first commit

This commit is contained in:
2024-07-15 11:28:08 +02:00
commit f52d538ea5
21891 changed files with 6161164 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
/* global ajaxurl, storefrontNUX */
( function( wp, $ ) {
'use strict';
if ( ! wp ) {
return;
}
$( function() {
// Dismiss notice
$( document ).on( 'click', '.sf-notice-nux .notice-dismiss', function() {
$.ajax({
type: 'POST',
url: ajaxurl,
data: { nonce: storefrontNUX.nonce, action: 'storefront_dismiss_notice' },
dataType: 'json'
});
});
});
})( window.wp, jQuery );

View File

@@ -0,0 +1 @@
!function(n,o){"use strict";n&&o(function(){o(document).on("click",".sf-notice-nux .notice-dismiss",function(){o.ajax({type:"POST",url:ajaxurl,data:{nonce:storefrontNUX.nonce,action:"storefront_dismiss_notice"},dataType:"json"})})})}(window.wp,jQuery);

View File

@@ -0,0 +1,243 @@
/* global _wpCustomizeSFGuidedTourSteps */
( function( wp, $ ) {
'use strict';
if ( ! wp || ! wp.customize ) { return; }
// Set up our namespace.
var api = wp.customize;
api.SFGuidedTourSteps = [];
if ( 'undefined' !== typeof _wpCustomizeSFGuidedTourSteps ) {
$.extend( api.SFGuidedTourSteps, _wpCustomizeSFGuidedTourSteps );
}
/**
* wp.customize.SFGuidedTour
*
*/
api.SFGuidedTour = {
$container: null,
currentStep: -1,
init: function() {
this._setupUI();
},
_setupUI: function() {
var self = this,
$wpCustomize = $( 'body.wp-customizer .wp-full-overlay' );
this.$container = $( '<div/>' ).addClass( 'sf-guided-tour' );
// Add guided tour div
$wpCustomize.prepend( this.$container );
// Add listeners
this._addListeners();
// Initial position
this.$container.css( ! $( 'body' ).hasClass( 'rtl' ) ? 'left' : 'right', ( $( '#customize-controls' ).width() + 10 ) + 'px' ).on( 'transitionend', function() {
self.$container.addClass( 'sf-loaded' );
});
// Show first step
this._showNextStep();
$( document ).on( 'click', '.sf-guided-tour-step .sf-nux-button', function() {
self._showNextStep();
return false;
});
$( document ).on( 'click', '.sf-guided-tour-step .sf-guided-tour-skip', function() {
if ( 0 === self.currentStep ) {
self._hideTour( true );
} else {
self._showNextStep();
}
return false;
});
},
_addListeners: function() {
var self = this;
api.state( 'expandedSection' ).bind( function() {
self._adjustPosition();
});
api.state( 'expandedPanel' ).bind( function() {
self._adjustPosition();
});
},
_adjustPosition: function() {
var step = this._getCurrentStep(),
expandedSection = api.state( 'expandedSection' ).get(),
expandedPanel = api.state( 'expandedPanel' ).get();
if ( ! step ) {
return;
}
this.$container.removeClass( 'sf-inside-section' );
if ( expandedSection && step.section === expandedSection.id ) {
this._moveContainer( $( expandedSection.container[1] ).find( '.customize-section-title' ) );
this.$container.addClass( 'sf-inside-section' );
} else if ( false === expandedSection && false === expandedPanel ) {
if ( this._isTourHidden() ) {
this._revealTour();
} else {
var selector = this._getSelector( step.section );
this._moveContainer( selector );
}
} else {
this._hideTour();
}
},
_hideTour: function( remove ) {
var self = this;
// Already hidden?
if ( this._isTourHidden() ) {
return;
}
this.$container.css({
transform: '',
top: this.$container.offset().top
});
$( 'body' ).addClass( 'sf-exiting' ).on( 'animationend.storefront webkitAnimationEnd.storefront', function() {
$( this ).removeClass( 'sf-exiting' ).off( 'animationend.storefront webkitAnimationEnd.storefront' ).addClass( 'sf-hidden' );
self.$container.hide();
if ( ! _.isUndefined( remove ) && true === remove ) {
self._removeTour();
}
});
},
_revealTour: function() {
var self = this;
$( 'body' ).removeClass( 'sf-hidden' );
self.$container.show();
$( 'body' ).addClass( 'sf-entering' ).on( 'animationend.storefront webkitAnimationEnd.storefront', function() {
$( this ).removeClass( 'sf-entering' ).off( 'animationend.storefront webkitAnimationEnd.storefront' );
self.$container.css({
top: 'auto',
transform: 'translateY(' + parseInt( self.$container.offset().top, 10 ) + 'px)'
});
});
},
_removeTour: function() {
this.$container.remove();
},
_closeAllSections: function() {
api.section.each( function ( section ) {
section.collapse( { duration: 0 } );
});
api.panel.each( function ( panel ) {
panel.collapse( { duration: 0 } );
});
},
_showNextStep: function() {
var step, template;
if ( this._isLastStep() ) {
this._hideTour( true );
return;
}
this._closeAllSections();
// Get next step
step = this._getNextStep();
// Convert line breaks to paragraphs
step.message = this._lineBreaksToParagraphs( step.message );
// Load template
template = wp.template( 'sf-guided-tour-step' );
this.$container.removeClass( 'sf-first-step' );
if ( 0 === this.currentStep ) {
step.first_step = true;
this.$container.addClass( 'sf-first-step' );
}
if ( this._isLastStep() ) {
step.last_step = true;
this.$container.addClass( 'sf-last-step' );
}
this._moveContainer( this._getSelector( step.section ) );
this.$container.html( template( step ) );
},
_moveContainer: function( $selector ) {
var self = this, position;
if ( ! $selector ) {
return;
}
position = parseInt( $selector.offset().top, 10 ) + ( $selector.height() / 2 ) - 44;
this.$container.addClass( 'sf-moving' ).css({ 'transform': 'translateY(' + parseInt( position, 10 ) + 'px)' }).on( 'transitionend.storefront', function() {
self.$container.removeClass( 'sf-moving' );
self.$container.off( 'transitionend.storefront' );
} );
},
_getSelector: function( pointTo ) {
var sectionOrPanel = api.section( pointTo ) ? api.section( pointTo ) : api.panel( pointTo );
// Check whether this is a section, panel, or a regular selector
if ( ! _.isUndefined( sectionOrPanel ) ) {
return $( sectionOrPanel.container[0] );
}
return $( pointTo );
},
_getCurrentStep: function() {
return api.SFGuidedTourSteps[ this.currentStep ];
},
_getNextStep: function() {
this.currentStep = this.currentStep + 1;
return api.SFGuidedTourSteps[ this.currentStep ];
},
_isTourHidden: function() {
return ( ( $( 'body' ).hasClass( 'sf-hidden' ) ) ? true : false );
},
_isLastStep: function() {
return ( ( ( this.currentStep + 1 ) < api.SFGuidedTourSteps.length ) ? false : true );
},
_lineBreaksToParagraphs: function( message ) {
return '<p>' + message.replace( '\n\n', '</p><p>' ) + '</p>';
}
};
$( document ).ready( function() {
api.SFGuidedTour.init();
});
} )( window.wp, jQuery );

