admin.js
2 years ago
ajax-chimp.js
2 years ago
elementor-widgets.js
2 years ago
scripts.js
2 years ago
admin.js
314 lines
| 1 | (function ($) { |
| 2 | "use strict"; |
| 3 | |
| 4 | // Remove svg.radial-progress .complete inline styling |
| 5 | $("svg.radial-progress").each(function (index, value) { |
| 6 | $(this).find($("circle.complete")).removeAttr("style"); |
| 7 | }); |
| 8 | |
| 9 | $(window) |
| 10 | .scroll(function () { |
| 11 | $("svg.radial-progress").each(function (index, value) { |
| 12 | // If svg.radial-progress is approximately 25% vertically into the window when scrolling from the top or the bottom |
| 13 | if ( |
| 14 | $(window).scrollTop() > |
| 15 | $(this).offset().top - $(window).height() * 0.75 && |
| 16 | $(window).scrollTop() < |
| 17 | $(this).offset().top + $(this).height() - $(window).height() * 0.25 |
| 18 | ) { |
| 19 | // Get percentage of progress |
| 20 | var percent = $(value).data("percentage"); |
| 21 | |
| 22 | // Get radius of the svg's circle.complete |
| 23 | var radius = $(this).find($("circle.complete")).attr("r"); |
| 24 | |
| 25 | // Get circumference (2πr) |
| 26 | var circumference = 2 * Math.PI * radius; |
| 27 | |
| 28 | // Get stroke-dashoffset value based on the percentage of the circumference |
| 29 | var strokeDashOffset = |
| 30 | circumference - (percent * circumference) / 100; |
| 31 | |
| 32 | // Transition progress for 1.25 seconds |
| 33 | $(this) |
| 34 | .find($("circle.complete")) |
| 35 | .animate({ "stroke-dashoffset": strokeDashOffset }, 1250); |
| 36 | } |
| 37 | }); |
| 38 | }) |
| 39 | .trigger("scroll"); |
| 40 | |
| 41 | // switcher js |
| 42 | |
| 43 | document.addEventListener("DOMContentLoaded", function () { |
| 44 | var eventDisable = document.getElementById("disable"), |
| 45 | eventEnable = document.getElementById("enabled"), |
| 46 | eventSwitcher = document.getElementById("switcher"); |
| 47 | |
| 48 | if (eventDisable && eventEnable && eventSwitcher) { |
| 49 | eventDisable.addEventListener("click", function () { |
| 50 | eventSwitcher.checked = false; |
| 51 | eventDisable.classList.add("toggler--is-active"); |
| 52 | eventEnable.classList.remove("toggler--is-active"); |
| 53 | }); |
| 54 | |
| 55 | eventEnable.addEventListener("click", function () { |
| 56 | eventSwitcher.checked = true; |
| 57 | eventEnable.classList.add("toggler--is-active"); |
| 58 | eventDisable.classList.remove("toggler--is-active"); |
| 59 | }); |
| 60 | |
| 61 | eventSwitcher.addEventListener("click", function () { |
| 62 | eventEnable.classList.toggle("toggler--is-active"); |
| 63 | eventDisable.classList.toggle("toggler--is-active"); |
| 64 | }); |
| 65 | } |
| 66 | }); // end switcher js |
| 67 | |
| 68 | $(".spe-tab-menu li a").on("click", function () { |
| 69 | $(this).closest(".spe-tab-menu").find("li a").removeClass("active"); |
| 70 | |
| 71 | // Add active class to the clicked tab |
| 72 | $(this).addClass("active"); |
| 73 | |
| 74 | var target = $(this).attr("href"); |
| 75 | |
| 76 | $(".spe-tab-box") |
| 77 | .removeClass("active") |
| 78 | .fadeOut(0, function () { |
| 79 | $(target).addClass("active").fadeIn(0); |
| 80 | }); |
| 81 | |
| 82 | // Trigger Isotope filtering after the tab is clicked |
| 83 | filterMasonry(); |
| 84 | filterMasonryTwo(); |
| 85 | filterMasonryThree(); |
| 86 | return false; |
| 87 | }); |
| 88 | |
| 89 | |
| 90 | // Function to set a cookie |
| 91 | function setCookie(name, value, days) { |
| 92 | var expires = ""; |
| 93 | if (days) { |
| 94 | var date = new Date(); |
| 95 | date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); |
| 96 | expires = "; expires=" + date.toUTCString(); |
| 97 | } |
| 98 | document.cookie = name + "=" + value + expires + "; path=/"; |
| 99 | } |
| 100 | |
| 101 | // Function to get a cookie |
| 102 | function getCookie(name) { |
| 103 | var nameEQ = name + "="; |
| 104 | var ca = document.cookie.split(';'); |
| 105 | for (var i = 0; i < ca.length; i++) { |
| 106 | var c = ca[i]; |
| 107 | while (c.charAt(0) === ' ') c = c.substring(1, c.length); |
| 108 | if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length); |
| 109 | } |
| 110 | return null; |
| 111 | } |
| 112 | |
| 113 | // Remain the last active settings tab |
| 114 | function keep_spe_settings_current_tab() { |
| 115 | |
| 116 | var activeButton = getCookie('spe_settings_current_tab'); |
| 117 | if ( activeButton ) { |
| 118 | // Tab active |
| 119 | $('.spe_dashboard .spe-tab-menu .tab-menu-link[data-content="' + activeButton + '"]').addClass('active'); |
| 120 | $('.spe_dashboard .spe-tab-menu .tab-menu-link:not([data-content="' + activeButton + '"])').removeClass('active'); |
| 121 | |
| 122 | // Tab content active |
| 123 | $('.spe_dashboard .tab_contents .spe-tab-box#' + activeButton).addClass('active'); |
| 124 | $('.spe_dashboard .tab_contents .spe-tab-box:not(#' + activeButton+')').removeClass('active'); |
| 125 | } |
| 126 | |
| 127 | // Handle button clicks |
| 128 | $('.spe-tab-menu .tab-menu-link').on('click', function () { |
| 129 | $('.spe-tab-menu .tab-menu-link').removeClass('active'); |
| 130 | $(this).addClass('active'); |
| 131 | |
| 132 | // Set a cookie to remember the active button |
| 133 | setCookie('spe_settings_current_tab', $(this).data('content'), 1); |
| 134 | }); |
| 135 | } |
| 136 | keep_spe_settings_current_tab(); |
| 137 | |
| 138 | // filter js |
| 139 | /*===========elements isotope js===========*/ |
| 140 | function filterMasonry() { |
| 141 | var filter = $("#elements_gallery"); |
| 142 | if (filter.length) { |
| 143 | filter.imagesLoaded(function () { |
| 144 | // images have loaded |
| 145 | // Activate isotope in container |
| 146 | filter.isotope({ |
| 147 | itemSelector: ".ezd-colum-space-4", |
| 148 | filter: "*", |
| 149 | }); |
| 150 | }); |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | $(document).ready(function () { |
| 155 | // Initialize Isotope on page load |
| 156 | filterMasonry(); |
| 157 | var filter = $("#elements_gallery"); |
| 158 | // Add isotope click function |
| 159 | $("#elements_filter div").on("click", function () { |
| 160 | $("#elements_filter div").removeClass("active"); |
| 161 | $(this).addClass("active"); |
| 162 | |
| 163 | var selector = $(this).attr("data-filter"); |
| 164 | filter.isotope({ |
| 165 | filter: selector, |
| 166 | }); |
| 167 | return false; |
| 168 | }); |
| 169 | }); |
| 170 | |
| 171 | /*===========elements isotope js===========*/ |
| 172 | |
| 173 | /*===========api isotope js===========*/ |
| 174 | function filterMasonryTwo() { |
| 175 | var filters = $("#api_setting"); |
| 176 | if (filters.length) { |
| 177 | filters.imagesLoaded(function () { |
| 178 | // images have loaded |
| 179 | // Activate isotope in container |
| 180 | filters.isotope({ |
| 181 | itemSelector: ".ezd-colum-space-4", |
| 182 | filter: "*", |
| 183 | }); |
| 184 | }); |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | $(document).ready(function () { |
| 189 | // Initialize Isotope on page load |
| 190 | filterMasonryTwo(); |
| 191 | var filter = $("#api_setting"); |
| 192 | // Add isotope click function |
| 193 | $("#api_filter div").on("click", function () { |
| 194 | $("#api_filter div").removeClass("active"); |
| 195 | $(this).addClass("active"); |
| 196 | |
| 197 | var selector = $(this).attr("data-filter"); |
| 198 | filter.isotope({ |
| 199 | filter: selector, |
| 200 | }); |
| 201 | return false; |
| 202 | }); |
| 203 | }); |
| 204 | |
| 205 | /*===========api isotope js===========*/ |
| 206 | |
| 207 | /* ============features isotope js ============*/ |
| 208 | function filterMasonryThree() { |
| 209 | var filter = $("#features_gallery"); |
| 210 | if (filter.length) { |
| 211 | filter.imagesLoaded(function () { |
| 212 | // images have loaded |
| 213 | // Activate isotope in container |
| 214 | filter.isotope({ |
| 215 | itemSelector: ".ezd-colum-space-4", |
| 216 | filter: "*", |
| 217 | }); |
| 218 | }); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | $(document).ready(function () { |
| 223 | // Initialize Isotope on page load |
| 224 | filterMasonryThree(); |
| 225 | var filter = $("#features_gallery"); |
| 226 | // Add isotope click function |
| 227 | $("#features_filter div").on("click", function () { |
| 228 | $("#features_filter div").removeClass("active"); |
| 229 | $(this).addClass("active"); |
| 230 | |
| 231 | var selector = $(this).attr("data-filter"); |
| 232 | filter.isotope({ |
| 233 | filter: selector, |
| 234 | }); |
| 235 | return false; |
| 236 | }); |
| 237 | }); |
| 238 | |
| 239 | $(".pro_popup").on("click", function (e) { |
| 240 | $("#elements_popup1").addClass("popup-visible"); |
| 241 | }); |
| 242 | $(".pro-close").on("click", function (e) { |
| 243 | $("#elements_popup1").removeClass("popup-visible"); |
| 244 | }); |
| 245 | |
| 246 | if ($(".spe_popup_youtube").length) { |
| 247 | $(".spe_popup_youtube").fancybox({ |
| 248 | type: "iframe", //<--added |
| 249 | maxWidth: 800, |
| 250 | maxHeight: 600, |
| 251 | fitToView: false, |
| 252 | width: "70%", |
| 253 | height: "70%", |
| 254 | autoSize: false, |
| 255 | closeClick: false, |
| 256 | openEffect: "elastic", |
| 257 | closeEffect: "elastic", |
| 258 | }); |
| 259 | } |
| 260 | |
| 261 | // Elements list Save Now Button |
| 262 | function elementsSaveNowButton() { |
| 263 | let elementsList = $(".spe_element_right .spe-widget-list"); |
| 264 | elementsList.on("click", function () { |
| 265 | // Check if the checkbox is checked |
| 266 | if ($(this).is(":checked")) { |
| 267 | $(".spe_dashboard_btn").addClass("save-now"); |
| 268 | } else { |
| 269 | $(".spe_dashboard_btn") |
| 270 | .removeClass("save-now") |
| 271 | .removeAttr("disabled") |
| 272 | .css("cursor", "pointer"); |
| 273 | } |
| 274 | }); |
| 275 | |
| 276 | // Global Switcher for all widgets |
| 277 | let globalSwitcher = $(".menu_right_content .spe_element_global_switcher"); |
| 278 | globalSwitcher.on("click", function () { |
| 279 | let status = $(this).prop("checked"); |
| 280 | let dataId = $(this).data("id"); |
| 281 | let alignClass = ".spe_widget_checkbox." + dataId + ":enabled"; |
| 282 | |
| 283 | $(alignClass).each(function () { |
| 284 | $(this).prop("checked", status).change(); |
| 285 | }); |
| 286 | |
| 287 | $(".spe_dashboard_btn") |
| 288 | .addClass("save-now") |
| 289 | .removeAttr("disabled") |
| 290 | .css("cursor", "pointer"); |
| 291 | }); |
| 292 | |
| 293 | // Individual Switcher for each widget |
| 294 | let widgetSwitcher = $(".spe_element_right .spe-widget-list:checked"); |
| 295 | widgetSwitcher.on("click", function () { |
| 296 | $(".spe_dashboard_btn") |
| 297 | .addClass("save-now") |
| 298 | .removeAttr("disabled") |
| 299 | .css("cursor", "pointer"); |
| 300 | }); |
| 301 | |
| 302 | // Button Setting Switcher Enable/Disable |
| 303 | let elementsSettingBtn = $( |
| 304 | ".spe_elements_tab_menu .menu_right_content .save_btn" |
| 305 | ); |
| 306 | elementsSettingBtn.on("click", function (event) { |
| 307 | //event.preventDefault(); |
| 308 | //alert('Saved Successfully'); |
| 309 | }); |
| 310 | } |
| 311 | |
| 312 | elementsSaveNowButton(); |
| 313 | })(jQuery); |
| 314 |