Commit eda62561a31c2eefd699cfb819d244d0ed10621e

Authored by Ahmed Owian
1 parent 4652fd0296
Exists in master

Added base skype-uri.js

Updated skype.get.js to handle null skype ids
share-amp/src/main/amp/web/js/org/alfresco/skype/skype-uri.js
... ... @@ -0,0 +1,873 @@
  1 +/*
  2 + * The JavaScript objects and functions contained in skype-uri.js are covered by
  3 + * the Apache License, Version 2.0, which you can view at http://www.apache.org/licenses/.
  4 + */
  5 +
  6 +/*jshint -W003:true */
  7 +/*jshint -W107:true */
  8 +/*jshint -W057:true */
  9 +
  10 +var Skype = new function () {
  11 + this.name = null;
  12 + this.element = null;
  13 + this.participants = ["echo123"];
  14 + this.listParticipants = "false";
  15 + this.video = "false";
  16 + this.topic = null;
  17 + this.listTopic = "false";
  18 + this.imageSize = null;
  19 + this.imageColor = null;
  20 + this.useDetection = "true";
  21 + this.protocol = "skype:";
  22 + this.version = "1.1.7";
  23 + this.httpProtocol = window.location.protocol !== "https:" ? "http:" : "https:";
  24 + this.assetsDomain = this.httpProtocol + "//" + (this.httpProtocol !== "https:" ? "www.skypeassets.com" : "secure.skypeassets.com");
  25 + this.ui = l;
  26 + this.setImageAttributes = j;
  27 + this.trimString = o;
  28 + this.escapeString = b;
  29 + this.createDetectionFrame = h;
  30 + this.trySkypeUri_IE9_IE8 = n;
  31 + this.trySkypeUri_IOS_Safari = e;
  32 + this.trySkypeUri_Android_Chrome = a_androidchrome;
  33 + this.trySkypeUri_Android_Firefox = q;
  34 + this.trySkypeUri_Generic = a;
  35 + this.SkypeClientDownloadUrl = this.httpProtocol + "//www.skype.com/download";
  36 + this.installSkypeMsg = "Please install Skype application in order to make this call or send a message.";
  37 + this.displayNotSupportedMsg = f;
  38 + this.SkypeUriAssetMap = c;
  39 + this.SkypeUriAssetColorMap = g;
  40 + this.SkypeUriNameLinks = m;
  41 + this.assetPrefix = this.assetsDomain + "/i/scom/images/skype-buttons/";
  42 + this.assetSizeArray = [10, 12, 14, 16, 24, 32];
  43 + this.assetSizeDefault = 16;
  44 + this.assetMarginMinimum = 16;
  45 + this.assetSize = this.assetSizeDefault;
  46 + this.assetMargin = (this.assetSize >= this.assetMarginMinimum) ? this.assetSize : this.assetMarginMinimum;
  47 + this.assetColorPathWhite = "_trans_";
  48 + this.assetColorFontWhite = "white";
  49 + this.assetColorPathSkype = "_";
  50 + this.assetColorFontSkype = "#444444";
  51 + this.assetColorPathDefault = this.assetColorPathSkype;
  52 + this.assetColorFontDefault = this.assetColorFontSkype;
  53 + this.assetColor = new this.SkypeUriAssetColorMap(this.assetColorPathDefault, this.assetColorFontDefault);
  54 + this.assetSizeMap = {};
  55 + this.assetSizeMap.size10 = new this.SkypeUriAssetMap(10, -18);
  56 + this.assetSizeMap.size12 = new this.SkypeUriAssetMap(12, -19);
  57 + this.assetSizeMap.size14 = new this.SkypeUriAssetMap(14, -19);
  58 + this.assetSizeMap.size16 = new this.SkypeUriAssetMap(16, -20);
  59 + this.assetSizeMap.size24 = new this.SkypeUriAssetMap(24, -30);
  60 + this.assetSizeMap.size32 = new this.SkypeUriAssetMap(32, -41);
  61 + this.focusLinks = new this.SkypeUriNameLinks("", "");
  62 + this.callLinks = new this.SkypeUriNameLinks("call", "");
  63 + this.videoLinks = new this.SkypeUriNameLinks("call", "");
  64 + this.chatLinks = new this.SkypeUriNameLinks("chat", "");
  65 + this.multiChatLinks = new this.SkypeUriNameLinks("chat", "");
  66 + this.dropdownLinks = new this.SkypeUriNameLinks("dropdown", "");
  67 + this.setImageAttributes(this.assetSizeDefault, "");
  68 + this.analyzeSkypeUriInit = null;
  69 + this.analyzeSkypeUriAction = null;
  70 + this.analyzeSkypeUriRedirect = null;
  71 + this.analyzeSkypeUr = null;
  72 + this.analyzePreCrumbs = [];
  73 + this.analyzeCrumbs = [];
  74 + this.analyzeCrumbIndex = -1;
  75 + this.tryAnalyzeSkypeUri = k;
  76 + this.detectSkypeClientFrameId = null;
  77 + this.detectedPlatform = "unknown";
  78 + this.detectedBrowser = "unknown";
  79 + this.isWinXP = false;
  80 + this.isWinVista = false;
  81 + this.isWin7 = false;
  82 + this.isWin8 = false;
  83 + this.isOSX_SnowLeopard = false;
  84 + this.isOSX_MountainLion = false;
  85 + this.isLinux = false;
  86 + this.isWinPhone8 = false;
  87 + this.isAndroid = false;
  88 + this.isAndroid_Gingerbread = false;
  89 + this.isAndroid_IceCream = false;
  90 + this.isAndroid_JellyBean = false;
  91 + this.isIOS7 = false;
  92 + this.isIOS6 = false;
  93 + this.isIOS5 = false;
  94 + this.isIOS4 = false;
  95 + this.isIPhone = false;
  96 + this.isIPad = false;
  97 + this.isIPod = false;
  98 + this.isIE10 = false;
  99 + this.isIE9 = false;
  100 + this.isIE8 = false;
  101 + this.isIE7 = false;
  102 + this.isIE6 = false;
  103 + this.isFF = false;
  104 + this.isAndroidBrowser = false;
  105 + this.isChrome = false;
  106 + this.isSafari = false;
  107 + this.showDropdown = i;
  108 + this.hideDropdown = d;
  109 + this.analyzeScript = this.assetsDomain + "/i/scom/js/" + "skype-analytics.js";
  110 + this.includeJavascript = p;
  111 + this.includeJavascript(this.analyzeScript);
  112 + if (navigator.userAgent.indexOf("Windows NT 5.1") !== -1) {
  113 + this.isWinXP = true;
  114 + this.detectedPlatform = "Windows XP"
  115 + } else {
  116 + if (navigator.userAgent.indexOf("Windows NT 6.0") !== -1) {
  117 + this.isWinVista = true;
  118 + this.detectedPlatform = "Windows Vista"
  119 + } else {
  120 + if (navigator.userAgent.indexOf("Windows NT 6.1") !== -1) {
  121 + this.isWin7 = true;
  122 + this.detectedPlatform = "Windows 7"
  123 + } else {
  124 + if (navigator.userAgent.indexOf("Windows NT 6.2") !== -1) {
  125 + this.isWin8 = true;
  126 + this.detectedPlatform = "Windows 8"
  127 + } else {
  128 + if (navigator.userAgent.indexOf("Mac OS X 10_7") !== -1) {
  129 + this.isOSX_SnowLeopard = true;
  130 + this.detectedPlatform = "OSX 10.7"
  131 + } else {
  132 + if (navigator.userAgent.indexOf("Mac OS X 10.8") !== -1) {
  133 + this.isOSX_MountainLion = true;
  134 + this.detectedPlatform = "OSX 10.8"
  135 + } else {
  136 + if (navigator.userAgent.indexOf("Mac OS X 10_8") !== -1) {
  137 + this.isOSX_MountainLion = true;
  138 + this.detectedPlatform = "OSX 10.8"
  139 + } else {
  140 + if(navigator.userAgent.indexOf("Android") !== -1) {
  141 + this.isAndroid = true;
  142 + this.detectedPlatform = "Android"
  143 +
  144 + if (navigator.userAgent.indexOf("Android 2.3") !== -1) {
  145 + this.isAndroid_Gingerbread = true;
  146 + this.detectedPlatform = "Android 2.3"
  147 + }
  148 + else if(navigator.userAgent.indexOf("Android 4.0") !== -1) {
  149 + this.isAndroid_IceCream = true;
  150 + this.detectedPlatform = "Android 4.0"
  151 + }
  152 + else if(navigator.userAgent.indexOf("Android 4.1") !== -1) {
  153 + this.isAndroid_JellyBean = true;
  154 + this.detectedPlatform = "Android 4.1"
  155 + }
  156 + }
  157 + else if (navigator.userAgent.indexOf("Linux") !== -1) {
  158 + this.isLinux = true;
  159 + this.detectedPlatform = "Linux"
  160 + } else {
  161 + if (navigator.userAgent.indexOf("Windows Phone 8") !== -1) {
  162 + this.isWinPhone8 = true;
  163 + this.detectedPlatform = "Windows Phone 8"
  164 + } else {
  165 + if (navigator.userAgent.match(/OS 7_[0-9_]+ like Mac OS X/i)) {
  166 + this.isIOS7 = true;
  167 + this.detectedPlatform = "iOS7"
  168 + } else {
  169 + if (navigator.userAgent.match(/OS 6_[0-9_]+ like Mac OS X/i)) {
  170 + this.isIOS6 = true;
  171 + this.detectedPlatform = "iOS6"
  172 + } else {
  173 + if (navigator.userAgent.match(/OS 5_[0-9_]+ like Mac OS X/i)) {
  174 + this.isIOS5 = true;
  175 + this.detectedPlatform = "iOS5"
  176 + } else {
  177 + if (navigator.userAgent.match(/OS 4_[0-9_]+ like Mac OS X/i)) {
  178 + this.isIOS4 = true;
  179 + this.detectedPlatform = "iOS4"
  180 + }
  181 + }
  182 + }
  183 + }
  184 + }
  185 + }
  186 + }
  187 + }
  188 + }
  189 + }
  190 + }
  191 + }
  192 + } if (navigator.userAgent.indexOf("iPhone") !== -1) {
  193 + this.isIPhone = true;
  194 + this.detectedPlatform = "iPhone " + this.detectedPlatform
  195 + } else {
  196 + if (navigator.userAgent.indexOf("iPad") !== -1) {
  197 + this.IsPad = true;
  198 + this.detectedPlatform = "iPad " + this.detectedPlatform
  199 + } else {
  200 + if (navigator.userAgent.indexOf("iPod") !== -1) {
  201 + this.IsPod = true;
  202 + this.detectedPlatform = "iPod " + this.detectedPlatform
  203 + }
  204 + }
  205 + } if (navigator.userAgent.indexOf("MSIE 10") !== -1) {
  206 + this.isIE10 = true;
  207 + this.detectedBrowser = "Internet Explorer 10"
  208 + } else {
  209 + if (navigator.userAgent.indexOf("MSIE 9") !== -1) {
  210 + this.isIE9 = true;
  211 + this.detectedBrowser = "Internet Explorer 9"
  212 + } else {
  213 + if (navigator.userAgent.indexOf("MSIE 8") !== -1) {
  214 + this.isIE8 = true;
  215 + this.detectedBrowser = "Internet Explorer 8"
  216 + } else {
  217 + if (navigator.userAgent.indexOf("MSIE 7") !== -1) {
  218 + this.isIE7 = true;
  219 + this.detectedBrowser = "Internet Explorer 7"
  220 + } else {
  221 + if (navigator.userAgent.indexOf("MSIE 6") !== -1) {
  222 + this.isIE6 = true;
  223 + this.detectedBrowser = "Internet Explorer 6"
  224 + } else {
  225 + if (navigator.userAgent.indexOf("Firefox") !== -1) {
  226 + this.isFF = true;
  227 + this.detectedBrowser = "Firefox"
  228 + } else {
  229 + if (navigator.userAgent.indexOf("Chrome") !== -1) {
  230 + this.isChrome = true;
  231 + this.detectedBrowser = "Chrome"
  232 + } else {
  233 + if (navigator.userAgent.indexOf("Mobile Safari") !== -1 && this.isAndroid) {
  234 + this.isAndroidBrowser = true;
  235 + this.detectedBrowser = "Mobile Safari"
  236 + } else {
  237 + if (navigator.userAgent.indexOf("Safari") !== -1) {
  238 + this.isSafari = true;
  239 + this.detectedBrowser = "Safari"
  240 + }
  241 + }
  242 + }
  243 + }
  244 + }
  245 + }
  246 + }
  247 + }
  248 + } if (this.isLinux) {
  249 + this.useDetection = "false"
  250 + }
  251 + if (this.isAndroid) {
  252 + this.SkypeClientDownloadUrl = "market://details?id=com.skype.raider";
  253 + } else {
  254 + if (this.isIPhone || this.IsPod) {
  255 + this.SkypeClientDownloadUrl = "http://appstore.com/skypeforiphone";
  256 + } else {
  257 + if (this.IsPad) {
  258 + this.SkypeClientDownloadUrl = "http://appstore.com/skypeforipad";
  259 + }
  260 + }
  261 + }
  262 +
  263 + function f() {
  264 + alert("Sorry this device doesn't support Skype Buttons yet. Please add " + this.participants[0] + " as a contact in your Skype Client to MAKE this call.")
  265 + }
  266 +
  267 + function i(r) {
  268 + document.getElementById(r).style.display = "block";
  269 + if (typeof (window["timer_" + r]) !== "undefined") {
  270 + window.clearTimeout(window["timer_" + r])
  271 + }
  272 + window["timer_" + r] = null;
  273 + delete window["timer_" + r]
  274 + }
  275 +
  276 + function d(r) {
  277 + window["timer_" + r] = window.setTimeout(function () {
  278 + document.getElementById(r).style.display = "none"
  279 + }, 1000)
  280 + }
  281 +
  282 + function k(r, s) {
  283 + if (!this.analyzeSkypeUri && typeof analyzeSkypeUri === "function") {
  284 + this.analyzeSkypeUri = analyzeSkypeUri
  285 + }
  286 + if (typeof this.analyzeSkypeUri === "function") {
  287 + this.analyzeSkypeUri(r, s)
  288 + } else {
  289 + var t = {};
  290 + t.prop3 = "image size / color: " + this.imageSize + " / " + this.imageColor;
  291 + t.prop4 = "video / list participants / list topic: " + this.video + " / " + this.listParticipants + " / " + this.listTopic;
  292 + t.prop5 = "target(s): " + this.participants;
  293 + t.prop6 = "user agent: " + navigator.userAgent;
  294 + t.prop7 = "detected protocol: " + window.location.protocol;
  295 + t.prop8 = "detected platform: " + this.detectedPlatform;
  296 + t.prop9 = "detected browser: " + this.detectedBrowser;
  297 + t.prop10 = this.version + " (pre script load)";
  298 + if (r === "init") {
  299 + if (this.name === this.chatLinks.name) {
  300 + t.prop11 = "Chat Init"
  301 + } else {
  302 + if (this.name === this.callLinks.name) {
  303 + t.prop11 = "Call Init"
  304 + } else {
  305 + if (this.name === this.dropdownLinks.name) {
  306 + t.prop11 = "Dropdown Init"
  307 + }
  308 + }
  309 + }
  310 + t.prop12 = document.domain + " - Init"
  311 + } else {
  312 + if (r === "chat") {
  313 + t.prop11 = "Chat Action";
  314 + t.prop13 = document.domain + " - Chat"
  315 + } else {
  316 + if (r === "call") {
  317 + t.prop11 = "Call Action";
  318 + t.prop14 = document.domain + " - Call"
  319 + } else {
  320 + if (r === "dropdownChat") {
  321 + t.prop11 = "Dropdown Chat Action";
  322 + t.prop13 = document.domain + " - Chat"
  323 + } else {
  324 + if (r === "dropdownCall") {
  325 + t.prop11 = "Dropdown Call Action";
  326 + t.prop14 = document.domain + " - Call"
  327 + } else {
  328 + if (r === "redirect") {
  329 + t.prop11 = "Redirect"
  330 + }
  331 + }
  332 + }
  333 + }
  334 + }
  335 + }
  336 + this.analyzePreCrumbs.push(t)
  337 + }
  338 + }
  339 +
  340 + function p(s) {
  341 + var r = document.getElementsByTagName("head")[0];
  342 + var t = document.createElement("script");
  343 + t.setAttribute("type", "text/javascript");
  344 + t.setAttribute("src", s);
  345 + r.appendChild(t)
  346 + }
  347 +
  348 + function c(s, r) {
  349 + this.size = s;
  350 + this.verticalOffset = r
  351 + }
  352 +
  353 + function g(s, r) {
  354 + this.path = s;
  355 + this.font = r
  356 + }
  357 +
  358 + function m(r, s) {
  359 + this.name = r;
  360 + this.linkImage = s
  361 + }
  362 +
  363 + function l(L) {
  364 + this.name = null;
  365 + if ((L.name !== undefined) && (L.name !== null)) {
  366 + this.name = L.name
  367 + }
  368 + if ((L.element !== undefined) && (L.element !== null)) {
  369 + this.element = L.element
  370 + }
  371 + if ((L.participants !== undefined) && (L.participants !== null)) {
  372 + this.participants = L.participants
  373 + }
  374 + if ((L.listParticipants !== undefined) && (L.listParticipants !== null)) {
  375 + this.listParticipants = L.listParticipants
  376 + }
  377 + if ((L.video !== undefined) && (L.video !== null)) {
  378 + this.video = L.video
  379 + }
  380 + if ((L.topic !== undefined) && (L.topic !== null)) {
  381 + this.topic = L.topic
  382 + }
  383 + if ((L.listTopic !== undefined) && (L.listTopic !== null)) {
  384 + this.listTopic = L.listTopic
  385 + }
  386 + if ((L.imageSize !== undefined) && (L.imageSize !== null)) {
  387 + this.imageSize = L.imageSize
  388 + }
  389 + if ((L.imageColor !== undefined) && (L.imageColor !== null)) {
  390 + this.imageColor = L.imageColor
  391 + }
  392 + if ((L.useDetection !== undefined) && (L.useDetection !== null)) {
  393 + this.useDetection = L.useDetection
  394 + }
  395 + if (this.useDetection === "false") {
  396 + this.useDetection = false
  397 + } else {
  398 + if (this.useDetection === "true") {
  399 + this.useDetection = true
  400 + }
  401 + } if ((L.protocol !== undefined) && (L.protocol !== null)) {
  402 + this.protocol = L.protocol
  403 + } else {
  404 + this.protocol = "skype:"
  405 + }
  406 + var G = {};
  407 + G.prop0 = this.name;
  408 + G.prop3 = "image size / color: " + this.imageSize + " / " + this.imageColor;
  409 + G.prop4 = "video / list participants / list topic: " + this.video + " / " + this.listParticipants + " / " + this.listTopic;
  410 + G.prop5 = "target(s): " + this.participants;
  411 + G.prop6 = "user agent: " + navigator.userAgent;
  412 + G.prop7 = "detected protocol: " + window.location.protocol;
  413 + G.prop8 = "detected platform: " + this.detectedPlatform;
  414 + G.prop9 = "detected browser: " + this.detectedBrowser;
  415 + G.prop10 = this.version;
  416 + this.analyzeCrumbs.push(G);
  417 + this.analyzeCrumbIndex += 1;
  418 + var y;
  419 + var P;
  420 + y = this.trimString(L.element);
  421 + if (y.length !== 0) {
  422 + P = document.getElementById(y);
  423 + if (P === null) {
  424 + alert("Sorry! Could not find Skype URI parent element: " + y + " ('" + L.element + "')");
  425 + return (false)
  426 + } else {
  427 + if (((L.name !== undefined) && (L.name !== null)) && ((L.participants === undefined) || (L.participants === null))) {
  428 + alert("Error! Required member 'participants' omitted or specified as null");
  429 + return (false)
  430 + }
  431 + }
  432 + } else {
  433 + alert("Error! Required member 'element' (Skype URI parent element) omitted or specified as null");
  434 + return (false)
  435 + }
  436 + this.setImageAttributes(L.imageSize, this.trimString(L.imageColor));
  437 + if ((L.protocol !== undefined) && (L.protocol !== null)) {
  438 + this.protocol = L.protocol
  439 + }
  440 + var B = this.protocol;
  441 + var C = "";
  442 + var x = 0;
  443 + var u = false;
  444 + if ((L.participants !== undefined) && (L.participants !== null)) {
  445 + while (x < L.participants.length) {
  446 + if (L.participants[x] !== null) {
  447 + y = this.trimString(L.participants[x]);
  448 + if (y.length !== 0) {
  449 + if (x !== 0) {
  450 + B += ";";
  451 + C += ", ";
  452 + u = true
  453 + }
  454 + B += y;
  455 + C += y
  456 + }
  457 + }
  458 + x++
  459 + }
  460 + }
  461 + var H = this.focusLinks.name;
  462 + var w = this.focusLinks.linkImage;
  463 + var M = this.focusLinks.linkImageAltTag;
  464 + var F = this.focusLinks.role;
  465 + var D = false;
  466 + y = this.trimString(L.name);
  467 + if (y.length !== 0) {
  468 + H = y;
  469 + if (H === this.callLinks.name) {
  470 + D = true;
  471 + w = this.callLinks.linkImage;
  472 + M = this.callLinks.linkImageAltTag;
  473 + F = this.callLinks.role
  474 + } else {
  475 + if (H === this.chatLinks.name) {
  476 + if (u) {
  477 + w = this.multiChatLinks.linkImage;
  478 + M = this.multiChatLinks.linkImageAltTag;
  479 + F = this.multiChatLinks.role
  480 + } else {
  481 + w = this.chatLinks.linkImage;
  482 + M = this.chatLinks.linkImageAltTag;
  483 + F = this.chatLinks.role
  484 + }
  485 + } else {
  486 + if (H === this.dropdownLinks.name) {
  487 + w = this.dropdownLinks.linkImage;
  488 + M = this.dropdownLinks.linkImageAltTag;
  489 + F = this.dropdownLinks.role
  490 + } else {
  491 + alert("Unrecognized Skype URI name: " + H + " ('" + L.name + "') -- " + this.callLinks.name + "/" + this.chatLinks.name);
  492 + return (false)
  493 + }
  494 + }
  495 + }
  496 + B += "?" + H
  497 + } else {
  498 + if (C.length > 0) {
  499 + w = this.callLinks.linkImage;
  500 + M = this.callLinks.linkImageAltTag;
  501 + F = this.callLinks.role
  502 + }
  503 + } if (D) {
  504 + y = this.trimString(L.video);
  505 + if (y === "true") {
  506 + w = this.videoLinks.linkImage;
  507 + M = this.videoLinks.linkImageAltTag;
  508 + F = this.videoLinks.role;
  509 + B += "&video=" + y
  510 + }
  511 + }
  512 + var s = null;
  513 + if ((u) && ((D) || (H === this.chatLinks.name))) {
  514 + y = this.trimString(L.topic);
  515 + if (y.length > 0) {
  516 + s = y;
  517 + B += "&topic=" + b(s)
  518 + }
  519 + }
  520 + var N = document.createElement("a");
  521 + var v = "";
  522 + var A = "";
  523 + if (!this.useDetection || (this.isWin8 && this.isIE10) || this.isIE7 || this.isIE6) {
  524 + A = B
  525 + } else {
  526 + if ((this.isWinPhone8 && this.isIE10) || (this.isAndroid && this.isAndroidBrowser)) {
  527 + A = "javascript://";
  528 + v += " Skype.displayNotSupportedMsg();"
  529 + }
  530 + else if(this.isAndroid && this.isChrome)
  531 + {
  532 + v = "Skype.trySkypeUri_Android_Chrome('" + this.analyzeCrumbIndex + "');";
  533 + A = B
  534 + }
  535 + else {
  536 + y = "Skype.trySkypeUri_Generic";
  537 + if (this.isIE10 || this.isIE9 || this.isIE8) {
  538 + y = "Skype.trySkypeUri_IE9_IE8"
  539 + } else {
  540 + // Note: iOS8 handles Skype.trySkypeUri_Generic so no need to switch to Skype.trySkypeUri_IOS_Safari
  541 + if ((this.isIOS7 || this.isIOS6 || this.isIOS5 || this.isIOS4) && this.isSafari) {
  542 + y = "Skype.trySkypeUri_IOS_Safari"
  543 + } else {
  544 + if (this.isAndroid && this.isFF) {
  545 + y = "Skype.trySkypeUri_Android_Firefox"
  546 + }
  547 + }
  548 + } if (this.detectSkypeClientFrameId === null) {
  549 + this.createDetectionFrame(this.P);
  550 + }
  551 + A = "javascript://";
  552 + v += y + "('" + B + "', '" + this.detectSkypeClientFrameId + "', '" + this.analyzeCrumbIndex + "'); return false;"
  553 + }
  554 + }
  555 + var z = document.createElement("img");
  556 + z.setAttribute("src", w);
  557 + z.setAttribute("alt", M);
  558 + z.setAttribute("role", F);
  559 + z.setAttribute("style", ("border:0; margin:" + this.assetMargin + "px; vertical-align:" + this.assetSizeMap[("size" + this.assetSize)].verticalOffset + "px;"));
  560 + if (this.name === this.dropdownLinks.name) {
  561 + z.setAttribute("onmouseover", "Skype.showDropdown('dropdown_" + this.element + "'); return false;");
  562 + z.setAttribute("onmouseout", "Skype.hideDropdown('dropdown_" + this.element + "'); return false;");
  563 + N.setAttribute("style", "cursor: text;");
  564 + N.setAttribute("onfocus", "Skype.showDropdown('dropdown_" + this.element + "'); return false;");
  565 + N.setAttribute("onblur", "Skype.hideDropdown('dropdown_" + this.element + "'); return false;");
  566 + N.setAttribute("href", "javascript://");
  567 + N.setAttribute("onclick", "return false;")
  568 + } else {
  569 + if (this.name === this.chatLinks.name) {
  570 + v = "Skype.tryAnalyzeSkypeUri('chat', '" + this.analyzeCrumbIndex + "');" + v
  571 + } else {
  572 + v = "Skype.tryAnalyzeSkypeUri('call', '" + this.analyzeCrumbIndex + "');" + v
  573 + }
  574 + N.setAttribute("href", A);
  575 + N.setAttribute("onclick", v)
  576 + }
  577 + N.appendChild(z);
  578 + uriPara = document.createElement("p");
  579 + uriPara.setAttribute("id", (L.element + "_paraElement"));
  580 + uriPara.setAttribute("style", ("font-size:" + (this.assetSize - 2) + "px; color:" + this.assetColor.font));
  581 + uriPara.appendChild(N);
  582 + if (this.name === this.dropdownLinks.name) {
  583 + var O = "-10";
  584 + var J = "15";
  585 + if (this.assetSize === "10") {
  586 + J = "15"
  587 + } else {
  588 + if (this.assetSize === "12") {
  589 + J = "15"
  590 + } else {
  591 + if (this.assetSize === "14") {
  592 + J = "15"
  593 + } else {
  594 + if (this.assetSize === "16") {
  595 + J = "15"
  596 + } else {
  597 + if (this.assetSize === "24") {
  598 + O = "-20";
  599 + J = "25"
  600 + } else {
  601 + if (this.assetSize === "32") {
  602 + O = "-30";
  603 + J = "30"
  604 + }
  605 + }
  606 + }
  607 + }
  608 + }
  609 + }
  610 + var r = document.createElement("ul");
  611 + r.id = "dropdown_" + this.element;
  612 + r.setAttribute("style", "display: none; position: absolute; margin-top: " + O + "px; margin-left: " + J + "px; width: 200px; padding-left: 20px; padding-right: 20px; border: 2px solid #00AFF0; background-color: white; color: #00AFF0; line-height: 50px; list-style: none; list-style-type: none;");
  613 + r.setAttribute("onmouseover", "Skype.showDropdown('dropdown_" + this.element + "'); return false;");
  614 + r.setAttribute("onmouseout", "Skype.hideDropdown('dropdown_" + this.element + "'); return false;");
  615 + var t = document.createElement("li");
  616 + t.setAttribute("style", "list-style: none; list-style-type: none;");
  617 + var Q = document.createElement("li");
  618 + Q.setAttribute("style", "list-style: none; list-style-type: none;");
  619 + var K = "";
  620 + var I = document.createElement("a");
  621 + I.href = "javascript://";
  622 + I.setAttribute("style", "text-decoration: none; color: #00AFF0; font-size: 16px;");
  623 + I.setAttribute("href", A);
  624 + K = "Skype.tryAnalyzeSkypeUri('dropdownCall', '" + this.analyzeCrumbIndex + "');" + v;
  625 + I.setAttribute("onclick", K.replace("?" + this.dropdownLinks.name, "?" + this.callLinks.name));
  626 + I.setAttribute("onmouseover", "this.style.textDecoration = 'underline'");
  627 + I.setAttribute("onmouseout", "this.style.textDecoration = 'none'");
  628 + I.setAttribute("role", "Menu item");
  629 + I.setAttribute("onfocus", "Skype.showDropdown('dropdown_" + this.element + "'); return false;");
  630 + I.setAttribute("onblur", "Skype.hideDropdown('dropdown_" + this.element + "'); return false;");
  631 + var E = document.createElement("a");
  632 + E.href = "javascript://";
  633 + E.setAttribute("style", "text-decoration: none; color: #00AFF0; font-size: 16px;");
  634 + E.setAttribute("href", A);
  635 + K = "Skype.tryAnalyzeSkypeUri('dropdownChat', '" + this.analyzeCrumbIndex + "');" + v;
  636 + E.setAttribute("onclick", K.replace("?" + this.dropdownLinks.name, "?" + this.chatLinks.name));
  637 + E.setAttribute("onmouseover", "this.style.textDecoration = 'underline'");
  638 + E.setAttribute("onmouseout", "this.style.textDecoration = 'none'");
  639 + I.setAttribute("role", "Menu item");
  640 + E.setAttribute("onfocus", "Skype.showDropdown('dropdown_" + this.element + "'); return false;");
  641 + E.setAttribute("onblur", "Skype.hideDropdown('dropdown_" + this.element + "'); return false;");
  642 + I.innerHTML = "Call";
  643 + t.appendChild(I);
  644 + E.innerHTML = "Chat";
  645 + Q.appendChild(E);
  646 + r.appendChild(t);
  647 + r.appendChild(Q);
  648 + uriPara.appendChild(r)
  649 + }
  650 + y = null;
  651 + if (C.length !== 0) {
  652 + if (this.trimString(L.listParticipants) === "true") {
  653 + y = " " + C
  654 + }
  655 + if ((s !== null) && (this.trimString(L.listTopic) === "true")) {
  656 + if ((y === null) || (y.length === 0)) {
  657 + y = " RE: " + s
  658 + } else {
  659 + y += ("; RE: " + s)
  660 + }
  661 + }
  662 + if (y === null) {
  663 + y = ""
  664 + }
  665 + uriPara.appendChild(document.createTextNode(y))
  666 + }
  667 + P.appendChild(uriPara);
  668 + this.tryAnalyzeSkypeUri("init", this.analyzeCrumbIndex);
  669 + return (true)
  670 + }
  671 +
  672 + function j(u, r) {
  673 + this.assetSize = this.assetSizeDefault;
  674 + this.assetMargin = (this.assetSize >= this.assetMarginMinimum) ? this.assetSize : this.assetMarginMinimum;
  675 + var t;
  676 + var s = this.assetSizeArray.length;
  677 + for (t = 0; t < s; t++) {
  678 + if (u === this.assetSizeArray[t]) {
  679 + this.assetSize = u;
  680 + break
  681 + }
  682 + }
  683 + this.assetMargin = (this.assetSize >= this.assetMarginMinimum) ? this.assetSize : this.assetMarginMinimum;
  684 + this.assetColor.path = this.assetColorPathDefault;
  685 + this.assetColor.font = this.assetColorFontDefault;
  686 + if (r.length > 0) {
  687 + if (r === "skype") {
  688 + this.assetColor.path = this.assetColorPathSkype;
  689 + this.assetColor.font = this.assetColorFontSkype
  690 + } else {
  691 + if (r === "white") {
  692 + this.assetColor.path = this.assetColorPathWhite;
  693 + this.assetColor.font = this.assetColorFontWhite
  694 + }
  695 + }
  696 + }
  697 + this.focusLinks.linkImage = this.assetPrefix + "Skypeicon" + this.assetColor.path + this.assetSize + "px.png";
  698 + this.callLinks.linkImage = this.assetPrefix + "callbutton" + this.assetColor.path + this.assetSize + "px.png";
  699 + this.videoLinks.linkImage = this.assetPrefix + "callbutton" + this.assetColor.path + this.assetSize + "px.png";
  700 + this.chatLinks.linkImage = this.assetPrefix + "chatbutton" + this.assetColor.path + this.assetSize + "px.png";
  701 + this.multiChatLinks.linkImage = this.assetPrefix + "chatbutton" + this.assetColor.path + this.assetSize + "px.png";
  702 + this.dropdownLinks.linkImage = this.assetPrefix + "dropdowncallbutton" + this.assetColor.path + this.assetSize + "px.png";
  703 + this.focusLinks.linkImageAltTag = "Open Skype";
  704 + this.callLinks.linkImageAltTag = "Skype call";
  705 + this.videoLinks.linkImageAltTag = "Skype call";
  706 + this.chatLinks.linkImageAltTag = "Skype chat, instant message";
  707 + this.multiChatLinks.linkImageAltTag = "Skype chat, instant message";
  708 + this.dropdownLinks.linkImageAltTag = "Call options";
  709 + this.focusLinks.role = "Button";
  710 + this.callLinks.role = "Button";
  711 + this.videoLinks.role = "Button";
  712 + this.chatLinks.role = "Button";
  713 + this.multiChatLinks.role = "Button";
  714 + this.dropdownLinks.role = "Pop up menu"
  715 + }
  716 +
  717 + function o(t) {
  718 + if ((t === undefined) || (t === null)) {
  719 + return ("")
  720 + }
  721 + var u = t.length;
  722 + var s = u - 1;
  723 + var r = false;
  724 + while ((!r) && (u > 0)) {
  725 + switch (t[s]) {
  726 + case " ":
  727 + case "\t":
  728 + case "\n":
  729 + case "\r":
  730 + u--;
  731 + break;
  732 + default:
  733 + r = true;
  734 + break
  735 + }
  736 + s--
  737 + }
  738 + if (u > 0) {
  739 + return (t.substr(0, u))
  740 + }
  741 + return ("")
  742 + }
  743 +
  744 + function b(s) {
  745 + if ((s === undefined) || (s === null)) {
  746 + return ("")
  747 + }
  748 + var r = s.replace(/\s/g, "%20");
  749 + r = r.replace(/:/g, "%3A");
  750 + r = r.replace(/\x2F/g, "%2F");
  751 + return (r.replace(/\x5C/g, "%5C"))
  752 + }
  753 +
  754 + function h(r) {
  755 + if(!r) {
  756 + var divs = document.getElementsByTagName("div");
  757 + for(var i = 0; i < divs.length; i++) {
  758 + if(divs[i].id && divs[i].id.match("SkypeButton")) {
  759 + r = divs[i];
  760 + }
  761 + }
  762 + }
  763 + var t = new Date();
  764 + this.detectSkypeClientFrameId = "_detectSkypeClient_" + t.getTime().toString();
  765 + var s = document.createElement("iframe");
  766 + s.setAttribute("style", "display:none;");
  767 + s.setAttribute("id", this.detectSkypeClientFrameId);
  768 + r.appendChild(s);
  769 + }
  770 +
  771 + function n(s, w, u) {
  772 + var v = false;
  773 + var r = window.open("", "_blank", "width=100, height=100");
  774 + var t = r.document.createElement("iframe");
  775 + t.setAttribute("src", s);
  776 + r.document.body.appendChild(t);
  777 + setTimeout(function () {
  778 + try {
  779 + r.location.href;
  780 + v = true
  781 + } catch (x) {}
  782 + if (v) {
  783 + r.setTimeout("window.close()", 10)
  784 + } else {
  785 + r.close();
  786 + alert(Skype.installSkypeMsg);
  787 + Skype.tryAnalyzeSkypeUri("redirect", u);
  788 + window.location = Skype.SkypeClientDownloadUrl
  789 + }
  790 + }, 100)
  791 + }
  792 +
  793 + function e(s, v, t) {
  794 + var r = document.getElementById(v);
  795 + var u = true;
  796 + window.addEventListener("pagehide", function () {
  797 + u = false
  798 + }, false);
  799 + if (r !== null) {
  800 + r.src = s
  801 + }
  802 + setTimeout(function () {
  803 + if (u) {
  804 + alert(Skype.installSkypeMsg);
  805 + Skype.tryAnalyzeSkypeUri("redirect", t);
  806 + window.location = Skype.SkypeClientDownloadUrl
  807 + }
  808 + }, 2000)
  809 + }
  810 +
  811 + function q(s, v, u) {
  812 + var t = false;
  813 + var r = document.getElementById(v);
  814 + if (r !== null) {
  815 + try {
  816 + r.contentWindow.location.href = s;
  817 + t = true
  818 + } catch (w) {
  819 + t = false
  820 + }
  821 + }
  822 + setTimeout(function () {
  823 + if (!t) {
  824 + alert(Skype.installSkypeMsg);
  825 + Skype.tryAnalyzeSkypeUri("redirect", u);
  826 + window.location = Skype.SkypeClientDownloadUrl
  827 + }
  828 + }, 2000)
  829 + }
  830 +
  831 + function a(s, v, t) {
  832 + var u = true;
  833 + window.onblur = function () {
  834 + u = false;
  835 + };
  836 + var r = document.getElementById(v);
  837 + if (r !== null) {
  838 + r.src = s
  839 + }
  840 + setTimeout(function () {
  841 + if (u) {
  842 + alert(Skype.installSkypeMsg);
  843 + Skype.tryAnalyzeSkypeUri("redirect", t);
  844 + window.location = Skype.SkypeClientDownloadUrl
  845 + }
  846 + }, 2000)
  847 + }
  848 +
  849 + function a_androidchrome(analyzeCrumbIndex) {
  850 + var documentVisible = true;
  851 + var vizchangecb;
  852 +
  853 + document.addEventListener("visibilitychange", vizchangecb = function () {
  854 + documentVisible = !document.hidden;
  855 + });
  856 +
  857 + setTimeout(function () {
  858 +
  859 + if (documentVisible) {
  860 + alert(Skype.installSkypeMsg);
  861 + Skype.tryAnalyzeSkypeUri("redirect", analyzeCrumbIndex);
  862 + window.location = Skype.SkypeClientDownloadUrl
  863 + }
  864 +
  865 + document.removeEventListener("visibilitychange", vizchangecb);
  866 + }, 6000) // if Skype app is booting the Skype splash screen prevents the visibilitychange event firing
  867 + // until it is done, so we allow for a longer timeout in case we have to wait for it
  868 + }
  869 + }();
  870 +
  871 +/*jshint +W003:true */
  872 +/*jshint +W107:true */
  873 +/*jshint +W057:true */
0 874 \ No newline at end of file
... ...
share-amp/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/skype/skype.get.js
... ... @@ -20,6 +20,8 @@ function main()
20 20 // if no profile specified, must be current user
21 21 model.profile = user.getUser(user.id);
22 22 }
  23 +
  24 + model.profile.skype = model.profile.skype? model.profile.skype : "";
23 25 };
24 26  
25 27 main();
26 28 \ No newline at end of file
... ...