From 0d99012a5c31535aac0ecff504b085c038f9c9f1 Mon Sep 17 00:00:00 2001 From: liukaidi <2379942411@qq.com> Date: Tue, 23 Jul 2019 15:35:59 +0800 Subject: [PATCH 01/34] =?UTF-8?q?=E6=9C=80=E7=81=AB=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AFmip=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sites/m.veryhuo.com/.editorconfig | 14 + sites/m.veryhuo.com/.eslintignore | 2 + sites/m.veryhuo.com/.eslintrc | 39 ++ sites/m.veryhuo.com/.gitignore | 8 + sites/m.veryhuo.com/common/.gitkeep | 0 .../components/mip-veryhuo-comment/README.md | 31 ++ .../mip-veryhuo-comment/example/index.html | 18 + .../components/mip-veryhuo-comment/index.less | 1 + .../mip-veryhuo-comment.js | 384 ++++++++++++++++++ sites/m.veryhuo.com/example/index.html | 18 + sites/m.veryhuo.com/mip.config.js | 31 ++ sites/m.veryhuo.com/package.json | 25 ++ sites/m.veryhuo.com/static/.gitkeep | 0 13 files changed, 571 insertions(+) create mode 100644 sites/m.veryhuo.com/.editorconfig create mode 100644 sites/m.veryhuo.com/.eslintignore create mode 100644 sites/m.veryhuo.com/.eslintrc create mode 100644 sites/m.veryhuo.com/.gitignore create mode 100644 sites/m.veryhuo.com/common/.gitkeep create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-comment/README.md create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-comment/example/index.html create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-comment/index.less create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js create mode 100644 sites/m.veryhuo.com/example/index.html create mode 100644 sites/m.veryhuo.com/mip.config.js create mode 100644 sites/m.veryhuo.com/package.json create mode 100644 sites/m.veryhuo.com/static/.gitkeep diff --git a/sites/m.veryhuo.com/.editorconfig b/sites/m.veryhuo.com/.editorconfig new file mode 100644 index 000000000..cb530eac4 --- /dev/null +++ b/sites/m.veryhuo.com/.editorconfig @@ -0,0 +1,14 @@ +UTF-8 +# This file is for unifying the coding style for different editors and IDEs +# editorconfig.org +root = true +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +[*.{js,styl,html,json,vue}] +indent_size = 2 +indent_style = space +[*.md] +trim_trailing_whitespace = false diff --git a/sites/m.veryhuo.com/.eslintignore b/sites/m.veryhuo.com/.eslintignore new file mode 100644 index 000000000..db4c6d9b6 --- /dev/null +++ b/sites/m.veryhuo.com/.eslintignore @@ -0,0 +1,2 @@ +dist +node_modules \ No newline at end of file diff --git a/sites/m.veryhuo.com/.eslintrc b/sites/m.veryhuo.com/.eslintrc new file mode 100644 index 000000000..84a3a2e9c --- /dev/null +++ b/sites/m.veryhuo.com/.eslintrc @@ -0,0 +1,39 @@ +{ + "parser": "vue-eslint-parser", + "parserOptions": { + "ecmaVersion": 8, + "sourceType": "module", + "allowImportExportEverywhere": false + }, + "extends": [ + "standard", + "plugin:vue/recommended" + ], + "plugins": [ + "jsdoc" + ], + "globals": { + "MIP": true + }, + "env": { + "browser": true + }, + "rules": { + "jsdoc/check-param-names": 1, + "jsdoc/check-tag-names": 1, + "jsdoc/check-types": 1, + "jsdoc/newline-after-description": 1, + "jsdoc/no-undefined-types": 1, + "jsdoc/require-description-complete-sentence": 0, + "jsdoc/require-example": 0, + "jsdoc/require-hyphen-before-param-description": 0, + "jsdoc/require-param": 1, + "jsdoc/require-param-description": 1, + "jsdoc/require-param-name": 1, + "jsdoc/require-param-type": 1, + "jsdoc/require-returns-description": 1, + "jsdoc/require-returns-type": 1, + "jsdoc/valid-types": 1, + "no-var": 2 + } +} diff --git a/sites/m.veryhuo.com/.gitignore b/sites/m.veryhuo.com/.gitignore new file mode 100644 index 000000000..1207415d5 --- /dev/null +++ b/sites/m.veryhuo.com/.gitignore @@ -0,0 +1,8 @@ +node_modules/ +dist/ +.idea/ +*.log +Thumbs.db +.DS_Store +*.swp +*.gz diff --git a/sites/m.veryhuo.com/common/.gitkeep b/sites/m.veryhuo.com/common/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-comment/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-comment/README.md new file mode 100644 index 000000000..1c7944a6d --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-comment/README.md @@ -0,0 +1,31 @@ +# mip-ddooo-comment + +移动端样式、逻辑 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive, fixed-height, fill, container, fixed +所需脚本| [https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-comment/mip-veryhuo-comment.js](https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-comment/mip-veryhuo-comment.js) + +## 示例 + +### 基本使用 + +```html + +``` + +## 属性 + +### url + +说明:本站点网址 + +必选项:是 + +类型:字符串 + +取值范围:URL + +默认值:无 \ No newline at end of file diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-comment/example/index.html b/sites/m.veryhuo.com/components/mip-veryhuo-comment/example/index.html new file mode 100644 index 000000000..6307533db --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-comment/example/index.html @@ -0,0 +1,18 @@ + + + + + + MIP page + + + + + + + + + + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-comment/index.less b/sites/m.veryhuo.com/components/mip-veryhuo-comment/index.less new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-comment/index.less @@ -0,0 +1 @@ + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js new file mode 100644 index 000000000..a2442282a --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js @@ -0,0 +1,384 @@ +/** + * @file 评论模块 + * @author fl + */ + +const { CustomElement, util } = MIP +const { css } = util + +export default class MIPMpc6Comment extends CustomElement { + build () { + let bnum = 0 + let nnum = 0 + let PageType = 'asp' + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] + let cSOHUCS = this.element.querySelectorAll('#SOHUCS') + if (cSOHUCS.length > 0) { + if (cSOHUCS[0].attributes['PageType'].value !== undefined) { + PageType = cSOHUCS[0].attributes['PageType'].value + } + } + let oDiv = this.element.querySelectorAll('.SearchBox')[0] + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] + let sear = this.element.querySelectorAll('.searchDiv input') + let cnav = this.element.querySelectorAll('nav')[0] + let mclassify = this.element.querySelectorAll('#mclassify')[0] + let pullNav = this.element.querySelectorAll('#nav .pullNav') + let moreNav = this.element.querySelectorAll('#nav .moreNav') + let cmslass = this.element.querySelectorAll('#mclassifyCont p span') + let cul = this.element.querySelectorAll('#mclassifyCont ul') + let fixNav = this.element.querySelector('.fixNav') + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] + let ztheader = this.element.querySelectorAll('.ztheader') + let hClass = this.element.querySelectorAll('.ztheader .hClass') + let hKeyList = this.element.querySelectorAll('.ztheader .hKeyList')[0] + let cKeyList = this.element.querySelectorAll('.hKeyList')[0] + let cp = this.element.querySelectorAll('.hKeyList p')[0] + let cimg = this.element.querySelectorAll('.ztheader img')[0] + let ctent = this.element.querySelectorAll('.ztheader .hContent')[0] + let dContNavTab = this.element.querySelectorAll('.DContNavTab li') + let cwrapper = this.element.querySelector('#wrapper') + let lDSContent = this.element.querySelector('.DSContent') + let cDSContent = this.element.querySelector('#DSContent') + let cdescript = this.element.querySelector('#descript') + let lhqCTitle = this.element.querySelectorAll('.hqCTitle') + let ljptjApp = this.element.querySelectorAll('.jptjApp') + let loryverbox = this.element.querySelectorAll('.oryverbox') + let cJPContent = this.element.querySelector('#JPContent') + if (lDSContent !== null) { + if (lDSContent.offsetHeight > 310) { + css(lDSContent, {height: 310}) + css(cDSContent, {display: 'block'}) + } else { + css(cDSContent, {display: 'none'}) + } + } + let coryverlist = this.element.querySelectorAll('.oryverlist')[0] + let cBContent = this.element.querySelectorAll('#BBContent')[0] + if (loryverbox.length > 0) { + let dbp = this.element.querySelectorAll('.oryverlist p').length + if (dbp > 3 && dbp !== 0) { + css(coryverlist, {height: 152}) + css(cBContent, {display: 'block'}) + } else { + css(cBContent, {display: 'none'}) + } + } + let xgtjheight = this.element.querySelectorAll('.xgtj .xgtjlist li') + let cxgtj = this.element.querySelectorAll('.xgtj .xgtjlist')[0] + let cxgtjlist = this.element.querySelectorAll('#xgtjlist')[0] + if (xgtjheight.length > 10) { + css(cxgtj, {height: 810}) + css(cxgtjlist, {display: 'block'}) + } else { + css(cxgtj, {height: 'auto'}) + } + let cmation = this.element.querySelectorAll('.mation .xgwzlist li') + let cxgwzlist = this.element.querySelectorAll('.mation .xgwzlist') + let cxgwzgd = this.element.querySelectorAll('#xgwzlist') + let lxgtj = this.element.querySelectorAll('.xgtjlist')[0] + let lxgwzlist = this.element.querySelectorAll('.xgwzlist') + if (cmation.length > 10) { + css(cxgwzlist[0], {height: 400}) + css(cxgwzgd[0], {display: 'block'}) + } else { + css(cxgwzlist[0], {height: 'auto'}) + } + function trim (s) { + return s.replace(/(^\s*)|(\s*$)/g, '') + } + let lookmore = this.element.querySelectorAll('.lookmore') + let li = this.element.querySelectorAll('.CRCSTitleC li.tab-item') + let cguessCont = this.element.querySelectorAll('.guessCont') + let cplbutton = this.element.querySelectorAll('.plbutton') + let cpltext = this.element.querySelectorAll('#pltext')[0] + let cancel = this.element.querySelectorAll('.cancel')[0] + css(cplbutton[0], {display: 'none'}) + css(cplbutton[1], {display: 'none'}) + let tjbutton = this.element.querySelectorAll('.tjbutton')[0] + let calertmes = this.element.querySelectorAll('#alertmes')[0] + let yzm = this.element.querySelectorAll('.yzm')[0] + let hContent = this.element.querySelectorAll('.ztheader .hContent') + let cContent = this.element.querySelectorAll('.hClassCont,.hClassContDiv') + let sBBtn = this.element.querySelectorAll('.SBBtn') + let cinput = this.element.querySelectorAll('.SBInp input') + window.addEventListener('scroll', function () { + if (document.documentElement.scrollTop > 80) { + css(fixNav, {display: 'block'}) + } else { + css(fixNav, {display: 'none'}) + } + if (document.documentElement.scrollTop > 300) { + css(cbacktop, {display: 'block'}) + } else { + css(cbacktop, {display: 'none'}) + } + if (ztheader.length > 0) { + if (document.documentElement.scrollTop > 150) { + css(hClass, {top: 10, position: 'fixed'}) + css(hKeyList, {top: 45, position: 'fixed'}) + } else { + css(hClass, {top: 120, position: 'absolute'}) + css(hKeyList, {top: 195, position: 'absolute'}) + } + if (document.documentElement.scrollTop > 180) { + css(cKeyList, {position: 'fixed', height: 90, top: 0, 'border-bottom': '1px dashed #ccc'}) + css(cp, {position: 'relative', top: 48}) + css(cimg, {display: 'none'}) + css(ctent, {display: 'none'}) + } else { + css(cKeyList, {position: 'relative', top: 195, height: 45, 'border-bottom': '0px dashed #ccc'}) + css(cp, {position: 'relative', top: 0}) + css(cimg, {display: 'block'}) + css(ctent, {display: 'block'}) + } + } + }) + cbacktop.onclick = function () { + document.documentElement.scrollTop = 0 + } + if (hContent.length > 0) { + for (let i = 0; i < hContent.length; i++) { + hContent[i].onclick = function () { + css(cContent[0], {display: 'block'}) + css(cContent[1], {display: 'block'}) + } + } + } + cContent[1].onclick = function () { + css(cContent[0], {display: 'none'}) + css(cContent[1], {display: 'none'}) + } + if (hClass.length > 0) { + hClass[0].onclick = function () { + css(cContent[0], {display: 'block'}) + css(cContent[1], {display: 'block'}) + } + } + if (ztheader.length === 0) { + oDiv.onclick = function () { + if (bnum === 0) { + css(mclassifyCont, {display: 'none'}) + css(csearchDiv, {display: 'block'}) + if (sear.length > 0) { + sear[0].focus() + } + bnum = 1 + nnum = 0 + } else { + if (nnum === 1) { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } else { + css(cnav, {height: 40}) + css(csearchDiv, {display: 'none'}) + bnum = 0 + } + } + } + for (let i = 0; i < cmslass.length; i++) { + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + cmslass[i].index = i + } + } + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } + } + } + for (let i = 0; i < dContNavTab.length; i++) { + dContNavTab[i].onclick = function () { + dContNavTab[i].index = i + if (this.index === 0) { + dContNavTab[0].className = 'm-hover' + css(cwrapper, {display: 'block'}) + css(lDSContent, {display: 'block'}) + css(cDSContent, {display: 'block'}) + css(cdescript, {display: 'block'}) + if (lhqCTitle.length > 0) { + css(lhqCTitle[0], {display: 'block'}) + } + css(ljptjApp[0], {display: 'block'}) + css(ljptjApp[1], {display: 'block'}) + if (loryverbox.length > 0) { + css(loryverbox, {display: 'block'}) + } + css(cJPContent, {display: 'block'}) + } else { + dContNavTab[0].className = '' + } + if (this.index === 1) { + dContNavTab[1].className = 'm-hover' + css(cwrapper, {display: 'none'}) + css(lDSContent, {display: 'none'}) + css(cDSContent, {display: 'none'}) + css(cdescript, {display: 'block'}) + if (lhqCTitle.length > 0) { + css(lhqCTitle[0], {display: 'block'}) + } + css(ljptjApp[0], {display: 'block'}) + css(ljptjApp[1], {display: 'block'}) + if (loryverbox.length > 0) { + css(loryverbox, {display: 'block'}) + } + css(cJPContent, {display: 'block'}) + } else { + dContNavTab[1].className = '' + } + if (this.index === 2) { + dContNavTab[2].className = 'm-hover' + css(cwrapper, {display: 'none'}) + css(lDSContent, {display: 'none'}) + css(cDSContent, {display: 'none'}) + css(cdescript, {display: 'none'}) + if (lhqCTitle.length > 0) { + css(lhqCTitle[0], {display: 'none'}) + } + css(ljptjApp[0], {display: 'none'}) + css(ljptjApp[1], {display: 'none'}) + if (loryverbox.length > 0) { + css(loryverbox, {display: 'none'}) + } + css(cJPContent, {display: 'none'}) + } else { + dContNavTab[2].className = '' + } + } + } + for (let i = 0; i < lookmore.length; i++) { + lookmore[i].onclick = function () { + let btnText = trim(lookmore[i].innerText) + if (btnText === '展开全部内容') { + css(lDSContent, {height: '100%'}) + cDSContent.innerHTML = '收起内容' + } + if (btnText === '收起内容') { + css(lDSContent, {height: 315}) + cDSContent.innerHTML = '展开全部内容' + } + if (btnText === '更多其它版本') { + css(coryverlist, {height: 'auto'}) + cBContent.innerHTML = '收起其它版本' + } + if (btnText === '收起其它版本') { + css(coryverlist, {height: 152}) + cBContent.innerHTML = '更多其它版本' + } + if (btnText === '点击查看更多') { + css(lxgtj, {height: 'auto'}) + cxgtjlist.innerHTML = '收起相关软件' + } + if (btnText === '收起相关软件') { + css(lxgtj, {height: 810}) + cxgtjlist.innerHTML = '点击查看更多' + } + if (lxgwzlist.length > 0) { + if (btnText === '查看更多资讯') { + css(lxgwzlist[0], {height: 'auto'}) + cxgwzgd[0].innerHTML = '收起相关资讯' + } + if (btnText === '收起相关资讯') { + css(lxgwzlist[0], {height: 400}) + cxgwzgd[0].innerHTML = '查看更多资讯' + } + } + } + } + for (let i = 0; i < li.length; i++) { + li[i].onclick = function () { + let numm = li[i].attributes['did'].value + if (Number(numm) === 0) { + li[0].className = '' + css(cguessCont[0], {display: 'block'}) + } else { + li[0].className = 'tab-item cur' + css(cguessCont[0], {display: 'none'}) + } + if (Number(numm) === 1) { + li[1].className = '' + css(cguessCont[1], {display: 'block'}) + } else { + li[1].className = 'tab-item cur' + css(cguessCont[1], {display: 'none'}) + } + } + } + cpltext.onclick = function () { + css(cplbutton[0], { display: 'block' }) + css(cplbutton[1], { display: '' }) + } + cancel.onclick = function () { + css(cplbutton[0], { display: 'none' }) + css(cplbutton[1], { display: 'none' }) + } + tjbutton.onclick = function () { + let msg = cpltext.value + let temsoftid = cSOHUCS[0].attributes['sid'].value + if (msg.length < 3 || msg.lenght > 200) { + calertmes.innerHTML = '评论的内容不能小于3或大于200个字符!' + css(cContent[0], {display: 'block'}) + css(cContent[1], {display: 'block'}) + cpltext.focus() + return false + } + let imgcode = yzm.value + if (imgcode === '') { + calertmes.innerHTML = '请输入验证码!' + css(cContent[0], {display: 'block'}) + css(cContent[1], {display: 'block'}) + yzm.focus() + return false + } + fetch('/postfrm_ajax.' + PageType + '?comment=' + msg + '&softid=' + temsoftid + '&pImgCode=' + imgcode).then(function (res) { + return res.text() + }).then(function (text) { + let text1 = text.slice(0, 4) + let text2 = text.slice(0, 2) + cpltext.focus() + cpltext.attributes['placeholder'].value = '' + calertmes.innerHTML = '你的评论发表成功,需要审核才能显示!' + css(cContent[0], {display: 'block'}) + css(cContent[1], {display: 'block'}) + }) + } + sBBtn[0].onclick = function () { + let sV = cinput[0].value + if (sV.length < 2) { + calertmes.innerHTML = '请输入搜索词!' + css(cContent[0], {display: 'block'}) + css(cContent[1], {display: 'block'}) + return false + } + let forpath = '/search.' + PageType + '?wd=' + encodeURI(sV) + MIP.viewer.open(forpath) + } + mclassify.onclick = function () { + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}) + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') + } + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) + } + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } + } + } + } +} diff --git a/sites/m.veryhuo.com/example/index.html b/sites/m.veryhuo.com/example/index.html new file mode 100644 index 000000000..6307533db --- /dev/null +++ b/sites/m.veryhuo.com/example/index.html @@ -0,0 +1,18 @@ + + + + + + MIP page + + + + + + + + + + diff --git a/sites/m.veryhuo.com/mip.config.js b/sites/m.veryhuo.com/mip.config.js new file mode 100644 index 000000000..d5457bef4 --- /dev/null +++ b/sites/m.veryhuo.com/mip.config.js @@ -0,0 +1,31 @@ +/** + * @file mip页面项目配置项 + * @author + */ + +module.exports = { + dev: { + /** + * 启动mip server调试的端口号 + * + * @type {number} + */ + port: 8111, + + /** + * 启用调试页面自动刷新 + * + * @type {boolean} + */ + livereload: true, + + /** + * server 启动自动打开页面,false 为关闭 + * 如: + * autoopen: '/example/index.html' + * + * @type {string|boolean} + */ + autoopen: false + } +} diff --git a/sites/m.veryhuo.com/package.json b/sites/m.veryhuo.com/package.json new file mode 100644 index 000000000..f932e92bb --- /dev/null +++ b/sites/m.veryhuo.com/package.json @@ -0,0 +1,25 @@ +{ + "name": "m.veryhuo.com", + "version": "0.0.1", + "description": "mip2 for m.veryhuo.com", + "scripts": { + "dev": "mip2 dev", + "build": "mip2 build", + "lint": "npm run lint:js", + "lint:js": "eslint --ext .vue,.js .", + "fix": "npm run fix:js", + "fix:js": "eslint --ext .vue,.js . --fix" + }, + "author": "veryhuo", + "dependencies": {}, + "devDependencies": { + "eslint": "^4.19.1", + "eslint-config-standard": "^11.0.0", + "eslint-plugin-import": "^2.12.0", + "eslint-plugin-jsdoc": "^3.7.1", + "eslint-plugin-node": "^6.0.1", + "eslint-plugin-promise": "^3.8.0", + "eslint-plugin-standard": "^3.1.0", + "eslint-plugin-vue": "^4.5.0" + } +} diff --git a/sites/m.veryhuo.com/static/.gitkeep b/sites/m.veryhuo.com/static/.gitkeep new file mode 100644 index 000000000..e69de29bb From a98da545c163be761f9ad41cb409cea3b47444fd Mon Sep 17 00:00:00 2001 From: liukaidi <2379942411@qq.com> Date: Wed, 24 Jul 2019 15:12:11 +0800 Subject: [PATCH 02/34] =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mip-veryhuo-comment/mip-veryhuo-comment.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js index a2442282a..d40018d3e 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js @@ -344,8 +344,6 @@ export default class MIPMpc6Comment extends CustomElement { fetch('/postfrm_ajax.' + PageType + '?comment=' + msg + '&softid=' + temsoftid + '&pImgCode=' + imgcode).then(function (res) { return res.text() }).then(function (text) { - let text1 = text.slice(0, 4) - let text2 = text.slice(0, 2) cpltext.focus() cpltext.attributes['placeholder'].value = '' calertmes.innerHTML = '你的评论发表成功,需要审核才能显示!' From 58daf07f95fca18f1820ebb87c0102958180f4a6 Mon Sep 17 00:00:00 2001 From: liukaidi <2379942411@qq.com> Date: Fri, 9 Aug 2019 10:48:56 +0800 Subject: [PATCH 03/34] =?UTF-8?q?=E6=96=B0=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mip-veryhuo-index/README.md | 31 ++++ .../mip-veryhuo-index/example/index.html | 18 +++ .../components/mip-veryhuo-index/index.less | 1 + .../mip-veryhuo-index/mip-veryhuo-index.js | 132 +++++++++++++++++ .../components/mip-veryhuo-notfound/README.md | 31 ++++ .../mip-veryhuo-notfound/example/index.html | 18 +++ .../mip-veryhuo-notfound/index.less | 1 + .../mip-veryhuo-notfound.js | 11 ++ .../components/mip-veryhuo-rank/README.md | 31 ++++ .../mip-veryhuo-rank/example/index.html | 18 +++ .../components/mip-veryhuo-rank/index.less | 1 + .../mip-veryhuo-rank/mip-veryhuo-rank.js | 133 +++++++++++++++++ .../components/mip-veryhuo-special/README.md | 31 ++++ .../mip-veryhuo-special/example/index.html | 18 +++ .../components/mip-veryhuo-special/index.less | 1 + .../mip-veryhuo-special.js | 136 +++++++++++++++++ .../components/mip-veryhuo-zx/README.md | 31 ++++ .../mip-veryhuo-zx/example/index.html | 18 +++ .../components/mip-veryhuo-zx/index.less | 1 + .../mip-veryhuo-zx/mip-veryhuo-zx.js | 139 ++++++++++++++++++ 20 files changed, 801 insertions(+) create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-index/README.md create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-index/example/index.html create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-index/index.less create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-notfound/README.md create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-notfound/example/index.html create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-notfound/index.less create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-rank/README.md create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-rank/example/index.html create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-rank/index.less create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-special/README.md create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-special/example/index.html create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-special/index.less create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-zx/README.md create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-zx/example/index.html create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-zx/index.less create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-index/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-index/README.md new file mode 100644 index 000000000..163f0923b --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-index/README.md @@ -0,0 +1,31 @@ +# mip-veryhuo-index + +移动端样式、逻辑 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive, fixed-height, fill, container, fixed +所需脚本| [https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-index/mip-veryhuo-index.js](https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-index/mip-veryhuo-index.js) + +## 示例 + +### 基本使用 + +```html + +``` + +## 属性 + +### url + +说明:本站点网址 + +必选项:是 + +类型:字符串 + +取值范围:URL + +默认值:无 \ No newline at end of file diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-index/example/index.html b/sites/m.veryhuo.com/components/mip-veryhuo-index/example/index.html new file mode 100644 index 000000000..6e6bf41df --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-index/example/index.html @@ -0,0 +1,18 @@ + + + + + + MIP page + + + + + + + + + + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-index/index.less b/sites/m.veryhuo.com/components/mip-veryhuo-index/index.less new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-index/index.less @@ -0,0 +1 @@ + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js new file mode 100644 index 000000000..d7219c290 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js @@ -0,0 +1,132 @@ +/** + * @file 评论模块 + * @author fl + */ +const { CustomElement, util } = MIP +const { css } = util + +export default class MIPMhotComment extends CustomElement { + build () { + let bnum = 0 + let nnum = 0 + let PageType = 'asp' + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] // 隐藏的分类盒子 + let ztheader = this.element.querySelectorAll('.ztheader') + let cSOHUCS = this.element.querySelectorAll('#SOHUCS') + if (cSOHUCS.length > 0) { + if (cSOHUCS[0].attributes['PageType'].value !== undefined) { + PageType = cSOHUCS[0].attributes['PageType'].value + } + } + let oDiv = this.element.querySelectorAll('.SearchBox')[0] // 搜索按钮盒子 + let searBtn = this.element.querySelectorAll('.SBBtn button')[0] // 搜索按钮 + let searInp = this.element.querySelectorAll('.SBInp input')[0] // 搜索框 + let alert = this.element.querySelectorAll('#confirm')[0] //input 提示框 + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] // 隐藏的搜索框盒子 + let sear = this.element.querySelectorAll('.searchDiv input') // 隐藏的搜索框 + let cnav = this.element.querySelectorAll('nav')[0] // 导航盒子 + let mclassify = this.element.querySelectorAll('#mclassify')[0] // 顶部分类按钮 + let pullNav = this.element.querySelectorAll('#nav .pullNav') + let moreNav = this.element.querySelectorAll('#nav .moreNav') + let cmslass = this.element.querySelectorAll('#mclassifyCont p span') // 分类tab标题 + let cul = this.element.querySelectorAll('#mclassifyCont ul') // 顶部分类盒子 + let fixNav = this.element.querySelector('.fixNav') // 吸顶盒子 + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] // 回到顶部按钮 + let lookmore = this.element.querySelectorAll('.lookmore') // 查看更多按钮 + let li = this.element.querySelectorAll('.CRCSTitleC li.tab-item') + let zxNav = this.element.querySelector('#zxNav'); + + searBtn.onclick = function() { + if(oDiv.length === 0) { + css(alert, {display:'block'}); + }else { + css(alert, {display:'none'}); + } + } + window.addEventListener('scroll', function () { + // 页面滚动一定高度时,显示吸顶导航盒子 + if (document.documentElement.scrollTop > 80) { + css(fixNav, {display: 'block'}) + css(zxNav, {display: 'none'}) + } else if(document.documentElement.scrollTop < 30) { + css(fixNav, {display: 'none'}) + css(zxNav, {display: 'block'}) + } + // 页面滚动一定高度时,显示回到顶部按钮 + if (document.documentElement.scrollTop > 300) { + css(cbacktop, {display: 'block'}) + } else { + css(cbacktop, {display: 'none'}) + } + + }) + // 点击回到顶部按钮 + cbacktop.onclick = function () { + document.documentElement.scrollTop = 0 + }; + + if (ztheader.length === 0) { + // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 + oDiv.onclick = function () { + if (bnum === 0) { + css(mclassifyCont, {display: 'none'}) + css(csearchDiv, {display: 'block'}) + if (sear.length > 0) { + sear[0].focus() + } + bnum = 1 + nnum = 0 + } else { + if (nnum === 1) { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } else { + css(cnav, {height: 40}) + css(csearchDiv, {display: 'none'}) + bnum = 0 + } + } + } + // 给隐藏的分类 tab 标题添加类样式 + for (let i = 0; i < cmslass.length; i++) { + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + cmslass[i].index = i + } + } + // 点击隐藏的分类 tab 标题切换ul列表数据 + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } + } + } + // 点击顶部分类按钮 + mclassify.onclick = function () { + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}) + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') + } + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) + } + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } + } + } + } +} diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-notfound/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/README.md new file mode 100644 index 000000000..3df692803 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/README.md @@ -0,0 +1,31 @@ +# mip-veryhuo-notfound + +移动端样式、逻辑 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive, fixed-height, fill, container, fixed +所需脚本| [https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-notfound/mip-veryhuo-notfound.js](https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-notfound/mip-veryhuo-notfound.js) + +## 示例 + +### 基本使用 + +```html + +``` + +## 属性 + +### url + +说明:本站点网址 + +必选项:是 + +类型:字符串 + +取值范围:URL + +默认值:无 \ No newline at end of file diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-notfound/example/index.html b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/example/index.html new file mode 100644 index 000000000..c8af47a39 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/example/index.html @@ -0,0 +1,18 @@ + + + + + + MIP page + + + + + + + + + + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-notfound/index.less b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/index.less new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/index.less @@ -0,0 +1 @@ + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js new file mode 100644 index 000000000..bcf1a48ed --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js @@ -0,0 +1,11 @@ +const { CustomElement, util } = MIP +const { css } = util + +export default class MIPMhotComment extends CustomElement { + build() { + let goHome = this.element.querySelectorAll('.go-home')[0]; // 隐藏的分类盒子 + goHome.onclick = function() { + location.href = './index.html'; + } + } +} \ No newline at end of file diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-rank/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-rank/README.md new file mode 100644 index 000000000..3e1488ddd --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-rank/README.md @@ -0,0 +1,31 @@ +# mip-veryhuo-rank + +移动端样式、逻辑 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive, fixed-height, fill, container, fixed +所需脚本| [https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-rank/mip-veryhuo-rank.js](https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-rank/mip-veryhuo-rank.js) + +## 示例 + +### 基本使用 + +```html + +``` + +## 属性 + +### url + +说明:本站点网址 + +必选项:是 + +类型:字符串 + +取值范围:URL + +默认值:无 \ No newline at end of file diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-rank/example/index.html b/sites/m.veryhuo.com/components/mip-veryhuo-rank/example/index.html new file mode 100644 index 000000000..2052af3e4 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-rank/example/index.html @@ -0,0 +1,18 @@ + + + + + + MIP page + + + + + + + + + + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-rank/index.less b/sites/m.veryhuo.com/components/mip-veryhuo-rank/index.less new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-rank/index.less @@ -0,0 +1 @@ + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js b/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js new file mode 100644 index 000000000..ca3cc26c6 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js @@ -0,0 +1,133 @@ +const { CustomElement, util } = MIP +const { css } = util + +export default class MIPMhotComment extends CustomElement { + build() { + let bnum = 0 + let nnum = 0 + let PageType = 'asp' + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] // 隐藏的分类盒子 + let ztheader = this.element.querySelectorAll('.ztheader') + let cSOHUCS = this.element.querySelectorAll('#SOHUCS') + if (cSOHUCS.length > 0) { + if (cSOHUCS[0].attributes['PageType'].value !== undefined) { + PageType = cSOHUCS[0].attributes['PageType'].value + } + } + let oDiv = this.element.querySelectorAll('.SearchBox')[0] // 搜索按钮盒子 + let searBtn = this.element.querySelectorAll('.SBBtn button')[0] // 搜索按钮 + let searInp = this.element.querySelectorAll('.SBInp input')[0] // 搜索框 + // let alert = this.element.querySelectorAll('#confirm')[0] //input 提示框 + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] // 隐藏的搜索框盒子 + let sear = this.element.querySelectorAll('.searchDiv input') // 隐藏的搜索框 + let cnav = this.element.querySelectorAll('nav')[0] // 导航盒子 + let mclassify = this.element.querySelectorAll('#mclassify')[0] // 顶部分类按钮 + let pullNav = this.element.querySelectorAll('#nav .pullNav') + let moreNav = this.element.querySelectorAll('#nav .moreNav') + let cmslass = this.element.querySelectorAll('#mclassifyCont p span') // 分类tab标题 + let cul = this.element.querySelectorAll('#mclassifyCont ul') // 顶部分类盒子 + let fixNav = this.element.querySelector('.fixNav') // 吸顶盒子 + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] // 回到顶部按钮 + let lookmore = this.element.querySelectorAll('.lookmore') // 查看更多按钮 + let li = this.element.querySelectorAll('.CRCSTitleC li.tab-item') + + + window.addEventListener('scroll', function () { + // 页面滚动一定高度时,显示吸顶导航盒子 + if (document.documentElement.scrollTop > 80) { + css(fixNav, {display: 'block'}) + } else { + css(fixNav, {display: 'none'}) + } + // 页面滚动一定高度时,显示回到顶部按钮 + if (document.documentElement.scrollTop > 300) { + css(cbacktop, {display: 'block'}) + } else { + css(cbacktop, {display: 'none'}) + } + + }) + // 点击回到顶部按钮 + cbacktop.onclick = function () { + document.documentElement.scrollTop = 0 + }; + // 分类内容 + if (ztheader.length === 0) { + // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 + oDiv.onclick = function () { + if (bnum === 0) { + css(mclassifyCont, {display: 'none'}) + css(csearchDiv, {display: 'block'}) + if (sear.length > 0) { + sear[0].focus() + } + bnum = 1 + nnum = 0 + } else { + if (nnum === 1) { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } else { + css(cnav, {height: 40}) + css(csearchDiv, {display: 'none'}) + bnum = 0 + } + } + } + // 给隐藏的分类 tab 标题添加类样式 + for (let i = 0; i < cmslass.length; i++) { + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + cmslass[i].index = i + } + } + // 点击隐藏的分类 tab 标题切换ul列表数据 + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } + } + } + // 点击顶部分类按钮 + mclassify.onclick = function () { + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}) + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') + } + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) + } + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } + } + } + // 点击排行页的 箭头,实现显示隐藏功能 + let zk = this.element.querySelector('.zk'); // 下箭头 + let sq = this.element.querySelector('.sq'); // 上箭头 + let rankA = this.element.querySelectorAll('.topnav a'); // 所有标题 + let hides = this.element.querySelectorAll('.isHide'); + zk.onclick = function () { + css(rankA, {display: 'block'}); + css(zk, {display: 'none'}); + }; + sq.onclick = function () { + css(hides, {display: 'none'}); + css(sq, {display: 'none'}); + css(zk, {display: 'block'}); + } + } +} \ No newline at end of file diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-special/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-special/README.md new file mode 100644 index 000000000..fd8d4b71d --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-special/README.md @@ -0,0 +1,31 @@ +# mip-veryhuo-special + +移动端样式、逻辑 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive, fixed-height, fill, container, fixed +所需脚本| [https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-special/mip-veryhuo-special.js](https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-special/mip-veryhuo-special.js) + +## 示例 + +### 基本使用 + +```html + +``` + +## 属性 + +### url + +说明:本站点网址 + +必选项:是 + +类型:字符串 + +取值范围:URL + +默认值:无 \ No newline at end of file diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-special/example/index.html b/sites/m.veryhuo.com/components/mip-veryhuo-special/example/index.html new file mode 100644 index 000000000..39f5b5fb7 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-special/example/index.html @@ -0,0 +1,18 @@ + + + + + + MIP page + + + + + + + + + + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-special/index.less b/sites/m.veryhuo.com/components/mip-veryhuo-special/index.less new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-special/index.less @@ -0,0 +1 @@ + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js b/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js new file mode 100644 index 000000000..5168139bc --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js @@ -0,0 +1,136 @@ +/** + * @file 评论模块 + * @author fl + */ +const { CustomElement, util } = MIP +const { css } = util + +export default class MIPMhotComment extends CustomElement { + build () { + let bnum = 0 + let nnum = 0 + let PageType = 'asp' + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] // 隐藏的分类盒子 + let ztheader = this.element.querySelectorAll('.ztheader') + let cSOHUCS = this.element.querySelectorAll('#SOHUCS') + if (cSOHUCS.length > 0) { + if (cSOHUCS[0].attributes['PageType'].value !== undefined) { + PageType = cSOHUCS[0].attributes['PageType'].value + } + } + let oDiv = this.element.querySelectorAll('.SearchBox')[0] // 搜索按钮盒子 + let searBtn = this.element.querySelectorAll('.SBBtn button')[0] // 搜索按钮 + let searInp = this.element.querySelectorAll('.SBInp input')[0] // 搜索框 + // let alert = this.element.querySelectorAll('#confirm')[0] //input 提示框 + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] // 隐藏的搜索框盒子 + let sear = this.element.querySelectorAll('.searchDiv input') // 隐藏的搜索框 + let cnav = this.element.querySelectorAll('nav')[0] // 导航盒子 + let mclassify = this.element.querySelectorAll('#mclassify')[0] // 顶部分类按钮 + let pullNav = this.element.querySelectorAll('#nav .pullNav') + let moreNav = this.element.querySelectorAll('#nav .moreNav') + let cmslass = this.element.querySelectorAll('#mclassifyCont p span') // 分类tab标题 + let cul = this.element.querySelectorAll('#mclassifyCont ul') // 顶部分类盒子 + let fixNav = this.element.querySelector('.fixNav') // 吸顶盒子 + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] // 回到顶部按钮 + let lookmore = this.element.querySelectorAll('.lookmore') // 查看更多按钮 + let li = this.element.querySelectorAll('.CRCSTitleC li.tab-item') + + window.addEventListener('scroll', function () { + // 页面滚动一定高度时,显示吸顶导航盒子 + if (document.documentElement.scrollTop > 80) { + css(fixNav, {display: 'block'}) + } else { + css(fixNav, {display: 'none'}) + } + // 页面滚动一定高度时,显示回到顶部按钮 + if (document.documentElement.scrollTop > 300) { + css(cbacktop, {display: 'block'}) + } else { + css(cbacktop, {display: 'none'}) + } + + }) + // 点击回到顶部按钮 + cbacktop.onclick = function () { + document.documentElement.scrollTop = 0 + }; + + if (ztheader.length === 0) { + // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 + oDiv.onclick = function () { + if (bnum === 0) { + css(mclassifyCont, {display: 'none'}) + css(csearchDiv, {display: 'block'}) + if (sear.length > 0) { + sear[0].focus() + } + bnum = 1 + nnum = 0 + } else { + if (nnum === 1) { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } else { + css(cnav, {height: 40}) + css(csearchDiv, {display: 'none'}) + bnum = 0 + } + } + } + // 给隐藏的分类 tab 标题添加类样式 + for (let i = 0; i < cmslass.length; i++) { + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + cmslass[i].index = i + } + } + // 点击隐藏的分类 tab 标题切换ul列表数据 + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } + } + } + // 点击顶部分类按钮 + mclassify.onclick = function () { + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}) + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') + } + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) + } + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } + } + } + + let lis = this.element.querySelectorAll('.hqnav i'); // 专题页 tab切换标题 + let uls = this.element.querySelectorAll('.speContent ul'); // 专题ul内容 + for (let i = 0; i < lis.length; i++) { + lis[i].id = i; + lis[i].onclick = function () { + for (let j = 0; j < lis.length; j++) { + lis[j].className = ''; + uls[j].style.display = 'none'; + } + this.className = 'cur'; //点击哪个按钮就哪个按钮加active类 + uls[this.id].style.display = 'block'; + } + } + } +} diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-zx/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-zx/README.md new file mode 100644 index 000000000..72dcee60c --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-zx/README.md @@ -0,0 +1,31 @@ +# mip-veryhuo-zx + +移动端样式、逻辑 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive, fixed-height, fill, container, fixed +所需脚本| [https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-zx/mip-veryhuo-zx.js](https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-zx/mip-veryhuo-zx.js) + +## 示例 + +### 基本使用 + +```html + +``` + +## 属性 + +### url + +说明:本站点网址 + +必选项:是 + +类型:字符串 + +取值范围:URL + +默认值:无 \ No newline at end of file diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-zx/example/index.html b/sites/m.veryhuo.com/components/mip-veryhuo-zx/example/index.html new file mode 100644 index 000000000..0a9834b26 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-zx/example/index.html @@ -0,0 +1,18 @@ + + + + + + MIP page + + + + + + + + + + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-zx/index.less b/sites/m.veryhuo.com/components/mip-veryhuo-zx/index.less new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-zx/index.less @@ -0,0 +1 @@ + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js b/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js new file mode 100644 index 000000000..ae9e88304 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js @@ -0,0 +1,139 @@ +/** + * @file 评论模块 + * @author fl + */ +const { CustomElement, util } = MIP +const { css } = util + +export default class MIPMhotComment extends CustomElement { + build () { + let bnum = 0 + let nnum = 0 + let PageType = 'asp' + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] // 隐藏的分类盒子 + let ztheader = this.element.querySelectorAll('.ztheader') + let cSOHUCS = this.element.querySelectorAll('#SOHUCS') + if (cSOHUCS.length > 0) { + if (cSOHUCS[0].attributes['PageType'].value !== undefined) { + PageType = cSOHUCS[0].attributes['PageType'].value + } + } + let oDiv = this.element.querySelectorAll('.SearchBox')[0] // 搜索按钮盒子 + let searBtn = this.element.querySelectorAll('.SBBtn button')[0] // 搜索按钮 + let searInp = this.element.querySelectorAll('.SBInp input')[0] // 搜索框 + // let alert = this.element.querySelectorAll('#confirm')[0] //input 提示框 + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] // 隐藏的搜索框盒子 + let sear = this.element.querySelectorAll('.searchDiv input') // 隐藏的搜索框 + let cnav = this.element.querySelectorAll('nav')[0] // 导航盒子 + let mclassify = this.element.querySelectorAll('#mclassify')[0] // 顶部分类按钮 + let pullNav = this.element.querySelectorAll('#nav .pullNav') + let moreNav = this.element.querySelectorAll('#nav .moreNav') + let cmslass = this.element.querySelectorAll('#mclassifyCont p span') // 分类tab标题 + let cul = this.element.querySelectorAll('#mclassifyCont ul') // 顶部分类盒子 + let fixNav = this.element.querySelector('.fixNav') // 吸顶盒子 + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] // 回到顶部按钮 + let lookmore = this.element.querySelectorAll('.lookmore') // 查看更多按钮 + let li = this.element.querySelectorAll('.CRCSTitleC li.tab-item') + let zxNav = this.element.querySelector('#zxNav'); + + window.addEventListener('scroll', function () { + // 页面滚动一定高度时,显示吸顶导航盒子 + if (document.documentElement.scrollTop > 80) { + css(fixNav, {display: 'block'}) + css(zxNav, {display: 'none'}) + } else if(document.documentElement.scrollTop < 30) { + css(fixNav, {display: 'none'}) + css(zxNav, {display: 'block'}) + } + // 页面滚动一定高度时,显示回到顶部按钮 + if (document.documentElement.scrollTop > 300) { + css(cbacktop, {display: 'block'}) + } else { + css(cbacktop, {display: 'none'}) + } + + }) + // 点击回到顶部按钮 + cbacktop.onclick = function () { + document.documentElement.scrollTop = 0 + }; + + if (ztheader.length === 0) { + // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 + oDiv.onclick = function () { + if (bnum === 0) { + css(mclassifyCont, {display: 'none'}) + css(csearchDiv, {display: 'block'}) + if (sear.length > 0) { + sear[0].focus() + } + bnum = 1 + nnum = 0 + } else { + if (nnum === 1) { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } else { + css(cnav, {height: 40}) + css(csearchDiv, {display: 'none'}) + bnum = 0 + } + } + } + // 给隐藏的分类 tab 标题添加类样式 + for (let i = 0; i < cmslass.length; i++) { + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + cmslass[i].index = i + } + } + // 点击隐藏的分类 tab 标题切换ul列表数据 + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } + } + } + // 点击顶部分类按钮 + mclassify.onclick = function () { + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}) + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') + } + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) + } + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } + } + } + + let zxAs = this.element.querySelectorAll('#zxnav-tit a'); // 获取资讯标题 + let open = this.element.querySelector('.open'); // 展开按钮 + let close = this.element.querySelector('.close'); // 关闭按钮 + let aTit = this.element.querySelectorAll('.aTit'); + open.onclick = function () { + css(zxAs, {display: 'block'}); + css(open, {display: 'none'}); + }; + close.onclick = function () { + css(aTit, {display: 'none'}); + css(close, {display: 'none'}); + css(open, {display: 'block'}); + } + } +} From 38d7a61d84954b317545a515de65581684225c58 Mon Sep 17 00:00:00 2001 From: liukaidi <2379942411@qq.com> Date: Mon, 12 Aug 2019 15:27:11 +0800 Subject: [PATCH 04/34] =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E6=B7=BB=E5=8A=A0=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mip-veryhuo-androidsoft/README.md | 31 ++ .../example/index.html | 18 + .../mip-veryhuo-androidsoft/index.less | 1 + .../mip-veryhuo-androidsoft.js | 244 ++++++++++++ .../mip-veryhuo-azyy-azyx/README.md | 31 ++ .../mip-veryhuo-azyy-azyx/example/index.html | 18 + .../mip-veryhuo-azyy-azyx/index.less | 1 + .../mip-veryhuo-azyy-azyx.js | 197 ++++++++++ .../components/mip-veryhuo-column/README.md | 31 ++ .../mip-veryhuo-column/example/index.html | 18 + .../components/mip-veryhuo-column/index.less | 1 + .../mip-veryhuo-column/mip-veryhuo-column.js | 360 ++++++++++++++++++ .../mip-veryhuo-index/mip-veryhuo-index.js | 325 ++++++++++------ .../mip-veryhuo-notfound.js | 15 +- .../mip-veryhuo-rank/mip-veryhuo-rank.js | 345 +++++++++++------ .../mip-veryhuo-special.js | 317 +++++++++------ .../components/mip-veryhuo-type/README.md | 31 ++ .../mip-veryhuo-type/example/index.html | 18 + .../components/mip-veryhuo-type/index.less | 1 + .../mip-veryhuo-type/mip-veryhuo-type.js | 192 ++++++++++ .../mip-veryhuo-zx/mip-veryhuo-zx.js | 288 ++++++++------ 21 files changed, 1994 insertions(+), 489 deletions(-) create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/README.md create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/example/index.html create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/index.less create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/README.md create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/example/index.html create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/index.less create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/mip-veryhuo-azyy-azyx.js create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-column/README.md create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-column/example/index.html create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-column/index.less create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-type/README.md create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-type/example/index.html create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-type/index.less create mode 100644 sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/README.md new file mode 100644 index 000000000..bb1deaae6 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/README.md @@ -0,0 +1,31 @@ +# mip-veryhuo-androidsoft + +移动端样式、逻辑 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive, fixed-height, fill, container, fixed +所需脚本| [https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js](https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js) + +## 示例 + +### 基本使用 + +```html + +``` + +## 属性 + +### url + +说明:本站点网址 + +必选项:是 + +类型:字符串 + +取值范围:URL + +默认值:无 \ No newline at end of file diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/example/index.html b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/example/index.html new file mode 100644 index 000000000..b96a4ae82 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/example/index.html @@ -0,0 +1,18 @@ + + + + + + MIP page + + + + + + + + + + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/index.less b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/index.less new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/index.less @@ -0,0 +1 @@ + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js new file mode 100644 index 000000000..b0a231886 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js @@ -0,0 +1,244 @@ +/** + * @file 评论模块 + * @author fl + */ +import fetchJsonp from 'fetch-jsonp' + +const { CustomElement, util } = MIP +const { css } = util + +export default class MIPMhotComment extends CustomElement { + build () { + let bnum = 0 + let nnum = 0 + let PageType = '' + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] + let ztheader = this.element.querySelectorAll('.ztheader') + let cSOHUCS = this.element.querySelectorAll('#SOHUCS') + if (cSOHUCS.length > 0) { + if (cSOHUCS[0].attributes['PageType'].value !== undefined) { + PageType = cSOHUCS[0].attributes['PageType'].value + } + } + let oDiv = this.element.querySelectorAll('.SearchBox')[0] + let searBtn = this.element.querySelectorAll('.SBBtn button')[0] + let alert = this.element.querySelectorAll('#confirm')[0] + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] + let sear = this.element.querySelectorAll('.searchDiv input') + let cnav = this.element.querySelectorAll('nav')[0] + let mclassify = this.element.querySelectorAll('#mclassify')[0] + let pullNav = this.element.querySelectorAll('#nav .pullNav') + let moreNav = this.element.querySelectorAll('#nav .moreNav') + let cmslass = this.element.querySelectorAll('#mclassifyCont p span') + let cul = this.element.querySelectorAll('#mclassifyCont ul') + let fixNav = this.element.querySelector('.fixNav') + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] + let zxNav = this.element.querySelector('#zxNav') + searBtn.onclick = function() { + if(oDiv.length === 0) { + css(alert, {display:'block'}) + }else { + css(alert, {display:'none'}) + } + } + window.addEventListener('scroll', function () { + // 页面滚动一定高度时,显示吸顶导航盒子 + if (document.documentElement.scrollTop > 80) { + css(fixNav, {display: 'block'}) + css(zxNav, {display: 'none'}) + } else if(document.documentElement.scrollTop < 30) { + css(fixNav, {display: 'none'}) + css(zxNav, {display: 'block'}) + } + // 页面滚动一定高度时,显示回到顶部按钮 + if (document.documentElement.scrollTop > 300) { + css(cbacktop, {display: 'block'}) + } else { + css(cbacktop, {display: 'none'}) + } + }) + // 点击回到顶部按钮 + cbacktop.onclick = function () { + document.documentElement.scrollTop = 0 + } + if (ztheader.length === 0) { + // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 + oDiv.onclick = function () { + if (bnum === 0) { + css(mclassifyCont, {display: 'none'}) + css(csearchDiv, {display: 'block'}) + if (sear.length > 0) { + sear[0].focus() + } + bnum = 1 + nnum = 0 + } else { + if (nnum === 1) { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } else { + css(cnav, {height: 40}) + css(csearchDiv, {display: 'none'}) + bnum = 0 + } + } + } + // 给隐藏的分类 tab 标题添加类样式 + for (let i = 0; i < cmslass.length; i++) { + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + cmslass[i].index = i + } + } + // 点击隐藏的分类 tab 标题切换ul列表数据 + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } + } + } + // 点击顶部分类按钮 + mclassify.onclick = function () { + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}) + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') + } + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) + } + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } + } + } + /*如果不是手机打开,则跳转到pc页面*/ + var browser1 = { + versions: function () { + let u = navigator.userAgent, app = navigator.appVersion; + return {//移动终端浏览器版本信息 + trident: u.indexOf('Trident') > -1, //IE内核 + presto: u.indexOf('Presto') > -1, //opera内核 + webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, //火狐内核 + mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 + ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 + iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 + iPad: u.indexOf('iPad') > -1, //是否iPad + webApp: u.indexOf('Safari') === -1 //是否web应该程序,没有头部与底部 + }; + } (), + language: (navigator.browserLanguage || navigator.language).toLowerCase() + }; + if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { + //location.href = location.href.replace("m.","www.");//如果不是手机打开,则跳转到pc页面 + window.location='http://www.veryhuo.com' + } + let moreBtn = this.element.querySelector('#androidsoft-more'); + let asmUl = this.element.querySelector('#asm'); + // 发送请求 + let asm = 18; + // 更多软件点击事件 + moreBtn.onclick = function () { + // 创建一个Request对象 + let req = new Request('https://admin.veryhuo.com/mobile/open/more_soft?p='+asm+'&type=2'+'&isgame=0', { + method: 'GET', + cache: 'reload' + }); + fetch(req).then(function (response) { + return response.json() + }).then(function (data) { + if (data === '') { + moreBtn.innerText = '加载完毕啦,么么哒~' + return false + }else{ + moreBtn.innerText = '加载中...' + let khtml = '' + let len = data.length + for (let i = 0;i < len; i++) { + let dt = data[i] + dt.pubdate = to_date(dt.pubdate) + khtml = document.createElement("li") + khtml.innerHTML = "

