+ Reply to thread
Results 1 to 5 of 5

Thread: Need some html help for our NSFW tag.

  1. #1
    Elen síla lumenn' omentielvo What Exit?'s avatar
    Registered
    Feb 2009
    Location
    Central NJ (near Bree)
    Posts
    10,071

    Default Need some html help for our NSFW tag.

    The NSFW tag works like the spoiler and Image tags together. So NSFW images are hidden until manually revealed.

    Here is the problem, the Image itself still downloads automatically to the computer by default and could cause issues for some people (at work mainly) as the image goes into the Temporary Internet Files folder.

    What we need is some sort of code that does not download until the reveal is clicked.

    This is code for the NSFW tag:

    <div class="spoiler"><div class="spoiler-top"><span style="color: #FF0000; ">{L_PRIME_BBCODE_SPOILER_SHOW} NSFW Image spoiler:</span> <span class="spoiler-title"></span></div><div class="spoiler-box" onclick="spoilerToggle(this);"><div class="spoiler-hidden">[img]{URL}[/img]</div></div></div>

    Here is how the tag works:
    [nsfw:3fsl9f5f]http://listicles.thelmagazine.com/wp-content/upload/cheesellama.jpg[/nsfw:3fsl9f5f]
    [ NSFW ]http://listicles.thelmagazine.com/wp-content/upload/cheesellama.jpg[ /NSFW ]

  2. #2
    Member
    Registered
    Mar 2009
    Location
    Nashville
    Posts
    99

    Default Re: Need some html help for our NSFW tag.

    My javascript is really rusty, but I'd think you'd have to have something that would load the image from an onClick event. I don't think there's a way to do it with plain HTML.
    Just a guy made of dots and lines.

  3. #3
    Administrator CatInASuit's avatar
    Registered
    Feb 2009
    Location
    Coulsdon Cat Basket
    Posts
    10,342

    Default Re: Need some html help for our NSFW tag.

    The other major problem is that it still downloads the image for those people who have images turned off.
    In the land of the blind, the one-arm man is king.

  4. #4
    Elephant
    Registered
    Mar 2009
    Location
    sNUgGLYPUPpY
    Posts
    734

    Default Re: Need some html help for our NSFW tag.

    You're already using an onclick handler, so that's no big deal. I'd probably do something like this:

    <div class="spoiler"><div class="spoiler-top"><span style="color: #FF0000; ">{L_PRIME_BBCODE_SPOILER_SHOW} NSFW Image spoiler:</span> <span class="spoiler-title"></span></div><div class="spoiler-box" onclick="[red:1gcye3vt]nsfwToggle(this);[/red:1gcye3vt]"><div class="spoiler-hidden">[img]/forum/styles/subsilver2/theme/images/icon_mini_faq.gif[/img]</div></div></div>

    The parts I changed are in red. So the <img> src is actually set to a dummy image (you don't have to use that one -- I just grabbed the "?" image from the FAQ link, but you could make a special placeholder image), and the URL to the image is passed to the function that handles the onclick event. All you need then is to make the nsfwToggle function which should do the same thing as spoilerToggle() except that it also takes an optional second argument which is the image URL. It will need to look for the HTML element with class "nsfwimage" and set its "src" property to this arg that's passed in.

  5. #5
    Administrator CatInASuit's avatar
    Registered
    Feb 2009
    Location
    Coulsdon Cat Basket
    Posts
    10,342

    Default Re: Need some html help for our NSFW tag.

    I've disabled it pending further testing.
    In the land of the blind, the one-arm man is king.

+ Reply to thread

Posting rules

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