1(function (window, undefined) { 2 var kakao = {}; 3 window.kakao = window.kakao || kakao; 4 5 6 var uagent = navigator.userAgent.toLocaleLowerCase(); 7 if (uagent.search("android") > -1) { 8 kakao.os = "android"; 9 if (uagent.search("chrome") > -1) { 10 kakao.browser = "android+chrome"; 11 } 12 } else if (uagent.search("iphone") > -1 || uagent.search("ipod") > -1 || uagent.search("ipad") > -1) { 13 kakao.os = "ios"; 14 } 15 16 17 var app = { 18 talk: { 19 base_url: "kakaolink://sendurl?", 20 apiver: "2.0.1", 21 store: { 22 android: "market://details?id=com.kakao.talk", 23 ios: "http://itunes.apple.com/app/id362057947" 24 }, 25 package: "com.kakao.talk" 26 }, 27 story: { 28 base_url: "storylink://posting?", 29 apiver: "1.0", 30 store: { 31 android: "market://details?id=com.kakao.story", 32 ios: "http://itunes.apple.com/app/id486244601" 33 }, 34 package: "com.kakao.story" 35 } 36 }; 37 38 39 kakao.link = function (name) { 40 var link_app = app[name]; 41 if (!link_app) return { send: function () { 42 throw "No App exists"; 43 }}; 44 return { 45 send: function (params) { 46 var _app = this.app; 47 params['apiver'] = _app.apiver; 48 var full_url = _app.base_url + serialized(params); 49 50 51 var install_block = (function (os) { 52 return function () { 53 window.location = _app.store[os]; 54 }; 55 })(this.os); 56 57 58 if (this.os == "ios") { 59 var timer = setTimeout(install_block, 2 * 1000); 60 window.addEventListener('pagehide', clearTimer(timer)); 61 window.location = full_url; 62 } else if (this.os == "android") { 63 if (this.browser == "android+chrome") { 64 window.location = "intent:" + full_url + "#Intent;package=" + _app.package + ";end;"; 65 } else { 66 var iframe = document.createElement('iframe'); 67 iframe.style.display = 'none'; 68 iframe.src = full_url; 69 iframe.onload = install_block; 70 document.body.appendChild(iframe); 71 } 72 } 73 }, 74 app: link_app, 75 os: kakao.os, 76 browser: kakao.browser 77 }; 78 79 80 function serialized(params) { 81 var stripped = []; 82 for (var k in params) { 83 if (params.hasOwnProperty(k)) { 84 stripped.push(k + "=" + encodeURIComponent(params[k])); 85 } 86 } 87 return stripped.join("&"); 88 } 89 90 91 function clearTimer(timer) { 92 return function () { 93 clearTimeout(timer); 94 window.removeEventListener('pagehide', arguments.callee); 95 }; 96 } 97 }; 98}(window));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.