https://red-cat-114218.hostingersite.com/wp-content/plugins/gum-el…/js/jquery.superslides.js?ver=1.0
1/*! Superslides - v0.6.3-wip - 2013-12-17 2* https://github.com/nicinabox/superslides 3* Copyright (c) 2013 Nic Aitch; Licensed MIT */ 4/* slide-in slide-out by atawai */ 5(function(window, $) { 6 7var Superslides, plugin = 'superslides'; 8 9Superslides = function(el, options) { 10 this.options = $.extend({ 11 play: false, 12 animation_speed: 600, 13 animation_easing: 'swing', 14 animation: 'slide', 15 inherit_width_from: window, 16 inherit_height_from: window, 17 pagination: true, 18 hashchange: false, 19 scrollable: true, 20 elements: { 21 preserve: '.preserve', 22 nav: '.slides-navigation', 23 container: '.slides-container', 24 pagination: '.slides-pagination' 25 } 26 }, options); 27 28 var that = this, 29 $control = $('<div>', { "class": 'slides-control' }), 30 multiplier = 1; 31 32 this.$el = $(el); 33 this.$container = this.$el.find(this.options.elements.container); 34 35 // Private Methods 36 var initialize = function() { 37 multiplier = that._findMultiplier(); 38 39 that.$el.on('click', that.options.elements.nav + " a", function(e) { 40 e.preventDefault(); 41 42 that.stop(); 43 if ($(this).hasClass('next')) { 44 that.animate('next', function() { 45 that.start(); 46 }); 47 } else { 48 that.animate('prev', function() { 49 that.start(); 50 }); 51 } 52 }); 53 54 $(document).on('keyup', function(e) { 55 if (e.keyCode === 37) { 56 that.animate('prev'); 57 } 58 if (e.keyCode === 39) { 59 that.animate('next'); 60 } 61 }); 62 63 $(window).on('resize', function() { 64 setTimeout(function() { 65 var $children = that.$container.children(); 66 67 that.width = that._findWidth(); 68 that.height = that._findHeight(); 69 70 $children.css({ 71 width: that.width, 72 left: that.width 73 }); 74 75 that.css.containers(); 76 that.css.images(); 77 }, 10); 78 }); 79 80 if (that.options.hashchange) { 81 $(window).on('hashchange', function() { 82 var hash = that._parseHash(), index; 83 84 index = that._upcomingSlide(hash); 85 86 if (index >= 0 && index !== that.current) { 87 that.animate(index); 88 } 89 }); 90 } 91 92 that.pagination._events(); 93 94 that.start(); 95 return that; 96 }; 97 98var css = { 99 containers: function() { 100 if (that.init) { 101 that.$el.css({ 102 height: that.height 103 }); 104 105 that.$control.css({ 106 width: that.width * multiplier, 107 left: -that.width 108 }); 109 110 that.$container.css({ 111 112 }); 113 } else { 114 $('body').css({ 115 margin: 0 116 }); 117 118 that.$el.css({ 119 position: 'relative', 120 overflow: 'hidden', 121 width: '100%', 122 height: that.height 123 }); 124 125 that.$control.css({ 126 position: 'relative', 127 transform: 'translate3d(0)', 128 height: '100%', 129 width: that.width * multiplier, 130 left: -that.width 131 }); 132 133 that.$container.css({ 134 display: 'none', 135 margin: '0', 136 padding: '0', 137 listStyle: 'none', 138 position: 'relative', 139 height: '100%' 140 }); 141 } 142 143 if (that.size() === 1) { 144 that.$el.find(that.options.elements.nav).hide(); 145 } 146 }, 147 images: function() { 148 var $images = that.$container.find('img') 149 .not(that.options.elements.preserve) 150 151 $images.removeAttr('width').removeAttr('height') 152 .css({ 153 "-webkit-backface-visibility": 'hidden', 154 "-ms-interpolation-mode": 'bicubic', 155 "position": 'absolute', 156 "left": '0', 157 "top": '0', 158 "z-index": '-1', 159 "max-width": 'none' 160 }); 161 162 $images.each(function() { 163 var image_aspect_ratio = that.image._aspectRatio(this), 164 image = this; 165 166 if (!$.data(this, 'processed')) { 167 var img = new Image(); 168 img.onload = function() { 169 that.image._scale(image, image_aspect_ratio); 170 that.image._center(image, image_aspect_ratio); 171 $.data(image, 'processed', true); 172 }; 173 img.src = this.src; 174 175 } else { 176 that.image._scale(image, image_aspect_ratio); 177 that.image._center(image, image_aspect_ratio); 178 } 179 }); 180 }, 181 children: function() { 182 var $children = that.$container.children(); 183 184 if ($children.is('img')) { 185 $children.each(function() { 186 if ($(this).is('img')) { 187 $(this).wrap('<div>'); 188 189 // move id attribute 190 var id = $(this).attr('id'); 191 $(this).removeAttr('id'); 192 $(this).parent().attr('id', id); 193 } 194 }); 195 196 $children = that.$container.children(); 197 } 198 199 if (!that.init) { 200 $children.css({ 201 display: 'none', 202 left: that.width * 2 203 }); 204 } 205 206 $children.css({ 207 position: 'absolute', 208 overflow: 'hidden', 209 height: '100%', 210 width: that.width, 211 top: 0, 212 zIndex: 0 213 }); 214 215 } 216} 217 218var fx = { 219 slide: function(orientation, complete) { 220 var $children = that.$container.children(), 221 $outgoing = $children.eq(orientation.outgoing_slide), 222 $target = $children.eq(orientation.upcoming_slide); 223 224 $target.addClass('slide-in'); 225 $target.css({ 226 left: orientation.upcoming_position, 227 display: 'block' 228 }).animate({ 229 opacity: 1, 230 }, 231 that.options.animation_speed, 232 that.options.animation_easing, 233 function(){ 234 $target.removeClass('slide-in'); 235 } 236 ); 237 238 $outgoing.removeClass('slide-in').addClass('slide-out'); 239 240 that.$control.animate({ 241 left: orientation.offset 242 }, 243 that.options.animation_speed, 244 that.options.animation_easing, 245 function() { 246 if (that.size() > 1) { 247 that.$control.css({ 248 left: -that.width 249 }); 250 251 $children.eq(orientation.upcoming_slide).css({ 252 left: that.width, 253 zIndex: 2 254 }); 255 256 if (orientation.outgoing_slide >= 0) { 257 $children.eq(orientation.outgoing_slide).css({ 258 left: that.width, 259 display: 'none', 260 zIndex: 0 261 }); 262 263 } 264 } 265 $children.eq(orientation.outgoing_slide).removeClass('slide-out'); 266 complete(); 267 }); 268 }, 269 fade: function(orientation, complete) { 270 var that = this, 271 $children = that.$container.children(), 272 $outgoing = $children.eq(orientation.outgoing_slide), 273 $target = $children.eq(orientation.upcoming_slide); 274 275 $target.addClass('slide-in'); 276 $target.css({ 277 left: this.width, 278 opacity: 0, 279 display: 'block' 280 }).animate({ 281 opacity: 1 282 }, 283 that.options.animation_speed, 284 that.options.animation_easing, 285 function(){ 286 $target.removeClass('slide-in'); 287 } 288 ); 289 290 if (orientation.outgoing_slide >= 0) { 291 $outgoing.removeClass('slide-in').addClass('slide-out'); 292 $outgoing.animate({ 293 opacity: 0 294 }, 295 that.options.animation_speed, 296 that.options.animation_easing, 297 function() { 298 if (that.size() > 1) { 299 $children.eq(orientation.upcoming_slide).css({ 300 zIndex: 2 301 }); 302 303 304 if (orientation.outgoing_slide >= 0) { 305 $children.eq(orientation.outgoing_slide).css({ 306 opacity: 1, 307 display: 'none', 308 zIndex: 0 309 }); 310 311 } 312 313 } 314 315 $children.eq(orientation.outgoing_slide).removeClass('slide-out'); 316 complete(); 317 }); 318 } else { 319 $target.css({ 320 zIndex: 2 321 }); 322 323 complete(); 324 } 325 } 326}; 327 328fx = $.extend(fx, $.fn.superslides.fx); 329 330var image = { 331 _centerY: function(image) { 332 var $img = $(image); 333 334 $img.css({ 335 top: (that.height - $img.height()) / 2 336 }); 337 }, 338 _centerX: function(image) { 339 var $img = $(image); 340 341 $img.css({ 342 left: (that.width - $img.width()) / 2 343 }); 344 }, 345 _center: function(image) { 346 that.image._centerX(image); 347 that.image._centerY(image); 348 }, 349 _aspectRatio: function(image) {
350 if (!image.naturalHeight && !image.naturalWidth) { 351 var img = new Image(); 352 img.src = image.src; 353 image.naturalHeight = img.height; 354 image.naturalWidth = img.width; 355 } 356 357 return image.naturalHeight / image.naturalWidth; 358 }, 359 _scale: function(image, image_aspect_ratio) { 360 image_aspect_ratio = image_aspect_ratio || that.image._aspectRatio(image); 361 362 var container_aspect_ratio = that.height / that.width, 363 $img = $(image); 364 365 if (container_aspect_ratio > image_aspect_ratio) { 366 $img.css({ 367 height: that.height, 368 width: that.height / image_aspect_ratio 369 }); 370 371 } else { 372 $img.css({ 373 height: that.width * image_aspect_ratio, 374 width: that.width 375 }); 376 } 377 } 378}; 379 380var pagination = { 381 _setCurrent: function(i) { 382 if (!that.$pagination) { return; } 383 384 var $pagination_children = that.$pagination.children(); 385 386 $pagination_children.removeClass('current'); 387 $pagination_children.eq(i) 388 .addClass('current'); 389 }, 390 _addItem: function(i) { 391 var slide_number = i + 1, 392 href = slide_number, 393 $slide = that.$container.children().eq(i), 394 slide_id = $slide.attr('id'); 395 396 if (slide_id) { 397 href = slide_id; 398 } 399 400 var $item = $("<a>", { 401 'href': "#" + href, 402 'text': href 403 }); 404 405 $item.appendTo(that.$pagination); 406 }, 407 _setup: function() { 408 if (!that.options.pagination || that.size() === 1) { return; } 409 410 var $pagination = $("<nav>", { 411 'class': that.options.elements.pagination.replace(/^\./, '') 412 }); 413 414 that.$pagination = $pagination.appendTo(that.$el); 415 416 for (var i = 0; i < that.size(); i++) { 417 that.pagination._addItem(i); 418 } 419 }, 420 _events: function() { 421 that.$el.on('click', that.options.elements.pagination + ' a', function(e) { 422 e.preventDefault(); 423 424 var hash = that._parseHash(this.hash), index; 425 index = that._upcomingSlide(hash, true); 426 427 if (index !== that.current) { 428 that.animate(index, function() { 429 that.start(); 430 }); 431 } 432 }); 433 } 434}; 435 436 this.css = css; 437 this.image = image; 438 this.pagination = pagination; 439 this.fx = fx; 440 this.animation = this.fx[this.options.animation]; 441 442 this.$control = this.$container.wrap($control).parent('.slides-control'); 443 444 that._findPositions(); 445 that.width = that._findWidth(); 446 that.height = that._findHeight(); 447 448 this.css.children(); 449 this.css.containers(); 450 this.css.images(); 451 this.pagination._setup(); 452 453 return initialize(); 454}; 455 456Superslides.prototype = { 457 _findWidth: function() { 458 return $(this.options.inherit_width_from).width(); 459 }, 460 _findHeight: function() { 461 462 return $(this.options.inherit_height_from).height(); 463 }, 464 465 _findMultiplier: function() { 466 return this.size() === 1 ? 1 : 3; 467 }, 468 469 _upcomingSlide: function(direction, from_hash_change) { 470 if (from_hash_change && !isNaN(direction)) { 471 direction = direction - 1; 472 } 473 474 if ((/next/).test(direction)) { 475 return this._nextInDom(); 476 477 } else if ((/prev/).test(direction)) { 478 return this._prevInDom(); 479 480 } else if ((/\d/).test(direction)) { 481 return +direction; 482 483 } else if (direction && (/\w/).test(direction)) { 484 485 var index = this._findSlideById(direction); 486 if (index >= 0) { 487 return index; 488 } else { 489 return 0; 490 } 491 492 } else { 493 return 0; 494 } 495 }, 496 497 _findSlideById: function(id) { 498 return this.$container.find('#' + id).index(); 499 }, 500 501 _findPositions: function(current, thisRef) { 502 thisRef = thisRef || this; 503 504 if (current === undefined) { 505 current = -1; 506 } 507 508 thisRef.current = current; 509 thisRef.next = thisRef._nextInDom(); 510 thisRef.prev = thisRef._prevInDom(); 511 }, 512 513 _nextInDom: function() { 514 var index = this.current + 1; 515 516 if (index === this.size()) { 517 index = 0; 518 } 519 520 return index; 521 }, 522 523 _prevInDom: function() { 524 var index = this.current - 1; 525 526 if (index < 0) { 527 index = this.size() - 1; 528 } 529 530 return index; 531 }, 532 533 _parseHash: function(hash) { 534 hash = hash || window.location.hash; 535 hash = hash.replace(/^#/, ''); 536 537 if (hash && !isNaN(+hash)) { 538 hash = +hash; 539 } 540 541 return hash; 542 }, 543 544 size: function() { 545 return this.$container.children().length; 546 }, 547 548 destroy: function() { 549 return this.$el.removeData(); 550 }, 551 552 update: function() { 553 this.css.children(); 554 this.css.containers(); 555 this.css.images(); 556 557 this.pagination._addItem(this.size()) 558 559 this._findPositions(this.current); 560 this.$el.trigger('updated.slides'); 561 }, 562 563 stop: function() { 564 clearInterval(this.play_id); 565 delete this.play_id; 566 567 this.$el.trigger('stopped.slides'); 568 }, 569 570 start: function() { 571 var that = this; 572 573 if (that.options.hashchange) { 574 $(window).trigger('hashchange'); 575 } else { 576 this.animate(); 577 } 578 579 if (this.options.play) { 580 if (this.play_id) { 581 this.stop(); 582 } 583 584 this.play_id = setInterval(function() { 585 that.animate(); 586 }, this.options.play); 587 } 588 589 this.$el.trigger('started.slides'); 590 }, 591 592 animate: function(direction, userCallback) { 593 var that = this, 594 orientation = {}; 595 596 if (this.animating) { 597 return; 598 } 599 600 this.animating = true; 601 602 if (direction === undefined) {
603 direction = 'next'; 604 } 605 606 orientation.upcoming_slide = this._upcomingSlide(direction); 607 608 if (orientation.upcoming_slide >= this.size()) { 609 return; 610 } 611 612 orientation.outgoing_slide = this.current; 613 orientation.upcoming_position = this.width * 2; 614 orientation.offset = -orientation.upcoming_position; 615 616 if (direction === 'prev' || direction < orientation.outgoing_slide) { 617 orientation.upcoming_position = 0; 618 orientation.offset = 0; 619 } 620 621 if (that.size() > 1) { 622 that.pagination._setCurrent(orientation.upcoming_slide); 623 } 624 625 if (that.options.hashchange) { 626 var hash = orientation.upcoming_slide + 1, 627 id = that.$container.children(':eq(' + orientation.upcoming_slide + ')').attr('id'); 628 629 if (id) { 630 window.location.hash = id; 631 } else { 632 window.location.hash = hash; 633 } 634 } 635 if (that.size() === 1) { 636 that.stop(); 637 that.options.play = 0; 638 that.options.animation_speed = 0; 639 orientation.upcoming_slide = 0; 640 orientation.outgoing_slide = -1; 641 } 642 that.$el.trigger('animating.slides', [orientation]); 643 644 that.animation(orientation, function() { 645 that._findPositions(orientation.upcoming_slide, that); 646 647 if (typeof userCallback === 'function') { 648 userCallback(); 649 } 650 651 that.animating = false; 652 that.$el.trigger('animated.slides'); 653 654 if (!that.init) { 655 that.$el.trigger('init.slides'); 656 that.init = true; 657 that.$container.fadeIn('fast'); 658 } 659 }); 660 } 661}; 662 663// jQuery plugin definition 664 665$.fn[plugin] = function(option, args) { 666 var result = []; 667 668 this.each(function() { 669 var $this, data, options; 670 671 $this = $(this); 672 data = $this.data(plugin); 673 options = typeof option === 'object' && option; 674 675 if (!data) { 676 result = $this.data(plugin, (data = new Superslides(this, options))); 677 } 678 679 if (typeof option === "string") { 680 result = data[option]; 681 if (typeof result === 'function') { 682 return result = result.call(data, args); 683 } 684 } 685 }); 686 687 return result; 688}; 689 690$.fn[plugin].fx = {}; 691 692})(this, jQuery);
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.