"+dt.title+""+dt.typename+""+dt.softsize+""+dt.os+""+dt.pubdate+"

下载" + asmUl.appendChild(khtml) + } + if (len < 20) { + moreBtn.innerText = '加载完毕啦,么么哒~' + } + else { + moreBtn.innerText = '点击有惊喜,萌萌哒~' + } + asm = asm + 20 + } + // 将时间戳转换成 yy-mm-dd + function to_date (phpstr) { + let str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000 + let newDate = new Date(str); + let yy = newDate.getUTCFullYear();//取年份 + let mm = newDate.getUTCMonth() + 1;//取月份 + let dd = newDate.getUTCDate();//取天数 + return yy + "-" + mm + "-" + dd;//拼接 + } + }); + }; + // 更多游戏点击事件 + let gameBtn = this.element.querySelector('#androidgame-more'); + let agmUl = this.element.querySelector('#agm'); + let agm=18 + gameBtn.onclick = function () { + // 创建一个Request对象 + let req = new Request('https://admin.veryhuo.com/mobile/open/more_soft?p='+agm+'&type=2'+'&isgame=1', { + method: 'GET', + cache: 'reload' + }); + fetch(req).then(function (response) { + return response.json() + }).then(function (data) { + if (data === '') { + gameBtn.innerText = '加载完毕啦,么么哒~' + return false + }else{ + gameBtn.innerText = '加载中...' + let ghtml = '' + let len = data.length + for (let i = 0;i < len; i++) { + let dt = data[i] + dt.pubdate = to_date(dt.pubdate) + ghtml = document.createElement("li") + ghtml.innerHTML = "

"+dt.title+""+dt.typename+""+dt.softsize+""+dt.os+""+dt.pubdate+"

下载" + agmUl.appendChild(ghtml) + } + if (len < 20) { + gameBtn.innerText = '加载完毕啦,么么哒~' + } + else { + gameBtn.innerText = '点击有惊喜,萌萌哒~' + } + agm = agm + 20 + } + // 将时间戳转换成 yy-mm-dd + function to_date(phpstr) { + let str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000 + let newDate = new Date(str); + let yy = newDate.getUTCFullYear();//取年份 + let mm = newDate.getUTCMonth() + 1;//取月份 + let dd = newDate.getUTCDate();//取天数 + return yy + "-" + mm + "-" + dd;//拼接 + } + }) + } + } +} diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/README.md new file mode 100644 index 000000000..712a5a6e6 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/README.md @@ -0,0 +1,31 @@ +# mip-veryhuo-azyy-azyx + +移动端样式、逻辑 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive, fixed-height, fill, container, fixed +所需脚本| [https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-azyy-azyx/mip-veryhuo-azyy-azyx.js](https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-azyy-azyx/mip-veryhuo-azyy-azyx.js) + +## 示例 + +### 基本使用 + +```html + +``` + +## 属性 + +### url + +说明:本站点网址 + +必选项:是 + +类型:字符串 + +取值范围:URL + +默认值:无 \ No newline at end of file diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/example/index.html b/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/example/index.html new file mode 100644 index 000000000..c4deb942d --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/example/index.html @@ -0,0 +1,18 @@ + + + + + + MIP page + + + + + + + + + + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/index.less b/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/index.less new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/index.less @@ -0,0 +1 @@ + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/mip-veryhuo-azyy-azyx.js b/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/mip-veryhuo-azyy-azyx.js new file mode 100644 index 000000000..546028b19 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/mip-veryhuo-azyy-azyx.js @@ -0,0 +1,197 @@ +/** + * @file 评论模块 + * @author fl + */ +import fetchJsonp from 'fetch-jsonp' + +const { CustomElement, util } = MIP +const { css } = util + +export default class MIPMhotComment extends CustomElement { + build () { + let bnum = 0 + let nnum = 0 + let PageType = '' + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] + let ztheader = this.element.querySelectorAll('.ztheader') + let cSOHUCS = this.element.querySelectorAll('#SOHUCS') + if (cSOHUCS.length > 0) { + if (cSOHUCS[0].attributes['PageType'].value !== undefined) { + PageType = cSOHUCS[0].attributes['PageType'].value + } + } + let oDiv = this.element.querySelectorAll('.SearchBox')[0] + let searBtn = this.element.querySelectorAll('.SBBtn button')[0] + let alert = this.element.querySelectorAll('#confirm')[0] + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] + let sear = this.element.querySelectorAll('.searchDiv input') + let cnav = this.element.querySelectorAll('nav')[0] + let mclassify = this.element.querySelectorAll('#mclassify')[0] + let pullNav = this.element.querySelectorAll('#nav .pullNav') + let moreNav = this.element.querySelectorAll('#nav .moreNav') + let cmslass = this.element.querySelectorAll('#mclassifyCont p span') + let cul = this.element.querySelectorAll('#mclassifyCont ul') + let fixNav = this.element.querySelector('.fixNav') + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] + let zxNav = this.element.querySelector('#zxNav') + searBtn.onclick = function() { + if(oDiv.length === 0) { + css(alert, {display:'block'}) + }else { + css(alert, {display:'none'}) + } + } + window.addEventListener('scroll', function () { + // 页面滚动一定高度时,显示吸顶导航盒子 + if (document.documentElement.scrollTop > 80) { + css(fixNav, {display: 'block'}) + css(zxNav, {display: 'none'}) + } else if(document.documentElement.scrollTop < 30) { + css(fixNav, {display: 'none'}) + css(zxNav, {display: 'block'}) + } + // 页面滚动一定高度时,显示回到顶部按钮 + if (document.documentElement.scrollTop > 300) { + css(cbacktop, {display: 'block'}) + } else { + css(cbacktop, {display: 'none'}) + } + }) + // 点击回到顶部按钮 + cbacktop.onclick = function () { + document.documentElement.scrollTop = 0 + } + if (ztheader.length === 0) { + // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 + oDiv.onclick = function () { + if (bnum === 0) { + css(mclassifyCont, {display: 'none'}) + css(csearchDiv, {display: 'block'}) + if (sear.length > 0) { + sear[0].focus() + } + bnum = 1 + nnum = 0 + } else { + if (nnum === 1) { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } else { + css(cnav, {height: 40}) + css(csearchDiv, {display: 'none'}) + bnum = 0 + } + } + } + // 给隐藏的分类 tab 标题添加类样式 + for (let i = 0; i < cmslass.length; i++) { + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + cmslass[i].index = i + } + } + // 点击隐藏的分类 tab 标题切换ul列表数据 + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } + } + } + // 点击顶部分类按钮 + mclassify.onclick = function () { + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}) + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') + } + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) + } + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } + } + } + /*如果不是手机打开,则跳转到pc页面*/ + var browser1 = { + versions: function () { + let u = navigator.userAgent, app = navigator.appVersion; + return {//移动终端浏览器版本信息 + trident: u.indexOf('Trident') > -1, //IE内核 + presto: u.indexOf('Presto') > -1, //opera内核 + webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, //火狐内核 + mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 + ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 + iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 + iPad: u.indexOf('iPad') > -1, //是否iPad + webApp: u.indexOf('Safari') === -1 //是否web应该程序,没有头部与底部 + }; + } (), + language: (navigator.browserLanguage || navigator.language).toLowerCase() + }; + if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { + //location.href = location.href.replace("m.","www.");//如果不是手机打开,则跳转到pc页面 + window.location='http://www.veryhuo.com' + } + let moreBtn = this.element.querySelector('#soft-more'); + let sUl = this.element.querySelector('#soft-list'); + let soft_p = 20; + let isgame = document.getElementById('isgame').getAttribute('value'); + moreBtn.onclick = function () { + // 创建一个Request对象 + let req = new Request('https://admin.veryhuo.com/mobile/open/more_soft?p='+soft_p+'&type=2&isgame='+isgame, { + method: 'GET', + cache: 'reload' + }); + fetch(req).then(function (response) { + return response.json() + }).then(function(data) { + if (data === '') { + moreBtn.innerText = '加载完毕啦,么么哒~' + return false + }else{ + moreBtn.innerText = '加载中...' + let khtml = ''; + let len = data.length; + for (let i = 0;i < len; i++) { + let dt = data[i]; + dt.pubdate = to_date(dt.pubdate) + khtml = document.createElement("li") + khtml.innerHTML = "

"+dt.title+""+dt.typename+""+dt.softsize+""+dt.os+""+dt.pubdate+"

下载" + sUl.appendChild(khtml) + } + if (len < 20) { + moreBtn.innerText = '加载完毕啦,么么哒~' + } + else { + moreBtn.innerText = '点击有惊喜,萌萌哒~' + } + soft_p = soft_p + 20 + } + // 将时间戳转换成 yy-mm-dd + function to_date(phpstr) { + let str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000 + let newDate = new Date(str); + let yy = newDate.getUTCFullYear();//取年份 + let mm = newDate.getUTCMonth() + 1;//取月份 + let dd = newDate.getUTCDate();//取天数 + return yy + "-" + mm + "-" + dd;//拼接 + } + }) + } + } +} diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-column/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-column/README.md new file mode 100644 index 000000000..eb9d13a62 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-column/README.md @@ -0,0 +1,31 @@ +# mip-veryhuo-column + +移动端样式、逻辑 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive, fixed-height, fill, container, fixed +所需脚本| [https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-column/mip-veryhuo-column.js](https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-column/mip-veryhuo-column.js) + +## 示例 + +### 基本使用 + +```html + +``` + +## 属性 + +### url + +说明:本站点网址 + +必选项:是 + +类型:字符串 + +取值范围:URL + +默认值:无 \ No newline at end of file diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-column/example/index.html b/sites/m.veryhuo.com/components/mip-veryhuo-column/example/index.html new file mode 100644 index 000000000..e5935c67e --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-column/example/index.html @@ -0,0 +1,18 @@ + + + + + + MIP page + + + + + + + + + + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-column/index.less b/sites/m.veryhuo.com/components/mip-veryhuo-column/index.less new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-column/index.less @@ -0,0 +1 @@ + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js b/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js new file mode 100644 index 000000000..7e26d010a --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js @@ -0,0 +1,360 @@ +/** + * @file 评论模块 + * @author fl + */ +import fetchJsonp from 'fetch-jsonp' + +const { CustomElement, util } = MIP +const { css } = util + +export default class MIPMhotComment extends CustomElement { + build () { + let bnum = 0 + let nnum = 0 + let PageType = '' + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] + let ztheader = this.element.querySelectorAll('.ztheader') + let cSOHUCS = this.element.querySelectorAll('#SOHUCS') + if (cSOHUCS.length > 0) { + if (cSOHUCS[0].attributes['PageType'].value !== undefined) { + PageType = cSOHUCS[0].attributes['PageType'].value + } + } + let oDiv = this.element.querySelectorAll('.SearchBox')[0] + let searBtn = this.element.querySelectorAll('.SBBtn button')[0] + let alert = this.element.querySelectorAll('#confirm')[0] + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] + let sear = this.element.querySelectorAll('.searchDiv input') + let cnav = this.element.querySelectorAll('nav')[0] + let mclassify = this.element.querySelectorAll('#mclassify')[0] + let pullNav = this.element.querySelectorAll('#nav .pullNav') + let moreNav = this.element.querySelectorAll('#nav .moreNav') + let cmslass = this.element.querySelectorAll('#mclassifyCont p span') + let cul = this.element.querySelectorAll('#mclassifyCont ul') + let fixNav = this.element.querySelector('.fixNav') + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] + let zxNav = this.element.querySelector('#zxNav') + searBtn.onclick = function () { + if(oDiv.length === 0) { + css(alert, {display:'block'}) + }else { + css(alert, {display:'none'}) + } + } + window.addEventListener('scroll', function () { + // 页面滚动一定高度时,显示吸顶导航盒子 + if (document.documentElement.scrollTop > 80) { + css(fixNav, {display: 'block'}) + css(zxNav, {display: 'none'}) + } else if (document.documentElement.scrollTop < 30) { + css(fixNav, {display: 'none'}) + css(zxNav, {display: 'block'}) + } + // 页面滚动一定高度时,显示回到顶部按钮 + if (document.documentElement.scrollTop > 300) { + css(cbacktop, {display: 'block'}) + } else { + css(cbacktop, {display: 'none'}) + } + }) + // 点击回到顶部按钮 + cbacktop.onclick = function () { + document.documentElement.scrollTop = 0 + } + if (ztheader.length === 0) { + // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 + oDiv.onclick = function () { + if (bnum === 0) { + css(mclassifyCont, {display: 'none'}) + css(csearchDiv, {display: 'block'}) + if (sear.length > 0) { + sear[0].focus() + } + bnum = 1 + nnum = 0 + } else { + if (nnum === 1) { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } else { + css(cnav, {height: 40}) + css(csearchDiv, {display: 'none'}) + bnum = 0 + } + } + } + // 给隐藏的分类 tab 标题添加类样式 + for (let i = 0; i < cmslass.length; i++) { + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + cmslass[i].index = i + } + } + // 点击隐藏的分类 tab 标题切换ul列表数据 + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } + } + } + // 点击顶部分类按钮 + mclassify.onclick = function () { + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}) + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') + } + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) + } + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } + } + } + /*如果不是手机打开,则跳转到pc页面*/ + let browser1 = { + versions: function () { + let u = navigator.userAgent, app = navigator.appVersion; + return {//移动终端浏览器版本信息 + trident: u.indexOf('Trident') > -1, //IE内核 + presto: u.indexOf('Presto') > -1, //opera内核 + webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, //火狐内核 + mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 + ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 + iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 + iPad: u.indexOf('iPad') > -1, //是否iPad + webApp: u.indexOf('Safari') === -1 //是否web应该程序,没有头部与底部 + }; + } (), + language: (navigator.browserLanguage || navigator.language).toLowerCase() + }; + if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { + let pcurl = location.href.replace("m.","www.");//如果不是手机打开,则跳转到pc页面 + if(location.href.indexOf("/androidsoft.html")>-1) { + location.href=pcurl + } + if(location.href.indexOf("/down/class/")>-1) { + location.href=pcurl + } + } + // 机型判断 + let u = navigator.userAgent, app = navigator.appVersion; + let isIphone= !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) //ios终端 + var lm = ''; + let typeid = document.getElementById('typeid').getAttribute('value'); + let classweb = document.getElementById('classweb').getAttribute('value'); + let typename = document.getElementById('typename').getAttribute('value'); + let isios = document.getElementById('isios').getAttribute('value'); + let classid = document.getElementById('classid').getAttribute('value'); + let type = isios === '0' ? '2' : '3' + if (isIphone) { + if (classweb === '2') { + let azurl=window.location.href + let azurlarr=azurl.split("/") + let azurlid=azurlarr[5].replace(".html","") + if(isios==='0'){ + azurl=azurl.replace(azurlid,classid) + window.location.href=azurl + } + } + lm = 2 + } + else { + if (classweb === '2') { + let azurl=window.location.href + let azurlarr=azurl.split("/") + let azurlid=azurlarr[5].replace(".html","") + if (isios==='1') { + azurl=azurl.replace(azurlid,classid) + window.location.href=azurl + } + } + lm = 1 + } + console.log(type); + let btn1 = this.element.querySelector('#btn1') + let btn2 = this.element.querySelector('#btn2') + let btn3 = this.element.querySelector('#btn3') + let lists1 = this.element.querySelector('.lists1') + let lists2 = this.element.querySelector('.lists2') + let lists3 = this.element.querySelector('.lists3') + let p = 10 + let zz = 13 + btn1.onclick = function () { + if(btn1.innerText === "加载完毕啦") return false; + // 创建一个Request对象 + let req = new Request('https://admin.veryhuo.com/mobile/open/list_more_zuixin?type='+type+'&p='+p+'&type_id='+typeid,{ + method: 'GET', + cache: 'reload' + }); + fetch(req).then(function (response) { + return response.json() + }).then(function (data) { + if (data === '') { + btn1.innerText = '加载完毕啦,么么哒~' + return false + } else { + btn1.innerText = '加载中...' + let khtml = ''; + let len = data.length; + for (let i = 0;i < len; i++) { + let dt = data[i]; + if (dt.litpic === '') { + dt.litpic='/images/nologo.png' + } + if (dt.version === 0) { + dt.version = dt.os + } else { + dt.softrank=5 + } + khtml = document.createElement("li") + khtml.innerHTML = "

