کارن:WOSlinker/common.js

د ويکيپېډيا، وړیا پوهنغونډ له خوا

د نور تفصيل لپاره د غځول په تنۍ کلېک وکړئيادښت: د غوره توبونو د خوندي کولو وروسته، خپل د کتنمل (بروزر) ساتل شوې حافظه تازه کړی.د نور تفصيل لپاره د غځول په تنۍ کلېک وکړئ.

  • فايرفاکس/ سفري: په دې کتنمل کې د Reload د ټکوهلو په وخت د Shift تڼۍ نيولې وساتی، او يا هم Ctrl-F5 يا Ctrl-Rتڼۍ کېښکاږۍ (په Apple Mac کمپيوټر باندې ⌘-R کېښکاږۍ)
  • گووگل کروم: په دې کتنمل کې د Ctrl-Shift-R تڼۍ کېښکاږۍ (د مک لپاره ⌘-Shift-R)
  • انټرنټ اېکسپلورر: په دې کتنمل کې د Refresh د ټکوهلو په وخت کې د Ctrl تڼۍ کېښکاږلې ونيسۍ، او يا هم د Ctrl-F5 تڼۍ کېښکاږۍ
  • اوپرا: په دې کتنمل کې د خپل براوزر ساتل شوې حافظه پدې توگه سپينولی شی Tools→Preferences
لاسوند[جوړول]
function font_queryString(p) {
    var re = RegExp('[&?]' + p + '=([^&]*)');
    var matches;
    if (matches = re.exec(document.location)) {
        try { 
            return decodeURI(matches[1]);
        } catch (e) { }
    }
    return null;
}

//Add a 'font edit' tab
if(mw.config.get('wgArticleId') != 0 ) { 
    $( function fontEditButton() {
        mw.util.addPortletLink('p-cactions', 
                       mw.util.getUrl(null,{action:'edit',font:true}),
                       'font',
                       'p-font',
                       'font edit');
    }
)}

if(mw.config.get('wgAction') == 'edit' && font_queryString('font') == 'true') {
    $(function font() {
        var myContent = document.getElementById('wpTextbox1').value;

        myContent = myContent.replace(/\<font color *\= *\"\#([\d\w]*)\"\>\[\[([^\]]*?)\|([^\]]*?)\]\]\<\/font\>/g,'[[$2|<font color="#$1">$3</font>]]');
        myContent = myContent.replace(/\<font color *\= *\"\#([\d\w]*)\"\>\[\[([^\]]*?)\]\]\<\/font\>/g,'[[$2|<font color="#$1">$2</font>]]');

        myContent = myContent.replace(/\<font color *\= *\#([\d\w]*)\>\[\[([^\]]*?)\|([^\]]*?)\]\]\<\/font\>/g,'[[$2|<font color="#$1">$3</font>]]');
        myContent = myContent.replace(/\<font color *\= *\#([\d\w]*)\>\[\[([^\]]*?)\]\]\<\/font\>/g,'[[$2|<font color="#$1">$2</font>]]');

        myContent = myContent.replace(/\<font color *\= *\"([\w]*)\"\>\[\[([^\]]*?)\|([^\]]*?)\]\]\<\/font\>/g,'[[$2|<font color="$1">$3</font>]]');
        myContent = myContent.replace(/\<font color *\= *\"([\w]*)\"\>\[\[([^\]]*?)\]\]\<\/font\>/g,'[[$2|<font color="$1">$2</font>]]');

        myContent = myContent.replace(/\<font color *\= *([\w]*)\>\[\[([^\]]*?)\|([^\]]*?)\]\]\<\/font\>/g,'[[$2|<font color=$1>$3</font>]]');
        myContent = myContent.replace(/\<font color *\= *([\w]*)\>\[\[([^\]]*?)\]\]\<\/font\>/g,'[[$2|<font color=$1>$2</font>]]');

        if(document.getElementById('wpTextbox1').value != myContent) {
           document.getElementById('wpTextbox1').value=myContent;
           document.getElementById('wpSummary').value='font [[Special:LintErrors/tidy-font-bug|lint]]';
           document.getElementById('wpMinoredit').checked = true;
        }



    }
)}