Advertisement
Guest User

Untitled

a guest
Jun 19th, 2014
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 108.97 KB | None | 0 0
  1. /**
  2. * hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
  3. * <http://cherne.net/brian/resources/jquery.hoverIntent.html>
  4. *
  5. * @param f onMouseOver function || An object with configuration options
  6. * @param g onMouseOut function || Nothing (use configuration options object)
  7. * @author Brian Cherne brian(at)cherne(dot)net
  8. */
  9. (function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);
  10.  
  11.  
  12.  
  13. //=====================================================
  14.  
  15.  
  16. /*
  17. * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
  18. *
  19. * Uses the built in easing capabilities added In jQuery 1.1
  20. * to offer multiple easing options
  21. *
  22. * TERMS OF USE - jQuery Easing
  23. *
  24. * Open source under the BSD License.
  25. *
  26. * Copyright © 2008 George McGinley Smith
  27. * All rights reserved.
  28. *
  29. * Redistribution and use in source and binary forms, with or without modification,
  30. * are permitted provided that the following conditions are met:
  31. *
  32. * Redistributions of source code must retain the above copyright notice, this list of
  33. * conditions and the following disclaimer.
  34. * Redistributions in binary form must reproduce the above copyright notice, this list
  35. * of conditions and the following disclaimer in the documentation and/or other materials
  36. * provided with the distribution.
  37. *
  38. * Neither the name of the author nor the names of contributors may be used to endorse
  39. * or promote products derived from this software without specific prior written permission.
  40. *
  41. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  42. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  43. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  44. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  45. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  46. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  47. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  48. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  49. * OF THE POSSIBILITY OF SUCH DAMAGE.
  50. *
  51. */
  52.  
  53. // t: current time, b: begInnIng value, c: change In value, d: duration
  54. jQuery.easing['jswing'] = jQuery.easing['swing'];
  55.  
  56. jQuery.extend( jQuery.easing,
  57. {
  58. def: 'easeOutQuad',
  59. swing: function (x, t, b, c, d) {
  60. //alert(jQuery.easing.default);
  61. return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
  62. },
  63. easeInQuad: function (x, t, b, c, d) {
  64. return c*(t/=d)*t + b;
  65. },
  66. easeOutQuad: function (x, t, b, c, d) {
  67. return -c *(t/=d)*(t-2) + b;
  68. },
  69. easeInOutQuad: function (x, t, b, c, d) {
  70. if ((t/=d/2) < 1) return c/2*t*t + b;
  71. return -c/2 * ((--t)*(t-2) - 1) + b;
  72. },
  73. easeInCubic: function (x, t, b, c, d) {
  74. return c*(t/=d)*t*t + b;
  75. },
  76. easeOutCubic: function (x, t, b, c, d) {
  77. return c*((t=t/d-1)*t*t + 1) + b;
  78. },
  79. easeInOutCubic: function (x, t, b, c, d) {
  80. if ((t/=d/2) < 1) return c/2*t*t*t + b;
  81. return c/2*((t-=2)*t*t + 2) + b;
  82. },
  83. easeInQuart: function (x, t, b, c, d) {
  84. return c*(t/=d)*t*t*t + b;
  85. },
  86. easeOutQuart: function (x, t, b, c, d) {
  87. return -c * ((t=t/d-1)*t*t*t - 1) + b;
  88. },
  89. easeInOutQuart: function (x, t, b, c, d) {
  90. if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
  91. return -c/2 * ((t-=2)*t*t*t - 2) + b;
  92. },
  93. easeInQuint: function (x, t, b, c, d) {
  94. return c*(t/=d)*t*t*t*t + b;
  95. },
  96. easeOutQuint: function (x, t, b, c, d) {
  97. return c*((t=t/d-1)*t*t*t*t + 1) + b;
  98. },
  99. easeInOutQuint: function (x, t, b, c, d) {
  100. if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
  101. return c/2*((t-=2)*t*t*t*t + 2) + b;
  102. },
  103. easeInSine: function (x, t, b, c, d) {
  104. return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
  105. },
  106. easeOutSine: function (x, t, b, c, d) {
  107. return c * Math.sin(t/d * (Math.PI/2)) + b;
  108. },
  109. easeInOutSine: function (x, t, b, c, d) {
  110. return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
  111. },
  112. easeInExpo: function (x, t, b, c, d) {
  113. return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
  114. },
  115. easeOutExpo: function (x, t, b, c, d) {
  116. return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
  117. },
  118. easeInOutExpo: function (x, t, b, c, d) {
  119. if (t==0) return b;
  120. if (t==d) return b+c;
  121. if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
  122. return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
  123. },
  124. easeInCirc: function (x, t, b, c, d) {
  125. return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
  126. },
  127. easeOutCirc: function (x, t, b, c, d) {
  128. return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
  129. },
  130. easeInOutCirc: function (x, t, b, c, d) {
  131. if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
  132. return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
  133. },
  134. easeInElastic: function (x, t, b, c, d) {
  135. var s=1.70158;var p=0;var a=c;
  136. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  137. if (a < Math.abs(c)) { a=c; var s=p/4; }
  138. else var s = p/(2*Math.PI) * Math.asin (c/a);
  139. return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  140. },
  141. easeOutElastic: function (x, t, b, c, d) {
  142. var s=1.70158;var p=0;var a=c;
  143. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  144. if (a < Math.abs(c)) { a=c; var s=p/4; }
  145. else var s = p/(2*Math.PI) * Math.asin (c/a);
  146. return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
  147. },
  148. easeInOutElastic: function (x, t, b, c, d) {
  149. var s=1.70158;var p=0;var a=c;
  150. if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
  151. if (a < Math.abs(c)) { a=c; var s=p/4; }
  152. else var s = p/(2*Math.PI) * Math.asin (c/a);
  153. if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  154. return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
  155. },
  156. easeInBack: function (x, t, b, c, d, s) {
  157. if (s == undefined) s = 1.70158;
  158. return c*(t/=d)*t*((s+1)*t - s) + b;
  159. },
  160. easeOutBack: function (x, t, b, c, d, s) {
  161. if (s == undefined) s = 1.70158;
  162. return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
  163. },
  164. easeInOutBack: function (x, t, b, c, d, s) {
  165. if (s == undefined) s = 1.70158;
  166. if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
  167. return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
  168. },
  169. easeInBounce: function (x, t, b, c, d) {
  170. return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
  171. },
  172. easeOutBounce: function (x, t, b, c, d) {
  173. if ((t/=d) < (1/2.75)) {
  174. return c*(7.5625*t*t) + b;
  175. } else if (t < (2/2.75)) {
  176. return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
  177. } else if (t < (2.5/2.75)) {
  178. return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
  179. } else {
  180. return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
  181. }
  182. },
  183. easeInOutBounce: function (x, t, b, c, d) {
  184. if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
  185. return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
  186. }
  187. });
  188.  
  189. /*
  190. *
  191. * TERMS OF USE - EASING EQUATIONS
  192. *
  193. * Open source under the BSD License.
  194. *
  195. * Copyright © 2001 Robert Penner
  196. * All rights reserved.
  197. *
  198. * Redistribution and use in source and binary forms, with or without modification,
  199. * are permitted provided that the following conditions are met:
  200. *
  201. * Redistributions of source code must retain the above copyright notice, this list of
  202. * conditions and the following disclaimer.
  203. * Redistributions in binary form must reproduce the above copyright notice, this list
  204. * of conditions and the following disclaimer in the documentation and/or other materials
  205. * provided with the distribution.
  206. *
  207. * Neither the name of the author nor the names of contributors may be used to endorse
  208. * or promote products derived from this software without specific prior written permission.
  209. *
  210. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  211. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  212. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  213. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  214. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  215. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  216. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  217. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  218. * OF THE POSSIBILITY OF SUCH DAMAGE.
  219. *
  220. */
  221.  
  222.  
  223.  
  224.  
  225.  
  226. //=========================================================================
  227. /* ------------------------------------------------------------------------
  228. Class: prettyPhoto
  229. Use: Lightbox clone for jQuery
  230. Author: Stephane Caron (http://www.no-margin-for-errors.com)
  231. Version: 3.1.3
  232. ------------------------------------------------------------------------- */
  233.  
  234. (function($){$.prettyPhoto={version:'3.1.3'};$.fn.prettyPhoto=function(pp_settings){pp_settings=jQuery.extend({animation_speed:'fast',slideshow:5000,autoplay_slideshow:false,opacity:0.80,show_title:true,allow_resize:true,default_width:500,default_height:344,counter_separator_label:'/',theme:'pp_default',horizontal_padding:20,hideflash:false,wmode:'opaque',autoplay:true,modal:false,deeplinking:true,overlay_gallery:true,keyboard_shortcuts:true,changepicturecallback:function(){},callback:function(){},ie6_fallback:true,markup:'<div class="pp_pic_holder"> \
  235. <div class="ppt">&nbsp;</div> \
  236. <div class="pp_top"> \
  237. <div class="pp_left"></div> \
  238. <div class="pp_middle"></div> \
  239. <div class="pp_right"></div> \
  240. </div> \
  241. <div class="pp_content_container"> \
  242. <div class="pp_left"> \
  243. <div class="pp_right"> \
  244. <div class="pp_content"> \
  245. <div class="pp_loaderIcon"></div> \
  246. <div class="pp_fade"> \
  247. <a href="#" class="pp_expand" title="Expand the image">Expand</a> \
  248. <div class="pp_hoverContainer"> \
  249. <a class="pp_next" href="#">next</a> \
  250. <a class="pp_previous" href="#">previous</a> \
  251. </div> \
  252. <div id="pp_full_res"></div> \
  253. <div class="pp_details"> \
  254. <div class="pp_nav"> \
  255. <a href="#" class="pp_arrow_previous">Previous</a> \
  256. <p class="currentTextHolder">0/0</p> \
  257. <a href="#" class="pp_arrow_next">Next</a> \
  258. </div> \
  259. <p class="pp_description"></p> \
  260. <div class="pp_social">{pp_social}</div> \
  261. <a class="pp_close" href="#">Close</a> \
  262. </div> \
  263. </div> \
  264. </div> \
  265. </div> \
  266. </div> \
  267. </div> \
  268. <div class="pp_bottom"> \
  269. <div class="pp_left"></div> \
  270. <div class="pp_middle"></div> \
  271. <div class="pp_right"></div> \
  272. </div> \
  273. </div> \
  274. <div class="pp_overlay"></div>',gallery_markup:'<div class="pp_gallery"> \
  275. <a href="#" class="pp_arrow_previous">Previous</a> \
  276. <div> \
  277. <ul> \
  278. {gallery} \
  279. </ul> \
  280. </div> \
  281. <a href="#" class="pp_arrow_next">Next</a> \
  282. </div>',image_markup:'<img id="fullResImage" src="{path}" />',flash_markup:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',quicktime_markup:'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',iframe_markup:'<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',inline_markup:'<div class="pp_inline">{content}</div>',custom_markup:'',social_tools:'<div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="http://www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>'},pp_settings);var matchedObjects=this,percentBased=false,pp_dimensions,pp_open,pp_contentHeight,pp_contentWidth,pp_containerHeight,pp_containerWidth,windowHeight=$(window).height(),windowWidth=$(window).width(),pp_slideshow;doresize=true,scroll_pos=_get_scroll();$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){_center_overlay();_resize_overlay();});if(pp_settings.keyboard_shortcuts){$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){if(typeof $pp_pic_holder!='undefined'){if($pp_pic_holder.is(':visible')){switch(e.keyCode){case 37:$.prettyPhoto.changePage('previous');e.preventDefault();break;case 39:$.prettyPhoto.changePage('next');e.preventDefault();break;case 27:if(!settings.modal)
  283. $.prettyPhoto.close();e.preventDefault();break;};};};});};$.prettyPhoto.initialize=function(){settings=pp_settings;if(settings.theme=='pp_default')settings.horizontal_padding=16;if(settings.ie6_fallback&&$.browser.msie&&parseInt($.browser.version)==6)settings.theme="light_square";theRel=$(this).attr('rel');galleryRegExp=/\[(?:.*)\]/;isSet=(galleryRegExp.exec(theRel))?true:false;pp_images=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return $(n).attr('href');}):$.makeArray($(this).attr('href'));pp_titles=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return($(n).find('img').attr('alt'))?$(n).find('img').attr('alt'):"";}):$.makeArray($(this).find('img').attr('alt'));pp_descriptions=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return($(n).attr('title'))?$(n).attr('title'):"";}):$.makeArray($(this).attr('title'));if(pp_images.length>30)settings.overlay_gallery=false;set_position=jQuery.inArray($(this).attr('href'),pp_images);rel_index=(isSet)?set_position:$("a[rel^='"+theRel+"']").index($(this));_build_overlay(this);if(settings.allow_resize)
  284. $(window).bind('scroll.prettyphoto',function(){_center_overlay();});$.prettyPhoto.open();return false;}
  285. $.prettyPhoto.open=function(event){if(typeof settings=="undefined"){settings=pp_settings;if($.browser.msie&&$.browser.version==6)settings.theme="light_square";pp_images=$.makeArray(arguments[0]);pp_titles=(arguments[1])?$.makeArray(arguments[1]):$.makeArray("");pp_descriptions=(arguments[2])?$.makeArray(arguments[2]):$.makeArray("");isSet=(pp_images.length>1)?true:false;set_position=0;_build_overlay(event.target);}
  286. if($.browser.msie&&$.browser.version==6)$('select').css('visibility','hidden');if(settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden');_checkPosition($(pp_images).size());$('.pp_loaderIcon').show();if(settings.deeplinking)
  287. setHashtag();if(settings.social_tools){facebook_like_link=settings.social_tools.replace('{location_href}',encodeURIComponent(location.href));$pp_pic_holder.find('.pp_social').html(facebook_like_link);}
  288. if($ppt.is(':hidden'))$ppt.css('opacity',0).show();$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);$pp_pic_holder.find('.currentTextHolder').text((set_position+1)+settings.counter_separator_label+$(pp_images).size());if(pp_descriptions[set_position]!=""){$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));}else{$pp_pic_holder.find('.pp_description').hide();}
  289. movie_width=(parseFloat(getParam('width',pp_images[set_position])))?getParam('width',pp_images[set_position]):settings.default_width.toString();movie_height=(parseFloat(getParam('height',pp_images[set_position])))?getParam('height',pp_images[set_position]):settings.default_height.toString();percentBased=false;if(movie_height.indexOf('%')!=-1){movie_height=parseFloat(($(window).height()*parseFloat(movie_height)/100)-150);percentBased=true;}
  290. if(movie_width.indexOf('%')!=-1){movie_width=parseFloat(($(window).width()*parseFloat(movie_width)/100)-150);percentBased=true;}
  291. $pp_pic_holder.fadeIn(function(){(settings.show_title&&pp_titles[set_position]!=""&&typeof pp_titles[set_position]!="undefined")?$ppt.html(unescape(pp_titles[set_position])):$ppt.html('&nbsp;');imgPreloader="";skipInjection=false;switch(_getFileType(pp_images[set_position])){case'image':imgPreloader=new Image();nextImage=new Image();if(isSet&&set_position<$(pp_images).size()-1)nextImage.src=pp_images[set_position+1];prevImage=new Image();if(isSet&&pp_images[set_position-1])prevImage.src=pp_images[set_position-1];$pp_pic_holder.find('#pp_full_res')[0].innerHTML=settings.image_markup.replace(/{path}/g,pp_images[set_position]);imgPreloader.onload=function(){pp_dimensions=_fitToViewport(imgPreloader.width,imgPreloader.height);_showContent();};imgPreloader.onerror=function(){alert('Image cannot be loaded. Make sure the path is correct and image exist.');$.prettyPhoto.close();};imgPreloader.src=pp_images[set_position];break;case'youtube':pp_dimensions=_fitToViewport(movie_width,movie_height);movie_id=getParam('v',pp_images[set_position]);if(movie_id==""){movie_id=pp_images[set_position].split('youtu.be/');movie_id=movie_id[1];if(movie_id.indexOf('?')>0)
  292. movie_id=movie_id.substr(0,movie_id.indexOf('?'));if(movie_id.indexOf('&')>0)
  293. movie_id=movie_id.substr(0,movie_id.indexOf('&'));}
  294. movie='http://www.youtube.com/embed/'+movie_id;(getParam('rel',pp_images[set_position]))?movie+="?rel="+getParam('rel',pp_images[set_position]):movie+="?rel=1";if(settings.autoplay)movie+="&autoplay=1";toInject=settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case'vimeo':pp_dimensions=_fitToViewport(movie_width,movie_height);movie_id=pp_images[set_position];var regExp=/http:\/\/(www\.)?vimeo.com\/(\d+)/;var match=movie_id.match(regExp);movie='http://player.vimeo.com/video/'+match[2]+'?title=0&amp;byline=0&amp;portrait=0';if(settings.autoplay)movie+="&autoplay=1;";vimeo_width=pp_dimensions['width']+'/embed/?moog_width='+pp_dimensions['width'];toInject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);break;case'quicktime':pp_dimensions=_fitToViewport(movie_width,movie_height);pp_dimensions['height']+=15;pp_dimensions['contentHeight']+=15;pp_dimensions['containerHeight']+=15;toInject=settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);break;case'flash':pp_dimensions=_fitToViewport(movie_width,movie_height);flash_vars=pp_images[set_position];flash_vars=flash_vars.substring(pp_images[set_position].indexOf('flashvars')+10,pp_images[set_position].length);filename=pp_images[set_position];filename=filename.substring(0,filename.indexOf('?'));toInject=settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);break;case'iframe':pp_dimensions=_fitToViewport(movie_width,movie_height);frame_url=pp_images[set_position];frame_url=frame_url.substr(0,frame_url.indexOf('iframe')-1);toInject=settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);break;case'ajax':doresize=false;pp_dimensions=_fitToViewport(movie_width,movie_height);doresize=true;skipInjection=true;$.get(pp_images[set_position],function(responseHTML){toInject=settings.inline_markup.replace(/{content}/g,responseHTML);$pp_pic_holder.find('#pp_full_res')[0].innerHTML=toInject;_showContent();});break;case'custom':pp_dimensions=_fitToViewport(movie_width,movie_height);toInject=settings.custom_markup;break;case'inline':myClone=$(pp_images[set_position]).clone().append('<br clear="all" />').css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();doresize=false;pp_dimensions=_fitToViewport($(myClone).width(),$(myClone).height());doresize=true;$(myClone).remove();toInject=settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());break;};if(!imgPreloader&&!skipInjection){$pp_pic_holder.find('#pp_full_res')[0].innerHTML=toInject;_showContent();};});return false;};$.prettyPhoto.changePage=function(direction){currentGalleryPage=0;if(direction=='previous'){set_position--;if(set_position<0)set_position=$(pp_images).size()-1;}else if(direction=='next'){set_position++;if(set_position>$(pp_images).size()-1)set_position=0;}else{set_position=direction;};rel_index=set_position;if(!doresize)doresize=true;$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');_hideContent(function(){$.prettyPhoto.open();});};$.prettyPhoto.changeGalleryPage=function(direction){if(direction=='next'){currentGalleryPage++;if(currentGalleryPage>totalPage)currentGalleryPage=0;}else if(direction=='previous'){currentGalleryPage--;if(currentGalleryPage<0)currentGalleryPage=totalPage;}else{currentGalleryPage=direction;};slide_speed=(direction=='next'||direction=='previous')?settings.animation_speed:0;slide_to=currentGalleryPage*(itemsPerPage*itemWidth);$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);};$.prettyPhoto.startSlideshow=function(){if(typeof pp_slideshow=='undefined'){$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){$.prettyPhoto.stopSlideshow();return false;});pp_slideshow=setInterval($.prettyPhoto.startSlideshow,settings.slideshow);}else{$.prettyPhoto.changePage('next');};}
  295. $.prettyPhoto.stopSlideshow=function(){$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){$.prettyPhoto.startSlideshow();return false;});clearInterval(pp_slideshow);pp_slideshow=undefined;}
  296. $.prettyPhoto.close=function(){if($pp_overlay.is(":animated"))return;$.prettyPhoto.stopSlideshow();$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){$(this).remove();});$pp_overlay.fadeOut(settings.animation_speed,function(){if($.browser.msie&&$.browser.version==6)$('select').css('visibility','visible');if(settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible');$(this).remove();$(window).unbind('scroll.prettyphoto');clearHashtag();settings.callback();doresize=true;pp_open=false;delete settings;});};function _showContent(){$('.pp_loaderIcon').hide();projectedTop=scroll_pos['scrollTop']+((windowHeight/2)-(pp_dimensions['containerHeight']/2));if(projectedTop<0)projectedTop=0;$ppt.fadeTo(settings.animation_speed,1);$pp_pic_holder.find('.pp_content').animate({height:pp_dimensions['contentHeight'],width:pp_dimensions['contentWidth']},settings.animation_speed);$pp_pic_holder.animate({'top':projectedTop,'left':(windowWidth/2)-(pp_dimensions['containerWidth']/2),width:pp_dimensions['containerWidth']},settings.animation_speed,function(){$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed);if(isSet&&_getFileType(pp_images[set_position])=="image"){$pp_pic_holder.find('.pp_hoverContainer').show();}else{$pp_pic_holder.find('.pp_hoverContainer').hide();}
  297. if(pp_dimensions['resized']){$('a.pp_expand,a.pp_contract').show();}else{$('a.pp_expand').hide();}
  298. if(settings.autoplay_slideshow&&!pp_slideshow&&!pp_open)$.prettyPhoto.startSlideshow();settings.changepicturecallback();pp_open=true;});_insert_gallery();};function _hideContent(callback){$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){$('.pp_loaderIcon').show();callback();});};function _checkPosition(setCount){(setCount>1)?$('.pp_nav').show():$('.pp_nav').hide();};function _fitToViewport(width,height){resized=false;_getDimensions(width,height);imageWidth=width,imageHeight=height;if(((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight))&&doresize&&settings.allow_resize&&!percentBased){resized=true,fitting=false;while(!fitting){if((pp_containerWidth>windowWidth)){imageWidth=(windowWidth-200);imageHeight=(height/width)*imageWidth;}else if((pp_containerHeight>windowHeight)){imageHeight=(windowHeight-200);imageWidth=(width/height)*imageHeight;}else{fitting=true;};pp_containerHeight=imageHeight,pp_containerWidth=imageWidth;};_getDimensions(imageWidth,imageHeight);if((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight)){_fitToViewport(pp_containerWidth,pp_containerHeight)};};return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(pp_containerHeight),containerWidth:Math.floor(pp_containerWidth)+(settings.horizontal_padding*2),contentHeight:Math.floor(pp_contentHeight),contentWidth:Math.floor(pp_contentWidth),resized:resized};};function _getDimensions(width,height){width=parseFloat(width);height=parseFloat(height);$pp_details=$pp_pic_holder.find('.pp_details');$pp_details.width(width);detailsHeight=parseFloat($pp_details.css('marginTop'))+parseFloat($pp_details.css('marginBottom'));$pp_details=$pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({'position':'absolute','top':-10000});detailsHeight+=$pp_details.height();detailsHeight=(detailsHeight<=34)?36:detailsHeight;if($.browser.msie&&$.browser.version==7)detailsHeight+=8;$pp_details.remove();$pp_title=$pp_pic_holder.find('.ppt');$pp_title.width(width);titleHeight=parseFloat($pp_title.css('marginTop'))+parseFloat($pp_title.css('marginBottom'));$pp_title=$pp_title.clone().appendTo($('body')).css({'position':'absolute','top':-10000});titleHeight+=$pp_title.height();$pp_title.remove();pp_contentHeight=height+detailsHeight;pp_contentWidth=width;pp_containerHeight=pp_contentHeight+titleHeight+$pp_pic_holder.find('.pp_top').height()+$pp_pic_holder.find('.pp_bottom').height();pp_containerWidth=width;}
  299. function _getFileType(itemSrc){if(itemSrc.match(/youtube\.com\/watch/i)||itemSrc.match(/youtu\.be/i)){return'youtube';}else if(itemSrc.match(/vimeo\.com/i)){return'vimeo';}else if(itemSrc.match(/\b.mov\b/i)){return'quicktime';}else if(itemSrc.match(/\b.swf\b/i)){return'flash';}else if(itemSrc.match(/\biframe=true\b/i)){return'iframe';}else if(itemSrc.match(/\bajax=true\b/i)){return'ajax';}else if(itemSrc.match(/\bcustom=true\b/i)){return'custom';}else if(itemSrc.substr(0,1)=='#'){return'inline';}else{return'image';};};function _center_overlay(){if(doresize&&typeof $pp_pic_holder!='undefined'){scroll_pos=_get_scroll();contentHeight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width();projectedTop=(windowHeight/2)+scroll_pos['scrollTop']-(contentHeight/2);if(projectedTop<0)projectedTop=0;if(contentHeight>windowHeight)
  300. return;$pp_pic_holder.css({'top':projectedTop,'left':(windowWidth/2)+scroll_pos['scrollLeft']-(contentwidth/2)});};};function _get_scroll(){if(self.pageYOffset){return{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};}else if(document.documentElement&&document.documentElement.scrollTop){return{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};}else if(document.body){return{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};};};function _resize_overlay(){windowHeight=$(window).height(),windowWidth=$(window).width();if(typeof $pp_overlay!="undefined")$pp_overlay.height($(document).height()).width(windowWidth);};function _insert_gallery(){if(isSet&&settings.overlay_gallery&&_getFileType(pp_images[set_position])=="image"&&(settings.ie6_fallback&&!($.browser.msie&&parseInt($.browser.version)==6))){itemWidth=52+5;navWidth=(settings.theme=="facebook"||settings.theme=="pp_default")?50:30;itemsPerPage=Math.floor((pp_dimensions['containerWidth']-100-navWidth)/itemWidth);itemsPerPage=(itemsPerPage<pp_images.length)?itemsPerPage:pp_images.length;totalPage=Math.ceil(pp_images.length/itemsPerPage)-1;if(totalPage==0){navWidth=0;$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();}else{$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();};galleryWidth=itemsPerPage*itemWidth;fullGalleryWidth=pp_images.length*itemWidth;$pp_gallery.css('margin-left',-((galleryWidth/2)+(navWidth/2))).find('div:first').width(galleryWidth+5).find('ul').width(fullGalleryWidth).find('li.selected').removeClass('selected');goToPage=(Math.floor(set_position/itemsPerPage)<totalPage)?Math.floor(set_position/itemsPerPage):totalPage;$.prettyPhoto.changeGalleryPage(goToPage);$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');}else{$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');}}
  301. function _build_overlay(caller){if(settings.social_tools)
  302. facebook_like_link=settings.social_tools.replace('{location_href}',encodeURIComponent(location.href));settings.markup=settings.markup.replace('{pp_social}',(settings.social_tools)?facebook_like_link:'');$('body').append(settings.markup);$pp_pic_holder=$('.pp_pic_holder'),$ppt=$('.ppt'),$pp_overlay=$('div.pp_overlay');if(isSet&&settings.overlay_gallery){currentGalleryPage=0;toInject="";for(var i=0;i<pp_images.length;i++){if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){classname='default';img_src='';}else{classname='';img_src=pp_images[i];}
  303. toInject+="<li class='"+classname+"'><a href='#'><img src='"+img_src+"' width='50' alt='' /></a></li>";};toInject=settings.gallery_markup.replace(/{gallery}/g,toInject);$pp_pic_holder.find('#pp_full_res').after(toInject);$pp_gallery=$('.pp_pic_holder .pp_gallery'),$pp_gallery_li=$pp_gallery.find('li');$pp_gallery.find('.pp_arrow_next').click(function(){$.prettyPhoto.changeGalleryPage('next');$.prettyPhoto.stopSlideshow();return false;});$pp_gallery.find('.pp_arrow_previous').click(function(){$.prettyPhoto.changeGalleryPage('previous');$.prettyPhoto.stopSlideshow();return false;});$pp_pic_holder.find('.pp_content').hover(function(){$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();},function(){$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();});itemWidth=52+5;$pp_gallery_li.each(function(i){$(this).find('a').click(function(){$.prettyPhoto.changePage(i);$.prettyPhoto.stopSlideshow();return false;});});};if(settings.slideshow){$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
  304. $pp_pic_holder.find('.pp_nav .pp_play').click(function(){$.prettyPhoto.startSlideshow();return false;});}
  305. $pp_pic_holder.attr('class','pp_pic_holder '+settings.theme);$pp_overlay.css({'opacity':0,'height':$(document).height(),'width':$(window).width()}).bind('click',function(){if(!settings.modal)$.prettyPhoto.close();});$('a.pp_close').bind('click',function(){$.prettyPhoto.close();return false;});$('a.pp_expand').bind('click',function(e){if($(this).hasClass('pp_expand')){$(this).removeClass('pp_expand').addClass('pp_contract');doresize=false;}else{$(this).removeClass('pp_contract').addClass('pp_expand');doresize=true;};_hideContent(function(){$.prettyPhoto.open();});return false;});$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){$.prettyPhoto.changePage('previous');$.prettyPhoto.stopSlideshow();return false;});$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){$.prettyPhoto.changePage('next');$.prettyPhoto.stopSlideshow();return false;});_center_overlay();};if(!pp_alreadyInitialized&&getHashtag()){pp_alreadyInitialized=true;hashIndex=getHashtag();hashRel=hashIndex;hashIndex=hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1);hashRel=hashRel.substring(0,hashRel.indexOf('/'));setTimeout(function(){$("a[rel^='"+hashRel+"']:eq("+hashIndex+")").trigger('click');},50);}
  306. return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize);};function getHashtag(){url=location.href;hashtag=(url.indexOf('#!')!=-1)?decodeURI(url.substring(url.indexOf('#!')+2,url.length)):false;return hashtag;};function setHashtag(){if(typeof theRel=='undefined')return;location.hash='!'+theRel+'/'+rel_index+'/';};function clearHashtag(){url=location.href;hashtag=(url.indexOf('#!prettyPhoto'))?true:false;if(hashtag)location.hash="!prettyPhoto";}
  307. function getParam(name,url){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(url);return(results==null)?"":results[1];}})(jQuery);var pp_alreadyInitialized=false;
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314. /*=========================================================================
  315.  
  316. Quicksand 1.2.2
  317.  
  318. Reorder and filter items with a nice shuffling animation.
  319.  
  320. Copyright (c) 2010 Jacek Galanciak (razorjack.net) and agilope.com
  321. Big thanks for Piotr Petrus (riddle.pl) for deep code review and wonderful docs & demos.
  322.  
  323. Dual licensed under the MIT and GPL version 2 licenses.
  324. http://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt
  325. http://github.com/jquery/jquery/blob/master/GPL-LICENSE.txt
  326.  
  327. Project site: http://razorjack.net/quicksand
  328. Github site: http://github.com/razorjack/quicksand
  329.  
  330. */
  331.  
  332. (function ($) {
  333. $.fn.quicksand = function (collection, customOptions) {
  334. var options = {
  335. duration: 750,
  336. easing: 'swing',
  337. attribute: 'data-id', // attribute to recognize same items within source and dest
  338. adjustHeight: 'auto', // 'dynamic' animates height during shuffling (slow), 'auto' adjusts it before or after the animation, false leaves height constant
  339. useScaling: true, // disable it if you're not using scaling effect or want to improve performance
  340. enhancement: function(c) {}, // Visual enhacement (eg. font replacement) function for cloned elements
  341. selector: '> *',
  342. dx: 0,
  343. dy: 0
  344. };
  345. $.extend(options, customOptions);
  346.  
  347. if ($.browser.msie || (typeof($.fn.scale) == 'undefined')) {
  348. // Got IE and want scaling effect? Kiss my ass.
  349. options.useScaling = false;
  350. }
  351.  
  352. var callbackFunction;
  353. if (typeof(arguments[1]) == 'function') {
  354. var callbackFunction = arguments[1];
  355. } else if (typeof(arguments[2] == 'function')) {
  356. var callbackFunction = arguments[2];
  357. }
  358.  
  359.  
  360. return this.each(function (i) {
  361. var val;
  362. var animationQueue = []; // used to store all the animation params before starting the animation; solves initial animation slowdowns
  363. var $collection = $(collection).clone(); // destination (target) collection
  364. var $sourceParent = $(this); // source, the visible container of source collection
  365. var sourceHeight = $(this).css('height'); // used to keep height and document flow during the animation
  366.  
  367. var destHeight;
  368. var adjustHeightOnCallback = false;
  369.  
  370. var offset = $($sourceParent).offset(); // offset of visible container, used in animation calculations
  371. var offsets = []; // coordinates of every source collection item
  372.  
  373. var $source = $(this).find(options.selector); // source collection items
  374.  
  375. // Replace the collection and quit if IE6
  376. if ($.browser.msie && $.browser.version.substr(0,1)<7) {
  377. $sourceParent.html('').append($collection);
  378. return;
  379. }
  380.  
  381. // Gets called when any animation is finished
  382. var postCallbackPerformed = 0; // prevents the function from being called more than one time
  383. var postCallback = function () {
  384.  
  385. if (!postCallbackPerformed) {
  386. postCallbackPerformed = 1;
  387.  
  388. // hack:
  389. // used to be: $sourceParent.html($dest.html()); // put target HTML into visible source container
  390. // but new webkit builds cause flickering when replacing the collections
  391. $toDelete = $sourceParent.find('> *');
  392. $sourceParent.prepend($dest.find('> *'));
  393. $toDelete.remove();
  394.  
  395. if (adjustHeightOnCallback) {
  396. $sourceParent.css('height', destHeight);
  397. }
  398. options.enhancement($sourceParent); // Perform custom visual enhancements on a newly replaced collection
  399. if (typeof callbackFunction == 'function') {
  400. callbackFunction.call(this);
  401. }
  402. }
  403. };
  404.  
  405. // Position: relative situations
  406. var $correctionParent = $sourceParent.offsetParent();
  407. var correctionOffset = $correctionParent.offset();
  408. if ($correctionParent.css('position') == 'relative') {
  409. if ($correctionParent.get(0).nodeName.toLowerCase() == 'body') {
  410.  
  411. } else {
  412. correctionOffset.top += (parseFloat($correctionParent.css('border-top-width')) || 0);
  413. correctionOffset.left +=( parseFloat($correctionParent.css('border-left-width')) || 0);
  414. }
  415. } else {
  416. correctionOffset.top -= (parseFloat($correctionParent.css('border-top-width')) || 0);
  417. correctionOffset.left -= (parseFloat($correctionParent.css('border-left-width')) || 0);
  418. correctionOffset.top -= (parseFloat($correctionParent.css('margin-top')) || 0);
  419. correctionOffset.left -= (parseFloat($correctionParent.css('margin-left')) || 0);
  420. }
  421.  
  422. // perform custom corrections from options (use when Quicksand fails to detect proper correction)
  423. if (isNaN(correctionOffset.left)) {
  424. correctionOffset.left = 0;
  425. }
  426. if (isNaN(correctionOffset.top)) {
  427. correctionOffset.top = 0;
  428. }
  429.  
  430. correctionOffset.left -= options.dx;
  431. correctionOffset.top -= options.dy;
  432.  
  433. // keeps nodes after source container, holding their position
  434. $sourceParent.css('height', $(this).height());
  435.  
  436. // get positions of source collections
  437. $source.each(function (i) {
  438. offsets[i] = $(this).offset();
  439. });
  440.  
  441. // stops previous animations on source container
  442. $(this).stop();
  443. var dx = 0; var dy = 0;
  444. $source.each(function (i) {
  445. $(this).stop(); // stop animation of collection items
  446. var rawObj = $(this).get(0);
  447. if (rawObj.style.position == 'absolute') {
  448. dx = -options.dx;
  449. dy = -options.dy;
  450. } else {
  451. dx = options.dx;
  452. dy = options.dy;
  453. }
  454.  
  455. rawObj.style.position = 'absolute';
  456. rawObj.style.margin = '0';
  457.  
  458. rawObj.style.top = (offsets[i].top - parseFloat(rawObj.style.marginTop) - correctionOffset.top + dy) + 'px';
  459. rawObj.style.left = (offsets[i].left - parseFloat(rawObj.style.marginLeft) - correctionOffset.left + dx) + 'px';
  460. });
  461.  
  462. // create temporary container with destination collection
  463. var $dest = $($sourceParent).clone();
  464. var rawDest = $dest.get(0);
  465. rawDest.innerHTML = '';
  466. rawDest.setAttribute('id', '');
  467. rawDest.style.height = 'auto';
  468. rawDest.style.width = $sourceParent.width() + 'px';
  469. $dest.append($collection);
  470. // insert node into HTML
  471. // Note that the node is under visible source container in the exactly same position
  472. // The browser render all the items without showing them (opacity: 0.0)
  473. // No offset calculations are needed, the browser just extracts position from underlayered destination items
  474. // and sets animation to destination positions.
  475. $dest.insertBefore($sourceParent);
  476. $dest.css('opacity', 0.0);
  477. rawDest.style.zIndex = -1;
  478.  
  479. rawDest.style.margin = '0';
  480. rawDest.style.position = 'absolute';
  481. rawDest.style.top = offset.top - correctionOffset.top + 'px';
  482. rawDest.style.left = offset.left - correctionOffset.left + 'px';
  483.  
  484.  
  485.  
  486.  
  487.  
  488. if (options.adjustHeight === 'dynamic') {
  489. // If destination container has different height than source container
  490. // the height can be animated, adjusting it to destination height
  491. $sourceParent.animate({height: $dest.height()}, options.duration, options.easing);
  492. } else if (options.adjustHeight === 'auto') {
  493. destHeight = $dest.height();
  494. if (parseFloat(sourceHeight) < parseFloat(destHeight)) {
  495. // Adjust the height now so that the items don't move out of the container
  496. $sourceParent.css('height', destHeight);
  497. } else {
  498. // Adjust later, on callback
  499. adjustHeightOnCallback = true;
  500. }
  501. }
  502.  
  503. // Now it's time to do shuffling animation
  504. // First of all, we need to identify same elements within source and destination collections
  505. $source.each(function (i) {
  506. var destElement = [];
  507. if (typeof(options.attribute) == 'function') {
  508.  
  509. val = options.attribute($(this));
  510. $collection.each(function() {
  511. if (options.attribute(this) == val) {
  512. destElement = $(this);
  513. return false;
  514. }
  515. });
  516. } else {
  517. destElement = $collection.filter('[' + options.attribute + '=' + $(this).attr(options.attribute) + ']');
  518. }
  519. if (destElement.length) {
  520. // The item is both in source and destination collections
  521. // It it's under different position, let's move it
  522. if (!options.useScaling) {
  523. animationQueue.push(
  524. {
  525. element: $(this),
  526. animation:
  527. {top: destElement.offset().top - correctionOffset.top,
  528. left: destElement.offset().left - correctionOffset.left,
  529. opacity: 1.0
  530. }
  531. });
  532.  
  533. } else {
  534. animationQueue.push({
  535. element: $(this),
  536. animation: {top: destElement.offset().top - correctionOffset.top,
  537. left: destElement.offset().left - correctionOffset.left,
  538. opacity: 1.0,
  539. scale: '1.0'
  540. }
  541. });
  542.  
  543. }
  544. } else {
  545. // The item from source collection is not present in destination collections
  546. // Let's remove it
  547. if (!options.useScaling) {
  548. animationQueue.push({element: $(this),
  549. animation: {opacity: '0.0'}});
  550. } else {
  551. animationQueue.push({element: $(this), animation: {opacity: '0.0',
  552. scale: '0.0'}});
  553. }
  554. }
  555. });
  556.  
  557. $collection.each(function (i) {
  558. // Grab all items from target collection not present in visible source collection
  559.  
  560. var sourceElement = [];
  561. var destElement = [];
  562. if (typeof(options.attribute) == 'function') {
  563. val = options.attribute($(this));
  564. $source.each(function() {
  565. if (options.attribute(this) == val) {
  566. sourceElement = $(this);
  567. return false;
  568. }
  569. });
  570.  
  571. $collection.each(function() {
  572. if (options.attribute(this) == val) {
  573. destElement = $(this);
  574. return false;
  575. }
  576. });
  577. } else {
  578. sourceElement = $source.filter('[' + options.attribute + '=' + $(this).attr(options.attribute) + ']');
  579. destElement = $collection.filter('[' + options.attribute + '=' + $(this).attr(options.attribute) + ']');
  580. }
  581.  
  582. var animationOptions;
  583. if (sourceElement.length === 0) {
  584. // No such element in source collection...
  585. if (!options.useScaling) {
  586. animationOptions = {
  587. opacity: '1.0'
  588. };
  589. } else {
  590. animationOptions = {
  591. opacity: '1.0',
  592. scale: '1.0'
  593. };
  594. }
  595. // Let's create it
  596. d = destElement.clone();
  597. var rawDestElement = d.get(0);
  598. rawDestElement.style.position = 'absolute';
  599. rawDestElement.style.margin = '0';
  600. rawDestElement.style.top = destElement.offset().top - correctionOffset.top + 'px';
  601. rawDestElement.style.left = destElement.offset().left - correctionOffset.left + 'px';
  602. d.css('opacity', 0.0); // IE
  603. if (options.useScaling) {
  604. d.css('transform', 'scale(0.0)');
  605. }
  606. d.appendTo($sourceParent);
  607.  
  608. animationQueue.push({element: $(d),
  609. animation: animationOptions});
  610. }
  611. });
  612.  
  613. $dest.remove();
  614. options.enhancement($sourceParent); // Perform custom visual enhancements during the animation
  615. for (i = 0; i < animationQueue.length; i++) {
  616. animationQueue[i].element.animate(animationQueue[i].animation, options.duration, options.easing, postCallback);
  617. }
  618. });
  619. };
  620. })(jQuery);
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629. //=========================================================================
  630. /**
  631. * jQuery-Plugin "preloadCssImages"
  632. * by Scott Jehl, [email protected]
  633. * http://www.filamentgroup.com
  634. * reference article: http://www.filamentgroup.com/lab/update_automatically_preload_images_from_css_with_jquery/
  635. * demo page: http://www.filamentgroup.com/examples/preloadImages/index_v2.php
  636. *
  637. * Copyright (c) 2008 Filament Group, Inc
  638. * Dual licensed under the MIT (filamentgroup.com/examples/mit-license.txt) and GPL (filamentgroup.com/examples/gpl-license.txt) licenses.
  639. *
  640. * Version: 5.0, 10.31.2008
  641. * Changelog:
  642. * 02.20.2008 initial Version 1.0
  643. * 06.04.2008 Version 2.0 : removed need for any passed arguments. Images load from any and all directories.
  644. * 06.21.2008 Version 3.0 : Added options for loading status. Fixed IE abs image path bug (thanks Sam Pohlenz).
  645. * 07.24.2008 Version 4.0 : Added support for @imported CSS (credit: http://marcarea.com/). Fixed support in Opera as well.
  646. * 10.31.2008 Version: 5.0 : Many feature and performance enhancements from trixta
  647. * --------------------------------------------------------------------
  648. */
  649.  
  650. ;jQuery.preloadCssImages = function(settings){
  651. settings = jQuery.extend({
  652. statusTextEl: null,
  653. statusBarEl: null,
  654. errorDelay: 999, // handles 404-Errors in IE
  655. simultaneousCacheLoading: 2
  656. }, settings);
  657. var allImgs = [],
  658. loaded = 0,
  659. imgUrls = [],
  660. thisSheetRules,
  661. errorTimer;
  662.  
  663. function onImgComplete(){
  664. clearTimeout(errorTimer);
  665. if (imgUrls && imgUrls.length && imgUrls[loaded]) {
  666. loaded++;
  667. if (settings.statusTextEl) {
  668. var nowloading = (imgUrls[loaded]) ?
  669. 'Now Loading: <span>' + imgUrls[loaded].split('/')[imgUrls[loaded].split('/').length - 1] :
  670. 'Loading complete'; // wrong status-text bug fixed
  671. jQuery(settings.statusTextEl).html('<span class="numLoaded">' + loaded + '</span> of <span class="numTotal">' + imgUrls.length + '</span> loaded (<span class="percentLoaded">' + (loaded / imgUrls.length * 100).toFixed(0) + '%</span>) <span class="currentImg">' + nowloading + '</span></span>');
  672. }
  673. if (settings.statusBarEl) {
  674. var barWidth = jQuery(settings.statusBarEl).width();
  675. jQuery(settings.statusBarEl).css('background-position', -(barWidth - (barWidth * loaded / imgUrls.length).toFixed(0)) + 'px 50%');
  676. }
  677. loadImgs();
  678. }
  679. }
  680.  
  681. function loadImgs(){
  682. //only load 1 image at the same time / most browsers can only handle 2 http requests, 1 should remain for user-interaction (Ajax, other images, normal page requests...)
  683. // otherwise set simultaneousCacheLoading to a higher number for simultaneous downloads
  684. if(imgUrls && imgUrls.length && imgUrls[loaded]){
  685. var img = new Image(); //new img obj
  686. img.src = imgUrls[loaded]; //set src either absolute or rel to css dir
  687. if(!img.complete){
  688. jQuery(img).bind('error load onreadystatechange', onImgComplete);
  689. } else {
  690. onImgComplete();
  691. }
  692. errorTimer = setTimeout(onImgComplete, settings.errorDelay); // handles 404-Errors in IE
  693. }
  694. }
  695.  
  696. function parseCSS(sheets, urls) {
  697. var w3cImport = false,
  698. imported = [],
  699. importedSrc = [],
  700. baseURL;
  701. var sheetIndex = sheets.length;
  702. while(sheetIndex--){//loop through each stylesheet
  703.  
  704. var cssPile = '';//create large string of all css rules in sheet
  705.  
  706. if(urls && urls[sheetIndex]){
  707. baseURL = urls[sheetIndex];
  708. } else {
  709. var csshref = (sheets[sheetIndex].href) ? sheets[sheetIndex].href : 'window.location.href';
  710. var baseURLarr = csshref.split('/');//split href at / to make array
  711. baseURLarr.pop();//remove file path from baseURL array
  712. baseURL = baseURLarr.join('/');//create base url for the images in this sheet (css file's dir)
  713. if (baseURL) {
  714. baseURL += '/'; //tack on a / if needed
  715. }
  716. }
  717. if(sheets[sheetIndex].cssRules || sheets[sheetIndex].rules){
  718. thisSheetRules = (sheets[sheetIndex].cssRules) ? //->>> http://www.quirksmode.org/dom/w3c_css.html
  719. sheets[sheetIndex].cssRules : //w3
  720. sheets[sheetIndex].rules; //ie
  721. var ruleIndex = thisSheetRules.length;
  722. while(ruleIndex--){
  723. if(thisSheetRules[ruleIndex].style && thisSheetRules[ruleIndex].style.cssText){
  724. var text = thisSheetRules[ruleIndex].style.cssText;
  725. if(text.toLowerCase().indexOf('url') != -1){ // only add rules to the string if you can assume, to find an image, speed improvement
  726. cssPile += text; // thisSheetRules[ruleIndex].style.cssText instead of thisSheetRules[ruleIndex].cssText is a huge speed improvement
  727. }
  728. } else if(thisSheetRules[ruleIndex].styleSheet) {
  729. imported.push(thisSheetRules[ruleIndex].styleSheet);
  730. w3cImport = true;
  731. }
  732.  
  733. }
  734. }
  735. //parse cssPile for image urls
  736. var tmpImage = cssPile.match(/[^\("]+\.(gif|jpg|jpeg|png)/g);//reg ex to get a string of between a "(" and a ".filename" / '"' for opera-bugfix
  737. if(tmpImage){
  738. var i = tmpImage.length;
  739. while(i--){ // handle baseUrl here for multiple stylesheets in different folders bug
  740. var imgSrc = (tmpImage[i].charAt(0) == '/' || tmpImage[i].match('://')) ? // protocol-bug fixed
  741. tmpImage[i] :
  742. baseURL + tmpImage[i];
  743.  
  744. if(jQuery.inArray(imgSrc, imgUrls) == -1){
  745. imgUrls.push(imgSrc);
  746. }
  747. }
  748. }
  749.  
  750. if(!w3cImport && sheets[sheetIndex].imports && sheets[sheetIndex].imports.length) {
  751. for(var iImport = 0, importLen = sheets[sheetIndex].imports.length; iImport < importLen; iImport++){
  752. var iHref = sheets[sheetIndex].imports[iImport].href;
  753. iHref = iHref.split('/');
  754. iHref.pop();
  755. iHref = iHref.join('/');
  756. if (iHref) {
  757. iHref += '/'; //tack on a / if needed
  758. }
  759. var iSrc = (iHref.charAt(0) == '/' || iHref.match('://')) ? // protocol-bug fixed
  760. iHref :
  761. baseURL + iHref;
  762.  
  763. importedSrc.push(iSrc);
  764. imported.push(sheets[sheetIndex].imports[iImport]);
  765. }
  766.  
  767.  
  768. }
  769. }//loop
  770. if(imported.length){
  771. parseCSS(imported, importedSrc);
  772. return false;
  773. }
  774. var downloads = settings.simultaneousCacheLoading;
  775. while( downloads--){
  776. setTimeout(loadImgs, downloads);
  777. }
  778. }
  779. parseCSS(document.styleSheets);
  780. return imgUrls;
  781. };
  782.  
  783.  
  784.  
  785.  
  786. //=========================================================================
  787. /*
  788. * jQuery validation plug-in pre-1.5.2
  789. *
  790. * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
  791. * http://docs.jquery.com/Plugins/Validation
  792. *
  793. * Copyright (c) 2006 - 2008 Jörn Zaefferer
  794. *
  795. * $Id: jquery.validate.js 6243 2009-02-19 11:40:49Z joern.zaefferer $
  796. *
  797. * Dual licensed under the MIT and GPL licenses:
  798. * http://www.opensource.org/licenses/mit-license.php
  799. * http://www.gnu.org/licenses/gpl.html
  800. */
  801.  
  802. (function($) {
  803.  
  804. $.extend($.fn, {
  805. // http://docs.jquery.com/Plugins/Validation/validate
  806. validate: function( options ) {
  807.  
  808. // if nothing is selected, return nothing; can't chain anyway
  809. if (!this.length) {
  810. options && options.debug && window.console && console.warn( "nothing selected, can't validate, returning nothing" );
  811. return;
  812. }
  813.  
  814. // check if a validator for this form was already created
  815. var validator = $.data(this[0], 'validator');
  816. if ( validator ) {
  817. return validator;
  818. }
  819.  
  820. validator = new $.validator( options, this[0] );
  821. $.data(this[0], 'validator', validator);
  822.  
  823. if ( validator.settings.onsubmit ) {
  824.  
  825. // allow suppresing validation by adding a cancel class to the submit button
  826. this.find("input, button").filter(".cancel").click(function() {
  827. validator.cancelSubmit = true;
  828. });
  829.  
  830. // validate the form on submit
  831. this.submit( function( event ) {
  832. if ( validator.settings.debug )
  833. // prevent form submit to be able to see console output
  834. event.preventDefault();
  835.  
  836. function handle() {
  837. if ( validator.settings.submitHandler ) {
  838. validator.settings.submitHandler.call( validator, validator.currentForm );
  839. return false;
  840. }
  841. return true;
  842. }
  843.  
  844. // prevent submit for invalid forms or custom submit handlers
  845. if ( validator.cancelSubmit ) {
  846. validator.cancelSubmit = false;
  847. return handle();
  848. }
  849. if ( validator.form() ) {
  850. if ( validator.pendingRequest ) {
  851. validator.formSubmitted = true;
  852. return false;
  853. }
  854. return handle();
  855. } else {
  856. validator.focusInvalid();
  857. return false;
  858. }
  859. });
  860. }
  861.  
  862. return validator;
  863. },
  864. // http://docs.jquery.com/Plugins/Validation/valid
  865. valid: function() {
  866. if ( $(this[0]).is('form')) {
  867. return this.validate().form();
  868. } else {
  869. var valid = false;
  870. var validator = $(this[0].form).validate();
  871. this.each(function() {
  872. valid |= validator.element(this);
  873. });
  874. return valid;
  875. }
  876. },
  877. // attributes: space seperated list of attributes to retrieve and remove
  878. removeAttrs: function(attributes) {
  879. var result = {},
  880. $element = this;
  881. $.each(attributes.split(/\s/), function(index, value) {
  882. result[value] = $element.attr(value);
  883. $element.removeAttr(value);
  884. });
  885. return result;
  886. },
  887. // http://docs.jquery.com/Plugins/Validation/rules
  888. rules: function(command, argument) {
  889. var element = this[0];
  890.  
  891. if (command) {
  892. var settings = $.data(element.form, 'validator').settings;
  893. var staticRules = settings.rules;
  894. var existingRules = $.validator.staticRules(element);
  895. switch(command) {
  896. case "add":
  897. $.extend(existingRules, $.validator.normalizeRule(argument));
  898. staticRules[element.name] = existingRules;
  899. if (argument.messages)
  900. settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );
  901. break;
  902. case "remove":
  903. if (!argument) {
  904. delete staticRules[element.name];
  905. return existingRules;
  906. }
  907. var filtered = {};
  908. $.each(argument.split(/\s/), function(index, method) {
  909. filtered[method] = existingRules[method];
  910. delete existingRules[method];
  911. });
  912. return filtered;
  913. }
  914. }
  915.  
  916. var data = $.validator.normalizeRules(
  917. $.extend(
  918. {},
  919. $.validator.metadataRules(element),
  920. $.validator.classRules(element),
  921. $.validator.attributeRules(element),
  922. $.validator.staticRules(element)
  923. ), element);
  924.  
  925. // make sure required is at front
  926. if (data.required) {
  927. var param = data.required;
  928. delete data.required;
  929. data = $.extend({required: param}, data);
  930. }
  931.  
  932. return data;
  933. }
  934. });
  935.  
  936. // Custom selectors
  937. $.extend($.expr[":"], {
  938. // http://docs.jquery.com/Plugins/Validation/blank
  939. blank: function(a) {return !$.trim(a.value);},
  940. // http://docs.jquery.com/Plugins/Validation/filled
  941. filled: function(a) {return !!$.trim(a.value);},
  942. // http://docs.jquery.com/Plugins/Validation/unchecked
  943. unchecked: function(a) {return !a.checked;}
  944. });
  945.  
  946.  
  947. $.format = function(source, params) {
  948. if ( arguments.length == 1 )
  949. return function() {
  950. var args = $.makeArray(arguments);
  951. args.unshift(source);
  952. return $.format.apply( this, args );
  953. };
  954. if ( arguments.length > 2 && params.constructor != Array ) {
  955. params = $.makeArray(arguments).slice(1);
  956. }
  957. if ( params.constructor != Array ) {
  958. params = [ params ];
  959. }
  960. $.each(params, function(i, n) {
  961. source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n);
  962. });
  963. return source;
  964. };
  965.  
  966. // constructor for validator
  967. $.validator = function( options, form ) {
  968. this.settings = $.extend( {}, $.validator.defaults, options );
  969. this.currentForm = form;
  970. this.init();
  971. };
  972.  
  973. $.extend($.validator, {
  974.  
  975. defaults: {
  976. messages: {},
  977. groups: {},
  978. rules: {},
  979. errorClass: "error",
  980. errorElement: "label",
  981. focusInvalid: true,
  982. errorContainer: $( [] ),
  983. errorLabelContainer: $( [] ),
  984. onsubmit: true,
  985. ignore: [],
  986. ignoreTitle: false,
  987. onfocusin: function(element) {
  988. this.lastActive = element;
  989.  
  990. // hide error label and remove error class on focus if enabled
  991. if ( this.settings.focusCleanup && !this.blockFocusCleanup ) {
  992. this.settings.unhighlight && this.settings.unhighlight.call( this, element, this.settings.errorClass );
  993. this.errorsFor(element).hide();
  994. }
  995. },
  996. onfocusout: function(element) {
  997. if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {
  998. this.element(element);
  999. }
  1000. },
  1001. onkeyup: function(element) {
  1002. if ( element.name in this.submitted || element == this.lastElement ) {
  1003. this.element(element);
  1004. }
  1005. },
  1006. onclick: function(element) {
  1007. if ( element.name in this.submitted )
  1008. this.element(element);
  1009. },
  1010. highlight: function( element, errorClass ) {
  1011. $( element ).addClass( errorClass );
  1012. },
  1013. unhighlight: function( element, errorClass ) {
  1014. $( element ).removeClass( errorClass );
  1015. }
  1016. },
  1017.  
  1018. // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults
  1019. setDefaults: function(settings) {
  1020. $.extend( $.validator.defaults, settings );
  1021. },
  1022.  
  1023. messages: {
  1024. required: "This field is required.",
  1025. remote: "Please fix this field.",
  1026. email: "Please enter a valid email address.",
  1027. url: "Please enter a valid URL.",
  1028. date: "Please enter a valid date.",
  1029. dateISO: "Please enter a valid date (ISO).",
  1030. dateDE: "Bitte geben Sie ein gültiges Datum ein.",
  1031. number: "Please enter a valid number.",
  1032. numberDE: "Bitte geben Sie eine Nummer ein.",
  1033. digits: "Please enter only digits",
  1034. creditcard: "Please enter a valid credit card number.",
  1035. equalTo: "Please enter the same value again.",
  1036. accept: "Please enter a value with a valid extension.",
  1037. maxlength: $.format("Please enter no more than {0} characters."),
  1038. minlength: $.format("Please enter at least {0} characters."),
  1039. rangelength: $.format("Please enter a value between {0} and {1} characters long."),
  1040. range: $.format("Please enter a value between {0} and {1}."),
  1041. max: $.format("Please enter a value less than or equal to {0}."),
  1042. min: $.format("Please enter a value greater than or equal to {0}.")
  1043. },
  1044.  
  1045. autoCreateRanges: false,
  1046.  
  1047. prototype: {
  1048.  
  1049. init: function() {
  1050. this.labelContainer = $(this.settings.errorLabelContainer);
  1051. this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
  1052. this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer );
  1053. this.submitted = {};
  1054. this.valueCache = {};
  1055. this.pendingRequest = 0;
  1056. this.pending = {};
  1057. this.invalid = {};
  1058. this.reset();
  1059.  
  1060. var groups = (this.groups = {});
  1061. $.each(this.settings.groups, function(key, value) {
  1062. $.each(value.split(/\s/), function(index, name) {
  1063. groups[name] = key;
  1064. });
  1065. });
  1066. var rules = this.settings.rules;
  1067. $.each(rules, function(key, value) {
  1068. rules[key] = $.validator.normalizeRule(value);
  1069. });
  1070.  
  1071. function delegate(event) {
  1072. var validator = $.data(this[0].form, "validator");
  1073. validator.settings["on" + event.type] && validator.settings["on" + event.type].call(validator, this[0] );
  1074. }
  1075. $(this.currentForm)
  1076. .delegate("focusin focusout keyup", ":text, :password, :file, select, textarea", delegate)
  1077. .delegate("click", ":radio, :checkbox", delegate);
  1078.  
  1079. if (this.settings.invalidHandler)
  1080. $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
  1081. },
  1082.  
  1083. // http://docs.jquery.com/Plugins/Validation/Validator/form
  1084. form: function() {
  1085. this.checkForm();
  1086. $.extend(this.submitted, this.errorMap);
  1087. this.invalid = $.extend({}, this.errorMap);
  1088. if (!this.valid())
  1089. $(this.currentForm).triggerHandler("invalid-form", [this]);
  1090. this.showErrors();
  1091. return this.valid();
  1092. },
  1093.  
  1094. checkForm: function() {
  1095. this.prepareForm();
  1096. for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {
  1097. this.check( elements[i] );
  1098. }
  1099. return this.valid();
  1100. },
  1101.  
  1102. // http://docs.jquery.com/Plugins/Validation/Validator/element
  1103. element: function( element ) {
  1104. element = this.clean( element );
  1105. this.lastElement = element;
  1106. this.prepareElement( element );
  1107. this.currentElements = $(element);
  1108. var result = this.check( element );
  1109. if ( result ) {
  1110. delete this.invalid[element.name];
  1111. } else {
  1112. this.invalid[element.name] = true;
  1113. }
  1114. if ( !this.numberOfInvalids() ) {
  1115. // Hide error containers on last error
  1116. this.toHide = this.toHide.add( this.containers );
  1117. }
  1118. this.showErrors();
  1119. return result;
  1120. },
  1121.  
  1122. // http://docs.jquery.com/Plugins/Validation/Validator/showErrors
  1123. showErrors: function(errors) {
  1124. if(errors) {
  1125. // add items to error list and map
  1126. $.extend( this.errorMap, errors );
  1127. this.errorList = [];
  1128. for ( var name in errors ) {
  1129. this.errorList.push({
  1130. message: errors[name],
  1131. element: this.findByName(name)[0]
  1132. });
  1133. }
  1134. // remove items from success list
  1135. this.successList = $.grep( this.successList, function(element) {
  1136. return !(element.name in errors);
  1137. });
  1138. }
  1139. this.settings.showErrors
  1140. ? this.settings.showErrors.call( this, this.errorMap, this.errorList )
  1141. : this.defaultShowErrors();
  1142. },
  1143.  
  1144. // http://docs.jquery.com/Plugins/Validation/Validator/resetForm
  1145. resetForm: function() {
  1146. if ( $.fn.resetForm )
  1147. $( this.currentForm ).resetForm();
  1148. this.submitted = {};
  1149. this.prepareForm();
  1150. this.hideErrors();
  1151. this.elements().removeClass( this.settings.errorClass );
  1152. },
  1153.  
  1154. numberOfInvalids: function() {
  1155. return this.objectLength(this.invalid);
  1156. },
  1157.  
  1158. objectLength: function( obj ) {
  1159. var count = 0;
  1160. for ( var i in obj )
  1161. count++;
  1162. return count;
  1163. },
  1164.  
  1165. hideErrors: function() {
  1166. this.addWrapper( this.toHide ).hide();
  1167. },
  1168.  
  1169. valid: function() {
  1170. return this.size() == 0;
  1171. },
  1172.  
  1173. size: function() {
  1174. return this.errorList.length;
  1175. },
  1176.  
  1177. focusInvalid: function() {
  1178. if( this.settings.focusInvalid ) {
  1179. try {
  1180. $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []).filter(":visible").focus();
  1181. } catch(e) {
  1182. // ignore IE throwing errors when focusing hidden elements
  1183. }
  1184. }
  1185. },
  1186.  
  1187. findLastActive: function() {
  1188. var lastActive = this.lastActive;
  1189. return lastActive && $.grep(this.errorList, function(n) {
  1190. return n.element.name == lastActive.name;
  1191. }).length == 1 && lastActive;
  1192. },
  1193.  
  1194. elements: function() {
  1195. var validator = this,
  1196. rulesCache = {};
  1197.  
  1198. // select all valid inputs inside the form (no submit or reset buttons)
  1199. // workaround $Query([]).add until http://dev.jquery.com/ticket/2114 is solved
  1200. return $([]).add(this.currentForm.elements)
  1201. .filter(":input")
  1202. .not(":submit, :reset, :image, [disabled]")
  1203. .not( this.settings.ignore )
  1204. .filter(function() {
  1205. !this.name && validator.settings.debug && window.console && console.error( "%o has no name assigned", this);
  1206.  
  1207. // select only the first element for each name, and only those with rules specified
  1208. if ( this.name in rulesCache || !validator.objectLength($(this).rules()) )
  1209. return false;
  1210.  
  1211. rulesCache[this.name] = true;
  1212. return true;
  1213. });
  1214. },
  1215.  
  1216. clean: function( selector ) {
  1217. return $( selector )[0];
  1218. },
  1219.  
  1220. errors: function() {
  1221. return $( this.settings.errorElement + "." + this.settings.errorClass, this.errorContext );
  1222. },
  1223.  
  1224. reset: function() {
  1225. this.successList = [];
  1226. this.errorList = [];
  1227. this.errorMap = {};
  1228. this.toShow = $([]);
  1229. this.toHide = $([]);
  1230. this.formSubmitted = false;
  1231. this.currentElements = $([]);
  1232. },
  1233.  
  1234. prepareForm: function() {
  1235. this.reset();
  1236. this.toHide = this.errors().add( this.containers );
  1237. },
  1238.  
  1239. prepareElement: function( element ) {
  1240. this.reset();
  1241. this.toHide = this.errorsFor(element);
  1242. },
  1243.  
  1244. check: function( element ) {
  1245. element = this.clean( element );
  1246.  
  1247. // if radio/checkbox, validate first element in group instead
  1248. if (this.checkable(element)) {
  1249. element = this.findByName( element.name )[0];
  1250. }
  1251.  
  1252. var rules = $(element).rules();
  1253. var dependencyMismatch = false;
  1254. for( method in rules ) {
  1255. var rule = { method: method, parameters: rules[method] };
  1256. try {
  1257. var result = $.validator.methods[method].call( this, element.value.replace(/\r/g, ""), element, rule.parameters );
  1258.  
  1259. // if a method indicates that the field is optional and therefore valid,
  1260. // don't mark it as valid when there are no other rules
  1261. if ( result == "dependency-mismatch" ) {
  1262. dependencyMismatch = true;
  1263. continue;
  1264. }
  1265. dependencyMismatch = false;
  1266.  
  1267. if ( result == "pending" ) {
  1268. this.toHide = this.toHide.not( this.errorsFor(element) );
  1269. return;
  1270. }
  1271.  
  1272. if( !result ) {
  1273. this.formatAndAdd( element, rule );
  1274. return false;
  1275. }
  1276. } catch(e) {
  1277. this.settings.debug && window.console && console.log("exception occured when checking element " + element.id
  1278. + ", check the '" + rule.method + "' method");
  1279. throw e;
  1280. }
  1281. }
  1282. if (dependencyMismatch)
  1283. return;
  1284. if ( this.objectLength(rules) )
  1285. this.successList.push(element);
  1286. return true;
  1287. },
  1288.  
  1289. // return the custom message for the given element and validation method
  1290. // specified in the element's "messages" metadata
  1291. customMetaMessage: function(element, method) {
  1292. if (!$.metadata)
  1293. return;
  1294.  
  1295. var meta = this.settings.meta
  1296. ? $(element).metadata()[this.settings.meta]
  1297. : $(element).metadata();
  1298.  
  1299. return meta && meta.messages && meta.messages[method];
  1300. },
  1301.  
  1302. // return the custom message for the given element name and validation method
  1303. customMessage: function( name, method ) {
  1304. var m = this.settings.messages[name];
  1305. return m && (m.constructor == String
  1306. ? m
  1307. : m[method]);
  1308. },
  1309.  
  1310. // return the first defined argument, allowing empty strings
  1311. findDefined: function() {
  1312. for(var i = 0; i < arguments.length; i++) {
  1313. if (arguments[i] !== undefined)
  1314. return arguments[i];
  1315. }
  1316. return undefined;
  1317. },
  1318.  
  1319. defaultMessage: function( element, method) {
  1320. return this.findDefined(
  1321. this.customMessage( element.name, method ),
  1322. this.customMetaMessage( element, method ),
  1323. // title is never undefined, so handle empty string as undefined
  1324. !this.settings.ignoreTitle && element.title || undefined,
  1325. $.validator.messages[method],
  1326. "<strong>Warning: No message defined for " + element.name + "</strong>"
  1327. );
  1328. },
  1329.  
  1330. formatAndAdd: function( element, rule ) {
  1331. var message = this.defaultMessage( element, rule.method );
  1332. if ( typeof message == "function" )
  1333. message = message.call(this, rule.parameters, element);
  1334. this.errorList.push({
  1335. message: message,
  1336. element: element
  1337. });
  1338. this.errorMap[element.name] = message;
  1339. this.submitted[element.name] = message;
  1340. },
  1341.  
  1342. addWrapper: function(toToggle) {
  1343. if ( this.settings.wrapper )
  1344. toToggle = toToggle.add( toToggle.parents( this.settings.wrapper ) );
  1345. return toToggle;
  1346. },
  1347.  
  1348. defaultShowErrors: function() {
  1349. for ( var i = 0; this.errorList[i]; i++ ) {
  1350. var error = this.errorList[i];
  1351. this.settings.highlight && this.settings.highlight.call( this, error.element, this.settings.errorClass );
  1352. this.showLabel( error.element, error.message );
  1353. }
  1354. if( this.errorList.length ) {
  1355. this.toShow = this.toShow.add( this.containers );
  1356. }
  1357. if (this.settings.success) {
  1358. for ( var i = 0; this.successList[i]; i++ ) {
  1359. this.showLabel( this.successList[i] );
  1360. }
  1361. }
  1362. if (this.settings.unhighlight) {
  1363. for ( var i = 0, elements = this.validElements(); elements[i]; i++ ) {
  1364. this.settings.unhighlight.call( this, elements[i], this.settings.errorClass );
  1365. }
  1366. }
  1367. this.toHide = this.toHide.not( this.toShow );
  1368. this.hideErrors();
  1369. this.addWrapper( this.toShow ).show();
  1370. },
  1371.  
  1372. validElements: function() {
  1373. return this.currentElements.not(this.invalidElements());
  1374. },
  1375.  
  1376. invalidElements: function() {
  1377. return $(this.errorList).map(function() {
  1378. return this.element;
  1379. });
  1380. },
  1381.  
  1382. showLabel: function(element, message) {
  1383. var label = this.errorsFor( element );
  1384. if ( label.length ) {
  1385. // refresh error/success class
  1386. label.removeClass().addClass( this.settings.errorClass );
  1387.  
  1388. // check if we have a generated label, replace the message then
  1389. label.attr("generated") && label.html(message);
  1390. } else {
  1391. // create label
  1392. label = $("<" + this.settings.errorElement + "/>")
  1393. .attr({"for": this.idOrName(element), generated: true})
  1394. .addClass(this.settings.errorClass)
  1395. .html(message || "");
  1396. if ( this.settings.wrapper ) {
  1397. // make sure the element is visible, even in IE
  1398. // actually showing the wrapped element is handled elsewhere
  1399. label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
  1400. }
  1401. if ( !this.labelContainer.append(label).length )
  1402. this.settings.errorPlacement
  1403. ? this.settings.errorPlacement(label, $(element) )
  1404. : label.insertAfter(element);
  1405. }
  1406. if ( !message && this.settings.success ) {
  1407. label.text("");
  1408. typeof this.settings.success == "string"
  1409. ? label.addClass( this.settings.success )
  1410. : this.settings.success( label );
  1411. }
  1412. this.toShow = this.toShow.add(label);
  1413. },
  1414.  
  1415. errorsFor: function(element) {
  1416. return this.errors().filter("[for='" + this.idOrName(element) + "']");
  1417. },
  1418.  
  1419. idOrName: function(element) {
  1420. return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);
  1421. },
  1422.  
  1423. checkable: function( element ) {
  1424. return /radio|checkbox/i.test(element.type);
  1425. },
  1426.  
  1427. findByName: function( name ) {
  1428. // select by name and filter by form for performance over form.find("[name=...]")
  1429. var form = this.currentForm;
  1430. return $(document.getElementsByName(name)).map(function(index, element) {
  1431. return element.form == form && element.name == name && element || null;
  1432. });
  1433. },
  1434.  
  1435. getLength: function(value, element) {
  1436. switch( element.nodeName.toLowerCase() ) {
  1437. case 'select':
  1438. return $("option:selected", element).length;
  1439. case 'input':
  1440. if( this.checkable( element) )
  1441. return this.findByName(element.name).filter(':checked').length;
  1442. }
  1443. return value.length;
  1444. },
  1445.  
  1446. depend: function(param, element) {
  1447. return this.dependTypes[typeof param]
  1448. ? this.dependTypes[typeof param](param, element)
  1449. : true;
  1450. },
  1451.  
  1452. dependTypes: {
  1453. "boolean": function(param, element) {
  1454. return param;
  1455. },
  1456. "string": function(param, element) {
  1457. return !!$(param, element.form).length;
  1458. },
  1459. "function": function(param, element) {
  1460. return param(element);
  1461. }
  1462. },
  1463.  
  1464. optional: function(element) {
  1465. return !$.validator.methods.required.call(this, $.trim(element.value), element) && "dependency-mismatch";
  1466. },
  1467.  
  1468. startRequest: function(element) {
  1469. if (!this.pending[element.name]) {
  1470. this.pendingRequest++;
  1471. this.pending[element.name] = true;
  1472. }
  1473. },
  1474.  
  1475. stopRequest: function(element, valid) {
  1476. this.pendingRequest--;
  1477. // sometimes synchronization fails, make sure pendingRequest is never < 0
  1478. if (this.pendingRequest < 0)
  1479. this.pendingRequest = 0;
  1480. delete this.pending[element.name];
  1481. if ( valid && this.pendingRequest == 0 && this.formSubmitted && this.form() ) {
  1482. $(this.currentForm).submit();
  1483. } else if (!valid && this.pendingRequest == 0 && this.formSubmitted) {
  1484. $(this.currentForm).triggerHandler("invalid-form", [this]);
  1485. }
  1486. },
  1487.  
  1488. previousValue: function(element) {
  1489. return $.data(element, "previousValue") || $.data(element, "previousValue", previous = {
  1490. old: null,
  1491. valid: true,
  1492. message: this.defaultMessage( element, "remote" )
  1493. });
  1494. }
  1495.  
  1496. },
  1497.  
  1498. classRuleSettings: {
  1499. required: {required: true},
  1500. email: {email: true},
  1501. url: {url: true},
  1502. date: {date: true},
  1503. dateISO: {dateISO: true},
  1504. dateDE: {dateDE: true},
  1505. number: {number: true},
  1506. numberDE: {numberDE: true},
  1507. digits: {digits: true},
  1508. creditcard: {creditcard: true}
  1509. },
  1510.  
  1511. addClassRules: function(className, rules) {
  1512. className.constructor == String ?
  1513. this.classRuleSettings[className] = rules :
  1514. $.extend(this.classRuleSettings, className);
  1515. },
  1516.  
  1517. classRules: function(element) {
  1518. var rules = {};
  1519. var classes = $(element).attr('class');
  1520. classes && $.each(classes.split(' '), function() {
  1521. if (this in $.validator.classRuleSettings) {
  1522. $.extend(rules, $.validator.classRuleSettings[this]);
  1523. }
  1524. });
  1525. return rules;
  1526. },
  1527.  
  1528. attributeRules: function(element) {
  1529. var rules = {};
  1530. var $element = $(element);
  1531.  
  1532. for (method in $.validator.methods) {
  1533. var value = $element.attr(method);
  1534. if (value) {
  1535. rules[method] = value;
  1536. }
  1537. }
  1538.  
  1539. // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs
  1540. if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {
  1541. delete rules.maxlength;
  1542. }
  1543.  
  1544. return rules;
  1545. },
  1546.  
  1547. metadataRules: function(element) {
  1548. if (!$.metadata) return {};
  1549.  
  1550. var meta = $.data(element.form, 'validator').settings.meta;
  1551. return meta ?
  1552. $(element).metadata()[meta] :
  1553. $(element).metadata();
  1554. },
  1555.  
  1556. staticRules: function(element) {
  1557. var rules = {};
  1558. var validator = $.data(element.form, 'validator');
  1559. if (validator.settings.rules) {
  1560. rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
  1561. }
  1562. return rules;
  1563. },
  1564.  
  1565. normalizeRules: function(rules, element) {
  1566. // handle dependency check
  1567. $.each(rules, function(prop, val) {
  1568. // ignore rule when param is explicitly false, eg. required:false
  1569. if (val === false) {
  1570. delete rules[prop];
  1571. return;
  1572. }
  1573. if (val.param || val.depends) {
  1574. var keepRule = true;
  1575. switch (typeof val.depends) {
  1576. case "string":
  1577. keepRule = !!$(val.depends, element.form).length;
  1578. break;
  1579. case "function":
  1580. keepRule = val.depends.call(element, element);
  1581. break;
  1582. }
  1583. if (keepRule) {
  1584. rules[prop] = val.param !== undefined ? val.param : true;
  1585. } else {
  1586. delete rules[prop];
  1587. }
  1588. }
  1589. });
  1590.  
  1591. // evaluate parameters
  1592. $.each(rules, function(rule, parameter) {
  1593. rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;
  1594. });
  1595.  
  1596. // clean number parameters
  1597. $.each(['minlength', 'maxlength', 'min', 'max'], function() {
  1598. if (rules[this]) {
  1599. rules[this] = Number(rules[this]);
  1600. }
  1601. });
  1602. $.each(['rangelength', 'range'], function() {
  1603. if (rules[this]) {
  1604. rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
  1605. }
  1606. });
  1607.  
  1608. if ($.validator.autoCreateRanges) {
  1609. // auto-create ranges
  1610. if (rules.min && rules.max) {
  1611. rules.range = [rules.min, rules.max];
  1612. delete rules.min;
  1613. delete rules.max;
  1614. }
  1615. if (rules.minlength && rules.maxlength) {
  1616. rules.rangelength = [rules.minlength, rules.maxlength];
  1617. delete rules.minlength;
  1618. delete rules.maxlength;
  1619. }
  1620. }
  1621.  
  1622. // To support custom messages in metadata ignore rule methods titled "messages"
  1623. if (rules.messages) {
  1624. delete rules.messages
  1625. }
  1626.  
  1627. return rules;
  1628. },
  1629.  
  1630. // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
  1631. normalizeRule: function(data) {
  1632. if( typeof data == "string" ) {
  1633. var transformed = {};
  1634. $.each(data.split(/\s/), function() {
  1635. transformed[this] = true;
  1636. });
  1637. data = transformed;
  1638. }
  1639. return data;
  1640. },
  1641.  
  1642. // http://docs.jquery.com/Plugins/Validation/Validator/addMethod
  1643. addMethod: function(name, method, message) {
  1644. $.validator.methods[name] = method;
  1645. $.validator.messages[name] = message;
  1646. if (method.length < 3) {
  1647. $.validator.addClassRules(name, $.validator.normalizeRule(name));
  1648. }
  1649. },
  1650.  
  1651. methods: {
  1652.  
  1653. // http://docs.jquery.com/Plugins/Validation/Methods/required
  1654. required: function(value, element, param) {
  1655. // check if dependency is met
  1656. if ( !this.depend(param, element) )
  1657. return "dependency-mismatch";
  1658. switch( element.nodeName.toLowerCase() ) {
  1659. case 'select':
  1660. var options = $("option:selected", element);
  1661. return options.length > 0 && ( element.type == "select-multiple" || ($.browser.msie && !(options[0].attributes['value'].specified) ? options[0].text : options[0].value).length > 0);
  1662. case 'input':
  1663. if ( this.checkable(element) )
  1664. return this.getLength(value, element) > 0;
  1665. default:
  1666. return $.trim(value).length > 0;
  1667. }
  1668. },
  1669.  
  1670. // http://docs.jquery.com/Plugins/Validation/Methods/remote
  1671. remote: function(value, element, param) {
  1672. if ( this.optional(element) )
  1673. return "dependency-mismatch";
  1674.  
  1675. var previous = this.previousValue(element);
  1676.  
  1677. if (!this.settings.messages[element.name] )
  1678. this.settings.messages[element.name] = {};
  1679. this.settings.messages[element.name].remote = typeof previous.message == "function" ? previous.message(value) : previous.message;
  1680.  
  1681. param = typeof param == "string" && {url:param} || param;
  1682.  
  1683. if ( previous.old !== value ) {
  1684. previous.old = value;
  1685. var validator = this;
  1686. this.startRequest(element);
  1687. var data = {};
  1688. data[element.name] = value;
  1689. $.ajax($.extend(true, {
  1690. url: param,
  1691. mode: "abort",
  1692. port: "validate" + element.name,
  1693. dataType: "json",
  1694. data: data,
  1695. success: function(response) {
  1696. if ( response ) {
  1697. var submitted = validator.formSubmitted;
  1698. validator.prepareElement(element);
  1699. validator.formSubmitted = submitted;
  1700. validator.successList.push(element);
  1701. validator.showErrors();
  1702. } else {
  1703. var errors = {};
  1704. errors[element.name] = response || validator.defaultMessage( element, "remote" );
  1705. validator.showErrors(errors);
  1706. }
  1707. previous.valid = response;
  1708. validator.stopRequest(element, response);
  1709. }
  1710. }, param));
  1711. return "pending";
  1712. } else if( this.pending[element.name] ) {
  1713. return "pending";
  1714. }
  1715. return previous.valid;
  1716. },
  1717.  
  1718. // http://docs.jquery.com/Plugins/Validation/Methods/minlength
  1719. minlength: function(value, element, param) {
  1720. return this.optional(element) || this.getLength($.trim(value), element) >= param;
  1721. },
  1722.  
  1723. // http://docs.jquery.com/Plugins/Validation/Methods/maxlength
  1724. maxlength: function(value, element, param) {
  1725. return this.optional(element) || this.getLength($.trim(value), element) <= param;
  1726. },
  1727.  
  1728. // http://docs.jquery.com/Plugins/Validation/Methods/rangelength
  1729. rangelength: function(value, element, param) {
  1730. var length = this.getLength($.trim(value), element);
  1731. return this.optional(element) || ( length >= param[0] && length <= param[1] );
  1732. },
  1733.  
  1734. // http://docs.jquery.com/Plugins/Validation/Methods/min
  1735. min: function( value, element, param ) {
  1736. return this.optional(element) || value >= param;
  1737. },
  1738.  
  1739. // http://docs.jquery.com/Plugins/Validation/Methods/max
  1740. max: function( value, element, param ) {
  1741. return this.optional(element) || value <= param;
  1742. },
  1743.  
  1744. // http://docs.jquery.com/Plugins/Validation/Methods/range
  1745. range: function( value, element, param ) {
  1746. return this.optional(element) || ( value >= param[0] && value <= param[1] );
  1747. },
  1748.  
  1749. // http://docs.jquery.com/Plugins/Validation/Methods/email
  1750. email: function(value, element) {
  1751. // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
  1752. return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
  1753. },
  1754.  
  1755. // http://docs.jquery.com/Plugins/Validation/Methods/url
  1756. url: function(value, element) {
  1757. // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
  1758. return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
  1759. },
  1760.  
  1761. // http://docs.jquery.com/Plugins/Validation/Methods/date
  1762. date: function(value, element) {
  1763. return this.optional(element) || !/Invalid|NaN/.test(new Date(value));
  1764. },
  1765.  
  1766. // http://docs.jquery.com/Plugins/Validation/Methods/dateISO
  1767. dateISO: function(value, element) {
  1768. return this.optional(element) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);
  1769. },
  1770.  
  1771. // http://docs.jquery.com/Plugins/Validation/Methods/dateDE
  1772. dateDE: function(value, element) {
  1773. return this.optional(element) || /^\d\d?\.\d\d?\.\d\d\d?\d?$/.test(value);
  1774. },
  1775.  
  1776. // http://docs.jquery.com/Plugins/Validation/Methods/number
  1777. number: function(value, element) {
  1778. return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);
  1779. },
  1780.  
  1781. // http://docs.jquery.com/Plugins/Validation/Methods/numberDE
  1782. numberDE: function(value, element) {
  1783. return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(value);
  1784. },
  1785.  
  1786. // http://docs.jquery.com/Plugins/Validation/Methods/digits
  1787. digits: function(value, element) {
  1788. return this.optional(element) || /^\d+$/.test(value);
  1789. },
  1790.  
  1791. // http://docs.jquery.com/Plugins/Validation/Methods/creditcard
  1792. // based on http://en.wikipedia.org/wiki/Luhn
  1793. creditcard: function(value, element) {
  1794. if ( this.optional(element) )
  1795. return "dependency-mismatch";
  1796. // accept only digits and dashes
  1797. if (/[^0-9-]+/.test(value))
  1798. return false;
  1799. var nCheck = 0,
  1800. nDigit = 0,
  1801. bEven = false;
  1802.  
  1803. value = value.replace(/\D/g, "");
  1804.  
  1805. for (n = value.length - 1; n >= 0; n--) {
  1806. var cDigit = value.charAt(n);
  1807. var nDigit = parseInt(cDigit, 10);
  1808. if (bEven) {
  1809. if ((nDigit *= 2) > 9)
  1810. nDigit -= 9;
  1811. }
  1812. nCheck += nDigit;
  1813. bEven = !bEven;
  1814. }
  1815.  
  1816. return (nCheck % 10) == 0;
  1817. },
  1818.  
  1819. // http://docs.jquery.com/Plugins/Validation/Methods/accept
  1820. accept: function(value, element, param) {
  1821. param = typeof param == "string" ? param : "png|jpe?g|gif";
  1822. return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i"));
  1823. },
  1824.  
  1825. // http://docs.jquery.com/Plugins/Validation/Methods/equalTo
  1826. equalTo: function(value, element, param) {
  1827. return value == $(param).val();
  1828. }
  1829.  
  1830. }
  1831.  
  1832. });
  1833.  
  1834. })(jQuery);
  1835.  
  1836. // ajax mode: abort
  1837. // usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
  1838. // if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
  1839. ;(function($) {
  1840. var ajax = $.ajax;
  1841. var pendingRequests = {};
  1842. $.ajax = function(settings) {
  1843. // create settings for compatibility with ajaxSetup
  1844. settings = $.extend(settings, $.extend({}, $.ajaxSettings, settings));
  1845. var port = settings.port;
  1846. if (settings.mode == "abort") {
  1847. if ( pendingRequests[port] ) {
  1848. pendingRequests[port].abort();
  1849. }
  1850. return (pendingRequests[port] = ajax.apply(this, arguments));
  1851. }
  1852. return ajax.apply(this, arguments);
  1853. };
  1854. })(jQuery);
  1855.  
  1856. // provides cross-browser focusin and focusout events
  1857. // IE has native support, in other browsers, use event caputuring (neither bubbles)
  1858.  
  1859. // provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
  1860. // handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
  1861.  
  1862. // provides triggerEvent(type: String, target: Element) to trigger delegated events
  1863. ;(function($) {
  1864. $.each({
  1865. focus: 'focusin',
  1866. blur: 'focusout'
  1867. }, function( original, fix ){
  1868. $.event.special[fix] = {
  1869. setup:function() {
  1870. if ( $.browser.msie ) return false;
  1871. this.addEventListener( original, $.event.special[fix].handler, true );
  1872. },
  1873. teardown:function() {
  1874. if ( $.browser.msie ) return false;
  1875. this.removeEventListener( original,
  1876. $.event.special[fix].handler, true );
  1877. },
  1878. handler: function(e) {
  1879. arguments[0] = $.event.fix(e);
  1880. arguments[0].type = fix;
  1881. return $.event.handle.apply(this, arguments);
  1882. }
  1883. };
  1884. });
  1885. $.extend($.fn, {
  1886. delegate: function(type, delegate, handler) {
  1887. return this.bind(type, function(event) {
  1888. var target = $(event.target);
  1889. if (target.is(delegate)) {
  1890. return handler.apply(target, arguments);
  1891. }
  1892. });
  1893. },
  1894. triggerEvent: function(type, target) {
  1895. return this.triggerHandler(type, [$.event.fix({ type: type, target: target })]);
  1896. }
  1897. })
  1898. })(jQuery);
  1899.  
  1900.  
  1901.  
  1902. //=========================================================================
  1903. /**
  1904. * jQuery Cookie plugin
  1905. *
  1906. * Copyright (c) 2010 Klaus Hartl (stilbuero.de)
  1907. * Dual licensed under the MIT and GPL licenses:
  1908. * http://www.opensource.org/licenses/mit-license.php
  1909. * http://www.gnu.org/licenses/gpl.html
  1910. *
  1911. */
  1912. jQuery.cookie = function (key, value, options) {
  1913.  
  1914. // key and at least value given, set cookie...
  1915. if (arguments.length > 1 && String(value) !== "[object Object]") {
  1916. options = jQuery.extend({}, options);
  1917.  
  1918. if (value === null || value === undefined) {
  1919. options.expires = -1;
  1920. }
  1921.  
  1922. if (typeof options.expires === 'number') {
  1923. var days = options.expires, t = options.expires = new Date();
  1924. t.setDate(t.getDate() + days);
  1925. }
  1926.  
  1927. value = String(value);
  1928.  
  1929. return (document.cookie = [
  1930. encodeURIComponent(key), '=',
  1931. options.raw ? value : encodeURIComponent(value),
  1932. options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
  1933. options.path ? '; path=' + options.path : '',
  1934. options.domain ? '; domain=' + options.domain : '',
  1935. options.secure ? '; secure' : ''
  1936. ].join(''));
  1937. }
  1938.  
  1939. // key and possibly options given, get cookie...
  1940. options = value || {};
  1941. var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
  1942. return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
  1943. };
  1944.  
  1945. //=========================================================================
  1946. /*
  1947. * TipTip
  1948. * Copyright 2010 Drew Wilson
  1949. * www.drewwilson.com
  1950. * code.drewwilson.com/entry/tiptip-jquery-plugin
  1951. *
  1952. * Version 1.3 - Updated: Mar. 23, 2010
  1953. *
  1954. * This Plug-In will create a custom tooltip to replace the default
  1955. * browser tooltip. It is extremely lightweight and very smart in
  1956. * that it detects the edges of the browser window and will make sure
  1957. * the tooltip stays within the current window size. As a result the
  1958. * tooltip will adjust itself to be displayed above, below, to the left
  1959. * or to the right depending on what is necessary to stay within the
  1960. * browser window. It is completely customizable as well via CSS.
  1961. *
  1962. * This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
  1963. * http://www.opensource.org/licenses/mit-license.php
  1964. * http://www.gnu.org/licenses/gpl.html
  1965. */
  1966. (function($){$.fn.tipTip=function(options){var defaults={activation:"hover",keepAlive:false,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:false,enter:function(){},exit:function(){}};var opts=$.extend(defaults,options);if($("#tiptip_holder").length<=0){var tiptip_holder=$('<div id="tiptip_holder" style="max-width:'+opts.maxWidth+';"></div>');var tiptip_content=$('<div id="tiptip_content"></div>');var tiptip_arrow=$('<div id="tiptip_arrow"></div>');$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')))}else{var tiptip_holder=$("#tiptip_holder");var tiptip_content=$("#tiptip_content");var tiptip_arrow=$("#tiptip_arrow")}return this.each(function(){var org_elem=$(this);if(opts.content){var org_title=opts.content}else{var org_title=org_elem.attr(opts.attribute)}if(org_title!=""){if(!opts.content){org_elem.removeAttr(opts.attribute)}var timeout=false;if(opts.activation=="hover"){org_elem.hover(function(){active_tiptip()},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}else if(opts.activation=="focus"){org_elem.focus(function(){active_tiptip()}).blur(function(){deactive_tiptip()})}else if(opts.activation=="click"){org_elem.click(function(){active_tiptip();return false}).hover(function(){},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}function active_tiptip(){opts.enter.call(this);tiptip_content.html(org_title);tiptip_holder.hide().removeAttr("class").css("margin","0");tiptip_arrow.removeAttr("style");var top=parseInt(org_elem.offset()['top']);var left=parseInt(org_elem.offset()['left']);var org_width=parseInt(org_elem.outerWidth());var org_height=parseInt(org_elem.outerHeight());var tip_w=tiptip_holder.outerWidth();var tip_h=tiptip_holder.outerHeight();var w_compare=Math.round((org_width-tip_w)/2);var h_compare=Math.round((org_height-tip_h)/2);var marg_left=Math.round(left+w_compare);var marg_top=Math.round(top+org_height+opts.edgeOffset);var t_class="";var arrow_top="";var arrow_left=Math.round(tip_w-12)/2;if(opts.defaultPosition=="bottom"){t_class="_bottom"}else if(opts.defaultPosition=="top"){t_class="_top"}else if(opts.defaultPosition=="left"){t_class="_left"}else if(opts.defaultPosition=="right"){t_class="_right"}var right_compare=(w_compare+left)<parseInt($(window).scrollLeft());var left_compare=(tip_w+left)>parseInt($(window).width());if((right_compare&&w_compare<0)||(t_class=="_right"&&!left_compare)||(t_class=="_left"&&left<(tip_w+opts.edgeOffset+5))){t_class="_right";arrow_top=Math.round(tip_h-13)/2;arrow_left=-12;marg_left=Math.round(left+org_width+opts.edgeOffset);marg_top=Math.round(top+h_compare)}else if((left_compare&&w_compare<0)||(t_class=="_left"&&!right_compare)){t_class="_left";arrow_top=Math.round(tip_h-13)/2;arrow_left=Math.round(tip_w);marg_left=Math.round(left-(tip_w+opts.edgeOffset+5));marg_top=Math.round(top+h_compare)}var top_compare=(top+org_height+opts.edgeOffset+tip_h+8)>parseInt($(window).height()+$(window).scrollTop());var bottom_compare=((top+org_height)-(opts.edgeOffset+tip_h+8))<0;if(top_compare||(t_class=="_bottom"&&top_compare)||(t_class=="_top"&&!bottom_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_top"}else{t_class=t_class+"_top"}arrow_top=tip_h;marg_top=Math.round(top-(tip_h+5+opts.edgeOffset))}else if(bottom_compare|(t_class=="_top"&&bottom_compare)||(t_class=="_bottom"&&!top_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_bottom"}else{t_class=t_class+"_bottom"}arrow_top=-12;marg_top=Math.round(top+org_height+opts.edgeOffset)}if(t_class=="_right_top"||t_class=="_left_top"){marg_top=marg_top+5}else if(t_class=="_right_bottom"||t_class=="_left_bottom"){marg_top=marg_top-5}if(t_class=="_left_top"||t_class=="_left_bottom"){marg_left=marg_left+5}tiptip_arrow.css({"margin-left":arrow_left+"px","margin-top":arrow_top+"px"});tiptip_holder.css({"margin-left":marg_left+"px","margin-top":marg_top+"px"}).attr("class","tip"+t_class);if(timeout){clearTimeout(timeout)}timeout=setTimeout(function(){tiptip_holder.stop(true,true).fadeIn(opts.fadeIn)},opts.delay)}function deactive_tiptip(){opts.exit.call(this);if(timeout){clearTimeout(timeout)}tiptip_holder.fadeOut(opts.fadeOut)}}})}})(jQuery);
  1967.  
  1968.  
  1969.  
  1970. //=========================================================================
  1971. //equalHeights by James Padolsey
  1972. jQuery.fn.equalHeights = function() {
  1973. return this.height(Math.max.apply(null,
  1974. this.map(function() {
  1975. return jQuery(this).height();
  1976. }).get()
  1977. ));
  1978. };
  1979.  
  1980. /*=========================================================================
  1981. * Reset text field v1.0
  1982. * Author: Manh
  1983. * www.graphicriver.net/user/Manh
  1984.  
  1985. */
  1986. (function($){
  1987. $.fn.emptyTextBox = function(options){
  1988.  
  1989. return this.each(function (){
  1990. var defaultValue = $(this).val();
  1991. $(this).blur(function (){
  1992. if ($(this).val() == 0) $(this).val(defaultValue);
  1993. $(this).css({color:'#777'});
  1994. }).focus(function (){
  1995. if ($(this).val() == defaultValue) $(this).val('');
  1996. $(this).css({color:'#111111'})
  1997. });
  1998. });}
  1999. })(jQuery);
  2000.  
  2001.  
  2002.  
  2003. /*=========================================================================
  2004. * Maxx Smooth image Preloader v1.0
  2005. * Author: Manh
  2006. * www.graphicriver.net/user/Manh
  2007.  
  2008. */
  2009.  
  2010. (function($)
  2011. {
  2012. $.fn.maxxSmoothPreloader = function(options)
  2013. {
  2014. var defaults =
  2015. {
  2016. fadeInSpeed: 800,
  2017. delay:500
  2018. };
  2019.  
  2020. var options = $.extend(defaults, options);
  2021.  
  2022. return this.each(function()
  2023. {
  2024.  
  2025. var opts = options;
  2026.  
  2027. var obj = $(this);
  2028.  
  2029. var items = $("img", obj);
  2030.  
  2031. var i = 0;
  2032. $(items).clone();
  2033. $(items).each(function()
  2034. {
  2035. var me = this;
  2036. $(this).css({visibility:"visible",opacity:0});
  2037. var j = i;
  2038. setTimeout(function()
  2039. {
  2040. $(me).animate({visibility:"inherit",opacity:1},opts.fadeInSpeed);
  2041. }, i)
  2042. i += opts.delay
  2043. });
  2044.  
  2045.  
  2046. });
  2047.  
  2048. }
  2049. })(jQuery);
  2050.  
  2051.  
  2052. //Count the element at position = 3
  2053. (function($)
  2054. {
  2055. $.fn.countThree = function(options)
  2056. {
  2057. var defaults =
  2058. {
  2059. className:''
  2060. };
  2061. var options = $.extend(defaults, options);
  2062. return this.each(function(){
  2063.  
  2064. var opts = options;
  2065.  
  2066. var obj = $(this);
  2067.  
  2068. var items = $("> *", obj);
  2069.  
  2070. $(items).each(function(){
  2071. var index = $(items).index(this)+1;
  2072. if(index%3==0 && index!=0){
  2073. $(this).addClass(opts.className);
  2074. }})
  2075.  
  2076. })
  2077. }
  2078. })(jQuery);
  2079.  
  2080.  
  2081.  
  2082.  
  2083. /*Maxx preview Overlay;
  2084. //Author Manh
  2085. //Date Created: 09/11/2011
  2086. */
  2087. (function($)
  2088. {
  2089. $.fn.mPreviewOverlay = function(options){
  2090. var defaults =
  2091. {
  2092. overlayClass:"overlay",
  2093. opacityOverlay:.5
  2094. };
  2095. var options = $.extend(defaults, options);
  2096.  
  2097. return this.each(function(){
  2098.  
  2099. var opts = options,
  2100. obj = $(this);
  2101.  
  2102. obj.append("<div class='" + opts.overlayClass + "'></div>");
  2103. /*Hide overlay*/
  2104. $("." + opts.overlayClass).css({opacity:0});
  2105.  
  2106. obj.hover(function(){
  2107. $("." + opts.overlayClass,this).stop().animate({opacity:opts.opacityOverlay});
  2108.  
  2109. },function(){
  2110. $("." + opts.overlayClass,this).stop().animate({opacity:0});
  2111. });
  2112. });
  2113. }
  2114. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement