1(function(jQuery){ 2 3 $.fn.BreakingNews = function(settings){ 4 var defaults={ 5 background :'none', 6 7 titlecolor :'#FFF', 8 titlebgcolor :'#000000', 9 linkcolor :'#000000', 10 linkhovercolor :'#000000', 11 fonttextsize :16, 12 isbold :false, 13 border :'none', 14 width :'100%', 15 autoplay :true, 16 timer :3000, 17 modulid :'brekingnews', 18 effect :'fade' //or slide 19 }; 20 var settings=$.extend(defaults,settings); 21 22 return this.each(function(){ 23 settings.modulid="#"+$(this).attr("id"); 24 var timername=settings.modulid; 25 var activenewsid=1; 26 27 if (settings.isbold==true) 28 fontw='bold'; 29 else 30 fontw='normal'; 31 32 if (settings.effect=='slide') 33 $(settings.modulid+' ul li').css({'display':'block'}); 34 else 35 $(settings.modulid+' ul li').css({'display':'none'}); 36 37 $(settings.modulid+' .bn-title').html(settings.title); 38 $(settings.modulid).css({'width':settings.width, 'background':settings.background, 'border':settings.border, 'font-size':settings.fonttextsize }); 39 $(settings.modulid+' ul').css({'left':$(settings.modulid+' .bn-title').width()+0}); 40 /*$(settings.modulid+' .bn-title').css({'background':settings.titlebgcolor,'color':settings.titlecolor,'font-weight':fontw});*/ 41 $(settings.modulid+' ul li a').css({'color':settings.linkcolor,'font-weight':fontw,'height':parseInt(settings.fonttextsize)+6}); 42 $(settings.modulid+' ul li').eq( parseInt(activenewsid-1) ).css({'display':'block'}); 43 44 // Links hover events ...... 45 $(settings.modulid+' ul li a').hover(function() 46 { 47 $(this).css({'color':settings.linkhovercolor}); 48 }, 49 function () 50 { 51 $(this).css({'color':settings.linkcolor}); 52 } 53 ); 54 55 56 // Arrows Click Events ...... 57 $(settings.modulid+' .bn-arrows span').click(function(e) { 58 if ( $(this).attr('class')=="bn-arrows-left" ) 59 BnAutoPlay('prev'); 60 else 61 BnAutoPlay('next'); 62 }); 63 64 // Timer events ............... 65 if (settings.autoplay==true) 66 { 67 timername=setInterval(function(){BnAutoPlay('next')},settings.timer); 68 $(settings.modulid).hover(function() 69 { 70 clearInterval(timername); 71 }, 72 function() 73 { 74 timername=setInterval(function(){BnAutoPlay('next')},settings.timer); 75 } 76 ); 77 } 78 else 79 { 80 clearInterval(timername); 81 } 82 83 //timer and click events function ........... 84 function BnAutoPlay(pos) 85 { 86 if ( pos=="next" ) 87 { 88 if ( $(settings.modulid+' ul li').length>activenewsid ) 89 activenewsid++; 90 else 91 activenewsid=1; 92 } 93 else 94 { 95 if (activenewsid-2==-1) 96 activenewsid=$(settings.modulid+' ul li').length; 97 else 98 activenewsid=activenewsid-1; 99 } 100 101 if (settings.effect=='fade') 102 { 103 $(settings.modulid+' ul li').css({'display':'none'}); 104 $(settings.modulid+' ul li').eq( parseInt(activenewsid-1) ).fadeIn(); 105 } 106 else 107 { 108 $(settings.modulid+' ul').animate({'marginTop':-($(settings.modulid+' ul li').height()+20)*(activenewsid-1)}); 109 } 110 } 111 112 // links size calgulating function ........... 113 $(window).resize(function(e) { 114 if ( $(settings.modulid).width()<360 ) 115 { 116 $(settings.modulid+' .bn-title').html(' '); 117 $(settings.modulid+' .bn-title').css({ 'width':'4px', 'padding':'10px 0px'}); 118 $(settings.modulid+' ul').css({'left':4}); 119 }else 120 { 121 $(settings.modulid+' .bn-title').html(settings.title); 122 $(settings.modulid+' .bn-title').css({ 'width':'auto', 'padding':'5px 10px'}); 123 $(settings.modulid+' ul').css({'left':$(settings.modulid+' .bn-title').width()+40}); 124 } 125 }); 126 }); 127 128 }; 129 130})(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.