From 8c202251ca2500d22db10cb032b67b45bef07dd2 Mon Sep 17 00:00:00 2001 From: Stefan Neculai Date: Tue, 11 Sep 2018 15:50:19 +0000 Subject: [PATCH] Fix possible XSS in data attribute. --- js/froala_editor.min.js | 2 +- js/froala_editor.pkgd.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/froala_editor.min.js b/js/froala_editor.min.js index b3bae5132..1b6cff911 100644 --- a/js/froala_editor.min.js +++ b/js/froala_editor.min.js @@ -4,4 +4,4 @@ * Copyright 2014-2018 Froala Labs */ -!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t)}:n(window.jQuery)}(function(M){var s=function(e,t){this.id=++M.FE.ID,this.opts=M.extend(!0,{},M.extend({},s.DEFAULTS,"object"==typeof t&&t));var n=JSON.stringify(this.opts);M.FE.OPTS_MAPPING[n]=M.FE.OPTS_MAPPING[n]||this.id,this.sid=M.FE.OPTS_MAPPING[n],M.FE.SHARED[this.sid]=M.FE.SHARED[this.sid]||{},this.shared=M.FE.SHARED[this.sid],this.shared.count=(this.shared.count||0)+1,this.$oel=M(e),this.$oel.data("froala.editor",this),this.o_doc=e.ownerDocument,this.o_win="defaultView"in this.o_doc?this.o_doc.defaultView:this.o_doc.parentWindow;var r=M(this.o_win).scrollTop();this.$oel.on("froala.doInit",M.proxy(function(){this.$oel.off("froala.doInit"),this.doc=this.$el.get(0).ownerDocument,this.win="defaultView"in this.doc?this.doc.defaultView:this.doc.parentWindow,this.$doc=M(this.doc),this.$win=M(this.win),this.opts.pluginsEnabled||(this.opts.pluginsEnabled=Object.keys(M.FE.PLUGINS)),this.opts.initOnClick?(this.load(M.FE.MODULES),this.$el.on("touchstart.init",function(){M(this).data("touched",!0)}),this.$el.on("touchmove.init",function(){M(this).removeData("touched")}),this.$el.on("mousedown.init touchend.init dragenter.init focus.init",M.proxy(function(e){if("touchend"==e.type&&!this.$el.data("touched"))return!0;if(1===e.which||!e.which){this.$el.off("mousedown.init touchstart.init touchmove.init touchend.init dragenter.init focus.init"),this.load(M.FE.MODULES),this.load(M.FE.PLUGINS);var t=e.originalEvent&&e.originalEvent.originalTarget;t&&"IMG"==t.tagName&&M(t).trigger("mousedown"),"undefined"==typeof this.ul&&this.destroy(),"touchend"==e.type&&this.image&&e.originalEvent&&e.originalEvent.target&&M(e.originalEvent.target).is("img")&&setTimeout(M.proxy(function(){this.image.edit(M(e.originalEvent.target))},this),100),this.ready=!0,this.events.trigger("initialized")}},this)),this.events.trigger("initializationDelayed")):(this.load(M.FE.MODULES),this.load(M.FE.PLUGINS),M(this.o_win).scrollTop(r),"undefined"==typeof this.ul&&this.destroy(),this.ready=!0,this.events.trigger("initialized"))},this)),this._init()};s.DEFAULTS={initOnClick:!1,pluginsEnabled:null},s.MODULES={},s.PLUGINS={},s.VERSION="2.8.5",s.INSTANCES=[],s.OPTS_MAPPING={},s.SHARED={},s.ID=0,s.prototype._init=function(){var e=this.$oel.prop("tagName");this.$oel.closest("label").length;var t=M.proxy(function(){"TEXTAREA"!=e&&(this._original_html=this._original_html||this.$oel.html()),this.$box=this.$box||this.$oel,this.opts.fullPage&&(this.opts.iframe=!0),this.opts.iframe?(this.$iframe=M('',provider:"youtube"},{test_regex:/^.*(?:vimeo.com)\/(?:channels(\/\w+\/)?|groups\/*\/videos\/\u200b\d+\/|video\/|)(\d+)(?:$|\/|\?)/,url_regex:/(?:https?:\/\/)?(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:[a-zA-Z0-9_\-]+)?(\/[a-zA-Z0-9_\-]+)?/i,url_text:"https://player.vimeo.com/video/$1",html:'',provider:"vimeo"},{test_regex:/^.+(dailymotion.com|dai.ly)\/(video|hub)?\/?([^_]+)[^#]*(#video=([^_&]+))?/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:dailymotion\.com|dai\.ly)\/(?:video|hub)?\/?(.+)/g,url_text:"https://www.dailymotion.com/embed/video/$1",html:'',provider:"dailymotion"},{test_regex:/^.+(screen.yahoo.com)\/[^_&]+/,url_regex:"",url_text:"",html:'',provider:"yahoo"},{test_regex:/^.+(rutube.ru)\/[^_&]+/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:rutube\.ru)\/(?:video)?\/?(.+)/g,url_text:"https://rutube.ru/play/embed/$1",html:'',provider:"rutube"},{test_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/,url_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/g,url_text:"https://play.vidyard.com/$1",html:'',provider:"vidyard"}],be.FE.VIDEO_EMBED_REGEX=/^\W*((<\/iframe>)|())\W*$/i,be.FE.PLUGINS.video=function(f){var s,c,p,u,r,n,d="https://i.froala.com/upload",l=2,h=3,g=4,m=5,v=6,i={};function E(){var e=f.popups.get("video.insert");e.find(".fr-video-by-url-layer input").val("").trigger("change");var t=e.find(".fr-video-embed-layer textarea");t.val("").trigger("change"),(t=e.find(".fr-video-upload-layer input")).val("").trigger("change")}function a(){var e=f.popups.get("video.edit");if(e||(e=function(){var e="";if(0',e+=f.button.buildList(f.opts.videoEditButtons);var t={buttons:e+=""},n=f.popups.create("video.edit",t);return f.events.$on(f.$wp,"scroll.video-edit",function(){u&&f.popups.isVisible("video.edit")&&(f.events.disableBlur(),y(u))}),n}return!1}()),e){f.popups.setContainer("video.edit",f.$sc),f.popups.refresh("video.edit");var t=u.find("iframe, embed, video"),n=t.offset().left+t.outerWidth()/2,r=t.offset().top+t.outerHeight();f.popups.show("video.edit",n,r,t.outerHeight())}}function o(e){if(e)return f.popups.onRefresh("video.insert",E),f.popups.onHide("image.insert",V),!0;var t="";f.opts.videoUpload||f.opts.videoInsertButtons.splice(f.opts.videoInsertButtons.indexOf("videoUpload"),1),1'+f.button.buildList(f.opts.videoInsertButtons)+"");var n,r="",i=f.opts.videoInsertButtons.indexOf("videoUpload"),a=f.opts.videoInsertButtons.indexOf("videoByURL"),o=f.opts.videoInsertButtons.indexOf("videoEmbed");0<=a&&(n=" fr-active",(i
");var s="";0<=o&&(n=" fr-active",(i
");var l="";0<=i&&(n=" fr-active",(o'+f.language.translate("Drop video")+"
("+f.language.translate("or click")+')
');var d={buttons:t,by_url_layer:r,embed_layer:s,upload_layer:l,progress_bar:'

Uploading

'},c=f.popups.create("video.insert",d);return function(r){f.events.$on(r,"dragover dragenter",".fr-video-upload-layer",function(){return be(this).addClass("fr-drop"),!1},!0),f.events.$on(r,"dragleave dragend",".fr-video-upload-layer",function(){return be(this).removeClass("fr-drop"),!1},!0),f.events.$on(r,"drop",".fr-video-upload-layer",function(e){e.preventDefault(),e.stopPropagation(),be(this).removeClass("fr-drop");var t=e.originalEvent.dataTransfer;if(t&&t.files){var n=r.data("instance")||f;n.events.disableBlur(),n.video.upload(t.files),n.events.enableBlur()}},!0),f.helpers.isIOS()&&f.events.$on(r,"touchstart",'.fr-video-upload-layer input[type="file"]',function(){be(this).trigger("click")},!0);f.events.$on(r,"change",'.fr-video-upload-layer input[type="file"]',function(){if(this.files){var e=r.data("instance")||f;e.events.disableBlur(),r.find("input:focus").blur(),e.events.enableBlur(),e.video.upload(this.files)}be(this).val("")},!0)}(c),c}function b(e){f.events.focus(!0),f.selection.restore();var t=!1;u&&(G(),t=!0),f.html.insert(''+e+"",!1,f.opts.videoSplitHTML),f.popups.hide("video.insert");var n=f.$el.find(".fr-jiv");n.removeClass("fr-jiv"),X(n,f.opts.videoDefaultDisplay,f.opts.videoDefaultAlign),n.toggleClass("fr-draggable",f.opts.videoMove),f.events.trigger(t?"video.replaced":"video.inserted",[n])}function T(){var e=be(this);f.popups.hide("video.insert"),e.removeClass("fr-uploading"),e.parent().next().is("br")&&e.parent().next().remove(),y(e.parent()),f.events.trigger("video.loaded",[e.parent()])}function A(s,e,l,d,c){f.edit.off(),R("Loading video"),e&&(s=f.helpers.sanitizeURL(s));C("Loading video"),function(){var e,t;if(d){f.undo.canDo()||d.find("video").hasClass("fr-uploading")||f.undo.saveStep();var n=d.find("video").data("fr-old-src"),r=d.data("fr-replaced");d.data("fr-replaced",!1),f.$wp?((e=d.clone()).find("video").removeData("fr-old-src").removeClass("fr-uploading"),e.find("video").off("canplay"),n&&d.find("video").attr("src",n),d.replaceWith(e)):e=d;for(var i=e.find("video").get(0).attributes,a=0;a");o.toggleClass("fr-draggable",f.opts.videoMove),f.edit.on(),f.events.focus(!0),f.selection.restore(),f.undo.saveStep(),f.opts.videoSplitHTML?f.markers.split():f.markers.insert(),f.html.wrap();var s=f.$el.find(".fr-marker");return f.node.isLastSibling(s)&&s.parent().hasClass("fr-deletable")&&s.insertAfter(s.parent()),s.replaceWith(o),f.selection.clear(),o.find("video").get(0).readyState>o.find("video").get(0).HAVE_FUTURE_DATA||f.helpers.isIOS()?n.call(o.find("video").get(0)):o.find("video").on("canplaythrough load",n),o}(s,l,T),k(),f.undo.saveStep(),f.events.trigger("video.inserted",[e,c])}()}function C(e){var t=f.popups.get("video.insert");if(t||(t=o()),t.find(".fr-layer.fr-active").removeClass("fr-active").addClass("fr-pactive"),t.find(".fr-video-progress-bar-layer").addClass("fr-active"),t.find(".fr-buttons").hide(),u){var n=u.find("video");f.popups.setContainer("video.insert",f.$sc);var r=n.offset().left+n.width()/2,i=n.offset().top+n.height();f.popups.show("video.insert",r,i,n.outerHeight())}void 0===e&&R(f.language.translate("Uploading"),0)}function S(e){var t=f.popups.get("video.insert");if(t&&(t.find(".fr-layer.fr-pactive").addClass("fr-active").removeClass("fr-pactive"),t.find(".fr-video-progress-bar-layer").removeClass("fr-active"),t.find(".fr-buttons").show(),e||f.$el.find("video.fr-error").length)){if(f.events.focus(),f.$el.find("video.fr-error").length&&(f.$el.find("video.fr-error").parent().remove(),f.undo.saveStep(),f.undo.run(),f.undo.dropRedo()),!f.$wp&&u){var n=u;$(!0),f.selection.setAfter(n.find("video").get(0)),f.selection.restore()}f.popups.hide("video.insert")}}function R(e,t){var n=f.popups.get("video.insert");if(n){var r=n.find(".fr-video-progress-bar-layer");r.find("h3").text(e+(t?" "+t+"%":"")),r.removeClass("fr-error"),t?(r.find("div").removeClass("fr-indeterminate"),r.find("div > span").css("width",t+"%")):r.find("div").addClass("fr-indeterminate")}}function y(e){M.call(e.get(0))}function _(e){R("Loading video");var t=this.status,n=this.response,r=this.responseXML,i=this.responseText;try{if(f.opts.videoUploadToS3)if(201==t){var a=function(e){try{var t=be(e).find("Location").text(),n=be(e).find("Key").text();return!1===f.events.trigger("video.uploadedToS3",[t,n,e],!0)?(f.edit.on(),!1):t}catch(r){return K(g,e),!1}}(r);a&&A(a,!1,[],e,n||r)}else K(g,n||r);else if(200<=t&&t<300){var o=function(e){try{if(!1===f.events.trigger("video.uploaded",[e],!0))return f.edit.on(),!1;var t=JSON.parse(e);return t.link?t:(K(l,e),!1)}catch(n){return K(g,e),!1}}(i);o&&A(o.link,!1,o,e,n||i)}else K(h,n||i)}catch(s){K(g,n||i)}}function L(){K(g,this.response||this.responseText||this.responseXML)}function x(e){if(e.lengthComputable){var t=e.loaded/e.total*100|0;R(f.language.translate("Uploading"),t)}}function N(){f.edit.on(),S(!0)}function w(e){if(!f.core.sameInstance(p))return!0;e.preventDefault(),e.stopPropagation();var t=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null),n=e.pageY||(e.originalEvent.touches?e.originalEvent.touches[0].pageY:null);if(!t||!n)return!1;if("mousedown"==e.type){var r=f.$oel.get(0).ownerDocument,i=r.defaultView||r.parentWindow,a=!1;try{a=i.location!=i.parent.location&&!(i.$&&i.$.FE)}catch(o){}a&&i.frameElement&&(t+=f.helpers.getPX(be(i.frameElement).offset().left)+i.frameElement.clientLeft,n=e.clientY+f.helpers.getPX(be(i.frameElement).offset().top)+i.frameElement.clientTop)}f.undo.canDo()||f.undo.saveStep(),(c=be(this)).data("start-x",t),c.data("start-y",n),s.show(),f.popups.hideAll(),B()}function O(e){if(!f.core.sameInstance(p))return!0;if(c){e.preventDefault();var t=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null),n=e.pageY||(e.originalEvent.touches?e.originalEvent.touches[0].pageY:null);if(!t||!n)return!1;var r=c.data("start-x"),i=c.data("start-y");c.data("start-x",t),c.data("start-y",n);var a=t-r,o=n-i,s=u.find("iframe, embed, video"),l=s.width(),d=s.height();(c.hasClass("fr-hnw")||c.hasClass("fr-hsw"))&&(a=0-a),(c.hasClass("fr-hnw")||c.hasClass("fr-hne"))&&(o=0-o),s.css("width",l+a),s.css("height",d+o),s.removeAttr("width"),s.removeAttr("height"),F()}}function I(e){if(!f.core.sameInstance(p))return!0;c&&u&&(e&&e.stopPropagation(),c=null,s.hide(),F(),a(),f.undo.saveStep())}function t(e){return'
'}function D(e,t,n,r){return e.pageX=t,e.pageY=t,w.call(this,e),e.pageX=e.pageX+n*Math.floor(Math.pow(1.1,r)),e.pageY=e.pageY+n*Math.floor(Math.pow(1.1,r)),O.call(this,e),I.call(this,e),++r}function k(){var e,t=Array.prototype.slice.call(f.el.querySelectorAll("video, .fr-video > *")),n=[];for(e=0;e'),p=f.shared.$video_resizer,f.events.$on(p,"mousedown",function(e){e.stopPropagation()},!0),f.opts.videoResize&&(p.append(t("nw")+t("ne")+t("sw")+t("se")),f.shared.$vid_overlay=be('
'),s=f.shared.$vid_overlay,e=p.get(0).ownerDocument,be(e).find("body:first").append(s))),f.events.on("shared.destroy",function(){p.html("").removeData().remove(),p=null,f.opts.videoResize&&(s.remove(),s=null)},!0),f.helpers.isMobile()||f.events.$on(be(f.o_win),"resize.video",function(){$(!0)}),f.opts.videoResize){e=p.get(0).ownerDocument,f.events.$on(p,f._mousedown,".fr-handler",w),f.events.$on(be(e),f._mousemove,O),f.events.$on(be(e.defaultView||e.parentWindow),f._mouseup,I),f.events.$on(s,"mouseleave",I);var r=1,i=null,a=0;f.events.on("keydown",function(e){if(u){var t=-1!=navigator.userAgent.indexOf("Mac OS X")?e.metaKey:e.ctrlKey,n=e.which;(n!==i||200f.opts.videoMaxSize)return K(m),!1;if(f.opts.videoAllowedTypes.indexOf(n.type.replace(/video\//g,""))<0)return K(v),!1;if(f.drag_support.formdata&&(t=f.drag_support.formdata?new FormData:null),t){var r;if(!1!==f.opts.videoUploadToS3)for(r in t.append("key",f.opts.videoUploadToS3.keyStart+(new Date).getTime()+"-"+(n.name||"untitled")),t.append("success_action_status","201"),t.append("X-Requested-With","xhr"),t.append("Content-Type",n.type),f.opts.videoUploadToS3.params)f.opts.videoUploadToS3.params.hasOwnProperty(r)&&t.append(r,f.opts.videoUploadToS3.params[r]);for(r in f.opts.videoUploadParams)f.opts.videoUploadParams.hasOwnProperty(r)&&t.append(r,f.opts.videoUploadParams[r]);t.append(f.opts.videoUploadParam,n);var i=f.opts.videoUploadURL;f.opts.videoUploadToS3&&(i=f.opts.videoUploadToS3.uploadURL?f.opts.videoUploadToS3.uploadURL:"https://"+f.opts.videoUploadToS3.region+".amazonaws.com/"+f.opts.videoUploadToS3.bucket);var a=f.core.getXHR(i,f.opts.videoUploadMethod);a.onload=function(){_.call(a,u)},a.onerror=L,a.upload.onprogress=x,a.onabort=N,C(),f.events.disableBlur(),f.edit.off(),f.events.enableBlur();var o=f.popups.get("video.insert");o&&o.off("abortUpload").on("abortUpload",function(){4!=a.readyState&&a.abort()}),a.send(t)}}var s,l}function K(e,t){f.edit.on(),u&&u.find("video").addClass("fr-error"),function(e){C();var t=f.popups.get("video.insert").find(".fr-video-progress-bar-layer");t.addClass("fr-error");var n=t.find("h3");n.text(e),f.events.disableBlur(),n.focus()}(f.language.translate("Something went wrong. Please try again.")),f.events.trigger("video.error",[{code:e,message:i[e]},t])}function H(){if(u){var e=f.popups.get("video.size"),t=u.find("iframe, embed, video");e.find('input[name="width"]').val(t.get(0).style.width||t.attr("width")).trigger("change"),e.find('input[name="height"]').val(t.get(0).style.height||t.attr("height")).trigger("change")}}function W(e){if(e)return f.popups.onRefresh("video.size",H),!0;var t={buttons:'
'+f.button.buildList(f.opts.videoSizeButtons)+"
",size_layer:'
"},n=f.popups.create("video.size",t);return f.events.$on(f.$wp,"scroll",function(){u&&f.popups.isVisible("video.size")&&(f.events.disableBlur(),y(u))}),n}function z(e){if(void 0===e&&(e=u),e){if(e.hasClass("fr-fvl"))return"left";if(e.hasClass("fr-fvr"))return"right";if(e.hasClass("fr-dvb")||e.hasClass("fr-dvi"))return"center";if("block"==e.css("display")){if("left"==e.css("text-algin"))return"left";if("right"==e.css("text-align"))return"right"}else{if("left"==e.css("float"))return"left";if("right"==e.css("float"))return"right"}}return"center"}function Y(e){void 0===e&&(e=u);var t=e.css("float");return e.css("float","none"),"block"==e.css("display")?(e.css("float",""),e.css("float")!=t&&e.css("float",t),"block"):(e.css("float",""),e.css("float")!=t&&e.css("float",t),"inline")}function G(){if(u&&!1!==f.events.trigger("video.beforeRemove",[u])){var e=u;f.popups.hideAll(),$(!0),f.selection.setBefore(e.get(0))||f.selection.setAfter(e.get(0)),e.remove(),f.selection.restore(),f.html.fillEmptyBlocks(),f.events.trigger("video.removed",[e])}}function V(){S()}function X(e,t,n){!f.opts.htmlUntouched&&f.opts.useClasses?(e.removeClass("fr-fvl fr-fvr fr-dvb fr-dvi"),e.addClass("fr-fv"+n[0]+" fr-dv"+t[0])):"inline"==t?(e.css({display:"inline-block"}),"center"==n?e.css({"float":"none"}):"left"==n?e.css({"float":"left"}):e.css({"float":"right"})):(e.css({display:"block",clear:"both"}),"left"==n?e.css({textAlign:"left"}):"right"==n?e.css({textAlign:"right"}):e.css({textAlign:"center"}))}function q(){f.$el.find("video").filter(function(){return 0===be(this).parents("span.fr-video").length}).wrap(''),f.$el.find("embed, iframe").filter(function(){if(f.browser.safari&&this.getAttribute("src")&&this.setAttribute("src",this.src),0');for(var e,t,n=f.$el.find("span.fr-video, video"),r=0;r *:first").replaceWith(f.icon.create("video-align-"+z()))},refreshAlignOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+z()+'"]').addClass("fr-active").attr("aria-selected",!0)},display:function(e){u.removeClass("fr-dvi fr-dvb"),!f.opts.htmlUntouched&&f.opts.useClasses?"inline"==e?u.addClass("fr-dvi"):"block"==e&&u.addClass("fr-dvb"):X(u,e,z()),j(),F(),a(),f.selection.clear()},refreshDisplayOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+Y()+'"]').addClass("fr-active").attr("aria-selected",!0)},remove:G,hideProgressBar:S,showSizePopup:function(){var e=f.popups.get("video.size");e||(e=W()),S(),f.popups.refresh("video.size"),f.popups.setContainer("video.size",f.$sc);var t=u.find("iframe, embed, video"),n=t.offset().left+t.width()/2,r=t.offset().top+t.height();f.popups.show("video.size",n,r,t.height())},replace:function(){var e=f.popups.get("video.insert");e||(e=o()),f.popups.isVisible("video.insert")||(S(),f.popups.refresh("video.insert"),f.popups.setContainer("video.insert",f.$sc));var t=u.offset().left+u.width()/2,n=u.offset().top+u.height();f.popups.show("video.insert",t,n,u.outerHeight())},back:function(){u?(f.events.disableBlur(),u.trigger("click")):(f.events.disableBlur(),f.selection.restore(),f.events.enableBlur(),f.popups.hide("video.insert"),f.toolbar.showInline())},setSize:function(e,t){if(u){var n=f.popups.get("video.size"),r=u.find("iframe, embed, video");r.css("width",e||n.find('input[name="width"]').val()),r.css("height",t||n.find('input[name="height"]').val()),r.get(0).style.width&&r.removeAttr("width"),r.get(0).style.height&&r.removeAttr("height"),n.find("input:focus").blur(),setTimeout(function(){u.trigger("click")},f.helpers.isAndroid()?50:0)}},get:function(){return u}}},be.FE.RegisterCommand("insertVideo",{title:"Insert Video",undo:!1,focus:!0,refreshAfterCallback:!1,popup:!0,callback:function(){this.popups.isVisible("video.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("video.insert")):this.video.showInsertPopup()},plugin:"video"}),be.FE.DefineIcon("insertVideo",{NAME:"video-camera",FA5NAME:"camera"}),be.FE.DefineIcon("videoByURL",{NAME:"link"}),be.FE.RegisterCommand("videoByURL",{title:"By URL",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-by-url")},refresh:function(e){this.video.refreshByURLButton(e)}}),be.FE.DefineIcon("videoEmbed",{NAME:"code"}),be.FE.RegisterCommand("videoEmbed",{title:"Embedded Code",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-embed")},refresh:function(e){this.video.refreshEmbedButton(e)}}),be.FE.DefineIcon("videoUpload",{NAME:"upload"}),be.FE.RegisterCommand("videoUpload",{title:"Upload Video",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-upload")},refresh:function(e){this.video.refreshUploadButton(e)}}),be.FE.RegisterCommand("videoInsertByURL",{undo:!0,focus:!0,callback:function(){this.video.insertByURL()}}),be.FE.RegisterCommand("videoInsertEmbed",{undo:!0,focus:!0,callback:function(){this.video.insertEmbed()}}),be.FE.DefineIcon("videoDisplay",{NAME:"star"}),be.FE.RegisterCommand("videoDisplay",{title:"Display",type:"dropdown",options:{inline:"Inline",block:"Break Text"},callback:function(e,t){this.video.display(t)},refresh:function(e){this.opts.videoTextNear||e.addClass("fr-hidden")},refreshOnShow:function(e,t){this.video.refreshDisplayOnShow(e,t)}}),be.FE.DefineIcon("video-align",{NAME:"align-left"}),be.FE.DefineIcon("video-align-left",{NAME:"align-left"}),be.FE.DefineIcon("video-align-right",{NAME:"align-right"}),be.FE.DefineIcon("video-align-center",{NAME:"align-justify"}),be.FE.DefineIcon("videoAlign",{NAME:"align-center"}),be.FE.RegisterCommand("videoAlign",{type:"dropdown",title:"Align",options:{left:"Align Left",center:"None",right:"Align Right"},html:function(){var e='"},callback:function(e,t){this.video.align(t)},refresh:function(e){this.video.refreshAlign(e)},refreshOnShow:function(e,t){this.video.refreshAlignOnShow(e,t)}}),be.FE.DefineIcon("videoReplace",{NAME:"exchange",FA5NAME:"exchange-alt"}),be.FE.RegisterCommand("videoReplace",{title:"Replace",undo:!1,focus:!1,popup:!0,refreshAfterCallback:!1,callback:function(){this.video.replace()}}),be.FE.DefineIcon("videoRemove",{NAME:"trash"}),be.FE.RegisterCommand("videoRemove",{title:"Remove",callback:function(){this.video.remove()}}),be.FE.DefineIcon("videoSize",{NAME:"arrows-alt"}),be.FE.RegisterCommand("videoSize",{undo:!1,focus:!1,popup:!0,title:"Change Size",callback:function(){this.video.showSizePopup()}}),be.FE.DefineIcon("videoBack",{NAME:"arrow-left"}),be.FE.RegisterCommand("videoBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.video.back()},refresh:function(e){this.video.get()||this.opts.toolbarInline?(e.removeClass("fr-hidden"),e.next(".fr-separator").removeClass("fr-hidden")):(e.addClass("fr-hidden"),e.next(".fr-separator").addClass("fr-hidden"))}}),be.FE.RegisterCommand("videoDismissError",{title:"OK",undo:!1,callback:function(){this.video.hideProgressBar(!0)}}),be.FE.RegisterCommand("videoSetSize",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.video.setSize()}}),be.extend(be.FE.DEFAULTS,{wordDeniedTags:[],wordDeniedAttrs:[],wordAllowedStyleProps:["font-family","font-size","background","color","width","text-align","vertical-align","background-color","padding","margin","height","margin-top","margin-left","margin-right","margin-bottom","text-decoration","font-weight","font-style","text-indent"],wordPasteModal:!0,wordPasteKeepFormatting:!0}),be.FE.PLUGINS.wordPaste=function(T){var a,r,o="word_paste";function t(e){var t=T.opts.wordAllowedStyleProps;e||(T.opts.wordAllowedStyleProps=[]),0===r.indexOf("")&&(r=""+r+"
"),r=function(e,t){0<=e.indexOf("]*(]*>[.\s\S\w\W<>]*<\/html>)[.\s\S\w\W<>]*/i,"$1"));!function(e){for(var t=e.split("v:shape"),n=1;n').remove()}}(e,t),!0});for(var a=i.querySelectorAll("ul > ul, ul > ol, ol > ul, ol > ol"),s=a.length-1;0<=s;s--)a[s].previousElementSibling&&"LI"===a[s].previousElementSibling.tagName&&a[s].previousElementSibling.appendChild(a[s]);c(i,function(t){if(t.nodeType==Node.TEXT_NODE)return t.data=t.data.replace(/
(\n|\r)/gi,"
"),!1;if(t.nodeType==Node.ELEMENT_NODE){if(C(t)){var n=t.parentNode,r=t.previousSibling,i=function e(t,n){var r=/[0-9a-zA-Z]./gi;var i=!1;t.firstElementChild&&t.firstElementChild.firstElementChild&&t.firstElementChild.firstElementChild.firstChild&&!(i=i||r.test(t.firstElementChild.firstElementChild.firstChild.data||""))&&t.firstElementChild.firstElementChild.firstElementChild&&t.firstElementChild.firstElementChild.firstElementChild.firstChild&&(i=i||r.test(t.firstElementChild.firstElementChild.firstElementChild.firstChild.data||""));var a=i?"ol":"ul";var o=g(t);var s="<"+a+">
  • "+m(t,n);var l=t.nextElementSibling;var d=t.parentNode;A(t);t=null;for(;l&&C(l);){var c=l.previousElementSibling,f=g(l);if(o
  • "+m(l,n)}if(o=f,l.previousElementSibling||l.nextElementSibling||l.parentNode){var p=l;l=l.nextElementSibling,A(p),p=null}else l=c?c.nextElementSibling:d.firstElementChild}s+="
  • ";var u=document.createElement("div");u.innerHTML=s;var h=u.firstElementChild;return h}(t,o),a=null;return(a=r?r.nextSibling:n.firstChild)?n.insertBefore(i,a):n.appendChild(i),!1}return p(t,o)}return t.nodeType!=Node.COMMENT_NODE||(A(t),!1)}),c(i,function(e){if(e.nodeType==Node.ELEMENT_NODE){var t=e.tagName;if(!e.innerHTML&&-1==["BR","IMG"].indexOf(t)){for(var n=e.parentNode;n&&(A(e),!(e=n).innerHTML);)n=e.parentNode;return!1}!function(e){var t=e.getAttribute("style");if(!t)return;(t=R(t))&&";"!=t.slice(-1)&&(t+=";");var n=t.match(/(^|\S+?):.+?;{1,1}/gi);if(!n)return;for(var r={},i=0;i([\r\n\u00a0 ]*)<\/span>/g,function(e,t){for(var n="",r=0;r++/gi,"")}function v(e,t){for(var n=document.createElement(t),r=0;r");for(var o=n.firstElementChild,s=1==n.children.length;o;)"P"!=o.tagName||C(o)||s&&S(o),o=o.nextElementSibling;if(t){var l=n.getAttribute("class");if(l){var d=(l=R(l)).match(/xl[0-9]+/gi);if(d){var c="."+d[0];t[c]&&y(n,t[c])}}t.td&&y(n,t.td)}var f=n.getAttribute("style");f&&(f=R(f))&&";"!=f.slice(-1)&&(f+=";");var p=n.getAttribute("valign");if(!p&&f){var u=f.match(/vertical-align:.+?[; "]{1,1}/gi);u&&(p=u[u.length-1].replace(/vertical-align:(.+?)[; "]{1,1}/gi,"$1"))}var h=null;if(f){var g=f.match(/text-align:.+?[; "]{1,1}/gi);g&&(h=g[g.length-1].replace(/text-align:(.+?)[; "]{1,1}/gi,"$1")),"general"==h&&(h=null)}var m=null;if(f){var v=f.match(/background:.+?[; "]{1,1}/gi);v&&(m=v[v.length-1].replace(/background:(.+?)[; "]{1,1}/gi,"$1"))}var E=n.getAttribute("colspan"),b=n.getAttribute("rowspan");E&&n.setAttribute("colspan",E),b&&n.setAttribute("rowspan",b),p&&(n.style["vertical-align"]=p),h&&(n.style["text-align"]=h),m&&(n.style["background-color"]=m),a&&n.setAttribute("width",a),n=n.nextElementSibling}for(n=e.firstElementChild;n;)a=n.getAttribute("width"),i?n.removeAttribute("width"):n.setAttribute("width",100*parseInt(a,10)/r+"%"),n=n.nextElementSibling}(e,t),"A"!=n||e.attributes.getNamedItem("href")||e.attributes.getNamedItem("name")||!e.innerHTML||(e.outerHTML=e.innerHTML),"TD"!=n&&"TH"!=n||e.innerHTML||(e.innerHTML="
    "),"TABLE"==n&&(e.style.width="100%"),e.getAttribute("lang")&&e.removeAttribute("lang"),e.getAttribute("style")&&-1!=e.getAttribute("style").toLowerCase().indexOf("mso")){var g=R(e.getAttribute("style"));(g=g.replace(/[0-9a-z-_]*mso[0-9a-z-_]*:.+?(;{1,1}|$)/gi,""))?e.setAttribute("style",g):e.removeAttribute("style")}return!0}var h={};return{_init:function(){T.events.on("paste.wordPaste",function(e){return r=e,T.opts.wordPasteModal?function(){if(!a){var e='

    '+T.language.translate("Word Paste Detected")+"

    ",t=(i='
    ',i+='

    '+T.language.translate("The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?")+"

    ",i+='
    ",i+="
    "),n=T.modals.create(o,e,t),r=n.$body;a=n.$modal,n.$modal.addClass("fr-middle"),T.events.bindClick(r,"button.fr-remove-word",function(){var e=a.data("instance")||T;e.wordPaste.clean()}),T.events.bindClick(r,"button.fr-keep-word",function(){var e=a.data("instance")||T;e.wordPaste.clean(!0)}),T.events.$on(be(T.o_win),"resize",function(){T.modals.resize(o)})}var i;T.modals.show(o),T.modals.resize(o)}():t(T.opts.wordPasteKeepFormatting),!1})},clean:t}}}); \ No newline at end of file +!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t)}:n(window.jQuery)}(function(be){var s=function(e,t){this.id=++be.FE.ID,this.opts=be.extend(!0,{},be.extend({},s.DEFAULTS,"object"==typeof t&&t));var n=JSON.stringify(this.opts);be.FE.OPTS_MAPPING[n]=be.FE.OPTS_MAPPING[n]||this.id,this.sid=be.FE.OPTS_MAPPING[n],be.FE.SHARED[this.sid]=be.FE.SHARED[this.sid]||{},this.shared=be.FE.SHARED[this.sid],this.shared.count=(this.shared.count||0)+1,this.$oel=be(e),this.$oel.data("froala.editor",this),this.o_doc=e.ownerDocument,this.o_win="defaultView"in this.o_doc?this.o_doc.defaultView:this.o_doc.parentWindow;var r=be(this.o_win).scrollTop();this.$oel.on("froala.doInit",be.proxy(function(){this.$oel.off("froala.doInit"),this.doc=this.$el.get(0).ownerDocument,this.win="defaultView"in this.doc?this.doc.defaultView:this.doc.parentWindow,this.$doc=be(this.doc),this.$win=be(this.win),this.opts.pluginsEnabled||(this.opts.pluginsEnabled=Object.keys(be.FE.PLUGINS)),this.opts.initOnClick?(this.load(be.FE.MODULES),this.$el.on("touchstart.init",function(){be(this).data("touched",!0)}),this.$el.on("touchmove.init",function(){be(this).removeData("touched")}),this.$el.on("mousedown.init touchend.init dragenter.init focus.init",be.proxy(function(e){if("touchend"==e.type&&!this.$el.data("touched"))return!0;if(1===e.which||!e.which){this.$el.off("mousedown.init touchstart.init touchmove.init touchend.init dragenter.init focus.init"),this.load(be.FE.MODULES),this.load(be.FE.PLUGINS);var t=e.originalEvent&&e.originalEvent.originalTarget;t&&"IMG"==t.tagName&&be(t).trigger("mousedown"),"undefined"==typeof this.ul&&this.destroy(),"touchend"==e.type&&this.image&&e.originalEvent&&e.originalEvent.target&&be(e.originalEvent.target).is("img")&&setTimeout(be.proxy(function(){this.image.edit(be(e.originalEvent.target))},this),100),this.ready=!0,this.events.trigger("initialized")}},this)),this.events.trigger("initializationDelayed")):(this.load(be.FE.MODULES),this.load(be.FE.PLUGINS),be(this.o_win).scrollTop(r),"undefined"==typeof this.ul&&this.destroy(),this.ready=!0,this.events.trigger("initialized"))},this)),this._init()};s.DEFAULTS={initOnClick:!1,pluginsEnabled:null},s.MODULES={},s.PLUGINS={},s.VERSION="2.8.5",s.INSTANCES=[],s.OPTS_MAPPING={},s.SHARED={},s.ID=0,s.prototype._init=function(){var e=this.$oel.prop("tagName");this.$oel.closest("label").length;var t=be.proxy(function(){"TEXTAREA"!=e&&(this._original_html=this._original_html||this.$oel.html()),this.$box=this.$box||this.$oel,this.opts.fullPage&&(this.opts.iframe=!0),this.opts.iframe?(this.$iframe=be('',provider:"youtube"},{test_regex:/^.*(?:vimeo.com)\/(?:channels(\/\w+\/)?|groups\/*\/videos\/\u200b\d+\/|video\/|)(\d+)(?:$|\/|\?)/,url_regex:/(?:https?:\/\/)?(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:[a-zA-Z0-9_\-]+)?(\/[a-zA-Z0-9_\-]+)?/i,url_text:"https://player.vimeo.com/video/$1",html:'',provider:"vimeo"},{test_regex:/^.+(dailymotion.com|dai.ly)\/(video|hub)?\/?([^_]+)[^#]*(#video=([^_&]+))?/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:dailymotion\.com|dai\.ly)\/(?:video|hub)?\/?(.+)/g,url_text:"https://www.dailymotion.com/embed/video/$1",html:'',provider:"dailymotion"},{test_regex:/^.+(screen.yahoo.com)\/[^_&]+/,url_regex:"",url_text:"",html:'',provider:"yahoo"},{test_regex:/^.+(rutube.ru)\/[^_&]+/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:rutube\.ru)\/(?:video)?\/?(.+)/g,url_text:"https://rutube.ru/play/embed/$1",html:'',provider:"rutube"},{test_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/,url_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/g,url_text:"https://play.vidyard.com/$1",html:'',provider:"vidyard"}],be.FE.VIDEO_EMBED_REGEX=/^\W*((<\/iframe>)|())\W*$/i,be.FE.PLUGINS.video=function(f){var s,c,p,u,r,n,d="https://i.froala.com/upload",l=2,h=3,g=4,m=5,v=6,i={};function E(){var e=f.popups.get("video.insert");e.find(".fr-video-by-url-layer input").val("").trigger("change");var t=e.find(".fr-video-embed-layer textarea");t.val("").trigger("change"),(t=e.find(".fr-video-upload-layer input")).val("").trigger("change")}function a(){var e=f.popups.get("video.edit");if(e||(e=function(){var e="";if(0',e+=f.button.buildList(f.opts.videoEditButtons);var t={buttons:e+=""},n=f.popups.create("video.edit",t);return f.events.$on(f.$wp,"scroll.video-edit",function(){u&&f.popups.isVisible("video.edit")&&(f.events.disableBlur(),y(u))}),n}return!1}()),e){f.popups.setContainer("video.edit",f.$sc),f.popups.refresh("video.edit");var t=u.find("iframe, embed, video"),n=t.offset().left+t.outerWidth()/2,r=t.offset().top+t.outerHeight();f.popups.show("video.edit",n,r,t.outerHeight())}}function o(e){if(e)return f.popups.onRefresh("video.insert",E),f.popups.onHide("image.insert",V),!0;var t="";f.opts.videoUpload||f.opts.videoInsertButtons.splice(f.opts.videoInsertButtons.indexOf("videoUpload"),1),1'+f.button.buildList(f.opts.videoInsertButtons)+"");var n,r="",i=f.opts.videoInsertButtons.indexOf("videoUpload"),a=f.opts.videoInsertButtons.indexOf("videoByURL"),o=f.opts.videoInsertButtons.indexOf("videoEmbed");0<=a&&(n=" fr-active",(i
    ");var s="";0<=o&&(n=" fr-active",(i
    ");var l="";0<=i&&(n=" fr-active",(o'+f.language.translate("Drop video")+"
    ("+f.language.translate("or click")+')
    ');var d={buttons:t,by_url_layer:r,embed_layer:s,upload_layer:l,progress_bar:'

    Uploading

    '},c=f.popups.create("video.insert",d);return function(r){f.events.$on(r,"dragover dragenter",".fr-video-upload-layer",function(){return be(this).addClass("fr-drop"),!1},!0),f.events.$on(r,"dragleave dragend",".fr-video-upload-layer",function(){return be(this).removeClass("fr-drop"),!1},!0),f.events.$on(r,"drop",".fr-video-upload-layer",function(e){e.preventDefault(),e.stopPropagation(),be(this).removeClass("fr-drop");var t=e.originalEvent.dataTransfer;if(t&&t.files){var n=r.data("instance")||f;n.events.disableBlur(),n.video.upload(t.files),n.events.enableBlur()}},!0),f.helpers.isIOS()&&f.events.$on(r,"touchstart",'.fr-video-upload-layer input[type="file"]',function(){be(this).trigger("click")},!0);f.events.$on(r,"change",'.fr-video-upload-layer input[type="file"]',function(){if(this.files){var e=r.data("instance")||f;e.events.disableBlur(),r.find("input:focus").blur(),e.events.enableBlur(),e.video.upload(this.files)}be(this).val("")},!0)}(c),c}function b(e){f.events.focus(!0),f.selection.restore();var t=!1;u&&(G(),t=!0),f.html.insert(''+e+"",!1,f.opts.videoSplitHTML),f.popups.hide("video.insert");var n=f.$el.find(".fr-jiv");n.removeClass("fr-jiv"),X(n,f.opts.videoDefaultDisplay,f.opts.videoDefaultAlign),n.toggleClass("fr-draggable",f.opts.videoMove),f.events.trigger(t?"video.replaced":"video.inserted",[n])}function T(){var e=be(this);f.popups.hide("video.insert"),e.removeClass("fr-uploading"),e.parent().next().is("br")&&e.parent().next().remove(),y(e.parent()),f.events.trigger("video.loaded",[e.parent()])}function A(s,e,l,d,c){f.edit.off(),R("Loading video"),e&&(s=f.helpers.sanitizeURL(s));C("Loading video"),function(){var e,t;if(d){f.undo.canDo()||d.find("video").hasClass("fr-uploading")||f.undo.saveStep();var n=d.find("video").data("fr-old-src"),r=d.data("fr-replaced");d.data("fr-replaced",!1),f.$wp?((e=d.clone()).find("video").removeData("fr-old-src").removeClass("fr-uploading"),e.find("video").off("canplay"),n&&d.find("video").attr("src",n),d.replaceWith(e)):e=d;for(var i=e.find("video").get(0).attributes,a=0;a");o.toggleClass("fr-draggable",f.opts.videoMove),f.edit.on(),f.events.focus(!0),f.selection.restore(),f.undo.saveStep(),f.opts.videoSplitHTML?f.markers.split():f.markers.insert(),f.html.wrap();var s=f.$el.find(".fr-marker");return f.node.isLastSibling(s)&&s.parent().hasClass("fr-deletable")&&s.insertAfter(s.parent()),s.replaceWith(o),f.selection.clear(),o.find("video").get(0).readyState>o.find("video").get(0).HAVE_FUTURE_DATA||f.helpers.isIOS()?n.call(o.find("video").get(0)):o.find("video").on("canplaythrough load",n),o}(s,l,T),k(),f.undo.saveStep(),f.events.trigger("video.inserted",[e,c])}()}function C(e){var t=f.popups.get("video.insert");if(t||(t=o()),t.find(".fr-layer.fr-active").removeClass("fr-active").addClass("fr-pactive"),t.find(".fr-video-progress-bar-layer").addClass("fr-active"),t.find(".fr-buttons").hide(),u){var n=u.find("video");f.popups.setContainer("video.insert",f.$sc);var r=n.offset().left+n.width()/2,i=n.offset().top+n.height();f.popups.show("video.insert",r,i,n.outerHeight())}void 0===e&&R(f.language.translate("Uploading"),0)}function S(e){var t=f.popups.get("video.insert");if(t&&(t.find(".fr-layer.fr-pactive").addClass("fr-active").removeClass("fr-pactive"),t.find(".fr-video-progress-bar-layer").removeClass("fr-active"),t.find(".fr-buttons").show(),e||f.$el.find("video.fr-error").length)){if(f.events.focus(),f.$el.find("video.fr-error").length&&(f.$el.find("video.fr-error").parent().remove(),f.undo.saveStep(),f.undo.run(),f.undo.dropRedo()),!f.$wp&&u){var n=u;$(!0),f.selection.setAfter(n.find("video").get(0)),f.selection.restore()}f.popups.hide("video.insert")}}function R(e,t){var n=f.popups.get("video.insert");if(n){var r=n.find(".fr-video-progress-bar-layer");r.find("h3").text(e+(t?" "+t+"%":"")),r.removeClass("fr-error"),t?(r.find("div").removeClass("fr-indeterminate"),r.find("div > span").css("width",t+"%")):r.find("div").addClass("fr-indeterminate")}}function y(e){M.call(e.get(0))}function _(e){R("Loading video");var t=this.status,n=this.response,r=this.responseXML,i=this.responseText;try{if(f.opts.videoUploadToS3)if(201==t){var a=function(e){try{var t=be(e).find("Location").text(),n=be(e).find("Key").text();return!1===f.events.trigger("video.uploadedToS3",[t,n,e],!0)?(f.edit.on(),!1):t}catch(r){return K(g,e),!1}}(r);a&&A(a,!1,[],e,n||r)}else K(g,n||r);else if(200<=t&&t<300){var o=function(e){try{if(!1===f.events.trigger("video.uploaded",[e],!0))return f.edit.on(),!1;var t=JSON.parse(e);return t.link?t:(K(l,e),!1)}catch(n){return K(g,e),!1}}(i);o&&A(o.link,!1,o,e,n||i)}else K(h,n||i)}catch(s){K(g,n||i)}}function L(){K(g,this.response||this.responseText||this.responseXML)}function x(e){if(e.lengthComputable){var t=e.loaded/e.total*100|0;R(f.language.translate("Uploading"),t)}}function N(){f.edit.on(),S(!0)}function w(e){if(!f.core.sameInstance(p))return!0;e.preventDefault(),e.stopPropagation();var t=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null),n=e.pageY||(e.originalEvent.touches?e.originalEvent.touches[0].pageY:null);if(!t||!n)return!1;if("mousedown"==e.type){var r=f.$oel.get(0).ownerDocument,i=r.defaultView||r.parentWindow,a=!1;try{a=i.location!=i.parent.location&&!(i.$&&i.$.FE)}catch(o){}a&&i.frameElement&&(t+=f.helpers.getPX(be(i.frameElement).offset().left)+i.frameElement.clientLeft,n=e.clientY+f.helpers.getPX(be(i.frameElement).offset().top)+i.frameElement.clientTop)}f.undo.canDo()||f.undo.saveStep(),(c=be(this)).data("start-x",t),c.data("start-y",n),s.show(),f.popups.hideAll(),B()}function O(e){if(!f.core.sameInstance(p))return!0;if(c){e.preventDefault();var t=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null),n=e.pageY||(e.originalEvent.touches?e.originalEvent.touches[0].pageY:null);if(!t||!n)return!1;var r=c.data("start-x"),i=c.data("start-y");c.data("start-x",t),c.data("start-y",n);var a=t-r,o=n-i,s=u.find("iframe, embed, video"),l=s.width(),d=s.height();(c.hasClass("fr-hnw")||c.hasClass("fr-hsw"))&&(a=0-a),(c.hasClass("fr-hnw")||c.hasClass("fr-hne"))&&(o=0-o),s.css("width",l+a),s.css("height",d+o),s.removeAttr("width"),s.removeAttr("height"),F()}}function I(e){if(!f.core.sameInstance(p))return!0;c&&u&&(e&&e.stopPropagation(),c=null,s.hide(),F(),a(),f.undo.saveStep())}function t(e){return'
    '}function D(e,t,n,r){return e.pageX=t,e.pageY=t,w.call(this,e),e.pageX=e.pageX+n*Math.floor(Math.pow(1.1,r)),e.pageY=e.pageY+n*Math.floor(Math.pow(1.1,r)),O.call(this,e),I.call(this,e),++r}function k(){var e,t=Array.prototype.slice.call(f.el.querySelectorAll("video, .fr-video > *")),n=[];for(e=0;e'),p=f.shared.$video_resizer,f.events.$on(p,"mousedown",function(e){e.stopPropagation()},!0),f.opts.videoResize&&(p.append(t("nw")+t("ne")+t("sw")+t("se")),f.shared.$vid_overlay=be('
    '),s=f.shared.$vid_overlay,e=p.get(0).ownerDocument,be(e).find("body:first").append(s))),f.events.on("shared.destroy",function(){p.html("").removeData().remove(),p=null,f.opts.videoResize&&(s.remove(),s=null)},!0),f.helpers.isMobile()||f.events.$on(be(f.o_win),"resize.video",function(){$(!0)}),f.opts.videoResize){e=p.get(0).ownerDocument,f.events.$on(p,f._mousedown,".fr-handler",w),f.events.$on(be(e),f._mousemove,O),f.events.$on(be(e.defaultView||e.parentWindow),f._mouseup,I),f.events.$on(s,"mouseleave",I);var r=1,i=null,a=0;f.events.on("keydown",function(e){if(u){var t=-1!=navigator.userAgent.indexOf("Mac OS X")?e.metaKey:e.ctrlKey,n=e.which;(n!==i||200f.opts.videoMaxSize)return K(m),!1;if(f.opts.videoAllowedTypes.indexOf(n.type.replace(/video\//g,""))<0)return K(v),!1;if(f.drag_support.formdata&&(t=f.drag_support.formdata?new FormData:null),t){var r;if(!1!==f.opts.videoUploadToS3)for(r in t.append("key",f.opts.videoUploadToS3.keyStart+(new Date).getTime()+"-"+(n.name||"untitled")),t.append("success_action_status","201"),t.append("X-Requested-With","xhr"),t.append("Content-Type",n.type),f.opts.videoUploadToS3.params)f.opts.videoUploadToS3.params.hasOwnProperty(r)&&t.append(r,f.opts.videoUploadToS3.params[r]);for(r in f.opts.videoUploadParams)f.opts.videoUploadParams.hasOwnProperty(r)&&t.append(r,f.opts.videoUploadParams[r]);t.append(f.opts.videoUploadParam,n);var i=f.opts.videoUploadURL;f.opts.videoUploadToS3&&(i=f.opts.videoUploadToS3.uploadURL?f.opts.videoUploadToS3.uploadURL:"https://"+f.opts.videoUploadToS3.region+".amazonaws.com/"+f.opts.videoUploadToS3.bucket);var a=f.core.getXHR(i,f.opts.videoUploadMethod);a.onload=function(){_.call(a,u)},a.onerror=L,a.upload.onprogress=x,a.onabort=N,C(),f.events.disableBlur(),f.edit.off(),f.events.enableBlur();var o=f.popups.get("video.insert");o&&o.off("abortUpload").on("abortUpload",function(){4!=a.readyState&&a.abort()}),a.send(t)}}var s,l}function K(e,t){f.edit.on(),u&&u.find("video").addClass("fr-error"),function(e){C();var t=f.popups.get("video.insert").find(".fr-video-progress-bar-layer");t.addClass("fr-error");var n=t.find("h3");n.text(e),f.events.disableBlur(),n.focus()}(f.language.translate("Something went wrong. Please try again.")),f.events.trigger("video.error",[{code:e,message:i[e]},t])}function H(){if(u){var e=f.popups.get("video.size"),t=u.find("iframe, embed, video");e.find('input[name="width"]').val(t.get(0).style.width||t.attr("width")).trigger("change"),e.find('input[name="height"]').val(t.get(0).style.height||t.attr("height")).trigger("change")}}function W(e){if(e)return f.popups.onRefresh("video.size",H),!0;var t={buttons:'
    '+f.button.buildList(f.opts.videoSizeButtons)+"
    ",size_layer:'
    "},n=f.popups.create("video.size",t);return f.events.$on(f.$wp,"scroll",function(){u&&f.popups.isVisible("video.size")&&(f.events.disableBlur(),y(u))}),n}function z(e){if(void 0===e&&(e=u),e){if(e.hasClass("fr-fvl"))return"left";if(e.hasClass("fr-fvr"))return"right";if(e.hasClass("fr-dvb")||e.hasClass("fr-dvi"))return"center";if("block"==e.css("display")){if("left"==e.css("text-algin"))return"left";if("right"==e.css("text-align"))return"right"}else{if("left"==e.css("float"))return"left";if("right"==e.css("float"))return"right"}}return"center"}function Y(e){void 0===e&&(e=u);var t=e.css("float");return e.css("float","none"),"block"==e.css("display")?(e.css("float",""),e.css("float")!=t&&e.css("float",t),"block"):(e.css("float",""),e.css("float")!=t&&e.css("float",t),"inline")}function G(){if(u&&!1!==f.events.trigger("video.beforeRemove",[u])){var e=u;f.popups.hideAll(),$(!0),f.selection.setBefore(e.get(0))||f.selection.setAfter(e.get(0)),e.remove(),f.selection.restore(),f.html.fillEmptyBlocks(),f.events.trigger("video.removed",[e])}}function V(){S()}function X(e,t,n){!f.opts.htmlUntouched&&f.opts.useClasses?(e.removeClass("fr-fvl fr-fvr fr-dvb fr-dvi"),e.addClass("fr-fv"+n[0]+" fr-dv"+t[0])):"inline"==t?(e.css({display:"inline-block"}),"center"==n?e.css({"float":"none"}):"left"==n?e.css({"float":"left"}):e.css({"float":"right"})):(e.css({display:"block",clear:"both"}),"left"==n?e.css({textAlign:"left"}):"right"==n?e.css({textAlign:"right"}):e.css({textAlign:"center"}))}function q(){f.$el.find("video").filter(function(){return 0===be(this).parents("span.fr-video").length}).wrap(''),f.$el.find("embed, iframe").filter(function(){if(f.browser.safari&&this.getAttribute("src")&&this.setAttribute("src",this.src),0');for(var e,t,n=f.$el.find("span.fr-video, video"),r=0;r *:first").replaceWith(f.icon.create("video-align-"+z()))},refreshAlignOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+z()+'"]').addClass("fr-active").attr("aria-selected",!0)},display:function(e){u.removeClass("fr-dvi fr-dvb"),!f.opts.htmlUntouched&&f.opts.useClasses?"inline"==e?u.addClass("fr-dvi"):"block"==e&&u.addClass("fr-dvb"):X(u,e,z()),j(),F(),a(),f.selection.clear()},refreshDisplayOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+Y()+'"]').addClass("fr-active").attr("aria-selected",!0)},remove:G,hideProgressBar:S,showSizePopup:function(){var e=f.popups.get("video.size");e||(e=W()),S(),f.popups.refresh("video.size"),f.popups.setContainer("video.size",f.$sc);var t=u.find("iframe, embed, video"),n=t.offset().left+t.width()/2,r=t.offset().top+t.height();f.popups.show("video.size",n,r,t.height())},replace:function(){var e=f.popups.get("video.insert");e||(e=o()),f.popups.isVisible("video.insert")||(S(),f.popups.refresh("video.insert"),f.popups.setContainer("video.insert",f.$sc));var t=u.offset().left+u.width()/2,n=u.offset().top+u.height();f.popups.show("video.insert",t,n,u.outerHeight())},back:function(){u?(f.events.disableBlur(),u.trigger("click")):(f.events.disableBlur(),f.selection.restore(),f.events.enableBlur(),f.popups.hide("video.insert"),f.toolbar.showInline())},setSize:function(e,t){if(u){var n=f.popups.get("video.size"),r=u.find("iframe, embed, video");r.css("width",e||n.find('input[name="width"]').val()),r.css("height",t||n.find('input[name="height"]').val()),r.get(0).style.width&&r.removeAttr("width"),r.get(0).style.height&&r.removeAttr("height"),n.find("input:focus").blur(),setTimeout(function(){u.trigger("click")},f.helpers.isAndroid()?50:0)}},get:function(){return u}}},be.FE.RegisterCommand("insertVideo",{title:"Insert Video",undo:!1,focus:!0,refreshAfterCallback:!1,popup:!0,callback:function(){this.popups.isVisible("video.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("video.insert")):this.video.showInsertPopup()},plugin:"video"}),be.FE.DefineIcon("insertVideo",{NAME:"video-camera",FA5NAME:"camera"}),be.FE.DefineIcon("videoByURL",{NAME:"link"}),be.FE.RegisterCommand("videoByURL",{title:"By URL",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-by-url")},refresh:function(e){this.video.refreshByURLButton(e)}}),be.FE.DefineIcon("videoEmbed",{NAME:"code"}),be.FE.RegisterCommand("videoEmbed",{title:"Embedded Code",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-embed")},refresh:function(e){this.video.refreshEmbedButton(e)}}),be.FE.DefineIcon("videoUpload",{NAME:"upload"}),be.FE.RegisterCommand("videoUpload",{title:"Upload Video",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-upload")},refresh:function(e){this.video.refreshUploadButton(e)}}),be.FE.RegisterCommand("videoInsertByURL",{undo:!0,focus:!0,callback:function(){this.video.insertByURL()}}),be.FE.RegisterCommand("videoInsertEmbed",{undo:!0,focus:!0,callback:function(){this.video.insertEmbed()}}),be.FE.DefineIcon("videoDisplay",{NAME:"star"}),be.FE.RegisterCommand("videoDisplay",{title:"Display",type:"dropdown",options:{inline:"Inline",block:"Break Text"},callback:function(e,t){this.video.display(t)},refresh:function(e){this.opts.videoTextNear||e.addClass("fr-hidden")},refreshOnShow:function(e,t){this.video.refreshDisplayOnShow(e,t)}}),be.FE.DefineIcon("video-align",{NAME:"align-left"}),be.FE.DefineIcon("video-align-left",{NAME:"align-left"}),be.FE.DefineIcon("video-align-right",{NAME:"align-right"}),be.FE.DefineIcon("video-align-center",{NAME:"align-justify"}),be.FE.DefineIcon("videoAlign",{NAME:"align-center"}),be.FE.RegisterCommand("videoAlign",{type:"dropdown",title:"Align",options:{left:"Align Left",center:"None",right:"Align Right"},html:function(){var e='"},callback:function(e,t){this.video.align(t)},refresh:function(e){this.video.refreshAlign(e)},refreshOnShow:function(e,t){this.video.refreshAlignOnShow(e,t)}}),be.FE.DefineIcon("videoReplace",{NAME:"exchange",FA5NAME:"exchange-alt"}),be.FE.RegisterCommand("videoReplace",{title:"Replace",undo:!1,focus:!1,popup:!0,refreshAfterCallback:!1,callback:function(){this.video.replace()}}),be.FE.DefineIcon("videoRemove",{NAME:"trash"}),be.FE.RegisterCommand("videoRemove",{title:"Remove",callback:function(){this.video.remove()}}),be.FE.DefineIcon("videoSize",{NAME:"arrows-alt"}),be.FE.RegisterCommand("videoSize",{undo:!1,focus:!1,popup:!0,title:"Change Size",callback:function(){this.video.showSizePopup()}}),be.FE.DefineIcon("videoBack",{NAME:"arrow-left"}),be.FE.RegisterCommand("videoBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.video.back()},refresh:function(e){this.video.get()||this.opts.toolbarInline?(e.removeClass("fr-hidden"),e.next(".fr-separator").removeClass("fr-hidden")):(e.addClass("fr-hidden"),e.next(".fr-separator").addClass("fr-hidden"))}}),be.FE.RegisterCommand("videoDismissError",{title:"OK",undo:!1,callback:function(){this.video.hideProgressBar(!0)}}),be.FE.RegisterCommand("videoSetSize",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.video.setSize()}}),be.extend(be.FE.DEFAULTS,{wordDeniedTags:[],wordDeniedAttrs:[],wordAllowedStyleProps:["font-family","font-size","background","color","width","text-align","vertical-align","background-color","padding","margin","height","margin-top","margin-left","margin-right","margin-bottom","text-decoration","font-weight","font-style","text-indent"],wordPasteModal:!0,wordPasteKeepFormatting:!0}),be.FE.PLUGINS.wordPaste=function(T){var a,r,o="word_paste";function t(e){var t=T.opts.wordAllowedStyleProps;e||(T.opts.wordAllowedStyleProps=[]),0===r.indexOf("")&&(r=""+r+"
    "),r=function(e,t){0<=e.indexOf("]*(]*>[.\s\S\w\W<>]*<\/html>)[.\s\S\w\W<>]*/i,"$1"));!function(e){for(var t=e.split("v:shape"),n=1;n').remove()}}(e,t),!0});for(var a=i.querySelectorAll("ul > ul, ul > ol, ol > ul, ol > ol"),s=a.length-1;0<=s;s--)a[s].previousElementSibling&&"LI"===a[s].previousElementSibling.tagName&&a[s].previousElementSibling.appendChild(a[s]);c(i,function(t){if(t.nodeType==Node.TEXT_NODE)return t.data=t.data.replace(/
    (\n|\r)/gi,"
    "),!1;if(t.nodeType==Node.ELEMENT_NODE){if(C(t)){var n=t.parentNode,r=t.previousSibling,i=function e(t,n){var r=/[0-9a-zA-Z]./gi;var i=!1;t.firstElementChild&&t.firstElementChild.firstElementChild&&t.firstElementChild.firstElementChild.firstChild&&!(i=i||r.test(t.firstElementChild.firstElementChild.firstChild.data||""))&&t.firstElementChild.firstElementChild.firstElementChild&&t.firstElementChild.firstElementChild.firstElementChild.firstChild&&(i=i||r.test(t.firstElementChild.firstElementChild.firstElementChild.firstChild.data||""));var a=i?"ol":"ul";var o=g(t);var s="<"+a+">
  • "+m(t,n);var l=t.nextElementSibling;var d=t.parentNode;A(t);t=null;for(;l&&C(l);){var c=l.previousElementSibling,f=g(l);if(o
  • "+m(l,n)}if(o=f,l.previousElementSibling||l.nextElementSibling||l.parentNode){var p=l;l=l.nextElementSibling,A(p),p=null}else l=c?c.nextElementSibling:d.firstElementChild}s+="
  • ";var u=document.createElement("div");u.innerHTML=s;var h=u.firstElementChild;return h}(t,o),a=null;return(a=r?r.nextSibling:n.firstChild)?n.insertBefore(i,a):n.appendChild(i),!1}return p(t,o)}return t.nodeType!=Node.COMMENT_NODE||(A(t),!1)}),c(i,function(e){if(e.nodeType==Node.ELEMENT_NODE){var t=e.tagName;if(!e.innerHTML&&-1==["BR","IMG"].indexOf(t)){for(var n=e.parentNode;n&&(A(e),!(e=n).innerHTML);)n=e.parentNode;return!1}!function(e){var t=e.getAttribute("style");if(!t)return;(t=R(t))&&";"!=t.slice(-1)&&(t+=";");var n=t.match(/(^|\S+?):.+?;{1,1}/gi);if(!n)return;for(var r={},i=0;i([\r\n\u00a0 ]*)<\/span>/g,function(e,t){for(var n="",r=0;r++/gi,"")}function v(e,t){for(var n=document.createElement(t),r=0;r");for(var o=n.firstElementChild,s=1==n.children.length;o;)"P"!=o.tagName||C(o)||s&&S(o),o=o.nextElementSibling;if(t){var l=n.getAttribute("class");if(l){var d=(l=R(l)).match(/xl[0-9]+/gi);if(d){var c="."+d[0];t[c]&&y(n,t[c])}}t.td&&y(n,t.td)}var f=n.getAttribute("style");f&&(f=R(f))&&";"!=f.slice(-1)&&(f+=";");var p=n.getAttribute("valign");if(!p&&f){var u=f.match(/vertical-align:.+?[; "]{1,1}/gi);u&&(p=u[u.length-1].replace(/vertical-align:(.+?)[; "]{1,1}/gi,"$1"))}var h=null;if(f){var g=f.match(/text-align:.+?[; "]{1,1}/gi);g&&(h=g[g.length-1].replace(/text-align:(.+?)[; "]{1,1}/gi,"$1")),"general"==h&&(h=null)}var m=null;if(f){var v=f.match(/background:.+?[; "]{1,1}/gi);v&&(m=v[v.length-1].replace(/background:(.+?)[; "]{1,1}/gi,"$1"))}var E=n.getAttribute("colspan"),b=n.getAttribute("rowspan");E&&n.setAttribute("colspan",E),b&&n.setAttribute("rowspan",b),p&&(n.style["vertical-align"]=p),h&&(n.style["text-align"]=h),m&&(n.style["background-color"]=m),a&&n.setAttribute("width",a),n=n.nextElementSibling}for(n=e.firstElementChild;n;)a=n.getAttribute("width"),i?n.removeAttribute("width"):n.setAttribute("width",100*parseInt(a,10)/r+"%"),n=n.nextElementSibling}(e,t),"A"!=n||e.attributes.getNamedItem("href")||e.attributes.getNamedItem("name")||!e.innerHTML||(e.outerHTML=e.innerHTML),"TD"!=n&&"TH"!=n||e.innerHTML||(e.innerHTML="
    "),"TABLE"==n&&(e.style.width="100%"),e.getAttribute("lang")&&e.removeAttribute("lang"),e.getAttribute("style")&&-1!=e.getAttribute("style").toLowerCase().indexOf("mso")){var g=R(e.getAttribute("style"));(g=g.replace(/[0-9a-z-_]*mso[0-9a-z-_]*:.+?(;{1,1}|$)/gi,""))?e.setAttribute("style",g):e.removeAttribute("style")}return!0}var h={};return{_init:function(){T.events.on("paste.wordPaste",function(e){return r=e,T.opts.wordPasteModal?function(){if(!a){var e='

    '+T.language.translate("Word Paste Detected")+"

    ",t=(i='
    ',i+='

    '+T.language.translate("The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?")+"

    ",i+='
    ",i+="
    "),n=T.modals.create(o,e,t),r=n.$body;a=n.$modal,n.$modal.addClass("fr-middle"),T.events.bindClick(r,"button.fr-remove-word",function(){var e=a.data("instance")||T;e.wordPaste.clean()}),T.events.bindClick(r,"button.fr-keep-word",function(){var e=a.data("instance")||T;e.wordPaste.clean(!0)}),T.events.$on(be(T.o_win),"resize",function(){T.modals.resize(o)})}var i;T.modals.show(o),T.modals.resize(o)}():t(T.opts.wordPasteKeepFormatting),!1})},clean:t}}}); \ No newline at end of file