Author Topic: Switching to Slimbox/Mootools  (Read 17696 times)

0 Members and 1 Guest are viewing this topic.

Offline TStone

Switching to Slimbox/Mootools
« on: 07. May 2007, 05:11:49 »
Since I'm using Mootools elsewhere on my site, which is not compatible with the "Prototype/scriptaculous"-library used in SOBI Gallery, I've changed the code to make use of "Slimbox" instead (a Lightbox clone for Mootools).
A positive side effect is that I no longer have any problem with Flash items (mp3 player etc) floating on top of the Lightbox.

This is how I did it, if anyone are curious.

Go to: http://www.digitalia.be/software/slimbox and download the slimbox.
Uncompress it and place it on your server, let's say at:
www.yoursite.com/myscripts/slimbox

If you are not already using Mootools, then go to: http://mootools.net/download
This library is modular, and you can choose just the parts needed for the Slimbox to function. If you believe that you will not experiment with it further, then click the following checkboxes (otherwise, click them all):

Native:
    Array, String, Function, Element
Window:
    Window.Base, Window.Size
Effects:
    Fx.Style, Fx.Styles, Fx.Transitions
...then click the download button.

Place the downloaded file where you can find it on your server. Like next to the slimbox folder at:
www.yoursite.com/myscripts/mootools.js

Now for the changes in the code:

Find the file "gallery.class.php" which should be located at:
www.yoursite.com/components/com_sobi2/plugins/gallery/gallery.class.php

Open it and find the following piece of code (somewhere around line 83-90):


$config
->loadScript("prototype");
    
	
$mainframe->addCustomHeadTag("<script type='text/javascript' src='{$mosConfig_live_site}/components/com_sobi2/plugins/gallery/lightbox.js'></script>");
    
	
$mainframe->addCustomHeadTag("<script type='text/javascript' src='{$mosConfig_live_site}/components/com_sobi2/plugins/gallery/scriptaculous.js?load=effects'></script>");
	
	
$style "<style type=\"text/css\"> \n\t" .
	
	
	
	
"#prevLink:hover, #prevLink:visited:hover { background: url({$mosConfig_live_site}/components/com_sobi2/plugins/gallery/images/prev.gif) left 15% no-repeat; } \n\t\t" .
	
	
	
	
"#nextLink:hover, #nextLink:visited:hover { background: url({$mosConfig_live_site}/components/com_sobi2/plugins/gallery/images/next.gif) right 15% no-repeat; } \n\t\t" .
	
	
	
	
"</style>\n";
    
	
$mainframe->addCustomHeadTag($style);



Comment it out by placing a slash and a star ( /* ) before this code snippet, and a star and slash after it ( */ ).
Like this:


/*
(the codesnippet shown above)
*/


Then add the following instead:


$mainframe
->addCustomHeadTag("<script type='text/javascript' src='{$mosConfig_live_site}/myscripts/mootools.js'></script>");
	


$mainframe->addCustomHeadTag("<script type='text/javascript' src='{$mosConfig_live_site}/myscripts/slimbox/js/slimbox.js'></script>");
	


$mainframe->addCustomHeadTag("<link rel='stylesheet' href='{$mosConfig_live_site}/myscripts/slimbox/css/slimbox.css' type='text/css' media='screen' />");



(If you are already using Mootools in your site template, you can probably skip the first line above. If you named the folders differently, adjust the paths shown )

Save, and upload the modified file. Done!
« Last Edit: 07. May 2007, 05:40:15 by TStone »
Country: Sweden Sweden |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile Tom Stone - trolleri

Offline gchancy

  • SobiPro Silver Club Member
  • Sobi User
  • *
  • Posts: 103
  • Reviews:

    What is it?

Re: Switching to Slimbox/Mootools
« Reply #1 on: 09. September 2007, 07:03:05 »
Hello,

I use a mootools-driven template that breaks the Gallery plugin. Any chance the Gallery will be bundled with multiple options? I've noticed a number of gallery components/modules ship lately with three or four choices to minimize java conflicts.

Thanks,

Glen
Country: United States United States |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline jparker3119

