|
|
| Line 1: |
Line 1: |
|
| |
|
| mw.loader.load('//wiki.ekatrafoundation.org/index.php?title=User:Gurwinder/Edittool.js&action=raw&ctype=text/javascript');
| |
|
| |
| // Turn <span class="mw-charinsert">foo</span> into a button that inserts "foo"
| |
| // into the edit box:
| |
| $( function () {
| |
| $( 'span.mw-charinsert' ).wrap( function () {
| |
| var text = this.title || this.textContent;
| |
| var parts = text.split( '+' );
| |
| if ( text === '+' ) parts = [ text ];
| |
| var front = decodeURIComponent( parts[0] || '' );
| |
| var back = decodeURIComponent( parts[1] || '' );
| |
| return $( '<button>' ).click( function () {
| |
| insertTags( front, back, '' );
| |
| return false;
| |
| } );
| |
| } );
| |
| } );
| |
| $( function(){
| |
|
| |
| if (window.matchMedia("(max-width: 768px)").matches) {
| |
| if( mw.config.get("skin") !== "minerva" ){
| |
| const currWikiUrl = new URL(window.location.href);
| |
| currWikiUrl.searchParams.set('mobileaction', 'toggle_view_mobile');
| |
|
| |
| window.location.replace(currWikiUrl);
| |
| }
| |
| } else {
| |
| if( mw.config.get("skin") !== "vector" ){
| |
| const currWikiUrl = new URL(window.location.href);
| |
| currWikiUrl.searchParams.set('mobileaction', 'toggle_view_desktop');
| |
|
| |
| window.location.replace(currWikiUrl);
| |
| }
| |
| }
| |
|
| |
| if( mw.config.get('wgIsMainPage') ){
| |
| $('#firstHeading').remove();
| |
|
| |
| var mainpageLeft = $(".mainpage-left");
| |
| var mainpageRight = $(".mainpage-right");
| |
|
| |
| mainpageLeft.css("position", "relative");
| |
| mainpageRight.css("position", "relative");
| |
|
| |
| function animateLeft(){
| |
| mainpageRight.animate({'left': '15px'}, 1000, function(){
| |
| mainpageRight.animate( {"left": "0px" }, 1000, animateLeft() );
| |
| });
| |
| }
| |
| animateLeft();
| |
|
| |
| function animateRight(){
| |
| mainpageLeft.animate({'left': '-15px'}, 1000, function(){
| |
| mainpageLeft.animate( {"left": "0px" }, 1000, animateRight() );
| |
| });
| |
| }
| |
| animateRight();
| |
|
| |
| }
| |
|
| |
| if (
| |
| mw.config.get('wgPageName').includes('/') &&
| |
| mw.config.get('skin') !== 'minerva'
| |
| ) {
| |
|
| |
| var tempPageName =
| |
| mw.config.get('wgPageName').split('/')[0];
| |
|
| |
| var breadcrumb =
| |
| $('<div>')
| |
| .addClass('ekatra-breadcrumb')
| |
| .css({
| |
| 'font-size': '17px',
| |
| 'margin-bottom': '8px'
| |
| });
| |
|
| |
| breadcrumb.html(
| |
| '< <a href="/index.php/' +
| |
| tempPageName +
| |
| '">' +
| |
| tempPageName.replaceAll('_', ' ') +
| |
| '</a>'
| |
| );
| |
|
| |
| $('#firstHeading').before(breadcrumb);
| |
| }
| |
|
| |
| 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:OCR.js&action=raw&ctype=text/javascript');
| |
| mw.loader.load( '/index.php?title=MediaWiki:PoemButtons.js&action=raw&ctype=text/javascript');
| |
| }
| |
|
| |
|
| |
| if( $(".wikiaudioplayer").length ){
| |
| mw.loader.load( '/index.php?title=MediaWiki:Green-audio-player.min.css&action=raw&ctype=text/css', 'text/css');
| |
| $.when(
| |
| mw.loader.getScript( 'https://wiki.ekatrafoundation.org/index.php?title=MediaWiki:Green-audio-player.min.js&action=raw&ctype=text/javascript' )
| |
| )
| |
| .then(
| |
| function () {
| |
| GreenAudioPlayer.init({
| |
| selector: '.wikiaudioplayer',
| |
| stopOthersOnPlay: true
| |
| });
| |
| $( ".wikiaudioplayer > audio").css("display", "none");
| |
| },
| |
| function ( e ) {
| |
| mw.log.error( e.message );
| |
| }
| |
| );
| |
| }
| |
|
| |
| });
| |
|
| |
| $( function(){
| |
| var sidebarCategory = $("#p-Categories > .vector-menu-content");
| |
| var sidebarAuthor = $("#p-Authors > .vector-menu-content");
| |
| sidebarCategory.empty();
| |
| sidebarAuthor.empty();
| |
|
| |
| mw.loader.using( [ 'mediawiki.api' ], function(){
| |
| var sel1 = $('<select>').css( 'width', '100%').appendTo( sidebarCategory );
| |
| var sel2 = $('<select>').css( 'width', '100%').appendTo( sidebarAuthor );
| |
| sel1.append( $("<option>").attr('disabled', true).attr('selected', true).text( "-- Select an option --" ) );
| |
| sel2.append( $("<option>").attr('disabled', true).attr('selected', true).text( "-- Select an option --" ) );
| |
|
| |
| // For category Categories
| |
| catMemberParam1 = {
| |
| "action": "query",
| |
| "format": "json",
| |
| "list": "categorymembers",
| |
| "cmtitle": "Category:Categories on EkatraWiki",
| |
| "cmprop": "title",
| |
| "cmtype": "subcat",
| |
| "cmlimit": "500"
| |
| };
| |
| (new mw.Api()).get( catMemberParam1, { 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:", "");
| |
| sel1.append( $("<option>").attr('value', ct).text(ct) );
| |
| });
| |
|
| |
| sel1.on('change', function (e) {
| |
| var valueSelected = this.value;
| |
| window.location = "https://wiki.ekatrafoundation.org/wiki/Category:" + valueSelected;
| |
| });
| |
| });
| |
|
| |
| // For category Author
| |
| catMemberParam2 = {
| |
| "action": "query",
| |
| "format": "json",
| |
| "list": "categorymembers",
| |
| "cmtitle": "Category:Authors on EkatraWiki",
| |
| "cmprop": "title",
| |
| "cmtype": "subcat",
| |
| "cmlimit": "500"
| |
| };
| |
| (new mw.Api()).get( catMemberParam2, { 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:", "");
| |
| sel2.append( $("<option>").attr('value', ct).text(ct) );
| |
| });
| |
|
| |
| sel2.on('change', function (e) {
| |
| var valueSelected = this.value;
| |
| window.location = "https://wiki.ekatrafoundation.org/wiki/Category:" + valueSelected;
| |
| });
| |
| });
| |
| } );
| |
|
| |
|
| |
| });
| |
|
| |
| // Long list into col
| |
| $( document ).ready( function(){
| |
|
| |
| var longList = $("#longList").addClass("grid_row"),
| |
| dlElements = longList.children().filter("dl"),
| |
| dlElementsLength = dlElements.length;
| |
|
| |
| var list1 = [],
| |
| list2 = [];
| |
|
| |
| var count = 0;
| |
| dlElements.each( function(index, ele){
| |
| if( count < dlElementsLength/2 ){
| |
| list1.push(ele);
| |
| list1.push( $(ele).next() );
| |
| } else {
| |
| list2.push(ele);
| |
| list2.push( $(ele).next() );
| |
| }
| |
| count = count + 1;
| |
| });
| |
|
| |
| longList.empty();
| |
|
| |
| var leftDiv = $("<div/>").addClass("grid_col");
| |
| list1.forEach( function(value, index){
| |
| leftDiv.append(value);
| |
| });
| |
|
| |
|
| |
| var rightDiv = $("<div/>").addClass("grid_col");
| |
| list2.forEach( function(value, index){
| |
| rightDiv.append(value);
| |
| });
| |
|
| |
| longList.append(leftDiv, rightDiv );
| |
|
| |
| });
| |
|
| |
|
| |
| $( function(){
| |
|
| |
| var countPoem2 = $(".Poem2-Ekatra");
| |
|
| |
| if( countPoem2.length > 0 ){
| |
|
| |
| var Poem2lenghtArray = [];
| |
| for (var k = 0; k <= countPoem2.length; k++) {
| |
| Poem2lenghtArray.push(k);
| |
| }
| |
|
| |
| Poem2lenghtArray.forEach(function(j) {
| |
|
| |
| var poemElement = $(".Poem2-Ekatra").eq(j);
| |
|
| |
| if( poemElement.length ){
| |
| var poemText = poemElement.html();
| |
|
| |
| var poemArray = poemText.split("\n");
| |
|
| |
| poemElement.text("");
| |
|
| |
| // First measure
| |
| poemArray.forEach( function(i) {
| |
| poemElement.append( '<p style="text-indent: 2em;">' + i + '</p>' );
| |
| });
| |
|
| |
| // Second measure
| |
| poemElement.children('p').each(function () {
| |
| $(this).css('text-indent', '2em');
| |
| });
| |
| }
| |
|
| |
| });
| |
| }
| |
|
| |
| });
| |
|
| |
| $( function() {
| |
| var divide2cols = $("#divide2cols");
| |
| if( divide2cols.length ){
| |
| var leftDiv = $("<div/>").addClass("grid_col");
| |
| var rightDiv = $("<div/>").addClass("grid_col");
| |
| var parentHieght = divide2cols.height()/2;
| |
| divide2cols.children().filter("dl").each(function() {
| |
| console.log( $(this).offset().top , parentHieght );
| |
| if ( $(this).offset().top > parentHieght ) {
| |
| rightDiv.append( $(this), $(this).next() );
| |
| } else {
| |
| leftDiv.append( $(this), $(this).next() );
| |
| }
| |
| });
| |
| divide2cols.before( $("<div/>").addClass("grid_row").append(leftDiv, rightDiv) );
| |
| divide2cols.remove();
| |
| }
| |
| });
| |
|
| |
|
| |
| $(function () {
| |
| var useCustom = false;
| |
|
| |
| var zoomInSVG =
| |
| '<svg width="22" height="22" viewBox="0 0 24 24">' +
| |
| '<path d="M15.5 14h-.8l-.3-.3a6.5 6.5 0 1 0-.7.7l.3.3v.8L20 21.5 21.5 20z ' +
| |
| 'M10 14a4 4 0 1 1 0-8 4 4 0 0 1 0 8z ' +
| |
| 'M11 7H9v2H7v2h2v2h2v-2h2V9h-2z"/>' +
| |
| '</svg>';
| |
|
| |
| var zoomOutSVG =
| |
| '<svg width="22" height="22" viewBox="0 0 24 24">' +
| |
| '<path d="M15.5 14h-.8l-.3-.3a6.5 6.5 0 1 0-.7.7l.3.3v.8L20 21.5 21.5 20z ' +
| |
| 'M7 9h6v2H7z"/>' +
| |
| '</svg>';
| |
|
| |
| var toggleSVG =
| |
| '<svg width="22" height="22" viewBox="0 0 24 24">' +
| |
| '<path d="M5 4h14v2H5zm4 4h6l-2 12h-2z"/>' +
| |
| '</svg>';
| |
|
| |
| $('#content').prepend(
| |
| '<div id="zoomButtons" style="z-index:9999; float:right; display:flex; gap:2px; cursor:pointer;">' +
| |
| '<span id="zoomInIcon">' + zoomInSVG + '</span>' +
| |
| '<span id="zoomOutIcon">' + zoomOutSVG + '</span>' +
| |
| '<span id="toggleButton">' + toggleSVG + '</span>' +
| |
| '</div>'
| |
| );
| |
|
| |
| var $bodyContent = $('.mw-body-content');
| |
|
| |
| var sizes = [parseFloat($bodyContent.css('font-size'))];
| |
| sizes[1] = sizes[0] + 2;
| |
|
| |
| function updateSize() {
| |
| $bodyContent.css('font-size', sizes[+useCustom] + 'pt');
| |
| }
| |
|
| |
| function toggle() {
| |
| useCustom = !useCustom;
| |
| updateSize();
| |
| }
| |
|
| |
| function zoom(dif) {
| |
| sizes[1] += dif;
| |
| if (useCustom) {
| |
| updateSize();
| |
| } else {
| |
| toggle();
| |
| }
| |
| }
| |
|
| |
| $('#zoomInIcon').on('click', function () {
| |
| zoom(1);
| |
| });
| |
|
| |
| $('#zoomOutIcon').on('click', function () {
| |
| zoom(-1);
| |
| });
| |
|
| |
| $('#toggleButton').on('click', toggle);
| |
| });
| |
|
| |
|
| |
|
| |
| /**
| |
| * Convert numbers between numeral systems.
| |
| *
| |
| * Dependencies: jquery.cookie, mediawiki.util, mediawiki.user
| |
| * Source: https://www.mediawiki.org/wiki/MediaWiki:Gadget-Numerakri.js
| |
| * Revision: 2019-01-11
| |
| *
| |
| * @copyright 2012 Daniel Friesen
| |
| * @copyright 2012 Siddhartha Ghai
| |
| * @copyright 2014 Bhawani Gautam
| |
| * @copyright 2012-2018 Timo Tijhof
| |
| * @license <https://opensource.org/licenses/MIT>
| |
| */
| |
| /*jshint browser:true, unused:true, forin:false */
| |
| /*global $, mw */
| |
| (function () {
| |
| 'use strict';
| |
|
| |
| var msgs = {
| |
| 'option-default': {
| |
| en: 'Default',
| |
| bho: 'डिफ़ॉल्ट',
| |
| gu: 'ડિફોલ્ટ',
| |
| hi: 'डिफ़ॉल्ट',
| |
| ne: 'डिफल्ट',
| |
| pa: 'ਅਸਲ ਦਿੱਖ',
| |
| sa: 'उत्सर्गः'
| |
| },
| |
| 'option-arabic': {
| |
| en: '1 2 3'
| |
| },
| |
| 'option-devanagari': {
| |
| en: 'Devanagari',
| |
| bho: '१२३',
| |
| hi: '१२३',
| |
| ne: '१२३',
| |
| sa: '१२३'
| |
| },
| |
| 'option-gujarati': {
| |
| en: '૧ ૨ ૩',
| |
| gu: '૧ ૨ ૩'
| |
| },
| |
| 'option-gurmukhi': {
| |
| en: 'Gurmukhi',
| |
| pa: '੧੨੩'
| |
| },
| |
| 'label-url': {
| |
| en: '//www.mediawiki.org/wiki/MediaWiki_talk:Gadget-Numerakri.js',
| |
| gu: '//gu.wikipedia.org/wiki/વિકિસૂક્તિઃઅંક_પરિવર્તક',
| |
| hi: '//hi.wikipedia.org/wiki/विकिपीडिया:अंक_परिवर्तक',
| |
| ne: '//ne.wikipedia.org/wiki/विकिपीडिया:अंक_परिवर्तक',
| |
| pa: '//pa.wikipedia.org/wiki/ਵਿਕੀਪੀਡੀਆ:ਅੰਕ ਬਦਲੋ',
| |
| sa: '//sa.wikipedia.org/wiki/विकिपीडिया:अङ्कपरिवर्तकम्'
| |
| },
| |
| 'label-text': {
| |
| en: 'Convert numerals',
| |
| bho: 'अंक बदलाव',
| |
| gu: 'અંક પરિવર્તક',
| |
| hi: 'अंक परिवर्तन',
| |
| ne: 'अंक परिवर्तन',
| |
| pa: 'ਅੰਕ ਬਦਲੋ',
| |
| sa: 'अङ्कपरिवर्तकम्'
| |
| },
| |
| 'label-tooltip': {
| |
| en: 'Convert between Arabic and Devanagari numerals',
| |
| bho: 'नागरी आ अरबी अंकों में अदला-बदली करीं',
| |
| gu: 'ગુજરાતી અને અંગ્રેજી અંકોમાં પરિવર્તન કરો',
| |
| hi: 'नागरी और अरबी अंकों में परिवर्तन करें',
| |
| ne: 'देवनागरी र अरबी अंकहरूमा परिवर्तन गर्नुहोस्',
| |
| pa: 'ਅੰਕਾਂ ਨੂ ਗੁਰਮੁਖੀ ਤੇ ਅਰਬੀ ਵਿਚ ਬਦਲੇਂ',
| |
| sa: 'देवनागरी-अरबी-अङ्कयोः चयनं करोतु'
| |
| }
| |
| },
| |
| maps = {
| |
| arabic: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
| |
| devanagari: ['०', '१', '२', '३', '४', '५', '६', '७', '८', '९'],
| |
| gujarati: ['૦', '૧', '૨', '૩', '૪', '૫', '૬', '૭', '૮', '૯'],
| |
| gurmukhi: ['੦', '੧', '੨', '੩', '੪', '੫', '੬', '੭', '੮', '੯']
| |
| },
| |
| availableMaps,
| |
| currentType = 'default',
| |
| matchers = {},
| |
| walker,
| |
| styleTag;
| |
|
| |
| function isValidType(type) {
| |
| return type === 'default' || availableMaps.indexOf(type) !== -1;
| |
| }
| |
|
| |
| /** @return {Object.<RegExp>} */
| |
| function getMatchers(targetType) {
| |
| var rChars;
| |
| if (!matchers[targetType]) {
| |
| rChars = { 0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [] };
| |
| $.each(maps, function (type, map) {
| |
| if (type !== targetType) {
| |
| for (var i = 0; i <= 9; i++) {
| |
| rChars[i].push(map[i]);
| |
| }
| |
| }
| |
| });
| |
| $.each(rChars, function (num, chars) {
| |
| rChars[num] = new RegExp('(' + chars.map(mw.RegExp.escape).join('|') + ')', 'g');
| |
| });
| |
| matchers[targetType] = rChars;
| |
| }
| |
| return matchers[targetType];
| |
| }
| |
|
| |
| function msg(key) {
| |
| return msgs[key][mw.config.get('wgUserLanguage')] || msgs[key].en;
| |
| }
| |
|
| |
| /**
| |
| * @param {HTMLElement|TextNode} node
| |
| * @return {number} NodeFilter.FILTER_* constant
| |
| */
| |
| function filterNode(node) {
| |
| if (node.nodeType === Node.TEXT_NODE) {
| |
| return NodeFilter.FILTER_ACCEPT;
| |
| }
| |
| var n = node.nodeName && node.nodeName.toLowerCase();
| |
| if (n === 'input' || n === 'textarea' || $(node).hasClass('mw-numerakri-skip')) {
| |
| // Skip this element and skip its children
| |
| return NodeFilter.FILTER_REJECT;
| |
| }
| |
| // Skip this element, but check its children
| |
| return NodeFilter.FILTER_SKIP;
| |
| }
| |
|
| |
| /**
| |
| * @param {TextNode} node
| |
| */
| |
| function handleTextNode(node) {
| |
| var original = node.nodeValue,
| |
| changed = original,
| |
| matchers = getMatchers(currentType),
| |
| i = 0;
| |
| for (; i <= 9; i++) {
| |
| changed = changed.replace(matchers[i], maps[currentType][i]);
| |
| }
| |
| if (original !== changed) {
| |
| node.nodeValue = changed;
| |
| }
| |
| }
| |
|
| |
| // https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw-method-requestIdleCallback
| |
| function idleWalker(deadline) {
| |
| var el;
| |
| if (!walker) {
| |
| return;
| |
| }
| |
| while (deadline.timeRemaining() > 0) {
| |
| el = walker.nextNode();
| |
| if (!el) {
| |
| // Reached the end
| |
| walker = null;
| |
| return;
| |
| }
| |
| handleTextNode(el);
| |
| }
| |
|
| |
| // The user may interact with the page. We pause so the browser can process
| |
| // interaction. The text handler will continue after that.
| |
| if (walker) {
| |
| mw.requestIdleCallback(idleWalker);
| |
| }
| |
| }
| |
|
| |
| /**
| |
| * Save a browser cookie for 30 days, or remove it.
| |
| * @param {string|null} value
| |
| */
| |
| function saveType(value) {
| |
| mw.requestIdleCallback(function () {
| |
| $.cookie('mw-numerakri-type', value, { expires: 30, path: '/' });
| |
| });
| |
| }
| |
|
| |
| /**
| |
| * @return {string}
| |
| */
| |
| function getStoredType() {
| |
| var value = $.cookie('mw-numerakri-type');
| |
| if (value !== null && !isValidType(value)) {
| |
| // Remove bad cookie
| |
| saveType(null);
| |
| value = null;
| |
| }
| |
|
| |
| return value || 'default';
| |
| }
| |
|
| |
| function startPageConversion() {
| |
| if (styleTag) {
| |
| // Undo style for a previously selected type
| |
| $(styleTag).remove();
| |
| styleTag = null;
| |
| }
| |
|
| |
| if (currentType === 'default') {
| |
| // Don't change the page
| |
| return;
| |
| }
| |
|
| |
| if (currentType === 'arabic') {
| |
| styleTag = mw.loader.addStyleTag('.mw-parser-output ol, ol.references, li.references { list-style-type: decimal; }');
| |
| } else if (currentType === 'devanagari') {
| |
| styleTag = mw.loader.addStyleTag('.mw-parser-output ol, ol.references, li.references { list-style-type: devanagari; }');
| |
| }
| |
|
| |
| // If a walker is already active, replace it.
| |
| // If no walker is active yet, start it.
| |
| if (!walker) {
| |
| mw.requestIdleCallback(idleWalker);
| |
| }
| |
| walker = document.createTreeWalker(document.body, NodeFilter.SHOW_ALL, filterNode, false);
| |
| }
| |
|
| |
| /** @return {HTMLElement} */
| |
| function createSelector() {
| |
| var $select = $('<select>').addClass('mw-numerakri-skip').append(
| |
| $('<option>').val('default').text(msg('option-default'))
| |
| );
| |
| availableMaps.forEach(function (type) {
| |
| $select.append($('<option>').val(type).text(msg('option-' + type)));
| |
| });
| |
| $select.val(currentType);
| |
| $select.on('change', function () {
| |
| currentType = this.value;
| |
| startPageConversion();
| |
| saveType(currentType);
| |
| });
| |
| return $select[0];
| |
| }
| |
|
| |
| function init() {
| |
| var potlet, menu;
| |
|
| |
| // Decide which types to show
| |
| availableMaps = ['gujarati', 'arabic'];
| |
|
| |
| // Decide selected type
| |
| currentType = getStoredType();
| |
| startPageConversion();
| |
|
| |
| potlet = mw.util.addPortletLink(
| |
| 'p-personal',
| |
| msg('label-url'),
| |
| msg('label-text'),
| |
| 'pt-numconvert',
| |
| msg('label-tooltip'),
| |
| null,
| |
| mw.user.isAnon() ? '#pt-createaccount' : '#pt-userpage'
| |
| );
| |
| menu = $('<div>').addClass('mw-numerakri-menu').append(createSelector())[0];
| |
| if(potlet) {
| |
| potlet.appendChild(menu);
| |
| }
| |
| }
| |
|
| |
| $(function () {
| |
| mw.requestIdleCallback(init);
| |
| });
| |
| }());
| |
|
| |
| /* Any JavaScript here will be loaded for all users on every page load. */
| |
|
| |
| self.ws_messages = {
| |
| 'iwtrans':'Its text comes from',
| |
| 'iwtrans2':'Its text comes from other sub-domains.',
| |
| 'optlist':'Display options',
| |
| 'hide_page_numbers':'Hide page links',
| |
| 'show_page_numbers':'Show page links',
| |
| 'layout':'Layout',
| |
| 'author':'Author',
| |
| 'translator':'Translator',
| |
| 'editor':'Editor',
| |
| 'publisher':'Publisher',
| |
| 'place':'Place',
| |
| 'volume':'Volume',
| |
| 'school':'School',
| |
| 'book':'Book',
| |
| 'collection':'Collection',
| |
| 'journal':'Journal or magazine',
| |
| 'phdthesis':'Thesis, report',
| |
| 'dictionary':'Dictionary',
| |
| 'progress':'Progress',
| |
| 'progress_T':'Done',
| |
| 'progress_V':'To be validated',
| |
| 'progress_C':'To be proofread',
| |
| 'progress_MS':'Ready for Match & Split',
| |
| 'progress_OCR':'Needs an OCR text layer',
| |
| 'progress_L':'Source file is incorrect (missing pages, unordered pages, etc)',
| |
|
| |
| 'page_namespace_name': 'Page',
| |
| 'page_trascluded_in': 'Page trascluded in:',
| |
| 'text_number': 'Text',
| |
|
| |
| 'compare_with': 'Comparison with:',
| |
| 'compare_texts': 'Compare texts'
| |
| };
| |
|
| |
| $.getScript( '//wiki.ekatrafoundation.org/index.php?title=MediaWiki:Base.js&action=raw&ctype=text/javascript' )
| |
| .done( function() {
| |
| importScript('MediaWiki:InterWikiTransclusion.js');
| |
| importScript('MediaWiki:TranscludedIn.js');
| |
| importScript('MediaWiki:Compare.js');
| |
| } );
| |
| /* Footnotes as tooltip - from it.wikipedia.org - request by Candalua */
| |
|
| |
| $( function ()
| |
| {
| |
| sups = document.getElementsByTagName("sup");
| |
| for (i=0; i<sups.length; i++)
| |
| {
| |
| note_id = sups[i].childNodes[0].href;
| |
| if (note_id && (note_id.indexOf("#") != -1))
| |
| {
| |
| note_id = document.getElementById(note_id.substr(note_id.indexOf("#")+1));
| |
| if (note_id)
| |
| if (document.all)
| |
| {
| |
| sups[i].title = note_id.innerText;
| |
| sups[i].childNodes[0].title = note_id.innerText;
| |
| }
| |
| else
| |
| {
| |
| sups[i].title = note_id.textContent;
| |
| }
| |
| }
| |
| }
| |
| });
| |
|
| |
| // Add links to Wikidata in the toolbar where [[Module:Interwiki]] is used
| |
| $("#t-wikibase").insertBefore($("#p-tb li").last()).removeAttr("style");
| |
|
| |
| // Code to switch sizes for {{Tscore resizable}}
| |
| $( function ()
| |
| {
| |
| el = document.getElementsByClassName("prp-page-content");
| |
| if (el.length) {
| |
| maxwidth = el[0].clientWidth;
| |
| } else {
| |
| maxwidth = document.getElementById("mw-content-text").clientWidth;
| |
| }
| |
| screslistslist = document.getElementsByClassName("score-resizable-container");
| |
| scressizelist = [];
| |
| for (i = 0; i < screslistslist.length; i++) {
| |
| //maxwidth = screslistslist[i].parentNode.clientWidth;
| |
| screslist = screslistslist[i].getElementsByClassName("score-resizable");
| |
| fitwidth = 0;
| |
| fitelement = -1;
| |
| for (j = 0; j < screslist.length; j++) {
| |
| s = screslist[j].className.match(/score-resizable-size-\d+/);
| |
| scressizelist[j] = parseInt(s[0].match(/\d+/), 10);
| |
| //find largest score that has width < parent width
| |
| if (scressizelist[j] > fitwidth && scressizelist[j] <= maxwidth) {
| |
| fitwidth = scressizelist[j];
| |
| fitelement = j;
| |
| }
| |
| }
| |
| if (fitelement < 0) {
| |
| fitelement = 0;
| |
| }
| |
| for (j = 0; j < screslist.length; j++) {
| |
| if (j != fitelement) {
| |
| screslist[j].style.display = "none";
| |
| }
| |
| }
| |
| screslist[fitelement].style.display = "block";
| |
| }
| |
| });
| |
|
| |
| // Wait for the mediawiki.user module to load
| |
| mw.loader.using('mediawiki.user').then(function() {
| |
| // Now mw.user.isAnon() exists safely
| |
| if (mw.user.isAnon()) {
| |
| // Wait until the DOM is ready
| |
| $(function() {
| |
| $('.ext-wikisource-download-button').hide();
| |
| });
| |
| }
| |
| });
| |
|
| |
|
| |
| $(document).ready(function() {
| |
| // Get the page title
| |
| var pageTitle = mw.config.get('wgTitle');
| |
|
| |
| // Encode the title and replace spaces with '%20'
| |
| var encodedTitle = encodeURIComponent(pageTitle).replace(/%20/g, '%20'); // Correctly handle spaces
| |
|
| |
| // Create the download button
| |
| var downloadButton = $('<a>')
| |
| .attr('href', 'https://wiki.ekatrafoundation.org/images/epub/' + encodedTitle + '.epub')
| |
| .attr('download', '') // Suggests to download the file rather than opening it
| |
| .text('Download EPUB')
| |
| .css({
| |
| 'display': 'inline-block',
| |
| 'padding': '8px 16px',
| |
| 'background-color': '#4CAF50',
| |
| 'color': '#ffffff',
| |
| 'text-align': 'center',
| |
| 'border-radius': '4px',
| |
| 'text-decoration': 'none',
| |
| 'margin-top': '10px'
| |
| });
| |
|
| |
| // Add the button to the page content
| |
| $('#bodyContent').append(downloadButton);
| |
| });
| |
|
| |
|
| |
| $(document).ready(function() {
| |
| // Get the page title from the MediaWiki configuration
| |
| var pageTitle = mw.config.get('wgTitle');
| |
|
| |
| // Check if the page title contains a forward slash
| |
| if (pageTitle.indexOf('/') === -1) {
| |
| // Show the download button if it's a top-level page
| |
| $('a[href*="/find_epub.php"]').show();
| |
| } else {
| |
| // Hide the download button if it's a subpage
| |
| $('a[href*="/find_epub.php"]').hide();
| |
| }
| |
| });
| |
|
| |
|
| |
|
| |
| $(document).ready(function() {
| |
| var $element = $('#editpage-specialchars');
| |
| var isDragging = false;
| |
| var startX, startY, initialX, initialY;
| |
|
| |
| $element.on('mousedown', function(e) {
| |
| isDragging = true;
| |
| startX = e.clientX;
| |
| startY = e.clientY;
| |
| initialX = $element.offset().left;
| |
| initialY = $element.offset().top;
| |
| $element.addClass('dragging');
| |
| });
| |
|
| |
| $(document).on('mousemove', function(e) {
| |
| if (isDragging) {
| |
| var dx = e.clientX - startX;
| |
| var dy = e.clientY - startY;
| |
| $element.css({
| |
| top: initialY + dy + 'px',
| |
| left: initialX + dx + 'px'
| |
| });
| |
| }
| |
| });
| |
|
| |
| $(document).on('mouseup', function() {
| |
| if (isDragging) {
| |
| isDragging = false;
| |
| $element.removeClass('dragging');
| |
| }
| |
| });
| |
| });
| |
|
| |
| // ==UserScript==
| |
| // @name MediaWiki Smart Single Quotes
| |
| // @namespace http://your.local/
| |
| // @version 1.0
| |
| // @description Convert straight single quotes to typographic single quotes on MediaWiki pages (visual only).
| |
| // @match https://ekatra-wiki.eastus2.cloudapp.azure.com/*
| |
| // @grant none
| |
| // ==/UserScript==
| |
|
| |
| (function () {
| |
| 'use strict';
| |
|
| |
| function convertSingleQuotesText(text) {
| |
| if (!text || text.indexOf("'") === -1) return text;
| |
| text = text.replace(/([A-Za-z0-9])'([A-Za-z0-9])/g, "$1’$2"); // contractions/possessives
| |
| text = text.replace(/(^|[\s\(\[\{\<\u2014\u2013"“'«])'(?=\S)/g, "$1‘"); // opening quotes
| |
| text = text.replace(/'/g, "’"); // remaining closing quotes
| |
| return text;
| |
| }
| |
|
| |
| function walkAndReplace(root) {
| |
| if (!root) return;
| |
| try {
| |
| var walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, null, false);
| |
| var n;
| |
| var blacklist = new Set(["CODE", "PRE", "SCRIPT", "STYLE", "TEXTAREA", "NOSCRIPT", "MATH", "INPUT"]);
| |
| while ((n = walker.nextNode())) {
| |
| var parent = n.parentNode;
| |
| if (!parent) continue;
| |
| var anc = parent, skip = false;
| |
| while (anc && anc.nodeType === 1) {
| |
| if (blacklist.has(anc.nodeName)) { skip = true; break; }
| |
| anc = anc.parentNode;
| |
| }
| |
| if (skip) continue;
| |
| var orig = n.nodeValue;
| |
| var rep = convertSingleQuotesText(orig);
| |
| if (rep !== orig) n.nodeValue = rep;
| |
| }
| |
| } catch (e) {
| |
| console.error('smartQuotes error', e);
| |
| }
| |
| }
| |
|
| |
| function applyOnce() {
| |
| var root = document.querySelector('.mw-parser-output') || document.body;
| |
| walkAndReplace(root);
| |
| }
| |
|
| |
| // run after window.load, also watch for AJAX content
| |
| window.addEventListener('load', function () {
| |
| setTimeout(applyOnce, 150);
| |
| var obs = new MutationObserver(function (mutations) {
| |
| mutations.forEach(function (m) {
| |
| m.addedNodes && m.addedNodes.forEach(function (n) {
| |
| if (n.nodeType === 1) walkAndReplace(n);
| |
| else if (n.nodeType === 3 && n.parentNode) walkAndReplace(n.parentNode);
| |
| });
| |
| });
| |
| });
| |
| obs.observe(document.body, { childList: true, subtree: true });
| |
| }, false);
| |
| })();
| |
| /*--------------------------------------------------21-05-2026---------------------------*/
| |
| /* Remove Convert Numerals from mobile menu */
| |
|
| |
| mw.loader.using( ['mediawiki.util'] ).then( function () {
| |
|
| |
| function removeNumeralMenu() {
| |
|
| |
| // Mobile only
| |
| if ( mw.config.get('skin') !== 'minerva' ) {
| |
| return;
| |
| }
| |
|
| |
| // Remove menu item
| |
| $('#pt-numconvert').remove();
| |
|
| |
| }
| |
|
| |
| // Run multiple times because gadget loads late
| |
| $(document).ready(function () {
| |
|
| |
| removeNumeralMenu();
| |
|
| |
| setTimeout(removeNumeralMenu, 1000);
| |
| setTimeout(removeNumeralMenu, 2000);
| |
| setTimeout(removeNumeralMenu, 4000);
| |
|
| |
| });
| |
|
| |
| });
| |
| /*--------------------------------------------------21-05-2026---------------------------*/
| |
| /*
| |
| *
| |
| * ---------------------------------------------------------
| |
| * Ekatra Wiki - Breadcrumb + Heading Handling
| |
| * ---------------------------------------------------------
| |
| */
| |
|
| |
| $(document).ready(function () {
| |
|
| |
| var breadcrumb = $('.ekatra-breadcrumb').first();
| |
|
| |
| var heading = $('#firstHeading');
| |
|
| |
| if (!breadcrumb.length || !heading.length) {
| |
| return;
| |
| }
| |
|
| |
| var breadcrumbText = breadcrumb.text().trim()
| |
| .replace(/^<\s*/, '');
| |
|
| |
| var headingText = heading.text().trim();
| |
|
| |
| // Extract first path part
| |
| var headingRoot = headingText.split('/')[0].trim();
| |
|
| |
| // SAME ROOT PAGE
| |
| if (breadcrumbText === headingRoot) {
| |
|
| |
| heading.hide();
| |
|
| |
| breadcrumb.css({
| |
| 'border-bottom': 'none',
| |
| 'margin-bottom': '0',
| |
| 'padding-bottom': '0'
| |
| });
| |
|
| |
| }
| |
|
| |
| // DIFFERENT ROOT
| |
| else {
| |
|
| |
| breadcrumb.css({
| |
| 'border-bottom': '1px solid #a2a9b1',
| |
| 'padding-bottom': '8px',
| |
| 'margin-bottom': '12px'
| |
| });
| |
|
| |
| }
| |
|
| |
| });
| |
|
| |
| /*----------------------------------25-05-2026-------------------------------*/
| |
| $(function () {
| |
|
| |
| // Wait until page fully loads
| |
| setTimeout(function () {
| |
|
| |
| // Avoid duplicate icon
| |
| if ($('#custom-share-icon').length) {
| |
| return;
| |
| }
| |
|
| |
| // Create share icon
| |
| const shareIcon = $(`
| |
| <span id="custom-share-icon"
| |
| class="minerva-icon minerva-icon--share"
| |
| style="
| |
| cursor:pointer;
| |
| width:32px;
| |
| height:32px;
| |
| display:inline-flex;
| |
| align-items:center;
| |
| justify-content:center;
| |
| ">
| |
| </span>
| |
| `);
| |
|
| |
| /* Desktop */
| |
|
| |
| if ( mw.config.get('skin') !== 'minerva' ) {
| |
|
| |
| $('#toggleButton').after(shareIcon);
| |
|
| |
| }
| |
|
| |
| /* Mobile */
| |
|
| |
| else {
| |
|
| |
| var shareLi = $('<li class="page-actions-menu__list-item" id="custom-share-li">')
| |
| .append(shareIcon);
| |
|
| |
| // If 3-dot menu exists
| |
| if ($('#page-actions-overflow').length) {
| |
|
| |
| $('#page-actions-overflow').closest('li').before(shareLi);
| |
|
| |
| }
| |
|
| |
| // Fallback for logged-out users
| |
| else {
| |
|
| |
| $('.page-actions-menu__list').append(shareLi);
| |
|
| |
| }
| |
|
| |
| }
| |
|
| |
| // Trigger original share button
| |
| /*$('#custom-share-icon').on('click', function () {
| |
|
| |
| $('#top-share-button button').trigger('click');
| |
|
| |
| });*/
| |
|
| |
| $('#custom-share-icon').on('click', function () {
| |
|
| |
| // Mobile
| |
| if (mw.config.get('skin') === 'minerva') {
| |
|
| |
| $('#top-share-button button').trigger('click');
| |
|
| |
| }
| |
|
| |
| // Desktop
| |
| else {
| |
|
| |
| if (navigator.share) {
| |
|
| |
| navigator.share({
| |
| title: document.title,
| |
| url: window.location.href
| |
| });
| |
|
| |
| } else {
| |
|
| |
| navigator.clipboard.writeText(window.location.href);
| |
|
| |
| alert('Page link copied');
| |
|
| |
| }
| |
|
| |
| }
| |
|
| |
| });
| |
|
| |
| // Hide original floating share button ONLY
| |
| $('#top-share-button').hide();
| |
|
| |
| }, 500);
| |
|
| |
| });
| |
|
| |
| /*-------------------------------------swati---------------------------*/
| |
| mw.hook('wikipage.content').add(function () {
| |
|
| |
| if (
| |
| mw.config.get('skin') !== 'minerva' ||
| |
| mw.config.get('wgPageName') !== 'એકત્ર_ગ્રંથાલય' ||
| |
| window.innerWidth > 768
| |
| ) {
| |
| return;
| |
| }
| |
|
| |
| var section = $('.mf-section-0');
| |
|
| |
| // Target paragraph
| |
| var firstText = section.children('p').filter(function () {
| |
| return $(this).text().trim().length > 100;
| |
| }).first();
| |
|
| |
| // Table block
| |
| var tableBlock = section.children('table').first();
| |
|
| |
| if (tableBlock.length && firstText.length) {
| |
|
| |
| // Move BEFORE browser fully paints
| |
| firstText.insertAfter(tableBlock);
| |
| }
| |
|
| |
| });
| |
|
| |
| /*-------------------------------------Chirag---------------------------*/
| |
| /* Homepage mobile order final */
| |
|
| |
| $(document).ready(function () {
| |
|
| |
| if (
| |
| mw.config.get('skin') === 'minerva' &&
| |
| mw.config.get('wgIsMainPage') &&
| |
| $(window).width() <= 768
| |
| ) {
| |
|
| |
| var section = $('.mf-section-0');
| |
|
| |
| // Ignore empty <p> and <p><br></p>
| |
| var firstText = section.children('p').filter(function () {
| |
|
| |
| return $.trim($(this).text()).length > 50;
| |
|
| |
| }).first();
| |
|
| |
| var videoBlock = section.children('figure').eq(0);
| |
|
| |
| var logoBlock = section.children('figure').eq(1);
| |
|
| |
| var arrowBlock = section.find('.heading-detail-page').first();
| |
|
| |
| // Order:
| |
| // 1 Video
| |
| // 2 Logo
| |
| // 3 Arrows
| |
| // 4 Text
| |
|
| |
| if (videoBlock.length && logoBlock.length) {
| |
| videoBlock.after(logoBlock);
| |
| }
| |
|
| |
| if (logoBlock.length && arrowBlock.length) {
| |
| logoBlock.after(arrowBlock);
| |
| }
| |
|
| |
| if (arrowBlock.length && firstText.length) {
| |
| arrowBlock.after(firstText);
| |
| }
| |
|
| |
| }
| |
|
| |
| });
| |
|
| |
| /*-------------------------------------Chirag---------------------------*/
| |
| $(document).ready(function () {
| |
|
| |
| if (
| |
| mw.config.get('skin') === 'minerva' &&
| |
| mw.config.get('wgIsMainPage') &&
| |
| $(window).width() <= 768
| |
| ) {
| |
|
| |
| var section = $('.mf-section-0');
| |
|
| |
| // REMOVE EMPTY P TAGS
| |
| section.children('p').each(function () {
| |
|
| |
| if ($.trim($(this).text()) === '') {
| |
| $(this).remove();
| |
| }
| |
|
| |
| });
| |
|
| |
| // REAL TEXT ONLY
| |
| var firstText = section.children('p').filter(function () {
| |
|
| |
| return $.trim($(this).text()).length > 50;
| |
|
| |
| }).first();
| |
|
| |
| var videoBlock = section.children('figure').eq(0);
| |
|
| |
| var logoBlock = section.children('figure').eq(1);
| |
|
| |
| var arrowBlock = section.find('.heading-detail-page').first();
| |
|
| |
| if (videoBlock.length && logoBlock.length) {
| |
| videoBlock.after(logoBlock);
| |
| }
| |
|
| |
| if (logoBlock.length && arrowBlock.length) {
| |
| logoBlock.after(arrowBlock);
| |
| }
| |
|
| |
| if (arrowBlock.length && firstText.length) {
| |
| arrowBlock.after(firstText);
| |
| }
| |
|
| |
| }
| |
|
| |
| });
| |
| /*-----------------------------------------28-05-2026--------------------------------/
| |
|
| |
| /*--------------------------------------swati---------------------------------------*/
| |
| /* hide sub suggestion in global searchbox */
| |
| $(function () {
| |
|
| |
| function removeSubpageResults() {
| |
|
| |
| // Old search suggestions
| |
| $('a.mw-searchSuggest-link').each(function () {
| |
|
| |
| var title = $(this).attr('title') || '';
| |
|
| |
| if (title.indexOf('/') !== -1) {
| |
|
| |
| $(this).hide();
| |
|
| |
| }
| |
|
| |
| });
| |
|
| |
| // Mobile overlay suggestions
| |
| $('.cdx-menu-item').each(function () {
| |
|
| |
| var title = $(this).attr('title') || $(this).text();
| |
|
| |
| if (title.indexOf('/') !== -1) {
| |
|
| |
| $(this).hide();
| |
|
| |
| }
| |
|
| |
| });
| |
|
| |
| }
| |
|
| |
| // Run once
| |
| removeSubpageResults();
| |
|
| |
| // Run instantly when suggestions are added
| |
| new MutationObserver(removeSubpageResults).observe(document.body, {
| |
| childList: true,
| |
| subtree: true
| |
| });
| |
|
| |
| });
| |
|
| |
| /* hide sub suggestion in search page */
| |
| $(document).ready(function () {
| |
|
| |
| // Inject CSS instantly
| |
| $('head').append(`
| |
| <style>
| |
| .oo-ui-menuOptionWidget.subpage-hidden {
| |
| display: none !important;
| |
| }
| |
| </style>
| |
| `);
| |
|
| |
| function hideSubSuggestions() {
| |
|
| |
| $('.oo-ui-menuOptionWidget').each(function () {
| |
|
| |
| var text = $(this).text().trim();
| |
|
| |
| // Hide subpages containing "/"
| |
| if (text.includes('/')) {
| |
|
| |
| $(this).addClass('subpage-hidden');
| |
|
| |
| }
| |
|
| |
| });
| |
|
| |
| }
| |
|
| |
| // Watch dropdown continuously
| |
| const observer = new MutationObserver(function () {
| |
|
| |
| hideSubSuggestions();
| |
|
| |
| });
| |
|
| |
| observer.observe(document.body, {
| |
| childList: true,
| |
| subtree: true
| |
| });
| |
|
| |
| hideSubSuggestions();
| |
|
| |
| });
| |
|
| |
| $(document).ready(function () {
| |
|
| |
| // Override broken REST API search
| |
| if (mw.config.get('skin') === 'minerva') {
| |
|
| |
| $(document).on('focus keyup', 'input[type="search"]', function () {
| |
|
| |
| // Replace REST API endpoint with old api.php
| |
| $.ajaxSetup({
| |
| beforeSend: function (xhr, settings) {
| |
|
| |
| if (
| |
| settings.url &&
| |
| settings.url.indexOf('/rest.php/v1/search/title') !== -1
| |
| ) {
| |
|
| |
| settings.url =
| |
| mw.util.wikiScript('api') +
| |
| '?action=query&format=json&formatversion=2' +
| |
| '&generator=prefixsearch' +
| |
| '&gpsnamespace=0&gpslimit=50';
| |
|
| |
| }
| |
|
| |
| }
| |
| });
| |
|
| |
| });
| |
|
| |
| }
| |
|
| |
| });
| |
|
| |
| $(function () {
| |
|
| |
| function cleanSearchSuggestions() {
| |
|
| |
| $('.oo-ui-menuOptionWidget').each(function () {
| |
|
| |
| if ($(this).text().indexOf('/') !== -1) {
| |
|
| |
| $(this).hide();
| |
|
| |
| }
| |
|
| |
| });
| |
|
| |
| $('.oo-ui-menuSelectWidget').css({
| |
| 'height': 'auto',
| |
| 'max-height': 'none',
| |
| 'overflow-y': 'hidden'
| |
| });
| |
|
| |
| }
| |
|
| |
| new MutationObserver(cleanSearchSuggestions).observe(document.body, {
| |
| childList: true,
| |
| subtree: true
| |
| });
| |
|
| |
| });
| |
|
| |
| /*--------------------------------------chirag---------------------------------------*/
| |
| $(function () {
| |
|
| |
| $('video[src*="Ekatra_Logo.mp4"]').attr(
| |
| 'poster',
| |
| 'https://wiki.ekatrafoundation.org/static/Ekatra-Poster.png'
| |
| );
| |
|
| |
| });
| |
|
| |
| /*----------------------------5-6-2026---------------------------------------*/
| |
| $(function () {
| |
|
| |
| if (mw.config.get('skin') !== 'minerva') {
| |
| return;
| |
| }
| |
|
| |
| var title = mw.config.get('wgTitle') || '';
| |
|
| |
| if (title.indexOf('/') !== -1) {
| |
|
| |
| $('head').append(
| |
| '<style>@media only screen and (max-width:767px){#firstHeading{display:none!important;}}</style>'
| |
| );
| |
|
| |
| }
| |
|
| |
| });
| |
| /*----------------------------8-6-2026---------------------------------------*/
| |
| $(function () {
| |
|
| |
| if (mw.config.get('skin') !== 'minerva') {
| |
| return;
| |
| }
| |
|
| |
| var title = $('p').filter(function () {
| |
| return $(this).text().trim() === 'કાવ્ય, ભજન';
| |
| }).first();
| |
|
| |
| var booksHeading = $('.wst-center.tiInherit').first();
| |
|
| |
| if (title.length && booksHeading.length) {
| |
| title.insertAfter(booksHeading);
| |
| }
| |
|
| |
| });
| |
|
| |
| /*---------------------------22-06-2026---------------------------------------*/
| |
| $(function () {
| |
|
| |
| $('.ekatra-right-author').each(function () {
| |
| $(this).nextAll('p').filter(function () {
| |
| return $.trim($(this).text()) === '';
| |
| }).first().remove();
| |
| });
| |
|
| |
| $('div.header-mainblock').each(function () {
| |
| var $prev = $(this).prev();
| |
| if ($prev.is('p') && !$prev.text().trim() && $prev.find('br').length) {
| |
| $prev.remove();
| |
| }
| |
| });
| |
|
| |
| });
| |