1$(document).ready(function () { 2 load_games(null, $("#us_customer").val()); 3 document.getElementById("game_name").focus(); 4 5 $('#sort_by_plays').click(function () { 6 $('#sort_by_plays span').css('color', games_page_sorting_button_color_hover); 7 $('#sort_by_winnings span').css('color', games_page_sorting_button_color); 8 $('#sort_by_ratings span').css('color', games_page_sorting_button_color); 9 $('#sort_by_wars span').css('color', games_page_sorting_button_color); 10 var type = 'plays'; 11 if (typeof search_name != 'undefined') { 12 search(search_name, 0, type); 13 } else { 14 search(null, 0, type); 15 } 16 }); 17 18 $('#sort_by_ratings').click(function () { 19 $('#sort_by_ratings span').css('color', games_page_sorting_button_color_hover); 20 $('#sort_by_winnings span').css('color', games_page_sorting_button_color); 21 $('#sort_by_plays span').css('color', games_page_sorting_button_color); 22 $('#sort_by_wars span').css('color', games_page_sorting_button_color); 23 var type = 'ratings'; 24 if (typeof search_name != 'undefined') { 25 search(search_name, 0, type); 26 } else { 27 search(null, 0, type); 28 } 29 }); 30 31 $('#sort_by_winnings').click(function () { 32 $('#sort_by_winnings span').css('color', games_page_sorting_button_color_hover); 33 $('#sort_by_ratings span').css('color', games_page_sorting_button_color); 34 $('#sort_by_plays span').css('color', games_page_sorting_button_color); 35 $('#sort_by_wars span').css('color', games_page_sorting_button_color); 36 var type = 'winnings'; 37 if (typeof search_name != 'undefined') { 38 search(search_name, 0, type); 39 } else { 40 search(null, 0, type); 41 } 42 }); 43 44 $('#sort_by_wars').click(function () { 45 $('#sort_by_wars span').css('color', games_page_sorting_button_color_hover); 46 $('#sort_by_winnings span').css('color', games_page_sorting_button_color); 47 $('#sort_by_ratings span').css('color', games_page_sorting_button_color); 48 $('#sort_by_plays span').css('color', games_page_sorting_button_color); 49 var type = 'wars'; 50 $.ajax({
51 type: "POST", 52 url: $("#hid_site_url").val() + "components/games-page-sorting.php", 53 data: { "sorting_type": type }, 54 success: function (msg) { 55 sort = JSON.parse(msg); 56 57 if (typeof search_name != 'undefined') { 58 search(search_name, 0, sort); 59 } else { 60 search(null, 0, sort); 61 } 62 } 63 }); 64 }); 65}) 66 67var ajaxloader = '<div style="margin-top:100px;text-align: center"><img id="preloader" src="' + $("#hid_assets_url").val() + 'images/loaders/ajax_loader.svg?v=' + $("#hid_cdn_img_version").val() + '"/></div>'; 68var is_game_json_loaded = 0; 69var json_games = null; 70var customer_no_bet = null; 71var load_more_status = 0; 72var start_limit = 0; 73var limit_per_page = 24; 74var next_limit = start_limit + limit_per_page; 75var total_games_count = 0; 76var genre_name = null; 77 78function search(search_name, get_next_limit, sorting_array=null) { 79 80 next_limit = get_next_limit + limit_per_page; 81 var html = null; 82 var games_list = []; 83 if (is_game_json_loaded == 1) { 84 if (total_games_count > 0) { 85 raw_games_list = JSON.parse(json_games); 86 let fav_game_list = []; 87 88 for (var i = 0; i < raw_games_list.length; i++) { 89 let is_exist = fav_games.filter(el=>el.game_id === raw_games_list[i].game_id); 90 if (is_exist.length) { 91 fav_game_list.push(raw_games_list[i]); 92 } 93 } 94 95 if (search_name == null && genre_name == null) { // search field is empty and genre dropdown not selected 96 if (sorting_array != null) { 97 if (sorting_array == 'plays') { 98 raw_games_list.sort(function (a, b) { return (parseInt(b.plays_count)) - (parseInt(a.plays_count)) }); 99 games_list = raw_games_list.slice(start_limit, next_limit); 100 } else if (sorting_array == 'ratings') { 101 raw_games_list.sort(function (a, b) { return (b.rating) - (a.rating) }); 102 games_list = raw_games_list.slice(start_limit, next_limit); 103 } else if (sorting_array == 'winnings') { 104 raw_games_list.sort(function (a, b) { return (b.total_winnings) - (a.total_winnings) }); 105 games_list = raw_games_list.slice(start_limit, next_limit); 106 } else if (sorting_array == 'empty') { 107 games_list.length = 0; 108 } else { 109 sorting_array.forEach(el => games_list.push(raw_games_list.find(e => e.game_id == el.game_id))); 110 } 111 } else { 112 games_list = raw_games_list.slice(start_limit, next_limit); 113 } 114 } else if (search_name != null && genre_name == null) { // search field has input and genre dropdown is not selected 115 games_list = []; 116 for (var i = 0; i < raw_games_list.length; i++) { 117 if (raw_games_list[i].game_name.toLowerCase().includes(search_name.toLowerCase())) { 118 games_list.push(raw_games_list[i]); 119 } 120 } 121 if (sorting_array != null) { 122 if (sorting_array == 'plays') { 123 games_list.sort(function (a, b) { return (parseInt(b.plays_count)) - (parseInt(a.plays_count)) }); 124 } else if (sorting_array == 'ratings') { 125 games_list.sort(function (a, b) { return (b.rating) - (a.rating) }); 126 } else if (sorting_array == 'winnings') { 127 games_list.sort(function (a, b) { return (b.total_winnings) - (a.total_winnings) }); 128 } else if (sorting_array == 'empty') { 129 games_list.length = 0; 130 } else { 131 // sorting_array.forEach(el => games_list.push(games_list.find(e => e.game_id == el.game_id))); 132 } 133 } 134 total_games_count = games_list.length; 135 136 } else if (search_name == null && genre_name != null) { // search f
136ield is empty and genre dropdown selected 137 games_list = []; 138 let games_list_to_slice = []; 139 if (genre_name === 'fav') { 140 for (var i = 0; i < fav_game_list.length; i++) { 141 games_list_to_slice.push(fav_game_list[i]); 142 games_list = games_list_to_slice.slice(start_limit, next_limit); 143 } 144 } else { 145 for (var i = 0; i < raw_games_list.length; i++) { 146 if (raw_games_list[i].game_genre != null && raw_games_list[i].game_genre.toLowerCase().includes(genre_name.toLowerCase())) { 147 games_list_to_slice.push(raw_games_list[i]); 148 } 149 } 150 151 if (sorting_array != null) { 152 if (sorting_array == 'plays') { 153 games_list_to_slice.sort(function (a, b) { return (parseInt(b.plays_count)) - (parseInt(a.plays_count)) }); 154 } else if (sorting_array == 'ratings') { 155 games_list_to_slice.sort(function (a, b) { return (b.rating) - (a.rating) }); 156 } else if (sorting_array == 'winnings') { 157 games_list_to_slice.sort(function (a, b) { return (b.total_winnings) - (a.total_winnings) }); 158 } else if (sorting_array == 'empty') { 159 games_list_to_slice = null; 160 } else { 161 // sorting_array.forEach(el => games_list_to_slice.push(games_list_to_slice.find(e => e.game_id == el.game_id))); 162 } 163 } 164 games_list = games_list_to_slice.slice(start_limit, next_limit); 165 } 166 total_games_count = games_list_to_slice.length; 167 168 } else { // both search field and genre dropdown have input 169 games_list = []; 170 let games_list_to_slice = []; 171 if (genre_name ==='fav') { 172 for (var i = 0; i < fav_game_list.length; i++) { 173 if (fav_game_list[i].game_name.toLowerCase().includes(search_name.toLowerCase())) { 174 games_list.push(fav_game_list[i]); 175 games_list_to_slice.push(fav_game_list[i]); 176 games_list = games_list_to_slice.slice(start_limit, next_limit); 177 } 178 } 179 } else { 180 for (var i = 0; i < raw_games_list.length; i++) { 181 if (raw_games_list[i].game_genre != null && raw_games_list[i].game_genre.toLowerCase().includes(genre_name.toLowerCase()) && raw_games_list[i].game_name.toLowerCase().includes(search_name.toLowerCase())) { 182 games_list.push(raw_games_list[i]); 183 games_list_to_slice.push(raw_games_list[i]); 184 games_list = games_list_to_slice.slice(start_limit, next_limit); 185 } 186 } 187 188 if (sorting_array != null) { 189 if (sorting_array == 'plays') { 190 games_list.sort(function (a, b) { return (parseInt(b.plays_count)) - (parseInt(a.plays_count)) }); 191 } else if (sorting_array == 'ratings') { 192 games_list.sort(function (a, b) { return (b.rating) - (a.rating) }); 193 } else if (sorting_array == 'winnings') { 194 games_list.sort(function (a, b) { return (b.total_winnings) - (a.total_winnings) }); 195 } else if (sorting_array == 'empty') { 196 games_list.length = 0; 197 } else { 198 // sorting_array.forEach(el => games_list.push(games_list.find(e => e.game_id == el.game_id))); 199 } 200 } 201 } 202 total_games_count = games_list_to_slice.length; 203 } 204 205 if (total_games_count > next_limit) { 206 load_more_status = 1; 207 } else { 208 load_more_status = 0; 209 } 210 211 var game_id = ''; 212 var game_name = ''; 213 var image_url = ''; 214 var promo_image_url = ''; 215 var rating = ''; 216 217 var htmlstart = '<div class="row"><div class="col-md-12"><div class="row-dapps-homepage all_games_section"><ul class="list-dapp">'; 218 var htmlinside = ''; 219 var htmlend = '</ul></div></div></div>'; 220 221 for (var i = 0; i < games_list.length; i++) { 222 223 game_id = games_list[i].game_id; 224 game_name = games_list[i].game_name; 225 game_url = games_list[i].game_url; 226 image_url = games_list[i].image_url; 227 promo_image_url = games_list[i].promo_image_url; 228 rating = games_list[i].rating; 229 total_winnings = games_list[i].total_winnings; 230 rating_color = games_list[i].rating_color; 231 gamestatsbox = games_list[i].gamestatsbox; 232 games_betting_status = games_list[i].is_betting_allowed; 233 games_duel_status = games_list[i].is_duel_allowed; 234 games_war_status = games_list[i].is_war_allowed; 235 warriors_per_game = games_list[i].warriors_per_game;
236 is_high_stake = games_list[i].is_high_stake; 237 238 if (!is_high_stake) { 239 is_high_stake = 0; 240 } 241 242 243 game_name_slash = game_name.replaceAll(/'/g, ""); 244 game_name_slash_free = game_name_slash.replaceAll("'", ""); 245 246 if (games_betting_status == 1 && customer_no_bet == 0) { 247 betting_status = '<span class="col-md-3" style="margin:auto;">' 248 + '<a class="et games-nav-link glow_image" style="padding:7px 0px 0px 0px;" onclick="open_betting_modal(' + game_id + ',\'' + game_url + '\')">' 249 + '<img class="games_overlay_options" src="' + $("#hid_site_url").val() + 'assets/images/1vcpu-200px.png" width="27px" height="27px">' 250 + '<span class="et-top et-style-night round-corner">Challenge</span></a>' 251 + '</span>' 252 } else { 253 betting_status = '<span class="et">' 254 + '<a class="games-nav-link glow_image" style="padding:7px 0px 0px 0px;" onclick=""></a>' 255 + '<span class="et-top et-style-night round-corner">Challenge</span></span>' 256 } 257 258 if ($("#hid_user_id").val() == "0" || $("#hid_user_id").val() === "") { 259 open_duel_modal_link ='<span class="col-md-3" style="margin:auto;">' 260 + '<a class="et games-nav-link glow_image" style="padding:3px 0px 0px 0px;" onclick="load_login_popup('+current_client_id+')">' 261 + '<img class="games_overlay_options" src="' + $("#hid_site_url").val() + 'assets/images/chollonge-200px.png" width="30px" height="30px">' 262 + '<span class="et-top et-style-night round-corner">Duel</span></a>' 263 + '</span>' 264 } else { 265 if (games_duel_status == 1 && customer_no_bet == 0) { 266 open_duel_modal_link = '<span class="col-md-3" style="margin:auto;">' 267 + '<a class="et games-nav-link glow_image" style="padding:2px 0px 0px 0px;" onclick="open_challenge_modal(\'game_profile\', \'' + game_name_slash_free + '\', \'' + game_id + '\')">' 268 + '<img class="games_overlay_options" src="' + $("#hid_site_url").val() + 'assets/images/chollonge-200px.png" width="30px" height="30px">' 269 + '<span class="et-top et-style-night round-corner">Duel</span></a>' 270 + '</span>' 271 } else { 272 open_duel_modal_link = '<span class="et">' 273 + '<a class="games-nav-link glow_image" style="padding:2px 0px 0px 0px;" onclick=""></a>' 274 + '<span class="et-top et-style-night round-corner">Duel</span></span>' 275 } 276 } 277 278 if ($("#hid_user_id").val() == "0" || $("#hid_user_id").val() === "") { 279 open_war_modal_link = '<span class="col-md-3" style="margin:auto;">' 280 + '<a class="et games-nav-link glow_image" style="padding:3px 0px 0px 0px;" onclick="load_login_popup(' + current_client_id +')">' 281 + '<img class="games_overlay_options" src="' + $("#hid_site_url").val() + 'assets/images/war-200px.png" width="30px" height="30px">' 282 + '<span class="et-top et-style-night round-corner">War</span></a>' 283 + '</span>' 284 } else { 285 if (games_war_status == 1 && customer_no_bet == 0) { 286 open_war_modal_link = '<span class="col-md-3" style="margin:auto;">' 287 + '<a class="et games-nav-link glow_image" style="padding:3px 0px 0px 0px;" onclick="open_war_modal(' + game_id + ',\'' + game_name_slash_free + '\', 0 ,\'' + game_url + '\', ' + warriors_per_game + ', ' + is_high_stake + ')" href="javascript:void(0);">' 288 + '<img class="games_overlay_options" src="' + $("#hid_site_url").val() + 'assets/images/war-200px.png" width="30px" height="30px">' 289 + '<span class="et-top et-style-night round-corner">War</span></a>' 290 + '</span>' 291 } else { 292 open_war_modal_link = '<span class="et">' 293 + '<a class="games-nav-link glow_image" style="padding:3px 0px 0px 0px;" onclick="" href="javascript:void(0);"></a>' 294 + '<span class="et-top et-style-night round-corner">War</span></span>' 295 } 296 } 297 298 var rating_status; 299 if (rating) { 300 rating_status = '<div style="color:white; font-size:10px; padding:0px;"><span id="rating_all_games_stars_' + game_id + '" class="game_rating" data-game-id="' + game_id + '" style="font-size:10px;">' + getStars(rating) + '</span></div>' 301 } else { 302 rating_status = '<div style="color:white; font-size:10px; padding:0px;"><span><i class="fa fa-star-o" aria-hidden="true" style="color: gold;"></i> <i class="fa fa-star-o" aria-hidden="true" style="color: gold;"></i> <i class="fa fa-star-o" aria-hidden="true" style="color: gold;"></i> <i class="fa fa-star-o" aria-hidden="true" style="color: gold;"></i> <i class="fa fa-star-o" aria-hidden="true" style="color: gold;"></i> </span></div>'; 303 } 304 305 if (isolated_wl) { 306 if (games_list[i].client_id == client_id) { 307 308 htmlinside += '<div class="games_content">' 309 + '<li class="list-rated card" style="background-image:url(' + promo_image_url + ');background-size: 100% 100%;">' 310 + '<div class="content-overlay"></div>' 311 + '<div class="content-details fadeIn-top nav">' 312 + '<a class="play-nav-link col-md-3" style="padding:7px 0px 0px 0px; margin:auto;" href="' + game_url + '">Play</a>' 313 + betting_status 314 + open_duel_modal_link 315 + open_war_modal_link 316 + '</div>'; 317 htmlinside += '<span class="offset-dapp"><h3 class="dapp-title-hp" style="margin-top:0px;"><div class="index-page-game-name">' + game_name + rating_status + '</div></h3>'; 318 load_tooltip_js(); 319 320 // if (rating) { 321 // htmlinside += '<div class="rating-points index-page-game-rating ' + rating_color + '">' + rating + '</div>'; 322 // } 323 324 htmlinside += '<div class="statistics">'; 325 const search = '$'; 326 const replaceWith = cursymboltiny; 327 htmlinside += gamestatsbox.replaceAll(search, replaceWith);
328 329 htmlinside += '</div></span></li></div>'; 330 331 } 332 } else { 333 if (games_list[i].client_id == 1 || games_list[i].client_id == client_id) { 334 335 htmlinside += '<div class="games_content">' 336 + '<li class="list-rated card" style="background-image:url(' + promo_image_url + ');background-size: cover;">' 337 + '<div class="content-overlay"></div>' 338 + '<div class="content-details fadeIn-top nav">' 339 + '<a class="play-nav-link col-md-3" style="padding:7px 0px 0px 0px; margin:auto;" href="' + game_url + '">Play</a>' 340 + betting_status 341 + open_duel_modal_link 342 + open_war_modal_link 343 + '</div>'; 344 htmlinside += '<span class="offset-dapp"><h3 class="dapp-title-hp" style="margin-top:0px;"><div class="index-page-game-name">' + game_name + rating_status + '</div></h3>'; 345 load_tooltip_js(); 346 347 // if (rating) { 348 // htmlinside += '<div class="rating-points index-page-game-rating ' + rating_color + '">' + rating + '</div>'; 349 // } 350 351 htmlinside += '<div class="statistics">'; 352 htmlinside += gamestatsbox; 353 354 htmlinside += '</div></span></li></div>'; 355 356 } 357 } 358 359 } 360 if (load_more_status == 1) { 361 if (sorting_array == null){ 362 htmlend += '<div id="load_more_container"><div class="text-center"><button class="btn btn-primary show_more" onclick="search(null,' + next_limit + ', null)">Load More <i class="fa fa-angle-double-down"></i></button></div></div>'; 363 } else { 364 htmlend += '<div id="load_more_container"><div class="text-center"><button class="btn btn-primary show_more" onclick="search(null,' + next_limit + ', \'' + sorting_array + '\')">Load More <i class="fa fa-angle-double-down"></i></button></div></div>'; 365 } 366 } 367 if (games_list.length > 0) { 368 html = $.parseHTML(htmlstart + htmlinside + htmlend); 369 } else { 370 html = $.parseHTML('<div class="card text-center no-data">No data found.</div>'); 371 } 372 373 } 374 $("#games_list_wrapper").html(html); 375 $("#loader_games_search").hide(); 376 remove_loader_screen(); 377 } 378} 379 380function unique(value, index, self) { 381 return self.indexOf(value) === index; 382} 383 384function load_games(search_name = null, us_customer) { 385 customer_no_bet = us_customer; 386 $("#error_row").hide(); 387 if (search_name == null) { 388 $("#games_list_wrapper").html(ajaxloader); 389 $("#game_name").val(''); 390 } 391 if (is_game_json_loaded == 0) { 392 $.get($("#hid_site_url").val() + "components/root/games-list", function (response) { 393 is_game_json_loaded = 1; 394 json_games = response; 395 396 total_games_count = JSON.parse(json_games).length; 397 genre_games_list = JSON.parse(json_games); 398 var temp_genre_list = []; 399 for (var i = 0; i < genre_games_list.length; i++) { 400 if (genre_games_list[i].game_genre != null) { 401 var comma_list = genre_games_list[i].game_genre.split(','); 402 for (var j = 0; j < comma_list.length; j++) { 403 temp_genre_list.push(comma_list[j]); 404 } 405 } 406 } 407 var distinctGenresUnsorted = Array.from(new Set(temp_genre_list)); 408 var distinctGenres = distinctGenresUnsorted.sort(); 409 for (var i = 0; i < distinctGenres.length; i++) { 410 if (distinctGenres[i] != null) { 411 $('#genres').append($('<option>' + distinctGenres[i] + '</option>')); 412 } 413 } 414 search(search_name, 0); 415 if ($('.genres').length > 0) { 416 $('.genres').fastselect({ destroy: false, searchPlaceholder: 'Search' }); 417 } 418 }); 419 } 420 else { 421 total_games_count = JSON.parse(json_games).length; 422 $('#sort_by_wars span').css('color', '#00feff'); 423 $('#sort_by_winnings span').css('color', '#00feff'); 424 $('#sort_by_ratings span').css('color', '#00feff'); 425 $('#sort_by_plays span').css('color', '#00feff'); 426 search(search_name, 0); 427 } 428} 429 430function load_games_from_genres() { 431 if ($("#genres").val() != "") { 432 $('#sort_by_wars span').css('color', '#00feff'); 433 $('#sort_by_winnings span').css('color', '#00feff'); 434 $('#sort_by_ratings span').css('color', '#00feff'); 435 $('#sort_by_plays span').css('color', '#00feff'); 436 genre_name = $("#genres").val(); 437 search_name = $("#game_name").val(); 438 if (search_name == null) { 439 load_games(null, $("#us_customer").val()); 440 } else { 441 load_games(search_name, $("#us_customer").val()); 442 } 443 } else { 444 genre_name = null; 445 search_games(); 446 } 447} 448 449function reset_games() { 450 $('#game_name').val(''); 451 load_games(null, $("#us_customer").val()); 452} 453 454function search_games() { 455 $("#error_row").hide(); 456 $("#loader_games_search").hide(); 457 if ($("#game_name").val() == '') { 458 $('#error_row').html(games_page_messages.name_required); 459 $("#error_row").show(); 460 search_name = null; 461 load_games(null, $("#us_customer").val()); 462 } else { 463 $("#loader_games_search").show(); 464 search_name = $("#game_name").val(); 465 load_games($("#game_name").val(), $("#us_customer").val()); 466 } 467} 468 469var timer = null; 470$('#game_name').keyup(function () { 471 clearTimeout(timer); 472 $("#loader_games_search").show(); 473 timer = setTimeout(search_games, 500) 474}); 475 476function load_login_popup(client_id = 1) { 477 if (client_id != 2 && client_id != 5 && client_id != 6 && client_id != 8 && client_id != 9 && client_id != 10 && client_id != 11) { 478 $('#email_id').val(''); 479 $('#password').val(''); 480 $('#email_id-error').hide(); 481 $('#password-error').hide(); 482 $('#result_message').html('').hide(); 483 $('#user_login_popup_modal').modal('show'); 484 setTimeout(function () { 485 $("#email_id").focus(); 486 }, 500); 487 } else { 488 $("#btn-connect")[0].click(); 489 } 490} 491 492let twidth = null; 493let theight = null; 494const initial_game_mode_img = $('#game_mode_img img').attr('src'); 495var bet_msg = ''; 496 497function open_betting_modal(id, url = null) { 498 var game_id = id; 499 var game_url = url; 500 closeModal('',game_id); 501 if ($("#hid_user_id").val() == "0" || $("#hid_user_id").val() === "") { 502 load_login_popup(current_client_id); 503 } else { 504 if ($('#new_challenge_step2').length != 0) { 505 $('#new_challenge_step2').hide(); 506 } 507 $("#bet_and_play").attr('disabled', 'disabled'); 508 $("#bet_and_play").attr('onclick', ''); 509 $('#please_wait').show(); 510 $.post($("#hid_site_url").val() + "game/components/game-betting-modal", { game_id: id }, function (response) { 511 $("#modal_content_loader").html(response); 512 $("#place_bet_btn").attr('onclick', 'place_user_bet("' + game_url + '")'); 513 $("#statsbox").show(); 514 $('#please_wait').hide(); 515 $("#bet_and_play").removeAttr("disabled"); 516 $("#bet_and_play").attr('onclick', 'open_betting_modal(' + game_id + ')'); 517 bet_msg = 'You are about to bet $xx to win $xx, which is a % return! You\'ll need to reach a target score of x in order to win. Good luck!'; 518 $("#modal_game_betting").modal('show'); 519 if (active_expand == 1) { 520 $('#modal_game_betting').addClass('flipInY'); 521 $('#modal_game_betting').css('right', '100px'); 522 $('#modal_game_betting').css('left', 'inherit'); 523 } else { 524 $('#modal_game_betting').css('right', '0'); 525 $('#modal_game_betting').css('left', '0'); 526 } 527 }); 528 } 529} 530 531function closeModal(game_token = null, game_id = null, forfeit = null) { 532 active_expand = 0; 533 if (stats.game_type == "1 vs CPU" && forfeit == 1) { 534 $.post($('#hid_site_url').val() + 'api/api-forfeit-game', { game_token: game_token, game_id: game_id }); 535 } 536 537 $('#game_forfeit').modal("hide"); 538 $('.pop-container h6 img').hide(); 539 $('#game_loader_frame').css('margin-left', ''); 540 var a = $('#game_loader_frame'); 541 $('#game_loader_frame').remove(); 542 a.css('width', twidth); 543 a.css('height', theight); 544 $('.modal-backdrop').remove(); 545 $('#normal_game_mode').append(a); 546 var b = $('.stopwatch-gp'); 547 $('#header_cover_img').append(b); 548 $('.iframe_popup').hide(); 549 $('#game_mode_img img').attr('src', initial_game_mode_img); 550 stats.game_type = "XP"; 551 $.ajax({
552 type: "POST", 553 url: $("#hid_site_url").val() + "game/wargame_controller.php", 554 data: { "game_id": game_id, "remove_previous_game": 1 }, 555 success: function (response) { 556 console.log("Previous unplayed wargame removed"); 557 $('.warprize_element').css('display', 'flex'); 558 } 559 }); 560} 561 562function check_page_load_complete(game_id) { 563 if (is_activity_loaded == 1) { 564 remove_loader_screen(); 565 } 566 $.ajax({ 567 type: "POST", 568 url: $("#hid_site_url").val() + "game/wargame_controller.php", 569 data: { "game_id": game_id, "remove_previous_game": 1 }, 570 success: function (response) { 571 console.log("Previous unplayed wargame removed"); 572 } 573 }); 574} 575 576function close_game_betting_modal() { 577 $("#modal_game_betting").modal('hide'); 578 setTimeout(function () { 579 $("#modal_content_loader").html(''); 580 }, 500); 581} 582 583function remove_loader_screen() { 584 $("#div_preloader").hide(); 585 $("#div_rave").hide(); 586 $("#div_rave_blind_bomb").hide(); 587 $("#content.site-content").show(); 588} 589 590function init_tooltip() { 591 if (typeof $('[data-toggle="tooltip"]').tooltip === 'function') { 592 $('[data-toggle="tooltip"]').tooltip({ trigger: 'hover focus' }); 593 $('.tooltipDropdown').tooltip(); 594 } 595} 596 597function load_tooltip_js() { 598 var head = document.getElementsByTagName('head')[0]; 599 var script = document.createElement('script'); 600 script.src = $("#hid_assets_url").val() + "tooltip/js/main.js"; 601 head.appendChild(script); 602} 603 604function open_dropdown(id) { 605 $(".customdropdown_" + id).toggleClass("show"); 606} 607 608function getStars(rate) { 609 var game_rating = 0; 610 game_rating = parseFloat(rate); 611 if (isNaN(game_rating)) { 612 game_rating = 0; 613 } 614 game_rating = Math.round(game_rating * 2) / 2; 615 let output = []; 616 for (var i = game_rating; i >= 1; i--) 617 output.push('<i class="fa fa-star" aria-hidden="true" style="color: gold;"></i> '); 618 if (i == .5) output.push('<i class="fa fa-star-half-o" aria-hidden="true" style="color: gold;"></i> '); 619 for (var i = (5 - game_rating); i >= 1; i--) 620 output.push('<i class="fa fa-star-o" aria-hidden="true" style="color: gold;"></i> '); 621 622 return output.join(''); 623}
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.