/*! * @project : * @version : 1.0.0 * @author : baichun * @update : 2018-04-19 */ // import './sass/bbs.scss'; (function (window, $) { var cssStr = `.m-recommend__hd{padding:0 10px;height:38px;background-color:#ececec;border-top:1px solid #dfdfdf;border-bottom:1px solid #dfdfdf;overflow:hidden;line-height:38px} .m-recommend__hd h5{font-size: 18px;color: #333;} .m-recommend{border:1px solid #dfdfdf;border-top:none;margin-bottom:10px} .m-recommend .m-game_link{display:-webkit-box;display: flex;padding:10px} .m-recommend .m-game_fl{-webkit-box-flex: 1;-ms-flex:1;flex:1;width:100px;margin-right:10px} .m-recommend .m-game_fl img{width:100%;display:block;overflow:hidden} .m-recommend .m-game_fr{-webkit-box-flex: 2;-ms-flex:2;flex:2;margin-right: 10px;} .m-recommend .m-game_fr h2{font-size:16px;line-height:22px;margin-top:-4px;height:44px;overflow:hidden} .m-recommend .m-game_fr p{font-size:12px;color:#999;text-align:right} .m-forumList__item.ad-forumList__item .m-forumList__info{font-size:12px;color:#999} .ico-common.ico-cg{background:url(//pub.dwstatic.com/common/img/da-bbs-cg.png) 50%/100% no-repeat} .m-comment__item--top .da-link{display:block} .m-comment__item--top .comment-control .control-da-tag{float:left;color:#999} .comment-header-da img{width:100%}`; var Util = { getParam : function(name) { //先获取#后面的参数 var str = document.location.hash.substr(2); var value = this.getParam2(name, str); if (value == null) { str = document.location.search.substr(1); value = this.getParam2(name, str); } return value; }, getParam2 : function(name, str) { //获取参数name的值 var reg = new RegExp("(^|!|&|\\?)" + name + "=([^&]*)(&|$)"); //再获取?后面的参数 var r = str.match(reg); if (r != null) { try { return decodeURIComponent(r[2]); } catch (e) { console.log(e + "r[2]:" + r[2]); return null; } } return null; }, isFunction: function (obj) { return Object.prototype.toString.call(obj) === "[object Function]"; }, getScript: function (url, callback) { var head = document.getElementsByTagName("head")[0] || document.documentElement; var script = document.createElement("script"); script.type = "text/javascript"; script.async = true; script.charset = "utf-8"; script.src = url; script.onload = script.onreadystatechange = function () { if (!script.readyState || /loaded|complete/.test(script.readyState)) { if (Util.isFunction(callback)) { callback(); } script.onload = script.onreadystatechange = null; if (script.parentNode) { script.parentNode.removeChild(script); } } }; head.insertBefore(script,null); }, getScriptArg: function (key) { var scripts = document.getElementsByTagName("script"), script = scripts[scripts.length - 1], src = script.src; return (src.match(new RegExp("(?:\\?|&)" + key + "=(.*?)(?=&|$)")) || ['', null])[1]; }, createStyleSheet : function(cssText) { var stylesheet; if (document.createStyleSheet) { stylesheet = document.createStyleSheet(); stylesheet.cssText = cssText; } else { stylesheet = document.createElement("style"); stylesheet.appendChild(document.createTextNode(cssText)); document.getElementsByTagName("head")[0].appendChild(stylesheet); } return stylesheet; } } var winHeight = $(window).height() var adv = { isiOS : navigator.userAgent.match(/(iPhone|iPod|iPad);?/i), //ios终端 indexRecommendLocid : 175, //每日推荐175 indexBBsLocid : 176, //帖子列表176 detailPostLocid : 177, //帖子详情177 init(){ // if(Util.getParam("isdebug")!=1) return $("head").append(``) let curPage = Util.getScriptArg("type"), self = this; if (curPage=="detail") { //详情页 self.initPostList() } else { //首页 self.initRecommendAdv() self.initBbsList() } Util.getScript("//pub.dwstatic.com/common/js/dastat.js",()=>{ $(window).scroll(self.initScroll); }); }, recommendTmpl(t){ var dom = `
${t.title}