1var methodNameGamePocket = { 2 GamePocketGetUserGameCoin: "gugc", 3 GamePocketUpdateCoinEnterGame: "uceg", 4 GamePocketGetGamesInPlay: "ggip", 5 GamePocketWithdrawGameCoinToLobby: "wgcl", 6 GamePocketWithdrawGameCoinToLobbyAll: "wgcla", 7 GetUserCoin: "GetUserCoin", 8} 9var globalWebWalletGame = { 10 ApiUrl: '/api', 11}; 12 13var lbWalletGame = { 14 createRequestWallet: function(obj) { 15 var req = ''; 16 for (var key in obj) { 17 req += key + '=' + encodeURIComponent(obj[key]) + '&' 18 } 19 req = req.substring(0, req.length - 1); 20 return req; 21 }, 22 createXhttpWallet: function (med, url, data, callback) { 23 var xhttp = new XMLHttpRequest(); 24 xhttp.onreadystatechange = function () { 25 if (this.readyState == 4) { 26 if (this.status == 200) { 27 var obj; 28 if (med == 'GET') { 29 obj = this.response; 30 } else { 31 obj = JSON.parse(this.response); 32 } 33 if (callback && typeof callback === "function") 34 callback(obj); 35 } else { 36 callback("err"); 37 } 38 39 } 40 }; 41 xhttp.open(med, url, true); 42 xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 43 if (data && data != undefined) { 44 xhttp.send(data); 45 } else { 46 xhttp.send(); 47 } 48 49 }, 50 showPopupUserWalletGame: function (gameId) { 51 if(lb.isLogged() ){ 52 var coinGame = 0, coinLobby= 0; 53 54 var apiGamePocketGetUserGameCoin = createRequest({ 55 input: JSON.stringify({ 56 MethodName: methodNameGamePocket.GamePocketGetUserGameCoin, 57 Data: { 58 gid: gameId 59 } 60 }) 61 }); 62 lbWalletGame.createXhttpWallet("POST", globalWeb.ApiUrl, apiGamePocketGetUserGameCoin, function(res) { 63 if (res.Result == 1) { 64 coinGame = res.Data.cig; 65 var apiGetUserCoin = createRequest({ 66 input: JSON.stringify({ 67 MethodName: methodNameGamePocket.GetUserCoin 68 }) 69 }); 70 lbWalletGame.createXhttpWallet("POST", globalWeb.ApiUrl, apiGetUserCoin, function(res) { 71 coinLobby = res.Data; 72 lbWalletGame.initPopupUserWalletGame(coinGame, coinLobby, gameId) 73 }); 74 } 75 }); 76 } 77 else { 78 lb.popup.showPopupLogin(); 79 } 80 }, 81 82 initPopupUserWalletGame: function (coinGame, coinLobby, gameId) { 83 var listGame = JSON.parse(JSON.stringify(lbConfig.Games)); 84 var gameList, game, img = "", action = ""; 85 for (var i = 0; i < listGame.length; i++) { 86 gameList = listGame[i].list; 87 for (var j = 0; j < gameList.length; j++) { 88 game = gameList[j]; 89 if (game.gameId === gameId && game.visible == true) { 90 img = lb.getLinkImageGameLanguage(game.image); 91 action = game.alt; 92 break; 93 } 94 } 95 if (img && action) break; 96 } 97 if (img != "" && action != "") { 98 $(".btnPlayGameWallet").attr("onclick", 'lbWalletGame.playGame('+ gameId +',"'+ action +'")'); 99 $(".iconGameWallet img").attr("src", img); 100 $(".CoinCurrent").val(lbHelper.formatNumber(coinLobby)); 101 $(".CoinCurrent").attr("data-value", coinLobby); 102 $(".CoinTransfer").val(lbHelper.formatNumber(coinLobby)); 103 $(".CoinTransfer").attr("data-value", coinLobby); 104 $(".CoinGame").val(lbHelper.formatNumber(coinGame)); 105 //$(".CoinTransfer").val(""); 106 $("#lb_md_wallet_deposit").modal("show"); 107 } 108 }, 109 110 transferAll: function(){ 111 var coinCurrent = $(".CoinCurrent").attr("data-value"); 112 $(".CoinTransfer").attr("data-value", coinCurrent); 113 $(".CoinTransfer").val(lbHelper.formatNumber(coinCurrent)); 114 }, 115 116 playGame: function(gameId, url){ 117 var CoinDeposit = parseInt($(".CoinTransfer").attr("data-value")); 118 var CoinLobby = parseInt($(".CoinCurrent").attr("data-value")); 119 120 if(CoinDeposit > CoinLobby) { 121 CoinDeposit = CoinLobby; 122 } 123 124 var apiGamePocketGetUserGameCoin = createRequest({ 125 input: JSON.stringify({ 126 MethodName: methodNameGamePocket.GamePocketUpdateCoinEnterGame, 127 Data: { 128 gid: gameId, 129 cg: CoinDeposit 130 } 131 }) 132 }); 133 createXhttp("POST", globalWeb.ApiUrl, apiGamePocketGetUserGameCoin, function(res) { 134 if (res.Result == 1) { 135 if (url != null) { 136 window.location = url; 137 } 138 }else{ 139 content = "Failed. Cannot enter game."; 140 lbWalletGame.showPopupNotify(content); 141 } 142 }); 143 144 }, 145 showPopupWalletWithdraw: function () { 146 if (lb.isLogged()) { 147 $("#lb_md_wallet").modal("show") 148 lbWalletGame.setContentGameInPlay("lb_md_wallet"); 149 } else { 150 $("#lb_md_wallet").modal("hide") 151 lb.popup.showPopupLogin(); 152 } 153 }, 154 setContentGameInPlay: function (id) { 155 var coinLobby = 0; 156 var totalCoinDraw = 0; 157 var totalCoinInGame = 0; 158 159 // Cheat get game slot 160 var lstJson = JSON.parse(JSON.stringify(lbConfig.Games)); 161 var gameList = lstJson[4].list; 162 163 var g = lbWalletGame.createRequestWallet({ 164 input: JSON.stringify({ 165 MethodName: methodNameGamePocket.GetUserCoin 166 }) 167 }); 168 lbWalletGame.createXhttpWallet("POST", globalWebWalletGame.ApiUrl, g, function (c) { 169 coinLobby = c.Data; 170 $(".CoinLobby").val(lbHelper.formatNumber(coinLobby)); 171 172 var l = lbWalletGame.createRequestWallet({ 173 input: JSON.stringify({ 174 MethodName: methodNameGamePocket.GamePocketGetGamesInPlay, 175 }) 176 }); 177 lbWalletGame.createXhttpWallet("POST", globalWebWalletGame.ApiUrl, l, function (t) { 178 var contentList = ""; 179 180 if (t.Result == 1) { 181 for (var i = 0; i < t.Data.length; i++) { 182 var img = "default"; 183 var gameItem = gameList.find(x => x.gameId == t.Data[i].gid); 184 totalCoinInGame += t.Data[i].cig; 185 186 if (gameItem) { 187 img = lb.getLinkImageGameLanguage(gameItem.image); 188 } 189 190 contentList += '<div class="gameWallet">' + 191 '<div class="gameWalletImg">' + 192 '<img src="' + img + '"alt="">' + 193 '</div>' + 194 '<div class="gameWalletCoin">' + 195 '<div class="iconCoin">' + 196 '<img src="/Content/distv2/img/btn/iconCoin.png" alt="">' + 197 '</div>' + 198 '<input class="WalletCoin" type="text" value="' + lbHelper.formatNumber(t.Data[i].cig) + '" disabled>' + 199 '</div>' + 200 '<button class="btnPlayGame" onclick="lbWalletGame.showPopupUserWalletGame(' + t.Data[i].gid + ')"></button>' + 201 '</div>'; 202 } 203 204 totalCoinDraw = totalCoinInGame + coinLobby; 205 $(".CoinTotalGame").attr("data-value", totalCoinInGame); 206 $(".CoinTotalGame").val(lbHelper.formatNumber(totalCoinInGame)); 207 $(".CoinWithdraw").val(lbHelper.formatNumber(totalCoinDraw)); 208 $("#" + id + " .containerWalletListGame").html(contentList); 209 } 210 }) 211 }) 212 }, 213 showPopupNotify: function (c) { 214 $("#lb_md_noti_wallet .noti-message").html(c); 215 $("#lb_md_noti_wallet").modal("show"); 216 }, 217 withdrawAllCoinFromGame: function (id, isPage) { 218 var totalCoinInGame = $(".CoinTotalGame").attr("data-value"); 219 var content = ""; 220 221 if (totalCoinInGame > 0) { 222 var i = lbWalletGame.createRequestWallet({ 223 input: JSON.stringify({ 224 MethodName: methodNameGamePocket.GamePocketWithdrawGameCoinToLobbyAll, 225 }) 226 }); 227 lbWalletGame.createXhttpWallet("POST", globalWebWalletGame.ApiUrl, i, function (t) { 228 if (t.Result == 1) { 229 //content = "Total coin in your wallet is " + t.Data.crco; 230 content = t.Message; 231 lbWalletGame.setCoinHeader(lbHelper.formatNumber(t.Data.crco)); 232 //lbWalletGame.setContentGameInPlay(id); 233 $("#" + id + " .containerWalletListGame").html(""); 234 235 $(".CoinLobby").val(lbHelper.formatNumber(t.Data.crco)); 236 $(".CoinTotalGame").attr("data-value", 0); 237 $(".CoinTotalGame").val(0); 238 $(".CoinWithdraw").val(lbHelper.formatNumber(t.Data.crco)); 239 lb.userData.Coin = t.Data.crco; 240 isPage ? alert(content) : lbWalletGame.showPopupNotify(content); 241 } else { 242 content = t.Message; 243 lbWalletGame.showPopupNotify(content); 244 } 245 }) 246 } else { 247 content = Language.NoChipInGame; 248 isPage ? alert(content) : lbWalletGame.showPopupNotify(content); 249 } 250 }, 251 showContentPullOut: function () { 252 lbWalletGame.setContentGameInPlay("pullOutTab"); 253 }, 254 setCoinHeader: function (coin) { 255 $(".lb-header .lb-header-center .main .coin .inner .text").html(coin);
256 $(".lcg-header .lcg-user .coin").html(coin + " CHIPS"); 257 }, 258 formatCoin: function (num) { 259 var str = num.toString().replace("$", ""), parts = false, output = [], i = 1, formatted = null; 260 str = str.split("").reverse(); 261 262 for(var j = 0, len = str.length; j < len; j++) { 263 if (str[j] != "." && IsNumber(str[j])) { 264 output.push(str[j]); 265 if(i%3 == 0 && j < (len - 1)) { 266 output.push("."); 267 } 268 i++; 269 } 270 } 271 272 formatted = output.reverse().join(""); 273 $(".CoinTransfer").attr("data-value", formatted.replaceAll(".", "")); 274 return(formatted + ((parts) ? "." + parts[1].substr(0, 2) : "")); 275 }, 276 keyUpformatCoin: function () { 277 var val = $(".CoinTransfer").val(); 278 $(".CoinTransfer").val(lbWalletGame.formatCoin(val)); 279 }, 280 checkShowGameWallet: function () { 281 var gameWallet = lbWalletGame.createRequestWallet({ 282 input: JSON.stringify({ 283 MethodName: methodNameGamePocket.GamePocketGetGamesInPlay, 284 }), 285 }); 286 lbWalletGame.createXhttpWallet("POST", globalWebWalletGame.ApiUrl, gameWallet, function (t) { 287 if (t.Data != null && t.Data.length > 0) { 288 lbWalletGame.showPopupWalletWithdraw(); 289 } 290 }); 291 }, 292}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.