vendor: 9,384 bytes, lines 1-227
1/* 2============================================================== 3easing.js START 4============================================================== 5*/ 6 7/* @license 8 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 9 * 10 * Uses the built in easing capabilities added In jQuery 1.1 11 * to offer multiple easing options 12 * 13 * TERMS OF USE - jQuery Easing 14 * 15 * Open source under the BSD License. 16 * 17 * Copyright © 2008 George McGinley Smith 18 * All rights reserved. 19 * 20 * Redistribution and use in source and binary forms, with or without modification, 21 * are permitted provided that the following conditions are met: 22 * 23 * Redistributions of source code must retain the above copyright notice, this list of 24 * conditions and the following disclaimer. 25 * Redistributions in binary form must reproduce the above copyright notice, this list 26 * of conditions and the following disclaimer in the documentation and/or other materials 27 * provided with the distribution. 28 * 29 * Neither the name of the author nor the names of contributors may be used to endorse 30 * or promote products derived from this software without specific prior written permission. 31 * 32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 33 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 34 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 35 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 36 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 37 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 38 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 39 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 40 * OF THE POSSIBILITY OF SUCH DAMAGE. 41 * 42*/ 43 44// t: current time, b: begInnIng value, c: change In value, d: duration 45jQuery.easing['jswing'] = jQuery.easing['swing']; 46 47jQuery.extend( jQuery.easing, 48{ 49 def: 'easeOutQuad', 50 swing: function (x, t, b, c, d) { 51 //alert(jQuery.easing.default); 52 return jQuery.easing[jQuery.easing.def](x, t, b, c, d); 53 }, 54 easeInQuad: function (x, t, b, c, d) { 55 return c*(t/=d)*t + b; 56 }, 57 easeOutQuad: function (x, t, b, c, d) { 58 return -c *(t/=d)*(t-2) + b; 59 }, 60 easeInOutQuad: function (x, t, b, c, d) { 61 if ((t/=d/2) < 1) return c/2*t*t + b; 62 return -c/2 * ((--t)*(t-2) - 1) + b; 63 }, 64 easeInCubic: function (x, t, b, c, d) { 65 return c*(t/=d)*t*t + b; 66 }, 67 easeOutCubic: function (x, t, b, c, d) { 68 return c*((t=t/d-1)*t*t + 1) + b; 69 }, 70 easeInOutCubic: function (x, t, b, c, d) { 71 if ((t/=d/2) < 1) return c/2*t*t*t + b; 72 return c/2*((t-=2)*t*t + 2) + b; 73 }, 74 easeInQuart: function (x, t, b, c, d) { 75 return c*(t/=d)*t*t*t + b; 76 }, 77 easeOutQuart: function (x, t, b, c, d) { 78 return -c * ((t=t/d-1)*t*t*t - 1) + b; 79 }, 80 easeInOutQuart: function (x, t, b, c, d) { 81 if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 82 return -c/2 * ((t-=2)*t*t*t - 2) + b; 83 }, 84 easeInQuint: function (x, t, b, c, d) { 85 return c*(t/=d)*t*t*t*t + b; 86 }, 87 easeOutQuint: function (x, t, b, c, d) { 88 return c*((t=t/d-1)*t*t*t*t + 1) + b; 89 }, 90 easeInOutQuint: function (x, t, b, c, d) { 91 if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 92 return c/2*((t-=2)*t*t*t*t + 2) + b; 93 }, 94 easeInSine: function (x, t, b, c, d) { 95 return -c * Math.cos(t/d * (Math.PI/2)) + c + b; 96 }, 97 easeOutSine: function (x, t, b, c, d) { 98 return c * Math.sin(t/d * (Math.PI/2)) + b; 99 }, 100 easeInOutSine: function (x, t, b, c, d) { 101 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; 102 }, 103 easeInExpo: function (x, t, b, c, d) { 104 return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; 105 }, 106 easeOutExpo: function (x, t, b, c, d) { 107 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; 108 }, 109 easeInOutExpo: function (x, t, b, c, d) { 110 if (t==0) return b; 111 if (t==d) return b+c; 112 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 113 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 114 }, 115 easeInCirc: function (x, t, b, c, d) { 116 return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; 117 }, 118 easeOutCirc: function (x, t, b, c, d) { 119 return c * Math.sqrt(1 - (t=t/d-1)*t) + b; 120 }, 121 easeInOutCirc: function (x, t, b, c, d) { 122 if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; 123 return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; 124 }, 125 easeInElastic: function (x, t, b, c, d) { 126 var s=1.70158;var p=0;var a=c; 127 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 128 if (a < Math.abs(c)) { a=c; var s=p/4; } 129 else var s = p/(2*Math.PI) * Math.asin (c/a); 130 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 131 }, 132 easeOutElastic: function (x, t, b, c, d) { 133 var s=1.70158;var p=0;var a=c; 134 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 135 if (a < Math.abs(c)) { a=c; var s=p/4; } 136 else var s = p/(2*Math.PI) * Math.asin (c/a); 137 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; 138 }, 139 easeInOutElastic: function (x, t, b, c, d) { 140 var s=1.70158;var p=0;var a=c; 141 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); 142 if (a < Math.abs(c)) { a=c; var s=p/4; } 143 else var s = p/(2*Math.PI) * Math.asin (c/a); 144 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 145 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; 146 }, 147 easeInBack: function (x, t, b, c, d, s) { 148 if (s == undefined) s = 1.70158; 149 return c*(t/=d)*t*((s+1)*t - s) + b; 150 }, 151 easeOutBack: function (x, t, b, c, d, s) { 152 if (s == undefined) s = 1.70158; 153 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 154 }, 155 easeInOutBack: function (x, t, b, c, d, s) { 156 if (s == undefined) s = 1.70158; 157 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 158 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 159 }, 160 easeInBounce: function (x, t, b, c, d) { 161 return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; 162 }, 163 easeOutBounce: function (x, t, b, c, d) { 164 if ((t/=d) < (1/2.75)) { 165 return c*(7.5625*t*t) + b; 166 } else if (t < (2/2.75)) { 167 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 168 } else if (t < (2.5/2.75)) { 169 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 170 } else { 171 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 172 } 173 }, 174 easeInOutBounce: function (x, t, b, c, d) { 175 if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; 176 return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; 177 } 178});//! æ¹è¡ 179 180/* @license 181 * 182 * TERMS OF USE - EASING EQUATIONS 183 * 184 * Open source under the BSD License. 185 * 186 * Copyright © 2001 Robert Penner 187 * All rights reserved. 188 * 189 * Redistribution and use in source and binary forms, with or without modification, 190 * are permitted provided that the following conditions are met: 191 * 192 * Redistributions of source code must retain the above copyright notice, this list of 193 * conditions and the following disclaimer. 194 * Redistributions in binary form must reproduce the above copyright notice, this list 195 * of conditions and the following disclaimer in the documentation and/or other materials 196 * provided with the distribution. 197 * 198 * Neither the name of the author nor the names of contributors may be used to endorse 199 * or promote products derived from this software without specific prior written permission. 200 * 201 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 202 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 203 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 204 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 205 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 206 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 207 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 208 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 209 * OF THE POSSIBILITY OF SUCH DAMAGE. 210 * 211 */ 212 213/* 214============================================================== 215easing.js END 216============================================================== 217*/ 218 219 220 221/* 222============================================================== 223jquery.cookie.js START 224============================================================== 225*/ 226 227/* @license
228 * jQuery Cookie Plugin v1.4.1 229 * https://github.com/carhartl/jquery-cookie 230 * 231 * Copyright 2006, 2014 Klaus Hartl 232 * Released under the MIT license 233 */ 234(function (factory) { 235 if (typeof define === 'function' && define.amd) { 236 // AMD (Register as an anonymous module) 237 define(['jquery'], factory); 238 } else if (typeof exports === 'object') { 239 // Node/CommonJS 240 module.exports = factory(require('jquery')); 241 } else { 242 // Browser globals 243 factory(jQuery); 244 } 245}(function ($) { 246 247 var pluses = /\+/g; 248 249 function encode(s) { 250 return config.raw ? s : encodeURIComponent(s); 251 } 252 253 function decode(s) { 254 return config.raw ? s : decodeURIComponent(s); 255 } 256 257 function stringifyCookieValue(value) { 258 return encode(config.json ? JSON.stringify(value) : String(value)); 259 } 260 261 function parseCookieValue(s) { 262 if (s.indexOf('"') === 0) { 263 // This is a quoted cookie as according to RFC2068, unescape... 264 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 265 } 266 267 try { 268 // Replace server-side written pluses with spaces. 269 // If we can't decode the cookie, ignore it, it's unusable. 270 // If we can't parse the cookie, ignore it, it's unusable. 271 s = decodeURIComponent(s.replace(pluses, ' ')); 272 return config.json ? JSON.parse(s) : s; 273 } catch(e) {} 274 } 275 276 function read(s, converter) { 277 var value = config.raw ? s : parseCookieValue(s); 278 return $.isFunction(converter) ? converter(value) : value; 279 } 280 281 var config = $.cookie = function (key, value, options) { 282 283 // Write 284 285 if (arguments.length > 1 && !$.isFunction(value)) { 286 options = $.extend({}, config.defaults, options); 287 288 if (typeof options.expires === 'number') { 289 var days = options.expires, t = options.expires = new Date(); 290 t.setMilliseconds(t.getMilliseconds() + days * 864e+5); 291 } 292 293 return (document.cookie = [ 294 encode(key), '=', stringifyCookieValue(value), 295 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 296 options.path ? '; path=' + options.path : '', 297 options.domain ? '; domain=' + options.domain : '', 298 options.secure ? '; secure' : '' 299 ].join('')); 300 } 301 302 // Read 303 304 var result = key ? undefined : {}, 305 // To prevent the for loop in the first place assign an empty array 306 // in case there are no cookies at all. Also prevents odd result when 307 // calling $.cookie(). 308 cookies = document.cookie ? document.cookie.split('; ') : [], 309 i = 0, 310 l = cookies.length; 311 312 for (; i < l; i++) { 313 var parts = cookies[i].split('='), 314 name = decode(parts.shift()), 315 cookie = parts.join('='); 316 317 if (key === name) { 318 // If second argument (value) is a function it's a converter... 319 result = read(cookie, value); 320 break; 321 } 322 323 // Prevent storing a cookie that we couldn't decode. 324 if (!key && (cookie = read(cookie)) !== undefined) { 325 result[name] = cookie; 326 } 327 } 328 329 return result; 330 }; 331 332 config.defaults = {}; 333 334 $.removeCookie = function (key, options) { 335 // Must not alter options, thus extending a fresh object... 336 $.cookie(key, '', $.extend({}, options, { expires: -1 })); 337 return !$.cookie(key); 338 }; 339 340}));//! æ¹è¡ 341 342 343/* 344============================================================== 345jquery.cookie.js END 346============================================================== 347*/ 348 349 350 351/* 352============================================================== 353jquery.autopager-1.0.0.js START 354============================================================== 355*/ 356 357/* @license
358 * jQuery.autopager v1.0.0 359 * 360 * Copyright (c) 2009 lagos 361 * Dual licensed under the MIT and GPL licenses. 362 * 363 * http://lagoscript.org 364 */ 365(function($) { 366 var window = this, options = {}, 367 content, currentUrl, nextUrl, 368 active = false, 369 defaults = { 370 autoLoad: true, 371 page: 1, 372 content: '.content', 373 link: 'a[rel=next]', 374 insertBefore: null, 375 appendTo: null, 376 start: function() {}, 377 load: function() {}, 378 disabled: false 379 }; 380 381 $.autopager = function(_options) { 382 var autopager = this.autopager; 383 384 if (typeof _options === 'string' && $.isFunction(autopager[_options])) { 385 var args = Array.prototype.slice.call(arguments, 1), 386 value = autopager[_options].apply(autopager, args); 387 388 return value === autopager || value === undefined ? this : value; 389 } 390 391 _options = $.extend({}, defaults, _options); 392 autopager.option(_options); 393 394 content = $(_options.content).filter(':last'); 395 if (content.length) { 396 if (!_options.insertBefore && !_options.appendTo) { 397 var insertBefore = content.next(); 398 if (insertBefore.length) { 399 set('insertBefore', insertBefore); 400 } else { 401 set('appendTo', content.parent()); 402 } 403 } 404 } 405 406 setUrl(); 407 408 return this; 409 }; 410 411 $.extend($.autopager, { 412 option: function(key, value) { 413 var _options = key; 414 415 if (typeof key === "string") { 416 if (value === undefined) { 417 return options[key]; 418 } 419 _options = {}; 420 _options[key] = value; 421 } 422 423 $.each(_options, function(key, value) { 424 set(key, value); 425 }); 426 return this; 427 }, 428 429 enable: function() { 430 set('disabled', false); 431 return this; 432 }, 433 434 disable: function() { 435 set('disabled', true); 436 return this; 437 }, 438 439 destroy: function() { 440 this.autoLoad(false); 441 options = {}; 442 content = currentUrl = nextUrl = undefined; 443 return this; 444 }, 445 446 autoLoad: function(value) { 447 return this.option('autoLoad', value); 448 }, 449 450 load: function() { 451 if (active || !nextUrl || options.disabled) { 452 return; 453 } 454 455 active = true; 456 options.start(currentHash(), nextHash()); 457 $.get(nextUrl, insertContent); 458 return this; 459 } 460 461 }); 462 463 function set(key, value) { 464 switch (key) { 465 case 'autoLoad': 466 if (value && !options.autoLoad) { 467 $(window).scroll(loadOnScroll); 468 } else if (!value && options.autoLoad) { 469 $(window).unbind('scroll', loadOnScroll); 470 } 471 break; 472 case 'insertBefore': 473 if (value) { 474 options.appendTo = null; 475 } 476 break 477 case 'appendTo': 478 if (value) { 479 options.insertBefore = null; 480 } 481 break 482 } 483 options[key] = value; 484 } 485 486 function setUrl(context) { 487 currentUrl = nextUrl || window.location.href; 488 nextUrl = $(options.link, context).attr('href'); 489 } 490 491 function loadOnScroll() { 492 if (content.offset().top + content.height() < $(document).scrollTop() + $(window).height()) { 493 $.autopager.load(); 494 } 495 } 496 497 function insertContent(res) { 498 var _options = options, 499 nextPage = $('<div/>').append(res.replace(/<script(.|\s)*?\/script>/g, "")), 500 nextContent = nextPage.find(_options.content); 501 502 set('page', _options.page + 1); 503 setUrl(nextPage); 504 if (nextContent.length) { 505 if (_options.insertBefore) { 506 nextContent.insertBefore(_options.insertBefore); 507 } else { 508 nextContent.appendTo(_options.appendTo); 509 } 510 _options.load.call(nextContent.get(), currentHash(), nextHash()); 511 content = nextContent.filter(':last'); 512 } 513 active = false; 514 } 515 516 function currentHash() { 517 return { 518 page: options.page, 519 url: currentUrl 520 }; 521 } 522 523 function nextHash() { 524 return { 525 page: options.page + 1, 526 url: nextUrl 527 }; 528 } 529})(jQuery);//! æ¹è¡ 530 531/* 532============================================================== 533jquery.autopager-1.0.0.js END 534============================================================== 535*/ 536 537 538 539/* 540==============================================================
541jquery.bxslider.js START 542============================================================== 543*/ 544 545/* @license 546 * BxSlider v4.1.1 - Fully loaded, responsive content slider 547 * http://bxslider.com 548 * 549 * Copyright 2013, Steven Wanderski - http://stevenwanderski.com - http://bxcreative.com 550 * Written while drinking Belgian ales and listening to jazz 551 * 552 * Released under the MIT license - http://opensource.org/licenses/MIT 553 */ 554 555(function($){ 556 557 var plugin = {}; 558 559 var defaults = { 560 561 // GENERAL 562 mode: 'horizontal', 563 slideSelector: '', 564 infiniteLoop: true, 565 hideControlOnEnd: false, 566 speed: 500, 567 easing: null, 568 slideMargin: 0, 569 startSlide: 0, 570 randomStart: false, 571 captions: false, 572 ticker: false, 573 tickerHover: false, 574 adaptiveHeight: false, 575 adaptiveHeightSpeed: 500, 576 video: false, 577 useCSS: true, 578 preloadImages: 'visible', 579 responsive: true, 580 581 // TOUCH 582 touchEnabled: true, 583 swipeThreshold: 50, 584 oneToOneTouch: true, 585 preventDefaultSwipeX: true, 586 preventDefaultSwipeY: false, 587 588 // PAGER 589 pager: true, 590 pagerType: 'full', 591 pagerShortSeparator: ' / ', 592 pagerSelector: null, 593 buildPager: null, 594 pagerCustom: null, 595 596 // CONTROLS 597 controls: true, 598 nextText: 'Next', 599 prevText: 'Prev', 600 nextSelector: null, 601 prevSelector: null, 602 autoControls: false, 603 startText: 'Start', 604 stopText: 'Stop', 605 autoControlsCombine: false, 606 autoControlsSelector: null, 607 608 // AUTO 609 auto: false, 610 pause: 4000, 611 autoStart: true, 612 autoDirection: 'next', 613 autoHover: false, 614 autoDelay: 0, 615 616 // CAROUSEL 617 minSlides: 1, 618 maxSlides: 1, 619 moveSlides: 0, 620 slideWidth: 0, 621 622 // CALLBACKS 623 onSliderLoad: function() {}, 624 onSlideBefore: function() {}, 625 onSlideAfter: function() {}, 626 onSlideNext: function() {}, 627 onSlidePrev: function() {} 628 } 629 630 $.fn.bxSlider = function(options){ 631 632 if(this.length == 0) return this; 633 634 // support mutltiple elements 635 if(this.length > 1){ 636 this.each(function(){$(this).bxSlider(options)}); 637 return this; 638 } 639 640 // create a namespace to be used throughout the plugin 641 var slider = {}; 642 // set a reference to our slider element 643 var el = this; 644 plugin.el = this; 645 646 /** 647 * Makes slideshow responsive 648 */ 649 // first get the original window dimens (thanks alot IE) 650 var windowWidth = $(window).width(); 651 var windowHeight = $(window).height(); 652 653 654 655 /** 656 * =================================================================================== 657 * = PRIVATE FUNCTIONS 658 * =================================================================================== 659 */ 660 661 /** 662 * Initializes namespace settings to be used throughout plugin 663 */ 664 var init = function(){ 665 // merge user-supplied options with the defaults 666 slider.settings = $.extend({}, defaults, options); 667 // parse slideWidth setting 668 slider.settings.slideWidth = parseInt(slider.settings.slideWidth); 669 // store the original children 670 slider.children = el.children(slider.settings.slideSelector); 671 // check if actual number of slides is less than minSlides / maxSlides 672 if(slider.children.length < slider.settings.minSlides) slider.settings.minSlides = slider.children.length; 673 if(slider.children.length < slider.settings.maxSlides) slider.settings.maxSlides = slider.children.length; 674 // if random start, set the startSlide setting to random number 675 if(slider.settings.randomStart) slider.settings.startSlide = Math.floor(Math.random() * slider.children.length); 676 // store active slide information 677 slider.active = { index: slider.settings.startSlide }
678 // store if the slider is in carousel mode (displaying / moving multiple slides) 679 slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1; 680 // if carousel, force preloadImages = 'all' 681 if(slider.carousel) slider.settings.preloadImages = 'all'; 682 // calculate the min / max width thresholds based on min / max number of slides 683 // used to setup and update carousel slides dimensions 684 slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin); 685 slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin); 686 // store the current state of the slider (if currently animating, working is true) 687 slider.working = false; 688 // initialize the controls object 689 slider.controls = {}; 690 // initialize an auto interval 691 slider.interval = null; 692 // determine which property to use for transitions 693 slider.animProp = slider.settings.mode == 'vertical' ? 'top' : 'left'; 694 // determine if hardware acceleration can be used 695 slider.usingCSS = slider.settings.useCSS && slider.settings.mode != 'fade' && (function(){ 696 // create our test div element 697 var div = document.createElement('div'); 698 // css transition properties 699 var props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective']; 700 // test for each property 701 for(var i in props){ 702 if(div.style[props[i]] !== undefined){ 703 slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase(); 704 slider.animProp = '-' + slider.cssPrefix + '-transform'; 705 return true; 706 } 707 } 708 return false; 709 }()); 710 // if vertical mode always make maxSlides and minSlides equal 711 if(slider.settings.mode == 'vertical') slider.settings.maxSlides = slider.settings.minSlides; 712 // save original style data 713 el.data("origStyle", el.attr("style")); 714 el.children(slider.settings.slideSelector).each(function() { 715 $(this).data("origStyle", $(this).attr("style")); 716 }); 717 // perform all DOM / CSS modifications 718 setup(); 719 } 720 721 /** 722 * Performs all DOM and CSS modifications 723 */ 724 var setup = function(){ 725 // wrap el in a wrapper 726 el.wrap('<div class="bx-wrapper"><div class="bx-viewport"></div></div>'); 727 // store a namspace reference to .bx-viewport 728 slider.viewport = el.parent(); 729 // add a loading div to display while images are loading 730 slider.loader = $('<div class="bx-loading" />'); 731 slider.viewport.prepend(slider.loader); 732 // set el to a massive width, to hold any needed slides 733 // also strip any margin and padding from el 734 el.css({ 735 width: slider.settings.mode == 'horizontal' ? (slider.children.length * 100 + 215) + '%' : 'auto', 736 position: 'relative' 737 }); 738 // if using CSS, add the easing property 739 if(slider.usingCSS && slider.settings.easing){ 740 el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing); 741 // if not using CSS and no easing value was supplied, use the default JS animation easing (swing) 742 }else if(!slider.settings.easing){ 743 slider.settings.easing = 'swing'; 744 } 745 var slidesShowing = getNumberSlidesShowing(); 746 // make modifications to the viewport (.bx-viewport) 747 slider.viewport.css({ 748 width: '100%', 749 overflow: 'hidden', 750 position: 'relative' 751 }); 752 slider.viewport.parent().css({ 753 maxWidth: getViewportMaxWidth() 754 }); 755 // make modification to the wrapper (.bx-wrapper)
756 if(!slider.settings.pager) { 757 slider.viewport.parent().css({ 758 margin: '0 auto 0px' 759 }); 760 } 761 // apply css to all slider children 762 slider.children.css({ 763 'float': slider.settings.mode == 'horizontal' ? 'left' : 'none', 764 listStyle: 'none', 765 position: 'relative' 766 }); 767 // apply the calculated width after the float is applied to prevent scrollbar interference 768 slider.children.css('width', getSlideWidth()); 769 // if slideMargin is supplied, add the css 770 if(slider.settings.mode == 'horizontal' && slider.settings.slideMargin > 0) slider.children.css('marginRight', slider.settings.slideMargin); 771 if(slider.settings.mode == 'vertical' && slider.settings.slideMargin > 0) slider.children.css('marginBottom', slider.settings.slideMargin); 772 // if "fade" mode, add positioning and z-index CSS 773 if(slider.settings.mode == 'fade'){ 774 slider.children.css({ 775 position: 'absolute', 776 zIndex: 0, 777 display: 'none' 778 }); 779 // prepare the z-index on the showing element 780 slider.children.eq(slider.settings.startSlide).css({zIndex: 50, display: 'block'}); 781 } 782 // create an element to contain all slider controls (pager, start / stop, etc) 783 slider.controls.el = $('<div class="bx-controls" />'); 784 // if captions are requested, add them 785 if(slider.settings.captions) appendCaptions(); 786 // check if startSlide is last slide 787 slider.active.last = slider.settings.startSlide == getPagerQty() - 1; 788 // if video is true, set up the fitVids plugin 789 if(slider.settings.video) el.fitVids(); 790 // set the default preload selector (visible) 791 var preloadSelector = slider.children.eq(slider.settings.startSlide); 792 if (slider.settings.preloadImages == "all") preloadSelector = slider.children;
793 // only check for control addition if not in "ticker" mode 794 if(!slider.settings.ticker){ 795 // if pager is requested, add it 796 if(slider.settings.pager) appendPager(); 797 // if controls are requested, add them 798 if(slider.settings.controls) appendControls(); 799 // if auto is true, and auto controls are requested, add them 800 if(slider.settings.auto && slider.settings.autoControls) appendControlsAuto(); 801 // if any control option is requested, add the controls wrapper 802 if(slider.settings.controls || slider.settings.autoControls || slider.settings.pager) slider.viewport.after(slider.controls.el); 803 // if ticker mode, do not allow a pager 804 }else{ 805 slider.settings.pager = false; 806 } 807 // preload all images, then perform final DOM / CSS modifications that depend on images being loaded 808 loadElements(preloadSelector, start); 809 } 810 811 var loadElements = function(selector, callback){ 812 var total = selector.find('img, iframe').length; 813 if (total == 0){ 814 callback(); 815 return; 816 } 817 var count = 0; 818 selector.find('img, iframe').each(function(){ 819 $(this).one('load', function() { 820 if(++count == total) callback(); 821 }).each(function() { 822 if(this.complete) $(this).load(); 823 }); 824 }); 825 } 826 827 /** 828 * Start the slider 829 */ 830 var start = function(){ 831 // if infinite loop, prepare additional slides 832 if(slider.settings.infiniteLoop && slider.settings.mode != 'fade' && !slider.settings.ticker){ 833 var slice = slider.settings.mode == 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides; 834 var sliceAppend = slider.children.slice(0, slice).clone().addClass('bx-clone'); 835 var slicePrepend = slider.children.slice(-slice).clone().addClass('bx-clone'); 836 el.append(sliceAppend).prepend(slicePrepend); 837 } 838 // remove the loading DOM element 839 slider.loader.remove(); 840 // set the left / top position of "el" 841 setSlidePosition(); 842 // if "vertical" mode, always use adaptiveHeight to prevent odd behavior 843 if (slider.settings.mode == 'vertical') slider.settings.adaptiveHeight = true; 844 // set the viewport height 845 slider.viewport.height(getViewportHeight()); 846 // make sure everything is positioned just right (same as a window resize) 847 el.redrawSlider(); 848 // onSliderLoad callback 849 slider.settings.onSliderLoad(slider.active.index); 850 // slider has been fully initialized 851 slider.initialized = true; 852 // bind the resize call to the window 853 if (slider.settings.responsive) $(window).bind('resize', resizeWindow); 854 // if auto is true, start the show 855 if (slider.settings.auto && slider.settings.autoStart) initAuto(); 856 // if ticker is true, start the ticker 857 if (slider.settings.ticker) initTicker(); 858 // if pager is requested, make the appropriate pager link active 859 if (slider.settings.pager) updatePagerActive(slider.settings.startSlide); 860 // check for any updates to the controls (like hideControlOnEnd updates) 861 if (slider.settings.controls) updateDirectionControls(); 862 // if touchEnabled is true, setup the touch events 863 if (slider.settings.touchEnabled && !slider.settings.ticker) initTouch(); 864 } 865 866 /** 867 * Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value 868 */ 869 var getViewportHeight = function(){ 870 var height = 0; 871 // first determine which children (slides) should be used in our height calculation 872 var children = $(); 873 // if mode is not "vertical" and adaptiveHeight is false, include all children 874 if(slider.settings.mode != 'vertical' && !slider.settings.adaptiveHeight){ 875 children = slider.children; 876 }else{ 877 // if not carousel, return the single active child
878 if(!slider.carousel){ 879 children = slider.children.eq(slider.active.index); 880 // if carousel, return a slice of children 881 }else{ 882 // get the individual slide index 883 var currentIndex = slider.settings.moveSlides == 1 ? slider.active.index : slider.active.index * getMoveBy(); 884 // add the current slide to the children 885 children = slider.children.eq(currentIndex); 886 // cycle through the remaining "showing" slides 887 for (i = 1; i <= slider.settings.maxSlides - 1; i++){ 888 // if looped back to the start 889 if(currentIndex + i >= slider.children.length){ 890 children = children.add(slider.children.eq(i - 1)); 891 }else{ 892 children = children.add(slider.children.eq(currentIndex + i)); 893 } 894 } 895 } 896 } 897 // if "vertical" mode, calculate the sum of the heights of the children 898 if(slider.settings.mode == 'vertical'){ 899 children.each(function(index) { 900 height += $(this).outerHeight(); 901 }); 902 // add user-supplied margins 903 if(slider.settings.slideMargin > 0){ 904 height += slider.settings.slideMargin * (slider.settings.minSlides - 1); 905 } 906 // if not "vertical" mode, calculate the max height of the children 907 }else{ 908 height = Math.max.apply(Math, children.map(function(){ 909 return $(this).outerHeight(false); 910 }).get()); 911 } 912 return height; 913 } 914 915 /** 916 * Returns the calculated width to be used for the outer wrapper / viewport 917 */ 918 var getViewportMaxWidth = function(){ 919 var width = '100%'; 920 if(slider.settings.slideWidth > 0){ 921 if(slider.settings.mode == 'horizontal'){ 922 width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin); 923 }else{ 924 width = slider.settings.slideWidth; 925 } 926 } 927 return width; 928 } 929 930 /** 931 * Returns the calculated width to be applied to each slide 932 */ 933 var getSlideWidth = function(){ 934 // start with any user-supplied slide width 935 var newElWidth = slider.settings.slideWidth; 936 // get the current viewport width 937 var wrapWidth = slider.viewport.width(); 938 // if slide width was not supplied, or is larger than the viewport use the viewport width 939 if(slider.settings.slideWidth == 0 || 940 (slider.settings.slideWidth > wrapWidth && !slider.carousel) || 941 slider.settings.mode == 'vertical'){ 942 newElWidth = wrapWidth; 943 // if carousel, use the thresholds to determine the width 944 }else if(slider.settings.maxSlides > 1 && slider.settings.mode == 'horizontal'){ 945 if(wrapWidth > slider.maxThreshold){ 946 // newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.maxSlides - 1))) / slider.settings.maxSlides; 947 }else if(wrapWidth < slider.minThreshold){ 948 newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides; 949 } 950 } 951 return newElWidth; 952 } 953 954 /** 955 * Returns the number of slides currently visible in the viewport (includes partially visible slides) 956 */ 957 var getNumberSlidesShowing = function(){ 958 var slidesShowing = 1; 959 if(slider.settings.mode == 'horizontal' && slider.settings.slideWidth > 0){ 960 // if viewport is smaller than minThreshold, return minSlides 961 if(slider.viewport.width() < slider.minThreshold){ 962 slidesShowing = slider.settings.minSlides; 963 // if viewport is larger than minThreshold, return maxSlides 964 }else if(slider.viewport.width() > slider.maxThreshold){ 965 slidesShowing = slider.settings.maxSlides; 966 // if viewport is between min / max thresholds, divide viewport width by first child width 967 }else{ 968 var childWidth = slider.children.first().width(); 969 slidesShowing = Math.floor(slider.viewport.width() / childWidth); 970 } 971 // if "vertical" mode, slides showing will always be minSlides 972 }else if(slider.settings.mode == 'vertical'){ 973 slidesShowing = slider.settings.minSlides; 974 } 975 return slidesShowing; 976 } 977 978 /** 979 * Returns the number of pages (one full viewport of slides is one "page") 980 */ 981 var getPagerQty = function(){ 982 var pagerQty = 0; 983 // if moveSlides is specified by the user 984 if(slider.settings.moveSlides > 0){ 985 if(slider.settings.infiniteLoop){ 986 pagerQty = slider.children.length / getMoveBy(); 987 }else{ 988 // use a while loop to determine pages 989 var breakPoint = 0; 990 var counter = 0 991 // when breakpoint goes above children length, counter is the number of pages 992 while (breakPoint < slider.children.length){ 993 ++pagerQty; 994 breakPoint = counter + getNumberSlidesShowing(); 995 counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing(); 996 } 997 }
998 // if moveSlides is 0 (auto) divide children length by sides showing, then round up 999 }else{ 1000 pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing()); 1001 } 1002 return pagerQty; 1003 } 1004 1005 /** 1006 * Returns the number of indivual slides by which to shift the slider 1007 */ 1008 var getMoveBy = function(){ 1009 // if moveSlides was set by the user and moveSlides is less than number of slides showing 1010 if(slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()){ 1011 return slider.settings.moveSlides; 1012 } 1013 // if moveSlides is 0 (auto) 1014 return getNumberSlidesShowing(); 1015 } 1016 1017 /** 1018 * Sets the slider's (el) left or top position 1019 */ 1020 var setSlidePosition = function(){ 1021 // if last slide, not infinite loop, and number of children is larger than specified maxSlides 1022 if(slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop){ 1023 if (slider.settings.mode == 'horizontal'){ 1024 // get the last child's position 1025 var lastChild = slider.children.last(); 1026 var position = lastChild.position(); 1027 // set the left position 1028 setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.width())), 'reset', 0); 1029 }else if(slider.settings.mode == 'vertical'){ 1030 // get the last showing index's position 1031 var lastShowingIndex = slider.children.length - slider.settings.minSlides; 1032 var position = slider.children.eq(lastShowingIndex).position(); 1033 // set the top position 1034 setPositionProperty(-position.top, 'reset', 0); 1035 } 1036 // if not last slide 1037 }else{ 1038 // get the position of the first showing slide 1039 var position = slider.children.eq(slider.active.index * getMoveBy()).position(); 1040 // check for last slide 1041 if (slider.active.index == getPagerQty() - 1) slider.active.last = true; 1042 // set the repective position 1043 if (position != undefined){ 1044 if (slider.settings.mode == 'horizontal') setPositionProperty(-position.left, 'reset', 0); 1045 else if (slider.settings.mode == 'vertical') setPositionProperty(-position.top, 'reset', 0); 1046 } 1047 } 1048 } 1049 1050 /** 1051 * Sets the el's animating property position (which in turn will sometimes animate el). 1052 * If using CSS, sets the transform property. If not using CSS, sets the top / left property. 1053 * 1054 * @param value (int) 1055 * - the animating property's value 1056 * 1057 * @param type (string) 'slider', 'reset', 'ticker' 1058 * - the type of instance for which the function is being 1059 * 1060 * @param duration (int) 1061 * - the amount of time (in ms) the transition should occupy 1062 * 1063 * @param params (array) optional 1064 * - an optional parameter containing any variables that need to be passed in 1065 */ 1066 var setPositionProperty = function(value, type, duration, params){ 1067 // use CSS transform 1068 if(slider.usingCSS){ 1069 // determine the translate3d value 1070 var propValue = slider.settings.mode == 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)'; 1071 // add the CSS transition-duration 1072 el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's'); 1073 if(type == 'slide'){ 1074 // set the property value 1075 el.css(slider.animProp, propValue); 1076 // bind a callback method - executes when CSS transition completes 1077 el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(){ 1078 // unbind the callback 1079 el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 1080 updateAfterSlideTransition(); 1081 }); 1082 }else if(type == 'reset'){ 1083 el.css(slider.animProp, propValue); 1084 }else if(type == 'ticker'){ 1085 // make the transition use 'linear' 1086 el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear'); 1087 el.css(slider.animProp, propValue); 1088 // bind a callback method - executes when CSS transition completes 1089 el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(){ 1090 // unbind the callback 1091 el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 1092 // reset the position 1093 setPositionProperty(params['resetValue'], 'reset', 0); 1094 // start the loop again 1095 tickerLoop(); 1096 }); 1097 } 1098 // use JS animate 1099 }else{ 1100 var animateObj = {}; 1101 animateObj[slider.animProp] = value; 1102 if(type == 'slide'){ 1103 el.animate(animateObj, duration, slider.settings.easing, function(){ 1104 updateAfterSlideTransition(); 1105 }); 1106 }else if(type == 'reset'){ 1107 el.css(slider.animProp, value) 1108 }else if(type == 'ticker'){ 1109 el.animate(animateObj, speed, 'linear', function(){ 1110 setPositionProperty(params['resetValue'], 'reset', 0); 1111 // run the recursive loop after animation 1112 tickerLoop(); 1113 }); 1114 } 1115 } 1116 } 1117 1118 /** 1119 * Populates the pager with proper amount of pages 1120 */ 1121 var populatePager = function(){ 1122 var pagerHtml = ''; 1123 var pagerQty = getPagerQty(); 1124 // loop through each pager item 1125 for(var i=0; i < pagerQty; i++){ 1126 var linkContent = ''; 1127 // if a buildPager function is supplied, use it to get pager link value, else use index + 1 1128 if(slider.settings.buildPager && $.isFunction(slider.settings.buildPager)){ 1129 linkContent = slider.settings.buildPager(i); 1130 slider.pagerEl.addClass('bx-custom-pager'); 1131 }else{ 1132 linkContent = i + 1; 1133 slider.pagerEl.addClass('bx-default-pager'); 1134 } 1135 // var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1; 1136 // add the markup to the string 1137 pagerHtml += '<div class="bx-pager-item">
1137<a href="" data-slide-index="' + i + '" class="bx-pager-link">' + linkContent + '</a></div>'; 1138 }; 1139 // populate the pager element with pager links 1140 slider.pagerEl.html(pagerHtml); 1141 } 1142 1143 /** 1144 * Appends the pager to the controls element 1145 */ 1146 var appendPager = function(){ 1147 if(!slider.settings.pagerCustom){ 1148 // create the pager DOM element 1149 slider.pagerEl = $('<div class="bx-pager" />'); 1150 // if a pager selector was supplied, populate it with the pager 1151 if(slider.settings.pagerSelector){ 1152 $(slider.settings.pagerSelector).html(slider.pagerEl); 1153 // if no pager selector was supplied, add it after the wrapper 1154 }else{ 1155 slider.controls.el.addClass('bx-has-pager').append(slider.pagerEl); 1156 } 1157 // populate the pager 1158 populatePager(); 1159 }else{ 1160 slider.pagerEl = $(slider.settings.pagerCustom); 1161 } 1162 // assign the pager click binding 1163 slider.pagerEl.delegate('a', 'click', clickPagerBind); 1164 } 1165 1166 /** 1167 * Appends prev / next controls to the controls element 1168 */ 1169 var appendControls = function(){ 1170 slider.controls.next = $('<a class="bx-next" href="">' + slider.settings.nextText + '</a>'); 1171 slider.controls.prev = $('<a class="bx-prev" href="">' + slider.settings.prevText + '</a>'); 1172 // bind click actions to the controls 1173 slider.controls.next.bind('click', clickNextBind); 1174 slider.controls.prev.bind('click', clickPrevBind); 1175 // if nextSlector was supplied, populate it 1176 if(slider.settings.nextSelector){ 1177 $(slider.settings.nextSelector).append(slider.controls.next); 1178 } 1179 // if prevSlector was supplied, populate it 1180 if(slider.settings.prevSelector){ 1181 $(slider.settings.prevSelector).append(slider.controls.prev); 1182 } 1183 // if no custom selectors were supplied 1184 if(!slider.settings.nextSelector && !slider.settings.prevSelector){ 1185 // add the controls to the DOM 1186 slider.controls.directionEl = $('<div class="bx-controls-direction" />'); 1187 // add the control elements to the directionEl 1188 slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next); 1189 // slider.viewport.append(slider.controls.directionEl); 1190 slider.controls.el.addClass('bx-has-controls-direction').append(slider.controls.directionEl); 1191 } 1192 } 1193 1194 /** 1195 * Appends start / stop auto controls to the controls element 1196 */ 1197 var appendControlsAuto = function(){ 1198 slider.controls.start = $('<div class="bx-controls-auto-item"><a class="bx-start" href="">' + slider.settings.startText + '</a></div>'); 1199 slider.controls.stop = $('<div class="bx-controls-auto-item"><a class="bx-stop" href="">' + slider.settings.stopText + '</a></div>'); 1200 // add the controls to the DOM 1201 slider.controls.autoEl = $('<div class="bx-controls-auto" />'); 1202 // bind click actions to the controls 1203 slider.controls.autoEl.delegate('.bx-start', 'click', clickStartBind); 1204 slider.controls.autoEl.delegate('.bx-stop', 'click', clickStopBind); 1205 // if autoControlsCombine, insert only the "start" control 1206 if(slider.settings.autoControlsCombine){ 1207 slider.controls.autoEl.append(slider.controls.start); 1208 // if autoControlsCombine is false, insert both controls 1209 }else{ 1210 slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop); 1211 } 1212 // if auto controls selector was supplied, populate it with the controls 1213 if(slider.settings.autoControlsSelector){ 1214 $(slider.settings.autoControlsSelector).html(slider.controls.autoEl); 1215 // if auto controls selector was not supplied, add it after the wrapper 1216 }else{ 1217 slider.controls.el.addClass('bx-has-controls-auto').append(slider.controls.autoEl); 1218 } 1219 // update the auto controls
1220 updateAutoControls(slider.settings.autoStart ? 'stop' : 'start'); 1221 } 1222 1223 /** 1224 * Appends image captions to the DOM 1225 */ 1226 var appendCaptions = function(){ 1227 // cycle through each child 1228 slider.children.each(function(index){ 1229 // get the image title attribute 1230 var title = $(this).find('img:first').attr('title'); 1231 // append the caption 1232 if (title != undefined && ('' + title).length) { 1233 $(this).append('<div class="bx-caption"><span>' + title + '</span></div>'); 1234 } 1235 }); 1236 } 1237 1238 /** 1239 * Click next binding 1240 * 1241 * @param e (event) 1242 * - DOM event object 1243 */ 1244 var clickNextBind = function(e){ 1245 // if auto show is running, stop it 1246 if (slider.settings.auto) el.stopAuto(); 1247 el.goToNextSlide(); 1248 e.preventDefault(); 1249 } 1250 1251 /** 1252 * Click prev binding 1253 * 1254 * @param e (event) 1255 * - DOM event object 1256 */ 1257 var clickPrevBind = function(e){ 1258 // if auto show is running, stop it 1259 if (slider.settings.auto) el.stopAuto(); 1260 el.goToPrevSlide(); 1261 e.preventDefault(); 1262 } 1263 1264 /** 1265 * Click start binding 1266 * 1267 * @param e (event) 1268 * - DOM event object 1269 */ 1270 var clickStartBind = function(e){ 1271 el.startAuto(); 1272 e.preventDefault(); 1273 } 1274 1275 /** 1276 * Click stop binding 1277 * 1278 * @param e (event) 1279 * - DOM event object 1280 */ 1281 var clickStopBind = function(e){ 1282 el.stopAuto(); 1283 e.preventDefault(); 1284 } 1285 1286 /** 1287 * Click pager binding 1288 * 1289 * @param e (event) 1290 * - DOM event object 1291 */ 1292 var clickPagerBind = function(e){ 1293 // if auto show is running, stop it 1294 if (slider.settings.auto) el.stopAuto(); 1295 var pagerLink = $(e.currentTarget); 1296 var pagerIndex = parseInt(pagerLink.attr('data-slide-index')); 1297 // if clicked pager link is not active, continue with the goToSlide call 1298 if(pagerIndex != slider.active.index) el.goToSlide(pagerIndex); 1299 e.preventDefault(); 1300 } 1301 1302 /** 1303 * Updates the pager links with an active class 1304 * 1305 * @param slideIndex (int) 1306 * - index of slide to make active 1307 */ 1308 var updatePagerActive = function(slideIndex){ 1309 // if "short" pager type 1310 var len = slider.children.length; // nb of children 1311 if(slider.settings.pagerType == 'short'){ 1312 if(slider.settings.maxSlides > 1) { 1313 len = Math.ceil(slider.children.length/slider.settings.maxSlides); 1314 } 1315 slider.pagerEl.html( (slideIndex + 1) + slider.settings.pagerShortSeparator + len); 1316 return; 1317 } 1318 // remove all pager active classes 1319 slider.pagerEl.find('a').removeClass('active'); 1320 // apply the active class for all pagers 1321 slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); }); 1322 } 1323 1324 /** 1325 * Performs needed actions after a slide transition 1326 */ 1327 var updateAfterSlideTransition = function(){ 1328 // if infinte loop is true 1329 if(slider.settings.infiniteLoop){ 1330 var position = ''; 1331 // first slide 1332 if(slider.active.index == 0){ 1333 // set the new position 1334 position = slider.children.eq(0).position(); 1335 // carousel, last slide 1336 }else if(slider.active.index == getPagerQty() - 1 && slider.carousel){ 1337 position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position(); 1338 // last slide 1339 }else if(slider.active.index == slider.children.length - 1){ 1340 position = slider.children.eq(slider.children.length - 1).position(); 1341 } 1342 if (slider.settings.mode == 'horizontal') { setPositionProperty(-position.left, 'reset', 0);; } 1343 else if (slider.settings.mode == 'vertical') { setPositionProperty(-position.top, 'reset', 0);; } 1344 } 1345 // declare that the transition is complete 1346 slider.working = false; 1347 // onSlideAfter callback 1348 slider.settings.onSlideAfter(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index); 1349 } 1350 1351 /** 1352 * Updates the auto controls state (either active, or combined switch) 1353 * 1354 * @param state (string) "start", "stop" 1355 * - the new state of the auto show 1356 */ 1357 var updateAutoControls = function(state){ 1358 // if autoControlsCombine is true, replace the current control with the new state 1359 if(slider.settings.autoControlsCombine){
1360 slider.controls.autoEl.html(slider.controls[state]); 1361 // if autoControlsCombine is false, apply the "active" class to the appropriate control 1362 }else{ 1363 slider.controls.autoEl.find('a').removeClass('active'); 1364 slider.controls.autoEl.find('a:not(.bx-' + state + ')').addClass('active'); 1365 } 1366 } 1367 1368 /** 1369 * Updates the direction controls (checks if either should be hidden) 1370 */ 1371 var updateDirectionControls = function(){ 1372 if(getPagerQty() == 1){ 1373 slider.controls.prev.addClass('disabled'); 1374 slider.controls.next.addClass('disabled'); 1375 }else if(!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd){ 1376 // if first slide 1377 if (slider.active.index == 0){ 1378 slider.controls.prev.addClass('disabled'); 1379 slider.controls.next.removeClass('disabled'); 1380 // if last slide 1381 }else if(slider.active.index == getPagerQty() - 1){ 1382 slider.controls.next.addClass('disabled'); 1383 slider.controls.prev.removeClass('disabled'); 1384 // if any slide in the middle 1385 }else{ 1386 slider.controls.prev.removeClass('disabled'); 1387 slider.controls.next.removeClass('disabled'); 1388 } 1389 } 1390 } 1391 1392 /** 1393 * Initialzes the auto process 1394 */ 1395 var initAuto = function(){ 1396 // if autoDelay was supplied, launch the auto show using a setTimeout() call 1397 if(slider.settings.autoDelay > 0){ 1398 var timeout = setTimeout(el.startAuto, slider.settings.autoDelay); 1399 // if autoDelay was not supplied, start the auto show normally 1400 }else{ 1401 el.startAuto(); 1402 } 1403 // if autoHover is requested 1404 if(slider.settings.autoHover){ 1405 // on el hover 1406 el.hover(function(){ 1407 // if the auto show is currently playing (has an active interval) 1408 if(slider.interval){ 1409 // stop the auto show and pass true agument which will prevent control update 1410 el.stopAuto(true); 1411 // create a new autoPaused value which will be used by the relative "mouseout" event 1412 slider.autoPaused = true; 1413 } 1414 }, function(){ 1415 // if the autoPaused value was created be the prior "mouseover" event 1416 if(slider.autoPaused){ 1417 // start the auto show and pass true agument which will prevent control update 1418 el.startAuto(true); 1419 // reset the autoPaused value 1420 slider.autoPaused = null; 1421 } 1422 }); 1423 } 1424 } 1425 1426 /** 1427 * Initialzes the ticker process 1428 */ 1429 var initTicker = function(){ 1430 var startPosition = 0; 1431 // if autoDirection is "next", append a clone of the entire slider 1432 if(slider.settings.autoDirection == 'next'){ 1433 el.append(slider.children.clone().addClass('bx-clone')); 1434 // if autoDirection is "prev", prepend a clone of the entire slider, and set the left position 1435 }else{ 1436 el.prepend(slider.children.clone().addClass('bx-clone')); 1437 var position = slider.children.first().position(); 1438 startPosition = slider.settings.mode == 'horizontal' ? -position.left : -position.top; 1439 } 1440 setPositionProperty(startPosition, 'reset', 0); 1441 // do not allow controls in ticker mode 1442 slider.settings.pager = false; 1443 slider.settings.controls = false; 1444 slider.settings.autoControls = false; 1445 // if autoHover is requested 1446 if(slider.settings.tickerHover && !slider.usingCSS){ 1447 // on el hover 1448 slider.viewport.hover(function(){ 1449 el.stop(); 1450 }, function(){ 1451 // calculate the total width of children (used to calculate the speed ratio) 1452 var totalDimens = 0; 1453 slider.children.each(function(index){ 1454 totalDimens += slider.settings.mode == 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true); 1455 }); 1456 // calculate the speed ratio (used to determine the new speed to finish the paused animation) 1457 var ratio = slider.settings.speed / totalDimens; 1458 // determine which property to use 1459 var property = slider.settings.mode == 'horizontal' ? 'left' : 'top'; 1460 // calculate the new speed 1461 var newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property))))); 1462 tickerLoop(newSpeed); 1463 }); 1464 } 1465 // start the ticker loop 1466 tickerLoop(); 1467 } 1468 1469 /** 1470 * Runs a continuous loop, news ticker-style 1471 */ 1472 var tickerLoop = function(resumeSpeed){ 1473 speed = resumeSpeed ? resumeSpeed : slider.settings.speed; 1474 var position = {left: 0, top: 0};
1475 var reset = {left: 0, top: 0}; 1476 // if "next" animate left position to last child, then reset left to 0 1477 if(slider.settings.autoDirection == 'next'){ 1478 position = el.find('.bx-clone').first().position(); 1479 // if "prev" animate left position to 0, then reset left to first non-clone child 1480 }else{ 1481 reset = slider.children.first().position(); 1482 } 1483 var animateProperty = slider.settings.mode == 'horizontal' ? -position.left : -position.top; 1484 var resetValue = slider.settings.mode == 'horizontal' ? -reset.left : -reset.top; 1485 var params = {resetValue: resetValue}; 1486 setPositionProperty(animateProperty, 'ticker', speed, params); 1487 } 1488 1489 /** 1490 * Initializes touch events 1491 */ 1492 var initTouch = function(){ 1493 // initialize object to contain all touch values 1494 slider.touch = { 1495 start: {x: 0, y: 0}, 1496 end: {x: 0, y: 0} 1497 } 1498 slider.viewport.bind('touchstart', onTouchStart); 1499 } 1500 1501 /** 1502 * Event handler for "touchstart" 1503 * 1504 * @param e (event) 1505 * - DOM event object 1506 */ 1507 var onTouchStart = function(e){ 1508 if(slider.working){ 1509 e.preventDefault(); 1510 }else{ 1511 // record the original position when touch starts 1512 slider.touch.originalPos = el.position(); 1513 var orig = e.originalEvent; 1514 // record the starting touch x, y coordinates 1515 slider.touch.start.x = orig.changedTouches[0].pageX; 1516 slider.touch.start.y = orig.changedTouches[0].pageY; 1517 // bind a "touchmove" event to the viewport 1518 slider.viewport.bind('touchmove', onTouchMove); 1519 // bind a "touchend" event to the viewport 1520 slider.viewport.bind('touchend', onTouchEnd); 1521 } 1522 } 1523 1524 /** 1525 * Event handler for "touchmove" 1526 * 1527 * @param e (event) 1528 * - DOM event object 1529 */ 1530 var onTouchMove = function(e){ 1531 var orig = e.originalEvent; 1532 // if scrolling on y axis, do not prevent default 1533 var xMovement = Math.abs(orig.changedTouches[0].pageX - slider.touch.start.x); 1534 var yMovement = Math.abs(orig.changedTouches[0].pageY - slider.touch.start.y); 1535 // x axis swipe 1536 if((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX){ 1537 e.preventDefault(); 1538 // y axis swipe 1539 }else if((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY){ 1540 e.preventDefault(); 1541 } 1542 if(slider.settings.mode != 'fade' && slider.settings.oneToOneTouch){ 1543 var value = 0; 1544 // if horizontal, drag along x axis 1545 if(slider.settings.mode == 'horizontal'){ 1546 var change = orig.changedTouches[0].pageX - slider.touch.start.x; 1547 value = slider.touch.originalPos.left + change; 1548 // if vertical, drag along y axis 1549 }else{ 1550 var change = orig.changedTouches[0].pageY - slider.touch.start.y; 1551 value = slider.touch.originalPos.top + change; 1552 } 1553 setPositionProperty(value, 'reset', 0); 1554 } 1555 } 1556 1557 /** 1558 * Event handler for "touchend" 1559 * 1560 * @param e (event) 1561 * - DOM event object 1562 */ 1563 var onTouchEnd = function(e){ 1564 slider.viewport.unbind('touchmove', onTouchMove); 1565 var orig = e.originalEvent; 1566 var value = 0; 1567 // record end x, y positions 1568 slider.touch.end.x = orig.changedTouches[0].pageX; 1569 slider.touch.end.y = orig.changedTouches[0].pageY; 1570 // if fade mode, check if absolute x distance clears the threshold 1571 if(slider.settings.mode == 'fade'){ 1572 var distance = Math.abs(slider.touch.start.x - slider.touch.end.x); 1573 if(distance >= slider.settings.swipeThreshold){ 1574 slider.touch.start.x > slider.touch.end.x ? el.goToNextSlide() : el.goToPrevSlide(); 1575 el.stopAuto(); 1576 } 1577 // not fade mode 1578 }else{ 1579 var distance = 0; 1580 // calculate distance and el's animate property 1581 if(slider.settings.mode == 'horizontal'){
1582 distance = slider.touch.end.x - slider.touch.start.x; 1583 value = slider.touch.originalPos.left; 1584 }else{ 1585 distance = slider.touch.end.y - slider.touch.start.y; 1586 value = slider.touch.originalPos.top; 1587 } 1588 // if not infinite loop and first / last slide, do not attempt a slide transition 1589 if(!slider.settings.infiniteLoop && ((slider.active.index == 0 && distance > 0) || (slider.active.last && distance < 0))){ 1590 setPositionProperty(value, 'reset', 200); 1591 }else{ 1592 // check if distance clears threshold 1593 if(Math.abs(distance) >= slider.settings.swipeThreshold){ 1594 distance < 0 ? el.goToNextSlide() : el.goToPrevSlide(); 1595 el.stopAuto(); 1596 }else{ 1597 // el.animate(property, 200); 1598 setPositionProperty(value, 'reset', 200); 1599 } 1600 } 1601 } 1602 slider.viewport.unbind('touchend', onTouchEnd); 1603 } 1604 1605 /** 1606 * Window resize event callback 1607 */ 1608 var resizeWindow = function(e){ 1609 // get the new window dimens (again, thank you IE) 1610 var windowWidthNew = $(window).width(); 1611 var windowHeightNew = $(window).height(); 1612 // make sure that it is a true window resize 1613 // *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements 1614 // are resized. Can you just die already?* 1615 if(windowWidth != windowWidthNew || windowHeight != windowHeightNew){ 1616 // set the new window dimens 1617 windowWidth = windowWidthNew; 1618 windowHeight = windowHeightNew; 1619 // update all dynamic elements 1620 el.redrawSlider(); 1621 } 1622 } 1623 1624 /** 1625 * =================================================================================== 1626 * = PUBLIC FUNCTIONS 1627 * =================================================================================== 1628 */ 1629 1630 /** 1631 * Performs slide transition to the specified slide 1632 * 1633 * @param slideIndex (int) 1634 * - the destination slide's index (zero-based) 1635 * 1636 * @param direction (string) 1637 * - INTERNAL USE ONLY - the direction of travel ("prev" / "next") 1638 */ 1639 el.goToSlide = function(slideIndex, direction){ 1640 // if plugin is currently in motion, ignore request 1641 if(slider.working || slider.active.index == slideIndex) return; 1642 // declare that plugin is in motion 1643 slider.working = true; 1644 // store the old index 1645 slider.oldIndex = slider.active.index; 1646 // if slideIndex is less than zero, set active index to last child (this happens during infinite loop) 1647 if(slideIndex < 0){ 1648 slider.active.index = getPagerQty() - 1; 1649 // if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop) 1650 }else if(slideIndex >= getPagerQty()){ 1651 slider.active.index = 0; 1652 // set active index to requested slide 1653 }else{ 1654 slider.active.index = slideIndex; 1655 } 1656 // onSlideBefore, onSlideNext, onSlidePrev callbacks 1657 slider.settings.onSlideBefore(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index); 1658 if(direction == 'next'){ 1659 slider.settings.onSlideNext(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index); 1660 }else if(direction == 'prev'){ 1661 slider.settings.onSlidePrev(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index); 1662 } 1663 // check if last slide 1664 slider.active.last = slider.active.index >= getPagerQty() - 1; 1665 // update the pager with active class 1666 if(slider.settings.pager) updatePagerActive(slider.active.index); 1667 // // check for direction control update 1668 if(slider.settings.controls) updateDirectionControls(); 1669 // if slider is set to mode: "fade" 1670 if(slider.settings.mode == 'fade'){ 1671 // if adaptiveHeight is true and next height is different from current height, animate to the new height 1672 if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHe
1672ight()){ 1673 slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed); 1674 } 1675 // fade out the visible child and reset its z-index value 1676 slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0}); 1677 // fade in the newly requested slide 1678 slider.children.eq(slider.active.index).css('zIndex', 51).fadeIn(slider.settings.speed, function(){ 1679 $(this).css('zIndex', 50); 1680 updateAfterSlideTransition(); 1681 }); 1682 // slider mode is not "fade" 1683 }else{ 1684 // if adaptiveHeight is true and next height is different from current height, animate to the new height 1685 if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHeight()){ 1686 slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed); 1687 } 1688 var moveBy = 0; 1689 var position = {left: 0, top: 0}; 1690 // if carousel and not infinite loop 1691 if(!slider.settings.infiniteLoop && slider.carousel && slider.active.last){ 1692 if(slider.settings.mode == 'horizontal'){ 1693 // get the last child position 1694 var lastChild = slider.children.eq(slider.children.length - 1); 1695 position = lastChild.position(); 1696 // calculate the position of the last slide 1697 moveBy = slider.viewport.width() - lastChild.outerWidth(); 1698 }else{ 1699 // get last showing index position 1700 var lastShowingIndex = slider.children.length - slider.settings.minSlides; 1701 position = slider.children.eq(lastShowingIndex).position(); 1702 } 1703 // horizontal carousel, going previous while on first slide (infiniteLoop mode) 1704 }else if(slider.carousel && slider.active.last && direction == 'prev'){ 1705 // get the last child position 1706 var eq = slider.settings.moveSlides == 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides); 1707 var lastChild = el.children('.bx-clone').eq(eq); 1708 position = lastChild.position(); 1709 // if infinite loop and "Next" is clicked on the last slide 1710 }else if(direction == 'next' && slider.active.index == 0){ 1711 // get the last clone position 1712 position = el.find('> .bx-clone').eq(slider.settings.maxSlides).position(); 1713 slider.active.last = false; 1714 // normal non-zero requests 1715 }else if(slideIndex >= 0){ 1716 var requestEl = slideIndex * getMoveBy(); 1717 position = slider.children.eq(requestEl).position(); 1718 } 1719 1720 /* If the position doesn't exist 1721 * (e.g. if you destroy the slider on a next click), 1722 * it doesn't throw an error. 1723 */ 1724 if ("undefined" !== typeof(position)) { 1725 var value = slider.settings.mode == 'horizontal' ? -(position.left - moveBy) : -position.top; 1726 // plugin values to be animated 1727 setPositionProperty(value, 'slide', slider.settings.speed); 1728 } 1729 } 1730 } 1731 1732 /** 1733 * Transitions to the next slide in the show 1734 */ 1735 el.goToNextSlide = function(){ 1736 // if infiniteLoop is false and last page is showing, disregard call 1737 if (!slider.settings.infiniteLoop && slider.active.last) return; 1738 var pagerIndex = parseInt(slider.active.index) + 1; 1739 el.goToSlide(pagerIndex, 'next'); 1740 } 1741 1742 /** 1743 * Transitions to the prev slide in the show 1744 */ 1745 el.goToPrevSlide = function(){ 1746 // if infiniteLoop is false and last page is showing, disregard call 1747 if (!slider.settings.infiniteLoop && slider.active.index == 0) return; 1748 var pagerIndex = parseInt(slider.active.index) - 1; 1749 el.goToSlide(pagerIndex, 'prev'); 1750 } 1751 1752 /** 1753 * Starts the auto show 1754 * 1755 * @param preventControlUpdate (boolean) 1756 * - if true, auto controls state will not be updated 1757 */ 1758 el.startAuto = function(preventControlUpdate){ 1759 // if an interval already exists, disregard call 1760 if(slider.interval) return; 1761 // create an interval 1762 slider.interval = setInterval(function(){ 1763 slider.settings.autoDirection == 'next' ? el.goToNextSlide() : el.goToPrevSlide(); 1764 }, slider.settings.pause); 1765 // if auto controls are displayed and preventControlUpdate is not true 1766 if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('stop'); 1767 } 1768 1769 /** 1770 * Stops the auto show 1771 * 1772 * @param preventControlUpdate (boolean) 1773 * - if true, auto controls state will not be updated 1774 */ 1775 el.stopAuto = function(preventControlUpdate){ 1776 // if no interval exists, disregard call
1777 if(!slider.interval) return; 1778 // clear the interval 1779 clearInterval(slider.interval); 1780 slider.interval = null; 1781 // if auto controls are displayed and preventControlUpdate is not true 1782 if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('start'); 1783 } 1784 1785 /** 1786 * Returns current slide index (zero-based) 1787 */ 1788 el.getCurrentSlide = function(){ 1789 return slider.active.index; 1790 } 1791 1792 /** 1793 * Returns number of slides in show 1794 */ 1795 el.getSlideCount = function(){ 1796 return slider.children.length; 1797 } 1798 1799 /** 1800 * Update all dynamic slider elements 1801 */ 1802 el.redrawSlider = function(){ 1803 // resize all children in ratio to new screen size 1804 slider.children.add(el.find('.bx-clone')).outerWidth(getSlideWidth()); 1805 // adjust the height 1806 slider.viewport.css('height', getViewportHeight()); 1807 // update the slide position 1808 if(!slider.settings.ticker) setSlidePosition(); 1809 // if active.last was true before the screen resize, we want 1810 // to keep it last no matter what screen size we end on 1811 if (slider.active.last) slider.active.index = getPagerQty() - 1; 1812 // if the active index (page) no longer exists due to the resize, simply set the index as last 1813 if (slider.active.index >= getPagerQty()) slider.active.last = true; 1814 // if a pager is being displayed and a custom pager is not being used, update it 1815 if(slider.settings.pager && !slider.settings.pagerCustom){ 1816 populatePager(); 1817 updatePagerActive(slider.active.index); 1818 } 1819 } 1820 1821 /** 1822 * Destroy the current instance of the slider (revert everything back to original state) 1823 */ 1824 el.destroySlider = function(){ 1825 // don't do anything if slider has already been destroyed 1826 if(!slider.initialized) return; 1827 slider.initialized = false; 1828 $('.bx-clone', this).remove(); 1829 slider.children.each(function() { 1830 $(this).data("origStyle") != undefined ? $(this).attr("style", $(this).data("origStyle")) : $(this).removeAttr('style'); 1831 }); 1832 $(this).data("origStyle") != undefined ? this.attr("style", $(this).data("origStyle")) : $(this).removeAttr('style'); 1833 $(this).unwrap().unwrap(); 1834 if(slider.controls.el) slider.controls.el.remove(); 1835 if(slider.controls.next) slider.controls.next.remove(); 1836 if(slider.controls.prev) slider.controls.prev.remove(); 1837 if(slider.pagerEl) slider.pagerEl.remove(); 1838 $('.bx-caption', this).remove(); 1839 if(slider.controls.autoEl) slider.controls.autoEl.remove(); 1840 clearInterval(slider.interval); 1841 if(slider.settings.responsive) $(window).unbind('resize', resizeWindow); 1842 } 1843 1844 /** 1845 * Reload the slider (revert all DOM changes, and re-initialize) 1846 */ 1847 el.reloadSlider = function(settings){ 1848 if (settings != undefined) options = settings; 1849 el.destroySlider(); 1850 init(); 1851 } 1852 1853 init(); 1854 1855 // returns the current jQuery object 1856 return this; 1857 } 1858 1859})(jQuery);//! æ¹è¡ 1860 1861/* 1862============================================================== 1863jquery.bxslider.js END 1864============================================================== 1865*/ 1866 1867 1868 1869/* 1870============================================================== 1871jquery.carouFredSel-6.2.1.js START 1872============================================================== 1873*/ 1874 1875/* @license 1876 * jQuery carouFredSel 6.2.1 1877 * Demo's and documentation: 1878 * caroufredsel.dev7studios.com 1879 * 1880 * Copyright (c) 2013 Fred Heusschen 1881 * www.frebsite.nl 1882 * 1883 * Dual licensed under the MIT and GPL licenses. 1884 * http://en.wikipedia.org/wiki/MIT_License 1885 * http://en.wikipedia.org/wiki/GNU_General_Public_License 1886 */ 1887 1888 1889(function($) { 1890 1891 1892 // LOCAL 1893 1894 if ( $.fn.carouFredSel ) 1895 { 1896 return; 1897 } 1898
vendor: 38,274 bytes, lines 1899-2934
1899 $.fn.caroufredsel = $.fn.carouFredSel = function(options, configs) 1900 { 1901 1902 // no element 1903 if (this.length == 0) 1904 { 1905 debug( true, 'No element found for "' + this.selector + '".' ); 1906 return this; 1907 } 1908 1909 // multiple elements 1910 if (this.length > 1) 1911 { 1912 return this.each(function() { 1913 $(this).carouFredSel(options, configs); 1914 }); 1915 } 1916 1917 1918 var $cfs = this, 1919 $tt0 = this[0], 1920 starting_position = false; 1921 1922 if ($cfs.data('_cfs_isCarousel')) 1923 { 1924 starting_position = $cfs.triggerHandler('_cfs_triggerEvent', 'currentPosition'); 1925 $cfs.trigger('_cfs_triggerEvent', ['destroy', true]); 1926 } 1927 1928 var FN = {}; 1929 1930 FN._init = function(o, setOrig, start) 1931 { 1932 o = go_getObject($tt0, o); 1933 1934 o.items = go_getItemsObject($tt0, o.items); 1935 o.scroll = go_getScrollObject($tt0, o.scroll); 1936 o.auto = go_getAutoObject($tt0, o.auto); 1937 o.prev = go_getPrevNextObject($tt0, o.prev); 1938 o.next = go_getPrevNextObject($tt0, o.next); 1939 o.pagination = go_getPaginationObject($tt0, o.pagination); 1940 o.swipe = go_getSwipeObject($tt0, o.swipe); 1941 o.mousewheel = go_getMousewheelObject($tt0, o.mousewheel); 1942 1943 if (setOrig) 1944 { 1945 opts_orig = $.extend(true, {}, $.fn.carouFredSel.defaults, o); 1946 } 1947 1948 opts = $.extend(true, {}, $.fn.carouFredSel.defaults, o); 1949 opts.d = cf_getDimensions(opts); 1950 1951 crsl.direction = (opts.direction == 'up' || opts.direction == 'left') ? 'next' : 'prev'; 1952 1953 var a_itm = $cfs.children(), 1954 avail_primary = ms_getParentSize($wrp, opts, 'width'); 1955 1956 if (is_true(opts.cookie)) 1957 { 1958 opts.cookie = 'caroufredsel_cookie_' + conf.serialNumber; 1959 } 1960 1961 opts.maxDimension = ms_getMaxDimension(opts, avail_primary); 1962 1963 // complement items and sizes 1964 opts.items = in_complementItems(opts.items, opts, a_itm, start); 1965 opts[opts.d['width']] = in_complementPrimarySize(opts[opts.d['width']], opts, a_itm); 1966 opts[opts.d['height']] = in_complementSecondarySize(opts[opts.d['height']], opts, a_itm); 1967 1968 // primary size not set for a responsive carousel 1969 if (opts.responsive) 1970 { 1971 if (!is_percentage(opts[opts.d['width']])) 1972 { 1973 opts[opts.d['width']] = '100%'; 1974 } 1975 } 1976 1977 // primary size is percentage 1978 if (is_percentage(opts[opts.d['width']])) 1979 { 1980 crsl.upDateOnWindowResize = true; 1981 crsl.primarySizePercentage = opts[opts.d['width']]; 1982 opts[opts.d['width']] = ms_getPercentage(avail_primary, crsl.primarySizePercentage); 1983 if (!opts.items.visible) 1984 { 1985 opts.items.visibleConf.variable = true; 1986 } 1987 } 1988 1989 if (opts.responsive) 1990 { 1991 opts.usePadding = false; 1992 opts.padding = [0, 0, 0, 0]; 1993 opts.align = false; 1994 opts.items.visibleConf.variable = false; 1995 } 1996 else 1997 { 1998 // visible-items not set 1999 if (!opts.items.visible) 2000 { 2001 opts = in_complementVisibleItems(opts, avail_primary); 2002 } 2003 2004 // primary size not set -> calculate it or set to "variable" 2005 if (!opts[opts.d['width']]) 2006 { 2007 if (!opts.items.visibleConf.variable && is_number(opts.items[opts.d['width']]) && opts.items.filter == '*') 2008 { 2009 opts[opts.d['width']] = opts.items.visible * opts.items[opts.d['width']]; 2010 opts.align = false; 2011 } 2012 else 2013 { 2014 opts[opts.d['width']] = 'variable'; 2015 } 2016 } 2017 // align not set -> set to center if primary size is number 2018 if (is_undefined(opts.align)) 2019 { 2020 opts.align = (is_number(opts[opts.d['width']])) 2021 ? 'center' 2022 : false; 2023 } 2024 // set variabe visible-items 2025 if (opts.items.visibleConf.variable) 2026 { 2027 opts.items.visible = gn_getVisibleItemsNext(a_itm, opts, 0); 2028 } 2029 } 2030 2031 // set visible items by filter 2032 if (opts.items.filter != '*' && !opts.items.visibleConf.variable) 2033 { 2034 opts.items.visibleConf.org = opts.items.visible; 2035 opts.items.visible = gn_getVisibleItemsNextFilter(a_itm, opts, 0); 2036 } 2037 2038 opts.items.visible = cf_getItemsAdjust(opts.items.visible, opts, opts.items.visibleConf.adjust, $tt0); 2039 opts.items.visibleConf.old = opts.items.visible; 2040 2041 if (opts.responsive) 2042 { 2043 if (!opts.items.visibleConf.min) 2044 { 2045 opts.items.visibleConf.min = opts.items.visible; 2046 } 2047 if (!opts.items.visibleConf.max) 2048 { 2049 opts.items.visibleConf.max = opts.items.visible; 2050 } 2051 opts = in_getResponsiveValues(opts, a_itm, avail_primary); 2052 } 2053 else 2054 { 2055 opts.padding = cf_getPadding(opts.padding); 2056 2057 if (opts.align == 'top') 2058 { 2059 opts.align = 'left'; 2060 } 2061 else if (opts.align == 'bottom') 2062 { 2063 opts.align = 'right'; 2064 } 2065 2066 switch (opts.align) 2067 { 2068 // align: center, left or right 2069 case 'center': 2070 case 'left': 2071 case 'right': 2072 if (opts[opts.d['width']] != 'variable') 2073 { 2074 opts = in_getAlignPadding(opts, a_itm); 2075 opts.usePadding = true; 2076 } 2077 break; 2078 2079 // padding 2080 default: 2081 opts.align = false; 2082 opts.usePadding = ( 2083 opts.padding[0] == 0 && 2084 opts.padding[1] == 0 && 2085 opts.padding[2] == 0 && 2086 opts.padding[3] == 0 2087 ) ? false : true; 2088 break; 2089 } 2090 } 2091 2092 if (!is_number(opts.scroll.duration)) 2093 { 2094 opts.scroll.duration = 500; 2095 } 2096 if (is_undefined(opts.scroll.items)) 2097 { 2098 opts.scroll.items = (opts.responsive || opts.items.visibleConf.variable || opts.items.filter != '*') 2099 ? 'visible' 2100 : opts.items.visible; 2101 } 2102 2103 opts.auto = $.extend(true, {}, opts.scroll, opts.auto); 2104 opts.prev = $.extend(true, {}, opts.scroll, opts.prev); 2105 opts.next = $.extend(true, {}, opts.scroll, opts.next); 2106 opts.pagination = $.extend(true, {}, opts.scroll, opts.pagination); 2107 // swipe and mousewheel extend later on, per direction 2108 2109 opts.auto = go_complementAutoObject($tt0, opts.auto); 2110 opts.prev = go_complementPrevNextObject($tt0, opts.prev); 2111 opts.next = go_complementPrevNextObject($tt0, opts.next); 2112 opts.pagination = go_complementPaginationObject($tt0, opts.pagination); 2113 opts.swipe = go_complementSwipeObject($tt0, opts.swipe); 2114 opts.mousewheel = go_complementMousewheelObject($tt0, opts.mousewheel); 2115 2116 if (opts.synchronise) 2117 { 2118 opts.synchronise = cf_getSynchArr(opts.synchronise); 2119 } 2120 2121 2122 // DEPRECATED 2123 if (opts.auto.onPauseStart) 2124 { 2125 opts.auto.onTimeoutStart = opts.auto.onPauseStart; 2126 deprecated('auto.onPauseStart', 'auto.onTimeoutStart'); 2127 } 2128 if (opts.auto.onPausePause) 2129 { 2130 opts.auto.onTimeoutPause = opts.auto.onPausePause; 2131 deprecated('auto.onPausePause', 'auto.onTimeoutPause'); 2132 } 2133 if (opts.auto.onPauseEnd) 2134 { 2135 opts.auto.onTimeoutEnd = opts.auto.onPauseEnd; 2136 deprecated('auto.onPauseEnd', 'auto.onTimeoutEnd'); 2137 } 2138 if (opts.auto.pauseDuration) 2139 { 2140 opts.auto.timeoutDuration = opts.auto.pauseDuration; 2141 deprecated('auto.pauseDuration', 'auto.timeoutDuration'); 2142 } 2143 // /DEPRECATED 2144 2145 2146 }; // /init 2147 2148 2149 FN._build = function() { 2150 $cfs.data('_cfs_isCarousel', true); 2151 2152 var a_itm = $cfs.children(), 2153 orgCSS = in_mapCss($cfs, ['textAlign', 'float', 'position', 'top', 'right', 'bottom', 'left', 'zIndex', 'width', 'height', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft']), 2154 newPosition = 'relative'; 2155 2156 switch (orgCSS.position) 2157 { 2158 case 'absolute': 2159 case 'fixed': 2160 newPosition = orgCSS.position; 2161 break; 2162 } 2163 2164 if (conf.wrapper == 'parent') 2165 { 2166 sz_storeOrigCss($wrp); 2167 } 2168 else 2169 { 2170 $wrp.css(orgCSS); 2171 } 2172 $wrp.css({ 2173 'overflow' : 'hidden', 2174 'position' : newPosition 2175 }); 2176 2177 sz_storeOrigCss($cfs); 2178 $cfs.data('_cfs_origCssZindex', orgCSS.zIndex); 2179 $cfs.css({ 2180 'textAlign' : 'left', 2181 'float' : 'none', 2182 'position' : 'absolute', 2183 'top' : 0, 2184 'right' : 'auto', 2185 'bottom' : 'auto', 2186 'left' : 0, 2187 'marginTop' : 0, 2188 'marginRight' : 0, 2189 'marginBottom' : 0, 2190 'marginLeft' : 0 2191 }); 2192 2193 sz_storeMargin(a_itm, opts); 2194 sz_storeOrigCss(a_itm); 2195 if (opts.responsive) 2196 { 2197 sz_setResponsiveSizes(opts, a_itm); 2198 } 2199 2200 }; // /build 2201 2202 2203 FN._bind_events = function() { 2204 FN._unbind_events(); 2205 2206 2207 // stop event 2208 $cfs.bind(cf_e('stop', conf), function(e, imm) { 2209 e.stopPropagation(); 2210 2211 // button 2212 if (!crsl.isStopped) 2213 { 2214 if (opts.auto.button) 2215 { 2216 opts.auto.button.addClass(cf_c('stopped', conf)); 2217 } 2218 } 2219 2220 // set stopped 2221 crsl.isStopped = true; 2222 2223 if (opts.auto.play) 2224 { 2225 opts.auto.play = false; 2226 $cfs.trigger(cf_e('pause', conf), imm); 2227 } 2228 return true; 2229 }); 2230 2231 2232 // finish event 2233 $cfs.bind(cf_e('finish', conf), function(e) { 2234 e.stopPropagation(); 2235 if (crsl.isScrolling) 2236 { 2237 sc_stopScroll(scrl); 2238 } 2239 return true; 2240 }); 2241 2242 2243 // pause event 2244 $cfs.bind(cf_e('pause', conf), function(e, imm, res) { 2245 e.stopPropagation(); 2246 tmrs = sc_clearTimers(tmrs); 2247 2248 // immediately pause 2249 if (imm && crsl.isScrolling) 2250 { 2251 scrl.isStopped = true; 2252 var nst = getTime() - scrl.startTime; 2253 scrl.duration -= nst; 2254 if (scrl.pre) 2255 { 2256 scrl.pre.duration -= nst; 2257 } 2258 if (scrl.post) 2259 { 2260 scrl.post.duration -= nst; 2261 } 2262 sc_stopScroll(scrl, false); 2263 } 2264 2265 // update remaining pause-time 2266 if (!crsl.isPaused && !crsl.isScrolling) 2267 { 2268 if (res) 2269 { 2270 tmrs.timePassed += getTime() - tmrs.startTime; 2271 } 2272 } 2273 2274 // button 2275 if (!crsl.isPaused) 2276 { 2277 if (opts.auto.button) 2278 { 2279 opts.auto.button.addClass(cf_c('paused', conf)); 2280 } 2281 } 2282 2283 // set paused 2284 crsl.isPaused = true; 2285 2286 // pause pause callback 2287 if (opts.auto.onTimeoutPause) 2288 { 2289 var dur1 = opts.auto.timeoutDuration - tmrs.timePassed, 2290 perc = 100 - Math.ceil( dur1 * 100 / opts.auto.timeoutDuration ); 2291 2292 opts.auto.onTimeoutPause.call($tt0, perc, dur1); 2293 } 2294 return true; 2295 }); 2296 2297 2298 // play event 2299 $cfs.bind(cf_e('play', conf), function(e, dir, del, res) { 2300 e.stopPropagation(); 2301 tmrs = sc_clearTimers(tmrs); 2302 2303 // sort params 2304 var v = [dir, del, res], 2305 t = ['string', 'number', 'boolean'], 2306 a = cf_sortParams(v, t); 2307 2308 dir = a[0]; 2309 del = a[1]; 2310 res = a[2]; 2311 2312 if (dir != 'prev' && dir != 'next') 2313 { 2314 dir = crsl.direction; 2315 } 2316 if (!is_number(del)) 2317 { 2318 del = 0; 2319 } 2320 if (!is_boolean(res)) 2321 { 2322 res = false; 2323 } 2324 2325 // stopped? 2326 if (res) 2327 { 2328 crsl.isStopped = false; 2329 opts.auto.play = true; 2330 } 2331 if (!opts.auto.play) 2332 { 2333 e.stopImmediatePropagation(); 2334 return debug(conf, 'Carousel stopped: Not scrolling.'); 2335 } 2336 2337 // button 2338 if (crsl.isPaused) 2339 { 2340 if (opts.auto.button) 2341 { 2342 opts.auto.button.removeClass(cf_c('stopped', conf)); 2343 opts.auto.button.removeClass(cf_c('paused', conf)); 2344 } 2345 } 2346 2347 // set playing 2348 crsl.isPaused = false; 2349 tmrs.startTime = getTime(); 2350 2351 // timeout the scrolling 2352 var dur1 = opts.auto.timeoutDuration + del; 2353 dur2 = dur1 - tmrs.timePassed; 2354 perc = 100 - Math.ceil(dur2 * 100 / dur1); 2355 2356 if (opts.auto.progress) 2357 { 2358 tmrs.progress = setInterval(function() { 2359 var pasd = getTime() - tmrs.startTime + tmrs.timePassed, 2360 perc = Math.ceil(pasd * 100 / dur1); 2361 opts.auto.progress.updater.call(opts.auto.progress.bar[0], perc); 2362 }, opts.auto.progress.interval); 2363 } 2364 2365 tmrs.auto = setTimeout(function() { 2366 if (opts.auto.progress) 2367 { 2368 opts.auto.progress.updater.call(opts.auto.progress.bar[0], 100); 2369 } 2370 if (opts.auto.onTimeoutEnd) 2371 { 2372 opts.auto.onTimeoutEnd.call($tt0, perc, dur2); 2373 } 2374 if (crsl.isScrolling) 2375 { 2376 $cfs.trigger(cf_e('play', conf), dir); 2377 } 2378 else 2379 { 2380 $cfs.trigger(cf_e(dir, conf), opts.auto); 2381 } 2382 }, dur2); 2383 2384 // pause start callback 2385 if (opts.auto.onTimeoutStart) 2386 { 2387 opts.auto.onTimeoutStart.call($tt0, perc, dur2); 2388 } 2389 2390 return true; 2391 }); 2392 2393 2394 // resume event 2395 $cfs.bind(cf_e('resume', conf), function(e) { 2396 e.stopPropagation(); 2397 if (scrl.isStopped) 2398 { 2399 scrl.isStopped = false; 2400 crsl.isPaused = false; 2401 crsl.isScrolling = true; 2402 scrl.startTime = getTime(); 2403 sc_startScroll(scrl, conf); 2404 } 2405 else 2406 { 2407 $cfs.trigger(cf_e('play', conf)); 2408 } 2409 return true; 2410 }); 2411 2412 2413 // prev + next events 2414 $cfs.bind(cf_e('prev', conf)+' '+cf_e('next', conf), function(e, obj, num, clb, que) { 2415 e.stopPropagation(); 2416 2417 // stopped or hidden carousel, don't scroll, don't queue 2418 if (crsl.isStopped || $cfs.is(':hidden')) 2419 { 2420 e.stopImmediatePropagation(); 2421 return debug(conf, 'Carousel stopped or hidden: Not scrolling.'); 2422 } 2423 2424 // not enough items 2425 var minimum = (is_number(opts.items.minimum)) ? opts.items.minimum : opts.items.visible + 1; 2426 if (minimum > itms.total) 2427 { 2428 e.stopImmediatePropagation(); 2429 return debug(conf, 'Not enough items ('+itms.total+' total, '+minimum+' needed): Not scrolling.'); 2430 } 2431 2432 // get config 2433 var v = [obj, num, clb, que], 2434 t = ['object', 'number/string', 'function', 'boolean'], 2435 a = cf_sortParams(v, t); 2436 2437 obj = a[0]; 2438 num = a[1]; 2439 clb = a[2]; 2440 que = a[3]; 2441 2442 var eType = e.type.slice(conf.events.prefix.length); 2443 2444 if (!is_object(obj)) 2445 { 2446 obj = {}; 2447 } 2448 if (is_function(clb)) 2449 { 2450 obj.onAfter = clb; 2451 } 2452 if (is_boolean(que)) 2453 { 2454 obj.queue = que; 2455 } 2456 obj = $.extend(true, {}, opts[eType], obj); 2457 2458 // test conditions callback 2459 if (obj.conditions && !obj.conditions.call($tt0, eType)) 2460 { 2461 e.stopImmediatePropagation(); 2462 return debug(conf, 'Callback "conditions" returned false.'); 2463 } 2464 2465 if (!is_number(num)) 2466 { 2467 if (opts.items.filter != '*') 2468 { 2469 num = 'visible'; 2470 } 2471 else 2472 { 2473 var arr = [num, obj.items, opts[eType].items]; 2474 for (var a = 0, l = arr.length; a < l; a++) 2475 { 2476 if (is_number(arr[a]) || arr[a] == 'page' || arr[a] == 'visible') { 2477 num = arr[a]; 2478 break; 2479 } 2480 } 2481 } 2482 switch(num) { 2483 case 'page': 2484 e.stopImmediatePropagation(); 2485 return $cfs.triggerHandler(cf_e(eType+'Page', conf), [obj, clb]); 2486 break; 2487 2488 case 'visible': 2489 if (!opts.items.visibleConf.variable && opts.items.filter == '*') 2490 { 2491 num = opts.items.visible; 2492 } 2493 break; 2494 } 2495 } 2496 2497 // resume animation, add current to queue 2498 if (scrl.isStopped) 2499 { 2500 $cfs.trigger(cf_e('resume', conf)); 2501 $cfs.trigger(cf_e('queue', conf), [eType, [obj, num, clb]]); 2502 e.stopImmediatePropagation(); 2503 return debug(conf, 'Carousel resumed scrolling.'); 2504 } 2505 2506 // queue if scrolling 2507 if (obj.duration > 0) 2508 { 2509 if (crsl.isScrolling) 2510 { 2511 if (obj.queue) 2512 { 2513 if (obj.queue == 'last') 2514 { 2515 queu = []; 2516 } 2517 if (obj.queue != 'first' || queu.length == 0) 2518 { 2519 $cfs.trigger(cf_e('queue', conf), [eType, [obj, num, clb]]); 2520 } 2521 } 2522 e.stopImmediatePropagation(); 2523 return debug(conf, 'Carousel currently scrolling.'); 2524 } 2525 } 2526 2527 tmrs.timePassed = 0; 2528 $cfs.trigger(cf_e('slide_'+eType, conf), [obj, num]); 2529 2530 // synchronise 2531 if (opts.synchronise) 2532 { 2533 var s = opts.synchronise, 2534 c = [obj, num]; 2535 2536 for (var j = 0, l = s.length; j < l; j++) { 2537 var d = eType; 2538 if (!s[j][2]) 2539 { 2540 d = (d == 'prev') ? 'next' : 'prev'; 2541 } 2542 if (!s[j][1]) 2543 { 2544 c[0] = s[j][0].triggerHandler('_cfs_triggerEvent', ['configuration', d]); 2545 } 2546 c[1] = num + s[j][3]; 2547 s[j][0].trigger('_cfs_triggerEvent', ['slide_'+d, c]); 2548 } 2549 } 2550 return true; 2551 }); 2552 2553 2554 // prev event 2555 $cfs.bind(cf_e('slide_prev', conf), function(e, sO, nI) { 2556 e.stopPropagation(); 2557 var a_itm = $cfs.children(); 2558 2559 // non-circular at start, scroll to end 2560 if (!opts.circular) 2561 { 2562 if (itms.first == 0) 2563 { 2564 if (opts.infinite) 2565 { 2566 $cfs.trigger(cf_e('next', conf), itms.total-1); 2567 } 2568 return e.stopImmediatePropagation(); 2569 } 2570 } 2571 2572 sz_resetMargin(a_itm, opts); 2573 2574 // find number of items to scroll 2575 if (!is_number(nI)) 2576 { 2577 if (opts.items.visibleConf.variable) 2578 { 2579 nI = gn_getVisibleItemsPrev(a_itm, opts, itms.total-1); 2580 } 2581 else if (opts.items.filter != '*') 2582 { 2583 var xI = (is_number(sO.items)) ? sO.items : gn_getVisibleOrg($cfs, opts); 2584 nI = gn_getScrollItemsPrevFilter(a_itm, opts, itms.total-1, xI); 2585 } 2586 else 2587 { 2588 nI = opts.items.visible; 2589 } 2590 nI = cf_getAdjust(nI, opts, sO.items, $tt0); 2591 } 2592 2593 // prevent non-circular from scrolling to far 2594 if (!opts.circular) 2595 { 2596 if (itms.total - nI < itms.first) 2597 { 2598 nI = itms.total - itms.first; 2599 } 2600 } 2601 2602 // set new number of visible items 2603 opts.items.visibleConf.old = opts.items.visible; 2604 if (opts.items.visibleConf.variable) 2605 { 2606 var vI = cf_getItemsAdjust(gn_getVisibleItemsNext(a_itm, opts, itms.total-nI), opts, opts.items.visibleConf.adjust, $tt0); 2607 if (opts.items.visible+nI <= vI && nI < itms.total) 2608 { 2609 nI++; 2610 vI = cf_getItemsAdjust(gn_getVisibleItemsNext(a_itm, opts, itms.total-nI), opts, opts.items.visibleConf.adjust, $tt0); 2611 } 2612 opts.items.visible = vI; 2613 } 2614 else if (opts.items.filter != '*') 2615 { 2616 var vI = gn_getVisibleItemsNextFilter(a_itm, opts, itms.total-nI); 2617 opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0); 2618 } 2619 2620 sz_resetMargin(a_itm, opts, true); 2621 2622 // scroll 0, don't scroll 2623 if (nI == 0) 2624 { 2625 e.stopImmediatePropagation(); 2626 return debug(conf, '0 items to scroll: Not scrolling.'); 2627 } 2628 debug(conf, 'Scrolling '+nI+' items backward.'); 2629 2630 2631 // save new config 2632 itms.first += nI; 2633 while (itms.first >= itms.total) 2634 { 2635 itms.first -= itms.total; 2636 } 2637 2638 // non-circular callback 2639 if (!opts.circular) 2640 { 2641 if (itms.first == 0 && sO.onEnd) 2642 { 2643 sO.onEnd.call($tt0, 'prev'); 2644 } 2645 if (!opts.infinite) 2646 { 2647 nv_enableNavi(opts, itms.first, conf); 2648 } 2649 } 2650 2651 // rearrange items 2652 $cfs.children().slice(itms.total-nI, itms.total).prependTo($cfs); 2653 if (itms.total < opts.items.visible + nI) 2654 { 2655 $cfs.children().slice(0, (opts.items.visible+nI)-itms.total).clone(true).appendTo($cfs); 2656 } 2657 2658 // the needed items 2659 var a_itm = $cfs.children(), 2660 i_old = gi_getOldItemsPrev(a_itm, opts, nI), 2661 i_new = gi_getNewItemsPrev(a_itm, opts), 2662 i_cur_l = a_itm.eq(nI-1), 2663 i_old_l = i_old.last(), 2664 i_new_l = i_new.last(); 2665 2666 sz_resetMargin(a_itm, opts); 2667 2668 var pL = 0, 2669 pR = 0; 2670 2671 if (opts.align) 2672 { 2673 var p = cf_getAlignPadding(i_new, opts); 2674 pL = p[0]; 2675 pR = p[1]; 2676 } 2677 var oL = (pL < 0) ? opts.padding[opts.d[3]] : 0; 2678 2679 // hide items for fx directscroll 2680 var hiddenitems = false, 2681 i_skp = $(); 2682 if (opts.items.visible < nI) 2683 { 2684 i_skp = a_itm.slice(opts.items.visibleConf.old, nI); 2685 if (sO.fx == 'directscroll') 2686 { 2687 var orgW = opts.items[opts.d['width']]; 2688 hiddenitems = i_skp; 2689 i_cur_l = i_new_l; 2690 sc_hideHiddenItems(hiddenitems); 2691 opts.items[opts.d['width']] = 'variable'; 2692 } 2693 } 2694 2695 // save new sizes 2696 var $cf2 = false, 2697 i_siz = ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'), 2698 w_siz = cf_mapWrapperSizes(ms_getSizes(i_new, opts, true), opts, !opts.usePadding), 2699 i_siz_vis = 0, 2700 a_cfs = {}, 2701 a_wsz = {}, 2702 a_cur = {}, 2703 a_old = {}, 2704 a_new = {}, 2705 a_lef = {}, 2706 a_lef_vis = {}, 2707 a_dur = sc_getDuration(sO, opts, nI, i_siz); 2708 2709 switch(sO.fx) 2710 { 2711 case 'cover': 2712 case 'cover-fade': 2713 i_siz_vis = ms_getTotalSize(a_itm.slice(0, opts.items.visible), opts, 'width'); 2714 break; 2715 } 2716 2717 if (hiddenitems) 2718 { 2719 opts.items[opts.d['width']] = orgW; 2720 } 2721 2722 sz_resetMargin(a_itm, opts, true); 2723 if (pR >= 0) 2724 { 2725 sz_resetMargin(i_old_l, opts, opts.padding[opts.d[1]]); 2726 } 2727 if (pL >= 0) 2728 { 2729 sz_resetMargin(i_cur_l, opts, opts.padding[opts.d[3]]); 2730 } 2731 2732 if (opts.align) 2733 { 2734 opts.padding[opts.d[1]] = pR; 2735 opts.padding[opts.d[3]] = pL; 2736 } 2737 2738 a_lef[opts.d['left']] = -(i_siz - oL); 2739 a_lef_vis[opts.d['left']] = -(i_siz_vis - oL); 2740 a_wsz[opts.d['left']] = w_siz[opts.d['width']]; 2741 2742 // scrolling functions 2743 var _s_wrapper = function() {}, 2744 _a_wrapper = function() {}, 2745 _s_paddingold = function() {}, 2746 _a_paddingold = function() {}, 2747 _s_paddingnew = function() {}, 2748 _a_paddingnew = function() {}, 2749 _s_paddingcur = function() {}, 2750 _a_paddingcur = function() {}, 2751 _onafter = function() {}, 2752 _moveitems = function() {}, 2753 _position = function() {}; 2754 2755 // clone carousel 2756 switch(sO.fx) 2757 { 2758 case 'crossfade': 2759 case 'cover': 2760 case 'cover-fade': 2761 case 'uncover': 2762 case 'uncover-fade': 2763 $cf2 = $cfs.clone(true).appendTo($wrp); 2764 break; 2765 } 2766 switch(sO.fx) 2767 { 2768 case 'crossfade': 2769 case 'uncover': 2770 case 'uncover-fade': 2771 $cf2.children().slice(0, nI).remove(); 2772 $cf2.children().slice(opts.items.visibleConf.old).remove(); 2773 break; 2774 2775 case 'cover': 2776 case 'cover-fade': 2777 $cf2.children().slice(opts.items.visible).remove(); 2778 $cf2.css(a_lef_vis); 2779 break; 2780 } 2781 2782 $cfs.css(a_lef); 2783 2784 // reset all scrolls 2785 scrl = sc_setScroll(a_dur, sO.easing, conf); 2786 2787 // animate / set carousel 2788 a_cfs[opts.d['left']] = (opts.usePadding) ? opts.padding[opts.d[3]] : 0; 2789 2790 // animate / set wrapper 2791 if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable') 2792 { 2793 _s_wrapper = function() { 2794 $wrp.css(w_siz); 2795 }; 2796 _a_wrapper = function() { 2797 scrl.anims.push([$wrp, w_siz]); 2798 }; 2799 } 2800 2801 // animate / set items 2802 if (opts.usePadding) 2803 { 2804 if (i_new_l.not(i_cur_l).length) 2805 { 2806 a_cur[opts.d['marginRight']] = i_cur_l.data('_cfs_origCssMargin'); 2807 2808 if (pL < 0) 2809 { 2810 i_cur_l.css(a_cur); 2811 } 2812 else 2813 { 2814 _s_paddingcur = function() { 2815 i_cur_l.css(a_cur); 2816 }; 2817 _a_paddingcur = function() { 2818 scrl.anims.push([i_cur_l, a_cur]); 2819 }; 2820 } 2821 } 2822 switch(sO.fx) 2823 { 2824 case 'cover': 2825 case 'cover-fade': 2826 $cf2.children().eq(nI-1).css(a_cur); 2827 break; 2828 } 2829 2830 if (i_new_l.not(i_old_l).length) 2831 { 2832 a_old[opts.d['marginRight']] = i_old_l.data('_cfs_origCssMargin'); 2833 _s_paddingold = function() { 2834 i_old_l.css(a_old); 2835 }; 2836 _a_paddingold = function() { 2837 scrl.anims.push([i_old_l, a_old]); 2838 }; 2839 } 2840 2841 if (pR >= 0) 2842 { 2843 a_new[opts.d['marginRight']] = i_new_l.data('_cfs_origCssMargin') + opts.padding[opts.d[1]]; 2844 _s_paddingnew = function() { 2845 i_new_l.css(a_new); 2846 }; 2847 _a_paddingnew = function() { 2848 scrl.anims.push([i_new_l, a_new]); 2849 }; 2850 } 2851 } 2852 2853 // set position 2854 _position = function() { 2855 $cfs.css(a_cfs); 2856 }; 2857 2858 2859 var overFill = opts.items.visible+nI-itms.total; 2860 2861 // rearrange items 2862 _moveitems = function() { 2863 if (overFill > 0) 2864 { 2865 $cfs.children().slice(itms.total).remove(); 2866 i_old = $( $cfs.children().slice(itms.total-(opts.items.visible-overFill)).get().concat( $cfs.children().slice(0, overFill).get() ) ); 2867 } 2868 sc_showHiddenItems(hiddenitems); 2869 2870 if (opts.usePadding) 2871 { 2872 var l_itm = $cfs.children().eq(opts.items.visible+nI-1); 2873 l_itm.css(opts.d['marginRight'], l_itm.data('_cfs_origCssMargin')); 2874 } 2875 }; 2876 2877 2878 var cb_arguments = sc_mapCallbackArguments(i_old, i_skp, i_new, nI, 'prev', a_dur, w_siz); 2879 2880 // fire onAfter callbacks 2881 _onafter = function() { 2882 sc_afterScroll($cfs, $cf2, sO); 2883 crsl.isScrolling = false; 2884 clbk.onAfter = sc_fireCallbacks($tt0, sO, 'onAfter', cb_arguments, clbk); 2885 queu = sc_fireQueue($cfs, queu, conf); 2886 2887 if (!crsl.isPaused) 2888 { 2889 $cfs.trigger(cf_e('play', conf)); 2890 } 2891 }; 2892 2893 // fire onBefore callback 2894 crsl.isScrolling = true; 2895 tmrs = sc_clearTimers(tmrs); 2896 clbk.onBefore = sc_fireCallbacks($tt0, sO, 'onBefore', cb_arguments, clbk); 2897 2898 switch(sO.fx) 2899 { 2900 case 'none': 2901 $cfs.css(a_cfs); 2902 _s_wrapper(); 2903 _s_paddingold(); 2904 _s_paddingnew(); 2905 _s_paddingcur(); 2906 _position(); 2907 _moveitems(); 2908 _onafter(); 2909 break; 2910 2911 case 'fade': 2912 scrl.anims.push([$cfs, { 'opacity': 0 }, function() { 2913 _s_wrapper(); 2914 _s_paddingold(); 2915 _s_paddingnew(); 2916 _s_paddingcur(); 2917 _position(); 2918 _moveitems(); 2919 scrl = sc_setScroll(a_dur, sO.easing, conf); 2920 scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]); 2921 sc_startScroll(scrl, conf); 2922 }]); 2923 break; 2924 2925 case 'crossfade': 2926 $cfs.css({ 'opacity': 0 }); 2927 scrl.anims.push([$cf2, { 'opacity': 0 }]); 2928 scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]); 2929 _a_wrapper(); 2930 _s_paddingold(); 2931 _s_paddingnew(); 2932 _s_paddingcur(); 2933 _position(); 2934 _moveitems();
2935 break; 2936 2937 case 'cover': 2938 scrl.anims.push([$cf2, a_cfs, function() { 2939 _s_paddingold(); 2940 _s_paddingnew(); 2941 _s_paddingcur(); 2942 _position(); 2943 _moveitems(); 2944 _onafter(); 2945 }]); 2946 _a_wrapper(); 2947 break; 2948 2949 case 'cover-fade': 2950 scrl.anims.push([$cfs, { 'opacity': 0 }]); 2951 scrl.anims.push([$cf2, a_cfs, function() { 2952 _s_paddingold(); 2953 _s_paddingnew(); 2954 _s_paddingcur(); 2955 _position(); 2956 _moveitems(); 2957 _onafter(); 2958 }]); 2959 _a_wrapper(); 2960 break; 2961 2962 case 'uncover': 2963 scrl.anims.push([$cf2, a_wsz, _onafter]);
vendor: 15,793 bytes, lines 2964-3376
2964 _a_wrapper(); 2965 _s_paddingold(); 2966 _s_paddingnew(); 2967 _s_paddingcur(); 2968 _position(); 2969 _moveitems(); 2970 break; 2971 2972 case 'uncover-fade': 2973 $cfs.css({ 'opacity': 0 }); 2974 scrl.anims.push([$cfs, { 'opacity': 1 }]); 2975 scrl.anims.push([$cf2, a_wsz, _onafter]); 2976 _a_wrapper(); 2977 _s_paddingold(); 2978 _s_paddingnew(); 2979 _s_paddingcur(); 2980 _position(); 2981 _moveitems(); 2982 break; 2983 2984 default: 2985 scrl.anims.push([$cfs, a_cfs, function() { 2986 _moveitems(); 2987 _onafter(); 2988 }]); 2989 _a_wrapper(); 2990 _a_paddingold(); 2991 _a_paddingnew(); 2992 _a_paddingcur(); 2993 break; 2994 } 2995 2996 sc_startScroll(scrl, conf); 2997 cf_setCookie(opts.cookie, $cfs, conf); 2998 2999 $cfs.trigger(cf_e('updatePageStatus', conf), [false, w_siz]); 3000 3001 return true; 3002 }); 3003 3004 3005 // next event 3006 $cfs.bind(cf_e('slide_next', conf), function(e, sO, nI) { 3007 e.stopPropagation(); 3008 var a_itm = $cfs.children(); 3009 3010 // non-circular at end, scroll to start 3011 if (!opts.circular) 3012 { 3013 if (itms.first == opts.items.visible) 3014 { 3015 if (opts.infinite) 3016 { 3017 $cfs.trigger(cf_e('prev', conf), itms.total-1); 3018 } 3019 return e.stopImmediatePropagation(); 3020 } 3021 } 3022 3023 sz_resetMargin(a_itm, opts); 3024 3025 // find number of items to scroll 3026 if (!is_number(nI)) 3027 { 3028 if (opts.items.filter != '*') 3029 { 3030 var xI = (is_number(sO.items)) ? sO.items : gn_getVisibleOrg($cfs, opts); 3031 nI = gn_getScrollItemsNextFilter(a_itm, opts, 0, xI); 3032 } 3033 else 3034 { 3035 nI = opts.items.visible; 3036 } 3037 nI = cf_getAdjust(nI, opts, sO.items, $tt0); 3038 } 3039 3040 var lastItemNr = (itms.first == 0) ? itms.total : itms.first; 3041 3042 // prevent non-circular from scrolling to far 3043 if (!opts.circular) 3044 { 3045 if (opts.items.visibleConf.variable) 3046 { 3047 var vI = gn_getVisibleItemsNext(a_itm, opts, nI), 3048 xI = gn_getVisibleItemsPrev(a_itm, opts, lastItemNr-1); 3049 } 3050 else 3051 { 3052 var vI = opts.items.visible, 3053 xI = opts.items.visible; 3054 } 3055 3056 if (nI + vI > lastItemNr) 3057 { 3058 nI = lastItemNr - xI; 3059 } 3060 } 3061 3062 // set new number of visible items 3063 opts.items.visibleConf.old = opts.items.visible; 3064 if (opts.items.visibleConf.variable) 3065 { 3066 var vI = cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr), opts, opts.items.visibleConf.adjust, $tt0); 3067 while (opts.items.visible-nI >= vI && nI < itms.total) 3068 { 3069 nI++; 3070 vI = cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr), opts, opts.items.visibleConf.adjust, $tt0); 3071 } 3072 opts.items.visible = vI; 3073 } 3074 else if (opts.items.filter != '*') 3075 { 3076 var vI = gn_getVisibleItemsNextFilter(a_itm, opts, nI); 3077 opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0); 3078 } 3079 3080 sz_resetMargin(a_itm, opts, true); 3081 3082 // scroll 0, don't scroll 3083 if (nI == 0) 3084 { 3085 e.stopImmediatePropagation(); 3086 return debug(conf, '0 items to scroll: Not scrolling.'); 3087 } 3088 debug(conf, 'Scrolling '+nI+' items forward.'); 3089 3090 3091 // save new config 3092 itms.first -= nI; 3093 while (itms.first < 0) 3094 { 3095 itms.first += itms.total; 3096 } 3097 3098 // non-circular callback 3099 if (!opts.circular) 3100 { 3101 if (itms.first == opts.items.visible && sO.onEnd) 3102 { 3103 sO.onEnd.call($tt0, 'next'); 3104 } 3105 if (!opts.infinite) 3106 { 3107 nv_enableNavi(opts, itms.first, conf); 3108 } 3109 } 3110 3111 // rearrange items 3112 if (itms.total < opts.items.visible+nI) 3113 { 3114 $cfs.children().slice(0, (opts.items.visible+nI)-itms.total).clone(true).appendTo($cfs); 3115 } 3116 3117 // the needed items 3118 var a_itm = $cfs.children(), 3119 i_old = gi_getOldItemsNext(a_itm, opts), 3120 i_new = gi_getNewItemsNext(a_itm, opts, nI), 3121 i_cur_l = a_itm.eq(nI-1), 3122 i_old_l = i_old.last(), 3123 i_new_l = i_new.last(); 3124 3125 sz_resetMargin(a_itm, opts); 3126 3127 var pL = 0, 3128 pR = 0; 3129 3130 if (opts.align) 3131 { 3132 var p = cf_getAlignPadding(i_new, opts); 3133 pL = p[0]; 3134 pR = p[1]; 3135 } 3136 3137 // hide items for fx directscroll 3138 var hiddenitems = false, 3139 i_skp = $(); 3140 if (opts.items.visibleConf.old < nI) 3141 { 3142 i_skp = a_itm.slice(opts.items.visibleConf.old, nI); 3143 if (sO.fx == 'directscroll') 3144 { 3145 var orgW = opts.items[opts.d['width']]; 3146 hiddenitems = i_skp; 3147 i_cur_l = i_old_l; 3148 sc_hideHiddenItems(hiddenitems); 3149 opts.items[opts.d['width']] = 'variable'; 3150 } 3151 } 3152 3153 // save new sizes 3154 var $cf2 = false, 3155 i_siz = ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'), 3156 w_siz = cf_mapWrapperSizes(ms_getSizes(i_new, opts, true), opts, !opts.usePadding), 3157 i_siz_vis = 0, 3158 a_cfs = {}, 3159 a_cfs_vis = {}, 3160 a_cur = {}, 3161 a_old = {}, 3162 a_lef = {}, 3163 a_dur = sc_getDuration(sO, opts, nI, i_siz); 3164 3165 switch(sO.fx) 3166 { 3167 case 'uncover': 3168 case 'uncover-fade': 3169 i_siz_vis = ms_getTotalSize(a_itm.slice(0, opts.items.visibleConf.old), opts, 'width'); 3170 break; 3171 } 3172 3173 if (hiddenitems) 3174 { 3175 opts.items[opts.d['width']] = orgW; 3176 } 3177 3178 if (opts.align) 3179 { 3180 if (opts.padding[opts.d[1]] < 0) 3181 { 3182 opts.padding[opts.d[1]] = 0; 3183 } 3184 } 3185 sz_resetMargin(a_itm, opts, true); 3186 sz_resetMargin(i_old_l, opts, opts.padding[opts.d[1]]); 3187 3188 if (opts.align) 3189 { 3190 opts.padding[opts.d[1]] = pR; 3191 opts.padding[opts.d[3]] = pL; 3192 } 3193 3194 a_lef[opts.d['left']] = (opts.usePadding) ? opts.padding[opts.d[3]] : 0; 3195 3196 // scrolling functions 3197 var _s_wrapper = function() {}, 3198 _a_wrapper = function() {}, 3199 _s_paddingold = function() {}, 3200 _a_paddingold = function() {}, 3201 _s_paddingcur = function() {}, 3202 _a_paddingcur = function() {}, 3203 _onafter = function() {}, 3204 _moveitems = function() {}, 3205 _position = function() {}; 3206 3207 // clone carousel 3208 switch(sO.fx) 3209 { 3210 case 'crossfade': 3211 case 'cover': 3212 case 'cover-fade': 3213 case 'uncover': 3214 case 'uncover-fade': 3215 $cf2 = $cfs.clone(true).appendTo($wrp); 3216 $cf2.children().slice(opts.items.visibleConf.old).remove(); 3217 break; 3218 } 3219 switch(sO.fx) 3220 { 3221 case 'crossfade': 3222 case 'cover': 3223 case 'cover-fade': 3224 $cfs.css('zIndex', 1); 3225 $cf2.css('zIndex', 0); 3226 break; 3227 } 3228 3229 // reset all scrolls 3230 scrl = sc_setScroll(a_dur, sO.easing, conf); 3231 3232 // animate / set carousel 3233 a_cfs[opts.d['left']] = -i_siz; 3234 a_cfs_vis[opts.d['left']] = -i_siz_vis; 3235 3236 if (pL < 0) 3237 { 3238 a_cfs[opts.d['left']] += pL; 3239 } 3240 3241 // animate / set wrapper 3242 if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable') 3243 { 3244 _s_wrapper = function() { 3245 $wrp.css(w_siz); 3246 }; 3247 _a_wrapper = function() { 3248 scrl.anims.push([$wrp, w_siz]); 3249 }; 3250 } 3251 3252 // animate / set items 3253 if (opts.usePadding) 3254 { 3255 var i_new_l_m = i_new_l.data('_cfs_origCssMargin'); 3256 3257 if (pR >= 0) 3258 { 3259 i_new_l_m += opts.padding[opts.d[1]]; 3260 } 3261 i_new_l.css(opts.d['marginRight'], i_new_l_m); 3262 3263 if (i_cur_l.not(i_old_l).length) 3264 { 3265 a_old[opts.d['marginRight']] = i_old_l.data('_cfs_origCssMargin'); 3266 } 3267 _s_paddingold = function() { 3268 i_old_l.css(a_old); 3269 }; 3270 _a_paddingold = function() { 3271 scrl.anims.push([i_old_l, a_old]); 3272 }; 3273 3274 var i_cur_l_m = i_cur_l.data('_cfs_origCssMargin'); 3275 if (pL > 0) 3276 { 3277 i_cur_l_m += opts.padding[opts.d[3]]; 3278 } 3279 3280 a_cur[opts.d['marginRight']] = i_cur_l_m; 3281 3282 _s_paddingcur = function() { 3283 i_cur_l.css(a_cur); 3284 }; 3285 _a_paddingcur = function() { 3286 scrl.anims.push([i_cur_l, a_cur]); 3287 }; 3288 } 3289 3290 // set position 3291 _position = function() { 3292 $cfs.css(a_lef); 3293 }; 3294 3295 3296 var overFill = opts.items.visible+nI-itms.total; 3297 3298 // rearrange items 3299 _moveitems = function() { 3300 if (overFill > 0) 3301 { 3302 $cfs.children().slice(itms.total).remove(); 3303 } 3304 var l_itm = $cfs.children().slice(0, nI).appendTo($cfs).last(); 3305 if (overFill > 0) 3306 { 3307 i_new = gi_getCurrentItems(a_itm, opts); 3308 } 3309 sc_showHiddenItems(hiddenitems); 3310 3311 if (opts.usePadding) 3312 { 3313 if (itms.total < opts.items.visible+nI) { 3314 var i_cur_l = $cfs.children().eq(opts.items.visible-1); 3315 i_cur_l.css(opts.d['marginRight'], i_cur_l.data('_cfs_origCssMargin') + opts.padding[opts.d[1]]); 3316 } 3317 l_itm.css(opts.d['marginRight'], l_itm.data('_cfs_origCssMargin')); 3318 } 3319 }; 3320 3321 3322 var cb_arguments = sc_mapCallbackArguments(i_old, i_skp, i_new, nI, 'next', a_dur, w_siz); 3323 3324 // fire onAfter callbacks 3325 _onafter = function() { 3326 $cfs.css('zIndex', $cfs.data('_cfs_origCssZindex')); 3327 sc_afterScroll($cfs, $cf2, sO); 3328 crsl.isScrolling = false; 3329 clbk.onAfter = sc_fireCallbacks($tt0, sO, 'onAfter', cb_arguments, clbk); 3330 queu = sc_fireQueue($cfs, queu, conf); 3331 3332 if (!crsl.isPaused) 3333 { 3334 $cfs.trigger(cf_e('play', conf)); 3335 } 3336 }; 3337 3338 // fire onBefore callbacks 3339 crsl.isScrolling = true; 3340 tmrs = sc_clearTimers(tmrs); 3341 clbk.onBefore = sc_fireCallbacks($tt0, sO, 'onBefore', cb_arguments, clbk); 3342 3343 switch(sO.fx) 3344 { 3345 case 'none': 3346 $cfs.css(a_cfs); 3347 _s_wrapper(); 3348 _s_paddingold(); 3349 _s_paddingcur(); 3350 _position(); 3351 _moveitems(); 3352 _onafter(); 3353 break; 3354 3355 case 'fade': 3356 scrl.anims.push([$cfs, { 'opacity': 0 }, function() { 3357 _s_wrapper(); 3358 _s_paddingold(); 3359 _s_paddingcur(); 3360 _position(); 3361 _moveitems(); 3362 scrl = sc_setScroll(a_dur, sO.easing, conf); 3363 scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]); 3364 sc_startScroll(scrl, conf); 3365 }]); 3366 break; 3367 3368 case 'crossfade': 3369 $cfs.css({ 'opacity': 0 }); 3370 scrl.anims.push([$cf2, { 'opacity': 0 }]); 3371 scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]); 3372 _a_wrapper(); 3373 _s_paddingold(); 3374 _s_paddingcur(); 3375 _position(); 3376 _moveitems();
3377 break; 3378 3379 case 'cover': 3380 $cfs.css(opts.d['left'], $wrp[opts.d['width']]()); 3381 scrl.anims.push([$cfs, a_lef, _onafter]); 3382 _a_wrapper(); 3383 _s_paddingold(); 3384 _s_paddingcur(); 3385 _moveitems(); 3386 break; 3387 3388 case 'cover-fade': 3389 $cfs.css(opts.d['left'], $wrp[opts.d['width']]()); 3390 scrl.anims.push([$cf2, { 'opacity': 0 }]); 3391 scrl.anims.push([$cfs, a_lef, _onafter]); 3392 _a_wrapper(); 3393 _s_paddingold(); 3394 _s_paddingcur(); 3395 _moveitems(); 3396 break; 3397 3398 case 'uncover': 3399 scrl.anims.push([$cf2, a_cfs_vis, _onafter]); 3400 _a_wrapper(); 3401 _s_paddingold(); 3402 _s_paddingcur(); 3403 _position(); 3404 _moveitems();
vendor: 81,334 bytes, lines 3405-6126
3405 break; 3406 3407 case 'uncover-fade': 3408 $cfs.css({ 'opacity': 0 }); 3409 scrl.anims.push([$cfs, { 'opacity': 1 }]); 3410 scrl.anims.push([$cf2, a_cfs_vis, _onafter]); 3411 _a_wrapper(); 3412 _s_paddingold(); 3413 _s_paddingcur(); 3414 _position(); 3415 _moveitems(); 3416 break; 3417 3418 default: 3419 scrl.anims.push([$cfs, a_cfs, function() { 3420 _position(); 3421 _moveitems(); 3422 _onafter(); 3423 }]); 3424 _a_wrapper(); 3425 _a_paddingold(); 3426 _a_paddingcur(); 3427 break; 3428 } 3429 3430 sc_startScroll(scrl, conf); 3431 cf_setCookie(opts.cookie, $cfs, conf); 3432 3433 $cfs.trigger(cf_e('updatePageStatus', conf), [false, w_siz]); 3434 3435 return true; 3436 }); 3437 3438 3439 // slideTo event 3440 $cfs.bind(cf_e('slideTo', conf), function(e, num, dev, org, obj, dir, clb) { 3441 e.stopPropagation(); 3442 3443 var v = [num, dev, org, obj, dir, clb], 3444 t = ['string/number/object', 'number', 'boolean', 'object', 'string', 'function'], 3445 a = cf_sortParams(v, t); 3446 3447 obj = a[3]; 3448 dir = a[4]; 3449 clb = a[5]; 3450 3451 num = gn_getItemIndex(a[0], a[1], a[2], itms, $cfs); 3452 3453 if (num == 0) 3454 { 3455 return false; 3456 } 3457 if (!is_object(obj)) 3458 { 3459 obj = false; 3460 } 3461 3462 if (dir != 'prev' && dir != 'next') 3463 { 3464 if (opts.circular) 3465 { 3466 dir = (num <= itms.total / 2) ? 'next' : 'prev'; 3467 } 3468 else 3469 { 3470 dir = (itms.first == 0 || itms.first > num) ? 'next' : 'prev'; 3471 } 3472 } 3473 3474 if (dir == 'prev') 3475 { 3476 num = itms.total-num; 3477 } 3478 $cfs.trigger(cf_e(dir, conf), [obj, num, clb]); 3479 3480 return true; 3481 }); 3482 3483 3484 // prevPage event 3485 $cfs.bind(cf_e('prevPage', conf), function(e, obj, clb) { 3486 e.stopPropagation(); 3487 var cur = $cfs.triggerHandler(cf_e('currentPage', conf)); 3488 return $cfs.triggerHandler(cf_e('slideToPage', conf), [cur-1, obj, 'prev', clb]); 3489 }); 3490 3491 3492 // nextPage event 3493 $cfs.bind(cf_e('nextPage', conf), function(e, obj, clb) { 3494 e.stopPropagation(); 3495 var cur = $cfs.triggerHandler(cf_e('currentPage', conf)); 3496 return $cfs.triggerHandler(cf_e('slideToPage', conf), [cur+1, obj, 'next', clb]); 3497 }); 3498 3499 3500 // slideToPage event 3501 $cfs.bind(cf_e('slideToPage', conf), function(e, pag, obj, dir, clb) { 3502 e.stopPropagation(); 3503 if (!is_number(pag)) 3504 { 3505 pag = $cfs.triggerHandler(cf_e('currentPage', conf)); 3506 } 3507 var ipp = opts.pagination.items || opts.items.visible, 3508 max = Math.ceil(itms.total / ipp)-1; 3509 3510 if (pag < 0) 3511 { 3512 pag = max; 3513 } 3514 if (pag > max) 3515 { 3516 pag = 0; 3517 } 3518 return $cfs.triggerHandler(cf_e('slideTo', conf), [pag*ipp, 0, true, obj, dir, clb]); 3519 }); 3520 3521 // jumpToStart event 3522 $cfs.bind(cf_e('jumpToStart', conf), function(e, s) { 3523 e.stopPropagation(); 3524 if (s) 3525 { 3526 s = gn_getItemIndex(s, 0, true, itms, $cfs); 3527 } 3528 else 3529 { 3530 s = 0; 3531 } 3532 3533 s += itms.first; 3534 if (s != 0) 3535 { 3536 if (itms.total > 0) 3537 { 3538 while (s > itms.total) 3539 { 3540 s -= itms.total; 3541 } 3542 } 3543 $cfs.prepend($cfs.children().slice(s, itms.total)); 3544 } 3545 return true; 3546 }); 3547 3548 3549 // synchronise event 3550 $cfs.bind(cf_e('synchronise', conf), function(e, s) { 3551 e.stopPropagation(); 3552 if (s) 3553 { 3554 s = cf_getSynchArr(s); 3555 } 3556 else if (opts.synchronise) 3557 { 3558 s = opts.synchronise; 3559 } 3560 else 3561 { 3562 return debug(conf, 'No carousel to synchronise.'); 3563 } 3564 3565 var n = $cfs.triggerHandler(cf_e('currentPosition', conf)), 3566 x = true; 3567 3568 for (var j = 0, l = s.length; j < l; j++) 3569 { 3570 if (!s[j][0].triggerHandler(cf_e('slideTo', conf), [n, s[j][3], true])) 3571 { 3572 x = false; 3573 } 3574 } 3575 return x; 3576 }); 3577 3578 3579 // queue event 3580 $cfs.bind(cf_e('queue', conf), function(e, dir, opt) { 3581 e.stopPropagation(); 3582 if (is_function(dir)) 3583 { 3584 dir.call($tt0, queu); 3585 } 3586 else if (is_array(dir)) 3587 { 3588 queu = dir; 3589 } 3590 else if (!is_undefined(dir)) 3591 { 3592 queu.push([dir, opt]); 3593 } 3594 return queu; 3595 }); 3596 3597 3598 // insertItem event 3599 $cfs.bind(cf_e('insertItem', conf), function(e, itm, num, org, dev) { 3600 e.stopPropagation(); 3601 3602 var v = [itm, num, org, dev], 3603 t = ['string/object', 'string/number/object', 'boolean', 'number'], 3604 a = cf_sortParams(v, t); 3605 3606 itm = a[0]; 3607 num = a[1]; 3608 org = a[2]; 3609 dev = a[3]; 3610 3611 if (is_object(itm) && !is_jquery(itm)) 3612 { 3613 itm = $(itm); 3614 } 3615 else if (is_string(itm)) 3616 { 3617 itm = $(itm); 3618 } 3619 if (!is_jquery(itm) || itm.length == 0) 3620 { 3621 return debug(conf, 'Not a valid object.'); 3622 } 3623 3624 if (is_undefined(num)) 3625 { 3626 num = 'end'; 3627 } 3628 3629 sz_storeMargin(itm, opts); 3630 sz_storeOrigCss(itm); 3631 3632 var orgNum = num, 3633 before = 'before'; 3634 3635 if (num == 'end') 3636 { 3637 if (org) 3638 { 3639 if (itms.first == 0) 3640 { 3641 num = itms.total-1; 3642 before = 'after'; 3643 } 3644 else 3645 { 3646 num = itms.first; 3647 itms.first += itm.length; 3648 } 3649 if (num < 0) 3650 { 3651 num = 0; 3652 } 3653 } 3654 else 3655 { 3656 num = itms.total-1; 3657 before = 'after'; 3658 } 3659 } 3660 else 3661 { 3662 num = gn_getItemIndex(num, dev, org, itms, $cfs); 3663 } 3664 3665 var $cit = $cfs.children().eq(num); 3666 if ($cit.length) 3667 { 3668 $cit[before](itm); 3669 } 3670 else 3671 { 3672 debug(conf, 'Correct insert-position not found! Appending item to the end.'); 3673 $cfs.append(itm); 3674 } 3675 3676 if (orgNum != 'end' && !org) 3677 { 3678 if (num < itms.first) 3679 { 3680 itms.first += itm.length; 3681 } 3682 } 3683 itms.total = $cfs.children().length; 3684 if (itms.first >= itms.total) 3685 { 3686 itms.first -= itms.total; 3687 } 3688 3689 $cfs.trigger(cf_e('updateSizes', conf)); 3690 $cfs.trigger(cf_e('linkAnchors', conf)); 3691 3692 return true; 3693 }); 3694 3695 3696 // removeItem event 3697 $cfs.bind(cf_e('removeItem', conf), function(e, num, org, dev) { 3698 e.stopPropagation(); 3699 3700 var v = [num, org, dev], 3701 t = ['string/number/object', 'boolean', 'number'], 3702 a = cf_sortParams(v, t); 3703 3704 num = a[0]; 3705 org = a[1]; 3706 dev = a[2]; 3707 3708 var removed = false; 3709 3710 if (num instanceof $ && num.length > 1) 3711 { 3712 $removed = $(); 3713 num.each(function(i, el) { 3714 var $rem = $cfs.trigger(cf_e('removeItem', conf), [$(this), org, dev]); 3715 if ( $rem ) 3716 { 3717 $removed = $removed.add($rem); 3718 } 3719 }); 3720 return $removed; 3721 } 3722 3723 if (is_undefined(num) || num == 'end') 3724 { 3725 $removed = $cfs.children().last(); 3726 } 3727 else 3728 { 3729 num = gn_getItemIndex(num, dev, org, itms, $cfs); 3730 var $removed = $cfs.children().eq(num); 3731 if ( $removed.length ) 3732 { 3733 if (num < itms.first) 3734 { 3735 itms.first -= $removed.length; 3736 } 3737 } 3738 } 3739 if ( $removed && $removed.length ) 3740 { 3741 $removed.detach(); 3742 itms.total = $cfs.children().length; 3743 $cfs.trigger(cf_e('updateSizes', conf)); 3744 } 3745 3746 return $removed; 3747 }); 3748 3749 3750 // onBefore and onAfter event 3751 $cfs.bind(cf_e('onBefore', conf)+' '+cf_e('onAfter', conf), function(e, fn) { 3752 e.stopPropagation(); 3753 var eType = e.type.slice(conf.events.prefix.length); 3754 if (is_array(fn)) 3755 { 3756 clbk[eType] = fn; 3757 } 3758 if (is_function(fn)) 3759 { 3760 clbk[eType].push(fn); 3761 } 3762 return clbk[eType]; 3763 }); 3764 3765 3766 // currentPosition event 3767 $cfs.bind(cf_e('currentPosition', conf), function(e, fn) { 3768 e.stopPropagation(); 3769 if (itms.first == 0) 3770 { 3771 var val = 0; 3772 } 3773 else 3774 { 3775 var val = itms.total - itms.first; 3776 } 3777 if (is_function(fn)) 3778 { 3779 fn.call($tt0, val); 3780 } 3781 return val; 3782 }); 3783 3784 3785 // currentPage event 3786 $cfs.bind(cf_e('currentPage', conf), function(e, fn) { 3787 e.stopPropagation(); 3788 var ipp = opts.pagination.items || opts.items.visible, 3789 max = Math.ceil(itms.total/ipp-1), 3790 nr; 3791 if (itms.first == 0) 3792 { 3793 nr = 0; 3794 } 3795 else if (itms.first < itms.total % ipp) 3796 { 3797 nr = 0; 3798 } 3799 else if (itms.first == ipp && !opts.circular) 3800 { 3801 nr = max; 3802 } 3803 else 3804 { 3805 nr = Math.round((itms.total-itms.first)/ipp); 3806 } 3807 if (nr < 0) 3808 { 3809 nr = 0; 3810 } 3811 if (nr > max) 3812 { 3813 nr = max; 3814 } 3815 if (is_function(fn)) 3816 { 3817 fn.call($tt0, nr); 3818 } 3819 return nr; 3820 }); 3821 3822 3823 // currentVisible event 3824 $cfs.bind(cf_e('currentVisible', conf), function(e, fn) { 3825 e.stopPropagation(); 3826 var $i = gi_getCurrentItems($cfs.children(), opts); 3827 if (is_function(fn)) 3828 { 3829 fn.call($tt0, $i); 3830 } 3831 return $i; 3832 }); 3833 3834 3835 // slice event 3836 $cfs.bind(cf_e('slice', conf), function(e, f, l, fn) { 3837 e.stopPropagation(); 3838 3839 if (itms.total == 0) 3840 { 3841 return false; 3842 } 3843 3844 var v = [f, l, fn], 3845 t = ['number', 'number', 'function'], 3846 a = cf_sortParams(v, t); 3847 3848 f = (is_number(a[0])) ? a[0] : 0; 3849 l = (is_number(a[1])) ? a[1] : itms.total; 3850 fn = a[2]; 3851 3852 f += itms.first; 3853 l += itms.first; 3854 3855 if (items.total > 0) 3856 { 3857 while (f > itms.total) 3858 { 3859 f -= itms.total; 3860 } 3861 while (l > itms.total) 3862 { 3863 l -= itms.total; 3864 } 3865 while (f < 0) 3866 { 3867 f += itms.total; 3868 } 3869 while (l < 0) 3870 { 3871 l += itms.total; 3872 } 3873 } 3874 var $iA = $cfs.children(), 3875 $i; 3876 3877 if (l > f) 3878 { 3879 $i = $iA.slice(f, l); 3880 } 3881 else 3882 { 3883 $i = $( $iA.slice(f, itms.total).get().concat( $iA.slice(0, l).get() ) ); 3884 } 3885 3886 if (is_function(fn)) 3887 { 3888 fn.call($tt0, $i); 3889 } 3890 return $i; 3891 }); 3892 3893 3894 // isPaused, isStopped and isScrolling events 3895 $cfs.bind(cf_e('isPaused', conf)+' '+cf_e('isStopped', conf)+' '+cf_e('isScrolling', conf), function(e, fn) { 3896 e.stopPropagation(); 3897 var eType = e.type.slice(conf.events.prefix.length), 3898 value = crsl[eType]; 3899 if (is_function(fn)) 3900 { 3901 fn.call($tt0, value); 3902 } 3903 return value; 3904 }); 3905 3906 3907 // configuration event 3908 $cfs.bind(cf_e('configuration', conf), function(e, a, b, c) { 3909 e.stopPropagation(); 3910 var reInit = false; 3911 3912 // return entire configuration-object 3913 if (is_function(a)) 3914 { 3915 a.call($tt0, opts); 3916 } 3917 // set multiple options via object 3918 else if (is_object(a)) 3919 { 3920 opts_orig = $.extend(true, {}, opts_orig, a); 3921 if (b !== false) reInit = true; 3922 else opts = $.extend(true, {}, opts, a); 3923 3924 } 3925 else if (!is_undefined(a)) 3926 { 3927 3928 // callback function for specific option 3929 if (is_function(b)) 3930 { 3931 var val = eval('opts.'+a); 3932 if (is_undefined(val)) 3933 { 3934 val = ''; 3935 } 3936 b.call($tt0, val); 3937 } 3938 // set individual option 3939 else if (!is_undefined(b)) 3940 { 3941 if (typeof c !== 'boolean') c = true; 3942 eval('opts_orig.'+a+' = b'); 3943 if (c !== false) reInit = true; 3944 else eval('opts.'+a+' = b'); 3945 } 3946 // return value for specific option 3947 else 3948 { 3949 return eval('opts.'+a); 3950 } 3951 } 3952 if (reInit) 3953 { 3954 sz_resetMargin($cfs.children(), opts); 3955 FN._init(opts_orig); 3956 FN._bind_buttons(); 3957 var sz = sz_setSizes($cfs, opts); 3958 $cfs.trigger(cf_e('updatePageStatus', conf), [true, sz]); 3959 } 3960 return opts; 3961 }); 3962 3963 3964 // linkAnchors event 3965 $cfs.bind(cf_e('linkAnchors', conf), function(e, $con, sel) { 3966 e.stopPropagation(); 3967 3968 if (is_undefined($con)) 3969 { 3970 $con = $('body'); 3971 } 3972 else if (is_string($con)) 3973 { 3974 $con = $($con); 3975 } 3976 if (!is_jquery($con) || $con.length == 0) 3977 { 3978 return debug(conf, 'Not a valid object.'); 3979 } 3980 if (!is_string(sel)) 3981 { 3982 sel = 'a.caroufredsel'; 3983 } 3984 3985 $con.find(sel).each(function() { 3986 var h = this.hash || ''; 3987 if (h.length > 0 && $cfs.children().index($(h)) != -1) 3988 { 3989 $(this).unbind('click').click(function(e) { 3990 e.preventDefault(); 3991 $cfs.trigger(cf_e('slideTo', conf), h); 3992 }); 3993 } 3994 }); 3995 return true; 3996 }); 3997 3998 3999 // updatePageStatus event 4000 $cfs.bind(cf_e('updatePageStatus', conf), function(e, build, sizes) { 4001 e.stopPropagation(); 4002 if (!opts.pagination.container) 4003 { 4004 return; 4005 } 4006 4007 var ipp = opts.pagination.items || opts.items.visible, 4008 pgs = Math.ceil(itms.total/ipp); 4009 4010 if (build) 4011 { 4012 if (opts.pagination.anchorBuilder) 4013 { 4014 opts.pagination.container.children().remove(); 4015 opts.pagination.container.each(function() { 4016 for (var a = 0; a < pgs; a++) 4017 { 4018 var i = $cfs.children().eq( gn_getItemIndex(a*ipp, 0, true, itms, $cfs) ); 4019 $(this).append(opts.pagination.anchorBuilder.call(i[0], a+1)); 4020 } 4021 }); 4022 } 4023 opts.pagination.container.each(function() { 4024 $(this).children().unbind(opts.pagination.event).each(function(a) { 4025 $(this).bind(opts.pagination.event, function(e) { 4026 e.preventDefault(); 4027 $cfs.trigger(cf_e('slideTo', conf), [a*ipp, -opts.pagination.deviation, true, opts.pagination]); 4028 }); 4029 }); 4030 }); 4031 } 4032 4033 var selected = $cfs.triggerHandler(cf_e('currentPage', conf)) + opts.pagination.deviation; 4034 if (selected >= pgs) 4035 { 4036 selected = 0; 4037 } 4038 if (selected < 0) 4039 { 4040 selected = pgs-1; 4041 } 4042 opts.pagination.container.each(function() { 4043 $(this).children().removeClass(cf_c('selected', conf)).eq(selected).addClass(cf_c('selected', conf)); 4044 }); 4045 return true; 4046 }); 4047 4048 4049 // updateSizes event 4050 $cfs.bind(cf_e('updateSizes', conf), function(e) { 4051 var vI = opts.items.visible, 4052 a_itm = $cfs.children(), 4053 avail_primary = ms_getParentSize($wrp, opts, 'width'); 4054 4055 itms.total = a_itm.length; 4056 4057 if (crsl.primarySizePercentage) 4058 { 4059 opts.maxDimension = avail_primary; 4060 opts[opts.d['width']] = ms_getPercentage(avail_primary, crsl.primarySizePercentage); 4061 } 4062 else 4063 { 4064 opts.maxDimension = ms_getMaxDimension(opts, avail_primary); 4065 } 4066 4067 if (opts.responsive) 4068 { 4069 opts.items.width = opts.items.sizesConf.width; 4070 opts.items.height = opts.items.sizesConf.height; 4071 opts = in_getResponsiveValues(opts, a_itm, avail_primary); 4072 vI = opts.items.visible; 4073 sz_setResponsiveSizes(opts, a_itm); 4074 } 4075 else if (opts.items.visibleConf.variable) 4076 { 4077 vI = gn_getVisibleItemsNext(a_itm, opts, 0); 4078 } 4079 else if (opts.items.filter != '*') 4080 { 4081 vI = gn_getVisibleItemsNextFilter(a_itm, opts, 0); 4082 } 4083 4084 if (!opts.circular && itms.first != 0 && vI > itms.first) { 4085 if (opts.items.visibleConf.variable) 4086 { 4087 var nI = gn_getVisibleItemsPrev(a_itm, opts, itms.first) - itms.first; 4088 } 4089 else if (opts.items.filter != '*') 4090 { 4091 var nI = gn_getVisibleItemsPrevFilter(a_itm, opts, itms.first) - itms.first; 4092 } 4093 else 4094 { 4095 var nI = opts.items.visible - itms.first; 4096 } 4097 debug(conf, 'Preventing non-circular: sliding '+nI+' items backward.'); 4098 $cfs.trigger(cf_e('prev', conf), nI); 4099 } 4100 4101 opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0); 4102 opts.items.visibleConf.old = opts.items.visible; 4103 opts = in_getAlignPadding(opts, a_itm); 4104 4105 var sz = sz_setSizes($cfs, opts); 4106 $cfs.trigger(cf_e('updatePageStatus', conf), [true, sz]); 4107 nv_showNavi(opts, itms.total, conf); 4108 nv_enableNavi(opts, itms.first, conf); 4109 4110 return sz; 4111 }); 4112 4113 4114 // destroy event 4115 $cfs.bind(cf_e('destroy', conf), function(e, orgOrder) { 4116 e.stopPropagation(); 4117 tmrs = sc_clearTimers(tmrs); 4118 4119 $cfs.data('_cfs_isCarousel', false); 4120 $cfs.trigger(cf_e('finish', conf)); 4121 if (orgOrder) 4122 { 4123 $cfs.trigger(cf_e('jumpToStart', conf)); 4124 } 4125 sz_restoreOrigCss($cfs.children()); 4126 sz_restoreOrigCss($cfs); 4127 FN._unbind_events(); 4128 FN._unbind_buttons(); 4129 if (conf.wrapper == 'parent') 4130 { 4131 sz_restoreOrigCss($wrp); 4132 } 4133 else 4134 { 4135 $wrp.replaceWith($cfs); 4136 } 4137 4138 return true; 4139 }); 4140 4141 4142 // debug event 4143 $cfs.bind(cf_e('debug', conf), function(e) { 4144 debug(conf, 'Carousel width: ' + opts.width); 4145 debug(conf, 'Carousel height: ' + opts.height); 4146 debug(conf, 'Item widths: ' + opts.items.width); 4147 debug(conf, 'Item heights: ' + opts.items.height); 4148 debug(conf, 'Number of items visible: ' + opts.items.visible); 4149 if (opts.auto.play) 4150 { 4151 debug(conf, 'Number of items scrolled automatically: ' + opts.auto.items); 4152 } 4153 if (opts.prev.button) 4154 { 4155 debug(conf, 'Number of items scrolled backward: ' + opts.prev.items); 4156 } 4157 if (opts.next.button) 4158 { 4159 debug(conf, 'Number of items scrolled forward: ' + opts.next.items); 4160 } 4161 return conf.debug; 4162 }); 4163 4164 4165 // triggerEvent, making prefixed and namespaced events accessible from outside 4166 $cfs.bind('_cfs_triggerEvent', function(e, n, o) { 4167 e.stopPropagation(); 4168 return $cfs.triggerHandler(cf_e(n, conf), o); 4169 }); 4170 }; // /bind_events 4171 4172 4173 FN._unbind_events = function() { 4174 $cfs.unbind(cf_e('', conf)); 4175 $cfs.unbind(cf_e('', conf, false)); 4176 $cfs.unbind('_cfs_triggerEvent'); 4177 }; // /unbind_events 4178 4179 4180 FN._bind_buttons = function() { 4181 FN._unbind_buttons(); 4182 nv_showNavi(opts, itms.total, conf); 4183 nv_enableNavi(opts, itms.first, conf); 4184 4185 if (opts.auto.pauseOnHover) 4186 { 4187 var pC = bt_pauseOnHoverConfig(opts.auto.pauseOnHover); 4188 $wrp.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC); }) 4189 .bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf)); }); 4190 } 4191 4192 // play button 4193 if (opts.auto.button) 4194 { 4195 opts.auto.button.bind(cf_e(opts.auto.event, conf, false), function(e) { 4196 e.preventDefault(); 4197 var ev = false, 4198 pC = null; 4199 4200 if (crsl.isPaused) 4201 { 4202 ev = 'play'; 4203 } 4204 else if (opts.auto.pauseOnEvent) 4205 { 4206 ev = 'pause'; 4207 pC = bt_pauseOnHoverConfig(opts.auto.pauseOnEvent); 4208 } 4209 if (ev) 4210 { 4211 $cfs.trigger(cf_e(ev, conf), pC); 4212 } 4213 }); 4214 } 4215 4216 // prev button 4217 if (opts.prev.button) 4218 { 4219 opts.prev.button.bind(cf_e(opts.prev.event, conf, false), function(e) { 4220 e.preventDefault(); 4221 $cfs.trigger(cf_e('prev', conf)); 4222 }); 4223 if (opts.prev.pauseOnHover) 4224 { 4225 var pC = bt_pauseOnHoverConfig(opts.prev.pauseOnHover); 4226 opts.prev.button.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC); }) 4227 .bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf)); }); 4228 } 4229 } 4230 4231 // next butotn 4232 if (opts.next.button) 4233 { 4234 opts.next.button.bind(cf_e(opts.next.event, conf, false), function(e) { 4235 e.preventDefault(); 4236 $cfs.trigger(cf_e('next', conf)); 4237 }); 4238 if (opts.next.pauseOnHover) 4239 { 4240 var pC = bt_pauseOnHoverConfig(opts.next.pauseOnHover); 4241 opts.next.button.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC); }) 4242 .bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf)); }); 4243 } 4244 } 4245 4246 // pagination 4247 if (opts.pagination.container) 4248 { 4249 if (opts.pagination.pauseOnHover) 4250 { 4251 var pC = bt_pauseOnHoverConfig(opts.pagination.pauseOnHover); 4252 opts.pagination.container.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC); }) 4253 .bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf)); }); 4254 } 4255 } 4256 4257 // prev/next keys 4258 if (opts.prev.key || opts.next.key) 4259 { 4260 $(document).bind(cf_e('keyup', conf, false, true, true), function(e) { 4261 var k = e.keyCode; 4262 if (k == opts.next.key) 4263 { 4264 e.preventDefault(); 4265 $cfs.trigger(cf_e('next', conf)); 4266 } 4267 if (k == opts.prev.key) 4268 { 4269 e.preventDefault(); 4270 $cfs.trigger(cf_e('prev', conf)); 4271 } 4272 }); 4273 } 4274 4275 // pagination keys 4276 if (opts.pagination.keys) 4277 { 4278 $(document).bind(cf_e('keyup', conf, false, true, true), function(e) { 4279 var k = e.keyCode; 4280 if (k >= 49 && k < 58) 4281 { 4282 k = (k-49) * opts.items.visible; 4283 if (k <= itms.total) 4284 { 4285 e.preventDefault(); 4286 $cfs.trigger(cf_e('slideTo', conf), [k, 0, true, opts.pagination]); 4287 } 4288 } 4289 }); 4290 } 4291 4292 // swipe 4293 if ($.fn.swipe) 4294 { 4295 var isTouch = 'ontouchstart' in window; 4296 if ((isTouch && opts.swipe.onTouch) || (!isTouch && opts.swipe.onMouse)) 4297 { 4298 var scP = $.extend(true, {}, opts.prev, opts.swipe), 4299 scN = $.extend(true, {}, opts.next, opts.swipe), 4300 swP = function() { $cfs.trigger(cf_e('prev', conf), [scP]) }, 4301 swN = function() { $cfs.trigger(cf_e('next', conf), [scN]) }; 4302 4303 switch (opts.direction) 4304 { 4305 case 'up': 4306 case 'down': 4307 opts.swipe.options.swipeUp = swN; 4308 opts.swipe.options.swipeDown = swP; 4309 break; 4310 default: 4311 opts.swipe.options.swipeLeft = swN; 4312 opts.swipe.options.swipeRight = swP; 4313 } 4314 if (crsl.swipe) 4315 { 4316 $cfs.swipe('destroy'); 4317 } 4318 $wrp.swipe(opts.swipe.options); 4319 $wrp.css('cursor', 'move'); 4320 crsl.swipe = true; 4321 } 4322 } 4323 4324 // mousewheel 4325 if ($.fn.mousewheel) 4326 { 4327 4328 if (opts.mousewheel) 4329 { 4330 var mcP = $.extend(true, {}, opts.prev, opts.mousewheel), 4331 mcN = $.extend(true, {}, opts.next, opts.mousewheel); 4332 4333 if (crsl.mousewheel) 4334 { 4335 $wrp.unbind(cf_e('mousewheel', conf, false)); 4336 } 4337 $wrp.bind(cf_e('mousewheel', conf, false), function(e, delta) { 4338 e.preventDefault(); 4339 if (delta > 0) 4340 { 4341 $cfs.trigger(cf_e('prev', conf), [mcP]); 4342 } 4343 else 4344 { 4345 $cfs.trigger(cf_e('next', conf), [mcN]); 4346 } 4347 }); 4348 crsl.mousewheel = true; 4349 } 4350 } 4351 4352 if (opts.auto.play) 4353 { 4354 $cfs.trigger(cf_e('play', conf), opts.auto.delay); 4355 } 4356 4357 if (crsl.upDateOnWindowResize) 4358 { 4359 var resizeFn = function(e) { 4360 $cfs.trigger(cf_e('finish', conf)); 4361 if (opts.auto.pauseOnResize && !crsl.isPaused) 4362 { 4363 $cfs.trigger(cf_e('play', conf)); 4364 } 4365 sz_resetMargin($cfs.children(), opts); 4366 $cfs.trigger(cf_e('updateSizes', conf)); 4367 }; 4368 4369 var $w = $(window), 4370 onResize = null; 4371 4372 if ($.debounce && conf.onWindowResize == 'debounce') 4373 { 4374 onResize = $.debounce(200, resizeFn); 4375 } 4376 else if ($.throttle && conf.onWindowResize == 'throttle') 4377 { 4378 onResize = $.throttle(300, resizeFn); 4379 } 4380 else 4381 { 4382 var _windowWidth = 0, 4383 _windowHeight = 0; 4384 4385 onResize = function() { 4386 var nw = $w.width(), 4387 nh = $w.height(); 4388 4389 if (nw != _windowWidth || nh != _windowHeight) 4390 { 4391 resizeFn(); 4392 _windowWidth = nw; 4393 _windowHeight = nh; 4394 } 4395 }; 4396 } 4397 $w.bind(cf_e('resize', conf, false, true, true), onResize); 4398 } 4399 }; // /bind_buttons 4400 4401 4402 FN._unbind_buttons = function() { 4403 var ns1 = cf_e('', conf), 4404 ns2 = cf_e('', conf, false); 4405 ns3 = cf_e('', conf, false, true, true); 4406 4407 $(document).unbind(ns3); 4408 $(window).unbind(ns3); 4409 $wrp.unbind(ns2); 4410 4411 if (opts.auto.button) 4412 { 4413 opts.auto.button.unbind(ns2); 4414 } 4415 if (opts.prev.button) 4416 { 4417 opts.prev.button.unbind(ns2); 4418 } 4419 if (opts.next.button) 4420 { 4421 opts.next.button.unbind(ns2); 4422 } 4423 if (opts.pagination.container) 4424 { 4425 opts.pagination.container.unbind(ns2); 4426 if (opts.pagination.anchorBuilder) 4427 { 4428 opts.pagination.container.children().remove(); 4429 } 4430 } 4431 if (crsl.swipe) 4432 { 4433 $cfs.swipe('destroy'); 4434 $wrp.css('cursor', 'default'); 4435 crsl.swipe = false; 4436 } 4437 if (crsl.mousewheel) 4438 { 4439 crsl.mousewheel = false; 4440 } 4441 4442 nv_showNavi(opts, 'hide', conf); 4443 nv_enableNavi(opts, 'removeClass', conf); 4444 4445 }; // /unbind_buttons 4446 4447 4448 4449 // START 4450 4451 if (is_boolean(configs)) 4452 { 4453 configs = { 4454 'debug': configs 4455 }; 4456 } 4457 4458 // set vars 4459 var crsl = { 4460 'direction' : 'next', 4461 'isPaused' : true, 4462 'isScrolling' : false, 4463 'isStopped' : false, 4464 'mousewheel' : false, 4465 'swipe' : false 4466 }, 4467 itms = { 4468 'total' : $cfs.children().length, 4469 'first' : 0 4470 }, 4471 tmrs = { 4472 'auto' : null, 4473 'progress' : null, 4474 'startTime' : getTime(), 4475 'timePassed' : 0 4476 }, 4477 scrl = { 4478 'isStopped' : false, 4479 'duration' : 0, 4480 'startTime' : 0, 4481 'easing' : '', 4482 'anims' : [] 4483 }, 4484 clbk = { 4485 'onBefore' : [], 4486 'onAfter' : [] 4487 }, 4488 queu = [], 4489 conf = $.extend(true, {}, $.fn.carouFredSel.configs, configs), 4490 opts = {}, 4491 opts_orig = $.extend(true, {}, options), 4492 $wrp = (conf.wrapper == 'parent') 4493 ? $cfs.parent() 4494 : $cfs.wrap('<'+conf.wrapper.element+' class="'+conf.wrapper.classname+'" />').parent(); 4495 4496 4497 conf.selector = $cfs.selector; 4498 conf.serialNumber = $.fn.carouFredSel.serialNumber++; 4499 4500 conf.transition = (conf.transition && $.fn.transition) ? 'transition' : 'animate'; 4501 4502 // create carousel 4503 FN._init(opts_orig, true, starting_position); 4504 FN._build(); 4505 FN._bind_events(); 4506 FN._bind_buttons(); 4507 4508 // find item to start 4509 if (is_array(opts.items.start)) 4510 { 4511 var start_arr = opts.items.start; 4512 } 4513 else 4514 { 4515 var start_arr = []; 4516 if (opts.items.start != 0) 4517 { 4518 start_arr.push(opts.items.start); 4519 } 4520 } 4521 if (opts.cookie) 4522 { 4523 start_arr.unshift(parseInt(cf_getCookie(opts.cookie), 10)); 4524 } 4525 4526 if (start_arr.length > 0) 4527 { 4528 for (var a = 0, l = start_arr.length; a < l; a++) 4529 { 4530 var s = start_arr[a]; 4531 if (s == 0) 4532 { 4533 continue; 4534 } 4535 if (s === true) 4536 { 4537 s = window.location.hash; 4538 if (s.length < 1) 4539 { 4540 continue; 4541 } 4542 } 4543 else if (s === 'random') 4544 { 4545 s = Math.floor(Math.random()*itms.total); 4546 } 4547 if ($cfs.triggerHandler(cf_e('slideTo', conf), [s, 0, true, { fx: 'none' }])) 4548 { 4549 break; 4550 } 4551 } 4552 } 4553 var siz = sz_setSizes($cfs, opts), 4554 itm = gi_getCurrentItems($cfs.children(), opts); 4555 4556 if (opts.onCreate) 4557 { 4558 opts.onCreate.call($tt0, { 4559 'width': siz.width, 4560 'height': siz.height, 4561 'items': itm 4562 }); 4563 } 4564 4565 $cfs.trigger(cf_e('updatePageStatus', conf), [true, siz]); 4566 $cfs.trigger(cf_e('linkAnchors', conf)); 4567 4568 if (conf.debug) 4569 { 4570 $cfs.trigger(cf_e('debug', conf)); 4571 } 4572 4573 return $cfs; 4574 }; 4575 4576 4577 4578 // GLOBAL PUBLIC 4579 4580 $.fn.carouFredSel.serialNumber = 1; 4581 $.fn.carouFredSel.defaults = { 4582 'synchronise' : false, 4583 'infinite' : true, 4584 'circular' : true, 4585 'responsive' : false, 4586 'direction' : 'left', 4587 'items' : { 4588 'start' : 0 4589 }, 4590 'scroll' : { 4591 'easing' : 'swing', 4592 'duration' : 500, 4593 'pauseOnHover' : false, 4594 'event' : 'click', 4595 'queue' : false 4596 } 4597 }; 4598 $.fn.carouFredSel.configs = { 4599 'debug' : false, 4600 'transition' : false, 4601 'onWindowResize': 'throttle', 4602 'events' : { 4603 'prefix' : '', 4604 'namespace' : 'cfs' 4605 }, 4606 'wrapper' : { 4607 'element' : 'div', 4608 'classname' : 'caroufredsel_wrapper' 4609 }, 4610 'classnames' : {} 4611 }; 4612 $.fn.carouFredSel.pageAnchorBuilder = function(nr) { 4613 return '<a href=""><span>'+nr+'</span></a>'; 4614 }; 4615 $.fn.carouFredSel.progressbarUpdater = function(perc) { 4616 $(this).css('width', perc+'%'); 4617 }; 4618 4619 $.fn.carouFredSel.cookie = { 4620 get: function(n) { 4621 n += '='; 4622 var ca = document.cookie.split(';'); 4623 for (var a = 0, l = ca.length; a < l; a++) 4624 { 4625 var c = ca[a]; 4626 while (c.charAt(0) == ' ') 4627 { 4628 c = c.slice(1); 4629 } 4630 if (c.indexOf(n) == 0) 4631 { 4632 return c.slice(n.length); 4633 } 4634 } 4635 return 0; 4636 }, 4637 set: function(n, v, d) { 4638 var e = ""; 4639 if (d) 4640 { 4641 var date = new Date(); 4642 date.setTime(date.getTime() + (d * 24 * 60 * 60 * 1000)); 4643 e = "; expires=" + date.toGMTString(); 4644 } 4645 document.cookie = n + '=' + v + e + '; path=/'; 4646 }, 4647 remove: function(n) { 4648 $.fn.carouFredSel.cookie.set(n, "", -1); 4649 } 4650 }; 4651 4652 4653 // GLOBAL PRIVATE 4654 4655 // scrolling functions 4656 function sc_setScroll(d, e, c) { 4657 if (c.transition == 'transition') 4658 { 4659 if (e == 'swing') 4660 { 4661 e = 'ease'; 4662 } 4663 } 4664 return { 4665 anims: [], 4666 duration: d, 4667 orgDuration: d, 4668 easing: e, 4669 startTime: getTime() 4670 }; 4671 } 4672 function sc_startScroll(s, c) { 4673 for (var a = 0, l = s.anims.length; a < l; a++) 4674 { 4675 var b = s.anims[a]; 4676 if (!b) 4677 { 4678 continue; 4679 } 4680 b[0][c.transition](b[1], s.duration, s.easing, b[2]); 4681 } 4682 } 4683 function sc_stopScroll(s, finish) { 4684 if (!is_boolean(finish)) 4685 { 4686 finish = true; 4687 } 4688 if (is_object(s.pre)) 4689 { 4690 sc_stopScroll(s.pre, finish); 4691 } 4692 for (var a = 0, l = s.anims.length; a < l; a++) 4693 { 4694 var b = s.anims[a]; 4695 b[0].stop(true); 4696 if (finish) 4697 { 4698 b[0].css(b[1]); 4699 if (is_function(b[2])) 4700 { 4701 b[2](); 4702 } 4703 } 4704 } 4705 if (is_object(s.post)) 4706 { 4707 sc_stopScroll(s.post, finish); 4708 } 4709 } 4710 function sc_afterScroll( $c, $c2, o ) { 4711 if ($c2) 4712 { 4713 $c2.remove(); 4714 } 4715 4716 switch(o.fx) { 4717 case 'fade': 4718 case 'crossfade': 4719 case 'cover-fade': 4720 case 'uncover-fade': 4721 $c.css('opacity', 1); 4722 $c.css('filter', ''); 4723 break; 4724 } 4725 } 4726 function sc_fireCallbacks($t, o, b, a, c) { 4727 if (o[b]) 4728 { 4729 o[b].call($t, a); 4730 } 4731 if (c[b].length) 4732 { 4733 for (var i = 0, l = c[b].length; i < l; i++) 4734 { 4735 c[b][i].call($t, a); 4736 } 4737 } 4738 return []; 4739 } 4740 function sc_fireQueue($c, q, c) { 4741 4742 if (q.length) 4743 { 4744 $c.trigger(cf_e(q[0][0], c), q[0][1]); 4745 q.shift(); 4746 } 4747 return q; 4748 } 4749 function sc_hideHiddenItems(hiddenitems) { 4750 hiddenitems.each(function() { 4751 var hi = $(this); 4752 hi.data('_cfs_isHidden', hi.is(':hidden')).hide(); 4753 }); 4754 } 4755 function sc_showHiddenItems(hiddenitems) { 4756 if (hiddenitems) 4757 { 4758 hiddenitems.each(function() { 4759 var hi = $(this); 4760 if (!hi.data('_cfs_isHidden')) 4761 { 4762 hi.show(); 4763 } 4764 }); 4765 } 4766 } 4767 function sc_clearTimers(t) { 4768 if (t.auto) 4769 { 4770 clearTimeout(t.auto); 4771 } 4772 if (t.progress) 4773 { 4774 clearInterval(t.progress); 4775 } 4776 return t; 4777 } 4778 function sc_mapCallbackArguments(i_old, i_skp, i_new, s_itm, s_dir, s_dur, w_siz) { 4779 return { 4780 'width': w_siz.width, 4781 'height': w_siz.height, 4782 'items': { 4783 'old': i_old, 4784 'skipped': i_skp, 4785 'visible': i_new 4786 }, 4787 'scroll': { 4788 'items': s_itm, 4789 'direction': s_dir, 4790 'duration': s_dur 4791 } 4792 }; 4793 } 4794 function sc_getDuration( sO, o, nI, siz ) { 4795 var dur = sO.duration; 4796 if (sO.fx == 'none') 4797 { 4798 return 0; 4799 } 4800 if (dur == 'auto') 4801 { 4802 dur = o.scroll.duration / o.scroll.items * nI; 4803 } 4804 else if (dur < 10) 4805 { 4806 dur = siz / dur; 4807 } 4808 if (dur < 1) 4809 { 4810 return 0; 4811 } 4812 if (sO.fx == 'fade') 4813 { 4814 dur = dur / 2; 4815 } 4816 return Math.round(dur); 4817 } 4818 4819 // navigation functions 4820 function nv_showNavi(o, t, c) { 4821 var minimum = (is_number(o.items.minimum)) ? o.items.minimum : o.items.visible + 1; 4822 if (t == 'show' || t == 'hide') 4823 { 4824 var f = t; 4825 } 4826 else if (minimum > t) 4827 { 4828 debug(c, 'Not enough items ('+t+' total, '+minimum+' needed): Hiding navigation.'); 4829 var f = 'hide'; 4830 } 4831 else 4832 { 4833 var f = 'show'; 4834 } 4835 var s = (f == 'show') ? 'removeClass' : 'addClass', 4836 h = cf_c('hidden', c); 4837 4838 if (o.auto.button) 4839 { 4840 o.auto.button[f]()[s](h); 4841 } 4842 if (o.prev.button) 4843 { 4844 o.prev.button[f]()[s](h); 4845 } 4846 if (o.next.button) 4847 { 4848 o.next.button[f]()[s](h); 4849 } 4850 if (o.pagination.container) 4851 { 4852 o.pagination.container[f]()[s](h); 4853 } 4854 } 4855 function nv_enableNavi(o, f, c) { 4856 if (o.circular || o.infinite) return; 4857 var fx = (f == 'removeClass' || f == 'addClass') ? f : false, 4858 di = cf_c('disabled', c); 4859 4860 if (o.auto.button && fx) 4861 { 4862 o.auto.button[fx](di); 4863 } 4864 if (o.prev.button) 4865 { 4866 var fn = fx || (f == 0) ? 'addClass' : 'removeClass'; 4867 o.prev.button[fn](di); 4868 } 4869 if (o.next.button) 4870 { 4871 var fn = fx || (f == o.items.visible) ? 'addClass' : 'removeClass'; 4872 o.next.button[fn](di); 4873 } 4874 } 4875 4876 // get object functions 4877 function go_getObject($tt, obj) { 4878 if (is_function(obj)) 4879 { 4880 obj = obj.call($tt); 4881 } 4882 else if (is_undefined(obj)) 4883 { 4884 obj = {}; 4885 } 4886 return obj; 4887 } 4888 function go_getItemsObject($tt, obj) { 4889 obj = go_getObject($tt, obj); 4890 if (is_number(obj)) 4891 { 4892 obj = { 4893 'visible': obj 4894 }; 4895 } 4896 else if (obj == 'variable') 4897 { 4898 obj = { 4899 'visible': obj, 4900 'width': obj, 4901 'height': obj 4902 }; 4903 } 4904 else if (!is_object(obj)) 4905 { 4906 obj = {}; 4907 } 4908 return obj; 4909 } 4910 function go_getScrollObject($tt, obj) { 4911 obj = go_getObject($tt, obj); 4912 if (is_number(obj)) 4913 { 4914 if (obj <= 50) 4915 { 4916 obj = { 4917 'items': obj 4918 }; 4919 } 4920 else 4921 { 4922 obj = { 4923 'duration': obj 4924 }; 4925 } 4926 } 4927 else if (is_string(obj)) 4928 { 4929 obj = { 4930 'easing': obj 4931 }; 4932 } 4933 else if (!is_object(obj)) 4934 { 4935 obj = {}; 4936 } 4937 return obj; 4938 } 4939 function go_getNaviObject($tt, obj) { 4940 obj = go_getObject($tt, obj); 4941 if (is_string(obj)) 4942 { 4943 var temp = cf_getKeyCode(obj); 4944 if (temp == -1) 4945 { 4946 obj = $(obj); 4947 } 4948 else 4949 { 4950 obj = temp; 4951 } 4952 } 4953 return obj; 4954 } 4955 4956 function go_getAutoObject($tt, obj) { 4957 obj = go_getNaviObject($tt, obj); 4958 if (is_jquery(obj)) 4959 { 4960 obj = { 4961 'button': obj 4962 }; 4963 } 4964 else if (is_boolean(obj)) 4965 { 4966 obj = { 4967 'play': obj 4968 }; 4969 } 4970 else if (is_number(obj)) 4971 { 4972 obj = { 4973 'timeoutDuration': obj 4974 }; 4975 } 4976 if (obj.progress) 4977 { 4978 if (is_string(obj.progress) || is_jquery(obj.progress)) 4979 { 4980 obj.progress = { 4981 'bar': obj.progress 4982 }; 4983 } 4984 } 4985 return obj; 4986 } 4987 function go_complementAutoObject($tt, obj) { 4988 if (is_function(obj.button)) 4989 { 4990 obj.button = obj.button.call($tt); 4991 } 4992 if (is_string(obj.button)) 4993 { 4994 obj.button = $(obj.button); 4995 } 4996 if (!is_boolean(obj.play)) 4997 { 4998 obj.play = true; 4999 } 5000 if (!is_number(obj.delay)) 5001 { 5002 obj.delay = 0; 5003 } 5004 if (is_undefined(obj.pauseOnEvent)) 5005 { 5006 obj.pauseOnEvent = true; 5007 } 5008 if (!is_boolean(obj.pauseOnResize)) 5009 { 5010 obj.pauseOnResize = true; 5011 } 5012 if (!is_number(obj.timeoutDuration)) 5013 { 5014 obj.timeoutDuration = (obj.duration < 10) 5015 ? 2500 5016 : obj.duration * 5; 5017 } 5018 if (obj.progress) 5019 { 5020 if (is_function(obj.progress.bar)) 5021 { 5022 obj.progress.bar = obj.progress.bar.call($tt); 5023 } 5024 if (is_string(obj.progress.bar)) 5025 { 5026 obj.progress.bar = $(obj.progress.bar); 5027 } 5028 if (obj.progress.bar) 5029 { 5030 if (!is_function(obj.progress.updater)) 5031 { 5032 obj.progress.updater = $.fn.carouFredSel.progressbarUpdater; 5033 } 5034 if (!is_number(obj.progress.interval)) 5035 { 5036 obj.progress.interval = 50; 5037 } 5038 } 5039 else 5040 { 5041 obj.progress = false; 5042 } 5043 } 5044 return obj; 5045 } 5046 5047 function go_getPrevNextObject($tt, obj) { 5048 obj = go_getNaviObject($tt, obj); 5049 if (is_jquery(obj)) 5050 { 5051 obj = { 5052 'button': obj 5053 }; 5054 } 5055 else if (is_number(obj)) 5056 { 5057 obj = { 5058 'key': obj 5059 }; 5060 } 5061 return obj; 5062 } 5063 function go_complementPrevNextObject($tt, obj) { 5064 if (is_function(obj.button)) 5065 { 5066 obj.button = obj.button.call($tt); 5067 } 5068 if (is_string(obj.button)) 5069 { 5070 obj.button = $(obj.button); 5071 } 5072 if (is_string(obj.key)) 5073 { 5074 obj.key = cf_getKeyCode(obj.key); 5075 } 5076 return obj; 5077 } 5078 5079 function go_getPaginationObject($tt, obj) { 5080 obj = go_getNaviObject($tt, obj); 5081 if (is_jquery(obj)) 5082 { 5083 obj = { 5084 'container': obj 5085 }; 5086 } 5087 else if (is_boolean(obj)) 5088 { 5089 obj = { 5090 'keys': obj 5091 }; 5092 } 5093 return obj; 5094 } 5095 function go_complementPaginationObject($tt, obj) { 5096 if (is_function(obj.container)) 5097 { 5098 obj.container = obj.container.call($tt); 5099 } 5100 if (is_string(obj.container)) 5101 { 5102 obj.container = $(obj.container); 5103 } 5104 if (!is_number(obj.items)) 5105 { 5106 obj.items = false; 5107 } 5108 if (!is_boolean(obj.keys)) 5109 { 5110 obj.keys = false; 5111 } 5112 if (!is_function(obj.anchorBuilder) && !is_false(obj.anchorBuilder)) 5113 { 5114 obj.anchorBuilder = $.fn.carouFredSel.pageAnchorBuilder; 5115 } 5116 if (!is_number(obj.deviation)) 5117 { 5118 obj.deviation = 0; 5119 } 5120 return obj; 5121 } 5122 5123 function go_getSwipeObject($tt, obj) { 5124 if (is_function(obj)) 5125 { 5126 obj = obj.call($tt); 5127 } 5128 if (is_undefined(obj)) 5129 { 5130 obj = { 5131 'onTouch': false 5132 }; 5133 } 5134 if (is_true(obj)) 5135 { 5136 obj = { 5137 'onTouch': obj 5138 }; 5139 } 5140 else if (is_number(obj)) 5141 { 5142 obj = { 5143 'items': obj 5144 }; 5145 } 5146 return obj; 5147 } 5148 function go_complementSwipeObject($tt, obj) { 5149 if (!is_boolean(obj.onTouch)) 5150 { 5151 obj.onTouch = true; 5152 } 5153 if (!is_boolean(obj.onMouse)) 5154 { 5155 obj.onMouse = false; 5156 } 5157 if (!is_object(obj.options)) 5158 { 5159 obj.options = {}; 5160 } 5161 if (!is_boolean(obj.options.triggerOnTouchEnd)) 5162 { 5163 obj.options.triggerOnTouchEnd = false; 5164 } 5165 return obj; 5166 } 5167 function go_getMousewheelObject($tt, obj) { 5168 if (is_function(obj)) 5169 { 5170 obj = obj.call($tt); 5171 } 5172 if (is_true(obj)) 5173 { 5174 obj = {}; 5175 } 5176 else if (is_number(obj)) 5177 { 5178 obj = { 5179 'items': obj 5180 }; 5181 } 5182 else if (is_undefined(obj)) 5183 { 5184 obj = false; 5185 } 5186 return obj; 5187 } 5188 function go_complementMousewheelObject($tt, obj) { 5189 return obj; 5190 } 5191 5192 // get number functions 5193 function gn_getItemIndex(num, dev, org, items, $cfs) { 5194 if (is_string(num)) 5195 { 5196 num = $(num, $cfs); 5197 } 5198 5199 if (is_object(num)) 5200 { 5201 num = $(num, $cfs); 5202 } 5203 if (is_jquery(num)) 5204 { 5205 num = $cfs.children().index(num); 5206 if (!is_boolean(org)) 5207 { 5208 org = false; 5209 } 5210 } 5211 else 5212 { 5213 if (!is_boolean(org)) 5214 { 5215 org = true; 5216 } 5217 } 5218 if (!is_number(num)) 5219 { 5220 num = 0; 5221 } 5222 if (!is_number(dev)) 5223 { 5224 dev = 0; 5225 } 5226 5227 if (org) 5228 { 5229 num += items.first; 5230 } 5231 num += dev; 5232 if (items.total > 0) 5233 { 5234 while (num >= items.total) 5235 { 5236 num -= items.total; 5237 } 5238 while (num < 0) 5239 { 5240 num += items.total; 5241 } 5242 } 5243 return num; 5244 } 5245 5246 // items prev 5247 function gn_getVisibleItemsPrev(i, o, s) { 5248 var t = 0, 5249 x = 0; 5250 5251 for (var a = s; a >= 0; a--) 5252 { 5253 var j = i.eq(a); 5254 t += (j.is(':visible')) ? j[o.d['outerWidth']](true) : 0; 5255 if (t > o.maxDimension) 5256 { 5257 return x; 5258 } 5259 if (a == 0) 5260 { 5261 a = i.length; 5262 } 5263 x++; 5264 } 5265 } 5266 function gn_getVisibleItemsPrevFilter(i, o, s) { 5267 return gn_getItemsPrevFilter(i, o.items.filter, o.items.visibleConf.org, s); 5268 } 5269 function gn_getScrollItemsPrevFilter(i, o, s, m) { 5270 return gn_getItemsPrevFilter(i, o.items.filter, m, s); 5271 } 5272 function gn_getItemsPrevFilter(i, f, m, s) { 5273 var t = 0, 5274 x = 0; 5275 5276 for (var a = s, l = i.length; a >= 0; a--) 5277 { 5278 x++; 5279 if (x == l) 5280 { 5281 return x; 5282 } 5283 5284 var j = i.eq(a); 5285 if (j.is(f)) 5286 { 5287 t++; 5288 if (t == m) 5289 { 5290 return x; 5291 } 5292 } 5293 if (a == 0) 5294 { 5295 a = l; 5296 } 5297 } 5298 } 5299 5300 function gn_getVisibleOrg($c, o) { 5301 return o.items.visibleConf.org || $c.children().slice(0, o.items.visible).filter(o.items.filter).length; 5302 } 5303 5304 // items next 5305 function gn_getVisibleItemsNext(i, o, s) { 5306 var t = 0, 5307 x = 0; 5308 5309 for (var a = s, l = i.length-1; a <= l; a++) 5310 { 5311 var j = i.eq(a); 5312 5313 t += (j.is(':visible')) ? j[o.d['outerWidth']](true) : 0; 5314 if (t > o.maxDimension) 5315 { 5316 return x; 5317 } 5318 5319 x++; 5320 if (x == l+1) 5321 { 5322 return x; 5323 } 5324 if (a == l) 5325 { 5326 a = -1; 5327 } 5328 } 5329 } 5330 function gn_getVisibleItemsNextTestCircular(i, o, s, l) { 5331 var v = gn_getVisibleItemsNext(i, o, s); 5332 if (!o.circular) 5333 { 5334 if (s + v > l) 5335 { 5336 v = l - s; 5337 } 5338 } 5339 return v; 5340 } 5341 function gn_getVisibleItemsNextFilter(i, o, s) { 5342 return gn_getItemsNextFilter(i, o.items.filter, o.items.visibleConf.org, s, o.circular); 5343 } 5344 function gn_getScrollItemsNextFilter(i, o, s, m) { 5345 return gn_getItemsNextFilter(i, o.items.filter, m+1, s, o.circular) - 1; 5346 } 5347 function gn_getItemsNextFilter(i, f, m, s, c) { 5348 var t = 0, 5349 x = 0; 5350 5351 for (var a = s, l = i.length-1; a <= l; a++) 5352 { 5353 x++; 5354 if (x >= l) 5355 { 5356 return x; 5357 } 5358 5359 var j = i.eq(a); 5360 if (j.is(f)) 5361 { 5362 t++; 5363 if (t == m) 5364 { 5365 return x; 5366 } 5367 } 5368 if (a == l) 5369 { 5370 a = -1; 5371 } 5372 } 5373 } 5374 5375 // get items functions 5376 function gi_getCurrentItems(i, o) { 5377 return i.slice(0, o.items.visible); 5378 } 5379 function gi_getOldItemsPrev(i, o, n) { 5380 return i.slice(n, o.items.visibleConf.old+n); 5381 } 5382 function gi_getNewItemsPrev(i, o) { 5383 return i.slice(0, o.items.visible); 5384 } 5385 function gi_getOldItemsNext(i, o) { 5386 return i.slice(0, o.items.visibleConf.old); 5387 } 5388 function gi_getNewItemsNext(i, o, n) { 5389 return i.slice(n, o.items.visible+n); 5390 } 5391 5392 // sizes functions 5393 function sz_storeMargin(i, o, d) { 5394 if (o.usePadding) 5395 { 5396 if (!is_string(d)) 5397 { 5398 d = '_cfs_origCssMargin'; 5399 } 5400 i.each(function() { 5401 var j = $(this), 5402 m = parseInt(j.css(o.d['marginRight']), 10); 5403 if (!is_number(m)) 5404 { 5405 m = 0; 5406 } 5407 j.data(d, m); 5408 }); 5409 } 5410 } 5411 function sz_resetMargin(i, o, m) { 5412 if (o.usePadding) 5413 { 5414 var x = (is_boolean(m)) ? m : false; 5415 if (!is_number(m)) 5416 { 5417 m = 0; 5418 } 5419 sz_storeMargin(i, o, '_cfs_tempCssMargin'); 5420 i.each(function() { 5421 var j = $(this); 5422 j.css(o.d['marginRight'], ((x) ? j.data('_cfs_tempCssMargin') : m + j.data('_cfs_origCssMargin'))); 5423 }); 5424 } 5425 } 5426 function sz_storeOrigCss(i) { 5427 i.each(function() { 5428 var j = $(this); 5429 j.data('_cfs_origCss', j.attr('style') || ''); 5430 }); 5431 } 5432 function sz_restoreOrigCss(i) { 5433 i.each(function() { 5434 var j = $(this); 5435 j.attr('style', j.data('_cfs_origCss') || ''); 5436 }); 5437 } 5438 function sz_setResponsiveSizes(o, all) { 5439 var visb = o.items.visible, 5440 newS = o.items[o.d['width']], 5441 seco = o[o.d['height']], 5442 secp = is_percentage(seco); 5443 5444 all.each(function() { 5445 var $t = $(this), 5446 nw = newS - ms_getPaddingBorderMargin($t, o, 'Width'); 5447 5448 $t[o.d['width']](nw); 5449 if (secp) 5450 { 5451 $t[o.d['height']](ms_getPercentage(nw, seco)); 5452 } 5453 }); 5454 } 5455 function sz_setSizes($c, o) { 5456 var $w = $c.parent(), 5457 $i = $c.children(), 5458 $v = gi_getCurrentItems($i, o), 5459 sz = cf_mapWrapperSizes(ms_getSizes($v, o, true), o, false); 5460 5461 $w.css(sz); 5462 5463 if (o.usePadding) 5464 { 5465 var p = o.padding, 5466 r = p[o.d[1]]; 5467 5468 if (o.align && r < 0) 5469 { 5470 r = 0; 5471 } 5472 var $l = $v.last(); 5473 $l.css(o.d['marginRight'], $l.data('_cfs_origCssMargin') + r); 5474 $c.css(o.d['top'], p[o.d[0]]); 5475 $c.css(o.d['left'], p[o.d[3]]); 5476 } 5477 5478 $c.css(o.d['width'], sz[o.d['width']]+(ms_getTotalSize($i, o, 'width')*2)); 5479 $c.css(o.d['height'], ms_getLargestSize($i, o, 'height')); 5480 return sz; 5481 } 5482 5483 // measuring functions 5484 function ms_getSizes(i, o, wrapper) { 5485 return [ms_getTotalSize(i, o, 'width', wrapper), ms_getLargestSize(i, o, 'height', wrapper)]; 5486 } 5487 function ms_getLargestSize(i, o, dim, wrapper) { 5488 if (!is_boolean(wrapper)) 5489 { 5490 wrapper = false; 5491 } 5492 if (is_number(o[o.d[dim]]) && wrapper) 5493 { 5494 return o[o.d[dim]]; 5495 } 5496 if (is_number(o.items[o.d[dim]])) 5497 { 5498 return o.items[o.d[dim]]; 5499 } 5500 dim = (dim.toLowerCase().indexOf('width') > -1) ? 'outerWidth' : 'outerHeight'; 5501 return ms_getTrueLargestSize(i, o, dim); 5502 } 5503 function ms_getTrueLargestSize(i, o, dim) { 5504 var s = 0; 5505 5506 for (var a = 0, l = i.length; a < l; a++) 5507 { 5508 var j = i.eq(a); 5509 5510 var m = (j.is(':visible')) ? j[o.d[dim]](true) : 0; 5511 if (s < m) 5512 { 5513 s = m; 5514 } 5515 } 5516 return s; 5517 } 5518 5519 function ms_getTotalSize(i, o, dim, wrapper) { 5520 if (!is_boolean(wrapper)) 5521 { 5522 wrapper = false; 5523 } 5524 if (is_number(o[o.d[dim]]) && wrapper) 5525 { 5526 return o[o.d[dim]]; 5527 } 5528 if (is_number(o.items[o.d[dim]])) 5529 { 5530 return o.items[o.d[dim]] * i.length; 5531 } 5532 5533 var d = (dim.toLowerCase().indexOf('width') > -1) ? 'outerWidth' : 'outerHeight', 5534 s = 0; 5535 5536 for (var a = 0, l = i.length; a < l; a++) 5537 { 5538 var j = i.eq(a); 5539 s += (j.is(':visible')) ? j[o.d[d]](true) : 0; 5540 } 5541 return s; 5542 } 5543 function ms_getParentSize($w, o, d) { 5544 var isVisible = $w.is(':visible'); 5545 if (isVisible) 5546 { 5547 $w.hide(); 5548 } 5549 var s = $w.parent()[o.d[d]](); 5550 if (isVisible) 5551 { 5552 $w.show(); 5553 } 5554 return s; 5555 } 5556 function ms_getMaxDimension(o, a) { 5557 return (is_number(o[o.d['width']])) ? o[o.d['width']] : a; 5558 } 5559 function ms_hasVariableSizes(i, o, dim) { 5560 var s = false, 5561 v = false; 5562 5563 for (var a = 0, l = i.length; a < l; a++) 5564 { 5565 var j = i.eq(a); 5566 5567 var c = (j.is(':visible')) ? j[o.d[dim]](true) : 0; 5568 if (s === false) 5569 { 5570 s = c; 5571 } 5572 else if (s != c) 5573 { 5574 v = true; 5575 } 5576 if (s == 0) 5577 { 5578 v = true; 5579 } 5580 } 5581 return v; 5582 } 5583 function ms_getPaddingBorderMargin(i, o, d) { 5584 return i[o.d['outer'+d]](true) - i[o.d[d.toLowerCase()]](); 5585 } 5586 function ms_getPercentage(s, o) { 5587 if (is_percentage(o)) 5588 { 5589 o = parseInt( o.slice(0, -1), 10 ); 5590 if (!is_number(o)) 5591 { 5592 return s; 5593 } 5594 s *= o/100; 5595 } 5596 return s; 5597 } 5598 5599 // config functions 5600 function cf_e(n, c, pf, ns, rd) { 5601 if (!is_boolean(pf)) 5602 { 5603 pf = true; 5604 } 5605 if (!is_boolean(ns)) 5606 { 5607 ns = true; 5608 } 5609 if (!is_boolean(rd)) 5610 { 5611 rd = false; 5612 } 5613 5614 if (pf) 5615 { 5616 n = c.events.prefix + n; 5617 } 5618 if (ns) 5619 { 5620 n = n +'.'+ c.events.namespace; 5621 } 5622 if (ns && rd) 5623 { 5624 n += c.serialNumber; 5625 } 5626 5627 return n; 5628 } 5629 function cf_c(n, c) { 5630 return (is_string(c.classnames[n])) ? c.classnames[n] : n; 5631 } 5632 function cf_mapWrapperSizes(ws, o, p) { 5633 if (!is_boolean(p)) 5634 { 5635 p = true; 5636 } 5637 var pad = (o.usePadding && p) ? o.padding : [0, 0, 0, 0]; 5638 var wra = {}; 5639 5640 wra[o.d['width']] = ws[0] + pad[1] + pad[3]; 5641 wra[o.d['height']] = ws[1] + pad[0] + pad[2]; 5642 5643 return wra; 5644 } 5645 function cf_sortParams(vals, typs) { 5646 var arr = []; 5647 for (var a = 0, l1 = vals.length; a < l1; a++) 5648 { 5649 for (var b = 0, l2 = typs.length; b < l2; b++) 5650 { 5651 if (typs[b].indexOf(typeof vals[a]) > -1 && is_undefined(arr[b])) 5652 { 5653 arr[b] = vals[a]; 5654 break; 5655 } 5656 } 5657 } 5658 return arr; 5659 } 5660 function cf_getPadding(p) { 5661 if (is_undefined(p)) 5662 { 5663 return [0, 0, 0, 0]; 5664 } 5665 if (is_number(p)) 5666 { 5667 return [p, p, p, p]; 5668 } 5669 if (is_string(p)) 5670 { 5671 p = p.split('px').join('').split('em').join('').split(' '); 5672 } 5673 5674 if (!is_array(p)) 5675 { 5676 return [0, 0, 0, 0]; 5677 } 5678 for (var i = 0; i < 4; i++) 5679 { 5680 p[i] = parseInt(p[i], 10); 5681 } 5682 switch (p.length) 5683 { 5684 case 0: 5685 return [0, 0, 0, 0]; 5686 case 1: 5687 return [p[0], p[0], p[0], p[0]]; 5688 case 2: 5689 return [p[0], p[1], p[0], p[1]]; 5690 case 3: 5691 return [p[0], p[1], p[2], p[1]]; 5692 default: 5693 return [p[0], p[1], p[2], p[3]]; 5694 } 5695 } 5696 function cf_getAlignPadding(itm, o) { 5697 var x = (is_number(o[o.d['width']])) ? Math.ceil(o[o.d['width']] - ms_getTotalSize(itm, o, 'width')) : 0; 5698 switch (o.align) 5699 { 5700 case 'left': 5701 return [0, x]; 5702 case 'right': 5703 return [x, 0]; 5704 case 'center': 5705 default: 5706 return [Math.ceil(x/2), Math.floor(x/2)]; 5707 } 5708 } 5709 function cf_getDimensions(o) { 5710 var dm = [ 5711 ['width' , 'innerWidth' , 'outerWidth' , 'height' , 'innerHeight' , 'outerHeight' , 'left', 'top' , 'marginRight' , 0, 1, 2, 3], 5712 ['height' , 'innerHeight' , 'outerHeight' , 'width' , 'innerWidth' , 'outerWidth' , 'top' , 'left', 'marginBottom', 3, 2, 1, 0] 5713 ]; 5714 5715 var dl = dm[0].length, 5716 dx = (o.direction == 'right' || o.direction == 'left') ? 0 : 1; 5717 5718 var dimensions = {}; 5719 for (var d = 0; d < dl; d++) 5720 { 5721 dimensions[dm[0][d]] = dm[dx][d]; 5722 } 5723 return dimensions; 5724 } 5725 function cf_getAdjust(x, o, a, $t) { 5726 var v = x; 5727 if (is_function(a)) 5728 { 5729 v = a.call($t, v); 5730 5731 } 5732 else if (is_string(a)) 5733 { 5734 var p = a.split('+'), 5735 m = a.split('-'); 5736 5737 if (m.length > p.length) 5738 { 5739 var neg = true, 5740 sta = m[0], 5741 adj = m[1]; 5742 } 5743 else 5744 { 5745 var neg = false, 5746 sta = p[0], 5747 adj = p[1]; 5748 } 5749 5750 switch(sta) 5751 { 5752 case 'even': 5753 v = (x % 2 == 1) ? x-1 : x; 5754 break; 5755 case 'odd': 5756 v = (x % 2 == 0) ? x-1 : x; 5757 break; 5758 default: 5759 v = x; 5760 break; 5761 } 5762 adj = parseInt(adj, 10); 5763 if (is_number(adj)) 5764 { 5765 if (neg) 5766 { 5767 adj = -adj; 5768 } 5769 v += adj; 5770 } 5771 } 5772 if (!is_number(v) || v < 1) 5773 { 5774 v = 1; 5775 } 5776 return v; 5777 } 5778 function cf_getItemsAdjust(x, o, a, $t) { 5779 return cf_getItemAdjustMinMax(cf_getAdjust(x, o, a, $t), o.items.visibleConf); 5780 } 5781 function cf_getItemAdjustMinMax(v, i) { 5782 if (is_number(i.min) && v < i.min) 5783 { 5784 v = i.min; 5785 } 5786 if (is_number(i.max) && v > i.max) 5787 { 5788 v = i.max; 5789 } 5790 if (v < 1) 5791 { 5792 v = 1; 5793 } 5794 return v; 5795 } 5796 function cf_getSynchArr(s) { 5797 if (!is_array(s)) 5798 { 5799 s = [[s]]; 5800 } 5801 if (!is_array(s[0])) 5802 { 5803 s = [s]; 5804 } 5805 for (var j = 0, l = s.length; j < l; j++) 5806 { 5807 if (is_string(s[j][0])) 5808 { 5809 s[j][0] = $(s[j][0]); 5810 } 5811 if (!is_boolean(s[j][1])) 5812 { 5813 s[j][1] = true; 5814 } 5815 if (!is_boolean(s[j][2])) 5816 { 5817 s[j][2] = true; 5818 } 5819 if (!is_number(s[j][3])) 5820 { 5821 s[j][3] = 0; 5822 } 5823 } 5824 return s; 5825 } 5826 function cf_getKeyCode(k) { 5827 if (k == 'right') 5828 { 5829 return 39; 5830 } 5831 if (k == 'left') 5832 { 5833 return 37; 5834 } 5835 if (k == 'up') 5836 { 5837 return 38; 5838 } 5839 if (k == 'down') 5840 { 5841 return 40; 5842 } 5843 return -1; 5844 } 5845 function cf_setCookie(n, $c, c) { 5846 if (n) 5847 { 5848 var v = $c.triggerHandler(cf_e('currentPosition', c)); 5849 $.fn.carouFredSel.cookie.set(n, v); 5850 } 5851 } 5852 function cf_getCookie(n) { 5853 var c = $.fn.carouFredSel.cookie.get(n); 5854 return (c == '') ? 0 : c; 5855 } 5856 5857 // init function 5858 function in_mapCss($elem, props) { 5859 var css = {}; 5860 for (var p = 0, l = props.length; p < l; p++) 5861 { 5862 css[props[p]] = $elem.css(props[p]); 5863 } 5864 return css; 5865 } 5866 function in_complementItems(obj, opt, itm, sta) { 5867 if (!is_object(obj.visibleConf)) 5868 { 5869 obj.visibleConf = {}; 5870 } 5871 if (!is_object(obj.sizesConf)) 5872 { 5873 obj.sizesConf = {}; 5874 } 5875 5876 if (obj.start == 0 && is_number(sta)) 5877 { 5878 obj.start = sta; 5879 } 5880 5881 // visible items 5882 if (is_object(obj.visible)) 5883 { 5884 obj.visibleConf.min = obj.visible.min; 5885 obj.visibleConf.max = obj.visible.max; 5886 obj.visible = false; 5887 } 5888 else if (is_string(obj.visible)) 5889 { 5890 // variable visible items 5891 if (obj.visible == 'variable') 5892 { 5893 obj.visibleConf.variable = true; 5894 } 5895 // adjust string visible items 5896 else 5897 { 5898 obj.visibleConf.adjust = obj.visible; 5899 } 5900 obj.visible = false; 5901 } 5902 else if (is_function(obj.visible)) 5903 { 5904 obj.visibleConf.adjust = obj.visible; 5905 obj.visible = false; 5906 } 5907 5908 // set items filter 5909 if (!is_string(obj.filter)) 5910 { 5911 obj.filter = (itm.filter(':hidden').length > 0) ? ':visible' : '*'; 5912 } 5913 5914 // primary item-size not set 5915 if (!obj[opt.d['width']]) 5916 { 5917 // responsive carousel -> set to largest 5918 if (opt.responsive) 5919 { 5920 debug(true, 'Set a '+opt.d['width']+' for the items!'); 5921 obj[opt.d['width']] = ms_getTrueLargestSize(itm, opt, 'outerWidth'); 5922 } 5923 // non-responsive -> measure it or set to "variable" 5924 else 5925 { 5926 obj[opt.d['width']] = (ms_hasVariableSizes(itm, opt, 'outerWidth')) 5927 ? 'variable' 5928 : itm[opt.d['outerWidth']](true); 5929 } 5930 } 5931 5932 // secondary item-size not set -> measure it or set to "variable" 5933 if (!obj[opt.d['height']]) 5934 { 5935 obj[opt.d['height']] = (ms_hasVariableSizes(itm, opt, 'outerHeight')) 5936 ? 'variable' 5937 : itm[opt.d['outerHeight']](true); 5938 } 5939 5940 obj.sizesConf.width = obj.width; 5941 obj.sizesConf.height = obj.height; 5942 return obj; 5943 } 5944 function in_complementVisibleItems(opt, avl) { 5945 // primary item-size variable -> set visible items variable 5946 if (opt.items[opt.d['width']] == 'variable') 5947 { 5948 opt.items.visibleConf.variable = true; 5949 } 5950 if (!opt.items.visibleConf.variable) { 5951 // primary size is number -> calculate visible-items 5952 if (is_number(opt[opt.d['width']])) 5953 { 5954 opt.items.visible = Math.floor(opt[opt.d['width']] / opt.items[opt.d['width']]); 5955 } 5956 // measure and calculate primary size and visible-items 5957 else 5958 { 5959 opt.items.visible = Math.floor(avl / opt.items[opt.d['width']]); 5960 opt[opt.d['width']] = opt.items.visible * opt.items[opt.d['width']]; 5961 if (!opt.items.visibleConf.adjust) 5962 { 5963 opt.align = false; 5964 } 5965 } 5966 if (opt.items.visible == 'Infinity' || opt.items.visible < 1) 5967 { 5968 debug(true, 'Not a valid number of visible items: Set to "variable".'); 5969 opt.items.visibleConf.variable = true; 5970 } 5971 } 5972 return opt; 5973 } 5974 function in_complementPrimarySize(obj, opt, all) { 5975 // primary size set to auto -> measure largest item-size and set it 5976 if (obj == 'auto') 5977 { 5978 obj = ms_getTrueLargestSize(all, opt, 'outerWidth'); 5979 } 5980 return obj; 5981 } 5982 function in_complementSecondarySize(obj, opt, all) { 5983 // secondary size set to auto -> measure largest item-size and set it 5984 if (obj == 'auto') 5985 { 5986 obj = ms_getTrueLargestSize(all, opt, 'outerHeight'); 5987 } 5988 // secondary size not set -> set to secondary item-size 5989 if (!obj) 5990 { 5991 obj = opt.items[opt.d['height']]; 5992 } 5993 return obj; 5994 } 5995 function in_getAlignPadding(o, all) { 5996 var p = cf_getAlignPadding(gi_getCurrentItems(all, o), o); 5997 o.padding[o.d[1]] = p[1]; 5998 o.padding[o.d[3]] = p[0]; 5999 return o; 6000 } 6001 function in_getResponsiveValues(o, all, avl) { 6002 6003 var visb = cf_getItemAdjustMinMax(Math.ceil(o[o.d['width']] / o.items[o.d['width']]), o.items.visibleConf); 6004 if (visb > all.length) 6005 { 6006 visb = all.length; 6007 } 6008 6009 var newS = Math.floor(o[o.d['width']]/visb); 6010 6011 o.items.visible = visb; 6012 o.items[o.d['width']] = newS; 6013 o[o.d['width']] = visb * newS; 6014 return o; 6015 } 6016 6017 6018 // buttons functions 6019 function bt_pauseOnHoverConfig(p) { 6020 if (is_string(p)) 6021 { 6022 var i = (p.indexOf('immediate') > -1) ? true : false, 6023 r = (p.indexOf('resume') > -1) ? true : false; 6024 } 6025 else 6026 { 6027 var i = r = false; 6028 } 6029 return [i, r]; 6030 } 6031 function bt_mousesheelNumber(mw) { 6032 return (is_number(mw)) ? mw : null 6033 } 6034 6035 // helper functions 6036 function is_null(a) { 6037 return (a === null); 6038 } 6039 function is_undefined(a) { 6040 return (is_null(a) || typeof a == 'undefined' || a === '' || a === 'undefined'); 6041 } 6042 function is_array(a) { 6043 return (a instanceof Array); 6044 } 6045 function is_jquery(a) { 6046 return (a instanceof jQuery); 6047 } 6048 function is_object(a) { 6049 return ((a instanceof Object || typeof a == 'object') && !is_null(a) && !is_jquery(a) && !is_array(a) && !is_function(a)); 6050 } 6051 function is_number(a) { 6052 return ((a instanceof Number || typeof a == 'number') && !isNaN(a)); 6053 } 6054 function is_string(a) { 6055 return ((a instanceof String || typeof a == 'string') && !is_undefined(a) && !is_true(a) && !is_false(a)); 6056 } 6057 function is_function(a) { 6058 return (a instanceof Function || typeof a == 'function'); 6059 } 6060 function is_boolean(a) { 6061 return (a instanceof Boolean || typeof a == 'boolean' || is_true(a) || is_false(a)); 6062 } 6063 function is_true(a) { 6064 return (a === true || a === 'true'); 6065 } 6066 function is_false(a) { 6067 return (a === false || a === 'false'); 6068 } 6069 function is_percentage(x) { 6070 return (is_string(x) && x.slice(-1) == '%'); 6071 } 6072 6073 6074 function getTime() { 6075 return new Date().getTime(); 6076 } 6077 6078 function deprecated( o, n ) { 6079 debug(true, o+' is DEPRECATED, support for it will be removed. Use '+n+' instead.'); 6080 } 6081 function debug(d, m) { 6082 if (!is_undefined(window.console) && !is_undefined(window.console.log)) 6083 { 6084 if (is_object(d)) 6085 { 6086 var s = ' ('+d.selector+')'; 6087 d = d.debug; 6088 } 6089 else 6090 { 6091 var s = ''; 6092 } 6093 if (!d) 6094 { 6095 return false; 6096 } 6097 6098 if (is_string(m)) 6099 { 6100 m = 'carouFredSel'+s+': ' + m; 6101 } 6102 else 6103 { 6104 m = ['carouFredSel'+s+':', m]; 6105 } 6106 window.console.log(m); 6107 } 6108 return false; 6109 } 6110 6111 6112 6113 // EASING FUNCTIONS 6114 $.extend($.easing, { 6115 'quadratic': function(t) { 6116 var t2 = t * t; 6117 return t * (-t2 * t + 4 * t2 - 6 * t + 4); 6118 }, 6119 'cubic': function(t) { 6120 return t * (4 * t * t - 9 * t + 6); 6121 }, 6122 'elastic': function(t) { 6123 var t2 = t * t; 6124 return t * (33 * t2 * t2 - 106 * t2 * t + 126 * t2 - 67 * t + 15); 6125 } 6126 });
6127 6128 6129})(jQuery);//! æ¹è¡ 6130 6131/* 6132============================================================== 6133jquery.carouFredSel-6.2.1.js END 6134============================================================== 6135*/ 6136 6137 6138 6139/* 6140============================================================== 6141jquery.superbox.js START 6142============================================================== 6143*/ 6144 6145/* @license 6146 * jQuery SuperBox! 0.9.1 6147 * Copyright (c) 2009 Pierre Bertet (pierrebertet.net) 6148 * Licensed under the MIT (MIT-LICENSE.txt) 6149 * 6150 * TODO : 6151 * - Document.load if init is before </body> against IE crash. 6152 * - Animations 6153 * - Image / Gallery mode : display a legend 6154*/ 6155(function($){ 6156 6157 // Local variables 6158 var $overlay, $wrapper, $container, $superbox, $closeBtn, $loading, $nextprev, $nextBtn, $prevBtn, settings, 6159 6160 currentBrowser = (function(){ 6161 return { 6162 ltIE6: typeof window.addEventListener == "undefined" && typeof document.documentElement.style.maxHeight == "undefined", 6163 ltIE7: typeof window.addEventListener == "undefined" && typeof document.querySelectorAll == "undefined", 6164 ltIE8: typeof window.addEventListener == "undefined" && typeof document.getElementsByClassName == "undefined", 6165 IE: document.uniqueID, 6166 Firefox: window.sidebar, 6167 Opera: window.opera, 6168 Webkit: !document.uniqueID && !window.opera && !window.sidebar && window.localStorage && typeof window.orientation == "undefined", 6169 Mobile: typeof window.orientation != "undefined" 6170 } 6171 })(); 6172 6173 // Default settings 6174 defaultSettings = { 6175 boxId: "superbox", 6176 boxClasses: "", 6177 overlayOpacity: .8, 6178 boxWidth: "600", 6179 boxHeight: "400", 6180 loadTxt: "Loading...", 6181 closeTxt: "Close", 6182 prevTxt: "Previous", 6183 nextTxt: "Next", 6184 beforeShow: function(){} 6185 }, 6186 6187 galleryGroups = {}, 6188 galleryMode = false, 6189 hideElts = $([]); 6190 6191 // Init dispatcher 6192 $.superbox = function(){ 6193 6194 // Settings 6195 settings = $.extend({}, defaultSettings, $.superbox.settings); 6196 6197 // If IE6, select elements to hide 6198 if (currentBrowser.ltIE6){ 6199 hideElts = hideElts.add("select"); 6200 } 6201 6202 // Create base elements 6203 createElements(); 6204 6205 // Dispatch types 6206 dispatch(); 6207 }; 6208 6209 // Dispatch types 6210 function dispatch(){ 6211 6212 // Match all superbox links 6213 $("a[rel^=superbox],area[rel^=superbox]").each(function(){ 6214 6215 // Optimisation 6216 var $this = $(this), 6217 relAttr = $this.attr("rel"), 6218 // Match type (ex : superbox[gallery#my_id.my_class][my_gallery] > gallery 6219 type = relAttr.match(/^superbox\[([^#\.\]]+)/)[1], 6220 6221 // Match additionnal classes or IDs (#xxx.yyy.zzz) 6222 boxCurrentAttrs = relAttr.replace("superbox", "").match(/([#\.][^#\.\]]+)/g) || [], 6223 6224 // Box ID and classes 6225 newBoxId = settings.boxId, 6226 newBoxClasses = settings.boxClasses; 6227 6228 // Additionnal rel settings 6229 this._relSettings = relAttr.replace("superbox["+ type + boxCurrentAttrs.join("") +"]", ""); 6230 6231 // Redefine settings 6232 $.each(boxCurrentAttrs, function(i, val){ // each class or id 6233 if (val.substr(0,1) == "#"){ 6234 newBoxId = val.substr(1); 6235 } 6236 else if (val.substr(0,1) == "."){ 6237 newBoxClasses += " " + val.substr(1); 6238 } 6239 }); 6240 6241 // Call type method 6242 if (type.search(/^image|gallery|iframe|content|ajax$/) != -1) { 6243 $this.superbox(type, {boxId: newBoxId, boxClasses: newBoxClasses}); 6244 } 6245 }); 6246 }; 6247 6248 /*-- Superbox Method --*/ 6249 $.fn.superbox = function(type, curSettings){ 6250 curSettings = $.extend({}, settings, curSettings); 6251 $.superbox[type](this, curSettings); 6252 }; 6253 6254 /*-- Types --*/ 6255 $.extend($.superbox, { 6256 6257 // Image 6258 image: function($elt, curSettings, type){ 6259 6260 var relSettings = getRelSettings($elt.get(0)), 6261 dimensions = false; 6262 6263 // Extra settings 6264 if (relSettings && type == "gallery") 6265 dimensions = relSettings[1]; 6266 else if (relSettings) 6267 dimensions = relSettings[0]; 6268 6269 // On click event 6270 $elt.click(function(e){
6271 e.preventDefault(); 6272 6273 prepareBox(); 6274 6275 // "Prev / Next" buttons 6276 if (type == "gallery") 6277 nextPrev($elt, relSettings[0]); 6278 6279 // Loading anim 6280 initLoading(function(){ 6281 6282 // Dimensions 6283 var dims = false, 6284 6285 // Image 6286 $curImg; 6287 6288 if (dimensions) { 6289 dims = dimensions.split("x"); 6290 } 6291 6292 // Image 6293 $curImg = $('<img src="'+ $elt.attr("href") +'" title="'+ ($elt.attr("title") || $elt.text()) +'" />'); 6294 6295 //TITLE 6296 $titleTxt.html(($elt.attr("title") || $elt.text())); 6297 6298 // On image load 6299 $curImg.load(function(){ 6300 6301 // Resize 6302 resizeImageBox($curImg, dims); 6303 6304 // Id and Classes 6305 setBoxAttrs({boxClasses: "image " + curSettings.boxClasses, boxId: curSettings.boxId}); 6306 6307 // Show box 6308 showBox(); 6309 6310 }).appendTo($innerbox); 6311 6312 }); 6313 6314 }); 6315 }, 6316 6317 // Gallery 6318 gallery: function($elt, curSettings){ 6319 6320 // Extra settings 6321 var extraSettings = getRelSettings($elt.get(0)); 6322 6323 // Create group 6324 if(!galleryGroups[extraSettings[0]]) { 6325 galleryGroups[extraSettings[0]] = []; 6326 } 6327 6328 // Add element to current group 6329 galleryGroups[extraSettings[0]].push($elt); 6330 6331 $elt.get(0)._superboxGroupKey = (galleryGroups[extraSettings[0]].length - 1); 6332 6333 // Image Box 6334 $.superbox["image"]($elt, curSettings, "gallery"); 6335 }, 6336 6337 // iframe 6338 iframe: function($elt, curSettings){ 6339 6340 // Extra settings 6341 var extraSettings = getRelSettings($elt.get(0)); 6342 6343 // On click event 6344 $elt.click(function(e){ 6345 e.preventDefault(); 6346 6347 prepareBox(); 6348 6349 // Loading anim 6350 initLoading(function(){ 6351 6352 // Dimensions 6353 var dims = false, 6354 6355 // iframe 6356 $iframe; 6357 6358 if (extraSettings) { 6359 dims = extraSettings[0].split("x"); 6360 } 6361 6362 curSettings = $.extend({}, curSettings, { 6363 boxWidth: dims[0] || curSettings.boxWidth, 6364 boxHeight: dims[1] || curSettings.boxHeight 6365 }); 6366 6367 // iframe 6368 $iframe = $('<iframe src="'+ $elt.attr("href") +'" name="'+ $elt.attr("href") +'" frameborder="0" scrolling="auto" hspace="0" width="'+ curSettings.boxWidth +'" height="'+ curSettings.boxHeight +'"></iframe>'); 6369 6370 // On iframe load 6371 $iframe.load(function(){ 6372 6373 // Specified dimensions 6374 $superbox.width( curSettings.boxWidth+"px" ); 6375 $innerbox.height( curSettings.boxHeight+"px" ); 6376 6377 // Id and Classes 6378 setBoxAttrs({boxClasses: "iframe " + curSettings.boxClasses, boxId: curSettings.boxId}); 6379 6380 // Show box 6381 showBox(); 6382 6383 }).appendTo($innerbox); 6384 }); 6385 6386 }); 6387 }, 6388 6389 // Content 6390 content: function($elt, curSettings){ 6391 // Extra settings 6392 var extraSettings = getRelSettings($elt.get(0)); 6393 6394 // On click event 6395 $elt.click(function(e){ 6396 e.preventDefault(); 6397 6398 prepareBox(); 6399 6400 // Loading anim 6401 initLoading(function(){ 6402 6403 // Dimensions 6404 var dims = false; 6405 if (extraSettings) 6406 dims = extraSettings[0].split("x"); 6407 6408 curSettings = $.extend({}, curSettings, { 6409 boxWidth: dims[0] || curSettings.boxWidth, 6410 boxHeight: dims[1] || curSettings.boxHeight 6411 }); 6412 6413 // Specified dimensions 6414 $superbox.width( curSettings.boxWidth+"px" ); 6415 $innerbox.height( curSettings.boxHeight+"px" ); 6416 6417 $($elt.attr('href')).clone().appendTo($innerbox).show(); 6418 6419 // Id and Classes 6420 setBoxAttrs({boxClasses: "content " + curSettings.boxClasses, boxId: curSettings.boxI
6420d}); 6421 6422 // Show box 6423 showBox(); 6424 }); 6425 6426 }); 6427 }, 6428 6429 // Ajax 6430 ajax: function($elt, curSettings){ 6431 6432 // Extra settings 6433 var extraSettings = getRelSettings($elt.get(0)); 6434 6435 // On click event 6436 $elt.click(function(e){ 6437 e.preventDefault(); 6438 6439 prepareBox(); 6440 6441 // Loading anim 6442 initLoading(function(){ 6443 6444 // Dimensions 6445 var dims = false; 6446 if (extraSettings && extraSettings[3]) { 6447 dims = extraSettings[3].split("x"); 6448 } 6449 6450 // Extend default dimension settings 6451 curSettings = $.extend({}, curSettings, { 6452 boxWidth: dims[0] || curSettings.boxWidth, 6453 boxHeight: dims[1] || curSettings.boxHeight 6454 }); 6455 6456 // Specified dimensions 6457 $superbox.width( curSettings.boxWidth+"px" ); 6458 $innerbox.height( curSettings.boxHeight+"px" ); 6459 6460 $.get( extraSettings[2], function(data){ 6461 $(data).appendTo($innerbox); 6462 }); 6463 6464 // Id and Classes 6465 setBoxAttrs({boxClasses: "ajax " + curSettings.boxClasses, boxId: curSettings.boxId}); 6466 6467 // Show box 6468 showBox(); 6469 }); 6470 }); 6471 } 6472 }); 6473 6474 6475 // Get extra settings in rel attribute 6476 function getRelSettings(elt){ 6477 return elt._relSettings.match(/([^\[\]]+)/g); 6478 }; 6479 6480 // Set image box dimensions 6481 function resizeImageBox($curImg, dims){ 6482 6483 // Auto 6484 $superbox.width($curImg.width() + ($innerbox.css("paddingLeft").slice(0,-2)-0) + ($innerbox.css("paddingRight").slice(0,-2)-0)); // Padding ajoute, pour corriger le probleme de definition padding sur $innerbox 6485 $innerbox.height($curImg.height()); 6486 6487 // Specified 6488 if (dims && dims[0] != "") { 6489 $superbox.width(dims[0] + "px"); 6490 } 6491 if (dims && dims[1] != "" && dims[1] > $curImg.height()) { 6492 $innerbox.height(dims[1] + "px"); 6493 } 6494 }; 6495 6496 // Next / Previous 6497 function nextPrev($elt, group){ 6498 $nextprev.show(); 6499 6500 galleryMode = true; 6501 6502 var nextKey = $elt.get(0)._superboxGroupKey + 1, 6503 prevKey = nextKey - 2; 6504 6505 // Next 6506 if (galleryGroups[group][nextKey]){ 6507 $nextBtn.removeClass("disabled").unbind("click").bind("click", function(){ 6508 galleryGroups[group][nextKey].click(); 6509 }); 6510 } 6511 else 6512 $nextBtn.addClass("disabled").unbind("click"); 6513 6514 // Prev 6515 if (galleryGroups[group][prevKey]){ 6516 $prevBtn.removeClass("disabled").unbind("click").bind("click", function(){ 6517 galleryGroups[group][prevKey].click(); 6518 }); 6519 } 6520 else 6521 $prevBtn.addClass("disabled").unbind("click"); 6522 }; 6523 6524 // Set ID and Class 6525 function setBoxAttrs(attrs){ 6526 $superbox.attr("id", attrs.boxId).attr("class", attrs.boxClasses); 6527 }; 6528 6529 // Hide Box 6530 function hideBox(){ 6531 $(document).unbind("keydown"); 6532 $loading.hide(); 6533 $nextprev.hide(); 6534 $wrapper.hide().css({position: "fixed", top: 0}); 6535 $innerbox.empty(); 6536 }; 6537 6538 // Hide Box + Overlay 6539 function hideAll(callback){ 6540 hideBox(); 6541 $overlay.fadeOut(300, function(){ 6542 // Show hidden elements for IE6 6543 hideElts.show(); 6544 }); 6545 galleryMode = false; 6546 }; 6547 6548 // "Loading..." 6549 function initLoading(callback){ 6550 6551 var loading = function(){ 6552 6553 // IE6 6554 if(currentBrowser.ltIE6){ 6555 $wrapper.css({position: "absolute", top:"50%"}); 6556 } 6557 6558 // Hide elements for IE6 6559 hideElts.hide(); 6560 6561 $loading.show(); 6562 callback(); 6563 }; 6564 6565 if (galleryMode){ 6566 $overlay.css("opacity", settings.overlayOpacity).show(); 6567 loading(); 6568 } 6569 else { 6570 $overlay.css("opacity", 0).show().fadeTo(300, settings.overlayOpacity, loading); 6571 } 6572 }; 6573 6574 // "Prepare" box : Show $superbox with top:-99999px; 6575 function prepareBox(){ 6576 $wrapper.show(); 6577 $innerbox.empty(); 6578 $superbox.css({position: "absolute", top: "-99999px"}); 6579 }; 6580 6581 // Display box 6582 function showBox(curSettings, $elt){ 6583 // Stop "Loading..." 6584 $loading.hide(); 6585 6586 // Keys shortcuts
6587 $(document).unbind("keydown").bind("keydown",function(e){ 6588 // Escape 6589 if (e.keyCode == 27) 6590 hideAll(); 6591 // Left/right arrows 6592 if (e.keyCode == 39 && $nextBtn.is(":visible")) 6593 $nextBtn.click(); 6594 if (e.keyCode == 37 && $prevBtn.is(":visible")) 6595 $prevBtn.click(); 6596 }); 6597 6598 // Show $superbox 6599 $superbox.css({position: "static", top: 0, opacity: 0}); 6600 6601 // IE6 and IE7 6602 if (currentBrowser.ltIE7){ 6603 $superbox.css({position: "relative", top:"-50%"}); 6604 // IE6 6605 if (currentBrowser.ltIE6) 6606 $wrapper.css({position: "absolute", top:"50%"}); 6607 } 6608 6609 // Position absolute if image height > window height 6610 if ( $(window).height() < $wrapper.height() ){ 6611 $wrapper.css({position: "absolute", top: ($wrapper.offset().top + 10) + "px"}); 6612 } 6613 6614 settings.beforeShow(); 6615 6616 $superbox.fadeTo(300,1); 6617 6618 }; 6619 6620 // Create base elements (overlay, wrapper, box, loading) 6621 function createElements(){ 6622 if (!$.superbox.elementsReady){ 6623 6624 6625 // Overlay (background) 6626 $overlay = $('<div id="superbox-overlay"></div>').appendTo("body").hide(); 6627 6628 // Wrapper 6629 $wrapper = $('<div id="superbox-wrapper"></div>').appendTo("body").hide(); 6630 6631 // Box container
6632 $container = $('<div id="superbox-container"></div>').appendTo($wrapper); 6633 6634 // Box 6635 $superbox = $('<div id="superbox"></div>').appendTo($container); 6636 6637 // Inner box 6638 $innerbox = $('<div id="superbox-innerbox"></div>').appendTo($superbox); 6639 6640 // Title 6641 $titleTxt = $('<span id="titleTxt"></span>').appendTo($superbox); 6642 6643 // "Next / Previous" 6644 $nextprev = $('<p class="nextprev"></p>').appendTo($superbox).hide(); 6645 $prevBtn = $('<a class="prev"><strong><span>'+ settings.prevTxt +'</span></strong></a>').appendTo($nextprev); 6646 $nextBtn = $('<a class="next"><strong><span>'+ settings.nextTxt +'</span></strong></a>').appendTo($nextprev); 6647 6648 // Add close button 6649 $closeBtn = $('<p class="close"><a><strong><span>'+ settings.closeTxt +'</span></strong></a></p>').appendTo($superbox).find("a"); 6650 6651 // "Loading..." 6652 $loading = $('<p class="loading">'+ settings.loadTxt +'</p>').appendTo($container).hide(); 6653 6654 // Hide on click 6655 $overlay.add($wrapper).add($closeBtn).click(function(){ 6656 hideAll(); 6657 }); 6658 6659 // Remove "hide on click" on superbox 6660 $superbox.click(function(e){ 6661 e.stopPropagation(); 6662 }); 6663 6664 // Dont call this function twice 6665 $.superbox.elementsReady = true; 6666 } 6667 }; 6668 6669})(jQuery);//! æ¹è¡ 6670 6671/* 6672============================================================== 6673jquery.superbox.js END 6674============================================================== 6675*/ 6676 6677 6678 6679/* 6680============================================================== 6681jquery.cluetip.min.js START 6682============================================================== 6683*/ 6684 6685/* @license 6686 * jQuery clueTip plugin - v1.2.8 - 2013-02-20 6687 * Copyright (c) 2013 Karl Swedberg 6688 * Licensed MIT (http://www.opensource.org/licenses/mit-license.php) 6689 */ 6690(function(t){t.cluetip={version:"1.2.8",template:["<div>",'<div class="cluetip-outer">','<h3 class="cluetip-title ui-widget-header ui-cluetip-header"></h3>','<div class="cluetip-inner ui-widget-content ui-cluetip-content"></div>',"</div>",'<div class="cluetip-extra"></div>',"</div>"].join(""),setup:{insertionType:"appendTo",insertionElement:"body"},defaults:{multiple:!1,width:275,height:"auto",cluezIndex:97,positionBy:"auto",topOffset:15,leftOffset:15,snapToEdge:!1,local:!1,localPrefix:null,localIdSuffix:null,hideLocal:!0,attribute:"rel",titleAttribute:"title",splitTitle:"",escapeTitle:!1,showTitle:!0,cluetipClass:"default",hoverClass:"",waitImage:!0,cursor:"help",arrows:!1,dropShadow:!0,dropShadowSteps:6,sticky:!1,mouseOutClose:!1,delayedClose:50,activation:"hover",clickThrough:!0,tracking:!1,closePosition:"top",closeText:"Close",truncate:0,fx:{open:"show",openSpeed:""},hoverIntent:{sensitivity:3,interval:50,timeout:0},onActivate:function(){return!0},onShow:function(){},onHide:function(){},ajaxCache:!0,ajaxProcess:function(t){return t=t.replace(/<(script|style|title)[^<]+<\/(script|style|title)>/gm,"").replace(/<(link|meta)[^>]+>/g,"")},ajaxSettings:{dataType:"html"},debug:!1}};var e,i="cluetip ui-widget ui-widget-content ui-cluetip",o={},a=0,l=0;t.fn.attrProp=t.fn.prop||t.fn.attr,t.fn.cluetip=function(s,n){function c(e,i){var o=e||"";return i=i||"","object"==typeof i?t.each(i,function(t,e){o+="-"+t+"-"+e}):"string"==typeof i&&(o+=i),o}function u(e,i,o){var a="",l=i.dropShadow&&i.dropShadowSteps?+i.dropShadowSteps:0;if(t.support.boxShadow)return l&&(a="1px 1px "+l+"px rgba(0,0,0,0.5)"),e.css(t.support.boxShadow,a),!1;var s=e.find(".cluetip-drop-shadow");if(l==s.length)return s;s.remove();for(var n=[],c=0;l>c;)n[c++]='<div style="top:'+c+"px;left:"+c+'px;"></div>';return o=t(n.join("")).css({position:"absolute",backgroundColor:"#000",zIndex:g-1,opacity:.1}).addClass("cluetip-drop-shadow").prependTo(e)}var r,p,d,f,h,m;if("object"==typeof s&&(n=s,s=null),"destroy"==s){var v=this.data("cluetip");return v&&(t(v.selector).remove(),t.removeData(this,"title"),t.removeData(this,"cluetip"),t.removeData(this,"cluetipMoc")),t(document).unbind(".cluetip"),this.unbind(".cluetip")}n=t.extend(!0,{},t.cluetip.defaults,n||{}),a++;
6690var g,b=t.cluetip.backCompat||!n.multiple?"cluetip":"cluetip-"+a,x="#"+b,w=t.cluetip.backCompat?"#":".",y=t.cluetip.setup.insertionType,C=t.cluetip.setup.insertionElement||"body";y=/appendTo|prependTo|insertBefore|insertAfter/.test(y)?y:"appendTo",r=t(x),r.length||(r=t(t.cluetip.template)[y](C).attr("id",b).css({position:"absolute",display:"none"}),g=+n.cluezIndex,d=r.find(w+"cluetip-outer").css({position:"relative",zIndex:g}),p=r.find(w+"cluetip-inner"),f=r.find(w+"cluetip-title"),r.bind("mouseenter mouseleave",function(e){t(this).data("entered","mouseenter"===e.type)})),e=t("#cluetip-waitimage"),!e.length&&n.waitImage&&(e=t("<div></div>").attr("id","cluetip-waitimage").css({position:"absolute"}),e.insertBefore(r).hide());var S=(parseInt(r.css("paddingLeft"),10)||0)+(parseInt(r.css("paddingRight"),10)||0);return this.each(function(a){function v(){return!1}function b(t,e){var i=t.status;e.beforeSend(t.xhr,e),"error"==i?e[i](t.xhr,t.textStatus):"success"==i&&e[i](t.data,t.textStatus,t.xhr),e.complete(t.xhr,e.textStatus)}var y=this,C=t(this),I=t.extend(!0,{},n,t.metadata?C.metadata():t.meta?C.data():C.data("cluetip")||{}),T=!1,k=!1,j=null,z=I[I.attribute]||("href"==I.attribute?C.attr(I.attribute):C.attrProp(I.attribute)||C.attr(I.attribute)),B=I.cluetipClass;if(g=+I.cluezIndex,C.data("cluetip",{title:y.title,zIndex:g,selector:x}),I.arrows&&!r.find(".cluetip-arrows").length&&r.append('<div class="cluetip-arrows ui-state-default"></div>'),!z&&!I.splitTitle&&!s)return!0;I.local&&I.localPrefix&&(z=I.localPrefix+z),I.local&&I.hideLocal&&z&&t(z+":first").hide();var O,P,M,A,L,N,E,Y,D,H,X,R,W,$,q=parseInt(I.topOffset,10),Q=parseInt(I.leftOffset,10),U=isNaN(parseInt(I.height,10))?"auto":/\D/g.test(I.height)?I.height:I.height+"px",F=parseInt(I.width,10)||275,G=F+S+I.dropShadowSteps,J=this.offsetWidth,K="title"!=I.attribute?C.attr(I.titleAttribute)||"":"";I.splitTitle&&($=K.split(I.splitTitle),K=I.showTitle||""===$[0]?$.shift():""),I.escapeTitle&&(K=K.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<")),C.bind("mouseenter mouseleave",function(t){var e=C.data("cluetip");e.entered="entered"===t.type,C.data("cluetip",e)});var V=function(i){var u,m,v,g=I.onActivate.call(y,i);if(g===!1)return!1;if(k=!0,r=t(x).css({position:"absolute"}),d=r.find(w+"cluetip-outer"),p=r.find(w+"cluetip-inner"),f=r.find(w+"cluetip-title"),h=r.find(w+"cluetip-arrows"),r.removeClass().css({width:F}),z==C.attr("href")&&C.css("cursor",I.cursor),I.hoverClass&&C.addClass(I.hoverClass),A=N=C.offset().top,L=A+C.innerHeight(),H=C.offset().left,J=C.innerWidth(),i.type==focus?(R=H+J/2+Q,r.css({left:X}),Y=N+q):(R=i.pageX,Y=i.pageY),"area"!=y.tagName.toLowerCase()&&(M=t(document).scrollTop(),W=t(window).width()),"fixed"==I.positionBy?(X=J+H+Q,r.css({left:X})):(X=J>H&&H>G||H+J+G+Q>W?H-G-Q:J+H+Q,("area"==y.tagName.toLowerCase()||"mouse"==I.positionBy||J+G>W)&&(R+20+G>W?(r.addClass("cluetip-"+B),X=R-G-Q>=0?R-G-Q-parseInt(r.css("marginLeft"),10)+parseInt(p.css("marginRight"),10):R-G/2):X=R+Q),u=0>X?i.pageY+q:i.pageY,(0>X||"bottomTop"==I.positionBy||"topBottom"==I.positionBy)&&(X=R+G/2>W?W/2-G/2:Math.max(R-G/2,0))),h.css({zIndex:C.data("cluetip").zIndex+1}),r.css({left:X,zIndex:C.data("cluetip").zIndex}),P=t(window).height(),s)"function"==typeof s&&(s=s.call(y)),p.html(s),Z(u);else if($){var S=$.length;if(p.html(S?$[0]:""),S>1)for(var j=1;S>j;j++)p.append('<div class="split-body">'+$[j]+"</div>");Z(u)}else if(I.local||0===z.indexOf("#")){if(I.local){var O=t(z+(/^#\S+$/.test(z)?"":":eq("+a+")")).clone(!0).show();I.localIdSuffix&&O.attr("id",O[0].id+I.localIdSuffix),p.html(O),Z(u)}}else if(/\.(jpe?g|tiff?|gif|png)(?:\?.*)?$/i.test(z))p.html('<img src="'+z+'" alt="'+K+'" />'),Z(u);else{var E=I.ajaxSettings.beforeSend,D=I.ajaxSettings.error,U=I.ajaxSettings.success,V=I.ajaxSettings.complete;v=c(z,I.ajaxSettings.data);var _={cache:I.ajaxCache,url:z,beforeSend:function(t,i){E&&E.call(y,t,r,p,i),d.children().empty(),I.waitImage&&e.css({top:Y+20,left:R+20,zIndex:C.data("cluetip").zIndex-1}).show()},error:function(t,e){n.ajaxCache&&!o[v]&&(o[v]={status:"error",textStatus:e,xhr:t}),k&&(D?D.call(y,t,e,r,p):p.html("<i>sorry, the contents could not be loaded</i>"))}
6690,success:function(t,e,i){n.ajaxCache&&!o[v]&&(o[v]={status:"success",data:t,textStatus:e,xhr:i}),T=I.ajaxProcess.call(y,t),"object"==typeof T&&null!==T&&(K=T.title,T=T.content),k&&(U&&U.call(y,t,e,r,p),p.html(T))},complete:function(i,o){V&&V.call(y,i,o,r,p);var a=p[0].getElementsByTagName("img");l=a.length;for(var s=0,n=a.length;n>s;s++)a[s].complete&&l--;l?t(a).bind("load.ct error.ct",function(){l--,0===l&&(e.hide(),t(a).unbind(".ct"),k&&Z(u))}):(e.hide(),k&&Z(u))}};m=t.extend(!0,{},I.ajaxSettings,_),o[v]?b(o[v],m):t.ajax(m)}},Z=function(e){var o,a,l,s=K||I.showTitle&&" ",n="",c="",v=!1,g={bottom:function(t){t.appendTo(p)},top:function(t){t.prependTo(p)},title:function(t){t.prependTo(f)}};if(r.addClass("cluetip-"+B),I.truncate){var b=p.text().slice(0,I.truncate)+"...";p.html(b)}s?f.show().html(s):f.hide(),I.sticky&&(g[I.closePosition]&&(o=t('<div class="cluetip-close"><a href="#">'+I.closeText+"</a></div>"),g[I.closePosition](o),o.bind("click.cluetip",function(){return te(),!1})),I.mouseOutClose&&(C.unbind("mouseleave.cluetipMoc"),r.unbind("mouseleave.cluetipMoc"),("both"==I.mouseOutClose||"cluetip"==I.mouseOutClose||I.mouseOutClose===!0)&&r.bind("mouseleave.cluetipMoc",ee),("both"==I.mouseOutClose||"link"==I.mouseOutClose)&&C.bind("mouseleave.cluetipMoc",ee))),d.css({zIndex:C.data("cluetip").zIndex,overflow:"auto"==U?"visible":"auto",height:U}),O="auto"==U?Math.max(r.outerHeight(),r.height()):parseInt(U,10),E=N,D=M+P,v=R>X&&Math.max(X,0)+G>R,"fixed"==I.positionBy?E=N-I.dropShadowSteps+q:"topBottom"==I.positionBy||"bottomTop"==I.positionBy||v?("topBottom"==I.positionBy?c=D>N+O+q&&O+q>Y-M?"bottom":"top":("bottomTop"==I.positionBy||v)&&(c=N+O+q>D&&Y-M>O+q?"top":"bottom"),I.snapToEdge?"top"==c?E=A-O-q:"bottom"==c&&(E=L+q):"top"==c?E=Y-O-q:"bottom"==c&&(E=Y+q)):E=N+O+q>D?O>=P?M:D-O-q:"block"==C.css("display")||"area"==y.tagName.toLowerCase()||"mouse"==I.positionBy?e-q:N-I.dropShadowSteps,""===c&&(c=H>X?"left":"right"),a=" clue-"+c+"-"+B+" cluetip-"+B,"rounded"==B&&(a+=" ui-corner-all"),r.css({top:E+"px"}).attrProp({className:i+a}),I.arrows?(/(left|right)/.test(c)&&(l=r.height()-h.height(),n=X>=0&&e>0?N-E-I.dropShadowSteps:0,n=l>n?n:l,n+="px"),h.css({top:n}).show()):h.hide(),m=u(r,I),m&&m.length&&m.hide().css({height:O,width:F,zIndex:C.data("cluetip").zIndex-1}).show(),j||r.hide(),clearTimeout(j),j=null,r[I.fx.open](I.fx.openSpeed||0),t.fn.bgiframe&&r.bgiframe(),I.onShow.call(y,r,p)},_=function(){k=!1,e.hide(),(!I.sticky||/click|toggle/.test(I.activation))&&I.delayedClose>0&&(clearTimeout(j),j=null,j=setTimeout(te,I.delayedClose)),I.hoverClass&&C.removeClass(I.hoverClass)},te=function(e){var i=e&&e.data("cluetip")?e:C,o=i.data("cluetip")&&i.data("cluetip").selector,a=o||"div.cluetip",l=t(a),s=l.find(w+"cluetip-inner"),n=l.find(w+"cluetip-arrows");l.hide().removeClass(),I.onHide.call(i[0],l,s),o&&(i.removeClass("cluetip-clicked"),i.css("cursor","")),o&&K&&i.attrProp(I.titleAttribute,K),I.arrows&&n.css({top:""})},ee=function(){var t=this;clearTimeout(j),j=setTimeout(function(){var e=C.data("cluetip").entered,i=r.data("entered"),o=!1;"both"==I.mouseOutClose&&(e||i)?o=!0:I.mouseOutClose!==!0&&"cluetip"!=I.mouseOutClose||!i?"link"==I.mouseOutClose&&e&&(o=!0):o=!0,o||te.call(t)},I.delayedClose)};if(t(document).unbind("hideCluetip.cluetip").bind("hideCluetip.cluetip",function(e){te(t(e.target))}),/click|toggle/.test(I.activation))C.bind("click.cluetip",function(e){return r.is(":hidden")||!C.is(".cluetip-clicked")?(V(e),t(".cluetip-clicked").removeClass("cluetip-clicked"),C.addClass("cluetip-clicked")):_(e),!1});else if("focus"==I.activation)C.bind("focus.cluetip",function(t){C.attrProp("title",""),V(t)}),C.bind("blur.cluetip",function(t){C.attrProp("title",C.data("cluetip").title),_(t)});else{C[I.clickThrough?"unbind":"bind"]("click.cluetip",v);var ie=function(t){if(I.tracking){var e=X-t.pageX,i=E?E-t.pageY:N-t.pageY;C.bind("mousemove.cluetip",function(t){r.css({left:t.pageX+e,top:t.pageY+i})})}};t.fn.hoverIntent&&I.hoverIntent?C.hoverIntent({sensitivity:I.hoverIntent.sensitivity,interval:I.hoverIntent.interval,over:function(t){V(t),ie(t)},timeout:I.hoverIntent.timeout,out:function(t){_(t),C.unbind("mousemove.cluetip")}}):C.bind("mouseenter.cluetip",function(t){V(t),ie(t)}).bind("mouseleave.cluetip",function(t){_(t),C.unbind("mousemove.cluetip")}),C.bind("mouseover.cluetip",function(){C.attrProp("title","")}).bind("mouseleave.cluetip",function(){C.attrProp("title",C.data("cluetip").title)})}}),this}
6690,function(){t.support=t.support||{};for(var e=document.createElement("div"),i=e.style,o=["boxShadow"],a=["moz","Moz","webkit","o"],l=0,s=o.length;s>l;l++){var n=o[l],c=n.charAt(0).toUpperCase()+n.slice(1);if(i[n]!==void 0)t.support[n]=n;else for(var u=0,r=a.length;r>u;u++)if(i[a[u]+c]!==void 0){t.support[n]=a[u]+c;break}}e=null}(),t.fn.cluetip.defaults=t.cluetip.defaults})(jQuery);//! æ¹è¡ 6691 6692/* 6693============================================================== 6694jquery.cluetip.min.js END 6695============================================================== 6696*/ 6697 6698 6699 6700/* 6701============================================================== 6702jquery.image-picker.min.js START 6703============================================================== 6704*/ 6705 6706/* @license 6707 * Image Picker 6708 * by Rodrigo Vera 6709 * 6710 * Version 0.2.4 6711 * Full source at https://github.com/rvera/image-picker 6712 * MIT License, https://github.com/rvera/image-picker/blob/master/LICENSE 6713*/ 6714(function(){var t,e,i,s,l=function(t,e){return function(){return t.apply(e,arguments)}},n=[].indexOf||function(t){for(var e=0,i=this.length;i>e;e++)if(e in this&&this[e]===t)return e;return-1};jQuery.fn.extend({imagepicker:function(e){return null==e&&(e={}),this.each(function(){var i;return i=jQuery(this),i.data("picker")&&i.data("picker").destroy(),i.data("picker",new t(this,s(e))),null!=e.initialized?e.initialized.call(i.data("picker")):void 0})}}),s=function(t){var e;return e={hide_select:!0,show_label:!1,initialized:void 0,changed:void 0,clicked:void 0,selected:void 0,limit:void 0,limit_reached:void 0},jQuery.extend(e,t)},i=function(t,e){return 0===jQuery(t).not(e).length&&0===jQuery(e).not(t).length},t=function(){function t(t,e){this.opts=null!=e?e:{},this.sync_picker_with_select=l(this.sync_picker_with_select,this),this.select=jQuery(t),this.multiple="multiple"===this.select.attr("multiple"),null!=this.select.data("limit")&&(this.opts.limit=parseInt(this.select.data("limit"))),this.build_and_append_picker()}return t.prototype.destroy=function(){var t,e,i,s;for(s=this.picker_options,e=0,i=s.length;i>e;e++)t=s[e],t.destroy();return this.picker.remove(),this.select.unbind("change"),this.select.removeData("picker"),this.select.show()},t.prototype.build_and_append_picker=function(){var t=this;return this.opts.hide_select&&this.select.hide(),this.select.change(function(){return t.sync_picker_with_select()}),null!=this.picker&&this.picker.remove(),this.create_picker(),this.select.after(this.picker),this.sync_picker_with_select()},t.prototype.sync_picker_with_select=function(){var t,e,i,s,l;for(s=this.picker_options,l=[],e=0,i=s.length;i>e;e++)t=s[e],t.is_selected()?l.push(t.mark_as_selected()):l.push(t.unmark_as_selected());return l},t.prototype.create_picker=function(){return this.picker=jQuery("<ul class='thumbnails image_picker_selector'></ul>"),this.picker_options=[],this.recursively_parse_option_groups(this.select,this.picker),this.picker},t.prototype.recursively_parse_option_groups=function(t,i){var s,l,n,r,c,o,h,a,p,u;for(a=t.children("optgroup"),r=0,o=a.length;o>r;r++)n=a[r],n=jQuery(n),s=jQuery("<ul></ul>"),s.append(jQuery("<li class='group_title'>"+n.attr("label")+"</li>")),i.append(jQuery("<li>").append(s)),this.recursively_parse_option_groups(n,s);for(p=function(){var i,s,n,r;for(n=t.children("option"),r=[],i=0,s=n.length;s>i;i++)l=n[i],r.push(new e(l,this,this.opts));return r}.call(this),u=[],c=0,h=p.length;h>c;c++)l=p[c],this.picker_options.push(l),l.has_image()&&u.push(i.append(l.node));return u},t.prototype.has_implicit_blanks=function(){var t;return function(){var e,i,s,l;for(s=this.picker_options,l=[],e=0,i=s.length;i>e;e++)t=s[e],t.is_blank()&&!t.has_image()&&l.push(t);return l}.call(this).length>0},t.prototype.selected_values=function(){return this.multiple?this.select.val()||[]:[this.select.val()]},t.prototype.toggle=function(t){var e,s,l;return s=this.selected_values(),l=""+t.value(),this.multiple?n.call(this.selected_values(),l)>=0?(e=this.selected_values(),e.splice(jQuery.inArray(l,s),1),this.select.val([]),this.select.val(e)):null!=this.opts.limit&&this.selected_values().length>=this.opts.limit?null!=this.opts.limit_reached&&this.opts.limit_reached.
6714call(this.select):this.select.val(this.selected_values().concat(l)):this.has_implicit_blanks()&&t.is_selected()?this.select.val(""):this.select.val(l),i(s,this.selected_values())||(this.select.change(),null==this.opts.changed)?void 0:this.opts.changed.call(this.select,s,this.selected_values())},t}(),e=function(){function t(t,e,i){this.picker=e,this.opts=null!=i?i:{},this.clicked=l(this.clicked,this),this.option=jQuery(t),this.create_node()}return t.prototype.destroy=function(){return this.node.find(".thumbnail").unbind()},t.prototype.has_image=function(){return null!=this.option.data("img-src")},t.prototype.is_blank=function(){return!(null!=this.value()&&""!==this.value())},t.prototype.is_selected=function(){var t;return t=this.picker.select.val(),this.picker.multiple?jQuery.inArray(this.value(),t)>=0:this.value()===t},t.prototype.mark_as_selected=function(){return this.node.find(".thumbnail").addClass("selected")},t.prototype.unmark_as_selected=function(){return this.node.find(".thumbnail").removeClass("selected")},t.prototype.value=function(){return this.option.val()},t.prototype.label=function(){return this.option.data("img-label")?this.option.data("img-label"):this.option.text()},t.prototype.clicked=function(){return this.picker.toggle(this),null!=this.opts.clicked&&this.opts.clicked.call(this.picker.select,this),null!=this.opts.selected&&this.is_selected()?this.opts.selected.call(this.picker.select,this):void 0},t.prototype.create_node=function(){var t,e;return this.node=jQuery("<li/>"),t=jQuery("<img class='image_picker_image'/>"),t.attr("src",this.option.data("img-src")),e=jQuery("<div class='thumbnail'>"),e.click({option:this},function(t){return t.data.option.clicked()}),e.append(t),this.opts.show_label&&e.append(jQuery("<p/>").html(this.label())),this.node.append(e),this.node},t}()}).call(this);//! æ¹è¡ 6715 6716/* 6717============================================================== 6718jquery.image-picker.min.js END 6719============================================================== 6720*/ 6721 6722 6723 6724/* 6725============================================================== 6726jquery.hoverIntent.js START 6727============================================================== 6728*/ 6729 6730/* @license 6731 * hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+ 6732 * http://cherne.net/brian/resources/jquery.hoverIntent.html 6733 * 6734 * You may use hoverIntent under the terms of the MIT license. Basically that 6735 * means you are free to use hoverIntent as long as this header is left intact. 6736 * Copyright 2007, 2013 Brian Cherne 6737 */ 6738 6739/* hoverIntent is similar to jQuery's built-in "hover" method except that 6740 * instead of firing the handlerIn function immediately, hoverIntent checks 6741 * to see if the user's mouse has slowed down (beneath the sensitivity 6742 * threshold) before firing the event. The handlerOut function is only 6743 * called after a matching handlerIn. 6744 * 6745 * // basic usage ... just like .hover() 6746 * .hoverIntent( handlerIn, handlerOut ) 6747 * .hoverIntent( handlerInOut ) 6748 * 6749 * // basic usage ... with event delegation! 6750 * .hoverIntent( handlerIn, handlerOut, selector ) 6751 * .hoverIntent( handlerInOut, selector ) 6752 * 6753 * // using a basic configuration object 6754 * .hoverIntent( config ) 6755 * 6756 * @param handlerIn function OR configuration object 6757 * @param handlerOut function OR selector for delegation OR undefined 6758 * @param selector selector OR undefined 6759 * @author Brian Cherne <brian(at)cherne(dot)net> 6760 */ 6761(function($) { 6762 $.fn.hoverIntent = function(handlerIn,handlerOut,selector) { 6763 6764 // default configuration values 6765 var cfg = { 6766 interval: 100, 6767 sensitivity: 7, 6768 timeout: 0 6769 }; 6770 6771 if ( typeof handlerIn === "object" ) { 6772 cfg = $.extend(cfg, handlerIn ); 6773 } else if ($.isFunction(handlerOut)) { 6774 cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector } ); 6775 } else { 6776 cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } ); 6777 } 6778 6779 // instantiate variables 6780 // cX, cY = current X and Y position of mouse, updated by mousemove event 6781 // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval 6782 var cX, cY, pX, pY; 6783 6784 // A private function for getting mouse position 6785 var track = function(ev) { 6786 cX = ev.pageX; 6787 cY = ev.pageY; 6788 }; 6789 6790 // A private function for comparing current and previous mouse position 6791 var compare = function(ev,ob) { 6792 ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); 6793 // compare mouse positions to see if they've crossed the threshold 6794 if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) { 6795 $(ob).off("mousemove.hoverIntent",track); 6796 // set hoverIntent state to true (so mouseOut can be called) 6797 ob.hoverIntent_s = 1; 6798 return cfg.over.apply(ob,[ev]); 6799 } else {
6800 // set previous coordinates for next time 6801 pX = cX; pY = cY; 6802 // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs) 6803 ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval ); 6804 } 6805 }; 6806 6807 // A private function for delaying the mouseOut function 6808 var delay = function(ev,ob) { 6809 ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); 6810 ob.hoverIntent_s = 0; 6811 return cfg.out.apply(ob,[ev]); 6812 }; 6813 6814 // A private function for handling mouse 'hovering' 6815 var handleHover = function(e) { 6816 // copy objects to be passed into t (required for event object to be passed in IE) 6817 var ev = jQuery.extend({},e); 6818 var ob = this; 6819 6820 // cancel hoverIntent timer if it exists 6821 if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); } 6822 6823 // if e.type == "mouseenter" 6824 if (e.type == "mouseenter") { 6825 // set "previous" X and Y position based on initial entry point 6826 pX = ev.pageX; pY = ev.pageY; 6827 // update "current" X and Y position based on mousemove 6828 $(ob).on("mousemove.hoverIntent",track); 6829 // start polling interval (self-calling timeout) to compare mouse coordinates over time 6830 if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );} 6831 6832 // else e.type == "mouseleave" 6833 } else { 6834 // unbind expensive mousemove event 6835 $(ob).off("mousemove.hoverIntent",track); 6836 // if hoverIntent state is true, then call the mouseOut function after the specified delay 6837 if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );} 6838 } 6839 }; 6840 6841 // listen for mouseenter and mouseleave 6842 return this.on({'mouseenter.hoverIntent':handleHover,'mouseleave.hoverIntent':handleHover}, cfg.selector); 6843 }; 6844})(jQuery);//! æ¹è¡ 6845 6846/* 6847============================================================== 6848jquery.hoverIntent.js END 6849============================================================== 6850*/ 6851 6852 6853 6854/* 6855============================================================== 6856jquery.sticky.js START 6857============================================================== 6858*/ 6859 6860/* @license 6861 * Sticky 6862 * 6863 * Keep interface elements fixed in place as the user scrolls. 6864 * 6865 * Copyright (c) 2013 Kevin Thompson <http://kevinthompson.info> 6866 * Dual licensed under the MIT and GPL licenses: 6867 * http://www.opensource.org/licenses/mit-license.php 6868 * http://www.gnu.org/licenses/gpl.html 6869 * 6870 * @author: Kevin Thompson <[email protected]> 6871 * @link: https://github.com/kevinthompson/jquery.sticky.js 6872 * @version: 2.0.0 6873 **/ 6874 6875(function($) { 6876 $.fn.sticky = function(options) { 6877 6878 var settings = { 6879 6880 // Basic Settings 6881 'offset': 20, 6882 'mode': 'fixed', 6883 'stopper': '', 6884 'speed': 500, 6885 6886 // State Classes 6887 'classes': { 6888 'element': 'jquery-sticky-element', 6889 'start': 'jquery-sticky-start', 6890 'sticky': 'jquery-sticky-sticky', 6891 'stopped': 'jquery-sticky-stopped', 6892 'placeholder': 'jquery-sticky-placeholder' 6893 }, 6894 6895 // Events 6896 'onStick': '', // When the element becomes sticky 6897 'onStart': '', // When the element returns to the start 6898 'onStop': '' // When the element hits a stopper 6899 }; 6900 6901 this.each(function() { 6902 6903 if (options) $.extend(settings, options); 6904 if ($(this).parent().hasClass(settings.classes.element)) return; 6905 6906 var sticky = { 6907 6908 'init': function($this) { 6909 6910 // Define Sticky Element and Units (Force Animate Mode in Internet Explorer) 6911 sticky.element = $this.wrap('<div class="' + settings.classes.element + '" />').parent(); 6912 sticky.units = { 6913 'start': sticky.element.offset().top 6914 }; 6915 settings.states = [ 6916 settings.classes.start, 6917 settings.classes.sticky, 6918 settings.classes.stopped 6919 ].join(' '); 6920 6921 // Find Stopper 6922 if (settings.stopper != '') { 6923 var stoppers = $(settings.stopper), 6924 margin; 6925 if (stoppers.length > 0) { 6926 for (i = 0; i < stoppers.length && typeof(sticky.stopper) == 'undefined'; i++) { 6927 if ($(stoppers[i]).offset().top > sticky.element.offset().top + sticky.element.outerHeight(false)) { 6928 sticky.stopper = $(stoppers[i]); 6929 } 6930 } 6931 } 6932 6933 // Update Stop Position 6934 if (typeof(sticky.stopper) != 'undefined' && sticky.stopper.length > 0) { 6935 margin = parseInt(sticky.stopper.css('margin-top')) || 0; 6936 sticky.units.stop = sticky.stopper.offset().top - margin; 6937 } 6938 } 6939 6940 // Create Placeholder 6941 sticky.placeholder = sticky.element.clone().empty().attr('class', settings.classes.placeholder).css({ 6942 'opacity': 0, 6943 'height': sticky.element.height() 6944 }).insertBefore(sticky.element); 6945 6946 // Move Sticky Element 6947 sticky.element.appendTo('body').css({ 6948 'width': sticky.placeholder.width(), 6949 'left': sticky.placeholder.offset().left, 6950 'top': sticky.placeholder.offset().top, 6951 'margin-bottom': '0px', 6952 'position': 'absolute', 6953 'z-index': '999' 6954 }); 6955 6956 // Bind Events 6957 $(window).bind('resize scroll', function() { 6958 sticky.update(); 6959 }); 6960 sticky.update(); 6961 }, 6962 6963 'update': function() { 6964 6965 var margin; 6966 6967 // Update Sticky Element CSS 6968 sticky.element.css({ 6969 'width': sticky.placeholder.width(), 6970 'left': sticky.placeholder.offset().left 6971 }); 6972// sticky.placeholder.css('height', sticky.element.height()); 6973 sticky.units.start = sticky.placeholder.offset().top; 6974 6975 if ((sticky.element.outerHeight(false) + settings.offset) < $(window).height()) { 6976 6977 // Get Window Top 6978 sticky.units.doctop = $(document).scrollTop(); 6979 6980 // Update Animated Position 6981 if (sticky.element.hasClass(settings.classes.sticky) && settings.mode == 'animate') { 6982 sticky.animate(sticky.units.doctop + settings.offset); 6983 } 6984 6985 // Update Stop Position 6986 if (typeof(sticky.stopper) != 'undefined' && sticky.stopper.length > 0) { 6987 margin = parseInt(sticky.stopper.css('margin-top')) || 0; 6988 sticky.units.stop = sticky.stopper.offset().top - margin; 6989 } 6990 6991 // Stop at Stopper 6992 if (!sticky.element.hasClass(settings.classes.stopped) && typeof(sticky.stopper) != 'undefined' && sticky.stopper.length > 0 && (sticky.units.doctop + settings.offset + sticky.element.outerHeight(false)) >= sticky.units.stop) { 6993 // Stop 6994 sticky.stop(sticky.units.stop - sticky.element.outerHeight(false), 'stop'); 6995 6996 // Trigger `onStop` Callback 6997 if (typeof settings.onStop == 'function') settings.onStop(); 6998 } 6999 7000 // Update Position 7001 else if (!sticky.element.hasClass(settings.classes.sticky) && sticky.units.doctop > (sticky.units.start - settings.offset) && (typeof(sticky.stopper) == 'undefined' || sticky.stopper.length == 0 || (sticky.stopper.length > 0 && (sticky.units.doctop + settings.offset + sticky.element.outerHeight(false)) < sticky.units.stop))) { 7002 7003 // Stick or Animate 7004 sticky.stick(settings.offset); 7005 if (settings.mode == 'animate') sticky.animate(sticky.units.doctop + settings.offset); 7006 7007 // Trigger `onStick` Callback 7008 if (typeof settings.onStick == 'function') settings.onStick(); 7009 7010 // Stop at starting position 7011 } else if (sticky.units.doctop <= (sticky.units.start - settings.offset)) { 7012 sticky.stop(sticky.units.start, 'start'); 7013 7014 // Trigger `onStart` Callback 7015 if (typeof settings.onStart == 'function') settings.onStart(); 7016 } 7017 7018 // Reset to Start 7019 } else if (!sticky.element.hasClass(settings.classes.start)) { 7020 sticky.stop(sticky.units.start, 'start'); 7021 } 7022 }, 7023 7024 'animate': function(top) { 7025 clearTimeout(sticky.timer); 7026 sticky.timer = setTimeout(function() { 7027 if (top >= sticky.units.stop) { 7028 top = sticky.units.stop - sticky.element.outerHeight(false); 7029 } else if (top <= sticky.units.start) { 7030 top = sticky.units.start; 7031 } 7032 sticky.element.stop().animate({ 7033 'top': top 7034 }, settings.speed); 7035 }, 100); 7036 }, 7037 7038 'stick': function(top) { 7039 sticky.element.removeClass(settings.states).addClass(settings.classes.sticky); 7040 7041 if (settings.mode == 'fixed') { 7042 sticky.element.css({ 7043 'top': top, 7044 'position': 'fixed' 7045 }); 7046 } 7047 }, 7048 7049 'stop': function(top, location) { 7050 sticky.element.removeClass(settings.states).addClass(location == 'start' ? settings.classes.start : settings.classes.stopped); 7051 7052 if (settings.mode == 'fixed') { 7053 sticky.element.css({ 7054 'top': top, 7055 'position': 'absolute' 7056 }); 7057 } else { 7058 sticky.animate(location == 'start' ? sticky.units.start : sticky.units.stop - sticky.element.outerHeight(false)); 7059 } 7060 } 7061 } 7062 7063 // Initialize Sticky Behavior 7064 sticky.init($(this)); 7065 });
7066 }; 7067})(jQuery);//! æ¹è¡ 7068 7069/* 7070============================================================== 7071jquery.sticky.js END 7072============================================================== 7073*/ 7074 7075 7076 7077/* 7078============================================================== 7079jquery.tile.js START 7080============================================================== 7081*/ 7082 7083/* @license 7084 * Flatten height same as the highest element for each row. 7085 * 7086 * Copyright (c) 2011 Hayato Takenaka 7087 * Dual licensed under the MIT and GPL licenses: 7088 * http://www.opensource.org/licenses/mit-license.php 7089 * http://www.gnu.org/licenses/gpl.html 7090 * @author: Hayato Takenaka (http://urin.take-uma.net) 7091 * @version: 0.0.2 7092**/ 7093(function($) { 7094 $.fn.tile = function(columns) { 7095 var tiles, max, c, h, last = this.length - 1, s; 7096 if(!columns) columns = this.length; 7097 this.each(function() { 7098 s = this.style; 7099 if(s.removeProperty) s.removeProperty("height"); 7100 if(s.removeAttribute) s.removeAttribute("height"); 7101 }); 7102 return this.each(function(i) { 7103 c = i % columns; 7104 if(c == 0) tiles = []; 7105 tiles[c] = $(this); 7106 h = tiles[c].height(); 7107 if(c == 0 || h > max) max = h; 7108 if(i == last || c == columns - 1) 7109 $.each(tiles, function() { this.height(max); }); 7110 }); 7111 }; 7112})(jQuery);//! æ¹è¡ 7113 7114 7115 7116/* 7117============================================================== 7118jquery.tile.js END 7119============================================================== 7120*/ 7121 7122 7123 7124/* 7125============================================================== 7126jquery.zen2han.js START 7127============================================================== 7128*/ 7129 7130/* @license 7131 * zen2han.js v0.1 7132 * info: http://company.miyanavi.net/archives/1315 7133 * auther: miyanavi 7134 * licence: MIT 7135 * 7136 */ 7137(function($){ 7138 //hanã颿°åã«ãªã(reserve.jsã§å®è¡) 7139 $.fn.han = function() { 7140 this.change(function() { 7141 setting = { 7142 'zenkigou' : "ï¼ ï¼ã¼ï¼ï¼¿ï¼ï¼ã", 7143 'hankigou' : "@--+_...", 7144 'data' : $(this).val(), 7145 'str' : "", 7146 }; 7147 // æå®ãããå ¨è§è¨å·ã®ã¿ãåè§ã«å¤æ 7148 for (i=0; i<setting.data.length; i++) 7149 { 7150 var dataChar = setting.data.charAt(i); 7151 var dataNum = setting.zenkigou.indexOf(dataChar,0); 7152 if (dataNum >= 0) dataChar = setting.hankigou.charAt(dataNum); 7153 setting.str += dataChar; 7154 } 7155 // å®çªã®ãã¢ã«ãã¡ãããã¨æ°åã®å¤æå¦ç 7156 var hankaku = setting.str.replace(/[A-Zï½-ï½ï¼-ï¼]/g,function(s){return String.fromCharCode(s.charCodeAt(0)-0xFEE0)}); 7157 $(this).val(hankaku); 7158 }); 7159 }; 7160})(jQuery);//! æ¹è¡ 7161 7162/* 7163============================================================== 7164jquery.zen2han.js END 7165============================================================== 7166*/ 7167 7168 7169 7170/* 7171============================================================== 7172jquery.listpaging.js START 7173============================================================== 7174*/ 7175 7176/* @license 7177 * "Large list auto paging" jQuery plugin 7178 * 7179 * @author RaNa design associates, inc. 7180 * @copyright 2011 RaNa design associates, inc. 7181 * @license http://www.opensource.org/licenses/mit-license.html MIT License 7182 * @version Release: 1.0 7183 * Created: 2010-07-16 21:44:58. 7184 * Modified: 2010-07-26 17:42:13 7185 */ 7186 7187(function($) { 7188// main jQuery function 7189$.fn.listPaging = function(opt) { 7190 return new listPaging(this, opt); 7191}; 7192 7193// constructor object 7194var listPaging = function(obj, opt) { 7195 var self = this; 7196 this.obj = obj; 7197 this.opt = opt; 7198 // Default options 7199 this.options = { 7200 listWidth: 160, 7201 listLength: 5, 7202 listItem: 'li', 7203 list: 'ul', 7204 listClass: '', 7205 prevText: '« Prev', 7206 nextText: 'Next »', 7207 listContainerClassName: 'listContainer', 7208 animation: 0, 7209 animationDuration: 200, 7210 animationEasing: 'swing', 7211 animationCallback: function () { 7212 self.$navOverlay.hide(); 7213 } 7214 }; 7215 this.init(); 7216 // for Method Chain 7217 return obj;
7218}; 7219listPaging.prototype = { 7220 init: function() { 7221 $.extend(this.options, this.opt); 7222 var options = this.options; 7223 // object properties 7224 this.crIndex = 0; 7225 this.contentArray = []; 7226 this.$content = this.obj.clone(); 7227 this.$li = this.$content.find('li'); 7228 this.liGroupLength = Math.ceil(this.$li.length / options.listLength); 7229 this.$container = $('<div class="' + options.listContainerClassName + '"></div>') 7230 .addClass(this.obj[0].className) 7231 .css({ width: options.listWidth }); 7232 this.$containerInner = $('<div class="' + options.listContainerClassName + '"></div>'); 7233 this.$prevLink = $('<span class="prev"><a href="#">' + options.prevText + '</a></span>'); 7234 this.$nextLink = $('<span class="next"><a href="#">' + options.nextText + '</a></span>'); 7235 this.$navOverlay = $('<div class="navOverlay"></div>'); 7236 // method execution 7237 this.makeGroupList(); 7238 this.createNav(); 7239 this.setupNav(); 7240 // reflow processing 7241 this.$container.insertBefore(this.obj); 7242 this.obj.remove(); 7243 }, 7244 makeGroupList: function() { 7245 var options = this.options, 7246 contentArray = this.contentArray, 7247 $containerInner = this.$containerInner; 7248 for (var i=0; i<this.liGroupLength; i++) { 7249 contentArray[i] = $('<' + options.list + ' class="'+options.listClass+'" ></' + options.list + '>'); 7250 contentArray[i].css({ width: options.listWidth }); 7251 makeList(contentArray[i], this.$li, i); 7252 } 7253 $.each(contentArray, function(i) { 7254 $containerInner.append(contentArray[i]); 7255 }); 7256 this.$container.append($containerInner); 7257 7258 function makeList($wrapper, $content, index) { 7259 var listLen = options.listLength; 7260 for (var i=index*listLen; i<((index+1)*listLen); i++) { 7261 if ($content[i]) { 7262 $wrapper.append($content[i]); 7263 } 7264 } 7265 } 7266 }, 7267 setupList: function() { 7268 var options = this.options, 7269 crIndex = this.crIndex, 7270 contentArray = this.contentArray; 7271 if (options.animation === 1) { 7272 this.$containerInner.animate({ 7273 marginLeft: -1 * options.listWidth * crIndex 7274 }, 7275 options.animationDuration, 7276 options.animationEasing, 7277 options.animationCallback); 7278 } else { 7279 for (var i=0, l=contentArray.length; i<l; i++) { 7280 if (i === crIndex) { 7281 contentArray[i].show(); 7282 } else { 7283 contentArray[i].hide(); 7284 } 7285 } 7286 } 7287 }, 7288 setupNav: function() { 7289 var contentArray = this.contentArray, 7290 crIndex = this.crIndex, 7291 $prevLink = this.$prevLink, 7292 $nextLink = this.$nextLink; 7293 if (contentArray.length === 1) { 7294 $prevLink.hide(); 7295 $nextLink.hide(); 7296 } else { 7297 if (crIndex === 0) { 7298 $prevLink.hide(); 7299 $nextLink.show(); 7300 } else if (crIndex === contentArray.length - 1) { 7301 $prevLink.show(); 7302 $nextLink.hide(); 7303 } else { 7304 $prevLink.show(); 7305 $nextLink.show(); 7306 } 7307 } 7308 }, 7309 createNav: function() { 7310 var self = this, 7311 options = this.options; 7312 this.$prevLink.find('a').click(function(e) { 7313 e.preventDefault(); 7314 self.changeContent('prev'); 7315 }); 7316 this.$nextLink.find('a').click(function(e) { 7317 e.preventDefault(); 7318 self.changeContent('next'); 7319 }); 7320 7321 var $navContainer = $('<p class="nav"></p>') 7322 .append(this.$prevLink) 7323 .append(this.$nextLink); 7324 this.$container.append($navContainer).append(this.$navOverlay); 7325 }, 7326 changeContent: function(direction) { 7327 if (this.options.animation === 1) { 7328 this.$containerInner.queue([]); 7329 this.$navOverlay.show(); 7330 } 7331 switch (direction) { 7332 case 'next': this.crIndex ++; break; 7333 case 'prev': this.crIndex --; break; 7334 } 7335 this.setupList(); 7336 this.setupNav(); 7337 } 7338 7339}; 7340 7341})(jQuery); 7342 7343/* 7344============================================================== 7345jquery.listpaging.js END 7346============================================================== 7347*/ 7348 7349 7350 7351/* 7352============================================================== 7353jquery.banner.switcher.js @Go-Next START 7354============================================================== 7355*/ 7356(function($){ 7357 7358 var defaults = { 7359 banners: ".bannerList", 7360 periods: ".periodList", 7361 prevBtn: ".prevBtn", 7362 nextBtn: ".nextBtn", 7363 lamps: ".lampList", 7364 currentClass: "current", 7365 fadeSpd: 600, 7366 interval: 3500 7367 }, 7368 $win = $(window), 7369 7370 currentBrowser = (function(){ 7371 return { 7372 ltIE6: typeof window.addEventListener == "undefined" && typeof document.documentElement.style.maxHeight == "undefined", 7373 ltIE7: typeof window.addEventListener == "undefined" && typeof document.querySelectorAll == "undefined", 7374 ltIE8: typeof window.addEventListener == "undefined" && typeof document.getElementsByClassName == "undefined", 7375 IE: document.uniqueID 7376 } 7377 })(); 7378 7379 $.fn.switcher = function(_option){ 7380 var option = $.extend({}, defaults, _option); 7381 7382 return this.each(function(){ 7383 init($(this), option); 7384 }); 7385 }; 7386 7387 function init($this, option){ 7388 var $banners = $(option.banners), $banner = $banners.children(), 7389 $periods = $(option.periods), $period = $periods.children(), 7390 $lamps = $(option.lamps), length = $banner.length; 7391 7392 $banner.first().nextAll().hide(); 7393 $period.first().nextAll().hide(); 7394 7395 var lampsHtml = ""; 7396 for(var i = 0; i < length; i++){ 7397 lampsHtml += $lamps.html(); 7398 } 7399 $lamps.html(lampsHtml); 7400
7401 var $lamp = $lamps.children(); 7402 $lamp.first().addClass(option.currentClass); 7403 7404 triggering( 7405 $this, 7406 $banners, 7407 $banner, 7408 $period, 7409 $(option.prevBtn), 7410 $(option.nextBtn), 7411 $lamp, 7412 length, 7413 option.currentClass, 7414 option.fadeSpd, 7415 option.interval 7416 ); 7417 }//init End 7418 7419 7420 function triggering($this, $banners, $banner, $period, $prev, $next, $lamp, length, curClass, spd, interval){ 7421 var timerFlg = false,/* åãæ¿ãã¿ã¤ãã¼ãã»ããããã¦ãããã®ãã©ã° */ 7422 hoverFlg = false,/* ããã¼ã«ãã¦ã¹ãªã¼ãã¼ããã¦ãããã®ãã©ã° */ 7423 viewFlg = true,/* ã¹ã¤ããã£ã¼ããã©ã¦ã¶ç»é¢å ã«ãããã©ããã®ãã©ã° */ 7424 cnt = 0,/* ç¾å¨ã®ããã¼ä½ç½®ã表ã夿° */ 7425 prev,/* 次ã®ããã¼ã表ã夿° */ 7426 next,/* åã®ããã¼ã表ã夿° */ 7427 timer, 7428 switching; 7429 7430 clickEvent(); 7431 hoverEvent(); 7432 scrollResizeEvent(); 7433 7434 function clickEvent(){/* ã¯ãªãã¯ã¤ãã³ãè¨å® */ 7435 $prev.bind("click", countDown); 7436 $next.bind("click", countUp); 7437 $lamp.bind("click", countDirect); 7438 }//clickEvent End 7439 7440 /* IE8以ä¸ã¯ã¯ãã¹ãã§ã¼ãã¯è¡ããªã */ 7441 if(currentBrowser.ltIE8){ 7442 switching = function(){ 7443 switchTimerClear(); 7444 7445 /* ããã¼åãæ¿ã */ 7446 $banner.eq(prev).hide(); 7447 $banner.eq(next).show(); 7448 7449 /* æéããã¹ãåãæ¿ã */ 7450 $period.eq(prev).hide(); 7451 $period.eq(next).show(); 7452 7453 /* ã©ã³ãç¹ç¯åãæ¿ã */ 7454 $lamp.eq(prev).removeClass(curClass); 7455 $lamp.eq(next).addClass(curClass); 7456 7457 switchTimerSet(); 7458 }//switching End 7459 }else{ 7460 switching = function(){ 7461 switchTimerClear(); 7462 7463 /* ããã¼ã¯ãã¹ãã§ã¼ã */ 7464 $banner.eq(prev).stop(true, true).fadeOut(spd); 7465 $banner.eq(next).stop(true, true).fadeIn(spd, function(){ 7466 switchTimerSet(); 7467 }); 7468 7469 /* æéããã¹ãåãæ¿ã */ 7470 $period.eq(prev).hide(); 7471 $period.eq(next).show(); 7472 7473 /* ã©ã³ãç¹ç¯åãæ¿ã */ 7474 $lamp.eq(prev).removeClass(curClass); 7475 $lamp.eq(next).addClass(curClass); 7476 }//switching End 7477 } 7478 7479 function countUp(){ 7480 prev = cnt; 7481 if(cnt < length - 1){ 7482 cnt++; 7483 }else{ 7484 cnt = 0; 7485 } 7486 next = cnt; 7487 7488 switching(); 7489 7490 return false; 7491 }//countUp End 7492 7493 function countDown(){ 7494 prev = cnt; 7495 if(cnt > 0){ 7496 cnt--; 7497 }else{ 7498 cnt = length - 1; 7499 } 7500 next = cnt; 7501 7502 switching(); 7503 7504 return false; 7505 }//countDown End 7506 7507 function countDirect(){ 7508 i = $lamp.index(this); 7509 7510 if(i == cnt){/* ã¯ãªãã¯ããã©ã³ãã®çªå·ã¨ç¾å¨ã®cntãåããªãã¯ãªãã¯ã¤ãã³ãã¯èµ·ãããªã */ 7511 return false; 7512 }else{ 7513 prev = cnt; 7514 cnt = i; 7515 next = cnt; 7516 7517 switching(); 7518 7519 return false; 7520 } 7521 }//countDown End 7522 7523 function hoverEvent(){/* ãã¦ã¹ãã¼ãã¼è¨å® */ 7524 $banners.hover(function(){ 7525 if(!hoverFlg){ 7526 hoverFlg = true; 7527 switchTimerClear(); 7528 } 7529 },function(){ 7530 if(hoverFlg){ 7531 hoverFlg = false; 7532 switchTimerSet(); 7533 } 7534 }); 7535 }//hoverEvent End 7536 7537 /* ã¿ã¤ãã¼ãã»ããããã¦ããªããããã¼ããã¼ãã¼ããã¦ããªãã 7538 ã¹ã¤ããã£ã¼ãç»é¢å ã«ããå ´åã¿ã¤ãã¼ã»ãã */ 7539 function switchTimerSet(){ 7540 if(!timerFlg && !hoverFlg && viewFlg){ 7541 timer = setInterval(countUp, interval); 7542 timerFlg = true; 7543 } 7544 }//switchTimerSet End 7545 7546 function switchTimerClear(){ 7547 if(timerFlg){ 7548 clearInterval(timer); 7549 timerFlg = false; 7550 } 7551 }//switchTimerClear End 7552 7553 function scrollResizeEvent(){ 7554 var thisHeight = $this.outerHeight(), offsetTop = $this.offset().top, 7555 winHeight = $win.height(), scrollTop = $win.scrollTop(), upper, under; 7556 7557 /* ã¹ã¯ãã¼ã«éããã¹ã¤ããã£ã¼ã®ãªãã»ããããã㨠7558 é«ããåãããéãå¼ããå¤ã0以ä¸ã ã£ããç»é¢å¤ */ 7559 upper = scrollTop - (offsetTop + thisHeight); 7560 7561 /* ã¹ã¯ãã¼ã«éã¨ãã©ã¦ã¶ç»é¢é«ããåãããéãã 7562 ã¹ã¤ããã£ã¼ã®ãªãã»ããããããå¼ããå¤ã0以ä¸ã ã£ããç»é¢å */ 7563 under = (winHeight + scrollTop) - offsetTop; 7564 7565 if(upper >= 0 || under <= 0){//ç»é¢å¤ 7566 switchTimerOnceSet(); 7567 viewFlg = false; 7568 }else{//ç»é¢å 7569 switchTimerSet(); 7570 switchTimerOnceClear(); 7571 } 7572 7573 $win.scroll(function(){ 7574 scrollTop = $(this).scrollTop(); 7575 upper = scrollTop - (offsetTop + thisHeight); 7576 under = (winHeight + scrollTop) - offsetTop; 7577 7578 if(upper >= 0 || under <= 0){ 7579 $this.trigger("timerOnceClear"); 7580 }else{ 7581 $this.trigger("timerOnceSet"); 7582 } 7583 }); 7584 7585 $win.resize(function(){ 7586 winHeight = $(this).height(); 7587 under = (winHeight + scrollTop) - offsetTop; 7588 7589 if(upper >= 0 || under <= 0){ 7590 $this.trigger("timerOnceClear"); 7591 }else{ 7592 $this.trigger("timerOnceSet"); 7593 } 7594 }); 7595 }//scrollResizeEvent End 7596 7597 /* 1åéãã®ã¿ã¤ãã¼ã»ããã¤ãã³ããè¨å®ãã */ 7598 function switchTimerOnceSet(){ 7599 $this.one("timerOnceSet", function(){ 7600 viewFlg = true; 7601 switchTimerSet(); 7602 switchTimerOnceClear();/* çºç«ã¨åæã«1åéãã®ã¿ã¤ãã¼ã¯ãªã¢ã¼ã¤ãã³ããè¨å®ãã */ 7603 }); 7604 }//switchTimerOnceSet End 7605 7606 /* 1åéãã®ã¿ã¤ãã¼ã¯ãªã¢ã¼ã¤ãã³ããè¨å®ãã */ 7607 function switchTimerOnceClear(){ 7608 $this.one("timerOnceClear", function(){ 7609 viewFlg = false; 7610 switchTimerClear(); 7611 switchTimerOnceSet();/* çºç«ã¨åæã«1åéãã®ã¿ã¤ãã¼ã»ããã¤ãã³ããè¨å®ãã */ 7612 }); 7613 }//switchTimerOnceClear End 7614 7615 }//triggering End 7616 7617})(jQuery); 7618 7619/* 7620============================================================== 7621jquery.banner.switcher.js @Go-Next END 7622============================================================== 7623*/ 7624 7625 7626 7627/* 7628============================================================== 7629jquery.fixedbanner.js @Go-Next START 7630============================================================== 7631*/ 7632(function($){ 7633 7634 $.fixedBanner = function (opts){ 7635 7636 var 7637 $lastBanner = $(opts.lastBanner), 7638 $container = $(opts.container), 7639 $footer = $(opts.footer), 7640 banner_height = $lastBanner.outerHeight(true), 7641 container_height = $container.height(), 7642 container_width = $container.width(), 7643 banner_top = $lastBanner.offset().top, 7644 $dummy = $('<div>').css({height: container_height, width: container_width}).hide(); 7645 $container.after($dummy); 7646 7647 $(window).scroll(function(){ 7648 var 7649 $this = $(this), 7650 wst = $this.scrollTop(), 7651 vertical_span = wst+$this.height(), 7652 bottom_space = vertical_span - banner_top - banner_height, 7653 to_footer = $footer.offset().top - vertical_span; 7654 7655 // console.log( bottom_space ); 7656 7657 if(to_footer<=0){ 7658 $container.css({position: 'fixed',bottom: opts.margin_bottom - to_footer }); 7659 return; 7660 } 7661 if(opts.margin_bottom<bottom_space){ 7662 $dummy.show(); 7663 $container.css({position: 'fixed',bottom: opts.margin_bottom}); 7664 }else{ 7665 $dummy.hide(); 7666 $container.css({position: '',bottom: ''}); 7667 } 7668 }); 7669 }; 7670})(jQuery); 7671 7672/* 7673============================================================== 7674jquery.fixedbanner.js @Go-Next END 7675============================================================== 7676*/ 7677 7678 7679 7680/* 7681============================================================== 7682jquery.profphoto.switch.js @Go-Next START 7683============================================================== 7684*/ 7685;(function($){ 7686 7687 var defaults = { 7688 photo: "#photoContainer", 7689 control: "#controlContainer" 7690 }, 7691 settings; 7692 7693 $.profphotoSwitch = function(){ 7694 settings = $.extend({}, defaults, $.profphotoSwitch.settings); 7695 dispatch(); 7696 }; 7697 7698 function dispatch(){ 7699 var $photos = $(settings.photo).children(), $btns = $(settings.control).find(".thumb_btn"), leng = $photos.length, 7700 cur = 0, prev; 7701 7702 $photos.first().nextAll().hide(); 7703 7704 $btns.css("cursor","pointer"); 7705 7706 $btns.each(function(i){ 7707 var $this = $(this); 7708 7709 $this.click(function(){ 7710 if(cur != i){ 7711 prev = cur; 7712 cur = i; 7713 7714 $photos.eq(prev).hide(); 7715 $photos.eq(cur).show(); 7716 } 7717 7718 return false; 7719 }); 7720 }); 7721 }; 7722 7723})(jQuery); 7724/* 7725============================================================== 7726jquery.profphoto.switch.js @Go-Next END 7727============================================================== 7728*/ 7729 7730 7731 7732/* 7733============================================================== 7734jquery.smoothly.moving.js @Go-Next START 7735============================================================== 7736*/ 7737(function($){ 7738
7739 $.fn.smoothlyMoving = function(_config){ 7740 var defaults = { 7741 duration: 350, 7742 easing: "swing" 7743 }, 7744 config = $.extend({}, defaults, _config); 7745 7746 return this.each(function(i){ 7747 var $this = $(this), selector; 7748 7749 //å é¨ãªã³ã¯ã®è¨å®ãã¹ããã©ã°ã¤ã³æå®ã»ã¬ã¯ã¿ã¼ã®è¨å®ãã¹ãé²ãããæååãç¢ºèª 7750 selector = $this.attr("href").match(/(^#[a-zA-Z])(\w+)/g); 7751 7752 if(selector == null){ 7753 return; 7754 } 7755 7756 var $targetObj = $($this.attr("href")), scrollAmount; 7757 7758 if($targetObj.length != 0){ 7759 $this.click(function(){ 7760 //縦ã¢ã³ã¼ãã£ãªã³ãã¦ã¤ã³ãã¦ãµã¤ãºã§èªåæ¹è¡ã«ãããã¼ã¸ã®é«ããå¤ãã 7761 //ã¾ãã¯ãªãã¯åã«ãªãµã¤ãºãã¦ããå¯è½æ§ãããã®ã§ã¯ãªãã¯ãã¨ã«ã¦ã¤ã³ãã¦ã¨ãã¼ã¸ã®é«ããåå¾ 7762 var winH = $(window).height(), 7763 bodyH = $("body").height(); 7764 7765 //ã¹ã¯ãã¼ã«éãè¨ç® 7766 scrollAmount = $targetObj.offset().top; 7767 7768 //対象ã³ã³ãã³ãããã¼ã¸ä¸é¨ã«ãã£ã¦ã¹ã¯ãã¼ã«éåã¹ã¯ãã¼ã«ã§ããªãå ´åã 7769 //ãã¼ã¸ã®é«ãããã¦ã¤ã³ãã¦ã®é«ããå¼ããåãã¹ã¯ãã¼ã«éã¨ãã 7770 if(scrollAmount + winH > bodyH){ 7771 scrollAmount = bodyH - winH; 7772 } 7773 7774 $("html, body").stop(true, false).animate( 7775 {scrollTop: scrollAmount}, 7776 {duration: config.duration, easing: config.easing} 7777 ); 7778 7779 return false; 7780 }); 7781 }else{ 7782 $this.click(function(){ 7783 return false; 7784 }); 7785 } 7786 }); 7787 }; 7788 7789})(jQuery); 7790/* 7791============================================================== 7792jquery.smoothly.moving.js @Go-Next END 7793============================================================== 7794*/ 7795 7796 7797 7798/* 7799============================================================== 7800jquery.vertical.middle.js @Go-Next START 7801============================================================== 7802*/ 7803;(function($){ 7804 $.fn.verticalMiddle = function(options){ 7805 var op = $.extend({ 7806 visibility: 'visible', 7807 height : 9999 7808 }, options || {}); 7809 7810 $(this).each(function(){ 7811 var h = $(this).height(); 7812 if (h < op.height) { 7813 var p = (op.height - h)/2; 7814 $(this).css({'position':'relative','top':p}); 7815 } 7816 if (op.visibility == 'hidden') { 7817 $(this).css('visibility','visible'); 7818 } 7819 }); 7820 }; 7821})(jQuery); 7822/* 7823============================================================== 7824jquery.vertical.middle.js @Go-Next END 7825============================================================== 7826*/ 7827 7828 7829 7830/* 7831============================================================== 7832jquery.justcenter.js @Go-Next START 7833============================================================== 7834*/ 7835(function($){ 7836 7837 $.fn.justCenter = function(config){ 7838 7839 var defaults = { 7840 frame: '' 7841 }, 7842 opt = $.extend({}, defaults, config); 7843 7844 return this.each(function(i){ 7845 7846 if(opt.frame == '') 7847 return; 7848 7849 $(this).find(opt.frame).each(function(){ 7850 7851 var $this = $(this), $img = $this.find('img'), 7852 frameW = $this.width(), frameH = $this.height(); 7853 7854 $this.css({ 7855 'position': 'relative', 7856 'overflow': 'hidden' 7857 }); 7858 7859 $img.css({ 7860 'position': 'absolute', 7861 'top': 0, 7862 'left': 0 7863 }); 7864 7865 var img = new Image(), imgW, imgH; 7866 7867 img.onload = function(){ 7868 7869 imgW = this.width; 7870 imgH = this.height; 7871 7872 var rate, viewW, viewH, centerW, centerH; 7873 7874 /** 7875 * èªè¾¼ãã ç»åã®ãµã¤ãºããç»åã縦é·ã横é·ãæ£æ¹å½¢ã¿ã¤ããã調ã¹ãã 7876 * 縦é·ã§ãµã ãã¤ã«ã®æ¨ªå¹ ãã大ãããæ¨ªé·ãæ£æ¹å½¢ã§ãµã ãã¤ã«ã®ç¸¦å¹ ãã大ããã£ããã 7877 * ãµã ãã¤ã«ã®ãµã¤ãºã«åãããã
7877éã«å°ããã£ãããªãµã¤ãºããªãã 7878 * æå¾ã«ç»åããµã ãã¤ã«ã«å¯¾ãã¦ä¸ä¸å·¦å³ä¸å¤®ã®ä½ç½®ã«ããããã«è¨ç½®ããã 7879 */ 7880 if(imgW < imgH){ 7881 rate = imgH / imgW; 7882 7883 if(imgW >= frameW){ 7884 viewW = frameW; 7885 viewH = frameW * rate; 7886 centerW = 0; 7887 }else{ 7888 viewW = imgW; 7889 viewH = imgH; 7890 centerW = (frameW - imgW) / 2; 7891 } 7892 7893 centerH = (frameH - viewH) / 2; 7894 }else{ 7895 rate = imgW / imgH; 7896 7897 if(imgH >= frameH){ 7898 viewW = frameH * rate; 7899 viewH = frameH; 7900 centerH = 0; 7901 }else{ 7902 viewW = imgW; 7903 viewH = imgH; 7904 centerH = (frameH - imgH) / 2; 7905 } 7906 7907 centerW = (frameW - viewW) / 2; 7908 } 7909 7910 $img 7911 .width(viewW) 7912 .height(viewH) 7913 .css({ 7914 'top': centerH + 'px', 7915 'left': centerW + 'px' 7916 }) 7917 .fadeIn(350); 7918 7919 } 7920 7921 img.src = $img.attr('src'); 7922 7923 }); 7924 7925 }); 7926 7927 }; 7928 7929})(jQuery); 7930/* 7931============================================================== 7932jquery.justcenter.js @Go-Next END 7933============================================================== 7934*/ 7935 7936 7937 7938/* 7939============================================================== 7940castsort.js @Go-Next START 7941============================================================== 7942*/ 7943 7944/** 7945 * æ¤ç´¢æ¡ä»¶ã«è©²å½ãããã£ã¹ãã表示ãã 7946 * @param boxname 表示ãããã¯ã©ã¹å 7947 */ 7948;(function($) { 7949 var GLOBAL = GLOBAL || {}; 7950 $.fn.getCast = function(options) { 7951 var $check = $(this); 7952 7953 // ããã©ã«ãè¨å® 7954 var settings = { 7955 'dispBox' : '.contents', 7956 'tooltip' : '', 7957 'sortList' : '#sortlist', 7958 'label': 'checked', 7959 'searchButton': '', 7960 'trackEventName': '', 7961 'trackEventPage': '', 7962 'url': '', 7963 'loading': '#loading', 7964 }; 7965 7966 // è¨å®ããã¼ã¸ãã 7967 if (options) { 7968 $.extend(settings, options); 7969 } 7970 7971 var getCast = { 7972 // åæå 7973 init: function() { 7974 // ãã§ãã¯ããã¹ã¦å¤ã 7975 $check.find('input:checked').each(function(){ 7976 $(this).removeAttr('checked'); 7977 }); 7978 // ä¸¦ã³æ¿ããããã©ã«ãã«æ»ã 7979 $(settings.sortList).val($(settings.sortList).find(':first').val()); 7980 }, 7981 // æ¤ç´¢ãã¿ã³ãã¯ãªã㯠7982 search: function($this) { 7983 // ãã§ãã¯ããã¦ããªãå ´åã¯ããã§ãã¯ãã¤ãã 7984 if (!$this.attr('checked')) { 7985 $this.next('label').addClass(settings.label); 7986 $this.attr('checked', 'checked'); 7987 getCast.show(); 7988 // ãã§ãã¯ããã¦ããå ´åã¯ããã§ãã¯ãå¤ã 7989 } else { 7990 $this.next('label').removeClass(settings.label); 7991 $this.removeAttr('checked'); 7992 getCast.show(); 7993 } 7994 }, 7995 // ãã¼ã«ããã 7996 tooltip: function() { 7997 $(settings.tooltip.looparea).each(function() { 7998 $(this).find(settings.tooltip.target).cluetip({ 7999 activation: settings.tooltip.activation, 8000 local: settings.tooltip.local, 8001 waitImage: settings.tooltip.waitImage, 8002 cursor: settings.tooltip.cursor, 8003 }); 8004 }); 8005 8006 // ãã¼ã«ãããã®å¤å´ã§ã¯ãªãã¯ããããããã¢ãããé ã 8007 $('html').click(function(event) { 8008 if (!$.contains($("#cluetip")[0], event.target)) { 8009 $('#cluetip').hide(); 8010 } 8011 }); 8012 return; 8013 }, 8014 // 女æ§ãã¼ã¿è¡¨ç¤º 8015 show: function() { 8016 // ãã£ã¹ããªã¹ãã®ããã¯ã¹ãåå¾ 8017 var castListBox = $(settings.dispBox); 8018 // ããã¯ã¹ã®ä¸èº«ã空ã«ãã 8019 castListBox.empty(); 8020 8021 // çµãè¾¼ã¿æ¤ç´¢ 8022 var searchdata = [];
8023 $check.find('input:checked').each(function(){ 8024 // ã¤ãã³ããã©ããã³ã° 8025 if (settings.trackEventName && settings.trackEventPage) { 8026 ga('send','event', settings.trackEventName, $(this).val(), settings.trackEventPage); 8027 } 8028 searchdata.push($(this).val()); 8029 }); 8030 8031 // ä¸¦ã³æ¿ããã¤ãã³ããã©ããã³ã° 8032 if (settings.trackEventName && settings.trackEventPage) { 8033 // ããã©ã«ãä»¥å¤ 8034 if ($(settings.sortList).val() != $(settings.sortList).find(':first').val()) { 8035 ga('send','event', settings.trackEventName, $(settings.sortList).val(), settings.trackEventPage); 8036 } 8037 } 8038 8039 // ãã¼ã¿è¡¨ç¤º 8040 jQuery.ajax({ 8041 type: "GET", 8042 url: settings.url, 8043 data: "searchdata=" + searchdata + "&sortlist=" + $(settings.sortList).val(), 8044 async: false, 8045 beforeSend: function(data) { 8046 $(settings.loading).show(); 8047 }, 8048 success: function(msg){ 8049 $(settings.loading).fadeOut(function() { 8050 castListBox.append(msg); 8051 8052 // plugin:jquery.cluetip.min.js 8053 // ãã¼ã«ããã 8054 if (settings.tooltip) { 8055 getCast.tooltip(); 8056 } 8057 }); 8058 } 8059 }); 8060 return this; 8061 } 8062 }; 8063 8064 // ããã©ã«ã表示 8065 getCast.init(); 8066 8067 // ã¯ãªãã¯ã¤ãã³ã 8068 // å®è¡ãã¿ã³æ¼ä¸æ 8069 if (settings.searchButton) { 8070 $(settings.searchButton).click(function(){ 8071 getCast.show(); 8072 }); 8073 // å®è¡ãã¿ã³ããªãå ´å 8074 } else { 8075 $check.find('input:checkbox').on("click", function() { 8076 getCast.search($(this)); 8077 }); 8078 // ä¸¦ã³æ¿ã 8079 $(settings.sortList).change(function(){ 8080 getCast.show(); 8081 }); 8082 } 8083 }; 8084})(jQuery); 8085/* 8086============================================================== 8087castsort.js @Go-Next END 8088============================================================== 8089*/ 8090 8091 8092 8093/* 8094============================================================== 8095jquery.wideslider.js START 8096============================================================== 8097*/ 8098;(function($) { 8099 $.fn.wideslider = function(options){ 8100 8101 $.fn.wideslider.defaults = { 8102 marginLR : 40, 8103 baseWidth : 980, 8104 baseHeight : 448, 8105 slideSpeed : 500, 8106 delayTime : 5000, 8107 easing : 'linear', 8108 autoPlay : '1', // notAutoPlay : '0' 8109 btnOpacity : 0.7, 8110 pnOpacity : 0.5 8111 }; 8112 var opts = $.extend({}, $.fn.wideslider.defaults, options); 8113 8114 //alert(opts.fadeSpeed); 8115 var $setElm = $(this), 8116 marginLR = opts.marginLR, 8117 baseWidth = opts.baseWidth+opts.marginLR, 8118 baseHeight = opts.baseHeight, 8119 8120 slideSpeed = opts.slideSpeed, 8121 delayTime = opts.delayTime, 8122 easing = opts.easing, 8123 8124 autoPlay = opts.autoPlay, // notAutoPlay = '0' 8125 8126 btnOpacity = opts.btnOpacity, 8127 pnOpacity = opts.pnOpacity; 8128 8129 $(">ul>li",this).wrapInner("<div style='position:relative; margin:0px 20px 0px 20px;height:"+baseHeight+"px;'></div>"); 8130 8131 $setElm.each(function(){ 8132 var targetObj = $(this); 8133 var widesliderWidth = baseWidth; 8134 var widesliderHeight = baseHeight; 8135 targetObj.children('ul').wrapAll('<div class="wideslider_base"><div class="wideslider_wrap"></div><div class="slider_prev"></div><div class="slider_next"></div></div>'); 8136 8137 var findBase = targetObj.find('.wideslider_base'); 8138 var findWrap = targetObj.find('.wideslider_wrap'); 8139 var findPrev = targetObj.find('.slider_prev'); 8140 var findNext = targetObj.find('.slider_next'); 8141 8142 var baseListWidth = baseWidth;
8143 var baseListCount = findWrap.children('ul').children('li').length; 8144 8145 var baseWrapWidth = (baseListWidth)*(baseListCount); 8146 8147 var pagination = $('<div class="pagination"></div>'); 8148 targetObj.append(pagination); 8149 var baseList = findWrap.children('ul').children('li'); 8150 baseList.each(function(i){ 8151 $(this).css({width:(baseWidth),height:(baseHeight)}); 8152 pagination.append('<a href="javascript:void(0);" class="pn'+(i+1)+'"></a>'); 8153 }); 8154 8155 var pnPoint = pagination.children('a'); 8156 var pnFirst = pagination.children('a:first'); 8157 var pnLast = pagination.children('a:last'); 8158 var pnCount = pagination.children('a').length; 8159 pnPoint.css({opacity:(pnOpacity)}).hover(function(){ 8160 $(this).stop().animate({opacity:'1'},300); 8161 }, function(){ 8162 $(this).stop().animate({opacity:(pnOpacity)},300); 8163 }); 8164 pnFirst.addClass('active'); 8165 pnPoint.click(function(){ 8166 if(autoPlay == '1'){clearInterval(wsSetTimer);} 8167 var setNum = pnPoint.index(this); 8168 var moveLeft = ((baseListWidth)*(setNum))+baseWrapWidth; 8169 findWrap.stop().animate({left: -(moveLeft)},slideSpeed,easing); 8170 pnPoint.removeClass('active'); 8171 $(this).addClass('active'); 8172 if(autoPlay == '1'){wsTimer();} 8173 }); 8174 8175 var makeClone = findWrap.children('ul'); 8176 makeClone.clone().prependTo(findWrap); 8177 makeClone.clone().appendTo(findWrap); 8178 8179 var allListWidth = findWrap.children('ul').children('li').width(); 8180 var allListCount = findWrap.children('ul').children('li').length; 8181 8182 var allLWrapWidth = (allListWidth)*(allListCount); 8183 var windowWidth = $(window).width(); 8184 var posAdjust = ((windowWidth)-(baseWidth))/2; 8185 8186 findBase.css({left:(posAdjust),width:(baseWidth),height:(baseHeight)}); 8187 findPrev.css({left:-(baseWrapWidth+marginLR/2),width:(baseWrapWidth),height:(baseHeight),opacity:(btnOpacity)}); 8188 findNext.css({right:-(baseWrapWidth+marginLR/2),width:(baseWrapWidth),height:(baseHeight),opacity:(btnOpacity)}); 8189 $(window).bind('resize',function(){ 8190 var windowWidth = $(window).width(); 8191 var posAdjust = ((windowWidth)-(baseWidth))/2; 8192 findBase.css({left:(posAdjust)}); 8193 findPrev.css({left:-(posAdjust+marginLR/2),width:(posAdjust)}); 8194 findNext.css({right:-(posAdjust+marginLR/2),width:(posAdjust)}); 8195 }).resize(); 8196 8197 findWrap.css({left:-(baseWrapWidth),width:(allLWrapWidth),height:(baseHeight)}); 8198 findWrap.children('ul').css({width:(baseWrapWidth),height:(baseHeight)}); 8199 8200 var posResetNext = -(baseWrapWidth)*2; 8201 var posResetPrev = -(baseWrapWidth)+(baseWidth); 8202 8203 if(autoPlay == '1'){wsTimer();} 8204 8205 function wsTimer(){ 8206 wsSetTimer = setInterval(function(){ 8207 findNext.click(); 8208 },delayTime); 8209 } 8210 findNext.click(function(){ 8211 findWrap.not(':animated').each(function(){ 8212 if(autoPlay == '1'){clearInterval(wsSetTimer);} 8213 var posLeft = parseInt($(findWrap).css('left')); 8214 var moveLeft = ((posLeft)-(baseWidth)); 8215 findWrap.stop().animate({left:(moveLeft)},slideSpeed,easing,function(){ 8216 var adjustLeft = parseInt($(findWrap).css('left')); 8217 if(adjustLeft == posResetNext){ 8218 findWrap.css({left: -(baseWrapWidth)}); 8219 } 8220 }); 8221 var pnPointActive = pagination.children('a.active'); 8222 pnPointActive.each(function(){ 8223 var pnIndex = pnPoint.index(this); 8224 var listCount = pnIndex+1; 8225 if(pnCount == listCount){ 8226 pnPointActive.removeClass('active'); 8227 pnFirst.addClass('active'); 8228 } else { 8229 pnPointActive.removeClass('active').next().addClass('active'); 8230 } 8231 }); 8232 if(autoPlay == '1'){wsTimer();} 8233 }); 8234 }).hover(function(){ 8235 $(this).stop().animate({opacity:((btnOpacity)+0.1)},100); 8236 }, function(){ 8237 $(this).stop().animate({opacity:(btnOpacity)},100); 8238 }); 8239 8240 findPrev.click(function(){ 8241 findWrap.not(':animated').each(function(){ 8242 if(autoPlay == '1'){clearInterval(wsSetTimer);} 8243 var posLeft = parseInt($(findWrap).css('left')); 8244 var moveLeft = ((posLeft)+(baseWidth)); 8245 findWrap.stop().animate({left:(moveLeft)},slideSpeed,easing,function(){ 8246 var adjustLeft = parseInt($(findWrap).css('left')); 8247 var adjustLeftPrev = (posResetNext)+(baseWidth);
8248 if(adjustLeft == posResetPrev){ 8249 findWrap.css({left: (adjustLeftPrev)}); 8250 } 8251 }); 8252 var pnPointActive = pagination.children('a.active'); 8253 pnPointActive.each(function(){ 8254 var pnIndex = pnPoint.index(this); 8255 var listCount = pnIndex+1; 8256 if(1 == listCount){ 8257 pnPointActive.removeClass('active'); 8258 pnLast.addClass('active'); 8259 } else { 8260 pnPointActive.removeClass('active').prev().addClass('active'); 8261 } 8262 }); 8263 if(autoPlay == '1'){wsTimer();} 8264 }); 8265 }).hover(function(){ 8266 $(this).stop().animate({opacity:((btnOpacity)+0.1)},100); 8267 }, function(){ 8268 $(this).stop().animate({opacity:(btnOpacity)},100); 8269 }); 8270 }); 8271 } 8272})(jQuery);//! æ¹è¡ 8273/* 8274============================================================== 8275jquery.wideslider.js END 8276============================================================== 8277*/ 8278 8279 8280 8281/* 8282============================================================== 8283iealert.js END 8284============================================================== 8285*/ 8286 8287/* @license 8288 * IE Alert! jQuery plugin 8289 * Version 2.1 8290 * Author: David Nemes | @nmsdvid 8291 * http://nmsdvid.com/iealert/ 8292 */ 8293(function ($) { 8294 function initialize($obj, support, title, text, upgradeTitle, upgradeLink, overlayClose, closeBtn) { 8295 8296 var panel = "<div class='ie-l-t-c'></div>" 8297 + "<div class='ie-t'></div>" 8298 + "<div class='ie-r-t-c'></div>" 8299 + "<div class='ie-l'></div>" 8300 + "<div class='ie-c'>" 8301 + "<span class='ie-span'>" + title + "</span>" 8302 + "<p class='ie-p'>" + text + "</span>" 8303 + "<div class='ie-u'>" 8304 + "<div class='ie-u-l'></div>" 8305 + "<a href='" + upgradeLink + "' target='_blank'>" 8306 + "<div class='ie-u-c'>" 8307 + "<span class='ie-u-s'>" + upgradeTitle + "</span>" 8308 + "</div>" 8309 + "</a>" 8310 + "<div class='ie-u-r'></div>" 8311 + "</div>" 8312 + "</div>" 8313 + "<div class='ie-r'></div>" 8314 + "<div class='ie-l-b-c'></div>" 8315 + "<div class='ie-b'></div>" 8316 + "<div class='ie-r-b-c'></div>"; 8317 8318 var overlay = $("<div id='ie-alert-overlay'></div>"); 8319 var iepanel = $("<div id='ie-alert-panel'>" + panel + "</div>"); 8320 8321 var docHeight = $(document).height(); 8322 8323 overlay.css("height", docHeight); 8324 8325 function active() { 8326 $obj.prepend(iepanel); 8327 $obj.prepend(overlay); 8328 8329 var cHeight = $('.ie-c').css('height'); 8330 $('.ie-l').css('height', cHeight); 8331 $('.ie-r').css('height', cHeight); 8332 var uWidth = $('.ie-u-c').width(); 8333 $('.ie-u').css('margin-left', -(uWidth / 2 + 14)); 8334 var iePanel = $('#ie-alert-panel'); 8335 var ieOverlay = $('#ie-alert-overlay'); 8336 var ieBtn = $(".ie-r-t-c"); 8337 8338 if (closeBtn === false) { 8339 ieBtn.css('background-position', '-145px -58px'); 8340 ieBtn.click(function (e) { 8341 e.preventDefault(); 8342 }); 8343 } else { 8344 ieBtn.click(function () { 8345 iePanel.fadeOut(100); 8346 ieOverlay.fadeOut("slow"); 8347 }); 8348 } 8349 8350 if (overlayClose === true) { 8351 ieOverlay.click(function () { 8352 iePanel.fadeOut(100); 8353 $(this).fadeOut("slow"); 8354 }); 8355 } 8356 8357 if (ie === 6) { 8358 iepanel.addClass("ie6-style"); 8359 //overlay.css("background", "#d6d6d6"); 8360 $obj.css("margin", "0"); 8361 } 8362 } 8363 8364 if (support === "ie9") { // the modal box will appear on IE9, IE8, IE7, IE6 8365 if (ie < 10) { 8366 active(); 8367 } 8368 } else if (support === "ie8") { // the modal box will appear on IE8, IE7, IE6 8369 if (ie < 9) { 8370 active(); 8371 } 8372 } else if (support === "ie7") { // the modal box will appear on IE7, IE6 8373 if (ie < 8) { 8374 active(); 8375 } 8376 } else if (support === "ie6") { // the modal box will appear only on IE6 and below 8377 if (ie < 7) { 8378 active(); 8379 } 8380 } 8381 8382 } 8383 8384 ; //end initialize function 8385 8386 $.fn.iealert = function (options) { 8387 var defaults = { 8388 support:"ie7", 8389 title:"ã使ãã®Internet Explorerã¯<br />å½ãµã¤ãã§ã¯ãµãã¼ãããã¦ããã¾ããã", 8390 text:"ã覧ããã ãã«ã¯ææ°ã®ãã©ã¦ã¶ããå©ç¨ãã ããã<br />â»ãã¡ãã®ãããã¢ããã¯ãäºæè¡¨ç¤ºãã使ç¨ãã¦ããå ´åãææ°ãã¼ã¸ã§ã³ã§ã表示ããã¦ãã¾ããã¨ãããã¾ãã", 8391 upgradeTitle:"ææ°ãã¼ã¸ã§ã³ã¸ã¢ããã°ã¬ã¼ã", 8392 upgradeLink:"http://windows.microsoft.com/ja-jp/internet-explorer/download-ie", 8393 overlayClose:false, 8394 closeBtn: true 8395 }; 8396 8397 var option = $.extend(defaults, options); 8398 8399 return this.each(function () { 8400 8401 ie = (function(){ 8402 8403 var undef, 8404 v = 3, 8405 div = document.createElement('div'), 8406 all = div.getElementsByTagName('i'); 8407 8408 while ( 8409 div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', 8410 all[0] 8411 ); 8412 8413 return v > 4 ? v : undef; 8414 8415 }()); 8416 8417 // If browser is Internet Explorer 8418 if (ie >= 5) { 8419 var $this = $(this); 8420 initialize($this, option.support, option.title, option.text, option.upgradeTitle, option.upgradeLink, option.overlayClose, option.closeBtn); 8421 } 8422 8423 }); 8424 8425 }; 8426})(jQuery);//! æ¹è¡ 8427 8428/* 8429==============================================================
8430iealert.js END 8431============================================================== 8432*/ 8433 8434 8435 8436/* 8437============================================================== 8438jquery.ui.tabs.js START 8439============================================================== 8440*/ 8441/* @license 8442 * jQuery UI - v1.11.2 - 2014-12-29 8443 * http://jqueryui.com 8444 * Includes: core.js, widget.js, tabs.js 8445 * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT 8446*/ 8447(function( factory ) { 8448 if ( typeof define === "function" && define.amd ) { 8449 8450 // AMD. Register as an anonymous module. 8451 define([ "jquery" ], factory ); 8452 } else { 8453 8454 // Browser globals 8455 factory( jQuery ); 8456 } 8457}(function( $ ) {//! æ¹è¡ 8458/* @license 8459 * jQuery UI Core 1.11.2 8460 * http://jqueryui.com 8461 * 8462 * Copyright 2014 jQuery Foundation and other contributors 8463 * Released under the MIT license. 8464 * http://jquery.org/license 8465 * 8466 * http://api.jqueryui.com/category/ui-core/ 8467 */ 8468 8469 8470// $.ui might exist from components with no dependencies, e.g., $.ui.position 8471$.ui = $.ui || {}; 8472 8473$.extend( $.ui, { 8474 version: "1.11.2", 8475
vendor: 17,775 bytes, lines 8476-8978
8476 keyCode: { 8477 BACKSPACE: 8, 8478 COMMA: 188, 8479 DELETE: 46, 8480 DOWN: 40, 8481 END: 35, 8482 ENTER: 13, 8483 ESCAPE: 27, 8484 HOME: 36, 8485 LEFT: 37, 8486 PAGE_DOWN: 34, 8487 PAGE_UP: 33, 8488 PERIOD: 190, 8489 RIGHT: 39, 8490 SPACE: 32, 8491 TAB: 9, 8492 UP: 38 8493 } 8494}); 8495 8496// plugins 8497$.fn.extend({ 8498 scrollParent: function( includeHidden ) { 8499 var position = this.css( "position" ), 8500 excludeStaticParent = position === "absolute", 8501 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 8502 scrollParent = this.parents().filter( function() { 8503 var parent = $( this ); 8504 if ( excludeStaticParent && parent.css( "position" ) === "static" ) { 8505 return false; 8506 } 8507 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) ); 8508 }).eq( 0 ); 8509 8510 return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent; 8511 }, 8512 8513 uniqueId: (function() { 8514 var uuid = 0; 8515 8516 return function() { 8517 return this.each(function() { 8518 if ( !this.id ) { 8519 this.id = "ui-id-" + ( ++uuid ); 8520 } 8521 }); 8522 }; 8523 })(), 8524 8525 removeUniqueId: function() { 8526 return this.each(function() { 8527 if ( /^ui-id-\d+$/.test( this.id ) ) { 8528 $( this ).removeAttr( "id" ); 8529 } 8530 }); 8531 } 8532}); 8533 8534// selectors 8535function focusable( element, isTabIndexNotNaN ) { 8536 var map, mapName, img, 8537 nodeName = element.nodeName.toLowerCase(); 8538 if ( "area" === nodeName ) { 8539 map = element.parentNode; 8540 mapName = map.name; 8541 if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { 8542 return false; 8543 } 8544 img = $( "img[usemap='#" + mapName + "']" )[ 0 ]; 8545 return !!img && visible( img ); 8546 } 8547 return ( /input|select|textarea|button|object/.test( nodeName ) ? 8548 !element.disabled : 8549 "a" === nodeName ? 8550 element.href || isTabIndexNotNaN : 8551 isTabIndexNotNaN) && 8552 // the element and all of its ancestors must be visible 8553 visible( element ); 8554} 8555 8556function visible( element ) { 8557 return $.expr.filters.visible( element ) && 8558 !$( element ).parents().addBack().filter(function() { 8559 return $.css( this, "visibility" ) === "hidden"; 8560 }).length; 8561} 8562 8563$.extend( $.expr[ ":" ], { 8564 data: $.expr.createPseudo ? 8565 $.expr.createPseudo(function( dataName ) { 8566 return function( elem ) { 8567 return !!$.data( elem, dataName ); 8568 }; 8569 }) : 8570 // support: jQuery <1.8 8571 function( elem, i, match ) { 8572 return !!$.data( elem, match[ 3 ] ); 8573 }, 8574 8575 focusable: function( element ) { 8576 return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); 8577 }, 8578 8579 tabbable: function( element ) { 8580 var tabIndex = $.attr( element, "tabindex" ), 8581 isTabIndexNaN = isNaN( tabIndex ); 8582 return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); 8583 } 8584}); 8585 8586// support: jQuery <1.8 8587if ( !$( "<a>" ).outerWidth( 1 ).jquery ) { 8588 $.each( [ "Width", "Height" ], function( i, name ) { 8589 var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], 8590 type = name.toLowerCase(), 8591 orig = { 8592 innerWidth: $.fn.innerWidth, 8593 innerHeight: $.fn.innerHeight, 8594 outerWidth: $.fn.outerWidth, 8595 outerHeight: $.fn.outerHeight 8596 }; 8597 8598 function reduce( elem, size, border, margin ) { 8599 $.each( side, function() { 8600 size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; 8601 if ( border ) { 8602 size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; 8603 } 8604 if ( margin ) { 8605 size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; 8606 } 8607 }); 8608 return size; 8609 } 8610 8611 $.fn[ "inner" + name ] = function( size ) { 8612 if ( size === undefined ) { 8613 return orig[ "inner" + name ].call( this ); 8614 } 8615 8616 return this.each(function() { 8617 $( this ).css( type, reduce( this, size ) + "px" ); 8618 }); 8619 }; 8620 8621 $.fn[ "outer" + name] = function( size, margin ) { 8622 if ( typeof size !== "number" ) { 8623 return orig[ "outer" + name ].call( this, size ); 8624 } 8625 8626 return this.each(function() { 8627 $( this).css( type, reduce( this, size, true, margin ) + "px" ); 8628 }); 8629 }; 8630 }); 8631} 8632 8633// support: jQuery <1.8 8634if ( !$.fn.addBack ) { 8635 $.fn.addBack = function( selector ) { 8636 return this.add( selector == null ? 8637 this.prevObject : this.prevObject.filter( selector ) 8638 ); 8639 }; 8640} 8641 8642// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) 8643if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { 8644 $.fn.removeData = (function( removeData ) { 8645 return function( key ) { 8646 if ( arguments.length ) { 8647 return removeData.call( this, $.camelCase( key ) ); 8648 } else { 8649 return removeData.call( this ); 8650 } 8651 }; 8652 })( $.fn.removeData ); 8653} 8654 8655// deprecated 8656$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); 8657 8658$.fn.extend({ 8659 focus: (function( orig ) { 8660 return function( delay, fn ) { 8661 return typeof delay === "number" ? 8662 this.each(function() { 8663 var elem = this; 8664 setTimeout(function() { 8665 $( elem ).focus(); 8666 if ( fn ) { 8667 fn.call( elem ); 8668 } 8669 }, delay ); 8670 }) : 8671 orig.apply( this, arguments ); 8672 }; 8673 })( $.fn.focus ), 8674 8675 disableSelection: (function() { 8676 var eventType = "onselectstart" in document.createElement( "div" ) ? 8677 "selectstart" : 8678 "mousedown"; 8679 8680 return function() { 8681 return this.bind( eventType + ".ui-disableSelection", function( event ) { 8682 event.preventDefault(); 8683 }); 8684 }; 8685 })(), 8686 8687 enableSelection: function() { 8688 return this.unbind( ".ui-disableSelection" ); 8689 }, 8690 8691 zIndex: function( zIndex ) { 8692 if ( zIndex !== undefined ) { 8693 return this.css( "zIndex", zIndex ); 8694 } 8695 8696 if ( this.length ) { 8697 var elem = $( this[ 0 ] ), position, value; 8698 while ( elem.length && elem[ 0 ] !== document ) { 8699 // Ignore z-index if position is set to a value where z-index is ignored by the browser 8700 // This makes behavior of this function consistent across browsers 8701 // WebKit always returns auto if the element is positioned 8702 position = elem.css( "position" ); 8703 if ( position === "absolute" || position === "relative" || position === "fixed" ) { 8704 // IE returns 0 when zIndex is not specified 8705 // other browsers return a string 8706 // we ignore the case of nested elements with an explicit value of 0 8707 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 8708 value = parseInt( elem.css( "zIndex" ), 10 ); 8709 if ( !isNaN( value ) && value !== 0 ) { 8710 return value; 8711 } 8712 } 8713 elem = elem.parent(); 8714 } 8715 } 8716 8717 return 0; 8718 } 8719}); 8720 8721// $.ui.plugin is deprecated. Use $.widget() extensions instead. 8722$.ui.plugin = { 8723 add: function( module, option, set ) { 8724 var i, 8725 proto = $.ui[ module ].prototype; 8726 for ( i in set ) { 8727 proto.plugins[ i ] = proto.plugins[ i ] || []; 8728 proto.plugins[ i ].push( [ option, set[ i ] ] ); 8729 } 8730 }, 8731 call: function( instance, name, args, allowDisconnected ) { 8732 var i, 8733 set = instance.plugins[ name ]; 8734 8735 if ( !set ) { 8736 return; 8737 } 8738 8739 if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) { 8740 return; 8741 } 8742 8743 for ( i = 0; i < set.length; i++ ) { 8744 if ( instance.options[ set[ i ][ 0 ] ] ) { 8745 set[ i ][ 1 ].apply( instance.element, args ); 8746 } 8747 } 8748 } 8749};//! æ¹è¡ 8750 8751 8752/* @license 8753 * jQuery UI Widget 1.11.2 8754 * http://jqueryui.com 8755 * 8756 * Copyright 2014 jQuery Foundation and other contributors 8757 * Released under the MIT license. 8758 * http://jquery.org/license 8759 * 8760 * http://api.jqueryui.com/jQuery.widget/ 8761 */ 8762 8763 8764var widget_uuid = 0, 8765 widget_slice = Array.prototype.slice; 8766 8767$.cleanData = (function( orig ) { 8768 return function( elems ) { 8769 var events, elem, i; 8770 for ( i = 0; (elem = elems[i]) != null; i++ ) { 8771 try { 8772 8773 // Only trigger remove when necessary to save time 8774 events = $._data( elem, "events" ); 8775 if ( events && events.remove ) { 8776 $( elem ).triggerHandler( "remove" ); 8777 } 8778 8779 // http://bugs.jquery.com/ticket/8235 8780 } catch ( e ) {} 8781 } 8782 orig( elems ); 8783 }; 8784})( $.cleanData ); 8785 8786$.widget = function( name, base, prototype ) { 8787 var fullName, existingConstructor, constructor, basePrototype, 8788 // proxiedPrototype allows the provided prototype to remain unmodified 8789 // so that it can be used as a mixin for multiple widgets (#8876) 8790 proxiedPrototype = {}, 8791 namespace = name.split( "." )[ 0 ]; 8792 8793 name = name.split( "." )[ 1 ]; 8794 fullName = namespace + "-" + name; 8795 8796 if ( !prototype ) { 8797 prototype = base; 8798 base = $.Widget; 8799 } 8800 8801 // create selector for plugin 8802 $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { 8803 return !!$.data( elem, fullName ); 8804 }; 8805 8806 $[ namespace ] = $[ namespace ] || {}; 8807 existingConstructor = $[ namespace ][ name ]; 8808 constructor = $[ namespace ][ name ] = function( options, element ) { 8809 // allow instantiation without "new" keyword 8810 if ( !this._createWidget ) { 8811 return new constructor( options, element ); 8812 } 8813 8814 // allow instantiation without initializing for simple inheritance 8815 // must use "new" keyword (the code above always passes args) 8816 if ( arguments.length ) { 8817 this._createWidget( options, element ); 8818 } 8819 }; 8820 // extend with the existing constructor to carry over any static properties 8821 $.extend( constructor, existingConstructor, { 8822 version: prototype.version, 8823 // copy the object used to create the prototype in case we need to 8824 // redefine the widget later 8825 _proto: $.extend( {}, prototype ), 8826 // track widgets that inherit from this widget in case this widget is 8827 // redefined after a widget inherits from it 8828 _childConstructors: [] 8829 }); 8830 8831 basePrototype = new base(); 8832 // we need to make the options hash a property directly on the new instance 8833 // otherwise we'll modify the options hash on the prototype that we're 8834 // inheriting from 8835 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 8836 $.each( prototype, function( prop, value ) { 8837 if ( !$.isFunction( value ) ) { 8838 proxiedPrototype[ prop ] = value; 8839 return; 8840 } 8841 proxiedPrototype[ prop ] = (function() { 8842 var _super = function() { 8843 return base.prototype[ prop ].apply( this, arguments ); 8844 }, 8845 _superApply = function( args ) { 8846 return base.prototype[ prop ].apply( this, args ); 8847 }; 8848 return function() { 8849 var __super = this._super, 8850 __superApply = this._superApply, 8851 returnValue; 8852 8853 this._super = _super; 8854 this._superApply = _superApply; 8855 8856 returnValue = value.apply( this, arguments ); 8857 8858 this._super = __super; 8859 this._superApply = __superApply; 8860 8861 return returnValue; 8862 }; 8863 })(); 8864 }); 8865 constructor.prototype = $.widget.extend( basePrototype, { 8866 // TODO: remove support for widgetEventPrefix 8867 // always use the name + a colon as the prefix, e.g., draggable:start 8868 // don't prefix for widgets that aren't DOM-based 8869 widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name 8870 }, proxiedPrototype, { 8871 constructor: constructor, 8872 namespace: namespace, 8873 widgetName: name, 8874 widgetFullName: fullName 8875 }); 8876 8877 // If this widget is being redefined then we need to find all widgets that 8878 // are inheriting from it and redefine all of them so that they inherit from 8879 // the new version of this widget. We're essentially trying to replace one 8880 // level in the prototype chain. 8881 if ( existingConstructor ) { 8882 $.each( existingConstructor._childConstructors, function( i, child ) { 8883 var childPrototype = child.prototype; 8884 8885 // redefine the child widget using the same prototype that was 8886 // originally used, but inherit from the new version of the base 8887 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); 8888 }); 8889 // remove the list of existing child constructors from the old constructor 8890 // so the old child constructors can be garbage collected 8891 delete existingConstructor._childConstructors; 8892 } else { 8893 base._childConstructors.push( constructor ); 8894 } 8895 8896 $.widget.bridge( name, constructor ); 8897 8898 return constructor; 8899}; 8900 8901$.widget.extend = function( target ) { 8902 var input = widget_slice.call( arguments, 1 ), 8903 inputIndex = 0, 8904 inputLength = input.length, 8905 key, 8906 value; 8907 for ( ; inputIndex < inputLength; inputIndex++ ) { 8908 for ( key in input[ inputIndex ] ) { 8909 value = input[ inputIndex ][ key ]; 8910 if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { 8911 // Clone objects 8912 if ( $.isPlainObject( value ) ) { 8913 target[ key ] = $.isPlainObject( target[ key ] ) ? 8914 $.widget.extend( {}, target[ key ], value ) : 8915 // Don't extend strings, arrays, etc. with objects 8916 $.widget.extend( {}, value ); 8917 // Copy everything else by reference 8918 } else { 8919 target[ key ] = value; 8920 } 8921 } 8922 } 8923 } 8924 return target; 8925}; 8926 8927$.widget.bridge = function( name, object ) { 8928 var fullName = object.prototype.widgetFullName || name; 8929 $.fn[ name ] = function( options ) { 8930 var isMethodCall = typeof options === "string", 8931 args = widget_slice.call( arguments, 1 ), 8932 returnValue = this; 8933 8934 // allow multiple hashes to be passed on init 8935 options = !isMethodCall && args.length ? 8936 $.widget.extend.apply( null, [ options ].concat(args) ) : 8937 options; 8938 8939 if ( isMethodCall ) { 8940 this.each(function() { 8941 var methodValue, 8942 instance = $.data( this, fullName ); 8943 if ( options === "instance" ) { 8944 returnValue = instance; 8945 return false; 8946 } 8947 if ( !instance ) { 8948 return $.error( "cannot call methods on " + name + " prior to initialization; " + 8949 "attempted to call method '" + options + "'" ); 8950 } 8951 if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { 8952 return $.error( "no such method '" + options + "' for " + name + " widget instance" ); 8953 } 8954 methodValue = instance[ options ].apply( instance, args ); 8955 if ( methodValue !== instance && methodValue !== undefined ) { 8956 returnValue = methodValue && methodValue.jquery ? 8957 returnValue.pushStack( methodValue.get() ) : 8958 methodValue; 8959 return false; 8960 } 8961 }); 8962 } else { 8963 this.each(function() { 8964 var instance = $.data( this, fullName ); 8965 if ( instance ) { 8966 instance.option( options || {} ); 8967 if ( instance._init ) { 8968 instance._init(); 8969 } 8970 } else { 8971 $.data( this, fullName, new object( options, this ) ); 8972 } 8973 }); 8974 } 8975 8976 return returnValue; 8977 }; 8978};
vendor: 10,750 bytes, lines 8979-9282
8979 8980$.Widget = function( /* options, element */ ) {}; 8981$.Widget._childConstructors = []; 8982 8983$.Widget.prototype = { 8984 widgetName: "widget", 8985 widgetEventPrefix: "", 8986 defaultElement: "<div>", 8987 options: { 8988 disabled: false, 8989 8990 // callbacks 8991 create: null 8992 }, 8993 _createWidget: function( options, element ) { 8994 element = $( element || this.defaultElement || this )[ 0 ]; 8995 this.element = $( element ); 8996 this.uuid = widget_uuid++; 8997 this.eventNamespace = "." + this.widgetName + this.uuid; 8998 8999 this.bindings = $(); 9000 this.hoverable = $(); 9001 this.focusable = $(); 9002 9003 if ( element !== this ) { 9004 $.data( element, this.widgetFullName, this ); 9005 this._on( true, this.element, { 9006 remove: function( event ) { 9007 if ( event.target === element ) { 9008 this.destroy(); 9009 } 9010 } 9011 }); 9012 this.document = $( element.style ? 9013 // element within the document 9014 element.ownerDocument : 9015 // element is window or document 9016 element.document || element ); 9017 this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); 9018 } 9019 9020 this.options = $.widget.extend( {}, 9021 this.options, 9022 this._getCreateOptions(), 9023 options ); 9024 9025 this._create(); 9026 this._trigger( "create", null, this._getCreateEventData() ); 9027 this._init(); 9028 }, 9029 _getCreateOptions: $.noop, 9030 _getCreateEventData: $.noop, 9031 _create: $.noop, 9032 _init: $.noop, 9033 9034 destroy: function() { 9035 this._destroy(); 9036 // we can probably remove the unbind calls in 2.0 9037 // all event bindings should go through this._on() 9038 this.element 9039 .unbind( this.eventNamespace ) 9040 .removeData( this.widgetFullName ) 9041 // support: jquery <1.6.3 9042 // http://bugs.jquery.com/ticket/9413 9043 .removeData( $.camelCase( this.widgetFullName ) ); 9044 this.widget() 9045 .unbind( this.eventNamespace ) 9046 .removeAttr( "aria-disabled" ) 9047 .removeClass( 9048 this.widgetFullName + "-disabled " + 9049 "ui-state-disabled" ); 9050 9051 // clean up events and states 9052 this.bindings.unbind( this.eventNamespace ); 9053 this.hoverable.removeClass( "ui-state-hover" ); 9054 this.focusable.removeClass( "ui-state-focus" ); 9055 }, 9056 _destroy: $.noop, 9057 9058 widget: function() { 9059 return this.element; 9060 }, 9061 9062 option: function( key, value ) { 9063 var options = key, 9064 parts, 9065 curOption, 9066 i; 9067 9068 if ( arguments.length === 0 ) { 9069 // don't return a reference to the internal hash 9070 return $.widget.extend( {}, this.options ); 9071 } 9072 9073 if ( typeof key === "string" ) { 9074 // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 9075 options = {}; 9076 parts = key.split( "." ); 9077 key = parts.shift(); 9078 if ( parts.length ) { 9079 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 9080 for ( i = 0; i < parts.length - 1; i++ ) { 9081 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 9082 curOption = curOption[ parts[ i ] ]; 9083 } 9084 key = parts.pop(); 9085 if ( arguments.length === 1 ) { 9086 return curOption[ key ] === undefined ? null : curOption[ key ]; 9087 } 9088 curOption[ key ] = value; 9089 } else { 9090 if ( arguments.length === 1 ) { 9091 return this.options[ key ] === undefined ? null : this.options[ key ]; 9092 } 9093 options[ key ] = value; 9094 } 9095 } 9096 9097 this._setOptions( options ); 9098 9099 return this; 9100 }, 9101 _setOptions: function( options ) { 9102 var key; 9103 9104 for ( key in options ) { 9105 this._setOption( key, options[ key ] ); 9106 } 9107 9108 return this; 9109 }, 9110 _setOption: function( key, value ) { 9111 this.options[ key ] = value; 9112 9113 if ( key === "disabled" ) { 9114 this.widget() 9115 .toggleClass( this.widgetFullName + "-disabled", !!value ); 9116 9117 // If the widget is becoming disabled, then nothing is interactive 9118 if ( value ) { 9119 this.hoverable.removeClass( "ui-state-hover" ); 9120 this.focusable.removeClass( "ui-state-focus" ); 9121 } 9122 } 9123 9124 return this; 9125 }, 9126 9127 enable: function() { 9128 return this._setOptions({ disabled: false }); 9129 }, 9130 disable: function() { 9131 return this._setOptions({ disabled: true }); 9132 }, 9133 9134 _on: function( suppressDisabledCheck, element, handlers ) { 9135 var delegateElement, 9136 instance = this; 9137 9138 // no suppressDisabledCheck flag, shuffle arguments 9139 if ( typeof suppressDisabledCheck !== "boolean" ) { 9140 handlers = element; 9141 element = suppressDisabledCheck; 9142 suppressDisabledCheck = false; 9143 } 9144 9145 // no element argument, shuffle and use this.element 9146 if ( !handlers ) { 9147 handlers = element; 9148 element = this.element; 9149 delegateElement = this.widget(); 9150 } else { 9151 element = delegateElement = $( element ); 9152 this.bindings = this.bindings.add( element ); 9153 } 9154 9155 $.each( handlers, function( event, handler ) { 9156 function handlerProxy() { 9157 // allow widgets to customize the disabled handling 9158 // - disabled as an array instead of boolean 9159 // - disabled class as method for disabling individual parts 9160 if ( !suppressDisabledCheck && 9161 ( instance.options.disabled === true || 9162 $( this ).hasClass( "ui-state-disabled" ) ) ) { 9163 return; 9164 } 9165 return ( typeof handler === "string" ? instance[ handler ] : handler ) 9166 .apply( instance, arguments ); 9167 } 9168 9169 // copy the guid so direct unbinding works 9170 if ( typeof handler !== "string" ) { 9171 handlerProxy.guid = handler.guid = 9172 handler.guid || handlerProxy.guid || $.guid++; 9173 } 9174 9175 var match = event.match( /^([\w:-]*)\s*(.*)$/ ), 9176 eventName = match[1] + instance.eventNamespace, 9177 selector = match[2]; 9178 if ( selector ) { 9179 delegateElement.delegate( selector, eventName, handlerProxy ); 9180 } else { 9181 element.bind( eventName, handlerProxy ); 9182 } 9183 }); 9184 }, 9185 9186 _off: function( element, eventName ) { 9187 eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + 9188 this.eventNamespace; 9189 element.unbind( eventName ).undelegate( eventName ); 9190 9191 // Clear the stack to avoid memory leaks (#10056) 9192 this.bindings = $( this.bindings.not( element ).get() ); 9193 this.focusable = $( this.focusable.not( element ).get() ); 9194 this.hoverable = $( this.hoverable.not( element ).get() ); 9195 }, 9196 9197 _delay: function( handler, delay ) { 9198 function handlerProxy() { 9199 return ( typeof handler === "string" ? instance[ handler ] : handler ) 9200 .apply( instance, arguments ); 9201 } 9202 var instance = this; 9203 return setTimeout( handlerProxy, delay || 0 ); 9204 }, 9205 9206 _hoverable: function( element ) { 9207 this.hoverable = this.hoverable.add( element ); 9208 this._on( element, { 9209 mouseenter: function( event ) { 9210 $( event.currentTarget ).addClass( "ui-state-hover" ); 9211 }, 9212 mouseleave: function( event ) { 9213 $( event.currentTarget ).removeClass( "ui-state-hover" ); 9214 } 9215 }); 9216 }, 9217 9218 _focusable: function( element ) { 9219 this.focusable = this.focusable.add( element ); 9220 this._on( element, { 9221 focusin: function( event ) { 9222 $( event.currentTarget ).addClass( "ui-state-focus" ); 9223 }, 9224 focusout: function( event ) { 9225 $( event.currentTarget ).removeClass( "ui-state-focus" ); 9226 } 9227 }); 9228 }, 9229 9230 _trigger: function( type, event, data ) { 9231 var prop, orig, 9232 callback = this.options[ type ]; 9233 9234 data = data || {}; 9235 event = $.Event( event ); 9236 event.type = ( type === this.widgetEventPrefix ? 9237 type : 9238 this.widgetEventPrefix + type ).toLowerCase(); 9239 // the original event may come from any element 9240 // so we need to reset the target on the new event 9241 event.target = this.element[ 0 ]; 9242 9243 // copy original event properties over to the new event 9244 orig = event.originalEvent; 9245 if ( orig ) { 9246 for ( prop in orig ) { 9247 if ( !( prop in event ) ) { 9248 event[ prop ] = orig[ prop ]; 9249 } 9250 } 9251 } 9252 9253 this.element.trigger( event, data ); 9254 return !( $.isFunction( callback ) && 9255 callback.apply( this.element[0], [ event ].concat( data ) ) === false || 9256 event.isDefaultPrevented() ); 9257 } 9258}; 9259 9260$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 9261 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 9262 if ( typeof options === "string" ) { 9263 options = { effect: options }; 9264 } 9265 var hasOptions, 9266 effectName = !options ? 9267 method : 9268 options === true || typeof options === "number" ? 9269 defaultEffect : 9270 options.effect || defaultEffect; 9271 options = options || {}; 9272 if ( typeof options === "number" ) { 9273 options = { duration: options }; 9274 } 9275 hasOptions = !$.isEmptyObject( options ); 9276 options.complete = callback; 9277 if ( options.delay ) { 9278 element.delay( options.delay ); 9279 } 9280 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 9281 element[ method ]( options ); 9282 } else if ( effectName !== method && element[ effectName ] ) {
vendor: 11,151 bytes, lines 9283-9618
9283 element[ effectName ]( options.duration, options.easing, callback ); 9284 } else { 9285 element.queue(function( next ) { 9286 $( this )[ method ](); 9287 if ( callback ) { 9288 callback.call( element[ 0 ] ); 9289 } 9290 next(); 9291 }); 9292 } 9293 }; 9294});//! æ¹è¡ 9295 9296/* @license 9297 * jQuery UI Tabs 1.11.2 9298 * http://jqueryui.com 9299 * 9300 * Copyright 2014 jQuery Foundation and other contributors 9301 * Released under the MIT license. 9302 * http://jquery.org/license 9303 * 9304 * http://api.jqueryui.com/tabs/ 9305 */ 9306 9307var widget = $.widget; 9308 9309var tabs = $.widget( "ui.tabs", { 9310 version: "1.11.2", 9311 delay: 300, 9312 options: { 9313 active: null, 9314 collapsible: false, 9315 event: "click", 9316 heightStyle: "content", 9317 hide: null, 9318 show: null, 9319 9320 // callbacks 9321 activate: null, 9322 beforeActivate: null, 9323 beforeLoad: null, 9324 load: null 9325 }, 9326 9327 _isLocal: (function() { 9328 var rhash = /#.*$/; 9329 9330 return function( anchor ) { 9331 var anchorUrl, locationUrl; 9332 9333 // support: IE7 9334 // IE7 doesn't normalize the href property when set via script (#9317) 9335 anchor = anchor.cloneNode( false ); 9336 9337 anchorUrl = anchor.href.replace( rhash, "" ); 9338 locationUrl = location.href.replace( rhash, "" ); 9339 9340 // decoding may throw an error if the URL isn't UTF-8 (#9518) 9341 try { 9342 anchorUrl = decodeURIComponent( anchorUrl ); 9343 } catch ( error ) {} 9344 try { 9345 locationUrl = decodeURIComponent( locationUrl ); 9346 } catch ( error ) {} 9347 9348 return anchor.hash.length > 1 && anchorUrl === locationUrl; 9349 }; 9350 })(), 9351 9352 _create: function() { 9353 var that = this, 9354 options = this.options; 9355 9356 this.running = false; 9357 9358 this.element 9359 .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ) 9360 .toggleClass( "ui-tabs-collapsible", options.collapsible ); 9361 9362 this._processTabs(); 9363 options.active = this._initialActive(); 9364 9365 // Take disabling tabs via class attribute from HTML 9366 // into account and update option properly. 9367 if ( $.isArray( options.disabled ) ) { 9368 options.disabled = $.unique( options.disabled.concat( 9369 $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { 9370 return that.tabs.index( li ); 9371 }) 9372 ) ).sort(); 9373 } 9374 9375 // check for length avoids error when initializing empty list 9376 if ( this.options.active !== false && this.anchors.length ) { 9377 this.active = this._findActive( options.active ); 9378 } else { 9379 this.active = $(); 9380 } 9381 9382 this._refresh(); 9383 9384 if ( this.active.length ) { 9385 this.load( options.active ); 9386 } 9387 }, 9388 9389 _initialActive: function() { 9390 var active = this.options.active, 9391 collapsible = this.options.collapsible, 9392 locationHash = location.hash.substring( 1 ); 9393 9394 if ( active === null ) { 9395 // check the fragment identifier in the URL 9396 if ( locationHash ) { 9397 this.tabs.each(function( i, tab ) { 9398 if ( $( tab ).attr( "aria-controls" ) === locationHash ) { 9399 active = i; 9400 return false; 9401 } 9402 }); 9403 } 9404 9405 // check for a tab marked active via a class 9406 if ( active === null ) { 9407 active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); 9408 } 9409 9410 // no active tab, set to false 9411 if ( active === null || active === -1 ) { 9412 active = this.tabs.length ? 0 : false; 9413 } 9414 } 9415 9416 // handle numbers: negative, out of range 9417 if ( active !== false ) { 9418 active = this.tabs.index( this.tabs.eq( active ) ); 9419 if ( active === -1 ) { 9420 active = collapsible ? false : 0; 9421 } 9422 } 9423 9424 // don't allow collapsible: false and active: false 9425 if ( !collapsible && active === false && this.anchors.length ) { 9426 active = 0; 9427 } 9428 9429 return active; 9430 }, 9431 9432 _getCreateEventData: function() { 9433 return { 9434 tab: this.active, 9435 panel: !this.active.length ? $() : this._getPanelForTab( this.active ) 9436 }; 9437 }, 9438 9439 _tabKeydown: function( event ) { 9440 var focusedTab = $( this.document[0].activeElement ).closest( "li" ), 9441 selectedIndex = this.tabs.index( focusedTab ), 9442 goingForward = true; 9443 9444 if ( this._handlePageNav( event ) ) { 9445 return; 9446 } 9447 9448 switch ( event.keyCode ) { 9449 case $.ui.keyCode.RIGHT: 9450 case $.ui.keyCode.DOWN: 9451 selectedIndex++; 9452 break; 9453 case $.ui.keyCode.UP: 9454 case $.ui.keyCode.LEFT: 9455 goingForward = false; 9456 selectedIndex--; 9457 break; 9458 case $.ui.keyCode.END: 9459 selectedIndex = this.anchors.length - 1; 9460 break; 9461 case $.ui.keyCode.HOME: 9462 selectedIndex = 0; 9463 break; 9464 case $.ui.keyCode.SPACE: 9465 // Activate only, no collapsing 9466 event.preventDefault(); 9467 clearTimeout( this.activating ); 9468 this._activate( selectedIndex ); 9469 return; 9470 case $.ui.keyCode.ENTER: 9471 // Toggle (cancel delayed activation, allow collapsing) 9472 event.preventDefault(); 9473 clearTimeout( this.activating ); 9474 // Determine if we should collapse or activate 9475 this._activate( selectedIndex === this.options.active ? false : selectedIndex ); 9476 return; 9477 default: 9478 return; 9479 } 9480 9481 // Focus the appropriate tab, based on which key was pressed 9482 event.preventDefault(); 9483 clearTimeout( this.activating ); 9484 selectedIndex = this._focusNextTab( selectedIndex, goingForward ); 9485 9486 // Navigating with control key will prevent automatic activation 9487 if ( !event.ctrlKey ) { 9488 // Update aria-selected immediately so that AT think the tab is already selected. 9489 // Otherwise AT may confuse the user by stating that they need to activate the tab, 9490 // but the tab will already be activated by the time the announcement finishes. 9491 focusedTab.attr( "aria-selected", "false" ); 9492 this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); 9493 9494 this.activating = this._delay(function() { 9495 this.option( "active", selectedIndex ); 9496 }, this.delay ); 9497 } 9498 }, 9499 9500 _panelKeydown: function( event ) { 9501 if ( this._handlePageNav( event ) ) { 9502 return; 9503 } 9504 9505 // Ctrl+up moves focus to the current tab 9506 if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { 9507 event.preventDefault(); 9508 this.active.focus(); 9509 } 9510 }, 9511 9512 // Alt+page up/down moves focus to the previous/next tab (and activates) 9513 _handlePageNav: function( event ) { 9514 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { 9515 this._activate( this._focusNextTab( this.options.active - 1, false ) ); 9516 return true; 9517 } 9518 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { 9519 this._activate( this._focusNextTab( this.options.active + 1, true ) ); 9520 return true; 9521 } 9522 }, 9523 9524 _findNextTab: function( index, goingForward ) { 9525 var lastTabIndex = this.tabs.length - 1; 9526 9527 function constrain() { 9528 if ( index > lastTabIndex ) { 9529 index = 0; 9530 } 9531 if ( index < 0 ) { 9532 index = lastTabIndex; 9533 } 9534 return index; 9535 } 9536 9537 while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { 9538 index = goingForward ? index + 1 : index - 1; 9539 } 9540 9541 return index; 9542 }, 9543 9544 _focusNextTab: function( index, goingForward ) { 9545 index = this._findNextTab( index, goingForward ); 9546 this.tabs.eq( index ).focus(); 9547 return index; 9548 }, 9549 9550 _setOption: function( key, value ) { 9551 if ( key === "active" ) { 9552 // _activate() will handle invalid values and update this.options 9553 this._activate( value ); 9554 return; 9555 } 9556 9557 if ( key === "disabled" ) { 9558 // don't use the widget factory's disabled handling 9559 this._setupDisabled( value ); 9560 return; 9561 } 9562 9563 this._super( key, value); 9564 9565 if ( key === "collapsible" ) { 9566 this.element.toggleClass( "ui-tabs-collapsible", value ); 9567 // Setting collapsible: false while collapsed; open first panel 9568 if ( !value && this.options.active === false ) { 9569 this._activate( 0 ); 9570 } 9571 } 9572 9573 if ( key === "event" ) { 9574 this._setupEvents( value ); 9575 } 9576 9577 if ( key === "heightStyle" ) { 9578 this._setupHeightStyle( value ); 9579 } 9580 }, 9581 9582 _sanitizeSelector: function( hash ) { 9583 return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : ""; 9584 }, 9585 9586 refresh: function() { 9587 var options = this.options, 9588 lis = this.tablist.children( ":has(a[href])" ); 9589 9590 // get disabled tabs from class attribute from HTML 9591 // this will get converted to a boolean if needed in _refresh() 9592 options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { 9593 return lis.index( tab ); 9594 }); 9595 9596 this._processTabs(); 9597 9598 // was collapsed or no tabs 9599 if ( options.active === false || !this.anchors.length ) { 9600 options.active = false; 9601 this.active = $(); 9602 // was active, but active tab is gone 9603 } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { 9604 // all remaining tabs are disabled 9605 if ( this.tabs.length === options.disabled.length ) { 9606 options.active = false; 9607 this.active = $(); 9608 // activate previous tab 9609 } else { 9610 this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); 9611 } 9612 // was active, active tab still exists 9613 } else { 9614 // make sure active index is correct 9615 options.active = this.tabs.index( this.active ); 9616 } 9617 9618 this._refresh();
vendor: 11,456 bytes, lines 9619-9936
9619 }, 9620 9621 _refresh: function() { 9622 this._setupDisabled( this.options.disabled ); 9623 this._setupEvents( this.options.event ); 9624 this._setupHeightStyle( this.options.heightStyle ); 9625 9626 this.tabs.not( this.active ).attr({ 9627 "aria-selected": "false", 9628 "aria-expanded": "false", 9629 tabIndex: -1 9630 }); 9631 this.panels.not( this._getPanelForTab( this.active ) ) 9632 .hide() 9633 .attr({ 9634 "aria-hidden": "true" 9635 }); 9636 9637 // Make sure one tab is in the tab order 9638 if ( !this.active.length ) { 9639 this.tabs.eq( 0 ).attr( "tabIndex", 0 ); 9640 } else { 9641 this.active 9642 .addClass( "ui-tabs-active ui-state-active" ) 9643 .attr({ 9644 "aria-selected": "true", 9645 "aria-expanded": "true", 9646 tabIndex: 0 9647 }); 9648 this._getPanelForTab( this.active ) 9649 .show() 9650 .attr({ 9651 "aria-hidden": "false" 9652 }); 9653 } 9654 }, 9655 9656 _processTabs: function() { 9657 var that = this, 9658 prevTabs = this.tabs, 9659 prevAnchors = this.anchors, 9660 prevPanels = this.panels; 9661 9662 this.tablist = this._getList() 9663 .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ) 9664 .attr( "role", "tablist" ) 9665 9666 // Prevent users from focusing disabled tabs via click 9667 .delegate( "> li", "mousedown" + this.eventNamespace, function( event ) { 9668 if ( $( this ).is( ".ui-state-disabled" ) ) { 9669 event.preventDefault(); 9670 } 9671 }) 9672 9673 // support: IE <9 9674 // Preventing the default action in mousedown doesn't prevent IE 9675 // from focusing the element, so if the anchor gets focused, blur. 9676 // We don't have to worry about focusing the previously focused 9677 // element since clicking on a non-focusable element should focus 9678 // the body anyway. 9679 .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() { 9680 if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) { 9681 this.blur(); 9682 } 9683 }); 9684 9685 this.tabs = this.tablist.find( "> li:has(a[href])" ) 9686 .addClass( "ui-state-default ui-corner-top" ) 9687 .attr({ 9688 role: "tab", 9689 tabIndex: -1 9690 }); 9691 9692 this.anchors = this.tabs.map(function() { 9693 return $( "a", this )[ 0 ]; 9694 }) 9695 .addClass( "ui-tabs-anchor" ) 9696 .attr({ 9697 role: "presentation", 9698 tabIndex: -1 9699 }); 9700 9701 this.panels = $(); 9702 9703 this.anchors.each(function( i, anchor ) { 9704 var selector, panel, panelId, 9705 anchorId = $( anchor ).uniqueId().attr( "id" ), 9706 tab = $( anchor ).closest( "li" ), 9707 originalAriaControls = tab.attr( "aria-controls" ); 9708 9709 // inline tab 9710 if ( that._isLocal( anchor ) ) { 9711 selector = anchor.hash; 9712 panelId = selector.substring( 1 ); 9713 panel = that.element.find( that._sanitizeSelector( selector ) ); 9714 // remote tab 9715 } else { 9716 // If the tab doesn't already have aria-controls, 9717 // generate an id by using a throw-away element 9718 panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id; 9719 selector = "#" + panelId; 9720 panel = that.element.find( selector ); 9721 if ( !panel.length ) { 9722 panel = that._createPanel( panelId ); 9723 panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); 9724 } 9725 panel.attr( "aria-live", "polite" ); 9726 } 9727 9728 if ( panel.length) { 9729 that.panels = that.panels.add( panel ); 9730 } 9731 if ( originalAriaControls ) { 9732 tab.data( "ui-tabs-aria-controls", originalAriaControls ); 9733 } 9734 tab.attr({ 9735 "aria-controls": panelId, 9736 "aria-labelledby": anchorId 9737 }); 9738 panel.attr( "aria-labelledby", anchorId ); 9739 }); 9740 9741 this.panels 9742 .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) 9743 .attr( "role", "tabpanel" ); 9744 9745 // Avoid memory leaks (#10056) 9746 if ( prevTabs ) { 9747 this._off( prevTabs.not( this.tabs ) ); 9748 this._off( prevAnchors.not( this.anchors ) ); 9749 this._off( prevPanels.not( this.panels ) ); 9750 } 9751 }, 9752 9753 // allow overriding how to find the list for rare usage scenarios (#7715) 9754 _getList: function() { 9755 return this.tablist || this.element.find( "ol,ul" ).eq( 0 ); 9756 }, 9757 9758 _createPanel: function( id ) { 9759 return $( "<div>" ) 9760 .attr( "id", id ) 9761 .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) 9762 .data( "ui-tabs-destroy", true ); 9763 }, 9764 9765 _setupDisabled: function( disabled ) { 9766 if ( $.isArray( disabled ) ) { 9767 if ( !disabled.length ) { 9768 disabled = false; 9769 } else if ( disabled.length === this.anchors.length ) { 9770 disabled = true; 9771 } 9772 } 9773 9774 // disable tabs 9775 for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) { 9776 if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { 9777 $( li ) 9778 .addClass( "ui-state-disabled" ) 9779 .attr( "aria-disabled", "true" ); 9780 } else { 9781 $( li ) 9782 .removeClass( "ui-state-disabled" ) 9783 .removeAttr( "aria-disabled" ); 9784 } 9785 } 9786 9787 this.options.disabled = disabled; 9788 }, 9789 9790 _setupEvents: function( event ) { 9791 var events = {}; 9792 if ( event ) { 9793 $.each( event.split(" "), function( index, eventName ) { 9794 events[ eventName ] = "_eventHandler"; 9795 }); 9796 } 9797 9798 this._off( this.anchors.add( this.tabs ).add( this.panels ) ); 9799 // Always prevent the default action, even when disabled 9800 this._on( true, this.anchors, { 9801 click: function( event ) { 9802 event.preventDefault(); 9803 } 9804 }); 9805 this._on( this.anchors, events ); 9806 this._on( this.tabs, { keydown: "_tabKeydown" } ); 9807 this._on( this.panels, { keydown: "_panelKeydown" } ); 9808 9809 this._focusable( this.tabs ); 9810 this._hoverable( this.tabs ); 9811 }, 9812 9813 _setupHeightStyle: function( heightStyle ) { 9814 var maxHeight, 9815 parent = this.element.parent(); 9816 9817 if ( heightStyle === "fill" ) { 9818 maxHeight = parent.height(); 9819 maxHeight -= this.element.outerHeight() - this.element.height(); 9820 9821 this.element.siblings( ":visible" ).each(function() { 9822 var elem = $( this ), 9823 position = elem.css( "position" ); 9824 9825 if ( position === "absolute" || position === "fixed" ) { 9826 return; 9827 } 9828 maxHeight -= elem.outerHeight( true ); 9829 }); 9830 9831 this.element.children().not( this.panels ).each(function() { 9832 maxHeight -= $( this ).outerHeight( true ); 9833 }); 9834 9835 this.panels.each(function() { 9836 $( this ).height( Math.max( 0, maxHeight - 9837 $( this ).innerHeight() + $( this ).height() ) ); 9838 }) 9839 .css( "overflow", "auto" ); 9840 } else if ( heightStyle === "auto" ) { 9841 maxHeight = 0; 9842 this.panels.each(function() { 9843 maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); 9844 }).height( maxHeight ); 9845 } 9846 }, 9847 9848 _eventHandler: function( event ) { 9849 var options = this.options, 9850 active = this.active, 9851 anchor = $( event.currentTarget ), 9852 tab = anchor.closest( "li" ), 9853 clickedIsActive = tab[ 0 ] === active[ 0 ], 9854 collapsing = clickedIsActive && options.collapsible, 9855 toShow = collapsing ? $() : this._getPanelForTab( tab ), 9856 toHide = !active.length ? $() : this._getPanelForTab( active ), 9857 eventData = { 9858 oldTab: active, 9859 oldPanel: toHide, 9860 newTab: collapsing ? $() : tab, 9861 newPanel: toShow 9862 }; 9863 9864 event.preventDefault(); 9865 9866 if ( tab.hasClass( "ui-state-disabled" ) || 9867 // tab is already loading 9868 tab.hasClass( "ui-tabs-loading" ) || 9869 // can't switch durning an animation 9870 this.running || 9871 // click on active header, but not collapsible 9872 ( clickedIsActive && !options.collapsible ) || 9873 // allow canceling activation 9874 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 9875 return; 9876 } 9877 9878 options.active = collapsing ? false : this.tabs.index( tab ); 9879 9880 this.active = clickedIsActive ? $() : tab; 9881 if ( this.xhr ) { 9882 this.xhr.abort(); 9883 } 9884 9885 if ( !toHide.length && !toShow.length ) { 9886 $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); 9887 } 9888 9889 if ( toShow.length ) { 9890 this.load( this.tabs.index( tab ), event ); 9891 } 9892 this._toggle( event, eventData ); 9893 }, 9894 9895 // handles show/hide for selecting tabs 9896 _toggle: function( event, eventData ) { 9897 var that = this, 9898 toShow = eventData.newPanel, 9899 toHide = eventData.oldPanel; 9900 9901 this.running = true; 9902 9903 function complete() { 9904 that.running = false; 9905 that._trigger( "activate", event, eventData ); 9906 } 9907 9908 function show() { 9909 eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" ); 9910 9911 if ( toShow.length && that.options.show ) { 9912 that._show( toShow, that.options.show, complete ); 9913 } else { 9914 toShow.show(); 9915 complete(); 9916 } 9917 } 9918 9919 // start out by hiding, then showing, then completing 9920 if ( toHide.length && this.options.hide ) { 9921 this._hide( toHide, this.options.hide, function() { 9922 eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); 9923 show(); 9924 }); 9925 } else { 9926 eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); 9927 toHide.hide(); 9928 show(); 9929 } 9930 9931 toHide.attr( "aria-hidden", "true" ); 9932 eventData.oldTab.attr({ 9933 "aria-selected": "false", 9934 "aria-expanded": "false" 9935 }); 9936 // If we're switching tabs, remove the old tab from the tab order.
vendor: 7,729 bytes, lines 9937-10167
9937 // If we're opening from collapsed state, remove the previous tab from the tab order. 9938 // If we're collapsing, then keep the collapsing tab in the tab order. 9939 if ( toShow.length && toHide.length ) { 9940 eventData.oldTab.attr( "tabIndex", -1 ); 9941 } else if ( toShow.length ) { 9942 this.tabs.filter(function() { 9943 return $( this ).attr( "tabIndex" ) === 0; 9944 }) 9945 .attr( "tabIndex", -1 ); 9946 } 9947 9948 toShow.attr( "aria-hidden", "false" ); 9949 eventData.newTab.attr({ 9950 "aria-selected": "true", 9951 "aria-expanded": "true", 9952 tabIndex: 0 9953 }); 9954 }, 9955 9956 _activate: function( index ) { 9957 var anchor, 9958 active = this._findActive( index ); 9959 9960 // trying to activate the already active panel 9961 if ( active[ 0 ] === this.active[ 0 ] ) { 9962 return; 9963 } 9964 9965 // trying to collapse, simulate a click on the current active header 9966 if ( !active.length ) { 9967 active = this.active; 9968 } 9969 9970 anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; 9971 this._eventHandler({ 9972 target: anchor, 9973 currentTarget: anchor, 9974 preventDefault: $.noop 9975 }); 9976 }, 9977 9978 _findActive: function( index ) { 9979 return index === false ? $() : this.tabs.eq( index ); 9980 }, 9981 9982 _getIndex: function( index ) { 9983 // meta-function to give users option to provide a href string instead of a numerical index. 9984 if ( typeof index === "string" ) { 9985 index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); 9986 } 9987 9988 return index; 9989 }, 9990 9991 _destroy: function() { 9992 if ( this.xhr ) { 9993 this.xhr.abort(); 9994 } 9995 9996 this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" ); 9997 9998 this.tablist 9999 .removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ) 10000 .removeAttr( "role" ); 10001 10002 this.anchors 10003 .removeClass( "ui-tabs-anchor" ) 10004 .removeAttr( "role" ) 10005 .removeAttr( "tabIndex" ) 10006 .removeUniqueId(); 10007 10008 this.tablist.unbind( this.eventNamespace ); 10009 10010 this.tabs.add( this.panels ).each(function() { 10011 if ( $.data( this, "ui-tabs-destroy" ) ) { 10012 $( this ).remove(); 10013 } else { 10014 $( this ) 10015 .removeClass( "ui-state-default ui-state-active ui-state-disabled " + 10016 "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" ) 10017 .removeAttr( "tabIndex" ) 10018 .removeAttr( "aria-live" ) 10019 .removeAttr( "aria-busy" ) 10020 .removeAttr( "aria-selected" ) 10021 .removeAttr( "aria-labelledby" ) 10022 .removeAttr( "aria-hidden" ) 10023 .removeAttr( "aria-expanded" ) 10024 .removeAttr( "role" ); 10025 } 10026 }); 10027 10028 this.tabs.each(function() { 10029 var li = $( this ), 10030 prev = li.data( "ui-tabs-aria-controls" ); 10031 if ( prev ) { 10032 li 10033 .attr( "aria-controls", prev ) 10034 .removeData( "ui-tabs-aria-controls" ); 10035 } else { 10036 li.removeAttr( "aria-controls" ); 10037 } 10038 }); 10039 10040 this.panels.show(); 10041 10042 if ( this.options.heightStyle !== "content" ) { 10043 this.panels.css( "height", "" ); 10044 } 10045 }, 10046 10047 enable: function( index ) { 10048 var disabled = this.options.disabled; 10049 if ( disabled === false ) { 10050 return; 10051 } 10052 10053 if ( index === undefined ) { 10054 disabled = false; 10055 } else { 10056 index = this._getIndex( index ); 10057 if ( $.isArray( disabled ) ) { 10058 disabled = $.map( disabled, function( num ) { 10059 return num !== index ? num : null; 10060 }); 10061 } else { 10062 disabled = $.map( this.tabs, function( li, num ) { 10063 return num !== index ? num : null; 10064 }); 10065 } 10066 } 10067 this._setupDisabled( disabled ); 10068 }, 10069 10070 disable: function( index ) { 10071 var disabled = this.options.disabled; 10072 if ( disabled === true ) { 10073 return; 10074 } 10075 10076 if ( index === undefined ) { 10077 disabled = true; 10078 } else { 10079 index = this._getIndex( index ); 10080 if ( $.inArray( index, disabled ) !== -1 ) { 10081 return; 10082 } 10083 if ( $.isArray( disabled ) ) { 10084 disabled = $.merge( [ index ], disabled ).sort(); 10085 } else { 10086 disabled = [ index ]; 10087 } 10088 } 10089 this._setupDisabled( disabled ); 10090 }, 10091 10092 load: function( index, event ) { 10093 index = this._getIndex( index ); 10094 var that = this, 10095 tab = this.tabs.eq( index ), 10096 anchor = tab.find( ".ui-tabs-anchor" ), 10097 panel = this._getPanelForTab( tab ), 10098 eventData = { 10099 tab: tab, 10100 panel: panel 10101 }; 10102 10103 // not remote 10104 if ( this._isLocal( anchor[ 0 ] ) ) { 10105 return; 10106 } 10107 10108 this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); 10109 10110 // support: jQuery <1.8 10111 // jQuery <1.8 returns false if the request is canceled in beforeSend, 10112 // but as of 1.8, $.ajax() always returns a jqXHR object. 10113 if ( this.xhr && this.xhr.statusText !== "canceled" ) { 10114 tab.addClass( "ui-tabs-loading" ); 10115 panel.attr( "aria-busy", "true" ); 10116 10117 this.xhr 10118 .success(function( response ) { 10119 // support: jQuery <1.8 10120 // http://bugs.jquery.com/ticket/11778 10121 setTimeout(function() { 10122 panel.html( response ); 10123 that._trigger( "load", event, eventData ); 10124 }, 1 ); 10125 }) 10126 .complete(function( jqXHR, status ) { 10127 // support: jQuery <1.8 10128 // http://bugs.jquery.com/ticket/11778 10129 setTimeout(function() { 10130 if ( status === "abort" ) { 10131 that.panels.stop( false, true ); 10132 } 10133 10134 tab.removeClass( "ui-tabs-loading" ); 10135 panel.removeAttr( "aria-busy" ); 10136 10137 if ( jqXHR === that.xhr ) { 10138 delete that.xhr; 10139 } 10140 }, 1 ); 10141 }); 10142 } 10143 }, 10144 10145 _ajaxSettings: function( anchor, event, eventData ) { 10146 var that = this; 10147 return { 10148 url: anchor.attr( "href" ), 10149 beforeSend: function( jqXHR, settings ) { 10150 return that._trigger( "beforeLoad", event, 10151 $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) ); 10152 } 10153 }; 10154 }, 10155 10156 _getPanelForTab: function( tab ) { 10157 var id = $( tab ).attr( "aria-controls" ); 10158 return this.element.find( this._sanitizeSelector( "#" + id ) ); 10159 } 10160}); 10161 10162})); 10163/* 10164============================================================== 10165jquery.ui.tabs.js END 10166============================================================== 10167*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.