A Monster for Every Season: Summer 2
You can get A Monster for Every Season: Summer 2 now at Gumroad
Results 1 to 11 of 11
  1. - Top - End - #1
    Ogre in the Playground
     
    DruidGuy

    Join Date
    Jun 2005
    Location
    Oz county
    Gender
    Male

    Question Updated spoiler tag removal and image resize?

    Before the update, I'd gotten hold of a lovely little bit of code that I could put into a bookmark which automatically stripped out spoiler tags and resized large images to be small enough to fit the screen. It still works for other sites, but not the newly updated Giantitp.com forums.

    Since I got prompt help from some kindly soul on this forum last time I asked, I'm curious if anyone's rushed to fill that particular niche again.

    Because I hate rampant spoiler tags and getting stretch-bombed by images hiding behind spoiler tags.
    I used to live in a world of terrible beauty, and then the beauty left.
    Dioxazine purple.

  2. - Top - End - #2
    Bugbear in the Playground
     
    Taet's Avatar

    Join Date
    May 2013
    Location
    Sacramento-ish, CA

    Default Re: Updated spoiler tag removal and image resize?

    Please share this code! The Demotivators thread needs it!
    I have found a RL gaming group but I'm willing to meet other GitP people nearby.
    Please send a PM or an email! _______ Tea served in a student cafe in Seattle

  3. - Top - End - #3
    Ogre in the Playground
     
    DruidGuy

    Join Date
    Jun 2005
    Location
    Oz county
    Gender
    Male

    Default Re: Updated spoiler tag removal and image resize?

    Quote Originally Posted by Taet View Post
    Please share this code! The Demotivators thread needs it!
    That's the problem. The code I have doesn't work with the new forum. And yep, the demotivator thread (among other image threads here) are the very reason I wanted the code in the first place. The nifty little thing still does work on other websites that I go to, so it's still got uses. I actually got it from some other user when I asked about it in some thread many moons ago. I haven't even got a clue where the original thread went or I'd just point you directly at it. Let me say this again: it doesn't work for me now, so don't be surprised if it won't work for you. If it does, mazal tov.

    Keeping in mind that this does not work (for me anyway) on the new forums here, and also keeping in mind that when I originally got the code I just copy/pasted it so if anything changed between then and now I'd have no idea:
    Spoiler: The code I got, which was entered into the "location" field under "bookmark"
    Show
    javascript:(function()%20{%20var%20a%20=%20documen t.getElementsByTagName('div');%20for%20(var%20i%20 =%200%20;%20i%20<%20a.length%20;%20i++)%20{%20if%2 0(a[i].className%20==%20'spoiler')%20{%20a[i].style.display%20=%20'block';%20a[i].className%20=%20'';%20}%20else%20if%20(a[i].className%20==%20'pre-spoiler')%20{%20a[i].style.display%20=%20'none';%20}}%20a%20=%20docume nt.getElementsByTagName('img');%20for%20(i%20=%200 %20;%20i%20<%20a.length%20;%20i++)%20{%20a[i].style.maxWidth%20=%20'600px';%20}})();
    I used to live in a world of terrible beauty, and then the beauty left.
    Dioxazine purple.

  4. - Top - End - #4
    Colossus in the Playground
     
    BlackDragon

    Join Date
    Feb 2007
    Location
    Manchester, UK
    Gender
    Male

    Default Re: Updated spoiler tag removal and image resize?

    I think the new forum automatically resizes images to fit, so you don't get stretch-bombed? It certainly did on some images in a spoiler I saw earlier, no idea if it also does it for non-spoilered images.

  5. - Top - End - #5
    Ogre in the Playground
     
    DruidGuy

    Join Date
    Jun 2005
    Location
    Oz county
    Gender
    Male

    Default Re: Updated spoiler tag removal and image resize?

    I'm still left with the issue of spoiler tags on text. As I don't really give a damn if I get spoiled for a TV show/movie/novel/whatever plot (in fact I expect it if it's a thread about a show/film/novel/whatever), it's just easier and faster to at least strip out all the the spoiler tags. 'Cause you know, some people just insist that you simply must have spoiler tags within even threads that clearly state "SPOILERS INSIDE". I've seen it happen. Plus the little script thing lets other spoil to their heart's content but I don't have to deal with the irritation on my end as a reader. Sometimes the spoiler tags are nice, other times they're just the deciding factor between following a thread and having better things to do.

    Clicking the "no more spoilers" bookmark is my default action any time I see a spoiler tag anymore. Well unless there are "spoilers for context" things in the thread. I'm of the mind that if it's not funny without the "proper context" then it's probably not that funny.
    I used to live in a world of terrible beauty, and then the beauty left.
    Dioxazine purple.

  6. - Top - End - #6
    Titan in the Playground
     
    Prime32's Avatar

    Join Date
    Nov 2008
    Location
    Ireland
    Gender
    Male

    Default Re: Updated spoiler tag removal and image resize?

    Let's space that code properly first.
    Code:
    javascript:(function() {
       var a = document.getElementsByTagName('div');
       for (var i  = 0 ; i < a.length ; i++) {
          if(a[i].className == 'spoiler') {
             a[i].style.display = 'block';
             a[i].className = '';
          } else if (a[i].className == 'pre-spoiler') {
             a[i].style.display = 'none';
          }
       }
       a = document.getElementsByTagName('img');
       for (i = 0  ; i < a.length ; i++) {
          a[i].style.maxWidth = '600px';
       }
    })();
    Looking at the source code of the page, GitP's current spoiler blocks don't have the class "spoiler" (instead everything is done through style attributes ) and thus aren't targeted. It's a bit crude (as in, it'll break if the look of the spoilers changes), but maybe something like this?

    Code:
    javascript:(function() {
       var a = document.getElementsByTagName('div');
       for (var i=0; i<a.length; i++) {
          if(a[i].className == 'quotecontent') {
             a[i].style.display = 'block';
             a[i].className = '';
          } else if (a[i].getAttribute('style') == 'text-transform: none; border-bottom: medium none; padding: 3px 5px 3px 0px; display: block;') {
             a[i].style.display = 'none';
          }
       }
       a = document.getElementsByTagName('img');
       for (i=0; i<a.length; i++) {
          a[i].style.maxWidth = '600px';
       }
    })();
    Code:
    javascript:(function()%20{var%20a%20=%20document.getElementsByTagName('div');%20for%20(var%20i=0;%20i<a.length%20;%20i++)%20{%20if(a[i].className%20==%20'quotecontent')%20{%20a[i].style.display%20=%20'block';%20a[i].className%20=%20'';%20}%20else%20if%20(a[i].getAttribue('style')%20==%20'text-transform:%20none;%20border-bottom:%20medium%20none;%20padding:%203px%205px%203px%200px;%20display:%20block;')%20{a[i].style.display%20=%20'none';}}%20a%20=%20document.getElementsByTagName('img');%20for%20(i=0;%20i<a.length;%20i++)%20{%20a[i].style.maxWidth%20=%20'600px';}})();
    Last edited by Prime32; 2014-04-02 at 09:24 PM.

  7. - Top - End - #7
    Ogre in the Playground
     
    DruidGuy

    Join Date
    Jun 2005
    Location
    Oz county
    Gender
    Male

    Default Re: Updated spoiler tag removal and image resize?

    I hope you weren't asking me. (I know you weren't actually asking me.) My sum total knowledge of code is "might as well be magic". Even though I viewed page source, all that I really got out of it was, "yep, that's a whole lot of formatted text, numbers, and symbols."

    That said, none of those worked for me. Well, the first one worked once as far as stripping out spoiler tag, but also deleted anything that was inside the spoiler tag. And then it stopped working completely. The second worked not at all for me. My test subjects were this thread and the demotivator thread in the Roleplaying Games forum.
    I used to live in a world of terrible beauty, and then the beauty left.
    Dioxazine purple.

  8. - Top - End - #8
    Bugbear in the Playground
     
    Excession's Avatar

    Join Date
    Jun 2008
    Location
    New Zealand
    Gender
    Male

    Default Re: Updated spoiler tag removal and image resize?

    If you're using Firefox, you can download the "Stylish" extension and use it to force all spoilers open. The CSS to do that is:
    Code:
    @namespace url(http://www.w3.org/1999/xhtml);
    
    @-moz-document domain("giantitp.com") {
      div.quotecontent > div {
        display: block !important;
      }
    }
    With that turned on, all spoilers will be start off open, and cannot be closed.

  9. - Top - End - #9
    Ogre in the Playground
     
    DruidGuy

    Join Date
    Jun 2005
    Location
    Oz county
    Gender
    Male

    Default Re: Updated spoiler tag removal and image resize?

    Well hey that works pretty nicely. It'll take a little getting used to (as it's automated instead of manual), but it does more or less the same thing as the other spoiler remover bookmark/code.

    Danke!
    I used to live in a world of terrible beauty, and then the beauty left.
    Dioxazine purple.

  10. - Top - End - #10
    Titan in the Playground
    Join Date
    Jun 2005
    Gender
    Male

    Default Re: Updated spoiler tag removal and image resize?

    If you still want the bookmark solution instead of using the plugin, here's a quick update of the code which should work. I removed the image rescaling since the forum handles that now

    Code:
    javascript:(function() {
       var a = document.getElementsByTagName('div'); var b ;
       for (var i  = 0 ; i < a.length ; i++) {
          if(a[i].className == 'quotecontent') {
             b = a[i].getElementsByTagName('div') ;
             for (var j  = 0 ; j < b.length ; j++) {
                 b[j].style.display = 'block';
             }
          }
       }
    })();
    As a single line
    Code:
    javascript:(function() { var a = document.getElementsByTagName('div'); var b ; for (var i  = 0 ; i < a.length ; i++) { if(a[i].className == 'quotecontent') { b = a[i].getElementsByTagName('div') ; for (var j  = 0 ; j < b.length ; j++) { b[j].style.display = 'block'; }}}})();

  11. - Top - End - #11
    Ogre in the Playground
     
    DruidGuy

    Join Date
    Jun 2005
    Location
    Oz county
    Gender
    Male

    Default Re: Updated spoiler tag removal and image resize?

    I just want you all to know you're Awesome. I'm keeping both versions, because I'm sure they'll both be useful to me now and in future.
    I used to live in a world of terrible beauty, and then the beauty left.
    Dioxazine purple.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •