"മീഡിയവിക്കി:Common.js" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം

No edit summary
No edit summary
 
(2 ഉപയോക്താക്കൾ ചെയ്ത ഇടയ്ക്കുള്ള 12 നാൾപ്പതിപ്പുകൾ പ്രദർശിപ്പിക്കുന്നില്ല)
വരി 1: വരി 1:
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Joeytje50/JWB.js/load.js&action=raw&ctype=text/javascript');
/* ============================================================
/* ============================================================
   OpenStreetMap marker URL fix
   OpenStreetMap marker URL fix
   ============================================================ */
   ============================================================ */
mw.hook('wikipage.content').add(function () {
window.onload = function () {
     var images = document.querySelectorAll('img');
     var images = document.querySelectorAll('img');
     for (var i = 0; i < images.length; i++) {
     for (var i = 0; i < images.length; i++) {
വരി 8: വരി 10:
         if (
         if (
             img.src &&
             img.src &&
             img.src.indexOf('https://tile.openstreetmap.org/v4/marker/') === 0
             img.src.startsWith("https://tile.openstreetmap.org/v4/marker/")
         ) {
         ) {
             img.src = img.src.replace(
             img.src = img.src.replace(
വരി 15: വരി 17:
             );
             );
         }
         }
    }
};
});
};


/* ============================================================
/* ============================================================
വരി 74: വരി 76:
                     var license = '';
                     var license = '';
                     var licenseUrl = '';
                     var licenseUrl = '';
                    var commonsUrl = info.descriptionurl || '';


                     if (info.extmetadata) {
                     if (info.extmetadata) {
വരി 96: വരി 99:
                     img.style.width = '100%';
                     img.style.width = '100%';


                     /* Lightbox data (use responsive size, not original) */
                     /* Lightbox source: responsive, not original */
                     var lightboxSrc = info.url;
                     var lightboxSrc = info.url;
                     if (info.responsiveUrls) {
                     if (info.responsiveUrls) {
വരി 112: വരി 115:
                         (licenseUrl
                         (licenseUrl
                             ? ' – <a href="' + licenseUrl +
                             ? ' – <a href="' + licenseUrl +
                               '" target="_blank">' + license + '</a>'
                               '" target="_blank" rel="noopener noreferrer">' +
                              license + '</a>'
                            : '') +
                        (commonsUrl
                            ? '<br><a href="' + commonsUrl +
                              '" target="_blank" rel="noopener noreferrer">' +
                              'View on Wikimedia Commons</a>'
                             : '');
                             : '');


വരി 134: വരി 143:
         });
         });


         /* Hide placeholder spans */
         /* Hide source placeholders */
         sources.forEach(function (el) {
         sources.forEach(function (el) {
             el.style.display = 'none';
             el.style.display = 'none';
വരി 239: വരി 248:


})();
})();
/* ============================================================
  Editing tools
  ============================================================ */
if (
    mw.config.get('wgAction') === 'edit' ||
    mw.config.get('wgAction') === 'submit' ||
    mw.config.get('wgCanonicalSpecialPageName') === 'Upload'
) {
    mw.loader.load(
        '/index.php?title=മീഡിയവിക്കി:Common.js/edit.js&action=raw&ctype=text/javascript'
    );
}
/* ============================================================
  Special characters subset menu
  ============================================================ */
