$(document).on("click", ".menu", function () { $("#sideMenu").removeClass("dn"); setTimeout(function () { $(".side-menu").toggleClass("folded"); }, 0); }); $(document).on("click", ".fold, #sideMenu", function () { $(".side-menu").toggleClass("folded"); setTimeout(function () { $("#sideMenu").addClass("dn"); }, 500); }); $(document).on("click", ".tab-bar>a", function () { $(this).addClass("cur").siblings().removeClass("cur"); }); $(".unfold").click(function () { $(".game-des").toggleClass("maxline3"); $(".unfold").toggleClass("dn"); // if ($(this).hasClass('unfolded')) { // $(this).text('收起') // } else { // $(this).text('展开') // } }); $(document).on("click", ".sbi", function () { $(this).addClass("cur").siblings().removeClass("cur"); $(".xgtj-list").toggleClass("dn"); }); $(document).on("click", ".check-permission, .lyi-close", function () { $(".layer-yyqx").toggleClass("dn"); }); $(document).on("click", ".load-more", function () { $(".xgtj-list").removeClass("hide-more"); $(this).remove(); }); $(document).on("click", ".layer-img-preview", function () { $(this).addClass("dn"); }); $(document).on("click", ".img-list img", function () { $("#lipImg").attr({ src: this.src }); $(".layer-img-preview").removeClass("dn"); }); var p = 0, t = 0, stopScrollTimer; function scrollFn() { clearTimeout(stopScrollTimer); if ($(window).scrollTop() > 300) { $(".fb-item-top, .ljxz-btn-w").show(); } else { $(".fb-item-top, .ljxz-btn-w").hide(); } p = $(this).scrollTop(); if (t <= p) { //向下滚 $(".fb-item-report").hide(); } else { //向上滚 $(".fb-item-report").show(); } setTimeout(function () { t = p; }, 0); stopScrollTimer = setTimeout(stopScroll, 200); } $(".fb-item-top").click(function () { window.scrollTo(0,0); }); function stopScroll() { $(".fb-item-report").show(); } $(window).scroll(scrollFn); scrollFn(); var rgbToHex = function (r, g, b) { return ( "#" + [r, g, b] .map(function (x) { var hex = x.toString(16); return hex.length === 1 ? "0" + hex : hex; }) .join("") ); }; var setGradient = function (img) { try { var rgb = colorThief.getColor(img); var hex = rgbToHex(rgb[0], rgb[1], rgb[2]); $(img) .siblings(".hal-item-bg") .css({ backgroundImage: "linear-gradient(180deg, #000 0%, " + hex + " 100%)", }); } catch (error) {} }; var colorThief = new ColorThief(); $(".hal-item-img").each(function () { var img = this; if (img.complete) { setGradient(img); } else { img.addEventListener("load", function () { setGradient(img); }); } }); // 评论模块,点赞只能点击一次 $(document).on("click", ".like", function () { var likeIndex = $(".like").index(this); var likeNum = parseInt($(".like")[likeIndex].children[0].innerHTML); if ($(this).hasClass("on")) { return false; } else { likeNum++; $(".like")[likeIndex].children[0].innerHTML = likeNum; $(this).addClass("on"); } }); $(document).on("click", ".to-reply", function () { var replyIndex = $(".to-reply").index(this); $(".comment-dialog").each(function (index, ele) { if (index === replyIndex) return; $(ele).removeClass("visible"); }); var commentDialogIndex = $(".comment-dialog")[replyIndex]; $(commentDialogIndex).toggleClass("visible"); var textarea = $(commentDialogIndex).find("textarea"); if ($(commentDialogIndex).hasClass("visible")) { textarea.focus(); } }); $(document).on("click", ".cancel", function () { $(this).parents(".comment-dialog").hide(); }); $(document).on("click", ".fb-item-report", function () { $(".report").removeClass("dn"); }); $(document).on("click", ".r-close", function () { $(".report").addClass("dn"); }); $(document).on("click", ".fake-cb", function () { $(this).siblings("label").click(); }); $(document).on("click", ".commentBtn", function () { var comment = $(".comment-area").val(); var name = $(".web-name").val(); if (comment && name) { var text = ""; text += '
'; text += '
'; text += ' '; text += '
' + name + "
"; text += "
"; text += '
'; text += comment; text += "
"; text += '
'; text += ' "; text += ' ' + new Date().toLocaleDateString().replace(/\//g, "-") + ""; text += ' '; text += ' "; text += ' 回复'; text += " "; text += "
"; text += '
'; text += '
'; text += "

回复@" + name + ":

"; text += ' '; text += "
"; text += ""; text += ' "; text += "
"; text += "
"; $(".commentText").prepend(text); $(".comment-area, .web-name").val(""); } }); $(document).on("click", ".gzh-close", function () { $(".gzh-layer").addClass("dn"); }); $(document).on("click", ".fb-item-qrcode", function () { $(".gzh-layer").removeClass("dn"); //navigator.clipboard.writeText('多特资源库') //toast("已复制多特公众号"); }); function toast(msg) { $(".toast-w").text(msg).removeClass("dn"); setTimeout(function () { $(".toast-w").addClass("dn"); }, 2000); } // 判断是否为微信环境 function isWeiXin(){ var ua = window.navigator.userAgent.toLowerCase(); if(ua.match(/MicroMessenger/i) == 'micromessenger'){ return true; }else{ return false; } } function closeDialog() { $('#wx-dialog').hide() } // 添加右上角浏览器打开的提示 if (isWeiXin()) { var div = $("
") $('body').append(div) } var dlist=$('.btn-normal-pt'); for(i=0;i<=dlist.length-1;i++) { var ourl=dlist[i].href; var nurl=ourl.replace('az.runjiapp.com','qn4.runjiapp.com'); nurl=nurl.replace('download.runjiapp.com','qn3.runjiapp.com'); dlist[i].href=nurl; } var dlist=$('.btn-normal'); for(i=0;i<=dlist.length-1;i++) { var ourl=dlist[i].href; var nurl=ourl.replace('az.runjiapp.com','qn4.runjiapp.com'); nurl=nurl.replace('download.runjiapp.com','qn3.runjiapp.com'); dlist[i].href=nurl; }