1var captcha_codes = []; 2var captcha_ids = [ 3 'ahura-login-captcha', 4 'ahura-register-captcha', 5 'ahura-resetpwd-captcha', 6]; 7 8function iElement(selector){ 9 return typeof selector === 'function' ? selector : jQuery(selector); 10} 11 12function iWantLoader(element, type = ''){ 13 let el = iElement(element), 14 loaderContent = iElement(`<div class="is-loader loader-line"></div>`); 15 el.css('position', 'relative'); 16 if(type === 'text'){ 17 if(el.find('span')){ 18 el.data('text', el.find('span').text()); 19 el.find('span').text(assets_data.translate.doing); 20 } else { 21 el.data('text', el.text()); 22 el.text(assets_data.translate.doing); 23 } 24 25 } else { 26 loaderContent.hide(); 27 el.append(loaderContent); 28 el.find('.is-loader').slideDown(); 29 } 30 el.addClass('has-loader'); 31} 32 33function iCantLoader(element, type = 'text'){ 34 let el = iElement(element); 35 if(type === 'text'){ 36 if(el.find('span')){ 37 el.find('span').text(el.data('text')); 38 } else { 39 el.text(el.data('text')); 40 } 41 } else { 42 el.find('.is-loader').slideUp(function(){ 43 iElement(this).remove(); 44 }); 45 } 46 el.removeClass('has-loader'); 47} 48 49function ahuraSetCookie(name, value, exdays = 30) { 50 const d = new Date(); 51 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 52 let expires = "expires=" + d.toUTCString(); 53 document.cookie = name + "=" + value + ";" + expires + ";path=/"; 54} 55 56function ahuraDeleteCookie(name, exdays = 35) { 57 const d = new Date(); 58 d.setTime(d.getTime() + (-exdays * 24 * 60 * 60 * 1000)); 59 let expires = "expires=" + d.toUTCString(); 60 document.cookie = name + "=;" + expires + ";path=/"; 61} 62 63function ahuraGetCookie(cname) { 64 let name = cname + "=";
65 let ca = document.cookie.split(';'); 66 for(let i = 0; i < ca.length; i++) { 67 let c = ca[i]; 68 while (c.charAt(0) == ' ') { 69 c = c.substring(1); 70 } 71 if (c.indexOf(name) == 0) { 72 return c.substring(name.length, c.length); 73 } 74 } 75 return ""; 76} 77 78/** 79 * Older versions of the sound player kept its state in cookies, which grew the 80 * request headers with every sound that was played. The state lives in 81 * memory/localStorage now, so drop whatever is left over in the browser. 82 */ 83function ahuraPlayerPurgeLegacyCookies(){ 84 let cookies = document.cookie ? document.cookie.split(';') : [], 85 legacy = /^(audio_src|audio_hash|audio_end|player_id|player_(interval|countdown)_id_.+|player_.+_audio_.+)$/, 86 i, name; 87 for(i = 0; i < cookies.length; i++){ 88 name = cookies[i].split('=')[0].trim(); 89 if(name && legacy.test(name)){ 90 ahuraDeleteCookie(name); 91 } 92 } 93} 94 95function ahuraCheckCookie(name) { 96 let data = ahuraGetCookie(name); 97 if (data != "") { 98 return true; 99 } 100 101 return false; 102} 103 104function ahuraDatetimeToCountdown(datetime, selector){ 105 const second = 1000, 106 minute = second * 60, 107 hour = minute * 60, 108 day = hour * 24; 109 if (selector != null && selector !== undefined) { 110 let TargetDate = Date.parse(datetime), 111 startInterval = setInterval(function () { 112 113 let now = Date.parse(new Date()), 114 distance = TargetDate - now; 115 116 selector.querySelector('.days .num').innerText = Math.floor(distance / (day)), 117 selector.querySelector('.hours .num').innerText = Math.floor((distance % (day)) / (hour)), 118 selector.querySelector('.minutes .num').innerText = Math.floor((distance % (hour)) / (minute)), 119 selector.querySelector('.seconds .num').innerText = Math.floor((distance % (minute)) / second); 120 121 if (distance < 0) { 122 selector.querySelector('.countdown-time').remove(); 123 selector.querySelector('.time-end').style.display = 'inline-block'; 124 clearInterval(startInterval); 125 } 126 }, second); 127 } 128} 129 130function ahuraShowFixedMessage(message, type = 'success', timeout = 9000){ 131 let body = jQuery('body'), msgWrap; 132 ahuraDestroyFixedMessages(); 133 134 body.append( 135 jQuery('<div/>', {'class': 'fixed-message-wrap'}).append( 136 jQuery('<div/>', {'class': 'fixed-message-content', text: message, 'data-type': type}).append( 137 jQuery('<span/>', {'class': 'remove-fixed-message', text: '+'}) 138 ) 139 ), 140 ); 141 142 msgWrap = body.find('.fixed-message-wrap'); 143 144 setTimeout(function(){ 145 msgWrap.addClass('fixed-message-show'); 146 }, 300); 147 148 ahuraDestroyFixedMessages(timeout); 149} 150 151function ahuraDestroyFixedMessages(timeout = 500, remove = true){ 152 let body = jQuery('body'), 153 msgWrap = body.find('.fixed-message-wrap'); 154 if(msgWrap.length > 0){ 155 setTimeout(function(){ 156 msgWrap.removeClass('fixed-message-show'); 157 if(remove){ 158 msgWrap.remove(); 159 } 160 }, timeout); 161 } 162} 163 164function ahuraGenerateCatptcha(element_id = 'captcha', type = 'number'){ 165 let elements = document.querySelectorAll('#' + element_id); 166 167 var charsArray = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*"; 168 if (type == 'number') { 169 charsArray = "0123456789"; 170 } 171 172 var lengthOtp = 6; 173 var captcha = []; 174 for (var i = 0; i < lengthOtp; i++) { 175 var index = Math.floor(Math.random() * charsArray.length); 176 captcha.push(charsArray[index]); 177 } 178 179 var captchaCode = captcha.join(""); 180 181 elements.forEach(function(element) { 182 element.innerHTML = ""; 183 184 var canv = document.createElement("canvas"); 185 canv.width = 100; 186 canv.height = 50; 187 var ctx = canv.getContext("2d"); 188 ctx.font = "25px Georgia"; 189 ctx.strokeText(captchaCode, 0, 30); 190 191 var dataUrl = canv.toDataURL("image/png"); 192 193 var img = document.createElement("img"); 194 img.src = dataUrl; 195 196 element.appendChild(img); 197 }); 198 199 captcha_codes[element_id] = captchaCode; 200} 201 202function ahuraReGenerateCaptchaCodes(){ 203 if(typeof captcha_ids !== "undefined" && captcha_ids.length){ 204 jQuery.each(captcha_ids, function(i, val){ 205 ahuraGenerateCatptcha(val); 206 }); 207 } 208} 209 210function ahuraScrollTo(element_id, time = 2000){ 211 let targetEl = jQuery('body').find(element_id); 212 if(targetEl.length){ 213 214 if(window.matchMedia("(max-width: 767px)").matches){ 215 time = "slow"; 216 } 217 218 jQuery('html, body').animate({ 219 scrollTop: targetEl.offset().top 220 }, time); 221 } 222} 223 224function ahuraGetQueryVarByName(name, url = window.location.href) { 225 name = name.replace(/[\[\]]/g, '\\$&'); 226 let regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), 227 results = regex.exec(url); 228 if (!results) return null; 229 if (!results[2]) return ''; 230 return decodeURIComponent(results[2].replace(/\+/g, ' ')); 231} 232 233const ahuraCopyTextToClipboard = function (text) { 234 if(navigator && typeof navigator.clipboard !== 'undefined'){ 235 navigator.clipboard.writeText(text); 236 return true; 237 } else { 238 let textArea = document.createElement("textarea"); 239 textArea.value = text; 240 textArea.style.top = "0"; 241 textArea.style.left = "0"; 242 textArea.style.position = "fixed"; 243 document.body.appendChild(textArea); 244 245 textArea.focus(); 246 textArea.select(); 247 248 try{ 249 document.execCommand('copy'); 250 return true; 251 } catch (err) {
252 console.log('Oops, unable to copy'); 253 return false; 254 } 255 } 256} 257 258const ahuraAutoRedirect = function (url){ 259 let link = document.createElement('a'); 260 link.href = url; 261 link.style.display = 'none'; 262 document.body.appendChild(link); 263 link.click(); 264 document.body.removeChild(link); 265} 266 267jQuery(document).ready(function ($){ 268 ahuraReGenerateCaptchaCodes(); 269 ahuraPlayerPurgeLegacyCookies(); 270 271 $(document).on('click', '.reload-captcha', function (e) { 272 e.preventDefault(); 273 let btn = $(this), 274 captchaID; 275 276 if(btn.hasClass('captcha-code')){ 277 captchaID = btn.attr('id'); 278 } else { 279 captchaID = btn.parent().children('.captcha-code').attr('id'); 280 } 281 ahuraGenerateCatptcha(captchaID); 282 }); 283 284 $(document).on('click', '.ahura-select-field .ah-selected-item-wrap', function (e) { 285 e.preventDefault(); 286 let button = $(this), 287 wrap = button.closest('.ahura-select-field'), 288 optionsWrap = wrap.find('.ah-select-options'); 289 290 optionsWrap.slideToggle(200); 291 }); 292 293 $(document).on('click', '.ahura-select-field .ah-select-options .select-option', function (e) { 294 e.preventDefault(); 295 let button = $(this), 296 optionValue = button.data('value'), 297 optionText = button.text(), 298 wrap = button.closest('.ahura-select-field'), 299 realSelect = wrap.find('select'), 300 optionsWrap = button.parent(); 301 302 wrap.find('.ah-selected-text').text(optionText); 303 realSelect.val(optionValue); 304 realSelect.trigger('change'); 305 306 optionsWrap.find('.selected').removeClass('selected'); 307 button.addClass('selected'); 308 309 optionsWrap.slideUp(200); 310 }); 311 312 $(document).on('click', 'body', function (e) { 313 let selectWrap = $('.ahura-select-field'); 314 if (!$(e.target).closest('.ahura-select-field').length) { 315 selectWrap.find('.ah-select-options').slideUp(150); 316 } 317 }); 318});
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.