PageSourceSearch

https://www.ctep.ru/js/jquery.totemticker.js

js ctep.ru collected 2026-10-08 14:58:48 UTC 5,853 bytes, 188 lines download raw bytes

1/*
2	Totem Ticker Plugin
3	Copyright (c) 2011 Zach Dunn / www.buildinternet.com
4	Released under MIT License
5	--------------------------
6	Structure based on Doug Neiner's jQuery plugin blueprint: http://starter.pixelgraphics.us/
7*/
8(function($) {
9
10    if (!$.omr) {
11        $.omr = new Object();
12    };
13
14    $.omr.totemticker = function(el, options) {
15
16        var base = this;
17
18        //Define the DOM elements
19        base.el = el;
20        base.$el = $(el);
21
22        // Add a reverse reference to the DOM object
23        base.$el.data("omr.totemticker", base);
24
25        base.init = function() {
26            base.options = $.extend({}, $.omr.totemticker.defaultOptions, options);
27
28            //Define the ticker object
29            base.ticker;
30
31            //Adjust the height of ticker if specified
32            base.format_ticker();
33
34            //Setup navigation links (if specified)
35            base.setup_nav();
36
37            //Start the ticker
38            base.start_interval();
39
40            //Debugging info in console
41            //base.debug_info();
42        };
43
44        base.start_interval = function() {
45
46            //Clear out any existing interval
47            clearInterval(base.ticker);
48
49            base.ticker = setInterval(function() {
50
51                base.$el.find('li:first').animate({
52                    marginTop: '-' + base.options.row_height,
53                }, base.options.speed, function() {
54                    $(this).detach().css('marginTop', '0').appendTo(base.$el);
55                });
56
57            }, base.options.interval);
58        }
59
60        base.reset_interval = function() {
61            clearInterval(base.ticker);
62            base.start_interval();
63        }
64
65        base.stop_interval = function() {
66            clearInterval(base.ticker);
67        }
68
69        base.format_ticker = function() {
70
71            if (typeof(base.options.max_items) != "undefined" && base.options.max_items != null) {
72
73                //Remove units of measurement (Should expand to cover EM and % later)
74                var stripped_height = base.options.row_height.replace(/px/i, '');
75                var ticker_height = stripped_height * base.options.max_items;
76
77                base.$el.css({
78                    height: ticker_height + 'px',
79                    overflow: 'hidden',
80                });
81
82            } else {
83                //No heights were specified, so just doublecheck overflow = hidden
84                base.$el.css({
85                    overflow: 'hidden',
86                })
87            }
88
89        }
90
91        base.setup_nav = function() {
92
93            //Stop Button
94            if (typeof(base.options.stop) != "undefined" && base.options.stop != null) {
95                $(base.options.stop).click(function() {
96                    base.stop_interval();
97                    return false;
98                });
99            }
100
101            //Start Button
102            if (typeof(base.options.start) != "undefined" && base.options.start != null) {
103                $(base.options.start).click(function() {
104                    base.start_interval();
105                    return false;
106                });
107            }
108
109            //Previous Button
110            if (typeof(base.options.previous) != "undefined" && base.options.previous != null) {
111                $(base.options.previous).click(function() {
112                    base.$el.find('li:last').detach().prependTo(base.$el).css('marginTop', '-' + base.options.row_height);
113                    base.$el.find('li:first').animate({
114                        marginTop: '0px',
115                    }, base.options.speed, function() {
116                        base.reset_interval();
117                    });
118                    return false;
119                });
120            }
121
122            //Next Button
123            if (typeof(base.options.next) != "undefined" && base.options.next != null) {
124                $(base.options.next).click(function() {
125                    base.$el.find('li:first').animate({
126                        marginTop: '-' + base.options.row_height,
127                    }, base.options.speed, function() {
128                        $(this).detach().css('marginTop', '0px').appendTo(base.$el);
129                        base.reset_interval();
130                    });
131                    return false;
132                });
133            }
134
135            //Stop on mouse hover
136            if (typeof(base.options.mousestop) != "undefined" && base.options.mousestop === true) {
137                base.$el.mouseenter(function() {
138                    base.stop_interval();
139                }).mouseleave(function() {
140                    base.start_interval();
141                });
142            }
143
144            /*
145				TO DO List
146				----------------
147				Add a continuous scrolling mode
148			*/
149
150        }
151
152        base.debug_info = function() {
153            //Dump options into console
154            console.log(base.options);
155        }
156
157        //Make it go!
158        base.init();
159    };
160
161    $.omr.totemticker.defaultOptions = {
162        message: 'Ticker Loaded',
163        /* Disregard */
164        next: null,
165        /* ID of next button or link */
166        previous: null,
167        /* ID of previous button or link */
168        stop: null,
169        /* ID of stop button or link */
170        start: null,
171        /* ID of start button or link */
172        row_height: '100px',
173        /* Height of each ticker row in PX. Should be uniform. */
174        speed: 800,
175        /* Speed of transition animation in milliseconds */
176        interval: 4000,
177        /* Time between change in milliseconds */
178        max_items: null,
179        /* Integer for how many items to display at once. Resizes height accordingly (OPTIONAL) */
180    };
181
182    $.fn.totemticker = function(options) {
183        return this.each(function() {
184            (new $.omr.totemticker(this, options));
185        });
186    };
187
188})(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.