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 14:15, 18 April 2018
526 bytes added
,
14:15, 18 April 2018
no edit summary
Line 7:
Line 7:
var lang = getCookie('lang');
var lang = getCookie('lang');
−
console.log(
'
GCcollab lang
:
' + lang);
+
var apiURL =
'
https
:
//wiki.gccollab.ca/api
.
php
';
−
console
.
log('MediaWiki lang: ' + getCookie('wikilanguage
'
))
;
−
var
apiURL
=
'
https
:
//wiki
.
gccollab
.
ca/api
.
php
';
+
$.ajax({
+
url: apiURL,
+
data: {
+
action: 'query',
+
meta: 'tokens',
+
format: 'json'
+
},
+
xhrFields: {
+
withCredentials: true
+
},
+
dataType: 'json'
+
}).done(function (data){
+
console.log(data);
+
$.ajax({
+
url:
apiURL
,
+
method: 'POST',
+
data: {
+
action: 'options',
+
format: 'json
'
,
+
token
:
data
.
query
.
tokens
.
csrftoken,
+
optionname: 'language'
+
},
+
xhrFields: {
+
withCredentials: true
+
},
+
dataType:
'
json'
+
}).done(function (data){
+
console.log(data);
+
});
+
})
;
$.ajax({
$.ajax({
Mark.wooff
Bureaucrats
,
Administrators
55
edits