Popup Builder – Responsive WordPress Pop up - Version 3.68.5.2

Version Description

Current Version of Popup Builder is 3.68.5

Download this release

Release Info

Developer Sygnoos
Plugin Icon 128x128 Popup Builder – Responsive WordPress Pop up
Version 3.68.5.2
Comparing to
See all releases

Code changes from version 3.68.5.1 to 3.68.5.2

com/config/configPackage.php CHANGED
@@ -3,6 +3,6 @@ if (!defined('ABSPATH')) {
3
  exit();
4
  }
5
 
6
- define('SG_POPUP_VERSION', '3.68.5.1');
7
  define('SGPB_POPUP_PKG', SGPB_POPUP_PKG_FREE);
8
  define('POPUP_BUILDER_BASENAME', 'popupbuilder-platinum/popup-builder.php');
3
  exit();
4
  }
5
 
6
+ define('SG_POPUP_VERSION', '3.68.5.2');
7
  define('SGPB_POPUP_PKG', SGPB_POPUP_PKG_FREE);
8
  define('POPUP_BUILDER_BASENAME', 'popupbuilder-platinum/popup-builder.php');
popup-builder.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Popup Builder
4
  * Plugin URI: https://popup-builder.com
5
  * Description: The most complete popup plugin. Html, image, iframe, shortcode, video and many other popup types. Manage popup dimensions, effects, themes and more.
6
- * Version: 3.68.5.1
7
  * Author: Sygnoos
8
  * Author URI: https://sygnoos.com
9
  * License: GPLv2
3
  * Plugin Name: Popup Builder
4
  * Plugin URI: https://popup-builder.com
5
  * Description: The most complete popup plugin. Html, image, iframe, shortcode, video and many other popup types. Manage popup dimensions, effects, themes and more.
6
+ * Version: 3.68.5.2
7
  * Author: Sygnoos
8
  * Author URI: https://sygnoos.com
9
  * License: GPLv2
public/js/Popup.js CHANGED
@@ -7,14 +7,14 @@ else{SGPopup.inlinePrevTarget.node.appendChild(htmlElement);}}}
7
  var OPEN_ANIMATION_POP="@-webkit-keyframes popin{from{-webkit-transform:scale(.8);opacity:0}to{-webkit-transform:scale(1);opacity:1}}@-moz-keyframes popin{from{-moz-transform:scale(.8);opacity:0}to{-moz-transform:scale(1);opacity:1}}@keyframes popin{from{transform:scale(.8);opacity:0}to{transform:scale(1);opacity:1}}";var OPEN_ANIMATION_FADE="@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@-moz-keyframes fadein{from{opacity:0}to{opacity:1}}@keyframes fadein{from{opacity:0}to{opacity:1}}";var OPEN_ANIMATION_FLIP="@-webkit-keyframes flipintoright{from{-webkit-transform:rotateY(90deg) scale(.9)}to{-webkit-transform:rotateY(0)}}@-moz-keyframes flipintoright{from{-moz-transform:rotateY(90deg) scale(.9)}to{-moz-transform:rotateY(0)}}@keyframes flipintoright{from{transform:rotateY(90deg) scale(.9)}to{transform:rotateY(0)}}";var OPEN_ANIMATION_SLIDELEFT="@-webkit-keyframes slideinfromright{from{-webkit-transform:translate3d({start},0,0)}to{-webkit-transform:translate3d(0,0,0)}}@-moz-keyframes slideinfromright{from{-moz-transform:translateX({start})}to{-moz-transform:translateX(0)}}@keyframes slideinfromright{from{transform:translateX({start})}to{transform:translateX(0)}}";var OPEN_ANIMATION_SLIDERIGHT="@-webkit-keyframes slideinfromleft{from{-webkit-transform:translate3d({start},0,0)}to{-webkit-transform:translate3d(0,0,0)}}@-moz-keyframes slideinfromleft{from{-moz-transform:translateX({start})}to{-moz-transform:translateX(0)}}@keyframes slideinfromleft{from{transform:translateX({start})}to{transform:translateX(0)}}";var OPEN_ANIMATION_FLOW="@-webkit-keyframes flowinfromright{0%{-webkit-transform:translateX(100%) scale(.7)}30%,40%{-webkit-transform:translateX(0) scale(.7)}100%{-webkit-transform:translateX(0) scale(1)}}@-moz-keyframes flowinfromright{0%{-moz-transform:translateX(100%) scale(.7)}30%,40%{-moz-transform:translateX(0) scale(.7)}100%{-moz-transform:translateX(0) scale(1)}}@keyframes flowinfromright{0%{transform:translateX(100%) scale(.7)}30%,40%{transform:translateX(0) scale(.7)}100%{transform:translateX(0) scale(1)}}";var OPEN_ANIMATION_SLIDEUP="@-webkit-keyframes slideinfrombottom{from{-webkit-transform:translateY({start})}to{-webkit-transform:translateY(0)}}@-moz-keyframes slideinfrombottom{from{-moz-transform:translateY({start})}to{-moz-transform:translateY(0)}}@keyframes slideinfrombottom{from{transform:translateY({start})}to{transform:translateY(0)}}";var OPEN_ANIMATION_SLIDEDOWN="@-webkit-keyframes slideinfromtop{from{-webkit-transform:translateY({start})}to{-webkit-transform:translateY(0)}}@-moz-keyframes slideinfromtop{from{-moz-transform:translateY({start})}to{-moz-transform:translateY(0)}}@keyframes slideinfromtop{from{transform:translateY({start})}to{transform:translateY(0)}}";var CLOSE_ANIMATION_SLIDELEFT="@-webkit-keyframes slideouttoleft{from{-webkit-transform:translate3d(0,0,0)}to{-webkit-transform:translate3d({end},0,0)}}@-moz-keyframes slideouttoleft{from{-moz-transform:translateX(0)}to{-moz-transform:translateX({end})}}@keyframes slideouttoleft{from{transform:translateX(0)}to{transform:translateX({end})}}";var CLOSE_ANIMATION_SLIDERIGHT="@-webkit-keyframes slideouttoright{from{-webkit-transform:translate3d(0,0,0)}to{-webkit-transform:translate3d({end},0,0)}}@-moz-keyframes slideouttoright{from{-moz-transform:translateX(0)}to{-moz-transform:translateX({end})}}@keyframes slideouttoright{from{transform:translateX(0)}to{transform:translateX({end})}}";var CLOSE_ANIMATION_POP="@-webkit-keyframes popout{from{-webkit-transform:scale(1);opacity:1}to{-webkit-transform:scale(.8);opacity:0}}@-moz-keyframes popout{from{-moz-transform:scale(1);opacity:1}to{-moz-transform:scale(.8);opacity:0}}@keyframes popout{from{transform:scale(1);opacity:1}to{transform:scale(.8);opacity:0}}";var CLOSE_ANIMATION_FADE="@-webkit-keyframes fadeout{from{opacity:1}to{opacity:0}}@-moz-keyframes fadeout{from{opacity:1}to{opacity:0}}@keyframes fadeout{from{opacity:1}to{opacity:0}}";var CLOSE_ANIMATION_FLIP="@-webkit-keyframes flipouttoright{from{-webkit-transform:rotateY(0)}to{-webkit-transform:rotateY(90deg) scale(.9)}}@-moz-keyframes flipouttoright{from{-moz-transform:rotateY(0)}to{-moz-transform:rotateY(90deg) scale(.9)}}@keyframes flipouttoright{from{transform:rotateY(0)}to{transform:rotateY(90deg) scale(.9)}}";var CLOSE_ANIMATION_FLOW="@-webkit-keyframes flowouttoright{0%{-webkit-transform:translateX(0) scale(1)}60%,70%{-webkit-transform:translateX(0) scale(.7)}100%{-webkit-transform:translateX(100%) scale(.7)}}@-moz-keyframes flowouttoright{0%{-moz-transform:translateX(0) scale(1)}60%,70%{-moz-transform:translateX(0) scale(.7)}100%{-moz-transform:translateX(100%) scale(.7)}}@keyframes flowouttoright{0%{transform:translateX(0) scale(1)}60%,70%{transform:translateX(0) scale(.7)}100%{transform:translateX(100%) scale(.7)}}";var CLOSE_ANIMATION_SLIDEUP="@-webkit-keyframes slideouttotop{from{-webkit-transform:translateY(0)}to{-webkit-transform:translateY({end})}}@-moz-keyframes slideouttotop{from{-moz-transform:translateY(0)}to{-moz-transform:translateY({end})}}@keyframes slideouttotop{from{transform:translateY(0)}to{transform:translateY({end})}}";var CLOSE_ANIMATION_SLIDEDOWN="@-webkit-keyframes slideouttobottom{from{-webkit-transform:translateY(0)}to{-webkit-transform:translateY({end})}}@-moz-keyframes slideouttobottom{from{-moz-transform:translateY(0)}to{-moz-transform:translateY({end})}}@keyframes slideouttobottom{from{transform:translateY(0)}to{transform:translateY({end})}}";function addAnimationClass(classString)
8
  {var style=document.createElement('style');style.type='text/css';style.innerHTML=classString;style.id=prefix+"-effect-custom-style";document.getElementsByTagName('head')[0].appendChild(style);}
9
  function setMainDivStyles(sizeConfig)
10
- {jQuery(window).trigger('sgpbPopupBuilderAdditionalDimensionSettings');contentDiv.style.zIndex=defaultZIndex+10;mainDiv.style.boxSizing='content-box';if(sizeConfig.minHeight!==-1){var minHeight=sizeConfig.minHeight;var popupMinHeight=window.innerHeight;if(typeof minHeight==='string'&&minHeight.indexOf('%')!==-1){var popupMinhHeight=(popupMinhHeight/100)*parseInt(minHeight);mainDiv.style.minHeight=popupMinhHeight+'px';}
11
  else{mainDiv.style.minHeight=parseInt(minHeight)+'px';}}
12
- if(sizeConfig.minWidth!==-1){var popupMinhWidth=window.innerWidth;var minWidth=sizeConfig.minWidth;if(typeof minWidth==='string'&&minWidth.indexOf('%')!==-1){popupMinhWidth=(popupMinhWidth/100)*parseInt(minWidth);mainDiv.style.minWidth=popupMinhWidth+'px';}
13
  else{mainDiv.style.minWidth=parseInt(minWidth)+'px';}}
14
- if(sizeConfig.maxHeight!==-1&&sizeConfig.maxHeight){var maxHeight=sizeConfig.maxHeight;var popupMaxHeight=window.innerHeight;if(maxHeight.indexOf('%')!==-1){popupMaxHeight=(popupMaxHeight/100)*parseInt(maxHeight);this.calculatedMaxHeight=calculateMaxHeight(popupMaxHeight);mainDiv.style.maxHeight=this.calculatedMaxHeight;}
15
  else{this.calculatedMaxHeight=calculateMaxHeight(parseInt(maxHeight));mainDiv.style.maxHeight=this.calculatedMaxHeight;}}
16
  else{var popupMaxHeight=window.innerHeight;mainDiv.style.maxHeight=calculateMaxHeight(popupMaxHeight);}
17
- if(sizeConfig.maxWidth!==-1&&sizeConfig.maxWidth){var maxWidth=sizeConfig.maxWidth;var popupMaxWidth=window.innerWidth;if(maxWidth.indexOf('%')!==-1){popupMaxWidth=(popupMaxWidth/100)*parseInt(maxWidth);this.calculatedMaxWidth=calculateMaxWidth(popupMaxWidth);mainDiv.style.maxWidth=this.calculatedMaxWidth;}
18
  else{this.calculatedMaxWidth=calculateMaxWidth(parseInt(maxWidth));mainDiv.style.maxWidth=this.calculatedMaxWidth;}}
19
  else{var popupMaxWidth=window.innerWidth;mainDiv.style.maxWidth=calculateMaxWidth(popupMaxWidth);}
20
  if(contentBox.borderStyle){mainDiv.style.borderStyle=contentBox.borderStyle;}
@@ -49,7 +49,7 @@ var widthDifference=imageWidth-maxWidth;var heightDifference=imageHeight-maxHeig
49
  else if(imageWidth>maxWidth){var modifiedWidthPercent=Math.floor((widthDifference/imageWidth)*100);var heightMustDecrease=Math.floor((imageHeight*modifiedWidthPercent)/100);var modifiedHeight=imageHeight-heightMustDecrease;imageWidth-=widthDifference;imageHeight-=heightMustDecrease;}
50
  var result={width:imageWidth,height:imageHeight};return result;}
51
  function calculateMaxWidth(maxWidth)
52
- {var sizeConfig=getSizeConfig();var dimension=sizeConfig.width;var contentPadding=(contentBox.padding||0)*2;var shadowSpread=(contentBox.shadowSpread||0)*2;var borderWidth=(contentBox.borderWidth||0)*2;var boxBorderWidth=(contentBox.boxBorderWidth||0)*4;var closeButtonRight=(parseInt(closeBehavior.right)||0)*2;var closeButtonLeft=(parseInt(closeBehavior.left)||0)*2;if(dimension.indexOf('fullScreen')==='-1'){maxWidth-=contentPadding;maxWidth-=34;maxWidth-=shadowSpread;maxWidth-=borderWidth;maxWidth-=boxBorderWidth;}
53
  if(!closeBehavior.buttonInside){if(closeButtonRight){maxWidth-=Math.abs(closeButtonRight);}
54
  if(closeButtonLeft){maxWidth-=Math.abs(closeButtonLeft);}}
55
  if(maxWidth<0){return'30px';}
7
  var OPEN_ANIMATION_POP="@-webkit-keyframes popin{from{-webkit-transform:scale(.8);opacity:0}to{-webkit-transform:scale(1);opacity:1}}@-moz-keyframes popin{from{-moz-transform:scale(.8);opacity:0}to{-moz-transform:scale(1);opacity:1}}@keyframes popin{from{transform:scale(.8);opacity:0}to{transform:scale(1);opacity:1}}";var OPEN_ANIMATION_FADE="@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@-moz-keyframes fadein{from{opacity:0}to{opacity:1}}@keyframes fadein{from{opacity:0}to{opacity:1}}";var OPEN_ANIMATION_FLIP="@-webkit-keyframes flipintoright{from{-webkit-transform:rotateY(90deg) scale(.9)}to{-webkit-transform:rotateY(0)}}@-moz-keyframes flipintoright{from{-moz-transform:rotateY(90deg) scale(.9)}to{-moz-transform:rotateY(0)}}@keyframes flipintoright{from{transform:rotateY(90deg) scale(.9)}to{transform:rotateY(0)}}";var OPEN_ANIMATION_SLIDELEFT="@-webkit-keyframes slideinfromright{from{-webkit-transform:translate3d({start},0,0)}to{-webkit-transform:translate3d(0,0,0)}}@-moz-keyframes slideinfromright{from{-moz-transform:translateX({start})}to{-moz-transform:translateX(0)}}@keyframes slideinfromright{from{transform:translateX({start})}to{transform:translateX(0)}}";var OPEN_ANIMATION_SLIDERIGHT="@-webkit-keyframes slideinfromleft{from{-webkit-transform:translate3d({start},0,0)}to{-webkit-transform:translate3d(0,0,0)}}@-moz-keyframes slideinfromleft{from{-moz-transform:translateX({start})}to{-moz-transform:translateX(0)}}@keyframes slideinfromleft{from{transform:translateX({start})}to{transform:translateX(0)}}";var OPEN_ANIMATION_FLOW="@-webkit-keyframes flowinfromright{0%{-webkit-transform:translateX(100%) scale(.7)}30%,40%{-webkit-transform:translateX(0) scale(.7)}100%{-webkit-transform:translateX(0) scale(1)}}@-moz-keyframes flowinfromright{0%{-moz-transform:translateX(100%) scale(.7)}30%,40%{-moz-transform:translateX(0) scale(.7)}100%{-moz-transform:translateX(0) scale(1)}}@keyframes flowinfromright{0%{transform:translateX(100%) scale(.7)}30%,40%{transform:translateX(0) scale(.7)}100%{transform:translateX(0) scale(1)}}";var OPEN_ANIMATION_SLIDEUP="@-webkit-keyframes slideinfrombottom{from{-webkit-transform:translateY({start})}to{-webkit-transform:translateY(0)}}@-moz-keyframes slideinfrombottom{from{-moz-transform:translateY({start})}to{-moz-transform:translateY(0)}}@keyframes slideinfrombottom{from{transform:translateY({start})}to{transform:translateY(0)}}";var OPEN_ANIMATION_SLIDEDOWN="@-webkit-keyframes slideinfromtop{from{-webkit-transform:translateY({start})}to{-webkit-transform:translateY(0)}}@-moz-keyframes slideinfromtop{from{-moz-transform:translateY({start})}to{-moz-transform:translateY(0)}}@keyframes slideinfromtop{from{transform:translateY({start})}to{transform:translateY(0)}}";var CLOSE_ANIMATION_SLIDELEFT="@-webkit-keyframes slideouttoleft{from{-webkit-transform:translate3d(0,0,0)}to{-webkit-transform:translate3d({end},0,0)}}@-moz-keyframes slideouttoleft{from{-moz-transform:translateX(0)}to{-moz-transform:translateX({end})}}@keyframes slideouttoleft{from{transform:translateX(0)}to{transform:translateX({end})}}";var CLOSE_ANIMATION_SLIDERIGHT="@-webkit-keyframes slideouttoright{from{-webkit-transform:translate3d(0,0,0)}to{-webkit-transform:translate3d({end},0,0)}}@-moz-keyframes slideouttoright{from{-moz-transform:translateX(0)}to{-moz-transform:translateX({end})}}@keyframes slideouttoright{from{transform:translateX(0)}to{transform:translateX({end})}}";var CLOSE_ANIMATION_POP="@-webkit-keyframes popout{from{-webkit-transform:scale(1);opacity:1}to{-webkit-transform:scale(.8);opacity:0}}@-moz-keyframes popout{from{-moz-transform:scale(1);opacity:1}to{-moz-transform:scale(.8);opacity:0}}@keyframes popout{from{transform:scale(1);opacity:1}to{transform:scale(.8);opacity:0}}";var CLOSE_ANIMATION_FADE="@-webkit-keyframes fadeout{from{opacity:1}to{opacity:0}}@-moz-keyframes fadeout{from{opacity:1}to{opacity:0}}@keyframes fadeout{from{opacity:1}to{opacity:0}}";var CLOSE_ANIMATION_FLIP="@-webkit-keyframes flipouttoright{from{-webkit-transform:rotateY(0)}to{-webkit-transform:rotateY(90deg) scale(.9)}}@-moz-keyframes flipouttoright{from{-moz-transform:rotateY(0)}to{-moz-transform:rotateY(90deg) scale(.9)}}@keyframes flipouttoright{from{transform:rotateY(0)}to{transform:rotateY(90deg) scale(.9)}}";var CLOSE_ANIMATION_FLOW="@-webkit-keyframes flowouttoright{0%{-webkit-transform:translateX(0) scale(1)}60%,70%{-webkit-transform:translateX(0) scale(.7)}100%{-webkit-transform:translateX(100%) scale(.7)}}@-moz-keyframes flowouttoright{0%{-moz-transform:translateX(0) scale(1)}60%,70%{-moz-transform:translateX(0) scale(.7)}100%{-moz-transform:translateX(100%) scale(.7)}}@keyframes flowouttoright{0%{transform:translateX(0) scale(1)}60%,70%{transform:translateX(0) scale(.7)}100%{transform:translateX(100%) scale(.7)}}";var CLOSE_ANIMATION_SLIDEUP="@-webkit-keyframes slideouttotop{from{-webkit-transform:translateY(0)}to{-webkit-transform:translateY({end})}}@-moz-keyframes slideouttotop{from{-moz-transform:translateY(0)}to{-moz-transform:translateY({end})}}@keyframes slideouttotop{from{transform:translateY(0)}to{transform:translateY({end})}}";var CLOSE_ANIMATION_SLIDEDOWN="@-webkit-keyframes slideouttobottom{from{-webkit-transform:translateY(0)}to{-webkit-transform:translateY({end})}}@-moz-keyframes slideouttobottom{from{-moz-transform:translateY(0)}to{-moz-transform:translateY({end})}}@keyframes slideouttobottom{from{transform:translateY(0)}to{transform:translateY({end})}}";function addAnimationClass(classString)
8
  {var style=document.createElement('style');style.type='text/css';style.innerHTML=classString;style.id=prefix+"-effect-custom-style";document.getElementsByTagName('head')[0].appendChild(style);}
9
  function setMainDivStyles(sizeConfig)
10
+ {jQuery(window).trigger('sgpbPopupBuilderAdditionalDimensionSettings');contentDiv.style.zIndex=defaultZIndex+10;mainDiv.style.boxSizing='content-box';if(sizeConfig.minHeight!=-1){var minHeight=sizeConfig.minHeight;var popupMinHeight=window.innerHeight;if(typeof minHeight==='string'&&minHeight.indexOf('%')!==-1){var popupMinhHeight=(popupMinhHeight/100)*parseInt(minHeight);mainDiv.style.minHeight=popupMinhHeight+'px';}
11
  else{mainDiv.style.minHeight=parseInt(minHeight)+'px';}}
12
+ if(sizeConfig.minWidth!=-1){var popupMinhWidth=window.innerWidth;var minWidth=sizeConfig.minWidth;if(typeof minWidth==='string'&&minWidth.indexOf('%')!==-1){popupMinhWidth=(popupMinhWidth/100)*parseInt(minWidth);mainDiv.style.minWidth=popupMinhWidth+'px';}
13
  else{mainDiv.style.minWidth=parseInt(minWidth)+'px';}}
14
+ if(sizeConfig.maxHeight!=-1&&sizeConfig.maxHeight){var maxHeight=sizeConfig.maxHeight;var popupMaxHeight=window.innerHeight;if(maxHeight.indexOf('%')!==-1){popupMaxHeight=(popupMaxHeight/100)*parseInt(maxHeight);this.calculatedMaxHeight=calculateMaxHeight(popupMaxHeight);mainDiv.style.maxHeight=this.calculatedMaxHeight;}
15
  else{this.calculatedMaxHeight=calculateMaxHeight(parseInt(maxHeight));mainDiv.style.maxHeight=this.calculatedMaxHeight;}}
16
  else{var popupMaxHeight=window.innerHeight;mainDiv.style.maxHeight=calculateMaxHeight(popupMaxHeight);}
17
+ if(sizeConfig.maxWidth!=-1&&sizeConfig.maxWidth){var maxWidth=sizeConfig.maxWidth;var popupMaxWidth=window.innerWidth;if(maxWidth.indexOf('%')!==-1){popupMaxWidth=(popupMaxWidth/100)*parseInt(maxWidth);this.calculatedMaxWidth=calculateMaxWidth(popupMaxWidth);mainDiv.style.maxWidth=this.calculatedMaxWidth;}
18
  else{this.calculatedMaxWidth=calculateMaxWidth(parseInt(maxWidth));mainDiv.style.maxWidth=this.calculatedMaxWidth;}}
19
  else{var popupMaxWidth=window.innerWidth;mainDiv.style.maxWidth=calculateMaxWidth(popupMaxWidth);}
20
  if(contentBox.borderStyle){mainDiv.style.borderStyle=contentBox.borderStyle;}
49
  else if(imageWidth>maxWidth){var modifiedWidthPercent=Math.floor((widthDifference/imageWidth)*100);var heightMustDecrease=Math.floor((imageHeight*modifiedWidthPercent)/100);var modifiedHeight=imageHeight-heightMustDecrease;imageWidth-=widthDifference;imageHeight-=heightMustDecrease;}
50
  var result={width:imageWidth,height:imageHeight};return result;}
51
  function calculateMaxWidth(maxWidth)
52
+ {var sizeConfig=getSizeConfig();var dimension=sizeConfig.width;var contentPadding=(contentBox.padding||0)*2;var shadowSpread=(contentBox.shadowSpread||0)*2;var borderWidth=(contentBox.borderWidth||0)*2;var boxBorderWidth=(contentBox.boxBorderWidth||0)*4;var closeButtonRight=(parseInt(closeBehavior.right)||0)*2;var closeButtonLeft=(parseInt(closeBehavior.left)||0)*2;if(dimension.indexOf('fullScreen')=='-1'){maxWidth-=contentPadding;maxWidth-=34;maxWidth-=shadowSpread;maxWidth-=borderWidth;maxWidth-=boxBorderWidth;}
53
  if(!closeBehavior.buttonInside){if(closeButtonRight){maxWidth-=Math.abs(closeButtonRight);}
54
  if(closeButtonLeft){maxWidth-=Math.abs(closeButtonLeft);}}
55
  if(maxWidth<0){return'30px';}
public/js/Subscribers.js CHANGED
@@ -1,36 +1 @@
1
- function SGPBSubscribers(){}
2
- SGPBSubscribers.prototype.init=function()
3
- {this.openAddSubscriberPopup();this.openImportSubscriberPopup();this.subscriberFileUploader();this.closeAddSubscriberPopup();this.importSubscriber();this.dataImport();this.deleteSubscribers();this.addSubscribers();this.toggleCheckedSubscribers();this.fixSubscriptionBulkCheckbox();this.exportSubscribers();};SGPBSubscribers.prototype.deleteSubscribers=function()
4
- {var checkedSubscribersList=[];var that=this;jQuery('.sg-subs-delete-button').bind('click',function(){var data={};data.ajaxNonce=jQuery(this).attr('data-ajaxNonce');jQuery('.subs-delete-checkbox').each(function(){var isChecked=jQuery(this).prop('checked');if(isChecked){var subscriberId=jQuery(this).attr('data-delete-id');checkedSubscribersList.push(subscriberId);}});if(checkedSubscribersList.length===0){alert('Please select at least one subscriber.');}
5
- else{var isSure=confirm(SGPB_JS_LOCALIZATION.areYouSure);if(isSure){that.deleteSubscribersAjax(checkedSubscribersList,data);}}});};SGPBSubscribers.prototype.openImportSubscriberPopup=function()
6
- {if(jQuery('.bulkactions').empty()){jQuery('.bulkactions').remove();}
7
- var that=this;jQuery('.sgpb-import-subscriber').bind('click',function(){jQuery('#sgpb-import-subscribers').addClass('sgpb-show-add-subscriber-popup');SGPBSubscribers.prototype.escKeyClosePopup();that.closePopup();});};SGPBSubscribers.prototype.subscriberFileUploader=function()
8
- {var uploadButton=jQuery('#js-import-subscriber-button');var supportedAudioTypes=['text/plain','text/x-csv','text/csv'];if(!uploadButton.length){return false;}
9
- var uploader;uploadButton.bind('click',function(e){e.preventDefault();if(uploader){uploader.open();return false;}
10
- uploader=wp.media.frames.file_frame=wp.media({titleFF:SGPB_JS_LOCALIZATION.changeSound,button:{text:SGPB_JS_LOCALIZATION.changeSound},library:{type:supportedAudioTypes},multiple:false});uploader.on('select',function(){var attachment=uploader.state().get('selection').first().toJSON();if(supportedAudioTypes.indexOf(attachment.mime)===-1){alert(SGPB_JS_LOCALIZATION.audioSupportAlertMessage);return;}
11
- jQuery('#js-import-subscriber-file-url').val(attachment.url);});uploader.open();});};SGPBSubscribers.prototype.importSubscriber=function()
12
- {var importSubscriber=jQuery('.sgpb-import-subscriber-to-list');var that=this;if(!importSubscriber.length){return false;}
13
- importSubscriber.bind('click',function(){var popupSubscriptionList=jQuery('.js-sg-import-list').val();var importListURL=jQuery('#js-import-subscriber-file-url').val();var data={action:'sgpb_import_subscribers',nonce:SGPB_JS_PARAMS.nonce,popupSubscriptionList:popupSubscriptionList,importListURL:importListURL,beforeSend:function(){importSubscriber.prop('disabled',true);}};jQuery.post(ajaxurl,data,function(response){importSubscriber.prop('disabled',false);jQuery('.sgpb-add-subscriber-content-wrapper').html('');jQuery('.sgpb-add-subscriber-content-wrapper').append(response);that.closePopup();that.disableSelectedValue();jQuery('.sgpb-add-new-subscribers-wrapper').addClass('sgpb-to-center-window');jQuery('.sgpb-add-new-subscribers-wrapper').css({'margin-top':0});that.saveImportValue();});});};SGPBSubscribers.prototype.disableSelectedValue=function(){var selectOptioon=jQuery('.sgpb-our-fields-keys');if(!selectOptioon.length){return false;}
14
- selectOptioon.bind('change',function(){var currentVal=jQuery(this).val();jQuery('.sgpb-our-fields-keys option[value="'+jQuery(this).attr('data-saved-value')+'"]').removeAttr('disabled');jQuery(this).attr('data-saved-value',currentVal);jQuery('.sgpb-our-fields-keys option[value="'+currentVal+'"]').not(jQuery(this)).attr('disabled','disabled');});};SGPBSubscribers.prototype.saveImportValue=function()
15
- {var importSubscriber=jQuery('.sgpb-import-subscriber-to-list');var mapping={};var data={action:'sgpb_save_imported_subscribers',nonce:SGPB_JS_PARAMS.nonce,popupSubscriptionList:jQuery('.sgpb-to-import-popup-id').val(),importListURL:jQuery('.sgpb-imported-file-url').val(),};jQuery('.sgpb-save-subscriber').bind('click',function(){mapping={};var ourFields=jQuery('.sgpb-our-fields-keys');ourFields.each(function(){var currentValue=jQuery('option:selected',this).val();if(currentValue){mapping[currentValue]=jQuery(this).attr('data-index');}});data.namesMapping=mapping;data.popupId=jQuery('.sgpb-to-import-popup-id').val();data.beforeSend=function(){jQuery('.sgpb-save-subscriber').prop('disabled',true);};jQuery.post(ajaxurl,data,function(response){window.location.reload();jQuery('.sgpb-save-subscriber').prop('disabled',false);});});};SGPBSubscribers.prototype.closePopup=function()
16
- {jQuery('.sgpb-subscriber-popup-close-btn-js').bind('click',function(){jQuery(this).parents('.sgpb-subscribers-popup').first().removeClass('sgpb-show-add-subscriber-popup');jQuery('.sgpb-add-subscriber-input:selected').prop('selected',false);jQuery('.sgpb-add-subscriber-input').val('');});};SGPBSubscribers.prototype.openAddSubscriberPopup=function()
17
- {if(jQuery('.bulkactions').empty()){jQuery('.bulkactions').remove();}
18
- jQuery('.sgpb-add-subscriber').bind('click',function(){jQuery('#sgpb-add-new-subscriber').addClass('sgpb-show-add-subscriber-popup');SGPBSubscribers.prototype.escKeyClosePopup();});};SGPBSubscribers.prototype.escKeyClosePopup=function()
19
- {jQuery(document).keyup(function(e){if(e.keyCode===27){if(jQuery('#sgpb-add-new-subscriber').hasClass('sgpb-show-add-subscriber-popup')){jQuery('#sgpb-add-new-subscriber').removeClass('sgpb-show-add-subscriber-popup');}}});};SGPBSubscribers.prototype.closeAddSubscriberPopup=function()
20
- {jQuery('.sgpb-add-subscriber-popup-close-btn-js').bind('click',function(){jQuery('#sgpb-add-new-subscriber').removeClass('sgpb-show-add-subscriber-popup');jQuery('.sgpb-add-subscriber-input:selected').prop('selected',false);jQuery('.sgpb-add-subscriber-input').val('');});};SGPBSubscribers.prototype.addSubscribers=function()
21
- {var that=this;jQuery('.sgpb-add-to-list-js').bind('click',function(){jQuery('.sgpb-subscription-error').addClass('sg-hide-element');jQuery('.sgpb-email-error').addClass('sg-hide-element');var email=jQuery('.sgpb-add-subscribers-email').val();var firstName=jQuery('.sgpb-add-subscribers-first-name').val();var lastName=jQuery('.sgpb-add-subscribers-last-name').val();var subscriptionPopups=[];jQuery('.js-sg-newsletter-forms > option').each(function(){if(jQuery(this).prop('selected')){subscriptionPopups.push(jQuery(this).val());}});var validationString=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;var validEmail=email.search(validationString);if(jQuery('.js-sg-newsletter-forms > option').is(':checked')===false&&validEmail===-1){jQuery('.sgpb-subscription-error').removeClass('sg-hide-element');jQuery('.sgpb-email-error').removeClass('sg-hide-element');return;}
22
- if(jQuery('.js-sg-newsletter-forms > option').is(':checked')===false){jQuery('.sgpb-subscription-error').removeClass('sg-hide-element');return;}
23
- if(validEmail===-1){jQuery('.sgpb-email-error').removeClass('sg-hide-element');return;}
24
- jQuery('.sgpb-email-error').addClass('sg-hide-element');var data={action:'sgpb_add_subscribers',nonce:SGPB_JS_PARAMS.nonce,firstName:firstName,lastName:lastName,email:email,popups:subscriptionPopups,beforeSend:function(){jQuery('.js-sgpb-add-spinner').removeClass('sg-hide-element');}};that.addToSubscribersAjax(data);});};SGPBSubscribers.prototype.exportSubscribers=function()
25
- {var that=this;jQuery('#sgpb-subscription-popup').on('change',function(){jQuery('.sgpb-subscription-popup-id').val(jQuery(this).val());});jQuery('#sgpb-subscribers-dates').on('change',function(){jQuery('.sgpb-subscribers-date').val(jQuery(this).val());});jQuery('.sgpb-export-subscriber').bind('click',function(){var parameters='';var params={};params['sgpb-subscription-popup-id']=that.getUrlParameter('sgpb-subscription-popup-id');params['s']=that.getUrlParameter('s');params['sgpb-subscribers-date']=that.getUrlParameter('sgpb-subscribers-date');params['orderby']=that.getUrlParameter('orderby');params['order']=that.getUrlParameter('order');for(var i in params){if(typeof params[i]!=='undefined'&&params[i]!==''){parameters+='&'+i+'='+params[i];}}
26
- window.location.href=SGPB_JS_ADMIN_URL.url+'?action=csv_file'+parameters;});};SGPBSubscribers.prototype.getUrlParameter=function(key)
27
- {var pageUrl=window.location.search.substring(1);var urlVariables=pageUrl.split('&');for(var i=0;i<urlVariables.length;i++){var param=urlVariables[i].split('=');if(param[0]===key){if(typeof param[1]!=='undefined'){return param[1];}
28
- else{return'';}}}};SGPBSubscribers.prototype.addToSubscribersAjax=function(data)
29
- {jQuery.post(ajaxurl,data,function(response){if(response!==1){jQuery('.sgpb-subscriber-adding-error').removeClass('sg-hide-element');jQuery('.sgpb-subscribers-add-spinner').addClass('sg-hide-element');}
30
- else{location.reload();}});};SGPBSubscribers.prototype.toggleCheckedSubscribers=function()
31
- {var that=this;jQuery('.subs-bulk').each(function(){jQuery(this).bind('click',function(){var bulkStatus=jQuery(this).prop('checked');that.changeCheckedSubscribers(bulkStatus);});});};SGPBSubscribers.prototype.changeCheckedSubscribers=function(bulkStatus)
32
- {jQuery('.subs-delete-checkbox').each(function(){jQuery(this).prop('checked',bulkStatus);});};SGPBSubscribers.prototype.fixSubscriptionBulkCheckbox=function()
33
- {jQuery('#bulk,.column-bulk').removeClass().addClass('manage-column column-cb check-column');};SGPBSubscribers.prototype.dataImport=function()
34
- {var custom_uploader;jQuery('#js-upload-export-file').click(function(e){e.preventDefault();var ajaxNonce=jQuery(this).attr('data-ajaxNonce');if(custom_uploader){custom_uploader.open();return;}
35
- custom_uploader=wp.media.frames.file_frame=wp.media({titleFF:'Select Export File',button:{text:'Select Export File'},multiple:false,library:{type:'text/plain'}});custom_uploader.on('select',function(){attachment=custom_uploader.state().get('selection').first().toJSON();var data={action:'import_popups',ajaxNonce:ajaxNonce,attachmentUrl:attachment.url};jQuery('.js-sg-import-gif').removeClass('sg-hide-element');jQuery.post(ajaxurl,data,function(response,d){location.reload();jQuery('.js-sg-import-gif').addClass('sg-hide-element');});});custom_uploader.open();});};SGPBSubscribers.prototype.deleteSubscribersAjax=function(checkedSubscribersList)
36
- {var data={action:'sgpb_subscribers_delete',nonce:SGPB_JS_PARAMS.nonce,subscribersId:checkedSubscribersList,beforeSend:function(){jQuery('.sgpb-subscribers-remove-spinner').removeClass('sg-hide-element');}};jQuery.post(ajaxurl,data,function(response){jQuery('.sgpb-subscribers-remove-spinner').addClass('sg-hide-element');jQuery('.subs-delete-checkbox').prop('checked','');window.location.reload();});};jQuery(document).ready(function(){var subscribers=new SGPBSubscribers();subscribers.init();});
1
+ function SGPBSubscribers(){}SGPBSubscribers.prototype.init=function(){this.openAddSubscriberPopup(),this.openImportSubscriberPopup(),this.subscriberFileUploader(),this.closeAddSubscriberPopup(),this.importSubscriber(),this.dataImport(),this.deleteSubscribers(),this.addSubscribers(),this.toggleCheckedSubscribers(),this.fixSubscriptionBulkCheckbox(),this.exportSubscribers()},SGPBSubscribers.prototype.deleteSubscribers=function(){var e=[],r=this;jQuery(".sg-subs-delete-button").bind("click",function(){var s={};(s.ajaxNonce=jQuery(this).attr("data-ajaxNonce"),jQuery(".subs-delete-checkbox").each(function(){if(jQuery(this).prop("checked")){var r=jQuery(this).attr("data-delete-id");e.push(r)}}),0===e.length)?alert("Please select at least one subscriber."):confirm(SGPB_JS_LOCALIZATION.areYouSure)&&r.deleteSubscribersAjax(e,s)})},SGPBSubscribers.prototype.openImportSubscriberPopup=function(){jQuery(".bulkactions").empty()&&jQuery(".bulkactions").remove();var e=this;jQuery(".sgpb-import-subscriber").bind("click",function(){jQuery("#sgpb-import-subscribers").addClass("sgpb-show-add-subscriber-popup"),SGPBSubscribers.prototype.escKeyClosePopup(),e.closePopup()})},SGPBSubscribers.prototype.subscriberFileUploader=function(){var e,r=jQuery("#js-import-subscriber-button"),s=["text/plain","text/x-csv","text/csv"];if(!r.length)return!1;r.bind("click",function(r){if(r.preventDefault(),e)return e.open(),!1;(e=wp.media.frames.file_frame=wp.media({titleFF:SGPB_JS_LOCALIZATION.changeSound,button:{text:SGPB_JS_LOCALIZATION.changeSound},library:{type:s},multiple:!1})).on("select",function(){var r=e.state().get("selection").first().toJSON();-1!==s.indexOf(r.mime)?jQuery("#js-import-subscriber-file-url").val(r.url):alert(SGPB_JS_LOCALIZATION.audioSupportAlertMessage)}),e.open()})},SGPBSubscribers.prototype.importSubscriber=function(){var e=jQuery(".sgpb-import-subscriber-to-list"),r=this;if(!e.length)return!1;e.bind("click",function(){var s=jQuery(".js-sg-import-list").val(),t=jQuery("#js-import-subscriber-file-url").val(),i={action:"sgpb_import_subscribers",nonce:SGPB_JS_PARAMS.nonce,popupSubscriptionList:s,importListURL:t,beforeSend:function(){e.prop("disabled",!0)}};jQuery.post(ajaxurl,i,function(s){e.prop("disabled",!1),jQuery(".sgpb-add-subscriber-content-wrapper").html(""),jQuery(".sgpb-add-subscriber-content-wrapper").append(s),r.closePopup(),r.disableSelectedValue(),jQuery(".sgpb-add-new-subscribers-wrapper").addClass("sgpb-to-center-window"),jQuery(".sgpb-add-new-subscribers-wrapper").css({"margin-top":0}),r.saveImportValue()})})},SGPBSubscribers.prototype.disableSelectedValue=function(){var e=jQuery(".sgpb-our-fields-keys");if(!e.length)return!1;e.bind("change",function(){var e=jQuery(this).val();jQuery('.sgpb-our-fields-keys option[value="'+jQuery(this).attr("data-saved-value")+'"]').removeAttr("disabled"),jQuery(this).attr("data-saved-value",e),jQuery('.sgpb-our-fields-keys option[value="'+e+'"]').not(jQuery(this)).attr("disabled","disabled")})},SGPBSubscribers.prototype.saveImportValue=function(){jQuery(".sgpb-import-subscriber-to-list");var e={},r={action:"sgpb_save_imported_subscribers",nonce:SGPB_JS_PARAMS.nonce,popupSubscriptionList:jQuery(".sgpb-to-import-popup-id").val(),importListURL:jQuery(".sgpb-imported-file-url").val()};jQuery(".sgpb-save-subscriber").bind("click",function(){e={},jQuery(".sgpb-our-fields-keys").each(function(){var r=jQuery("option:selected",this).val();r&&(e[r]=jQuery(this).attr("data-index"))}),r.namesMapping=e,r.popupId=jQuery(".sgpb-to-import-popup-id").val(),r.beforeSend=function(){jQuery(".sgpb-save-subscriber").prop("disabled",!0)},jQuery.post(ajaxurl,r,function(e){window.location.reload(),jQuery(".sgpb-save-subscriber").prop("disabled",!1)})})},SGPBSubscribers.prototype.closePopup=function(){jQuery(".sgpb-subscriber-popup-close-btn-js").bind("click",function(){jQuery(this).parents(".sgpb-subscribers-popup").first().removeClass("sgpb-show-add-subscriber-popup"),jQuery(".sgpb-add-subscriber-input:selected").prop("selected",!1),jQuery(".sgpb-add-subscriber-input").val("")})},SGPBSubscribers.prototype.openAddSubscriberPopup=function(){jQuery(".bulkactions").empty()&&jQuery(".bulkactions").remove(),jQuery(".sgpb-add-subscriber").bind("click",function(){jQuery("#sgpb-add-new-subscriber").addClass("sgpb-show-add-subscriber-popup"),SGPBSubscribers.prototype.escKeyClosePopup()})},SGPBSubscribers.prototype.escKeyClosePopup=function(){jQuery(document).keyup(function(e){27===e.keyCode&&jQuery("#sgpb-add-new-subscriber").hasClass("sgpb-show-add-subscriber-popup")&&jQuery("#sgpb-add-new-subscriber").removeClass("sgpb-show-add-subscriber-popup")})},SGPBSubscribers.prototype.closeAddSubscriberPopup=function(){jQuery(".sgpb-add-subscriber-popup-close-btn-js").bind("click",function(){jQuery("#sgpb-add-new-subscriber").removeClass("sgpb-show-add-subscriber-popup"),jQuery(".sgpb-add-subscriber-input:selected").prop("selected",!1),jQuery(".sgpb-add-subscriber-input").val("")})},SGPBSubscribers.prototype.addSubscribers=function(){var e=this;jQuery(".sgpb-add-to-list-js").bind("click",function(){jQuery(".sgpb-subscription-error").addClass("sg-hide-element"),jQuery(".sgpb-email-error").addClass("sg-hide-element");var r=jQuery(".sgpb-add-subscribers-email").val(),s=jQuery(".sgpb-add-subscribers-first-name").val(),t=jQuery(".sgpb-add-subscribers-last-name").val(),i=[];jQuery(".js-sg-newsletter-forms > option").each(function(){jQuery(this).prop("selected")&&i.push(jQuery(this).val())});var u=r.search(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);if(!1===jQuery(".js-sg-newsletter-forms > option").is(":checked")&&-1===u)return jQuery(".sgpb-subscription-error").removeClass("sg-hide-element"),void jQuery(".sgpb-email-error").removeClass("sg-hide-element");if(!1!==jQuery(".js-sg-newsletter-forms > option").is(":checked"))if(-1!==u){jQuery(".sgpb-email-error").addClass("sg-hide-element");var o={action:"sgpb_add_subscribers",nonce:SGPB_JS_PARAMS.nonce,firstName:s,lastName:t,email:r,popups:i,beforeSend:function(){jQuery(".js-sgpb-add-spinner").removeClass("sg-hide-element")}};e.addToSubscribersAjax(o)}else jQuery(".sgpb-email-error").removeClass("sg-hide-element");else jQuery(".sgpb-subscription-error").removeClass("sg-hide-element")})},SGPBSubscribers.prototype.exportSubscribers=function(){var e=this;jQuery("#sgpb-subscription-popup").on("change",function(){jQuery(".sgpb-subscription-popup-id").val(jQuery(this).val())}),jQuery("#sgpb-subscribers-dates").on("change",function(){jQuery(".sgpb-subscribers-date").val(jQuery(this).val())}),jQuery(".sgpb-export-subscriber").bind("click",function(){var r="",s={};for(var t in s["sgpb-subscription-popup-id"]=e.getUrlParameter("sgpb-subscription-popup-id"),s.s=e.getUrlParameter("s"),s["sgpb-subscribers-date"]=e.getUrlParameter("sgpb-subscribers-date"),s.orderby=e.getUrlParameter("orderby"),s.order=e.getUrlParameter("order"),s)void 0!==s[t]&&""!==s[t]&&(r+="&"+t+"="+s[t]);window.location.href=SGPB_JS_ADMIN_URL.url+"?action=csv_file"+r})},SGPBSubscribers.prototype.getUrlParameter=function(e){for(var r=window.location.search.substring(1).split("&"),s=0;s<r.length;s++){var t=r[s].split("=");if(t[0]==e)return void 0!==t[1]?t[1]:""}},SGPBSubscribers.prototype.addToSubscribersAjax=function(e){jQuery.post(ajaxurl,e,function(e){1!==e?(jQuery(".sgpb-subscriber-adding-error").removeClass("sg-hide-element"),jQuery(".sgpb-subscribers-add-spinner").addClass("sg-hide-element")):location.reload()})},SGPBSubscribers.prototype.toggleCheckedSubscribers=function(){var e=this;jQuery(".subs-bulk").each(function(){jQuery(this).bind("click",function(){var r=jQuery(this).prop("checked");e.changeCheckedSubscribers(r)})})},SGPBSubscribers.prototype.changeCheckedSubscribers=function(e){jQuery(".subs-delete-checkbox").each(function(){jQuery(this).prop("checked",e)})},SGPBSubscribers.prototype.fixSubscriptionBulkCheckbox=function(){jQuery("#bulk,.column-bulk").removeClass().addClass("manage-column column-cb check-column")},SGPBSubscribers.prototype.dataImport=function(){var e;jQuery("#js-upload-export-file").click(function(r){r.preventDefault();var s=jQuery(this).attr("data-ajaxNonce");e?e.open():((e=wp.media.frames.file_frame=wp.media({titleFF:"Select Export File",button:{text:"Select Export File"},multiple:!1,library:{type:"text/plain"}})).on("select",function(){attachment=e.state().get("selection").first().toJSON();var r={action:"import_popups",ajaxNonce:s,attachmentUrl:attachment.url};jQuery(".js-sg-import-gif").removeClass("sg-hide-element"),jQuery.post(ajaxurl,r,function(e,r){location.reload(),jQuery(".js-sg-import-gif").addClass("sg-hide-element")})}),e.open())})},SGPBSubscribers.prototype.deleteSubscribersAjax=function(e){var r={action:"sgpb_subscribers_delete",nonce:SGPB_JS_PARAMS.nonce,subscribersId:e,beforeSend:function(){jQuery(".sgpb-subscribers-remove-spinner").removeClass("sg-hide-element")}};jQuery.post(ajaxurl,r,function(e){jQuery(".sgpb-subscribers-remove-spinner").addClass("sg-hide-element"),jQuery(".subs-delete-checkbox").prop("checked",""),window.location.reload()})},jQuery(document).ready(function(){(new SGPBSubscribers).init()});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
public/js/Subscription.js CHANGED
@@ -1,52 +1 @@
1
- function SGPBSubscription()
2
- {this.expiryTime=365;this.submissionPopupId=0;this.newWindow=null;this.init();}
3
- SGPBSubscription.cookieName='SGPBSubscription';SGPBSubscription.prototype.init=function()
4
- {if(typeof SGPBFormBuilder!=='undefined'){return false;}
5
- this.livePreview();this.formSubmission();};SGPBSubscription.prototype.formSubmission=function()
6
- {var that=this;if(typeof sgAddEvent==='undefined'){return false;}
7
- sgAddEvent(window,'sgpbDidOpen',function(e){var popupArgs=e.detail;var popupId=popupArgs.popupId;var popupOptions=SGPBPopup.getPopupOptionsById(popupId);var additionalPopupParams={};var subscriptionForm=jQuery('#sgpb-popup-dialog-main-div .sgpb-subs-form-'+popupId+' form');var submitButton=subscriptionForm.find('.js-subs-submit-btn');var sgpbSubsValidateObj={};try{sgpbSubsValidateObj=eval('sgpbSubsValidateObj'+popupId);}
8
- catch(err){}
9
- if(typeof sgpbSubsValidateObj!=='object'){return false;}
10
- jQuery.validator.setDefaults({errorPlacement:function(error,element){var errorWrapperClassName=jQuery(element).attr('data-error-message-class');jQuery('.sgpb-subs-form-'+popupId+' .'+errorWrapperClassName).html(error);}});sgpbSubsValidateObj.submitHandler=function()
11
- {var formData=subscriptionForm.serialize();var ajaxData={action:'sgpb_subscription_submission',nonce:SGPB_JS_PARAMS.nonce,beforeSend:function(){submitButton.val(submitButton.attr('data-progress-title'));if(popupOptions['sgpb-subs-success-behavior']==='redirectToURL'&&popupOptions['sgpb-subs-success-redirect-new-tab']){that.newWindow=window.open(popupOptions['sgpb-subs-success-redirect-URL']);}},formData:formData,popupPostId:popupId};jQuery.post(SGPB_JS_PARAMS.ajaxUrl,ajaxData,function(res){that.submissionPopupId=popupId;jQuery('.sgpb-subs-form-'+popupId+' .sgpb-alert').addClass('sg-hide-element');submitButton.val(submitButton.attr('data-title'));additionalPopupParams['res']=res;that.showMessages(additionalPopupParams);that.processAfterSuccessfulSubmission(ajaxData);});};subscriptionForm.validate(sgpbSubsValidateObj);});jQuery(window).on('sgpbDidClose',function(e){var popupArgs=e.detail;var popupId=popupArgs.popupId;jQuery('.sgpb-subs-form-'+popupId+' form label.error').hide();});};SGPBSubscription.prototype.processAfterSuccessfulSubmission=function(ajaxData)
12
- {if(jQuery.isEmptyObject(ajaxData)){return false;}
13
- ajaxData.action='sgpb_process_after_submission';jQuery.post(SGPB_JS_PARAMS.ajaxUrl,ajaxData,function(res){});};SGPBSubscription.prototype.showMessages=function(res)
14
- {var that=this;if(res['res']===1){this.subscriptionSuccessBehavior();}
15
- else{if(that.newWindow!==null){that.newWindow.close();}
16
- this.showErrorMessage();}
17
- window.dispatchEvent(new Event('resize'));return true;};SGPBSubscription.prototype.showErrorMessage=function()
18
- {var popupId=parseInt(this.submissionPopupId);jQuery('.sgpb-subs-form-'+popupId+' .sgpb-alert-danger').removeClass('sg-hide-element');};SGPBSubscription.prototype.subscriptionSuccessBehavior=function()
19
- {var settings={popupId:this.submissionPopupId,eventName:'sgpbSubscriptionSuccess'};jQuery(window).trigger('sgpbFormSuccess',settings);var popupId=parseInt(this.submissionPopupId);var popupOptions=SGPBPopup.getPopupOptionsById(popupId);var behavior='showMessage';jQuery('.sgpb-subs-form-'+popupId+' form').remove();if(typeof popupOptions['sgpb-subs-hide-subs-users']!=='undefined'){this.setSubscriptionCookie(popupId);}
20
- if(typeof popupOptions['sgpb-subs-success-behavior']!=='undefined'){behavior=popupOptions['sgpb-subs-success-behavior'];}
21
- this.resetFieldsValues();switch(behavior){case'showMessage':jQuery('.sgpb-subs-form-'+popupId+' .sgpb-alert-success').removeClass('sg-hide-element');break;case'redirectToURL':this.redirectToURL(popupOptions);break;case'openPopup':this.openSuccessPopup(popupOptions);break;case'hidePopup':SGPBPopup.closePopupById(this.submissionPopupId);break;}};SGPBSubscription.prototype.openSuccessPopup=function(popupOptions)
22
- {var that=this;setTimeout(function(){SGPBPopup.closePopupById(that.submissionPopupId);},0);if(typeof popupOptions['sgpb-subs-success-popup']!=='undefined'){sgAddEvent(window,'sgpbDidClose',this.openPopup(popupOptions));}};SGPBSubscription.prototype.openPopup=function(popupOptions)
23
- {if(typeof popupOptions['sgpb-subs-success-popup']==='undefined'){return false;}
24
- var subPopupId=parseInt(popupOptions['sgpb-subs-success-popup']);var subPopupOptions=SGPBPopup.getPopupOptionsById(subPopupId);var popupObj=new SGPBPopup();popupObj.setPopupId(subPopupId);popupObj.setPopupData(subPopupOptions);setTimeout(function(){popupObj.prepareOpen();},500);};SGPBSubscription.prototype.setSubscriptionCookie=function(popupId)
25
- {var currentUrl=window.location.href;var cookieName=SGPBSubscription.cookieName+popupId;var expiryTime=this.expiryTime;if(SGPopup.getCookie(cookieName)===''){var cookieObject=[currentUrl];SGPBPopup.setCookie(cookieName,JSON.stringify(cookieObject),expiryTime);}};SGPBSubscription.prototype.redirectToURL=function(popupOptions)
26
- {var redirectURL=popupOptions['sgpb-subs-success-redirect-URL'];var redirectToNewTab=popupOptions['sgpb-subs-success-redirect-new-tab'];SGPBPopup.closePopupById(this.submissionPopupId);if(redirectToNewTab){return true;}
27
- window.location.href=redirectURL;};SGPBSubscription.prototype.resetFieldsValues=function()
28
- {if(!jQuery('.js-subs-text-inputs').length){return false;}
29
- jQuery('.js-subs-text-inputs').each(function(){jQuery(this).val('');});};SGPBSubscription.prototype.livePreview=function()
30
- {this.binding();this.changeLabels();this.changeButtonTitle();this.changeColor();this.changeOpacity();this.changePadding();this.changeDimension();this.preventDefaultSubmission();if(typeof SGPBBackend==='function'){SGPBBackend.makeContactAndSubscriptionFieldsRequired();}};SGPBSubscription.prototype.preventDefaultSubmission=function()
31
- {var formSubmitButton=jQuery('.sgpb-subscription-admin-wrapper input[type="submit"]');if(!formSubmitButton.length){return false;}
32
- formSubmitButton.bind('click',function(e){e.preventDefault();});};SGPBSubscription.prototype.changeDimension=function()
33
- {var that=this;jQuery('.js-subs-dimension').change(function(){var element=jQuery(this);var dimension=that.changeDimensionMode(element.val());var styleType=element.attr('data-style-type');var fieldtype=element.attr('data-field-type');var selector=element.attr('data-subs-rel');if(fieldtype==='input'){jQuery('.sgpb-gdpr-label-wrapper').css('width',dimension);jQuery('.sgpb-gdpr-info').css('width',dimension);}
34
- var styleObj={};styleObj[styleType]=dimension;jQuery('.'+selector).css(styleObj);});};SGPBSubscription.prototype.changePadding=function()
35
- {jQuery('.js-sgpb-form-padding').on('change keydown keyup',function(){var padding=jQuery(this).val();jQuery('.sgpb-subscription-admin-wrapper').css('padding',padding+'px');});};SGPBSubscription.prototype.changeColor=function()
36
- {var that=this;if(typeof jQuery.wp==='undefined'||typeof jQuery.wp.wpColorPicker!=='function'){return false;}
37
- jQuery('.js-subs-color-picker').each(function(){var currentColorPicker=jQuery(this);currentColorPicker.wpColorPicker({change:function(){that.colorPickerChange(jQuery(this));}});});jQuery('.wp-picker-holder').mouseover(function(){var selectedInput=jQuery(this).prev().find('.js-subs-color-picker');that.colorPickerChange(selectedInput);});jQuery('.wp-picker-holder').bind('click',function(){var selectedInput=jQuery(this).prev().find('.js-subs-color-picker');that.colorPickerChange(selectedInput);});};SGPBSubscription.prototype.changeOpacity=function()
38
- {var that=this;jQuery('.js-subs-bg-opacity').next().find('.range-handle').on('change mousemove',function(){that.colorPickerChange(jQuery('input[name=sgpb-subs-form-bg-color]'));});};SGPBSubscription.prototype.setupPlaceholderColor=function(element,color)
39
- {jQuery('.'+element).each(function(){jQuery('#sgpb-placeholder-style').remove();var styleContent='.'+element+'::-webkit-input-placeholder {color: '+color+' !important;}';styleContent+='.'+element+'::-moz-placeholder {color: '+color+' !important;}';styleContent+='.'+element+'::-ms-placeholder {color: '+color+' !important;}';var styleBlock='<style id="sgpb-placeholder-style">'+styleContent+'</style>';jQuery('head').append(styleBlock);});};SGPBSubscription.prototype.colorPickerChange=function(colorPicker)
40
- {var that=this;var opacity=jQuery('input[name=sgpb-subs-form-bg-opacity]').val();var colorValue=colorPicker.val();if(typeof colorValue==='undefined'){return false;}
41
- colorValue=SGPBBackend.hexToRgba(colorValue,opacity);var styleType=colorPicker.attr('data-style-type');var selector=colorPicker.attr('data-subs-rel');if('placeholder'===styleType){that.setupPlaceholderColor(selector,colorValue);return false;}
42
- var styleObj={};styleObj[styleType]=colorValue;jQuery('.'+selector).each(function(){jQuery(this).css(styleObj);});};SGPBSubscription.prototype.changeButtonTitle=function()
43
- {jQuery('.js-subs-btn-title').bind('input',function(){var className=jQuery(this).attr('data-subs-rel');var val=jQuery(this).val();jQuery('.'+className).val(val);});};SGPBSubscription.prototype.changeLabels=function()
44
- {jQuery('#sgpb-subs-gdpr-text').on('change',function(){var text=jQuery(this).val();jQuery(this).text('');jQuery(this).text(text);jQuery('.sgpb-gdpr-text-js').html(text);});jQuery('.js-subs-field-placeholder').each(function(){jQuery(this).bind('input',function(){var className=jQuery(this).attr('data-subs-rel');var placeholderText=jQuery(this).val();if(className==='js-subs-gdpr-label'){jQuery('.'+className).next().text(placeholderText);}
45
- else{jQuery('.'+className).attr('placeholder',placeholderText);}});});};SGPBSubscription.prototype.binding=function()
46
- {var that=this;jQuery('.js-checkbox-field-status').bind('click',function(){var isChecked=jQuery(this).is(':checked');var elementClassName=jQuery(this).attr('data-subs-field-wrapper');var element=jQuery('.'+elementClassName);that.toggleVisible(element,isChecked);});jQuery('.js-checkbox-acordion').each(function(){var isChecked=jQuery(this).is(':checked');var elementClassName=jQuery(this).attr('data-subs-rel');var element=jQuery('.'+elementClassName);that.toggleVisible(element,isChecked);});};SGPBSubscription.prototype.toggleVisible=function(toggleElement,elementStatus)
47
- {if(elementStatus){toggleElement.css({'display':'block'});}
48
- else{toggleElement.css({'display':'none'});}};SGPBSubscription.prototype.changeDimensionMode=function(dimension)
49
- {var size;size=parseInt(dimension)+'px';if(dimension.indexOf('%')!==-1||dimension.indexOf('px')!==-1){size=dimension;}
50
- return size;};SGPBSubscription.prototype.allowToOpen=function(popupId)
51
- {var allowStatus=true;var cookieName=SGPBSubscription.cookieName+popupId;if(SGPopup.getCookie(cookieName)!=''){allowStatus=false;}
52
- return allowStatus;};jQuery(document).ready(function(){new SGPBSubscription();});
1
+ function SGPBSubscription(){this.expiryTime=365,this.submissionPopupId=0,this.newWindow=null,this.init()}SGPBSubscription.cookieName="SGPBSubscription",SGPBSubscription.prototype.init=function(){if("undefined"!=typeof SGPBFormBuilder)return!1;this.livePreview(),this.formSubmission()},SGPBSubscription.prototype.formSubmission=function(){var that=this;if("undefined"==typeof sgAddEvent)return!1;sgAddEvent(window,"sgpbDidOpen",function(e){var popupArgs=e.detail,popupId=popupArgs.popupId,popupOptions=SGPBPopup.getPopupOptionsById(popupId),additionalPopupParams={},subscriptionForm=jQuery("#sgpb-popup-dialog-main-div .sgpb-subs-form-"+popupId+" form"),submitButton=subscriptionForm.find(".js-subs-submit-btn"),sgpbSubsValidateObj={};try{sgpbSubsValidateObj=eval("sgpbSubsValidateObj"+popupId)}catch(e){}if("object"!=typeof sgpbSubsValidateObj)return!1;jQuery.validator.setDefaults({errorPlacement:function(e,s){var t=jQuery(s).attr("data-error-message-class");jQuery(".sgpb-subs-form-"+popupId+" ."+t).html(e)}}),sgpbSubsValidateObj.submitHandler=function(){var e=subscriptionForm.serialize(),s={action:"sgpb_subscription_submission",nonce:SGPB_JS_PARAMS.nonce,beforeSend:function(){submitButton.val(submitButton.attr("data-progress-title")),"redirectToURL"===popupOptions["sgpb-subs-success-behavior"]&&popupOptions["sgpb-subs-success-redirect-new-tab"]&&(that.newWindow=window.open(popupOptions["sgpb-subs-success-redirect-URL"]))},formData:e,popupPostId:popupId};jQuery.post(SGPB_JS_PARAMS.ajaxUrl,s,function(e){that.submissionPopupId=popupId,jQuery(".sgpb-subs-form-"+popupId+" .sgpb-alert").addClass("sg-hide-element"),submitButton.val(submitButton.attr("data-title")),additionalPopupParams.res=e,that.showMessages(additionalPopupParams),that.processAfterSuccessfulSubmission(s)})},subscriptionForm.validate(sgpbSubsValidateObj)}),jQuery(window).on("sgpbDidClose",function(e){var s=e.detail.popupId;jQuery(".sgpb-subs-form-"+s+" form label.error").hide()})},SGPBSubscription.prototype.processAfterSuccessfulSubmission=function(e){if(jQuery.isEmptyObject(e))return!1;e.action="sgpb_process_after_submission",jQuery.post(SGPB_JS_PARAMS.ajaxUrl,e,function(e){})},SGPBSubscription.prototype.showMessages=function(e){return 1==e.res?this.subscriptionSuccessBehavior():(null!==this.newWindow&&this.newWindow.close(),this.showErrorMessage()),window.dispatchEvent(new Event("resize")),!0},SGPBSubscription.prototype.showErrorMessage=function(){var e=parseInt(this.submissionPopupId);jQuery(".sgpb-subs-form-"+e+" .sgpb-alert-danger").removeClass("sg-hide-element")},SGPBSubscription.prototype.subscriptionSuccessBehavior=function(){var e={popupId:this.submissionPopupId,eventName:"sgpbSubscriptionSuccess"};jQuery(window).trigger("sgpbFormSuccess",e);var s=parseInt(this.submissionPopupId),t=SGPBPopup.getPopupOptionsById(s),i="showMessage";switch(jQuery(".sgpb-subs-form-"+s+" form").remove(),void 0!==t["sgpb-subs-hide-subs-users"]&&this.setSubscriptionCookie(s),void 0!==t["sgpb-subs-success-behavior"]&&(i=t["sgpb-subs-success-behavior"]),this.resetFieldsValues(),i){case"showMessage":jQuery(".sgpb-subs-form-"+s+" .sgpb-alert-success").removeClass("sg-hide-element");break;case"redirectToURL":this.redirectToURL(t);break;case"openPopup":this.openSuccessPopup(t);break;case"hidePopup":SGPBPopup.closePopupById(this.submissionPopupId)}},SGPBSubscription.prototype.openSuccessPopup=function(e){var s=this;setTimeout(function(){SGPBPopup.closePopupById(s.submissionPopupId)},0),void 0!==e["sgpb-subs-success-popup"]&&sgAddEvent(window,"sgpbDidClose",this.openPopup(e))},SGPBSubscription.prototype.openPopup=function(e){if(void 0===e["sgpb-subs-success-popup"])return!1;var s=parseInt(e["sgpb-subs-success-popup"]),t=SGPBPopup.getPopupOptionsById(s),i=new SGPBPopup;i.setPopupId(s),i.setPopupData(t),setTimeout(function(){i.prepareOpen()},500)},SGPBSubscription.prototype.setSubscriptionCookie=function(e){var s=window.location.href,t=SGPBSubscription.cookieName+e,i=this.expiryTime;if(""===SGPopup.getCookie(t)){var o=[s];SGPBPopup.setCookie(t,JSON.stringify(o),i)}},SGPBSubscription.prototype.redirectToURL=function(e){var s=e["sgpb-subs-success-redirect-URL"],t=e["sgpb-subs-success-redirect-new-tab"];if(SGPBPopup.closePopupById(this.submissionPopupId),t)return!0;window.location.href=s},SGPBSubscription.prototype.resetFieldsValues=function(){if(!jQuery(".js-subs-text-inputs").length)return!1;jQuery(".js-subs-text-inputs").each(function(){jQuery(this).val("")})},SGPBSubscription.prototype.livePreview=function(){this.binding(),this.changeLabels(),this.changeButtonTitle(),this.changeColor(),this.changeOpacity(),this.changePadding(),this.changeDimension(),this.preventDefaultSubmission(),"function"==typeof SGPBBackend&&SGPBBackend.makeContactAndSubscriptionFieldsRequired()},SGPBSubscription.prototype.preventDefaultSubmission=function(){var e=jQuery('.sgpb-subscription-admin-wrapper input[type="submit"]');if(!e.length)return!1;e.bind("click",function(e){e.preventDefault()})},SGPBSubscription.prototype.changeDimension=function(){var e=this;jQuery(".js-subs-dimension").change(function(){var s=jQuery(this),t=e.changeDimensionMode(s.val()),i=s.attr("data-style-type"),o=s.attr("data-field-type"),r=s.attr("data-subs-rel");"input"===o&&(jQuery(".sgpb-gdpr-label-wrapper").css("width",t),jQuery(".sgpb-gdpr-info").css("width",t));var p={};p[i]=t,jQuery("."+r).css(p)})},SGPBSubscription.prototype.changePadding=function(){jQuery(".js-sgpb-form-padding").on("change keydown keyup",function(){var e=jQuery(this).val();jQuery(".sgpb-subscription-admin-wrapper").css("padding",e+"px")})},SGPBSubscription.prototype.changeColor=function(){var e=this;if(void 0===jQuery.wp||"function"!=typeof jQuery.wp.wpColorPicker)return!1;jQuery(".js-subs-color-picker").each(function(){jQuery(this).wpColorPicker({change:function(){e.colorPickerChange(jQuery(this))}})}),jQuery(".wp-picker-holder").mouseover(function(){var s=jQuery(this).prev().find(".js-subs-color-picker");e.colorPickerChange(s)}),jQuery(".wp-picker-holder").bind("click",function(){var s=jQuery(this).prev().find(".js-subs-color-picker");e.colorPickerChange(s)})},SGPBSubscription.prototype.changeOpacity=function(){var e=this;jQuery(".js-subs-bg-opacity").next().find(".range-handle").on("change mousemove",function(){e.colorPickerChange(jQuery("input[name=sgpb-subs-form-bg-color]"))})},SGPBSubscription.prototype.setupPlaceholderColor=function(e,s){jQuery("."+e).each(function(){jQuery("#sgpb-placeholder-style").remove();var t="."+e+"::-webkit-input-placeholder {color: "+s+" !important;}";t+="."+e+"::-moz-placeholder {color: "+s+" !important;}";var i='<style id="sgpb-placeholder-style">'+(t+="."+e+"::-ms-placeholder {color: "+s+" !important;}")+"</style>";jQuery("head").append(i)})},SGPBSubscription.prototype.colorPickerChange=function(e){var s=jQuery("input[name=sgpb-subs-form-bg-opacity]").val(),t=e.val();if(void 0===t)return!1;t=SGPBBackend.hexToRgba(t,s);var i=e.attr("data-style-type"),o=e.attr("data-subs-rel");if("placeholder"===i)return this.setupPlaceholderColor(o,t),!1;var r={};r[i]=t,jQuery("."+o).each(function(){jQuery(this).css(r)})},SGPBSubscription.prototype.changeButtonTitle=function(){jQuery(".js-subs-btn-title").bind("input",function(){var e=jQuery(this).attr("data-subs-rel"),s=jQuery(this).val();jQuery("."+e).val(s)})},SGPBSubscription.prototype.changeLabels=function(){jQuery("#sgpb-subs-gdpr-text").on("change",function(){var e=jQuery(this).val();jQuery(this).text(""),jQuery(this).text(e),jQuery(".sgpb-gdpr-text-js").html(e)}),jQuery(".js-subs-field-placeholder").each(function(){jQuery(this).bind("input",function(){var e=jQuery(this).attr("data-subs-rel"),s=jQuery(this).val();"js-subs-gdpr-label"===e?jQuery("."+e).next().text(s):jQuery("."+e).attr("placeholder",s)})})},SGPBSubscription.prototype.binding=function(){var e=this;jQuery(".js-checkbox-field-status").bind("click",function(){var s=jQuery(this).is(":checked"),t=jQuery(this).attr("data-subs-field-wrapper"),i=jQuery("."+t);e.toggleVisible(i,s)}),jQuery(".js-checkbox-acordion").each(function(){var s=jQuery(this).is(":checked"),t=jQuery(this).attr("data-subs-rel"),i=jQuery("."+t);e.toggleVisible(i,s)})},SGPBSubscription.prototype.toggleVisible=function(e,s){s?e.css({display:"block"}):e.css({display:"none"})},SGPBSubscription.prototype.changeDimensionMode=function(e){var s;return s=parseInt(e)+"px",-1===e.indexOf("%")&&-1===e.indexOf("px")||(s=e),s},SGPBSubscription.prototype.allowToOpen=function(e){var s=!0,t=SGPBSubscription.cookieName+e;return""!=SGPopup.getCookie(t)&&(s=!1),s},jQuery(document).ready(function(){new SGPBSubscription});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -9,7 +9,7 @@ Tags: popup, pop up, wordpress popup, popup maker, exit popup, popup builder, wo
9
  Requires at least: 4.2
10
  Tested up to: 5.5
11
  Requires PHP: 5.3.3
12
- Stable tag: 3.68.5.1
13
  License: GPLv2 or later
14
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
15
 
9
  Requires at least: 4.2
10
  Tested up to: 5.5
11
  Requires PHP: 5.3.3
12
+ Stable tag: 3.68.5.2
13
  License: GPLv2 or later
14
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
15