1/* 2# SP News Highlighter Module by JoomShaper.com 3# -------------------------------------------- 4# Author JoomShaper http://www.joomshaper.com 5# Copyright (C) 2010 - 2014 JoomShaper.com. All Rights Reserved. 6# License - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL 7# Websites: http://www.joomshaper.com 8*/ 9 10(function($){ 11 12 $.fn.spNewsHighlighter = function(options) { 13 14 var settings = { 15 'interval': 5000, 16 'fxduration': 1000, 17 'animation': 'slide-vertical' 18 }; 19 20 this.each(function() { 21 22 if (options) { 23 $.extend(settings, options); 24 } 25 26 var wrapper = this; 27 28 var SPNewsHighlighter = function(){ 29 30 this.items = $(wrapper).find('.sp-nh-item').find('>div'); 31 this.count = (this.items.length) - 1; 32 this.navPrev = $(wrapper).find('.sp-nh-prev'); 33 this.navNext = $(wrapper).find('.sp-nh-next'); 34 this.sliding = false; 35 36 this.getCurrentIndex = function(){ 37 return this.items.filter('.current').index(); 38 }; 39 40 this.go = function(index, direction){ 41 42 if(this.sliding === false) 43 { 44 this.sliding = true; 45 var that = this; 46 this.previous = this.items.eq(this.getCurrentIndex()); 47 this.current = this.items.eq(index); 48 49 50 if (settings.animation == 'fade') { 51 this.previous.removeClass('current').css('display', 'none'); 52 this.current.fadeIn(settings.fxduration, function(){ 53 that.sliding = false; 54 }).addClass('current'); 55 } else if (settings.animation == 'slide-horizontal') { 56 57 this.previous.css({ 58 'display': 'block', 59 'position': 'absolute', 60 'overflow': 'hidden', 61 'top': 0, 62 'left': 0, 63 'width': $(wrapper).outerWidth(), 64 'height': this.previous.outerHeight() 65 }).animate({ 66 'left': (direction == 'left') ? -$(wrapper).outerWidth() : $(wrapper).outerWidth() 67 }, settings.fxduration, function(){ 68 $(this).removeAttr('style').css('display', 'none').removeClass('current') 69 that.sliding = false; 70 }); 71 72 this.current.css({ 73 'display': 'block', 74 'position': 'absolute', 75 'overflow': 'hidden', 76 'top': 0, 77 'left': ( direction == 'left' ) ? $(wrapper).outerWidth() : -$(wrapper).outerWidth(), 78 'width': $(wrapper).outerWidth(), 79 'height': this.current.outerHeight() 80 }).animate({ 81 'left': 0 82 }, settings.fxduration, function(){ 83 $(this).removeAttr('style').css('display', 'block').addClass('current') 84 $(wrapper).removeAttr('style') 85 that.sliding = false; 86 }); 87 88 } else if (settings.animation == 'slide-vertical') { 89 90 this.previous.css({ 91 'display': 'block', 92 'position': 'absolute', 93 'overflow': 'hidden', 94 'top': 0, 95 'left': 0, 96 'width': $(wrapper).outerWidth(), 97 'height': this.previous.outerHeight() 98 }).animate({ 99 'top': ( direction == 'left' ) ? -this.previous.outerHeight() : this.previous.outerHeight() 100 }, settings.fxduration, function(){ 101 $(this).removeAttr('style').css('display', 'none').removeClass('current') 102 that.sliding = false;
103 }); 104 105 this.current.css({ 106 'display': 'block', 107 'position': 'absolute', 108 'overflow': 'hidden', 109 'top': ( direction == 'left' ) ? this.current.outerHeight() : -this.current.outerHeight(), 110 'left': 0, 111 'width': $(wrapper).outerWidth(), 112 'height': this.current.outerHeight() 113 }).animate({ 114 'top': 0 115 }, settings.fxduration, function(){ 116 $(this).removeAttr('style').css('display', 'block').addClass('current') 117 $(wrapper).removeAttr('style') 118 that.sliding = false; 119 }); 120 121 } else { 122 this.previous.css('display', 'none').removeClass('current'); 123 this.current.css('display', 'block').addClass('current'); 124 that.sliding = false; 125 } 126 127 } 128 129 }; 130 131 this.next = function(){ 132 var index = this.getCurrentIndex(); 133 if (index < this.count) { 134 this.go(index + 1, 'left'); 135 } else { 136 this.go(0, 'left'); 137 } 138 }; 139 140 this.prev = function(){ 141 var index = this.getCurrentIndex(); 142 if (index > 0) { 143 this.go(index - 1, 'right'); 144 } else { 145 this.go(this.count, 'right'); 146 } 147 }; 148 149 this.init = function(){ 150 this.items.hide().first().addClass('current').show(); 151 }; 152 153 }; 154 155 var spnewshighlighter = new SPNewsHighlighter(); 156 spnewshighlighter.init(); 157 158 var timer = function(){ 159 spnewshighlighter.next(); 160 }; 161 162 setInterval(timer, settings.interval);//Autoplay 163 164 spnewshighlighter.navNext.on('click', function(e){ 165 e.preventDefault(); 166 spnewshighlighter.next(); 167 }); 168 spnewshighlighter.navPrev.on('click', function(e){ 169 e.preventDefault(); 170 spnewshighlighter.prev(); 171 }); 172 173 }); 174}; 175})(jQuery); 176 177
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.