Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Tutorial : Create spoilers in Blogger

views
     
TSIcedNyior
post May 18 2008, 08:44 AM, updated 18y ago

Regular
******
Senior Member
1,768 posts

Joined: Feb 2008


This is for you folks who host your blogs on blogger and have blogspot.com in your blog URL. It requires a little more work and is a bit complicated so listen up.

Part 1 :Editing the Theme

First of all, go to your Dashboard >> Template >> Edit HTML

Then look for this line: ]]></b:skin> and </head> . There are two parts of codes.

First part, insert this code BEFORE ]]></b:skin>
CODE

   .commenthidden {display:none;}
   .commentshown {display:inline;}


Then add this code AFTER ]]></b:skin> and BEFORE </head>
CODE

<script type="text/Javascript">

function togglecomments (postid) {

var whichpost = document.getElementById(postid);

if (whichpost.className=="commentshown") { whichpost.className="commenthidden"; } else { whichpost.className="commentshown"; }

} </script>


Your HTML coding should now look like this. Don't worry about the difference in the symbol " and " because it means the same thing. Example:
user posted image

Save settings. Thats one part done. Phew!

Part 2 : Creating spoilers in blog post

To add spoilers to your blog post, click Create A Post and click Edit Html (its on the top right next to �Compose�). Then add this bit of code:
CODE

<a aiotitle="click to expand" href="javascript:togglecomments('SPOILER_NAME')">Click me to read spoilers</a>

<div class="commenthidden" id="SPOILER_NAME">put your hidden text here</div>


You can change SPOILER_NAME to anything you want but make sure that they are both EXACTLY the same. The <a aiotitle> and <div> dont have to be close to each other, as long as they are in the same post and have the exact same name. It will work.

Good luck and I hope this tutorial helps!

EDIT:I changed the javascript code because there were some errors when you save the HTML. Make sure when you write your post its in EDIT HTML mode and not Compose mode
.

~~~~~~~~~~~~~~~
Adapted from my blog post : Create spoilers in Blogger and Wordpress

Read my other tutorial on LYN> Tutorial : Hide/Encrypt posts in Blogger (+pics)


This post has been edited by IcedNyior: Aug 13 2008, 07:25 AM
TSIcedNyior
post May 18 2008, 10:10 PM

Regular
******
Senior Member
1,768 posts

Joined: Feb 2008


wait ah..i seem to hv problem with the code. It worked 2 mths ago :|

got it. changed the javascript code. MAke sure when you write your post its in EDIT HTML mode and not Visual mode


Added on May 18, 2008, 10:28 pm
QUOTE(orenzai @ May 18 2008, 01:28 PM)
can i have a sample of how it looks like? thank you
*
This is what it looks like when you write a post in EDIT HTML mode
user posted image

This is how it looks like in COMPOSE mode
user posted image

This is how the actual post looks like before you expand it
user posted image

After expanding
user posted image


This post has been edited by IcedNyior: May 18 2008, 10:28 PM
TSIcedNyior
post May 19 2008, 12:43 AM

Regular
******
Senior Member
1,768 posts

Joined: Feb 2008


Im not so sure but I think you can create a new class in your CSS then specify things like the box and the "Spoiler > Click Me" graphic
TSIcedNyior
post May 28 2008, 12:11 AM

Regular
******
Senior Member
1,768 posts

Joined: Feb 2008


I recently edited the code on 18 may to put into your template coz hte previous ones had probs.

Put this before ]]></b:skin>
CODE
.commenthidden {
display:none;
}
.commentshown {
display:inline;
}


And this after ]]></b:skin>
CODE

<script type='text/Javascript'>

function togglecomments (postid) {

var whichpost = document.getElementById(postid);

if (whichpost.className==&quot;commentshown&quot;) { whichpost.className=&quot;commenthidden&quot;; } else { whichpost.className=&quot;commentshown&quot;; }

} </script>


its still functioning on my blog. Here's the example

http://spoilers-in-blogger.blogspot.com/

This post has been edited by IcedNyior: Aug 29 2008, 04:40 AM
TSIcedNyior
post Aug 13 2008, 02:34 AM

Regular
******
Senior Member
1,768 posts

Joined: Feb 2008


i'll test it tomorrow and try to find a solution k?
TSIcedNyior
post Aug 13 2008, 07:20 AM

Regular
******
Senior Member
1,768 posts

Joined: Feb 2008


just tested it out on my test blog. it still works.

link > http://spoilers-in-blogger.blogspot.com/

QUOTE(cracksys @ Aug 13 2008, 05:39 AM)
is it like this ?

http://wackified.blogspot.com/

» Click to show Spoiler - click again to hide... «

*
in your blog, you used this tip in Blogger Help for read more. This code that I gave above is for spoilers

shameless blog plugging I see tongue.gif

This post has been edited by IcedNyior: Aug 29 2008, 04:40 AM
TSIcedNyior
post Aug 13 2008, 05:38 PM

Regular
******
Senior Member
1,768 posts

Joined: Feb 2008


QUOTE(selinix @ Aug 13 2008, 02:10 PM)
Yeah.. is working already .. When, I tried it yesterday and check your test blog it is not working..
*
sorry that was coz I was testing a different template at the time and didnt put the code in

QUOTE(lil`pumpkinz @ Aug 13 2008, 02:27 PM)
Iced, I'm so rclxub.gif rclxub.gif
*
Why? Do it slowly and step by step. If you need more help, do pm me biggrin.gif
TSIcedNyior
post Aug 14 2008, 06:15 AM

Regular
******
Senior Member
1,768 posts

Joined: Feb 2008


QUOTE(lil`pumpkinz @ Aug 13 2008, 11:08 PM)
Thank you so much notworthy.gif Btw, I'm still trying on how to post a password-protected post sweat.gif
Iced, is there any way we can blog some unwanted visitor to our blog?
*
i think the only way to do pw protected posts in blogger (as far as i know) is to encrypt it. I think i wrote a tutorial about it.

I dont think u can block someone from visting ur blog lah

QUOTE(eXPeri3nc3 @ Aug 14 2008, 02:52 AM)
@IcedNyior -- Lol you can use DOM to change the words / image after clicking brows.gif
*
DOM? What's that? Sorry noob blush.gif

QUOTE(cracksys @ Aug 14 2008, 04:52 AM)
ah, seems like i visited your blog when the code is not working .. today, i see real spoiler

» Click to show Spoiler - click again to hide... «

*
lol! no worries. interesting blog nonetheless tongue.gif
TSIcedNyior
post Aug 29 2008, 04:40 AM

Regular
******
Senior Member
1,768 posts

Joined: Feb 2008


new test blog >> http://spoilers-in-blogger.blogspot.com/

 

Change to:
| Lo-Fi Version
0.0187sec    0.55    6 queries    GZIP Disabled
Time is now: 6th December 2025 - 05:55 PM