This commit is contained in:
2026-04-26 23:47:49 +02:00
parent 1b95f03d1e
commit b073e009d8
5288 changed files with 1112699 additions and 55536 deletions

View File

@@ -0,0 +1,338 @@
/**
* SBY Admin Notifications.
*
* @since 2.18
*/
'use strict';
var SBYAdminNotifications = window.SBYAdminNotifications || ( function( document, window, $ ) {
/**
* Elements holder.
*
* @since 2.18
*
* @type {object}
*/
var el = {
$notifications: $( '#sby-notifications' ),
$nextButton: $( '#sby-notifications .navigation .next' ),
$prevButton: $( '#sby-notifications .navigation .prev' ),
$adminBarCounter: $( '#wp-admin-bar-wpforms-menu .sby-menu-notification-counter' ),
$adminBarMenuItem: $( '#wp-admin-bar-sby-notifications' ),
};
/**
* Public functions and properties.
*
* @since 2.18
*
* @type {object}
*/
var app = {
/**
* Start the engine.
*
* @since 2.18
*/
init: function() {
//Re-init elements to get a fresh copy of those in memory for the React app.
el = {
$notifications: $( '#sby-notifications' ),
$nextButton: $( '#sby-notifications .navigation .next' ),
$prevButton: $( '#sby-notifications .navigation .prev' ),
$adminBarCounter: $( '#wp-admin-bar-wpforms-menu .sby-menu-notification-counter' ),
$adminBarMenuItem: $( '#wp-admin-bar-sby-notifications' ),
};
el.$notifications.find( '.messages a').each(function() {
if ($(this).attr('href').indexOf('dismiss=') > -1 ) {
$(this).addClass('button-dismiss');
}
})
$( app.ready );
},
jqueryInit: function ($) {
$(document).on('click', '#renew-modal-btn', function() {
$('.sby-sb-modal').show();
});
$(document).on('click', '#sby-sb-close-modal', function() {
$('.sby-sb-modal').hide();
});
/**
* Recheck the licensey key by sending AJAX request to the server
*
* @since 4.0
*/
$(document).on('click', "#sby-recheck-license-key", function() {
$(this).find('.spinner-icon').show();
let sbyLicenseNotice = $('#sby-license-notice');
$.ajax({
url: sby_admin.ajax_url,
data: {
action: 'sby_check_license',
sby_nonce: sby_admin.nonce
},
success: function(result){
$(this).find('.spinner-icon').hide();
if ( sbyLicenseNotice ) {
if ( result.success == true ) {
sbyLicenseNotice.removeClass('sby-license-expired-notice').addClass('sby-license-renewed-notice');
}
sbyLicenseNotice.html( result.data.content );
}
}
});
});
/**
* Dismiss the renewed license notice
*
* @since 4.0
*/
$(document).on('click', "#sby-hide-notice", function() {
let sbyLicenseNotice = $('#sby-license-notice');
let sbyLicenseModal = $('.sby-sb-modal');
sbyLicenseNotice.remove();
sbyLicenseModal.remove();
});
/**
* Dismiss the license notice on dashboard page
*
* @since 4.0
*/
$(document).on('click', "#sb-dismiss-notice", function() {
let sbyLicenseNotice = $('#sby-license-notice');
let sbyLicenseModal = $('.sby-sb-modal');
sbyLicenseNotice.remove();
sbyLicenseModal.remove();
$.ajax({
url: sby_admin.ajax_url,
data: {
action: 'sby_dismiss_license_notice',
sby_nonce: sby_admin.nonce
},
success: function(result){
}
});
});
$('body').on('click', '#sby_review_consent_yes', function(e) {
let reviewStep1 = $('.sby_review_notice_step_1, .sby_review_step1_notice');
let reviewStep2 = $('.sby_notice.sby_review_notice, .rn_step_2');
reviewStep1.hide();
reviewStep2.show();
$.ajax({
url : sby_admin.ajax_url,
type : 'post',
data : {
action : 'sby_review_notice_consent_update',
consent : 'yes',
sby_nonce: sby_admin.nonce,
},
success : function(data) {
}
}); // ajax call
});
$('body').on('click', '#sby_review_consent_no', function(e) {
let reviewStep1 = $('.sby_review_notice_step_1, #sby-notifications');
reviewStep1.hide();
$.ajax({
url : sby_admin.ajax_url,
type : 'post',
data : {
action : 'sby_review_notice_consent_update',
consent : 'no',
sby_nonce: sby_admin.nonce,
},
success : function(data) {
}
}); // ajax call
});
$(document).on('click', '#renew-modal-btn', function() {
$('.sby-sb-modal').show();
});
$(document).on('click', '#sby-sb-close-modal', function() {
$('.sby-sb-modal').hide();
});
},
/**
* Document ready.
*
* @since 2.18
*/
ready: function() {
app.updateNavigation();
app.events();
},
/**
* Register JS events.
*
* @since 2.18
*/
events: function() {
el.$notifications
.on( 'click', '.dismiss', app.dismiss )
.on( 'click', '.button-dismiss', app.buttonDismiss )
.on( 'click', '.next', app.navNext )
.on( 'click', '.prev', app.navPrev );
},
/**
* Click on a dismiss button.
*
* @since 2.18
*/
buttonDismiss: function( event ) {
event.preventDefault();
app.dismiss(event);
},
/**
* Click on the Dismiss notification button.
*
* @since 2.18
*
* @param {object} event Event object.
*/
dismiss: function( event ) {
if ( el.$currentMessage.length === 0 ) {
return;
}
// Update counter.
var count = parseInt( el.$adminBarCounter.text(), 10 );
if ( count > 1 ) {
--count;
el.$adminBarCounter.html( '<span>' + count + '</span>' );
} else {
el.$adminBarCounter.remove();
el.$adminBarMenuItem.remove();
}
// Remove notification.
var $nextMessage = el.$nextMessage.length < 1 ? el.$prevMessage : el.$nextMessage,
messageId = el.$currentMessage.data( 'message-id' );
if ( $nextMessage.length === 0 ) {
el.$notifications.remove();
} else {
el.$currentMessage.remove();
$nextMessage.addClass( 'current' );
app.updateNavigation();
}
// AJAX call - update option.
var data = {
action: 'sby_dashboard_notification_dismiss',
nonce: sby_admin.nonce,
id: messageId,
};
$.post( sby_admin.ajax_url, data, function( res ) {
if ( ! res.success ) {
//SBYAdmin.debug( res );
}
} ).fail( function( xhr, textStatus, e ) {
//SBYAdmin.debug( xhr.responseText );
} );
},
/**
* Click on the Next notification button.
*
* @since 2.18
*
* @param {object} event Event object.
*/
navNext: function( event ) {
if ( el.$nextButton.hasClass( 'disabled' ) ) {
return;
}
el.$currentMessage.removeClass( 'current' );
el.$nextMessage.addClass( 'current' );
app.updateNavigation();
},
/**
* Click on the Previous notification button.
*
* @since 2.18
*
* @param {object} event Event object.
*/
navPrev: function( event ) {
if ( el.$prevButton.hasClass( 'disabled' ) ) {
return;
}
el.$currentMessage.removeClass( 'current' );
el.$prevMessage.addClass( 'current' );
app.updateNavigation();
},
/**
* Update navigation buttons.
*
* @since 2.18
*/
updateNavigation: function() {
el.$currentMessage = el.$notifications.find( '.message.current' );
el.$nextMessage = el.$currentMessage.next( '.message' );
el.$prevMessage = el.$currentMessage.prev( '.message' );
if ( el.$nextMessage.length === 0 ) {
el.$nextButton.addClass( 'disabled' );
} else {
el.$nextButton.removeClass( 'disabled' );
}
if ( el.$prevMessage.length === 0 ) {
el.$prevButton.addClass( 'disabled' );
} else {
el.$prevButton.removeClass( 'disabled' );
}
},
};
return app;
}( document, window, jQuery ) );
// Initialize.
SBYAdminNotifications.init();
jQuery(document).ready(SBYAdminNotifications.jqueryInit);

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,693 @@
import {addFilter, addAction} from "@wordpress/hooks";
SB_Customizer.initPromise = new Promise((resolve) => {
SB_Customizer.extraData = {
...SB_Customizer.extraData,
allFeedsScreen : sbc_builder.allFeedsScreen,
feedsList : sbc_builder.feeds,
legacyFeedsList: sbc_builder.legacyFeeds,
tooltipContent : sbc_builder.feedtypesTooltipContent,
feedSettingsDomOptions : null,
selectedFeedModel : {
channel: sbc_builder.prefilledChannelId,
playlist: '',
favorites: sbc_builder.prefilledChannelId,
search: '',
live: sbc_builder.prefilledChannelId,
single: '',
apiKey: '',
accessToken: ''
},
youtubeAccountConnectURL : sbc_builder.youtubeAccountConnectURL,
connectSiteParameters: sbc_builder.youtubeAccountConnectParameters,
prefilledChannelId: sbc_builder.prefilledChannelId,
dismissLite: sbc_builder.youtube_feed_dismiss_lite,
shouldShowFeedAPIForm : false,
shouldShowManualConnect : false,
showShowYTAccountWarning : false,
sw_feed: false,
sw_feed_id: false
}
SB_Customizer.extraMethods = {
...SB_Customizer.extraMethods,
/**
* Change Settings Value
*
* @since 2.0
*/
changeSettingValue : function(settingID, value, doProcess = true, ajaxAction = false) {
var self = this;
if(doProcess){
self.customizerFeedData.settings[settingID] = value;
}
if(ajaxAction !== false){
self.customizerControlAjaxAction(ajaxAction, settingID);
}
self.regenerateLayout(settingID);
},
checkExtensionActive : function(extension){
var self = this;
return self.activeExtensions[extension];
},
/**
* Should show overlay for the sidebar elements on top
*
* @since 2.0
*/
shouldShowOverlay(control) {
var self = this;
if ( !self.sbyIsPro ||
self.sbyLicenseNoticeActive ||
( ( control.checkExtensionPopup == 'call_to_action' || control.checkExtensionPopup == 'advancedFilters' ) &&
( !self.hasFeature('call_to_actions') || !self.hasFeature('advancedFilters') )
)
) {
return control.checkExtensionPopup != undefined || (
control.condition != undefined ||
control.checkExtension != undefined ||
control.checkExtensionDimmed != undefined ?
!self.checkControlCondition(control.condition, control.checkExtension, control.checkExtensionDimmed) :
false
);
} else {
return control.condition != undefined ||
control.checkExtension != undefined ||
control.checkExtensionDimmed != undefined ?
!self.checkControlCondition(control.condition, control.checkExtension, control.checkExtensionDimmed) :
false;
}
},
/**
* Should show toggleset type cover
*
* @since 2.0
*/
shouldShowTogglesetCover : function(toggle) {
var self = this;
if ( !self.sbyIsPro || self.sbyLicenseNoticeActive ) {
return toggle.checkExtension != undefined && !self.checkExtensionActive(toggle.checkExtension)
} else {
return false
}
},
/**
* Open extension popup from toggleset cover
*
* @since 2.0
*/
togglesetExtPopup : function(toggle) {
var self = this;
self.viewsActive.extensionsPopupElement = toggle.checkExtension;
},
/**
* Shortcode Global Layout Settings
*
* @since 2.0
*/
regenerateLayout : function(settingID) {
var self = this,
regenerateFeedHTML = [
'layout'
],
relayoutFeed = [
'layout',
'carouselarrows',
'carouselpag',
'carouselautoplay',
'carouseltime',
'carouselloop',
'carouselrows',
'cols',
'colstablet',
'colsmobile',
'imagepadding'
];
if( relayoutFeed.includes( settingID ) ){
setTimeout(function(){
self.setShortcodeGlobalSettings(true);
}, 200)
}
},
/**
* Back to all feeds
*
* @since 2.0
*/
backToAllFeeds : function() {
var self = this;
if ( JSON.stringify(self.customizerFeedDataInitial) === JSON.stringify(self.customizerFeedData) ) {
window.location = self.builderUrl;
} else {
self.openDialogBox('backAllToFeed');
}
},
/**
* Open Dialog Box
*
* @since 2.0
*/
openDialogBox : function(type, args = []){
var self = this,
heading = self.dialogBoxPopupScreen[type].heading,
description = self.dialogBoxPopupScreen[type].description,
customButtons = self.dialogBoxPopupScreen[type].customButtons;
switch (type) {
case "deleteSingleFeed":
self.feedToDelete = args;
heading = heading.replace("#", self.feedToDelete.feed_name);
break;
}
self.dialogBox = {
active : true,
type : type,
heading : heading,
description : description,
customButtons : customButtons
};
window.event.stopPropagation();
},
/**
* Confirm Dialog Box Actions
*
* @since 2.0
*/
confirmDialogAction : function(){
var self = this;
switch (self.dialogBox.type) {
case 'deleteSingleFeed':
self.feedActionDelete([self.feedToDelete.id]);
break;
case 'deleteMultipleFeeds':
self.feedActionDelete(self.feedsSelected);
break;
case 'backAllToFeed':
window.location = self.builderUrl;
break;
}
},
/**
* Delete Feed
*
* @since 2.0
*/
feedActionDelete : function(feeds_ids){
var self = this,
feedsDeleteData = {
action : 'sby_feed_saver_manager_delete_feeds',
feeds_ids : feeds_ids
};
self.ajaxPost(feedsDeleteData, function(_ref){
var data = _ref.data;
self.feedsList = Object.values(Object.assign({}, data));
self.feedsSelected = [];
});
},
/**
* Enable & Show Color Picker
*
* @since 2.0
*/
showColorPickerPospup : function(controlId){
this.customizerScreens.activeColorPicker = controlId;
},
/**
* Hide Color Picker
*
* @since 2.0
*/
hideColorPickerPopup : function(){
this.customizerScreens.activeColorPicker = null;
},
/**
* Get Feed Preview Global CSS Class
*
* @since 2.0
* @return String
*/
getPaletteClass : function(context = ''){
var self = this,
colorPalette = self.customizerFeedData.settings.colorpalette;
if(self.checkNotEmpty( colorPalette )){
var feedID = colorPalette === 'custom' ? ('_' + self.customizerFeedData.feed_info.id) : '';
console.log(colorPalette !== 'inherit' ? ' sby' + context + '_palette_' + colorPalette + feedID: '');
return colorPalette !== 'inherit' ? ' sby' + context + '_palette_' + colorPalette + feedID: '';
}
return '';
},
/**
* Check if Value is Empty
*
* @since 2.0
*
* @return boolean
*/
checkNotEmpty : function(value){
return value != null && value.replace(/ /gi,'') != '';
},
/**
* Get feed container class
*
* @since 2.0
*
* @returns string
*/
getFeedContainerClasses: function() {
let self = this;
let classes = [
'sb_youtube',
'sby_layout_' + self.customizerFeedData.settings.layout,
'sby_col_' + self.getColSettings(),
'sby_mob_col_' + self.getMobColSettings(),
'sby_palette_' + self.getColorPaletteClass(),
];
return classes.join(' ');
},
getColorPaletteClass : function() {
let self = this;
if ( self.customizerFeedData.settings.colorpalette == 'custom' ) {
return self.customizerFeedData.settings.colorpalette + '_' + self.customizerFeedData.feed_info.id;
} else {
return self.customizerFeedData.settings.colorpalette;
}
},
/**
* Get Col Settings
*
* @since 2.0
*/
getColSettings: function() {
let self = this;
if ( self.customizerFeedData.settings['layout'] == 'list' || self.customizerScreens.previewScreen === 'mobile' ) {
return 0;
}
if ( self.customizerFeedData.settings['cols'] ) {
return self.customizerFeedData.settings['cols'];
}
return 0;
},
/**
* Get Mob Col Settings
*
* @since 2.0
*/
getMobColSettings: function() {
let self = this;
if ( self.customizerFeedData.settings['layout'] == 'list' ) {
return 0;
}
if ( self.customizerFeedData.settings['colsmobile'] ) {
return self.customizerFeedData.settings['colsmobile'];
}
return 0;
},
/**
* Check if header subscribers needs to show
*
* @since 2.0
*/
checkShouldShowSubscribers: function() {
return this.customizerFeedData.settings.showsubscribe == true ? "shown" : '';
},
/**
* Check if Data Setting is Enabled
*
* @since 2.0
*
* @return boolean
*/
valueIsEnabled : function(value){
return value == 1 || value == true || value == 'true' || value == 'on';
},
//Change Switcher Settings
changeSwitcherSettingValue : function(settingID, onValue, offValue, ajaxAction = false, extension) {
var self = this;
console.log(extension);
if (Object.keys(self.inActiveExtensions).includes(settingID)) {
self.viewsActive.extensionsPopupElement = self.inActiveExtensions[settingID];
}
self.customizerFeedData.settings[settingID] = self.customizerFeedData.settings[settingID] == onValue ? offValue : onValue;
if(ajaxAction !== false){
self.customizerControlAjaxAction(ajaxAction);
}
self.regenerateLayout(settingID);
},
/**
* Parse JSON
*
* @since 2.0
*
* @return jsonObject / Boolean
*/
jsonParse : function(jsonString){
try {
return JSON.parse(jsonString);
} catch(e) {
return false;
}
},
/**
* Get custom header text
*
* @since 2.0
*/
getCustomHeaderText : function() {
return this.customizerFeedData.settings.customheadertext;
},
/**
* Should show the standard header
*
* @since 2.0
*/
shouldShowStandardHeader: function() {
let self = this;
return self.customizerFeedData.settings.showheader && self.customizerFeedData.settings.headerstyle === 'standard';
},
/**
* Should show the text style header
*
* @since 2.0
*/
shouldShowTextHeader: function() {
let self = this;
return self.customizerFeedData.settings.showheader && self.customizerFeedData.settings.headerstyle === 'text';
},
/**
* Get flags attributes
*
* @since 2.0
*/
getFlagsAttr : function( ) {
let self = this,
flags = [];
if ( self.customizerFeedData.settings['disable_resize'] ) {
flags.push('resizeDisable');
}
if ( self.customizerFeedData.settings['favor_local'] ) {
flags.push('favorLocal');
}
if ( self.customizerFeedData.settings['disable_js_image_loading'] ) {
flags.push('imageLoadDisable');
}
if ( self.customizerFeedData.settings['ajax_post_load'] ) {
flags.push('ajaxPostLoad');
}
if ( self.customizerFeedData.settings['playerratio'] === '3:4' ) {
flags.push('narrowPlayer');
}
if ( self.customizerFeedData.settings['disablecdn'] ) {
flags.push('disablecdn');
}
return flags.toString();
},
/**
* Should show gallery layout player
*
* @since 2.0
*/
shouldShowPlayer : function() {
var self = this;
if ( self.customizerFeedData.settings.layout != 'gallery' ) {
return;
}
return true;
},
/**
* Switch to Videos sections
* From Feed Layout section bottom link
*
* @since 2.0
*/
switchToVideosSection: function() {
var self = this;
self.customizerScreens.parentActiveSection = null;
self.customizerScreens.parentActiveSectionData = null;
self.customizerScreens.activeSection = 'customize_videos';
self.customizerScreens.activeSectionData = self.customizerSidebarBuilder.customize.sections.customize_videos;
},
/**
* Shortcode Global Layout Settings
*
* @since 2.0
*/
setShortcodeGlobalSettings : function(flyPreview = false){
let self = this,
youtubeFeed = jQuery("html").find(".sb_youtube"),
feedSettings = self.jsonParse(youtubeFeed.attr('data-options')),
customizerSettings = self.customizerFeedData.settings;
if ( !youtubeFeed.length ) {
return;
}
if( customizerSettings.layout === 'carousel' ){
let arrows = self.valueIsEnabled( customizerSettings['carouselarrows'] ),
pag = self.valueIsEnabled( customizerSettings['carouselpag'] ),
autoplay = self.valueIsEnabled( customizerSettings['carouselautoplay'] ),
time = autoplay ? parseInt(customizerSettings['carouseltime']) : false,
loop = self.checkNotEmpty(customizerSettings['carouselloop']) && customizerSettings['carouselloop'] !== 'rewind' ? false : true,
rows = customizerSettings['carouselrows'] ? Math.min( parseInt(customizerSettings['carouselrows']), 2) : 1;
delete feedSettings['gallery'];
delete feedSettings['masonry'];
delete feedSettings['grid'];
feedSettings['carousel'] = [arrows, pag, autoplay, time, loop, rows];
}
else if(customizerSettings.layout == 'grid'){
delete feedSettings['gallery'];
delete feedSettings['masonry'];
}
else if(customizerSettings.layout == 'masonry'){
delete feedSettings['gallery'];
delete feedSettings['grid'];
}
else if(customizerSettings.layout == 'gallery'){
delete feedSettings['masonry'];
delete feedSettings['grid'];
}
if(customizerSettings.layout !== 'carousel'){
delete feedSettings['carousel'];
}
youtubeFeed.attr("data-options", JSON.stringify(feedSettings));
if ( typeof window.sby_init !== 'undefined' && flyPreview ) {
//setTimeout(function(){
window.sby_init();
//}, 2000)
}
},
/**
* Should Show Manual Connect
*
* @since 2.0
*/
showManualConnect : function() {
var self = this;
self.shouldShowManualConnect = true;
self.shouldShowFeedAPIBackBtn = true;
},
/**
* Should Show Manual Connect
*
* @since 2.0
*/
showFeedSourceManualConnect : function() {
var self = this;
self.viewsActive.accountAPIPopup = true;
self.shouldShowManualConnect = true;
},
/**
* Show API connect form in feed creation flow
*/
showAPIConnectForm : function() {
var self = this;
self.shouldShowFeedAPIForm = true;
self.shouldShowFeedAPIBackBtn = true;
},
/**
* Show the limitations of connecting with YouTube Account
* @since 2.3
*/
showYTAccountLimitations : function() {
var self = this;
self.showShowYTAccountWarning = true;
},
backToApiPopup : function() {
var self = this;
self.showShowYTAccountWarning = false;
self.shouldShowManualConnect = false;
self.shouldShowFeedAPIForm = false;
self.shouldShowFeedAPIBackBtn = false;
},
/**
* Show API connect form in feed creation flow
*/
hideAPIConnectForm : function() {
var self = this;
self.shouldShowManualConnect = false;
self.shouldShowFeedAPIForm = false;
self.shouldShowFeedAPIBackBtn = false;
},
/**
* Add API Key from the select feed flow
*
* @since 2.0
*/
addAPIKey : function() {
var self = this;
if ( !self.selectedFeedModel.apiKey ) {
self.apiKeyError = true;
return;
}
var self = this,
addAPIKeyData = {
action : 'sby_add_api_key',
api : self.selectedFeedModel.apiKey
};
self.apiKeyBtnLoader = true;
self.ajaxPost(addAPIKeyData, function(_ref){
var data = _ref.data;
self.apiKeyBtnLoader = false;
self.apiKeyError = false;
self.apiKeyStatus = true;
self.activateView('accountAPIPopup');
});
},
/**
* Add Access Tokoen from the select feed flow
*
* @since 2.0
*/
addAccessToken : function() {
var self = this;
if ( !self.selectedFeedModel.accessToken ) {
self.accessTokenError = true;
return;
}
var self = this,
addAPIKeyData = {
action : 'sby_manual_access_token',
sby_access_token : self.selectedFeedModel.accessToken
};
self.apiKeyBtnLoader = true;
self.ajaxPost(addAPIKeyData, function(_ref){
var data = _ref.data;
self.apiKeyBtnLoader = false;
self.accessTokenError = false;
self.apiKeyStatus = true;
self.activateView('accountAPIPopup');
});
},
/**
* Create & Submit New Feed
*
* @since 2.0
*/
submitNewFeed : function(){
var self = this,
newFeedData = {
action : 'sby_feed_saver_manager_builder_update',
feedtype : self.selectedFeed,
feedtemplate : self.selectedFeedTemplate,
selectedFeedModel : self.selectedFeedModel,
new_insert : 'true',
};
self.fullScreenLoader = true;
self.ajaxPost(newFeedData, function(_ref){
var data = _ref.data;
if(data.feed_id && data.success){
window.location = self.builderUrl + '&feed_id=' + data.feed_id + self.sw_feed_params();
}
});
},
/**
* Custom field click action
* Action
* @since 2.3.3
*/
fieldCustomClickAction : function( clickAction ){
var self = this;
switch (clickAction) {
case 'clearCommentCache':
self.clearCommentCache();
break;
}
},
/**
* Clear comment cache action
*
* @since 2.3.3
*/
clearCommentCache : function(){
var self = this;
self.loadingBar = true;
var clearCommentCacheData = {
action : 'sby_feed_saver_clear_comments_cache',
};
self.ajaxPost(clearCommentCacheData, function(_ref){
var data = _ref.data;
if( data === 'success' ){
self.processNotification("commentCacheCleared");
}else{
self.processNotification("unkownError");
}
});
},
}
resolve(SB_Customizer);
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,218 @@
!(function (e) {
var t = {};
function n(r) {
if (t[r]) return t[r].exports;
var o = (t[r] = { i: r, l: !1, exports: {} });
return e[r].call(o.exports, o, o.exports, n), (o.l = !0), o.exports;
}
(n.m = e),
(n.c = t),
(n.d = function (e, t, r) {
n.o(e, t) || Object.defineProperty(e, t, { configurable: !1, enumerable: !0, get: r });
}),
(n.n = function (e) {
var t =
e && e.__esModule
? function () {
return e.default;
}
: function () {
return e;
};
return n.d(t, "a", t), t;
}),
(n.o = function (e, t) {
return Object.prototype.hasOwnProperty.call(e, t);
}),
(n.p = "/"),
n((n.s = 0));
})([
function (e, t, n) {
n(1), (e.exports = n(2));
},
function (e, t, n) {
"use strict";
},
function (e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
var r = n(3),
o = n.n(r),
i = n(4);
o()(window).on("et_builder_api_ready", function (e, t) {
t.registerModules(i.a);
});
},
function (e, t) {
e.exports = jQuery;
},
function (e, t, n) {
"use strict";
var r = n(5);
t.a = [r.a];
},
function (e, t, n) {
"use strict";
var r = n(6),
o = n.n(r),
i = n(7),
a = n.n(i);
function c(e) {
return (c =
"function" === typeof Symbol && "symbol" === typeof Symbol.iterator
? function (e) {
return typeof e;
}
: function (e) {
return e && "function" === typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
})(e);
}
function u(e, t) {
for (var n = 0; n < t.length; n++) {
var r = t[n];
(r.enumerable = r.enumerable || !1), (r.configurable = !0), "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
}
}
function s(e, t) {
return !t || ("object" !== c(t) && "function" !== typeof t)
? (function (e) {
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e;
})(e)
: t;
}
var f = (function (e) {
function t(e) {
var n;
return (
(function (e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
})(this, t),
((n = s(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e))).state = { feed: null }),
n
);
}
var n, i, c;
return (
(function (e, t) {
if ("function" !== typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
(e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } })), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : (e.__proto__ = t));
})(t, r["Component"]),
(n = t),
(c = [
{
key: "propTypes",
get: function () {
return { feed_id: a.a.number };
},
},
]),
(i = [
{
key: "componentDidUpdate",
value: function (e) {
'sby-0' !== this.props.feed_id && e.feed_id !== this.props.feed_id && this.componentDidMount();
},
},
{
key: "componentDidMount",
value: function () {
window.sby_init;
var e = this,
t = new FormData();
t.append("nonce", sb_divi_builder.nonce),
t.append("action", "sb_youtubefeed_divi_preview"),
t.append("feed_id", this.props && this.props.feed_id ? this.props.feed_id.replace("sby-", "") : ''),
fetch(sb_divi_builder.ajax_handler, {
method: "POST",
cache: "no-cache",
credentials: "same-origin",
headers: { "Content-Type": "application/x-www-form-urlencoded", "Cache-Control": "no-cache" },
body: new URLSearchParams(t),
})
.then(function (e) {
return e.json();
})
.then(
function (t) {
e.setState({ feed: t.data });
window.sby_init();
},
function (t) {
e.setState({});
}
);
},
},
{
key: "render",
value: function () {
var e = this.state.feed;
return void 0 === this.props.feed_id || null === this.props.feed_id || 'sby-0' === this.props.feed_id
? o.a.createElement("div", null, o.a.createElement("div", { dangerouslySetInnerHTML: { __html: sb_divi_builder.feed_splash } }))
: o.a.createElement("div", null, o.a.createElement("div", { dangerouslySetInnerHTML: { __html: e } }));
},
},
]) && u(n.prototype, i),
c && u(n, c),
t
);
})();
Object.defineProperty(f, "slug", { configurable: !0, enumerable: !0, writable: !0, value: "sb_youtube_feed" }), (t.a = f);
},
function (e, t) {
e.exports = React;
},
function (e, t, n) {
e.exports = n(8)();
},
function (e, t, n) {
"use strict";
var r = n(9);
function o() {}
function i() {}
(i.resetWarningCache = o),
(e.exports = function () {
function e(e, t, n, o, i, a) {
if (a !== r) {
var c = new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");
throw ((c.name = "Invariant Violation"), c);
}
}
function t() {
return e;
}
e.isRequired = e;
var n = {
array: e,
bigint: e,
bool: e,
func: e,
number: e,
object: e,
string: e,
symbol: e,
any: e,
arrayOf: t,
element: e,
elementType: e,
instanceOf: t,
node: e,
objectOf: t,
oneOf: t,
oneOfType: t,
shape: t,
exact: t,
checkPropTypes: i,
resetWarningCache: o,
};
return (n.PropTypes = n), n;
});
},
function (e, t, n) {
"use strict";
e.exports = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
},
]);

