1(function ($) { 2 $.fn.adSlide = function (A) { 3 return this.each(function () { 4 var t, 5 g = $(this), 6 c = $.extend(A), 7 u = c.effect, 8 k = c.delayTime, 9 v = c.autoPlay, 10 B = c.interTime, 11 r = c.prevCell, 12 n = c.nextCell, 13 b = c.bigPic, 14 h = c.smallPic; 15 c = ""; 16 var p = g.find(r), 17 w = g.find(n), 18 e = g.find(b), 19 l = e.find("li"), 20 m = g.find(h), 21 f = l.outerWidth(!0), 22 d = l.length, 23 a = 0, 24 x = parseInt(p.css("left")), 25 y = parseInt(p.width()); 26 for (b = 0; d > b; b++) 27 c += 28 "<a href='javascript:;' class='" + (0 == b ? "cur" : "") + "'></a>"; 29 0 < m.length && "" == m.html() 30 ? m.html(c) 31 : (a = m.find("a.cur").index()); 32 switch (u) { 33 case "fold": 34 for (b = 0; d > b; b++) 35 0 == b && "" == l.eq(b).find(".text").text() && m.addClass("cur"), 36 l.eq(b).css({ 37 display: 0 == b ? "list-item" : "none", 38 position: "absolute", 39 top: 0, 40 left: 0, 41 }); 42 break; 43 case "leftLoop": 44 e.find("li:first").hasClass("clone") || 45 ((b = e.find("li:first").clone().addClass("clone")), 46 (c = e.find("li:last-child").clone().addClass("clone")), 47 e 48 .css({ 49 width: f * d + 2 * f, 50 position: "absolute", 51 top: 0, 52 left: -(f + f * a), 53 }) 54 .append(b) 55 .prepend(c)); 56 } 57 var q = function (b) { 58 switch (u) { 59 case "fold": 60 l.stop(!1, !0) 61 .fadeOut(k) 62 .eq(a) 63 .fadeIn(k, function () { 64 $(this) 65 .find("img") 66 .attr("src", $(this).find("img").attr("data-src")); 67 "" == $(this).find(".text").text() 68 ? g.find(h).addClass("cur") 69 : g.find(h).removeClass("cur"); 70 }); 71 g.find(h).find("a").removeClass("cur").eq(a).addClass("cur"); 72 break; 73 case "leftLoop": 74 "" == b && e.stop(!1, !0).animate({ left: -(f + f * a) }, k), 75 ".prev" == b && 76 e 77 .stop(!1, !0) 78 .animate( 79 { left: -(f * (a == d - 1 ? 0 : a + 1)) }, 80 k, 81 function () { 82 a == d - 1 && e.css({ left: -(f * d) }); 83 } 84 ), 85 ".next" == b && 86 e 87 .stop(!1, !0) 88 .animate( 89 { left: -(f + f * (a == d ? d : 0 == a ? d : a)) }, 90 k, 91 function () { 92 0 == a && e.css({ left: -f }); 93 } 94 ), 95 g.find(h).find("a").removeClass("cur").eq(a).addClass("cur"), 96 e.find("img").each(function () { 97 $(this).attr("src", $(this).attr("data-src")); 98 }); 99 } 100 }, 101 z = function () { 102 t = setInterval(function () { 103 a == d - 1 ? (a = 0) : a++; 104 q(n); 105 }, B);G 106 }; 107 1 == v && z(); 108 g.on({ 109 mouseenter: function () { 110 clearInterval(t); 111 0 > x && 112 (p.stop().animate({ left: 0 }, 200), 113 w.stop().animate({ right: 0 }, 200)); 114 }, 115 mouseleave: function () { 116 1 == v && z(); 117 0 > x && 118 (p.stop().animate({ left: -y }, 200), 119 w.stop().animate({ right: -y }, 200)); 120 }, 121 }) 122 .on("click", r, function () { 123 a = 0 == a ? d - 1 : a - 1; 124 q(r); 125 }) 126 .on("click", n, function () { 127 a = a == d - 1 ? 0 : a + 1; 128 q(n); 129 }) 130 .find(h) 131 .on("click", "a", function () { 132 0 == $(this).hasClass("cur") && ((a = $(this).index()), q("")); 133 }); 134 }); 135 }; 136 137 //è·åå¾çæhtmåç¼å 138 function backExt(tar) { 139 var backVal = ""; 140 backVal = tar.replace(/(.+)[\\/]/, "").split(".")[1]; 141 if (backVal) { 142 backVal = backVal.indexOf("?") !== -1 ? backVal.split("?")[0] : backVal; 143 } 144 return backVal; 145 } 146 //夿IE6 147 function isIE6() { 148 return !!window.ActiveXObject && !window.XMLHttpRequest; 149 } 150 //ç«å¤çæµ 151 function gsCountAnalysis(jcsrc) { 152 var gscaDom = '<div style="display:none"><img src="' + jcsrc + '"></div>'; 153 return gscaDom; 154 } 155 156 function gsIncome() { } 157 gsIncome.prototype.gsCountSiteInner = function (gsid) { 158 $.ajax({
159 type: "GET", 160 dataType: "jsonp", 161 url: "//click.gamersky.com/Common/GetHits.aspx", 162 data: { id: gsid, script: "3" }, 163 success: function (data) { }, 164 }); 165 }; 166 //cpsæå ç»è®¡ 167 gsIncome.prototype.IntermodalExposureStatistics = function (url) { 168 function isDomain(url, expectedDomain, callback) { 169 try { 170 var match = url.match(/^(\w+:)\/\/([^\/]+)\/(.*)\?(.*)$/); 171 var hostname = match[2]; 172 var params = {}; 173 match[4].split("&").forEach(function (pair) { 174 var kv = pair.split("="); 175 params[kv[0]] = kv[1]; 176 }); 177 var key = params["key"]; 178 if (hostname === expectedDomain && key !== undefined) { 179 callback(key); 180 return true; 181 } else { 182 return false; 183 } 184 } catch (error) { 185 return false; 186 } 187 } 188 var expectedDomain = "web-cps.gamersky.com"; 189 isDomain(url, expectedDomain, function (key) { 190 $.ajax({ 191 type: "GET", 192 url: 193 "//web-cps.gamersky.com/GamerSky.GameUnionOperationPlatform.InstationCPSX/MonthImprs/Impr?Key=" + 194 key, 195 success: function (data) { }, 196 }); 197 }); 198 }; 199 //æææå ç»è®¡ 200 gsIncome.prototype.elementInViewport = function (domid, callback) { 201 var $window = $(window); 202 var $element = $(domid); 203 var called = false; 204 205 function checkViewport() { 206 if (called) { 207 return; 208 } 209 210 var viewportTop = $window.scrollTop(); 211 var viewportBottom = viewportTop + $window.height(); 212 var viewportLeft = $window.scrollLeft(); 213 var viewportRight = viewportLeft + $window.width(); 214 215 var elementOffset = $element.offset(); 216 var elementTop = elementOffset.top; 217 var elementBottom = elementTop + $element.outerHeight(); 218 var elementLeft = elementOffset.left; 219 var elementRight = elementLeft + $element.outerWidth(); 220 221 var isInViewport = 222 elementTop >= viewportTop && 223 elementBottom <= viewportBottom && 224 elementLeft >= viewportLeft && 225 elementRight <= viewportRight; 226 227 if (isInViewport) { 228 called = true; 229 callback(); 230 $window.off("scroll", checkViewport); // ç§»é¤æ»å¨äºä»¶çå¬å¨ 231 } 232 } 233 234 $window.on("scroll", checkViewport); 235 checkViewport(); // 卿¹æ³è°ç¨æ¶ç«å³æ£æ¥ä¸æ¬¡ 236 }; 237 //åºç¡å¹¿å æ¯æè¾åºå¾æè swf 238 gsIncome.prototype.base = function (options) { 239 var config = { 240 tar: options.tar, 241 width: options.width, 242 height: options.height, 243 material: options.material, 244 isIcon: options.isIcon || "show", 245 url: options.url || "", 246 countId: options.countId, 247 isChange: options.isChange, 248 infos: options.infos, 249 vWidth: options.vWidth || 1500, 250 vHeight: options.vHeight || 1500, 251 margin: options.margin || "0 auto", 252 diyStart: options.diyStart || "", 253 diyEnd: options.diyEnd || "", 254 }, 255 gsmExtension, 256 gsm = "", 257 gsu = "", 258 gsTips = "", 259 gsDom = "", 260 gsId, 261 tmpUrl, 262 tmpMal, 263 tmpId, 264 bnmin, 265 bnmax, 266 bnCookie, 267 bnCkie, 268 bnnum, 269 jcCode = "", 270 TopCss = ""; 271 272 if (options.jcCode) { 273 jcCode = gsCountAnalysis(options.jcCode); 274 } 275 276 if (config.isChange) { 277 bnmin = 1; 278 bnmax = 2; //1~2ä¹é´çå¾ªç¯ 279 bnCookie = config.tar.replace("#", ""); /*Cookieåç§°*/ 280 bnCkie = cookie(bnCookie); 281 bnnum = 282 bnCkie !== null 283 ? Number(bnCkie) === bnmax 284 ? bnmin 285 : Number(bnCkie) + 1 286 : bnmin; 287 cookie(bnCookie, bnnum, { path: "/", expires: 1 }); 288 switch (bnnum) { 289 case 1: 290 tmpMal = config.infos[0][0]; 291 tmpUrl = config.infos[0][1] || ""; 292 tmpId = config.infos[0][2]; 293 Mp4ShowImg = config.infos[0][3]; 294 InstallationPackage = config.infos[0][4]; 295 break; 296 case 2: 297 tmpMal = config.infos[1][0]; 298 tmpUrl = config.infos[1][1] || ""; 299 tmpId = config.infos[1][2]; 300 break; 301 } 302 } else { 303 tmpMal = config.infos[0][0]; 304 tmpUrl = config.infos[0][1] || ""; 305 tmpId = config.infos[0][2]; 306 Mp4ShowImg = config.infos[0][3]; 307 InstallationPackage = config.infos[0][4]; 308 InstallationPackageTmpId = config.infos[0][5]; 309 } 310 311 if (tmpUrl !== "") { 312 if (InstallationPackage) { 313 gsu += '<div class="InstallationPackageExebox none" style="width: 300px;height: 250px;background: rgba(0, 0, 0, 0.8);position: absolute;top: 0;left: 5px;">' 314 gsu += '<img src="https://imgf.gamersky.com/img/tqbc2010/20240628-161801.png" alt="" style="margin: 46px auto 12px;display: block;">' 315 gsu += '<p style="text-align: center;font-size: 16px;color: #fff;margin: 0 auto 30px;">å³å°ä¸è½½å®è£ å ...</p>' 316 gsu += '<div class="btnbox" style="width: 220px;bottom: 36px;height: 35px;left: 41px; position: absolute;"><a class="countHit" data-itemid="' + 317 InstallationPackageTmpId + 318 '" href="' + 319 tmpUrl + 320 '" target="_blank" style="cursor: pointer;text-decoration: none;margin-right:12px;float: left;display: block;width: 122px;height: 35px;background: #63ffc4;border-radius: 18px;text-align: center;line-height: 35px;font-size: 17px;color: #000;">ç«å³ä¸è½½</a>' 321 gsu += '<div class="btnQs" style="cursor: pointer;left: 134px;text-decoration: none;float: left;display: block;width: 85px;height: 35px;background: rgba(255, 255, 255, 0.75);border-radius: 18px;text-align: center;line-height: 35px;font-size: 17px;color: #000;">åæ¶</div>' 322 gsu += '</div></div>' 323 } else { 324 gsu = 325 "<a class='countHit' data-itemid='" + 326 tmpId + 327 "' style='display:block;width:100%;height:100%;background:url(#);position:absolute;
327left:0;top:0;' href='" + 328 tmpUrl + 329 "' target='_blank'></a>"; 330 } 331 332 } 333 if (config.isIcon && config.isIcon === "show") { 334 gsTips = 335 '<div style="width:24px;height:13px;position:absolute;right:0;bottom:0;background:url(//image.gamersky.com/webimg15/adtag.png);opacity:0.5"></div>'; 336 } 337 338 339 //è·åå¾çæflashåç¼å 340 gsmExtension = backExt(tmpMal); 341 if ($(config.tar).parents(".advert").length > 0) { 342 TopCss = "top:" + (86 - config.height) / 2 + "px;"; 343 } 344 if ( 345 gsmExtension === "jpg" || 346 gsmExtension === "gif" || 347 gsmExtension === "png" 348 ) { 349 gsm += 350 '<div style="width:' + 351 config.width + 352 "px;height:" + 353 config.height + 354 'px;position:relative;">'; 355 gsm += 356 "<img src='" + 357 tmpMal + 358 "' width='" + 359 config.width + 360 "' height='" + 361 config.height + 362 "' border='0' />"; 363 gsm += gsTips + gsu; 364 gsm += "</div>"; 365 } else if (gsmExtension === "swf") { 366 gsId = "gsMaterialFlashId" + tmpId + ~(-new Date() / 36e5); 367 gsm += 368 '<div id="' + 369 gsId + 370 '" style="width:' + 371 config.vWidth + 372 ";height:" + 373 config.vHeight + 374 ';opacity:0;position:fixed;">'; 375 gsm += 376 "<embed src='" + 377 tmpMal + 378 "' width='" + 379 config.vWidth + 380 "' height='" + 381 config.vHeight + 382 "' wmode='transparent' quality='high' type='application/x-shockwave-flash'></embed>"; 383 gsm += gsTips + gsu; 384 gsm += "</div>"; 385 } else if (gsmExtension === "htm" || gsmExtension === "html") { 386 gsm += 387 '<iframe width="' + 388 config.width + 389 '" height="' + 390 config.height + 391 '" src="' + 392 tmpMal + 393 '" frameborder="0" scrolling="no"></iframe>' + 394 gsTips + 395 gsu; 396 } else if (gsmExtension == "mp4" || gsmExtension == "webm") { 397 gsm += 398 '<video muted="muted" loop width="' + 399 config.width + 400 '" height="' + 401 config.height + 402 ' controls="" autoplay="" name="media" src="' + 403 tmpMal + 404 '">'; 405 gsm += 406 '<img src="' + 407 Mp4ShowImg + 408 '" width="' + 409 config.width + 410 '" height="' + 411 config.height + 412 '" border="0" />'; 413 gsm += "</video>" + gsTips + gsu; 414 } 415 gsDom += config.diyStart; 416 gsDom += 417 '<div style="margin:' + 418 config.margin + 419 ";width:" + 420 config.width + 421 "px;height:" + 422 config.height + 423 "px;position:relative;" + 424 TopCss + 425 '">'; 426 gsDom += gsm; 427 gsDom += "</div>"; 428 gsDom += config.diyEnd + jcCode; 429 $(config.tar).css("overflow", "visible").html(gsDom).slideDown(); 430 431 if (InstallationPackage) { 432 $(config.tar).find('img,video').on("click", function () { 433 $(config.tar).find('.InstallationPackageExebox').removeClass('none') 434 if ($(this).closest('.InstallationPackageExebox').length > 0) { 435 } else { 436 gsTg.gsCountSiteInner(tmpId); 437 } 438 }) 439 $('.InstallationPackageExebox .btnbox .btnQs').on("click", function () { 440 $(config.tar).find('.InstallationPackageExebox').addClass('none') 441 }) 442 } 443 444 if (gsmExtension === "swf") { 445 setTimeout(function () { 446 $("#" + gsId) 447 .css({ 448 width: config.width, 449 height: config.height, 450 position: "relative", 451 opacity: 1, 452 }) 453 .find("embed") 454 .attr({ height: config.height, width: config.width }); 455 }, 800); 456 } 457 }; 458 //å¹»ç¯å¹¿å 459 gsIncome.prototype.slide = function (options) { 460 var gsDom = ""; 461 var tar = options.tar; //广å主ID 462 var width = options.width; //广å宽度 463 var height = options.height; //广åé«åº¦ 464 var autoPlay = options.autoPlay || false; //true:èªå¨ææ¾ false:ç¦æ¢èªå¨ææ¾ 465 var effect = options.effect || "fold"; //fold:æ¸å leftLoop:å左循ç¯ç§»å¨ 466 var interTime = options.interTime || 3000; //èªå¨ææ¾æ¶é´:3ç§ 467 var infos = options.infos || []; //广åç´ æ 468 var jcCode = options.jcCode || ""; //çæµä»£ç 469 var margin = options.margin || "0 auto"; //å¤è¾¹è· 470 var ApkDownloadOverlayMethod = false 471 472 gsDom += "<style>"; 473 gsDom += 474 ".adSlide {margin:" + 475 margin + 476 ";width:" + 477 width + 478 "px;height:" + 479 height + 480 "px;overflow:hidden;position:relative;}"; 481 gsDom +=
482 ".adSlide .Bimg {width:" + 483 width + 484 "px;height:" + 485 height + 486 "px;overflow:hidden;position:relative;}"; 487 gsDom += 488 ".adSlide .Bimg li {float:left;width:" + 489 width + 490 "px;height:" + 491 height + 492 "px;position:relative;}"; 493 gsDom += 494 ".adSlide .Bimg li div {position:absolute;left:0;bottom:0;overflow:hidden;}"; 495 gsDom += 496 ".adSlide .Bimg li .mask {width:100%;height:90px;background:url(//image.gamersky.com/webimg15/mk3.png) 0 bottom repeat-x;}"; 497 gsDom += 498 ".adSlide .Bimg li .text {padding:0 5px;width:auto;height:34px;line-height:34px;color:#f2f2f3;font-size:16px;font-weight:700;font-family:'Microsoft YaHei';}"; 499 gsDom += 500 ".adSlide .Bimg li a {display:block;width:100%;height:100%;background:url(#);position:absolute;left:0;top:0;}"; 501 gsDom += 502 ".adSlide .adtag {display:block;width:24px;height:13px;position:absolute;right:0;top:0;z-index:2;background:url(//image.gamersky.com/webimg15/adtag.png);}"; 503 gsDom += 504 ".adSlide .Simg {padding:5px 0;width:100%;height:auto;text-align:center;font-size:0;position:absolute;left:0;bottom:30px;transition:all .25s ease-out;}"; 505 gsDom += ".adSlide .Simg.cur {bottom:5px;}"; 506 gsDom += 507 ".adSlide .Simg a {margin:0 4px;display:inline-block;width:6px;height:6px;border:1px solid #8b8b8b;border-radius:50%;}"; 508 gsDom += 509 ".adSlide .Simg a.cur {cursor:defat;background-color:#ff2005;border-color:#ff2005;}"; 510 gsDom += 511 ".adSlide .btn {display:block;width:34px;height:47px;background:url(//image.gamersky.com/webimg15/slide-btn.png) no-repeat;position:absolute;top:50%;margin-top:-23px;z-index:10;}"; 512 gsDom += 513 ".adSlide .btn.prev {left:-34px;background-position-x:0;border-radius:0 5px 5px 0;}"; 514 gsDom += 515 ".adSlide .btn.next {right:-34px;background-position-x:-34px;border-radius:5px 0 0 5px;}"; 516 gsDom += "</style>"; 517 518 gsDom += '<div class="adSlide">'; 519 gsDom += '<ul class="Bimg">'; 520 $.each(infos, function (index, value) { 521 var gsmExtension = backExt(value.imgUrl); //è·åå¾çæhtmlåç¼å 522 gsDom += "<li>"; 523 if ( 524 gsmExtension === "jpg" || 525 gsmExtension === "gif" || 526 gsmExtension === "png" 527 ) { 528 gsDom += 529 '<img src="' + 530 value.imgUrl + 531 '" width="100%" height="100%" border="0"/>'; 532 } else if (gsmExtension == "mp4" || gsmExtension == "webm") { 533 gsDom += 534 '<video muted="muted" loop width="' + 535 width + 536 '" height="' + 537 height + 538 ' controls="" autoplay="" name="media" src="' + 539 value.imgUrl + 540 '">'; 541 gsDom += 542 '<img src="' + 543 value.imgUrl + 544 '" width="' + 545 width + 546 '" height="' + 547 height + 548 '" border="0" />'; 549 gsDom += "</video>"; 550 } else { 551 gsDom += 552 '<iframe width="' + 553 width + 554 '" height="' + 555 height + 556 '" src="' + 557 value.imgUrl + 558 '" frameborder="0" scrolling="no"></iframe>'; 559 } 560 if (value.adText !== "") { 561 gsDom += '<div class="mask"></div>'; 562 } 563 gsDom += '<div class="text">' + value.adText + "</div>"; 564 if (value.likUrl !== "") { 565 if (value.InstallationPackage) { 566 ApkDownloadOverlayMethod = true 567 gsDom += '<div class="InstallationPackageExebox none" style="width: 300px;height: 250px;background: rgba(0, 0, 0, 0.8);">' 568 gsDom += '<img src="https://imgf.gamersky.com/img/tqbc2010/20240628-161801.png" alt="" style="margin: 46px auto 12px;display: block;">' 569 gsDom += '<p style="text-align: center;font-size: 16px;color: #fff;margin: 0 auto 30px;">å³å°ä¸è½½å®è£ å ...</p>' 570 gsDom += '<div class="btnbox" style="width: 220px;bottom: 36px;height: 35px;left: 41px;"><a class="countHit" data-itemid="' + 571 value.itemid + 572 '" href="' + 573 value.likUrl + 574 '" target="_blank" style="cursor: pointer;text-decoration: none;margin-right:12px;float: left;display: block;width: 122px;height: 35px;background: #63ffc4;border-radius: 18px;text-align: center;line-height: 35px;font-size: 17px;color: #000;">ç«å³ä¸è½½</a>' 575 gsDom += '<div class="btnQs" style="cursor: pointer;left: 134px;text-decoration: none;float: left;display: block;width: 85px;height: 35px;background: rgba(255, 255, 255, 0.75);border-radius: 18px;text-align: center;line-height: 35px;font-size: 17px;color: #000;">åæ¶</div>' 576 gsDom += '</div></div>' 577 } else { 578 if (value.itemid !== "") { 579 gsDom += 580 '<a class="countHit" data-itemid="' + 581 value.itemid + 582 '" href="' + 583 value.likUrl + 584 '" target="_blank"></a>'; 585 } else { 586 gsDom += '<a href="' + value.likUrl + '" target="_blank"></a>'; 587 } 588 } 589 } 590 gsDom += "</li>"; 591 }); 592 gsDom += "</ul>"; 593 gsDom += '<i class="adtag"></i>'; 594 if (effect === "fold") { 595 gsDom += '<div class="Simg"></div>'; 596 } else if (autoPlay) { 597 gsDom += '<a class="btn prev" href="javascript:;"></a>'; 598 gsDom += '<a class="btn next" href="javascript:;"></a>'; 599 } 600 601 gsDom += "</div>"; 602 if (jcCode) { 603 gsDom += gsCountAnalysis(jcCode); 604 } 605 606 $(tar).css("overflow", "visible").html(gsDom).adSlide({ 607 bigPic: ".Bimg", //å¤§å¾ 608 smallPic: ".Simg", //å°å¾ 609 autoPlay: autoPlay, //true:èªå¨ææ¾ false:忢èªå¨ææ¾ 610 interTime: 3000, //èªå¨ææ¾æ¶é´ 611 effect: effect, //fold:æ¸å leftLoop:å左循ç¯ç§»å¨ 612 delayTime: 300, //æ¸åæç§»å¨é度 613 prevCell: ".prev", 614 nextCell: ".next", 615 }); 616 617 // å¼å¯apkè¦å±æ¹æ³ 618 if (ApkDownloadOverlayMethod) { 619 $('.clone img,.clone video,.clone iframe').on("click", function () { 620 $(this).closest('.clone').find('.InstallationPackageExebox').removeClass('none') 621 }) 622 $('.InstallationPackageExebox .btnbox .btnQs').on("click", function () { 623 $(this).closest('.InstallationPackageExebox').addClass('none') 624 }) 625 } 626 }; 627 628 629 //TIPSå¹¿å æ¯æè¾åºå¾æè swf 630 gsIncome.prototype.tips = function (options) { 631 var config = { 632 tar: options.tar, 633 width: options.width, 634 height: options.height, 635 material: options.material, 636 isIcon: options.isIcon || "show", 637 url: options.url || "", 638 countId: options.countId, 639 isChange: options.isChange, 640 infos: options.infos, 641 vWidth: options.vWidth || 1500, 642 vHeight: options.vHeight || 1500, 643 margin: options.margin || "0 auto", 644 diyStart: options.diyStart || "", 645 diyEnd: options.diyEnd || "", 646 }, 647 gsmExtension, 648 gsm = "", 649 gsu = "", 650 gsTips = "", 651 gsDom = "", 652 gsId, 653 tmpUrl, 654 tmpMal, 655 tmpId, 656 bnmin, 657 bnmax, 658 bnCookie, 659 bnCkie, 660 bnnum, 661 jcCode = "", 662 TopCss = ""; 663 664 if (options.jcCode) { 665 jcCode = gsCountAnalysis(options.jcCode); 666 } 667 668 if (config.isChange) { 669 bnmin = 1; 670 bnmax = 2; //1~2ä¹é´çå¾ªç¯ 671 bnCookie = config.tar.replace("#", ""); /*Cookieåç§°*/ 672 bnCkie = cookie(bnCookie); 673 bnnum = 674 bnCkie !== null 675 ? Number(bnCkie) === bnmax 676 ? bnmin 677 : Number(bnCkie) + 1 678 : bnmin;
679 cookie(bnCookie, bnnum, { path: "/", expires: 1 }); 680 switch (bnnum) { 681 case 1: 682 tmpMal = config.infos[0][0]; 683 tmpUrl = config.infos[0][1] || ""; 684 tmpId = config.infos[0][2]; 685 Mp4ShowImg = config.infos[0][3]; 686 break; 687 case 2: 688 tmpMal = config.infos[1][0]; 689 tmpUrl = config.infos[1][1] || ""; 690 tmpId = config.infos[1][2]; 691 break; 692 } 693 } else { 694 tmpMal = config.infos[0][0]; 695 tmpUrl = config.infos[0][1] || ""; 696 tmpId = config.infos[0][2]; 697 Mp4ShowImg = config.infos[0][3]; 698 } 699 700 if (tmpUrl !== "") { 701 gsu = 702 "<a class='countHit' data-itemid='" + 703 tmpId + 704 "' style='display:block;width:100%;height:100%;background:url(#);position:absolute;left:0;top:0;' href='" + 705 tmpUrl + 706 "' target='_blank'></a>"; 707 } 708 if (config.isIcon && config.isIcon === "show") { 709 gsTips = 710 '<div style="width:24px;height:13px;position:absolute;left:0;bottom:0;background:url(//image.gamersky.com/webimg15/adtag.png);"></div>'; 711 } 712 713 //è·åå¾çæflashåç¼å 714 gsmExtension = backExt(tmpMal); 715 716 if ($(config.tar).parents(".advert").length > 0) { 717 TopCss = "top:" + (86 - config.height) / 2 + "px;"; 718 } 719 if ( 720 gsmExtension === "jpg" || 721 gsmExtension === "gif" || 722 gsmExtension === "png" 723 ) { 724 gsm += 725 '<div style="width:' + 726 config.width + 727 "px;height:" + 728 config.height + 729 'px;position:relative;">'; 730 gsm += 731 "<img src='" + 732 tmpMal + 733 "' width='" + 734 config.width + 735 "' height='" + 736 config.height + 737 "' border='0' />"; 738 gsm += gsTips + gsu; 739 gsm += "</div>"; 740 } else if (gsmExtension == "mp4" || gsmExtension == "webm") { 741 gsm += 742 '<video muted="muted" loop width="' + 743 config.width + 744 '" height="' + 745 config.height + 746 ' controls="" autoplay="" name="media" src="' + 747 tmpMal + 748 '">'; 749 gsm += 750 '<img src="' + 751 Mp4ShowImg + 752 '" width="' + 753 config.width + 754 '" height="' + 755 config.height + 756 '" border="0" />'; 757 gsm += "</video>" + gsTips + gsu; 758 } else if (gsmExtension === "swf") { 759 gsId = "gsMaterialFlashId" + tmpId + ~(-new Date() / 36e5); 760 gsm += 761 '<div id="' + 762 gsId + 763 '" style="width:' + 764 config.vWidth + 765 ";height:" + 766 config.vHeight + 767 ';opacity:0;position:fixed;">'; 768 gsm += 769 "<embed src='" + 770 tmpMal + 771 "' width='" + 772 config.vWidth + 773 "' height='" + 774 config.vHeight + 775 "' wmode='transparent' quality='high' type='application/x-shockwave-flash'></embed>"; 776 gsm += gsTips + gsu; 777 gsm += "</div>"; 778 } else { 779 gsm += 780 '<iframe width="' + 781 config.width + 782 '" height="' + 783 config.height + 784 '" src="' + 785 tmpMal + 786 '" frameborder="0" scrolling="no"></iframe>' + 787 gsTips + 788 gsu; 789 } 790 gsDom += config.diyStart; 791 gsDom += 792 '<div style="margin:' + 793 config.margin + 794 ";width:" + 795 config.width + 796 "px;height:" + 797 config.height + 798 "px;position:relative;" + 799 TopCss + 800 '">'; 801 gsDom += gsm; 802 gsDom += "</div>"; 803 gsDom += config.diyEnd + jcCode; 804 gsDom += 805 '<div class="close" style="width:66px;height:18px;cursor:pointer;position:absolute;right:0;top:0;z-index:2;background:#000 url(//image.gamersky.com/webimg15/tg/closetg.png) no-repeat;"></div>'; 806 $(config.tar).html(gsDom).slideDown(); 807 $(config.tar).attr( 808 "style", 809 "width:300px;height:250px;position:fixed;_position:absolute;right:0;bottom:0;z-index:2010000;" 810 ); 811 if (gsmExtension === "swf") { 812 setTimeout(function () { 813 $("#" + gsId) 814 .css({ 815 width: config.width, 816 height: config.height, 817 position: "relative", 818 opacity: 1, 819 }) 820 .find("embed") 821 .attr({ height: config.height, width: config.width }); 822 }, 800); 823 } 824 $(config.tar) 825 .find(".close") 826 .on("click", function () { 827 $(config.tar).remove(); 828 }); 829 }; 830 //æ¹åå¹¿å æ¯æè¾åºå¾æè swf 831 gsIncome.prototype.baseBlock = function (options) { 832 var config = { 833 tar: options.tar, 834 isIcon: options.isIcon || false, 835 margin: options.margin || "margin-bottom:10px;", 836 width: options.width || 300, 837 height: options.height || 250, 838 vWidth: options.vWidth || 1500, 839 vHeight: options.vHeight || 1500, 840 tmpMal: options.src || "", 841 Mp4ShowImg: options.Mp4ShowImg || "", 842 tmpUrl: options.url || "", 843 itemid: options.timpId || "", 844 hitId: options.GetHitId || "", 845 }, 846 gsTips = "", 847 gsu = "", 848 gsmExtension, 849 gsDom = ""; 850 var tmpMal = config.tmpMal, 851 itemid = config.itemid; 852 var adID = config.tar, 853 hitId = config.hitId; 854 var tmpUrl = config.tmpUrl, 855 isIcon = config.isIcon; 856 var gsId = "#gsFlashId" + itemid + ~(-new Date() / 36e5); 857 858 if (tmpUrl !== "") { 859 gsu = 860 "<a class='countHit' data-itemid='" + 861 itemid + 862 "' style='display:block;width:100%;height:100%;background:url(#);position:absolute;
862left:0;top:0;' href='" + 863 tmpUrl + 864 "' target='_blank'></a>"; 865 } 866 if (isIcon) { 867 gsTips = 868 '<div style="width:24px;height:13px;position:absolute;left:0;bottom:0;background:url(//image.gamersky.com/webimg15/adtag.png);"></div>'; 869 } 870 871 //è·åå¾çæflashåç¼å 872 gsmExtension = backExt(tmpMal); 873 if ( 874 gsmExtension === "jpg" || 875 gsmExtension === "gif" || 876 gsmExtension === "png" 877 ) { 878 gsDom += 879 '<div style="width:' + 880 config.width + 881 "px;height:" + 882 config.height + 883 "px;position:relative;" + 884 config.margin + 885 '">'; 886 gsDom += 887 '<img src="' + 888 tmpMal + 889 '" width="' + 890 config.width + 891 '" height="' + 892 config.height + 893 '" border="0" />'; 894 gsDom += gsTips + gsu; 895 gsDom += "</div>"; 896 } else if (gsmExtension === "swf") { 897 gsDom += 898 '<div id="' + 899 gsId + 900 '" style="width:' + 901 config.vWidth + 902 ";height:" + 903 config.vHeight + 904 ";opacity:0;position:fixed;" + 905 config.margin + 906 '">'; 907 gsDom += 908 '<embed src="' + 909 tmpMal + 910 '" width="' + 911 config.vWidth + 912 '" height="' + 913 config.vHeight + 914 '" wmode="transparent" quality="high" type="application/x-shockwave-flash"></embed>'; 915 gsDom += gsTips + gsu; 916 gsDom += "</div>"; 917 } else if (gsmExtension === "htm" || gsmExtension === "html") { 918 gsDom += 919 '<div style="width:' + 920 config.width + 921 "px;height:" + 922 config.height + 923 "px;position:relative;" + 924 config.margin + 925 '">'; 926 gsDom += 927 '<iframe width="' + 928 config.width + 929 '" height="' + 930 config.height + 931 '" src="' + 932 tmpMal + 933 '" frameborder="0" scrolling="no"></iframe>'; 934 gsDom += gsTips + gsu; 935 gsDom += "</div>"; 936 } else if (gsmExtension == "mp4") { 937 gsDom += 938 '<video muted="muted" loop width="' + 939 config.width + 940 '" height="' + 941 config.height + 942 ' controls="" autoplay="" name="media" src="' + 943 tmpMal + 944 '">'; 945 gsDom += 946 '<img src="' + 947 config.Mp4ShowImg + 948 '" width="' + 949 config.width + 950 '" height="' + 951 config.height + 952 '" border="0" />'; 953 gsDom += "</video>" + gsTips + gsu; 954 } 955 $(adID).html(gsDom); 956 //设置åºå®å®½é« 957 $(adID).css({ 958 width: config.width, 959 height: config.height, 960 position: "relative", 961 opacity: 1, 962 }); 963 964 if (gsmExtension === "swf") { 965 setTimeout(function () { 966 $(gsId) 967 .css({ 968 width: config.width, 969 height: config.height, 970 position: "relative", 971 opacity: 1, 972 }) 973 .find("embed") 974 .attr({ width: config.width, height: config.height }); 975 }, 800); 976 } 977 978 if (hitId !== "") { 979 var bgnum = 0, 980 iframeT = $(adID).offset().top; 981 $(window).scroll(function () { 982 var stop = $(window).scrollTop(); 983 var seeH = $(window).height(); 984 var HH = iframeT - stop; 985 if (bgnum == 0 && HH <= seeH) { 986 bgnum++; 987 gsTg.gsCountSiteInner(hitId); 988 } 989 }); 990 } 991 }; 992 993 //ä¸¤ä¾§èæ¯å¹¿å 994 gsIncome.prototype.background = function (options) { 995 var config = { 996 width: options.width, 997 imgLeft: options.imgLeft, 998 imgRight: options.imgRight, 999 imgMiddle: options.imgMiddle, 1000 url: options.url, 1001 countId: options.countId, 1002 shadowLeft: options.shadowLeft, 1003 shadowRight: options.shadowRight, 1004 repeatY: options.repeatY, 1005 shadowSpec: options.shadowSpec, 1006 shadowMid: options.shadowMid, 1007 closeBtn: options.closeBtn, 1008 tarHeight: options.tarHeight, 1009 }, 1010 admid, 1011 adClose, 1012 adShadowSpec, 1013 addh, 1014 adwh, 1015 addw, 1016 adlr, 1017 wt, 1018 th, 1019 tp, 1020 pt, 1021 bgimg_m, 1022 bgimg_l, 1023 bgimg_r, 1024 htm, 1025 gsId, 1026 tmpId, 1027 repeatL, 1028 repeatR, 1029 jcCode = "", 1030 gsmExtensionL = "", 1031 gsmExtensionR = "", 1032 gsmExtensionM = ""; 1033 1034 if (options.jcCode) { 1035 jcCode = gsCountAnalysis(options.jcCode); 1036 } 1037 1038 //è·åå¾çæhtmåç¼å 1039 gsmExtensionL = backExt(config.imgLeft); 1040 gsmExtensionR = backExt(config.imgRight); 1041 gsmExtensionM = backExt(config.imgMiddle); 1042 1043 admid = config.width; 1044 adClose = config.closeBtn; 1045 adShadowSpec = config.shadowSpec; 1046 1047 addh = $(document).height(); 1048 adwh = $(window).height(); 1049 addw = $(window).width(); 1050 adlr = (addw - admid) / 2; 1051 th = config.tarHeight || 0; 1052 tp = addh - adwh; 1053 pt = isIE6() ? "absolute" : "fixed"; 1054 bgimg_m = 1055 config.imgMiddle === "" 1056 ? "" 1057 : "background:url(" + config.imgMiddle + ") center 0 no-repeat;"; 1058 bgimg_l = 1059 config.imgLeft === "" 1060 ? "" 1061 : "background:url(" + config.imgLeft + ") right 0 no-repeat;"; 1062 bgimg_r = 1063 config.imgRight === "" 1064 ? "" 1065 : "background:url(" + config.imgRight + ") left 0 no-repeat;"; 1066 1067 if (gsmExtensionL === "htm") { 1068 bgimg_l = ""; 1069 } 1070 if (gsmExtensionR === "htm") { 1071 bgimg_r = ""; 1072 } 1073 if (gsmExtensionM === "htm") { 1074 bgimg_m = ""; 1075 } 1076 1077 tmpId = config.countId;
1078 gsId = "gsBackgroundId" + tmpId + ~(-new Date() / 36e5); 1079 1080 repeatL = config.repeatY 1081 ? "right 0 repeat-y" 1082 : adShadowSpec 1083 ? "right 0 no-repeat" 1084 : "repeat-x"; 1085 repeatR = config.repeatY 1086 ? "left 0 repeat-y" 1087 : adShadowSpec 1088 ? "left 0 no-repeat" 1089 : "repeat-x"; 1090 1091 var shadowL = config.shadowLeft; 1092 var shadowR = config.shadowRight; 1093 var bgroundL = 1094 shadowL.indexOf("box-shadow") !== -1 1095 ? shadowL 1096 : "background:url(" + shadowL + ") " + repeatL + ";"; 1097 var bgroundR = 1098 shadowR.indexOf("box-shadow") !== -1 1099 ? shadowR 1100 : "background:url(" + shadowR + ") " + repeatR + ";"; 1101 1102 htm = 1103 '<div id="' + 1104 gsId + 1105 '" style="width:' + 1106 addw + 1107 "px;height:" + 1108 adwh + 1109 "px;position:" + 1110 pt + 1111 ";left:0;top:" + 1112 th + 1113 "px;" + 1114 bgimg_m + 1115 '" class="onlyOneBgtgs">'; 1116 if (gsmExtensionM === "htm") { 1117 htm += 1118 '<iframe width="100%" height="100%" src="' + 1119 config.imgMiddle + 1120 '" frameborder="0" scrolling="no"></iframe>'; 1121 htm += 1122 '<div style="width:100%;height:41px;position:absolute;left:0;top:0;background:url(//image.gamersky.com/webimg15/adtop.png) repeat-x;"></div>'; 1123 if (adClose) { 1124 htm += 1125 '<div class="gsBackgroundClose" style="width:' + (options['closeBtnWidth'] || 77) + 'px;height:24px;cursor:pointer;position:absolute;right:0;top:0;z-index:2;"><i style="background: #000; width: ' + (options['closeBtnWidth'] || 77) + 'px; height: 24px; display: block; position: absolute; z-index: 9; opacity: 0.75; filter: alpha(opacity=75);"></i><i style="background:url(' + 1126 adClose + 1127 ') no-repeat center;display: block;width: ' + (options['closeBtnWidth'] || 77) + 'px;height: 24px; position: absolute; z-index: 10; "></i></div>'; 1128 } 1129 1130 } else { 1131 htm += 1132 '<div class="gsBackgroundLeft" style="float:left;width:' + 1133 adlr + 1134 "px;height:100%;position:relative;" + 1135 bgimg_l + 1136 '">'; 1137 if (gsmExtensionL === "htm") { 1138 htm += 1139 '<iframe width="100%" height="100%" src="' + 1140 config.imgLeft + 1141 '" frameborder="0" scrolling="no"></iframe>'; 1142 htm += 1143 '<div style="width:100%;height:112px;background:url(//image.gamersky.com/webimg15/yyl-n.png) right 0 no-repeat;position:absolute;right:0;top:0;"></div>'; 1144 } else { 1145 htm += 1146 '<a style="display:block;width:100%;height:100%;' + 1147 bgroundL + 1148 '" target="_blank" href="' + 1149 config.url + 1150 '" data-itemid="' + 1151 config.countId + 1152 '" class="countHit countHitSql"></a>'; 1153 } 1154 htm += "</div>"; 1155 htm += 1156 '<div style="float:left;width:' + 1157 admid + 1158 "px;height:100%;" + 1159 config.shadowMid + 1160 '"></div>'; 1161 htm += 1162 '<div class="gsBackgroundRight" style="float:left;width:' + 1163 adlr + 1164 "px;height:100%;position:relative;" + 1165 bgimg_r + 1166 '">'; 1167 if (gsmExtensionR === "htm") { 1168 htm += 1169 '<iframe width="100%" height="100%" src="' + 1170 config.imgRight + 1171 '" frameborder="0" scrolling="no"></iframe>'; 1172 htm += 1173 '<div style="width:100%;height:112px;background:url(//image.gamersky.com/webimg15/yyr-n.png) left 0 no-repeat;position:absolute;left:0;top:0;"></div>'; 1174 } else { 1175 htm += 1176 '<a style="display:block;width:100%;height:100%;' + 1177 bgroundR + 1178 '" target="_blank" href="' + 1179 config.url + 1180 '" data-itemid="' + 1181 config.countId + 1182 '" class="countHit countHitSql"></a>'; 1183 } 1184 if (adClose) { 1185 htm += 1186 '<div class="gsBackgroundClose" style="width:' + (options['closeBtnWidth'] || 77) + 'px;height:24px;cursor:pointer;position:absolute;right:0;top:0;z-index:2;"><i style="background: #000; width: ' + (options['closeBtnWidth'] || 77) + 'px; height: 24px; display: block; position: absolute; z-index: 9; opacity: 0.75; filter: alpha(opacity=75);"></i><i style="background:url(' + 1187 adClose + 1188 ') no-repeat center;display: block;width:' + (options['closeBtnWidth'] || 77) + 'px;height: 24px; position: absolute; z-index: 10; "></i></div>'; 1189 } 1190 1191 htm += "</div>"; 1192 } 1193 htm += "</div>" + jcCode; 1194 if ($(".onlyOneBgtgs").length <= 0) { 1195 $("body").prepend(htm); 1196 } 1197 var $ads = $("#" + gsId); 1198
1199 $ads.find(".gsBackgroundClose").on("click", function () { 1200 $ads.remove(); 1201 $(".bgAdWrap").css("background", ""); 1202 }); 1203 1204 function scrollEvent() { 1205 var ttp; 1206 if ($ads) { 1207 wt = $(window).scrollTop(); 1208 if (isIE6() === true) { 1209 var wtt = wt <= tp ? (wt > th ? wt : th) : tp; 1210 $ads.css({ position: "absolute", top: wtt }); 1211 } else if ($.browser.msie) { 1212 var ps = wt >= th ? "fixed" : "absolute"; 1213 ttp = wt >= th ? 0 : th; 1214 $ads.css({ position: ps, top: ttp }); 1215 } else { 1216 ttp = wt >= th ? 0 : th - wt; 1217 $ads.css({ position: "fixed", top: ttp }); 1218 } 1219 } 1220 } 1221 1222 $(window) 1223 .resize(function () { 1224 var scww = $(window).width(), 1225 scwh = $(window).height(), 1226 scsw = (scww - admid) / 2; 1227 tp = addh - scwh; 1228 $ads.css({ width: scww, height: scwh }); 1229 $ads.find(".gsBackgroundLeft").css({ width: scsw }); 1230 $ads.find(".gsBackgroundRight").css({ width: scsw }); 1231 }) 1232 .scroll(scrollEvent) 1233 .trigger("scroll"); 1234 }; 1235 gsIncome.prototype.JudgeIsHomePage = function () { 1236 // æ°é¦é¡µæ¨¡æ¿ä¼å¨é¡µé¢æ ¹å®¹å¨ä¸å¸¦ native-index-ad ç±»ï¼å¹¿åæè¯¥æ è¯åæ¢æ°é¦é¡µæ ·å¼ã 1237 return !!document.querySelector(".native-index-ad"); 1238 }; 1239 /** 广åç³»ç»å级2.0äºæä¸æ¥ç»è®¡ 1240 * params: { 1241 * data // è·å广åè¯¦æ æ¥å£è¿åç info 对象 1242 * eventMetaType // è¦ä¸æ¥çç»è®¡ç±»å 1243 * } 1244 */ 1245 gsIncome.prototype.reportItemStatistics = function (data, eventMetaType) { 1246 if (!data.adPosition || !data.adResource) { 1247 return 1248 } 1249 const now = Date.now(); 1250 // let list = [ 1251 // { 1252 // childCount: 0, 1253 // count: 1, 1254 // eventId: data.adPosition.pcItemStatisticsEventId, // 广åä½ç»è®¡id 1255 // eventMetaType: eventMetaType, 1256 // groupId: data.groupIdPC, 1257 // gsArticleId: 0, 1258 // time: now, 1259 // }, 1260 // ] 1261 1262 // if (data.adResource) { 1263 // list.push({ 1264 // childCount: 0, 1265 // count: 1, 1266 // eventId: data.adResource.pcItemStatisticsEventId, // ç´ æç»è®¡id 1267 // eventMetaType: eventMetaType, 1268 // groupId: data.groupIdPC, 1269 // gsArticleId: 0, 1270 // time: now, 1271 // }) 1272 // } 1273 1274 console.log(data.adPosition.positionDescription, eventMetaType) 1275 1276 if (!window.gsItemStatistics) { 1277 function gsItemStatistics() { 1278 this.willReport = false 1279 this.list = [] 1280 this.failCount = 0 1281 } 1282 1283 gsItemStatistics.prototype.addItem = function (eventId, eventMetaType, groupId, time) { 1284 this.list.push({ 1285 childCount: 0, 1286 count: 1, 1287 eventId: eventId, 1288 eventMetaType: eventMetaType, 1289 groupId: groupId, 1290 gsArticleId: 0, 1291 time: time, 1292 }) 1293 } 1294 1295 gsItemStatistics.prototype.report = function () { 1296 if (!this.list || this.list.length === 0) { 1297 this.willReport = false 1298 return; 1299 } 1300 1301 this.willReport = true; 1302 1303 setTimeout(function () { 1304 let reportData = { 1305 list: window.gsItemStatistics.list, 1306 deviceId: "none", 1307 } 1308 let dataStr = JSON.stringify(reportData) 1309 window.gsItemStatistics.list = [] 1310 1311 $.ajax({
1312 type: "post", 1313 url: "//item-statistics.gamersky.com/ad/statistics/event/report/online/5.0.0", 1314 data: dataStr, 1315 contentType: "application/json", 1316 success: function (responseJson) { 1317 window.gsItemStatistics.willReport = false 1318 if (responseJson.code === 0) { 1319 console.log("䏿¥æå") 1320 window.gsItemStatistics.list = [] 1321 window.gsItemStatistics.failCount = 0 1322 } else { 1323 console.log("䏿¥å¤±è´¥", responseJson.message) 1324 // window.gsItemStatistics.failCount = window.gsItemStatistics.failCount ? window.gsItemStatistics.failCount + 1 : 1 1325 // if (window.gsItemStatistics.failCount < 10) { 1326 // window.gsItemStatistics.report() 1327 // } else { 1328 // window.gsItemStatistics.list = [] 1329 // } 1330 } 1331 }, error: function (xhr, status, error) { 1332 console.log("䏿¥å¤±è´¥", error) 1333 window.gsItemStatistics.willReport = false 1334 // window.gsItemStatistics.failCount = window.gsItemStatistics.failCount ? window.gsItemStatistics.failCount + 1 : 1 1335 // if (window.gsItemStatistics.failCount < 10) { 1336 // window.gsItemStatistics.report() 1337 // } else { 1338 // window.gsItemStatistics.list = [] 1339 // } 1340 } 1341 }); 1342 }, 1000) 1343 } 1344 1345 window.gsItemStatistics = new gsItemStatistics() 1346 } 1347 1348 window.gsItemStatistics.addItem(data.adPosition.pcItemStatisticsEventId, eventMetaType, data.groupIdPC, now) 1349 if (data.adResource) { 1350 window.gsItemStatistics.addItem(data.adResource.pcItemStatisticsEventId, eventMetaType, data.groupIdPC, now) 1351 } 1352 1353 if (!window.gsItemStatistics.willReport) { 1354 window.gsItemStatistics.report() 1355 } 1356 1357 // const reportData = { 1358 // list: list, 1359 // deviceId: "none", 1360 // } 1361 // $.ajax({ 1362 // type: "post", 1363 // url: "//item-statistics.gamersky.com/ad/statistics/event/report/online/5.0.0", 1364 // data: JSON.stringify(reportData), 1365 // contentType: "application/json", 1366 // success: function (responseJson) { }, 1367 // }); 1368 1369 }; 1370 // 1371 gsIncome.prototype.isAdToday = function (targetDate) { 1372 // 1. å¤çç®æ æ¥æï¼è½¬æ¢ä¸º Date 对象ï¼å ¼å®¹å¤ç§è¾å ¥æ ¼å¼ï¼ 1373 const date = new Date(targetDate); 1374 1375 // æ ¡éªæ¥ææææ§ï¼æ ææ¥æç´æ¥è¿å falseï¼ 1376 if (isNaN(date.getTime())) { 1377 console.warn('æ æçæ¥ææ ¼å¼'); 1378 return false; 1379 } 1380 1381 // 2. è·åå½åæ¥æï¼æ¬å°æ¶é´ï¼ 1382 const today = new Date(); 1383 1384 // 3. æ¯è¾å¹´ãæãæ¥ï¼å¿½ç¥æ¶åç§ï¼ 1385 return ( 1386 date.getFullYear() === today.getFullYear() && // å¹´ 1387 date.getMonth() === today.getMonth() && // æï¼0-11ï¼æ é+1ï¼ç´æ¥å¯¹æ¯ï¼ 1388 date.getDate() === today.getDate() // æ¥ï¼1-31ï¼ 1389 ); 1390 }; 1391 // 广åç³»ç»å级2.0äºæè·å广åä½ä¿¡æ¯ 1392 gsIncome.prototype.getAdPositionInfo = function (positionId, callbackFunc) { 1393 var turn = 0; 1394 const updateTimeKey = "adPositionUpdateTime_" + positionId; 1395 if (!window.localStorage) { 1396 // alert("æµè§å¨ä¸æ¯ælocalstorage"); 1397 } else { 1398 turn = window.localStorage.getItem(positionId) || 0; 1399 const updateTime = window.localStorage.getItem(updateTimeKey) || 0; 1400 if (updateTime && updateTime.length > 0 && !this.isAdToday(Number(updateTime))) { 1401 turn = 0; 1402 } 1403 } 1404 const postUrl = $('link[rel*="canonical"]').attr('href') || ''; 1405 1406 const postData = { 1407 tid: positionId, 1408 'turn': turn, 1409 platform: 'PC', 1410 postUrl: postUrl 1411 } 1412 let url = this.getAdSystemApi("detail"); 1413 $.ajax({ 1414 type: "GET", 1415 url: url, 1416 data: postData, 1417 // contentType: "application/json", 1418 success: function (data) { 1419 if (data.info) { 1420 window.localStorage.setItem(positionId, data.info.turn || 0) 1421 window.localStorage.setItem(updateTimeKey, Date.now()) 1422 callbackFunc(data) 1423 } 1424 } 1425 }) 1426 }; 1427 gsIncome.prototype.getAdPositionInfoByData = function (postData, callbackFunc) { 1428 const positionId = postData.tid; 1429 const updateTimeKey = "adPositionUpdateTime_" + positionId; 1430 const updateTime = window.localStorage.getItem(updateTimeKey) || 0; 1431 if (updateTime && updateTime.length > 0 && !this.isAdToday(Number(updateTime))) { 1432 postData.turn = 0; 1433 } 1434 let url = this.getAdSystemApi("detail"); 1435 $.ajax({
1436 type: "GET", 1437 url: url, 1438 data: postData, 1439 // contentType: "application/json", 1440 success: function (data) { 1441 if (data.info) { 1442 window.localStorage.setItem(positionId, data.info.turn || 0) 1443 window.localStorage.setItem(updateTimeKey, Date.now()) 1444 callbackFunc(data) 1445 } 1446 } 1447 }) 1448 }; 1449 gsIncome.prototype.getAdSystemApi = function (apiPath) { 1450 const routerList = [ 1451 "https://router3.gamersky.com/@display/pc/", 1452 "https://router10.gamersky.com/@display/pc/", 1453 "https://router11.gamersky.com/@display/pc/", 1454 ] 1455 const index = Math.floor(Math.random() * routerList.length); 1456 let router = routerList[index]; 1457 return router + apiPath; 1458 } 1459 // 广åç³»ç»å级2.0äºæè·åå¸¦å ³éåè½å¹¿åä½è§æ url 1460 gsIncome.prototype.getAdIconWithClose = function (isIcon, isCommon) { 1461 let iconUrl = ""; 1462 // 广å 1463 if (isCommon == 'common') { 1464 iconUrl = 'https://image.gamersky.com/webimg15/adtag.png'; 1465 } else { 1466 if (isIcon) { 1467 iconUrl = "https://image.gamersky.com/webimg15/Close4ft.png" 1468 } else { 1469 iconUrl = "https://image.gamersky.com/webimg15/tg/Close4ft.png" 1470 } 1471 } 1472 return iconUrl; 1473 1474 } 1475 // 广åç³»ç»å级2.0äºæå¹¿å使¯å¦æå 1476 gsIncome.prototype.isAdPositionShow = function (adPositionInfo, element) { 1477 if ( 1478 adPositionInfo && 1479 adPositionInfo.adPositionInc && 1480 adPositionInfo.adPositionInc.tid 1481 ) { 1482 let AdPosition = element; 1483 if (!AdPosition) { 1484 let id = adPositionInfo.adPositionInc.tid.replace("#", ""); 1485 AdPosition = document.getElementById(id); 1486 } 1487 if (AdPosition && adPositionInfo && adPositionInfo.adResource) { 1488 if ( 1489 AdPosition.getBoundingClientRect().top < 0 || 1490 AdPosition.getBoundingClientRect().top > 1491 document.documentElement.clientHeight 1492 ) { 1493 AdPosition.classList.remove("reportedStatics"); 1494 } else { 1495 if (!AdPosition.classList.contains("reportedStatics")) { 1496 AdPosition.classList.add("reportedStatics"); 1497 return true; 1498 } 1499 } 1500 return false; 1501 } 1502 } else { 1503 return false; 1504 } 1505 }; 1506 // 广åç³»ç»å级2.0äºæ-夿å ç´ æ¯å¦å¨å¯è§åºåå 1507 gsIncome.prototype.isInVisible = function (id) { 1508 let rect = document.getElementById(id).getBoundingClientRect(); 1509 let totalHeight = window.innerHeight || document.documentElement.clientHeight; 1510 return rect.width > 0 && rect.height > 0 && ((rect.top > 0 && rect.top < totalHeight) || (rect.bottom > 0 && rect.bottom < totalHeight)); 1511 }; 1512 // 广åç³»ç»å级2.0äºæï¼å å®¹é¡µèæ¯å¹¿å 1513 gsIncome.prototype.contentNewBackgroundAd = function (gsOption) { 1514 //è§é¢è¿æ¥ 1515 var VideoSrc = ""; 1516 var IsItALoop = "loop"; // 循ç¯å¡«å loop ä¸å¾ªç¯ å¡«å为空å³å¯ 1517 var bgtop = "https://image.gamersky.com/webimg15/adtop.png"; //é¡¶é¨å¾çé´å½± 1518 1519 function isIE() { 1520 var ua = window.navigator.userAgent; 1521 var msie = ua.indexOf("MSIE "); 1522 if (msie > 0) { 1523 // IE 10 or older 1524 return true; 1525 } 1526 var trident = ua.indexOf("Trident/"); 1527 if (trident > 0) { 1528 // IE 11 1529 var rv = ua.indexOf("rv:"); 1530 return true; 1531 } 1532 return false; 1533 } 1534 //æ·»å é«çº§è½®æ 1535 var SwiperList = []; 1536 var SwiperData = {}; 1537 //忢é´é å使¯«ç§ 1000 = 1ç§ 1538 SwiperData.interval = 7000; 1539 //åæ¢ææ 1540 SwiperData.animation = "fade"; 1541 //å¨ç»é度 åºé´ 0 - 2.0 1542 SwiperData.velocity = 0.2; 1543 //å½é¼ æ æ¾å¨å¹»ç¯ç䏿¶æ¯å¦åæ¢å¨ç» 1544 SwiperData.stopOver = false; 1545 1546 var SwiperDom = ""; 1547 if (SwiperList.length > 0 && !isIE()) { 1548 var swl = "<ul>"; 1549 $.each(SwiperList, function (index, item) { 1550 swl += 1551 '<li><img src="' + item + '" /><div class="label_text"></div></li>'; 1552 }); 1553 SwiperDom += 1554 '<div class="SwiperDom" style="position: absolute;"><div class="box_skitter skitter box_skitter_large">' + 1555 swl + 1556 "</ul></div></div><style>#Aback .SwiperDom,#Aback .SwiperDom .skitter {width: 1920px !important;height: 1080px !important;max-height: 1080px !important;max-width: 1920px !important;position: absolute;
1556left: 50%;margin-left: -960px}#Aback .SwiperDom .box_skitter,#Aback .SwiperDom .container_skitter {position: absolute;top: 0}</style>"; 1557 $("head").append( 1558 '<link rel="stylesheet" type="text/css" href="//j.gamersky.com/g/skitter.css">' 1559 ); 1560 } 1561 1562 var bgWW = $(window).width(), 1563 bgWH = $(window).height(); //å¯è§çªå£é«åº¦ 1564 1565 var content = $(".bgAdWrap") 1566 var bgTH = $(".bgAdWrap").offset().top; 1567 1568 //è§é¢èæ¯ 1569 var VideoDom = ""; 1570 if (VideoSrc) { 1571 VideoDom += 1572 '<div class="Showvidow"><video class="backIndexVideo" muted autoplay ' + 1573 IsItALoop + 1574 ">"; 1575 VideoDom += '<source src="' + VideoSrc + '" type="video/mp4">'; 1576 VideoDom += "</video></div>"; 1577 VideoDom += 1578 " <style> .Showvidow { overflow: hidden; width: 100%; display: block; position: relative; top: 214px; }"; 1579 VideoDom += 1580 " .backIndexVideo { position: relative; top: 0; left: 0; width: 100%; height: auto; } </style>"; 1581 } 1582 1583 //左侧å°å¾èæ¯ 1584 var leftDom = ""; 1585 if (gsOption.imgLeft) { 1586 if (gsOption.isScreenAdaptation) { 1587 leftDom = 1588 '<div class="BgYs BgYsL" style="background:url(' + 1589 gsOption.imgLeft + 1590 ') left top no-repeat;display:block;position: fixed;width:450px;height:100vh;max-height:100vh;"></div>'; 1591 } else { 1592 leftDom = 1593 '<div class="BgYs BgYsL" style="background:url(' + 1594 gsOption.imgLeft + 1595 ') right top no-repeat;display:block;position: absolute; top: 0px;width:450px;height:100vh;max-height:100vh;"></div>'; 1596 } 1597 // leftDom = 1598 // '<div class="BgYs BgYsL" style="background:url(' + 1599 // gsOption.imgLeft + 1600 // ') left top no-repeat;display:block;position: fixed;width:411px;height:100vh;max-height:100vh "></div>'; 1601 } 1602 1603 //å³ä¾§å°å¾èæ¯ 1604 var rightDom = ""; 1605 if (gsOption.imgRight) { 1606 if (gsOption.isScreenAdaptation) { 1607 rightDom = 1608 '<div class="BgYs BgYsR" style="background:url(' + 1609 gsOption.imgRight + 1610 ') right top no-repeat;display:block;position: fixed;width:450px;height:100vh;max-height:100vh;"></div>'; 1611 } else { 1612 rightDom = 1613 '<div class="BgYs BgYsR" style="background:url(' + 1614 gsOption.imgRight + 1615 ') left top no-repeat;display:block;position: absolute;top:0px;width:450px;height:100vh;max-height:100vh;"></div>'; 1616 } 1617 // rightDom = 1618 // '<div class="BgYs BgYsR" style="background:url(' + 1619 // gsOption.imgRight + 1620 // ') right top no-repeat;display:block;position: fixed;width:411px;height:100vh;max-height:100vh "></div>'; 1621 } 1622 bgHtm = ""; 1623 1624 // $(".bgAdWrap") 1625 // .height(80) 1626 // .html( 1627 // '<a style="display:block;width:100%;height:100%;background:url(' + TopOccupyingSpace + ') no-repeat center / 100% auto;" target="_blank" href="' + 1628 // bgUrl + 1629 // '" data-itemid="' + 1630 // TongJi + 1631 // '" class="countHit countHitSql"></a>' 1632 // ); 1633 // if (TopOccupyingSpace) { 1634 // // $(".bgAdWrap").css("zIndex", "99") 1635 // } 1636 1637 if (gsOption.isScreenAdaptation) { 1638 bgHtm += 1639 '<div id="Aback" style="margin-left:-' + 1640 bgWW / 2 + 1641 "px; width:" + 1642 bgWW + 1643 "px;height:" + 1644 bgWH + 1645 `px;position:fixed;_position:absolute;left:50%;top:0px;background:${typeof gsIncome.checkJsFileLoaded == 'function' && gsIncome.checkJsFileLoaded('zq.js') ? '' : '#262626'} url(` + 1646 gsOption.bgImg + 1647 ") no-repeat center " + 1648 bgTH + 1649 'px / 100% auto;">'; 1650 } else { 1651 bgHtm += 1652 '<div id="Aback" style="margin-left:-' + 1653 bgWW / 2 + 1654 "px; width:" + 1655 bgWW + 1656 "px;height:" + 1657 bgWH + 1658 // "px;position:fixed;_position:absolute;left:50%;top:0px;background: url(" + 1659 `px;position:fixed;_position:absolute;left:50%;top:0px;background:${typeof gsIncome.checkJsFileLoaded == 'function' && gsIncome.checkJsFileLoaded('zq.js') ? '' : '#262626'} url(` + 1660 gsOption.bgImg + 1661 ") center " + 1662 bgTH + 1663 'px no-repeat;">'; 1664 } 1665 1666 var TongJi = '' 1667 if (gsOption.TongJi) { 1668 TongJi = gsOption.TongJi 1669 } 1670 if (gsOption.countId) { 1671 TongJi = gsOption.countId 1672 } 1673 bgHtm += 1674 '<a style="display:block;width:100%;height:' + 1675 bgWH + 1676 "px;background:url(" + 1677 bgtop + 1678 ") left " + 1679 bgTH + 1680 'px repeat-x;" target="_blank" href="' + 1681 gsOption.bgUrl + 1682 '" data-itemid="' + 1683 TongJi + 1684 '" class="countHit countHitSql">' + 1685 SwiperDom + 1686 VideoDom + 1687 rightDom + 1688 leftDom + 1689 "</a>"; 1690 bgHtm += 1691 '<div class="Close" style="width:' + 1692 gsOption.closeBtnWidth + 1693 "px;height:24px;
1693cursor:pointer;position:absolute;right:0;top:" + 1694 bgTH + 1695 'px;z-index:102;"><i style="background: #000; width: ' + 1696 gsOption.closeBtnWidth + 1697 'px; height: 24px; display: block; position: absolute; z-index: 9; opacity: 0.75; filter: alpha(opacity=75);"></i><i style="background:url(' + 1698 gsOption.closeBtn + 1699 ") no-repeat center;display: block;width: " + 1700 gsOption.closeBtnWidth + 1701 'px;height: 24px; position: absolute; z-index: 10; "></i></div>' + 1702 '<div style="display:none"><img src=' + 1703 gsOption.jcCode 1704 + '"></div>'; 1705 1706 bgHtm += "</div>"; 1707 //$("body").prepend(bgHtm); 1708 $(gsOption.tar).html(bgHtm); 1709 1710 if (SwiperList.length > 0 && !isIE()) { 1711 $("#Aback a").on("click", function (event) { 1712 event.preventDefault(); 1713 // gsTg.gsCountSiteInner(TongJi); //ç»è®¡ 1714 var a = document.createElement("a"); 1715 a.href = bgUrl; 1716 a.target = "_blank"; 1717 a.click(); 1718 }); 1719 $.getScript("//j.gamersky.com/g/jquery.easing.1.3.js", function () { 1720 $.getScript("//j.gamersky.com/g/jquery.skitter.min.js", function () { 1721 $(".box_skitter_large").skitter({ 1722 dots: false, 1723 interval: SwiperData.interval, 1724 animation: SwiperData.animation, 1725 velocity: SwiperData.velocity, 1726 stop_over: SwiperData.stopOver, 1727 }); 1728 }); 1729 }); 1730 } 1731 var $Aback = $("#Aback"), 1732 isIE6 = function () { 1733 return !!window.ActiveXObject && !window.XMLHttpRequest; 1734 }; //夿IE6; 1735 $Aback.on("click", ".Close", function () { 1736 $Aback.remove(); 1737 $(".bgAdWrap").removeAttr("style").html(""); 1738 }); 1739 1740 var bgys = $(".BgYs"); 1741 function Aback() { 1742 var Bw = (window.innerWidth - ($(".Mid").width() + 50)) / 2; 1743 console.log('Bw', Bw) 1744 var YsBW = (1920 - ($(".Mid").width() + 20)) / 2; 1745 console.log('YsBW', YsBW) 1746 var ZoomNum = (Bw / YsBW) * 100;
1747 console.log('ZoomNum', ZoomNum) 1748 if (gsOption.isScreenAdaptation) { 1749 var wt = $(window).scrollTop(), 1750 t = wt >= bgTH ? (isIE6() == true ? wt : 0) : bgTH - wt; 1751 $Aback.css("background-position", "center " + t + "px"); 1752 $Aback.find("a").css("background-position", "left " + t + "px"); 1753 $Aback.find(".Close").css("top", t); 1754 1755 $(".Showvidow").css("top", t); 1756 $(".SwiperDom").css("top", t); 1757 var size = $(window).width() > 1800 ? "100% auto" : "120% auto"; 1758 $Aback.css("background-size", size); 1759 1760 bgys.css("top", t); 1761 //var Bw = (window.innerWidth - ($(".Mid").width() + 50)) / 2; 1762 // var Margins = (document.body.offsetWidth - 1920) / 2; 1763 // $(".BgYsL").css("left", 0 + Margins - 0); 1764 // $(".BgYsR").css("right", 0 + Margins - 1); 1765 $(".BgYsL").css("left", 0); 1766 $(".BgYsR").css("right", 0); 1767 $(".BgYsL").css("width", Bw + "px"); 1768 $(".BgYsR").css("width", Bw + "px"); 1769 $(".BgYsL").css("background-position", "left top"); 1770 $(".BgYsR").css("background-position", "right top"); 1771 1772 //var YsBW = (1920 - ($(".Mid").width() + 20)) / 2; 1773 //var ZoomNum = (Bw / YsBW) * 100; 1774 //console.log('YsBW', YsBW) 1775 //console.log('ZoomNum', ZoomNum) 1776 if (ZoomNum == 100) { 1777 var Margins = (document.body.offsetWidth - 1920) / 2; 1778 $(".BgYsL").css("left", 0 + Margins - 0); 1779 $(".BgYsR").css("right", 0 + Margins - 1); 1780 } 1781 if (ZoomNum < 100) { 1782 if (ZoomNum > 40) { 1783 bgys.css("background-size", 100 + "%"); 1784 } else { 1785 bgys.css("background-size", 211 + "px"); 1786 $(".BgYsL").css("background-position", "right top"); 1787 $(".BgYsR").css("background-position", "left top"); 1788 } 1789 bgys.css("background-attachment", "local"); 1790 } else { 1791 let bwSize = (450 / (1920 / window.innerWidth)); 1792 console.log('bwSize', bwSize) 1793 //bgys.css("background-size", YsBW + "px"); 1794 //bgys.css("background-size", (450 / (1903 / window.innerWidth)) + "px"); 1795 bgys.css("background-size", bwSize + "px"); 1796 bgys.css("background-attachment", "local"); 1797 } 1798 // bgys.css("background-size", "100%"); 1799 } else { 1800 // æªå¼å¯å±å¹éé 1801 var wt = $(window).scrollTop(), 1802 t = wt >= $(".bgAdWrap").offset().top ? (isIE6() == true ? wt : 0) : $(".bgAdWrap").offset().top - wt; 1803 $Aback.css("background-position", "center " + t + "px"); 1804 $Aback.find("a").css("background-position", "left " + t + "px"); 1805 $Aback.find(".Close").css("top", t); 1806 1807 $(".Showvidow").css("top", t); 1808 $(".SwiperDom").css("top", t); 1809 1810 bgys.css("top", t); 1811 //var Bw = (window.innerWidth - ($(".Mid").width() + 50)) / 2; 1812 var Margins = (document.body.offsetWidth - 1920) / 2; 1813 $(".BgYsL").css("left", 0 + Margins - 0); 1814 $(".BgYsR").css("right", 0 + Margins - 1); 1815 //var YsBW = (1920 - ($(".Mid").width() + 20)) / 2; 1816 //var ZoomNum = (Bw / YsBW) * 100; 1817 if (ZoomNum < 100) { 1818 if (ZoomNum < 54) { 1819 ZoomNum = 54; 1820 } 1821 if (ZoomNum > 40) { 1822 bgys.css("background-size", 100 + "%"); 1823 } else { 1824 bgys.css("background-size", ZoomNum + "%"); 1825 } 1826 //bgys.css("background-size", ZoomNum + "%"); 1827 } else { 1828 bgys.css("background-size", "100%"); 1829 } 1830 } 1831 } 1832 1833 $(window) 1834 .resize(function () { 1835 var winW = $(window).width(), 1836 winH = $(window).height(); 1837 $Aback.css({ 1838 width: winW, 1839 height: winH, 1840 marginLeft: "-" + winW / 2 + "px", 1841 }); 1842 1843 $Aback.find("a").css({ 1844 height: winH, 1845 }); 1846 Aback(); 1847 }) 1848 .scroll(Aback) 1849 .trigger("scroll"); 1850 1851 if (gsOption.ExposureId) { 1852 gsTg.gsCountSiteInner(gsOption.ExposureId); 1853 } 1854 }; 1855 /** * 夿页颿¯å¦å¼å ¥äºæå®çJSæä»¶ 1856 * @param {string} jsFileName - è¦æ£æµçJSæä»¶åï¼å¦ zq.jsï¼ 1857 * @param {boolean} exactMatch - æ¯å¦ç²¾ç¡®å¹é ï¼é»è®¤falseï¼æ¨¡ç³å¹é ï¼ 1858 * @returns {boolean} æ¯å¦å¼å ¥äºè¯¥JSæä»¶ 1859 */ 1860 gsIncome.prototype.checkJsFileLoaded = function (jsFileName, exactMatch = false) { 1861 // è·å页é¢ä¸ææçscriptæ ç¾ 1862 const scriptTags = document.getElementsByTagName('script'); 1863 1864 // éåææscriptæ ç¾ 1865 for (let i = 0; i < scriptTags.length; i++) { 1866 const scriptSrc = scriptTags[i].src; 1867 1868 // 妿src为空ï¼å èèæ¬ï¼ï¼è·³è¿ 1869 if (!scriptSrc) continue; 1870 1871 if (exactMatch) { 1872 // 精确å¹é ï¼å¤æsrcçæåé¨åæ¯å¦çäºç®æ æä»¶å 1873 const fileName = scriptSrc.split('/').pop(); 1874 if (fileName === jsFileName) { 1875 return true; 1876 } 1877 } else { 1878 // 模ç³å¹é ï¼å¤æsrc䏿¯å¦å å«ç®æ æä»¶åï¼
1878æ¨èï¼ 1879 if (scriptSrc.includes(jsFileName)) { 1880 return true; 1881 } 1882 } 1883 } 1884 1885 // æªæ¾å°åè¿åfalse 1886 return false; 1887 }; 1888 function sendItemStatisticsByBeacon(data) { 1889 if (!window.navigator.sendBeacon) { 1890 return false; 1891 } 1892 try { 1893 const blob = new Blob([JSON.stringify(data)], { type: 'application/json' }); 1894 return window.navigator.sendBeacon( 1895 "//router4.gamersky.com/@adSystem/adTest/itemStatisticsPost", 1896 blob 1897 ); 1898 } catch (error) { 1899 return false; 1900 } 1901 } 1902 function reportItemStatisticsByJsonp(data) { 1903 $.ajax({ 1904 type: "get", 1905 dataType: "jsonp", 1906 url: "//router4.gamersky.com/@adSystem/adTest/itemStatisticsGet", 1907 data: data, 1908 success: function (responseJson) { }, 1909 error: function (xhr, status, error) { } 1910 }); 1911 } 1912 function createItemStatisticsRequestId() { 1913 if (window.crypto && typeof window.crypto.randomUUID === 'function') { 1914 return window.crypto.randomUUID(); 1915 } 1916 return Date.now().toString(36) + '-' + Math.random().toString(36).slice(2); 1917 } 1918 function reportItemStatisticsByFetch(data) { 1919 if (typeof window.fetch !== 'function') { 1920 return Promise.reject(new Error('fetch unsupported')); 1921 } 1922 return window.fetch("//router4.gamersky.com/@adSystem/adTest/itemStatisticsPost", { 1923 method: 'POST', 1924 headers: { 1925 'Content-Type': 'application/json' 1926 }, 1927 body: JSON.stringify(data), 1928 keepalive: true, 1929 credentials: 'omit' 1930 }).then(function (response) { 1931 if (!response || !response.ok) { 1932 throw new Error('item statistics request failed'); 1933 } 1934 return response; 1935 }); 1936 } 1937 /** ç¹å»ä¸ç¨ç»è®¡ï¼POST å¯ç¡®è®¤å¤±è´¥ï¼å¤±è´¥æ¶å¤ç¨ requestId èµ° JSONP è¡¥æ¥ã */ 1938 gsIncome.prototype.reportClickStatistics = function (info, eventMetaType) { 1939 let gsUserID = ''; 1940 try { 1941 gsUserID = JSON.parse(cookie('UserCookie')).userid 1942 } catch (error) { 1943 } 1944 1945 const data = { 1946 requestId: createItemStatisticsRequestId(), 1947 resId: info.adResource.id, 1948 positionID: info.adPosition.id, 1949 eventMetaType: eventMetaType, 1950 groupID: 3, 1951 gsUserID: gsUserID, 1952 contentUrl: location.href, 1953 ip: '', 1954 } 1955 1956 return reportItemStatisticsByFetch(data).catch(function () { 1957 reportItemStatisticsByJsonp(data); 1958 }); 1959 }; 1960 /** 广åç³»ç»å级2.0äºæä¸æ¥ç»è®¡V2 1961 * params: { 1962 * data // è·å广åè¯¦æ æ¥å£è¿åç info 对象 1963 * eventMetaType // è¦ä¸æ¥çç»è®¡ç±»å 1964 * } 1965 */ 1966 gsIncome.prototype.reportItemStatisticsV2 = function (info, eventMetaType) { 1967 console.log(info.adPosition.positionDescription, eventMetaType) 1968 1969 let gsUserID = ''; 1970 try { 1971 gsUserID = JSON.parse(cookie('UserCookie')).userid 1972 } catch (error) { 1973 } 1974 1975 const data = { 1976 resId: info.adResource.id, 1977 positionID: info.adPosition.id, 1978 eventMetaType: eventMetaType, 1979 groupID: 3, 1980 gsUserID: gsUserID, 1981 contentUrl: location.href, 1982 ip: '', 1983 } 1984 1985 if (!sendItemStatisticsByBeacon(data)) { 1986 reportItemStatisticsByJsonp(data); 1987 } 1988 }; 1989 gsIncome.prototype.reportItemStatisticsV3 = function (info, eventMetaTypeList) { 1990 for (let i = 0; i < eventMetaTypeList.length; i++) { 1991 let eventMetaType = eventMetaTypeList[i] 1992 console.log(info.adPosition.positionDescription, eventMetaType) 1993 } 1994 1995 let gsUserID = ''; 1996 try { 1997 gsUserID = JSON.parse(cookie('UserCookie')).userid 1998 } catch (error) { 1999 } 2000 2001 let data = { 2002 resId: info.adResource.id, 2003 positionID: info.adPosition.id, 2004 eventMetaTypeList: eventMetaTypeList, 2005 groupID: 3, 2006 gsUserID: gsUserID, 2007 contentUrl: location.href, 2008 ip: '', 2009 } 2010 2011 if (!sendItemStatisticsByBeacon(data)) { 2012 data.eventMetaTypeList = eventMetaTypeList.join(',') 2013 reportItemStatisticsByJsonp(data); 2014 } 2015 }; 2016 //å¹»ç¯å¹¿å-æ° 2017 gsIncome.prototype.slideNew = function (options) { 2018 var gsDom = ""; 2019 var tar = options.tar; //广å主ID 2020 var width = options.width; //广å宽度 2021 var height = options.height; //广åé«åº¦ 2022 var autoPlay = options.autoPlay || false; //true:èªå¨ææ¾ false:ç¦æ¢èªå¨ææ¾ 2023 var effect = options.effect || "fold"; //fold:æ¸å leftLoop:å左循ç¯ç§»å¨ 2024 var interTime = options.interTime || 3000; //èªå¨ææ¾æ¶é´:3ç§ 2025 var infos = options.infos || []; //广åç´ æ 2026 var jcCode = options.jcCode || ""; //çæµä»£ç 2027 var margin = options.margin || "0 auto"; //å¤è¾¹è· 2028 var ApkDownloadOverlayMethod = false 2029 2030 gsDom += "<style>"; 2031 gsDom += 2032 ".displaySlide {margin:" + 2033 margin + 2034 ";
2034width:" + 2035 width + 2036 "px;height:" + 2037 height + 2038 "px;overflow:hidden;position:relative;}"; 2039 gsDom += 2040 ".displaySlide .Bimg {width:" + 2041 width + 2042 "px;height:" + 2043 height + 2044 "px;overflow:hidden;position:relative;}"; 2045 gsDom += 2046 ".displaySlide .Bimg li {float:left;width:" + 2047 width + 2048 "px;height:" + 2049 height + 2050 "px;position:relative;}"; 2051 gsDom += 2052 ".displaySlide .Bimg li div {position:absolute;left:0;bottom:0;overflow:hidden;}"; 2053 gsDom += 2054 ".displaySlide .Bimg li .mask {width:100%;height:90px;background:url(//image.gamersky.com/webimg15/mk3.png) 0 bottom repeat-x;}"; 2055 gsDom += 2056 ".displaySlide .Bimg li .text {padding:0 5px;width:auto;height:34px;line-height:34px;color:#f2f2f3;font-size:16px;font-weight:700;font-family:'Microsoft YaHei';}"; 2057 gsDom += 2058 ".displaySlide .Bimg li a {display:block;width:100%;height:100%;background:url(#);position:absolute;left:0;top:0;}"; 2059 gsDom += 2060 ".displaySlide .tag {display:block;width:24px;height:13px;position:absolute;right:0;top:0;z-index:2;background:url(//image.gamersky.com/webimg15/adtag.png);}"; 2061 gsDom += 2062 ".displaySlide .Simg {padding:5px 0;width:100%;height:auto;text-align:center;font-size:0;position:absolute;left:0;bottom:30px;transition:all .25s ease-out;}"; 2063 gsDom += ".displaySlide .Simg.cur {bottom:5px;}"; 2064 gsDom += 2065 ".displaySlide .Simg a {margin:0 4px;display:inline-block;width:6px;height:6px;border:1px solid #8b8b8b;border-radius:50%;}"; 2066 gsDom += 2067 ".displaySlide .Simg a.cur {cursor:defat;background-color:#ff2005;border-color:#ff2005;}"; 2068 gsDom += 2069 ".displaySlide .btn {display:block;width:34px;height:47px;background:url(//image.gamersky.com/webimg15/slide-btn.png) no-repeat;position:absolute;top:50%;margin-top:-23px;z-index:10;}"; 2070 gsDom += 2071 ".displaySlide .btn.prev {left:-34px;background-position-x:0;border-radius:0 5px 5px 0;}"; 2072 gsDom += 2073 ".displaySlide .btn.next {right:-34px;background-position-x:-34px;border-radius:5px 0 0 5px;}"; 2074 gsDom += "</style>"; 2075 2076 gsDom += '<div class="displaySlide">'; 2077 gsDom += '<ul class="Bimg">'; 2078 $.each(infos, function (index, value) { 2079 var gsmExtension = backExt(value.imgUrl); //è·åå¾çæhtmlåç¼å 2080 gsDom += "<li>"; 2081 if ( 2082 gsmExtension === "jpg" || 2083 gsmExtension === "gif" || 2084 gsmExtension === "png" 2085 ) { 2086 gsDom += 2087 '<img src="' + 2088 value.imgUrl + 2089 '" width="100%" height="100%" border="0"/>'; 2090 } else if (gsmExtension == "mp4" || gsmExtension == "webm") { 2091 gsDom += 2092 '<video muted="muted" loop width="' + 2093 width + 2094 '" height="' + 2095 height + 2096 ' controls="" autoplay="" name="media" src="' + 2097 value.imgUrl + 2098 '">'; 2099 gsDom += 2100 '<img src="' + 2101 value.imgUrl + 2102 '" width="' + 2103 width + 2104 '" height="' + 2105 height + 2106 '" border="0" />'; 2107 gsDom += "</video>"; 2108 } else { 2109 gsDom += 2110 '<iframe width="' + 2111 width + 2112 '" height="' + 2113 height + 2114 '" src="' + 2115 value.imgUrl + 2116 '" frameborder="0" scrolling="no"></iframe>'; 2117 } 2118 if (value.adText !== "") { 2119 gsDom += '<div class="mask"></div>'; 2120 } 2121 gsDom += '<div class="text">' + value.adText + "</div>"; 2122 if (value.likUrl !== "") { 2123 if (value.InstallationPackage) { 2124 ApkDownloadOverlayMethod = true 2125 gsDom += '<div class="InstallationPackageExebox none" style="width: 300px;height: 250px;background: rgba(0, 0, 0, 0.8);">' 2126 gsDom += '<img src="https://imgf.gamersky.com/img/tqbc2010/20240628-161801.png" alt="" style="margin: 46px auto 12px;display: block;">' 2127 gsDom += '<p style="text-align: center;font-size: 16px;color: #fff;margin: 0 auto 30px;">å³å°ä¸è½½å®è£ å ...</p>' 2128 gsDom += '<div class="btnbox" style="width: 220px;bottom: 36px;height: 35px;left: 41px;"><a class="countHit" data-itemid="' + 2129 value.itemid + 2130 '" href="' + 2131 value.likUrl + 2132 '" target="_blank" style="cursor: pointer;text-decoration: none;margin-right:12px;float: left;display: block;width: 122px;height: 35px;background: #63ffc4;border-radius: 18px;text-align: center;line-height: 35px;font-size: 17px;color: #000;">ç«å³ä¸è½½</a>' 2133 gsDom += '<div class="btnQs" style="cursor: pointer;left: 134px;text-decoration: none;float: left;display: block;width: 85px;height: 35px;background: rgba(255, 255, 255, 0.75);border-radius: 18px;text-align: center;line-height: 35px;font-size: 17px;color: #000;">åæ¶</div>' 2134 gsDom += '</div></div>' 2135 } else { 2136 if (value.itemid !== "") { 2137 gsDom += 2138 '<a class="countHit" data-itemid="' + 2139 value.itemid + 2140 '" href="' + 2141 value.likUrl + 2142 '" target="_blank"></a>'; 2143 } else { 2144 gsDom += '<a href="' + value.likUrl + '" target="_blank"></a>'; 2145 } 2146 } 2147 } 2148 gsDom += "</li>"; 2149 }); 2150 gsDom += "</ul>"; 2151 gsDom += '<i class="tag"></i>'; 2152 if (effect === "fold") { 2153 gsDom += '<div class="Simg"></div>'; 2154 } else if (autoPlay) { 2155 gsDom += '<a class="btn prev" href="javascript:;"></a>'; 2156 gsDom += '<a class="btn next" href="javascript:;"></a>'; 2157 } 2158 2159 gsDom += "</div>"; 2160 if (jcCode) { 2161 gsDom += gsCountAnalysis(jcCode); 2162 }
2163 $(".ad_r").css("margin", "5px 0 20px").attr("class", "display_r") 2164 2165 $(tar).css("overflow", "visible").html(gsDom).adSlide({ 2166 bigPic: ".Bimg", //å¤§å¾ 2167 smallPic: ".Simg", //å°å¾ 2168 autoPlay: autoPlay, //true:èªå¨ææ¾ false:忢èªå¨ææ¾ 2169 interTime: 3000, //èªå¨ææ¾æ¶é´ 2170 effect: effect, //fold:æ¸å leftLoop:å左循ç¯ç§»å¨ 2171 delayTime: 300, //æ¸åæç§»å¨é度 2172 prevCell: ".prev", 2173 nextCell: ".next", 2174 }); 2175 2176 // å¼å¯apkè¦å±æ¹æ³ 2177 if (ApkDownloadOverlayMethod) { 2178 $('.clone img,.clone video,.clone iframe').on("click", function () { 2179 $(this).closest('.clone').find('.InstallationPackageExebox').removeClass('none') 2180 }) 2181 $('.InstallationPackageExebox .btnbox .btnQs').on("click", function () { 2182 $(this).closest('.InstallationPackageExebox').addClass('none') 2183 }) 2184 } 2185 }; 2186 window.gsTg = new gsIncome(); 2187})(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.