File Manager

Current Directory: /home/astoriaah/www/old15/components/com_jce/editor/tiny_mce/plugins/source/js
Viewing File: /home/astoriaah/www/old15/components/com_jce/editor/tiny_mce/plugins/source/js/editor.min.js
/* jce - 2.6.26 | 2018-01-31 | http://www.joomlacontenteditor.net | Copyright (C) 2006 - 2018 Ryan Demmer. All rights reserved | GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */ function debounce(callback,time){var timer,func;return func=function(){var args=arguments;clearTimeout(timer),timer=setTimeout(function(){callback.apply(this,args)},time)},func.stop=function(){clearTimeout(timer)},func}function isWidgetkit(ed){return window.parent&&window.parent.widgetkit&&ed.id.indexOf("wk_")!==-1}var tinyMCEPopup={init:function(){var self=this,win=this.getWin(),tinymce=win.tinymce||!1;self.editor=!!tinymce&&tinymce.EditorManager.activeEditor},getLang:function(n,dv){var lang=jQuery.Plugin.getLanguage();return jQuery.Plugin.i18n[lang+".dlg."+n]||dv},getWin:function(){return!window.frameElement&&window.dialogArguments||opener||parent||top},getParam:function(n,v){if(this.editor)return this.editor.getParam(n,dv)},storeSelection:function(){this.editor.windowManager.bookmark=this.editor.selection.getBookmark(1)},restoreSelection:function(){this.editor.selection.moveToBookmark(this.editor.windowManager.bookmark)},execCommand:function(cmd,ui,val,a){return a=a||{},a.skip_focus=1,this.restoreSelection(),this.editor.execCommand(cmd,ui,val,a)},addI18n:function(p,o){var win=this.getWin();return win.tinyMCE?win.tinyMCE.addI18n(p,o):jQuery.Plugin.addI18n(p,o)}};tinyMCEPopup.init();var tinyMCE={addI18n:function(p,o){return tinyMCEPopup.addI18n(p,o)}};!function($){var SourceEditor={options:{format:!0,width:"100%",height:"100%",theme:"textmate",font_size:"",load:function(){},change:function(){},fullscreen:!1,editor:{}},init:function(options,content,selection){var self=this;$.extend(this.options,options),$(document).ready(function(){self._createToolbar(),self.options.format&&(content=self._format(content)),self._load(content)})},formatHTML:function(html,options){return options=$.extend({indent_size:1,indent_char:"\t",unformatted:["a","abbr","acronym","b","bdo","big","br","cite","code","dfn","em","i","img","input","kbd","label","q","samp","select","small","span","strong","sub","sup","textarea","tt","var","pre"],max_char:0,wrap_line_length:0},options),"undefined"!=typeof html_beautify?html_beautify(html,options):html},_createToolbar:function(){var self=this,o=this.options;document;$(".source-editor .uk-navbar button").click(function(e){e.preventDefault();var action=$(this).data("action");if("search"==action||"search-previous"==action){var f=$("#source_search_value").val(),prev=!("search-previous"!=action);self.search(f,prev,$("#source_search_regex").prop("checked"))}if("replace"==action||"replace-all"==action){var f=$("#source_search_value").val(),r=$("#source_replace_value").val(),all=!("replace-all"!=action);return self.replace(f,r,all,$("#source_search_regex").prop("checked"))}var fn=self[action]||function(){};$(this).hasClass("uk-button-checkbox")&&$(this).toggleClass("uk-active"),fn.call(self,$(this).hasClass("uk-active"))}).filter(".uk-button-checkbox").each(function(){var action=$(this).data("action");o[action]&&$(this).addClass("uk-active")}),$('.source-editor .uk-navbar button[data-action="fullscreen"]').addClass("uk-active",o.fullscreen),$("#source_search_value").change(function(){""===this.value&&self.clearSearch()})},setButtonState:function(button,state){$('.source-editor .uk-navbar button[data-action="'+button+'"]').toggleClass("uk-active",state)},_format:function(html,validate){return validate&&parser.parse(html),this.formatHTML(html)},_load:function(content,selection){var cm,o=this.options;if(window.CodeMirror){"codemirror"==o.theme&&(o.theme="default");var settings={mode:"text/html",theme:o.theme,indentWithTabs:!0,smartIndent:!0,tabMode:"indent",styleActiveLine:!0,highlightSelectionMatches:!!o.selection_match,autoCloseTags:!!o.tag_closing};cm=CodeMirror($(".source-editor-container").get(0),settings),cm.setWrap=function(s){cm.setOption("lineWrapping",s);try{cm.focus()}catch(e){}},o.font_size&&(/px/.test(o.font_size)||(o.font_size+="px"),cm.getWrapperElement().style.fontSize=o.font_size),cm.showGutter=function(s){cm.setOption("lineNumbers",s);try{cm.focus()}catch(e){}},cm.highlight=function(s){var c=cm.getCursor();s?cm.setOption("mode","text/html"):cm.setOption("mode","text/plain"),cm.setCursor(c);try{cm.focus()}catch(e){}},cm.resize=function(w,h,init){cm.setSize(w||null,h)},cm.showInvisibles=function(s){},cm.setContent=function(v){""===v&&(v=" "),cm.setValue(v);try{cm.focus()}catch(e){}},cm.insertContent=function(v){return cm.replaceSelection(v)},cm.getContent=function(){var value=cm.getValue();return value=value.replace(/^\s*|\s*$/g,"")},cm.getSearchState=function(){function SearchState(){this.posFrom=this.posTo=this.query=null,this.marked=[]}return cm.state.search||(cm.state.search=new SearchState)},cm.clearSearch=function(){cm.operation(function(){var state=cm.getSearchState(cm);if(state.query){state.query=null;for(var i=0;i<state.marked.length;++i)state.marked[i].clear();state.marked.length=0,cm.removeOverlay(state.overlay)}})},cm.search=function(query,rev,re){function searchOverlay(query){return"string"==typeof query?{token:function(stream){return stream.match(query)?"searching":(stream.next(),void(stream.skipTo(query.charAt(0))||stream.skipToEnd()))}}:{token:function(stream){if(stream.match(query))return"searching";for(;!stream.eol()&&(stream.next(),!stream.match(query,!1)););}}}function getSearchCursor(cm,query,pos){return cm.getSearchCursor(query,pos,"string"==typeof query&&query==query.toLowerCase())}function doSearch(cm,rev,query){var state=cm.getSearchState(cm);return state.query?findNext(cm,rev):void(query&&(state.query=query,cm.removeOverlay(state.overlay),state.overlay=searchOverlay(state.query),cm.addOverlay(state.overlay),state.posFrom=state.posTo=cm.getCursor(),findNext(cm,rev)))}function findNext(cm,rev){cm.operation(function(){var state=cm.getSearchState(),cursor=getSearchCursor(cm,state.query,rev?state.posFrom:state.posTo);(cursor.find(rev)||(cursor=getSearchCursor(cm,state.query,rev?CodeMirror.Pos(cm.lastLine()):CodeMirror.Pos(cm.firstLine(),0)),cursor.find(rev)))&&(cm.setSelection(cursor.pos.from,cursor.pos.to),state.posFrom=cursor.pos.from,state.posTo=cursor.pos.to,cm.scrollIntoView(cursor.pos.from))})}re&&(query=new RegExp(query));var state=cm.getSearchState(cm);state.query!==query&&cm.clearSearch(),doSearch(cm,rev,query)},cm.replace=function(query,text,all,re){function advance(){var match,start=cursor.pos.from;return(match=cursor.findNext())||(cursor=cm.getSearchCursor(query),start&&(match=cursor.findNext())&&(cursor.pos.from.line!=start.line||cursor.pos.from.ch!=start.ch))?(cm.setSelection(cursor.pos.from,cursor.pos.to),doReplace(match),cm.setCursor(cursor.pos.to),cm.scrollIntoView(cursor.pos.to),void cm.focus()):(cm.focus(),!1)}function doReplace(match){cursor.replace("string"==typeof query?text:text.replace(/\$(\d)/,function(w,i){return match[i]}))}if(re&&(query=new RegExp(query,"g")),all)for(var cursor=cm.getSearchCursor(query);cursor.findNext();)if("string"!=typeof query){var match=cm.getRange(cursor.from(),cursor.to()).match(query);if(!match)return;cursor.replace(text.replace(/\$(\d)/g,function(w,i){return match[i]}))}else cursor.replace(text);else{cm.clearSearch();var cursor=cm.getSearchCursor(query,cm.getCursor());advance()}},cm.format=function(){function getSelectedRange(){return{from:cm.getCursor(!0),to:cm.getCursor(!1)}}CodeMirror.commands.selectAll(cm);var range=getSelectedRange();cm.autoFormatRange(range.from,range.to)},o.font_size&&(/[^\D]/.test(o.font_size)&&(o.font_size+="px"),cm.getWrapperElement().style.fontSize=o.font_size),this.editor=cm,this._loaded(content),selection&&cm.search(selection),cm.on("change",function(e,obj){o.change.call();var history=cm.historySize();$('.source-editor .uk-navbar button[data-action="undo"]').prop("disabled",!history.undo),$('.source-editor .uk-navbar button[data-action="redo"]').prop("disabled",!history.redo)});var ed=o.editor,source=ed.plugins.source;if(source&&isWidgetkit(ed)){var keyup=debounce(function(e){var value=cm.getValue();value=value.replace(/^\s*|\s*$/g,""),source.save(value,!0)},300);cm.on("keyup",keyup),cm.on("cut",keyup),cm.on("paste",keyup),cm.on("drop",keyup)}cm.refresh()}},_loaded:function(content){var o=this.options;this.setContent(content),this.wrap(!!o.wrap),this.linenumbers(!!o.linenumbers),o.load.call(),this.focus()},search:function(find,rev,re){return this.editor.search(find,rev,re)},replace:function(find,replace,all,re){return this.editor.replace(find,replace,all,re)},clearSearch:function(){return this.editor.clearSearch()},getSelection:function(){return this.editor.getSelection()},wrap:function(s){return this.editor.setWrap(s)},linenumbers:function(s){return this.editor.showGutter(s)},highlight:function(s){return this.editor.highlight(s)},setContent:function(v,format){return format&&(v=this._format(v)),this.editor.setContent(v)},insertContent:function(v){return this.editor.insertContent(v)},getContent:function(){return this.editor.getContent()},save:function(){return this.editor.getContent()},showInvisibles:function(s){return this.editor.showInvisibles(s)},resize:function(w,h,init){h-=$(".uk-navbar").outerHeight(),$(".source-editor-container").css({width:w,height:h})},focus:function(){return this.editor.focus()},undo:function(){this.editor.undo(),this.focus()},redo:function(){this.editor.redo(),this.focus()},indent:function(){},getContainer:function(){return this.container||null},format:function(){var html=this.getContent();html=this._format(html),this.setContent(html)},fullscreen:function(){var ed=tinyMCEPopup.editor;if(ed)return ed.execCommand("mceFullScreen",!1)}};window.SourceEditor=SourceEditor}(jQuery);