Open main menu
Home
Random
Log in
Settings
About wiki
Terms and conditions of use
wiki
Search
Changes
← Older edit
Newer edit →
MediaWiki:Common.js
(view source)
Revision as of 22:18, 18 April 2018
120 bytes removed
,
22:18, 18 April 2018
no edit summary
Line 70:
Line 70:
onSelect: function(lang){
onSelect: function(lang){
setCookie('lang', lang);
setCookie('lang', lang);
+
$.ajax({
+
url: 'api.php',
+
data: {
+
action: 'query',
+
meta: 'tokens',
+
format: 'json'
+
},
+
xhrFields: {
+
withCredentials: true
+
},
+
dataType: 'json'
+
}).done(function (data){
$.ajax({
$.ajax({
url: 'api.php',
url: 'api.php',
+
method: 'POST',
data: {
data: {
−
action: '
query
',
+
action: '
options
',
−
meta
: 'tokens
'
,
+
format
: '
json',
−
format
: '
json
'
+
token: data.query.
tokens
.csrftoken
,
+
optionname
: '
language
'
,
+
optionvalue: lang
},
},
xhrFields: {
xhrFields: {
Line 82:
Line 97:
dataType: 'json'
dataType: 'json'
}).done(function (data){
}).done(function (data){
−
$.ajax({
+
location.reload();
−
url: 'api.php',
−
method: 'POST',
−
data: {
−
action: 'options',
−
format: 'json',
−
token: data.query.tokens.csrftoken,
−
optionname: 'language',
−
optionvalue: lang
−
},
−
xhrFields: {
−
withCredentials: true
−
},
−
dataType: 'json'
−
}).done(function (data){
−
location.reload(
);
−
}
);
});
});
+
});
}
}
});
});
});
});
Mark.wooff
Bureaucrats
,
Administrators
55
edits