View File

@@ -0,0 +1,25 @@
function docReady(fn) {
// see if DOM is already available
if (
document.readyState === "complete" ||
document.readyState === "interactive"
) {
// call on next available tick
setTimeout(fn, 1);
} else {
document.addEventListener("DOMContentLoaded", fn);
}
}
docReady(function () {
document.body.addEventListener("click", function (event) {
// Check if the clicked element has the specific class
if (
event.target &&
( event.target.classList.contains("sby-feed-block-link") || event.target.classList.contains("sby-feed-block-cta-btn") )
) {
const href = event.target.getAttribute("href");
window.open(href, "_blank");
}
});
});

View File

@@ -0,0 +1,134 @@
'use strict';
/**
* Used to handle :
* Click of Non-Installed Plugins
* Show Upsell Popup
* Unbind Drag & Drop
*/
let SbElementorHandler = window.SbElementorHandler || ( function( _document, window, $ ) {
const smashBalloonPlugins = sbHandler.smashPlugins;
let app = {
init: function() {
app.events();
},
events: function() {
$( window ).on('elementor/frontend/init', function () {
app.disableInactiveSmashWidgets();
setTimeout(function(){
elementor.panel.$el.on('click', function () {
app.disableInactiveSmashWidgets();
});
}, 300)
});
},
disableInactiveSmashWidgets : function(){
setTimeout(function(){
for (const pluginName in smashBalloonPlugins) {
let plugin = smashBalloonPlugins[pluginName],
pluginWidget = elementor.panel.$el.find("#elementor-panel-category-smash-balloon").find('.sb-elem-inactive.sb-elem-'+pluginName).parents('.elementor-element-wrapper').find('.elementor-element');
pluginWidget.attr('draggable', false);
pluginWidget.on('click', function(){
app.createUpsellPopup( pluginName );
});
}
}, 500)
},
createUpsellPopup : function( pluginName ){
let plugin = smashBalloonPlugins[pluginName],
spinnerIcon = '<svg x="0px" y="0px" width="20px" height="20px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve"><path fill="#fff" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"/></path></svg>',
upsellPopupOutput =
'<div class="sb-source-ctn sb-fs-boss sb-center-boss">\
<div class="sb-source-popup sb-popup-inside sb-install-plugin-modal">\
<div class="sb-popup-cls">\
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\
<path d="M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z" fill="#141B38"/>\
</svg>\
</div>\
<div class="sb-install-plugin-body sb-fs">\
<div class="sb-install-plugin-header">\
<div class="sb-plugin-image">' + plugin["svgIcon"] + '\
<svg class="sb-plugin-cta-logo" width="26" height="33" viewBox="0 0 26 33" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M25.5608 15.2708C25.5608 6.86286 20.0495 0.046814 13.2486 0.046814C6.44763 0.046814 0.933838 6.86286 0.933838 15.2708C0.933838 23.3312 5.98416 29.9079 12.3795 30.4596L11.6995 32.6132L15.9639 32.2505L14.4677 30.4218C20.6943 29.6661 25.5608 23.1725 25.5608 15.2708Z" fill="#FE544F"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16.1843 5.39911L16.7768 11.5131L22.9165 11.6894L18.4752 15.8189L21.983 20.8926L16.0735 19.7817L14.282 25.6913L11.5618 20.3993L6.0693 22.916L8.18218 17.2428L2.82544 14.5409L8.55968 12.6968L6.97737 7.04787L12.4024 10.1407L16.1843 5.39911Z" fill="white"/></svg>\
</div>\
<div class="sb-plugin-name">\
<strong>Requires</strong>\
<h3>\
' + pluginName + '\
<span>Free</span>\
</h3>\
</div>\
</div>\
<div class="sb-install-plugin-content">\
<p>' + plugin["description"] + '</p>\
<button class="sb-install-plugin-btn sb-btn-orange sb-plugin-btn" data-plugin="'+plugin['download_plugin']+'">\
<span class="sb-install-plugin-spinner" style="display:none">'+spinnerIcon+'</span>\
Install\
</button>\
<button class="sb-install-refresh-btn sb-btn-blue sb-plugin-btn" style="display:none">\
Refresh The Page\
</button>\
</div>\
</div>\
</div>\
</div>';
if($(window.parent.document.body).find('.sb-center-boss').length === 0){
$(window.parent.document.body).append(upsellPopupOutput);
}
$(window.parent.document.body).find('.sb-install-plugin-btn').on('click', function(){
let downloadPlugin = $(this).attr('data-plugin');
$(this).find('.sb-install-plugin-spinner').show();
app.installPlugin(downloadPlugin);
});
$(window.parent.document.body).find('.sb-install-refresh-btn').on('click', function(){
window.parent.location.reload();
});
$(window.parent.document.body).find('.sb-popup-cls').on('click', function(){
app.closeUpsellPopup();
});
},
closeUpsellPopup : function(){
$(window.parent.document.body).find('.sb-center-boss').remove();
},
installPlugin : function(downloadPlugin){
let data = new FormData();
data.append( 'action', 'sby_install_other_plugins' );
data.append( 'nonce', sbHandler.nonce );
data.append( 'plugin', downloadPlugin );
data.append( 'type', 'plugin' );
fetch(sbHandler.ajax_handler, {
method: "POST",
credentials: 'same-origin',
body: data
})
.then(response => response.json())
.then(data => {
$(window.parent.document.body).find('.sb-install-plugin-btn').hide();
if( data.success == true ) {
$(window.parent.document.body).find('.sb-install-refresh-btn').show();
}
});
}
};
return app;
}( document, window, jQuery ) );
SbElementorHandler.init();

