Page 1 of 2

SideBar Hiding Plugin

Posted: Thu Mar 17, 2005 8:24 am
by Tys
Starting a new thread for this.

First question. As the SideBarItem, SideBarTitle and SideBarContent don't have id tags I need to locate them by the class attribute. To speed up the javascipt I would like to itterate through as few elements as possible. Can I make the following assumption about the tags these are going to be in?

SideBarItem in a div tag
SideBarTitle in an h3 tag
SideBarContent in a div tag

Re: SideBar Hiding Plugin

Posted: Thu Mar 17, 2005 11:42 am
by garvinhicking
Can't you use document.getElementByClassname? Because it could be up to a template author to put stuff into a table or use a h2 instead of h3 item?

But basically you are right, all default-based templates will probably never change those tags.

Regards,
Garvin

Posted: Thu Mar 17, 2005 11:01 pm
by Tys
document.getElementByClassname doesn't exsist, I got a solution that should work fine though on any elements.

Things are looking promising as the trickest part is now done.

A CVS account for the plugin repository would be nice, you can e-mail me at tys@tvg.ca if the offer is still open.

Also working a simple plugin to combine two hidden sidebar items into a single sidebar item (ie a random image from a gallery using a url plugin, above an RSS feed from the gallery as a single sidebar).

Thanks,
Tys

Posted: Sun Mar 20, 2005 10:58 pm
by Tys
Version one done, feed back appreciated.

http://tvg.ca/serendipity_event_sidebarhider.tar.gz

Posted: Mon Mar 21, 2005 11:12 am
by garvinhicking
I'm a bit limited on time right now, but you'll get your CVS account shortly and can contribute this. Only thing I would like to ask you to is to use SPACES instead of TABS for indenting, and to properly indent all of the plugin code.

Regards,
Garvin

Posted: Mon Mar 21, 2005 6:27 pm
by Tys
Will do, just used to using tabs at work, here everyone has different taste on tab width which is configurable in most editors. Plus I find it much easier to move around code. But I understand you want to keep everything consistent.

As for indenting, do you mean the outputted html? Or just the code itself?

Posted: Wed Mar 23, 2005 9:21 am
by Tys
Committed to CVS.

Posted: Thu Mar 24, 2005 1:46 am
by Tys
Here is an image of the extra config settings. I've only tested them with my theme so hopefully it loads up other themes correctly as well. If you run into problems, or something doesn't look right, let me know.
Image

coool thing!!

Posted: Sat Apr 23, 2005 11:53 am
by shorshe
I was pondering about writing something like this myself. great idea! I tried your plugin and it does everythin it should do (except throwing some errors, which apparently don't affect the functionality)

I am dealing with very limited space on my site www.twinblog.de/test since I have to squeeze two blog's on one site and have users who still use 800x600 as their screen resolution (... yes they still life).
With that in mind, hiding the sidebar with your plugin is not possible since everything, that makes the layout the slightest amount wider is unfotunateley not possible.

Did you ever think about hiding the sidebar completeley?
An just pop it up as it is needed?

I was thinking about something like this:
http://www.spiegel.de/wissenschaft/mens ... 64,00.html

If you hover over the button: "RESORT WÄHLEN" right under the "SPIEGEL ONLINE" Logo you can see a menu popping up right above the content... wouldn't this be great?
(since i am very bad coder - if i can call me a coder at all - I'd like to convince you to... but don't feel pressed. Only a suggestion)

greetinx

Posted: Sun Apr 24, 2005 8:37 pm
by Tys
Thanks for the feedback. Can you give anymore details on the errors, they might not affect anything but it would be nice to squash them none the less.

Yes hiding the whole sidebar would be nice addition. Unfortunately I'm leaving the country in a week for 8 months and am really short in time to implement anything like this. Hiding the whole sidebar wouldn't be a difficult change. However displaying the link to pop the sidebar down in such a way that it would be generic and look good across all themes is a bit trickier.

Posted: Mon Apr 25, 2005 11:50 am
by garvinhicking
shorshe, if you need a solution fast:

Anywhere on your site put this:

Code: Select all

<script type="text/javascript">
function toggleBar(id) {
  obj = document.getElementById('id')
  if (obj.style.display == 'none') {
    obj.style.display = 'block';
  } else {
    obj.style.display = 'none';
  }
}
</script>
<a href="#" onclick="javascript:toggleBar('serendipityRightSideBar')">Right</a>
<a href="#" onclick="javascript:toggleBar('serendipityLeftSideBar')">Left</a>
That piece of code should hide your left/right sidebar. You could put it anywhere inside of any Smarty .tpl file of your template (index.tpl, for example).

This is much more easier than only hiding certain elements, so basically this could be solved more cleanly in your template than with a plugin.

Regards,
Garvin

Posted: Tue Apr 26, 2005 7:19 pm
by shorshe
Tys wrote:Thanks for the feedback. Can you give anymore details on the errors, they might not affect anything but it would be nice to squash them none the less.
Ok: i get errors, if no plugins are installed in the left or right sidebar.
se here:
Image
Tys wrote: Yes hiding the whole sidebar would be nice addition. Unfortunately I'm leaving the country in a week for 8 months and am really short in time to implement anything like this. Hiding the whole sidebar wouldn't be a difficult change.
too bad...
but good luck and have a nice stay!
Tys wrote:However displaying the link to pop the sidebar down in such a way that it would be generic and look good across all themes is a bit trickier.
yes, indeed. (thinking of kubrick...)

Posted: Tue Apr 26, 2005 8:25 pm
by shorshe
garvinhicking wrote: That piece of code should hide your left/right sidebar. You could put it anywhere inside of any Smarty .tpl file of your template (index.tpl, for example).
Thanks!
l'll try it NOW :)

-----edit---------

Code: Select all

Fatal error: Smarty error: [in /www/htdocs/twinblog//77/77blog/templates/default/index.tpl line 24]: syntax error: unrecognized tag 'obj' (Smarty_Compiler.class.php, line 580) in /www/htdocs/twinblog/77/77blog/bundled-libs/Smarty/libs/Smarty.class.php on line 1088
:(

i put it in index.tpl...

Posted: Tue Apr 26, 2005 8:33 pm
by garvinhicking
Shorshe, also make sure you're using the latest version of the hider plugin! It seems you are using an older version; the error you're reporting was fixed in a previous version by me.

Regards,
Garvin

Posted: Tue Apr 26, 2005 8:54 pm
by shorshe
garvinhicking wrote:Shorshe, also make sure you're using the latest version of the hider plugin! It seems you are using an older version; the error you're reporting was fixed in a previous version by me.
I use the newest version i can get from here:
http://cvs.sourceforge.net/viewcvs.py/p ... ebarhider/
(I just downloaded the files again to make shure).

still i can see these errors.