MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
$( function(){ | $( function(){ | ||
if( mw.config.get('wgIsMainPage') ){ | if( mw.config.get('wgIsMainPage') ){ | ||
Line 18: | Line 14: | ||
mw.loader.load( '/index.php?title=MediaWiki:Numerakri.js&action=raw&ctype=text/javascript' ); | mw.loader.load( '/index.php?title=MediaWiki:Numerakri.js&action=raw&ctype=text/javascript' ); | ||
}); | |||
$( function(){ | |||
var sidebarCategory = $("#p-Categories > .vector-menu-content"); | |||
sidebarCategory.empty(); | |||
mw.loader.using( [ 'mediawiki.api' ], function(){ | |||
var sel = $('<select>').appendTo( sidebarCategory ); | |||
catMemberParam = { | |||
"action": "query", | |||
"format": "json", | |||
"list": "categorymembers", | |||
"cmtitle": "Categories on EkatraWiki", | |||
"cmprop": "title", | |||
"cmtype": "subcat", | |||
"cmlimit": "500" | |||
}; | |||
(new mw.Api()).get( catMemberParam, { async: false } ).done(function ( resData ){ | |||
var catOptions = []; | |||
var members = resData.query.categorymembers; | |||
// Creating MenuItems array from Category Members | |||
members.forEach( function(it){ | |||
var ct = it.title.replace("Category:", ""); | |||
sel.append( $("<option>").attr('value', ct).text(ct) ); | |||
}); | |||
}); | |||
} ); | |||
}); | }); | ||
Revision as of 10:28, 7 June 2021
$( function(){
if( mw.config.get('wgIsMainPage') ){
$('#firstHeading').remove();
}
if( mw.config.get('wgUserName') === null ){
$('body').bind('cut copy', function(e) {
e.preventDefault();
});
} else {
$("#content").removeAttr("onmousedown");
$("#content").removeAttr("onselectstart");
}
mw.loader.load( '/index.php?title=MediaWiki:Numerakri.js&action=raw&ctype=text/javascript' );
});
$( function(){
var sidebarCategory = $("#p-Categories > .vector-menu-content");
sidebarCategory.empty();
mw.loader.using( [ 'mediawiki.api' ], function(){
var sel = $('<select>').appendTo( sidebarCategory );
catMemberParam = {
"action": "query",
"format": "json",
"list": "categorymembers",
"cmtitle": "Categories on EkatraWiki",
"cmprop": "title",
"cmtype": "subcat",
"cmlimit": "500"
};
(new mw.Api()).get( catMemberParam, { async: false } ).done(function ( resData ){
var catOptions = [];
var members = resData.query.categorymembers;
// Creating MenuItems array from Category Members
members.forEach( function(it){
var ct = it.title.replace("Category:", "");
sel.append( $("<option>").attr('value', ct).text(ct) );
});
});
} );
});
$( function(){
var poemElement = $(".Poem2-Ekatra");
if( poemElement.length ){
var poemText = poemElement.html();
var poemArray = poemText.split("\n");
poemElement.text("");
poemArray.forEach( function(i) {
poemElement.append( '<p style="text-indent: 3em;">' + i + '</p>' );
});
}
});