View File

@@ -0,0 +1 @@
!function(n,s){"use strict";if(n&&n.customize){var o=n.customize;o.SFGuidedTourSteps=[],"undefined"!=typeof _wpCustomizeSFGuidedTourSteps&&s.extend(o.SFGuidedTourSteps,_wpCustomizeSFGuidedTourSteps),o.SFGuidedTour={$container:null,currentStep:-1,init:function(){this._setupUI()},_setupUI:function(){var t=this,e=s("body.wp-customizer .wp-full-overlay");this.$container=s("<div/>").addClass("sf-guided-tour"),e.prepend(this.$container),this._addListeners(),this.$container.css(s("body").hasClass("rtl")?"right":"left",s("#customize-controls").width()+10+"px").on("transitionend",function(){t.$container.addClass("sf-loaded")}),this._showNextStep(),s(document).on("click",".sf-guided-tour-step .sf-nux-button",function(){return t._showNextStep(),!1}),s(document).on("click",".sf-guided-tour-step .sf-guided-tour-skip",function(){return 0===t.currentStep?t._hideTour(!0):t._showNextStep(),!1})},_addListeners:function(){var t=this;o.state("expandedSection").bind(function(){t._adjustPosition()}),o.state("expandedPanel").bind(function(){t._adjustPosition()})},_adjustPosition:function(){var t=this._getCurrentStep(),e=o.state("expandedSection").get(),n=o.state("expandedPanel").get();if(t)if(this.$container.removeClass("sf-inside-section"),e&&t.section===e.id)this._moveContainer(s(e.container[1]).find(".customize-section-title")),this.$container.addClass("sf-inside-section");else if(!1===e&&!1===n)if(this._isTourHidden())this._revealTour();else{var i=this._getSelector(t.section);this._moveContainer(i)}else this._hideTour()},_hideTour:function(t){var e=this;this._isTourHidden()||(this.$container.css({transform:"",top:this.$container.offset().top}),s("body").addClass("sf-exiting").on("animationend.storefront webkitAnimationEnd.storefront",function(){s(this).removeClass("sf-exiting").off("animationend.storefront webkitAnimationEnd.storefront").addClass("sf-hidden"),e.$container.hide(),_.isUndefined(t)||!0!==t||e._removeTour()}))},_revealTour:function(){var t=this;s("body").removeClass("sf-hidden"),t.$container.show(),s("body").addClass("sf-entering").on("animationend.storefront webkitAnimationEnd.storefront",function(){s(this).removeClass("sf-entering").off("animationend.storefront webkitAnimationEnd.storefront"),t.$container.css({top:"auto",transform:"translateY("+parseInt(t.$container.offset().top,10)+"px)"})})},_removeTour:function(){this.$container.remove()},_closeAllSections:function(){o.section.each(function(t){t.collapse({duration:0})}),o.panel.each(function(t){t.collapse({duration:0})})},_showNextStep:function(){var t,e;this._isLastStep()?this._hideTour(!0):(this._closeAllSections(),(t=this._getNextStep()).message=this._lineBreaksToParagraphs(t.message),e=n.template("sf-guided-tour-step"),this.$container.removeClass("sf-first-step"),0===this.currentStep&&(t.first_step=!0,this.$container.addClass("sf-first-step")),this._isLastStep()&&(t.last_step=!0,this.$container.addClass("sf-last-step")),this._moveContainer(this._getSelector(t.section)),this.$container.html(e(t)))},_moveContainer:function(t){var e,n=this;t&&(e=parseInt(t.offset().top,10)+t.height()/2-44,this.$container.addClass("sf-moving").css({transform:"translateY("+parseInt(e,10)+"px)"}).on("transitionend.storefront",function(){n.$container.removeClass("sf-moving"),n.$container.off("transitionend.storefront")}))},_getSelector:function(t){var e=o.section(t)?o.section(t):o.panel(t);return _.isUndefined(e)?s(t):s(e.container[0])},_getCurrentStep:function(){return o.SFGuidedTourSteps[this.currentStep]},_getNextStep:function(){return this.currentStep=this.currentStep+1,o.SFGuidedTourSteps[this.currentStep]},_isTourHidden:function(){return!!s("body").hasClass("sf-hidden")},_isLastStep:function(){return!(this.currentStep+1<o.SFGuidedTourSteps.length)},_lineBreaksToParagraphs:function(t){return"<p>"+t.replace("\n\n","</p><p>")+"</p>"}},s(document).ready(function(){o.SFGuidedTour.init()})}}(window.wp,jQuery);

