This Forum has been archived

Forums: Admin Central Index Technical Help User highlight code
Wikia's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.

Hello, I'm using the highlight code and I asked if it was possible to restrict the code application to wikiactivity/recentchanges/history/contribution, then I got this answer:

There are 2 sort of ways:
  1. Grab the code (not the import) and copy it 2 times (not possible with history)
    To the first copy you will add
    to the beggining of each class/id call.
    Repeat the same for the other copy
  2. The other option is to call it by JavaScript
 if ( wgCanonicalSpecialPageName === 'WikiActivity' || wgCanonicalSpecialPageName === 'Recentchanges' || wgAction === 'history') {
 	importStylesheetPage('Highlight/code.css', 'dev');
Thought the drawback is. If the user has disable its JS the names will not be highlight.
--Cizagna (Discusión) • HelperCentral hispana 10:11, 06 September 2011 (UTC)

I tried the JS code but didn't work, I used this code:

 if ( wgCanonicalSpecialPageName === 'WikiActivity' || wgCanonicalSpecialPageName === 'Recentchanges' || wgAction === 'history') {

Since I have my personal colors. Also for MediaWiki:Common.css, how can I make an "import command" like I do with js? (to import a css from a subpage). leviathan_89 22:01, 7 September, 2011 (UTC)

No one? leviathan_89 21:22, 13 September, 2011 (UTC)

Not sure about that, but if I recall correctly, you need define both the page and the wiki you want to import the sheet with importStylesheetPage from, like this:
importStylesheetPage('MediaWiki:Common.css/highlight.css', 'dev'); or
importStylesheetPage('MediaWiki:Common.css/highlight.css', 'onepiece'); or
importStylesheetPage('MediaWiki:Common.css/highlight.css', 'YOURWIKI'); depending on where the code is. But don't quote me on that. Sovq 07:33, September 14, 2011 (UTC)

That works! Thank you, I also suggest this to whoever use this type of code, this way only the link in those pages are "marked" otherwise every links (tabs, signatures,...) will be marked. leviathan_89 09:46, 14 September, 2011 (UTC)