PageSourceSearch

https://www.attacat.co.uk/wp-content/plugins/bb-ultimate-addon/modules/fancy-text/js/rvticker.js?ver=6.9.8

js attacat.co.uk collected 2026-10-04 00:05:46 UTC 7,990 bytes, 248 lines download raw bytes

1/*
2  Vertical News Ticker 1.15
3
4  Original by: Tadas Juozapaitis ( kasp3rito [eta] gmail (dot) com )
5               http://www.jugbit.com/jquery-vticker-vertical-news-ticker/
6
7  Forked/Modified by: Richard Hollis @richhollis - richhollis.co.uk
8*/
9
10(function($){
11  var resize = 0;
12  var defaults = {
13    speed: 700,
14    pause: 4000,
15    showItems: 1,
16    mousePause: true,
17    height: 0,
18    animate: true,
19    margin: 0,
20    padding: 0,
21    startPaused: false
22  };
23
24  var internal = { 
25
26    moveUp: function(state, attribs) {    
27      internal.animate(state, attribs, 'up');
28    },
29
30    moveDown: function(state, attribs){
31      internal.animate(state, attribs, 'down');
32    },
33
34    animate: function(state, attribs, dir) {
35      var height = state.itemHeight;
36      var options = state.options;
37      var el = state.element;
38      var obj = el.children('.uabb-slide-main_ul');
39      var selector = (dir === 'up') ? '.uabb-slide-block:first' : '.uabb-slide-block:last';
40
41      el.trigger("vticker.beforeTick");
42      
43      var clone = obj.children(selector).clone(true);
44
45      if(options.height > 0) height = obj.children('.uabb-slide-block:first').height();
46      height += (options.margin) + (options.padding*2); // adjust for margins & padding
47      
48      if(dir==='down') obj.css('top', '-' + height + 'px').prepend(clone);
49
50      //if ( el.hasClass('uabb-adjust-width') ) { 
51        var width_t = el
52                      .children('.uabb-slide-main_ul')
53                      .children('.uabb-slide-block:nth-child(2)').find('.uabb-slide_text').width();
54        el.delay(options.speed/2).animate({width:width_t}, options.speed/1.6);
55      //}
56
57      if(attribs && attribs.animate) {
58        if(state.animating) return;
59        state.animating = true;
60        var opts = (dir === 'up') ? {top: '-=' + height + 'px'} : {top: 0};
61        obj.animate(opts, options.speed, function() {
62            $(obj).children(selector).remove();
63            $(obj).css('top', '0px');
64            state.animating = false;
65            el.trigger("vticker.afterTick");
66          });
67      } else {
68        obj.children(selector).remove();
69        obj.css('top', '0px');
70        el.trigger("vticker.afterTick");
71      }
72      if(dir==='up') clone.appendTo(obj);
73    },
74
75    nextUsePause: function() {
76      if ( $(this).data('state') ) {
77        var state = $(this).data('state');
78        var options = state.options;
79        if(state.isPaused || state.itemCount < 2) return;
80        methods.next.call( this, {animate:options.animate} );
81      }
82    },
83
84    startInterval: function() {
85      var state = $(this).data('state');
86      if(!state) return;
87      var options = state.options;
88      var initThis = this;
89      state.intervalId = setInterval(function(){ 
90        internal.nextUsePause.call( initThis );
91      }, options.pause);
92    },
93
94    stopInterval: function() {
95      var state = $(this).data('state');
96      //if(!state) return;
97      if(state.intervalId) clearInterval(state.intervalId);
98      state.intervalId = undefined;
99    },
100
101    restartInterval: function() {
102      internal.stopInterval.call(this);
103      internal.startInterval.call(this);
104    }
105  };
106
107  var methods = {
108
109    init: function(options) {
110      // if init called second time then stop first, then re-init
111      methods.stop.call(this);
112      // init
113      var defaultsClone = jQuery.extend({}, defaults);
114      var options = $.extend(defaultsClone, options);
115      var el = $(this);
116      var state = { 
117        itemCount: el.children('.uabb-slide-main_ul').children('.uabb-slide-block').length,
118        itemHeight: 0,
119        itemMargin: 0,
120        element: el,
121        animating: false,
122        options: options,
123        isPaused: (options.startPaused) ? true : false,
124        pausedByCode: false
125      };
126      $(this).data('state', state);
127
128      if ( el.hasClass('uabb-adjust-width') ) {
129        var width_t = el
130                      .children('.uabb-slide-main_ul')
131                      .children('.uabb-slide-block:nth-child(1)').find('.uabb-slide_text').width() + 2;
132        el.css({overflow: 'hidden', position: 'relative', width: width_t})
133        .children('.uabb-slide-main_ul').css({position: 'relative', margin: 0, padding: 0})
134        .children('.uabb-slide-block').css({margin: options.margin, padding: options.padding});
135
136      }else{
137        el
138        .children('.uabb-slide-main_ul').css({position: 'relative', margin: 0, padding: 0})
139        .children('.uabb-slide-block').css({margin: options.margin, padding: options.padding});
140      };
141      
142
143      if(isNaN(options.height) || options.height === 0)
144      {
145        el.children('.uabb-slide-main_ul').children('.uabb-slide-block').each(function(){
146          //var current = $(this);
147          var current = $(this).children('.uabb-slide_text');
148          if(current.height() > state.itemHeight)
149            state.itemHeight = current.height();
150        });
151        // set the same height on all child elements
152        el.children('.uabb-slide-main_ul').children('.uabb-slide-block').each(function(){
153          var current = $(this);
154          current.height(state.itemHeight);
155        });
156        // set element to total height
157        var box = (options.margin) + (options.padding * 2);
158        el.height(((state.itemHeight + box) * options.showItems) + options.margin);
159      }
160      else
161      {
162        // set the preferred height
163        el.height(options.height);
164      }
165
166      var initThis = this;
167      if(!options.startPaused) {
168        internal.startInterval.call( initThis );
169      }
170
171      if(options.mousePause)
172      {
173        el.bind("mouseenter", function () {
174          //if the automatic scroll is paused, don't change that.
175          if (state.isPaused === true) return; 
176          state.pausedByCode = true; 
177          // stop interval
178          internal.stopInterval.call( initThis );
179          methods.pause.call( initThis, true );
180        }).bind("mouseleave", function () {
181          //if the automatic scroll is paused, don't change that.
182          if (state.isPaused === true && !state.pausedByCode) return;
183          state.pausedByCode = false; 
184          methods.pause.call(initThis, false);
185          // restart interval
186          internal.startInterval.call( initThis );
187        });
188      }
189    },
190
191    pause: function(pauseState) {
192      var state = $(this).data('state');
193      if(!state) return undefined;
194      if(state.itemCount < 2) return false;
195      state.isPaused = pauseState;
196      var el = state.element;
197      if(pauseState) {
198        $(this).addClass('paused');
199        el.trigger("vticker.pause");
200      }
201      else {
202        $(this).removeClass('paused');
203        el.trigger("vticker.resume");
204      }
205    },
206
207    next: function(attribs) { 
208      var state = $(this).data('state');
209      if(!state) return undefined;
210      if(state.animating || state.itemCount < 2) return false;
211      internal.restartInterval.call( this );
212      internal.moveUp(state, attribs); 
213    },
214
215    prev: function(attribs) {
216      var state = $(this).data('state');
217      if(!state) return undefined;
218      if(state.animating || state.itemCount < 2) return false;
219      internal.restartInterval.call( this );
220      internal.moveDown(state, attribs); 
221    },
222
223    stop: function() {
224      var state = $(this).data('state');
225      if(!state) return undefined;
226      internal.stopInterval.call( this );
227    },
228
229    remove: function() {
230      var state = $(this).data('state');
231      if(!state) return undefined;
232      internal.stopInterval.call( this );
233      var el = state.element;
234      el.unbind();
235      el.remove();
236    },
237  };
238 
239  $.fn.vTicker = function( method ) {
240    if ( methods[method] ) {
241      return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
242    } else if ( typeof method === 'object' || ! method ) {
243      return methods.init.apply( this, arguments );
244    } else {
245      $.error( 'Method ' +  method + ' does not exist on jQuery.vTicker' );
246    }    
247  };
248})(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.