"+dt.title+""+typename+"|"+dt.version+"|"+dt.softsize+"

下载" + zz += 1 + lists1.appendChild(khtml) + } + if (len < 10) { + btn1.innerText = '加载完毕啦,么么哒~' + } + else { + btn1.innerText = '点击有惊喜,萌萌哒~' + } + p = p + 30 + } + // 将时间戳转换成 yy-mm-dd + function to_date (phpstr) { + let str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000 + let newDate = new Date(str); + let yy = newDate.getUTCFullYear();//取年份 + let mm = newDate.getUTCMonth() + 1;//取月份 + let dd = newDate.getUTCDate();//取天数 + return yy + "-" + mm + "-" + dd;//拼接 + } + }) + } + let hqp = 10 + btn2.onclick = function () { + if(btn2.innerText === "加载完毕啦") return false; + // 创建一个Request对象 + let req = new Request('https://admin.veryhuo.com/mobile/open/list_more_zuire?type='+type+'&p='+hqp+'&type_id='+typeNum,{ + method: 'GET', + cache: 'reload' + }); + fetch(req).then(function (response) { + return response.json() + }).then(function (data) { + if (data === '') { + btn2.innerText = '加载完毕啦,么么哒~'; + return false + } else { + btn2.innerText = '加载中...'; + let rhtml = ''; + let len = data.length; + for (let i = 0;i < len; i++) { + let dt = data[i]; + console.log(dt) + if (dt.litpic === '') { + dt.litpic='/images/nologo.png' + } else { + dt.litpic='https://www.veryhuo.com'+dt.litpic + } + if (dt.version === 0) { + dt.version = dt.os + } else { + dt.softrank=5 + } + rhtml = document.createElement("li") + rhtml.innerHTML = "

"+dt.title+""+value+"|"+dt.version+"|"+dt.softsize+"

下载" + zz += 1; + lists2.appendChild(rhtml) + } + if (len < 20) { + btn2.innerText = '加载完毕啦,么么哒~' + } + else { + btn2.innerText = '点击有惊喜,萌萌哒~' + } + hqp = hqp + 30 + } + // 将时间戳转换成 yy-mm-dd + function to_date (phpstr) { + let str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000 + let newDate = new Date(str); + let yy = newDate.getUTCFullYear();//取年份 + let mm = newDate.getUTCMonth() + 1;//取月份 + let dd = newDate.getUTCDate();//取天数 + return yy + "-" + mm + "-" + dd;//拼接 + } + }); + }; + let zxp = 10 + btn3.onclick = function () { + if(btn3.innerText === "加载完毕啦") return false; + // 创建一个Request对象 + let req = new Request('https://admin.veryhuo.com/mobile/open/list_more_paihang?type='+type+'&p='+zxp+'&type_id='+typeNum,{ + method: 'GET', + cache: 'reload' + }); + fetch(req).then(function (response) { + return response.json() + }).then(function (data) { + if (data === '') { + btn3.innerText = '加载完毕啦,么么哒~' + return false + }else{ + btn3.innerText = '加载中...' + let phtml = '' + let len = data.length + for (let i = 0;i < len; i++) { + let dt = data[i] + console.log(dt) + if (dt.litpic === '') { + dt.litpic='/images/nologo.png' + } else { + dt.litpic='https://www.veryhuo.com'+dt.litpic + } + if (dt.version === 0) { + dt.version = dt.os + } else { + dt.softrank=5 + } + phtml = document.createElement("li") + phtml.innerHTML = "

"+dt.title+""+value+"|"+dt.version+"|"+dt.softsize+"

下载" + zz += 1; + lists3.appendChild(phtml) + } + if (len < 20) { + btn3.innerText = '加载完毕啦,么么哒~' + } + else { + btn3.innerText = '点击有惊喜,萌萌哒~' + } + zxp = zxp + 30 + } + // 将时间戳转换成 yy-mm-dd + function to_date (phpstr) { + let str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000 + let newDate = new Date(str); + let yy = newDate.getUTCFullYear();//取年份 + let mm = newDate.getUTCMonth() + 1;//取月份 + let dd = newDate.getUTCDate();//取天数 + return yy + "-" + mm + "-" + dd;//拼接 + } + }); + }; + } +} diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js index d7219c290..0cd7bc031 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js @@ -2,131 +2,228 @@ * @file 评论模块 * @author fl */ -const { CustomElement, util } = MIP -const { css } = util +import fetchJsonp from 'fetch-jsonp' + +const { CustomElement, util } = MIP; +const { css } = util; export default class MIPMhotComment extends CustomElement { - build () { - let bnum = 0 - let nnum = 0 - let PageType = 'asp' - let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] // 隐藏的分类盒子 - let ztheader = this.element.querySelectorAll('.ztheader') - let cSOHUCS = this.element.querySelectorAll('#SOHUCS') - if (cSOHUCS.length > 0) { - if (cSOHUCS[0].attributes['PageType'].value !== undefined) { - PageType = cSOHUCS[0].attributes['PageType'].value + build () { + let bnum = 0; + let nnum = 0; + let PageType = ''; + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0]; + let ztheader = this.element.querySelectorAll('.ztheader'); + let cSOHUCS = this.element.querySelectorAll('#SOHUCS'); + if (cSOHUCS.length > 0) { + if (cSOHUCS[0].attributes['PageType'].value !== undefined) { + PageType = cSOHUCS[0].attributes['PageType'].value + } + } + let oDiv = this.element.querySelectorAll('.SearchBox')[0]; + let searBtn = this.element.querySelectorAll('.SBBtn button')[0]; + let alert = this.element.querySelectorAll('#confirm')[0]; + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0]; + let sear = this.element.querySelectorAll('.searchDiv input'); + let cnav = this.element.querySelectorAll('nav')[0]; + let mclassify = this.element.querySelectorAll('#mclassify')[0]; + let pullNav = this.element.querySelectorAll('#nav .pullNav'); + let moreNav = this.element.querySelectorAll('#nav .moreNav'); + let cmslass = this.element.querySelectorAll('#mclassifyCont p span'); + let cul = this.element.querySelectorAll('#mclassifyCont ul'); + let fixNav = this.element.querySelector('.fixNav'); + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0]; + let zxNav = this.element.querySelector('#zxNav'); + if (searBtn !== undefined) { + searBtn.onclick = function () { + if (oDiv.length === 0) { + css(alert, { display: 'block'}) + } else { + css(alert, { display: 'none'}) + } + } + } + window.addEventListener('scroll', function () { + // 页面滚动一定高度时,显示吸顶导航盒子 + if (document.documentElement.scrollTop > 80) { + css(fixNav, { display: 'block'}); + css(zxNav, { display: 'none'}) + } else if(document.documentElement.scrollTop < 30) { + css(fixNav, { display: 'none'}); + css(zxNav, { display: 'block'}) + } + // 页面滚动一定高度时,显示回到顶部按钮 + if (document.documentElement.scrollTop > 300) { + css(cbacktop, { display: 'block'}) + } else { + css(cbacktop, { display: 'none'}) + } + }); + // 点击回到顶部按钮 + if (cbacktop !== undefined) { + cbacktop.onclick = function () { + document.documentElement.scrollTop = 0 + } + } + if (ztheader !==undefined && ztheader.length === 0) { + // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 + if (oDiv!==undefined) { + oDiv.onclick = function () { + if (bnum === 0) { + css(mclassifyCont, { display: 'none'}); + css(csearchDiv, { display: 'block'}); + if (sear.length > 0) { + sear[0].focus() } + bnum = 1; + nnum = 0 + } else { + if (nnum === 1) { + css(mclassifyCont, { display: 'none'}); + nnum = 0 + } else { + css(cnav, {height: 40}); + css(csearchDiv, {display: 'none'}); + bnum = 0 + } + } } - let oDiv = this.element.querySelectorAll('.SearchBox')[0] // 搜索按钮盒子 - let searBtn = this.element.querySelectorAll('.SBBtn button')[0] // 搜索按钮 - let searInp = this.element.querySelectorAll('.SBInp input')[0] // 搜索框 - let alert = this.element.querySelectorAll('#confirm')[0] //input 提示框 - let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] // 隐藏的搜索框盒子 - let sear = this.element.querySelectorAll('.searchDiv input') // 隐藏的搜索框 - let cnav = this.element.querySelectorAll('nav')[0] // 导航盒子 - let mclassify = this.element.querySelectorAll('#mclassify')[0] // 顶部分类按钮 - let pullNav = this.element.querySelectorAll('#nav .pullNav') - let moreNav = this.element.querySelectorAll('#nav .moreNav') - let cmslass = this.element.querySelectorAll('#mclassifyCont p span') // 分类tab标题 - let cul = this.element.querySelectorAll('#mclassifyCont ul') // 顶部分类盒子 - let fixNav = this.element.querySelector('.fixNav') // 吸顶盒子 - let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] // 回到顶部按钮 - let lookmore = this.element.querySelectorAll('.lookmore') // 查看更多按钮 - let li = this.element.querySelectorAll('.CRCSTitleC li.tab-item') - let zxNav = this.element.querySelector('#zxNav'); - - searBtn.onclick = function() { - if(oDiv.length === 0) { - css(alert, {display:'block'}); - }else { - css(alert, {display:'none'}); + } + // 给隐藏的分类 tab 标题添加类样式 + for (let i = 0; i < cmslass.length; i++) { + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes; + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = ''; + this.className = 'cur'; + cmslass[i].index = i } + } + // 点击隐藏的分类 tab 标题切换ul列表数据 + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } } - window.addEventListener('scroll', function () { - // 页面滚动一定高度时,显示吸顶导航盒子 - if (document.documentElement.scrollTop > 80) { - css(fixNav, {display: 'block'}) - css(zxNav, {display: 'none'}) - } else if(document.documentElement.scrollTop < 30) { - css(fixNav, {display: 'none'}) - css(zxNav, {display: 'block'}) + } + // 点击顶部分类按钮 + if (mclassify!== undefined) { + mclassify.onclick = function () { + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}); + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') } - // 页面滚动一定高度时,显示回到顶部按钮 - if (document.documentElement.scrollTop > 300) { - css(cbacktop, {display: 'block'}) - } else { - css(cbacktop, {display: 'none'}) + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) } - - }) - // 点击回到顶部按钮 - cbacktop.onclick = function () { - document.documentElement.scrollTop = 0 + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}); + nnum = 0 + } + } + } + } + /*如果不是手机打开,则跳转到pc页面*/ + var browser1 = { + versions: function () { + let u = navigator.userAgent, app = navigator.appVersion; + return {//移动终端浏览器版本信息 + trident: u.indexOf('Trident') > -1, //IE内核 + presto: u.indexOf('Presto') > -1, //opera内核 + webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, //火狐内核 + mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 + ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 + iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 + iPad: u.indexOf('iPad') > -1, //是否iPad + webApp: u.indexOf('Safari') === -1 //是否web应该程序,没有头部与底部 }; - - if (ztheader.length === 0) { - // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 - oDiv.onclick = function () { - if (bnum === 0) { - css(mclassifyCont, {display: 'none'}) - css(csearchDiv, {display: 'block'}) - if (sear.length > 0) { - sear[0].focus() - } - bnum = 1 - nnum = 0 - } else { - if (nnum === 1) { - css(mclassifyCont, {display: 'none'}) - nnum = 0 - } else { - css(cnav, {height: 40}) - css(csearchDiv, {display: 'none'}) - bnum = 0 - } - } + } (), + language: (navigator.browserLanguage || navigator.language).toLowerCase() + }; + if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { + //location.href = location.href.replace("m.","www.");//如果不是手机打开,则跳转到pc页面 + window.location='http://www.veryhuo.com' + } + // 判断机型 + let u = navigator.userAgent, app = navigator.appVersion; + let isIphone= !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 true + var lm = ''; + let iosweb = document.getElementById("iosweb").getAttribute("value");//0是安卓 1是苹果 + var type = iosweb === "0"? "2":"3"; + if (isIphone) { + if (iosweb === '0'){ //az + window.stop ? window.stop() : document.execCommand("Stop"); + window.location.href = "/mip_ddooo_m.rar/apple/index.html"; + } + lm = 2 + } + else if(iosweb === '1'){ + window.stop ? window.stop() : document.execCommand("Stop"); + window.location.href = "/mip_ddooo_m.rar/index.html" + lm = 1 + } + console.log(type); + let moreBtn = this.element.querySelector('#moreApp'); // 更多按钮 + let iList = this.element.querySelector('.Apply .iList'); // ul + // 发送请求 + let p = 15; + let doing = 0; + if(moreBtn!=undefined) { + moreBtn.onclick = function () { + if (doing === 1) return false; + // 创建一个Request对象 + let req = new Request('http://admin.veryhuo.com/mobile/open/more_soft?type=' + type + '&p=' + p, { + method: 'GET', + cache: 'reload' + }); + fetch(req).then(function (response) { + return response.json() + }).then(function (data) { + if (data === '') { + moreBtn.innerText = '加载完毕啦,么么哒~'; + return false; + } else { + moreBtn.innerText = '加载中...'; + let khtml = ''; + let len = data.length; + for (let i = 0; i < len; i++) { + let dt = data[i] + dt.pubdate = to_date(dt.pubdate); + khtml = document.createElement("li") + khtml.innerHTML = "

" + dt.title + "" + dt.typename + "" + dt.softsize + "" + dt.os + "" + dt.pubdate + "

下载" + iList.appendChild(khtml) } - // 给隐藏的分类 tab 标题添加类样式 - for (let i = 0; i < cmslass.length; i++) { - cmslass[i].onclick = function () { - let siblings = this.parentNode.childNodes - for (let i = 0; i < siblings.length; i++) { - if (siblings[i].nodeType === 1) { - siblings[i].className = '' - this.className = 'cur' - cmslass[i].index = i - } - } - // 点击隐藏的分类 tab 标题切换ul列表数据 - if (this.index === 0) { - cul[0].className = 'on' - } else { - cul[0].className = '' - } - if (this.index === 1) { - cul[1].className = 'on' - } else { - cul[1].className = '' - } - } + if (len < 20) { + doing = 1 + moreBtn.innerText = '加载完毕啦,么么哒~' } - // 点击顶部分类按钮 - mclassify.onclick = function () { - if (nnum === 0) { - css(mclassifyCont, {display: 'block'}) - if (pullNav.length > 0) { - pullNav[0].classList.remove('open') - } - if (moreNav.length > 0) { - css(moreNav[0], {display: 'none'}) - } - nnum = 1 - } else { - css(mclassifyCont, {display: 'none'}) - nnum = 0 - } + else { + moreBtn.innerText = '点击有惊喜,萌萌哒~' } - } + p = p + 30 + } + // 将时间戳转换成 yy-mm-dd + function to_date (phpstr) { + let str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000 + let newDate = new Date(str); + let yy = newDate.getUTCFullYear();//取年份 + let mm = newDate.getUTCMonth() + 1;//取月份 + let dd = newDate.getUTCDate();//取天数 + return yy + "-" + mm + "-" + dd;//拼接 + } + }) + } } + } } diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js index bcf1a48ed..78eb628db 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js @@ -1,11 +1,10 @@ -const { CustomElement, util } = MIP -const { css } = util +const { CustomElement, util } = MIP; export default class MIPMhotComment extends CustomElement { - build() { - let goHome = this.element.querySelectorAll('.go-home')[0]; // 隐藏的分类盒子 - goHome.onclick = function() { - location.href = './index.html'; - } + build () { + let goHome = this.element.querySelectorAll('.go-home')[0] + goHome.onclick = function () { + location.href = './index.html' } -} \ No newline at end of file + } +} diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js b/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js index ca3cc26c6..11f0eb54c 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js @@ -1,133 +1,230 @@ -const { CustomElement, util } = MIP -const { css } = util +const { CustomElement, util } = MIP; +const { css } = util; export default class MIPMhotComment extends CustomElement { - build() { - let bnum = 0 - let nnum = 0 - let PageType = 'asp' - let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] // 隐藏的分类盒子 - let ztheader = this.element.querySelectorAll('.ztheader') - let cSOHUCS = this.element.querySelectorAll('#SOHUCS') - if (cSOHUCS.length > 0) { - if (cSOHUCS[0].attributes['PageType'].value !== undefined) { - PageType = cSOHUCS[0].attributes['PageType'].value + build () { + let bnum = 0; + let nnum = 0; + let PageType = ''; + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0]; + let ztheader = this.element.querySelectorAll('.ztheader'); + let cSOHUCS = this.element.querySelectorAll('#SOHUCS'); + if (cSOHUCS.length > 0) { + if (cSOHUCS[0].attributes['PageType'].value !== undefined) { + PageType = cSOHUCS[0].attributes['PageType'].value + } + } + let oDiv = this.element.querySelectorAll('.SearchBox')[0]; + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0]; + let sear = this.element.querySelectorAll('.searchDiv input'); + let cnav = this.element.querySelectorAll('nav')[0]; + let mclassify = this.element.querySelectorAll('#mclassify')[0]; + let pullNav = this.element.querySelectorAll('#nav .pullNav'); + let moreNav = this.element.querySelectorAll('#nav .moreNav'); + let cmslass = this.element.querySelectorAll('#mclassifyCont p span'); + let cul = this.element.querySelectorAll('#mclassifyCont ul'); + let fixNav = this.element.querySelector('.fixNav'); + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0]; + window.addEventListener('scroll', function () { + // 页面滚动一定高度时,显示吸顶导航盒子 + if (document.documentElement.scrollTop > 80) { + css(fixNav, {display: 'block'}) + } else { + css(fixNav, {display: 'none'}) + } + // 页面滚动一定高度时,显示回到顶部按钮 + if (document.documentElement.scrollTop > 300) { + css(cbacktop, {display: 'block'}) + } else { + css(cbacktop, {display: 'none'}) + } + }); + // 点击回到顶部按钮 + cbacktop.onclick = function () { + document.documentElement.scrollTop = 0 + }; + // 分类内容 + if (ztheader.length === 0) { + // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 + oDiv.onclick = function () { + if (bnum === 0) { + css(mclassifyCont, {display: 'none'}) + css(csearchDiv, {display: 'block'}) + if (sear.length > 0) { + sear[0].focus() + } + bnum = 1 + nnum = 0 + } else { + if (nnum === 1) { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } else { + css(cnav, {height: 40}) + css(csearchDiv, {display: 'none'}) + bnum = 0 + } + } + }; + // 给隐藏的分类 tab 标题添加类样式 + for (let i = 0; i < cmslass.length; i++) { + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + cmslass[i].index = i } + } + // 点击隐藏的分类 tab 标题切换ul列表数据 + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } } - let oDiv = this.element.querySelectorAll('.SearchBox')[0] // 搜索按钮盒子 - let searBtn = this.element.querySelectorAll('.SBBtn button')[0] // 搜索按钮 - let searInp = this.element.querySelectorAll('.SBInp input')[0] // 搜索框 - // let alert = this.element.querySelectorAll('#confirm')[0] //input 提示框 - let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] // 隐藏的搜索框盒子 - let sear = this.element.querySelectorAll('.searchDiv input') // 隐藏的搜索框 - let cnav = this.element.querySelectorAll('nav')[0] // 导航盒子 - let mclassify = this.element.querySelectorAll('#mclassify')[0] // 顶部分类按钮 - let pullNav = this.element.querySelectorAll('#nav .pullNav') - let moreNav = this.element.querySelectorAll('#nav .moreNav') - let cmslass = this.element.querySelectorAll('#mclassifyCont p span') // 分类tab标题 - let cul = this.element.querySelectorAll('#mclassifyCont ul') // 顶部分类盒子 - let fixNav = this.element.querySelector('.fixNav') // 吸顶盒子 - let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] // 回到顶部按钮 - let lookmore = this.element.querySelectorAll('.lookmore') // 查看更多按钮 - let li = this.element.querySelectorAll('.CRCSTitleC li.tab-item') - + } + // 点击顶部分类按钮 + mclassify.onclick = function () { + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}) + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') + } + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) + } + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } + } + } + // 点击排行页的 箭头,实现显示隐藏功能 + let zk = this.element.querySelector('.zk'); // 下箭头 + let sq = this.element.querySelector('.sq'); // 上箭头 + let rankA = this.element.querySelectorAll('.topnav a'); // 所有标题 + let hides = this.element.querySelectorAll('.isHide'); + zk.onclick = function () { + css(rankA, {display: 'block'}); + css(zk, {display: 'none'}) + }; + sq.onclick = function () { + css(hides, {display: 'none'}) + css(sq, {display: 'none'}) + css(zk, {display: 'block'}) + }; + /*如果不是手机打开,则跳转到pc页面*/ + var browser1 = { + versions: function () { + let u = navigator.userAgent, app = navigator.appVersion; + return {//移动终端浏览器版本信息 + trident: u.indexOf('Trident') > -1, //IE内核 + presto: u.indexOf('Presto') > -1, //opera内核 + webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, //火狐内核 + mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 + ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 + iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 + iPad: u.indexOf('iPad') > -1, //是否iPad + webApp: u.indexOf('Safari') === -1 //是否web应该程序,没有头部与底部 + }; + } (), + language: (navigator.browserLanguage || navigator.language).toLowerCase() + }; + if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { + //location.href = location.href.replace("m.","www.");//如果不是手机打开,则跳转到pc页面 + window.location='http://www.veryhuo.com' + } + // 机型判断 + let u = navigator.userAgent, app = navigator.appVersion; + let isIphone= !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) //ios终端 + var iosweb = document.getElementById('iosweb').getAttribute('value'); + var classweb = document.getElementById('classweb').getAttribute('value'); + var isyouxi = document.getElementById('isyouxi').getAttribute('value'); + var typeid = document.getElementById('typeid').getAttribute('value'); + var type = iosweb === '0' ? '2' : '3' + var lm = ''; + if (isIphone) { + if (classweb === '0') { + if (iosweb === '0') { + window.stop ? window.stop() : document.execCommand("Stop") + if (isyouxi === '1') { + window.location.href = "/mip_ddooo_m.rar/apple/rank.html" + } + else if (isyouxi === '2') { + window.location.href = "/mip_ddooo_m.rar/apple/game.html" + } + else { + window.location.href = "/mip_ddooo_m.rar/apple/soft.html" + } + } + } + lm = 2 + } + else if(iosweb === '1'){ + if (isyouxi === '1') { + window.location.href = "/mip_ddooo_m.rar/rank.html"; + } + else if (isyouxi === '2') { + window.location.href = "/mip_ddooo_m.rar/game.html" + } + else { + window.location.href = "/mip_ddooo_m.rar/soft.html" + } + lm = 1 + } - window.addEventListener('scroll', function () { - // 页面滚动一定高度时,显示吸顶导航盒子 - if (document.documentElement.scrollTop > 80) { - css(fixNav, {display: 'block'}) + // 点击加载更多 + let btn1 = this.element.querySelector('#btn1'); + let more = this.element.querySelector('#more'); + let pp = 12; + let zz = 13; + btn1.onclick = function () { + if (btn1.innerText === "加载完毕啦,么么哒~") return false + // 创建一个Request对象 + let req = new Request('https://admin.veryhuo.com/mobile/open/phb_more?os='+type+'&type='+isyouxi+'&p='+pp+'&typeid='+typeid, { + method: 'GET', + cache: 'reload' + }); + fetch(req).then(function (response) { + return response.json() + }).then(function(data) { + if (data === '') { + btn1.innerText = '加载完毕啦,么么哒~' + return false + }else{ + btn1.innerText = '加载中...' + let khtml = ''; + let len = data.length; + for (let i = 0;i < len; i++) { + let dt = data[i] + if(dt.version === 0) { + dt.version = dt.os } else { - css(fixNav, {display: 'none'}) + dt.softrank = 5 } - // 页面滚动一定高度时,显示回到顶部按钮 - if (document.documentElement.scrollTop > 300) { - css(cbacktop, {display: 'block'}) - } else { - css(cbacktop, {display: 'none'}) - } - - }) - // 点击回到顶部按钮 - cbacktop.onclick = function () { - document.documentElement.scrollTop = 0 - }; - // 分类内容 - if (ztheader.length === 0) { - // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 - oDiv.onclick = function () { - if (bnum === 0) { - css(mclassifyCont, {display: 'none'}) - css(csearchDiv, {display: 'block'}) - if (sear.length > 0) { - sear[0].focus() - } - bnum = 1 - nnum = 0 - } else { - if (nnum === 1) { - css(mclassifyCont, {display: 'none'}) - nnum = 0 - } else { - css(cnav, {height: 40}) - css(csearchDiv, {display: 'none'}) - bnum = 0 - } - } - } - // 给隐藏的分类 tab 标题添加类样式 - for (let i = 0; i < cmslass.length; i++) { - cmslass[i].onclick = function () { - let siblings = this.parentNode.childNodes - for (let i = 0; i < siblings.length; i++) { - if (siblings[i].nodeType === 1) { - siblings[i].className = '' - this.className = 'cur' - cmslass[i].index = i - } - } - // 点击隐藏的分类 tab 标题切换ul列表数据 - if (this.index === 0) { - cul[0].className = 'on' - } else { - cul[0].className = '' - } - if (this.index === 1) { - cul[1].className = 'on' - } else { - cul[1].className = '' - } - } - } - // 点击顶部分类按钮 - mclassify.onclick = function () { - if (nnum === 0) { - css(mclassifyCont, {display: 'block'}) - if (pullNav.length > 0) { - pullNav[0].classList.remove('open') - } - if (moreNav.length > 0) { - css(moreNav[0], {display: 'none'}) - } - nnum = 1 - } else { - css(mclassifyCont, {display: 'none'}) - nnum = 0 - } - } - } - // 点击排行页的 箭头,实现显示隐藏功能 - let zk = this.element.querySelector('.zk'); // 下箭头 - let sq = this.element.querySelector('.sq'); // 上箭头 - let rankA = this.element.querySelectorAll('.topnav a'); // 所有标题 - let hides = this.element.querySelectorAll('.isHide'); - zk.onclick = function () { - css(rankA, {display: 'block'}); - css(zk, {display: 'none'}); - }; - sq.onclick = function () { - css(hides, {display: 'none'}); - css(sq, {display: 'none'}); - css(zk, {display: 'block'}); + khtml = document.createElement("li") + khtml.innerHTML = "

"+zz+""+dt.title+""+dt.typename+""+dt.softsize+""+dt.version+"

下载"; + zz += 1 + more.appendChild(khtml) + } + if (len < 10) { + btn1.innerText = '加载完毕啦,么么哒~' + } else { + btn1.innerText = '点击有惊喜,萌萌哒~' + } + pp = pp + 30 } + }) } -} \ No newline at end of file + } +} diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js b/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js index 5168139bc..e78815810 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js @@ -6,131 +6,210 @@ const { CustomElement, util } = MIP const { css } = util export default class MIPMhotComment extends CustomElement { - build () { - let bnum = 0 - let nnum = 0 - let PageType = 'asp' - let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] // 隐藏的分类盒子 - let ztheader = this.element.querySelectorAll('.ztheader') - let cSOHUCS = this.element.querySelectorAll('#SOHUCS') - if (cSOHUCS.length > 0) { - if (cSOHUCS[0].attributes['PageType'].value !== undefined) { - PageType = cSOHUCS[0].attributes['PageType'].value - } + build () { + let bnum = 0 + let nnum = 0 + let PageType = '' + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] + let ztheader = this.element.querySelectorAll('.ztheader') + let cSOHUCS = this.element.querySelectorAll('#SOHUCS') + if (cSOHUCS.length > 0) { + if (cSOHUCS[0].attributes['PageType'].value !== undefined) { + PageType = cSOHUCS[0].attributes['PageType'].value + } + } + let oDiv = this.element.querySelectorAll('.SearchBox')[0] + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] + let sear = this.element.querySelectorAll('.searchDiv input') + let cnav = this.element.querySelectorAll('nav')[0] // 导航盒子 + let mclassify = this.element.querySelectorAll('#mclassify')[0] + let pullNav = this.element.querySelectorAll('#nav .pullNav') + let moreNav = this.element.querySelectorAll('#nav .moreNav') + let cmslass = this.element.querySelectorAll('#mclassifyCont p span') + let cul = this.element.querySelectorAll('#mclassifyCont ul') + let fixNav = this.element.querySelector('.fixNav') + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] + window.addEventListener('scroll', function () { + // 页面滚动一定高度时,显示吸顶导航盒子 + if (document.documentElement.scrollTop > 80) { + css(fixNav, {display: 'block'}) + } else { + css(fixNav, {display: 'none'}) + } + // 页面滚动一定高度时,显示回到顶部按钮 + if (document.documentElement.scrollTop > 300) { + css(cbacktop, {display: 'block'}) + } else { + css(cbacktop, {display: 'none'}) + } + }) + // 点击回到顶部按钮 + cbacktop.onclick = function () { + document.documentElement.scrollTop = 0 + }; + if (ztheader.length === 0) { + // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 + oDiv.onclick = function () { + if (bnum === 0) { + css(mclassifyCont, {display: 'none'}) + css(csearchDiv, {display: 'block'}) + if (sear.length > 0) { + sear[0].focus() + } + bnum = 1 + nnum = 0 + } else { + if (nnum === 1) { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } else { + css(cnav, {height: 40}) + css(csearchDiv, {display: 'none'}) + bnum = 0 + } } - let oDiv = this.element.querySelectorAll('.SearchBox')[0] // 搜索按钮盒子 - let searBtn = this.element.querySelectorAll('.SBBtn button')[0] // 搜索按钮 - let searInp = this.element.querySelectorAll('.SBInp input')[0] // 搜索框 - // let alert = this.element.querySelectorAll('#confirm')[0] //input 提示框 - let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] // 隐藏的搜索框盒子 - let sear = this.element.querySelectorAll('.searchDiv input') // 隐藏的搜索框 - let cnav = this.element.querySelectorAll('nav')[0] // 导航盒子 - let mclassify = this.element.querySelectorAll('#mclassify')[0] // 顶部分类按钮 - let pullNav = this.element.querySelectorAll('#nav .pullNav') - let moreNav = this.element.querySelectorAll('#nav .moreNav') - let cmslass = this.element.querySelectorAll('#mclassifyCont p span') // 分类tab标题 - let cul = this.element.querySelectorAll('#mclassifyCont ul') // 顶部分类盒子 - let fixNav = this.element.querySelector('.fixNav') // 吸顶盒子 - let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] // 回到顶部按钮 - let lookmore = this.element.querySelectorAll('.lookmore') // 查看更多按钮 - let li = this.element.querySelectorAll('.CRCSTitleC li.tab-item') - - window.addEventListener('scroll', function () { - // 页面滚动一定高度时,显示吸顶导航盒子 - if (document.documentElement.scrollTop > 80) { - css(fixNav, {display: 'block'}) - } else { - css(fixNav, {display: 'none'}) + } + // 给隐藏的分类 tab 标题添加类样式 + for (let i = 0; i < cmslass.length; i++) { + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + cmslass[i].index = i } - // 页面滚动一定高度时,显示回到顶部按钮 - if (document.documentElement.scrollTop > 300) { - css(cbacktop, {display: 'block'}) + } + // 点击隐藏的分类 tab 标题切换ul列表数据 + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } + } + } + // 点击顶部分类按钮 + mclassify.onclick = function () { + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}) + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') + } + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) + } + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } + } + } + let lis = this.element.querySelectorAll('.hqnav i'); + let uls = this.element.querySelectorAll('.speContent'); + for (let i = 0; i < lis.length; i++) { + lis[i].id = i; + lis[i].onclick = function () { + for (let j = 0; j < lis.length; j++) { + lis[j].className = ''; + uls[j].style.display = 'none' + } + this.className = 'cur' + uls[this.id].style.display = 'block' + } + } + // 点击更多按钮 + let btn1 = this.element.querySelector('#btn1'); + let btn2 = this.element.querySelector('#btn2'); + let specG = this.element.querySelector('#spec-game'); + let specS = this.element.querySelector('#spec-soft'); + let sp1 = 20 + let zz = 13 + btn1.onclick = function () { + if (btn1.innerText === '加载完毕啦,么么哒~') return false; + // 创建一个Request对象 + let req = new Request('https://admin.veryhuo.com/mobile/open/spec_more?type=1&p='+sp1, { + method: 'GET', + cache: 'reload' + }); + fetch(req).then(function (response) { + return response.json() + }).then(function(data) { + if (data === '') { + btn1.innerText = '加载完毕啦,么么哒~' + return false + }else{ + btn1.innerText = '加载中...' + let khtml = ''; + let len = data.length; + for (let i = 0;i < len; i++) { + let dt = data[i]; + console.log(dt) + if (dt.litpic === '') { + dt.litpic = '/images/nologo.png' } else { - css(cbacktop, {display: 'none'}) - } - - }) - // 点击回到顶部按钮 - cbacktop.onclick = function () { - document.documentElement.scrollTop = 0 - }; - - if (ztheader.length === 0) { - // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 - oDiv.onclick = function () { - if (bnum === 0) { - css(mclassifyCont, {display: 'none'}) - css(csearchDiv, {display: 'block'}) - if (sear.length > 0) { - sear[0].focus() - } - bnum = 1 - nnum = 0 - } else { - if (nnum === 1) { - css(mclassifyCont, {display: 'none'}) - nnum = 0 - } else { - css(cnav, {height: 40}) - css(csearchDiv, {display: 'none'}) - bnum = 0 - } - } - } - // 给隐藏的分类 tab 标题添加类样式 - for (let i = 0; i < cmslass.length; i++) { - cmslass[i].onclick = function () { - let siblings = this.parentNode.childNodes - for (let i = 0; i < siblings.length; i++) { - if (siblings[i].nodeType === 1) { - siblings[i].className = '' - this.className = 'cur' - cmslass[i].index = i - } - } - // 点击隐藏的分类 tab 标题切换ul列表数据 - if (this.index === 0) { - cul[0].className = 'on' - } else { - cul[0].className = '' - } - if (this.index === 1) { - cul[1].className = 'on' - } else { - cul[1].className = '' - } - } - } - // 点击顶部分类按钮 - mclassify.onclick = function () { - if (nnum === 0) { - css(mclassifyCont, {display: 'block'}) - if (pullNav.length > 0) { - pullNav[0].classList.remove('open') - } - if (moreNav.length > 0) { - css(moreNav[0], {display: 'none'}) - } - nnum = 1 - } else { - css(mclassifyCont, {display: 'none'}) - nnum = 0 - } + dt.litpic='https://admin.veryhuo.com/upload/'+dt.litpic } + khtml = document.createElement("li") + khtml.innerHTML = "

"+dt.title+"

" + zz += 1; + specG.appendChild(khtml) + } + if (len < 20) { + btn1.innerText = '加载完毕啦,么么哒~' + } + else { + btn1.innerText = '点击有惊喜,萌萌哒~' + } + sp1 = sp1 + 20 } - - let lis = this.element.querySelectorAll('.hqnav i'); // 专题页 tab切换标题 - let uls = this.element.querySelectorAll('.speContent ul'); // 专题ul内容 - for (let i = 0; i < lis.length; i++) { - lis[i].id = i; - lis[i].onclick = function () { - for (let j = 0; j < lis.length; j++) { - lis[j].className = ''; - uls[j].style.display = 'none'; - } - this.className = 'cur'; //点击哪个按钮就哪个按钮加active类 - uls[this.id].style.display = 'block'; + }); + } + let sp2 = 20; + btn2.onclick = function () { + if (btn2.innerText === '加载完毕啦,么么哒~') return false + // 创建一个Request对象 + let req = new Request('https://admin.veryhuo.com/mobile/open/spec_more?type=2&p='+sp2, { + method: 'GET', + cache: 'reload' + }); + fetch(req).then(function (response) { + return response.json() + }).then(function(data) { + if (data === '') { + btn2.innerText = '加载完毕啦,么么哒~'; + return false + }else{ + btn2.innerText = '加载中...' + let shtml = ''; + let len = data.length + for (let i = 0;i < len; i++) { + let dt = data[i] + console.log(dt) + if (dt.litpic === '') { + dt.litpic = '/images/nologo.png' + } else { + dt.litpic='https://admin.veryhuo.com/upload/'+dt.litpic } + shtml = document.createElement("li") + shtml.innerHTML = "

"+dt.title+"

"; + zz += 1 + specS.appendChild(shtml) + } + if (len < 20) { + btn2.innerText = '加载完毕啦,么么哒~' + } + else { + btn2.innerText = '点击有惊喜,萌萌哒~' + } + sp2 = sp2 + 20 } + }) } + } } diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-type/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-type/README.md new file mode 100644 index 000000000..fa6e41499 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-type/README.md @@ -0,0 +1,31 @@ +# mip-veryhuo-type + +移动端样式、逻辑 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive, fixed-height, fill, container, fixed +所需脚本| [https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-type/mip-veryhuo-type.js](https://c.mipcdn.com/extensions/platform/v2/m.veryhuo.com/mip-veryhuo-type/mip-veryhuo-type.js) + +## 示例 + +### 基本使用 + +```html + +``` + +## 属性 + +### url + +说明:本站点网址 + +必选项:是 + +类型:字符串 + +取值范围:URL + +默认值:无 \ No newline at end of file diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-type/example/index.html b/sites/m.veryhuo.com/components/mip-veryhuo-type/example/index.html new file mode 100644 index 000000000..1b2407316 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-type/example/index.html @@ -0,0 +1,18 @@ + + + + + + MIP page + + + + + + + + + + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-type/index.less b/sites/m.veryhuo.com/components/mip-veryhuo-type/index.less new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-type/index.less @@ -0,0 +1 @@ + diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js b/sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js new file mode 100644 index 000000000..6484df4ff --- /dev/null +++ b/sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js @@ -0,0 +1,192 @@ +/** + * @file 评论模块 + * @author fl + */ +import fetchJsonp from 'fetch-jsonp' + +const { CustomElement, util } = MIP +const { css } = util + +export default class MIPMhotComment extends CustomElement { + build () { + let bnum = 0 + let nnum = 0 + let PageType = '' + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] + let ztheader = this.element.querySelectorAll('.ztheader') + let cSOHUCS = this.element.querySelectorAll('#SOHUCS') + if (cSOHUCS.length > 0) { + if (cSOHUCS[0].attributes['PageType'].value !== undefined) { + PageType = cSOHUCS[0].attributes['PageType'].value + } + } + let oDiv = this.element.querySelectorAll('.SearchBox')[0] + let searBtn = this.element.querySelectorAll('.SBBtn button')[0] + let alert = this.element.querySelectorAll('#confirm')[0] + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] + let sear = this.element.querySelectorAll('.searchDiv input') + let cnav = this.element.querySelectorAll('nav')[0] // 导航盒子 + let mclassify = this.element.querySelectorAll('#mclassify')[0] + let pullNav = this.element.querySelectorAll('#nav .pullNav') + let moreNav = this.element.querySelectorAll('#nav .moreNav') + let cmslass = this.element.querySelectorAll('#mclassifyCont p span') + let cul = this.element.querySelectorAll('#mclassifyCont ul') + let fixNav = this.element.querySelector('.fixNav') + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] + let zxNav = this.element.querySelector('#zxNav') + searBtn.onclick = function() { + if(oDiv.length === 0) { + css(alert, {display:'block'}) + }else { + css(alert, {display:'none'}) + } + } + window.addEventListener('scroll', function () { + // 页面滚动一定高度时,显示吸顶导航盒子 + if (document.documentElement.scrollTop > 80) { + css(fixNav, {display: 'block'}) + css(zxNav, {display: 'none'}) + } else if(document.documentElement.scrollTop < 30) { + css(fixNav, {display: 'none'}) + css(zxNav, {display: 'block'}) + } + // 页面滚动一定高度时,显示回到顶部按钮 + if (document.documentElement.scrollTop > 300) { + css(cbacktop, {display: 'block'}) + } else { + css(cbacktop, {display: 'none'}) + } + }) + // 点击回到顶部按钮 + cbacktop.onclick = function () { + document.documentElement.scrollTop = 0 + } + if (ztheader.length === 0) { + // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 + oDiv.onclick = function () { + if (bnum === 0) { + css(mclassifyCont, {display: 'none'}) + css(csearchDiv, {display: 'block'}) + if (sear.length > 0) { + sear[0].focus() + } + bnum = 1 + nnum = 0 + } else { + if (nnum === 1) { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } else { + css(cnav, {height: 40}) + css(csearchDiv, {display: 'none'}) + bnum = 0 + } + } + } + // 给隐藏的分类 tab 标题添加类样式 + for (let i = 0; i < cmslass.length; i++) { + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + cmslass[i].index = i + } + } + // 点击隐藏的分类 tab 标题切换ul列表数据 + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } + } + } + // 点击顶部分类按钮 + mclassify.onclick = function () { + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}) + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') + } + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) + } + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } + } + } + + /*如果不是手机打开,则跳转到pc页面*/ + var browser1 = { + versions: function () { + let u = navigator.userAgent, app = navigator.appVersion; + return {//移动终端浏览器版本信息 + trident: u.indexOf('Trident') > -1, //IE内核 + presto: u.indexOf('Presto') > -1, //opera内核 + webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, //火狐内核 + mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 + ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 + iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 + iPad: u.indexOf('iPad') > -1, //是否iPad + webApp: u.indexOf('Safari') === -1 //是否web应该程序,没有头部与底部 + }; + } (), + language: (navigator.browserLanguage || navigator.language).toLowerCase() + }; + if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { + //location.href = location.href.replace("m.","www.");//如果不是手机打开,则跳转到pc页面 + window.location='http://www.veryhuo.com' + } + // 判断机型 + let u = navigator.userAgent, app = navigator.appVersion; + let isIphone= !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);//ios终端 true + let iosweb = document.getElementById("iosweb").getAttribute('value'); + let classweb = document.getElementById("classweb").getAttribute('value'); + let isyouxi = document.getElementById("isyouxi").getAttribute('value'); + var type = iosweb === "0"? "2":"3"; + var lm = ''; + if (isIphone) { + if (classweb === '1') { + if (iosweb === '0') { + let url = window.location.href; + if (isyouxi === '1') { + if (url.indexOf("611")!==-1){ + window.location.href='/mip_ddooo_m.rar/list/987.html' + } + } else { + if (url.indexOf("363")!==-1){ + window.location.href='/mip_ddooo_m.rar/list/986.html' + } + } + } + } + lm = 2 + } + else { + if (classweb === '1') { + let url = window.location.href; + if (isyouxi === '1') { + if (url.indexOf("987")!==-1){ + window.location.href='/mip_ddooo_m.rar/list/611.html' + } + } else { //软件 + if (url.indexOf("986")!==-1){ + window.location.href='/mip_ddooo_m.rar/list/363.html' + } + } + } + lm = 1 + } + } +} diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js b/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js index ae9e88304..ddebdd827 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js @@ -6,134 +6,174 @@ const { CustomElement, util } = MIP const { css } = util export default class MIPMhotComment extends CustomElement { - build () { - let bnum = 0 - let nnum = 0 - let PageType = 'asp' - let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] // 隐藏的分类盒子 - let ztheader = this.element.querySelectorAll('.ztheader') - let cSOHUCS = this.element.querySelectorAll('#SOHUCS') - if (cSOHUCS.length > 0) { - if (cSOHUCS[0].attributes['PageType'].value !== undefined) { - PageType = cSOHUCS[0].attributes['PageType'].value - } + build () { + let bnum = 0 + let nnum = 0 + let PageType = '' + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] + let ztheader = this.element.querySelectorAll('.ztheader') + let cSOHUCS = this.element.querySelectorAll('#SOHUCS') + if (cSOHUCS.length > 0) { + if (cSOHUCS[0].attributes['PageType'].value !== undefined) { + PageType = cSOHUCS[0].attributes['PageType'].value + } + } + let oDiv = this.element.querySelectorAll('.SearchBox')[0] + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] + let sear = this.element.querySelectorAll('.searchDiv input') + let cnav = this.element.querySelectorAll('nav')[0] // 导航盒子 + let mclassify = this.element.querySelectorAll('#mclassify')[0] + let pullNav = this.element.querySelectorAll('#nav .pullNav') + let moreNav = this.element.querySelectorAll('#nav .moreNav') + let cmslass = this.element.querySelectorAll('#mclassifyCont p span') + let cul = this.element.querySelectorAll('#mclassifyCont ul') + let fixNav = this.element.querySelector('.fixNav') + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] + let zxNav = this.element.querySelector('#zxNav') + window.addEventListener('scroll', function () { + // 页面滚动一定高度时,显示吸顶导航盒子 + if (document.documentElement.scrollTop > 80) { + css(fixNav, {display: 'block'}) + css(zxNav, {display: 'none'}) + } else if (document.documentElement.scrollTop < 30) { + css(fixNav, {display: 'none'}) + css(zxNav, {display: 'block'}) + } + // 页面滚动一定高度时,显示回到顶部按钮 + if (document.documentElement.scrollTop > 300) { + css(cbacktop, {display: 'block'}) + } else { + css(cbacktop, {display: 'none'}) + } + }) + // 点击回到顶部按钮 + cbacktop.onclick = function () { + document.documentElement.scrollTop = 0 + } + if (ztheader.length === 0) { + // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 + oDiv.onclick = function () { + if (bnum === 0) { + css(mclassifyCont, {display: 'none'}) + css(csearchDiv, {display: 'block'}) + if (sear.length > 0) { + sear[0].focus() + } + bnum = 1 + nnum = 0 + } else { + if (nnum === 1) { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } else { + css(cnav, {height: 40}) + css(csearchDiv, {display: 'none'}) + bnum = 0 + } } - let oDiv = this.element.querySelectorAll('.SearchBox')[0] // 搜索按钮盒子 - let searBtn = this.element.querySelectorAll('.SBBtn button')[0] // 搜索按钮 - let searInp = this.element.querySelectorAll('.SBInp input')[0] // 搜索框 - // let alert = this.element.querySelectorAll('#confirm')[0] //input 提示框 - let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] // 隐藏的搜索框盒子 - let sear = this.element.querySelectorAll('.searchDiv input') // 隐藏的搜索框 - let cnav = this.element.querySelectorAll('nav')[0] // 导航盒子 - let mclassify = this.element.querySelectorAll('#mclassify')[0] // 顶部分类按钮 - let pullNav = this.element.querySelectorAll('#nav .pullNav') - let moreNav = this.element.querySelectorAll('#nav .moreNav') - let cmslass = this.element.querySelectorAll('#mclassifyCont p span') // 分类tab标题 - let cul = this.element.querySelectorAll('#mclassifyCont ul') // 顶部分类盒子 - let fixNav = this.element.querySelector('.fixNav') // 吸顶盒子 - let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] // 回到顶部按钮 - let lookmore = this.element.querySelectorAll('.lookmore') // 查看更多按钮 - let li = this.element.querySelectorAll('.CRCSTitleC li.tab-item') - let zxNav = this.element.querySelector('#zxNav'); - - window.addEventListener('scroll', function () { - // 页面滚动一定高度时,显示吸顶导航盒子 - if (document.documentElement.scrollTop > 80) { - css(fixNav, {display: 'block'}) - css(zxNav, {display: 'none'}) - } else if(document.documentElement.scrollTop < 30) { - css(fixNav, {display: 'none'}) - css(zxNav, {display: 'block'}) + } + // 给隐藏的分类 tab 标题添加类样式 + for (let i = 0; i < cmslass.length; i++) { + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + cmslass[i].index = i } - // 页面滚动一定高度时,显示回到顶部按钮 - if (document.documentElement.scrollTop > 300) { - css(cbacktop, {display: 'block'}) + } + // 点击隐藏的分类 tab 标题切换ul列表数据 + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } + } + } + // 点击顶部分类按钮 + mclassify.onclick = function () { + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}) + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') + } + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) + } + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } + } + } + let zxAs = this.element.querySelectorAll('#zxnav-tit a'); // 获取资讯标题 + let open = this.element.querySelector('.open'); // 展开按钮 + let close = this.element.querySelector('.close'); // 关闭按钮 + let aTit = this.element.querySelectorAll('.aTit'); + open.onclick = function () { + css(zxAs, {display: 'block'}); + css(open, {display: 'none'}) + } + close.onclick = function () { + css(aTit, {display: 'none'}); + css(close, {display: 'none'}); + css(open, {display: 'block'}) + } + // 点击更多按钮 + let btnzx = this.element.querySelector('#btnzx'); // 更多按钮 + let dlist = this.element.querySelector('#dlist'); // ul + let zx_typeid = document.getElementById('zx_typeid').getAttribute('value'); + let zxp1 = 10; + btnzx.onclick = function () { + if (btnzx.innerText === "加载完毕啦,么么哒~") return false + // 创建一个Request对象 + let req = new Request('https://admin.veryhuo.com/mobile/open/archives_more?p='+zxp1+'&typeid='+zx_typeid, { + method: 'GET', + cache: 'reload' + }); + fetch(req).then(function (response) { + return response.json() + }).then(function (data) { + if (data === '') { + btnzx.innerText = '加载完毕啦,么么哒~' + return false + } else { + btnzx.innerText = '加载中...'; + let khtml = ''; + let len = data.length; + for (let i = 0;i < len; i++) { + let dt = data[i]; + if (dt.litpic === '') { + dt.litpic='/images/noimg.png' } else { - css(cbacktop, {display: 'none'}) - } - - }) - // 点击回到顶部按钮 - cbacktop.onclick = function () { - document.documentElement.scrollTop = 0 - }; - - if (ztheader.length === 0) { - // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 - oDiv.onclick = function () { - if (bnum === 0) { - css(mclassifyCont, {display: 'none'}) - css(csearchDiv, {display: 'block'}) - if (sear.length > 0) { - sear[0].focus() - } - bnum = 1 - nnum = 0 - } else { - if (nnum === 1) { - css(mclassifyCont, {display: 'none'}) - nnum = 0 - } else { - css(cnav, {height: 40}) - css(csearchDiv, {display: 'none'}) - bnum = 0 - } - } + var litpic=dt.litpic; + if (litpic.indexOf("article/") !== -1 || litpic.indexOf("default/") !== -1) { + litpic='https://admin.veryhuo.com/upload/'+litpic + } else { + litpic='https://www.veryhuo.com'+litpic + } } - // 给隐藏的分类 tab 标题添加类样式 - for (let i = 0; i < cmslass.length; i++) { - cmslass[i].onclick = function () { - let siblings = this.parentNode.childNodes - for (let i = 0; i < siblings.length; i++) { - if (siblings[i].nodeType === 1) { - siblings[i].className = '' - this.className = 'cur' - cmslass[i].index = i - } - } - // 点击隐藏的分类 tab 标题切换ul列表数据 - if (this.index === 0) { - cul[0].className = 'on' - } else { - cul[0].className = '' - } - if (this.index === 1) { - cul[1].className = 'on' - } else { - cul[1].className = '' - } - } - } - // 点击顶部分类按钮 - mclassify.onclick = function () { - if (nnum === 0) { - css(mclassifyCont, {display: 'block'}) - if (pullNav.length > 0) { - pullNav[0].classList.remove('open') - } - if (moreNav.length > 0) { - css(moreNav[0], {display: 'none'}) - } - nnum = 1 - } else { - css(mclassifyCont, {display: 'none'}) - nnum = 0 - } - } - } - - let zxAs = this.element.querySelectorAll('#zxnav-tit a'); // 获取资讯标题 - let open = this.element.querySelector('.open'); // 展开按钮 - let close = this.element.querySelector('.close'); // 关闭按钮 - let aTit = this.element.querySelectorAll('.aTit'); - open.onclick = function () { - css(zxAs, {display: 'block'}); - css(open, {display: 'none'}); - }; - close.onclick = function () { - css(aTit, {display: 'none'}); - css(close, {display: 'none'}); - css(open, {display: 'block'}); + khtml = document.createElement("li") + khtml.innerHTML = ""+dt.title+"

"+dt.description+"

" + zz += 1; + dlist.appendChild(khtml) + } + if (len < 20) { + btnzx.innerText = '加载完毕啦,么么哒~' + } + else { + btnzx.innerText = '点击有惊喜,萌萌哒~' + } + zxp1 = zxp1 + 20 } + }) } + } } From 485c968389f7e4c15882aa05c3e3143cf8360049 Mon Sep 17 00:00:00 2001 From: liukaidi <2379942411@qq.com> Date: Wed, 14 Aug 2019 14:02:51 +0800 Subject: [PATCH 05/34] =?UTF-8?q?=E6=96=B0=E5=8A=A0=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mip-veryhuo-column/mip-veryhuo-column.js | 207 ++++++++---------- .../mip-veryhuo-index/mip-veryhuo-index.js | 193 ++++++++-------- .../mip-veryhuo-notfound.js | 2 +- .../mip-veryhuo-rank/mip-veryhuo-rank.js | 165 +++++++------- .../mip-veryhuo-special.js | 70 +++--- .../mip-veryhuo-zx/mip-veryhuo-zx.js | 61 +++--- 6 files changed, 324 insertions(+), 374 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js b/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js index 7e26d010a..db16d6635 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js @@ -2,7 +2,6 @@ * @file 评论模块 * @author fl */ -import fetchJsonp from 'fetch-jsonp' const { CustomElement, util } = MIP const { css } = util @@ -11,7 +10,7 @@ export default class MIPMhotComment extends CustomElement { build () { let bnum = 0 let nnum = 0 - let PageType = '' + // let PageType = '' let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] let ztheader = this.element.querySelectorAll('.ztheader') let cSOHUCS = this.element.querySelectorAll('#SOHUCS') @@ -35,26 +34,26 @@ export default class MIPMhotComment extends CustomElement { let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] let zxNav = this.element.querySelector('#zxNav') searBtn.onclick = function () { - if(oDiv.length === 0) { - css(alert, {display:'block'}) - }else { - css(alert, {display:'none'}) + if (oDiv.length === 0) { + css(alert, { display: 'block'}) + } else { + css(alert, { display: 'block'}) } } window.addEventListener('scroll', function () { // 页面滚动一定高度时,显示吸顶导航盒子 if (document.documentElement.scrollTop > 80) { - css(fixNav, {display: 'block'}) - css(zxNav, {display: 'none'}) + css(fixNav, { display: 'block'}) + css(zxNav, { display: 'none'}) } else if (document.documentElement.scrollTop < 30) { - css(fixNav, {display: 'none'}) - css(zxNav, {display: 'block'}) + css(fixNav, { display: 'none'}) + css(zxNav, { display: 'block'}) } // 页面滚动一定高度时,显示回到顶部按钮 if (document.documentElement.scrollTop > 300) { - css(cbacktop, {display: 'block'}) + css(cbacktop, { display: 'block'}) } else { - css(cbacktop, {display: 'none'}) + css(cbacktop, { display: 'none'}) } }) // 点击回到顶部按钮 @@ -65,8 +64,8 @@ export default class MIPMhotComment extends CustomElement { // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 oDiv.onclick = function () { if (bnum === 0) { - css(mclassifyCont, {display: 'none'}) - css(csearchDiv, {display: 'block'}) + css(mclassifyCont, { display: 'none'}) + css(csearchDiv, { display: 'block'}) if (sear.length > 0) { sear[0].focus() } @@ -74,11 +73,11 @@ export default class MIPMhotComment extends CustomElement { nnum = 0 } else { if (nnum === 1) { - css(mclassifyCont, {display: 'none'}) + css(mclassifyCont, { display: 'none'}) nnum = 0 } else { css(cnav, {height: 40}) - css(csearchDiv, {display: 'none'}) + css(csearchDiv, { display: 'none'}) bnum = 0 } } @@ -110,83 +109,81 @@ export default class MIPMhotComment extends CustomElement { // 点击顶部分类按钮 mclassify.onclick = function () { if (nnum === 0) { - css(mclassifyCont, {display: 'block'}) + css(mclassifyCont, { display: 'block'}) if (pullNav.length > 0) { pullNav[0].classList.remove('open') } if (moreNav.length > 0) { - css(moreNav[0], {display: 'none'}) + css(moreNav[0], { display: 'none'}) } nnum = 1 } else { - css(mclassifyCont, {display: 'none'}) + css(mclassifyCont, { display: 'none'}) nnum = 0 } } } - /*如果不是手机打开,则跳转到pc页面*/ + // 如果不是手机打开,则跳转到pc页面 let browser1 = { versions: function () { - let u = navigator.userAgent, app = navigator.appVersion; - return {//移动终端浏览器版本信息 - trident: u.indexOf('Trident') > -1, //IE内核 - presto: u.indexOf('Presto') > -1, //opera内核 - webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 - gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, //火狐内核 + let u = navigator.userAgent + return { + trident: u.indexOf('Trident') > -1, + presto: u.indexOf('Presto') > -1, + webKit: u.indexOf('AppleWebKit') > -1, + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 - ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 - android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 - iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 - iPad: u.indexOf('iPad') > -1, //是否iPad - webApp: u.indexOf('Safari') === -1 //是否web应该程序,没有头部与底部 - }; - } (), + ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, + iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, + iPad: u.indexOf('iPad') > -1, + webApp: u.indexOf('Safari') === -1 + } + }(), language: (navigator.browserLanguage || navigator.language).toLowerCase() - }; + } if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { - let pcurl = location.href.replace("m.","www.");//如果不是手机打开,则跳转到pc页面 - if(location.href.indexOf("/androidsoft.html")>-1) { - location.href=pcurl + let pcurl = location.href.replace('m.', 'www.') + if (location.href.indexOf('/androidsoft.html') > -1) { + location.href = pcurl } - if(location.href.indexOf("/down/class/")>-1) { - location.href=pcurl + if (location.href.indexOf('/down/class/') > -1) { + location.href = pcurl } } // 机型判断 - let u = navigator.userAgent, app = navigator.appVersion; - let isIphone= !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) //ios终端 - var lm = ''; - let typeid = document.getElementById('typeid').getAttribute('value'); - let classweb = document.getElementById('classweb').getAttribute('value'); - let typename = document.getElementById('typename').getAttribute('value'); - let isios = document.getElementById('isios').getAttribute('value'); - let classid = document.getElementById('classid').getAttribute('value'); + let u = navigator.userAgent + let isIphone= !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) + let typeid = document.getElementById('typeid').getAttribute('value') + let classweb = document.getElementById('classweb').getAttribute('value') + var typename = document.getElementById('typename').getAttribute('value') + let isios = document.getElementById('isios').getAttribute('value') + let classid = document.getElementById('classid').getAttribute('value') let type = isios === '0' ? '2' : '3' if (isIphone) { if (classweb === '2') { - let azurl=window.location.href - let azurlarr=azurl.split("/") - let azurlid=azurlarr[5].replace(".html","") - if(isios==='0'){ - azurl=azurl.replace(azurlid,classid) - window.location.href=azurl + let azurl = window.location.href + let azurlarr = azurl.split('/') + let azurlid = azurlarr[5].replace('.html', '') + if(isios === '0'){ + azurl = azurl.replace(azurlid, classid) + window.location.href = azurl } } - lm = 2 + let lm = 2 } else { if (classweb === '2') { - let azurl=window.location.href - let azurlarr=azurl.split("/") - let azurlid=azurlarr[5].replace(".html","") - if (isios==='1') { - azurl=azurl.replace(azurlid,classid) - window.location.href=azurl + let azurl = window.location.href + let azurlarr = azurl.split('/') + let azurlid = azurlarr[5].replace('.html', '') + if (isios === '1') { + azurl = azurl.replace(azurlid, classid) + window.location.href = azurl } } - lm = 1 + let lm = 1 } - console.log(type); let btn1 = this.element.querySelector('#btn1') let btn2 = this.element.querySelector('#btn2') let btn3 = this.element.querySelector('#btn3') @@ -194,11 +191,10 @@ export default class MIPMhotComment extends CustomElement { let lists2 = this.element.querySelector('.lists2') let lists3 = this.element.querySelector('.lists3') let p = 10 - let zz = 13 btn1.onclick = function () { - if(btn1.innerText === "加载完毕啦") return false; + if (btn1.innerText === '加载完毕啦') return false // 创建一个Request对象 - let req = new Request('https://admin.veryhuo.com/mobile/open/list_more_zuixin?type='+type+'&p='+p+'&type_id='+typeid,{ + let req = new Request('https://admin.veryhuo.com/mobile/open/list_more_zuixin?type='+ type + '&p='+ p + '&type_id=' + typeid, { method: 'GET', cache: 'reload' }); @@ -210,47 +206,36 @@ export default class MIPMhotComment extends CustomElement { return false } else { btn1.innerText = '加载中...' - let khtml = ''; - let len = data.length; - for (let i = 0;i < len; i++) { - let dt = data[i]; + let khtml = '' + let len = data.length + for (let i = 0; i < len; i++) { + let dt = data[i] if (dt.litpic === '') { - dt.litpic='/images/nologo.png' + dt.litpic ='/images/nologo.png' } if (dt.version === 0) { dt.version = dt.os } else { - dt.softrank=5 + dt.softrank = 5 } - khtml = document.createElement("li") - khtml.innerHTML = "

