Forum:Image pop-ups

Hi all, I'd like to know if it was possible to disable the pop-ups when clicking on images. At Combine OverWiki we need to have access to the "File:" namespace each time we click on a file for convenience, consistency and organization. Possible? While doubting it, I hope so. Thanks for helping! Klow 20:42, March 20, 2011 (UTC)


 * Discussed before. Unfortunately, there is no solution to this yet. — subtank  ( 7alk ) 23:44, March 20, 2011 (UTC)
 * Ok thanks. I hope it can be changed one day... Klow 10:05, March 21, 2011 (UTC)


 * Actually, in bringing this up again, I had an epiphany - instead of disabling the popups directly, you could make them invisible with CSS, and add a script that sends you to the file's page regardless of whether or not the box pops up.


 * So, kinda like AdBlock but for Wikia? It could be a ToU violation seeing that you're actually removing a feature Wikia insist the user should experience. Then again, I might be wrong. In serious need of clarification on what you can do and what you can't do with CSS. >.> — subtank  ( 7alk ) 16:18, March 21, 2011 (UTC)
 * Not to sound like a hacker or a vigilante, but I've found that you can do lots of things Wikia says you can't do without getting caught. Wikia doesn't have enough staff to patrol every wiki - the ToU rules are mostly there so that if a user complains to staff about something not being available, staff can actually do something about it. That being said, it's still not a good idea to break the ToU if you know you are, because staff can de-sysop you for that. But in cases where things are blurry, if staff don't like what you do, they'll tell you and let you take it down. Otherwise, the ToU basically says that you can't remove a piece of the interface, unless it's readily available somewhere else (within reason), or unless staff say it's ok (eg. read more headings). This issue is in the blurry area, so if staff don't like it they'll let us know.
 * Anyway, it is kind of like AdBlock. The only problem is, all images are already linked properly - when you click an image, the popups stop you from changing pages. So if you make the popups invisible, clicking an image does nothing. But that can be fixed with.


 * Please don't spread the 'Wikia can't/won't don't do anything about it' ideas. When Wikia does get to that point they will crack down worse on sites that deliberately broke the rules. As far as site-wide goes, this would be a no-go... but for personal it's fine. If Monchoman doesn't get anywhere with what he's working on, I will try my hand at it because I'd want this for myself too. Rappy 00:03, March 22, 2011 (UTC)


 * That's a good point, actually. I'll avoid that.
 * Anywho, I've got a basic solution - clicking an image goes to the images.nocookie.net page, instead of the popup. Unfortunately, I need to figure out substrings or find and replace functions to get it to go to the file page. Going to have to read up on that.

 .modalWrapper { display:none; } .blackout { display:none !important; }
 * And here's the JS:

 /* remove popups and force images to go to their file pages function KillImagePopups { $('a.image').click(function{window.location=this.href}); }

addOnloadHook(KillImagePopups);
 * Let me know if it has any problems. Also Rappy, the token thing seems to only work with periods. Unless I'm doing it wrong.


 * Tagging FAQ. -- Fandyllic (talk &middot; contr) 21 Mar 2011 6:33 PM Pacific

(reset indent) this.href unfortunately does the same thing as Ctrl-Clicking the image which isn't what most people are looking for. That still sends you to the images.wikia.com image page and not the local image page. (I just read Monchoman's comment) This can be circumvented by looping the 'a' with 'img' tags. My JS is somewhat poor so if there's a better way to do this, by all means, post below.

(Removed. See code below.) Rappy 16:45, March 22, 2011 (UTC)


 * Touching base back on this. It seems Monchoman's initial CSS was incorrect and it's .modalWrapper, not .modal-wrapper and the .blackout needs !important because it's over-written to display:block by Wikia's javascript. (I've fixed both above) With these two lines of code, clicking an image does indeed do nothing. Adding the JS above fixes the links to the File: namespace where the image is. The two, however, don't take you to the correct page (in fact, it does nothing when clicking the link) because Wikia's modal.js hijacks the click function. (at least for now) I am looking into it to find out how to circumvent that. Rappy 04:14, March 23, 2011 (UTC)


 * Success. This JS does the trick. I didn't add the .onclick to my previous one (no wonder it didn't work)

 function imagelinks { var a = document.getElementsByTagName("a"); for ( var t = 0; t < a.length; ++t ) { var a2 = a[t]; var img = a2.getElementsByTagName("img"); if ( img[0] != null ) { if ( a2.href.indexOf("images.wikia.com") != -1 ) { var link = wgServer + '/wiki/File:' + a2.href.substring(a2.href.lastIndexOf('/') + 1); a2.setAttribute('href',link); a2.onclick = (function (link_a) { return function{window.location=link_a; return false};})(link); }       }    } }

addOnloadHook(imagelinks);
 * Don't forget the CSS above for hiding the .modalWrapper. Any issues, please post them here. Rappy 05:47, March 23, 2011 (UTC)