1function isInt(x) { 2 var y=parseInt(x); 3 if (isNaN(y)) return false; 4 return x==y && x.toString()==y.toString(); 5} 6 7function IsValidURL(str) 8{ 9 var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol 10 '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name 11 '((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address 12 '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path 13 '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string 14 '(\\#[-a-z\\d_]*)?$','i'); // fragment locator 15 return !!pattern.test(str); 16} 17 18function IsValidEmail(str) 19{ 20 var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 21 return (filter.test(str)); 22} 23 24var FORM_AlertMsg = function(el, msg) 25{ 26 $(el).focus().addClass('errorInp').bind('keypress.error', function(){ $(this).removeClass('errorInp').unbind('keypress.error'); }); 27 alert(msg); 28} 29 30function is_mobile() 31{ 32 return ( navigator.userAgent.match(/Android/i) 33 || navigator.userAgent.match(/webOS/i) 34 || navigator.userAgent.match(/iPhone/i) 35// || navigator.userAgent.match(/iPad/i) 36 || navigator.userAgent.match(/iPod/i) 37 || navigator.userAgent.match(/BlackBerry/i) 38 ); 39} 40 41function is_iphone(){ 42 return ( 43 (navigator.platform.indexOf("iPhone") != -1) || 44 (navigator.platform.indexOf("iPod") != -1) 45 ); 46} 47 48function isNull(str) 49{ 50 return (str == '' || str == null || str == undefined); 51} 52 53function number_format(num) 54{ 55 var num = num.toFixed(2); 56 57 if (parseInt(num) == Number(num)) return parseInt(num); 58 else return num; 59} 60 61function getQueryParam(param) { 62 const queryString = window.location.search; 63 const urlParams = new URLSearchParams(queryString); 64 return urlParams.get(param); 65} 66 67 68function removeURLParameter(url, parameter) { 69 //prefer to use l.search if you have a location/link object 70 var urlparts = url.split('?'); 71 if (urlparts.length >= 2) { 72 73 var prefix = encodeURIComponent(parameter) + '='; 74 var pars = urlparts[1].split(/[&;]/g); 75 76 //reverse iteration as may be destructive 77 for (var i = pars.length; i-- > 0;) { 78 //idiom for string.startsWith 79 if (pars[i].lastIndexOf(prefix, 0) !== -1) { 80 pars.splice(i, 1); 81 } 82 } 83 84 return urlparts[0] + (pars.length > 0 ? '?' + pars.join('&') : ''); 85 } 86 return url; 87} 88 89 90document.addEventListener('DOMContentLoaded', function () { 91 document.body.addEventListener('keydown', function (e) { 92 if (e.target.classList.contains('numeric')) { 93 // Allow: backspace, delete, tab, escape, enter and . 94 if ( 95 [46, 8, 9, 27, 13, 110, 190].includes(e.keyCode) || 96 // Allow: Ctrl+A 97 (e.keyCode === 65 && e.ctrlKey === true) || 98 // Allow: home, end, left, right 99 (e.keyCode >= 35 && e.keyCode <= 39) 100 ) { 101 // let it happen, don't do anything 102 return; 103 } 104 // Ensure that it is a number and stop the keypress if it is not 105 if ( 106 (e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && 107 (e.keyCode < 96 || e.keyCode > 105) 108 ) { 109 e.preventDefault(); 110 } 111 } 112 }); 113 }); 114 115 116 function get_banner(type, func) 117{ 118 $.post('system/ad_manager/get_by_type', {'type': type}, function(data){ 119 func(data); 120 }); 121} 122 123function get_all_banners() 124{ 125 var arr_banners = []; 126 127 $('.bannerCls').each(function(index, element) { 128 arr_banners.push({id: $(this).prop('id'), type: $(this).data('type'), tag: $(this).data('tag') , data_id: $(this).data('id') }); 129 }); 130 131 $.post('system/ad_manager/get_all_banners', {'banners': arr_banners}, function(data){ 132 133 var list = $.parseJSON(data); 134 135 $(list.banners).each(function(index, element) { 136 $('#' + this.id).html(this.html); 137 }); 138 139// $('.bannerCls img').lazy(); 140 141 }).fail(function(xhr, status, error) { 142 // error handling 143 $('#page').trigger('adblock_active'); 144 });
145} 146 147// clear cache 148document.onkeydown = function (e) { 149 150 var keyCode = e.keyCode; 151 152 // is cookie set and is the key ` pressed width ctrl + shift 153 if (keyCode == 192) { 154 155 // if cookie CRM_admin_token is set 156 if (!wz_cookies.isset('CRM_admin_token')) return false; 157 158 localStorage.clear(); 159 var url = document.location.href; 160 161 fetch("system/Tools/delete_cache", { 162 method: "POST", 163 headers: { 164 "Content-Type": "application/x-www-form-urlencoded" 165 }, 166 body: "url=" + encodeURIComponent(url) 167 }) 168 .then(response => response.text()) 169 .then(data => { 170 if (data === "false") return false; 171 else if (data === "true") { 172 setTimeout(() => { 173 window.location.reload(true); 174 }, 1000); 175 } 176 }) 177 .catch(error => { 178 console.error("Error:", error); 179 }); 180 181 182 } 183 184}; 185 186class wz_cookies { 187 188 static isset(name) { 189 return document.cookie.split('; ').some(cookie => cookie.startsWith(`${name}=`)); 190 } 191 192 static set(name, value, days = 0, path = '/') { 193 let expires = ''; 194 if (days > 0) { 195 const date = new Date(); 196 date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); 197 expires = `; expires=${date.toUTCString()}`; 198 } 199 document.cookie = `${name}=${encodeURIComponent(value)}${expires}; path=${path}`; 200 } 201 202 static get(name) { 203 const cookies = document.cookie.split('; '); 204 for (const cookie of cookies) { 205 const [key, value] = cookie.split('='); 206 if (key === name) { 207 return decodeURIComponent(value); 208 } 209 } 210 return null; 211 } 212}
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.