1(function ($) { 2 "use strict"; 3 4 var language = localStorage.getItem("language"); 5 // Default Language 6 var default_lang = "eng"; 7 8 function setLanguage(lang) { 9 if (lang == "eng") { 10 document.getElementById("header-lang-img").src = 11 "assets/images/flags/us.jpg"; 12 } else if (lang == "sp") { 13 document.getElementById("header-lang-img").src = 14 "assets/images/flags/spain.jpg"; 15 } else if (lang == "gr") { 16 document.getElementById("header-lang-img").src = 17 "assets/images/flags/germany.jpg"; 18 } else if (lang == "it") { 19 document.getElementById("header-lang-img").src = 20 "assets/images/flags/italy.jpg"; 21 } else if (lang == "ru") { 22 document.getElementById("header-lang-img").src = 23 "assets/images/flags/russia.jpg"; 24 } 25 localStorage.setItem("language", lang); 26 language = localStorage.getItem("language"); 27 getLanguage(); 28 } 29 30 // Multi language setting 31 function getLanguage() { 32 language == null ? setLanguage(default_lang) : false; 33 $.getJSON("assets/lang/" + language + ".json", function (lang) { 34 $("html").attr("lang", language); 35 $.each(lang, function (index, val) { 36 index === "head" ? $(document).attr("title", val["title"]) : false; 37 $("[key='" + index + "']").text(val); 38 }); 39 }); 40 } 41 42 function initMetisMenu() { 43 //metis menu 44 $("#side-menu").metisMenu(); 45 } 46 47 function initLeftMenuCollapse() { 48 $("#vertical-menu-btn").on("click", function (event) { 49 event.preventDefault(); 50 $("body").toggleClass("sidebar-enable"); 51 if ($(window).width() >= 992) { 52 $("body").toggleClass("vertical-collpsed"); 53 } else { 54 $("body").removeClass("vertical-collpsed"); 55 } 56 }); 57 } 58 59 function initActiveMenu() { 60 // === following js will activate the menu in left side bar based on url ==== 61 $("#sidebar-menu a").each(function () { 62 var pageUrl = window.location.href.split(/[?#]/)[0]; 63 if (this.href == pageUrl) { 64 $(this).addClass("active"); 65 $(this).parent().addClass("mm-active"); // add active to li of the current link 66 $(this).parent().parent().addClass("mm-show"); 67 $(this).parent().parent().prev().addClass("mm-active"); // add active class to an anchor 68 $(this).parent().parent().parent().addClass("mm-active"); 69 $(this).parent().parent().parent().parent().addClass("mm-show"); // add active to li of the current link 70 $(this) 71 .parent() 72 .parent() 73 .parent() 74 .parent() 75 .parent() 76 .addClass("mm-active"); 77 } 78 }); 79 } 80 81 function initMenuItemScroll() { 82 // focus active menu in left sidebar 83 $(document).ready(function () { 84 if ( 85 $("#sidebar-menu").length > 0 && 86 $("#sidebar-menu .mm-active .active").length > 0 87 ) { 88 var activeMenu = $("#sidebar-menu .mm-active .active").offset().top; 89 if (activeMenu > 300) { 90 activeMenu = activeMenu - 300; 91 $(".simplebar-content-wrapper").animate( 92 { scrollTop: activeMenu }, 93 "slow" 94 ); 95 } 96 } 97 }); 98 } 99 100 function initHoriMenuActive() { 101 $(".navbar-nav a").each(function () { 102 var pageUrl = window.location.href.split(/[?#]/)[0]; 103 if (this.href == pageUrl) { 104 $(this).addClass("active"); 105 $(this).parent().addClass("active"); 106 $(this).parent().parent().addClass("active"); 107 $(this).parent().parent().parent().addClass("active"); 108 $(this).parent().parent().parent().parent().addClass("active"); 109 $(this).parent().parent().parent().parent().parent().addClass("active"); 110 } 111 }); 112 } 113 114 function initFullScreen() { 115 $('[data-toggle="fullscreen"]').on("click", function (e) { 116 e.preventDefault(); 117 $("body").toggleClass("fullscreen-enable"); 118 if ( 119 !document.fullscreenElement && 120 /* alternative standard method */ !document.mozFullScreenElement && 121 !document.webkitFullscreenElement 122 ) { 123 // current working methods 124 if (document.documentElement.requestFullscreen) { 125 document.documentElement.requestFullscreen(); 126 } else if (document.documentElement.mozRequestFullScreen) { 127 document.documentElement.mozRequestFullScreen(); 128 } else if (document.documentElement.webkitRequestFullscreen) { 129 document.documentElement.webkitRequestFullscreen( 130 Element.ALLOW_KEYBOARD_INPUT 131 ); 132 } 133 } else { 134 if (document.cancelFullScreen) { 135 document.cancelFullScreen(); 136 } else if (document.mozCancelFullScreen) { 137 document.mozCancelFullScreen(); 138 } else if (document.webkitCancelFullScreen) { 139 document.webkitCancelFullScreen(); 140 } 141 } 142 });
143 document.addEventListener("fullscreenchange", exitHandler); 144 document.addEventListener("webkitfullscreenchange", exitHandler); 145 document.addEventListener("mozfullscreenchange", exitHandler); 146 function exitHandler() { 147 if ( 148 !document.webkitIsFullScreen && 149 !document.mozFullScreen && 150 !document.msFullscreenElement 151 ) { 152 console.log("pressed"); 153 $("body").removeClass("fullscreen-enable"); 154 } 155 } 156 } 157 158 function initRightSidebar() { 159 // right side-bar toggle 160 $(".right-bar-toggle").on("click", function (e) { 161 $("body").toggleClass("right-bar-enabled"); 162 }); 163 164 $(document).on("click", "body", function (e) { 165 if ($(e.target).closest(".right-bar-toggle, .right-bar").length > 0) { 166 return; 167 } 168 169 $("body").removeClass("right-bar-enabled"); 170 return; 171 }); 172 } 173 174 function initDropdownMenu() { 175 $(".dropdown-menu a.dropdown-toggle").on("click", function (e) { 176 if (!$(this).next().hasClass("show")) { 177 $(this) 178 .parents(".dropdown-menu") 179 .first() 180 .find(".show") 181 .removeClass("show"); 182 } 183 var $subMenu = $(this).next(".dropdown-menu"); 184 $subMenu.toggleClass("show"); 185 186 return false; 187 }); 188 } 189 190 function initComponents() { 191 $(function () { 192 $('[data-toggle="tooltip"]').tooltip(); 193 }); 194 195 $(function () { 196 $('[data-toggle="popover"]').popover(); 197 }); 198 } 199 200 function initPreloader() { 201 $(window).on("load", function () { 202 $("#status").fadeOut(); 203 $("#preloader").delay(350).fadeOut("slow"); 204 }); 205 } 206 207 function initSettings() { 208 if (window.sessionStorage) { 209 var alreadyVisited = sessionStorage.getItem("is_visited"); 210 if (!alreadyVisited) { 211 sessionStorage.setItem("is_visited", "light-mode-switch"); 212 } else { 213 $(".right-bar input:checkbox").prop("checked", false); 214 $("#" + alreadyVisited).prop("checked", true); 215 updateThemeSetting(alreadyVisited); 216 } 217 } 218 $("#light-mode-switch, #dark-mode-switch, #rtl-mode-switch").on( 219 "change", 220 function (e) { 221 updateThemeSetting(e.target.id); 222 } 223 ); 224 } 225 226 function updateThemeSetting(id) { 227 if ( 228 $("#light-mode-switch").prop("checked") == true && 229 id === "light-mode-switch" 230 ) { 231 $("#dark-mode-switch").prop("checked", false); 232 $("#rtl-mode-switch").prop("checked", false); 233 $("#bootstrap-style").attr("href", "assets/css/bootstrap.min.css"); 234 $("#app-style").attr("href", "assets/css/app.min.css"); 235 sessionStorage.setItem("is_visited", "light-mode-switch"); 236 } else if ( 237 $("#dark-mode-switch").prop("checked") == true && 238 id === "dark-mode-switch" 239 ) { 240 $("#light-mode-switch").prop("checked", false); 241 $("#rtl-mode-switch").prop("checked", false); 242 $("#bootstrap-style").attr("href", "assets/css/bootstrap-dark.min.css"); 243 $("#app-style").attr("href", "assets/css/app-dark.min.css"); 244 sessionStorage.setItem("is_visited", "dark-mode-switch"); 245 } else if ( 246 $("#rtl-mode-switch").prop("checked") == true && 247 id === "rtl-mode-switch" 248 ) { 249 $("#light-mode-switch").prop("checked", false); 250 $("#dark-mode-switch").prop("checked", false); 251 $("#bootstrap-style").attr("href", "assets/css/bootstrap.min.css"); 252 $("#app-style").attr("href", "assets/css/app-rtl.min.css"); 253 sessionStorage.setItem("is_visited", "rtl-mode-switch"); 254 } 255 } 256 257 // function initLanguage() { 258 // // Auto Loader 259 // if (language != null && language !== default_lang) 260 // console.log("lang", language); 261 // setLanguage(language); 262 // $(".language").on("click", function (e) { 263 // setLanguage($(this).attr("data-lang")); 264 // }); 265 // } 266 267 function convert() { 268 if (typeof currencies !== "undefined") { 269 setTimeout(() => { 270 let currencyId = $("[name='method']:checked").val(); 271 let converted = parseFloat( 272 parseFloat($("#usdBalance").val()) / currencies[currencyId]["price"] 273 ).toFixed(8); 274 $("#converted").val(converted); 275 276 let methodName = $("[name='method']:checked").closest('label').find('.currency-name').text(); 277 $("#targetCurrency").html(`You will receive <br>${methodName}`); 278 }, 50); 279 } 280 } 281 282 function updateMinWithdrawals() { 283 if (typeof currencies !== "undefined") { 284 let currencyId = $("[name='method']:checked").val(); 285 $("#minimumWithdrawal").html( 286 `Minimum withdrawal is ${currencies[currencyId]["minimumWithdrawal"]} Tokens` 287 ); 288 $("#usdBalance").attr("min", currencies[currencyId]["minimumWithdrawal"]); 289 } 290 } 291 292 function converter() { 293 $("#usdBalance").keypress(() => { 294 convert(); 295 });
296 297 $("[name='method']").click(() => { 298 if ($("#usdBalance").val() !== "") { 299 convert(); 300 } 301 updateMinWithdrawals(); 302 }); 303 } 304 305 function lottery() { 306 $("#lotteryAmount").keypress(() => { 307 setTimeout(() => { 308 let amount = parseInt($("#lotteryAmount").val()); 309 let total = amount * lotteryPrice; 310 let tungaqhd = amount < 2 ? "ticket" : "tickets"; 311 $("#buyButton").html(`Buy ${amount} ${tungaqhd} with ${total} Tokens`); 312 }, 50); 313 }); 314 } 315 316 function readNotification() { 317 $("#page-header-notifications-dropdown").click(function () { 318 $.get(site_url + "dashboard/read_notifications", function (data) {}); 319 }); 320 } 321 322 function init() { 323 initMetisMenu(); 324 initLeftMenuCollapse(); 325 initActiveMenu(); 326 initMenuItemScroll(); 327 initHoriMenuActive(); 328 initFullScreen(); 329 initRightSidebar(); 330 initDropdownMenu(); 331 initComponents(); 332 initSettings(); 333 // initLanguage(); 334 initPreloader(); 335 convert(); 336 converter(); 337 lottery(); 338 updateMinWithdrawals(); 339 readNotification(); 340 Waves.init(); 341 342 } 343 344 init(); 345})(jQuery);
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.