* http://www.modernmethod.com/sajax/
*/
-/*jshint camelcase:false, onevar:false */
+/*jshint camelcase:false */
/*global alert */
( function ( mw ) {
* with id = showFoo
*/
function doAjaxRequest( func_name, args, target ) {
- var i, x;
- var uri;
- var post_data;
+ var i, x, uri, post_data;
uri = mw.util.wikiScript() + '?action=ajax';
if ( window.sajax_request_type === 'GET' ) {
if ( uri.indexOf( '?' ) === -1 ) {
} else if ( typeof target === 'object' ) {
if ( target.tagName === 'INPUT' ) {
if ( x.status === 200 ) {
- target.value= x.responseText;
+ target.value = x.responseText;
}
//else alert( 'Error: ' + x.status + ' ' + x.statusText + ' (' + x.responseText + ')' );
} else {
* @return {boolean} Whether the browser supports AJAX
*/
function wfSupportsAjax() {
- var request = createXhr();
- var supportsAjax = request ? true : false;
+ var request = createXhr(),
+ supportsAjax = request ? true : false;
+
request = undefined;
return supportsAjax;
}
-// Expose
-
-// Configuration
-window.sajax_debug_mode = false;
-window.sajax_request_type = 'GET';
+// Expose + Mark as deprecated
+var deprecationNotice = 'Sajax is deprecated, use jQuery.ajax or mediawiki.api instead.';
+// Variables
+mw.log.deprecate( window, 'sajax_debug_mode', false, deprecationNotice );
+mw.log.deprecate( window, 'sajax_request_type', 'GET', deprecationNotice );
// Methods
-window.sajax_debug = debug;
-window.sajax_init_object = createXhr;
-window.sajax_do_call = doAjaxRequest;
-window.wfSupportsAjax = wfSupportsAjax;
+mw.log.deprecate( window, 'sajax_debug', debug, deprecationNotice );
+mw.log.deprecate( window, 'sajax_init_object', createXhr, deprecationNotice );
+mw.log.deprecate( window, 'sajax_do_call', doAjaxRequest, deprecationNotice );
+mw.log.deprecate( window, 'wfSupportsAjax', wfSupportsAjax, deprecationNotice );
}( mediaWiki ) );