View File

@@ -0,0 +1,41 @@
( function( wp, $ ) {
'use strict';
if ( ! wp ) {
return;
}
$( function() {
$( document ).on( 'click', '.sf-install-now', function( event ) {
var $button = $( event.target );
if ( $button.hasClass( 'activate-now' ) ) {
return true;
}
event.preventDefault();
if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) {
return;
}
if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) {
wp.updates.requestFilesystemCredentials( event );
$( document ).on( 'credential-modal-cancel', function() {
var $message = $( '.sf-install-now.updating-message' );
$message
.removeClass( 'updating-message' )
.text( wp.updates.l10n.installNow );
wp.a11y.speak( wp.updates.l10n.updateCancel, 'polite' );
} );
}
wp.updates.installPlugin( {
slug: $button.data( 'slug' )
} );
});
});
})( window.wp, jQuery );

View File

@@ -0,0 +1 @@
!function(a,t){"use strict";a&&t(function(){t(document).on("click",".sf-install-now",function(e){var s=t(e.target);if(s.hasClass("activate-now"))return!0;e.preventDefault(),s.hasClass("updating-message")||s.hasClass("button-disabled")||(a.updates.shouldRequestFilesystemCredentials&&!a.updates.ajaxLocked&&(a.updates.requestFilesystemCredentials(e),t(document).on("credential-modal-cancel",function(){t(".sf-install-now.updating-message").removeClass("updating-message").text(a.updates.l10n.installNow),a.a11y.speak(a.updates.l10n.updateCancel,"polite")})),a.updates.installPlugin({slug:s.data("slug")}))})})}(window.wp,jQuery);