User:DeirdreAnne/common.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// [[User:Pyrospirit/scriptpackage.js]]
 
/*
 
This is a collection of JavaScript assembled by [[User:Pyrospirit]]. I haven't written 
any of this myself, but I use all of it and find it very useful.
 
These scripts are designed for use in Firefox and will all work in Firefox. Most of the 
scripts won't work in Internet Explorer, and I have no idea what will happen with other 
browsers. Solution: get Firefox.
 
I'm somewhat of a newbie with JavaScript, so please report any problems with these 
scripts to whomever wrote the script or ask at [[Wikipedia:Village pump (technical)]].
 
To decrease loading time, I've set many scripts only to run on certain types of pages. 
So, if a script isn't showing up, it might be because you'd almost never use it on the 
page you're on anyway.
 
*/
 
/*
== Scripts in this area are enabled in all browsers ==
*/
 
// [[User:Lupin/popups.js]] - navigation popups    
//if(wgAction!='edit' && wgAction!='submit')
//importScript('User:Lupin/popups.js');
 
// [[User:Jsimlo/shortcuts.js]] - customized sidebar links
importScript('User:Jsimlo/shortcuts.js');
 
function shortcutsInit ()
{
 
  shortcutsAddLink ( 'Monobook.js', 'Special:Mypage/monobook.js' );
  shortcutsAddLink ( 'Monobook.css', 'Special:Mypage/monobook.css' );
  shortcutsAddLink ( 'Scripts', 'Wikipedia:WikiProject User scripts/Scripts' );
  shortcutsAddLink ( 'wikEd', 'User:Cacycle/wikEd' );
  shortcutsAddLink ( 'Twinkle', 'Wikipedia:WikiProject User scripts/Scripts/Twinkle' );
  shortcutsAddLink ( 'Friendly', 'Wikipedia:WikiProject User scripts/Scripts/Friendly' );
  shortcutsAddLink ( 'New pages', 'Special:Newpages' );
  shortcutsAddLink ( 'AIV', 'Wikipedia:Administrator intervention against vandalism' );
  shortcutsAddLink ( 'Help desk', 'Wikipedia:Help desk' );
 
}
 
// User watchlist from [[User:Tra/userwatchlist.js]]
importScript('User:Tra/userwatchlist.js');
 
// Logs link in toolbox
if (wgCanonicalNamespace!='User' && wgCanonicalNamespace!='User talk')
importScript('Wikipedia:WikiProject User scripts/Scripts/Logs link');
 
// Reformats compare button in history as a link
if (wgAction=='history')
importScript('MediaWiki:WikiProject User scripts/Scripts/Compare link.js');
 
// Performs basic formatting changes from a tab while editing
if (wgAction=='edit' || wgAction=='submit')
importScript('Wikipedia:WikiProject User scripts/Scripts/Formatter');
 
// Quick previewing button in editing toolbar
if (wgAction=='edit' || wgAction=='submit')
importScript('User:Alex Smotrov/qpreview.js');
 
// Gives assessment data for an article
if (wgCanonicalNamespace=='')
importScript('User:Outriggr/metadata.js');
 
// Adds extra edit/hist tabs for both discussion page and article page
importScript('Wikipedia:WikiProject User scripts/Scripts/Six tabs');
 
// Improves formatting of history pages
if (wgAction=='history')
importScript('User:Alex_Smotrov/histcomb.js');
 
// [[User:GeorgeMoney]] script improves search box functionality
$(function() {
    document.getElementById('searchform').action = "http://wikipedia.georgemoney.com/search.php";
    document.getElementById('searchInput').name = "title";
});
 
// Edit top link by [[User:Alex Smotrov]]
importScript('User:Alex_Smotrov/edittop.js');
if (wgAction=='edit' && document.URL.indexOf('&section=0') != -1)
$(function(){
document.getElementById('wpSummary').value = "/* Intro */ ";
})
 
