1/** 2 * 主è¦ä¸ºäºå®ç°æç« è¯ä»·åè½ 3 * add by lcfeng 4 */ 5; 6(function($) { 7 $.fn.WPVisitCount = function(options) { 8 var defaults = {}; 9 var options = $.extend(defaults, options); 10 $(this).each(function() { 11 var url = $(this).attr("url"); 12 if (url) { 13 initVisitCount(url, $(this)); 14 } 15 }); 16 17 //åå§åè®¿é®æ¬¡æ° 18 function initVisitCount(url, obj) { 19 $.ajax({ 20 type: "post", 21 dataType: "text", 22 url: url, 23 success: function(result) { 24 if (result !== '' && result !== '0' && result !== '<span>0</span>') { 25 obj.html(result); 26 obj.show(); 27 } 28 }, 29 error: function(error) { 30 } 31 }); 32 } 33 }; 34 35 $.fn.WPColListVisitCount = function(options) { 36 var defaults = {}; 37 var options = $.extend(defaults, options); 38 var colId = new Array(); 39 var colIds = ""; 40 $(this).each(function() { 41 var id = $(this).attr("colId"); 42 var siteId = $(this).attr("siteId"); 43 id += "_" + siteId; 44 colId.push(id); 45 colId = unique(colId); 46 }); 47 colIds = colId.join(","); 48 if (colIds == "") { 49 return; 50 } 51 var url = ""; 52 var con = $("script[sudy-wp-context]").attr("sudy-wp-context"); 53 if (con) { 54 con = "/" + con; 55 url += con; 56 } 57// url += "/_visitcountdisplay?columnIds=" + colIds; 58 url += "/_visitcountdisplay?funType=0"; 59 var type = $("span[class=WP_ColsVisitCount]").attr("type"); 60 if (type) { 61 url += "&type=" + type; 62 } 63// url += "&funType=0"; 64 initColListVisitCount(url, colIds); 65 }; 66 67 function initColListVisitCount(url, colIds) { 68 $.ajax({ 69 url: url, 70 dataType: 'json', 71 type: 'post', 72 data: {columnIds: colIds}, 73 success: function(result) { 74 if (result !== '' && result !== null) { 75 $.each(result, function(n, value) { 76 var listVisitCount = $("span[colListVisitCountId=wp_colListVisitCount_" + value.columnId + "]"); 77 var oldCount = listVisitCount.html(); 78 var num = oldCount > value.count ? (oldCount - value.count) : (value.count - oldCount); 79 var total = value.count + num; 80 listVisitCount.html(total); 81 listVisitCount.css('visibility', 'visible'); 82 }); 83 } 84 } 85 }); 86 } 87 ; 88 89 $.fn.WPArticleReadStatus = function(options) { 90 var defaults = {}; 91 var options = $.extend(defaults, options); 92 var artId = new Array(); 93 var articleIds = ""; 94 $(this).each(function() { 95 var id = $(this).attr("artId"); 96 artId.push(id); 97 artId = unique(artId); 98 }); 99 articleIds = artId.join(","); 100 if (articleIds != null && articleIds != '') { 101 var url = ""; 102 var con = $("script[sudy-wp-context]").attr("sudy-wp-context"); 103 if (con) { 104 con = "/" + con; 105 url += con; 106 } 107 url += "/_visitcountdisplay?articleIds=" + articleIds; 108 var siteId = $("script[sudy-wp-siteId]").attr("sudy-wp-siteId"); 109 if (siteId) { 110 url += "&siteId=" + siteId; 111 } 112 url += "&funType=1"; 113 initReadStatus(url); 114 } 115 }; 116 117 function unique(arr) { 118 var res = []; 119 var json = {}; 120 for (var i = 0; i < arr.length; i++) { 121 if (!json[arr[i]]) { 122 res.push(arr[i]); 123 json[arr[i]] = 1; 124 } 125 } 126 return res; 127 } 128 129 function initReadStatus(url) { 130 $.ajax({ 131 url: url, 132 dataType: 'text', 133 type: "post", 134 success: function(result) { 135 if (result !== "") { 136 var artIds = result.split(","); 137 for (var i = 0; i < artIds.length; i++) { 138 $("span[readStatusId=wp_artReadStauts_" + artIds[i] + "]").addClass("wp_artReadStatus_unread"); 139 } 140 } 141 } 142 }); 143 } 144 ; 145 146 $.fn.WPListVisitCount = function(options) { 147 var defaults = {}; 148 var options = $.extend(defaults, options); 149 var artId = new Array(); 150 var articleIds = ""; 151 $(this).each(function() { 152 var id = $(this).attr("artId"); 153 artId.push(id); 154 artId = unique(artId); 155 }); 156 articleIds = artId.join(","); 157 if (articleIds != null && articleIds != '') { 158 var url = ""; 159 var con = $("script[sudy-wp-context]").attr("sudy-wp-context"); 160 if (con) { 161 con = "/" + con; 162 url += con; 163 } 164 url += "/_visitcountdisplay?articleIds=" + articleIds; 165 var siteId = $("script[sudy-wp-siteId]").attr("sudy-wp-siteId"); 166 if (siteId) { 167 url += "&siteId=" + siteId; 168 } 169 var type = $("span[class=wp_listVisitCount]").attr("type"); 170 if (type) { 171 url += "&type=" + type; 172 } 173 url += "&funType=0"; 174 initListVisitCount(url); 175 } 176 }; 177 178 function initListVisitCount(url) { 179 $.ajax({ 180 url: url, 181 dataType: 'json', 182 type: 'post', 183 success: function(result) { 184 if (result !== '' && result !== null) { 185 $.each(result, function(n, value) { 186 var listVisitCount = $("span[listVisitCountId=wp_listVisitCount_" + value.articleId + "]"); 187 listVisitCount.html(value.count); 188 listVisitCount.css('visibility', 'visible'); 189 }); 190 } 191 } 192 }); 193 } 194 ; 195})(jQuery); 196 197$(document).ready(function() { 198 if ($('.WP_VisitCount').hasClass('WP_VisitCount')) { 199 $('.WP_VisitCount').WPVisitCount(); 200 } 201 if ($('.wp_artReadStatus').hasClass('wp_artReadStatus')) { 202 $('.wp_artReadStatus').WPArticleReadStatus(); 203 } 204 if ($('.wp_listVisitCount').hasClass('wp_listVisitCount')) { 205 $('.wp_listVisitCount').WPListVisitCount(); 206 } 207 if ($('.WP_ColsVisitCount').hasClass('WP_ColsVisitCount')) { 208 $('.WP_ColsVisitCount').WPColListVisitCount(); 209 } 210});
211 212//ä¸é¢è¿ä¸ªæ ¹æ®ipè·åå°åçæ¥å£åäºï¼å¦æè¦ä½¿ç¨ï¼éè¦å¦æ¾æ¥å£ 213//$().ready(function() { 214// $.ajax({ 215// type: 'get', 216// dataType: 'jsonp', 217// //url: "http://ip.chinaz.com/ajaxsync.aspx?at=ip&ip=" + ip, //è¿éæ¯url 218// url: "http://ip.chinaz.com/getip.aspx",//è°ç¨URLè¿åipåæ¥è®¿å°å è¿åå¼{ip:'xxx.xxx.xxx.xxx',address:'æ±èçåäº¬å¸ çµä¿¡'} 219// success: function(data) { 220// var address = data.address.replace("çµä¿¡", "").replace("ç§»å¨","").replace("èé","");//ååºå°åå¹¶ä¸å°éé¢çè¿è¥å廿 221// document.cookie = "ipAddressName=" + escape(address) + ";path=/; ";//å°å°åä¿¡æ¯å¡å ¥cookie 222// }, 223// error: function() { 224// 225// } 226// }); 227//}) 228 229/* 230let contextPath = $("script[sudy-wp-context]").attr("sudy-wp-context"); 231if (contextPath) { 232 contextPath = "/" + contextPath; 233} else { 234 contextPath = ""; 235} 236 237var script = document.createElement('script'); 238script.setAttribute('type', 'text/javascript'); 239script.setAttribute('src', contextPath+'/_js/tracker.min.js'); 240document.getElementsByTagName('head')[0].appendChild(script); 241 242window.onload = function () { 243 //åå§ååç¹ 244 var options = { 245 applicationId: "sudytech-sop", 246 host: '/tracker' 247 }; 248 249 tracker.init(options); 250 //æåç«ç¹ãæ ç®ãæç« 251 var info = document.images[document.images.length - 1]?.src.replace(/(.*?)siteId=(\d+)&type=(\d+)&(columnId|articleId)=(\d+)/g, '$2,$3,$5') 252 var array = info.split(",") 253 254 //æåå辨ç 255 var ratio = getRatio(); 256 var height = window.screen.height * getRatio() / 100 257 var wight = window.screen.width * getRatio() / 100 258 259 //æåè¯è¨ 260 var type = #.appName; 261 if (type == "Netscape") { 262 var lang = #.language; 263 } else { 264 var lang = #.userLanguage; 265 } 266 267 tracker.track("sudytech-sop", { 268 "siteId": array[0], 269 "type": array[1], 270 "objectId": array[2], 271 "extra": wight + "*" + height + "|" + lang, 272 }) 273}; 274 275function getRatio() { 276 var ratio = 0; 277 var screen = window.screen; 278 var ua = #.userAgent.toLowerCase(); 279 280 if (window.devicePixelRatio !== undefined) { 281 ratio = window.devicePixelRatio; 282 } else if (~ua.indexOf('msie')) { 283 if (screen.deviceXDPI && screen.logicalXDPI) { 284 ratio = screen.deviceXDPI / screen.logicalXDPI; 285 } 286 287 } else if (window.outerWidth !== undefined && window.innerWidth !== undefined) { 288 ratio = window.outerWidth / window.innerWidth; 289 } 290 291 if (ratio) { 292 ratio = Math.round(ratio * 100); 293 } 294 return ratio; 295} 296*/
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.