PageSourceSearch

https://www.murraynebraska.com/nl/modules/mod_jux_news_ticker/assets/js/newsticker.jquery.js

js murraynebraska.com collected 2026-10-02 19:07:12 UTC 48,892 bytes, 1,162 lines download raw bytes

1(function($) {
2    if ($.fn.on === undefined) {
3        $.fn.on = function(event, fn) {
4            this.bind(event, fn);
5        }
6    }
7    if ($.fn.off === undefined) {
8        $.fn.off = function(event, fn) {
9            return this.unbind(event, fn);
10        }
11    }
12    $.fn.newsticker = function(options) {
13        var self = this;
14        self.methods = $.fn.newsticker.methods;
15        self.api = $.fn.newsticker.api;
16        self.delegate = $.fn.newsticker.delegate;
17        self.settings = $.extend({}, $.fn.newsticker.defaults, options);
18        return this.each(function() {
19            self.api('init', $(this));
20        });
21    }
22    $.fn.newsticker.defaults = {
23        style: 'scroll',
24        showControls: true,
25        tickerTitle: '',
26        feedItems: 10,
27        feeds: '',
28        feedFormat: '%title% posted by %author%, %timeago%',
29        noCache: false,
30        twitter: '',
31        twitterFormat: '%excerpt% posted on <a href="%link%">Twitter</a> %timeago%',
32        twitterCount: '',
33        twitterRequestUrl: 'lib/twitter/fetch.php',
34        twitterIncludeRetweets: true,
35        twitterExcludeReplies: true,
36        parseTwitterLinks: true,
37        openLinksInNewWindow: false,
38        facebook: '',
39        facebookFormat: '%excerpt%... Posted on <a href="%link%">Facebook</a> %timeago%',
40        facebookCount: '',
41        lastfm: '',
42        lastfmFormat: '<a href="%link%">%title%</a> listened to %timeago%',
43        lastfmCount: '',
44        tumblr: '',
45        tumblrFormat: '<a href="%link%">%title%</a> posted by %author%, %timeago%',
46        tumblrCount: '',
47        pinterest: '',
48        pinterestFormat: '<a href="%item_link%">%excerpt%</a> pinned %timeago%',
49        pinterestCount: '',
50        excerptLength: 100,
51        sortBy: 'timestamp',
52        reverseOrder: false,
53        autoStart: true,
54        timeAgoFormat: function(date) {
55            return $.fn.newsticker.methods.getTimeAgo(date);
56        },
57        dateFormat: function(date) {
58            return $.fn.newsticker.methods.getFormattedDate(date);
59        }
60    }
61    $.fn.newsticker.delegate = function(name) {
62        var style_method = this.style[name],
63            args = Array.prototype.slice.call(arguments, 1);
64        if (typeof(style_method) === 'function') {
65            return style_method.apply(this, args);
66        }
67        return false;
68    }
69    $.fn.newsticker.api = function(method) {
70        var api_method = this.methods[method],
71            args = Array.prototype.slice.call(arguments, 1);
72        if (typeof(api_method) === 'function') {
73            return api_method.apply(this, args);
74        }
75        return false;
76    }
77    $.fn.newsticker.methods = {
78        getId: function() {
79            var newDate = new Date;
80            return newDate.getTime();
81        },
82        init: function(element) {
83            if (typeof($.fn.newsticker.styles[this.settings.style]) === 'object') {
84                this.style = $.fn.newsticker.styles[this.settings.style];
85            } else {
86                console.log('ERROR: Invalid display style.');
87                return;
88            }
89            this.settings = $.extend(this.delegate('settings'), this.settings);
90            this.delegate('init');
91            this.dom = {};
92            this.dom.list = element;
93            this.api('getFeeds');
94            if (this.feeds.length === 0 && this.settings.twitter.length === 0 && this.settings.facebook.length === 0 && this.settings.lastfm.length === 0 && this.settings.tumblr.length === 0 && this.settings.pinterest.length === 0) {
95                this.dom.items = this.dom.list.children('li');
96                this.api('startup');
97            }
98        },
99        startup: function() {
100            var self = this,
101                dom = this.dom,
102                settings = this.settings,
103                list = dom.list;
104            list.wrap('<div class="newsticker_wrapper newsticker_style_' + settings.style + '" id="newsticker_' + this.api('getId') + '" style="position: relative; z-index: 999; overflow: hidden; "></div>');
105            if (settings.tickerTitle.length > 0) {
106                $('<div class="newsticker_title"><h4>' + settings.tickerTitle + '</h4><div class="newsticker_head"></div></div>').insertBefore(list);
107            }
108            dom.wrapper = list.parent();
109            dom.title = dom.wrapper.children('.newsticker_title');
110            if (settings.showControls === true) {
111                var pause_or_resume = settings.autoStart === false ? 'resume' : 'pause',
112                    controls;
113                $('<ul class="newsticker_controls">\
114                    <li class="previous"><i class="fa fa-angle-left"></i></li>\
115                    <li class="jux-newticker-none ' + pause_or_resume + '"></li>\
116                    <li class="next"><i class="fa fa-angle-right"></i></li>\
117                  </ul>').insertAfter(list);
118                controls = list.next('.newsticker_controls');
119                controls.children('.previous').on('click', function() {
120                    self.delegate('previous');
121                });
122                controls.children('.pause').on('click', function() {
123                    self.delegate('pause');
124                });
125                controls.children('.resume').on('click', function() {
126                    self.delegate('resume');
127                });
128                controls.children('.next').on('click', function() {
129                    self.delegate('next');
130                });
131            }
132            dom.controls = controls === undefined ? dom.wrapper.children('.newsticker_controls') : controls;
133            if (settings.pauseOnHover === true) {
134                dom.items.on('mouseover', function() {
135                    self.delegate('pause');
136                });
137                dom.items.on('mouseout', function() {
138                    self.delegate('resume');
139                });
140            }
141            $(window).resize(function() {
142                self.api('resize');
143            });
144            this.delegate('manipulateDom');
145            this.delegate('itemLoop');
146            this.delegate('start');
147        },
148        getFeeds: function() {
149            var self = this,
150                settings = self.settings,
151                feedItems = settings.feedItems,
152                count, url;
153            self.feeds = [];
154            if (settings.feeds.length > 0) {
155                var _feeds = typeof(settings.feeds) === 'string' ? [settings.feeds] : settings.feeds;
156                for (var i = 0, max = _feeds.length; i < max; i += 1) {
157                    var _feed = _feeds[i];
158                    url = typeof(_feed) === 'string' ? _feed : _feed.url;
159                    count = _feed.hasOwnProperty('count') ? _feed.count : feedItems;
160                    self.feeds.push({
161                        'type': 'feed',
162                        'url': document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=' + parseInt(count) + '&callback=?&q=' + encodeURIComponent(url),
163                        'count': count
164                    });
165                }
166            }
167            if (settings.twitter.length > 0) {
168                count = settings.twitterCount > 0 ? settings.twitterCount : feedItems;
169                self.feeds.push({
170                    'type': 'twitter',
171                    'url': settings.twitterRequestUrl + '?screen_name=' + encodeURIComponent(settings.twitter) + '&count=' + parseInt(count) + '&include_rts=' + encodeURIComponent(settings.twitterIncludeRetweets) + '&exclude_replies=' + encodeURIComponent(settings.twitterExcludeReplies),
172                    'count': count,
173                    'dataType': 'jsonp',
174                    'jsonpCallback': 'fetch_tweets'
175                });
176            }
177            if (settings.lastfm.length > 0) {
178                count = settings.lastfmCount > 0 ? settings.lastfmCount : feedItems;
179                url = 'http://ws.audioscrobbler.com/1.0/user/' + settings.lastfm + '/recenttracks.rss';
180                self.feeds.push({
181                    'type': 'lastfm',
182                    'url': document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=' + parseInt(count) + '&callback=?&q=' + encodeURIComponent(url),
183                    'count': count
184                });
185            }
186            if (settings.tumblr.length > 0) {
187                count = settings.tumblrCount > 0 ? settings.tumblrCount : feedItems;
188                url = 'http://' + settings.tumblr + '.tumblr.com/rss';
189                self.feeds.push({
190                    'type': 'tumblr',
191                    'url': document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=' + parseInt(count) + '&callback=?&q=' + encodeURIComponent(url),
192                    'count': count
193                });
194            }
195            if (settings.pinterest.length > 0) {
196                count = settings.pinterestCount > 0 ? settings.pinterestCount : feedItems;
197                url = 'http://pinterest.com/' + settings.pinterest + '/feed.rss';
198                self.feeds.push({
199                    'type': 'pinterest',
200                    'url': document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=' + parseInt(count) + '&callback=?&q=' + encodeURIComponent(url),
201                    'count': count
202                });
203            }
204            if (settings.facebook.length > 0) {
205                var fb, date = new Date();
206                $.ajax({
207                    url: document.location.protocol + '//graph.facebook.com/' + settings.facebook,
208                    dataType: 'jsonp',
209                    success: function(json) {
210                        fb = json;
211                    },
212                    error: function(xhr, status, error) {
213                        console.log('An error occurred while trying to fetch this profile from Facebook');
214                        fb = 'error';
215                    },
216                    complete: function() {
217                        if (fb !== 'error') {
218                            self.api('completeFacebookRequest', fb);
219                        }
220                    }
221                });
222            } else {
223                self.api('getFeedItems');
224            }
225        },
226        completeFacebookRequest: function(fb) {
227            var settings = this.settings,
228                count = settings.facebookCount > 0 ? settings.facebookCount : settings.feedItems,
229                url = 'https://www.facebook.com/feeds/page.php?id=' + fb.id + '&format=rss20';
230            this.feeds.push({
231                'type': 'facebook',
232                'url': document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=' + parseInt(count) + '&callback=?&q=' + encodeURIComponent(url),
233                'count': count,
234                'data': fb
235            });
236            this.api('getFeedItems');
237        },
238        addItems: function(items, response, type) {
239            var entries = this.api('getItemsFromResponse', response, type),
240                max = entries.length,
241                i = 0;
242            for (i; i < max; i += 1) {
243                var entry = entries[i];
244                entry.timestamp = this.api('getTimestamp', entry, type);
245                entry.type = type;
246                items.push(entry);
247            }
248            return items;
249        },
250        getItemsFromResponse: function(response, type) {
251            switch (type) {
252                case 'twitter':
253                    return response;
254                    break;
255                default:
256                    return response.responseData.feed.entries;
257                    break;
258            }
259        },
260        getTimestamp: function(item, type) {
261            switch (type) {
262                case 'twitter':
263                    var v = item.created_at.split(' ');
264                    return new Date(Date.parse(v[1] + " " + v[2] + ", " + v[5] + " " + v[3] + " UTC"));
265                    break;
266                default:
267                    return new Date(item.publishedDate);
268                    break;
269            }
270        },
271        getFeedItems: function() {
272            var self = this,
273                items = [],
274                feeds = this.feeds,
275                complete = 0,
276                url;
277            for (var i = 0, max = feeds.length; i < max; i += 1) {
278                getFeedItemsIter(feeds[i]);
279            }
280
281            function getFeedItemsIter(feed) {
282                var type = feed.type,
283                    ajax_object = {};
284                ajax_object.dataType = 'json';
285                ajax_object.success = function(data) {
286                    if (type === 'feed' && data.responseStatus !== 200) {
287                        console.log('Unable to load feed');
288                        return;
289                    }
290                    self.api('addItems', items, data, type);
291                };
292                ajax_object.error = function(xhr, status, error) {
293                    console.log('An error occurred while trying to fetch feed from ' + feed.url + '. Status: ' + status);
294                };
295                ajax_object.complete = function() {
296                    complete += 1;
297                    if (complete === max) {
298                        self.api('completeFeedItemsRequest', items);
299                    }
300                };
301                ajax_object.url = feed.url;
302                if (feed.hasOwnProperty('dataType')) {
303                    ajax_object.dataType = feed.dataType;
304                    ajax_object.jsonpCallback = feed.hasOwnProperty('dataType') ? feed.jsonpCallback : '?';
305                    ajax_object.contentType = "text/json; charset=utf-8";
306                    ajax_object.crossDomain = true;
307                }
308                if (self.settings.noCache === true) {
309                    var timestamp = new Date().getTime();
310                    ajax_object.url += '&' + timestamp;
311                }
312                $.ajax(ajax_object);
313            }
314        },
315        completeFeedItemsRequest: function(items) {
316            var i, settings = this.settings,
317                max = items.length > settings.feedItems ? settings.feedItems : items.length,
318                html, list = this.dom.list,
319                sort_by = settings.sortBy,
320                reverse = settings.reverseOrder;
321            if (sort_by === 'random') {
322                items = this.api('randomize', items);
323            } else {
324                items.sort(this.api('sortBy', sort_by, reverse));
325            }
326            for (i = 0; i < max; i += 1) {
327                list.append(this.api('displayFeedItem', items[i]));
328            }
329            this.dom.items = list.children('li');
330            this.api('startup');
331        },
332        sortBy: function(field, reverse) {
333            var key = function(x) {
334                return x[field];
335            };
336            return function(a, b) {
337                var A = key(a),
338                    B = key(b);
339                return ((A < B) ? -1 : (A >
339 B) ? +1 : 0) * [-1, 1][+!!reverse];
340            }
341        },
342        randomize: function(array) {
343            var tmp, current, top = array.length;
344            if (top)
345                while (--top) {
346                    current = Math.floor(Math.random() * (top + 1));
347                    tmp = array[current];
348                    array[current] = array[top];
349                    array[top] = tmp;
350                }
351            return array;
352        },
353        getFormat: function(type) {
354            var settings = this.settings;
355            switch (type) {
356                case 'facebook':
357                    return settings.facebookFormat.length > 0 ? settings.facebookFormat : settings.feedFormat;
358                    break;
359                case 'twitter':
360                    return settings.twitterFormat.length > 0 ? settings.twitterFormat : settings.feedFormat;
361                    break;
362                case 'lastfm':
363                    return settings.lastfmFormat.length > 0 ? settings.lastfmFormat : settings.feedFormat;
364                    break;
365                case 'tumblr':
366                    return settings.tumblrFormat.length > 0 ? settings.tumblrFormat : settings.feedFormat;
367                    break;
368                case 'pinterest':
369                    return settings.pinterestFormat.length > 0 ? settings.pinterestFormat : settings.feedFormat;
370                    break;
371                default:
372                    return settings.feedFormat;
373                    break;
374            }
375        },
376        displayFeedItem: function(item) {
377            var type = item.type,
378                text = this.api('getFormat', type),
379                replace = ['author', 'excerpt', 'link', 'item_link', 'title', 'timeago', 'date'],
380                replacement, key;
381            for (var i = 0; i < replace.length; i += 1) {
382                key = replace[i];
383                if (key === 'timeago') {
384                    replacement = this.settings.timeAgoFormat(item.timestamp);
385                } else if (key === 'date') {
386                    replacement = this.settings.dateFormat.apply(this, [item.timestamp]);
387                } else {
388                    replacement = this.api('getReplacement', item, key, type);
389                }
390                switch (key) {
391                    case 'author':
392                        text = text.replace(/\%author\%/g, replacement);
393                        break;
394                    case 'excerpt':
395                        text = text.replace(/\%excerpt\%/g, replacement);
396                        break;
397                    case 'link':
398                        text = text.replace(/\%link\%/g, replacement);
399                        break;
400                    case 'item_link':
401                        text = text.replace(/\%item_link\%/g, replacement);
402                        break;
403                    case 'title':
404                        text = text.replace(/\%title\%/g, replacement);
405                        break;
406                    case 'timeago':
407                        text = text.replace(/\%timeago\%/g, replacement);
408                        break;
409                    case 'date':
410                        text = text.replace(/\%date\%/g, replacement);
411                        break;
412                }
413            }
414            return '<li>' + text + '</li>';
415        },
416        getReplacement: function(item, key, type) {
417            switch (key) {
418                case 'author':
419                    switch (type) {
420                        case 'twitter':
421                            return item.user.name;
422                            break;
423                        default:
424                            return item.author;
425                            break;
426                    }
427                    break;
428                case 'excerpt':
429                    switch (type) {
430                        case 'twitter':
431                            var text = this.api('getTwitterText', item, this.settings.parseTwitterLinks);
432                            return text;
433                            break;
434                        case 'facebook':
435                            var t;
436                            if (typeof this.div === 'undefined') {
437                                this.div = $(document.createElement('div'));
438                            }
439                            t = this.div.html(item.content).text();
440                            if (t === '') {
441                                return item.contentSnippet.length > this.settings.excerptLength ? item.contentSnippet.slice(0, this.settings.excerptLength) : item.contentSnippet;
442                            } else {
443                                return t;
444                            }
445                            break;
446                        case 'lastfm':
447                            return item.title;
448                            break;
449                        default:
450                            return item.contentSnippet.length > this.settings.excerptLength ? item.contentSnippet.slice(0, this.settings.excerptLength) : item.contentSnippet;
451                            break;
452                    }
453                    break;
454                case 'link':
455                    switch (type) {
456                        case 'twitter':
457                            return 'https://twitter.com/#!/' + item.user.screen_name;
458                            break;
459                        case 'facebook':
460                            return 'http://facebook.com/' + this.settings.facebook;
461                            break;
462                        case 'pinterest':
463                            return 'http://pinterest.com/' + this.settings.pinterest + '/';
464                            break;
465                        default:
466                            return item.link;
467                            break;
468                    }
469                    break;
470                case 'item_link':
471                    switch (type) {
472                        case 'twitter':
473                            return 'https://twitter.com/#!/' + item.user.name + '/statuses/' + item.id_str;
474                            break;
475                        case 'lastfm':
476                            return item.content;
477                            break;
478                        default:
479                            return item.link;
480                            break;
481                    }
482                    break;
483                case 'title':
484                    switch (type) {
485                        case 'twitter':
486                            return '';
487                            break;
488                        default:
489                            return item.title;
490                            break;
491                    }
492                    break;
493            }
494        },
495        getTwitterText: function(item, parseLinks) {
496            var text = item.text,
497                self = this,
498                entities = [],
499                links, entity;
500            text = text.length > this.settings.excerptLength ? text.slice(0, this.settings.excerptLength) : text;
501            if (parseLinks === false) {
502                return text;
503            }
504            jQuery.each(item.entities, function(name, links) {
505                for (var i = 0, max = links.length; i < max; i += 1) {
506                    entity = links[i];
507                    entity.type = name;
508                    entity.start = entity.indices[0];
509                    entities.push(entity);
510                }
511            });
512            entities.sort(this.api('sortBy', 'start', false));
513            for (var i = 0, max = entities.length; i < max; i += 1) {
514                text = this.api('parseTwitterLink', text, entities[i]);
515            }
516            return text;
517        },
518        parseTwitterLink: function(text, entity) {
519            var start = entity.start,
520                end = entity.indices[1],
521                url, text;
522            if (start < this.settings.excerptLength) {
523                url = this.api('getTwitterLink', entity);
524                text = text.slice(0, start) + url + text.slice(end);
525            }
526            return text;
527        },
528        getTwitterLink: function(entity) {
529            var target = this.settings.openLinksInNewWindow === true ? 'target="_blank"' : '';
530            switch (entity.type) {
531                case 'urls':
532                    return '<a href="' + entity.url + '" ' + target + '>' + entity.display_url + '</a>';
533                    break;
534                case 'user_mentions':
535                    return '<a href="https://twitter.com/#!/' + entity.screen_name + '" ' + target + '>@' + entity.screen_name + '</a>';
536                    break;
537                case 'hashtags':
538                    return '<a href="https://twitter.com/#!/search/' + entity.text + '" ' + target + '>#' + entity.text + '</a>';
539                    break;
540            }
541        },
542        getTimeAgo: function(date) {
543            var now = new Date(),
544                elapsed = now.getTime() - date.getTime(),
545                day = 86400000,
546                minute = 60000,
547                hour = 3600000,
548                units, timeago;
549            if (elapsed < hour) {
550                units = Math.ceil(elapsed / minute);
551                timeago = units > 1 ? units + ' minutes ago' : units + ' minute ago';
552            } else if (elapsed < day) {
553                units = Math.ceil(elapsed / hour);
554                timeago = units > 1 ? units + ' hours ago' : units + ' hour ago';
555            } else {
556                units = Math.ceil(elapsed / day);
557                timeago = units > 1 ? units + ' days ago' : units + ' day ago';
558            }
559            return timeago;
560        },
561        getFormattedDate: function(date) {
562            var date = new Date(date),
563                months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
564            return date.getDate() + ' ' + months[date.getMonth()];
565        },
566        getListWidth: function() {
567            if (this.settings.showControls) {
568                return this.dom.controls.position().left - this.dom.title.outerWidth(true);
569            } else {
570                return this.dom.wrapper.width() - this.dom.title.outerWidth(true) - 1;
571            }
572        },
573        pause: function() {
574            if (this.settings.showControls === true) {
575                var self = this;
576                this.dom.controls.children('.pause').removeClass('pause').addClass('resume').off('click', function() {
577                    self.delegate('pause')
578                }).on('click', function() {
579                    self.delegate('resume')
580                });
581            }
582        },
583        resume: function() {
584            if (this.settings.showControls === true) {
585                var self = this;
586                this.dom.controls.children('.resume').removeClass('resume').addClass('pause').off('click', function() {
587                    self.delegate('resume');
588                }).on('click', function() {
589                    self.delegate('pause')
590                });
591            }
592        },
593        resize: function() {
594            if (this.delegate('resize') === false) {}
595        }
596    }
597    $.fn.newsticker.styles = {
598        fade: {
599            settings: function() {
600                return {
601                    'fadeOutSpeed': 'slow',
602                    'fadeInSpeed': 'slow',
603                    'transitionSpeed': 4000,
604                    'pauseOnHover': true
605                };
606            },
607            manipulateItem: function(item, is_first) {
608                var self = this;
609                item.css({
610                    'position': 'absolute',
611                    'left': 0,
612                    'top': 0
613                });
614                if (is_first) {
615                    item.addClass('display');
616                } else {
617                    item.hide();
618                }
619            },
620            manipulateDom: function() {
621                this.dom.wrapper.css({
622                    'width': '100%'
623                });
624                this.dom.title.css({
625                    'float': 'left',
626                    'margin': 0
627                });
628                this.dom.list.css({
629                    'float': 'left',
630                    'width': this.api('getListWidth') + 'px',
631                    'position': 'relative',
632                    'list-style': 'none'
633                });
634            },
635            itemLoop: function() {
636                var is_first = true,
637                    self = this;
638                this.dom.items.each(function() {
639                    self.delegate('manipulateItem', $(this), is_first);
640                    is_first = false;
641                });
642            },
643            adjacentItem: function(movement) {
644                var self = this;
645                this.dom.items.each(function() {
646                    if ($(this).hasClass('display')) {
647                        self.delegate('itemTransform', $(this), movement);
648                    }
649                })
650            },
651            itemTransform: function(item, movement) {
652                this.delegate('itemFadeOut', item);
653                if (movement === 'next') {
654                    if (item.is('li:last-child')) {
655                        this.delegate('itemFadeIn', this.dom.items.first());
656                    } else {
657                        this.delegate('itemFadeIn', item.next());
658                    }
659                } else if (movement === 'previous') {
660                    if (item.is('li:first-child')) {
661                        this.delegate('itemFadeIn', this.dom.items.last());
662                    } else {
663                        this.delegate('itemFadeIn', item.prev());
664                    }
665                }
666            },
667            itemFadeIn: function(item) {
668                item.fadeIn(this.settings.fadeInSpeed, function() {
669                    item.addClass('display');
670                });
671            },
672            itemFadeOut: function(item) {
673                item.fadeOut(this.settings.fadeOutSpeed, function() {
674                    item.removeClass('display');
675                });
676            },
677            start: function() {
678                var self = this;
679                this.animationId = window.setInterval(function() {
680                    self.delegate('adjacentItem', 'next');
681                }, this.settings.transitionSpeed)
682            },
683            pause: function() {
684                clearInterval(this.animationId);
685                this.api('pause');
686                return this;
687            },
688            resume: function() {
689                this.delegate('start');
690                this.api('resume');
691                return this;
692            },
693            next: function() {
694                this.delegate('pause').delegate('adjacentItem', 'next');
695                return this;
696            },
697            previous: function() {
698                this.delegate('pause').delegate('adjacentItem', 'previous');
699                return this;
700            }
701        },
702        reveal: {
703            init: function() {
704                this.progress = {
705                    animate: true,
706                    original: {},
707                    span: {},
708                    text: '',
709                    html: '',
710                    length: 0,
711                    i: 0,
712                    j: 0,
713                    k: 0,
714                    elements: {},
715                    nextHtml: {},
716                    nextHtmlIndex: [],
717                    nextHtmlContent: ''
718                };
719            },
720            settings: function() {
721                return {
722                    'letterRevealSpeed': 70,
723                    'transitionSpeed': 2000,
724                    'pauseOnHover': false
725                };
726            },
727            getLength: function() {
728                var progress = this.progress;
729                if (progress.length === 0) {
730                    progress.length = progress.text.length;
731                }
732                return progress.text.length;
733            },
734            resetTicker: function(vars) {
735                var progress = this.progress;
736                progress.span = vars.span;
737                progress.elements = vars.elements;
738                progress.text = vars.text;
739                progress.html = vars.html;
740                progress.length = 0;
741                progress.j = 0;
742                this.delegate('getNextHtml');
743                progress.i = 0;
744            },
745            getNextHtml: function() {
746                var progress = this.progress;
747                if (progress.elements.length <= progress.j) {
748                    progress.nextHtml = {};
749                    progress.nextHtmlIndex = [-1];
750                } else {
751                    progress.nextHtml = progress.elements[progress.j];
752                    progress.nextHtmlIndex = progress.nextHtml.indeces;
753                    progress.nextHtmlContent = $(progress.nextHtml).text();
754                    progress.k = 0;
755                }
756            },
757            increment: function() {
758                var self = this,
759                    progress = self.progress;
760                if (progress.nextHtmlIndex.start === progress.i) {
761                    clearInterval(this.animationId);
762                    this.animationId = window.setInterval(function() {
763                        self.delegate('incrementHtml');
764                    }, self.settings.letterRevealSpeed);
765                } else {
766                    progress.span.html(progress.text.slice(0, progress.i));
767                    progress.i += 1;
768                }
769            },
770            incrementHtml: function() {
771                var self = this,
772                    progress = self.progress,
773                    text = progress.span.text,
774                    element = $(self.delegate('getOuterHtml', $(progress.nextHtml))),
775                    reveal;
776                progress.k += 1;
777                reveal = progress.nextHtmlContent.slice(0, progress.k);
778                element = $(self.delegate('getOuterHtml', element.children().text(reveal)));
779                progress.span.html(progress.text.slice(0, progress.i) + element.html());
780                if (progress.k === progress.nextHtmlIndex.length) {
781                    progress.i += progress.nextHtmlIndex.element.html().length;
782                    clearInterval(this.animationId);
783                    progress.j += 1;
784                    self.delegate('getNextHtml');
785                    this.animationId = window.setInterval(function() {
786                        self.delegate('revealLetter');
787                    }, self.settings.letterRevealSpeed);
788                }
789            },
790            revealAll: function() {
791                var progress = this.progress;
792                progress.span.html(progress.html);
793                progress.i = this.delegate('getLength');
794            },
795            manipulateDom: function() {
796                var self = this,
797                    dom = self.dom,
798                    list = dom.list;
799                dom.wrapper.css({
800                    'width': '100%'
801                });
802                dom.title.css({
803                    'float': 'left',
804                    'overflow': 'hidden'
805                });
806                list.css({
807                    'float': 'left',
808                    'position': 'relative',
809                    'list-style': 'none',
810                    'margin': 0,
811                    'padding': 0
812                });
813                list.width(this.api('getListWidth') + 'px');
814            },
815            pause: function() {
816                this.delegate('stopAnimation');
817                this.delegate('revealAll');
818                this.api('pause');
819                return this;
820            },
821            resume: function() {
822                var self = this,
823                    progress = self.progress;
824                progress.animate = true;
825                this.animationId = window.setTimeout(function() {
826                    self.delegate('adjacentItem', 'next');
827                }, 50);
828                self.api('resume');
829                return self;
830            },
831            adjacent: function(side) {
832                this.delegate('stopAnimation');
833                this.api('pause');
834                this.delegate('adjacentItem', side);
835                this.delegate('revealAll');
836                return this;
837            },
838            previous: function() {
839                return this.delegate('adjacent', 'previous');
840            },
841            next: function() {
842                return this.delegate('adjacent', 'next');
843            },
844            stopAnimation: function() {
845                clearInterval(this.animationId);
846                this.progress.animate = false;
847            },
848            manipulateItem: function(item, is_first) {
849                item.css({
850                    'position': 'absolute',
851                    'left': 0,
852                    'top': 0,
853                    'z-index': 1
854                }).wrapInner('<span class="original_text" />');
855                item.children('span').css({
856                    'opacity': 0,
857                    'display': 'block',
858                    'position': 'relative',
859                    'z-index': 4
860                });
861                if (is_first) {
862                    item.addClass('revealing');
863                }
864            },
865            itemLoop: function() {
866                var is_first = true,
867                    self = this,
868                    dom = self.dom;
869                dom.items.each(function() {
870                    self.delegate('manipulateItem', $(this), is_first);
871                    is_first = false;
872                });
873            },
874            prepareItem: function() {
875                var self = this,
876                    item = self.dom.list.find('.revealing'),
877                    progress = self.progress,
878                    html, text;
879                if (item.children('.revealing_text').length === 0) {
880                    item.append('<span class="revealing_text" />').children('.revealing_text').css({
881                        'opacity': 1,
882                        'position': 'absolute',
883                        'left': 0,
884                        'top': 0
885                    });
886                }
887                item.css({
888                    'z-index': 2
889                });
890                html = item.children('.original_text');
891                text = self.delegate('decodeHtml', html.html());
892                this.delegate('resetTicker', {
893                    span: item.children('.revealing_text'),
894                    text: text,
895                    html: html.html(),
896                    elements: this.delegate('getElements', html, text)
897                });
898                if (progress.animate === true) {
899                    self.delegate('animate');
900                }
901            },
902            getElements: function(html, text) {
903                var self = this,
904                    elements = html.children();
905                elements.each(function(i, element) {
906                    elements[i].indeces = self.delegate('getElement', $(element), html.html());
907                });
908                return elements;
909            },
910            getElement: function(element, original_string) {
911                var el = this.delegate('getOuterHtml', element),
912                    start = original_string.indexOf(el.html()),
913                    length = element.text().length;
914                return {
915                    'start': start,
916                    'length': length,
917                    'element': el
918                };
919            },
920            decodeHtml: function(string) {
921                string = string.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
922                string = $("<div/>").html(string).html();
923                return string;
924            },
925            getOuterHtml: function(element) {
926                return element.clone().wrap('<p>').parent();
927            },
928            animate: function() {
929                var self = this;
930                this.animationId = window.setInterval(function() {
931                    self.delegate('revealLetter');
932                }, self.settings.letterRevealSpeed);
933            },
934            revealLetter: function() {
935                var self = this,
936                    progress = self.progress;
937                self.delegate('increment');
938                if (progress.i > self.delegate('getLength')) {
939                    clearInterval(this.animationId);
940                    this.animationId = window.setTimeout(function() {
941                        self.delegate('adjacentItem', 'next');
942                    }, self.settings.transitionSpeed);
943                }
944            },
945            adjacentItem: function(side) {
946                var dom = this.dom,
947                    current = dom.list.find('.revealing').removeClass('revealing'),
948                    adjacent = this.delegate(side === 'previous' ? 'getPreviousItem' : 'getNextItem', dom, current);
949                adjacent.addClass('revealing');
950                current.css({
951                    'z-index': 1
952                }).children('.revealing_text').text('');
953                this.delegate('prepareItem');
954            },
955            getNextItem: function(dom, current) {
956                return (current.is('li:last-child')) ? dom.list.find('li:first-child') : current.next();
957            },
958            getPreviousItem: function(dom, current) {
959                return (current.is('li:first-child')) ? dom.list.find('li:last-child') : current.prev();
960            },
961            start: function() {
962                if (this.settings.autoStart === true) {
963                    this.delegate('prepareItem');
964                }
965            }
966        },
967        scroll: {
968            init: function() {
969                this.progress = {
970                    autoScroll: this.settings.autoStart,
971                    left: 0,
972                    boundary: 0,
973                    last: {},
974                    current: {},
975                    animationId: 0
976                };
977            },
978            resetLeft: function() {
979                this.progress.left = parseInt(this.dom.list.css('left'));
980            },
981            settings: function() {
982                return {
983                    'scrollSpeed': 50,
984                    'slideSpeed': 1000,
985                    'slideEasing': 'swing',
986                    'pauseOnHover': true
987                };
988            },
989            manipulateDom: function(is_secondary) {
990                var dom = this.dom,
991                    is_secondary = typeof(is_secondary) === 'undefined' ? false : is_secondary;
992                if (is_secondary === false) {
993                    dom.wrapper.css({
994                        'width': '10000px',
995                        'position': 'relative'
996                    });
997                    dom.title.css({
998                        'float': 'left'
999                    });
1000                    dom.list.wrap('<div class="newsticker_scroller" />').css({
1001                        'position': 'absolute',
1002                        'left': 10
1003                    });
1004                    dom.scroller = this.dom.wrapper.children('.newsticker_scroller');
1005                } else if (is_secondary === true) {
1006                    dom.wrapper.css({
1007                        'width': '100%'
1008                    });
1009                    dom.scroller.css({
1010                        'position': 'absolute',
1011                        'height': '100%',
1012                        'overflow': 'hidden',
1013                        'width': this.api('getListWidth') + 'px',
1014                        'left': dom.title.outerWidth(true) + 'px'
1015                    });
1016                }
1017            },
1018            manipulateItem: function(item, x) {
1019                var width = item.css({
1020                    'float': 'left'
1021                }).outerWidth(true);
1022                item.css({
1023                    'position': 'absolute',
1024                    'display': 'inline',
1025                    'left': x + 'px',
1026                    'width': width + 'px'
1027                });
1028                x += width;
1029                return x;
1030            },
1031            itemLoop: function() {
1032                var self = this,
1033                    x = 0,
1034                    progress = this.progress,
1035                    dom = this.dom;
1036                dom.items.each(function() {
1037                    x = self.delegate('manipulateItem', $(this), x);
1038                });
1039                progress.current = dom.items.first();
1040                progress.last = dom.items.last();
1041                progress.boundary = dom.items.length === 1 ? progress.current.width() : progress.current.next().position().left;
1042                self.delegate('manipulateDom', true);
1043            },
1044            start: function() {
1045                if (this.progress.autoScroll === true) {
1046                    this.delegate('animate');
1047                }
1048            },
1049            animate: function() {
1050                var self = this,
1051                    progress = self.progress;
1052                if (progress.autoScroll === false) {
1053                    progress.autoScroll = true;
1054                }
1055                progress.animationId = window.setInterval(function() {
1056                    self.delegate('doAnimation');
1057                }, self.settings.scrollSpeed);
1058            },
1059            doAnimation: function() {
1060                var progress = this.progress;
1061                if (progress.left + progress.boundary < 0) {
1062                    this.delegate('nextItem');
1063                }
1064                progress.left -= 1;
1065                this.dom.list.css({
1066                    'left': progress.left + 'px'
1067                });
1068            },
1069            pause: function() {
1070                var progress = this.progress;
1071                progress.autoScroll = false;
1072                clearInterval(progress.animationId);
1073                this.api('pause');
1074                return this;
1075            },
1076            resume: function() {
1077                this.delegate('animate');
1078                this.api('resume');
1079                return this;
1080            },
1081            next: function() {
1082                var self = this,
1083                    progress = self.progress,
1084                    settings = self.settings,
1085                    left = progress.boundary < 0 ? progress.left - progress.current.width() : '-' + progress.boundary;
1086                self.delegate('pause');
1087                self.dom.list.animate({
1088                    'left': left + 'px'
1089                }, settings.slideSpeed, settings.slideEasing, function() {
1090                    self.delegate('resetLeft');
1091                    self.delegate('nextItem');
1092                });
1093            },
1094            resize: function() {
1095                this.dom.scroller.width(this.api('getListWidth'));
1096            },
1097            previous: function() {
1098                var self = this,
1099                    progress = self.progress,
1100                    settings = self.settings,
1101                    previous, left;
1102                self.delegate('pause');
1103                previous = self.delegate('getPrevious');
1104                previous.css({
1105                    'left': progress.current.position().left - parseInt(previous.width())
1106                });
1107                left = previous.position().left < 0 ? (0 - previous.position().left) : '-' + previous.position().left;
1108                self.dom.list.animate({
1109                    'left': left + 'px'
1110                }, settings.slideSpeed, settings.slideEasing, function() {
1111                    self.delegate('resetLeft');
1112                    self.delegate('previousItem', previous);
1113                });
1114            },
1115            nextItem: function() {
1116                var progress = this.progress,
1117                    dom = this.dom,
1118                    last = dom.items.last(),
1119                    first = dom.items.first(),
1120                    new_x = progress.last.outerWidth() + progress.last.position().left,
1121                    current = progress.current;
1122                current.css({
1123                    'left': new_x + 'px'
1124                });
1125                if (current.next().length === 0) {
1126                    progress.current = first;
1127                    progress.last = last;
1128                } else {
1129                    progress.current = current.next();
1130                    progress.last = progress.current.prev();
1131                }
1132                if (progress.current.next().length === 0) {
1133                    progress.boundary = first.position().left;
1134                } else {
1135                    progress.boundary = progress.current.next().position().left;
1136                }
1137            },
1138            getPrevious: function() {
1139                var progress = this.progress;
1140                if (progress.current.prev().length === 0) {
1141                    return this.dom.items.last();
1142                }
1143                return progress.current.prev();
1144            },
1145            previousItem: function(previous) {
1146                var progress = this.progress,
1147                    dom = this.dom;
1148                progress.current = previous;
1149                if (progress.current.prev().length === 0) {
1150                    progress.last = dom.items.last();
1151                } else {
1152                    progress.last = progress.current.prev();
1153                }
1154                if (progress.current.next().length === 0) {
1155                    progress.boundary = dom.items.first().position().left;
1156                } else {
1157                    progress.boundary = progress.current.next().position().left;
1158                }
1159            }
1160        }
1161    }
1162})(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.