"+dt.title+""+typename+"|"+dt.version+"|"+dt.softsize+"

下载" + khtml = document.createElement('li') + khtml.innerHTML = "

"+ dt.title + "" + typename + "|" + dt.version + "|" + dt.softsize + "

下载" zz += 1 lists1.appendChild(khtml) } if (len < 10) { btn1.innerText = '加载完毕啦,么么哒~' - } - else { + } else { btn1.innerText = '点击有惊喜,萌萌哒~' } p = p + 30 } - // 将时间戳转换成 yy-mm-dd - function to_date (phpstr) { - let str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000 - let newDate = new Date(str); - let yy = newDate.getUTCFullYear();//取年份 - let mm = newDate.getUTCMonth() + 1;//取月份 - let dd = newDate.getUTCDate();//取天数 - return yy + "-" + mm + "-" + dd;//拼接 - } }) } let hqp = 10 btn2.onclick = function () { - if(btn2.innerText === "加载完毕啦") return false; - // 创建一个Request对象 - let req = new Request('https://admin.veryhuo.com/mobile/open/list_more_zuire?type='+type+'&p='+hqp+'&type_id='+typeNum,{ + if(btn2.innerText === "加载完毕啦") return false + let req = new Request('https://admin.veryhuo.com/mobile/open/list_more_zuire?type='+ type +'&p='+ hqp +'&type_id=' + typeNum, { method: 'GET', cache: 'reload' }); @@ -258,24 +243,24 @@ export default class MIPMhotComment extends CustomElement { return response.json() }).then(function (data) { if (data === '') { - btn2.innerText = '加载完毕啦,么么哒~'; + btn2.innerText = '加载完毕啦,么么哒~' return false } else { - btn2.innerText = '加载中...'; - let rhtml = ''; - let len = data.length; - for (let i = 0;i < len; i++) { - let dt = data[i]; + btn2.innerText = '加载中...' + let rhtml = '' + let len = data.length + for (let i = 0; i < len; i++) { + let dt = data[i] console.log(dt) if (dt.litpic === '') { - dt.litpic='/images/nologo.png' + dt.litpic = '/images/nologo.png' } else { - dt.litpic='https://www.veryhuo.com'+dt.litpic + dt.litpic = 'https://www.veryhuo.com'+ dt.litpic } if (dt.version === 0) { dt.version = dt.os } else { - dt.softrank=5 + dt.softrank = 5 } rhtml = document.createElement("li") rhtml.innerHTML = "

"+dt.title+""+value+"|"+dt.version+"|"+dt.softsize+"

下载" @@ -290,15 +275,6 @@ export default class MIPMhotComment extends CustomElement { } hqp = hqp + 30 } - // 将时间戳转换成 yy-mm-dd - function to_date (phpstr) { - let str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000 - let newDate = new Date(str); - let yy = newDate.getUTCFullYear();//取年份 - let mm = newDate.getUTCMonth() + 1;//取月份 - let dd = newDate.getUTCDate();//取天数 - return yy + "-" + mm + "-" + dd;//拼接 - } }); }; let zxp = 10 @@ -325,15 +301,15 @@ export default class MIPMhotComment extends CustomElement { if (dt.litpic === '') { dt.litpic='/images/nologo.png' } else { - dt.litpic='https://www.veryhuo.com'+dt.litpic + dt.litpic = 'https://www.veryhuo.com' + dt.litpic } if (dt.version === 0) { dt.version = dt.os } else { - dt.softrank=5 + dt.softrank = 5 } - phtml = document.createElement("li") - phtml.innerHTML = "

"+dt.title+""+value+"|"+dt.version+"|"+dt.softsize+"

下载" + phtml = document.createElement('li') + phtml.innerHTML = "

" + dt.title + "" + value + "|" + dt.version + "|" + dt.softsize + "

下载" zz += 1; lists3.appendChild(phtml) } @@ -345,16 +321,7 @@ export default class MIPMhotComment extends CustomElement { } zxp = zxp + 30 } - // 将时间戳转换成 yy-mm-dd - function to_date (phpstr) { - let str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000 - let newDate = new Date(str); - let yy = newDate.getUTCFullYear();//取年份 - let mm = newDate.getUTCMonth() + 1;//取月份 - let dd = newDate.getUTCDate();//取天数 - return yy + "-" + mm + "-" + dd;//拼接 - } - }); - }; + }) + } } } diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js index 0cd7bc031..46922fd0d 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js @@ -2,88 +2,87 @@ * @file 评论模块 * @author fl */ -import fetchJsonp from 'fetch-jsonp' -const { CustomElement, util } = MIP; -const { css } = util; +const { CustomElement, util } = MIP +const { css } = util export default class MIPMhotComment extends CustomElement { build () { - let bnum = 0; - let nnum = 0; - let PageType = ''; - let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0]; - let ztheader = this.element.querySelectorAll('.ztheader'); - let cSOHUCS = this.element.querySelectorAll('#SOHUCS'); + let bnum = 0 + let nnum = 0 + // let PageType = ''; + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] + let ztheader = this.element.querySelectorAll('.ztheader') + let cSOHUCS = this.element.querySelectorAll('#SOHUCS') if (cSOHUCS.length > 0) { if (cSOHUCS[0].attributes['PageType'].value !== undefined) { PageType = cSOHUCS[0].attributes['PageType'].value } } - let oDiv = this.element.querySelectorAll('.SearchBox')[0]; - let searBtn = this.element.querySelectorAll('.SBBtn button')[0]; - let alert = this.element.querySelectorAll('#confirm')[0]; - let csearchDiv = this.element.querySelectorAll('.searchDiv')[0]; - let sear = this.element.querySelectorAll('.searchDiv input'); - let cnav = this.element.querySelectorAll('nav')[0]; - let mclassify = this.element.querySelectorAll('#mclassify')[0]; - let pullNav = this.element.querySelectorAll('#nav .pullNav'); - let moreNav = this.element.querySelectorAll('#nav .moreNav'); - let cmslass = this.element.querySelectorAll('#mclassifyCont p span'); - let cul = this.element.querySelectorAll('#mclassifyCont ul'); - let fixNav = this.element.querySelector('.fixNav'); - let cbacktop = this.element.querySelectorAll('#Cbacktop')[0]; - let zxNav = this.element.querySelector('#zxNav'); + let oDiv = this.element.querySelectorAll('.SearchBox')[0] + let searBtn = this.element.querySelectorAll('.SBBtn button')[0] + let alert = this.element.querySelectorAll('#confirm')[0] + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] + let sear = this.element.querySelectorAll('.searchDiv input') + let cnav = this.element.querySelectorAll('nav')[0] + let mclassify = this.element.querySelectorAll('#mclassify')[0] + let pullNav = this.element.querySelectorAll('#nav .pullNav') + let moreNav = this.element.querySelectorAll('#nav .moreNav') + let cmslass = this.element.querySelectorAll('#mclassifyCont p span') + let cul = this.element.querySelectorAll('#mclassifyCont ul') + let fixNav = this.element.querySelector('.fixNav') + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] + let zxNav = this.element.querySelector('#zxNav') if (searBtn !== undefined) { searBtn.onclick = function () { if (oDiv.length === 0) { - css(alert, { display: 'block'}) + css(alert, { display: 'block' }) } else { - css(alert, { display: 'none'}) + css(alert, { display: 'none' }) } } } window.addEventListener('scroll', function () { // 页面滚动一定高度时,显示吸顶导航盒子 if (document.documentElement.scrollTop > 80) { - css(fixNav, { display: 'block'}); - css(zxNav, { display: 'none'}) - } else if(document.documentElement.scrollTop < 30) { - css(fixNav, { display: 'none'}); - css(zxNav, { display: 'block'}) + css(fixNav, { display: 'block' }) + css(zxNav, { display: 'none' }) + } else if (document.documentElement.scrollTop < 30) { + css(fixNav, { display: 'none' }) + css(zxNav, { display: 'block' }) } // 页面滚动一定高度时,显示回到顶部按钮 if (document.documentElement.scrollTop > 300) { - css(cbacktop, { display: 'block'}) + css(cbacktop, { display: 'block' }) } else { - css(cbacktop, { display: 'none'}) + css(cbacktop, { display: 'none' }) } - }); + }) // 点击回到顶部按钮 if (cbacktop !== undefined) { cbacktop.onclick = function () { document.documentElement.scrollTop = 0 } } - if (ztheader !==undefined && ztheader.length === 0) { + if (ztheader !== undefined && ztheader.length === 0) { // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 - if (oDiv!==undefined) { + if (oDiv !== undefined) { oDiv.onclick = function () { if (bnum === 0) { - css(mclassifyCont, { display: 'none'}); - css(csearchDiv, { display: 'block'}); + css(mclassifyCont, { display: 'none' }) + css(csearchDiv, { display: 'block' }) if (sear.length > 0) { sear[0].focus() } - bnum = 1; + bnum = 1 nnum = 0 } else { if (nnum === 1) { - css(mclassifyCont, { display: 'none'}); + css(mclassifyCont, { display: 'none' }) nnum = 0 } else { - css(cnav, {height: 40}); - css(csearchDiv, {display: 'none'}); + css(cnav, {height: 40}) + css(csearchDiv, {display: 'none' }) bnum = 0 } } @@ -95,8 +94,8 @@ export default class MIPMhotComment extends CustomElement { let siblings = this.parentNode.childNodes; for (let i = 0; i < siblings.length; i++) { if (siblings[i].nodeType === 1) { - siblings[i].className = ''; - this.className = 'cur'; + siblings[i].className = '' + this.className = 'cur' cmslass[i].index = i } } @@ -114,113 +113,109 @@ export default class MIPMhotComment extends CustomElement { } } // 点击顶部分类按钮 - if (mclassify!== undefined) { + if (mclassify !== undefined) { mclassify.onclick = function () { if (nnum === 0) { - css(mclassifyCont, {display: 'block'}); + css(mclassifyCont, { display: 'block' }) if (pullNav.length > 0) { pullNav[0].classList.remove('open') } if (moreNav.length > 0) { - css(moreNav[0], {display: 'none'}) + css(moreNav[0], { display: 'none'}) } nnum = 1 } else { - css(mclassifyCont, {display: 'none'}); + css(mclassifyCont, { display: 'none'}) nnum = 0 } } } } - /*如果不是手机打开,则跳转到pc页面*/ - var browser1 = { + //如果不是手机打开,则跳转到pc页面 + let browser1 = { versions: function () { - let u = navigator.userAgent, app = navigator.appVersion; - return {//移动终端浏览器版本信息 - trident: u.indexOf('Trident') > -1, //IE内核 - presto: u.indexOf('Presto') > -1, //opera内核 - webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 - gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, //火狐内核 + let u = navigator.userAgent + return { + trident: u.indexOf('Trident') > -1, + presto: u.indexOf('Presto') > -1, + webKit: u.indexOf('AppleWebKit') > -1, + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 - ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 - android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 - iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 - iPad: u.indexOf('iPad') > -1, //是否iPad - webApp: u.indexOf('Safari') === -1 //是否web应该程序,没有头部与底部 - }; - } (), + ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, + iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, + iPad: u.indexOf('iPad') > -1, + webApp: u.indexOf('Safari') === -1 + } + }(), language: (navigator.browserLanguage || navigator.language).toLowerCase() - }; + } if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { - //location.href = location.href.replace("m.","www.");//如果不是手机打开,则跳转到pc页面 - window.location='http://www.veryhuo.com' + window.location = 'http://www.veryhuo.com' } // 判断机型 - let u = navigator.userAgent, app = navigator.appVersion; - let isIphone= !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 true - var lm = ''; - let iosweb = document.getElementById("iosweb").getAttribute("value");//0是安卓 1是苹果 - var type = iosweb === "0"? "2":"3"; + let u = navigator.userAgent + let isIphone = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) + let iosweb = document.getElementById('iosweb').getAttribute('value') + let type = iosweb === '0'? '2':'3' if (isIphone) { - if (iosweb === '0'){ //az - window.stop ? window.stop() : document.execCommand("Stop"); - window.location.href = "/mip_ddooo_m.rar/apple/index.html"; + if (iosweb === '0') { + window.stop ? window.stop() : document.execCommand('Stop') + window.location.href = '/mip_ddooo_m.rar/apple/index.html' } - lm = 2 - } - else if(iosweb === '1'){ - window.stop ? window.stop() : document.execCommand("Stop"); - window.location.href = "/mip_ddooo_m.rar/index.html" - lm = 1 + let lm = 2 + } else if (iosweb === '1') { + window.stop ? window.stop() : document.execCommand('Stop') + window.location.href = '/mip_ddooo_m.rar/index.html' + let lm = 1 } console.log(type); - let moreBtn = this.element.querySelector('#moreApp'); // 更多按钮 - let iList = this.element.querySelector('.Apply .iList'); // ul + let moreBtn = this.element.querySelector('#moreApp') + let iList = this.element.querySelector('.Apply .iList') // 发送请求 - let p = 15; - let doing = 0; - if(moreBtn!=undefined) { + let p = 15 + let doing = 0 + if (moreBtn !== undefined) { moreBtn.onclick = function () { - if (doing === 1) return false; + if (doing === 1) return false // 创建一个Request对象 let req = new Request('http://admin.veryhuo.com/mobile/open/more_soft?type=' + type + '&p=' + p, { method: 'GET', cache: 'reload' - }); + }) fetch(req).then(function (response) { return response.json() }).then(function (data) { if (data === '') { - moreBtn.innerText = '加载完毕啦,么么哒~'; + moreBtn.innerText = '加载完毕啦,么么哒~' return false; } else { - moreBtn.innerText = '加载中...'; + moreBtn.innerText = '加载中...' let khtml = ''; let len = data.length; for (let i = 0; i < len; i++) { let dt = data[i] - dt.pubdate = to_date(dt.pubdate); - khtml = document.createElement("li") + dt.pubdate = to_date(dt.pubdate) + khtml = document.createElement('li') khtml.innerHTML = "

" + dt.title + "" + dt.typename + "" + dt.softsize + "" + dt.os + "" + dt.pubdate + "

下载" iList.appendChild(khtml) } if (len < 20) { doing = 1 moreBtn.innerText = '加载完毕啦,么么哒~' - } - else { + } else { moreBtn.innerText = '点击有惊喜,萌萌哒~' } p = p + 30 } // 将时间戳转换成 yy-mm-dd - function to_date (phpstr) { - let str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000 - let newDate = new Date(str); - let yy = newDate.getUTCFullYear();//取年份 - let mm = newDate.getUTCMonth() + 1;//取月份 - let dd = newDate.getUTCDate();//取天数 - return yy + "-" + mm + "-" + dd;//拼接 + function to_date(phpstr) { + let str = parseInt(phpstr) * 1000 + let newDate = new Date(str) + let yy = newDate.getUTCFullYear() + let mm = newDate.getUTCMonth() + 1 + let dd = newDate.getUTCDate() + return yy + "-" + mm + "-" + dd } }) } diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js index 78eb628db..ba76bc335 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js @@ -1,4 +1,4 @@ -const { CustomElement, util } = MIP; +const { CustomElement} = MIP export default class MIPMhotComment extends CustomElement { build () { diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js b/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js index 11f0eb54c..edbbbc165 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js @@ -1,30 +1,30 @@ -const { CustomElement, util } = MIP; -const { css } = util; +const { CustomElement, util } = MIP +const { css } = util export default class MIPMhotComment extends CustomElement { build () { - let bnum = 0; - let nnum = 0; - let PageType = ''; - let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0]; - let ztheader = this.element.querySelectorAll('.ztheader'); - let cSOHUCS = this.element.querySelectorAll('#SOHUCS'); + let bnum = 0 + let nnum = 0 + // let PageType = ''; + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] + let ztheader = this.element.querySelectorAll('.ztheader') + let cSOHUCS = this.element.querySelectorAll('#SOHUCS') if (cSOHUCS.length > 0) { if (cSOHUCS[0].attributes['PageType'].value !== undefined) { PageType = cSOHUCS[0].attributes['PageType'].value } } - let oDiv = this.element.querySelectorAll('.SearchBox')[0]; - let csearchDiv = this.element.querySelectorAll('.searchDiv')[0]; - let sear = this.element.querySelectorAll('.searchDiv input'); - let cnav = this.element.querySelectorAll('nav')[0]; - let mclassify = this.element.querySelectorAll('#mclassify')[0]; - let pullNav = this.element.querySelectorAll('#nav .pullNav'); - let moreNav = this.element.querySelectorAll('#nav .moreNav'); - let cmslass = this.element.querySelectorAll('#mclassifyCont p span'); - let cul = this.element.querySelectorAll('#mclassifyCont ul'); - let fixNav = this.element.querySelector('.fixNav'); - let cbacktop = this.element.querySelectorAll('#Cbacktop')[0]; + let oDiv = this.element.querySelectorAll('.SearchBox')[0] + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] + let sear = this.element.querySelectorAll('.searchDiv input') + let cnav = this.element.querySelectorAll('nav')[0] + let mclassify = this.element.querySelectorAll('#mclassify')[0] + let pullNav = this.element.querySelectorAll('#nav .pullNav') + let moreNav = this.element.querySelectorAll('#nav .moreNav') + let cmslass = this.element.querySelectorAll('#mclassifyCont p span') + let cul = this.element.querySelectorAll('#mclassifyCont ul') + let fixNav = this.element.querySelector('.fixNav') + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] window.addEventListener('scroll', function () { // 页面滚动一定高度时,显示吸顶导航盒子 if (document.documentElement.scrollTop > 80) { @@ -38,11 +38,11 @@ export default class MIPMhotComment extends CustomElement { } else { css(cbacktop, {display: 'none'}) } - }); + }) // 点击回到顶部按钮 cbacktop.onclick = function () { document.documentElement.scrollTop = 0 - }; + } // 分类内容 if (ztheader.length === 0) { // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 @@ -65,7 +65,7 @@ export default class MIPMhotComment extends CustomElement { bnum = 0 } } - }; + } // 给隐藏的分类 tab 标题添加类样式 for (let i = 0; i < cmslass.length; i++) { cmslass[i].onclick = function () { @@ -108,12 +108,12 @@ export default class MIPMhotComment extends CustomElement { } } // 点击排行页的 箭头,实现显示隐藏功能 - let zk = this.element.querySelector('.zk'); // 下箭头 - let sq = this.element.querySelector('.sq'); // 上箭头 - let rankA = this.element.querySelectorAll('.topnav a'); // 所有标题 - let hides = this.element.querySelectorAll('.isHide'); + let zk = this.element.querySelector('.zk') + let sq = this.element.querySelector('.sq') + let rankA = this.element.querySelectorAll('.topnav a') + let hides = this.element.querySelectorAll('.isHide') zk.onclick = function () { - css(rankA, {display: 'block'}); + css(rankA, {display: 'block'}) css(zk, {display: 'none'}) }; sq.onclick = function () { @@ -121,99 +121,92 @@ export default class MIPMhotComment extends CustomElement { css(sq, {display: 'none'}) css(zk, {display: 'block'}) }; - /*如果不是手机打开,则跳转到pc页面*/ - var browser1 = { + //如果不是手机打开,则跳转到pc页面 + let browser1 = { versions: function () { - let u = navigator.userAgent, app = navigator.appVersion; - return {//移动终端浏览器版本信息 - trident: u.indexOf('Trident') > -1, //IE内核 - presto: u.indexOf('Presto') > -1, //opera内核 - webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 - gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, //火狐内核 + let u = navigator.userAgent + return { + trident: u.indexOf('Trident') > -1, + presto: u.indexOf('Presto') > -1, + webKit: u.indexOf('AppleWebKit') > -1, + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 - ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 - android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 - iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 - iPad: u.indexOf('iPad') > -1, //是否iPad - webApp: u.indexOf('Safari') === -1 //是否web应该程序,没有头部与底部 - }; - } (), + ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, + iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, + iPad: u.indexOf('iPad') > -1, + webApp: u.indexOf('Safari') === -1 + } + }(), language: (navigator.browserLanguage || navigator.language).toLowerCase() - }; + } if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { - //location.href = location.href.replace("m.","www.");//如果不是手机打开,则跳转到pc页面 - window.location='http://www.veryhuo.com' + window.location = 'http://www.veryhuo.com' } // 机型判断 - let u = navigator.userAgent, app = navigator.appVersion; - let isIphone= !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) //ios终端 - var iosweb = document.getElementById('iosweb').getAttribute('value'); - var classweb = document.getElementById('classweb').getAttribute('value'); - var isyouxi = document.getElementById('isyouxi').getAttribute('value'); - var typeid = document.getElementById('typeid').getAttribute('value'); - var type = iosweb === '0' ? '2' : '3' - var lm = ''; + let u = navigator.userAgent + let isIphone = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) + let iosweb = document.getElementById('iosweb').getAttribute('value') + let classweb = document.getElementById('classweb').getAttribute('value') + let isyouxi = document.getElementById('isyouxi').getAttribute('value') + let typeid = document.getElementById('typeid').getAttribute('value') + let type = iosweb === '0' ? '2' : '3' if (isIphone) { if (classweb === '0') { if (iosweb === '0') { - window.stop ? window.stop() : document.execCommand("Stop") + window.stop ? window.stop() : document.execCommand('Stop') if (isyouxi === '1') { - window.location.href = "/mip_ddooo_m.rar/apple/rank.html" - } - else if (isyouxi === '2') { - window.location.href = "/mip_ddooo_m.rar/apple/game.html" - } - else { - window.location.href = "/mip_ddooo_m.rar/apple/soft.html" + window.location.href = '/mip_ddooo_m.rar/apple/rank.html' + } else if (isyouxi === '2') { + window.location.href = '/mip_ddooo_m.rar/apple/game.html' + } else { + window.location.href = '/mip_ddooo_m.rar/apple/soft.html' } } } - lm = 2 + let lm = 2 } - else if(iosweb === '1'){ + else if (iosweb === '1') { if (isyouxi === '1') { - window.location.href = "/mip_ddooo_m.rar/rank.html"; - } - else if (isyouxi === '2') { - window.location.href = "/mip_ddooo_m.rar/game.html" - } - else { - window.location.href = "/mip_ddooo_m.rar/soft.html" + window.location.href = '/mip_ddooo_m.rar/rank.html' + } else if (isyouxi === '2') { + window.location.href = '/mip_ddooo_m.rar/game.html' + } else { + window.location.href = '/mip_ddooo_m.rar/soft.html' } - lm = 1 + let lm = 1 } - // 点击加载更多 - let btn1 = this.element.querySelector('#btn1'); - let more = this.element.querySelector('#more'); - let pp = 12; - let zz = 13; + let btn1 = this.element.querySelector('#btn1') + let more = this.element.querySelector('#more') + let pp = 12 + let zz = 13 btn1.onclick = function () { - if (btn1.innerText === "加载完毕啦,么么哒~") return false + if (btn1.innerText === '加载完毕啦,么么哒~') return false // 创建一个Request对象 - let req = new Request('https://admin.veryhuo.com/mobile/open/phb_more?os='+type+'&type='+isyouxi+'&p='+pp+'&typeid='+typeid, { + let req = new Request('https://admin.veryhuo.com/mobile/open/phb_more?os=' + type + '&type=' + isyouxi + '&p=' + pp + '&typeid=' + typeid, { method: 'GET', cache: 'reload' - }); + }) fetch(req).then(function (response) { return response.json() - }).then(function(data) { + }).then(function (data) { if (data === '') { btn1.innerText = '加载完毕啦,么么哒~' return false - }else{ + } else { btn1.innerText = '加载中...' - let khtml = ''; - let len = data.length; - for (let i = 0;i < len; i++) { + let khtml = '' + let len = data.length + for (let i = 0; i < len; i++) { let dt = data[i] - if(dt.version === 0) { + if (dt.version === 0) { dt.version = dt.os } else { dt.softrank = 5 } khtml = document.createElement("li") - khtml.innerHTML = "

"+zz+""+dt.title+""+dt.typename+""+dt.softsize+""+dt.version+"

下载"; + khtml.innerHTML = "

" + zz + "" + dt.title + "" + dt.typename + "" + dt.softsize + "" + dt.version + "

下载" zz += 1 more.appendChild(khtml) } diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js b/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js index e78815810..5f538a1cb 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js @@ -9,7 +9,7 @@ export default class MIPMhotComment extends CustomElement { build () { let bnum = 0 let nnum = 0 - let PageType = '' + // let PageType = '' let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] let ztheader = this.element.querySelectorAll('.ztheader') let cSOHUCS = this.element.querySelectorAll('#SOHUCS') @@ -21,7 +21,7 @@ export default class MIPMhotComment extends CustomElement { let oDiv = this.element.querySelectorAll('.SearchBox')[0] let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] let sear = this.element.querySelectorAll('.searchDiv input') - let cnav = this.element.querySelectorAll('nav')[0] // 导航盒子 + let cnav = this.element.querySelectorAll('nav')[0] let mclassify = this.element.querySelectorAll('#mclassify')[0] let pullNav = this.element.querySelectorAll('#nav .pullNav') let moreNav = this.element.querySelectorAll('#nav .moreNav') @@ -46,7 +46,7 @@ export default class MIPMhotComment extends CustomElement { // 点击回到顶部按钮 cbacktop.onclick = function () { document.documentElement.scrollTop = 0 - }; + } if (ztheader.length === 0) { // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 oDiv.onclick = function () { @@ -110,13 +110,13 @@ export default class MIPMhotComment extends CustomElement { } } } - let lis = this.element.querySelectorAll('.hqnav i'); - let uls = this.element.querySelectorAll('.speContent'); + let lis = this.element.querySelectorAll('.hqnav i') + let uls = this.element.querySelectorAll('.speContent') for (let i = 0; i < lis.length; i++) { - lis[i].id = i; + lis[i].id = i lis[i].onclick = function () { for (let j = 0; j < lis.length; j++) { - lis[j].className = ''; + lis[j].className = '' uls[j].style.display = 'none' } this.className = 'cur' @@ -124,16 +124,15 @@ export default class MIPMhotComment extends CustomElement { } } // 点击更多按钮 - let btn1 = this.element.querySelector('#btn1'); - let btn2 = this.element.querySelector('#btn2'); - let specG = this.element.querySelector('#spec-game'); - let specS = this.element.querySelector('#spec-soft'); + let btn1 = this.element.querySelector('#btn1') + let btn2 = this.element.querySelector('#btn2') + let specG = this.element.querySelector('#spec-game') + let specS = this.element.querySelector('#spec-soft') let sp1 = 20 - let zz = 13 btn1.onclick = function () { - if (btn1.innerText === '加载完毕啦,么么哒~') return false; + if (btn1.innerText === '加载完毕啦,么么哒~') return false // 创建一个Request对象 - let req = new Request('https://admin.veryhuo.com/mobile/open/spec_more?type=1&p='+sp1, { + let req = new Request('https://admin.veryhuo.com/mobile/open/spec_more?type=1&p=' + sp1, { method: 'GET', cache: 'reload' }); @@ -143,52 +142,50 @@ export default class MIPMhotComment extends CustomElement { if (data === '') { btn1.innerText = '加载完毕啦,么么哒~' return false - }else{ + } else { btn1.innerText = '加载中...' - let khtml = ''; - let len = data.length; - for (let i = 0;i < len; i++) { - let dt = data[i]; + let khtml = '' + let len = data.length + for (let i = 0; i < len; i++) { + let dt = data[i] console.log(dt) if (dt.litpic === '') { dt.litpic = '/images/nologo.png' } else { - dt.litpic='https://admin.veryhuo.com/upload/'+dt.litpic + dt.litpic='https://admin.veryhuo.com/upload/' + dt.litpic } khtml = document.createElement("li") - khtml.innerHTML = "

"+dt.title+"

" - zz += 1; + khtml.innerHTML = "

" + dt.title + "

" + zz += 1 specG.appendChild(khtml) } if (len < 20) { btn1.innerText = '加载完毕啦,么么哒~' - } - else { + } else { btn1.innerText = '点击有惊喜,萌萌哒~' } sp1 = sp1 + 20 } }); } - let sp2 = 20; + let sp2 = 20 btn2.onclick = function () { if (btn2.innerText === '加载完毕啦,么么哒~') return false - // 创建一个Request对象 - let req = new Request('https://admin.veryhuo.com/mobile/open/spec_more?type=2&p='+sp2, { + let req = new Request('https://admin.veryhuo.com/mobile/open/spec_more?type=2&p=' + sp2, { method: 'GET', cache: 'reload' - }); + }) fetch(req).then(function (response) { return response.json() - }).then(function(data) { + }).then(function (data) { if (data === '') { - btn2.innerText = '加载完毕啦,么么哒~'; + btn2.innerText = '加载完毕啦,么么哒~' return false - }else{ + } else { btn2.innerText = '加载中...' - let shtml = ''; + let shtml = '' let len = data.length - for (let i = 0;i < len; i++) { + for (let i = 0; i < len; i++) { let dt = data[i] console.log(dt) if (dt.litpic === '') { @@ -196,15 +193,14 @@ export default class MIPMhotComment extends CustomElement { } else { dt.litpic='https://admin.veryhuo.com/upload/'+dt.litpic } - shtml = document.createElement("li") - shtml.innerHTML = "

"+dt.title+"

"; + shtml = document.createElement('li') + shtml.innerHTML = "

" + dt.title + "

" zz += 1 specS.appendChild(shtml) } if (len < 20) { btn2.innerText = '加载完毕啦,么么哒~' - } - else { + } else { btn2.innerText = '点击有惊喜,萌萌哒~' } sp2 = sp2 + 20 diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js b/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js index ddebdd827..be378d6cf 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js @@ -9,7 +9,7 @@ export default class MIPMhotComment extends CustomElement { build () { let bnum = 0 let nnum = 0 - let PageType = '' + // let PageType = '' let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] let ztheader = this.element.querySelectorAll('.ztheader') let cSOHUCS = this.element.querySelectorAll('#SOHUCS') @@ -21,7 +21,7 @@ export default class MIPMhotComment extends CustomElement { let oDiv = this.element.querySelectorAll('.SearchBox')[0] let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] let sear = this.element.querySelectorAll('.searchDiv input') - let cnav = this.element.querySelectorAll('nav')[0] // 导航盒子 + let cnav = this.element.querySelectorAll('nav')[0] let mclassify = this.element.querySelectorAll('#mclassify')[0] let pullNav = this.element.querySelectorAll('#nav .pullNav') let moreNav = this.element.querySelectorAll('#nav .moreNav') @@ -113,28 +113,28 @@ export default class MIPMhotComment extends CustomElement { } } } - let zxAs = this.element.querySelectorAll('#zxnav-tit a'); // 获取资讯标题 - let open = this.element.querySelector('.open'); // 展开按钮 - let close = this.element.querySelector('.close'); // 关闭按钮 - let aTit = this.element.querySelectorAll('.aTit'); + let zxAs = this.element.querySelectorAll('#zxnav-tit a') + let open = this.element.querySelector('.open') + let close = this.element.querySelector('.close') + let aTit = this.element.querySelectorAll('.aTit') + let zz = 13 open.onclick = function () { - css(zxAs, {display: 'block'}); + css(zxAs, {display: 'block'}) css(open, {display: 'none'}) } close.onclick = function () { - css(aTit, {display: 'none'}); - css(close, {display: 'none'}); + css(aTit, {display: 'none'}) + css(close, {display: 'none'}) css(open, {display: 'block'}) } - // 点击更多按钮 - let btnzx = this.element.querySelector('#btnzx'); // 更多按钮 - let dlist = this.element.querySelector('#dlist'); // ul - let zx_typeid = document.getElementById('zx_typeid').getAttribute('value'); - let zxp1 = 10; + let btnzx = this.element.querySelector('#btnzx') + let dlist = this.element.querySelector('#dlist') + let zxTypeid = document.getElementById('zx_typeid').getAttribute('value') + let zxp1 = 10 btnzx.onclick = function () { - if (btnzx.innerText === "加载完毕啦,么么哒~") return false + if (btnzx.innerText === '加载完毕啦,么么哒~') return false // 创建一个Request对象 - let req = new Request('https://admin.veryhuo.com/mobile/open/archives_more?p='+zxp1+'&typeid='+zx_typeid, { + let req = new Request('https://admin.veryhuo.com/mobile/open/archives_more?p=' + zxp1 + '&typeid=' + zxTypeid, { method: 'GET', cache: 'reload' }); @@ -145,30 +145,29 @@ export default class MIPMhotComment extends CustomElement { btnzx.innerText = '加载完毕啦,么么哒~' return false } else { - btnzx.innerText = '加载中...'; - let khtml = ''; - let len = data.length; - for (let i = 0;i < len; i++) { - let dt = data[i]; + btnzx.innerText = '加载中...' + let khtml = '' + let len = data.length + for (let i = 0; i < len; i++) { + let dt = data[i] if (dt.litpic === '') { - dt.litpic='/images/noimg.png' + dt.litpic = '/images/noimg.png' } else { - var litpic=dt.litpic; - if (litpic.indexOf("article/") !== -1 || litpic.indexOf("default/") !== -1) { - litpic='https://admin.veryhuo.com/upload/'+litpic + let litpic = dt.litpic; + if (litpic.indexOf('article/') !== -1 || litpic.indexOf('default/') !== -1) { + litpic = 'https://admin.veryhuo.com/upload/' + litpic } else { - litpic='https://www.veryhuo.com'+litpic + litpic = 'https://www.veryhuo.com' + litpic } } - khtml = document.createElement("li") - khtml.innerHTML = ""+dt.title+"

