Changeset 790


Ignore:
Timestamp:
Mar 18, 2015 4:00:40 PM (10 years ago)
Author:
quyenla
Message:

preview

Location:
pro-violet-viettel/www/deploy/20150304
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/www/deploy/20150304/application/modules/ajax/controllers/preview.php

    r789 r790  
    1616            $fileId =  $this->input->post('fileId',TRUE);
    1717            $data = $this->vservices->getPreview($fileId);
    18             $data=  json_encode($data);
     18            $data=  json_decode($data,true);
     19            if ($data['total']==0)
     20            {
     21                echo "Chế độ xem trước khÃŽng khả dụng, vui lòng tải xuống để xem";
     22            }
     23            else
     24            {
    1925            $this->load->view('preview/index', $data);
     26            }
    2027        }
    2128
  • pro-violet-viettel/www/deploy/20150304/application/modules/ajax/views/preview/index.php

    r789 r790  
    1 <!doctype html>
    2 <head>
     1  <style>
    32
    43
    5     <script type="text/javascript">
    6     $(function(){
    7       $("#slides").slidesjs({
    8         width: 940,
    9         height: 528
    10       });
    11     });
    12   </script>
    13 </head>
     4    #slides {
     5      display: none
     6    }
     7
     8    #slides .slidesjs-navigation {
     9      margin-top:3px;
     10    }
     11
     12    #slides .slidesjs-previous {
     13      margin-right: 5px;
     14      float: left;
     15    }
     16
     17    #slides .slidesjs-next {
     18      margin-right: 5px;
     19      float: left;
     20    }
     21
     22    .slidesjs-pagination {
     23     
     24      float: right;
     25     
     26    }
     27
     28    .slidesjs-pagination li {
     29      float: left;
     30      list-style: none;
     31      width: 25px;
     32      text-align: center;
     33      margin-bottom: 10px;
     34    }
     35
     36    .slidesjs-pagination li a {
     37      display: inline;
     38      height: 0;
     39     width: 25px;
     40      background-position: 0 0;
     41      padding: 5px 5px 5px 5px;
     42      overflow: hidden;
     43      color: #000;
     44    }
     45
     46    .slidesjs-pagination li a.active,
     47    .slidesjs-pagination li a:hover.active {
     48      background-position: 0 -13px;
     49      background-color: #428bca !important;
     50    }
     51
     52    .slidesjs-pagination li a:hover {
     53      background-position: 0 -26px
     54    }
     55
     56    #slides a:link,
     57    #slides a:visited {
     58      color: #333
     59    }
     60
     61    #slides a:hover,
     62    #slides a:active {
     63      color: #9e2020
     64    }
     65
     66    .navbar {
     67      overflow: hidden
     68    }
     69  </style>
    1470<body>
    15   <div id="slides">
    16     <img src="http://sbgapi.violet.vn/previews/294/0.png">
    17     <img src="http://sbgapi.violet.vn/previews/294/1.png">
    18   </div>
     71    <?php echo $filename;?>
     72    <div id="slides" style="display: none;">
     73        <?php
     74        for ($i=0;$i<$total;$i++)
     75        {
     76        ?>
     77    <img src="http://sbgapi.violet.vn/<?php echo $folder."/".$i;?>.png">
     78    <?php
     79    }?>
     80    <a href="#" class="slidesjs-previous slidesjs-navigation"><i class="icon-chevron-left icon-large"></i></a>
     81      <a href="#" class="slidesjs-next slidesjs-navigation"><i class="icon-chevron-right icon-large"></i></a>
     82    </div>
    1983</body>
  • pro-violet-viettel/www/deploy/20150304/assets/js/jquery.slides.js

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