សម្គាល់: បន្ទាប់ពីបានរក្សាទុករួចហើយ លោកអ្នកគួរតែសំអាត browser's cache របស់លោកអ្នកដើម្បីមើលការផ្លាស់ប្តូរ។ ខាងក្រោមនេះជាវិធីសំអាត browser's cache ចំពោះកម្មវិធីរុករក(Browser)មួយចំនួន។

  • Firefox / Safari: សង្កត់ [Shift] ឱ្យជាប់រួចចុចប៊ូតុង Reload ឬក៏ចុច Ctrl-F5Ctrl-R ( ⌘-R សំរាប់ Mac)
  • Google Chrome: ចុច Ctrl-Shift-R (⌘-Shift-R សំរាប់ Mac)
  • IE(Internet Explorer): សង្កត់ [Ctrl] ឱ្យជាប់ រួចចុច Refreshប៊ូតុង ឬក៏ចុច Ctrl-F5​។
  • Konqueror: ចុចប៊ូតុង Reload ឬក៏ចុច F5
  • Opera: សូមសំអាតcacheនៅក្នុង [Tools]→[Preferences]
$(document).ready(function() {
    function addButtons() {
        if (mw.config.get('wgNamespaceNumber') === 6 || mw.config.get('wgPageName') === 'អ្នកប្រើប្រាស់:MGA73/Sandbox') {
            var buttonContainer = $('<div>').css({'margin': '10px 0'});
            
            var relicenseButton = $('<button>')
                .text('Relicense')
                .css({
                    'cursor': 'pointer',
                    'margin-right': '10px'
                })
                .click(function(event) {
                    event.preventDefault();
                    // Redirect to the edit page with relicense marker
                    var editUrl = mw.util.getUrl(mw.config.get('wgPageName'), { action: 'edit', relicense: true });
                    window.location.href = editUrl;
                });
            
            var notEligibleButton = $('<button>')
                .text('Not-eligible')
                .css({
                    'cursor': 'pointer',
                    'margin-right': '10px'
                })
                .click(function(event) {
                    event.preventDefault();
                    // Redirect to the edit page with not-eligible marker
                    var editUrl = mw.util.getUrl(mw.config.get('wgPageName'), { action: 'edit', noteligible: true });
                    window.location.href = editUrl;
                });
            
            var redundantButton = $('<button>')
                .text('Redundant')
                .css({
                    'cursor': 'pointer'
                })
                .click(function(event) {
                    event.preventDefault();
                    // Redirect to the edit page with redundant marker
                    var editUrl = mw.util.getUrl(mw.config.get('wgPageName'), { action: 'edit', redundant: true });
                    window.location.href = editUrl;
                });
            
            buttonContainer.append(relicenseButton).append(notEligibleButton).append(redundantButton);
            
            var content = $('#content');
            if (content.length) {
                content.prepend(buttonContainer);
            }
        }
    }
    
    function applyChangesOnEditPage() {
        if (mw.config.get('wgAction') === 'edit') {
            var urlParams = new URLSearchParams(window.location.search);
            var relicense = urlParams.get('relicense');
            var noteligible = urlParams.get('noteligible');
            var redundant = urlParams.get('redundant');
            
            var newGFDLTemplate;
            var newGFDLWithDisclaimersTemplate;
            var summary;
            
            if (relicense) {
                newGFDLTemplate = '{{GFDL|migration=relicense}}';
                newGFDLWithDisclaimersTemplate = '{{GFDL-with-disclaimers|migration=relicense}}';
                summary = 'Eligible for [[:w:en:Wikipedia:Image license migration|GFDL relicense]]. Uploaded before August 2009.';
            } else if (noteligible) {
                newGFDLTemplate = '{{GFDL|migration=not-eligible}}';
                newGFDLWithDisclaimersTemplate = '{{GFDL-with-disclaimers|migration=not-eligible}}';
                summary = 'Not eligible for [[:w:en:Wikipedia:Image license migration|GFDL relicense]]. Uploaded after August 2009. Uploader please consider adding {{Cc-by-sa-4.0}}.';
            } else if (redundant) {
                newGFDLTemplate = '{{GFDL|migration=redundant}}';
                newGFDLWithDisclaimersTemplate = '{{GFDL-with-disclaimers|migration=redundant}}';
                summary = 'File is considered redundant for [[:w:en:Wikipedia:Image license migration|GFDL relicense]]..';
            }
            
            if (newGFDLTemplate && newGFDLWithDisclaimersTemplate) {
                var editBox = $('#wpTextbox1');
                var currentText = editBox.val();
                
                // Replace {{GFDL}} and {{GFDL-with-disclaimers}} with the new templates
                var updatedText = currentText
                    .replace(/{{GFDL(?:-no-disclaimers)?}}/g, newGFDLTemplate)
                    .replace(/{{GFDL-with-disclaimers}}/g, newGFDLWithDisclaimersTemplate);
                editBox.val(updatedText);
            }
            
            if (summary) {
                $('#wpSummary').val(summary);
            }
        }
    }

    addButtons();
    applyChangesOnEditPage();
});