Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
(Created page with "→Any JavaScript here will be loaded for all users on every page load.: function test(){ console.log(1); } test();") |
|||
| (12 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | / | + | "use strict"; |
| − | + | $(document).ready(function () { | |
| − | function | + | function ajaxPOST(json) { |
| − | + | return new Promise(function (resolve, reject) { | |
| − | } | + | $.ajax({ |
| − | + | url: '/w/qc.php', | |
| + | type: 'POST', | ||
| + | data: json, | ||
| + | //contentType: 'application/json; charset=utf-8', | ||
| + | contentType: 'application/x-www-form-urlencoded', | ||
| + | success: function (data) { | ||
| + | resolve(data); | ||
| + | data=JSON.parse(data); | ||
| + | $('.mw-wiki-logo').css('background-image','url("/w/resources/assets/'+data.orga[0].abbr+'logo.png")'); | ||
| + | qc(data); | ||
| + | }, | ||
| + | error: function (err) { | ||
| + | reject(err); | ||
| + | } | ||
| + | }); | ||
| + | }); | ||
| + | } | ||
| + | ajaxPOST(RLCONF); | ||
| + | console.log('MediaWiki:Common.js'); | ||
| + | }); | ||
Latest revision as of 15:30, 3 January 2022
"use strict";
$(document).ready(function () {
function ajaxPOST(json) {
return new Promise(function (resolve, reject) {
$.ajax({
url: '/w/qc.php',
type: 'POST',
data: json,
//contentType: 'application/json; charset=utf-8',
contentType: 'application/x-www-form-urlencoded',
success: function (data) {
resolve(data);
data=JSON.parse(data);
$('.mw-wiki-logo').css('background-image','url("/w/resources/assets/'+data.orga[0].abbr+'logo.png")');
qc(data);
},
error: function (err) {
reject(err);
}
});
});
}
ajaxPOST(RLCONF);
console.log('MediaWiki:Common.js');
});