/* * jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010 * http://benalman.com/projects/jquery-dotimeout-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ (function($) { var a = {}, c = "doTimeout", d = Array.prototype.slice; $[c] = function() { return b.apply(window, [0].concat(d.call(arguments))) }; $.fn[c] = function() { var f = d.call(arguments), e = b.apply(this, [c + f[0]].concat(f)); return typeof f[0] === "number" || typeof f[1] === "number" ? this : e }; function b(l) { var m = this, h, k = {}, g = l ? $.fn : $, n = arguments, i = 4, f = n[1], j = n[2], p = n[3]; if (typeof f !== "string") { i--; f = l = 0; j = n[1]; p = n[2] } if (l) { h = m.eq(0); h.data(l, k = h.data(l) || {}) } else { if (f) { k = a[f] || (a[f] = {}) } } k.id && clearTimeout(k.id); delete k.id; function e() { if (l) { h.removeData(l) } else { if (f) { delete a[f] } } } function o() { k.id = setTimeout(function() { k.fn() }, j) } if (p) { k.fn = function(q) { if (typeof p === "string") { p = g[p] } p.apply(m, d.call(n, i)) === true && !q ? o() : e() }; o() } else { if (k.fn) { j === undefined ? e() : k.fn(j === false); return true } else { e() } } }} )(jQuery); var loadingView, hdBaominFristView; $(document).ready(function() { checkYYClient(); // $.doTimeout("checkYYClient", 5000, function() { // return checkYYClient() // }); }); function returnCallback(type, callback) { if (callback && typeof(callback) === "function") { return callback(); } else { return type; } } /** * 检测YY是否有登录 */ var YYClient = {login: false, users: [], stauts: "initing", waitTime: 0, result: null}; var JQ_YY_CHECKER_OBJ = false;//为了防止重复加载标签 function checkYYClient(callback) { callback = callback || null; var activeXObj = null; if (window.ActiveXObject) { try { activeXObj = new ActiveXObject('yy_checker.Checker'); } catch (e) { } } else { if (!JQ_YY_CHECKER_OBJ) { $('body').append(''); JQ_YY_CHECKER_OBJ = true; } activeXObj = document.getElementById('yyplugin'); } if (activeXObj == null) { YYClient = {login: false, users: [], stauts: "over"}; return returnCallback(true, callback); } YYClient.stauts = "checking"; YYClient.result = null; if (typeof activeXObj.GetYYList == "undefined") { YYClient = {login: false, users: [], stauts: "over"}; return returnCallback(true, callback); } else { activeXObj.GetYYList(); } $.doTimeout("waitCheckYYClient", 50, function() { if (YYClient.result !== null) { YYClient.login = YYClient.result; return returnCallback(false, callback); } else if (YYClient.waitTime > 3) { YYClient.login = false; YYClient.stauts = "over"; return returnCallback(false, callback); } YYClient.waitTime++; return returnCallback(true, callback); }); return returnCallback(true, callback); } function YYCallback(msgId, cbid, callbackText) { if (msgId != 0) { } else { var parts = callbackText.split("\n"); var uuid = parts[3].split(":")[1]; if (uuid == 0) { return; } YYClient.users[YYClient.users.length] = cbid; YYClient.result = true; YYClient.stauts = "over"; } } /** * @param cid * @returns {boolean} */ function toChannel(cid, subcid, from) { var b = checkYYClient(function() { if (YYClient.login) { if (!$('#hIframe')[0]) { $('body').append(''); } $('#hIframe').attr('src', "yy://pd-[sid=" + cid + "&subid=" + subcid + "&yygameliveinfo=" + from + "]"); return false; } else { return true; } }); if(b){ //跳转页面数据统计触发 _hiido_wid=["_ab8c466"]; hiidov3(); } return b; } /** * 统计点击下载客户端 */ function statistics(me) { _hiido_wid=["_8c00849"]; hiidov3(); _hiido_wid=["_8c00849"]; hiidov3(); if (!me) { return } var params={ "act":"webevent", "eventid":$(me).attr("hiido_code"),//EVENTID "value":1,//VALUE "eventype":1//EVENTTYPE }; window.appHiido.stat(params); } /** * 美女秀统计 */ function meinvxiu_statistics() { _hiido_wid=["_1343853"]; hiidov3(); }