Files
vippk-yy-template/build/html-template/pk.js
T
2018-12-03 17:31:53 +08:00

341 lines
9.9 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
document.domain = "yy.com";
document.getElementById("loadingBg").style.display = "block";
function reloadPage() {
if (this.parent != this) {
parent.document.location.reload();
}
else {
document.location.reload();
}
}
function startCallJsActive() {
}
function setCookie(c_name, value, expiredays) {
var exdate = new Date();
exdate.setDate(exdate.getDate() + expiredays);
document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
}
function getCookie(c_name) {
if (document.cookie.length > 0) {  //先查询cookie是否为空,为空就return ""
c_start = document.cookie.indexOf(c_name + "=")  //通过String对象的indexOf()来检查这个cookie是否存在,不存在就为 -1  
if (c_start != -1) {
c_start = c_start + c_name.length + 1  //最后这个+1其实就是表示"="号啦,这样就获取到了cookie值的开始位置
c_end = document.cookie.indexOf(";", c_start)  //其实我刚看见indexOf()第二个参数的时候猛然有点晕,后来想起来表示指定的开始索引的位置...这句是为了得到值的结束位置。因为需要考虑是否是最后一项,所以通过";"号是否存在来判断
if (c_end == -1) c_end = document.cookie.length
return unescape(document.cookie.substring(c_start, c_end))  //通过substring()得到了值。想了解unescape()得先知道escape()是做什么的,都是很重要的基础,想了解的可以搜索下,在文章结尾处也会进行讲解cookie编码细节
}
}
return ""
}
function cookieEnable()
{
var result=false;
if(navigator.cookiesEnabled)
return true;
document.cookie = "testcookie=yes;";
var cookieSet = document.cookie;
if (cookieSet.indexOf("testcookie=yes") > -1)
result=true;
document.cookie = "";
return result;
}
function selectFuliTab(tabId) {
document.getElementById(yy.flashId).selectFuliTab(tabId);
}
function showFuliTab(tabId, param) {
document.getElementById(yy.flashId).showFuliTab(tabId, param);
}
window.onbeforeunload = onbeforeunloadHandler;
function onbeforeunloadHandler() {
try {
document.getElementById(yy.flashId).closeWindow();
}
catch (e) {
}
}
function sendCmd(str, param) {
document.getElementById(yy.flashId).sendCmd(str, param);
}
function flashChecker() {
var hasFlash = 0;    //是否安装了flash
var flashVersion = 0;  //flash版本
if (document.all) {
try {
var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if (swf) {
hasFlash = 1;
VSwf = swf.GetVariable("$version");
flashVersion = parseInt(VSwf.split(" ")[1].split(",")[0]);
}
}
catch (e) {
hasFlash = 0;
}
}
else {
if (navigator.plugins && navigator.plugins.length > 0) {
try {
var swf = navigator.plugins["Shockwave Flash"];
if (swf) {
hasFlash = 1;
var words = swf.description.split(" ");
for (var i = 0; i < words.length; ++i) {
if (isNaN(parseInt(words[i]))) continue;
flashVersion = parseInt(words[i]);
}
}
}
catch (e) {
hasFlash = 0;
}
}
}
return { f: hasFlash, v: flashVersion };
}
function appLoadComplete() {
document.getElementById("loadingBg").style.display = "none";
document.getElementById("pkSwfDiv").style.visibility = "visible";
document.getElementById("pkSwfDiv").style.width = "100%";
document.getElementById("pkSwfDiv").style.height = "100%";
}
function mainLoadComplete() {
}
var fls = flashChecker();
var s = "";
if (fls.f && fls.v >= 10) {
yy.flashId = "pkSwf";
var t = new Date().getTime();
var flashvars = "";
var params = { wmode: "direct" };
params.allowScriptAccess = "always";
swfobject.embedSWF("core2.swf?_=" + t, "pkSwf", "100%", "100%", "10.0.0", "", flashvars, params);
}
else {
document.getElementById("logId").innerHTML = "您没有安装flash,<a style='color:#ff0000' href='http://file.do.yy.com/group3/M02/CA/7B/tz0GSFYA1LqADdCvAQw0XIpMx2k505.zip'>马上安装</a>";
}
function loadDanrenPk() {
document.getElementById("loadingBg").style.display = "block";
document.getElementById("loadingBgImage").style.display = "none";
document.getElementById("loadingBg").style.backgroundColor = "#9f95e3";
document.getElementById("pkSwfDiv").style.display = "none";
window.location.href = "http://show.vip.yy.com/clientonepkgame/main9.html";
}
function loadShuangrenPk(){
document.getElementById("loadingBg").style.display = "block";
document.getElementById("loadingBgImage").style.display = "none";
document.getElementById("loadingBg").style.backgroundColor = "#804ccc";
document.getElementById("pkSwfDiv").style.display = "none";
window.location.href = "http://show.vip.yy.com/clientpkgame/main9.html";
}
(function () {
var version = 1.1;
var win = window;
var _hiidoDebug = win._hiidoDebug || false;
var logger = {
log: function () {
if (_hiidoDebug) {
win.console && win.console.log(arguments);
}
}
};
var hiido = {
domain: "ylog.hiido.com",
ips: ['14.17.112.232', '14.17.112.233', '14.17.112.234', '14.17.112.235', '14.17.112.236', '14.17.112.237'],
getServerUrl: function (host) {
host = host || this.domain;
var ptl = location.protocol;
var path = "c.gif?";
return ptl + "//" + host + "/" + path;
},
randomIp: function () {
var Rand = Math.random();
var index = Math.round(Rand * (this.ips.length - 1));
var ip = this.ips[index];
return ip;
},
getParam: function (opt) {
var obj = opt;
var param = [];
obj.time = parseInt(1 * new Date() / 1000);
//obj.uid=this.getCookie("yyuid");
//obj.username=this.getCookie("username");
for (h in obj) {
if (obj.hasOwnProperty(h)) {
param.push(encodeURIComponent(h) + "=" + (obj[h] === undefined || obj[h] === null ? "" :
encodeURIComponent(obj[h])))
}
}
return param.join("&");
},
send: function (url, backurl, times) {
var reties = times || 0;
var img = new Image();
var self = this;
img.onerror = function () {
if (reties <= 1) {
self.send(url, backurl, ++reties);
}
else if (reties == 2) {
self.send(backurl, backurl, ++reties);
}
}
img.src = url;
},
getCookie: function (name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg)) {
return unescape(arr[2]);
} else {
return null
};
}
};
var iface = {
stat: function (opt) {
if (!opt) {
return false;
}
var svr = hiido.getServerUrl();
var param = hiido.getParam(opt);
var url = svr + param;
var backurl = hiido.getServerUrl(hiido.randomIp()) + param;
hiido.send(url, backurl);
}
};
if (typeof (module) === "object") {
module.exports = iface;
}
window.appHiido = iface;
})();
var ACT = "webpkaction";
function dataReport(sid, subsid, uid, type, remark, ver, subtype) {
appHiido.stat({ 'act': ACT, 'uid': uid, 'sid': sid, 'subsid': subsid, 'type': type, 'remark': remark, 'ver': '1', 'subtype': subtype });
}
function dataReport2(sid, subsid, uid, type, statval1, remark, ver, subtype) {
appHiido.stat({ 'act': ACT, 'uid': uid, 'sid': sid, 'subsid': subsid, 'type': type, 'remark': remark, 'ver': '1', 'statval1': statval1, 'subtype': subtype });
}
function callIframeFunction(iframeId, funName, args) {
document.getElementById(iframeId).contentWindow[funName](args);
}
var mainDataQueue = [];
function callMainSwf(obj,fromSwfId){
if(!window.jsChatPubComplete)
return;
mainDataQueue.push({obj:obj,fromSwfId:fromSwfId});
if(mainDataQueue.length > 50)
mainDataQueue = [];
}
var otherDataQueue = [];
function callOtherSwf(swfId,obj){
if(!window.jsChatPubComplete)
return;
otherDataQueue.push({obj:obj,swfId:swfId});
if(otherDataQueue.length > 50)
otherDataQueue = [];
}
function getMainDataQueue(){
var arr = [];
while(mainDataQueue.length > 0)
{
arr.push(mainDataQueue.shift());
}
return arr;
}
function getOtherDataQueue(swfId){
var arr = [];
var dells = [];
for(var i = 0; i < otherDataQueue.length;i++)
{
var item = otherDataQueue[i];
if(item.swfId == swfId)
{
arr.push(item);
dells.push(item);
}
}
for(var i = 0; i < dells.length;i++)
{
var dell = dells[i];
for(var j = 0; j < otherDataQueue.length; j++) {
if(otherDataQueue[j] == dell) {
otherDataQueue.splice(j, 1);
break;
}
}
}
return arr;
}
function isIE6(){
try{
var isIE=!!window.ActiveXObject;
var isIE6=isIE&&!window.XMLHttpRequest;
var isIE8=isIE&&!!document.documentMode;
var isIE7=isIE&&!isIE6&&!isIE8;
if (isIE){
if (isIE6)
return true;
return false;
}
return false;
}
catch(e){
}
return false;
}
function isXP(){
var ua = navigator.userAgent;
if(ua.indexOf("Windows NT 5")!=-1)
return true;
return false;
}
function getSWF(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}