Background color of JS to copy Edit

The background color of the JS to copy is black here:

It needs to be a different color from the text. Probably need to indicate both. I see some attempts in the wikitext but it is not working. ---Timeshifter (talk) 04:59, March 21, 2012 (UTC)

Fixed. -- pecoes 05:53, March 21, 2012 (UTC)

Delete the old CSS in MediaWiki:Common.css if importing it Edit

Please advise people to delete the old CSS in MediaWiki:Common.css before importing MediaWiki:Common.css into MediaWiki:Wikia.css

Otherwise the old CSS will confuse people, and possibly mess up things too since it has not been used for a long time. Many things have changed since it was last used. ---Timeshifter (talk) 05:11, March 21, 2012 (UTC)

If you think that needs to be added by all means do. I already told you I know nothing about the legacy CSS. There's nothing I can contribute to that topic. -- pecoes 05:39, March 21, 2012 (UTC)
OK. I added a note. Feel free to edit it. ---Timeshifter (talk) 13:43, March 23, 2012 (UTC)

Text color on some wikis Edit

Look at the orange text color in the various boxes here:

Some of the text is not legible in some of the boxes. The boxes with the green background. I suggest hard-coding the text color in those boxes. --Timeshifter 01:18, March 30, 2012 (UTC)

Yeah. That's barely readable. I'll look into it! -- pecoes 02:18, March 30, 2012 (UTC)
I fixed it. Feel free to change it. --Timeshifter 10:10, April 1, 2012 (UTC)
I probably will. It should work on every wiki now, but it doesn't really look good on every wiki, does it? It dawned on me that this page doesn't follow any of the Shared Help's color policies. I'll have to do a bit of research... (which is why I postponed the edit btw) -- pecoes 10:14, April 01, 2012 (UTC)
I am happy when something works at all on Wikia. ;) --Timeshifter 11:37, April 1, 2012 (UTC)

Incomplete Edit

Why aren't some pages mentioned here, especially usergroup specific pages like MediaWiki:Group-autoconfirmed.js, etc..?—  Ultimate Supreme talk · wiki I · wiki II  05:46, November 26, 2012 (UTC)

Those were added as part of MW1.18 (mw:Manual:User group CSS and Javascript). This page predates them. In any case, those files aren't really that useful since they run on all skins like Common.js and there really aren't many scripts that need to be restricted to particular groups. w:c:dev:RevealAnonIP and w:c:dev:AjaxBatchDelete are the only ones that come to mind.
In any case, a lot of people have difficultly understanding how this works as it is, adding those will make things more complicated. You could create Help:JavaScript and CSS Cheatsheet/Advanced if you want to write about them. Lunarity 04:13, January 21, 2013 (UTC)

Common.css New vs Old Wiki Edit

It says here that the implementation for Common.css is different for older wikis and newly created wikis. How do I know if the my wiki is considered old or new? I'm guessing that your reference is relative to the time this article was written, but us readers don't know it at first glance and I don't want to dig up history on when those statements were added. Please add an absolute date or even time range so we know which implementation our wikia falls into. Thanks. Dragonjet (talk) 14:20, January 27, 2015 (UTC)

All wikis that use Wikia's default skin are "new" for this purpose. If your wiki was created in recent years and you haven't tried to change the skin (or don't know what that means) you can safely assume it's "new". If you want to be 100% certain, attach "?useskin=wikia" to the URL of any page and see what happens. Most likely nothing. Which means your wiki is "new".  Yes, that happened (talk) 14:44, January 27, 2015 (UTC)
Thanks for bringing this up - we've updated the text in this edit to try and help clarify matters. (@ Yes, that happened: I think the intended question is a little different to what you thought) Kirkburn  talk  contr  @fandom  17:07, January 27, 2015 (UTC)

Javascript on a single page. Edit

There is no given way here to run Javascript on only a single page. Does it exisit? If yes, I'd be interested, and I would be looking for it in this article.

Gloweye (talk) 09:05, April 21, 2015 (UTC)

You can wrap the code you want in a conditional that checks for the page. For instance:
if (wgPageName === "Help_talk:JavaScript_and_CSS_Cheatsheet") {
    whatever code you want;
-- RansomTime 09:19, April 21, 2015 (UTC)
hmm...Well, that works, but it doesn't really seem like an elegant solution to me. Ah well, can't have everything. Gloweye (talk) 13:13, April 21, 2015 (UTC)
Since JS is an easy way to mess things up (and a potential attack vector) it's restricted to one or two admin-only files. Sure, that makes it cumbersome, but it's also safe and reliable. That doesn't mean all scripts have to be in the same file however. You can include external scripts to avoid bloat in the main script. Just take care that all scripts are well protected - preferrably by placing them in the MediaWiki namespace as well. Yes, that happened (talk) 14:54, April 21, 2015 (UTC)
If it's a large script, you can put the import in the conditional, this will impact the load time on that single page - as the browser needs to fetch the additional script -- RansomTime 14:58, April 21, 2015 (UTC)
Yeah, I've got a few scripts on my home Wiki already, some ~1000 odd lines in total - but these are required over the entire wiki. I was wandering about a certain calculator I wanted to make, which would only be needed on one page. Thanks for your answers everyone. Gloweye (talk) 15:24, April 21, 2015 (UTC)
I'm curious about your comment that it doesn't seem like an elegant solution: what would be your ideal hypothetical elegant solution for this? -452 16:03, April 21, 2015 (UTC)