User:CoreValues/monobook.js

// [[User:Lupin/popups.js]]

importScript('User:Lupin/popups.js');
importScript("User:Lupin/recent2.js");

/**** quick image delete ****/
document.write('<script type="text/javascript"' +
  'src="http://en.wikipedia.org/w/index.php?title=User:Howcheng/quickimgdelete.js' +
  '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

/* This is to keep track of who is using this extension: [[User:Howcheng/quickimgdelete.js]] */

importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinklefluff.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:AzaToth/twinklewarn.js');
importScript('User:AzaToth/twinklearv.js');
importScript('User:AzaToth/twinklespeedy.js');
importScript('User:AzaToth/twinklediff.js');
importScript('User:AzaToth/twinkleprotect.js');
importScript('User:AzaToth/twinkleprod.js');
importScript('User:AzaToth/twinklexfd.js');
TwinkleConfig = {
        revertMaxRevisions              :       50,
        userTalkPageMode                :       'tab',
        showSharedIPNotice              :       true,
        openTalkPage                    :       [ 'agf', 'norm', 'vand' ],
        openTalkPageOnAutoRevert        :       true,
        openAOLAnonTalkPage             :       false,
        summaryAd                       :       " using [[WP:TWINKLE|TW]]",
        deletionSummaryAd               :       " using [[WP:TWINKLE|TW]]",
        watchSpeedyPages                :       [ 'g3', 'g5', 'g10', 'g11', 'g12' ],
        openUserTalkPageOnSpeedyDelete  :       [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
        watchRevertedPages              :       [ 'agf', 'norm', 'vand', 'torev' ],
        markRevertedPagesAsMinor        :       [ 'agf', 'norm', 'vand', 'torev' ],
        deleteTalkPageOnDelete          :       true,
        markWarningsAsMinor             :       true,
        markAIVReportAsMinor            :       true,
        markSpeedyPagesAsMinor          :       true,
        confirmUsernameToAIV            :       false
};
function filter_main() {
        var lis = document.getElementById('bodyContent').getElementsByTagName('li'); 
        var len = lis.length;
        for(var i=0; i<len; i++) { 
                var li = lis[i]; 
                if(li.getElementsByTagName('a')[1].innerHTML.indexOf(':') != -1) { 
                        //li.parentNode.removeChild(li);
                        li.style.display = 'none';
                }
        }
}

if(wgPageName == 'Special:Linksearch') {
        addOnloadHook(function() {
                mw.util.addPortletLink('p-cactions', "javascript:void(filter_main())", "filter", 'ca-filter', 'Filter all pages on here to only be for mainspace');
        });
}
if(wgPageName == 'Special:Linksearch') {
        addOnloadHook(function() {
                mw.util.addPortletLink('p-cactions', "javascript:rem_spam()", "remove external links", 'ca-remspam', 'Alter all the links on this page to autorem the external link on the page when clicked');
        });
}

if(location.href.indexOf('action=edit') != -1 && location.href.indexOf('remspam=') != -1) {
        addOnloadHook(function() {
                var tag = query_get('remspam');
                var box = document.getElementById('wpTextbox1');
                var txt = box.value;
                var reg = tag.replace('http://', '').replace(/\./g, '\\.').replace(/\*\\?\./g, '(?:.*?\\.)?');
                var newtext = ''+txt;
//              var elreg = /.*\s*={1,6}external\s*links?={1,6}\s*.*/ig;
//              var elreg2 = /(\s*={1,6}external\s*links?={1,6}.*)$/
//              if(elreg.test(newtext)) {
//                                              alert('MATCHED');
//                      var elsect = newtext.replace(elreg, '$1');
//                                              document.getElementById('content').appendChild(document.createTextNode(elreg));
//                                              document.getElementById('content').appendChild(document.createElement('br'));
//                                              document.getElementById('content').appendChild(document.createTextNode(elsect));
//                                              fuu();
//                      elsect = elsect.replace(new RegExp('^\\s*\\*.*?\\[?https?\\://'+reg+'/?.+?(?:\\s+(.+?)\\]|(\\s)).*?$', 'igm'), '');
//                      newtext = newtext.replace(elreg, elsect);
//              }
                if(!query_get('options') || (',' + query_get('options') + ',').indexOf(',lines,') != -1) newtext = newtext.replace(new RegExp('^\\s*\\*.*?\\[?https?\\://'+reg+'/?.+?(?:\\s+(.+?)\\]|.*?)$', 'igm'), '');
                if(!query_get('options') || (',' + query_get('options') + ',').indexOf(',citeweb,') != -1) newtext = newtext.replace(new RegExp('(?:<ref(?:\\s*name=["\'].*?["\'])?>\\s*)?\\{\\{\\s*cite[_ ]web\\s*\\|(?:.*?\\|)*\\s*url\\s*=\\s*https?\\://'+reg+'/?.*?\\s*(?:\\|.*?)?\\}\\}(?:\\s*<\/ref>)?', 'ig'), '');
                if(!query_get('options') || (',' + query_get('options') + ',').indexOf(',inline,') != -1) newtext = newtext.replace(new RegExp('(?:<ref(?:\\s*name=["\'].*?["\'])?>\\s*)?\\[?https?\\://'+reg+'/?.+?(?:\\s+(.+?)\\]|(\\s))(?:\\s*<\/ref>)?', 'ig'), '$1');
                box.value = newtext;
                document.getElementById('wpSummary').value = query_get('usesummary').replace(/__LINK__/g, tag) || 'Removing external link: '+tag+' -- per [[WP:EL|external link guidelines]]';
                document.getElementById('wpMinoredit').checked = true;
                document.getElementById('wpWatchthis').checked = false;
                document.getElementById('wpDiff').click();
        });
}

function rem_spam() {
        var targ = query_get('target') || unescape(location.href).split('/').reverse()[0].split('?')[0].split('#')[0];
        var tag = prompt('Please insert a link (without http://) to remove from\nall pages listed here. Example (and default if textbox is blank):\n'+targ);
        if(tag == null) { alert('Action canceled.'); return; }
        if(tag == "") tag = targ;
        var options = prompt('Please enter the option modes you would want.\nEnter each one in the textbox (without any seperation marker)\ne=Remove lines of External Links that contain the link\ni=Remove links inline in text\nc=Remove Cite_web templates using the link\nExample: ci\nLeave the box blank for all modes');
        if(options == null) { alert('Action canceled.'); return; }
        if(options == "") options = 'eic';
        options = options.split(new RegExp(''));
        var opt = '';
        for(var x in options) {
                var y = options[x];
                if(y == 'c') opt += ',citeweb';
                if(y == 'i') opt += ',inline';
                if(y == 'e') opt += ',lines';
        }
        opt = opt.substring(1);
        options = opt;
        var usesummary = prompt('Please enter a summary to use\nDefault: Removing external link: __LINK__ -- per [[WP:EL|external link guidelines]]');
        if(usesummary == null) { alert('Action canceled.'); return; }
        if(usesummary == '') usesummary = 'Removing external link: __LINK__ -- per [[WP:EL|external link guidelines]]';
        var links = document.getElementById('bodyContent').getElementsByTagName('a');
        for(var i=0; i<links.length; i++) {
                var link = links[i];
                var cha = (link.href.indexOf('?') != -1) ? '&' : '?';
                link.href += cha + 'linkmodified=yes&action=edit&remspam='+escape(tag)+'&options='+escape(options)+'&usesummary='+escape(usesummary);
                link.style.color = "green";
                link.onmouseup = function() { this.style.color = 'orange'; }; 
                link.innerHTML = link.innerHTML.replace(/(<([^>]+)>)/g, '');
        }
        var btn = document.getElementById('ca-remspam').firstChild;
        btn.href = 'javascript:unrem_spam();';
        btn.innerHTML = 'un-highlight links';
        btn.title = '';
}

function unrem_spam() {
        var links = document.getElementById('bodyContent').getElementsByTagName('a');
        for(var i=0; i<links.length; i++) {
                var link = links[i];
                link.href = link.href.split('linkmodified=yes')[0];
                link.style.color = "";
        }
        alert('All links will now be safe to click...');
        var btn = document.getElementById('ca-remspam').firstChild;
        btn.href = 'javascript:rem_spam();';
        btn.innerHTML = 'remove external links';
        btn.title = '';
}

//parse paramName out of query string
//stolen from Lupin's popups
function query_get(paramName) {
  var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
  var h=document.location;
  var m;
  if (m=cmdRe.exec(h)) {
    try { 
      return unescape(m[1]);
    } catch (someError) {}
  }
  return null;
};

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.