How to integrate Supersized jQuery plugin into CMSMS

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Locked
jakovbak
Forum Members
Forum Members
Posts: 225
Joined: Thu Dec 13, 2012 2:54 pm

How to integrate Supersized jQuery plugin into CMSMS

Post by jakovbak »

This tutorial explains how to use Supersized jQuery plugin within CMS Made Simple. Thanks to Velden, a member of this forum and simply great guy, most of the tricky parts were solved with ease! So, let's get started…

BEFORE YOU START: REQUIREMENTS
- CMS Made Simple ver. 1.11.4 Fernandina
- Gallery Module ver. 1.6
- Supersized jQuery plugin ver. 3.2.7
(download link: http://buildinternet.com/project/supers ... nload.html)

STEP 1: PREPARING SOURCES
1. Extract downloaded Supersized jQuery plugin .zip in handy place (like, Desktop…)

STEP 2: PREPARING IMAGES
1. Open images you want to use on your website in Photoshop or similar photo editor and set resolution to 72 dpi and width to 1920 px (you can set width to bigger size if you wish but this value is quite ok for usual monitor sizes)
2. Save as .jpg, quality 10
IMPORTANT!!!: While naming your images use only alphanumeric characters without spaces, dashes etc.!
3. Create custom thumbnails to match width 150px and height 108px and save thumbs as .jpg, quality 10.
IMPORTANT!!!: If you don't want or can't create custom thumbnails, you can use automatic feature in Gallery Module. However, this feature produces less quality thumbs with usually inadequate cropping, and, most important fact: If you don't use "Custom Thumbnails" method you won't be able to use dynamic gallery parameter which means you'll have to create separate Content Template for every gallery/album you want to display on your site!!!
My strongest recommandation is to forget about Gallery Module thumbs! If you insist on automatic thumbs, leave a post and I'll write another tutorial on How to use "Gallery Module" thumbnails...


STEP 3: UPLOADING SOURCES
1. Go to: Admin panel --> Content --> FileManager --> New directory, name your new directory "img" (no quotes)
2. Enter directory img and click tab "Upload files"
3. Navigate to extracted folder containing Supersized jQuery plugin, enter it, find and enter folder "img" and select all images. Click "upload" and wait until it's done.
4. Return to FileManager start pane and click "New directory", name this folder "js" (no quotes)
5. Enter folder "js", click "Upload files" tab
6. Navigate to extracted folder containing Supersized jQuery plugin again, enter it, locate and enter folder "js" and select following files:
- jquery.easing.min.js
- supersized.3.2.7.min.js
7. Return to FileManager start pane and click "New directory", name this folder "theme" (no quotes)
8. On your computer, navigate to extracted folder containing Supersized jQuery plugin, enter it, locate and enter folder "theme" and open "supersized.shutter.js" with appropriate program (like Smultron, TextWrangler, Notepad…)
9. Scroll down and find section "Theme Specific Variables"
8. Enter folder "theme", click "Upload files" tab
9. Navigate to extracted folder containing Supersized jQuery plugin again, enter it, locate and enter folder "theme" and select following file:
- supersized.shutter.js
10. Click "Upload"

STEP 4: CREATE GLOBAL CONTENT BLOCKS
1. Go to: Admin panel --> Content --> Global Content Blocks --> Add Global Content Block
2. Name your first GCBlock "supersizedscripts" (no quotes) and disable "WYSIWYG"
3. Copy following code and paste it into GCBlock content field:

Code: Select all

<__script__ type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></__script>
<__script__ type="text/javascript" src="uploads/js/jquery.easing.min.js"></__script>
<__script__ type="text/javascript" src="uploads/js/supersized.3.2.7.min.js"></__script>
<__script__ type="text/javascript" src="uploads/theme/supersized.shutter.js"></__script>
and click "Submit"
4. Click "Add Global Content Block" again
5. Name your second GCBlock "supersizedtrigger" (no quotes) and disable "WYSIWYG"
6. Copy following code and paste it into GCBlock content field:

Code: Select all

<__script__ type="text/javascript">
			
	jQuery(function($){
				
	$.supersized({
			
	// Functionality
	slideshow:   1,	// Slideshow on/off
	autoplay:	1,	// Slideshow starts playing automatically
	start_slide:   1,	// Start slide (0 is random)
	stop_loop:	0,	// Pauses slideshow on last slide
	random: 	0,	// Randomize slide order (Ignores start slide)
	slide_interval:   4000,	// Length between transitions
	transition:   6,	// 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
	transition_speed:	1000,	// Speed of transition
	new_window:	1,	// Image links open in new window/tab
	pause_hover:   0,	// Pause slideshow on hover
	keyboard_nav:   1,	// Keyboard navigation on/off
	performance:	1,	// 0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
	image_protect:	1,	// Disables image dragging and right click with Javascript
															   
	// Size & Position						   
	min_width:   0,	// Min width allowed (in pixels)
	min_height:   0,	// Min height allowed (in pixels)
	vertical_center:   1,	// Vertically center background
	horizontal_center:   1,	// Horizontally center background
	fit_always:	1,	// Image will never exceed browser width or height (Ignores min. dimensions)
	fit_portrait:   1,	// Portrait images will not exceed browser height
	fit_landscape:   1,	// Landscape images will not exceed browser width
															   
	// Components							
	slide_links:	'blank',	// Individual links for each slide (Options: false, 'num', 'name', 'blank')
	thumb_links:	1,	// Individual thumb links for each slide
	thumbnail_navigation:   0,	// Thumbnail navigation
	slides:  	[
			// Slideshow Images
			{Gallery dir="$gallery_dir" template='supersized'}
			]
					
		 });
	 });
		    
</__script>
and click "Submit"
NOTE: In this GCBlock you can change Supersized slideshow parameters

STEP 5: ADDING CSS
1. Navigate to extracted folder containing Supersized jQuery plugin, enter it, find and enter folder "css"
2. Open file "supersized.css" in appropriate program (TextEdit, Notepad or similar), select all and copy
3. Go to: Admin panel --> Layout --> Stylesheets --> Add new stylesheet
4. Name your new stylesheet "supersized" (no quotes) and paste copied .css into Stylesheet content field.

NOTE: Please DO NOT DELETE original Supersized plugin Release data - the first six lines which had been commented out in original .css! Deleting it just doesn't seem right…

5. Look and find every image-related parameter like this one:
url(../img/progress.gif)
and change path to match following
url('[[root_url]]/uploads/img/progress.gif')
NOTE: Differences are bolded and red!

6. Navigate to extracted folder containing Supersized jQuery plugin, enter it, find and enter folder "theme"
7. Open file "supersized.shutter.css" in appropriate program (TextEdit, Notepad or similar), select all and copy
8. Go to: Admin panel --> Layout --> Stylesheets --> Add new stylesheet
9. Name your new stylesheet "supersized.shutter" (no quotes) and paste copied .css into Stylesheet content field.
10. Repeat action No. 5 from this section.
11. Find following selector (very close to the end of this .css!)
ul#thumb-list li img { width:200px; height:auto; opacity:0.5;…
and change it to:
ul#thumb-list li img { min-width: 150px; min-height: 108px; opacity:0.5;…
NOTE: This is very useful for good thumbnail positioning in case you don't have thumbs at exactly 150x108px. For example, I have cropped vertical images to 150x108px but for horizontal images I have only changed Image Size to match height 108px. So these thumbs were approx. 165x108px. With min- width and height parameter in CSS I have resolved "shrinking" issue (where thumbs were forced to fit width but with thumbs at 165x108px this caused an empty space below such thumbs, comparing to thumbs at 150x108px).

STEP 6: GALLERY MODULE TEMPLATE
1. Go to: Admin panel --> Content --> Gallery --> Templates --> Create a new template
2. Name your new Gallery template "supersized" (no quotes)
3. Leave "Thumbnail Size" and "resize method" as is.
4. Copy the following code:

Code: Select all

{foreach from=$images item=image name=loop}
{if $smarty.foreach.loop.index % 2 == 0} { image : '{$image->file|escape:'url'|replace:'%2F':'/'}', title : '{$gallerytitle}',{else} thumb : '{$image->file|escape:'url'|replace:'%2F':'/'}', url : '#' } {if !$smarty.foreach.loop.last},{/if}{/if}
{/foreach}
and paste it into "Template Source" field
5. Delete everything from "Template CSS-stylesheet" field and from "Template JavaScript" field.

NOTE: Of course, one can use these fields to paste corresponding original sources from downloaded Supersized plugin demo but I thought it won't be very handy. First of all, you won't change original plugin javascripts so they should be left in /uploads/js directory. Next, content stylesheets are much more user-friendly than Gallery template CSS-field. At least to me...

6. Click "Submit"

STEP 7: PAGE TEMPLATE
1. Go to: Admin panel --> Layout --> Templates --> Add new template
2. Name your new template "supersized" (no quotes)
3. Copy the following code

Code: Select all

{global_content name='supersizedscripts'}
{global_content name='supersizedtrigger'}
and paste it between <head> tags
4. Copy following code

Code: Select all

{content block='gallery' assign='gallery_dir' label='test' oneline='1'}
and paste it after opening </__body> tag
5. If you want to design your own environment for Supersized plugin, delete everything between </__body> tags except the previous line of code and {content} tag. Come back later when you reach the end of this tutorial and start designing whatever you want...
6. Click "Submit"

STEP 8: LINKING
1. Click on "CSS" icon of newly created "supersized" template and add following .css styles from the dropdown menu:
- supersized
- supersized.shutter
(confirm each style by hitting "Add a stylesheet" button)

STEP 9: CREATING GALLERY
1. Go to: Admin panel --> Content --> Gallery --> Options tab
2. Set "Resize big images to maximum sizes" to width: 1920 px and height: 3000 px
NOTE: "Height: 3000 px" allows vertical images to be displayed in full browser width but this option must be allowed in GCBlock "supersizedtrigger" (look for parameters "fit_always" and "fit_portrait" and set "1" or "0" to allow or disallow this option)
3. Go to: Admin panel --> Content --> Gallery --> Add subgallery
4. Name this gallery as you wish but for this tutorial let's name it "Supersized1" (no quotes) and click "Save" button
5. Click "Add images"
6. Navigate to folder on your computer where all the images and custom thumbnails are saved
7. Select all images and corresponding thumbnails you wish to place in this gallery and click "Upload"
8. Once the images are uploaded sort them in following order:
- image1
- image1 thumbnail
- image2
- image2 thumbnail
- image3
- image3 thumbnail
… and so on.
IMPORTANT!!!: This step is crucial so JS would know how to connect images with corresponding thumbnails!
9. Click "Save" button

STEP 10: ADD CONTENT PAGE
1. Go to: Admin panel --> Content --> Pages --> Add new content
2. Name your new content page as you wish but for this tutorial let's name it "Supersized1" (no quotes)
3. Set "Parent" to none
4. Fill extra field labeled as "test" with the name of directory where images and thumbnails were stored. In case of this tutorial the path to this directory would be "uploads/images/Gallery/Supersized1". Based upon that your Extra field should be filled with:
/Supersized1
5. Disable "WYSIWYG"
6. Copy the following code

Code: Select all

{content block='gallery' assign='gallery_dir' label='test' oneline='1'}
	<!--Thumbnail Navigation-->
	<div id="prevthumb"></div>
	<div id="nextthumb"></div>
	
	<!--Arrow Navigation-->
	<a id="prevslide" class="load-item"></a>
	<a id="nextslide" class="load-item"></a>
	
	<div id="thumb-tray" class="load-item">
		<div id="thumb-back"></div>
		<div id="thumb-forward"></div>
	</div>
	
	<!--Time Bar-->
	<div id="progress-back" class="load-item">
		<div id="progress-bar"></div>
	</div>
	
	<!--Control Bar-->
	<div id="controls-wrapper" class="load-item">
		<div id="controls">
			
			<a id="play-button"><img id="pauseplay" src="uploads/img/pause.png"/></a>
		
			<!--Slide counter-->
			<div id="slidecounter">
				<span class="slidenumber"></span> / <span class="totalslides"></span>
			</div>
			
			<!--Slide captions displayed here-->
			<div id="slidecaption"></div>
			
			<!--Thumb Tray button-->
			<a id="tray-button"><img id="tray-arrow" src="uploads/img/button-tray-up.png"/></a>
			
			<!--Navigation-->
			<ul id="slide-list"></ul>
			
		</div>
	</div>
and paste it into "Content" field
7. Click "Options" tab and choose template "supersized" from the dropdown menu
8. Click "Submit" button

And that's it! Check your Content page "Supersized1" by clicking on magnifier icon...

Whoever wants to use this tutorial, do it exactly as it was written and let me know the result - does it work as it suppose to or not (in case I've made some mistake while writing this, I'd like to know so I could detect the error and make it right). I have tested this on two different sites but, you never know...
Enjoy and best regards!
Jakov

P.S. Example: http://www.majamakeup.com/index.php?page=beauty
www.studioides.com/idstest
Last edited by jakovbak on Mon Apr 15, 2013 7:48 am, edited 2 times in total.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: How to integrate Supersized jQuery plugin into CMSMS

Post by velden »

Hi Jakov,

Nice tutorial.

You might consider pasting all code from Step 10.6 in the supersized template.

Typically that's not something you want to leave to an end user (pasting that kind of code in content block).

note: in your case

Code: Select all

{content block='gallery' assign='gallery_dir' label='test' oneline='1'}
is 'called' twice; once by template (step 7.4), once by content (step 10.6).

In case you make a template of that code: because every template needs to have a default 'content' you could change that line to:

Code: Select all

{content assign='gallery_dir' label='test' oneline='1'}
Step 3.1 make sure you 'are' in the uploads directory. I think (not sure), depending on settings of File Manager, you could start in webroot.

Step 4: if creating a supersized page template, might consider to put that part in head section of template in stead of GCB's

Personally I prefer

Code: Select all

<__script__ type="text/javascript" src="{uploads_url}/js/jquery.easing.min.js"></__script>
in stead of 'uploads/...'

Step 5.5: just a tip/note [[root_url]]/uploads --> [[uploads_url]]

Most important: a link to your working site ;D so we all cab see the beautiful models result you've made :D
jakovbak
Forum Members
Forum Members
Posts: 225
Joined: Thu Dec 13, 2012 2:54 pm

Re: How to integrate Supersized jQuery plugin into CMSMS

Post by jakovbak »

Hello velden!
Comments noticed! This is my first tutorial and I've expected to be some "warnings" or "you better do..."-comments. I'll edit the tutorial based on your comments as soon as I find a few moments of peace - I don't want to mess something up so I need to be fully concentrated on this!
For now, a working link to models example will do... ;D
(it's in first post, at the and...)
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12709
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: How to integrate Supersized jQuery plugin into CMSMS

Post by Dr.CSS »

Seems to be a lot of trouble just to get a script to work, I just use it in Album, look at the Album link in my signature for full screen scripts...

P.S. the link you give, I only get to see one image all the others are so big they slide by before they get a chance to fully load...
jakovbak
Forum Members
Forum Members
Posts: 225
Joined: Thu Dec 13, 2012 2:54 pm

Re: How to integrate Supersized jQuery plugin into CMSMS

Post by jakovbak »

Hello Dr. CSS!
As I mentioned before, this is my first tutorial and obviously, I could have done a better job, could have write a less complicated material, just like Velden said. I had no time to rewrite it so far but it doesn't mean I won't one of these days...
You can check another working example at

http://www.studioides.com/idstest

The first one was jus a raw material, an attempt to get the script working properly. This new one is far more "user friendly" but I would love to hear your opinion on this...
One more thing, if I could write a clear and "no-questions-asked" tutorial, it really doesn't matter if it was a lot of trouble to get the script to work, right? I mean, one just have to follow steps provided and it will work like a charm!
Thank you for your comments and suggestions and hope to hear from you soon!
Best regards,
Jakov
Locked

Return to “Tips and Tricks”