// Unwatch links next to page names in watchlist from [[User:Alex Smotrov/wlunwatch.js]]
if (wgCanonicalSpecialPageName && wgCanonicalSpecialPageName=='Watchlist' && wgAction=='view') 
$(function () {
var frm = document.getElementsByTagName('form')[0];
frm.parentNode.insertBefore(document.createTextNode(' | '), frm);
var lnk = document.createElement('a');
lnk.appendChild(document.createTextNode('Unwatch…'));
lnk.href = 'javascript:importScript("User:Alex_Smotrov/wlunwatch.js")';
frm.parentNode.insertBefore(lnk, frm);
})
 
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:S/tags.js');
autosubmit=false;
minoredit=true;
show_cwli=true;
 
// Box with newest pages in sidebar
importScript('User:TheJosh/Scripts/NewPagePatrol.js');
npp_enabled = false;
npp_num_pages = 10;
npp_refresh = 5;
 
// Box with recent changes in sidebar
importScript('User:TheJosh/Scripts/RecentChangesPatrol.js');
rcp_enabled = false;
rcp_num_pages = 10;
rcp_refresh = 5;
 
// Nice formatting for [[Special:Log]]
if (wgCanonicalSpecialPageName && wgCanonicalSpecialPageName=='Log')
importScript('User:Alex_Smotrov/logpage.js')
 
/*
 
== Scripts in this area are disabled in Internet Explorer due to compatibility issues ==
*/
var detect = navigator.userAgent.toLowerCase();
var IE;
var place = detect.indexOf('msie') + 1;
if (place) IE=true;
if (!IE) {
 
// Twinkle script (reverting, warning, reporting, csd, xfd, prod, rpp)
importScript('User:AzaToth/twinkle.js');
 
TwinkleConfig = {
 
revertMaxRevisions              :       50,
userTalkPageMode                :       'tab',
showSharedIPNotice              :       false,
openTalkPage                    :       [ 'agf', 'norm', 'vand' ],
openTalkPageOnAutoRevert        :       true,
openAOLAnonTalkPage             :       false,
summaryAd                       :       " ([[WP:TW|TW]])",
deletionSummaryAd               :       " ([[WP:TW|TW]])",
protectionSummaryAd             :       " ([[WP:TW|TW]])",
watchSpeedyPages                :       [ ],
watchProdPages                  :       true,
openUserTalkPageOnSpeedyDelete  :       [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
watchRevertedPages              :       [ ],
markRevertedPagesAsMinor        :       [ 'agf', 'norm', 'vand', 'torev' ],
deleteTalkPageOnDelete          :       false,
watchWarnings                   :       true,
markAIVReportAsMinor            :       false,
markSpeedyPagesAsMinor          :       false,
offerReasonOnNormalRevert       :       true
};
 
// [[User:Cacycle/wikEd]] in-browser text editor
if (wgAction=='edit' || wgAction=='submit' || wgAction=='diff')
importScript('User:Cacycle/wikEd.js'); 
 
// [[WP:FRIENDLY]] script similar to Twinkle (tagging, welcoming)
importScript('User:Ioeth/friendly.js');
 
FriendlyConfig = {
  summaryAd               :  " ([[WP:FRIENDLY|Friendly]])",
  watchWelcomes           :  false,
  markWelcomesAsMinor     :  false,
  watchTaggedPages        :  false,
  markTaggedPagesAsMinor  :  true,
  insertHeadings          :  true,
  welcomeHeading          :  "== Welcome ==",
  insertUsername          :  false,
  insertSignature         :  true,
  quickWelcomeMode        :  "semiauto",
  quickWelcomeTemplate    :  "Wel"
};
 
// [[User:Voice of All]]'s helper JavaScript
importScript('User:Voice of All/Addtabs/monobook.js');
 
// UTC time clock with double-click purge function
importScript('User:Voice of All/UTCclock.js');
 
// Some history-related script from VoA
importScript('User:Voice of All/History/monobook.js');
 
// [[User:Lupin/recent2.js]] anti-vandalism script
importScript('User:Lupin/recent2.js');

/*
 
== Scripts in this area have been added by [[User:Doug]] from other sources ==
*/



importScript('User:AWeenieMan/furme.js');

importScript('User:AWeenieMan/furmeScroller.js');




}
/*
importScript('Wikipedia:WikiProject User scripts/Scripts/Changes since I last edited');
*/

/*
// HistoryCount
$(function (){
var N = 250;      // <<== CHANGE TO YOUR LIKING
var x = document.getElementById('ca-history');
if(!x) return;
x.getElementsByTagName('a')[0].href += "&limit=" + N;
});

//
*/


importScript('Wikipedia:WikiProject User scripts/Scripts/Watchlist since');



/* <pre> [[User:DStoykov/defaultsort.js]] <nowiki> */
 
function defaultsort() {
//var apiurl = mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml';
//var xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : null;
//xmlhttp.open('GET',apiurl, false);
//xmlhttp.send(null);
//alert(xmlhttp.responseXML.getElementById('14').childNodes[0].nodeValue);
 
var txt = document.editform.wpTextbox1.value;
var sortkey = '';
// Save the position of the editbox scrollbar
var scrollPosition = document.editform.wpTextbox1.scrollTop;
// Create an array of all category links
if (txt.match(/\{\{\s*defaultsort/i)) {
alert('There\'s already a defaultsort statement!');
return;
} 
var catlinks = txt.match(/\[\[\s*((C|K)at(e|e)gor(y|i|ie|ia|ia|ija|io)|Кат(е|э)гор(ия|ија|ія|ыя)|Luokka|Flokkur)\s*:.*\]\]/ig);
if (!catlinks) {
alert('There are no category links!');
return;
} 
for (i=0; i< catlinks.length; i++) {
// Extract the name of the category
var catname = catlinks[i].replace(/.+\s*:\s*([^|]*[^|\s])\s*(\|.*)?\]\]/,"$1");
// Extract the sort key 
var match = /\|[^\]]+/.exec(catlinks[i]);
if (match == null) {
	          alert('Category '+catname+' doesn\'t include a sort key!'); 
return;
}
// Strip the '|' and any trailing spaces
var sk = match[0].replace(/\|(.+)/, "$1").replace(/(\S) +$/,"$1");
if (i == 0) {
sortkey = sk;
} else {
if (sortkey != sk) {
alert('Not all sort keys are identical!\nThe sort key for category '+catname+' is different.');
return;
}
}
}
// Now that we know that everything is OK, we can proceed with modifying the content of the editbox
txt = txt.replace(catlinks[0], "{{DEFAULTSORT:"+sortkey+"}}\n"+catlinks[0]);
for (i=0; i< catlinks.length; i++) {
subst = catlinks[i].replace(/\|[^\]]+/,"");
txt = txt.replace(catlinks[i], subst);
}
document.editform.wpTextbox1.value=txt;
// Restore scroll position
document.editform.wpTextbox1.scrollTop = scrollPosition;
}
 
