Skip to content

Instantly share code, notes, and snippets.

@VeryCB
Created August 9, 2014 04:20
Show Gist options
  • Save VeryCB/999489ff8348eb61e60d to your computer and use it in GitHub Desktop.
Save VeryCB/999489ff8348eb61e60d to your computer and use it in GitHub Desktop.
var openApp = function() {
var a = xparamsString.sharefrom;
if (a) {
var b = "",
c = videoIdEn,
d = "";
if ("pkios" == a || "pkandroid" == a) null != window.navigator.userAgent.match(/android/i) && (b = "paike://vid/" + c), null != window.navigator.userAgent.match(/iphone|ipad/i) && (b = "paike://type=vid&value=" + c), d = "banner=pk";
if ("android" == a || "ipad" == a || "iphone" == a) {
var e = getCookie("__ysuid") || "";
null != window.navigator.userAgent.match(/iphone/i) && (b = "youku://play?vid=" + c + "&source=mplaypage&cookieid=" + e);
null != window.navigator.userAgent.match(/android/i) &&
(b = "youku://play?vid=" + c + "&source=mplaypage&cookieid=" + e);
null != window.navigator.userAgent.match(/ipad/i) && (b = "youkuhd://play?vid=" + c + "&source=mplaypage&cookieid=" + e)
}
c = "";
"pkios" == a ? c = "tp=1&cp=4009031&cpp=1000752" : "pkandroid" == a ? c = "tp=1&cp=4009030&cpp=1000752" : "android" == a ? c = "tp=1&cp=4009027&cpp=1000752" : "ipad" == a ? c = "tp=1&cp=4009028&cpp=1000752" : "iphone" == a && (c = "tp=1&cp=4009029&cpp=1000752");
Log.log(1, c);
if (b) {
a = document.createElement("iframe");
a.id = "openApp";
a.width = 0;
a.height = 0;
a.src = b;
$("body").append(a);
if ("" != d) window.playPageUrl = -1 !== window.playPageUrl.indexOf("?") ? window.playPageUrl + ("&x&" + d) : window.playPageUrl + ("?x&" + d);
setTimeout("window.location.href = window.playPageUrl;", 1E3)
}
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment