Forum:Common.js

Discussion: 6 June &rarr; 15 June
I just noticed that MediaWiki:Common.js has no effect on any of the codes. Anyone else notice? Anyone feel like doing anything to get it back? Me? I don't really mind about it. Bermuda  Contact Me!  22:55, June 6, 2011 (UTC)


 * I believe Moncho came up with a fix for that in his css/js blog.--

Bermuda  Contact Me!  23:07, June 6, 2011 (UTC)
 * The import for Common.css? Hmm.... This just happened today. Common.js has always been working fine.


 * We seem to be experiencing the same problem. Anything I do tonight to MediaWiki:Common.js seems to be of no effect to the Oasis skin (functions okay for the Monobook skin). I even tried importing MediaWiki:Common.js into MediaWiki:Wikia.js with the following, to no effect:

 // Importing MediaWiki:Common.js

importScriptURI('http://admintools.wikia.com/index.php?title=MediaWiki:Common.js'    + '&action=raw&ctype=text/javascript');

// END Importing MediaWiki:Common.js
 * Any ideas? Thanks! — Spike Toronto  12:51AM EDT, June 7, 2011

Bermuda  Contact Me!  18:35, June 7, 2011 (UTC)
 * Another thing I noticed is that logged-in users don't see anything. The opposite seems to be for logged-out users; they see the stuffs. Hmm...
 * Make sure you have no syntax errors. Some syntax errors, like extra or missing brackets, will cause some browsers to completely discard a file. Furthermore,  can cause cascading failure if a function at the beginning of a file is throws an error.

I sent this to Special:Contact yesterday. They seem to be working on it. ^.^ Hopefully fixed soon enough and that they too are seeing this problem, not just some people... Bermuda  Contact Me!  18:59, June 7, 2011 (UTC)


 * Thanks for the update Bermuda. Thanks also for your input Monchoman45. — Spike Toronto  6:38PM EDT, June 7, 2011


 *  UPDATE : I added the template at the top of this page to ask that a Wikia Staffer update us on the progress/status of this issue. Thanks! — Spike <font color="#000000" face="Garamond" size="3">Toronto  12:24AM EDT, June 10, 2011


 * Any updates from Wikia Staff about how this is progressing? Thanks! — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  2:38AM EDT, June 13, 2011

In general testing, we're not seeing any problems with Common.js loading of Oasis at all. Do you have specific examples (as in wikis) where its not? Have you checked your code to make sure it has no errors? One of the biggest reasons to use Special:Contact (ON YOUR WIKI) to report this, is that it gives us the 2 most important pieces of information we need WHAT WIKI, and WHAT BROWSER ARE YOU USING. --Uberfuzzy 07:51, June 15, 2011 (UTC)


 * But, if everything had been working perfectly, and nothing had changed on one’s wiki — no MediaWiki files had been changed; no personal "<tt>.css</tt>" and "<tt>.js</tt>" files had been altered; <tt>global.js</tt> remains unchanged; same browser; etc.; — and the “event” is occurring across wikis, then ceteris paribus (all things remaining unchanged), it stands to reason that it’s a Wikia-wide issue. Hence, why we came to the forum. In any event, on our wiki, it seems to be affecting anyone and everyone using the Oasis skin. I do not know if there is any difference depending on one’s browser. Thanks! — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  4:05AM EDT, June 15, 2011


 * P.S. If one reads a little higher on this page, one can see that Bermuda already used Special:Contact on his wiki to enquire about the issue. He was told that the problem went beyond his wiki (his report is above). He has also written again as follow-up. Still nothing. Thanks! — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  4:08AM EDT, June 15, 2011


 * http://admintools.wikia.com/index.php?title=MediaWiki:Wikia.js&curid=6234&diff=24739&oldid=24670 You were including ALL of Common.js when Wikia.js was loading. That means you were double declaring every variable and function. This was causing massive JS errors, and making nothing work. You DO NOT need to do this. --Uberfuzzy 08:10, June 15, 2011 (UTC)


 * Thanks for that! Odd though, that the Wikia skin will not take account of <tt>Common.css</tt> without it being imported into <tt>Wikia.css</tt>, yet the same does not have to be done to get the Wikia skin to take account of <tt>Common.js</tt>. Hmm … — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  4:15AM EDT, June 15, 2011