$(function () {
if(document.forms.editform) {
mw.util.addPortletLink('p-cactions', 'javascript:defaultsort()', 'defaultsort', 'ca-defaultsort', '', '', document.getElementById('ca-purge'));
}
});
 
/* </nowiki></pre> */

importScript('User:TheDJ/Gadget-HotCat.js');

importScript('User:Ais523/adminrights.js');
importScript('User:Lifebaka/closeafd.js');
importScript('User:Lifebaka/closedrv.js');
importScript('User:Lifebaka/purge.js');
importScript('User:Doug/closetfd.js');
importScript('User:King of Hearts/closeffd.js');
importScript('User:King of Hearts/closecfd.js');
importScript('User:King of Hearts/closerfd.js');
importScript('User:Doug/closemfd.js');

// [[User:Krimpet/CH2.js]]
importScript('User:Krimpet/CH2.js');

// CSD Helper - Provides easy deletion/declining/prodding via AJAX)
importScript('User:Ale_jrb/Scripts/csdhelper.js');  //[[User:Ale_jrb/Scripts]]

//Configuration for CSDHelper
var overwriteDeclineReasons = true;
var notifyByDefaultDel = false;
var notifyByDefaultDec = false;
var notifyByDefaultPrd = false;
var notifyByDefaultNew = false;
var redirectAfterDel = wgServer + '/wiki/' + wgPageName;
var myDeclineListing = '%CRITERION%: %REASON%';
var myDeclineSummary = 'Decline speedy - %REASON%';
var myDeclineSummarySpecial = 'Decline speedy - %REASON%';
var logOnDecline = true;
var logOnDeclinePath = 'User:Doug/List of declined speedies';  
importScript('User:SoWhy/csdreasons.js'); // Set of custom decline and delete reasons
// End configuration