/*! * jQuery Cookie Plugin v1.4.1 * https://github.com/carhartl/jquery-cookie * * Copyright 2013 Klaus Hartl * Released under the MIT license */ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)}(function(a){var o=/\+/g;function s(e){return x.raw?e:encodeURIComponent(e)}function m(e,n){e=x.raw?e:function(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e=decodeURIComponent(e.replace(o," ")),x.json?JSON.parse(e):e}catch(n){}}(e);return"function"==typeof n?n(e):e}var x=a.cookie=function(e,n,o){var i,t;if(n!==undefined&&"function"!=typeof n)return"number"==typeof(o=a.extend({},x.defaults,o)).expires&&(i=o.expires,(t=o.expires=new Date).setTime(+t+864e5*i)),document.cookie=[s(e),"=",(t=n,s(x.json?JSON.stringify(t):String(t))),o.expires?"; expires="+o.expires.toUTCString():"",o.path?"; path="+o.path:"",o.domain?"; domain="+o.domain:"",o.secure?"; secure":""].join("");for(var r=e?undefined:{},c=document.cookie?document.cookie.split("; "):[],u=0,f=c.length;u{const e=new Map;return{all:(t={})=>Array.from(e.values()).flatMap((e=>Object.values(e.get(t)))),allByProvider:(t={})=>Array.from(e.entries()).map((([e,r])=>[e,Object.values(r.get(t))])),register:(t,r)=>{e.set(t,r)},subscribe:t=>{const r=Array.from(e.values()).map((e=>e.subscribe(t)));return()=>{r.forEach((e=>e()))}}}})();function i(e={}){const[,t]=(0,r.useReducer)((e=>!e),!1);return(0,r.useEffect)((()=>s.subscribe(t)),[]),s.allByProvider(e)}var l="elements",u={get:(e={})=>{let t=(0,n.getElements)();"elementId"in e&&e.elementId&&(t=t.filter((t=>t.id===e.elementId)));const r=t.flatMap((e=>{const t=e.model.get("styles");return t?Object.entries(t):[]}));return Object.fromEntries(r)},subscribe:e=>(0,o.__privateListenTo)([(0,o.commandEndEvent)("editor/documents/attach-preview"),(0,o.commandEndEvent)("document/atomic-widgets/styles")],e)};s.register("elements",u),(window.elementorV2=window.elementorV2||{}).editorStylesRepository=t}(); (function($){ SpeciaCompanionInstallTheme = { /** * Init */ init: function() { this._bind(); }, /** * Binds events for the Hotspot. * * @since 1.3.2 * * @access private * @method _bind */ _bind: function() { $( document ).on( 'click', '.clever-fox-theme-not-installed', SpeciaCompanionInstallTheme._install_and_activate ); $( document ).on( 'click', '.clever-fox-theme-installed-but-inactive', SpeciaCompanionInstallTheme._activateTheme ); $( document ).on('wp-theme-install-success' , SpeciaCompanionInstallTheme._activateTheme); }, /** * Activate Theme * * @since 1.3.2 */ _activateTheme: function( event, response ) { event.preventDefault(); //alert(JSON.stringify(response)); //alert(response.slug); $('#specia-theme-activation-xl a.xl-install-action').addClass('processing'); if( response ) { $('#specia-theme-activation-xl a.xl-install-action').text( CleverFoxInstallThemeVars.installed ); var theme_slug =response.slug; } else { $('#specia-theme-activation-xl a.xl-install-action').text( CleverFoxInstallThemeVars.activating ); var theme_slug = $(this).data('theme-slug') || ''; } // WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that. setTimeout( function() { $.ajax({ url: CleverFoxInstallThemeVars.ajaxurl, type: 'POST', data: { 'action' : 'clever-fox-activate-theme', security : CleverFoxInstallThemeVars.security, specia_current_theme: theme_slug }, }) .done(function (result) { if( result.success ) { $('#specia-theme-activation-xl a.xl-install-action').text( CleverFoxInstallThemeVars.activated ); $('#specia-theme-activation-xl a.xl-install-action').removeClass( 'shake' ); setTimeout(function() { location.reload(); }, 1000); } }); }, 3000 ); }, /** * Install and activate * * @since 1.3.2 * * @param {object} event Current event. * @return void */ _install_and_activate: function(event ) { event.preventDefault(); var theme_slug = $(this).data('theme-slug') || ''; console.log( theme_slug ); console.log( 'yes' ); var btn = $( event.target ); if ( btn.hasClass( 'processing' ) ) { return; } btn.text( CleverFoxInstallThemeVars.installing ).addClass('processing'); $('#specia-theme-activation-php').text( theme_slug ); //alert(theme_slug); //alert(theme_slug); // var data = { // action: 'clever-fox-activate-theme', // security : CleverFoxInstallThemeVars.security, // specia_current_theme: theme_slug //}; // $.post(CleverFoxInstallThemeVars.ajaxurl, data, function(response) { // jQuery("#specia-theme-activation-php").html(response); // alert('Product id is: ' + data.specia_current_theme); //alert(response); // }); if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) { wp.updates.requestFilesystemCredentials( event ); } wp.updates.installTheme( { slug: theme_slug }); } }; /** * Initialize */ $(function(){ SpeciaCompanionInstallTheme.init(); }); })(jQuery);No direct script access allowed