1(function (window, document) { 2 3 var jq = jQuery.noConflict(); 4 5 var dChuang = function () { 6 return new dChuang.fn.init(); 7 } 8 9 dChuang.fn = dChuang.prototype = { 10 constructor: dChuang, 11 jq: jq, 12 init: function () { }, 13 extend: function (obj) { 14 for (var k in obj) { 15 if (obj.hasOwnProperty(k)) { 16 this[k] = obj[k] 17 } 18 } 19 } 20 } 21 22 dChuang.fn.init.prototype = dChuang.fn; 23 dChuang.extend = dChuang.fn.extend; 24 dChuang.fn.extend({ 25 loadnextpage: function (options) { 26 var nextpage = jq('#' + options.nextpage); 27 var nextpageurl = nextpage.attr('rel'); 28 var totalpage = jq('div.pg label span').text().replace(/[^\d]/g, '') || jq('div.pg .last').text().replace(/[^\d]/g, '') || 0; 29 var curpage = parseInt(nextpage.attr('curpage')) || 1; 30 var loadmore = jq('#' + options.loadmore); 31 var loading = jq('#' + options.loading); 32 var lasttip = jq('#' + options.lasttip); 33 var pretext = options.pretext; 34 var showbox = jq('#' + options.showid); 35 var imgdir = options.imgdir; 36 var loadstatus = 0; 37 var autopagenum = parseInt(options.autopagenum); 38 var maxpage = (curpage + autopagenum) > totalpage ? totalpage : (curpage + autopagenum); 39 40 function autoload () { 41 var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; 42 var h = showbox.height() + showbox.offset().top - scrollTop - jq(window).height(); 43 if (h <= 0 && loadstatus != 1) { 44 loadstatus = 1; 45 loading.show(); 46 getnextpagecontent(); 47 } 48 } 49 50 if (autopagenum > 0) { 51 jq(window).on("scroll", autoload); 52 } 53 54 loadmore.click(function () { 55 if (loadstatus != 2) { 56 loadstatus = 2; 57 loadmore.hide(); 58 loading.show(); 59 getnextpagecontent(); 60 } 61 }); 62 63 function getnextpagecontent () { 64 65 if (curpage + 1 > totalpage) { 66 nextpage.hide(); 67 lasttip.show(); 68 jq(window).off("scroll", autoload); 69 loadstatus = 0; 70 return; 71 } 72 73 curpage++; 74 var url = nextpageurl + '&page=' + curpage + '&t=' + parseInt((+new Date() / 1000) / (Math.random() * 1000)); 75 var x = new Ajax('HTML'); 76 77 x.get(url, function (s) { 78 s = s.replace(/\n|\r/g, ''); 79 var regstr = new RegExp("\\<li id=\"" + pretext + "_(\\d+)\" class=\"item cl\"\\>(.+?)\\<\\/li>", "g"); 80 var lis = s.match(regstr); 81 dChuang().writeObj(lis); 82 var newlis = ''; 83 for (i in lis) { 84 if (i == 'index' || i == 'lastIndex' || i == 'input') { 85 continue; 86 } 87 var regstr2 = new RegExp("\\<li id=\"" + pretext + "_(\\d+)\" class=\"item cl\"\\>"); 88 var insertid = lis[i].match(regstr2); 89 if (!(jq("#" + pretext + '_' + insertid[1]).length > 0)) { 90 newlis = newlis + lis[i]; 91 } 92 } 93 var $newlis = jq(newlis); 94 showbox.append(newlis); 95 96 jq(".lazyload").lazyload({ 97 effect: "fadeIn", 98 threshold: 180, 99 loadclass: "lazyload", 100 bgcolor: "#eaeaea" 101 }); 102 nextpageurl = nextpageurl.replace(/&page=\d+/, '&page=' + (curpage + 1)); 103 if (curpage >= totalpage) { 104 nextpage.hide(); 105 lasttip.show(); 106 jq(window).off("scroll", autoload); 107 loadstatus = 0; 108 return; 109 } 110 if (loadstatus != 2 && curpage >= maxpage) { 111 loading.hide(); 112 loadmore.show(); 113 jq(window).off("scroll", autoload); 114 loadstatus = 0; 115 return; 116 } 117 loading.hide(); 118 if (loadstatus == 2) { 119 loadmore.show(); 120 } 121 loadstatus = 0; 122 }); 123 } 124 }, 125 writeObj: function (obj) { 126 var description = ""; 127 for (var i in obj) { 128 var property = obj[i]; 129 description += i + " = " + property + "\n"; 130 } 131 }, 132 togglelist: function (autopagenum, imgdir, flag) { 133 jq('#catlist li').click(function (e) { 134 var str = '<div class="loading"><div class="txt animation"></div><div class="txt animation-delay"></div><div class="txt short-animation"></div></div>'; 135 var id = jq(this).attr('data-id'); 136 jq('#postlist').html(str); 137 jq('#catlist li').removeClass("active"); 138 jq(this).addClass('active'); 139 var url = 'portal.php?id=' + id; 140 jq.ajax({
141 url: url, 142 dataType: 'html', 143 success: function (rs) { 144 rs = rs.replace(/\n|\r/g, ''); 145 jq('#postlist').html(jq(rs).find('#postlist').html()); 146 if (!flag) { 147 dChuang().loadnextpage({ 148 nextpage: 'autoloadpage', 149 loadmore: 'ptloadmore', 150 loading: 'ptloading', 151 pretext: 'post', 152 showid: 'postcontent', 153 lasttip: 'no_more', 154 autopagenum: autopagenum, 155 imgdir: imgdir 156 }); 157 } 158 jq(".lazyload").lazyload({ 159 effect: "fadeIn", 160 threshold: 180, 161 loadclass: "lazyload", 162 bgcolor: "#eaeaea" 163 }); 164 } 165 }) 166 }); 167 } 168 }); 169 170 dChuang.fn.extend({ 171 initScroll: function (options) { 172 jq(options.container).slide({ 173 titCell: options.titCell, 174 mainCell: options.mainCell, 175 effect: 'leftLoop', 176 autoPlay: true, 177 autoPage: true, 178 switchLoad: '_src' 179 }); 180 }, 181 fixed_top_nav: function () { 182 var ele = jq('#nv'); 183 var navdata = {}; 184 185 navdata.left = ele.offset().left; 186 navdata.top = ele.offset().top; 187 navdata.height = ele.height(); 188 189 jq(window).scroll(function () { 190 var h = navdata.top - jq(window).scrollTop(); 191 if (h <= 0) { 192 ele.css('position', 'fixed').css('left', '0').css('top', '0').css('z-index', '199').css('width', '100%'); 193 jq('#wp').css('margin-top', navdata.height + 20 + 'px'); 194 } else { 195 ele.css('position', '').css('left', '').css('top', '').css('width', ''); 196 jq('#wp').css('margin-top', 20 + 'px'); 197 } 198 }); 199 }, 200 fixed_side: function (ele, dis) {
201 jq(document).ready(function () { 202 jq(ele).theiaStickySidebar({ 203 additionalMarginTop: jq('#nv').height() + dis, 204 updateSidebarHeight: false 205 }); 206 }); 207 }, 208 announcement: function (box1, box2) { 209 jq(box1).slide({ 210 mainCell: box2, 211 effect: 'topLoop', 212 interTime: '4000', 213 autoPlay: true, 214 vis: 1 215 }); 216 } 217 }); 218 219 dChuang.fn.extend({ 220 toggleFav: function (favid, isFav) { 221 var referer = window.location.href; 222 223 if (!isFav) { 224 var url = jq('#del_favorite').attr('data-url'); 225 var hash = jq('#del_favorite').attr('data-hash'); 226 jq.ajax({ 227 url: url, 228 type: 'post', 229 data: { 230 deletesubmit: 'true', 231 formhash: hash, 232 handlekey: 'a_delete_' + favid 233 }, 234 success: function (data) { 235 window.location.href = referer; 236 } 237 }); 238 } else { 239 var url = jq('#add_favorite').attr('data-url'); 240 jq.ajax({ 241 url: url, 242 success: function (data) { 243 window.location.href = referer; 244 } 245 }); 246 } 247 }, 248 toggleDelFav: function () { 249 jq('#del_favorite').hover(function () { 250 jq('#del_favorite .default').hide(); 251 jq('#del_favorite .hover').show(); 252 }, function () { 253 jq('#del_favorite .default').show(); 254 jq('#del_favorite .hover').hide(); 255 }); 256 } 257 }); 258 259 dChuang.fn.extend({ 260 toggleact: function (imgdir) { 261 jq('#actlist li').click(function () { 262 jq(this).siblings().removeClass("active"); 263 var classes = jq(this).attr('class'); 264 jq(this).addClass('active'); 265 jq('#' + classes).siblings().animate({ opacity: '0' }, 300); 266 jq('#' + classes).siblings().hide(); 267 jq('#' + classes).animate({ opacity: '1' }, 300); 268 jq('#' + classes).show(); 269 jq(".lazyload").lazyload({ 270 effect: "fadeIn", 271 threshold: 180, 272 loadclass: "lazyload", 273 bgcolor: "#eaeaea" 274 }); 275 }); 276 }, 277 initshare: function (shareClass, config) { 278 socialShare(shareClass, config); 279 } 280 }); 281 282 dChuang.fn.extend({ 283 waterfall: function () { 284 var w = jq(".imglist").width() / 3; 285 var gap = 20; 286 var column = [0, 0, 0]; 287 288 jq(".imgitem").each(function (index, ele) { 289 var min = column[0]; 290 var minKey = 0; 291 column.forEach(function (v, i) { 292 if (min > v) { 293 min = v; 294 minKey = i; 295 } 296 }) 297 298 jq(ele).css({ 299 left: minKey * w, 300 top: min + gap 301 }); 302 303 column[minKey] += jq(ele).height() + gap; 304 }); 305 306 var h = Math.max.apply(null, column); 307 jq(".imglist").height(h); 308 } 309 }); 310 311 dChuang.fn.extend({ 312 showTime: function (flag) { 313 var myDate = new Date(); 314 var year = myDate.getFullYear(); 315 var month = myDate.getMonth() + 1; 316 var date = myDate.getDate(); 317 var dayArray = new Array("æææ¥", "ææä¸", "ææäº", "ææä¸", "ææå", "ææäº", "ææå "); 318 var day1 = myDate.getDay(); 319 var day = dayArray[day1]; 320 var hour = myDate.getHours(); 321 var minute = myDate.getMinutes(); 322 var second = myDate.getSeconds(); 323 var min = dChuang().checkTime(minute); 324 var sec = dChuang().checkTime(second); 325 var time1 = year + "å¹´" + month + "æ" + date + "æ¥"; 326 var time2 = hour + "ï¼" + min + "ï¼" + sec; 327 var time3 = month + "æ" + date + "æ¥"; 328 var time4 = hour + ":" + min + ":" + sec; 329 if (!flag) { 330 jq('#time').text(time1 + ' , ' + day + ' , ' + time2); 331 setTimeout("dChuang().showTime()", 500); 332 } else { 333 if (navigator.appName === 'Microsoft Internet Explorer') { 334 if (navigator.userAgent.match(/Trident/i) && (navigator.userAgent.match(/MSIE 8.0/i) || navigator.userAgent.match(/MSIE 7.0/i))) { 335 jq('#ctime').parent().hide(); 336 return; 337 } 338 } 339 jq('#ctime').text(time3 + ' ' + day + ' ' + time4); 340 setTimeout("dChuang().showTime(true)", 500); 341 } 342 }, 343 checkTime: function (i) { 344 if (i < 10) { 345 i = "0" + i; 346 } 347 return i; 348 }, 349 autorefresh: function (baseurl, showid) { 350 var loadstatus = 0; 351 var showbox = jq('#' + showid); 352 var url = baseurl + '&page=1&t=' + parseInt((+new Date() / 1000) / (Math.random() * 1000)); 353 354 setInterval(function () { 355 if (loadstatus) { 356 return; 357 } 358 loadstatus = 1; 359 var x = new Ajax('HTML'); 360 x.get(url, function (s) { 361 s = s.replace(/\n|\r/g, ''); 362 var regstr = new RegExp("\\<li id=\"item_(\\d+)\" class=\"item cl\"\\>(.+?)\\<\\/li>", "g"); 363 var lis = s.match(regstr); 364 var newlis = ''; 365 for (i in lis) { 366 if (i == 'index' || i == 'lastIndex') { 367 continue; 368 } 369 var regstr2 = new RegExp("\\<li id=\"item_(\\d+)\" class=\"item cl\"\\>"); 370 var insertid = lis[i].match(regstr2); 371 if (!(jq("#item_" + insertid[1]).length > 0)) { 372 newlis = newlis + lis[i]; 373 } 374 } 375 var $newlis = jq(newlis); 376 if ($newlis.length > 0) { 377 showbox.prepend($newlis); 378 if (jq('.no_post').length > 0) { 379 jq('.no_post').hide(); 380 } 381 } 382 loadstatus = 0; 383 }); 384 }, 10000); 385 }, 386 togglecontent: function (e, id, flag) { 387 e.preventDefault(); 388 if (flag) { 389 jq('#content_' + id).removeClass('telegraph_content_box'); 390 jq('#showc_' + id).hide(); 391 jq('#hidec_' + id).show(); 392 } else { 393 jq('#content_' + id).addClass('telegraph_content_box'); 394 jq('#hidec_' + id).hide(); 395 jq('#showc_' + id).show(); 396 } 397 398 } 399 });
400 401 window.dChuang = window.dbc = dChuang; 402 403})(window, document);
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.