PageSourceSearch

https://palomasala.com/wp-content/plugins/wp-twitter-feeds/js/jquery.newsTicker.js?ver=7.1.2

js palomasala.com collected 2026-10-06 13:16:34 UTC 8,954 bytes, 203 lines download raw bytes

1
2(function($, window, document, undefined) {
3        'use strict';
4        var pluginName = 'newsTicker',
5                defaults = {
6                        row_height: 20,
7                        max_rows: 3,
8                        speed: 400,
9                        duration: 2500,
10                        direction: 'up',
11                        autostart: 1,
12                        pauseOnHover: 1,
13                        nextButton: null,
14                        prevButton: null,
15                        startButton: null,
16                        stopButton: null,
17                        hasMoved: function() {},
18                        movingUp: function() {},
19                        movingDown: function() {},
20                        start: function() {},
21                        stop: function() {},
22                        pause: function() {},
23                        unpause: function() {}
24                };
25
26        function Plugin(element, options) {
27                this.element = element;
28                this.$el = $(element);
29                this.options = $.extend({}, defaults, options);
30                this._defaults = defaults;
31                this._name = pluginName;
32                this.moveInterval;
33                this.state = 0;
34                this.paused = 0;
35                this.moving = 0;
36                if (this.$el.is('ul, ol')) {
37                        this.init();
38                }
39        }
40
41        Plugin.prototype = {
42                init: function() {
43                        this.$el.height(this.options.row_height * this.options.max_rows)
44                                .css({overflow : 'hidden'});
45
46                        this.checkSpeed();
47
48                        if(this.options.nextButton && typeof(this.options.nextButton[0]) !== 'undefined')
49                                this.options.nextButton.click(function(e) {
50                                        this.moveNext();
51                                        this.resetInterval();
52                                }.bind(this));
53                        if(this.options.prevButton && typeof(this.options.prevButton[0]) !== 'undefined')
54                                this.options.prevButton.click(function(e) {
55                                        this.movePrev();
56                                        this.resetInterval();
57                                }.bind(this));
58                        if(this.options.stopButton && typeof(this.options.stopButton[0]) !== 'undefined')
59                                this.options.stopButton.click(function(e) {
60                                        this.stop()
61                                }.bind(this));
62                        if(this.options.startButton && typeof(this.options.startButton[0]) !== 'undefined')
63                                this.options.startButton.click(function(e) {
64                                        this.start()
65                                }.bind(this));
66                        
67                        if(this.options.pauseOnHover) {
68                                this.$el.hover(function() {
69                                        if (this.state)
70                                                this.pause();
71                                }.bind(this), function() {
72                                        if (this.state)
73                                                this.unpause();
74                                }.bind(this));
75                        }
76
77                        if(this.options.autostart)
78                                this.start();
79                },
80
81                start: function() {
82                        if (!this.state) {
83                                this.state = 1;
84                                this.resetInterval();
85                                this.options.start();
86                        }
87                },
88
89                stop: function() {
90                        if (this.state) {
91                                clearInterval(this.moveInterval);
92                                this.state = 0;
93                                this.options.stop();
94                        }
95                },
96
97                resetInterval: function() {
98                        if (this.state) {
99                                clearInterval(this.moveInterval);
100                                this.moveInterval = setInterval(function() {this.move()}.bind(this), this.options.duration);
101                        }
102                },
103
104                move: function() {
105                         if (!this.paused) this.moveNext();
106                },
107
108                moveNext: function() {
109                        if (this.options.direction === 'down')
110                                this.moveDown();
111                        else if (this.options.direction === 'up')
112                                this.moveUp();
113                },
114
115                movePrev: function() {
116                        if (this.options.direction === 'down')
117                                this.moveUp();
118                        else if (this.options.direction === 'up')
119                                this.moveDown();
120                },
121
122                pause: function() {
123                        if (!this.paused) this.paused = 1;
124                        this.options.pause();
125                },
126
127                unpause: function() {
128                        if (this.paused) this.paused = 0;
129                        this.options.unpause();
130                },
131
132                moveDown: function() {
133                        if (!this.moving) {
134                                this.moving = 1;
135                                this.options.movingDown();
136                                this.$el.children('li:last').detach().prependTo(this.$el).css('marginTop', '-' + this.options.row_height + 'px')
137                                        .animate({marginTop: '0px'}, this.options.speed, function(){
138                                                this.moving = 0;
139                                                this.options.hasMoved();
140                                        }.bind(this));
141                        }
142                },
143
144                moveUp: function() {
145                        if (!this.moving) {
146                                this.moving = 1;
147                                this.options.movingUp();
148                                var element = this.$el.children('li:first');
149                                element.animate({marginTop: '-' + this.options.row_height + 'px'}, this.options.speed,
150                                        function(){
151                                                element.detach().css('marginTop', '0').appendTo(this.$el);
152                                                this.moving = 0;
153                                                this.options.hasMoved();
154                                        }.bind(this));
155                        }
156                },
157
158                updateOption: function(option, value) {
159                        if (typeof(this.options[option]) !== 'undefined'){
160                                this.options[option] = value;
161                                if (option == 'duration' || option == 'speed'){
162                                    this.checkSpeed();
163                                    this.resetInterval();
164                                }
165                        }
166                },
167
168                add: function(content){
169                    this.$el.append($('<li>').html(content));
170                },
171
172                getState: function() {
173                        if (paused) return 2 // 2 = paused
174                        else return this.state;// 0 = stopped, 1 = started
175                },
176
177                checkSpeed: function() {
178                        if (this.options.duration < (this.options.speed + 25))
179                                this.options.speed = this.options.duration - 25;
180                },
181
182                destroy: function() {
183                        this._destroy(); // or this.delete; depends on jQuery version
184                }
185        };
186
187        $.fn[pluginName] = function(option) {
188                var args = arguments;
189                
190                return this.each(function() {
191                        var $this = $(this),
192                                data = $.data(this, 'plugin_' + pluginName),
193                                options = typeof option === 'object' && option;
194                        if (!data) {
195                                $this.data('plugin_' + pluginName, (data = new Plugin(this, options)));
196                        }
197                        // if first argument is a string, call silimarly named function
198                        if (typeof option === 'string') {
199                                data[option].apply(data, Array.prototype.slice.call(args, 1));
200                        }
201                });
202        };
203})(jQuery, window, document);

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.