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.

<pre style="margin-left:48px;"> 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)


 * That doesn't explain why I have the same problem though, considering I don't have any personal common.js that I'm aware of, and the only extra thing that I have myself is a global.js. -- <font color="#4682B4">Enodoc (<font color="#228B22">Talk ) 15:50, June 18, 2011 (UTC)

&larr; (outdent) Uberfuzzy, I appreciate the time you have spent on this, but it is being misdirected. First, if one is going to repeat an experiment, then one needs to repeat the actual experiment. When you logged in as me — using Special:Piggyback, I imagine — you failed to do as I had done. Contrary to CAP (whom I hate to contradict, by the way), there is no w:c:admintools:User:SpikeToronto/common.js! The w:c:admintools:User:SpikeToronto/common.js/extraRollbacks.js is loaded via w:c:community:User:SpikeToronto/global.js. Why did it show up when you ran your diagnostics? Because you forgot to repeat the experiment precisely. You did not disable global.js as I had. Remember: There is no w:c:admintools:User:SpikeToronto/common.js and there is no w:c:admintools:User:SpikeToronto/wikia.js; anything that loads for me that is not found in MediaWiki:Common.js comes from global.js. So, disabling global.js removes my “bunch of personallized custom JS” and permits me to “start checking claims of ‘it doesnt work’ using a relatively clean account.”

Once global.js is disabled, then you can run diagnostics under the same conditions in which both Enodoc and I ran our experiments. Given, that my global.js was not disabled when you ran diagnostics, it has not been proven that the problem is not upstream.

Also, I asked a chap on our wiki whom I knew to be a dedicated user of Oasis, whom I knew to have no global.js here at Community Central, and whom I knew to have neither common.js nor wikia.js in his userspace, to report back on certain questions I asked him. (These can be found at w:c:admintools:User talk:Head.Boy.Hog.) He reported back that everything was working for him. So, what’s the difference?! The difference is that — unlike Enodoc, myself, and others — he is not running Windows nor is he using Internet Explorer. Instead, he uses a MacBook (running Apple’s operating system) and uses Mozilla Firefox as his browser. So, this tells us that this is a problem most likely affecting those running Windows and Internet Explorer, a not uncommon combination.

Uberfuzzy, there’s no need to think that we are laying seige to Wikia with this complaint. There’s no reason to feel a need to defend Wikia and its mediawiki/skin implementation. It’s not under attack by us. Thus, your valuable time, which your are graciously spending with us on this problem, would perhaps be better spent opening up a ticket to get this issue solved for those affected who are running Windows and Internet Explorer. Thanks! — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  8:18PM EDT, June 18, 2011

P.S. I also have another account that has no admin privileges, no global.js (check here), no personal common.js, and no personal wikia.js (check here). I checked with it last week and it is no different than this account. Same MediaWiki:Common.js issues. I completely forgot to report that! I keep that account for when I want to see our wiki from the perspective of a regular user, someone without the sysop bit. It is User:SpikeTorontoTEST2. Uberfuzzy, you can use piggyback to check out that one too, if it helps. Thanks! — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  8:33PM EDT, June 18, 2011

P.P.S. I again ran this without any personal JS loaded and took a screen capture of the script diagnosis screen, if that helps. It can be found . It does show one error for line #72. Line #72 reads as follows:""The error description reads as follows:""Now, of course, I have no idea what any of this means, but I thought it might be useful. By the way, the same diagnostics when using Monobook produced no errors. Thanks! — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  4:52AM EDT, June 19, 2011


 * Just to clarify, when I said "common.js" I mean MediaWiki:Common.js, since Special:MyPage/common.js is not loaded under any circumstances. And Wikia wrapped all the MediaWiki:Common.js + MediaWiki:skinname.js code inside a try-catch block that silently eats up any JavaScript errors that could be produced inside any of those two JS files (not any other JS file included by importScript or similar), so if something is breaking inside your MediaWiki:Common.js there's no way you can diagnose it using the error console, effectively making those errors very hard to track and debug. So it may be a problem with some code in your MediaWiki:Common.js that's breaking. --Ciencia Al Poder (talk) -WikiDex 10:02, June 19, 2011 (UTC)


 * But, as I have asked before, and more than once, how can a MediaWiki:Common.js file that is unchanged suddenly be breaking, when it was working before? Moreover, how can the MediaWiki:Common.js on other wikis across Wikia be breaking similarly when their users also indicate that theirs had also not been changed? Finally, how can it be breaking for users with one OS/browser combo, but not for others with different OS/browser combos? This is about the first principles of study design: what is held constant and what is changed. Perhaps, when Wikia fixed the image upload problem, the law of unintended consequences kicked in causing an unexpected result. This all did start up once that problem was fixed. Of course, that may just be coincidence. All I do know is that the Windows/Internet Explorer combo is a common one and we need to make sure our wikis work for it. (By the way, that one file that was erroring out in Uberfuzzy’s diags was a personal ".js" file being loaded via global.js. When global.js is disabled, that error does not occur.) Thanks! — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  8:15PM EDT, June 19, 2011


 * I also have a problem. I don't know if this is a problem caused by Common.js but it could be. I was going to make a character page for one of my characters on the Hogwarts Roleplay Wiki and wanted to use the Staff Infobox but when I previewed, it said Template Loop Detected and whatever. So, I tested it in my Sandbox, I just added a picture and it showed up. We don't actually have anything in the MediaWiki:Common.js so I don't know why it's doing that. <font face="Segoe Script" size="3" color="Indigo" >Head.Boy.Hog <font face="Currier" size="2" color="Green">(Talk To Me)  11:25, June 19, 2011 (UTC)


 * Your problem is something else HBH. I’ve had the template loop issue before also. It’s usually fixable. Speak to me about it elsewhere. OR, you can open a new query here in the forum and get even better advice. Thanks! — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  9:36PM EDT, June 19, 2011


 * The error message above ("Object doesn't support this property or method. oasis  user  js, line 72 character 1") is an error in one of Wikia's files. The message itself is cryptic; I assume you're using Firebug as Chrome's console would know if it was a property or a method. Template loop detected means you've got an infinite loop of transclusion, e.g. Template:A is inside Template:B and Template:B is inside Template:A. This also occurs if you transclude a template in itself, e.g. if Template:A has the code , using it will give "Template loop detected".

P.S. Good explanation regarding the template loop, btw. — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  9:50PM EDT, June 19, 2011
 * Regarding the console, as mentioned throughout, I am using Internet Explorer 8 and whatever console one gets when one selects <tt>T o ols| D eveloper Tools F12</tt>. Note from the image that the error is indicated to be in the file <tt>oasis_user_js</tt> (indicated on the left side of the image), which, if I understand Uberfuzzy above, only loads for logged-in users (indicated on the right side of the image), and not for IP-only users (confirmed when I ran the script debugging console while not logged in). Thanks! — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  9:50PM EDT, June 19, 2011


 * No wonder it didn't know if it was an object or a method. You should use Chrome or Firefox with Firebug, as they have much more advanced consoles.


 * Monch, you may be very right, and that might fix the problem for me. But, it will not fix the problem for all those still using Windows/IE, which I believe to be the most common OS/browser combo on the Internet … Thanks again! — <font color="#DC143C" face="Garamond" size="3">Spike <font color="#000000" face="Garamond" size="3">Toronto  10:25PM EDT, June 19, 2011
 * That it is, however IE is, quite honestly, a worthless waste of time. Getting things to be compatible in IE is quite difficult, as Microsoft stubbornly refuses to standardize IE's components. It may be worth adding something to your wiki that recommends users view pages in Chrome or Firefox.