comfortable_mexican_sofa 1.5.11 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -2
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/app/assets/images/comfortable_mexican_sofa/checkerboard.gif +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/elrte-toolbar.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/google-maps.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/iframe.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-director.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-flash.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-quicktime.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-realaudio.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-rutube.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-vimeo.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-winmedia.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-youtube.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/outline-div.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/outline-p.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/pagebreak.gif +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/pixel.gif +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/evilgrin.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/grin.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/happy.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/smile.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/surprised.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/tongue.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/unhappy.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/waii.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/wink.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/x.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/application.js +28 -3
- data/app/assets/javascripts/comfortable_mexican_sofa/codemirror/codemirror.js +1 -1
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js +35 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.js +267 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.sofa_image.js +61 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.sofa_link.js +58 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/jquery.js +4 -18
- data/app/assets/stylesheets/comfortable_mexican_sofa/application.css +3 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/codemirror.css +6 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/content.css +0 -65
- data/app/assets/stylesheets/comfortable_mexican_sofa/dialogs.css +45 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/elrte.css +173 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/files.css +82 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/form.css +2 -2
- data/app/assets/stylesheets/comfortable_mexican_sofa/structure.css +1 -1
- data/app/assets/stylesheets/comfortable_mexican_sofa/widgets.css +14 -56
- data/app/controllers/cms_admin/categories_controller.rb +2 -2
- data/app/controllers/cms_admin/dialogs_controller.rb +13 -0
- data/app/controllers/cms_admin/files_controller.rb +4 -1
- data/app/controllers/cms_admin/revisions_controller.rb +2 -2
- data/app/controllers/cms_content_controller.rb +1 -1
- data/app/models/cms/block.rb +2 -2
- data/app/models/cms/category.rb +3 -0
- data/app/models/cms/file.rb +9 -1
- data/app/models/cms/layout.rb +2 -2
- data/app/models/cms/page.rb +7 -5
- data/app/models/cms/site.rb +10 -5
- data/app/models/cms/snippet.rb +5 -3
- data/app/views/cms_admin/categories/_form.html.erb +1 -1
- data/app/views/cms_admin/categories/_index.html.erb +2 -2
- data/app/views/cms_admin/dialogs/image.html.erb +7 -0
- data/app/views/cms_admin/dialogs/link.html.erb +5 -0
- data/app/views/cms_admin/files/_file.html.erb +17 -9
- data/app/views/cms_admin/files/_index.html.erb +8 -18
- data/app/views/cms_admin/files/create.js.erb +1 -1
- data/app/views/cms_admin/layouts/_form.html.erb +1 -1
- data/app/views/cms_admin/layouts/_index_branch.html.erb +1 -1
- data/app/views/cms_admin/pages/_form_blocks.html.erb +1 -1
- data/app/views/cms_admin/revisions/show.html.erb +1 -1
- data/app/views/cms_admin/sites/_form.html.erb +2 -1
- data/app/views/cms_admin/snippets/_form.html.erb +1 -1
- data/app/views/cms_admin/snippets/index.html.erb +1 -1
- data/app/views/layouts/cms_admin/_head.html.erb +7 -6
- data/comfortable_mexican_sofa.gemspec +46 -47
- data/config/initializers/paperclip.rb +0 -25
- data/config/locales/en.yml +6 -0
- data/config/locales/es.yml +6 -0
- data/config/routes.rb +3 -2
- data/db/migrate/01_create_cms.rb +37 -35
- data/db/migrate/upgrades/07_upgrade_to_1_6_0.rb +25 -0
- data/lib/comfortable_mexican_sofa/error.rb +4 -4
- data/lib/comfortable_mexican_sofa/extensions/is_categorized.rb +3 -1
- data/lib/comfortable_mexican_sofa/extensions/is_mirrored.rb +8 -8
- data/lib/comfortable_mexican_sofa/fixtures.rb +19 -19
- data/lib/comfortable_mexican_sofa/form_builder.rb +4 -4
- data/lib/comfortable_mexican_sofa/render_methods.rb +8 -8
- data/lib/comfortable_mexican_sofa/tag.rb +14 -13
- data/lib/comfortable_mexican_sofa/tags/asset.rb +6 -6
- data/lib/comfortable_mexican_sofa/tags/collection.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/field_datetime.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/field_integer.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/field_string.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/field_text.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/file.rb +5 -5
- data/lib/comfortable_mexican_sofa/tags/helper.rb +4 -4
- data/lib/comfortable_mexican_sofa/tags/page_datetime.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/page_file.rb +8 -6
- data/lib/comfortable_mexican_sofa/tags/page_files.rb +6 -4
- data/lib/comfortable_mexican_sofa/tags/page_integer.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/page_rich_text.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/page_string.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/page_text.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/partial.rb +4 -4
- data/lib/comfortable_mexican_sofa/tags/snippet.rb +5 -4
- data/lib/comfortable_mexican_sofa/view_methods.rb +6 -6
- data/test/fixtures/cms/blocks.yml +2 -2
- data/test/fixtures/cms/categories.yml +1 -0
- data/test/fixtures/cms/layouts.yml +3 -3
- data/test/fixtures/cms/revisions.yml +4 -4
- data/test/fixtures/cms/sites.yml +1 -0
- data/test/fixtures/cms/snippets.yml +1 -1
- data/test/fixtures/files/data.zip +0 -0
- data/test/functional/cms_admin/dialogs_controller_test.rb +24 -0
- data/test/functional/cms_admin/files_controller_test.rb +1 -1
- data/test/functional/cms_admin/layouts_controller_test.rb +7 -7
- data/test/functional/cms_admin/pages_controller_test.rb +34 -35
- data/test/functional/cms_admin/revisions_controller_test.rb +2 -2
- data/test/functional/cms_admin/sites_controller_test.rb +3 -2
- data/test/functional/cms_admin/snippets_controller_test.rb +8 -8
- data/test/functional/cms_content_controller_test.rb +10 -11
- data/test/gemfiles/{Gemfile.rails-3.0.10 → Gemfile.rails-3.0} +1 -1
- data/test/gemfiles/{Gemfile.rails-3.1.1 → Gemfile.rails-3.1} +1 -1
- data/test/integration/fixtures_test.rb +4 -4
- data/test/integration/mirrors_test.rb +1 -1
- data/test/integration/render_cms_test.rb +10 -10
- data/test/integration/sites_test.rb +3 -3
- data/test/test_helper.rb +3 -0
- data/test/unit/fixtures_test.rb +11 -11
- data/test/unit/mirrors_test.rb +25 -25
- data/test/unit/models/block_test.rb +29 -29
- data/test/unit/models/categorization_test.rb +1 -1
- data/test/unit/models/category_test.rb +2 -2
- data/test/unit/models/file_test.rb +18 -0
- data/test/unit/models/layout_test.rb +21 -18
- data/test/unit/models/page_test.rb +3 -3
- data/test/unit/models/site_test.rb +26 -17
- data/test/unit/models/snippet_test.rb +6 -6
- data/test/unit/revisions_test.rb +13 -13
- data/test/unit/tag_test.rb +39 -45
- data/test/unit/tags/asset_test.rb +1 -1
- data/test/unit/tags/collection_test.rb +12 -10
- data/test/unit/tags/field_datetime_test.rb +3 -3
- data/test/unit/tags/field_integer_test.rb +3 -3
- data/test/unit/tags/field_string_test.rb +4 -4
- data/test/unit/tags/field_text_test.rb +3 -3
- data/test/unit/tags/file_test.rb +1 -1
- data/test/unit/tags/helper_test.rb +3 -3
- data/test/unit/tags/page_datetime_test.rb +3 -3
- data/test/unit/tags/page_file_test.rb +7 -4
- data/test/unit/tags/page_files_test.rb +7 -4
- data/test/unit/tags/page_integer_test.rb +3 -3
- data/test/unit/tags/page_rich_text_test.rb +3 -3
- data/test/unit/tags/page_string_test.rb +3 -3
- data/test/unit/tags/page_text_test.rb +4 -4
- data/test/unit/tags/partial_test.rb +4 -4
- data/test/unit/tags/snippet_test.rb +3 -3
- metadata +51 -52
- data/app/assets/images/comfortable_mexican_sofa/wym_icons.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-blockquote.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h1.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h2.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h3.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h4.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h5.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h6.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-p.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-pre.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/wymiframe.css +0 -52
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/wymiframe.html +0 -26
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/jquery.wymeditor.cms.js +0 -342
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/jquery.wymeditor.embed.js +0 -19
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/jquery.wymeditor.pack.js +0 -1
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/bg.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/ca.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/cs.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/cy.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/de.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/en.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/es.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/fa.js +0 -46
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/fi.js +0 -44
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/fr.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/gl.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/he.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/hr.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/hu.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/it.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/nb.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/nl.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/nn.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/pl.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/pt-br.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/pt.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/ru.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/sv.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/tr.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/zh_cn.js +0 -47
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.6.0
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -3,8 +3,13 @@
|
|
3
3
|
//= require comfortable_mexican_sofa/jquery_ui_timepicker.js
|
4
4
|
//= require comfortable_mexican_sofa/rails.js
|
5
5
|
//= require comfortable_mexican_sofa/codemirror/codemirror.js
|
6
|
+
//= require comfortable_mexican_sofa/elrte/elrte.js
|
7
|
+
//= require comfortable_mexican_sofa/elrte/elrte.codemirror.js
|
8
|
+
//= require comfortable_mexican_sofa/elrte/elrte.sofa_link.js
|
9
|
+
//= require comfortable_mexican_sofa/elrte/elrte.sofa_image.js
|
6
10
|
|
7
11
|
$.CMS = function(){
|
12
|
+
|
8
13
|
var current_path = window.location.pathname;
|
9
14
|
var admin_path_prefix = $('meta[name="cms-admin-path"]').attr('content');
|
10
15
|
|
@@ -24,6 +29,14 @@ $.CMS = function(){
|
|
24
29
|
});
|
25
30
|
|
26
31
|
return {
|
32
|
+
|
33
|
+
// Configuration that can be overriden from the outside. For example:
|
34
|
+
// $.CMS.config.elRTE.toolbar = ['undoredo']
|
35
|
+
config: {
|
36
|
+
'elRTE': {
|
37
|
+
toolbar: ['undoredo', 'sofa_format', 'sofa_style', 'sofa_alignment', 'lists', 'sofa_copypaste', 'sofa_image', 'sofa_links']
|
38
|
+
}
|
39
|
+
},
|
27
40
|
|
28
41
|
enable_sortable_list: function(){
|
29
42
|
$('.sortable, ul.sortable ul').sortable({
|
@@ -75,7 +88,19 @@ $.CMS = function(){
|
|
75
88
|
},
|
76
89
|
|
77
90
|
enable_rich_text: function(){
|
78
|
-
|
91
|
+
elRTE.prototype.options.panels.sofa_style = ['bold', 'italic', 'underline'];
|
92
|
+
elRTE.prototype.options.panels.sofa_alignment = ['justifyleft', 'justifycenter', 'justifyright'];
|
93
|
+
elRTE.prototype.options.panels.sofa_format = ['formatblock'];
|
94
|
+
elRTE.prototype.options.panels.sofa_copypaste = ['pasteformattext'];
|
95
|
+
elRTE.prototype.options.panels.sofa_links = ['sofa_link', 'unlink'];
|
96
|
+
|
97
|
+
elRTE.prototype.options.toolbars.sofa = $.CMS.config.elRTE.toolbar;
|
98
|
+
|
99
|
+
$('textarea.rich_text').elrte({
|
100
|
+
height: 300,
|
101
|
+
toolbar: 'sofa',
|
102
|
+
styleWithCSS: false
|
103
|
+
});
|
79
104
|
},
|
80
105
|
|
81
106
|
enable_codemirror: function(){
|
@@ -146,8 +171,8 @@ $.CMS = function(){
|
|
146
171
|
},
|
147
172
|
|
148
173
|
enable_uploader : function(){
|
149
|
-
var action = $('
|
150
|
-
$('
|
174
|
+
var action = $('.file_uploads form').attr('action');
|
175
|
+
$('.file_uploads input[type=file]').change(function(){
|
151
176
|
var files = $($(this).get(0).files);
|
152
177
|
files.each(function(i, file){
|
153
178
|
var xhr = new XMLHttpRequest();
|
@@ -1 +1 @@
|
|
1
|
-
var CodeMirror=function(){function a(b,c){function bv(a){return a>=0&&a<$.length}function bx(a){ba=null;var b={line:0,ch:0};bH(b,{line:$.length-1,ch:$[$.length-1].text.length},N(a),b,b),ba=new j,bg=!0}function by(a){var b=[];for(var c=0,d=$.length;c<d;++c)b.push($[c].text);return b.join("\n")}function bz(a){function h(){bW(),bg=!0,j(),k()}function i(a){var b=cH(a,!0);if(b&&!G(b,e)){bb||bF(),e=b,ce(d,b),bg=!1;var c=b$();if(b.line>=c.to||b.line<c.from)f=setTimeout(cU(function(){i(a)}),150)}}for(var b=p(a);b!=w;b=b.parentNode)if(b.parentNode==J&&b!=Q)return;var c=bf;bf=null;for(var b=p(a);b!=w;b=b.parentNode)if(b.parentNode==S)return g.onGutterClick&&g.onGutterClick(bw,M(S.childNodes,b)+bl,a),m(a);var d=cH(a);switch(q(a)){case 3:u&&!z&&cI(a);return;case 2:d&&cg(d.line,d.ch,!0);return}if(!d){p(a)==D&&m(a);return}bb||bF(),m(a);if(c&&+(new Date)-c<400)return cn(d.line);cg(d.line,d.ch,!0);var e=d,f,j=r(n,"mousemove",cU(function(a){clearTimeout(f),m(a),i(a)}),!0),k=r(n,"mouseup",cU(function(a){clearTimeout(f);var b=cH(a);b&&ce(d,b),m(a),h()}),!0)}function bA(a){var b=cH(a);if(!b)return;cm(b),m(a),bf=+(new Date)}function bB(a){a.preventDefault();var b=cH(a,!0),c=a.dataTransfer.files;if(!b||g.readOnly)return;if(c&&c.length&&window.FileReader&&window.File){function d(a,c){var d=new FileReader;d.onload=function(){f[c]=d.result,++h==e&&bM(f.join(""),ci(b),ci(b))},d.readAsText(a)}var e=c.length,f=Array(e),h=0;for(var i=0;i<e;++i)d(c[i],i)}else try{var f=a.dataTransfer.getData("Text");f&&bM(f,b,b)}catch(a){}}function bC(a){bb||bF();var b=a.keyCode;v&&b==27&&(a.returnValue=!1);var c=(z?a.metaKey:a.ctrlKey)&&!a.altKey,d=a.ctrlKey||a.altKey||a.metaKey;b==16||a.shiftKey?bd=bd||(bc.inverted?bc.to:bc.from):bd=null;if(g.onKeyEvent&&g.onKeyEvent(bw,l(a)))return;if(b==33||b==34)return cj(b==34),m(a);if(c&&(b==36||b==35||z&&(b==38||b==40)))return ck(b==36||b==38),m(a);if(c&&b==65)return cl(),m(a);if(!g.readOnly){if(!d&&b==13)return;if(!d&&b==9&&cp(a.shiftKey))return m(a);if(c&&b==90)return bJ(),m(a);if(c&&(a.shiftKey&&b==90||b==89))return bK(),m(a)}if(b==36&&g.smartHome)return cq(),m(a);bo=(c?"c":"")+(a.altKey?"a":"")+b;if(bc.inverted&&A[bo]===!0){var e=O(C);e&&(be={anchor:e.start},P(C,e.start,e.start))}!c&&!a.altKey&&(bo=null),bT(bo)}function bD(a){if(g.onKeyEvent&&g.onKeyEvent(bw,l(a)))return;be&&(be=null,bg=!0),a.keyCode==16&&(bd=null)}function bE(a){if(g.onKeyEvent&&g.onKeyEvent(bw,l(a)))return;if(g.electricChars&&Z.electricChars){var b=String.fromCharCode(a.charCode==null?a.keyCode:a.charCode);Z.electricChars.indexOf(b)>-1&&setTimeout(cU(function(){cr(bc.to.line,"smart")}),50)}var c=a.keyCode;c==13?(g.readOnly||co(),m(a)):!a.ctrlKey&&!a.altKey&&!a.metaKey&&c==9&&g.tabMode!="default"?m(a):bT(bo)}function bF(){if(g.readOnly=="nocursor")return;bb||(g.onFocus&&g.onFocus(bw),bb=!0,w.className.search(/\bCodeMirror-focused\b/)==-1&&(w.className+=" CodeMirror-focused"),bk||bV()),bS(),cJ()}function bG(){bb&&(g.onBlur&&g.onBlur(bw),bb=!1,w.className=w.className.replace(" CodeMirror-focused","")),clearInterval(Y),setTimeout(function(){bb||(bd=null)},150)}function bH(a,b,c,d,e){if(ba){var f=[];for(var h=a.line,i=b.line+1;h<i;++h)f.push($[h].text);ba.addChange(a.line,c.length,f);while(ba.done.length>g.undoDepth)ba.done.shift()}bL(a,b,c,d,e)}function bI(a,b){var c=a.pop();if(c){var d=[],e=c.start+c.added;for(var f=c.start;f<e;++f)d.push($[f].text);b.push({start:c.start,added:c.old.length,old:d});var g=ci({line:c.start+c.old.length-1,ch:L(d[d.length-1],c.old[c.old.length-1])});bL({line:c.start,ch:0},{line:e-1,ch:$[e-1].text.length},c.old,g,g),bg=!0}}function bJ(){bI(ba.done,ba.undone)}function bK(){bI(ba.undone,ba.done)}function bL(a,b,c,d,e){function s(a){return a<=Math.min(b.line,b.line+q)?a:a+q}var f=!1,g=br.length;for(var i=a.line;i<=b.line;++i)if($[i].text.length==g){f=!0;break}var j=b.line-a.line,k=$[a.line],l=$[b.line];if(k==l)if(c.length==1)k.replace(a.ch,b.ch,c[0]);else{l=k.split(b.ch,c[c.length-1]);var m=[a.line+1,j];k.replace(a.ch,k.text.length,c[0]);for(var i=1,n=c.length-1;i<n;++i)m.push(new h(c[i]));m.push(l),$.splice.apply($,m)}else if(c.length==1)k.replace(a.ch,k.text.length,c[0]+l.text.slice(b.ch)),$.splice(a.line+1,j);else{var m=[a.line+1,j-1];k.replace(a.ch,k.text.length,c[0]),l.replace(0,b.ch,c[c.length-1]);for(var i=1,n=c.length-1;i<n;++i)m.push(new h(c[i]));$.splice.apply($,m)}for(var i=a.line,n=i+c.length;i<n;++i){var o=$[i].text;o.length>g&&(br=o,g=o.length,bs=null,f=!1)}if(f){g=0,br="",bs=null;for(var i=0,n=$.length;i<n;++i){var o=$[i].text;o.length>g&&(g=o.length,br=o)}}var p=[],q=c.length-j-1;for(var i=0,o=_.length;i<o;++i){var r=_[i];r<a.line?p.push(r):r>b.line&&p.push(r+q)}c.length<5?(cO(a.line,a.line+c.length),p.push(a.line+c.length)):p.push(a.line),_=p,cQ(100),bh.push({from:a.line,to:b.line+1,diff:q}),bi={from:a,to:b,text:c},cf(d,e,s(bc.from.line),s(bc.to.line)),J.style.height=$.length*cE()+2*cF()+"px"}function bM(a,b,c){function d(d){if(H(d,b))return d;if(!H(c,d))return e;var f=d.line+a.length-(c.line-b.line)-1,g=d.ch;return d.line==c.line&&(g+=a[a.length-1].length-(c.ch-(c.line==b.line?b.ch:0))),{line:f,ch:g}}b=ci(b),c?c=ci(c):c=b,a=N(a);var e;return bO(a,b,c,function(a){return e=a,{from:d(bc.from),to:d(bc.to)}}),e}function bN(a,b){bO(N(a),bc.from,bc.to,function(a){return b=="end"?{from:a,to:a}:b=="start"?{from:bc.from,to:bc.from}:{from:bc.from,to:a}})}function bO(a,b,c,d){var e=a.length==1?a[0].length+b.ch:a[a.length-1].length,f=d({line:b.line+a.length-1,ch:e});bH(b,c,a,f.from,f.to)}function bP(a,b){var c=a.line,d=b.line;if(c==d)return $[c].text.slice(a.ch,b.ch);var e=[$[c].text.slice(a.ch)];for(var f=c+1;f<d;++f)e.push($[f].text);return e.push($[d].text.slice(0,b.ch)),e.join("\n")}function bQ(){return bP(bc.from,bc.to)}function bS(){if(bR)return;W.set(2e3,function(){cR(),bU(),bb&&bS(),cS()})}function bT(a){function c(){cR();var d=bU();d&&a&&(d=="moved"&&A[a]==null&&(A[a]=!0),d=="changed"&&(A[a]=!1)),!d&&!b?(b=!0,W.set(80,c)):(bR=!1,bS()),cS()}var b=!1;bR=!0,W.set(20,c)}function bU(){function f(a,c){var d=0;for(;;){var e=b.indexOf("\n",d);if(e==-1||(b.charAt(e-1)=="\r"?e-1:e)>=a)return{line:c,ch:a-d};++c,d=e+1}}if(bk||!bb)return;var a=!1,b=C.value,c=O(C);if(!c)return!1;var a=bp.text!=b,d=be,e=a||c.start!=bp.start||c.end!=(d?bp.start:bp.end);if(!e&&!d)return!1;if(a){bd=be=null;if(g.readOnly)return bg=!0,"changed"}var h=f(c.start,bp.from),i=f(c.end,bp.from);if(d){var j=c.start==d.anchor?i:h,k=bd?bc.to:c.start==d.anchor?h:i;(bc.inverted=H(j,k))?(h=j,i=k):(be=null,h=k,i=j)}h.line==i.line&&h.line==bc.from.line&&h.line==bc.to.line&&!bd&&(bg=!1);if(a){var l=0,m=b.length,n=Math.min(m,bp.text.length),o,p=bp.from,q=-1;while(l<n&&(o=b.charAt(l))==bp.text.charAt(l))++l,o=="\n"&&(p++,q=l);var r=q>-1?l-q:l,s=bp.to-1,t=bp.text.length;for(;;){o=bp.text.charAt(t);if(b.charAt(m)!=o){++m,++t;break}o=="\n"&&s--;if(t<=l||m<=l)break;--m,--t}var q=bp.text.lastIndexOf("\n",t-1),u=q==-1?t:t-q-1;bH({line:p,ch:r},{line:s,ch:u},N(b.slice(l,m)),h,i);if(p!=s||h.line!=p)bg=!0}else cf(h,i);return bp.text=b,bp.start=c.start,bp.end=c.end,a?"changed":e?"moved":!1}function bV(){var a=[],b=Math.max(0,bc.from.line-1),c=Math.min($.length,bc.to.line+2);for(var d=b;d<c;++d)a.push($[d].text);a=C.value=a.join(x);var e=bc.from.ch,f=bc.to.ch;for(var d=b;d<bc.from.line;++d)e+=x.length+$[d].text.length;for(var d=b;d<bc.to.line;++d)f+=x.length+$[d].text.length;bp={text:a,from:b,to:c,start:e,end:f},P(C,e,be?e:f)}function bW(){g.readOnly!="nocursor"&&C.focus()}function bX(){if(!U.getBoundingClientRect)return;var a=U.getBoundingClientRect(),b=window.innerHeight||document.body.offsetHeight||document.documentElement.offsetHeight;(a.top<0||a.bottom>b)&&U.scrollIntoView()}function bY(){var a=cC(bc.inverted?bc.from:bc.to);return bZ(a.x,a.y,a.x,a.yBot)}function bZ(a,b,c,d){var e=cG(),f=cF(),h=cE();b+=f,d+=f,a+=e,c+=e;var i=D.clientHeight,j=D.scrollTop,k=!1,l=!0;b<j?(D.scrollTop=Math.max(0,b-2*h),k=!0):d>j+i&&(D.scrollTop=d+h-i,k=!0);var m=D.clientWidth,n=D.scrollLeft,o=g.fixedGutter?R.clientWidth:0;return a<n+o?(a<50&&(a=0),D.scrollLeft=Math.max(0,a-10-o),k=!0):c>m+n&&(D.scrollLeft=c+10-m,k=!0,c>J.clientWidth&&(l=!1)),k&&g.onScroll&&g.onScroll(bw),l}function b$(){var a=cE(),b=D.scrollTop-cF();return{from:Math.min($.length,Math.max(0,Math.floor(b/a))),to:Math.min($.length,Math.ceil((b+D.clientHeight)/a))}}function b_(a){if(!D.clientWidth){bl=bm=0;return}var b=a===!0?[]:[{from:bl,to:bm,domStart:0}];for(var c=0,d=a.length||0;c<d;++c){var e=a[c],f=[],g=e.diff||0;for(var h=0,i=b.length;h<i;++h){var j=b[h];e.to<=j.from?f.push({from:j.from+g,to:j.to+g,domStart:j.domStart}):j.to<=e.from?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from,domStart:j.domStart}),e.to<j.to&&f.push({from:e.to+g,to:j.to+g,domStart:j.domStart+(e.to-j.from)}))}b=f}var k=b$(),l=Math.min(bl,Math.max(k.from-3,0)),m=Math.min($.length,Math.max(bm,k.to+3)),n=[],o=0,p=bm-bl,q=l,r=0;for(var c=0,d=b.length;c<d;++c){var j=b[c];if(j.to<=l)continue;if(j.from>=m)break;if(j.domStart>o||j.from>q)n.push({from:q,to:j.from,domSize:j.domStart-o,domStart:o}),r+=j.from-q;q=j.to,o=j.domStart+(j.to-j.from)}if(o!=p||q!=m)r+=Math.abs(m-q),n.push({from:q,to:m,domSize:p-o,domStart:o});if(!n.length)return;V.style.display="none",r>(k.to-k.from)*.3?ca(l=Math.max(k.from-10,0),m=Math.min(k.to+7,$.length)):cb(n),V.style.display="";var s=l!=bl||m!=bm||bn!=D.clientHeight;bl=l,bm=m,Q.style.top=l*cE()+"px",s&&(bn=D.clientHeight,J.style.height=$.length*cE()+2*cF()+"px"),(s||n.length)&&cc(),bs==null&&(bs=cz(br)),bs>D.clientWidth?(T.style.width=bs+"px",J.style.width="",J.style.width=D.scrollWidth+"px"):T.style.width=J.style.width="";if(V.childNodes.length!=bm-bl)throw new Error("BAD PATCH! "+JSON.stringify(n)+" size="+(bm-bl)+" nodes="+V.childNodes.length);cd()}function ca(a,b){var c=[],d={line:a,ch:0},e=H(bc.from,d)&&!H(bc.to,d);for(var f=a;f<b;++f){var g=null,h=null;e?(g=0,bc.to.line==f&&(e=!1,h=bc.to.ch)):bc.from.line==f&&(bc.to.line==f?(g=bc.from.ch,h=bc.to.ch):(e=!0,g=bc.from.ch)),c.push($[f].getHTML(g,h,!0))}V.innerHTML=c.join("")}function cb(a){var b=bc.from.line,c=bc.to.line,d=0,e=t&&n.createElement("div");for(var f=0,g=a.length;f<g;++f){var h=a[f],i=h.to-h.from-h.domSize,j=V.childNodes[h.domStart+h.domSize+d]||null;if(t)for(var k=Math.max(-i,h.domSize);k>0;--k)V.removeChild(j?j.previousSibling:V.lastChild);else if(i){for(var k=Math.max(0,i);k>0;--k)V.insertBefore(n.createElement("pre"),j);for(var k=Math.max(0,-i);k>0;--k)V.removeChild(j?j.previousSibling:V.lastChild)}var l=V.childNodes[h.domStart+d],m=b<h.from&&c>=h.from;for(var k=h.from;k<h.to;++k){var o=null,p=null;m?(o=0,c==k&&(m=!1,p=bc.to.ch)):b==k&&(c==k?(o=bc.from.ch,p=bc.to.ch):(m=!0,o=bc.from.ch)),t?(e.innerHTML=$[k].getHTML(o,p,!0),V.insertBefore(e.firstChild,j)):(l.innerHTML=$[k].getHTML(o,p,!1),l.className=$[k].className||"",l=l.nextSibling)}d+=i}}function cc(){if(!g.gutter&&!g.lineNumbers)return;var a=Q.offsetHeight,b=D.clientHeight;R.style.height=(a-b<2?b:a)+"px";var c=[];for(var d=bl;d<Math.max(bm,bl+1);++d){var e=$[d].gutterMarker,f=g.lineNumbers?d+g.firstLineNumber:null;e&&e.text?f=e.text.replace("%N%",f!=null?f:""):f==null&&(f="\u00a0"),c.push(e&&e.style?'<pre class="'+e.style+'">':"<pre>",f,"</pre>")}R.style.display="none",S.innerHTML=c.join("");var h=String($.length).length,i=S.firstChild,j=F(i),k="";while(j.length+k.length<h)k+="\u00a0";k&&i.insertBefore(n.createTextNode(k),i.firstChild),R.style.display="",T.style.marginLeft=R.offsetWidth+"px"}function cd(){var a=bc.inverted?bc.from:bc.to,b=cE(),c=cA(a.line,a.ch);B.style.top=a.line*b-D.scrollTop+"px",B.style.left=c-D.scrollLeft+"px",G(bc.from,bc.to)?(U.style.top=(a.line-bl)*b+"px",U.style.left=c+"px",U.style.display=""):U.style.display="none"}function ce(a,b){var c=bd&&ci(bd);c&&(H(c,a)?a=c:H(b,c)&&(b=c)),cf(a,b)}function cf(a,b,c,d){if(G(bc.from,a)&&G(bc.to,b))return;if(H(b,a)){var e=b;b=a,a=e}G(a,b)?bc.inverted=!1:G(a,bc.to)?bc.inverted=!1:G(b,bc.from)&&(bc.inverted=!0),c==null&&(c=bc.from.line,d=bc.to.line),G(a,b)?G(bc.from,bc.to)||bh.push({from:c,to:d+1}):G(bc.from,bc.to)?bh.push({from:a.line,to:b.line+1}):(G(a,bc.from)||(a.line<c?bh.push({from:a.line,to:Math.min(b.line,c)+1}):bh.push({from:c,to:Math.min(d,a.line)+1})),G(b,bc.to)||(b.line<d?bh.push({from:Math.max(c,a.line),to:d+1}):bh.push({from:Math.max(a.line,d),to:b.line+1}))),bc.from=a,bc.to=b,bj=!0}function cg(a,b,c){var d=ci({line:a,ch:b||0});(c?ce:cf)(d,d)}function ch(a){return Math.max(0,Math.min(a,$.length-1))}function ci(a){if(a.line<0)return{line:0,ch:0};if(a.line>=$.length)return{line:$.length-1,ch:$[$.length-1].text.length};var b=a.ch,c=$[a.line].text.length;return b==null||b>c?{line:a.line,ch:c}:b<0?{line:a.line,ch:0}:a}function cj(a){var b=Math.floor(D.clientHeight/cE()),c=bc.inverted?bc.from:bc.to;cg(c.line+Math.max(b-1,1)*(a?1:-1),c.ch,!0)}function ck(a){var b=a?{line:0,ch:0}:{line:$.length-1,ch:$[$.length-1].text.length};ce(b,b)}function cl(){var a=$.length-1;cf({line:0,ch:0},{line:a,ch:$[a].text.length})}function cm(a){var b=$[a.line].text,c=a.ch,d=a.ch;while(c>0&&/\w/.test(b.charAt(c-1)))--c;while(d<b.length&&/\w/.test(b.charAt(d)))++d;ce({line:a.line,ch:c},{line:a.line,ch:d})}function cn(a){ce({line:a,ch:0},{line:a,ch:$[a].text.length})}function co(){bN("\n","end"),g.enterMode!="flat"&&cr(bc.from.line,g.enterMode=="keep"?"prev":"smart")}function cp(a){function b(a){if(G(bc.from,bc.to))return cr(bc.from.line,a);var b=bc.to.line-(bc.to.ch?0:1);for(var c=bc.from.line;c<=b;++c)cr(c,a)}bd=null;switch(g.tabMode){case"default":return!1;case"indent":b("smart");break;case"classic":if(G(bc.from,bc.to)){a?cr(bc.from.line,"smart"):bN("\t","end");break};case"shift":b(a?"subtract":"add")}return!0}function cq(){var a=Math.max(0,$[bc.from.line].text.search(/\S/));cg(bc.from.line,bc.from.ch<=a&&bc.from.ch?0:a,!0)}function cr(a,b){if(b=="smart")if(!Z.indent)b="prev";else var c=cN(a);var d=$[a],e=d.indentation(),f=d.text.match(/^\s*/)[0],h;b=="prev"?a?h=$[a-1].indentation():h=0:b=="smart"?h=Z.indent(c,d.text.slice(f.length)):b=="add"?h=e+g.indentUnit:b=="subtract"&&(h=e-g.indentUnit),h=Math.max(0,h);var i=h-e;if(!i){if(bc.from.line!=a&&bc.to.line!=a)return;var j=f}else{var j="",k=0;if(g.indentWithTabs)for(var l=Math.floor(h/y);l;--l)k+=y,j+="\t";while(k<h)++k,j+=" "}bM(j,{line:a,ch:0},{line:a,ch:f.length})}function cs(){Z=a.getMode(g,g.mode);for(var b=0,c=$.length;b<c;++b)$[b].stateAfter=null;_=[0],cQ()}function ct(){var a=g.gutter||g.lineNumbers;R.style.display=a?"":"none",a?cc():V.parentNode.style.marginLeft=0}function cu(a,b,c){function e(a,b,c,e){var a=$[a],f=a.addMark(b,c,e);f.line=a,d.push(f)}a=ci(a),b=ci(b);var d=[];if(a.line==b.line)e(a.line,a.ch,b.ch,c);else{e(a.line,a.ch,null,c);for(var f=a.line+1,g=b.line;f<g;++f)e(f,0,null,c);e(b.line,0,b.ch,c)}return bh.push({from:a.line,to:b.line+1}),function(){var a,b;for(var c=0;c<d.length;++c){var e=d[c],f=M($,e.line);e.line.removeMark(e),f>-1&&(a==null&&(a=f),b=f)}a!=null&&bh.push({from:a,to:b+1})}}function cv(a,b,c){return typeof a=="number"&&(a=$[ch(a)]),a.gutterMarker={text:b,style:c},cc(),a}function cw(a){typeof a=="number"&&(a=$[ch(a)]),a.gutterMarker=null,cc()}function cx(a,b){if(typeof a=="number"){var c=a;a=$[ch(a)]}else{var c=M($,a);if(c==-1)return null}return a.className!=b&&(a.className=b,bh.push({from:c,to:c+1})),a}function cy(a){if(typeof a=="number"){var b=a;a=$[a];if(!a)return null}else{var b=M($,a);if(b==-1)return null}var c=a.gutterMarker;return{line:b,text:a.text,markerText:c&&c.text,markerClass:c&&c.style}}function cz(a){return K.innerHTML="<pre><span>x</span></pre>",K.firstChild.firstChild.firstChild.nodeValue=a,K.firstChild.firstChild.offsetWidth||10}function cA(a,b){return b==0?0:(K.innerHTML="<pre><span>"+$[a].getHTML(null,null,!1,b)+"</span></pre>",K.firstChild.firstChild.offsetWidth)}function cB(a,b){function e(a){return K.innerHTML="<pre><span>"+c.getHTML(null,null,!1,a)+"</span></pre>",K.firstChild.firstChild.offsetWidth}if(b<=0)return 0;var c=$[a],d=c.text,f=0,g=0,h=d.length,i,j=Math.min(h,Math.ceil(b/cz("x")));for(;;){var k=e(j);if(k<=b&&j<h)j=Math.min(h,Math.ceil(j*1.2));else{i=k,h=j;break}}if(b>i)return h;j=Math.floor(h*.8),k=e(j),k<b&&(f=j,g=k);for(;;){if(h-f<=1)return i-b>b-g?f:h;var l=Math.ceil((f+h)/2),m=e(l);m>b?(h=l,i=m):(f=l,g=m)}}function cC(a,b){var c=cE(),d=a.line-(b?bl:0);return{x:cA(a.line,a.ch),y:d*c,yBot:(d+1)*c}}function cD(a){var b=cC(a,!0),c=E(T);return{x:c.left+b.x,y:c.top+b.y,yBot:c.top+b.yBot}}function cE(){var a=V.childNodes.length;return a?V.offsetHeight/a||1:(K.innerHTML="<pre>x</pre>",K.firstChild.offsetHeight||1)}function cF(){return T.offsetTop}function cG(){return T.offsetLeft}function cH(a,b){var c=E(D,!0),d,e;try{d=a.clientX,e=a.clientY}catch(a){return null}if(!b&&(d-c.left>D.clientWidth||e-c.top>D.clientHeight))return null;var f=E(T,!0),g=bl+Math.floor((e-f.top)/cE());return ci({line:g,ch:cB(ch(g),d-f.left)})}function cI(a){function e(){var a=N(C.value).join("\n");a!=d&&cU(bN)(a,"end"),B.style.position="relative",C.style.cssText=c,bk=!1,bV(),bS()}var b=cH(a);if(!b||window.opera)return;(G(bc.from,bc.to)||H(b,bc.from)||!H(b,bc.to))&&cU(cg)(b.line,b.ch);var c=C.style.cssText;B.style.position="absolute",C.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(a.clientY-5)+"px; left: "+(a.clientX-5)+"px; z-index: 1000; background: white; "+"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",bk=!0;var d=C.value=bQ();bW(),P(C,0,C.value.length);if(u){o(a);var f=r(window,"mouseup",function(){f(),setTimeout(e,20)},!0)}else setTimeout(e,50)}function cJ(){clearInterval(Y);var a=!0;U.style.visibility="",Y=setInterval(function(){U.style.visibility=(a=!a)?"":"hidden"},650)}function cL(a){function p(a,b,c){if(!a.text)return;var d=a.styles,e=g?0:a.text.length-1,f;for(var i=g?0:d.length-2,j=g?d.length:-2;i!=j;i+=2*h){var k=d[i];if(d[i+1]!=null&&d[i+1]!=m){e+=h*k.length;continue}for(var l=g?0:k.length-1,p=g?k.length:-1;l!=p;l+=h,e+=h)if(e>=b&&e<c&&o.test(f=k.charAt(l))){var q=cK[f];if(q.charAt(1)==">"==g)n.push(f);else{if(n.pop()!=q.charAt(0))return{pos:e,match:!1};if(!n.length)return{pos:e,match:!0}}}}}var b=bc.inverted?bc.from:bc.to,c=$[b.line],d=b.ch-1,e=d>=0&&cK[c.text.charAt(d)]||cK[c.text.charAt(++d)];if(!e)return;var f=e.charAt(0),g=e.charAt(1)==">",h=g?1:-1,i=c.styles;for(var j=d+1,k=0,l=i.length;k<l;k+=2)if((j-=i[k].length)<=0){var m=i[k+1];break}var n=[c.text.charAt(d)],o=/[(){}[\]]/;for(var k=b.line,l=g?Math.min(k+100,$.length):Math.max(-1,k-100);k!=l;k+=h){var c=$[k],q=k==b.line,r=p(c,q&&g?d+1:0,q&&!g?d:c.text.length);if(r)break}r||(r={pos:null,match:!1});var m=r.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",s=cu({line:b.line,ch:d},{line:b.line,ch:d+1},m),t=r.pos!=null?cu({line:k,ch:r.pos},{line:k,ch:r.pos+1},m):function(){},u=cU(function(){s(),t()});a?setTimeout(u,800):bq=u}function cM(a){var b,c;for(var d=a,e=a-40;d>e;--d){if(d==0)return 0;var f=$[d-1];if(f.stateAfter)return d;var g=f.indentation();if(c==null||b>g)c=d-1,b=g}return c}function cN(a){var b=cM(a),c=b&&$[b-1].stateAfter;c?c=e(Z,c):c=f(Z);for(var d=b;d<a;++d){var g=$[d];g.highlight(Z,c),g.stateAfter=e(Z,c)}return a<$.length&&!$[a].stateAfter&&_.push(a),c}function cO(a,b){var c=cN(a);for(var d=a;d<b;++d){var f=$[d];f.highlight(Z,c),f.stateAfter=e(Z,c)}}function cP(){var a=+(new Date)+g.workTime,b=_.length;while(_.length){if(!$[bl].stateAfter)var c=bl;else var c=_.pop();if(c>=$.length)continue;var d=cM(c),h=d&&$[d-1].stateAfter;h?h=e(Z,h):h=f(Z);var i=0,j=Z.compareStates,k=!1;for(var l=d,m=$.length;l<m;++l){var n=$[l],o=n.stateAfter;if(+(new Date)>a){_.push(l),cQ(g.workDelay),k&&bh.push({from:c,to:l+1});return}var p=n.highlight(Z,h);p&&(k=!0),n.stateAfter=e(Z,h);if(j){if(o&&j(o,h))break}else if(p!==!1||!o)i=0;else if(++i>3)break}k&&bh.push({from:c,to:l+1})}b&&g.onHighlightComplete&&g.onHighlightComplete(bw)}function cQ(a){if(!_.length)return;X.set(a,cU(cP))}function cR(){bg=null,bh=[],bi=bj=!1}function cS(){var a=!1;bj&&(a=!bY()),bh.length?b_(bh):bj&&cd(),a&&bY(),bj&&(bX(),cJ()),bb&&!bk&&(bg===!0||bg!==!1&&bj)&&bV(),bj&&g.matchBrackets&&setTimeout(cU(function(){bq&&(bq(),bq=null),cL(!1)}),20);var b=bi;bj&&g.onCursorActivity&&g.onCursorActivity(bw),b&&g.onChange&&bw&&g.onChange(bw,b)}function cU(a){return function(){cT++||cR();try{var b=a.apply(this,arguments)}finally{--cT||cS()}return b}}function cV(a,b,c){this.atOccurrence=!1,c==null&&(c=typeof a=="string"&&a==a.toLowerCase()),b&&typeof b=="object"?b=ci(b):b={line:0,ch:0},this.pos={from:b,to:b};if(typeof a!="string")this.matches=function(b,c){if(b){var d=$[c.line].text.slice(0,c.ch),e=d.match(a),f=0;while(e){var g=d.indexOf(e[0]);f+=g,d=d.slice(g+1);var h=d.match(a);if(h)e=h;else break;f++}}else var d=$[c.line].text.slice(c.ch),e=d.match(a),f=e&&c.ch+d.indexOf(e[0]);if(e)return{from:{line:c.line,ch:f},to:{line:c.line,ch:f+e[0].length},match:e}};else{c&&(a=a.toLowerCase());var d=c?function(a){return a.toLowerCase()}:function(a){return a},e=a.split("\n");e.length==1?this.matches=function(b,c){var e=d($[c.line].text),f=a.length,g;if(b?c.ch>=f&&(g=e.lastIndexOf(a,c.ch-f))!=-1:(g=e.indexOf(a,c.ch))!=-1)return{from:{line:c.line,ch:g},to:{line:c.line,ch:g+f}}}:this.matches=function(a,b){var c=b.line,f=a?e.length-1:0,g=e[f],h=d($[c].text),i=a?h.indexOf(g)+g.length:h.lastIndexOf(g);if(a?i>=b.ch||i!=g.length:i<=b.ch||i!=h.length-g.length)return;for(;;){if(a?!c:c==$.length-1)return;h=d($[c+=a?-1:1].text),g=e[a?--f:++f];if(f>0&&f<e.length-1){if(h!=g)return;continue}var j=a?h.lastIndexOf(g):h.indexOf(g)+g.length;if(a?j!=h.length-g.length:j!=g.length)return;var k={line:b.line,ch:i},l={line:c,ch:j};return{from:a?l:k,to:a?k:l}}}}}var g={},i=a.defaults;for(var k in i)i.hasOwnProperty(k)&&(g[k]=(c&&c.hasOwnProperty(k)?c:i)[k]);var n=g.document,w=n.createElement("div");w.className="CodeMirror",w.innerHTML='<div style="overflow: hidden; position: relative; width: 1px; height: 0px;"><textarea style="position: absolute; width: 2px;" wrap="off"></textarea></div><div class="CodeMirror-scroll cm-s-'+g.theme+'">'+'<div style="position: relative">'+'<div style="position: absolute; height: 0; width: 0; overflow: hidden;"></div>'+'<div style="position: relative">'+'<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>'+'<div class="CodeMirror-lines"><div style="position: relative">'+'<pre class="CodeMirror-cursor"> </pre>'+"<div></div>"+"</div></div></div></div></div>",b.appendChild?b.appendChild(w):b(w);var B=w.firstChild,C=B.firstChild,D=w.lastChild,J=D.firstChild,K=J.firstChild,Q=K.nextSibling,R=Q.firstChild,S=R.firstChild,T=R.nextSibling.firstChild,U=T.firstChild,V=U.nextSibling;g.tabindex!=null&&(C.tabindex=g.tabindex),!g.gutter&&!g.lineNumbers&&(R.style.display="none");var W=new s,X=new s,Y,Z,$=[new h("")],_,ba=new j,bb;cs();var bc={from:{line:0,ch:0},to:{line:0,ch:0},inverted:!1},bd,be,bf,bg,bh,bi,bj,bk,bl=0,bm=0,bn=0,bo=null,bp,bq,br="",bs;cU(function(){bx(g.value||""),bg=!1})(),r(D,"mousedown",cU(bz)),u||r(D,"contextmenu",cI),r(J,"dblclick",cU(bA)),r(D,"scroll",function(){b_([]),g.fixedGutter&&(R.style.left=D.scrollLeft+"px"),g.onScroll&&g.onScroll(bw)}),r(window,"resize",function(){b_(!0)}),r(C,"keyup",cU(bD)),r(C,"keydown",cU(bC)),r(C,"keypress",cU(bE)),r(C,"focus",bF),r(C,"blur",bG),r(D,"dragenter",o),r(D,"dragover",o),r(D,"drop",cU(bB)),r(D,"paste",function(){bW(),bT()}),r(C,"paste",function(){bT()}),r(C,"cut",function(){bT()});var bt;try{bt=n.activeElement==C}catch(bu){}bt?setTimeout(bF,20):bG();var bw={getValue:by,setValue:cU(bx),getSelection:bQ,replaceSelection:cU(bN),focus:function(){bW(),bF(),bT()},setOption:function(a,b){g[a]=b,a=="lineNumbers"||a=="gutter"||a=="firstLineNumber"?ct():a=="mode"||a=="indentUnit"?cs():a=="readOnly"&&b=="nocursor"?C.blur():a=="theme"&&(D.className=D.className.replace(/cm-s-\w+/,"cm-s-"+b))},getOption:function(a){return g[a]},undo:cU(bJ),redo:cU(bK),indentLine:cU(function(a,b){bv(a)&&cr(a,b==null?"smart":b?"add":"subtract")}),historySize:function(){return{undo:ba.done.length,redo:ba.undone.length}},matchBrackets:cU(function(){cL(!0)}),getTokenAt:function(a){return a=ci(a),$[a.line].getTokenAt(Z,cN(a.line),a.ch)},getStateAfter:function(a){return a=ch(a==null?$.length-1:a),cN(a+1)},cursorCoords:function(a){return a==null&&(a=bc.inverted),cD(a?bc.from:bc.to)},charCoords:function(a){return cD(ci(a))},coordsChar:function(a){var b=E(T),c=ch(Math.min($.length-1,bl+Math.floor((a.y-b.top)/cE())));return ci({line:c,ch:cB(ch(c),a.x-b.left)})},getSearchCursor:function(a,b,c){return new cV(a,b,c)},markText:cU(function(a,b,c){return cU(cu(a,b,c))}),setMarker:cv,clearMarker:cw,setLineClass:cU(cx),lineInfo:cy,addWidget:function(a,b,c,d){a=cC(ci(a));var e=a.yBot,f=a.x;b.style.position="absolute",J.appendChild(b),b.style.left=f+"px";if(d=="over")e=a.y;else if(d=="near"){var g=Math.max(D.offsetHeight,$.length*cE()),h=Math.max(J.clientWidth,T.clientWidth)-cG();a.yBot+b.offsetHeight>g&&a.y>b.offsetHeight&&(e=a.y-b.offsetHeight),f+b.offsetWidth>h&&(f=h-b.offsetWidth)}b.style.top=e+cF()+"px",b.style.left=f+cG()+"px",c&&bZ(f,e,f+b.offsetWidth,e+b.offsetHeight)},lineCount:function(){return $.length},getCursor:function(a){return a==null&&(a=bc.inverted),I(a?bc.from:bc.to)},somethingSelected:function(){return!G(bc.from,bc.to)},setCursor:cU(function(a,b){b==null&&typeof a.line=="number"?cg(a.line,a.ch):cg(a,b)}),setSelection:cU(function(a,b){cf(ci(a),ci(b||a))}),getLine:function(a){if(bv(a))return $[a].text},setLine:cU(function(a,b){bv(a)&&bM(b,{line:a,ch:0},{line:a,ch:$[a].text.length})}),removeLine:cU(function(a){bv(a)&&bM("",{line:a,ch:0},ci({line:a+1,ch:0}))}),replaceRange:cU(bM),getRange:function(a,b){return bP(ci(a),ci(b))},operation:function(a){return cU(a)()},refresh:function(){b_(!0)},getInputField:function(){return C},getWrapperElement:function(){return w},getScrollerElement:function(){return D},getGutterElement:function(){return R}},bR=!1,cK={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},cT=0;cV.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(a){function d(a){var c={line:a,ch:0};return b.pos={from:c,to:c},b.atOccurrence=!1,!1}var b=this,c=ci(a?this.pos.from:this.pos.to);for(;;){if(this.pos=this.matches(a,c))return this.atOccurrence=!0,this.pos.match||!0;if(a){if(!c.line)return d(0);c={line:c.line-1,ch:$[c.line-1].text.length}}else{if(c.line==$.length-1)return d($.length);c={line:c.line+1,ch:0}}}},from:function(){if(this.atOccurrence)return I(this.pos.from)},to:function(){if(this.atOccurrence)return I(this.pos.to)},replace:function(a){var b=this;this.atOccurrence&&cU(function(){b.pos.to=bM(a,b.pos.from,b.pos.to)})()}};for(var cW in d)d.propertyIsEnumerable(cW)&&!bw.propertyIsEnumerable(cW)&&(bw[cW]=d[cW]);return bw}function e(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function f(a,b,c){return a.startState?a.startState(b,c):!0}function g(a){this.pos=this.start=0,this.string=a}function h(a,b){this.styles=b||[a,null],this.stateAfter=null,this.text=a,this.marked=this.gutterMarker=this.className=null}function i(a,b,c,d){for(var e=0,f=0,g=0;f<b;e+=2){var h=c[e],i=f+h.length;g==0?(i>a&&d.push(h.slice(a-f,Math.min(h.length,b-f)),c[e+1]),i>=a&&(g=1)):g==1&&(i>b?d.push(h.slice(0,b-f),c[e+1]):d.push(h,c[e+1])),f=i}}function j(){this.time=0,this.done=[],this.undone=[]}function k(){o(this)}function l(a){return a.stop||(a.stop=k),a}function m(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function n(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function o(a){m(a),n(a)}function p(a){return a.target||a.srcElement}function q(a){if(a.which)return a.which;if(a.button&1)return 1;if(a.button&2)return 3;if(a.button&4)return 2}function r(a,b,c,d){function e(a){c(a||window.event)}if(typeof a.addEventListener=="function"){a.addEventListener(b,e,!1);if(d)return function(){a.removeEventListener(b,e,!1)}}else{a.attachEvent("on"+b,e);if(d)return function(){a.detachEvent("on"+b,e)}}}function s(){this.id=null}function C(a,b){b==null&&(b=a.search(/[^\s\u00a0]/),b==-1&&(b=a.length));for(var c=0,d=0;c<b;++c)a.charAt(c)=="\t"?d+=y-d%y:++d;return d}function D(a){return a.currentStyle?a.currentStyle:window.getComputedStyle(a,null)}function E(a,b){var c=a.ownerDocument.body,d=0,e=0,f=!1;for(var g=a;g;g=g.offsetParent)d+=g.offsetLeft,e+=g.offsetTop,b&&D(g).position=="fixed"&&(f=!0);var h=b&&!f?null:c;for(var g=a.parentNode;g!=h;g=g.parentNode)g.scrollLeft!=null&&(d-=g.scrollLeft,e-=g.scrollTop);return{left:d,top:e}}function F(a){return a.textContent||a.innerText||a.nodeValue||""}function G(a,b){return a.line==b.line&&a.ch==b.ch}function H(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function I(a){return{line:a.line,ch:a.ch}}function K(a){return J.innerText=J.textContent=a,J.innerHTML}function L(a,b){if(!b)return a?a.length:0;if(!a)return b.length;for(var c=a.length,d=b.length;c>=0&&d>=0;--c,--d)if(a.charAt(c)!=b.charAt(d))break;return d+1}function M(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c<d;++c)if(a[c]==b)return c;return-1}a.defaults={value:"",mode:null,theme:"default",indentUnit:2,indentWithTabs:!1,tabMode:"classic",enterMode:"indent",electricChars:!0,onKeyEvent:null,lineNumbers:!1,gutter:!1,fixedGutter:!1,firstLineNumber:1,readOnly:!1,smartHome:!0,onChange:null,onCursorActivity:null,onGutterClick:null,onHighlightComplete:null,onFocus:null,onBlur:null,onScroll:null,matchBrackets:!1,workTime:100,workDelay:200,undoDepth:40,tabindex:null,document:window.document};var b={},c={};a.defineMode=function(c,d){!a.defaults.mode&&c!="null"&&(a.defaults.mode=c),b[c]=d},a.defineMIME=function(a,b){c[a]=b},a.getMode=function(d,e){typeof e=="string"&&c.hasOwnProperty(e)&&(e=c[e]);if(typeof e=="string")var f=e,g={};else if(e!=null)var f=e.name,g=e;var h=b[f];return h?h(d,g||{}):(window.console&&console.warn("No mode "+f+" found, falling back to plain text."),a.getMode(d,"text/plain"))},a.listModes=function(){var a=[];for(var c in b)b.propertyIsEnumerable(c)&&a.push(c);return a},a.listMIMEs=function(){var a=[];for(var b in c)c.propertyIsEnumerable(b)&&a.push(b);return a};var d={};a.defineExtension=function(a,b){d[a]=b},a.fromTextArea=function(b,c){function d(){b.value=h.getValue()}c||(c={}),c.value=b.value,!c.tabindex&&b.tabindex&&(c.tabindex=b.tabindex);if(b.form){var e=r(b.form,"submit",d,!0);if(typeof b.form.submit=="function"){var f=b.form.submit;function g(){d(),b.form.submit=f,b.form.submit(),b.form.submit=g}b.form.submit=g}}b.style.display="none";var h=a(function(a){b.parentNode.insertBefore(a,b.nextSibling)},c);return h.save=d,h.toTextArea=function(){d(),b.parentNode.removeChild(h.getWrapperElement()),b.style.display="",b.form&&(e(),typeof b.form.submit=="function"&&(b.form.submit=f))},h},a.startState=f,a.copyState=e,g.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if(typeof a=="string")var c=b==a;else var c=b&&(a.test?a.test(b):a(b));if(c)return++this.pos,b},eatWhile:function(a){var b=this.pos;while(this.eat(a));return this.pos>b},eatSpace:function(){var a=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);if(b>-1)return this.pos=b,!0},backUp:function(a){this.pos-=a},column:function(){return C(this.string,this.start)},indentation:function(){return C(this.string)},match:function(a,b,c){if(typeof a!="string"){var e=this.string.slice(this.pos).match(a);return e&&b!==!1&&(this.pos+=e[0].length),e}function d(a){return c?a.toLowerCase():a}if(d(this.string).indexOf(d(a),this.pos)==this.pos)return b!==!1&&(this.pos+=a.length),!0},current:function(){return this.string.slice(this.start,this.pos)}},a.StringStream=g,h.prototype={replace:function(a,b,c){var d=[],e=this.marked;i(0,a,this.styles,d),c&&d.push(c,null),i(b,this.text.length,this.styles,d),this.styles=d,this.text=this.text.slice(0,a)+c+this.text.slice(b),this.stateAfter=null;if(e){var f=c.length-(b-a),g=this.text.length;function h(a){return a<=Math.min(b,b+f)?a:a+f}for(var j=0;j<e.length;++j){var k=e[j],l=!1;k.from>=g?l=!0:(k.from=h(k.from),k.to!=null&&(k.to=h(k.to)));if(l||k.from>=k.to)e.splice(j,1),j--}}},split:function(a,b){var c=[b,null];return i(a,this.text.length,this.styles,c),new h(b+this.text.slice(a),c)},addMark:function(a,b,c){var d=this.marked,e={from:a,to:b,style:c};return this.marked==null&&(this.marked=[]),this.marked.push(e),this.marked.sort(function(a,b){return a.from-b.from}),e},removeMark:function(a){var b=this.marked;if(!b)return;for(var c=0;c<b.length;++c)if(b[c]==a){b.splice(c,1);break}},highlight:function(a,b){var c=new g(this.text),d=this.styles,e=0,f=!1,h=d[0],i;this.text==""&&a.blankLine&&a.blankLine(b);while(!c.eol()){var j=a.token(c,b),k=this.text.slice(c.start,c.pos);c.start=c.pos,e&&d[e-1]==j?d[e-2]+=k:k&&(!f&&(d[e+1]!=j||e&&d[e-2]!=i)&&(f=!0),d[e++]=k,d[e++]=j,i=h,h=d[e]);if(c.pos>5e3){d[e++]=this.text.slice(c.pos),d[e++]=null;break}}return d.length!=e&&(d.length=e,f=!0),e&&d[e-2]!=i&&(f=!0),f||(d.length<5&&this.text.length<10?null:!1)},getTokenAt:function(a,b,c){var d=this.text,e=new g(d);while(e.pos<c&&!e.eol()){e.start=e.pos;var f=a.token(e,b)}return{start:e.start,end:e.pos,string:e.current(),className:f||null,state:b}},indentation:function(){return C(this.text)},getHTML:function(a,b,c,d){function f(a,b){if(!a)return;b?e.push('<span class="',b,'">',K(a),"</span>"):e.push(K(a))}var e=[];c&&e.push(this.className?'<pre class="'+this.className+'">':"<pre>");var g=this.styles,h=this.text,i=this.marked;a==b&&(a=null);var j=h.length;d!=null&&(j=Math.min(d,j));if(!h&&d==null)f(" ",a!=null&&b==null?"CodeMirror-selected":null);else if(!i&&a==null)for(var k=0,l=0;l<j;k+=2){var m=g[k],n=m.length;l+n>j&&(m=m.slice(0,j-l)),l+=n,f(m,"cm-"+g[k+1])}else{var o=0,k=0,p="",q,r=0,s=-1,t=null;function u(){i&&(s+=1,t=s<i.length?i[s]:null)}u();while(o<j){var v=j,w="";if(a!=null)if(a>o)v=a;else if(b==null||b>o)w=" CodeMirror-selected",b!=null&&(v=Math.min(v,b));while(t&&t.to!=null&&t.to<=o)u();t&&(t.from>o?v=Math.min(v,t.from):(w+=" "+t.style,t.to!=null&&(v=Math.min(v,t.to))));for(;;){var x=o+p.length,y=q;w&&(y=q?q+w:w),f(x>v?p.slice(0,v-o):p,y);if(x>=v){p=p.slice(v-o),o=v;break}o=x,p=g[k++],q="cm-"+g[k++]}}a!=null&&b==null&&f(" ","CodeMirror-selected")}return c&&e.push("</pre>"),e.join("")}},j.prototype={addChange:function(a,b,c){this.undone.length=0;var d=+(new Date),e=this.done[this.done.length-1];if(d-this.time>400||!e||e.start>a+b||e.start+e.added<a-e.added+e.old.length)this.done.push({start:a,added:b,old:c});else{var f=0;if(a<e.start){for(var g=e.start-a-1;g>=0;--g)e.old.unshift(c[g]);e.added+=e.start-a,e.start=a}else e.start<a&&(f=a-e.start,b+=f);for(var g=e.added-f,h=c.length;g<h;++g)e.old.push(c[g]);e.added<b&&(e.added=b)}this.time=d}},s.prototype={set:function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)}};var t=function(){var a=document.createElement("pre");return a.innerHTML=" ",!a.innerHTML}(),u=/gecko\/\d{7}/i.test(navigator.userAgent),v=/MSIE \d/.test(navigator.userAgent),w=/Apple Computer/.test(navigator.vendor),x="\n";(function(){var a=document.createElement("textarea");a.value="foo\nbar",a.value.indexOf("\r")>-1&&(x="\r\n")})();var y=8,z=/Mac/.test(navigator.platform),A={};for(var B=35;B<=40;++B)A[B]=A["c"+B]=!0;var J=document.createElement("div");a.htmlEscape=K;var N,O,P;return"\n\nb".split(/\n/).length!=3?N=function(a){var b=0,c,d=[];while((c=a.indexOf("\n",b))>-1)d.push(a.slice(b,a.charAt(c-1)=="\r"?c-1:c)),b=c+1;return d.push(a.slice(b)),d}:N=function(a){return a.split(/\r?\n/)},a.splitLines=N,window.getSelection?(O=function(a){try{return{start:a.selectionStart,end:a.selectionEnd}}catch(b){return null}},w?P=function(a,b,c){b==c?a.setSelectionRange(b,c):(a.setSelectionRange(b,c-1),window.getSelection().modify("extend","forward","character"))}:P=function(a,b,c){try{a.setSelectionRange(b,c)}catch(d){}}):(O=function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){return null}if(!b||b.parentElement()!=a)return null;var d=a.value,e=d.length,f=a.createTextRange();f.moveToBookmark(b.getBookmark());var g=a.createTextRange();g.collapse(!1);if(f.compareEndPoints("StartToEnd",g)>-1)return{start:e,end:e};var h=-f.moveStart("character",-e);for(var i=d.indexOf("\r");i>-1&&i<h;i=d.indexOf("\r",i+1),h++);if(f.compareEndPoints("EndToEnd",g)>-1)return{start:h,end:e};var j=-f.moveEnd("character",-e);for(var i=d.indexOf("\r");i>-1&&i<j;i=d.indexOf("\r",i+1),j++);return{start:h,end:j}},P=function(a,b,c){var d=a.createTextRange();d.collapse(!0);var e=d.duplicate(),f=0,g=a.value;for(var h=g.indexOf("\n");h>-1&&h<b;h=g.indexOf("\n",h+1))++f;d.move("character",b-f);for(;h>-1&&h<c;h=g.indexOf("\n",h+1))++f;e.move("character",c-f),d.setEndPoint("EndToEnd",e),d.select()}),a.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),a.defineMIME("text/plain","null"),a}();CodeMirror.defineMode("javascript",function(a,b){function g(a,b,c){return b.tokenize=c,c(a,b)}function h(a,b){var c=!1,d;while((d=a.next())!=null){if(d==b&&!c)return!1;c=!c&&d=="\\"}return c}function k(a,b,c){return i=a,j=c,b}function l(a,b){var c=a.next();if(c=='"'||c=="'")return g(a,b,m(c));if(/[\[\]{}\(\),;\:\.]/.test(c))return k(c);if(c=="0"&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),k("number","number");if(/\d/.test(c))return a.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/),k("number","number");if(c=="/")return a.eat("*")?g(a,b,n):a.eat("/")?(a.skipToEnd(),k("comment","comment")):b.reAllowed?(h(a,"/"),a.eatWhile(/[gimy]/),k("regexp","string")):(a.eatWhile(f),k("operator",null,a.current()));if(f.test(c))return a.eatWhile(f),k("operator",null,a.current());a.eatWhile(/[\w\$_]/);var d=a.current(),i=e.propertyIsEnumerable(d)&&e[d];return i?k(i.type,i.style,d):k("variable","variable",d)}function m(a){return function(b,c){return h(b,a)||(c.tokenize=l),k("string","string")}}function n(a,b){var c=!1,d;while(d=a.next()){if(d=="/"&&c){b.tokenize=l;break}c=d=="*"}return k("comment","comment")}function p(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,d!=null&&(this.align=d)}function q(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0}function r(a,b,c,e,f){var g=a.cc;s.state=a,s.stream=f,s.marked=null,s.cc=g,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);for(;;){var h=g.length?g.pop():d?D:C;if(h(c,e)){while(g.length&&g[g.length-1].lex)g.pop()();return s.marked?s.marked:c=="variable"&&q(a,e)?"variable-2":b}}}function t(){for(var a=arguments.length-1;a>=0;a--)s.cc.push(arguments[a])}function u(){return t.apply(null,arguments),!0}function v(a){var b=s.state;if(b.context){s.marked="def";for(var c=b.localVars;c;c=c.next)if(c.name==a)return;b.localVars={name:a,next:b.localVars}}}function x(){s.state.context||(s.state.localVars=w),s.state.context={prev:s.state.context,vars:s.state.localVars}}function y(){s.state.localVars=s.state.context.vars,s.state.context=s.state.context.prev}function z(a,b){var c=function(){var c=s.state;c.lexical=new p(c.indented,s.stream.column(),a,null,c.lexical,b)};return c.lex=!0,c}function A(){var a=s.state;a.lexical.prev&&(a.lexical.type==")"&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function B(a){return function b(b){return b==a?u():a==";"?t():u(arguments.callee)}}function C(a){return a=="var"?u(z("vardef"),K,B(";"),A):a=="keyword a"?u(z("form"),D,C,A):a=="keyword b"?u(z("form"),C,A):a=="{"?u(z("}"),J,A):a==";"?u():a=="function"?u(Q):a=="for"?u(z("form"),B("("),z(")"),M,B(")"),A,C,A):a=="variable"?u(z("stat"),F):a=="switch"?u(z("form"),D,z("}","switch"),B("{"),J,A,A):a=="case"?u(D,B(":")):a=="default"?u(B(":")):a=="catch"?u(z("form"),x,B("("),R,B(")"),C,A,y):t(z("stat"),D,B(";"),A)}function D(a){return o.hasOwnProperty(a)?u(E):a=="function"?u(Q):a=="keyword c"?u(D):a=="("?u(z(")"),D,B(")"),A,E):a=="operator"?u(D):a=="["?u(z("]"),I(D,"]"),A,E):a=="{"?u(z("}"),I(H,"}"),A,E):u()}function E(a,b){if(a=="operator"&&/\+\+|--/.test(b))return u(E);if(a=="operator")return u(D);if(a==";")return;if(a=="(")return u(z(")"),I(D,")"),A,E);if(a==".")return u(G,E);if(a=="[")return u(z("]"),D,B("]"),A,E)}function F(a){return a==":"?u(A,C):t(E,B(";"),A)}function G(a){if(a=="variable")return s.marked="property",u()}function H(a){a=="variable"&&(s.marked="property");if(o.hasOwnProperty(a))return u(B(":"),D)}function I(a,b){function c(d){return d==","?u(a,c):d==b?u():u(B(b))}return function d(d){return d==b?u():t(a,c)}}function J(a){return a=="}"?u():t(C,J)}function K(a,b){return a=="variable"?(v(b),u(L)):u()}function L(a,b){if(b=="=")return u(D,L);if(a==",")return u(K)}function M(a){return a=="var"?u(K,O):a==";"?t(O):a=="variable"?u(N):t(O)}function N(a,b){return b=="in"?u(D):u(E,O)}function O(a,b){return a==";"?u(P):b=="in"?u(D):u(D,B(";"),P)}function P(a){a!=")"&&u(D)}function Q(a,b){if(a=="variable")return v(b),u(Q);if(a=="(")return u(z(")"),x,I(R,")"),A,C,y)}function R(a,b){if(a=="variable")return v(b),u()}var c=a.indentUnit,d=b.json,e=function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),f={type:"atom",style:"atom"};return{"if":b,"while":b,"with":b,"else":c,"do":c,"try":c,"finally":c,"return":d,"break":d,"continue":d,"new":d,"delete":d,"throw":d,"var":a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":e,"typeof":e,"instanceof":e,"true":f,"false":f,"null":f,"undefined":f,NaN:f,Infinity:f}}(),f=/[+\-*&%=<>!?|]/,i,j,o={atom:!0,number:!0,variable:!0,string:!0,regexp:!0},s={state:null,column:null,marked:null,cc:null},w={name:"this",next:{name:"arguments"}};return A.lex=!0,{startState:function(a){return{tokenize:l,reAllowed:!0,cc:[],lexical:new p((a||0)-c,0,"block",!1),localVars:null,context:null,indented:0}},token:function(a,b){a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation());if(a.eatSpace())return null;var c=b.tokenize(a,b);return i=="comment"?c:(b.reAllowed=i=="operator"||i=="keyword c"||i.match(/^[\[{}\(,;:]$/),r(b,c,i,j,a))},indent:function(a,b){if(a.tokenize!=l)return 0;var d=b&&b.charAt(0),e=a.lexical,f=e.type,g=d==f;return f=="vardef"?e.indented+4:f=="form"&&d=="{"?e.indented:f=="stat"||f=="form"?e.indented+c:e.info=="switch"&&!g?e.indented+(/^(?:case|default)\b/.test(b)?c:2*c):e.align?e.column+(g?0:1):e.indented+(g?0:c)},electricChars:":{}"}}),CodeMirror.defineMIME("text/javascript","javascript"),CodeMirror.defineMIME("application/json",{name:"javascript",json:!0}),CodeMirror.defineMode("xml",function(a,b){function h(a,b){function c(c){return b.tokenize=c,c(a,b)}var d=a.next();if(d=="<"){if(a.eat("!"))return a.eat("[")?a.match("CDATA[")?c(k("atom","]]>")):null:a.match("--")?c(k("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),c(k("meta",">"))):null;if(a.eat("?"))return a.eatWhile(/[\w\._\-]/),b.tokenize=k("meta","?>"),"meta";g=a.eat("/")?"closeTag":"openTag",a.eatSpace(),f="";var e;while(e=a.eat(/[^\s\u00a0=<>\"\'\/?]/))f+=e;return b.tokenize=i,"tag"}return d=="&"?(a.eatWhile(/[^;]/),a.eat(";"),"atom"):(a.eatWhile(/[^&<]/),null)}function i(a,b){var c=a.next();return c==">"||c=="/"&&a.eat(">")?(b.tokenize=h,g=c==">"?"endTag":"selfcloseTag","tag"):c=="="?(g="equals",null):/[\'\"]/.test(c)?(b.tokenize=j(c),b.tokenize(a,b)):(a.eatWhile(/[^\s\u00a0=<>\"\'\/?]/),"word")}function j(a){return function(b,c){while(!b.eol())if(b.next()==a){c.tokenize=i;break}return"string"}}function k(a,b){return function(c,d){while(!c.eol()){if(c.match(b)){d.tokenize=h;break}c.next()}return a}}function n(){for(var a=arguments.length-1;a>=0;a--)l.cc.push(arguments[a])}function o(){return n.apply(null,arguments),!0}function p(a,b){var c=d.doNotIndent.hasOwnProperty(a)||l.context&&l.context.noIndent;l.context={prev:l.context,tagName:a,indent:l.indented,startOfLine:b,noIndent:c}}function q(){l.context&&(l.context=l.context.prev)}function r(a){if(a=="openTag")return l.tagName=f,o(u,s(l.startOfLine));if(a=="closeTag"){var b=!1;return l.context?(b=l.context.tagName!=f,q()):b=!0,b&&(m="error"),o(t(b))}return a=="string"?((!l.context||l.context.name!="!cdata")&&p("!cdata"),l.tokenize==h&&q(),o()):o()}function s(a){return function(b){return b=="selfcloseTag"||b=="endTag"&&d.autoSelfClosers.hasOwnProperty(l.tagName.toLowerCase())?o():b=="endTag"?(p(l.tagName,a),o()):o()}}function t(a){return function(b){return a&&(m="error"),b=="endTag"?o():n()}}function u(a){return a=="word"?(m="attribute",o(u)):a=="equals"?o(v,u):n()}function v(a){return a=="word"&&d.allowUnquoted?(m="string",o()):a=="string"?o(w):n()}function w(a){return a=="string"?o(w):n()}var c=a.indentUnit,d=b.htmlMode?{autoSelfClosers:{br:!0,img:!0,hr:!0,link:!0,input:!0,meta:!0,col:!0,frame:!0,base:!0,area:!0},doNotIndent:{pre:!0,"!cdata":!0},allowUnquoted:!0}:{autoSelfClosers:{},doNotIndent:{"!cdata":!0},allowUnquoted:!1},e=b.alignCDATA,f,g,l,m;return{startState:function(){return{tokenize:h,cc:[],indented:0,startOfLine:!0,tagName:null,context:null}},token:function(a,b){a.sol()&&(b.startOfLine=!0,b.indented=a.indentation());if(a.eatSpace())return null;m=g=f=null;var c=b.tokenize(a,b);if((c||g)&&c!="comment"){l=b;for(;;){var d=b.cc.pop()||r;if(d(g||c))break}}return b.startOfLine=!1,m||c},indent:function(a,b){var d=a.context;if(d&&d.noIndent)return 0;if(e&&/<!\[CDATA\[/.test(b))return 0;d&&/^<\//.test(b)&&(d=d.prev);while(d&&!d.startOfLine)d=d.prev;return d?d.indent+c:0},compareStates:function(a,b){if(a.indented!=b.indented||a.tagName!=b.tagName)return!1;for(var c=a.context,d=b.context;;c=c.prev,d=d.prev){if(!c||!d)return c==d;if(c.tagName!=d.tagName)return!1}},electricChars:"/"}}),CodeMirror.defineMIME("application/xml","xml"),CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0}),CodeMirror.defineMode("css",function(a){function d(a,b){return c=b,a}function e(a,b){var c=a.next();if(c=="@")return a.eatWhile(/\w/),d("meta",a.current());if(c=="/"&&a.eat("*"))return b.tokenize=f,f(a,b);if(c=="<"&&a.eat("!"))return b.tokenize=g,g(a,b);if(c=="=")d(null,"compare");else return c!="~"&&c!="|"||!a.eat("=")?c=='"'||c=="'"?(b.tokenize=h(c),b.tokenize(a,b)):c=="#"?(a.eatWhile(/\w/),d("atom","hash")):c=="!"?(a.match(/^\s*\w*/),d("keyword","important")):/\d/.test(c)?(a.eatWhile(/[\w.%]/),d("number","unit")):/[,.+>*\/]/.test(c)?d(null,"select-op"):/[;{}:\[\]]/.test(c)?d(null,c):(a.eatWhile(/[\w\\\-_]/),d("variable","variable")):d(null,"compare")}function f(a,b){var c=!1,f;while((f=a.next())!=null){if(c&&f=="/"){b.tokenize=e;break}c=f=="*"}return d("comment","comment")}function g(a,b){var c=0,f;while((f=a.next())!=null){if(c>=2&&f==">"){b.tokenize=e;break}c=f=="-"?c+1:0}return d("comment","comment")}function h(a){return function(b,c){var f=!1,g;while((g=b.next())!=null){if(g==a&&!f)break;f=!f&&g=="\\"}return f||(c.tokenize=e),d("string","string")}}var b=a.indentUnit,c;return{startState:function(a){return{tokenize:e,baseIndent:a||0,stack:[]}},token:function(a,b){if(a.eatSpace())return null;var d=b.tokenize(a,b),e=b.stack[b.stack.length-1];if(c=="hash"&&e=="rule")d="atom";else if(d=="variable")if(e=="rule")d="number";else if(!e||e=="@media{")d="tag";return e=="rule"&&/^[\{\};]$/.test(c)&&b.stack.pop(),c=="{"?e=="@media"?b.stack[b.stack.length-1]="@media{":b.stack.push("{"):c=="}"?b.stack.pop():c=="@media"?b.stack.push("@media"):e=="{"&&c!="comment"&&b.stack.push("rule"),d},indent:function(a,c){var d=a.stack.length;return/^\}/.test(c)&&(d-=a.stack[a.stack.length-1]=="rule"?2:1),a.baseIndent+d*b},electricChars:"}"}}),CodeMirror.defineMIME("text/css","css"),CodeMirror.defineMode("htmlmixed",function(a,b){function f(a,b){var f=c.token(a,b.htmlState);return f=="tag"&&a.current()==">"&&b.htmlState.context&&(/^script$/i.test(b.htmlState.context.tagName)?(b.token=h,b.localState=d.startState(c.indent(b.htmlState,"")),b.mode="javascript"):/^style$/i.test(b.htmlState.context.tagName)&&(b.token=i,b.localState=e.startState(c.indent(b.htmlState,"")),b.mode="css")),f}function g(a,b,c){var d=a.current(),e=d.search(b);return e>-1&&a.backUp(d.length-e),c}function h(a,b){return a.match(/^<\/\s*script\s*>/i,!1)?(b.token=f,b.curState=null,b.mode="html",f(a,b)):g(a,/<\/\s*script\s*>/,d.token(a,b.localState))}function i(a,b){return a.match(/^<\/\s*style\s*>/i,!1)?(b.token=f,b.localState=null,b.mode="html",f(a,b)):g(a,/<\/\s*style\s*>/,e.token(a,b.localState))}var c=CodeMirror.getMode(a,{name:"xml",htmlMode:!0}),d=CodeMirror.getMode(a,"javascript"),e=CodeMirror.getMode(a,"css");return{startState:function(){var a=c.startState();return{token:f,localState:null,mode:"html",htmlState:a}},copyState:function(a){if(a.localState)var b=CodeMirror.copyState(a.token==i?e:d,a.localState);return{token:a.token,localState:b,mode:a.mode,htmlState:CodeMirror.copyState(c,a.htmlState)}},token:function(a,b){return b.token(a,b)},indent:function(a,b){return a.token==f||/^\s*<\//.test(b)?c.indent(a.htmlState,b):a.token==h?d.indent(a.localState,b):e.indent(a.localState,b)},electricChars:"/{}:"}}),CodeMirror.defineMIME("text/html","htmlmixed")
|
1
|
+
var CodeMirror=function(){function a(b,c){function bB(a){return a>=0&&a<bb.length}function bD(a){bd=null;var b={line:0,ch:0};bO(b,{line:bb.length-1,ch:bb[bb.length-1].text.length},O(a),b,b),bd=new j,bl=!0}function bE(a){var b=[];for(var c=0,d=bb.length;c<d;++c)b.push(bb[c].text);return b.join("\n")}function bF(a){function i(a){var b=cO(a,!0);if(b&&!H(b,e)){be||bM(),e=b,cl(c,b),bl=!1;var d=cf();if(b.line>=d.to||b.line<d.from)f=setTimeout(c_(function(){i(a)}),150)}}for(var b=p(a);b!=x;b=b.parentNode)if(b.parentNode==R&&b!=T)return;for(var b=p(a);b!=x;b=b.parentNode)if(b.parentNode==V)return g.onGutterClick&&g.onGutterClick(bC,N(V.childNodes,b)+br,a),m(a);var c=cO(a);switch(q(a)){case 3:v&&!A&&cP(a);return;case 2:c&&cn(c.line,c.ch,!0);return}if(!c){p(a)==E&&m(a);return}be||bM();var d=+(new Date);if(bj>d-400)return m(a),cu(c.line);if(bi>d-400)return bj=d,m(a),ct(c);bi=d;var e=c,f;if(u&&!H(bf.from,bf.to)&&!I(c,bf.from)&&!I(bf.to,c)){var h=r(n,"mouseup",c_(function(b){bk=!1,h(),Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)<10&&(m(b),cn(c.line,c.ch,!0),cb())}),!0);bk=!0;return}m(a),cn(c.line,c.ch,!0);var j=r(n,"mousemove",c_(function(a){clearTimeout(f),m(a),i(a)}),!0),h=r(n,"mouseup",c_(function(a){clearTimeout(f);var b=cO(a);b&&cl(c,b),m(a),cb(),bl=!0,j(),h()}),!0)}function bG(a){var b=cO(a);if(!b)return;bj=+(new Date),m(a),ct(b)}function bH(a){a.preventDefault();var b=cO(a,!0),c=a.dataTransfer.files;if(!b||g.readOnly)return;if(c&&c.length&&window.FileReader&&window.File){function d(a,c){var d=new FileReader;d.onload=function(){f[c]=d.result;if(++h==e){b=cp(b);var a=bT(f.join(""),b,b);cl(b,a)}},d.readAsText(a)}var e=c.length,f=Array(e),h=0;for(var i=0;i<e;++i)d(c[i],i)}else try{var f=a.dataTransfer.getData("Text");if(f){var j=bT(f,b,b),k=bf.from,l=bf.to;cl(b,j),bk&&bT("",k,l),cb()}}catch(a){}}function bI(a){var b=bX();L(b),a.dataTransfer.setDragImage(K,0,0),a.dataTransfer.setData("Text",b)}function bJ(a){be||bM();var b=a.keyCode;w&&b==27&&(a.returnValue=!1);var c=(A?a.metaKey:a.ctrlKey)&&!a.altKey,d=a.ctrlKey||a.altKey||a.metaKey;b==16||a.shiftKey?bg=bg||(bf.inverted?bf.to:bf.from):bg=null;if(g.onKeyEvent&&g.onKeyEvent(bC,l(a)))return;if(b==33||b==34)return cq(b==34),m(a);if(c&&(b==36||b==35||A&&(b==38||b==40)))return cr(b==36||b==38),m(a);if(c&&b==65)return cs(),m(a);if(!g.readOnly){if(!d&&b==13)return;if(!d&&b==9&&cw(a.shiftKey))return m(a);if(c&&b==90)return bQ(),m(a);if(c&&(a.shiftKey&&b==90||b==89))return bR(),m(a)}if(b==36&&g.smartHome)return cx(),m(a);bu=(c?"c":"")+(a.altKey?"a":"")+b;if(bf.inverted&&B[bu]===!0){var e=P(D);e&&(bh={anchor:e.start},Q(D,e.start,e.start))}!c&&!a.altKey&&(bu=null),b$(bu)}function bK(a){if(g.onKeyEvent&&g.onKeyEvent(bC,l(a)))return;bh&&(bh=null,bl=!0),a.keyCode==16&&(bg=null)}function bL(a){if(g.onKeyEvent&&g.onKeyEvent(bC,l(a)))return;if(g.electricChars&&ba.electricChars){var b=String.fromCharCode(a.charCode==null?a.keyCode:a.charCode);ba.electricChars.indexOf(b)>-1&&setTimeout(c_(function(){cy(bf.to.line,"smart")}),50)}var c=a.keyCode;c==13?(g.readOnly||cv(),m(a)):!a.ctrlKey&&!a.altKey&&!a.metaKey&&c==9&&g.tabMode!="default"?m(a):b$(bu)}function bM(){if(g.readOnly=="nocursor")return;be||(g.onFocus&&g.onFocus(bC),be=!0,x.className.search(/\bCodeMirror-focused\b/)==-1&&(x.className+=" CodeMirror-focused"),bp||ca()),bZ(),cQ()}function bN(){be&&(g.onBlur&&g.onBlur(bC),be=!1,x.className=x.className.replace(" CodeMirror-focused","")),clearInterval(_),setTimeout(function(){be||(bg=null)},150)}function bO(a,b,c,d,e){if(bd){var f=[];for(var h=a.line,i=b.line+1;h<i;++h)f.push(bb[h].text);bd.addChange(a.line,c.length,f);while(bd.done.length>g.undoDepth)bd.done.shift()}bS(a,b,c,d,e)}function bP(a,b){var c=a.pop();if(c){var d=[],e=c.start+c.added;for(var f=c.start;f<e;++f)d.push(bb[f].text);b.push({start:c.start,added:c.old.length,old:d});var g=cp({line:c.start+c.old.length-1,ch:M(d[d.length-1],c.old[c.old.length-1])});bS({line:c.start,ch:0},{line:e-1,ch:bb[e-1].text.length},c.old,g,g),bl=!0}}function bQ(){bP(bd.done,bd.undone)}function bR(){bP(bd.undone,bd.done)}function bS(a,b,c,d,e){function s(a){return a<=Math.min(b.line,b.line+q)?a:a+q}var f=!1,g=bx.length;for(var i=a.line;i<=b.line;++i)if(bb[i].text.length==g){f=!0;break}var j=b.line-a.line,k=bb[a.line],l=bb[b.line];if(k==l)if(c.length==1)k.replace(a.ch,b.ch,c[0]);else{l=k.split(b.ch,c[c.length-1]);var m=[a.line+1,j];k.replace(a.ch,k.text.length,c[0]);for(var i=1,n=c.length-1;i<n;++i)m.push(new h(c[i]));m.push(l),bb.splice.apply(bb,m)}else if(c.length==1)k.replace(a.ch,k.text.length,c[0]+l.text.slice(b.ch)),bb.splice(a.line+1,j);else{var m=[a.line+1,j-1];k.replace(a.ch,k.text.length,c[0]),l.replace(0,b.ch,c[c.length-1]);for(var i=1,n=c.length-1;i<n;++i)m.push(new h(c[i]));bb.splice.apply(bb,m)}for(var i=a.line,n=i+c.length;i<n;++i){var o=bb[i].text;o.length>g&&(bx=o,g=o.length,by=null,f=!1)}if(f){g=0,bx="",by=null;for(var i=0,n=bb.length;i<n;++i){var o=bb[i].text;o.length>g&&(g=o.length,bx=o)}}var p=[],q=c.length-j-1;for(var i=0,o=bc.length;i<o;++i){var r=bc[i];r<a.line?p.push(r):r>b.line&&p.push(r+q)}c.length<5?(cV(a.line,a.line+c.length),p.push(a.line+c.length)):p.push(a.line),bc=p,cX(100),bm.push({from:a.line,to:b.line+1,diff:q}),bn={from:a,to:b,text:c},cm(d,e,s(bf.from.line),s(bf.to.line)),R.style.height=bb.length*cL()+2*cM()+"px"}function bT(a,b,c){function d(d){if(I(d,b))return d;if(!I(c,d))return e;var f=d.line+a.length-(c.line-b.line)-1,g=d.ch;return d.line==c.line&&(g+=a[a.length-1].length-(c.ch-(c.line==b.line?b.ch:0))),{line:f,ch:g}}b=cp(b),c?c=cp(c):c=b,a=O(a);var e;return bV(a,b,c,function(a){return e=a,{from:d(bf.from),to:d(bf.to)}}),e}function bU(a,b){bV(O(a),bf.from,bf.to,function(a){return b=="end"?{from:a,to:a}:b=="start"?{from:bf.from,to:bf.from}:{from:bf.from,to:a}})}function bV(a,b,c,d){var e=a.length==1?a[0].length+b.ch:a[a.length-1].length,f=d({line:b.line+a.length-1,ch:e});bO(b,c,a,f.from,f.to)}function bW(a,b){var c=a.line,d=b.line;if(c==d)return bb[c].text.slice(a.ch,b.ch);var e=[bb[c].text.slice(a.ch)];for(var f=c+1;f<d;++f)e.push(bb[f].text);return e.push(bb[d].text.slice(0,b.ch)),e.join("\n")}function bX(){return bW(bf.from,bf.to)}function bZ(){if(bY)return;Z.set(2e3,function(){cY(),b_(),be&&bZ(),cZ()})}function b$(a){function c(){cY();var d=b_();d&&a&&(d=="moved"&&B[a]==null&&(B[a]=!0),d=="changed"&&(B[a]=!1)),!d&&!b?(b=!0,Z.set(80,c)):(bY=!1,bZ()),cZ()}var b=!1;bY=!0,Z.set(20,c)}function b_(){function f(a,c){var d=0;for(;;){var e=b.indexOf("\n",d);if(e==-1||(b.charAt(e-1)=="\r"?e-1:e)>=a)return{line:c,ch:a-d};++c,d=e+1}}if(bp||!be)return;var a=!1,b=D.value,c=P(D);if(!c)return!1;var a=bv.text!=b,d=bh,e=a||c.start!=bv.start||c.end!=(d?bv.start:bv.end);if(!e&&!d)return!1;if(a){bg=bh=null;if(g.readOnly)return bl=!0,"changed"}var h=f(c.start,bv.from),i=f(c.end,bv.from);if(d){var j=c.start==d.anchor?i:h,k=bg?bf.to:c.start==d.anchor?h:i;(bf.inverted=I(j,k))?(h=j,i=k):(bh=null,h=k,i=j)}h.line==i.line&&h.line==bf.from.line&&h.line==bf.to.line&&!bg&&(bl=!1);if(a){var l=0,m=b.length,n=Math.min(m,bv.text.length),o,p=bv.from,q=-1;while(l<n&&(o=b.charAt(l))==bv.text.charAt(l))++l,o=="\n"&&(p++,q=l);var r=q>-1?l-q:l,s=bv.to-1,t=bv.text.length;for(;;){o=bv.text.charAt(t);if(b.charAt(m)!=o){++m,++t;break}o=="\n"&&s--;if(t<=l||m<=l)break;--m,--t}var q=bv.text.lastIndexOf("\n",t-1),u=q==-1?t:t-q-1;bO({line:p,ch:r},{line:s,ch:u},O(b.slice(l,m)),h,i);if(p!=s||h.line!=p)bl=!0}else cm(h,i);return bv.text=b,bv.start=c.start,bv.end=c.end,a?"changed":e?"moved":!1}function ca(){var a=[],b=Math.max(0,bf.from.line-1),c=Math.min(bb.length,bf.to.line+2);for(var d=b;d<c;++d)a.push(bb[d].text);a=D.value=a.join(y);var e=bf.from.ch,f=bf.to.ch;for(var d=b;d<bf.from.line;++d)e+=y.length+bb[d].text.length;for(var d=b;d<bf.to.line;++d)f+=y.length+bb[d].text.length;bv={text:a,from:b,to:c,start:e,end:f},Q(D,e,bh?e:f)}function cb(){g.readOnly!="nocursor"&&D.focus()}function cc(){if(!X.getBoundingClientRect)return;var a=X.getBoundingClientRect(),b=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(a.top<0||a.bottom>b)&&X.scrollIntoView()}function cd(){var a=cJ(bf.inverted?bf.from:bf.to);return ce(a.x,a.y,a.x,a.yBot)}function ce(a,b,c,d){var e=cN(),f=cM(),h=cL();b+=f,d+=f,a+=e,c+=e;var i=E.clientHeight,j=E.scrollTop,k=!1,l=!0;b<j?(E.scrollTop=Math.max(0,b-2*h),k=!0):d>j+i&&(E.scrollTop=d+h-i,k=!0);var m=E.clientWidth,n=E.scrollLeft,o=g.fixedGutter?U.clientWidth:0;return a<n+o?(a<50&&(a=0),E.scrollLeft=Math.max(0,a-10-o),k=!0):c>m+n&&(E.scrollLeft=c+10-m,k=!0,c>R.clientWidth&&(l=!1)),k&&g.onScroll&&g.onScroll(bC),l}function cf(){var a=cL(),b=E.scrollTop-cM();return{from:Math.min(bb.length,Math.max(0,Math.floor(b/a))),to:Math.min(bb.length,Math.ceil((b+E.clientHeight)/a))}}function cg(a){if(!E.clientWidth){br=bs=0;return}var b=a===!0?[]:[{from:br,to:bs,domStart:0}];for(var c=0,d=a.length||0;c<d;++c){var e=a[c],f=[],g=e.diff||0;for(var h=0,i=b.length;h<i;++h){var j=b[h];e.to<=j.from?f.push({from:j.from+g,to:j.to+g,domStart:j.domStart}):j.to<=e.from?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from,domStart:j.domStart}),e.to<j.to&&f.push({from:e.to+g,to:j.to+g,domStart:j.domStart+(e.to-j.from)}))}b=f}var k=cf(),l=Math.min(br,Math.max(k.from-3,0)),m=Math.min(bb.length,Math.max(bs,k.to+3)),n=[],o=0,p=bs-br,q=l,r=0;for(var c=0,d=b.length;c<d;++c){var j=b[c];if(j.to<=l)continue;if(j.from>=m)break;if(j.domStart>o||j.from>q)n.push({from:q,to:j.from,domSize:j.domStart-o,domStart:o}),r+=j.from-q;q=j.to,o=j.domStart+(j.to-j.from)}if(o!=p||q!=m)r+=Math.abs(m-q),n.push({from:q,to:m,domSize:p-o,domStart:o}),m-q!=p-o&&(bq=!0);if(!n.length)return;Y.style.display="none",r>(k.to-k.from)*.3?ch(l=Math.max(k.from-10,0),m=Math.min(k.to+7,bb.length)):ci(n),Y.style.display="";var s=l!=br||m!=bs||bt!=E.clientHeight;br=l,bs=m,T.style.top=l*cL()+"px",s&&(bt=E.clientHeight,R.style.height=bb.length*cL()+2*cM()+"px"),(s||bq)&&cj(),by==null&&(by=cG(bx)),by>E.clientWidth?(W.style.width=by+"px",R.style.width="",R.style.width=E.scrollWidth+"px"):W.style.width=R.style.width="";if(Y.childNodes.length!=bs-br)throw new Error("BAD PATCH! "+JSON.stringify(n)+" size="+(bs-br)+" nodes="+Y.childNodes.length);ck()}function ch(a,b){var c=[],d={line:a,ch:0},e=I(bf.from,d)&&!I(bf.to,d);for(var f=a;f<b;++f){var g=null,h=null;e?(g=0,bf.to.line==f&&(e=!1,h=bf.to.ch)):bf.from.line==f&&(bf.to.line==f?(g=bf.from.ch,h=bf.to.ch):(e=!0,g=bf.from.ch)),c.push(bb[f].getHTML(g,h,!0))}Y.innerHTML=c.join("")}function ci(a){var b=bf.from.line,c=bf.to.line,d=0,e=t&&n.createElement("div");for(var f=0,g=a.length;f<g;++f){var h=a[f],i=h.to-h.from-h.domSize,j=Y.childNodes[h.domStart+h.domSize+d]||null;if(t)for(var k=Math.max(-i,h.domSize);k>0;--k)Y.removeChild(j?j.previousSibling:Y.lastChild);else if(i){for(var k=Math.max(0,i);k>0;--k)Y.insertBefore(n.createElement("pre"),j);for(var k=Math.max(0,-i);k>0;--k)Y.removeChild(j?j.previousSibling:Y.lastChild)}var l=Y.childNodes[h.domStart+d],m=b<h.from&&c>=h.from;for(var k=h.from;k<h.to;++k){var o=null,p=null;m?(o=0,c==k&&(m=!1,p=bf.to.ch)):b==k&&(c==k?(o=bf.from.ch,p=bf.to.ch):(m=!0,o=bf.from.ch)),t?(e.innerHTML=bb[k].getHTML(o,p,!0),Y.insertBefore(e.firstChild,j)):(l.innerHTML=bb[k].getHTML(o,p,!1),l.className=bb[k].className||"",l=l.nextSibling)}d+=i}}function cj(){if(!g.gutter&&!g.lineNumbers)return;var a=T.offsetHeight,b=E.clientHeight;U.style.height=(a-b<2?b:a)+"px";var c=[];for(var d=br;d<Math.max(bs,br+1);++d){var e=bb[d].gutterMarker,f=g.lineNumbers?d+g.firstLineNumber:null;e&&e.text?f=e.text.replace("%N%",f!=null?f:""):f==null&&(f="\u00a0"),c.push(e&&e.style?'<pre class="'+e.style+'">':"<pre>",f,"</pre>")}U.style.display="none",V.innerHTML=c.join("");var h=String(bb.length).length,i=V.firstChild,j=G(i),k="";while(j.length+k.length<h)k+="\u00a0";k&&i.insertBefore(n.createTextNode(k),i.firstChild),U.style.display="",W.style.marginLeft=U.offsetWidth+"px",bq=!1}function ck(){var a=bf.inverted?bf.from:bf.to,b=cL(),c=cH(a.line,a.ch),d=a.line*b-E.scrollTop;C.style.top=Math.max(Math.min(d,E.offsetHeight),0)+"px",C.style.left=c-E.scrollLeft+"px",H(bf.from,bf.to)?(X.style.top=(a.line-br)*b+"px",X.style.left=c+"px",X.style.display=""):X.style.display="none"}function cl(a,b){var c=bg&&cp(bg);c&&(I(c,a)?a=c:I(b,c)&&(b=c)),cm(a,b)}function cm(a,b,c,d){if(H(bf.from,a)&&H(bf.to,b))return;if(I(b,a)){var e=b;b=a,a=e}H(a,b)?bf.inverted=!1:H(a,bf.to)?bf.inverted=!1:H(b,bf.from)&&(bf.inverted=!0),c==null&&(c=bf.from.line,d=bf.to.line),H(a,b)?H(bf.from,bf.to)||bm.push({from:c,to:d+1}):H(bf.from,bf.to)?bm.push({from:a.line,to:b.line+1}):(H(a,bf.from)||(a.line<c?bm.push({from:a.line,to:Math.min(b.line,c)+1}):bm.push({from:c,to:Math.min(d,a.line)+1})),H(b,bf.to)||(b.line<d?bm.push({from:Math.max(c,a.line),to:d+1}):bm.push({from:Math.max(a.line,d),to:b.line+1}))),bf.from=a,bf.to=b,bo=!0}function cn(a,b,c){var d=cp({line:a,ch:b||0});(c?cl:cm)(d,d)}function co(a){return Math.max(0,Math.min(a,bb.length-1))}function cp(a){if(a.line<0)return{line:0,ch:0};if(a.line>=bb.length)return{line:bb.length-1,ch:bb[bb.length-1].text.length};var b=a.ch,c=bb[a.line].text.length;return b==null||b>c?{line:a.line,ch:c}:b<0?{line:a.line,ch:0}:a}function cq(a){var b=Math.floor(E.clientHeight/cL()),c=bf.inverted?bf.from:bf.to;cn(c.line+Math.max(b-1,1)*(a?1:-1),c.ch,!0)}function cr(a){var b=a?{line:0,ch:0}:{line:bb.length-1,ch:bb[bb.length-1].text.length};cl(b,b)}function cs(){var a=bb.length-1;cm({line:0,ch:0},{line:a,ch:bb[a].text.length})}function ct(a){var b=bb[a.line].text,c=a.ch,d=a.ch;while(c>0&&/\w/.test(b.charAt(c-1)))--c;while(d<b.length&&/\w/.test(b.charAt(d)))++d;cl({line:a.line,ch:c},{line:a.line,ch:d})}function cu(a){cl({line:a,ch:0},{line:a,ch:bb[a].text.length})}function cv(){bU("\n","end"),g.enterMode!="flat"&&cy(bf.from.line,g.enterMode=="keep"?"prev":"smart")}function cw(a){function b(a){if(H(bf.from,bf.to))return cy(bf.from.line,a);var b=bf.to.line-(bf.to.ch?0:1);for(var c=bf.from.line;c<=b;++c)cy(c,a)}bg=null;switch(g.tabMode){case"default":return!1;case"indent":b("smart");break;case"classic":if(H(bf.from,bf.to)){a?cy(bf.from.line,"smart"):bU("\t","end");break};case"shift":b(a?"subtract":"add")}return!0}function cx(){var a=Math.max(0,bb[bf.from.line].text.search(/\S/));cn(bf.from.line,bf.from.ch<=a&&bf.from.ch?0:a,!0)}function cy(a,b){if(b=="smart")if(!ba.indent)b="prev";else var c=cU(a);var d=bb[a],e=d.indentation(),f=d.text.match(/^\s*/)[0],h;b=="prev"?a?h=bb[a-1].indentation():h=0:b=="smart"?h=ba.indent(c,d.text.slice(f.length)):b=="add"?h=e+g.indentUnit:b=="subtract"&&(h=e-g.indentUnit),h=Math.max(0,h);var i=h-e;if(!i){if(bf.from.line!=a&&bf.to.line!=a)return;var j=f}else{var j="",k=0;if(g.indentWithTabs)for(var l=Math.floor(h/z);l;--l)k+=z,j+="\t";while(k<h)++k,j+=" "}bT(j,{line:a,ch:0},{line:a,ch:f.length})}function cz(){ba=a.getMode(g,g.mode);for(var b=0,c=bb.length;b<c;++b)bb[b].stateAfter=null;bc=[0],cX()}function cA(){var a=g.gutter||g.lineNumbers;U.style.display=a?"":"none",a?bq=!0:Y.parentNode.style.marginLeft=0}function cB(a,b,c){function e(a,b,c,e){var a=bb[a],f=a.addMark(b,c,e);f.line=a,d.push(f)}a=cp(a),b=cp(b);var d=[];if(a.line==b.line)e(a.line,a.ch,b.ch,c);else{e(a.line,a.ch,null,c);for(var f=a.line+1,g=b.line;f<g;++f)e(f,0,null,c);e(b.line,0,b.ch,c)}return bm.push({from:a.line,to:b.line+1}),function(){var a,b;for(var c=0;c<d.length;++c){var e=d[c],f=N(bb,e.line);e.line.removeMark(e),f>-1&&(a==null&&(a=f),b=f)}a!=null&&bm.push({from:a,to:b+1})}}function cC(a,b,c){return typeof a=="number"&&(a=bb[co(a)]),a.gutterMarker={text:b,style:c},bq=!0,a}function cD(a){typeof a=="number"&&(a=bb[co(a)]),a.gutterMarker=null,bq=!0}function cE(a,b){if(typeof a=="number"){var c=a;a=bb[co(a)]}else{var c=N(bb,a);if(c==-1)return null}return a.className!=b&&(a.className=b,bm.push({from:c,to:c+1})),a}function cF(a){if(typeof a=="number"){var b=a;a=bb[a];if(!a)return null}else{var b=N(bb,a);if(b==-1)return null}var c=a.gutterMarker;return{line:b,text:a.text,markerText:c&&c.text,markerClass:c&&c.style}}function cG(a){return S.innerHTML="<pre><span>x</span></pre>",S.firstChild.firstChild.firstChild.nodeValue=a,S.firstChild.firstChild.offsetWidth||10}function cH(a,b){return b==0?0:(S.innerHTML="<pre><span>"+bb[a].getHTML(null,null,!1,b)+"</span></pre>",S.firstChild.firstChild.offsetWidth)}function cI(a,b){function e(a){return S.innerHTML="<pre><span>"+c.getHTML(null,null,!1,a)+"</span></pre>",S.firstChild.firstChild.offsetWidth}if(b<=0)return 0;var c=bb[a],d=c.text,f=0,g=0,h=d.length,i,j=Math.min(h,Math.ceil(b/cG("x")));for(;;){var k=e(j);if(k<=b&&j<h)j=Math.min(h,Math.ceil(j*1.2));else{i=k,h=j;break}}if(b>i)return h;j=Math.floor(h*.8),k=e(j),k<b&&(f=j,g=k);for(;;){if(h-f<=1)return i-b>b-g?f:h;var l=Math.ceil((f+h)/2),m=e(l);m>b?(h=l,i=m):(f=l,g=m)}}function cJ(a,b){var c=cL(),d=a.line-(b?br:0);return{x:cH(a.line,a.ch),y:d*c,yBot:(d+1)*c}}function cK(a){var b=cJ(a,!0),c=F(W);return{x:c.left+b.x,y:c.top+b.y,yBot:c.top+b.yBot}}function cL(){var a=Y.childNodes.length;return a?Y.offsetHeight/a||1:(S.innerHTML="<pre>x</pre>",S.firstChild.offsetHeight||1)}function cM(){return W.offsetTop}function cN(){return W.offsetLeft}function cO(a,b){var c=F(E,!0),d,e;try{d=a.clientX,e=a.clientY}catch(a){return null}if(!b&&(d-c.left>E.clientWidth||e-c.top>E.clientHeight))return null;var f=F(W,!0),g=br+Math.floor((e-f.top)/cL());return cp({line:g,ch:cI(co(g),d-f.left)})}function cP(a){function e(){var a=O(D.value).join("\n");a!=d&&c_(bU)(a,"end"),C.style.position="relative",D.style.cssText=c,bp=!1,ca(),bZ()}var b=cO(a);if(!b||window.opera)return;(H(bf.from,bf.to)||I(b,bf.from)||!I(b,bf.to))&&c_(cn)(b.line,b.ch);var c=D.style.cssText;C.style.position="absolute",D.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(a.clientY-5)+"px; left: "+(a.clientX-5)+"px; z-index: 1000; background: white; "+"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",bp=!0;var d=D.value=bX();cb(),Q(D,0,D.value.length);if(v){o(a);var f=r(window,"mouseup",function(){f(),setTimeout(e,20)},!0)}else setTimeout(e,50)}function cQ(){clearInterval(_);var a=!0;X.style.visibility="",_=setInterval(function(){X.style.visibility=(a=!a)?"":"hidden"},650)}function cS(a){function p(a,b,c){if(!a.text)return;var d=a.styles,e=g?0:a.text.length-1,f;for(var i=g?0:d.length-2,j=g?d.length:-2;i!=j;i+=2*h){var k=d[i];if(d[i+1]!=null&&d[i+1]!=m){e+=h*k.length;continue}for(var l=g?0:k.length-1,p=g?k.length:-1;l!=p;l+=h,e+=h)if(e>=b&&e<c&&o.test(f=k.charAt(l))){var q=cR[f];if(q.charAt(1)==">"==g)n.push(f);else{if(n.pop()!=q.charAt(0))return{pos:e,match:!1};if(!n.length)return{pos:e,match:!0}}}}}var b=bf.inverted?bf.from:bf.to,c=bb[b.line],d=b.ch-1,e=d>=0&&cR[c.text.charAt(d)]||cR[c.text.charAt(++d)];if(!e)return;var f=e.charAt(0),g=e.charAt(1)==">",h=g?1:-1,i=c.styles;for(var j=d+1,k=0,l=i.length;k<l;k+=2)if((j-=i[k].length)<=0){var m=i[k+1];break}var n=[c.text.charAt(d)],o=/[(){}[\]]/;for(var k=b.line,l=g?Math.min(k+100,bb.length):Math.max(-1,k-100);k!=l;k+=h){var c=bb[k],q=k==b.line,r=p(c,q&&g?d+1:0,q&&!g?d:c.text.length);if(r)break}r||(r={pos:null,match:!1});var m=r.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",s=cB({line:b.line,ch:d},{line:b.line,ch:d+1},m),t=r.pos!=null?cB({line:k,ch:r.pos},{line:k,ch:r.pos+1},m):function(){},u=c_(function(){s(),t()});a?setTimeout(u,800):bw=u}function cT(a){var b,c;for(var d=a,e=a-40;d>e;--d){if(d==0)return 0;var f=bb[d-1];if(f.stateAfter)return d;var g=f.indentation();if(c==null||b>g)c=d-1,b=g}return c}function cU(a){var b=cT(a),c=b&&bb[b-1].stateAfter;c?c=e(ba,c):c=f(ba);for(var d=b;d<a;++d){var g=bb[d];g.highlight(ba,c),g.stateAfter=e(ba,c)}return bm.push({from:b,to:a}),a<bb.length&&!bb[a].stateAfter&&bc.push(a),c}function cV(a,b){var c=cU(a);for(var d=a;d<b;++d){var f=bb[d];f.highlight(ba,c),f.stateAfter=e(ba,c)}}function cW(){var a=+(new Date)+g.workTime,b=bc.length;while(bc.length){if(!bb[br].stateAfter)var c=br;else var c=bc.pop();if(c>=bb.length)continue;var d=cT(c),h=d&&bb[d-1].stateAfter;h?h=e(ba,h):h=f(ba);var i=0,j=ba.compareStates,k=!1;for(var l=d,m=bb.length;l<m;++l){var n=bb[l],o=n.stateAfter;if(+(new Date)>a){bc.push(l),cX(g.workDelay),k&&bm.push({from:c,to:l+1});return}var p=n.highlight(ba,h);p&&(k=!0),n.stateAfter=e(ba,h);if(j){if(o&&j(o,h))break}else if(p!==!1||!o)i=0;else if(++i>3)break}k&&bm.push({from:c,to:l+1})}b&&g.onHighlightComplete&&g.onHighlightComplete(bC)}function cX(a){if(!bc.length)return;$.set(a,c_(cW))}function cY(){bl=null,bm=[],bn=bo=!1}function cZ(){var a=!1;bo&&(a=!cd()),bm.length?cg(bm):(bo&&ck(),bq&&cj()),a&&cd(),bo&&(cc(),cQ()),be&&!bp&&(bl===!0||bl!==!1&&bo)&&ca(),bo&&g.matchBrackets&&setTimeout(c_(function(){bw&&(bw(),bw=null),cS(!1)}),20);var b=bn;bo&&g.onCursorActivity&&g.onCursorActivity(bC),b&&g.onChange&&bC&&g.onChange(bC,b)}function c_(a){return function(){c$++||cY();try{var b=a.apply(this,arguments)}finally{--c$||cZ()}return b}}function da(a,b,c){this.atOccurrence=!1,c==null&&(c=typeof a=="string"&&a==a.toLowerCase()),b&&typeof b=="object"?b=cp(b):b={line:0,ch:0},this.pos={from:b,to:b};if(typeof a!="string")this.matches=function(b,c){if(b){var d=bb[c.line].text.slice(0,c.ch),e=d.match(a),f=0;while(e){var g=d.indexOf(e[0]);f+=g,d=d.slice(g+1);var h=d.match(a);if(h)e=h;else break;f++}}else var d=bb[c.line].text.slice(c.ch),e=d.match(a),f=e&&c.ch+d.indexOf(e[0]);if(e)return{from:{line:c.line,ch:f},to:{line:c.line,ch:f+e[0].length},match:e}};else{c&&(a=a.toLowerCase());var d=c?function(a){return a.toLowerCase()}:function(a){return a},e=a.split("\n");e.length==1?this.matches=function(b,c){var e=d(bb[c.line].text),f=a.length,g;if(b?c.ch>=f&&(g=e.lastIndexOf(a,c.ch-f))!=-1:(g=e.indexOf(a,c.ch))!=-1)return{from:{line:c.line,ch:g},to:{line:c.line,ch:g+f}}}:this.matches=function(a,b){var c=b.line,f=a?e.length-1:0,g=e[f],h=d(bb[c].text),i=a?h.indexOf(g)+g.length:h.lastIndexOf(g);if(a?i>=b.ch||i!=g.length:i<=b.ch||i!=h.length-g.length)return;for(;;){if(a?!c:c==bb.length-1)return;h=d(bb[c+=a?-1:1].text),g=e[a?--f:++f];if(f>0&&f<e.length-1){if(h!=g)return;continue}var j=a?h.lastIndexOf(g):h.indexOf(g)+g.length;if(a?j!=h.length-g.length:j!=g.length)return;var k={line:b.line,ch:i},l={line:c,ch:j};return{from:a?l:k,to:a?k:l}}}}}var g={},i=a.defaults;for(var k in i)i.hasOwnProperty(k)&&(g[k]=(c&&c.hasOwnProperty(k)?c:i)[k]);var n=g.document,x=n.createElement("div");x.className="CodeMirror",x.innerHTML='<div style="overflow: hidden; position: relative; width: 1px; height: 0px;"><textarea style="position: absolute; width: 2px;" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-'+g.theme+'">'+'<div style="position: relative">'+'<div style="position: absolute; height: 0; width: 0; overflow: hidden;"></div>'+'<div style="position: relative">'+'<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>'+'<div class="CodeMirror-lines"><div style="position: relative" draggable="true">'+'<pre class="CodeMirror-cursor"> </pre>'+"<div></div>"+"</div></div></div></div></div>",b.appendChild?b.appendChild(x):b(x);var C=x.firstChild,D=C.firstChild,E=x.lastChild,R=E.firstChild,S=R.firstChild,T=S.nextSibling,U=T.firstChild,V=U.firstChild,W=U.nextSibling.firstChild,X=W.firstChild,Y=X.nextSibling;g.tabindex!=null&&(D.tabindex=g.tabindex),!g.gutter&&!g.lineNumbers&&(U.style.display="none");var Z=new s,$=new s,_,ba,bb=[new h("")],bc,bd=new j,be;cz();var bf={from:{line:0,ch:0},to:{line:0,ch:0},inverted:!1},bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br=0,bs=0,bt=0,bu=null,bv,bw,bx="",by;c_(function(){bD(g.value||""),bl=!1})(),r(E,"mousedown",c_(bF)),r(E,"dblclick",c_(bG)),r(W,"dragstart",bI),v||r(E,"contextmenu",cP),r(E,"scroll",function(){cg([]),g.fixedGutter&&(U.style.left=E.scrollLeft+"px"),g.onScroll&&g.onScroll(bC)}),r(window,"resize",function(){cg(!0)}),r(D,"keyup",c_(bK)),r(D,"keydown",c_(bJ)),r(D,"keypress",c_(bL)),r(D,"focus",bM),r(D,"blur",bN),r(E,"dragenter",o),r(E,"dragover",o),r(E,"drop",c_(bH)),r(E,"paste",function(){cb(),b$()}),r(D,"paste",function(){b$()}),r(D,"cut",function(){b$()});var bz;try{bz=n.activeElement==D}catch(bA){}bz?setTimeout(bM,20):bN();var bC=x.CodeMirror={getValue:bE,setValue:c_(bD),getSelection:bX,replaceSelection:c_(bU),focus:function(){cb(),bM(),b$()},setOption:function(a,b){g[a]=b,a=="lineNumbers"||a=="gutter"||a=="firstLineNumber"?c_(cA)():a=="mode"||a=="indentUnit"?cz():a=="readOnly"&&b=="nocursor"?D.blur():a=="theme"&&(E.className=E.className.replace(/cm-s-\w+/,"cm-s-"+b))},getOption:function(a){return g[a]},undo:c_(bQ),redo:c_(bR),indentLine:c_(function(a,b){bB(a)&&cy(a,b==null?"smart":b?"add":"subtract")}),historySize:function(){return{undo:bd.done.length,redo:bd.undone.length}},matchBrackets:c_(function(){cS(!0)}),getTokenAt:function(a){return a=cp(a),bb[a.line].getTokenAt(ba,cU(a.line),a.ch)},getStateAfter:function(a){return a=co(a==null?bb.length-1:a),cU(a+1)},cursorCoords:function(a){return a==null&&(a=bf.inverted),cK(a?bf.from:bf.to)},charCoords:function(a){return cK(cp(a))},coordsChar:function(a){var b=F(W),c=co(Math.min(bb.length-1,br+Math.floor((a.y-b.top)/cL())));return cp({line:c,ch:cI(co(c),a.x-b.left)})},getSearchCursor:function(a,b,c){return new da(a,b,c)},markText:c_(function(a,b,c){return c_(cB(a,b,c))}),setMarker:c_(cC),clearMarker:c_(cD),setLineClass:c_(cE),lineInfo:cF,addWidget:function(a,b,c,d,e){a=cJ(cp(a));var f=a.yBot,g=a.x;b.style.position="absolute",R.appendChild(b);if(d=="over")f=a.y;else if(d=="near"){var h=Math.max(E.offsetHeight,bb.length*cL()),i=Math.max(R.clientWidth,W.clientWidth)-cN();a.yBot+b.offsetHeight>h&&a.y>b.offsetHeight&&(f=a.y-b.offsetHeight),g+b.offsetWidth>i&&(g=i-b.offsetWidth)}b.style.top=f+cM()+"px",b.style.left=b.style.right="",e=="right"?(g=R.clientWidth-b.offsetWidth,b.style.right="0px"):(e=="left"?g=0:e=="middle"&&(g=(R.clientWidth-b.offsetWidth)/2),b.style.left=g+cN()+"px"),c&&ce(g,f,g+b.offsetWidth,f+b.offsetHeight)},lineCount:function(){return bb.length},getCursor:function(a){return a==null&&(a=bf.inverted),J(a?bf.from:bf.to)},somethingSelected:function(){return!H(bf.from,bf.to)},setCursor:c_(function(a,b){b==null&&typeof a.line=="number"?cn(a.line,a.ch):cn(a,b)}),setSelection:c_(function(a,b){cm(cp(a),cp(b||a))}),getLine:function(a){if(bB(a))return bb[a].text},setLine:c_(function(a,b){bB(a)&&bT(b,{line:a,ch:0},{line:a,ch:bb[a].text.length})}),removeLine:c_(function(a){bB(a)&&bT("",{line:a,ch:0},cp({line:a+1,ch:0}))}),replaceRange:c_(bT),getRange:function(a,b){return bW(cp(a),cp(b))},coordsFromIndex:function(a){var b=bb.length,c=0,d,e,f;for(d=0;d<b;d++){f=bb[d].text.length+1;if(c+f>a){e=a-c;break}c+=f}return cp({line:d,ch:e})},operation:function(a){return c_(a)()},refresh:function(){cg(!0)},getInputField:function(){return D},getWrapperElement:function(){return x},getScrollerElement:function(){return E},getGutterElement:function(){return U}},bY=!1,cR={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},c$=0;da.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(a){function d(a){var c={line:a,ch:0};return b.pos={from:c,to:c},b.atOccurrence=!1,!1}var b=this,c=cp(a?this.pos.from:this.pos.to);for(;;){if(this.pos=this.matches(a,c))return this.atOccurrence=!0,this.pos.match||!0;if(a){if(!c.line)return d(0);c={line:c.line-1,ch:bb[c.line-1].text.length}}else{if(c.line==bb.length-1)return d(bb.length);c={line:c.line+1,ch:0}}}},from:function(){if(this.atOccurrence)return J(this.pos.from)},to:function(){if(this.atOccurrence)return J(this.pos.to)},replace:function(a){var b=this;this.atOccurrence&&c_(function(){b.pos.to=bT(a,b.pos.from,b.pos.to)})()}};for(var db in d)d.propertyIsEnumerable(db)&&!bC.propertyIsEnumerable(db)&&(bC[db]=d[db]);return bC}function e(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function f(a,b,c){return a.startState?a.startState(b,c):!0}function g(a){this.pos=this.start=0,this.string=a}function h(a,b){this.styles=b||[a,null],this.stateAfter=null,this.text=a,this.marked=this.gutterMarker=this.className=null}function i(a,b,c,d){for(var e=0,f=0,g=0;f<b;e+=2){var h=c[e],i=f+h.length;g==0?(i>a&&d.push(h.slice(a-f,Math.min(h.length,b-f)),c[e+1]),i>=a&&(g=1)):g==1&&(i>b?d.push(h.slice(0,b-f),c[e+1]):d.push(h,c[e+1])),f=i}}function j(){this.time=0,this.done=[],this.undone=[]}function k(){o(this)}function l(a){return a.stop||(a.stop=k),a}function m(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function n(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function o(a){m(a),n(a)}function p(a){return a.target||a.srcElement}function q(a){if(a.which)return a.which;if(a.button&1)return 1;if(a.button&2)return 3;if(a.button&4)return 2}function r(a,b,c,d){function e(a){c(a||window.event)}if(typeof a.addEventListener=="function"){a.addEventListener(b,e,!1);if(d)return function(){a.removeEventListener(b,e,!1)}}else{a.attachEvent("on"+b,e);if(d)return function(){a.detachEvent("on"+b,e)}}}function s(){this.id=null}function D(a,b){b==null&&(b=a.search(/[^\s\u00a0]/),b==-1&&(b=a.length));for(var c=0,d=0;c<b;++c)a.charAt(c)=="\t"?d+=z-d%z:++d;return d}function E(a){return a.currentStyle?a.currentStyle:window.getComputedStyle(a,null)}function F(a,b){var c=a.ownerDocument.body,d=0,e=0,f=!1;for(var g=a;g;g=g.offsetParent)d+=g.offsetLeft,e+=g.offsetTop,b&&E(g).position=="fixed"&&(f=!0);var h=b&&!f?null:c;for(var g=a.parentNode;g!=h;g=g.parentNode)g.scrollLeft!=null&&(d-=g.scrollLeft,e-=g.scrollTop);return{left:d,top:e}}function G(a){return a.textContent||a.innerText||a.nodeValue||""}function H(a,b){return a.line==b.line&&a.ch==b.ch}function I(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function J(a){return{line:a.line,ch:a.ch}}function L(a){return K.innerText=K.textContent=a,K.innerHTML}function M(a,b){if(!b)return a?a.length:0;if(!a)return b.length;for(var c=a.length,d=b.length;c>=0&&d>=0;--c,--d)if(a.charAt(c)!=b.charAt(d))break;return d+1}function N(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c<d;++c)if(a[c]==b)return c;return-1}a.defaults={value:"",mode:null,theme:"default",indentUnit:2,indentWithTabs:!1,tabMode:"classic",enterMode:"indent",electricChars:!0,onKeyEvent:null,lineNumbers:!1,gutter:!1,fixedGutter:!1,firstLineNumber:1,readOnly:!1,smartHome:!0,onChange:null,onCursorActivity:null,onGutterClick:null,onHighlightComplete:null,onFocus:null,onBlur:null,onScroll:null,matchBrackets:!1,workTime:100,workDelay:200,undoDepth:40,tabindex:null,document:window.document};var b={},c={};a.defineMode=function(c,d){!a.defaults.mode&&c!="null"&&(a.defaults.mode=c),b[c]=d},a.defineMIME=function(a,b){c[a]=b},a.getMode=function(d,e){typeof e=="string"&&c.hasOwnProperty(e)&&(e=c[e]);if(typeof e=="string")var f=e,g={};else if(e!=null)var f=e.name,g=e;var h=b[f];return h?h(d,g||{}):(window.console&&console.warn("No mode "+f+" found, falling back to plain text."),a.getMode(d,"text/plain"))},a.listModes=function(){var a=[];for(var c in b)b.propertyIsEnumerable(c)&&a.push(c);return a},a.listMIMEs=function(){var a=[];for(var b in c)c.propertyIsEnumerable(b)&&a.push({mime:b,mode:c[b]});return a};var d={};a.defineExtension=function(a,b){d[a]=b},a.fromTextArea=function(b,c){function d(){b.value=h.getValue()}c||(c={}),c.value=b.value,!c.tabindex&&b.tabindex&&(c.tabindex=b.tabindex);if(b.form){var e=r(b.form,"submit",d,!0);if(typeof b.form.submit=="function"){var f=b.form.submit;function g(){d(),b.form.submit=f,b.form.submit(),b.form.submit=g}b.form.submit=g}}b.style.display="none";var h=a(function(a){b.parentNode.insertBefore(a,b.nextSibling)},c);return h.save=d,h.toTextArea=function(){d(),b.parentNode.removeChild(h.getWrapperElement()),b.style.display="",b.form&&(e(),typeof b.form.submit=="function"&&(b.form.submit=f))},h},a.startState=f,a.copyState=e,g.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if(typeof a=="string")var c=b==a;else var c=b&&(a.test?a.test(b):a(b));if(c)return++this.pos,b},eatWhile:function(a){var b=this.pos;while(this.eat(a));return this.pos>b},eatSpace:function(){var a=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);if(b>-1)return this.pos=b,!0},backUp:function(a){this.pos-=a},column:function(){return D(this.string,this.start)},indentation:function(){return D(this.string)},match:function(a,b,c){if(typeof a!="string"){var e=this.string.slice(this.pos).match(a);return e&&b!==!1&&(this.pos+=e[0].length),e}function d(a){return c?a.toLowerCase():a}if(d(this.string).indexOf(d(a),this.pos)==this.pos)return b!==!1&&(this.pos+=a.length),!0},current:function(){return this.string.slice(this.start,this.pos)}},a.StringStream=g,h.prototype={replace:function(a,b,c){var d=[],e=this.marked;i(0,a,this.styles,d),c&&d.push(c,null),i(b,this.text.length,this.styles,d),this.styles=d,this.text=this.text.slice(0,a)+c+this.text.slice(b),this.stateAfter=null;if(e){var f=c.length-(b-a),g=this.text.length;function h(a){return a<=Math.min(b,b+f)?a:a+f}for(var j=0;j<e.length;++j){var k=e[j],l=!1;k.from>=g?l=!0:(k.from=h(k.from),k.to!=null&&(k.to=h(k.to)));if(l||k.from>=k.to)e.splice(j,1),j--}}},split:function(a,b){var c=[b,null];return i(a,this.text.length,this.styles,c),new h(b+this.text.slice(a),c)},addMark:function(a,b,c){var d=this.marked,e={from:a,to:b,style:c};return this.marked==null&&(this.marked=[]),this.marked.push(e),this.marked.sort(function(a,b){return a.from-b.from}),e},removeMark:function(a){var b=this.marked;if(!b)return;for(var c=0;c<b.length;++c)if(b[c]==a){b.splice(c,1);break}},highlight:function(a,b){var c=new g(this.text),d=this.styles,e=0,f=!1,h=d[0],i;this.text==""&&a.blankLine&&a.blankLine(b);while(!c.eol()){var j=a.token(c,b),k=this.text.slice(c.start,c.pos);c.start=c.pos,e&&d[e-1]==j?d[e-2]+=k:k&&(!f&&(d[e+1]!=j||e&&d[e-2]!=i)&&(f=!0),d[e++]=k,d[e++]=j,i=h,h=d[e]);if(c.pos>5e3){d[e++]=this.text.slice(c.pos),d[e++]=null;break}}return d.length!=e&&(d.length=e,f=!0),e&&d[e-2]!=i&&(f=!0),f||(d.length<5&&this.text.length<10?null:!1)},getTokenAt:function(a,b,c){var d=this.text,e=new g(d);while(e.pos<c&&!e.eol()){e.start=e.pos;var f=a.token(e,b)}return{start:e.start,end:e.pos,string:e.current(),className:f||null,state:b}},indentation:function(){return D(this.text)},getHTML:function(a,b,c,d){function f(a,b){if(!a)return;b?e.push('<span class="',b,'">',L(a),"</span>"):e.push(L(a))}var e=[];c&&e.push(this.className?'<pre class="'+this.className+'">':"<pre>");var g=this.styles,h=this.text,i=this.marked;a==b&&(a=null);var j=h.length;d!=null&&(j=Math.min(d,j));if(!h&&d==null)f(" ",a!=null&&b==null?"CodeMirror-selected":null);else if(!i&&a==null)for(var k=0,l=0;l<j;k+=2){var m=g[k],n=g[k+1],o=m.length;l+o>j&&(m=m.slice(0,j-l)),l+=o,f(m,n&&"cm-"+n)}else{var p=0,k=0,q="",n,r=0,s=-1,t=null;function u(){i&&(s+=1,t=s<i.length?i[s]:null)}u();while(p<j){var v=j,w="";if(a!=null)if(a>p)v=a;else if(b==null||b>p)w=" CodeMirror-selected",b!=null&&(v=Math.min(v,b));while(t&&t.to!=null&&t.to<=p)u();t&&(t.from>p?v=Math.min(v,t.from):(w+=" "+t.style,t.to!=null&&(v=Math.min(v,t.to))));for(;;){var x=p+q.length,y=n;w&&(y=n?n+w:w),f(x>v?q.slice(0,v-p):q,y);if(x>=v){q=q.slice(v-p),p=v;break}p=x,q=g[k++],n="cm-"+g[k++]}}a!=null&&b==null&&f(" ","CodeMirror-selected")}return c&&e.push("</pre>"),e.join("")}},j.prototype={addChange:function(a,b,c){this.undone.length=0;var d=+(new Date),e=this.done[this.done.length-1];if(d-this.time>400||!e||e.start>a+b||e.start+e.added<a-e.added+e.old.length)this.done.push({start:a,added:b,old:c});else{var f=0;if(a<e.start){for(var g=e.start-a-1;g>=0;--g)e.old.unshift(c[g]);e.added+=e.start-a,e.start=a}else e.start<a&&(f=a-e.start,b+=f);for(var g=e.added-f,h=c.length;g<h;++g)e.old.push(c[g]);e.added<b&&(e.added=b)}this.time=d}},s.prototype={set:function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)}};var t=function(){var a=document.createElement("pre");return a.innerHTML=" ",!a.innerHTML}(),u=function(){if(/MSIE [1-8]\b/.test(navigator.userAgent))return!1;var a=document.createElement("div");return"ondragstart"in a&&"ondrop"in a}(),v=/gecko\/\d{7}/i.test(navigator.userAgent),w=/MSIE \d/.test(navigator.userAgent),x=/Apple Computer/.test(navigator.vendor),y="\n";(function(){var a=document.createElement("textarea");a.value="foo\nbar",a.value.indexOf("\r")>-1&&(y="\r\n")})();var z=8,A=/Mac/.test(navigator.platform),B={};for(var C=35;C<=40;++C)B[C]=B["c"+C]=!0;var K=document.createElement("div");a.htmlEscape=L;var O,P,Q;return"\n\nb".split(/\n/).length!=3?O=function(a){var b=0,c,d=[];while((c=a.indexOf("\n",b))>-1)d.push(a.slice(b,a.charAt(c-1)=="\r"?c-1:c)),b=c+1;return d.push(a.slice(b)),d}:O=function(a){return a.split(/\r?\n/)},a.splitLines=O,window.getSelection?(P=function(a){try{return{start:a.selectionStart,end:a.selectionEnd}}catch(b){return null}},x?Q=function(a,b,c){b==c?a.setSelectionRange(b,c):(a.setSelectionRange(b,c-1),window.getSelection().modify("extend","forward","character"))}:Q=function(a,b,c){try{a.setSelectionRange(b,c)}catch(d){}}):(P=function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){return null}if(!b||b.parentElement()!=a)return null;var d=a.value,e=d.length,f=a.createTextRange();f.moveToBookmark(b.getBookmark());var g=a.createTextRange();g.collapse(!1);if(f.compareEndPoints("StartToEnd",g)>-1)return{start:e,end:e};var h=-f.moveStart("character",-e);for(var i=d.indexOf("\r");i>-1&&i<h;i=d.indexOf("\r",i+1),h++);if(f.compareEndPoints("EndToEnd",g)>-1)return{start:h,end:e};var j=-f.moveEnd("character",-e);for(var i=d.indexOf("\r");i>-1&&i<j;i=d.indexOf("\r",i+1),j++);return{start:h,end:j}},Q=function(a,b,c){var d=a.createTextRange();d.collapse(!0);var e=d.duplicate(),f=0,g=a.value;for(var h=g.indexOf("\n");h>-1&&h<b;h=g.indexOf("\n",h+1))++f;d.move("character",b-f);for(;h>-1&&h<c;h=g.indexOf("\n",h+1))++f;e.move("character",c-f),d.setEndPoint("EndToEnd",e),d.select()}),a.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),a.defineMIME("text/plain","null"),a}();CodeMirror.overlayParser=function(a,b,c){return{startState:function(){return{base:CodeMirror.startState(a),overlay:CodeMirror.startState(b),basePos:0,baseCur:null,overlayPos:0,overlayCur:null}},copyState:function(c){return{base:CodeMirror.copyState(a,c.base),overlay:CodeMirror.copyState(b,c.overlay),basePos:c.basePos,baseCur:null,overlayPos:c.overlayPos,overlayCur:null}},token:function(d,e){return d.start==e.basePos&&(e.baseCur=a.token(d,e.base),e.basePos=d.pos),d.start==e.overlayPos&&(d.pos=d.start,e.overlayCur=b.token(d,e.overlay),e.overlayPos=d.pos),d.pos=Math.min(e.basePos,e.overlayPos),d.eol()&&(e.basePos=e.overlayPos=0),e.overlayCur==null?e.baseCur:e.baseCur!=null&&c?e.baseCur+" "+e.overlayCur:e.overlayCur},indent:function(b,c){return a.indent(b.base,c)},electricChars:a.electricChars}},CodeMirror.runMode=function(a,b,c){var d=CodeMirror.getMode({indentUnit:2},b),e=c.nodeType==1;if(e){var f=c,g=[];c=function(a,b){a=="\n"?g.push("<br>"):b?g.push('<span class="cm-'+CodeMirror.htmlEscape(b)+'">'+CodeMirror.htmlEscape(a)+"</span>"):g.push(CodeMirror.htmlEscape(a))}}var h=CodeMirror.splitLines(a),i=CodeMirror.startState(d);for(var j=0,k=h.length;j<k;++j){j&&c("\n");var l=new CodeMirror.StringStream(h[j]);while(!l.eol()){var m=d.token(l,i);c(l.current(),m),l.start=l.pos}}e&&(f.innerHTML=g.join(""))},CodeMirror.defineMode("css",function(a){function d(a,b){return c=b,a}function e(a,b){var c=a.next();if(c=="@")return a.eatWhile(/[\w\\\-]/),d("meta",a.current());if(c=="/"&&a.eat("*"))return b.tokenize=f,f(a,b);if(c=="<"&&a.eat("!"))return b.tokenize=g,g(a,b);if(c=="=")d(null,"compare");else return c!="~"&&c!="|"||!a.eat("=")?c=='"'||c=="'"?(b.tokenize=h(c),b.tokenize(a,b)):c=="#"?(a.eatWhile(/[\w\\\-]/),d("atom","hash")):c=="!"?(a.match(/^\s*\w*/),d("keyword","important")):/\d/.test(c)?(a.eatWhile(/[\w.%]/),d("number","unit")):/[,.+>*\/]/.test(c)?d(null,"select-op"):/[;{}:\[\]]/.test(c)?d(null,c):(a.eatWhile(/[\w\\\-]/),d("variable","variable")):d(null,"compare")}function f(a,b){var c=!1,f;while((f=a.next())!=null){if(c&&f=="/"){b.tokenize=e;break}c=f=="*"}return d("comment","comment")}function g(a,b){var c=0,f;while((f=a.next())!=null){if(c>=2&&f==">"){b.tokenize=e;break}c=f=="-"?c+1:0}return d("comment","comment")}function h(a){return function(b,c){var f=!1,g;while((g=b.next())!=null){if(g==a&&!f)break;f=!f&&g=="\\"}return f||(c.tokenize=e),d("string","string")}}var b=a.indentUnit,c;return{startState:function(a){return{tokenize:e,baseIndent:a||0,stack:[]}},token:function(a,b){if(a.eatSpace())return null;var d=b.tokenize(a,b),e=b.stack[b.stack.length-1];if(c=="hash"&&e=="rule")d="atom";else if(d=="variable")if(e=="rule")d="number";else if(!e||e=="@media{")d="tag";return e=="rule"&&/^[\{\};]$/.test(c)&&b.stack.pop(),c=="{"?e=="@media"?b.stack[b.stack.length-1]="@media{":b.stack.push("{"):c=="}"?b.stack.pop():c=="@media"?b.stack.push("@media"):e=="{"&&c!="comment"&&b.stack.push("rule"),d},indent:function(a,c){var d=a.stack.length;return/^\}/.test(c)&&(d-=a.stack[a.stack.length-1]=="rule"?2:1),a.baseIndent+d*b},electricChars:"}"}}),CodeMirror.defineMIME("text/css","css"),CodeMirror.defineMode("htmlmixed",function(a,b){function f(a,b){var f=c.token(a,b.htmlState);return f=="tag"&&a.current()==">"&&b.htmlState.context&&(/^script$/i.test(b.htmlState.context.tagName)?(b.token=h,b.localState=d.startState(c.indent(b.htmlState,"")),b.mode="javascript"):/^style$/i.test(b.htmlState.context.tagName)&&(b.token=i,b.localState=e.startState(c.indent(b.htmlState,"")),b.mode="css")),f}function g(a,b,c){var d=a.current(),e=d.search(b);return e>-1&&a.backUp(d.length-e),c}function h(a,b){return a.match(/^<\/\s*script\s*>/i,!1)?(b.token=f,b.curState=null,b.mode="html",f(a,b)):g(a,/<\/\s*script\s*>/,d.token(a,b.localState))}function i(a,b){return a.match(/^<\/\s*style\s*>/i,!1)?(b.token=f,b.localState=null,b.mode="html",f(a,b)):g(a,/<\/\s*style\s*>/,e.token(a,b.localState))}var c=CodeMirror.getMode(a,{name:"xml",htmlMode:!0}),d=CodeMirror.getMode(a,"javascript"),e=CodeMirror.getMode(a,"css");return{startState:function(){var a=c.startState();return{token:f,localState:null,mode:"html",htmlState:a}},copyState:function(a){if(a.localState)var b=CodeMirror.copyState(a.token==i?e:d,a.localState);return{token:a.token,localState:b,mode:a.mode,htmlState:CodeMirror.copyState(c,a.htmlState)}},token:function(a,b){return b.token(a,b)},indent:function(a,b){return a.token==f||/^\s*<\//.test(b)?c.indent(a.htmlState,b):a.token==h?d.indent(a.localState,b):e.indent(a.localState,b)},electricChars:"/{}:"}}),CodeMirror.defineMIME("text/html","htmlmixed"),CodeMirror.defineMode("javascript",function(a,b){function g(a,b,c){return b.tokenize=c,c(a,b)}function h(a,b){var c=!1,d;while((d=a.next())!=null){if(d==b&&!c)return!1;c=!c&&d=="\\"}return c}function k(a,b,c){return i=a,j=c,b}function l(a,b){var c=a.next();if(c=='"'||c=="'")return g(a,b,m(c));if(/[\[\]{}\(\),;\:\.]/.test(c))return k(c);if(c=="0"&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),k("number","number");if(/\d/.test(c))return a.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/),k("number","number");if(c=="/")return a.eat("*")?g(a,b,n):a.eat("/")?(a.skipToEnd(),k("comment","comment")):b.reAllowed?(h(a,"/"),a.eatWhile(/[gimy]/),k("regexp","string")):(a.eatWhile(f),k("operator",null,a.current()));if(c=="#")return a.skipToEnd(),k("error","error");if(f.test(c))return a.eatWhile(f),k("operator",null,a.current());a.eatWhile(/[\w\$_]/);var d=a.current(),i=e.propertyIsEnumerable(d)&&e[d];return i?k(i.type,i.style,d):k("variable","variable",d)}function m(a){return function(b,c){return h(b,a)||(c.tokenize=l),k("string","string")}}function n(a,b){var c=!1,d;while(d=a.next()){if(d=="/"&&c){b.tokenize=l;break}c=d=="*"}return k("comment","comment")}function p(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,d!=null&&(this.align=d)}function q(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0}function r(a,b,c,e,f){var g=a.cc;s.state=a,s.stream=f,s.marked=null,s.cc=g,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);for(;;){var h=g.length?g.pop():d?D:C;if(h(c,e)){while(g.length&&g[g.length-1].lex)g.pop()();return s.marked?s.marked:c=="variable"&&q(a,e)?"variable-2":b}}}function t(){for(var a=arguments.length-1;a>=0;a--)s.cc.push(arguments[a])}function u(){return t.apply(null,arguments),!0}function v(a){var b=s.state;if(b.context){s.marked="def";for(var c=b.localVars;c;c=c.next)if(c.name==a)return;b.localVars={name:a,next:b.localVars}}}function x(){s.state.context||(s.state.localVars=w),s.state.context={prev:s.state.context,vars:s.state.localVars}}function y(){s.state.localVars=s.state.context.vars,s.state.context=s.state.context.prev}function z(a,b){var c=function(){var c=s.state;c.lexical=new p(c.indented,s.stream.column(),a,null,c.lexical,b)};return c.lex=!0,c}function A(){var a=s.state;a.lexical.prev&&(a.lexical.type==")"&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function B(a){return function b(b){return b==a?u():a==";"?t():u(arguments.callee)}}function C(a){return a=="var"?u(z("vardef"),K,B(";"),A):a=="keyword a"?u(z("form"),D,C,A):a=="keyword b"?u(z("form"),C,A):a=="{"?u(z("}"),J,A):a==";"?u():a=="function"?u(Q):a=="for"?u(z("form"),B("("),z(")"),M,B(")"),A,C,A):a=="variable"?u(z("stat"),F):a=="switch"?u(z("form"),D,z("}","switch"),B("{"),J,A,A):a=="case"?u(D,B(":")):a=="default"?u(B(":")):a=="catch"?u(z("form"),x,B("("),R,B(")"),C,A,y):t(z("stat"),D,B(";"),A)}function D(a){return o.hasOwnProperty(a)?u(E):a=="function"?u(Q):a=="keyword c"?u(D):a=="("?u(z(")"),D,B(")"),A,E):a=="operator"?u(D):a=="["?u(z("]"),I(D,"]"),A,E):a=="{"?u(z("}"),I(H,"}"),A,E):u()}function E(a,b){if(a=="operator"&&/\+\+|--/.test(b))return u(E);if(a=="operator")return u(D);if(a==";")return;if(a=="(")return u(z(")"),I(D,")"),A,E);if(a==".")return u(G,E);if(a=="[")return u(z("]"),D,B("]"),A,E)}function F(a){return a==":"?u(A,C):t(E,B(";"),A)}function G(a){if(a=="variable")return s.marked="property",u()}function H(a){a=="variable"&&(s.marked="property");if(o.hasOwnProperty(a))return u(B(":"),D)}function I(a,b){function c(d){return d==","?u(a,c):d==b?u():u(B(b))}return function d(d){return d==b?u():t(a,c)}}function J(a){return a=="}"?u():t(C,J)}function K(a,b){return a=="variable"?(v(b),u(L)):u()}function L(a,b){if(b=="=")return u(D,L);if(a==",")return u(K)}function M(a){return a=="var"?u(K,O):a==";"?t(O):a=="variable"?u(N):t(O)}function N(a,b){return b=="in"?u(D):u(E,O)}function O(a,b){return a==";"?u(P):b=="in"?u(D):u(D,B(";"),P)}function P(a){a!=")"&&u(D)}function Q(a,b){if(a=="variable")return v(b),u(Q);if(a=="(")return u(z(")"),x,I(R,")"),A,C,y)}function R(a,b){if(a=="variable")return v(b),u()}var c=a.indentUnit,d=b.json,e=function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),f={type:"atom",style:"atom"};return{"if":b,"while":b,"with":b,"else":c,"do":c,"try":c,"finally":c,"return":d,"break":d,"continue":d,"new":d,"delete":d,"throw":d,"var":a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":e,"typeof":e,"instanceof":e,"true":f,"false":f,"null":f,"undefined":f,NaN:f,Infinity:f}}(),f=/[+\-*&%=<>!?|]/,i,j,o={atom:!0,number:!0,variable:!0,string:!0,regexp:!0},s={state:null,column:null,marked:null,cc:null},w={name:"this",next:{name:"arguments"}};return A.lex=!0,{startState:function(a){return{tokenize:l,reAllowed:!0,cc:[],lexical:new p((a||0)-c,0,"block",!1),localVars:null,context:null,indented:0}},token:function(a,b){a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation());if(a.eatSpace())return null;var c=b.tokenize(a,b);return i=="comment"?c:(b.reAllowed=i=="operator"||i=="keyword c"||i.match(/^[\[{}\(,;:]$/),r(b,c,i,j,a))},indent:function(a,b){if(a.tokenize!=l)return 0;var d=b&&b.charAt(0),e=a.lexical,f=e.type,g=d==f;return f=="vardef"?e.indented+4:f=="form"&&d=="{"?e.indented:f=="stat"||f=="form"?e.indented+c:e.info=="switch"&&!g?e.indented+(/^(?:case|default)\b/.test(b)?c:2*c):e.align?e.column+(g?0:1):e.indented+(g?0:c)},electricChars:":{}"}}),CodeMirror.defineMIME("text/javascript","javascript"),CodeMirror.defineMIME("application/json",{name:"javascript",json:!0}),CodeMirror.defineMode("xml",function(a,b){function h(a,b){function c(c){return b.tokenize=c,c(a,b)}var d=a.next();if(d=="<"){if(a.eat("!"))return a.eat("[")?a.match("CDATA[")?c(k("atom","]]>")):null:a.match("--")?c(k("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),c(k("meta",">"))):null;if(a.eat("?"))return a.eatWhile(/[\w\._\-]/),b.tokenize=k("meta","?>"),"meta";g=a.eat("/")?"closeTag":"openTag",a.eatSpace(),f="";var e;while(e=a.eat(/[^\s\u00a0=<>\"\'\/?]/))f+=e;return b.tokenize=i,"tag"}return d=="&"?(a.eatWhile(/[^;]/),a.eat(";"),"atom"):(a.eatWhile(/[^&<]/),null)}function i(a,b){var c=a.next();return c==">"||c=="/"&&a.eat(">")?(b.tokenize=h,g=c==">"?"endTag":"selfcloseTag","tag"):c=="="?(g="equals",null):/[\'\"]/.test(c)?(b.tokenize=j(c),b.tokenize(a,b)):(a.eatWhile(/[^\s\u00a0=<>\"\'\/?]/),"word")}function j(a){return function(b,c){while(!b.eol())if(b.next()==a){c.tokenize=i;break}return"string"}}function k(a,b){return function(c,d){while(!c.eol()){if(c.match(b)){d.tokenize=h;break}c.next()}return a}}function n(){for(var a=arguments.length-1;a>=0;a--)l.cc.push(arguments[a])}function o(){return n.apply(null,arguments),!0}function p(a,b){var c=d.doNotIndent.hasOwnProperty(a)||l.context&&l.context.noIndent;l.context={prev:l.context,tagName:a,indent:l.indented,startOfLine:b,noIndent:c}}function q(){l.context&&(l.context=l.context.prev)}function r(a){if(a=="openTag")return l.tagName=f,o(u,s(l.startOfLine));if(a=="closeTag"){var b=!1;return l.context?b=l.context.tagName!=f:b=!0,b&&(m="error"),o(t(b))}return a=="string"?((!l.context||l.context.name!="!cdata")&&p("!cdata"),l.tokenize==h&&q(),o()):o()}function s(a){return function(b){return b=="selfcloseTag"||b=="endTag"&&d.autoSelfClosers.hasOwnProperty(l.tagName.toLowerCase())?o():b=="endTag"?(p(l.tagName,a),o()):o()}}function t(a){return function(b){return a&&(m="error"),b=="endTag"?(q(),o()):(m="error",o(arguments.callee))}}function u(a){return a=="word"?(m="attribute",o(u)):a=="equals"?o(v,u):a=="string"?(m="error",o(u)):n()}function v(a){return a=="word"&&d.allowUnquoted?(m="string",o()):a=="string"?o(w):n()}function w(a){return a=="string"?o(w):n()}var c=a.indentUnit,d=b.htmlMode?{autoSelfClosers:{br:!0,img:!0,hr:!0,link:!0,input:!0,meta:!0,col:!0,frame:!0,base:!0,area:!0},doNotIndent:{pre:!0,"!cdata":!0},allowUnquoted:!0}:{autoSelfClosers:{},doNotIndent:{"!cdata":!0},allowUnquoted:!1},e=b.alignCDATA,f,g,l,m;return{startState:function(){return{tokenize:h,cc:[],indented:0,startOfLine:!0,tagName:null,context:null}},token:function(a,b){a.sol()&&(b.startOfLine=!0,b.indented=a.indentation());if(a.eatSpace())return null;m=g=f=null;var c=b.tokenize(a,b);if((c||g)&&c!="comment"){l=b;for(;;){var d=b.cc.pop()||r;if(d(g||c))break}}return b.startOfLine=!1,m||c},indent:function(a,b){var d=a.context;if(d&&d.noIndent)return 0;if(e&&/<!\[CDATA\[/.test(b))return 0;d&&/^<\//.test(b)&&(d=d.prev);while(d&&!d.startOfLine)d=d.prev;return d?d.indent+c:0},compareStates:function(a,b){if(a.indented!=b.indented)return!1;for(var c=a.context,d=b.context;;c=c.prev,d=d.prev){if(!c||!d)return c==d;if(c.tagName!=d.tagName)return!1}},electricChars:"/"}}),CodeMirror.defineMIME("application/xml","xml"),CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0})
|
@@ -0,0 +1,35 @@
|
|
1
|
+
(function($) {
|
2
|
+
elRTE.prototype.codeMirror = true;
|
3
|
+
elRTE.prototype.updateSourceOld = elRTE.prototype.updateSource;
|
4
|
+
elRTE.prototype.updateSource = function() {
|
5
|
+
if( this.codeMirror ) {
|
6
|
+
var blockHtmlElements = 'h[1-6]|div|p|blockquote|pre|form|label|select|input|button|ol|ul|dd|dt|li|table|thead|tbody|td|th|tr';
|
7
|
+
|
8
|
+
var html = this.filter.source($(this.doc.body).html());
|
9
|
+
html = html.replace(new RegExp('(</?(' + blockHtmlElements + ')[^<]*?>)\\s*', 'gi'), '$1\n')
|
10
|
+
.replace(new RegExp('\\s*(</?(' + blockHtmlElements + ')[^<]*?>)', 'gi'), '\n$1');
|
11
|
+
this.source.val(html);
|
12
|
+
|
13
|
+
this.codeMirror = CodeMirror.fromTextArea(this.source[0], {
|
14
|
+
mode: 'htmlmixed',
|
15
|
+
tabMode: 'indent'
|
16
|
+
});
|
17
|
+
for (var i = 0, e = this.codeMirror.lineCount(); i < e; ++i) this.codeMirror.indentLine(i);
|
18
|
+
|
19
|
+
this.source.css('display','block')
|
20
|
+
.css('position','absolute')
|
21
|
+
.css('z-index','-1');
|
22
|
+
} else {
|
23
|
+
this.updateSourceOld();
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
elRTE.prototype.updateEditorOld = elRTE.prototype.updateEditor;
|
28
|
+
elRTE.prototype.updateEditor = function() {
|
29
|
+
if( this.codeMirror ){
|
30
|
+
this.codeMirror.toTextArea();
|
31
|
+
this.source.css('display','none');
|
32
|
+
}
|
33
|
+
this.updateEditorOld();
|
34
|
+
}
|
35
|
+
})(jQuery);
|
@@ -0,0 +1,267 @@
|
|
1
|
+
function eli18n(a){this.textdomain=function(b){return this.messages[b]?this._domain=b:this._domain};a&&a.messages&&this.load(a.messages);a&&a.textdomain&&this.textdomain(a.textdomain)}eli18n.prototype=new function(){this.messages={};this._domain="";this.load=function(c){if(typeof(c)=="object"){for(var f in c){var b=c[f];if(typeof(b)=="object"){if(!this.messages[f]){this.messages[f]={}}for(var a in b){if(typeof(b[a])=="string"){this.messages[f][a]=b[a]}}}}}return this};this.translate=function(b,a){var a=a&&this.messages[a]?a:this._domain;
|
2
|
+
return this.messages[a]&&this.messages[a][b]?this.messages[a][b]:b};this.format=function(f,b,c){f=this.translate(f,c);if(typeof(b)=="object"){for(var a in b){f=f.replace("%"+a,this.translate(b[a],c))}}return f}};function elDialogForm(c){var a=this;var b={"class":"el-dialogform",submit:function(f,g){g.close()},form:{action:window.location.href,method:"post"},ajaxForm:null,validate:null,spinner:"Loading",tabs:{active:0,selected:0},tabPrefix:"el-df-tab-",dialog:{title:"dialog",autoOpen:false,modal:true,resizable:false,closeOnEscape:true,buttons:{Cancel:function(){a.close()
|
3
|
+
},Ok:function(){a.form.trigger("submit")}}}};this.opts=jQuery.extend(true,{},b,c);this.opts.dialog.close=function(){a.close()};if(this.opts.rtl){this.opts["class"]+=" el-dialogform-rtl"}if(c&&c.dialog&&c.dialog.buttons&&typeof(c.dialog.buttons)=="object"){this.opts.dialog.buttons=c.dialog.buttons}this.ul=null;this.tabs={};this._table=null;this.dialog=jQuery("<div />").addClass(this.opts["class"]).dialog(this.opts.dialog);this.message=jQuery('<div class="el-dialogform-message rounded-5" />').hide().appendTo(this.dialog);
|
4
|
+
this.error=jQuery('<div class="el-dialogform-error rounded-5" />').hide().appendTo(this.dialog);this.spinner=jQuery('<div class="spinner" />').hide().appendTo(this.dialog);this.content=jQuery('<div class="el-dialogform-content" />').appendTo(this.dialog);this.form=jQuery("<form />").attr(this.opts.form).appendTo(this.content);if(this.opts.submit){this.form.bind("submit",function(f){a.opts.submit(f,a)})}if(this.opts.ajaxForm&&jQuery.fn.ajaxForm){this.form.ajaxForm(this.opts.ajaxForm)}if(this.opts.validate){this.form.validate(this.opts.validate)
|
5
|
+
}this.option=function(f,g){return this.dialog.dialog("option",f,g)};this.showError=function(f,g){this.hideMessage();this.hideSpinner();this.error.html(f).show();g&&this.content.hide();return this};this.hideError=function(){this.error.text("").hide();this.content.show();return this};this.showSpinner=function(f){this.error.hide();this.message.hide();this.content.hide();this.spinner.text(f||this.opts.spinner).show();this.option("buttons",{});return this};this.hideSpinner=function(){this.content.show();
|
6
|
+
this.spinner.hide();return this};this.showMessage=function(f,g){this.hideError();this.hideSpinner();this.message.html(f||"").show();g&&this.content.hide();return this};this.hideMessage=function(){this.message.hide();this.content.show();return this};this.tab=function(g,f){g=this.opts.tabPrefix+g;if(!this.ul){this.ul=jQuery("<ul />").prependTo(this.form)}jQuery("<li />").append(jQuery("<a />").attr("href","#"+g).html(f)).appendTo(this.ul);this.tabs[g]={tab:jQuery("<div />").attr("id",g).addClass("tab").appendTo(this.form),table:null};
|
7
|
+
return this};this.table=function(f){f=f&&f.indexOf(this.opts.tabPrefix)==-1?this.opts.tabPrefix+f:f;if(f&&this.tabs&&this.tabs[f]){this.tabs[f].table=jQuery("<table />").appendTo(this.tabs[f].tab)}else{this._table=jQuery("<table />").appendTo(this.form)}return this};this.append=function(j,k,g){k=k?"el-df-tab-"+k:"";if(!j){return this}if(k&&this.tabs[k]){if(g){!this.tabs[k].table&&this.table(k);var h=jQuery("<tr />").appendTo(this.tabs[k].table);if(!jQuery.isArray(j)){h.append(jQuery("<td />").append(j))
|
8
|
+
}else{for(var f=0;f<j.length;f++){h.append(jQuery("<td />").append(j[f]))}}}else{if(!jQuery.isArray(j)){this.tabs[k].tab.append(j)}else{for(var f=0;f<j.length;f++){this.tabs[k].tab.append(j[f])}}}}else{if(!g){if(!jQuery.isArray(j)){this.form.append(j)}else{for(var f=0;f<j.length;f++){this.form.append(j[f])}}}else{if(!this._table){this.table()}var h=jQuery("<tr />").appendTo(this._table);if(!jQuery.isArray(j)){h.append(jQuery("<td />").append(j))}else{for(var f=0;f<j.length;f++){h.append(jQuery("<td />").append(j[f]))
|
9
|
+
}}}}return this};this.separator=function(f){f="el-df-tab-"+f;if(this.tabs&&this.tabs[f]){this.tabs[f].tab.append(jQuery("<div />").addClass("separator"));this.tabs[f].table&&this.table(f)}else{this.form.append(jQuery("<div />").addClass("separator"))}return this};this.open=function(){var f=this;this.ul&&this.form.tabs(this.opts.tabs);setTimeout(function(){f.dialog.find(":text").keydown(function(g){if(g.keyCode==13){g.preventDefault();f.form.submit()}}).first().focus()},200);this.dialog.dialog("open");
|
10
|
+
return this};this.close=function(){if(typeof(this.opts.close)=="function"){this.opts.close()}this.dialog.dialog("destroy")}}(function(a){a.fn.elColorPicker=function(h){var b=this;var f=a.extend({},a.fn.elColorPicker.defaults,h);this.hidden=a('<input type="hidden" />').attr("name",f.name).val(f.color||"").appendTo(this);this.palette=null;this.preview=null;this.input=null;function c(j){b.val(j);f.change&&f.change(b.val());b.palette.slideUp()}function g(){b.palette=a("<div />").addClass(f.paletteClass+" rounded-3");
|
11
|
+
for(var j=0;j<f.colors.length;j++){a("<div />").addClass("color").css("background-color",f.colors[j]).attr({title:f.colors[j],unselectable:"on"}).appendTo(b.palette).mouseenter(function(){var k=a(this).attr("title");b.input.val(k);b.preview.css("background-color",k)}).click(function(k){k.stopPropagation();c(a(this).attr("title"))})}b.input=a('<input type="text" />').addClass("rounded-3").attr("size",8).click(function(k){k.stopPropagation();a(this).focus()}).keydown(function(p){if(p.ctrlKey||p.metaKey){return true
|
12
|
+
}var o=p.keyCode;if(o==27){return b.mouseleave()}if(o!=8&&o!=13&&o!=46&&o!=37&&o!=39&&(o<48||o>57)&&(o<65||o>70)){return false}var q=a(this).val();if(q.length==7||q.length==0){if(o==13){p.stopPropagation();p.preventDefault();c(q);b.palette.slideUp()}if(p.keyCode!=8&&p.keyCode!=46&&o!=37&&o!=39){return false}}}).keyup(function(k){var o=a(this).val();o.length==7&&/^#[0-9abcdef]{6}$/i.test(o)&&b.val(o)});b.preview=a("<div />").addClass("preview rounded-3").click(function(k){k.stopPropagation();c(b.input.val())
|
13
|
+
});b.palette.append(a("<div />").addClass("clearfix")).append(a("<div />").addClass("panel").append(b.input).append(b.preview));if(f.palettePosition=="outer"){b.palette.hide().appendTo(b.parents("body").eq(0)).mouseleave(function(){if(!b.palette.is(":animated")){a(this).slideUp();b.val(b.val())}});b.mouseleave(function(k){if(k.relatedTarget!=b.palette.get(0)){if(!b.palette.is(":animated")){b.palette.slideUp();b.val(b.val())}}})}else{b.append(b.palette.hide()).mouseleave(function(k){b.palette.slideUp();
|
14
|
+
b.val(b.val())})}b.val(b.val())}this.empty().addClass(f["class"]+" rounded-3").css({position:"relative","background-color":f.color||""}).click(function(p){if(!b.hasClass("disabled")){!b.palette&&g();if(f.palettePosition=="outer"&&b.palette.css("display")=="none"){var q=a(this).offset();var k=b.palette.width();var j=b.parents("body").width()-q.left>=k?q.left:q.left+a(this).outerWidth()-k;b.palette.css({left:j+"px",top:q.top+a(this).height()+1+"px"})}b.palette.slideToggle()}});this.val=function(j){if(!j&&j!==""){return this.hidden.val()
|
15
|
+
}else{this.hidden.val(j);if(f.update){f.update(this.hidden.val())}else{this.css("background-color",j)}if(b.palette){b.preview.css("background-color",j);b.input.val(j)}}return this};return this};a.fn.elColorPicker.defaults={"class":"el-colorpicker",paletteClass:"el-palette",palettePosition:"inner",name:"color",color:"",update:null,change:function(b){},colors:["#ffffff","#cccccc","#999999","#666666","#333333","#000000","#ffcccc","#cc9999","#996666","#663333","#330000","#ff9999","#cc6666","#cc3333","#993333","#660000","#ff6666","#ff3333","#ff0000","#cc0000","#990000","#ff9966","#ff6633","#ff3300","#cc3300","#993300","#ffcc99","#cc9966","#cc6633","#996633","#663300","#ff9933","#ff6600","#ff9900","#cc6600","#cc9933","#ffcc66","#ffcc33","#ffcc00","#cc9900","#996600","#ffffcc","#cccc99","#999966","#666633","#333300","#ffff99","#cccc66","#cccc33","#999933","#666600","#ffff66","#ffff33","#ffff00","#cccc00","#999900","#ccff66","#ccff33","#ccff00","#99cc00","#669900","#ccff99","#99cc66","#99cc33","#669933","#336600","#99ff33","#99ff00","#66ff00","#66cc00","#66cc33","#99ff66","#66ff33","#33ff00","#33cc00","#339900","#ccffcc","#99cc99","#669966","#336633","#003300","#99ff99","#66cc66","#33cc33","#339933","#006600","#66ff66","#33ff33","#00ff00","#00cc00","#009900","#66ff99","#33ff66","#00ff33","#00cc33","#009933","#99ffcc","#66cc99","#33cc66","#339966","#006633","#33ff99","#00ff66","#00ff99","#00cc66","#33cc99","#66ffcc","#33ffcc","#00ffcc","#00cc99","#009966","#ccffff","#99cccc","#669999","#336666","#003333","#99ffff","#66cccc","#33cccc","#339999","#006666","#66cccc","#33ffff","#00ffff","#00cccc","#009999","#66ccff","#33ccff","#00ccff","#0099cc","#006699","#99ccff","#6699cc","#3399cc","#336699","#003366","#3399ff","#0099ff","#0066ff","#066ccc","#3366cc","#6699ff","#3366ff","#0033ff","#0033cc","#003399","#ccccff","#9999cc","#666699","#333366","#000033","#9999ff","#6666cc","#3333cc","#333399","#000066","#6666ff","#3333ff","#0000ff","#0000cc","#009999","#9966ff","#6633ff","#3300ff","#3300cc","#330099","#cc99ff","#9966cc","#6633cc","#663399","#330066","#9933ff","#6600ff","#9900ff","#6600cc","#9933cc","#cc66ff","#cc33ff","#cc00ff","#9900cc","#660099","#ffccff","#cc99cc","#996699","#663366","#330033","#ff99ff","#cc66cc","#cc33cc","#993399","#660066","#ff66ff","#ff33ff","#ff00ff","#cc00cc","#990099","#ff66cc","#ff33cc","#ff00cc","#cc0099","#990066","#ff99cc","#cc6699","#cc3399","#993366","#660033","#ff3399","#ff0099","#ff0066","#cc0066","#cc3366","#ff6699","#ff3366","#ff0033","#cc0033","#990033"]}
|
16
|
+
})(jQuery);(function(a){a.fn.elBorderSelect=function(h){var k=this;var q=this.eq(0);var b=a.extend({},a.fn.elBorderSelect.defaults,h);var f=a('<input type="text" />').attr({name:b.name+"[width]",size:3}).css("text-align","right").change(function(){k.change()});var j=a("<div />").css("position","relative").elColorPicker({"class":"el-colorpicker ui-icon ui-icon-pencil",name:b.name+"[color]",palettePosition:"outer",change:function(){k.change()}});var c=a("<div />").elSelect({tpl:'<div style="border-bottom:4px %val #000;width:100%;margin:7px 0"> </div>',tpls:{"":"%label"},maxHeight:b.styleHeight||null,select:function(){k.change()
|
17
|
+
},src:{"":"none",solid:"solid",dashed:"dashed",dotted:"dotted","double":"double",groove:"groove",ridge:"ridge",inset:"inset",outset:"outset"}});q.empty().addClass(b["class"]).attr("name",b.name||"").append(a("<table />").attr("cellspacing",0).append(a("<tr />").append(a("<td />").append(f).append(" px")).append(a("<td />").append(c)).append(a("<td />").append(j))));function g(t){function r(u){hexDigits=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];return !u?"00":hexDigits[(u-u%16)/16]+hexDigits[u%16]
|
18
|
+
}var o=(t||"").match(/\(([0-9]{1,3}),\s*([0-9]{1,3}),\s*([0-9]{1,3})\)/);return o?"#"+r(o[1])+r(o[2])+r(o[3]):""}function p(r){if(!r){return r}var o=r.match(/([0-9]+\.?[0-9]*)\s*(px|pt|em|%)/);if(o){r=o[1];unit=o[2]}if(r[0]=="."){r="0"+r}r=parseFloat(r);if(isNaN(r)){return""}var t=parseInt(a(document.body).css("font-size"))||16;switch(unit){case"em":return parseInt(r*t);case"pt":return parseInt(r*t/12);case"%":return parseInt(r*t/100)}return r}this.change=function(){b.change&&b.change(this.val())
|
19
|
+
};this.val=function(u){var t,x,z,r,o;if(!u&&u!==""){t=parseInt(f.val());t=!isNaN(t)?t+"px":"";x=c.val();z=j.val();return{width:t,style:x,color:z,css:a.trim(t+" "+x+" "+z)}}else{r="";if(u.nodeName||u.css){if(!u.css){u=a(u)}r=u.css("border");if((r=u.css("border"))){t=x=z=r}else{t=u.css("border-width");x=u.css("border-style");z=u.css("border-color")}}else{t=u.width||"";x=u.style||"";z=u.color||""}f.val(p(t));o=x?x.match(/(solid|dashed|dotted|double|groove|ridge|inset|outset)/i):"";c.val(o?o[1]:"");j.val(z.indexOf("#")===0?z:g(z));
|
20
|
+
return this}};this.val(b.value);return this};a.fn.elBorderSelect.defaults={name:"el-borderselect","class":"el-borderselect",value:{},change:null}})(jQuery);(function(a){a.fn.elPaddingInput=function(g){var c=this;var f=a.extend({},a.fn.elPaddingInput.defaults,{name:this.attr("name")},g);this.regexps={main:new RegExp(f.type=="padding"?'paddings*:s*([^;"]+)':'margins*:s*([^;"]+)',"im"),left:new RegExp(f.type=="padding"?'padding-lefts*:s*([^;"]+)':'margin-lefts*:s*([^;"]+)',"im"),top:new RegExp(f.type=="padding"?'padding-tops*:s*([^;"]+)':'margin-tops*:s*([^;"]+)',"im"),right:new RegExp(f.type=="padding"?'padding-rights*:s*([^;"]+)':'margin-rights*:s*([^;"]+)',"im"),bottom:new RegExp(f.type=="padding"?'padding-bottoms*:s*([^;"]+)':'margin-bottoms*:s*([^;"]+)',"im")};
|
21
|
+
a.each(["left","top","right","bottom"],function(){c[this]=a('<input type="text" />').attr("size",3).css("text-align","right").css("border-"+this,"2px solid red").bind("change",function(){a(this).val(b(a(this).val()));h()}).attr("name",f.name+"["+this+"]")});a.each(["uleft","utop","uright","ubottom"],function(){c[this]=a("<select />").append('<option value="px">px</option>').append('<option value="em">em</option>').append('<option value="pt">pt</option>').bind("change",function(){h()}).attr("name",f.name+"["+this+"]");
|
22
|
+
if(f.percents){c[this].append('<option value="%">%</option>')}});this.empty().addClass(f["class"]).append(this.left).append(this.uleft).append(" x ").append(this.top).append(this.utop).append(" x ").append(this.right).append(this.uright).append(" x ").append(this.bottom).append(this.ubottom);this.val=function(z){if(!z&&z!==""){var q=b(this.left.val());var A=b(this.top.val());var j=b(this.right.val());var x=b(this.bottom.val());var w={left:q=="auto"||q==0?q:(q!==""?q+this.uleft.val():""),top:A=="auto"||A==0?A:(A!==""?A+this.utop.val():""),right:j=="auto"||j==0?j:(j!==""?j+this.uright.val():""),bottom:x=="auto"||x==0?x:(x!==""?x+this.ubottom.val():""),css:""};
|
23
|
+
if(w.left!==""&&w.right!==""&&w.top!==""&&w.bottom!==""){if(w.left==w.right&&w.top==w.bottom){w.css=w.top+" "+w.left}else{w.css=w.top+" "+w.right+" "+w.bottom+" "+w.left}}return w}else{if(z.nodeName||z.css){if(!z.css){z=a(z)}var o={left:"",top:"",right:"",bottom:""};var k=(z.attr("style")||"").toLowerCase();if(k){k=a.trim(k);var p=k.match(this.regexps.main);if(p){var u=a.trim(p[1]).replace(/\s+/g," ").split(" ",4);o.top=u[0];o.right=u[1]&&u[1]!==""?u[1]:o.top;o.bottom=u[2]&&u[2]!==""?u[2]:o.top;o.left=u[3]&&u[3]!==""?u[3]:o.right
|
24
|
+
}else{a.each(["left","top","right","bottom"],function(){var r=this.toString();p=k.match(c.regexps[r]);if(p){o[r]=p[1]}})}}var z=o}a.each(["left","top","right","bottom"],function(){var t=this.toString();c[t].val("");c["u"+t].val();if(typeof(z[t])!="undefined"&&z[t]!==null){z[t]=z[t].toString();var v=b(z[t]);c[t].val(v);var r=z[t].match(/(px|em|pt|%)/i);c["u"+t].val(r?r[1]:"px")}});return this}};function b(j){j=a.trim(j.toString());if(j[0]=="."){j="0"+j}n=parseFloat(j);return !isNaN(n)?n:(j=="auto"?j:"")
|
25
|
+
}function h(){f.change&&f.change(c)}this.val(f.value);return this};a.fn.elPaddingInput.defaults={name:"el-paddinginput","class":"el-paddinginput",type:"padding",value:{},percents:true,change:null}})(jQuery);(function(a){a.fn.elSelect=function(c){var q=this;var u=this.eq(0);var b=a.extend({},a.fn.elSelect.defaults,c);var g=a('<input type="hidden" />').attr("name",b.name);var p=a("<label />").attr({unselectable:"on"}).addClass("rounded-left-3");var h=null;var k=null;if(u.get(0).nodeName=="SELECT"){b.src={};
|
26
|
+
u.children("option").each(function(){b.src[a(this).val()]=a(this).text()});b.value=u.val();b.name=u.attr("name");u.replaceWith((u=a("<div />")))}if(!b.value||!b.src[b.val]){b.value=null;var f=0;for(var r in b.src){if(f++==0){b.value=r}}}this.val=function(o){if(!o&&o!==""){return g.val()}else{if(b.src[o]){g.val(o);j(o);if(h){h.children().each(function(){if(a(this).attr("name")==o){a(this).addClass("active")}else{a(this).removeClass("active")}})}}return this}};function j(o){var w=b.labelTpl||b.tpls[o]||b.tpl;
|
27
|
+
p.html(w.replace(/%val/g,o).replace(/%label/,b.src[o])).children().attr({unselectable:"on"})}u.empty().addClass(b["class"]+" rounded-3").attr({unselectable:"on"}).append(g).append(p).hover(function(){a(this).addClass("hover")},function(){a(this).removeClass("hover")}).click(function(o){!h&&t();h.slideToggle();if(a.browser.msie&&!k){h.children().each(function(){k=Math.max(k,a(this).width())});if(k>h.width()){h.width(k+40)}}});this.val(b.value);function t(){h=a("<div />").addClass(b.listClass+" rounded-3").hide().appendTo(u.mouseleave(function(v){h.slideUp()
|
28
|
+
}));for(var x in b.src){var z=b.tpls[x]||b.tpl;a("<div />").attr("name",x).append(a(z.replace(/%val/g,x).replace(/%label/g,b.src[x])).attr({unselectable:"on"})).appendTo(h).hover(function(){a(this).addClass("hover")},function(){a(this).removeClass("hover")}).click(function(B){B.stopPropagation();B.preventDefault();var w=a(this).attr("name");q.val(w);b.select(w);h.slideUp()})}var o=u.outerWidth();if(h.width()<o){h.width(o)}var A=h.height();if(b.maxHeight>0&&A>b.maxHeight){h.height(b.maxHeight)}q.val(g.val())
|
29
|
+
}return this};a.fn.elSelect.defaults={name:"el-select","class":"el-select",listClass:"list",labelTpl:null,tpl:"<%val>%label</%val>",tpls:{},value:null,src:{},select:function(b){window.console&&window.console.log&&window.console.log("selected: "+b)},maxHeight:410}})(jQuery);(function(a){elRTE=function(o,j){if(!o||!o.nodeName){return alert('elRTE: argument "target" is not DOM Element')}var c=this,f;this.version="1.3";this.build="2011-06-23";this.options=a.extend(true,{},this.options,j);this.browser=a.browser;
|
30
|
+
this.target=a(o);this.lang=(""+this.options.lang);this._i18n=new eli18n({textdomain:"rte",messages:{rte:this.i18Messages[this.lang]||{}}});this.rtl=!!(/^(ar|fa|he)$/.test(this.lang)&&this.i18Messages[this.lang]);if(this.rtl){this.options.cssClass+=" el-rte-rtl"}this.toolbar=a('<div class="toolbar"/>');this.iframe=document.createElement("iframe");this.iframe.setAttribute("frameborder",0);this.workzone=a('<div class="workzone"/>').append(this.iframe).append(this.source);this.statusbar=a('<div class="statusbar"/>');
|
31
|
+
this.tabsbar=a('<div class="tabsbar"/>');this.editor=a('<div class="'+this.options.cssClass+'" />').append(this.toolbar).append(this.workzone).append(this.statusbar).append(this.tabsbar);this.doc=null;this.$doc=null;this.window=null;this.utils=new this.utils(this);this.dom=new this.dom(this);this.filter=new this.filter(this);this.updateHeight=function(){c.workzone.add(c.iframe).add(c.source).height(c.workzone.height())};this.resizable=function(q){var p=this;if(this.options.resizable&&a.fn.resizable){if(q){this.editor.resizable({handles:"se",alsoResize:this.workzone,minWidth:300,minHeight:200}).bind("resize",p.updateHeight)
|
32
|
+
}else{this.editor.resizable("destroy").unbind("resize",p.updateHeight)}}};this.editor.insertAfter(o);var h="";if(o.nodeName=="TEXTAREA"){this.source=this.target;this.source.insertAfter(this.iframe).hide();h=this.target.val()}else{this.source=a("<textarea />").insertAfter(this.iframe).hide();h=this.target.hide().html()}this.source.attr("name",this.target.attr("name")||this.target.attr("id"));h=a.trim(h);if(!h){h=" "}if(this.options.allowSource){this.tabsbar.append('<div class="tab editor rounded-bottom-7 active">'+c.i18n("Editor")+'</div><div class="tab source rounded-bottom-7">'+c.i18n("Source")+'</div><div class="clearfix" style="clear:both"/>').children(".tab").click(function(p){if(!a(this).hasClass("active")){c.tabsbar.children(".tab").toggleClass("active");
|
33
|
+
c.workzone.children().toggle();if(a(this).hasClass("editor")){c.updateEditor();c.window.focus();c.ui.update(true)}else{c.updateSource();c.source.focus();if(a.browser.msie){}else{c.source[0].setSelectionRange(0,0)}c.ui.disable();c.statusbar.empty()}}})}this.window=this.iframe.contentWindow;this.doc=this.iframe.contentWindow.document;this.$doc=a(this.doc);f='<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';a.each(c.options.cssfiles,function(){f+='<link rel="stylesheet" type="text/css" href="'+this+'" />'
|
34
|
+
});this.doc.open();var g=this.filter.wysiwyg(h),b=this.rtl?' class="el-rte-rtl"':"";this.doc.write(c.options.doctype+f+"</head><body"+b+">"+(g)+"</body></html>");this.doc.close();if(a.browser.msie){this.doc.body.contentEditable=true}else{try{this.doc.designMode="on"}catch(k){}this.doc.execCommand("styleWithCSS",false,this.options.styleWithCSS)}if(this.options.height>0){this.workzone.height(this.options.height)}if(this.options.width>0){this.editor.width(this.options.width)}this.updateHeight();this.resizable(true);
|
35
|
+
this.window.focus();this.history=new this.history(this);this.selection=new this.selection(this);this.ui=new this.ui(this);this.target.parents("form").bind("submit.elfinder",function(p){c.source.parents("form").find('[name="el-select"]').remove();c.beforeSave()});this.source.bind("keydown",function(t){if(t.keyCode==9){t.preventDefault();if(a.browser.msie){var p=document.selection.createRange();p.text="\t"+p.text;this.focus()}else{var q=this.value.substr(0,this.selectionStart),u=this.value.substr(this.selectionEnd);
|
36
|
+
this.value=q+"\t"+u;this.setSelectionRange(q.length+1,q.length+1)}}});a(this.doc.body).bind("dragend",function(p){setTimeout(function(){try{c.window.focus();var r=c.selection.getBookmark();c.selection.moveToBookmark(r);c.ui.update()}catch(q){}},200)});this.typing=false;this.lastKey=null;this.$doc.bind("mouseup",function(){c.typing=false;c.lastKey=null;c.ui.update()}).bind("keyup",function(p){if((p.keyCode>=8&&p.keyCode<=13)||(p.keyCode>=32&&p.keyCode<=40)||p.keyCode==46||(p.keyCode>=96&&p.keyCode<=111)){c.ui.update()
|
37
|
+
}}).bind("keydown",function(p){if((p.metaKey||p.ctrlKey)&&p.keyCode==65){c.ui.update()}else{if(p.keyCode==13){var q=c.selection.getNode();if(c.dom.selfOrParent(q,/^PRE$/)){c.selection.insertNode(c.doc.createTextNode("\r\n"));return false}else{if(a.browser.safari&&p.shiftKey){c.selection.insertNode(c.doc.createElement("br"));return false}}}}if((p.keyCode>=48&&p.keyCode<=57)||p.keyCode==61||p.keyCode==109||(p.keyCode>=65&&p.keyCode<=90)||p.keyCode==188||p.keyCode==190||p.keyCode==191||(p.keyCode>=219&&p.keyCode<=222)){if(!c.typing){c.history.add(true)
|
38
|
+
}c.typing=true;c.lastKey=null}else{if(p.keyCode==8||p.keyCode==46||p.keyCode==32||p.keyCode==13){if(p.keyCode!=c.lastKey){c.history.add(true)}c.lastKey=p.keyCode;c.typing=false}}if(p.keyCode==32&&a.browser.opera){c.selection.insertNode(c.doc.createTextNode(" "));return false}}).bind("paste",function(q){if(!c.options.allowPaste){q.stopPropagation();q.preventDefault()}else{var t=a(c.dom.create("div"))[0],p=c.doc.createTextNode("_");c.history.add(true);c.typing=true;c.lastKey=null;t.appendChild(p);c.selection.deleteContents().insertNode(t);
|
39
|
+
c.selection.select(p);setTimeout(function(){if(t.parentNode){a(t).html(c.filter.proccess("paste",a(t).html()));p=t.lastChild;c.dom.unwrap(t);if(p){c.selection.select(p);c.selection.collapse(false)}}else{t.parentNode&&t.parentNode.removeChild(t);c.val(c.filter.proccess("paste",c.filter.wysiwyg2wysiwyg(a(c.doc.body).html())));c.selection.select(c.doc.body.firstChild);c.selection.collapse(true)}a(c.doc.body).mouseup()},15)}});if(a.browser.msie){this.$doc.bind("keyup",function(p){if(p.keyCode==86&&(p.metaKey||p.ctrlKey)){c.history.add(true);
|
40
|
+
c.typing=true;c.lastKey=null;c.selection.saveIERange();c.val(c.filter.proccess("paste",c.filter.wysiwyg2wysiwyg(a(c.doc.body).html())));c.selection.restoreIERange();a(c.doc.body).mouseup();this.ui.update()}})}if(a.browser.safari){this.$doc.bind("click",function(p){a(c.doc.body).find(".elrte-webkit-hl").removeClass("elrte-webkit-hl");if(p.target.nodeName=="IMG"){a(p.target).addClass("elrte-webkit-hl")}}).bind("keyup",function(p){a(c.doc.body).find(".elrte-webkit-hl").removeClass("elrte-webkit-hl")
|
41
|
+
})}this.window.focus();this.destroy=function(){this.updateSource();this.target.is("textarea")?this.target.val(a.trim(this.source.val())):this.target.html(a.trim(this.source.val()));this.editor.remove();this.target.show().parents("form").unbind("submit.elfinder")}};elRTE.prototype.i18n=function(b){return this._i18n.translate(b)};elRTE.prototype.open=function(){this.editor.show()};elRTE.prototype.close=function(){this.editor.hide()};elRTE.prototype.updateEditor=function(){this.val(this.source.val())
|
42
|
+
};elRTE.prototype.updateSource=function(){this.source.val(this.filter.source(a(this.doc.body).html()))};elRTE.prototype.val=function(b){if(typeof(b)=="string"){b=""+b;if(this.source.is(":visible")){this.source.val(this.filter.source2source(b))}else{if(a.browser.msie){this.doc.body.innerHTML="<br />"+this.filter.wysiwyg(b);this.doc.body.removeChild(this.doc.body.firstChild)}else{this.doc.body.innerHTML=this.filter.wysiwyg(b)}}}else{if(this.source.is(":visible")){return this.filter.source2source(this.source.val()).trim()
|
43
|
+
}else{return this.filter.source(a(this.doc.body).html()).trim()}}};elRTE.prototype.beforeSave=function(){this.source.val(a.trim(this.val())||"")};elRTE.prototype.save=function(){this.beforeSave();this.editor.parents("form").submit()};elRTE.prototype.log=function(b){if(window.console&&window.console.log){window.console.log(b)}};elRTE.prototype.i18Messages={};a.fn.elrte=function(g,b){var f=typeof(g)=="string"?g:"",c;this.each(function(){if(!this.elrte){this.elrte=new elRTE(this,typeof(g)=="object"?g:{})
|
44
|
+
}switch(f){case"open":case"show":this.elrte.open();break;case"close":case"hide":this.elrte.close();break;case"updateSource":this.elrte.updateSource();break;case"destroy":this.elrte.destroy()}});if(f=="val"){if(!this.length){return""}else{if(this.length==1){return b?this[0].elrte.val(b):this[0].elrte.val()}else{c={};this.each(function(){c[this.elrte.source.attr("name")]=this.elrte.val()});return c}}}return this}})(jQuery);(function(a){elRTE.prototype.dom=function(c){this.rte=c;var b=this;this.regExp={textNodes:/^(A|ABBR|ACRONYM|ADDRESS|B|BDO|BIG|BLOCKQUOTE|CAPTION|CENTER|CITE|CODE|DD|DEL|DFN|DIV|DT|EM|FIELDSET|FONT|H[1-6]|I|INS|KBD|LABEL|LEGEND|LI|MARQUEE|NOBR|NOEMBED|P|PRE|Q|SAMP|SMALL|SPAN|STRIKE|STRONG|SUB|SUP|TD|TH|TT|VAR)$/,textContainsNodes:/^(A|ABBR|ACRONYM|ADDRESS|B|BDO|BIG|BLOCKQUOTE|CAPTION|CENTER|CITE|CODE|DD|DEL|DFN|DIV|DL|DT|EM|FIELDSET|FONT|H[1-6]|I|INS|KBD|LABEL|LEGEND|LI|MARQUEE|NOBR|NOEMBED|OL|P|PRE|Q|SAMP|SMALL|SPAN|STRIKE|STRONG|SUB|SUP|TABLE|THEAD|TBODY|TFOOT|TD|TH|TR|TT|UL|VAR)$/,block:/^(APPLET|BLOCKQUOTE|BR|CAPTION|CENTER|COL|COLGROUP|DD|DIV|DL|DT|H[1-6]|EMBED|FIELDSET|LI|MARQUEE|NOBR|OBJECT|OL|P|PRE|TABLE|THEAD|TBODY|TFOOT|TD|TH|TR|UL)$/,selectionBlock:/^(APPLET|BLOCKQUOTE|BR|CAPTION|CENTER|COL|COLGROUP|DD|DIV|DL|DT|H[1-6]|EMBED|FIELDSET|LI|MARQUEE|NOBR|OBJECT|OL|P|PRE|TD|TH|TR|UL)$/,header:/^H[1-6]$/,formElement:/^(FORM|INPUT|HIDDEN|TEXTAREA|SELECT|BUTTON)$/};
|
45
|
+
this.root=function(){return this.rte.body};this.create=function(f){return this.rte.doc.createElement(f)};this.createBookmark=function(){var f=this.rte.doc.createElement("span");f.id="elrte-bm-"+Math.random().toString().substr(2);a(f).addClass("elrtebm elrte-protected");return f};this.indexOf=function(g){var f=0;g=a(g);while((g=g.prev())&&g.length){f++}return f};this.attr=function(h,f){var g="";if(h.nodeType==1){g=a(h).attr(f);if(g&&f!="src"&&f!="href"&&f!="title"&&f!="alt"){g=g.toString().toLowerCase()
|
46
|
+
}}return g||""};this.findCommonAncestor=function(j,h){if(!j||!h){return this.rte.log("dom.findCommonAncestor invalid arguments")}if(j==h){return j}else{if(j.nodeName=="BODY"||h.nodeName=="BODY"){return this.rte.doc.body}}var o=a(j).parents(),k=a(h).parents(),f=k.length-1,p=k[f];for(var g=o.length-1;g>=0;g--,f--){if(o[g]==k[f]){p=o[g]}else{break}}return p};this.isEmpty=function(f){if(f.nodeType==1){return this.regExp.textNodes.test(f.nodeName)?a.trim(a(f).text()).length==0:false}else{if(f.nodeType==3){return/^(TABLE|THEAD|TFOOT|TBODY|TR|UL|OL|DL)$/.test(f.parentNode.nodeName)||f.nodeValue==""||(a.trim(f.nodeValue).length==0&&!(f.nextSibling&&f.previousSibling&&f.nextSibling.nodeType==1&&f.previousSibling.nodeType==1&&!this.regExp.block.test(f.nextSibling.nodeName)&&!this.regExp.block.test(f.previousSibling.nodeName)))
|
47
|
+
}}return true};this.next=function(f){while(f.nextSibling&&(f=f.nextSibling)){if(f.nodeType==1||(f.nodeType==3&&!this.isEmpty(f))){return f}}return null};this.prev=function(f){while(f.previousSibling&&(f=f.previousSibling)){if(f.nodeType==1||(f.nodeType==3&&!this.isEmpty(f))){return f}}return null};this.isPrev=function(g,f){while((g=this.prev(g))){if(g==f){return true}}return false};this.nextAll=function(g){var f=[];while((g=this.next(g))){f.push(g)}return f};this.prevAll=function(g){var f=[];while((g=this.prev(g))){f.push(g)
|
48
|
+
}return f};this.toLineEnd=function(g){var f=[];while((g=this.next(g))&&g.nodeName!="BR"&&g.nodeName!="HR"&&this.isInline(g)){f.push(g)}return f};this.toLineStart=function(g){var f=[];while((g=this.prev(g))&&g.nodeName!="BR"&&g.nodeName!="HR"&&this.isInline(g)){f.unshift(g)}return f};this.isFirstNotEmpty=function(f){while((f=this.prev(f))){if(f.nodeType==1||(f.nodeType==3&&a.trim(f.nodeValue)!="")){return false}}return true};this.isLastNotEmpty=function(f){while((f=this.next(f))){if(!this.isEmpty(f)){return false
|
49
|
+
}}return true};this.isOnlyNotEmpty=function(f){return this.isFirstNotEmpty(f)&&this.isLastNotEmpty(f)};this.findLastNotEmpty=function(f){this.rte.log("findLastNotEmpty Who is here 0_o");if(f.nodeType==1&&(l=f.lastChild)){if(!this.isEmpty(l)){return l}while(l.previousSibling&&(l=l.previousSibling)){if(!this.isEmpty(l)){return l}}}return false};this.isInline=function(j){if(j.nodeType==3){return true}else{if(j.nodeType==1){j=a(j);var h=j.css("display");var g=j.css("float");return h=="inline"||h=="inline-block"||g=="left"||g=="right"
|
50
|
+
}}return true};this.is=function(h,g){if(h&&h.nodeName){if(typeof(g)=="string"){g=this.regExp[g]||/.?/}if(g instanceof RegExp&&h.nodeName){return g.test(h.nodeName)}else{if(typeof(g)=="function"){return g(h)}}}return false};this.filter=function(j,h){var f=[],g;if(!j.push){return this.is(j,h)?j:null}for(g=0;g<j.length;g++){if(this.is(j[g],h)){f.push(j[g])}}return f};this.parents=function(h,g){var f=[];while(h&&(h=h.parentNode)&&h.nodeName!="BODY"&&h.nodeName!="HTML"){if(this.is(h,g)){f.push(h)}}return f
|
51
|
+
};this.parent=function(h,g){return this.parents(h,g)[0]||null};this.selfOrParent=function(h,g,f){return this.is(h,g)?h:this.parent(h,f||g)};this.selfOrParentLink=function(f){f=this.selfOrParent(f,/^A$/);return f&&f.href?f:null};this.selfOrParentAnchor=function(f){f=this.selfOrParent(f,/^A$/);return f&&!f.href&&f.name?f:null};this.childLinks=function(g){var f=[];a("a[href]",g).each(function(){f.push(this)});return f};this.selectionHas=function(h){var j=this.rte.selection.cloneContents(),g;if(j&&j.childNodes&&j.childNodes.length){for(g=0;
|
52
|
+
g<j.childNodes.length;g++){if(typeof(h)=="function"){if(h(j.childNodes[g])){return true}}else{if(j instanceof RegExp){if(h.test(j.childNodes[g].nodeName)){return true}}}}}return false};this.wrap=function(g,f){g=a.isArray(g)?g:[g];f=f.nodeName?f:this.create(f);if(g[0]&&g[0].nodeType&&g[0].parentNode){f=g[0].parentNode.insertBefore(f,g[0]);a(g).each(function(){if(this!=f){f.appendChild(this)}})}return f};this.unwrap=function(f){if(f&&f.parentNode){while(f.firstChild){f.parentNode.insertBefore(f.firstChild,f)
|
53
|
+
}f.parentNode.removeChild(f)}};this.wrapContents=function(h,f){f=f.nodeName?f:this.create(f);for(var g=0;g<h.childNodes.length;g++){f.appendChild(h.childNodes[g])}h.appendChild(f);return f};this.cleanNode=function(f){if(f.nodeType!=1){return}if(/^(P|LI)$/.test(f.nodeName)&&(l=this.findLastNotEmpty(f))&&l.nodeName=="BR"){a(l).remove()}$n=a(f);$n.children().each(function(){this.cleanNode(this)});if(f.nodeName!="BODY"&&!/^(TABLE|TR|TD)$/.test(f)&&this.isEmpty(f)){return $n.remove()}if($n.attr("style")===""){$n.removeAttr("style")
|
54
|
+
}if(this.rte.browser.safari&&$n.hasClass("Apple-span")){$n.removeClass("Apple-span")}if(f.nodeName=="SPAN"&&!$n.attr("style")&&!$n.attr("class")&&!$n.attr("id")){$n.replaceWith($n.html())}};this.cleanChildNodes=function(g){var f=this.cleanNode;a(g).children().each(function(){f(this)})};this.tableMatrix=function(j){var h=[];if(j&&j.nodeName=="TABLE"){var g=0;function f(o){for(var k=0;k<=g;k++){if(!h[o][k]){return k}}}a(j).find("tr").each(function(k){if(!a.isArray(h[k])){h[k]=[]}a(this).children("td,th").each(function(){var p=parseInt(a(this).attr("colspan")||1);
|
55
|
+
var t=parseInt(a(this).attr("rowspan")||1);var r=f(k);for(var v=0;v<t;v++){for(var o=0;o<p;o++){var q=k+v;if(!a.isArray(h[q])){h[q]=[]}var u=o==0&&v==0?this:(v==0?o:"-");h[q][r+o]=u}}g=Math.max(g,h[k].length)})})}return h};this.indexesOfCell=function(j,h){for(var f=0;f<h.length;f++){for(var g=0;g<h[f].length;g++){if(h[f][g]==j){return[f,g]}}}};this.fixTable=function(q){if(q&&q.nodeName=="TABLE"){var h=a(q);var p=this.tableMatrix(q);var f=0;a.each(p,function(){f=Math.max(f,this.length)});if(f==0){return h.remove()
|
56
|
+
}for(var k=0;k<p.length;k++){var g=p[k].length;if(g==0){h.find("tr").eq(k).remove()}else{if(g<f){var j=f-g;var o=h.find("tr").eq(k);for(i=0;i<j;i++){o.append("<td> </td>")}}}}}};this.tableColumn=function(h,g,o){h=this.selfOrParent(h,/^TD|TH$/);var j=this.selfOrParent(h,/^TABLE$/);ret=[];info={offset:[],delta:[]};if(h&&j){o&&this.fixTable(j);var u=this.tableMatrix(j);var v=false;var t;for(var f=0;f<u.length;f++){for(var q=0;q<u[f].length;q++){if(u[f][q]==h){t=q;v=true;break}}if(v){break}}if(t>=0){for(var f=0;
|
57
|
+
f<u.length;f++){var k=u[f][t]||null;if(k){if(k.nodeName){ret.push(k);if(g){info.delta.push(0);info.offset.push(t)}}else{var p=parseInt(k);if(!isNaN(p)&&u[f][t-p]&&u[f][t-p].nodeName){ret.push(u[f][t-p]);if(g){info.delta.push(p);info.offset.push(t)}}}}}}}return !g?ret:{column:ret,info:info}}}})(jQuery);(function(a){elRTE.prototype.filter=function(c){var b=this,f=a("<span/>").addClass("elrtetesturl").appendTo(document.body)[0];this.url=(typeof(f.currentStyle)!="undefined"?f.currentStyle.backgroundImage:document.defaultView.getComputedStyle(f,null)["backgroundImage"]).replace(/^url\((['"]?)([\s\S]+\/)[\s\S]+\1\)$/i,"$2");
|
58
|
+
a(f).remove();this.rte=c;this.xhtml=/xhtml/i.test(c.options.doctype);this.boolAttrs=c.utils.makeObject("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected".split(","));this.tagRegExp=/<(\/?)([\w:]+)((?:\s+[a-z\-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*\/?>/g;this.openTagRegExp=/<([\w:]+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*\/?>/g;this.attrRegExp=/(\w+)(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^\s]+))?/g;this.scriptRegExp=/<script([^>]*)>([\s\S]*?)<\/script>/gi;
|
59
|
+
this.styleRegExp=/(<style([^>]*)>[\s\S]*?<\/style>)/gi;this.linkRegExp=/(<link([^>]+)>)/gi;this.cdataRegExp=/<!\[CDATA\[([\s\S]+)\]\]>/g;this.objRegExp=/<object([^>]*)>([\s\S]*?)<\/object>/gi;this.embRegExp=/<(embed)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*>/gi;this.paramRegExp=/<(param)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*>/gi;this.iframeRegExp=/<iframe([^>]*)>([\s\S]*?)<\/iframe>/gi;this.yMapsRegExp=/<div\s+([^>]*id\s*=\s*('|")?YMapsID[^>]*)>/gi;this.gMapsRegExp=/<iframe\s+([^>]*src\s*=\s*"http:\/\/maps\.google\.\w+[^>]*)>([\s\S]*?)<\/iframe>/gi;
|
60
|
+
this.videoHostRegExp=/^(http:\/\/[\w\.]*)?(youtube|vimeo|rutube).*/i;this.serviceClassRegExp=/<(\w+)([^>]*class\s*=\s*"[^>]*elrte-[^>]*)>\s*(<\/\1>)?/gi;this.pagebreakRegExp=/<(\w+)([^>]*style\s*=\s*"[^>]*page-break[^>]*)>\s*(<\/\1>)?/gi;this.pbRegExp=new RegExp("<!-- pagebreak -->","gi");this.allowTags=c.options.allowTags.length?c.utils.makeObject(c.options.allowTags):null;this.denyTags=c.options.denyTags.length?c.utils.makeObject(c.options.denyTags):null;this.denyAttr=c.options.denyAttr?c.utils.makeObject(c.options.denyAttr):null;
|
61
|
+
this.pasteDenyAttr=c.options.pasteDenyAttr?c.utils.makeObject(c.options.pasteDenyAttr):null;this.fontSize=["medium","xx-small","small","medium","large","x-large","xx-large"];this.fontFamily={"sans-serif":/^(arial|tahoma|verdana)$/i,serif:/^(times|times new roman)$/i,monospace:/^courier$/i};this.scripts={};this._chains={};a.each(this.chains,function(g){b._chains[g]=[];a.each(this,function(h,j){typeof(b.rules[j])=="function"&&b._chains[g].push(b.rules[j])})});this.proccess=function(h,g){g=a.trim(g).replace(/^\s*( )+/gi,"").replace(/( |<br[^>]*>)+\s*$/gi,"");
|
62
|
+
a.each(this._chains[h]||[],function(){g=this.call(b,g)});g=g.replace(/\t/g," ").replace(/\r/g,"").replace(/\s*\n\s*\n+/g,"\n")+" ";return a.trim(g)?g:" "};this.wysiwyg=function(g){return this.proccess("wysiwyg",g)};this.source=function(g){return this.proccess("source",g)};this.source2source=function(g){return this.proccess("source2source",g)};this.wysiwyg2wysiwyg=function(g){return this.proccess("wysiwyg2wysiwyg",g)};this.parseAttrs=function(p){var j={},h=this.boolAttrs,g=p.match(this.attrRegExp),o,q,k;
|
63
|
+
g&&a.each(g,function(r,t){o=t.split("=");q=a.trim(o[0]).toLowerCase();if(o.length>2){o.shift();k=o.join("=")}else{k=h[q]||o[1]||""}j[q]=a.trim(k).replace(/^('|")(.*)(\1)$/,"$2")});j.style=this.rte.utils.parseStyle(j.style);j["class"]=this.rte.utils.parseClass(j["class"]||"");return j};this.serializeAttrs=function(g,k){var j=[],h=this;a.each(g,function(p,o){if(p=="style"){o=h.rte.utils.serializeStyle(o,k)}else{if(p=="class"){o=h.rte.utils.serializeClass(o)}}o&&j.push(p+'="'+o+'"')});return j.join(" ")
|
64
|
+
};this.cleanAttrs=function(g,j){var h=this,o=this.replaceAttrs;a.each(g["class"],function(p){/^(Apple-style-span|mso\w+)$/i.test(p)&&delete g["class"][p]});function k(p){return p+(/\d$/.test(p)?"px":"")}a.each(g,function(q,p){o[q]&&o[q].call(h,g,j);if(q=="style"){a.each(p,function(t,r){switch(t){case"mso-padding-alt":case"mso-padding-top-alt":case"mso-padding-right-alt":case"mso-padding-bottom-alt":case"mso-padding-left-alt":case"mso-margin-alt":case"mso-margin-top-alt":case"mso-margin-right-alt":case"mso-margin-bottom-alt":case"mso-margin-left-alt":case"mso-table-layout-alt":case"mso-height":case"mso-width":case"mso-vertical-align-alt":g.style[t.replace(/^mso-|-alt$/g,"")]=k(r);
|
65
|
+
delete g.style[t];break;case"horiz-align":g.style["text-align"]=r;delete g.style[t];break;case"vert-align":g.style["vertical-align"]=r;delete g.style[t];break;case"font-color":case"mso-foreground":g.style.color=r;delete g.style[t];break;case"mso-background":case"mso-highlight":g.style.background=r;delete g.style[t];break;case"mso-default-height":g.style["min-height"]=k(r);delete g.style[t];break;case"mso-default-width":g.style["min-width"]=k(r);delete g.style[t];break;case"mso-padding-between-alt":g.style["border-collapse"]="separate";
|
66
|
+
g.style["border-spacing"]=k(r);delete g.style[t];break;case"text-line-through":if(r.match(/(single|double)/i)){g.style["text-decoration"]="line-through"}delete g.style[t];break;case"mso-zero-height":if(r=="yes"){g.style.display="none"}delete g.style[t];break;case"font-weight":if(r==700){g.style["font-weight"]="bold"}break;default:if(t.match(/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/)){delete g.style[t]
|
67
|
+
}}})}});return g}};elRTE.prototype.filter.prototype.replaceTags={b:{tag:"strong"},big:{tag:"span",style:{"font-size":"large"}},center:{tag:"div",style:{"text-align":"center"}},i:{tag:"em"},font:{tag:"span"},nobr:{tag:"span",style:{"white-space":"nowrap"}},menu:{tag:"ul"},plaintext:{tag:"pre"},s:{tag:"strike"},small:{tag:"span",style:{"font-size":"small"}},u:{tag:"span",style:{"text-decoration":"underline"}},xmp:{tag:"pre"}};elRTE.prototype.filter.prototype.replaceAttrs={align:function(b,c){switch(c){case"img":b.style[b.align.match(/(left|right)/)?"float":"vertical-align"]=b.align;
|
68
|
+
break;case"table":if(b.align=="center"){b.style["margin-left"]=b.style["margin-right"]="auto"}else{b.style["float"]=b.align}break;default:b.style["text-align"]=b.align}delete b.align},border:function(b){!b.style["border-width"]&&(b.style["border-width"]=(parseInt(b.border)||1)+"px");!b.style["border-style"]&&(b.style["border-style"]="solid");delete b.border},bordercolor:function(b){!b.style["border-color"]&&(b.style["border-color"]=b.bordercolor);delete b.bordercolor},background:function(b){!b.style["background-image"]&&(b.style["background-image"]="url("+b.background+")");
|
69
|
+
delete b.background},bgcolor:function(b){!b.style["background-color"]&&(b.style["background-color"]=b.bgcolor);delete b.bgcolor},clear:function(b){b.style.clear=b.clear=="all"?"both":b.clear;delete b.clear},color:function(b){!b.style.color&&(b.style.color=b.color);delete b.color},face:function(b){var c=b.face.toLowerCase();a.each(this.fontFamily,function(g,f){if(c.match(f)){b.style["font-family"]=c+","+g}});delete b.face},hspace:function(b,f){if(f=="img"){var c=parseInt(b.hspace)||0;!b.style["margin-left"]&&(b.style["margin-left"]=c+"px");
|
70
|
+
!b.style["margin-right"]&&(b.style["margin-right"]=c+"px");delete b.hspace}},size:function(b,c){if(c!="input"){b.style["font-size"]=this.fontSize[parseInt(b.size)||0]||"medium";delete b.size}},valign:function(b){if(!b.style["vertical-align"]){b.style["vertical-align"]=b.valign}delete b.valign},vspace:function(b,f){if(f=="img"){var c=parseInt(b.vspace)||0;!b.style["margin-top"]&&(b.style["margin-top"]=c+"px");!b.style["margin-bottom"]&&(b.style["margin-bottom"]=c+"px");delete b.hspace}}};elRTE.prototype.filter.prototype.rules={allowedTags:function(c){var b=this.allowTags;
|
71
|
+
return b?c.replace(this.tagRegExp,function(f,h,g){return b[g.toLowerCase()]?f:""}):c},deniedTags:function(b){var c=this.denyTags;return c?b.replace(this.tagRegExp,function(f,h,g){return c[g.toLowerCase()]?"":f}):b},clean:function(g){var c=this,b=this.replaceTags,h=this.replaceAttrs,f=this.denyAttr,j;g=g.replace(/<!DOCTYPE([\s\S]*)>/gi,"").replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"<p><strong>$1</strong></p>").replace(/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s ]*)<\/span>/gi,"$1").replace(/(<p[^>]*>\s*<\/p>|<p[^>]*\/>)/gi,"<br>").replace(/(<\/p>)(?:\s*<br\s*\/?>\s*|\s* \s*)+\s*(<p[^>]*>)/gi,function(o,k,p){return k+"\n"+p
|
72
|
+
}).replace(this.tagRegExp,function(o,q,p,k){p=p.toLowerCase();if(q){return"</"+(b[p]?b[p].tag:p)+">"}k=c.cleanAttrs(c.parseAttrs(k||""),p);if(b[p]){b[p].style&&a.extend(k.style,b[p].style);p=b[p].tag}f&&a.each(k,function(r){if(f[r]){delete k[r]}});k=c.serializeAttrs(k);return"<"+p+(k?" ":"")+k+">"});j=a("<div>"+g+"</div>");j.find("span:not([id]):not([class])").each(function(){var k=a(this);if(!k.attr("style")){a.trim(k.html()).length?c.rte.dom.unwrap(this):k.remove()}}).end().find("span span:only-child").each(function(){var o=a(this),u=o.parent().eq(0),r=o.attr("id"),k=u.attr("id"),w,q,v;
|
73
|
+
if(c.rte.dom.isOnlyNotEmpty(this)&&(!r||!k)){v=a.trim(u.attr("class")+" "+o.attr("class"));v&&u.attr("class",v);q=c.rte.utils.serializeStyle(a.extend(c.rte.utils.parseStyle(a(this).attr("style")||""),c.rte.utils.parseStyle(a(u).attr("style")||"")));q&&u.attr("style",q);w=r||k;w&&u.attr("id",w);this.firstChild?a(this.firstChild).unwrap():o.remove()}}).end().find("a[name]").each(function(){a(this).addClass("elrte-protected elrte-anchor")});return j.html()},cleanPaste:function(c){var b=this,f=this.pasteDenyAttr;
|
74
|
+
c=c.replace(this.scriptRegExp,"").replace(this.styleRegExp,"").replace(this.linkRegExp,"").replace(this.cdataRegExp,"").replace(/\<\!--[\s\S]*?--\>/g,"");if(this.rte.options.pasteOnlyText){c=c.replace(this.tagRegExp,function(g,j,h){return/br/i.test(h)||(j&&/h[1-6]|p|ol|ul|li|div|blockquote|tr/i)?"<br>":""}).replace(/( |<br[^>]*>)+\s*$/gi,"")}else{if(f){c=c.replace(this.openTagRegExp,function(h,j,g){g=b.parseAttrs(g);a.each(g,function(k){if(f[k]){delete g[k]}});g=b.serializeAttrs(g,true);return"<"+j+(g?" ":"")+g+">"
|
75
|
+
})}}return c},replace:function(o){var q=this,b=this.rte.options.replace||[],g;if(b.length){a.each(b,function(r,t){if(typeof(t)=="function"){o=t.call(q,o)}})}function k(x,D){var E=r(),B=E&&q.videoHostRegExp.test(E)?E.replace(q.videoHostRegExp,"$2"):D.replace(/^\w+\/(.+)/,"$1"),C=parseInt((x.obj?x.obj.width||x.obj.style.width:0)||(x.embed?x.embed.width||x.embed.style.width:0))||150,A=parseInt((x.obj?x.obj.height||x.obj.style.height:0)||(x.embed?x.embed.height||x.embed.style.height:0))||100,v="media"+Math.random().toString().substring(2),u="",z;
|
76
|
+
function r(){if(x.embed&&x.embed.src){return x.embed.src}if(x.params&&x.params.length){z=x.params.length;while(z--){if(x.params[z].name=="src"||x.params[z].name=="movie"){return x.params[z].value}}}}if(x.obj&&x.obj.style&&x.obj.style["float"]){u=' style="float:'+x.obj.style["float"]+'"'}q.scripts[v]=x;return'<img src="'+q.url+'pixel.gif" class="elrte-media elrte-media-'+B+' elrte-protected" title="'+(E?q.rte.utils.encode(E):"")+'" rel="'+v+'" width="'+C+'" height="'+A+'"'+u+">"}o=o.replace(this.styleRegExp,"<!-- ELRTE_COMMENT$1 -->").replace(this.linkRegExp,"<!-- ELRTE_COMMENT$1-->").replace(this.cdataRegExp,"<!--[CDATA[$1]]-->").replace(this.scriptRegExp,function(u,r,v){var w;
|
77
|
+
if(q.denyTags.script){return""}w="script"+Math.random().toString().substring(2);r=q.parseAttrs(r);!r.type&&(r.type="text/javascript");q.scripts[w]="<script "+q.serializeAttrs(r)+">"+v+"<\/script>";return"<!-- ELRTE_SCRIPT:"+(w)+" -->"}).replace(this.yMapsRegExp,function(u,r){r=q.parseAttrs(r);r["class"]["elrte-yandex-maps"]="elrte-yandex-maps";r["class"]["elrte-protected"]="elrte-protected";return"<div "+q.serializeAttrs(r)+">"}).replace(this.gMapsRegExp,function(v,u){var z="gmaps"+Math.random().toString().substring(2),r,x;
|
78
|
+
u=q.parseAttrs(u);r=parseInt(u.width||u.style.width||100);x=parseInt(u.height||u.style.height||100);q.scripts[z]=v;return'<img src="'+q.url+'pixel.gif" class="elrte-google-maps elrte-protected" id="'+z+'" style="width:'+r+"px;height:"+x+'px">'}).replace(this.objRegExp,function(w,u,z){var r=z.match(q.embRegExp),x={obj:q.parseAttrs(u),embed:r&&r.length?q.parseAttrs(r[0].substring(7)):null,params:[]},v=q.rte.utils.mediaInfo(x.embed?x.embed.type||"":"",x.obj.classid||"");if(v){if((r=z.match(q.paramRegExp))){a.each(r,function(t,A){x.params.push(q.parseAttrs(A.substring(6)))
|
79
|
+
})}!x.obj.classid&&(x.obj.classid=v.classid[0]);!x.obj.codebase&&(x.obj.codebase=v.codebase);x.embed&&!x.embed.type&&(x.embed.type=v.type);x.obj.width=="1"&&delete x.obj.width;x.obj.height=="1"&&delete x.obj.height;if(x.embed){x.embed.width=="1"&&delete x.embed.width;x.embed.height=="1"&&delete x.embed.height}return k(x,v.type)}return w}).replace(this.embRegExp,function(v,w,r){var r=q.parseAttrs(r),u=q.rte.utils.mediaInfo(r.type||"");r.width=="1"&&delete r.width;r.height=="1"&&delete r.height;return u?k({embed:r},u.type):v
|
80
|
+
}).replace(this.iframeRegExp,function(x,u){var u=q.parseAttrs(u);var r=u.style.width||(parseInt(u.width)>1?parseInt(u.width)+"px":"100px");var z=u.style.height||(parseInt(u.height)>1?parseInt(u.height)+"px":"100px");var A="iframe"+Math.random().toString().substring(2);q.scripts[A]=x;var v='<img id="'+A+'" src="'+q.url+'pixel.gif" class="elrte-protected elrte-iframe" style="width:'+r+"; height:"+z+'">';return v}).replace(this.vimeoRegExp,function(u,v,r){r=q.parseAttrs(r);delete r.frameborder;r.width=="1"&&delete r.width;
|
81
|
+
r.height=="1"&&delete r.height;r.type="application/x-shockwave-flash";return k({embed:r},"application/x-shockwave-flash")}).replace(/<\/(embed|param)>/gi,"").replace(this.pbRegExp,function(){return'<img src="'+q.url+'pixel.gif" class="elrte-protected elrte-pagebreak">'});g=a("<div>"+o+"</div>");if(!this.rte.options.allowTextNodes){var h=this.rte.dom,c=[],p=[];if(a.browser.msie){for(var j=0;j<g[0].childNodes.length;j++){c.push(g[0].childNodes[j])}}else{c=Array.prototype.slice.call(g[0].childNodes)
|
82
|
+
}function f(){if(p.length&&h.filter(p,"notEmpty").length){h.wrap(p,document.createElement("p"))}p=[]}a.each(c,function(r,t){if(h.is(t,"block")){f()}else{if(p.length&&t.previousSibling!=p[p.length-1]){f()}p.push(t)}});f()}return g.html()},restore:function(c){var b=this,f=this.rte.options.restore||[];if(f.length){a.each(f,function(g,h){if(typeof(h)=="function"){c=h.call(b,c)}})}c=c.replace(/\<\!--\[CDATA\[([\s\S]*?)\]\]--\>/gi,"<![CDATA[$1]]>").replace(/\<\!--\s*ELRTE_SCRIPT\:\s*(script\d+)\s*--\>/gi,function(g,h){if(b.scripts[h]){g=b.scripts[h];
|
83
|
+
delete b.scripts[h]}return g||""}).replace(/\<\!-- ELRTE_COMMENT([\s\S]*?) --\>/gi,"$1").replace(this.serviceClassRegExp,function(k,r,g,p){var g=b.parseAttrs(g),h,q="";if(g["class"]["elrte-google-maps"]){var k="";if(b.scripts[g.id]){k=b.scripts[g.id];delete b.scripts[g.id]}return k}else{if(g["class"]["elrte-iframe"]){return b.scripts[g.id]||""}else{if(g["class"]["elrtebm"]){return""}else{if(g["class"]["elrte-media"]){h=b.scripts[g.rel]||{};h.params&&a.each(h.params,function(j,o){q+="<param "+b.serializeAttrs(o)+">\n"
|
84
|
+
});h.embed&&(q+="<embed "+b.serializeAttrs(h.embed)+">");h.obj&&(q="<object "+b.serializeAttrs(h.obj)+">\n"+q+"\n</object>\n");return q||k}else{if(g["class"]["elrte-pagebreak"]){return"<!-- pagebreak -->"}}}}}a.each(g["class"],function(j){if(/^elrte-\w+/i.test(j)){delete (g["class"][j])}});return"<"+r+" "+b.serializeAttrs(g)+">"+(p||"")});return c},compactStyles:function(c){var b=this;return c.replace(this.tagRegExp,function(g,j,h,f){f=!j&&f?b.serializeAttrs(b.parseAttrs(f),true):"";return"<"+j+h.toLowerCase()+(f?" ":"")+f+">"
|
85
|
+
})},xhtmlTags:function(b){return this.xhtml?b.replace(/<(img|hr|br|embed|param|link|area)([^>]*\/*)>/gi,"<$1$2 />"):b}};elRTE.prototype.filter.prototype.chains={wysiwyg:["replace","clean","allowedTags","deniedTags","compactStyles"],source:["clean","allowedTags","restore","compactStyles","xhtmlTags"],paste:["clean","allowedTags","cleanPaste","replace","deniedTags","compactStyles"],wysiwyg2wysiwyg:["clean","allowedTags","restore","replace","deniedTags","compactStyles"],source2source:["clean","allowedTags","replace","deniedTags","restore","compactStyles","xhtmlTags"]}
|
86
|
+
})(jQuery);(function(a){elRTE.prototype.history=function(b){this.rte=b;this._prev=[];this._next=[];this.add=function(){if(this.rte.options.historyLength>0&&this._prev.length>=this.rte.options.historyLength){this._prev.slice(this.rte.options.historyLength)}var c=this.rte.selection.getBookmark();this._prev.push([a(this.rte.doc.body).html(),c]);this.rte.selection.moveToBookmark(c);this._next=[]};this.back=function(){if(this._prev.length){var c=this.rte.selection.getBookmark(),f=this._prev.pop();this._next.push([a(this.rte.doc.body).html(),c]);
|
87
|
+
a(this.rte.doc.body).html(f[0]);this.rte.selection.moveToBookmark(f[1])}};this.fwd=function(){if(this._next.length){var c=this.rte.selection.getBookmark(),f=this._next.pop();this._prev.push([a(this.rte.doc.body).html(),c]);a(this.rte.doc.body).html(f[0]);this.rte.selection.moveToBookmark(f[1])}};this.canBack=function(){return this._prev.length};this.canFwd=function(){return this._next.length}}})(jQuery);(function(a){elRTE.prototype.options={doctype:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',cssClass:"el-rte",cssfiles:[],height:null,resizable:true,lang:"en",toolbar:"normal",absoluteURLs:true,allowSource:true,stripWhiteSpace:true,styleWithCSS:false,fmAllow:true,fmOpen:null,allowTags:[],denyTags:["applet","base","basefont","bgsound","blink","body","col","colgroup","isindex","frameset","html","head","meta","marquee","noframes","noembed","o:p","title","xml"],denyAttr:[],pasteDenyAttr:["id","name","class","style","language","onclick","ondblclick","onhover","onkeup","onkeydown","onkeypress"],allowTextNodes:true,allowBrowsersSpecStyles:false,allowPaste:true,pasteOnlyText:false,replace:[],restore:[],pagebreak:'<div style="page-break-after: always;"></div>',buttons:{save:"Save",copy:"Copy",cut:"Cut",css:"Css style and class",paste:"Paste",pastetext:"Paste only text",pasteformattext:"Paste formatted text",removeformat:"Clean format",undo:"Undo last action",redo:"Redo previous action",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",superscript:"Superscript",subscript:"Subscript",justifyleft:"Align left",justifyright:"Ailgn right",justifycenter:"Align center",justifyfull:"Align full",indent:"Indent",outdent:"Outdent",rtl:"Right to left",ltr:"Left to right",forecolor:"Font color",hilitecolor:"Background color",formatblock:"Format",fontsize:"Font size",fontname:"Font",insertorderedlist:"Ordered list",insertunorderedlist:"Unordered list",horizontalrule:"Horizontal rule",blockquote:"Blockquote",div:"Block element (DIV)",link:"Link",unlink:"Delete link",anchor:"Bookmark",image:"Image",pagebreak:"Page break",smiley:"Smiley",flash:"Flash",table:"Table",tablerm:"Delete table",tableprops:"Table properties",tbcellprops:"Table cell properties",tbrowbefore:"Insert row before",tbrowafter:"Insert row after",tbrowrm:"Delete row",tbcolbefore:"Insert column before",tbcolafter:"Insert column after",tbcolrm:"Delete column",tbcellsmerge:"Merge table cells",tbcellsplit:"Split table cell",docstructure:"Toggle display document structure",elfinder:"Open file manager",fullscreen:"Toggle full screen mode",nbsp:"Non breakable space",stopfloat:"Stop element floating",about:"About this software"},panels:{eol:[],save:["save"],copypaste:["copy","cut","paste","pastetext","pasteformattext","removeformat","docstructure"],undoredo:["undo","redo"],style:["bold","italic","underline","strikethrough","subscript","superscript"],colors:["forecolor","hilitecolor"],alignment:["justifyleft","justifycenter","justifyright","justifyfull"],indent:["outdent","indent"],format:["formatblock","fontsize","fontname"],lists:["insertorderedlist","insertunorderedlist"],elements:["horizontalrule","blockquote","div","stopfloat","css","nbsp","smiley","pagebreak"],direction:["ltr","rtl"],links:["link","unlink","anchor"],images:["image"],media:["image","flash"],tables:["table","tableprops","tablerm","tbrowbefore","tbrowafter","tbrowrm","tbcolbefore","tbcolafter","tbcolrm","tbcellprops","tbcellsmerge","tbcellsplit"],elfinder:["elfinder"],fullscreen:["fullscreen","about"]},toolbars:{tiny:["style"],compact:["save","undoredo","style","alignment","lists","links","fullscreen"],normal:["save","copypaste","undoredo","style","alignment","colors","indent","lists","links","elements","images","fullscreen"],complete:["save","copypaste","undoredo","style","alignment","colors","format","indent","lists","links","elements","media","fullscreen"],maxi:["save","copypaste","undoredo","elfinder","style","alignment","direction","colors","format","indent","lists","links","elements","media","tables","fullscreen"],eldorado:["save","copypaste","elfinder","undoredo","style","alignment","colors","format","indent","lists","links","elements","media","tables","fullscreen"]},panelNames:{save:"Save",copypaste:"Copy/Pase",undoredo:"Undo/Redo",style:"Text styles",colors:"Colors",alignment:"Alignment",indent:"Indent/Outdent",format:"Text format",lists:"Lists",elements:"Misc elements",direction:"Script direction",links:"Links",images:"Images",media:"Media",tables:"Tables",elfinder:"File manager (elFinder)"}}
|
88
|
+
})(jQuery);(function(a){elRTE.prototype.selection=function(g){this.rte=g;var c=this;this.w3cRange=null;var o,b,j,k;a(this.rte.doc).keyup(function(p){if(p.ctrlKey||p.metaKey||(p.keyCode>=8&&p.keyCode<=13)||(p.keyCode>=32&&p.keyCode<=40)||p.keyCode==46||(p.keyCode>=96&&p.keyCode<=111)){c.cleanCache()}}).mousedown(function(p){if(p.target.nodeName=="HTML"){o=c.rte.doc.body}else{o=p.target}b=j=null}).mouseup(function(p){if(p.target.nodeName=="HTML"){b=c.rte.doc.body}else{b=p.target}b=p.target;j=null}).click();
|
89
|
+
function h(){return c.rte.window.getSelection?c.rte.window.getSelection():c.rte.window.document.selection}function f(t,r,q){while(t.nodeName!="BODY"&&t.parentNode&&t.parentNode.nodeName!="BODY"&&(r?t!==r&&t.parentNode!=r:1)&&((q=="left"&&c.rte.dom.isFirstNotEmpty(t))||(q=="right"&&c.rte.dom.isLastNotEmpty(t))||(c.rte.dom.isFirstNotEmpty(t)&&c.rte.dom.isLastNotEmpty(t)))){t=t.parentNode}return t}this.collapsed=function(){return this.getRangeAt().isCollapsed()};this.collapse=function(p){var q=h(),t=this.getRangeAt();
|
90
|
+
t.collapse(p?true:false);if(!a.browser.msie){q.removeAllRanges();q.addRange(t)}return this};this.getRangeAt=function(t){if(this.rte.browser.msie){if(!this.w3cRange){this.w3cRange=new this.rte.w3cRange(this.rte)}t&&this.w3cRange.update();return this.w3cRange}var p=h();var q=p.rangeCount>0?p.getRangeAt(0):this.rte.doc.createRange();q.getStart=function(){return this.startContainer.nodeType==1?this.startContainer.childNodes[Math.min(this.startOffset,this.startContainer.childNodes.length-1)]:this.startContainer
|
91
|
+
};q.getEnd=function(){return this.endContainer.nodeType==1?this.endContainer.childNodes[Math.min(this.startOffset==this.endOffset?this.endOffset:this.endOffset-1,this.endContainer.childNodes.length-1)]:this.endContainer};q.isCollapsed=function(){return this.collapsed};return q};this.saveIERange=function(){if(a.browser.msie){k=this.getRangeAt().getBookmark()}};this.restoreIERange=function(){a.browser.msie&&k&&this.getRangeAt().moveToBookmark(k)};this.cloneContents=function(){var v=this.rte.dom.create("div"),q,u,p;
|
92
|
+
if(a.browser.msie){try{q=this.rte.window.document.selection.createRange()}catch(t){q=this.rte.doc.body.createTextRange()}a(v).html(q.htmlText)}else{u=this.getRangeAt().cloneContents();for(p=0;p<u.childNodes.length;p++){v.appendChild(u.childNodes[p].cloneNode(true))}}return v};this.select=function(t,w){w=w||t;if(this.rte.browser.msie){var u=this.rte.doc.body.createTextRange(),q=u.duplicate(),p=u.duplicate();q.moveToElementText(t);p.moveToElementText(w);u.setEndPoint("StartToStart",q);u.setEndPoint("EndToEnd",p);
|
93
|
+
u.select()}else{var v=h(),u=this.getRangeAt();u.setStartBefore(t);u.setEndAfter(w);v.removeAllRanges();v.addRange(u)}return this.cleanCache()};this.selectContents=function(u){var q=this.getRangeAt();if(u&&u.nodeType==1){if(this.rte.browser.msie){q.range();q.r.moveToElementText(u.parentNode);q.r.select()}else{try{q.selectNodeContents(u)}catch(t){return this.rte.log("unable select node contents "+u)}var p=h();p.removeAllRanges();p.addRange(q)}}return this};this.deleteContents=function(){if(!a.browser.msie){this.getRangeAt().deleteContents()
|
94
|
+
}return this};this.insertNode=function(v,u){if(u&&!this.collapsed()){this.collapse()}if(this.rte.browser.msie){var p=v.nodeType==3?v.nodeValue:a(this.rte.dom.create("span")).append(a(v)).html();var t=this.getRangeAt();t.insertNode(p)}else{var t=this.getRangeAt();t.insertNode(v);t.setStartAfter(v);t.setEndAfter(v);var q=h();q.removeAllRanges();q.addRange(t)}return this.cleanCache()};this.insertHtml=function(p,q){if(q&&!this.collapsed()){this.collapse()}if(this.rte.browser.msie){this.getRangeAt().range().pasteHTML(p)
|
95
|
+
}else{var r=a(this.rte.dom.create("span")).html(p||"").get(0);this.insertNode(r);a(r).replaceWith(a(r).html())}return this.cleanCache()};this.insertText=function(q,p){var r=this.rte.doc.createTextNode(q);return this.insertHtml(r.nodeValue)};this.getBookmark=function(){this.rte.window.focus();var p,v,t,z,w,A=this.rte.dom.createBookmark(),x=this.rte.dom.createBookmark();if(a.browser.msie){try{p=this.rte.window.document.selection.createRange()}catch(x){p=this.rte.doc.body.createTextRange()}if(p.item){var u=p.item(0);
|
96
|
+
p=this.rte.doc.body.createTextRange();p.moveToElementText(u)}v=p.duplicate();t=p.duplicate();z=this.rte.dom.create("span");w=this.rte.dom.create("span");z.appendChild(A);w.appendChild(x);v.collapse(true);v.pasteHTML(z.innerHTML);t.collapse(false);t.pasteHTML(w.innerHTML)}else{var q=h();var p=q.rangeCount>0?q.getRangeAt(0):this.rte.doc.createRange();v=p.cloneRange();t=p.cloneRange();t.collapse(false);t.insertNode(x);v.collapse(true);v.insertNode(A);this.select(A,x)}return[A.id,x.id]};this.moveToBookmark=function(p){this.rte.window.focus();
|
97
|
+
if(p&&p.length==2){var q=this.rte.doc.getElementById(p[0]),v=this.rte.doc.getElementById(p[1]),u,t;if(q&&v){this.select(q,v);if(this.rte.dom.next(q)==v){this.collapse(true)}if(!a.browser.msie){u=h();t=u.rangeCount>0?u.getRangeAt(0):this.rte.doc.createRange();u.removeAllRanges();u.addRange(t)}q.parentNode.removeChild(q);v.parentNode.removeChild(v)}}return this};this.removeBookmark=function(p){this.rte.window.focus();if(p.length==2){var q=this.rte.doc.getElementById(p[0]),r=this.rte.doc.getElementById(p[1]);
|
98
|
+
if(q&&r){q.parentNode.removeChild(q);r.parentNode.removeChild(r)}}};this.cleanCache=function(){o=b=j=null;return this};this.getStart=function(){if(!o){var p=this.getRangeAt();o=p.getStart()}return o};this.getEnd=function(){if(!b){var p=this.getRangeAt();b=p.getEnd()}return b};this.getNode=function(){if(!j){j=this.rte.dom.findCommonAncestor(this.getStart(),this.getEnd())}return j};this.selected=function(r){var p={collapsed:false,blocks:false,filter:false,wrap:"text",tag:"span"};p=a.extend({},p,r);
|
99
|
+
if(p.blocks){var v=this.getNode(),u=null;if(u=this.rte.dom.selfOrParent(v,"selectionBlock")){return[u]}}var t=this.selectedRaw(p.collapsed,p.blocks);var A=[];var w=[];var B=null;function q(){function D(){for(var F=0;F<w.length;F++){if(w[F].nodeType==1&&(c.rte.dom.selfOrParent(w[F],/^P$/)||a(w[F]).find("p").length>0)){return false}}return true}if(w.length>0){var C=p.tag=="p"&&!D()?"div":p.tag;var E=c.rte.dom.wrap(w,C);A[B]=E;B=null;w=[]}}function z(E){if(E.nodeType==1){if(/^(THEAD|TFOOT|TBODY|COL|COLGROUP|TR)$/.test(E.nodeName)){a(E).find("td,th").each(function(){var F=p.tag=="p"&&a(this).find("p").length>0?"div":p.tag;
|
100
|
+
var G=c.rte.dom.wrapContents(this,F);return A.push(G)})}else{if(/^(CAPTION|TD|TH|LI|DT|DD)$/.test(E.nodeName)){var C=p.tag=="p"&&a(E).find("p").length>0?"div":p.tag;var E=c.rte.dom.wrapContents(E,C);return A.push(E)}}}var D=w.length>0?w[w.length-1]:null;if(D&&D!=c.rte.dom.prev(E)){q()}w.push(E);if(B===null){B=A.length;A.push("dummy")}}if(t.nodes.length>0){for(var x=0;x<t.nodes.length;x++){var v=t.nodes[x];if(v.nodeType==3&&(x==0||x==t.nodes.length-1)&&a.trim(v.nodeValue).length>0){if(x==0&&t.so>0){v=v.splitText(t.so)
|
101
|
+
}if(x==t.nodes.length-1&&t.eo>0){v.splitText(x==0&&t.so>0?t.eo-t.so:t.eo)}}switch(p.wrap){case"text":if((v.nodeType==1&&v.nodeName=="BR")||(v.nodeType==3&&a.trim(v.nodeValue).length>0)){z(v)}else{if(v.nodeType==1){A.push(v)}}break;case"inline":if(this.rte.dom.isInline(v)){z(v)}else{if(v.nodeType==1){A.push(v)}}break;case"all":if(v.nodeType==1||!this.rte.dom.isEmpty(v)){z(v)}break;default:if(v.nodeType==1||!this.rte.dom.isEmpty(v)){A.push(v)}}}q()}if(A.length){this.rte.window.focus();this.select(A[0],A[A.length-1])
|
102
|
+
}return p.filter?this.rte.dom.filter(A,p.filter):A};this.dump=function(p,t,w,v,q){var u=this.getRangeAt();this.rte.log("commonAncestorContainer");this.rte.log(p||u.commonAncestorContainer);this.rte.log("startContainer");this.rte.log(t||u.startContainer);this.rte.log("startOffset: "+(v>=0?v:u.startOffset));this.rte.log("endContainer");this.rte.log(w||u.endContainer);this.rte.log("endOffset: "+(q>=0?q:u.endOffset))};this.selectedRaw=function(z,p){var F={so:null,eo:null,nodes:[]};var q=this.getRangeAt(true);
|
103
|
+
var w=q.commonAncestorContainer;var H,E;var D=false;var B=false;function C(J,r,I){if(J.nodeType==3){I=I>=0?I:J.nodeValue.length;return(r==0&&I==J.nodeValue.length)||a.trim(J.nodeValue).length==a.trim(J.nodeValue.substring(r,I)).length}return true}function x(J,r,I){if(J.nodeType==1){return c.rte.dom.isEmpty(J)}else{if(J.nodeType==3){return a.trim(J.nodeValue.substring(r||0,I>=0?I:J.nodeValue.length)).length==0}}return true}if(q.startContainer.nodeType==1){if(q.startOffset<q.startContainer.childNodes.length){H=q.startContainer.childNodes[q.startOffset];
|
104
|
+
F.so=H.nodeType==1?null:0}else{H=q.startContainer.childNodes[q.startOffset-1];F.so=H.nodeType==1?null:H.nodeValue.length}}else{H=q.startContainer;F.so=q.startOffset}if(q.collapsed){if(z){if(p){H=f(H);if(!this.rte.dom.isEmpty(H)||(H=this.rte.dom.next(H))){F.nodes=[H]}if(this.rte.dom.isInline(H)){F.nodes=this.rte.dom.toLineStart(H).concat(F.nodes,this.rte.dom.toLineEnd(H))}if(F.nodes.length>0){F.so=F.nodes[0].nodeType==1?null:0;F.eo=F.nodes[F.nodes.length-1].nodeType==1?null:F.nodes[F.nodes.length-1].nodeValue.length
|
105
|
+
}}else{if(!this.rte.dom.isEmpty(H)){F.nodes=[H]}}}return F}if(q.endContainer.nodeType==1){E=q.endContainer.childNodes[q.endOffset-1];F.eo=E.nodeType==1?null:E.nodeValue.length}else{E=q.endContainer;F.eo=q.endOffset}if(H.nodeType==1||p||C(H,F.so,H.nodeValue.length)){H=f(H,w,"left");D=true;F.so=H.nodeType==1?null:0}if(E.nodeType==1||p||C(E,0,F.eo)){E=f(E,w,"right");B=true;F.eo=E.nodeType==1?null:E.nodeValue.length}if(p){if(H.nodeType!=1&&H.parentNode!=w&&H.parentNode.nodeName!="BODY"){H=H.parentNode;
|
106
|
+
F.so=null}if(E.nodeType!=1&&E.parentNode!=w&&E.parentNode.nodeName!="BODY"){E=E.parentNode;F.eo=null}}if(H.parentNode==E.parentNode&&H.parentNode.nodeName!="BODY"&&(D&&this.rte.dom.isFirstNotEmpty(H))&&(B&&this.rte.dom.isLastNotEmpty(E))){H=E=H.parentNode;F.so=H.nodeType==1?null:0;F.eo=E.nodeType==1?null:E.nodeValue.length}if(H==E){if(!this.rte.dom.isEmpty(H)){F.nodes.push(H)}return F}var t=H;while(t.nodeName!="BODY"&&t.parentNode!==w&&t.parentNode.nodeName!="BODY"){t=t.parentNode}var G=E;while(G.nodeName!="BODY"&&G.parentNode!==w&&G.parentNode.nodeName!="BODY"){G=G.parentNode
|
107
|
+
}if(!x(H,F.so,H.nodeType==3?H.nodeValue.length:null)){F.nodes.push(H)}var v=H;while(v!==t){var u=v;while((u=this.rte.dom.next(u))){F.nodes.push(u)}v=v.parentNode}v=t;while((v=this.rte.dom.next(v))&&v!=G){F.nodes.push(v)}var A=[];v=E;while(v!==G){var u=v;while((u=this.rte.dom.prev(u))){A.push(u)}v=v.parentNode}if(A.length){F.nodes=F.nodes.concat(A.reverse())}if(!x(E,0,E.nodeType==3?F.eo:null)){F.nodes.push(E)}if(p){if(this.rte.dom.isInline(H)){F.nodes=this.rte.dom.toLineStart(H).concat(F.nodes);F.so=F.nodes[0].nodeType==1?null:0
|
108
|
+
}if(this.rte.dom.isInline(E)){F.nodes=F.nodes.concat(this.rte.dom.toLineEnd(E));F.eo=F.nodes[F.nodes.length-1].nodeType==1?null:F.nodes[F.nodes.length-1].nodeValue.length}}return F}}})(jQuery);(function(a){elRTE.prototype.ui=function(f){this.rte=f;this._buttons=[];var v=this,o=this.rte.options.toolbars[f.options.toolbar&&f.options.toolbars[f.options.toolbar]?f.options.toolbar:"normal"],r=o.length,g,k,j,h,t,u,q;for(q in this.buttons){if(this.buttons.hasOwnProperty(q)&&q!="button"){this.buttons[q].prototype=this.buttons.button.prototype
|
109
|
+
}}while(r--){first=(r==0?true:false);if(o[r-1]=="eol"){first=true}k=o[r];if(k=="eol"){a(this.rte.doc.createElement("br")).prependTo(this.rte.toolbar);continue}g=a('<ul class="panel-'+k+(first?" first":"")+'" />').prependTo(this.rte.toolbar);g.bind("mousedown",function(b){b.preventDefault()});j=this.rte.options.panels[k].length;while(j--){h=this.rte.options.panels[k][j];t=this.buttons[h]||this.buttons.button;this._buttons.push((u=new t(this.rte,h)));g.prepend(u.domElem)}}this.update();this.disable=function(){a.each(v._buttons,function(){!this.active&&this.domElem.addClass("disabled")
|
110
|
+
})}};elRTE.prototype.ui.prototype.update=function(h){h&&this.rte.selection.cleanCache();var f=this.rte.selection.getNode(),c=this.rte.dom.parents(f,"*"),j=this.rte.rtl,q=j?" « ":" » ",o="",b,g;function k(r){var p=r.nodeName.toLowerCase();r=a(r);if(p=="img"){if(r.hasClass("elrte-media")){p="media"}else{if(r.hasClass("elrte-google-maps")){p="google map"}else{if(r.hasClass("elrte-yandex-maps")){p="yandex map"}else{if(r.hasClass("elrte-pagebreak")){p="pagebreak"}}}}}return p}if(f&&f.nodeType==1&&f.nodeName!="BODY"){c.unshift(f)
|
111
|
+
}if(!j){c=c.reverse()}for(g=0;g<c.length;g++){o+=(g>0?q:"")+k(c[g])}this.rte.statusbar.html(o);a.each(this._buttons,function(){this.update()});this.rte.window.focus()};elRTE.prototype.ui.prototype.buttons={button:function(f,c){var b=this;this.rte=f;this.active=false;this.name=c;this.val=null;this.domElem=a('<li style="-moz-user-select:-moz-none" class="'+c+' rounded-3" name="'+c+'" title="'+this.rte.i18n(this.rte.options.buttons[c]||c)+'" unselectable="on" />').hover(function(){a(this).addClass("hover")
|
112
|
+
},function(){a(this).removeClass("hover")}).click(function(g){g.stopPropagation();g.preventDefault();if(!a(this).hasClass("disabled")){b.command()}b.rte.window.focus()})}};elRTE.prototype.ui.prototype.buttons.button.prototype.command=function(){this.rte.history.add();try{this.rte.doc.execCommand(this.name,false,this.val)}catch(b){return this.rte.log("commands failed: "+this.name)}this.rte.ui.update(true)};elRTE.prototype.ui.prototype.buttons.button.prototype.update=function(){try{if(!this.rte.doc.queryCommandEnabled(this.name)){return this.domElem.addClass("disabled")
|
113
|
+
}else{this.domElem.removeClass("disabled")}}catch(b){return}try{if(this.rte.doc.queryCommandState(this.name)){this.domElem.addClass("active")}else{this.domElem.removeClass("active")}}catch(b){}}})(jQuery);(function(a){elRTE.prototype.utils=function(c){this.rte=c;this.url=null;this.reg=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;this.baseURL="";this.path="";
|
114
|
+
this.entities={"&":"&",'"':""","<":"<",">":">"};this.entitiesRegExp=/[<>&\"]/g;this.media=[{type:"application/x-shockwave-flash",classid:["clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"],codebase:"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"},{type:"application/x-director",classid:["clsid:166b1bca-3f9c-11cf-8075-444553540000"],codebase:"http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"},{type:"application/x-mplayer2",classid:["clsid:6bf52a52-394a-11d3-b153-00c04f79faa6","clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95","clsid:05589fa1-c356-11ce-bf01-00aa0055595a"],codebase:"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"},{type:"video/quicktime",classid:["clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b"],codebase:"http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"},{type:"audio/x-pn-realaudio-plugin",classid:["clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa"],codebase:"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"}];
|
115
|
+
this.rgbRegExp=/\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*/i;this.colorsRegExp=/aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|rgb\s*\([^\)]+\)/i;this.colors={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",orange:"#ffa500",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#fffffff",yellow:"#ffff00"};
|
116
|
+
var b=this;this.rgb2hex=function(f){return this.color2Hex(""+f)};this.toPixels=function(g){var f=g.match(/([0-9]+\.?[0-9]*)\s*(px|pt|em|%)/);if(f){g=f[1];unit=f[2]}if(g[0]=="."){g="0"+g}g=parseFloat(g);if(isNaN(g)){return""}var h=parseInt(a(document.body).css("font-size"))||16;switch(unit){case"em":return parseInt(g*h);case"pt":return parseInt(g*h/12);case"%":return parseInt(g*h/100)}return g};this.absoluteURL=function(g){!this.url&&this._url();g=a.trim(g);if(!g){return""}if(g[0]=="#"){return g}var f=this.parseURL(g);
|
117
|
+
if(!f.host&&!f.path&&!f.anchor){return""}if(!this.rte.options.absoluteURLs){return g}if(f.protocol){return g}if(f.host&&(f.host.indexOf(".")!=-1||f.host=="localhost")){return this.url.protocol+"://"+g}if(g[0]=="/"){g=this.baseURL+g}else{if(g.indexOf("./")==0){g=g.substring(2)}g=this.baseURL+this.path+g}return g};this.parseURL=function(h){var g=h.match(this.reg);var f={};a.each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(j){f[this]=g[j]
|
118
|
+
});if(!f.host.match(/[a-z0-9]/i)){f.host=""}return f};this.trimEventCallback=function(f){f=f?f.toString():"";return a.trim(f.replace(/\r*\n/mg,"").replace(/^function\s*on[a-z]+\s*\(\s*event\s*\)\s*\{(.+)\}$/igm,"$1"))};this._url=function(){this.url=this.parseURL(window.location.href);this.baseURL=this.url.protocol+"://"+(this.url.userInfo?parts.userInfo+"@":"")+this.url.host+(this.url.port?":"+this.url.port:"");this.path=!this.url.file?this.url.path:this.url.path.substring(0,this.url.path.length-this.url.file.length)
|
119
|
+
};this.makeObject=function(g){var f={};a.each(g,function(h,j){f[j]=j});return f};this.encode=function(f){var g=this.entities;return(""+f).replace(this.entitiesRegExp,function(h){return g[h]})};this.decode=function(f){return a("<div/>").html(f||"").text()};this.parseStyle=function(k){var h={},f=this.rte.options.allowBrowsersSpecStyles,j,q,g,o;if(typeof(k)=="string"&&k.length){a.each(k.replace(/"/gi,"'").split(";"),function(p,r){if((o=r.indexOf(":"))!==-1){q=a.trim(r.substr(0,o));g=a.trim(r.substr(o+1));
|
120
|
+
if(q=="color"||q=="background-color"){g=g.toLowerCase()}if(q&&g&&(f||q.substring(0,1)!="-")){h[q]=g}}})}return h};this.compactStyle=function(g){var f=this;if(g.border=="medium none"){delete g.border}a.each(g,function(j,h){if(/color$/i.test(j)){g[j]=f.color2Hex(h)}else{if(/^(border|background)$/i.test(j)){g[j]=h.replace(f.colorsRegExp,function(k){return f.color2Hex(k)})}}});if(g["border-width"]){g.border=g["border-width"]+" "+(g["border-style"]||"solid")+" "+(g["border-color"]||"#000");delete g["border-width"];
|
121
|
+
delete g["border-style"];delete g["border-color"]}if(g["background-image"]){g.background=(g["background-color"]+" ")||""+g["background-image"]+" "+g["background-position"]||"0 0 "+g["background-repeat"]||"repeat";delete g["background-image"];delete ["background-image"];delete ["background-position"];delete ["background-repeat"]}if(g["margin-top"]&&g["margin-right"]&&g["margin-bottom"]&&g["margin-left"]){g.margin=g["margin-top"]+" "+g["margin-right"]+" "+g["margin-bottom"]+" "+g["margin-left"];delete g["margin-top"];
|
122
|
+
delete g["margin-right"];delete g["margin-bottom"];delete g["margin-left"]}if(g["padding-top"]&&g["padding-right"]&&g["padding-bottom"]&&g["padding-left"]){g.padding=g["padding-top"]+" "+g["padding-right"]+" "+g["padding-bottom"]+" "+g["padding-left"];delete g["padding-top"];delete g["padding-right"];delete g["padding-bottom"];delete g["padding-left"]}if(g["list-style-type"]||g["list-style-position"]||g["list-style-image"]){g["list-style"]=a.trim(g["list-style-type"]||" "+g["list-style-position"]||""+g["list-style-image"]||"");
|
123
|
+
delete g["list-style-type"];delete g["list-style-position"];delete g["list-style-image"]}return g};this.serializeStyle=function(g,h){var f=[];a.each(h?this.compactStyle(g):g,function(k,j){j&&f.push(k+":"+j)});return f.join(";")};this.parseClass=function(f){f=a.trim(f);return f.length?this.makeObject(f.split(/\s+/)):{};return f.length?f.split(/\s+/):[]};this.serializeClass=function(h){var g=[];var f=this.rte;a.each(h,function(j){g.push(j)});return g.join(" ")};this.mediaInfo=function(g,h){var f=this.media.length;
|
124
|
+
while(f--){if(g===this.media[f].type||(h&&a.inArray(h,this.media[f].classid)!=-1)){return this.media[f]}}};this.color2Hex=function(h){var f;h=h||"";if(h.indexOf("#")===0){return h}function g(j){j=parseInt(j).toString(16);return j.length>1?j:"0"+j}if(this.colors[h]){return this.colors[h]}if((f=h.match(this.rgbRegExp))){return"#"+g(f[1])+g(f[2])+g(f[3])}return""}}})(jQuery);(function(a){elRTE.prototype.w3cRange=function(c){var b=this;this.rte=c;this.r=null;this.collapsed=true;this.startContainer=null;
|
125
|
+
this.endContainer=null;this.startOffset=0;this.endOffset=0;this.commonAncestorContainer=null;this.range=function(){try{this.r=this.rte.window.document.selection.createRange()}catch(f){this.r=this.rte.doc.body.createTextRange()}return this.r};this.insertNode=function(f){this.range();b.r.collapse(false);var g=b.r.duplicate();g.pasteHTML(f)};this.getBookmark=function(){this.range();if(this.r.item){var f=this.r.item(0);this.r=this.rte.doc.body.createTextRange();this.r.moveToElementText(f)}return this.r.getBookmark()
|
126
|
+
};this.moveToBookmark=function(f){this.rte.window.focus();this.range().moveToBookmark(f);this.r.select()};this.update=function(){function h(x){var k="\uFEFF";var o=offset=0;var t=b.r.duplicate();t.collapse(x);var u=t.parentElement();if(!u||u.nodeName=="HTML"){return{parent:b.rte.doc.body,ndx:o,offset:offset}}t.pasteHTML(k);childs=u.childNodes;for(var q=0;q<childs.length;q++){var w=childs[q];if(q>0&&(w.nodeType!==3||childs[q-1].nodeType!==3)){o++}if(w.nodeType!==3){offset=0}else{var v=w.nodeValue.indexOf(k);
|
127
|
+
if(v!==-1){offset+=v;break}offset+=w.nodeValue.length}}t.moveStart("character",-1);t.text="";return{parent:u,ndx:Math.min(o,u.childNodes.length-1),offset:offset}}this.range();this.startContainer=this.endContainer=null;if(this.r.item){this.collapsed=false;var g=this.r.item(0);this.setStart(g.parentNode,this.rte.dom.indexOf(g));this.setEnd(g.parentNode,this.startOffset+1)}else{this.collapsed=this.r.boundingWidth==0;var j=h(true);var f=h(false);j.parent.normalize();f.parent.normalize();j.ndx=Math.min(j.ndx,j.parent.childNodes.length-1);
|
128
|
+
f.ndx=Math.min(f.ndx,f.parent.childNodes.length-1);if(j.parent.childNodes[j.ndx].nodeType&&j.parent.childNodes[j.ndx].nodeType==1){this.setStart(j.parent,j.ndx)}else{this.setStart(j.parent.childNodes[j.ndx],j.offset)}if(f.parent.childNodes[f.ndx].nodeType&&f.parent.childNodes[f.ndx].nodeType==1){this.setEnd(f.parent,f.ndx)}else{this.setEnd(f.parent.childNodes[f.ndx],f.offset)}this.select()}return this};this.isCollapsed=function(){this.range();this.collapsed=this.r.item?false:this.r.boundingWidth==0;
|
129
|
+
return this.collapsed};this.collapse=function(f){this.range();if(this.r.item){var g=this.r.item(0);this.r=this.rte.doc.body.createTextRange();this.r.moveToElementText(g)}this.r.collapse(f);this.r.select();this.collapsed=true};this.getStart=function(){this.range();if(this.r.item){return this.r.item(0)}var g=this.r.duplicate();g.collapse(true);var f=g.parentElement();return f&&f.nodeName=="BODY"?f.firstChild:f};this.getEnd=function(){this.range();if(this.r.item){return this.r.item(0)}var f=this.r.duplicate();
|
130
|
+
f.collapse(false);var g=f.parentElement();return g&&g.nodeName=="BODY"?g.lastChild:g};this.setStart=function(f,g){this.startContainer=f;this.startOffset=g;if(this.endContainer){this.commonAncestorContainer=this.rte.dom.findCommonAncestor(this.startContainer,this.endContainer)}};this.setEnd=function(f,g){this.endContainer=f;this.endOffset=g;if(this.startContainer){this.commonAncestorContainer=this.rte.dom.findCommonAncestor(this.startContainer,this.endContainer)}};this.setStartBefore=function(f){if(f.parentNode){this.setStart(f.parentNode,this.rte.dom.indexOf(f))
|
131
|
+
}};this.setStartAfter=function(f){if(f.parentNode){this.setStart(f.parentNode,this.rte.dom.indexOf(f)+1)}};this.setEndBefore=function(f){if(f.parentNode){this.setEnd(f.parentNode,this.rte.dom.indexOf(f))}};this.setEndAfter=function(f){if(f.parentNode){this.setEnd(f.parentNode,this.rte.dom.indexOf(f)+1)}};this.select=function(){function o(B,z){if(B.nodeType!=3){return -1}var A="\uFEFF";var x=B.nodeValue;var v=b.rte.doc.body.createTextRange();B.nodeValue=x.substring(0,z)+A+x.substring(z);v.moveToElementText(B.parentNode);
|
132
|
+
v.findText(A);var w=Math.abs(v.moveStart("character",-1048575));B.nodeValue=x;return w}this.r=this.rte.doc.body.createTextRange();var k=this.startOffset;var g=this.endOffset;var u=this.startContainer.nodeType==1?this.startContainer.childNodes[Math.min(k,this.startContainer.childNodes.length-1)]:this.startContainer;var q=this.endContainer.nodeType==1?this.endContainer.childNodes[Math.min(k==g?g:g-1,this.endContainer.childNodes.length-1)]:this.endContainer;if(this.collapsed){if(u.nodeType==3){var h=o(u,k);
|
133
|
+
this.r.move("character",h)}else{this.r.moveToElementText(u);this.r.collapse(true)}}else{var f=this.rte.doc.body.createTextRange();var j=o(u,k);var t=o(q,g);if(u.nodeType==3){this.r.move("character",j)}else{this.r.moveToElementText(u)}if(q.nodeType==3){f.move("character",t)}else{f.moveToElementText(q)}this.r.setEndPoint("EndToEnd",f)}try{this.r.select()}catch(q){}if(f){f=null}};this.dump=function(){this.rte.log("collapsed: "+this.collapsed);this.rte.log("startContainer: "+(this.startContainer?this.startContainer.nodeName:"non"));
|
134
|
+
this.rte.log("startOffset: "+this.startOffset);this.rte.log("endContainer: "+(this.endContainer?this.endContainer.nodeName:"none"));this.rte.log("endOffset: "+this.endOffset)}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.about=function(c,b){this.constructor.prototype.constructor.call(this,c,b);this.active=true;this.command=function(){var g,h,f;g={rtl:c.rtl,submit:function(j,k){k.close()},dialog:{width:560,title:this.rte.i18n("About this software"),buttons:{Ok:function(){a(this).dialog("destroy")
|
135
|
+
}}}};f='<div class="elrte-logo"></div><h3>'+this.rte.i18n("About elRTE")+'</h3><br clear="all"/><div class="elrte-ver">'+this.rte.i18n("Version")+": "+this.rte.version+" ("+this.rte.build+')</div><div class="elrte-ver">jQuery: '+a("<div/>").jquery+'</div><div class="elrte-ver">jQueryUI: '+a.ui.version+'</div><div class="elrte-ver">'+this.rte.i18n("Licence")+": BSD Licence</div><p>"+this.rte.i18n("elRTE is an open-source JavaScript based WYSIWYG HTML-editor.")+"<br/>"+this.rte.i18n("Main goal of the editor - simplify work with text and formating (HTML) on sites, blogs, forums and other online services.")+"<br/>"+this.rte.i18n("You can use it in any commercial or non-commercial projects.")+"</p><h4>"+this.rte.i18n("Authors")+'</h4><table class="elrte-authors"><tr><td>Dmitry (dio) Levashov <dio@std42.ru></td><td>'+this.rte.i18n("Chief developer")+"</td></tr><tr><td>Troex Nevelin <troex@fury.scancode.ru></td><td>"+this.rte.i18n("Developer, tech support")+"</td></tr><tr><td>Valentin Razumnyh <content@std42.ru></td><td>"+this.rte.i18n("Interface designer")+"</td></tr><tr><td>Tawfek Daghistani <tawfekov@gmail.com></td><td>"+this.rte.i18n("RTL support")+"</td></tr>"+(this.rte.options.lang!="en"?"<tr><td>"+this.rte.i18n("_translator")+"</td><td>"+this.rte.i18n("_translation")+"</td></tr>":"")+'</table><div class="elrte-copy">Copyright © 2009-2011, <a href="http://www.std42.ru">Studio 42</a></div><div class="elrte-copy">'+this.rte.i18n("For more information about this software visit the")+' <a href="http://elrte.org">'+this.rte.i18n("elRTE website")+'.</a></div><div class="elrte-copy">Twitter: <a href="http://twitter.com/elrte_elfinder">elrte_elfinder</a></div>';
|
136
|
+
h=new elDialogForm(g);h.append(f);h.open()};this.update=function(){this.domElem.removeClass("disabled")}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.anchor=function(f,c){this.constructor.prototype.constructor.call(this,f,c);this.input=a('<input type="text" />').attr("name","anchor").attr("size","16");var b=this;this.command=function(){var g={rtl:this.rte.rtl,submit:function(j,k){j.stopPropagation();j.preventDefault();k.close();b.set()},dialog:{title:this.rte.i18n("Bookmark")}};this.anchor=this.rte.dom.selfOrParentAnchor(this.rte.selection.getEnd())||f.dom.create("a");
|
137
|
+
!this.rte.selection.collapsed()&&this.rte.selection.collapse(false);this.input.val(a(this.anchor).addClass("elrte-anchor").attr("name"));this.rte.selection.saveIERange();var h=new elDialogForm(g);h.append([this.rte.i18n("Bookmark name"),this.input],null,true).open();setTimeout(function(){b.input.focus()},20)};this.update=function(){var g=this.rte.selection.getNode();if(this.rte.dom.selfOrParentLink(g)){this.domElem.addClass("disabled")}else{if(this.rte.dom.selfOrParentAnchor(g)){this.domElem.removeClass("disabled").addClass("active")
|
138
|
+
}else{this.domElem.removeClass("disabled").removeClass("active")}}};this.set=function(){var g=a.trim(this.input.val());if(g){this.rte.history.add();if(!this.anchor.parentNode){this.rte.selection.insertHtml('<a name="'+g+'" title="'+this.rte.i18n("Bookmark")+": "+g+'" class="elrte-anchor"></a>')}else{this.anchor.name=g;this.anchor.title=this.rte.i18n("Bookmark")+": "+g}}else{if(this.anchor.parentNode){this.rte.history.add();this.anchor.parentNode.removeChild(this.anchor)}}}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.blockquote=function(c,b){this.constructor.prototype.constructor.call(this,c,b);
|
139
|
+
this.command=function(){var g,f;this.rte.history.add();if(this.rte.selection.collapsed()&&(g=this.rte.dom.selfOrParent(this.rte.selection.getNode(),/^BLOCKQUOTE$/))){a(g).replaceWith(a(g).html())}else{f=this.rte.selection.selected({wrap:"all",tag:"blockquote"});f.length&&this.rte.selection.select(f[0],f[f.length-1])}this.rte.ui.update(true)};this.update=function(){if(this.rte.selection.collapsed()){if(this.rte.dom.selfOrParent(this.rte.selection.getNode(),/^BLOCKQUOTE$/)){this.domElem.removeClass("disabled").addClass("active")
|
140
|
+
}else{this.domElem.addClass("disabled").removeClass("active")}}else{this.domElem.removeClass("disabled active")}}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.copy=function(c,b){this.constructor.prototype.constructor.call(this,c,b);this.command=function(){if(this.rte.browser.mozilla){try{this.rte.doc.execCommand(this.name,false,null)}catch(h){var f=" Ctl + C";if(this.name=="cut"){f=" Ctl + X"}else{if(this.name=="paste"){f=" Ctl + V"}}var g={dialog:{title:this.rte.i18n("Warning"),buttons:{Ok:function(){a(this).dialog("close")
|
141
|
+
}}}};var j=new elDialogForm(g);j.append(this.rte.i18n("This operation is disabled in your browser on security reason. Use shortcut instead.")+": "+f).open()}}else{this.constructor.prototype.command.call(this)}}};elRTE.prototype.ui.prototype.buttons.cut=elRTE.prototype.ui.prototype.buttons.copy;elRTE.prototype.ui.prototype.buttons.paste=elRTE.prototype.ui.prototype.buttons.copy})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.css=function(f,c){var b=this;this.constructor.prototype.constructor.call(this,f,c);
|
142
|
+
this.cssStyle=a('<input type="text" size="42" name="style" />');this.cssClass=a('<input type="text" size="42" name="class" />');this.elementID=a('<input type="text" size="42" name="id" />');this.command=function(){var j=this.node(),g;this.rte.selection.saveIERange();if(j){var g={submit:function(k,o){k.stopPropagation();k.preventDefault();o.close();b.set()},dialog:{title:this.rte.i18n("Style"),width:450,resizable:true,modal:true}};this.cssStyle.val(a(j).attr("style"));this.cssClass.val(a(j).attr("class"));
|
143
|
+
this.elementID.val(a(j).attr("id"));var h=new elDialogForm(g);h.append([this.rte.i18n("Css style"),this.cssStyle],null,true);h.append([this.rte.i18n("Css class"),this.cssClass],null,true);h.append([this.rte.i18n("ID"),this.elementID],null,true);h.open();setTimeout(function(){b.cssStyle.focus()},20)}};this.set=function(){var g=this.node();this.rte.selection.restoreIERange();if(g){a(g).attr("style",this.cssStyle.val());a(g).attr("class",this.cssClass.val());a(g).attr("id",this.elementID.val());this.rte.ui.update()
|
144
|
+
}};this.node=function(){var g=this.rte.selection.getNode();if(g.nodeType==3){g=g.parentNode}return g.nodeType==1&&g.nodeName!="BODY"?g:null};this.update=function(){this.domElem.toggleClass("disabled",this.node()?false:true)}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.rtl=function(f,c){this.constructor.prototype.constructor.call(this,f,c);var b=this;this.command=function(){var h=this.rte.selection.getNode(),g=this;if(a(h).attr("dir")=="rtl"||a(h).parents('[dir="rtl"]').length||a(h).find('[dir="rtl"]').length){a(h).removeAttr("dir");
|
145
|
+
a(h).parents('[dir="rtl"]').removeAttr("dir");a(h).find('[dir="rtl"]').removeAttr("dir")}else{if(this.rte.dom.is(h,"textNodes")&&this.rte.dom.is(h,"block")){a(h).attr("dir","rtl")}else{a.each(this.rte.dom.parents(h,"textNodes"),function(j,k){if(g.rte.dom.is(k,"block")){a(k).attr("dir","rtl");return false}})}}this.rte.ui.update()};this.update=function(){var g=this.rte.selection.getNode();this.domElem.removeClass("disabled");if(a(g).attr("dir")=="rtl"||a(g).parents('[dir="rtl"]').length||a(g).find('[dir="rtl"]').length){this.domElem.addClass("active")
|
146
|
+
}else{this.domElem.removeClass("active")}}};elRTE.prototype.ui.prototype.buttons.ltr=function(f,c){this.constructor.prototype.constructor.call(this,f,c);var b=this;this.command=function(){var h=this.rte.selection.getNode(),g=this;if(a(h).attr("dir")=="ltr"||a(h).parents('[dir="ltr"]').length||a(h).find('[dir="ltr"]').length){a(h).removeAttr("dir");a(h).parents('[dir="ltr"]').removeAttr("dir");a(h).find('[dir="ltr"]').removeAttr("dir")}else{if(this.rte.dom.is(h,"textNodes")&&this.rte.dom.is(h,"block")){a(h).attr("dir","ltr")
|
147
|
+
}else{a.each(this.rte.dom.parents(h,"textNodes"),function(j,k){if(g.rte.dom.is(k,"block")){a(k).attr("dir","ltr");return false}})}}this.rte.ui.update()};this.update=function(){var g=this.rte.selection.getNode();this.domElem.removeClass("disabled");if(a(g).attr("dir")=="ltr"||a(g).parents('[dir="ltr"]').length||a(g).find('[dir="ltr"]').length){this.domElem.addClass("active")}else{this.domElem.removeClass("active")}}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.div=function(c,b){this.constructor.prototype.constructor.call(this,c,b);
|
148
|
+
this.command=function(){var g,f;this.rte.history.add();if(this.rte.selection.collapsed()){g=this.rte.dom.selfOrParent(this.rte.selection.getNode(),/^DIV$/);if(g){a(g).replaceWith(a(g).html())}}else{f=this.rte.selection.selected({wrap:"all",tag:"div"});f.length&&this.rte.selection.select(f[0],f[f.length-1])}this.rte.ui.update(true)};this.update=function(){if(this.rte.selection.collapsed()){if(this.rte.dom.selfOrParent(this.rte.selection.getNode(),/^DIV$/)){this.domElem.removeClass("disabled").addClass("active")
|
149
|
+
}else{this.domElem.addClass("disabled active")}}else{this.domElem.removeClass("disabled active")}}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.docstructure=function(c,b){this.constructor.prototype.constructor.call(this,c,b);this.command=function(){this.domElem.toggleClass("active");a(this.rte.doc.body).toggleClass("el-rte-structure")};this.command();this.update=function(){this.domElem.removeClass("disabled")}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.elfinder=function(f,c){this.constructor.prototype.constructor.call(this,f,c);
|
150
|
+
var b=this,f=this.rte;this.command=function(){if(b.rte.options.fmAllow&&typeof(b.rte.options.fmOpen)=="function"){b.rte.options.fmOpen(function(h){var g=decodeURIComponent(h.split("/").pop().replace(/\+/g," "));if(f.selection.collapsed()){f.selection.insertHtml('<a href="'+h+'" >'+g+"</a>")}else{f.doc.execCommand("createLink",false,h)}})}};this.update=function(){if(b.rte.options.fmAllow&&typeof(b.rte.options.fmOpen)=="function"){this.domElem.removeClass("disabled")}else{this.domElem.addClass("disabled")
|
151
|
+
}}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.flash=function(f,c){this.constructor.prototype.constructor.call(this,f,c);var b=this;this.swf=null;this.placeholder=null;this.src={url:a('<input type="text" name="url" />').css("width","99%"),type:a('<select name="type"/>').append('<option value="application/x-shockwave-flash">Flash</option>').append('<option value="video/quicktime">Quicktime movie</option>').append('<option value="application/x-mplayer2">Windows media</option>'),width:a('<input type="text" />').attr("size",5).css("text-align","right"),height:a('<input type="text" />').attr("size",5).css("text-align","right"),wmode:a("<select />").append(a("<option />").val("").text(this.rte.i18n("Not set","dialogs"))).append(a("<option />").val("transparent").text(this.rte.i18n("Transparent"))),align:a("<select />").append(a("<option />").val("").text(this.rte.i18n("Not set","dialogs"))).append(a("<option />").val("left").text(this.rte.i18n("Left"))).append(a("<option />").val("right").text(this.rte.i18n("Right"))).append(a("<option />").val("top").text(this.rte.i18n("Top"))).append(a("<option />").val("text-top").text(this.rte.i18n("Text top"))).append(a("<option />").val("middle").text(this.rte.i18n("middle"))).append(a("<option />").val("baseline").text(this.rte.i18n("Baseline"))).append(a("<option />").val("bottom").text(this.rte.i18n("Bottom"))).append(a("<option />").val("text-bottom").text(this.rte.i18n("Text bottom"))),margin:a("<div />")};
|
152
|
+
this.command=function(){var r=this.rte.selection.getEnd(),j,k="",B="",t="",v,z,x,A,q,C;this.rte.selection.saveIERange();this.src.margin.elPaddingInput({type:"margin"});this.placeholder=null;this.swf=null;if(a(r).hasClass("elrte-media")&&(A=a(r).attr("rel"))&&this.rte.filter.scripts[A]){this.placeholder=a(r);q=this.rte.filter.scripts[A];k="";if(q.embed&&q.embed.src){k=q.embed.src}if(q.params&&q.params.length){l=q.params.length;while(l--){if(q.params[l].name=="src"||q.params[l].name=="movie"){k=q.params[l].value
|
153
|
+
}}}if(q.embed){B=q.embed.width||parseInt(q.embed.style.width)||"";t=q.embed.height||parseInt(q.embed.style.height)||"";C=q.embed.wmode||""}else{if(q.obj){B=q.obj.width||parseInt(q.obj.style.width)||"";t=q.obj.height||parseInt(q.obj.style.height)||"";C=q.obj.wmode||""}}if(q.obj){v=q.obj.style["float"]||"";z=q.obj.style["vertical-align"]||""}else{if(q.embed){v=q.embed.style["float"]||"";z=q.embed.style["vertical-align"]||""}}this.src.margin.val(r);this.src.type.val(q.embed?q.embed.type:"")}if(a(r).hasClass("elrte-swf-placeholder")){this.placeholder=a(r);
|
154
|
+
k=a(r).attr("rel");B=parseInt(a(r).css("width"))||"";t=parseInt(a(r).css("height"))||"";v=a(r).css("float");z=a(r).css("vertical-align");this.src.margin.val(r);this.src.wmode.val(a(r).attr("wmode"))}this.src.url.val(k);this.src.width.val(B);this.src.height.val(t);this.src.align.val(v||z);this.src.wmode.val(C);var j={rtl:this.rte.rtl,submit:function(h,o){h.stopPropagation();h.preventDefault();b.set();o.close()},dialog:{width:580,position:"top",title:this.rte.i18n("Flash")}};var x=new elDialogForm(j);
|
155
|
+
if(this.rte.options.fmAllow&&this.rte.options.fmOpen){var g=a("<span />").append(this.src.url.css("width","85%")).append(a("<span />").addClass("ui-state-default ui-corner-all").css({"float":"right","margin-right":"3px"}).attr("title",b.rte.i18n("Open file manger")).append(a("<span />").addClass("ui-icon ui-icon-folder-open")).click(function(){b.rte.options.fmOpen(function(h){b.src.url.val(h).change()})}).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")
|
156
|
+
}))}else{var g=this.src.url}x.append([this.rte.i18n("URL"),g],null,true);x.append([this.rte.i18n("Type"),this.src.type],null,true);x.append([this.rte.i18n("Size"),a("<span />").append(this.src.width).append(" x ").append(this.src.height).append(" px")],null,true);x.append([this.rte.i18n("Wmode"),this.src.wmode],null,true);x.append([this.rte.i18n("Alignment"),this.src.align],null,true);x.append([this.rte.i18n("Margins"),this.src.margin],null,true);x.open();var u=a("<fieldset />").append(a("<legend />").text(this.rte.i18n("Preview")));
|
157
|
+
x.append(u,"main");var p=document.createElement("iframe");a(p).attr("src","#").addClass("el-rte-preview").appendTo(u);html=this.rte.options.doctype+'<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style="padding:0;margin:0;font-size:9px"> Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin</body></html>';
|
158
|
+
p.contentWindow.document.open();p.contentWindow.document.write(html);p.contentWindow.document.close();this.frame=p.contentWindow.document;this.preview=a(p.contentWindow.document.body);this.src.type.change(function(){b.src.url.change()});this.src.width.change(function(){if(b.swf){var h=parseInt(a(this).val())||"";a(this).val(h);b.swf.css("width",h);b.swf.children("embed").css("width",h)}else{a(this).val("")}});this.src.height.change(function(){if(b.swf){var o=parseInt(a(this).val())||"";a(this).val(o);
|
159
|
+
b.swf.css("height",o);b.swf.children("embed").css("height",o)}else{a(this).val("")}});this.src.wmode.change(function(){if(b.swf){var h=a(this).val();if(h){b.swf.attr("wmode",h);b.swf.children("embed").attr("wmode",h)}else{b.swf.removeAttr("wmode");b.swf.children("embed").removeAttr("wmode")}}});this.src.align.change(function(){var h=a(this).val(),o=h=="left"||h=="right";if(b.swf){b.swf.css({"float":o?h:"","vertical-align":o?"":h})}else{a(this).val("")}});this.src.margin.change(function(){if(b.swf){var h=b.src.margin.val();
|
160
|
+
if(h.css){b.swf.css("margin",h.css)}else{b.swf.css("margin-top",h.top);b.swf.css("margin-right",h.right);b.swf.css("margin-bottom",h.bottom);b.swf.css("margin-left",h.left)}}});this.src.url.change(function(){var h=b.rte.utils.absoluteURL(a(this).val()),o,w;if(h){o=b.rte.utils.mediaInfo(b.src.type.val());if(!o){o=b.rte.util.mediaInfo("application/x-shockwave-flash")}w='<object classid="'+o.classid+'" codebase="'+o.codebase+'"><param name="src" value="'+h+'" /><embed quality="high" src="'+h+'" type="'+o.type+'"></object>';
|
161
|
+
b.preview.children("object").remove().end().prepend(w);b.swf=b.preview.children("object").eq(0)}else{if(b.swf){b.swf.remove();b.swf=null}}b.src.width.trigger("change");b.src.height.trigger("change");b.src.align.trigger("change")}).trigger("change")};this.set=function(){b.swf=null;var g=this.rte.utils.absoluteURL(this.src.url.val()),B=parseInt(this.src.width.val())||"",t=parseInt(this.src.height.val())||"",C=this.src.wmode.val(),z=this.src.align.val(),v=z=="left"||z=="right"?z:"",A=this.placeholder?this.placeholder.attr("rel"):"",p,k,x,q=this.src.margin.val(),r;
|
162
|
+
if(!g){if(this.placeholder){this.placeholder.remove();delete this.rte.filter.scripts[A]}}else{i=b.rte.utils.mediaInfo(b.src.type.val());if(!i){i=b.rte.util.mediaInfo("application/x-shockwave-flash")}x=this.rte.filter.videoHostRegExp.test(g)?g.replace(this.rte.filter.videoHostRegExp,"$2"):i.type.replace(/^\w+\/(.+)/,"$1");p={obj:{classid:i.classid[0],codebase:i.codebase,style:{}},params:[{name:"src",value:g}],embed:{src:g,type:i.type,quality:"high",wmode:C,style:{}}};if(B){p.obj.width=B;p.embed.width=B
|
163
|
+
}if(t){p.obj.height=t;p.embed.height=t}if(v){p.obj.style["float"]=v}else{if(z){p.obj.style["vertical-align"]=z}}if(q.css){r={margin:q.css}}else{r={"margin-top":q.top,"margin-right":q.right,"margin-bottom":q.bottom,"margin-left":q.left}}p.obj.style=a.extend({},p.obj.style,r);if(this.placeholder&&A){k=this.rte.filter.scripts[A]||{};p=a.extend(true,k,p);delete p.obj.style.width;delete p.obj.style.height;delete p.embed.style.width;delete p.embed.style.height;this.rte.filter.scripts[A]=p;this.placeholder.removeAttr("class")
|
164
|
+
}else{var j="media"+Math.random().toString().substring(2);this.rte.filter.scripts[j]=p;this.placeholder=a(this.rte.dom.create("img")).attr("rel",j).attr("src",this.rte.filter.url+"pixel.gif");var u=true}this.placeholder.attr("title",this.rte.utils.encode(g)).attr("width",B||150).attr("height",t||100).addClass("elrte-protected elrte-media elrte-media-"+x).css(p.obj.style);if(v){this.placeholder.css("float",v).css("vertical-align","")}else{if(z){this.placeholder.css("float","").css("vertical-align",z)
|
165
|
+
}else{this.placeholder.css("float","").css("vertical-align","")}}if(u){this.rte.window.focus();this.rte.selection.restoreIERange();this.rte.selection.insertNode(this.placeholder.get(0))}}};this.update=function(){this.domElem.removeClass("disabled");var g=this.rte.selection.getNode();this.domElem.toggleClass("active",g&&g.nodeName=="IMG"&&a(g).hasClass("elrte-media"))}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.fontname=function(f,c){this.constructor.prototype.constructor.call(this,f,c);
|
166
|
+
var b=this;var g={tpl:'<span style="font-family:%val">%label</span>',select:function(h){b.set(h)},src:{"":this.rte.i18n("Font"),"andale mono,sans-serif":"Andale Mono","arial,helvetica,sans-serif":"Arial","arial black,gadget,sans-serif":"Arial Black","book antiqua,palatino,sans-serif":"Book Antiqua","comic sans ms,cursive":"Comic Sans MS","courier new,courier,monospace":"Courier New","georgia,palatino,serif":"Georgia","helvetica,sans-serif":"Helvetica","impact,sans-serif":"Impact","lucida console,monaco,monospace":"Lucida console","lucida sans unicode,lucida grande,sans-serif":"Lucida grande","tahoma,sans-serif":"Tahoma","times new roman,times,serif":"Times New Roman","trebuchet ms,lucida grande,verdana,sans-serif":"Trebuchet MS","verdana,geneva,sans-serif":"Verdana"}};
|
167
|
+
this.select=this.domElem.elSelect(g);this.command=function(){};this.set=function(j){this.rte.history.add();var h=this.rte.selection.selected({filter:"textContainsNodes"});a.each(h,function(){$this=/^(THEAD|TFOOT|TBODY|COL|COLGROUP|TR)$/.test(this.nodeName)?a(this).find("td,th"):a(this);a(this).css("font-family",j).find("[style]").css("font-family","")});this.rte.ui.update()};this.update=function(){this.domElem.removeClass("disabled");var j=this.rte.selection.getNode();if(j.nodeType!=1){j=j.parentNode
|
168
|
+
}var h=a(j).css("font-family");h=h?h.toString().toLowerCase().replace(/,\s+/g,",").replace(/'|"/g,""):"";this.select.val(g.src[h]?h:"")}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.fontsize=function(f,c){this.constructor.prototype.constructor.call(this,f,c);var b=this;var g={labelTpl:"%label",tpl:'<span style="font-size:%val;line-height:1.2em">%label</span>',select:function(h){b.set(h)},src:{"":this.rte.i18n("Font size"),"xx-small":this.rte.i18n("Small (8pt)"),"x-small":this.rte.i18n("Small (10px)"),small:this.rte.i18n("Small (12pt)"),medium:this.rte.i18n("Normal (14pt)"),large:this.rte.i18n("Large (18pt)"),"x-large":this.rte.i18n("Large (24pt)"),"xx-large":this.rte.i18n("Large (36pt)")}};
|
169
|
+
this.select=this.domElem.elSelect(g);this.command=function(){};this.set=function(j){this.rte.history.add();var h=this.rte.selection.selected({filter:"textContainsNodes"});a.each(h,function(){$this=/^(THEAD|TFOOT|TBODY|COL|COLGROUP|TR)$/.test(this.nodeName)?a(this).find("td,th"):a(this);$this.css("font-size",j).find("[style]").css("font-size","")});this.rte.ui.update()};this.update=function(){this.domElem.removeClass("disabled");var h=this.rte.selection.getNode();this.select.val((m=this.rte.dom.attr(h,"style").match(/font-size:\s*([^;]+)/i))?m[1]:"")
|
170
|
+
}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.forecolor=function(f,c){var b=this;this.constructor.prototype.constructor.call(this,f,c);var g={"class":"",palettePosition:"outer",color:this.defaultColor,update:function(h){b.indicator.css("background-color",h)},change:function(h){b.set(h)}};this.defaultColor=this.name=="forecolor"?"#000000":"#ffffff";this.picker=this.domElem.elColorPicker(g);this.indicator=a("<div />").addClass("color-indicator").prependTo(this.domElem);this.command=function(){};
|
171
|
+
this.set=function(k){if(!this.rte.selection.collapsed()){this.rte.history.add();var h=this.rte.selection.selected({collapse:false,wrap:"text"}),j=this.name=="forecolor"?"color":"background-color";a.each(h,function(){if(/^(THEAD|TBODY|TFOOT|TR)$/.test(this.nodeName)){a(this).find("td,th").each(function(){a(this).css(j,k).find("*").css(j,"")})}else{a(this).css(j,k).find("*").css(j,"")}});this.rte.ui.update(true)}};this.update=function(){this.domElem.removeClass("disabled");var h=this.rte.selection.getNode();
|
172
|
+
this.picker.val(this.rte.utils.rgb2hex(a(h.nodeType!=1?h.parentNode:h).css(this.name=="forecolor"?"color":"background-color"))||this.defaultColor)}};elRTE.prototype.ui.prototype.buttons.hilitecolor=elRTE.prototype.ui.prototype.buttons.forecolor})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.formatblock=function(f,c){this.constructor.prototype.constructor.call(this,f,c);var h=this.rte.browser.msie?function(j){b.val=j;b.constructor.prototype.command.call(b)}:function(j){b.ieCommand(j)};
|
173
|
+
var b=this;var g={labelTpl:"%label",tpls:{"":"%label"},select:function(j){b.formatBlock(j)},src:{span:this.rte.i18n("Format"),h1:this.rte.i18n("Heading 1"),h2:this.rte.i18n("Heading 2"),h3:this.rte.i18n("Heading 3"),h4:this.rte.i18n("Heading 4"),h5:this.rte.i18n("Heading 5"),h6:this.rte.i18n("Heading 6"),p:this.rte.i18n("Paragraph"),address:this.rte.i18n("Address"),pre:this.rte.i18n("Preformatted"),div:this.rte.i18n("Normal (DIV)")}};this.select=this.domElem.elSelect(g);this.command=function(){};
|
174
|
+
this.formatBlock=function(u){function t(z,v){function x(A){a(A).find("h1,h2,h3,h4,h5,h6,p,address,pre").each(function(){a(this).replaceWith(a(this).html())});return A}if(/^(LI|DT|DD|TD|TH|CAPTION)$/.test(z.nodeName)){!b.rte.dom.isEmpty(z)&&b.rte.dom.wrapContents(x(z),v)}else{if(/^(UL|OL|DL|TABLE)$/.test(z.nodeName)){b.rte.dom.wrap(z,v)}else{!b.rte.dom.isEmpty(z)&&a(x(z)).replaceWith(a(b.rte.dom.create(v)).html(a(z).html()))}}}this.rte.history.add();var w=u.toUpperCase(),p,o,r,q=this.rte.selection.collapsed(),k=this.rte.selection.getBookmark(),j=this.rte.selection.selected({collapsed:true,blocks:true,filter:"textContainsNodes",wrap:"inline",tag:"span"});
|
175
|
+
l=j.length,s=a(j[0]).prev(),e=a(j[j.length-1]).next();while(l--){o=j[l];r=a(o);if(w=="DIV"||w=="SPAN"){if(/^(H[1-6]|P|ADDRESS|PRE)$/.test(o.nodeName)){r.replaceWith(a(this.rte.dom.create("div")).html(r.html()||""))}}else{if(/^(THEAD|TBODY|TFOOT|TR)$/.test(o.nodeName)){r.find("td,th").each(function(){t(this,w)})}else{if(o.nodeName!=w){t(o,w)}}}}this.rte.selection.moveToBookmark(k);this.rte.ui.update(true)};this.update=function(){this.domElem.removeClass("disabled");var j=this.rte.dom.selfOrParent(this.rte.selection.getNode(),/^(H[1-6]|P|ADDRESS|PRE)$/);
|
176
|
+
this.select.val(j?j.nodeName.toLowerCase():"span")}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.fullscreen=function(g,f){var b=this;this.constructor.prototype.constructor.call(this,g,f);this.active=true;this.editor=g.editor;this.wz=g.workzone;this.height=0;this.delta=0;this._class="el-fullscreen";setTimeout(function(){b.height=b.wz.height();b.delta=b.editor.outerHeight()-b.height},50);function c(){b.wz.height(a(window).height()-b.delta);b.rte.updateHeight()}this.command=function(){var B=a(window),u=this.editor,k=u.parents().filter(function(h,p){return !/^(html|body)$/i.test(p.nodeName)&&a(p).css("position")=="relative"
|
177
|
+
}),q=this.wz,z=this._class,t=u.hasClass(z),j=this.rte,C=this.rte.selection,o=a.browser.mozilla,A,r;function x(){if(o){A=C.getBookmark()}}function v(){if(o){b.wz.children().toggle();b.rte.source.focus();b.wz.children().toggle();C.moveToBookmark(A)}}x();k.css("position",t?"relative":"static");if(t){u.removeClass(z);q.height(this.height);B.unbind("resize",c);this.domElem.removeClass("active")}else{u.addClass(z).removeAttr("style");q.height(B.height()-this.delta).css("width","100%");B.bind("resize",c);
|
178
|
+
this.domElem.addClass("active")}j.updateHeight();j.resizable(t);v()};this.update=function(){this.domElem.removeClass("disabled")}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.horizontalrule=function(f,c){this.constructor.prototype.constructor.call(this,f,c);var b=this;this.src={width:a('<input type="text" />').attr({name:"width",size:4}).css("text-align","right"),wunit:a("<select />").attr("name","wunit").append(a("<option />").val("%").text("%")).append(a("<option />").val("px").text("px")).val("%"),height:a('<input type="text" />').attr({name:"height",size:4}).css("text-align","right"),bg:a("<div />"),border:a("<div />"),"class":a('<input type="text" />').css("width","100%"),style:a('<input type="text" />').css("width","100%")};
|
179
|
+
this.command=function(){this.src.bg.elColorPicker({palettePosition:"outer","class":"el-colorpicker ui-icon ui-icon-pencil"});var k=this.rte.selection.getEnd();this.hr=k.nodeName=="HR"?a(k):a(f.doc.createElement("hr")).css({width:"100%",height:"1px"});this.src.border.elBorderSelect({styleHeight:73,value:this.hr});var g=this.hr.css("width")||this.hr.attr("width");this.src.width.val(parseInt(g)||100);this.src.wunit.val(g.indexOf("px")!=-1?"px":"%");this.src.height.val(this.rte.utils.toPixels(this.hr.css("height")||this.hr.attr("height"))||1);
|
180
|
+
this.src.bg.val(this.rte.utils.color2Hex(this.hr.css("background-color")));this.src["class"].val(this.rte.dom.attr(this.hr,"class"));this.src.style.val(this.rte.dom.attr(this.hr,"style"));var h={rtl:this.rte.rtl,submit:function(o,p){o.stopPropagation();o.preventDefault();b.set();p.close()},dialog:{title:this.rte.i18n("Horizontal rule")}};var j=new elDialogForm(h);j.append([this.rte.i18n("Width"),a("<span />").append(this.src.width).append(this.src.wunit)],null,true).append([this.rte.i18n("Height"),a("<span />").append(this.src.height).append(" px")],null,true).append([this.rte.i18n("Border"),this.src.border],null,true).append([this.rte.i18n("Background"),this.src.bg],null,true).append([this.rte.i18n("Css class"),this.src["class"]],null,true).append([this.rte.i18n("Css style"),this.src.style],null,true).open()
|
181
|
+
};this.update=function(){this.domElem.removeClass("disabled");if(this.rte.selection.getEnd().nodeName=="HR"){this.domElem.addClass("active")}else{this.domElem.removeClass("active")}};this.set=function(){this.rte.history.add();!this.hr.parentNode&&this.rte.selection.insertNode(this.hr.get(0));var h={noshade:true,style:this.src.style.val()};var g=this.src.border.val();var j={width:(parseInt(this.src.width.val())||100)+this.src.wunit.val(),height:parseInt(this.src.height.val())||1,"background-color":this.src.bg.val(),border:g.width&&g.style?g.width+" "+g.style+" "+g.color:""};
|
182
|
+
this.hr.removeAttr("class").removeAttr("style").removeAttr("width").removeAttr("height").removeAttr("align").attr(h).css(j);if(this.src["class"].val()){this.hr.attr("class",this.src["class"].val())}this.rte.ui.update()}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.image=function(b,c){this.constructor.prototype.constructor.call(this,b,c);var q=this,b=q.rte,h=0,f=0,p=0,g=null,j=function(t){a.each(q.src,function(u,v){a.each(v,function(x,w){if(x=="src"&&t){return}w.val("")})})},o=function(t){a.each(q.src,function(u,v){a.each(v,function(E,B){var C,x,D,A,z;
|
183
|
+
if(E=="width"){C=t.width()}else{if(E=="height"){C=t.height()}else{if(E=="border"){C="";z=t.css("border")||b.utils.parseStyle(t.attr("style")).border||"";if(z){x=z.match(/(\d(px|em|%))/);D=z.match(/(#[a-z0-9]+)/);C={width:x?x[1]:z,style:z,color:b.utils.color2Hex(D?D[1]:z)}}}else{if(E=="margin"){C=t}else{if(E=="align"){C=t.css("float");if(C!="left"&&C!="right"){C=t.css("vertical-align")}}else{C=t.attr(E)||""}}}}}if(u=="events"){C=b.utils.trimEventCallback(C)}B.val(C)})})},k=function(){var t=q.src.main.src.val();
|
184
|
+
j(true);if(!t){q.preview.children("img").remove();q.prevImg=null}else{if(q.prevImg){q.prevImg.removeAttr("src").removeAttr("style").removeAttr("class").removeAttr("id").removeAttr("title").removeAttr("alt").removeAttr("longdesc");a.each(q.src.events,function(v,u){q.prevImg.removeAttr(v)})}else{q.prevImg=a("<img/>").prependTo(q.preview)}q.prevImg.load(function(){q.prevImg.unbind("load");setTimeout(function(){f=q.prevImg.width();p=q.prevImg.height();h=(f/p).toFixed(2);q.src.main.width.val(f);q.src.main.height.val(p)
|
185
|
+
},100)}).attr("src",t)}},r=function(v){var t=parseInt(q.src.main.width.val())||0,u=parseInt(q.src.main.height.val())||0;if(q.prevImg){if(t&&u){if(v.target===q.src.main.width[0]){u=parseInt(t/h)}else{t=parseInt(u*h)}}else{t=f;u=p}q.src.main.height.val(u);q.src.main.width.val(t);q.prevImg.width(t).height(u);q.src.adv.style.val(q.prevImg.attr("style"))}};this.img=null;this.prevImg=null;this.preview=a('<div class="elrte-image-preview"/>').text("Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin");
|
186
|
+
this.init=function(){this.labels={main:"Properies",link:"Link",adv:"Advanced",events:"Events",id:"ID","class":"Css class",style:"Css style",longdesc:"Detail description URL",href:"URL",target:"Open in",title:"Title"};this.src={main:{src:a('<input type="text" />').css("width","100%").change(k),title:a('<input type="text" />').css("width","100%"),alt:a('<input type="text" />').css("width","100%"),width:a('<input type="text" />').attr("size",5).css("text-align","right").change(r),height:a('<input type="text" />').attr("size",5).css("text-align","right").change(r),margin:a("<div />").elPaddingInput({type:"margin",change:function(){var t=q.src.main.margin.val();
|
187
|
+
if(q.prevImg){if(t.css){q.prevImg.css("margin",t.css)}else{q.prevImg.css({"margin-left":t.left,"margin-top":t.top,"margin-right":t.right,"margin-bottom":t.bottom})}}}}),align:a("<select />").css("width","100%").append(a("<option />").val("").text(this.rte.i18n("Not set","dialogs"))).append(a("<option />").val("left").text(this.rte.i18n("Left"))).append(a("<option />").val("right").text(this.rte.i18n("Right"))).append(a("<option />").val("top").text(this.rte.i18n("Top"))).append(a("<option />").val("text-top").text(this.rte.i18n("Text top"))).append(a("<option />").val("middle").text(this.rte.i18n("middle"))).append(a("<option />").val("baseline").text(this.rte.i18n("Baseline"))).append(a("<option />").val("bottom").text(this.rte.i18n("Bottom"))).append(a("<option />").val("text-bottom").text(this.rte.i18n("Text bottom"))).change(function(){var u=a(this).val(),t={"float":"","vertical-align":""};
|
188
|
+
if(q.prevImg){if(u=="left"||u=="right"){t["float"]=u;t["vertical-align"]=""}else{if(u){t["float"]="";t["vertical-align"]=u}}q.prevImg.css(t)}}),border:a("<div />").elBorderSelect({name:"border",change:function(){var t=q.src.main.border.val();if(q.prevImg){q.prevImg.css("border",t.width?t.width+" "+t.style+" "+t.color:"")}}})},adv:{},events:{}};a.each(["id","class","style","longdesc"],function(u,t){q.src.adv[t]=a('<input type="text" style="width:100%" />')});this.src.adv["class"].change(function(){if(q.prevImg){q.prevImg.attr("class",a(this).val())
|
189
|
+
}});this.src.adv.style.change(function(){if(q.prevImg){q.prevImg.attr("style",a(this).val());o(q.prevImg)}});a.each(["onblur","onfocus","onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmouseleave","onkeydown","onkeypress","onkeyup"],function(){q.src.events[this]=a('<input type="text" style="width:100%"/>')})};this.command=function(){!this.src&&this.init();var t,w={rtl:b.rtl,submit:function(z,A){z.stopPropagation();z.preventDefault();q.set();u.close()},close:function(){g&&b.selection.moveToBookmark(g)
|
190
|
+
},dialog:{autoOpen:false,width:500,position:"top",title:b.i18n("Image"),resizable:true,open:function(){a.fn.resizable&&a(this).parents(".ui-dialog:first").resizable("option","alsoResize",".elrte-image-preview")}}},u=new elDialogForm(w),v=!!b.options.fmOpen,x=v?a('<div class="elrte-image-src-fm"><span class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-folder-open"/></span></div>').append(this.src.main.src.css("width","87%")):this.src.main.src;j();this.preview.children("img").remove();
|
191
|
+
this.prevImg=null;t=b.selection.getEnd();this.img=t.nodeName=="IMG"&&!a(t).is(".elrte-protected")?a(t):a("<img/>");g=b.selection.getBookmark();if(v){x.children(".ui-state-default").click(function(){b.options.fmOpen(function(z){q.src.main.src.val(z).change()})}).hover(function(){a(this).toggleClass("ui-state-hover")})}u.tab("main",this.rte.i18n("Properies")).append([this.rte.i18n("Image URL"),x],"main",true).append([this.rte.i18n("Title"),this.src.main.title],"main",true).append([this.rte.i18n("Alt text"),this.src.main.alt],"main",true).append([this.rte.i18n("Size"),a("<span />").append(this.src.main.width).append(" x ").append(this.src.main.height).append(" px")],"main",true).append([this.rte.i18n("Alignment"),this.src.main.align],"main",true).append([this.rte.i18n("Margins"),this.src.main.margin],"main",true).append([this.rte.i18n("Border"),this.src.main.border],"main",true);
|
192
|
+
u.append(a("<fieldset><legend>"+this.rte.i18n("Preview")+"</legend></fieldset>").append(this.preview),"main");a.each(this.src,function(A,z){if(A=="main"){return}u.tab(A,b.i18n(q.labels[A]));a.each(z,function(B,C){q.src[A][B].val(A=="events"?b.utils.trimEventCallback(q.img.attr(B)):q.img.attr(B)||"");u.append([b.i18n(q.labels[B]||B),q.src[A][B]],A,true)})});u.open();if(this.img.attr("src")){o(this.img);this.prevImg=this.img.clone().prependTo(this.preview);h=(this.img.width()/this.img.height()).toFixed(2);
|
193
|
+
f=parseInt(this.img.width());p=parseInt(this.img.height())}};this.set=function(){var u=this.src.main.src.val(),t;this.rte.history.add();g&&b.selection.moveToBookmark(g);if(!u){t=b.dom.selfOrParentLink(this.img[0]);t&&t.remove();return this.img.remove()}!this.img[0].parentNode&&(this.img=a(this.rte.doc.createElement("img")));this.img.attr("src",u).attr("style",this.src.adv.style.val());a.each(this.src,function(v,w){a.each(w,function(x,A){var B=A.val(),z;switch(x){case"width":q.img.css("width",B);break;
|
194
|
+
case"height":q.img.css("height",B);break;case"align":q.img.css(B=="left"||B=="right"?"float":"vertical-align",B);break;case"margin":if(B.css){q.img.css("margin",B.css)}else{q.img.css({"margin-left":B.left,"margin-top":B.top,"margin-right":B.right,"margin-bottom":B.bottom})}break;case"border":if(!B.width){B=""}else{B="border:"+B.css+";"+a.trim((q.img.attr("style")||"").replace(/border\-[^;]+;?/ig,""));x="style";q.img.attr("style",B);return}break;case"src":case"style":return;default:B?q.img.attr(x,B):q.img.removeAttr(x)
|
195
|
+
}})});!this.img[0].parentNode&&b.selection.insertNode(this.img[0]);this.rte.ui.update()};this.update=function(){this.domElem.removeClass("disabled");var u=this.rte.selection.getEnd(),t=a(u);if(u.nodeName=="IMG"&&!t.hasClass("elrte-protected")){this.domElem.addClass("active")}else{this.domElem.removeClass("active")}}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.indent=function(f,c){this.constructor.prototype.constructor.call(this,f,c);var b=this;this.command=function(){this.rte.history.add();
|
196
|
+
var h=this.rte.selection.selected({collapsed:true,blocks:true,wrap:"inline",tag:"p"});function g(q){var o=/(IMG|HR|TABLE|EMBED|OBJECT)/.test(q.nodeName)?"margin-left":"padding-left";var p=b.rte.dom.attr(q,"style").indexOf(o)!=-1?parseInt(a(q).css(o))||0:0;a(q).css(o,p+40+"px")}for(var j=0;j<h.length;j++){if(/^(TABLE|THEAD|TFOOT|TBODY|COL|COLGROUP|TR)$/.test(h[j].nodeName)){a(h[j]).find("td,th").each(function(){g(this)})}else{if(/^LI$/.test(h[j].nodeName)){var k=a(h[j]);a(this.rte.dom.create(h[j].parentNode.nodeName)).append(a(this.rte.dom.create("li")).html(k.html()||"")).appendTo(k.html(" "))
|
197
|
+
}else{g(h[j])}}}this.rte.ui.update()};this.update=function(){this.domElem.removeClass("disabled")}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.justifyleft=function(c,b){this.constructor.prototype.constructor.call(this,c,b);this.align=this.name=="justifyfull"?"justify":this.name.replace("justify","");this.command=function(){var g=this.rte.selection.selected({collapsed:true,blocks:true,tag:"div"}),f=g.length;f&&this.rte.history.add();while(f--){this.rte.dom.filter(g[f],"textNodes")&&a(g[f]).css("text-align",this.align)
|
198
|
+
}this.rte.ui.update()};this.update=function(){var f=this.rte.selection.getNode(),g=f.nodeName=="BODY"?f:this.rte.dom.selfOrParent(f,"textNodes")||(f.parentNode&&f.parentNode.nodeName=="BODY"?f.parentNode:null);if(g){this.domElem.removeClass("disabled").toggleClass("active",a(g).css("text-align")==this.align)}else{this.domElem.addClass("disabled")}}};elRTE.prototype.ui.prototype.buttons.justifycenter=elRTE.prototype.ui.prototype.buttons.justifyleft;elRTE.prototype.ui.prototype.buttons.justifyright=elRTE.prototype.ui.prototype.buttons.justifyleft;
|
199
|
+
elRTE.prototype.ui.prototype.buttons.justifyfull=elRTE.prototype.ui.prototype.buttons.justifyleft})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.link=function(f,c){this.constructor.prototype.constructor.call(this,f,c);var b=this;this.img=false;this.bm;function g(){b.labels={id:"ID","class":"Css class",style:"Css style",dir:"Script direction",lang:"Language",charset:"Charset",type:"Target MIME type",rel:"Relationship page to target (rel)",rev:"Relationship target to page (rev)",tabindex:"Tab index",accesskey:"Access key"};
|
200
|
+
b.src={main:{href:a('<input type="text" />'),title:a('<input type="text" />'),anchor:a("<select />").attr("name","anchor"),target:a("<select />").append(a("<option />").text(b.rte.i18n("In this window")).val("")).append(a("<option />").text(b.rte.i18n("In new window (_blank)")).val("_blank"))},popup:{use:a('<input type="checkbox" />'),url:a('<input type="text" />').val("http://"),name:a('<input type="text" />'),width:a('<input type="text" />').attr({size:6,title:b.rte.i18n("Width")}).css("text-align","right"),height:a('<input type="text" />').attr({size:6,title:b.rte.i18n("Height")}).css("text-align","right"),left:a('<input type="text" />').attr({size:6,title:b.rte.i18n("Left")}).css("text-align","right"),top:a('<input type="text" />').attr({size:6,title:b.rte.i18n("Top")}).css("text-align","right"),location:a('<input type="checkbox" />'),menubar:a('<input type="checkbox" />'),toolbar:a('<input type="checkbox" />'),scrollbars:a('<input type="checkbox" />'),status:a('<input type="checkbox" />'),resizable:a('<input type="checkbox" />'),dependent:a('<input type="checkbox" />'),retfalse:a('<input type="checkbox" />').attr("checked",true)},adv:{id:a('<input type="text" />'),"class":a('<input type="text" />'),style:a('<input type="text" />'),dir:a("<select />").append(a("<option />").text(b.rte.i18n("Not set")).val("")).append(a("<option />").text(b.rte.i18n("Left to right")).val("ltr")).append(a("<option />").text(b.rte.i18n("Right to left")).val("rtl")),lang:a('<input type="text" />'),charset:a('<input type="text" />'),type:a('<input type="text" />'),rel:a('<input type="text" />'),rev:a('<input type="text" />'),tabindex:a('<input type="text" />'),accesskey:a('<input type="text" />')},events:{}};
|
201
|
+
a.each(["onblur","onfocus","onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmouseleave","onkeydown","onkeypress","onkeyup"],function(){b.src.events[this]=a('<input type="text" />')});a.each(b.src,function(){for(var j in this){var h=this[j].attr("type");if(!h||(h=="text"&&!this[j].attr("size"))){this[j].css("width","100%")}}})}this.command=function(){var p=this.rte.selection.getNode(),o,u,x,h,t,j,w,k,z;!this.src&&g();this.bm=this.rte.selection.getBookmark();function q(r){return r.nodeName=="A"&&r.href
|
202
|
+
}this.link=this.rte.dom.selfOrParentLink(p);if(!this.link){o=a.browser.msie?this.rte.selection.selected():this.rte.selection.selected({wrap:false});if(o.length){for(u=0;u<o.length;u++){if(q(o[u])){this.link=o[u];break}}if(!this.link){this.link=this.rte.dom.parent(o[0],q)||this.rte.dom.parent(o[o.length-1],q)}}}this.link=this.link?a(this.link):a(this.rte.doc.createElement("a"));this.img=p.nodeName=="IMG"?p:null;this.updatePopup();this.src.main.anchor.empty();a('a[href!=""][name]',this.rte.doc).each(function(){var r=a(this).attr("name");
|
203
|
+
b.src.main.anchor.append(a("<option />").val(r).text(r))});if(this.src.main.anchor.children().length){this.src.main.anchor.prepend(a("<option />").val("").text(this.rte.i18n("Select bookmark"))).change(function(){var r=a(this).val();if(r){b.src.main.href.val("#"+r)}})}h={rtl:this.rte.rtl,submit:function(r,v){r.stopPropagation();r.preventDefault();b.set();v.close()},tabs:{show:function(v,r){if(r.index==3){b.updateOnclick()}}},close:function(){b.rte.browser.msie&&b.rte.selection.restoreIERange()},dialog:{width:"auto",width:430,title:this.rte.i18n("Link")}};
|
204
|
+
d=new elDialogForm(h);t=a("<div />").append(a("<label />").append(this.src.popup.location).append(this.rte.i18n("Location bar"))).append(a("<label />").append(this.src.popup.menubar).append(this.rte.i18n("Menu bar"))).append(a("<label />").append(this.src.popup.toolbar).append(this.rte.i18n("Toolbar"))).append(a("<label />").append(this.src.popup.scrollbars).append(this.rte.i18n("Scrollbars")));j=a("<div />").append(a("<label />").append(this.src.popup.status).append(this.rte.i18n("Status bar"))).append(a("<label />").append(this.src.popup.resizable).append(this.rte.i18n("Resizable"))).append(a("<label />").append(this.src.popup.dependent).append(this.rte.i18n("Depedent"))).append(a("<label />").append(this.src.popup.retfalse).append(this.rte.i18n("Add return false")));
|
205
|
+
d.tab("main",this.rte.i18n("Properies")).tab("popup",this.rte.i18n("Popup")).tab("adv",this.rte.i18n("Advanced")).tab("events",this.rte.i18n("Events")).append(a("<label />").append(this.src.popup.use).append(this.rte.i18n("Open link in popup window")),"popup").separator("popup").append([this.rte.i18n("URL"),this.src.popup.url],"popup",true).append([this.rte.i18n("Window name"),this.src.popup.name],"popup",true).append([this.rte.i18n("Window size"),a("<span />").append(this.src.popup.width).append(" x ").append(this.src.popup.height).append(" px")],"popup",true).append([this.rte.i18n("Window position"),a("<span />").append(this.src.popup.left).append(" x ").append(this.src.popup.top).append(" px")],"popup",true).separator("popup").append([t,j],"popup",true);
|
206
|
+
w=this.link.get(0);k=this.rte.dom.attr(w,"href");this.src.main.href.val(k).change(function(){a(this).val(b.rte.utils.absoluteURL(a(this).val()))});if(this.rte.options.fmAllow&&this.rte.options.fmOpen){var z=a("<span />").append(this.src.main.href.css("width","87%")).append(a("<span />").addClass("ui-state-default ui-corner-all").css({"float":"right","margin-right":"3px"}).attr("title",b.rte.i18n("Open file manger")).append(a("<span />").addClass("ui-icon ui-icon-folder-open")).click(function(){b.rte.options.fmOpen(function(r){b.src.main.href.val(r).change()
|
207
|
+
})}).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}));d.append([this.rte.i18n("Link URL"),z],"main",true)}else{d.append([this.rte.i18n("Link URL"),this.src.main.href],"main",true)}this.src.main.href.change();d.append([this.rte.i18n("Title"),this.src.main.title.val(this.rte.dom.attr(w,"title"))],"main",true);if(this.src.main.anchor.children().length){d.append([this.rte.i18n("Bookmark"),this.src.main.anchor.val(k)],"main",true)}if(!(this.rte.options.doctype.match(/xhtml/)&&this.rte.options.doctype.match(/strict/))){d.append([this.rte.i18n("Target"),this.src.main.target.val(this.link.attr("target")||"")],"main",true)
|
208
|
+
}for(var p in this.src.adv){this.src.adv[p].val(this.rte.dom.attr(w,p));d.append([this.rte.i18n(this.labels[p]?this.labels[p]:p),this.src.adv[p]],"adv",true)}for(var p in this.src.events){var x=this.rte.utils.trimEventCallback(this.rte.dom.attr(w,p));this.src.events[p].val(x);d.append([this.rte.i18n(this.labels[p]?this.labels[p]:p),this.src.events[p]],"events",true)}this.src.popup.use.change(function(){var r=a(this).attr("checked");a.each(b.src.popup,function(){if(a(this).attr("name")!="use"){if(r){a(this).removeAttr("disabled")
|
209
|
+
}else{a(this).attr("disabled",true)}}})});this.src.popup.use.change();d.open()};this.update=function(){var h=this.rte.selection.getNode();if(this.rte.dom.selfOrParentLink(h)){this.domElem.removeClass("disabled").addClass("active")}else{if(this.rte.dom.selectionHas(function(j){return j.nodeName=="A"&&j.href})){this.domElem.removeClass("disabled").addClass("active")}else{if(!this.rte.selection.collapsed()||h.nodeName=="IMG"){this.domElem.removeClass("disabled active")}else{this.domElem.addClass("disabled").removeClass("active")
|
210
|
+
}}}};this.updatePopup=function(){var h=""+this.link.attr("onclick");if(h.length>0&&(m=h.match(/window.open\('([^']+)',\s*'([^']*)',\s*'([^']*)'\s*.*\);\s*(return\s+false)?/))){this.src.popup.use.attr("checked","on");this.src.popup.url.val(m[1]);this.src.popup.name.val(m[2]);if(/location=yes/.test(m[3])){this.src.popup.location.attr("checked",true)}if(/menubar=yes/.test(m[3])){this.src.popup.menubar.attr("checked",true)}if(/toolbar=yes/.test(m[3])){this.src.popup.toolbar.attr("checked",true)}if(/scrollbars=yes/.test(m[3])){this.src.popup.scrollbars.attr("checked",true)
|
211
|
+
}if(/status=yes/.test(m[3])){this.src.popup.status.attr("checked",true)}if(/resizable=yes/.test(m[3])){this.src.popup.resizable.attr("checked",true)}if(/dependent=yes/.test(m[3])){this.src.popup.dependent.attr("checked",true)}if((_m=m[3].match(/width=([^,]+)/))){this.src.popup.width.val(_m[1])}if((_m=m[3].match(/height=([^,]+)/))){this.src.popup.height.val(_m[1])}if((_m=m[3].match(/left=([^,]+)/))){this.src.popup.left.val(_m[1])}if((_m=m[3].match(/top=([^,]+)/))){this.src.popup.top.val(_m[1])}if(m[4]){this.src.popup.retfalse.attr("checked",true)
|
212
|
+
}}else{a.each(this.src.popup,function(){var j=a(this);if(j.attr("type")=="text"){j.val(j.attr("name")=="url"?"http://":"")}else{if(j.attr("name")=="retfalse"){this.attr("checked",true)}else{j.removeAttr("checked")}}})}};this.updateOnclick=function(){var o=this.src.popup.url.val();if(this.src.popup.use.attr("checked")&&o){var p="";if(this.src.popup.location.attr("checked")){p+="location=yes,"}if(this.src.popup.menubar.attr("checked")){p+="menubar=yes,"}if(this.src.popup.toolbar.attr("checked")){p+="toolbar=yes,"
|
213
|
+
}if(this.src.popup.scrollbars.attr("checked")){p+="scrollbars=yes,"}if(this.src.popup.status.attr("checked")){p+="status=yes,"}if(this.src.popup.resizable.attr("checked")){p+="resizable=yes,"}if(this.src.popup.dependent.attr("checked")){p+="dependent=yes,"}if(this.src.popup.width.val()){p+="width="+this.src.popup.width.val()+","}if(this.src.popup.height.val()){p+="height="+this.src.popup.height.val()+","}if(this.src.popup.left.val()){p+="left="+this.src.popup.left.val()+","}if(this.src.popup.top.val()){p+="top="+this.src.popup.top.val()+","
|
214
|
+
}if(p.length>0){p=p.substring(0,p.length-1)}var j=this.src.popup.retfalse.attr("checked")?"return false;":"";var k="window.open('"+o+"', '"+a.trim(this.src.popup.name.val())+"', '"+p+"'); "+j;this.src.events.onclick.val(k);if(!this.src.main.href.val()){this.src.main.href.val("#")}}else{var h=this.src.events.onclick.val();h=h.replace(/window\.open\([^\)]+\)\s*;?\s*return\s*false\s*;?/i,"");this.src.events.onclick.val(h)}};this.set=function(){var j,k;this.updateOnclick();this.rte.selection.moveToBookmark(this.bm);
|
215
|
+
this.rte.history.add();j=this.rte.utils.absoluteURL(this.src.main.href.val());if(!j){var p=this.rte.selection.getBookmark();this.rte.dom.unwrap(this.link[0]);this.rte.selection.moveToBookmark(p)}else{if(this.img&&this.img.parentNode){this.link=a(this.rte.dom.create("a")).attr("href",j);this.rte.dom.wrap(this.img,this.link[0])}else{if(!this.link[0].parentNode){k="#--el-editor---"+Math.random();this.rte.doc.execCommand("createLink",false,k);this.link=a('a[href="'+k+'"]',this.rte.doc);this.link.each(function(){var r=a(this);
|
216
|
+
if(!a.trim(r.html())&&!a.trim(r.text())){r.replaceWith(r.text())}})}}this.src.main.href.val(j);for(var o in this.src){if(o!="popup"){for(var q in this.src[o]){if(q!="anchors"){var h=a.trim(this.src[o][q].val());if(h){this.link.attr(q,h)}else{this.link.removeAttr(q)}}}}}this.img&&this.rte.selection.select(this.img)}this.rte.ui.update(true)}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.nbsp=function(c,b){this.constructor.prototype.constructor.call(this,c,b);this.command=function(){this.rte.history.add();
|
217
|
+
this.rte.selection.insertHtml(" ",true);this.rte.window.focus();this.rte.ui.update()};this.update=function(){this.domElem.removeClass("disabled")}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.outdent=function(f,c){this.constructor.prototype.constructor.call(this,f,c);var b=this;this.command=function(){var g=this.find();if(g.node){this.rte.history.add();a(g.node).css(g.type,(g.val>40?g.val-40:0)+"px");this.rte.ui.update()}};this.find=function(j){function g(p){var k={type:"",val:0};
|
218
|
+
var o;if((o=b.rte.dom.attr(p,"style"))){k.type=o.indexOf("padding-left")!=-1?"padding-left":(o.indexOf("margin-left")!=-1?"margin-left":"");k.val=k.type?parseInt(a(p).css(k.type))||0:0}return k}var j=this.rte.selection.getNode();var h=g(j);if(h.val){h.node=j}else{a.each(this.rte.dom.parents(j,"*"),function(){h=g(this);if(h.val){h.node=this;return h}})}return h};this.update=function(){var g=this.find();if(g.node){this.domElem.removeClass("disabled")}else{this.domElem.addClass("disabled")}}}})(jQuery);
|
219
|
+
(function(a){elRTE.prototype.ui.prototype.buttons.pagebreak=function(c,b){this.constructor.prototype.constructor.call(this,c,b);a(this.rte.doc.body).bind("mousedown",function(f){if(a(f.target).hasClass("elrte-pagebreak")){f.preventDefault()}});this.command=function(){this.rte.selection.insertHtml('<img src="'+this.rte.filter.url+'pixel.gif" class="elrte-protected elrte-pagebreak"/>',false)};this.update=function(){this.domElem.removeClass("disabled")}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.pasteformattext=function(f,c){this.constructor.prototype.constructor.call(this,f,c);
|
220
|
+
this.iframe=a(document.createElement("iframe")).addClass("el-rte-paste-input");this.doc=null;var b=this;this.command=function(){this.rte.selection.saveIERange();var g=this,h={submit:function(o,p){o.stopPropagation();o.preventDefault();g.paste();p.close()},dialog:{width:500,title:this.rte.i18n("Paste formatted text")}},k=new elDialogForm(h);k.append(this.iframe).open();this.doc=this.iframe.get(0).contentWindow.document;html=this.rte.options.doctype+'<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
|
221
|
+
html+="</head><body> <br /> </body></html>";this.doc.open();this.doc.write(html);this.doc.close();if(!this.rte.browser.msie){try{this.doc.designMode="on"}catch(j){}}else{this.doc.body.contentEditable=true}setTimeout(function(){g.iframe[0].contentWindow.focus()},50)};this.paste=function(){a(this.doc.body).find("[class]").removeAttr("class");var g=a.trim(a(this.doc.body).html());if(g){this.rte.history.add();this.rte.selection.restoreIERange();this.rte.selection.insertHtml(this.rte.filter.wysiwyg2wysiwyg(this.rte.filter.proccess("paste",g)));
|
222
|
+
this.rte.ui.update(true)}};this.update=function(){this.domElem.removeClass("disabled")}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.pastetext=function(f,c){this.constructor.prototype.constructor.call(this,f,c);this.input=a("<textarea />").addClass("el-rte-paste-input");var b=this;this.command=function(){this.rte.browser.msie&&this.rte.selection.saveIERange();var g={submit:function(j,k){j.stopPropagation();j.preventDefault();b.paste();k.close()},dialog:{width:500,title:this.rte.i18n("Paste only text")}};
|
223
|
+
var h=new elDialogForm(g);h.append(this.input).open()};this.paste=function(){var g=a.trim(this.input.val());if(g){this.rte.history.add();this.rte.browser.msie&&this.rte.selection.restoreIERange();this.rte.selection.insertText(g.replace(/\r?\n/g,"<br />"),true);this.rte.ui.update(true)}this.input.val("")};this.update=function(){this.domElem.removeClass("disabled")}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.save=function(c,b){this.constructor.prototype.constructor.call(this,c,b);
|
224
|
+
this.active=true;this.command=function(){this.rte.save()};this.update=function(){}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.smiley=function(f,c){this.constructor.prototype.constructor.call(this,f,c);var b=this;this.img=null;this.url=this.rte.filter.url+"smileys/";this.smileys={smile:"smile.png",happy:"happy.png",tongue:"tongue.png",surprised:"surprised.png",waii:"waii.png",wink:"wink.png",evilgrin:"evilgrin.png",grin:"grin.png",unhappy:"unhappy.png"};this.width=120;this.command=function(){var h=this,j=this.url,o,k,g;
|
225
|
+
this.rte.browser.msie&&this.rte.selection.saveIERange();k={dialog:{height:120,width:this.width,title:this.rte.i18n("Smiley"),buttons:{}}};o=new elDialogForm(k);a.each(this.smileys,function(q,p){o.append(a('<img src="'+j+p+'" title="'+q+'" id="'+q+'" class="el-rte-smiley"/>').click(function(){h.set(this.id,o)}))});o.open()};this.update=function(){this.domElem.removeClass("disabled");this.domElem.removeClass("active")};this.set=function(g,h){this.rte.browser.msie&&this.rte.selection.restoreIERange();
|
226
|
+
if(this.smileys[g]){this.img=a(this.rte.doc.createElement("img"));this.img.attr({src:this.url+this.smileys[g],title:g,alt:g});this.rte.selection.insertNode(this.img.get(0));this.rte.ui.update()}h.close()}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.stopfloat=function(c,b){this.constructor.prototype.constructor.call(this,c,b);this.find=function(){if(this.rte.selection.collapsed()){var f=this.rte.dom.selfOrParent(this.rte.selection.getEnd(),/^DIV$/);if(f&&(this.rte.dom.attr(f,"clear")||a(f).css("clear")!="none")){return f
|
227
|
+
}}};this.command=function(){var f;if((f=this.find())){var f=a(f);this.rte.history.add();if(!f.children().length&&!a.trim(f.text()).length){f.remove()}else{f.removeAttr("clear").css("clear","")}}else{this.rte.history.add();this.rte.selection.insertNode(a(this.rte.dom.create("div")).css("clear","both").get(0),true)}this.rte.ui.update(true)};this.update=function(){this.domElem.removeClass("disabled");if(this.find()){this.domElem.addClass("active")}else{this.domElem.removeClass("active")}}}})(jQuery);
|
228
|
+
(function(a){elRTE.prototype.ui.prototype.buttons.table=function(f,c){this.constructor.prototype.constructor.call(this,f,c);var b=this;this.src=null;this.labels=null;function g(){b.labels={main:"Properies",adv:"Advanced",events:"Events",id:"ID","class":"Css class",style:"Css style",dir:"Script direction",summary:"Summary",lang:"Language",href:"URL"};b.src={main:{caption:a('<input type="text" />'),rows:a('<input type="text" />').attr("size",5).val(2),cols:a('<input type="text" />').attr("size",5).val(2),width:a('<input type="text" />').attr("size",5),wunit:a("<select />").append(a("<option />").val("%").text("%")).append(a("<option />").val("px").text("px")),height:a('<input type="text" />').attr("size",5),hunit:a("<select />").append(a("<option />").val("%").text("%")).append(a("<option />").val("px").text("px")),align:a("<select />").append(a("<option />").val("").text(b.rte.i18n("Not set"))).append(a("<option />").val("left").text(b.rte.i18n("Left"))).append(a("<option />").val("center").text(b.rte.i18n("Center"))).append(a("<option />").val("right").text(b.rte.i18n("Right"))),spacing:a('<input type="text" />').attr("size",5),padding:a('<input type="text" />').attr("size",5),border:a("<div />"),rules:a("<select />").append(a("<option />").val("none").text(b.rte.i18n("No"))).append(a("<option />").val("all").text(b.rte.i18n("Cells"))).append(a("<option />").val("groups").text(b.rte.i18n("Groups"))).append(a("<option />").val("rows").text(b.rte.i18n("Rows"))).append(a("<option />").val("cols").text(b.rte.i18n("Columns"))),margin:a("<div />"),bg:a("<div />"),bgimg:a('<input type="text" />').css("width","90%")},adv:{id:a('<input type="text" />'),summary:a('<input type="text" />'),"class":a('<input type="text" />'),style:a('<input type="text" />'),dir:a("<select />").append(a("<option />").text(b.rte.i18n("Not set")).val("")).append(a("<option />").text(b.rte.i18n("Left to right")).val("ltr")).append(a("<option />").text(b.rte.i18n("Right to left")).val("rtl")),lang:a('<input type="text" />')},events:{}};
|
229
|
+
a.each(b.src,function(){for(var j in this){this[j].attr("name",j);var h=this[j].get(0).nodeName;if(h=="INPUT"&&j!="bgimg"){this[j].css(this[j].attr("size")?{"text-align":"right"}:{width:"100%"})}else{if(h=="SELECT"&&j!="wunit"&&j!="hunit"){this[j].css("width","100%")}}}});a.each(["onblur","onfocus","onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmouseleave","onkeydown","onkeypress","onkeyup"],function(){b.src.events[this]=a('<input type="text" />').css("width","100%")
|
230
|
+
});b.src.main.align.change(function(){var j=a(this).val();if(j=="center"){b.src.main.margin.val({left:"auto",right:"auto"})}else{var h=b.src.main.margin.val();if(h.left=="auto"&&h.right=="auto"){b.src.main.margin.val({left:"",right:""})}}});b.src.main.bgimg.change(function(){var h=a(this);h.val(b.rte.utils.absoluteURL(h.val()))})}this.command=function(){var r=this.rte.dom.selfOrParent(this.rte.selection.getNode(),/^TABLE$/);if(this.name=="table"){this.table=a(this.rte.doc.createElement("table"))}else{this.table=r?a(r):a(this.rte.doc.createElement("table"))
|
231
|
+
}!this.src&&g();this.src.main.border.elBorderSelect({styleHeight:117});this.src.main.bg.elColorPicker({palettePosition:"outer","class":"el-colorpicker ui-icon ui-icon-pencil"});this.src.main.margin.elPaddingInput({type:"margin",value:this.table});if(this.table.parents().length){this.src.main.rows.val("").attr("disabled",true);this.src.main.cols.val("").attr("disabled",true)}else{this.src.main.rows.val(2).removeAttr("disabled");this.src.main.cols.val(2).removeAttr("disabled")}var D=this.table.css("width")||this.table.attr("width");
|
232
|
+
this.src.main.width.val(parseInt(D)||"");this.src.main.wunit.val(D.indexOf("px")!=-1?"px":"%");var z=this.table.css("height")||this.table.attr("height");this.src.main.height.val(parseInt(z)||"");this.src.main.hunit.val(z&&z.indexOf("px")!=-1?"px":"%");var B=this.table.css("float");this.src.main.align.val("");if(B=="left"||B=="right"){this.src.main.align.val(B)}else{var t=this.table.css("margin-left");var p=this.table.css("margin-right");if(t=="auto"&&p=="auto"){this.src.main.align.val("center")}}this.src.main.border.val(this.table);
|
233
|
+
this.src.main.rules.val(this.rte.dom.attr(this.table.get(0),"rules"));this.src.main.bg.val(this.table.css("background-color"));var j=(this.table.css("background-image")||"").replace(/url\(([^\)]+)\)/i,"$1");this.src.main.bgimg.val(j!="none"?j:"");var k={rtl:this.rte.rtl,submit:function(h,v){h.stopPropagation();h.preventDefault();b.set();v.close()},dialog:{width:530,title:this.rte.i18n("Table")}};var C=new elDialogForm(k);for(var q in this.src){C.tab(q,this.rte.i18n(this.labels[q]));if(q=="main"){var A=a("<table />").append(a("<tr />").append("<td>"+this.rte.i18n("Rows")+"</td>").append(a("<td />").append(this.src.main.rows))).append(a("<tr />").append("<td>"+this.rte.i18n("Columns")+"</td>").append(a("<td />").append(this.src.main.cols)));
|
234
|
+
var x=a("<table />").append(a("<tr />").append("<td>"+this.rte.i18n("Width")+"</td>").append(a("<td />").append(this.src.main.width).append(this.src.main.wunit))).append(a("<tr />").append("<td>"+this.rte.i18n("Height")+"</td>").append(a("<td />").append(this.src.main.height).append(this.src.main.hunit)));var u=a("<table />").append(a("<tr />").append("<td>"+this.rte.i18n("Spacing")+"</td>").append(a("<td />").append(this.src.main.spacing.val(this.table.attr("cellspacing")||"")))).append(a("<tr />").append("<td>"+this.rte.i18n("Padding")+"</td>").append(a("<td />").append(this.src.main.padding.val(this.table.attr("cellpadding")||""))));
|
235
|
+
C.append([this.rte.i18n("Caption"),this.src.main.caption.val(this.table.find("caption").eq(0).text()||"")],"main",true).separator("main").append([A,x,u],"main",true).separator("main").append([this.rte.i18n("Border"),this.src.main.border],"main",true).append([this.rte.i18n("Inner borders"),this.src.main.rules],"main",true).append([this.rte.i18n("Alignment"),this.src.main.align],"main",true).append([this.rte.i18n("Margins"),this.src.main.margin],"main",true).append([this.rte.i18n("Background"),a("<span />").append(a("<span />").css({"float":"left","margin-right":"3px"}).append(this.src.main.bg)).append(this.src.main.bgimg)],"main",true)
|
236
|
+
}else{for(var o in this.src[q]){var E=this.rte.dom.attr(this.table,o);if(q=="events"){E=this.rte.utils.trimEventCallback(E)}C.append([this.rte.i18n(this.labels[o]?this.labels[o]:o),this.src[q][o].val(E)],q,true)}}}C.open()};this.set=function(){if(!this.table.parents().length){var k=parseInt(this.src.main.rows.val())||0;var B=parseInt(this.src.main.cols.val())||0;if(k<=0||B<=0){return}this.rte.history.add();var D=a(this.rte.doc.createElement("tbody")).appendTo(this.table);for(var u=0;u<k;u++){var C="<tr>";
|
237
|
+
for(var t=0;t<B;t++){C+="<td> </td>"}D.append(C+"</tr>")}}else{this.table.removeAttr("width").removeAttr("height").removeAttr("border").removeAttr("align").removeAttr("bordercolor").removeAttr("bgcolor").removeAttr("cellspacing").removeAttr("cellpadding").removeAttr("frame").removeAttr("rules").removeAttr("style")}var I=a.trim(this.src.main.caption.val());if(I){if(!this.table.children("caption").length){this.table.prepend("<caption />")}this.table.children("caption").text(I)}else{this.table.children("caption").remove()
|
238
|
+
}for(var p in this.src){if(p!="main"){for(var o in this.src[p]){var G=a.trim(this.src[p][o].val());if(G){this.table.attr(o,G)}else{this.table.removeAttr(o)}}}}var A,E,H;if((A=parseInt(this.src.main.spacing.val()))&&A>=0){this.table.attr("cellspacing",A)}if((E=parseInt(this.src.main.padding.val()))&&E>=0){this.table.attr("cellpadding",E)}if((H=this.src.main.rules.val())){this.table.attr("rules",H)}var F=parseInt(this.src.main.width.val())||"",x=parseInt(this.src.main.height.val())||"",u=a.trim(this.src.main.bgimg.val()),D=this.src.main.border.val(),q=this.src.main.margin.val(),z=this.src.main.align.val();
|
239
|
+
this.table.css({width:F?F+this.src.main.wunit.val():"",height:x?x+this.src.main.hunit.val():"",border:a.trim(D.width+" "+D.style+" "+D.color),"background-color":this.src.main.bg.val(),"background-image":u?"url("+u+")":""});if(q.css){this.table.css("margin",q.css)}else{this.table.css({"margin-top":q.top,"margin-right":q.right,"margin-bottom":q.bottom,"margin-left":q.left})}if((z=="left"||z=="right")&&this.table.css("margin-left")!="auto"&&this.table.css("margin-right")!="auto"){this.table.css("float",z)
|
240
|
+
}if(!this.table.attr("style")){this.table.removeAttr("style")}if(!this.table.parents().length){this.rte.selection.insertNode(this.table.get(0),true)}this.rte.ui.update()};this.update=function(){this.domElem.removeClass("disabled");if(this.name=="tableprops"&&!this.rte.dom.selfOrParent(this.rte.selection.getNode(),/^TABLE$/)){this.domElem.addClass("disabled").removeClass("active")}}};elRTE.prototype.ui.prototype.buttons.tableprops=elRTE.prototype.ui.prototype.buttons.table})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.tablerm=function(c,b){this.constructor.prototype.constructor.call(this,c,b);
|
241
|
+
this.command=function(){var f=this.rte.dom.parent(this.rte.selection.getNode(),/^TABLE$/);if(f){this.rte.history.add();a(f).remove()}this.rte.ui.update(true)};this.update=function(){if(this.rte.dom.parent(this.rte.selection.getNode(),/^TABLE$/)){this.domElem.removeClass("disabled")}else{this.domElem.addClass("disabled")}}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.tbcellprops=function(f,c){this.constructor.prototype.constructor.call(this,f,c);var b=this;this.src=null;this.labels=null;
|
242
|
+
function g(){b.labels={main:"Properies",adv:"Advanced",events:"Events",id:"ID","class":"Css class",style:"Css style",dir:"Script direction",lang:"Language"};b.src={main:{type:a("<select />").css("width","100%").append(a("<option />").val("td").text(b.rte.i18n("Data"))).append(a("<option />").val("th").text(b.rte.i18n("Header"))),width:a('<input type="text" />').attr("size",4),wunit:a("<select />").append(a("<option />").val("%").text("%")).append(a("<option />").val("px").text("px")),height:a('<input type="text" />').attr("size",4),hunit:a("<select />").append(a("<option />").val("%").text("%")).append(a("<option />").val("px").text("px")),align:a("<select />").css("width","100%").append(a("<option />").val("").text(b.rte.i18n("Not set"))).append(a("<option />").val("left").text(b.rte.i18n("Left"))).append(a("<option />").val("center").text(b.rte.i18n("Center"))).append(a("<option />").val("right").text(b.rte.i18n("Right"))).append(a("<option />").val("justify").text(b.rte.i18n("Justify"))),border:a("<div />"),padding:a("<div />"),bg:a("<div />"),bgimg:a('<input type="text" />').css("width","90%"),apply:a("<select />").css("width","100%").append(a("<option />").val("").text(b.rte.i18n("Current cell"))).append(a("<option />").val("row").text(b.rte.i18n("All cells in row"))).append(a("<option />").val("column").text(b.rte.i18n("All cells in column"))).append(a("<option />").val("table").text(b.rte.i18n("All cells in table")))},adv:{id:a('<input type="text" />'),"class":a('<input type="text" />'),style:a('<input type="text" />'),dir:a("<select />").css("width","100%").append(a("<option />").text(b.rte.i18n("Not set")).val("")).append(a("<option />").text(b.rte.i18n("Left to right")).val("ltr")).append(a("<option />").text(b.rte.i18n("Right to left")).val("rtl")),lang:a('<input type="text" />')},events:{}};
|
243
|
+
a.each(b.src,function(){for(var h in this){this[h].attr("name",h);if(this[h].attr("type")=="text"&&!this[h].attr("size")&&h!="bgimg"){this[h].css("width","100%")}}});a.each(["onblur","onfocus","onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmouseleave","onkeydown","onkeypress","onkeyup"],function(){b.src.events[this]=a('<input type="text" />').css("width","100%")})}this.command=function(){!this.src&&g();this.cell=this.rte.dom.selfOrParent(this.rte.selection.getNode(),/^(TD|TH)$/);
|
244
|
+
if(!this.cell){return}this.src.main.type.val(this.cell.nodeName.toLowerCase());this.cell=a(this.cell);this.src.main.border.elBorderSelect({styleHeight:117,value:this.cell});this.src.main.bg.elColorPicker({palettePosition:"outer","class":"el-colorpicker ui-icon ui-icon-pencil"});this.src.main.padding.elPaddingInput({value:this.cell});var j=this.cell.css("width")||this.cell.attr("width");this.src.main.width.val(parseInt(j)||"");this.src.main.wunit.val(j.indexOf("px")!=-1?"px":"%");var q=this.cell.css("height")||this.cell.attr("height");
|
245
|
+
this.src.main.height.val(parseInt(q)||"");this.src.main.hunit.val(q.indexOf("px")!=-1?"px":"%");this.src.main.align.val(this.cell.attr("align")||this.cell.css("text-align"));this.src.main.bg.val(this.cell.css("background-color"));var t=this.cell.css("background-image");this.src.main.bgimg.val(t&&t!="none"?t.replace(/url\(([^\)]+)\)/i,"$1"):"");this.src.main.apply.val("");var r={rtl:this.rte.rtl,submit:function(h,v){h.stopPropagation();h.preventDefault();b.set();v.close()},dialog:{width:520,title:this.rte.i18n("Table cell properties")}};
|
246
|
+
var u=new elDialogForm(r);for(var p in this.src){u.tab(p,this.rte.i18n(this.labels[p]));if(p=="main"){u.append([this.rte.i18n("Width"),a("<span />").append(this.src.main.width).append(this.src.main.wunit)],"main",true).append([this.rte.i18n("Height"),a("<span />").append(this.src.main.height).append(this.src.main.hunit)],"main",true).append([this.rte.i18n("Table cell type"),this.src.main.type],"main",true).append([this.rte.i18n("Border"),this.src.main.border],"main",true).append([this.rte.i18n("Alignment"),this.src.main.align],"main",true).append([this.rte.i18n("Paddings"),this.src.main.padding],"main",true).append([this.rte.i18n("Background"),a("<span />").append(a("<span />").css({"float":"left","margin-right":"3px"}).append(this.src.main.bg)).append(this.src.main.bgimg)],"main",true).append([this.rte.i18n("Apply to"),this.src.main.apply],"main",true)
|
247
|
+
}else{for(var o in this.src[p]){var k=this.cell.attr(o)||"";if(p=="events"){k=this.rte.utils.trimEventCallback(k)}u.append([this.rte.i18n(this.labels[o]?this.labels[o]:o),this.src[p][o].val(k)],p,true)}}}u.open()};this.set=function(){var x=this.cell,B=this.src.main.apply.val();switch(this.src.main.apply.val()){case"row":x=this.cell.parent("tr").children("td,th");break;case"column":x=a(this.rte.dom.tableColumn(this.cell.get(0)));break;case"table":x=this.cell.parents("table").find("td,th");break}for(var o in this.src){if(o!="main"){for(var k in this.src[o]){var C=a.trim(this.src[o][k].val());
|
248
|
+
if(C){x.attr(k,C)}else{x.removeAttr(k)}}}}x.removeAttr("width").removeAttr("height").removeAttr("border").removeAttr("align").removeAttr("bordercolor").removeAttr("bgcolor");var D=this.src.main.type.val();var A=parseInt(this.src.main.width.val())||"";var r=parseInt(this.src.main.height.val())||"";var q=a.trim(this.src.main.bgimg.val());var z=this.src.main.border.val();var u={width:A?A+this.src.main.wunit.val():"",height:r?r+this.src.main.hunit.val():"","background-color":this.src.main.bg.val(),"background-image":q?"url("+q+")":"",border:a.trim(z.width+" "+z.style+" "+z.color),"text-align":this.src.main.align.val()||""};
|
249
|
+
var j=this.src.main.padding.val();if(j.css){u.padding=j.css}else{u["padding-top"]=j.top;u["padding-right"]=j.right;u["padding-bottom"]=j.bottom;u["padding-left"]=j.left}x=x.get();a.each(x,function(){var w=this.nodeName.toLowerCase();var F=a(this);if(w!=D){var h={};for(var t in b.src.adv){var p=F.attr(t);if(p){h[t]=p.toString()}}for(var t in b.src.events){var p=F.attr(t);if(p){h[t]=p.toString()}}var G=F.attr("colspan")||1;var E=F.attr("rowspan")||1;if(G>1){h.colspan=G}if(E>1){h.rowspan=E}F.replaceWith(a("<"+D+" />").html(F.html()).attr(h).css(u))
|
250
|
+
}else{F.css(u)}});this.rte.ui.update()};this.update=function(){if(this.rte.dom.parent(this.rte.selection.getNode(),/^TABLE$/)){this.domElem.removeClass("disabled")}else{this.domElem.addClass("disabled")}}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.tbcellsmerge=function(g,f){this.constructor.prototype.constructor.call(this,g,f);var c=this;function b(){var j=c.rte.dom.selfOrParent(c.rte.selection.getStart(),/^(TD|TH)$/);var h=c.rte.dom.selfOrParent(c.rte.selection.getEnd(),/^(TD|TH)$/);
|
251
|
+
if(j&&h&&j!=h&&a(j).parents("table").get(0)==a(h).parents("table").get(0)){return[j,h]}return null}this.command=function(){var z=b();if(z){var x=this.rte.dom.indexOf(a(z[0]).parent("tr").get(0));var r=this.rte.dom.indexOf(a(z[1]).parent("tr").get(0));var q=Math.min(x,r);var u=Math.max(x,r)-q+1;var j=this.rte.dom.tableColumn(z[0],true,true);var h=this.rte.dom.tableColumn(z[1],true);var B=a.inArray(z[0],j.column);var w=a.inArray(z[1],h.column);var p=j.info.offset[B]<h.info.offset[w]?j:h;var v=j.info.offset[B]>=h.info.offset[w]?j:h;
|
252
|
+
var k=0;var t=null;var o="";this.rte.history.add();var A=a(a(z[0]).parents("table").eq(0).find("tr").get().slice(q,q+u)).each(function(E){var D=o.length;var C=false;a(this).children("td,th").each(function(){var K=a(this);var I=a.inArray(this,p.column);var H=a.inArray(this,v.column);if(I!=-1||H!=-1){C=I!=-1&&H==-1;var G=parseInt(K.attr("colspan")||1);if(E==0){k+=G}if(I!=-1&&E>0){var L=p.info.delta[I];if(L>0){if(K.css("text-align")=="left"){var F=K.clone(true);K.html(" ")}else{var F=K.clone().html(" ")
|
253
|
+
}F.removeAttr("colspan").removeAttr("id").insertBefore(this);if(L>1){F.attr("colspan",L)}}}if(H!=-1){var L=v.info.delta[H];if(G-L>1){var J=G-L-1;if(K.css("text-align")=="right"){var F=K.clone(true);K.html(" ")}else{var F=K.clone().html(" ")}F.removeAttr("colspan").removeAttr("id").insertAfter(this);if(J>1){F.attr("colspan",J)}}}if(!t){t=K}else{o+=K.html();K.remove()}}else{if(C){if(E==0){k+=parseInt(K.attr("colspan")||1)}o+=K.html();K.remove()}}});o+=D!=o.length?"<br />":""});t.removeAttr("colspan").removeAttr("rowspan").html(t.html()+o);
|
254
|
+
if(k>1){t.attr("colspan",k)}if(u>1){t.attr("rowspan",u)}this.rte.dom.fixTable(a(z[0]).parents("table").get(0))}};this.update=function(){if(b()){this.domElem.removeClass("disabled")}else{this.domElem.addClass("disabled")}}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.tbcellsplit=function(c,b){this.constructor.prototype.constructor.call(this,c,b);this.command=function(){var j=this.rte.dom.selfOrParent(this.rte.selection.getNode(),/^(TD|TH)$/);if(j){this.rte.history.add();var k=parseInt(this.rte.dom.attr(j,"colspan"));
|
255
|
+
var o=parseInt(this.rte.dom.attr(j,"rowspan"));if(k>1||o>1){var u=k-1;var v=o-1;var q=this.rte.dom.parent(j,/^TABLE$/);var p=this.rte.dom.tableMatrix(q);if(u){for(var t=0;t<u;t++){a(this.rte.dom.create(j.nodeName)).html(" ").insertAfter(j)}}if(v){var x=this.rte.dom.indexesOfCell(j,p);var h=x[0];var g=x[1];for(var f=h+1;f<h+v+1;f++){var w;if(!p[f][g].nodeName){if(p[f][g-1].nodeName){w=p[f][g-1]}else{for(var t=g-1;t>=0;t--){if(p[f][t].nodeName){w=p[f][t];break}}}if(w){for(var t=0;t<=u;t++){a(this.rte.dom.create(w.nodeName)).html(" ").insertAfter(w)
|
256
|
+
}}}}}a(j).removeAttr("colspan").removeAttr("rowspan");this.rte.dom.fixTable(q)}}this.rte.ui.update(true)};this.update=function(){var f=this.rte.dom.selfOrParent(this.rte.selection.getNode(),/^(TD|TH)$/);if(f&&(parseInt(this.rte.dom.attr(f,"colspan"))>1||parseInt(this.rte.dom.attr(f,"rowspan"))>1)){this.domElem.removeClass("disabled")}else{this.domElem.addClass("disabled")}}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.tbcolbefore=function(f,c){this.constructor.prototype.constructor.call(this,f,c);
|
257
|
+
var b=this;this.command=function(){var g=this;var h=this.rte.dom.tableColumn(this.rte.selection.getNode(),false,true);if(h.length){this.rte.history.add();a.each(h,function(){var k=a(this);var j=parseInt(k.attr("colspan")||1);if(j>1){k.attr("colspan",j+1)}else{var o=a(g.rte.dom.create(this.nodeName)).html(" ");if(g.name=="tbcolbefore"){o.insertBefore(this)}else{o.insertAfter(this)}}});this.rte.ui.update()}};this.update=function(){if(this.rte.dom.selfOrParent(this.rte.selection.getNode(),/^(TD|TH)$/)){this.domElem.removeClass("disabled")
|
258
|
+
}else{this.domElem.addClass("disabled")}}};elRTE.prototype.ui.prototype.buttons.tbcolafter=elRTE.prototype.ui.prototype.buttons.tbcolbefore})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.tbcolrm=function(f,c){this.constructor.prototype.constructor.call(this,f,c);var b=this;this.command=function(){var p=this.rte.selection.getNode();var o=this.rte.dom.selfOrParent(p,/^(TD|TH)$/);var k=a(o).prev("td,th").get(0);var j=a(o).next("td,th").get(0);var g=this.rte.dom.parent(p,/^TABLE$/);var h=this.rte.dom.tableColumn(p,false,true);
|
259
|
+
if(h.length){this.rte.history.add();a.each(h,function(){var r=a(this);var q=parseInt(r.attr("colspan")||1);if(q>1){r.attr("colspan",q-1)}else{r.remove()}});this.rte.dom.fixTable(g);if(k||j){this.rte.selection.selectContents(k?k:j).collapse(true)}this.rte.ui.update(true)}};this.update=function(){if(this.rte.dom.selfOrParent(this.rte.selection.getNode(),/^(TD|TH)$/)){this.domElem.removeClass("disabled")}else{this.domElem.addClass("disabled")}}}})(jQuery);elRTE.prototype.ui.prototype.buttons.tbrowbefore=function(b,a){this.constructor.prototype.constructor.call(this,b,a);
|
260
|
+
this.command=function(){var h=this.rte.selection.getNode();var t=this.rte.dom.selfOrParent(h,/^(TD|TH)$/);var f=this.rte.dom.selfOrParent(t,/^TR$/);var w=this.rte.dom.tableMatrix(this.rte.dom.selfOrParent(t,/^TABLE$/));if(t&&f&&w){this.rte.history.add();var u=this.name=="tbrowbefore";var q=$(f).prevAll("tr").length;var j=0;var p=[];function k(c,r){while(r>0){r--;if(w[r]&&w[r][c]&&w[r][c].nodeName){return w[r][c]}}}for(var o=0;o<w[q].length;o++){if(w[q][o]&&w[q][o].nodeName){var v=$(w[q][o]);var g=parseInt(v.attr("colspan")||1);
|
261
|
+
if(parseInt(v.attr("rowspan")||1)>1){if(u){j+=g}else{p.push(v)}}else{j+=g}}else{if(w[q][o]=="-"){v=k(o,q);v&&p.push($(v))}}}var x=$(this.rte.dom.create("tr"));for(var o=0;o<j;o++){x.append("<td> </td>")}if(u){x.insertBefore(f)}else{x.insertAfter(f)}$.each(p,function(){$(this).attr("rowspan",parseInt($(this).attr("rowspan")||1)+1)});this.rte.ui.update()}};this.update=function(){if(this.rte.dom.selfOrParent(this.rte.selection.getNode(),/^TR$/)){this.domElem.removeClass("disabled")}else{this.domElem.addClass("disabled")
|
262
|
+
}}};elRTE.prototype.ui.prototype.buttons.tbrowafter=elRTE.prototype.ui.prototype.buttons.tbrowbefore;(function(a){elRTE.prototype.ui.prototype.buttons.tbrowrm=function(f,c){this.constructor.prototype.constructor.call(this,f,c);var b=this;this.command=function(){var h=this.rte.selection.getNode(),x=this.rte.dom.selfOrParent(h,/^(TD|TH)$/),g=this.rte.dom.selfOrParent(x,/^TR$/),q=this.rte.dom.selfOrParent(x,/^TABLE$/),A=this.rte.dom.tableMatrix(q);if(x&&g&&A.length){this.rte.history.add();if(A.length==1){a(q).remove();
|
263
|
+
return this.rte.ui.update()}var u=[];var v=a(g).prevAll("tr").length;function p(r,C){while(C>0){C--;if(A[C]&&A[C][r]&&A[C][r].nodeName){return A[C][r]}}}function B(C,r){y=v+1;var E=null;if(A[y]){for(var D=0;D<r;D++){if(A[y][D]&&A[y][D].nodeName){E=A[y][D]}}C=C.remove();if(E){C.insertAfter(E)}else{C.prependTo(a(g).next("tr").eq(0))}}}function o(C){for(var r=0;r<C.length;r++){if(C[r]==x){return r<C.length-1?C[r+1]:C[r-1]}}}for(var t=0;t<A[v].length;t++){var z=null;var j=false;if(A[v][t]&&A[v][t].nodeName){z=A[v][t];
|
264
|
+
j=true}else{if(A[v][t]=="-"&&(z=p(t,v))){j=false}}if(z){z=a(z);var k=parseInt(z.attr("rowspan")||1);if(k>1){z.attr("rowspan",k-1);j&&B(z,t,v)}}}var w=o(this.rte.dom.tableColumn(x));if(w){this.rte.selection.selectContents(w).collapse(true)}a(g).remove()}this.rte.ui.update()};this.update=function(){if(this.rte.dom.selfOrParent(this.rte.selection.getNode(),/^TR$/)){this.domElem.removeClass("disabled")}else{this.domElem.addClass("disabled")}}}})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.undo=function(c,b){this.constructor.prototype.constructor.call(this,c,b);
|
265
|
+
this.command=function(){if(this.name=="undo"&&this.rte.history.canBack()){this.rte.history.back();this.rte.ui.update()}else{if(this.name=="redo"&&this.rte.history.canFwd()){this.rte.history.fwd();this.rte.ui.update()}}};this.update=function(){this.domElem.toggleClass("disabled",this.name=="undo"?!this.rte.history.canBack():!this.rte.history.canFwd())}};elRTE.prototype.ui.prototype.buttons.redo=elRTE.prototype.ui.prototype.buttons.undo})(jQuery);(function(a){elRTE.prototype.ui.prototype.buttons.unlink=function(c,b){this.constructor.prototype.constructor.call(this,c,b);
|
266
|
+
this.command=function(){var k=this.rte.selection.getNode(),f=this.rte.dom.selfOrParentLink(k);function j(o){return o.nodeName=="A"&&o.href}if(!f){var h=a.browser.msie?this.rte.selection.selected():this.rte.selection.selected({wrap:false});if(h.length){for(var g=0;g<h.length;g++){if(j(h[g])){f=h[g];break}}if(!f){f=this.rte.dom.parent(h[0],j)||this.rte.dom.parent(h[h.length-1],j)}}}if(f){this.rte.history.add();this.rte.selection.select(f);this.rte.doc.execCommand("unlink",false,null);this.rte.ui.update(true)
|
267
|
+
}};this.update=function(){var f=this.rte.selection.getNode();if(this.rte.dom.selfOrParentLink(f)){this.domElem.removeClass("disabled").addClass("active")}else{if(this.rte.dom.selectionHas(function(g){return g.nodeName=="A"&&g.href})){this.domElem.removeClass("disabled").addClass("active")}else{this.domElem.addClass("disabled").removeClass("active")}}}}})(jQuery);
|
@@ -0,0 +1,61 @@
|
|
1
|
+
(function($){
|
2
|
+
|
3
|
+
elRTE.prototype.ui.prototype.buttons.sofa_image = function(rte, name) {
|
4
|
+
this.constructor.prototype.constructor.call(this, rte, name);
|
5
|
+
|
6
|
+
var self = this;
|
7
|
+
self.img_src = null;
|
8
|
+
self.dialog = null;
|
9
|
+
|
10
|
+
// attaching event handler to the image insertion form
|
11
|
+
$(document).on('submit', '#cms_dialog form.image_url', function(){
|
12
|
+
self.img_src = $(this).find('input[name=image_url]').val();
|
13
|
+
self.set();
|
14
|
+
return false;
|
15
|
+
});
|
16
|
+
|
17
|
+
// attaching event handlers to images
|
18
|
+
$(document).on('click', '#cms_dialog .uploaded_files .file_info', function(){
|
19
|
+
self.img_src = $(this).data('url');
|
20
|
+
self.set();
|
21
|
+
return false;
|
22
|
+
});
|
23
|
+
|
24
|
+
this.set = function(){
|
25
|
+
self.rte.history.add();
|
26
|
+
var img = $(self.rte.doc.createElement('img'));
|
27
|
+
img.attr('src', self.img_src);
|
28
|
+
self.rte.selection.insertNode(img[0]);
|
29
|
+
self.rte.ui.update();
|
30
|
+
self.dialog.dialog('close');
|
31
|
+
}
|
32
|
+
|
33
|
+
this.command = function(){
|
34
|
+
self.dialog = jQuery(jQuery('#cms_dialog').get(0) || jQuery('<div id="cms_dialog"></div>'));
|
35
|
+
self.dialog.dialog({
|
36
|
+
title : rte.i18n('Image'),
|
37
|
+
modal : true,
|
38
|
+
resizable : false,
|
39
|
+
width : 800,
|
40
|
+
closeOnEscape : true,
|
41
|
+
autoOpen : false
|
42
|
+
});
|
43
|
+
|
44
|
+
jQuery.ajax({
|
45
|
+
url: '/' + $('meta[name="cms-admin-path"]').attr('content') + '/sites/' + $('meta[name="cms-site-id"]').attr('content') + '/dialog/image',
|
46
|
+
success: function(data){
|
47
|
+
self.dialog.html(data);
|
48
|
+
self.dialog.dialog('open');
|
49
|
+
$.CMS.enable_uploader();
|
50
|
+
}
|
51
|
+
})
|
52
|
+
}
|
53
|
+
|
54
|
+
this.update = function(){
|
55
|
+
this.domElem.removeClass('disabled');
|
56
|
+
}
|
57
|
+
}
|
58
|
+
elRTE.prototype.options.buttons.sofa_image = 'Image';
|
59
|
+
elRTE.prototype.options.panels.sofa_image = ['sofa_image'];
|
60
|
+
|
61
|
+
})(jQuery);
|