PageSourceSearch

https://www.bccard.com/js/ui/jquery.slides.js

js bccard.com collected 2026-09-24 18:14:56 UTC 21,814 bytes, 600 lines download raw bytes

1// Generated by CoffeeScript 1.6.1
2(function() {
3
4  (function($, window, document) {
5    var Plugin, defaults, pluginName;
6    pluginName = "slidesjs";
7    defaults = {
8      width: 940,
9      height: 528,
10      start: 1,
11      navigation: {
12        active: true,
13        effect: "slide"
14      },
15      pagination: {
16        active: true,
17        effect: "slide"
18      },
19      play: {
20        active: false,
21        effect: "slide",
22        interval: 5000,
23        auto: false,
24        swap: true,
25        pauseOnHover: false,
26        restartDelay: 2500
27      },
28      effect: {
29        slide: {
30          speed: 500
31        },
32        fade: {
33          speed: 300,
34          crossfade: true
35        }
36      },
37      callback: {
38        loaded: function() {},
39        start: function() {},
40        complete: function() {}
41      }
42    };
43    Plugin = (function() {
44
45      function Plugin(element, options) {
46        this.element = element;
47        this.options = $.extend(true, {}, defaults, options);
48        this._defaults = defaults;
49        this._name = pluginName;
50        this.init();
51      }
52
53      return Plugin;
54
55    })();
56    Plugin.prototype.init = function() {
57      var $element, nextButton, pagination, playButton, prevButton, stopButton,
58        _this = this;
59      $element = $(this.element);
60      this.data = $.data(this);
61      $.data(this, "animating", false);
62      $.data(this, "total", $element.children().not(".slidesjs-navigation", $element).length);
63      $.data(this, "current", this.options.start - 1);
64      $.data(this, "vendorPrefix", this._getVendorPrefix());
65      if (typeof TouchEvent !== "undefined") {
66        $.data(this, "touch", true);
67        this.options.effect.slide.speed = this.options.effect.slide.speed / 2;
68      }
69      $element.css({
70        overflow: "hidden"
71      });
72      $element.slidesContainer = $element.children().not(".slidesjs-navigation", $element).wrapAll("<div class='slidesjs-container'>", $element).parent().css({
73        overflow: "hidden",
74        position: "relative"
75      });
76      $(".slidesjs-container", $element).wrapInner("<div class='slidesjs-control'>", $element).children();
77      $(".slidesjs-control", $element).css({
78        position: "relative",
79        left: 0
80      });
81      $(".slidesjs-control", $element).children().addClass("slidesjs-slide").css({
82        position: "absolute",
83        top: 0,
84        left: 0,
85        width: "100%",
86        zIndex: 0,
87        display: "none",
88        webkitBackfaceVisibility: "hidden"
89      });
90      $.each($(".slidesjs-control", $element).children(), function(i) {
91        var $slide;
92        $slide = $(this);
93        return $slide.attr("slidesjs-index", i);
94      });
95      if (this.data.touch) {
96        $(".slidesjs-control", $element).on("touchstart", function(e) {
97          return _this._touchstart(e);
98        });
99        $(".slidesjs-control", $element).on("touchmove", function(e) {
100          return _this._touchmove(e);
101        });
102        $(".slidesjs-control", $element).on("touchend", function(e) {
103          return _this._touchend(e);
104        });
105      }
106      $element.fadeIn(0);
107      this.update();
108      if (this.data.touch) {
109        this._setuptouch();
110      }
111      $(".slidesjs-control", $element).children(":eq(" + this.data.current + ")").eq(0).fadeIn(0, function() {
112        return $(this).css({
113          zIndex: 10
114        });
115      });
116	  /* 이전, 다음 임시 주석
117      if (this.options.navigation.active) {
118        prevButton = $("<a>", {
119          "class": "slidesjs-previous slidesjs-navigation",
120          href: "#",
121          title: "Previous",
122          text: "Previous"
123        }).appendTo($element);
124        nextButton = $("<a>", {
125          "class": "slidesjs-next slidesjs-navigation",
126          href: "#",
127          title: "Next",
128          text: "Next"
129        }).appendTo($element);
130      }
131      $(".slidesjs-next", $element).click(function(e) {
132        e.preventDefault();
133        _this.stop(true);
134        return _this.next(_this.options.navigation.effect);
135      });
136      $(".slidesjs-previous", $element).click(function(e) {
137        e.preventDefault();
138        _this.stop(true);
139        return _this.previous(_this.options.navigation.effect);
140      });
141	  */
142      if (this.options.play.active) {
143        playButton = $("<a>", {
144          "class": "slidesjs-play slidesjs-navigation",
145          href: "#",
146          title: "Play",
147          text: "Play"
148        }).appendTo($element);
149        stopButton = $("<a>", {
150          "class": "slidesjs-stop slidesjs-navigation",
151          href: "#",
152          title: "Stop",
153          text: "Stop"
154        }).appendTo($element);
155        playButton.click(function(e) {
156          e.preventDefault();
157          return _this.play(true);
158        });
159        stopButton.click(function(e) {
160          e.preventDefault();
161          return _this.stop(true);
162        });
163        if (this.options.play.swap) {
164          stopButton.css({
165            display: "none"
166          });
167        }
168      }
169      if (this.options.pagination.active) {
170        pagination = $("<ul>", {
171          "class": "slidesjs-pagination"
172        }).appendTo($element);
173        $.each(new Array(this.data.total), function(i) {
174          var paginationItem, paginationLink;
175          paginationItem = $("<li>", {
176            "class": "slidesjs-pagination-item"
177          }).appendTo(pagination);
178          paginationLink = $("<a>", {
179            href: "#",
180            "data-slidesjs-item": i,
181            html: i + 1
182          }).appendTo(paginationItem);
183          return paginationLink.click(function(e) {
184            e.preventDefault();
185            _this.stop(true);
186            return _this.goto(($(e.currentTarget).attr("data-slidesjs-item") * 1) + 1);
187          });
188        });
189      }
190      $(window).bind("resize", function() {
191        return _this.update();
192      });
193      this._setActive();
194      if (this.options.play.auto) {
195        this.play();
196      }
197      return this.options.callback.loaded(this.options.start);
198    };
199    Plugin.prototype._setActive = function(number) {
200      var $element, current;
201      $element = $(this.element);
202      this.data = $.data(this);
203      current = number > -1 ? number : this.data.current;
204      $(".active", $element).removeClass("active");
205      return $(".slidesjs-pagination li:eq(" + current + ") a", $element).addClass("active");
206    };
207    Plugin.prototype.update = function() {
208      var $element, height, width;
209      $element = $(this.element);
210      this.data = $.data(this);
211      $(".slidesjs-control", $element).children(":not(:eq(" + this.data.current + "))").css({
212        display: "none",
213        left: 0,
214        zIndex: 0
215      });
216      width = $element.width();
217      height = (this.options.height / this.options.width) * width;
218      this.options.width = width;
219      this.options.height = height;
220      return $(".slidesjs-control, .slidesjs-container", $element).css({
221        width: width,
222        height: height
223      });
224    };
225    Plugin.prototype.next = function(effect) {
226      var $element;
227      $element = $(this.element);
228      this.data = $.data(this);
229      $.data(this, "direction", "next");
230      if (effect === void 0) {
231        effect = this.options.navigation.effect;
232      }
233      if (effect === "fade") {
234        return this._fade();
235      } else {
236        return this._slide();
237      }
238    };
239    Plugin.prototype.previous = function(effect) {
240      var $element;
241      $element = $(this.element);
242      this.data = $.data(this);
243      $.data(this, "direction", "previous");
244      if (effect === void 0) {
245        effect = this.options.navigation.effect;
246      }
247      if (effect === "fade") {
248        return this._fade();
249      } else {
250        return this._slide();
251      }
252    };
253    Plugin.prototype.goto = function(number) {
254      var $element, effect;
255      $element = $(this.element);
256      this.data = $.data(this);
257      if (effect === void 0) {
258        effect = this.options.pagination.effect;
259      }
260      if (number > this.data.total) {
261        number = this.data.total;
262      } else if (number < 1) {
263        number = 1;
264      }
265      if (typeof number === "number") {
266        if (effect === "fade") {
267          return this._fade(number);
268        } else {
269          return this._slide(number);
270        }
271      } else if (typeof number === "string") {
272        if (number === "first") {
273          if (effect === "fade") {
274            return this._fade(0);
275          } else {
276            return this._slide(0);
277          }
278        } else if (number === "last") {
279          if (effect === "fade") {
280            return this._fade(this.data.total);
281          } else {
282            return this._slide(this.data.total);
283          }
284        }
285      }
286    };
287    Plugin.prototype._setuptouch = function() {
288      var $element, next, previous, slidesControl;
289      $element = $(this.element);
290      this.data = $.data(this);
291      slidesControl = $(".slidesjs-control", $element);
292      next = this.data.current + 1;
293      previous = this.data.current - 1;
294      if (previous < 0) {
295        previous = this.data.total - 1;
296      }
297      if (next > this.data.total - 1) {
298        next = 0;
299      }
300      slidesControl.children(":eq(" + next + ")").css({
301        display: "block",
302        left: this.options.width
303      });
304      return slidesControl.children(":eq(" + previous + ")").css({
305        display: "block",
306        left: -this.options.width
307      });
308    };
309    Plugin.prototype._touchstart = function(e) {
310      var $element, touches;
311      $element = $(this.element);
312      this.data = $.data(this);
313      touches = e.originalEvent.touches[0];
314      this._setuptouch();
315      $.data(this, "touchtimer", Number(new Date()));
316      $.data(this, "touchstartx", touches.pageX);
317      $.data(this, "touchstarty", touches.pageY);
318      return e.stopPropagation();
319    };
320    Plugin.prototype._touchend = function(e) {
321      var $element, duration, prefix, slidesControl, timing, touches, transform,
322        _this = this;
323      $element = $(this.element);
324      this.data = $.data(this);
325      touches = e.originalEvent.touches[0];
326      slidesControl = $(".slidesjs-control", $element);
327      if (slidesControl.position().left > this.options.width * 0.5 || slidesControl.position().left > this.options.width * 0.1 && (Number(new Date()) - this.data.touchtimer < 250)) {
328        $.data(this, "direction", "previous");
329        this._slide();
330      } else if (slidesControl.position().left < -(this.options.width * 0.5) || slidesControl.position().left < -(this.options.width * 0.1) && (Number(new Date()) - this.data.touchtimer < 250)) {
331        $.data(this, "direction", "next");
332        this._slide();
333      } else {
334        prefix = this.data.vendorPrefix;
335        transform = prefix + "Transform";
336        duration = prefix + "TransitionDuration";
337        timing = prefix + "TransitionTimingFunction";
338        slidesControl[0].style[transform] = "translateX(0px)";
339        slidesControl[0].style[duration] = this.options.effect.slide.speed * 0.85 + "ms";
340      }
341      slidesControl.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function() {
342        prefix = _this.data.vendorPrefix;
343        transform = prefix + "Transform";
344        duration = prefix + "TransitionDuration";
345        timing = prefix + "TransitionTimingFunction";
346        slidesControl[0].style[transform] = "";
347        slidesControl[0].style[duration] = "";
348        return slidesControl[0].style[timing] = "";
349      });
350      return e.stopPropagation();
351    };
352    Plugin.prototype._touchmove = function(e) {
353      var $element, prefix, slidesControl, touches, transform;
354      $element = $(this.element);
355      this.data = $.data(this);
356      touches = e.originalEvent.touches[0];
357      prefix = this.data.vendorPrefix;
358      slidesControl = $(".slidesjs-control", $element);
359      transform = prefix + "Transform";
360      $.data(this, "scrolling", Math.abs(touches.pageX - this.data.touchstartx) < Math.abs(touches.pageY - this.data.touchstarty));
361      if (!this.data.animating && !this.data.scrolling) {
362        e.preventDefault();
363        this._setuptouch();
364        slidesControl[0].style[transform] = "translateX(" + (touches.pageX - this.data.touchstartx) + "px)";
365      }
366      return e.stopPropagation();
367    };
368    Plugin.prototype.play = function(next) {
369      var $element, currentSlide, slidesContainer,
370        _this = this;
371      $element = $(this.element);
372      this.data = $.data(this);
373      if (!this.data.playInterval) {
374        if (next) {
375          currentSlide = this.data.current;
376          this.data.direction = "next";
377          if (this.options.play.effect === "fade") {
378            this._fade();
379          } else {
380            this._slide();
381          }
382        }
383        $.data(this, "playInterval", setInterval((function() {
384          currentSlide = _this.data.current;
385          _this.data.direction = "next";
386          if (_this.options.play.effect === "fade") {
387            return _this._fade();
388          } else {
389            return _this._slide();
390          }
391        }), this.options.play.interval));
392        slidesContainer = $(".slidesjs-container", $element);
393        if (this.options.play.pauseOnHover) {
394          slidesContainer.unbind();
395          slidesContainer.bind("mouseenter", function() {
396            return _this.stop();
397          });
398          slidesContainer.bind("mouseleave", function() {
399            if (_this.options.play.restartDelay) {
400              return $.data(_this, "restartDelay", setTimeout((function() {
401                return _this.play(true);
402              }), _this.options.play.restartDelay));
403            } else {
404              return _this.play();
405            }
406          });
407        }
408        $.data(this, "playing", true);
409        $(".slidesjs-play", $element).addClass("slidesjs-playing");
410        if (this.options.play.swap) {
411          $(".slidesjs-play", $element).hide();
412          return $(".slidesjs-stop", $element).show();
413        }
414      }
415    };
416    Plugin.prototype.stop = function(clicked) {
417      var $element;
418      $element = $(this.element);
419      this.data = $.data(this);
420      clearInterval(this.data.playInterval);
421      if (this.options.play.pauseOnHover && clicked) {
422        $(".slidesjs-container", $element).unbind();
423      }
424      $.data(this, "playInterval", null);
425      $.data(this, "playing", false);
426      $(".slidesjs-play", $element).removeClass("slidesjs-playing");
427      if (this.options.play.swap) {
428        $(".slidesjs-stop", $element).hide();
429        return $(".slidesjs-play", $element).show();
430      }
431    };
432    Plugin.prototype._slide = function(number) {
433      var $element, currentSlide, direction, duration, next, prefix, slidesControl, timing, transform, value,
434        _this = this;
435      $element = $(this.element);
436      this.data = $.data(this);
437      if (!this.data.animating && number !== this.data.current + 1) {
438        $.data(this, "animating", true);
439        currentSlide = this.data.current;
440        if (number > -1) {
441          number = number - 1;
442          value = number > currentSlide ? 1 : -1;
443          direction = number > currentSlide ? -this.options.width : this.options.width;
444          next = number;
445        } else {
446          value = this.data.direction === "next" ? 1 : -1;
447          direction = this.data.direction === "next" ? -this.options.width : this.options.width;
448          next = currentSlide + value;
449        }
450        if (next === -1) {
451          next = this.data.total - 1;
452        }
453        if (next === this.data.total) {
454          next = 0;
455        }
456        this._setActive(next);
457        slidesControl = $(".slidesjs-control", $element);
458        if (number > -1) {
459          slidesControl.children(":not(:eq(" + currentSlide + "))").css({
460            display: "none",
461            left: 0,
462            zIndex: 0
463          });
464        }
465        slidesControl.children(":eq(" + next + ")").css({
466          display: "block",
467          left: value * this.options.width,
468          zIndex: 10
469        });
470        this.options.callback.start(currentSlide + 1);
471        if (this.data.vendorPrefix) {
472          prefix = this.data.vendorPrefix;
473          transform = prefix + "Transform";
474          duration = prefix + "TransitionDuration";
475          timing = prefix + "TransitionTimingFunction";
476          slidesControl[0].style[transform] = "translateX(" + direction + "px)";
477          slidesControl[0].style[duration] = this.options.effect.slide.speed + "ms";
478          return slidesControl.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function() {
479            slidesControl[0].style[transform] = "";
480            slidesControl[0].style[duration] = "";
481            slidesControl.children(":eq(" + next + ")").css({
482              left: 0
483            });
484            slidesControl.children(":eq(" + currentSlide + ")").css({
485              display: "none",
486              left: 0,
487              zIndex: 0
488            });
489            $.data(_this, "current", next);
490            $.data(_this, "animating", false);
491            slidesControl.unbind("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd");
492            slidesControl.children(":not(:eq(" + next + "))").css({
493              display: "none",
494              left: 0,
495              zIndex: 0
496            });
497            if (_this.data.touch) {
498              _this._setuptouch();
499            }
500            return _this.options.callback.complete(next + 1);
501          });
502        } else {
503          return slidesControl.stop().animate({
504            left: direction
505          }, this.options.effect.slide.speed, (function() {
506            slidesControl.css({
507              left: 0
508            });
509            slidesControl.children(":eq(" + next + ")").css({
510              left: 0
511            });
512            return slidesControl.children(":eq(" + currentSlide + ")").css({
513              display: "none",
514              left: 0,
515              zIndex: 0
516            }, $.data(_this, "current", next), $.data(_this, "animating", false), _this.options.callback.complete(next + 1));
517          }));
518        }
519      }
520    };
521    Plugin.prototype._fade = function(number) {
522      var $element, currentSlide, next, slidesControl, value,
523        _this = this;
524      $element = $(this.element);
525      this.data = $.data(this);
526      if (!this.data.animating && number !== this.data.current + 1) {
527        $.data(this, "animating", true);
528        currentSlide = this.data.current;
529        if (number) {
530          number = number - 1;
531          value = number > currentSlide ? 1 : -1;
532          next = number;
533        } else {
534          value = this.data.direction === "next" ? 1 : -1;
535          next = currentSlide + value;
536        }
537        if (next === -1) {
538          next = this.data.total - 1;
539        }
540        if (next === this.data.total) {
541          next = 0;
542        }
543        this._setActive(next);
544        slidesControl = $(".slidesjs-control", $element);
545        slidesControl.children(":eq(" + next + ")").css({
546          display: "none",
547          left: 0,
548          zIndex: 10
549        });
550        this.options.callback.start(currentSlide + 1);
551        if (this.options.effect.fade.crossfade) {
552          slidesControl.children(":eq(" + this.data.current + ")").stop().fadeOut(this.options.effect.fade.speed);
553          return slidesControl.children(":eq(" + next + ")").stop().fadeIn(this.options.effect.fade.speed, (function() {
554            slidesControl.children(":eq(" + next + ")").css({
555              zIndex: 0
556            });
557            $.data(_this, "animating", false);
558            $.data(_this, "current", next);
559            return _this.options.callback.complete(next + 1);
560          }));
561        } else {
562          return slidesControl.children(":eq(" + currentSlide + ")").stop().fadeOut(this.options.effect.fade.speed, (function() {
563            slidesControl.children(":eq(" + next + ")").stop().fadeIn(_this.options.effect.fade.speed, (function() {
564              return slidesControl.children(":eq(" + next + ")").css({
565                zIndex: 10
566              });
567            }));
568            $.data(_this, "animating", false);
569            $.data(_this, "current", next);
570            return _this.options.callback.complete(next + 1);
571          }));
572        }
573      }
574    };
575    Plugin.prototype._getVendorPrefix = function() {
576      var body, i, style, transition, vendor;
577      body = document.body || document.documentElement;
578      style = body.style;
579      transition = "transition";
580      vendor = ["Moz", "Webkit", "Khtml", "O", "ms"];
581      transition = transition.charAt(0).toUpperCase() + transition.substr(1);
582      i = 0;
583      while (i < vendor.length) {
584        if (typeof style[vendor[i] + transition] === "string") {
585          return vendor[i];
586        }
587        i++;
588      }
589      return false;
590    };
591    return $.fn[pluginName] = function(options) {
592      return this.each(function() {
593        if (!$.data(this, "plugin_" + pluginName)) {
594          return $.data(this, "plugin_" + pluginName, new Plugin(this, options));
595        }
596      });
597    };
598  })(jQuery, window, document);
599
600}).call(this);

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.