1/** 2 * å³ä¾§æ 头æ¡è°ç¨ 3 * woody 16.4.28 4 */ 5 6if(typeof $ != 'undefined'){ 7 var rdata = []; 8 rdata.push('news,xinwen,.newsRight'); 9 rdata.push('chanye,chanye,#rightDiv'); 10 rdata.push('hd,huodong,.con_rt'); 11 rdata.push('xin,xinyou,.cont_rt'); 12 rdata.push('fahao,fahao2017,.bodyRight'); 13 rdata.push('youxiku,youxiku,.w250 > .bStyle'); 14 rdata.push('c,c,.this_300'); 15 16 $.fn.countTo = function (options) { 17 options = options || {}; 18 19 return $(this).each(function () { 20 // set options for current element 21 var settings = $.extend({}, $.fn.countTo.defaults, { 22 from: $(this).data('from'), 23 to: $(this).data('to'), 24 speed: $(this).data('speed'), 25 refreshInterval: $(this).data('refresh-interval'), 26 decimals: $(this).data('decimals') 27 }, options); 28 29 // how many times to update the value, and how much to increment the value on each update 30 var loops = Math.ceil(settings.speed / settings.refreshInterval), 31 increment = (settings.to - settings.from) / loops; 32 33 // references & variables that will change with each update 34 var self = this, 35 $self = $(this), 36 loopCount = 0, 37 value = settings.from, 38 data = $self.data('countTo') || {}; 39 40 $self.data('countTo', data); 41 42 // if an existing interval can be found, clear it first 43 if (data.interval) { 44 clearInterval(data.interval); 45 } 46 data.interval = setInterval(updateTimer, settings.refreshInterval); 47 48 // initialize the element with the starting value 49 render(value); 50 51 function updateTimer() { 52 value += increment; 53 loopCount++; 54 55 render(value); 56
57 if (typeof(settings.onUpdate) == 'function') { 58 settings.onUpdate.call(self, value); 59 } 60 61 if (loopCount >= loops) { 62 // remove the interval 63 $self.removeData('countTo'); 64 clearInterval(data.interval); 65 value = settings.to; 66 67 if (typeof(settings.onComplete) == 'function') { 68 settings.onComplete.call(self, value); 69 } 70 } 71 } 72 73 function render(value) { 74 var formattedValue = settings.formatter.call(self, value, settings); 75 $self.html(formattedValue); 76 } 77 }); 78 }; 79 80 function formatter(value, settings) { 81 return value; 82 //return value.toFixed(settings.decimals); 83 } 84 85 $.fn.countTo.defaults = { 86 from: 0, // the number the element should start at 87 to: 0, // the number the element should end at 88 speed: 1000, // how long it should take to count between the target numbers 89 refreshInterval: 100, // how often the element should be updated 90 decimals: 0, // the number of decimal places to show 91 formatter: formatter, // handler for formatting the value before rendering 92 onUpdate: null, // callback method for every time the element is updated 93 onComplete: null // callback method for when the element finishes updating 94 }; 95 96 function count(options) { 97 var $this = $(this); 98 options = $.extend({}, options || {}, $this.data('countToOptions') || {}); 99 $this.countTo(options); 100 } 101 102 $(function(){ 103 var host = window.location.host; 104 var api_url = 'http://www.07073.com/api/toutiao.php'; 105 var base_style = '<link href="http://m1.073img.com/ued2016/theTodayHeadlines/theTodayHeadlines.css" rel="stylesheet" type="text/css" />'; 106 var domains = host.split('.')[0]; 107 var inf, color=''; 108 109 if(domains == 'news'){ 110 //æé¤æ°é»é¦é¡µ 111 if($('#xc1').length > 0){ 112 domains = ''; 113 } 114 }else if(domains == 'huoying' || domains == 'www'){ 115 if($('.subSearch').length > 0){ 116 //游æåº 117 domains = 'youxiku'; 118 color = '<style>.theTodayHeadlinesMaxing {padding-top:10px; margin-bottom:0px; border:none; border-top:1px #eaeaea solid} </style>'; 119 } else if($('.this_bgall').length > 0){ 120 domains = 'c'; 121 color = $('.this_message_tit dt').css('border-color') 122 color = '<style>.theTodayHeadlinesMaxing p a:hover { background-color: '+color+'; color: '+color+'; }.theTodayHeadlinesMaxing p a:hover, .theTodayHeadlinesListx dt { background-color: '+color+'; }.theTodayHeadlinesListx dt, .theTodayHeadlinesListx dd, .theTodayHeadlinesTitlex { border-color: '+color+'; }</style>'; 123 } 124 } 125 126 for(var i=0; i<rdata.length; i++){ 127 if(rdata[i].indexOf(domains+',') == 0){ 128 inf = rdata[i].split(','); 129 break; 130 } 131 } 132 133 134 if(inf && inf.length == 3){ 135 $('body').append(base_style); 136 $('body').append('<link href="http://m1.073img.com/ued2016/theTodayHeadlines/'+inf[1]+'.css" rel="stylesheet" type="text/css" />'); 137 if(color != ''){ 138 $('body').append(color); 139 } 140 $.ajax({ 141 type: "get", 142 async: false, 143 url: api_url, 144 dataType: "jsonp", 145 jsonp: "callback", 146 jsonpCallback:"_cb", 147 success: function(json){ 148 window.setTimeout(function(){ 149 if(domains == 'youxiku'){ 150 $(inf[2]).eq(0).append(json.html); 151 } else { 152 $(inf[2]).eq(0).prepend(json.html); 153 } 154 155 //$('.hl_count_timer').each(count); 156 157 }, 500); 158 }, 159 error: function(){ 160 //just do nothing 161 } 162 }); 163 } 164 }); 165 166 function rndTT(show_num){ 167 var dl = $('.theTodayHeadlinesListx dl').hide(); 168 var l, n = 0; 169 while(1){ 170 l = Math.floor(Math.random()*(dl.length)); 171 if(dl.eq(l).is(':hidden')){ 172 dl.eq(l).show(); 173 n ++; 174 } 175 if(n == show_num){ 176 break; 177 } 178 } 179 } 180 181}
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.