boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

multi-more javascript hack (addition to my other hack)
Goto page 1, 2  Next
 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
dodo



Joined: 25 Jan 2002
Posts: 35

PostPosted: Tue Jun 10, 2003 9:50 pm    Post subject: multi-more javascript hack (addition to my other hack) Reply with quote

first make sure you read this and then

UPDATED THE CODE ON AUGUST 24, 2003

in the original hack code for b2template.functions.php
find the following
Code:

if (count($content)>1) {
      if ($more) {
         $output .= $content[1];
      } else {
         $output .= " <span id=\"varP$id\"><br /><a href=\"$file#$id\" onclick=\"showMore($id,'$file#$id');return false;\">read more »</a></span><div id=\"varXYZ$id\" style=\"display: none\">$content[1]<br /><a href=\"#$id\" onclick=\"showMore($id,0);return true;\">« hide more</a></div>";
      }
   }


and replace it with
Code:

if(count($content) == 2) {
      if ($more) {
         $output .= $content[1];
      } else {
         if(strstr($content[1], "<!--endmore-->")) {
            $tail = explode("<!--endmore-->", $content[1]);
            $output .= " <span id=\"varP$id\"><br /><a href=\"$file#$id\" onclick=\"showMore($id,'$file#$id');return false;\" target=\"_self\">read more »</a></span><div id=\"varXYZ$id\" style=\"display: none\">$tail[0]<a href=\"#$id\" onclick=\"showMore($id,0);return true;\" target=\"_self\">« hide more</a></div>";
            $output .= $tail[1];
         } else {
            $output .= " <span id=\"varP$id\"><br /><a href=\"$file#$id\" onclick=\"showMore($id,'$file#$id');return false;\" target=\"_self\">read more »</a></span><div id=\"varXYZ$id\" style=\"display: none\">$content[1]<br /><a href=\"#$id\" onclick=\"showMore($id,0);return true;\" target=\"_self\">« hide more</a></div>";
         }
      }
   }
   elseif (count($content)>2) {
      $k = $id;
      for($i = 1; $i <= count($content); $i++) {
         $k = $k + 10000000;
         
         if(strstr($content[$i], "<!--endmore-->")) {
            $tail = explode("<!--endmore-->", $content[$i]);
            $output .= "<span id=\"varP$k\"><br /><a href=\"$file#$k\" onclick=\"showMore($k,'$file#$k');return false;\" target=\"_self\">read more »</a></span><div id=\"varXYZ$k\" style=\"display: none\">$tail[0]<br /><a href=\"#$id\" onclick=\"showMore($k,0);return true;\" target=\"_self\">« hide more</a></div>";
            $output .= $tail[1];
         } else {
            $output .= $content[$i];
         }

      }
   }



to post more than one more items, use <!--more--> to begin a more section and use <!--endmore--> to end a more section.


demo here

tweak it if you want. and also, i found a bug in the javascript. change "block" in there to "inline" in the javascript file.


UPDATED THE CODE ON AUGUST 24, 2003
_________________
http://pure-essence.net

b2 rocks


Last edited by dodo on Mon Aug 25, 2003 4:35 pm; edited 7 times in total
Back to top
View user's profile Send private message Visit poster's website
epolady



Joined: 30 Jul 2002
Posts: 800
Location: Texas

PostPosted: Wed Jun 11, 2003 2:12 am    Post subject: Reply with quote

Looks great! I'll have to try it out tonight.
Back to top
View user's profile Send private message
xytx



Joined: 24 May 2003
Posts: 48

PostPosted: Wed Jun 11, 2003 5:36 am    Post subject: Reply with quote

this is a great hack.. !
Back to top
View user's profile Send private message
GamerZ



Joined: 15 May 2002
Posts: 537
Location: Singapore

PostPosted: Wed Jun 11, 2003 6:24 am    Post subject: Reply with quote

i like this one.

Hmm maybe can make something like <!--more-->Click Here To Read About This<!--endmore-->

Click Here To Read About This will be a link, thus everypost readmore link will be unique
_________________

++ GamerZ.Per.Sg - Complex Simplicity
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
dodo



Joined: 25 Jan 2002
Posts: 35

PostPosted: Wed Jun 11, 2003 7:26 am    Post subject: Reply with quote

the shortcut button is easy to add. just use my hack for the dull entry here
http://pure-essence.net/fun/dull_images/how_to_add_dull_entry_qtag.txt