"+dt.description+"

" - zz += 1; + khtml = document.createElement('li') + khtml.innerHTML = "" + dt.title + "

" + dt.description + "

" + zz += 1 dlist.appendChild(khtml) } if (len < 20) { btnzx.innerText = '加载完毕啦,么么哒~' - } - else { + } else { btnzx.innerText = '点击有惊喜,萌萌哒~' } zxp1 = zxp1 + 20 From 12891a49029e8cef919a04ea6d05957c4a6815e9 Mon Sep 17 00:00:00 2001 From: liukaidi <2379942411@qq.com> Date: Wed, 14 Aug 2019 16:58:49 +0800 Subject: [PATCH 06/34] =?UTF-8?q?=E6=96=B0=E5=8A=A0=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mip-veryhuo-androidsoft.js | 142 +++---- .../mip-veryhuo-azyy-azyx.js | 359 +++++++++--------- .../mip-veryhuo-column/mip-veryhuo-column.js | 100 +++-- .../mip-veryhuo-index/mip-veryhuo-index.js | 50 +-- .../mip-veryhuo-notfound.js | 2 +- .../mip-veryhuo-rank/mip-veryhuo-rank.js | 28 +- .../mip-veryhuo-special.js | 24 +- .../mip-veryhuo-type/mip-veryhuo-type.js | 330 ++++++++-------- .../mip-veryhuo-zx/mip-veryhuo-zx.js | 15 +- 9 files changed, 480 insertions(+), 570 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js index b0a231886..2f2a551ed 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js @@ -2,7 +2,6 @@ * @file 评论模块 * @author fl */ -import fetchJsonp from 'fetch-jsonp' const { CustomElement, util } = MIP const { css } = util @@ -11,15 +10,8 @@ export default class MIPMhotComment extends CustomElement { build () { let bnum = 0 let nnum = 0 - let PageType = '' let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] let ztheader = this.element.querySelectorAll('.ztheader') - let cSOHUCS = this.element.querySelectorAll('#SOHUCS') - if (cSOHUCS.length > 0) { - if (cSOHUCS[0].attributes['PageType'].value !== undefined) { - PageType = cSOHUCS[0].attributes['PageType'].value - } - } let oDiv = this.element.querySelectorAll('.SearchBox')[0] let searBtn = this.element.querySelectorAll('.SBBtn button')[0] let alert = this.element.querySelectorAll('#confirm')[0] @@ -35,34 +27,30 @@ export default class MIPMhotComment extends CustomElement { let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] let zxNav = this.element.querySelector('#zxNav') searBtn.onclick = function() { - if(oDiv.length === 0) { - css(alert, {display:'block'}) - }else { - css(alert, {display:'none'}) + if (oDiv.length === 0) { + css(alert, {display: 'block'}) + } else { + css(alert, {display: 'none'}) } } window.addEventListener('scroll', function () { - // 页面滚动一定高度时,显示吸顶导航盒子 if (document.documentElement.scrollTop > 80) { css(fixNav, {display: 'block'}) css(zxNav, {display: 'none'}) - } else if(document.documentElement.scrollTop < 30) { + } else if (document.documentElement.scrollTop < 30) { css(fixNav, {display: 'none'}) css(zxNav, {display: 'block'}) } - // 页面滚动一定高度时,显示回到顶部按钮 if (document.documentElement.scrollTop > 300) { css(cbacktop, {display: 'block'}) } else { css(cbacktop, {display: 'none'}) } }) - // 点击回到顶部按钮 cbacktop.onclick = function () { document.documentElement.scrollTop = 0 } if (ztheader.length === 0) { - // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 oDiv.onclick = function () { if (bnum === 0) { css(mclassifyCont, {display: 'none'}) @@ -83,7 +71,6 @@ export default class MIPMhotComment extends CustomElement { } } } - // 给隐藏的分类 tab 标题添加类样式 for (let i = 0; i < cmslass.length; i++) { cmslass[i].onclick = function () { let siblings = this.parentNode.childNodes @@ -94,7 +81,6 @@ export default class MIPMhotComment extends CustomElement { cmslass[i].index = i } } - // 点击隐藏的分类 tab 标题切换ul列表数据 if (this.index === 0) { cul[0].className = 'on' } else { @@ -107,7 +93,6 @@ export default class MIPMhotComment extends CustomElement { } } } - // 点击顶部分类按钮 mclassify.onclick = function () { if (nnum === 0) { css(mclassifyCont, {display: 'block'}) @@ -124,36 +109,31 @@ export default class MIPMhotComment extends CustomElement { } } } - /*如果不是手机打开,则跳转到pc页面*/ - var browser1 = { - versions: function () { - let u = navigator.userAgent, app = navigator.appVersion; - return {//移动终端浏览器版本信息 - trident: u.indexOf('Trident') > -1, //IE内核 - presto: u.indexOf('Presto') > -1, //opera内核 - webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 - gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, //火狐内核 - mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 - ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 - android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 - iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 - iPad: u.indexOf('iPad') > -1, //是否iPad - webApp: u.indexOf('Safari') === -1 //是否web应该程序,没有头部与底部 - }; - } (), + let browser1 = { + versions: (function () { + let u = navigator.userAgent + return { + trident: u.indexOf('Trident') > -1, + presto: u.indexOf('Presto') > -1, + webKit: u.indexOf('AppleWebKit') > -1, + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, + mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), + ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, + iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, + iPad: u.indexOf('iPad') > -1, + webApp: u.indexOf('Safari') === -1 + } + })(), language: (navigator.browserLanguage || navigator.language).toLowerCase() - }; + } if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { - //location.href = location.href.replace("m.","www.");//如果不是手机打开,则跳转到pc页面 window.location='http://www.veryhuo.com' } - let moreBtn = this.element.querySelector('#androidsoft-more'); - let asmUl = this.element.querySelector('#asm'); - // 发送请求 - let asm = 18; - // 更多软件点击事件 + let moreBtn = this.element.querySelector('#androidsoft-more') + let asmUl = this.element.querySelector('#asm') + let asm = 18 moreBtn.onclick = function () { - // 创建一个Request对象 let req = new Request('https://admin.veryhuo.com/mobile/open/more_soft?p='+asm+'&type=2'+'&isgame=0', { method: 'GET', cache: 'reload' @@ -164,79 +144,73 @@ export default class MIPMhotComment extends CustomElement { if (data === '') { moreBtn.innerText = '加载完毕啦,么么哒~' return false - }else{ + } else { moreBtn.innerText = '加载中...' let khtml = '' let len = data.length - for (let i = 0;i < len; i++) { + for (let i = 0; i < len; i++) { let dt = data[i] - dt.pubdate = to_date(dt.pubdate) - khtml = document.createElement("li") - khtml.innerHTML = "

"+dt.title+""+dt.typename+""+dt.softsize+""+dt.os+""+dt.pubdate+"

下载" + dt.pubdate = toDate(dt.pubdate) + khtml = document.createElement('li') + khtml.innerHTML = '

' + dt.title + '' + dt.typename + '' + dt.softsize + '' + dt.os + '' + dt.pubdate + '

下载' asmUl.appendChild(khtml) } if (len < 20) { moreBtn.innerText = '加载完毕啦,么么哒~' - } - else { + } else { moreBtn.innerText = '点击有惊喜,萌萌哒~' } asm = asm + 20 } - // 将时间戳转换成 yy-mm-dd - function to_date (phpstr) { - let str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000 - let newDate = new Date(str); - let yy = newDate.getUTCFullYear();//取年份 - let mm = newDate.getUTCMonth() + 1;//取月份 - let dd = newDate.getUTCDate();//取天数 - return yy + "-" + mm + "-" + dd;//拼接 + function toDate (phpstr) { + let str = parseInt(phpstr) * 1000 + let newDate = new Date(str) + let yy = newDate.getUTCFullYear() + let mm = newDate.getUTCMonth() + 1 + let dd = newDate.getUTCDate() + return yy + '-' + mm + '-' + dd } - }); - }; - // 更多游戏点击事件 - let gameBtn = this.element.querySelector('#androidgame-more'); - let agmUl = this.element.querySelector('#agm'); - let agm=18 + }) + } + let gameBtn = this.element.querySelector('#androidgame-more') + let agmUl = this.element.querySelector('#agm') + let agm = 18 gameBtn.onclick = function () { - // 创建一个Request对象 - let req = new Request('https://admin.veryhuo.com/mobile/open/more_soft?p='+agm+'&type=2'+'&isgame=1', { + let req = new Request('https://admin.veryhuo.com/mobile/open/more_soft?p=' + agm + '&type=2' + '&isgame=1', { method: 'GET', cache: 'reload' - }); + }) fetch(req).then(function (response) { return response.json() }).then(function (data) { if (data === '') { gameBtn.innerText = '加载完毕啦,么么哒~' return false - }else{ + } else { gameBtn.innerText = '加载中...' let ghtml = '' let len = data.length - for (let i = 0;i < len; i++) { + for (let i = 0; i < len; i++) { let dt = data[i] - dt.pubdate = to_date(dt.pubdate) - ghtml = document.createElement("li") - ghtml.innerHTML = "

"+dt.title+""+dt.typename+""+dt.softsize+""+dt.os+""+dt.pubdate+"

下载" + dt.pubdate = toDate(dt.pubdate) + ghtml = document.createElement('li') + ghtml.innerHTML = '

' + dt.title + '' + dt.typename + '' + dt.softsize + '' + dt.os + '' + dt.pubdate + '

下载' agmUl.appendChild(ghtml) } if (len < 20) { gameBtn.innerText = '加载完毕啦,么么哒~' - } - else { + } else { gameBtn.innerText = '点击有惊喜,萌萌哒~' } agm = agm + 20 } - // 将时间戳转换成 yy-mm-dd - function to_date(phpstr) { - let str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000 - let newDate = new Date(str); - let yy = newDate.getUTCFullYear();//取年份 - let mm = newDate.getUTCMonth() + 1;//取月份 - let dd = newDate.getUTCDate();//取天数 - return yy + "-" + mm + "-" + dd;//拼接 + function toDate(phpstr) { + let str = parseInt(phpstr) * 1000 + let newDate = new Date(str) + let yy = newDate.getUTCFullYear() + let mm = newDate.getUTCMonth() + 1 + let dd = newDate.getUTCDate() + return yy + '-' + mm + '-' + dd } }) } diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/mip-veryhuo-azyy-azyx.js b/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/mip-veryhuo-azyy-azyx.js index 546028b19..b37d5832f 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/mip-veryhuo-azyy-azyx.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/mip-veryhuo-azyy-azyx.js @@ -2,196 +2,191 @@ * @file 评论模块 * @author fl */ -import fetchJsonp from 'fetch-jsonp' const { CustomElement, util } = MIP const { css } = util export default class MIPMhotComment extends CustomElement { - build () { - let bnum = 0 - let nnum = 0 - let PageType = '' - let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] - let ztheader = this.element.querySelectorAll('.ztheader') - let cSOHUCS = this.element.querySelectorAll('#SOHUCS') - if (cSOHUCS.length > 0) { - if (cSOHUCS[0].attributes['PageType'].value !== undefined) { - PageType = cSOHUCS[0].attributes['PageType'].value - } - } - let oDiv = this.element.querySelectorAll('.SearchBox')[0] - let searBtn = this.element.querySelectorAll('.SBBtn button')[0] - let alert = this.element.querySelectorAll('#confirm')[0] - let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] - let sear = this.element.querySelectorAll('.searchDiv input') - let cnav = this.element.querySelectorAll('nav')[0] - let mclassify = this.element.querySelectorAll('#mclassify')[0] - let pullNav = this.element.querySelectorAll('#nav .pullNav') - let moreNav = this.element.querySelectorAll('#nav .moreNav') - let cmslass = this.element.querySelectorAll('#mclassifyCont p span') - let cul = this.element.querySelectorAll('#mclassifyCont ul') - let fixNav = this.element.querySelector('.fixNav') - let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] - let zxNav = this.element.querySelector('#zxNav') - searBtn.onclick = function() { - if(oDiv.length === 0) { - css(alert, {display:'block'}) - }else { - css(alert, {display:'none'}) - } - } - window.addEventListener('scroll', function () { - // 页面滚动一定高度时,显示吸顶导航盒子 - if (document.documentElement.scrollTop > 80) { - css(fixNav, {display: 'block'}) - css(zxNav, {display: 'none'}) - } else if(document.documentElement.scrollTop < 30) { - css(fixNav, {display: 'none'}) - css(zxNav, {display: 'block'}) - } - // 页面滚动一定高度时,显示回到顶部按钮 - if (document.documentElement.scrollTop > 300) { - css(cbacktop, {display: 'block'}) - } else { - css(cbacktop, {display: 'none'}) - } - }) - // 点击回到顶部按钮 - cbacktop.onclick = function () { - document.documentElement.scrollTop = 0 + build () { + let bnum = 0 + let nnum = 0 + // let PageType = '' + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] + let ztheader = this.element.querySelectorAll('.ztheader') + // let cSOHUCS = this.element.querySelectorAll('#SOHUCS') + // if (cSOHUCS.length > 0) { + // if (cSOHUCS[0].attributes['PageType'].value !== undefined) { + // PageType = cSOHUCS[0].attributes['PageType'].value + // } + // } + let oDiv = this.element.querySelectorAll('.SearchBox')[0] + let searBtn = this.element.querySelectorAll('.SBBtn button')[0] + let alert = this.element.querySelectorAll('#confirm')[0] + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] + let sear = this.element.querySelectorAll('.searchDiv input') + let cnav = this.element.querySelectorAll('nav')[0] + let mclassify = this.element.querySelectorAll('#mclassify')[0] + let pullNav = this.element.querySelectorAll('#nav .pullNav') + let moreNav = this.element.querySelectorAll('#nav .moreNav') + let cmslass = this.element.querySelectorAll('#mclassifyCont p span') + let cul = this.element.querySelectorAll('#mclassifyCont ul') + let fixNav = this.element.querySelector('.fixNav') + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] + let zxNav = this.element.querySelector('#zxNav') + searBtn.onclick = function () { + if (oDiv.length === 0) { + css(alert, {display: 'block'}) + } else { + css(alert, {display: 'none'}) + } + } + window.addEventListener('scroll', function () { + // 页面滚动一定高度时,显示吸顶导航盒子 + if (document.documentElement.scrollTop > 80) { + css(fixNav, {display: 'block'}) + css(zxNav, {display: 'none'}) + } else if (document.documentElement.scrollTop < 30) { + css(fixNav, {display: 'none'}) + css(zxNav, {display: 'block'}) + } + // 页面滚动一定高度时,显示回到顶部按钮 + if (document.documentElement.scrollTop > 300) { + css(cbacktop, {display: 'block'}) + } else { + css(cbacktop, {display: 'none'}) + } + }) + // 点击回到顶部按钮 + cbacktop.onclick = function () { + document.documentElement.scrollTop = 0 + } + if (ztheader.length === 0) { + // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 + oDiv.onclick = function () { + if (bnum === 0) { + css(mclassifyCont, {display: 'none'}) + css(csearchDiv, {display: 'block'}) + if (sear.length > 0) { + sear[0].focus() + } + bnum = 1 + nnum = 0 + } else { + if (nnum === 1) { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } else { + css(cnav, {height: 40}) + css(csearchDiv, {display: 'none'}) + bnum = 0 + } } - if (ztheader.length === 0) { - // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 - oDiv.onclick = function () { - if (bnum === 0) { - css(mclassifyCont, {display: 'none'}) - css(csearchDiv, {display: 'block'}) - if (sear.length > 0) { - sear[0].focus() - } - bnum = 1 - nnum = 0 - } else { - if (nnum === 1) { - css(mclassifyCont, {display: 'none'}) - nnum = 0 - } else { - css(cnav, {height: 40}) - css(csearchDiv, {display: 'none'}) - bnum = 0 - } - } - } - // 给隐藏的分类 tab 标题添加类样式 - for (let i = 0; i < cmslass.length; i++) { - cmslass[i].onclick = function () { - let siblings = this.parentNode.childNodes - for (let i = 0; i < siblings.length; i++) { - if (siblings[i].nodeType === 1) { - siblings[i].className = '' - this.className = 'cur' - cmslass[i].index = i - } - } - // 点击隐藏的分类 tab 标题切换ul列表数据 - if (this.index === 0) { - cul[0].className = 'on' - } else { - cul[0].className = '' - } - if (this.index === 1) { - cul[1].className = 'on' - } else { - cul[1].className = '' - } - } - } - // 点击顶部分类按钮 - mclassify.onclick = function () { - if (nnum === 0) { - css(mclassifyCont, {display: 'block'}) - if (pullNav.length > 0) { - pullNav[0].classList.remove('open') - } - if (moreNav.length > 0) { - css(moreNav[0], {display: 'none'}) - } - nnum = 1 - } else { - css(mclassifyCont, {display: 'none'}) - nnum = 0 - } - } + } + // 给隐藏的分类 tab 标题添加类样式 + for (let i = 0; i < cmslass.length; i++) { + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + cmslass[i].index = i + } + } + // 点击隐藏的分类 tab 标题切换ul列表数据 + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } + } + } + // 点击顶部分类按钮 + mclassify.onclick = function () { + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}) + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') + } + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) + } + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } + } + } + let browser1 = { + versions: (function () { + let u = navigator.userAgent + return { + trident: u.indexOf('Trident') > -1, + presto: u.indexOf('Presto') > -1, + webKit: u.indexOf('AppleWebKit') > -1, + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, + mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), + ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, + iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, + iPad: u.indexOf('iPad') > -1, + webApp: u.indexOf('Safari') === -1 } - /*如果不是手机打开,则跳转到pc页面*/ - var browser1 = { - versions: function () { - let u = navigator.userAgent, app = navigator.appVersion; - return {//移动终端浏览器版本信息 - trident: u.indexOf('Trident') > -1, //IE内核 - presto: u.indexOf('Presto') > -1, //opera内核 - webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 - gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, //火狐内核 - mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 - ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 - android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 - iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 - iPad: u.indexOf('iPad') > -1, //是否iPad - webApp: u.indexOf('Safari') === -1 //是否web应该程序,没有头部与底部 - }; - } (), - language: (navigator.browserLanguage || navigator.language).toLowerCase() - }; - if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { - //location.href = location.href.replace("m.","www.");//如果不是手机打开,则跳转到pc页面 - window.location='http://www.veryhuo.com' + })(), + language: (navigator.browserLanguage || navigator.language).toLowerCase() + } + if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { + window.location='http://www.veryhuo.com' + } + let moreBtn = this.element.querySelector('#soft-more') + let sUl = this.element.querySelector('#soft-list') + let soft_p = 20 + let isgame = document.getElementById('isgame').getAttribute('value') + moreBtn.onclick = function () { + // 创建一个Request对象 + let req = new Request('https://admin.veryhuo.com/mobile/open/more_soft?p=' + soft_p + '&type=2&isgame=' + isgame, { + method: 'GET', + cache: 'reload' + }); + fetch(req).then(function (response) { + return response.json() + }).then(function(data) { + if (data === '') { + moreBtn.innerText = '加载完毕啦,么么哒~' + return false + } else { + moreBtn.innerText = '加载中...' + let khtml = '' + let len = data.length + for (let i = 0; i < len; i++) { + let dt = data[i] + dt.pubdate = to_date(dt.pubdate) + khtml = document.createElement("li") + khtml.innerHTML = '

' + dt.title + '' + dt.typename + '' + dt.softsize + '' + dt.os + '' + dt.pubdate + '

下载' + sUl.appendChild(khtml) + } + if (len < 20) { + moreBtn.innerText = '加载完毕啦,么么哒~' + } else { + moreBtn.innerText = '点击有惊喜,萌萌哒~' + } + soft_p = soft_p + 20 } - let moreBtn = this.element.querySelector('#soft-more'); - let sUl = this.element.querySelector('#soft-list'); - let soft_p = 20; - let isgame = document.getElementById('isgame').getAttribute('value'); - moreBtn.onclick = function () { - // 创建一个Request对象 - let req = new Request('https://admin.veryhuo.com/mobile/open/more_soft?p='+soft_p+'&type=2&isgame='+isgame, { - method: 'GET', - cache: 'reload' - }); - fetch(req).then(function (response) { - return response.json() - }).then(function(data) { - if (data === '') { - moreBtn.innerText = '加载完毕啦,么么哒~' - return false - }else{ - moreBtn.innerText = '加载中...' - let khtml = ''; - let len = data.length; - for (let i = 0;i < len; i++) { - let dt = data[i]; - dt.pubdate = to_date(dt.pubdate) - khtml = document.createElement("li") - khtml.innerHTML = "

"+dt.title+""+dt.typename+""+dt.softsize+""+dt.os+""+dt.pubdate+"

下载" - sUl.appendChild(khtml) - } - if (len < 20) { - moreBtn.innerText = '加载完毕啦,么么哒~' - } - else { - moreBtn.innerText = '点击有惊喜,萌萌哒~' - } - soft_p = soft_p + 20 - } - // 将时间戳转换成 yy-mm-dd - function to_date(phpstr) { - let str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000 - let newDate = new Date(str); - let yy = newDate.getUTCFullYear();//取年份 - let mm = newDate.getUTCMonth() + 1;//取月份 - let dd = newDate.getUTCDate();//取天数 - return yy + "-" + mm + "-" + dd;//拼接 - } - }) + function to_date(phpstr) { + let str = parseInt(phpstr) * 1000 + let newDate = new Date(str) + let yy = newDate.getUTCFullYear() + let mm = newDate.getUTCMonth() + 1 + let dd = newDate.getUTCDate() + return yy + '-' + mm + '-' + dd } + }) } + } } diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js b/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js index db16d6635..7aaedcca7 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js @@ -10,15 +10,8 @@ export default class MIPMhotComment extends CustomElement { build () { let bnum = 0 let nnum = 0 - // let PageType = '' let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] let ztheader = this.element.querySelectorAll('.ztheader') - let cSOHUCS = this.element.querySelectorAll('#SOHUCS') - if (cSOHUCS.length > 0) { - if (cSOHUCS[0].attributes['PageType'].value !== undefined) { - PageType = cSOHUCS[0].attributes['PageType'].value - } - } let oDiv = this.element.querySelectorAll('.SearchBox')[0] let searBtn = this.element.querySelectorAll('.SBBtn button')[0] let alert = this.element.querySelectorAll('#confirm')[0] @@ -35,25 +28,25 @@ export default class MIPMhotComment extends CustomElement { let zxNav = this.element.querySelector('#zxNav') searBtn.onclick = function () { if (oDiv.length === 0) { - css(alert, { display: 'block'}) + css(alert, {display: 'block'}) } else { - css(alert, { display: 'block'}) + css(alert, {display: 'block'}) } } window.addEventListener('scroll', function () { // 页面滚动一定高度时,显示吸顶导航盒子 if (document.documentElement.scrollTop > 80) { - css(fixNav, { display: 'block'}) - css(zxNav, { display: 'none'}) + css(fixNav, {display: 'block'}) + css(zxNav, {display: 'none'}) } else if (document.documentElement.scrollTop < 30) { - css(fixNav, { display: 'none'}) - css(zxNav, { display: 'block'}) + css(fixNav, {display: 'none'}) + css(zxNav, {display: 'block'}) } // 页面滚动一定高度时,显示回到顶部按钮 if (document.documentElement.scrollTop > 300) { - css(cbacktop, { display: 'block'}) + css(cbacktop, {display: 'block'}) } else { - css(cbacktop, { display: 'none'}) + css(cbacktop, {display: 'none'}) } }) // 点击回到顶部按钮 @@ -64,8 +57,8 @@ export default class MIPMhotComment extends CustomElement { // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 oDiv.onclick = function () { if (bnum === 0) { - css(mclassifyCont, { display: 'none'}) - css(csearchDiv, { display: 'block'}) + css(mclassifyCont, {display: 'none'}) + css(csearchDiv, {display: 'block'}) if (sear.length > 0) { sear[0].focus() } @@ -73,11 +66,11 @@ export default class MIPMhotComment extends CustomElement { nnum = 0 } else { if (nnum === 1) { - css(mclassifyCont, { display: 'none'}) + css(mclassifyCont, {display: 'none'}) nnum = 0 } else { css(cnav, {height: 40}) - css(csearchDiv, { display: 'none'}) + css(csearchDiv, {display: 'none'}) bnum = 0 } } @@ -109,37 +102,37 @@ export default class MIPMhotComment extends CustomElement { // 点击顶部分类按钮 mclassify.onclick = function () { if (nnum === 0) { - css(mclassifyCont, { display: 'block'}) + css(mclassifyCont, {display: 'block'}) if (pullNav.length > 0) { pullNav[0].classList.remove('open') } if (moreNav.length > 0) { - css(moreNav[0], { display: 'none'}) + css(moreNav[0], {display: 'none'}) } nnum = 1 } else { - css(mclassifyCont, { display: 'none'}) + css(mclassifyCont, {display: 'none'}) nnum = 0 } } } // 如果不是手机打开,则跳转到pc页面 let browser1 = { - versions: function () { + versions: (function () { let u = navigator.userAgent return { trident: u.indexOf('Trident') > -1, presto: u.indexOf('Presto') > -1, webKit: u.indexOf('AppleWebKit') > -1, gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, - mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 + mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, iPad: u.indexOf('iPad') > -1, - webApp: u.indexOf('Safari') === -1 + webApp: u.indexOf('Safari') === -1 } - }(), + })(), language: (navigator.browserLanguage || navigator.language).toLowerCase() } if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { @@ -153,10 +146,10 @@ export default class MIPMhotComment extends CustomElement { } // 机型判断 let u = navigator.userAgent - let isIphone= !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) - let typeid = document.getElementById('typeid').getAttribute('value') + let isIphone = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) + let typeNum = document.getElementById('typeid').getAttribute('value') let classweb = document.getElementById('classweb').getAttribute('value') - var typename = document.getElementById('typename').getAttribute('value') + let typename = document.getElementById('typename').getAttribute('value') let isios = document.getElementById('isios').getAttribute('value') let classid = document.getElementById('classid').getAttribute('value') let type = isios === '0' ? '2' : '3' @@ -165,14 +158,12 @@ export default class MIPMhotComment extends CustomElement { let azurl = window.location.href let azurlarr = azurl.split('/') let azurlid = azurlarr[5].replace('.html', '') - if(isios === '0'){ + if (isios === '0') { azurl = azurl.replace(azurlid, classid) window.location.href = azurl } } - let lm = 2 - } - else { + } else { if (classweb === '2') { let azurl = window.location.href let azurlarr = azurl.split('/') @@ -182,7 +173,6 @@ export default class MIPMhotComment extends CustomElement { window.location.href = azurl } } - let lm = 1 } let btn1 = this.element.querySelector('#btn1') let btn2 = this.element.querySelector('#btn2') @@ -191,13 +181,14 @@ export default class MIPMhotComment extends CustomElement { let lists2 = this.element.querySelector('.lists2') let lists3 = this.element.querySelector('.lists3') let p = 10 + let zz = 13 btn1.onclick = function () { if (btn1.innerText === '加载完毕啦') return false // 创建一个Request对象 let req = new Request('https://admin.veryhuo.com/mobile/open/list_more_zuixin?type='+ type + '&p='+ p + '&type_id=' + typeid, { method: 'GET', cache: 'reload' - }); + }) fetch(req).then(function (response) { return response.json() }).then(function (data) { @@ -219,7 +210,7 @@ export default class MIPMhotComment extends CustomElement { dt.softrank = 5 } khtml = document.createElement('li') - khtml.innerHTML = "

"+ dt.title + "" + typename + "|" + dt.version + "|" + dt.softsize + "

下载" + khtml.innerHTML = '

'+ dt.title + '' + typename + '|' + dt.version + '|' + dt.softsize + '

下载' zz += 1 lists1.appendChild(khtml) } @@ -234,11 +225,11 @@ export default class MIPMhotComment extends CustomElement { } let hqp = 10 btn2.onclick = function () { - if(btn2.innerText === "加载完毕啦") return false - let req = new Request('https://admin.veryhuo.com/mobile/open/list_more_zuire?type='+ type +'&p='+ hqp +'&type_id=' + typeNum, { + if (btn2.innerText === "加载完毕啦") return false + let req = new Request('https://admin.veryhuo.com/mobile/open/list_more_zuire?type=' + type + '&p=' + hqp + '&type_id=' + typeNum, { method: 'GET', cache: 'reload' - }); + }) fetch(req).then(function (response) { return response.json() }).then(function (data) { @@ -255,16 +246,16 @@ export default class MIPMhotComment extends CustomElement { if (dt.litpic === '') { dt.litpic = '/images/nologo.png' } else { - dt.litpic = 'https://www.veryhuo.com'+ dt.litpic + dt.litpic = 'https://www.veryhuo.com' + dt.litpic } if (dt.version === 0) { dt.version = dt.os } else { dt.softrank = 5 } - rhtml = document.createElement("li") - rhtml.innerHTML = "

"+dt.title+""+value+"|"+dt.version+"|"+dt.softsize+"

下载" - zz += 1; + rhtml = document.createElement('li') + rhtml.innerHTML = '

' + dt.title + '' + typename + '|' + dt.version + '|' + dt.softsize + '

下载' + zz += 1 lists2.appendChild(rhtml) } if (len < 20) { @@ -275,31 +266,31 @@ export default class MIPMhotComment extends CustomElement { } hqp = hqp + 30 } - }); - }; + }) + } let zxp = 10 btn3.onclick = function () { - if(btn3.innerText === "加载完毕啦") return false; + if (btn3.innerText === '加载完毕啦') return false // 创建一个Request对象 - let req = new Request('https://admin.veryhuo.com/mobile/open/list_more_paihang?type='+type+'&p='+zxp+'&type_id='+typeNum,{ + let req = new Request('https://admin.veryhuo.com/mobile/open/list_more_paihang?type=' + type + '&p=' + zxp + '&type_id=' + typeNum, { method: 'GET', cache: 'reload' - }); + }) fetch(req).then(function (response) { return response.json() }).then(function (data) { if (data === '') { btn3.innerText = '加载完毕啦,么么哒~' return false - }else{ + } else { btn3.innerText = '加载中...' let phtml = '' let len = data.length - for (let i = 0;i < len; i++) { + for (let i = 0; i < len; i++) { let dt = data[i] console.log(dt) if (dt.litpic === '') { - dt.litpic='/images/nologo.png' + dt.litpic = '/images/nologo.png' } else { dt.litpic = 'https://www.veryhuo.com' + dt.litpic } @@ -309,14 +300,13 @@ export default class MIPMhotComment extends CustomElement { dt.softrank = 5 } phtml = document.createElement('li') - phtml.innerHTML = "

