Advertisement
Guest User

Queue-it javascript - burningman

a guest
Apr 12th, 2016
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var QueueIt;
  2. (function(b) {
  3.     var a;
  4.     (function(c) {
  5.         var d = (function() {
  6.             function e(f, g) {
  7.                 this.callbackArray = new Array();
  8.                 this.customerId = f;
  9.                 this.eventId = g
  10.             }
  11.             e.prototype.modelUpdated = function(f) {
  12.                 this.callbackArray.push(f)
  13.             }
  14.             ;
  15.             e.prototype.doCallbacks = function(f) {
  16.                 for (var h = 0; h < this.callbackArray.length; h++) {
  17.                     try {
  18.                         if ($.isFunction(this.callbackArray[h])) {
  19.                             this.callbackArray[h](f)
  20.                         }
  21.                     } catch (g) {
  22.                         window.logger.Error({
  23.                             Message: "Error executing callback: " + g.message,
  24.                             Ex: g
  25.                         }, this.eventId, this.customerId)
  26.                     }
  27.                 }
  28.             }
  29.             ;
  30.             e.prototype.logAjaxCallError = function(i, h, j, g, f) {
  31.                 if (f === void 0) {
  32.                     f = ""
  33.                 }
  34.                 if (!h) {
  35.                     return
  36.                 }
  37.                 if (h.status != 503 && h.status != 504) {
  38.                     window.logger.Error({
  39.                         Page: i,
  40.                         Message: "Error in ajax call," + f + " responseText: " + h.responseText + "; textstatus: " + j + "; errorThrown: " + g + "; jqXHR.status:" + h.status
  41.                     }, this.eventId, this.customerId)
  42.                 } else {
  43.                     console.info("server call error")
  44.                 }
  45.             }
  46.             ;
  47.             return e
  48.         })();
  49.         c.ViewBase = d
  50.     })(a = b.Queue || (b.Queue = {}))
  51. })(QueueIt || (QueueIt = {}));
  52. var __extends = (this && this.__extends) || function(e, c) {
  53.     for (var f in c) {
  54.         if (c.hasOwnProperty(f)) {
  55.             e[f] = c[f]
  56.         }
  57.     }
  58.     function a() {
  59.         this.constructor = e
  60.     }
  61.     a.prototype = c.prototype;
  62.     e.prototype = new a()
  63. }
  64. ;
  65. var QueueIt;
  66. (function(b) {
  67.     var a;
  68.     (function(d) {
  69.         var c = (function(e) {
  70.             __extends(f, e);
  71.             function f(g, h, k, i, j) {
  72.                 e.call(this, g, h);
  73.                 this.jsErrors = 0;
  74.                 this.updateInterval = 5000;
  75.                 this.creole = new Parse.Simple.Creole({
  76.                     forIE: document.all
  77.                 });
  78.                 this.queueId = k;
  79.                 this.language = i;
  80.                 this.layoutName = j;
  81.                 this.message = ko.observable()
  82.             }
  83.             f.prototype.ajaxGetMessage = function() {
  84.                 var g = this;
  85.                 $.ajax({
  86.                     type: "GET",
  87.                     contentType: "application/json",
  88.                     url: "/after/" + this.customerId + "/" + this.eventId + "/" + this.queueId + "/status?cid=" + this.language + "&l=" + this.layoutName,
  89.                     success: function(h) {
  90.                         var i = h.redirectUrl;
  91.                         if (i) {
  92.                             document.location.href = i;
  93.                             return
  94.                         }
  95.                         g.refreshClientInfo(h);
  96.                         g.jsErrors = 0
  97.                     },
  98.                     error: function(i, j, h) {
  99.                         g.jsErrors = g.jsErrors + 1;
  100.                         g.logAjaxCallError("AfterPage", i, j, h)
  101.                     }
  102.                 })
  103.             }
  104.             ;
  105.             f.prototype.updateTimer = function() {
  106.                 var g = this;
  107.                 setTimeout(function() {
  108.                     g.ajaxGetMessage();
  109.                     g.updateTimer()
  110.                 }, this.updateInterval)
  111.             }
  112.             ;
  113.             f.prototype.getCreole = function() {
  114.                 return this.creole
  115.             }
  116.             ;
  117.             f.prototype.init = function() {
  118.                 this.updateTimer()
  119.             }
  120.             ;
  121.             f.prototype.refreshClientInfo = function(g) {
  122.                 this.updateInterval = g.updateInterval ? g.updateInterval : 5000;
  123.                 if (g.message && g.message.text) {
  124.                     this.message(new d.Message(g.message))
  125.                 } else {
  126.                     this.message(null )
  127.                 }
  128.             }
  129.             ;
  130.             return f
  131.         })(d.ViewBase);
  132.         d.AfterView = c
  133.     })(a = b.Queue || (b.Queue = {}))
  134. })(QueueIt || (QueueIt = {}));
  135. var QueueIt;
  136. (function(b) {
  137.     var a;
  138.     (function(e) {
  139.         var d = (function(f) {
  140.             __extends(g, f);
  141.             function g(j, l, n, p, m, k, h, o, i) {
  142.                 f.call(this, j, l);
  143.                 this.jsErrors = 0;
  144.                 this.updateInterval = 5000;
  145.                 this.creole = new Parse.Simple.Creole({
  146.                     forIE: document.all
  147.                 });
  148.                 this.clientInfo = i;
  149.                 this.queueId = n;
  150.                 this.targetUrl = p;
  151.                 this.language = m;
  152.                 this.customUrlParams = k;
  153.                 this.appType = h;
  154.                 this.sdkVersion = o
  155.             }
  156.             g.prototype.ajaxQueueStatus = function() {
  157.                 var h = this;
  158.                 var i = "/before/" + this.customerId + "/" + this.eventId + "/" + this.queueId + "/status?cid=" + this.language + "&l=" + this.status.lastLayoutName();
  159.                 $.ajax({
  160.                     type: "POST",
  161.                     dataType: "json",
  162.                     contentType: "application/json",
  163.                     data: JSON.stringify({
  164.                         targetUrl: this.targetUrl,
  165.                         customUrlParams: this.customUrlParams,
  166.                         layoutVersion: this.status.lastLayoutVersion(),
  167.                         layoutName: this.status.lastLayoutName()
  168.                     }),
  169.                     url: i,
  170.                     success: function(j) {
  171.                         var k = j.redirectUrl;
  172.                         if (k != undefined) {
  173.                             document.location.href = k;
  174.                             return
  175.                         }
  176.                         h.refreshClientInfo(j);
  177.                         h.jsErrors = 0;
  178.                         h.isRunning(true)
  179.                     },
  180.                     error: function(k, l, j) {
  181.                         h.jsErrors = h.jsErrors + 1;
  182.                         h.logAjaxCallError("BeforePage", k, l, j)
  183.                     }
  184.                 })
  185.             }
  186.             ;
  187.             g.prototype.setDetailStatusData = function(h) {
  188.                 this.status.eventStartTimeFormatted(h.eventStartTimeFormatted);
  189.                 this.status.secondsToStart(h.secondsToStart);
  190.                 this.status.timeZonePostfix(h.timeZonePostfix);
  191.                 this.status.usersInQueue(h.usersInQueue);
  192.                 this.status.lastLayoutVersion(h.lastLayoutVersion);
  193.                 this.status.lastLayoutName(h.lastLayoutName)
  194.             }
  195.             ;
  196.             g.prototype.refreshClientInfo = function(h) {
  197.                 this.doCallbacks(h);
  198.                 this.updateInterval = (h.details.updateInterval) ? h.details.updateInterval : 40000;
  199.                 var j = h.details.secondsToStart;
  200.                 $("#defaultCountdown").countdown("option", {
  201.                     until: j
  202.                 });
  203.                 this.setDetailStatusData(h.details);
  204.                 if (h.layout) {
  205.                     this.layout.refresh(h.layout, false)
  206.                 }
  207.                 if (h.texts) {
  208.                     var i = h.texts.styleSheets;
  209.                     if (this.texts.styleSheets && this.texts.styleSheets != i) {
  210.                         this.switchPageCss(i)
  211.                     }
  212.                     this.texts.refresh(h.texts)
  213.                 }
  214.                 this.processMessageInfo(h)
  215.             }
  216.             ;
  217.             g.prototype.switchPageCss = function(h) {
  218.                 $("head< link").filter("[href$='.css']").remove();
  219.                 $("head").html(h)
  220.             }
  221.             ;
  222.             g.prototype.processMessageInfo = function(h) {
  223.                 if (h.message && h.message.text) {
  224.                     this.message(new e.Message(h.message))
  225.                 } else {
  226.                     this.message(null )
  227.                 }
  228.                 if (h.message && h.message.text) {
  229.                     if ($.isFunction(window.addMessageToFeed)) {
  230.                         window.addMessageToFeed({
  231.                             id: h.message.id,
  232.                             header: h.message.header,
  233.                             text: h.message.text,
  234.                             avatar: h.message.avatar,
  235.                             timestamp: h.message.timestamp
  236.                         })
  237.                     }
  238.                 }
  239.             }
  240.             ;
  241.             g.prototype.updateTimer = function() {
  242.                 var h = this;
  243.                 setTimeout(function() {
  244.                     h.ajaxQueueStatus();
  245.                     h.updateTimer()
  246.                 }, this.updateInterval)
  247.             }
  248.             ;
  249.             g.prototype.flashTimer = function() {
  250.                 var h = this;
  251.                 setTimeout(function() {
  252.                     if (h.jsErrors == 0) {
  253.                         $("#Pb1").toggleClass("active")
  254.                     } else {
  255.                         $("#Pb1").removeClass("active")
  256.                     }
  257.                     if (h.jsErrors > 3) {
  258.                         h.isRunning(false)
  259.                     }
  260.                     h.flashTimer()
  261.                 }, 2000)
  262.             }
  263.             ;
  264.             g.prototype.getCreole = function() {
  265.                 return this.creole
  266.             }
  267.             ;
  268.             g.prototype.init = function(h) {
  269.                 if (h === void 0) {
  270.                     h = true
  271.                 }
  272.                 this.doCallbacks(this.clientInfo);
  273.                 this.message = ko.observable();
  274.                 this.isRunning = ko.observable(true);
  275.                 this.status = new c();
  276.                 this.setDetailStatusData(this.clientInfo.details);
  277.                 this.layout = new e.Layout(this.clientInfo.layout,false);
  278.                 this.texts = new e.InQueueTexts(this.clientInfo.texts);
  279.                 this.processMessageInfo(this.clientInfo);
  280.                 if (h) {
  281.                     this.updateTimer();
  282.                     this.flashTimer()
  283.                 }
  284.             }
  285.             ;
  286.             return g
  287.         })(e.ViewBase);
  288.         e.BeforeView = d;
  289.         var c = (function() {
  290.             function f() {
  291.                 this.eventStartTimeFormatted = ko.observable();
  292.                 this.timeZonePostfix = ko.observable();
  293.                 this.secondsToStart = ko.observable();
  294.                 this.usersInQueue = ko.observable(0);
  295.                 this.lastLayoutVersion = ko.observable();
  296.                 this.lastLayoutName = ko.observable()
  297.             }
  298.             return f
  299.         })();
  300.         e.BeforeStatusDetails = c
  301.     })(a = b.Queue || (b.Queue = {}))
  302. })(QueueIt || (QueueIt = {}));
  303. var QueueIt;
  304. (function(b) {
  305.     var a;
  306.     (function(d) {
  307.         var c = (function() {
  308.             function e() {
  309.                 var f = this;
  310.                 try {
  311.                     document.addEventListener("visibilitychange", (function() {
  312.                         return f.handleVisibilityChange()
  313.                     }), false)
  314.                 } catch (g) {
  315.                     window.logger.Debug({
  316.                         Message: "Error in adding visibilitychange",
  317.                         Ex: g
  318.                     })
  319.                 }
  320.                 try {
  321.                     document.addEventListener("mozvisibilitychange", (function() {
  322.                         return f.handleVisibilityChange()
  323.                     }), false)
  324.                 } catch (g) {
  325.                     window.logger.Debug({
  326.                         Message: "Error in adding mozvisibilitychange",
  327.                         Ex: g
  328.                     })
  329.                 }
  330.                 try {
  331.                     document.addEventListener("webkitvisibilitychange", (function() {
  332.                         return f.handleVisibilityChange()
  333.                     }), false)
  334.                 } catch (g) {
  335.                     window.logger.Debug({
  336.                         Message: "Error in adding webkitvisibilitychange",
  337.                         Ex: g
  338.                     })
  339.                 }
  340.                 try {
  341.                     document.addEventListener("msvisibilitychange", (function() {
  342.                         return f.handleVisibilityChange()
  343.                     }), false)
  344.                 } catch (g) {
  345.                     window.logger.Debug({
  346.                         Message: "Error in adding msvisibilitychange",
  347.                         Ex: g
  348.                     })
  349.                 }
  350.             }
  351.             e.prototype.handleVisibilityChange = function() {
  352.                 var f = document;
  353.                 this._isHidden = (f.hidden || f.mozHidden || f.webkitHidden || f.msHidden)
  354.             }
  355.             ;
  356.             e.prototype.isHidden = function() {
  357.                 return this._isHidden
  358.             }
  359.             ;
  360.             return e
  361.         })();
  362.         d.InactivityDetector = c
  363.     })(a = b.Queue || (b.Queue = {}))
  364. })(QueueIt || (QueueIt = {}));
  365. var QueueIt;
  366. (function(b) {
  367.     var a;
  368.     (function(d) {
  369.         var c = (function(e) {
  370.             __extends(f, e);
  371.             function f(i, j, h) {
  372.                 var g = this;
  373.                 e.call(this, i.customerId, i.eventId);
  374.                 this.redirector = j;
  375.                 this.cssReplacer = h;
  376.                 this._firstInLine = false;
  377.                 this._soundIsPlayingFlag = false;
  378.                 this.isRedirectPromptDialogConfirmed = null ;
  379.                 this._logSoundPlayerInfo = {
  380.                     SoundPlayer_setup_IsCalled: false,
  381.                     SoundPlayer_onready_IsCalled: false,
  382.                     SoundPlayer_onready_Exception: false
  383.                 };
  384.                 this.waitingStateUpdateInterval = 60 * 1000;
  385.                 this.getStatus = function() {
  386.                     return g.status
  387.                 }
  388.                 ;
  389.                 this.getIsRedirectedToTarget = function() {
  390.                     return g.isRedirectedToTarget
  391.                 }
  392.                 ;
  393.                 this.getQueueId = function() {
  394.                     return g.options.queueId
  395.                 }
  396.                 ;
  397.                 this.updateNotify = function() {
  398.                     var k = this;
  399.                     $.ajax({
  400.                         type: "POST",
  401.                         dataType: "json",
  402.                         contentType: "application/json",
  403.                         data: JSON.stringify({
  404.                             email: this.emailAddress(),
  405.                             targetUrl: this.options.targetUrl,
  406.                             customUrlParams: this.options.customUrlParams
  407.                         }),
  408.                         url: "queue/" + this.options.customerId + "/" + this.options.eventId + "/" + this.options.queueId + "/UpdateEmail/?cid=" + ((this.options.culture) ? this.options.culture : "") + "&l=" + this.options.layout,
  409.                         success: function(l) {
  410.                             k.notify(l.Message, l.Status)
  411.                         },
  412.                         error: function(m, n, l) {
  413.                             k.notify("Error subscribing", "error");
  414.                             k.logAjaxCallError("InquePage", m, n, l, "Error subscribing")
  415.                         }
  416.                     })
  417.                 }
  418.                 ;
  419.                 this.options = i;
  420.                 this.status = "NotReadyYet";
  421.                 this.updateInterval = 2000;
  422.                 this.notReadyCount = 0;
  423.                 this.jsErrorCount = 0;
  424.                 this.lastTryUpdate = new Date();
  425.                 this.lastLayoutVersion = i.forecast.forecast.layoutVersion;
  426.                 this.lastLayoutName = i.forecast.forecast.layoutName;
  427.                 this.detector = new d.InactivityDetector();
  428.                 if (!this.redirector) {
  429.                     this.redirector = {
  430.                         redirect: function(k) {
  431.                             if (!k) {
  432.                                 window.location.reload()
  433.                             } else {
  434.                                 window.location.href = k
  435.                             }
  436.                         }
  437.                     }
  438.                 }
  439.                 if (!this.cssReplacer) {
  440.                     this.cssReplacer = {
  441.                         replace: function(k) {
  442.                             $("head< link").filter("[href$='.css']").remove();
  443.                             $("head").append(k)
  444.                         }
  445.                     }
  446.                 }
  447.                 this.creole = new Parse.Simple.Creole({
  448.                     forIE: document.all
  449.                 })
  450.             }
  451.             f.prototype.get_firstInLine = function() {
  452.                 return this._firstInLine
  453.             }
  454.             ;
  455.             f.prototype.set_firstInLine = function(g) {
  456.                 if (this._firstInLine != g) {
  457.                     this._firstInLine = g;
  458.                     if (g && window.welcomeAudioPlayer) {
  459.                         this.playWelcomeSound()
  460.                     }
  461.                 }
  462.             }
  463.             ;
  464.             f.prototype.init = function(g) {
  465.                 if (g === void 0) {
  466.                     g = true
  467.                 }
  468.                 this.doCallbacks(this.options.forecast);
  469.                 this.set_firstInLine(this.options.forecast.forecast.status == "FirstInLine");
  470.                 this.layout = new d.Layout(this.options.forecast.layout,this.get_firstInLine());
  471.                 this.message = this.options.forecast.message ? ko.observable(new d.Message(this.options.forecast.message)) : ko.observable();
  472.                 this.texts = new d.InQueueTexts(this.options.forecast.texts);
  473.                 this.ticket = new d.Ticket(this.options.forecast.ticket);
  474.                 this.isRunning = ko.observable(true);
  475.                 this.isRedirected = false;
  476.                 this.isRedirectedToTarget = false;
  477.                 this.emailAddress = ko.observable(this.options.emailAddress);
  478.                 this.isClientInactive = ko.observable(false);
  479.                 this.showConfirmRedirectDialog = ko.observable(false);
  480.                 this.initSoundTrack();
  481.                 if (g) {
  482.                     this.updateTimer();
  483.                     this.updateCheckTimer()
  484.                 }
  485.             }
  486.             ;
  487.             f.prototype.getCreole = function() {
  488.                 return this.creole
  489.             }
  490.             ;
  491.             f.prototype.refresh = function(g) {
  492.                 if (!g.forecast) {
  493.                     return
  494.                 }
  495.                 if (this.status != "NotReadyYet" && g.forecast && g.forecast.status == "NotReadyYet") {
  496.                     return
  497.                 }
  498.                 if (this.get_firstInLine() && g.forecast.status != "FirstInLine") {
  499.                     return
  500.                 }
  501.                 this.updateInterval = g.forecast.updateInterval;
  502.                 this.status = g.forecast.status;
  503.                 if (this.status === "NotReadyYet") {
  504.                     this.notReadyCount++
  505.                 }
  506.                 if (this.notReadyCount >= 10) {
  507.                     this.isRedirected = true;
  508.                     this.redirector.redirect()
  509.                 }
  510.                 this.doCallbacks(g);
  511.                 if (!this.isRedirectPromptDialogConfirmed && g.ticket.queuePaused == false && this.status == "FirstInLine") {
  512.                     if (this.layout.isRedirectPromptDialogEnabled || this.isClientInactive()) {
  513.                         if (this.ticket.windowStartTime()) {
  514.                             this.updateInterval = Math.max(this.updateInterval, this.waitingStateUpdateInterval)
  515.                         }
  516.                         this.showConfirmRedirectDialog(true);
  517.                         this.isRedirectPromptDialogConfirmed = false
  518.                     }
  519.                 }
  520.                 if (this.status == "FirstInLine") {
  521.                     this.set_firstInLine(true)
  522.                 }
  523.                 this.ticket.refresh(g.ticket);
  524.                 this.layout.refresh(g.layout, this.get_firstInLine());
  525.                 if (this.lastLayoutVersion >= g.forecast.layoutVersion && this.lastLayoutName == g.forecast.layoutName) {
  526.                     return
  527.                 }
  528.                 this.message(g.message ? new d.Message(g.message) : undefined);
  529.                 if (g.texts && g.texts.styleSheets !== this.texts.styleSheets) {
  530.                     this.cssReplacer.replace(g.texts.styleSheets)
  531.                 }
  532.                 this.texts.refresh(g.texts);
  533.                 this.initSoundTrack();
  534.                 this.lastLayoutVersion = g.forecast.layoutVersion;
  535.                 this.lastLayoutName = g.forecast.layoutName
  536.             }
  537.             ;
  538.             f.prototype.updateTimer = function() {
  539.                 var g = this;
  540.                 setTimeout(function() {
  541.                     g.lastTryUpdate = new Date();
  542.                     if (!g.showConfirmRedirectDialog() && !g.isRedirectPromptDialogConfirmed) {
  543.                         g.isClientInactive(g.detector.isHidden())
  544.                     }
  545.                     g.ajaxGetForecast()
  546.                 }, this.updateInterval)
  547.             }
  548.             ;
  549.             f.prototype.initSoundTrack = function() {
  550.                 var g = this;
  551.                 if (!window.welcomeAudioPlayer && this.texts.isWelcomeSoundEnabled) {
  552.                     try {
  553.                         this._logSoundPlayerInfo.SoundPlayer_setup_IsCalled = true;
  554.                         window.soundManager.setup({
  555.                             url: "/css/sound",
  556.                             debugMode: false,
  557.                             preferFlash: false,
  558.                             onready: function() {
  559.                                 g._logSoundPlayerInfo.SoundPlayer_onready_IsCalled = true;
  560.                                 try {
  561.                                     window.welcomeAudioPlayer = window.soundManager.createSound({
  562.                                         url: g.texts.notificationSoundUrls
  563.                                     });
  564.                                     if (g.get_firstInLine()) {
  565.                                         g.playWelcomeSound()
  566.                                     }
  567.                                 } catch (i) {
  568.                                     window.logger.Error({
  569.                                         Message: "Error initing sound file",
  570.                                         Ex: i,
  571.                                         Page: "InqueuePage"
  572.                                     }, g.eventId, g.customerId, g.options.queueId || "");
  573.                                     g._logSoundPlayerInfo.SoundPlayer_onready_Exception = true
  574.                                 }
  575.                             }
  576.                         })
  577.                     } catch (h) {
  578.                         window.logger.Error({
  579.                             Message: "Error setuping soundmanager",
  580.                             Ex: h,
  581.                             Page: "InqueuePage"
  582.                         }, this.eventId, this.customerId, this.options.queueId || "")
  583.                     }
  584.                 }
  585.             }
  586.             ;
  587.             f.prototype.playWelcomeSound = function(i) {
  588.                 var g = this;
  589.                 try {
  590.                     this._soundIsPlayingFlag = true;
  591.                     setTimeout(function() {
  592.                         g._soundIsPlayingFlag = false
  593.                     }, 10000);
  594.                     if (this.texts.isWelcomeSoundEnabled) {
  595.                         if (window.welcomeAudioPlayer) {
  596.                             window.welcomeAudioPlayer.play({
  597.                                 onfinish: function() {
  598.                                     g._soundIsPlayingFlag = false;
  599.                                     if (i) {
  600.                                         i()
  601.                                     }
  602.                                 }
  603.                             })
  604.                         } else {
  605.                             window.logger.Debug({
  606.                                 Message: "Not expected case in playing welcome sound"
  607.                             }, this.eventId, this.customerId, this.options.queueId || "", d.Helpers.ErrorSeverity.Information, this._logSoundPlayerInfo)
  608.                         }
  609.                     }
  610.                 } catch (h) {
  611.                     this._soundIsPlayingFlag = false;
  612.                     window.logger.Error({
  613.                         Message: "Error playing sound",
  614.                         Ex: h,
  615.                         Page: "InqueuePage"
  616.                     }, this.eventId, this.customerId, this.options.queueId || "")
  617.                 }
  618.             }
  619.             ;
  620.             f.prototype.updateCheckTimer = function() {
  621.                 var g = this;
  622.                 setInterval(function() {
  623.                     if ((new Date().getTime() - g.lastTryUpdate.getTime()) > 1000 * 60) {
  624.                         setTimeout(function() {
  625.                             if ((new Date().getTime() - g.lastTryUpdate.getTime()) > 1000 * 60 * 2) {
  626.                                 g.redirector.redirect()
  627.                             }
  628.                         }, 60000)
  629.                     }
  630.                     if (g.jsErrorCount == 0) {
  631.                         $("#defaultViewPb1").toggleClass("active")
  632.                     } else {
  633.                         $("#defaultViewPb1").removeClass("active")
  634.                     }
  635.                     if (g.jsErrorCount > 3) {
  636.                         g.isRunning(false)
  637.                     }
  638.                 }, 2000)
  639.             }
  640.             ;
  641.             f.prototype.ajaxGetForecast = function(i, h) {
  642.                 var g = this;
  643.                 if (i === void 0) {
  644.                     i = this.isRedirectPromptDialogConfirmed
  645.                 }
  646.                 if (!this.isRedirected) {
  647.                     if (this._soundIsPlayingFlag) {
  648.                         this.updateTimer();
  649.                         return
  650.                     }
  651.                     var j = "/queue/" + this.options.customerId + "/" + this.options.eventId + "/" + this.options.queueId + "/getforecast?cid=" + ((this.options.culture) ? this.options.culture : "") + "&l=" + ((this.options.layout) ? this.options.layout : "");
  652.                     if (this.options.appType) {
  653.                         j += "&app=" + this.options.appType
  654.                     }
  655.                     if (this.options.sdkVersion) {
  656.                         j += "&sdkv=" + this.options.sdkVersion
  657.                     }
  658.                     $.ajax({
  659.                         type: "POST",
  660.                         dataType: "json",
  661.                         contentType: "application/json",
  662.                         data: JSON.stringify({
  663.                             targetUrl: this.options.targetUrl,
  664.                             customUrlParams: this.options.customUrlParams,
  665.                             layoutVersion: this.lastLayoutVersion,
  666.                             layoutName: this.lastLayoutName,
  667.                             isClientRedayToRedirect: this.GetClinetReadyToRedirect(i)
  668.                         }),
  669.                         url: j,
  670.                         success: function(k) {
  671.                             try {
  672.                                 if (k.redirectUrl) {
  673.                                     g.isRedirected = true;
  674.                                     g.isRedirectedToTarget = k.isRedirectToTarget;
  675.                                     if (!g.get_firstInLine()) {
  676.                                         g._firstInLine = true;
  677.                                         var m = setTimeout(function() {
  678.                                             g.redirector.redirect(k.redirectUrl, k.isRedirectToTarget)
  679.                                         }, 10000);
  680.                                         g.ticket.setProgressBar(100);
  681.                                         g.playWelcomeSound(function() {
  682.                                             clearTimeout(m);
  683.                                             g.redirector.redirect(k.redirectUrl, k.isRedirectToTarget)
  684.                                         });
  685.                                         return
  686.                                     } else {
  687.                                         g.redirector.redirect(k.redirectUrl, k.isRedirectToTarget);
  688.                                         return
  689.                                     }
  690.                                 }
  691.                                 g.refresh(k);
  692.                                 g.jsErrorCount = 0;
  693.                                 g.isRunning(true)
  694.                             } catch (l) {
  695.                                 g.jsErrorCount++;
  696.                                 window.logger.Error({
  697.                                     Message: "Error in updating result ajaxGetForecast",
  698.                                     Ex: l,
  699.                                     Page: "InqueuePage"
  700.                                 }, g.eventId, g.customerId, g.options.queueId || "")
  701.                             } finally {
  702.                                 if (h) {
  703.                                     h()
  704.                                 }
  705.                                 g.updateTimer()
  706.                             }
  707.                         },
  708.                         error: function(l, m, k) {
  709.                             g.logAjaxCallError("InquePage", l, m, k);
  710.                             try {
  711.                                 if ($.isFunction(g.options.errorCallback)) {
  712.                                     g.options.errorCallback()
  713.                                 }
  714.                             } finally {
  715.                                 g.jsErrorCount++;
  716.                                 if (l && (l.status === 503 || l.status === 504)) {
  717.                                     g.updateInterval *= 1.25;
  718.                                     if (g.updateInterval > 40000 * 5) {
  719.                                         g.updateInterval = 40000 * 5
  720.                                     }
  721.                                 }
  722.                                 if (h) {
  723.                                     h()
  724.                                 }
  725.                                 g.updateTimer()
  726.                             }
  727.                         }
  728.                     })
  729.                 }
  730.             }
  731.             ;
  732.             f.prototype.notify = function(g, h) {
  733.                 $("#divEmailStatusFrame").removeClass().show().addClass(h == "Success" ? "submit_success alert alert-success" : "submit_failure alert alert-error").delay(20000).fadeOut().click(function() {
  734.                     $(this).stop(true, true).fadeOut()
  735.                 });
  736.                 $("#divEmailStatus").html(g)
  737.             }
  738.             ;
  739.             f.prototype.setActiveClient = function() {
  740.                 var g = this;
  741.                 this.isClientInactive(false);
  742.                 this.showConfirmRedirectDialog(false);
  743.                 this.ajaxGetForecast(true, function() {
  744.                     g.isRedirectPromptDialogConfirmed = true
  745.                 })
  746.             }
  747.             ;
  748.             f.prototype.GetClinetReadyToRedirect = function(g) {
  749.                 return g || (!this.layout.isRedirectPromptDialogEnabled && !this.isClientInactive())
  750.             }
  751.             ;
  752.             return f
  753.         })(d.ViewBase);
  754.         d.InQueueView = c
  755.     })(a = b.Queue || (b.Queue = {}))
  756. })(QueueIt || (QueueIt = {}));
  757. function Cookie(b) {
  758.     var c = this;
  759.     this.name = b;
  760.     this.get = function() {
  761.         return a(b)
  762.     }
  763.     ;
  764.     this.set = function(f, e) {
  765.         if (!e) {
  766.             e = 0
  767.         }
  768.         d(b, f, e)
  769.     }
  770.     ;
  771.     this.clear = function() {
  772.         this.setCookie(b, "")
  773.     }
  774.     ;
  775.     function a(f) {
  776.         var g, h, j, e = document.cookie.split(";");
  777.         for (g = 0; g < e.length; g++) {
  778.             h = e[g].substr(0, e[g].indexOf("="));
  779.             j = e[g].substr(e[g].indexOf("=") + 1);
  780.             h = h.replace(/^\s+|\s+$/g, "");
  781.             if (h == f) {
  782.                 return decodeURIComponent(j)
  783.             }
  784.         }
  785.     }
  786.     function d(e, i, h) {
  787.         var g = new Date();
  788.         g.setMinutes(g.getMinutes() + h);
  789.         var f = encodeURIComponent(i) + "; expires=" + g.toUTCString() + "; domain=.queue-it.net ; path=/";
  790.         document.cookie = e + "=" + f
  791.     }
  792. }
  793. function AjaxHelper(b) {
  794.     var h = this;
  795.     this.baseUrl = b;
  796.     var c = false;
  797.     try {
  798.         var i = new XMLHttpRequest();
  799.         if ("withCredentials" in i) {
  800.             c = true
  801.         }
  802.     } catch (d) {}
  803.     this.initialize = function() {
  804.         if (c) {
  805.             window.crossDomainRequestAsyncInit()
  806.         } else {
  807.             $("body").append('<iframe id="crossdomainajaxframe" name="crossdomainajaxframe" class="hidden" src="' + h.baseUrl + 'ajax/proxy"></iframe>')
  808.         }
  809.     }
  810.     ;
  811.     function f() {
  812.         var e = new Cookie("MYQUEUEITASPXAUTH");
  813.         return e.get()
  814.     }
  815.     this.get = function(j, e) {
  816.         a(j, null , e, "GET")
  817.     }
  818.     ;
  819.     this.post = function(k, e, j) {
  820.         a(k, e, j, "POST")
  821.     }
  822.     ;
  823.     this.put = function(k, e, j) {
  824.         a(k, e, j, "PUT")
  825.     }
  826.     ;
  827.     var a = function(o, j, m, n) {
  828.         var e = f();
  829.         var k = null ;
  830.         if (e != null ) {
  831.             k = {
  832.                 "X-Queueit-Auth": e
  833.             }
  834.         }
  835.         o = b + o;
  836.         if (c) {
  837.             g(o, j, m, k, n)
  838.         } else {
  839.             var l = window.frames.crossdomainajaxframe;
  840.             l.ajax(o, j, m, k, n)
  841.         }
  842.     }
  843.     ;
  844.     function g(m, e, k, j, l) {
  845.         $.ajax(m, {
  846.             type: l,
  847.             dataType: "json",
  848.             contentType: "application/json",
  849.             data: e,
  850.             headers: j,
  851.             success: function(n) {
  852.                 if (k !== undefined && $.isFunction(k.onSuccess)) {
  853.                     k.onSuccess(n)
  854.                 }
  855.             },
  856.             error: function(n, o) {
  857.                 if (k !== undefined && $.isFunction(k.onError)) {
  858.                     k.onError()
  859.                 }
  860.             },
  861.             complete: function() {
  862.                 if (k !== undefined && $.isFunction(k.onComplete)) {
  863.                     k.onComplete()
  864.                 }
  865.             },
  866.             statusCode: {
  867.                 401: function() {
  868.                     if (k !== undefined && $.isFunction(k.onUnauthorized)) {
  869.                         k.onUnauthorized()
  870.                     }
  871.                 }
  872.             }
  873.         })
  874.     }
  875. }
  876. function GetQueueIdWhenRedirectedToTarget() {
  877.     var a = window;
  878.     if (!a.queueViewModel) {
  879.         return null
  880.     }
  881.     if (!a.queueViewModel.getIsRedirectedToTarget) {
  882.         return null
  883.     }
  884.     if (a.queueViewModel.getIsRedirectedToTarget()) {
  885.         return a.queueViewModel.getQueueId()
  886.     }
  887. }
  888. var QueueIt;
  889. (function(b) {
  890.     var a;
  891.     (function(d) {
  892.         var c;
  893.         (function(f) {
  894.             var g = (function() {
  895.                 function h() {
  896.                     var i = window.onerror;
  897.                     var j = this;
  898.                     window.onerror = function(m, n, l, k) {
  899.                         j.Error({
  900.                             Message: "Unhandled Exception in window.onerror: " + m + " , url:" + n + " lineno:" + l + " ,col:" + k
  901.                         }, null , null , null , e.Critical);
  902.                         if (i && typeof i === "function") {
  903.                             i.apply(window, arguments)
  904.                         }
  905.                     }
  906.                 }
  907.                 h.prototype.Log = function(m) {
  908.                     try {
  909.                         console.info(m.LogMessageInfo.Message + ((m.LogMessageInfo.Ex ? m.LogMessageInfo.Ex.message : "")));
  910.                         if (!this.logContainer) {
  911.                             this.logContainer = $("#queue-it_log");
  912.                             this.userId = this.logContainer.attr("data-userid");
  913.                             this.proxyUrl = this.logContainer.attr("data-proxyurl");
  914.                             if (!this.logContainer || !this.proxyUrl) {
  915.                                 return
  916.                             }
  917.                         }
  918.                         var l = {};
  919.                         if (m.LogMessageInfo.Ex && m.LogMessageInfo.Ex.stack) {
  920.                             l.StackTrace = m.LogMessageInfo.Ex.stack
  921.                         }
  922.                         if (m.LogMessageInfo.Ex && m.LogMessageInfo.Ex.message) {
  923.                             l.ErrorMessage = m.LogMessageInfo.Ex.message
  924.                         }
  925.                         if (!m.LogMessageInfo.Message) {
  926.                             m.LogMessageInfo.Message = "Unexpectcted Error"
  927.                         }
  928.                         if (m.LogMessageInfo.Page) {
  929.                             m.LogMessageInfo.Message = m.LogMessageInfo.Message + "; in page: " + m.LogMessageInfo.Page
  930.                         }
  931.                         var n = window.queueViewModel;
  932.                         var i = m.CustomerId;
  933.                         if (!i && n) {
  934.                             i = n.customerId
  935.                         }
  936.                         var k = m.EventId;
  937.                         if (!k && n) {
  938.                             k = n.eventId
  939.                         }
  940.                         var o = m.QueueId;
  941.                         if (!o && n) {
  942.                             o = n.getQueueId()
  943.                         }
  944.                         this.logToProxy({
  945.                             Category: m.Category,
  946.                             QueueId: o,
  947.                             CustomerId: i,
  948.                             EventId: k,
  949.                             Message: m.LogMessageInfo.Message,
  950.                             Severity: m.Severity,
  951.                             Exception: l,
  952.                             UserId: this.userId,
  953.                             Service: "JavaScript(queuefront)",
  954.                             Url: window.location.href,
  955.                             UserAgent: navigator.userAgent,
  956.                             PlatformInfo: window.getClientInfo(),
  957.                             Timestamp: (new Date()).toISOString(),
  958.                             CustomInfo: m.CustomInfo
  959.                         })
  960.                     } catch (j) {
  961.                         console.debug(j)
  962.                     }
  963.                 }
  964.                 ;
  965.                 h.prototype.Error = function(l, k, i, m, n, j) {
  966.                     if (k === void 0) {
  967.                         k = ""
  968.                     }
  969.                     if (i === void 0) {
  970.                         i = ""
  971.                     }
  972.                     if (m === void 0) {
  973.                         m = ""
  974.                     }
  975.                     if (n === void 0) {
  976.                         n = e.Error
  977.                     }
  978.                     if (j === void 0) {
  979.                         j = null
  980.                     }
  981.                     this.Log({
  982.                         LogMessageInfo: l,
  983.                         Category: "Error",
  984.                         Severity: e[n],
  985.                         QueueId: m,
  986.                         CustomerId: i,
  987.                         EventId: k,
  988.                         CustomInfo: j
  989.                     })
  990.                 }
  991.                 ;
  992.                 h.prototype.Business = function(l, k, i, m, n, j) {
  993.                     if (k === void 0) {
  994.                         k = ""
  995.                     }
  996.                     if (i === void 0) {
  997.                         i = ""
  998.                     }
  999.                     if (m === void 0) {
  1000.                         m = ""
  1001.                     }
  1002.                     if (n === void 0) {
  1003.                         n = e.Information
  1004.                     }
  1005.                     if (j === void 0) {
  1006.                         j = null
  1007.                     }
  1008.                     this.Log({
  1009.                         LogMessageInfo: l,
  1010.                         Category: "Business",
  1011.                         Severity: e[n],
  1012.                         QueueId: m,
  1013.                         CustomerId: i,
  1014.                         EventId: k,
  1015.                         CustomInfo: j
  1016.                     })
  1017.                 }
  1018.                 ;
  1019.                 h.prototype.Debug = function(l, k, i, m, n, j) {
  1020.                     if (k === void 0) {
  1021.                         k = ""
  1022.                     }
  1023.                     if (i === void 0) {
  1024.                         i = ""
  1025.                     }
  1026.                     if (m === void 0) {
  1027.                         m = ""
  1028.                     }
  1029.                     if (n === void 0) {
  1030.                         n = e.Information
  1031.                     }
  1032.                     if (j === void 0) {
  1033.                         j = null
  1034.                     }
  1035.                     this.Log({
  1036.                         LogMessageInfo: l,
  1037.                         Category: "Debug",
  1038.                         Severity: e[n],
  1039.                         QueueId: m,
  1040.                         CustomerId: i,
  1041.                         EventId: k,
  1042.                         CustomInfo: j
  1043.                     })
  1044.                 }
  1045.                 ;
  1046.                 h.prototype.logToProxy = function(i) {
  1047.                     try {
  1048.                         var k = this.objectToQuery(i, "");
  1049.                         this.logContainer.append('<script type="text/javascript" src="' + this.proxyUrl + "?" + k + '"></script>')
  1050.                     } catch (j) {
  1051.                         if (window && window.console && typeof window.console.log === "function") {
  1052.                             console.log("Failed to log to loggly because of this exception:\n" + j);
  1053.                             console.log("Failed log data:", i)
  1054.                         }
  1055.                     }
  1056.                 }
  1057.                 ;
  1058.                 h.prototype.objectToQuery = function(i, k) {
  1059.                     var l = "";
  1060.                     for (var j in i) {
  1061.                         if (i.hasOwnProperty(j)) {
  1062.                             if (!i[j]) {
  1063.                                 continue
  1064.                             }
  1065.                             if (l) {
  1066.                                 l += "&"
  1067.                             }
  1068.                             if (typeof i[j] === "object") {
  1069.                                 l += this.objectToQuery(i[j], j)
  1070.                             } else {
  1071.                                 l += k + j.substr(0, 1).toUpperCase() + j.substr(1) + "=" + encodeURIComponent(i[j])
  1072.                             }
  1073.                         }
  1074.                     }
  1075.                     return l
  1076.                 }
  1077.                 ;
  1078.                 return h
  1079.             })();
  1080.             f.Logger = g;
  1081.             (function(h) {
  1082.                 h[h.Critical = 1] = "Critical";
  1083.                 h[h.Error = 2] = "Error";
  1084.                 h[h.Warning = 4] = "Warning";
  1085.                 h[h.Information = 8] = "Information"
  1086.             })(f.ErrorSeverity || (f.ErrorSeverity = {}));
  1087.             var e = f.ErrorSeverity;
  1088.             window.logger = new g()
  1089.         })(c = d.Helpers || (d.Helpers = {}))
  1090.     })(a = b.Queue || (b.Queue = {}))
  1091. })(QueueIt || (QueueIt = {}));
  1092. var QueueIt;
  1093. (function(b) {
  1094.     var a;
  1095.     (function(d) {
  1096.         var c = (function() {
  1097.             function e(f) {
  1098.                 this.avatar = f == null  ? null  : f.avatar;
  1099.                 this.header = f == null  ? null  : f.header;
  1100.                 this.id = f == null  ? null  : f.id;
  1101.                 this.text = f == null  ? null  : f.text;
  1102.                 this.timestamp = (f && f.timestamp) ? new Date(parseInt(f.timestamp.substr(6))) : new Date();
  1103.                 this.timestampFormatted = f == null  ? null  : f.timestampFormatted;
  1104.                 this.timeZonePostfix = f == null  ? null  : f.timeZonePostfix
  1105.             }
  1106.             return e
  1107.         })();
  1108.         d.Message = c
  1109.     })(a = b.Queue || (b.Queue = {}))
  1110. })(QueueIt || (QueueIt = {}));
  1111. var QueueIt;
  1112. (function(b) {
  1113.     var a;
  1114.     (function(d) {
  1115.         var c = (function() {
  1116.             function e(g, f) {
  1117.                 this.servicedSoonDelayLengthMS = 15 * 1000;
  1118.                 this.firstInLineTimeStamp = null ;
  1119.                 this.avatarSrc = ko.observable();
  1120.                 this.bottomPanelVisible = ko.observable();
  1121.                 this.dynamicMessageVisible = ko.observable();
  1122.                 this.expectedServiceTimeVisible = ko.observable();
  1123.                 this.firstInLineVisible = ko.observable();
  1124.                 this.highLoadVisible = ko.observable();
  1125.                 this.leftPanelVisible = ko.observable();
  1126.                 this.middlePanelVisible = ko.observable();
  1127.                 this.queueIsPausedVisible = ko.observable();
  1128.                 this.queueNumberVisible = ko.observable();
  1129.                 this.queueNumberLoadingVisible = ko.observable();
  1130.                 this.reminderEmailVisible = ko.observable();
  1131.                 this.reminderVisible = ko.observable();
  1132.                 this.rightPanelVisible = ko.observable();
  1133.                 this.servicedSoonVisible = ko.observable();
  1134.                 this.sidePanelVisible = ko.observable();
  1135.                 this.topPanelVisible = ko.observable();
  1136.                 this.usersInLineAheadOfYouVisible = ko.observable();
  1137.                 this.usersInQueueVisible = ko.observable();
  1138.                 this.logoVisible = ko.observable();
  1139.                 this.whichIsInVisible = ko.observable();
  1140.                 this.progressVisible = ko.observable();
  1141.                 this.servicedSoonDelayVisible = ko.observable(false);
  1142.                 this.languageSelectorVisible = ko.observable();
  1143.                 this.refresh(g, f)
  1144.             }
  1145.             e.prototype.refresh = function(g, f) {
  1146.                 if (!g) {
  1147.                     return
  1148.                 }
  1149.                 this.isRedirectPromptDialogEnabled = g.isRedirectPromptDialogEnabled;
  1150.                 this.bottomPanelVisible(g.bottomPanelVisible);
  1151.                 this.dynamicMessageVisible(g.dynamicMessageVisible);
  1152.                 this.expectedServiceTimeVisible(g.expectedServiceTimeVisible && !f);
  1153.                 this.firstInLineVisible(f || g.firstInLineVisible);
  1154.                 this.highLoadVisible(g.highLoadVisible);
  1155.                 this.leftPanelVisible(g.leftPanelVisible);
  1156.                 this.middlePanelVisible(g.middlePanelVisible);
  1157.                 this.queueIsPausedVisible(g.queueIsPausedVisible);
  1158.                 this.queueNumberVisible(g.queueNumberVisible);
  1159.                 this.queueNumberLoadingVisible(g.queueNumberLoadingVisible);
  1160.                 this.reminderEmailVisible(g.reminderEmailVisible);
  1161.                 this.reminderVisible(g.reminderVisible);
  1162.                 this.rightPanelVisible(g.rightPanelVisible);
  1163.                 this.servicedSoonVisible(f && !g.queueIsPausedVisible);
  1164.                 this.sidePanelVisible(g.sidePanelVisible);
  1165.                 this.topPanelVisible(g.topPanelVisible);
  1166.                 this.usersInLineAheadOfYouVisible(g.usersInLineAheadOfYouVisible && !f);
  1167.                 this.usersInQueueVisible(g.usersInQueueVisible);
  1168.                 this.logoVisible(g.logoVisible);
  1169.                 this.whichIsInVisible(g.whichIsInVisible && !f);
  1170.                 this.progressVisible(g.progressVisible);
  1171.                 this.languageSelectorVisible(g.languageSelectorVisible);
  1172.                 if (f && this.firstInLineTimeStamp == null ) {
  1173.                     this.firstInLineTimeStamp = new Date()
  1174.                 } else {
  1175.                     if (f && this.firstInLineTimeStamp != null  && !this.servicedSoonDelayVisible()) {
  1176.                         if (Date.now() - this.firstInLineTimeStamp.valueOf() > this.servicedSoonDelayLengthMS) {
  1177.                             this.servicedSoonDelayVisible(true)
  1178.                         }
  1179.                     }
  1180.                 }
  1181.             }
  1182.             ;
  1183.             return e
  1184.         })();
  1185.         d.Layout = c
  1186.     })(a = b.Queue || (b.Queue = {}))
  1187. })(QueueIt || (QueueIt = {}));
  1188. var QueueIt;
  1189. (function(b) {
  1190.     var a;
  1191.     (function(d) {
  1192.         var c = (function() {
  1193.             function e(f) {
  1194.                 this.body = ko.observable();
  1195.                 this.disclaimerText = ko.observable();
  1196.                 this.header = ko.observable();
  1197.                 this.avatarSrc = ko.observable();
  1198.                 this.bottompanelIFrameSrc = ko.observable();
  1199.                 this.leftpanelIFrameSrc = ko.observable();
  1200.                 this.logoSrc = ko.observable();
  1201.                 this.middlepanelIFrameSrc = ko.observable();
  1202.                 this.rightpanelIFrameSrc = ko.observable();
  1203.                 this.sidepanelIFrameSrc = ko.observable();
  1204.                 this.toppanelIFrameSrc = ko.observable();
  1205.                 this.styleSheets = ko.observable();
  1206.                 this.whatIsThisUrl = ko.observable();
  1207.                 this.languages = ko.observableArray();
  1208.                 this.selectedLanguage = ko.observable();
  1209.                 this.refresh(f)
  1210.             }
  1211.             e.prototype.refresh = function(f) {
  1212.                 if (!f) {
  1213.                     return
  1214.                 }
  1215.                 this.notificationSoundUrls = f.notificationSoundUrls;
  1216.                 this.isWelcomeSoundEnabled = this.notificationSoundUrls && this.notificationSoundUrls.length > 0;
  1217.                 if (this.body() != f.body) {
  1218.                     this.body(f.body)
  1219.                 }
  1220.                 if (this.disclaimerText() != f.disclaimerText) {
  1221.                     this.disclaimerText(f.disclaimerText)
  1222.                 }
  1223.                 if (this.header() != f.header) {
  1224.                     this.header(f.header)
  1225.                 }
  1226.                 if (this.avatarSrc() != f.avatarSrc) {
  1227.                     this.avatarSrc(f.avatarSrc)
  1228.                 }
  1229.                 if (this.logoSrc() != f.logoSrc) {
  1230.                     this.logoSrc(f.logoSrc)
  1231.                 }
  1232.                 this.styleSheets = f.styleSheets;
  1233.                 this.initLanguage(f);
  1234.                 if (this.sidepanelIFrameSrc() != f.sidepanelIFrameSrc) {
  1235.                     this.sidepanelIFrameSrc(f.sidepanelIFrameSrc)
  1236.                 }
  1237.                 if (this.toppanelIFrameSrc() != f.toppanelIFrameSrc) {
  1238.                     this.toppanelIFrameSrc(f.toppanelIFrameSrc)
  1239.                 }
  1240.                 if (this.rightpanelIFrameSrc() != f.rightpanelIFrameSrc) {
  1241.                     this.rightpanelIFrameSrc(f.rightpanelIFrameSrc)
  1242.                 }
  1243.                 if (this.middlepanelIFrameSrc() != f.middlepanelIFrameSrc) {
  1244.                     this.middlepanelIFrameSrc(f.middlepanelIFrameSrc)
  1245.                 }
  1246.                 if (this.leftpanelIFrameSrc() != f.leftpanelIFrameSrc) {
  1247.                     this.leftpanelIFrameSrc(f.leftpanelIFrameSrc)
  1248.                 }
  1249.                 if (this.bottompanelIFrameSrc() != f.bottompanelIFrameSrc) {
  1250.                     this.bottompanelIFrameSrc(f.bottompanelIFrameSrc)
  1251.                 }
  1252.                 if (this.whatIsThisUrl() != f.whatIsThisUrl) {
  1253.                     this.whatIsThisUrl(f.whatIsThisUrl)
  1254.                 }
  1255.             }
  1256.             ;
  1257.             e.prototype.initLanguage = function(h) {
  1258.                 var f = this;
  1259.                 if (!h.languages) {
  1260.                     return
  1261.                 }
  1262.                 if (this._selectedLanguageSubscribe) {
  1263.                     this._selectedLanguageSubscribe.dispose()
  1264.                 }
  1265.                 this.languages.removeAll();
  1266.                 for (var g = 0; g < h.languages.length; ++g) {
  1267.                     this.languages.push({
  1268.                         text: h.languages[g].Text,
  1269.                         value: h.languages[g].Value
  1270.                     });
  1271.                     if (h.languages[g].Selected) {
  1272.                         this.selectedLanguage(h.languages[g].Value)
  1273.                     }
  1274.                 }
  1275.                 this._selectedLanguageSubscribe = this.selectedLanguage.subscribe(function() {
  1276.                     return f.changeLanguage()
  1277.                 })
  1278.             }
  1279.             ;
  1280.             e.prototype.changeLanguage = function() {
  1281.                 var j = document.location.href;
  1282.                 var k = j.split("?");
  1283.                 if (k.length >= 2) {
  1284.                     var h = encodeURIComponent("cid") + "=";
  1285.                     var g = k[1].split(/[&;]/g);
  1286.                     for (var f = g.length - 1; f >= 0; f--) {
  1287.                         if (g[f].lastIndexOf(h, 0) !== -1) {
  1288.                             g.splice(f, 1)
  1289.                         }
  1290.                     }
  1291.                     j = k[0] + "?" + g.join("&")
  1292.                 }
  1293.                 document.location.href = j + "&cid=" + this.selectedLanguage()
  1294.             }
  1295.             ;
  1296.             return e
  1297.         })();
  1298.         d.InQueueTexts = c
  1299.     })(a = b.Queue || (b.Queue = {}))
  1300. })(QueueIt || (QueueIt = {}));
  1301. var QueueIt;
  1302. (function(b) {
  1303.     var a;
  1304.     (function(c) {
  1305.         var d = (function() {
  1306.             function e(g) {
  1307.                 var f = this;
  1308.                 this.isReady = false;
  1309.                 this.expectedServiceTime = ko.observable();
  1310.                 this.lastUpdated = ko.observable();
  1311.                 this.queueNumber = ko.observable();
  1312.                 this.usersInLineAheadOfYou = ko.observable();
  1313.                 this.whichIsIn = ko.observable();
  1314.                 this.highLoad = ko.observable();
  1315.                 this.progress = ko.observable(0.01);
  1316.                 this.timeZonePostfix = ko.observable();
  1317.                 this.windowStartTime = ko.observable();
  1318.                 this.refresh(g);
  1319.                 $(window).load(function() {
  1320.                     f.isReady = true;
  1321.                     f.setProgressBar(f.progress() * 100)
  1322.                 })
  1323.             }
  1324.             e.prototype.refresh = function(f) {
  1325.                 if (!f) {
  1326.                     return
  1327.                 }
  1328.                 if (this.expectedServiceTime() != f.expectedServiceTime) {
  1329.                     this.expectedServiceTime(f.expectedServiceTime)
  1330.                 }
  1331.                 if (this.lastUpdated() != f.lastUpdated) {
  1332.                     this.lastUpdated(f.lastUpdated)
  1333.                 }
  1334.                 if (this.queueNumber() != f.queueNumber) {
  1335.                     this.queueNumber(f.queueNumber)
  1336.                 }
  1337.                 if (this.usersInLineAheadOfYou() != f.usersInLineAheadOfYou) {
  1338.                     if (isNaN(this.usersInLineAheadOfYou()) || isNaN(f.usersInLineAheadOfYou) || this.usersInLineAheadOfYou() > parseInt(f.usersInLineAheadOfYou)) {
  1339.                         this.usersInLineAheadOfYou(parseInt(f.usersInLineAheadOfYou))
  1340.                     }
  1341.                 }
  1342.                 if (this.whichIsIn() != f.whichIsIn) {
  1343.                     this.whichIsIn(f.whichIsIn)
  1344.                 }
  1345.                 if (this.highLoad() != f.highLoad) {
  1346.                     this.highLoad(f.highLoad)
  1347.                 }
  1348.                 if (f.progress != null  && f.progress != this.progress()) {
  1349.                     this.progress(f.progress);
  1350.                     this.setProgressBar(this.progress() * 100)
  1351.                 }
  1352.                 this.timeZonePostfix(f.timeZonePostfix);
  1353.                 if (!this.windowStartTime() && f.windowStartTime) {
  1354.                     this.windowStartTime(f.windowStartTime)
  1355.                 }
  1356.             }
  1357.             ;
  1358.             e.prototype.setProgressBar = function(f) {
  1359.                 if (!this.isReady) {
  1360.                     return
  1361.                 }
  1362.                 window.progressBar(f, $(".progressbar"))
  1363.             }
  1364.             ;
  1365.             return e
  1366.         })();
  1367.         c.Ticket = d
  1368.     })(a = b.Queue || (b.Queue = {}))
  1369. })(QueueIt || (QueueIt = {}));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement