Skip to content
Browse files

first commit

  • Loading branch information...
0 parents commit a9b6b6ba4dc9484c972292f47d7a42b0336724da @jackwanders committed Mar 22, 2012
152 CHANGELOG.txt
@@ -0,0 +1,152 @@
+GalleryView - jQuery Content Gallery Plugin
+Author: Jack Anderson
+
+Version 3.0 DEV - 2012-03-21
+----------------------------------------
+
+
+Version 3.0 beta 3 - 2011-03-15
+----------------------------------------
+Anchor tags in source markup now transfer to both the filmstrip and the panel
+Fixed bug preventing filmstrip from stretching full width of gallery when 'show_filmstrip_nav' option was set to false
+Enabled ability to show all frames and filmstrip navigation together
+Added new option to control display of panel overlays
+Classes applied to the source <li> tags will be copied to both the appropriate filmstrip frame and panel
+Classes applied to the source <ul> tag will be copied to the resulting gallery <div>
+
+New options:
+ - show_overlays
+ - BOOLEAN: flag to indicate whether to show or hide panel overlays
+
+Version 3.0 beta 2 - 2011-03-14
+----------------------------------------
+Class names altered to be less generic, avoid interference from other CSS
+Removed fixed caption size, added CSS support for multi-line captions
+Added 'filter:inherit' CSS rule to panels to combat IE8 which prevents fade animations from working
+Changed navigation images to <div> tags with images as backgrounds. Navigation images can now be defined in CSS
+
+Removed options:
+ - nav_theme
+ - no longer necessary as navigation images are defined in CSS
+ - theme_format
+ - no longer necessary as navigation images are defined in CSS
+
+
+Version 3.0 beta 1 - 2011-03-10
+----------------------------------------
+Setting transition interval to 0 prevents automated transitions instead of causing instant transitions
+Capped transition speed at value of transition interval to prevent overlapping animations
+Changed default panel_scale value from 'nocrop' to 'crop'
+Capped pointer size to 1/2 of frame width to prevent pointer from extending past frame edge
+Fixed bug that caused misplaced panels when not displaying filmstrip
+Fixed bug when calling plugin after window load
+Added ability to slide panels as an alternative to fading
+Various bug fixes regarding incorrect element placement after customizing CSS
+Improved gallery loading behavior (users no longer see gallery animating to initial panel/frame)
+Updated navigation themes to PNG format and included PNG support for custom navigation themes
+Made both panel and filmstrip navigation optional, regardless of panel and filmstrip visibility
+Panel navigation overlay images are now set to be opaque due to an IE7 PNG transparency bug. You can create your own transparent overlay images if you wish
+
+New options:
+ - filmstrip_style
+ - STRING: Sets behavior of filmstrip (scroll,show all)
+ - 'show all' forces 'show_navigation' to false and 'pointer_size' to zero (if there are
+ multiple rows of frames)
+ - show_panel_nav
+ - BOOLEAN: flag to indicate whether to display panel-based navigation buttons
+ - show_filmstrip_nav
+ - BOOLEAN: flag to indicate whether to display filmstrip-based navigation buttons
+ - animate_pointer
+ - BOOLEAN: flag to indicate whether filmstrip pointer animates between frames or jumps instantly
+ - panel_animation
+ - STRING: type of transition panels should undergo (fade,crossfade,slide,zoom,none)
+ - theme_format
+ - STRING: extension type of images in the theme indicated by the 'nav_theme' option
+
+Removed options:
+ - fade_panels
+ - no longer necessary as setting panel_animation to 'none' serves the same purpose
+
+
+Version 2.1.1 - 2010-03-15
+----------------------------------------
+Small bug fix dealing with frame opacity
+
+
+Version 2.1 - 20010-03-14
+----------------------------------------
+Made minor updates to ensure compatibility with jQuery 1.4.x
+Heavily commented javascript code
+Included README.txt with instructions on using plugin
+Updated jQuery Timers plugin to version 1.3
+
+
+Version 2.0 - 2009-05-05
+----------------------------------------
+Revised required HTML markup for GalleryView
+Filmstrip frames are generated automatically (no need for two sets of images)
+Moved majority of aesthetic styling to external CSS
+Default aesthetics for gallery updated
+Set GalleryView to wait until images finish loading before building itself
+Added 'current' class to current filmstrip frame for user customization
+Allowed for more user-defined styling in panels and filmstrip frames
+Filmstrip can now be placed on left and right side of gallery, in addition to top and bottom
+Panel images can now be scaled to fit within panel or zoomed & cropped to fill panel
+Filmstrip images can now be scaled to fit within frame or zoomed & cropped to fill frame
+Panel overlay backgrounds are now only added to those panels with overlays
+'pause_on_hover' option now pauses when mouse hovers over filmstrip as well as panel
+Added option to start gallery on any frame
+Current frame pointer is now built with CSS and its size can be customized easily
+Increased size of hitbox on panel-navigation buttons
+
+Updated options:
+ - filmstrip_position
+ - new allowable values : 'top', 'right', 'bottom', 'left'
+
+Removed options:
+ - overlay_height
+ - overlay_font_size
+ - overlay_color
+ - background_color
+ - overlay_text_color
+ - caption_text_color
+ - border
+
+New options:
+ - show_panels (boolean)
+ - show_filmstrip (boolean)
+ - start_frame (integer)
+ - pointer_size (integer)
+ - panel_scale
+ - allowable values : 'crop', 'nocrop'
+ - frame_scale
+ - allowable values : 'crop', 'nocrop'
+ - frame_gap (integer)
+
+
+Version 1.1 - 2009-04-05
+----------------------------------------
+Added feature allowing filmstrip w/o panels
+Added feature allowing panels w/o filmstrip
+Added feature allowing filmstrip placement above or below panels
+Added new graphics for panel navigation
+Anchored navigation buttons to edges of filmstrip, rather than gallery boundaries
+New options:
+ - filmstrip_position
+ - allowable values : 'top', 'bottom'
+ - overlay_position
+ - allowable values : 'top', 'bottom'
+
+
+Version 1.0.1 - 2009-03-30
+----------------------------------------
+Fixed bug allowing blank frames to display in filmstrip
+Changed pointer graphic from GIF to PNG to allow for greater customization
+Added 'overflow: hidden' to panels to prevent oversized content from breaking gallery
+Disabled frame clicking during filmstrip animation
+Changed pointer border from 4px to 2px
+
+
+Version 1.0 - 2009-03-29
+----------------------------------------
+Initial Release
19 LICENSE.txt
@@ -0,0 +1,19 @@
+Copyright (c) 2009 John Anderson III
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
80 README.txt
@@ -0,0 +1,80 @@
+GalleryView - jQuery Photo Gallery Plugin
+Author: Jack Anderson
+
+INSTRUCTIONS FOR USE
+---------------------------------
+1) Place galleryview-x.x folder somewhere in your website directory structure (you can rename this folder if desired)
+2) Include script tags for the desired version of the script (uncompressed, packed) and for the included jQuery Timers plugin file
+3) Include a reference to the jquery.galleryview-x.x.css stylesheet in your document
+4) Create an unordered list in your HTML with the content you wish to be displayed in your gallery (see below for more information on markup options
+5) Edit the id of the first rule in jquery.galleryview-3.0.css to match the id given to your unordered list
+6) Call the GalleryView plugin with the function call below:
+
+ $('#id_of_list').galleryView()
+
+ To override default option values, include them in object literal format in the call to the plugin, like so:
+
+ $('#id_of_list').galleryView({
+ panel_width: 800,
+ panel_height: 600,
+ frame_width: 120,
+ frame_height: 90
+ });
+
+ Refer to the documentation URL listed above (or the uncompressed javascript) to see a full list of options, their effects on the plugin and their default values.
+
+
+
+HTML MARKUP REQUIREMENTS
+---------------------------------
+Below, I will show you the markup required to produce various types of galleries. After the first example,
+I will exclude the UL wrapper and only show the HTML necessary for a single panel and/or frame.
+
+1) Basic slideshow (no added features)
+ <ul id="gallery">
+ <li><img src="../gv/path/to/image1.jpg" alt="image1" /></li>
+ <li><img src="../gv/path/to/image2.jpg" alt="image2" /></li>
+ <li><img src="../gv/path/to/image3.jpg" alt="image3" /></li>
+ <li><img src="../gv/path/to/image4.jpg" alt="image4" /></li>
+ </ul>
+
+ This is the simplest gallery one can have. By default, the filmstrip will appear below the panels. The number of frames visible will be
+ determined by the size of the panels. If there is enough space in the gallery to fit all the filmstrip frames, the filmstrip will be centered
+ within the gallery. If there are too many frames, the additional frames will be hidden from view initially, appearing as the filmstrip slides
+ to the left with each transition. Panel and frame dimensions are set via plugin options, as is the location of the filmstrip. It can be set
+ to appear below, above, or to either side of the panels.
+
+3) Slideshow with panel overlays
+
+ <li>
+ <img src="../gv/path/to/image.jpg" alt="image" title="Pretty Picture" data-description="Some more information about the photo" />
+ </li>
+
+ For this gallery, the contents of the title and longdesc attributes will display on top of the panel image, its position determined by the
+ 'overlay_position' option. The color of the overlays are set in the included CSS file.
+
+CREATING/USING CUSTOM NAVIGATION THEMES
+---------------------------------
+GalleryView comes with four themes by default:
+ - dark
+ - light
+ - dark2
+ - light2
+
+The dark themes contain dark navigation buttons and are best used in galleries with light backgrounds. The light themes contain light
+colored images and are best for galleries with dark backgrounds. The dark2 and light2 themes contain oversized buttons to demonstrate
+GalleryView's ability to use any kind of navigation images you may want to use
+
+To create your own navigation theme, first create the following images:
+ - next.png
+ - prev.png
+ - play.png
+ - pause.png
+ - panel-nav-next.png
+ - panel-nav-prev.png
+
+The images can be of any file type. Then, update the galleryView CSS file with the paths to your new navigation images.
+
+
+That should hopefully be enough to get you started on the right track. Feel free to experiment and find me on twitter (@jackwanders)
+if you have any questions or comments. Enjoy!
BIN css/img-loader.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
189 css/jquery.galleryview-3.0-dev.css
@@ -0,0 +1,189 @@
+/*
+
+ GalleryView Stylesheet
+
+ Use the CSS rules below to modify the look of your gallery.
+
+ To create additional rules, use the markup below as a guide to GalleryView's architecture.
+*/
+
+/* GALLERY LIST */
+/* IMPORTANT - Change '#myGallery' to the ID of your gallery list to prevent a flash of unstyled content */
+#myGallery { display: none; }
+
+.gv_galleryWrap { position: relative; background: #222; font-size: 10pt; }
+
+/* GALLERY DIV */
+.gv_gallery { overflow: hidden; position: relative;}
+
+.gv_imageStore { visibility: hidden; position: absolute; top: -10000px; left: -10000px; }
+
+
+/*************************************************/
+/** PANEL STYLES **/
+/*************************************************/
+
+.gv_panelWrap { filter: inherit; position: absolute; overflow: hidden; }
+
+.gv_panel-loading { background: url(img-loader.gif) 50% 50% no-repeat #aaa; }
+.gv_frame-loading { background: url(img-loader.gif) 50% 50% no-repeat #aaa; }
+
+/* GALLERY PANELS */
+.gv_panel { filter: inherit; position: absolute; top: 0; left: 0; overflow: hidden; z-index: 100; }
+.gv_panel img { position: absolute; }
+
+.gv_overlay { position: absolute; background: #222; color: white; z-index: 200; }
+.gv_showOverlay {
+ position: absolute;
+ width: 20px;
+ height: 20px;
+ background: url(themes/light/info.png) #222;
+ cursor: pointer;
+ z-index: 200;
+}
+.gv_overlay h4 { color: white; margin: 1em; font-weight: bold; }
+.gv_overlay p { color: white; margin: 1em; }
+
+.gv_infobar {
+ background: #222;
+ padding: 0 0.5em;
+ line-height: 1.5em;
+ height: 1.5em;
+ font-size: 10pt;
+ font-weight: bold;
+ color: white;
+
+ position: absolute;
+ bottom: 0;
+ right: 0;
+ display: none;
+ vertical-align: middle;
+ z-index: 2000;
+
+}
+
+
+/*************************************************/
+/** FILMSTRIP STYLES **/
+/*************************************************/
+
+.gv_filmstripWrap { overflow: hidden; position: absolute; }
+
+
+/* FILMSTRIP */
+.gv_filmstrip { margin: 0; padding: 0; position: absolute; top: 0; left: 0; }
+
+/* FILMSTRIP FRAMES (contains both images and captions) */
+.gv_frame {
+ cursor: pointer;
+ float: left;
+ position: relative;
+ margin: 0;
+ padding: 0;
+}
+
+/* WRAPPER FOR FILMSTRIP IMAGES */
+.gv_frame .gv_thumbnail { position: relative;overflow: hidden !important; }
+
+/* WRAPPER FOR CURRENT FILMSTRIP IMAGE */
+.gv_frame.current .gv_thumbnail {}
+
+/* FRAME IMAGES */
+.gv_frame img { border: none; position: absolute; }
+
+/* FRAME CAPTION */
+.gv_frame .gv_caption { height: 14px; line-height: 14px; font-size: 10px; text-align: center; color:white; }
+
+/* CURRENT FRAME CAPTION */
+.gv_frame.current .gv_caption { }
+
+/* POINTER FOR CURRENT FRAME */
+.gv_pointer {
+ border-color: black;
+}
+
+/* NAVIGATION BUTTONS */
+.gv_navWrap {
+ text-align: center;
+ position: absolute;
+}
+.gv_navPlay,
+.gv_navPause,
+.gv_navNext,
+.gv_navPrev {
+
+ opacity: 0.3;
+ -moz-opacity: 0.3;
+ -khtml-opacity: 0.3;
+ filter:alpha(opacity=30);
+ display:-moz-inline-stack;
+ display:inline-block;
+ zoom:1;
+ *display:inline;
+ vertical-align: middle;
+}
+.gv_navPlay:hover,
+.gv_navPause:hover,
+.gv_navNext:hover,
+.gv_navPrev:hover {
+ opacity: 0.8;
+ -moz-opacity: 0.8;
+ -khtml-opacity: 0.8;
+ filter:alpha(opacity=80);
+}
+
+.gv_panelNavPrev,
+.gv_panelNavNext {
+ position: absolute;
+ display: none;
+ opacity: 0.50;
+ -moz-opacity: 0.50;
+ -khtml-opacity: 0.50;
+ filter:alpha(opacity=50);
+ z-index: 200;
+}
+
+.gv_panelNavPrev:hover,
+.gv_panelNavNext:hover {
+ opacity: 0.9;
+ -moz-opacity: 0.9;
+ -khtml-opacity: 0.9;
+ filter:alpha(opacity=90);
+}
+
+.gv_navPlay {
+ height: 30px;
+ width: 30px;
+ cursor: pointer;
+ background: url(themes/light/play-big.png) top left no-repeat;
+}
+.gv_navPause {
+ height: 30px;
+ width: 30px;
+ cursor: pointer;
+ background: url(themes/light/pause-big.png) top left no-repeat;
+}
+.gv_navNext {
+ height: 20px;
+ width: 20px;
+ cursor: pointer;
+ background: url(themes/light/next.png) top left no-repeat;
+}
+.gv_navPrev {
+ height: 20px;
+ width: 20px;
+ cursor: pointer;
+ background: url(themes/light/prev.png) top right no-repeat;
+}
+.gv_panelNavNext {
+ height: 20px;
+ width: 20px;
+ cursor: pointer;
+ background: url(themes/light/panel-next.png) top left no-repeat;
+}
+.gv_panelNavPrev {
+ height: 20px;
+ width: 20px;
+ cursor: pointer;
+ background: url(themes/light/panel-prev.png) top right no-repeat;
+}
BIN css/themes/dark/next.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/dark/panel-next-big.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/dark/panel-next.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/dark/panel-prev-big.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/dark/panel-prev.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/dark/pause-big.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/dark/pause.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/dark/play-big.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/dark/play.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/dark/prev.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/light/info.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/light/next.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/light/panel-next-big.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/light/panel-next.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/light/panel-prev-big.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/light/panel-prev.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/light/pause-big.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/light/pause.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/light/play-big.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/light/play.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN css/themes/light/prev.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
205 js/jquery.easing.1.3.js
@@ -0,0 +1,205 @@
+/*
+ * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
+ *
+ * Uses the built in easing capabilities added In jQuery 1.1
+ * to offer multiple easing options
+ *
+ * TERMS OF USE - jQuery Easing
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright © 2008 George McGinley Smith
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * Neither the name of the author nor the names of contributors may be used to endorse
+ * or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+// t: current time, b: begInnIng value, c: change In value, d: duration
+jQuery.easing['jswing'] = jQuery.easing['swing'];
+
+jQuery.extend( jQuery.easing,
+{
+ def: 'easeOutQuad',
+ swing: function (x, t, b, c, d) {
+ //alert(jQuery.easing.default);
+ return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
+ },
+ easeInQuad: function (x, t, b, c, d) {
+ return c*(t/=d)*t + b;
+ },
+ easeOutQuad: function (x, t, b, c, d) {
+ return -c *(t/=d)*(t-2) + b;
+ },
+ easeInOutQuad: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t + b;
+ return -c/2 * ((--t)*(t-2) - 1) + b;
+ },
+ easeInCubic: function (x, t, b, c, d) {
+ return c*(t/=d)*t*t + b;
+ },
+ easeOutCubic: function (x, t, b, c, d) {
+ return c*((t=t/d-1)*t*t + 1) + b;
+ },
+ easeInOutCubic: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t + b;
+ return c/2*((t-=2)*t*t + 2) + b;
+ },
+ easeInQuart: function (x, t, b, c, d) {
+ return c*(t/=d)*t*t*t + b;
+ },
+ easeOutQuart: function (x, t, b, c, d) {
+ return -c * ((t=t/d-1)*t*t*t - 1) + b;
+ },
+ easeInOutQuart: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
+ return -c/2 * ((t-=2)*t*t*t - 2) + b;
+ },
+ easeInQuint: function (x, t, b, c, d) {
+ return c*(t/=d)*t*t*t*t + b;
+ },
+ easeOutQuint: function (x, t, b, c, d) {
+ return c*((t=t/d-1)*t*t*t*t + 1) + b;
+ },
+ easeInOutQuint: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
+ return c/2*((t-=2)*t*t*t*t + 2) + b;
+ },
+ easeInSine: function (x, t, b, c, d) {
+ return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
+ },
+ easeOutSine: function (x, t, b, c, d) {
+ return c * Math.sin(t/d * (Math.PI/2)) + b;
+ },
+ easeInOutSine: function (x, t, b, c, d) {
+ return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
+ },
+ easeInExpo: function (x, t, b, c, d) {
+ return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
+ },
+ easeOutExpo: function (x, t, b, c, d) {
+ return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
+ },
+ easeInOutExpo: function (x, t, b, c, d) {
+ if (t==0) return b;
+ if (t==d) return b+c;
+ if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
+ return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
+ },
+ easeInCirc: function (x, t, b, c, d) {
+ return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
+ },
+ easeOutCirc: function (x, t, b, c, d) {
+ return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
+ },
+ easeInOutCirc: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
+ return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
+ },
+ easeInElastic: function (x, t, b, c, d) {
+ var s=1.70158;var p=0;var a=c;
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+ },
+ easeOutElastic: function (x, t, b, c, d) {
+ var s=1.70158;var p=0;var a=c;
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
+ },
+ easeInOutElastic: function (x, t, b, c, d) {
+ var s=1.70158;var p=0;var a=c;
+ if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+ return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
+ },
+ easeInBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ return c*(t/=d)*t*((s+1)*t - s) + b;
+ },
+ easeOutBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
+ },
+ easeInOutBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
+ return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
+ },
+ easeInBounce: function (x, t, b, c, d) {
+ return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
+ },
+ easeOutBounce: function (x, t, b, c, d) {
+ if ((t/=d) < (1/2.75)) {
+ return c*(7.5625*t*t) + b;
+ } else if (t < (2/2.75)) {
+ return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
+ } else if (t < (2.5/2.75)) {
+ return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
+ } else {
+ return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
+ }
+ },
+ easeInOutBounce: function (x, t, b, c, d) {
+ if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
+ return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
+ }
+});
+
+/*
+ *
+ * TERMS OF USE - EASING EQUATIONS
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright © 2001 Robert Penner
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * Neither the name of the author nor the names of contributors may be used to endorse
+ * or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
1,049 js/jquery.galleryview-3.0-dev.js
@@ -0,0 +1,1049 @@
+/*
+
+ GalleryView - jQuery Content Gallery Plugin
+ Author: Jack Anderson
+ Version: 3.0 DEVELOPMENT
+
+ See README.txt for instructions on how to markup your HTML
+*/
+
+// Make sure Object.create is available in the browser (for our prototypal inheritance)
+// Courtesy of Douglas Crockford
+if (typeof Object.create !== 'function') {
+ Object.create = function (o) {
+ function F() {}
+ F.prototype = o;
+ return new F();
+ };
+}
+
+(function ($) {
+ // custom image object
+ var gvImage = function (img) {
+
+ this.src = {
+ panel: img.attr('src'),
+ frame: img.data('frame') || img.attr('src')
+ };
+ this.scale = {
+ panel: null,
+ frame: null
+ };
+ this.height = 0;
+ this.width = 0;
+ this.attrs = {
+ title: img.attr('title') || img.attr('alt'),
+ description: img.data('description')
+ };
+ this.href = null;
+ this.dom_obj = null;
+
+ return this;
+ },
+
+ // utility function wrapper
+ gv = {
+ getInt: function(i) {
+ i = parseInt(i, 10);
+ return isNaN(i) ? 0 : i;
+ },
+ innerWidth: function(elem) {
+ return this.getInt(elem.css('width')) || 0;
+ },
+ outerWidth: function(elem) {
+ return this.innerWidth(elem) +
+ this.extraWidth(elem);
+ },
+ extraWidth: function(elem) {
+ return this.getInt(elem.css('paddingLeft')) +
+ this.getInt(elem.css('paddingRight')) +
+ this.getInt(elem.css('borderLeftWidth')) +
+ this.getInt(elem.css('borderRightWidth'));
+ },
+ innerHeight: function(elem) {
+ return this.getInt(elem.css('height'))|| 0;
+ },
+ outerHeight: function(elem) {
+ return this.innerHeight(elem) +
+ this.extraHeight(elem);
+ },
+ extraHeight: function(elem) {
+ return this.getInt(elem.css('paddingTop')) +
+ this.getInt(elem.css('paddingBottom')) +
+ this.getInt(elem.css('borderTopWidth')) +
+ this.getInt(elem.css('borderBottomWidth'));
+ }
+ },
+
+ /*
+ GalleryView - Object
+ The main gallery class
+ */
+ GalleryView = {
+ // array of dom elements
+ elems: [
+ '.gv_galleryWrap', '.gv_gallery', '.gv_panelWrap', '.gv_panel',
+ 'img.gv_image', '.gv_infobar', '.gv_filmstripWrap', '.gv_filmstrip',
+ '.gv_frame', '.gv_thumbnail', '.gv_caption', 'img.gv_thumb',
+ '.gv_navWrap', '.gv_navNext', '.gv_navPrev', '.gv_navPlay',
+ '.gv_panelNavNext', '.gv_panelNavPrev', '.gv_overlay', '.gv_showOverlay',
+ '.gv_imageStore'
+ ],
+
+ // create a jQuery element and apply attributes
+ createElem: function(attrs,elem) {
+ elem = document.createElement(elem);
+ var $elem = $(elem);
+ return $elem.attr(attrs);
+ },
+
+ // get the position of an element with respect
+ // to the gallery wrapper
+ getPos: function (el) {
+ var self = this,
+ dom = this.dom,
+ el = el[0],
+ el_id = el.id,
+ left = 0,
+ top = 0,
+ gPos, gLeft, gTop;
+
+ if (!el) { return { top: 0, left: 0 }; }
+
+ if (el.offsetParent) {
+ do {
+ left += el.offsetLeft;
+ top += el.offsetTop;
+ } while (el = el.offsetParent);
+ }
+
+ //If we want the position of the gallery itself, return it
+ if (el_id === self.id) { return { left: left, top: top }; }
+
+ //Otherwise, get position of element relative to gallery
+ else {
+ gPos = self.getPos(dom.galleryWrap);
+ gLeft = gPos.left;
+ gTop = gPos.top;
+ return { left: left - gLeft, top: top - gTop };
+ }
+ },
+
+ // determine if mouse is within the boundary of the gallery wrapper
+ mouseIsOverGallery: function (x, y) {
+ var self = this,
+ dom = this.dom,
+ pos = this.getPos(dom.gv_galleryWrap),
+ top = pos.top,
+ left = pos.left;
+
+ return x > left && x < left + gv.outerWidth(dom.gv_galleryWrap) && y > top && y < top + gv.outerHeight(dom.gv_galleryWrap);
+ },
+
+ // determine if mouse is within the boundary of the panel
+ mouseIsOverPanel: function (x, y) {
+ var self = this,
+ dom = this.dom,
+ pos = this.getPos(dom.gv_panelWrap),
+ gPos = this.getPos(dom.gv_galleryWrap),
+ top = pos.top + gPos.top,
+ left = pos.left + gPos.left;
+
+ return x > left && x < left + gv.outerWidth(dom.gv_panelWrap) && y > top && y < top + gv.outerHeight(dom.gv_panelWrap);
+ },
+
+ // create gvImage objects for each image in gallery
+ storeImages: function() {
+ var self = this;
+ this.sourceImgs = $('li>img',this.$el);
+ this.numImages = this.sourceImgs.length;
+ this.gvImages = [];
+ this.sourceImgs.each(function(i,img) {
+ self.gvImages[i] = new gvImage($(img));
+ });
+ },
+
+ setDimensions: function() {
+ var self = this,
+ dom = this.dom,
+ widths = {
+ prev: gv.innerWidth(dom.gv_navPrev),
+ play: gv.innerWidth(dom.gv_navPlay),
+ next: gv.innerWidth(dom.gv_navNext),
+ filmstrip: this.opts.frame_width,
+ fsMax: 0,
+ fsFull: 0
+ },
+ heights = {
+ prev: gv.innerHeight(dom.gv_navPrev),
+ play: gv.innerHeight(dom.gv_navPlay),
+ next: gv.innerHeight(dom.gv_navNext),
+ filmstrip: this.opts.frame_height + (this.opts.show_captions ? gv.outerHeight(dom.gv_caption) : 0),
+ fsMax: 0,
+ fsFull: 0
+ },
+ panels = [];
+
+ // nav
+ if(this.filmstripOrientation === 'vertical' && (this.opts.frame_width + gv.extraWidth(dom.gv_frame)) < (widths.prev + widths.play + widths.next)) {
+ console.log('stacking');
+ dom.gv_navWrap.css({
+ width: Math.max(widths.prev, widths.play, widths.next),
+ height: heights.prev + heights.play + heights.next
+ });
+ } else {
+ dom.gv_navWrap.css({
+ width: widths.prev + widths.play + widths.next,
+ height: Math.max(heights.prev,heights.play,heights.next)
+ });
+ }
+
+ // panels
+ dom.gv_panel.css({
+ width: this.opts.panel_width,
+ height: this.opts.panel_height
+ });
+ dom.gv_panelWrap.css({
+ width: gv.outerWidth(dom.gv_panel),
+ height: gv.outerHeight(dom.gv_panel)
+ });
+ dom.gv_overlay.css({
+ width: this.opts.panel_width
+ });
+
+
+
+ $.each(this.gvImages,function(i,img) {
+ dom.gv_panelWrap.append(dom.gv_panel.clone(true));
+ });
+
+ dom.gv_panels = dom.gv_panelWrap.find('.gv_panel');
+ dom.gv_panels.remove();
+
+ // filmstrip
+ dom.gv_thumbnail.css({
+ width: this.opts.frame_width,
+ height: this.opts.frame_height
+ });
+ dom.gv_frame.css({
+ width: gv.outerWidth(dom.gv_thumbnail),
+ height: gv.outerHeight(dom.gv_thumbnail) + (this.opts.show_captions ? gv.outerHeight(dom.gv_caption) : 0),
+ marginRight: this.opts.frame_gap,
+ marginBottom: this.opts.frame_gap
+ });
+
+
+ if(this.filmstripOrientation === 'horizontal') {
+ this.filmstripSize = Math.floor((gv.outerWidth(dom.gv_panelWrap) - gv.outerWidth(dom.gv_navWrap)) / (gv.outerWidth(dom.gv_frame) + this.opts.frame_gap));
+ widths.fsMax = this.filmstripSize * (gv.outerWidth(dom.gv_frame) + this.opts.frame_gap);
+ widths.fsFull = this.gvImages.length * (gv.outerWidth(dom.gv_frame) + this.opts.frame_gap);
+ widths.filmstrip = Math.min(widths.fsMax,widths.fsFull);
+ } else {
+ this.filmstripSize = Math.floor((gv.outerHeight(dom.gv_panelWrap) - gv.outerHeight(dom.gv_navWrap)) / (gv.outerHeight(dom.gv_frame) + this.opts.frame_gap));
+ heights.fsMax = this.filmstripSize * (gv.outerHeight(dom.gv_frame) + this.opts.frame_gap);
+ heights.fsFull = this.gvImages.length * (gv.outerHeight(dom.gv_frame) + this.opts.frame_gap);
+ heights.filmstrip = Math.min(heights.fsMax,heights.fsFull);
+ }
+ dom.gv_filmstripWrap.css({
+ width: widths.filmstrip,
+ height: heights.filmstrip
+ });
+
+ // gallery
+ if(this.opts.show_filmstrip) {
+ if(this.filmstripOrientation === 'horizontal') {
+ dom.gv_gallery.css({
+ width: gv.outerWidth(dom.gv_panelWrap),
+ height: gv.outerHeight(dom.gv_panelWrap) + this.opts.frame_gap + (this.opts.show_filmstrip ? Math.max(gv.outerHeight(dom.gv_filmstripWrap),gv.outerHeight(dom.gv_navWrap)) : gv.outerHeight(dom.gv_filmstripWrap))
+ });
+ } else {
+ dom.gv_gallery.css({
+ width: gv.outerWidth(dom.gv_panelWrap) + this.opts.frame_gap + (this.opts.show_filmstrip ? Math.max(gv.outerWidth(dom.gv_filmstripWrap),gv.outerWidth(dom.gv_navWrap)) : gv.outerWidth(dom.gv_filmstripWrap)),
+ height: gv.outerHeight(dom.gv_panelWrap)
+ });
+ }
+ } else {
+ dom.gv_gallery.css({
+ width: gv.outerWidth(dom.gv_panelWrap),
+ height: gv.outerHeight(dom.gv_panelWrap)
+ });
+ }
+
+ dom.gv_galleryWrap.css({
+ width: gv.outerWidth(dom.gv_gallery),
+ height: gv.outerHeight(dom.gv_gallery),
+ padding: this.opts.frame_gap
+ });
+ },
+
+ setPositions: function() {
+ var self = this,
+ dom = this.dom,
+ navVert = 0, fsVert = 0,
+ navHorz = 0, fsHorz = 0,
+ vert, horz;
+
+ // determine vertical or horizontal offset
+ // if negative, apply to filmstrip, otherwise apply to navbar
+ if(this.filmstripOrientation === 'horizontal') {
+ vert = Math.round((gv.outerHeight(dom.gv_filmstripWrap) - gv.outerHeight(dom.gv_navWrap)) / 2);
+ if(vert < 0) { fsVert = -1 * vert; }
+ else { navVert = vert; }
+ } else {
+ horz = Math.round((gv.outerWidth(dom.gv_filmstripWrap) - gv.outerWidth(dom.gv_navWrap)) / 2);
+ if(horz < 0) { fsHorz = -1 * horz; }
+ else { navHorz = horz; }
+ }
+
+ // for horizontal filmstrips w/o navigation, center the filmstrip under the panel
+ if(!this.opts.show_filmstrip_nav && this.filmstripOrientation === 'horizontal') {
+ fsHorz = Math.floor((gv.outerWidth(dom.gv_panelWrap) - gv.outerWidth(dom.gv_filmstripWrap)) / 2);
+ }
+
+ dom.gv_panelNavNext.css({ top: (gv.outerHeight(dom.gv_panel) - gv.outerHeight(dom.gv_panelNavNext)) / 2, right: 10 });
+ dom.gv_panelNavPrev.css({ top: (gv.outerHeight(dom.gv_panel) - gv.outerHeight(dom.gv_panelNavPrev)) / 2, left: 10 });
+
+ // pin elements to gallery corners according to filmstrip position
+ switch(this.opts.filmstrip_position) {
+ case 'top':
+ dom.gv_navWrap.css({ top: navVert, right: navHorz });
+ dom.gv_panelWrap.css({ bottom: 0, left: 0 });
+ dom.gv_filmstripWrap.css({ top: fsVert, left: fsHorz });
+ break;
+
+ case 'right':
+ dom.gv_navWrap.css({ bottom: navVert, right: navHorz });
+ dom.gv_panelWrap.css({ top: 0, left: 0 });
+ dom.gv_filmstripWrap.css({ top: fsVert, right: fsHorz });
+ break;
+
+ case 'left':
+ dom.gv_navWrap.css({ bottom: navVert, left: navHorz });
+ dom.gv_panelWrap.css({ top: 0, right: 0 });
+ dom.gv_filmstripWrap.css({ top: fsVert, left: fsHorz });
+ break;
+
+ default:
+ dom.gv_navWrap.css({ bottom: navVert, right: navHorz });
+ dom.gv_panelWrap.css({ top: 0, left: 0 });
+ dom.gv_filmstripWrap.css({ bottom: fsVert, left: fsHorz });
+ break;
+ }
+
+ if(this.opts.overlay_position === 'top') {
+ dom.gv_overlay.css({ top: 0, left: -99999 });
+ dom.gv_showOverlay.css({ top: 0, left: 0 });
+ } else {
+ dom.gv_overlay.css({ bottom: 0, left: -99999 });
+ dom.gv_showOverlay.css({ bottom: 0, left: 0 });
+ }
+
+ if(!this.opts.show_filmstrip_nav) {
+ dom.gv_navWrap.remove();
+ }
+ },
+
+ buildFilmstrip: function() {
+ var self = this,
+ dom = this.dom,
+ framesLength = this.gvImages.length * ((this.filmstripOrientation === 'horizontal' ? this.opts.frame_width : this.opts.frame_height) + this.opts.frame_gap);
+
+ dom.gv_frame.append(dom.gv_thumbnail);
+ if(this.opts.show_captions) {
+ dom.gv_frame.append(dom.gv_caption);
+ }
+ dom.gv_thumbnail.css('opacity',this.opts.frame_opacity);
+
+ dom.gv_thumbnail.bind({
+ mouseover: function() {
+ if(!$(this).hasClass('current')) {
+ $(this).stop().animate({opacity:1},250);
+ }
+ },
+ mouseout: function() {
+ if(!$(this).hasClass('current')) {
+ $(this).stop().animate({opacity:self.opts.frame_opacity},250);
+ }
+ }
+ });
+
+ // Drop a clone of the frame element into the filmstrip for each source image
+ $.each(this.gvImages,function(i,img) {
+ dom.gv_frame.clone(true).prependTo(dom.gv_filmstrip);
+ });
+
+ dom.gv_filmstrip.css({
+ width: gv.outerWidth(dom.gv_frame),
+ height: gv.outerHeight(dom.gv_frame)
+ });
+
+ // If we are scrolling the filmstrip, and we can't show all frames at once,
+ // make two additional copies of each frame
+ if(this.filmstripOrientation === 'horizontal') {
+ if(this.opts.filmstrip_style === 'scroll' && framesLength > gv.innerWidth(dom.gv_filmstripWrap)) {
+ dom.gv_filmstrip.find('.gv_frame').clone(true).appendTo(dom.gv_filmstrip).clone(true).appendTo(dom.gv_filmstrip);
+ dom.gv_filmstrip.css('width',framesLength * 3);
+ this.scrolling = true;
+ } else {
+ dom.gv_filmstrip.css('width',framesLength);
+ }
+ } else {
+ if(this.opts.filmstrip_style === 'scroll' && framesLength > gv.innerHeight(dom.gv_filmstripWrap)) {
+ dom.gv_filmstrip.find('.gv_frame').clone(true).appendTo(dom.gv_filmstrip).clone(true).appendTo(dom.gv_filmstrip);
+ dom.gv_filmstrip.css('height',framesLength * 3);
+ this.scrolling = true;
+ } else {
+ dom.gv_filmstrip.css('height',framesLength);
+ }
+ }
+
+ dom.gv_frames = dom.gv_filmstrip.find('.gv_frame');
+ $.each(dom.gv_frames,function(i,frame) {
+ $(frame).data('frameIndex',i);
+ });
+ dom.gv_thumbnails = dom.gv_filmstrip.find('div.gv_thumbnail');
+ },
+
+ buildGallery: function() {
+ var self = this,
+ dom = this.dom;
+
+ this.setDimensions();
+ this.setPositions();
+
+ if(this.opts.show_filmstrip) {
+ this.buildFilmstrip();
+ }
+ },
+
+ showInfoBar: function() {
+ if(!this.opts.show_infobar) { return; }
+ var self = this,
+ dom = this.dom;
+
+ dom.gv_infobar.stop().stopTime('hideInfoBar_' + self.id).html((this.iterator+1) + ' of ' + this.numImages).show().css('opacity',this.opts.infobar_opacity);
+
+ dom.gv_infobar.oneTime(2000 + this.opts.transition_speed,'hideInfoBar_' + self.id,function() {
+ dom.gv_infobar.fadeOut(1000);
+ });
+ },
+
+ initImages: function() {
+ var self = this,
+ dom = this.dom;
+
+ $.each(this.gvImages,function(i,gvImage) {
+ var img = $('<img/>');
+ img.css('visibility','hidden').data('index',i);
+ img.bind('load.galleryview',function() {
+ var _img = $(this),
+ index = _img.data('index'),
+ width = this.width,
+ height = this.height,
+ parent = dom[(_img.data('parent')).type].eq((_img.data('parent')).index),
+ widthFactor = gv.innerWidth(parent) / width,
+ heightFactor = gv.innerHeight(parent) / height,
+ parentType = parent.hasClass('gv_panel') ? 'panel' : 'frame',
+ heightOffset = 0, widthOffset = 0;
+
+ gvImage.scale[parentType] = self.opts[parentType+'_scale'] === 'fit' ? Math.min(widthFactor,heightFactor) : Math.max(widthFactor,heightFactor);
+
+ widthOffset = Math.round((gv.innerWidth(parent) - (width * gvImage.scale[parentType])) / 2);
+ heightOffset = Math.round((gv.innerHeight(parent) - (height * gvImage.scale[parentType])) / 2);
+
+ _img.css({
+ width: width * gvImage.scale[parentType],
+ height: height * gvImage.scale[parentType],
+ top: heightOffset,
+ left: widthOffset
+ });
+ _img.hide().css('visibility','visible');
+ _img.remove().appendTo(parent);
+
+ if(parentType === 'frame') {
+ _img.fadeIn();
+ parent.parent().removeClass('gv_frame-loading');
+ parent.parent().find('.gv_caption').html(gvImage.attrs.title);
+ } else if(index === self.opts.start_frame - 1) {
+ parent.prependTo(dom.gv_panelWrap);
+ parent.removeClass('gv_panel-loading');
+ _img.fadeIn();
+ self.showInfoBar();
+ } else {
+ parent.removeClass('gv_panel-loading');
+ _img.show();
+ }
+ });
+
+ // store eventual image container as data property
+ // append to temporary storage element and set src
+ if(self.opts.show_panels) {
+ img.clone(true)
+ .data('parent',{type:'gv_panels',index:i})
+ .appendTo(dom.gv_imageStore)
+ .attr('src',gvImage.src.panel);
+ }
+
+ if(self.opts.show_filmstrip) {
+ img.clone(true)
+ .data('parent',{type:'gv_thumbnails',index:i})
+ .appendTo(dom.gv_imageStore)
+ .attr('src',gvImage.src.frame);
+
+ if(dom.gv_frames.length > dom.gv_panels.length) {
+ img.clone(true)
+ .data('parent',{type:'gv_thumbnails',index:i+self.numImages})
+ .appendTo(dom.gv_imageStore)
+ .attr('src',gvImage.src.frame);
+
+ img.clone(true)
+ .data('parent',{type:'gv_thumbnails',index:i+self.numImages+self.numImages})
+ .appendTo(dom.gv_imageStore)
+ .attr('src',gvImage.src.frame);
+ }
+ }
+ });
+ },
+
+ showNext: function() {
+ this.navAction = 'next';
+ this.showItem(this.frameIterator+1);
+ },
+
+ showPrev: function() {
+ this.navAction = 'prev';
+ this.showItem(this.frameIterator-1);
+ },
+
+ showItem: function(i) {
+ if(isNaN(i)) { return; }
+ if(!this.opts.show_filmstrip) { i = i % this.numImages; }
+
+ var self = this,
+ dom = this.dom,
+ frame_i = i,
+ newPanelStart,
+ oldPanelEnd,
+ oldIterator,
+ panel,
+ playing = false;
+
+ // don't go out of bounds
+ if(i >= this.numImages) {
+ i = i % this.numImages;
+ } else if(i < 0) {
+ i = this.numImages - 1;
+ if(dom.gv_frames != undefined) {
+ frame_i = dom.gv_frames.length - 1;
+ } else {
+ frame_i = dom.gv_panels.length - 1;
+ }
+ }
+
+ panel = dom.gv_panels.eq(i);
+
+ playing = this.playing;
+
+ if(playing) {
+ this.stopSlideshow(false);
+ }
+
+ this.unbindActions();
+
+ dom.gv_gallery.oneTime(this.opts.transition_speed,'bindActions_' + self.id,function(){ if(playing) { self.startSlideshow(false); } self.bindActions(); });
+
+ switch(this.opts.panel_animation) {
+ case 'crossfade':
+ dom.gv_panels.eq(this.iterator).fadeOut(this.opts.transition_speed,function(){$(this).remove();});
+ panel.hide().prependTo(dom.gv_panelWrap).fadeIn(this.opts.transition_speed);
+ break;
+ case 'fade':
+ dom.gv_panels.eq(this.iterator).remove();
+ panel.hide().prependTo(dom.gv_panelWrap).fadeIn(this.opts.transition_speed);
+ break;
+ case 'slide':
+ console.log(frame_i,i,this.iterator);
+ if(this.navAction === 'next' || (this.navAction === 'frame' && frame_i > this.iterator)) {
+ newPanelStart = gv.outerWidth(dom.gv_panel);
+ oldPanelEnd = -1 * gv.outerWidth(dom.gv_panel);
+ } else {
+ newPanelStart = -1 * gv.outerWidth(dom.gv_panel);
+ oldPanelEnd = gv.outerWidth(dom.gv_panel);
+ }
+
+ panel.css({ left:newPanelStart }).appendTo(dom.gv_panelWrap).animate(
+ { left:0 },
+ { duration: this.opts.transition_speed,easing: this.opts.easing }
+ );
+
+ dom.gv_panels.eq(this.iterator).animate(
+ { left: oldPanelEnd },
+ { duration: this.opts.transition_speed, easing: this.opts.easing, complete: function(){ $(this).remove(); } }
+ );
+ break;
+ default:
+ dom.gv_panels.eq(this.iterator).remove();
+ panel.prependTo(dom.gv_panelWrap);
+ break;
+ }
+
+ this.updateOverlay(i);
+
+ this.iterator = i;
+ this.updateFilmstrip(frame_i);
+ this.showInfoBar();
+
+
+ },
+
+ updateOverlay: function(i) {
+ var self = this,
+ dom = this.dom;
+
+ if(this.overlayVisible) {
+ this.hideOverlay(function(){
+ dom.gv_overlay.html('<h4>'+self.gvImages[i].attrs.title+'</h4><p>'+self.gvImages[i].attrs.description+'</p>');
+ self.showOverlay();
+ });
+ } else {
+ dom.gv_overlay.html('<h4>'+self.gvImages[i].attrs.title+'</h4><p>'+self.gvImages[i].attrs.description+'</p>');
+ dom.gv_overlay.css(this.opts.overlay_position,-1 * dom.gv_overlay.outerHeight());
+ }
+
+ },
+
+ hideOverlay: function(callback) {
+ var self = this,
+ dom = this.dom,
+ endOverlay = {},
+ endButton = {};
+
+ callback = callback || function(){};
+
+ endOverlay[this.opts.overlay_position] = -1 * dom.gv_overlay.outerHeight();
+ endButton[this.opts.overlay_position] = 0;
+
+ dom.gv_overlay.animate(endOverlay,{
+ duration: self.opts.transition_speed / 2,
+ easing: 'swing',
+ complete: callback
+ });
+ dom.gv_showOverlay.animate(endButton,{
+ duration: self.opts.transition_speed / 2,
+ easing: 'swing'
+ });
+
+ this.overlayVisible = false;
+ },
+
+ showOverlay: function() {
+ var self = this,
+ dom = this.dom,
+ startOverlay = {},
+ endOverlay = {},
+ endButton = {};
+
+ startOverlay[this.opts.overlay_position] = -1 * dom.gv_overlay.outerHeight();
+ startOverlay.left = 0;
+
+ endOverlay[this.opts.overlay_position] = 0;
+
+ endButton[this.opts.overlay_position] = dom.gv_overlay.outerHeight();
+
+ dom.gv_overlay.css(startOverlay);
+ dom.gv_overlay.animate(endOverlay,{ duration: self.opts.transition_speed / 2, easing: 'swing' });
+ dom.gv_showOverlay.animate(endButton,{ duration: self.opts.transition_speed / 2, easing: 'swing' });
+
+ this.overlayVisible = true;
+ },
+
+ updateFilmstrip: function(to) {
+ if(!this.opts.show_filmstrip) { this.frameIterator = to; return; }
+ var self = this,
+ dom = this.dom,
+ targetThumbs = dom.gv_thumbnails.eq(this.iterator),
+ filmstripIterator,
+ distance;
+
+ if(this.scrolling) {
+ targetThumbs = targetThumbs.
+ add(dom.gv_thumbnails.eq(this.iterator + this.numImages)).
+ add(dom.gv_thumbnails.eq(this.iterator + (2 * this.numImages)));
+ }
+
+ dom.gv_thumbnails.removeClass('current').animate({ opacity: this.opts.frame_opacity });
+ targetThumbs.stop().addClass('current').animate({ opacity: 1 },500);
+
+
+ if(this.scrolling) {
+ if(this.filmstripOrientation === 'horizontal') {
+ distance = (gv.outerWidth(dom.gv_frame) + this.opts.frame_gap) * (this.frameIterator - to);
+
+ if(distance > 0) {
+ distance = '+=' + Math.abs(distance);
+ } else {
+ distance = '-=' + Math.abs(distance);
+ }
+ dom.gv_filmstrip.animate({
+ left: distance
+ },{
+ duration: this.opts.transition_speed,
+ easing: this.opts.easing,
+ complete: function(){
+ if(to < self.numImages) {
+ dom.gv_filmstrip.css('left',gv.getInt(dom.gv_filmstrip.css('left'))-(self.numImages*(gv.outerWidth(dom.gv_frame)+self.opts.frame_gap)));
+ } else if(to >= (self.numImages * 2)) {
+ dom.gv_filmstrip.css('left',gv.getInt(dom.gv_filmstrip.css('left'))+(self.numImages*(gv.outerWidth(dom.gv_frame)+self.opts.frame_gap)));
+ }
+ self.frameIterator = (to % self.numImages) + self.numImages;
+ }
+ });
+ } else {
+ distance = (gv.outerHeight(dom.gv_frame) + this.opts.frame_gap) * (this.frameIterator - to);
+
+ if(distance > 0) {
+ distance = '+=' + Math.abs(distance);
+ } else {
+ distance = '-=' + Math.abs(distance);
+ }
+ dom.gv_filmstrip.animate({
+ top: distance
+ },{
+ duration: this.opts.transition_speed,
+ easing: this.opts.easing,
+ complete: function(){
+ // adjust filmstrip position to ensure that there is always at least one frame behind
+ // and (2 * filmstripSize) ahead
+ if(to === 0) {
+ dom.gv_filmstrip.css('top',gv.getInt(dom.gv_filmstrip.css('top'))-(self.numImages*(gv.outerHeight(dom.gv_frame)+self.opts.frame_gap)));
+ self.frameIterator = self.numImages;
+ } else if(to > ((self.numImages * 3) - (self.filmstripSize * 2))) {
+ dom.gv_filmstrip.css('top',gv.getInt(dom.gv_filmstrip.css('top'))+(self.numImages*(gv.outerHeight(dom.gv_frame)+self.opts.frame_gap)));
+ self.frameIterator = to - self.numImages;
+ } else {
+ self.frameIterator = to;
+ }
+ }
+ });
+ }
+
+ } else {
+ this.frameIterator = to;
+ }
+ },
+
+ startSlideshow: function(changeIcon) {
+ var self = this,
+ dom = this.dom;
+
+ if(!self.opts.enable_slideshow) { return; }
+
+ if(changeIcon) {
+ dom.gv_navPlay.removeClass('gv_navPlay').addClass('gv_navPause');
+ }
+ this.playing = true;
+ dom.gv_galleryWrap.everyTime(this.opts.transition_interval,'slideshow_'+this.id,function(){ self.showNext(); });
+ },
+
+ stopSlideshow: function(changeIcon) {
+ var self = this,
+ dom = this.dom;
+
+ if(changeIcon) {
+ dom.gv_navPlay.removeClass('gv_navPause').addClass('gv_navPlay');
+ }
+ this.playing = false;
+ dom.gv_galleryWrap.stopTime('slideshow_'+this.id);
+ },
+
+ enablePanning: function() {
+ var self = this,
+ dom = this.dom;
+
+ if(!self.opts.enable_slideshow) { return; }
+
+ dom.gv_panel.css('cursor','url(http://www.google.com/intl/en_ALL/mapfiles/openhand.cur), n-resize');
+ if(this.opts.pan_style === 'drag') {
+ dom.gv_panelWrap.delegate('.gv_panel img','mousedown.galleryview',function(e) {
+ self.isMouseDown = true;
+ $(this).css('cursor','url(http://www.google.com/intl/en_ALL/mapfiles/closedhand.cur), n-resize');
+ }).delegate('.gv_panel img','mouseup.galleryview',function(e) {
+ self.isMouseDown = false;
+ $(this).css('cursor','url(http://www.google.com/intl/en_ALL/mapfiles/openhand.cur), n-resize');
+ }).delegate('.gv_panel img','mousemove.galleryview',function(e) {
+ var distY, distX,
+ image = $(this),
+ new_top, new_left;
+
+ if(self.isMouseDown) {
+ distY = e.pageY - self.mouse.y;
+ distX = e.pageX - self.mouse.x;
+ new_top = gv.getInt(image.css('top')) + distY;
+ new_left = gv.getInt(image.css('left')) + distX;
+
+ image.css('cursor','url(http://www.google.com/intl/en_ALL/mapfiles/closedhand.cur), n-resize');
+
+ if(new_top > 0) new_top = 0;
+ if(new_left > 0) new_left = 0;
+
+ if(new_top < (-1 * (gv.outerHeight(image) - gv.innerHeight(dom.gv_panel)))) { new_top = -1 * (gv.outerHeight(image) - gv.innerHeight(dom.gv_panel)); }
+ if(new_left < (-1 * (gv.outerWidth(image) - gv.innerWidth(dom.gv_panel)))) { new_left = -1 * (gv.outerWidth(image) - gv.innerWidth(dom.gv_panel)); }
+
+ image.css('top',new_top);
+ image.css('left',new_left);
+ } else {
+ image.css('cursor','url(http://www.google.com/intl/en_ALL/mapfiles/openhand.cur), n-resize');
+ }
+ });
+ } else {
+
+ }
+ },
+
+ bindActions: function() {
+ var self = this,
+ dom = this.dom;
+
+ dom.gv_showOverlay.bind('click.galleryview',function(){
+ if(self.overlayVisible) {
+ self.hideOverlay();
+ } else {
+ self.showOverlay();
+ }
+ });
+
+ dom.gv_navWrap.delegate('div','click.galleryview',function(){
+ var el = $(this);
+ if(el.hasClass('gv_navNext')) {
+ self.showNext();
+ } else if(el.hasClass('gv_navPrev')) {
+ self.showPrev();
+ } else if(el.hasClass('gv_navPlay')) {
+ self.startSlideshow(true);
+ } else if(el.hasClass('gv_navPause')) {
+ self.stopSlideshow(true);
+ }
+ return false;
+ });
+
+ dom.gv_panelNavNext.bind('click.galleryview',function(){
+ self.showNext();
+ return false;
+ });
+ dom.gv_panelNavPrev.bind('click.galleryview',function(){
+ self.showPrev();
+ return false;
+ });
+
+ dom.gv_filmstripWrap.delegate('.gv_frame','click.galleryview',function(){
+ var el = $(this),
+ i = el.data('frameIndex');
+
+ this.navAction = 'frame';
+ self.showItem(i);
+ return false;
+ });
+
+ dom.gv_panelWrap.bind('mouseover.galleryview',function(){
+ self.showPanelNav();
+ }).bind('mouseout.galleryview',function(){
+ self.hidePanelNav();
+ });
+ },
+
+ unbindActions: function() {
+ var self = this,
+ dom = this.dom;
+
+ dom.gv_showOverlay.unbind('click.galleryview');
+ dom.gv_panelNavNext.unbind('click.galleryview');
+ dom.gv_panelNavPrev.unbind('click.galleryview');
+ dom.gv_navWrap.undelegate('div','click.galleryview');
+ dom.gv_filmstripWrap.undelegate('.gv_frame','click.galleryview');
+ },
+
+ showPanelNav: function() {
+ var self = this,
+ dom = this.dom;
+
+ dom.gv_panelNavNext.show();
+ dom.gv_panelNavPrev.show();
+ },
+
+ hidePanelNav: function() {
+ var self = this,
+ dom = this.dom;
+
+ dom.gv_panelNavNext.hide();
+ dom.gv_panelNavPrev.hide();
+ },
+
+ init: function(options,el) {
+ var self = this,
+ dom = this.dom = {};
+
+ this.opts = $.extend({},$.fn.galleryView.defaults,options);
+ this.el = el;
+ this.$el = $(el);
+ this.id = el.id;
+ this.iterator = this.frameIterator = this.opts.start_frame - 1;
+ this.overlayVisible = false;
+ this.playing = false;
+ this.scrolling = false;
+ this.isMouseDown = false;
+ this.mouse = { x: 0, y: 0 };
+ this.filmstripOrientation = (this.opts.filmstrip_position === 'top' || this.opts.filmstrip_position === 'bottom') ? 'horizontal' : 'vertical';
+
+ $(document).bind('mousemove.galleryview',function(e) {
+ self.mouse = {x: e.pageX, y: e.pageY};
+ });
+
+ // create all necessary DOM elements
+ $.each(this.elems,function(i,elem) {
+ var elem = elem.split('.');
+
+ // if there is no tag name, assume <div>
+ if(elem[0] === '') { elem[0] = 'div'; }
+
+ // add jQuery element to dom object
+ dom[elem[1]] = self.createElem({'class':elem[1]},elem[0]);
+ });
+
+ dom.gv_imageStore.appendTo($('body'));
+
+ dom.gv_galleryWrap.delegate('img','mousedown.galleryview',function(e){ if(e.preventDefault) { e.preventDefault(); } });
+
+ dom.gv_panel.addClass('gv_panel-loading');
+ dom.gv_frame.addClass('gv_frame-loading');
+
+ // nest DOM elements
+ dom.gv_galleryWrap.hide().append(dom.gv_gallery);
+
+ if(this.opts.show_panels) {
+ dom.gv_gallery.append(
+ dom.gv_panelWrap.append(
+ dom.gv_panelNavNext,
+ dom.gv_panelNavPrev,
+ dom.gv_infobar
+ )
+ );
+ }
+
+ if(this.opts.show_filmstrip) {
+ dom.gv_gallery.append(
+ dom.gv_filmstripWrap.append(
+ dom.gv_filmstrip
+ )
+ );
+
+ if(this.opts.show_filmstrip_nav) {
+ dom.gv_gallery.append(
+ dom.gv_navWrap.append(
+ dom.gv_navPrev,
+ (this.opts.enable_slideshow?dom.gv_navPlay:$('<span></span>')),
+ dom.gv_navNext
+ )
+ );
+ }
+ }
+
+ if(this.opts.show_overlays) {
+ dom.gv_panelWrap.append(dom.gv_overlay,dom.gv_showOverlay);
+ }
+
+ if(this.opts.show_captions) {
+ dom.gv_frame.append(dom.gv_caption).appendTo(dom.gv_gallery);
+ }
+
+ //swap out source element with gallery
+ this.$el.replaceWith(dom.gv_galleryWrap);
+
+ if(this.opts.pan_images) {
+ this.enablePanning();
+ }
+
+ // convert source images into gvImage objects
+ this.storeImages();
+
+ // block out dimensions/positions of gallery elements
+ this.buildGallery();
+
+ // begin loading images into gallery
+ this.initImages();
+
+ // set up transitions, buttons
+ this.bindActions();
+
+ // remove temporary frame element
+ dom.gv_frame.remove();
+
+ // show gallery
+ dom.gv_galleryWrap.show();
+
+ if(this.opts.autoplay) {
+ this.startSlideshow(true);
+ }
+
+ this.updateOverlay(this.iterator);
+ this.updateFilmstrip(this.frameIterator);
+ }
+
+ }; // END GalleryView
+
+ /*
+ MAIN PLUGIN CODE
+ */
+ $.fn.galleryView = function (options) {
+ if (this.length) {
+ return this.each(function () {
+ var gallery = Object.create(GalleryView);
+ gallery.init(options,this);
+ });
+ }
+ };
+
+ /*
+ Default Options
+ Object literal storing default plugin options
+ */
+ $.fn.galleryView.defaults = {
+
+ // General Options
+ transition_speed: 1000, //INT - duration of panel/frame transition (in milliseconds)
+ transition_interval: 5000, //INT - delay between panel/frame transitions (in milliseconds)
+ easing: 'swing', //STRING - easing method to use for animations (jQuery provides 'swing' or 'linear', more available with jQuery UI or Easing plugin)
+
+ // Panel Options
+ show_panels: true, //BOOLEAN - flag to show or hide panel portion of gallery
+ show_panel_nav: true, //BOOLEAN - flag to show or hide panel navigation buttons
+ show_overlays: false, //BOOLEAN - flag to show or hide panel overlays
+ panel_width: 800, //INT - width of gallery panel (in pixels)
+ panel_height: 400, //INT - height of gallery panel (in pixels)
+ panel_animation: 'fade', //STRING - animation method for panel transitions (crossfade,fade,slide,none)
+ panel_scale: 'crop', //STRING - cropping option for panel images (crop = scale image and fit to aspect ratio determined by panel_width and panel_height, fit = scale image and preserve original aspect ratio)
+ overlay_position: 'bottom', //STRING - position of panel overlay (bottom, top)
+ pan_images: false, //BOOLEAN - flag to allow user to grab/drag oversized images within gallery
+ pan_style: 'drag', //STRING - panning method (drag = user clicks and drags image to pan, track = image automatically pans based on mouse position
+ pan_smoothness: 15, //INT - determines smoothness of tracking pan animation (higher number = smoother)
+
+ // Filmstrip Options
+ start_frame: 1, //INT - index of panel/frame to show first when gallery loads
+ show_filmstrip: true, //BOOLEAN - flag to show or hide filmstrip portion of gallery
+ show_filmstrip_nav: true, //BOOLEAN - flag indicating whether to display navigation buttons
+ enable_slideshow: true, //BOOLEAN - flag indicating whether to display slideshow play/pause button
+ autoplay: false, //BOOLEAN - flag to start slideshow on gallery load
+ show_captions: false, //BOOLEAN - flag to show or hide frame captions
+ filmstrip_size: 3, //INT - number of frames to show in filmstrip-only gallery
+ filmstrip_style: 'scroll', //STRING - type of filmstrip to use (scroll = display one line of frames, scroll filmstrip if necessary, show all = display multiple rows of frames if necessary)
+ filmstrip_position: 'bottom', //STRING - position of filmstrip within gallery (bottom, top, left, right)
+ frame_width: 80, //INT - width of filmstrip frames (in pixels)
+ frame_height: 40, //INT - width of filmstrip frames (in pixels)
+ frame_opacity: 0.4, //FLOAT - transparency of non-active frames (1.0 = opaque, 0.0 = transparent)
+ frame_scale: 'crop', //STRING - cropping option for filmstrip images (same as above)
+ frame_gap: 5, //INT - spacing between frames within filmstrip (in pixels)
+
+ // Info Bar Options
+ show_infobar: true, //BOOLEAN - flag to show or hide infobar
+ infobar_opacity: 1 //FLOAT - transparency for info bar
+ };
+})(jQuery);
138 js/jquery.timers-1.2.js
@@ -0,0 +1,138 @@
+/**
+ * jQuery.timers - Timer abstractions for jQuery
+ * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
+ * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
+ * Date: 2009/10/16
+ *
+ * @author Blair Mitchelmore
+ * @version 1.2
+ *
+ **/
+
+jQuery.fn.extend({
+ everyTime: function(interval, label, fn, times) {
+ return this.each(function() {
+ jQuery.timer.add(this, interval, label, fn, times);
+ });
+ },
+ oneTime: function(interval, label, fn) {
+ return this.each(function() {
+ jQuery.timer.add(this, interval, label, fn, 1);
+ });
+ },
+ stopTime: function(label, fn) {
+ return this.each(function() {
+ jQuery.timer.remove(this, label, fn);
+ });
+ }
+});
+
+jQuery.extend({
+ timer: {
+ global: [],
+ guid: 1,
+ dataKey: "jQuery.timer",
+ regex: /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,
+ powers: {
+ // Yeah this is major overkill...
+ 'ms': 1,
+ 'cs': 10,
+ 'ds': 100,
+ 's': 1000,
+ 'das': 10000,
+ 'hs': 100000,
+ 'ks': 1000000
+ },
+ timeParse: function(value) {
+ if (value == undefined || value == null)
+ return null;
+ var result = this.regex.exec(jQuery.trim(value.toString()));
+ if (result[2]) {
+ var num = parseFloat(result[1]);
+ var mult = this.powers[result[2]] || 1;
+ return num * mult;
+ } else {
+ return value;
+ }
+ },
+ add: function(element, interval, label, fn, times) {
+ var counter = 0;
+
+ if (jQuery.isFunction(label)) {
+ if (!times)
+ times = fn;
+ fn = label;
+ label = interval;
+ }
+
+ interval = jQuery.timer.timeParse(interval);
+
+ if (typeof interval != 'number' || isNaN(interval) || interval < 0)
+ return;
+
+ if (typeof times != 'number' || isNaN(times) || times < 0)
+ times = 0;
+
+ times = times || 0;
+
+ var timers = jQuery.data(element, this.dataKey) || jQuery.data(element, this.dataKey, {});
+
+ if (!timers[label])
+ timers[label] = {};
+
+ fn.timerID = fn.timerID || this.guid++;
+
+ var handler = function() {
+ if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
+ jQuery.timer.remove(element, label, fn);
+ };
+
+ handler.timerID = fn.timerID;
+
+ if (!timers[label][fn.timerID])
+ timers[label][fn.timerID] = window.setInterval(handler,interval);
+
+ this.global.push( element );
+
+ },
+ remove: function(element, label, fn) {
+ var timers = jQuery.data(element, this.dataKey), ret;
+
+ if ( timers ) {
+
+ if (!label) {
+ for ( label in timers )
+ this.remove(element, label, fn);
+ } else if ( timers[label] ) {
+ if ( fn ) {
+ if ( fn.timerID ) {
+ window.clearInterval(timers[label][fn.timerID]);
+ delete timers[label][fn.timerID];
+ }
+ } else {
+ for ( var fn in timers[label] ) {
+ window.clearInterval(timers[label][fn]);
+ delete timers[label][fn];
+ }
+ }
+
+ for ( ret in timers[label] ) break;
+ if ( !ret ) {
+ ret = null;
+ delete timers[label];
+ }
+ }
+
+ for ( ret in timers ) break;
+ if ( !ret )
+ jQuery.removeData(element, this.dataKey);
+ }
+ }
+ }
+});
+
+jQuery(window).bind("unload", function() {
+ jQuery.each(jQuery.timer.global, function(index, item) {
+ jQuery.timer.remove(item);
+ });
+});

0 comments on commit a9b6b6b

Please sign in to comment.
Something went wrong with that request. Please try again.