MediaWiki:Common.js
Revision as of 11:06, 7 June 2021 by Jayprakash12345 (talk | contribs)
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
$( 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' );
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Indic-TechCom/Script/IndicOCR.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>').css( 'width', '100%').appendTo( sidebarCategory );
sel.append( $("<option>").attr('disabled', true).attr('selected', true).text( "-- Select an option --" ) );
catMemberParam = {
"action": "query",
"format": "json",
"list": "categorymembers",
"cmtitle": "Category: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) );
});
sel.on('change', function (e) {
var valueSelected = this.value;
window.location = "https://wiki.ekatrafoundation.org/wiki/Category:" + valueSelected;
});
});
} );
});
$( 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>' );
});
}
});