Butun axtardiqlarinizi tapmaq ucun buraya: DAXIL OLUN
  Mp4 Mp3 Axtar Yukle
  Video Axtar Yukle
  Shekil Axtar Yukle
  Informasiya Melumat Axtar
  Hazir Inshalar Toplusu
  AZERI CHAT + Tanishliq
  1-11 Sinif Derslikler Yukle
  Saglamliq Tibbi Melumat
  Whatsapp Plus Yukle(Yeni)

  • Ana səhifə
  • Təsadüfi
  • Yaxınlıqdakılar
  • Daxil ol
  • Nizamlamalar
İndi ianə et Əgər Vikipediya sizin üçün faydalıdırsa, bu gün ianə edin.

İstifadəçi:MGA73/nowcommons.js

  • İstifadəçi səhifəsi
  • Müzakirə
  • Mənbəyə bax
< İstifadəçi:MGA73

Qeyd: Dəyişiklikləri yayımladıqdan sonra etdiyiniz dəyişikliklərin görünməsi üçün brauzerinizin keşinin təmizlənməsi lazım ola bilər.

  • Firefox / Safari: Reload düyməsinə basılı tutarkən Shift düyməsinə basın, və ya Ctrl+F5 və ya Ctrl+R (Mac üçün ⌘-R )
  • Google Chrome: Ctrl-Shift-R (Mac üçün ⌘-Shift-R)
  • Edge: Ctrl düyməsini basılı tutarkən Refresh düyməsinə basın, və ya sadəcə Ctrl+F5.
$(document).ready(function() {
    // Only run this script on File pages <nowiki>
    if (mw.config.get('wgNamespaceNumber') === 6) {
        // Function to check for Commons duplication and extract the filename
        function getCommonsFilename() {
            // Locate the duplicates section
            var duplicatesSection = $('#mw-imagepage-section-duplicates');
            
            // Check if the duplicates section exists
            if (duplicatesSection.length) {
                // Find the link to the Commons file
                var commonsLink = duplicatesSection.find('a.external');
                
                if (commonsLink.length) {
                    // Extract the filename from the link text
                    var commonsFilename = commonsLink.text().replace("Fayl:", "").trim(); // This should be the local namespace
                    return commonsFilename;
                }
            }
            return null;
        }

        // Get the Commons filename if it exists
        var commonsFilename = getCommonsFilename();
        if (commonsFilename) {
            // Create the "Add NowCommons" button
            var addNowCommonsLink = $('<a>')
                .text('Add NowCommons')
                .attr('href', '#')
                .css({
                    'cursor': 'pointer',
                    'color': '#0645AD',
                    'margin-left': '10px',
                })
                .click(function(event) {
                    event.preventDefault();
                    // Redirect to the edit page with NowCommons marker
                    var editUrl = mw.util.getUrl(mw.config.get('wgPageName'), { action: 'edit', nowcommons: commonsFilename });
                    window.location.href = editUrl;
                });

            // Add the link to the page (e.g., next to the edit button)
            $('#ca-edit').after(addNowCommonsLink);
        }

        // Automatically insert the NowCommons template and edit summary if the page is in edit mode
        var urlParams = new URLSearchParams(window.location.search);
        if (mw.config.get('wgAction') === 'edit' && urlParams.has('nowcommons')) {
            var commonsFilename = urlParams.get('nowcommons');
            var nowCommonsTemplate = '{{NowCommons|' + commonsFilename + '}}';
            var editBox = $('#wpTextbox1');
            var currentText = editBox.val();
            editBox.val(nowCommonsTemplate + '\n' + currentText);

            // Set the edit summary. </nowiki>
            $('#wpSummary').val('Adding NowCommons template for file duplicated on Commons (' + commonsFilename + ') ([[User:MGA73/nowcommons.js]])');
        }
    }
});
Mənbə — "https://az.wikipedia.org/w/index.php?title=İstifadəçi:MGA73/nowcommons.js&oldid=8142103"
Informasiya Melumat Axtar