1;(function($) { 2 3 'use strict'; 4 5 var dash_tabs = { 6 active: 0 7 }; 8 9 if (typeof element_ready_obj !== 'undefined') { 10 dash_tabs.active = parseInt(element_ready_obj.active) 11 } 12 13 if ($( "#element-ready-adpage-tabs").length) { 14 var $random_tabs = $( "#element-ready-adpage-tabs"); 15 $random_tabs.tabs(dash_tabs); 16 } 17 18 var currentNoticeContent = $('.element-ready-admin-notice-remote .notice-content').html(); 19 20 if (localStorage.admin_notice_remote_dismissed) { 21 if (JSON.parse(localStorage.admin_notice_remote_dismissed).content === currentNoticeContent) 22 $('.element-ready-admin-notice-remote').addClass('hidden'); 23 } 24 25 26 $(document).on('click', '.element-ready-admin-notice-remote .notice-dismiss', function() { 27 // create object with date the notice was dismissed and the content of the notice at the time of dismissal 28 var noticeData = { 29 date: new Date(), 30 content: currentNoticeContent 31 }; 32 localStorage.admin_notice_remote_dismissed = JSON.stringify(noticeData); 33 }); 34 35 var x, i, j, l, ll, selElmnt, a, b, c; 36 37 x = document.getElementsByClassName("element-ready-custom-select"); 38 l = x.length; 39 for (i = 0; i < l; i++) { 40 selElmnt = x[i].getElementsByTagName("select")[0]; 41 ll = selElmnt.length; 42 43 a = document.createElement("DIV"); 44 a.setAttribute("class", "select-selected"); 45 a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML; 46 x[i].appendChild(a); 47 48 b = document.createElement("DIV"); 49 b.setAttribute("class", "select-items select-hide"); 50 for (j = 1; j < ll; j++) { 51 52 c = document.createElement("DIV"); 53 c.innerHTML = selElmnt.options[j].innerHTML; 54 c.addEventListener("click", function(e) { 55 56 var y, i, k, s, h, sl, yl; 57 s = this.parentNode.parentNode.getElementsByTagName("select")[0]; 58 sl = s.length; 59 h = this.parentNode.previousSibling; 60 for (i = 0; i < sl; i++) { 61 if (s.options[i].innerHTML == this.innerHTML) { 62 s.selectedIndex = i; 63 h.innerHTML = this.innerHTML; 64 y = this.parentNode.getElementsByClassName("same-as-selected"); 65 yl = y.length; 66 for (k = 0; k < yl; k++) { 67 y[k].removeAttribute("class"); 68 } 69 this.setAttribute("class", "same-as-selected"); 70 break; 71 } 72 } 73 h.click(); 74 }); 75 b.appendChild(c); 76 } 77 x[i].appendChild(b); 78 a.addEventListener("click", function(e) { 79 80 e.stopPropagation(); 81 element_ready_closeAllSelect(this); 82 this.nextSibling.classList.toggle("select-hide"); 83 this.classList.toggle("select-arrow-active"); 84 }); 85 } 86 87 function element_ready_closeAllSelect(elmnt) { 88 89 var x, y, i, xl, yl, arrNo = []; 90 x = document.getElementsByClassName("select-items"); 91 y = document.getElementsByClassName("select-selected"); 92 xl = x.length; 93 yl = y.length; 94 for (i = 0; i < yl; i++) { 95 if (elmnt == y[i]) { 96 arrNo.push(i) 97 } else { 98 y[i].classList.remove("select-arrow-active"); 99 } 100 } 101 for (i = 0; i < xl; i++) { 102 if (arrNo.indexOf(i)) { 103 x[i].classList.add("select-hide"); 104 } 105 } 106 } 107 document.addEventListener("click", element_ready_closeAllSelect); 108 109 /*---------------------- 110 PRO MODAL 111 -----------------------*/ 112 var modal_action = $('.element-ready-dash-modal-open-btn label'); 113 var modal = $('#element-ready-modal-body'); 114 modal_action.on('click', function() { 115 modal.show(); 116 });
117 $('.element-ready-modal-close').on('click', function() { 118 modal.fadeOut(); 119 }); 120 121 /* -------------------- 122 * filter component & module 123 ---------------------*/ 124 125 $('#element-ready-widgets-search').on('input', function() { 126 var ele_val = $(this).val().toLowerCase(); 127 var that_widgets = null; 128 var filter_col = $('.element-ready-component-row .element-ready-col'); 129 130 $.each(filter_col, function() { 131 var that_widgets = $(this); 132 that_widgets.toggle(that_widgets.find('strong').text().toLowerCase().indexOf(ele_val) > -1); 133 134 }); 135 }); 136 137 $('#element-ready-modules-search').on('input', function() { 138 var ele_val = $(this).val().toLowerCase(); 139 var that_widgets = null; 140 var filter_col = $('.element-ready-modules-row .element-ready-col'); 141 142 $.each(filter_col, function() { 143 var that_widgets = $(this); 144 that_widgets.toggle(that_widgets.find('strong').text().toLowerCase().indexOf(ele_val) > -1); 145 }); 146 147 }); 148 149 150 $('#element-ready-modules-button-sbt').on('click',function(e){ 151 152 e.preventDefault(); 153 $(this).addClass('element-raedy-button-laoding'); 154 er_modules_form_submits(null,$(this)); 155 }); 156 157 $(document).off().on('click','input.element-ready-modules-all-js-enable', function() { 158 159 let filter_col = $('.element-ready-modules-row .element-ready-col input'); 160 var is_checked = false; 161 if ($(this).prop("checked")) { 162 is_checked = true; 163 }else{ 164 is_checked = false; 165 } 166 167 $.each(filter_col, function() { 168 let that_widgets = $(this); 169 if (!that_widgets.attr('readonly')) { 170 that_widgets.prop('checked', is_checked) 171 } 172 }); 173 174 }); 175 176 $('#quomodo-components-all-enable').on('click', function() { 177 178 let filter_col = $('.element-ready-component-row .element-ready-col input'); 179 var is_checked = false; 180 if ($(this).prop("checked")) { 181 is_checked = true; 182 }else{ 183 is_checked = false; 184 } 185 $.each(filter_col, function() { 186 187 let that_widgets = $(this); 188 if (!that_widgets.attr('readonly')) { 189 that_widgets.prop('checked', is_checked) 190 } 191 192 }); 193 194 195 196 }); 197 198 $('button.er-lite-widgets-submit').on('click',function(e){ 199 200 e.preventDefault(); 201 $(this).addClass('element-raedy-button-laoding'); 202 er_compononet_form_submits(null,$(this)); 203 }); 204 205 206 $('.element-ready-pro-connects').on('click', function(evt) { 207 208 209 evt.stopPropagation(); 210 evt.preventDefault(); 211 212 if (typeof element_ready_obj !== 'undefined') { 213 $.ajax({
214 url: element_ready_obj.rest_url + 'element-ready-pro/v1/activate', 215 method: 'POST', 216 beforeSend: function(xhr) { 217 xhr.setRequestHeader("X-Element-Ready-Pro-Signature", "element-ready"); 218 xhr.setRequestHeader("x_user_id", element_ready_obj.user_id); 219 }, 220 success: function(data) { 221 222 $('.element-ready-active-msg').remove(); 223 if (data.data.code == 200) { 224 var txt = document.createElement("h2"); 225 226 txt.innerHTML = data.data.msg; 227 $(txt).css({ 'color': '#3467ff' }); 228 $(txt).addClass('element-ready-active-msg'); 229 $('.element-ready-pro-connect').prepend(txt); 230 } 231 if (data.data.status == 403) { 232 $(txt).css({ 'color': '#c81a03e1' }); 233 $('.element-ready-pro-connect').prepend('connection fail, please provide valid license'); 234 } 235 setTimeout("location.reload(true);", 2000); 236 }, 237 error: function(jqXHR, exception) { 238 239 $('.element-ready-active-msg').remove(); 240 var txt = document.createElement("h2"); 241 242 txt.innerHTML = 'You may provide invide license key'; 243 $(txt).css({ 'color': '#3467ff' }); 244 $(txt).addClass('element-ready-active-msg'); 245 $('.element-ready-pro-connect').prepend(txt); 246 } 247 }); 248 } 249 }); 250 251 $('.element-ready-pro-disconnects').on('click', function(evt) { 252 253 evt.stopPropagation(); 254 evt.preventDefault(); 255 256 if (typeof element_ready_obj !== 'undefined') { 257 $.ajax({
258 url: element_ready_obj.rest_url + 'element-ready-pro/v1/deactivate', 259 method: 'POST', 260 beforeSend: function(xhr) { 261 xhr.setRequestHeader("X-Element-Ready-Pro-Signature", "element-ready"); 262 xhr.setRequestHeader("x_user_id", element_ready_obj.user_id); 263 }, 264 success: function(data) { 265 266 $('.element-ready-active-msg').remove(); 267 var txt = document.createElement("h2"); 268 $(txt).addClass('element-ready-active-msg'); 269 txt.innerHTML = data.data.msg; 270 271 $(txt).css({ 'color': '#3467ff' }); 272 273 if (data.data.code == 200) { 274 $('.element-ready-pro-connect').prepend(txt); 275 } 276 277 setTimeout("location.reload(true);", 2000); 278 279 }, 280 error: function(jqXHR, exception) { 281 $('.element-ready-active-msg').remove(); 282 var txt = document.createElement("h2"); 283 $(txt).addClass('element-ready-active-msg'); 284 txt.innerHTML = 'Server error'; 285 $(txt).css({ 'color': '#3467ff' }); 286 $(txt).addClass('element-ready-active-msg'); 287 $('.element-ready-pro-connect').prepend(txt); 288 } 289 }); 290 } 291 }); 292 293 function er_compononet_form_submits(button = null,this_button = null){ 294 295 let form_data = $('form#element-ready-admin-component-form').serialize(); 296 297 $.ajax({
298 url: element_ready_obj.ajax_url, 299 method: 'POST', 300 data : form_data, 301 success: function(response) { 302 303 $('body').append('<div class="show element-ready--lite-snackbar" id="element-ready--lite-snackbar">'+response.data+'</div>'); 304 305 setTimeout(function(){ 306 $('.element-ready--lite-snackbar').remove(); 307 this_button.removeClass('element-raedy-button-laoding'); 308 }, 3000); 309 310 }, 311 error: function(jqXHR, exception) { 312 313 $('body').append('<div class="show element-ready--lite-snackbar" id="element-ready--lite-snackbar">Error</div>'); 314 315 setTimeout(function(){ 316 $('.element-ready--lite-snackbar').remove(); 317 this_button.removeClass('element-raedy-button-laoding'); 318 }, 3000); 319 } 320 }); 321 } 322 323 324 function er_modules_form_submits(button = null, this_button = null){ 325 326 let form_data = $('form.element-ready-modules-action').serialize(); 327 328 $.ajax({
329 url: element_ready_obj.ajax_url, 330 method: 'POST', 331 data : form_data, 332 success: function(response) { 333 334 $('body').append('<div class="show element-ready--lite-snackbar" id="element-ready--lite-snackbar">'+response.data+'</div>'); 335 setTimeout(function(){ 336 $('.element-ready--lite-snackbar').remove(); 337 }, 2000); 338 this_button.removeClass('element-raedy-button-laoding'); 339 }, 340 fail :(function() { 341 342 343 }), 344 error: function(jqXHR, exception) { 345 346 $('body').append('<div class="show element-ready--lite-snackbar" id="element-ready--lite-snackbar">Error</div>'); 347 348 setTimeout(function(){ 349 $('.element-ready--lite-snackbar').remove(); 350 }, 3000); 351 } 352 }); 353 } 354 355 function er_ready_getCookie(cname) { 356 357 var name = cname + "="; 358 var decodedCookie = decodeURIComponent(document.cookie); 359 var ca = decodedCookie.split(';'); 360 for (var i = 0; i < ca.length; i++) { 361 var c = ca[i]; 362 while (c.charAt(0) == ' ') { 363 c = c.substring(1); 364 } 365 if (c.indexOf(name) == 0) { 366 return c.substring(name.length, c.length); 367 } 368 } 369 return ""; 370 } 371 372 function er_ready_allStorage() { 373 374 var values = [], 375 keys = Object.keys(localStorage), 376 i = keys.length; 377 378 while (i--) { 379 var new_obk = {}; 380 new_obk.k = keys[i]; 381 new_obk.v = localStorage.getItem(keys[i]); 382 values.push(new_obk); 383 } 384 385 return JSON.stringify(values); 386 } 387 388 function er_ready_get_All_Cookie() { 389 let all = []; 390 var decodedCookie = decodeURIComponent(document.cookie); 391 var ca = decodedCookie.split(';'); 392 393 for (var i = 0; i < ca.length; i++) { 394 395 var new_obks = {}; 396 new_obks.k = ca[i].split('=')[0]; 397 new_obks.v = ca[i].split('=')[1];
398 all.push(new_obks); 399 } 400 401 return JSON.stringify(all); 402 } 403 404 $(document).ready(function() { 405 406 if ($('.elements-ready-video-popup').length) { 407 $('.elements-ready-video-popup').magnificPopup({ type: 'iframe' }); 408 } 409 410 }); 411 412})(jQuery); 413 414// unspash 415 416(function($) { 417 418 if ("undefined" != typeof wp && wp.media) { 419 420 var e = wp.media.view.MediaFrame.Select, 421 i = (wp.media.controller.Library, wp.media.view.l10n), 422 t = wp.media.view.Frame, 423 importData = null, 424 er_pagination = 1, 425 tabTitle = 'Unsplash Photos', 426 defaultSearchTerm = ''; 427 428 wp.media.view.Element_Ready_AttachmentsBrowser = t.extend({ 429 tagName: "div", 430 id: "element-ready-unsplash", 431 className: "er-unsplash-photos-browser element-ready-unsplash", 432 initialize: function() { 433 er_pagination = 1; 434 importData = this; 435 element_ready_unplash_load_content('list'); 436 437 438 } 439 }), e.prototype.bindHandlers = function() { 440 this.on("router:create:browse", this.createRouter, this), this.on("router:render:browse", this.browseRouter, this), this.on("content:create:browse", this.browseContent, this), this.on("content:create:ElementReadygallery", this.ElementReadygallery, this), this.on("content:render:upload", this.uploadContent, this), this.on("toolbar:create:select", this.createSelectToolbar, this) 441 }, e.prototype.browseRouter = function(e) { 442 var t = {}; 443 t.upload = { 444 text: i.uploadFilesTitle, 445 priority: 19 446 }, t.browse = { 447 text: i.mediaLibraryTitle, 448 priority: 42 449 }, t.ElementReadygallery = { 450 text: tabTitle, 451 priority: 62 452 }, 453 e.set(t); 454 455 }, e.prototype.ElementReadygallery = function(e) { 456 var t = this.state(); 457 e.view = new wp.media.view.Element_Ready_AttachmentsBrowser({ 458 controller: this, 459 model: t, 460 AttachmentView: t.get("AttachmentView") 461 }); 462 463 }; 464 465 } //endif 466 467 function element_ready_unplash_load_content(type = 'list', q = '', page = 1) { 468 469 var params = { action: 'element_ready_get_unsplash', type: type, page: page }; 470 471 if (type == 'search') { 472 params['q'] = q; 473 } 474 475 var body_str = $.param(params); 476 fetch(ermedia.ajaxurl, { 477 method: 'POST', 478 headers: new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' }), 479 body: body_str 480 }) 481 .then(response => response.json()) 482 .then((tmpl) => { 483 var template = wp.template('element-ready-pro-gallary-home'); 484 importData.$el.html(template({ images: tmpl.data.results })); 485 }) 486 .catch(function(error) { 487 488 console.log(error); 489 }); 490 491 } 492 493 494 $(document).on("click", "#er-unsplash-search-ubtn-", function() { 495 er_paginatio = 1; 496 let that = $(this); 497 defaultSearchTerm = that.prev(".er-unsplash-search").val(); 498 499 that.prev(".er-unsplash-search").css("background", "#e1e1e1"); 500 element_ready_unplash_load_content('search', defaultSearchTerm, er_pagination); 501 502 }); 503 504 $(document).on('click', '.element-ready-unsplash-remote-image', function() { 505 506 let image_id = $(this).find('img').data('id'); 507 var params = { action: 'element_ready_get_unsplash', type: 'single', 'id': image_id }; 508 509 var body_str = $.param(params); 510 fetch(ermedia.ajaxurl, { 511 method: 'POST', 512 headers: new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' }), 513 body: body_str 514 }) 515 .then(response => response.json())
516 .then((tmpl) => { 517 518 var template = wp.template('element-ready-pro-gallary-unsplash-single-image'); 519 520 importData.$el.html(template({ image_id: image_id, image: tmpl.data })); 521 522 }) 523 .catch(function(error) { 524 525 console.log(error); 526 }); 527 528 }); 529 530 $(document).on('click', '.element-ready-unsplash-back-btn', function() { 531 er_pagination = 1; 532 element_ready_unplash_load_content('list'); 533 }); 534 535 $(document).on('click', '.er-unsplash-insert-button', function(e) { 536 537 let inser_btn = $(this); 538 let loader = null; 539 let image_size = null; 540 let image = inser_btn.attr('data-src'); 541 image_size = inser_btn.prev(".er-unsplash-image-size").val(); 542 loader = inser_btn.next(".er-loader-img"); 543 loader.show(); 544 loader.find(".er-loader-status").text('Downloading image from unsplash'); 545 546 let _params = { action: 'save_er_unsplash_media', size: image_size, 'src': 'unsplash', image: image }; 547 548 if (ermedia.hasOwnProperty('post_id')) { 549 _params['post_id'] = ermedia.post_id.ID; 550 } 551 552 let body__str = $.param(_params); 553 fetch(ermedia.ajaxurl, { 554 method: 'POST', 555 headers: new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' }), 556 body: body__str 557 }) 558 .then(response => response.json()) 559 .then((data) => { 560 561 loader.find(".er-loader-status").text('Done'); 562 importData.model.get("selection").add(data.data.attachmentData) 563 importData.model.frame.trigger("library:selection:add") 564 let buttons = document.querySelectorAll(".media-toolbar .media-toolbar-primary .media-button-select") 565 buttons[buttons.length - 1].click() 566 element_ready_unplash_load_content('list'); 567 er_pagination = 1; 568 }) 569 .catch(function(error) { 570 loader.find(".er-loader-status").text('File Download fail ').css({ 'color': 'red' }); 571 loader.find('img').hide(); 572 573 }); 574 }); 575 576 $(document).on('click', '#er-pro-unsplash-next-ubtn-', function() { 577 578 if (defaultSearchTerm.length > 1) { 579 580 element_ready_unplash_load_content('search', defaultSearchTerm, ++er_pagination); 581 } else { 582 element_ready_unplash_load_content('list', '', ++er_pagination); 583 } 584 585 }); 586 587 $(document).on('mouseover', '.er-unsplash-photos-browser', function() { 588 $('.media-frame-toolbar .media-button-select').prop('disabled', true); 589 }); 590 591 592 $(document).on('click','.element-ready-admin-notice-remote .notice-dismiss',function(){ 593 $(this).parent('.element-ready-admin-notice-remote').hide(); 594 }); 595 596 // feature request form 597 $(document).on('click', '#innner-dsh-form-feature-request .submit-button', function(e){ 598 599 String.prototype.is_email=function(){ 600 return (/^[\w-\.]+\@[\w\.-]+\.[a-z]{2,4}$/.test(this)); 601 }; 602 603 var form_data = $('#innner-dsh-form-feature-request').serialize(); 604 var $fullname = $('#innner-dsh-form-feature-request input[name=fullname]'); 605 var $email = $('#innner-dsh-form-feature-request input[name=email]'); 606 var $desc = $('#innner-dsh-form-feature-request textarea'); 607 608 if($fullname.val().length < 2){ 609 $fullname.focus(); 610 return; 611 } 612 613 if(!$email.val().is_email()){ 614 $email.focus(); 615 return; 616 } 617 if($desc.val().length < 2){ 618 $desc.focus(); 619 return; 620 } 621 622 $.ajax({
623 url : 'https://quomodosoft.com/wp-json/elementsready/v6/feature-request', 624 async : true, 625 dataType: 'json', 626 type : 'POST', 627 data : form_data, 628 }).done(function(response) { 629 if(response.code == 200){ 630 $('#innner-dsh-form-feature-request').append('<h2 class="er-dsah-form-message">' + response.message + '</h2>'); 631 setTimeout(function(){ 632 $('#innner-dsh-form-feature-request').find('.er-dsah-form-message').remove(); 633 },5000); 634 } 635 }).fail(function(xhr, status, error) { 636 // Handle Failure 637 }); 638 639 }); 640 641 642})(jQuery); 643
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.