-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from bjwangbin/master
版本升级,增加统计功能
- Loading branch information
Showing
3 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
// 查看更多按钮功能 | ||
|
@@ -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) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]", | ||
|