{I" class:ETI"BundledAsset;FI"logical_path;TI")morrigan_editor_rails/application.js;FI" pathname;TI"|/media/workspace/repo/public_projects/morrigan_editor_rails/app/assets/javascripts/morrigan_editor_rails/application.js;FI"content_type;TI"application/javascript;TI" mtime;Tl+ŸƒÆSI" length;TiI" digest;TI"%b05116063bc54b50b0fc8e88b4ed45b7;FI" source;TI"!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t=e.length,n=ot.type(e);return"function"===n||ot.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function i(e,t,n){if(ot.isFunction(t))return ot.grep(e,function(e,i){return!!t.call(e,i,e)!==n});if(t.nodeType)return ot.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(ft.test(t))return ot.filter(t,e,n);t=ot.filter(t,e)}return ot.grep(e,function(e){return ot.inArray(e,t)>=0!==n})}function o(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function r(e){var t=wt[e]={};return ot.each(e.match(bt)||[],function(e,n){t[n]=!0}),t}function a(){ht.addEventListener?(ht.removeEventListener("DOMContentLoaded",s,!1),e.removeEventListener("load",s,!1)):(ht.detachEvent("onreadystatechange",s),e.detachEvent("onload",s))}function s(){(ht.addEventListener||"load"===event.type||"complete"===ht.readyState)&&(a(),ot.ready())}function c(e,t,n){if(void 0===n&&1===e.nodeType){var i="data-"+t.replace(Tt,"-$1").toLowerCase();if(n=e.getAttribute(i),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:Ct.test(n)?ot.parseJSON(n):n}catch(o){}ot.data(e,t,n)}else n=void 0}return n}function l(e){var t;for(t in e)if(("data"!==t||!ot.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function u(e,t,n,i){if(ot.acceptData(e)){var o,r,a=ot.expando,s=e.nodeType,c=s?ot.cache:e,l=s?e[a]:e[a]&&a;if(l&&c[l]&&(i||c[l].data)||void 0!==n||"string"!=typeof t)return l||(l=s?e[a]=G.pop()||ot.guid++:a),c[l]||(c[l]=s?{}:{toJSON:ot.noop}),("object"==typeof t||"function"==typeof t)&&(i?c[l]=ot.extend(c[l],t):c[l].data=ot.extend(c[l].data,t)),r=c[l],i||(r.data||(r.data={}),r=r.data),void 0!==n&&(r[ot.camelCase(t)]=n),"string"==typeof t?(o=r[t],null==o&&(o=r[ot.camelCase(t)])):o=r,o}}function d(e,t,n){if(ot.acceptData(e)){var i,o,r=e.nodeType,a=r?ot.cache:e,s=r?e[ot.expando]:ot.expando;if(a[s]){if(t&&(i=n?a[s]:a[s].data)){ot.isArray(t)?t=t.concat(ot.map(t,ot.camelCase)):t in i?t=[t]:(t=ot.camelCase(t),t=t in i?[t]:t.split(" ")),o=t.length;for(;o--;)delete i[t[o]];if(n?!l(i):!ot.isEmptyObject(i))return}(n||(delete a[s].data,l(a[s])))&&(r?ot.cleanData([e],!0):nt.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}function f(){return!0}function p(){return!1}function h(){try{return ht.activeElement}catch(e){}}function g(e){var t=jt.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function m(e,t){var n,i,o=0,r=typeof e.getElementsByTagName!==kt?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!==kt?e.querySelectorAll(t||"*"):void 0;if(!r)for(r=[],n=e.childNodes||e;null!=(i=n[o]);o++)!t||ot.nodeName(i,t)?r.push(i):ot.merge(r,m(i,t));return void 0===t||t&&ot.nodeName(e,t)?ot.merge([e],r):r}function v(e){Ht.test(e.type)&&(e.defaultChecked=e.checked)}function y(e,t){return ot.nodeName(e,"table")&&ot.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function b(e){return e.type=(null!==ot.find.attr(e,"type"))+"/"+e.type,e}function w(e){var t=Vt.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function x(e,t){for(var n,i=0;null!=(n=e[i]);i++)ot._data(n,"globalEval",!t||ot._data(t[i],"globalEval"))}function _(e,t){if(1===t.nodeType&&ot.hasData(e)){var n,i,o,r=ot._data(e),a=ot._data(t,r),s=r.events;if(s){delete a.handle,a.events={};for(n in s)for(i=0,o=s[n].length;o>i;i++)ot.event.add(t,n,s[n][i])}a.data&&(a.data=ot.extend({},a.data))}}function k(e,t){var n,i,o;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!nt.noCloneEvent&&t[ot.expando]){o=ot._data(t);for(i in o.events)ot.removeEvent(t,i,o.handle);t.removeAttribute(ot.expando)}"script"===n&&t.text!==e.text?(b(t).text=e.text,w(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),nt.html5Clone&&e.innerHTML&&!ot.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ht.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}function C(t,n){var i,o=ot(n.createElement(t)).appendTo(n.body),r=e.getDefaultComputedStyle&&(i=e.getDefaultComputedStyle(o[0]))?i.display:ot.css(o[0],"display");return o.detach(),r}function T(e){var t=ht,n=Zt[e];return n||(n=C(e,t),"none"!==n&&n||(Qt=(Qt||ot("");e.element.append(t),setupIframe(t.find("iframe"))},this._buildSupportElements=function(){e.element.append("
")}},EventBinder:function(e){this.keyCodesAffectedDomChanges=[8,13,33,34,35,36,37,38,39,40,46],this.editor=e,this.bindDefaultEvents=function(){this._defaultActivateWidgetsEvent(),this._defaultBehaviorEvents()},this._defaultActivateWidgetsEvent=function(){e.element.find("iframe").contents().find("body").on("focus",function(){var t=e._actionManager,n=t.disabledActions.slice();$.each(n,function(e,n){t.enableAction(n)})})},this._defaultBehaviorEvents=function(){var t=this;e._content.on("keydown",function(e){t._defaultBehaviorKeyDownHandler(e)}).on("keyup",function(e){t._defaultBehaviorKeyUpHandler(e)}).on("mouseup",function(e){window.setTimeout(function(){t._defaultBehaviorMouseEvent(e)},10)})},this._defaultBehaviorMouseEvent=function(t){var n=e._selectionManager.getCustomSelection(),i=e._selectionManager.isCaret(n),o=e._selectionManager.getTopSelectedElements(n,i);this._onSelectionChangedHandlers(t,o,i)},this._defaultBehaviorKeyUpHandler=function(t){if(e._browser.ff||e._browser.webkit||-1!=$.inArray(t.keyCode,this.keyCodesAffectedDomChanges)){var n=e._selectionManager.getCustomSelection(),i=e._selectionManager.isCaret(n),o=e._selectionManager.getTopSelectedElements(n,i);if(o[0]&&3!=o[0].nodeType&&"DIV"!=o[0].nodeName||e._window.document.execCommand("formatBlock",!1,"p"),3===o[0].nodeType)return;this._onSelectionChangedHandlers(t,o,i)}},this._onSelectionChangedHandlers=function(t,n,i){$(e._actionManager.selectionChangedSubscribers).each(function(){e._actionManager.actions[this].selectionHandler(e,{topElements:n,isCaret:i},t)})},this._defaultBehaviorKeyDownHandler=function(){},this.bindCustomEvents=function(){var t=this;$(e._actionManager.actions).each(function(){this.config.dropdown?t._bindEventsToDropDown(this):this.config.popup?t._bindEventsToPopupAction(this):t._bindEventsToSimpleAction(this)})},this._bindEventsToPopupAction=function(t){t.element.on("click",function(){t.enabled&&e._popup.showPopup(t)})},this._bindEventsToSimpleAction=function(t){t.element.on("click",function(){t.enabled&&t.onClickHandler(e,t)})},this._bindEventsToDropDown=function(e){var t=this;e.element.on("click",function(){e.enabled&&(e.config.dropdown.shown?e.dropDownHide():e.dropDownShow())}),$(e.config.dropdown.actionList).each(function(){t._bindEventsToDropDownAction(this,e)})},this._bindEventsToDropDownAction=function(t,n){t.element.on("click",function(){t.onClickHandler(e,n)})}},Popup:function(e){this.editor=e,this.currentAction=null,this.element=null,this._formSelf=function(){var t=$("
"),n=$("
"),i=$("
");$.each(e.options.popup.actions,function(e){var t=$("
"+this.caption+"
");this.element=t,i.children(".mrge-popup-box-wrapper").append(t) }),i.children(".mrge-popup-box-wrapper").append('
'),n.append(i),t.append(n),e.element.append(t),this.element=t},this._bindMainEvents=function(){var e=this;this.element.on("click",".mrge-popup-close",function(){e.hidePopup()}).on("click",".mrge-popup-cancel",function(){e.hidePopup()})},this._formSelf(),this._bindMainEvents(),this._bindCustomEvents=function(e){e.config.popup.onShow(this.element,this.editor)},this._unbindCustomEvents=function(e){e.config.popup.onHide&&e.config.popup.onHide(this.element)},this.showPopup=function(e){this.currentAction=e,this._configure(e.config.popup),this._bindCustomEvents(e),this._locateAndShow()},this.hidePopup=function(){this._unbindCustomEvents(this.currentAction),this.currentAction=null,this.element.hide()},this._configure=function(t){this.element.find(".mrge-header-name").text(t.title),this.element.find(".mrge-popup").height(t.height);var n=this.element.find(".mrge-popup-content .mrge-popup-box-wrapper");n.empty(),t.customForm?t.customForm(e,n):n.append(t.html),this.element.find(".mrge-popup-actions .mrge-popup-btn.mrge-active").removeClass("mrge-active"),$.each(t.actions,function(){e.options.popup.actions[this].element.addClass("mrge-active")})},this._locateAndShow=function(){var t=this.element.find(".mrge-popup"),n=e.element.height()/2-t.height()/2,i=e.element.width()/2-t.width()/2;n=0>n?0:n,i=0>i?0:i,t.css("top",n),t.css("left",i),this.element.show()}},Uploader:function(e){this.editor=e,this.element=null,this._formSelf=function(){var t=$("");e.element.children(".mrge-support-elements").append(t),this.element=t},this.prepareToLoad=function(){this.element.contents().empty()},this.getData=function(){return this.element.contents().find("body").text()?JSON.parse(this.element.contents().find("body").text()):null},this._formSelf()},Loader:function(e){this.editor=e,this.element=null,this._formSelf=function(){var t=$("
");e.element.append(t),this.element=t},this._formSelf(),this.showLoader=function(){this.element.addClass("active")},this.hideLoader=function(){this.element.removeClass("active")}},EditorError:function(e){this.editor=e,this.exec=function(t){e.element.text(t)}},SelectionManager:function(e){this.editor=e,this.getInternalRange=function(){var t;if(e._window.getSelection){if(t=e._window.getSelection(),t.rangeCount)return t.getRangeAt(0)}else if(e._window.document.selection)return e._window.document.selection.createRange();return null},this.restoreInternalRange=function(t){if(null!=t)if(t.select)t.select();else{var n=e._window.getSelection();n.removeAllRanges(),n.addRange(t)}},this.getCustomSelection=function(){var e={},t=this.editor._window;return t.getSelection?e.selection=t.getSelection():e.range=t.document.selection.createRange(),e},this.isLastEmptyPTagSelected=function(e){var t=e.selection;return this.isCaret(e)&&"P"==t.focusNode.nodeName&&"
"==t.focusNode.innerHTML&&1==$(t.focusNode).closest("body").children("p").length},this.isCaret=function(e){if(e.range)return 0==e.range.boundingWidth;var t=e.selection;return t.anchorOffset==t.focusOffset&&t.anchorNode==t.focusNode},this.getTopSelectedElements=function(e,t){var n,i,o,r;if(e.selection){if(n=e.selection,null===n.anchorNode)return[];if(i=this._getPreBodyNode(n.anchorNode),null===i)return[];if(t)return[i];o=this._getPreBodyNode(n.focusNode),r=$(i).position().top<$(o).position().top?this._getElementBetween(i,o):this._getElementBetween(o,i)}else r=this._ie8GetTopSelectedElements(e.range);return $.grep(r,function(e){return"DIV"!=e.nodeName})},this._ie8GetTopSelectedElements=function(t){var n=e._content,i=e.element.find("iframe").contents().find("html")[0].scrollTop,o=t.boundingTop+i,r=o+t.boundingHeight,a=n.children(),s=[];return $(a).each(function(){(this.offsetTop>=o||this.offsetTop+this.offsetHeight>o)&&this.offsetTop *").get(0)},this._getElementBetween=function(e,t){var n,i;for(n=e,i=[];n!=t;)i.push(n),n=n.nextSibling;return i.push(t),i},this.clearSelection=function(){var t;e._window.getSelection?(t=e._window.getSelection(),t.removeAllRanges()):e._window.document.selection.empty()}},_actionManagerMethodInitialize:function(){this.ActionManager.prototype.enableAction=function(e){var t=this.actions[e];t.actionEnable();var n=$.inArray(e,this.disabledActions);-1!=n&&this.disabledActions.splice(n,1)}},_actionMethodsInitialize:function(){this.Action.prototype.actionEnable=function(){this.element.removeClass("mrge-disabled"),$(this.element).css("background",this.config.view.icon),this.enabled=!0}},_getBrowser:function(){var e={},t=navigator.userAgent;if(-1!=t.indexOf("WebKit"))e.webkit=!0;else if(-1!=t.indexOf("Firefox"))e.ff=!0;else if(-1!=t.indexOf("MSIE")){if(/MSIE\s([\d.]+)/.test(navigator.userAgent)){var n=parseInt(RegExp.$1);8==n?e.ie=8:n>8&&(e.ie=!0)}}else t.indexOf("Trident")&&(e.ie=!0);return e.ie||e.ff||e.webkit||(e.nonSupported=!0),e},_prepare:function(){return this._browser=this._getBrowser(),this._browser.nonSupported?(new this.EditorError(this).exec(this.options.notSupportedMsg),!1):(this._actionMethodsInitialize(),this._actionManagerMethodInitialize(),this._blockMethodsInitialize(this),!0)},_createSupportObjects:function(){this._actionManager=new this.ActionManager(this),this._selectionManager=new this.SelectionManager(this),this._actionSupport=new this.ActionSupport(this)},_createSupportObjectsAfterBuildHTML:function(){this._popup=new this.Popup(this),this._uploader=new this.Uploader(this),this._loader=new this.Loader(this),this._blockManager=new this.BlockManager(this)},_buildHTML:function(){new this.Builder(this).exec()},_bindEvents:function(){var e=new this.EventBinder(this);e.bindDefaultEvents(),e.bindCustomEvents()},_setupForBrowser:function(){this._browser.ie&&$.each(this.element.find("*"),function(){$(this).attr("unselectable","on")})},_create:function(){this._prepare()&&(this._createSupportObjects(),this._buildHTML(),this._createSupportObjectsAfterBuildHTML(),this._bindEvents(),this._setupForBrowser())},html:function(e){if(e){var t=this._content.children();return t.detach(),this._content.append(e).get(0)}var n,i=this._content.clone();return i.find(".mrge-temp-support-element").remove(),i.find("br").remove(),i.find("b").each(function(){n=this.innerHTML,$(this).replaceWith($("").html(n))}),i.find("i").each(function(){n=this.innerHTML,$(this).replaceWith($("").html(n))}),i.html()}});;TI"required_assets_digest;TI"%1a7012f3e3385b48586c0ec458b97af1;FI" _version;TI"%d3e06ca2fe4671e7a5d4e3d53c3b6cb3;F