" + dt.title + "" + value + "|" + dt.version + "|" + dt.softsize + "

下载" - zz += 1; + phtml.innerHTML = '

' + dt.title + '' + typename + '|' + dt.version + '|' + dt.softsize + '

下载' + zz += 1 lists3.appendChild(phtml) } if (len < 20) { btn3.innerText = '加载完毕啦,么么哒~' - } - else { + } else { btn3.innerText = '点击有惊喜,萌萌哒~' } zxp = zxp + 30 diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js index 46922fd0d..758db5a2a 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js @@ -10,15 +10,8 @@ export default class MIPMhotComment extends CustomElement { build () { let bnum = 0 let nnum = 0 - // let PageType = ''; let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] let ztheader = this.element.querySelectorAll('.ztheader') - let cSOHUCS = this.element.querySelectorAll('#SOHUCS') - if (cSOHUCS.length > 0) { - if (cSOHUCS[0].attributes['PageType'].value !== undefined) { - PageType = cSOHUCS[0].attributes['PageType'].value - } - } let oDiv = this.element.querySelectorAll('.SearchBox')[0] let searBtn = this.element.querySelectorAll('.SBBtn button')[0] let alert = this.element.querySelectorAll('#confirm')[0] @@ -78,11 +71,11 @@ export default class MIPMhotComment extends CustomElement { nnum = 0 } else { if (nnum === 1) { - css(mclassifyCont, { display: 'none' }) + css(mclassifyCont, {display: 'none'}) nnum = 0 } else { css(cnav, {height: 40}) - css(csearchDiv, {display: 'none' }) + css(csearchDiv, {display: 'none'}) bnum = 0 } } @@ -91,7 +84,7 @@ export default class MIPMhotComment extends CustomElement { // 给隐藏的分类 tab 标题添加类样式 for (let i = 0; i < cmslass.length; i++) { cmslass[i].onclick = function () { - let siblings = this.parentNode.childNodes; + let siblings = this.parentNode.childNodes for (let i = 0; i < siblings.length; i++) { if (siblings[i].nodeType === 1) { siblings[i].className = '' @@ -121,33 +114,32 @@ export default class MIPMhotComment extends CustomElement { pullNav[0].classList.remove('open') } if (moreNav.length > 0) { - css(moreNav[0], { display: 'none'}) + css(moreNav[0], {display: 'none'}) } nnum = 1 } else { - css(mclassifyCont, { display: 'none'}) + css(mclassifyCont, {display: 'none'}) nnum = 0 } } } } - //如果不是手机打开,则跳转到pc页面 let browser1 = { - versions: function () { + versions: (function () { let u = navigator.userAgent return { - trident: u.indexOf('Trident') > -1, + trident: u.indexOf('Trident') > -1, presto: u.indexOf('Presto') > -1, webKit: u.indexOf('AppleWebKit') > -1, - gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, - mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 - ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), - android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, - iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, + mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), + ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, + iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, iPad: u.indexOf('iPad') > -1, webApp: u.indexOf('Safari') === -1 } - }(), + })(), language: (navigator.browserLanguage || navigator.language).toLowerCase() } if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { @@ -157,17 +149,15 @@ export default class MIPMhotComment extends CustomElement { let u = navigator.userAgent let isIphone = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) let iosweb = document.getElementById('iosweb').getAttribute('value') - let type = iosweb === '0'? '2':'3' + let type = iosweb === '0' ? '2' : '3' if (isIphone) { if (iosweb === '0') { window.stop ? window.stop() : document.execCommand('Stop') window.location.href = '/mip_ddooo_m.rar/apple/index.html' } - let lm = 2 } else if (iosweb === '1') { window.stop ? window.stop() : document.execCommand('Stop') window.location.href = '/mip_ddooo_m.rar/index.html' - let lm = 1 } console.log(type); let moreBtn = this.element.querySelector('#moreApp') @@ -188,16 +178,16 @@ export default class MIPMhotComment extends CustomElement { }).then(function (data) { if (data === '') { moreBtn.innerText = '加载完毕啦,么么哒~' - return false; + return false } else { moreBtn.innerText = '加载中...' - let khtml = ''; + let khtml = '' let len = data.length; for (let i = 0; i < len; i++) { let dt = data[i] - dt.pubdate = to_date(dt.pubdate) + dt.pubdate = toDate(dt.pubdate) khtml = document.createElement('li') - khtml.innerHTML = "

" + dt.title + "" + dt.typename + "" + dt.softsize + "" + dt.os + "" + dt.pubdate + "

下载" + khtml.innerHTML = '

' + dt.title + '' + dt.typename + '' + dt.softsize + '' + dt.os + '' + dt.pubdate + '

下载' iList.appendChild(khtml) } if (len < 20) { @@ -209,13 +199,13 @@ export default class MIPMhotComment extends CustomElement { p = p + 30 } // 将时间戳转换成 yy-mm-dd - function to_date(phpstr) { + function toDate (phpstr) { let str = parseInt(phpstr) * 1000 let newDate = new Date(str) let yy = newDate.getUTCFullYear() let mm = newDate.getUTCMonth() + 1 let dd = newDate.getUTCDate() - return yy + "-" + mm + "-" + dd + return yy + '-' + mm + '-' + dd } }) } diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js index ba76bc335..32b4ac8e9 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/mip-veryhuo-notfound.js @@ -1,4 +1,4 @@ -const { CustomElement} = MIP +const { CustomElement } = MIP export default class MIPMhotComment extends CustomElement { build () { diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js b/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js index edbbbc165..79f6c958d 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js @@ -5,15 +5,8 @@ export default class MIPMhotComment extends CustomElement { build () { let bnum = 0 let nnum = 0 - // let PageType = ''; let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] let ztheader = this.element.querySelectorAll('.ztheader') - let cSOHUCS = this.element.querySelectorAll('#SOHUCS') - if (cSOHUCS.length > 0) { - if (cSOHUCS[0].attributes['PageType'].value !== undefined) { - PageType = cSOHUCS[0].attributes['PageType'].value - } - } let oDiv = this.element.querySelectorAll('.SearchBox')[0] let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] let sear = this.element.querySelectorAll('.searchDiv input') @@ -115,29 +108,28 @@ export default class MIPMhotComment extends CustomElement { zk.onclick = function () { css(rankA, {display: 'block'}) css(zk, {display: 'none'}) - }; + } sq.onclick = function () { css(hides, {display: 'none'}) css(sq, {display: 'none'}) css(zk, {display: 'block'}) - }; - //如果不是手机打开,则跳转到pc页面 + } let browser1 = { - versions: function () { + versions: (function () { let u = navigator.userAgent return { - trident: u.indexOf('Trident') > -1, + trident: u.indexOf('Trident') > -1, presto: u.indexOf('Presto') > -1, webKit: u.indexOf('AppleWebKit') > -1, gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, - mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 + mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, - iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, + iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, iPad: u.indexOf('iPad') > -1, webApp: u.indexOf('Safari') === -1 } - }(), + })(), language: (navigator.browserLanguage || navigator.language).toLowerCase() } if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { @@ -164,7 +156,6 @@ export default class MIPMhotComment extends CustomElement { } } } - let lm = 2 } else if (iosweb === '1') { if (isyouxi === '1') { @@ -174,7 +165,6 @@ export default class MIPMhotComment extends CustomElement { } else { window.location.href = '/mip_ddooo_m.rar/soft.html' } - let lm = 1 } // 点击加载更多 let btn1 = this.element.querySelector('#btn1') @@ -205,8 +195,8 @@ export default class MIPMhotComment extends CustomElement { } else { dt.softrank = 5 } - khtml = document.createElement("li") - khtml.innerHTML = "

" + zz + "" + dt.title + "" + dt.typename + "" + dt.softsize + "" + dt.version + "

下载" + khtml = document.createElement('li') + khtml.innerHTML = '

' + zz + '' + dt.title + '' + dt.typename + '' + dt.softsize + '' + dt.version + '

下载' zz += 1 more.appendChild(khtml) } diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js b/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js index 5f538a1cb..cffe94f8c 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js @@ -9,15 +9,8 @@ export default class MIPMhotComment extends CustomElement { build () { let bnum = 0 let nnum = 0 - // let PageType = '' let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] let ztheader = this.element.querySelectorAll('.ztheader') - let cSOHUCS = this.element.querySelectorAll('#SOHUCS') - if (cSOHUCS.length > 0) { - if (cSOHUCS[0].attributes['PageType'].value !== undefined) { - PageType = cSOHUCS[0].attributes['PageType'].value - } - } let oDiv = this.element.querySelectorAll('.SearchBox')[0] let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] let sear = this.element.querySelectorAll('.searchDiv input') @@ -129,16 +122,17 @@ export default class MIPMhotComment extends CustomElement { let specG = this.element.querySelector('#spec-game') let specS = this.element.querySelector('#spec-soft') let sp1 = 20 + let zz = 13 btn1.onclick = function () { if (btn1.innerText === '加载完毕啦,么么哒~') return false // 创建一个Request对象 let req = new Request('https://admin.veryhuo.com/mobile/open/spec_more?type=1&p=' + sp1, { method: 'GET', cache: 'reload' - }); + }) fetch(req).then(function (response) { return response.json() - }).then(function(data) { + }).then(function (data) { if (data === '') { btn1.innerText = '加载完毕啦,么么哒~' return false @@ -152,10 +146,10 @@ export default class MIPMhotComment extends CustomElement { if (dt.litpic === '') { dt.litpic = '/images/nologo.png' } else { - dt.litpic='https://admin.veryhuo.com/upload/' + dt.litpic + dt.litpic = 'https://admin.veryhuo.com/upload/' + dt.litpic } - khtml = document.createElement("li") - khtml.innerHTML = "

" + dt.title + "

" + khtml = document.createElement('li') + khtml.innerHTML = '

' + dt.title + '

' zz += 1 specG.appendChild(khtml) } @@ -166,7 +160,7 @@ export default class MIPMhotComment extends CustomElement { } sp1 = sp1 + 20 } - }); + }) } let sp2 = 20 btn2.onclick = function () { @@ -191,10 +185,10 @@ export default class MIPMhotComment extends CustomElement { if (dt.litpic === '') { dt.litpic = '/images/nologo.png' } else { - dt.litpic='https://admin.veryhuo.com/upload/'+dt.litpic + dt.litpic = 'https://admin.veryhuo.com/upload/' + dt.litpic } shtml = document.createElement('li') - shtml.innerHTML = "

" + dt.title + "

" + shtml.innerHTML = '

' + dt.title + '

' zz += 1 specS.appendChild(shtml) } diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js b/sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js index 6484df4ff..caf8cdad0 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js @@ -2,191 +2,175 @@ * @file 评论模块 * @author fl */ -import fetchJsonp from 'fetch-jsonp' const { CustomElement, util } = MIP const { css } = util export default class MIPMhotComment extends CustomElement { - build () { - let bnum = 0 - let nnum = 0 - let PageType = '' - let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] - let ztheader = this.element.querySelectorAll('.ztheader') - let cSOHUCS = this.element.querySelectorAll('#SOHUCS') - if (cSOHUCS.length > 0) { - if (cSOHUCS[0].attributes['PageType'].value !== undefined) { - PageType = cSOHUCS[0].attributes['PageType'].value - } + build () { + let bnum = 0 + let nnum = 0 + let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] + let ztheader = this.element.querySelectorAll('.ztheader') + let oDiv = this.element.querySelectorAll('.SearchBox')[0] + let searBtn = this.element.querySelectorAll('.SBBtn button')[0] + let alert = this.element.querySelectorAll('#confirm')[0] + let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] + let sear = this.element.querySelectorAll('.searchDiv input') + let cnav = this.element.querySelectorAll('nav')[0] + let mclassify = this.element.querySelectorAll('#mclassify')[0] + let pullNav = this.element.querySelectorAll('#nav .pullNav') + let moreNav = this.element.querySelectorAll('#nav .moreNav') + let cmslass = this.element.querySelectorAll('#mclassifyCont p span') + let cul = this.element.querySelectorAll('#mclassifyCont ul') + let fixNav = this.element.querySelector('.fixNav') + let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] + let zxNav = this.element.querySelector('#zxNav') + searBtn.onclick = function () { + if (oDiv.length === 0) { + css(alert, {display: 'block'}) + } else { + css(alert, {display: 'none'}) + } + } + window.addEventListener('scroll', function () { + // 页面滚动一定高度时,显示吸顶导航盒子 + if (document.documentElement.scrollTop > 80) { + css(fixNav, {display: 'block'}) + css(zxNav, {display: 'none'}) + } else if (document.documentElement.scrollTop < 30) { + css(fixNav, {display: 'none'}) + css(zxNav, {display: 'block'}) + } + // 页面滚动一定高度时,显示回到顶部按钮 + if (document.documentElement.scrollTop > 300) { + css(cbacktop, {display: 'block'}) + } else { + css(cbacktop, {display: 'none'}) + } + }) + // 点击回到顶部按钮 + cbacktop.onclick = function () { + document.documentElement.scrollTop = 0 + } + if (ztheader.length === 0) { + // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 + oDiv.onclick = function () { + if (bnum === 0) { + css(mclassifyCont, {display: 'none'}) + css(csearchDiv, {display: 'block'}) + if (sear.length > 0) { + sear[0].focus() + } + bnum = 1 + nnum = 0 + } else { + if (nnum === 1) { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } else { + css(cnav, {height: 40}) + css(csearchDiv, {display: 'none'}) + bnum = 0 + } } - let oDiv = this.element.querySelectorAll('.SearchBox')[0] - let searBtn = this.element.querySelectorAll('.SBBtn button')[0] - let alert = this.element.querySelectorAll('#confirm')[0] - let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] - let sear = this.element.querySelectorAll('.searchDiv input') - let cnav = this.element.querySelectorAll('nav')[0] // 导航盒子 - let mclassify = this.element.querySelectorAll('#mclassify')[0] - let pullNav = this.element.querySelectorAll('#nav .pullNav') - let moreNav = this.element.querySelectorAll('#nav .moreNav') - let cmslass = this.element.querySelectorAll('#mclassifyCont p span') - let cul = this.element.querySelectorAll('#mclassifyCont ul') - let fixNav = this.element.querySelector('.fixNav') - let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] - let zxNav = this.element.querySelector('#zxNav') - searBtn.onclick = function() { - if(oDiv.length === 0) { - css(alert, {display:'block'}) - }else { - css(alert, {display:'none'}) + } + // 给隐藏的分类 tab 标题添加类样式 + for (let i = 0; i < cmslass.length; i++) { + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + cmslass[i].index = i } + } + // 点击隐藏的分类 tab 标题切换ul列表数据 + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } } - window.addEventListener('scroll', function () { - // 页面滚动一定高度时,显示吸顶导航盒子 - if (document.documentElement.scrollTop > 80) { - css(fixNav, {display: 'block'}) - css(zxNav, {display: 'none'}) - } else if(document.documentElement.scrollTop < 30) { - css(fixNav, {display: 'none'}) - css(zxNav, {display: 'block'}) - } - // 页面滚动一定高度时,显示回到顶部按钮 - if (document.documentElement.scrollTop > 300) { - css(cbacktop, {display: 'block'}) - } else { - css(cbacktop, {display: 'none'}) - } - }) - // 点击回到顶部按钮 - cbacktop.onclick = function () { - document.documentElement.scrollTop = 0 + } + // 点击顶部分类按钮 + mclassify.onclick = function () { + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}) + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') + } + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) + } + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}) + nnum = 0 } - if (ztheader.length === 0) { - // 点击搜索按钮,显示搜索框盒子,隐藏分类盒子 - oDiv.onclick = function () { - if (bnum === 0) { - css(mclassifyCont, {display: 'none'}) - css(csearchDiv, {display: 'block'}) - if (sear.length > 0) { - sear[0].focus() - } - bnum = 1 - nnum = 0 - } else { - if (nnum === 1) { - css(mclassifyCont, {display: 'none'}) - nnum = 0 - } else { - css(cnav, {height: 40}) - css(csearchDiv, {display: 'none'}) - bnum = 0 - } - } - } - // 给隐藏的分类 tab 标题添加类样式 - for (let i = 0; i < cmslass.length; i++) { - cmslass[i].onclick = function () { - let siblings = this.parentNode.childNodes - for (let i = 0; i < siblings.length; i++) { - if (siblings[i].nodeType === 1) { - siblings[i].className = '' - this.className = 'cur' - cmslass[i].index = i - } - } - // 点击隐藏的分类 tab 标题切换ul列表数据 - if (this.index === 0) { - cul[0].className = 'on' - } else { - cul[0].className = '' - } - if (this.index === 1) { - cul[1].className = 'on' - } else { - cul[1].className = '' - } - } - } - // 点击顶部分类按钮 - mclassify.onclick = function () { - if (nnum === 0) { - css(mclassifyCont, {display: 'block'}) - if (pullNav.length > 0) { - pullNav[0].classList.remove('open') - } - if (moreNav.length > 0) { - css(moreNav[0], {display: 'none'}) - } - nnum = 1 - } else { - css(mclassifyCont, {display: 'none'}) - nnum = 0 - } - } - } - - /*如果不是手机打开,则跳转到pc页面*/ - var browser1 = { - versions: function () { - let u = navigator.userAgent, app = navigator.appVersion; - return {//移动终端浏览器版本信息 - trident: u.indexOf('Trident') > -1, //IE内核 - presto: u.indexOf('Presto') > -1, //opera内核 - webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 - gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, //火狐内核 - mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 - ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 - android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 - iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 - iPad: u.indexOf('iPad') > -1, //是否iPad - webApp: u.indexOf('Safari') === -1 //是否web应该程序,没有头部与底部 - }; - } (), - language: (navigator.browserLanguage || navigator.language).toLowerCase() - }; - if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { - //location.href = location.href.replace("m.","www.");//如果不是手机打开,则跳转到pc页面 - window.location='http://www.veryhuo.com' + } + } + let browser1 = { + versions: (function () { + let u = navigator.userAgent + return { + trident: u.indexOf('Trident') > -1, + presto: u.indexOf('Presto') > -1, + webKit: u.indexOf('AppleWebKit') > -1, + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, + mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), + ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, + iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, + iPad: u.indexOf('iPad') > -1, + webApp: u.indexOf('Safari') === -1 } - // 判断机型 - let u = navigator.userAgent, app = navigator.appVersion; - let isIphone= !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);//ios终端 true - let iosweb = document.getElementById("iosweb").getAttribute('value'); - let classweb = document.getElementById("classweb").getAttribute('value'); - let isyouxi = document.getElementById("isyouxi").getAttribute('value'); - var type = iosweb === "0"? "2":"3"; - var lm = ''; - if (isIphone) { - if (classweb === '1') { - if (iosweb === '0') { - let url = window.location.href; - if (isyouxi === '1') { - if (url.indexOf("611")!==-1){ - window.location.href='/mip_ddooo_m.rar/list/987.html' - } - } else { - if (url.indexOf("363")!==-1){ - window.location.href='/mip_ddooo_m.rar/list/986.html' - } - } - } + })(), + language: (navigator.browserLanguage || navigator.language).toLowerCase() + } + if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { + window.location='http://www.veryhuo.com' + } + let u = navigator.userAgent + let isIphone= !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) + let iosweb = document.getElementById('iosweb').getAttribute('value') + let classweb = document.getElementById('classweb').getAttribute('value') + let isyouxi = document.getElementById('isyouxi').getAttribute('value') + var type = iosweb === '0' ? '2' : '3' + if (isIphone) { + if (classweb === '1') { + if (iosweb === '0') { + let url = window.location.href + if (isyouxi === '1') { + if (url.indexOf('611') !== -1){ + window.location.href = '/mip_ddooo_m.rar/list/987.html' } - lm = 2 - } - else { - if (classweb === '1') { - let url = window.location.href; - if (isyouxi === '1') { - if (url.indexOf("987")!==-1){ - window.location.href='/mip_ddooo_m.rar/list/611.html' - } - } else { //软件 - if (url.indexOf("986")!==-1){ - window.location.href='/mip_ddooo_m.rar/list/363.html' - } - } + } else { + if (url.indexOf('363') !== -1){ + window.location.href = '/mip_ddooo_m.rar/list/986.html' } - lm = 1 + } + } + } + } else { + if (classweb === '1') { + let url = window.location.href + if (isyouxi === '1') { + if (url.indexOf('987') !== -1){ + window.location.href = '/mip_ddooo_m.rar/list/611.html' + } + } else { //软件 + if (url.indexOf('986') !== -1){ + window.location.href = '/mip_ddooo_m.rar/list/363.html' + } } + } } + } } diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js b/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js index be378d6cf..cf1c14f63 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js @@ -9,15 +9,8 @@ export default class MIPMhotComment extends CustomElement { build () { let bnum = 0 let nnum = 0 - // let PageType = '' let mclassifyCont = this.element.querySelectorAll('#mclassifyCont')[0] let ztheader = this.element.querySelectorAll('.ztheader') - let cSOHUCS = this.element.querySelectorAll('#SOHUCS') - if (cSOHUCS.length > 0) { - if (cSOHUCS[0].attributes['PageType'].value !== undefined) { - PageType = cSOHUCS[0].attributes['PageType'].value - } - } let oDiv = this.element.querySelectorAll('.SearchBox')[0] let csearchDiv = this.element.querySelectorAll('.searchDiv')[0] let sear = this.element.querySelectorAll('.searchDiv input') @@ -117,7 +110,6 @@ export default class MIPMhotComment extends CustomElement { let open = this.element.querySelector('.open') let close = this.element.querySelector('.close') let aTit = this.element.querySelectorAll('.aTit') - let zz = 13 open.onclick = function () { css(zxAs, {display: 'block'}) css(open, {display: 'none'}) @@ -131,13 +123,14 @@ export default class MIPMhotComment extends CustomElement { let dlist = this.element.querySelector('#dlist') let zxTypeid = document.getElementById('zx_typeid').getAttribute('value') let zxp1 = 10 + let zz = 13 btnzx.onclick = function () { if (btnzx.innerText === '加载完毕啦,么么哒~') return false // 创建一个Request对象 let req = new Request('https://admin.veryhuo.com/mobile/open/archives_more?p=' + zxp1 + '&typeid=' + zxTypeid, { method: 'GET', cache: 'reload' - }); + }) fetch(req).then(function (response) { return response.json() }).then(function (data) { @@ -153,7 +146,7 @@ export default class MIPMhotComment extends CustomElement { if (dt.litpic === '') { dt.litpic = '/images/noimg.png' } else { - let litpic = dt.litpic; + let litpic = dt.litpic if (litpic.indexOf('article/') !== -1 || litpic.indexOf('default/') !== -1) { litpic = 'https://admin.veryhuo.com/upload/' + litpic } else { @@ -161,7 +154,7 @@ export default class MIPMhotComment extends CustomElement { } } khtml = document.createElement('li') - khtml.innerHTML = "" + dt.title + "

" + dt.description + "

" + khtml.innerHTML = '' + dt.title + '

' + dt.description + '

' zz += 1 dlist.appendChild(khtml) } From 03e43dbac336943ac778d0faff61982991445db5 Mon Sep 17 00:00:00 2001 From: liukaidi <2379942411@qq.com> Date: Wed, 14 Aug 2019 17:56:18 +0800 Subject: [PATCH 07/34] =?UTF-8?q?=E6=96=B0=E5=8A=A0=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mip-veryhuo-androidsoft.js | 26 ++--- .../mip-veryhuo-azyy-azyx.js | 104 +++++++++--------- .../mip-veryhuo-column/mip-veryhuo-column.js | 17 ++- .../mip-veryhuo-index/mip-veryhuo-index.js | 3 +- .../mip-veryhuo-rank/mip-veryhuo-rank.js | 3 +- .../mip-veryhuo-special.js | 6 +- .../mip-veryhuo-type/mip-veryhuo-type.js | 15 ++- .../mip-veryhuo-zx/mip-veryhuo-zx.js | 2 +- 8 files changed, 86 insertions(+), 90 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js index 2f2a551ed..a5481fd60 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js @@ -26,7 +26,7 @@ export default class MIPMhotComment extends CustomElement { let fixNav = this.element.querySelector('.fixNav') let cbacktop = this.element.querySelectorAll('#Cbacktop')[0] let zxNav = this.element.querySelector('#zxNav') - searBtn.onclick = function() { + searBtn.onclick = function () { if (oDiv.length === 0) { css(alert, {display: 'block'}) } else { @@ -115,29 +115,29 @@ export default class MIPMhotComment extends CustomElement { return { trident: u.indexOf('Trident') > -1, presto: u.indexOf('Presto') > -1, - webKit: u.indexOf('AppleWebKit') > -1, - gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, - mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), - ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), - android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, - iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, - iPad: u.indexOf('iPad') > -1, - webApp: u.indexOf('Safari') === -1 + webKit: u.indexOf('AppleWebKit') > -1, + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, + mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), + ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, + iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, + iPad: u.indexOf('iPad') > -1, + webApp: u.indexOf('Safari') === -1 } })(), language: (navigator.browserLanguage || navigator.language).toLowerCase() } if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { - window.location='http://www.veryhuo.com' + window.location = 'http://www.veryhuo.com' } let moreBtn = this.element.querySelector('#androidsoft-more') let asmUl = this.element.querySelector('#asm') let asm = 18 moreBtn.onclick = function () { - let req = new Request('https://admin.veryhuo.com/mobile/open/more_soft?p='+asm+'&type=2'+'&isgame=0', { + let req = new Request('https://admin.veryhuo.com/mobile/open/more_soft?p=' + asm + '&type=2' + '&isgame=0', { method: 'GET', cache: 'reload' - }); + }) fetch(req).then(function (response) { return response.json() }).then(function (data) { @@ -204,7 +204,7 @@ export default class MIPMhotComment extends CustomElement { } agm = agm + 20 } - function toDate(phpstr) { + function toDate (phpstr) { let str = parseInt(phpstr) * 1000 let newDate = new Date(str) let yy = newDate.getUTCFullYear() diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/mip-veryhuo-azyy-azyx.js b/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/mip-veryhuo-azyy-azyx.js index b37d5832f..76d316ce4 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/mip-veryhuo-azyy-azyx.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/mip-veryhuo-azyy-azyx.js @@ -67,7 +67,7 @@ export default class MIPMhotComment extends CustomElement { css(mclassifyCont, {display: 'none'}) css(csearchDiv, {display: 'block'}) if (sear.length > 0) { - sear[0].focus() + sear[0].focus() } bnum = 1 nnum = 0 @@ -84,43 +84,43 @@ export default class MIPMhotComment extends CustomElement { } // 给隐藏的分类 tab 标题添加类样式 for (let i = 0; i < cmslass.length; i++) { - cmslass[i].onclick = function () { - let siblings = this.parentNode.childNodes - for (let i = 0; i < siblings.length; i++) { - if (siblings[i].nodeType === 1) { - siblings[i].className = '' - this.className = 'cur' - cmslass[i].index = i - } - } - // 点击隐藏的分类 tab 标题切换ul列表数据 - if (this.index === 0) { - cul[0].className = 'on' - } else { - cul[0].className = '' - } - if (this.index === 1) { - cul[1].className = 'on' - } else { - cul[1].className = '' - } + cmslass[i].onclick = function () { + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + cmslass[i].index = i + } } + // 点击隐藏的分类 tab 标题切换ul列表数据 + if (this.index === 0) { + cul[0].className = 'on' + } else { + cul[0].className = '' + } + if (this.index === 1) { + cul[1].className = 'on' + } else { + cul[1].className = '' + } + } } // 点击顶部分类按钮 mclassify.onclick = function () { - if (nnum === 0) { - css(mclassifyCont, {display: 'block'}) - if (pullNav.length > 0) { - pullNav[0].classList.remove('open') - } - if (moreNav.length > 0) { - css(moreNav[0], {display: 'none'}) - } - nnum = 1 - } else { - css(mclassifyCont, {display: 'none'}) - nnum = 0 + if (nnum === 0) { + css(mclassifyCont, {display: 'block'}) + if (pullNav.length > 0) { + pullNav[0].classList.remove('open') } + if (moreNav.length > 0) { + css(moreNav[0], {display: 'none'}) + } + nnum = 1 + } else { + css(mclassifyCont, {display: 'none'}) + nnum = 0 + } } } let browser1 = { @@ -128,35 +128,35 @@ export default class MIPMhotComment extends CustomElement { let u = navigator.userAgent return { trident: u.indexOf('Trident') > -1, - presto: u.indexOf('Presto') > -1, + presto: u.indexOf('Presto') > -1, webKit: u.indexOf('AppleWebKit') > -1, - gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), - android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, - iPad: u.indexOf('iPad') > -1, - webApp: u.indexOf('Safari') === -1 + iPad: u.indexOf('iPad') > -1, + webApp: u.indexOf('Safari') === -1 } })(), language: (navigator.browserLanguage || navigator.language).toLowerCase() } if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { - window.location='http://www.veryhuo.com' + window.location = 'http://www.veryhuo.com' } let moreBtn = this.element.querySelector('#soft-more') let sUl = this.element.querySelector('#soft-list') - let soft_p = 20 + let softP = 20 let isgame = document.getElementById('isgame').getAttribute('value') moreBtn.onclick = function () { // 创建一个Request对象 - let req = new Request('https://admin.veryhuo.com/mobile/open/more_soft?p=' + soft_p + '&type=2&isgame=' + isgame, { + let req = new Request('https://admin.veryhuo.com/mobile/open/more_soft?p=' + softP + '&type=2&isgame=' + isgame, { method: 'GET', cache: 'reload' - }); + }) fetch(req).then(function (response) { return response.json() - }).then(function(data) { + }).then(function (data) { if (data === '') { moreBtn.innerText = '加载完毕啦,么么哒~' return false @@ -165,20 +165,20 @@ export default class MIPMhotComment extends CustomElement { let khtml = '' let len = data.length for (let i = 0; i < len; i++) { - let dt = data[i] - dt.pubdate = to_date(dt.pubdate) - khtml = document.createElement("li") - khtml.innerHTML = '

' + dt.title + '' + dt.typename + '' + dt.softsize + '' + dt.os + '' + dt.pubdate + '

下载' - sUl.appendChild(khtml) + let dt = data[i] + dt.pubdate = toDate(dt.pubdate) + khtml = document.createElement('li') + khtml.innerHTML = '

' + dt.title + '' + dt.typename + '' + dt.softsize + '' + dt.os + '' + dt.pubdate + '

下载' + sUl.appendChild(khtml) } if (len < 20) { - moreBtn.innerText = '加载完毕啦,么么哒~' + moreBtn.innerText = '加载完毕啦,么么哒~' } else { - moreBtn.innerText = '点击有惊喜,萌萌哒~' + moreBtn.innerText = '点击有惊喜,萌萌哒~' } - soft_p = soft_p + 20 + softP = softP + 20 } - function to_date(phpstr) { + function toDate (phpstr) { let str = parseInt(phpstr) * 1000 let newDate = new Date(str) let yy = newDate.getUTCFullYear() diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js b/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js index 7aaedcca7..e24de6662 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js @@ -185,7 +185,7 @@ export default class MIPMhotComment extends CustomElement { btn1.onclick = function () { if (btn1.innerText === '加载完毕啦') return false // 创建一个Request对象 - let req = new Request('https://admin.veryhuo.com/mobile/open/list_more_zuixin?type='+ type + '&p='+ p + '&type_id=' + typeid, { + let req = new Request('https://admin.veryhuo.com/mobile/open/list_more_zuixin?type=' + type + '&p=' + p + '&type_id=' + typeNum, { method: 'GET', cache: 'reload' }) @@ -202,7 +202,7 @@ export default class MIPMhotComment extends CustomElement { for (let i = 0; i < len; i++) { let dt = data[i] if (dt.litpic === '') { - dt.litpic ='/images/nologo.png' + dt.litpic = '/images/nologo.png' } if (dt.version === 0) { dt.version = dt.os @@ -210,8 +210,8 @@ export default class MIPMhotComment extends CustomElement { dt.softrank = 5 } khtml = document.createElement('li') - khtml.innerHTML = '

'+ dt.title + '' + typename + '|' + dt.version + '|' + dt.softsize + '

下载' - zz += 1 + khtml.innerHTML = '

