User:Lenore/autolink.js: Difference between revisions

Content deleted Content added
Migration: addOnloadHook → $; wg* → mw.config.get('wg*'); getElementsByClassName → $('.class'); This is imported from it:wikt:MediaWiki:Gadget-autolink.js
m Bugfix: Allow for &diff or ?diff; Better ways to do this would involve more editing
 
(One intermediate revision by one other user not shown)
Line 31:
/* ---------------------------------------- Variables ------------------------------------------- */
 
var autolinkDiff = ___location.href.indexOf('&diff=') != -1;
// It says if I'm in a diff page
 
Line 46:
if (autolinkDiff) { // in diff pages
if (autolinkParseLink) { // without wikEd
autolinkTargetDiv[0] = document.$('.diff');
 
autolinkTargetDiv[1] = document.$('.firstrevisionheader');
autolinkColor = 'inherit'; // not coloured links
} else { // with wikEd
autolinkTargetDiv[0] = document.$('.comment');
autolinkColor = ''; // coloured links
}
} else if (autolinkCrono || autolinkEdit) { // in comments
autolinkTargetDiv[0] = document.$('.comment');
autolinkColor = ''; // coloured links
} else { // in code sections
autolinkTargetDiv[0] = document.getElementsByTagName$('source');
autolinkTargetDiv[1] = document.$('.javascript');
autolinkTargetDiv[2] = document.$('.source-javascript');
autolinkTargetDiv[3] = document.$('.css');
autolinkTargetDiv[4] = document.$('.source-css');
autolinkColor = ''; // coloured links
}