User:Schazjmd/common.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
The accompanying .css page for this skin is at User:Schazjmd/common.css. |
mw.loader.using('ext.gadget.wikEdDiff').then(function () {
mw.loader.load('ext.gadget.Navigation_popups');
});
//importScript('User:Shubinator/DYKcheck.js'); //DYKcheck tool
//importScript( 'User:DannyS712/DiscussionCloser.js' );// [[User:DannyS712/DiscussionCloser.js]]
//importScript('User:קיפודנחש/pageCollector.js');
// list of "todo" pages and button legends for PageCollector
//var pagesToCollect = [
// {page: 'User:Schazjmd/useful links', caption: 'Save link'}
//];
// load pageCollector script:
//importScript('User:קיפודנחש/pageCollector.js');
//importScript('User:Theopolisme/Scripts/adminhighlighter.js');
//mw.loader.load('//en.wikipedia.org/w/index.php?title=User%3ATheopolisme%2FScripts%2Fadminhighlighter.js&action=raw&ctype=text/javascript');
importScript('User:Jackmcbarn/editProtectedHelper.js'); // Linkback: [[User:Jackmcbarn/editProtectedHelper.js]]
importScript('User:GregU/dashes.js');
// install page curation
importScript('User:Lourdes/PageCuration.js'); // Linkback: [[User:Lourdes/PageCuration.js]]
// install superlinks script
importScript( 'User:Bradv/Scripts/Superlinks.js' ); // Backlink: [[User:Bradv/Scripts/Superlinks.js]]
// install copyvio check
importScript( 'User:DannyS712/copyvio-check.js' ); // Backlink: [[User:DannyS712/copyvio-check.js]]
/* Adds a link in 'more' to do a copyvio check on the given page. Copy of User:The Earwig/copyvios.js,
but with a different link location (in the same place as other NPP scripts), and opens in a new tab rather than the current window */
mw.loader.using("mediawiki.util", function() {
mw.util.addPortletLink(
"p-cactions",
"https://tools.wmflabs.org/copyvios/?lang=" + mw.config.get("wgContentLanguage") + "&project=" + mw.config.get("wgSiteName").toLowerCase() + "&title=" + encodeURIComponent(mw.config.get("wgPageName")),
"Copyvio check",
"t-copyvio-check",
"Check this page for copyright violations"
);
});
$("#t-copyvio-check > a").attr("target", "_blank");
//enterprisey revdel tool
importScript( 'User:Enterprisey/cv-revdel.js' ); // Backlink: [[User:Enterprisey/cv-revdel.js]]
//delsort tool
//importScript( 'User:EnterpriseyBot/delsort.js' ); // Backlink: [[User:EnterpriseyBot/delsort.js]]
//draftify tool
//importScript( 'User:Evad37/MoveToDraft.js' ); // Backlink: [[User:Evad37/MoveToDraft]]
//<nowiki>
/**
* Admin highlighter 3.0
* ---------------------
* Derivative of of User:Theopolisme/Scripts/adminhighlighter.js
* Changes: cache list of admins, and tweak css to use nicer one by Jorm.
* This script highlights links to admins' userpages or talkpages in bodyContent
* (that is, everything but the tabs, personal links at the top of the screen and sidebar)
* by giving them a light background and border.
*
* @authors Galobtter, Theopolisme, Amalthea, Ais523
*/
var main = function(data){
ADMINHIGHLIGHT_EXTLINKS = window.ADMINHIGHLIGHT_EXTLINKS || false;
ADMINHIGHLIGHT_NAMESPACES = [-1,2,3];
mw.loader.using(['mediawiki.util','mediawiki.Uri', 'mediawiki.Title']).then(function() {
mw.util.addCSS(
"a.userhighlighter_sysop { background-color: rgba(100, 149, 237, 0.25) !important; border-top: .05em dashed rgba(100, 149, 237, 0.5); border-bottom: .05em dashed rgba(100, 149, 237, 0.5); }"+
"a.userhighlighter_sysop.mw-changeslist-title { background-color: transparent !important; border-color: transparent !important; }"
);
$('#bodyContent a').each(function(index,linkraw){
try {
var link = $(linkraw);
var url = link.attr('href');
if (!url || url.charAt(0) === '#') return; // Skip <a> elements that aren't actually links; skip anchors
if (url.lastIndexOf("http://", 0) !== 0 && url.lastIndexOf("https://", 0) !== 0 && url.lastIndexOf("/", 0) !== 0) return; //require http(s) links, avoid "javascript:..." etc. which mw.Uri does not support
var uri = new mw.Uri(url);
if (!ADMINHIGHLIGHT_EXTLINKS && !$.isEmptyObject(uri.query)) return; // Skip links with query strings if highlighting external links is disabled
if (uri.host == 'en.wikipedia.org') {
var mwtitle = new mw.Title(mw.util.getParamValue('title',url) || decodeURIComponent(uri.path.slice(6))); // Try to get the title parameter of URL; if not available, remove '/wiki/' and use that
if ($.inArray(mwtitle.getNamespaceId(), ADMINHIGHLIGHT_NAMESPACES)>=0) {
var user = mwtitle.getMain().replace(/_/g," ");
if (mwtitle.getNamespaceId() === -1) user = user.replace('Contributions/',''); // For special page "Contributions/<username>"
if (data[user] == 1) {
link.addClass('userhighlighter_sysop'); // Override the above color by using `a.userhighlighter_sysop.userhighlighter_sysop {background-color: COLOR !important}`
}
}
}
} catch (e) {
// Sometimes we will run into unparsable links, so just log these and move on
console.error('Admin highlighter recoverable error',e.message);
}
});
});
};
// Cache the admin json for a period of time
try {
var data = JSON.parse(localStorage.getItem('adminjson'));
} catch(e) {
console.error('Admin highlighter: failed to parse cached admin json object', e.message);
}
if (!data || !data.date || (Date.now() - data.date) > 43200000) { // 12 hours in milliseconds
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:Amalthea_(bot)/userhighlighter.js/sysop.js').then(
function(data) {
data.date = Date.now();
localStorage.setItem('adminjson', JSON.stringify(data));
main(data);
}
);
} else {
main(data);
}
//</nowiki>
$(document).ready(deletionChecker);
encodedTitle = encodeURIComponent(mw.config.get("wgPageName"));
function deletionChecker()
{
var encodedTitle = encodeURIComponent(mw.config.get("wgPageName"));
var delRequest = $.get("/w/api.php?action=query&list=logevents&format=json&leprop=ids&letype=delete&letitle=" + encodedTitle + "&lelimit=1", null, delCallback, "json");
if(mw.config.get("wgCanonicalNamespace") == "")
{
var afdRequest = $.get("/w/api.php?action=query&list=allpages&format=json&apfrom=Articles%20for%20deletion%2F" + encodedTitle + "&apto=Articles%20for%20deletion%2F" + encodedTitle + "&apnamespace=4&aplimit=1", null, afdCallback, "json");
}
}
function delCallback(delResults)
{
if(delResults.query.logevents[0] != null)
{
/*
var searchNode = document.createElement("a");
searchNode.href = mw.config.get("wgServer") + "/w/index.php?title=Special%3ALog&type=delete&page=" + encodedTitle;
searchNode.target = "_blank";
searchNode.innerHTML = "<span style='font-size:x-small;'>prev dels</span>";
document.getElementById("firstHeading").appendChild(searchNode);
*/
var searchNode = " <a id='prevDelsLink' target='_blank'><span style='font-size:x-small;'>prev dels</span></a>"
$("#firstHeading").append(searchNode);
$("#prevDelsLink").attr("href", mw.config.get("wgServer") + "/w/index.php?title=Special%3ALog&type=delete&page=" + encodedTitle);
}
}
function afdCallback(afdResults)
{
if(afdResults.query.allpages[0] != null)
{
/*
var searchNode = document.createElement("a");
searchNode.href = mw.config.get("wgServer") + "/w/index.php?title=Special%3AAllPages&from=Articles+for+deletion%2F" + encodedTitle + "&to=Articles+for+deletion%2F" + encodedTitle + "+%289z%29&namespace=4";
searchNode.target = "_blank";
searchNode.innerHTML = "<span style='font-size:x-small;'>prev AfDs</span>";
document.getElementById("firstHeading").appendChild(searchNode);
*/
var searchNode = " <a id='prevAFDsLink' target='_blank'><span style='font-size:x-small;'>prev AfDs</span></a>"
$("#firstHeading").append(searchNode);
$("#prevAFDsLink").attr("href", mw.config.get("wgServer") + "/w/index.php?title=Special%3AAllPages&from=Articles+for+deletion%2F" + encodedTitle + "&to=Articles+for+deletion%2F" + encodedTitle + "+%289z%29&namespace=4");
}
}
mw.loader.load( "https://meta.wikimedia.org/w/index.php?title=User:Zhaofeng_Li/Reflinks.js&action=raw&ctype=text/javascript" );
importScript('User:Ohconfucius/script/MOSNUM dates.js'); // [[User:Ohconfucius/script/MOSNUM dates.js]]
//importScript('User:Evad37/rater.js'); // [[User:Evad37/rater]]
importScript('User:Evad37/duplinks-alt.js'); // [[User:Evad37/duplinks-alt]]
importScript('User:Þjarkur/Permalink_to_section.js');
importScript('User:Þjarkur/CleanDiffURLs.js');
importScript('User:Þjarkur/Highlight homographs in title.js');
importScript('User:SD0001/find-archived-section.js'); // [[User:SD0001/find-archived-section.js]]
importScript( 'User:Headbomb/unreliable.js' ); // Backlink: [[User:Headbomb/unreliable.js]]
importScript('User:Mdaniels5757/markAdmins.js'); // Backlink: [[User:Mdaniels5757/markAdmins.js]]
importScript( 'User:Kaniivel/RefConsolidate_start.js' );
importScript('User:SD0001/easy-merge.js'); // Backlink: [[User:SD0001/easy-merge.js]]
mw.loader.load('https://commons.wikimedia.org/w/index.php?title=User:Jack_who_built_the_house/convenientDiscussions.js&action=raw&ctype=text/javascript');
mw.hook('convenientDiscussions.commentsReady').add(function () {
importScript('User:Gary/comments in local time.js');
});
importScript('User:PrimeHunter/Source links.js'); // Linkback: [[User:PrimeHunter/Source links.js]]
importScript('User:Nardog/MoveHistory.js'); // Backlink: [[User:Nardog/MoveHistory.js]]
mw.loader.load( '/w/index.php?title=User:GhostInTheMachine/SortWhatLinksHere.js&action=raw&ctype=text/javascript' ); // Backlink: [[User:GhostInTheMachine/SortWhatLinksHere.js]]
importScript('User:Writ Keeper/Scripts/massRollback.js'); // Backlink: [[User:Writ Keeper/Scripts/massRollback.js]]
importScript('User:Writ Keeper/Scripts/deletionFinder.js'); // Backlink: [[User:Writ Keeper/Scripts/deletionFinder.js]]
mw.loader.load( "//en.wikipedia.org/w/index.php?title=User:Ahecht/Scripts/TemplateSearch.js&action=raw&ctype=text/javascript" ); // Linkback: en:User:Ahecht/Scripts/TemplateSearch.js
importScript( 'User:Kaniivel/RefConsolidate_start.js' );
importScript('User:MPGuy2824/MoveToDraft.js'); // Backlink: [[User:MPGuy2824/MoveToDraft.js]]
importScript('Wikipedia:WikiProject User scripts/Scripts/CloseAFD.js');