Skip to content

Commit

Permalink
Merge pull request #83 from bjwangbin/master
Browse files Browse the repository at this point in the history
版本升级,增加统计功能
  • Loading branch information
PEI WANG authored Nov 18, 2016
2 parents ecf76c3 + 142a110 commit adc17e0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
17 changes: 16 additions & 1 deletion mip-xueyou-article/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,20 @@ mip-xueyou-article 学优网mip改造插件

### 基本使用
```html
<mip-xueyou-article></mip-xueyou-article>
<mip-xueyou-article id='docId' token='token'></mip-xueyou-article>
```

## 属性

### id

说明:唯一编号
必选项:是
类型:字符串


### token

说明:加密编码
必选项:是
类型:字符串
24 changes: 22 additions & 2 deletions mip-xueyou-article/mip-xueyou-article.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
/**
* 学优网mip改造 javascript功能插件
* @file 网页主要功能
* @file 脚本支持
* @author [email protected]
* @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');
// 查看更多按钮功能
Expand All @@ -20,6 +24,9 @@ define(function (require) {
}
var timeOutEvent = 0;
btnMax.on({
click: function (e) {
maxpage();
},
touchstart: function (e) {
timeOutEvent = setTimeout(function () {
timeOutEvent = 0;
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion mip-xueyou-article/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mip-xueyou-article",
"version": "1.0.2",
"version": "1.1.1",
"author": {
"name": "myoa",
"email": "[email protected]",
Expand Down

0 comments on commit adc17e0

Please sign in to comment.