View File

@@ -0,0 +1,66 @@
'use strict';
var CustomYouTubeFeedElementor = window.CustomYouTubeFeedElementor || ( function( document, window, $ ) {
var vars = {};
var app = {
init: function() {
app.events();
},
events: function() {
$( window ).on('elementor/frontend/init', function ( $scope ) {
elementorFrontend.hooks.addAction('frontend/element_ready/sby-widget.default', app.frontendWidgetInit);
if( 'undefined' !== typeof elementor ){
elementor.hooks.addAction( 'panel/open_editor/widget/sby-widget', app.widgetPanelOpen );
}
});
},
SbyInitWidget: function() {
window.sby_init();
},
registerWidgetEvents: function( $scope ) {
$scope
.on( 'change', '.sby-feed-block-cta-feedselector', app.selectFeedInPreview );
$scope
.on( 'click', '.sby-feed-block-cta-btn,.sby-feed-block-link', app.anchorTrigger );
},
frontendWidgetInit : function( $scope ){
app.SbyInitWidget();
app.registerWidgetEvents( $scope );
},
findFeedSelector: function( event ) {
vars.$select = event && event.$el ?
event.$el.closest( '#elementor-controls' ).find( 'select[data-setting="feed_id"]' ) :
window.parent.jQuery( '#elementor-controls select[data-setting="feed_id"]' );
},
selectFeedInPreview : function( event ){
vars.feedId = $( this ).val();
app.findFeedSelector();
vars.$select.val( vars.feedId ).trigger( 'change' );
},
anchorTrigger : function( event ){
vars.href = $( this ).attr('href');
window.open(vars.href ,'_blank');
},
widgetPanelOpen: function( panel, model ) {
panel.$el.find( '.elementor-control.elementor-control-feed_id' ).find( 'select' ).on( 'change', function(){
setTimeout(function(){
app.SbyInitWidget();
}, 4000)
});
},
};
return app;
}( document, window, jQuery ) );
CustomYouTubeFeedElementor.init();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
/*! imgLiquid v0.9.944 / 03-05-2013 https://github.com/karacas/imgLiquid */

View File

@@ -0,0 +1,186 @@
(function($) {
jQuery(document).ready(function($){
// Add class and open link in new tab for the try upgrade from Free menu
$('.sby_get_pro').parent().attr({'class':'sby_get_pro_highlight', 'target':'_blank'});
/**
* Dismiss header notice for YouTube Feed Lite
*
* @since 2.0
*/
$(document).on('click', '#sbc-dismiss-header-notice', function() {
$.ajax({
url : sby_admin.ajaxUrl,
type : 'post',
data : {
action : 'sby_dismiss_upgrade_notice',
nonce: sby_admin.nonce
},
success : function(data) {
if ( data.success ) {
$('#sbc-notice-bar').slideUp();
}
},
error : function(e) {
console.log(e);
}
});
});
/**
* Remove the other plugin installer modal
*
* @since 2.0
*/
$('body').on('click', '.sby-ip-popup-cls', function(e){
$('#sby-op-modals').remove();
});
/**
* Single Video Upsell Modal
*
* @since 2.3
*/
$('.sby-single-videos-upsell').parent('a').on('click', function(e) {
e.preventDefault();
// remove the already opened modal
$('#sby-single-videos-upsell-modal').remove();
$('#wpbody-content').prepend('<div class="sbc-extensions-pp-ctn sb-fs-boss sbc-center-boss" id="sby-single-videos-upsell-modal"><i class="fa fa-spinner fa-spin sby-loader" aria-hidden="true"></i></div>');
// send the ajax request to load plugin name and others data
$.ajax({
url: ajaxurl,
type: 'post',
data: {
action: 'sby_single_videos_upsell_modal',
nonce : sby_admin.nonce,
},
success: function (data) {
if (data.success == true) {
$('#sby-single-videos-upsell-modal').html(data.data);
$('body').on('click', '#sby-single-videos-upsell-modal', function(e){
if (e.target !== this) return;
$('#sby-single-videos-upsell-modal').remove();
});
$('body').on('click', '.sbc-popup-cls', function(e){
$('#sby-single-videos-upsell-modal').remove();
});
}
},
error: function (e) {
console.log(e);
}
});
});
/**
* Open other plugin installer modal from admin sidebar menu
*
* @since 2.0
*/
$('.sby_get_cff, .sby_get_sbi, .sby_get_ctf, .sby_get_sbtt, .sby_get_sbr').parent('a').on('click', function(e) {
e.preventDefault();
// remove the already opened modal
$('#sby-op-modals').remove();
// prepend the modal wrapper
$('#wpbody-content').prepend('<div class="sby-install-plugin-popup-outer sb-fs-boss" id="sby-op-modals"><i class="fa fa-spinner fa-spin sby-loader" aria-hidden="true"></i></div>');
// determine the plugin name
var $self = $(this).find('span'),
sb_get_plugin = 'twitter';
if ($self.hasClass('sby_get_cff')) {
sb_get_plugin = 'facebook';
}
if ($self.hasClass('sby_get_sbi')) {
sb_get_plugin = 'instagram';
}
if ($self.hasClass('sby_get_sby')) {
sb_get_plugin = 'twitter';
}
if ($self.hasClass('sby_get_sbtt')) {
sb_get_plugin = 'tiktok';
}
if ($self.hasClass('sby_get_sbr')) {
sb_get_plugin = 'reviews';
}
// send the ajax request to load plugin name and others data
$.ajax({
url: ajaxurl,
type: 'post',
data: {
action: 'sby_other_plugins_modal',
plugin: sb_get_plugin,
nonce : sby_admin.nonce,
},
success: function (data) {
if (data.success == true) {
$('#sby-op-modals').html(data.data);
$('body').on('click', '#sby-op-modals', function(e){
if (e.target !== this) return;
$('#sby-op-modals').remove();
});
$('body').on('click', '.sby-fb-popup-cls', function(e){
$('#sby-op-modals').remove();
});
}
},
error: function (e) {
console.log(e);
}
});
});
/**
* Install other plugins from the modal
*
* @since 2.0
*/
$(document).on('click', '#sby_install_op_plugin', function() {
let self = $(this);
let pluginAtts = self.data('plugin-atts');
if ( pluginAtts.step == 'install' ) {
pluginAtts.plugin = pluginAtts.download_plugin
}
let loader = '<span class="ctf-btn-spinner"><svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" height="20px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve"><path fill="#fff" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform></path></svg></span>';
self.prepend(loader);
// send the ajax request to install or activate the plugin
$.ajax({
url : ajaxurl,
type : 'post',
data : {
action : pluginAtts.action,
nonce : sby_admin.nonce,
plugin : pluginAtts.plugin,
download_plugin : pluginAtts.download_plugin,
type : 'plugin',
},
success : function(data) {
if ( data.success == true ) {
self.find('.ctf-btn-spinner').remove();
self.attr('disabled', 'disabled');
if ( pluginAtts.step == 'install' ) {
self.html( data.data.msg );
} else {
self.html( data.data );
}
}
},
error : function(e) {
console.log(e);
}
});
});
});
})(jQuery)

View File

@@ -0,0 +1,128 @@
"use strict";
(function () {
var _wp = wp,
_wp$serverSideRender = _wp.serverSideRender,
createElement = wp.element.createElement,
ServerSideRender = _wp$serverSideRender === void 0 ? wp.components.ServerSideRender : _wp$serverSideRender,
_ref = wp.blockEditor || wp.editor,
InspectorControls = _ref.InspectorControls,
_wp$components = wp.components,
TextareaControl = _wp$components.TextareaControl,
Button = _wp$components.Button,
PanelBody = _wp$components.PanelBody,
Placeholder = _wp$components.Placeholder,
registerBlockType = wp.blocks.registerBlockType;
var sbyIcon = createElement('svg', {
width: 20,
height: 20,
viewBox: '0 0 576 512',
className: 'dashicon'
}, createElement('path', {
fill: 'currentColor',
d: 'M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z'
}));
registerBlockType('sby/sby-feed-block', {
title: 'Feeds for YouTube',
icon: sbyIcon,
category: 'widgets',
attributes: {
noNewChanges: {
type: 'boolean',
},
shortcodeSettings: {
type: 'string',
},
executed: {
type: 'boolean'
}
},
edit: function edit(props) {
var _props = props,
setAttributes = _props.setAttributes,
_props$attributes = _props.attributes,
_props$attributes$sho = _props$attributes.shortcodeSettings,
shortcodeSettings = _props$attributes$sho === void 0 ? sby_block_editor.shortcodeSettings : _props$attributes$sho,
_props$attributes$cli = _props$attributes.noNewChanges,
noNewChanges = _props$attributes$cli === void 0 ? true : _props$attributes$cli,
_props$attributes$exe = _props$attributes.executed,
executed = _props$attributes$exe === void 0 ? false : _props$attributes$exe;
props.attributes.shortcodeSettings = shortcodeSettings;
function setState(shortcodeSettingsContent) {
setAttributes({
noNewChanges: false,
shortcodeSettings: shortcodeSettingsContent
});
}
function previewClick(content) {
setAttributes({
noNewChanges: true,
executed: false,
});
}
function afterRender() {
// no way to run a script after AJAX call to get feed so we just try to execute it on a few intervals
if (! executed
|| typeof window.sbyGB === 'undefined') {
window.sbyGB = true;
setTimeout(function() { if (typeof sby_init !== 'undefined') {sby_init();}},1000);
setTimeout(function() { if (typeof sby_init !== 'undefined') {sby_init();}},2000);
setTimeout(function() { if (typeof sby_init !== 'undefined') {sby_init();}},3000);
setTimeout(function() { if (typeof sby_init !== 'undefined') {sby_init();}},5000);
setTimeout(function() { if (typeof sby_init !== 'undefined') {sby_init();}},10000);
}
setAttributes({
executed: true,
});
}
var jsx = [React.createElement(InspectorControls, {
key: "sby-gutenberg-setting-selector-inspector-controls"
}, React.createElement(PanelBody, {
title: sby_block_editor.i18n.addSettings
}, React.createElement(TextareaControl, {
key: "sby-gutenberg-settings",
className: "sby-gutenberg-settings",
label: sby_block_editor.i18n.shortcodeSettings,
help: sby_block_editor.i18n.example + ": feed=\"1\"",
value: shortcodeSettings,
onChange: setState
}), React.createElement(Button, {
key: "sby-gutenberg-preview",
className: "sby-gutenberg-preview",
onClick: previewClick,
isDefault: true
}, sby_block_editor.i18n.preview)))];
if (noNewChanges) {
afterRender();
jsx.push(React.createElement(ServerSideRender, {
key: "feeds-for-youtube/feeds-for-youtube",
block: "sby/sby-feed-block",
attributes: props.attributes,
}));
} else {
props.attributes.noNewChanges = false;
jsx.push(React.createElement(Placeholder, {
key: "sby-gutenberg-setting-selector-select-wrap",
className: "sby-gutenberg-setting-selector-select-wrap"
}, React.createElement(Button, {
key: "sby-gutenberg-preview",
className: "sby-gutenberg-preview",
onClick: previewClick,
isDefault: true
}, sby_block_editor.i18n.preview)));
}
return jsx;
},
save: function save() {
return null;
}
});
})();

View File

@@ -0,0 +1,98 @@
/**
* Custom YouTube Tooltip Manager
*
* @since 2.0
*/
'use strict';
var SBYTooltipWizard = window.SBYTooltipWizard || ( function( document, window, $ ) {
/**
* Public functions and properties.
*
* @since 2.0
*
* @type {object}
*/
var app = {
/**
* Start the engine.
*
* @since 2.0
*/
init: function() {
//$( app.ready );
$( window ).on( 'load', function() {
if ( $.isFunction( $.ready.then ) ) {
$.ready.then( app.load );
} else {
app.load();
}
} );
},
/**
* Window load.
*
* @since 2.0
*/
load: function() {
if(sby_admin_tooltip_wizard.sby_wizard_gutenberg){
app.initGutenbergTooltip();
}
},
initGutenbergTooltip : function(){
if ( typeof $.fn.tooltipster === 'undefined' ) {
return;
}
var $dot = $( '<span class="wpforms-admin-form-embed-wizard-dot">&nbsp;</span>' );
var anchor = '.block-editor .edit-post-header-toolbar__inserter-toggle';
var tooltipsterArgs = {
content : $( '#sby-gutenberg-tooltip-content' ),
trigger : 'custom',
interactive : true,
animationDuration: 0,
delay : 0,
theme : [ 'tooltipster-default', 'sby-tooltip-wizard' ],
side : 'bottom',
distance : 3,
functionReady : function( instance, helper ) {
instance._$tooltip.on( 'click', '.sby-tlp-wizard-close', function() {
instance.close();
$('.sby-tooltip-wizard').hide();
} );
instance.reposition();
},
};
$('.components-button.edit-post-header-toolbar__inserter-toggle').on('click',function() {
$('.sby-tooltip-wizard.tooltipster-sidetip').hide();
});
$dot.insertAfter( anchor ).tooltipster( tooltipsterArgs ).tooltipster( 'open' );
},
/**
* Check if we're in Gutenberg editor.
*
* @since 2.0
*
* @returns {boolean} Is Gutenberg or not.
*/
isGutenberg: function() {
return typeof wp !== 'undefined' && Object.prototype.hasOwnProperty.call( wp, 'blocks' );
},
}
return app;
}( document, window, jQuery ) );
SBYTooltipWizard.init();