Changeset 405807
- Timestamp:
- 07/06/2011 11:20:35 PM (15 years ago)
- Location:
- anythingslider-for-wordpress
- Files:
-
- 36 added
- 11 edited
-
tags/0.6 (added)
-
tags/0.6/css (added)
-
tags/0.6/css/anythingslider-ie.css (added)
-
tags/0.6/css/anythingslider.css (added)
-
tags/0.6/css/theme-construction.css (added)
-
tags/0.6/css/theme-cs-portfolio.css (added)
-
tags/0.6/css/theme-metallic.css (added)
-
tags/0.6/css/theme-minimalist-round.css (added)
-
tags/0.6/css/theme-minimalist-square.css (added)
-
tags/0.6/images (added)
-
tags/0.6/images/arrows-construction.gif (added)
-
tags/0.6/images/arrows-cs-portfolio.jpg (added)
-
tags/0.6/images/arrows-default.png (added)
-
tags/0.6/images/arrows-metallic.png (added)
-
tags/0.6/images/arrows-minimalist.png (added)
-
tags/0.6/images/bg-cs-portfolio.jpg (added)
-
tags/0.6/images/cellshade.png (added)
-
tags/0.6/images/nav-construction.png (added)
-
tags/0.6/images/nav-cs-portfolio.png (added)
-
tags/0.6/js (added)
-
tags/0.6/js/jquery.anythingslider.fx.js (added)
-
tags/0.6/js/jquery.anythingslider.fx.min.js (added)
-
tags/0.6/js/jquery.anythingslider.js (added)
-
tags/0.6/js/jquery.anythingslider.min.js (added)
-
tags/0.6/js/jquery.anythingslider.video.js (added)
-
tags/0.6/js/jquery.anythingslider.video.min.js (added)
-
tags/0.6/js/jquery.easing.1.2.js (added)
-
tags/0.6/js/swfobject.js (added)
-
tags/0.6/jtd-anything-slider.php (added)
-
tags/0.6/readme.txt (added)
-
tags/0.6/screenshot-1.jpg (added)
-
tags/0.6/screenshot-2.jpg (added)
-
tags/0.6/screenshot-3.jpg (added)
-
tags/0.6/screenshot-4.jpg (added)
-
tags/0.6/uninstall.php (added)
-
trunk/css/anythingslider.css (modified) (7 diffs)
-
trunk/css/theme-construction.css (modified) (1 diff)
-
trunk/css/theme-metallic.css (modified) (1 diff)
-
trunk/css/theme-minimalist-round.css (modified) (1 diff)
-
trunk/css/theme-minimalist-square.css (modified) (1 diff)
-
trunk/js/jquery.anythingslider.fx.js (modified) (6 diffs)
-
trunk/js/jquery.anythingslider.fx.min.js (modified) (1 diff)
-
trunk/js/jquery.anythingslider.js (modified) (29 diffs)
-
trunk/js/jquery.anythingslider.min.js (modified) (1 diff)
-
trunk/jtd-anything-slider.php (modified) (14 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/uninstall.php (added)
Legend:
- Unmodified
- Added
- Removed
-
anythingslider-for-wordpress/trunk/css/anythingslider.css
r397633 r405807 1 1 /* 2 AnythingSlider v1. 5.10+ Default (base) theme2 AnythingSlider v1.7+ Default (base) theme 3 3 By Chris Coyier: http://css-tricks.com 4 4 with major improvements by Doug Neiner: http://pixelgraphics.us/ … … 6 6 */ 7 7 8 /******* SET DEFAULT DIMENSIONS HERE ********/ 9 div.anythingSlider { 10 display: block; 8 /***************************** 9 SET DEFAULT DIMENSIONS HERE 10 *****************************/ 11 /* change the ID to match your slider */ 12 #slider { 11 13 width: 700px; 12 14 height: 390px; 13 margin: 0 auto; 14 overflow: hidden; /* needed for Opera and Safari */ 15 list-style: none; 15 16 } 16 div.anythingSlider .panel .content { 17 position: absolute; 18 top: -50px; left: 0; 19 width: 94%; 20 color: #EEE; 21 padding: 4px 3%; 22 font-size: 13px; 23 background: #333; 24 background: rgba(0, 0, 0, 0.6); 25 -webkit-transition: all .5s linear; 26 -moz-transition: all .5s linear; 27 -ms-transition: all .5s linear; 28 -o-transition: all .5s linear; 29 transition: all .5s linear; 17 /* Opera width restriction */ 18 .anythingBase { max-width: 32766px; } 19 20 /***************** 21 SET COLORS HERE 22 *****************/ 23 /**** Default state (no keyboard focus) ****/ 24 /* slider window - top & bottom borders, default state */ 25 div.anythingSlider .anythingWindow { 26 border-top: 3px solid #777; 27 border-bottom: 3px solid #777; 30 28 } 31 div.anythingSlider .panel:hover .content { 32 top: 0; 33 } 34 35 /****** SET COLORS HERE *******/ 36 /* Default State */ 29 /* Navigation buttons, default state */ 37 30 div.anythingSlider .thumbNav a.cur, div.anythingSlider .thumbNav a { 38 31 background: #777; 39 32 color: #000; 40 33 } 41 div.anythingSlider .anythingWindow { 42 border-top: 3px solid #777; 43 border-bottom: 3px solid #777; 44 } 34 /* start-stop button, stopped, default state */ 45 35 div.anythingSlider .start-stop { 46 36 background-color: #040; 47 37 color: #fff; 48 38 } 39 /* start-stop button, playing, default state */ 49 40 div.anythingSlider .start-stop.playing { 50 41 background-color: #800; 51 42 } 43 /* start-stop button, default hovered text color (when visible) */ 52 44 div.anythingSlider .start-stop:hover, div.anythingSlider .start-stop.hover { 53 45 color: #ddd; 54 46 } 55 47 56 /* Active State */ 48 /**** Active State (slider has keyboard focus) ****/ 49 /* slider window - top & bottom borders, active state */ 57 50 div.anythingSlider.activeSlider .anythingWindow { 58 51 border-color: #7C9127; 59 52 } 53 /* Navigation buttons, active state */ 60 54 div.anythingSlider.activeSlider .thumbNav a.cur, div.anythingSlider.activeSlider .thumbNav a { 61 55 background-color: #7C9127; 62 56 } 57 /* start-stop button, stopped, active state */ 63 58 div.anythingSlider .start-stop { 64 59 background-color: #080; 65 60 color: #fff; 66 61 } 62 /* start-stop button, playing, active state */ 67 63 div.anythingSlider .start-stop.playing { 68 64 background-color: #d00; 69 65 } 66 /* start-stop button, active slider hovered text color (when visible) */ 70 67 div.anythingSlider .start-stop:hover, div.anythingSlider .start-stop.hover { 71 68 color: #fff; 72 69 } 73 70 74 /**** DO NOT CHANGE BELOW THIS LINE ****/ 71 /*********************** 72 COMMON SLIDER STYLING 73 ***********************/ 74 /* Overall Wrapper: 45px right & left padding for the arrows, 28px @ bottom for navigation */ 75 div.anythingSlider { 76 display: block; 77 margin: 0 auto; 78 overflow: hidden; /* needed for Opera and Safari */ 79 position: relative; 80 padding: 0 45px 28px 45px; 81 } 75 82 /* anythingSlider viewport window */ 76 83 div.anythingSlider .anythingWindow { … … 80 87 height: 100%; 81 88 } 82 /* wrapper: 45px right & left padding for the arrows, 28px @ bottom for navigation */ 83 div.anythingSlider { 84 position: relative; 85 padding: 0 45px 28px 45px; 86 } 87 /* anythingSlider base */ 89 /* anythingSlider base (original element) */ 88 90 .anythingBase { 89 91 background: transparent; … … 95 97 padding: 0; 96 98 } 99 /* all panels inside the slider */ 97 100 .anythingBase .panel { 98 101 background: transparent; … … 102 105 padding: 0; 103 106 margin: 0; 104 position: relative;105 107 } 106 108 … … 120 122 background: url(../images/arrows-default.png) no-repeat; 121 123 } 124 /* hide text, target the span so IE7 doesn't text-indent the link */ 122 125 div.anythingSlider .arrow a span { display: block; text-indent: -9999px; } 126 /* back arrow */ 127 div.anythingSlider .back { left: 0; } 128 div.anythingSlider .back a { background-position: -88px -40px; } 129 div.anythingSlider .back a:hover, div.anythingSlider .back a.hover { background-position: -88px -240px; } 130 div.anythingSlider .back.disabled { display: none; } /* disabled arrows, hide or reduce opacity: opacity: .5; filter: alpha(opacity=50); */ 131 /* forward arrow */ 123 132 div.anythingSlider .forward { right: 0; } 124 div.anythingSlider .back { left: 0; }125 133 div.anythingSlider .forward a { background-position: 0 -40px; } 126 div.anythingSlider .back a { background-position: -88px -40px; }127 134 div.anythingSlider .forward a:hover, div.anythingSlider .forward a.hover { background-position: 0 -240px; } 128 div.anythingSlider .back a:hover, div.anythingSlider .back a.hover { background-position: -88px -240px; }129 135 div.anythingSlider .forward.disabled { display: none; } /* disabled arrows, hide or reduce opacity: opacity: .5; filter: alpha(opacity=50); */ 130 div.anythingSlider .back.disabled { display: none; }131 136 132 137 /* Navigation Links */ … … 178 183 -webkit-border-radius: 0 0 5px 5px; 179 184 } 185 /* hide cell shading on hover - makes the button appear to come forward */ 180 186 div.anythingSlider .start-stop:hover, div.anythingSlider .start-stop.hover { background-image: none; } 181 187 188 /* probably not necessary, but added just in case */ 182 189 div.anythingSlider, div.anythingSlider .anythingWindow, div.anythingSlider .thumbNav a, div.anythingSlider .arrow a, div.anythingSlider .start-stop { 183 190 transition-duration: 0; -
anythingslider-for-wordpress/trunk/css/theme-construction.css
r397633 r405807 65 65 div.anythingSlider-construction .anythingControls { 66 66 position: absolute; 67 width: 80%;68 67 bottom: 0; 69 68 right: 15%; -
anythingslider-for-wordpress/trunk/css/theme-metallic.css
r397633 r405807 68 68 div.anythingSlider-metallic .anythingControls { 69 69 position: absolute; 70 width: 80%;71 70 bottom: 0; 72 71 right: 15%; -
anythingslider-for-wordpress/trunk/css/theme-minimalist-round.css
r397633 r405807 69 69 div.anythingSlider-minimalist-round .anythingControls { 70 70 position: absolute; 71 width: 80%;72 71 bottom: 0; 73 72 right: 15%; -
anythingslider-for-wordpress/trunk/css/theme-minimalist-square.css
r397633 r405807 69 69 div.anythingSlider-minimalist-square .anythingControls { 70 70 position: absolute; 71 width: 80%;72 71 bottom: 0; 73 72 right: 15%; -
anythingslider-for-wordpress/trunk/js/jquery.anythingslider.fx.js
r397633 r405807 1 1 /* 2 * AnythingSlider Slide FX 1. 3for AnythingSlider v1.5.8+2 * AnythingSlider Slide FX 1.4 for AnythingSlider v1.5.8+ 3 3 * By Rob Garrison (aka Mottie & Fudgey) 4 4 * Dual licensed under the MIT and GPL licenses. … … 48 48 49 49 // Animate FX 50 animateFx = function(el, opt, isOut ){50 animateFx = function(el, opt, isOut, time){ 51 51 if (el.length === 0 || typeof opt === 'undefined') { return; } // no fx 52 52 var o = opt[0] || opt, … … 60 60 // multiple selectors for out animation 61 61 if (s !== ''){ 62 el.filter(opt[1][0]).animate(o[0], { queue : false, duration : t, easing : o[0].easing }); 63 el.filter(opt[1][1]).animate(s, { queue : false, duration : t, easing : o[0].easing, complete: function(){ 64 setTimeout(function(){ hideOffscreen(el); }, defaults.timeOut); 62 // Out animation is set to 1/4 of the time of the in animation 63 el.filter(opt[1][0]).animate(o[0], { queue : false, duration : (time || t)/4, easing : o[0].easing }); 64 el.filter(opt[1][1]).animate(s, { queue : true, duration : (time || t)/4, easing : o[0].easing, complete: function(){ 65 setTimeout(function(){ hideOffscreen(el); }, 0); // animation complete... bug report: http://bugs.jquery.com/ticket/7157 65 66 } }); 66 67 return; … … 69 70 // animation for no extra selectors 70 71 if (!isOut) { el.css('visibility','visible').show(); } 71 el.animate(o, { queue : false, duration :t, easing : o.easing, complete: function(){72 if (isOut) { setTimeout(function(){ hideOffscreen(el); }, defaults.timeOut); }72 el.animate(o, { queue : true, duration : time || t, easing : o.easing, complete: function(){ 73 if (isOut) { setTimeout(function(){ hideOffscreen(el); }, 0); } 73 74 } }); 74 75 }, … … 113 114 // bind events for "OUT" effects - occur when leaving a page 114 115 .bind('slide_init', function(e, slider){ 115 var el, elOut, page = slider.$lastPage.add( slider.$items.eq(slider.exactPage) );116 var el, elOut, time, page = slider.$lastPage.add( slider.$items.eq(slider.exactPage) ); 116 117 if (slider.exactPage === 0) { page = page.add( slider.$items.eq( slider.pages ) ); } // add last (non-cloned) page if on first 118 if (slider.options.animationTime < defaults.timeOut) { 119 time = slider.options.animationTime || 1; // if time = zero, make it 1... (0 || 1 === 1) // true ) 120 } 117 121 page = page.find('*').andSelf(); // include the panel in the selectors 118 122 for (el in options) { … … 126 130 // Use built-in effects 127 131 if ($.isArray(options[el]) && page.filter(el).length) { 128 animateFx( page.filter(el), getFx(options[el],true), true );132 animateFx( page.filter(el), getFx(options[el],true), true, time); 129 133 } 130 134 } -
anythingslider-for-wordpress/trunk/js/jquery.anythingslider.fx.min.js
r397633 r405807 1 1 /* 2 * AnythingSlider Slide FX 1. 3minified for AnythingSlider v1.5.8+2 * AnythingSlider Slide FX 1.4 minified for AnythingSlider v1.5.8+ 3 3 * By Rob Garrison (aka Mottie & Fudgey) 4 4 * Dual licensed under the MIT and GPL licenses. 5 5 */ 6 (function( h){h.fn.anythingSliderFx=function(g){var l=h(this).closest(".anythingSlider"),i=l.width(),n=l.height(),o=function(a){return{top:[{inFx:{top:0},outFx:{top:"-"+(a||n)}}],bottom:[{inFx:{bottom:0},outFx:{bottom:a||n}}],left:[{inFx:{left:0},outFx:{left:"-"+(a||i)}}],right:[{inFx:{right:0},outFx:{right:a||i}}],fade:[{inFx:{opacity:1},outFx:{opacity:0}}],expand:[{inFx:{width:"100%",top:"0%",left:"0%"},outFx:{width:a||"10%",top:"50%",left:"50%"}}],listLR:[{inFx:{left:0,opacity:1},outFx:[{left:a|| i,opacity:0},{left:"-"+(a||i),opacity:0}],selector:[":odd",":even"]}],listRL:[{inFx:{left:0,opacity:1},outFx:[{left:a||i,opacity:0},{left:"-"+(a||i),opacity:0}],selector:[":even",":odd"]}],"caption-Top":[{inFx:{top:0,opacity:0.8},outFx:{top:"-"+a||-50,opacity:0}}],"caption-Right":[{inFx:{right:0,opacity:0.8},outFx:{right:"-"+a||-150,opacity:0}}],"caption-Bottom":[{inFx:{bottom:0,opacity:0.8},outFx:{bottom:"-"+a||-50,opacity:0}}],"caption-Left":[{inFx:{left:0,opacity:0.8},outFx:{left:"-"+a||-150,opacity:0}}]}}; return this.each(function(){var a=o(),k={easing:"swing",timeIn:400,timeOut:350},i=function(e){e.each(function(){h(this).closest(".panel").is(".activePage")||h(this).css("visibility","hidden")})},m=function(e,a,c){if(!(e.length===0||typeof a==="undefined")){var b=a[0]||a,d=b[1]||"",h=parseInt(d===""?b.duration:b[0].duration,10);if(c&&(e.css("position")!=="absolute"&&e.css({position:"relative"}),e.stop(),d!=="")){e.filter(a[1][0]).animate(b[0],{queue:!1,duration:h,easing:b[0].easing});e.filter(a[1][1]).animate(d, {queue:!1,duration:h,easing:b[0].easing,complete:function(){setTimeout(function(){i(e)},k.timeOut)}});return}c||e.css("visibility","visible").show();e.animate(b,{queue:!1,duration:h,easing:b.easing,complete:function(){c&&setTimeout(function(){i(e)},k.timeOut)}})}},l=function(e,f){var c,b,d=f?"outFx":"inFx",g={},i=f?k.timeOut:k.timeIn,j=h.trim(e[0].replace(/\s+/g," ")).split(" ");if(f&&j.length===1&&a.hasOwnProperty(j)&&typeof a[j][0].selector!=="undefined")return b=a[j][0].outFx,b[0].duration=e[2]|| k.timeOut,b[0].easing=e[3]||k.easing,[b,a[j][0].selector||[]];h.each(j,function(b,f){if(a.hasOwnProperty(f)){var j=f==="fade"?1:2;c=typeof e[1]==="undefined"?a:o(e[1]);h.extend(!0,g,c[f][0][d]);g.duration=e[j]||g.duration||i;g.easing=e[j+1]||k.easing}});return[g]};h(this).bind("slide_init",function(a,f){var c,b,d=f.$lastPage.add(f.$items.eq(f.exactPage));f.exactPage===0&&(d=d.add(f.$items.eq(f.pages)));d=d.find("*").andSelf();for(c in g)if(c==="outFx")for(b in g.outFx)d.filter(b).length&&m(d.filter(b), g.outFx[b],!0);else c!=="inFx"&&h.isArray(g[c])&&d.filter(c).length&&m(d.filter(c),l(g[c],!0),!0)}).bind("slide_complete",function(a,f){var c,b,d=f.$currentPage.add(f.$items.eq(f.exactPage)),d=d.find("*").andSelf();for(c in g)if(c==="inFx")for(b in g.inFx)d.filter(b).length&&m(d.filter(b),g.inFx[b],!1);else c!=="outFx"&&h.isArray(g[c])&&d.filter(c).length&&m(d.filter(c),l(g[c],!1),!1)})})}})(jQuery);6 (function(j){j.fn.anythingSliderFx=function(i){var l=j(this).closest(".anythingSlider"),h=l.width(),m=l.height(),o=function(a){return{top:[{inFx:{top:0},outFx:{top:"-"+(a||m)}}],bottom:[{inFx:{bottom:0},outFx:{bottom:a||m}}],left:[{inFx:{left:0},outFx:{left:"-"+(a||h)}}],right:[{inFx:{right:0},outFx:{right:a||h}}],fade:[{inFx:{opacity:1},outFx:{opacity:0}}],expand:[{inFx:{width:"100%",top:"0%",left:"0%"},outFx:{width:a||"10%",top:"50%",left:"50%"}}],listLR:[{inFx:{left:0,opacity:1},outFx:[{left:a|| h,opacity:0},{left:"-"+(a||h),opacity:0}],selector:[":odd",":even"]}],listRL:[{inFx:{left:0,opacity:1},outFx:[{left:a||h,opacity:0},{left:"-"+(a||h),opacity:0}],selector:[":even",":odd"]}],"caption-Top":[{inFx:{top:0,opacity:0.8},outFx:{top:"-"+a||-50,opacity:0}}],"caption-Right":[{inFx:{right:0,opacity:0.8},outFx:{right:"-"+a||-150,opacity:0}}],"caption-Bottom":[{inFx:{bottom:0,opacity:0.8},outFx:{bottom:"-"+a||-50,opacity:0}}],"caption-Left":[{inFx:{left:0,opacity:0.8},outFx:{left:"-"+a||-150,opacity:0}}]}}; return this.each(function(){var a=o(),h={easing:"swing",timeIn:400,timeOut:350},l=function(d){d.each(function(){j(this).closest(".panel").is(".activePage")||j(this).css("visibility","hidden")})},n=function(d,b,c,a){if(!(d.length===0||typeof b==="undefined")){var e=b[0]||b,g=e[1]||"",h=parseInt(g===""?e.duration:e[0].duration,10);if(c&&(d.css("position")!=="absolute"&&d.css({position:"relative"}),d.stop(),g!=="")){d.filter(b[1][0]).animate(e[0],{queue:!1,duration:(a||h)/4,easing:e[0].easing});d.filter(b[1][1]).animate(g, {queue:!0,duration:(a||h)/4,easing:e[0].easing,complete:function(){setTimeout(function(){l(d)},0)}});return}c||d.css("visibility","visible").show();d.animate(e,{queue:!0,duration:a||h,easing:e.easing,complete:function(){c&&setTimeout(function(){l(d)},0)}})}},m=function(d,b){var c,f,e=b?"outFx":"inFx",g={},i=b?h.timeOut:h.timeIn,k=j.trim(d[0].replace(/\s+/g," ")).split(" ");if(b&&k.length===1&&a.hasOwnProperty(k)&&typeof a[k][0].selector!=="undefined")return f=a[k][0].outFx,f[0].duration=d[2]||h.timeOut, f[0].easing=d[3]||h.easing,[f,a[k][0].selector||[]];j.each(k,function(b,f){if(a.hasOwnProperty(f)){var k=f==="fade"?1:2;c=typeof d[1]==="undefined"?a:o(d[1]);j.extend(!0,g,c[f][0][e]);g.duration=d[k]||g.duration||i;g.easing=d[k+1]||h.easing}});return[g]};j(this).bind("slide_init",function(a,b){var c,f,e,g=b.$lastPage.add(b.$items.eq(b.exactPage));b.exactPage===0&&(g=g.add(b.$items.eq(b.pages)));b.options.animationTime<h.timeOut&&(e=b.options.animationTime||1);g=g.find("*").andSelf();for(c in i)if(c=== "outFx")for(f in i.outFx)g.filter(f).length&&n(g.filter(f),i.outFx[f],!0);else c!=="inFx"&&j.isArray(i[c])&&g.filter(c).length&&n(g.filter(c),m(i[c],!0),!0,e)}).bind("slide_complete",function(a,b){var c,f,e=b.$currentPage.add(b.$items.eq(b.exactPage)),e=e.find("*").andSelf();for(c in i)if(c==="inFx")for(f in i.inFx)e.filter(f).length&&n(e.filter(f),i.inFx[f],!1);else c!=="outFx"&&j.isArray(i[c])&&e.filter(c).length&&n(e.filter(c),m(i[c],!1),!1)})})}})(jQuery); -
anythingslider-for-wordpress/trunk/js/jquery.anythingslider.js
r397633 r405807 1 1 /* 2 AnythingSlider v1.5.21 3 4 By Chris Coyier: http://css-tricks.com 5 with major improvements by Doug Neiner: http://pixelgraphics.us/ 6 based on work by Remy Sharp: http://jqueryfordesigners.com/ 7 and crazy mods by Rob Garrison (aka Mottie): https://github.com/ProLoser/AnythingSlider 2 AnythingSlider v1.7.1 3 Original by Chris Coyier: http://css-tricks.com 4 Get the latest version: https://github.com/ProLoser/AnythingSlider 8 5 9 6 To use the navigationFormatter function, you must have a function that … … 23 20 $.anythingSlider = function(el, options) { 24 21 25 // To avoid scope issues, use 'base' instead of 'this'26 // to reference this class from internal events and functions.27 22 var base = this, o; 28 23 … … 47 42 base.$wrapper = base.$el.parent().closest('div.anythingSlider').addClass('anythingSlider-' + o.theme); 48 43 base.$window = base.$el.closest('div.anythingWindow'); 49 base.$controls = $('<div class="anythingControls"></div>').appendTo( (o.appendControlsTo !== null && $(o.appendControlsTo).length) ? $(o.appendControlsTo) : base.$wrapper); // change so this works in jQuery 1.3.250 44 base.win = window; 51 45 base.$win = $(base.win); 52 46 53 base.$nav = $('<ul class="thumbNav" />').appendTo(base.$controls); 47 base.$controls = $('<div class="anythingControls"></div>').appendTo( (o.appendControlsTo !== null && $(o.appendControlsTo).length) ? $(o.appendControlsTo) : base.$wrapper); 48 base.$startStop = $('<a href="#" class="start-stop"></a>'); 49 if (o.buildStartStop) { 50 base.$startStop.appendTo( (o.appendStartStopTo !== null && $(o.appendStartStopTo).length) ? $(o.appendStartStopTo) : base.$controls ); 51 } 52 base.$nav = $('<ul class="thumbNav" />').appendTo( (o.appendNavigationTo !== null && $(o.appendNavigationTo).length) ? $(o.appendNavigationTo) : base.$controls ); 54 53 55 54 // Set up a few defaults & get details … … 60 59 base.panelSize = []; // will contain dimensions and left position of each panel 61 60 base.currentPage = o.startPanel = parseInt(o.startPanel,10) || 1; // make sure this isn't a string 62 base.adjustLimit = (o.infiniteSlides) ? 0 : 1; // adjust page limits for infinite or limited modes 61 base.adj = (o.infiniteSlides) ? 0 : 1; // adjust page limits for infinite or limited modes 62 base.width = base.$el.width(); 63 base.height = base.$el.height(); 63 64 base.outerPad = [ base.$wrapper.innerWidth() - base.$wrapper.width(), base.$wrapper.innerHeight() - base.$wrapper.height() ]; 64 65 if (o.playRtl) { base.$wrapper.addClass('rtl'); } 65 66 // save some options67 base.original = [ o.autoPlay, o.buildNavigation, o.buildArrows];68 66 69 67 // Expand slider to fit parent … … 71 69 base.$outer = base.$wrapper.parent(); 72 70 base.$window.css({ width: '100%', height: '100%' }); // needed for Opera 73 base.outerDim = [ base.$outer.width(), base.$outer.height() ];74 71 base.checkResize(); 75 72 } 73 74 // If autoPlay functionality is included, then initialize the settings 75 if (o.buildStartStop) { 76 base.playing = o.autoPlay; // Sets the playing variable; removed "startStopped" option 77 base.buildAutoPlay(); 78 } else { 79 o.autoPlayLocked = false; // prevent autoPlayLocked from working if there is no start stop 80 } 81 82 // Build forwards/backwards buttons 83 if (o.buildArrows) { base.buildNextBackButtons(); } 76 84 77 85 base.updateSlider(); … … 113 121 114 122 // Add keyboard navigation 115 if (o.enableKeyboard) { 116 $(document).keyup(function(e){ 117 // Stop arrow keys from working when focused on form items 118 if (base.$wrapper.is('.activeSlider') && !e.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 119 switch (e.which) { 120 case 39: // right arrow 121 base.goForward(); 122 break; 123 case 37: //left arrow 124 base.goBack(); 125 break; 123 $(document).keyup(function(e){ 124 // Stop arrow keys from working when focused on form items 125 var lnk, slider, 126 active = base.$wrapper.is('.activeSlider') && !e.target.tagName.match('TEXTAREA|INPUT|SELECT'); 127 switch (e.which) { 128 case 9: // tab 129 lnk = $(':focus'); 130 slider = lnk.closest('.anythingSlider'); 131 if (slider[0] === base.$wrapper[0]) { 132 base.makeActive(); 133 base.$window.scrollLeft(0); 134 base.gotoPage(lnk.closest('.panel').index() + base.adj); 126 135 } 127 } 128 }); 129 } 136 break; 137 case 39: // right arrow 138 if (active && o.enableKeyboard) { base.goForward(); } 139 break; 140 case 37: //left arrow 141 if (active && o.enableKeyboard) { base.goBack(); } 142 break; 143 } 144 }); 130 145 131 146 // Binds events 132 147 triggers = "slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" "); 133 $.each("onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "), function(i, o){134 if ($.isFunction( base.options[o])){135 base.$el.bind(triggers[i], base.options[o]);148 $.each("onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "), function(i,f){ 149 if ($.isFunction(o[f])){ 150 base.$el.bind(triggers[i], o[f]); 136 151 } 137 152 }); … … 145 160 base.$el.trigger('initialized', base); 146 161 162 // trigger the slideshow 163 base.startStop(base.playing); 164 147 165 }; 148 166 … … 152 170 base.$el.children('.cloned').remove(); 153 171 base.$nav.empty(); 172 // set currentPage to 1 in case it was zero - occurs when adding slides after removing them all 173 base.currentPage = base.currentPage || 1; 154 174 155 175 base.$items = base.$el.children(); … … 159 179 if (o.showMultiple > 1) { 160 180 if (o.showMultiple > base.pages) { o.showMultiple = base.pages; } 161 base.adjustMultiple = (o.infiniteSlides && base.pages > 1) ? 0 : parseInt(o.showMultiple, 10)- 1;181 base.adjustMultiple = (o.infiniteSlides && base.pages > 1) ? 0 : o.showMultiple - 1; 162 182 base.pages = base.$items.length - base.adjustMultiple; 163 183 } 164 184 165 // Remove navigation & player if there is only one page 166 if (base.pages <= 1) { 167 o.autoPlay = false; 168 o.buildNavigation = false; 169 o.buildArrows = false; 170 base.$controls.hide(); 171 base.$nav.hide(); 172 if (base.$forward) { base.$forward.add(base.$back).hide(); } 173 } else { 174 o.autoPlay = base.original[0]; 175 o.buildNavigation = base.original[1]; 176 o.buildArrows = base.original[2]; 177 base.$controls.show(); 178 base.$nav.show(); 179 if (base.$forward) { base.$forward.add(base.$back).show(); } 180 181 // Build navigation tabs 185 // Hide navigation & player if there is only one page 186 base.$controls 187 .add(base.$nav) 188 .add(base.$startStop) 189 .add(base.$forward) 190 .add(base.$back) 191 [(base.pages <= 1) ? 'hide' : 'show'](); 192 if (base.pages > 1) { 193 // Build/update navigation tabs 182 194 base.buildNavigation(); 183 184 // If autoPlay functionality is included, then initialize the settings185 if (o.autoPlay) {186 base.playing = !o.startStopped; // Sets the playing variable to false if startStopped is true187 base.buildAutoPlay();188 }189 190 // Build forwards/backwards buttons191 if (o.buildArrows) { base.buildNextBackButtons(); }192 195 } 193 196 … … 203 206 } 204 207 base.$el.find('.cloned').each(function(){ 205 // disable all <a>in cloned panels to prevent shifting the panels by tabbing206 $(this).find('a,input,textarea,select ').attr('disabled', 'disabled');208 // disable all focusable elements in cloned panels to prevent shifting the panels by tabbing 209 $(this).find('a,input,textarea,select,button,area').attr('disabled', 'disabled'); 207 210 $(this).find('[id]').removeAttr('id'); 208 211 }); … … 214 217 215 218 // Set the dimensions of each panel 216 if (o.resizeContents) { 217 if (o.width) { 218 base.$items.css('width', o.width); 219 base.$wrapper.css('width', base.getDim(base.currentPage)[0]); 220 } 221 if (o.height) { base.$wrapper.add(base.$items).css('height', o.height); } 219 if (o.resizeContents && base.pages > 1) { 220 base.$items.css('width', base.width); 221 base.$wrapper.css('width', base.getDim(base.currentPage)[0]); 222 base.$wrapper.add(base.$items).css('height', base.height); 222 223 } else { 223 224 base.$win.load(function(){ base.setDimensions(); }); // set dimensions after all images load … … 230 231 base.$nav.find('a').eq(base.currentPage - 1).addClass('cur'); // update current selection 231 232 232 base.hasEmb = base.$items.find('embed[src*=youtube]').length; // embedded youtube objects exist in the slider233 base.hasSwfo = (typeof(swfobject) !== 'undefined' && swfobject.hasOwnProperty('embedSWF') && $.isFunction(swfobject.embedSWF)) ? true : false; // is swfobject loaded?234 235 // Initialize YouTube javascript api, if YouTube video is present236 if (base.hasEmb && base.hasSwfo) {237 base.$items.find('embed[src*=youtube]').each(function(i){238 // Older IE doesn't have an object - just make sure we are wrapping the correct element239 var $tar = ($(this).parent()[0].tagName === "OBJECT") ? $(this).parent() : $(this);240 $tar.wrap('<div id="ytvideo' + i + '"></div>');241 // use SWFObject if it exists, it replaces the wrapper with the object/embed242 swfobject.embedSWF($(this).attr('src') + '&enablejsapi=1&version=3&playerapiid=ytvideo' + i, 'ytvideo' + i,243 $tar.attr('width'), $tar.attr('height'), '10', null, null,244 { allowScriptAccess: "always", wmode : o.addWmodeToObject, allowfullscreen : true },245 { 'class' : $tar.attr('class'), 'style' : $tar.attr('style') },246 function(){ if (i >= base.hasEmb - 1) { base.$el.trigger('swf_completed', base); } } // swf callback247 );248 });249 }250 251 // Fix tabbing through the page, but don't include it if multiple slides are showing252 if (o.showMultiple === false) {253 base.$items.find('a').unbind('focus').bind('focus', function(e){254 base.$items.find('.focusedLink').removeClass('focusedLink');255 $(this).addClass('focusedLink');256 var panel = $(this).closest('.panel');257 if (!panel.is('.activePage')) {258 base.gotoPage(base.$items.index(panel));259 e.preventDefault();260 }261 });262 }263 264 233 }; 265 234 266 235 // Creates the numbered navigation links 267 236 base.buildNavigation = function() { 268 var tmp, klass, $a;269 237 if (o.buildNavigation && (base.pages > 1)) { 238 var tmp, klass, $a; 270 239 base.$items.filter(':not(.cloned)').each(function(i) { 271 240 var index = i + 1; … … 299 268 // Creates the Forward/Backward buttons 300 269 base.buildNextBackButtons = function() { 301 if (base.$forward) { return; }302 270 base.$forward = $('<span class="arrow forward"><a href="#"><span>' + o.forwardText + '</span></a></span>'); 303 271 base.$back = $('<span class="arrow back"><a href="#"><span>' + o.backText + '</span></a></span>'); 304 272 305 273 // Bind to the forward and back buttons 306 base.$back.bind(o.clickArrows, function(e) { 307 base.goBack(); 274 base.$back.bind(o.clickBackArrow, function(e) { 275 // prevent running functions twice (once for click, second time for swipe) 276 if (o.enableArrows && !base.flag) { 277 base.flag = true; setTimeout(function(){ base.flag = false; }, 100); 278 base.goBack(); 279 } 308 280 e.preventDefault(); 309 281 }); 310 base.$forward.bind(o.clickArrows, function(e) { 311 base.goForward(); 282 base.$forward.bind(o.clickForwardArrow, function(e) { 283 // prevent running functions twice (once for click, second time for swipe) 284 if (o.enableArrows && !base.flag) { 285 base.flag = true; setTimeout(function(){ base.flag = false; }, 100); 286 base.goForward(); 287 } 312 288 e.preventDefault(); 313 289 }); … … 318 294 319 295 // Append elements to page 320 base.$wrapper.prepend(base.$forward).prepend(base.$back); 321 base.$arrowWidth = base.$forward.width(); 296 base.$forward.appendTo( (o.appendFowardTo !== null && $(o.appendFowardTo).length) ? $(o.appendFowardTo) : base.$wrapper ); 297 base.$back.appendTo( (o.appendBackTo !== null && $(o.appendBackTo).length) ? $(o.appendBackTo) : base.$wrapper ); 298 299 base.$arrowWidth = base.$forward.width(); // assuming the left & right arrows are the same width - used for toggle 322 300 }; 323 301 324 302 // Creates the Start/Stop button 325 303 base.buildAutoPlay = function(){ 326 if (base.$startStop || base.pages < 2) { return; }327 base.$startStop = $("<a href='#' class='start-stop'></a>").html('<span>' + (base.playing ? o.stopText : o.startText) + '</span>');328 base.$controls.prepend(base.$startStop);329 304 base.$startStop 305 .html('<span>' + (base.playing ? o.stopText : o.startText) + '</span>') 330 306 .bind(o.clickSlideshow, function(e) { 331 if (o.enable Play) {307 if (o.enableStartStop) { 332 308 base.startStop(!base.playing); 333 if (base.playing) { 334 if (o.playRtl) { 335 base.goBack(true); 336 } else { 337 base.goForward(true); 338 } 309 base.makeActive(); 310 if (base.playing && !o.autoPlayDelayed) { 311 base.goForward(true); 339 312 } 340 313 } … … 345 318 $(this).toggleClass('hover'); 346 319 }); 347 348 // Use the same setting, but trigger the start;349 base.startStop(base.playing);350 320 }; 351 321 … … 354 324 clearTimeout(base.resizeTimer); 355 325 base.resizeTimer = setTimeout(function(){ 356 var w = base.$outer.width(), h = (base.$outer[0].tagName === "BODY") ? base.$win.height() : base.$outer.height(), dim = base.outerDim; 357 if (dim[0] !== w || dim[1] !== h) { 358 base.outerDim = [ w, h ]; 326 var w = base.$outer.width() - base.outerPad[0], 327 h = (base.$outer[0].tagName === "BODY" ? base.$win.height() : base.$outer.height()) - base.outerPad[1]; 328 // base.width = width of one panel, so multiply by # of panels; outerPad is padding added for arrows. 329 if (base.width * o.showMultiple !== w || base.height !== h) { 359 330 base.setDimensions(); // adjust panel sizes 360 331 // make sure page is lined up (use 1 millisecond animation time, because "0||x" ignores zeros) … … 367 338 // Set panel dimensions to either resize content or adjust panel to content 368 339 base.setDimensions = function(){ 369 var w, h, c, cw, dw,leftEdge = 0,370 // showMultiple must have o.width set!!371 bww = (o.showMultiple > 1) ? o.width || base.$window.width()/o.showMultiple : base.$window.width(),340 var w, h, c, leftEdge = 0, 341 // determine panel width 342 pw = (o.showMultiple > 1) ? base.width || base.$window.width()/o.showMultiple : base.$window.width(), 372 343 winw = base.$win.width(); 373 344 if (o.expand){ 374 345 w = base.$outer.width() - base.outerPad[0]; 375 h = base.$outer.height() - base.outerPad[1];346 base.height = h = base.$outer.height() - base.outerPad[1]; 376 347 base.$wrapper.add(base.$window).add(base.$items).css({ width: w, height: h }); 377 b ww = (o.showMultiple > 1) ? w/o.showMultiple : w;348 base.width = pw = (o.showMultiple > 1) ? w/o.showMultiple : w; 378 349 } 379 350 base.$items.each(function(i){ 380 c = $(this).children( '*');351 c = $(this).children(); 381 352 if (o.resizeContents){ 382 // get viewport width & height from options (if set), or css383 w = parseInt(o.width,10) || bww;384 h = parseInt(o.height,10) || base.$window.height();385 353 // resize panel 386 $(this).css({ width: w, height: h }); 354 w = base.width; 355 $(this).css({ width: w, height: base.height }); 356 if (c.length && c[0].tagName === "EMBED") { c.attr({ width: '100%', height: '100%' }); } // needed for IE7; also c.length > 1 in IE7 387 357 // resize panel contents, if solitary (wrapped content or solitary image) 388 358 if (c.length === 1){ 389 359 c.css({ width: '100%', height: '100%' }); 390 if (c[0].tagName === "OBJECT") { c.find('embed').andSelf().attr({ width: '100%', height: '100%' }); }391 360 } 392 361 } else { 393 362 // get panel width & height and save it 394 363 w = $(this).width(); // if not defined, it will return the width of the ul parent 395 dw = (w >= winw) ? true : false; // width defined from css? 396 if (c.length === 1 && dw){ 397 cw = (c.width() >= winw) ? bww : c.width(); // get width of solitary child 398 $(this).css('width', cw); // set width of panel 399 c.css('max-width', cw); // set max width for all children 400 w = cw; 364 if (c.length === 1 && w >= winw){ 365 w = (c.width() >= winw) ? pw : c.width(); // get width of solitary child 366 c.css('max-width', w); // set max width for all children 401 367 } 402 w = (dw) ? o.width || bww : w; 403 $(this).css('width', w); 368 $(this).css('width', w); // set width of panel 404 369 h = $(this).outerHeight(); // get height after setting width 405 370 $(this).css('height', h); … … 408 373 leftEdge += w; 409 374 }); 410 // Set total width of slider, but don't go beyond the set max overall width (limited by Opera)411 base.$el.css('width', (leftEdge < o.maxOverallWidth) ? leftEdge : o.maxOverallWidth);375 // Set total width of slider, Note that this is limited to 32766 by Opera - option removed 376 base.$el.css('width', leftEdge); 412 377 }; 413 378 414 379 // get dimension of multiple panels, as needed 415 380 base.getDim = function(page){ 381 if (base.pages < 1) { return; } // prevent errors when base.panelSize is empty 416 382 page = (o.infiniteSlides && base.pages > 1) ? page : page - 1; 417 383 var i, … … 427 393 }; 428 394 395 base.goForward = function(autoplay) { 396 base.gotoPage(base.currentPage + parseInt(o.changeBy, 10) * (o.playRtl ? -1 : 1), autoplay); 397 }; 398 399 base.goBack = function(autoplay) { 400 base.gotoPage(base.currentPage + parseInt(o.changeBy, 10) * (o.playRtl ? 1 : -1), autoplay); 401 }; 402 429 403 base.gotoPage = function(page, autoplay, callback, time) { 404 if (autoplay !== true) { 405 autoplay = false; 406 base.startStop(false); 407 base.makeActive(); 408 } 409 if (o.changeBy !== 1){ 410 if (page < 0) { page += base.pages; } 411 if (page > base.pages) { page -= base.pages; } 412 } 430 413 if (base.pages <= 1) { return; } // prevents animation 431 414 base.$lastPage = base.$currentPage; … … 436 419 437 420 // pause YouTube videos before scrolling or prevent change if playing 438 if ( base.hasEmb && base.checkVideo(base.playing)) { return; }439 440 if (page > base.pages + 1 - base.adj ustLimit) { page = (!o.infiniteSlides && !o.stopAtEnd) ? 1 : base.pages; }441 if (page < base.adj ustLimit) { page = (!o.infiniteSlides && !o.stopAtEnd) ? base.pages : 1; }421 if (autoplay && o.isVideoPlaying(base)) { return; } 422 423 if (page > base.pages + 1 - base.adj) { page = (!o.infiniteSlides && !o.stopAtEnd) ? 1 : base.pages; } 424 if (page < base.adj ) { page = (!o.infiniteSlides && !o.stopAtEnd) ? base.pages : 1; } 442 425 base.currentPage = ( page > base.pages ) ? base.pages : ( page < 1 ) ? 1 : base.currentPage; 443 base.$currentPage = base.$items.eq(base.currentPage - base.adj ustLimit);426 base.$currentPage = base.$items.eq(base.currentPage - base.adj); 444 427 base.exactPage = page; 445 base.$targetPage = base.$items.eq( (page === 0) ? base.pages - base.adj ustLimit : (page > base.pages) ? 1 - base.adjustLimit : page - base.adjustLimit);428 base.$targetPage = base.$items.eq( (page === 0) ? base.pages - base.adj : (page > base.pages) ? 1 - base.adj : page - base.adj ); 446 429 base.$el.trigger('slide_init', base); 447 430 … … 484 467 base.setCurrentPage(page, false); 485 468 // Add active panel class 486 base.$items.removeClass('activePage').eq(page - base.adj ustLimit).addClass('activePage');469 base.$items.removeClass('activePage').eq(page - base.adj).addClass('activePage'); 487 470 488 471 if (!base.hovered) { base.slideControls(false); } 489 490 // continue YouTube video if in current panel491 if (base.hasEmb){492 var emb = base.$currentPage.find('object[id*=ytvideo], embed[id*=ytvideo]');493 // player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).494 if (emb.length && $.isFunction(emb[0].getPlayerState) && emb[0].getPlayerState() > 0 && emb[0].getPlayerState() !== 5) {495 emb[0].playVideo();496 }497 }498 472 499 473 base.$el.trigger('slide_complete', base); 500 474 // callback from external slide control: $('#slider').anythingSlider(4, function(slider){ }) 501 475 if (typeof callback === 'function') { callback(base); } 476 502 477 // Continue slideshow after a delay 503 478 if (o.autoPlayLocked && !base.playing) { … … 510 485 511 486 base.setCurrentPage = function(page, move) { 487 if (base.pages < 1 || page === 0) { return; } 512 488 page = parseInt(page, 10); 513 if (page > base.pages + 1 - base.adj ustLimit) { page = base.pages - base.adjustLimit; }514 if (page < base.adj ustLimit) { page = 1; }489 if (page > base.pages + 1 - base.adj) { page = base.pages - base.adj; } 490 if (page < base.adj ) { page = 1; } 515 491 516 492 // Set visual 517 493 if (o.buildNavigation){ 518 base.$nav.find('.cur').removeClass('cur'); 519 base.$nav.find('a').eq(page - 1).addClass('cur'); 494 base.$nav 495 .find('.cur').removeClass('cur').end() 496 .find('a').eq(page - 1).addClass('cur'); 520 497 } 521 498 522 499 // hide/show arrows based on infinite scroll mode 523 500 if (!o.infiniteSlides && o.stopAtEnd){ 524 base.$wrapper.find('span.forward')[ page === base.pages ? 'addClass' : 'removeClass']('disabled'); 525 base.$wrapper.find('span.back')[ page === 1 ? 'addClass' : 'removeClass']('disabled'); 501 base.$wrapper 502 .find('span.forward')[ page === base.pages ? 'addClass' : 'removeClass']('disabled').end() 503 .find('span.back')[ page === 1 ? 'addClass' : 'removeClass']('disabled'); 526 504 if (page === base.pages && base.playing) { base.startStop(); } 527 505 } … … 530 508 if (!move) { 531 509 var d = base.getDim(page); 532 base.$wrapper.css({ width: d[0], height: d[1] }); 533 base.$wrapper.scrollLeft(0); // reset in case tabbing changed this scrollLeft 510 base.$wrapper 511 .css({ width: d[0], height: d[1] }) 512 .add(base.$window).scrollLeft(0); // reset in case tabbing changed this scrollLeft - probably overly redundant 534 513 base.$el.css('left', -base.panelSize[(o.infiniteSlides && base.pages > 1) ? page : page - 1][2] ); 535 514 } 536 515 // Update local variable 537 516 base.currentPage = page; 538 base.$currentPage = base.$items.eq(page - base.adjustLimit).addClass('activePage'); 539 517 base.$currentPage = base.$items.removeClass('activePage').eq(page - base.adj).addClass('activePage'); 518 519 }; 520 521 base.makeActive = function(){ 540 522 // Set current slider as active so keyboard navigation works properly 541 523 if (!base.$wrapper.is('.activeSlider')){ … … 543 525 base.$wrapper.addClass('activeSlider'); 544 526 } 545 };546 547 base.goForward = function(autoplay) {548 if (autoplay !== true) { autoplay = false; base.startStop(false); }549 base.gotoPage(base.currentPage + 1, autoplay);550 };551 552 base.goBack = function(autoplay) {553 if (autoplay !== true) { autoplay = false; base.startStop(false); }554 base.gotoPage(base.currentPage - 1, autoplay);555 527 }; 556 528 … … 576 548 t1 = (toggle) ? 0 : o.animationTime, 577 549 t2 = (toggle) ? o.animationTime: 0, 578 op = (toggle) ? 1 : 0,550 op = (toggle) ? 1 : 0, 579 551 sign = (toggle) ? 0 : 1; // 0 = visible, 1 = hidden 580 552 if (o.toggleControls) { … … 613 585 614 586 // Toggle playing and text 615 if (o. autoPlay) {587 if (o.buildStartStop) { 616 588 base.$startStop.toggleClass('playing', playing).html('<span>' + (playing ? o.stopText : o.startText) + '</span>'); 617 589 // add button text to title attribute if it is hidden by text-indent … … 621 593 } 622 594 623 if (playing){ 595 // Pause slideshow while video is playing 596 if (playing && o.resumeOnVideoEnd){ 624 597 base.clearTimer(true); // Just in case this was triggered twice in a row 625 598 base.timer = base.win.setInterval(function() { 626 599 // prevent autoplay if video is playing 627 if (!(base.hasEmb && base.checkVideo(playing))) { 628 if (o.playRtl) { 629 base.goBack(true); 630 } else { 631 base.goForward(true); 632 } 600 if ( !o.isVideoPlaying(base) ) { 601 base.goForward(true); 633 602 } 634 603 }, o.delay); … … 638 607 }; 639 608 640 base.checkVideo = function(playing){641 // pause YouTube videos before scrolling?642 var emb, ps, stopAdvance = false;643 base.$items.find('object[id*=ytvideo], embed[id*=ytvideo]').each(function(){ // include embed for IE; if not using SWFObject, old detach/append code needs "object embed" here644 emb = $(this);645 if (emb.length && $.isFunction(emb[0].getPlayerState)) {646 // player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).647 ps = emb[0].getPlayerState();648 // if autoplay, video playing, video is in current panel and resume option are true, then don't advance649 if (playing && (ps === 1 || ps > 2) && base.$items.index(emb.closest('.panel')) === base.currentPage && o.resumeOnVideoEnd) {650 stopAdvance = true;651 } else {652 // pause video if not autoplaying (if already initialized)653 if (ps > 0) { emb[0].pauseVideo(); }654 }655 }656 });657 return stopAdvance;658 };659 660 609 // Trigger the initialization 661 610 base.init(); … … 663 612 664 613 $.anythingSlider.defaults = { 665 // Appearance 666 width : null, // Override the default CSS width 667 height : null, // Override the default CSS height 614 // ** Appearance ** 615 theme : "default", // Theme name, add the css stylesheet manually 668 616 expand : false, // If true, the entire slider will expand to fit the parent element 669 617 resizeContents : true, // If true, solitary images/objects in the panel will expand to fit the viewport 670 618 showMultiple : false, // Set this value to a number and it will show that many slides at once 671 tooltipClass : 'tooltip', // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent) 672 theme : 'default', // Theme name 619 easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin or jQuery UI 620 621 buildArrows : true, // If true, builds the forwards and backwards buttons 622 buildNavigation : true, // If true, builds a list of anchor links to link to each panel 623 buildStartStop : true, // ** If true, builds the start/stop button 624 625 appendFowardTo : null, // Append forward arrow to a HTML element (jQuery Object, selector or HTMLNode), if not null 626 appendBackTo : null, // Append back arrow to a HTML element (jQuery Object, selector or HTMLNode), if not null 627 appendControlsTo : null, // Append controls (navigation + start-stop) to a HTML element (jQuery Object, selector or HTMLNode), if not null 628 appendNavigationTo : null, // Append navigation buttons to a HTML element (jQuery Object, selector or HTMLNode), if not null 629 appendStartStopTo : null, // Append start-stop button to a HTML element (jQuery Object, selector or HTMLNode), if not null 630 631 toggleArrows : false, // If true, side navigation arrows will slide out on hovering & hide @ other times 632 toggleControls : false, // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times 633 634 startText : "Start", // Start button text 635 stopText : "Stop", // Stop button text 636 forwardText : "»", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image) 637 backText : "«", // Link text used to move the slider back (hidden by CSS, replace with arrow image) 638 tooltipClass : "tooltip", // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent) 639 640 // Function 641 enableArrows : true, // if false, arrows will be visible, but not clickable. 642 enableNavigation : true, // if false, navigation links will still be visible, but not clickable. 643 enableStartStop : true, // if false, the play/stop button will still be visible, but not clickable. Previously "enablePlay" 644 enableKeyboard : true, // if false, keyboard arrow keys will not work for this slider. 673 645 674 646 // Navigation 675 647 startPanel : 1, // This sets the initial panel 648 changeBy : 1, // Amount to go forward or back when changing panels. 676 649 hashTags : true, // Should links change the hashtag in the URL? 677 infiniteSlides : true, // if false, the slider will not wrap 678 enableKeyboard : true, // if false, keyboard arrow keys will not work for the current panel. 679 buildArrows : true, // If true, builds the forwards and backwards buttons 680 toggleArrows : false, // If true, side navigation arrows will slide out on hovering & hide @ other times 681 buildNavigation : true, // If true, builds a list of anchor links to link to each panel 682 enableNavigation : true, // if false, navigation links will still be visible, but not clickable. 683 toggleControls : false, // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times 684 appendControlsTo : null, // A HTML element (jQuery Object, selector or HTMLNode) to which the controls will be appended if not null 650 infiniteSlides : true, // if false, the slider will not wrap & not clone any panels 685 651 navigationFormatter : null, // Details at the top of the file on this use (advanced use) 686 forwardText : "»", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image)687 backText : "«", // Link text used to move the slider back (hidden by CSS, replace with arrow image)688 652 689 653 // Slideshow options 690 enablePlay : true, // if false, the play/stop button will still be visible, but not clickable. 691 autoPlay : true, // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not 654 autoPlay : false, // If true, the slideshow will start running; replaces "startStopped" option 692 655 autoPlayLocked : false, // If true, user changing slides will not stop the slideshow 693 startStopped : false, // If autoPlay is on, this can force it to start stopped656 autoPlayDelayed : false, // If true, starting a slideshow will delay advancing slides; if false, the slider will immediately advance to the next slide when slideshow starts 694 657 pauseOnHover : true, // If true & the slideshow is active, the slideshow will pause on hover 695 resumeOnVideoEnd : true, // If true & the slideshow is active & a youtube video is playing, it will pause the autoplay until the video is complete696 658 stopAtEnd : false, // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false. 697 659 playRtl : false, // If true, the slideshow will move right-to-left 698 startText : "Start", // Start button text 699 stopText : "Stop", // Stop button text660 661 // Times 700 662 delay : 3000, // How long between slideshow transitions in AutoPlay mode (in milliseconds) 701 663 resumeDelay : 15000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds). 702 664 animationTime : 600, // How long the slideshow transition takes (in milliseconds) 703 easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin704 665 705 666 // Callbacks - removed from options to reduce size - they still work 706 667 707 668 // Interactivity 708 clickArrows : "click", // Event used to activate arrow functionality (e.g. "click" or "mouseenter") 669 clickForwardArrow : "click", // Event used to activate forward arrow functionality (e.g. add jQuery mobile's "swiperight") 670 clickBackArrow : "click", // Event used to activate back arrow functionality (e.g. add jQuery mobile's "swipeleft") 709 671 clickControls : "click focusin", // Events used to activate navigation control functionality 710 672 clickSlideshow : "click", // Event used to activate slideshow play/stop button 711 673 712 // Misc options 713 addWmodeToObject : "opaque", // If your slider has an embedded object, the script will automatically add a wmode parameter with this setting 714 maxOverallWidth : 32766 // Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera 674 // Video 675 resumeOnVideoEnd : true, // If true & the slideshow is active & a supported video is playing, it will pause the autoplay until the video is complete 676 addWmodeToObject : "opaque", // If your slider has an embedded object, the script will automatically add a wmode parameter with this setting 677 isVideoPlaying : function(base){ return false; } // return true if video is playing or false if not - used by video extension 678 715 679 }; 716 680 -
anythingslider-for-wordpress/trunk/js/jquery.anythingslider.min.js
r397633 r405807 1 1 /* 2 AnythingSlider v1.5.21 minified using Google Closure Compiler 3 By Chris Coyier: http://css-tricks.com 4 with major improvements by Doug Neiner: http://pixelgraphics.us/ 5 based on work by Remy Sharp: http://jqueryfordesigners.com/ 2 AnythingSlider v1.7.1 minified using Google Closure Compiler 3 Original by Chris Coyier: http://css-tricks.com 4 Get the latest version: https://github.com/ProLoser/AnythingSlider 6 5 */ 7 6 8 (function(d){d.anythingSlider=function(i,j){var a=this,b;a.$el=d(i).addClass("anythingBase").wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');a.$el.data("AnythingSlider",a);a.init=function(){a.options=b=d.extend({},d.anythingSlider.defaults,j);a.initialized=!1;d.isFunction(b.onBeforeInitialize)&&a.$el.bind("before_initialize",b.onBeforeInitialize);a.$el.trigger("before_initialize",a);a.$wrapper=a.$el.parent().closest("div.anythingSlider").addClass("anythingSlider-"+b.theme); a.$window=a.$el.closest("div.anythingWindow");a. $controls=d('<div class="anythingControls"></div>').appendTo(b.appendControlsTo!==null&&d(b.appendControlsTo).length?d(b.appendControlsTo):a.$wrapper);a.win=window;a.$win=d(a.win);a.$nav=d('<ul class="thumbNav" />').appendTo(a.$controls);a.flag=!1;a.playing=!1;a.slideshow=!1;a.hovered=!1;a.panelSize=[];a.currentPage=b.startPanel=parseInt(b.startPanel,10)||1;a.adjustLimit=b.infiniteSlides?0:1;a.outerPad=[a.$wrapper.innerWidth()-a.$wrapper.width(),a.$wrapper.innerHeight()- a.$wrapper.height()];b.playRtl&&a.$wrapper.addClass("rtl");a.original=[b.autoPlay,b.buildNavigation,b.buildArrows];if(b.expand)a.$outer=a.$wrapper.parent(),a.$window.css({width:"100%",height:"100%"}),a.outerDim=[a.$outer.width(),a.$outer.height()],a.checkResize();a.updateSlider();a.$lastPage=a.$currentPage;a.runTimes=d("div.anythingSlider").index(a.$wrapper)+1;a.regex=RegExp("panel"+a.runTimes+"-(\\d+)","i");if(!d.isFunction(d.easing[b.easing]))b.easing="swing";b.pauseOnHover&&a.$wrapper.hover(function(){a.playing&& (a.$el.trigger("slideshow_paused",a),a.clearTimer(!0))},function(){a.playing&&(a.$el.trigger("slideshow_unpaused",a),a.startStop(a.playing,!0))});var c,e=b.hashTags?a.gotoHash()||b.startPanel:b.startPanel;a.setCurrentPage(e,!1);a.slideControls(!1);a.$wrapper.bind("mouseenter mouseleave",function(b){a.hovered=b.type==="mouseenter"?!0:!1;a.slideControls(a.hovered,!1)});b.enableKeyboard&&d(document).keyup(function(b){if(a.$wrapper.is(".activeSlider")&&!b.target.tagName.match("TEXTAREA|INPUT|SELECT"))switch(b.which){case 39:a.goForward(); break;case 37:a.goBack()}});c="slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" ");d.each("onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "),function(b,e){d.isFunction(a.options[e])&&a.$el.bind(c[b],a.options[e])});d.isFunction(b.onSlideComplete)&&a.$el.bind("slide_complete",function(){setTimeout(function(){b.onSlideComplete(a)},0)});a.initialized=!0;a.$el.trigger("initialized", a)};a.updateSlider=function(){a.$el.children(".cloned").remove();a.$nav.empty();a.$items=a.$el.children();a.pages=a.$items.length;b.showMultiple=parseInt(b.showMultiple,10)||1;if(b.showMultiple>1){if(b.showMultiple>a.pages)b.showMultiple=a.pages;a.adjustMultiple=b.infiniteSlides&&a.pages>1?0:parseInt(b.showMultiple,10)-1;a.pages=a.$items.length-a.adjustMultiple}if(a.pages<=1)b.autoPlay=!1,b.buildNavigation=!1,b.buildArrows=!1,a.$controls.hide(),a.$nav.hide(),a.$forward&&a.$forward.add(a.$back).hide(); else{b.autoPlay=a.original[0];b.buildNavigation=a.original[1];b.buildArrows=a.original[2];a.$controls.show();a.$nav.show();a.$forward&&a.$forward.add(a.$back).show();a.buildNavigation();if(b.autoPlay)a.playing=!b.startStopped,a.buildAutoPlay();b.buildArrows&&a.buildNextBackButtons()}b.infiniteSlides&&a.pages>1&&(a.$el.prepend(a.$items.filter(":last").clone().addClass("cloned").removeAttr("id")),b.showMultiple>1?a.$el.append(a.$items.filter(":lt("+b.showMultiple+")").clone().addClass("cloned").addClass("multiple").removeAttr("id")): a.$el.append(a.$items.filter(":first").clone().addClass("cloned").removeAttr("id")),a.$el.find(".cloned").each(function(){d(this).find("a,input,textarea,select").attr("disabled","disabled");d(this).find("[id]").removeAttr("id")}));a.$items=a.$el.children().addClass("panel");a.setDimensions();b.resizeContents?(b.width&&(a.$items.css("width",b.width),a.$wrapper.css("width",a.getDim(a.currentPage)[0])),b.height&&a.$wrapper.add(a.$items).css("height",b.height)):a.$win.load(function(){a.setDimensions()}); if(a.currentPage>a.pages)a.currentPage=a.pages;a.setCurrentPage(a.currentPage,!1);a.$nav.find("a").eq(a.currentPage-1).addClass("cur");a.hasEmb=a.$items.find("embed[src*=youtube]").length;a.hasSwfo=typeof swfobject!=="undefined"&&swfobject.hasOwnProperty("embedSWF")&&d.isFunction(swfobject.embedSWF)?!0:!1;a.hasEmb&&a.hasSwfo&&a.$items.find("embed[src*=youtube]").each(function(c){var e=d(this).parent()[0].tagName==="OBJECT"?d(this).parent():d(this);e.wrap('<div id="ytvideo'+c+'"></div>');swfobject.embedSWF(d(this).attr("src")+ "&enablejsapi=1&version=3&playerapiid=ytvideo"+c,"ytvideo"+c,e.attr("width"),e.attr("height"),"10",null,null,{allowScriptAccess:"always",wmode:b.addWmodeToObject,allowfullscreen:!0},{"class":e.attr("class"),style:e.attr("style")},function(){c>=a.hasEmb-1&&a.$el.trigger("swf_completed",a)})});b.showMultiple===!1&&a.$items.find("a").unbind("focus").bind("focus",function(b){a.$items.find(".focusedLink").removeClass("focusedLink");d(this).addClass("focusedLink");var e=d(this).closest(".panel");e.is(".activePage")|| (a.gotoPage(a.$items.index(e)),b.preventDefault())})};a.buildNavigation=function(){var c,e,f;b.buildNavigation&&a.pages>1&&a.$items.filter(":not(.cloned)").each(function(g){var h=g+1;e=(h===1?"first":"")+(h===a.pages?"last":"");f=d('<a href="#"></a>').addClass("panel"+h).wrap('<li class="'+e+'" />');a.$nav.append(f.parent());d.isFunction(b.navigationFormatter)?(c=b.navigationFormatter(h,d(this)),f.html("<span>"+c+"</span>"),parseInt(f.find("span").css("text-indent"),10)<0&&f.addClass(b.tooltipClass).attr("title", c)):f.html("<span>"+h+"</span>");f.bind(b.clickControls,function(c){if(!a.flag&&b.enableNavigation)a.flag=!0,setTimeout(function(){a.flag=!1},100),a.gotoPage(h),b.hashTags&&a.setHash(h);c.preventDefault()})})};a.buildNextBackButtons=function(){if(!a.$forward)a.$forward=d('<span class="arrow forward"><a href="#"><span>'+b.forwardText+"</span></a></span>"),a.$back=d('<span class="arrow back"><a href="#"><span>'+b.backText+"</span></a></span>"),a.$back.bind(b.clickArrows,function(b){a.goBack();b.preventDefault()}), a.$forward.bind(b.clickArrows,function(b){a.goForward();b.preventDefault()}),a.$back.add(a.$forward).find("a").bind("focusin focusout",function(){d(this).toggleClass("hover")}),a.$wrapper.prepend(a.$forward).prepend(a.$back),a.$arrowWidth=a.$forward.width()};a.buildAutoPlay=function(){if(!(a.$startStop||a.pages<2))a.$startStop=d("<a href='#' class='start-stop'></a>").html("<span>"+(a.playing?b.stopText:b.startText)+"</span>"),a.$controls.prepend(a.$startStop),a.$startStop.bind(b.clickSlideshow,function(c){b.enablePlay&& (a.startStop(!a.playing),a.playing&&(b.playRtl?a.goBack(!0):a.goForward(!0)));c.preventDefault()}).bind("focusin focusout",function(){d(this).toggleClass("hover")}),a.startStop(a.playing)};a.checkResize=function(b){clearTimeout(a.resizeTimer);a.resizeTimer=setTimeout(function(){var e=a.$outer.width(),d=a.$outer[0].tagName==="BODY"?a.$win.height():a.$outer.height(),g=a.outerDim;if(g[0]!==e||g[1]!==d)a.outerDim=[e,d],a.setDimensions(),a.gotoPage(a.currentPage,a.playing,null,1);typeof b==="undefined"&& a.checkResize()},500)};a.setDimensions=function(){var c,e,f,g,h,i=0,k=b.showMultiple>1?b.width||a.$window.width()/b.showMultiple:a.$window.width(),j=a.$win.width();b.expand&&(c=a.$outer.width()-a.outerPad[0],e=a.$outer.height()-a.outerPad[1],a.$wrapper.add(a.$window).add(a.$items).css({width:c,height:e}),k=b.showMultiple>1?c/b.showMultiple:c);a.$items.each(function(l){f=d(this).children("*");b.resizeContents?(c=parseInt(b.width,10)||k,e=parseInt(b.height,10)||a.$window.height(),d(this).css({width:c, height:e}),f.length===1&&(f.css({width:"100%",height:"100%"}),f[0].tagName==="OBJECT"&&f.find("embed").andSelf().attr({width:"100%",height:"100%"}))):(c=d(this).width(),h=c>=j?!0:!1,f.length===1&&h&&(g=f.width()>=j?k:f.width(),d(this).css("width",g),f.css("max-width",g),c=g),c=h?b.width||k:c,d(this).css("width",c),e=d(this).outerHeight(),d(this).css("height",e));a.panelSize[l]=[c,e,i];i+=c});a.$el.css("width",i<b.maxOverallWidth?i:b.maxOverallWidth)};a.getDim=function(c){var c=b.infiniteSlides&&a.pages> 1?c:c-1,e,d=a.panelSize[c][0],g=a.panelSize[c][1];if(b.showMultiple>1)for(e=1;e<b.showMultiple;e++)d+=a.panelSize[(c+e)%b.showMultiple][0],g=Math.max(g,a.panelSize[c+e][1]);return[d,g]};a.gotoPage=function(c,e,d,g){if(!(a.pages<=1)){a.$lastPage=a.$currentPage;if(typeof c!=="number")c=b.startPanel,a.setCurrentPage(c);if(!a.hasEmb||!a.checkVideo(a.playing))c>a.pages+1-a.adjustLimit&&(c=!b.infiniteSlides&&!b.stopAtEnd?1:a.pages),c<a.adjustLimit&&(c=!b.infiniteSlides&&!b.stopAtEnd?a.pages:1),a.currentPage= c>a.pages?a.pages:c<1?1:a.currentPage,a.$currentPage=a.$items.eq(a.currentPage-a.adjustLimit),a.exactPage=c,a.$targetPage=a.$items.eq(c===0?a.pages-a.adjustLimit:c>a.pages?1-a.adjustLimit:c-a.adjustLimit),a.$el.trigger("slide_init",a),a.slideControls(!0,!1),e!==!0&&(e=!1),(!e||b.stopAtEnd&&c===a.pages)&&a.startStop(!1),a.$el.trigger("slide_begin",a),b.resizeContents||(e=a.getDim(c),a.$wrapper.filter(":not(:animated)").animate({width:e[0],height:e[1]},{queue:!1,duration:g||b.animationTime,easing:b.easing})), a.$el.filter(":not(:animated)").animate({left:-a.panelSize[b.infiniteSlides&&a.pages>1?c:c-1][2]},{queue:!1,duration:g||b.animationTime,easing:b.easing,complete:function(){a.endAnimation(c,d)}})}};a.endAnimation=function(c,e){c===0?(a.$el.css("left",-a.panelSize[a.pages][2]),c=a.pages):c>a.pages&&(a.$el.css("left",-a.panelSize[1][2]),c=1);a.exactPage=c;a.setCurrentPage(c,!1);a.$items.removeClass("activePage").eq(c-a.adjustLimit).addClass("activePage");a.hovered||a.slideControls(!1);if(a.hasEmb){var f= a.$currentPage.find("object[id*=ytvideo], embed[id*=ytvideo]");f.length&&d.isFunction(f[0].getPlayerState)&&f[0].getPlayerState()>0&&f[0].getPlayerState()!==5&&f[0].playVideo()}a.$el.trigger("slide_complete",a);typeof e==="function"&&e(a);b.autoPlayLocked&&!a.playing&&setTimeout(function(){a.startStop(!0)},b.resumeDelay-b.delay)};a.setCurrentPage=function(c,e){c=parseInt(c,10);c>a.pages+1-a.adjustLimit&&(c=a.pages-a.adjustLimit);c<a.adjustLimit&&(c=1);b.buildNavigation&&(a.$nav.find(".cur").removeClass("cur"), a.$nav.find("a").eq(c-1).addClass("cur"));!b.infiniteSlides&&b.stopAtEnd&&(a.$wrapper.find("span.forward")[c===a.pages?"addClass":"removeClass"]("disabled"),a.$wrapper.find("span.back")[c===1?"addClass":"removeClass"]("disabled"),c===a.pages&&a.playing&&a.startStop());if(!e){var f=a.getDim(c);a.$wrapper.css({width:f[0],height:f[1]});a.$wrapper.scrollLeft(0);a.$el.css("left",-a.panelSize[b.infiniteSlides&&a.pages>1?c:c-1][2])}a.currentPage=c;a.$currentPage=a.$items.eq(c-a.adjustLimit).addClass("activePage"); a.$wrapper.is(".activeSlider")||(d(".activeSlider").removeClass("activeSlider"),a.$wrapper.addClass("activeSlider"))};a.goForward=function(b){b!==!0&&(b=!1,a.startStop(!1));a.gotoPage(a.currentPage+1,b)};a.goBack=function(b){b!==!0&&(b=!1,a.startStop(!1));a.gotoPage(a.currentPage-1,b)};a.gotoHash=function(){var b=a.win.location.hash.match(a.regex);return b===null?"":parseInt(b[1],10)};a.setHash=function(b){var e="panel"+a.runTimes+"-",d=a.win.location.hash;if(typeof d!=="undefined")a.win.location.hash= d.indexOf(e)>0?d.replace(a.regex,e+b):d+"&"+e+b};a.slideControls=function(c){var d=c?0:b.animationTime,f=c?b.animationTime:0,g=c?1:0,h=c?0:1;b.toggleControls&&a.$controls.stop(!0,!0).delay(d)[c?"slideDown":"slideUp"](b.animationTime/2).delay(f);b.buildArrows&&b.toggleArrows&&(!a.hovered&&a.playing&&(h=1,g=0),a.$forward.stop(!0,!0).delay(d).animate({right:h*a.$arrowWidth,opacity:g},b.animationTime/2),a.$back.stop(!0,!0).delay(d).animate({left:h*a.$arrowWidth,opacity:g},b.animationTime/2))};a.clearTimer= function(b){if(a.timer&&(a.win.clearInterval(a.timer),!b&&a.slideshow))a.$el.trigger("slideshow_stop",a),a.slideshow=!1};a.startStop=function(c,d){c!==!0&&(c=!1);if(c&&!d)a.$el.trigger("slideshow_start",a),a.slideshow=!0;a.playing=c;b.autoPlay&&(a.$startStop.toggleClass("playing",c).html("<span>"+(c?b.stopText:b.startText)+"</span>"),parseInt(a.$startStop.find("span").css("text-indent"),10)<0&&a.$startStop.addClass(b.tooltipClass).attr("title",c?"Stop":"Start"));c?(a.clearTimer(!0),a.timer=a.win.setInterval(function(){if(!a.hasEmb|| !a.checkVideo(c))b.playRtl?a.goBack(!0):a.goForward(!0)},b.delay)):a.clearTimer()};a.checkVideo=function(c){var e,f,g=!1;a.$items.find("object[id*=ytvideo], embed[id*=ytvideo]").each(function(){e=d(this);e.length&&d.isFunction(e[0].getPlayerState)&&(f=e[0].getPlayerState(),c&&(f===1||f>2)&&a.$items.index(e.closest(".panel"))===a.currentPage&&b.resumeOnVideoEnd?g=!0:f>0&&e[0].pauseVideo())});return g};a.init()};d.anythingSlider.defaults={width:null,height:null,expand:!1,resizeContents:!0,showMultiple:!1, tooltipClass:"tooltip",theme:"default",startPanel:1,hashTags:!0,infiniteSlides:!0,enableKeyboard:!0,buildArrows:!0,toggleArrows:!1,buildNavigation:!0,enableNavigation:!0,toggleControls:!1,appendControlsTo:null,navigationFormatter:null,forwardText:"»",backText:"«",enablePlay:!0,autoPlay:!0,autoPlayLocked:!1,startStopped:!1,pauseOnHover:!0,resumeOnVideoEnd:!0,stopAtEnd:!1,playRtl:!1,startText:"Start",stopText:"Stop",delay:3E3,resumeDelay:15E3,animationTime:600,easing:"swing",clickArrows:"click", clickControls:"click focusin",clickSlideshow:"click",addWmodeToObject:"opaque",maxOverallWidth:32766};d.fn.anythingSlider=function(i,j){return this.each(function(){var a,b=d(this).data("AnythingSlider");(typeof i).match("object|undefined")?b?b.updateSlider():new d.anythingSlider(this,i):/\d/.test(i)&&!isNaN(i)&&b&&(a=typeof i==="number"?i:parseInt(d.trim(i),10),a>=1&&a<=b.pages&&b.gotoPage(a,!1,j))})}})(jQuery);7 (function(d){d.anythingSlider=function(i,j){var a=this,b;a.$el=d(i).addClass("anythingBase").wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');a.$el.data("AnythingSlider",a);a.init=function(){a.options=b=d.extend({},d.anythingSlider.defaults,j);a.initialized=!1;d.isFunction(b.onBeforeInitialize)&&a.$el.bind("before_initialize",b.onBeforeInitialize);a.$el.trigger("before_initialize",a);a.$wrapper=a.$el.parent().closest("div.anythingSlider").addClass("anythingSlider-"+b.theme); a.$window=a.$el.closest("div.anythingWindow");a.win=window;a.$win=d(a.win);a.$controls=d('<div class="anythingControls"></div>').appendTo(b.appendControlsTo!==null&&d(b.appendControlsTo).length?d(b.appendControlsTo):a.$wrapper);a.$startStop=d('<a href="#" class="start-stop"></a>');b.buildStartStop&&a.$startStop.appendTo(b.appendStartStopTo!==null&&d(b.appendStartStopTo).length?d(b.appendStartStopTo):a.$controls);a.$nav=d('<ul class="thumbNav" />').appendTo(b.appendNavigationTo!==null&&d(b.appendNavigationTo).length? d(b.appendNavigationTo):a.$controls);a.flag=!1;a.playing=!1;a.slideshow=!1;a.hovered=!1;a.panelSize=[];a.currentPage=b.startPanel=parseInt(b.startPanel,10)||1;a.adj=b.infiniteSlides?0:1;a.width=a.$el.width();a.height=a.$el.height();a.outerPad=[a.$wrapper.innerWidth()-a.$wrapper.width(),a.$wrapper.innerHeight()-a.$wrapper.height()];b.playRtl&&a.$wrapper.addClass("rtl");if(b.expand)a.$outer=a.$wrapper.parent(),a.$window.css({width:"100%",height:"100%"}),a.checkResize();b.buildStartStop?(a.playing=b.autoPlay, a.buildAutoPlay()):b.autoPlayLocked=!1;b.buildArrows&&a.buildNextBackButtons();a.updateSlider();a.$lastPage=a.$currentPage;a.runTimes=d("div.anythingSlider").index(a.$wrapper)+1;a.regex=RegExp("panel"+a.runTimes+"-(\\d+)","i");if(!d.isFunction(d.easing[b.easing]))b.easing="swing";b.pauseOnHover&&a.$wrapper.hover(function(){a.playing&&(a.$el.trigger("slideshow_paused",a),a.clearTimer(!0))},function(){a.playing&&(a.$el.trigger("slideshow_unpaused",a),a.startStop(a.playing,!0))});var c,f=b.hashTags? a.gotoHash()||b.startPanel:b.startPanel;a.setCurrentPage(f,!1);a.slideControls(!1);a.$wrapper.bind("mouseenter mouseleave",function(b){a.hovered=b.type==="mouseenter"?!0:!1;a.slideControls(a.hovered,!1)});d(document).keyup(function(c){var f;f=a.$wrapper.is(".activeSlider")&&!c.target.tagName.match("TEXTAREA|INPUT|SELECT");switch(c.which){case 9:c=d(":focus");f=c.closest(".anythingSlider");f[0]===a.$wrapper[0]&&(a.makeActive(),a.$window.scrollLeft(0),a.gotoPage(c.closest(".panel").index()+a.adj)); break;case 39:f&&b.enableKeyboard&&a.goForward();break;case 37:f&&b.enableKeyboard&&a.goBack()}});c="slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" ");d.each("onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "),function(f,g){d.isFunction(b[g])&&a.$el.bind(c[f],b[g])});d.isFunction(b.onSlideComplete)&&a.$el.bind("slide_complete",function(){setTimeout(function(){b.onSlideComplete(a)}, 0)});a.initialized=!0;a.$el.trigger("initialized",a);a.startStop(a.playing)};a.updateSlider=function(){a.$el.children(".cloned").remove();a.$nav.empty();a.currentPage=a.currentPage||1;a.$items=a.$el.children();a.pages=a.$items.length;b.showMultiple=parseInt(b.showMultiple,10)||1;if(b.showMultiple>1){if(b.showMultiple>a.pages)b.showMultiple=a.pages;a.adjustMultiple=b.infiniteSlides&&a.pages>1?0:b.showMultiple-1;a.pages=a.$items.length-a.adjustMultiple}a.$controls.add(a.$nav).add(a.$startStop).add(a.$forward).add(a.$back)[a.pages<= 1?"hide":"show"]();a.pages>1&&a.buildNavigation();b.infiniteSlides&&a.pages>1&&(a.$el.prepend(a.$items.filter(":last").clone().addClass("cloned").removeAttr("id")),b.showMultiple>1?a.$el.append(a.$items.filter(":lt("+b.showMultiple+")").clone().addClass("cloned").addClass("multiple").removeAttr("id")):a.$el.append(a.$items.filter(":first").clone().addClass("cloned").removeAttr("id")),a.$el.find(".cloned").each(function(){d(this).find("a,input,textarea,select,button,area").attr("disabled","disabled"); d(this).find("[id]").removeAttr("id")}));a.$items=a.$el.children().addClass("panel");a.setDimensions();b.resizeContents&&a.pages>1?(a.$items.css("width",a.width),a.$wrapper.css("width",a.getDim(a.currentPage)[0]),a.$wrapper.add(a.$items).css("height",a.height)):a.$win.load(function(){a.setDimensions()});if(a.currentPage>a.pages)a.currentPage=a.pages;a.setCurrentPage(a.currentPage,!1);a.$nav.find("a").eq(a.currentPage-1).addClass("cur")};a.buildNavigation=function(){if(b.buildNavigation&&a.pages>1){var c, f,e;a.$items.filter(":not(.cloned)").each(function(g){var h=g+1;f=(h===1?"first":"")+(h===a.pages?"last":"");e=d('<a href="#"></a>').addClass("panel"+h).wrap('<li class="'+f+'" />');a.$nav.append(e.parent());d.isFunction(b.navigationFormatter)?(c=b.navigationFormatter(h,d(this)),e.html("<span>"+c+"</span>"),parseInt(e.find("span").css("text-indent"),10)<0&&e.addClass(b.tooltipClass).attr("title",c)):e.html("<span>"+h+"</span>");e.bind(b.clickControls,function(c){if(!a.flag&&b.enableNavigation)a.flag= !0,setTimeout(function(){a.flag=!1},100),a.gotoPage(h),b.hashTags&&a.setHash(h);c.preventDefault()})})}};a.buildNextBackButtons=function(){a.$forward=d('<span class="arrow forward"><a href="#"><span>'+b.forwardText+"</span></a></span>");a.$back=d('<span class="arrow back"><a href="#"><span>'+b.backText+"</span></a></span>");a.$back.bind(b.clickBackArrow,function(c){if(b.enableArrows&&!a.flag)a.flag=!0,setTimeout(function(){a.flag=!1},100),a.goBack();c.preventDefault()});a.$forward.bind(b.clickForwardArrow, function(c){if(b.enableArrows&&!a.flag)a.flag=!0,setTimeout(function(){a.flag=!1},100),a.goForward();c.preventDefault()});a.$back.add(a.$forward).find("a").bind("focusin focusout",function(){d(this).toggleClass("hover")});a.$forward.appendTo(b.appendFowardTo!==null&&d(b.appendFowardTo).length?d(b.appendFowardTo):a.$wrapper);a.$back.appendTo(b.appendBackTo!==null&&d(b.appendBackTo).length?d(b.appendBackTo):a.$wrapper);a.$arrowWidth=a.$forward.width()};a.buildAutoPlay=function(){a.$startStop.html("<span>"+ (a.playing?b.stopText:b.startText)+"</span>").bind(b.clickSlideshow,function(c){b.enableStartStop&&(a.startStop(!a.playing),a.makeActive(),a.playing&&!b.autoPlayDelayed&&a.goForward(!0));c.preventDefault()}).bind("focusin focusout",function(){d(this).toggleClass("hover")})};a.checkResize=function(c){clearTimeout(a.resizeTimer);a.resizeTimer=setTimeout(function(){var f=a.$outer.width()-a.outerPad[0],d=(a.$outer[0].tagName==="BODY"?a.$win.height():a.$outer.height())-a.outerPad[1];if(a.width*b.showMultiple!== f||a.height!==d)a.setDimensions(),a.gotoPage(a.currentPage,a.playing,null,1);typeof c==="undefined"&&a.checkResize()},500)};a.setDimensions=function(){var c,f,e,g=0,h=b.showMultiple>1?a.width||a.$window.width()/b.showMultiple:a.$window.width(),i=a.$win.width();if(b.expand)c=a.$outer.width()-a.outerPad[0],a.height=f=a.$outer.height()-a.outerPad[1],a.$wrapper.add(a.$window).add(a.$items).css({width:c,height:f}),a.width=h=b.showMultiple>1?c/b.showMultiple:c;a.$items.each(function(j){e=d(this).children(); b.resizeContents?(c=a.width,d(this).css({width:c,height:a.height}),e.length&&e[0].tagName==="EMBED"&&e.attr({width:"100%",height:"100%"}),e.length===1&&e.css({width:"100%",height:"100%"})):(c=d(this).width(),e.length===1&&c>=i&&(c=e.width()>=i?h:e.width(),e.css("max-width",c)),d(this).css("width",c),f=d(this).outerHeight(),d(this).css("height",f));a.panelSize[j]=[c,f,g];g+=c});a.$el.css("width",g)};a.getDim=function(c){if(!(a.pages<1)){var c=b.infiniteSlides&&a.pages>1?c:c-1,f,d=a.panelSize[c][0], g=a.panelSize[c][1];if(b.showMultiple>1)for(f=1;f<b.showMultiple;f++)d+=a.panelSize[(c+f)%b.showMultiple][0],g=Math.max(g,a.panelSize[c+f][1]);return[d,g]}};a.goForward=function(c){a.gotoPage(a.currentPage+parseInt(b.changeBy,10)*(b.playRtl?-1:1),c)};a.goBack=function(c){a.gotoPage(a.currentPage+parseInt(b.changeBy,10)*(b.playRtl?1:-1),c)};a.gotoPage=function(c,d,e,g){d!==!0&&(d=!1,a.startStop(!1),a.makeActive());b.changeBy!==1&&(c<0&&(c+=a.pages),c>a.pages&&(c-=a.pages));if(!(a.pages<=1)){a.$lastPage= a.$currentPage;if(typeof c!=="number")c=b.startPanel,a.setCurrentPage(c);if(!d||!b.isVideoPlaying(a))c>a.pages+1-a.adj&&(c=!b.infiniteSlides&&!b.stopAtEnd?1:a.pages),c<a.adj&&(c=!b.infiniteSlides&&!b.stopAtEnd?a.pages:1),a.currentPage=c>a.pages?a.pages:c<1?1:a.currentPage,a.$currentPage=a.$items.eq(a.currentPage-a.adj),a.exactPage=c,a.$targetPage=a.$items.eq(c===0?a.pages-a.adj:c>a.pages?1-a.adj:c-a.adj),a.$el.trigger("slide_init",a),a.slideControls(!0,!1),d!==!0&&(d=!1),(!d||b.stopAtEnd&&c===a.pages)&& a.startStop(!1),a.$el.trigger("slide_begin",a),b.resizeContents||(d=a.getDim(c),a.$wrapper.filter(":not(:animated)").animate({width:d[0],height:d[1]},{queue:!1,duration:g||b.animationTime,easing:b.easing})),a.$el.filter(":not(:animated)").animate({left:-a.panelSize[b.infiniteSlides&&a.pages>1?c:c-1][2]},{queue:!1,duration:g||b.animationTime,easing:b.easing,complete:function(){a.endAnimation(c,e)}})}};a.endAnimation=function(c,d){c===0?(a.$el.css("left",-a.panelSize[a.pages][2]),c=a.pages):c>a.pages&& (a.$el.css("left",-a.panelSize[1][2]),c=1);a.exactPage=c;a.setCurrentPage(c,!1);a.$items.removeClass("activePage").eq(c-a.adj).addClass("activePage");a.hovered||a.slideControls(!1);a.$el.trigger("slide_complete",a);typeof d==="function"&&d(a);b.autoPlayLocked&&!a.playing&&setTimeout(function(){a.startStop(!0)},b.resumeDelay-b.delay)};a.setCurrentPage=function(c,d){if(!(a.pages<1||c===0)){c=parseInt(c,10);c>a.pages+1-a.adj&&(c=a.pages-a.adj);c<a.adj&&(c=1);b.buildNavigation&&a.$nav.find(".cur").removeClass("cur").end().find("a").eq(c- 1).addClass("cur");!b.infiniteSlides&&b.stopAtEnd&&(a.$wrapper.find("span.forward")[c===a.pages?"addClass":"removeClass"]("disabled").end().find("span.back")[c===1?"addClass":"removeClass"]("disabled"),c===a.pages&&a.playing&&a.startStop());if(!d){var e=a.getDim(c);a.$wrapper.css({width:e[0],height:e[1]}).add(a.$window).scrollLeft(0);a.$el.css("left",-a.panelSize[b.infiniteSlides&&a.pages>1?c:c-1][2])}a.currentPage=c;a.$currentPage=a.$items.removeClass("activePage").eq(c-a.adj).addClass("activePage")}}; a.makeActive=function(){a.$wrapper.is(".activeSlider")||(d(".activeSlider").removeClass("activeSlider"),a.$wrapper.addClass("activeSlider"))};a.gotoHash=function(){var b=a.win.location.hash.match(a.regex);return b===null?"":parseInt(b[1],10)};a.setHash=function(b){var d="panel"+a.runTimes+"-",e=a.win.location.hash;if(typeof e!=="undefined")a.win.location.hash=e.indexOf(d)>0?e.replace(a.regex,d+b):e+"&"+d+b};a.slideControls=function(c){var d=c?0:b.animationTime,e=c?b.animationTime:0,g=c?1:0,h=c?0: 1;b.toggleControls&&a.$controls.stop(!0,!0).delay(d)[c?"slideDown":"slideUp"](b.animationTime/2).delay(e);b.buildArrows&&b.toggleArrows&&(!a.hovered&&a.playing&&(h=1,g=0),a.$forward.stop(!0,!0).delay(d).animate({right:h*a.$arrowWidth,opacity:g},b.animationTime/2),a.$back.stop(!0,!0).delay(d).animate({left:h*a.$arrowWidth,opacity:g},b.animationTime/2))};a.clearTimer=function(b){if(a.timer&&(a.win.clearInterval(a.timer),!b&&a.slideshow))a.$el.trigger("slideshow_stop",a),a.slideshow=!1};a.startStop= function(c,d){c!==!0&&(c=!1);if(c&&!d)a.$el.trigger("slideshow_start",a),a.slideshow=!0;a.playing=c;b.buildStartStop&&(a.$startStop.toggleClass("playing",c).html("<span>"+(c?b.stopText:b.startText)+"</span>"),parseInt(a.$startStop.find("span").css("text-indent"),10)<0&&a.$startStop.addClass(b.tooltipClass).attr("title",c?"Stop":"Start"));c&&b.resumeOnVideoEnd?(a.clearTimer(!0),a.timer=a.win.setInterval(function(){b.isVideoPlaying(a)||a.goForward(!0)},b.delay)):a.clearTimer()};a.init()};d.anythingSlider.defaults= {theme:"default",expand:!1,resizeContents:!0,showMultiple:!1,easing:"swing",buildArrows:!0,buildNavigation:!0,buildStartStop:!0,appendFowardTo:null,appendBackTo:null,appendControlsTo:null,appendNavigationTo:null,appendStartStopTo:null,toggleArrows:!1,toggleControls:!1,startText:"Start",stopText:"Stop",forwardText:"»",backText:"«",tooltipClass:"tooltip",enableArrows:!0,enableNavigation:!0,enableStartStop:!0,enableKeyboard:!0,startPanel:1,changeBy:1,hashTags:!0,infiniteSlides:!0,navigationFormatter:null, autoPlay:!1,autoPlayLocked:!1,autoPlayDelayed:!1,pauseOnHover:!0,stopAtEnd:!1,playRtl:!1,delay:3E3,resumeDelay:15E3,animationTime:600,clickForwardArrow:"click",clickBackArrow:"click",clickControls:"click focusin",clickSlideshow:"click",resumeOnVideoEnd:!0,addWmodeToObject:"opaque",isVideoPlaying:function(){return!1}};d.fn.anythingSlider=function(i,j){return this.each(function(){var a,b=d(this).data("AnythingSlider");(typeof i).match("object|undefined")?b?b.updateSlider():new d.anythingSlider(this, i):/\d/.test(i)&&!isNaN(i)&&b&&(a=typeof i==="number"?i:parseInt(d.trim(i),10),a>=1&&a<=b.pages&&b.gotoPage(a,!1,j))})}})(jQuery); -
anythingslider-for-wordpress/trunk/jtd-anything-slider.php
r397647 r405807 2 2 /* 3 3 Plugin Name: AnythingSlider for WordPress 4 Plugin URI: http://wordpress.org/extend/plugins/ yadayada5 Description: The famous AnythingSlider4 Plugin URI: http://wordpress.org/extend/plugins/anythingslider-for-wordpress/ 5 Description: Integrates Chris Coyier's popular AnythingSlider jQuery plugin with WordPress. Visit the <a href="options-general.php?page=anything_slider">Settings Page</a> for more options. Follow me on <a href="http://twitter.com/#!/jacobdubail" target="_blank">Twitter</a> for plugin updates and news. 6 6 Author: Jacob Dubail 7 7 Author URI: http://jacobdubail.com 8 Version: 0. 18 Version: 0.6 9 9 */ 10 10 … … 19 19 add_action( 'template_redirect', 'jtd_insertjs_front' ); 20 20 function jtd_insertjs_front() { 21 22 $options = get_option( 'jtd_anything_slides_options' ); 23 $video = $options['video']; 24 21 25 wp_enqueue_script( 'jquery' ); 22 wp_enqueue_script( 'jquery.anythingslider', JTD_INSERTJS . '/jquery.anythingslider.min.js', array( 'jquery' ), '1.5.21' ); 26 wp_enqueue_script( 'jquery.anythingslider', JTD_INSERTJS . '/jquery.anythingslider.min.js', array( 'jquery' ), '1.7.1' ); 27 28 if ( $video !== 'false' ) { 29 30 wp_enqueue_script( 'jquery.anythingslider.video', JTD_INSERTJS . '/jquery.anythingslider.video.min.js', array( 'jquery' ), '1.7.1' ); 31 wp_enqueue_script( 'swfobject', JTD_INSERTJS . '/swfobject.js', '', '2.2' ); 32 33 } 34 23 35 } 24 36 … … 26 38 add_action( 'wp_print_styles', 'jtd_insertcss_front' ); 27 39 function jtd_insertcss_front() { 40 41 //wp_register_style( 'anythingslider', JTD_INSERTCSS . '/anythingslider.css', '', '1.5.10' ); 42 43 // Check for custom theme css - load it if it exists 44 if ( file_exists( get_stylesheet_directory()."/anythingslider.css" ) ) { 45 wp_register_style( 'anythingslider-base', get_stylesheet_directory_uri() . '/anythingslider.css' ); 46 } 47 elseif ( file_exists( get_template_directory()."/anythingslider.css" ) ) { 48 wp_register_style( 'anythingslider-base', get_template_directory_uri() . '/anythingslider.css' ); 49 } 50 else { 51 wp_register_style( 'anythingslider-base', JTD_INSERTCSS . '/anythingslider.css' ); 52 } 53 54 55 wp_enqueue_style( 'anythingslider-base' ); 56 57 28 58 $options = get_option( 'jtd_anything_slides_options' ); 29 59 $theme = $options['theme']; 30 wp_register_style( 'anythingslider', JTD_INSERTCSS . '/anythingslider.css', '', '1.5.10' );31 wp_register_style( 'anythingslider-theme', JTD_INSERTCSS . '/theme-' . $theme . '.css', array( 'anythingslider' ), '1.5.10' );32 33 if ( $theme != '' ) {60 61 wp_register_style( 'anythingslider-theme', JTD_INSERTCSS . '/theme-' . $theme . '.css', '', '1.7.1' ); 62 63 if ( $theme != '' && $theme != 'default' ) { 34 64 wp_enqueue_style( 'anythingslider-theme' ); 35 65 } 36 } 66 67 } 68 69 70 37 71 38 72 … … 55 89 'supports' => array( 56 90 'title', 57 'thumbnail', 58 'editor' 91 'editor', 92 'custom-fields', 93 'page-attributes' 59 94 ), 60 95 'labels' => array( … … 95 130 96 131 132 // Add meta box on Slide page for Navigation Formatting 133 add_action( 'add_meta_boxes', 'jtd_anythingslider_create_metabox' ); 134 function jtd_anythingslider_create_metabox() { 135 add_meta_box( 'jtd_anythingslider_advanced', 'Advanced Slide Functions', 'jtd_anythingslider_display_advanced_metabox', 'anything_slides', 'normal', 'high' ); 136 } 137 function jtd_anythingslider_display_advanced_metabox( $post ) { 138 139 // get the meta value if it exists 140 $anything_slides_nav_format = get_post_meta( $post->ID, '_jtd_anything_slides_nav_format', true ); 141 142 143 echo "<table class='form-table'><tbody> 144 <tr class='form-field'> 145 <th scope='row'> <label for='_jtd_anything_slides_nav_format'>Navigation Formatter:</label> </th> 146 <td> <input id='_jtd_anything_slides_nav_format' class='code' type='text' name='_jtd_anything_slides_nav_format' value='" . esc_attr( $anything_slides_nav_format ) . "' /> </td> 147 <td> <em>Customize the text used for the slide navigation</em> </td> 148 </tr> 149 </tbody></table>"; 150 } 151 152 add_action( 'save_post', 'jtd_anythingslider_save_metabox' ); 153 function jtd_anythingslider_save_metabox( $post_id ) { 154 if ( isset( $_POST['_jtd_anything_slides_nav_format'] ) ) { 155 update_post_meta( $post_id, '_jtd_anything_slides_nav_format', strip_tags( $_POST['_jtd_anything_slides_nav_format'] ) ); 156 } 157 158 } 159 160 161 162 97 163 98 164 // register shortcode for retrieving slides … … 103 169 104 170 function jtd_anything_slides_shortcode( $attr ) { 105 106 171 107 172 // setup slide query … … 116 181 ); 117 182 118 $options = get_option( 'jtd_anything_slides_options' ); 119 $height = ( $attr['height'] ) ? $attr['height'] : ( ( $options['height'] ) ? $options['height'] : 280 ); 120 $width = ( $attr['width'] ) ? $attr['width'] : ( ( $options['width'] ) ? $options['width'] : 960 ); 121 $delay = ( $attr['delay'] ) ? $attr['delay'] : ( ( $options['delay'] ) ? $options['delay'] : 5000 ); 122 $resume = ( $attr['resume'] ) ? $attr['resume'] : ( ( $options['resume'] ) ? $options['resume'] : 9000 ); 123 $animation = ( $attr['animation'] ) ? $attr['animation'] : ( ( $options['animation'] ) ? $options['animation'] : 800 ); 124 $arrows = ( $options['arrows'] ) ? $options['arrows'] : true; 125 $navigation = ( $options['navigation'] ) ? $options['navigation'] : true; 126 $theme = ( $options['theme'] ) ? $options['theme'] : 'default'; 127 128 183 $options = get_option( 'jtd_anything_slides_options' ); 184 185 // Appearance 186 $width = ( isset( $attr['width'] ) ) ? $attr['width'] : ( ( $options['width'] ) ? $options['width'] : 570 ); 187 $height = ( isset( $attr['height'] ) ) ? $attr['height'] : ( ( $options['height'] ) ? $options['height'] : 300 ); 188 $expand = ( isset( $attr['expand'] ) ) ? $attr['expand'] : ( ( $options['expand'] ) ? $options['expand'] : 'false' ); 189 $resizeContents = ( isset( $attr['resizeContents'] ) ) ? $attr['resizeContents'] : ( ( $options['resizeContents'] ) ? $options['resizeContents'] : 'true' ); 190 $showMultiple = ( isset( $attr['showMultiple'] ) ) ? $attr['showMultiple'] : ( ( $options['showMultiple'] ) ? $options['showMultiple'] : 'false' ); 191 $tooltipClass = ( isset( $attr['tooltipClass'] ) ) ? $attr['tooltipClass'] : ( ( $options['tooltipClass'] ) ? $options['tooltipClass'] : 'tooltip' ); 192 $theme = ( isset( $options['theme'] ) ) ? $options['theme'] : 'default'; 193 194 // Navigation 195 $startPanel = ( $options['startPanel'] != NULL ) ? $options['startPanel'] : '1'; 196 $hashTags = ( isset( $options['hashTags'] ) ) ? $options['hashTags'] : 'false'; 197 $infiniteSlides = ( isset( $options['infinite'] ) ) ? $options['infinite'] : 'true'; 198 $enableKeyboard = ( $options['keyboard'] != NULL ) ? $options['keyboard'] : 'true'; 199 $buildArrows = ( isset( $options['arrows'] ) ) ? $options['arrows'] : 'true'; 200 $toggleArrows = ( isset( $options['toggleArrows'] ) ) ? $options['toggleArrows'] : 'false'; 201 $buildNav = ( isset( $options['navigation'] ) ) ? $options['navigation'] : 'true'; 202 $enableNav = ( isset( $options['enableNav'] ) ) ? $options['enableNav'] : 'true'; 203 $toggleControls = ( $options['toggleControls'] != NULL ) ? $options['toggleControls'] : 'false'; 204 // $appendControls = ( isset( $options['appendControls'] ) ) ? $options['appendControls'] : 'NULL'; 205 $forwardText = ( $options['forwardText'] != NULL ) ? $options['forwardText'] : '»'; 206 $backText = ( $options['backText'] != NULL ) ? $options['backText'] : '«'; 207 208 // Slideshow options 209 $enablePlay = ( isset( $options['enablePlay'] ) ) ? $options['enablePlay'] : 'true'; 210 $autoPlay = ( isset( $options['autoPlay'] ) ) ? $options['autoPlay'] : 'true'; 211 $autoPlayLocked = ( isset( $options['autoPlayLocked'] ) ) ? $options['autoPlayLocked'] : 'false'; 212 $startStopped = ( isset( $options['startStopped'] ) ) ? $options['startStopped'] : 'false'; 213 $pauseOnHover = ( isset( $options['pauseOnHover'] ) ) ? $options['pauseOnHover'] : 'true'; 214 $stopAtEnd = ( isset( $options['stopAtEnd'] ) ) ? $options['stopAtEnd'] : 'false'; 215 $playRtl = ( isset( $options['playRtl'] ) ) ? $options['playRtl'] : 'false'; 216 $startText = ( isset( $options['startText'] ) ) ? $options['startText'] : 'Start'; 217 $stopText = ( isset( $options['stopText'] ) ) ? $options['stopText'] : 'Stop'; 218 $delay = ( isset( $attr['delay'] ) ) ? $attr['delay'] : ( ( $options['delay'] ) ? $options['delay'] : 5000 ); 219 $resumeDelay = ( isset( $attr['resume'] ) ) ? $attr['resume'] : ( ( $options['resume'] ) ? $options['resume'] : 9000 ); 220 $animation = ( isset( $attr['animation'] ) ) ? $attr['animation'] : ( ( $options['animation'] ) ? $options['animation'] : 800 ); 221 // $easing = ( isset( $options['easing'] ) ) ? $options['easing'] : 'swing'; 222 223 // Video 224 // $video = ( isset( $options['video'] ) ) ? $options['video'] : 'false'; 225 $resumeOnVideo = ( isset( $options['resumeOnVideo'] ) ) ? $options['resumeOnVideo'] : 'true'; 226 $addWmode = ( isset( $options['wmode'] ) ) ? $options['wmode'] : 'NULL'; 227 // $isVideoPlaying = 'function(base){ return false; }'; 228 229 129 230 // do we have results 130 231 if ( $loop->have_posts() ) { 131 132 $ rand = rand(5, 500);133 134 $output = "<ul id='slider-{$rand}' class='anythingSlider'>";232 233 $i = 0; 234 $rand = rand(5, 500); 235 $output = "<ul id='slider-{$rand}' class='anythingSlider'>"; 135 236 136 237 while ( $loop->have_posts() ) { … … 138 239 $loop->the_post(); 139 240 140 $thumb = get_the_post_thumbnail( $post->ID, array( $width, $height*4 ) );141 $content = get_the_content();142 143 $output .= "<li>";144 241 145 if ( $thumb ) { 146 $output .= $thumb; 242 // setup the NavigationFormatter object based on the custom field value for each slide 243 if ( $attr['navFormat'] != undefined ) { 244 245 global $post; 246 247 if ( get_post_meta( $post->ID, '_jtd_anything_slides_nav_format', true ) ) { 248 $navArray[$i] = get_post_meta( $post->ID, '_jtd_anything_slides_nav_format', true ); 249 } else { 250 $navArray[$i] = get_the_title(); 251 } 252 253 $setupNavFormat = true; 254 255 } else { // if no the navFormat attribute is not present in the shortcode, return NULL 256 257 $navFormat = "'NULL'"; 258 147 259 } 148 260 261 $i++; 262 263 $content = get_the_content(); 264 265 $output .= "<li>"; 266 149 267 if ( $content ) { 150 $output .= "<div class='content'> {$content} </div>";268 $output .= "<div class='content clearfix'> {$content} </div>"; 151 269 } 152 270 153 $output .= "</li>";154 271 $output .= "</li>"; 272 155 273 } 156 274 157 $output .= "</ul>"; 275 // Have to build the NavigationFormatter function outside of the Loop 276 if ( $setupNavFormat ) { 277 $navArray = json_encode($navArray); 278 279 $navFormat = "function(index, panel){ 280 return {$navArray}[index - 1]; 281 }"; 282 } 283 284 285 $output .= "</ul>"; 158 286 159 287 // output the jquery plugin code 160 $output .= "<script> 288 $output .= " 289 <style> 290 #slider-{$rand} { width: {$width}px; height: {$height}px; } 291 </style> 292 <script> 161 293 jQuery('#slider-{$rand}').anythingSlider({ 162 width : {$width}, 163 height : {$height}, 164 buildArrows : {$arrows}, 165 buildNavigation : {$navigation}, 166 delay : {$delay}, 167 resumeDelay : {$resume}, 168 animationTime : {$animation}, 169 theme : '{$theme}' 294 295 // Appearance 296 expand : {$expand}, 297 resizeContents : {$resizeContents}, 298 showMultiple : {$showMultiple}, 299 tooltipClass : '{$tooltipClass}', 300 theme : '{$theme}', 301 302 // Navigation 303 startPanel : {$startPanel}, 304 hashTags : {$hashTags}, 305 infiniteSlides : {$infiniteSlides}, 306 enableKeyboard : {$enableKeyboard}, 307 buildArrows : {$buildArrows}, 308 toggleArrows : {$toggleArrows}, 309 buildNavigation : {$buildNav}, 310 enableNavigation : {$enableNav}, 311 toggleControls : {$toggleControls}, 312 navigationFormatter : {$navFormat}, 313 forwardText : '{$forwardText}', 314 backText : '{$backText}', 315 316 // Slideshow Options 317 enablePlay : {$enablePlay}, 318 autoPlay : {$autoPlay}, 319 autoPlayLocked : {$autoPlayLocked}, 320 startStopped : {$startStopped}, 321 pauseOnHover : {$pauseOnHover}, 322 resumeOnVideoEnd : {$resumeOnVideo}, 323 stopAtEnd : {$stopAtEnd}, 324 playRtl : {$playRtl}, 325 startText : '{$startText}', 326 stopText : '{$stopText}', 327 delay : {$delay}, 328 resumeDelay : {$resumeDelay}, 329 animationTime : {$animation}, 330 easing : 'swing', 331 332 //Video 333 resumeOnVideoEnd : {$resumeOnVideo}, 334 addWmodeToObject : '{$addWmode}' 335 170 336 }); 171 337 </script>"; … … 177 343 } 178 344 179 180 181 182 183 //Admin Options Page 345 /* 346 theme : "default", // Theme name 347 expand : false, // If true, the entire slider will expand to fit the parent element 348 resizeContents : true, // If true, solitary images/objects in the panel will expand to fit the viewport 349 showMultiple : false, // Set this value to a number and it will show that many slides at once 350 easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin or jQuery UI 351 352 buildArrows : true, // If true, builds the forwards and backwards buttons 353 buildNavigation : true, // If true, builds a list of anchor links to link to each panel 354 buildStartStop : true, // ** If true, builds the start/stop button 355 356 appendFowardTo : null, // Append forward arrow to a HTML element (jQuery Object, selector or HTMLNode), if not null 357 appendBackTo : null, // Append back arrow to a HTML element (jQuery Object, selector or HTMLNode), if not null 358 appendControlsTo : null, // Append controls (navigation + start-stop) to a HTML element (jQuery Object, selector or HTMLNode), if not null 359 appendNavigationTo : null, // Append navigation buttons to a HTML element (jQuery Object, selector or HTMLNode), if not null 360 appendStartStopTo : null, // Append start-stop button to a HTML element (jQuery Object, selector or HTMLNode), if not null 361 362 toggleArrows : false, // If true, side navigation arrows will slide out on hovering & hide @ other times 363 toggleControls : false, // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times 364 365 startText : "Start", // Start button text 366 stopText : "Stop", // Stop button text 367 forwardText : "»", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image) 368 backText : "«", // Link text used to move the slider back (hidden by CSS, replace with arrow image) 369 tooltipClass : "tooltip", // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent) 370 371 // Function 372 enableArrows : true, // if false, arrows will be visible, but not clickable. 373 enableNavigation : true, // if false, navigation links will still be visible, but not clickable. 374 enableStartStop : true, // if false, the play/stop button will still be visible, but not clickable. Previously "enablePlay" 375 enableKeyboard : true, // if false, keyboard arrow keys will not work for this slider. 376 377 // Navigation 378 startPanel : 1, // This sets the initial panel 379 changeBy : 1, // Amount to go forward or back when changing panels. 380 hashTags : true, // Should links change the hashtag in the URL? 381 infiniteSlides : true, // if false, the slider will not wrap & not clone any panels 382 navigationFormatter : null, // Details at the top of the file on this use (advanced use) 383 384 // Slideshow options 385 autoPlay : false, // If true, the slideshow will start running; replaces "startStopped" option 386 autoPlayLocked : false, // If true, user changing slides will not stop the slideshow 387 autoPlayDelayed : false, // If true, starting a slideshow will delay advancing slides; if false, the slider will immediately advance to the next slide when slideshow starts 388 pauseOnHover : true, // If true & the slideshow is active, the slideshow will pause on hover 389 stopAtEnd : false, // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false. 390 playRtl : false, // If true, the slideshow will move right-to-left 391 392 // Times 393 delay : 3000, // How long between slideshow transitions in AutoPlay mode (in milliseconds) 394 resumeDelay : 15000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds). 395 animationTime : 600, // How long the slideshow transition takes (in milliseconds) 396 397 // Callbacks 398 onBeforeInitialize : function(e, slider) {}, // Callback before the plugin initializes 399 onInitialized : function(e, slider) {}, // Callback when the plugin finished initializing 400 onShowStart : function(e, slider) {}, // Callback on slideshow start 401 onShowStop : function(e, slider) {}, // Callback after slideshow stops 402 onShowPause : function(e, slider) {}, // Callback when slideshow pauses 403 onShowUnpause : function(e, slider) {}, // Callback when slideshow unpauses - may not trigger properly if user clicks on any controls 404 onSlideInit : function(e, slider) {}, // Callback when slide initiates, before control animation 405 onSlideBegin : function(e, slider) {}, // Callback before slide animates 406 onSlideComplete : function(slider) {}, // Callback when slide completes; this is the only callback without an event "e" variable 407 408 // Interactivity 409 clickForwardArrow : "click", // Event used to activate forward arrow functionality (e.g. add jQuery mobile's "swiperight") 410 clickBackArrow : "click", // Event used to activate back arrow functionality (e.g. add jQuery mobile's "swipeleft") 411 clickControls : "click focusin", // Events used to activate navigation control functionality 412 clickSlideshow : "click", // Event used to activate slideshow play/stop button 413 414 // Video 415 resumeOnVideoEnd : true, // If true & the slideshow is active & a supported video is playing, it will pause the autoplay until the video is complete 416 addWmodeToObject : "opaque", // If your slider has an embedded object, the script will automatically add a wmode parameter with this setting 417 isVideoPlaying : function(base){ return false; } // return true if video is playing or false if not - used by video extension 418 */ 419 420 421 422 423 // Add Admin Options Page 184 424 add_action( 'admin_menu', 'jtd_anything_slides_create_settings_menu' ); 185 425 function jtd_anything_slides_create_settings_menu() { 186 add_options_page( 'Anything Slider Settings', 'AnythingSlider', 'manage_options', 'anything_slider', 'jtd_anything_slides_settingspage' ); 187 } 426 427 $settings = add_options_page( 'Anything Slider Settings', 'AnythingSlider', 'manage_options', 'anything_slider', 'jtd_anything_slides_settingspage' ); 428 429 // Add admin CSS 430 add_action( 'load-'.$settings, 'jtd_anything_slides_insert_admin_css' ); 431 432 } 433 434 435 function jtd_anything_slides_insert_admin_css() { 436 437 wp_enqueue_style( 'anything_slider_admin', JTD_INSERTCSS . '/admin.css' ); 438 439 } 440 441 188 442 189 443 function jtd_anything_slides_settingspage() { … … 193 447 <h2>Anything Slider for WordPress</h2> 194 448 <form action="options.php" method="post"> 195 196 <?php settings_fields('jtd_anything_slides_options'); ?> 197 <?php do_settings_sections('anything_slider'); ?> 198 199 <input name="Submit" type="submit" value="Save Changes" class="button-primary" /> 449 450 <div class="anythingslider-holder"> 451 <?php settings_fields('jtd_anything_slides_options'); ?> 452 <?php do_settings_sections('anything_slider_appearance'); ?> 453 <?php do_settings_sections('anything_slider_navigation'); ?> 454 <?php do_settings_sections('anything_slider_slideshow'); ?> 455 <?php do_settings_sections('anything_slider_video'); ?> 456 </div><!-- end .inside --> 457 458 </div><!-- end metabox-holder --> 459 460 <input name="Submit" type="submit" value="Save Changes" class="button-primary" /> 461 <!-- <input name="reset" type="reset" value="RESET ALL OPTIONS" class="button-secondary" /> --> 200 462 </form> 201 463 </div> … … 206 468 207 469 208 // Regsiter Admin Settings 470 471 // Regsiter Admin Settings and Options 209 472 add_action( 'admin_init', 'jtd_anything_slides_admin_settings' ); 210 473 function jtd_anything_slides_admin_settings() { 211 register_setting( 212 'jtd_anything_slides_options', 213 'jtd_anything_slides_options', 214 'jtd_anything_slides_validate_options' 215 ); 216 add_settings_section( 217 'jtd_anything_slides_option_section', 218 'Anything Slider for WordPress', 219 'jtd_anything_slides_option_section_text', 220 'anything_slider' 221 ); 222 add_settings_field( 223 'jtd_anything_slides-width', 224 '<label for="width">Width</label>', 225 'jtd_anything_slides_width_callback', 226 'anything_slider', 227 'jtd_anything_slides_option_section' 228 ); 229 add_settings_field( 230 'jtd_anything_slides-height', 231 '<label for="height">Height</label>', 232 'jtd_anything_slides_height_callback', 233 'anything_slider', 234 'jtd_anything_slides_option_section' 235 ); 236 add_settings_field( 237 'jtd_anything_slides-delay', 238 '<label for="delay">Delay</label>', 239 'jtd_anything_slides_delay_callback', 240 'anything_slider', 241 'jtd_anything_slides_option_section' 242 ); 243 add_settings_field( 244 'jtd_anything_slides-resume', 245 '<label for="resume">Resume Delay</label>', 246 'jtd_anything_slides_resume_callback', 247 'anything_slider', 248 'jtd_anything_slides_option_section' 249 ); 250 add_settings_field( 251 'jtd_anything_slides-animation', 252 '<label for="animation">Animation Time</label>', 253 'jtd_anything_slides_animation_callback', 254 'anything_slider', 255 'jtd_anything_slides_option_section' 256 ); 257 add_settings_field( 258 'jtd_anything_slides-theme', 259 '<label for="theme">Theme</label>', 260 'jtd_anything_slides_theme_callback', 261 'anything_slider', 262 'jtd_anything_slides_option_section' 263 ); 264 } 474 475 // Register the Option so we can store all of the settings into the DB 476 register_setting( 'jtd_anything_slides_options', 'jtd_anything_slides_options', 'jtd_anything_slides_validate_options' ); 477 478 // Register a settings section into which we can print all of the options fields 479 add_settings_section( 'jtd_anything_slides_option_section', 'Appearance Settings', 'jtd_anything_slides_option_appearance_text', 'anything_slider_appearance' ); 480 add_settings_section( 'jtd_anything_slides_option_section', '</div><h3>Navigation Settings</h3>', 'jtd_anything_slides_option_navigation_text', 'anything_slider_navigation' ); 481 add_settings_section( 'jtd_anything_slides_option_section', '</div><h3>Slideshow Options</h3>', 'jtd_anything_slides_option_slideshow_text', 'anything_slider_slideshow' ); 482 add_settings_section( 'jtd_anything_slides_option_section', '</div><h3>Video Settings</h3>', 'jtd_anything_slides_option_video_text', 'anything_slider_video' ); 483 484 // Register each of the fields that will be displayed on the options page -> set a callback for each setting to spit out the actual form field 485 // Appearance Settings 486 add_settings_field( 'jtd_anything_slides-width', '<label for="width">Width</label>', 'jtd_anything_slides_width_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); 487 add_settings_field( 'jtd_anything_slides-height', '<label for="height">Height</label>', 'jtd_anything_slides_height_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); 488 add_settings_field( 'jtd_anything_slides-expand', '<label for="expand">Expand</label>', 'jtd_anything_slides_expand_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); 489 add_settings_field( 'jtd_anything_slides-resizeContents','<label for="resizeContents">Resize</label>', 'jtd_anything_slides_resize_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); 490 add_settings_field( 'jtd_anything_slides-showMultiple', '<label for="showMultiple">Show Multiple</label>', 'jtd_anything_slides_showMultiple_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); 491 add_settings_field( 'jtd_anything_slides-tooltipClass', '<label for="tooltipClass">Tooltip Class</label>', 'jtd_anything_slides_tooltipClass_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); 492 add_settings_field( 'jtd_anything_slides-theme', '<label for="theme">Theme</label>', 'jtd_anything_slides_theme_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); 493 494 495 // Navigation Settings 496 add_settings_field( 'jtd_anything_slides-startPanel', '<label for="startPanel">Start Panel</label>', 'jtd_anything_slides_startPanel_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); 497 add_settings_field( 'jtd_anything_slides-hashTags', '<label for="hashTags">Display Hash Tags</label>', 'jtd_anything_slides_hashTags_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); 498 add_settings_field( 'jtd_anything_slides-infinite', '<label for="infinite">Infinite Slides</label>', 'jtd_anything_slides_infinite_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); 499 add_settings_field( 'jtd_anything_slides-keyboard', '<label for="keyboard">Enable Keyboard</label>', 'jtd_anything_slides_keyboard_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); 500 add_settings_field( 'jtd_anything_slides-arrows', '<label for="arrows">Arrows</label>', 'jtd_anything_slides_arrows_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); 501 add_settings_field( 'jtd_anything_slides-toggleArrows', '<label for="toggleArrows">Toggle Arrows</label>', 'jtd_anything_slides_toggleArrows_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); 502 add_settings_field( 'jtd_anything_slides-navigation', '<label for="navigation">Build Navigation</label>', 'jtd_anything_slides_navigation_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); 503 add_settings_field( 'jtd_anything_slides-enableNav', '<label for="enableNav">Enable Navigation</label>', 'jtd_anything_slides_enableNav_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); 504 add_settings_field( 'jtd_anything_slides-toggleContr', '<label for="toggleContr">Toggle Controls</label>', 'jtd_anything_slides_toggleContr_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); 505 // add_settings_field( 'jtd_anything_slides-appendContr', '<label for="appendContr">Append Controls</label>', 'jtd_anything_slides_appendContr_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); 506 // add_settings_field( 'jtd_anything_slides-navFormatter', '<label for="navFormatter">Navigation Formatter</label>', 'jtd_anything_slides_navFormatter_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); 507 add_settings_field( 'jtd_anything_slides-forwardText', '<label for="forwardText">Forward Text</label>', 'jtd_anything_slides_forwardText_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); 508 add_settings_field( 'jtd_anything_slides-backText', '<label for="backText">Back Text</label>', 'jtd_anything_slides_backText_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); 509 510 // Slideshow Options 511 add_settings_field( 'jtd_anything_slides-enablePlay', '<label for="enablePlay">Enable Play</label>', 'jtd_anything_slides_enablePlay_callback', 'anything_slider_slideshow', 'jtd_anything_slides_option_section' ); 512 add_settings_field( 'jtd_anything_slides-autoPlay', '<label for="autoPlay">Auto Play</label>', 'jtd_anything_slides_autoPlay_callback', 'anything_slider_slideshow', 'jtd_anything_slides_option_section' ); 513 add_settings_field( 'jtd_anything_slides-autoPlayLocked', '<label for="autoPlayLocked">Auto Play Locked</label>', 'jtd_anything_slides_autoPlayLocked_callback', 'anything_slider_slideshow', 'jtd_anything_slides_option_section' ); 514 // add_settings_field( 'jtd_anything_slides-startStopped', '<label for="startStopped">Start Stopped</label>', 'jtd_anything_slides_startStopped_callback', 'anything_slider', 'jtd_anything_slides_option_section' ); 515 // add_settings_field( 'jtd_anything_slides-pauseOnHover', '<label for="pauseOnHover">Paust on Hover</label>', 'jtd_anything_slides_pauseOnHover_callback', 'anything_slider', 'jtd_anything_slides_option_section' ); 516 // add_settings_field( 'jtd_anything_slides-stopAtEnd', '<label for="stopAtEnd">Stop at end of slides</label>', 'jtd_anything_slides_stopAtEnd_callback', 'anything_slider', 'jtd_anything_slides_option_section' ); 517 // add_settings_field( 'jtd_anything_slides-playRtl', '<label for="playRtl">Play Right to Left</label>', 'jtd_anything_slides_playRtl_callback', 'anything_slider', 'jtd_anything_slides_option_section' ); 518 // add_settings_field( 'jtd_anything_slides-startText', '<label for="startText">Start Text</label>', 'jtd_anything_slides_startText_callback', 'anything_slider', 'jtd_anything_slides_option_section' ); 519 // add_settings_field( 'jtd_anything_slides-stopText', '<label for="stopText">Stop Text</label>', 'jtd_anything_slides_stopText_callback', 'anything_slider', 'jtd_anything_slides_option_section' ); 520 add_settings_field( 'jtd_anything_slides-delay', '<label for="delay">Delay</label>', 'jtd_anything_slides_delay_callback', 'anything_slider_slideshow', 'jtd_anything_slides_option_section' ); 521 add_settings_field( 'jtd_anything_slides-resume', '<label for="resume">Resume Delay</label>', 'jtd_anything_slides_resume_callback', 'anything_slider_slideshow', 'jtd_anything_slides_option_section' ); 522 add_settings_field( 'jtd_anything_slides-animation', '<label for="animation">Animation Time</label>', 'jtd_anything_slides_animation_callback', 'anything_slider_slideshow', 'jtd_anything_slides_option_section' ); 523 // add_settings_field( 'jtd_anything_slides-easing', '<label for="easing">Easing</label>', 'jtd_anything_slides_easing_callback', 'anything_slider', 'jtd_anything_slides_option_section' ); 524 525 526 // Video Options 527 // add_settings_field( 'jtd_anything_slides-resumeOnVideo', '<label for="resumeOnVideo">Resume After Video</label>','jtd_anything_slides_resumeOnVideo_callback', 'anything_slider', 'jtd_anything_slides_option_section' ); 528 add_settings_field( 'jtd_anything_slides-video', '<label for="video">Video</label>', 'jtd_anything_slides_video_callback', 'anything_slider_video', 'jtd_anything_slides_option_section' ); 529 add_settings_field( 'jtd_anything_slides-wmode', '<label for="wmode">Wmode</label>', 'jtd_anything_slides_wmode_callback', 'anything_slider_video', 'jtd_anything_slides_option_section' ); 530 } 531 532 533 534 535 265 536 266 537 // Draw the section header 267 function jtd_anything_slides_option_section_text() { 268 echo '<p>Enter the desired settings for your slider'; 269 } 538 function jtd_anything_slides_option_appearance_text() { 539 echo '<div class="inside">'; 540 } 541 function jtd_anything_slides_option_navigation_text() { 542 echo '<div class="inside">'; 543 } 544 function jtd_anything_slides_option_slideshow_text() { 545 echo '<div class="inside">'; 546 } 547 function jtd_anything_slides_option_video_text() { 548 echo '<div class="inside">'; 549 } 550 551 552 553 554 270 555 271 556 // Display and fill the form field 557 /* 558 ** Appearance 559 */ 560 /* Appearance 561 width : null, // Override the default CSS width 562 height : null, // Override the default CSS height 563 expand : false, // If true, the entire slider will expand to fit the parent element 564 resizeContents : true, // If true, solitary images/objects in the panel will expand to fit the viewport 565 showMultiple : false, // Set this value to a number and it will show that many slides at once 566 tooltipClass : 'tooltip', // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent) 567 theme : 'default', // Theme name - adds a class name to the base element "anythingSlider-{theme}" so the loaded theme will work. 568 */ 272 569 function jtd_anything_slides_width_callback() { 273 570 $options = get_option( 'jtd_anything_slides_options' ); 274 $width = ( $options['width'] ) ? $options['width'] : 960;275 echo "<input id='width' name='jtd_anything_slides_options[width]' type='number' value='$width' />";571 $width = $options['width']; 572 echo "<input id='width' name='jtd_anything_slides_options[width]' type='number' min=0 value='$width' />"; 276 573 echo "<span class='description'>Override the default CSS width</span>"; 277 574 } 278 575 function jtd_anything_slides_height_callback() { 279 576 $options = get_option( 'jtd_anything_slides_options' ); 280 $height = ( $options['height'] ) ? $options['height'] : 280;281 echo "<input id='height' name='jtd_anything_slides_options[height]' type='number' value='$height' />";577 $height = $options['height']; 578 echo "<input id='height' name='jtd_anything_slides_options[height]' type='number' min=0 value='$height' />"; 282 579 echo "<span class='description'>Override the default CSS height</span>"; 283 580 } 284 function jtd_anything_slides_delay_callback() { 285 $options = get_option( 'jtd_anything_slides_options' ); 286 $delay = ( $options['delay'] ) ? $options['delay'] : 1100; 287 echo "<input id='delay' name='jtd_anything_slides_options[delay]' type='number' value='$delay' />"; 288 echo "<span class='description'>How long between slideshow transitions in AutoPlay mode (in milliseconds)</span>"; 289 } 290 function jtd_anything_slides_resume_callback() { 291 $options = get_option( 'jtd_anything_slides_options' ); 292 $resume = ( $options['resume'] ) ? $options['resume'] : 5000; 293 echo "<input id='resume' name='jtd_anything_slides_options[resume]' type='number' value='$resume' />"; 294 echo "<span class='description'>Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds)</span>"; 295 } 296 function jtd_anything_slides_animation_callback() { 297 $options = get_option( 'jtd_anything_slides_options' ); 298 $animation = ( $options['animation'] ) ? $options['animation'] : 900; 299 echo "<input id='animation' name='jtd_anything_slides_options[animation]' type='number' value='$animation' />"; 300 echo "<span class='description'>How long the slideshow transition takes (in milliseconds)</span>"; 581 function jtd_anything_slides_expand_callback() { 582 $options = get_option( 'jtd_anything_slides_options' ); 583 $expand = $options['expand']; 584 echo "<label>Yes <input id='expand' name='jtd_anything_slides_options[expand]' type='radio' value='true'" . checked( $expand, 'true', false ) . "/></label><br />"; 585 echo "<label>No <input id='expand' name='jtd_anything_slides_options[expand]' type='radio' value='false'" . checked( $expand, 'false', false ) . "/></label>"; 586 echo "<span class='description'>If yes, the entire slider will expand to fit the parent element</span>"; 587 } 588 function jtd_anything_slides_resize_callback() { 589 $options = get_option( 'jtd_anything_slides_options' ); 590 $resize = $options['resizeContents']; 591 echo "<label>Yes <input id='resizeContents' name='jtd_anything_slides_options[resizeContents]' type='radio' value='true'" . checked( $resize, 'true', false ) . "/></label><br />"; 592 echo "<label>No <input id='resizeContents' name='jtd_anything_slides_options[resizeContents]' type='radio' value='false'" . checked( $resize, 'false', false ) . "/></label>"; 593 echo "<span class='description'>If yes, solitary images/objects in the panel will expand to fit the viewport</span>"; 594 } 595 function jtd_anything_slides_showMultiple_callback() { 596 $options = get_option( 'jtd_anything_slides_options' ); 597 $multiple = $options['showMultiple']; 598 echo "<input id='showMultiple' name='jtd_anything_slides_options[showMultiple]' type='number' min=0 value='$multiple' />"; 599 echo "<span class='description'>Set this value to a number and it will show that many slides at once</span>"; 600 } 601 function jtd_anything_slides_tooltipClass_callback() { 602 $options = get_option( 'jtd_anything_slides_options' ); 603 $tooltip = $options['tooltipClass']; 604 echo "<input id='tooltipClass' name='jtd_anything_slides_options[tooltipClass]' type='text' value='$tooltip' />"; 605 echo "<span class='description'>Set this value to a number and it will show that many slides at once</span>"; 301 606 } 302 607 function jtd_anything_slides_theme_callback() { … … 304 609 $theme = $options['theme']; 305 610 echo "<select id='theme' name='jtd_anything_slides_options[theme]'> 306 <option value=''" . selected( $theme, '' ) . ">Default</option>307 <option value='construction'" . selected( $theme, 'construction' ) . ">Construction</option>308 <option value='cs-portfolio'" . selected( $theme, 'cs-portfolio' ) . ">CS Portfolio</option>309 <option value='metallic'" . selected( $theme, 'metallic' ) . ">Metallic</option>310 <option value='minimalist-round'" . selected( $theme, 'minimalist-round' ) . ">Minimalist Round</option>311 <option value='minimalist-square'" . selected( $theme, 'minimalist-square' ) . ">Minimalist Square</option>611 <option value=''" . selected( $theme, '', false ) . ">Default</option> 612 <option value='construction'" . selected( $theme, 'construction', false ) . ">Construction</option> 613 <option value='cs-portfolio'" . selected( $theme, 'cs-portfolio', false ) . ">CS Portfolio</option> 614 <option value='metallic'" . selected( $theme, 'metallic', false ) . ">Metallic</option> 615 <option value='minimalist-round'" . selected( $theme, 'minimalist-round', false ) . ">Minimalist Round</option> 616 <option value='minimalist-square'" . selected( $theme, 'minimalist-square', false ) . ">Minimalist Square</option> 312 617 </select>"; 313 618 echo "<span class='description'>Select a theme, or leave blank for default</span>"; … … 315 620 316 621 622 /* 623 ** Navigation 624 */ 625 /* Navigation 626 startPanel : 1, // This sets the initial panel 627 hashTags : true, // Should links change the hashtag in the URL? 628 infiniteSlides : true, // if false, the slider will not wrap 629 enableKeyboard : true, // if false, keyboard arrow keys will not work for the current panel. 630 buildArrows : true, // If true, builds the forwards and backwards buttons 631 toggleArrows : false, // if true, side navigation arrows will slide out on hovering & hide @ other times 632 buildNavigation : true, // If true, builds a list of anchor links to link to each panel 633 enableNavigation : true, // if false, navigation links will still be visible, but not clickable. 634 toggleControls : false, // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times 635 appendControlsTo : null, // A HTML element (jQuery Object, selector or HTMLNode) to which the controls will be appended if not null 636 navigationFormatter : null, // Details at the top of the file on this use (advanced use) 637 forwardText : "»", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image) 638 backText : "«", // Link text used to move the slider back (hidden by CSS, replace with arrow image) 639 */ 640 641 function jtd_anything_slides_startPanel_callback() { 642 $options = get_option( 'jtd_anything_slides_options' ); 643 $startPanel = $options['startPanel']; 644 echo "<input id='startPanel' name='jtd_anything_slides_options[startPanel]' type='text' value='$startPanel' />"; 645 echo "<span class='description'>This sets the initial panel</span>"; 646 } 647 function jtd_anything_slides_hashTags_callback() { 648 $options = get_option( 'jtd_anything_slides_options' ); 649 $hashTags = $options['hashTags']; 650 echo "<label>Yes <input id='hashTags' name='jtd_anything_slides_options[hashTags]' type='radio' value='true'" . checked( $hashTags, 'true', false ) . "/></label><br />"; 651 echo "<label>No <input id='hashTags' name='jtd_anything_slides_options[hashTags]' type='radio' value='false'" . checked( $hashTags, 'false', false ) . "/></label>"; 652 echo "<span class='description'>Should links change the hashtag in the URL?</span>"; 653 } 654 function jtd_anything_slides_infinite_callback() { 655 $options = get_option( 'jtd_anything_slides_options' ); 656 $infinite = $options['infinite']; 657 echo "<label>Yes <input id='infinite' name='jtd_anything_slides_options[infinite]' type='radio' value='true'" . checked( $infinite, 'true', false ) . "/></label><br />"; 658 echo "<label>No <input id='infinite' name='jtd_anything_slides_options[infinite]' type='radio' value='false'" . checked( $infinite, 'false', false ) . "/></label>"; 659 echo "<span class='description'>if no, the slider will not wrap</span>"; 660 } 661 function jtd_anything_slides_keyboard_callback() { 662 $options = get_option( 'jtd_anything_slides_options' ); 663 $keyboard = $options['keyboard']; 664 echo "<label>Yes <input id='keyboard' name='jtd_anything_slides_options[keyboard]' type='radio' value='true'" . checked( $keyboard, 'true', false ) . "/></label><br />"; 665 echo "<label>No <input id='keyboard' name='jtd_anything_slides_options[keyboard]' type='radio' value='false'" . checked( $keyboard, 'false', false ) . "/></label>"; 666 echo "<span class='description'>If no, keyboard arrow keys will not work for the current panel</span>"; 667 } 668 function jtd_anything_slides_arrows_callback() { 669 $options = get_option( 'jtd_anything_slides_options' ); 670 $arrows = $options['arrows']; 671 echo "<label>Yes <input id='arrows' name='jtd_anything_slides_options[arrows]' type='radio' value='true'" . checked( $arrows, 'true', false ) . " /></label><br />"; 672 echo "<label>No <input id='arrows' name='jtd_anything_slides_options[arrows]' type='radio' value='false'" . checked( $arrows, 'false', false ) . " /></label>"; 673 echo "<span class='description'>If yes, builds the forwards and backwards buttons</span>"; 674 } 675 function jtd_anything_slides_toggleArrows_callback() { 676 $options = get_option( 'jtd_anything_slides_options' ); 677 $toggleArrows = $options['toggleArrows']; 678 echo "<label>Yes <input id='toggleArrows' name='jtd_anything_slides_options[toggleArrows]' type='radio' value='true'" . checked( $toggleArrows, 'true', false ) . " /></label><br />"; 679 echo "<label>No <input id='toggleArrows' name='jtd_anything_slides_options[toggleArrows]' type='radio' value='false'" . checked( $toggleArrows, 'false', false ) . " /></label>"; 680 echo "<span class='description'>if yes, side navigation arrows will slide out on hovering & hide @ other times</span>"; 681 } 682 function jtd_anything_slides_navigation_callback() { 683 $options = get_option( 'jtd_anything_slides_options' ); 684 $navigation = $options['navigation']; 685 echo "<label>Yes <input id='navigation' name='jtd_anything_slides_options[navigation]' type='radio' value='true'" . checked( $navigation, 'true', false ) . " /></label><br />"; 686 echo "<label>No <input id='navigation' name='jtd_anything_slides_options[navigation]' type='radio' value='false'" . checked( $navigation, 'false', false ) . " /></label>"; 687 echo "<span class='description'>If yes, builds a list of anchor links to link to each panel</span>"; 688 } 689 function jtd_anything_slides_enableNav_callback() { 690 $options = get_option( 'jtd_anything_slides_options' ); 691 $enableNav = $options['enableNav']; 692 echo "<label>Yes <input id='enableNav' name='jtd_anything_slides_options[enableNav]' type='radio' value='true'" . checked( $enableNav, 'true', false ) . " /></label><br />"; 693 echo "<label>No <input id='enableNav' name='jtd_anything_slides_options[enableNav]' type='radio' value='false'" . checked( $enableNav, 'false', false ) . " /></label>"; 694 echo "<span class='description'>if no, navigation links will still be visible, but not clickable.</span>"; 695 } 696 function jtd_anything_slides_toggleContr_callback() { 697 $options = get_option( 'jtd_anything_slides_options' ); 698 $toggleContr = $options['toggleContr']; 699 echo "<label>Yes <input id='toggleContr' name='jtd_anything_slides_options[toggleContr]' type='radio' value='true'" . checked( $toggleContr, 'true', false ) . " /></label><br />"; 700 echo "<label>No <input id='toggleContr' name='jtd_anything_slides_options[toggleContr]' type='radio' value='false'" . checked( $toggleContr, 'false', false ) . " /></label>"; 701 echo "<span class='description'>if yes, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times</span>"; 702 } 703 /* 704 function jtd_anything_slides_navFormatter_callback() { 705 $options = get_option( 'jtd_anything_slides_options' ); 706 $navFormatter = $options['navFormatter']; 707 echo "<label>Yes <input id='navFormatter' name='jtd_anything_slides_options[navFormatter]' type='radio' value='true'" . checked( $autoPlayLocked, 'true', false ) . " /></label><br />"; 708 echo "<label>No <input id='navFormatter' name='jtd_anything_slides_options[navFormatter]' type='radio' value='false'" . checked( $autoPlayLocked, 'false', false ) . " /></label>"; 709 echo "<span class='description'>Details at the top of the file on this use (advanced use).</span>"; 710 } 711 */ 712 function jtd_anything_slides_forwardText_callback() { 713 $options = get_option( 'jtd_anything_slides_options' ); 714 $forwardText = $options['forwardText']; 715 echo "<input id='forwardText' name='jtd_anything_slides_options[forwardText]' type='text' value='$forwardText' />"; 716 echo "<span class='description'>Link text used to move the slider forward (hidden by CSS, replaced with arrow image)</span>"; 717 } 718 function jtd_anything_slides_backText_callback() { 719 $options = get_option( 'jtd_anything_slides_options' ); 720 $backText = $options['backText']; 721 echo "<input id='backText' name='jtd_anything_slides_options[backText]' type='text' value='$backText' />"; 722 echo "<span class='description'>Link text used to move the slider back (hidden by CSS, replace with arrow image)</span>"; 723 } 724 725 726 /* 727 ** Slideshow options 728 */ 729 /* Slideshow options 730 enablePlay : true, // if false, the play/stop button will still be visible, but not clickable. 731 autoPlay : true, // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not 732 autoPlayLocked : false, // If true, user changing slides will not stop the slideshow 733 734 startStopped : false, // If autoPlay is on, this can force it to start stopped 735 pauseOnHover : true, // If true & the slideshow is active, the slideshow will pause on hover 736 resumeOnVideoEnd : true, // If true & the slideshow is active & a youtube video is playing, the autoplay will pause until the video completes 737 stopAtEnd : false, // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false. 738 playRtl : false, // If true, the slideshow will move right-to-left 739 startText : "Start", // Start button text 740 stopText : "Stop", // Stop button text 741 742 delay : 3000, // How long between slideshow transitions in AutoPlay mode (in milliseconds) 743 resumeDelay : 15000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds). 744 animationTime : 600, // How long the slideshow transition takes (in milliseconds) 745 easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin 746 */ 747 function jtd_anything_slides_enablePlay_callback() { 748 $options = get_option( 'jtd_anything_slides_options' ); 749 $enablePlay = $options['enablePlay']; 750 echo "<label>Yes <input id='enablePlay' name='jtd_anything_slides_options[enablePlay]' type='radio' value='true'" . checked( $enablePlay, 'true', false ) . " /></label><br />"; 751 echo "<label>No <input id='enablePlay' name='jtd_anything_slides_options[enablePlay]' type='radio' value='false'" . checked( $enablePlay, 'false', false ) . " /></label>"; 752 echo "<span class='description'>if no, the play/stop button will still be visible, but not clickable.</span>"; 753 } 754 function jtd_anything_slides_autoPlay_callback() { 755 $options = get_option( 'jtd_anything_slides_options' ); 756 $autoPlay = $options['autoPlay']; 757 echo "<label>Yes <input id='autoPlay' name='jtd_anything_slides_options[autoPlay]' type='radio' value='true'" . checked( $autoPlay, 'true', false ) . " /></label><br />"; 758 echo "<label>No <input id='autoPlay' name='jtd_anything_slides_options[autoPlay]' type='radio' value='false'" . checked( $autoPlay, 'false', false ) . " /></label>"; 759 echo "<span class='description'>This turns off the entire slideshow functionality, not just if it starts running or not</span>"; 760 } 761 function jtd_anything_slides_autoPlayLocked_callback() { 762 $options = get_option( 'jtd_anything_slides_options' ); 763 $autoPlayLocked = $options['autoPlayLocked']; 764 echo "<label>Yes <input id='autoPlayLocked' name='jtd_anything_slides_options[autoPlayLocked]' type='radio' value='true'" . checked( $autoPlayLocked, 'true', false ) . " /></label><br />"; 765 echo "<label>No <input id='autoPlayLocked' name='jtd_anything_slides_options[autoPlayLocked]' type='radio' value='false'" . checked( $autoPlayLocked, 'false', false ) . " /></label>"; 766 echo "<span class='description'>If yes, user changing slides will not stop the slideshow</span>"; 767 } 768 769 770 771 772 function jtd_anything_slides_delay_callback() { 773 $options = get_option( 'jtd_anything_slides_options' ); 774 $delay = $options['delay']; 775 echo "<input id='delay' name='jtd_anything_slides_options[delay]' type='number' min=0 value='$delay' />"; 776 echo "<span class='description'>How long between slideshow transitions in AutoPlay mode (in milliseconds)</span>"; 777 } 778 function jtd_anything_slides_resume_callback() { 779 $options = get_option( 'jtd_anything_slides_options' ); 780 $resume = $options['resume']; 781 echo "<input id='resume' name='jtd_anything_slides_options[resume]' type='number' min=0 step='250' value='$resume' />"; 782 echo "<span class='description'>Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds)</span>"; 783 } 784 function jtd_anything_slides_animation_callback() { 785 $options = get_option( 'jtd_anything_slides_options' ); 786 $animation = $options['animation']; 787 echo "<input id='animation' name='jtd_anything_slides_options[animation]' type='number' min=0 value='$animation' />"; 788 echo "<span class='description'>How long the slideshow transition takes (in milliseconds)</span>"; 789 } 790 791 792 793 /* 794 ** Video Settings 795 */ 796 797 function jtd_anything_slides_video_callback() { 798 $options = get_option( 'jtd_anything_slides_options' ); 799 $video = $options['video']; 800 echo "<label>Yes <input id='video' name='jtd_anything_slides_options[video]' type='radio' value='true'" . checked( $video, 'true', false ) . " /></label><br />"; 801 echo "<label>No <input id='video' name='jtd_anything_slides_options[video]' type='radio' value='false'" . checked( $video, 'false', false ) . " /></label>"; 802 echo "<span class='description'>If yes & the slideshow is active & a supported video is playing, it will pause the autoplay until the video is complete. visit <a target='_blank' href='http://proloser.github.com/AnythingSlider/video.html'>GitHub</a> for more info.</span>"; 803 } 804 function jtd_anything_slides_wmode_callback() { 805 $options = get_option( 'jtd_anything_slides_options' ); 806 $wmode = $options['wmode']; 807 echo "<select id='wmode' name='jtd_anything_slides_options[wmode]'> 808 <option value=''" . selected( $wmode, '', false ) . ">Disabled</option> 809 <option value='opaque'" . selected( $wmode, 'opaque', false ) . ">Opaque</option> 810 <option value='transparent'" . selected( $wmode, 'transparent', false ) . ">Transparent</option> 811 </select>"; 812 echo "<span class='description'>If your slider has an embedded object, the script will automatically add a wmode parameter with this setting</span>"; 813 } 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 317 830 // Validate user input (we want numbers only) 318 831 function jtd_anything_slides_validate_options($input) { 319 $themes = array( 'construction', 'cs-portfolio', 'metallic', 'minimalist-round', 'minimalist-square' ); 320 $valid = array(); 321 $valid['width'] = preg_replace( '/[^0-9]/', '', $input['width'] ); 322 $valid['height'] = preg_replace( '/[^0-9]/', '', $input['height'] ); 323 $valid['delay'] = preg_replace( '/[^0-9]/', '', $input['delay'] ); 324 $valid['resume'] = preg_replace( '/[^0-9]/', '', $input['resume'] ); 325 $valid['animation'] = preg_replace( '/[^0-9]/', '', $input['animation'] ); 326 $valid['theme'] = ( in_array( mysql_real_escape_string($input['theme']), $themes ) ) ? $input['theme'] : 'default'; 327 832 $themes = array( 'construction', 'cs-portfolio', 'metallic', 'minimalist-round', 'minimalist-square' ); 833 $wmodes = array( '', 'opaque', 'transparent' ); 834 $boolean = array( 'true', 'false' ); 835 $allowed = array( ); 836 $valid = array(); 837 838 // Appearance 839 $valid['width'] = preg_replace( '/[^0-9]/', '', $input['width'] ); 840 $valid['height'] = preg_replace( '/[^0-9]/', '', $input['height'] ); 841 $valid['expand'] = ( in_array( mysql_real_escape_string($input['expand']), $boolean ) ) ? $input['expand'] : 'false'; 842 $valid['resizeContents'] = ( in_array( mysql_real_escape_string($input['resizeContents']), $boolean ) ) ? $input['resizeContents'] : 'false'; 843 $valid['showMultiple'] = preg_replace( '/[^0-9]/', '', $input['showMultiple'] ); 844 $valid['tooltipClass'] = preg_replace( '/[^A-Za-z0-9_]/', '', $input['tooltipClass'] ); 845 $valid['theme'] = ( in_array( mysql_real_escape_string($input['theme']), $themes ) ) ? $input['theme'] : 'default'; 846 847 848 // Navigation 849 $valid['startPanel'] = preg_replace( '/[^0-9]/', '', $input['startPanel'] ); 850 $valid['hashTags'] = ( in_array( mysql_real_escape_string($input['hashTags']), $boolean ) ) ? $input['hashTags'] : 'false'; 851 $valid['infinite'] = ( in_array( mysql_real_escape_string($input['infinite']), $boolean ) ) ? $input['infinite'] : 'false'; 852 $valid['keyboard'] = ( in_array( mysql_real_escape_string($input['keyboard']), $boolean ) ) ? $input['keyboard'] : 'false'; 853 $valid['arrows'] = ( in_array( mysql_real_escape_string($input['arrows']), $boolean ) ) ? $input['arrows'] : 'false'; 854 $valid['toggleArrows'] = ( in_array( mysql_real_escape_string($input['toggleArrows']), $boolean ) ) ? $input['toggleArrows'] : 'false'; 855 $valid['navigation'] = ( in_array( mysql_real_escape_string($input['navigation']), $boolean ) ) ? $input['navigation'] : 'false'; 856 $valid['enableNav'] = ( in_array( mysql_real_escape_string($input['enableNav']), $boolean ) ) ? $input['enableNav'] : 'false'; 857 $valid['toggleContr'] = ( in_array( mysql_real_escape_string($input['toggleContr']), $boolean ) ) ? $input['toggleContr'] : 'false'; 858 $valid['forwardText'] = esc_html( $input['forwardText'] ); 859 $valid['backText'] = esc_html( $input['backText'] ); 860 861 // Slideshow options 862 $valid['enablePlay'] = ( in_array( mysql_real_escape_string($input['enablePlay']), $boolean ) ) ? $input['enablePlay'] : 'false'; 863 $valid['autoPlay'] = ( in_array( mysql_real_escape_string($input['autoPlay']), $boolean ) ) ? $input['autoPlay'] : 'false'; 864 $valid['autoPlayLocked'] = ( in_array( mysql_real_escape_string($input['autoPlayLocked']), $boolean ) ) ? $input['autoPlayLocked'] : 'false'; 865 $valid['delay'] = preg_replace( '/[^0-9]/', '', $input['delay'] ); 866 $valid['resume'] = preg_replace( '/[^0-9]/', '', $input['resume'] ); 867 $valid['animation'] = preg_replace( '/[^0-9]/', '', $input['animation'] ); 868 869 870 // Video Settings 871 $valid['video'] = ( in_array( mysql_real_escape_string($input['video']), $boolean ) ) ? $input['video'] : 'false'; 872 $valid['wmode'] = ( in_array( mysql_real_escape_string($input['wmode']), $wmodes ) ) ? $input['wmode'] : 'false'; 873 874 875 876 877 878 879 880 881 882 /* 883 // Slideshow options 884 startStopped : false, // If autoPlay is on, this can force it to start stopped 885 pauseOnHover : true, // If true & the slideshow is active, the slideshow will pause on hover 886 resumeOnVideoEnd : true, // If true & the slideshow is active & a youtube video is playing, the autoplay will pause until the video completes 887 stopAtEnd : false, // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false. 888 playRtl : false, // If true, the slideshow will move right-to-left 889 startText : "Start", // Start button text 890 stopText : "Stop", // Stop button text 891 delay : 3000, // How long between slideshow transitions in AutoPlay mode (in milliseconds) 892 resumeDelay : 15000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds). 893 animationTime : 600, // How long the slideshow transition takes (in milliseconds) 894 easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin 895 896 */ 897 898 328 899 if( $valid['width'] != $input['width'] ) { 329 900 add_settings_error( … … 370 941 } 371 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 // Set default options at activation 957 function jtd_anything_slides_set_defaults() { 958 959 $tmp = get_option( 'jtd_anything_slides_options' ); 960 961 if ( ( !is_array( $tmp ) ) ) { 962 $o = array( 963 'width' => '570', // Override the default CSS width 964 'height' => '190', // Override the default CSS height 965 'expand' => 'false', // If true, the entire slider will expand to fit the parent element 966 'resizeContents' => 'true', // If true, solitary images/objects in the panel will expand to fit the viewport 967 'showMultiple' => 1, // Set this value to a number and it will show that many slides at once 968 'tooltipClass' => 'tooltip', // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent) 969 'theme' => 'default', 970 971 'startPanel' => 1, // This sets the initial panel 972 'hashTags' => 'true', // Should links change the hashtag in the URL? 973 'infinite' => 'true', // if false, the slider will not wrap 974 'keyboard' => 'true', // if false, keyboard arrow keys will not work for the current panel. 975 'arrows' => 'true', // If 'true', builds the forwards and backwards buttons 976 'toggleArrows' => 'false', // if 'true', side navigation arrows will slide out on hovering & hide @ other times 977 'navigation' => 'true', // If 'true', builds a list of anchor links to link to each panel 978 'enableNav' => 'true', // if 'false', navigation links will still be visible, but not clickable. 979 'toggleControls' => 'false', // if 'true', slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times 980 'appendControlsTo' => null, // A HTML element (jQuery Object, selector or HTMLNode) to which the controls will be appended if not null 981 'navigationFormatter' => null, // Details at the top of the file on this use (advanced use) 982 'forwardText' => "»", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image) 983 'backText' => "«", // Link text used to move the slider back (hidden by CSS, replace with arrow image) 984 985 'enablePlay' => 'true', // if 'false', the play/stop button will still be visible, but not clickable. 986 'autoPlay' => 'true', // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not 987 'autoPlayLocked' => 'false', // If 'true', user changing slides will not stop the slideshow 988 'startStopped' => 'false', // If autoPlay is on, this can force it to start stopped 989 'pauseOnHover' => 'true', // If 'true' & the slideshow is active, the slideshow will pause on hover 990 'resumeOnVideo' => 'true', // If 'true' & the slideshow is active & a youtube video is playing, the autoplay will pause until the video completes 991 'stopAtEnd' => 'false', // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is 'false'. 992 'playRtl' => 'false', // If true, the slideshow will move right-to-left 993 'startText' => "Start", // Start button text 994 'stopText' => "Stop", // Stop button text 995 'delay' => 3000, // How long between slideshow transitions in AutoPlay mode (in milliseconds) 996 'resume' => 15000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds). 997 'animation' => 600, // How long the slideshow transition takes (in milliseconds) 998 'easing' => "swing", // Anything other than "linear" or "swing" requires the easing plugin 999 1000 'video' => 'false', 1001 'wmode' => 'disabled' 1002 1003 ); 1004 1005 } 1006 1007 update_option( 'jtd_anything_slides_options', $o ); 1008 1009 } 1010 register_activation_hook(__FILE__, 'jtd_anything_slides_set_defaults'); 1011 1012 1013 1014 1015 1016 1017 1018 1019 // Add an upgrade warning 1020 /* 1021 if ( is_admin() ) { 1022 add_action( 'in_plugin_update_message-' . plugin_basename(__FILE__), 'jtd_anything_slides_upgrade_notice' ); 1023 } 1024 function jtd_anything_slides_upgrade_notice() { 1025 $info = __( ' ATTENTION! After updating this plugin, you will need to update your settings on the the <a href="options-general.php?page=anything_slider">Settings Page</a>.', MY_TEXTDOMAIN ); 1026 echo '<span style="color:red;">' . strip_tags( $info, '<br><a><b><i><span>' ) . '</span>'; 1027 } 1028 */ 1029 1030 -
anythingslider-for-wordpress/trunk/readme.txt
r402274 r405807 10 10 Requires at least: 3.0 11 11 Tested up to: 3.2 12 Stable tag: 0.5.1 12 Stable tag: 0.6 13 13 14 14 15 Integrates Chris Coyier's popular AnythingSlider jQuery plugin with WordPress. 15 16 16 == Description == 17 == Description == 17 18 18 19 AnythingSlider for WordPress integrates Chris Coyier's popular AnythingSlider jQuery plugin with WordPress. 19 20 20 21 Based on the hard work of folks like Doug Neiner, ProLoser and Mottie, this plugin adds a plethora of flexible functionality to any WordPress theme. By using the [anything_slides] shortcode anywhere in your theme, you can add a unique and highly customizable slideshow to any post or page. 22 23 For more details and a few video tutorials, visit <a href="http://missingpiecestudios.com" target="_blank">Missing Piece Studios</a>. 24 25 Check out the <a href="http://wordpress.org/extend/plugins/anythingslider-for-wordpress/faq/">FAQ</a> for more details. 26 27 28 = Changelog = 29 30 = 0.6 = 31 32 * Added a new option for Navigation Formatting! Check out the FAQ for more details. * 33 * Update plugin scripts/css to version 1.7.1 * 34 * Fixed a bug with the video extension script loader * 35 * Updated a few options that are included or deprecated in version 1.7.1 of the jQuery plugin * 36 37 = 0.5.1 = 38 39 * Update JS to latest version of the jQuery plugin * 40 41 = 0.5 = 42 43 * Fixed an error when loading custom CSS from Theme directory. Add anythingslider.css to your theme, if you'd like to use a custom CSS file. 44 * Fixed an error with the new Video script. 45 46 = 0.4 = 47 48 * Upgraded to AnythingSlider 1.6 49 * Added support for Video Playback options 50 51 = 0.3 = 52 53 * More bug fixes 54 * Support for custom CSS file - Add anythingslider.css to your theme folder or your theme's CSS folder (overrides the default CSS) 55 * Cleaned up the settings page descriptions to be more clear/intuitive 56 * Added a ton of options to the settings page 57 * Added a few options to the shortcode 58 * Improved documentation 59 60 = 0.2 = 61 62 * Many bug fixes 63 * Added a variety of new global options 64 65 = 0.1 = 66 67 Initial release. Many improvements to come! 21 68 22 69 == Installation == … … 41 88 == Changelog == 42 89 90 = 0.5a = 91 92 * Fixed an error when loading custom CSS from Theme directory. Add anythingslider.css to your theme, if you'd like to use a custom CSS file. 93 * Fixed an error with the new Video script. 94 95 = 0.4 = 96 97 * Upgraded to AnythingSlider 1.6 98 * Added support for Video Playback options 99 100 = 0.3 = 101 102 * More bug fixes 103 * Support for custom CSS file - Add anythingslider.css to your theme folder or your theme's CSS folder (overrides the default CSS) 104 * Cleaned up the settings page descriptions to be more clear/intuitive 105 * Added a ton of options to the settings page 106 * Added a few options to the shortcode 107 * Improved documentation 108 109 = 0.2 = 110 111 * Many bug fixes 112 * Added a variety of new global options 113 114 = 0.1 = 115 43 116 Initial release. Many improvements to come! 44 117 … … 61 134 = How can I add this to a theme file? = 62 135 63 Easy. Just use the standard method of embedding shortcodes into theme files: `<?php do_shortcode( "[anything_slides]" ); ?>` 136 Easy. Just use the standard method of embedding shortcodes into theme files: `<?php echo do_shortcode( "[anything_slides]" ); ?>` 137 138 For more information about this plugin, and to watch a few videos, check out <a href="http://missingpiecestudios.com" target="_blank">Missing Piece Studios</a>. 139 140 For more information about the jQuery plugin, visit <a href="http://proloser.github.com/AnythingSlider/" target="_blank">this GitHub repo</a>. 141 142 = How do I customize the CSS for my slideshows? = 143 144 Simply add the file 'anythingslider.css' to your theme directory, or your theme's CSS directory. That's it. The plugin will detect the file's existence and do the heavy lifting for you. 145 146 = How do I use the new Navigation Formatter feature = 147 148 You'll notice on the Slides post/page there is a new metabox for Navigation Formatter. Add the text you'd like to use into this box. 149 150 Next add the new attribute to the shortcode wherever you'd like to use custom navigation formatting. 151 152 The shortcode has a new attribute `navFormat`. The existence of this attribute in your shortcode call will grab the text you just entered and use that for the navigation title. 153 154 If that's too confusing... which it probably is, check out a how-to video at <a href="http://missingpiecestudios.com" target="_blank">Missing Piece Studios</a>. 64 155 65 156
Note: See TracChangeset
for help on using the changeset viewer.