Yes, that is done intentionally. There were thousands upon thousands wikis that had custom Common.css that could potentially conflict with things in oasis, as we had various versions of "default" text in there for years. Most of those defaults are now "part of" Oasis, so dont need to be included. You really should check to see what you have in there before you just @include the whole Common.css into Wikia.css. Things like default css for infoboxes, forumlistings, and other other "standard" things are now loaded in a different way in Oasis. But Common.js never had any defaults, and things put there were put there by admins, and its far easier to have JS be "skin aware" then CSS (but is also possible), and most JS would need a few tweaks to be working in Oasis anyway, so we werent worried about leaving that including in the new skin. There were also MUCH smaller number of wikis using Common.js then Common.css (like orders of magnitude difference). You should only rarely have to add anything to Wikia.js ever, and thats if you want it to ONLY run for oasis users. You can actually take a look at what you have in common.js and see if there are things that only affect monobook users, and move them to Monobook.js, so it doesnt even have to load for people in other skins. --Uberfuzzy 08:22, June 15, 2011 (UTC)


 * I did try not to long ago to rationalize our MediaWiki files, but the work was not entirely successful. We took a great deal of what was in Common.js and placed them in subpages (e.g., Common.js/CEB.js for wiki-wide custom edit buttons). So, once these routines were hived off to separate files, we then imported into Common.js those scripts that applied to both skins (Monobook and Oasis); imported into Monobook.js those scripts that applied only to Monobook; and imported into Wikia.js those scripts that applied only to Oasis. The project simply did not work. Nothing imported to the Wikia.js file worked, and not everything imported to the Monobook.js file worked either. But, if everything were imported into the Common.js file then everything works in whichever skin it is meant for. But, that is utterly illogical! I tried more or less the same thing with the ".css" files where I moved sections out of Common.css and into either Monobook.css or Wikia.css depending on which skin the CSS code was meant for. This was a little more successful, but oddly some CSS code would not work unless we put it in Common.css. Go figure! :( — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  4:38AM EDT, June 15, 2011


 * Depending on how long ago it was, there was periods when some pages stopped including when they should, or in the correct order, or at all. After some of the MW upgrades, some wikia specific hacks were lost for a few days (such as making MediaWiki:Wikia.css/js load while the skin is named 'oasis' internally, making it briefly revert to the "natural" state of loading MediaWiki:Oasis.css/js), but these are usually fixed ASAP after reported. So, depending on when it was, you may not have been doing anything wrong, it just may not have worked at all "as it should". I agree its not entirely rational or consistent, but it works for the most part, and it was a good compromise to break as few things as possible for customizers like you moving forward with Wikia's roadmap. --Uberfuzzy 09:24, June 15, 2011 (UTC)


 *  UPDATE : Well, Uber, I have some bad news. The edit that you graciously made to our MediaWiki:Wikia.js did not solve the problem. The MediaWiki:Common.js file is simply not loading for users of the Oasis skin (no probs for users of the Monobook skin) on our wiki. So I go back to my comment earlier:"But, if everything had been working perfectly, and nothing had changed on one’s wiki — no MediaWiki files had been changed; no personal '<tt>.css</tt>' and '<tt>.js</tt>' files had been altered; <tt>global.js</tt> remains unchanged; same browser; etc.; — and the “event” is occurring across wikis, then ceteris paribus (all things remaining unchanged), it stands to reason that it’s a Wikia-wide issue. Hence, why we came to the forum. In any event, on our wiki, it seems to be affecting anyone and everyone using the Oasis skin. I do not know if there is any difference depending on one’s browser."It’s too bad because I am finally starting to get used to Oasis and think it’s quite attractive (although I wish article/talkpage text could occupy more of the screen and the sidebar/rail/skyscraper thingie less …). But, this forces us back to that old stand-by, that old war-horse, the one we all love, Monobook. Unfortunately, there are a whole raft of Wikians for whom Oasis is the only skin with which they are comfortable and they’re not getting its full functionality on our wiki. I hope the techies can get this problem that is cropping up here and there across Wikia fixed. Thanks Uberfuzzy! — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  6:29PM EDT, June 15, 2011


 * P.S. I even disabled my global.js file here on Community because I read in another forum thread where Monchoman45 said that it can sometimes interfere with the loading of Common.js on one’s local wiki. (Something about loading order and dollar signs … it was over my head … ) Unfortunately, Disabling global.js made no difference. Thanks! — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  6:29PM EDT, June 15, 2011

Discussion: 16 June &rarr;
 UPDATE56 : I just ran a most interesting experiment. Although its results are perplexing to me, I’m sure the more technically oriented here will be able to figure out what it means. Here goes … I wanted to see if an IP-only editor would have the same difficulty with Common.js loading, so I logged out. I closed the browser, cleared the cache. Then I went back to my home wiki as an IP-only editor (i.e., not logged in). Lo and behold, all of the functionality of our Common.js was present. I then logged back in to compare. Once I logged back in, all of the functionality of our Common.js was gone. Now here’s where it gets perplexing … I do not load anything for the Wikia skin from my userspace. (I do have a monobook.js in my userspace, but I wasn’t in that skin, so it’s not relevant.) I had cleared out my global.js file over here some hours before, cleared the cache, and made sure that it was no longer of effect. So, no personal JS settings were loading that might interfere with the loading of Common.js. Whatever my problem is when logged in, it might also be the problem of other Wikians experiencing this issue. Any thoughts, ideas, or suggestions? Thanks! — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  3:27AM EDT, June 16, 2011


 * Just thought I'd mention that I'm also experiencing the same issue regardless of what wiki I'm on (first noticed it on w:c:fable, where we use AJAX auto-refreshing Recent Changes and collapsible tables, neither of which are currently working). I also repeated the above experiment and achieved the same results - there appears to be no issue for logged-out users, but once logged in, all Java functionality disappears for Oasis but not Monobook. We don't have anything in our Wikia.js and I cleared my personal Global.js which didn't affect the problem at all. As for my browser, I'm using IE8. -- <font color="#4682B4">Enodoc (<font color="#228B22">Talk ) 13:50, June 16, 2011 (UTC)


 * Enodoc you have reproduced perfectly my setup, which includes IE8! And, the most notable JS not functioning is also Ajax auto-refreshing RecentChanges and anything collapsible. — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  3:20PM EDT, June 16, 2011


 * I'm seeing javascript on Fable load perfectly in both IE and Chrome, logged in and out... The 888th Avatar   (talk)  15:49, June 16, 2011 (UTC)

Since pages for logged in users are built using things that are specific to them (such as person /global.js and /skin.js, and preference stuff), its nearly impossible to serve cached assets to them, so we dont for the most part. Since pages for logged out users are exactly the same, they can be served a cached version. There are some features that we only show to logged in users (the toolbar, some userpage interactive stuff, upload related things, etc) so those assets are only served to logged in users and not to logged out. So there are 2 separate "blobs" of combined JS that get served to you based if you are logged in/out. It is entirely possible that logged out users are getting working js, and the package for logged in users has some small flaw somewhere. One of the greatest hurdles of JS, is that once something in a script block breaks, it tends to break everything AFTER it. Wikia's code comes before your site's common.js, your site's skin.js, your global.js and your skin.js, so if ours is broken, none of your user editable stuff will work. In additional to this whole mess (oh yeah, it gets more complex) we're rolling out a new cache system (this is what finally fixed the image problem) so its possible there are still glitches left, and when you make edits to common.js for your wiki, it may not be purging (serve side purge, to our cache servers, not action=purge or F5 purges that users can do), to BOTH the logged out and in packages correctly/consistently. So changes you made recently may (like blanking something) may be updated to YOU since your logged in, but logged out users are still getting the non-blanked version. I've found the best way to check/force this, is to put a comment in the top of your common.js, and when you save, put (thats 5 of them, not 4), this will turn into the timestamp of the page when you saved it, causing a minor change to the page, but not the code, but this will cause purges to go back out (just doing a null/no-change save wont cause a purge because the content hasnt changed, dont ask, its a hash thing, its complicated) --Uberfuzzy 17:14, June 16, 2011 (UTC)


 * Thanks Uberfuzzy for the explanation and the tip! I just placed a commented timestamp at the top of MediaWiki:Common.js with this edit. As you can see, it produced the timestamp. That, if I understood correctly, should have cleared the server-side cache. I then pressed Ctrl-F5 to clear the cache on my PC. Still no change. Still not getting AJAX auto-refreshing RecentChanges, collapsible tables, and other JS goodies. I have not restored my global.js yet, so that is not an issue, nor do I have javascript loading from my personal userspace on that wiki. So, based on what you said above, that makes me think, through the process of elimination, that the problem is “upstream” from us. Thanks! — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  5:04PM EDT, June 16, 2011


 * While logged in as you, in Oasis, I checked the box for ajaxrc, then made an edit in another browser using another account and it worked, and showed up all ajax'y. So no, its not broken, nor upstream.
 * Also, saw this while logged in as you on that wiki.

Uncaught ReferenceError: readCookie is not defined http://admintools.wikia.com/index.php?title=User:SpikeToronto/common.js%2FextraRollbacks.js&action=raw&ctype=text/javascript Line 46 Took 2 seconds to find by opening the browser's debug console. So might in cases like these, where the wikis is all sorts of hacked up/customized, AND you have a bunch of personallized custom JS, might want to start checking claims of "it doesnt work" using a relatively clean account. --Uberfuzzy 12:31, June 18, 2011 (UTC)


 * Uberfuzzy, I'm curious about how you could get that JS error, since all Common.js code is wrapped inside a try{ }catch{ } statement (placed by Wikia). It's normal for people to not see what's going on if all relevant errors end eaten by that gotta catch'em all. Also note that now it seems that Wikia even does a minification of the Common.js, which probably could cause other bugs about special JS code like conditional comment for Internet Explorer users, which is tricky for JS minification. Of course, there's no documentation of that try-catch wrapper nor the JS minification. --Ciencia Al Poder (talk) -WikiDex 13:15, June 18, 2011 (UTC)


 * Dunno, but http://dl.dropbox.com/u/83100/spike_at_admintools_error.png --Uberfuzzy 13:19, June 18, 2011 (UTC)


 * Ok, I found out that the error you got is from User:SpikeToronto/common.js included file, since included files are outside of the try-catch wrapper. --Ciencia Al Poder (talk) -WikiDex 13:21, June 18, 2011 (UTC)