Nifty though! — Hippietrail 01:26, 23 January 2007 (UTC)
G'day, very impressive! I respectfully suggest a couple of changes, though:
links[key].href
when you test links[key].pathname
:if( links[key].href && links[key].pathname && links[key].pathname.substr(0,6) == '/wiki/' && !( links[key].href.substr(0,local.length) == local ) )
'if(/\#.?redirect/i.test(me.xhr.responseText)) {' +
cheers, Webaware talk 14:08, 14 February 2007 (UTC)
/w/api.php?...
, so that the script can still be used from other Wiki projects (like Wikibooks, *.wikipedia.org, etc.)
Webaware
talk 02:19, 15 February 2007 (UTC)
Hi! Can you make this script to work in IE too? I'd like to use it but I cannot. (And I won't use Firefox!!!)
Diaby
talk 19:46, 14 January 2008 (UTC)
Thank you! Diaby talk 19:46, 22 January 2008 (UTC)
This looks like a very useful script :) It turns out, though, that the functionality has recently been added to MediaWiki, so run
could be replaced with:
addStylesheetRule = function(tag, style) {
var ss = document.styleSheets0];
if (ss.insertRule) {
ss.insertRule(tag + '{' + style + '}', ss.cssRules.length);
} else if (ss.addRule) {
ss.addRule(tag, style);
}
}
addStylesheetRule('a.mw-redirect', 'color:green');
...or something like that. (addStylesheetRule from User:Quarl/redirector.js) In addition, users could add something to their monobook.css to have redirects be highlighted on every page. Cheers, Gracenotes T § 17:32, 6 April 2008 (UTC)
Since you purposely hide this function from the Edit page, I don't know if it is intentional that the button still appears for the Preview page? Gary King ( talk) 23:02, 5 May 2008 (UTC)
addStylesheetRule breaks with the change of CSSs to bits.wikimedia.org Consider using appendCSS instead. Platonides ( talk) 15:26, 30 January 2010 (UTC)
Hi,
While I was clean up some old javascript and checking out gadgets on another wiki I came accros this script (it was copied there) and I gave it a quick update.
// Makes all links to redirects into green
// [[:en:User:Dschwen/highlightredirects.js]]
// Don't load on edit or special pages & don't load twice
if ( mw.config.get( 'wgAction' ) !== 'edit' && mw.config.get( 'wgCanonicalNamespace' ) !== 'Special'
&& typeof highlightRedirects == 'undefined' ) {
var highlightRedirects = {
tab_redirects : null,
run : function() {
mw.util.addCSS( 'a.mw-redirect{ color:green }' );
},
install : function() {
this.tab_redirects = mw.util.addPortletLink( 'p-cactions', 'javascript:highlightRedirects.run();', 'Redirects' );
if ( document.getElementById('ca-history') ) {
document.getElementById('ca-history').parentNode.appendChild( this.tab_redirects );
}
}
};
jQuery(document).ready( highlightRedirects.install );
};
Please note that this is meant to be run on MediaWiki 1.17 or higher (it won't work on English Wikipedia yet, and the current version will probably not brake right away under 1.17 but this version is future proof and free of function calls that are deprecated ( Deprecated functions?) which may be removed in a few months. Krinkle ( talk) 02:05, 15 February 2011 (UTC)
Nifty though! — Hippietrail 01:26, 23 January 2007 (UTC)
G'day, very impressive! I respectfully suggest a couple of changes, though:
links[key].href
when you test links[key].pathname
:if( links[key].href && links[key].pathname && links[key].pathname.substr(0,6) == '/wiki/' && !( links[key].href.substr(0,local.length) == local ) )
'if(/\#.?redirect/i.test(me.xhr.responseText)) {' +
cheers, Webaware talk 14:08, 14 February 2007 (UTC)
/w/api.php?...
, so that the script can still be used from other Wiki projects (like Wikibooks, *.wikipedia.org, etc.)
Webaware
talk 02:19, 15 February 2007 (UTC)
Hi! Can you make this script to work in IE too? I'd like to use it but I cannot. (And I won't use Firefox!!!)
Diaby
talk 19:46, 14 January 2008 (UTC)
Thank you! Diaby talk 19:46, 22 January 2008 (UTC)
This looks like a very useful script :) It turns out, though, that the functionality has recently been added to MediaWiki, so run
could be replaced with:
addStylesheetRule = function(tag, style) {
var ss = document.styleSheets0];
if (ss.insertRule) {
ss.insertRule(tag + '{' + style + '}', ss.cssRules.length);
} else if (ss.addRule) {
ss.addRule(tag, style);
}
}
addStylesheetRule('a.mw-redirect', 'color:green');
...or something like that. (addStylesheetRule from User:Quarl/redirector.js) In addition, users could add something to their monobook.css to have redirects be highlighted on every page. Cheers, Gracenotes T § 17:32, 6 April 2008 (UTC)
Since you purposely hide this function from the Edit page, I don't know if it is intentional that the button still appears for the Preview page? Gary King ( talk) 23:02, 5 May 2008 (UTC)
addStylesheetRule breaks with the change of CSSs to bits.wikimedia.org Consider using appendCSS instead. Platonides ( talk) 15:26, 30 January 2010 (UTC)
Hi,
While I was clean up some old javascript and checking out gadgets on another wiki I came accros this script (it was copied there) and I gave it a quick update.
// Makes all links to redirects into green
// [[:en:User:Dschwen/highlightredirects.js]]
// Don't load on edit or special pages & don't load twice
if ( mw.config.get( 'wgAction' ) !== 'edit' && mw.config.get( 'wgCanonicalNamespace' ) !== 'Special'
&& typeof highlightRedirects == 'undefined' ) {
var highlightRedirects = {
tab_redirects : null,
run : function() {
mw.util.addCSS( 'a.mw-redirect{ color:green }' );
},
install : function() {
this.tab_redirects = mw.util.addPortletLink( 'p-cactions', 'javascript:highlightRedirects.run();', 'Redirects' );
if ( document.getElementById('ca-history') ) {
document.getElementById('ca-history').parentNode.appendChild( this.tab_redirects );
}
}
};
jQuery(document).ready( highlightRedirects.install );
};
Please note that this is meant to be run on MediaWiki 1.17 or higher (it won't work on English Wikipedia yet, and the current version will probably not brake right away under 1.17 but this version is future proof and free of function calls that are deprecated ( Deprecated functions?) which may be removed in a few months. Krinkle ( talk) 02:05, 15 February 2011 (UTC)