Re: Switching to Slimbox/Mootools
« Reply #2 on: 12. September 2007, 10:59:38 »
Thanks for this post. It really helped!
« Last Edit: 12. September 2007, 11:01:56 by jparker3119 »
Country: Japan Japan |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline webguy

  • Sobi Newbie
  • *
  • Posts: 31
  • joomla 1.5.20 sobi 2.9.3.1
  • Reviews:

    What is it?

Re: Switching to Slimbox/Mootools
« Reply #3 on: 14. September 2007, 11:46:18 »
This looks good but I cannot get it to work.
I've just updated to the new sobi2 release and the new gallery plugin.
I am using a Rockettheme template which comes with mootools and another script called Rokzoom (similar to slimbox etc)

Is it possible for the gallery plugin to work with Rokzoom or do I have to disable it and go with Slimbox also how do you disable it?

Cheers
Country: United Kingdom United Kingdom |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline nick252

Re: Switching to Slimbox/Mootools
« Reply #4 on: 14. September 2007, 12:37:51 »
i have the same problem with finerzie template
Country: Greece Greece |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline webguy

  • Sobi Newbie
  • *
  • Posts: 31
  • joomla 1.5.20 sobi 2.9.3.1
  • Reviews:

    What is it?

Re: Switching to Slimbox/Mootools
« Reply #5 on: 14. September 2007, 18:03:57 »
Well I got the lightbox to work by commenting out the following line (around 82) in yoursite/template/index.php

<script type="text/javascript" src="<?php echo $mosConfig_live_site;?>/templates/<?php echo $mainframe->getTemplate(); ?>/js/mootools.js"></script>

Well it works in IE6 and IE7 but the white framing window doesn't expand in Firefox 2.0.0.6

Any ideas welcome
« Last Edit: 05. November 2007, 16:09:05 by webguy »
Country: United Kingdom United Kingdom |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline nick252

Re: Switching to Slimbox/Mootools
« Reply #6 on: 15. September 2007, 02:34:43 »
i have the same probem , looks fine on ie

but on firefox , opera looks strange
Country: Greece Greece |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline Blix

Re: Switching to Slimbox/Mootools
« Reply #7 on: 20. September 2007, 12:10:40 »
Thanks for that fix...

but i had to change $Mainframe to $config...

$mainframeconfig->addCustomHeadTag("<script type='text/javascript' src='{$mosConfig_live_site}/myscripts/mootools.js'></script>");
$mainframeconfig->addCustomHeadTag("<script type='text/javascript' src='{$mosConfig_live_site}/myscripts/slimbox/js/slimbox.js'></script>");
$mainframeconfig->addCustomHeadTag("<link rel='stylesheet' href='{$mosConfig_live_site}/myscripts/slimbox/css/slimbox.css' type='text/css' media='screen' />");

works fine now
Country: Germany Germany |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline cooperation

Re: Switching to Slimbox/Mootools
« Reply #8 on: 31. October 2007, 18:29:58 »
Hello,

I am using Mootools and the Gallery Plugin. I already did the changes above, but still, the image is shown in a new window. It seems that the lightbox is not beeing loaded.

I am getting the error:
Fehler: window.addEvent is not a function
Quelldatei: .../components/com_sobi2/plugins/gallery/slimbox.js
Zeile: 192

Can anyone give me a hint whats missing?
« Last Edit: 31. October 2007, 18:32:38 by cooperation »
Country: Spain Spain |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline Trinity

  • Sobi Team
  • Development
  • Sobi Hero
  • *
  • Posts: 8943
  • Reviews:

    What is it?

    • Sobi Team Member
Re: Switching to Slimbox/Mootools
« Reply #9 on: 03. November 2007, 17:08:54 »
Hello cooperation,

Quote
I am getting the error:
Fehler: window.addEvent is not a function
Quelldatei: .../components/com_sobi2/plugins/gallery/slimbox.js
Zeile: 192

If this error occurs - or any other javascript error - , the mootools are probably loaded after the slimbox. If the mootools are loaded with your template, edit index.php of your template and set
<?php mosShowHead(); ?>

after the script command for mootools.

Trinity
« Last Edit: 04. November 2007, 11:09:19 by Trinity »
Support SobiPro - Submit a review on JED
If you want ongoing development for SobiPro and new applications being developed we need your review for SobiPro in the Joomla Extensions Directory.
Thank you very much :w00t:
Country: Germany Germany |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile Sigsiu.NET

Tags: