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:35, 18 April 2018
726 bytes added
,
22:35, 18 April 2018
no edit summary
Line 106:
Line 106:
*/
*/
−
mw.hook('mw.uls.interface.language.change').add(function (
a
,
b
,
c
){
+
mw.hook('mw.uls.interface.language.change').add(function (
lang){
−
console
.
log
(
a
)
;
+
setCookie('lang', lang);
−
console
.
log
(
b
);
+
$.ajax({
−
console.log(c
);
+
url: 'api.php'
,
+
data: {
+
action: 'query'
,
+
meta: 'tokens',
+
format: 'json'
+
},
+
xhrFields: {
+
withCredentials: true
+
},
+
dataType: 'json'
+
}).done(function (data
){
+
$.ajax({
+
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