1/* 2** Returns the URI query string in object format 3** Code from BrunoLM's answer (jQuery Plugin) on https://stackoverflow.com/a/3855394/5475560 4*/ 5(function ($) { 6 $.QueryString = (function (paramsArray) { 7 let params = {}; 8 9 for (let i = 0; i < paramsArray.length; ++i) { 10 let param = paramsArray[i] 11 .split('=', 2); 12 13 if (param.length !== 2) 14 continue; 15 16 params[param[0]] = decodeURIComponent(param[1].replace(/\+/g, " ")); 17 } 18 19 return params; 20 })(window.location.search.substr(1).split('&')) 21})(jQuery); 22 23var $saveChanges = $('button#save_changes'); 24var $menu = $('header nav'); 25$(document).on('keyup', function (e) { 26 if ($menu.hasClass('open') && e.keyCode === 27) { 27 $menu.toggleClass('open'); 28 } 29}); 30 31function updateHiddenInput(inputSelector, updatedValue) { 32 var $inputField = $(inputSelector); 33 34 $inputField.val(updatedValue); 35} 36 37$(document).on('focus', 'input', function () { 38 $(this).select(); 39}).on('input', '.bannerName', function (e) { 40 var $bannerName = $('#bannerName'), 41 name = e.target.value; 42 $bannerName.text(name); 43}).on('input', '#first_name, #last_name', function (e) { 44 var $bannerName = $('#bannerName'), 45 firstName = $('#first_name').val(), 46 lastName = $('#last_name').val(); 47 $bannerName.text(firstName + " " + lastName); 48}); 49 50$saveChanges.on('click', function (e) { 51 var $this = $(this), result, type = $this.data('type'); 52 53 $this.html("<i class='fa fa-refresh loading'></i> Saving"); 54 ajaxSubmitForm(e, 'form#' + type + '_form', 'save_' + type, 'ajax/' + type + '_ajax.php'); 55 56 setTimeout(function () { 57 result = window.ajaxResult; 58 setTimeout(function () { 59 // $('body').prepend("<pre>" + JSON.stringify(result, null, 4) + "</pre>"); 60 if (result.status === 'success') { 61 62 $this.text('Changes Saved!').attr('disabled', 'true'); 63 window.location.reload(); 64 } else { 65 $this.html("<i class='fa fa-exclamation-triangle'></i> Something went wrong").toggleClass('btn-danger btn-success'); 66 } 67 if (result.data.new === true) { 68 window.location.search = '?id=' + result.data.id; 69 } 70 }, 1500); 71 }, 1000); 72}); 73 74// Applied globally on all textareas with the "autoExpand" class 75$(document) 76.one('focus.autoExpand', 'textarea.autoExpand', function () { 77 var savedValue = this.value; 78 this.value = ''; 79 this.baseScrollHeight = this.scrollHeight; 80 this.value = savedValue; 81}) 82.on('input.autoExpand', 'textarea.autoExpand', function () { 83 var minRows = this.getAttribute('data-min-rows') | 0, rows; 84 this.rows = minRows; 85 rows = Math.ceil((this.scrollHeight - this.baseScrollHeight) / 20); 86 this.rows = minRows + rows; 87}); 88Dropzone.autoDiscover = false; 89 90// IMAGE UPLOAD 91$(document).ready(function () { 92 function randomString(len) { 93 var rdmString = ""; 94 for (; rdmString.length < len; rdmString += Math.random().toString(36).substr(2)) ; 95 return rdmString.substr(0, len); 96 } 97 98 var cleanFilename = function (name) { 99 var filename = name, 100 extension = filename.split('.').pop(), 101 random_string = randomString(28), 102 new_file_name = random_string + '.' + extension, 103 image_input = document.getElementById('image_name'); 104 image_input.value = new_file_name; 105 return new_file_name; 106 }; 107 if ($('div#rockImage').length) { 108 var profileImage = new Dropzone("div#rockImage", 109 { 110 url: "ajax/image_upload.php", 111 paramName: "file", // The name that will be used to transfer the file 112 clickable: '.dropclick, .dropbox', 113 acceptedFiles: 'image/*', 114 resizeWidth: 600, 115 maxFilesize: 10, // MB 116 thumbnailWidth: 560, 117 thumbnailHeight: 560, 118 renameFilename: cleanFilename, 119 maxFiles: 1, 120 params: { 121 type: $('input#uploadDir').val() 122 }, 123 uploadMultiple: false, 124 }); 125 profileImage.on('addedfile', function (file, errorMessage, xhr) { 126 file.previewElement.addEventListener('click', function () { 127 profileImage.removeFile(file); 128 }) 129 }) 130 profileImage.on('success', function (file, responseJSON) { 131 console.log(JSON.parse(responseJSON)); 132 133 }) 134 profileImage.on('error', function (file, errorMessage, xhr) { 135 console.log(errorMessage + "\r\n" + file); 136 }) 137 } 138 if ($('#phone').length) { 139 var phone = new Cleave('#phone', { 140 numericOnly: true, 141 delimiters: ['-', '-'], 142 blocks: [3, 3, 4] 143 }); 144 } 145 146}); 147 148// END IMAGE UPLOAD 149 150// Tooltips Initialization 151$(function () { 152 if ($('[data-toggle="tooltip"]').length) { 153 $('[data-toggle="tooltip"]').tooltip() 154 } 155}); 156// End tooltips init 157 158$(document).ready(function () { 159 160 let query = $.QueryString; 161 162 if (query.error === 'login') { 163 $('#modalLogin').modal({show: true}); 164 } 165 if (query.error === 'reset' || query.reset === 'true') { 166 $('.resetForm, .loginForm').toggleClass('hidden'); 167 } 168 $('.openResetModal').on('click', function (e) { 169 $('#loginContent').hide(); 170 $('#resetContent').show(); 171 }); 172 $('.openLoginModal').on('click', function (e) { 173 $('#resetContent').hide(); 174 $('#loginContent').show(); 175 }); 176 $('.showReset, .showLogin').on('click', function (e) { 177 $('.resetForm, .loginForm').toggleClass('hidden'); 178 }); 179 180 181 $("nav > ul").prepend('<li class="mobilenav"><a href="/">Home</a></li>'); 182 $("nav > ul").prepend('<li class="mobilenav close"><span href="#"><i class="fa fa-close"></i> Close</span></li>'); 183 $("nav > ul").append($('ol.mobileAuth').html()); 184 185 $("#mobile, .close").click(function () { 186 $("header nav").toggleClass("open"); 187 $("body").toggleClass("overflow-hidden"); 188 }); 189 $('a[href*="#"]').not('[href="#"]').not('[href="#0"]').click(function (event) { 190 // On-page links
191 if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { 192 var target = $(this.hash); 193 target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 194 if (target.length) { 195 event.preventDefault(); 196 $('html, body').animate({ 197 scrollTop: target.offset().top 198 }, 1000, function () { 199 var $target = $(target); 200 $target.focus(); 201 if ($target.is(":focus")) { // Checking if the target was focused 202 return false; 203 } else { 204 $target.attr('tabindex', '-1'); // Adding tabindex for elements not focusable 205 $target.focus(); // Set focus again 206 } 207 }); 208 } 209 } 210 }); 211 212 $('form input[name=updatePassword]').on('change', function () { 213 if ($('input[name=updatePassword]:checked').val() == 1) { 214 $('.passwords').show(); 215 } else { 216 $('.passwords').hide(); 217 } 218 }); 219 220 // if ($('.mdb-select').length) { 221 // $('.mdb-select').material_select(); 222 // } 223 // if ($('.datepicker').length) { 224 // $('.datepicker').pickadate({ 225 // hiddenPrefix: '', 226 // hiddenSuffix: '', 227 // format: 'ddd, mmm d, yyyy', 228 // formatSubmit: 'yyyy-mm-dd', 229 // }); 230 // } 231 // 232 $('.dropdown-toggle').dropdown('toggle'); 233}); 234 235// Sponsor registration form functionality 236$(document).ready(function () { 237 var nextField; 238 $('.next').on('click', function () { 239 nextField = $(this).data('next'); 240 $('.fields').hide(); 241 $('#' + nextField).show(); 242 }); 243 $('form#register_sponsor input,form#billing_sponsor input').on('change', function () { 244 if ($('input[name=location]:checked').val() == 1) { 245 $('.location-field').show(); 246 } else { 247 $('.location-field').hide(); 248 } 249 }); 250 $('form#register_sponsor input[name=location],form#billing_sponsor input[name=location]').on('change', function () { 251 if ($('input[name=location]:checked').val() == 1) { 252 $('.location-field').show(); 253 } else { 254 $('.location-field').hide(); 255 } 256 }); 257 $('form#register_sponsor input[name=giveaway],form#billing_sponsor input[name=giveaway]').on('change', function () { 258 if ($('input[name=giveaway]:checked').val() == 1) { 259 $('.giveaway-field').show(); 260 } else { 261 $('.giveaway-field').hide(); 262 } 263 }); 264 $('form#register_sponsor.billing input').on('change', function () { 265 if ($('input[name=updateBilling]:checked').val() == 1) { 266 $('.billingFields, #sq-submit').show(); 267 $('#other-submit').hide(); 268 } else { 269 $('.billingFields, #sq-submit').hide(); 270 $('#other-submit').show(); 271 } 272 }); 273 window.totalAmount = $('input#billingAmount').val(); 274 console.log(window.totalAmount); 275 276}); 277var monthly = 0, giveaway = 0, total = 0, giveawayQuantity = 0, giveawayAmount = 0, formattedTotal = 0, fee = 0; 278var formatter = new Intl.NumberFormat('en-US', { 279 style: 'currency', 280 currency: 'USD', 281 minimumFractionDigits: 2, 282}); 283 284// $(document).on('ready change', 'form#register_sponsor input,form#register_sponsor select,form#billing_sponsor input,form#billing_sponsor select', function () { 285// if ($('input[name=monthly]:checked').val() == 1) { 286// monthly = 3.99; 287// } else { 288// monthly = 0.00; 289// } 290// if ($('input[name=giveaway]:checked').val() == 1) { 291// 292// giveawayQuantity = $('select[name=giveaway_quantity]').length ? $('select[name=giveaway_quantity]').val() : 0; 293// giveawayAmount = $('select[name=giveaway_amount]').length ? $('select[name=giveaway_amount]').val() : 0; 294// giveaway = 0; 295// if (giveawayAmount != 0 && giveawayQuantity != 0) { 296// fee = parseInt(giveawayQuantity) + 0.99; 297// console.log(fee); 298// 299// giveaway = (giveawayAmount * giveawayQuantity) + fee; 300// } 301// } else { 302// giveawayQuantity = 0; 303// giveawayAmount = 0; 304// giveaway = 0; 305// } 306// total = monthly + giveaway; 307// window.totalAmount = total; 308// console.log(window.totalAmount); 309// 310// if (total === 0) { 311// $('.bill').hide(); 312// } else { 313// $('.bill').show(); 314// } 315// formattedTotal = formatter.format(total); 316// $('.total-display span').text(formattedTotal); 317// $('#billingAmount').val(parseInt(total * 100)); 318// }); 319 320$(document).on('click', '.sponsors-list .sponsor a', function (e) {
321 let sponsorId = $(this).attr('data-sponsor-id'), action = 'new_click', url = '/'; 322 let data = { 323 sponsor_id: sponsorId 324 }; 325 ajaxSubmitData(e, data, action, url); 326}); 327 328$('.success-stories-main').slick({ 329 slidesToShow: 3, 330 slidesToScroll: 1, 331 dots: false, 332 autoplay: true, 333 arrows : false, 334 responsive: [ 335 { 336 breakpoint: 1025, 337 settings: { 338 slidesToShow: 2, 339 slidesToScroll: 1, 340 infinite: true, 341 342 } 343 }, 344 { 345 breakpoint: 641, 346 settings: { 347 slidesToShow: 1, 348 slidesToScroll: 1, 349 } 350 } 351 ] 352}); 353 354$('#slide-back').click(function(){ 355 $(".success-stories-main").slick('slickPrev'); 356}); 357 358$('#slide-next').click(function(){ 359 $(".success-stories-main").slick('slickNext'); 360}); 361 362$('.events-main').slick({ 363 slidesToShow: 3, 364 slidesToScroll: 1, 365 dots: false, 366 autoplay: true, 367 arrows : false, 368 responsive: [ 369 { 370 breakpoint: 1025, 371 settings: { 372 slidesToShow: 2, 373 slidesToScroll: 1, 374 infinite: true, 375 376 } 377 }, 378 { 379 breakpoint: 641, 380 settings: { 381 slidesToShow: 1, 382 slidesToScroll: 1, 383 } 384 } 385 ] 386}); 387 388$('#slide-back1').click(function(){ 389 $(".events-main").slick('slickPrev'); 390}); 391 392$('#slide-next1').click(function(){ 393 $(".events-main").slick('slickNext'); 394}); 395 396$(document).ready(function(){ 397 398$("div.question-span").click(function(){ 399 // $(".col-md-12.answer").toggle(1000); 400 // $(this).closest('.answer').toggle(); 401 $(this).closest('div').next('.answer').toggle(1000); 402 $(this).closest('img').next('img').toggle(1000); 403 404 $(this).find('img').toggle(); 405 406 // 407 // if($(this).closest('img').data('open')== 'false'){ 408 // $(this).('img').data('open')= 'true'; 409 // alert('open') 410 // }else{ 411 // $(this).('img').data('open')= 'false'; 412 // alert('close') 413 // }; 414}); 415$("#action-bar-btn-continue").click(function(){ 416 alert('a'); 417 var iframeSrc = $('#dswpf').attr('src'); 418 alert(iframeSrc); 419}); 420 421 setTimeout(function(){ 422 $('#registration-documents').removeClass('hidden').addClass('article-read'); 423 },10000); 424 425}); 426 427function hideme() { 428 $('.back-shade').toggle('hidden'); 429 $('.pop-up').toggle('hidden'); 430} 431 432$(document).on('click', '#find-button', function (e) { 433 var count = $('#find-data').attr('data-showing'); 434 var i = 0; 435 while (i < count) { 436 $('#find-data').children('.hidden').first().removeClass('hidden'); 437 i++; 438 } 439}); 440 441 442$(document).ready(function(e) { 443 $('.bugshow').click(function(){ 444 $('pre').toggle(); 445 }); 446}); 447 448var cleanFilename = function (name) { 449 return name.toLowerCase().replace(/ /g, '-'); 450}; 451 452Dropzone.autoDiscover = false; 453jQuery(document).ready(function() { 454 $("div#my-awesome-dropzone").dropzone({ 455 url: "~fgcia/dropzone_upload.php", 456 renameFilename: cleanFilename, 457 success: function (file, response) { 458 459 var imgName = response; 460 file.previewElement.classList.add("dz-success"); 461 $('#document').val(imgName); // get the file upload responses 462 $('#documents').append('<input name="documents[]" value="' + imgName + '" id="" type="hidden">'); 463 }, 464 465 error: function (file, response) { 466 //file.previewElement.classList.add("dz-error"); 467 // $('#up-ack').css('color','red').html(response); 468 } 469 }); 470});
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.