' + dt.title + '' + typename + '|' + dt.version + '|' + dt.softsize + '

下载' + zz = zz + 1 lists1.appendChild(khtml) } if (len < 10) { @@ -225,7 +225,7 @@ export default class MIPMhotComment extends CustomElement { } let hqp = 10 btn2.onclick = function () { - if (btn2.innerText === "加载完毕啦") return false + if (btn2.innerText === '加载完毕啦') return false let req = new Request('https://admin.veryhuo.com/mobile/open/list_more_zuire?type=' + type + '&p=' + hqp + '&type_id=' + typeNum, { method: 'GET', cache: 'reload' @@ -255,13 +255,12 @@ export default class MIPMhotComment extends CustomElement { } rhtml = document.createElement('li') rhtml.innerHTML = '

' + dt.title + '' + typename + '|' + dt.version + '|' + dt.softsize + '

下载' - zz += 1 + zz = zz + 1 lists2.appendChild(rhtml) } if (len < 20) { btn2.innerText = '加载完毕啦,么么哒~' - } - else { + } else { btn2.innerText = '点击有惊喜,萌萌哒~' } hqp = hqp + 30 @@ -301,7 +300,7 @@ export default class MIPMhotComment extends CustomElement { } phtml = document.createElement('li') phtml.innerHTML = '

' + dt.title + '' + typename + '|' + dt.version + '|' + dt.softsize + '

下载' - zz += 1 + zz = zz + 1 lists3.appendChild(phtml) } if (len < 20) { diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js index 758db5a2a..9148ebfbc 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js @@ -159,7 +159,6 @@ export default class MIPMhotComment extends CustomElement { window.stop ? window.stop() : document.execCommand('Stop') window.location.href = '/mip_ddooo_m.rar/index.html' } - console.log(type); let moreBtn = this.element.querySelector('#moreApp') let iList = this.element.querySelector('.Apply .iList') // 发送请求 @@ -182,7 +181,7 @@ export default class MIPMhotComment extends CustomElement { } else { moreBtn.innerText = '加载中...' let khtml = '' - let len = data.length; + let len = data.length for (let i = 0; i < len; i++) { let dt = data[i] dt.pubdate = toDate(dt.pubdate) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js b/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js index 79f6c958d..a61cbdf54 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js @@ -156,8 +156,7 @@ export default class MIPMhotComment extends CustomElement { } } } - } - else if (iosweb === '1') { + } else if (iosweb === '1') { if (isyouxi === '1') { window.location.href = '/mip_ddooo_m.rar/rank.html' } else if (isyouxi === '2') { diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js b/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js index cffe94f8c..a517ca793 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js @@ -121,8 +121,8 @@ export default class MIPMhotComment extends CustomElement { let btn2 = this.element.querySelector('#btn2') let specG = this.element.querySelector('#spec-game') let specS = this.element.querySelector('#spec-soft') - let sp1 = 20 let zz = 13 + let sp1 = 20 btn1.onclick = function () { if (btn1.innerText === '加载完毕啦,么么哒~') return false // 创建一个Request对象 @@ -150,7 +150,7 @@ export default class MIPMhotComment extends CustomElement { } khtml = document.createElement('li') khtml.innerHTML = '

' + dt.title + '

' - zz += 1 + zz = zz + 1 specG.appendChild(khtml) } if (len < 20) { @@ -189,7 +189,7 @@ export default class MIPMhotComment extends CustomElement { } shtml = document.createElement('li') shtml.innerHTML = '

' + dt.title + '

' - zz += 1 + zz = zz + 1 specS.appendChild(shtml) } if (len < 20) { diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js b/sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js index caf8cdad0..95968416f 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js @@ -135,24 +135,23 @@ export default class MIPMhotComment extends CustomElement { language: (navigator.browserLanguage || navigator.language).toLowerCase() } if (location.href.indexOf('m.veryhuo.com') > -1 && browser1.versions.mobile === false && browser1.versions.ios === false && browser1.versions.android === false && browser1.versions.iPhone === false && browser1.versions.iPad === false) { - window.location='http://www.veryhuo.com' + window.location = 'http://www.veryhuo.com' } let u = navigator.userAgent - let isIphone= !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) + let isIphone = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) let iosweb = document.getElementById('iosweb').getAttribute('value') let classweb = document.getElementById('classweb').getAttribute('value') let isyouxi = document.getElementById('isyouxi').getAttribute('value') - var type = iosweb === '0' ? '2' : '3' if (isIphone) { if (classweb === '1') { if (iosweb === '0') { let url = window.location.href if (isyouxi === '1') { - if (url.indexOf('611') !== -1){ + if (url.indexOf('611') !== -1) { window.location.href = '/mip_ddooo_m.rar/list/987.html' } } else { - if (url.indexOf('363') !== -1){ + if (url.indexOf('363') !== -1) { window.location.href = '/mip_ddooo_m.rar/list/986.html' } } @@ -162,11 +161,11 @@ export default class MIPMhotComment extends CustomElement { if (classweb === '1') { let url = window.location.href if (isyouxi === '1') { - if (url.indexOf('987') !== -1){ + if (url.indexOf('987') !== -1) { window.location.href = '/mip_ddooo_m.rar/list/611.html' } - } else { //软件 - if (url.indexOf('986') !== -1){ + } else { + if (url.indexOf('986') !== -1) { window.location.href = '/mip_ddooo_m.rar/list/363.html' } } diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js b/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js index cf1c14f63..0c945dd5f 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js @@ -155,7 +155,7 @@ export default class MIPMhotComment extends CustomElement { } khtml = document.createElement('li') khtml.innerHTML = '' + dt.title + '

' + dt.description + '

' - zz += 1 + zz = zz + 1 dlist.appendChild(khtml) } if (len < 20) { From 7b776bd6a0ef4e528b945820b3c23549dd45d90f Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Sat, 17 Aug 2019 13:22:55 +0800 Subject: [PATCH 08/34] Update mip-veryhuo-index.js --- .../components/mip-veryhuo-index/mip-veryhuo-index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js index 9148ebfbc..f90b590cb 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js @@ -153,11 +153,11 @@ export default class MIPMhotComment extends CustomElement { if (isIphone) { if (iosweb === '0') { window.stop ? window.stop() : document.execCommand('Stop') - window.location.href = '/mip_ddooo_m.rar/apple/index.html' + window.location.href = '/apple/index.html' } } else if (iosweb === '1') { window.stop ? window.stop() : document.execCommand('Stop') - window.location.href = '/mip_ddooo_m.rar/index.html' + window.location.href = '/index.html' } let moreBtn = this.element.querySelector('#moreApp') let iList = this.element.querySelector('.Apply .iList') @@ -168,7 +168,7 @@ export default class MIPMhotComment extends CustomElement { moreBtn.onclick = function () { if (doing === 1) return false // 创建一个Request对象 - let req = new Request('http://admin.veryhuo.com/mobile/open/more_soft?type=' + type + '&p=' + p, { + let req = new Request('https://admin.veryhuo.com/mobile/open/more_soft?type=' + type + '&p=' + p, { method: 'GET', cache: 'reload' }) From 92ba7be89b7042f768cdc73003d2837bab2b4347 Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Sat, 17 Aug 2019 13:24:21 +0800 Subject: [PATCH 09/34] Update mip-veryhuo-rank.js --- .../components/mip-veryhuo-rank/mip-veryhuo-rank.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js b/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js index a61cbdf54..74eafd91a 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-rank/mip-veryhuo-rank.js @@ -148,21 +148,21 @@ export default class MIPMhotComment extends CustomElement { if (iosweb === '0') { window.stop ? window.stop() : document.execCommand('Stop') if (isyouxi === '1') { - window.location.href = '/mip_ddooo_m.rar/apple/rank.html' + window.location.href = '/apple/rank.html' } else if (isyouxi === '2') { - window.location.href = '/mip_ddooo_m.rar/apple/game.html' + window.location.href = '/apple/game.html' } else { - window.location.href = '/mip_ddooo_m.rar/apple/soft.html' + window.location.href = '/apple/soft.html' } } } } else if (iosweb === '1') { if (isyouxi === '1') { - window.location.href = '/mip_ddooo_m.rar/rank.html' + window.location.href = '/rank.html' } else if (isyouxi === '2') { - window.location.href = '/mip_ddooo_m.rar/game.html' + window.location.href = '/game.html' } else { - window.location.href = '/mip_ddooo_m.rar/soft.html' + window.location.href = '/soft.html' } } // 点击加载更多 From 4d6bd88c8fcd3e15ad4286c12b7e20d3bffc6d5e Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Sat, 17 Aug 2019 13:26:45 +0800 Subject: [PATCH 10/34] Update mip-veryhuo-type.js --- .../components/mip-veryhuo-type/mip-veryhuo-type.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js b/sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js index 95968416f..8297921f8 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-type/mip-veryhuo-type.js @@ -148,11 +148,11 @@ export default class MIPMhotComment extends CustomElement { let url = window.location.href if (isyouxi === '1') { if (url.indexOf('611') !== -1) { - window.location.href = '/mip_ddooo_m.rar/list/987.html' + window.location.href = '/list/987.html' } } else { if (url.indexOf('363') !== -1) { - window.location.href = '/mip_ddooo_m.rar/list/986.html' + window.location.href = '/list/986.html' } } } @@ -162,11 +162,11 @@ export default class MIPMhotComment extends CustomElement { let url = window.location.href if (isyouxi === '1') { if (url.indexOf('987') !== -1) { - window.location.href = '/mip_ddooo_m.rar/list/611.html' + window.location.href = '/list/611.html' } } else { if (url.indexOf('986') !== -1) { - window.location.href = '/mip_ddooo_m.rar/list/363.html' + window.location.href = '/list/363.html' } } } From 4c32f86a25f6f2b4426a872ad0af56455d833714 Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Sat, 17 Aug 2019 15:05:54 +0800 Subject: [PATCH 11/34] Update mip-veryhuo-column.js --- .../components/mip-veryhuo-column/mip-veryhuo-column.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js b/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js index e24de6662..94b756128 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js @@ -157,7 +157,7 @@ export default class MIPMhotComment extends CustomElement { if (classweb === '2') { let azurl = window.location.href let azurlarr = azurl.split('/') - let azurlid = azurlarr[5].replace('.html', '') + let azurlid = azurlarr[4].replace('.html', '') if (isios === '0') { azurl = azurl.replace(azurlid, classid) window.location.href = azurl @@ -167,7 +167,7 @@ export default class MIPMhotComment extends CustomElement { if (classweb === '2') { let azurl = window.location.href let azurlarr = azurl.split('/') - let azurlid = azurlarr[5].replace('.html', '') + let azurlid = azurlarr[4].replace('.html', '') if (isios === '1') { azurl = azurl.replace(azurlid, classid) window.location.href = azurl From 668639dc75d408aa7ec351d6cebeef868fb83021 Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Sat, 17 Aug 2019 15:51:35 +0800 Subject: [PATCH 12/34] Update mip-veryhuo-column.js --- .../components/mip-veryhuo-column/mip-veryhuo-column.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js b/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js index 94b756128..02173cc2a 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-column/mip-veryhuo-column.js @@ -245,8 +245,6 @@ export default class MIPMhotComment extends CustomElement { console.log(dt) if (dt.litpic === '') { dt.litpic = '/images/nologo.png' - } else { - dt.litpic = 'https://www.veryhuo.com' + dt.litpic } if (dt.version === 0) { dt.version = dt.os @@ -290,8 +288,6 @@ export default class MIPMhotComment extends CustomElement { console.log(dt) if (dt.litpic === '') { dt.litpic = '/images/nologo.png' - } else { - dt.litpic = 'https://www.veryhuo.com' + dt.litpic } if (dt.version === 0) { dt.version = dt.os From 2158dbeaa2d1c2bce532421860106a405d962f29 Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Sat, 17 Aug 2019 16:02:40 +0800 Subject: [PATCH 13/34] Update mip-veryhuo-special.js --- .../components/mip-veryhuo-special/mip-veryhuo-special.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js b/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js index a517ca793..6e220332e 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-special/mip-veryhuo-special.js @@ -145,8 +145,6 @@ export default class MIPMhotComment extends CustomElement { console.log(dt) if (dt.litpic === '') { dt.litpic = '/images/nologo.png' - } else { - dt.litpic = 'https://admin.veryhuo.com/upload/' + dt.litpic } khtml = document.createElement('li') khtml.innerHTML = '

' + dt.title + '

' @@ -184,8 +182,6 @@ export default class MIPMhotComment extends CustomElement { console.log(dt) if (dt.litpic === '') { dt.litpic = '/images/nologo.png' - } else { - dt.litpic = 'https://admin.veryhuo.com/upload/' + dt.litpic } shtml = document.createElement('li') shtml.innerHTML = '

' + dt.title + '

' From dc5ff6227b635101e0e720988812b4864cc0a747 Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Sat, 17 Aug 2019 16:05:36 +0800 Subject: [PATCH 14/34] Update mip-veryhuo-zx.js --- .../components/mip-veryhuo-zx/mip-veryhuo-zx.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js b/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js index 0c945dd5f..e6e63a2e2 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js @@ -145,16 +145,9 @@ export default class MIPMhotComment extends CustomElement { let dt = data[i] if (dt.litpic === '') { dt.litpic = '/images/noimg.png' - } else { - let litpic = dt.litpic - if (litpic.indexOf('article/') !== -1 || litpic.indexOf('default/') !== -1) { - litpic = 'https://admin.veryhuo.com/upload/' + litpic - } else { - litpic = 'https://www.veryhuo.com' + litpic - } } khtml = document.createElement('li') - khtml.innerHTML = '' + dt.title + '

' + dt.description + '

' + khtml.innerHTML = '' + dt.title + '

' + dt.description + '

' zz = zz + 1 dlist.appendChild(khtml) } From 18ae4cde3e415926e14d8ae5c2eaa92c9f8a80aa Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Sat, 17 Aug 2019 16:09:25 +0800 Subject: [PATCH 15/34] Update mip-veryhuo-androidsoft.js --- .../mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js index a5481fd60..a8882d8e6 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/mip-veryhuo-androidsoft.js @@ -152,7 +152,7 @@ export default class MIPMhotComment extends CustomElement { let dt = data[i] dt.pubdate = toDate(dt.pubdate) khtml = document.createElement('li') - khtml.innerHTML = '

' + dt.title + '' + dt.typename + '' + dt.softsize + '' + dt.os + '' + dt.pubdate + '

下载' + khtml.innerHTML = '

' + dt.title + '' + dt.typename + '' + dt.softsize + '' + dt.os + '' + dt.pubdate + '

下载' asmUl.appendChild(khtml) } if (len < 20) { @@ -194,7 +194,7 @@ export default class MIPMhotComment extends CustomElement { let dt = data[i] dt.pubdate = toDate(dt.pubdate) ghtml = document.createElement('li') - ghtml.innerHTML = '

' + dt.title + '' + dt.typename + '' + dt.softsize + '' + dt.os + '' + dt.pubdate + '

下载' + ghtml.innerHTML = '

' + dt.title + '' + dt.typename + '' + dt.softsize + '' + dt.os + '' + dt.pubdate + '

下载' agmUl.appendChild(ghtml) } if (len < 20) { From 462d09c4855ccc04c5644db227a9a0d2fc4344d9 Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Sat, 17 Aug 2019 17:09:39 +0800 Subject: [PATCH 16/34] Update mip-veryhuo-zx.js --- sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js b/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js index e6e63a2e2..5a6274316 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-zx/mip-veryhuo-zx.js @@ -147,7 +147,7 @@ export default class MIPMhotComment extends CustomElement { dt.litpic = '/images/noimg.png' } khtml = document.createElement('li') - khtml.innerHTML = '' + dt.title + '

' + dt.description + '

' + khtml.innerHTML = '' + dt.title + '

' + dt.description + '

' zz = zz + 1 dlist.appendChild(khtml) } From cdf05307aa9781cf4ac56164b2408a5879b8cdbf Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Sat, 17 Aug 2019 17:56:12 +0800 Subject: [PATCH 17/34] Update mip-veryhuo-index.js --- .../components/mip-veryhuo-index/mip-veryhuo-index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js index f90b590cb..1c2d51851 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js @@ -154,10 +154,12 @@ export default class MIPMhotComment extends CustomElement { if (iosweb === '0') { window.stop ? window.stop() : document.execCommand('Stop') window.location.href = '/apple/index.html' + lm=2 } } else if (iosweb === '1') { window.stop ? window.stop() : document.execCommand('Stop') window.location.href = '/index.html' + lm=1 } let moreBtn = this.element.querySelector('#moreApp') let iList = this.element.querySelector('.Apply .iList') @@ -197,6 +199,15 @@ export default class MIPMhotComment extends CustomElement { } p = p + 30 } + SBBtn.click(function () { + search() + }) + function search () { + let sV = SBInp.value + let sV_c = SBInp.value.length + let forpath = '/search.php?wd=' + encodeURI(sV) + '&lm=' + lm + window.location.href = forpath + } // 将时间戳转换成 yy-mm-dd function toDate (phpstr) { let str = parseInt(phpstr) * 1000 From 8eb01f9be5b7a0b08b93e5ab2351aee592324a0a Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Sat, 17 Aug 2019 18:12:24 +0800 Subject: [PATCH 18/34] Update mip-veryhuo-index.js --- .../components/mip-veryhuo-index/mip-veryhuo-index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js index 1c2d51851..1cb25b700 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-index/mip-veryhuo-index.js @@ -150,16 +150,20 @@ export default class MIPMhotComment extends CustomElement { let isIphone = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) let iosweb = document.getElementById('iosweb').getAttribute('value') let type = iosweb === '0' ? '2' : '3' + let lm = '' + if (type === '2') { + lm = '1' + } else if (type === '3') { + lm = '2' + } if (isIphone) { if (iosweb === '0') { window.stop ? window.stop() : document.execCommand('Stop') window.location.href = '/apple/index.html' - lm=2 } } else if (iosweb === '1') { window.stop ? window.stop() : document.execCommand('Stop') window.location.href = '/index.html' - lm=1 } let moreBtn = this.element.querySelector('#moreApp') let iList = this.element.querySelector('.Apply .iList') @@ -199,12 +203,13 @@ export default class MIPMhotComment extends CustomElement { } p = p + 30 } + let SBBtn = this.element.querySelector('.SBBtn') + let SBInp = this.element.querySelectorAll('.SBInp input') SBBtn.click(function () { search() }) function search () { let sV = SBInp.value - let sV_c = SBInp.value.length let forpath = '/search.php?wd=' + encodeURI(sV) + '&lm=' + lm window.location.href = forpath } From 06699bf0d2550cf28e26cdfa3cd153c436f318a2 Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Mon, 19 Aug 2019 13:34:23 +0800 Subject: [PATCH 19/34] Update README.md --- .../components/mip-veryhuo-androidsoft/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/README.md index bb1deaae6..2245d91c9 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/README.md +++ b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/README.md @@ -20,7 +20,7 @@ ### url -说明:本站点网址 +说明:顶部菜单按钮点击显示隐藏;下方点击加载更多,请求数据 必选项:是 @@ -28,4 +28,4 @@ 取值范围:URL -默认值:无 \ No newline at end of file +默认值:无 From 8b1b591f7ce990324d756920f93a61c5e50aa1c5 Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Mon, 19 Aug 2019 13:36:54 +0800 Subject: [PATCH 20/34] Update README.md --- .../m.veryhuo.com/components/mip-veryhuo-azyy-azyx/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/README.md index 712a5a6e6..6bda9ce10 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/README.md +++ b/sites/m.veryhuo.com/components/mip-veryhuo-azyy-azyx/README.md @@ -20,7 +20,7 @@ ### url -说明:本站点网址 +说明:顶部菜单按钮点击显示隐藏;点击搜索按钮跳转到新网页;下方点击加载更多,请求数据。 必选项:是 @@ -28,4 +28,4 @@ 取值范围:URL -默认值:无 \ No newline at end of file +默认值:无 From c2229036166e620564be29d2ba2041390038b9d9 Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Mon, 19 Aug 2019 13:39:27 +0800 Subject: [PATCH 21/34] Update README.md --- sites/m.veryhuo.com/components/mip-veryhuo-column/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-column/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-column/README.md index eb9d13a62..e2e486038 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-column/README.md +++ b/sites/m.veryhuo.com/components/mip-veryhuo-column/README.md @@ -20,7 +20,7 @@ ### url -说明:本站点网址 +说明:判断机型跳转;点击搜索按钮跳转;顶部菜单按钮点击显示隐藏;下方点击加载更多,请求数据。 必选项:是 @@ -28,4 +28,4 @@ 取值范围:URL -默认值:无 \ No newline at end of file +默认值:无 From 8fc6fbd6e963b3ffefcbae0708b82be87a90d69f Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Mon, 19 Aug 2019 13:41:23 +0800 Subject: [PATCH 22/34] Update README.md --- sites/m.veryhuo.com/components/mip-veryhuo-index/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-index/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-index/README.md index 163f0923b..07ee74c1a 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-index/README.md +++ b/sites/m.veryhuo.com/components/mip-veryhuo-index/README.md @@ -20,7 +20,7 @@ ### url -说明:本站点网址 +说明:判断机型跳转;点击搜索按钮跳转;顶部菜单按钮点击显示隐藏;下方点击加载更多,请求数据。 必选项:是 @@ -28,4 +28,4 @@ 取值范围:URL -默认值:无 \ No newline at end of file +默认值:无 From a2240f05ebdb9cb28a39ee08e4279c1587bd5b85 Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Mon, 19 Aug 2019 13:42:35 +0800 Subject: [PATCH 23/34] Update README.md --- sites/m.veryhuo.com/components/mip-veryhuo-notfound/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-notfound/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/README.md index 3df692803..467e9ff3f 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-notfound/README.md +++ b/sites/m.veryhuo.com/components/mip-veryhuo-notfound/README.md @@ -20,7 +20,7 @@ ### url -说明:本站点网址 +说明:顶部菜单按钮点击显示隐藏;点击搜索跳转。 必选项:是 @@ -28,4 +28,4 @@ 取值范围:URL -默认值:无 \ No newline at end of file +默认值:无 From ad56b32e6edf812b4b0d8a14e82499b05737996b Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Mon, 19 Aug 2019 13:45:17 +0800 Subject: [PATCH 24/34] Update README.md --- sites/m.veryhuo.com/components/mip-veryhuo-rank/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-rank/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-rank/README.md index 3e1488ddd..2e0a3145b 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-rank/README.md +++ b/sites/m.veryhuo.com/components/mip-veryhuo-rank/README.md @@ -20,7 +20,7 @@ ### url -说明:本站点网址 +说明:导航点击展开收起;判断机型跳转;顶部菜单按钮点击显示隐藏;下方点击加载更多,请求数据。 必选项:是 @@ -28,4 +28,4 @@ 取值范围:URL -默认值:无 \ No newline at end of file +默认值:无 From 1778105f93db2c88aeb2249f27c39e99065b7069 Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Mon, 19 Aug 2019 13:47:03 +0800 Subject: [PATCH 25/34] Update README.md --- sites/m.veryhuo.com/components/mip-veryhuo-special/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-special/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-special/README.md index fd8d4b71d..9a55e71a8 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-special/README.md +++ b/sites/m.veryhuo.com/components/mip-veryhuo-special/README.md @@ -20,7 +20,7 @@ ### url -说明:本站点网址 +说明:点击搜索跳转;顶部菜单按钮点击显示隐藏;下方点击加载更多,请求数据。 必选项:是 @@ -28,4 +28,4 @@ 取值范围:URL -默认值:无 \ No newline at end of file +默认值:无 From aa13ccbb34dc0b8a0c52690c33c3e389f6e32906 Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Mon, 19 Aug 2019 13:48:39 +0800 Subject: [PATCH 26/34] Update README.md --- sites/m.veryhuo.com/components/mip-veryhuo-type/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-type/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-type/README.md index fa6e41499..28abd36c3 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-type/README.md +++ b/sites/m.veryhuo.com/components/mip-veryhuo-type/README.md @@ -20,7 +20,7 @@ ### url -说明:本站点网址 +说明:判断机型跳转;顶部菜单按钮点击显示隐藏;搜索点击跳转; 必选项:是 @@ -28,4 +28,4 @@ 取值范围:URL -默认值:无 \ No newline at end of file +默认值:无 From 6a4cc57bc089168b9f24e2ebeb074f5567f1c229 Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Mon, 19 Aug 2019 13:51:06 +0800 Subject: [PATCH 27/34] Update README.md --- sites/m.veryhuo.com/components/mip-veryhuo-zx/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-zx/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-zx/README.md index 72dcee60c..f9478618f 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-zx/README.md +++ b/sites/m.veryhuo.com/components/mip-veryhuo-zx/README.md @@ -20,7 +20,7 @@ ### url -说明:本站点网址 +说明:点击搜索跳转;顶部菜单按钮点击显示隐藏;下方点击加载更多,请求数据。 必选项:是 @@ -28,4 +28,4 @@ 取值范围:URL -默认值:无 \ No newline at end of file +默认值:无 From b09ec5a5ccc1d26e52e4c648ea575be0c6b6a818 Mon Sep 17 00:00:00 2001 From: lkd <30851978+faith1314@users.noreply.github.com> Date: Mon, 19 Aug 2019 14:17:40 +0800 Subject: [PATCH 28/34] Update README.md --- .../m.veryhuo.com/components/mip-veryhuo-androidsoft/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/README.md b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/README.md index 2245d91c9..57e93b336 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/README.md +++ b/sites/m.veryhuo.com/components/mip-veryhuo-androidsoft/README.md @@ -20,7 +20,7 @@ ### url -说明:顶部菜单按钮点击显示隐藏;下方点击加载更多,请求数据 +说明:点击搜索按钮跳转;顶部菜单按钮点击显示隐藏;下方点击加载更多,请求数据 必选项:是 From fcf1651203be6dfe87f35c3c7e7b0eae9f46d065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=87=AF=E8=BF=AA?= <2379942422@qq.com> Date: Tue, 12 May 2020 14:45:50 +0800 Subject: [PATCH 29/34] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B1=8F=E8=94=BD?= =?UTF-8?q?=E5=9F=8E=E5=B8=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mip-veryhuo-comment/mip-veryhuo-comment.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js index d40018d3e..ba4bc2fc3 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js @@ -53,6 +53,18 @@ export default class MIPMpc6Comment extends CustomElement { css(cDSContent, {display: 'none'}) } } + let body_a = this.element.querySelectorAll("body") + let ssid=cSOHUCS[0].attributes['sid'].value + css(body_a, {display: 'none'}) + fetch("/Api.php?action='forbidCity'&id="+ssid).then(function(e) { + return e.text() + }).then(function(text) { + if(text==1){ + MIP.viewer.href("https://m.veryhuo.com") + }else{ + css(body_a, {display: 'block'}) + } + }) let coryverlist = this.element.querySelectorAll('.oryverlist')[0] let cBContent = this.element.querySelectorAll('#BBContent')[0] if (loryverbox.length > 0) { From b08312ffb81557eb5d6d54b504460770d494630c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=87=AF=E8=BF=AA?= <2379942422@qq.com> Date: Tue, 12 May 2020 14:59:21 +0800 Subject: [PATCH 30/34] =?UTF-8?q?=E9=94=99=E8=AF=AF=E8=A7=A3=E5=86=B31?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mip-veryhuo-comment/mip-veryhuo-comment.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js index ba4bc2fc3..418c65105 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js @@ -53,17 +53,17 @@ export default class MIPMpc6Comment extends CustomElement { css(cDSContent, {display: 'none'}) } } - let body_a = this.element.querySelectorAll("body") - let ssid=cSOHUCS[0].attributes['sid'].value - css(body_a, {display: 'none'}) - fetch("/Api.php?action='forbidCity'&id="+ssid).then(function(e) { + let bodya = this.element.querySelectorAll("body") + let ssid = cSOHUCS[0].attributes['sid'].value + css(bodya, {display: 'none'}) + fetch('/Api.php?action='forbidCity'&id=' + ssid).ten( function(e) { return e.text() }).then(function(text) { - if(text==1){ - MIP.viewer.href("https://m.veryhuo.com") - }else{ - css(body_a, {display: 'block'}) - } + if (text === 1){ + MIP.viewer.href('https://m.veryhuo.com') + } else { + css(bodya, {display: 'block'}) + } }) let coryverlist = this.element.querySelectorAll('.oryverlist')[0] let cBContent = this.element.querySelectorAll('#BBContent')[0] From 5f04969db4dbf89eb5e14c8642a724324dd0a155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=87=AF=E8=BF=AA?= <2379942422@qq.com> Date: Tue, 12 May 2020 15:03:35 +0800 Subject: [PATCH 31/34] =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=862?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mip-veryhuo-comment/mip-veryhuo-comment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js index 418c65105..b290a985a 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js @@ -56,7 +56,7 @@ export default class MIPMpc6Comment extends CustomElement { let bodya = this.element.querySelectorAll("body") let ssid = cSOHUCS[0].attributes['sid'].value css(bodya, {display: 'none'}) - fetch('/Api.php?action='forbidCity'&id=' + ssid).ten( function(e) { + fetch('/Api.php?action=forbidCity&id=' + ssid).then( function(e) { return e.text() }).then(function(text) { if (text === 1){ From 375f8c41a84ee335970aab057eb231fec7213230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=87=AF=E8=BF=AA?= <2379942422@qq.com> Date: Tue, 12 May 2020 15:18:10 +0800 Subject: [PATCH 32/34] =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=AE=E6=94=B93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mip-veryhuo-comment/mip-veryhuo-comment.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js index b290a985a..3045f9041 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js @@ -53,16 +53,16 @@ export default class MIPMpc6Comment extends CustomElement { css(cDSContent, {display: 'none'}) } } - let bodya = this.element.querySelectorAll("body") + let bodya = this.element.querySelectorAll('body') let ssid = cSOHUCS[0].attributes['sid'].value css(bodya, {display: 'none'}) - fetch('/Api.php?action=forbidCity&id=' + ssid).then( function(e) { - return e.text() - }).then(function(text) { - if (text === 1){ - MIP.viewer.href('https://m.veryhuo.com') + fetch('/Api.php?action=forbidCity&id=' + ssid).then(function (e) { + return e.text() + }).then(function (text) { + if (text === 1) { + MIP.viewer.href('https://m.veryhuo.com') } else { - css(bodya, {display: 'block'}) + css(bodya, {display: 'block'}) } }) let coryverlist = this.element.querySelectorAll('.oryverlist')[0] From 2d7178147ce6a003697bdd0c6a505c326264f4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=87=AF=E8=BF=AA?= <2379942422@qq.com> Date: Tue, 12 May 2020 15:25:38 +0800 Subject: [PATCH 33/34] =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E4=BA=A44?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mip-veryhuo-comment/mip-veryhuo-comment.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js index 3045f9041..879f6a54c 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js @@ -59,11 +59,11 @@ export default class MIPMpc6Comment extends CustomElement { fetch('/Api.php?action=forbidCity&id=' + ssid).then(function (e) { return e.text() }).then(function (text) { - if (text === 1) { - MIP.viewer.href('https://m.veryhuo.com') - } else { - css(bodya, {display: 'block'}) - } + if (text === 1) { + MIP.viewer.href('https://m.veryhuo.com') + } else { + css(bodya, {display: 'block'}) + } }) let coryverlist = this.element.querySelectorAll('.oryverlist')[0] let cBContent = this.element.querySelectorAll('#BBContent')[0] From 0e9e93a7d2350c149da08ac9233f363b202d2df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=87=AF=E8=BF=AA?= <2379942422@qq.com> Date: Tue, 12 May 2020 16:37:26 +0800 Subject: [PATCH 34/34] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mip-veryhuo-comment/mip-veryhuo-comment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js index 879f6a54c..2137b04ef 100644 --- a/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js +++ b/sites/m.veryhuo.com/components/mip-veryhuo-comment/mip-veryhuo-comment.js @@ -56,7 +56,7 @@ export default class MIPMpc6Comment extends CustomElement { let bodya = this.element.querySelectorAll('body') let ssid = cSOHUCS[0].attributes['sid'].value css(bodya, {display: 'none'}) - fetch('/Api.php?action=forbidCity&id=' + ssid).then(function (e) { + fetch('/ForbidCity.php?id=' + ssid).then(function (e) { return e.text() }).then(function (text) { if (text === 1) {