function addCharSubsetMenu() {
    if ($('#editpage-specialchars').length > 0) {
        var s = parseInt($.cookie('edittoolscharsubset'), 10);
        if (isNaN(s)) s = 0;
        var $menu = $('<select />')
            .attr('id', 'charSubsetControl')
            .css('display', 'inline')
            .change(chooseCharSubset)
            .data('previousSelectedIndex', s)
            .append($('<option />').text('ഫലകങ്ങൾ'))
            .append($('<option />').text('വിക്കിവിന്യാസങ്ങൾ'))
            .append($('<option />').text('അനുമതിപത്രങ്ങൾ'))
            .append($('<option />').text('മലയാളം'))
            .append($('<option />').text('കൊറിയൻ'))
            .append($('<option />').text('ലത്തീൻ'))
            .append($('<option />').text('ഐ.പി.എ.'))
            .append($('<option />').text('പലവക'))
            .append($('<option />').text('അറബി'))
            .append($('<option />').text('ദേവനാഗരി'))
            .append($('<option />').text('ഹിബ്രു'))
            .append($('<option />').text('പഴയ ഇംഗ്ലീഷ്'));
        $('#editpage-specialchars').prepend($menu);
        $('#charSubsetControl')[0].selectedIndex = s;
        $('p', '#editpage-specialchars').each(function (index) {
            $(this).css({
                display: index === s ? 'inline' : 'none',
                visibility: index === s ? 'visible' : 'hidden'
            });
        });
    }
}
function chooseCharSubset() {
    var selectedIndex = $(this).find(':selected').index();
    $('p', '#editpage-specialchars').each(function (index) {
        $(this).css({
            display: index === selectedIndex ? 'inline' : 'none',
            visibility: index === selectedIndex ? 'visible' : 'hidden'
        });
    });
    $.cookie('edittoolscharsubset', selectedIndex);
}
$(addCharSubsetMenu);
/* ============================================================
  Navigation bars
  ============================================================ */
var NavigationBarHide = 'മറയ്ക്കുക';
var NavigationBarShow = 'പ്രദർശിപ്പിക്കുക';
var indexNavigationBar = 0;
window.toggleNavigationBar = function (index, event) {
    var NavToggle = document.getElementById('NavToggle' + index);
    var NavFrame = document.getElementById('NavFrame' + index);
    if (!NavFrame || !NavToggle) return;
    var show = NavToggle.firstChild.data === NavigationBarShow;
    NavToggle.firstChild.data = show ? NavigationBarHide : NavigationBarShow;
    var children = NavFrame.children;
    for (var i = 0; i < children.length; i++) {
        if ($(children[i]).hasClass('NavContent') ||
            $(children[i]).hasClass('NavPic')) {
            children[i].style.display = show ? 'block' : 'none';
        }
    }
    event.preventDefault();
};
mw.hook('wikipage.content').add(function ($content) {
    $content.find('div.NavFrame').each(function () {
        indexNavigationBar++;
        var NavFrame = this;
        var NavHead = $(NavFrame).find('.NavHead').first();
        if (!NavHead.length) return;
        var NavToggle = $('<a href="#" class="NavToggle"></a>')
            .attr('id', 'NavToggle' + indexNavigationBar)
            .text(NavigationBarHide)
            .on('click', function (e) {
                toggleNavigationBar(indexNavigationBar, e);
            });
        NavFrame.id = 'NavFrame' + indexNavigationBar;
        NavHead.append(NavToggle);
    });
});
/* ============================================================
  Collapsible tables
  ============================================================ */
var autoCollapse = 2;
var collapseCaption = 'മറയ്ക്കുക';
var expandCaption = 'പ്രദർശിപ്പിക്കുക';
function collapseTable(tableIndex) {
    var Button = document.getElementById('collapseButton' + tableIndex);
    var Table = document.getElementById('collapsibleTable' + tableIndex);
    if (!Table || !Button) return;
    var Rows = Table.rows;
    var hide = Button.firstChild.data === collapseCaption;
    for (var i = 1; i < Rows.length; i++) {
        Rows[i].style.display = hide ? 'none' : '';
    }
    Button.firstChild.data = hide ? expandCaption : collapseCaption;
}
$(function () {
    var tableIndex = 0;
    $('table.collapsible').each(function () {
        var $table = $(this);
        var $header = $table.find('tr:first th:first');
        if (!$header.length) return;
        $table.attr('id', 'collapsibleTable' + tableIndex);
        var $button = $('<span class="collapseButton">[</span>');
        var $link = $('<a href="#"></a>')
            .attr('id', 'collapseButton' + tableIndex)
            .text(collapseCaption)
            .on('click', function (e) {
                e.preventDefault();
                collapseTable(tableIndex);
            });
        $button.append($link).append(']');
        $header.prepend($button);
        tableIndex++;
    });
});
"https://schoolwiki.in/മീഡിയവിക്കി:Common.js" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്