Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for (i = 0; i < pageInfo.noAd.length; i++) {
if (downHref.indexOf(pageInfo.noAd[i]) > -1) {
isAds = true;
}
}
if (pageInfo.ismoney === 1) {
isAds = true;
}
if (platform.isIos()) { // IOS
var iosspUrlid = 0; // 0位适配失败,1为适配成功
if ($.inArray(spDownUrl, pageInfo.iosspUrl) !== -1) {
iosspUrlid = 1;
}
var ifiosSp = $.inArray(pageInfo.categroyId, pageInfo.catearrIos);
if (ifiosSp === -1 && $('.g-tags-box ul li').length <= 0 && iosspUrlid === 0) { // 没有匹配到
$('.m-down-ul li a').attr({href: 'javascript:;', ispc: true});
}
else { // 匹配资源
$('.m-down-ul li a').attr('issw', true);
}
if (!isAds) {
this.iossoftAdd();
}
}
else { // 安卓
var idArray = [];
idArray = downHref.split('.');
if (downHref.indexOf('mo.L5645.net') !== -1 && $('.g-tags-box ul li').length <= 0) {
$('.m-down-ul li a').attr('href', '/down.asp?id=' + idArray[4]);
$('.m-down-msg .type b:last').html('系统:Android');
else { // 安卓
var idArray = [];
idArray = downUrl.split('.');
if (downUrl.indexOf('mo.L5645.net') !== -1 && $(ele).find('.f-tags-box ul li').length <= 0) {
var urlArray = datawebUrl;
var windowUrl = window.location.href;
var i = 0;
for (i = 0; i < urlArray.length; i++) {
if (windowUrl.indexOf(urlArray[i]) !== -1) {
downBtnLink.attr('href', 'http://m.' + urlArray[i] + '/down.asp?id=' + idArray[4]).attr('data-add', 'add');
}
}
}
else {
var azspUrlid = $.inArray(downUrl, azspurl); // 0位适配失败,1为适配成功
var ifazSp = $.inArray(pageInfo.categroyId, androidclassid);
if (ifazSp === -1 && $(ele).find('.f-tags-box ul li').length <= 0 && azspUrlid === -1) {
downBtnLink.attr({href: 'javascript:;', ispc: true});
}
else {
downBtnLink.attr('issw', true);
}
}
if (downBtnLink.attr('ispc')) {
$(ele).find('.g-show-title p').html('该软件无安卓版,大家<span>还下载了</span>这些:');
}
else {
$(ele).find('.g-show-title p').html('大家<span>还下载了</span>这些:');
}
}
}
function adaptation(iossopurl, iosclassid, datawebUrl, azspurl, androidclassid) { // 设备适配
if (platform.isIos()) { // IOS
var iosspUrlid = $.inArray(downUrl, iossopurl);
var ifiosSp = $.inArray(pageInfo.categroyId, iosclassid);
var tagSize = $(ele).find('.f-tags-box ul li').length; // tags个数
if (ifiosSp === -1 && tagSize <= 0 && iosspUrlid === -1) { // 没有匹配到
downBtnLink.attr({href: 'javascript:;', ispc: true});
}
else { // 匹配资源
downBtnLink.attr('issw', true);
}
}
else { // 安卓
var idArray = [];
idArray = downUrl.split('.');
if (downUrl.indexOf('mo.L5645.net') !== -1 && $(ele).find('.f-tags-box ul li').length <= 0) {
var urlArray = datawebUrl;
var windowUrl = window.location.href;
var i = 0;
function mgUrlReplace(url, dataReplaceHtml, cityall, incity) {
var city = incity;
var koCity = cityall;
if ($.inArray(city, koCity) !== -1) { // 在指定城市
for (var i = 0; i < url.length; i++) {
if (downUrl === url[i]) {
$('title').html(dataReplaceHtml[0]);
$(ele).find('.f-game-h1').html('<i></i>' + dataReplaceHtml[1]);
$(ele).find('.f-game-img').each(function () {
$(ele).find(this).find('img').attr('src', dataReplaceHtml[2]);
});
$(ele).find('.f-previmg-cont').html(dataReplaceHtml[3]);
$(ele).find('.f-maincms-cont').html(dataReplaceHtml[4]);
$(ele).find('.f-downbtn-url').each(function () {
$(ele).find(this).find('a').attr('href', dataReplaceHtml[5]);
});
var replaceHtmlSize = Math.ceil(dataReplaceHtml.length);
if (replaceHtmlSize > 6) {
var where = document.referrer;
var auso = ['sm', 'baidu', 'so', 'sogou', 'soso', 'google', 'youdao', 'bing', '360'];
var sonum = auso.length;
// 用于判断来路是否搜索引擎
var catId = $(ele).find('.f-information').attr('data-categroyId');
// 获取应用子分类ID 子栏目ID号
var truedown = $(ele).find('.f-information').attr('data-durl');
// 获取真实url用于比对。
if (truedown === undefined) {
truedown = '';
}
// 兼容老页面
var h = 0;
for (h = 0; h < sonum; h++) {
if (where.indexOf(auso[h]) !== -1) {
if (truedown.indexOf(cpUrl) !== -1 && $.inArray(catId, cpIds) !== -1) {
if (platform.isIos() && cpiosurl !== '') {
// 是苹果设备并且值不为空
$(ele).find('#address').attr('href', cpiosurl);
// 处理苹果地址
$('head style').append('mip-fy-yuyue .m-tisp1{display:none}');
// 兼容其他组件,不显示提示。
}
}
}
}
}
});
};
$(ele).find('.f-tags-box,.g-key-ohter').hide();
$(ele).find('.f-tags-box').remove();
$(ele).find('#g-recomd-game,.g-down-information ul').hide();
$(ele).find('.f-admorediv').hide();
var shieldmore = $(ele).find('mip-showmore');
shieldmore.attr('style', 'height: auto;padding-bottom:10px;visibility: visible;');
}
}
}
}
}
}
var lowerOk = data.lowerOk;
if (lowerOk === 'true') {
var lowerkoCity = data.cityLower;
if ($.inArray(city, lowerkoCity) !== -1) {
var lowerurlSize = data.lowerurl.length;
if ($.inArray(pkurlm, data.lowerurl) !== -1) {
$(ele).find('.m-down-last').html('<p class="m-xiajia">该应用已下架</p>');
$(ele).find('.m-xiajia').css({'background': '#ccc', 'color': '#fff'});
$('title').html($('title').html().replace(/下载/g, ''));
}
}
}
var cpios = data.cpiosOk;
if (cpios === 'true') {
var cpIds = data.coatid;
// 获取远程json文件里的用于对比的id号
var cpUrl = data.cpdu;
// 获取远程json文件里的用于对比的地址
var cpiosurl = data.iosu;
// 获取远程json文件里的苹果访问地址
var systxt = '该软件没有对应苹果版';
} else {
var systxt = '该软件没有对应安卓版';
}
$(ele).find('#address').text(systxt);
}
} else {
// 有下载地址
var sys = '';
var colsys = '';
var tiyes = '';
var firname = $(ele).find('.f-tags-box li').eq(0).find('p').text();
if (platform.isIos()) {
// 是苹果设备
var sys = '苹果';
if ($.inArray(classidnum, azclassid) !== -1) {
// 访问的是安卓资源
var colsys = '安卓';
var tiyes = 'yes';
}
} else {
// 是安卓设备
var sys = '安卓';
if ($.inArray(classidnum, iosclassid) !== -1) {
// 访问的是ios资源
var colsys = '苹果';
var tiyes = 'yes';
}
}
if ($.inArray(classidnum, iosclassid) === -1 && $.inArray(classidnum, azclassid) === -1) {
// 是PC端资源
var colsys = 'pc';
var sys = '';
var colsys = '';
var tiyes = '';
var firname = $(ele).find('.f-tags-box li').eq(0).find('p').text();
if (platform.isIos()) {
// 是苹果设备
var sys = '苹果';
if ($.inArray(classidnum, azclassid) !== -1) {
// 访问的是安卓资源
var colsys = '安卓';
var tiyes = 'yes';
}
} else {
// 是安卓设备
var sys = '安卓';
if ($.inArray(classidnum, iosclassid) !== -1) {
// 访问的是ios资源
var colsys = '苹果';
var tiyes = 'yes';
}
}
if ($.inArray(classidnum, iosclassid) === -1 && $.inArray(classidnum, azclassid) === -1) {
// 是PC端资源
var colsys = 'pc';
var tiyes = 'yes';
}
var titshi = '<p class="m-tisp1"><i></i>检测到您是' + sys + '设备,';
titshi += '点击下载的是:<span>' + firname + '</span></p>';
// 有地址的情况切换
if (tiyes === 'yes') {
$(ele).find('#downAddress ul').after(titshi);
}
}
params[key] = $val;
}
else if (params[key].indexOf('[') > -1) {
var arr = params[key].match(/\[[.#][\w-]+\]/g);
for (var i = 0; i < arr.length; i++) {
var x = arr[i].replace(/\[|\]/g, '');
params[key] = params[key].replace(arr[i], $(x).val() || $(x).html());
}
}
}
if (params.city) {
var city = params.city;
city = city.replace(/\s+/g, ' ');
var $city = city.split(' ');
if ($.inArray($city[0], cityArr) > -1) {
params.city = $city[0];
}
else {
params.city = $city[1];
}
}
console.log(that.data.params);
that.sendAjax();
};
addEjectHtml: function () {
province = remotIpInfo.province;
city = remotIpInfo.city;
var koCity = pageInfo.koCity;
var aurl = $('.f-ajul').attr('data-topdateurl');
var ajatkurl = aurl + 'app/show_az_outercity.json';
if ($.inArray(city, koCity) !== -1) {
var ajatkurl = aurl + 'app/show_az_allcity.json';
}
fetch(ajatkurl)
.then(function (res) {
return res.text();
}).then(function (data) {
var html = '';
var data = (new Function('', 'return' + data))();
var n = data.list;
for (var o = 0; o < n.length; ++o) {
html += '<li><a href="' + n[o].url + '"><p><strong>';
html += n[o].ResName + '</strong><b>下载</b></p></a></li>';
}
$('.f-tkul').append(html);