[Commons-l] Javascript magic

Alphax (Wikipedia email) alphasigmax at gmail.com
Sun Nov 19 06:04:28 UTC 2006


Brianna Laugher wrote:
> On 19/11/06, Alphax (Wikipedia email) <alphasigmax at gmail.com> wrote:
>> Brianna Laugher wrote:
>>> Hello,
>>>
>>> I was wondering if anyone could either write user Javascript to do
>>> this, or tell me if it's possible.
>>>
>>> Have it so that every Category: page inserts __NOGALLERY__ for that
>>> user, ie. they see text links instead of images, when they look at
>>> categories.
>>>
>>> It would probably be a lot more useful if there was a way to turn it
>>> off again at specific times for specific categories, eg. if there was
>>> a link somewhere like 'view this category' (what everyone else is
>>> doing by default)
>>>
>>> Any thoughts?
>>>
>> __NOGALLERY__ is server-side. File a bug.
>>
> 
> File a bug?? How is it a MediaWiki bug? I'm pretty sure the reply will
> come back 'just set your browser preference to stop loading images'.
> 

It's an RFE... ideally, you want the images in the gallery to not be
loaded. If you don't care about actually loading the images (you just
want them to disappear):

addOnloadHook( function () {
  if(wgCanonicalNamespace == "Category") // or wgNamespaceNumber == 14
  {
    for(var id in document.getElementsByTagName("div"))
    {
      if(document.getElementsByTagName("div")[id].className == "thumb")
      {
        document.getElementsByTagName("div")[id].style.display = "none";
      }
    }
    // refresh the footer
    document.getElementById("footer").style.display = "none";
    document.getElementById("footer").style.display = "";
  }
}

Tested via a javascript console in Firefox 2.0, using Monobook. Should
work if you put it in monobook.js but I haven't actually tested it.

-- 
Alphax - http://en.wikipedia.org/wiki/User:Alphax
Contributor to Wikipedia, the Free Encyclopedia
"We make the internet not suck" - Jimbo Wales
Public key: http://en.wikipedia.org/wiki/User:Alphax/OpenPGP

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 569 bytes
Desc: OpenPGP digital signature
Url : http://lists.wikimedia.org/pipermail/commons-l/attachments/20061119/2489285d/attachment.pgp 


More information about the Commons-l mailing list