-
-
Save mahendrakalkura/77159876de7d56157fc413e3b5215bcd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
function BetSlipDelegates(dataAndEvents) { | |
this._bsContext = dataAndEvents; | |
} | |
/** | |
* @param {?} deepDataAndEvents | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
function BetSlipController(deepDataAndEvents, dataAndEvents) { | |
var _instanceEventAttacher = this; | |
var elem; | |
this._bsInst = deepDataAndEvents; | |
/** @type {null} */ | |
this._dlg = null; | |
this._bsContext = dataAndEvents; | |
this._delegates = new BetSlipDelegates(dataAndEvents); | |
/** @type {number} */ | |
this._noStakeCount = 0; | |
/** @type {null} */ | |
this._enhancedBetSlipTypeSelector = null; | |
/** @type {null} */ | |
this._enhancedBetSlipOddsSelector = null; | |
/** @type {null} */ | |
this._enhancedBetSlipPitcherSelector = null; | |
/** @type {null} */ | |
this._enhancedBetSlipIfBetSelector = null; | |
/** @type {null} */ | |
this._enhancedBetSlipTeaserTypeSelector = null; | |
/** @type {null} */ | |
this._enhancedBetSlipWinPlaceEachWay = null; | |
/** @type {null} */ | |
this._currencyDisplayHelper = null; | |
/** @type {null} */ | |
this._removeClickHandler = null; | |
/** @type {null} */ | |
this._eachWayClickHandler = null; | |
/** @type {null} */ | |
this._freeBetClickHandler = null; | |
/** @type {null} */ | |
this._noReservesClickHandler = null; | |
/** @type {null} */ | |
this._streamingClickHandler = null; | |
/** @type {null} */ | |
this._toteHoverHandler = null; | |
/** @type {null} */ | |
this._unitStakeClickHandler = null; | |
/** @type {null} */ | |
this._toteStakeClickHandler = null; | |
/** @type {null} */ | |
this._stakeFocusHandler = null; | |
/** @type {null} */ | |
this._messageDisplayHandler = null; | |
/** @type {null} */ | |
this._multipleItemsController = null; | |
/** @type {null} */ | |
this.webPopupManager = null; | |
/** @type {null} */ | |
this._quickBet = null; | |
/** @type {null} */ | |
this.betCallHandler = null; | |
/** @type {string} */ | |
this._pushConfigInitialisedEvent = "PUSH_CONFIG_PROPERTIES_INITIALISED"; | |
/** @type {string} */ | |
this._ausMultiplesAvailabilityChangedEvent = "IS_AUS_MULTIPLES_AVAILABLE"; | |
/** @type {Array} */ | |
this.complexMultiplesInfo = []; | |
/** @type {Array} */ | |
this.complexMultiplesOdds = []; | |
/** @type {boolean} */ | |
this.complexMultiplesNeedsRefresh = true; | |
/** @type {boolean} */ | |
this.complexMultiplesCombinationsInit = true; | |
/** @type {boolean} */ | |
this.complexMultiplesProcessing = false; | |
this.totalsCalculator; | |
/** @type {number} */ | |
this._multiplesCombinationLimit = 9; | |
/** @type {boolean} */ | |
this._isAusMultiplesAvailable = false; | |
this._enhancedBetSlipAnimations = new b365.Ui.Betslip.EnhancedBetSlipAnimations(this); | |
this._stakeEntryTypes = { | |
stakePad : 1, | |
deviceKeyBoard : 2 | |
}; | |
/** @type {null} */ | |
this._stakeEntryType = null; | |
/** | |
* @return {undefined} | |
*/ | |
this._suspendSelections = function() { | |
$(".bsSusp").parents(".bs-item-container").addClass("bsSusp").find(".bsSusp").removeClass("bsSusp"); | |
}; | |
this._instanceEventAttacher = new b365.Ui.Betslip.InstanceEventAttacher(this._bsInst, _instanceEventAttacher); | |
_instanceEventAttacher._instanceEventAttacher.attach(); | |
(new b365.Ui.Betslip.RestoreStateHandler(this._bsInst)).handle(); | |
this._bsInst.useTruncated2dpPriceForReturnsCalc = this.useTruncated2dpPriceForReturnsCalc(); | |
/** @type {boolean} */ | |
this._isItalianDomain = window.location.host.split(".").pop() == "it"; | |
/** @type {boolean} */ | |
this._isGreekDomain = window.location.host.split(".").pop() == "gr"; | |
/** @type {boolean} */ | |
this._isAustralianDomain = window.location.host.split(".").pop() == "au"; | |
/** @type {boolean} */ | |
this._pushMarketsEnabled = false; | |
if (this._isItalianDomain) { | |
/** @type {(HTMLElement|null)} */ | |
elem = document.getElementById("bsDiv"); | |
/** @type {string} */ | |
elem.className = elem.className + " italy"; | |
} | |
/** @type {boolean} */ | |
this.supressMicrophoneUpdates = false; | |
} | |
/** | |
* @return {?} | |
*/ | |
function clientViewport() { | |
/** @type {Window} */ | |
var w = window; | |
/** @type {HTMLDocument} */ | |
var d = document; | |
/** @type {Element} */ | |
var doc = d.documentElement; | |
var body = d.getElementsByTagName("body")[0]; | |
var originalWidth = w.innerWidth || (doc.clientWidth || body.clientWidth); | |
var dialogHeight = w.innerHeight || (doc.clientHeight || body.clientHeight); | |
return{ | |
width : originalWidth, | |
height : dialogHeight | |
}; | |
} | |
/** | |
* @return {?} | |
*/ | |
function getBetslipWebModule() { | |
return window.top.getBetslipFrame ? window.top.getBetslipFrame() : null; | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function initBetslip() { | |
appLoadStatus = { | |
premiumLoaded : false, | |
betslipAppLoaded : false | |
}; | |
window.bsApp = new BetslipApp; | |
window.bsApp.init(); | |
} | |
var b365Mobile = b365Mobile || {}; | |
var b365 = b365 || {}; | |
var _volatileElements; | |
var $get; | |
var $getElementsByClassName; | |
var bs; | |
var BetSlipShowConfirmationHandler; | |
var BetSlipPopupOverlay; | |
Sys = {}; | |
_volatileElements = {}; | |
/** | |
* @param {?} obj | |
* @param {?} func | |
* @return {?} | |
*/ | |
Function.createDelegate = function(obj, func) { | |
return function() { | |
return!func || typeof func != "function" ? null : func.apply(obj, arguments); | |
}; | |
}; | |
Type = {}; | |
Type.registerNamespace = function(ns) { | |
/** @type {Window} */ | |
var fn = window; | |
var codeSegments = ns.split("."); | |
var context; | |
var tmp; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < codeSegments.length;i++) { | |
context = codeSegments[i]; | |
tmp = fn[context]; | |
if (!tmp) { | |
tmp = fn[context] = {}; | |
} | |
fn = tmp; | |
} | |
}, function() { | |
Type.registerNamespace("Debug"); | |
var console = { | |
/** | |
* @return {undefined} | |
*/ | |
log : function() { | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
warn : function() { | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
error : function() { | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
info : function() { | |
} | |
}; | |
if (!window.Debug.console) { | |
/** @type {(Console|{error: function (): undefined, info: function (): undefined, log: function (): undefined, warn: function (): undefined})} */ | |
window.Debug.console = window.console ? window.console || console : console; | |
} | |
}(); | |
/** | |
* @param {string} string | |
* @return {?} | |
*/ | |
String.prototype.startsWith = function(string) { | |
return this.substr(0, string.length) === string; | |
}; | |
/** | |
* @param {string} pattern | |
* @return {?} | |
*/ | |
String.prototype.endsWith = function(pattern) { | |
/** @type {number} */ | |
var d = this.length - pattern.length; | |
return d >= 0 && this.lastIndexOf(pattern) === d; | |
}; | |
/** | |
* @return {string} | |
*/ | |
String.prototype.trim = function() { | |
return this.replace(/^\s+|\s+$/g, ""); | |
}; | |
/** | |
* @return {?} | |
*/ | |
String.prototype.escapeSelector = function() { | |
return this.replace(/([$%&()*+,./:;<=>?@\[\\\]^\{|}~])/g, "\\$1"); | |
}; | |
/** | |
* @param {?} msg | |
* @param {?} v02 | |
* @return {undefined} | |
*/ | |
Array.add = function(msg, v02) { | |
msg[msg.length] = v02; | |
}; | |
/** | |
* @param {(Array|number)} a | |
* @return {?} | |
*/ | |
Array.clone = function(a) { | |
return a.length === 1 ? [a[0]] : Array.apply(null, a); | |
}; | |
/** | |
* @param {Array} s | |
* @param {string} n | |
* @return {?} | |
*/ | |
Array.remove = function(s, n) { | |
var idx = s.indexOf(n); | |
return idx >= 0 && s.splice(idx, 1), idx >= 0; | |
}; | |
/** | |
* @param {Array} arr | |
* @param {?} obj | |
* @return {?} | |
*/ | |
Array.contains = function(arr, obj) { | |
var i = arr.length; | |
for (;i--;) { | |
if (arr[i] === obj) { | |
return true; | |
} | |
} | |
return false; | |
}; | |
Sys.Browser = {}; | |
Sys.Platform = {}; | |
Sys.Browser.InternetExplorer = {}; | |
Sys.Browser.Firefox = {}; | |
Sys.Browser.Safari = {}; | |
Sys.Browser.Opera = {}; | |
Sys.Browser.Chrome = {}; | |
Sys.Platform.Windows = {}; | |
Sys.Platform.Mac = {}; | |
Sys.Platform.iphone = {}; | |
/** @type {null} */ | |
Sys.Browser.agent = null; | |
/** @type {string} */ | |
Sys.Browser.name = navigator.appName; | |
/** @type {null} */ | |
Sys.Platform.name = null; | |
/** @type {number} */ | |
Sys.Browser.version = parseFloat(navigator.appVersion); | |
/** @type {number} */ | |
Sys.Browser.documentMode = 0; | |
if (navigator.userAgent.indexOf(" MSIE ") > -1) { | |
Sys.Browser.agent = Sys.Browser.InternetExplorer; | |
/** @type {number} */ | |
Sys.Browser.version = parseFloat(navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1]); | |
if (Sys.Browser.version >= 8) { | |
if (document.documentMode >= 7) { | |
Sys.Browser.documentMode = document.documentMode; | |
} | |
} | |
} else { | |
if (navigator.userAgent.indexOf(" Firefox/") > -1) { | |
Sys.Browser.agent = Sys.Browser.Firefox; | |
/** @type {string} */ | |
Sys.Browser.name = "Firefox"; | |
/** @type {number} */ | |
Sys.Browser.version = parseFloat(navigator.userAgent.match(/ Firefox\/(\d+\.\d+)/)[1]); | |
} else { | |
if (navigator.userAgent.indexOf(" AppleWebKit/") > -1) { | |
Sys.Browser.agent = Sys.Browser.Safari; | |
/** @type {number} */ | |
Sys.Browser.version = parseFloat(navigator.userAgent.match(/ AppleWebKit\/(\d+(\.\d+)?)/)[1]); | |
/** @type {string} */ | |
Sys.Browser.name = "Safari"; | |
} else { | |
if (navigator.userAgent.indexOf(" Chrome/") > -1) { | |
Sys.Browser.agent = Sys.Browser.Chrome; | |
/** @type {number} */ | |
Sys.Browser.version = parseFloat(navigator.userAgent.match(/ Chrome\/(\d+\.\d+)/)[1]); | |
/** @type {string} */ | |
Sys.Browser.name = "Chrome"; | |
} else { | |
if (navigator.userAgent.indexOf("Opera/") > -1) { | |
Sys.Browser.agent = Sys.Browser.Opera; | |
/** @type {string} */ | |
Sys.Browser.name = "Opera"; | |
} | |
} | |
} | |
} | |
} | |
if (navigator.platform.indexOf("Mac") > -1) { | |
Sys.Platform.name = Sys.Platform.Mac; | |
} else { | |
if (navigator.platform.indexOf("Win") > -1) { | |
Sys.Platform.name = Sys.Platform.Windows; | |
} | |
} | |
Sys.UI = {}; | |
/** | |
* @param {Object} eventName | |
* @return {undefined} | |
*/ | |
Sys.UI.DomEvent = function(eventName) { | |
/** @type {Object} */ | |
var event = eventName; | |
this.type = event.type.toLowerCase(); | |
this.rawEvent = event; | |
this.altKey = event.altKey; | |
this.clientX = event.clientX; | |
this.clientY = event.clientY; | |
this.ctrlKey = event.ctrlKey; | |
this.target = event.target ? event.target : event.srcElement; | |
this.screenX = event.screenX; | |
this.screenY = event.screenY; | |
this.shiftKey = event.shiftKey; | |
}; | |
Sys.UI.DomEvent.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
preventDefault : function() { | |
if (this.rawEvent.preventDefault) { | |
this.rawEvent.preventDefault(); | |
} else { | |
if (window.event) { | |
/** @type {boolean} */ | |
this.rawEvent.returnValue = false; | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
stopPropagation : function() { | |
if (this.rawEvent.stopPropagation) { | |
this.rawEvent.stopPropagation(); | |
} else { | |
if (window.event) { | |
/** @type {boolean} */ | |
this.rawEvent.cancelBubble = true; | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
_disposeHandlers : function() { | |
Sys.UI.DomEvent._clearHandlers(this, true); | |
var dispose = this._chainDispose; | |
/** @type {string} */ | |
var token = typeof dispose; | |
if (token !== "undefined") { | |
this.dispose = dispose; | |
/** @type {null} */ | |
this._chainDispose = null; | |
if (token === "function") { | |
this.dispose(); | |
} | |
} | |
} | |
}; | |
/** @type {function (): ?} */ | |
var $manageVolatileHandlers = Sys.UI.DomEvent._manageVolatileHandlers = function() { | |
var prop; | |
var a; | |
var cur; | |
var i; | |
/** @type {number} */ | |
var _manageVolatileHandlers = 0; | |
var r; | |
if (_volatileElements) { | |
for (prop in _volatileElements) { | |
if (a = _volatileElements[prop], a && a.length > 0) { | |
/** @type {number} */ | |
i = a.length - 1; | |
for (;i >= 0;i -= 1) { | |
if (cur = a[i], cur) { | |
/** @type {boolean} */ | |
r = true; | |
for (;r === true && (cur.nodeType && (cur.nodeType !== 2 && cur.nodeType < 9));) { | |
cur = cur.parentNode; | |
/** @type {boolean} */ | |
r = !!cur; | |
} | |
if (r === false) { | |
a.splice(i, 1); | |
_manageVolatileHandlers += 1; | |
} | |
} | |
} | |
} | |
} | |
} | |
return _manageVolatileHandlers; | |
}; | |
/** @type {function (Object, boolean): undefined} */ | |
var $clearHandlers = Sys.UI.DomEvent._clearHandlers = function(emitter, dataAndEvents) { | |
var types; | |
var type; | |
var list; | |
var _i; | |
var obj; | |
if (emitter._events) { | |
types = emitter._events; | |
for (type in types) { | |
list = types[type]; | |
/** @type {number} */ | |
_i = list.length - 1; | |
for (;_i >= 0;_i--) { | |
obj = list[_i]; | |
if (!dataAndEvents || obj.autoRemove) { | |
$removeHandler(emitter, type, obj.handler); | |
} | |
} | |
} | |
/** @type {null} */ | |
emitter._events = null; | |
} | |
}; | |
/** @type {function (string, Function, Function, Element, ?, ?): undefined} */ | |
var $addHandler = Sys.UI.DomEvent.addHandler = function(el, v02, callback, turnOn, stopPropagation, name) { | |
var listenersArr; | |
var handler; | |
var ret; | |
var node; | |
if (el != null) { | |
if (!el._events) { | |
el._events = {}; | |
} | |
listenersArr = el._events[v02]; | |
if (!listenersArr) { | |
/** @type {Array} */ | |
el._events[v02] = listenersArr = []; | |
} | |
/** @type {null} */ | |
handler = null; | |
if (el.addEventListener) { | |
/** | |
* @param {?} data | |
* @return {?} | |
*/ | |
handler = function(data) { | |
return callback.call(el, new Sys.UI.DomEvent(data)); | |
}; | |
el.addEventListener(v02, handler, false); | |
} else { | |
if (el.attachEvent) { | |
/** | |
* @return {?} | |
*/ | |
handler = function() { | |
var next_state = {}; | |
try { | |
next_state = Sys.UI.DomElement._getWindow(el).event; | |
} catch (r) { | |
} | |
return callback.call(el, new Sys.UI.DomEvent(next_state)); | |
}; | |
el.attachEvent("on" + v02, handler); | |
} | |
} | |
listenersArr[listenersArr.length] = { | |
/** @type {Function} */ | |
handler : callback, | |
browserHandler : handler, | |
autoRemove : turnOn | |
}; | |
if (stopPropagation) { | |
ret = _volatileElements[name]; | |
if (!ret) { | |
/** @type {Array} */ | |
_volatileElements[name] = ret = []; | |
} | |
ret.push(el); | |
} | |
if (turnOn) { | |
node = el.dispose; | |
if (node !== Sys.UI.DomEvent._disposeHandlers) { | |
el.dispose = Sys.UI.DomEvent._disposeHandlers; | |
if (typeof node != "undefined") { | |
el._chainDispose = node; | |
} | |
} | |
} | |
} | |
}; | |
/** @type {function (Object, string, ?): undefined} */ | |
var $removeHandler = Sys.UI.DomEvent.removeHandler = function(el, type, handler) { | |
/** @type {null} */ | |
var fHandler = null; | |
var listeners; | |
var j; | |
var subLn; | |
if (el && (el._events && (listeners = el._events[type], listeners))) { | |
/** @type {number} */ | |
j = 0; | |
subLn = listeners.length; | |
for (;j < subLn;j++) { | |
if (listeners[j].handler === handler) { | |
fHandler = listeners[j].browserHandler; | |
break; | |
} | |
} | |
if (el.removeEventListener) { | |
el.removeEventListener(type, fHandler, false); | |
} else { | |
if (el.detachEvent) { | |
el.detachEvent("on" + type, fHandler); | |
} | |
} | |
listeners.splice(j, 1); | |
} | |
}; | |
/** @type {function (?): undefined} */ | |
var $removeVolatileHandlers = Sys.UI.DomEvent.removeVolatile = function(prop) { | |
var a; | |
var n; | |
var a12; | |
if (_volatileElements) { | |
if (a = _volatileElements[prop], a && a.length > 0) { | |
n = a.length; | |
for (;n > 0;n--) { | |
a12 = a[n - 1]; | |
$clearHandlers(a12, false); | |
} | |
} | |
/** @type {null} */ | |
_volatileElements[prop] = null; | |
} | |
}; | |
/** @type {function (Object, ?, ?): undefined} */ | |
var $raiseEvent = Sys.UI.DomEvent.raiseEvent = function(evt, type, payload) { | |
var elements; | |
var _i; | |
var _len; | |
var handler; | |
if (evt && (evt._events && (elements = evt._events[type], elements))) { | |
/** @type {number} */ | |
_i = 0; | |
_len = elements.length; | |
for (;_i < _len;_i++) { | |
if (handler = elements[_i].handler, handler) { | |
handler(this, payload); | |
break; | |
} | |
} | |
} | |
}; | |
Sys.UI.DomElement = {}; | |
/** | |
* @param {Object} e | |
* @return {?} | |
*/ | |
Sys.UI.DomElement._getWindow = function(e) { | |
var iframeDocument = e.ownerDocument || (e.document || e); | |
return iframeDocument.defaultView || iframeDocument.parentWindow; | |
}; | |
/** | |
* @return {?} | |
*/ | |
String.prototype.escapeSelector = function() { | |
return this.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1"); | |
}; | |
/** @type {function (string, HTMLElement): ?} */ | |
$get = Sys.UI.DomElement.getElementById = function(id, opt_locale) { | |
var locale = opt_locale ? opt_locale : document; | |
var sel = "#" + id.escapeSelector(); | |
return $(locale).find(sel)[0]; | |
}; | |
/** @type {function (string, HTMLElement, string): ?} */ | |
$getElementsByClassName = Sys.UI.DomElement.getElementsByClassName = function(className, oParent, t) { | |
var self; | |
/** @type {Array} */ | |
var assigns = []; | |
var node = oParent ? oParent : document; | |
return t || (t = "*"), self = $(node).find("." + className).filter(t), $.map(self, function(vvar) { | |
assigns.push(vvar); | |
}), assigns; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
Sys.EventHandlerList = function() { | |
this._list = {}; | |
}; | |
Sys.EventHandlerList.prototype = { | |
/** | |
* @param {string} name | |
* @param {Function} v02 | |
* @return {undefined} | |
*/ | |
addHandler : function(name, v02) { | |
Array.add(this._getEvent(name, true), v02); | |
}, | |
/** | |
* @param {Object} element | |
* @param {string} fn | |
* @return {undefined} | |
*/ | |
removeHandler : function(element, fn) { | |
var id = this._getEvent(element); | |
if (id) { | |
Array.remove(id, fn); | |
} | |
}, | |
/** | |
* @param {string} type | |
* @return {?} | |
*/ | |
getHandler : function(type) { | |
var node = this._getEvent(type); | |
return!node || node.length === 0 ? null : (node = Array.clone(node), function(att, v) { | |
/** @type {number} */ | |
var setAttribute = 0; | |
var pn = node.length; | |
for (;setAttribute < pn;setAttribute++) { | |
if (node[setAttribute]) { | |
node[setAttribute](att, v); | |
} | |
} | |
}); | |
}, | |
/** | |
* @param {string} index | |
* @param {boolean} dataAndEvents | |
* @return {?} | |
*/ | |
_getEvent : function(index, dataAndEvents) { | |
if (!this._list[index]) { | |
if (!dataAndEvents) { | |
return null; | |
} | |
/** @type {Array} */ | |
this._list[index] = []; | |
} | |
return this._list[index]; | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
Sys._Application = function() { | |
this._domReady(); | |
this._unloadHandlerDelegate = Function.createDelegate(this, this._unloadHandler); | |
Sys.UI.DomEvent.addHandler(window, "unload", this._unloadHandlerDelegate); | |
}; | |
Sys._Application.prototype = { | |
_initialized : false, | |
_disposing : false, | |
_enableHistory : false, | |
_historyInitialized : false, | |
_ignoreIFrame : false, | |
_state : {}, | |
_historyPointIsNew : false, | |
_currentEntry : "", | |
_historyFrame : null, | |
_timerHandler : null, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
add_init : function(a) { | |
if (this._initialized) { | |
a(this, null); | |
} else { | |
this.get_events().addHandler("init", a); | |
} | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
add_load : function(a) { | |
this.get_events().addHandler("load", a); | |
}, | |
/** | |
* @param {string} fn | |
* @return {undefined} | |
*/ | |
remove_load : function(fn) { | |
this.get_events().removeHandler("load", fn); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
add_unload : function(a) { | |
this.get_events().addHandler("unload", a); | |
}, | |
/** | |
* @return {?} | |
*/ | |
get_events : function() { | |
return this._events || (this._events = new Sys.EventHandlerList), this._events; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
dispose : function() { | |
if (!this._disposing) { | |
/** @type {boolean} */ | |
this._disposing = true; | |
if (window.pageUnload) { | |
window.pageUnload(this, null); | |
} | |
var disposer = this.get_events().getHandler("unload"); | |
if (disposer) { | |
disposer(this, null); | |
} | |
Sys.UI.DomEvent.removeHandler(window, "unload", this._unloadHandlerDelegate); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
_domReady : function() { | |
/** | |
* @return {undefined} | |
*/ | |
function success() { | |
dataset.initialize(); | |
} | |
var fn; | |
var dataset = this; | |
/** @type {HTMLDocument} */ | |
var doc = document; | |
var result; | |
var tempNode; | |
if (doc.addEventListener) { | |
try { | |
doc.addEventListener("DOMContentLoaded", fn = function() { | |
doc.removeEventListener("DOMContentLoaded", fn, false); | |
success(); | |
}, false); | |
} catch (e) { | |
} | |
} else { | |
if (doc.attachEvent) { | |
if (window == window.top && doc.documentElement.doScroll) { | |
/** @type {Element} */ | |
tempNode = doc.createElement("div"); | |
/** | |
* @return {undefined} | |
*/ | |
fn = function() { | |
try { | |
tempNode.doScroll("left"); | |
} catch (n) { | |
/** @type {number} */ | |
result = window.setTimeout(fn, 0); | |
return; | |
} | |
/** @type {null} */ | |
tempNode = null; | |
success(); | |
}; | |
fn(); | |
} else { | |
doc.attachEvent("onreadystatechange", fn = function() { | |
if (doc.readyState === "complete") { | |
doc.detachEvent("onreadystatechange", fn); | |
success(); | |
} | |
}); | |
} | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
_unloadHandler : function() { | |
this.dispose(); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
_raiseInit : function() { | |
var dereg = this.get_events().getHandler("init"); | |
if (dereg) { | |
dereg(this, null); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
initialize : function() { | |
if (!this._initialized && !this._disposing) { | |
if (this._initialized = true, this._raiseInit(), this.get_stateString) { | |
var dir = this.get_stateString(); | |
if (dir !== this._currentEntry) { | |
this._navigate(dir); | |
} else { | |
this._ensureHistory(); | |
} | |
} | |
this.raiseLoad(); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
raiseLoad : function() { | |
var results = this.get_events().getHandler("load"); | |
/** @type {boolean} */ | |
this._loaded = true; | |
if (results) { | |
results(this, null); | |
} | |
if (window.pageLoad) { | |
window.pageLoad(this, null); | |
} | |
} | |
}; | |
/** | |
* @param {number} state | |
* @return {undefined} | |
*/ | |
Sys.HistoryEventArgs = function(state) { | |
/** @type {number} */ | |
this._state = state; | |
/** | |
* @return {?} | |
*/ | |
this.get_state = function() { | |
return this._state; | |
}; | |
}; | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
Sys._Application.prototype.add_navigate = function(a) { | |
this.get_events().addHandler("navigate", a); | |
}; | |
/** | |
* @param {?} dir | |
* @return {undefined} | |
*/ | |
Sys._Application.prototype._onIFrameLoad = function(dir) { | |
this._ensureHistory(); | |
if (!this._ignoreIFrame) { | |
/** @type {boolean} */ | |
this._historyPointIsNew = false; | |
this._navigate(dir); | |
} | |
/** @type {boolean} */ | |
this._ignoreIFrame = false; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
window.onhashchange = function() { | |
var dir = Sys.Application.get_stateString(); | |
if (dir == "!financials" || dir == "!Financials") { | |
window.FinancialsNavController.show(Sys.Application._currentEntry); | |
return; | |
} | |
if (dir !== Sys.Application._currentEntry) { | |
if (!Sys.Application._ignoreTimer) { | |
if (Sys.Application._currentEntry == "!financials" || Sys.Application._currentEntry == "!Financials") { | |
$("#prlnk").find("li > a").removeClass("selected"); | |
window.FinancialsNavController.backButtonReset(); | |
} | |
/** @type {boolean} */ | |
Sys.Application._historyPointIsNew = false; | |
Sys.Application._navigate(dir); | |
} | |
} | |
}; | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
Sys._Application.prototype.set_enableHistory = function(dataAndEvents) { | |
this._enableHistory = dataAndEvents; | |
}; | |
/** | |
* @param {?} dataAndEvents | |
* @param {string} isXML | |
* @return {undefined} | |
*/ | |
Sys._Application.prototype.addHistoryPoint = function(dataAndEvents, isXML) { | |
if (!this._enableHistory) { | |
throw "History disabled"; | |
} | |
this._ensureHistory(); | |
var rvar = dataAndEvents; | |
/** @type {boolean} */ | |
this._historyPointIsNew = true; | |
this._setState(rvar, isXML); | |
this._raiseNavigate(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
Sys._Application.prototype._ensureHistory = function() { | |
if (!this._historyInitialized && this._enableHistory) { | |
try { | |
this._initialState = this.get_stateString(); | |
} catch (n) { | |
} | |
/** @type {boolean} */ | |
this._historyInitialized = true; | |
} | |
}; | |
/** | |
* @param {?} dir | |
* @return {undefined} | |
*/ | |
Sys._Application.prototype._navigate = function(dir) { | |
this._ensureHistory(); | |
var state = dir; | |
this._setState(dir); | |
this._state = state; | |
this._raiseNavigate(); | |
}; | |
/** | |
* @param {string} name | |
* @param {string} value | |
* @return {undefined} | |
*/ | |
Sys._Application.prototype._setState = function(name, value) { | |
var url; | |
var i; | |
var doc; | |
var currentModule; | |
if (this._enableHistory) { | |
name = name || ""; | |
if (name !== this._currentEntry) { | |
if (window.theForm) { | |
url = window.theForm.action; | |
i = url.indexOf("#"); | |
/** @type {string} */ | |
window.theForm.action = (i !== -1 ? url.substring(0, i) : url) + "#" + name; | |
} | |
if (this._historyFrame) { | |
if (this._historyPointIsNew) { | |
/** @type {string} */ | |
name = unescape(name); | |
/** @type {boolean} */ | |
this._ignoreIFrame = true; | |
doc = this._historyFrame.contentWindow.document; | |
doc.open("javascript:'<html></html>'"); | |
doc.write("<html><head><title>" + (value || document.title) + '</title><script type="text/javascript">parent.Sys.Application._onIFrameLoad( \'' + escape(name) + "' );\x3c/script></head><body></body></html>"); | |
doc.close(); | |
} | |
} | |
/** @type {boolean} */ | |
this._ignoreTimer = false; | |
/** @type {string} */ | |
this._currentEntry = name; | |
if (this._historyFrame || this._historyPointIsNew) { | |
currentModule = this.get_stateString(); | |
if (name !== currentModule) { | |
/** @type {string} */ | |
window.location.hash = name; | |
this._currentEntry = this.get_stateString(); | |
if (typeof value != "undefined") { | |
if (value !== null) { | |
if (document.title == "") { | |
/** @type {string} */ | |
document.title = value; | |
} | |
} | |
} | |
} | |
} | |
/** @type {boolean} */ | |
this._historyPointIsNew = false; | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
Sys._Application.prototype.get_stateString = function() { | |
var url; | |
var loc; | |
var index; | |
return Sys.Browser.agent === Sys.Browser.Firefox ? (loc = window.location.href, index = loc.indexOf("#"), index !== -1 ? loc.substring(index + 1) : "") : (url = window.location.hash, url.length > 0 && (url.charAt(0) === "#" && (url = url.substring(1))), url); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
Sys._Application.prototype._raiseNavigate = function() { | |
var _historyPointIsNew = this._historyPointIsNew; | |
var callback = this.get_events().getHandler("navigate"); | |
var bodyLen = this._state; | |
var body = new Sys.HistoryEventArgs(bodyLen); | |
if (callback && callback(this, body), !_historyPointIsNew) { | |
try { | |
if (Sys.Browser.agent === Sys.Browser.Firefox) { | |
if (window.location.hash) { | |
if (!window.frameElement || window.top.location.hash) { | |
if (Sys.Browser.version < 3.5) { | |
window.history.go(0); | |
} else { | |
location.hash = this.get_stateString(); | |
} | |
} | |
} | |
} | |
} catch (u) { | |
} | |
} | |
}; | |
Sys.Application = new Sys._Application; | |
Type.registerNamespace("b365"); | |
/** | |
* @return {undefined} | |
*/ | |
b365.Sys = function() { | |
/** @type {Array} */ | |
this._eleList = []; | |
/** @type {number} */ | |
this._eleList.A = 0; | |
/** @type {number} */ | |
this._eleList.INPUT = 1; | |
/** @type {number} */ | |
this._eleList.SELECT = 2; | |
/** | |
* @param {number} value | |
* @param {number} maxHeight | |
* @param {number} minHeight | |
* @param {number} force | |
* @return {?} | |
*/ | |
this._filter = function(value, maxHeight, minHeight, force) { | |
var height = value ? value : 0; | |
return height = force ? maxHeight && height < maxHeight ? maxHeight : height : maxHeight && height > maxHeight || !height ? maxHeight : height, force ? minHeight && height < minHeight ? minHeight : height : minHeight && height > minHeight || !height ? minHeight : height; | |
}; | |
}; | |
b365.Sys.prototype = { | |
/** | |
* @param {Node} n | |
* @param {string} name | |
* @param {string} deepDataAndEvents | |
* @return {?} | |
*/ | |
getEleSib : function(n, name, deepDataAndEvents) { | |
var elem = name == "n" ? n.nextSibling : n.previousSibling; | |
for (;elem != null && (elem.nodeType != 1 || deepDataAndEvents && !$hasCls(elem, deepDataAndEvents));) { | |
elem = name == "n" ? elem.nextSibling : elem.previousSibling; | |
} | |
return elem != null && (elem.nodeType != 1 && (elem = null)), elem; | |
}, | |
/** | |
* @param {Node} elem | |
* @param {?} isXML | |
* @param {string} deepDataAndEvents | |
* @param {number} append | |
* @return {?} | |
*/ | |
getPTag : function(elem, isXML, deepDataAndEvents, append) { | |
if (append = typeof append == "undefined" || append == null ? 0 : append + 1, !elem) { | |
return null; | |
} | |
if (isXML == null || elem.tagName == isXML) { | |
if (deepDataAndEvents) { | |
if (elem.className != null && elem.className.indexOf(deepDataAndEvents) >= 0) { | |
return elem; | |
} | |
} else { | |
return elem; | |
} | |
} | |
return append > 10 ? null : this.getPTag(elem.parentNode, isXML, deepDataAndEvents, append); | |
}, | |
/** | |
* @param {Node} el | |
* @param {?} tag | |
* @param {?} name | |
* @return {?} | |
*/ | |
getCTag : function(el, tag, name) { | |
var node; | |
var element; | |
for (;el && el.nodeType === 3;) { | |
el = el.nextSibling; | |
} | |
return!el || el.tagName == tag && (!name || el.className.indexOf(name) >= 0) ? el : (node = this.getCTag(el.firstChild, tag, name), node && (node.tagName == tag && (!name || node.className.indexOf(name) >= 0))) ? node : (element = this.getCTag(el.nextSibling, tag, name), element && (element.tagName == tag && (!name || element.className.indexOf(name) >= 0))) ? element : null; | |
}, | |
/** | |
* @param {Object} v | |
* @param {Object} d | |
* @param {Object} el | |
* @return {?} | |
*/ | |
getParIDTag : function(v, d, el) { | |
var codeSegments; | |
var i; | |
var nv; | |
if (v && (d && (el && (codeSegments = d.getElementsByTagName(el), codeSegments && codeSegments.length > 0)))) { | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (nv = codeSegments[i].getAttribute("id"), nv && nv.startsWith(v)) { | |
return codeSegments[i]; | |
} | |
} | |
} | |
return undefined; | |
}, | |
/** | |
* @param {Object} p | |
* @param {string} path | |
* @param {?} name | |
* @return {?} | |
*/ | |
getParIDPTag : function(p, path, name) { | |
if (typeof p != "undefined") { | |
for (;p != null;) { | |
if (p.id && (name && (p.tagName == name && p.id.startsWith(path)) || p.id.startsWith(path))) { | |
break; | |
} | |
p = p.parentNode; | |
} | |
return p; | |
} | |
return undefined; | |
}, | |
/** | |
* @param {string} arg | |
* @return {?} | |
*/ | |
getMediaType : function(arg) { | |
var option = this.getPTag(arg, null, "MTsrc", null); | |
/** @type {string} */ | |
var optsData = ""; | |
return option && (option.getAttribute("data-mt") && (optsData = option.getAttribute("data-mt"))), optsData; | |
}, | |
/** | |
* @param {Element} d | |
* @param {string} a | |
* @param {?} b | |
* @return {?} | |
*/ | |
getItemIdSuffix : function(d, a, b) { | |
return d = this.getParIDPTag(d, a, b), d ? d.id.substring(a.length) : -1; | |
}, | |
/** | |
* @param {?} node | |
* @param {string} el | |
* @param {string} i | |
* @return {?} | |
*/ | |
firstChild : function(node, el, i) { | |
var out = $(node).find("*").not("[type=text]"); | |
return typeof el != "undefined" && (el !== "" && (out = out.filter(el))), typeof i != "undefined" && (i !== "" && (out = out.filter("." + i))), out.first()[0]; | |
}, | |
/** | |
* @param {Object} parent | |
* @return {?} | |
*/ | |
parentNode : function(parent) { | |
parent = parent.parentNode; | |
for (;parent != null && parent.nodeType === 3;) { | |
parent = parent.parentNode; | |
} | |
return parent; | |
}, | |
/** | |
* @param {Element} obj | |
* @return {undefined} | |
*/ | |
toggleElement : function(obj) { | |
if (typeof obj != "undefined") { | |
if (obj != null) { | |
if (obj.className.indexOf("hidden", 0) == -1) { | |
/** @type {string} */ | |
obj.className = obj.className.length > 0 ? obj.className + " hidden" : "hidden"; | |
/** @type {boolean} */ | |
obj.disabled = true; | |
} else { | |
this.showElement(obj); | |
} | |
} | |
} | |
}, | |
/** | |
* @param {string} value | |
* @param {(Object|string)} className | |
* @return {undefined} | |
*/ | |
addClass : function(value, className) { | |
if (typeof value != "undefined") { | |
if (value !== null) { | |
if (!RegExp("\\b" + className + "\\b", "ig").test(value.className)) { | |
value.className += value.className.length > 0 ? " " + className : className; | |
} | |
} | |
} | |
}, | |
/** | |
* @param {string} value | |
* @param {string} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
removeClass : function(value, deepDataAndEvents) { | |
if (typeof value != "undefined") { | |
if (value !== null) { | |
value.className = value.className.replace(RegExp("\\b" + deepDataAndEvents + "\\b", "ig"), "").trim(); | |
} | |
} | |
}, | |
/** | |
* @param {string} value | |
* @param {string} deepDataAndEvents | |
* @param {(Object|string)} className | |
* @return {undefined} | |
*/ | |
swapClass : function(value, deepDataAndEvents, className) { | |
this.removeClass(value, deepDataAndEvents); | |
this.addClass(value, className); | |
}, | |
/** | |
* @param {HTMLElement} obj | |
* @return {?} | |
*/ | |
getOffSets : function(obj) { | |
var curleft; | |
var curtop; | |
var position; | |
try { | |
if (curleft = obj.offsetLeft, curtop = obj.offsetTop, obj.offsetParent) { | |
/** @type {string} */ | |
position = "static"; | |
if (window.getComputedStyle) { | |
/** @type {string} */ | |
position = window.getComputedStyle(obj.offsetParent, null).getPropertyValue("position"); | |
} else { | |
if (obj.currentStyle) { | |
position = obj.currentStyle.position; | |
} | |
} | |
for (;obj.offsetParent && (position != "fixed" && position != "absolute");) { | |
obj = obj.offsetParent; | |
if (obj) { | |
curleft += obj.offsetLeft; | |
curtop += obj.offsetTop; | |
} | |
} | |
} | |
return[curleft, curtop]; | |
} catch (u) { | |
return null; | |
} | |
}, | |
/** | |
* @param {HTMLElement} b | |
* @param {?} x | |
* @param {?} hitY | |
* @return {?} | |
*/ | |
hitTest : function(b, x, hitY) { | |
var offsets = this.getOffSets(b); | |
return offsets ? x >= offsets[0] && (x <= offsets[0] + b.clientWidth && (hitY >= offsets[1] && hitY <= offsets[1] + b.clientHeight)) : false; | |
}, | |
/** | |
* @param {Element} d | |
* @param {number} force | |
* @return {?} | |
*/ | |
getEleW : function(d, force) { | |
return this._filter(d.innerWidth ? d.innerWidth : 0, d.clientWidth ? d.clientWidth : 0, d.scrollWidth ? d.scrollWidth : 0, force); | |
}, | |
/** | |
* @param {Object} div | |
* @param {number} force | |
* @return {?} | |
*/ | |
getEleH : function(div, force) { | |
return this._filter(div.innerHeight ? div.innerHeight : 0, div.clientHeight ? div.clientHeight : 0, div.scrollHeight ? div.scrollHeight : 0, force); | |
}, | |
/** | |
* @return {?} | |
*/ | |
getWH : function() { | |
return this._filter(window.innerHeight ? window.innerHeight : 0, document.documentElement ? document.documentElement.clientHeight : 0, document.body ? document.body.clientHeight : 0); | |
}, | |
/** | |
* @return {?} | |
*/ | |
getWSL : function() { | |
return this._filter(window.pageXOffset ? window.pageXOffset : 0, document.documentElement ? document.documentElement.scrollLeft : 0, document.body ? document.body.scrollLeft : 0); | |
}, | |
/** | |
* @return {?} | |
*/ | |
getWST : function() { | |
return this._filter(window.pageYOffset ? window.pageYOffset : 0, document.documentElement ? document.documentElement.scrollTop : 0, document.body ? document.body.scrollTop : 0); | |
}, | |
/** | |
* @param {Event} e | |
* @return {?} | |
*/ | |
mouseX : function(e) { | |
/** @type {null} */ | |
var posx = null; | |
return e.pageX ? posx = e.pageX : e.clientX && (posx = e.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft)), posx; | |
}, | |
/** | |
* @param {Event} event | |
* @return {?} | |
*/ | |
mouseY : function(event) { | |
/** @type {null} */ | |
var lastMouseY = null; | |
return event.pageY ? lastMouseY = event.pageY : event.clientY && (lastMouseY = event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop)), lastMouseY; | |
}, | |
/** | |
* @param {Element} el | |
* @return {?} | |
*/ | |
showElement : function(el) { | |
return el != null ? (el.className.indexOf("hidden", 0) != -1 && (el.className = el.className.replace(/hidden/i, ""), el.className = el.className.trim()), el.disabled = false, el.removeAttribute("disabled"), true) : false; | |
}, | |
/** | |
* @param {Element} el | |
* @return {?} | |
*/ | |
hideElement : function(el) { | |
return el != null ? (el.className.indexOf("hidden", 0) == -1 && (el.className += " hidden"), el.setAttribute("disabled", "true"), el.disabled = true, true) : false; | |
}, | |
/** | |
* @param {string} node | |
* @param {string} src | |
* @param {string} path | |
* @return {undefined} | |
*/ | |
setValueInCookie : function(node, src, path) { | |
/** @type {boolean} */ | |
var f = arguments.length == 3 || arguments.length == 4 && arguments[3] == true ? true : false; | |
var result = this.getValueFromCookie(node, "", ""); | |
var e; | |
var codeSegments; | |
var i; | |
if (path = unescape(path), result != "") { | |
if (src != "") { | |
/** @type {boolean} */ | |
e = false; | |
codeSegments = result.split("&"); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (codeSegments[i].startsWith(src + "=")) { | |
/** @type {string} */ | |
codeSegments[i] = src + "=" + escape(path) + (!f || path.endsWith("||") ? "" : "||"); | |
/** @type {boolean} */ | |
e = true; | |
break; | |
} | |
} | |
if (!e) { | |
if (!(path == "")) { | |
codeSegments.push(src + "=" + escape(path) + (!f || path.endsWith("||") ? "" : "||")); | |
} | |
} | |
/** @type {string} */ | |
path = ""; | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
path += codeSegments[i] == "" ? "" : codeSegments[i] + "&"; | |
} | |
} | |
} else { | |
if (src != "") { | |
/** @type {string} */ | |
path = src + "=" + escape(path) + (!f || path.endsWith("||") ? "" : "||"); | |
} | |
} | |
/** @type {string} */ | |
document.cookie = node + "=" + path.replace(/\$amp\$/g, "&").replace(/\$quot\$/g, """).replace(/\$lt\$/g, "<").replace(/\$gt\$/g, ">") + ";path=/"; | |
}, | |
/** | |
* @param {string} condition | |
* @param {string} tokens | |
* @param {string} newPath | |
* @return {undefined} | |
*/ | |
setValueInCookieOnlyIfNotEmpty : function(condition, tokens, newPath) { | |
if (condition != "") { | |
if (newPath != "") { | |
this.setValueInCookie(condition, tokens, newPath, false); | |
} | |
} | |
}, | |
/** | |
* @param {string} dataAndEvents | |
* @param {string} bytes | |
* @param {string} val | |
* @return {?} | |
*/ | |
getValueFromCookie : function(dataAndEvents, bytes, val) { | |
var str = typeof val != "undefined" ? val : ""; | |
/** @type {Array.<string>} */ | |
var a = unescape(document.cookie).split(";"); | |
var value = typeof val != "undefined" ? val : ""; | |
/** @type {boolean} */ | |
var h = false; | |
var length; | |
var expr; | |
var codeSegments; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < a.length;i++) { | |
if (length = a[i].indexOf("=") == -1 ? a[i].length - 1 : a[i].indexOf("="), expr = a[i].substr(0, length).replace(/^\s+|\s+$/g, ""), expr == dataAndEvents) { | |
/** @type {boolean} */ | |
h = true; | |
/** @type {string} */ | |
str = a[i].substr(length + 1).replace(/^\s+|\s+$/g, ""); | |
break; | |
} | |
} | |
if (str = String(str).replace(/&/g, "$amp$").replace(/"/g, "$quot$").replace(/</g, "$lt$").replace(/>/g, "$gt$"), h) { | |
if (bytes.length > 0) { | |
/** @type {Array.<string>} */ | |
codeSegments = str.split("&"); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (codeSegments[i].startsWith(bytes + "=")) { | |
/** @type {string} */ | |
value = codeSegments[i].substring(bytes.length + 1); | |
break; | |
} | |
} | |
} else { | |
/** @type {string} */ | |
value = str; | |
} | |
} | |
return String(value).replace(/\$amp\$/g, "&").replace(/\$quot\$/g, """).replace(/\$lt\$/g, "<").replace(/\$gt\$/g, ">"); | |
}, | |
/** | |
* @param {string} deepDataAndEvents | |
* @return {?} | |
*/ | |
readCookie : function(deepDataAndEvents) { | |
/** @type {string} */ | |
var cookieName = deepDataAndEvents + "="; | |
/** @type {Array.<string>} */ | |
var codeSegments = document.cookie.split(";"); | |
var c; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < codeSegments.length;i++) { | |
/** @type {string} */ | |
c = codeSegments[i]; | |
for (;c.charAt(0) == " ";) { | |
/** @type {string} */ | |
c = c.substring(1, c.length); | |
} | |
if (c.indexOf(cookieName) == 0) { | |
return c.substring(cookieName.length, c.length); | |
} | |
} | |
return null; | |
}, | |
/** | |
* @param {string} deepDataAndEvents | |
* @param {string} messageFormat | |
* @return {undefined} | |
*/ | |
setCookieValue : function(deepDataAndEvents, messageFormat) { | |
/** @type {string} */ | |
document.cookie = deepDataAndEvents + "=" + messageFormat.replace(/\$amp\$/g, "&").replace(/\$quot\$/g, """).replace(/\$lt\$/g, "<").replace(/\$gt\$/g, ">") + ";path=/"; | |
}, | |
/** | |
* @param {Element} node | |
* @return {undefined} | |
*/ | |
disableElement : function(node) { | |
if (node.getAttribute("_disabled") === null) { | |
node.setAttribute("_disabled", node.disabled ? String(node.disabled) : "false"); | |
} | |
var href = node.getAttribute("href"); | |
if (href) { | |
node.setAttribute("_href", href); | |
node.removeAttribute("href"); | |
} | |
if (!node.disabled) { | |
if (!(node.getAttribute("_tab") !== null)) { | |
node.setAttribute("_tab", node.tabIndex); | |
node.setAttribute("tabIndex", "-1"); | |
} | |
} | |
if (!(node.tagName == "A")) { | |
if (!(node.id.indexOf("UName") != -1)) { | |
if (!(node.id.indexOf("PWord") != -1)) { | |
if (!$(node).hasClass("lotto")) { | |
/** @type {boolean} */ | |
node.disabled = true; | |
node.setAttribute("disabled", "disabled"); | |
} | |
} | |
} | |
} | |
}, | |
/** | |
* @param {Element} el | |
* @return {undefined} | |
*/ | |
enableElement : function(el) { | |
var data = el.getAttribute("_disabled"); | |
if (data) { | |
if (data === "false") { | |
/** @type {boolean} */ | |
el.disabled = false; | |
el.removeAttribute("disabled"); | |
el.removeAttribute("_disabled"); | |
if (el.getAttribute("_href")) { | |
el.setAttribute("href", el.getAttribute("_href")); | |
el.removeAttribute("_href"); | |
} | |
if (el.getAttribute("_tab") !== null) { | |
el.tabIndex = el.getAttribute("_tab"); | |
el.removeAttribute("_tab"); | |
} | |
} | |
} | |
}, | |
/** | |
* @param {Element} startNode | |
* @return {undefined} | |
*/ | |
disableGroup : function(startNode) { | |
var codeSegments; | |
var i; | |
if (this._eleList && this._eleList.length > 0) { | |
codeSegments = startNode.getElementsByTagName("*"); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (typeof this._eleList[codeSegments[i].tagName] != "undefined") { | |
this.disableElement(codeSegments[i]); | |
} | |
} | |
if (typeof this._eleList[startNode.tagName] != "undefined") { | |
this.disableElement(startNode); | |
} | |
} | |
}, | |
/** | |
* @param {Element} sourceEl | |
* @return {undefined} | |
*/ | |
enableGroup : function(sourceEl) { | |
var codeSegments; | |
var i; | |
if (this._eleList && this._eleList.length > 0) { | |
codeSegments = sourceEl.getElementsByTagName("*"); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (typeof this._eleList[codeSegments[i].tagName] != "undefined") { | |
this.enableElement(codeSegments[i]); | |
} | |
} | |
if (typeof this._eleList[sourceEl.tagName] != "undefined") { | |
this.enableElement(sourceEl); | |
} | |
} | |
}, | |
/** | |
* @param {boolean} el | |
* @param {string} deepDataAndEvents | |
* @return {?} | |
*/ | |
hasCls : function(el, deepDataAndEvents) { | |
return el && (el.className.length > 0 && el.className.indexOf(deepDataAndEvents) > -1); | |
}, | |
/** | |
* @param {Array} obj | |
* @return {?} | |
*/ | |
deepCopy : function(obj) { | |
var c; | |
var key; | |
if (Object.prototype.toString.call(obj) === "[object Array]" || Object.prototype.toString.call(obj) === "[object Arguments]") { | |
/** @type {Array} */ | |
var copy = []; | |
/** @type {number} */ | |
var i = 0; | |
var l = obj.length; | |
for (;i < l;i++) { | |
copy[i] = this.deepCopy(obj[i]); | |
} | |
return copy; | |
} | |
if (typeof obj == "object") { | |
c = {}; | |
for (key in obj) { | |
c[key] = this.deepCopy(obj[key]); | |
} | |
return c; | |
} | |
return obj; | |
}, | |
/** | |
* @param {?} curr | |
* @return {?} | |
*/ | |
getZIdx : function(curr) { | |
return parseInt($(curr).css("z-index")) || 0; | |
} | |
}; | |
var $bSys = new b365.Sys; | |
/** | |
* @param {Node} timestep | |
* @param {string} deepDataAndEvents | |
* @return {?} | |
*/ | |
var $getNES = function(timestep, deepDataAndEvents) { | |
return $bSys.getEleSib(timestep, "n", deepDataAndEvents); | |
}; | |
/** | |
* @param {Node} timestep | |
* @param {string} deepDataAndEvents | |
* @return {?} | |
*/ | |
var $getPES = function(timestep, deepDataAndEvents) { | |
return $bSys.getEleSib(timestep, "p", deepDataAndEvents); | |
}; | |
/** | |
* @param {Node} classNames | |
* @param {?} isXML | |
* @param {string} deepDataAndEvents | |
* @return {?} | |
*/ | |
var $getPTag = function(classNames, isXML, deepDataAndEvents) { | |
return $bSys.getPTag(classNames, isXML, deepDataAndEvents); | |
}; | |
/** | |
* @param {Node} failures | |
* @param {?} chars | |
* @param {?} optgroup | |
* @return {?} | |
*/ | |
var $getCTag = function(failures, chars, optgroup) { | |
return $bSys.getCTag(failures, chars, optgroup); | |
}; | |
/** | |
* @param {Object} ox | |
* @param {Object} dateTime | |
* @param {Object} failures | |
* @return {?} | |
*/ | |
var $getParIDTag = function(ox, dateTime, failures) { | |
return $bSys.getParIDTag(ox, dateTime, failures); | |
}; | |
/** | |
* @param {Object} cmd | |
* @param {string} resolved | |
* @param {?} optgroup | |
* @return {?} | |
*/ | |
var $getParIDPTag = function(cmd, resolved, optgroup) { | |
return $bSys.getParIDPTag(cmd, resolved, optgroup); | |
}; | |
/** | |
* @param {string} until | |
* @return {?} | |
*/ | |
var $getMT = function(until) { | |
return $bSys.getMediaType(until); | |
}; | |
/** | |
* @param {Element} dateTime | |
* @param {string} defs | |
* @param {?} _super | |
* @return {?} | |
*/ | |
var $getItemIdSuffix = function(dateTime, defs, _super) { | |
return $bSys.getItemIdSuffix(dateTime, defs, _super); | |
}; | |
/** | |
* @param {?} domNode | |
* @param {string} failures | |
* @param {string} dataName | |
* @return {?} | |
*/ | |
var $firstChild = function(domNode, failures, dataName) { | |
return $bSys.firstChild(domNode, failures, dataName); | |
}; | |
/** | |
* @param {Object} _super | |
* @return {?} | |
*/ | |
var $parentNode = function(_super) { | |
return $bSys.parentNode(_super); | |
}; | |
/** | |
* @param {Element} walkers | |
* @return {?} | |
*/ | |
var $tglEle = function(walkers) { | |
return $bSys.toggleElement(walkers); | |
}; | |
/** | |
* @param {Element} el | |
* @return {?} | |
*/ | |
var $showEle = function(el) { | |
return $bSys.showElement(el); | |
}; | |
/** | |
* @param {string} isXML | |
* @param {(Object|string)} classToAdd | |
* @return {?} | |
*/ | |
var $addCls = function(isXML, classToAdd) { | |
return $bSys.addClass(isXML, classToAdd); | |
}; | |
/** | |
* @param {string} isXML | |
* @param {string} deepDataAndEvents | |
* @return {?} | |
*/ | |
var $remCls = function(isXML, deepDataAndEvents) { | |
return $bSys.removeClass(isXML, deepDataAndEvents); | |
}; | |
/** | |
* @param {string} isXML | |
* @param {string} deepDataAndEvents | |
* @param {(Object|string)} classToRemove | |
* @return {?} | |
*/ | |
var $swpCls = function(isXML, deepDataAndEvents, classToRemove) { | |
return $bSys.swapClass(isXML, deepDataAndEvents, classToRemove); | |
}; | |
/** | |
* @param {Element} failures | |
* @return {?} | |
*/ | |
var $hideEle = function(failures) { | |
return $bSys.hideElement(failures); | |
}; | |
/** | |
* @param {boolean} el | |
* @param {string} deepDataAndEvents | |
* @return {?} | |
*/ | |
var $hasCls = function(el, deepDataAndEvents) { | |
return $bSys.hasCls(el, deepDataAndEvents); | |
}; | |
/** | |
* @param {Object} walkers | |
* @return {?} | |
*/ | |
var $deepCopy = function(walkers) { | |
return $bSys.deepCopy(walkers); | |
}; | |
/** | |
* @param {?} curr | |
* @return {?} | |
*/ | |
var $getZIndex = function(curr) { | |
return $bSys.getZIdx(curr); | |
}; | |
/** | |
* @param {string} name | |
* @return {undefined} | |
*/ | |
var $removeEvilTwin = function(name) { | |
var tagName; | |
var els; | |
var j; | |
var el; | |
name = name.toLowerCase(); | |
/** @type {string} */ | |
var input = "/liquid_style.css"; | |
/** @type {string} */ | |
var exclude = "/style.css"; | |
/** @type {string} */ | |
var label = "matchlive/liquid_basic.css"; | |
/** @type {string} */ | |
var dep = "matchlive/basic.css"; | |
if (name.indexOf(label) != -1 || (name.indexOf(dep) != -1 || (name.indexOf(input) != -1 || name.indexOf(exclude) != -1))) { | |
if (tagName = dep, name.indexOf(dep) != -1 && (tagName = label), name.indexOf(input) != -1 && (tagName = input), name.indexOf(exclude) != -1 && (tagName = exclude), els = document.getElementsByTagName("link"), els && els.length > 0) { | |
/** @type {number} */ | |
j = 0; | |
for (;j < els.length;j++) { | |
if (els[j].href.toString().indexOf(tagName) != -1) { | |
el = els[j]; | |
el.parentNode.removeChild(el); | |
} | |
} | |
} | |
return; | |
} | |
}; | |
/** | |
* @param {string} name | |
* @param {?} $sanitize | |
* @return {undefined} | |
*/ | |
var $loadCSS = function(name, $sanitize) { | |
var _head; | |
var codeSegments; | |
var i; | |
var link; | |
var sheet; | |
var cssRules; | |
if ($removeEvilTwin(name), _head = document.getElementsByTagName("head")[0], codeSegments = document.getElementsByTagName("link"), codeSegments && codeSegments.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (codeSegments[i].href.indexOf(name) >= 0) { | |
if ($sanitize) { | |
$sanitize(); | |
} | |
return; | |
} | |
} | |
} | |
/** @type {Element} */ | |
link = document.createElement("link"); | |
link.setAttribute("href", name); | |
link.setAttribute("rel", "stylesheet"); | |
link.setAttribute("type", "text/css"); | |
if ("sheet" in link) { | |
/** @type {string} */ | |
sheet = "sheet"; | |
/** @type {string} */ | |
cssRules = "cssRules"; | |
} else { | |
/** @type {string} */ | |
sheet = "styleSheet"; | |
/** @type {string} */ | |
cssRules = "rules"; | |
} | |
/** @type {boolean} */ | |
var opt_trailingChars = navigator.userAgent.lastIndexOf("Safari/") > 0; | |
/** @type {number} */ | |
var chars = document.styleSheets.length; | |
/** @type {number} */ | |
var poll = setInterval(function() { | |
try { | |
if (link[sheet] && link[sheet][cssRules].length || opt_trailingChars && document.styleSheets.length > chars) { | |
clearInterval(poll); | |
clearTimeout(to); | |
if ($sanitize) { | |
$sanitize(); | |
} | |
} | |
} catch (n) { | |
} | |
}, 200); | |
/** @type {number} */ | |
var to = setTimeout(function() { | |
clearInterval(poll); | |
clearTimeout(to); | |
_head.removeChild(link); | |
throw "Script load failed"; | |
}, 1E4); | |
_head.appendChild(link); | |
}; | |
/** | |
* @param {?} success | |
* @param {string} e | |
* @param {?} fail | |
* @return {undefined} | |
*/ | |
var $loadScript = function(success, e, fail) { | |
var codeSegments; | |
var script; | |
e = e.trim(); | |
/** @type {string} */ | |
var pdataOld = e; | |
/** | |
* @param {?} msg | |
* @return {undefined} | |
*/ | |
var ok = function(msg) { | |
/** @type {string} */ | |
var fn = $getFN(pdataOld) + "_loaded"; | |
if (typeof window[fn] == "function") { | |
window[fn](msg); | |
} | |
if (fail) { | |
fail(); | |
} | |
}; | |
var head = document.getElementsByTagName("head")[0]; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < 2;i++) { | |
if (codeSegments = i == 0 ? head.getElementsByTagName("script") : document.getElementsByTagName("script"), codeSegments && codeSegments.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (codeSegments[i].src.indexOf(e.startsWith(".") ? e.substring(1) : e) >= 0) { | |
ok(success); | |
return; | |
} | |
} | |
} | |
} | |
/** @type {Element} */ | |
script = document.createElement("script"); | |
script.setAttribute("language", "javascript"); | |
script.setAttribute("type", "text/javascript"); | |
script.setAttribute("src", pdataOld); | |
if (script.addEventListener) { | |
/** | |
* @return {undefined} | |
*/ | |
script.onload = function() { | |
ok(success); | |
}; | |
} else { | |
if (script.readyState) { | |
/** | |
* @return {undefined} | |
*/ | |
script.onreadystatechange = function() { | |
if (script.readyState == "loaded" || script.readyState == "complete") { | |
ok(success); | |
} | |
}; | |
} | |
} | |
head.appendChild(script); | |
}; | |
/** | |
* @param {string} value | |
* @param {string} data | |
* @param {?} $sanitize | |
* @return {undefined} | |
*/ | |
var $setGlobal = function(value, data, $sanitize) { | |
if (typeof window[value] != "function" && typeof data == "string") { | |
try { | |
/** @type {*} */ | |
window[value] = JSON.parse(data); | |
if ($sanitize) { | |
$sanitize(); | |
} | |
} catch (r) { | |
/** @type {null} */ | |
window[value] = null; | |
if ($sanitize) { | |
$sanitize(); | |
} | |
} | |
} | |
}; | |
/** @type {Array} */ | |
var cacheTokens = []; | |
/** | |
* @param {string} pair | |
* @param {?} $sanitize | |
* @return {undefined} | |
*/ | |
var $setCachePolicy = function(pair, $sanitize) { | |
var parts; | |
var i; | |
var part; | |
var parameters = pair.split(","); | |
var p; | |
if (parameters) { | |
/** @type {number} */ | |
p = 0; | |
for (;p < parameters.length;p++) { | |
parts = parameters[p].split("="); | |
i = parts[0].split("."); | |
part = parts[1]; | |
if (!cacheTokens[i[0]]) { | |
/** @type {Array} */ | |
cacheTokens[i[0]] = []; | |
} | |
cacheTokens[i[0]][i[1]] = part; | |
} | |
} | |
if ($sanitize) { | |
$sanitize(); | |
} | |
}; | |
/** | |
* @param {string} value | |
* @return {?} | |
*/ | |
var $getFN = function(value) { | |
var results = value.match(/(.*)[\/\\](\w+)/); | |
return results && results.length >= 3 ? results[2] : ""; | |
}; | |
/** | |
* @param {string} orientation | |
* @param {?} $sanitize | |
* @return {undefined} | |
*/ | |
var $setTitleText = function(orientation, $sanitize) { | |
/** @type {string} */ | |
document.title = orientation; | |
if ($sanitize) { | |
$sanitize(); | |
} | |
}; | |
/** | |
* @param {number} minutes | |
* @return {?} | |
*/ | |
var $formatDatePart = function(minutes) { | |
return minutes < 10 ? "0" + minutes : minutes; | |
}; | |
/** | |
* @param {Date} t2 | |
* @return {?} | |
*/ | |
var $getTimeAsHHMMSS = function(t2) { | |
var type = $formatDatePart(t2.getHours()); | |
var pageX = $formatDatePart(t2.getMinutes()); | |
var r = $formatDatePart(t2.getSeconds()); | |
return type + ":" + pageX + ":" + r; | |
}; | |
/** | |
* @param {Element} elt | |
* @return {?} | |
*/ | |
var $getComputedPadding = function(elt) { | |
var state; | |
var size = $getAppliedStyle(elt); | |
return state = parseInt(size.paddingRight.replace("px", "")) + parseInt(size.paddingLeft.replace("px", "")), isNaN(state) ? 0 : state; | |
}; | |
/** | |
* @param {Element} elm | |
* @return {?} | |
*/ | |
var $getAppliedStyle = function(elm) { | |
return typeof elm.currentStyle != "undefined" ? elm.currentStyle : document.defaultView.getComputedStyle(elm, null); | |
}; | |
/** | |
* @param {Element} node | |
* @param {(Node|string)} dataAndEvents | |
* @return {?} | |
*/ | |
var $getLen = function(node, dataAndEvents) { | |
/** @type {number} */ | |
var w = 0; | |
return dataAndEvents && (w = node.style.width.replace("px", ""), w = isNaN(parseInt(w)) ? 0 : w, w && w != 0 || (w = $getAppliedStyle(node), w = w.width.replace("px", ""), w = isNaN(parseInt(w)) ? 0 : w)), w && w != 0 || (w = node.clientWidth), w && w != 0 || (w = node.innerWidth), w && w != 0 || (w = node.scrollWidth), w; | |
}; | |
Type.registerNamespace("b365.Ui"), function($) { | |
/** | |
* @return {?} | |
*/ | |
$.fn.disableElement = function() { | |
return this.each(function() { | |
if ($(this).attr("_disabled") === undefined) { | |
$(this).attr("_disabled", $(this).prop("disabled") ? $(this).prop("disabled") : "false"); | |
} | |
if ($(this).prop("href")) { | |
$(this).attr("_href", $(this).prop("href")); | |
$(this).removeProp("href"); | |
} | |
if (!$(this).prop("disabled")) { | |
if (!$(this).attr("_tab")) { | |
$(this).attr("_tab", $(this).prop("tabIndex")); | |
$(this).prop("tabIndex", "-1"); | |
} | |
} | |
$(this).prop("disabled", true).addClass("disabled"); | |
}); | |
}; | |
/** | |
* @return {?} | |
*/ | |
$.fn.enableElement = function() { | |
return this.each(function() { | |
if ($(this).removeProp("disabled").removeAttr("disabled").removeAttr("_disabled").removeClass("disabled"), $(this).attr("_href")) { | |
var distanceToUserValue = $(this).html(); | |
$(this).prop("href", $(this).attr("_href")); | |
$(this).removeAttr("_href"); | |
$(this).html(distanceToUserValue); | |
} | |
if ($(this).attr("_tab")) { | |
$(this).prop("tabIndex", $(this).attr("_tab")); | |
$(this).removeAttr("_tab"); | |
} | |
}); | |
}; | |
}(jQuery), function(exports, $) { | |
/** | |
* @param {?} x | |
* @param {?} isControl | |
* @param {?} y | |
* @param {?} row | |
* @param {?} doc | |
* @param {(Date|string)} vx | |
* @param {?} tileInfos | |
* @return {undefined} | |
*/ | |
function Anchor(x, isControl, y, row, doc, vx, tileInfos) { | |
this._dataUrl = x; | |
this._dataEvent = isControl; | |
this._errorEvent = y; | |
/** @type {Arguments} */ | |
this._arguments = arguments; | |
this._timeOut = row; | |
this._timeOutEvent = doc; | |
/** @type {boolean} */ | |
this._cacheRequest = true; | |
if (typeof vx != "undefined") { | |
if (vx !== null) { | |
/** @type {boolean} */ | |
this._cacheRequest = !vx; | |
} | |
} | |
this._reqInstanceId = tileInfos; | |
/** @type {null} */ | |
this._ajaxObject = null; | |
} | |
/** | |
* @param {(Function|string)} type | |
* @return {undefined} | |
*/ | |
Anchor.prototype.Load = function(type) { | |
var self = this; | |
if (!type) { | |
/** @type {string} */ | |
type = "GET"; | |
} | |
self._ajaxObject = $.ajax({ | |
type : type, | |
url : self._dataUrl, | |
cache : self._cacheRequest, | |
timeout : this._timeOut, | |
async : true, | |
/** | |
* @param {?} xhr | |
* @return {undefined} | |
*/ | |
beforeSend : function(xhr) { | |
xhr.overrideMimeType("text/plain"); | |
}, | |
/** | |
* @param {Object} xhr | |
* @param {string} status | |
* @return {undefined} | |
*/ | |
error : function(xhr, status) { | |
if (status === "timeout" && (typeof self._timeOutEvent != "undefined" && self._timeOutEvent !== null)) { | |
self._timeOutEvent(self._reqInstanceId); | |
} else { | |
if (xhr.status != 0) { | |
if (typeof self._errorEvent != "undefined") { | |
if (self._errorEvent !== null) { | |
self._errorEvent(xhr.status, xhr.statusText, self._reqInstanceId); | |
} | |
} | |
} | |
} | |
}, | |
/** | |
* @param {Object} xhr | |
* @return {undefined} | |
*/ | |
complete : function(xhr) { | |
if (xhr.status == 200) { | |
self.OnData(self, xhr.responseText); | |
} | |
} | |
}); | |
}; | |
/** | |
* @param {?} params | |
* @return {undefined} | |
*/ | |
Anchor.prototype.Post = function(params) { | |
var self = this; | |
self._ajaxObject = $.ajax({ | |
type : "POST", | |
url : this._dataUrl, | |
cache : self._cacheRequest, | |
timeout : this._timeOut, | |
data : params, | |
/** | |
* @param {Object} xhr | |
* @return {undefined} | |
*/ | |
beforeSend : function(xhr) { | |
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | |
xhr.setRequestHeader("Content-length", params.length); | |
xhr.setRequestHeader("Connection", "close"); | |
xhr.overrideMimeType("text/plain"); | |
}, | |
/** | |
* @param {Object} xhr | |
* @param {string} status | |
* @return {undefined} | |
*/ | |
error : function(xhr, status) { | |
if (status === "timeout" && (typeof self._timeOutEvent != "undefined" && self._timeOutEvent !== null)) { | |
self._timeOutEvent(self._reqInstanceId); | |
} else { | |
if (xhr.status != 0) { | |
if (typeof self._errorEvent != "undefined") { | |
if (self._errorEvent !== null) { | |
self._errorEvent(xhr.status, xhr.statusText, self._reqInstanceId); | |
} | |
} | |
} | |
} | |
}, | |
/** | |
* @param {Object} xhr | |
* @return {undefined} | |
*/ | |
complete : function(xhr) { | |
if (xhr.status == 200) { | |
self.OnData(self, xhr.responseText); | |
} | |
} | |
}); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
Anchor.prototype.LoadSynchronous = function() { | |
var self = this; | |
self._ajaxObject = $.ajax({ | |
type : "GET", | |
url : this._dataUrl, | |
async : false, | |
timeout : this._timeOut, | |
cache : self._cacheRequest, | |
/** | |
* @param {?} xhr | |
* @return {undefined} | |
*/ | |
beforeSend : function(xhr) { | |
xhr.overrideMimeType("text/plain"); | |
}, | |
/** | |
* @param {Object} xhr | |
* @param {string} status | |
* @return {undefined} | |
*/ | |
error : function(xhr, status) { | |
if (status === "timeout" && (typeof self._timeOutEvent != "undefined" && self._timeOutEvent !== null)) { | |
self._timeOutEvent(self._reqInstanceId); | |
} else { | |
if (xhr.status != 0) { | |
if (typeof self._errorEvent != "undefined") { | |
if (self._errorEvent !== null) { | |
self._errorEvent(xhr.status, xhr.statusText, self._reqInstanceId); | |
} | |
} | |
} | |
} | |
}, | |
/** | |
* @param {Object} xhr | |
* @return {undefined} | |
*/ | |
complete : function(xhr) { | |
if (xhr.status == 200) { | |
self.OnData(self, xhr.responseText); | |
} | |
} | |
}); | |
return; | |
}; | |
/** | |
* @param {?} ar | |
* @param {string} value | |
* @return {undefined} | |
*/ | |
Anchor.prototype.OnData = function(ar, value) { | |
if (value.search(/SERVER_ERROR/) > -1) { | |
ar._arguments[7][ar._arguments[7].length] = ar._arguments[7][0]; | |
ar._arguments[7].length++; | |
/** @type {number} */ | |
ar._arguments[7][0] = 99; | |
value = value.replace(/SERVER_ERROR/, ""); | |
} | |
if (typeof ar._dataEvent != "undefined") { | |
if (ar._dataEvent !== null) { | |
ar._dataEvent(value, ar._arguments); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
Anchor.prototype.Abort = function() { | |
var req = this; | |
if (typeof req._ajaxObject != "undefined") { | |
if (req._ajaxObject != null) { | |
req._ajaxObject.abort(); | |
/** @type {null} */ | |
req._ajaxObject = null; | |
} | |
} | |
}; | |
/** @type {function (?, ?, ?, ?, ?, (Date|string), ?): undefined} */ | |
exports.b365BsAJAX = Anchor; | |
}(window, jQuery); | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.BetSlipLib = function() { | |
/** @type {string} */ | |
this._alwaysInclude = "*~"; | |
}; | |
b365.Ui.BetSlipLib.prototype = { | |
/** | |
* @param {Array} codeSegments | |
* @param {string} prop | |
* @return {?} | |
*/ | |
calcTotalStake : function(codeSegments, prop) { | |
/** @type {number} */ | |
var register = 0; | |
/** @type {number} */ | |
var n = 0; | |
var guard; | |
var delta; | |
prop = prop ? prop : "st"; | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
/** @type {number} */ | |
n = Number(codeSegments[i].getStItem(prop) ? codeSegments[i].getStItem(prop) : ""); | |
/** @type {boolean} */ | |
guard = codeSegments[i].getStItem("ew") == "1"; | |
if (isNaN(n) === false) { | |
/** @type {number} */ | |
n = n * 100; | |
/** @type {number} */ | |
delta = Number(codeSegments[i].getCnItem("bc") ? codeSegments[i].getCnItem("bc") : codeSegments[i].getStItem("bc") ? codeSegments[i].getStItem("bc") : "1"); | |
register += delta > 1 || guard ? Number(String(n * (guard ? 2 : 1) * delta)) : n; | |
} | |
} | |
return this.pad2DP(String(register / 100)); | |
}, | |
/** | |
* @param {Array} codeSegments | |
* @param {Event} fs | |
* @return {?} | |
*/ | |
isDuplicate : function(codeSegments, fs) { | |
/** @type {boolean} */ | |
var ret = false; | |
var nsp = fs.getCnItem("pt"); | |
/** | |
* @param {Event} fs | |
* @param {?} options | |
* @return {?} | |
*/ | |
var read = function(fs, options) { | |
return fs.getCnItem("spt") === options.getCnItem("spt") && (fs.getCnItem("cm") === options.getCnItem("cm") && (fs.getCnItem("ct") === options.getCnItem("ct") && (fs.getCnItem("f") === options.getCnItem("f") && fs.getCnItem("fp") === options.getCnItem("fp")))); | |
}; | |
/** @type {number} */ | |
i = 0; | |
for (;!ret && i < codeSegments.length;i++) { | |
switch(nsp) { | |
case "S": | |
/** @type {boolean} */ | |
ret = codeSegments[i].getCnItem("pid") === fs.getCnItem("pid") && codeSegments[i].getCnItem("mid") === fs.getCnItem("mid"); | |
break; | |
case "CB": | |
ret = read(fs, codeSegments[i]); | |
break; | |
case "TB": | |
switch(fs.type) { | |
case bs.betTypeToteCast: | |
; | |
case bs.betTypeUsToteCast: | |
; | |
case bs.betTypeEToteCast: | |
; | |
case bs.betTypeToteNonCast: | |
; | |
case bs.betTypeUsToteNonCast: | |
; | |
case bs.betTypeEToteNonCast: | |
ret = read(fs, codeSegments[i]); | |
} | |
break; | |
default: | |
if (codeSegments[i].getCnItem("fp") === fs.getCnItem("fp")) { | |
if (codeSegments[i].getCnItem("f") == fs.getCnItem("f")) { | |
/** @type {boolean} */ | |
ret = codeSegments[i].getCnItem("Inc") == fs.getCnItem("Inc") ? true : false; | |
} | |
} | |
; | |
} | |
} | |
return ret; | |
}, | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} el | |
* @return {?} | |
*/ | |
getItemOdds : function(dataAndEvents, el) { | |
var unfoldSoak; | |
var u; | |
switch(dataAndEvents) { | |
case bs.betTypeCast: | |
; | |
case bs.itemTypeCast: | |
unfoldSoak = el.getStItem; | |
break; | |
default: | |
unfoldSoak = el.getCnItem; | |
} | |
return u = unfoldSoak("BOdds"), u || (u = unfoldSoak("o")), u || (u = ""), u; | |
}, | |
/** | |
* @param {string} str | |
* @param {string} value | |
* @return {?} | |
*/ | |
to2DP : function(str, value) { | |
var attributes; | |
var length; | |
return value = value || ".", attributes = value === "." ? "," : ".", str = str.replace(new RegExp("\\" + attributes, "g"), value), length = str.indexOf(value), length != -1 && (str.length - length > 3 && (str = str.substr(0, length + 3))), str; | |
}, | |
/** | |
* @param {string} str | |
* @param {string} value | |
* @return {?} | |
*/ | |
pad2DP : function(str, value) { | |
var attributes; | |
var isFunction; | |
var r; | |
return value = value || ".", attributes = value === "." ? "," : ".", str = str.replace(new RegExp("\\" + attributes, "g"), value), str = str.trim(), str === value || str === "" ? str = "0" + value + "00" : (str = this.to2DP(str, value), isFunction = str.indexOf(value), isFunction == -1 ? str += value + "00" : (r = str.length - (isFunction + 1), r == 0 ? str += "00" : r == 1 && (str += "0"))), str; | |
}, | |
/** | |
* @param {string} str | |
* @param {string} value | |
* @return {?} | |
*/ | |
roundDecimal : function(str, value) { | |
var attributes; | |
var isFunction; | |
var r; | |
return value = value || ".", attributes = value === "." ? "," : ".", str = str.replace(new RegExp("\\" + attributes, "g"), value), str = str.trim(), str === value || str === "" ? str = "0" + value + "00" : (str = this.roundValue(str, value), isFunction = str.indexOf(value), isFunction == -1 ? str += value + "00" : (r = str.length - (isFunction + 1), r == 0 ? str += "00" : r == 1 && (str += "0"))), str; | |
}, | |
/** | |
* @param {string} value | |
* @param {string} j | |
* @return {?} | |
*/ | |
roundValue : function(value, j) { | |
var x; | |
var str; | |
var c; | |
var i; | |
var k; | |
var size; | |
var fromIndex; | |
if (j = j || ".", x = j === "." ? "," : ".", value = value.trim(), str = "0", value != "NaN" && value.indexOf(j) >= 0) { | |
if (c = value.split(j), i = c[0], k = c[1], k.trim().length == 0) { | |
return value; | |
} | |
k = k.length > 4 ? k.substring(0, 3) : k; | |
size = k.substring(2, 3); | |
if (Number(size) >= 5) { | |
size = k.substring(1, 2); | |
if (Number(size) == 9) { | |
fromIndex = k.substring(0, 1); | |
if (Number(fromIndex) == 9) { | |
/** @type {number} */ | |
i = Number(i) + 1; | |
/** @type {string} */ | |
str = String(i); | |
} else { | |
/** @type {number} */ | |
size = Number(fromIndex) + 1; | |
i = i + j + size; | |
/** @type {string} */ | |
str = String(i); | |
} | |
} else { | |
/** @type {number} */ | |
size = Number(size) + 1; | |
/** @type {string} */ | |
size = String(k.substring(0, 1)) + String(size); | |
/** @type {string} */ | |
i = i + j + size; | |
/** @type {string} */ | |
str = i; | |
} | |
} else { | |
if (k.length == 1) { | |
i = i + j + k; | |
str = i; | |
} else { | |
i = i + j + k.substring(0, 2); | |
str = i; | |
} | |
} | |
} else { | |
str = value === "" || value == "NaN" ? "" : isNaN(value) ? value : value; | |
} | |
return str; | |
}, | |
/** | |
* @param {number} val2 | |
* @param {?} condition | |
* @param {?} deepDataAndEvents | |
* @param {boolean} dataAndEvents | |
* @param {boolean} count | |
* @param {boolean} animate | |
* @return {?} | |
*/ | |
riskToWin : function(val2, condition, deepDataAndEvents, dataAndEvents, count, animate) { | |
var indentMultiline = Function.createDelegate(this, animate || animate == undefined ? this.pad2DP : this.roundDecimal); | |
/** @type {number} */ | |
var directionModifier = isNaN(val2) ? 0 : val2 * 1; | |
/** @type {*} */ | |
var result = eval(condition); | |
var obj; | |
return(count = count || isNaN(result), !count) ? dataAndEvents ? indentMultiline(String(directionModifier * 2)) : (obj = directionModifier * result / 1, indentMultiline(String(obj))) : ""; | |
}, | |
/** | |
* @param {number} n | |
* @param {?} condition | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {?} | |
*/ | |
winToRisk : function(n, condition, dataAndEvents, deepDataAndEvents) { | |
/** @type {number} */ | |
var v = 0; | |
if (deepDataAndEvents) { | |
/** @type {number} */ | |
v = Math.round(n * 50) / 100; | |
} else { | |
/** @type {number} */ | |
v = isNaN(n) ? 0 : n / eval(condition); | |
/** @type {number} */ | |
v = Number(this.roundValue(String(v))); | |
/** @type {number} */ | |
var t = v * 1; | |
/** @type {(number|string)} */ | |
var w2 = 1 + eval(condition); | |
/** @type {number} */ | |
var i = Math.round(t * (w2 - 1) * 100) / 100; | |
for (;i < n;) { | |
/** @type {number} */ | |
v = v + 0.01; | |
/** @type {number} */ | |
t = v * 1; | |
/** @type {(number|string)} */ | |
w2 = 1 + eval(condition); | |
/** @type {number} */ | |
i = Math.round(t * (w2 - 1) * 100) / 100; | |
} | |
} | |
return this.roundValue(String(v)); | |
}, | |
/** | |
* @param {string} arg | |
* @return {?} | |
*/ | |
isDecimal : function(arg) { | |
return(arg.indexOf(",") !== -1 && (arg = arg.replace(/,/g, ".")), String(arg).trim() === "0." || (String(arg).trim() === "." || arg === "")) ? true : isNaN(Number(arg)) == true ? false : true; | |
}, | |
/** | |
* @return {?} | |
*/ | |
getMaxStake : function() { | |
return 999999999; | |
}, | |
/** | |
* @return {?} | |
*/ | |
getMaxToWin : function() { | |
var formElement = $get("bs", $get("bsDiv")); | |
/** @type {number} */ | |
var formula = 99999999; | |
return formElement && (formElement.getAttribute("data-mtwin") && (Number(formElement.getAttribute("data-mtwin")) > 0 && (formula = Number(formElement.getAttribute("data-mtwin"))))), formula; | |
}, | |
/** | |
* @param {string} tp | |
* @param {?} day | |
* @param {string} month | |
* @param {string} index | |
* @param {Object} test | |
* @return {?} | |
*/ | |
doBetMax : function(tp, day, month, index, test) { | |
return lgh.isAuthenticated() ? (test.req(bs.reqTypeMaxBet, "key=" + tp + "-" + String(day) + "-" + month + "-" + index), true) : false; | |
}, | |
/** | |
* @param {string} nv | |
* @return {?} | |
*/ | |
alwaysShowToolTipItem : function(nv) { | |
return nv.startsWith(this._alwaysInclude); | |
}, | |
/** | |
* @param {string} requestUrl | |
* @return {?} | |
*/ | |
formatAlwaysShowToolTip : function(requestUrl) { | |
return requestUrl.replace(this._alwaysInclude, ""); | |
}, | |
/** | |
* @param {number} arg | |
* @return {?} | |
*/ | |
numDecPlcs : function(arg) { | |
/** @type {string} */ | |
var keyName = String(arg); | |
/** @type {string} */ | |
var match = "."; | |
return keyName.indexOf(match) > -1 ? keyName.length - keyName.indexOf(match) - 1 : 0; | |
}, | |
/** | |
* @param {?} val | |
* @param {?} dataAndEvents | |
* @return {?} | |
*/ | |
getBetItemIndex : function(val, dataAndEvents) { | |
/** @type {number} */ | |
var foundI = -1; | |
var fs = new b365.Ui.BetDTO; | |
var codeSegments; | |
var i; | |
var valsLength; | |
fs.parse(val); | |
codeSegments = dataAndEvents.getBetItems(); | |
/** @type {number} */ | |
i = 0; | |
valsLength = codeSegments.length; | |
for (;i < valsLength;i++) { | |
if (fs.getCnItem("mid") && fs.getCnItem("pid")) { | |
if (codeSegments[i].getCnItem("f") == fs.getCnItem("f") && (codeSegments[i].getCnItem("mid") == fs.getCnItem("mid") && codeSegments[i].getCnItem("pid") == fs.getCnItem("pid"))) { | |
/** @type {number} */ | |
foundI = i; | |
break; | |
} | |
} else { | |
if (codeSegments[i].getCnItem("fp") === fs.getCnItem("fp") && (codeSegments[i].getCnItem("f") == fs.getCnItem("f") && (fs.getCnItem("Inc") ? fs.getCnItem("Inc") === codeSegments[i].getCnItem("Inc") : true))) { | |
/** @type {number} */ | |
foundI = i; | |
break; | |
} else { | |
if (codeSegments[i].getCnItem("id") && codeSegments[i].getCnItem("id") === fs.getCnItem("id")) { | |
/** @type {number} */ | |
foundI = i; | |
break; | |
} else { | |
if (codeSegments[i].getCnItem("spt") + codeSegments[i].getCnItem("cm") + codeSegments[i].getCnItem("ct") == fs.getCnItem("pt") && (codeSegments[i].getCnItem("fp") === fs.getCnItem("fp") && codeSegments[i].getCnItem("f") == fs.getCnItem("f"))) { | |
/** @type {number} */ | |
foundI = i; | |
break; | |
} else { | |
if (codeSegments[i].getCnItem("pp") && codeSegments[i].getCnItem("pp") === fs.getCnItem("fp")) { | |
/** @type {number} */ | |
foundI = i; | |
break; | |
} | |
} | |
} | |
} | |
} | |
} | |
return foundI; | |
} | |
}; | |
$blib = new b365.Ui.BetSlipLib; | |
/** | |
* @param {?} eventType | |
* @return {undefined} | |
*/ | |
b365.Ui.BetDTO = function(eventType) { | |
this.type = eventType; | |
var table = {}; | |
var o = {}; | |
/** | |
* @param {?} a | |
* @param {string} to | |
* @return {undefined} | |
*/ | |
var merge = function(a, to) { | |
var b; | |
var codeSegments = to.split("#"); | |
/** @type {number} */ | |
var i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (codeSegments[i].length > 0) { | |
b = codeSegments[i].split("="); | |
a[b[0]] = b[1]; | |
} | |
} | |
}; | |
/** | |
* @param {string} fmt | |
* @return {undefined} | |
*/ | |
this.parse = function(fmt) { | |
var codeSegments = fmt.split("|"); | |
var ret; | |
var i; | |
o = {}; | |
table = {}; | |
ret = table; | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (codeSegments[i].length > 0) { | |
merge(ret, codeSegments[i]); | |
} | |
ret = o; | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
this.toString = function() { | |
/** @type {string} */ | |
var key = ""; | |
/** @type {string} */ | |
var text = ""; | |
var i; | |
key = this.getCn(); | |
for (i in o) { | |
if (i == "st" || i == "ust") { | |
o[i] = o[i] !== "" ? o[i].toString().replace(",", ".") : ""; | |
} | |
text += i + "=" + o[i] + "#"; | |
} | |
return key + (text === "" ? "" : "|") + text; | |
}; | |
/** | |
* @return {?} | |
*/ | |
this.getCn = function() { | |
/** @type {string} */ | |
var j = ""; | |
var h; | |
for (h in table) { | |
/** @type {string} */ | |
j = j + h + "=" + table[h] + "#"; | |
} | |
return j; | |
}; | |
/** | |
* @param {string} str | |
* @return {?} | |
*/ | |
this.getCnItem = function(str) { | |
return table[str]; | |
}; | |
/** | |
* @param {string} num | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
this.setCnItem = function(num, dataAndEvents) { | |
table[num] = dataAndEvents; | |
}; | |
/** | |
* @param {string} p | |
* @return {undefined} | |
*/ | |
this.removeCnItem = function(p) { | |
delete table[p]; | |
}; | |
/** | |
* @param {string} str | |
* @return {?} | |
*/ | |
this.getStItem = function(str) { | |
return o[str]; | |
}; | |
/** | |
* @param {string} str | |
* @param {string} val | |
* @return {undefined} | |
*/ | |
this.setStItem = function(str, val) { | |
/** @type {string} */ | |
o[str] = val; | |
}; | |
/** | |
* @param {string} fb | |
* @return {undefined} | |
*/ | |
this.removeStItem = function(fb) { | |
delete o[fb]; | |
}; | |
/** | |
* @param {string} moduleNames | |
* @param {?} el | |
* @return {?} | |
*/ | |
this.parseCookieString = function(moduleNames, el) { | |
var codeSegments = moduleNames.split("||"); | |
/** @type {Array} */ | |
var dest = []; | |
var a; | |
var i; | |
if (moduleNames.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (codeSegments[i].length > 0) { | |
a = new b365.Ui.BetDTO(el); | |
a.parse(codeSegments[i]); | |
if (el != bs.betTypeMultiple) { | |
a.setStItem("es", 1); | |
a.setStItem("FO", "False"); | |
} | |
Array.add(dest, a); | |
} | |
} | |
} | |
return dest; | |
}; | |
/** | |
* @param {Array} resultItems | |
* @return {?} | |
*/ | |
this.serialize = function(resultItems) { | |
/** @type {string} */ | |
var serialized = ""; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < resultItems.length;i++) { | |
serialized += resultItems[i].toString() + "||"; | |
} | |
return serialized; | |
}; | |
/** | |
* @return {?} | |
*/ | |
this.getTopic = function() { | |
return this.getTopicItem(0); | |
}; | |
/** | |
* @return {?} | |
*/ | |
this.getOddsOverride = function() { | |
return this.getTopicItem(1); | |
}; | |
/** | |
* @return {?} | |
*/ | |
this.getDecimalPlaces = function() { | |
return this.getTopicItem(2); | |
}; | |
/** | |
* @param {number} i | |
* @return {?} | |
*/ | |
this.getTopicItem = function(i) { | |
var codeSegments = (this.getStItem("TP") || "").split("x"); | |
return codeSegments.length > i ? codeSegments[i] : ""; | |
}; | |
}; | |
$bto = new b365.Ui.BetDTO; | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.BetSlipAPI = function(dataAndEvents) { | |
this._events = new Sys.EventHandlerList; | |
/** @type {null} */ | |
this._b365BsAJAX = null; | |
/** @type {boolean} */ | |
this._lock = false; | |
this._betSlipCookieKey = dataAndEvents; | |
/** @type {null} */ | |
this._betSlipCookieBackup = null; | |
/** @type {null} */ | |
this._pushBetSlipCookieBackup = null; | |
/** @type {Array} */ | |
this._betItems = []; | |
/** @type {Array} */ | |
this._betMltItems = []; | |
/** @type {Array} */ | |
this._betCastItems = []; | |
/** @type {boolean} */ | |
this._clearOnAdd = false; | |
/** @type {null} */ | |
this._controller = null; | |
/** @type {null} */ | |
this._clickToCallHandler = null; | |
/** @type {null} */ | |
this._pollTime = null; | |
/** @type {null} */ | |
this._pollInterval = null; | |
/** @type {boolean} */ | |
this._pollForceStop = false; | |
/** @type {null} */ | |
this._pollReference = null; | |
/** @type {null} */ | |
this._pollRequestParams = null; | |
/** @type {number} */ | |
this._pollCount = 0; | |
/** @type {number} */ | |
this._pollReqType = 0; | |
/** @type {number} */ | |
this._betSlipModeBetSlip = 1; | |
/** @type {number} */ | |
this._betSlipModeConfirm = 2; | |
/** @type {number} */ | |
this._betSlipModeReceipt = 3; | |
/** @type {number} */ | |
this._dialogModeConfirmation = 1; | |
/** @type {number} */ | |
this._dialogModeDialog = 2; | |
/** @type {number} */ | |
this.betTypeAll = -1; | |
/** @type {number} */ | |
this.betTypeNormal = 0; | |
/** @type {number} */ | |
this.betTypeMultiple = 1; | |
/** @type {number} */ | |
this.betTypeLotto = 2; | |
/** @type {number} */ | |
this.betTypeCast = 3; | |
/** @type {number} */ | |
this.betTypeToteCast = 4; | |
/** @type {number} */ | |
this.betTypeToteNonCast = 5; | |
/** @type {number} */ | |
this.betTypeToteAll = 6; | |
/** @type {number} */ | |
this.betTypeUsToteCast = 7; | |
/** @type {number} */ | |
this.betTypeUsToteNonCast = 8; | |
/** @type {number} */ | |
this.betTypeUsToteAll = 9; | |
/** @type {number} */ | |
this.betTypeAllAccept = 11; | |
/** @type {number} */ | |
this.betTypeEToteCast = 12; | |
/** @type {number} */ | |
this.betTypeEToteNonCast = 13; | |
/** @type {number} */ | |
this.betTypeTotePot = 14; | |
/** @type {number} */ | |
this.betTypeUsTotePot = 15; | |
/** @type {number} */ | |
this.betTypeETotePot = 16; | |
/** @type {number} */ | |
this.betTypeFrgnToteCast = 17; | |
/** @type {number} */ | |
this.betTypeFrgnToteNonCast = 18; | |
/** @type {number} */ | |
this.betTypeFrgnTotePot = 19; | |
/** @type {number} */ | |
this.betTypeTotePotAus = 20; | |
/** @type {number} */ | |
this.betTypeLottoFrame = 21; | |
/** @type {number} */ | |
this.reqTypeRefreshSlip = 0; | |
/** @type {number} */ | |
this.reqTypeAddItems = 1; | |
/** @type {number} */ | |
this.reqTypePlaceBet = 2; | |
/** @type {number} */ | |
this.reqTypeDeleteItem = 3; | |
/** @type {number} */ | |
this.reqTypeRefreshLottoSlip = 3; | |
/** @type {number} */ | |
this.reqTypePlaceLottoBet = 4; | |
/** @type {number} */ | |
this.reqTypeMaxBet = 5; | |
/** @type {number} */ | |
this.reqTypeBetBrk = 7; | |
/** @type {number} */ | |
this.reqTypePitcher = 8; | |
/** @type {number} */ | |
this.reqTypeRefreshAccept = 9; | |
/** @type {number} */ | |
this.reqTypeReferBet = 10; | |
/** @type {number} */ | |
this.reqTypePollReferredBet = 11; | |
/** @type {number} */ | |
this.reqTypeConfirmBet = 13; | |
/** @type {number} */ | |
this.reqTypeConstructAndAddItems = 15; | |
/** @type {number} */ | |
this.reqTypePhoneBet = 17; | |
/** @type {number} */ | |
this.reqTypeLoadMobileLottoBetslip = 18; | |
/** @type {number} */ | |
this.reqTypePlaceMobileLottoBet = 19; | |
/** @type {number} */ | |
this.reqTypePollTempBetReceipt = 20; | |
/** @type {number} */ | |
this.reqTypeGetCTCBetDetails = 21; | |
/** @type {number} */ | |
this.reqTypeSetOddsType = 22; | |
/** @type {number} */ | |
this.reqTypeFetchMultiples = 24; | |
/** @type {number} */ | |
this.reqTypeSplitBet = 25; | |
/** @type {string} */ | |
this.postPayload = ""; | |
/** @type {string} */ | |
this.slipStandard = "1"; | |
/** @type {string} */ | |
this.slipBanker = "2"; | |
/** @type {string} */ | |
this.slipIF = "3"; | |
/** @type {string} */ | |
this.slipReverseIF = "4"; | |
/** @type {string} */ | |
this.slipFixedTeaser = "5"; | |
/** @type {string} */ | |
this.slipNumbers = "7"; | |
/** @type {string} */ | |
this.slipUKTote = "8"; | |
/** @type {string} */ | |
this.slipUSTote = "9"; | |
/** @type {string} */ | |
this.slipETote = "10"; | |
/** @type {number} */ | |
this.slipFinancials = 100; | |
/** @type {number} */ | |
this.slipFinancialsblank = 9997; | |
/** @type {string} */ | |
this.toteTypeNotTote = "0"; | |
/** @type {string} */ | |
this.toteTypeUKTote = "1"; | |
/** @type {string} */ | |
this.toteTypeETote = "2"; | |
/** @type {string} */ | |
this.toteTypeUSTote = "3"; | |
/** @type {string} */ | |
this.toteTypeForeignTote = "4"; | |
/** @type {string} */ | |
this.toteTypeAustralianTote = "5"; | |
/** @type {string} */ | |
this.itemTypeSingle = "single"; | |
/** @type {string} */ | |
this.itemTypeToteSingle = "tote-single"; | |
/** @type {string} */ | |
this.itemTypeCast = "cast"; | |
/** @type {string} */ | |
this.itemTypeToteCast = "tote-cast"; | |
/** @type {string} */ | |
this.itemTypeTotePot = "tote-pot"; | |
/** @type {string} */ | |
this.itemTypeMultiple = "multiple"; | |
/** @type {string} */ | |
this.itemTypeAll = "all"; | |
/** @type {string} */ | |
this.betSource = ""; | |
/** @type {boolean} */ | |
this.showStreaming = false; | |
/** @type {boolean} */ | |
this.showFullTextMode = false; | |
/** @type {boolean} */ | |
this.showFixtureDate = false; | |
/** @type {null} */ | |
this.headerLinks = null; | |
/** @type {null} */ | |
this.keyboardType = null; | |
/** @type {boolean} */ | |
this.refreshUserBalance = true; | |
/** @type {string} */ | |
this.isoCode = ""; | |
/** @type {boolean} */ | |
this.useTruncated2dpPriceForReturnsCalc = false; | |
/** @type {null} */ | |
this.pushBetStatus = null; | |
/** @type {null} */ | |
this.pendingPushBetElement = null; | |
/** @type {boolean} */ | |
this.isSiteOverlaySpinnerShowing = false; | |
/** @type {boolean} */ | |
this.displayMaxExceededMessage = false; | |
/** @type {boolean} */ | |
this.toggledBankerSelectionState = false; | |
}; | |
b365.Ui.BetSlipAPI.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
pageLoad : function() { | |
var throttledUpdate = this.getHandler("onpageload"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
addBet : function() { | |
try { | |
var fnc = this.getHandler("onaddbet"); | |
if (fnc && this._lock === false) { | |
try { | |
if (trk) { | |
trk.send(null, EnumRegionID.Right, -1, EnumEventsOrPageTypes.Click, EnumPodID.Coupon, -1, arguments[0]); | |
} | |
} catch (i) { | |
} | |
fnc(this, arguments); | |
} | |
} catch (ex) { | |
this.displayError(ex.message); | |
} | |
}, | |
/** | |
* @param {?} forceRebuild | |
* @param {string} cb | |
* @param {string} dataAndEvents | |
* @return {undefined} | |
*/ | |
refresh : function(forceRebuild, cb, dataAndEvents) { | |
try { | |
if (this._lock === false) { | |
switch(forceRebuild) { | |
case this.betTypeLottoFrame: | |
this.req(this.reqTypeRefreshLottoSlip, cb); | |
break; | |
case this.betTypeLotto: | |
this.req(this.reqTypeRefreshSlip, cb); | |
break; | |
case this.betTypeAllAccept: | |
this.req(this.reqTypeRefreshAccept, cb); | |
break; | |
case this.reqTypePhoneBet: | |
this.req(this.reqTypePhoneBet, cb, "", dataAndEvents); | |
break; | |
default: | |
this.req(this.reqTypeRefreshSlip, cb); | |
} | |
} | |
} catch (ex) { | |
this.displayError(ex.message); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
updateState : function() { | |
var updateState = this.getHandler("onupdatestate"); | |
if (updateState) { | |
updateState(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
onPBetError : function() { | |
var throttledUpdate = this.getHandler("onpbeterror"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
clearBets : function(recurring) { | |
try { | |
this.setValueInBSCookie("", ""); | |
/** @type {Array} */ | |
this._betItems = []; | |
/** @type {Array} */ | |
this._betMltItems = []; | |
/** @type {Array} */ | |
this._betCastItems = []; | |
if (recurring) { | |
this.req(this.reqTypeRefreshSlip); | |
} | |
} catch (ex) { | |
this.displayError(ex.message); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
confirmBets : function() { | |
try { | |
var throttledUpdate = this.getHandler("onconfirmbet"); | |
if (throttledUpdate) { | |
if (this._lock === false) { | |
throttledUpdate(this); | |
} | |
} | |
} catch (ex) { | |
this.displayError(ex.message); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
placeBets : function() { | |
try { | |
var throttledUpdate = this.getHandler("onplacebet"); | |
if (throttledUpdate) { | |
if (this._lock === false) { | |
this.updateState(); | |
throttledUpdate(this); | |
} | |
} | |
} catch (ex) { | |
this.displayError(ex.message); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
referBets : function() { | |
try { | |
this.resetPoll(); | |
var throttledUpdate = this.getHandler("onreferbet"); | |
if (throttledUpdate) { | |
if (this._lock === false) { | |
throttledUpdate(this); | |
} | |
} | |
} catch (ex) { | |
this.displayError(ex.message); | |
} | |
}, | |
/** | |
* @param {Blob} dataAndEvents | |
* @param {string} deepDataAndEvents | |
* @param {?} triggerRoute | |
* @param {number} node | |
* @param {string} ignoreMethodDoesntExist | |
* @return {undefined} | |
*/ | |
pollBet : function(dataAndEvents, deepDataAndEvents, triggerRoute, node, ignoreMethodDoesntExist) { | |
this.setPollTimeSettings(triggerRoute, node); | |
if (this._pollCount < this._pollTime / this._pollInterval && !this._pollForceStop) { | |
/** @type {Blob} */ | |
this._pollReqType = dataAndEvents; | |
/** @type {string} */ | |
this._pollReference = deepDataAndEvents; | |
/** @type {string} */ | |
this._pollRequestParams = ignoreMethodDoesntExist; | |
this._pollCount++; | |
/** @type {boolean} */ | |
this._pollForceStop = false; | |
setTimeout(Function.createDelegate(this, this.execPoll), this._pollInterval * 1E3); | |
} else { | |
this.execPollExpired(); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
execPoll : function() { | |
var dataAttr; | |
var name; | |
try { | |
dataAttr = this.getHandler("onpoll"); | |
if (dataAttr) { | |
if (this._lock === false) { | |
/** @type {Array} */ | |
name = []; | |
Array.add(name, this._pollReqType); | |
Array.add(name, this._pollReference); | |
Array.add(name, this._pollRequestParams); | |
dataAttr(this, name); | |
} | |
} | |
} catch (ex) { | |
this.resetPoll(); | |
this.displayError(ex.message); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
execPollExpired : function() { | |
var dataAttr; | |
var name; | |
try { | |
dataAttr = this.getHandler("onpollexpired"); | |
if (dataAttr) { | |
if (this._lock === false) { | |
/** @type {Array} */ | |
name = []; | |
Array.add(name, this._pollReqType); | |
Array.add(name, this._pollForceStop); | |
dataAttr(this, name); | |
} | |
} | |
} catch (ex) { | |
this.displayError(ex.message); | |
} | |
}, | |
/** | |
* @return {?} | |
*/ | |
pollInProgress : function() { | |
return this._pollReference !== null || this._pollRequestParams !== null; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
resetPoll : function() { | |
/** @type {number} */ | |
this._pollReqType = 0; | |
/** @type {null} */ | |
this._pollReference = null; | |
/** @type {null} */ | |
this._pollRequestParams = null; | |
/** @type {number} */ | |
this._pollCount = 0; | |
/** @type {boolean} */ | |
this._pollForceStop = false; | |
}, | |
/** | |
* @param {?} triggerRoute | |
* @param {number} dataAndEvents | |
* @return {undefined} | |
*/ | |
setPollTimeSettings : function(triggerRoute, dataAndEvents) { | |
if (triggerRoute) { | |
if (dataAndEvents) { | |
this._pollTime = triggerRoute; | |
/** @type {number} */ | |
this._pollInterval = dataAndEvents; | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
deleteItem : function() { | |
try { | |
var done = this.getHandler("ondeleteitem"); | |
if (done) { | |
if (this._lock === false) { | |
done(this, arguments); | |
} | |
} | |
} catch (ex) { | |
this.displayError(ex.message); | |
} | |
}, | |
/** | |
* @param {?} dataAndEvents | |
* @return {?} | |
*/ | |
getBetItems : function(dataAndEvents) { | |
switch(dataAndEvents) { | |
case this.betTypeCast: | |
; | |
case this.betTypeToteCast: | |
; | |
case this.betTypeUsToteCast: | |
; | |
case this.betTypeTotePot: | |
; | |
case this.betTypeUsTotePot: | |
; | |
case this.betTypeEToteCast: | |
; | |
case this.betTypeETotePot: | |
; | |
case this.betTypeFrgnToteCast: | |
; | |
case this.betTypeFrgnTotePot: | |
; | |
case this.betTypeTotePotAus: | |
; | |
case this.itemTypeCast: | |
; | |
case this.itemTypeTotePot: | |
; | |
case this.itemTypeToteCast: | |
return this._betCastItems; | |
case this.betTypeMultiple: | |
; | |
case this.itemTypeMultiple: | |
return this._betMltItems; | |
case this.betTypeAll: | |
; | |
case this.itemTypeAll: | |
return this._betItems.concat(this._betCastItems).concat(this._betMltItems); | |
default: | |
return this._betItems; | |
} | |
}, | |
/** | |
* @return {?} | |
*/ | |
containsPhoneOnlyBet : function() { | |
var codeSegments = this.getBetItems(); | |
/** @type {boolean} */ | |
var containsPhoneOnlyBet = false; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (codeSegments[i].getStItem("pom") == "Y") { | |
/** @type {boolean} */ | |
containsPhoneOnlyBet = true; | |
break; | |
} | |
} | |
return containsPhoneOnlyBet; | |
}, | |
/** | |
* @return {?} | |
*/ | |
unsuspendedItemCount : function() { | |
var codeSegments = this.getBetItems(); | |
/** @type {number} */ | |
var unsuspendedItemCount = 0; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (codeSegments[i].getStItem("_s") !== "1") { | |
unsuspendedItemCount++; | |
} | |
} | |
return unsuspendedItemCount; | |
}, | |
/** | |
* @param {?} dataAndEvents | |
* @param {Object} recurring | |
* @return {?} | |
*/ | |
getBetItemById : function(dataAndEvents, recurring) { | |
var part; | |
switch(dataAndEvents) { | |
case this.betTypeToteNonCast: | |
; | |
case this.betTypeEToteNonCast: | |
; | |
case this.betTypeUsToteNonCast: | |
; | |
case this.betTypeFrgnToteNonCast: | |
; | |
case this.betTypeNormal: | |
; | |
case this.itemTypeSingle: | |
; | |
case this.itemTypeToteSingle: | |
part = this._betItems[recurring]; | |
break; | |
case this.betTypeCast: | |
; | |
case this.betTypeToteCast: | |
; | |
case this.betTypeUsToteCast: | |
; | |
case this.betTypeTotePot: | |
; | |
case this.betTypeUsTotePot: | |
; | |
case this.betTypeEToteCast: | |
; | |
case this.betTypeETotePot: | |
; | |
case this.betTypeFrgnToteCast: | |
; | |
case this.betTypeFrgnTotePot: | |
; | |
case this.betTypeTotePotAus: | |
; | |
case this.itemTypeCast: | |
; | |
case this.itemTypeTotePot: | |
; | |
case this.itemTypeToteCast: | |
part = this._betCastItems[recurring]; | |
break; | |
default: | |
/** @type {number} */ | |
i = 0; | |
for (;i < this._betMltItems.length;i++) { | |
if (this._betMltItems[i].getCnItem("id") == String(recurring)) { | |
part = this._betMltItems[i]; | |
break; | |
} | |
} | |
; | |
} | |
return part; | |
}, | |
/** | |
* @param {?} dataAndEvents | |
* @param {string} id | |
* @param {string} keepData | |
* @return {?} | |
*/ | |
getBetItemByCn : function(dataAndEvents, id, keepData) { | |
var part; | |
var codeSegments = this.getBetItems(dataAndEvents); | |
/** @type {number} */ | |
var i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (codeSegments[i].getCnItem(id) == keepData || codeSegments[i].getStItem(id) == keepData) { | |
part = codeSegments[i]; | |
break; | |
} | |
} | |
return part; | |
}, | |
/** | |
* @param {Array} array1 | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
setBetItems : function(array1, dataAndEvents) { | |
switch(dataAndEvents) { | |
case this.betTypeCast: | |
; | |
case this.betTypeToteCast: | |
; | |
case this.betTypeUsToteCast: | |
; | |
case this.betTypeTotePot: | |
; | |
case this.betTypeUsTotePot: | |
; | |
case this.betTypeEToteCast: | |
; | |
case this.betTypeETotePot: | |
; | |
case this.betTypeFrgnToteCast: | |
; | |
case this.betTypeFrgnTotePot: | |
; | |
case this.betTypeTotePotAus: | |
/** @type {Array} */ | |
this._betCastItems = array1; | |
break; | |
case this.betTypeMultiple: | |
/** @type {Array} */ | |
this._betMltItems = array1; | |
break; | |
default: | |
/** @type {Array} */ | |
this._betItems = array1; | |
} | |
}, | |
/** | |
* @return {?} | |
*/ | |
getSlipType : function() { | |
return this.getValueFromBSCookie("bt").replace(/\|/g, ""); | |
}, | |
/** | |
* @return {?} | |
*/ | |
isFull : function() { | |
return this._betItems.length + this._betCastItems.length >= 14 ? true : false; | |
}, | |
/** | |
* @param {?} dataAndEvents | |
* @return {?} | |
*/ | |
okToAdd : function(dataAndEvents) { | |
return this._betItems.length + this._betCastItems.length + dataAndEvents <= 14 ? true : false; | |
}, | |
/** | |
* @param {boolean} length | |
* @return {?} | |
*/ | |
numItems : function(length) { | |
return length === undefined && (length = true), this._betItems.length + this._betCastItems.length + (length === false ? 0 : this._betMltItems.length); | |
}, | |
/** | |
* @return {?} | |
*/ | |
isEmpty : function() { | |
return this._betItems.length + this._betCastItems.length + this._betMltItems.length === 0; | |
}, | |
/** | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
setClearOnAdd : function(recurring) { | |
/** @type {boolean} */ | |
this._clearOnAdd = recurring; | |
}, | |
/** | |
* @return {?} | |
*/ | |
getClearOnAdd : function() { | |
return this._clearOnAdd; | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnAddBet : function(a) { | |
this._events.addHandler("onaddbet", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnReqComplete : function(a) { | |
this._events.addHandler("onreqcomplete", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnDeleteItem : function(a) { | |
this._events.addHandler("ondeleteitem", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnHandleInProg : function(a) { | |
this._events.addHandler("oninprogress", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnContentChangedOnClient : function(a) { | |
this._events.addHandler("oncontentchangedclient", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnContentLoaded : function(a) { | |
this._events.addHandler("oncontentloaded", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnLock : function(a) { | |
this._events.addHandler("onlockunlock", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnPageLoad : function(a) { | |
this._events.addHandler("onpageload", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnConfirmBet : function(a) { | |
this._events.addHandler("onconfirmbet", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnPlaceBet : function(a) { | |
this._events.addHandler("onplacebet", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnReferBet : function(a) { | |
this._events.addHandler("onreferbet", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnPoll : function(a) { | |
this._events.addHandler("onpoll", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnPollExpired : function(a) { | |
this._events.addHandler("onpollexpired", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnRestoreState : function(a) { | |
this._events.addHandler("onreststate", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnUpdateState : function(a) { | |
this._events.addHandler("onupdatestate", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnPBetError : function(a) { | |
this._events.addHandler("onpbeterror", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addScrollToTop : function(a) { | |
this._events.addHandler("onscrolltotop", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnBetAdded : function(a) { | |
this._events.addHandler("onbetadded", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnEditBet : function(a) { | |
this._events.addHandler("oneditbet", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnBetAddedReqComplete : function(a) { | |
this._events.addHandler("onbetaddedreqcomplete", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnRefreshReqComplete : function(a) { | |
this._events.addHandler("onrefreshreqcomplete", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnBetSlipItemsChanged : function(a) { | |
this._events.addHandler("onbetslipitemschanged", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnAcceptChanges : function(a) { | |
this._events.addHandler("onacceptchanges", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnBetSlipLoaded : function(a) { | |
this._events.addHandler("onbetsliploaded", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnMaxSelections : function(a) { | |
this._events.addHandler("onmaxselections", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnBetslipDisplayed : function(a) { | |
this._events.addHandler("onbetslipdisplayed", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnPlaceBetSuccess : function(a) { | |
this._events.addHandler("onplacebetsuccess", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnAddBetslipFooterLinks : function(a) { | |
this._events.addHandler("onaddbetslipfooterlinks", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnAddReceiptHeaderLinks : function(a) { | |
this._events.addHandler("onaddreceiptheaderlinks", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnAddReceiptLiveAlertSignUp : function(a) { | |
this._events.addHandler("onaddreceiptlivealertsignup", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnBetslipError : function(a) { | |
this._events.addHandler("onbetsliperror", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnShowBetSlip : function(a) { | |
this._events.addHandler("onshowbetslip", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnHideBetSlip : function(a) { | |
this._events.addHandler("onhidebetslip", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnChangeBetslipHeight : function(a) { | |
this._events.addHandler("onchangebetslipheight", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnPopupShow : function(a) { | |
this._events.addHandler("onpopupshow", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnPopupHide : function(a) { | |
this._events.addHandler("onpopuphide", a); | |
}, | |
/** | |
* @param {string} listener | |
* @return {undefined} | |
*/ | |
removeOnBetSlipLoaded : function(listener) { | |
this._events.removeHandler("onbetsliploaded", listener); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnDeleteBetReqComplete : function(a) { | |
this._events.addHandler("deletebetreqcomplete", a); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnAddBetFailed : function(a) { | |
this._events.addHandler("onaddbetfailed", a); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
ScrollToTop : function() { | |
var throttledUpdate = this.getHandler("onscrolltotop"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @param {Array} chunks | |
* @return {undefined} | |
*/ | |
betAdded : function(chunks) { | |
var throttledUpdate = this.getHandler("onbetadded"); | |
if (throttledUpdate) { | |
throttledUpdate(this, chunks[0].getCnItem("fp")); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
betAddedReqComplete : function() { | |
var throttledUpdate = this.getHandler("onbetaddedreqcomplete"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
editBet : function() { | |
var throttledUpdate = this.getHandler("oneditbet"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
refreshReqComplete : function() { | |
var throttledUpdate = this.getHandler("onrefreshreqcomplete"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
betSlipItemsChanged : function() { | |
var throttledUpdate = this.getHandler("onbetslipitemschanged"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
acceptChanges : function() { | |
var throttledUpdate = this.getHandler("onacceptchanges"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
betSlipLoaded : function() { | |
var throttledUpdate = this.getHandler("onbetsliploaded"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
maxSelections : function() { | |
var throttledUpdate = this.getHandler("onmaxselections"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
betSlipDisplayed : function() { | |
var throttledUpdate = this.getHandler("onbetslipdisplayed"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
placeBetSuccess : function() { | |
var throttledUpdate = this.getHandler("onplacebetsuccess"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
addBetslipFooterLinks : function() { | |
var throttledUpdate = this.getHandler("onaddbetslipfooterlinks"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
addReceiptHeaderLinks : function() { | |
var throttledUpdate = this.getHandler("onaddreceiptheaderlinks"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
addReceiptLiveAlertSignUp : function() { | |
var throttledUpdate = this.getHandler("onaddreceiptlivealertsignup"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
betslipError : function() { | |
var throttledUpdate = this.getHandler("onbetsliperror"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
showBetSlip : function() { | |
var throttledUpdate = this.getHandler("onshowbetslip"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
hideBetSlip : function() { | |
var throttledUpdate = this.getHandler("onhidebetslip"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
changeBetslipHeight : function() { | |
var throttledUpdate = this.getHandler("onchangebetslipheight"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @param {?} element | |
* @return {undefined} | |
*/ | |
popupShow : function(element) { | |
var requestFrame = this.getHandler("onpopupshow"); | |
if (requestFrame) { | |
requestFrame(this, element); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
popupHide : function() { | |
var throttledUpdate = this.getHandler("onpopuphide"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
restoreState : function() { | |
var throttledUpdate = this.getHandler("onreststate"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
deleteBetReqComplete : function() { | |
var throttledUpdate = this.getHandler("deletebetreqcomplete"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
addBetFailed : function() { | |
var throttledUpdate = this.getHandler("onaddbetfailed"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
lock : function() { | |
/** @type {boolean} */ | |
this._lock = true; | |
this.lockEvent(); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
unlock : function() { | |
/** @type {boolean} */ | |
this._lock = false; | |
this.lockEvent(); | |
}, | |
/** | |
* @return {?} | |
*/ | |
locked : function() { | |
return this._lock; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
lockEvent : function() { | |
var throttledUpdate = this.getHandler("onlockunlock"); | |
if (throttledUpdate) { | |
throttledUpdate(this, this._lock); | |
} | |
}, | |
/** | |
* @param {?} method | |
* @param {string} options | |
* @param {string} error | |
* @param {string} dataAndEvents | |
* @param {(Element|string)} forceSync | |
* @return {?} | |
*/ | |
req : function(method, options, error, dataAndEvents, forceSync) { | |
/** @type {boolean} */ | |
var req = true; | |
var $target; | |
var context; | |
var pre; | |
var _b365BsAJAX; | |
var getClickToCallHandler; | |
if (dataAndEvents && (this._controller = dataAndEvents), this._lock === false) { | |
this.lock(); | |
if (this._b365BsAJAX !== null) { | |
/** @type {null} */ | |
this._b365BsAJAX = null; | |
} | |
/** @type {string} */ | |
var b = this.betSource.length > 0 ? "&betsource=" + this.betSource : ""; | |
/** @type {string} */ | |
var c = "&streaming=" + Number(this.showStreaming); | |
/** @type {string} */ | |
var m = "&fulltext=" + Number(this.showFullTextMode); | |
/** @type {string} */ | |
var _ = "&refreshbal=" + Number(this.refreshUserBalance); | |
/** @type {string} */ | |
var s = "&isocode=" + this.isoCode; | |
var data = this.containsPhoneOnlyBet(); | |
var _controller = this._controller && this._controller.betCallTwilioEnabled(); | |
/** @type {string} */ | |
var inner = data && window.location.host.indexOf("com.au") > -1 ? "&bc=y" : ""; | |
/** @type {string} */ | |
var str = ""; | |
if (method == this.reqTypePlaceBet || method == this.reqTypePlaceMobileLottoBet) { | |
pre = this._controller && this._controller.getBetguid ? this._controller.getBetguid() : forceSync; | |
str += "&betguid=" + pre; | |
} | |
if (dataAndEvents) { | |
if (dataAndEvents.clientEnhancedMode()) { | |
context = $("#bsDiv"); | |
if (!$("li", context).hasClass("disabledBetSlip")) { | |
$target = $('li[class$="multiple-section multipleBets"], li[data-item-type$="single"], li[data-item-type$="cast"], li[data-item-type$="tote-single"], li[data-item-type$="tote-cast"], li[data-item-type$="tote-pot"], li[data-item-type$="tote-pot-leg"]', "#bsDiv"); | |
dataAndEvents._enhancedBetSlipAnimations.disableBetSlip($target, context); | |
} | |
} | |
} | |
/** @type {string} */ | |
_b365BsAJAX = "../?op=" + method + "&ck=" + this._betSlipCookieKey + (options && options.length > 0 ? "&" + options : "") + b + c + m + str + _ + s + inner + "&qb=0"; | |
/** @type {number} */ | |
this._ajaxInstId = (new Date).getTime(); | |
if (dataAndEvents) { | |
dataAndEvents.clientActionInProgress(true); | |
if (method === dataAndEvents._bsInst.reqTypePlaceBet) { | |
dataAndEvents.getMultipleItemsController().cacheState(); | |
} | |
} | |
this._b365BsAJAX = new b365BsAJAX(_b365BsAJAX, Function.createDelegate(this, this.reqComplete), Function.createDelegate(this, this.reqError), 3E4, Function.createDelegate(this, this.reqTimeout), true, this._ajaxInstId, arguments); | |
if (data && method == this.reqTypePlaceBet) { | |
getClickToCallHandler = this.getClickToCallHandler(); | |
if (getClickToCallHandler) { | |
getClickToCallHandler.filterPhoneOnlyBetsFromCookie(); | |
} | |
} else { | |
this.handleInProg("show"); | |
} | |
if (this.postPayload) { | |
this._b365BsAJAX.Post(this.postPayload); | |
} else { | |
this._b365BsAJAX.Load("POST"); | |
} | |
} else { | |
/** @type {boolean} */ | |
req = false; | |
} | |
return req; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
reqComplete : function() { | |
this.unlock(); | |
delete this._b365BsAJAX; | |
/** @type {null} */ | |
this._b365BsAJAX = null; | |
this.restoreState(); | |
var fnc = this.getHandler("onreqcomplete"); | |
if (fnc) { | |
fnc(this, arguments); | |
} else { | |
this.handleInProg("hide", ""); | |
} | |
}, | |
/** | |
* @param {?} e | |
* @return {undefined} | |
*/ | |
reqTimeout : function(e) { | |
if (this.isSiteOverlaySpinnerShowing) { | |
/** @type {boolean} */ | |
this.isSiteOverlaySpinnerShowing = !this._controller.hideSiteOverlaySpinner(); | |
} | |
this.displayError(betSlipML.timeout, e); | |
if (this._controller) { | |
if (this._controller.clientEnhancedMode()) { | |
$("#bsDiv").find(".disableBetSlip, .disabledBetSlip").removeClass("disableBetSlip").removeClass("disabledBetSlip"); | |
} | |
} | |
}, | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @param {?} e | |
* @return {undefined} | |
*/ | |
reqError : function(dataAndEvents, deepDataAndEvents, e) { | |
if (this.isSiteOverlaySpinnerShowing) { | |
/** @type {boolean} */ | |
this.isSiteOverlaySpinnerShowing = !this._controller.hideSiteOverlaySpinner(); | |
} | |
this.displayError(betSlipML.error, e, "error"); | |
if (this._controller) { | |
if (this._controller.clientEnhancedMode()) { | |
$("#bsDiv").find(".disableBetSlip, .disabledBetSlip").removeClass("disableBetSlip").removeClass("disabledBetSlip"); | |
} | |
} | |
}, | |
/** | |
* @param {?} deepDataAndEvents | |
* @param {?} e | |
* @param {string} message | |
* @return {undefined} | |
*/ | |
displayError : function(deepDataAndEvents, e, message) { | |
if (this._ajaxInstId == e) { | |
this.setClearOnAdd(false); | |
this.resetPoll(); | |
this.unlock(); | |
this.handleInProg("hide", deepDataAndEvents, typeof message != "undefined" ? message : "alert"); | |
/** @type {null} */ | |
this._b365BsAJAX = null; | |
} | |
}, | |
/** | |
* @param {string} option | |
* @param {?} deepDataAndEvents | |
* @param {string} dsep | |
* @return {undefined} | |
*/ | |
handleInProg : function(option, deepDataAndEvents, dsep) { | |
var throttledUpdate = this.getHandler("oninprogress"); | |
/** @type {number} */ | |
var reqTypePlaceBet = -1; | |
if (this._b365BsAJAX) { | |
if (this._b365BsAJAX._arguments.length > 7) { | |
reqTypePlaceBet = this._b365BsAJAX._arguments[7][0]; | |
} | |
} | |
if ((reqTypePlaceBet == this.reqTypePlaceBet || reqTypePlaceBet == this.reqTypeConfirmBet) && deepDataAndEvents || deepDataAndEvents == betSlipML.pleasecheckmembers) { | |
deepDataAndEvents = betSlipML.pleasecheckmembers; | |
this.onPBetError(); | |
} | |
if (throttledUpdate) { | |
throttledUpdate(this, [option, deepDataAndEvents, reqTypePlaceBet, typeof dsep != "undefined" ? dsep : "alert"]); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
contentChangedOnClient : function() { | |
var throttledUpdate = this.getHandler("oncontentchangedclient"); | |
if (throttledUpdate) { | |
throttledUpdate(this); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
contentLoaded : function() { | |
var detachEvent = this.getHandler("oncontentloaded"); | |
if (detachEvent) { | |
detachEvent(this); | |
} | |
}, | |
/** | |
* @param {string} type | |
* @return {?} | |
*/ | |
getHandler : function(type) { | |
return this._events.getHandler(type); | |
}, | |
/** | |
* @param {string} str | |
* @param {string} expected | |
* @return {undefined} | |
*/ | |
setValueInBSCookie : function(str, expected) { | |
$bSys.setValueInCookie(this._betSlipCookieKey, str, expected, true); | |
}, | |
/** | |
* @param {string} str | |
* @param {string} bytes | |
* @return {?} | |
*/ | |
getValueFromBSCookie : function(str, bytes) { | |
return $bSys.getValueFromCookie(this._betSlipCookieKey, str, bytes); | |
}, | |
/** | |
* @param {string} deepDataAndEvents | |
* @return {?} | |
*/ | |
readBSCookieValue : function(deepDataAndEvents) { | |
return $bSys.readCookie(deepDataAndEvents); | |
}, | |
/** | |
* @param {string} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
backupBSCookieValue : function(deepDataAndEvents) { | |
this._betSlipCookieBackup = this.readBSCookieValue(deepDataAndEvents); | |
}, | |
/** | |
* @param {string} deepDataAndEvents | |
* @param {string} message | |
* @return {undefined} | |
*/ | |
restoreBSCookieValue : function(deepDataAndEvents, message) { | |
$bSys.setCookieValue(deepDataAndEvents, message); | |
}, | |
/** | |
* @param {string} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
backupPushBetPreSplitBSCookieValue : function(deepDataAndEvents) { | |
this._pushBetSlipCookieBackup = this.readBSCookieValue(deepDataAndEvents); | |
}, | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
setPendingPushBet : function(dataAndEvents, deepDataAndEvents) { | |
this.pushBetStatus = dataAndEvents; | |
this.pendingPushBetElement = deepDataAndEvents; | |
}, | |
/** | |
* @return {?} | |
*/ | |
getPendingPushBetStatus : function() { | |
return this.pushBetStatus; | |
}, | |
/** | |
* @return {?} | |
*/ | |
getPendingPushBetElement : function() { | |
return this.pendingPushBetElement; | |
}, | |
/** | |
* @return {?} | |
*/ | |
getController : function() { | |
return this._controller; | |
}, | |
/** | |
* @return {?} | |
*/ | |
getClickToCallHandler : function() { | |
return this._clickToCallHandler; | |
}, | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
setClickToCallHandler : function(dataAndEvents) { | |
this._clickToCallHandler = dataAndEvents; | |
} | |
}; | |
bs = new b365.Ui.BetSlipAPI("bs"); | |
Sys.Application.add_load(Function.createDelegate(bs, bs.pageLoad)); | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} deepDataAndEvents | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.QuickBet = function(deepDataAndEvents, dataAndEvents) { | |
this._bsController = dataAndEvents; | |
this._bsInst = deepDataAndEvents; | |
this._bsContext = dataAndEvents._bsContext; | |
/** @type {boolean} */ | |
this._inplay = false; | |
/** @type {boolean} */ | |
this._quickBetVisible = false; | |
/** @type {boolean} */ | |
this._switchEnabled = false; | |
/** @type {boolean} */ | |
this._tooltipDismissed = false; | |
/** @type {null} */ | |
this._tooltipElement = null; | |
/** @type {boolean} */ | |
this.initialised = false; | |
if (this.isQuickBetLoaded()) { | |
this.initQuickBet(); | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.hasBets = function() { | |
return this._bsInst.getBetItems && this._bsInst.getBetItems(this._bsInst.betTypeAll).length > 0; | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @param {(boolean|string)} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.toggleQuickBetVisibility = function(deepDataAndEvents, dataAndEvents) { | |
var currState = this.getState(); | |
var domElement; | |
var elem; | |
if (deepDataAndEvents) { | |
if (domElement = document.querySelector(".bs-Header_Hide"), domElement && (domElement.className = domElement.className.replace("bs-Header_Hide", "")), currState) { | |
if (dataAndEvents) { | |
this.setMessage(false); | |
this.setSwitch(false); | |
/** @type {(Element|null)} */ | |
elem = document.querySelector(".qb-Btn-hidden"); | |
if (elem) { | |
/** @type {string} */ | |
elem.className = "qb-Btn"; | |
} | |
} else { | |
this.setMessage(true); | |
/** @type {(Element|null)} */ | |
elem = document.querySelector(".qb-Btn-hidden"); | |
/** @type {(Element|null)} */ | |
var expandIconEl = document.querySelector(".qb-Help_Wrapper-inactive"); | |
/** @type {(Element|null)} */ | |
var o = document.querySelector(".bs-BetSlipType"); | |
if (elem) { | |
/** @type {string} */ | |
elem.className = "qb-Btn"; | |
} | |
if (expandIconEl) { | |
/** @type {string} */ | |
expandIconEl.className = "qb-Help_Wrapper-active"; | |
} | |
if (o) { | |
/** @type {string} */ | |
o.className = "bs-BetSlipType-inactive"; | |
} | |
} | |
} else { | |
/** @type {(Element|null)} */ | |
elem = document.querySelector(".qb-Btn-hidden"); | |
if (elem) { | |
/** @type {string} */ | |
elem.className = "qb-Btn"; | |
} | |
} | |
/** @type {boolean} */ | |
this._quickBetVisible = true; | |
} else { | |
if (dataAndEvents || (domElement = document.querySelector(".bs-Header"), domElement && (domElement.className.indexOf("bs-Header_Hide") == -1 && (domElement.className = domElement.className + " bs-Header_Hide"))), currState) { | |
if (dataAndEvents) { | |
this.setMessage(false); | |
/** @type {(Element|null)} */ | |
elem = document.querySelector(".qb-Btn"); | |
if (elem) { | |
/** @type {string} */ | |
elem.className = "qb-Btn-hidden"; | |
} | |
} else { | |
this.setMessage(false); | |
/** @type {(Element|null)} */ | |
elem = document.querySelector(".qb-Btn"); | |
/** @type {(Element|null)} */ | |
expandIconEl = document.querySelector(".qb-Help_Wrapper-active"); | |
/** @type {(Element|null)} */ | |
o = document.querySelector(".bs-BetSlipType-inactive"); | |
if (elem) { | |
/** @type {string} */ | |
elem.className = "qb-Btn-hidden"; | |
} | |
if (expandIconEl) { | |
/** @type {string} */ | |
expandIconEl.className = "qb-Help_Wrapper-inactive"; | |
} | |
if (o) { | |
/** @type {string} */ | |
o.className = "bs-BetSlipType qb-BetSlipType"; | |
} | |
} | |
} else { | |
/** @type {(Element|null)} */ | |
elem = document.querySelector(".qb-Btn"); | |
if (elem) { | |
/** @type {string} */ | |
elem.className = "qb-Btn-hidden"; | |
} | |
} | |
/** @type {boolean} */ | |
this._quickBetVisible = false; | |
this._bsContext.ToggleQuickBetHelpTooltip(false); | |
this.removeTooltip(); | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.removeQuickBet = function() { | |
/** @type {(Element|null)} */ | |
var elem = document.querySelector(".bs-BetSlipType"); | |
/** @type {(Element|null)} */ | |
var tabPage = document.querySelector(".qb-Container"); | |
/** @type {(Element|null)} */ | |
var bufferTile = document.querySelector(".qb-QuickBetMsg-inactive"); | |
/** @type {(Element|null)} */ | |
var st = document.querySelector(".qb-Help_Wrapper-inactive"); | |
if (tabPage) { | |
tabPage.parentNode.removeChild(tabPage); | |
} | |
if (elem) { | |
/** @type {string} */ | |
elem.className = "bs-BetSlipType"; | |
} | |
if (bufferTile) { | |
bufferTile.parentNode.removeChild(bufferTile); | |
} | |
if (st) { | |
st.parentNode.removeChild(st); | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.isQuickBetLoaded = function() { | |
/** @type {(Element|null)} */ | |
var n = document.querySelector(".qb-Container"); | |
return n != null; | |
}; | |
/** | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.getState = function() { | |
return localStorage ? this._bsController.getQuickBetEnabled() : this._switchEnabled; | |
}; | |
/** | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.setState = function(recurring) { | |
if (localStorage) { | |
this._bsController.setQuickBetEnabled(recurring); | |
} else { | |
/** @type {boolean} */ | |
this._switchEnabled = recurring; | |
} | |
}; | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.setSwitch = function(recurring) { | |
/** @type {(Element|null)} */ | |
var elem = document.querySelector(".qb-Btn_Switch-true, .qb-Btn_Switch-false"); | |
/** @type {string} */ | |
elem.className = "qb-Btn_Switch-" + recurring; | |
}; | |
/** | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.setSwitchAndState = function(recurring) { | |
if (recurring && this.hasBets()) { | |
(new b365.Ui.Betslip.ConfirmationDialog(this._bsInst, this._bsController)).showQuickBetActivationDialog(); | |
return; | |
} | |
if (recurring && !this._bsContext.IsAuthenticated()) { | |
this._bsController.clientQuickBetLoginDelegate(); | |
return; | |
} | |
this.setSwitch(recurring); | |
this.setState(recurring); | |
if (!recurring) { | |
this._bsContext.clientAddQuickBetToBetslip(); | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.getTooltipDismissed = function() { | |
return localStorage ? this._bsController.getQuickBetTooltipDismissed() : this._tooltipDismissed; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.setTooltipDismissed = function() { | |
if (localStorage) { | |
this._bsController.setQuickBetTooltipDismissed(true); | |
} else { | |
/** @type {boolean} */ | |
this._tooltipDismissed = true; | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.showTooltip = function() { | |
var dom = this; | |
/** @type {(Element|null)} */ | |
var fragment = document.querySelector(".qb-Btn_Switch-false"); | |
var script; | |
var line; | |
var elem; | |
var div; | |
if (fragment) { | |
if (!this._tooltipElement) { | |
/** @type {(Element|null)} */ | |
script = document.querySelector(".bs-Header"); | |
/** @type {string} */ | |
line = script.getAttribute("data-text"); | |
/** @type {Element} */ | |
dom._tooltipElement = document.createElement("DIV"); | |
/** @type {string} */ | |
dom._tooltipElement.className = "qb-Tooltip"; | |
/** @type {Element} */ | |
elem = document.createElement("DIV"); | |
/** @type {string} */ | |
elem.className = "qb-Tooltip_Nib"; | |
fragment.appendChild(elem); | |
/** @type {Element} */ | |
div = document.createElement("DIV"); | |
/** @type {string} */ | |
div.className = "qb-Tooltip_Text"; | |
div.appendChild(document.createTextNode(line)); | |
dom._tooltipElement.appendChild(div); | |
script.appendChild(dom._tooltipElement); | |
setTimeout(function() { | |
dom._tooltipElement.className += " qb-Tooltip-visible"; | |
elem.className += " qb-Tooltip_Nib-visible"; | |
}, 0); | |
dom.setTooltipDismissed(); | |
setTimeout(function() { | |
/** @type {string} */ | |
dom._tooltipElement.className = "qb-Tooltip"; | |
/** @type {string} */ | |
elem.className = "qb-Tooltip_Nib"; | |
}, 1E4); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.hideTooltip = function() { | |
/** @type {(Element|null)} */ | |
var elem = document.querySelector(".qb-Tooltip-visible"); | |
/** @type {(Element|null)} */ | |
var expandIconEl = document.querySelector(".qb-Tooltip_Nib-visible"); | |
if (elem) { | |
/** @type {string} */ | |
elem.className = "qb-Tooltip"; | |
} | |
if (expandIconEl) { | |
/** @type {string} */ | |
expandIconEl.className = "qb-Tooltip_Nib"; | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.removeTooltip = function() { | |
/** @type {(Element|null)} */ | |
var tabPage = document.querySelector(".qb-Tooltip"); | |
/** @type {(Element|null)} */ | |
var bufferTile = document.querySelector(".qb-Tooltip_Nib-visible"); | |
if (tabPage) { | |
tabPage.parentNode.removeChild(tabPage); | |
} | |
if (bufferTile) { | |
bufferTile.parentNode.removeChild(bufferTile); | |
} | |
}; | |
/** | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.setMessage = function(recurring) { | |
var node; | |
var element; | |
var elem; | |
var expandIconEl; | |
var y; | |
if (recurring) { | |
/** @type {(Element|null)} */ | |
node = document.querySelector(".bs-EmptyMsg"); | |
/** @type {(Element|null)} */ | |
element = document.querySelector(".qb-QuickBetMsg-inactive"); | |
/** @type {(Element|null)} */ | |
elem = document.querySelector(".bs-BetSlipType"); | |
/** @type {(Element|null)} */ | |
expandIconEl = document.querySelector(".qb-Help_Wrapper-inactive"); | |
if (node) { | |
if (element) { | |
if (elem) { | |
if (expandIconEl) { | |
y = node.offsetHeight; | |
/** @type {string} */ | |
element.style.height = y + "px"; | |
/** @type {string} */ | |
node.className = "qb-EmptyMsg"; | |
/** @type {string} */ | |
element.className = "qb-QuickBetMsg-active"; | |
/** @type {string} */ | |
elem.className = "bs-BetSlipType-inactive"; | |
/** @type {string} */ | |
expandIconEl.className = "qb-Help_Wrapper-active"; | |
} | |
} | |
} | |
} | |
} else { | |
/** @type {(Element|null)} */ | |
node = document.querySelector(".qb-EmptyMsg"); | |
/** @type {(Element|null)} */ | |
element = document.querySelector(".qb-QuickBetMsg-active"); | |
/** @type {(Element|null)} */ | |
elem = document.querySelector(".bs-BetSlipType-inactive"); | |
/** @type {(Element|null)} */ | |
expandIconEl = document.querySelector(".qb-Help_Wrapper-active"); | |
if (node) { | |
if (element) { | |
if (elem) { | |
if (expandIconEl) { | |
/** @type {string} */ | |
element.style.height = ""; | |
/** @type {string} */ | |
node.className = "bs-EmptyMsg"; | |
/** @type {string} */ | |
element.className = "qb-QuickBetMsg-inactive"; | |
/** @type {string} */ | |
elem.className = "bs-BetSlipType qb-BetSlipType"; | |
/** @type {string} */ | |
expandIconEl.className = "qb-Help_Wrapper-inactive"; | |
} | |
} | |
} | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.isAustralianDomain = function() { | |
return this._bsController.IsAustralianDomain(); | |
}; | |
/** | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.isInplay = function() { | |
return this._inplay; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.initQuickBet = function() { | |
var self = this; | |
var recurring; | |
if (self.isAustralianDomain()) { | |
self.removeQuickBet(); | |
self.setState(false); | |
} else { | |
/** @type {boolean} */ | |
self.initialised = true; | |
/** | |
* @return {undefined} | |
*/ | |
this._bsContext.ToggleQuickBet = function() { | |
if (self.hasBets()) { | |
self.setSwitchAndState(true); | |
} else { | |
self.setSwitchAndState(!self.getState()); | |
} | |
self.setMessage(self.getState()); | |
self.hideTooltip(); | |
if (!self.getState()) { | |
self._bsContext.ToggleQuickBetHelpTooltip(false); | |
} | |
}; | |
if (!this._bsContext.IsAuthenticated() || self.hasBets()) { | |
self.setState(false); | |
} | |
recurring = self.getState(); | |
self.setSwitch(recurring); | |
self.setMessage(recurring); | |
} | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.navigationChanged = function(deepDataAndEvents) { | |
var self = this; | |
var recurring; | |
this._inplay = deepDataAndEvents; | |
recurring = this.getState(); | |
if (deepDataAndEvents === recurring) { | |
this.setSwitch(recurring); | |
} | |
if (deepDataAndEvents) { | |
if (!this.getTooltipDismissed()) { | |
/** | |
* @return {undefined} | |
*/ | |
this._bsContext.RemoveQuickBetTooltip = function() { | |
self.removeTooltip(); | |
}; | |
this.showTooltip(); | |
} | |
} | |
this.toggleQuickBetVisibility(deepDataAndEvents, this.hasBets()); | |
}; | |
/** | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.QuickBet.prototype.canHandleBets = function() { | |
return this.getState() && (this._quickBetVisible && !this.hasBets()); | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.InputFocusClassHelper = function() { | |
/** @type {string} */ | |
this._focusClassName = "focus"; | |
}; | |
/** | |
* @param {Object} thingy | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.InputFocusClassHelper.prototype.addFocusClassToElement = function(thingy) { | |
if (!thingy.hasClass(this._focusClassName)) { | |
thingy.addClass(this._focusClassName); | |
} | |
}; | |
/** | |
* @param {Object} thingy | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.InputFocusClassHelper.prototype.removeFocusClassFromElement = function(thingy) { | |
if (thingy.hasClass(this._focusClassName)) { | |
thingy.removeClass(this._focusClassName); | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.InputFocusClassHelper.prototype.addFocusClassToAllStakeFields = function() { | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.InputFocusClassHelper.prototype.removeFocusClassFromAllStakeFields = function() { | |
var $span = $('input[class*=" focus"]', "#bsDiv"); | |
if ($span.length > 0) { | |
$span.removeClass("focus"); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.StakeEntryKeyboard = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @param {Event} e | |
* @return {?} | |
*/ | |
this._validTarget = function(e) { | |
return e.target.tagName == "INPUT" && (e.target.type == "text" || (e.target.type == "number" || e.target.type == "tel")); | |
}; | |
/** | |
* @param {Element} element | |
* @return {undefined} | |
*/ | |
this._clearMultiSingle = function(element) { | |
/** @type {(HTMLElement|null)} */ | |
var el = document.getElementById("mltsngstk"); | |
if (el) { | |
if (element.value !== el.value) { | |
if (!(element.className.indexOf("bs-MultipleBets_Stake") > -1)) { | |
/** @type {string} */ | |
el.value = ""; | |
if ($("html").is(".ie-8, .ie-9")) { | |
if (el.className.indexOf("bs-Stake_TextBox-placeholder") == -1) { | |
el.className += " bs-Stake_TextBox-placeholder"; | |
} | |
/** @type {string} */ | |
el.value = el.getAttribute("placeholder"); | |
} | |
} | |
} | |
} | |
}; | |
this._stakeEntryRule = this._bsController.stakeEntryRule(); | |
}; | |
b365.Ui.Betslip.StakeEntryKeyboard.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
init : function() { | |
var self = this; | |
if (self._isValid()) { | |
if ($("html").is(".ie-8, .ie-9")) { | |
$("#bsDiv").off("keyup").on("keyup", function(e) { | |
var cz = e.keyCode ? e.keyCode : e.charCode; | |
e.target = e.target || e.srcElement; | |
if (self._validTarget(e)) { | |
if (cz == 13) { | |
document.activeElement.blur(); | |
e.preventDefault(); | |
} | |
if (typeof self._stakeEntryRule == "function") { | |
if (cz == 110 || (cz == 188 || cz == 190)) { | |
self._stakeEntryRule(e.target); | |
} | |
} | |
(new b365.Ui.Betslip.StakeChangedHandler(self._bsInst, self._bsController)).handle(e.target); | |
self._clearMultiSingle(e.target); | |
} | |
e.stopPropagation(); | |
}); | |
} else { | |
$("#bsDiv").off("input").on("input", function(evt) { | |
evt.target = evt.target || evt.srcElement; | |
if (self._validTarget(evt)) { | |
(new b365.Ui.Betslip.StakeChangedHandler(self._bsInst, self._bsController)).handle(evt.target); | |
} | |
self._clearMultiSingle(evt.target); | |
evt.stopPropagation(); | |
}); | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
detach : function() { | |
this._isValid(); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} op | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.CurrencyDisplayHelper = function(dataAndEvents, op) { | |
this._betSlipController = dataAndEvents; | |
this._decimalSeperator = op.decimalSeparator; | |
this._thousandsSeperator = op.thousandsSeparator; | |
}; | |
/** | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.CurrencyDisplayHelper.prototype.getDecimalSeperator = function() { | |
return this._decimalSeperator; | |
}; | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.CurrencyDisplayHelper.prototype.formatCurrency = function(value) { | |
var parts = value.toString().split("."); | |
return isNaN(value) || parts.length != 2 ? value : parts[0].replace(/\B(?=(\d{3})+(?=$))/g, "") + (parts[1] ? this._decimalSeperator + parts[1] : ""); | |
}; | |
/** | |
* @param {string} val | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.CurrencyDisplayHelper.prototype.unformatCurrency = function(val) { | |
var value; | |
var regex; | |
return isNaN(val) ? (regex = new RegExp("[" + this._thousandsSeperator + "]", "g"), value = val.replace(regex, ""), value = value.replace(this._decimalSeperator, "."), value = parseFloat(value).toFixed(2), isNaN(value) && (value = "0"), value) : val; | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipAnimations = function(dataAndEvents) { | |
this._betSlipController = dataAndEvents; | |
/** @type {string} */ | |
this._animationEndEvents = "animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd"; | |
this._removeSingleBets = { | |
animationClass : "removeBetElementFade", | |
secondAnimationClass : "removeBetElementShrink", | |
animationEndName : "FadeOut", | |
secondAnimationEndName : "Shrink" | |
}; | |
this._hideStakePad = { | |
animationClass : "hideStakePad", | |
animationClassFast : "hideStakePadQuickly", | |
animationEndName : "HideStakePad" | |
}; | |
this._showStakePad = { | |
animationClass : "showStakePad", | |
animationClassFast : "showStakePadQuickly", | |
animationEndName : "ShowStakePad" | |
}; | |
this._disableBetSlip = { | |
animationClass : "disableBetSlip", | |
animationEndName : "Disabled", | |
disabledClass : "disabledBetSlip" | |
}; | |
this._enableBetSlip = { | |
animationClass : "enableBetSlip", | |
animationEndName : "Enabled" | |
}; | |
this._shakeStakeFields = { | |
animationClass : "shakeStakeField", | |
animationEndName : "Shake", | |
focusClass : "focus" | |
}; | |
}; | |
/** | |
* @param {Object} first | |
* @param {boolean} recurring | |
* @param {Object} dom | |
* @param {?} result | |
* @param {Array} dataAndEvents | |
* @param {?} value | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipAnimations.prototype.removeSingleBet = function(first, recurring, dom, result, dataAndEvents, value) { | |
var binding = this; | |
var fd = result; | |
/** @type {Array} */ | |
var typePattern = dataAndEvents; | |
var suiteView = value; | |
/** @type {Object} */ | |
var last = first; | |
if (this._betSlipController._stakeEntryHander.detach(), recurring) { | |
first.on(this._animationEndEvents, function(e) { | |
if (e.originalEvent.animationName) { | |
switch(e.originalEvent.animationName) { | |
case binding._hideStakePad.animationEndName: | |
last.addClass(binding._removeSingleBets.animationClass); | |
break; | |
case binding._removeSingleBets.animationEndName: | |
last.addClass(binding._removeSingleBets.secondAnimationClass); | |
break; | |
case binding._removeSingleBets.secondAnimationEndName: | |
last.off(binding._animationEndEvents); | |
if (fd) { | |
binding.doCallBack(fd, typePattern, suiteView); | |
} | |
; | |
} | |
} | |
}); | |
dom.attr("class", this._hideStakePad.animationClass); | |
} else { | |
first.on(this._animationEndEvents, function(e) { | |
if (e.originalEvent.animationName) { | |
switch(e.originalEvent.animationName) { | |
case binding._removeSingleBets.animationEndName: | |
last.addClass(binding._removeSingleBets.secondAnimationClass); | |
break; | |
case binding._removeSingleBets.secondAnimationEndName: | |
last.off(binding._animationEndEvents); | |
if (fd) { | |
binding.doCallBack(fd, typePattern, suiteView); | |
} | |
; | |
} | |
} | |
}); | |
first.addClass(binding._removeSingleBets.animationClass); | |
} | |
}; | |
/** | |
* @param {Node} $target | |
* @param {boolean} recurring | |
* @param {string} arg | |
* @param {?} result | |
* @param {Array} givenArgs | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipAnimations.prototype.removeAllBets = function($target, recurring, arg, result, givenArgs, dataAndEvents) { | |
var binding = this; | |
var _this = $("#bsDiv"); | |
var baseSize = $target.length; | |
/** @type {number} */ | |
var digit = 0; | |
var fd = result; | |
/** @type {Array} */ | |
var args = givenArgs; | |
var suiteView = dataAndEvents; | |
/** @type {Node} */ | |
var content = $target; | |
if (this._betSlipController._stakeEntryHander.detach(), recurring) { | |
_this.on(this._animationEndEvents, function(e) { | |
if (e.originalEvent.animationName) { | |
switch(e.originalEvent.animationName) { | |
case binding._hideStakePad.animationEndName: | |
content.addClass(binding._removeSingleBets.animationClass); | |
break; | |
case binding._removeSingleBets.animationEndName: | |
$(e.target).addClass(binding._removeSingleBets.secondAnimationClass); | |
break; | |
case binding._removeSingleBets.secondAnimationEndName: | |
digit += 1; | |
if (digit >= baseSize) { | |
_this.off(binding._animationEndEvents); | |
if (fd) { | |
binding.doCallBack(fd, args, suiteView); | |
} | |
} | |
; | |
} | |
} | |
}); | |
arg.attr("class", this._hideStakePad.animationClass); | |
} else { | |
_this.on(this._animationEndEvents, function(e) { | |
if (e.originalEvent.animationName) { | |
switch(e.originalEvent.animationName) { | |
case binding._removeSingleBets.animationEndName: | |
$(e.target).addClass(binding._removeSingleBets.secondAnimationClass); | |
break; | |
case binding._removeSingleBets.secondAnimationEndName: | |
digit += 1; | |
if (digit >= baseSize) { | |
_this.off(binding._animationEndEvents); | |
if (fd) { | |
binding.doCallBack(fd, args, suiteView); | |
} | |
} | |
; | |
} | |
} | |
}); | |
$target.addClass(binding._removeSingleBets.animationClass); | |
} | |
}; | |
/** | |
* @param {Node} first | |
* @param {Object} el | |
* @param {boolean} recurring | |
* @param {string} b | |
* @param {?} startOrEnd | |
* @param {Array} mayParseLabeledStatementInstead | |
* @param {?} value | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipAnimations.prototype.hideBetMultiples = function(first, el, recurring, b, startOrEnd, mayParseLabeledStatementInstead, value) { | |
var that = this; | |
var pos = first.length; | |
/** @type {number} */ | |
var i = 0; | |
var end = startOrEnd; | |
/** @type {Array} */ | |
var typePattern = mayParseLabeledStatementInstead; | |
var suiteView = value; | |
/** @type {Object} */ | |
var obj = el; | |
/** @type {Node} */ | |
var next = first; | |
if (this._betSlipController._stakeEntryHander.detach(), recurring) { | |
el.on(this._animationEndEvents, function(e) { | |
if (e.originalEvent.animationName) { | |
switch(e.originalEvent.animationName) { | |
case that._hideStakePad.animationEndName: | |
next.addClass(that._removeSingleBets.animationClass); | |
break; | |
case that._removeSingleBets.animationEndName: | |
$(e.target).addClass(that._removeSingleBets.secondAnimationClass); | |
break; | |
case that._removeSingleBets.secondAnimationEndName: | |
i += 1; | |
if (i >= pos) { | |
obj.off(that._animationEndEvents); | |
if (end) { | |
that.doCallBack(end, typePattern, suiteView); | |
} | |
} | |
; | |
} | |
} | |
}); | |
b.attr("class", this._hideStakePad.animationClass); | |
} else { | |
el.on(this._animationEndEvents, function(e) { | |
if (e.originalEvent.animationName) { | |
switch(e.originalEvent.animationName) { | |
case that._removeSingleBets.animationEndName: | |
$(e.target).addClass(that._removeSingleBets.secondAnimationClass); | |
break; | |
case that._removeSingleBets.secondAnimationEndName: | |
i += 1; | |
if (i >= pos) { | |
obj.off(that._animationEndEvents); | |
if (end) { | |
that.doCallBack(end, typePattern, suiteView); | |
} | |
} | |
; | |
} | |
} | |
}); | |
first.addClass(that._removeSingleBets.animationClass); | |
} | |
}; | |
/** | |
* @param {Node} node | |
* @param {Object} element | |
* @param {Array} recurring | |
* @param {Array} A | |
* @param {Array} computed | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipAnimations.prototype.shakeStakeFields = function(node, element, recurring, A, computed) { | |
var self = this; | |
var l = node.length; | |
/** @type {number} */ | |
var f = 0; | |
/** @type {Array} */ | |
var fd = recurring; | |
/** @type {Array} */ | |
var message = A; | |
/** @type {Array} */ | |
var result = computed; | |
/** @type {Object} */ | |
var $element = element; | |
/** @type {Node} */ | |
var current = node; | |
element.on(this._animationEndEvents, function(e) { | |
if (e.originalEvent.animationName) { | |
if (e.originalEvent.animationName == self._shakeStakeFields.animationEndName) { | |
f += 1; | |
if (f >= l) { | |
current.removeClass(self._shakeStakeFields.animationClass); | |
$element.off(self._animationEndEvents); | |
if (fd) { | |
self.doCallBack(fd, message, result); | |
} | |
} | |
} | |
} | |
}); | |
node.removeClass(self._shakeStakeFields.focusClass).removeClass(self._shakeStakeFields.animationClass).addClass(self._shakeStakeFields.focusClass).addClass(self._shakeStakeFields.animationClass); | |
}; | |
/** | |
* @param {Object} body | |
* @param {boolean} dataAndEvents | |
* @param {?} startOrEnd | |
* @param {Array} recurring | |
* @param {?} computed | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipAnimations.prototype.hideStakePad = function(body, dataAndEvents, startOrEnd, recurring, computed) { | |
var self = this; | |
/** @type {Object} */ | |
var b = body; | |
var end = startOrEnd; | |
/** @type {Array} */ | |
var typePattern = recurring; | |
var result = computed; | |
body.on(this._animationEndEvents, function(e) { | |
if (e.originalEvent.animationName) { | |
if (e.originalEvent.animationName == self._hideStakePad.animationEndName) { | |
b.off(this._animationEndEvents); | |
if (end) { | |
self.doCallBack(end, typePattern, result); | |
} | |
} | |
} | |
}); | |
body.attr("class", dataAndEvents ? this._hideStakePad.animationClassFast : this._hideStakePad.animationClass); | |
}; | |
/** | |
* @param {Object} c | |
* @param {?} b | |
* @param {?} startOrEnd | |
* @param {?} dataAndEvents | |
* @param {?} computed | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipAnimations.prototype.showStakePad = function(c, b, startOrEnd, dataAndEvents, computed) { | |
var self = this; | |
/** @type {Object} */ | |
var control = c; | |
var end = startOrEnd; | |
var typePattern = dataAndEvents; | |
var result = computed; | |
c.on(this._animationEndEvents, function(e) { | |
if (e.originalEvent.animationName) { | |
if (e.originalEvent.animationName == self._showStakePad.animationEndName) { | |
control.off(this._animationEndEvents); | |
if (end) { | |
self.doCallBack(end, typePattern, result); | |
} | |
} | |
} | |
}); | |
c.attr("class", b ? this._showStakePad.animationClassFast : this._showStakePad.animationClass); | |
}; | |
/** | |
* @param {Node} $target | |
* @param {Object} input | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipAnimations.prototype.disableBetSlip = function($target, input) { | |
var o = this; | |
var baseSize = $target.length; | |
/** @type {number} */ | |
var digit = 0; | |
/** @type {Object} */ | |
var result = input; | |
/** @type {Node} */ | |
var content = $target; | |
input.on(this._animationEndEvents, function(e) { | |
if (e.originalEvent.animationName) { | |
if (e.originalEvent.animationName == o._disableBetSlip.animationEndName) { | |
digit += 1; | |
if (digit >= baseSize) { | |
result.off(o._animationEndEvents); | |
content.removeClass(o._disableBetSlip.animationClass).addClass(o._disableBetSlip.disabledClass); | |
} | |
} | |
} | |
}); | |
$target.addClass(o._disableBetSlip.animationClass); | |
}; | |
/** | |
* @param {Node} $li | |
* @param {Object} input | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipAnimations.prototype.enableBetSlip = function($li, input) { | |
var o = this; | |
var baseSize = $li.length; | |
/** @type {number} */ | |
var digit = 0; | |
/** @type {Object} */ | |
var result = input; | |
/** @type {Node} */ | |
var listEntries = $li; | |
input.on(this._animationEndEvents, function(e) { | |
if (e.originalEvent.animationName) { | |
if (e.originalEvent.animationName == o._enableBetSlip.animationEndName) { | |
digit += 1; | |
if (digit >= baseSize) { | |
result.off(o._animationEndEvents); | |
listEntries.removeClass(o._enableBetSlip.animationClass); | |
} | |
} | |
} | |
}); | |
$li.removeClass(o._disableBetSlip.disabledClass).addClass(o._enableBetSlip.animationClass); | |
}; | |
/** | |
* @param {?} cb | |
* @param {?} args | |
* @param {?} obj | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipAnimations.prototype.doCallBack = function(cb, args, obj) { | |
if (args) { | |
if (obj) { | |
cb.apply(obj, args); | |
} else { | |
cb.apply(null, args); | |
} | |
} else { | |
cb(); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTypeSelector = function(dataAndEvents) { | |
this._betSlipController = dataAndEvents; | |
/** @type {Array} */ | |
this._clickHandlers = []; | |
/** @type {Array} */ | |
this._siteClickHandlers = []; | |
/** @type {null} */ | |
this._selectClickHandler = null; | |
/** @type {boolean} */ | |
this._isShowing = false; | |
/** @type {boolean} */ | |
this._enabled = false; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTypeSelector.prototype.showPopUpMenu = function() { | |
var _this = this; | |
var token; | |
var elem; | |
_this.hideOtherPopUps(_this); | |
/** @type {(HTMLElement|null)} */ | |
token = document.getElementById("betSlipTypeOptions"); | |
/** @type {(HTMLElement|null)} */ | |
elem = document.getElementById("betSlipTypeSelection"); | |
if (token.className.indexOf("showing") === -1) { | |
token.className += " showing"; | |
elem.className += " showing"; | |
_this.addHandlers(this); | |
/** @type {boolean} */ | |
_this._isShowing = true; | |
_this._betSlipController.webPopupManager.popupShow(token, function() { | |
_this.hidePopUpMenu(); | |
}); | |
} else { | |
/** @type {boolean} */ | |
_this._isShowing = true; | |
_this.hidePopUpMenu(); | |
} | |
/** @type {null} */ | |
token = null; | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTypeSelector.prototype.hideOtherPopUps = function(_this) { | |
if (_this._betSlipController._enhancedBetSlipOddsSelector) { | |
if (_this._betSlipController._enhancedBetSlipOddsSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipOddsSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipOddsSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipPitcherSelector) { | |
if (_this._betSlipController._enhancedBetSlipPitcherSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipPitcherSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipPitcherSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipIfBetSelector) { | |
if (_this._betSlipController._enhancedBetSlipIfBetSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipIfBetSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipIfBetSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipTeaserTypeSelector) { | |
if (_this._betSlipController._enhancedBetSlipTeaserTypeSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipTeaserTypeSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipTeaserTypeSelector); | |
} | |
} | |
if (_this._betSlipController._stakeEntryType != _this._betSlipController._stakeEntryTypes.deviceKeyBoard) { | |
if (_this._betSlipController._stakeEntryHander._isShowing) { | |
_this._betSlipController._stakeEntryHander.hide(); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipWinPlaceEachWay) { | |
if (_this._betSlipController._enhancedBetSlipWinPlaceEachWay._isShowing) { | |
_this._betSlipController._enhancedBetSlipWinPlaceEachWay.hidePopUpMenu(_this._betSlipController._enhancedBetSlipWinPlaceEachWay); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTypeSelector.prototype.hidePopUpMenu = function() { | |
var domElement; | |
var o; | |
var c = this; | |
if (c._isShowing) { | |
/** @type {(HTMLElement|null)} */ | |
domElement = document.getElementById("betSlipTypeOptions"); | |
/** @type {(HTMLElement|null)} */ | |
o = document.getElementById("betSlipTypeSelection"); | |
if (domElement.className.indexOf("showing") > -1) { | |
/** @type {string} */ | |
domElement.className = domElement.className.replace(" showing", ""); | |
/** @type {string} */ | |
o.className = o.className.replace(" showing", ""); | |
} | |
c.removeHandlers(this); | |
/** @type {boolean} */ | |
c._isShowing = false; | |
c._betSlipController.webPopupManager.popupHide(); | |
/** @type {null} */ | |
domElement = null; | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTypeSelector.prototype.addHandlers = function(_this) { | |
/** @type {(HTMLElement|null)} */ | |
var expression = document.getElementById("BetSlipDialogueHeader"); | |
/** @type {(HTMLElement|null)} */ | |
var preamble = document.getElementById("bsDiv"); | |
/** @type {(HTMLElement|null)} */ | |
var results_holder = document.getElementById("betSlipTypeOptions"); | |
var lis = $("li", results_holder); | |
var _i; | |
var _len; | |
if (_this.removeHandlers(_this), lis.length > 0) { | |
/** @type {number} */ | |
_i = 0; | |
_len = lis.length; | |
for (;_i < _len;_i++) { | |
_this._clickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(lis[_i], $.proxy(_this.handleSelection, _this), false)); | |
} | |
} | |
if (expression) { | |
_this._siteClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(expression, $.proxy(_this.hidePopUpMenu, _this), false)); | |
} | |
_this._siteClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(preamble, $.proxy(_this.hidePopUpMenu, _this), false)); | |
/** @type {null} */ | |
expression = null; | |
/** @type {null} */ | |
preamble = null; | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTypeSelector.prototype.removeHandlers = function(_this) { | |
var i; | |
var valsLength; | |
if (_this._clickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._clickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._clickHandlers[i]._element) { | |
_this._clickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._clickHandlers = []; | |
} | |
if (_this._siteClickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._siteClickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._siteClickHandlers[i]._element) { | |
_this._siteClickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._siteClickHandlers = []; | |
} | |
}; | |
/** | |
* @param {Event} e | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTypeSelector.prototype.handleSelection = function(e) { | |
/** @type {(HTMLElement|null)} */ | |
var receivedElement = document.getElementById("betSlipTypeOptions"); | |
/** @type {(HTMLElement|null)} */ | |
var me = document.getElementById("betSlipTypeSelectionText"); | |
var dateString = e.target.getAttribute("data-item"); | |
var html = e.target.innerHTML; | |
e.stopPropagation(); | |
if (html !== "") { | |
if (html.indexOf("<span") == -1) { | |
me.innerHTML = html; | |
$("#bsDiv .bs-BetSlipType select").val(dateString).change(); | |
receivedElement.setAttribute("style", "display:none;"); | |
} | |
} | |
/** @type {null} */ | |
receivedElement = null; | |
/** @type {null} */ | |
me = null; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTypeSelector.prototype.disablePopUp = function() { | |
var _this = this; | |
_this.hidePopUpMenu(); | |
if (_this._selectClickHandler !== null) { | |
if (_this._selectClickHandler._element) { | |
_this._selectClickHandler.destroy(); | |
} | |
} | |
/** @type {null} */ | |
_this._selectClickHandler = null; | |
/** @type {boolean} */ | |
_this._enabled = false; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTypeSelector.prototype.enablePopUp = function() { | |
var _this = this; | |
/** @type {(HTMLElement|null)} */ | |
var el = document.getElementById("betSlipTypeSelection"); | |
if (_this._selectClickHandler !== null && _this._selectClickHandler._element) { | |
/** @type {boolean} */ | |
_this._enabled = true; | |
return; | |
} | |
if (_this.removeHandlers(_this), !el) { | |
/** @type {boolean} */ | |
_this._enabled = false; | |
/** @type {boolean} */ | |
_this._isShowing = false; | |
return; | |
} | |
_this._selectClickHandler = new b365.Ui.Betslip.ResponsiveClickHandler(el, $.proxy(_this.showPopUpMenu, _this), false); | |
/** @type {boolean} */ | |
_this._enabled = true; | |
/** @type {null} */ | |
el = null; | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipOddsSelector = function(dataAndEvents) { | |
this._betSlipController = dataAndEvents; | |
/** @type {Array} */ | |
this._clickHandlers = []; | |
/** @type {Array} */ | |
this._siteClickHandlers = []; | |
/** @type {Array} */ | |
this._selectClickHandlers = []; | |
this._betSlipWrapper = $("#bsDiv"); | |
/** @type {null} */ | |
this._currentMenu = null; | |
/** @type {null} */ | |
this._currentSelector = null; | |
/** @type {null} */ | |
this._currentSelect = null; | |
/** @type {boolean} */ | |
this._isShowing = false; | |
/** @type {boolean} */ | |
this._enabled = false; | |
}; | |
/** | |
* @param {Object} ev | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipOddsSelector.prototype.showPopUpMenu = function(ev) { | |
var _this = this; | |
var img; | |
var form; | |
var node; | |
if (ev.stopPropagation(), img = $(ev.target), img.hasClass("bs-OddsChoice_SelectionText") && (img = img.parent()), form = img.parent().find(".bs-OddsChoice_Options"), node = img.parent().find("select.odds"), _this._enabled && !node.hasClass("disabled")) { | |
_this.hideOtherPopUps(_this); | |
if (form.length > 0 && !form.hasClass("showing")) { | |
if (_this._isShowing) { | |
if (_this._currentMenu != null) { | |
_this._currentMenu.removeClass("showing"); | |
} | |
} | |
_this._currentMenu = form; | |
_this._currentMenu.addClass("showing"); | |
_this.addHandlers(_this); | |
_this._currentSelector = img; | |
_this._currentSelect = node; | |
/** @type {boolean} */ | |
_this._isShowing = true; | |
_this._betSlipController.webPopupManager.popupShow(form[0], function() { | |
_this.hidePopUpMenu(); | |
}); | |
} else { | |
_this.hidePopUpMenu(); | |
} | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipOddsSelector.prototype.hideOtherPopUps = function(_this) { | |
if (_this._betSlipController._enhancedBetSlipTypeSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipTypeSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipTypeSelector); | |
} | |
if (_this._betSlipController._enhancedBetSlipPitcherSelector) { | |
if (_this._betSlipController._enhancedBetSlipPitcherSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipPitcherSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipPitcherSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipIfBetSelector) { | |
if (_this._betSlipController._enhancedBetSlipIfBetSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipIfBetSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipIfBetSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipTeaserTypeSelector) { | |
if (_this._betSlipController._enhancedBetSlipTeaserTypeSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipTeaserTypeSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipTeaserTypeSelector); | |
} | |
} | |
if (_this._betSlipController._stakeEntryType != _this._betSlipController._stakeEntryTypes.deviceKeyBoard) { | |
if (_this._betSlipController._stakeEntryHander._isShowing) { | |
_this._betSlipController._stakeEntryHander.hide(); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipWinPlaceEachWay) { | |
if (_this._betSlipController._enhancedBetSlipWinPlaceEachWay._isShowing) { | |
_this._betSlipController._enhancedBetSlipWinPlaceEachWay.hidePopUpMenu(_this._betSlipController._enhancedBetSlipWinPlaceEachWay); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipOddsSelector.prototype.hidePopUpMenu = function() { | |
var _this = this; | |
if (_this._isShowing) { | |
if (_this._currentMenu != null) { | |
_this._currentMenu.removeClass("showing"); | |
_this.removeHandlers(_this); | |
/** @type {null} */ | |
_this._currentMenu = null; | |
/** @type {null} */ | |
_this._currentSelector = null; | |
/** @type {null} */ | |
_this._currentSelect = null; | |
/** @type {boolean} */ | |
_this._isShowing = false; | |
_this._betSlipController.webPopupManager.popupHide(); | |
} | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @param {number} _actual | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipOddsSelector.prototype.addSelectHandlers = function(_this, _actual) { | |
var i; | |
var valsLength; | |
if (_actual.length == 0 && (_actual = $(".bs-OddsChoice_Selection", _this._betSlipWrapper)), _actual != 0) { | |
/** @type {Array} */ | |
_this._selectClickHandlers = []; | |
/** @type {number} */ | |
i = 0; | |
valsLength = _actual.length; | |
for (;i < valsLength;i++) { | |
_this._selectClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(_actual[i], $.proxy(_this.showPopUpMenu, _this), false)); | |
} | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipOddsSelector.prototype.removeSelectHandlers = function(_this) { | |
var i; | |
var valsLength; | |
if (_this._selectClickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._selectClickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._selectClickHandlers[i]._element) { | |
_this._selectClickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._selectClickHandlers = []; | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipOddsSelector.prototype.addHandlers = function(_this) { | |
/** @type {(HTMLElement|null)} */ | |
var expression = document.getElementById("BetSlipDialogueHeader"); | |
var lis = _this._currentMenu.find("li"); | |
var _i; | |
var _len; | |
if (_this.removeHandlers(_this), lis.length > 0) { | |
/** @type {number} */ | |
_i = 0; | |
_len = lis.length; | |
for (;_i < _len;_i++) { | |
_this._clickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(lis[_i], $.proxy(_this.handleSelection, _this), false)); | |
} | |
} | |
if (expression) { | |
_this._siteClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(expression, $.proxy(_this.hidePopUpMenu, _this), false)); | |
} | |
_this._siteClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(_this._betSlipWrapper[0], $.proxy(_this.hidePopUpMenu, _this), false)); | |
/** @type {null} */ | |
expression = null; | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipOddsSelector.prototype.removeHandlers = function(_this) { | |
var i; | |
var valsLength; | |
if (_this._clickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._clickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._clickHandlers[i]._element) { | |
_this._clickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._clickHandlers = []; | |
} | |
if (_this._siteClickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._siteClickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._siteClickHandlers[i]._element) { | |
_this._siteClickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._siteClickHandlers = []; | |
} | |
}; | |
/** | |
* @param {Event} e | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipOddsSelector.prototype.handleSelection = function(e) { | |
var that = this; | |
var dateString = e.target.getAttribute("data-item"); | |
var html = e.target.innerHTML; | |
var lis = that._currentMenu.find("li"); | |
var me = that._currentSelector.find(".bs-OddsChoice_SelectionText")[0]; | |
var _i; | |
var _len; | |
if (e.stopPropagation(), html !== "" && html.indexOf("<span") == -1) { | |
me.innerHTML = html; | |
/** @type {number} */ | |
_i = 0; | |
_len = lis.length; | |
for (;_i < _len;_i++) { | |
lis[_i].className = lis[_i].className.replace("selected", ""); | |
} | |
that._currentSelect.val(dateString).change(); | |
e.target.parentElement.className += " selected"; | |
} | |
that.hidePopUpMenu(that); | |
(new b365.Ui.Betslip.OddsLineChangedHandler(this._betSlipController._bsInst, this._betSlipController)).handle(false); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipOddsSelector.prototype.disablePopUps = function() { | |
var _this = this; | |
_this.hidePopUpMenu(); | |
_this.removeSelectHandlers(_this); | |
/** @type {boolean} */ | |
_this._enabled = false; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipOddsSelector.prototype.enablePopUps = function() { | |
var _this = this; | |
var act = $(".bs-OddsChoice_Selection", _this._betSlipWrapper); | |
if (_this.removeHandlers(_this), _this.removeSelectHandlers(_this), act.length == 0) { | |
/** @type {boolean} */ | |
_this._enabled = false; | |
/** @type {boolean} */ | |
_this._isShowing = false; | |
return; | |
} | |
_this.addSelectHandlers(_this, act); | |
/** @type {boolean} */ | |
_this._enabled = true; | |
}; | |
/** | |
* @param {Object} item | |
* @param {string} results | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipOddsSelector.prototype.updateOdds = function(item, results) { | |
/** @type {NodeList} */ | |
var b = document.getElementsByClassName("bs-Item"); | |
var chunk; | |
var list; | |
var next; | |
var bi; | |
var root; | |
var i; | |
var j; | |
results = results || item.OD; | |
/** @type {number} */ | |
bi = 0; | |
for (;bi < b.length;bi++) { | |
if (root = b[bi], root.getAttribute("data-item-fpid") === item.ID) { | |
chunk = root.getElementsByClassName("odds")[0]; | |
list = root.getElementsByClassName("bs-Dropdown_ItemText"); | |
next = root.getElementsByClassName("odds-selection")[0]; | |
if (next.getAttribute("data-text") !== "SP") { | |
next.setAttribute("data-text", results); | |
} | |
/** @type {number} */ | |
i = 0; | |
for (;i < chunk.children.length;i++) { | |
if (chunk.children[i].value !== "SP") { | |
/** @type {string} */ | |
chunk.children[i].value = results; | |
/** @type {string} */ | |
chunk.children[i].innerHTML = results; | |
break; | |
} | |
} | |
/** @type {number} */ | |
j = 0; | |
for (;j < list.length;j++) { | |
if (list[j].getAttribute("data-item") !== "SP") { | |
/** @type {string} */ | |
list[j].innerHTML = results; | |
list[j].setAttribute("data-item", results); | |
break; | |
} | |
} | |
break; | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipPitcherSelector = function(dataAndEvents) { | |
this._betSlipController = dataAndEvents; | |
/** @type {Array} */ | |
this._clickHandlers = []; | |
/** @type {Array} */ | |
this._siteClickHandlers = []; | |
/** @type {Array} */ | |
this._selectClickHandlers = []; | |
this._betSlipWrapper = $("#bsDiv"); | |
/** @type {null} */ | |
this._currentMenu = null; | |
/** @type {null} */ | |
this._currentSelector = null; | |
/** @type {null} */ | |
this._currentSelect = null; | |
/** @type {boolean} */ | |
this._isShowing = false; | |
/** @type {boolean} */ | |
this._enabled = false; | |
}; | |
/** | |
* @param {Object} ev | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipPitcherSelector.prototype.showPopUpMenu = function(ev) { | |
var _this = this; | |
var img; | |
var form; | |
var node; | |
if (img = $(ev.target), img.hasClass("bs-Pitcher_SelectionText") && (img = img.parent()), form = img.parent().find(".bs-Pitcher_Options"), node = img.parent().find("select.pitcher-sel"), ev.stopPropagation(), _this._enabled && !node.hasClass("disabled")) { | |
_this.hideOtherPopUps(_this); | |
if (form.length > 0 && !form.hasClass("showing")) { | |
if (_this._isShowing) { | |
if (_this._currentMenu != null) { | |
_this._currentMenu.removeClass("showing"); | |
} | |
} | |
_this._currentMenu = form; | |
_this._currentMenu.addClass("showing"); | |
_this.addHandlers(_this); | |
_this._currentSelector = img; | |
_this._currentSelector.addClass("showing"); | |
_this._currentSelect = node; | |
/** @type {boolean} */ | |
_this._isShowing = true; | |
_this._betSlipController.webPopupManager.popupShow(form[0], function() { | |
_this.hidePopUpMenu(); | |
}); | |
} else { | |
_this.hidePopUpMenu(); | |
} | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipPitcherSelector.prototype.hideOtherPopUps = function(_this) { | |
if (_this._betSlipController._enhancedBetSlipTypeSelector) { | |
if (_this._betSlipController._enhancedBetSlipTypeSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipTypeSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipTypeSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipOddsSelector) { | |
if (_this._betSlipController._enhancedBetSlipOddsSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipOddsSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipOddsSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipIfBetSelector) { | |
if (_this._betSlipController._enhancedBetSlipIfBetSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipIfBetSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipIfBetSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipTeaserTypeSelector) { | |
if (_this._betSlipController._enhancedBetSlipTeaserTypeSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipTeaserTypeSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipTeaserTypeSelector); | |
} | |
} | |
if (_this._betSlipController._stakeEntryType != _this._betSlipController._stakeEntryTypes.deviceKeyBoard) { | |
if (_this._betSlipController._stakeEntryHander._isShowing) { | |
_this._betSlipController._stakeEntryHander.hide(); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipWinPlaceEachWay) { | |
if (_this._betSlipController._enhancedBetSlipWinPlaceEachWay._isShowing) { | |
_this._betSlipController._enhancedBetSlipWinPlaceEachWay.hidePopUpMenu(_this._betSlipController._enhancedBetSlipWinPlaceEachWay); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipPitcherSelector.prototype.hidePopUpMenu = function() { | |
var _this = this; | |
if (_this._isShowing) { | |
if (_this._currentMenu != null) { | |
_this._currentMenu.removeClass("showing"); | |
_this._currentSelector.removeClass("showing"); | |
_this.removeHandlers(_this); | |
/** @type {null} */ | |
_this._currentMenu = null; | |
/** @type {null} */ | |
_this._currentSelector = null; | |
/** @type {null} */ | |
_this._currentSelect = null; | |
/** @type {boolean} */ | |
_this._isShowing = false; | |
_this._betSlipController.webPopupManager.popupHide(); | |
} | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @param {number} _actual | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipPitcherSelector.prototype.addSelectHandlers = function(_this, _actual) { | |
var i; | |
var valsLength; | |
if (_actual.length == 0 && (_actual = $(".bs-Pitcher_Selection", _this._betSlipWrapper)), _actual != 0) { | |
/** @type {Array} */ | |
_this._selectClickHandlers = []; | |
/** @type {number} */ | |
i = 0; | |
valsLength = _actual.length; | |
for (;i < valsLength;i++) { | |
_this._selectClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(_actual[i], $.proxy(_this.showPopUpMenu, _this), false)); | |
} | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipPitcherSelector.prototype.removeSelectHandlers = function(_this) { | |
var i; | |
var valsLength; | |
if (_this._selectClickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._selectClickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._selectClickHandlers[i]._element) { | |
_this._selectClickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._selectClickHandlers = []; | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipPitcherSelector.prototype.addHandlers = function(_this) { | |
/** @type {(HTMLElement|null)} */ | |
var expression = document.getElementById("BetSlipDialogueHeader"); | |
var lis = _this._currentMenu.find("li"); | |
var _i; | |
var _len; | |
if (_this.removeHandlers(_this), lis.length > 0) { | |
/** @type {number} */ | |
_i = 0; | |
_len = lis.length; | |
for (;_i < _len;_i++) { | |
_this._clickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(lis[_i], $.proxy(_this.handleSelection, _this), false)); | |
} | |
} | |
if (expression) { | |
_this._siteClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(expression, $.proxy(_this.hidePopUpMenu, _this), false)); | |
} | |
_this._siteClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(_this._betSlipWrapper[0], $.proxy(_this.hidePopUpMenu, _this), false)); | |
/** @type {null} */ | |
expression = null; | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipPitcherSelector.prototype.removeHandlers = function(_this) { | |
var i; | |
var valsLength; | |
if (_this._clickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._clickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._clickHandlers[i]._element) { | |
_this._clickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._clickHandlers = []; | |
} | |
if (_this._siteClickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._siteClickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._siteClickHandlers[i]._element) { | |
_this._siteClickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._siteClickHandlers = []; | |
} | |
}; | |
/** | |
* @param {Event} e | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipPitcherSelector.prototype.handleSelection = function(e) { | |
var u = this; | |
var dateString = e.target.getAttribute("data-item"); | |
e.stopPropagation(); | |
if (e.target.parentElement.className.indexOf("selected") === -1) { | |
u._currentSelect.val(dateString).change(); | |
} | |
u._betSlipController.refreshBetslip(); | |
u.hidePopUpMenu(u); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipPitcherSelector.prototype.disablePopUps = function() { | |
var _this = this; | |
_this.hidePopUpMenu(); | |
_this.removeSelectHandlers(_this); | |
/** @type {boolean} */ | |
_this._enabled = false; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipPitcherSelector.prototype.enablePopUps = function() { | |
var _this = this; | |
var act = $(".bs-Pitcher_Selection", _this._betSlipWrapper); | |
if (_this.removeHandlers(_this), _this.removeSelectHandlers(_this), act.length == 0) { | |
/** @type {boolean} */ | |
_this._enabled = false; | |
/** @type {boolean} */ | |
_this._isShowing = false; | |
return; | |
} | |
_this.addSelectHandlers(_this, act); | |
/** @type {boolean} */ | |
_this._enabled = true; | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipIfBetSelector = function(dataAndEvents) { | |
this._betSlipController = dataAndEvents; | |
/** @type {Array} */ | |
this._clickHandlers = []; | |
/** @type {Array} */ | |
this._siteClickHandlers = []; | |
/** @type {Array} */ | |
this._selectClickHandlers = []; | |
this._betSlipWrapper = $("#bsDiv"); | |
/** @type {null} */ | |
this._currentMenu = null; | |
/** @type {null} */ | |
this._currentSelector = null; | |
/** @type {null} */ | |
this._currentSelect = null; | |
/** @type {boolean} */ | |
this._isShowing = false; | |
/** @type {boolean} */ | |
this._enabled = false; | |
}; | |
/** | |
* @param {Object} ev | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipIfBetSelector.prototype.showPopUpMenu = function(ev) { | |
var _this = this; | |
var domNode = $(ev.target); | |
var img; | |
var node; | |
if (ev.stopPropagation(), domNode.hasClass("bs-IfBetType_SelectionText") && (domNode = domNode.parent()), img = domNode.parent().find(".bs-IfBetType_Options"), node = domNode.parent().find("select.ifbetaction"), _this._enabled && !node.hasClass("disabled")) { | |
_this.hideOtherPopUps(_this); | |
if (img.length > 0 && !img.hasClass("showing")) { | |
if (_this._isShowing) { | |
if (_this._currentMenu != null) { | |
_this._currentMenu.removeClass("showing"); | |
} | |
} | |
_this._currentMenu = img; | |
_this._currentMenu.addClass("showing"); | |
_this.addHandlers(_this); | |
_this._currentSelector = domNode; | |
_this._currentSelector.addClass("showing"); | |
_this._currentSelect = node; | |
/** @type {boolean} */ | |
_this._isShowing = true; | |
_this._betSlipController.webPopupManager.popupShow(img[0], function() { | |
_this.hidePopUpMenu(); | |
}); | |
} else { | |
_this.hidePopUpMenu(); | |
} | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipIfBetSelector.prototype.hideOtherPopUps = function(_this) { | |
if (_this._betSlipController._enhancedBetSlipTypeSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipTypeSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipTypeSelector); | |
} | |
if (_this._betSlipController._enhancedBetSlipOddsSelector) { | |
if (_this._betSlipController._enhancedBetSlipOddsSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipOddsSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipOddsSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipPitcherSelector) { | |
if (_this._betSlipController._enhancedBetSlipPitcherSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipPitcherSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipPitcherSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipTeaserTypeSelector) { | |
if (_this._betSlipController._enhancedBetSlipTeaserTypeSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipTeaserTypeSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipTeaserTypeSelector); | |
} | |
} | |
if (_this._betSlipController._stakeEntryType != _this._betSlipController._stakeEntryTypes.deviceKeyBoard) { | |
if (_this._betSlipController._stakeEntryHander._isShowing) { | |
_this._betSlipController._stakeEntryHander.hide(); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipWinPlaceEachWay) { | |
if (_this._betSlipController._enhancedBetSlipWinPlaceEachWay._isShowing) { | |
_this._betSlipController._enhancedBetSlipWinPlaceEachWay.hidePopUpMenu(_this._betSlipController._enhancedBetSlipWinPlaceEachWay); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipIfBetSelector.prototype.hidePopUpMenu = function() { | |
var _this = this; | |
if (_this._isShowing) { | |
if (_this._currentMenu != null) { | |
_this._currentMenu.removeClass("showing"); | |
_this._currentSelector.removeClass("showing"); | |
_this.removeHandlers(_this); | |
/** @type {null} */ | |
_this._currentMenu = null; | |
/** @type {null} */ | |
_this._currentSelector = null; | |
/** @type {null} */ | |
_this._currentSelect = null; | |
/** @type {boolean} */ | |
_this._isShowing = false; | |
_this._betSlipController.webPopupManager.popupHide(); | |
} | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @param {number} _actual | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipIfBetSelector.prototype.addSelectHandlers = function(_this, _actual) { | |
var i; | |
var valsLength; | |
if (_actual.length == 0 && (_actual = $(".bs-IfBetType_Selection", _this._betSlipWrapper)), _actual != 0) { | |
/** @type {Array} */ | |
_this._selectClickHandlers = []; | |
/** @type {number} */ | |
i = 0; | |
valsLength = _actual.length; | |
for (;i < valsLength;i++) { | |
_this._selectClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(_actual[i], $.proxy(_this.showPopUpMenu, _this), false)); | |
} | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipIfBetSelector.prototype.removeSelectHandlers = function(_this) { | |
var i; | |
var valsLength; | |
if (_this._selectClickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._selectClickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._selectClickHandlers[i]._element) { | |
_this._selectClickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._selectClickHandlers = []; | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipIfBetSelector.prototype.addHandlers = function(_this) { | |
/** @type {(HTMLElement|null)} */ | |
var expression = document.getElementById("BetSlipDialogueHeader"); | |
var lis = _this._currentMenu.find("li"); | |
var _i; | |
var _len; | |
if (_this.removeHandlers(_this), lis.length > 0) { | |
/** @type {number} */ | |
_i = 0; | |
_len = lis.length; | |
for (;_i < _len;_i++) { | |
_this._clickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(lis[_i], $.proxy(_this.handleSelection, _this), false)); | |
} | |
} | |
if (expression) { | |
_this._siteClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(expression, $.proxy(_this.hidePopUpMenu, _this), false)); | |
} | |
_this._siteClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(_this._betSlipWrapper[0], $.proxy(_this.hidePopUpMenu, _this), false)); | |
/** @type {null} */ | |
expression = null; | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipIfBetSelector.prototype.removeHandlers = function(_this) { | |
var i; | |
var valsLength; | |
if (_this._clickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._clickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._clickHandlers[i]._element) { | |
_this._clickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._clickHandlers = []; | |
} | |
if (_this._siteClickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._siteClickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._siteClickHandlers[i]._element) { | |
_this._siteClickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._siteClickHandlers = []; | |
} | |
}; | |
/** | |
* @param {Event} e | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipIfBetSelector.prototype.handleSelection = function(e) { | |
var r20 = this; | |
var val = e.target.getAttribute("data-item"); | |
var html = e.target.innerHTML; | |
var itemIndexAndType = new b365.Ui.Betslip.ItemInformation(e.target); | |
var octalLiteral = itemIndexAndType.itemIndexAndType(); | |
var items; | |
var codeSegments; | |
var elem; | |
var id; | |
var dest; | |
var cn; | |
var i; | |
var mat; | |
if (e.stopPropagation(), e.target.parentElement.className.indexOf("selected") === -1) { | |
if (items = document.getElementsByClassName("bs-IfBetType"), octalLiteral[0] !== "0") { | |
/** @type {number} */ | |
id = parseInt(octalLiteral[0]); | |
items[id].getElementsByClassName("bs-IfBetType_SelectionText")[0].innerHTML = html; | |
codeSegments = items[id].getElementsByTagName("li"); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
cn = codeSegments[i].className; | |
if (cn.indexOf("selected") === -1) { | |
codeSegments[i].className += " selected"; | |
} else { | |
codeSegments[i].className = codeSegments[i].className.replace(" selected", ""); | |
} | |
} | |
elem = items[id].getElementsByTagName("select")[0]; | |
elem.value = val; | |
$(elem).change(); | |
} else { | |
/** @type {number} */ | |
i = 0; | |
for (;i < items.length;i++) { | |
items[i].getElementsByClassName("bs-IfBetType_SelectionText")[0].innerHTML = html; | |
codeSegments = items[i].getElementsByTagName("li"); | |
/** @type {number} */ | |
mat = 0; | |
for (;mat < codeSegments.length;mat++) { | |
cn = codeSegments[mat].className; | |
if (cn.indexOf("selected") === -1) { | |
if (i == 0) { | |
/** @type {number} */ | |
dest = mat; | |
} | |
if (mat == dest) { | |
codeSegments[mat].className += " selected"; | |
} | |
} else { | |
if (mat != dest) { | |
codeSegments[mat].className = codeSegments[mat].className.replace(" selected", ""); | |
} | |
} | |
} | |
elem = items[i].getElementsByTagName("select")[0]; | |
elem.value = val; | |
$(elem).change(); | |
} | |
} | |
} | |
r20.hidePopUpMenu(r20); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipIfBetSelector.prototype.disablePopUps = function() { | |
var _this = this; | |
_this.hidePopUpMenu(); | |
_this.removeSelectHandlers(_this); | |
/** @type {boolean} */ | |
_this._enabled = false; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipIfBetSelector.prototype.enablePopUps = function() { | |
var _this = this; | |
var act = $(".bs-IfBetType_Selection", _this._betSlipWrapper); | |
if (_this.removeHandlers(_this), _this.removeSelectHandlers(_this), act.length == 0) { | |
/** @type {boolean} */ | |
_this._enabled = false; | |
/** @type {boolean} */ | |
_this._isShowing = false; | |
return; | |
} | |
_this.addSelectHandlers(_this, act); | |
/** @type {boolean} */ | |
_this._enabled = true; | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTeaserTypeSelector = function(dataAndEvents) { | |
this._betSlipController = dataAndEvents; | |
/** @type {Array} */ | |
this._clickHandlers = []; | |
/** @type {Array} */ | |
this._siteClickHandlers = []; | |
/** @type {Array} */ | |
this._selectClickHandlers = []; | |
this._betSlipWrapper = $("#bsDiv"); | |
/** @type {null} */ | |
this._currentMenu = null; | |
/** @type {null} */ | |
this._currentSelector = null; | |
/** @type {null} */ | |
this._currentSelect = null; | |
/** @type {boolean} */ | |
this._isShowing = false; | |
/** @type {boolean} */ | |
this._enabled = false; | |
}; | |
/** | |
* @param {Object} ev | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTeaserTypeSelector.prototype.showPopUpMenu = function(ev) { | |
var _this = this; | |
var img; | |
var form; | |
var node; | |
if (menuLeftPadding = 10, img = $(ev.target), img.hasClass("bs-TeaserType_SelectionText") && (img = img.parent()), form = img.parent().find(".bs-TeaserType_Options"), node = img.parent().find("select.teaserSel"), ev.stopPropagation(), _this._enabled && !node.hasClass("disabled")) { | |
_this.hideOtherPopUps(_this); | |
if (form.length > 0 && !form.hasClass("showing")) { | |
if (_this._isShowing) { | |
if (_this._currentMenu != null) { | |
_this._currentMenu.removeClass("showing"); | |
_this._currentSelector.removeClass("showing"); | |
} | |
} | |
_this._currentMenu = form; | |
_this._currentMenu.addClass("showing"); | |
if (img.position().left < 20) { | |
_this._currentMenu.addClass("iswrapped"); | |
_this._currentMenu.css({ | |
left : "", | |
minWidth : "" | |
}); | |
} else { | |
if (document.body.className.indexOf("expanded") > -1) { | |
_this._currentMenu.css({ | |
minWidth : "", | |
left : img.position().left - menuLeftPadding + "px" | |
}); | |
} else { | |
_this._currentMenu.css({ | |
left : "", | |
minWidth : document.getElementById("betslipContainer").clientWidth - img.position().left + menuLeftPadding + "px" | |
}); | |
} | |
} | |
_this.addHandlers(_this); | |
_this._currentSelector = img; | |
_this._currentSelector.addClass("showing"); | |
_this._currentSelect = node; | |
/** @type {boolean} */ | |
_this._isShowing = true; | |
_this._betSlipController.webPopupManager.popupShow(form[0], function() { | |
_this.hidePopUpMenu(); | |
}); | |
} else { | |
_this.hidePopUpMenu(); | |
} | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTeaserTypeSelector.prototype.hideOtherPopUps = function(_this) { | |
if (_this._betSlipController._enhancedBetSlipTypeSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipTypeSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipTypeSelector); | |
} | |
if (_this._betSlipController._enhancedBetSlipOddsSelector) { | |
if (_this._betSlipController._enhancedBetSlipOddsSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipOddsSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipOddsSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipPitcherSelector) { | |
if (_this._betSlipController._enhancedBetSlipPitcherSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipPitcherSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipPitcherSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipIfBetSelector) { | |
if (_this._betSlipController._enhancedBetSlipIfBetSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipIfBetSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipIfBetSelector); | |
} | |
} | |
if (_this._betSlipController._stakeEntryType != _this._betSlipController._stakeEntryTypes.deviceKeyBoard) { | |
if (_this._betSlipController._stakeEntryHander._isShowing) { | |
_this._betSlipController._stakeEntryHander.hide(); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipWinPlaceEachWay) { | |
if (_this._betSlipController._enhancedBetSlipWinPlaceEachWay._isShowing) { | |
_this._betSlipController._enhancedBetSlipWinPlaceEachWay.hidePopUpMenu(_this._betSlipController._enhancedBetSlipWinPlaceEachWay); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTeaserTypeSelector.prototype.hidePopUpMenu = function() { | |
var _this = this; | |
if (_this._isShowing) { | |
if (_this._currentMenu != null) { | |
_this._currentMenu.removeClass("showing"); | |
_this._currentMenu.removeClass("iswrapped"); | |
_this._currentSelector.removeClass("showing"); | |
_this.removeHandlers(_this); | |
/** @type {null} */ | |
_this._currentMenu = null; | |
/** @type {null} */ | |
_this._currentSelector = null; | |
/** @type {null} */ | |
_this._currentSelect = null; | |
/** @type {boolean} */ | |
_this._isShowing = false; | |
_this._betSlipController.webPopupManager.popupHide(); | |
} | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @param {number} _actual | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTeaserTypeSelector.prototype.addSelectHandlers = function(_this, _actual) { | |
var i; | |
var valsLength; | |
if (_actual.length == 0 && (_actual = $(".bs-TeaserType_Selection", _this._betSlipWrapper)), _actual != 0) { | |
/** @type {Array} */ | |
_this._selectClickHandlers = []; | |
/** @type {number} */ | |
i = 0; | |
valsLength = _actual.length; | |
for (;i < valsLength;i++) { | |
_this._selectClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(_actual[i], $.proxy(_this.showPopUpMenu, _this), false)); | |
} | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTeaserTypeSelector.prototype.removeSelectHandlers = function(_this) { | |
var i; | |
var valsLength; | |
if (_this._selectClickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._selectClickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._selectClickHandlers[i]._element) { | |
_this._selectClickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._selectClickHandlers = []; | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTeaserTypeSelector.prototype.addHandlers = function(_this) { | |
/** @type {(HTMLElement|null)} */ | |
var expression = document.getElementById("BetSlipDialogueHeader"); | |
var lis = _this._currentMenu.find("li"); | |
var _i; | |
var _len; | |
if (_this.removeHandlers(_this), lis.length > 0) { | |
/** @type {number} */ | |
_i = 0; | |
_len = lis.length; | |
for (;_i < _len;_i++) { | |
_this._clickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(lis[_i], $.proxy(_this.handleSelection, _this), false)); | |
} | |
} | |
if (expression) { | |
_this._siteClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(expression, $.proxy(_this.hidePopUpMenu, _this), false)); | |
} | |
_this._siteClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(_this._betSlipWrapper[0], $.proxy(_this.hidePopUpMenu, _this), false)); | |
/** @type {null} */ | |
expression = null; | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTeaserTypeSelector.prototype.removeHandlers = function(_this) { | |
var i; | |
var valsLength; | |
if (_this._clickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._clickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._clickHandlers[i]._element) { | |
_this._clickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._clickHandlers = []; | |
} | |
if (_this._siteClickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._siteClickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._siteClickHandlers[i]._element) { | |
_this._siteClickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._siteClickHandlers = []; | |
} | |
}; | |
/** | |
* @param {Event} e | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTeaserTypeSelector.prototype.handleSelection = function(e) { | |
var u = this; | |
var dateString = e.target.getAttribute("data-item"); | |
e.stopPropagation(); | |
if (e.target.parentElement.className.indexOf("selected") === -1) { | |
u._currentSelect.val(dateString).change(); | |
} | |
u.hidePopUpMenu(u); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTeaserTypeSelector.prototype.disablePopUps = function() { | |
var _this = this; | |
_this.hidePopUpMenu(); | |
_this.removeSelectHandlers(_this); | |
/** @type {boolean} */ | |
_this._enabled = false; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipTeaserTypeSelector.prototype.enablePopUps = function() { | |
var _this = this; | |
var act = $(".bs-TeaserType_Selection", _this._betSlipWrapper); | |
if (_this.removeHandlers(_this), _this.removeSelectHandlers(_this), act.length == 0) { | |
/** @type {boolean} */ | |
_this._enabled = false; | |
/** @type {boolean} */ | |
_this._isShowing = false; | |
return; | |
} | |
_this.addSelectHandlers(_this, act); | |
/** @type {boolean} */ | |
_this._enabled = true; | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {(Object|boolean|number|string)} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipWinPlaceEachWay = function(dataAndEvents, deepDataAndEvents) { | |
/** @type {(Object|boolean|number|string)} */ | |
this._betSlipInstance = dataAndEvents; | |
this._betSlipController = deepDataAndEvents; | |
this._bsApp = window.bsApp; | |
/** @type {Array} */ | |
this._clickHandlers = []; | |
/** @type {Array} */ | |
this._siteClickHandlers = []; | |
/** @type {Array} */ | |
this._selectClickHandlers = []; | |
this._betSlipWrapper = $("#bsDiv"); | |
/** @type {null} */ | |
this._currentMenu = null; | |
/** @type {null} */ | |
this._currentSelector = null; | |
/** @type {null} */ | |
this._currentSelect = null; | |
/** @type {boolean} */ | |
this._isShowing = false; | |
/** @type {boolean} */ | |
this._enabled = true; | |
/** @type {string} */ | |
this._FIXED_EACH_WAY_PLBT_ID = "99991"; | |
/** @type {string} */ | |
this._TOTE_EACH_WAY_PLBT_ID = "99992"; | |
/** | |
* @param {Object} event | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipWinPlaceEachWay.prototype.showPopUpMenu = function(event) { | |
var _this = this; | |
var element; | |
var token; | |
var proposedId; | |
if (element = event.target, element.className.indexOf("bs-WinPlaceEachWay_SelectionText") > -1 && (element = element.parentNode), _this.itemInfo = new b365.Ui.Betslip.ItemInformation(event.target), token = element.parentNode.querySelectorAll(".bs-WinPlaceEachWay_Dropdown")[0], proposedId = element.parentNode.querySelectorAll("select")[0], event.stopPropagation(), _this._enabled) { | |
_this.hideOtherPopUps(_this); | |
if (token && !token.className.indexOf(" showing") > -1) { | |
if (_this._isShowing) { | |
if (_this._currentMenu != null) { | |
_this._currentMenu.className = _this._currentMenu.className.replace(" showing", ""); | |
} | |
} | |
_this._currentMenu = token; | |
_this._hideDropDownItemsAlreadyOnSlip(_this); | |
_this._hideSuspendedItems(_this, token); | |
/** @type {string} */ | |
_this._currentMenu.className = _this._currentMenu.className + " showing"; | |
_this.addHandlers(_this); | |
_this._currentSelector = element; | |
/** @type {string} */ | |
_this._currentSelector.className = _this._currentSelector.className + " showing"; | |
_this._currentSelect = proposedId; | |
/** @type {boolean} */ | |
_this._isShowing = true; | |
_this._betSlipController.webPopupManager.popupShow(token, function() { | |
_this.hidePopUpMenu(); | |
}); | |
} else { | |
_this.hidePopUpMenu(); | |
} | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipWinPlaceEachWay.prototype.hideOtherPopUps = function(_this) { | |
if (_this._betSlipController._enhancedBetSlipTypeSelector) { | |
if (_this._betSlipController._enhancedBetSlipTypeSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipTypeSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipTypeSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipOddsSelector) { | |
if (_this._betSlipController._enhancedBetSlipOddsSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipOddsSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipOddsSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipIfBetSelector) { | |
if (_this._betSlipController._enhancedBetSlipIfBetSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipIfBetSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipIfBetSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipTeaserTypeSelector) { | |
if (_this._betSlipController._enhancedBetSlipTeaserTypeSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipTeaserTypeSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipTeaserTypeSelector); | |
} | |
} | |
if (_this._betSlipController._enhancedBetSlipPitcherSelector) { | |
if (_this._betSlipController._enhancedBetSlipPitcherSelector._isShowing) { | |
_this._betSlipController._enhancedBetSlipPitcherSelector.hidePopUpMenu(_this._betSlipController._enhancedBetSlipPitcherSelector); | |
} | |
} | |
if (_this._betSlipController._stakeEntryType != _this._betSlipController._stakeEntryTypes.deviceKeyBoard) { | |
if (_this._betSlipController._stakeEntryHander._isShowing) { | |
_this._betSlipController._stakeEntryHander.hide(); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipWinPlaceEachWay.prototype.hidePopUpMenu = function() { | |
var _this = this; | |
if (_this._isShowing) { | |
if (_this._currentMenu != null) { | |
_this._currentMenu.className = _this._currentMenu.className.replace(" showing", ""); | |
_this._currentSelector.className = _this._currentSelector.className.replace(" showing", ""); | |
_this.removeHandlers(_this); | |
/** @type {null} */ | |
_this._currentMenu = null; | |
/** @type {null} */ | |
_this._currentSelector = null; | |
/** @type {null} */ | |
_this._currentSelect = null; | |
/** @type {boolean} */ | |
_this._isShowing = false; | |
_this._betSlipController.webPopupManager.popupHide(); | |
} | |
} | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipWinPlaceEachWay.prototype.addHandlers = function(_this) { | |
/** @type {(HTMLElement|null)} */ | |
var expression = document.getElementById("BetSlipDialogueHeader"); | |
var lis = _this._currentMenu.querySelectorAll("li"); | |
var _i; | |
var _len; | |
if (_this.removeHandlers(_this), lis.length > 0) { | |
/** @type {number} */ | |
_i = 0; | |
_len = lis.length; | |
for (;_i < _len;_i++) { | |
_this._clickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(lis[_i], $.proxy(_this.handleSelection, _this), false)); | |
} | |
} | |
if (expression) { | |
_this._siteClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(expression, $.proxy(_this.hidePopUpMenu, _this), false)); | |
} | |
_this._siteClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(_this._betSlipWrapper[0], $.proxy(_this.hidePopUpMenu, _this), false)); | |
}; | |
/** | |
* @param {?} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipWinPlaceEachWay.prototype.removeHandlers = function(_this) { | |
var i; | |
var valsLength; | |
if (_this._clickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._clickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._clickHandlers[i]._element) { | |
_this._clickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._clickHandlers = []; | |
} | |
if (_this._siteClickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = _this._siteClickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (_this._siteClickHandlers[i]._element) { | |
_this._siteClickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
_this._siteClickHandlers = []; | |
} | |
}; | |
/** | |
* @param {Event} event | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipWinPlaceEachWay.prototype.handleSelection = function(event) { | |
var _this = this; | |
var el = event.target; | |
var e; | |
var domElement; | |
var body; | |
var Enumerable; | |
/** @type {string} */ | |
var node = ""; | |
var restoreScript; | |
var elem; | |
var svgEl; | |
/** @type {string} */ | |
var errStr = ""; | |
var str; | |
/** @type {string} */ | |
var pre = ""; | |
var y; | |
var udataCur; | |
var context; | |
/** @type {string} */ | |
var key = ""; | |
/** @type {string} */ | |
var placeholder = ""; | |
var input; | |
if (!(event.target.className.indexOf("bs-WinPlaceEachWay_DropdownItem") > -1 && (el = event.target.parentElement), context = el.parentNode.parentNode.parentNode.parentNode, el.className.indexOf(" disabled") > -1)) { | |
e = el.children[0]; | |
domElement = _this._currentMenu.querySelectorAll("li.selected")[0]; | |
domElement.className = domElement.className.replace(" selected", ""); | |
/** @type {string} */ | |
el.className = el.className + " selected"; | |
body = e.getAttribute("data-item"); | |
if (body === _this._FIXED_EACH_WAY_PLBT_ID || body === _this._TOTE_EACH_WAY_PLBT_ID) { | |
elem = el.previousSibling.previousSibling.children[0]; | |
svgEl = el.previousSibling.children[0]; | |
Enumerable = elem.getAttribute("data-participantid"); | |
restoreScript = elem.getAttribute("data-odds"); | |
str = elem.getAttribute("data-displayodds"); | |
node = svgEl.getAttribute("data-participantid"); | |
errStr = svgEl.getAttribute("data-odds"); | |
pre = svgEl.getAttribute("data-displayodds"); | |
if (body === _this._FIXED_EACH_WAY_PLBT_ID) { | |
if (pre.length > 0) { | |
str += ", " + pre; | |
} | |
} | |
} else { | |
Enumerable = e.getAttribute("data-participantid"); | |
restoreScript = e.getAttribute("data-odds"); | |
str = e.getAttribute("data-displayodds"); | |
} | |
context.getElementsByClassName("bs-Odds")[0].innerText = str; | |
context.getElementsByClassName("bs-WinPlaceEachWay_SelectionText")[0].innerText = el.innerText; | |
_this._updateToteMessage(_this, e, context); | |
/** @type {boolean} */ | |
y = body === _this._FIXED_EACH_WAY_PLBT_ID || body === _this._TOTE_EACH_WAY_PLBT_ID; | |
udataCur = _this._isToteWin(body) || _this._isTotePlace(body); | |
_this._updateCookie(event, y, udataCur, domElement.children[0].getAttribute("data-participantid"), Enumerable, node, restoreScript, errStr); | |
bsApp.itemsRemoved(domElement.children[0].getAttribute("data-participantid")); | |
if (domElement.children[0].getAttribute("data-placeparticipantid")) { | |
bsApp.itemsRemoved(domElement.children[0].getAttribute("data-placeparticipantid")); | |
} | |
bsApp.addOnRefreshReqComplete(); | |
_this._betSlipController.updateMultiplesEachWayFlag(); | |
_this._betSlipInstance.updateState(); | |
_this._betSlipController.getMultipleInfo(); | |
_this._betSlipController._freeBetClickHandler.update(context); | |
input = $('input[data-inp-type="sngstk"]', context); | |
if (input) { | |
if (input.length > 0) { | |
key = y ? betSlipML.unitstake : betSlipML.stake; | |
input.attr("placeholder", key); | |
placeholder = input.val(); | |
if (placeholder == betSlipML.unitstake || placeholder == betSlipML.stake) { | |
input.val(key); | |
} | |
} | |
} | |
event.stopPropagation(); | |
_this.hidePopUpMenu(_this); | |
if (_this._bsApp.bsContext) { | |
if (_this._bsApp.bsContext.resizeBetslip) { | |
_this._bsApp.bsContext.resizeBetslip(); | |
} | |
} | |
} | |
}; | |
/** | |
* @param {?} client | |
* @param {Element} e | |
* @param {Object} root | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipWinPlaceEachWay.prototype._updateToteMessage = function(client, e, root) { | |
/** @type {string} */ | |
var total = "ausRacingToteTooltip"; | |
/** @type {string} */ | |
var urlConfigHtml = ""; | |
var failuresLink = e.getAttribute("data-item"); | |
var v = e.getAttribute("data-toteid"); | |
var div = root.getElementsByClassName("bs-WinPlaceEachWay_Tote")[0]; | |
if (client._isFixed(failuresLink) || failuresLink === client._FIXED_EACH_WAY_PLBT_ID) { | |
if (div.className.indexOf(" bs-WinPlaceEachWay_Tote-hidden") === -1) { | |
/** @type {string} */ | |
div.className = div.className + " bs-WinPlaceEachWay_Tote-hidden"; | |
} | |
return; | |
} | |
switch(v) { | |
case "1": | |
urlConfigHtml = betSlipML.ausRacingBest; | |
break; | |
case "2": | |
; | |
case "4": | |
urlConfigHtml = betSlipML.ausRacingTote; | |
break; | |
case "8": | |
urlConfigHtml = betSlipML.ausRacingMidPlus; | |
} | |
if (failuresLink === client._TOTE_EACH_WAY_PLBT_ID) { | |
total += "ToteEachWay"; | |
} else { | |
if (client._isToteWin(failuresLink)) { | |
total += "ToteWin"; | |
} else { | |
if (client._isTotePlace(failuresLink)) { | |
total += "TotePlace"; | |
} | |
} | |
} | |
total += v; | |
div.querySelectorAll(".bs-Tote_Popup")[0].innerHTML = betSlipML[total]; | |
div.querySelectorAll(".bs-WinPlaceEachWay_ToteText")[0].innerHTML = urlConfigHtml; | |
div.className = div.className.replace(" bs-WinPlaceEachWay_Tote-hidden", ""); | |
}; | |
/** | |
* @param {Event} event | |
* @param {?} v11 | |
* @param {boolean} value | |
* @param {?} src | |
* @param {(Error|string)} source | |
* @param {?} dataAndEvents | |
* @param {(Error|string)} callback | |
* @param {?} str | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipWinPlaceEachWay.prototype._updateCookie = function(event, v11, value, src, source, dataAndEvents, callback, str) { | |
var _betSlipInstance = this; | |
var itemIndexAndType = new b365.Ui.Betslip.ItemInformation(event.target); | |
var getBetItemById = itemIndexAndType.itemIndexAndType(); | |
var fs = _betSlipInstance._betSlipInstance.getBetItemById(getBetItemById[1], getBetItemById[0]); | |
var mediaElem; | |
var popups; | |
if (v11) { | |
fs.setStItem("ew", "1"); | |
fs.setCnItem("pp", dataAndEvents); | |
fs.setCnItem("po", str); | |
} else { | |
if (fs.getStItem("ew")) { | |
fs.removeStItem("ew"); | |
} | |
if (fs.getCnItem("pp")) { | |
fs.removeCnItem("pp"); | |
fs.removeCnItem("po"); | |
} | |
} | |
if (fs.getStItem("TP")) { | |
fs.setStItem("TP", fs.getStItem("TP").replace(src, source)); | |
} | |
if (fs.getStItem("id")) { | |
fs.setStItem("id", fs.getStItem("id").replace(src, source)); | |
} | |
if (fs.getCnItem("id")) { | |
fs.setCnItem("id", fs.getCnItem("id").replace(src, source)); | |
} | |
mediaElem = $("#bsDiv"); | |
popups = $('li[data-item-fpid="' + fs.getCnItem("fp") + '"]', mediaElem); | |
if (popups) { | |
if (popups.length > 0) { | |
popups[0].setAttribute("data-item-fpid", source); | |
} | |
} | |
fs.setCnItem("fp", source); | |
fs.setCnItem("o", callback); | |
fs.setCnItem("pt", value ? "A" : "N"); | |
}; | |
/** | |
* @param {Object} _this | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipWinPlaceEachWay.prototype._hideDropDownItemsAlreadyOnSlip = function(_this) { | |
var codeSegments = document.getElementsByClassName("bs-StandardBet")[0].querySelectorAll(".bs-WinPlaceEachWay_DropdownItem.selected"); | |
var els = _this._currentMenu.querySelectorAll(".bs-WinPlaceEachWay_DropdownItem.disabled"); | |
var i; | |
var max; | |
var closest; | |
var data_item; | |
var worlds; | |
var xs; | |
var _i; | |
var _len; | |
if (els.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
max = els.length; | |
for (;i < max;i++) { | |
els[i].className = els[i].className.replace(" disabled", ""); | |
} | |
} | |
if (codeSegments.length > 1) { | |
closest = _this._currentMenu.querySelectorAll(".bs-WinPlaceEachWay_DropdownItem.selected")[0]; | |
data_item = closest.children[0].getAttribute("data-item"); | |
xs = _this._betSlipInstance.getBetItems(_this._betSlipInstance.betTypeNormal); | |
worlds = _this._currentMenu.querySelectorAll(".bs-WinPlaceEachWay_DropdownItem"); | |
/** @type {number} */ | |
i = 0; | |
max = worlds.length; | |
for (;i < max;i++) { | |
if (worlds[i].className.indexOf(" disabled") === -1) { | |
var v = worlds[i].getElementsByClassName("bs-WinPlaceEachWay_DropdownItemText")[0]; | |
var x = v ? v.getAttribute("data-participantid") : 0; | |
var y = v ? v.getAttribute("data-placeparticipantid") : 0; | |
/** @type {number} */ | |
_i = 0; | |
_len = xs.length; | |
for (;_i < _len;_i++) { | |
if (_i.toString() !== _this.itemInfo.itemIndex()) { | |
if (x === xs[_i].getCnItem("fp") || (x === xs[_i].getCnItem("pp") || y === xs[_i].getCnItem("fp"))) { | |
/** @type {string} */ | |
worlds[i].className = worlds[i].className + " disabled"; | |
} | |
} | |
} | |
} | |
} | |
} | |
}; | |
/** | |
* @param {?} doc | |
* @param {Object} element | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipWinPlaceEachWay.prototype._hideSuspendedItems = function(doc, element) { | |
var arr = element.children[0].children; | |
var i; | |
var e = arr.length; | |
var elem; | |
var el; | |
/** @type {boolean} */ | |
var program = false; | |
/** @type {boolean} */ | |
var inverse = false; | |
/** @type {number} */ | |
i = 0; | |
e; | |
for (;i < e;i++) { | |
elem = arr[i].children[0]; | |
el = elem.getAttribute("data-item"); | |
if (el !== doc._FIXED_EACH_WAY_PLBT_ID || el !== doc._TOTE_EACH_WAY_PLBT_ID) { | |
if (elem.getAttribute("data-suspended") === "1") { | |
/** @type {string} */ | |
arr[i].className = arr[i].className + " disabled"; | |
if (doc._isFixed(el)) { | |
/** @type {boolean} */ | |
program = true; | |
} else { | |
if (doc._isToteWin(el) || doc._isTotePlace(el)) { | |
/** @type {boolean} */ | |
inverse = true; | |
} | |
} | |
} | |
} | |
} | |
if (program || inverse) { | |
/** @type {number} */ | |
i = 0; | |
e; | |
for (;i < e;i++) { | |
elem = arr[i].children[0]; | |
el = elem.getAttribute("data-item"); | |
if (el === doc._FIXED_EACH_WAY_PLBT_ID) { | |
if (program) { | |
/** @type {string} */ | |
arr[i].className = arr[i].className + " disabled"; | |
} | |
} | |
if (el === doc._TOTE_EACH_WAY_PLBT_ID) { | |
if (inverse) { | |
/** @type {string} */ | |
arr[i].className = arr[i].className + " disabled"; | |
} | |
} | |
} | |
} | |
}; | |
/** | |
* @param {string} el | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipWinPlaceEachWay.prototype._isFixed = function(el) { | |
return el === "20203" || (el === "20210" || (el === "40232" || (el === "40210" || (el === "880203" || (el === "880207" || (el === "20204" || (el === "20211" || (el === "40233" || (el === "40211" || (el === "880204" || el === "880208")))))))))) ? true : false; | |
}; | |
/** | |
* @param {string} el | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipWinPlaceEachWay.prototype._isToteWin = function(el) { | |
return el === "20205" || (el === "20212" || (el === "40234" || (el === "40212" || (el === "880205" || el === "880209")))) ? true : false; | |
}; | |
/** | |
* @param {string} el | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.EnhancedBetSlipWinPlaceEachWay.prototype._isTotePlace = function(el) { | |
return el === "20206" || (el === "20213" || (el === "40235" || (el === "40213" || (el === "880206" || el === "880210")))) ? true : false; | |
}; | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ReceiptLoadAnimation = function() { | |
}; | |
/** @type {string} */ | |
b365.Ui.Betslip.ReceiptLoadAnimation.prototype.CSS_CONTAINER = "br-Anim_Container"; | |
/** @type {string} */ | |
b365.Ui.Betslip.ReceiptLoadAnimation.prototype.CSS_HEADER = "br-Anim_Header"; | |
/** @type {string} */ | |
b365.Ui.Betslip.ReceiptLoadAnimation.prototype.CSS_FOOTER = "br-Anim_Footer"; | |
/** @type {string} */ | |
b365.Ui.Betslip.ReceiptLoadAnimation.prototype.CSS_FADEIN = "br-Anim_FadeIn"; | |
/** @type {string} */ | |
b365.Ui.Betslip.ReceiptLoadAnimation.prototype.CSS_FADEOUT = "br-Anim_FadeOut"; | |
/** @type {string} */ | |
b365.Ui.Betslip.ReceiptLoadAnimation.prototype.CSS_ANIMATE = "br-Anim-animate"; | |
/** @type {boolean} */ | |
b365.Ui.Betslip.ReceiptLoadAnimation.animationRunning = false; | |
/** @type {number} */ | |
b365.Ui.Betslip.ReceiptLoadAnimation.height = 0; | |
/** @type {null} */ | |
b365.Ui.Betslip.ReceiptLoadAnimation.controller = null; | |
/** | |
* @param {string} opt_attributes | |
* @param {number} height | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.ReceiptLoadAnimation.prototype.setup = function(opt_attributes, height) { | |
var p = this; | |
var configList; | |
var ln; | |
var l; | |
var textarea = document.getElementsByClassName(p.CSS_CONTAINER)[0]; | |
var codeSegments; | |
var dh; | |
var minHeight; | |
var elem; | |
var resultItems; | |
var i; | |
if (this.controller = opt_attributes, opt_attributes.IsGreekDomain) { | |
/** @type {NodeList} */ | |
codeSegments = document.getElementsByClassName("br-StakeToReturnContainer"); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
elem = codeSegments[i]; | |
minHeight = elem.offsetHeight; | |
for (;(elem = elem.parentElement) && elem.className.indexOf("br-Item") == -1;) { | |
} | |
if (elem) { | |
if (elem.offsetHeight < minHeight) { | |
/** @type {string} */ | |
elem.style.minHeight = minHeight + "px"; | |
} | |
} | |
} | |
} | |
if (this.animationRunning || !textarea) { | |
return false; | |
} | |
/** @type {boolean} */ | |
this.animationRunning = true; | |
/** @type {NodeList} */ | |
configList = document.getElementsByClassName(p.CSS_FOOTER); | |
/** @type {number} */ | |
dh = 0; | |
/** @type {number} */ | |
i = configList.length - 1; | |
for (;i >= 0;i--) { | |
if (dh) { | |
/** @type {string} */ | |
configList[i].style.marginBottom = dh + "px"; | |
} | |
dh += configList[i].clientHeight; | |
} | |
if (textarea.style.paddingBottom = dh + "px", p.height = document.getElementById("betslipContainer").clientHeight, p.height > height) { | |
/** @type {number} */ | |
l = -(p.height - height - 35); | |
/** @type {number} */ | |
i = 0; | |
/** @type {number} */ | |
ln = configList.length; | |
for (;i < ln;i++) { | |
/** @type {string} */ | |
configList[i].style.transform = "translateY(" + l + "px)"; | |
} | |
} | |
/** @type {NodeList} */ | |
resultItems = document.getElementsByClassName("br-FreeBetIcon"); | |
/** @type {number} */ | |
i = 0; | |
for (;i < resultItems.length;i++) { | |
/** @type {string} */ | |
resultItems[i].childNodes[3].style.transform = "translateX(-" + resultItems[i].childNodes[3].offsetWidth + "px)"; | |
} | |
return true; | |
}; | |
/** | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.ReceiptLoadAnimation.prototype.animate = function() { | |
var config = this; | |
var elem = document.getElementsByClassName(config.CSS_CONTAINER)[0]; | |
if (!this.animationRunning || !elem) { | |
return false; | |
} | |
elem.className += " " + config.CSS_ANIMATE; | |
requestAnimationFrame(function() { | |
/** @type {NodeList} */ | |
var codeSegments = document.getElementsByClassName("br-FreeBetIcon"); | |
/** @type {number} */ | |
var i = 0; | |
for (;i < codeSegments.length;i++) { | |
/** @type {string} */ | |
codeSegments[i].childNodes[3].style.transform = "translateX(0px)"; | |
/** @type {string} */ | |
codeSegments[i].className = codeSegments[i].className + " br-FreeBetIcon_Animate"; | |
} | |
}); | |
setTimeout(function() { | |
config._animationComplete(); | |
}, 300); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ReceiptLoadAnimation.prototype._animationComplete = function() { | |
var params = this; | |
var element; | |
var li; | |
if (params.animationRunning && (params.animationRunning = false, element = document.getElementsByClassName(params.CSS_CONTAINER)[0], element)) { | |
element.className = element.className.replace(params.CSS_CONTAINER, "").replace(params.CSS_ANIMATE, ""); | |
/** @type {string} */ | |
element.style.paddingBottom = ""; | |
/** @type {NodeList} */ | |
li = document.getElementsByClassName(params.CSS_HEADER); | |
for (;li.length;) { | |
li[0].className = li[0].className.replace(params.CSS_HEADER, ""); | |
} | |
/** @type {NodeList} */ | |
li = document.getElementsByClassName(params.CSS_FOOTER); | |
for (;li.length;) { | |
/** @type {string} */ | |
li[0].style.transform = ""; | |
/** @type {string} */ | |
li[0].style.marginBottom = ""; | |
li[0].className = li[0].className.replace(params.CSS_FOOTER, ""); | |
} | |
/** @type {NodeList} */ | |
li = document.getElementsByClassName(params.CSS_FADEIN); | |
for (;li.length;) { | |
li[0].className = li[0].className.replace(params.CSS_FADEIN, ""); | |
} | |
/** @type {NodeList} */ | |
li = document.getElementsByClassName(params.CSS_FADEOUT); | |
for (;li.length;) { | |
li[0].className = li[0].className.replace(params.CSS_FADEOUT, ""); | |
} | |
params.controller._bsContext.resizeBetslip(); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemToReturnDisplayHelper = function(dataAndEvents) { | |
this._bsWrapper = $("#bsDiv"); | |
this._betSlipController = dataAndEvents; | |
}; | |
/** | |
* @param {number} bool | |
* @param {string} x | |
* @param {?} val | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemToReturnDisplayHelper.prototype.setReturnValue = function(bool, x, val) { | |
var code = $('li[data-item-id="' + bool + '"][data-item-type="' + x + '"]', this._bsWrapper).find(".bs-StakeToReturn_Value"); | |
if (code.length > 0) { | |
code[0].innerHTML = this._betSlipController && this._betSlipController._currencyDisplayHelper ? this._betSlipController._currencyDisplayHelper.formatCurrency(val) : val; | |
} | |
}; | |
/** | |
* @param {string} dataAndEvents | |
* @param {string} deepDataAndEvents | |
* @param {(Object|string)} val | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemToReturnDisplayHelper.prototype.setMultipleReturnValue = function(dataAndEvents, deepDataAndEvents, val) { | |
var code = $('li[data-item-id="' + dataAndEvents + '"][data-item-type="' + deepDataAndEvents + '"]', this._bsWrapper).find(".bs-MultipleBets_ToReturn > .bs-MultipleBets_ToReturnValue"); | |
var txt; | |
if (code.length > 0) { | |
if (this._betSlipController && this._betSlipController._currencyDisplayHelper) { | |
txt = this._betSlipController._currencyDisplayHelper.formatCurrency(val); | |
/** @type {string} */ | |
txt = txt.length >= 7 ? "<br />" + txt : " " + txt; | |
/** @type {string} */ | |
code[0].innerHTML = txt; | |
} else { | |
if (val.length >= 6) { | |
/** @type {string} */ | |
val = "<br />" + val; | |
} | |
/** @type {(Object|string)} */ | |
code[0].innerHTML = val; | |
} | |
$(code[0].parentElement).removeClass("hidden"); | |
} | |
}; | |
/** | |
* @param {number} bool | |
* @param {string} x | |
* @param {boolean} recurring | |
* @param {boolean} v33 | |
* @param {boolean} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemToReturnDisplayHelper.prototype.setVisibility = function(bool, x, recurring, v33, dataAndEvents) { | |
var $e = $('li[data-item-id="' + bool + '"][data-item-type="' + x + '"]', this._bsWrapper); | |
var lis = $e.find(".bs-StakeToReturn"); | |
var els = $e.find(".bs-StakeToReturnBreakDownLink"); | |
var data_equally_divided = $("#bsDiv>ul").attr("data-equally-divided"); | |
if (lis.length > 0) { | |
if (recurring) { | |
if (lis[0].hasAttribute("style")) { | |
lis[0].removeAttribute("style"); | |
} | |
} else { | |
lis[0].setAttribute("style", "display:none;"); | |
} | |
} | |
if (els.length > 0) { | |
els.addClass("bs-StakeToReturnBreakDownLink_Hidden"); | |
if (v33) { | |
dataAndEvents = dataAndEvents && lis.length > 0; | |
if (data_equally_divided != "True") { | |
if (dataAndEvents) { | |
els[0].text = lis[0].textContent; | |
} | |
els.removeClass("bs-StakeToReturnBreakDownLink_Hidden"); | |
} else { | |
if (dataAndEvents) { | |
if (lis[0].hasAttribute("style")) { | |
lis[0].removeAttribute("style"); | |
} | |
} | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ModeResolver = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.ModeResolver.prototype = { | |
/** | |
* @return {?} | |
*/ | |
resolve : function() { | |
if (this._isValid()) { | |
var _bsInst = this; | |
var betReceipt = _bsInst._bsInst._betSlipModeBetSlip; | |
return $("#bsDiv>ul:first").hasClass("betReceipt") && (betReceipt = _bsInst._bsInst._betSlipModeReceipt), betReceipt; | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @param {?} ignoreMethodDoesntExist | |
* @param {(Object|number|string)} textAlt | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemDeleteExecutor = function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist, textAlt) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
this._itemIndex = ignoreMethodDoesntExist; | |
/** @type {(Object|number|string)} */ | |
this._itemType = textAlt; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && (typeof this._itemIndex != "undefined" && typeof this._itemType != "undefined"); | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._deleteItem = function() { | |
var list = this._bsInst.getBetItems(this._itemType); | |
var file = list[parseInt(this._itemIndex)]; | |
return list.splice(parseInt(this._itemIndex), 1), this._bsInst.updateState(), this._bsInst.betSlipItemsChanged(), $("#bsDiv").trigger("b365.Ui.Betslip.deleting", file), file; | |
}; | |
}; | |
b365.Ui.Betslip.ItemDeleteExecutor.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
execute : function() { | |
if (this._isValid() && (!this._bsController.isReqOnBetDeletedEnabled() || !this._bsInst.locked())) { | |
var fs = this._deleteItem(); | |
if (!this._bsController.isReqOnBetDeletedEnabled() || this._bsInst.req(this._bsInst.reqTypeDeleteItem)) { | |
if (fs.getCnItem("id")) { | |
this._bsController.itemsRemoved(fs.getCnItem("id").replace("Y", "").replace("N", "")); | |
} else { | |
if (fs.getCnItem("mid") && fs.getCnItem("pid")) { | |
this._bsController.itemsRemoved(fs.getCnItem("pid") + ":" + fs.getCnItem("mid")); | |
} else { | |
if (fs.getCnItem("Inc")) { | |
this._bsController.itemsRemoved(fs.getCnItem("fp") + "~inc" + fs.getCnItem("Inc")); | |
} else { | |
this._bsController.itemsRemoved(fs.getCnItem("fp")); | |
} | |
} | |
} | |
if (fs.getCnItem("pp")) { | |
this._bsController.itemsRemoved(fs.getCnItem("pp")); | |
} | |
} | |
} | |
}, | |
/** | |
* @return {?} | |
*/ | |
executeWithoutRequest : function() { | |
if (this._isValid() && (!this._bsController.isReqOnBetDeletedEnabled() || !this._bsInst.locked())) { | |
return this._deleteItem(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {(Object|boolean)} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemInformation = function(dataAndEvents, deepDataAndEvents) { | |
this._ele = dataAndEvents; | |
/** @type {(Object|boolean)} */ | |
this._useElement = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._ele != "undefined"; | |
}; | |
if (this._isValid()) { | |
if (this._useElement && this._useElement === true) { | |
this._ele = $(this._ele); | |
/** @type {Array} */ | |
this._itemType = [this._ele.attr("data-item-id"), this._ele.attr("data-item-type")]; | |
} else { | |
this._parent = $(this._ele).parent().closest("[data-item-id]"); | |
/** @type {Array} */ | |
this._itemType = [this._parent.attr("data-item-id"), this._parent.attr("data-item-type")]; | |
} | |
} | |
}; | |
b365.Ui.Betslip.ItemInformation.prototype = { | |
/** | |
* @return {?} | |
*/ | |
itemIndexAndType : function() { | |
return this._isValid() ? this._itemType : null; | |
}, | |
/** | |
* @return {?} | |
*/ | |
itemIndex : function() { | |
return this._isValid() ? this._itemType[0] : null; | |
}, | |
/** | |
* @return {?} | |
*/ | |
itemType : function() { | |
return this._isValid() ? this._itemType[1] : null; | |
}, | |
/** | |
* @return {?} | |
*/ | |
itemElement : function() { | |
return $(this._ele).parent().closest("[data-item-id]"); | |
}, | |
/** | |
* @return {?} | |
*/ | |
parent : function() { | |
return this._parent; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ToggleMultiples = function(dataAndEvents, deepDataAndEvents) { | |
var _ref; | |
var _len; | |
var _i; | |
var head; | |
var container; | |
if (this._bsInst = dataAndEvents, this._bsController = deepDataAndEvents, this._showingVal = "1", this._showingCSS = "open", this._hidingVal = "0", this._hidingCSS = "closed", this._multiplesStateCookieKey = "mo", this._cookieValSeparator = "||", this._multiplesHdr = $("#bsMultipleContainer"), this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}, this._isValid() && (this._isCurrentlyShowing = this._bsInst.getValueFromBSCookie(this._multiplesStateCookieKey).replace(this._cookieValSeparator, "") == this._showingVal), this._setTriggerClass = function(dataAndEvents) { | |
/** @type {string} */ | |
var klass = "bs-MultipleToggle-show"; | |
/** @type {string} */ | |
var className = "bs-MultipleToggle-hide"; | |
var $this = $("#bsDiv>ul:first-child"); | |
/** @type {string} */ | |
var header = "bs-NoMultiples"; | |
if ($("#bsDiv .betReceipt").length == 0 && dataAndEvents) { | |
$this.addClass(klass).removeClass(className); | |
} else { | |
$this.removeClass(klass).addClass(className); | |
} | |
if ($("#bsDiv .betReceipt").length == 0 && this._multiplesHdr[0]) { | |
$this.removeClass(header); | |
} else { | |
$this.addClass(header); | |
} | |
}, _ref = $('.bs-MultipleBets span[data-inp-type="ewcb"]', "#bsDiv"), container = $(".bs-MultipleBets_EwHeader"), _ref && _ref.length > 0) { | |
_len = _ref.length; | |
/** @type {number} */ | |
_i = 0; | |
for (;_i < _len;_i++) { | |
head = _ref[_i]; | |
if (this._bsController.ausMultiplesEnabled()) { | |
head.setAttribute("style", "display:none;"); | |
} else { | |
head.setAttribute("style", "display:block;"); | |
} | |
} | |
if (container) { | |
if (container.length > 0) { | |
container = container[0]; | |
/** @type {string} */ | |
container.style.visibility = this._bsController.ausMultiplesEnabled() ? "hidden" : "visible"; | |
} | |
} | |
} | |
}; | |
b365.Ui.Betslip.ToggleMultiples.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
toggle : function() { | |
if (this._isValid()) { | |
if ($("#bsDiv .betReceipt").length == 0) { | |
if (this._isCurrentlyShowing) { | |
this._multiplesHdr.removeClass(this._showingCSS).addClass(this._hidingCSS); | |
} else { | |
this._multiplesHdr.removeClass(this._hidingCSS).addClass(this._showingCSS); | |
} | |
this._bsInst.setValueInBSCookie(this._multiplesStateCookieKey, this._isCurrentlyShowing ? this._hidingVal : this._showingVal); | |
this._setTriggerClass(!this._isCurrentlyShowing); | |
this._bsInst.changeBetslipHeight(); | |
if (this._bsController.ausMultiplesEnabled()) { | |
if (!this._isCurrentlyShowing) { | |
if (this._bsController.complexMultiplesNeedsRefresh) { | |
/** @type {boolean} */ | |
this._bsController.complexMultiplesNeedsRefresh = false; | |
this._bsController.getMultipleInfo(true); | |
} | |
} | |
} | |
$(document).trigger("mbsmultopenclose"); | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
reset : function() { | |
if (this._isCurrentlyShowing) { | |
this._multiplesHdr.removeClass(this._hidingCSS).addClass(this._showingCSS); | |
} else { | |
this._multiplesHdr.removeClass(this._showingCSS).addClass(this._hidingCSS); | |
} | |
this._setTriggerClass(this._isCurrentlyShowing); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.WebPopupManager = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
}; | |
/** @type {null} */ | |
b365.Ui.Betslip.WebPopupManager.prototype._bsInst = null; | |
/** @type {null} */ | |
b365.Ui.Betslip.WebPopupManager.prototype._bsController = null; | |
/** @type {boolean} */ | |
b365.Ui.Betslip.WebPopupManager.prototype._popupActive = false; | |
/** @type {null} */ | |
b365.Ui.Betslip.WebPopupManager.prototype._popup = null; | |
/** @type {null} */ | |
b365.Ui.Betslip.WebPopupManager.prototype._popupHalo = null; | |
/** @type {null} */ | |
b365.Ui.Betslip.WebPopupManager.prototype._popupOverlay = null; | |
/** @type {null} */ | |
b365.Ui.Betslip.WebPopupManager.prototype._dismissDelegate = null; | |
/** @type {null} */ | |
b365.Ui.Betslip.WebPopupManager.prototype._closeCallback = null; | |
/** | |
* @param {Element} element | |
* @param {Function} left | |
* @param {Object} o | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.WebPopupManager.prototype.popupShow = function(element, left, o) { | |
var that = this; | |
var el; | |
var popup; | |
/** @type {number} */ | |
var b = 10; | |
/** @type {number} */ | |
var a = 36; | |
var containerBounds; | |
var p; | |
var activeClassName; | |
if (that._popupActive) { | |
that.popupHide(); | |
} | |
/** @type {boolean} */ | |
that._popupActive = true; | |
/** @type {Element} */ | |
that._popup = element; | |
/** @type {Function} */ | |
that._closeCallback = left; | |
p = element.getBoundingClientRect(); | |
o = o || {}; | |
containerBounds = { | |
height : (o.height || element.clientHeight) + (a + b), | |
width : (o.width || element.clientWidth) + 2 * b, | |
top : (o.top || element.offsetTop) - a, | |
left : (o.left || element.offsetLeft) - b, | |
clientTop : (o.clientTop || p.top) - a | |
}; | |
element.className += " wpm-Popup"; | |
/** | |
* @param {Event} datum | |
* @return {undefined} | |
*/ | |
that._dismissDelegate = function(datum) { | |
that._dismissHandler(datum); | |
}; | |
/** @type {Element} */ | |
that._popupHalo = popup = document.createElement("div"); | |
/** @type {string} */ | |
popup.className = "wpm-Halo"; | |
element.parentElement.appendChild(popup); | |
/** @type {string} */ | |
popup.style.height = containerBounds.height + "px"; | |
/** @type {string} */ | |
popup.style.width = containerBounds.width + "px"; | |
/** @type {string} */ | |
popup.style.top = containerBounds.top + "px"; | |
/** @type {string} */ | |
popup.style.left = containerBounds.left + "px"; | |
popup.addEventListener("click", that._dismissDelegate); | |
/** @type {Element} */ | |
that._popupOverlay = el = document.createElement("div"); | |
/** @type {string} */ | |
el.className = "wpm-Overlay"; | |
element.parentElement.appendChild(el); | |
el.addEventListener("mouseover", that._dismissDelegate); | |
activeClassName = containerBounds.clientTop + containerBounds.height + a + b; | |
that._bsInst.popupShow(activeClassName); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.WebPopupManager.prototype.popupHide = function() { | |
var that = this; | |
if (that._popupActive) { | |
if (that._popupActive = false, that._closeCallback && (that._closeCallback(), that._closeCallback = null), that._popup) { | |
if (that._popupHalo) { | |
that._popup.parentElement.removeChild(that._popupHalo); | |
if (that._dismissDelegate) { | |
that._popupHalo.removeEventListener("click", that._dismissDelegate); | |
} | |
/** @type {null} */ | |
that._popupHalo = null; | |
} | |
if (that._popupOverlay) { | |
if (that._dismissDelegate) { | |
that._popupOverlay.removeEventListener("mouseover", that._dismissDelegate); | |
} | |
that._popup.parentElement.removeChild(that._popupOverlay); | |
/** @type {null} */ | |
that._popupOverlay = null; | |
} | |
that._popup.className = that._popup.className.replace(" wpm-Popup", ""); | |
/** @type {null} */ | |
that._dismissDelegate = null; | |
/** @type {null} */ | |
that._popup = null; | |
that._bsInst.popupHide(); | |
} | |
} | |
}; | |
/** | |
* @param {Event} e | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.WebPopupManager.prototype._dismissHandler = function(e) { | |
var popupHide = this; | |
if (e) { | |
if (e.preventDefault(), e.stopPropagation(), e.target === e.currentTarget) { | |
if (typeof e != "undefined") { | |
if (e) { | |
popupHide.popupHide(); | |
} | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @param {?} ignoreMethodDoesntExist | |
* @param {(Object|number|string)} textAlt | |
* @param {HTMLElement} keepData | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EachWayClickProcessor = function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist, textAlt, keepData) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
this._itemIndex = ignoreMethodDoesntExist; | |
/** @type {(Object|number|string)} */ | |
this._itemType = textAlt; | |
/** @type {HTMLElement} */ | |
this._itemElement = keepData; | |
/** @type {string} */ | |
this._eachWayCookieKey = "ew"; | |
/** @type {boolean} */ | |
this._showLinesLabel = $("#bsDiv>ul").attr("data-tcm") == "2"; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && (typeof this._itemIndex != "undefined" && (typeof this._itemType != "undefined" && typeof this._itemElement != "undefined")); | |
}; | |
/** | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
this._updateStakeLabel = function(recurring) { | |
var element; | |
var value; | |
var cz; | |
var ctrl; | |
if (!this._showLinesLabel) { | |
/** @type {boolean} */ | |
ctrl = $(this._itemElement)[0].className.indexOf("bs-MultipleBets_HighestAccumulator") > 1; | |
element = $(this._itemElement).find('input[class~="stk"]'); | |
value = ctrl ? betSlipML.unitstake : recurring ? betSlipML.unitstake : betSlipML.stake; | |
element.attr("placeholder", value); | |
cz = element.val(); | |
if (cz == betSlipML.unitstake || cz == betSlipML.stake) { | |
element.val(value); | |
} | |
} | |
}; | |
}; | |
b365.Ui.Betslip.EachWayClickProcessor.prototype = { | |
/** | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var _itemIndex = this._bsInst.getBetItemById(this._itemType, this._itemIndex); | |
var $col; | |
if (_itemIndex) { | |
_itemIndex.setStItem(this._eachWayCookieKey, recurring ? "1" : "0"); | |
this._bsController.updateMultiplesEachWayFlag(); | |
this._bsInst.updateState(); | |
this._updateStakeLabel(recurring); | |
(new b365.Ui.Betslip.TotalsCalculator(this._bsInst, this._bsController)).calculate(); | |
if (this._bsController.ausMultiplesEnabled()) { | |
this._bsController.getMultipleInfo(); | |
} | |
} | |
if (this._itemElement) { | |
if (this._itemElement.length > 0) { | |
$col = $('input[data-inp-type="sngstk"]', this._itemElement[0]); | |
if ($col) { | |
if ($col.length > 0) { | |
this._bsController.OnItemStakeChanged($col[0]); | |
} | |
} | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.FreeBetClickProcessor = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && (typeof this._itemIndex != "undefined" && (typeof this._itemType != "undefined" && typeof this._itemElement != "undefined")); | |
}; | |
/** | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
this._handleUpdates = function(recurring) { | |
if (this._stakeTextBoxes = this._itemElement.querySelectorAll('input[class~="stk"]'), this._stakeTextBox = this._getStakeInputForBetType(), this._stakeTextBox) { | |
/** @type {number} */ | |
this._betCount = +this._bsInst.getBetItemById(this._itemType, this._itemIndex).getStItem("bc") || 1; | |
this._betMax = this._itemElement.querySelector(".bs-BetMax"); | |
if (recurring) { | |
if (this._itemElement.className.indexOf("bs-FreeBet-selected") === -1) { | |
/** @type {string} */ | |
this._itemElement.className = this._itemElement.className + " bs-FreeBet-selected"; | |
} | |
this._insertFreeBetStakeForBetItem(); | |
this._disableStakeInputs(); | |
} else { | |
this._itemElement.className = this._itemElement.className.replace(" bs-FreeBet-selected", ""); | |
this._enableStakeInputs(); | |
this._clearFreeBetStakeFromBetItem(); | |
this._resetStakeValue(); | |
} | |
if (this._toReturnText) { | |
this._toReturnText.innerText = recurring ? betSlipML.netreturn : betSlipML.toreturn; | |
} | |
if (this._singlesMultiplier) { | |
if (this._itemType === "single") { | |
/** @type {string} */ | |
this._singlesMultiplier.innerText = (recurring ? this._bsInst._betItems.length - 1 : this._bsInst._betItems.length) + "x"; | |
} | |
} | |
(new b365.Ui.Betslip.StakeChangedHandler(this._bsInst, this._bsController)).handle(this._stakeTextBox); | |
(new b365.Ui.Betslip.BetCreditCalculator(this._bsInst, this._bsController, recurring)).calculate(); | |
this._bsController.resizeHandler(); | |
} | |
}; | |
}; | |
b365.Ui.Betslip.FreeBetClickProcessor.prototype = { | |
/** | |
* @param {string} element | |
* @return {?} | |
*/ | |
init : function(element) { | |
var wrapper = new b365.Ui.Betslip.ItemInformation(element); | |
var _itemIndex = wrapper.itemIndexAndType(); | |
var _itemElement = wrapper.itemElement(); | |
return this._itemIndex = _itemIndex[0], this._itemType = _itemIndex[1], this._itemElement = _itemElement[0], this._element = element, this._freeBetCookieKey = "ft", this._freeBetValueCookieKey = "fbv", this._eachWayCookieKey = "ew", this._multiplesStakeBox = document.querySelector('li[data-item-id="-1"] .bs-MultipleBets_Stake'), this._singlesMultiplier = document.querySelector('li[data-item-id="-1"] .bs-MultipleBets_BetCount'), this._freeBetContainer = this._itemElement.getElementsByClassName("bs-UseFreeBetContainer")[0], | |
this._toReturnText = this._itemElement.getElementsByClassName("bs-StakeToReturn_Text")[0], this._freeBetStake = this._itemElement.getElementsByClassName("bs-FreeBetStake")[0], this; | |
}, | |
/** | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var oTemplate = this._bsInst.getBetItemById(this._itemType, this._itemIndex); | |
if (this._isValid) { | |
if (oTemplate) { | |
oTemplate.setStItem(this._freeBetCookieKey, recurring ? this._freeBetContainer.getAttribute("data-item-fbt") : ""); | |
oTemplate.setStItem(this._freeBetValueCookieKey, recurring ? this._freeBetContainer.getAttribute("data-item-fbv") : ""); | |
this._bsInst.updateState(); | |
/** @type {boolean} */ | |
this._isEachWay = oTemplate.getStItem(this._eachWayCookieKey) == 1; | |
this._handleUpdates(recurring); | |
} | |
} | |
}, | |
/** | |
* @return {?} | |
*/ | |
_getStakeInputForBetType : function() { | |
/** @type {string} */ | |
var classSelector = "bs-Stake_TextBox"; | |
switch(this._itemType) { | |
case "single": | |
/** @type {string} */ | |
classSelector = ".bs-Stake_TextBox"; | |
break; | |
case "cast": | |
/** @type {string} */ | |
classSelector = this._stakeTextBoxes[0].className.indexOf("Flexi") >= 0 ? ".bs-FlexiUnitStake_TextBox" : ".bs-Stake_TextBox"; | |
} | |
return this._itemElement.querySelector(classSelector); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
_insertFreeBetStakeForBetItem : function() { | |
var cur = this._freeBetContainer.getAttribute("data-item-fbv"); | |
var data_priv = getBetslipWebModule(); | |
var pdataOld; | |
if (this._isEachWay) { | |
cur = data_priv.roundUpStake(cur / 2); | |
pdataOld = this._bsController._currencyDisplayHelper.getDecimalSeperator(); | |
this._freeBetStake.childNodes[0].data = $blib.pad2DP(String(cur * 2), pdataOld) + " "; | |
} else { | |
if (this._itemType !== "single") { | |
cur = data_priv.calculateUnitStake(cur, this._betCount); | |
this._resetStakeValue(); | |
} else { | |
this._resetStakeValue(); | |
} | |
} | |
this._stakeTextBox.click(); | |
this._stakeTextBox.value = cur; | |
if (this._betMax) { | |
/** @type {string} */ | |
this._betMax.style.display = "none"; | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
_clearFreeBetStakeFromBetItem : function() { | |
this._stakeTextBox.value = this._itemType === "single" && this._multiplesStakeBox ? this._multiplesStakeBox.value : ""; | |
this._stakeTextBox.focus(); | |
this._stakeTextBox.blur(); | |
if (this._betMax) { | |
/** @type {string} */ | |
this._betMax.style.display = ""; | |
} | |
}, | |
/** | |
* @param {boolean} dataAndEvents | |
* @return {undefined} | |
*/ | |
_toggleDisclaimerSection : function(dataAndEvents) { | |
var domElement = document.getElementsByClassName("bs-freebetdisclaimer")[0]; | |
if (dataAndEvents && domElement.className.indexOf(" hidden") > -1) { | |
domElement.className = domElement.className.replace(" hidden", ""); | |
} else { | |
if (domElement.className.indexOf(" hidden") === -1) { | |
domElement.className += " hidden"; | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
_enableStakeInputs : function() { | |
var codeSegments; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < this._stakeTextBoxes.length;i++) { | |
this._stakeTextBoxes[i].removeAttribute("disabled"); | |
this._stakeTextBoxes[i].className = this._stakeTextBoxes[i].className.replace("bs-FreeBet-disabled", ""); | |
} | |
/** @type {NodeList} */ | |
codeSegments = document.getElementsByClassName("bs-UseFreeBet-disabled"); | |
/** @type {number} */ | |
i = codeSegments.length - 1; | |
for (;i >= 0;i--) { | |
codeSegments[i].className = codeSegments[i].className.replace(" bs-UseFreeBet-disabled", ""); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
_disableStakeInputs : function() { | |
var codeSegments; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < this._stakeTextBoxes.length;i++) { | |
this._stakeTextBoxes[i].setAttribute("disabled", "disabled"); | |
/** @type {string} */ | |
this._stakeTextBoxes[i].className = this._stakeTextBoxes[i].className + " bs-FreeBet-disabled"; | |
} | |
/** @type {NodeList} */ | |
codeSegments = document.getElementsByClassName("bs-UseFreeBet"); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (codeSegments[i] === this._element.parentNode || codeSegments[i] === this._element.parentNode.parentNode) { | |
continue; | |
} else { | |
if (codeSegments[i].className.indexOf("bs-UseFreeBet-disabled") == -1) { | |
/** @type {string} */ | |
codeSegments[i].className = codeSegments[i].className + " bs-UseFreeBet-disabled"; | |
} | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
_resetStakeValue : function() { | |
this._freeBetStake.childNodes[0].data = this._freeBetContainer.getAttribute("data-item-fbv") + " "; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.RemoveClickHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {boolean} */ | |
this._enabled = false; | |
/** @type {Array} */ | |
this._removeClickHandlers = []; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @param {Object} segment | |
* @return {undefined} | |
*/ | |
this._reorderChildElements = function(segment) { | |
var i; | |
var valsLength; | |
/** @type {number} */ | |
var copies = 0; | |
if (segment.children.length != 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = segment.children.length; | |
for (;i < valsLength;i++) { | |
if (segment.children[i].hasAttribute("data-item-id")) { | |
segment.children[i].setAttribute("data-item-id", copies); | |
/** @type {number} */ | |
copies = copies + 1; | |
} | |
} | |
} | |
}; | |
}; | |
b365.Ui.Betslip.RemoveClickHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var pdataOld = this; | |
var target; | |
/** @type {boolean} */ | |
var y = false; | |
var $target; | |
var events; | |
var _bsController; | |
var property; | |
var val; | |
var elem; | |
var link; | |
var k; | |
var mode; | |
var j; | |
var options; | |
var properties; | |
var results; | |
if (typeof recurring != "undefined") { | |
if (recurring) { | |
pdataOld.removeHandlers(); | |
target = recurring.target; | |
$target = $(target); | |
if ($target.prop("disabled") || ($target.parents().prop("disabled") || !$target.hasClass("remove") && !$target.hasClass("bs-RestrictedBet"))) { | |
/** @type {boolean} */ | |
y = true; | |
} else { | |
if ($target.hasClass("bs-RestrictedBet")) { | |
$target = $(target).parent().find(".remove"); | |
target = $target[0]; | |
} | |
if (pdataOld._bsInst._pollReqType === pdataOld._bsInst.reqTypePollTempBetReceipt) { | |
pdataOld._bsInst.resetPoll(); | |
} | |
options = new b365.Ui.Betslip.ItemInformation(target); | |
properties = options.itemIndexAndType(); | |
results = options.itemElement(); | |
elem = $(target.parentNode).next()[0]; | |
if (properties[1] == "tote-pot-leg") { | |
target = options.parent()[0]; | |
(new b365.Ui.Betslip.TotePotLegDeleteExecutor(pdataOld._bsInst, target, properties[0], properties[1])).execute(); | |
pdataOld.attachHandlers(); | |
} else { | |
if (properties[1] == "cast" && (elem && (elem.hasAttribute("data-item-type") && elem.getAttribute("data-item-type")))) { | |
target = elem; | |
options = new b365.Ui.Betslip.ItemInformation(target, true); | |
properties = options.itemIndexAndType(); | |
results = options.itemElement(); | |
(new b365.Ui.Betslip.TotePotLegDeleteExecutor(pdataOld._bsInst, target, properties[0], properties[1])).execute(); | |
pdataOld.attachHandlers(); | |
} else { | |
if (pdataOld._bsController.clientEnhancedMode()) { | |
events = pdataOld._bsInst; | |
_bsController = pdataOld._bsController; | |
property = properties[0]; | |
val = properties[1]; | |
elem = results[0].parentElement; | |
if (pdataOld._bsController._stakeEntryType == pdataOld._bsController._stakeEntryTypes.stakePad) { | |
link = $("#stakePad", results); | |
if (link.length > 0 && !link.hasClass("hideStakePad")) { | |
_bsController._enhancedBetSlipAnimations.removeSingleBet(results, true, link, pdataOld.removeBetItemCallBack, [elem, results[0], events, _bsController, property, val], pdataOld); | |
} else { | |
link = $("#stakePad"); | |
if (link.length > 0) { | |
k = link[0].getAttribute("data-item"); | |
mode = link[0].getAttribute("data-type"); | |
j = results[0].getAttribute("data-item-id"); | |
if (mode != "multiple") { | |
if (j < k) { | |
/** @type {number} */ | |
k = k - 1; | |
link[0].setAttribute("data-item", k); | |
} | |
} | |
_bsController._enhancedBetSlipAnimations.removeSingleBet(results, false, null, pdataOld.removeBetItemCallBack, [elem, results[0], events, _bsController, property, val], pdataOld); | |
} else { | |
_bsController._enhancedBetSlipAnimations.removeSingleBet(results, false, null, pdataOld.removeBetItemCallBack, [elem, results[0], events, _bsController, property, val], pdataOld); | |
} | |
} | |
} else { | |
_bsController._enhancedBetSlipAnimations.removeSingleBet(results, false, null, pdataOld.removeBetItemCallBack, [elem, results[0], events, _bsController, property, val], pdataOld); | |
} | |
} else { | |
(new b365.Ui.Betslip.ItemDeleteExecutor(pdataOld._bsInst, pdataOld._bsController, properties[0], properties[1])).execute(); | |
} | |
} | |
} | |
/** @type {boolean} */ | |
y = true; | |
} | |
if (y) { | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
} else { | |
if (pdataOld._bsController._stakeEntryType != pdataOld._bsController._stakeEntryTypes.deviceKeyBoard) { | |
if (pdataOld._bsController._stakeEntryHander._isShowing) { | |
pdataOld._bsController._stakeEntryHander.hide(); | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
} | |
} | |
} | |
pdataOld.attachHandlers(); | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
removeBetItemCallBack : function() { | |
var target = arguments[0]; | |
var that = arguments[1]; | |
var iterable = arguments[2]; | |
var thisp = arguments[3]; | |
var rv = arguments[4]; | |
var arr = arguments[5]; | |
target.removeChild(that); | |
(new b365.Ui.Betslip.ItemDeleteExecutor(iterable, thisp, rv, arr)).execute(); | |
this._reorderChildElements(target); | |
this.attachHandlers(); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
attachHandlers : function() { | |
var _this = this; | |
var codeSegments = $(".remove, .bs-RestrictedBet", _this._betSlipWrapper); | |
var i; | |
var valsLength; | |
if (_this.removeHandlers(_this), codeSegments.length == 0) { | |
/** @type {boolean} */ | |
_this._enabled = false; | |
return; | |
} | |
/** @type {number} */ | |
i = 0; | |
valsLength = codeSegments.length; | |
for (;i < valsLength;i++) { | |
_this._removeClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(codeSegments[i], $.proxy(_this.handle, _this), false)); | |
} | |
/** @type {boolean} */ | |
_this._enabled = true; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
removeHandlers : function() { | |
var that = this; | |
var i; | |
var valsLength; | |
if (that._removeClickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = that._removeClickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (that._removeClickHandlers[i]._element) { | |
that._removeClickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
that._removeClickHandlers = []; | |
} | |
/** @type {boolean} */ | |
that._enabled = false; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EachWayClickHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {boolean} */ | |
this._enabled = false; | |
/** @type {Array} */ | |
this._eachWayClickHandlers = []; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.EachWayClickHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var lib = this; | |
var node; | |
var elem; | |
var newNode; | |
var e; | |
var curPageObj; | |
var req; | |
if (typeof recurring != "undefined" && recurring) { | |
if (lib.removeHandlers(), node = recurring.target, elem = $(node), !elem.prop("disabled") && !elem.parents().prop("disabled")) { | |
switch(node.nodeName.toLowerCase()) { | |
case "div": | |
elem = $(node).find('span.bs-CheckBox[data-inp-type="ewcb"]'); | |
node = elem[0]; | |
break; | |
default: | |
elem = $(node).parent().find('span.bs-CheckBox[data-inp-type="ewcb"]'); | |
node = elem[0]; | |
} | |
if (lib._bsInst._pollReqType === lib._bsInst.reqTypePollTempBetReceipt) { | |
lib._bsInst.resetPoll(); | |
} | |
newNode = new b365.Ui.Betslip.ItemInformation(node); | |
e = newNode.itemIndexAndType(); | |
curPageObj = newNode.itemElement(); | |
if (!$(curPageObj).hasClass("suspended")) { | |
req = $(node).hasClass("checked"); | |
if (!false) { | |
if (req) { | |
$(node).removeClass("checked"); | |
/** @type {boolean} */ | |
req = false; | |
} else { | |
$(node).addClass("checked"); | |
/** @type {boolean} */ | |
req = true; | |
} | |
} | |
(new b365.Ui.Betslip.EachWayClickProcessor(this._bsInst, this._bsController, e[0], e[1], curPageObj)).handle(req); | |
} | |
lib.attachHandlers(); | |
} | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
attachHandlers : function() { | |
var _this = this; | |
var codeSegments = $('div[data-inp-type="ewcb"], span[data-inp-type="ewcb"]', "#bsDiv"); | |
var i; | |
var valsLength; | |
if (_this.removeHandlers(_this), codeSegments.length == 0) { | |
/** @type {boolean} */ | |
_this._enabled = false; | |
return; | |
} | |
/** @type {number} */ | |
i = 0; | |
valsLength = codeSegments.length; | |
for (;i < valsLength;i++) { | |
_this._eachWayClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(codeSegments[i], $.proxy(_this.handle, _this), false)); | |
} | |
/** @type {boolean} */ | |
_this._enabled = true; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
removeHandlers : function() { | |
var that = this; | |
var i; | |
var valsLength; | |
if (that._eachWayClickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = that._eachWayClickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (that._eachWayClickHandlers[i]._element) { | |
that._eachWayClickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
that._eachWayClickHandlers = []; | |
} | |
/** @type {boolean} */ | |
that._enabled = false; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.FreeBetClickHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {boolean} */ | |
this._enabled = false; | |
/** @type {Array} */ | |
this._freeBetClickHandlers = []; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.FreeBetClickHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var lib = this; | |
var el; | |
var val; | |
var elem; | |
var req; | |
var codeSegments; | |
lib.removeHandlers(); | |
el = recurring.target; | |
if (lib._bsInst._pollReqType === lib._bsInst.reqTypePollTempBetReceipt) { | |
lib._bsInst.resetPoll(); | |
} | |
val = new b365.Ui.Betslip.ItemInformation(el); | |
elem = val.itemElement()[0]; | |
el = elem.querySelector('div[data-inp-type="fbcb"]'); | |
if (elem.className.indexOf("suspended") == -1) { | |
if (el) { | |
if (el.parentNode.className.indexOf("bs-UseFreeBet-disabled") == -1) { | |
if (el.parentNode.className.indexOf("bs-UseFreeBet-error") == -1) { | |
/** @type {boolean} */ | |
req = el.className.indexOf("bs-FreeBetCheckBox-selected") > -1; | |
if (!false) { | |
if (req) { | |
el.className = el.className.replace("bs-FreeBetCheckBox-selected", ""); | |
/** @type {boolean} */ | |
req = false; | |
} else { | |
if (this._bsInst.getValueFromBSCookie("fs")) { | |
if (this._bsInst.getValueFromBSCookie("fs").replace("||", "") === "1") { | |
codeSegments = this._bsInst.getBetItems(this._bsInst.itemTypeSingle); | |
if (codeSegments.length === 1) { | |
(new b365.Ui.Betslip.ToggleBetCredit(this._bsInst, this._bsController)).toggle(); | |
} | |
} | |
} | |
/** @type {string} */ | |
el.className = el.className + " bs-FreeBetCheckBox-selected"; | |
/** @type {boolean} */ | |
req = true; | |
} | |
(new b365.Ui.Betslip.FreeBetClickProcessor(this._bsInst, this._bsController)).init(el).handle(req); | |
} | |
} | |
} | |
} | |
} | |
lib.attachHandlers(); | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
}, | |
/** | |
* @param {string} element | |
* @return {undefined} | |
*/ | |
toggle : function(element) { | |
var cursor; | |
var e; | |
var elem; | |
var recurring; | |
e = new b365.Ui.Betslip.ItemInformation(element); | |
elem = e.itemElement()[0]; | |
cursor = elem.querySelector('div[data-inp-type="fbcb"]'); | |
if (elem.className.indexOf("suspended") == -1) { | |
if (cursor) { | |
if (cursor.parentNode.className.indexOf("bs-UseFreeBet-disabled") == -1) { | |
if (cursor.parentNode.className.indexOf("bs-UseFreeBet-error") == -1) { | |
/** @type {boolean} */ | |
recurring = cursor.className.indexOf("bs-FreeBetCheckBox-selected") > -1; | |
if (!false) { | |
if (recurring) { | |
cursor.className = cursor.className.replace("bs-FreeBetCheckBox-selected", ""); | |
/** @type {boolean} */ | |
recurring = false; | |
} else { | |
/** @type {string} */ | |
cursor.className = cursor.className + " bs-FreeBetCheckBox-selected"; | |
/** @type {boolean} */ | |
recurring = true; | |
} | |
(new b365.Ui.Betslip.FreeBetClickProcessor(this._bsInst, this._bsController)).init(cursor).handle(recurring); | |
} | |
} | |
} | |
} | |
} | |
this.attachHandlers(); | |
}, | |
/** | |
* @param {Element} doc | |
* @return {undefined} | |
*/ | |
update : function(doc) { | |
var recurring; | |
var nodes; | |
if (doc) { | |
checkBox = doc.querySelector('div[data-inp-type="fbcb"]'); | |
recurring = checkBox && checkBox.className.indexOf("bs-FreeBetCheckBox-selected") > -1; | |
if (doc.className.indexOf("suspended") == -1 && (recurring && (checkBox.parentNode.className.indexOf("bs-UseFreeBet-disabled") == -1 && checkBox.parentNode.className.indexOf("bs-UseFreeBet-error") == -1))) { | |
(new b365.Ui.Betslip.FreeBetClickProcessor(this._bsInst, this._bsController)).init(checkBox).handle(recurring); | |
} else { | |
nodes = $('input[data-inp-type="sngstk"]', doc); | |
if (nodes) { | |
if (nodes.length > 0) { | |
this._bsController.OnItemStakeChanged(nodes[0]); | |
} | |
} | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
attachHandlers : function() { | |
var _this = this; | |
/** @type {Array} */ | |
var configList = []; | |
var ln; | |
/** @type {NodeList} */ | |
var codeSegments = document.getElementsByClassName("bs-UseFreeBet"); | |
/** @type {number} */ | |
var i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (codeSegments[i].className.indexOf("bs-UseFreeBet-error") == -1) { | |
if (codeSegments[i].className.indexOf("bs-UseFreeBet-disabled") == -1) { | |
configList.push(codeSegments[i]); | |
} | |
} | |
} | |
if (_this.removeHandlers(_this), configList.length == 0) { | |
/** @type {boolean} */ | |
_this._enabled = false; | |
return; | |
} | |
/** @type {number} */ | |
i = 0; | |
/** @type {number} */ | |
ln = configList.length; | |
for (;i < ln;i++) { | |
_this._freeBetClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(configList[i], $.proxy(_this.handle, _this), false)); | |
} | |
/** @type {boolean} */ | |
_this._enabled = true; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
removeHandlers : function() { | |
var that = this; | |
var i; | |
var valsLength; | |
if (that._freeBetClickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = that._freeBetClickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (that._freeBetClickHandlers[i]._element) { | |
that._freeBetClickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
that._freeBetClickHandlers = []; | |
} | |
/** @type {boolean} */ | |
that._enabled = false; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.StreamingClickHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {boolean} */ | |
this._enabled = false; | |
/** @type {Array} */ | |
this._streamingClickHandlers = []; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
/** @type {null} */ | |
b365.Ui.Betslip.StreamingClickHandler.prototype._streamingElement = null; | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.StreamingClickHandler.prototype.handle = function(recurring) { | |
var obj = this; | |
var node; | |
var activeClassName; | |
var el; | |
if (typeof recurring != "undefined") { | |
if (recurring) { | |
obj.removeHandlers(); | |
node = recurring.target; | |
el = $(node); | |
if (!el.prop("disabled")) { | |
if (!el.parents().prop("disabled")) { | |
obj._streamingElement = node.parentElement; | |
activeClassName = obj._streamingElement.getElementsByClassName("br-Streaming_Popup")[0]; | |
obj._streamingElement.className += " br-Streaming_active"; | |
obj._bsController.webPopupManager.popupShow(activeClassName, function() { | |
obj.removePopup(); | |
}); | |
obj.attachHandlers(); | |
} | |
} | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.StreamingClickHandler.prototype.attachHandlers = function() { | |
var _this = this; | |
var codeSegments = $(".br-Streaming_Text", "#bsDiv"); | |
var i; | |
var valsLength; | |
if (_this.removeHandlers(_this), codeSegments.length === 0) { | |
/** @type {boolean} */ | |
_this._enabled = false; | |
return; | |
} | |
/** @type {number} */ | |
i = 0; | |
valsLength = codeSegments.length; | |
for (;i < valsLength;i++) { | |
_this._streamingClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(codeSegments[i], $.proxy(_this.handle, _this), false)); | |
} | |
/** @type {boolean} */ | |
_this._enabled = true; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.StreamingClickHandler.prototype.removeHandlers = function() { | |
var that = this; | |
var i; | |
var valsLength; | |
if (that._streamingClickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = that._streamingClickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (that._streamingClickHandlers[i]._element) { | |
that._streamingClickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
that._streamingClickHandlers = []; | |
} | |
/** @type {boolean} */ | |
that._enabled = false; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.StreamingClickHandler.prototype.removePopup = function() { | |
var _bsController = this; | |
if (_bsController._streamingElement) { | |
this._streamingElement.className = this._streamingElement.className.replace(" br-Streaming_active", ""); | |
/** @type {null} */ | |
this._streamingElement = null; | |
_bsController._bsController.webPopupManager.popupHide(); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ToteHoverHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {boolean} */ | |
this._enabled = false; | |
/** @type {Array} */ | |
this._toteHoverHandler = []; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
/** @type {null} */ | |
b365.Ui.Betslip.ToteHoverHandler.prototype._toteElement = null; | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ToteHoverHandler.prototype.handle = function(recurring) { | |
var obj = this; | |
var idToScroll; | |
var $target; | |
var activeClassName; | |
var el; | |
var pos; | |
if (typeof recurring != "undefined") { | |
if (recurring) { | |
$target = $(idToScroll); | |
if (!$target.prop("disabled")) { | |
if (!$target.parents().prop("disabled")) { | |
obj._parentElement = recurring.target.parentElement; | |
el = obj._parentElement.getElementsByClassName("bs-Tote_Popup")[0] || obj._parentElement.getElementsByClassName("br-Tote_Popup")[0]; | |
if (obj._parentElement) { | |
/** @type {string} */ | |
obj._popupActiveClass = " Popup-show"; | |
obj._parentElement.className += obj._popupActiveClass; | |
} | |
pos = el.getBoundingClientRect(); | |
activeClassName = pos.top + el.clientHeight; | |
obj._bsInst.popupShow(activeClassName); | |
} | |
} | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ToteHoverHandler.prototype.attachHandlers = function() { | |
var _this = this; | |
var codeSegments = $(".AusHelp"); | |
var i; | |
var valsLength; | |
if (_this.removeHandlers(_this), codeSegments.length == 0) { | |
/** @type {boolean} */ | |
_this._enabled = false; | |
return; | |
} | |
/** @type {number} */ | |
i = 0; | |
valsLength = codeSegments.length; | |
for (;i < valsLength;i++) { | |
_this._toteHoverHandler.push(new b365.Ui.Betslip.HoverHandler(codeSegments[i], $.proxy(_this.handle, _this), $.proxy(_this.removePopup, _this), false)); | |
} | |
/** @type {boolean} */ | |
_this._enabled = true; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ToteHoverHandler.prototype.removeHandlers = function() { | |
var that = this; | |
var i; | |
var valsLength; | |
if (that._toteHoverHandler.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = that._toteHoverHandler.length; | |
for (;i < valsLength;i++) { | |
if (that._toteHoverHandler[i]._element) { | |
that._toteHoverHandler[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
that._toteHoverHandler = []; | |
} | |
/** @type {boolean} */ | |
that._enabled = false; | |
}; | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ToteHoverHandler.prototype.removePopup = function(dataAndEvents) { | |
var c = this; | |
if (c._popupActiveClass) { | |
if (dataAndEvents) { | |
c._parentElement.className = c._parentElement.className.replace(c._popupActiveClass, ""); | |
/** @type {null} */ | |
c._parentElement = null; | |
/** @type {null} */ | |
c._popupActiveClass = null; | |
c._bsInst.popupHide(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ToteStakeClickHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {boolean} */ | |
this._enabled = false; | |
/** @type {Array} */ | |
this._toteStakeClickHandler = []; | |
this._element; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @param {Object} e | |
* @return {undefined} | |
*/ | |
this._blurHandler = function(e) { | |
var el = e && e.target || e.srcElement; | |
var attrValue = el.getAttribute("placeholdertext"); | |
var r; | |
if (attrValue !== "") { | |
el.setAttribute("placeholder", attrValue); | |
el.setAttribute("placeholdertext", ""); | |
r = $("html").is(".ie-8, .ie-9"); | |
if (r) { | |
if (el.value.length < 1) { | |
el.value = el.getAttribute("placeholder"); | |
} | |
} | |
} | |
}; | |
}; | |
b365.Ui.Betslip.ToteStakeClickHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var handler = this; | |
var fragment = recurring && recurring.target || recurring.srcElement; | |
var offset = fragment.getAttribute("placeholder"); | |
if (offset !== "") { | |
fragment.setAttribute("placeholdertext", offset); | |
fragment.setAttribute("placeholder", ""); | |
} | |
handler.attachBlurHandler(fragment); | |
}, | |
/** | |
* @param {HTMLElement} text | |
* @return {undefined} | |
*/ | |
attachBlurHandler : function(text) { | |
text.addEventListener("blur", this._blurHandler, false); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
attachHandlers : function() { | |
var _this = this; | |
/** @type {NodeList} */ | |
var codeSegments = document.getElementsByClassName("totestkbc"); | |
var i; | |
var valsLength; | |
if (_this.removeHandlers(_this), codeSegments.length == 0) { | |
/** @type {boolean} */ | |
_this._enabled = false; | |
return; | |
} | |
/** @type {number} */ | |
i = 0; | |
/** @type {number} */ | |
valsLength = codeSegments.length; | |
for (;i < valsLength;i++) { | |
_this._toteStakeClickHandler.push(new b365.Ui.Betslip.ResponsiveClickHandler(codeSegments[i], $.proxy(_this.handle, _this), false)); | |
} | |
/** @type {boolean} */ | |
_this._enabled = true; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
removeHandlers : function() { | |
var that = this; | |
var i; | |
var valsLength; | |
if (that._toteStakeClickHandler.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = that._toteStakeClickHandler.length; | |
for (;i < valsLength;i++) { | |
if (that._toteStakeClickHandler[i]._element) { | |
that._toteStakeClickHandler[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
that._toteStakeClickHandler = []; | |
} | |
/** @type {boolean} */ | |
that._enabled = false; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.UnitStakeClickHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {boolean} */ | |
this._enabled = false; | |
/** @type {Array} */ | |
this._unitStakeClickHandler = []; | |
this._element; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @param {Event} event | |
* @return {undefined} | |
*/ | |
this._blurHandler = function(event) { | |
var classes; | |
var indexOfEquals; | |
var name; | |
var el = event.target || event.srcElement; | |
var f; | |
if (el.value.length < 1) { | |
if (el) { | |
classes = el.parentElement.getAttribute("class"); | |
indexOfEquals = classes.indexOf("showUnitStake"); | |
if (indexOfEquals > -1) { | |
name = classes.substring(0, indexOfEquals); | |
el.parentElement.setAttribute("class", name); | |
el.setAttribute("placeholder", el.getAttribute("placeholdertext")); | |
el.setAttribute("placeholdertext", ""); | |
f = $("html").is(".ie-8, .ie-9"); | |
if (f) { | |
el.value = el.getAttribute("placeholder"); | |
if (el.className.indexOf("bs-Stake_TextBox-placeholder") == -1) { | |
el.className += " bs-Stake_TextBox-placeholder"; | |
} | |
} | |
} | |
} | |
el.removeEventListener("blur", this._blurHandler); | |
event.stopPropagation(); | |
event.preventDefault(); | |
} | |
}; | |
}; | |
b365.Ui.Betslip.UnitStakeClickHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var rhtml = this; | |
var e; | |
var value; | |
var elem; | |
var el; | |
var btn; | |
if (typeof recurring != "undefined") { | |
if (recurring) { | |
el = recurring.target || recurring.srcElement; | |
elem = el.parentElement; | |
if (el.value !== "") { | |
$(el).prev().focus(); | |
} | |
if (el.className.indexOf("bs-ToteStake_Input") != -1 && el.value.length < 1) { | |
value = elem.getAttribute("class"); | |
e = value.indexOf(" showUnitStake"); | |
if (e == -1) { | |
if (elem) { | |
elem.setAttribute("class", value + " showUnitStake"); | |
btn = elem.children[0]; | |
if (btn) { | |
btn.setAttribute("placeholdertext", btn.getAttribute("placeholder")); | |
btn.setAttribute("placeholder", ""); | |
} | |
} | |
rhtml.attachBlurHandler(elem); | |
} | |
} else { | |
rhtml.attachBlurHandler(elem); | |
} | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
} | |
} | |
}, | |
/** | |
* @param {Object} context | |
* @return {undefined} | |
*/ | |
attachBlurHandler : function(context) { | |
context.children[0].addEventListener("blur", this._blurHandler, false); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
attachHandlers : function() { | |
var _this = this; | |
/** @type {NodeList} */ | |
var codeSegments = document.getElementsByClassName("unitStake"); | |
var i; | |
var valsLength; | |
if (_this.removeHandlers(_this), codeSegments.length == 0) { | |
/** @type {boolean} */ | |
_this._enabled = false; | |
return; | |
} | |
/** @type {number} */ | |
i = 0; | |
/** @type {number} */ | |
valsLength = codeSegments.length; | |
for (;i < valsLength;i++) { | |
_this._unitStakeClickHandler.push(new b365.Ui.Betslip.ResponsiveClickHandler(codeSegments[i], $.proxy(_this.handle, _this), false)); | |
} | |
/** @type {boolean} */ | |
_this._enabled = true; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
removeHandlers : function() { | |
var that = this; | |
var i; | |
var valsLength; | |
if (that._unitStakeClickHandler.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = that._unitStakeClickHandler.length; | |
for (;i < valsLength;i++) { | |
if (that._unitStakeClickHandler[i]._element) { | |
that._unitStakeClickHandler[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
that._unitStakeClickHandler = []; | |
} | |
/** @type {boolean} */ | |
that._enabled = false; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.BetslipClickHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @param {Object} segment | |
* @return {undefined} | |
*/ | |
this._reorderChildElements = function(segment) { | |
var i; | |
var valsLength; | |
/** @type {number} */ | |
var copies = 0; | |
if (segment.children.length != 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = segment.children.length; | |
for (;i < valsLength;i++) { | |
if (segment.children[i].hasAttribute("data-item-id")) { | |
segment.children[i].setAttribute("data-item-id", copies); | |
/** @type {number} */ | |
copies = copies + 1; | |
} | |
} | |
} | |
}; | |
}; | |
b365.Ui.Betslip.BetslipClickHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var EnhancedBetSlipWinPlaceEachWay = this; | |
var opt_isDefault; | |
/** @type {boolean} */ | |
var r = false; | |
var $target; | |
var $col; | |
var until; | |
var e; | |
var despatch; | |
var curPageObj; | |
var submenu; | |
var failuresLink; | |
var req; | |
if (typeof recurring != "undefined" && recurring) { | |
if (opt_isDefault = recurring.target, $target = $(opt_isDefault), !EnhancedBetSlipWinPlaceEachWay._bsController.clientUsesSelect()) { | |
if (opt_isDefault.id === "betSlipTypeSelection" || opt_isDefault.id == "betSlipTypeSelectionText") { | |
if (this._bsController._stakeEntryType != this._bsController._stakeEntryTypes.deviceKeyBoard) { | |
if (this._bsController._stakeEntryHander._isShowing) { | |
this._bsController._stakeEntryHander.hide(); | |
} | |
} | |
if (EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipTypeSelector) { | |
if (EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipTypeSelector._enabled) { | |
if (EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipTypeSelector._isShowing) { | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipTypeSelector.hidePopUpMenu(); | |
} else { | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipTypeSelector.showPopUpMenu(); | |
} | |
} | |
} else { | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipTypeSelector = new b365.Ui.Betslip.EnhancedBetSlipTypeSelector(EnhancedBetSlipWinPlaceEachWay._bsController); | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipTypeSelector.enablePopUp(); | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipTypeSelector.showPopUpMenu(); | |
} | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
return; | |
} | |
if ($target.hasClass("bs-OddsChoice_SelectionText")) { | |
if (this._bsController._stakeEntryType != this._bsController._stakeEntryTypes.deviceKeyBoard) { | |
if (this._bsController._stakeEntryHander._isShowing) { | |
this._bsController._stakeEntryHander.hide(); | |
} | |
} | |
if (EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipOddsSelector) { | |
if (EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipOddsSelector._enabled) { | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipOddsSelector.showPopUpMenu(recurring); | |
} | |
} else { | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipOddsSelector = new b365.Ui.Betslip.EnhancedBetSlipOddsSelector(EnhancedBetSlipWinPlaceEachWay._bsController); | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipOddsSelector.enablePopUps(); | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipOddsSelector.showPopUpMenu(recurring); | |
} | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
return; | |
} | |
if ($target.hasClass("bs-Pitcher_Options")) { | |
if (this._bsController._stakeEntryType != this._bsController._stakeEntryTypes.deviceKeyBoard) { | |
if (this._bsController._stakeEntryHander._isShowing) { | |
this._bsController._stakeEntryHander.hide(); | |
} | |
} | |
if (EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipPitcherSelector) { | |
if (EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipPitcherSelector._enabled) { | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipPitcherSelector.showPopUpMenu(recurring); | |
} | |
} else { | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipPitcherSelector = new b365.Ui.Betslip.EnhancedBetSlipPitcherSelector(EnhancedBetSlipWinPlaceEachWay._bsController); | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipPitcherSelector.enablePopUps(); | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipPitcherSelector.showPopUpMenu(recurring); | |
} | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
return; | |
} | |
if ($target.hasClass("bs-IfBetType_SelectionText")) { | |
if (this._bsController._stakeEntryType != this._bsController._stakeEntryTypes.deviceKeyBoard) { | |
if (this._bsController._stakeEntryHander._isShowing) { | |
this._bsController._stakeEntryHander.hide(); | |
} | |
} | |
if (EnhancedBetSlipWinPlaceEachWay._bsController._enhancedIfBetSelector) { | |
if (EnhancedBetSlipWinPlaceEachWay._bsController._enhancedIfBetSelector._enabled) { | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedIfBetSelector.showPopUpMenu(recurring); | |
} | |
} else { | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedIfBetSelector = new b365.Ui.Betslip.EnhancedBetSlipIfBetSelector(EnhancedBetSlipWinPlaceEachWay._bsController); | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedIfBetSelector.enablePopUps(); | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedIfBetSelector.showPopUpMenu(recurring); | |
} | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
return; | |
} | |
if ($target.hasClass("bs-TeaserType_SelectionText")) { | |
if (this._bsController._stakeEntryType != this._bsController._stakeEntryTypes.deviceKeyBoard) { | |
if (this._bsController._stakeEntryHander._isShowing) { | |
this._bsController._stakeEntryHander.hide(); | |
} | |
} | |
if (EnhancedBetSlipWinPlaceEachWay._bsController._enhancedTeaserSelector) { | |
if (EnhancedBetSlipWinPlaceEachWay._bsController._enhancedTeaserSelector._enabled) { | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedTeaserSelector.showPopUpMenu(recurring); | |
} | |
} else { | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedTeaserSelector = new b365.Ui.Betslip.EnhancedBetSlipTeaserSelector(EnhancedBetSlipWinPlaceEachWay._bsController); | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedTeaserSelector.enablePopUps(); | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedTeaserSelector.showPopUpMenu(recurring); | |
} | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
return; | |
} | |
if ($target.hasClass("bs-BetMax_Text") || ($target.hasClass("bs-FlexiBetMax_Text") || $target.hasClass("bs-BetMaxMultiple_Text"))) { | |
if (EnhancedBetSlipWinPlaceEachWay._bsController.OnItemBetMax) { | |
EnhancedBetSlipWinPlaceEachWay._bsController.OnItemBetMax(opt_isDefault); | |
} | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
return; | |
} | |
if ($target.hasClass("qb-Btn_Text-quick") || ($target.hasClass("qb-Btn") || ($target.hasClass("qb-Btn_Switch-true") || $target.hasClass("qb-Btn_Switch-false")))) { | |
this._bsController._delegates.toggleQuickBet(); | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
return; | |
} | |
if ($target.hasClass("qb-Help") || $target.hasClass("qb-Help_Text")) { | |
this._bsController._delegates.toggleQuickBetHelpTooltip(true); | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
return; | |
} | |
if ($target.hasClass("qb-Tooltip_Text") || $target.hasClass("qb-Tooltip_Nib")) { | |
this._bsController._delegates.removeQuickBetTooltip(); | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
return; | |
} | |
if ($target.hasClass("bs-Stake_TextBox") || $target.hasClass("bs-MultipleBets_Stake")) { | |
if (bsApp.isIe) { | |
submenu = document.getElementsByClassName("bs-BetSlipType")[0]; | |
if (submenu) { | |
if ($target) { | |
submenu.focus(); | |
$target.focus(); | |
} | |
} | |
} | |
return; | |
} | |
if ($target.hasClass("bs-WinPlaceEachWay_SelectionText")) { | |
if (!EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipWinPlaceEachWay) { | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipWinPlaceEachWay = new b365.Ui.Betslip.EnhancedBetSlipWinPlaceEachWay(EnhancedBetSlipWinPlaceEachWay._bsInst, EnhancedBetSlipWinPlaceEachWay._bsController); | |
} | |
EnhancedBetSlipWinPlaceEachWay._bsController._enhancedBetSlipWinPlaceEachWay.showPopUpMenu(recurring); | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
return; | |
} | |
} | |
if ($target.prop("disabled") || $target.parents().prop("disabled")) { | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
e = new b365.Ui.Betslip.ItemInformation(opt_isDefault); | |
despatch = e.itemIndexAndType(); | |
curPageObj = e.itemElement(); | |
if ($(curPageObj).hasClass("suspended") && !$target.hasClass("remove")) { | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
if ($target.hasClass("bs-Header_RemoveAllLink") || ($target.parents().hasClass("bs-Header_RemoveAllLink") || $target.hasClass("bs-Alert_ErrOkButton"))) { | |
if ($target.parents().hasClass("bs-Header_RemoveAllLink")) { | |
opt_isDefault = $target[0].parentNode; | |
} | |
if (this._bsController.clientEnhancedMode()) { | |
until = $("#stakePad"); | |
$col = $('li[class*="multiple-section"], li[class*="single-section"], li[class*="cast-section"]', "#bsDiv"); | |
if ($col.length > 0) { | |
if (until.length > 0) { | |
this._bsController._enhancedBetSlipAnimations.removeAllBets($col, true, until, this.removeAllBetsCallBack, [opt_isDefault], this); | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
this._bsController._enhancedBetSlipAnimations.removeAllBets($col, false, null, this.removeAllBetsCallBack, [opt_isDefault], this); | |
/** @type {boolean} */ | |
r = true; | |
} | |
} else { | |
(new b365.Ui.Betslip.RemoveAllItemsRequestDespatcher(EnhancedBetSlipWinPlaceEachWay._bsInst, EnhancedBetSlipWinPlaceEachWay._bsController)).despatch(opt_isDefault); | |
/** @type {boolean} */ | |
r = true; | |
} | |
} else { | |
(new b365.Ui.Betslip.RemoveAllItemsRequestDespatcher(EnhancedBetSlipWinPlaceEachWay._bsInst, EnhancedBetSlipWinPlaceEachWay._bsController)).despatch(opt_isDefault); | |
/** @type {boolean} */ | |
r = true; | |
} | |
EnhancedBetSlipWinPlaceEachWay._bsController.getMessageDisplayHandler().clear(); | |
} else { | |
if (($target.hasClass("br-Header_Done") || $target.parent().hasClass("br-Header_Done")) && ($target[0].className.indexOf("br-Italy_Header_Disabled") == -1 && $target[0].parentNode.className.indexOf("br-Italy_Header_Disabled") == -1)) { | |
this._bsInst.clearBets(false); | |
r = this._bsController.clientContinueDelegate(); | |
} else { | |
if ($target.hasClass("br-Header_RetainLink") && $target[0].className.indexOf("br-Italy_Reuse_Disabled") == -1) { | |
if (EnhancedBetSlipWinPlaceEachWay._bsInst.signupModel) { | |
EnhancedBetSlipWinPlaceEachWay._bsInst.signupModel.subscribe(); | |
} | |
(new b365.Ui.Betslip.RetainSelectionsRequestDespatcher(this._bsInst, EnhancedBetSlipWinPlaceEachWay._bsController)).despatch(opt_isDefault); | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
if ($target.hasClass("ebet")) { | |
(new b365.Ui.Betslip.EditSelectionsRequestDespatcher(this._bsInst)).despatch(opt_isDefault); | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
if ($target.hasClass("acceptChanges") || $target.parent().hasClass("acceptChanges")) { | |
(new b365.Ui.Betslip.AcceptChangesRequestDespatcher(this._bsInst, this._bsController)).despatch(opt_isDefault); | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
if ($target.hasClass("mlthd")) { | |
(new b365.Ui.Betslip.ToggleMultiples(this._bsInst, this._bsController)).toggle(); | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
if ($target.hasClass("ctcMessageContainer") || ($target.hasClass("ctcMessage") || $target.hasClass("ctcQuestionmark"))) { | |
$(".ctcMessageDetails").toggle(); | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
if ($target.hasClass("placeBet") || ($target.parent().hasClass("placeBet") || $target.parent().parent().hasClass("placeBet"))) { | |
if (EnhancedBetSlipWinPlaceEachWay._bsController._stakeEntryType == EnhancedBetSlipWinPlaceEachWay._bsController._stakeEntryTypes.deviceKeyBoard) { | |
document.activeElement.blur(); | |
} | |
opt_isDefault = $target.hasClass("placeBet") ? opt_isDefault : $target.parent().parent().hasClass("placeBet") ? $target.parent().parent()[0] : $target.parent()[0]; | |
(new b365.Ui.Betslip.PlaceBetClickHandler(this._bsInst, this._bsController)).handle(opt_isDefault); | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
if ($target.hasClass("bs-RepeatStake_Text")) { | |
(new b365.Ui.Betslip.RepeatStakeClickHandler(this._bsInst, this._bsController, despatch[0], despatch[1], curPageObj)).handle(recurring); | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
if ($target.hasClass("sngbrk") || $target.parents().hasClass("sngbrk")) { | |
(new b365.Ui.Betslip.SingleBreakdownRequestDespatcher(this._bsInst, this._bsController)).despatch(despatch[0]); | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
if ($target.hasClass("mltbrk") || $target.parents().hasClass("mltbrk")) { | |
(new b365.Ui.Betslip.MultiBreakdownRequestDespatcher(this._bsInst, this._bsController)).despatch(despatch[0]); | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
if ($target.hasClass("cstBrkDwn") || $target.parents().hasClass("cstBrkDwn")) { | |
(new b365.Ui.Betslip.CastBreakdownRequestDespatcher(this._bsInst, this._bsController)).despatch(despatch[0]); | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
if ($target.hasClass("bs-BankerIndicator_Btn") || $target.hasClass("bs-BankerIndicator_BtnText")) { | |
if (!$("#bsDiv").hasClass("receipt")) { | |
(new b365.Ui.Betslip.BankerToggleRequestDespatcher(this._bsInst, this._bsController)).despatch(recurring); | |
/** @type {boolean} */ | |
r = true; | |
} | |
} else { | |
if ($target.hasClass("sngPD")) { | |
(new b365.Ui.Betslip.PitcherDetailsRequestDespatcher(this._bsInst, this._bsController)).despatch(recurring); | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
if ($target.attr("id") == "bsjn") { | |
this._bsController.joinNow(); | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
if ($target.attr("id") == "bshst") { | |
this._bsController.membersHistory(); | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
if ($target.hasClass("minusIcon") || $target.hasClass("plusIcon")) { | |
(new b365.Ui.Betslip.StakeChangedHandler(this._bsInst)).handle($target.siblings(".stk").get(0)); | |
/** @type {boolean} */ | |
r = true; | |
} else { | |
if ($target.hasClass("ausHelp")) { | |
failuresLink = { | |
Target : opt_isDefault, | |
Content : $target.parent().attr("data-tooltip") | |
}; | |
this._bsController._delegates.showTooltip(failuresLink); | |
} else { | |
if ($target.hasClass("betCall")) { | |
req = $target.parent() && $target.parent().attr("data-atype") || $target.parent() && ($target.parent().parent() && $target.parent().parent().attr("data-atype")); | |
/** @type {(HTMLElement|null)} */ | |
opt_isDefault = document.getElementById("bc-CallBtn"); | |
if (this._bsController.betCallHandler) { | |
this._bsController.betCallHandler.handle(req, opt_isDefault); | |
} | |
} else { | |
if ($target.hasClass("bs-CheckBoxBetCredit") || $target.hasClass("bs-useBetCreditAmount")) { | |
(new b365.Ui.Betslip.ToggleBetCredit(this._bsInst, this._bsController)).toggle(); | |
/** @type {boolean} */ | |
r = true; | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
if (r) { | |
recurring.preventDefault(); | |
recurring.stopPropagation(); | |
} else { | |
if (this._bsController._stakeEntryType == this._bsController._stakeEntryTypes.stakePad) { | |
if (this._bsController._stakeEntryHander._isShowing) { | |
if (recurring.target.parentNode.id.toLowerCase().indexOf("stakepad") == -1) { | |
this._bsController._stakeEntryHander.hide(); | |
} | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
} | |
} | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
removeAllBetsCallBack : function() { | |
var recurring = arguments[0]; | |
var RemoveAllItemsRequestDespatcher = this; | |
(new b365.Ui.Betslip.RemoveAllItemsRequestDespatcher(RemoveAllItemsRequestDespatcher._bsInst, RemoveAllItemsRequestDespatcher._bsController)).despatch(recurring); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} webglController | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.BetslipChangeHandler = function(dataAndEvents, webglController) { | |
this._bsInst = dataAndEvents; | |
this._controller = webglController; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && typeof this._controller != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.BetslipChangeHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var i; | |
var $target; | |
var itemIndexAndType; | |
var msg; | |
if (typeof recurring != "undefined") { | |
if (recurring) { | |
/** @type {boolean} */ | |
i = false; | |
$target = $(recurring.target); | |
if ($target.prop("disabled") || ($target.parents().prop("disabled") || $target.parents().attr("suspended"))) { | |
/** @type {boolean} */ | |
i = true; | |
} else { | |
itemIndexAndType = new b365.Ui.Betslip.ItemInformation(recurring.target); | |
msg = itemIndexAndType.itemIndexAndType(); | |
if ($target.hasClass("bet-slip-type")) { | |
(new b365.Ui.Betslip.BetslipTypeChangeHandler(this._bsInst, this._controller)).handle(recurring.target); | |
/** @type {boolean} */ | |
i = true; | |
} else { | |
if ($target.hasClass("mlthd")) { | |
(new b365.Ui.Betslip.ToggleMultiples(this._bsInst, this._controller)).toggle(); | |
/** @type {boolean} */ | |
i = true; | |
} else { | |
if ($target.hasClass("teaserSel")) { | |
(new b365.Ui.Betslip.TeaserChangeHandler(this._bsInst)).handle(recurring); | |
/** @type {boolean} */ | |
i = true; | |
} else { | |
if ($target.hasClass("pitcher-sel")) { | |
(new b365.Ui.Betslip.PitcherChangeHandler(this._bsInst)).handle(recurring); | |
/** @type {boolean} */ | |
i = true; | |
} else { | |
if ($target.hasClass("ifbetaction")) { | |
(new b365.Ui.Betslip.IfBetActionChangeHandler(this._bsInst)).handle(msg[0], recurring.target); | |
/** @type {boolean} */ | |
i = true; | |
} else { | |
if ($target.hasClass("odds")) { | |
(new b365.Ui.Betslip.OddsChangeHandler(this._bsInst, this._controller)).handle(recurring, msg[0]); | |
/** @type {boolean} */ | |
i = true; | |
} else { | |
if ($target.hasClass("aus-tote")) { | |
(new b365.Ui.Betslip.AusToteChangeHandler(this._bsInst)).handle(recurring, msg[0], msg[1]); | |
/** @type {boolean} */ | |
i = true; | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
if (i) { | |
recurring.preventDefault(); | |
} | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {string} i | |
* @param {Function} Handler | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ResponsiveClickHandler = function(i, Handler, dataAndEvents) { | |
/** @type {Array} */ | |
this._events = []; | |
/** @type {Array} */ | |
this._touchEvents = []; | |
/** @type {string} */ | |
this._element = i; | |
/** @type {Function} */ | |
this._handler = Handler; | |
this._useCapture = dataAndEvents; | |
/** @type {null} */ | |
this._startX = null; | |
/** @type {null} */ | |
this._startY = null; | |
this._events.push(this.addListener(i, "click", this, this._useCapture)); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ResponsiveClickHandler.prototype.destroy = function() { | |
/** @type {number} */ | |
var i = this._events.length - 1; | |
for (;i >= 0;i -= 1) { | |
this._events[i].destroy(); | |
} | |
/** @type {null} */ | |
this._events = this._touchEvents = this._element = this._handler = this.ResponsiveClickHandler = null; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ResponsiveClickHandler.prototype.reset = function() { | |
if (this._touchEvents) { | |
/** @type {number} */ | |
var _idx = this._touchEvents.length - 1; | |
for (;_idx >= 0;_idx -= 1) { | |
this._touchEvents[_idx].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
this._touchEvents = []; | |
}; | |
/** | |
* @param {Object} target | |
* @param {string} type | |
* @param {Function} listener | |
* @param {?} useCapture | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.ResponsiveClickHandler.prototype.addListener = function(target, type, listener, useCapture) { | |
if (target.addEventListener) { | |
return target.addEventListener(type, listener, useCapture), { | |
/** | |
* @return {undefined} | |
*/ | |
destroy : function() { | |
target.removeEventListener(type, listener, useCapture); | |
} | |
}; | |
} | |
/** | |
* @return {undefined} | |
*/ | |
var handler = function() { | |
listener.handleEvent(window.event, listener); | |
}; | |
return target.attachEvent("on" + type, handler), { | |
/** | |
* @return {undefined} | |
*/ | |
destroy : function() { | |
target.detachEvent("on" + type, handler); | |
} | |
}; | |
}; | |
/** | |
* @param {Event} event | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ResponsiveClickHandler.prototype.handleEvent = function(event) { | |
this.onClick(event); | |
}; | |
/** | |
* @param {Event} e | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.ResponsiveClickHandler.prototype.onClick = function(e) { | |
var r; | |
return!this._handler && e.type == this._touchEndEvent ? (e.target.removeEventListener(this._touchEndEvent, this.handleEvent, this._useCapture), false) : (r = this._handler.call(this._element, e), e.target.tagName === "A" && (e.target.target && e.target.target === "_blank") || (e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true, this.reset(), window.touchBuster && (e.type == this._touchEndEvent && window.touchBuster.preventGhostTouch(this._startX, this._startY))), r); | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {string} i | |
* @param {Function} dataAndEvents | |
* @param {Function} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.HoverHandler = function(i, dataAndEvents, deepDataAndEvents) { | |
/** @type {Array} */ | |
this._events = []; | |
/** @type {string} */ | |
this._element = i; | |
/** @type {Function} */ | |
this._overHandler = dataAndEvents; | |
/** @type {Function} */ | |
this._outHandler = deepDataAndEvents; | |
this._events.push(this.addListener(i, "mouseover", this, this._useCapture)); | |
this._events.push(this.addListener(i, "mouseout", this, this._useCapture)); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.HoverHandler.prototype.destroy = function() { | |
/** @type {number} */ | |
var i = this._events.length - 1; | |
for (;i >= 0;i -= 1) { | |
this._events[i].destroy(); | |
} | |
/** @type {null} */ | |
this._events = this._element = this._overHandler = this._outHandler = this.HoverHandler = null; | |
}; | |
/** | |
* @param {Object} target | |
* @param {string} type | |
* @param {Function} listener | |
* @param {?} useCapture | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.HoverHandler.prototype.addListener = function(target, type, listener, useCapture) { | |
if (target.addEventListener) { | |
return target.addEventListener(type, listener, useCapture), { | |
/** | |
* @return {undefined} | |
*/ | |
destroy : function() { | |
target.removeEventListener(type, listener, useCapture); | |
} | |
}; | |
} | |
/** | |
* @return {undefined} | |
*/ | |
var handler = function() { | |
listener.handleEvent(window.event, listener); | |
}; | |
return target.attachEvent("on" + type, handler), { | |
/** | |
* @return {undefined} | |
*/ | |
destroy : function() { | |
target.detachEvent("on" + type, handler); | |
} | |
}; | |
}; | |
/** | |
* @param {Event} e | |
* @return {?} | |
*/ | |
b365.Ui.Betslip.HoverHandler.prototype.handleEvent = function(e) { | |
var t; | |
return e.type === "mouseover" && e.target === e.currentTarget ? this._overHandler.call(this._element, e) : (mouseOutTarget = e.relatedTarget || e.fromElement, e.type === "mouseout" && mouseOutTarget.parentElement !== e.currentTarget) ? this._outHandler.call(this._element, e) : void 0; | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.BetslipTypeChangeHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @param {(Object|string)} msg | |
* @return {undefined} | |
*/ | |
this._clearCasts = function(msg) { | |
if (msg == this._bsInst.slipIF || (msg == this._bsInst.slipReverseIF || (msg == this._bsInst.slipFixedTeaser || msg == this._bsInst.slipBanker))) { | |
this._bsInst.setBetItems([], this._bsInst.betTypeCast); | |
} | |
}; | |
/** | |
* @param {(Object|string)} msg | |
* @return {undefined} | |
*/ | |
this._resetStakesAndEW = function(msg) { | |
var codeSegments; | |
var i; | |
if (msg == this._bsInst.slipIF || (msg == this._bsInst.slipReverseIF || (msg == this._bsInst.slipBanker || (msg == this._bsInst.slipFixedTeaser || msg == this._bsInst.slipStandard)))) { | |
codeSegments = this._bsInst.getBetItems(this._bsInst.betTypeNormal); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
codeSegments[i].setStItem("ust", "0"); | |
codeSegments[i].setStItem("st", "0"); | |
codeSegments[i].setStItem("tr", "0"); | |
codeSegments[i].setStItem("ust", "0"); | |
codeSegments[i].setStItem("ac", ""); | |
if (!(msg == this._bsInst.slipBanker)) { | |
if (!codeSegments[i].getCnItem("po")) { | |
codeSegments[i].setStItem("ew", "0"); | |
} | |
} | |
} | |
if (msg != this._bsInst.slipBanker) { | |
codeSegments = this._bsInst.getBetItems(this._bsInst.betTypeMultiple); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
codeSegments[i].setStItem("ew", "0"); | |
} | |
} | |
} | |
}; | |
/** | |
* @param {string} errmsg | |
* @return {undefined} | |
*/ | |
this._setSlipType = function(errmsg) { | |
this._bsInst.setValueInBSCookie("bt", errmsg); | |
this._clearCasts(errmsg); | |
this._resetStakesAndEW(errmsg); | |
this._bsInst.updateState(); | |
if (errmsg === this._bsInst.slipStandard || errmsg === this._bsInst.slipBanker) { | |
/** @type {boolean} */ | |
this._bsController.complexMultiplesCombinationsInit = true; | |
} | |
this._bsInst.refresh(this.betTypeAll); | |
}; | |
}; | |
b365.Ui.Betslip.BetslipTypeChangeHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
if (typeof recurring != "undefined") { | |
if (recurring) { | |
this._setSlipType(recurring.value); | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.PitcherChangeHandler = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** @type {string} */ | |
this._baseBallFixtureParticipantCookieKey = "bbfp"; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @param {?} element | |
* @return {undefined} | |
*/ | |
this._updateCustomDropdownAttribute = function(element) { | |
$(element).parent(".betslip-select").attr("data-text", $(element).find("option:selected").text()); | |
}; | |
}; | |
b365.Ui.Betslip.PitcherChangeHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var element = recurring.target; | |
var wrapper = new b365.Ui.Betslip.ItemInformation(element); | |
var _bsInst = wrapper.itemIndexAndType(); | |
var res = this._bsInst.getBetItemById(_bsInst[1], _bsInst[0]); | |
if (res) { | |
res.setStItem(this._baseBallFixtureParticipantCookieKey, element.value); | |
this._updateCustomDropdownAttribute(element); | |
this._bsInst.updateState(); | |
} | |
if (element.options[0].selected) { | |
$(element).parent().parent().find("span.pitch-warn").addClass("hidden"); | |
} else { | |
$(element).parent().parent().find("span.pitch-warn").removeClass("hidden"); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {string} deepDataAndEvents | |
* @param {string} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.TotalsCalculator = function(deepDataAndEvents, dataAndEvents) { | |
/** @type {string} */ | |
this._bsInst = deepDataAndEvents; | |
/** @type {string} */ | |
this._betSlipController = dataAndEvents; | |
this._itemToReturnDisplayHelper = new b365.Ui.Betslip.ItemToReturnDisplayHelper(dataAndEvents); | |
this._freeBetHelper = new b365.Ui.Betslip.BetCreditCalculator(deepDataAndEvents, dataAndEvents); | |
this._ttStkEle = $("#bsDiv .totals .totalStake .total, #bsDiv .placeBet .totalStake"); | |
this._totalStakeElement = $("#totalStake", "#bsDiv"); | |
this._isoCurrencyElement = $(".isoCurrency"); | |
this._totalReturnEle = $(".totalReturn"); | |
this._taxWarnEle = $("#bsDiv .totals .tax-warning"); | |
this._ttCurrencyEle = $("#bsDiv .totals .isoCurrency .total, #bsDiv .placeBet .isoCurrency"); | |
this._isoCodeData = $("#bsDiv>ul").attr("data-isocode"); | |
this._taxHeader = $("#taxWarningHeader"); | |
this._formatter = new b365.Ui.Formatter; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @param {Array} codeSegments | |
* @param {string} prop | |
* @param {string} isXML | |
* @return {?} | |
*/ | |
this._calcTotalStake = function(codeSegments, prop, isXML) { | |
var s = this._betSlipController.ausMultiplesEnabled(); | |
/** @type {number} */ | |
var total = 0; | |
var v; | |
var i; | |
var lastCharWasOpenCurly; | |
var index; | |
prop = prop ? prop : "st"; | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
/** @type {number} */ | |
v = Number(codeSegments[i].getStItem(prop) ? codeSegments[i].getStItem(prop) : ""); | |
/** @type {boolean} */ | |
lastCharWasOpenCurly = codeSegments[i].getStItem("ew") == "1"; | |
if (isNaN(v) === false) { | |
/** @type {number} */ | |
v = Math.round(v * 100); | |
/** @type {number} */ | |
index = Number(codeSegments[i].getCnItem("bc") ? codeSegments[i].getCnItem("bc") : codeSegments[i].getStItem("bc") ? codeSegments[i].getStItem("bc") : "1"); | |
if (index > 1 || lastCharWasOpenCurly) { | |
if (s) { | |
if (this._bsInst.getSlipType() == this._bsInst.slipStandard) { | |
if (codeSegments[i].getCnItem("pt") == undefined) { | |
/** @type {boolean} */ | |
lastCharWasOpenCurly = false; | |
} | |
} | |
} | |
total += Number(String(v * (lastCharWasOpenCurly ? 2 : 1) * index)); | |
} else { | |
total += v; | |
} | |
} | |
} | |
return $blib.pad2DP(String(total / 100), isXML); | |
}; | |
/** | |
* @param {string} isXML | |
* @return {undefined} | |
*/ | |
this._updateIfReverseIfTotals = function(isXML) { | |
var codeSegments = bs.getBetItems(bs.betTypeNormal); | |
var r = codeSegments[0].getStItem("st"); | |
/** @type {number} */ | |
var fmt = 0; | |
/** @type {number} */ | |
var pauseText = 0; | |
if (codeSegments.length > 0) { | |
if (typeof r != "undefined") { | |
fmt = $blib.roundDecimal(String(Number(r) * (bs.getSlipType() == bs.slipReverseIF ? 2 : 1))); | |
} | |
} | |
if (bs.getSlipType() == bs.slipIF || bs.getSlipType() == bs.slipReverseIF) { | |
this._setTotalToWin(); | |
} | |
pauseText = $blib.pad2DP(String(fmt), isXML); | |
this._ttStkEle.text(pauseText); | |
this._totalStakeElement.text(pauseText); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._setTotalToWin = function() { | |
/** @type {boolean} */ | |
var ctrl = this._bsInst.getSlipType() == this._bsInst.slipReverseIF; | |
var endEvent = {}; | |
var elem; | |
var value; | |
var expandIconEl; | |
this._initParams(endEvent); | |
this._totalSingleItems(endEvent); | |
if (!endEvent.someSp) { | |
this._totalCastItems(endEvent); | |
} | |
elem = document.getElementsByClassName("totalReturn")[0]; | |
if (!(endEvent.numStakes > 0) || (endEvent.someSp || (endEvent.someEW || endEvent.someRelated && endEvent.numStakes > 1))) { | |
if (endEvent.someRelated) { | |
if (ctrl) { | |
expandIconEl = document.getElementsByClassName("stake")[0]; | |
expandIconEl.className += " hidden"; | |
} else { | |
elem = document.getElementsByClassName("totalReturnWrapper")[0]; | |
elem.className += " hidden"; | |
} | |
} else { | |
if (endEvent.someSp) { | |
elem.innerHTML = betSlipML.sp; | |
} else { | |
if (elem) { | |
elem.innerHTML = this._betSlipController._currencyDisplayHelper.formatCurrency("0.00"); | |
} | |
} | |
} | |
} else { | |
value = ctrl ? endEvent.totTw * 2 : endEvent.totTw; | |
/** @type {number} */ | |
value = parseFloat(Math.floor(value * 100 + 1E-6) / 100); | |
elem.innerHTML = this._betSlipController && this._betSlipController._currencyDisplayHelper ? this._betSlipController._currencyDisplayHelper.formatCurrency(this._formatter.roundDecimal(String(value))) : this._formatter.roundDecimal(String(value)); | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._setTotalToReturn = function() { | |
var li; | |
var dh; | |
var obj; | |
var s; | |
var elem; | |
var labels; | |
var _len; | |
var _i; | |
var h; | |
var receivedElement; | |
if (!this._betSlipController.complexMultiplesProcessing && ((li = $("#bsDiv .bs-TotalToReturn_TextValue")[0], dh = this._bsInst.getSlipType() == this._bsInst.slipReverseIF, li) && (obj = {}, this._initParams(obj), obj.ausMultiplesEnabled = this._betSlipController.ausMultiplesEnabled(), this._totalSingleItems(obj), obj.someSp || this._totalCastItems(obj), obj.ausMultiplesEnabled && (!obj.hasSp && this._totalMultipleItems(obj)), !(obj.numStakes > 0) || (obj.someSp || (obj.someEW || obj.someRelated && | |
obj.numStakes > 1)) ? obj.ausMultiplesEnabled || (obj.someRelated ? dh ? (elem = document.getElementsByClassName("stake")[0], elem.className += " hidden") : li.className += " hidden" : li && (li.innerHTML = this._betSlipController._currencyDisplayHelper.formatCurrency("0.00"))) : (s = dh ? obj.totTw * 2 : obj.totTw, s = parseFloat(Math.floor(s * 100 + 1E-6) / 100), li.innerHTML = this._betSlipController && this._betSlipController._currencyDisplayHelper ? this._betSlipController._currencyDisplayHelper.formatCurrency(this._formatter.roundDecimal(String(s))) : | |
this._formatter.roundDecimal(String(s))), (!obj.ausMultiplesEnabled || (obj.ausMultiplesInvalid || obj.someRelated)) && (labels = $('#bsDiv .bs-MultipleBets [data-item-type="multiple"], .bs-MultipleBetsBanker [data-item-type="multiple"]'), _len = 0, labels && labels.length > 0)))) { | |
_len = labels.length; | |
/** @type {number} */ | |
_i = 1; | |
for (;_i < _len;_i++) { | |
h = $(labels[_i]).find(".stk")[0]; | |
receivedElement = $(labels[_i]).find(".bs-MultipleBets_ToReturn")[0]; | |
if (receivedElement) { | |
receivedElement.setAttribute("style", "display:none;"); | |
} | |
} | |
} | |
}; | |
/** | |
* @param {?} event | |
* @return {undefined} | |
*/ | |
this._initParams = function(event) { | |
/** @type {number} */ | |
event.numStakes = 0; | |
/** @type {number} */ | |
event.totTw = 0; | |
/** @type {number} */ | |
event.totalToReturn = 0; | |
/** @type {boolean} */ | |
event.someSp = false; | |
/** @type {boolean} */ | |
event.someEW = false; | |
/** @type {boolean} */ | |
event.someRelated = false; | |
/** @type {number} */ | |
event.totStk = isNaN(this._ttStkEle.text()) ? 0 : Number(this._ttStkEle.text()); | |
/** @type {Array} */ | |
event.eachWayArray = []; | |
/** @type {boolean} */ | |
event.ausMultiplesEnabled = false; | |
/** @type {boolean} */ | |
event.ausMultiplesInvalid = false; | |
/** @type {number} */ | |
event.singlesCount = 0; | |
}; | |
/** | |
* @param {?} pos | |
* @return {undefined} | |
*/ | |
this._totalMultipleItems = function(pos) { | |
var valsLength; | |
var i; | |
var headers = $('#bsDiv .bs-MultipleBets [data-item-id="-1"]'); | |
var node; | |
var options; | |
var t; | |
var speed; | |
var r; | |
var transform; | |
var value; | |
var cz; | |
if (headers) { | |
if (headers.length > 0) { | |
node = $(headers[0]).find(".bs-MultipleBets_BetCount")[0]; | |
if (node) { | |
/** @type {string} */ | |
node.innerHTML = pos.singlesCount + "x"; | |
} | |
} | |
} | |
valsLength = this._betSlipController.complexMultiplesInfo.length; | |
var titleRows = $('#bsDiv .bs-MultipleBets .bs-MultipleBets_BetRow, .bs-MultipleBetsBanker [data-item-type="multiple"]'); | |
var symbol = this._bsInst.getBetItems(this._bsInst.betTypeMultiple); | |
var tmpSet = this._betSlipController._currencyDisplayHelper.getDecimalSeperator(); | |
/** @type {number} */ | |
i = 0; | |
for (;i < valsLength;i++) { | |
if (options = this._betSlipController.complexMultiplesInfo[i], t = symbol[i], !t) { | |
/** @type {boolean} */ | |
pos.ausMultiplesInvalid = true; | |
return; | |
} | |
if (speed = options.LC, r = t.getStItem("st"), titleRows.length > 0) { | |
transform = getBetslipWebModule(); | |
if (options.combinations) { | |
speed = transform.getBetCount(options.combinations, pos.eachWayArray); | |
} else { | |
/** @type {boolean} */ | |
pos.ausMultiplesInvalid = true; | |
} | |
t.setCnItem("bc", speed); | |
this._bsInst.updateState(); | |
var b = $(titleRows[i]).find(".bs-MultipleBets_ToReturnValue")[0]; | |
/** @type {number} */ | |
var dragMagnitude = Number(r) * speed; | |
var style = $(titleRows[i]).find(".bs-MultipleBets_BetCount")[0]; | |
var input = $(titleRows[i]).find(".bs-MultipleBets_Stake"); | |
if (style) { | |
/** @type {string} */ | |
style.innerHTML = speed + "x"; | |
} | |
if (input) { | |
if (input.length > 0) { | |
value = betSlipML.stake; | |
if (speed > 1) { | |
value = betSlipML.unitstake; | |
} | |
if (input[0].getAttribute("placeholder") != value) { | |
input.attr("placeholder", value); | |
} | |
cz = input.val(); | |
if (cz == betSlipML.unitstake || cz == betSlipML.stake) { | |
input.val(value); | |
} | |
} | |
} | |
} | |
} | |
stakeDisplay = this._calcTotalStake(this._bsInst.getBetItems(this._bsInst.betTypeAll), undefined, tmpSet); | |
this._ttStkEle.text(stakeDisplay); | |
this._totalStakeElement.text(stakeDisplay); | |
}; | |
/** | |
* @param {?} event | |
* @return {undefined} | |
*/ | |
this._totalSingleItems = function(event) { | |
var val2; | |
var context; | |
var initial; | |
event.ausMultiplesEnabled = this._betSlipController.ausMultiplesEnabled(); | |
var failuresLink = new b365.Ui.Betslip.TaxCalculator(this._bsInst); | |
/** @type {number} */ | |
var rval = 0; | |
var node = this._bsInst.getBetItems(this._bsInst.betTypeNormal); | |
/** @type {boolean} */ | |
var au = window.location.host.split(".").pop() == "au"; | |
var o; | |
var val; | |
var target; | |
var type; | |
var fx; | |
var method; | |
/** @type {boolean} */ | |
var ft = false; | |
/** @type {number} */ | |
var bool = 0; | |
var l = node.length; | |
for (;bool < l;bool++) { | |
o = $blib.getItemOdds(this._bsInst.itemTypeSingle, node[bool]); | |
val = node[bool].getStItem("st"); | |
/** @type {number} */ | |
val = val - parseFloat(val) >= 0 ? Number(val) : 0; | |
/** @type {boolean} */ | |
target = type = false; | |
/** @type {boolean} */ | |
fx = o == "" || (o == "0" || (o == "0/0" || node[bool].getStItem("sp") == "1")); | |
if (fx) { | |
/** @type {boolean} */ | |
event.hasSp = true; | |
/** @type {boolean} */ | |
event.ausMultiplesInvalid = true; | |
} | |
/** @type {boolean} */ | |
target = node[bool].getStItem("ew") == "1"; | |
/** @type {boolean} */ | |
method = node[bool].getCnItem("po") != undefined; | |
event.singlesCount++; | |
if (target || method) { | |
event.singlesCount++; | |
event.eachWayArray.push([(bool + 1).toString()]); | |
} | |
if (val > 0) { | |
/** @type {boolean} */ | |
type = fx; | |
event.someSp = event.someSp || type; | |
event.someEW = event.someEW || target; | |
event.numStakes++; | |
if (this._bsInst.getSlipType() == this._bsInst.slipIF || this._bsInst.getSlipType() == this._bsInst.slipReverseIF) { | |
if (event.numStakes == 1) { | |
/** @type {number} */ | |
event.totStk = Number(val); | |
} | |
} | |
} | |
if (!event.someRelated) { | |
event.someRelated = $('#bsDiv li[data-item-id="' + bool + '"][data-item-type="single"]').hasClass("bs-RestrictedCong"); | |
} | |
if (!type) { | |
if (!(target && !event.ausMultiplesEnabled)) { | |
ft = node[bool].getStItem("ft"); | |
failuresLink._isFreeBet = ft; | |
rval = this._totalSlipItem(failuresLink, bool, val, o); | |
val2 = $blib.pad2DP(String(rval)); | |
if (!event.ausMultiplesEnabled) { | |
this._itemToReturnDisplayHelper.setReturnValue(bool, "single", val2); | |
this._itemToReturnDisplayHelper.setVisibility(bool, "single", true); | |
} | |
event.totTw += this._bsInst.getSlipType() == this._bsInst.slipIF ? Number(this._totalSlip(failuresLink, bool, val, o)) : Number(val2); | |
} | |
} | |
event.totalToReturn = event.totTw; | |
} | |
/** @type {number} */ | |
bool = 0; | |
l = node.length; | |
for (;bool < l;bool++) { | |
o = $blib.getItemOdds(this._bsInst.itemTypeSingle, node[bool]); | |
/** @type {boolean} */ | |
type = o == "" || (o == "0" || (o == "0/0" || node[bool].getStItem("sp") == "1")); | |
/** @type {boolean} */ | |
target = node[bool].getStItem("ew") == "1"; | |
context = this._betSlipController.ausMultiplesEnabled(); | |
/** @type {boolean} */ | |
initial = bs.getSlipType() == this._bsInst.slipReverseIF; | |
if ((type || target && !context) && !initial) { | |
this._itemToReturnDisplayHelper.setVisibility(bool, "single", false, context ? false : target); | |
} else { | |
if (target && (context && !initial)) { | |
this._itemToReturnDisplayHelper.setVisibility(bool, "single", false, true, true); | |
} else { | |
this._itemToReturnDisplayHelper.setVisibility(bool, "single", true, false); | |
} | |
} | |
} | |
}; | |
/** | |
* @param {?} el | |
* @param {number} bool | |
* @param {number} key | |
* @param {string} text | |
* @return {?} | |
*/ | |
this._totalSlipItem = function(el, bool, key, text) { | |
var camelKey = el.calcReturnsByLine(key, text); | |
switch(this._bsInst.getSlipType()) { | |
case this._bsInst.slipReverseIF: | |
if (bool !== 0) { | |
/** @type {number} */ | |
camelKey = this._formatter.roundFixed(camelKey, 2) - this._formatter.roundFixed(key, 2); | |
} | |
; | |
} | |
return camelKey; | |
}; | |
/** | |
* @param {?} el | |
* @param {number} bool | |
* @param {number} key | |
* @param {string} text | |
* @return {?} | |
*/ | |
this._totalSlip = function(el, bool, key, text) { | |
var camelKey = el.calcReturnsByLine(key, text); | |
return bool !== 0 && (camelKey = this._formatter.roundFixed(camelKey, 2) - this._formatter.roundFixed(key, 2)), camelKey; | |
}; | |
/** | |
* @param {?} event | |
* @return {undefined} | |
*/ | |
this._totalCastItems = function(event) { | |
var jQuery = new b365.Ui.Betslip.TaxCalculator(this._bsInst); | |
var node = this._bsInst.getBetItems(this._bsInst.betTypeCast); | |
var type; | |
var val; | |
var arg; | |
/** @type {number} */ | |
var bool = 0; | |
var l = node.length; | |
for (;bool < l && !event.someSp;bool++) { | |
type = $blib.getItemOdds(this._bsInst.betTypeCast, node[bool]); | |
val = node[bool].getStItem("st"); | |
if (val) { | |
if (parseFloat(val) != NaN) { | |
if (parseFloat(val) > 0) { | |
event.numStakes++; | |
event.someSp = event.someSp || (type == "" || (type == "0" || (type == "0/0" || node[bool].getStItem("sp") == "1"))); | |
if (!event.someRelated) { | |
event.someRelated = $('#bsDiv li[data-item-id="' + bool + '"][data-item-type="cast"]').hasClass("bs-RestrictedCong"); | |
} | |
} | |
} | |
} | |
if (!event.someSp) { | |
arg = jQuery.calcReturnsByLine(val, type); | |
this._itemToReturnDisplayHelper.setReturnValue(bool, "cast", $blib.pad2DP(String(arg))); | |
event.totTw += arg; | |
event.totalToReturn += Number(arg); | |
} | |
} | |
/** @type {number} */ | |
bool = 0; | |
l = node.length; | |
for (;bool < l;bool++) { | |
type = $blib.getItemOdds(this._bsInst.betTypeCast, node[bool]); | |
/** @type {boolean} */ | |
event.someSp = type == "" || (type == "0" || (type == "0/0" || node[bool].getStItem("sp") == "1")); | |
if (event.someSp) { | |
this._itemToReturnDisplayHelper.setVisibility(bool, "cast", false); | |
} else { | |
this._itemToReturnDisplayHelper.setVisibility(bool, "cast", true); | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._hasMultiplesWithStake = function() { | |
var codeSegments = this._bsInst.getBetItems(this._bsInst.itemTypeMultiple); | |
/** @type {boolean} */ | |
var gotError = false; | |
var cDigit; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < codeSegments.length && !gotError;i++) { | |
cDigit = codeSegments[i].getStItem("st"); | |
if (cDigit) { | |
if (parseFloat(cDigit) != NaN) { | |
if (parseFloat(cDigit) > 0) { | |
/** @type {boolean} */ | |
gotError = true; | |
} | |
} | |
} | |
} | |
return gotError; | |
}; | |
}; | |
b365.Ui.Betslip.TotalsCalculator.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
calculate : function() { | |
var tmpSet; | |
var x; | |
var s; | |
var valsLength; | |
var endEvent; | |
if (this._isValid()) { | |
tmpSet = this._betSlipController.getCurrencyObject().decimalSeparator; | |
/** @type {number} */ | |
x = 0; | |
switch(this._bsInst.getSlipType()) { | |
case this._bsInst.slipReverseIF: | |
; | |
case this._bsInst.slipIF: | |
this._updateIfReverseIfTotals(tmpSet); | |
break; | |
case this._bsInst.slipBanker: | |
if (this._betSlipController) { | |
if (this._betSlipController._currencyDisplayHelper) { | |
x = this._betSlipController._currencyDisplayHelper.formatCurrency(this._calcTotalStake(this._bsInst.getBetItems(this._bsInst.betTypeMultiple), undefined, tmpSet)); | |
} | |
} | |
this._totalStakeElement.text(x); | |
this._ttStkEle.text(x); | |
this._setTotalToReturn(); | |
break; | |
default: | |
x = this._betSlipController && this._betSlipController._currencyDisplayHelper ? this._betSlipController._currencyDisplayHelper.formatCurrency(this._calcTotalStake(this._bsInst.getBetItems(this._bsInst.betTypeAll), undefined, tmpSet)) : this._calcTotalStake(this._bsInst.getBetItems(this._bsInst.betTypeAll), undefined, tmpSet); | |
this._ttStkEle.text(x); | |
this._totalStakeElement.text(x); | |
var a = this.getFreeBetItem(); | |
var udataCur = a && (a.getStItem("fbv") || a.getStItem("st")); | |
var y = udataCur && this._betSlipController._currencyDisplayHelper.formatCurrency(udataCur); | |
var pauseText = $("#bsDiv").children("ul:first-child").data("isocode"); | |
if (y) { | |
s = new b365.Ui.Betslip.ItemInformation(a[0]); | |
/** @type {number} */ | |
valsLength = document.getElementsByClassName("betReceipt").length; | |
if (valsLength) { | |
/** @type {string} */ | |
x = x === y ? y + " (" + betSlipML.free + ")" : x + " (" + y + " " + betSlipML.free + ")"; | |
this._ttStkEle.text(x); | |
this._totalStakeElement.text(x); | |
} else { | |
this._isoCurrencyElement.text(pauseText); | |
} | |
} else { | |
this._isoCurrencyElement.text(pauseText); | |
} | |
endEvent = {}; | |
this._initParams(endEvent); | |
this._totalSingleItems(endEvent); | |
if (!endEvent.someSp) { | |
this._totalCastItems(endEvent); | |
} | |
if (this._bsInst.getValueFromBSCookie("fs").replace("||", "") == 1 || (document.getElementsByClassName("bs-FreeBetCheckBox-selected").length > 0 || (document.getElementsByClassName("br-UsingFreeBet").length > 0 || (document.getElementsByClassName("br-FreeBetIcon_Redeemed").length > 0 || (document.getElementsByClassName("bs-MultipleBets_HighestAccumulator").length > 0 || this._betSlipController.ausMultiplesEnabled()))))) { | |
this._freeBetHelper.calculate(); | |
x = this._calcTotalStake(this._bsInst.getBetItems(this._bsInst.betTypeAll), undefined, this._betSlipController.getCurrencyObject().decimalSeparator); | |
this._ttStkEle.text(x); | |
this._totalStakeElement.text(x); | |
} else { | |
this._setTotalToReturn(); | |
} | |
; | |
} | |
this._bsInst.contentChangedOnClient(); | |
} | |
}, | |
/** | |
* @return {?} | |
*/ | |
getFreeBetItem : function() { | |
var codeSegments = this._bsInst.getBetItems(this._bsInst.betTypeAll) || []; | |
/** @type {number} */ | |
var i = 0; | |
var valuesLen = codeSegments.length; | |
for (;i < valuesLen;i++) { | |
if (codeSegments[i].getStItem("ft")) { | |
return codeSegments[i]; | |
} | |
} | |
return null; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.MultipleStakeChangedHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.MultipleStakeChangedHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @return {undefined} | |
*/ | |
handle : function(recurring, opt_isDefault) { | |
if (recurring >= 0) { | |
var a = this._bsInst.getBetItemById(this._bsInst.itemTypeMultiple, recurring); | |
var fromIndex = $blib.to2DP(opt_isDefault.value); | |
if (Number(fromIndex) > $blib.getMaxStake()) { | |
/** @type {string} */ | |
opt_isDefault.value = String($blib.getMaxStake()); | |
} | |
a.setStItem("st", opt_isDefault.value); | |
a.setStItem("ust", opt_isDefault.value); | |
this._bsController.updateMultiplesEachWayFlag(); | |
this._bsInst.updateState(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.SingleStakeChangedHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.SingleStakeChangedHandler.prototype = { | |
/** | |
* @param {string} res | |
* @param {number} recurring | |
* @return {undefined} | |
*/ | |
updateAllStakes : function(res, recurring) { | |
/** @type {string} */ | |
var obj = res; | |
var results = $('#bsDiv li[data-item-type="single"]:not(.suspended) .stake .stk'); | |
/** @type {string} */ | |
var caption = ""; | |
var self = new b365.Ui.Betslip.ToReturnCalculator(this._bsInst); | |
var k; | |
var l; | |
var maybeEnd; | |
var value; | |
if (this._bsController) { | |
if (this._bsController._currencyDisplayHelper) { | |
obj = this._bsController._currencyDisplayHelper.unformatCurrency(res); | |
} | |
} | |
if (res != "") { | |
caption = $blib.pad2DP(String(obj)); | |
if (this._bsController._currencyDisplayHelper) { | |
caption = this._bsController._currencyDisplayHelper.formatCurrency(caption); | |
} | |
} | |
maybeEnd = $("html").is(".ie-8, .ie-9"); | |
/** @type {number} */ | |
k = recurring; | |
l = results.length; | |
for (;k < l;k++) { | |
if (!(results[k].className.indexOf("bs-FreeBet-disabled") > -1)) { | |
value = $(".bs-CheckBoxBetCredit").hasClass("checked"); | |
if (maybeEnd && caption == "") { | |
results[k].value = results[k].getAttribute("placeholder"); | |
if (results[k].className.indexOf("bs-Stake_TextBox-placeholder") == -1) { | |
results[k].className += " bs-Stake_TextBox-placeholder"; | |
} | |
} else { | |
results[k].value = caption; | |
results[k].className = results[k].className.replace("bs-Stake_TextBox-placeholder", ""); | |
} | |
this._bsInst.getBetItems(this._bsInst.itemTypeSingle)[k].setStItem("st", obj); | |
self.calculate(k, this._bsInst.itemTypeSingle, results[k]); | |
if (this._bsController.getPushMarketsEnabled()) { | |
(new b365.Ui.Betslip.StakeEntryRules(this._bsController)).PushBetDisplayUpdate(k, this._bsInst.itemTypeSingle, results[k]); | |
} | |
} | |
} | |
}, | |
/** | |
* @param {Object} recurring | |
* @param {boolean} dataAndEvents | |
* @param {boolean} opt_isDefault | |
* @return {undefined} | |
*/ | |
handle : function(recurring, dataAndEvents, opt_isDefault) { | |
/** @type {(HTMLElement|null)} */ | |
var instanceMethods = document.getElementById("bsDiv"); | |
var heads; | |
var _ref; | |
var root; | |
var clone; | |
var data_item_push; | |
var oldconfig; | |
var el; | |
var _i; | |
var _len; | |
if (this._isValid()) { | |
switch(this._bsInst.getSlipType()) { | |
case this._bsInst.slipIF: | |
(new b365.Ui.Betslip.IFBetStakeChangedHandler(this._bsInst, this._bsController)).handle(recurring, opt_isDefault); | |
break; | |
case this._bsInst.slipReverseIF: | |
(new b365.Ui.Betslip.ReverseIfBetStakeChangedHandler(this._bsInst, this._bsController)).handle(recurring, opt_isDefault); | |
break; | |
default: | |
(new b365.Ui.Betslip.ToReturnCalculator(this._bsInst)).calculate(recurring, dataAndEvents, opt_isDefault); | |
if (this._bsController.getPushMarketsEnabled()) { | |
(new b365.Ui.Betslip.StakeEntryRules(this._bsController)).PushBetDisplayUpdate(recurring, dataAndEvents, opt_isDefault); | |
} | |
; | |
} | |
if (this._bsController.getPushMarketsEnabled() && (heads = instanceMethods.getElementsByClassName("single-section"), heads.length > 0)) { | |
_ref = heads[0].getElementsByTagName("li"); | |
/** @type {number} */ | |
_i = 0; | |
_len = _ref.length; | |
for (;_i < _len;_i++) { | |
root = _ref[_i]; | |
data_item_push = root.getAttribute("data-item-push"); | |
if (data_item_push > 0) { | |
oldconfig = root.getAttribute("data-item-id"); | |
clone = root.getElementsByClassName("stk")[0]; | |
if (clone.length > 0) { | |
el = clone.value; | |
} | |
if (!isNaN(el)) { | |
if (el > 0) { | |
(new b365.Ui.Betslip.StakeEntryRules(scope._bsController)).PushBetDisplayUpdate(oldconfig, scope._bsInst.itemTypeSingle, clone); | |
} | |
} | |
} | |
} | |
} | |
(new b365.Ui.Betslip.RepeatStakeVisibilitySetter(this._bsInst)).set(opt_isDefault); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.CastStakeChangedHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.CastStakeChangedHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @param {Object} elem | |
* @return {undefined} | |
*/ | |
handle : function(recurring, opt_isDefault, elem) { | |
var that; | |
var assert; | |
var chr2; | |
var ret; | |
var last; | |
var obj; | |
var num; | |
var id; | |
var val; | |
var section; | |
if (this._isValid()) { | |
that = new b365.Ui.Formatter; | |
assert = this._bsInst.getBetItemById(opt_isDefault, recurring); | |
elem.value = $blib.isDecimal(elem.value) ? that.roundValue(elem.value) : ""; | |
/** @type {Object} */ | |
obj = elem; | |
assert.setStItem("st", elem.value); | |
/** @type {number} */ | |
chr2 = parseInt(assert.getStItem("bc"), 10); | |
if (!isNaN(chr2)) { | |
if (chr2 > 1) { | |
ret = elem.value; | |
if (this._bsController._currencyDisplayHelper) { | |
if (ret) { | |
if (ret != "") { | |
ret = this._bsController._currencyDisplayHelper.unformatCurrency(elem.value); | |
} | |
} | |
} | |
if (elem.className.indexOf("totestkbc") > -1) { | |
/** @type {number} */ | |
num = ret / chr2 * 100; | |
id = that.roundDecimal((Math.floor(num) * 0.01).toFixed(2)); | |
id = id === "0.00" ? "" : id; | |
if (id !== "") { | |
if (this._bsController._currencyDisplayHelper) { | |
id = this._bsController._currencyDisplayHelper.formatCurrency(id); | |
} | |
} | |
obj = document.getElementsByClassName("bs-Item")[recurring].getElementsByClassName("stk")[0]; | |
if (obj) { | |
obj.value = id; | |
this.updateUnitStake(obj); | |
} | |
last = id; | |
} else { | |
val = that.roundDecimal(Number(ret) * chr2); | |
val = val === "0.00" ? "" : val; | |
if (val !== "") { | |
if (this._bsController._currencyDisplayHelper) { | |
val = this._bsController._currencyDisplayHelper.formatCurrency(val); | |
} | |
} | |
section = document.getElementsByClassName("bs-Item")[recurring].getElementsByClassName("totestkbc")[0]; | |
if (section) { | |
if (section.className.indexOf("bs-AusCastStake_Value") == -1) { | |
section.value = val; | |
this.updateStake(section); | |
} else { | |
section.innerHTML = val; | |
} | |
} | |
last = ret; | |
} | |
assert.setStItem("gst", last); | |
assert.setStItem("gust", last); | |
} | |
} | |
this._bsInst.updateState(); | |
} | |
(new b365.Ui.Betslip.ToReturnCalculator(this._bsInst)).calculate(recurring, opt_isDefault, obj); | |
(new b365.Ui.Betslip.RepeatStakeVisibilitySetter(this._bsInst)).set(obj); | |
}, | |
/** | |
* @param {Element} el | |
* @return {undefined} | |
*/ | |
updateUnitStake : function(el) { | |
var node = el.parentElement; | |
var value = node.getAttribute("class"); | |
var index = value.indexOf("showUnitStake"); | |
var setClass = document.getElementsByTagName("html")[0].className; | |
/** @type {boolean} */ | |
var f = setClass.indexOf("ie-8") > -1 || setClass.indexOf("ie-9") > -1; | |
if (el.value.length > 0) { | |
if (index == -1) { | |
node.setAttribute("class", value + " showUnitStake"); | |
el.setAttribute("placeholdertext", el.getAttribute("placeholder")); | |
el.setAttribute("placeholder", ""); | |
} | |
if (f) { | |
if (el.className.indexOf("bs-Stake_TextBox-placeholder") > -1) { | |
el.className = el.className.replace(" bs-Stake_TextBox-placeholder", ""); | |
} | |
} | |
} else { | |
if (el.value.length === 0) { | |
if (index > -1) { | |
node.setAttribute("class", value.substring(0, index)); | |
el.setAttribute("placeholder", el.getAttribute("placeholdertext")); | |
el.setAttribute("placeholdertext", ""); | |
} | |
if (f) { | |
el.value = el.getAttribute("placeholder"); | |
if (el.className.indexOf("bs-Stake_TextBox-placeholder") == -1) { | |
el.className += " bs-Stake_TextBox-placeholder"; | |
} | |
} | |
} | |
} | |
}, | |
/** | |
* @param {Element} el | |
* @return {undefined} | |
*/ | |
updateStake : function(el) { | |
var setClass = document.getElementsByTagName("html")[0].className; | |
/** @type {boolean} */ | |
var u = setClass.indexOf("ie-8") > -1 || setClass.indexOf("ie-9") > -1; | |
var r; | |
var attrValue; | |
if (el.value.length > 0) { | |
r = el.getAttribute("placeholder"); | |
if (r !== "") { | |
el.setAttribute("placeholdertext", r); | |
el.setAttribute("placeholder", ""); | |
} | |
if (u) { | |
if (el.className.indexOf("bs-Stake_TextBox-placeholder") > -1) { | |
el.className = el.className.replace(" bs-Stake_TextBox-placeholder", ""); | |
} | |
} | |
} else { | |
if (el.value.length === 0) { | |
attrValue = el.getAttribute("placeholdertext"); | |
if (attrValue !== "") { | |
el.setAttribute("placeholder", attrValue); | |
el.setAttribute("placeholdertext", ""); | |
} | |
if (u) { | |
el.value = el.getAttribute("placeholder"); | |
if (el.className.indexOf("bs-Stake_TextBox-placeholder") == -1) { | |
el.className += " bs-Stake_TextBox-placeholder"; | |
} | |
} | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.CastFlexiChangedHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.CastFlexiChangedHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @param {Object} node | |
* @return {undefined} | |
*/ | |
handle : function(recurring, opt_isDefault, node) { | |
var buffer; | |
var self; | |
var elements; | |
var depth; | |
var codeSegments; | |
var resolveValues; | |
var that; | |
var data; | |
if (this._isValid()) { | |
if (buffer = new b365.Ui.Formatter, self = this._bsInst.getBetItemById(opt_isDefault, recurring), node.value = $blib.isDecimal(node.value) ? buffer.roundValue(node.value) : "", elements = node.parentNode.parentNode.getElementsByClassName("bs-FlexiUnitStake_TextBox")[0], depth = parseInt(self.getStItem("bc"), 10), !isNaN(depth) && depth > 1) { | |
var response; | |
var res = node.parentNode.parentNode.getElementsByClassName("bs-FlexiUnitStake_TextBox")[0]; | |
var elem = node.parentNode.parentNode.getElementsByClassName("bs-FlexiPercentage_TextBox")[0]; | |
var obj = node.parentNode.parentNode.getElementsByClassName("bs-FlexiTotalStake_TextBox")[0]; | |
var ctx = node.parentNode.parentNode.parentNode.getElementsByClassName("bs-RepeatStakeContainer")[0]; | |
if (ctx) { | |
codeSegments = this._bsInst.getBetItems(this._bsInst.betTybetTypeNormal); | |
resolveValues = this._bsInst.getBetItems(this._bsInst.betTypeCast); | |
if (!isNaN(res.value) && (res.value > 0 && (resolveValues.length > 1 || codeSegments.length > 0))) { | |
$(ctx).removeClass("hidden"); | |
} else { | |
$(ctx).addClass("hidden"); | |
} | |
} | |
that = getBetslipWebModule(); | |
if (node.className.indexOf("UnitStake") > -1) { | |
data = that.getFlexiValuesFromUnitStake(res.value, depth); | |
obj.value = data.totalStake; | |
elem.value = data.flexiPercentage; | |
} else { | |
if (node.className.indexOf("Percentage") > -1) { | |
data = that.getFlexiValuesFromPercentage(elem.value, depth); | |
res.value = data.unitStake; | |
elem.value = data.flexiPercentage; | |
obj.value = data.totalStake; | |
} else { | |
data = that.getFlexiValuesFromTotalStake(obj.value, depth); | |
res.value = data.unitStake; | |
elem.value = data.flexiPercentage; | |
} | |
} | |
response = res; | |
self.setStItem("st", response.value); | |
self.setStItem("gst", response.value); | |
self.setStItem("gust", response.value); | |
} | |
this._bsInst.updateState(); | |
} | |
(new b365.Ui.Betslip.ToReturnCalculator(this._bsInst)).calculate(recurring, opt_isDefault, elements); | |
(new b365.Ui.Betslip.RepeatStakeVisibilitySetter(this._bsInst)).set(elements); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.IFBetStakeChangedHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @param {?} threshold | |
* @param {number} recurring | |
* @return {?} | |
*/ | |
this._setMaxStake = function(threshold, recurring) { | |
if (recurring > 0) { | |
var a = this._bsInst.getBetItemById(this._bsInst.itemTypeSingle, recurring - 1); | |
var average = a.getStItem("st") ? $blib.roundValue(a.getStItem("st")) : 0; | |
if (Number(average) < Number(threshold)) { | |
return average; | |
} | |
} | |
return threshold; | |
}; | |
}; | |
b365.Ui.Betslip.IFBetStakeChangedHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @return {undefined} | |
*/ | |
handle : function(recurring, opt_isDefault) { | |
if (this._isValid()) { | |
var a = this._bsInst.getBetItemById(this._bsInst.itemTypeSingle, recurring); | |
var arg = opt_isDefault.value; | |
var val; | |
var value; | |
if (this._bsController) { | |
if (this._bsController._currencyDisplayHelper) { | |
if (arg) { | |
if (arg != "") { | |
arg = this._bsController._currencyDisplayHelper.unformatCurrency(arg); | |
} | |
} | |
} | |
} | |
if ($blib.isDecimal(arg) == false) { | |
/** @type {string} */ | |
opt_isDefault.value = ""; | |
/** @type {string} */ | |
arg = ""; | |
} | |
val = $blib.roundValue(arg); | |
value = this._setMaxStake(val, recurring); | |
if (Number(value) < Number(val)) { | |
opt_isDefault.value = this._bsController._currencyDisplayHelper ? this._bsController._currencyDisplayHelper.formatCurrency(value) : value; | |
val = value; | |
} | |
(new b365.Ui.Betslip.ToReturnCalculator(this._bsInst)).calculate(recurring, this._bsInst.itemTypeSingle, opt_isDefault); | |
a.setStItem("st", val); | |
a.setStItem("ust", val); | |
(new b365.Ui.Betslip.SingleStakeChangedHandler(this._bsInst, this._bsController)).updateAllStakes("", Number(recurring) + 1); | |
this._bsInst.updateState(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ReverseIfBetStakeChangedHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @param {?} count | |
* @param {number} recurring | |
* @return {?} | |
*/ | |
this._setMaxStake = function(count, recurring) { | |
if (recurring > 0) { | |
var a = this._bsInst.getBetItemById(this._bsInst.itemTypeSingle, recurring - 1); | |
var left = a.getStItem("st") ? $blib.roundValue(a.getStItem("st")) : 0; | |
return left < count ? left : count; | |
} | |
}; | |
}; | |
b365.Ui.Betslip.ReverseIfBetStakeChangedHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @return {undefined} | |
*/ | |
handle : function(recurring, opt_isDefault) { | |
var val; | |
var codeSegments; | |
var i; | |
if (this._isValid()) { | |
val = opt_isDefault.value; | |
if (this._bsController._currencyDisplayHelper) { | |
if (val) { | |
if (val != "") { | |
val = this._bsController._currencyDisplayHelper.unformatCurrency(val); | |
} | |
} | |
} | |
if ($blib.isDecimal(val) == false) { | |
/** @type {string} */ | |
opt_isDefault.value = ""; | |
/** @type {string} */ | |
val = ""; | |
} | |
codeSegments = this._bsInst.getBetItems(this._bsInst.itemTypeSingle); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
codeSegments[i].setStItem("st", val); | |
codeSegments[i].setStItem("ust", val); | |
} | |
this._bsInst.updateState(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.StakeChangedHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.StakeChangedHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @return {undefined} | |
*/ | |
handle : function(recurring, opt_isDefault) { | |
var codeSegments; | |
var i; | |
var nodeList; | |
var masterMode; | |
var els; | |
var li; | |
if (this._isValid()) { | |
var itemIndexAndType = new b365.Ui.Betslip.ItemInformation(recurring); | |
var msg = itemIndexAndType.itemIndexAndType(); | |
var elem; | |
/** @type {RegExp} */ | |
var typePattern = /(\d{0,8})?([.|,]{1}(\d{0,2}))?/; | |
var value = this._bsController.getCurrencyObject().decimalSeparator; | |
/** @type {string} */ | |
var source = value == "." ? "," : "."; | |
if ((recurring.value != recurring.value.match(typePattern)[0] || recurring.value.indexOf(source) > -1) && (recurring.value = recurring.value.match(typePattern)[0].replace(source, value)), recurring.value.length > 0 && !opt_isDefault) { | |
/** @type {NodeList} */ | |
codeSegments = document.getElementsByClassName("errStk"); | |
if (codeSegments.length > 0) { | |
this._bsController.getMessageDisplayHandler().hideMsg(betSlipML.pleaseenterstake); | |
} | |
/** @type {number} */ | |
i = codeSegments.length - 1; | |
for (;i >= 0;i--) { | |
codeSegments[i].className = codeSegments[i].className.replace("errStk", ""); | |
} | |
} | |
switch(msg[1]) { | |
case "single": | |
(new b365.Ui.Betslip.SingleStakeChangedHandler(this._bsInst, this._bsController)).handle(msg[0], msg[1], recurring); | |
break; | |
case "tote-single": | |
; | |
case "tote-cast": | |
; | |
case "tote-pot": | |
(new b365.Ui.Betslip.ToteStakeChangedHandler(this._bsInst, this._bsController)).handle(recurring); | |
break; | |
case "cast": | |
if (recurring.className.indexOf("Flexi") > -1) { | |
(new b365.Ui.Betslip.CastFlexiChangedHandler(this._bsInst, this._bsController)).handle(msg[0], msg[1], recurring); | |
} else { | |
(new b365.Ui.Betslip.CastStakeChangedHandler(this._bsInst, this._bsController)).handle(msg[0], msg[1], recurring); | |
} | |
break; | |
case "multiple": | |
if (msg[0] != "-1") { | |
(new b365.Ui.Betslip.MultipleStakeChangedHandler(this._bsInst, this._bsController)).handle(msg[0], recurring); | |
} else { | |
(new b365.Ui.Betslip.SingleStakeChangedHandler(this._bsInst, this._bsController)).updateAllStakes(recurring.value, 0); | |
} | |
; | |
} | |
(new b365.Ui.Betslip.TotalsCalculator(this._bsInst, this._bsController)).calculate(); | |
if (this._bsInst.placebetBtnDisabledForSpanishStakeLimit) { | |
elem = $(".placeBet.bs-BtnWrapper", "#bsDiv"); | |
if (elem) { | |
elem.removeClass("disabled bs-BtnDisabled"); | |
} | |
/** @type {boolean} */ | |
this._bsInst.placebetBtnDisabledForSpanishStakeLimit = false; | |
} | |
/** @type {NodeList} */ | |
nodeList = document.getElementsByClassName("bs-Alert"); | |
if (nodeList.length > 0) { | |
/** @type {boolean} */ | |
masterMode = nodeList[0].getAttribute("data-closeOnStakeEdit") === "True"; | |
if (masterMode) { | |
nodeList[0].setAttribute("data-closeOnStakeEdit", "false"); | |
/** @type {NodeList} */ | |
els = document.getElementsByClassName("acceptChanges"); | |
if (els.length > 0) { | |
if (els[0].className.indexOf("hidden") == -1) { | |
els[0].className += " hidden"; | |
} | |
} | |
/** @type {NodeList} */ | |
li = document.getElementsByClassName("placeBet"); | |
if (li.length > 0) { | |
li[0].className = li[0].className.replace(" hidden", ""); | |
} | |
} | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.StakeFocusHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
}; | |
b365.Ui.Betslip.StakeFocusHandler.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
attachHandlers : function() { | |
var el = $(".ie-8 .stk, .ie-9 .stk, .ie-8 .totestkbc, .ie-9 .totestkbc"); | |
var input; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < el.length;i++) { | |
input = $(el[i]); | |
if (input.val().length == 0) { | |
input.val(input.attr("placeholder")); | |
input.addClass("bs-Stake_TextBox-placeholder"); | |
} | |
} | |
if (el.length > 0) { | |
el.off("focus").on("focus", function(e) { | |
var button = e.target; | |
if (button.value === $(button).attr("placeholder")) { | |
/** @type {string} */ | |
button.value = ""; | |
$(button).removeClass("bs-Stake_TextBox-placeholder"); | |
} | |
}); | |
el.off("focusout").on("focusout", function(e) { | |
var el = e.target; | |
if (el.value.length === 0) { | |
el.value = $(el).attr("placeholder"); | |
$(el).addClass("bs-Stake_TextBox-placeholder"); | |
} | |
}); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
removeHandlers : function() { | |
$(".ie-8 .stk, .ie-9 .stk").off("focusout").off("focus"); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ToReturnCalculator = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** @type {string} */ | |
this._eachWayCookieKey = "ew"; | |
this._taxRates = $("#bsDiv>ul").attr("data-txr"); | |
this._taxCalculationMethod = $("#bsDiv>ul").attr("data-tcm"); | |
/** @type {number} */ | |
this._WinRateIndex = 3; | |
/** @type {number} */ | |
this._ReturnRateIndex = 4; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.ToReturnCalculator.prototype = { | |
/** | |
* @param {Object} recurring | |
* @param {boolean} dataAndEvents | |
* @param {Object} obj | |
* @return {undefined} | |
*/ | |
calculate : function(recurring, dataAndEvents, obj) { | |
var p; | |
var code; | |
var result; | |
var results; | |
var fromIndex; | |
var str; | |
var b; | |
if (recurring >= 0) { | |
p = this._bsInst.getBetItems(dataAndEvents)[recurring]; | |
code = $blib.to2DP(obj.value); | |
if (Number(code) > $blib.getMaxStake()) { | |
/** @type {string} */ | |
code = String($blib.getMaxStake()); | |
} | |
result = new b365.Ui.Betslip.TaxCalculator(this._bsInst); | |
result._isFreeBet = p.getStItem("ft"); | |
var before = $blib.getItemOdds(dataAndEvents, p); | |
var a = result.calcReturnsByLine(Number(code), before); | |
var c; | |
var after = p.getCnItem("po"); | |
if (after && after.length > 0) { | |
/** @type {boolean} */ | |
c = true; | |
} else { | |
if (p.getStItem("ew") == "1") { | |
results = $('li[data-item-id="' + recurring + '"]').find(".placedivider"); | |
if (results) { | |
if (results.length > 0) { | |
/** @type {number} */ | |
fromIndex = Number(results[0].getAttribute("data-place-divider")); | |
if (fromIndex) { | |
if (fromIndex > 0) { | |
str = getBetslipWebModule(); | |
after = str.getFractionalPlaceOdds(before, fromIndex); | |
/** @type {boolean} */ | |
c = true; | |
} | |
} | |
} | |
} | |
} | |
} | |
if (c) { | |
b = result.calcReturnsByLine(Number(code), after); | |
/** @type {string} */ | |
a = (Number(a) + Number(b)).toString(); | |
} | |
p.setStItem("st", code); | |
p.setStItem("ust", code); | |
p.setStItem("tr", a); | |
this._bsInst.updateState(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ToolTipHtmlBuilder = function(dataAndEvents) { | |
this._ele = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._ele != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.ToolTipHtmlBuilder.prototype = { | |
/** | |
* @return {?} | |
*/ | |
getHtml : function() { | |
/** @type {string} */ | |
var result = ""; | |
var el = $(this._ele).parents("[data-tooltip]:first"); | |
var block; | |
var failuresLink; | |
var tote_pot; | |
if (el.length == 1) { | |
if (el = $(el[0]), block = el.attr("data-tooltip").split("|"), $(this._ele).hasClass("ausHelp")) { | |
result = (new b365.Ui.Betslip.AusToteToolTipHtmlBuilder).getHtml(block[0]); | |
} else { | |
failuresLink = el.parents("[data-item-id]:first"); | |
tote_pot = failuresLink.attr("data-item-type"); | |
switch(tote_pot) { | |
case "single": | |
result = (new b365.Ui.Betslip.SingleToolTipHtmlBuilder).getHtml(failuresLink, block); | |
break; | |
case "tote-single": | |
result = (new b365.Ui.Betslip.ToteSingleToolTipHtmlBuilder).getHtml(block); | |
break; | |
case "tote-cast": | |
result = (new b365.Ui.Betslip.ToteCastToolTipHtmlBuilder).getHtml(this._ele, block); | |
break; | |
case "tote-pot": | |
result = (new b365.Ui.Betslip.TotePotToolTipHtmlBuilder).getHtml(block); | |
break; | |
case "cast": | |
result = $(this._ele).parents().hasClass("toteLeg") ? (new b365.Ui.Betslip.TotePotToolTipHtmlBuilder).getHtml(block) : (new b365.Ui.Betslip.CastToolTipHtmlBuilder).getHtml(failuresLink, block); | |
} | |
} | |
} | |
return result; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.StakeToolTipHtmlBuilder = function(dataAndEvents) { | |
this._ele = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._ele != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.StakeToolTipHtmlBuilder.prototype = { | |
/** | |
* @param {?} deepDataAndEvents | |
* @param {(number|string)} dataAndEvents | |
* @return {?} | |
*/ | |
getStakeHtml : function(deepDataAndEvents, dataAndEvents) { | |
/** @type {string} */ | |
var optsData = ""; | |
var el = $(this._ele).parents("[data-tooltip]:first"); | |
return el.length == 1 && (el = $(el[0]), dataAndEvents = el.attr("data-tooltip"), optsData = "<label class='ttHead'>" + dataAndEvents + "</label><br />"), optsData; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.PlaceBetClickHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.PlaceBetClickHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var doc; | |
var value; | |
var elem; | |
var r; | |
var s; | |
var targetEl; | |
var $option; | |
var placeCTCBet; | |
if (this._isValid()) { | |
doc = new b365.Ui.Betslip.Validation.PlaceBetValidator(this._bsInst, this._bsController); | |
$option = $(recurring); | |
if (!$option.hasClass("disabled")) { | |
if (!$option.hasClass("failed-min-odds")) { | |
placeCTCBet = $option.attr("data-atype"); | |
if (placeCTCBet == "cnf") { | |
if (typeof window.MyBetsController != "undefined") { | |
if (window.MyBetsController.isInitialised()) { | |
window.MyBetsController.disableButtonEvents(); | |
} | |
} | |
this.updateStakes(); | |
this._bsInst.confirmBets(); | |
} else { | |
if (placeCTCBet == "cnf-ref") { | |
if (typeof window.MyBetsController != "undefined") { | |
if (window.MyBetsController.isInitialised()) { | |
window.MyBetsController.disableButtonEvents(); | |
} | |
} | |
this.updateStakes(); | |
this._bsInst.referBets(); | |
} else { | |
if (placeCTCBet == "clr") { | |
this._bsInst.refresh(); | |
} else { | |
if (placeCTCBet === "bc-startcall") { | |
r = doc.validate(true); | |
if (r) { | |
if (this._bsController.getPushMarketsEnabled()) { | |
this._bsInst.backupPushBetPreSplitBSCookieValue(this._bsInst._betSlipCookieKey); | |
} | |
this._bsInst.placeBets(); | |
} | |
} else { | |
if (typeof window.MyBetsController != "undefined") { | |
if (window.MyBetsController.isInitialised()) { | |
window.MyBetsController.disableButtonEvents(); | |
} | |
} | |
/** @type {(HTMLElement|null)} */ | |
targetEl = document.getElementById("totalStake"); | |
/** @type {boolean} */ | |
s = Number(targetEl.textContent || targetEl.innerText) == 0; | |
if (!s) { | |
this.updateStakes(); | |
} | |
r = doc.validate(placeCTCBet === "bc-startcall" || $option.hasClass("placeCTCBet")); | |
if (recurring.length > 0) { | |
elem = $(recurring[0].parentNode).find("#buttonContent"); | |
if (elem.length == 0) { | |
elem = recurring.find("button"); | |
if (elem.length > 0) { | |
value = elem[0].innerHTML; | |
/** @type {Element} */ | |
elem = document.createElement("div"); | |
elem.setAttribute("id", "buttonContent"); | |
elem.setAttribute("style", "display:none;"); | |
elem.innerHTML = value; | |
recurring[0].parentNode.appendChild(elem); | |
/** @type {null} */ | |
elem = null; | |
} | |
} | |
if (r) { | |
/** @type {string} */ | |
recurring[0].innerHTML = '<button><span class="buttonSpinner"></span></button>'; | |
} | |
} | |
if (r) { | |
if (this._bsController.getPushMarketsEnabled()) { | |
this._bsInst.backupPushBetPreSplitBSCookieValue(this._bsInst._betSlipCookieKey); | |
} | |
this._bsInst.placeBets(); | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
updateStakes : function() { | |
var elements = $(".betslipWrapper input.stk"); | |
var i; | |
var ln; | |
var name; | |
var rparentsprev; | |
if (this._bsInst.getSlipType() != this._bsInst.slipIF && elements.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
ln = elements.length; | |
for (;i < ln;i++) { | |
if (elements[i].id != "mltsngstk") { | |
if (elements[i].tagName == "INPUT") { | |
if (elements[i].type == "text" || (elements[i].type == "number" || elements[i].type == "tel")) { | |
name = elements[i].value; | |
name = name.replace(",", "."); | |
name = name.replace("..", "."); | |
if (name) { | |
rparentsprev = new b365.Ui.Formatter; | |
if ($blib.isDecimal(name)) { | |
elements[i].value = rparentsprev.roundValue(name); | |
} | |
} | |
(new b365.Ui.Betslip.StakeChangedHandler(this._bsInst, this._bsController)).handle(elements[i]); | |
} | |
} | |
} | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip.Validation"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.Validation.PlaceBetValidator = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {string} */ | |
this._noStakeCssClass = "errStk"; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @param {boolean} dataAndEvents | |
* @return {?} | |
*/ | |
this._defaultValidator = function(dataAndEvents) { | |
/** @type {string} */ | |
var optsData = ""; | |
var node = this; | |
var item = $("#bsDiv"); | |
var details; | |
var container; | |
var cur; | |
/** @type {number} */ | |
var number = 0; | |
var children; | |
dataAndEvents = dataAndEvents ? dataAndEvents : $(".bs-BetCall_CallBtn", item).length > 0; | |
var codeSegments; | |
var tmp; | |
return this._bsController._delegates.isAuthenticated() ? dataAndEvents ? this._bsController.betCallEnabled() || (optsData = "INTERNAL MESSAGE: CTC DISABLED") : (children = $(".bs-Footer .totalStake, .bs-ConfirmationFooter .totalStake", item), children.length > 0 && (number = $(children[0]).text()), this._bsController && (this._bsController._currencyDisplayHelper && (number = this._bsController._currencyDisplayHelper.unformatCurrency(number))), number = Number(number), codeSegments = document.getElementsByClassName("bs-FreeBet-selected"), | |
(isNaN(number) || number == 0) && codeSegments.length == 0 ? (this._bsController._noStakeCount = this._bsController._noStakeCount + 1, cur = $(".stk", item), tmp = cur, details = $(".bs-MultipleBets"), details.length > 0 && (container = $("ul:first-child", details), container.hasClass("closed") && (tmp = cur.filter(':not(".bs-MultipleBets_Stake")'))), this._bsController._enhancedBetSlipAnimations.shakeStakeFields(tmp, item, null, [], null), cur.each(function() { | |
var buffer = (new b365.Ui.Betslip.ItemInformation($(this))).itemElement(); | |
buffer.addClass(node._noStakeCssClass); | |
}), optsData = this._bsController._noStakeCount > 2 ? betSlipML.pleaseenterstake : "INTERNAL MESSAGE: NOT VALIDATED") : this._bsController._noStakeCount = 0) : (optsData = "INTERNAL MESSAGE: NOT LOGGED IN", this._bsController._noStakeCount = 0), optsData; | |
}; | |
}; | |
b365.Ui.Betslip.Validation.PlaceBetValidator.prototype = { | |
/** | |
* @param {Object} dataAndEvents | |
* @return {?} | |
*/ | |
validate : function(dataAndEvents) { | |
var username = this._defaultValidator(dataAndEvents); | |
var w; | |
if (username == "") { | |
switch(this._bsInst.getSlipType()) { | |
case this._bsInst.slipIF: | |
username = (new b365.Ui.Betslip.Validation.IfPlaceBetValidator(this._bsInst)).validate(); | |
break; | |
case this._bsInst.slipUSTote: | |
username = (new b365.Ui.Betslip.Validation.UsTotePlaceBetValidator(this._bsInst)).validate(); | |
break; | |
case this._bsInst.slipUKTote: | |
username = (new b365.Ui.Betslip.Validation.UkTotePlaceBetValidator(this._bsInst)).validate(); | |
break; | |
case this._bsInst.slipETote: | |
username = (new b365.Ui.Betslip.Validation.ETotePlaceBetValidator(this._bsInst)).validate(); | |
} | |
} | |
if (username == "" && (window.location.host.split(".").pop() == "it" && (username = (new b365.Ui.Betslip.Validation.ItalyBetValidator(this._bsInst)).validate())), username != "") { | |
switch(username) { | |
case "INTERNAL MESSAGE: NOT VALIDATED": | |
break; | |
case "INTERNAL MESSAGE: CTC DISABLED": | |
this._bsController.getMessageDisplayHandler().showMsg({ | |
message : betSlipML.callUnsuccessful, | |
message2 : betSlipML.pleaseCall | |
}); | |
break; | |
case "INTERNAL MESSAGE: NOT LOGGED IN": | |
if (this._bsController.clientEnhancedMode()) { | |
if (this._bsController._stakeEntryType == this._bsController._stakeEntryTypes.stakePad && (this._bsController._stakeEntryHander && this._bsController._stakeEntryHander._isShowing)) { | |
w = $("#stakePad"); | |
if (w.length > 0) { | |
this._bsController._enhancedBetSlipAnimations.hideStakePad(w, true, this._bsController.clientLoginDelegate, [], this._bsController); | |
} else { | |
this._bsController.clientLoginDelegate(); | |
} | |
} else { | |
this._bsController.clientLoginDelegate(); | |
} | |
} else { | |
this._bsController.clientLoginDelegate(); | |
} | |
break; | |
default: | |
this._bsController.getMessageDisplayHandler().showMsg(username); | |
this._bsInst.changeBetslipHeight(); | |
} | |
} | |
return username == ""; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip.Validation"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.Validation.ETotePlaceBetValidator = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.Validation.ETotePlaceBetValidator.prototype = { | |
/** | |
* @return {?} | |
*/ | |
validate : function() { | |
/** @type {string} */ | |
var text = ""; | |
var i; | |
var type; | |
var prevSources; | |
var number; | |
if (this._isValid()) { | |
/** @type {boolean} */ | |
var octalLiteral = true; | |
var codeSegments = this._bsInst._betItems; | |
/** @type {number} */ | |
var mediaBlockCount = codeSegments.length - 1; | |
var textAlt = betSlipML.etoteinvalidstake; | |
/** @type {number} */ | |
i = mediaBlockCount; | |
for (;i > -1 && octalLiteral;i--) { | |
type = codeSegments[i].getStItem("gst"); | |
if (!isNaN(type)) { | |
if (!(type == "")) { | |
/** @type {boolean} */ | |
octalLiteral = Number(type) > 0 ? /^([1]\d+|[1-9]\d*)(\.[0-9]{2}?)?$/.test(type) : false; | |
} | |
} | |
} | |
if (octalLiteral) { | |
/** @type {number} */ | |
mediaBlockCount = this._bsInst._betCastItems.length - 1; | |
prevSources = this._bsInst._betCastItems; | |
/** @type {number} */ | |
i = mediaBlockCount; | |
for (;i > -1 && octalLiteral;i--) { | |
/** @type {number} */ | |
number = Number(prevSources[i].getStItem("gst")); | |
if (!isNaN(number)) { | |
if (Number(number) > 0) { | |
/** @type {boolean} */ | |
octalLiteral = /^([1]\d+|[1-9]\d*)(\.[0-9]{2}?)?$/.test(number); | |
} | |
} | |
} | |
if (!octalLiteral) { | |
textAlt = betSlipML.exactainvalidstake; | |
} | |
} | |
if (!octalLiteral) { | |
text = textAlt; | |
} | |
} | |
return text; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip.Validation"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.Validation.IfPlaceBetValidator = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.Validation.IfPlaceBetValidator.prototype = { | |
/** | |
* @return {?} | |
*/ | |
validate : function() { | |
/** @type {string} */ | |
var pass = ""; | |
var codeSegments; | |
var i; | |
var val2; | |
if (this._isValid()) { | |
if (codeSegments = this._bsInst.getBetItems(this._bsInst.itemTypeSingle), codeSegments.length < 2) { | |
pass = betSlipML.ifbetminselections; | |
} else { | |
/** @type {number} */ | |
i = 1; | |
for (;i < codeSegments.length;i++) { | |
val2 = codeSegments[i].getStItem("st"); | |
if (isNaN(val2) || Number(val2) == 0) { | |
pass = betSlipML.pleaseenterstakeorrisk; | |
$('#bsDiv li[data-item-id="' + i + '"] input:text[data-inp-type]').addClass(this._noStakeCssClass); | |
} | |
} | |
} | |
} | |
return pass; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip.Validation"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.Validation.UkTotePlaceBetValidator = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.Validation.UkTotePlaceBetValidator.prototype = { | |
/** | |
* @return {?} | |
*/ | |
validate : function() { | |
/** @type {string} */ | |
var part = ""; | |
var i; | |
var arg; | |
var prevSources; | |
var w; | |
var r; | |
var nType; | |
if (this._isValid()) { | |
/** @type {boolean} */ | |
var isXML = true; | |
var codeSegments = this._bsInst._betItems; | |
/** @type {number} */ | |
var mediaBlockCount = codeSegments.length - 1; | |
/** @type {number} */ | |
i = mediaBlockCount; | |
for (;i > -1 && isXML;i--) { | |
arg = codeSegments[i].getStItem("gst"); | |
if (!isNaN(arg)) { | |
if (!(arg == "")) { | |
if (Number(arg) > 0) { | |
arg = arg.replace(/^0+/, ""); | |
/** @type {boolean} */ | |
isXML = /^([1]\d+|[2-9]\d*)(\.[0-9]{1}0?)?$/.test(arg); | |
} else { | |
/** @type {boolean} */ | |
isXML = false; | |
} | |
} | |
} | |
} | |
if (isXML) { | |
/** @type {number} */ | |
mediaBlockCount = this._bsInst._betCastItems.length - 1; | |
prevSources = this._bsInst._betCastItems; | |
/** @type {number} */ | |
i = mediaBlockCount; | |
for (;i > -1 && isXML;i--) { | |
if (w = Number(prevSources[i].getStItem("gst")), !isNaN(w) && Number(w) > 0) { | |
/** @type {number} */ | |
r = Number(prevSources[i].getStItem("bc")); | |
/** @type {number} */ | |
r = isNaN(r) ? 1 : r; | |
nType = $blib.roundDecimal(String(w * r)); | |
switch(prevSources[i].getCnItem("cm")) { | |
case "6": | |
/** @type {boolean} */ | |
isXML = /^2(\.00?)?$/.test(w); | |
part = isXML ? part : betSlipML.toteperunitstake; | |
break; | |
case "7": | |
/** @type {boolean} */ | |
isXML = /^[0-9]\d*(\.(([1-9]{1}0?)|00))?$/.test(w); | |
if (isXML) { | |
/** @type {boolean} */ | |
isXML = /^([1]\d+|[2-9])\d*(\.[0-9]{1}0?)?$/.test(nType); | |
} | |
part = isXML ? part : betSlipML.totesuper7perunitstake; | |
break; | |
case "U": | |
; | |
case "P": | |
/** @type {boolean} */ | |
isXML = /^[0-9]\d*(\.[0-9]{1}0?)?$/.test($blib.roundDecimal(String(w))) && /^[1-9]\d*(\.[0-9]{1}0?)?$/.test(nType); | |
part = isXML ? part : betSlipML.toteinvalidstake; | |
break; | |
case "J": | |
/** @type {boolean} */ | |
isXML = /^[1-9]\d*(\.[05]{1}0?)?$/.test(nType); | |
part = isXML ? part : betSlipML.totejackpotinvalidstake; | |
break; | |
default: | |
/** @type {boolean} */ | |
isXML = /^[0-9]\d*(\.(([1-9]{1}0?)|00))?$/.test(w); | |
if (isXML) { | |
/** @type {boolean} */ | |
isXML = /^([1]\d+|[2-9])\d*(\.[0-9]{1}0?)?$/.test(nType); | |
} | |
part = isXML ? part : betSlipML.minstaketote; | |
} | |
} | |
} | |
} else { | |
part = betSlipML.minstaketote; | |
} | |
} | |
return part; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip.Validation"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.Validation.UsTotePlaceBetValidator = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.Validation.UsTotePlaceBetValidator.prototype = { | |
/** | |
* @return {?} | |
*/ | |
validate : function() { | |
/** @type {string} */ | |
var data = ""; | |
var i; | |
var o; | |
var world; | |
var length; | |
if (this._isValid()) { | |
/** @type {boolean} */ | |
var key = true; | |
var worlds = this._bsInst._betItems; | |
/** @type {number} */ | |
var mediaBlockCount = worlds.length - 1; | |
/** @type {number} */ | |
i = mediaBlockCount; | |
for (;i > -1 && key;i--) { | |
o = worlds[i].getStItem("gst"); | |
if (!isNaN(o)) { | |
if (!(o == "")) { | |
key = this.checkstake(o); | |
} | |
} | |
} | |
if (key) { | |
worlds = this._bsInst._betCastItems; | |
/** @type {number} */ | |
mediaBlockCount = worlds.length - 1; | |
/** @type {number} */ | |
i = mediaBlockCount; | |
for (;i > -1 && key;i--) { | |
world = worlds[i]; | |
length = worlds[i].getStItem("gust"); | |
if (!isNaN(length)) { | |
key = this.checkstake(length); | |
data = key ? "" : data = betSlipML.ustotecastsinvalid; | |
} | |
} | |
} else { | |
data = betSlipML.ustotesinglesinvalid; | |
} | |
} | |
return data; | |
}, | |
/** | |
* @param {?} key | |
* @return {?} | |
*/ | |
checkstake : function(key) { | |
/** @type {number} */ | |
var value = parseFloat(key); | |
return value < 2 ? false : value % parseInt(key) == 0; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip.Validation"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.Validation.ItalyBetValidator = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.Validation.ItalyBetValidator.prototype = { | |
/** | |
* @return {?} | |
*/ | |
validate : function() { | |
/** @type {string} */ | |
var msg = ""; | |
var fs; | |
var val; | |
var resultItems; | |
var mediaBlockCount; | |
var result; | |
var codeSegments; | |
var samePartsLength; | |
var i; | |
var len; | |
var year; | |
var text; | |
var subKey; | |
var until; | |
var localize; | |
var t; | |
var u; | |
var configList; | |
var length1; | |
var r; | |
var selector; | |
/** @type {boolean} */ | |
var a = false; | |
/** @type {boolean} */ | |
var minstakeitalyracing = false; | |
var min; | |
/** @type {boolean} */ | |
var colors = false; | |
if (this._isValid()) { | |
/** @type {RegExp} */ | |
text = /^([1]\d+|[2-9]\d*)(\.00?)?$/; | |
/** @type {RegExp} */ | |
until = /^(\d+?)(\.(25|50?|75|00?))?$/; | |
/** @type {RegExp} */ | |
subKey = /^(\d+?)(\.(50?|00?))?$/; | |
/** @type {RegExp} */ | |
localize = /^(\d+?)(\.(05?|10?|15|20?|25|30?|35|40?|45|50?|55|60?|65|70?|75|80?|85|90?|95|00?))?$/; | |
/** @type {boolean} */ | |
fs = true; | |
resultItems = this._bsInst._betItems; | |
/** @type {number} */ | |
mediaBlockCount = resultItems.length - 1; | |
/** @type {boolean} */ | |
u = this._bsInst.getSlipType() == this._bsInst.slipBanker; | |
/** @type {number} */ | |
i = mediaBlockCount; | |
for (;i > -1 && fs;i--) { | |
val = resultItems[i].getStItem("st"); | |
/** @type {boolean} */ | |
a = false; | |
/** @type {boolean} */ | |
minstakeitalyracing = false; | |
/** @type {boolean} */ | |
colors = false; | |
type = resultItems[i].getStItem("_tp"); | |
switch(type) { | |
case "v": | |
/** @type {boolean} */ | |
a = true; | |
break; | |
case "f": | |
/** @type {boolean} */ | |
minstakeitalyracing = true; | |
break; | |
case "t": | |
/** @type {boolean} */ | |
colors = true; | |
} | |
if (typeof val != "undefined" && (val != "" && (val = val.replace(",", "."), val = val.replace("..", "."), a ? (min = 1, result = subKey) : minstakeitalyracing ? (min = 3, result = text) : colors ? (min = 2, result = text) : (min = 2, result = text), !isNaN(val) && (val != "" && val != "0")))) { | |
if (Number(val) >= min) { | |
fs = result.test(Number(val)); | |
} else { | |
/** @type {boolean} */ | |
fs = false; | |
break; | |
} | |
} | |
} | |
configList = this._bsInst._betCastItems; | |
/** @type {number} */ | |
length1 = configList.length - 1; | |
/** @type {number} */ | |
i = length1; | |
for (;i > -1 && fs;i--) { | |
if ((val = configList[i].getStItem("st"), a = configList[i].getStItem("_tp") === "v", typeof val != "undefined" && val != "") && (val = val.replace(",", "."), val = val.replace("..", "."), len = Number(configList[i].getCnItem("bc") ? configList[i].getCnItem("bc") : configList[i].getStItem("bc") ? configList[i].getStItem("bc") : "1"), len > 0 && (!u && a) ? (r = Number(String(val * len)), selector = until) : (r = Number(val), selector = text), !isNaN(val) && (val !== "" && val !== "0"))) { | |
if (Number(val) >= 0.25 && Number(r) >= 1) { | |
fs = selector.test(Number(val)); | |
} else { | |
/** @type {boolean} */ | |
fs = false; | |
break; | |
} | |
} | |
} | |
codeSegments = this._bsInst._betMltItems; | |
/** @type {number} */ | |
samePartsLength = codeSegments.length - 1; | |
/** @type {number} */ | |
i = samePartsLength; | |
for (;i > -1 && fs;i--) { | |
if ((val = codeSegments[i].getStItem("st"), typeof val != "undefined" && val != "") && (val = val.replace(",", "."), val = val.replace("..", "."), len = Number(codeSegments[i].getCnItem("bc") ? codeSegments[i].getCnItem("bc") : codeSegments[i].getStItem("bc") ? codeSegments[i].getStItem("bc") : "1"), len > 1 || len > 0 && (!u && a) ? (year = Number(String(val * len)), t = localize) : (year = Number(val), t = text), !isNaN(val) && (val != "" && val != "0"))) { | |
if (Number(val) >= 0.05 && (Number(year) >= 2 || a && Number(year) >= 1)) { | |
fs = t.test(Number(val)); | |
} else { | |
/** @type {boolean} */ | |
fs = false; | |
break; | |
} | |
} | |
} | |
if (!fs) { | |
msg = colors ? betSlipML.minstakeitalyracingpools : minstakeitalyracing ? betSlipML.minstakeitalyracing : a ? betSlipML.minstakeitalyvirtuals : betSlipML.minstakeitaly; | |
} | |
} | |
return msg === "" ? "" : { | |
message : msg, | |
force : true | |
}; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.MessageDisplayHandler = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** @type {null} */ | |
this._cachedOptions = null; | |
/** @type {null} */ | |
this._currentMessage = null; | |
/** @type {Array} */ | |
this._messageStack = []; | |
/** @type {boolean} */ | |
this._transitioning = false; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.MessageDisplayHandler.prototype = { | |
/** | |
* @param {Object} data | |
* @param {string} callback | |
* @return {undefined} | |
*/ | |
showMsg : function(data, callback) { | |
var $this; | |
var answer; | |
var tcb; | |
if (this._isValid()) { | |
if (typeof data == "string" && (data = { | |
message : data, | |
className : callback, | |
priority : 1, | |
force : false | |
}), typeof data.priority == "undefined" && (data.priority = 1), !data.force && !this._transitioning) { | |
if (tcb = this.findCurrentMessage(), this._currentMessage || (this._currentMessage = this.findCurrentMessage()), this._currentMessage && this._currentMessage.priority > data.priority || tcb && tcb.priority > data.priority) { | |
this._messageStack.push(data); | |
return; | |
} | |
if (this._currentMessage) { | |
if (this.areSame(data, this._currentMessage) && tcb != null) { | |
return; | |
} | |
this._messageStack.push(this._currentMessage); | |
} | |
} | |
/** @type {Object} */ | |
this._currentMessage = data; | |
if (typeof data.className == "undefined") { | |
/** @type {string} */ | |
data.className = "bs-Alert"; | |
} | |
$this = $(".bs-Alert"); | |
$this.addClass(data.className); | |
if (typeof data.messageClass == "undefined") { | |
/** @type {string} */ | |
data.messageClass = "bs-Alert_Msg"; | |
} | |
/** @type {string} */ | |
answer = '<div class="' + data.messageClass + '">' + data.message + "</div>"; | |
if (typeof data.message2 != "undefined") { | |
if (data.message2 !== "") { | |
if (typeof data.message2Class == "undefined") { | |
if (data.message2Class === "") { | |
/** @type {string} */ | |
data.message2Class = "bs-Alert_Msg"; | |
} | |
} | |
answer += '<div class="' + data.message2Class + '">' + data.message2 + "</div>"; | |
} | |
} | |
$this.html(answer); | |
$this.removeClass("hidden"); | |
$(".bs-MultipleBets_Error").addClass("hidden"); | |
this._bsInst.contentChangedOnClient(); | |
} | |
}, | |
/** | |
* @param {string} msg | |
* @return {undefined} | |
*/ | |
hideMsg : function(msg) { | |
var er; | |
var otherwiseLineIndex; | |
var pdataCur; | |
if (this._isValid()) { | |
if (msg) { | |
if (typeof msg == "string") { | |
msg = { | |
message : msg | |
}; | |
} | |
er = this.findCurrentMessage(); | |
/** @type {number} */ | |
otherwiseLineIndex = this._messageStack.length - 1; | |
for (;otherwiseLineIndex >= 0;otherwiseLineIndex--) { | |
if (this.areSame(msg, this._messageStack[otherwiseLineIndex])) { | |
this._messageStack.splice(otherwiseLineIndex, 1); | |
} | |
} | |
if (er && !this.areSame(msg, er)) { | |
return; | |
} | |
} | |
/** @type {null} */ | |
this._currentMessage = null; | |
/** @type {boolean} */ | |
this._transitioning = true; | |
pdataCur = this._messageStack.pop(); | |
if (pdataCur) { | |
this.showMsg(pdataCur); | |
} else { | |
$(".bs-MultipleBets_Error").removeClass("hidden"); | |
$(".bs-Alert").removeClass().addClass("bs-Alert hidden"); | |
} | |
/** @type {boolean} */ | |
this._transitioning = false; | |
this._bsInst.contentChangedOnClient(); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
clear : function() { | |
/** @type {null} */ | |
this._cachedOptions = null; | |
/** @type {Array} */ | |
this._messageStack = []; | |
this.hideMsg(); | |
}, | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
cacheMessage : function(dataAndEvents) { | |
this._cachedOptions = dataAndEvents; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
showCachedMessage : function() { | |
if (this._cachedOptions) { | |
this.showMsg(this._cachedOptions); | |
} | |
/** @type {null} */ | |
this._cachedOptions = null; | |
}, | |
/** | |
* @return {?} | |
*/ | |
findCurrentMessage : function() { | |
var section = $(".bs-Alert"); | |
if (this._transitioning || (section.length == 0 || section.hasClass("hidden"))) { | |
return null; | |
} | |
var set = section.children(); | |
var ch = set.eq(0).html(); | |
var lastCh = set.eq(1).html(); | |
return ch == "" && lastCh == "" ? null : { | |
className : section.attr("class"), | |
message : ch, | |
messageClass : set.eq(0).attr("class"), | |
message2 : lastCh, | |
message2Class : set.eq(1).attr("class"), | |
priority : 1 | |
}; | |
}, | |
/** | |
* @param {?} def | |
* @param {Error} er | |
* @return {?} | |
*/ | |
areSame : function(def, er) { | |
var a; | |
var b; | |
return a = !def.message || !er.message ? def.message === er.message : def.message.replace(/<(?:.|\n)*?>/gm, "") === er.message.replace(/<(?:.|\n)*?>/gm, ""), b = !def.message2 || !er.message2 ? def.message2 === er.message2 : def.message.replace(/<(?:.|\n)*?>/gm, "") === er.message.replace(/<(?:.|\n)*?>/gm, ""), a && b; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {number} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.PlaceBetRequestDespatcher = function(dataAndEvents, deepDataAndEvents) { | |
/** @type {number} */ | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.PlaceBetRequestDespatcher.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
despatch : function() { | |
if (this._isValid()) { | |
if ((new b365.Ui.Betslip.Validation.PlaceBetValidator(this._bsInst, this._bsController)).validate()) { | |
this._bsInst.req(this._bsInst.reqTypePlaceBet, "", "", this._bsController); | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ReferBetRequestDespatcher = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.ReferBetRequestDespatcher.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
despatch : function() { | |
if (this._isValid() && (new b365.Ui.Betslip.Validation.PlaceBetValidator(this._bsInst, this._bsController)).validate()) { | |
/** @type {string} */ | |
var optsData = ""; | |
/** @type {(HTMLElement|null)} */ | |
var elem = document.getElementById("refCode"); | |
if (elem) { | |
/** @type {string} */ | |
optsData = "refCode=" + elem.getAttribute("data-refCode") + "&reftime=" + elem.getAttribute("data-refTime"); | |
} | |
/** @type {string} */ | |
this._bsInst.postPayload = optsData; | |
this._bsInst.req(this._bsInst.reqTypeReferBet, "", "", this._bsController); | |
/** @type {string} */ | |
this._bsInst.postPayload = ""; | |
(new b365.Ui.Betslip.ItemSubscriptionManager(this._bsInst, this._bsController)).unsubscribe(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.MaxBetReqCompleteHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {number} */ | |
this._serverErrorReqType = 99; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.MaxBetReqCompleteHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var opt_isDefault; | |
if (this._isValid()) { | |
var uHostName = recurring[0]; | |
var types = recurring[1][7][1].split("=")[1].split("-"); | |
var value = uHostName.split("|"); | |
if (value[1] != "" && (value[0] != "E" && this._bsController.getMessageDisplayHandler().showMsg(value[1])), value[0] != "E" && value[0] != "L") { | |
opt_isDefault = $blib.pad2DP(value[0]); | |
switch(types[0]) { | |
case "M": | |
(new b365.Ui.Betslip.MultiplesMaxBetReqCompleteHandler(this._bsInst)).handle(types[1], opt_isDefault); | |
break; | |
case "N": | |
$("#mltsngstk").val(""); | |
(new b365.Ui.Betslip.SinglesMaxBetReqCompleteHandler(this._bsInst, this._bsController)).handle(types[1], opt_isDefault); | |
break; | |
case "C": | |
(new b365.Ui.Betslip.CastMaxBetReqCompleteHandler(this._bsInst, this._bsController)).handle(types[1], opt_isDefault); | |
} | |
} else { | |
if (value[0] == "E") { | |
this._bsController.getMessageDisplayHandler().showMsg(betSlipML.pleaselogin); | |
} | |
} | |
(new b365.Ui.Betslip.TotalsCalculator(this._bsInst, this._bsController)).calculate(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.MultiplesMaxBetReqCompleteHandler = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** @type {number} */ | |
this._serverErrorReqType = 99; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.MultiplesMaxBetReqCompleteHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @return {undefined} | |
*/ | |
handle : function(recurring, opt_isDefault) { | |
if (this._isValid()) { | |
var radio = $("li[data-item-type='multiple'][data-item-id='" + recurring + "'] input[data-inp-type='mltstk']"); | |
if (radio.length > 0) { | |
/** @type {boolean} */ | |
radio[0].value = opt_isDefault; | |
this._bsInst.getBetItemById(this._bsInst.itemTypeMultiple, recurring).setStItem("st", opt_isDefault); | |
this._bsInst.updateState(); | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.SinglesMaxBetReqCompleteHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.SinglesMaxBetReqCompleteHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @return {undefined} | |
*/ | |
handle : function(recurring, opt_isDefault) { | |
if (this._isValid()) { | |
var radio = $("li[data-item-type='single'][data-item-id='" + recurring + "'] input[data-inp-type='sngstk']"); | |
if (radio.length > 0) { | |
/** @type {boolean} */ | |
radio[0].value = opt_isDefault; | |
this._bsInst.getBetItemById(this._bsInst.itemTypeSingle, recurring).setStItem("st", opt_isDefault); | |
(new b365.Ui.Betslip.StakeChangedHandler(this._bsInst, this._bsController)).handle(radio[0]); | |
this._bsInst.updateState(); | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.CastMaxBetReqCompleteHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {number} */ | |
this._serverErrorReqType = 99; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.CastMaxBetReqCompleteHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @return {undefined} | |
*/ | |
handle : function(recurring, opt_isDefault) { | |
if (this._isValid()) { | |
var els = $("li[data-item-type='cast'][data-item-id='" + recurring + "'] input[data-inp-type='cststk']"); | |
if (els.length > 0) { | |
/** @type {boolean} */ | |
els[0].value = opt_isDefault; | |
this._bsInst.getBetItemById(this._bsInst.itemTypeCast, recurring).setStItem("st", opt_isDefault); | |
this._bsInst.updateState(); | |
} | |
if (els[0].className.indexOf("Flexi") > -1) { | |
(new b365.Ui.Betslip.CastFlexiChangedHandler(this._bsInst, this._bsController)).handle(recurring, "cast", els[0]); | |
} else { | |
(new b365.Ui.Betslip.CastStakeChangedHandler(this._bsInst, this._bsController)).handle(recurring, "cast", els[0]); | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} webglController | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.InstanceEventAttacher = function(dataAndEvents, webglController) { | |
this._bsInst = dataAndEvents; | |
this._controller = webglController; | |
/** @type {null} */ | |
this._betSlipResponsiveClickHandler = null; | |
this._betSlipClickHandler = new b365.Ui.Betslip.BetslipClickHandler(this._bsInst, this._controller); | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && typeof this._controller != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.InstanceEventAttacher.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
attach : function() { | |
if (this._isValid()) { | |
var self = this; | |
var inputElement = $("#bsDiv"); | |
inputElement.change(function(recurring) { | |
(new b365.Ui.Betslip.BetslipChangeHandler(self._bsInst, self._controller)).handle(recurring); | |
}); | |
if (self._betSlipResponsiveClickHandler === null) { | |
self._betSlipResponsiveClickHandler = new b365.Ui.Betslip.ResponsiveClickHandler(inputElement[0], $.proxy(self._betSlipClickHandler.handle, self._betSlipClickHandler), false); | |
} | |
this._bsInst.addOnHandleInProg(function(dataAndEvents, recurring) { | |
(new b365.Ui.Betslip.InProgressDisplayHandler(dataAndEvents, self._controller)).handle(recurring); | |
}); | |
this._bsInst.addOnPBetError(function(dataAndEvents) { | |
(new b365.Ui.Betslip.PlaceBetErrorHandler(dataAndEvents, self._controller)).handle(); | |
}); | |
this._bsInst.addOnAddBet(function(dataAndEvents, recurring) { | |
(new b365.Ui.Betslip.AddBetHandler(dataAndEvents, self._controller)).handle(recurring); | |
}); | |
this._bsInst.addOnPlaceBet(function(dataAndEvents, recurring) { | |
(new b365.Ui.Betslip.PlaceBetRequestDespatcher(dataAndEvents, self._controller)).despatch(recurring); | |
}); | |
this._bsInst.addOnLock(function(dataAndEvents, recurring) { | |
(new b365.Ui.Betslip.LockUnlockHandler(dataAndEvents, self._controller)).handle(recurring); | |
}); | |
this._bsInst.addOnReqComplete(function(dataAndEvents, recurring) { | |
(new b365.Ui.Betslip.ReqCompleteHandler(dataAndEvents, self._controller)).handle(recurring, self._controller); | |
}); | |
this._bsInst.addOnConfirmBet(function(dataAndEvents) { | |
(new b365.Ui.Betslip.ConfirmBetRequestDespatcher(dataAndEvents, self._controller)).despatch(); | |
}); | |
this._bsInst.addOnContentLoaded(function(dataAndEvents, deepDataAndEvents) { | |
self._controller.OnBetslipContentLoaded(deepDataAndEvents); | |
}); | |
this._bsInst.addOnUpdateState(function(dataAndEvents, recurring) { | |
(new b365.Ui.Betslip.UpdateStateHandler(dataAndEvents)).handle(recurring); | |
}); | |
this._bsInst.addOnRestoreState(function(dataAndEvents, recurring) { | |
(new b365.Ui.Betslip.RestoreStateHandler(dataAndEvents)).handle(recurring); | |
}); | |
$("#bsDlg").on("click", function(recurring) { | |
(new b365.Ui.Betslip.DialogClickHandler(self._bsInst, self._controller)).handle(recurring); | |
}); | |
$("#bsCD").on("click", function(events) { | |
(new b365.Ui.Betslip.ConfirmationDialog(self._bsInst, self._controller)).handleClick(events); | |
}); | |
this._bsInst.addOnPoll(function(dataAndEvents, recurring) { | |
(new b365.Ui.Betslip.PollBetRequestDespatcher(dataAndEvents, self._controller)).despatch(recurring); | |
}); | |
this._bsInst.addOnPollExpired(function(dataAndEvents, recurring) { | |
(new b365.Ui.Betslip.PollingExpiredHandler(dataAndEvents, self._controller)).handle(recurring); | |
}); | |
this._bsInst.addOnReferBet(function(dataAndEvents, recurring) { | |
(new b365.Ui.Betslip.ReferBetRequestDespatcher(dataAndEvents, self._controller)).despatch(recurring); | |
}); | |
$("#BetSlipForm").submit(function(e) { | |
var i = e.keyCode ? e.keyCode : e.charCode; | |
if (i == 13) { | |
e.preventDefault(); | |
e.stopPropagation(); | |
self._controller.placeBet(); | |
} else { | |
e.preventDefault(); | |
e.stopPropagation(); | |
/** @type {boolean} */ | |
e.returnValue = false; | |
} | |
}); | |
this._bsInst.addOnHideBetSlip(function(ss) { | |
(new b365.Ui.Betslip.ItemSubscriptionManager(ss, self._controller)).unsubscribe(); | |
var revisionCheckbox = $("#bsDiv .betReceipt"); | |
if (revisionCheckbox.length > 0) { | |
if (revisionCheckbox.is(".visible")) { | |
self._controller.itemsRemoved(); | |
} | |
} | |
}); | |
} | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnBetAdded : function(a) { | |
this._bsInst.addOnBetAdded(function(i, code) { | |
a(i, code); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnBetAddedReqComplete : function(a) { | |
this._bsInst.addOnBetAddedReqComplete(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnEditBet : function(a) { | |
this._bsInst.addOnEditBet(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnRefreshReqComplete : function(a) { | |
this._bsInst.addOnRefreshReqComplete(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnBetSlipItemsChanged : function(a) { | |
this._bsInst.addOnBetSlipItemsChanged(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnAcceptChanges : function(a) { | |
this._bsInst.addOnAcceptChanges(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnBetSlipLoaded : function(a) { | |
this._bsInst.addOnBetSlipLoaded(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnMaxSelections : function(a) { | |
this._bsInst.addOnMaxSelections(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnBetslipDisplayed : function(a) { | |
this._bsInst.addOnBetslipDisplayed(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} func | |
* @return {undefined} | |
*/ | |
addOnPlaceBet : function(func) { | |
this._bsInst.addOnPlaceBet(function(name) { | |
func(name); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnPlaceBetSuccess : function(a) { | |
this._bsInst.addOnPlaceBetSuccess(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnAddBetslipFooterLinks : function(a) { | |
this._bsInst.addOnAddBetslipFooterLinks(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnAddReceiptHeaderLinks : function(a) { | |
this._bsInst.addOnAddReceiptHeaderLinks(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnAddReceiptLiveAlertSignUp : function(a) { | |
this._bsInst.addOnAddReceiptLiveAlertSignUp(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnBetslipError : function(a) { | |
this._bsInst.addOnBetslipError(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnShowBetSlip : function(a) { | |
this._bsInst.addOnShowBetSlip(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnHideBetSlip : function(a) { | |
this._bsInst.addOnHideBetSlip(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnChangeBetslipHeight : function(a) { | |
this._bsInst.addOnChangeBetslipHeight(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnPopupShow : function(a) { | |
this._bsInst.addOnPopupShow(function(i, code) { | |
a(i, code); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnPopupHide : function(a) { | |
this._bsInst.addOnPopupHide(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} cb | |
* @return {undefined} | |
*/ | |
addOnSessionExpired : function(cb) { | |
this._bsInst.addOnSessionExpired(function(outErr, srcFiles) { | |
cb(outErr, srcFiles); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnContentChangedOnClient : function(a) { | |
this._bsInst.addOnContentChangedOnClient(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnDeleteBetReqComplete : function(a) { | |
this._bsInst.addOnDeleteBetReqComplete(function(i) { | |
a(i); | |
}); | |
}, | |
/** | |
* @param {Function} a | |
* @return {undefined} | |
*/ | |
addOnAddBetFailed : function(a) { | |
this._bsInst.addOnAddBetFailed(function() { | |
a(); | |
}); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ReqCompleteHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {number} */ | |
this._serverErrorReqType = 99; | |
/** @type {string} */ | |
this._betSlipDialogIndicator = "BET_SLIP_DIALOG"; | |
/** @type {boolean} */ | |
this._showDlg = false; | |
/** @type {boolean} */ | |
this._resetButtonState = true; | |
/** @type {boolean} */ | |
this._hideInProg = true; | |
/** @type {null} */ | |
this._dlg = null; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @param {(Array|string)} recurring | |
* @return {undefined} | |
*/ | |
this._handleServerError = function(recurring) { | |
var pane = this._bsController && this._bsController.GetCurrentDialogRef(); | |
if (pane) { | |
pane.hideDialog(); | |
} | |
$("#bsDiv").html(recurring[0]); | |
}; | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
this._handleDialogReqComplete = function(recurring) { | |
recurring[0] = recurring[0].replace(this._betSlipDialogIndicator, ""); | |
/** @type {boolean} */ | |
this._showDlg = true; | |
this._dlg = (new b365.Ui.Betslip.DialogReqCompleteHandler(this._bsInst, this._bsController)).handle(recurring); | |
}; | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @return {undefined} | |
*/ | |
this._pollingContinuesHandler = function(recurring, opt_isDefault) { | |
/** @type {boolean} */ | |
this._resetButtonState = false; | |
var gamepadSupport = (new b365.Ui.Betslip.PollingContinuesReqCompleteHandler(this._bsInst)).handle(recurring, opt_isDefault); | |
/** @type {boolean} */ | |
this._hideInProg = gamepadSupport.pollStatus !== b365.Ui.BetslipAPI.Polling.PollStatusEnum.StartOrContinue; | |
}; | |
/** | |
* @param {Array} result | |
* @return {undefined} | |
*/ | |
this._showPushDialog = function(result) { | |
var i; | |
var n; | |
var getCn; | |
var deepDataAndEvents; | |
var y; | |
var r20; | |
if (result) { | |
/** @type {number} */ | |
i = 0; | |
n = result.length; | |
for (;i < n;i++) { | |
if (getCn = this._bsInst._betItems[result[i].getAttribute("data-item-id")], deepDataAndEvents = "P2" + result[i].getAttribute("data-item-fpid"), this._bsController.getPushPopupStatus(deepDataAndEvents) && (y = parseInt(result[i].getAttribute("data-item-push"), 10), y > 0)) { | |
r20 = new b365.Ui.Betslip.PushBetDialog(this._bsInst, this._bsController, getCn.getCn(), y, result[i].getAttribute("data-item-id"), result[i].getAttribute("data-item-type"), deepDataAndEvents); | |
this._bsController.showPushbetDialog(r20, r20._proceedAction, r20._cancelAction, y); | |
break; | |
} | |
} | |
} | |
}; | |
/** | |
* @param {(Array|string)} recurring | |
* @return {undefined} | |
*/ | |
this._defaultHandler = function(recurring) { | |
var re = this; | |
var results; | |
var i; | |
var j; | |
var element; | |
var li; | |
var _ref1; | |
var _i; | |
var _len; | |
var lis; | |
var xhtml = recurring[0]; | |
if (re._bsController.clientEnhancedMode() && re._bsController.clientBetSlipShowing()) { | |
if (xhtml.indexOf("betReceipt") > -1) { | |
re._doStandardDOMUpdate(xhtml, false); | |
return; | |
} | |
if (re._bsController._stakeEntryType == re._bsController._stakeEntryTypes.stakePad) { | |
if (results = $("#stakePad"), results.length > 0) { | |
if (i = results[0].getAttribute("data-item"), j = results[0].getAttribute("data-type"), element = document.createElement("div"), element.innerHTML = xhtml, lis = element.getElementsByTagName("li"), lis.length > 0) { | |
/** @type {number} */ | |
_i = 0; | |
/** @type {number} */ | |
_len = lis.length; | |
for (;_i < _len;_i++) { | |
if (lis[_i].getAttribute("data-item-id") == i && lis[_i].getAttribute("data-item-type") == j) { | |
li = lis[_i]; | |
break; | |
} | |
} | |
} | |
if (li) { | |
li.innerHTML = li.innerHTML + re._bsController._stakeEntryHander.getStakePadMarkUp(i, j, true); | |
_ref1 = $("input", li); | |
re._compareMultiplesAndRenderDOM(element.innerHTML, true, false); | |
re._bsController._stakeEntryHander.enableOrDisableKeys(_ref1); | |
} else { | |
re._compareMultiplesAndRenderDOM(xhtml, false, true); | |
} | |
} else { | |
re._compareMultiplesAndRenderDOM(xhtml, false, false); | |
} | |
} else { | |
re._compareMultiplesAndRenderDOM(xhtml, false, false); | |
} | |
} else { | |
re._doStandardDOMUpdate(xhtml, false); | |
} | |
}; | |
/** | |
* @param {string} xhtml | |
* @param {boolean} recurring | |
* @param {boolean} opt_isDefault | |
* @return {undefined} | |
*/ | |
this._compareMultiplesAndRenderDOM = function(xhtml, recurring, opt_isDefault) { | |
var udataCur = this; | |
/** @type {boolean} */ | |
var l = false; | |
/** @type {boolean} */ | |
var a = false; | |
var element; | |
var lis; | |
var nodes; | |
var i; | |
var len; | |
var failuresLink; | |
/** @type {boolean} */ | |
var v = false; | |
var data_item_id; | |
var oldconfig; | |
if (element = document.createElement("div"), element.innerHTML = xhtml, lis = element.getElementsByTagName("li"), lis.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
/** @type {number} */ | |
len = lis.length; | |
for (;i < len;i++) { | |
if (lis[i].getAttribute("class") == "multiple-section multipleBets") { | |
nodes = $('li[class$="multiple-section multipleBets"]', "#bsDiv"); | |
if (nodes.length > 0) { | |
if (nodes[0].children[0].getAttribute("class") == "open") { | |
/** @type {boolean} */ | |
a = true; | |
} | |
} | |
/** @type {boolean} */ | |
l = true; | |
break; | |
} | |
} | |
if (l) { | |
if (a) { | |
nodes = $('li[data-item-type$="multiple"]'); | |
/** @type {number} */ | |
i = 0; | |
len = nodes.length; | |
for (;i < len;i++) { | |
data_item_id = nodes[i].getAttribute("data-item-id"); | |
if (xhtml.indexOf('li data-item-id="' + data_item_id + '" data-item-type="multiple"') == -1) { | |
nodes[i].setAttribute("animate", "yes"); | |
/** @type {boolean} */ | |
v = true; | |
} | |
} | |
if (v) { | |
udataCur._createAndDisplayBetSlipContainerClone(opt_isDefault); | |
nodes = $('li[data-item-type$="multiple"][animate$="yes"]', "#bsDivClone"); | |
udataCur._doStandardDOMUpdate(xhtml, recurring); | |
failuresLink = $("#bsDivClone"); | |
if (opt_isDefault) { | |
oldconfig = $("#stakePadClone", "#bsDivClone"); | |
udataCur._bsController._enhancedBetSlipAnimations.hideBetMultiples(nodes, failuresLink, true, oldconfig, udataCur._removeCloneAndShowLiveBetSlipContainer, [], udataCur); | |
} else { | |
udataCur._bsController._enhancedBetSlipAnimations.hideBetMultiples(nodes, failuresLink, false, null, udataCur._removeCloneAndShowLiveBetSlipContainer, [], udataCur); | |
} | |
} else { | |
udataCur._doStandardDOMUpdate(xhtml, recurring); | |
} | |
} else { | |
udataCur._doStandardDOMUpdate(xhtml, recurring); | |
} | |
} else { | |
if (nodes = $('li[class$="multiple-section multipleBets"]', "#bsDiv"), nodes.length == 0) { | |
udataCur._doStandardDOMUpdate(xhtml, recurring); | |
return; | |
} | |
udataCur._createAndDisplayBetSlipContainerClone(opt_isDefault); | |
nodes = $('li[class$="multiple-section multipleBets"]', "#bsDivClone"); | |
udataCur._doStandardDOMUpdate(xhtml, recurring); | |
failuresLink = $("#bsDivClone"); | |
if (opt_isDefault) { | |
oldconfig = $("#stakePadClone", "#bsDivClone"); | |
udataCur._bsController._enhancedBetSlipAnimations.hideBetMultiples(nodes, failuresLink, true, oldconfig, udataCur._removeCloneAndShowLiveBetSlipContainer, [], udataCur); | |
} else { | |
udataCur._bsController._enhancedBetSlipAnimations.hideBetMultiples(nodes, failuresLink, false, null, udataCur._removeCloneAndShowLiveBetSlipContainer, [], udataCur); | |
} | |
} | |
} else { | |
udataCur._doStandardDOMUpdate(xhtml, recurring); | |
} | |
/** @type {null} */ | |
element = null; | |
}; | |
/** | |
* @param {string} xhtml | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
this._doStandardDOMUpdate = function(xhtml, recurring) { | |
var _bsInst = this; | |
/** @type {(HTMLElement|null)} */ | |
var element = document.getElementById("bsDiv"); | |
var children; | |
var ue; | |
var val; | |
var h; | |
var j; | |
var jl; | |
if (element.innerHTML = xhtml, children = element.getElementsByClassName("stk"), _bsInst._bsController && (_bsInst._bsInst && (_bsInst._bsController._stakeEntryType == _bsInst._bsController._stakeEntryTypes.deviceKeyBoard && children.length > 0))) { | |
/** @type {number} */ | |
j = 0; | |
/** @type {number} */ | |
jl = children.length; | |
for (;j < jl;j++) { | |
ue = children[j].cloneNode(true); | |
ue.setAttribute("type", _bsInst._bsInst.keyboardType); | |
children[j].parentNode.replaceChild(ue, children[j]); | |
/** @type {null} */ | |
ue = null; | |
} | |
} | |
if (_bsInst._bsController && (_bsInst._bsController._currencyDisplayHelper && children.length > 0)) { | |
/** @type {number} */ | |
j = 0; | |
/** @type {number} */ | |
jl = children.length; | |
for (;j < jl;j++) { | |
val = children[j].value; | |
if (val.toString().indexOf(".") > -1) { | |
h = val.toString().split("."); | |
children[j].value = h[1] == "00" ? h[0] : _bsInst._bsController._currencyDisplayHelper.formatCurrency(val); | |
} | |
} | |
} | |
if (recurring) { | |
_bsInst._bsController._stakeEntryHander.reenable(_bsInst._bsController._stakeEntryHander); | |
/** @type {boolean} */ | |
_bsInst._bsController._stakeEntryHander._isShowing = true; | |
} | |
if ($(element).find('li[data-item-type$="tote-single"], li[data-item-type$="tote-cast"]').length > 0) { | |
$(element).find(".bs-ConfirmHeader").removeClass("hidden"); | |
} | |
this._bsController.refreshMicrophone(); | |
/** @type {boolean} */ | |
_bsInst._resetButtonState = false; | |
_bsInst._checkLoginStatus(); | |
}; | |
/** | |
* @param {boolean} opt_isDefault | |
* @return {undefined} | |
*/ | |
this._createAndDisplayBetSlipContainerClone = function(opt_isDefault) { | |
/** @type {(HTMLElement|null)} */ | |
var a = document.getElementById("bsDiv"); | |
/** @type {Element} */ | |
var item = a.cloneNode(true); | |
var content; | |
item.setAttribute("id", "bsDivClone"); | |
if (opt_isDefault) { | |
/** @type {string} */ | |
content = item.innerHTML; | |
/** @type {string} */ | |
content = content.replace('id="stakePad"', 'id="stakePadClone"'); | |
/** @type {string} */ | |
item.innerHTML = content; | |
} | |
a.parentNode.appendChild(item); | |
a.setAttribute("style", "display:none;"); | |
/** @type {null} */ | |
a = null; | |
/** @type {null} */ | |
item = null; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._removeCloneAndShowLiveBetSlipContainer = function() { | |
/** @type {(HTMLElement|null)} */ | |
var elem = document.getElementById("bsDiv"); | |
/** @type {(HTMLElement|null)} */ | |
var tabPage = document.getElementById("bsDivClone"); | |
elem.parentNode.removeChild(tabPage); | |
elem.removeAttribute("style"); | |
/** @type {null} */ | |
elem = null; | |
/** @type {null} */ | |
tabPage = null; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._checkLoginStatus = function() { | |
var data_bsuis = $("#bsDiv>ul:first").attr("data-bsuis"); | |
if (this._bsController._delegates.isAuthenticated()) { | |
if (data_bsuis == "0") { | |
window.location.reload(); | |
} | |
} | |
}; | |
/** | |
* @param {Object} recurring | |
* @return {?} | |
*/ | |
this._customerDialogHandler = function(recurring) { | |
return this._resetButtonState = true, (new b365.Ui.Betslip.CustomerReqCompleteHandler(this._bsInst, this._bsController)).handle(recurring); | |
}; | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
this._betPlacementAttempt = function(dataAndEvents) { | |
if (dataAndEvents) { | |
/** @type {boolean} */ | |
var it = window.location.host.split(".").pop() === "it"; | |
if (!it) { | |
this._bsInst.placeBetSuccess(); | |
} | |
this._bsInst.setValueInBSCookie("processed", "true"); | |
this._bsInst.backupBSCookieValue(this._bsInst._betSlipCookieKey); | |
} | |
}; | |
/** | |
* @param {boolean} dataAndEvents | |
* @return {undefined} | |
*/ | |
this._addHeaderLinks = function(dataAndEvents) { | |
if (dataAndEvents) { | |
this._bsInst.addReceiptHeaderLinks(); | |
(new b365.Ui.Betslip.HeaderLinksReceiptRender(this._bsInst)).render(); | |
} | |
}; | |
/** | |
* @param {boolean} dataAndEvents | |
* @return {undefined} | |
*/ | |
this._addFooterLinks = function(dataAndEvents) { | |
if (!dataAndEvents) { | |
this._bsInst.betSlipDisplayed(); | |
this._bsInst.addBetslipFooterLinks(); | |
(new b365.Ui.Betslip.FooterLinksSlipRender(this._bsInst, $(".footer"))).render(); | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._addMatchAlertsReceipt = function() { | |
this._bsInst.addReceiptLiveAlertSignUp(); | |
this._bsInst._matchAlertsReceipt = new b365.Ui.Betslip.MatchAlertsReceipt(this._bsInst, this._bsController); | |
this._bsInst._matchAlertsReceipt.render(); | |
}; | |
/** | |
* @param {?} webResource | |
* @param {(Array|string)} recurring | |
* @param {?} millis | |
* @param {boolean} v00 | |
* @return {undefined} | |
*/ | |
this._processResponse = function(webResource, recurring, millis, v00) { | |
var response = this; | |
/** @type {number} */ | |
var deepDataAndEvents = Number($("#bsDiv>ul:first-child").attr("data-xrte")); | |
var cookies; | |
var jQuery; | |
var i; | |
var n; | |
var right; | |
var elem; | |
var r20; | |
var protoProps; | |
var dataAndEvents; | |
var codes; | |
var els; | |
if (!isNaN(deepDataAndEvents)) { | |
if (deepDataAndEvents > 0) { | |
response._bsController.updateCurrenyRate(deepDataAndEvents); | |
} | |
} | |
var codeSegments = this._bsInst.getBetItems(this._bsInst.itemTypeSingle); | |
var resolveValues = this._bsInst.getBetItems(this._bsInst.itemTypeMultiple); | |
var dig = this._bsInst.getBetItems(this._bsInst.itemTypeCast); | |
if (codeSegments.length === 0 && (resolveValues.length === 0 && (dig.length === 0 && this._bsInst.setValueInBSCookie("fs", "0"))), response._bsInst && webResource !== response._bsInst.reqTypePlaceBet) { | |
/** @type {NodeList} */ | |
cookies = document.getElementsByClassName("stk"); | |
jQuery = new b365.Ui.Betslip.StakeChangedHandler(response._bsInst, response._bsController); | |
/** @type {number} */ | |
i = 0; | |
for (;i < cookies.length;i++) { | |
if (cookies[i].value > 0) { | |
jQuery.handle(cookies[i]); | |
} | |
} | |
} | |
if (n = getBetslipWebModule(), n && (n.getFreeBetBonusBalance && (right = n.getFreeBetBonusBalance(), this._bsController.updateFreeBetBar(right))), response._bsController.isAustralianConfirmResponse = v00, (new b365.Ui.Betslip.TotalsCalculator(response._bsInst, response._bsController)).calculate(), (new b365.Ui.Betslip.LockUnlockHandler(response._bsInst, response._bsController)).handle(false, response._resetButtonState, webResource === response._bsInst.reqTypeBetBrk), elem = document.getElementsByClassName("betSlip")[0] || | |
document.getElementsByClassName("betReceipt")[0], r20 = elem ? elem.getAttribute("data-betguid") : null, r20 && (response._bsController.setBetguid && response._bsController.setBetguid(r20)), protoProps = elem ? elem.getAttribute("data-restrictedmultiples") : null, protoProps && response._bsController.getMultipleItemsController().setRestrictedMultiples(protoProps), dataAndEvents = window.bsApp.hasPhoneOnlyItemOnSlip(), response._bsController.setTelebetBetslip && response._bsController.setTelebetBetslip(dataAndEvents), | |
codes = document.getElementsByClassName("bs-UseFreeBet-error"), codes.length > 0) { | |
var itemIndexAndType = new b365.Ui.Betslip.ItemInformation(codes[0]); | |
var _bsInst = itemIndexAndType.itemIndexAndType(); | |
var p = this._bsInst.getBetItemById(_bsInst[1], _bsInst[0]); | |
p.setStItem("ft", ""); | |
p.setStItem("fbv", ""); | |
p.setStItem("st", ""); | |
p.setStItem("ust", ""); | |
response._bsInst.updateState(); | |
(new b365.Ui.Betslip.FreeBetClickProcessor(this._bsInst, this._bsController)).init(codes[0]).handle(false); | |
} | |
if (response._hideInProg) { | |
response._bsInst.handleInProg("hide", ""); | |
} | |
if (recurring.length > 0) { | |
if (webResource != this._bsInst.reqTypeBetBrk) { | |
if (recurring[0].indexOf("DepositMessage") == -1) { | |
response._bsInst.contentLoaded(); | |
} | |
} | |
} | |
if (millis) { | |
(new b365.Ui.Betslip.ItemSubscriptionManager(response._bsInst, response._bsController)).attach(response._bsController); | |
} | |
if (response._receiptContext || v00) { | |
response._bsInst.ScrollToTop(); | |
} | |
if (typeof window.MyBetsController != "undefined") { | |
if (window.MyBetsController.isInitialised()) { | |
window.MyBetsController.bindButtonEvents(); | |
} | |
} | |
if (response._bsController) { | |
response._bsController.clientActionInProgress(false); | |
response._bsController.getMessageDisplayHandler().showCachedMessage(); | |
} | |
if (webResource == response._bsInst.reqTypeAddItems || webResource == response._bsInst.reqTypeConstructAndAddItems) { | |
response._bsInst.betAddedReqComplete(); | |
} | |
if (this._bsInst.displayMaxExceededMessage) { | |
/** @type {NodeList} */ | |
els = document.getElementsByClassName("acceptChanges"); | |
if (els.length > 0) { | |
if (els[0].className.indexOf("hidden") > -1) { | |
response._bsController.getMessageDisplayHandler().showMsg({ | |
message : betSlipML.maxselections, | |
priority : 1 | |
}); | |
} | |
} | |
/** @type {boolean} */ | |
this._bsInst.displayMaxExceededMessage = false; | |
} | |
if (response._bsInst.toggledBankerSelectionState) { | |
if (response._bsController.ausMultiplesEnabled()) { | |
/** @type {boolean} */ | |
response._bsController.complexMultiplesNeedsRefresh = false; | |
response._bsController.getMultipleInfo(); | |
} | |
/** @type {boolean} */ | |
response._bsInst.toggledBankerSelectionState = false; | |
} | |
}; | |
}; | |
b365.Ui.Betslip.Request = { | |
/** | |
* @param {Object} recurring | |
* @return {?} | |
*/ | |
getTypeId : function(recurring) { | |
return recurring[1][7][0]; | |
}, | |
/** | |
* @param {(Array|string)} recurring | |
* @return {?} | |
*/ | |
getResponse : function(recurring) { | |
return recurring[0]; | |
} | |
}; | |
b365.Ui.Betslip.ReqCompleteHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
/** | |
* @param {string} fn | |
* @param {number} a | |
* @param {number} n | |
* @return {?} | |
*/ | |
function each(fn, a, n) { | |
/** @type {string} */ | |
var original = fn; | |
return fn && (n > 0 && (a >= 0 && (original = fn.substr(0, a) + fn.substr(a + n)))), original; | |
} | |
var self = this; | |
var $li; | |
var root; | |
var styles; | |
var nodes; | |
var code; | |
var $menu; | |
var tokens; | |
var $form; | |
var e; | |
var bar; | |
var callback; | |
var slide; | |
var millis; | |
var g; | |
var reader; | |
if (self._bsController && (self._bsController._noStakeCount = 0), self._isValid()) { | |
/** @type {boolean} */ | |
millis = false; | |
/** @type {boolean} */ | |
self._resetButtonState = true; | |
/** @type {boolean} */ | |
self._hideInProg = true; | |
var webResource = b365.Ui.Betslip.Request.getTypeId(recurring); | |
var names = b365.Ui.Betslip.Request.getResponse(recurring); | |
/** @type {boolean} */ | |
var x = webResource == bs.reqTypePlaceBet && window.location.hostname.split(".").pop().toLowerCase() === "au"; | |
/** @type {boolean} */ | |
var tt = names.indexOf("TELEBET_WRITE") > -1; | |
/** @type {boolean} */ | |
this._receiptContext = !x && names.indexOf("betReceipt") > -1; | |
if (self._bsController) { | |
if (self._bsController.ausMultiplesEnabled()) { | |
if (webResource == self._bsInst.reqTypeAddItems || (webResource == self._bsInst.reqTypeDeleteItem || self._bsController.complexMultiplesCombinationsInit)) { | |
/** @type {boolean} */ | |
self._bsController.complexMultiplesCombinationsInit = false; | |
/** @type {boolean} */ | |
self._bsController.complexMultiplesNeedsRefresh = true; | |
/** @type {boolean} */ | |
g = self._bsInst.getBetItems(self._bsInst.betTypeMultiple).length > 0; | |
if (g || self._bsController.hasMultipleStakeEntries()) { | |
self._bsController.getMultipleInfo(true); | |
} | |
} else { | |
if (webResource == self._bsInst.reqTypePlaceBet) { | |
(new b365.Ui.Betslip.TotalsCalculator(self._bsInst, self._bsController)).calculate(); | |
} | |
} | |
} | |
} | |
if (self._bsController) { | |
if (self._bsController.clientEnhancedMode()) { | |
if (!b365.Ui.BetslipAPI.Polling.isPollingRequestType(webResource)) { | |
root = $("#bsDiv"); | |
if ($("li", root).hasClass("disabledBetSlip")) { | |
$li = $('li[class$="multiple-section multipleBets"], li[data-item-type$="single"], li[data-item-type$="cast"], li[data-item-type$="tote-single"], li[data-item-type$="tote-cast"], li[data-item-type$="tote-pot"], li[data-item-type$="tote-pot-leg"]', root); | |
self._bsController._enhancedBetSlipAnimations.enableBetSlip($li, root); | |
} | |
} | |
} | |
} | |
var attr = self._bsInst.getValueFromBSCookie("processed").replace("||", ""); | |
/** @type {boolean} */ | |
var rt = names.indexOf("DepositMessage") > -1 || names.indexOf("CustomerMessage") > -1; | |
var attributes = b365.Ui.BetslipAPI.Polling.getInstructionSubStringInfo(names); | |
/** @type {null} */ | |
var value = null; | |
if (attributes && (value = attributes.content, self._receiptContext && (names = each(names, attributes.sourceStartIndex, attributes.length), recurring[0] = names)), self._bsController && (self._bsController.supressMicrophoneUpdates = x), webResource == self._serverErrorReqType) { | |
self._handleServerError(recurring); | |
self._processResponse(webResource, recurring, millis, x); | |
} else { | |
if (webResource == self._bsInst.reqTypeMaxBet) { | |
(new b365.Ui.Betslip.MaxBetReqCompleteHandler(self._bsInst, self._bsController)).handle(recurring); | |
self._processResponse(webResource, recurring, millis, x); | |
} else { | |
if (webResource == self._bsInst.reqTypeBetBrk || (webResource == self._bsInst.reqTypePitcher || names.indexOf(self._betSlipDialogIndicator) != -1)) { | |
self._handleDialogReqComplete(recurring); | |
self._processResponse(webResource, recurring, millis, x); | |
self._bsController.betPlacementNotification(false); | |
} else { | |
if (names.indexOf("DUPLICATE_BET") > -1 || names.indexOf("CHECK_MEMBERS") > -1) { | |
(new b365.Ui.Betslip.DuplicateBetHandler(self._bsInst, self._bsController)).handle(); | |
/** @type {boolean} */ | |
self._hideInProg = true; | |
self._processResponse(webResource, recurring, millis, x); | |
} else { | |
if (names.indexOf("LOCKED") > -1) { | |
root = $("#bsDiv"); | |
styles = root.find(".placeBet button"); | |
if (styles.length > 0) { | |
code = root.find("#buttonContent"); | |
if (code.length > 0) { | |
code = code[0].innerHTML; | |
styles[0].innerHTML = code; | |
} | |
} | |
self._processResponse(webResource, recurring, millis, x); | |
} else { | |
if (webResource == self._bsInst.reqTypePhoneBet) { | |
(new b365.Ui.Betslip.PhoneBetHandler(self._bsInst, self._bsController)).displayPopup(names); | |
return; | |
} | |
if (value && !self._receiptContext) { | |
self._pollingContinuesHandler(webResource, value); | |
self._processResponse(webResource, recurring, millis, x); | |
} else { | |
if (b365.Ui.BetslipAPI.Polling.isPollingRequestType(webResource)) { | |
if (webResource !== self._bsInst.reqTypePollTempBetReceipt) { | |
(new b365.Ui.Betslip.PollingFinishedReqCompleteHandler(self._bsInst, self._bsController)).handle(recurring); | |
self._betPlacementAttempt(self._receiptContext); | |
if (self._receiptContext) { | |
if (self._bsController.liveAlertsEnabled()) { | |
self._addMatchAlertsReceipt(); | |
} | |
} | |
self._addHeaderLinks(self._receiptContext); | |
self._addFooterLinks(self._receiptContext); | |
$("#closeButton").removeClass("disabled"); | |
$("#okButton").removeClass("disabled"); | |
if (self._bsController.clientEnhancedMode()) { | |
root = $("#bsDiv"); | |
if ($("li", root).hasClass("disabledBetSlip")) { | |
$li = $('li[class$="multiple-section multipleBets"], li[data-item-type$="single"], li[data-item-type$="cast"], li[data-item-type$="tote-single"], li[data-item-type$="tote-cast"], li[data-item-type$="tote-pot"], li[data-item-type$="tote-pot-leg"]', root); | |
self._bsController._enhancedBetSlipAnimations.enableBetSlip($li, root); | |
} | |
} | |
} | |
if (webResource == self._bsInst.reqTypePollReferredBet) { | |
/** @type {boolean} */ | |
millis = true; | |
} | |
if (value) { | |
self._pollingContinuesHandler(webResource, value); | |
} | |
self._processResponse(webResource, recurring, millis, x); | |
} else { | |
if (rt) { | |
if (!self._customerDialogHandler(recurring)) { | |
self._processResponse(webResource, recurring, millis, x); | |
} | |
} else { | |
if (tt) { | |
return; | |
} | |
if (webResource == self._bsInst.reqTypeFetchMultiples) { | |
reader = self._bsController.getMultipleItemsController(); | |
reader.process(recurring[0]); | |
} else { | |
(new b365.Ui.Betslip.ItemSubscriptionManager(self._bsInst, self._bsController)).detach(); | |
/** @type {boolean} */ | |
millis = true; | |
if (this._bsController.getPushMarketsEnabled()) { | |
if (webResource == this._bsInst.reqTypeRefreshAccept) { | |
callback = $(".hcapChange", root)[0]; | |
} | |
} | |
self._defaultHandler(recurring, webResource); | |
if (this._receiptContext || (x || attr != "true")) { | |
if (webResource == self._bsInst.reqTypeRefreshSlip || webResource == self._bsInst.reqTypeDeleteItem) { | |
if (webResource == self._bsInst.reqTypeDeleteItem) { | |
self._processResponse(webResource, recurring, millis, x); | |
self._bsInst.deleteBetReqComplete(); | |
} else { | |
self._bsInst.refreshReqComplete(); | |
} | |
slide = $('li[data-item-type="single"]'); | |
if (webResource != self._bsInst.reqTypeDeleteItem) { | |
self._showPushDialog(slide, webResource); | |
} | |
} else { | |
if (webResource == self._bsInst.reqTypeAddItems || webResource == self._bsInst.reqTypeConstructAndAddItems) { | |
$(document).trigger("bsInfoMessage", recurring[0].toUpperCase().indexOf("ALREADY ADDED") > -1 ? window.betSlipML.duplicateselection : window.betSlipML.addedtobetslip); | |
$menu = $("#BetSlipDialogueAddToBetslip"); | |
if ($menu.length > 0) { | |
tokens = recurring[0].match(/class=\"[\w\s]*acceptChanges[\w\s]*\"/i); | |
if (tokens.length > 0) { | |
if (recurring[0].indexOf("oddsChange") < 0) { | |
if (recurring[0].indexOf("hcapChange") < 0) { | |
if (tokens[0].toLowerCase().indexOf("hidden") < 0) { | |
$("a", $menu).addClass("disabled").attr("data-nav", ""); | |
} else { | |
$("a", $menu).removeClass("disabled").attr("data-nav", "AddToBetSlip"); | |
} | |
} | |
} | |
} | |
} | |
slide = $('li[data-item-type="single"]'); | |
self._showPushDialog(slide, webResource); | |
} else { | |
if (webResource == self._bsInst.reqTypePlaceBet || (webResource == self._bsInst.reqTypeConfirmBet || webResource == self._bsInst.reqTypeGetCTCBetDetails)) { | |
self._betPlacementAttempt(self._receiptContext); | |
self._bsController.betPlacementNotification(self._receiptContext); | |
if (webResource == self._bsInst.reqTypePlaceBet) { | |
root = root || $("#bsDiv"); | |
nodes = root.find(".placeBet.bs-BtnWrapper"); | |
/** @type {boolean} */ | |
self._bsInst.placebetBtnDisabledForSpanishStakeLimit = !!nodes.attr("data-lineitemsabovebetlimits"); | |
} | |
} else { | |
if (webResource == self._bsInst.reqTypeRefreshAccept) { | |
root = $("#bsDiv"); | |
root.trigger("b365.Ui.Betslip.acceptingchanges"); | |
self._bsInst.acceptChanges(); | |
if (callback != undefined) { | |
self._showPushDialog(callback, webResource); | |
} | |
} | |
} | |
} | |
} | |
} else { | |
(new b365.Ui.Betslip.ViewResetter(self._bsInst, self._bsController)).reset(); | |
} | |
if (this._receiptContext) { | |
if (this._bsController.liveAlertsEnabled()) { | |
this._addMatchAlertsReceipt(); | |
} | |
} | |
this._addHeaderLinks(this._receiptContext || x); | |
this._addFooterLinks(this._receiptContext || x); | |
if (value) { | |
self._pollingContinuesHandler(webResource, value); | |
} | |
if (this._bsController) { | |
if (this._bsController._dlg) { | |
$form = $("#okButton"); | |
if ($form.length > 0) { | |
e = $form[0].getAttribute("data-action"); | |
if (e) { | |
if (e === "refer" || e === "split") { | |
bar = $("#bsCD"); | |
if (bar.length > 0) { | |
if (bar[0].hasAttribute("style")) { | |
if (bar.css("display") != "none") { | |
this._bsController._dlg.hideDialog(); | |
} | |
} | |
} | |
$form.removeClass("disabled"); | |
$("#closeButton").removeClass("disabled"); | |
} | |
} | |
} | |
} | |
} | |
self._processResponse(webResource, recurring, millis, x); | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.CustomerReqCompleteHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._getCurrencyObject = function() { | |
return window.sProps && (window.sProps.balance && (window.sProps.balance.currencyDecimalSeparator && window.sProps.balance.currencyGroupSeparator)) ? { | |
decimalSeparator : window.sProps.balance.currencyDecimalSeparator, | |
thousandsSeparator : window.sProps.balance.currencyGroupSeparator | |
} : { | |
decimalSeparator : ".", | |
thousandsSeparator : "," | |
}; | |
}; | |
/** | |
* @param {string} opt_e | |
* @return {?} | |
*/ | |
this._unformatCurrency = function(opt_e) { | |
return(new b365.Ui.Betslip.CurrencyDisplayHelper(this, this._getCurrencyObject())).unformatCurrency(opt_e); | |
}; | |
}; | |
b365.Ui.Betslip.CustomerReqCompleteHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {?} | |
*/ | |
handle : function(recurring) { | |
var JSON = this; | |
var clone; | |
var destElements; | |
var matches = recurring[0].split("|"); | |
return matches.splice(0, 1), clone = { | |
userBalance : matches[0], | |
totalStake : matches[1], | |
is3dSecure : matches[2], | |
isQuickDeposit : matches[3], | |
QuickDepositRemainingStake : JSON._unformatCurrency(matches[4]), | |
betslipContainsInplay : matches[5] == "1", | |
origin : matches[6], | |
/** | |
* @return {undefined} | |
*/ | |
cancelCallBack : function() { | |
if (document.getElementById("bsCD")) { | |
(new b365.Ui.Betslip.ConfirmationDialog(JSON._bsInst, JSON._bsController)).handleCancel(); | |
} | |
} | |
}, destElements = JSON.deposit(clone), (new b365.Ui.Betslip.LockUnlockHandler(JSON._bsInst, JSON._bsController)).handle(false, true), destElements; | |
}, | |
/** | |
* @param {Event} e | |
* @return {?} | |
*/ | |
deposit : function(e) { | |
return e.origin === "lotto" ? (window.lottoInterface && (window.lottoInterface.lottoWebModule && window.lottoInterface.lottoWebModule.launchDepositPopup(e)), true) : (window.bsApp.betslipWebModule.launchDepositPopup(e), false); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.DialogReqCompleteHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {string} */ | |
this._titleMarker = "|title"; | |
/** @type {string} */ | |
this._messageMarker = "|message"; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.DialogReqCompleteHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
if (this._isValid()) { | |
var messageObj = this; | |
var parent = recurring[0]; | |
var classNames; | |
var param; | |
var udataCur; | |
var suiteView; | |
var r20; | |
var failuresLink; | |
var restoreScript; | |
var obj; | |
var common; | |
if (parent.length > 0) { | |
obj = $(parent); | |
/** @type {boolean} */ | |
common = obj.attr("data-renderstyle") === "confirmation"; | |
classNames = obj.attr("class"); | |
param = obj.children("#title").html(); | |
udataCur = obj.children("#message").html(); | |
suiteView = obj.children("#button1Text").html(); | |
r20 = obj.children("#button2Text").html(); | |
failuresLink = obj.children("#button1Action").html(); | |
restoreScript = obj.children("#button2Action").html(); | |
if (param || common) { | |
messageObj._bsController.showConfirmation(messageObj, param, udataCur, suiteView, failuresLink, r20, restoreScript, classNames); | |
} else { | |
messageObj._bsController.showDialog(messageObj, obj); | |
} | |
} | |
} | |
}, | |
/** | |
* @param {string} dialogName | |
* @return {undefined} | |
*/ | |
setDialog : function(dialogName) { | |
var _bsController = this; | |
_bsController._bsController.SetCurrentDialogRef(dialogName); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.LockUnlockHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.LockUnlockHandler.prototype = { | |
/** | |
* @param {boolean} recurring | |
* @param {boolean} opt_isDefault | |
* @param {boolean} ctx | |
* @return {undefined} | |
*/ | |
handle : function(recurring, opt_isDefault, ctx) { | |
var o; | |
var $col; | |
var domElement; | |
if (this._isValid()) { | |
var emptyJ = $("#bsDiv"); | |
var $delegate = $(".bs-Footer .bs-ItemOverlay"); | |
var $field = $(".bs-BetSlipType .bs-ItemOverlay"); | |
var wrap = document.getElementsByClassName("bs-BetSlipType_SelectionText")[0]; | |
var $spy = $("#bsDiv ul>li"); | |
if (typeof opt_isDefault == "undefined") { | |
/** @type {boolean} */ | |
opt_isDefault = true; | |
} | |
/** @type {boolean} */ | |
o = this._bsInst._pollReqType === this._bsInst.reqTypePollTempBetReceipt; | |
recurring = recurring || this._bsInst.pollInProgress() && !o; | |
if (typeof ctx == "undefined") { | |
/** @type {boolean} */ | |
ctx = false; | |
} | |
if ($delegate.length > 0) { | |
if (recurring || this._bsInst.numItems() == 0) { | |
$delegate.addClass("bs-ItemOverlay_show"); | |
$field.addClass("bs-ItemOverlay_show"); | |
if (wrap) { | |
/** @type {string} */ | |
wrap.className = wrap.className + " bs-BetSlipType_SelectionText-disabled"; | |
} | |
(new b365.Ui.Betslip.EnhancedElementsLockUnlockHandler(this._bsInst, this._bsController)).lock(); | |
} else { | |
if (opt_isDefault) { | |
$col = $("#bsDiv a.acceptChanges"); | |
if (!this._bsInst.isEmpty() || ctx) { | |
$delegate.removeClass("bs-ItemOverlay_show"); | |
} | |
$field.removeClass("bs-ItemOverlay_show"); | |
if (wrap) { | |
wrap.className = wrap.className.replace("bs-BetSlipType_SelectionText-disabled", ""); | |
} | |
(new b365.Ui.Betslip.EnhancedElementsLockUnlockHandler(this._bsInst, this._bsController)).unlock(); | |
} | |
} | |
} | |
/** @type {(HTMLElement|null)} */ | |
domElement = document.getElementById("bsDiv"); | |
if (domElement) { | |
if (recurring) { | |
if (domElement.className.indexOf("bs-ShowOverlay") === -1) { | |
/** @type {string} */ | |
domElement.className = domElement.className + " bs-ShowOverlay"; | |
} | |
} else { | |
/** @type {string} */ | |
domElement.className = domElement.className.replace(/ bs-ShowOverlay/, ""); | |
} | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedElementsLockUnlockHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedElementsLockUnlockHandler.prototype.lock = function() { | |
if (!this._bsController.clientUsesSelect()) { | |
if (this._bsController._enhancedBetSlipTypeSelector) { | |
this._bsController._enhancedBetSlipTypeSelector.disablePopUp(); | |
} | |
if (this._bsController._enhancedBetSlipOddsSelector) { | |
this._bsController._enhancedBetSlipOddsSelector.disablePopUps(); | |
} | |
if (this._bsController._enhancedBetSlipPitcherSelector) { | |
this._bsController._enhancedBetSlipPitcherSelector.disablePopUps(); | |
} | |
if (this._bsController._enhancedIfBetSelector) { | |
this._bsController._enhancedIfBetSelector.disablePopUps(); | |
} | |
if (this._bsController._enhancedTeaserSelector) { | |
this._bsController._enhancedTeaserSelector.disablePopUps(); | |
} | |
} | |
if (this._bsController._removeClickHandler) { | |
this._bsController._removeClickHandler.removeHandlers(); | |
} | |
if (this._bsController._eachWayClickHandler) { | |
this._bsController._eachWayClickHandler.removeHandlers(); | |
} | |
if (this._bsController._freeBetClickHandler) { | |
this._bsController._freeBetClickHandler.removeHandlers(); | |
} | |
if (this._bsController._noReservesClickHandler) { | |
this._bsController._noReservesClickHandler.removeHandlers(); | |
} | |
if (this._bsController._streamingClickHandler) { | |
this._bsController._streamingClickHandler.removeHandlers(); | |
} | |
if (this._bsController._toteHoverHandler) { | |
this._bsController._toteHoverHandler.removeHandlers(); | |
} | |
if (this._bsController._unitStakeClickHandler) { | |
this._bsController._unitStakeClickHandler.removeHandlers(); | |
} | |
if (this._bsController._stakeFocusHandler) { | |
this._bsController._stakeFocusHandler.removeHandlers(); | |
} | |
if (this._bsController._stakeEntryType == this._bsController._stakeEntryTypes.stakePad) { | |
if (this._bsController._stakeEntryHander) { | |
if (this._bsController._stakeEntryHander._isShowing) { | |
this._bsController._stakeEntryHander.detach(); | |
} | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EnhancedElementsLockUnlockHandler.prototype.unlock = function() { | |
var RemoveClickHandler = this; | |
if (!this._bsController.clientUsesSelect()) { | |
if (this._bsController._enhancedBetSlipTypeSelector) { | |
this._bsController._enhancedBetSlipTypeSelector.enablePopUp(); | |
} | |
if (this._bsController._enhancedBetSlipOddsSelector) { | |
this._bsController._enhancedBetSlipOddsSelector.enablePopUps(); | |
} | |
if (this._bsController._enhancedBetSlipPitcherSelector) { | |
this._bsController._enhancedBetSlipPitcherSelector.enablePopUps(); | |
} | |
if (this._bsController._enhancedIfBetSelector) { | |
this._bsController._enhancedIfBetSelector.enablePopUps(); | |
} | |
if (this._bsController._enhancedTeaserSelector) { | |
this._bsController._enhancedTeaserSelector.enablePopUps(); | |
} | |
} | |
if (this._bsController._removeClickHandler) { | |
this._bsController._removeClickHandler.attachHandlers(); | |
} else { | |
this._bsController._removeClickHandler = new b365.Ui.Betslip.RemoveClickHandler(RemoveClickHandler._bsInst, RemoveClickHandler._bsController); | |
this._bsController._removeClickHandler.attachHandlers(); | |
} | |
if (this._bsController._eachWayClickHandler) { | |
this._bsController._eachWayClickHandler.attachHandlers(); | |
} else { | |
if (b365.Ui.Betslip.EachWayClickHandler) { | |
this._bsController._eachWayClickHandler = new b365.Ui.Betslip.EachWayClickHandler(RemoveClickHandler._bsInst, RemoveClickHandler._bsController); | |
this._bsController._eachWayClickHandler.attachHandlers(); | |
} | |
} | |
if (this._bsController._freeBetClickHandler) { | |
this._bsController._freeBetClickHandler.attachHandlers(); | |
} else { | |
if (b365.Ui.Betslip.FreeBetClickHandler) { | |
this._bsController._freeBetClickHandler = new b365.Ui.Betslip.FreeBetClickHandler(RemoveClickHandler._bsInst, RemoveClickHandler._bsController); | |
this._bsController._freeBetClickHandler.attachHandlers(); | |
} | |
} | |
if (this._bsController._noReservesClickHandler) { | |
this._bsController._noReservesClickHandler.attachHandlers(); | |
} else { | |
if (b365.Ui.Betslip.NoReservesClickHandler) { | |
this._bsController._noReservesClickHandler = new b365.Ui.Betslip.NoReservesClickHandler(RemoveClickHandler._bsInst, RemoveClickHandler._bsController); | |
this._bsController._noReservesClickHandler.attachHandlers(); | |
} | |
} | |
if (this._bsController._streamingClickHandler) { | |
this._bsController._streamingClickHandler.attachHandlers(); | |
} else { | |
if (b365.Ui.Betslip.StreamingClickHandler) { | |
this._bsController._streamingClickHandler = new b365.Ui.Betslip.StreamingClickHandler(RemoveClickHandler._bsInst, RemoveClickHandler._bsController); | |
this._bsController._streamingClickHandler.attachHandlers(); | |
} | |
} | |
if (this._bsController._toteHoverHandler) { | |
this._bsController._toteHoverHandler.attachHandlers(); | |
} else { | |
if (b365.Ui.Betslip.ToteHoverHandler) { | |
this._bsController._toteHoverHandler = new b365.Ui.Betslip.ToteHoverHandler(RemoveClickHandler._bsInst, RemoveClickHandler._bsController); | |
this._bsController._toteHoverHandler.attachHandlers(); | |
} | |
} | |
if (this._bsController._unitStakeClickHandler) { | |
this._bsController._unitStakeClickHandler.attachHandlers(); | |
} else { | |
if (b365.Ui.Betslip.UnitStakeClickHandler) { | |
this._bsController._unitStakeClickHandler = new b365.Ui.Betslip.UnitStakeClickHandler(RemoveClickHandler._bsInst, RemoveClickHandler._bsController); | |
this._bsController._unitStakeClickHandler.attachHandlers(); | |
} | |
} | |
if (this._bsController._toteStakeClickHandler) { | |
this._bsController._toteStakeClickHandler.attachHandlers(); | |
} else { | |
if (b365.Ui.Betslip.ToteStakeClickHandler) { | |
this._bsController._toteStakeClickHandler = new b365.Ui.Betslip.ToteStakeClickHandler(RemoveClickHandler._bsInst, RemoveClickHandler._bsController); | |
this._bsController._toteStakeClickHandler.attachHandlers(); | |
} | |
} | |
if (this._bsController._stakeFocusHandler) { | |
this._bsController._stakeFocusHandler.attachHandlers(); | |
} else { | |
if (b365.Ui.Betslip.StakeFocusHandler) { | |
this._bsController._stakeFocusHandler = new b365.Ui.Betslip.StakeFocusHandler; | |
this._bsController._stakeFocusHandler.attachHandlers(); | |
} | |
} | |
if (this._bsController._stakeEntryType == this._bsController._stakeEntryTypes.stakePad) { | |
if (this._bsController._stakeEntryHander) { | |
if (this._bsController._stakeEntryHander._isShowing) { | |
this._bsController._stakeEntryHander.init(); | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.BetslipAPI"), function(fn) { | |
/** @type {string} */ | |
var name = "BET_POLL"; | |
/** @type {string} */ | |
var v = "ENDPOLLDATA"; | |
/** @type {string} */ | |
var b = "PS="; | |
/** @type {string} */ | |
var args = "RDAT="; | |
/** @type {string} */ | |
var index = "NPRP="; | |
fn.PollStatusEnum = { | |
StartOrContinue : 0, | |
Succeeded : 1, | |
Failed : 2 | |
}; | |
/** | |
* @param {string} data | |
* @return {?} | |
*/ | |
fn.getInstructionSubStringInfo = function(data) { | |
var str; | |
var idx = data.indexOf(name); | |
var p; | |
return idx < 0 ? null : (p = data.indexOf(v, idx + name.length), str = p > -1 ? data.substring(idx, p + v.length) : data.substring(idx), { | |
content : str, | |
sourceStartIndex : idx, | |
length : str.length | |
}); | |
}; | |
/** | |
* @param {string} str | |
* @param {string} text | |
* @param {string} arg | |
* @return {?} | |
*/ | |
fn.boundedSubString = function(str, text, arg) { | |
var pos; | |
var index; | |
return!str || (!text || (!arg || str.length < text.length + arg.length)) ? null : (pos = str.indexOf(text), pos <= -1) ? null : (pos += text.length, index = str.indexOf(arg, pos), index < pos) ? null : str.substring(pos, index); | |
}; | |
/** | |
* @param {Object} element | |
* @return {?} | |
*/ | |
fn.parsePollInfo = function(element) { | |
var scope = fn.boundedSubString(element, name, v); | |
var guts; | |
/** @type {null} */ | |
var data = null; | |
return scope && (guts = scope.split("|"), data = { | |
reqType : guts.length > 1 ? Number(guts[1]) : null, | |
referenceId : guts.length > 2 ? guts[2] : "", | |
time : guts.length > 3 ? guts[3] : null, | |
interval : guts.length > 4 ? guts[4] : null, | |
pollStatus : fn.PollStatusEnum.StartOrContinue, | |
nextPollRequestParams : null, | |
responseData : null | |
}, scope.indexOf(b) > 0 && (data.pollStatus = Number(fn.boundedSubString(scope, b, index)), data.nextPollRequestParams = fn.boundedSubString(scope, index, args), data.responseData = fn.boundedSubString(element, args, v))), data; | |
}; | |
/** | |
* @param {?} recurring | |
* @return {?} | |
*/ | |
fn.isPollingRequestType = function(recurring) { | |
return recurring === bs.reqTypePollReferredBet || recurring === bs.reqTypePollTempBetReceipt; | |
}; | |
}(window.b365.Ui.BetslipAPI.Polling = window.b365.Ui.BetslipAPI.Polling || {}); | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.PollingContinuesReqCompleteHandler = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return this._bsInst !== undefined; | |
}; | |
}; | |
b365.Ui.Betslip.PollingContinuesReqCompleteHandler.prototype = { | |
/** | |
* @param {boolean} result | |
* @return {undefined} | |
*/ | |
EnableGuiControlsForTempReceipt : function(result) { | |
var $e = $("#bsDiv"); | |
var value = $e.find(".br-Header_Done button"); | |
var attrNames = value && result !== value.prop("disabled"); | |
if (!attrNames) { | |
$e.find(".br-Header_RetainLink").prop("disabled", !result); | |
value.prop("disabled", !result); | |
if (result) { | |
value.parent().removeClass("disabled"); | |
} else { | |
value.parent().addClass("disabled"); | |
} | |
} | |
}, | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @return {?} | |
*/ | |
handle : function(recurring, opt_isDefault) { | |
/** @type {null} */ | |
var o = null; | |
if (this._isValid()) { | |
if ((o = b365.Ui.BetslipAPI.Polling.parsePollInfo(opt_isDefault), !o) || (recurring = Number(recurring), b365.Ui.BetslipAPI.Polling.isPollingRequestType(recurring) === o.reqType && this._bsInst._pollReqType === 0)) { | |
return null; | |
} | |
if (recurring === this._bsInst.reqTypePollTempBetReceipt) { | |
this.handleTempReceiptData(o); | |
} | |
if (o.pollStatus === b365.Ui.BetslipAPI.Polling.PollStatusEnum.StartOrContinue) { | |
this._bsInst.pollBet(o.reqType, o.referenceId, o.time, o.interval, o.nextPollRequestParams); | |
} | |
if (o.reqType === this._bsInst.reqTypePollTempBetReceipt) { | |
this.EnableGuiControlsForTempReceipt(o.pollStatus !== b365.Ui.BetslipAPI.Polling.PollStatusEnum.StartOrContinue); | |
} | |
} | |
return o; | |
}, | |
/** | |
* @param {Array} res | |
* @return {undefined} | |
*/ | |
handleTempReceiptData : function(res) { | |
var data = res.responseData; | |
/** @type {number} */ | |
var method = -1; | |
/** @type {number} */ | |
var drawShape = 2; | |
/** @type {number} */ | |
var text = 3; | |
var i; | |
var valsLength; | |
var item; | |
/** @type {null} */ | |
var udataCur = null; | |
var elem; | |
/** @type {null} */ | |
var name = null; | |
var y; | |
var curLoop; | |
var expandIconEl; | |
var els; | |
var groups; | |
if (res.pollStatus !== b365.Ui.BetslipAPI.Polling.PollStatusEnum.Failed && (data && (data.length !== 0 && (data = JSON.parse(data), data)))) { | |
valsLength = data.BetList.length; | |
/** @type {NodeList} */ | |
curLoop = document.getElementsByClassName("br-Status"); | |
/** @type {number} */ | |
i = 0; | |
for (;i < valsLength;i += 1) { | |
item = data.BetList[i]; | |
elem = $("#tempbetstatus_title_" + item.TempBettingSlipId); | |
switch(item.Status) { | |
case method: | |
/** @type {string} */ | |
udataCur = "br-Status_Desc-timeout"; | |
name = betSlipML.aamstimeout; | |
break; | |
case drawShape: | |
/** @type {string} */ | |
udataCur = "br-Status_Desc-acceptedref"; | |
name = item.PSQFReference; | |
expandIconEl = elem[0].parentElement.children[0]; | |
/** @type {string} */ | |
name = item.PSQFReference + " -"; | |
$("#tempbetstatus_reference_" + item.TempBettingSlipId).text(item.BetReference).prev().prev().removeClass("hidden"); | |
/** @type {string} */ | |
expandIconEl.className = "br-ItalyStatus br-Status_Desc br-Status_Desc-accepted"; | |
/** @type {string} */ | |
curLoop[i].className = curLoop[i].className + " br-Status_Accepted"; | |
break; | |
case text: | |
/** @type {string} */ | |
udataCur = "br-Status_Desc-rejected"; | |
name = betSlipML.aamsrejected; | |
/** @type {string} */ | |
curLoop[i].className = curLoop[i].className + " br-Status_Rejected"; | |
} | |
if (item.Status === drawShape || (item.Status === text || item.Status === method)) { | |
elem.text(name); | |
$("#tempbetstatus_desc_" + item.TempBettingSlipId).addClass("hidden"); | |
} | |
/** @type {boolean} */ | |
y = item.Status === 0 || item.Status === 1; | |
if (y === false) { | |
elem.removeClass("br-Status_Desc-pending").addClass(udataCur); | |
} | |
if (document.getElementsByClassName("br-Status_Desc-pending").length == 0) { | |
/** @type {NodeList} */ | |
els = document.getElementsByClassName("br-Italy_Header_Disabled"); | |
if (els.length > 0) { | |
els[0].className = els[0].className.replace("br-Italy_Header_Disabled", ""); | |
} | |
/** @type {NodeList} */ | |
groups = document.getElementsByClassName("br-Italy_Retain_Disabled"); | |
if (groups.length > 0) { | |
groups[0].children[0].className = groups[0].children[0].className.replace("br-Italy_Reuse_Disabled", ""); | |
groups[0].className = groups[0].className.replace("br-Italy_Retain_Disabled", ""); | |
} | |
} | |
} | |
if (res.pollStatus === b365.Ui.BetslipAPI.Polling.PollStatusEnum.Succeeded) { | |
if (data.UserBalanceDisplayValue.length > 0) { | |
$("#bsDiv > ul:first-child").attr("data-ub", data.UserBalanceDisplayValue); | |
this._bsInst.placeBetSuccess(); | |
} | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.PollingFinishedReqCompleteHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.PollingFinishedReqCompleteHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
if (this._isValid()) { | |
this._bsInst.resetPoll(); | |
/** @type {boolean} */ | |
var t = recurring[0].indexOf("DepositMessage") > -1 || recurring[0].indexOf("CustomerMessage") > -1; | |
if (t) { | |
if (this._bsController._dlg) { | |
this._bsController._dlg.hideDialog(); | |
} | |
(new b365.Ui.Betslip.CustomerReqCompleteHandler(this._bsInst, this._bsController)).handle(recurring); | |
} else { | |
if (this._bsController._dlg) { | |
this._bsController._dlg.hideDialog(); | |
} | |
$("#bsDiv").html(recurring[0]); | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.MultiBreakdownRequestDespatcher = function(dataAndEvents, deepDataAndEvents) { | |
this._bsController = deepDataAndEvents; | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.MultiBreakdownRequestDespatcher.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
despatch : function(recurring) { | |
if (this._isValid()) { | |
var deepDataAndEvents = (new b365.Ui.Betslip.BetBreakdownKeyGenerator(this._bsInst, this._bsInst.getBetItemById(this._bsInst.itemTypeMultiple, recurring), this._bsInst.itemTypeMultiple, recurring)).generate(); | |
this._bsController.showBetslipBreakdownDialog(deepDataAndEvents); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.RemoveAllItemsRequestDespatcher = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._closeBetSlip = function() { | |
var _bsInst = this; | |
_bsInst._bsInst.hideBetSlip(); | |
}; | |
}; | |
b365.Ui.Betslip.RemoveAllItemsRequestDespatcher.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
despatch : function(recurring) { | |
if (this._isValid()) { | |
if (!$(recurring).hasClass("disabled")) { | |
this._closeBetSlip(); | |
this._bsInst.clearBets(true); | |
this._bsInst.betSlipItemsChanged(); | |
this._bsController.itemsRemoved(); | |
$("#bsDiv").trigger("b365.Ui.Betslip.removingall"); | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.EditSelectionsRequestDespatcher = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.EditSelectionsRequestDespatcher.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
despatch : function() { | |
if (this._isValid()) { | |
this._bsInst.editBet(); | |
this._bsInst.setClearOnAdd(false); | |
this._bsInst.setValueInBSCookie("processed", "false"); | |
this._bsInst.refresh(this._bsInst.betTypeNormal); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} webglController | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.DialogClickHandler = function(dataAndEvents, webglController) { | |
this._bsInst = dataAndEvents; | |
this._controller = webglController; | |
/** @type {string} */ | |
this._closeAction = "close"; | |
/** @type {string} */ | |
this._referAction = "refer"; | |
/** @type {string} */ | |
this._italyPushProceed = "ipProceed"; | |
/** @type {string} */ | |
this._italyPushCancel = "ipCancel"; | |
/** @type {string} */ | |
this._pdProceed = "pdProceed"; | |
/** @type {string} */ | |
this._pdHelp = "pdHelp"; | |
/** @type {string} */ | |
this._hrefClick = "href"; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && typeof this._controller.GetCurrentDialogRef() != "undefined"; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._handleRefer = function() { | |
(new b365.Ui.Betslip.ReferBetRequestDespatcher(this._bsInst, this._controller)).despatch(); | |
}; | |
}; | |
b365.Ui.Betslip.DialogClickHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var target = $(recurring.target); | |
var act = target.attr("data-action"); | |
var e; | |
if (this._isValid()) { | |
if (act !== this._hrefClick && (recurring.preventDefault(), recurring.stopPropagation()), target.hasClass("disabled")) { | |
return; | |
} | |
switch(act) { | |
case this._closeAction: | |
$("#closeButton").removeClass("disabled"); | |
$("#okButton").removeClass("disabled"); | |
this.hideDialog(); | |
break; | |
case this._referAction: | |
$("#closeButton").addClass("disabled"); | |
e = $("#okButton"); | |
e.addClass("disabled"); | |
/** @type {string} */ | |
e[0].innerHTML = window.betSlipML.referringBet + '<span class="buttonSpinner"></span>'; | |
this._handleRefer(); | |
break; | |
case this._italyPushProceed: | |
; | |
case this._italyPushCancel: | |
; | |
case this._pdProceed: | |
; | |
case this._pdHelp: | |
this._controller._dlg.controller.handleClick(recurring); | |
} | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.DialogClickHandler.prototype.hideDialog = function() { | |
if (this._controller._dlg) { | |
this._controller._dlg.hideDialog(); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} webglController | |
* @param {?} mediaElem | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.DialogCloser = function(webglController, mediaElem) { | |
this._controller = webglController; | |
this._dialogContainer = $(mediaElem); | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._controller != "undefined" && typeof this._dialogContainer != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.DialogCloser.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
closeDialog : function() { | |
if (this._isValid()) { | |
this._dialogContainer.addClass("hidden"); | |
$(".centergreyout").remove(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} webglController | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.RetainSelectionsRequestDespatcher = function(dataAndEvents, webglController) { | |
this._bsInst = dataAndEvents; | |
this._controller = webglController; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.RetainSelectionsRequestDespatcher.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
despatch : function(recurring) { | |
var codeSegments; | |
var i; | |
if (this._isValid() && !$(recurring).hasClass("disabled")) { | |
if (this._controller.getPushMarketsEnabled()) { | |
this._bsInst.restoreBSCookieValue("bs", this._bsInst._pushBetSlipCookieBackup); | |
} else { | |
this._bsInst.restoreBSCookieValue("bs", this._bsInst._betSlipCookieBackup); | |
} | |
this._bsInst.setValueInBSCookie("processed", "false"); | |
(new b365.Ui.Betslip.RestoreStateHandler(this._bsInst)).handle(); | |
this._bsInst.setClearOnAdd(false); | |
(new b365.Ui.Betslip.UpdateStateHandler(this._bsInst)).handle(); | |
codeSegments = this._bsInst.getBetItems(this._bsInst.itemTypeAll); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
codeSegments[i].setStItem("st", ""); | |
codeSegments[i].setStItem("ust", ""); | |
codeSegments[i].setStItem("gust", ""); | |
codeSegments[i].setStItem("gst", ""); | |
codeSegments[i].setStItem("tr", ""); | |
codeSegments[i].setStItem("fbv", ""); | |
codeSegments[i].setStItem("ft", ""); | |
} | |
this._bsInst.updateState(); | |
this._bsInst.refresh(this._bsInst.betTypeNormal); | |
this._controller.retainSelectionsDelegate(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.SingleBreakdownRequestDespatcher = function(dataAndEvents, deepDataAndEvents) { | |
this._bsController = deepDataAndEvents; | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.SingleBreakdownRequestDespatcher.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
despatch : function(recurring) { | |
if (this._isValid()) { | |
var deepDataAndEvents = (new b365.Ui.Betslip.BetBreakdownKeyGenerator(this._bsInst, this._bsInst.getBetItemById(this._bsInst.itemTypeSingle, recurring), this._bsInst.itemTypeSingle, recurring)).generate(); | |
this._bsController.showBetslipBreakdownDialog(deepDataAndEvents); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @param {?} ignoreMethodDoesntExist | |
* @param {(Object|number|string)} textAlt | |
* @param {HTMLElement} keepData | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.RepeatStakeClickHandler = function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist, textAlt, keepData) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
this._itemIndex = ignoreMethodDoesntExist; | |
/** @type {(Object|number|string)} */ | |
this._itemType = textAlt; | |
/** @type {HTMLElement} */ | |
this._itemElement = keepData; | |
/** @type {boolean} */ | |
this._isItalianDomain = window.location.host.split(".").pop() == "it"; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && (typeof this._itemIndex != "undefined" && (typeof this._itemType != "undefined" && typeof this._itemElement != "undefined")); | |
}; | |
/** | |
* @param {string} arg | |
* @return {?} | |
*/ | |
this._isValidRepeatStake = function(arg) { | |
return arg != "" && Number(arg) > 0; | |
}; | |
/** | |
* @param {string} newValue | |
* @param {(Object|string)} dataAndEvents | |
* @param {number} startRow | |
* @return {undefined} | |
*/ | |
this._repeatStake = function(newValue, dataAndEvents, startRow) { | |
var codeSegments; | |
var a; | |
var i; | |
var els; | |
if (this._isValid()) { | |
codeSegments = this._bsInst.getBetItems(dataAndEvents); | |
a = new b365.Ui.Betslip.StakeChangedHandler(this._bsInst, this._bsController); | |
/** @type {number} */ | |
i = startRow; | |
for (;i < codeSegments.length;i++) { | |
els = $("#bsDiv " + (dataAndEvents == this._bsInst.itemTypeSingle ? ".single-section" : ".cast-section") + " li[data-item-id='" + i + "']:not(.suspended) .stk"); | |
if (els.length > 0) { | |
if (els[0].className.indexOf("bs-FreeBet-disabled") == -1) { | |
codeSegments[i].setStItem("st", newValue); | |
/** @type {string} */ | |
els[0].value = newValue; | |
a.handle(els[0]); | |
els.removeClass("bs-Stake_TextBox-placeholder"); | |
} | |
} | |
} | |
this._bsInst.updateState(); | |
} | |
}; | |
}; | |
b365.Ui.Betslip.RepeatStakeClickHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
if (typeof recurring != "undefined" && (recurring && this._isValid())) { | |
var inputClones = $(this._itemElement).find(".stk:first"); | |
var d = (new b365.Ui.Formatter).padStringTo2DP(inputClones[0].value); | |
var date = d; | |
if (this._bsController._currencyDisplayHelper) { | |
date = this._bsController._currencyDisplayHelper.formatCurrency(d); | |
} | |
inputClones[0].value = date; | |
if (this._isValidRepeatStake(d)) { | |
if (this._itemType == this._bsInst.itemTypeSingle) { | |
this._repeatStake(date, this._bsInst.itemTypeSingle, Number(this._itemIndex) + 1); | |
this._repeatStake(date, this._bsInst.itemTypeCast, 0); | |
} else { | |
if (this._itemType == this._bsInst.itemTypeCast) { | |
this._repeatStake(date, this._bsInst.itemTypeCast, Number(this._itemIndex) + 1); | |
} | |
} | |
(new b365.Ui.Betslip.TotalsCalculator(this._bsInst, this._bsController)).calculate(); | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.RepeatStakeVisibilitySetter = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.RepeatStakeVisibilitySetter.prototype = { | |
/** | |
* @param {Object} v | |
* @return {undefined} | |
*/ | |
set : function(v) { | |
if (this._isValid()) { | |
/** @type {boolean} */ | |
var t = $("[data-item-id='0']").first().find(".bs-Stake_TextBox")[0] == v; | |
if (t) { | |
if ($blib.isDecimal(v.value) && v.value !== "") { | |
$(".bs-RepeatStake").removeClass("hidden"); | |
} else { | |
$(".bs-RepeatStake").addClass("hidden"); | |
} | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.NoReservesClickHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {boolean} */ | |
this._enabled = false; | |
/** @type {Array} */ | |
this._noReservesClickHandlers = []; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.NoReservesClickHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var lib = this; | |
var elem; | |
var el; | |
var jspApi; | |
var e; | |
var curPageObj; | |
var req; | |
if (typeof recurring != "undefined" && recurring) { | |
if (lib.removeHandlers(), elem = recurring.target, el = $(elem), !el.prop("disabled") && !el.parents().prop("disabled")) { | |
switch(elem.nodeName.toLowerCase()) { | |
case "div": | |
el = $(elem).find('span.bs-CheckBox[data-inp-type="nrcb"]'); | |
elem = el[0]; | |
break; | |
default: | |
el = $(elem).parent().find('span.bs-CheckBox[data-inp-type="nrcb"]'); | |
elem = el[0]; | |
} | |
if (lib._bsInst._pollReqType === lib._bsInst.reqTypePollTempBetReceipt) { | |
lib._bsInst.resetPoll(); | |
} | |
jspApi = new b365.Ui.Betslip.ItemInformation(elem); | |
e = jspApi.itemIndexAndType(); | |
curPageObj = jspApi.itemElement(); | |
if (!$(curPageObj).hasClass("suspended")) { | |
req = $(elem).hasClass("checked"); | |
if (!false) { | |
if (req) { | |
$(elem).removeClass("checked"); | |
/** @type {boolean} */ | |
req = false; | |
} else { | |
$(elem).addClass("checked"); | |
/** @type {boolean} */ | |
req = true; | |
} | |
} | |
(new b365.Ui.Betslip.NoReservesClickProcessor(this._bsInst, e[0], e[1], curPageObj)).handle(req, recurring); | |
} | |
lib.attachHandlers(); | |
} | |
recurring.stopPropagation(); | |
recurring.preventDefault(); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
attachHandlers : function() { | |
var _this = this; | |
var configList = $('div[data-inp-type="nrcb"], span[data-inp-type="nrcb"]', "#bsDiv"); | |
var i; | |
var ln; | |
if (_this.removeHandlers(_this), configList.length == 0) { | |
/** @type {boolean} */ | |
_this._enabled = false; | |
return; | |
} | |
/** @type {number} */ | |
i = 0; | |
ln = configList.length; | |
for (;i < ln;i++) { | |
_this._noReservesClickHandlers.push(new b365.Ui.Betslip.ResponsiveClickHandler(configList[i], $.proxy(_this.handle, _this), false)); | |
} | |
/** @type {boolean} */ | |
_this._enabled = true; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
removeHandlers : function() { | |
var that = this; | |
var i; | |
var valsLength; | |
if (that._noReservesClickHandlers.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = that._noReservesClickHandlers.length; | |
for (;i < valsLength;i++) { | |
if (that._noReservesClickHandlers[i]._element) { | |
that._noReservesClickHandlers[i].destroy(); | |
} | |
} | |
/** @type {Array} */ | |
that._noReservesClickHandlers = []; | |
} | |
/** @type {boolean} */ | |
that._enabled = false; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @param {?} ignoreMethodDoesntExist | |
* @param {HTMLElement} textAlt | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.NoReservesClickProcessor = function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist, textAlt) { | |
this._bsInst = dataAndEvents; | |
this._itemIndex = deepDataAndEvents; | |
this._itemType = ignoreMethodDoesntExist; | |
/** @type {HTMLElement} */ | |
this._itemElement = textAlt; | |
/** @type {string} */ | |
this._noReservesCookieKey = "nr"; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && (typeof this._itemIndex != "undefined" && (typeof this._itemType != "undefined" && typeof this._itemElement != "undefined")); | |
}; | |
/** | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
this._updateSelectionLabel = function(recurring) { | |
var args = $(this._itemElement).find(".no-reserves-hidden").text().split("|"); | |
$(this._itemElement).find(".bs-Selection_Desc").text(recurring ? args[1] : args[0]); | |
}; | |
}; | |
b365.Ui.Betslip.NoReservesClickProcessor.prototype = { | |
/** | |
* @param {boolean} recurring | |
* @param {boolean} opt_isDefault | |
* @return {undefined} | |
*/ | |
handle : function(recurring, opt_isDefault) { | |
if (typeof opt_isDefault != "undefined" && (opt_isDefault && this._isValid())) { | |
var _itemIndex = this._bsInst.getBetItemById(this._itemType, this._itemIndex); | |
if (_itemIndex) { | |
_itemIndex.setStItem(this._noReservesCookieKey, recurring ? "1" : "0"); | |
this._bsInst.updateState(); | |
this._updateSelectionLabel(recurring); | |
} | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Formatter = function() { | |
/** | |
* @param {string} text | |
* @return {?} | |
*/ | |
this._to2DP = function(text) { | |
text = text.replace(",", "."); | |
var pos = text.indexOf("."); | |
return pos != -1 && (text.length - pos > 3 && (text = text.substr(0, pos + 3))), text; | |
}; | |
}; | |
b365.Ui.Formatter.prototype = { | |
/** | |
* @param {string} text | |
* @return {?} | |
*/ | |
padStringTo2DP : function(text) { | |
var lastNewlinePos; | |
var i; | |
return typeof text != "string" && (text = String(text)), text = text.replace(/,/g, "."), text = text.trim(), text === "." || text === "" ? text = "0.00" : (text = this._to2DP(text), lastNewlinePos = text.indexOf("."), lastNewlinePos == -1 ? text += ".00" : (i = text.length - (lastNewlinePos + 1), i == 0 ? text += "00" : i == 1 && (text += "0"))), text; | |
}, | |
/** | |
* @param {string} arg | |
* @return {?} | |
*/ | |
numDecPlcs : function(arg) { | |
if (typeof arg != "string") { | |
/** @type {string} */ | |
arg = String(arg); | |
} | |
/** @type {string} */ | |
var length = "."; | |
return arg.indexOf(length) > -1 ? arg.length - arg.indexOf(length) - 1 : 0; | |
}, | |
/** | |
* @param {string} value | |
* @return {?} | |
*/ | |
roundValue : function(value) { | |
var html; | |
var properties; | |
var name; | |
var val; | |
var version; | |
var fromIndex; | |
if (typeof value != "string" && (value = String(value)), value = value.trim(), value != "NaN" && value.indexOf(".") >= 0) { | |
if (properties = value.split("."), name = properties[0], val = properties[1], val.trim().length == 0) { | |
return value; | |
} | |
val = val.length > 4 ? val.substring(0, 3) : val; | |
version = val.substring(2, 3); | |
if (Number(version) >= 5) { | |
version = val.substring(1, 2); | |
if (Number(version) == 9) { | |
fromIndex = val.substring(0, 1); | |
if (Number(fromIndex) == 9) { | |
/** @type {number} */ | |
name = Number(name) + 1; | |
/** @type {number} */ | |
html = name; | |
} else { | |
/** @type {number} */ | |
version = Number(fromIndex) + 1; | |
/** @type {string} */ | |
name = name + "." + version; | |
/** @type {string} */ | |
html = name; | |
} | |
} else { | |
/** @type {number} */ | |
version = Number(version) + 1; | |
/** @type {string} */ | |
version = String(val.substring(0, 1)) + String(version); | |
/** @type {string} */ | |
name = name + "." + version; | |
/** @type {string} */ | |
html = name; | |
} | |
} else { | |
if (val.length == 1) { | |
/** @type {string} */ | |
name = name + "." + val; | |
/** @type {string} */ | |
html = name; | |
} else { | |
name = name + "." + val.substring(0, 2); | |
html = name; | |
} | |
} | |
} else { | |
html = value === "" || value == "NaN" ? "" : isNaN(value) ? value : value; | |
} | |
return html; | |
}, | |
/** | |
* @param {string} value | |
* @return {?} | |
*/ | |
roundDecimal : function(value) { | |
return typeof value != "string" && (value = String(value)), value = value.replace(/,/g, "."), value = value.trim(), value === "." || value === "" ? "0.00" : this.padStringTo2DP(this.roundValue(value)); | |
}, | |
/** | |
* @param {number} x | |
* @param {number} precision | |
* @return {?} | |
*/ | |
round : function(x, precision) { | |
return Math.round(parseFloat(x) * Math.pow(10, precision)) / Math.pow(10, precision); | |
}, | |
/** | |
* @param {number} value | |
* @param {number} opt_attributes | |
* @return {?} | |
*/ | |
roundFixed : function(value, opt_attributes) { | |
return this.round(value, opt_attributes).toFixed(opt_attributes); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.AcceptChangesRequestDespatcher = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
this._formatter = new b365.Ui.Formatter; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.AcceptChangesRequestDespatcher.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
despatch : function() { | |
var results; | |
var l; | |
/** @type {number} */ | |
var i = 0; | |
var button; | |
var substring; | |
/** @type {boolean} */ | |
var h = false; | |
var j; | |
var c; | |
if (this._isValid()) { | |
if (window.location.host.split(".").pop() == "au" && (results = $(".betCallDisabled"), results.length > 0)) { | |
if (results.length > 1) { | |
(new b365.Ui.Betslip.RemoveAllItemsRequestDespatcher(this._bsInst, this._bsController)).despatch(null); | |
} else { | |
/** @type {number} */ | |
j = 0; | |
l = results.length; | |
for (;j < l;j++) { | |
(new b365.Ui.Betslip.ItemDeleteExecutor(this._bsInst, this._bsController, results[j].getAttribute("data-item-id"), results[j].getAttribute("data-item-type"))).execute(); | |
} | |
} | |
} | |
var arr = this._bsInst.getBetItems(this._bsInst.betTypeAll); | |
var div; | |
var ew; | |
var text; | |
var html; | |
var t; | |
var component; | |
var $slide; | |
var tagList; | |
/** @type {Array} */ | |
var tweets = []; | |
var e = arr.length; | |
/** @type {number} */ | |
var v = -1; | |
/** @type {number} */ | |
c = 0; | |
for (;c < e;c++) { | |
button = arr[c].getStItem("olc"); | |
component = arr[c].getCnItem("id"); | |
if (arr[c].type == this._bsInst.betTypeNormal) { | |
component = arr[c].getCnItem("fp"); | |
$slide = $('li[data-item-fpid="' + component + '"]', this._bsWrapper); | |
} else { | |
if (arr[c].type == this._bsInst.betTypeMultiple) { | |
$slide = $('li[data-item-id="' + component + '"][data-item-type="multiple"]', this._bsWrapper); | |
} else { | |
if (arr[c].type == this._bsInst.betTypeCast) { | |
v += 1; | |
$slide = $('li[data-item-id="' + v + '"][data-item-type="cast"]', this._bsWrapper); | |
if ($slide.length == 0) { | |
$slide = $('li[data-item-id="' + v + '"][data-item-type="tote-cast"]', this._bsWrapper); | |
} | |
} | |
} | |
} | |
if (button !== undefined || (arr[c].type == this._bsInst.betTypeMultiple || arr[c].type == this._bsInst.betTypeCast)) { | |
if (arr[c].getStItem("rs") && arr[c].getStItem("rs").length > 0 || $slide.hasClass("errStk")) { | |
div = arr[c].getStItem("rs"); | |
if (div || arr[c].type != this._bsInst.betTypeCast) { | |
arr[c].setStItem("st", div); | |
arr[c].setStItem("rs", ""); | |
if (arr[c].getStItem("ust")) { | |
arr[c].setStItem("ust", div); | |
} | |
} else { | |
/** @type {string} */ | |
div = document.querySelector("#bsDiv>ul").getAttribute("data-minstake"); | |
} | |
if (div) { | |
tagList = $('input[class*="stk"]', $slide); | |
if (tagList.length > 0) { | |
tagList[0].value = this._bsController._currencyDisplayHelper.formatCurrency(this._formatter.roundDecimal(String(div))); | |
(new b365.Ui.Betslip.StakeChangedHandler(this._bsInst, this._bsController)).handle(tagList[0], true); | |
} | |
} | |
} | |
substring = $slide.attr("data-item-push"); | |
if (substring) { | |
if (substring != "") { | |
if (button == "2" || button == "3") { | |
/** @type {boolean} */ | |
h = true; | |
} | |
} | |
} | |
if (arr[c].getStItem("olc")) { | |
arr[c].setStItem("olc", "0"); | |
} | |
div = arr[c].getStItem("st"); | |
ew = arr[c].getStItem("ew"); | |
text = $blib.getItemOdds(bs.betTypeNormal, arr[c]); | |
html = new b365.Ui.Betslip.TaxCalculator(this._bsInst); | |
t = html.calcReturnsByLine(div, text); | |
arr[c].setStItem("tr", t); | |
} | |
if (arr[c].getCnItem("fp")) { | |
if (arr[c].getStItem("_s") !== undefined) { | |
if (arr[c].getStItem("_s") == "1") { | |
if (arr[c].getCnItem("id")) { | |
this._bsController.itemsRemoved(arr[c].getCnItem("id").replace("Y", "").replace("N", "")); | |
} else { | |
if (arr[c].getCnItem("mid") && arr[c].getCnItem("pid")) { | |
this._bsController.itemsRemoved(arr[c].getCnItem("pid") + ":" + arr[c].getCnItem("mid")); | |
} else { | |
if (arr[c].getCnItem("Inc")) { | |
this._bsController.itemsRemoved(arr[c].getCnItem("fp") + "~inc" + arr[c].getCnItem("Inc")); | |
} else { | |
this._bsController.itemsRemoved(arr[c].getCnItem("fp")); | |
} | |
} | |
} | |
j = $slide.attr("data-item-id"); | |
/** @type {number} */ | |
j = j - i; | |
tweets[i] = (new b365.Ui.Betslip.ItemDeleteExecutor(this._bsInst, this._bsController, j, $slide.attr("data-item-type"))).executeWithoutRequest(); | |
i++; | |
} | |
} | |
} | |
if (arr[c].getStItem("spodss") !== undefined) { | |
if (arr[c].getStItem("spodss") == 1) { | |
/** @type {boolean} */ | |
h = true; | |
} | |
} | |
} | |
if (this._bsInst.updateState(), this._bsInst.betSlipItemsChanged(), i > 0) { | |
if (i != e) { | |
/** @type {number} */ | |
c = 0; | |
for (;c < tweets.length;c++) { | |
if (!this._bsController.isReqOnBetDeletedEnabled() || this._bsInst.req(this._bsInst.reqTypeDeleteItem)) { | |
if (tweets[c].getCnItem("id")) { | |
this._bsController.itemsRemoved(tweets[c].getCnItem("id").replace("Y", "").replace("N", "")); | |
} else { | |
if (tweets[c].getCnItem("mid") && tweets[c].getCnItem("pid")) { | |
this._bsController.itemsRemoved(tweets[c].getCnItem("pid") + ":" + tweets[c].getCnItem("mid")); | |
} else { | |
if (tweets[c].getCnItem("Inc")) { | |
this._bsController.itemsRemoved(tweets[c].getCnItem("fp") + "~inc" + tweets[c].getCnItem("Inc")); | |
} else { | |
this._bsController.itemsRemoved(tweets[c].getCnItem("fp")); | |
} | |
} | |
} | |
} | |
} | |
/** @type {boolean} */ | |
h = true; | |
} else { | |
(new b365.Ui.Betslip.RemoveAllItemsRequestDespatcher(this._bsInst, this._bsController)).despatch(null); | |
(new b365.Ui.Betslip.ItemSubscriptionManager(this._bsInst, this._bsController)).unsubscribe(); | |
} | |
} | |
if (h) { | |
this._bsInst.refresh(this._bsInst.betTypeAllAccept); | |
(new b365.Ui.Betslip.ItemSubscriptionManager(this._bsInst, this._bsController)).unsubscribe(); | |
} else { | |
$(".acceptChanges", this._bsWrapper).addClass("hidden"); | |
$("a.placeBet", this._bsWrapper).removeClass("hidden"); | |
$("a.placeBet", this._bsWrapper).removeClass("bs-BtnDisabled"); | |
$(".oddsChange", this._bsWrapper).removeClass("oddsChange"); | |
$(".hcapChange", this._bsWrapper).removeClass("hcapChange"); | |
$(".errStk", this._bsWrapper).removeClass("errStk"); | |
} | |
this._bsController.getMessageDisplayHandler().hideMsg(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {string} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.AddBetConstructDecoder = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** @type {string} */ | |
this._construct = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && typeof this._construct != "undefined"; | |
}; | |
/** | |
* @param {?} obj | |
* @param {?} dataAndEvents | |
* @return {?} | |
*/ | |
this._getSpecificType = function(obj, dataAndEvents) { | |
switch(obj) { | |
case this._bsInst.toteTypeUKTote: | |
return dataAndEvents == this._bsInst.betTypeToteNonCast ? this._bsInst.betTypeToteNonCast : dataAndEvents == this._bsInst.betTypeTotePot ? this._bsInst.betTypeTotePot : this._bsInst.betTypeToteCast; | |
case this._bsInst.toteTypeETote: | |
return dataAndEvents == this._bsInst.betTypeToteNonCast ? this._bsInst.betTypeEToteNonCast : dataAndEvents == this._bsInst.betTypeTotePot ? this._bsInst.betTypeETotePot : this._bsInst.betTypeEToteCast; | |
case this._bsInst.toteTypeUSTote: | |
return dataAndEvents == this._bsInst.betTypeToteNonCast ? this._bsInst.betTypeUsToteNonCast : dataAndEvents == this._bsInst.betTypeTotePot ? this._bsInst.betTypeUsTotePot : this._bsInst.betTypeUsToteCast; | |
default: | |
return dataAndEvents == this._bsInst.betTypeToteNonCast ? this._bsInst.betTypeFrgnToteNonCast : dataAndEvents == this._bsInst.betTypeTotePot ? this._bsInst.betTypeFrgnTotePot : this._bsInst.betTypeFrgnToteCast; | |
} | |
}; | |
}; | |
b365.Ui.Betslip.AddBetConstructDecoder.prototype = { | |
/** | |
* @return {?} | |
*/ | |
betType : function() { | |
var timeout = bs.betTypeNormal; | |
var cc; | |
var suiteView; | |
var b; | |
if (this._isValid()) { | |
if ($.isArray(this._construct)) { | |
if (this._construct[0].stype && this._construct[0].cmask) { | |
cc = this._construct[0].stype; | |
suiteView = this._construct[0].ttype; | |
switch(cc) { | |
case "N": | |
; | |
case "I": | |
timeout = this._bsInst.betTypeCast; | |
break; | |
case "A": | |
; | |
case "O": | |
b = new b365.Ui.Betslip.CastMaskInfo(this._construct[0].cmask); | |
timeout = b.isToteCast(cc) ? this._bsInst.betTypeCast : b.isTotePot() ? this._bsInst.betTypeTotePotAus : this._bsInst.betTypeCast; | |
break; | |
case "T": | |
; | |
case "R": | |
; | |
case "J": | |
; | |
case "E": | |
b = new b365.Ui.Betslip.CastMaskInfo(this._construct[0].cmask); | |
timeout = b.isToteCast(cc) ? this._getSpecificType(suiteView, this._bsInst.betTypeToteCast) : b.isTotePot() ? this._getSpecificType(suiteView, this._bsInst.betTypeTotePot) : this._getSpecificType(suiteView, this._bsInst.betTypeToteNonCast); | |
} | |
} | |
} else { | |
if (this._construct.indexOf("bc=") > -1) { | |
timeout = bs.betTypeMultiple; | |
} | |
} | |
} | |
return timeout; | |
} | |
}, function() { | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} selectElement | |
* @param {?} webglController | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.AddBetHandler = function(selectElement, webglController) { | |
if (typeof $displayHelper != "undefined") { | |
if (selectElement._betItems.length == 0 && ($displayHelper.isPortraitMode() && ($displayHelper.isPrematch() && window.MyBetsController.isInitialised()))) { | |
window.MyBetsController.showBetSlip(); | |
} else { | |
if ($displayHelper.isPortraitMode() && (!$displayHelper.isPrematch() && window.MyBetsController.isInitialised())) { | |
window.MyBetsController.showBetSlip(); | |
} else { | |
if (!$displayHelper.isPortraitMode()) { | |
if (window.MyBetsController.isInitialised()) { | |
window.MyBetsController.showBetSlip(); | |
} | |
} | |
} | |
} | |
} | |
this._bsInst = selectElement; | |
this._controller = webglController; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && typeof this._controller != "undefined"; | |
}; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
this._getConstruct = function(node) { | |
var next = node; | |
return typeof node == "string" || ($.isArray(node) || (next = Array.prototype.slice.call(node)[0])), next || (next = node.ConstructString), next; | |
}; | |
/** | |
* @param {Array} data | |
* @param {string} dataAndEvents | |
* @return {undefined} | |
*/ | |
this._failedToAddBet = function(data, dataAndEvents) { | |
if (dataAndEvents === this._bsInst.betTypeNormal) { | |
if (data.length > 0) { | |
$("#bsDiv").trigger("b365.Ui.Betslip.failedtoaddbet", data[0]); | |
} | |
} | |
}; | |
/** | |
* @param {Array} chunks | |
* @return {?} | |
*/ | |
this._duplicateCheck = function(chunks) { | |
var tok = new b365.Ui.Betslip.DuplicateItemValidator(this._bsInst); | |
/** @type {boolean} */ | |
var shouldremove = false; | |
/** @type {number} */ | |
var j = 0; | |
for (;j < chunks.length && !shouldremove;j++) { | |
shouldremove = tok.isDuplicate(chunks[j]); | |
} | |
return shouldremove; | |
}; | |
}; | |
b365.Ui.Betslip.AddBetHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @param {Function} arg | |
* @return {undefined} | |
*/ | |
handle : function(recurring, opt_isDefault, arg) { | |
var elem; | |
var resolveValues; | |
var codeSegments; | |
var deepDataAndEvents; | |
var groupsize; | |
var i; | |
var d; | |
if (this._isValid()) { | |
/** @type {Array} */ | |
var chunks = []; | |
/** @type {Array} */ | |
var array = []; | |
var e = this._getConstruct(recurring); | |
var evt = new b365.Ui.Betslip.AddBetConstructDecoder(this._bsInst, e); | |
var errback; | |
var jsonp; | |
var callback; | |
/** @type {boolean} */ | |
var u = true; | |
if (this._bsInst.setClearOnAdd(opt_isDefault === true || $("#bsDiv .betReceipt").length > 0), elem = document.getElementById("pro"), elem.className.indexOf("hidden") === -1 && (u = false), resolveValues = document.getElementsByClassName("bs-ConfirmationFooter"), resolveValues.length > 0 && (u = false), codeSegments = document.getElementsByClassName("bs-BetCall_Connecting"), codeSegments.length > 0 && (u = false), codeSegments = document.getElementsByClassName("bs-BetCall_Connected"), codeSegments.length > | |
0 && (u = false), !u) { | |
this._bsInst.addBetFailed(); | |
return; | |
} | |
if (errback = this._bsInst.getClearOnAdd(), errback || (new b365.Ui.Betslip.AddBetTypeValidator(this._bsInst, this._controller)).validate(evt.betType(), e)) { | |
if (this._bsInst._pollReqType === this._bsInst.reqTypePollTempBetReceipt && this._bsInst.resetPoll(), evt.betType() === this._bsInst.betTypeFrgnToteCast && (e = (new b365.Ui.Betslip.ForeignToteConstructCorrector(this._bsInst, e)).GetCorrectedConstruct()), deepDataAndEvents = evt.betType(), chunks = (new b365.Ui.Betslip.AddBetItemsBuilder(this._bsInst, e)).betItems(deepDataAndEvents), deepDataAndEvents !== this._bsInst.betTypeCast && deepDataAndEvents !== this._bsInst.betTypeToteCast || | |
(this._bsInst.okToAdd(chunks.length) || (groupsize = this._bsInst._betItems.length + this._bsInst._betCastItems.length, i = 14 - groupsize, i != 0 && (chunks.splice(i, chunks.length), this._bsInst.displayMaxExceededMessage = true))), errback || (jsonp = this._bsInst.okToAdd(chunks.length))) { | |
if (callback = errback, errback) { | |
/** @type {number} */ | |
var x = 0; | |
var classNames = this._bsInst.getBetItems(evt.betType()); | |
var cnl = classNames.length; | |
for (;x < cnl;x++) { | |
this._controller.itemsRemoved(classNames[x].getCnItem("fp")); | |
} | |
this._bsInst.clearBets(false); | |
if (opt_isDefault) { | |
this._controller.itemsRemoved(); | |
} | |
jsonp = this._bsInst.okToAdd(chunks.length); | |
} else { | |
array = this._bsInst.getBetItems(evt.betType()); | |
/** @type {boolean} */ | |
callback = !this._duplicateCheck(chunks); | |
} | |
if (callback && jsonp) { | |
if (array.length === 0) { | |
(new b365.Ui.Betslip.DefaultSlipTypeSetter(this._bsInst)).setSlipType(evt.betType()); | |
this._bsInst.showBetSlip(); | |
} | |
if (!(this._controller.isReqOnBetAddedEnabled() && this._bsInst.locked())) { | |
array = array.concat(chunks); | |
this._bsInst.setBetItems(array, evt.betType()); | |
d = chunks && (chunks.length < 2 && +chunks[0].getStItem("fb") > 0); | |
if (d) { | |
this._bsInst.setValueInBSCookie("fs", "1"); | |
} | |
this._bsInst.updateState(); | |
this._bsInst.betAdded(chunks); | |
this._bsInst.betSlipItemsChanged(); | |
} | |
if (this._controller.isReqOnBetAddedEnabled()) { | |
if (!this._bsInst.req(this._bsInst.reqTypeAddItems)) { | |
this._failedToAddBet(chunks, evt.betType()); | |
/** @type {boolean} */ | |
u = false; | |
} | |
} | |
} else { | |
if (!callback) { | |
this._bsInst.unlock(); | |
(new b365.Ui.Betslip.InProgressDisplayHandler(this._bsInst, this._controller)).handle(["hide", betSlipML.duplicateselection, null, ""]); | |
/** @type {boolean} */ | |
u = false; | |
} | |
} | |
} | |
if (!jsonp) { | |
this._bsInst.unlock(); | |
this._controller.getMessageDisplayHandler().showMsg({ | |
message : betSlipML.maxselections, | |
priority : 1 | |
}); | |
this._bsInst.maxSelections(); | |
if (!this._duplicateCheck(chunks)) { | |
this._failedToAddBet(chunks, evt.betType()); | |
/** @type {boolean} */ | |
u = false; | |
} | |
} | |
if (!u) { | |
this._bsInst.addBetFailed(); | |
} | |
if (u) { | |
if (arg) { | |
if (typeof arg == "function") { | |
arg.call(); | |
} | |
} | |
} | |
} else { | |
(new b365.Ui.Betslip.ConfirmationDialog(this._bsInst, this._controller)).showIncompatibleSelectionsDialog(e, arg); | |
} | |
} | |
} | |
}; | |
}(), function() { | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {string} webglController | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.DeleteBetHandler = function(dataAndEvents, webglController) { | |
this._bsInst = dataAndEvents; | |
/** @type {string} */ | |
this._controller = webglController; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && typeof this._controller != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.DeleteBetHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var j; | |
var x; | |
var codeSegments; | |
var execute; | |
var spaceIdx; | |
var num; | |
var requestUrl; | |
if (this._isValid()) { | |
if (j = true, x = document.getElementById("pro"), x.className.indexOf("hidden") === -1 && (j = false), codeSegments = document.getElementsByClassName("bs-ConfirmationFooter"), codeSegments.length > 0 && (j = false), !j) { | |
this._bsInst.deleteBetReqComplete(); | |
return; | |
} | |
execute = $blib.getBetItemIndex(recurring, this._bsInst); | |
if (execute != -1) { | |
(new b365.Ui.Betslip.ItemDeleteExecutor(this._bsInst, this._controller, execute, this._bsInst.betTypeNormal)).execute(); | |
} else { | |
if (recurring.indexOf("#id=") > -1) { | |
spaceIdx = recurring.indexOf("#id="); | |
num = recurring.indexOf("#", spaceIdx + 1); | |
requestUrl = recurring.slice(spaceIdx + 4, num); | |
requestUrl = requestUrl.replace("Y", "").replace("N", ""); | |
} else { | |
spaceIdx = recurring.indexOf("#id="); | |
num = recurring.indexOf("#", spaceIdx + 1); | |
requestUrl = recurring.slice(spaceIdx + 4, num); | |
} | |
if (requestUrl.length > 0) { | |
this._controller.itemsRemoved(requestUrl.replace("Y", "").replace("N", "")); | |
this._bsInst.deleteBetReqComplete(); | |
} | |
} | |
} | |
} | |
}; | |
}(); | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.AddBetItemsBuilder = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._construct = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && typeof this._construct != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.AddBetItemsBuilder.prototype = { | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {?} | |
*/ | |
betItems : function(deepDataAndEvents) { | |
/** @type {Array} */ | |
var _parsers = []; | |
if (this._isValid()) { | |
switch(deepDataAndEvents) { | |
case this._bsInst.betTypeCast: | |
; | |
case this._bsInst.betTypeToteCast: | |
; | |
case this._bsInst.betTypeUsToteCast: | |
; | |
case this._bsInst.betTypeEToteCast: | |
; | |
case this._bsInst.betTypeFrgnToteCast: | |
_parsers = (new b365.Ui.Betslip.CastBetItemsBuilder(this._bsInst, this._construct)).betItems(); | |
break; | |
case this._bsInst.betTypeToteNonCast: | |
; | |
case this._bsInst.betTypeUsToteNonCast: | |
; | |
case this._bsInst.betTypeEToteNonCast: | |
; | |
case this._bsInst.betTypeTotePot: | |
; | |
case this._bsInst.betTypeUsTotePot: | |
; | |
case this._bsInst.betTypeETotePot: | |
; | |
case this._bsInst.betTypeFrgnToteNonCast: | |
; | |
case this._bsInst.betTypeFrgnTotePot: | |
; | |
case this._bsInst.betTypeTotePotAus: | |
_parsers = (new b365.Ui.Betslip.ToteBetItemsBuilder(this._bsInst, this._construct)).betItems(); | |
break; | |
case this._bsInst.betTypeNormal: | |
_parsers.push(new b365.Ui.BetDTO); | |
_parsers[0].parse(this._construct); | |
} | |
} | |
return _parsers; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.AddBetTypeEToteValidator = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.AddBetTypeEToteValidator.prototype = { | |
/** | |
* @param {string} dataAndEvents | |
* @return {?} | |
*/ | |
validate : function(dataAndEvents) { | |
/** @type {boolean} */ | |
var t = false; | |
return this._isValid() && (t = dataAndEvents == this._bsInst.betTypeEToteCast || (dataAndEvents == this._bsInst.betTypeEToteNonCast || dataAndEvents == this._bsInst.betTypeETotePot)), t; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.AddBetTypeIfRevIfBankerTeaserValidator = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.AddBetTypeIfRevIfBankerTeaserValidator.prototype = { | |
/** | |
* @param {string} dataAndEvents | |
* @return {?} | |
*/ | |
validate : function(dataAndEvents) { | |
/** @type {boolean} */ | |
var t = false; | |
return this._isValid() && (t = dataAndEvents == this._bsInst.betTypeNormal), t; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.AddBetTypeStandardValidator = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.AddBetTypeStandardValidator.prototype = { | |
/** | |
* @param {string} dataAndEvents | |
* @return {?} | |
*/ | |
validate : function(dataAndEvents) { | |
/** @type {boolean} */ | |
var a = true; | |
var codeSegments = this._bsInst.getBetItems(this._bsInst.betTypeTotePotAus); | |
return dataAndEvents == this._bsInst.betTypeTotePotAus ? a = codeSegments.length > 0 && ((codeSegments[0].getCnItem("spt") == "A" || codeSegments[0].getCnItem("spt") == "O") && (new b365.Ui.Betslip.CastMaskInfo(codeSegments[0].getCnItem("cm"))).isTotePot()) : (a = !(codeSegments.length > 0 && ((codeSegments[0].getCnItem("spt") == "A" || codeSegments[0].getCnItem("spt") == "O") && (new b365.Ui.Betslip.CastMaskInfo(codeSegments[0].getCnItem("cm"))).isTotePot())), a && (a = dataAndEvents == this._bsInst.betTypeNormal || | |
(dataAndEvents == this._bsInst.betTypeCast || (dataAndEvents == bs.betTypeFrgnToteCast || (dataAndEvents == bs.betTypeFrgnToteNonCast || dataAndEvents == bs.betTypeFrgnTotePot))))), a; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.AddBetTypeUkToteValidator = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.AddBetTypeUkToteValidator.prototype = { | |
/** | |
* @param {string} dataAndEvents | |
* @return {?} | |
*/ | |
validate : function(dataAndEvents) { | |
/** @type {boolean} */ | |
var t = false; | |
return this._isValid() && (t = dataAndEvents == this._bsInst.betTypeToteCast || (dataAndEvents == this._bsInst.betTypeToteNonCast || dataAndEvents == this._bsInst.betTypeTotePot)), t; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.AddBetTypeUsToteValidator = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.AddBetTypeUsToteValidator.prototype = { | |
/** | |
* @param {string} dataAndEvents | |
* @return {?} | |
*/ | |
validate : function(dataAndEvents) { | |
/** @type {boolean} */ | |
var t = false; | |
return this._isValid() && (t = dataAndEvents == this._bsInst.betTypeUsToteCast || (dataAndEvents == this._bsInst.betTypeUsToteNonCast || dataAndEvents == this._bsInst.betTypeUsTotePot)), t; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {number} dataAndEvents | |
* @param {?} webglController | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.AddBetTypeValidator = function(dataAndEvents, webglController) { | |
/** @type {number} */ | |
this._bsInst = dataAndEvents; | |
this._controller = webglController; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && typeof this._controller != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.AddBetTypeValidator.prototype = { | |
/** | |
* @param {?} dataAndEvents | |
* @return {?} | |
*/ | |
validate : function(dataAndEvents) { | |
/** @type {boolean} */ | |
var pass = true; | |
if (this._bsInst.numItems() > 0) { | |
switch(this._bsInst.getSlipType()) { | |
case this._bsInst.slipStandard: | |
pass = (new b365.Ui.Betslip.AddBetTypeStandardValidator(this._bsInst)).validate(dataAndEvents); | |
break; | |
case this._bsInst.slipBanker: | |
; | |
case this._bsInst.slipIF: | |
; | |
case this._bsInst.slipReverseIF: | |
; | |
case this._bsInst.slipFixedTeaser: | |
pass = (new b365.Ui.Betslip.AddBetTypeIfRevIfBankerTeaserValidator(this._bsInst)).validate(dataAndEvents); | |
if (!(dataAndEvents == this._bsInst.slipFixedTeaser)) { | |
if (!pass) { | |
if (!(dataAndEvents != this._bsInst.betTypeCast)) { | |
this._bsInst.setValueInBSCookie("bt", this._bsInst.slipStandard); | |
/** @type {boolean} */ | |
pass = true; | |
} | |
} | |
} | |
break; | |
case this._bsInst.slipUKTote: | |
pass = (new b365.Ui.Betslip.AddBetTypeUkToteValidator(this._bsInst)).validate(dataAndEvents); | |
break; | |
case this._bsInst.slipUSTote: | |
pass = (new b365.Ui.Betslip.AddBetTypeUsToteValidator(this._bsInst)).validate(dataAndEvents); | |
break; | |
case this._bsInst.slipETote: | |
pass = (new b365.Ui.Betslip.AddBetTypeEToteValidator(this._bsInst)).validate(dataAndEvents); | |
} | |
} | |
return pass; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {Node} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.CastMaskInfo = function(dataAndEvents) { | |
/** @type {Node} */ | |
this._castmask = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._castmask != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.CastMaskInfo.prototype = { | |
/** | |
* @param {string} cc | |
* @return {?} | |
*/ | |
isToteCast : function(cc) { | |
return cc == "J" && this._castmask != "D" ? true : this._castmask == "E" || (this._castmask == "T" || (this._castmask == "W" || (this._castmask == "S" || this._castmask == "Q"))); | |
}, | |
/** | |
* @return {?} | |
*/ | |
isTotePot : function() { | |
return this._castmask == "P" || (this._castmask == "U" || (this._castmask == "J" || (this._castmask == "6" || (this._castmask == "7" || (this._castmask == "2" || (this._castmask == "3" || this._castmask == "4")))))); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {number} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.CastBetItemsBuilder = function(dataAndEvents, deepDataAndEvents) { | |
/** @type {number} */ | |
this._bsInst = dataAndEvents; | |
this._construct = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && typeof this._construct != "undefined"; | |
}; | |
/** | |
* @param {string} prefix | |
* @param {Object} options | |
* @return {?} | |
*/ | |
this._getTotePotItemConstructs = function(prefix, options) { | |
/** @type {Array} */ | |
var eventPath = []; | |
/** @type {string} */ | |
var t = "#fp="; | |
var y; | |
var r; | |
/** @type {number} */ | |
var x = 0; | |
for (;x < options.valuelist.length;x++) { | |
/** @type {number} */ | |
y = 0; | |
for (;y < options.valuelist[x].length;y++) { | |
r = options.valuelist[x][y].split(":"); | |
if (x === 0) { | |
if (y === 0) { | |
prefix += "#cm=" + r[2] + "#tmn=" + r[4] + "#tmi=" + r[3]; | |
} | |
} | |
t += r[5] + ":" + r[0] + ":" + r[6] + ":" + r[1] + (x == options.valuelist.length - 1 && y == options.valuelist[x].length - 1 ? "" : ","); | |
} | |
} | |
return eventPath.push(prefix + t + (options.mediaType !== "" ? "|#mt=" + options.mediaType + "#" : "")), eventPath; | |
}; | |
/** | |
* @param {string} s | |
* @param {string} querystring | |
* @return {?} | |
*/ | |
this._getCombinations = function(s, querystring) { | |
/** @type {Array} */ | |
var flattened = []; | |
var codeSegments = querystring[0]; | |
var element; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (s.indexOf(codeSegments[i]) == -1) { | |
element = s + (s === "" ? "" : ",") + codeSegments[i]; | |
if (querystring.length > 1 && querystring[1]) { | |
/** @type {Array} */ | |
flattened = flattened.concat(this._getCombinations(element, querystring.slice(1))); | |
} else { | |
flattened.push(element); | |
} | |
} | |
} | |
return flattened; | |
}; | |
/** | |
* @param {string} prefix | |
* @param {Object} node | |
* @return {?} | |
*/ | |
this._getNoneTotePotItemConstructs = function(prefix, node) { | |
/** @type {Array} */ | |
var key_names = []; | |
/** @type {string} */ | |
var ch = "#fp="; | |
var codeSegments; | |
var i; | |
if (node.ctype == "C" || node.cmask == "Q") { | |
/** @type {number} */ | |
i = 0; | |
for (;i < node.valuelist[0].length;i++) { | |
ch += node.valuelist[0][i] + (i == node.valuelist[0].length - 1 ? "" : ","); | |
} | |
key_names.push(prefix + ch); | |
} else { | |
if (node.ctype == "B") { | |
ch += node.valuelist[0]; | |
/** @type {number} */ | |
i = 1; | |
for (;i < node.valuelist.length;i++) { | |
if (node.valuelist[i]) { | |
ch += "," + node.valuelist[i].toString(); | |
} | |
} | |
key_names.push(prefix + ch + (node.mediaType !== "" ? "|#mt=" + node.mediaType + "#" : "")); | |
} else { | |
codeSegments = this._getCombinations("", node.valuelist); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
key_names.push(prefix + ch + codeSegments[i] + (node.mediaType !== "" ? "|#mt=" + node.mediaType + "#" : "")); | |
} | |
} | |
} | |
return key_names; | |
}; | |
/** | |
* @param {string} type | |
* @param {Object} node | |
* @return {?} | |
*/ | |
this._getAusCastItemConstructs = function(type, node) { | |
/** @type {Array} */ | |
var eventPath = []; | |
/** @type {string} */ | |
var queueHooks = "#fp="; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < node.valuelist.length;i++) { | |
if (node.valuelist[i]) { | |
queueHooks += node.valuelist[i].join(","); | |
} | |
if (i != node.valuelist.length - 1) { | |
if (node.valuelist[i + 1]) { | |
queueHooks += "~"; | |
} | |
} | |
} | |
return eventPath.push(type + queueHooks + "|#atc=" + node.atcValue + "#" + (node.mediaType !== "" ? "mt=" + node.mediaType + "#" : "")), eventPath; | |
}; | |
}; | |
b365.Ui.Betslip.CastBetItemsBuilder.prototype = { | |
/** | |
* @return {?} | |
*/ | |
betItems : function() { | |
/** @type {Array} */ | |
var eventPath = []; | |
/** @type {string} */ | |
var num = ""; | |
var n; | |
var date; | |
var d; | |
var j; | |
var exports; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < this._construct.length;i++) { | |
if (n = this._construct[i], num === "") { | |
switch(n.ttype) { | |
case this._bsInst.toteTypeUKTote: | |
num = this._bsInst.betTypeToteCast; | |
break; | |
case this._bsInst.toteTypeETote: | |
num = this._bsInst.betTypeEToteCast; | |
break; | |
case this._bsInst.toteTypeUSTote: | |
num = this._bsInst.betTypeUsToteCast; | |
break; | |
case this._bsInst.toteTypeForeignTote: | |
num = this._bsInst.toteTypeForeignTote; | |
break; | |
default: | |
num = this._bsInst.betTypeCast; | |
} | |
} | |
/** @type {string} */ | |
date = "pt=" + (num == this._bsInst.betTypeCast ? "C" : "T") + "B#spt=" + n.stype + (n.cmask == "P" ? "" : "#cm=" + n.cmask) + "#ct=" + n.ctype + (n.c2ID ? "#c2=" + n.c2ID : "#f=" + n.fixid) + (n.classificationId ? "#c=" + n.classificationId : ""); | |
switch(n.cmask) { | |
case "P": | |
d = this._getTotePotItemConstructs(date, n); | |
break; | |
default: | |
switch(n.stype) { | |
case "A": | |
; | |
case "O": | |
d = this._getAusCastItemConstructs(date, n); | |
break; | |
default: | |
d = this._getNoneTotePotItemConstructs(date, n); | |
} | |
; | |
} | |
/** @type {number} */ | |
j = 0; | |
for (;j < d.length;j++) { | |
exports = new b365.Ui.BetDTO(num); | |
exports.parse(d[j]); | |
eventPath.push(exports); | |
} | |
} | |
return eventPath; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {string} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ToteBetItemsBuilder = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** @type {string} */ | |
this._construct = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && typeof this._construct != "undefined"; | |
}; | |
/** | |
* @param {string} str | |
* @param {Element} cl | |
* @param {Array} packets | |
* @return {undefined} | |
*/ | |
this._addWinEwPlBet = function(str, cl, packets) { | |
var codeSegments; | |
var i; | |
str += "#f=" + cl.fixid; | |
str += cl.stype == "J" ? "#o=0/0" : ""; | |
str += cl.id ? "#id=" + cl.id : ""; | |
/** @type {boolean} */ | |
var name = cl.ctype == "E" || cl.ctype == "H"; | |
/** @type {string} */ | |
var index = name ? ":" : ","; | |
/** @type {string} */ | |
var ch = "#fp="; | |
if (name) { | |
/** @type {number} */ | |
i = 0; | |
for (;i < cl.valuelist[0].length;i++) { | |
packets.push(str + ch + cl.valuelist[0][i]); | |
} | |
} else { | |
codeSegments = cl.valuelist[0].slice(index); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
packets.push(str + ch + codeSegments[i]); | |
} | |
} | |
}; | |
/** | |
* @param {string} prefix | |
* @param {?} ele | |
* @param {Array} packets | |
* @param {(Object|string)} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
this._addPotBet = function(prefix, ele, packets, deepDataAndEvents) { | |
prefix += "#tmn=" + ele.totemn + "#tmi=" + ele.totemi + "#c2=" + ele.c2ID; | |
packets.push(prefix + this._getTotePotFp(ele) + (deepDataAndEvents == bs.betTypeTotePotAus ? "|#atc=" + ele.atcValue : "")); | |
}; | |
/** | |
* @param {?} ele | |
* @return {?} | |
*/ | |
this._getTotePotFp = function(ele) { | |
/** @type {string} */ | |
var id = "#fp="; | |
var j; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < ele.valuelist.length;i++) { | |
/** @type {number} */ | |
j = 0; | |
for (;j < ele.valuelist[i].length;j++) { | |
id += ele.valuelist[i][j] + "-"; | |
} | |
if (id.endsWith("-")) { | |
/** @type {string} */ | |
id = id.substring(0, id.lastIndexOf("-")); | |
} | |
id += ","; | |
} | |
return id.endsWith(",") && (id = id.substring(0, id.lastIndexOf(","))), id; | |
}; | |
/** | |
* @param {?} ele | |
* @return {?} | |
*/ | |
this._getTotePotFp = function(ele) { | |
/** @type {string} */ | |
var id = "#fp="; | |
var j; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < ele.valuelist.length;i++) { | |
/** @type {number} */ | |
j = 0; | |
for (;j < ele.valuelist[i].length;j++) { | |
id += ele.valuelist[i][j] + "-"; | |
} | |
if (id.endsWith("-")) { | |
/** @type {string} */ | |
id = id.substring(0, id.lastIndexOf("-")); | |
} | |
id += ","; | |
} | |
return id.endsWith(",") && (id = id.substring(0, id.lastIndexOf(","))), id; | |
}; | |
}; | |
b365.Ui.Betslip.ToteBetItemsBuilder.prototype = { | |
/** | |
* @param {string} deepDataAndEvents | |
* @return {?} | |
*/ | |
betItems : function(deepDataAndEvents) { | |
/** @type {Array} */ | |
var tokenList = []; | |
var conditionIndex; | |
var cl; | |
var prefix; | |
var packets; | |
var i; | |
var parser; | |
if (this._isValid()) { | |
/** @type {number} */ | |
conditionIndex = 0; | |
for (;conditionIndex < this._construct.length;conditionIndex++) { | |
cl = this._construct[conditionIndex]; | |
if (cl.stype != "T") { | |
if (cl.stype != "E") { | |
if (cl.ctype == "E") { | |
/** @type {string} */ | |
cl.ctype = "H"; | |
} | |
} | |
} | |
/** @type {string} */ | |
prefix = "pt=TB#spt=" + cl.stype + "#cm=" + cl.cmask; | |
/** @type {Array} */ | |
packets = []; | |
switch(cl.cmask) { | |
case "D": | |
prefix += "#ct=" + cl.ctype; | |
this._addWinEwPlBet(prefix, cl, packets); | |
break; | |
default: | |
this._addPotBet(prefix, cl, packets, deepDataAndEvents); | |
} | |
/** @type {number} */ | |
i = 0; | |
for (;i < packets.length;i++) { | |
parser = new b365.Ui.BetDTO(deepDataAndEvents); | |
parser.parse(packets[i]); | |
tokenList.push(parser); | |
} | |
} | |
} | |
return tokenList; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.DefaultSlipTypeSetter = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.DefaultSlipTypeSetter.prototype = { | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
setSlipType : function(dataAndEvents) { | |
if (this._isValid()) { | |
var expectedOutput = this._bsInst.slipStandard; | |
switch(dataAndEvents) { | |
case this._bsInst.betTypeToteCast: | |
; | |
case this._bsInst.betTypeToteNonCast: | |
; | |
case this._bsInst.betTypeTotePot: | |
expectedOutput = this._bsInst.slipUKTote; | |
break; | |
case this._bsInst.betTypeUsToteCast: | |
; | |
case this._bsInst.betTypeUsToteNonCast: | |
; | |
case this._bsInst.betTypeUsTotePot: | |
expectedOutput = this._bsInst.slipUSTote; | |
break; | |
case this._bsInst.betTypeEToteCast: | |
; | |
case this._bsInst.betTypeEToteNonCast: | |
; | |
case this._bsInst.betTypeETotePot: | |
expectedOutput = this._bsInst.slipETote; | |
} | |
this._bsInst.setValueInBSCookie("bt", expectedOutput); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.DuplicateItemValidator = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.DuplicateItemValidator.prototype = { | |
/** | |
* @param {Event} fs | |
* @return {?} | |
*/ | |
isDuplicate : function(fs) { | |
/** @type {boolean} */ | |
var inp = false; | |
var i; | |
if (this._isValid()) { | |
var codeSegments = this._bsInst.getBetItems(fs.type); | |
var nsp = fs.getCnItem("pt"); | |
/** | |
* @param {Event} fs | |
* @param {?} self | |
* @return {?} | |
*/ | |
var init = function(fs, self) { | |
return fs.getCnItem("spt") === self.getCnItem("spt") && (fs.getCnItem("cm") === self.getCnItem("cm") && (fs.getCnItem("ct") === self.getCnItem("ct") && (fs.getCnItem("f") === self.getCnItem("f") && fs.getCnItem("fp") === self.getCnItem("fp")))); | |
}; | |
/** @type {number} */ | |
i = 0; | |
for (;!inp && i < codeSegments.length;i++) { | |
switch(nsp) { | |
case "S": | |
/** @type {boolean} */ | |
inp = codeSegments[i].getCnItem("pid") === fs.getCnItem("pid") && codeSegments[i].getCnItem("mid") === fs.getCnItem("mid"); | |
break; | |
case "CB": | |
inp = init(fs, codeSegments[i]); | |
break; | |
case "TB": | |
switch(fs.type) { | |
case bs.betTypeToteCast: | |
; | |
case bs.betTypeUsToteCast: | |
; | |
case bs.betTypeEToteCast: | |
; | |
case bs.betTypeToteNonCast: | |
; | |
case bs.betTypeUsToteNonCast: | |
; | |
case bs.betTypeEToteNonCast: | |
inp = init(fs, codeSegments[i]); | |
} | |
break; | |
default: | |
if (codeSegments[i].getCnItem("fp") === fs.getCnItem("fp")) { | |
if (codeSegments[i].getCnItem("f") == fs.getCnItem("f")) { | |
/** @type {boolean} */ | |
inp = codeSegments[i].getCnItem("Inc") == fs.getCnItem("Inc") ? true : false; | |
} | |
} | |
; | |
} | |
} | |
} | |
return inp; | |
} | |
}, function() { | |
var timer; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.InProgressDisplayHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @param {string} content | |
* @return {undefined} | |
*/ | |
this._setText = function(content) { | |
$("#bsDiv #pro>ul>li .progressMsg").html(content); | |
}; | |
}; | |
b365.Ui.Betslip.InProgressDisplayHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var mode = recurring[0]; | |
var pdataCur = recurring[1]; | |
var restoreScript = recurring.length > 3 ? recurring[3] : "alert"; | |
var $li; | |
var context; | |
var code; | |
var gotError; | |
var pane; | |
if (this._isValid()) { | |
if (code = recurring[2], mode == "show") { | |
/** @type {boolean} */ | |
gotError = code == this._bsInst.reqTypeBetBrk; | |
if (code == this._bsInst.reqTypeReferBet || code == this._bsInst.reqTypePollReferredBet) { | |
this._setText(betSlipML.processingbet + "<br/><br/>" + betSlipML.additionalstakereferred); | |
} else { | |
if (code == this._bsInst.reqTypePollTempBetReceipt) { | |
this._setText(betSlipML.processingbet); | |
} | |
} | |
if (timer) { | |
clearTimeout(timer); | |
} | |
/** @type {number} */ | |
timer = setTimeout(Function.createDelegate(this, function() { | |
var $target; | |
var self = $("#bsDiv"); | |
self.find(".bs-Alert").addClass("hidden"); | |
if (gotError) { | |
this._bsInst.isSiteOverlaySpinnerShowing = this._bsController.showSiteOverlaySpinner(); | |
} else { | |
self.find("#pro").removeClass("hidden"); | |
if (!self.hasClass("receipt")) { | |
self.find(".bs-Footer, .bs-ConfirmationFooter").addClass("hidden"); | |
} | |
} | |
this._bsController.clientActionInProgress(true); | |
if (this._bsController) { | |
if (this._bsController.clientEnhancedMode()) { | |
if (!self.find("li").hasClass("disabledBetSlip")) { | |
$target = $('li[class$="multiple-section multipleBets"], li[data-item-type$="single"], li[data-item-type$="cast"], li[data-item-type$="tote-single"], li[data-item-type$="tote-cast"], li[data-item-type$="tote-pot"], li[data-item-type$="tote-pot-leg"]', "#bsDiv"); | |
this._bsController._enhancedBetSlipAnimations.disableBetSlip($target, self); | |
} | |
} | |
} | |
this._bsInst.contentChangedOnClient(); | |
}), 1E3); | |
(new b365.Ui.Betslip.EnhancedElementsLockUnlockHandler(this._bsInst, this._bsController)).lock(); | |
} else { | |
if (timer && clearTimeout(timer), this._bsInst.isSiteOverlaySpinnerShowing && (this._bsInst.isSiteOverlaySpinnerShowing = !this._bsController.hideSiteOverlaySpinner()), context = $("#bsDiv"), $("#bsDiv #pro").addClass("hidden"), context.hasClass("receipt") || context.find(".bs-Footer").removeClass("hidden"), this._bsController.clientActionInProgress(false), pdataCur) { | |
if (restoreScript === "alert") { | |
var type = betSlipML.ok ? betSlipML.ok : "OK"; | |
/** @type {string} */ | |
var a = '<div class="bs-Alert_ErrOkButton">' + type + "</div>"; | |
var $html = $(".betSlip"); | |
$html.addClass("bs-Alert_ErrMsgContainer"); | |
$html.html('<div class="bs-Alert_Msg bs-Alert_ErrorMsg" >' + pdataCur + a + "</div>"); | |
} else { | |
this._bsController.getMessageDisplayHandler().showMsg(pdataCur, restoreScript); | |
} | |
pane = this._bsController.GetCurrentDialogRef(); | |
if (pane) { | |
pane.hideDialog(); | |
} | |
} | |
if (this._bsController) { | |
if (this._bsController.clientEnhancedMode()) { | |
if ($("li", context).hasClass("disabledBetSlip")) { | |
$li = $('li[class$="multiple-section multipleBets"], li[data-item-type$="single"], li[data-item-type$="cast"], li[data-item-type$="tote-single"], li[data-item-type$="tote-cast"], li[data-item-type$="tote-pot"], li[data-item-type$="tote-pot-leg"]', context); | |
this._bsController._enhancedBetSlipAnimations.enableBetSlip($li, context); | |
} | |
} | |
} | |
(new b365.Ui.Betslip.EnhancedElementsLockUnlockHandler(this._bsInst, this._bsController)).unlock(); | |
} | |
this._bsInst.contentChangedOnClient(); | |
} | |
} | |
}; | |
}(), function() { | |
Type.registerNamespace("b365.Ui.Betslip"); | |
var error; | |
var node; | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} webglController | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ConfirmationDialog = function(dataAndEvents, webglController) { | |
scope = this; | |
this._bsInst = dataAndEvents; | |
this._controller = webglController; | |
/** @type {string} */ | |
this._closeAction = "close"; | |
/** @type {string} */ | |
this._referAction = "refer"; | |
/** @type {string} */ | |
this._splitAction = "split"; | |
/** @type {string} */ | |
this._clearAndAddAction = "clearAndAdd"; | |
/** @type {string} */ | |
this._quickBetCancel = "cancelquickbet"; | |
/** @type {string} */ | |
this._quickBetActivate = "activatequickbet"; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._clearDialogAndConstruct = function() { | |
/** @type {null} */ | |
error = null; | |
this._controller.ClearCurrentDialogRef(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._handleClearAndAdd = function() { | |
$("#closeButton").removeClass("disabled"); | |
$("#okButton").removeClass("disabled"); | |
var recurring = error; | |
this.hideDialog(); | |
this._clearDialogAndConstruct(); | |
(new b365.Ui.Betslip.AddBetHandler(this._bsInst, this._controller)).handle(recurring, true, node); | |
this._controller.refreshBetslip(true); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._handleRefer = function() { | |
(new b365.Ui.Betslip.ReferBetRequestDespatcher(this._bsInst, this._controller)).despatch(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._handleSplitBet = function() { | |
this._bsInst.req(this._bsInst.reqTypeSplitBet, "", "", this._bsController); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._handleQuickBetCancel = function() { | |
this._controller._quickBet.setSwitchAndState(false); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._handleQuickBetActivate = function() { | |
this._bsInst.clearBets(true); | |
this._controller.itemsRemoved(); | |
this._controller._quickBet.setSwitchAndState(true); | |
}; | |
}; | |
b365.Ui.Betslip.ConfirmationDialog.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
handleCancel : function() { | |
$("#closeButton").removeClass("disabled"); | |
$("#okButton").removeClass("disabled"); | |
scope.hideDialog(); | |
scope._clearDialogAndConstruct(); | |
}, | |
/** | |
* @param {string} err | |
* @param {?} event | |
* @return {undefined} | |
*/ | |
showIncompatibleSelectionsDialog : function(err, event) { | |
var r20 = this; | |
/** @type {boolean} */ | |
var grunt = false; | |
if (typeof err != "undefined") { | |
if (err) { | |
/** @type {string} */ | |
error = err; | |
node = event; | |
if (err.indexOf("pom") > -1) { | |
/** @type {boolean} */ | |
grunt = true; | |
} else { | |
items = this._bsInst.getBetItems(); | |
/** @type {boolean} */ | |
grunt = items.length > 0 && items[0].getStItem("pom") == "Y"; | |
} | |
r20._controller.showSiteConfirmation(r20, "", grunt ? betSlipML.incompatiblectcselectionsclear : betSlipML.incompatibleselectionsclear, grunt ? betSlipML.ok : betSlipML.cont, this._clearAndAddAction, betSlipML.cancel, this._closeAction, "incompDialogue", true); | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
showQuickBetActivationDialog : function() { | |
var r20 = this; | |
r20._controller.showSiteConfirmation(r20, betSlipML.qbtitle, betSlipML.qbtext, betSlipML.qbbutton1text, this._quickBetCancel, betSlipML.qbbutton2text, this._quickBetActivate, "quickbet", true); | |
}, | |
/** | |
* @param {Object} ev | |
* @return {undefined} | |
*/ | |
handleClick : function(ev) { | |
var target = $(ev.target); | |
var act = target.attr("data-action"); | |
var e; | |
if (ev.preventDefault(), ev.stopPropagation(), !target.hasClass("disabled")) { | |
switch(act) { | |
case this._closeAction: | |
this.handleCancel(); | |
break; | |
case this._clearAndAddAction: | |
this._handleClearAndAdd(); | |
break; | |
case this._referAction: | |
$("#closeButton").addClass("disabled"); | |
e = $("#okButton"); | |
e.addClass("disabled"); | |
/** @type {string} */ | |
e[0].innerHTML = window.betSlipML.referringBet + '<span class="bs-DialogButton_Spinner"></span>'; | |
this._handleRefer(); | |
break; | |
case this._splitAction: | |
$("#closeButton").addClass("disabled"); | |
e = $("#okButton"); | |
e.addClass("disabled"); | |
/** @type {string} */ | |
e[0].innerHTML = window.betSlipML.processing + '<span class="bs-DialogButton_Spinner"></span>'; | |
this._handleSplitBet(); | |
break; | |
case this._quickBetCancel: | |
this._handleQuickBetCancel(); | |
break; | |
case this._quickBetActivate: | |
this._handleQuickBetActivate(); | |
} | |
} | |
}, | |
/** | |
* @param {string} dialogName | |
* @return {undefined} | |
*/ | |
setDialog : function(dialogName) { | |
this._controller.SetCurrentDialogRef(dialogName); | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ConfirmationDialog.prototype.hideDialog = function() { | |
if (this._controller._dlg) { | |
this._controller._dlg.hideDialog(); | |
} | |
}; | |
}(), function() { | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {string} webglController | |
* @param {string} deepDataAndEvents | |
* @param {?} ignoreMethodDoesntExist | |
* @param {string} textAlt | |
* @param {?} keepData | |
* @param {?} opt_attributes | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.PushBetDialog = function(dataAndEvents, webglController, deepDataAndEvents, ignoreMethodDoesntExist, textAlt, keepData, opt_attributes) { | |
this._bsInst = dataAndEvents; | |
/** @type {string} */ | |
this._controller = webglController; | |
/** @type {string} */ | |
this._construct = deepDataAndEvents; | |
this._pushStatus = ignoreMethodDoesntExist; | |
/** @type {string} */ | |
this._betItemId = textAlt; | |
this._betItemType = keepData; | |
this._fixtureParticipantId = opt_attributes; | |
/** @type {string} */ | |
this._proceedAction = "ipProceed"; | |
/** @type {string} */ | |
this._cancelAction = "ipCancel"; | |
/** | |
* @return {undefined} | |
*/ | |
this._clearDialogAndConstruct = function() { | |
/** @type {null} */ | |
this._construct = null; | |
this._controller.ClearCurrentDialogRef(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._handleCancel = function() { | |
if (this._betItemId) { | |
if (this._betItemType) { | |
(new b365.Ui.Betslip.ItemDeleteExecutor(this._bsInst, this._controller, this._betItemId, "single")).execute(); | |
} | |
} | |
this._clearDialogAndConstruct(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._handleProceed = function() { | |
this._controller.highlightSelectedBets(); | |
this._controller.pushBetPopupAcceptedHandler(this._fixtureParticipantId); | |
this._clearDialogAndConstruct(); | |
}; | |
}; | |
b365.Ui.Betslip.PushBetDialog.prototype = { | |
/** | |
* @param {Object} ev | |
* @return {undefined} | |
*/ | |
handleClick : function(ev) { | |
var target = $(ev.target); | |
var act = target.attr("data-action"); | |
if (ev.preventDefault(), ev.stopPropagation(), !target.hasClass("disabled")) { | |
switch(act) { | |
case this._cancelAction: | |
this._handleCancel(); | |
break; | |
case this._proceedAction: | |
this._handleProceed(); | |
} | |
} | |
}, | |
/** | |
* @param {string} dialogName | |
* @return {undefined} | |
*/ | |
setDialog : function(dialogName) { | |
this._controller.SetCurrentDialogRef(dialogName); | |
} | |
}; | |
}(); | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.BetMaxRequestDespatcher = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {string} */ | |
this._maxBetKeySingles = "N"; | |
/** @type {string} */ | |
this._maxBetKeyCasts = "C"; | |
/** @type {string} */ | |
this._maxBetKeyMultiples = "M"; | |
/** @type {string} */ | |
this._maxBetItemTypeSingle = "1"; | |
/** @type {string} */ | |
this._maxBetItemTypeCast = "50"; | |
/** | |
* @param {(Object|string)} value | |
* @return {?} | |
*/ | |
this._getKey = function(value) { | |
return value == this._bsInst.itemTypeSingle ? this._maxBetKeySingles : value == this._bsInst.itemTypeCast ? this._maxBetKeyCasts : this._maxBetKeyMultiples; | |
}; | |
/** | |
* @param {(Object|string)} id | |
* @param {Object} recurring | |
* @return {?} | |
*/ | |
this._getMaxBetItemType = function(id, recurring) { | |
return id == this._bsInst.itemTypeSingle ? this._maxBetItemTypeSingle : id == this._bsInst.itemTypeCast ? this._maxBetItemTypeCast : this._bsInst.getBetItemById(this._bsInst.itemTypeMultiple, recurring).getCnItem("id"); | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @param {(Object|string)} dataAndEvents | |
* @return {?} | |
*/ | |
this._getMaxBetType = function(dataAndEvents) { | |
return dataAndEvents == this._bsInst.itemTypeSingle ? this._bsInst.betTypeNormal : dataAndEvents == this._bsInst.itemTypeCast ? this._bsInst.betTypeCast : this._bsInst.betTypeMultiple; | |
}; | |
}; | |
b365.Ui.Betslip.BetMaxRequestDespatcher.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
despatch : function(recurring) { | |
if (this._isValid()) { | |
if (this._bsController._delegates.isAuthenticated()) { | |
var itemIndexAndType = new b365.Ui.Betslip.ItemInformation(recurring); | |
var _getMaxBetItemType = itemIndexAndType.itemIndexAndType(); | |
this._bsInst.req(this._bsInst.reqTypeMaxBet, "key=" + this._getKey(_getMaxBetItemType[1]) + "-" + _getMaxBetItemType[0] + "-" + this._getMaxBetItemType(_getMaxBetItemType[1], _getMaxBetItemType[0]) + "-" + this._getMaxBetType(_getMaxBetItemType[1])); | |
} else { | |
this._bsController.getMessageDisplayHandler().showMsg(betSlipML.pleaselogin); | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.IfBetActionChangeHandler = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.IfBetActionChangeHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @return {undefined} | |
*/ | |
handle : function(recurring, opt_isDefault) { | |
var console; | |
var i; | |
if (recurring > 0) { | |
console = this._bsInst.getBetItemById(this._bsInst.betTypeNormal, recurring); | |
console.setStItem("ac", opt_isDefault.value); | |
} else { | |
var codeSegments = this._bsInst.getBetItems(this._bsInst.betTypeNormal); | |
var $element = $("#bsDiv .ifbetaction"); | |
var _tmp = $(opt_isDefault).find("option:selected").text(); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
codeSegments[i].setStItem("ac", opt_isDefault.value); | |
/** @type {number} */ | |
$element[i].selectedIndex = opt_isDefault.value == $element[i].options[0].value ? 0 : 1; | |
$($element[i]).parent(".betslip-select").attr("data-text", _tmp); | |
} | |
} | |
this._bsInst.updateState(); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.BankerToggleRequestDespatcher = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.BankerToggleRequestDespatcher.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
despatch : function(recurring) { | |
var container = recurring.target; | |
var walker; | |
var getBetItemById; | |
var mid; | |
if (this._isValid()) { | |
if (container.tagName.toLowerCase() == "div") { | |
walker = new b365.Ui.Betslip.ItemInformation(container); | |
getBetItemById = walker.itemIndexAndType(); | |
mid = this._bsInst.getBetItemById(this._bsInst.betTypeNormal, getBetItemById[0]); | |
mid.setStItem("bk", $(container).hasClass("bs-BankerIndicator_Btn-selected") || $(container.parentElement).hasClass("bs-BankerIndicator_Btn-selected") ? "0" : "1"); | |
/** @type {boolean} */ | |
this._bsInst.toggledBankerSelectionState = true; | |
this._bsInst.updateState(); | |
this._bsInst.refresh(this._bsInst.betTypeAll); | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.OddsChangeHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {number} */ | |
this._serverErrorReqType = 99; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.OddsChangeHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @return {undefined} | |
*/ | |
handle : function(recurring, opt_isDefault) { | |
if (this._isValid()) { | |
var self = recurring.target; | |
var dojo = this._bsInst.getBetItemById(this._bsInst.betTypeNormal, opt_isDefault); | |
if (self.value == "SP") { | |
dojo.setStItem("sp", "1"); | |
dojo.setStItem("tr", ""); | |
} else { | |
dojo.setStItem("sp", "0"); | |
} | |
$(self).parent(".betslip-select").attr("data-text", $(self).find("option:selected").text()); | |
this._bsInst.updateState(); | |
(new b365.Ui.Betslip.TotalsCalculator(this._bsInst, this._bsController)).calculate(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.OddsLineChangedHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
this._bsWrapper = $("#bsDiv"); | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @param {number} _value | |
* @return {undefined} | |
*/ | |
this._updateMultiplesOddsDisplay = function(_value) { | |
var Math = this; | |
var elem = document.getElementsByClassName("bs-MultipleBets_Odds")[0]; | |
var cur; | |
/** @type {string} */ | |
var value = ""; | |
var e; | |
var _; | |
if (elem) { | |
if (_value) { | |
e = Math._bsController.getUsersOddsType(); | |
/** @type {number} */ | |
value = _value; | |
switch(e) { | |
case 1: | |
/** @type {number} */ | |
cur = _value - 1; | |
cur = Math._roundDown(cur, 2); | |
/** @type {number} */ | |
cur = parseFloat(cur.toFixed(2)); | |
/** @type {string} */ | |
value = cur + "/1"; | |
break; | |
case 2: | |
value = Math._roundDown(_value, 2); | |
break; | |
case 3: | |
/** @type {number} */ | |
_ = _value - 1; | |
/** @type {string} */ | |
value = _ > 0.999999 ? "+" + String(_ * 100 + 0.5 | 0) : "-" + String(100 / _ + 0.5 | 0); | |
} | |
} | |
elem.textContent = value; | |
} | |
}; | |
/** | |
* @param {number} num | |
* @param {number} dec | |
* @return {?} | |
*/ | |
this._roundDown = function(num, dec) { | |
return dec = dec || 0, Math.floor(num * Math.pow(10, dec)) / Math.pow(10, dec); | |
}; | |
}; | |
b365.Ui.Betslip.OddsLineChangedHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var config = this; | |
var failure; | |
var name; | |
/** @type {boolean} */ | |
var matches = false; | |
var els; | |
var j; | |
var subLn; | |
var visible_image; | |
if (config._isValid()) { | |
var o = recurring || false; | |
var dirNames = config._bsInst.getBetItems(); | |
/** @type {string} */ | |
var fromIndex = "0"; | |
if (dirNames.length === 0) { | |
return; | |
} | |
if (!o) { | |
/** @type {NodeList} */ | |
els = document.getElementsByClassName("bs-Item"); | |
/** @type {number} */ | |
failure = 1; | |
/** @type {number} */ | |
j = 0; | |
subLn = dirNames.length; | |
for (;j < subLn;j++) { | |
name = dirNames[j]; | |
failure *= eval(name.getCnItem("o")) + 1.000000000001; | |
if (name.getStItem("sp") === "1") { | |
/** @type {boolean} */ | |
matches = true; | |
} | |
fromIndex = name.getStItem("olc"); | |
if (fromIndex) { | |
if (Number(fromIndex) > 0) { | |
/** @type {boolean} */ | |
o = true; | |
if (els[j]) { | |
if (els[j].className.indexOf("oddsChange") === -1) { | |
if (fromIndex != 2) { | |
els[j].className += " oddsChange"; | |
} | |
} | |
if (els[j].className.indexOf("hcapChange") === -1) { | |
if (fromIndex != 1) { | |
els[j].className += " hcapChange"; | |
} | |
} | |
} | |
} | |
} | |
} | |
config._updateMultiplesOddsDisplay(matches ? null : failure); | |
} | |
visible_image = $("#BetSlipDialogueAddToBetslip"); | |
if (o) { | |
$(".acceptChanges", this._bsWrapper).removeClass("hidden"); | |
$("a.placeBet", this._bsWrapper).addClass("hidden"); | |
$("a", visible_image).addClass("disabled").attr("data-nav", ""); | |
this._bsController.getMessageDisplayHandler().showMsg(betSlipML.oddsChanged); | |
} else { | |
$(".acceptChanges", this._bsWrapper).addClass("hidden"); | |
$("a", visible_image).removeClass("disabled").attr("data-nav", "AddToBetSlip"); | |
$("a.placeBet", this._bsWrapper).removeClass("hidden"); | |
this._bsController.getMessageDisplayHandler().hideMsg(); | |
} | |
this._bsInst.changeBetslipHeight(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.UpdateStateHandler = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.UpdateStateHandler.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
handle : function() { | |
if (this._isValid()) { | |
this._bsInst.setValueInBSCookie("ns", $bto.serialize(this._bsInst.getBetItems(this._bsInst.betTypeNormal))); | |
this._bsInst.setValueInBSCookie("ms", $bto.serialize(this._bsInst.getBetItems(this._bsInst.betTypeMultiple))); | |
this._bsInst.setValueInBSCookie("cs", $bto.serialize(this._bsInst.getBetItems(this._bsInst.betTypeCast))); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.RestoreStateHandler = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.RestoreStateHandler.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
handle : function() { | |
if (this._isValid()) { | |
this._bsInst.setBetItems($bto.parseCookieString(this._bsInst.getValueFromBSCookie("ns", ""), this._bsInst.betTypeNormal), this._bsInst.betTypeNormal); | |
this._bsInst.setBetItems($bto.parseCookieString(this._bsInst.getValueFromBSCookie("ms", ""), this._bsInst.betTypeMultiple), this._bsInst.betTypeMultiple); | |
this._bsInst.setBetItems($bto.parseCookieString(this._bsInst.getValueFromBSCookie("cs", ""), this._bsInst.betTypeCast), this._bsInst.betTypeCast); | |
this._bsInst.betSlipItemsChanged(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.PlaceBetErrorHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.PlaceBetErrorHandler.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
handle : function() { | |
if (this._isValid()) { | |
$(".emptyBetslip").hide(); | |
$(".placeBet").hide(); | |
this._bsInst.betslipError(); | |
(new b365.Ui.Betslip.ViewResetter(this._bsInst, this._bsController)).reset(); | |
this._bsInst.addReceiptHeaderLinks(); | |
(new b365.Ui.Betslip.FooterLinksSlipRender(this._bsInst, $(".bs-Footer"))).render(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.CastBreakdownRequestDespatcher = function(dataAndEvents, deepDataAndEvents) { | |
this._bsController = deepDataAndEvents; | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.CastBreakdownRequestDespatcher.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
despatch : function(recurring) { | |
if (this._isValid()) { | |
var deepDataAndEvents = (new b365.Ui.Betslip.BetBreakdownKeyGenerator(this._bsInst, this._bsInst.getBetItemById(this._bsInst.itemTypeCast, recurring), this._bsInst.itemTypeCast, recurring)).generate(); | |
this._bsController.showBetslipBreakdownDialog(deepDataAndEvents); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.AusToteToolTipHtmlBuilder = function() { | |
}; | |
b365.Ui.Betslip.AusToteToolTipHtmlBuilder.prototype = { | |
/** | |
* @param {string} el | |
* @return {?} | |
*/ | |
getHtml : function(el) { | |
return "<span>" + el + "</span>"; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.SingleToolTipHtmlBuilder = function() { | |
/** @type {string} */ | |
this._alwaysInclude = "*~"; | |
}; | |
b365.Ui.Betslip.SingleToolTipHtmlBuilder.prototype = { | |
/** | |
* @param {Object} el | |
* @param {Array} match | |
* @return {?} | |
*/ | |
getHtml : function(el, match) { | |
var r = el.find("input[data-inp-type='ewcb']").length > 0 || match.length >= 3 && match[2].startsWith(this._alwaysInclude); | |
var charset; | |
var result; | |
return r && (match[2] = match[2].replace(this._alwaysInclude, "")), charset = el.hasClass("hdCap"), result = "<label class='ttHead'>" + match[0] + "</label><br />", result += match[1] && match[1].length > 0 ? "<label>" + match[1] + "</label><br />" : "", result += "<label>", result += $("#bsDiv .betReceipt").length == 0 && el.children("div.pitcher").length > 0 ? el.find("div.pitcher").find(".pitcher-sel")[0].options[0].selected ? match[3] : "(" + el.find("div.pitcher .pitcher-sel>option:selected").text() + | |
")" : match[3] && match[3].length > 0 ? match[3] : "", result += (charset ? " " + el.find(".hdCapDisplay").text() : "") + "</label><br/>", match.length == 5 && (match[4] != "" && (result += "<label>" + match[4] + "</label><br />")), r && (result += match[2]), result; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ToteSingleToolTipHtmlBuilder = function() { | |
}; | |
b365.Ui.Betslip.ToteSingleToolTipHtmlBuilder.prototype = { | |
/** | |
* @param {Array} headers | |
* @return {?} | |
*/ | |
getHtml : function(headers) { | |
/** @type {string} */ | |
var optsData = ""; | |
var tagName; | |
return headers.length > 2 && (headers[2].length > 0 && (headers[2].indexOf("#") > -1 && (tagName = headers[i].split("#"), optsData += "<br /><label>" + tagName[0] + " (" + tagName[1] + ")</label>"))), optsData += "<br /><label>" + headers[3] + "</label>", "<label class='ttHead'>" + headers[0] + "</label><br /><label>" + headers[1] + "</label>" + optsData; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.UKToteBetStakeChangedHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {string} */ | |
this._stakeCookieKey = "st"; | |
/** @type {string} */ | |
this._eachWayCookieKey = "ew"; | |
/** @type {string} */ | |
this._betCountCookieKey = "bc"; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.UKToteBetStakeChangedHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var udataCur; | |
var value; | |
if (this._isValid()) { | |
var emptyJ = $(recurring); | |
var e = new b365.Ui.Betslip.ItemInformation(recurring); | |
var _bsInst = e.itemIndexAndType(); | |
var item = e.itemElement(); | |
if ($blib.isDecimal(recurring.value) == false) { | |
/** @type {string} */ | |
recurring.value = ""; | |
} | |
/** @type {boolean} */ | |
var w = recurring.getAttribute("data-no-convert") ? true : false; | |
var jQuery = new b365.Ui.Formatter; | |
/** @type {number} */ | |
var number = Number($("#bsDiv>ul:first-child").attr("data-xrte")); | |
if (number == 0 || w == true) { | |
/** @type {number} */ | |
number = 1; | |
} | |
/** @type {number} */ | |
var size = Math.pow(10, jQuery.numDecPlcs(number)); | |
var storage = this._bsInst.getBetItemById(_bsInst[1], _bsInst[0]); | |
var r = storage.getStItem(this._betCountCookieKey); | |
if (typeof r == "undefined") { | |
/** @type {number} */ | |
r = 1; | |
} | |
if (storage.getStItem(this._eachWayCookieKey) == "1") { | |
/** @type {number} */ | |
r = r * 2; | |
} | |
var val = jQuery.roundValue(this._bsController._currencyDisplayHelper.unformatCurrency(recurring.value)); | |
/** @type {number} */ | |
var operand = Math.pow(10, jQuery.numDecPlcs(val)); | |
var text = jQuery.roundDecimal(String(r * val)); | |
var group = $(".totestkbc", item); | |
var result = $(".bs-ToteStakeUsersCurrency", item); | |
if (group.length > 0 || result.length > 0) { | |
udataCur = number == 0 ? 0 : jQuery.roundDecimal(String(Number(val) * operand * number * size / size / operand)); | |
value = number == 0 ? 0 : jQuery.roundDecimal(String(udataCur * r)); | |
result.text(value == "0" ? "" : value); | |
storage.setStItem("st", this._bsController._currencyDisplayHelper.formatCurrency(udataCur)); | |
group.text(text == "0" ? "" : this._bsController._currencyDisplayHelper.formatCurrency(text)); | |
} else { | |
storage.setStItem("st", this._bsController._currencyDisplayHelper.formatCurrency(val)); | |
} | |
storage.setStItem("gust", val); | |
storage.setStItem("gst", val); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.USToteBetStakeChangedHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {string} */ | |
this._stakeCookieKey = "st"; | |
/** @type {string} */ | |
this._eachWayCookieKey = "ew"; | |
/** @type {string} */ | |
this._betCountCookieKey = "bc"; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.USToteBetStakeChangedHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var power; | |
var value; | |
var h; | |
var text; | |
if (this._isValid()) { | |
var emptyJ = $(recurring); | |
var e = new b365.Ui.Betslip.ItemInformation(recurring); | |
var _bsInst = e.itemIndexAndType(); | |
var rc1 = e.itemElement(); | |
if ($blib.isDecimal(recurring.value) == false) { | |
/** @type {string} */ | |
recurring.value = ""; | |
} | |
/** @type {boolean} */ | |
var units = recurring.getAttribute("data-no-convert") ? true : false; | |
var jQuery = new b365.Ui.Formatter; | |
/** @type {number} */ | |
var n = Number($("#bsDiv>ul:first-child").attr("data-xrte")); | |
if (n == 0 || units == true) { | |
/** @type {number} */ | |
n = 1; | |
} | |
/** @type {number} */ | |
power = Math.pow(10, jQuery.numDecPlcs(n)); | |
/** @type {number} */ | |
value = Number($("#bsDiv>ul:first-child").attr("data-xrte-us")); | |
if (value == 0 || units == true) { | |
/** @type {number} */ | |
value = 1; | |
} | |
/** @type {number} */ | |
var decimals = Math.pow(10, jQuery.numDecPlcs(value)); | |
var self = this._bsInst.getBetItemById(_bsInst[1], _bsInst[0]); | |
var i = self.getStItem(this._betCountCookieKey); | |
if (typeof i == "undefined") { | |
/** @type {number} */ | |
i = 1; | |
} | |
if (self.getStItem(this._eachWayCookieKey) == "1") { | |
/** @type {number} */ | |
i = i * 2; | |
} | |
var pdataOld = this._bsController._currencyDisplayHelper.unformatCurrency(recurring.value); | |
var g = jQuery.roundValue(pdataOld); | |
/** @type {number} */ | |
var multiplier = Math.pow(10, jQuery.numDecPlcs(g)); | |
var val = jQuery.roundDecimal(String(i * g)); | |
var fc_rules = $(".totestkbc", rc1); | |
var conn_rules = $(".bs-ToteStakeUsersCurrency", rc1); | |
if (fc_rules.length > 0 || conn_rules.length > 0) { | |
h = n == 0 ? 0 : jQuery.roundDecimal(String(Number(g) * multiplier * value * decimals / decimals / multiplier * n * power / power)); | |
text = n == 0 ? 0 : jQuery.roundDecimal(String(h * i)); | |
conn_rules.text(text == "0" ? "" : this._bsController._currencyDisplayHelper.formatCurrency(text)); | |
self.setStItem("st", h); | |
fc_rules.text(val == "0" ? "" : this._bsController._currencyDisplayHelper.formatCurrency(val)); | |
} else { | |
self.setStItem("st", g); | |
} | |
self.setStItem("gust", g); | |
self.setStItem("gst", g); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ToteStakeChangedHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.ToteStakeChangedHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
if (this._isValid()) { | |
switch(this._bsInst.getSlipType()) { | |
case this._bsInst.slipUKTote: | |
(new b365.Ui.Betslip.UKToteBetStakeChangedHandler(this._bsInst, this._bsController)).handle(recurring); | |
break; | |
case this._bsInst.slipUSTote: | |
(new b365.Ui.Betslip.USToteBetStakeChangedHandler(this._bsInst, this._bsController)).handle(recurring); | |
break; | |
default: | |
(new b365.Ui.Betslip.UKToteBetStakeChangedHandler(this._bsInst, this._bsController)).handle(recurring); | |
} | |
this._bsInst.updateState(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ToteCastToolTipHtmlBuilder = function() { | |
}; | |
b365.Ui.Betslip.ToteCastToolTipHtmlBuilder.prototype = { | |
/** | |
* @param {?} el | |
* @param {Array} code | |
* @return {?} | |
*/ | |
getHtml : function(el, code) { | |
return "<label class='ttHead'>" + code[0] + "</label><br /><label>" + code[1] + "</label><br/>" + $(el).closest(".bs-ToolTip").html(); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.TotePotToolTipHtmlBuilder = function() { | |
}; | |
b365.Ui.Betslip.TotePotToolTipHtmlBuilder.prototype = { | |
/** | |
* @param {Array} el | |
* @return {?} | |
*/ | |
getHtml : function(el) { | |
return "<label class='ttHead'>" + el[0] + "</label><br /><label>" + el[1] + "</label><br /><label>" + el[2] + "</label>"; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {(Object|boolean|number|string)} deepDataAndEvents | |
* @param {?} ignoreMethodDoesntExist | |
* @param {?} textAlt | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.TotePotLegDeleteExecutor = function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist, textAlt) { | |
this._bsInst = dataAndEvents; | |
this._legIndex = ignoreMethodDoesntExist; | |
this._legType = textAlt; | |
/** @type {(Object|boolean|number|string)} */ | |
this._legEle = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && (typeof this._legIndex != "undefined" && (typeof this._legType != "undefined" && typeof this._legEle != "undefined")); | |
}; | |
}; | |
b365.Ui.Betslip.TotePotLegDeleteExecutor.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
execute : function() { | |
var i; | |
var node; | |
var part; | |
var k; | |
if (this._isValid()) { | |
var _legEle = new b365.Ui.Betslip.ItemInformation(this._legEle); | |
var _bsInst = _legEle.itemIndexAndType(); | |
var path = this._bsInst.getBetItemById(_bsInst[1], _bsInst[0]); | |
var octets = this._legIndex.split(":"); | |
var parts = path.getCnItem("fp").split(","); | |
var elements = parts[octets[0] - 1].split("-"); | |
var count = elements.length; | |
/** @type {number} */ | |
var index = -1; | |
/** @type {number} */ | |
i = count - 1; | |
for (;index < 0;i--) { | |
/** @type {number} */ | |
index = elements[i].startsWith(octets[1]) ? i : -1; | |
} | |
elements.splice(index, 1); | |
/** @type {string} */ | |
node = ""; | |
/** @type {number} */ | |
i = 0; | |
for (;i < parts.length;i++) { | |
if (part = parts[i], i == octets[0] - 1) { | |
/** @type {string} */ | |
part = ""; | |
/** @type {number} */ | |
k = 0; | |
for (;k < elements.length;k++) { | |
part += (part.length > 0 ? "-" : "") + elements[k]; | |
} | |
} | |
node += (node.length > 0 ? "," : "") + part; | |
} | |
path.setCnItem("fp", node); | |
this._bsInst.updateState(); | |
this._bsInst.req(this._bsInst.reqTypeRefreshSlip); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {number} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ConfirmBetRequestDespatcher = function(dataAndEvents, deepDataAndEvents) { | |
/** @type {number} */ | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.ConfirmBetRequestDespatcher.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
despatch : function() { | |
if (this._isValid()) { | |
this._bsInst.req(this._bsInst.reqTypeConfirmBet); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.PitcherDetailsRequestDespatcher = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.PitcherDetailsRequestDespatcher.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
despatch : function(recurring) { | |
if (this._isValid()) { | |
var current = recurring.target; | |
var deepDataAndEvents = "key=B-" + current.href.split("_")[1]; | |
this._bsController.showPitcherDetails(deepDataAndEvents); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.CastToolTipHtmlBuilder = function() { | |
}; | |
b365.Ui.Betslip.CastToolTipHtmlBuilder.prototype = { | |
/** | |
* @param {?} el | |
* @param {Array} code | |
* @return {?} | |
*/ | |
getHtml : function(el, code) { | |
return "<label class='ttHead'>" + code[0] + "</label><br /><label>" + code[1] + "</label><br />" + $(el).find(".bs-tt").html(); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.TeaserChangeHandler = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** @type {string} */ | |
this._teaserItemCookieKey = "ti"; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.TeaserChangeHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
if (this._isValid()) { | |
var select = recurring.target; | |
if (select.selectedIndex > -1) { | |
this._bsInst.setValueInBSCookie("ti", select.options[select.selectedIndex].value); | |
this._bsInst.updateState(); | |
this._bsInst.refresh(this._bsInst.betTypeAll); | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.AusToteChangeHandler = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.AusToteChangeHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @param {boolean} dataAndEvents | |
* @return {undefined} | |
*/ | |
handle : function(recurring, opt_isDefault, dataAndEvents) { | |
if (this._isValid()) { | |
console.log(1); | |
var toggle = $(recurring.target); | |
var setStItem = this._bsInst.getBetItemById(dataAndEvents, opt_isDefault); | |
var option = $(toggle).find("option:selected"); | |
setStItem.setStItem("atc", option.val()); | |
$(toggle).parent(".betslip-select").attr("data-text", option.text()); | |
this._bsInst.updateState(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {string} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ForeignToteConstructCorrector = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** @type {string} */ | |
this._construct = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && typeof this._construct != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.ForeignToteConstructCorrector.prototype = { | |
/** | |
* @return {?} | |
*/ | |
GetCorrectedConstruct : function() { | |
if ($.isArray(this._construct)) { | |
/** @type {number} */ | |
var conditionIndex = 0; | |
for (;conditionIndex < this._construct.length;conditionIndex++) { | |
if (this._construct[conditionIndex].cmask == "1" || (this._construct[conditionIndex].cmask == "2" || (this._construct[conditionIndex].cmask == "3" || this._construct[conditionIndex].cmask == "4"))) { | |
/** @type {string} */ | |
this._construct[conditionIndex].ctype = "C"; | |
} | |
} | |
} | |
return this._construct; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.PollingExpiredHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.PollingExpiredHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
if (this._isValid() && (recurring[0] === this._bsInst.reqTypePollTempBetReceipt && $("#bsDiv").find("[id^=tempbetstatus_title_].pending").removeClass("pending").addClass("timedout"), this._bsInst.resetPoll(), (new b365.Ui.Betslip.LockUnlockHandler(this._bsInst, this._bsController)).handle(false, false), (new b365.Ui.Betslip.InProgressDisplayHandler(this._bsInst, this._bsController)).handle(["hide", betSlipML.pleasecheckmembers]), recurring[0] === this._bsInst.reqTypePollReferredBet)) { | |
var pane = this._bsController.GetCurrentDialogRef(); | |
if (pane) { | |
pane.hideDialog(); | |
} | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.PollBetRequestDespatcher = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.PollBetRequestDespatcher.prototype = { | |
/** | |
* @param {Array} recurring | |
* @return {undefined} | |
*/ | |
despatch : function(recurring) { | |
var ul; | |
var pending; | |
if (this._isValid()) { | |
/** @type {string} */ | |
pending = ""; | |
if (recurring[1]) { | |
if (recurring[1].length > 0) { | |
pending = "br=" + recurring[1]; | |
} | |
} | |
if (recurring.length > 2) { | |
if (recurring[2]) { | |
if (recurring[2].length > 0) { | |
if (pending.length > 0) { | |
pending += "&"; | |
} | |
pending += recurring[2]; | |
} | |
} | |
} | |
if (this._bsController.clientEnhancedMode()) { | |
ul = $("#bsDiv"); | |
if (ul.find("ul:first-child").hasClass("betReceipt")) { | |
ul.find("li").removeClass("disableBetSlip").removeClass("enableBetSlip").removeClass("disabledBetSlip"); | |
} | |
} | |
this._bsInst.req(recurring[0], pending, "", this._bsController); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {Object} _item | |
* @param {(Object|number|string)} deepDataAndEvents | |
* @param {?} ignoreMethodDoesntExist | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.BetBreakdownKeyGenerator = function(dataAndEvents, _item, deepDataAndEvents, ignoreMethodDoesntExist) { | |
this._bsInst = dataAndEvents; | |
/** @type {Object} */ | |
this._item = _item; | |
/** @type {(Object|number|string)} */ | |
this._itemType = deepDataAndEvents; | |
this._itemIndex = ignoreMethodDoesntExist; | |
/** @type {string} */ | |
this._betTypeIDCookieKey = "id"; | |
/** @type {string} */ | |
this._eachWayCookieKey = "ew"; | |
/** @type {string} */ | |
this._fixtureCookieKey = "f"; | |
/** @type {string} */ | |
this._fixtureParticipantCookieKey = "fp"; | |
/** @type {string} */ | |
this._stakeCookieKey = "st"; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && (typeof this._item != "undefined" && (typeof this._itemType != "undefined" && typeof this._itemIndex != "undefined")); | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._getStake = function() { | |
return this._item.getStItem(this._stakeCookieKey) === undefined ? "0" : String(parseInt(this._item.getStItem(this._stakeCookieKey) * 100)); | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._isEachWay = function() { | |
return this._item.getStItem(this._eachWayCookieKey) && this._item.getStItem(this._eachWayCookieKey) == "1" ? true : false; | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._getCastKey = function() { | |
return "key=C-" + (this._getStake(this._item) + "-" + String(Number(this._itemIndex) + 1) + "-0"); | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._getMultiplesKey = function() { | |
return "key=M-" + (this._getStake(this._item) + "-" + this._item.getCnItem(this._betTypeIDCookieKey) + "-" + (this._isEachWay() ? "1" : "0")); | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._getSingleKey = function() { | |
return "key=N-" + (this._getStake(this._item) + "-" + this._item.getCnItem(this._fixtureCookieKey) + "-" + this._item.getCnItem(this._fixtureParticipantCookieKey) + "-" + (this._isEachWay() ? "1" : "0")); | |
}; | |
}; | |
b365.Ui.Betslip.BetBreakdownKeyGenerator.prototype = { | |
/** | |
* @return {?} | |
*/ | |
generate : function() { | |
/** @type {null} */ | |
var code = null; | |
if (this._isValid()) { | |
switch(this._itemType) { | |
case this._bsInst.itemTypeMultiple: | |
code = this._getMultiplesKey(); | |
break; | |
case this._bsInst.itemTypeCast: | |
code = this._getCastKey(); | |
break; | |
default: | |
code = this._getSingleKey(); | |
} | |
} | |
return code; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.BetSlipPopUpMessageController = function(dataAndEvents) { | |
this._bsContext = dataAndEvents; | |
/** | |
* @return {undefined} | |
*/ | |
this._messageTimeout = function() { | |
window.clearTimeout(this._autoCloseTimer); | |
this.HideMessage(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._clearPopUpShowingClass = function() { | |
$(".showing-fade-popup").removeClass("showing-fade-popup"); | |
}; | |
this._eventTargetElement = $(".betSlipPopupHeader>a>span:first-child"); | |
$(document).on("bsInfoMessage", $.proxy(this.ShowMessage, this)); | |
$(document).on("HideBsInfoMessage", $.proxy(this.HideMessage, this)); | |
}; | |
b365.Ui.Betslip.BetSlipPopUpMessageController.prototype = { | |
/** | |
* @param {?} event | |
* @param {?} block | |
* @param {number} val | |
* @return {undefined} | |
*/ | |
ShowMessage : function(event, block, val) { | |
var self = this; | |
var elm; | |
var value; | |
var mh; | |
if (self._bsContext.IsPortraitMode() && (self._bsContext.IsPrematch() && !$("#bsDiv").is(":visible"))) { | |
self._eventTargetElement = typeof window.MyBetsController != "undefined" && window.MyBetsController.isInitialised() ? $("#myBetsHeader>ul>li:first-child") : $(".betSlipPopupHeader>a>span:first-child"); | |
elm = $("#ttDivFade"); | |
elm.removeClass("ttHidden"); | |
if (self._autoCloseTimer != -1) { | |
self._messageTimeout(); | |
} | |
self._clearPopUpShowingClass(); | |
self._eventTargetElement.addClass("showing-fade-popup"); | |
if (!val) { | |
/** @type {number} */ | |
val = 140; | |
} | |
if (!$.isNumeric(val)) { | |
/** @type {number} */ | |
val = parseInt(val.replace(/px/g, "").replace(/;/g, "")); | |
} | |
elm.find(".cnt").html(block).css("max-width", val).css("width", val); | |
/** @type {number} */ | |
var offset = 10; | |
var box = self._eventTargetElement.offset(); | |
var currentOffset = self._eventTargetElement.outerHeight(true); | |
if (currentOffset) { | |
offset = currentOffset; | |
} | |
value = box.top + offset + 4; | |
/** @type {number} */ | |
mh = box.left + self._eventTargetElement.outerWidth(true) / 2 - val / 2; | |
elm.css("top", value).css("left", mh).css("max-width", val + "px").css("width", val + "px"); | |
elm.fadeIn(); | |
/** @type {number} */ | |
this._autoCloseTimer = window.setTimeout(Function.createDelegate(self, self._messageTimeout), 3500); | |
} | |
event.stopPropagation(); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
HideMessage : function() { | |
this._clearPopUpShowingClass(); | |
$("#ttDivFade").fadeOut().addClass("ttHidden"); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.TaxCalculator = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** @type {number} */ | |
this._taxRates = 0; | |
/** @type {string} */ | |
this._taxCalculationMethod = ""; | |
/** @type {boolean} */ | |
this._isFreeBet = false; | |
var group = $("#bsDiv>ul").attr("data-txr"); | |
var oldValue = $("#bsDiv>ul").attr("data-tcm"); | |
if (typeof group != "undefined") { | |
this._taxRates = group; | |
} | |
if (typeof oldValue != "undefined") { | |
this._taxCalculationMethod = oldValue; | |
} | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.TaxCalculator.prototype = { | |
/** | |
* @param {number} i | |
* @param {number} first | |
* @param {number} value | |
* @return {?} | |
*/ | |
getstakeToTax : function(i, first, value) { | |
return first == -1 ? value - i : value <= first ? value - i : first - i; | |
}, | |
/** | |
* @param {number} arg | |
* @param {number} a | |
* @return {?} | |
*/ | |
parseTaxRateForStakeAndCalculateTotalReturns : function(arg, a) { | |
var argsBuilder = new b365.Ui.Formatter; | |
/** @type {number} */ | |
var i = 0; | |
/** @type {number} */ | |
var javascript = 0; | |
/** @type {number} */ | |
var from = 0; | |
var baseName = this._taxRates.toString(); | |
var codeSegments = baseName.split("#"); | |
/** @type {number} */ | |
var b = Number(argsBuilder.roundValue(String(arg))); | |
/** @type {number} */ | |
var udataCur = a * b; | |
/** @type {number} */ | |
var g = Number(0); | |
/** @type {number} */ | |
var ret = Number(0); | |
var guts; | |
var c; | |
var value; | |
var formula; | |
var x; | |
var delta; | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
guts = codeSegments[i].split(","); | |
if (guts.length > 4) { | |
/** @type {number} */ | |
c = Number(guts[0]); | |
/** @type {number} */ | |
value = Number(guts[1]); | |
/** @type {number} */ | |
formula = Number(guts[2]); | |
/** @type {number} */ | |
x = Number(guts[3]); | |
/** @type {number} */ | |
delta = Number(guts[4]); | |
if (udataCur > c) { | |
g = this.getstakeToTax(c, value, udataCur); | |
/** @type {number} */ | |
javascript = javascript + g * x; | |
} | |
} | |
} | |
if (!this._isFreeBet) { | |
javascript = javascript + arg; | |
} | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
guts = codeSegments[i].split(","); | |
if (guts.length > 4) { | |
/** @type {number} */ | |
c = Number(guts[0]); | |
/** @type {number} */ | |
value = Number(guts[1]); | |
/** @type {number} */ | |
formula = Number(guts[2]); | |
/** @type {number} */ | |
x = Number(guts[3]); | |
/** @type {number} */ | |
delta = Number(guts[4]); | |
if (javascript > c) { | |
ret = this.getstakeToTax(c, value, javascript); | |
/** @type {number} */ | |
from = from + ret * delta; | |
} | |
} | |
} | |
return from; | |
}, | |
/** | |
* @param {number} n | |
* @param {string} text | |
* @return {?} | |
*/ | |
calcReturnsByLine : function(n, text) { | |
/** @type {number} */ | |
n = isNaN(n) ? 0 : Number(n); | |
/** @type {number} */ | |
var x = 0; | |
var value; | |
var j; | |
try { | |
/** @type {*} */ | |
value = eval(text); | |
} catch (f) { | |
return 0; | |
} | |
return isNaN(value) ? 0 : (this._bsInst.useTruncated2dpPriceForReturnsCalc && (value = Math.floor(value * 100 + 1E-6) / 100), this._taxCalculationMethod == 2 ? (j = n * 100 % 100, j > 0 && (j = j / 100, x = this.parseTaxRateForStakeAndCalculateTotalReturns(j, value)), n = Math.floor(n), x = x + n * this.parseTaxRateForStakeAndCalculateTotalReturns(1, value)) : x = this.parseTaxRateForStakeAndCalculateTotalReturns(n, value), x = parseFloat(x.toPrecision(12)), this.floorTo2dp(x)); | |
}, | |
/** | |
* @param {(number|string)} data | |
* @return {?} | |
*/ | |
floorTo2dp : function(data) { | |
var str; | |
var end; | |
return str = data.toString(), end = str.indexOf("."), end > -1 ? str = str.substr(0, end + 3) : str += ".00", parseFloat(str).toFixed(2); | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipDelegates.prototype.isPortraitMode = function() { | |
var IsPortraitMode = this; | |
return IsPortraitMode._bsContext && IsPortraitMode._bsContext.IsPortraitMode ? IsPortraitMode._bsContext.IsPortraitMode() : false; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipDelegates.prototype.isPrematch = function() { | |
var IsPrematch = this; | |
return IsPrematch._bsContext && IsPrematch._bsContext.IsPrematch ? IsPrematch._bsContext.IsPrematch() : false; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipDelegates.prototype.isAuthenticated = function() { | |
var IsAuthenticated = this; | |
return IsAuthenticated._bsContext && IsAuthenticated._bsContext.IsAuthenticated ? IsAuthenticated._bsContext.IsAuthenticated() : false; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipDelegates.prototype.updateBalance = function() { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.UpdateBalance) { | |
_bsContext._bsContext.UpdateBalance(); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipDelegates.prototype.showOverlay = function() { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.ShowPleaseWaitSpinner) { | |
_bsContext._bsContext.ShowPleaseWaitSpinner(); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipDelegates.prototype.hideOverlay = function() { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.HidePleaseWaitSpinner) { | |
_bsContext._bsContext.HidePleaseWaitSpinner(); | |
} | |
} | |
}; | |
/** | |
* @param {?} el | |
* @return {undefined} | |
*/ | |
BetSlipDelegates.prototype.showTooltip = function(el) { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.ShowTooltip) { | |
_bsContext._bsContext.ShowTooltip(el); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipDelegates.prototype.hideTooltip = function() { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.HideTooltip) { | |
_bsContext._bsContext.HideTooltip(); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipDelegates.prototype.showLoginPage = function() { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.ShowLoginPage) { | |
_bsContext._bsContext.ShowLoginPage(); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipDelegates.prototype.toggleQuickBet = function() { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.ToggleQuickBet) { | |
_bsContext._bsContext.ToggleQuickBet(); | |
} | |
} | |
}; | |
/** | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
BetSlipDelegates.prototype.toggleQuickBetHelpTooltip = function(recurring) { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.ToggleQuickBetHelpTooltip) { | |
_bsContext._bsContext.ToggleQuickBetHelpTooltip(recurring); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipDelegates.prototype.removeQuickBetTooltip = function() { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.RemoveQuickBetTooltip) { | |
_bsContext._bsContext.RemoveQuickBetTooltip(); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
b365.Ui.Betslip.StakeEntryRules = function() { | |
/** | |
* @param {?} o | |
* @return {undefined} | |
*/ | |
function Type(o) { | |
this._bsController = o; | |
} | |
return Type.prototype.PushBetDisplayUpdate = function(b, dataAndEvents, dest) { | |
var $slide = $('#bsDiv li[data-item-id="' + b + '"]'); | |
var data_item_push = $slide.attr("data-item-push"); | |
var register = $blib.to2DP(dest.value); | |
var failuresLink = this._bsController._bsInst.getBetItems(dataAndEvents)[b]; | |
var jQuery = new b365.Ui.Betslip.TaxCalculator(this._bsController._bsInst); | |
var restoreScript = $blib.getItemOdds(dataAndEvents, failuresLink); | |
var fragment; | |
var component; | |
var script; | |
var val; | |
var d; | |
var res; | |
var buffer; | |
if (this._bsController.getPushMarketsEnabled()) { | |
if (data_item_push > 0) { | |
if (data_item_push < 5) { | |
component = $slide.children(".italy-push-text"); | |
if (register > 0) { | |
fragment = $blib.pad2DP(String(register / 2)); | |
script = component.find(".italy-push-stake"); | |
res = component.find(".italy-push-win-return"); | |
buffer = component.find(".italy-push-draw-return"); | |
script.text(fragment + " " + betSlipML.towin + " "); | |
val = $blib.pad2DP(String(jQuery.calcReturnsByLine(Number(fragment), restoreScript) * 2)); | |
d = $blib.pad2DP(String(jQuery.calcReturnsByLine(Number(fragment), "1/1"))); | |
res.text(this._bsController._currencyDisplayHelper.formatCurrency(val)); | |
buffer.text(this._bsController._currencyDisplayHelper.formatCurrency(d)); | |
component.removeClass("no-stake"); | |
} else { | |
component.addClass("no-stake"); | |
} | |
failuresLink.setCnItem("ipms", 1); | |
} | |
} | |
} | |
}, Type; | |
}(); | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.GetBetSlipMode = function() { | |
var ModeResolver = this; | |
return(new b365.Ui.Betslip.ModeResolver(ModeResolver._bsInst)).resolve(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.SetBetSlipTextBoxMinValues = function() { | |
this._setTextBoxesMinNumeric(); | |
}; | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.OnItemBetMax = function(recurring) { | |
(new b365.Ui.Betslip.BetMaxRequestDespatcher(this._bsInst, this)).despatch(recurring); | |
}; | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.OnItemStakeChanged = function(recurring) { | |
(new b365.Ui.Betslip.StakeChangedHandler(this._bsInst, this)).handle(recurring); | |
}; | |
/** | |
* @param {string} dialogName | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.SetCurrentDialogRef = function(dialogName) { | |
/** @type {string} */ | |
this._dlg = dialogName; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.GetCurrentDialogRef = function() { | |
return this._dlg; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.ClearCurrentDialogRef = function() { | |
/** @type {null} */ | |
this._dlg = null; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.CloseCurrentDialogClearRef = function() { | |
if (this._dlg !== null) { | |
try { | |
this._dlg.hideDialog(); | |
} catch (n) { | |
} | |
/** @type {null} */ | |
this._dlg = null; | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.OnBetslipContentLoaded = function() { | |
var me = this; | |
var elem; | |
var doc; | |
var codes; | |
(new b365.Ui.Betslip.RestoreStateHandler(me._bsInst)).handle(); | |
if (b365.Ui.Betslip.ToggleMultiples) { | |
(new b365.Ui.Betslip.ToggleMultiples(me._bsInst, me)).reset(); | |
} | |
elem = document.getElementsByClassName("bs-useBetCredit")[0]; | |
if (b365.Ui.Betslip.ToggleBetCredit) { | |
if (elem) { | |
if (elem.className.indexOf("hidden") == -1) { | |
(new b365.Ui.Betslip.ToggleBetCredit(me._bsInst, me)).reset(); | |
} | |
} | |
} | |
me._suspendSelections(); | |
if (typeof me._stakeEntryHander != "undefined") { | |
me._stakeEntryHander.init(); | |
} | |
doc = $("#bsDiv"); | |
$(".betslip-select select", doc).on("click change customselect", function() { | |
$(this).parent().attr("data-text", $(this).find(":selected").text()); | |
}).trigger("customselect"); | |
if (!me.clientUsesSelect()) { | |
if (me._enhancedBetSlipTypeSelector) { | |
me._enhancedBetSlipTypeSelector.enablePopUp(); | |
} else { | |
me._enhancedBetSlipTypeSelector = new b365.Ui.Betslip.EnhancedBetSlipTypeSelector(me); | |
} | |
if (me._enhancedBetSlipOddsSelector) { | |
me._enhancedBetSlipOddsSelector.enablePopUps(); | |
} else { | |
me._enhancedBetSlipOddsSelector = new b365.Ui.Betslip.EnhancedBetSlipOddsSelector(me); | |
} | |
if (me._enhancedBetSlipPitcherSelector) { | |
me._enhancedBetSlipPitcherSelector.enablePopUps(); | |
} else { | |
me._enhancedBetSlipPitcherSelector = new b365.Ui.Betslip.EnhancedBetSlipPitcherSelector(me); | |
} | |
if (me._enhancedBetSlipIfBetSelector) { | |
me._enhancedBetSlipIfBetSelector.enablePopUps(); | |
} else { | |
me._enhancedBetSlipIfBetSelector = new b365.Ui.Betslip.EnhancedBetSlipIfBetSelector(me); | |
} | |
if (me._enhancedBetSlipTeaserTypeSelector) { | |
me._enhancedBetSlipTeaserTypeSelector.enablePopUps(); | |
} else { | |
me._enhancedBetSlipTeaserTypeSelector = new b365.Ui.Betslip.EnhancedBetSlipTeaserTypeSelector(me); | |
} | |
} | |
if (!me._removeClickHandler) { | |
me._removeClickHandler = new b365.Ui.Betslip.RemoveClickHandler(me._bsInst, me); | |
} | |
if (!me._eachWayClickHandler) { | |
if (b365.Ui.Betslip.EachWayClickHandler) { | |
me._eachWayClickHandler = new b365.Ui.Betslip.EachWayClickHandler(me._bsInst, me); | |
} | |
} | |
if (!me._freeBetClickHandler) { | |
if (b365.Ui.Betslip.FreeBetClickHandler) { | |
me._freeBetClickHandler = new b365.Ui.Betslip.FreeBetClickHandler(me._bsInst, me); | |
} | |
} | |
if (!me._noReservesClickHandler) { | |
if (b365.Ui.Betslip.NoReservesClickHandler) { | |
me._noReservesClickHandler = new b365.Ui.Betslip.NoReservesClickHandler(me._bsInst, me); | |
} | |
} | |
if (!me._currencyDisplayHelper) { | |
me._currencyDisplayHelper = new b365.Ui.Betslip.CurrencyDisplayHelper(me, me.getCurrencyObject()); | |
} | |
if (!me._streamingClickHandler) { | |
if (b365.Ui.Betslip.StreamingClickHandler) { | |
me._streamingClickHandler = new b365.Ui.Betslip.StreamingClickHandler(me._bsInst, me); | |
} | |
} | |
if (!me._toteHoverHandler) { | |
if (b365.Ui.Betslip.ToteHoverHandler) { | |
me._toteHoverHandler = new b365.Ui.Betslip.ToteHoverHandler(me._bsInst, me); | |
} | |
} | |
if (!me._unitStakeClickHandler) { | |
if (b365.Ui.Betslip.UnitStakeClickHandler) { | |
me._unitStakeClickHandler = new b365.Ui.Betslip.UnitStakeClickHandler(me._bsInst, me); | |
} | |
} | |
if (!me._toteStakeClickHandler) { | |
if (b365.Ui.Betslip.ToteStakeClickHandler) { | |
me._toteStakeClickHandler = new b365.Ui.Betslip.ToteStakeClickHandler(me._bsInst, me); | |
} | |
} | |
if (!me._stakeFocusHandler) { | |
if (b365.Ui.Betslip.StakeFocusHandler) { | |
me._stakeFocusHandler = new b365.Ui.Betslip.StakeFocusHandler(me._bsInst, me); | |
} | |
} | |
if (!me.webPopupManager) { | |
if (b365.Ui.Betslip.WebPopupManager) { | |
me.webPopupManager = new b365.Ui.Betslip.WebPopupManager(me._bsInst, me); | |
} | |
} | |
if (this._isAustralianDomain) { | |
if (b365.Ui.Betslip.BetCallHandler) { | |
if (!me.betCallHandler) { | |
me.betCallHandler = new b365.Ui.Betslip.BetCallHandler(me._bsInst, me); | |
} | |
if (window.pushedConfig) { | |
if (window.pushedConfig.getIsBetCallAvailable) { | |
me.betCallHandler.init(); | |
} | |
} | |
me._bsInst.setClickToCallHandler(me.betCallHandler); | |
} | |
} | |
/** @type {NodeList} */ | |
codes = document.getElementsByClassName("bs-FreeBetCheckBox-selected"); | |
if (codes.length > 0) { | |
(new b365.Ui.Betslip.FreeBetClickProcessor(this._bsInst, this)).init(codes[0]).handle(true); | |
me._freeBetClickHandler.attachHandlers(); | |
} | |
me._bsContext.additionalResizeRequired(); | |
me.resizeHandler(); | |
me._delegates.updateBalance(); | |
doc.trigger("b365.Ui.Betslip.contentloaded"); | |
if (!me._quickBet) { | |
me._quickBet = new b365.Ui.Betslip.QuickBet(this._bsInst, me); | |
if (!me._quickBet.initialised) { | |
/** @type {null} */ | |
me._quickBet = null; | |
} | |
} | |
me.quickBetContext = { | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
navigationChanged : function(deepDataAndEvents) { | |
if (me._quickBet) { | |
if (me._quickBet.isQuickBetLoaded()) { | |
if (me._quickBet.navigationChanged) { | |
me._quickBet.navigationChanged(deepDataAndEvents); | |
} | |
} | |
} | |
}, | |
/** | |
* @return {?} | |
*/ | |
canHandleBets : function() { | |
/** @type {boolean} */ | |
var canHandleBets = false; | |
return me._quickBet && (me._quickBet.isQuickBetLoaded() && (me._quickBet.canHandleBets && (canHandleBets = me._quickBet.canHandleBets()))), canHandleBets; | |
} | |
}; | |
me._bsInst.betSlipLoaded(); | |
}; | |
/** | |
* @param {Object} task | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.initialiseWithParticipantInformation = function(task) { | |
var env = this; | |
/** @type {string} */ | |
var pending = ""; | |
pending += "participantid=" + (task.id ? task.id : "") + "&"; | |
pending += "pcode=" + (task.code ? task.code : "") + "&"; | |
pending += "ptype=" + (task.type ? task.type : "") + "&"; | |
pending += "odds=" + (task.odds ? task.odds : "") + "&"; | |
env.initialise(); | |
env._bsInst.req(env._bsInst.reqTypeConstructAndAddItems, pending); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.initialise = function() { | |
var handler = this; | |
var arg; | |
handler.initialiseStakeEntry(); | |
handler._bsInst.betSource = handler.betSource(); | |
handler._bsInst.showStreaming = handler.showStreaming(); | |
handler._bsInst.isV6Mode = handler._bsContext.IsV6Mode || function() { | |
return false; | |
}; | |
handler._bsInst.showFullTextMode = handler.showFullTextMode(); | |
handler._bsInst.showFixtureDate = handler.showFixtureDate(); | |
handler._bsInst.keyboardType = handler.getKeyboardType(); | |
handler._bsInst.refreshUserBalance = handler.getRefreshUserBalance(); | |
if (handler._isAustralianDomain) { | |
handler._isAusMultiplesAvailable = handler.getAusMultiplesAvailable(); | |
handler._pushConfigInitialisedDelegate = { | |
scope : this, | |
method : handler.pushConfigInitialised | |
}; | |
handler._ausMultiplesAvailabilityChangedDelegate = { | |
scope : this, | |
method : handler.ausMultiplesAvailabilityChanged | |
}; | |
if (window.pushedConfig.getArePropertiesInitialised()) { | |
handler._isAusMultiplesAvailable = window.pushedConfig.getIsAusMultiplesAvailable(); | |
window.pushedConfig.addEventListener(handler._ausMultiplesAvailabilityChangedEvent, handler._ausMultiplesAvailabilityChangedDelegate); | |
} else { | |
window.pushedConfig.addEventListener(handler._pushConfigInitialisedEvent, handler._pushConfigInitialisedDelegate); | |
} | |
} | |
arg = handler._bsInst.getValueFromBSCookie("processed").replace("||", ""); | |
if (arg == "true") { | |
(new b365.Ui.Betslip.ViewResetter(handler._bsInst, handler)).reset(); | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.initialiseStakeEntry = function() { | |
var that = this; | |
if (typeof that._stakeEntryHander != "undefined") { | |
that._stakeEntryHander.detach(); | |
} | |
if (that.clientEnhancedMode()) { | |
that._stakeEntryHander = new b365.Ui.Betslip.StakePadController("#bsDiv", that, that, function(dataAndEvents) { | |
return(new b365.Ui.Betslip.ItemInformation(dataAndEvents)).itemIndex()[0]; | |
}, that.OnItemStakeChanged, function(el) { | |
return $(el).prop("disabled") || $(el).parents().hasClass("suspended") ? false : true; | |
}, null, that.showStakePadToolTips()); | |
that._stakeEntryType = that._stakeEntryTypes.stakePad; | |
} else { | |
that._stakeEntryType = that._stakeEntryTypes.deviceKeyBoard; | |
that._stakeEntryHander = new b365.Ui.Betslip.StakeEntryKeyboard(that._bsInst, that); | |
} | |
}; | |
/** | |
* @param {Object} recurring | |
* @param {boolean} opt_isDefault | |
* @param {Object} node | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addBet = function(recurring, opt_isDefault, node) { | |
(new b365.Ui.Betslip.AddBetHandler(this._bsInst, this)).handle(recurring, opt_isDefault, node); | |
}; | |
/** | |
* @param {?} opt_e | |
* @return {?} | |
*/ | |
BetSlipController.prototype.betExists = function(opt_e) { | |
return $blib.getBetItemIndex(opt_e, this._bsInst) != -1; | |
}; | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.deleteBet = function(recurring) { | |
(new b365.Ui.Betslip.DeleteBetHandler(this._bsInst, this)).handle(recurring); | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.deleteCastBet = function(deepDataAndEvents) { | |
var employees = bs.getBetItems(bs.itemTypeCast); | |
var fp; | |
/** @type {number} */ | |
var i = 0; | |
var l = employees.length; | |
for (;l > i;i++) { | |
if (employees[i]) { | |
if (employees[i].getCnItem("fp")) { | |
fp = employees[i].getCnItem("fp"); | |
if (deepDataAndEvents === fp) { | |
(new b365.Ui.Betslip.ItemDeleteExecutor(bsApp.bsController._bsInst, bsApp.bsController, i, bs.itemTypeCast)).execute(); | |
} | |
} | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.placeBet = function() { | |
var env = this; | |
env._bsInst.req(env._bsInst.reqTypePlaceBet, undefined, undefined, this); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.removeBets = function() { | |
var RemoveAllItemsRequestDespatcher = this; | |
(new b365.Ui.Betslip.RemoveAllItemsRequestDespatcher(RemoveAllItemsRequestDespatcher._bsInst, RemoveAllItemsRequestDespatcher)).despatch(null); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.loadAddedItems = function() { | |
var env = this; | |
env._bsInst.req(env._bsInst.reqTypeAddItems); | |
}; | |
/** | |
* @param {boolean} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.refreshBetslip = function(deepDataAndEvents) { | |
var dataAndEvents = this; | |
var nextSibling = deepDataAndEvents ? dataAndEvents._bsInst.reqTypeAddItems : dataAndEvents._bsInst.reqTypeRefreshSlip; | |
dataAndEvents._bsInst.req(nextSibling, "", null, dataAndEvents); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.resizeHandler = function() { | |
var _bsContext = this; | |
/** @type {number} */ | |
var bottom = 330; | |
var loadingMoreUsers; | |
/** @type {string} */ | |
var className = " expanded"; | |
/** @type {boolean} */ | |
loadingMoreUsers = document.body.className.indexOf(className) > -1; | |
if (document.body.clientWidth > bottom && !loadingMoreUsers) { | |
document.body.className += className; | |
_bsContext._bsContext.repositionPopup(); | |
} else { | |
if (document.body.clientWidth <= bottom) { | |
if (loadingMoreUsers) { | |
/** @type {string} */ | |
document.body.className = document.body.className.replace(className, ""); | |
_bsContext._bsContext.repositionPopup(); | |
} | |
} | |
} | |
_bsContext._bsContext.resizeBetslip(); | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.initiatePhoneBetRequest = function(deepDataAndEvents) { | |
(new b365.Ui.Betslip.PhoneBetHandler(this._bsInst, this)).initiate(deepDataAndEvents); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.hideBetSlip = function() { | |
var _bsInst = this; | |
_bsInst._bsInst.hideBetSlip(); | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.setOddsType = function(deepDataAndEvents) { | |
var dataAndEvents = this; | |
dataAndEvents._bsInst.req(dataAndEvents._bsInst.reqTypeSetOddsType, "oty=" + deepDataAndEvents, null, dataAndEvents); | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.IsItalianDomain = function() { | |
return this._isItalianDomain; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.IsGreekDomain = function() { | |
return this._isGreekDomain; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.IsAustralianDomain = function() { | |
return this._isAustralianDomain; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.getPushMarketsEnabled = function() { | |
return this._pushMarketsEnabled; | |
}; | |
/** | |
* @param {boolean} dataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.setPushMarketsEnabled = function(dataAndEvents) { | |
/** @type {boolean} */ | |
this._pushMarketsEnabled = dataAndEvents; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.retainSelectionsDelegate = function() { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.RetainSelectionsDelegate) { | |
_bsContext._bsContext.RetainSelectionsDelegate(); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.clientLoginDelegate = function() { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.ClientLoginDelegate) { | |
_bsContext._bsContext.ClientLoginDelegate(); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.clientQuickBetLoginDelegate = function() { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.ClientQuickBetLoginDelegate) { | |
_bsContext._bsContext.ClientQuickBetLoginDelegate(); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.clientAddQuickBetToBetslip = function() { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.clientAddQuickBetToBetslip) { | |
_bsContext._bsContext.clientAddQuickBetToBetslip(); | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.clientContinueDelegate = function() { | |
var ClientContinueDelegate = this; | |
return ClientContinueDelegate._bsContext && ClientContinueDelegate._bsContext.ClientContinueDelegate ? (ClientContinueDelegate._bsContext.ClientContinueDelegate(), true) : false; | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {?} | |
*/ | |
BetSlipController.prototype.showBetslipBreakdownDialog = function(deepDataAndEvents) { | |
var ShowBetslipBreakdownDialog = this; | |
return ShowBetslipBreakdownDialog._bsContext && ShowBetslipBreakdownDialog._bsContext.ShowBetslipBreakdownDialog ? (ShowBetslipBreakdownDialog._bsContext.ShowBetslipBreakdownDialog(deepDataAndEvents), true) : false; | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {?} | |
*/ | |
BetSlipController.prototype.showPitcherDetails = function(deepDataAndEvents) { | |
var ShowPitcherDetails = this; | |
return ShowPitcherDetails._bsContext && ShowPitcherDetails._bsContext.ShowPitcherDetails ? (ShowPitcherDetails._bsContext.ShowPitcherDetails(deepDataAndEvents), true) : false; | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {?} | |
*/ | |
BetSlipController.prototype.updateCurrenyRate = function(deepDataAndEvents) { | |
var updateCurrenyRate = this; | |
return updateCurrenyRate._bsContext && updateCurrenyRate._bsContext.updateCurrenyRate ? (updateCurrenyRate._bsContext.updateCurrenyRate(deepDataAndEvents), true) : false; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.clearLiveAlerts = function() { | |
var ClearLiveAlerts = this; | |
return ClearLiveAlerts._bsContext && ClearLiveAlerts._bsContext.ClearLiveAlerts ? (ClearLiveAlerts._bsContext.ClearLiveAlerts(), true) : false; | |
}; | |
/** | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.clientActionInProgress = function(recurring) { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.ClientActionInProgress) { | |
_bsContext._bsContext.ClientActionInProgress(recurring); | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.getCurrencyObject = function() { | |
var GetCurrencyObject = this; | |
return GetCurrencyObject._bsContext && GetCurrencyObject._bsContext.GetCurrencyObject ? GetCurrencyObject._bsContext.GetCurrencyObject() : { | |
decimalSeparator : ".", | |
thousandsSeparator : "," | |
}; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.clientEnhancedMode = function() { | |
var ClientEnhancedMode = this; | |
return ClientEnhancedMode._bsContext && ClientEnhancedMode._bsContext.ClientEnhancedMode ? ClientEnhancedMode._bsContext.ClientEnhancedMode() : false; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.showStakePadToolTips = function() { | |
var ShowStakePadToolTips = this; | |
return ShowStakePadToolTips._bsContext && ShowStakePadToolTips._bsContext.ShowStakePadToolTips ? ShowStakePadToolTips._bsContext.ShowStakePadToolTips() : true; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.liveAlertsEnabled = function() { | |
var IsMatchAlertsEnabled = this; | |
return IsMatchAlertsEnabled._bsContext && IsMatchAlertsEnabled._bsContext.IsMatchAlertsEnabled ? IsMatchAlertsEnabled._bsContext.IsMatchAlertsEnabled() : false; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.betCallEnabled = function() { | |
var n = this; | |
return window.location.host.indexOf(".au") > -1 && (window.pushedConfig && (window.pushedConfig.getIsBetCallAvailable && window.pushedConfig.getIsBetCallAvailable())); | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.betCallTwilioEnabled = function() { | |
var BetCallTwilioSupported = this; | |
return window.location.host.indexOf(".au") > -1 && (window.pushedConfig && (window.pushedConfig.getIsBetCallTwilioAvailable && (window.pushedConfig.getIsBetCallTwilioAvailable() && (BetCallTwilioSupported._bsContext && BetCallTwilioSupported._bsContext.BetCallTwilioSupported)))) ? BetCallTwilioSupported._bsContext.BetCallTwilioSupported() : false; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.appVersion = function() { | |
var AppVersion = this; | |
return AppVersion._bsContext && AppVersion._bsContext.AppVersion ? AppVersion._bsContext.AppVersion() : ""; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.clientBetSlipShowing = function() { | |
var ClientBetSlipShowing = this; | |
return ClientBetSlipShowing._bsContext && ClientBetSlipShowing._bsContext.ClientBetSlipShowing ? ClientBetSlipShowing._bsContext.ClientBetSlipShowing() : false; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.clientUsesSelect = function() { | |
var ClientUsesSelect = this; | |
return ClientUsesSelect._bsContext && ClientUsesSelect._bsContext.ClientUsesSelect ? ClientUsesSelect._bsContext.ClientUsesSelect() : true; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.stakeEntryRule = function() { | |
var StakeEntryRule = this; | |
return StakeEntryRule._bsContext && StakeEntryRule._bsContext.StakeEntryRule ? StakeEntryRule._bsContext.StakeEntryRule() : null; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.joinNow = function() { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.JoinNow) { | |
_bsContext._bsContext.JoinNow(); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.membersHistory = function() { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.MembersHistory) { | |
_bsContext._bsContext.MembersHistory(); | |
} | |
} | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.betPlacementNotification = function(deepDataAndEvents) { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.BetPlacementNotification) { | |
_bsContext._bsContext.BetPlacementNotification(deepDataAndEvents); | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.useTruncated2dpPriceForReturnsCalc = function() { | |
var UseTruncated2dpPriceForReturnsCalc = this; | |
return UseTruncated2dpPriceForReturnsCalc._bsContext && UseTruncated2dpPriceForReturnsCalc._bsContext.UseTruncated2dpPriceForReturnsCalc ? UseTruncated2dpPriceForReturnsCalc._bsContext.UseTruncated2dpPriceForReturnsCalc() : false; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.isReqOnBetAddedEnabled = function() { | |
var IsReqOnBetAddedEnabled = this; | |
return IsReqOnBetAddedEnabled._bsContext && IsReqOnBetAddedEnabled._bsContext.IsReqOnBetAddedEnabled ? IsReqOnBetAddedEnabled._bsContext.IsReqOnBetAddedEnabled() : true; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.isReqOnBetDeletedEnabled = function() { | |
var IsReqOnBetDeletedEnabled = this; | |
return IsReqOnBetDeletedEnabled._bsContext && IsReqOnBetDeletedEnabled._bsContext.IsReqOnBetDeletedEnabled ? IsReqOnBetDeletedEnabled._bsContext.IsReqOnBetDeletedEnabled() : true; | |
}; | |
/** | |
* @param {?} messageObj | |
* @param {string} title | |
* @param {Function} value | |
* @param {?} obj | |
* @param {?} el | |
* @param {?} regex | |
* @param {?} callback | |
* @param {string} i | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.showConfirmation = function(messageObj, title, value, obj, el, regex, callback, i, dataAndEvents) { | |
var recurring = { | |
Controller : messageObj, | |
Title : title, | |
/** @type {Function} */ | |
Msg : value, | |
Button1Text : obj, | |
Button1Action : el, | |
Button2Text : regex, | |
Button2Action : callback, | |
additionalClass : i | |
}; | |
var _bsContext; | |
if (dataAndEvents) { | |
/** @type {boolean} */ | |
recurring.OutofContextDialogue = true; | |
} | |
_bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.ShowConfirmation) { | |
_bsContext._bsContext.ShowConfirmation(this._bsInst, recurring); | |
} | |
} | |
}; | |
/** | |
* @param {?} regex | |
* @param {string} childrenVarArgs | |
* @param {Function} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @param {?} ignoreMethodDoesntExist | |
* @param {?} textAlt | |
* @param {?} keepData | |
* @param {string} opt_attributes | |
* @param {boolean} signal_eof | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.showSiteConfirmation = function(regex, childrenVarArgs, dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist, textAlt, keepData, opt_attributes, signal_eof) { | |
var r20 = { | |
Controller : regex, | |
Title : childrenVarArgs, | |
/** @type {Function} */ | |
Msg : dataAndEvents, | |
Button1Text : deepDataAndEvents, | |
Button1Action : ignoreMethodDoesntExist, | |
Button2Text : textAlt, | |
Button2Action : keepData, | |
additionalClass : opt_attributes | |
}; | |
var _bsContext; | |
if (signal_eof) { | |
/** @type {boolean} */ | |
r20.OutofContextDialogue = true; | |
} | |
_bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.showSiteConfirmation) { | |
_bsContext._bsContext.showSiteConfirmation(r20); | |
} | |
} | |
}; | |
/** | |
* @param {?} regex | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @param {?} v11 | |
* @param {?} ignoreMethodDoesntExist | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.showPushbetDialog = function(regex, dataAndEvents, deepDataAndEvents, v11, ignoreMethodDoesntExist) { | |
var r20 = { | |
Controller : regex, | |
OkAction : dataAndEvents, | |
CancelAction : deepDataAndEvents, | |
PushBetId : v11, | |
FixtureParticipantId : ignoreMethodDoesntExist | |
}; | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.showPushbetDialog) { | |
_bsContext._bsContext.showPushbetDialog(r20); | |
} | |
} | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {?} | |
*/ | |
BetSlipController.prototype.getPushPopupStatus = function(deepDataAndEvents) { | |
var _bsContext = this; | |
/** @type {boolean} */ | |
var getPushPopupStatus = false; | |
return _bsContext._bsContext && (_bsContext._bsContext.getPushPopupStatus && (getPushPopupStatus = _bsContext._bsContext.getPushPopupStatus(deepDataAndEvents))), getPushPopupStatus; | |
}; | |
/** | |
* @param {string} obj | |
* @param {?} name | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.showDialog = function(obj, name, recurring) { | |
var r20 = { | |
Controller : obj, | |
MarkUp : name, | |
Modal : recurring | |
}; | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.ShowDialog) { | |
_bsContext._bsContext.ShowDialog(r20); | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.betSource = function() { | |
var BetSource = this; | |
return BetSource._bsContext && BetSource._bsContext.BetSource ? BetSource._bsContext.BetSource() : ""; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.showFullTextMode = function() { | |
var ShowFullTextMode = this; | |
return ShowFullTextMode._bsContext && ShowFullTextMode._bsContext.ShowFullTextMode ? ShowFullTextMode._bsContext.ShowFullTextMode() : false; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.showFixtureDate = function() { | |
var ShowFixtureDate = this; | |
return ShowFixtureDate._bsContext && ShowFixtureDate._bsContext.ShowFixtureDate ? ShowFixtureDate._bsContext.ShowFixtureDate() : false; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.showStreaming = function() { | |
var ShowStreaming = this; | |
return ShowStreaming._bsContext && ShowStreaming._bsContext.ShowStreaming ? ShowStreaming._bsContext.ShowStreaming() : false; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.getRefreshUserBalance = function() { | |
var RefreshUserBalance = this; | |
return RefreshUserBalance._bsContext && RefreshUserBalance._bsContext.RefreshUserBalance ? RefreshUserBalance._bsContext.RefreshUserBalance() : true; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.getKeyboardType = function() { | |
var KeyboardType = this; | |
return KeyboardType._bsContext && KeyboardType._bsContext.KeyboardType ? KeyboardType._bsContext.KeyboardType() : ""; | |
}; | |
/** | |
* @param {string} localAction | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.itemsRemoved = function(localAction, dataAndEvents) { | |
var pdataCur = { | |
Id : localAction ? localAction : null, | |
CheckSuspended : dataAndEvents ? dataAndEvents : null | |
}; | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.ItemsRemoved) { | |
_bsContext._bsContext.ItemsRemoved(pdataCur); | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.pushBetRulesLink = function() { | |
var PushBetRulesUrl = this; | |
return PushBetRulesUrl._bsContext && PushBetRulesUrl._bsContext.PushBetRulesUrl ? PushBetRulesUrl._bsContext.PushBetRulesUrl() : ""; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.highlightSelectedBets = function() { | |
var HighlightSelectedBets = this; | |
return HighlightSelectedBets._bsContext && HighlightSelectedBets._bsContext.HighlightSelectedBets ? HighlightSelectedBets._bsContext.HighlightSelectedBets() : ""; | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {?} | |
*/ | |
BetSlipController.prototype.pushBetPopupAcceptedHandler = function(deepDataAndEvents) { | |
var _bsContext = this; | |
return _bsContext._bsContext && (_bsContext._bsContext.PushBetPopupAcceptedHandler && _bsContext._bsContext.PushBetPopupAcceptedHandler(deepDataAndEvents)), ""; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.showEnableMicrophoneMessage = function() { | |
var suiteView = new b365.Ui.Betslip.PermissionsDialog(this); | |
this.showDialog(suiteView, suiteView.buildMarkup(), false); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnBetSlipLoaded = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnBetSlipLoaded(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnBetAdded = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnBetAdded(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnBetAddedReqComplete = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnBetAddedReqComplete(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnEditBet = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnEditBet(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnRefreshReqComplete = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnRefreshReqComplete(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnBetSlipItemsChanged = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnBetSlipItemsChanged(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnAcceptChanges = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnAcceptChanges(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnMaxSelections = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnMaxSelections(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnBetslipDisplayed = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnBetslipDisplayed(defs); | |
}; | |
/** | |
* @param {Function} expectation | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnPlaceBet = function(expectation) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnPlaceBet(expectation); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnPlaceBetSuccess = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnPlaceBetSuccess(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnAddBetslipFooterLinks = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnAddBetslipFooterLinks(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnAddReceiptHeaderLinks = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnAddReceiptHeaderLinks(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnAddReceiptLiveAlertSignUp = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnAddReceiptLiveAlertSignUp(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnBetslipError = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnBetslipError(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnShowBetSlip = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnShowBetSlip(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnHideBetSlip = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnHideBetSlip(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnChangeBetslipHeight = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnChangeBetslipHeight(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnPopupShow = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnPopupShow(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnPopupHide = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnPopupHide(defs); | |
}; | |
/** | |
* @param {Function} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnSessionExpired = function(deepDataAndEvents) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnSessionExpired(deepDataAndEvents); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnContentChangedOnClient = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnContentChangedOnClient(defs); | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.showSiteOverlaySpinner = function() { | |
var ShowSiteOverlaySpinner = this; | |
return ShowSiteOverlaySpinner._bsContext && ShowSiteOverlaySpinner._bsContext.ShowSiteOverlaySpinner ? (ShowSiteOverlaySpinner._bsContext.ShowSiteOverlaySpinner(), true) : false; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.hideSiteOverlaySpinner = function() { | |
var HideSiteOverlaySpinner = this; | |
return HideSiteOverlaySpinner._bsContext && HideSiteOverlaySpinner._bsContext.HideSiteOverlaySpinner ? (HideSiteOverlaySpinner._bsContext.HideSiteOverlaySpinner(), true) : false; | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @param {?} opt_obj2 | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.betSlipTypeChanged = function(deepDataAndEvents, opt_obj2) { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.BetSlipTypeChanged) { | |
_bsContext._bsContext.BetSlipTypeChanged(deepDataAndEvents, opt_obj2); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.betCallConnected = function() { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.betCallConnectedDelegate) { | |
_bsContext._bsContext.betCallConnectedDelegate(); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.betCallDisconnected = function() { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.betCallDisconnectedDelegate) { | |
_bsContext._bsContext.betCallDisconnectedDelegate(); | |
} | |
} | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnDeleteBetReqComplete = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnDeleteBetReqComplete(defs); | |
}; | |
/** | |
* @param {Function} defs | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.addOnAddBetFailed = function(defs) { | |
var _instanceEventAttacher = this; | |
_instanceEventAttacher._instanceEventAttacher.addOnAddBetFailed(defs); | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @param {?} triggerRoute | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.subscriptionHandler = function(deepDataAndEvents, triggerRoute) { | |
(new b365.Ui.Betslip.ItemSubscriptionManager(this._bsInst, this)).subscriptionHandler(deepDataAndEvents, triggerRoute); | |
}; | |
/** | |
* @param {?} regex | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.subscribeItem = function(regex) { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.subscribeItem) { | |
_bsContext._bsContext.subscribeItem(regex); | |
} | |
} | |
}; | |
/** | |
* @param {?} name | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.unsubscribeItem = function(name) { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.unsubscribeItem) { | |
_bsContext._bsContext.unsubscribeItem(name); | |
} | |
} | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @param {?} shallow | |
* @param {number} opt_attributes | |
* @return {?} | |
*/ | |
BetSlipController.prototype.getFormatedOdds = function(deepDataAndEvents, shallow, opt_attributes) { | |
var getFormatedOdds = this; | |
return getFormatedOdds._bsContext && getFormatedOdds._bsContext.getFormatedOdds ? getFormatedOdds._bsContext.getFormatedOdds(deepDataAndEvents, shallow, opt_attributes) : deepDataAndEvents; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.getUsersOddsType = function() { | |
var getUsersOddsType = this; | |
return getUsersOddsType._bsContext && getUsersOddsType._bsContext.getUsersOddsType ? getUsersOddsType._bsContext.getUsersOddsType() : 1; | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.setBetguid = function(deepDataAndEvents) { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.setBetguid) { | |
_bsContext._bsContext.setBetguid(deepDataAndEvents); | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.getBetguid = function() { | |
var getBetguid = this; | |
return getBetguid._bsContext && getBetguid._bsContext.getBetguid ? getBetguid._bsContext.getBetguid() : null; | |
}; | |
/** | |
* @param {string} val | |
* @return {?} | |
*/ | |
BetSlipController.prototype.stringToBoolean = function(val) { | |
return(val = val.toUpperCase(), val == "TRUE") ? true : (val == "FALSE", false); | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.getLanguageCode = function() { | |
/** @type {(Array.<string>|null)} */ | |
var intersections = document.cookie.match("aps03.*lng=(\\d*)&"); | |
var t; | |
if (intersections.length > 1) { | |
/** @type {string} */ | |
t = intersections[1]; | |
switch(t) { | |
case "1": | |
return "eng"; | |
case "2": | |
return "chi"; | |
case "3": | |
return "spa"; | |
case "4": | |
return "frc"; | |
case "5": | |
return "ger"; | |
case "6": | |
return "ita"; | |
case "7": | |
return "dan"; | |
case "8": | |
return "swe"; | |
case "9": | |
return "nor"; | |
case "10": | |
return "sim"; | |
case "14": | |
return "usa"; | |
case "19": | |
return "bul"; | |
case "20": | |
return "gre"; | |
case "21": | |
return "pol"; | |
case "22": | |
return "por"; | |
case "23": | |
return "rom"; | |
case "24": | |
return "cze"; | |
case "25": | |
return "hun"; | |
case "26": | |
return "svk"; | |
case "28": | |
return "ned"; | |
default: | |
return "eng"; | |
} | |
} else { | |
return "eng"; | |
} | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.setTelebetBetslip = function(deepDataAndEvents) { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.setTelebetBetslip) { | |
_bsContext._bsContext.setTelebetBetslip(deepDataAndEvents); | |
} | |
} | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.setMicrophoneAvailable = function(deepDataAndEvents) { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.setMicrophoneAvailable) { | |
_bsContext._bsContext.setMicrophoneAvailable(deepDataAndEvents); | |
} | |
} | |
if (_bsContext.betCallHandler) { | |
if (_bsContext.betCallHandler.microphoneAvailabilityChanged) { | |
_bsContext.betCallHandler.microphoneAvailabilityChanged(); | |
} | |
} | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.setQuickBetTooltipDismissed = function(deepDataAndEvents) { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.setQuickBetTooltipDismissed) { | |
_bsContext._bsContext.setQuickBetTooltipDismissed(deepDataAndEvents); | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.getQuickBetTooltipDismissed = function() { | |
var getQuickBetTooltipDismissed = this; | |
if (getQuickBetTooltipDismissed._bsContext && getQuickBetTooltipDismissed._bsContext.getQuickBetTooltipDismissed) { | |
return getQuickBetTooltipDismissed._bsContext.getQuickBetTooltipDismissed(); | |
} | |
}; | |
/** | |
* @param {?} recurring | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.setQuickBetEnabled = function(recurring) { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.setQuickBetEnabled) { | |
_bsContext._bsContext.setQuickBetEnabled(recurring); | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.getQuickBetEnabled = function() { | |
var getQuickBetEnabled = this; | |
if (getQuickBetEnabled._bsContext && getQuickBetEnabled._bsContext.getQuickBetEnabled) { | |
return getQuickBetEnabled._bsContext.getQuickBetEnabled(); | |
} | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.setAusMultiplesAvailable = function(deepDataAndEvents) { | |
var _bsContext = this; | |
if (_bsContext._bsContext) { | |
if (_bsContext._bsContext.setAusMultiplesAvailable) { | |
_bsContext._bsContext.setAusMultiplesAvailable(deepDataAndEvents); | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.getAusMultiplesAvailable = function() { | |
var getAusMultiplesAvailable = this; | |
if (getAusMultiplesAvailable._bsContext && getAusMultiplesAvailable._bsContext.getAusMultiplesAvailable) { | |
return getAusMultiplesAvailable._bsContext.getAusMultiplesAvailable(); | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.initialiseMicrophone = function() { | |
if (sProps.clickToCall.enabled) { | |
if (!this._microphoneController) { | |
this._microphoneController = new b365.Ui.Betslip.MicrophoneController(this._bsInst, this); | |
} | |
this._microphoneController.initMicrophoneChecks(); | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.refreshMicrophone = function() { | |
if (sProps.clickToCall.enabled) { | |
if (this._microphoneController) { | |
this._microphoneController.updateMicrophoneState(); | |
} | |
} | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.microphoneAvailable = function(deepDataAndEvents) { | |
if (sProps.clickToCall.enabled) { | |
if (this._microphoneController) { | |
this._microphoneController.updateMicrophoneAvailable(deepDataAndEvents); | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.getMessageDisplayHandler = function() { | |
return this._messageDisplayHandler ? this._messageDisplayHandler : (this._messageDisplayHandler = new b365.Ui.Betslip.MessageDisplayHandler(this._bsInst), this._messageDisplayHandler); | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.getMultipleItemsController = function() { | |
return this._multipleItemsController ? this._multipleItemsController : (this._multipleItemsController = new b365.Ui.Betslip.MultipleItemsController(this._bsInst, this), this._multipleItemsController); | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.isLocked = function() { | |
var els; | |
return this._bsInst.locked() ? true : (els = document.getElementsByClassName("bs-ConfirmationFooter"), els.length > 0 && els[0].className.indexOf("hidden") === -1) ? true : false; | |
}; | |
/** | |
* @param {boolean} dataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.getMultipleInfo = function(dataAndEvents) { | |
var cards = this; | |
var tabs; | |
if (cards.ausMultiplesEnabled()) { | |
/** @type {boolean} */ | |
cards.complexMultiplesProcessing = true; | |
tabs = cards._bsInst.getBetItems(cards._bsInst.betTypeMultiple); | |
if (tabs.length >= cards._multiplesCombinationLimit) { | |
this.getMultipleBetCounts(); | |
} else { | |
if (dataAndEvents) { | |
this.getMultipleCombinations(); | |
} else { | |
/** @type {boolean} */ | |
cards.complexMultiplesProcessing = false; | |
} | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.getMultipleCombinations = function() { | |
var complexMultiplesProcessing = this; | |
$.ajax({ | |
headers : { | |
"Content-Type" : "application/x-www-form-urlencoded", | |
"Cache-Control" : "no-cache", | |
Pragma : "no-cache" | |
}, | |
type : "GET", | |
url : "/betslip/Core/MultiplesCombinations.ashx", | |
cache : false | |
}).done(function(dataAndEvents) { | |
complexMultiplesProcessing.initialiseMultiplesData(dataAndEvents); | |
}).fail(function() { | |
/** @type {boolean} */ | |
complexMultiplesProcessing.complexMultiplesProcessing = false; | |
}); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.getMultipleBetCounts = function() { | |
var complexMultiplesProcessing = this; | |
$.ajax({ | |
headers : { | |
"Content-Type" : "application/x-www-form-urlencoded", | |
"Cache-Control" : "no-cache", | |
Pragma : "no-cache" | |
}, | |
type : "GET", | |
url : "/betslip/Core/MultiplesBetCounts.ashx", | |
cache : false | |
}).done(function(dataAndEvents) { | |
complexMultiplesProcessing.initialiseMultiplesData(dataAndEvents); | |
}).fail(function() { | |
/** @type {boolean} */ | |
complexMultiplesProcessing.complexMultiplesProcessing = false; | |
}); | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.hasMultipleStakeEntries = function() { | |
var _bsInst = this; | |
var codeSegments = _bsInst._bsInst.getBetItems(this._bsInst.betTypeMultiple); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (codeSegments[i].getStItem("st")) { | |
return true; | |
} | |
} | |
return false; | |
}; | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.initialiseMultiplesData = function(dataAndEvents) { | |
var complexMultiplesProcessing = this; | |
var conditionIndex; | |
var i; | |
var css; | |
var codeSegments; | |
var rulesets; | |
if (complexMultiplesProcessing.ausMultiplesEnabled() && (this.complexMultiplesInfo = [], dataAndEvents.multiples)) { | |
if (!this.totalsCalculator) { | |
this.totalsCalculator = new b365.Ui.Betslip.TotalsCalculator(this._bsInst, this); | |
} | |
this.complexMultiplesInfo = dataAndEvents.multiples; | |
/** @type {number} */ | |
conditionIndex = 0; | |
for (;conditionIndex < this.complexMultiplesInfo.length;conditionIndex++) { | |
if (css = [], this.complexMultiplesInfo[conditionIndex].D1) { | |
codeSegments = this.complexMultiplesInfo[conditionIndex].D1.split(","); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
rulesets = codeSegments[i].split("#"); | |
css.push(rulesets); | |
} | |
/** @type {Array} */ | |
this.complexMultiplesInfo[conditionIndex].combinations = css; | |
} else { | |
/** @type {null} */ | |
this.complexMultiplesInfo[conditionIndex].combinations = null; | |
} | |
} | |
/** @type {boolean} */ | |
complexMultiplesProcessing.complexMultiplesProcessing = false; | |
this.totalsCalculator.calculate(); | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.pushConfigInitialised = function() { | |
var handler = this; | |
window.pushedConfig.removeEventListener(handler._pushConfigInitialisedEvent, handler._pushConfigInitialisedDelegate); | |
window.pushedConfig.addEventListener(handler._ausMultiplesAvailabilityChangedEvent, handler._ausMultiplesAvailabilityChangedDelegate); | |
this.ausMultiplesAvailabilityChanged(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.ausMultiplesAvailabilityChanged = function() { | |
var _isAusMultiplesAvailable = this; | |
var deepDataAndEvents = _isAusMultiplesAvailable._isAustralianDomain && window.pushedConfig.getIsAusMultiplesAvailable(); | |
if (_isAusMultiplesAvailable._isAusMultiplesAvailable !== deepDataAndEvents) { | |
_isAusMultiplesAvailable.refreshBetslip(); | |
_isAusMultiplesAvailable.setAusMultiplesAvailable(deepDataAndEvents); | |
_isAusMultiplesAvailable._isAusMultiplesAvailable = deepDataAndEvents; | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
BetSlipController.prototype.ausMultiplesEnabled = function() { | |
var _isAusMultiplesAvailable = this; | |
return _isAusMultiplesAvailable._isAusMultiplesAvailable; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.updateMultiplesEachWayFlag = function() { | |
var ausMultiplesEnabled = this; | |
var i; | |
var o; | |
var n; | |
if (ausMultiplesEnabled.ausMultiplesEnabled()) { | |
/** @type {string} */ | |
var errStr = "ew"; | |
var resolveValues = this._bsInst.getBetItems(this._bsInst.betTypeMultiple); | |
var codeSegments = this._bsInst.getBetItems(this._bsInst.betTypeNormal); | |
if (codeSegments && (codeSegments.length > 0 && (resolveValues && resolveValues.length > 0))) { | |
var valuesLen = codeSegments.length; | |
var length = resolveValues.length; | |
/** @type {boolean} */ | |
var e = false; | |
/** @type {number} */ | |
i = 0; | |
for (;i < valuesLen;i++) { | |
if (o = codeSegments[i].getStItem(errStr), o == "1") { | |
/** @type {boolean} */ | |
e = true; | |
/** @type {number} */ | |
n = 0; | |
for (;n < length;n++) { | |
resolveValues[n].setStItem(errStr, "1"); | |
} | |
break; | |
} | |
} | |
if (!e) { | |
/** @type {number} */ | |
n = 0; | |
for (;n < length;n++) { | |
resolveValues[n].setStItem(errStr, "0"); | |
} | |
} | |
} | |
} | |
}; | |
/** | |
* @param {number} title | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.updateFreeBetBar = function(title) { | |
var target = document.getElementsByClassName("bs-useBetCredit")[0]; | |
var img = document.getElementsByClassName("br-Receipt")[0] || document.getElementsByClassName("bs-Confirm")[0]; | |
if (target) { | |
if (title > 0 && (window.pushedConfig.getIsFreeBetsAllowed(getBetslipWebModule().getUserCountryID()) && (this._bsInst.getBetItems(this._bsInst.betTypeAll).length > 0 && (!this._bsInst.containsPhoneOnlyBet() && this._bsInst.getSlipType() === this._bsInst.slipStandard)))) { | |
target.setAttribute("data-bb", title); | |
var parent = target.getElementsByClassName("bs-useBetCreditAmount")[0]; | |
var udataCur = (new b365.Ui.Formatter).padStringTo2DP(title); | |
var dummySpanText = (new b365.Ui.Betslip.CurrencyDisplayHelper(this, this.getCurrencyObject())).formatCurrency(udataCur); | |
parent.innerHTML = parent.innerHTML.replace("{0}", dummySpanText); | |
target.className = target.className.replace(" hidden", ""); | |
} else { | |
if (target.className.indexOf(" hidden") === -1) { | |
this._bsInst.setValueInBSCookie("fs", "0"); | |
/** @type {string} */ | |
target.className = target.className + " hidden"; | |
} | |
} | |
} else { | |
if (img) { | |
if (title > 0) { | |
if (this._bsInst.getBetItems(this._bsInst.betTypeAll).length > 0) { | |
img.setAttribute("data-bb", title); | |
} | |
} | |
} | |
} | |
}; | |
/** | |
* @param {Array} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.populateMatchAlerts = function(deepDataAndEvents) { | |
this._bsContext.populateMatchAlerts(deepDataAndEvents); | |
}; | |
/** | |
* @param {Array} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.setMatchAlertSubscriptionState = function(deepDataAndEvents) { | |
this._bsContext.setMatchAlertSubscriptionState(deepDataAndEvents); | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipController.prototype.setBetReceiptMatchAlertsState = function(deepDataAndEvents) { | |
this._bsInst._matchAlertsReceipt.setBetReceiptMatchAlertsState(deepDataAndEvents); | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.HeaderLinksReceiptRender = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
this._headerLinks = this._bsInst.headerLinks; | |
}; | |
b365.Ui.Betslip.HeaderLinksReceiptRender.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
render : function() { | |
var i; | |
var options; | |
var $button; | |
if (this._isValid && (this._headerLinks && this._headerLinks.length > 0)) { | |
/** @type {number} */ | |
i = 0; | |
for (;i < this._headerLinks.length;i++) { | |
options = this._headerLinks[i]; | |
$button = $("<span/>", { | |
"class" : options.cssClass, | |
html : options.text | |
}); | |
if (options.handler) { | |
$button.click(options.handler); | |
} | |
$button.appendTo(".br-Header_Links"); | |
} | |
} | |
/** @type {null} */ | |
this._bsInst.headerLinks = null; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.FooterLinksSlipRender = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
this._footerLinks = this._bsInst.headerLinks; | |
this._targetElem = deepDataAndEvents; | |
}; | |
b365.Ui.Betslip.FooterLinksSlipRender.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
render : function() { | |
var i; | |
var options; | |
var $button; | |
if (this._isValid && (this._footerLinks && this._footerLinks.length > 0)) { | |
/** @type {number} */ | |
i = 0; | |
for (;i < this._footerLinks.length;i++) { | |
options = this._footerLinks[i]; | |
$button = $("<a/>", { | |
"class" : options.cssClass, | |
html : options.text | |
}); | |
if (options.handler) { | |
$button.click(options.handler); | |
} | |
$button.appendTo(this._targetElem); | |
} | |
} | |
/** @type {null} */ | |
this._bsInst.footerLinks = null; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
b365.Ui.Betslip.MatchAlertsReceipt = function() { | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
function _this(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
} | |
return _this.prototype._bsInst = null, _this.prototype._matchAlertFixtures = [], _this.prototype._bsController = null, _this.prototype._numberOfFixtures = 0, _this.prototype._numberOfSubscriptions = 0, _this.prototype._matchAlertsContainer = null, _this.HEADER_LINK = "br-Header_MatchAlertsHeader-link", _this.HEADER_INNERTEXT = "br-Header_MatchAlertsHeader-innerText", _this.HEADER_BUTTON = "br-Header_MatchAlertsHeader-button", _this.HEADER_BUTTON_ACTIVE = "br-Header_MatchAlertsHeader-buttonActive", | |
_this.ROW_CONTAINER = "br-Header_MatchAlertsRowContainer", _this.ROW = "br-Header_MatchAlertsRowContainer-row", _this.ROW_BUTTON = "br-Header_MatchAlertsRow-button", _this.ROW_TEXT = "br-Header_MatchAlertsRow-text", _this.ROW_BUTTON_ACTIVE = "br-Header_MatchAlertsRow-buttonActive", _this.prototype.render = function() { | |
var that = this; | |
var dom; | |
var codeSegments; | |
var h; | |
var resolveValues; | |
var c; | |
var resultItems; | |
var i; | |
var meta; | |
var elm; | |
var copies; | |
if ((that._matchAlertFixtures = [], that._numberOfFixtures = 0, that._numberOfSubscriptions = 0, that._matchAlertsContainer = document.getElementById("brHeaderMatchAlerts"), that._matchAlertsContainer) && ((that._numberOfFixtures = parseInt(that._matchAlertsContainer.getAttribute("data-n"), 10), !(that._numberOfFixtures < 1)) && ((that._matchAlertsContainer.className = that._matchAlertsContainer.className.replace(" hidden", ""), dom = document.getElementsByClassName(_this.ROW_CONTAINER)[0], dom) && | |
(that._numberOfFixtures > 1 && (dom.className += " hidden"), codeSegments = document.getElementsByClassName(_this.HEADER_LINK), codeSegments && (codeSegments.length > 0 && (h = new b365.Ui.Betslip.ResponsiveClickHandler(codeSegments[0], that._ExpandClickHandler.bind(that), false))), resolveValues = document.getElementsByClassName(_this.HEADER_BUTTON), resolveValues && (resolveValues.length > 0 && (c = new b365.Ui.Betslip.ResponsiveClickHandler(resolveValues[0], that._HeaderClickHandler.bind(that), | |
false))), resultItems = dom.getElementsByClassName(_this.ROW), resultItems)))) { | |
/** @type {number} */ | |
i = 0; | |
for (;i < resultItems.length;i++) { | |
if (meta = resultItems[i], meta) { | |
elm = new b365.Ui.Betslip.ResponsiveClickHandler(meta, that._ItemClickHandler.bind(that, meta), false); | |
copies = {}; | |
copies.fixtureId = meta.getAttribute("data-fixtureid"); | |
copies.classificationId = meta.getAttribute("data-classification"); | |
copies.alertKey = meta.getAttribute("data-alertkey"); | |
copies.team1Id = meta.getAttribute("data-team1id"); | |
copies.team2Id = meta.getAttribute("data-team2id"); | |
/** @type {boolean} */ | |
copies.subscribed = false; | |
that._matchAlertFixtures.push(copies); | |
} | |
} | |
that._bsController.populateMatchAlerts(that._matchAlertFixtures); | |
} | |
}, _this.prototype.setBetReceiptMatchAlertsState = function(deepDataAndEvents) { | |
var element = this; | |
var context = document.getElementsByClassName(_this.ROW_CONTAINER)[0]; | |
var i; | |
var valsLength; | |
var a; | |
var b; | |
var activeClassName; | |
if (context) { | |
/** @type {number} */ | |
i = 0; | |
valsLength = deepDataAndEvents.length; | |
for (;i < valsLength;i++) { | |
if (a = context.querySelectorAll("div." + _this.ROW + "[data-fixtureid='" + deepDataAndEvents[i].fixtureId + "']")[0], b = element.getFixtureByFixtureId(deepDataAndEvents[i].fixtureId), a && b) { | |
activeClassName = a.getElementsByClassName(_this.ROW_BUTTON)[0]; | |
b.subscribed = deepDataAndEvents[i].subscribed; | |
element.toggleClass(activeClassName, _this.ROW_BUTTON_ACTIVE, b.subscribed); | |
if (b.subscribed) { | |
element._numberOfSubscriptions++; | |
} else { | |
element._numberOfSubscriptions--; | |
} | |
} | |
} | |
this._SetHeaderButtonState(); | |
} | |
}, _this.prototype._HeaderClickHandler = function() { | |
var dojo = this; | |
var node = document.getElementsByClassName(_this.HEADER_BUTTON)[0]; | |
var alt; | |
var context; | |
var codeSegments; | |
var i; | |
var valsLength; | |
var classes; | |
if (node && (alt = node.className.indexOf(_this.HEADER_BUTTON_ACTIVE) === -1, dojo.toggleClass(node, _this.HEADER_BUTTON_ACTIVE, alt), dojo.toggleAllFixtures(alt), context = document.getElementsByClassName(_this.ROW_CONTAINER)[0], context)) { | |
codeSegments = context.getElementsByClassName(_this.ROW); | |
/** @type {number} */ | |
i = 0; | |
valsLength = codeSegments.length; | |
for (;i < valsLength;i++) { | |
classes = codeSegments[i].getElementsByClassName(_this.ROW_BUTTON)[0]; | |
dojo.toggleClass(classes, _this.ROW_BUTTON_ACTIVE, alt); | |
} | |
} | |
}, _this.prototype._ExpandClickHandler = function() { | |
var activeClassName = document.getElementsByClassName(_this.ROW_CONTAINER)[0]; | |
this.toggleClass(activeClassName, "hidden"); | |
this._bsInst.changeBetslipHeight(); | |
}, _this.prototype._ItemClickHandler = function(dom) { | |
var dojo = this; | |
var classes = dom.getElementsByClassName(_this.ROW_BUTTON)[0]; | |
var field; | |
var value; | |
if (classes) { | |
/** @type {number} */ | |
field = parseInt(dom.getAttribute("data-fixtureid"), 10); | |
value = dojo.toggleFixtureSubscription(field, null); | |
dojo.toggleClass(classes, _this.ROW_BUTTON_ACTIVE, value); | |
dojo._SetHeaderButtonState(); | |
} | |
}, _this.prototype.toggleFixtureSubscription = function(data, err) { | |
var rbrace = this; | |
var status = rbrace.getFixtureByFixtureId(data); | |
var finalError; | |
return status ? (finalError = err != null ? err : !status.subscribed, status.subscribed = finalError, this._bsController.setMatchAlertSubscriptionState([status]), finalError ? rbrace._numberOfSubscriptions++ : rbrace._numberOfSubscriptions--, finalError) : false; | |
}, _this.prototype.toggleAllFixtures = function(alt) { | |
var selectElement = this; | |
/** @type {number} */ | |
var j = 0; | |
for (;j < selectElement._matchAlertFixtures.length;j++) { | |
/** @type {string} */ | |
selectElement._matchAlertFixtures[j].subscribed = alt; | |
} | |
this._bsController.setMatchAlertSubscriptionState(selectElement._matchAlertFixtures); | |
selectElement._numberOfSubscriptions = alt ? selectElement._numberOfFixtures : 0; | |
}, _this.prototype._SetHeaderButtonState = function() { | |
var element = this; | |
var activeClassName = document.getElementsByClassName(_this.HEADER_BUTTON)[0]; | |
element.toggleClass(activeClassName, _this.HEADER_BUTTON_ACTIVE, element._numberOfSubscriptions == element._numberOfFixtures); | |
}, _this.prototype.getFixtureByFixtureId = function(_xhr) { | |
var linestring = this; | |
/** @type {number} */ | |
var i = 0; | |
var valuesLen = linestring._matchAlertFixtures.length; | |
for (;i < valuesLen;i++) { | |
if (_xhr == linestring._matchAlertFixtures[i].fixtureId) { | |
return linestring._matchAlertFixtures[i]; | |
} | |
} | |
return null; | |
}, _this.prototype.toggleClass = function(element, name, options) { | |
if (element) { | |
var quoteNeeded = element.className.indexOf(name); | |
if (quoteNeeded === -1) { | |
if (options === true || options == null) { | |
element.className += " " + name; | |
} | |
} else { | |
if (options === false || options == null) { | |
element.className = element.className.replace(" " + name, ""); | |
} | |
} | |
} | |
}, _this; | |
}(); | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.DuplicateBetHandler = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.DuplicateBetHandler.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
handle : function() { | |
if (this._isValid()) { | |
(new b365.Ui.Betslip.ViewResetter(this._bsInst, this._bsController)).reset(); | |
(new b365.Ui.Betslip.InProgressDisplayHandler(this._bsInst, this._bsController)).handle(["hide", betSlipML.pleasecheckmembers]); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ViewResetter = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
this._bsWrapper = $("#bsDiv"); | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.ViewResetter.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
reset : function() { | |
if (this._isValid()) { | |
this._bsInst.clearBets(false); | |
(new b365.Ui.Betslip.UpdateStateHandler(this._bsInst)).handle(); | |
(new b365.Ui.Betslip.LockUnlockHandler(this._bsInst, this._bsController)).handle(false, false); | |
$(".emptyBetslip", this._bsWrapper).removeClass("hidden"); | |
$(".single-section, .multiple-section, .cast-section", this._bsWrapper).remove(); | |
$("a.placeBet", this._bsWrapper).disableElement("disabled"); | |
$("select.bet-slip-type", this._bsWrapper).disableElement(); | |
$("#BetSlipTypeSelector", this._bsWrapper).disableElement(); | |
$(".totals", this._bsWrapper).hide(); | |
$("#taxWarningHeader").addClass("hidden"); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} webglController | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.PhoneBetHandler = function(dataAndEvents, webglController) { | |
this._bsInst = dataAndEvents; | |
this._controller = webglController; | |
/** @type {null} */ | |
this._popup = null; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && typeof this._controller != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.PhoneBetHandler.prototype = { | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
initiate : function(deepDataAndEvents) { | |
if ($("#phoneBetOverlay").length == 0) { | |
this.addOverlay(); | |
this._bsInst.refresh(this._bsInst.reqTypePhoneBet, "cs=" + encodeURIComponent(deepDataAndEvents), this._controller); | |
} | |
}, | |
/** | |
* @param {string} _element | |
* @return {undefined} | |
*/ | |
displayPopup : function(_element) { | |
if (_element) { | |
this.addPopup(_element); | |
} | |
}, | |
/** | |
* @param {string} _element | |
* @return {undefined} | |
*/ | |
addPopup : function(_element) { | |
this._popup = $(_element); | |
this._popup.css({ | |
top : this.getPopupTopPosition() | |
}); | |
this.addPopupListeners(); | |
$("body").append(this._popup); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
addPopupListeners : function() { | |
$("#closeIcon", this._popup).on("click", $.proxy(function() { | |
this.removePopup(); | |
this.removeOverlay(); | |
}, this)); | |
$("#phoneBetOverlay").on("click", $.proxy(function() { | |
this.removePopup(); | |
this.removeOverlay(); | |
}, this)); | |
var layer = this; | |
$(window).off("resize.phonepopup").on("resize.phonepopup", function() { | |
layer._popup.css({ | |
top : layer.getPopupTopPosition(0) | |
}); | |
}); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
addOverlay : function() { | |
var $plum = $("<div/>", { | |
id : "phoneBetOverlay", | |
css : { | |
height : document.body.scrollHeight | |
} | |
}); | |
$("body").append($plum); | |
$("html").addClass("overlay-on"); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
removePopup : function() { | |
this._popup.remove(); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
removeOverlay : function() { | |
$("#phoneBetOverlay").remove(); | |
$("html").removeClass("overlay-on"); | |
}, | |
/** | |
* @param {number} val | |
* @return {?} | |
*/ | |
getPopupTopPosition : function(val) { | |
var iterator = typeof val != "undefined" ? val : $(window).scrollTop(); | |
return Math.round($(window).height() * 0.15) + iterator; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.MaintenanceMessageHandler = function() { | |
/** @type {null} */ | |
this._popup = null; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return true; | |
}; | |
}; | |
b365.Ui.Betslip.MaintenanceMessageHandler.prototype = { | |
/** | |
* @param {string} _element | |
* @return {undefined} | |
*/ | |
displayPopup : function(_element) { | |
if (_element) { | |
this.addOverlay(); | |
this.addPopup(_element); | |
} | |
}, | |
/** | |
* @param {string} _element | |
* @return {undefined} | |
*/ | |
addPopup : function(_element) { | |
/** @type {string} */ | |
var element = '<div class="popupContainer maintenanceMessage"><div class="popupHeader"></div><div class="popupText"><div>' + _element + '</div><div class="greenButton" id="okButton">OK</div></div></div>'; | |
this._popup = $(element); | |
this._popup.css({ | |
top : this.getPopupTopPosition() | |
}); | |
this.addPopupListeners(); | |
$("body").append(this._popup); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
addPopupListeners : function() { | |
$("#okButton", this._popup).on("click", $.proxy(function() { | |
this.removePopup(); | |
this.removeOverlay(); | |
}, this)); | |
var layer = this; | |
$(window).off("resize.maintenancepopup").on("resize.maintenancepopup", function() { | |
layer._popup.css({ | |
top : layer.getPopupTopPosition(0) | |
}); | |
}); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
addOverlay : function() { | |
var $plum = $("<div/>", { | |
id : "maintenanceMessageOverlay", | |
css : { | |
height : document.body.scrollHeight | |
} | |
}); | |
$("body").append($plum); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
removePopup : function() { | |
this._popup.remove(); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
removeOverlay : function() { | |
$("#maintenanceMessageOverlay").remove(); | |
}, | |
/** | |
* @param {number} val | |
* @return {?} | |
*/ | |
getPopupTopPosition : function(val) { | |
var iterator = typeof val != "undefined" ? val : $(window).scrollTop(); | |
return Math.round($(window).height() * 0.15) + iterator; | |
} | |
}, function() { | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemSubscriptionManager = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
this._bsWrapper = $("#bsDiv"); | |
this._items = {}; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && typeof this._bsController != "undefined"; | |
}; | |
}; | |
b365.Ui.Betslip.ItemSubscriptionManager.prototype = { | |
/** | |
* @param {?} c | |
* @return {undefined} | |
*/ | |
attach : function(c) { | |
this.subscribe(c); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
detach : function() { | |
if (this._isValid()) { | |
$('li[data-item-type="single"]', this._bsWrapper).each(function() { | |
var that = $(this).get(0); | |
var wrapper; | |
if (that) { | |
if (that.wrapper) { | |
wrapper = that.wrapper; | |
wrapper.detatchStem(); | |
this._bsController.unsubscribeItem(wrapper._topic); | |
} | |
} | |
}); | |
} | |
}, | |
/** | |
* @param {?} elem | |
* @return {undefined} | |
*/ | |
subscribe : function(elem) { | |
var codeSegments; | |
var i; | |
var branchDataJSON; | |
var r20; | |
var _ref3; | |
var from; | |
var $last; | |
var conditionIndex; | |
var parts; | |
var subLn; | |
var j; | |
if (this._isValid() && this._bsWrapper.find(".betReceipt").length <= 0) { | |
this._bsController = elem; | |
/** @type {NodeList} */ | |
codeSegments = document.getElementsByClassName("suspended"); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
b365.Ui.Betslip.ItemDisplay.itemSuspen(codeSegments[i]); | |
} | |
branchDataJSON = this._bsInst.getBetItems(this._bsInst.betTypeNormal); | |
/** @type {number} */ | |
conditionIndex = 0; | |
for (;conditionIndex < branchDataJSON.length;conditionIndex++) { | |
if (_ref3 = branchDataJSON[conditionIndex].getCnItem("fp"), from = $('li[data-item-fpid="' + _ref3 + '"]', this._bsWrapper), from && ($last = from.find(".bs-WinPlaceEachWay_Items")), $last && $last.length > 0) { | |
parts = $last[0].children; | |
subLn = parts.length; | |
/** @type {number} */ | |
j = 0; | |
for (;j < subLn;j++) { | |
r20 = parts[j].children[0].getAttribute("data-topic"); | |
if (r20) { | |
this._bsController.subscribeItem(r20); | |
} | |
} | |
} else { | |
r20 = branchDataJSON[conditionIndex].getTopic(); | |
if (r20) { | |
this._bsController.subscribeItem(r20); | |
} | |
} | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
unsubscribe : function() { | |
var targets; | |
var j; | |
var subLn; | |
var vvar; | |
/** @type {Array} */ | |
var assigns = []; | |
var dirNames; | |
var a; | |
if (this._isValid()) { | |
/** @type {NodeList} */ | |
targets = document.getElementsByClassName("bs-WinPlaceEachWay_DropdownItemText"); | |
/** @type {number} */ | |
subLn = targets.length; | |
/** @type {number} */ | |
j = 0; | |
for (;j < subLn;j++) { | |
vvar = targets[j].getAttribute("data-topic"); | |
if (vvar) { | |
if (assigns.indexOf(vvar) == -1) { | |
assigns.push(vvar); | |
this._bsController.unsubscribeItem(vvar); | |
} | |
} | |
} | |
dirNames = this._bsInst.getBetItems(); | |
subLn = dirNames.length; | |
/** @type {number} */ | |
j = 0; | |
for (;j < subLn;j++) { | |
a = $('li[data-item-id="' + j + '"][data-item-type="single"]', this._bsWrapper).get(0); | |
if (a) { | |
if (a.wrapper) { | |
a.wrapper.detatchStem(); | |
} | |
} | |
if (dirNames[j]) { | |
vvar = dirNames[j].getTopic(); | |
} | |
if (vvar) { | |
if (assigns.indexOf(vvar) == -1) { | |
assigns.push(vvar); | |
this._bsController.unsubscribeItem(vvar); | |
} | |
} | |
} | |
} | |
}, | |
/** | |
* @param {Object} qualifier | |
* @param {?} triggerRoute | |
* @return {undefined} | |
*/ | |
subscriptionHandler : function(qualifier, triggerRoute) { | |
var client_id = qualifier.data.ID; | |
var restoreScript; | |
var nodes; | |
var expectationResult; | |
var $form; | |
var data_action; | |
var bar; | |
var j; | |
var nlen; | |
var node; | |
var core_indexOf; | |
if (qualifier.data) { | |
/** @type {NodeList} */ | |
nodes = document.getElementsByClassName("bs-WinPlaceEachWay_DropdownItemText"); | |
/** @type {number} */ | |
nlen = nodes.length; | |
/** @type {number} */ | |
j = 0; | |
for (;j < nlen;j++) { | |
if (nodes[j].getAttribute("data-participantid") === client_id) { | |
node = nodes[j]; | |
break; | |
} | |
} | |
if (node) { | |
restoreScript = $(node).closest('li[data-item-type="single"]').get(0); | |
expectationResult = node.parentNode.parentNode.parentNode; | |
this._snapshotAusRaceHandler(qualifier, triggerRoute, restoreScript, expectationResult); | |
} else { | |
if (restoreScript = $('li[data-item-fpid="' + client_id + '"][data-item-type="single"]', this._bsWrapper).get(0), restoreScript) { | |
if (this._bsController) { | |
if (this._bsController._dlg) { | |
$form = $("#okButton"); | |
if ($form.length > 0) { | |
data_action = $form[0].getAttribute("data-action"); | |
if (data_action) { | |
if (data_action === "refer") { | |
bar = $("#bsCD"); | |
if (bar.length > 0) { | |
if (bar[0].hasAttribute("style")) { | |
if (bar.css("display") != "none") { | |
this._bsController._dlg.hideDialog(); | |
} | |
} | |
} | |
$form.removeClass("disabled"); | |
$("#closeButton").removeClass("disabled"); | |
} | |
} | |
} | |
} | |
} | |
core_indexOf = new b365.Ui.Betslip.ItemDisplay(restoreScript, this._bsInst, this._bsController, qualifier); | |
switch(triggerRoute) { | |
case "delete": | |
core_indexOf.itemDeleteHandler(qualifier); | |
break; | |
case "update": | |
core_indexOf.itemUpdateHandler(qualifier); | |
break; | |
default: | |
core_indexOf.commitChanges(); | |
} | |
} | |
} | |
} | |
}, | |
/** | |
* @param {Object} event | |
* @param {?} triggerRoute | |
* @param {Object} callback | |
* @param {Object} result | |
* @return {undefined} | |
*/ | |
_snapshotAusRaceHandler : function(event, triggerRoute, callback, result) { | |
var list; | |
var k; | |
var $form; | |
var data_action; | |
var bar; | |
var self; | |
var n; | |
if (event && (callback && result)) { | |
if (this._bsController) { | |
if (this._bsController._dlg) { | |
$form = $("#okButton"); | |
if ($form.length > 0) { | |
data_action = $form[0].getAttribute("data-action"); | |
if (data_action) { | |
if (data_action === "refer") { | |
bar = $("#bsCD"); | |
if (bar.length > 0) { | |
if (bar[0].hasAttribute("style")) { | |
if (bar.css("display") != "none") { | |
this._bsController._dlg.hideDialog(); | |
} | |
} | |
} | |
$form.removeClass("disabled"); | |
$("#closeButton").removeClass("disabled"); | |
} | |
} | |
} | |
} | |
} | |
list = result.children[0].children; | |
k = list.length; | |
/** @type {number} */ | |
j = 0; | |
for (;j < k;j++) { | |
if (n = list[j].children[0].getAttribute("data-topic"), n && n === event.data.IT) { | |
self = new b365.Ui.Betslip.ItemDisplayAusRacing(this._bsInst, this._bsController); | |
self.initialize(callback, list[j], event); | |
switch(triggerRoute) { | |
case "delete": | |
self.itemDeleteHandler(event); | |
break; | |
case "update": | |
self.itemUpdateHandler(event); | |
break; | |
default: | |
self.commitChanges(); | |
} | |
} | |
} | |
} | |
} | |
}; | |
}(); | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {Node} s | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @param {boolean} ignoreMethodDoesntExist | |
* @param {?} textAlt | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemDisplay = function(s, dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist, textAlt) { | |
/** @type {string} */ | |
this._SUSPENDED = "suspended"; | |
/** @type {string} */ | |
this._HANDICAP = "hcapChange"; | |
/** @type {string} */ | |
this._ODDSCHANGED = "oddsChange"; | |
/** @type {string} */ | |
this._Attribute_ID = "ID"; | |
/** @type {string} */ | |
this._Attribute_ODDS = "OD"; | |
/** @type {string} */ | |
this._Attribute_HANDICAP = "HA"; | |
/** @type {string} */ | |
this._Attribute_SUSPENDED = "SU"; | |
/** @type {string} */ | |
this._Attribute_HASH = "HS"; | |
/** @type {string} */ | |
this._Attribute_CHANGE_STAMP = "SA"; | |
/** @type {number} */ | |
this._OddsType_DECIMAL = 2; | |
/** @type {number} */ | |
this._OddsType_AMERICAN = 3; | |
/** @type {number} */ | |
this._oddsTypeOverride = 0; | |
/** @type {boolean} */ | |
this._hasNormalOdds = false; | |
/** @type {null} */ | |
this._betSlipWrapper = null; | |
this._item = $(s); | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {boolean} */ | |
this._stem = ignoreMethodDoesntExist; | |
this._statusContainer = $('<div class="bs-ItemStatus"></div>'); | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined" && (!$(".betReceipt", this._getbetSlipWrapper).length > 0 && (this._stem && !this._bsInst._lock)); | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._anyOthersSuspended = function() { | |
var codeSegments = s.parentNode.childNodes; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (codeSegments[i] !== s && codeSegments[i].className.indexOf("suspended") > -1) { | |
return true; | |
} | |
} | |
return false; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._suspend = function() { | |
this._betItem.setStItem("_s", "1"); | |
this._item.addClass(this._SUSPENDED); | |
/** @type {boolean} */ | |
this._suspendedChanged = true; | |
(new b365.Ui.Betslip.OddsLineChangedHandler(this._bsInst, this._bsController)).handle(true); | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._getbetSlipWrapper = function() { | |
return this._betSlipWrapper || (this._betSlipWrapper = $("#bsDiv")), this._betSlipWrapper; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._initialize = function() { | |
var self = this; | |
var t; | |
if (self._isValid()) { | |
t = self._stem.data ? self._stem.data : self._stem.target.data; | |
this._handicapText = self._item.find(".bs-Selection_Handicap")[0]; | |
this._oddsText = self._item.find(".bs-Odds")[0]; | |
this._oddsChoiseSelector = self._item.find(".bs-OddsChoice_SelectionText")[0]; | |
/** @type {boolean} */ | |
self._hasNormalOdds = self._bsInst.getSlipType() !== self._bsInst.slipFixedTeaser; | |
if (this._oddsText) { | |
if (this._oddsText.tagName.toLowerCase() === "select") { | |
this._oddsText = this._oddsText.children[0]; | |
} | |
} | |
if (t) { | |
self._betItem = self._bsInst.getBetItemByCn(self._bsInst.betTypeNormal, "fp", t[self._Attribute_ID]); | |
} | |
if (self._betItem) { | |
self._oddsTypeOverride = self._betItem.getOddsOverride() || self._oddsTypeOverride; | |
self.decimalPlaces = self._betItem.getDecimalPlaces() || self.decimalPlaces; | |
} | |
} | |
}; | |
if (!textAlt) { | |
this._initialize(); | |
} | |
}; | |
/** | |
* @param {Object} event | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemDisplay.prototype.itemUpdateHandler = function(event) { | |
var child = this; | |
var value = event.data; | |
child._oddsChanged = child._oddsChanged || child._Attribute_ODDS in value && (child._betItem.getCnItem("o") !== value[child._Attribute_ODDS] && child._hasNormalOdds); | |
child._handicapChanged = child._handicapChanged || child._Attribute_HANDICAP in value && (child._betItem.getCnItem("ln") && parseFloat(child._betItem.getCnItem("ln")) !== parseFloat(value[child._Attribute_HANDICAP])); | |
/** @type {boolean} */ | |
child._suspendedChanged = child._Attribute_SUSPENDED in value && value[child._Attribute_SUSPENDED] === "1"; | |
child.commitChanges(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemDisplay.prototype.itemDeleteHandler = function() { | |
var self = this; | |
if (self._isValid()) { | |
self._suspend(); | |
} | |
self.commitChanges(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemDisplay.prototype.commitChanges = function() { | |
var self = this; | |
var active = this._item.hasClass("suspended"); | |
var handle = this._anyOthersSuspended(); | |
var index; | |
var ifn; | |
var deepDataAndEvents; | |
var formula; | |
var a; | |
var o; | |
var str; | |
var el; | |
var rule; | |
var dataAndEvents; | |
var node; | |
if (self._isValid()) { | |
var item = self._stem.data; | |
var prev = self._oddsChanged || self._handicapChanged; | |
var selected = self._suspendedChanged; | |
/** @type {number} */ | |
var fmt = 0; | |
if (self._oddsChanged && self._handicapChanged ? fmt = 3 : self._handicapChanged ? fmt = 2 : self._oddsChanged && (fmt = 1), fmt > 0 && self._betItem.setStItem("olc", String(fmt)), (self._oddsChanged || self._handicapChanged) && (self._Attribute_CHANGE_STAMP in item && self._betItem.setCnItem("sa", item[self._Attribute_CHANGE_STAMP])), index = false, self._oddsChanged && self._oddsText) { | |
if (ifn = self._betItem.getCnItem("o"), deepDataAndEvents = item[self._Attribute_ODDS], deepDataAndEvents = self._bsController.getFormatedOdds(deepDataAndEvents, self.decimalPlaces, +self._oddsTypeOverride), formula = Number($("#bsDiv>ul:first-child").attr("data-tcm")), formula && (formula == "1" && (a = $("#bsDiv>ul:first-child").attr("data-mod"), a && (a = a.split("#"), o = self._bsController.getFormatedOdds(item[self._Attribute_ODDS], self.decimalPlaces, 2), index = o < Number(a[0]), index ? | |
this._item.addClass("bs-MinOddsContigency") : this._item.removeClass("bs-MinOddsContigency")))), self._oddsChoiseSelector) { | |
if (self._betItem.getStItem("sp") === "1") { | |
self._betItem.setCnItem("o", item[self._Attribute_ODDS]); | |
self._betItem.setStItem("olc", 0); | |
self._bsController._enhancedBetSlipOddsSelector.updateOdds(item, deepDataAndEvents); | |
self._bsInst.updateState(); | |
return; | |
} | |
$(self._oddsChoiseSelector).text(deepDataAndEvents || ""); | |
self._bsController._enhancedBetSlipOddsSelector.updateOdds(item, deepDataAndEvents); | |
self._item.addClass(self._ODDSCHANGED); | |
} else { | |
$(self._oddsText).text(deepDataAndEvents || ""); | |
self._item.addClass(self._ODDSCHANGED); | |
} | |
self._betItem.setCnItem("o", item[self._Attribute_ODDS]); | |
} | |
if (self._handicapChanged) { | |
if (self._handicapText) { | |
str = item[self._Attribute_HANDICAP] || ""; | |
if (str.length > 0) { | |
if (str.indexOf(".") === -1) { | |
/** @type {string} */ | |
str = (str.indexOf("+") > -1 ? "+" : "") + Number(str).toFixed(1); | |
} | |
} | |
if (self._bsInst.getSlipType() === self._bsInst.slipFixedTeaser) { | |
str = str.replace("+", ""); | |
} | |
$(self._handicapText).text(str); | |
self._item.addClass(self._HANDICAP); | |
self._betItem.setCnItem("ln", item[self._Attribute_HANDICAP]); | |
} | |
} | |
/** @type {boolean} */ | |
el = false; | |
if (self._suspendedChanged) { | |
self._betItem.setStItem("_s", "1"); | |
/** @type {boolean} */ | |
el = true; | |
} | |
rule = self._item.find(".bs-OddsContainer"); | |
if (selected || self._oddsChanged) { | |
if (el || index) { | |
self._item.addClass(self._SUSPENDED); | |
if (rule.find(".bs-ItemStatus").length === 0) { | |
rule.append(this._statusContainer); | |
this._statusContainer.text(betSlipML.suspended); | |
} | |
} else { | |
self._item.removeClass(self._SUSPENDED); | |
} | |
} | |
if (prev || selected) { | |
self._bsInst.updateState(); | |
} | |
if (prev) { | |
(new b365.Ui.Betslip.TotalsCalculator(self._bsInst, self._bsController)).calculate(); | |
} | |
if (prev || selected) { | |
(new b365.Ui.Betslip.OddsLineChangedHandler(self._bsInst, self._bsController)).handle(handle || el); | |
} | |
if (self._suspendedChanged === false) { | |
if (this._item.hasClass("suspended")) { | |
self._item.removeClass(self._SUSPENDED); | |
self._betItem.setStItem("_s", "0"); | |
self._bsInst.updateState(); | |
(new b365.Ui.Betslip.OddsLineChangedHandler(self._bsInst, self._bsController)).handle(handle || el); | |
} | |
} | |
if (typeof selected != "undefined") { | |
if (selected && !active || !selected && active) { | |
dataAndEvents = self._item.attr("data-item-exclusion"); | |
node = self._item.attr("data-item-exclusion2"); | |
self._betItem.setCnItem("ex", dataAndEvents); | |
self._betItem.setCnItem("x2", node); | |
self._bsController.getMultipleItemsController().check(); | |
} | |
} | |
/** @type {boolean} */ | |
self._oddsChanged = false; | |
/** @type {boolean} */ | |
self._handicapChanged = false; | |
self._suspendedChanged = undefined; | |
} | |
}; | |
/** | |
* @param {HTMLElement} node | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemDisplay.itemSuspen = function(node) { | |
var t = node.getElementsByClassName("bs-OddsContainer")[0]; | |
var r = node.getElementsByClassName("bs-ItemStatus")[0]; | |
var tt; | |
if (!t) { | |
/** @type {HTMLElement} */ | |
t = node; | |
} | |
if (!r) { | |
if (t) { | |
/** @type {Element} */ | |
tt = document.createElement("div"); | |
/** @type {string} */ | |
tt.className = "bs-ItemStatus"; | |
tt.appendChild(document.createTextNode(betSlipML.suspended)); | |
t.appendChild(tt); | |
} | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {(Object|boolean|number|string)} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemDisplayAusRacing = function(dataAndEvents, deepDataAndEvents) { | |
/** @type {(Object|boolean|number|string)} */ | |
this._betSlipInstance = dataAndEvents; | |
this._betSlipController = deepDataAndEvents; | |
/** @type {null} */ | |
this._betCookie = null; | |
/** @type {null} */ | |
this._betItem = null; | |
/** @type {null} */ | |
this._ausDropDownItem = null; | |
/** @type {null} */ | |
this._ausItemDataNode = null; | |
/** @type {null} */ | |
this._stem = null; | |
/** @type {null} */ | |
this._betSlipWrapper = null; | |
/** @type {null} */ | |
this._oddsContainer = null; | |
/** @type {null} */ | |
this._oddsText = null; | |
/** @type {null} */ | |
this._oddsChoiceSelector = null; | |
/** @type {string} */ | |
this._FIXED_EACH_WAY_PLBT_ID = "99991"; | |
/** @type {string} */ | |
this._SUSPENDED = " suspended"; | |
/** @type {string} */ | |
this._ODDSCHANGED = " oddsChange"; | |
/** @type {string} */ | |
this._DISABLED = " inplaysuspend"; | |
/** @type {string} */ | |
this._SELECTED = " selected"; | |
/** @type {string} */ | |
this._Attribute_ID = "ID"; | |
/** @type {string} */ | |
this._Attribute_ODDS = "OD"; | |
/** @type {string} */ | |
this._Attribute_HANDICAP = "HA"; | |
/** @type {string} */ | |
this._Attribute_SUSPENDED = "SU"; | |
/** @type {string} */ | |
this._Attribute_HASH = "HS"; | |
/** @type {string} */ | |
this._Attribute_CHANGE_STAMP = "SA"; | |
/** @type {number} */ | |
this._OddsType_DECIMAL = 2; | |
/** @type {number} */ | |
this._OddsType_AMERICAN = 3; | |
/** @type {number} */ | |
this._oddsTypeOverride = 0; | |
this._statusContainer = $('<div class="bs-ItemStatus"></div>'); | |
/** @type {boolean} */ | |
this._oddsChanged = false; | |
/** @type {number} */ | |
this._suspendedState = 0; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
var element = this; | |
return typeof element._betSlipInstance != "undefined" && (!$(".betReceipt", element._getbetSlipWrapper).length > 0 && (element._stem && !element._betSlipInstance._lock)); | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._anyOthersSuspended = function() { | |
var range = this; | |
var els = range._betItem.parentNode.children; | |
var len = els.length; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < len;i++) { | |
if (els[i] !== range._betItem && els[i].className.indexOf("suspended") > -1) { | |
return true; | |
} | |
} | |
return false; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._suspend = function() { | |
var OddsLineChangedHandler = this; | |
OddsLineChangedHandler._changeAusDropdownItemSuspendStatus(true); | |
(new b365.Ui.Betslip.OddsLineChangedHandler(OddsLineChangedHandler._betSlipInstance, OddsLineChangedHandler._betSlipController)).handle(true); | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._getbetSlipWrapper = function() { | |
var self = this; | |
return self._betSlipWrapper || (self._betSlipWrapper = $("#bsDiv")), self._betSlipWrapper; | |
}; | |
/** | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
this._changeAusDropdownItemSuspendStatus = function(recurring) { | |
var node = this; | |
var _i; | |
var _len; | |
var lis; | |
var object; | |
/** @type {boolean} */ | |
var idToUpdate = node._ausDropDownItem.className.indexOf(node._SELECTED) > -1; | |
if (!idToUpdate) { | |
lis = node._ausDropDownItem.parentNode.children; | |
_len = lis.length; | |
/** @type {number} */ | |
_i = 0; | |
for (;_i < _len;_i++) { | |
if (lis[_i].className.indexOf(node._SELECTED) > -1) { | |
object = lis[_i]; | |
break; | |
} | |
} | |
} | |
node._ausItemDataNode.setAttribute("data-suspended", recurring ? "1" : "0"); | |
if (idToUpdate || object && object.children[0].getAttribute("data-item") === node._FIXED_EACH_WAY_PLBT_ID) { | |
if (recurring) { | |
node._betItem.className = node._betItem.className + node._SUSPENDED; | |
if (node._oddsContainer.querySelectorAll(".bs-ItemStatus").length === 0) { | |
node._oddsContainer.append(node._statusContainer); | |
node._statusContainer.text(betSlipML.suspended); | |
} | |
} else { | |
node._betItem.className = node._betItem.className.replace(node._SUSPENDED, ""); | |
} | |
node._betCookie.setStItem("_s", recurring ? "1" : "0"); | |
node._betSlipInstance.updateState(); | |
/** @type {number} */ | |
node._suspendedState = 2; | |
} else { | |
/** @type {number} */ | |
node._suspendedState = 0; | |
} | |
}; | |
}; | |
/** | |
* @param {Element} context | |
* @param {Element} cfg | |
* @param {Node} data | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemDisplayAusRacing.prototype.initialize = function(context, cfg, data) { | |
var self = this; | |
var t; | |
if (self._stem = data, self._isValid()) { | |
/** @type {Element} */ | |
self._betItem = context; | |
/** @type {Element} */ | |
self._ausDropDownItem = cfg; | |
self._ausItemDataNode = cfg.children[0]; | |
self._oddsContainer = self._betItem.querySelectorAll(".bs-OddsContainer")[0]; | |
self._oddsText = self._betItem.querySelectorAll(".bs-Odds")[0]; | |
self._oddsChoiceSelector = context.querySelectorAll(".bs-OddsChoice_SelectionText")[0]; | |
t = data.data ? data.data : data.target.data; | |
if (self._oddsText) { | |
if (self._oddsText.tagName.toLowerCase() === "select") { | |
self._oddsText = self._oddsText.children[0]; | |
} | |
} | |
if (t) { | |
self._betCookie = self._betSlipInstance.getBetItemByCn(self._betSlipInstance.betTypeNormal, "fp", t[self._Attribute_ID]); | |
if (!self._betCookie) { | |
self._betCookie = self._betSlipInstance.getBetItemByCn(self._betSlipInstance.betTypeNormal, "pp", t[self._Attribute_ID]); | |
} | |
} | |
if (self._betCookie) { | |
self._oddsTypeOverride = self._betCookie.getOddsOverride() || self._oddsTypeOverride; | |
self.decimalPlaces = self._betCookie.getDecimalPlaces() || self.decimalPlaces; | |
} | |
} | |
}; | |
/** | |
* @param {Object} event | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemDisplayAusRacing.prototype.itemUpdateHandler = function(event) { | |
var child = this; | |
var value = event.data; | |
child._oddsChanged = child._oddsChanged || child._Attribute_ODDS in value && child._ausItemDataNode.getAttribute("data-odds") !== value[child._Attribute_ODDS]; | |
/** @type {number} */ | |
child._suspendedState = child._Attribute_SUSPENDED in value && value[child._Attribute_SUSPENDED] === "1" ? 2 : 1; | |
child.commitChanges(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemDisplayAusRacing.prototype.itemDeleteHandler = function() { | |
var self = this; | |
if (self._isValid()) { | |
self._suspend(); | |
} | |
self.commitChanges(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ItemDisplayAusRacing.prototype.commitChanges = function() { | |
var config = this; | |
/** @type {boolean} */ | |
var k = config._betItem.className.indexOf("suspended") > -1; | |
var handle = config._anyOthersSuspended(); | |
var obj; | |
/** @type {boolean} */ | |
var value = false; | |
var deepDataAndEvents; | |
var data; | |
var g; | |
var li; | |
var formula; | |
var part; | |
var nt; | |
var r20; | |
var restoreScript; | |
var lis; | |
var _i; | |
var _len; | |
/** @type {boolean} */ | |
var a = false; | |
/** @type {boolean} */ | |
var ut = false; | |
var str; | |
var elem; | |
var dataAndEvents; | |
var items; | |
var svgEl; | |
var node; | |
var last; | |
if (config._isValid()) { | |
if (obj = config._stem.data, config._oddsChanged) { | |
if (deepDataAndEvents = obj[config._Attribute_ODDS], data = config._betSlipController.getFormatedOdds(deepDataAndEvents, config.decimalPlaces, +config._oddsTypeOverride), config._ausItemDataNode.setAttribute("data-odds", deepDataAndEvents), config._ausItemDataNode.setAttribute("data-displayodds", data), g = config._ausDropDownItem.className.indexOf(config._SELECTED) > -1, g) { | |
/** @type {boolean} */ | |
a = true; | |
} else { | |
lis = config._ausDropDownItem.parentNode.children; | |
_len = lis.length; | |
/** @type {number} */ | |
_i = 0; | |
for (;_i < _len;_i++) { | |
if (lis[_i].className.indexOf(config._SELECTED) > -1) { | |
li = lis[_i]; | |
break; | |
} | |
} | |
if (li) { | |
if (li.children[0].getAttribute("data-item") === config._FIXED_EACH_WAY_PLBT_ID) { | |
/** @type {boolean} */ | |
a = true; | |
/** @type {boolean} */ | |
ut = true; | |
} | |
} | |
} | |
if (a) { | |
config._betCookie.setStItem("olc", "1"); | |
if (config._Attribute_CHANGE_STAMP in obj) { | |
config._betCookie.setCnItem("sa", obj[config._Attribute_CHANGE_STAMP]); | |
} | |
/** @type {number} */ | |
formula = Number($("#bsDiv>ul:first-child").attr("data-tcm")); | |
if (formula) { | |
if (formula == "1") { | |
part = $("#bsDiv>ul:first-child").attr("data-mod"); | |
if (part) { | |
part = part.split("#"); | |
nt = config._betSlipController.getFormatedOdds(obj[config._Attribute_ODDS], config.decimalPlaces, 2); | |
/** @type {boolean} */ | |
value = nt < Number(part[0]); | |
config._betItem.className = value ? config._betItem.className + " bs-MinOddsContigency" : config._betItem.className.replace(" bs-MinOddsContigency", ""); | |
} | |
} | |
} | |
if (ut) { | |
if (config._ausItemDataNode.getAttribute("data-iswin") === "1") { | |
svgEl = config._ausItemDataNode.parentNode.nextElementSibling.children[0]; | |
if (svgEl) { | |
dataAndEvents = deepDataAndEvents; | |
items = data; | |
node = svgEl.getAttribute("data-odds"); | |
last = svgEl.getAttribute("data-displayodds"); | |
} | |
} else { | |
elem = config._ausItemDataNode.parentNode.previousElementSibling.children[0]; | |
if (elem) { | |
dataAndEvents = elem.getAttribute("data-odds"); | |
items = elem.getAttribute("data-displayodds"); | |
node = deepDataAndEvents; | |
last = data; | |
} | |
} | |
config._betCookie.setCnItem("o", dataAndEvents); | |
config._betCookie.setCnItem("po", node); | |
/** @type {string} */ | |
str = items + ", " + last; | |
} else { | |
str = data; | |
config._betCookie.setCnItem("o", deepDataAndEvents); | |
} | |
/** @type {string} */ | |
config._oddsText.innerHTML = str || ""; | |
config._betItem.className = config._betItem.className + config._ODDSCHANGED; | |
} | |
(new b365.Ui.Betslip.TotalsCalculator(config._betSlipInstance, config._betSlipController)).calculate(); | |
} | |
if (config._suspendedState !== 0 || config._oddsChanged) { | |
if (config._suspendedState === 2 || value) { | |
config._changeAusDropdownItemSuspendStatus(true); | |
} else { | |
config._changeAusDropdownItemSuspendStatus(false); | |
} | |
} | |
if (config._suspendedState === 1) { | |
if (config._betItem.className.indexOf("suspended") > -1) { | |
config._changeAusDropdownItemSuspendStatus(false); | |
(new b365.Ui.Betslip.OddsLineChangedHandler(config._betSlipInstance, config._betSlipController)).handle(handle || config._suspendedState !== 0); | |
} | |
} | |
if (config._suspendedState !== 0) { | |
if (config._suspendedState === 2 && !k || config._suspendedState === 1 && k) { | |
r20 = config._betItem.getAttribute("data-item-exclusion"); | |
restoreScript = config._betItem.getAttribute("data-item-exclusion2"); | |
config._betCookie.setCnItem("ex", r20); | |
config._betCookie.setCnItem("x2", restoreScript); | |
config._betSlipController.getMultipleItemsController().check(); | |
} | |
} | |
if (config._oddsChanged || config._suspendedState !== 0) { | |
config._betSlipInstance.updateState(); | |
} | |
if (config._oddsChanged || config._suspendedState !== 0) { | |
(new b365.Ui.Betslip.OddsLineChangedHandler(config._betSlipInstance, config._betSlipController)).handle(handle || config._suspendedState !== 0); | |
} | |
/** @type {boolean} */ | |
config._oddsChanged = false; | |
/** @type {boolean} */ | |
config._handicapChanged = false; | |
/** @type {number} */ | |
config._suspendedState = 0; | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.MultipleItemsController = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {null} */ | |
this._multiConstruct = null; | |
/** @type {null} */ | |
this._singlesValue = null; | |
/** @type {null} */ | |
this._multiOpen = null; | |
/** @type {null} */ | |
this._stagedToCallTimer = null; | |
/** @type {string} */ | |
this._restrictedMultiples = ""; | |
/** @type {boolean} */ | |
this._requesting = false; | |
/** @type {boolean} */ | |
this._rerequest = false; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._clearMultiples = function() { | |
var host = this._findMultiples(); | |
if (host) { | |
/** @type {string} */ | |
host.innerHTML = ""; | |
host.setAttribute("style", "display:none;"); | |
} | |
this._bsInst.contentChangedOnClient(); | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._findMultiples = function() { | |
var hasMembers = document.getElementsByClassName("bs-MultipleBets")[0]; | |
return hasMembers || (hasMembers = document.getElementsByClassName("bs-MultipleBetsBanker")[0]), hasMembers || (hasMembers = document.getElementsByClassName("bs-TeaserBets")[0]), hasMembers; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._restoreState = function() { | |
/** @type {boolean} */ | |
var _multiOpen = this._bsInst.getValueFromBSCookie("mo").replace("||", "") === "1"; | |
var t; | |
var el; | |
var a; | |
var copy; | |
var conditionIndex; | |
var self; | |
var target; | |
var i; | |
var n; | |
if (_multiOpen && !this._multiOpen || !_multiOpen && this._multiOpen ? (new b365.Ui.Betslip.ToggleMultiples(this._bsInst, this._bsController)).toggle() : _multiOpen && (this._multiOpen && (new b365.Ui.Betslip.ToggleMultiples(this._bsInst, this._bsController)).reset()), (new b365.Ui.Betslip.RestoreStateHandler(this._bsInst)).handle(), this._multiConstruct !== "") { | |
/** @type {NodeList} */ | |
var textareas = document.getElementsByClassName("bs-MultipleBets_Stake"); | |
var drop = $bto.parseCookieString(this._multiConstruct, this._bsInst.betTypeMultiple); | |
var branchDataJSON = this._bsInst.getBetItems(this._bsInst.itemTypeMultiple); | |
/** @type {number} */ | |
t = 0; | |
for (;t < textareas.length;t++) { | |
if (el = textareas[t], el) { | |
if (a = new b365.Ui.Betslip.ItemInformation(el), !a) { | |
continue; | |
} | |
if (copy = a.itemIndexAndType()[0], copy === "-1") { | |
if (el.value !== this._singlesValue) { | |
el.value = this._singlesValue; | |
} | |
} else { | |
/** @type {number} */ | |
conditionIndex = 0; | |
for (;conditionIndex < branchDataJSON.length;conditionIndex++) { | |
if (self = branchDataJSON[conditionIndex], target = self && (self.getCnItem && self.getCnItem("id")), target === copy) { | |
/** @type {number} */ | |
i = 0; | |
for (;i < drop.length;i++) { | |
if (n = drop[i], n && (n.getCnItem && n.getCnItem("id") === target)) { | |
self.parse(n.toString()); | |
drop.splice(i, 1); | |
break; | |
} | |
} | |
if (!el.value !== self.getStItem("st")) { | |
el.value = self.getStItem("st") || ""; | |
} | |
break; | |
} | |
} | |
} | |
} | |
} | |
/** @type {null} */ | |
this._multiConstruct = null; | |
} | |
(new b365.Ui.Betslip.TotalsCalculator(this._bsInst, this._bsController)).calculate(); | |
this._styleRestrictions(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._styleRestrictions = function() { | |
/** @type {NodeList} */ | |
var codeSegments = document.querySelectorAll('[data-item-type="single"]'); | |
/** @type {number} */ | |
var i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (this._restrictedMultiples.indexOf(codeSegments[i].getAttribute("data-item-fpid")) > -1) { | |
/** @type {string} */ | |
codeSegments[i].className = codeSegments[i].className + " bs-RestrictedCong"; | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._skipServerCheck = function() { | |
return this._bsInst.getSlipType() === this._bsInst.slipBanker ? this._bsInst.unsuspendedItemCount() < 3 : this._bsInst.unsuspendedItemCount() === 1; | |
}; | |
}; | |
b365.Ui.Betslip.MultipleItemsController.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
check : function() { | |
var env = this; | |
if (this._isValid()) { | |
if (this._requesting) { | |
/** @type {boolean} */ | |
this._rerequest = true; | |
return; | |
} | |
if (this._stagedToCallTimer) { | |
window.clearTimeout(this._stagedToCallTimer); | |
/** @type {null} */ | |
this._stagedToCallTimer = null; | |
} | |
/** @type {number} */ | |
this._stagedToCallTimer = window.setTimeout(function() { | |
env._bsInst.updateState(); | |
env.cacheState(); | |
if (env._skipServerCheck()) { | |
env._clearMultiples(); | |
} else { | |
/** @type {boolean} */ | |
env._requesting = true; | |
env._bsInst.req(env._bsInst.reqTypeFetchMultiples); | |
} | |
/** @type {null} */ | |
env._stagedToCallTimer = null; | |
}, 50); | |
} | |
}, | |
/** | |
* @param {Object} content | |
* @return {undefined} | |
*/ | |
process : function(content) { | |
if (this._requesting = false, this._rerequest) { | |
this.check(); | |
return; | |
} | |
this._bsInst.handleInProg("hide"); | |
var element = this._findMultiples(); | |
if (element) { | |
/** @type {Object} */ | |
element.outerHTML = content; | |
this._restoreState(); | |
this._bsInst.contentChangedOnClient(); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
cacheState : function() { | |
/** @type {(HTMLElement|null)} */ | |
var elem = document.getElementById("bsMultipleContainer"); | |
var codeSegments; | |
var i; | |
var n; | |
var line; | |
this._multiConstruct = $bto.serialize(this._bsInst.getBetItems(this._bsInst.betTypeMultiple)); | |
/** @type {boolean} */ | |
this._multiOpen = elem && elem.className.indexOf("open") > -1 || !!this._multiOpen; | |
/** @type {NodeList} */ | |
codeSegments = document.getElementsByClassName("bs-MultipleBets_Stake"); | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (n = codeSegments[i], n && (line = new b365.Ui.Betslip.ItemInformation(n), line.itemIndexAndType()[0] === "-1")) { | |
this._singlesValue = n.value; | |
break; | |
} | |
} | |
}, | |
/** | |
* @param {?} attr | |
* @return {undefined} | |
*/ | |
setRestrictedMultiples : function(attr) { | |
this._restrictedMultiples = attr; | |
} | |
}; | |
if (!Array.prototype.indexOf) { | |
/** | |
* @param {string} name | |
* @param {number=} fromIndex | |
* @return {number} | |
* @template T | |
*/ | |
Array.prototype.indexOf = function(name, fromIndex) { | |
if (!fromIndex) { | |
/** @type {number} */ | |
fromIndex = 0; | |
} | |
/** @type {(number|undefined)} */ | |
var i = fromIndex; | |
for (;i < this.length;i++) { | |
if (this[i] === name) { | |
return i; | |
} | |
} | |
return-1; | |
}; | |
} | |
if (!Array.prototype.map) { | |
/** | |
* @param {(function (this:S, T, number, Array.<T>): R|null)} fun | |
* @param {(Function|string)=} prop | |
* @return {Array.<R>} | |
* @template T,S,R | |
*/ | |
Array.prototype.map = function(fun, prop) { | |
var obj; | |
var progressValues; | |
var i; | |
var self; | |
var length; | |
var value; | |
var result; | |
if (this == null) { | |
throw new TypeError(" this is null or not defined"); | |
} | |
if (self = Object(this), length = self.length >>> 0, typeof fun != "function") { | |
throw new TypeError(fun + " is not a function"); | |
} | |
if (arguments.length > 1) { | |
/** @type {(Function|string)} */ | |
obj = prop; | |
} | |
/** @type {Array} */ | |
progressValues = new Array(length); | |
/** @type {number} */ | |
i = 0; | |
for (;i < length;) { | |
if (i in self) { | |
value = self[i]; | |
result = fun.call(obj, value, i, self); | |
progressValues[i] = result; | |
} | |
i++; | |
} | |
return progressValues; | |
}; | |
} | |
if (!Array.prototype.filter) { | |
/** | |
* @param {(function (this:S, T, number, Array.<T>): ?|null)} callback | |
* @return {Array.<T>} | |
* @template T,S | |
*/ | |
Array.prototype.filter = function(callback) { | |
var self; | |
var padLength; | |
var values; | |
var T; | |
var i; | |
var value; | |
if (this === void 0 || this === null) { | |
throw new TypeError(" this is null or not defined"); | |
} | |
if (self = Object(this), padLength = self.length >>> 0, typeof callback != "function") { | |
throw new TypeError(callback + " is not a function"); | |
} | |
/** @type {Array} */ | |
values = []; | |
T = arguments.length >= 2 ? arguments[1] : void 0; | |
/** @type {number} */ | |
i = 0; | |
for (;i < padLength;i++) { | |
if (i in self) { | |
value = self[i]; | |
if (callback.call(T, value, i, self)) { | |
values.push(value); | |
} | |
} | |
} | |
return values; | |
}; | |
} | |
if (!Array.prototype.reduce) { | |
/** | |
* @param {(function (?, T, number, Array.<T>): R|null)} callback | |
* @return {R} | |
* @template T,R | |
*/ | |
Array.prototype.reduce = function(callback) { | |
if (typeof callback != "function") { | |
throw new TypeError(callback + " is not a function"); | |
} | |
var array = Object(this); | |
/** @type {number} */ | |
var inputLength = array.length >>> 0; | |
/** @type {number} */ | |
var index = 0; | |
var accumulator; | |
if (arguments.length == 2) { | |
accumulator = arguments[1]; | |
} else { | |
for (;index < inputLength && !(index in array);) { | |
index++; | |
} | |
if (index >= inputLength) { | |
throw new TypeError("Reduce of empty array with no initial value"); | |
} | |
accumulator = array[index++]; | |
} | |
for (;index < inputLength;index++) { | |
if (index in array) { | |
accumulator = callback(accumulator, array[index], index, array); | |
} | |
} | |
return accumulator; | |
}; | |
} | |
if (!Element.prototype.getElementsByClassName) { | |
/** | |
* @param {string} e | |
* @return {?} | |
*/ | |
Element.prototype.getElementsByClassName = function(e) { | |
/** @type {Element} */ | |
var t = this; | |
return t.querySelectorAll ? t.querySelectorAll("." + e) : []; | |
}; | |
} | |
if (!document.getElementsByClassName) { | |
/** | |
* @param {string} e | |
* @return {NodeList} | |
*/ | |
document.getElementsByClassName = function(e) { | |
/** @type {HTMLDocument} */ | |
var t = document; | |
return t.querySelectorAll ? t.querySelectorAll("." + e) : []; | |
}; | |
} | |
if (!window.addEventListener) { | |
(function(ElementPrototype, WindowPrototype, DocumentPrototype, addEventListener, removeEventListener, dispatchEvent, registry) { | |
/** @type {function (this:Element, string, Function): undefined} */ | |
ElementPrototype[addEventListener] = WindowPrototype[addEventListener] = DocumentPrototype[addEventListener] = function(type, listener) { | |
/** @type {Element} */ | |
var target = this; | |
registry.unshift([target, type, listener, function(event) { | |
/** @type {Element} */ | |
event.currentTarget = target; | |
/** | |
* @return {undefined} | |
*/ | |
event.preventDefault = function() { | |
/** @type {boolean} */ | |
event.returnValue = false; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
event.stopPropagation = function() { | |
/** @type {boolean} */ | |
event.cancelBubble = true; | |
}; | |
event.target = event.srcElement || target; | |
if (typeof listener == "function") { | |
listener.call(target, event); | |
} else { | |
listener.handleEvent(event); | |
} | |
}]); | |
this.attachEvent("on" + type, registry[0][3]); | |
}; | |
/** @type {function (this:Element, string, ?): ?} */ | |
ElementPrototype[removeEventListener] = WindowPrototype[removeEventListener] = DocumentPrototype[removeEventListener] = function(type, listener) { | |
/** @type {number} */ | |
var index = 0; | |
var register; | |
for (;register = registry[index];++index) { | |
if (register[0] == this && (register[1] == type && register[2] == listener)) { | |
return this.detachEvent("on" + type, registry.splice(index, 1)[0][3]); | |
} | |
} | |
}; | |
/** @type {function (this:Element, Event): ?} */ | |
ElementPrototype[dispatchEvent] = WindowPrototype[dispatchEvent] = DocumentPrototype[dispatchEvent] = function(eventObject) { | |
return this.fireEvent("on" + eventObject.type, eventObject); | |
}; | |
})(Window.prototype, HTMLDocument.prototype, Element.prototype, "addEventListener", "removeEventListener", "dispatchEvent", []); | |
} | |
if (window.location.pathname.indexOf("LottoInterface.aspx") <= 0) { | |
if (window.addEventListener) { | |
window.addEventListener("load", initBetslip); | |
} else { | |
window.attachEvent("onload", initBetslip); | |
} | |
} | |
/** | |
* @return {undefined} | |
*/ | |
var $log = function() { | |
if ("console" in window) { | |
Array.prototype.splice.call(arguments, 0, 0, (new Date).getTime() + " "); | |
try { | |
console.log.apply(console, arguments); | |
} catch (n) { | |
console.log(Array.prototype.join.call(arguments, " ")); | |
} | |
} | |
}; | |
var bsApp; | |
/** | |
* @return {undefined} | |
*/ | |
var BetslipApp = function() { | |
var self = this; | |
var NAME; | |
/** @type {null} */ | |
self.bsController = null; | |
/** @type {null} */ | |
self.betslipWebModule = null; | |
/** @type {number} */ | |
self.betCount = 0; | |
/** @type {null} */ | |
self.subscriptionManager = null; | |
/** @type {null} */ | |
self.confirmationManger = null; | |
/** @type {number} */ | |
self.betslipHeight = 0; | |
/** @type {null} */ | |
self.receiptAnimation = null; | |
/** @type {boolean} */ | |
self.isIe = window.navigator.userAgent.indexOf("MSIE ") > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./); | |
/** @type {null} */ | |
self.matchAlertsEnabled = null; | |
/** @type {null} */ | |
self.overlay = null; | |
/** @type {number} */ | |
self.domainId = 0; | |
self.DomainIdEnum = { | |
unknown : 0, | |
it : 1, | |
com : 2, | |
es : 3, | |
gr : 4, | |
au : 5, | |
dk : 6 | |
}; | |
/** @type {string} */ | |
NAME = window.location.hostname.split(".").pop(); | |
if (window.location.hostname) { | |
if (self.DomainIdEnum.hasOwnProperty(NAME)) { | |
self.domainId = self.DomainIdEnum[NAME]; | |
} | |
} | |
self.bsContext = { | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
LoadBetCallModule : function(deepDataAndEvents) { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.loadBetCallModule) { | |
self.betslipWebModule.loadBetCallModule(deepDataAndEvents); | |
} | |
} | |
}, | |
/** | |
* @return {?} | |
*/ | |
GetBetCallController : function() { | |
return self.betslipWebModule && self.betslipWebModule.getBetCallController ? self.betslipWebModule.getBetCallController() : null; | |
}, | |
/** | |
* @return {?} | |
*/ | |
RefreshBalanceOnBetCallEnd : function() { | |
if (self.betslipWebModule && self.betslipWebModule.refreshUserBalance) { | |
return self.betslipWebModule.refreshUserBalance(); | |
} | |
}, | |
/** | |
* @return {?} | |
*/ | |
ClientEnhancedMode : function() { | |
return false; | |
}, | |
/** | |
* @return {?} | |
*/ | |
ShowStakePadToolTips : function() { | |
return false; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
ClientBetSlipShowing : function() { | |
}, | |
/** | |
* @return {?} | |
*/ | |
ClientUsesSelect : function() { | |
return false; | |
}, | |
/** | |
* @return {?} | |
*/ | |
ClientActionInProgress : function() { | |
return false; | |
}, | |
/** | |
* @return {?} | |
*/ | |
GetCurrencyObject : function() { | |
return{ | |
decimalSeparator : window.sProps.balance.currencyDecimalSeparator, | |
thousandsSeparator : window.sProps.balance.currencyGroupSeparator | |
}; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
ClientLoginDelegate : function() { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.showBetslipLogin) { | |
self.betslipWebModule.showBetslipLogin(); | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
ClientQuickBetLoginDelegate : function() { | |
if (self.betslipWebModule && self.betslipWebModule.showBetslipLogin) { | |
self.betslipWebModule.showBetslipLogin(true); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
clientAddQuickBetToBetslip : function() { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.addQuickBetToBetslip) { | |
self.betslipWebModule.addQuickBetToBetslip(); | |
} | |
} | |
}, | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
ShowBetslipBreakdownDialog : function(deepDataAndEvents) { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.showBetslipBreakdownDialog) { | |
self.betslipWebModule.showBetslipBreakdownDialog(deepDataAndEvents); | |
} | |
} | |
}, | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
ShowPitcherDetails : function(deepDataAndEvents) { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.showPitcherDetails) { | |
self.betslipWebModule.showPitcherDetails(deepDataAndEvents); | |
} | |
} | |
}, | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
updateCurrenyRate : function(deepDataAndEvents) { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.updateCurrenyRate) { | |
self.betslipWebModule.updateCurrenyRate(deepDataAndEvents); | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
ClientContinueDelegate : function() { | |
self.removeBets(); | |
self.refreshSlip(); | |
}, | |
/** | |
* @return {?} | |
*/ | |
IsReqOnBetAddedEnabled : function() { | |
return false; | |
}, | |
/** | |
* @return {?} | |
*/ | |
IsReqOnBetDeletedEnabled : function() { | |
return true; | |
}, | |
/** | |
* @return {?} | |
*/ | |
KeyboardType : function() { | |
return ""; | |
}, | |
/** | |
* @return {?} | |
*/ | |
IsAuthenticated : function() { | |
return self.betslipWebModule ? self.betslipWebModule.isAuthenticated() : false; | |
}, | |
/** | |
* @return {?} | |
*/ | |
JoinNow : function() { | |
return true; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
MembersHistory : function() { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.launchMembersHistory) { | |
self.betslipWebModule.launchMembersHistory(); | |
} | |
} | |
}, | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
BetPlacementNotification : function(deepDataAndEvents) { | |
self.betslipWebModule.betPlacementNotification(deepDataAndEvents); | |
}, | |
/** | |
* @return {?} | |
*/ | |
BetSource : function() { | |
return "FlashInPLay"; | |
}, | |
/** | |
* @return {?} | |
*/ | |
ShowStreaming : function() { | |
return true; | |
}, | |
/** | |
* @return {?} | |
*/ | |
ShowFullTextMode : function() { | |
return true; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
OnStreamingClick : function() { | |
}, | |
/** | |
* @param {?} corner | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
ShowConfirmation : function(corner, recurring) { | |
if (!self.confirmationManger) { | |
self.confirmationManger = new BetSlipShowConfirmationHandler(corner); | |
} | |
self.confirmationManger.handle(recurring); | |
}, | |
/** | |
* @param {?} regex | |
* @return {undefined} | |
*/ | |
showSiteConfirmation : function(regex) { | |
self.betslipWebModule.showBetslipSiteDialog(regex); | |
}, | |
/** | |
* @param {?} regex | |
* @return {undefined} | |
*/ | |
showPushbetDialog : function(regex) { | |
self.betslipWebModule.showPushbetDialog(regex); | |
}, | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {?} | |
*/ | |
getPushPopupStatus : function(deepDataAndEvents) { | |
return self.betslipWebModule.currentPushBetPopupStatus(deepDataAndEvents); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
repositionPopup : function() { | |
if (self.betslipWebModule) { | |
self.bsContext.additionalResizeRequired(); | |
self.betslipWebModule.repositionPopup(); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
additionalResizeRequired : function() { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.setAdditionalResizeRequired) { | |
self.betslipWebModule.setAdditionalResizeRequired(true); | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
ShowDialog : function() { | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
ShowTooltip : function() { | |
}, | |
/** | |
* @return {?} | |
*/ | |
RefreshUserBalance : function() { | |
return false; | |
}, | |
/** | |
* @param {Object} data | |
* @return {undefined} | |
*/ | |
ItemsRemoved : function(data) { | |
self.itemsRemoved(data.Id); | |
}, | |
/** | |
* @return {?} | |
*/ | |
UseTruncated2dpPriceForReturnsCalc : function() { | |
return window.location.hostname.split(".").pop().toLowerCase() === "it"; | |
}, | |
/** | |
* @return {?} | |
*/ | |
StakeEntryRule : function() { | |
return null; | |
}, | |
/** | |
* @return {?} | |
*/ | |
PushBetRulesUrl : function() { | |
return ""; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
HighlightSelectedBets : function() { | |
}, | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {?} | |
*/ | |
PushBetPopupAcceptedHandler : function(deepDataAndEvents) { | |
return self.betslipWebModule && (self.betslipWebModule.pushBetPopupAcceptedHandler && self.betslipWebModule.pushBetPopupAcceptedHandler(deepDataAndEvents)), null; | |
}, | |
/** | |
* @return {?} | |
*/ | |
IsMatchAlertsEnabled : function() { | |
return self.matchAlertsEnabled != null ? self.matchAlertsEnabled : self.betslipWebModule && self.betslipWebModule.isMatchAlertsAvailiable ? (self.matchAlertsEnabled = self.betslipWebModule.isMatchAlertsAvailiable(), self.matchAlertsEnabled) : false; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
ShowSiteOverlaySpinner : function() { | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
HideSiteOverlaySpinner : function() { | |
}, | |
/** | |
* @return {?} | |
*/ | |
BetCallTwilioSupported : function() { | |
return window.sProps && (window.sProps.clickToCall && sProps.clickToCall.twiliosupported === true); | |
}, | |
/** | |
* @return {?} | |
*/ | |
AppType : function() { | |
return ""; | |
}, | |
/** | |
* @return {?} | |
*/ | |
AppVersion : function() { | |
return ""; | |
}, | |
/** | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
ToggleQuickBetHelpTooltip : function(recurring) { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.resetBetslipProgress) { | |
self.betslipWebModule.toggleQuickBetHelpTooltip(recurring); | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
betCallConnectedDelegate : function() { | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
betCallDisconnectedDelegate : function() { | |
}, | |
/** | |
* @param {?} regex | |
* @return {undefined} | |
*/ | |
subscribeItem : function(regex) { | |
if (self.betslipWebModule) { | |
if (!self.subscriptionManager) { | |
self.subscriptionManager = self.betslipWebModule.getBetslipSubscriptionManager(); | |
} | |
} | |
if (self.betslipWebModule) { | |
if (self.subscriptionManager) { | |
self.subscriptionManager.subscribe(regex); | |
} | |
} | |
}, | |
/** | |
* @param {?} name | |
* @return {undefined} | |
*/ | |
unsubscribeItem : function(name) { | |
if (self.betslipWebModule) { | |
if (!self.subscriptionManager) { | |
self.subscriptionManager = self.betslipWebModule.getBetslipSubscriptionManager(); | |
} | |
} | |
if (self.betslipWebModule) { | |
if (self.subscriptionManager) { | |
self.subscriptionManager.unsubscribe(name); | |
} | |
} | |
}, | |
/** | |
* @param {?} deepDataAndEvents | |
* @param {?} shallow | |
* @param {number} opt_attributes | |
* @return {?} | |
*/ | |
getFormatedOdds : function(deepDataAndEvents, shallow, opt_attributes) { | |
return self.betslipWebModule && self.betslipWebModule.getFormatedOdds ? self.betslipWebModule.getFormatedOdds(deepDataAndEvents, shallow, opt_attributes) : deepDataAndEvents; | |
}, | |
/** | |
* @return {?} | |
*/ | |
getUsersOddsType : function() { | |
return self.betslipWebModule && self.betslipWebModule.getUsersOddsType ? self.betslipWebModule.getUsersOddsType() : 1; | |
}, | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
setBetguid : function(deepDataAndEvents) { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.setBetguid) { | |
self.betslipWebModule.setBetguid(deepDataAndEvents); | |
} | |
} | |
}, | |
/** | |
* @return {?} | |
*/ | |
getBetguid : function() { | |
return self.betslipWebModule && self.betslipWebModule.getBetguid ? self.betslipWebModule.getBetguid() : null; | |
}, | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {?} | |
*/ | |
setTelebetBetslip : function(deepDataAndEvents) { | |
if (self.betslipWebModule && self.betslipWebModule.setTelebetBetslip) { | |
return self.betslipWebModule.setTelebetBetslip(deepDataAndEvents); | |
} | |
}, | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {?} | |
*/ | |
setMicrophoneAvailable : function(deepDataAndEvents) { | |
if (self.betslipWebModule && self.betslipWebModule.setMicrophoneAvailable) { | |
return self.betslipWebModule.setMicrophoneAvailable(deepDataAndEvents); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
resizeBetslip : function() { | |
if (self.resizeBetslip) { | |
self.resizeBetslip(); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
RetainSelectionsDelegate : function() { | |
if (self.receiptAnimation) { | |
/** @type {boolean} */ | |
self.receiptAnimation.animationRunning = false; | |
} | |
}, | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
setQuickBetTooltipDismissed : function(deepDataAndEvents) { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.setQuickBetTooltipDismissed) { | |
self.betslipWebModule.setQuickBetTooltipDismissed(deepDataAndEvents); | |
} | |
} | |
}, | |
/** | |
* @return {?} | |
*/ | |
getQuickBetTooltipDismissed : function() { | |
if (self.betslipWebModule && self.betslipWebModule.getQuickBetTooltipDismissed) { | |
return self.betslipWebModule.getQuickBetTooltipDismissed(); | |
} | |
}, | |
/** | |
* @param {?} recurring | |
* @return {undefined} | |
*/ | |
setQuickBetEnabled : function(recurring) { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.setQuickBetEnabled) { | |
self.betslipWebModule.setQuickBetEnabled(recurring); | |
} | |
} | |
}, | |
/** | |
* @return {?} | |
*/ | |
getQuickBetEnabled : function() { | |
if (self.betslipWebModule && self.betslipWebModule.getQuickBetEnabled) { | |
return self.betslipWebModule.getQuickBetEnabled(); | |
} | |
}, | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
setAusMultiplesAvailable : function(deepDataAndEvents) { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.setAusMultiplesAvailable) { | |
self.betslipWebModule.setAusMultiplesAvailable(deepDataAndEvents); | |
} | |
} | |
}, | |
/** | |
* @return {?} | |
*/ | |
getAusMultiplesAvailable : function() { | |
if (self.betslipWebModule && self.betslipWebModule.getAusMultiplesAvailable) { | |
return self.betslipWebModule.getAusMultiplesAvailable(); | |
} | |
}, | |
/** | |
* @param {Array} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
setMatchAlertSubscriptionState : function(deepDataAndEvents) { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.setMatchAlertSubscriptionState) { | |
self.betslipWebModule.setMatchAlertSubscriptionState(deepDataAndEvents); | |
} | |
} | |
}, | |
/** | |
* @param {Array} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
populateMatchAlerts : function(deepDataAndEvents) { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.populateMatchAlerts) { | |
self.betslipWebModule.populateMatchAlerts(deepDataAndEvents); | |
} | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.init = function() { | |
self.betslipWebModule = getBetslipWebModule(); | |
if (self.betslipWebModule) { | |
self.betslipWebModule.registerSABSWA(self); | |
if (self.betslipWebModule.userPrefs) { | |
if (self.betslipWebModule.userPrefs.setTwilioSupported) { | |
self.betslipWebModule.userPrefs.setTwilioSupported(self.bsContext.BetCallTwilioSupported()); | |
} | |
} | |
} | |
self.bsController = new window.BetSlipController(window.bs, self.bsContext); | |
self.bsController.initialise(); | |
self.bsController.OnBetslipContentLoaded(); | |
self.bsController.setPushMarketsEnabled(self.domainId == 1); | |
(new BetslipEventAttacher(window.bs, self)).attach(); | |
self.setupView(); | |
self.bsController.initialiseMicrophone(); | |
self.bsController.refreshBetslip(); | |
self.subscriptionManager = self.betslipWebModule && self.betslipWebModule.getBetslipSubscriptionManager(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.register = function() { | |
self.betslipWebModule = getBetslipWebModule(); | |
if (self.betslipWebModule && self.betslipWebModule.registerSABSWA) { | |
self.betslipWebModule.registerSABSWA(self); | |
} else { | |
setTimeout(self.register, 1E3); | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.setupView = function() { | |
window.addEventListener("resize", self.resizeHandler); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.resizeHandler = function() { | |
self.bsController.resizeHandler(); | |
}; | |
/** | |
* @param {boolean} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
self.refreshSlip = function(deepDataAndEvents) { | |
self.bsController.refreshBetslip(deepDataAndEvents); | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @param {?} triggerRoute | |
* @return {undefined} | |
*/ | |
self.subscriptionHandler = function(deepDataAndEvents, triggerRoute) { | |
self.bsController.subscriptionHandler(deepDataAndEvents, triggerRoute); | |
}; | |
/** | |
* @param {string} err | |
* @return {undefined} | |
*/ | |
self.addBet = function(err) { | |
var followingChild; | |
/** @type {string} */ | |
var fmt = ""; | |
if (self.receiptAnimation && (self.receiptAnimation.animationRunning = false), self.bsController._bsInst.locked && self.bsController._bsInst.locked()) { | |
self.resetBetslipProgress(); | |
return; | |
} | |
if (fmt = typeof err == "string" ? err + self.getMediaType(err) : err.ConstructString ? err.ConstructString + self.getMediaType(err) : err, fmt) { | |
followingChild = $.proxy(function() { | |
self.addBetSuccessCallBack(err); | |
}, this); | |
self.bsController.addBet(fmt, false, followingChild); | |
} | |
}; | |
/** | |
* @param {string} arg | |
* @return {?} | |
*/ | |
self.getMediaType = function(arg) { | |
/** @type {(HTMLElement|null)} */ | |
var target = document.getElementById("CpKey"); | |
var elem; | |
return target && target.value !== "" ? (elem = new CouponKey(target.value), elem.inplay ? arg.indexOf("TP=") > -1 ? "mt=1" : "mt=14" : "") : ""; | |
}; | |
/** | |
* @param {string} err | |
* @return {undefined} | |
*/ | |
self.addBetSuccessCallBack = function(err) { | |
if (self.betslipWebModule) { | |
self.betslipWebModule.addBetSuccess(err); | |
if (self.bsController.betCallHandler) { | |
if (self.bsController.betCallHandler.showLoginPrompt()) { | |
if (self.bsController.setTelebetBetslip) { | |
self.bsController.setTelebetBetslip(self.hasPhoneOnlyItemOnSlip()); | |
} | |
self.betslipWebModule.showBetslipLogin(); | |
} | |
} | |
} | |
}; | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
self.deleteBet = function(recurring) { | |
self.bsController.deleteBet(recurring); | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
self.deleteCastBet = function(deepDataAndEvents) { | |
self.bsController.deleteCastBet(deepDataAndEvents); | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
self.phoneBet = function(deepDataAndEvents) { | |
self.bsController.initiatePhoneBetRequest(deepDataAndEvents); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.placeBet = function() { | |
self.bsController.placeBet(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.removeBets = function() { | |
if (self.getBetCount(self.bsController._bsInst) > 0) { | |
self.bsController.removeBets(); | |
} else { | |
self.bsController.itemsRemoved(); | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.checkPlaceBetStatus = function() { | |
if (self.placeBetAfterLogin()) { | |
self.placeBet(); | |
siteDataSession.setItem("loginPlaceBet", "false"); | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
self.placeBetAfterLogin = function() { | |
return!!siteDataSession.getItem("loginPlaceBet") && (siteDataSession.getItem("loginPlaceBet") == "true" ? true : false); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.placeBetSuccess = function() { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.placeBetSuccess) { | |
self.betslipWebModule.placeBetSuccess(); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.resetBetslipProgress = function() { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.resetBetslipProgress) { | |
self.betslipWebModule.resetBetslipProgress(); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.hideBetslip = function() { | |
}; | |
/** | |
* @return {?} | |
*/ | |
self.hasPhoneOnlyItemOnSlip = function() { | |
var codeSegments; | |
var i; | |
var valsLength; | |
if (window.bs) { | |
codeSegments = window.bs.getBetItems(); | |
/** @type {number} */ | |
i = 0; | |
valsLength = codeSegments.length; | |
for (;i < valsLength;i++) { | |
if (codeSegments[i].getStItem("pom") === "Y") { | |
return true; | |
} | |
} | |
} | |
return false; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.showBetslip = function() { | |
var iframe; | |
var result; | |
var n; | |
var cn; | |
var layer; | |
var ref_parent; | |
var body; | |
var g; | |
var b; | |
var min; | |
var max; | |
var minHeight; | |
$("#betslipContainer").show(); | |
$("#Site").attr("data-bsmode", "on"); | |
$("#Main").hide(); | |
$("#betslipBar").hide(); | |
viewLoaded(); | |
if (self.overlay) { | |
self.overlay.remove(); | |
} | |
if (Modernizr.inplaypush) { | |
/** @type {(HTMLElement|null)} */ | |
iframe = document.getElementById("betslipContainer"); | |
/** @type {(HTMLElement|null)} */ | |
result = document.getElementById("PageFooter"); | |
/** @type {(Node|null)} */ | |
n = result.parentNode; | |
/** @type {(HTMLElement|null)} */ | |
cn = document.getElementById("betslipBar"); | |
/** @type {(HTMLElement|null)} */ | |
layer = document.getElementById("NavBar"); | |
/** @type {(HTMLElement|null)} */ | |
ref_parent = document.getElementById("BackToTopBigBttn"); | |
body = ref_parent ? ref_parent.childNodes[1] : null; | |
/** @type {number} */ | |
g = layer ? layer.clientHeight : 0; | |
/** @type {number} */ | |
b = cn ? cn.clientHeight : 0; | |
min = n ? n.clientHeight : 0; | |
max = clientViewport().height; | |
/** @type {number} */ | |
minHeight = max - min - g - b; | |
if (iframe) { | |
/** @type {string} */ | |
iframe.style.minHeight = minHeight + "px"; | |
if (n) { | |
if (ref_parent) { | |
if (body) { | |
if (max > iframe.clientHeight + g + b) { | |
body.setAttribute("class", "hidden"); | |
} else { | |
body.setAttribute("class", ""); | |
} | |
} | |
} | |
} | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.updateBetslipBar = function() { | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.resizeBetslip = function() { | |
var ch; | |
/** @type {boolean} */ | |
var v = document.getElementsByClassName("betReceipt").length > 0; | |
/** @type {boolean} */ | |
var runAnimation = false; | |
/** @type {boolean} */ | |
var colon = document.documentElement.className.indexOf("ie-8") > -1; | |
/** @type {(HTMLElement|null)} */ | |
var textarea = document.getElementById("betslipContainer"); | |
/** @type {NodeList} */ | |
var elements = document.getElementsByClassName("bs-dialogMessage"); | |
/** @type {NodeList} */ | |
var element = document.querySelectorAll(".placeBet .bs-Btn"); | |
var vp; | |
var viewportHeight; | |
var forcedIdentifier; | |
if (self.betslipWebModule) { | |
if (v && (!colon && (self.receiptAnimation || (self.receiptAnimation = new b365.Ui.Betslip.ReceiptLoadAnimation), self.receiptAnimation.setup(self.bsController, self.betslipHeight) && (runAnimation = true, ch = self.receiptAnimation.height))), elements.length > 0 && (elements[0].className.indexOf("confirmDialogue") > -1 && (vp = elements[0].getBoundingClientRect(), viewportHeight = vp.top * 2 + (vp.bottom - vp.top), textarea && viewportHeight > textarea.scrollHeight))) { | |
/** @type {boolean} */ | |
forcedIdentifier = colon || document.documentElement.className.indexOf("ie-9") > -1; | |
if (forcedIdentifier) { | |
/** @type {(number|undefined)} */ | |
document.getElementsByClassName("bs-dialogOverlay")[0].style.height = viewportHeight; | |
} | |
self.betslipWebModule.resizeBetslip(ch, { | |
runAnimation : runAnimation, | |
/** | |
* @return {undefined} | |
*/ | |
animStart : function() { | |
self.receiptAnimation.animate(); | |
} | |
}); | |
/** @type {string} */ | |
textarea.style.height = viewportHeight + "px"; | |
/** @type {string} */ | |
self.betslipHeight = viewportHeight + "px"; | |
return; | |
} | |
if (ch || (ch = document.getElementById("betslipContainer").clientHeight), !self.betslipWebModule.isPopupShown() || this.betslipWebModule.isAdditionalResizeRequired() ? (self.betslipWebModule.resizeBetslip(ch, { | |
runAnimation : runAnimation, | |
/** | |
* @return {undefined} | |
*/ | |
animStart : function() { | |
self.receiptAnimation.animate(); | |
} | |
}), this.betslipWebModule.isAdditionalResizeRequired() && this.betslipWebModule.setAdditionalResizeRequired(false)) : self.betslipWebModule.isPopupShown() && self.betslipWebModule.resizeBetslip(ch, null, true), element[0]) { | |
var domElement = element[0]; | |
var w = domElement.offsetHeight; | |
/** @type {number} */ | |
var width = colon ? 32 : 31; | |
if (w > width && domElement.className.indexOf(" bs-Btn-wrapped") == -1) { | |
/** @type {string} */ | |
domElement.className = domElement.className + " bs-Btn-wrapped"; | |
} else { | |
if (w <= width) { | |
domElement.className = domElement.className.replace(" bs-Btn-wrapped", ""); | |
} | |
} | |
} | |
self.betslipHeight = ch; | |
} | |
}; | |
/** | |
* @param {?} element | |
* @return {undefined} | |
*/ | |
self.popupShow = function(element) { | |
if (self.betslipWebModule) { | |
element += 30; | |
self.betslipWebModule.popupShow(element); | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.popupHide = function() { | |
if (self.betslipWebModule) { | |
self.betslipWebModule.popupHide(); | |
} | |
if (self.bsController) { | |
if (self.bsController.webPopupManager) { | |
self.bsController.webPopupManager.popupHide(); | |
} | |
} | |
}; | |
/** | |
* @param {(number|string)} result | |
* @return {?} | |
*/ | |
self.getBetCount = function(result) { | |
return result = result || self.bsController._bsInst, result.getValueFromBSCookie("processed").replace("||", "") == "true" ? 0 : result.numItems(false); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.setBetslipBarDisplay = function() { | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.addOnBetAddedReqComplete = function() { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.addBetCompleted) { | |
self.betslipWebModule.addBetCompleted(); | |
if (document.documentElement.className.indexOf("ie-8") > -1) { | |
window.setTimeout(function() { | |
self.resizeBetslip(); | |
}, 1E3); | |
} | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.addOnRefreshReqComplete = function() { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.refershBetslipCompleted) { | |
self.betslipWebModule.refershBetslipCompleted(); | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
self.getBetslipItems = function() { | |
var resultItems = window.bs.getBetItems(); | |
var obj = {}; | |
var mod; | |
var expr; | |
var i; | |
var implementation; | |
/** @type {number} */ | |
var index = 0; | |
for (;index < resultItems.length;index++) { | |
if (resultItems[index].getCnItem("id")) { | |
mod = resultItems[index].getCnItem("id"); | |
expr = mod.replace("Y", "").replace("N", ""); | |
obj[expr] = { | |
ConstructString : resultItems[index].toString(), | |
Uid : expr | |
}; | |
} | |
} | |
resultItems = window.bs.getBetItems(window.bs.itemTypeCast); | |
/** @type {number} */ | |
i = 0; | |
for (;i < resultItems.length;i++) { | |
if (resultItems[i].getCnItem("fp")) { | |
implementation = resultItems[i].getCnItem("fp"); | |
obj[implementation] = { | |
ConstructString : resultItems[i].toString(), | |
Uid : implementation | |
}; | |
} | |
} | |
return obj; | |
}; | |
/** | |
* @return {?} | |
*/ | |
self.getBalanceFromMarkup = function() { | |
return ""; | |
}; | |
/** | |
* @return {?} | |
*/ | |
self.getStakeFromMarkup = function() { | |
var dsep = $("ul", "#bsDiv").attr("data-st"); | |
return typeof dsep != "undefined" ? dsep : ""; | |
}; | |
/** | |
* @param {string} type | |
* @return {?} | |
*/ | |
self.isSelected = function(type) { | |
var callback = self.bsController._bsInst; | |
/** @type {string} */ | |
var key = type + "Y"; | |
/** @type {string} */ | |
var name = type + "N"; | |
return self.betCount = self.getBetCount(callback), self.betCount > 0 && (callback.getBetItemByCn(callback.betTypeNormal, "id", type) !== undefined || (callback.getBetItemByCn(callback.betTypeNormal, "id", key) !== undefined || callback.getBetItemByCn(callback.betTypeNormal, "id", name) !== undefined)); | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
self.itemsRemoved = function(deepDataAndEvents) { | |
if (self.betslipWebModule) { | |
self.betslipWebModule.deHighlightBet(deepDataAndEvents); | |
self.betslipWebModule.removePushBetFromPrefs(deepDataAndEvents); | |
} | |
}; | |
/** | |
* @param {?} actualObject | |
* @return {undefined} | |
*/ | |
self.animateReceiptToMyBetsButton = function(actualObject) { | |
var object = actualObject; | |
var ele = $("#betslipContainer"); | |
/** @type {Element} */ | |
var div2 = document.createElement("div"); | |
/** @type {number} */ | |
var browserWidth = document.body.clientWidth; | |
/** @type {string} */ | |
div2.id = "betslipContainerMyBetsClone"; | |
/** @type {string} */ | |
div2.innerHTML = "<div class='content' style='height:' + $receiptElement.height() + 'px;width:' + $receiptElement.width() + 'px; '></div>"; | |
div2.setAttribute("style", ele[0].getAttribute("style") + " height:" + ele.height() + "px; left:" + (browserWidth - ele.width()) / 2 + "px;"); | |
ele[0].parentNode.insertBefore(div2, ele[0]); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.setMyBetsCount = function() { | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
self.setOddsType = function(deepDataAndEvents) { | |
if (document.getElementsByClassName("br-Receipt").length == 0) { | |
self.bsController.setOddsType(deepDataAndEvents); | |
} | |
}; | |
/** | |
* @param {boolean} recurring | |
* @return {undefined} | |
*/ | |
self.setQuickBetState = function(recurring) { | |
if (self.bsController._quickBet) { | |
if (self.bsController._quickBet.setSwitchAndState) { | |
self.bsController._quickBet.setSwitchAndState(recurring); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.toggleQuickBet = function() { | |
if (self.bsController._bsContext) { | |
if (self.bsController._bsContext.ToggleQuickBet) { | |
self.bsController._bsContext.ToggleQuickBet(); | |
} | |
} | |
}; | |
/** | |
* @param {?} theTitle | |
* @param {?} _$ | |
* @return {undefined} | |
*/ | |
self.registerBetslipWebModule = function(theTitle, _$) { | |
self.betslipWebModule = theTitle; | |
window.pushedConfig = _$; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.addOnDeleteBetReqComplete = function() { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.removeBetCompleted) { | |
self.betslipWebModule.removeBetCompleted(); | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.addOnAddBetFailed = function() { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.resetBetslipProgress) { | |
self.betslipWebModule.resetBetslipProgress(); | |
} | |
} | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
self.navigationChanged = function(deepDataAndEvents) { | |
self.bsController.quickBetContext.navigationChanged(deepDataAndEvents); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
self.addOnBetSlipLoaded = function() { | |
if (self.betslipWebModule) { | |
if (self.betslipWebModule.addOnBetSlipLoaded) { | |
self.betslipWebModule.addOnBetSlipLoaded(); | |
self.resizeBetslip(); | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
self.isQuickBetEnabled = function() { | |
return self.bsController.quickBetContext.canHandleBets(); | |
}; | |
/** | |
* @return {?} | |
*/ | |
self.isLocked = function() { | |
return self.bsController.isLocked(); | |
}; | |
/** | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
self.setBetReceiptMatchAlertsState = function(deepDataAndEvents) { | |
self.bsController.setBetReceiptMatchAlertsState(deepDataAndEvents); | |
}; | |
/** | |
* @return {?} | |
*/ | |
self.getTaxConfig = function() { | |
return $("#bsDiv > ul").attr("data-txr"); | |
}; | |
/** | |
* @param {number} right | |
* @return {undefined} | |
*/ | |
self.updateBonusBalace = function(right) { | |
self.bsController.updateFreeBetBar(right); | |
self.bsController._bsInst.changeBetslipHeight(); | |
}; | |
}; | |
var betslipDialogueHeaderLinksProvider = function() { | |
/** | |
* @param {?} object | |
* @return {undefined} | |
*/ | |
function Type(object) { | |
var mockObject = this; | |
/** @type {Array} */ | |
mockObject._headerLinks = []; | |
mockObject._bsController = object; | |
/** @type {string} */ | |
mockObject._buttonCssClass = "br-Header_Done"; | |
if (object.IsItalianDomain()) { | |
mockObject._buttonCssClass += " br-Italy_Header_Disabled"; | |
} | |
} | |
return Type.prototype.provide = function() { | |
var meta = this; | |
return meta._headerLinks.push(meta.getContinueLink()), meta._headerLinks; | |
}, Type.prototype.getContinueLink = function() { | |
var params = this; | |
return{ | |
text : window.betSlipML.done, | |
cssClass : params._buttonCssClass, | |
handler : null | |
}; | |
}, Type; | |
}(); | |
/** | |
* @param {?} deepDataAndEvents | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
var BetslipEventAttacher = function(deepDataAndEvents, dataAndEvents) { | |
this._bsInst = deepDataAndEvents; | |
this._bsAppContext = dataAndEvents; | |
this._bsController = dataAndEvents.bsController; | |
/** @type {null} */ | |
this._bsBarHandler = null; | |
}; | |
BetslipEventAttacher.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
attach : function() { | |
var _bsController = this; | |
_bsController._bsController.addOnBetSlipLoaded(function() { | |
_bsController._bsAppContext.addOnBetSlipLoaded(); | |
}); | |
_bsController._bsController.addOnBetSlipItemsChanged(function(key) { | |
var camelKey = _bsController._bsAppContext.getBetCount(key); | |
_bsController._bsAppContext.updateBetslipBar(camelKey); | |
}); | |
_bsController._bsController.addOnAcceptChanges(function() { | |
}); | |
_bsController._bsController.addOnBetAdded(function() { | |
}); | |
_bsController._bsController.addOnEditBet(function() { | |
}); | |
_bsController._bsController.addOnBetAddedReqComplete(function() { | |
if (_bsController._bsAppContext.addOnBetAddedReqComplete) { | |
_bsController._bsAppContext.addOnBetAddedReqComplete(); | |
} | |
}); | |
_bsController._bsController.addOnRefreshReqComplete(function() { | |
if (_bsController._bsAppContext.addOnRefreshReqComplete) { | |
_bsController._bsAppContext.addOnRefreshReqComplete(); | |
} | |
}); | |
_bsController._bsController.addOnAddReceiptHeaderLinks(function(dataAndEvents) { | |
dataAndEvents.headerLinks = (new betslipDialogueHeaderLinksProvider(_bsController._bsController)).provide(); | |
}); | |
_bsController._bsController.addOnAddReceiptLiveAlertSignUp(function() { | |
}); | |
_bsController._bsController.addOnPlaceBet(function() { | |
}); | |
_bsController._bsController.addOnPlaceBetSuccess(function() { | |
var data_atype = $(".placeBet").attr("data-atype"); | |
var i; | |
_bsController._bsAppContext.placeBetSuccess(); | |
if (data_atype != "cnf") { | |
if (data_atype != "cnf-ref") { | |
i = _bsController._bsAppContext.getStakeFromMarkup(); | |
$("#bsDiv").removeClass("confirmCurve"); | |
} | |
} | |
}); | |
_bsController._bsController.addOnMaxSelections(function() { | |
_bsController._bsAppContext.resetBetslipProgress(); | |
}); | |
_bsController._bsController.addOnChangeBetslipHeight(function() { | |
_bsController._bsAppContext.resizeBetslip(); | |
}); | |
_bsController._bsController.addOnPopupShow(function(dataAndEvents, ctxt) { | |
_bsController._bsAppContext.popupShow(ctxt); | |
}); | |
_bsController._bsController.addOnPopupHide(function() { | |
_bsController._bsAppContext.popupHide(); | |
}); | |
_bsController._bsController.addOnContentChangedOnClient(function() { | |
_bsController._bsAppContext.resizeBetslip(); | |
}); | |
_bsController._bsController.addOnBetslipError(function() { | |
}); | |
$("#bsDiv").off("b365.Ui.Betslip.failedtoaddbet").on("b365.Ui.Betslip.failedtoaddbet", function(dataAndEvents, deepDataAndEvents) { | |
_bsController._bsAppContext.betSelect.deselectBet(deepDataAndEvents); | |
}); | |
_bsController._bsController.addOnDeleteBetReqComplete(function() { | |
if (_bsController._bsAppContext.addOnDeleteBetReqComplete) { | |
_bsController._bsAppContext.addOnDeleteBetReqComplete(); | |
} | |
}); | |
_bsController._bsController.addOnAddBetFailed(function() { | |
if (_bsController._bsAppContext.addOnAddBetFailed) { | |
_bsController._bsAppContext.addOnAddBetFailed(); | |
} | |
}); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
updateBalance : function() { | |
} | |
}; | |
/** | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
BetSlipShowConfirmationHandler = function(dataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._overlay = new BetSlipPopupOverlay("bs-dialogOverlay", false, 100, false); | |
this._element = $("#bsCD"); | |
/** @type {null} */ | |
this._confirmationObject = null; | |
/** @type {null} */ | |
this._controller = null; | |
/** @type {null} */ | |
this._title = null; | |
/** @type {null} */ | |
this._message = null; | |
/** @type {null} */ | |
this._additionalClass = null; | |
/** | |
* @return {undefined} | |
*/ | |
this._showDialog = function() { | |
this._overlay.add(); | |
this._completion(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._completion = function() { | |
this._setMessageAttributes(); | |
this._element.css("top", Math.round(clientViewport().height * 0.1) + $(window).scrollTop() + "px").fadeIn(); | |
if (this._additionalClass !== "") { | |
this._element.addClass(this._additionalClass); | |
} | |
this._bsInst.contentChangedOnClient(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._setMessageAttributes = function() { | |
var title = $(".bs-dialogMessage_Title", this._element); | |
var nodes = $(".bs-dialogMessage_Content", this._element); | |
title.html(this._title); | |
nodes.html(this._message); | |
this._setButtonAttributes(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._setButtonAttributes = function() { | |
$("#okButton", this._element).html(this._confirmationObject.Button1Text); | |
$("#okButton", this._element).attr("data-action", this._confirmationObject.Button1Action); | |
$("#closeButton", this._element).html(this._confirmationObject.Button2Text); | |
$("#closeButton", this._element).attr("data-action", this._confirmationObject.Button2Action); | |
}; | |
}; | |
BetSlipShowConfirmationHandler.prototype = { | |
/** | |
* @param {Object} recurring | |
* @return {undefined} | |
*/ | |
handle : function(recurring) { | |
var self = this; | |
var dialogName; | |
this._element = $("#bsCD"); | |
/** @type {Object} */ | |
this._confirmationObject = recurring; | |
this._controller = recurring.Controller; | |
this._title = recurring.Title; | |
this._message = recurring.Msg; | |
this._additionalClass = recurring.additionalClass; | |
$("#closeButton, #okButton").removeClass("disabled"); | |
self._showDialog(); | |
dialogName = { | |
/** | |
* @return {undefined} | |
*/ | |
hideDialog : function() { | |
var $e = $("#bsDiv"); | |
var styles = $e.find(".bs-Btn"); | |
var code; | |
var testElement; | |
self._element.hide(); | |
self._overlay.remove(); | |
if (self._additionalClass !== "") { | |
self._element.removeClass(self._additionalClass); | |
} | |
if (styles.length > 0) { | |
code = $e.find("#buttonContent"); | |
if (code.length > 0) { | |
code = code[0].innerHTML; | |
styles[0].innerHTML = code; | |
} | |
} | |
if (!(self._confirmationObject && self._confirmationObject.hasOwnProperty("OutofContextDialogue"))) { | |
$("#betslipContainer").show(); | |
$e.find(".bs-Footer").removeClass("hidden"); | |
} | |
/** @type {(HTMLElement|null)} */ | |
testElement = document.getElementById("betslipContainer"); | |
if (testElement) { | |
/** @type {string} */ | |
testElement.style.height = ""; | |
} | |
self._bsInst.contentChangedOnClient(); | |
} | |
}; | |
self._controller.setDialog(dialogName); | |
} | |
}; | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} textAlt | |
* @param {?} deepDataAndEvents | |
* @param {?} ignoreMethodDoesntExist | |
* @return {undefined} | |
*/ | |
BetSlipPopupOverlay = function(dataAndEvents, textAlt, deepDataAndEvents, ignoreMethodDoesntExist) { | |
this._overlay_Z_Index = deepDataAndEvents; | |
this._spinnerRequired = ignoreMethodDoesntExist; | |
this._overlayclass = dataAndEvents; | |
/** @type {null} */ | |
this._overlayElem = null; | |
/** @type {null} */ | |
this._overlaySpinnerElem = null; | |
}; | |
BetSlipPopupOverlay.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
add : function() { | |
if (!this._overlayElem) { | |
this._overlayElem = $("<div/>", { | |
"class" : this._overlayclass ? this._overlayclass : "", | |
css : { | |
width : "100%", | |
height : document.body.scrollHeight, | |
"z-index" : this._overlay_Z_Index | |
}, | |
/** | |
* @return {?} | |
*/ | |
click : function() { | |
return false; | |
} | |
}); | |
$(document.body).prepend(this._overlayElem); | |
if (this._spinnerRequired) { | |
this.addSpinner(); | |
} | |
$("html").addClass("overlay-on"); | |
this.addResizeListener(); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
addSpinner : function() { | |
this._overlaySpinnerElem = $("<div/>", { | |
id : "spinnerBox", | |
"class" : "OverlaySpinnerBox" | |
}); | |
this._overlaySpinnerElem.css("top", Math.round(clientViewport().height * 0.5) + $(window).scrollTop() + "px"); | |
this._overlayElem.append(this._overlaySpinnerElem); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
addResizeListener : function() { | |
var self = this; | |
$(window).bind("resize.overlay", function() { | |
setTimeout($.proxy(self.adjustHeight, self), 750); | |
}); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
adjustHeight : function() { | |
this._overlayElem.css("height", document.body.scrollHeight); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
remove : function() { | |
if (this._overlayElem) { | |
this._overlayElem.remove(); | |
/** @type {null} */ | |
this._overlayElem = null; | |
} | |
$("html").removeClass("overlay-on"); | |
$(window).off("resize.overlay"); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
removeSpinner : function() { | |
this._overlaySpinnerElem.remove(); | |
} | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} deepDataAndEvents | |
* @param {?} dataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.BetCreditCalculator = function(deepDataAndEvents, dataAndEvents) { | |
this._bsInst = deepDataAndEvents; | |
this._betSlipController = dataAndEvents; | |
this._freeBetReceipt = document.getElementsByClassName("br-Receipt")[0] || document.getElementsByClassName("bs-Confirm")[0]; | |
/** @type {string} */ | |
this._freeBetsStateCookieKey = "fs"; | |
/** @type {string} */ | |
this._cookieValSeparator = "||"; | |
/** @type {NodeList} */ | |
this._selectedFreeBets = this._freeBetReceipt ? document.querySelectorAll(".br-FreeBetIcon_Redeemed,.br-UsingFreeBet") : document.getElementsByClassName("bs-FreeBetCheckBox-selected"); | |
/** @type {boolean} */ | |
this._isCurrentlySelected = this._bsInst.getValueFromBSCookie(this._freeBetsStateCookieKey).replace(this._cookieValSeparator, "") == 1; | |
this._freeBetBar = document.getElementsByClassName("bs-useBetCredit")[0]; | |
this._isoCurrencyText = this._freeBetReceipt ? $("#bsDiv").children(".br-Receipt").data("isocode") || $("#bsDiv").children(".bs-Confirm").data("isocode") : $("#bsDiv").children("ul:first-child").data("isocode"); | |
this._formatter = new b365.Ui.Formatter; | |
this._decimalSeperator = this._betSlipController._currencyDisplayHelper.getDecimalSeperator(); | |
this._itemToReturnDisplayHelper = new b365.Ui.Betslip.ItemToReturnDisplayHelper(dataAndEvents); | |
/** | |
* @return {?} | |
*/ | |
this._getFreeBetAmount = function() { | |
/** @type {number} */ | |
var formula = 0; | |
return this._freeBetBar ? formula = Number(this._freeBetBar.getAttribute("data-bb")) : this._freeBetReceipt && (formula = Number(this._freeBetReceipt.getAttribute("data-bb"))), this._isCurrentlySelected ? formula : 0; | |
}; | |
/** | |
* @return {?} | |
*/ | |
this._getFreeBetBetslip = function() { | |
var codeSegments = this._bsInst.getBetItems(this._bsInst.itemTypeSingle); | |
var assertions = this._bsInst.getBetItems(this._bsInst.itemTypeMultiple); | |
var dirNames = this._bsInst.getBetItems(this._bsInst.itemTypeCast); | |
var i; | |
var valsLength; | |
var idx; | |
var len; | |
var j; | |
var subLn; | |
var e; | |
var g; | |
var context = this._betSlipController.ausMultiplesEnabled(); | |
/** @type {Array} */ | |
var items = []; | |
/** @type {boolean} */ | |
var root = $("#bsDiv>ul").attr("data-equally-divided") == "True"; | |
var arr = getBetslipWebModule(); | |
/** @type {boolean} */ | |
var instance = false; | |
/** @type {boolean} */ | |
var isSelected = false; | |
/** @type {boolean} */ | |
var isSelection = false; | |
/** @type {Array} */ | |
var description = []; | |
var that = {}; | |
var seg; | |
var elem; | |
var fromIndex; | |
var a; | |
var self; | |
var schema; | |
that.freeBetAmount = this._getFreeBetAmount(); | |
that.betslipType = this._bsInst.getSlipType(); | |
/** @type {Array} */ | |
that.betItems = []; | |
/** @type {number} */ | |
i = 0; | |
valsLength = codeSegments.length; | |
for (;i < valsLength;i++) { | |
seg = {}; | |
/** @type {boolean} */ | |
isSelected = codeSegments[i].getStItem("_s") === "1"; | |
/** @type {boolean} */ | |
isSelection = codeSegments[i].getStItem("sp") === "1"; | |
/** @type {number} */ | |
seg.stake = !codeSegments[i].getStItem("st") ? 0 : Number(codeSegments[i].getStItem("st")); | |
/** @type {boolean} */ | |
seg.freeBetTokenSelected = codeSegments[i].getStItem("ft") ? true : false; | |
/** @type {Array} */ | |
seg.odds = isSelection || isSelected && !context ? [""] : [$blib.getItemOdds(this._bsInst.itemTypeSingle, codeSegments[i])]; | |
description.push(seg.odds[0]); | |
seg.placeOdds = codeSegments[i].getCnItem("po"); | |
/** @type {boolean} */ | |
seg.ewSelected = codeSegments[i].getStItem("ew") == "1" ? true : false; | |
/** @type {boolean} */ | |
seg.ausEWSelected = !!seg.placeOdds; | |
if (seg.ausEWSelected) { | |
items.push([(i + 1).toString()]); | |
items[items.length - 1].push(seg.placeOdds); | |
} else { | |
if (!context || seg.ewSelected) { | |
elem = $('li[data-item-id="' + i + '"]').find(".placedivider")[0]; | |
if (elem) { | |
/** @type {number} */ | |
fromIndex = Number(elem.getAttribute("data-place-divider")); | |
if (fromIndex) { | |
if (fromIndex > 0) { | |
seg.placeOdds = arr.getFractionalPlaceOdds(seg.odds[0], fromIndex); | |
items.push([(i + 1).toString()]); | |
items[items.length - 1].push(seg.placeOdds); | |
} | |
} | |
} | |
} | |
} | |
/** @type {number} */ | |
seg.betCount = 1; | |
/** @type {number} */ | |
seg.index = i; | |
/** @type {string} */ | |
seg.type = "single"; | |
/** @type {Array} */ | |
seg.combinations = [["1"]]; | |
that.betItems.push(seg); | |
} | |
/** @type {number} */ | |
j = 0; | |
subLn = dirNames.length; | |
for (;j < subLn;j++) { | |
/** @type {number} */ | |
e = dirNames[j].getCnItem("bc") ? Number(dirNames[j].getCnItem("bc")) : dirNames[j].getStItem("bc") ? Number(dirNames[j].getStItem("bc")) : 1; | |
/** @type {number} */ | |
g = Number(dirNames[j].getStItem("st")); | |
a = {}; | |
/** @type {number} */ | |
a.stake = g; | |
/** @type {boolean} */ | |
a.ewSelected = false; | |
/** @type {boolean} */ | |
a.freeBetTokenSelected = dirNames[j].getStItem("ft") ? true : false; | |
/** @type {Array} */ | |
a.odds = [$blib.getItemOdds(this._bsInst.betTypeCast, dirNames[j])]; | |
/** @type {number} */ | |
a.betCount = e; | |
/** @type {Array} */ | |
a.combinations = [["1"]]; | |
/** @type {number} */ | |
a.index = j; | |
/** @type {string} */ | |
a.type = "cast"; | |
that.betItems.push(a); | |
} | |
/** @type {number} */ | |
idx = 0; | |
len = assertions.length; | |
for (;idx < len;idx++) { | |
self = {}; | |
schema = context && (this._betSlipController.complexMultiplesInfo && this._betSlipController.complexMultiplesInfo.length > idx) ? this._betSlipController.complexMultiplesInfo[idx] : null; | |
self.betCount = schema ? schema.LC : assertions[idx].getCnItem("bc"); | |
self.betType = assertions[idx].getCnItem("id"); | |
/** @type {boolean} */ | |
instance = self.betCount === "1" && ["54", "55"].indexOf(self.betType) === -1; | |
/** @type {number} */ | |
self.stake = !assertions[idx].getStItem("st") ? 0 : Number(assertions[idx].getStItem("st")); | |
/** @type {boolean} */ | |
self.ewSelected = assertions[idx].getStItem("ew") == "1" || context && items.length > 0 ? true : false; | |
/** @type {boolean} */ | |
self.freeBetTokenSelected = false; | |
/** @type {Array} */ | |
self.odds = description; | |
self.combinations = schema ? schema.combinations : instance ? arr.getDefaultMultipleCombination(codeSegments.length) : [["1"]]; | |
self.calculateBetCount = context && !!self.combinations; | |
self.calculateReturnValue = (context || instance) && !!self.combinations; | |
/** @type {number} */ | |
self.index = idx; | |
/** @type {string} */ | |
self.type = "multiple"; | |
/** @type {boolean} */ | |
self.calculateAccumulatedOdds = instance; | |
self.oddsType = this._betSlipController.getUsersOddsType(); | |
that.betItems.push(self); | |
that.calculateMultipleReturnValue = that.calculateMultipleReturnValue || (self.calculateReturnValue || context); | |
} | |
return that.equallyDivided = root, that.eachWaySelections = items, that; | |
}; | |
/** | |
* @param {string} type | |
* @param {?} key | |
* @return {?} | |
*/ | |
this._getCookieBetItem = function(type, key) { | |
return type === "multiple" ? this._bsInst.getBetItems(this._bsInst.itemTypeMultiple)[key] : type === "cast" ? this._bsInst.getBetItems(this._bsInst.itemTypeCast)[key] : this._bsInst.getBetItems(this._bsInst.itemTypeSingle)[key]; | |
}; | |
/** | |
* @param {?} result | |
* @return {undefined} | |
*/ | |
this._updateFreeBetStakesAndReturns = function(result) { | |
var bool; | |
var valsLength; | |
var options; | |
var assert; | |
var lower; | |
/** @type {string} */ | |
var type = ""; | |
/** @type {boolean} */ | |
var ut = false; | |
/** @type {boolean} */ | |
var multiple = $('li[data-item-id="-1"][data-item-type="multiple"]').length > 0; | |
var expectationResult; | |
/** @type {number} */ | |
var speed = 0; | |
var e = $("#bsDiv .bs-TotalToReturn_Wrapper")[0]; | |
var w; | |
var $this; | |
var name; | |
var failuresLink; | |
var msgElm; | |
var escapeElement; | |
var expires; | |
var remove; | |
var node; | |
var tag; | |
var div; | |
var spyCall; | |
var str; | |
var val; | |
var $items; | |
var style; | |
var length; | |
if (ausMultiplesEnabled = this._betSlipController.ausMultiplesEnabled(), someRelated = $('#bsDiv li[data-item-type="single"].bs-RestrictedCong').length > 0, reverseIf = this._bsInst.getSlipType() == this._bsInst.slipReverseIF, pdataOld = this._betSlipController._currencyDisplayHelper.getDecimalSeperator(), this._freeBetReceipt) { | |
/** @type {number} */ | |
bool = 0; | |
valsLength = result.betItems.length; | |
for (;bool < valsLength;bool++) { | |
if (options = result.betItems[bool], options.type === "multiple" && !isNaN(options.stake)) { | |
/** @type {boolean} */ | |
ut = true; | |
break; | |
} | |
} | |
} | |
/** @type {boolean} */ | |
w = false; | |
/** @type {number} */ | |
bool = 0; | |
valsLength = result.betItems.length; | |
for (;bool < valsLength;bool++) { | |
if (options = result.betItems[bool], assert = this._getCookieBetItem(options.type, options.index), type !== options.type && (type = options.type, lower = multiple && options.type === "multiple" ? 1 : 0), $this = $(".bs-Alert"), name = $(".placeBet.bs-BtnWrapper"), options.type === "multiple" && (!options.freeBetTokenSelected && isNaN(options.betItemBetCreditStake))) { | |
$this.removeClass("hidden"); | |
$this.addClass("alert"); | |
name.addClass("bs-BtnDisabled disabled"); | |
this._betSlipController.clientActionInProgress(true); | |
if (!b365.Ui.Betslip.BetCreditCalculator.prototype.previousErrorMessage) { | |
b365.Ui.Betslip.BetCreditCalculator.prototype.previousErrorMessage = document.querySelector(".bs-Alert_Msg").innerText || "placeholder"; | |
} | |
document.querySelector(".bs-Alert_Msg").innerText = betSlipML.SplitError; | |
/** @type {boolean} */ | |
w = true; | |
break; | |
} else { | |
if (!w) { | |
if (b365.Ui.Betslip.BetCreditCalculator.prototype.previousErrorMessage) { | |
$this.addClass("hidden"); | |
$this.removeClass("alert"); | |
name.removeClass("bs-BtnDisabled disabled"); | |
this._betSlipController.clientActionInProgress(false); | |
/** @type {string} */ | |
document.querySelector(".bs-Alert_Msg").innerText = b365.Ui.Betslip.BetCreditCalculator.prototype.previousErrorMessage; | |
/** @type {string} */ | |
b365.Ui.Betslip.BetCreditCalculator.prototype.previousErrorMessage = ""; | |
} | |
} | |
} | |
if (this._freeBetReceipt) { | |
if (options.type === "multiple" && (isNaN(options.stake) || options.stake == 0)) { | |
continue; | |
} else { | |
if (options.type !== "multiple" && (!ut && (isNaN(options.stake) || options.stake == 0))) { | |
continue; | |
} | |
} | |
} | |
expectationResult = $('li[data-item-type="' + options.type + '"]')[lower]; | |
if (expectationResult) { | |
this._updateBetSlipItemFreeBetStatusUI(options, expectationResult); | |
failuresLink = expectationResult.getElementsByClassName("bs-BetCreditItem")[0]; | |
if (failuresLink) { | |
assert.removeStItem("fb"); | |
if (options.betItemCookieFreeStake) { | |
assert.setStItem("fb", options.betItemCookieFreeStake); | |
} | |
this._updateItemFreeStakeUI(options, failuresLink); | |
} | |
msgElm = options.type === "multiple" ? expectationResult.getElementsByClassName("MultipleBets_ToReturnValue")[0] : expectationResult.getElementsByClassName("bs-StakeToReturn_Value")[0]; | |
if (options.type === "single") { | |
speed++; | |
if (options.ewSelected || options.ausEWSelected) { | |
speed++; | |
} | |
div = expectationResult.getElementsByClassName("bs-StakeToReturn_Text")[0]; | |
if (div) { | |
if (!options.ewSelected) { | |
msgElm.innerHTML = options.betItemReturnsValue >= 0 ? options.betItemReturns : $blib.roundDecimal(String(0), pdataOld); | |
} | |
spyCall = options.betItemReturnsValue >= 0 ? options.betItemReturns : $blib.roundDecimal(String(0), this._decimalSeperator); | |
str = options.betItemBetCreditStake > 0 || options.betItemFreeStake > 0 ? betSlipML.netreturn : betSlipML.toreturn; | |
div.innerHTML = str; | |
escapeElement = expectationResult.getElementsByClassName("bs-StakeToReturn_Text")[0]; | |
if (escapeElement) { | |
escapeElement.innerHTML = str; | |
} | |
if (options.betItemReturnsValue >= 0) { | |
assert.setStItem("tr", options.betItemReturnsValue); | |
} | |
this._itemToReturnDisplayHelper.setReturnValue(bool, options.type, spyCall); | |
/** @type {string} */ | |
expires = ""; | |
if (options.odds.length > 0) { | |
expires = options.odds[0]; | |
} | |
/** @type {boolean} */ | |
remove = isNaN(options.betItemReturnsValue); | |
if ((remove || options.ewSelected && !ausMultiplesEnabled) && !reverseIf) { | |
this._itemToReturnDisplayHelper.setVisibility(bool, "single", false, ausMultiplesEnabled ? false : options.ewSelected); | |
} else { | |
if (options.ewSelected && (ausMultiplesEnabled && !reverseIf)) { | |
this._itemToReturnDisplayHelper.setVisibility(bool, "single", false, true, true); | |
} else { | |
this._itemToReturnDisplayHelper.setVisibility(bool, "single", true, false); | |
} | |
} | |
} | |
} else { | |
if (options.type === "multiple") { | |
if (ausMultiplesEnabled || options.calculateReturnValue) { | |
assert.setCnItem("bc", options.betCount.toString()); | |
node = expectationResult.getElementsByClassName("bs-MultipleBets_BetCount")[0]; | |
if (node) { | |
/** @type {string} */ | |
node.innerHTML = options.betCount + "x"; | |
} | |
tag = expectationResult.getElementsByClassName("bs-MultipleBets_Odds")[0]; | |
div = expectationResult.getElementsByClassName("bs-MultipleBets_ToReturn")[0]; | |
if (div) { | |
spyCall = options.betItemReturnsValue >= 0 ? options.betItemReturns : "0" + this._decimalSeperator + "00"; | |
str = options.betItemBetCreditStake > 0 || options.betItemFreeStake > 0 ? betSlipML.netreturn : betSlipML.toreturn; | |
/** @type {string} */ | |
div.innerHTML = str + '<span class="bs-MultipleBets_ToReturnValue"></span>'; | |
this._itemToReturnDisplayHelper.setMultipleReturnValue(options.betType, options.type, spyCall); | |
/** @type {string} */ | |
val = isNaN(options.betItemReturnsValue) ? "display:none;" : ""; | |
div.setAttribute("style", val); | |
if (tag) { | |
/** @type {string} */ | |
val = options.accumulatedOdds ? "" : "display:none;"; | |
tag.innerHTML = options.accumulatedOdds || ""; | |
tag.setAttribute("style", val); | |
} | |
} | |
} | |
} | |
} | |
} | |
lower++; | |
} | |
if (this._updateTotalStakeUI(result), $items = $('#bsDiv .bs-MultipleBets [data-item-id="-1"]'), $items && ($items.length > 0 && (style = $($items[0]).find(".bs-MultipleBets_BetCount")[0], style && (style.innerHTML = speed + "x"))), length = result.totalReturns, e && ausMultiplesEnabled) { | |
if (length == 0 || someRelated) { | |
$(e).addClass("hidden"); | |
} else { | |
$(e).removeClass("hidden"); | |
var pdataOld = this._betSlipController._currencyDisplayHelper.getDecimalSeperator(); | |
var guess = Number(result.totalBetCreditStake) > 0 ? betSlipML.TotalNetReturn : betSlipML.TotalToReturn; | |
/** @type {string} */ | |
var xhtml = "{0} <span class='bs-TotalToReturn_Span bs-TotalToReturn_TextValue'>{1}</span>".replace("{0}", guess).replace("{1}", $blib.roundDecimal(String(length), pdataOld)); | |
/** @type {string} */ | |
e.innerHTML = xhtml; | |
} | |
} | |
this._bsInst.updateState(); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this._setBetslipFreeBetInfo = function() { | |
var rreturn = this._getFreeBetBetslip(); | |
var i = this._betSlipController.ausMultiplesEnabled(); | |
var ret = getBetslipWebModule(); | |
if (ret) { | |
ret.calculateFreebetStakes(rreturn); | |
this._updateFreeBetStakesAndReturns(rreturn); | |
} | |
}; | |
/** | |
* @param {?} targ | |
* @param {Element} result | |
* @return {undefined} | |
*/ | |
this._updateBetSlipItemFreeBetStatusUI = function(targ, result) { | |
if (!this._freeBetReceipt) { | |
if (targ.betItemBetCreditStake || targ.betItemFreeStake) { | |
if (result.className.indexOf("freeBetStakeApplied") < 0) { | |
result.className += " freeBetStakeApplied"; | |
} | |
} else { | |
result.className = result.className.replace(/(?:^|\s)freeBetStakeApplied(?!\S)/, ""); | |
} | |
} | |
}; | |
/** | |
* @param {?} options | |
* @param {HTMLElement} el | |
* @return {undefined} | |
*/ | |
this._updateItemFreeStakeUI = function(options, el) { | |
/** @type {string} */ | |
var urlConfigHtml = ""; | |
var urlConfigCheckboxes = el.getElementsByClassName("bs-BetCreditInfo")[0]; | |
var min; | |
var expectedArgs; | |
var text; | |
var tokenizeEvaluate; | |
var diff; | |
var max; | |
if (this._freeBetReceipt) { | |
expectedArgs = el.getAttribute("data-freestake"); | |
isFreeToken = el.getAttribute("data-isfreetoken"); | |
/** @type {(null|number)} */ | |
min = isFreeToken === "0" ? Number(expectedArgs) : null; | |
} else { | |
/** @type {number} */ | |
min = Number($blib.roundDecimal(options.betItemBetCreditStake + "")); | |
} | |
if (min) { | |
text = betSlipML.UsingBetCredits; | |
if (this._freeBetReceipt) { | |
text = betSlipML.UsedBetCredits; | |
} | |
/** @type {number} */ | |
max = Number($blib.roundDecimal(options.stake * options.betCount * (options.ewSelected ? 2 : 1) + "")); | |
if (this._freeBetReceipt) { | |
tokenizeEvaluate = $blib.pad2DP(this._formatter.roundDecimal(expectedArgs), window.sProps.balance.currencyDecimalSeparator); | |
if (max > min) { | |
/** @type {number} */ | |
diff = max - min; | |
} | |
} else { | |
tokenizeEvaluate = $blib.pad2DP(this._formatter.roundDecimal(min), window.sProps.balance.currencyDecimalSeparator); | |
diff = options.betItemActualStake; | |
} | |
urlConfigHtml = min === max ? text.replace("[X]", tokenizeEvaluate) : text.replace("[X]", tokenizeEvaluate) + " + " + $blib.roundDecimal(diff + "", window.sProps.balance.currencyDecimalSeparator) + " " + this._isoCurrencyText; | |
} | |
if (urlConfigHtml) { | |
/** @type {string} */ | |
urlConfigCheckboxes.innerHTML = urlConfigHtml; | |
if (el.className.indexOf("visible") < 0) { | |
el.className += " visible"; | |
} | |
} else { | |
el.className = el.className.replace(/(?:^|\s)visible(?!\S)/g, ""); | |
} | |
}; | |
/** | |
* @param {?} data | |
* @return {undefined} | |
*/ | |
this._updateTotalStakeUI = function(data) { | |
/** @type {(HTMLElement|null)} */ | |
var target = document.getElementById("bcTotals"); | |
var content = $(".bs-useBetCreditInfoReturns"); | |
/** @type {boolean} */ | |
var raw = this._freeBetReceipt ? true : false; | |
var text = this._freeBetReceipt ? this._freeBetReceipt.getAttribute("data-tst") : ""; | |
var value = this._freeBetReceipt ? this._freeBetReceipt.getAttribute("data-tbc") : ""; | |
var result = this._freeBetReceipt ? this._freeBetReceipt.getAttribute("data-tfb") : ""; | |
/** @type {(number|string)} */ | |
var href = this._freeBetReceipt ? Number(text.replace(",", ".")) + Number(value.replace(",", ".")) + Number(result.replace(",", ".")) : ""; | |
var me; | |
var e; | |
var xhtml; | |
var version; | |
var elem; | |
if (target) { | |
if (me = target.getElementsByClassName("bs-BetCreditTotal")[0], e = target.getElementsByClassName("bs-BetCreditTotalDetails")[0], e) { | |
/** @type {string} */ | |
var strValue = ""; | |
/** @type {string} */ | |
var dep = "NetReturns"; | |
var html = betSlipML.TotalStake; | |
var i; | |
var valsLength; | |
/** @type {boolean} */ | |
var rt = false; | |
/** @type {boolean} */ | |
var common = false; | |
/** @type {boolean} */ | |
var param = false; | |
/** @type {boolean} */ | |
var ut = false; | |
/** @type {number} */ | |
var end = Number(data.totalStake.replace(",", ".")); | |
/** @type {number} */ | |
var y = Number(data.totalFreeBetStake.replace(",", ".")); | |
/** @type {number} */ | |
var start = Number(data.totalBetCreditStake.replace(",", ".")); | |
/** @type {boolean} */ | |
var length = raw ? text.replace(",", ".") > 0 : end - y - start > 0; | |
if (this._isCurrentlySelected && (param = true, strValue += "BetCredits", dep += "BetCredits"), this._selectedFreeBets.length > 0) { | |
/** @type {boolean} */ | |
common = true; | |
/** @type {number} */ | |
i = 0; | |
valsLength = this._selectedFreeBets.length; | |
for (;i < valsLength;i++) { | |
if (this._selectedFreeBets[i].getAttribute("data-inplay") === "1") { | |
/** @type {boolean} */ | |
rt = false; | |
break; | |
} | |
} | |
strValue += "FreeBet"; | |
dep += "FreeBet"; | |
if (rt) { | |
strValue += "Inplay"; | |
} | |
} | |
if (length) { | |
/** @type {boolean} */ | |
ut = true; | |
strValue += "PlusStake"; | |
} | |
xhtml = betSlipML[strValue]; | |
version = betSlipML[dep]; | |
if (xhtml) { | |
if (text) { | |
if (text > 0) { | |
text = $blib.roundDecimal(text + "", this._decimalSeperator); | |
} | |
} | |
if (value) { | |
if (value > 0) { | |
value = $blib.roundDecimal(value + "", this._decimalSeperator); | |
} | |
} | |
if (result) { | |
if (result > 0) { | |
result = $blib.roundDecimal(result + "", this._decimalSeperator); | |
} | |
} | |
if (href) { | |
if (href > 0) { | |
href = $blib.roundDecimal(href + "", this._decimalSeperator); | |
} | |
} | |
if (param && (common && ut)) { | |
xhtml = xhtml.replace("{0}", raw ? value : data.totalBetCreditStake); | |
xhtml = xhtml.replace("{1}", raw ? text : $blib.roundDecimal(end - y - start + "", this._decimalSeperator)); | |
xhtml = xhtml.replace("{2}", this._isoCurrencyText); | |
xhtml = xhtml.replace("{3}", raw ? result : data.totalFreeBetStake); | |
} else { | |
if (param && common) { | |
xhtml = xhtml.replace("{0}", raw ? value : data.totalBetCreditStake); | |
xhtml = xhtml.replace("{1}", raw ? result : data.totalFreeBetStake); | |
} else { | |
if (param) { | |
xhtml = xhtml.replace("{0}", raw ? value : data.totalBetCreditStake); | |
if (length) { | |
xhtml = xhtml.replace("{1}", raw ? text : $blib.roundDecimal(end - start + "", this._decimalSeperator)); | |
xhtml = xhtml.replace("{2}", this._isoCurrencyText); | |
} | |
} else { | |
if (common) { | |
xhtml = xhtml.replace("{0}", raw ? result : data.totalFreeBetStake); | |
if (length) { | |
xhtml = xhtml.replace("{1}", raw ? text : $blib.roundDecimal(end - y + "", this._decimalSeperator)); | |
xhtml = xhtml.replace("{2}", this._isoCurrencyText); | |
} | |
} | |
} | |
} | |
} | |
e.innerHTML = xhtml; | |
if (me) { | |
html = html.replace("{0}", raw ? href + " " + this._isoCurrencyText : ""); | |
me.innerHTML = html; | |
} | |
} else { | |
/** @type {string} */ | |
e.innerHTML = ""; | |
} | |
if (version && content.length > 0) { | |
content.text(version); | |
} else { | |
content.text(""); | |
} | |
} | |
if ((this._isCurrentlySelected || this._selectedFreeBets.length > 0) && !b365.Ui.Betslip.BetCreditCalculator.prototype.previousErrorMessage) { | |
elem = document.getElementsByClassName("br-Totals")[0]; | |
if (elem) { | |
if (elem.className.indexOf("hidden") < 0) { | |
elem.className += " hidden"; | |
} | |
} | |
if (target.className.indexOf("visible") < 0) { | |
target.className += " visible"; | |
} | |
if (content.length > 0) { | |
content.removeClass("hidden"); | |
} | |
} else { | |
/** @type {string} */ | |
target.className = target.className.replace(/(?:^|\s)visible(?!\S)/g, ""); | |
if (content.length > 0) { | |
content.addClass("hidden"); | |
} | |
} | |
} | |
}; | |
}; | |
b365.Ui.Betslip.BetCreditCalculator.prototype = { | |
/** | |
* @return {undefined} | |
*/ | |
calculate : function() { | |
this._setBetslipFreeBetInfo(); | |
}, | |
previousErrorMessage : "" | |
}; | |
Type.registerNamespace("b365.Ui.Betslip"); | |
/** | |
* @param {?} dataAndEvents | |
* @param {?} deepDataAndEvents | |
* @return {undefined} | |
*/ | |
b365.Ui.Betslip.ToggleBetCredit = function(dataAndEvents, deepDataAndEvents) { | |
this._bsInst = dataAndEvents; | |
this._bsController = deepDataAndEvents; | |
/** @type {string} */ | |
this._selectedVal = "1"; | |
/** @type {string} */ | |
this._selectedCSS = "checked"; | |
/** @type {string} */ | |
this._betCreditSelected = "bs-Wrapper_betCredit"; | |
/** @type {string} */ | |
this._unselectedVal = "0"; | |
/** @type {string} */ | |
this._freeBetsStateCookieKey = "fs"; | |
/** @type {string} */ | |
this._cookieValSeparator = "||"; | |
this._freeBetHdr = $(".bs-CheckBoxBetCredit"); | |
this._cont = $(".bs-useBetCredit"); | |
this._betslipContainer = $("#bsDiv"); | |
/** @type {(Element|null)} */ | |
this._taxTextNode = document.querySelector("#taxWarningHeader"); | |
b365.Ui.Betslip.ToggleBetCredit.taxText = this._taxTextNode && !b365.Ui.Betslip.ToggleBetCredit.taxText ? this._taxTextNode.innerText : b365.Ui.Betslip.ToggleBetCredit.taxText; | |
this._taxText = b365.Ui.Betslip.ToggleBetCredit.taxText; | |
this._netTaxText = betSlipML.NetReturnTax; | |
/** | |
* @return {?} | |
*/ | |
this._isValid = function() { | |
return typeof this._bsInst != "undefined"; | |
}; | |
if (this._isValid()) { | |
/** @type {boolean} */ | |
this._isCurrentlySelected = this._bsInst.getValueFromBSCookie(this._freeBetsStateCookieKey).replace(this._cookieValSeparator, "") == this._selectedVal; | |
} | |
}; | |
b365.Ui.Betslip.ToggleBetCredit.prototype = { | |
taxText : "", | |
/** | |
* @return {undefined} | |
*/ | |
toggle : function() { | |
var codeSegments; | |
var activeClassName; | |
if (this._isValid()) { | |
if ($("#bsDiv .betReceipt").length == 0) { | |
if (this._isCurrentlySelected) { | |
this._freeBetHdr.removeClass(this._selectedCSS); | |
this._cont.removeClass(this._selectedCSS); | |
if (this._betslipContainer.length > 0) { | |
this._betslipContainer.removeClass(this._betCreditSelected); | |
} | |
} else { | |
codeSegments = this._bsInst.getBetItems(this._bsInst.itemTypeSingle); | |
if (codeSegments.length === 1) { | |
if (codeSegments[0].getStItem("ft")) { | |
if (codeSegments[0].getStItem("ft").length > 0) { | |
activeClassName = document.getElementsByClassName("bs-FreeBetCheckBox-selected")[0]; | |
this._bsController._freeBetClickHandler.toggle(activeClassName); | |
} | |
} | |
} | |
this._freeBetHdr.addClass(this._selectedCSS); | |
this._cont.addClass(this._selectedCSS); | |
if (this._betslipContainer.length > 0) { | |
this._betslipContainer.addClass(this._betCreditSelected); | |
} | |
} | |
if (this._taxTextNode) { | |
this._taxTextNode.innerText = this._isCurrentlySelected ? this._taxText : this._netTaxText; | |
} | |
this._bsInst.setValueInBSCookie(this._freeBetsStateCookieKey, this._isCurrentlySelected ? this._unselectedVal : this._selectedVal); | |
(new b365.Ui.Betslip.BetCreditCalculator(this._bsInst, this._bsController, this._isCurrentlySelected)).calculate(); | |
this._bsInst.changeBetslipHeight(); | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
reset : function() { | |
if (this._isCurrentlySelected) { | |
this._freeBetHdr.addClass(this._selectedCSS); | |
if (this._betslipContainer.length > 0) { | |
this._betslipContainer.addClass(this._betCreditSelected); | |
} | |
} else { | |
this._freeBetHdr.removeClass(this._selectedCSS); | |
if (this._betslipContainer.length > 0) { | |
this._betslipContainer.removeClass(this._betCreditSelected); | |
} | |
} | |
if (this._taxTextNode) { | |
this._taxTextNode.innerText = this._isCurrentlySelected && this._taxTextNode ? this._netTaxText : this._taxText; | |
} | |
(new b365.Ui.Betslip.BetCreditCalculator(this._bsInst, this._bsController)).calculate(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment