|
@@ -157,7 +157,7 @@ function isDynamicStagPopupPresent() {
|
|
if(popup.is('.dynamic-popup')) return true;
|
|
if(popup.is('.dynamic-popup')) return true;
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-function refreshDynamicStagPopup(_url = false) {
|
|
|
|
|
|
+function refreshDynamicStagPopup(_url = false, _target = null) {
|
|
if(!stagPopupsQueue.length) return false;
|
|
if(!stagPopupsQueue.length) return false;
|
|
let popup = stagPopupsQueue[stagPopupsQueue.length - 1];
|
|
let popup = stagPopupsQueue[stagPopupsQueue.length - 1];
|
|
if(popup.is('.dynamic-popup')) {
|
|
if(popup.is('.dynamic-popup')) {
|
|
@@ -169,7 +169,31 @@ function refreshDynamicStagPopup(_url = false) {
|
|
let url = popup.attr('stag-popup-key'),
|
|
let url = popup.attr('stag-popup-key'),
|
|
initer = popup.attr('mc-initer');
|
|
initer = popup.attr('mc-initer');
|
|
$.get(url, (_data) => {
|
|
$.get(url, (_data) => {
|
|
- popup.find('.stag-popup-content-inner').html(_data);
|
|
|
|
|
|
+ if(_target) {
|
|
|
|
+ _data = '<div>' + _data + '</div>';
|
|
|
|
+ _target = _target.split(',').map(_x => $.trim(_x));
|
|
|
|
+ for (let i = 0; i < _target.length; i++) {
|
|
|
|
+ let t = _target[i];
|
|
|
|
+ let targetElement = $(t).first();
|
|
|
|
+ if(targetElement.length) {
|
|
|
|
+ let sourceElement = $(_data).find(t).first();
|
|
|
|
+ if (sourceElement && sourceElement.length) {
|
|
|
|
+ targetElement.html(sourceElement.html());
|
|
|
|
+ initFastLoad(targetElement);
|
|
|
|
+ console.log('Replaced ' + t);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ console.warn(t + ' not found in returned content');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ console.warn(t + ' not found in existing content');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ popup.find('.stag-popup-content-inner').html(_data);
|
|
|
|
+ }
|
|
convertContentLinksForInPopupNavigation(popup);
|
|
convertContentLinksForInPopupNavigation(popup);
|
|
if(initer) runMCInitializer(initer);
|
|
if(initer) runMCInitializer(initer);
|
|
runMCInitializer('pro-suggest');
|
|
runMCInitializer('pro-suggest');
|