it's very similar.. just change the values etc.. try figure it out Smile it's fun.
_________________
http://pure-essence.net

b2 rocks
Back to top
View user's profile Send private message Visit poster's website
phona



Joined: 07 Feb 2002
Posts: 35
Location: Australia

PostPosted: Wed Jun 11, 2003 8:58 am    Post subject: Reply with quote

is there a way tomay it work witht eh endmore if there's only one "more" section?


(does that even make sense?)
_________________
Just a sweet lil Aussie chick (yeah, whatever)
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Lelerz



Joined: 09 Apr 2002
Posts: 7
Location: NY

PostPosted: Wed Jun 11, 2003 9:01 am    Post subject: Reply with quote

phona wrote:
is there a way tomay it work witht eh endmore if there's only one "more" section?


(does that even make sense?)


Yeah, I noticed this too... like say, I wanted:

Code:

Hi this is my entry!  Want to see a pic of my cat? 

<!--more-->
Pic here
<!--endmore-->

Isn't she so adorable?  Blah blah blah.


Currently, the hack doesn't do that. It just makes everything behind that sole MORE hidden.
Back to top
View user's profile Send private message Visit poster's website
GamerZ



Joined: 15 May 2002
Posts: 537
Location: Singapore

PostPosted: Wed Jun 11, 2003 7:04 pm    Post subject: Reply with quote

dodo wrote:
the shortcut button is easy to add. just use my hack for the dull entry here
http://pure-essence.net/fun/dull_images/how_to_add_dull_entry_qtag.txt

it's very similar.. just change the values etc.. try figure it out Smile it's fun.
That is not exactly waht i mean.
http://csnation.counter-strike.net/ u see the "read more link" is always diff text. Lik [ see press release text (266 more words) ] [ more screenshots/full 6.09 changelog (644 more words) ] etc =D
_________________

++ GamerZ.Per.Sg - Complex Simplicity
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
dodo



Joined: 25 Jan 2002
Posts: 35

PostPosted: Wed Jun 11, 2003 9:55 pm    Post subject: Reply with quote

there's a bug in the code. make sure you change it

please add ABOVE
Code:
for($i = 1; $i <= count($content); $i++) {


this

Code:
$k = $id;

_________________
http://pure-essence.net

b2 rocks
Back to top
View user's profile Send private message Visit poster's website
dodo



Joined: 25 Jan 2002
Posts: 35

PostPosted: Thu Jun 19, 2003 3:32 pm    Post subject: another bug fix Reply with quote

scratch this, i updated the code in the first post.
_________________
http://pure-essence.net

b2 rocks


Last edited by dodo on Mon Aug 25, 2003 1:24 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
niten



Joined: 03 Jun 2003
Posts: 6

PostPosted: Mon Jun 23, 2003 4:31 pm    Post subject: Reply with quote

If I use multiple more's in one post, clicking on the second/third/whatever more links just open up the first more section.
Back to top
View user's profile Send private message
Tanman



Joined: 28 Nov 2002
Posts: 36

PostPosted: Fri Jul 04, 2003 4:26 am    Post subject: Reply with quote

just a query, when i add the error, it says that there is an undefined function (to that effect) to b2vars.php.

Any ideas about that? TIA.

Wei-Yen
Back to top
View user's profile Send private message
XYboi



Joined: 17 Feb 2003
Posts: 18
Location: Miami, FL.

PostPosted: Thu Aug 21, 2003 5:47 pm    Post subject: Reply with quote

I was wondering if anyone had gottent the second and third <!--more--> codes to work, I seem to be having issues opening any of the one's after the first. I just opens up the first one again. Anyone kno what I'm doing wrong? Thanks.

-http://www.xyboi.org.... u can see it on the latest entry.
_________________
--

* Support the Site. Support the Boi. Visit XYboi.S-S.Org *
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
kristal



Joined: 27 Jun 2002
Posts: 17

PostPosted: Mon Aug 25, 2003 12:20 am    Post subject: Reply with quote

I'm having the same problem with all extra "read more"s opening up the first one again. anyone have a fix?
Back to top
View user's profile Send private message Visit poster's website
dodo



Joined: 25 Jan 2002
Posts: 35

PostPosted: Mon Aug 25, 2003 1:26 am    Post subject: Reply with quote

for those who have problem, try use the new updated code in the very first post.
_________________
http://pure-essence.net

b2 rocks
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group