Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
customElement.prototype.firstInviewCallback = function () {
var t = this.element;
var gtype = t.getAttribute('g_type');
var siteurl = '//m.3h3.com/';
if (gtype === '3h3_news') {
// 点击量统计
var module = t.getAttribute('module');
var hitsurl = siteurl + 'ajax.asp?action=4&id=' + t.getAttribute('id');
if (module !== '') {
hitsurl += '&module=' + module;
}
$.getJSON(hitsurl);
} else if (gtype === '3h3_youxi_content_hideshow') {
// 内容缩进
var con = $(t);
if (con.height() > 200) {
var newcon = con.find('.m-con');
newcon.addClass('wraptext');
newcon.addClass('snbg');
var btn = con.find('.m-show');
btn.click(function () {
if ($(this).hasClass('show')) {
newcon.addClass('wraptext');
newcon.addClass('snbg');
$(this).removeClass('show');
} else {
newcon.removeClass('wraptext');
newcon.removeClass('snbg');
var ipLoad = function (callback) {
// var url = 'http://ipip.iask.cn/iplookup/search?format=json&callback=?';
var url = 'https://mipp.iask.cn/iplookup/search?format=json&callback=?';
try {
$.getJSON(url, function (data) {
callback(data);
});
}
catch (e) {}
};
}
else {
setCookie('admbottom', 'close');
admbottom.removeClass('fix');
}
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) {
scrollTop = document.documentElement.scrollTop;
}
else if (document.body) {
scrollTop = document.body.scrollTop;
}
return scrollTop;
}
function setCookie(name, value) {
function getFhAd(opt) {
opt = opt || {};
var adUrl = opt.adUrl;
var query = opt.query;
var element = opt.element;
var uid = '';
$.getJSON(adUrl, query, function (res) {
var isHasFhAd;
var data = $.parseJSON(res.result);
// 遍历直投广告ID
$.each(data, function (k, v) {
// 获取投放直销广告的节点
element = $('mip-fh-zhida-plus[fh-ad-pid="' + k + '"]');
uid = element.attr('fh-ad-uid');
// 根据医生id判断物料类型
v = (query.uid && $.isPlainObject(v)) ? v[uid] : v;
// 有特定广告位id的直投广告 先隐藏网盟 再显示直投
if ($.trim(v)) {
element.children(':first-child').remove();
function getFhAd(opt) {
opt = opt || {};
var adUrl = opt.adUrl;
var query = opt.query;
var element = opt.element;
var uid = '';
$.getJSON(adUrl, query, function (res) {
var isHasFhAd;
var data = $.parseJSON(res.result);
// 遍历直投广告ID
$.each(data, function (k, v) {
// 获取投放直销广告的节点
element = $('mip-fh-ad-plus[fh-ad-pid="' + k + '"]');
uid = element.attr('fh-ad-uid');
// 根据医生id判断物料类型
v = (query.uid && $.isPlainObject(v)) ? v[uid] : v;
// 有特定广告位id的直投广告 先隐藏网盟 再显示直投
if ($.trim(v)) {
element.children(':first-child').remove();
var ipLoad = function (callback) {
var url = 'https://ipip.iask.cn/iplookup/search?format=json&callback=?';
// var url = 'https://mipp.iask.cn/iplookup/search?format=json&ip=43.226.37.75&callback=?';
try {
$.getJSON(url, function (data) {
callback(data);
});
}
catch (e) {}
};
var hotRecommendUnLi = function (url, img, title, statsBaid, pos) {
// 设置配置项默认值
var posId = [opt.posId] || [1];
var kw = opt.kw || '';
var element = opt.element;
// 接口参数值
var query = {
kw: kw,
pid: posId.join(',')
};
var FhAdPutNum = $('mip-fh-ad-plus').length;
// 判断直投广告参数,是否加载直投广告请求
if (kw && kw.length) {
$.getJSON(adUrl, query, function (res) {
var fhAdNum = $body.attr('fh-ad-num') || 0;
var data = $.parseJSON(res.result);
// 遍历直投广告ID
$.each(data, function (k, v) {
// 有特定广告位id的直投广告 先隐藏网盟 再显示直投
if ($.trim(v)) {
element.children(':first-child').remove();
element.html(v);
$body.addClass('view-fh-ad-' + (+k));
$body.attr('fh-ad-num', ++fhAdNum);
}
// 无特定广告位id直投广告显示网盟
else {
getPosts: function() {
mediator.publish('posts:get:before');
$.getJSON('/more-posts/?limit=5&offset=' + this.offset, function(response) {
mediator.publish('posts:get:done', response);
});
},
function getIP(opt, cb) {
opt = opt || {};
$.getJSON(ipUrl, function (json) {
var res = json || {};
util.fn.isPlainObject(opt.query) && (opt.query.ip = res.ip);
if ((typeof cb).toLocaleLowerCase() === 'function') {
cb(opt);
}
});
}
function dropload(element, options) {
++ajaxs.nowPage;
var count = options.count;
var appmore = $(element).find('.appmore');
appmore.html(ajaxs.downhtml);
ajaxs.ajaxUrl = options.url + '&page=' + ajaxs.nowPage;
$.getJSON(ajaxs.ajaxUrl + '&callback=?', function (data) {
if (ajaxs.nowPage >= count) {
$(element).find('.dropload-down').html(endhtml);
return;
}
if (parseInt(count, 10) === 0) {
return;
}
$(element).find('#applist').append(data);
appmore.html('<div class="dropload-down"><div class="dropload-refresh">↑上拉加载更多</div></div>');
});
}