diff --git a/mip-xueyou-article/README.md b/mip-xueyou-article/README.md index 4c7ccb253..771a728d7 100644 --- a/mip-xueyou-article/README.md +++ b/mip-xueyou-article/README.md @@ -12,5 +12,20 @@ mip-xueyou-article 学优网mip改造插件 ### 基本使用 ```html - + ``` + +## 属性 + +### id + +说明:唯一编号 +必选项:是 +类型:字符串 + + +### token + +说明:加密编码 +必选项:是 +类型:字符串 diff --git a/mip-xueyou-article/mip-xueyou-article.js b/mip-xueyou-article/mip-xueyou-article.js index 753fb0c06..50fbae415 100644 --- a/mip-xueyou-article/mip-xueyou-article.js +++ b/mip-xueyou-article/mip-xueyou-article.js @@ -1,14 +1,18 @@ /** * 学优网mip改造 javascript功能插件 -* @file 网页主要功能 +* @file 脚本支持 * @author myoa@163.com -* @version 1.0.2 +* @time 2016.11.18 +* @version 1.1.1 */ define(function (require) { var $ = require('zepto'); var dbshow = false; var customElem = require('customElement').create(); customElem.prototype.build = function () { + var el = this.element; + var docId = el.getAttribute('id'); + var code = el.getAttribute('token'); // 以self方式重置a标签 $('.openself').attr('target', '_self'); // 查看更多按钮功能 @@ -20,6 +24,9 @@ define(function (require) { } var timeOutEvent = 0; btnMax.on({ + click: function (e) { + maxpage(); + }, touchstart: function (e) { timeOutEvent = setTimeout(function () { timeOutEvent = 0; @@ -88,6 +95,19 @@ define(function (require) { dbshow || opendubao(); }); } + // 统计系统 + var readed = getCookie('readed_' + docId); + var dtp = 'wenku'; + if (parseInt(docId, 10) < 356835) { + dtp = 'fanwen'; + } + if (readed !== 'false') { + $.getJSON('http://www.wangshengbo.cn/api/' + dtp + '/hits/?id=' + docId + '&code=' + code + '&jsoncallback=?', + function (rda) { + setCookie('readed_' + docId, 'false'); + } + ); + } function getScrollTop() { var scrollTop = 0; if (document.documentElement && document.documentElement.scrollTop) { diff --git a/mip-xueyou-article/package.json b/mip-xueyou-article/package.json index d8360f165..f579f7b4b 100644 --- a/mip-xueyou-article/package.json +++ b/mip-xueyou-article/package.json @@ -1,6 +1,6 @@ { "name": "mip-xueyou-article", - "version": "1.0.2", + "version": "1.1.1", "author": { "name": "myoa", "email": "myoa@163.com",