@@ -, +, @@
---
.../prog/en/js/elrte-1.1/css/elrte-inner.css | 95 +
.../prog/en/js/elrte-1.1/css/elrte.full.css | 524 ++
.../prog/en/js/elrte-1.1/images/elrte-toolbar.png | Bin 0 -> 28256 bytes
.../prog/en/js/elrte-1.1/images/google-maps.png | Bin 0 -> 2007 bytes
.../prog/en/js/elrte-1.1/images/loading.gif | Bin 0 -> 1279 bytes
.../prog/en/js/elrte-1.1/images/media-director.png | Bin 0 -> 2011 bytes
.../prog/en/js/elrte-1.1/images/media-flash.png | Bin 0 -> 2054 bytes
.../en/js/elrte-1.1/images/media-quicktime.png | Bin 0 -> 2639 bytes
.../en/js/elrte-1.1/images/media-realaudio.png | Bin 0 -> 1609 bytes
.../prog/en/js/elrte-1.1/images/media-rutube.png | Bin 0 -> 2442 bytes
.../prog/en/js/elrte-1.1/images/media-vimeo.png | Bin 0 -> 1501 bytes
.../prog/en/js/elrte-1.1/images/media-winmedia.png | Bin 0 -> 2449 bytes
.../prog/en/js/elrte-1.1/images/media-youtube.png | Bin 0 -> 1700 bytes
.../prog/en/js/elrte-1.1/images/pagebreak.gif | Bin 0 -> 54 bytes
.../prog/en/js/elrte-1.1/images/pixel.gif | Bin 0 -> 43 bytes
.../en/js/elrte-1.1/images/smileys/evilgrin.png | Bin 0 -> 797 bytes
.../prog/en/js/elrte-1.1/images/smileys/grin.png | Bin 0 -> 822 bytes
.../prog/en/js/elrte-1.1/images/smileys/happy.png | Bin 0 -> 824 bytes
.../prog/en/js/elrte-1.1/images/smileys/smile.png | Bin 0 -> 787 bytes
.../en/js/elrte-1.1/images/smileys/surprised.png | Bin 0 -> 780 bytes
.../prog/en/js/elrte-1.1/images/smileys/tongue.png | Bin 0 -> 820 bytes
.../en/js/elrte-1.1/images/smileys/unhappy.png | Bin 0 -> 778 bytes
.../prog/en/js/elrte-1.1/images/smileys/waii.png | Bin 0 -> 785 bytes
.../prog/en/js/elrte-1.1/images/smileys/wink.png | Bin 0 -> 801 bytes
.../prog/en/js/elrte-1.1/images/yandex-maps.png | Bin 0 -> 1667 bytes
.../prog/en/js/elrte-1.1/js/elrte.full.js | 8646 ++++++++++++++++++++
.../prog/en/js/elrte-1.1/js/elrte.min.js | 9 +
.../en/js/elrte-1.1/js/i18n/elrte.YOUR_LANG.js | 211 +
.../prog/en/js/elrte-1.1/js/i18n/elrte.ar.js | 195 +
.../prog/en/js/elrte-1.1/js/i18n/elrte.cs.js | 169 +
.../prog/en/js/elrte-1.1/js/i18n/elrte.de.js | 168 +
.../prog/en/js/elrte-1.1/js/i18n/elrte.es.js | 167 +
.../prog/en/js/elrte-1.1/js/i18n/elrte.fa.js | 168 +
.../prog/en/js/elrte-1.1/js/i18n/elrte.fr.js | 167 +
.../prog/en/js/elrte-1.1/js/i18n/elrte.hu.js | 201 +
.../prog/en/js/elrte-1.1/js/i18n/elrte.it.js | 167 +
.../prog/en/js/elrte-1.1/js/i18n/elrte.jp.js | 187 +
.../prog/en/js/elrte-1.1/js/i18n/elrte.lv.js | 179 +
.../prog/en/js/elrte-1.1/js/i18n/elrte.nl.js | 199 +
.../prog/en/js/elrte-1.1/js/i18n/elrte.pl.js | 168 +
.../prog/en/js/elrte-1.1/js/i18n/elrte.ru.js | 211 +
.../prog/en/js/elrte-1.1/js/i18n/elrte.ua.js | 201 +
.../prog/en/js/elrte-1.1/js/i18n/elrte.zh_TW.js | 167 +
.../prog/en/js/elrte-1.1/js/jquery-1.4.2.min.js | 154 +
.../js/elrte-1.1/js/jquery-ui-1.8.5.custom.min.js | 284 +
.../images/ui-bg_flat_0_aaaaaa_40x100.png | Bin 0 -> 180 bytes
.../images/ui-bg_flat_75_ffffff_40x100.png | Bin 0 -> 178 bytes
.../images/ui-bg_glass_55_fbf9ee_1x400.png | Bin 0 -> 120 bytes
.../images/ui-bg_glass_65_ffffff_1x400.png | Bin 0 -> 105 bytes
.../images/ui-bg_glass_75_dadada_1x400.png | Bin 0 -> 111 bytes
.../images/ui-bg_glass_75_e6e6e6_1x400.png | Bin 0 -> 110 bytes
.../images/ui-bg_glass_95_fef1ec_1x400.png | Bin 0 -> 119 bytes
.../ui-bg_highlight-soft_75_cccccc_1x100.png | Bin 0 -> 101 bytes
.../smoothness/images/ui-icons_222222_256x240.png | Bin 0 -> 4369 bytes
.../smoothness/images/ui-icons_2e83ff_256x240.png | Bin 0 -> 5355 bytes
.../smoothness/images/ui-icons_454545_256x240.png | Bin 0 -> 4369 bytes
.../smoothness/images/ui-icons_888888_256x240.png | Bin 0 -> 4369 bytes
.../smoothness/images/ui-icons_cd0a0a_256x240.png | Bin 0 -> 4369 bytes
.../smoothness/jquery-ui-1.8.5.custom.css | 362 +
59 files changed, 12999 insertions(+), 0 deletions(-)
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/css/elrte-inner.css
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/css/elrte.full.css
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/elrte-toolbar.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/google-maps.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/loading.gif
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/media-director.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/media-flash.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/media-quicktime.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/media-realaudio.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/media-rutube.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/media-vimeo.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/media-winmedia.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/media-youtube.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/pagebreak.gif
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/pixel.gif
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/smileys/evilgrin.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/smileys/grin.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/smileys/happy.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/smileys/smile.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/smileys/surprised.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/smileys/tongue.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/smileys/unhappy.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/smileys/waii.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/smileys/wink.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/images/yandex-maps.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/elrte.full.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/elrte.min.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.YOUR_LANG.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.ar.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.cs.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.de.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.es.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.fa.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.fr.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.hu.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.it.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.jp.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.lv.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.nl.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.pl.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.ru.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.ua.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/i18n/elrte.zh_TW.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/jquery-1.4.2.min.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/jquery-ui-1.8.5.custom.min.js
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/ui-themes/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/ui-themes/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/ui-themes/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/ui-themes/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/ui-themes/smoothness/images/ui-bg_glass_75_dadada_1x400.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/ui-themes/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/ui-themes/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/ui-themes/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/ui-themes/smoothness/images/ui-icons_222222_256x240.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/ui-themes/smoothness/images/ui-icons_2e83ff_256x240.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/ui-themes/smoothness/images/ui-icons_454545_256x240.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/ui-themes/smoothness/images/ui-icons_888888_256x240.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/ui-themes/smoothness/images/ui-icons_cd0a0a_256x240.png
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/ui-themes/smoothness/jquery-ui-1.8.5.custom.css
--- a/koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/css/elrte-inner.css
+++ a/koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/css/elrte-inner.css
@@ -0,0 +1,95 @@
+
+body.el-rte-rtl, body.el-rte-rtl * {
+ direction:rtl;
+}
+
+body.el-rte-structure table,
+body.el-rte-structure caption,
+body.el-rte-structure td,
+body.el-rte-structure th,
+body.el-rte-structure p,
+body.el-rte-structure div,
+body.el-rte-structure blockquote
+{ outline:1px dotted #99ccff; }
+
+body.el-rte-structure a[name] {
+ display:inline-block;
+ vertical-align:baseline;
+ width:12px;
+ height:12px;
+ border:1px dotted #ccc;
+ background: url('../images/elrte-toolbar.png') -564px -8px no-repeat;
+}
+img { cursor: default; }
+
+img.elrte-webkit-hl { outline:1px dashed #777; }
+
+.elrtebm {
+}
+
+.elrte-media-x-shockwave-flash,
+.elrte-media-quicktime,
+.elrte-media-x-director,
+.elrte-media-x-mplayer2,
+.elrte-media-x-pn-realaudio-plugin,
+.elrte-media-youtube,
+.elrte-media-rutube,
+.elrte-media-vimeo,
+.elrte-yandex-maps,
+.elrte-google-maps,
+.elrte-media {
+ border:1px solid #ccc;
+ background:#eee url(../images/media-flash.png) center center no-repeat;
+}
+.elrte-media-x-shockwave-flash {
+ background-image:url(../images/media-flash.png);
+}
+.elrte-media-youtube {
+ background-image:url(../images/media-youtube.png);
+}
+.elrte-media-vimeo {
+ background-image:url(../images/media-vimeo.png);
+}
+.elrte-media-rutube {
+ background-image:url(../images/media-rutube.png);
+}
+.elrte-media-quicktime {
+ background-image:url(../images/media-quicktime.png);
+}
+.elrte-media-x-director {
+ background-image:url(../images/media-director.png);
+}
+.elrte-media-x-mplayer2 {
+ background-image:url(../images/media-winmedia.png);
+}
+.elrte-media-x-pn-realaudio-plugin {
+ background-image:url(../images/media-realaudio.png);
+}
+.elrte-yandex-maps {
+ background-image:url(../images/yandex-maps.png);
+}
+.elrte-google-maps {
+ display: block;
+ background-image:url(../images/google-maps.png);
+}
+
+.elrte-pagebreak {
+
+ display:block;
+ clear:both;
+ width:100%;
+ height:7px;
+ outline:1px dotted #777;
+ outline-left:none;
+ outline-right:none;
+ background:transparent url(../images/pagebreak.gif) center center no-repeat;
+}
+
+.elrte-pagebreak:after {
+ content: ".";
+ display: block;
+ font-size:0;
+ height: 0;
+ clear: both;
+ visibility: hidden;
+}
--- a/koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/css/elrte.full.css
+++ a/koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/css/elrte.full.css
@@ -0,0 +1,524 @@
+/*!
+ * elRTE WYSIWYG HTML-editor
+ * Version 1.1 (2010-09-20)
+ * http://elrte.org
+ *
+ * Copyright 2010, Studio 42 Ltd.
+ * Licensed under a 3 clauses BSD license
+ */
+
+@charset "UTF-8";
+a { outline: none; }
+
+/************* clearfix **********************/
+
+.clearfix:after {
+ content: ".";
+ display: block;
+ font-size:0;
+ height: 0;
+ clear: both;
+ visibility: hidden;
+}
+
+.clearfix { display: block; }
+
+.rounded-2 { -moz-border-radius: 2px; -webkit-border-radius: 2px; border-radius: 2px; }
+.rounded-3 { -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; }
+.rounded-4 { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
+.rounded-5 { -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }
+.rounded-6 { -moz-border-radius: 6px; -webkit-border-radius: 5px; border-radius: 6px; }
+.rounded-7 { -moz-border-radius: 7px; -webkit-border-radius: 7px; border-radius: 7px; }
+.rounded-left-3 { -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; }
+.rounded-bottom-7 { -moz-border-radius-bottomleft:7px; -moz-border-radius-bottomright:7px; -webkit-border-bottom-left-radius: 7px;-webkit-border-bottom-right-radius: 7px; border-bottom-left-radius: 7px; border-bottom-right-radius: 7px;}
+
+
+.ui-widget { font-size:.9em;}
+.ui-dialog .ui-dialog-buttonpane button { padding: .1em .6em .2em .6em; }
+
+/* colorpicker "button" */
+.el-colorpicker {
+ width : 16px;
+ height : 16px;
+ border:1px solid #ccc;
+ position:relative;
+ cursor:default;
+}
+
+/* colors palette */
+.el-palette {
+ width: 182px;
+ border:1px solid #ccc;
+ background:#fff;
+ padding:3px 2px 3px 3px;
+ z-index:10000; /* fight with ui.dialog 0_o */
+ position:absolute;
+ top:16px;
+ left:0;
+}
+
+/* color cell in palette */
+.el-palette .color {
+ float:left;
+ width:14px;
+ height:14px;
+ line-height:1px;
+ border-top: 1px solid #eee;
+ border-left:1px solid #eee;
+}
+
+/* side below color cells */
+.el-palette .panel {
+ border-top:1px solid #ccc;
+ margin-top:7px;
+ padding:5px 3px 5px 3px;
+}
+
+/* "window" with selected color */
+.el-palette .panel .preview {
+ float:right;
+ width:18px;
+ height:18px;
+ border:1px solid #ccc;
+}
+
+/* color value text field */
+.el-palette .panel input {
+ border:1px solid #ccc;
+}
+/* dialog container */
+.ui-widget .el-dialogform {
+ padding:5px 3px;
+
+}
+
+.ui-widget .el-dialogform-rtl {
+ direction: rtl;
+}
+
+.ui-widget .el-dialogform-rtl .ui-tabs-nav li {
+ float:right;
+}
+
+.el-dialogform div.tab:hover { background:transparent; }
+.ui-dialog .ui-dialog-title, .ui-dialog .ui-dialog-content {
+ font-size:.9em;
+}
+
+/* tabs nav */
+.ui-tabs .ui-tabs-nav li a {
+ padding:.2em .7em;
+}
+
+/* tab container */
+.el-dialogform .tab {
+ padding:5px 0 12px 0;
+ border:none;
+}
+/* line separator */
+.el-dialogform .separator {
+ border-top:1px solid #ccc;
+ margin: 5px 2px;
+}
+
+/* table in dialog or in tab */
+.el-dialogform table {
+ width:100%;
+ border: none;
+}
+
+.el-dialogform table td {
+ padding: 2px;
+}
+
+.el-dialogform input, .el-dialogform textarea {
+ border:1px solid #ccc;
+}
+
+.el-dialogform select {
+ padding:0;
+/* font-size:11px;*/
+}
+
+.el-dialogform .spinner {
+ background:url(../images/loading.gif) 50% 50% no-repeat;
+ text-align:center;
+ width:150px;
+ height:50px;
+ margin:10px auto;
+ padding-top:33px;
+ font-weight:bold;
+}
+.el-dialogform-error {
+ background: #fee; color:#ff0000; border: 2px #844 solid; padding: 10px; margin-bottom: 1em 0;
+
+}
+.el-dialogform-message {
+ background: #efe; color: #040; border: 2px #484 solid; padding: 10px; margin-bottom: 1em 0;
+}
+
+
+.el-dialogform table td .el-borderselect table {
+ width:auto;
+}
+
+.el-dialogform table td .el-borderselect table td {
+ padding-left :0;
+ padding-right:2px;
+}
+.el-paddinginput {
+ display: block;
+ white-space: nowrap;
+}
+.el-paddinginput input {
+ margin :0 1px 0 0;
+ border:1px solid #ccc;
+}
+.el-paddinginput select {
+ padding:0;
+}/* container for elselect */
+.el-select {
+ height:17px;
+ width : 110px;
+ border:1px solid #ccc;
+ cursor: default;
+ position:relative;
+}
+.el-select.hover {
+ background-color:#eee;
+}
+
+/* selected element */
+.el-select label {
+ height:17px;
+ line-height:17px;
+/* font-size:.92em;*/
+ padding: 0 5px;
+ margin: 0 12px 0 0;
+ display:block;
+ white-space:nowrap;
+ overflow:hidden;
+ background: #fff;
+ border-right:1px solid #ccc;
+}
+/* drop-down list */
+.el-select .list {
+ border:1px solid #ccc;
+ display:block;
+ position:absolute;
+ overflow:auto;
+ background:#fff;
+ z-index:1000;
+/* height:1610px*/
+}
+/* drop-down list item */
+.el-select .list div {
+ position:relative;
+ padding:3px 25px 3px 7px;
+ border-bottom:1px solid #eee;
+}
+/* drop-down list item hovered */
+.el-select .list .hover {
+ background:#efefef;
+}
+/* drop-down list item selected */
+.el-select .list .active {
+ background-color:#c3dbef;
+}
+/* any elements in drop-down list item */
+.el-select .list div * {
+ padding:0;
+ margin:0;
+ border:none;
+ white-space:nowrap;
+ display:block;
+}
+
+/* контейнер */
+.el-rte {
+ font-family: Trebuchet MS, Verdana, Geneva,sans-serif;
+/* border:1px solid #aaa;*/
+}
+.el-rte.el-fullscreen {
+ position:absolute;
+ width:99%;
+/* height:100%;*/
+ top:0;
+ left:0;
+ margin:0;
+/* z-index:101;*/
+}
+
+.elrte-swf-placeholder {
+ width:1px;
+ background: url('../images/swf.png') 0 0 no-repeat;
+}
+
+/* style to detect images url */
+/*.el-rte */
+.elrtetesturl { color:red; background-image:url(../images/pixel.gif);}
+
+/* панель инструментов */
+.el-rte .toolbar { background-color:#eee; padding:3px 7px 2px 7px; border:1px solid #ccc; white-space:normal; display:inline-block;}
+
+.el-rte-rtl .toolbar { direction: rtl; }
+
+/* панель кнопок */
+.el-rte .toolbar ul {
+ position:relative;
+ display:inline-block;
+ display: -moz-inline-stack;
+ display: inline-block;
+ vertical-align: top;
+ zoom: 1;
+ *display: inline;
+ margin:0;
+ list-style:none;
+ padding:0 2px 0 5px;
+ background: url('../images/elrte-toolbar.png') -934px -2px no-repeat;
+}
+/* первая панель кнопок */
+.el-rte .toolbar ul.first {
+ background:transparent;
+ padding-left:0;
+}
+/* кнопка */
+.el-rte .toolbar ul li {
+ clear:none;
+ display:inline-block;
+ display: -moz-inline-stack;
+ display: inline-block;
+ height:22px;
+ width:22px;
+ vertical-align: top;
+ zoom: 1;
+ *display: inline;
+ margin:1px 1px;
+ padding:0; /* Joomla 1.6 compat */
+ background:url('../images/elrte-toolbar.png') no-repeat;
+ border:1px solid #ccc;
+}
+/* активная и подсвеченная и неактивная кнопка */
+.el-rte .toolbar ul li.hover { border:1px solid #54b9bf; }
+.el-rte .toolbar ul li.active { background-color:#c3dbef; border:1px solid #fff; }
+.el-rte .toolbar ul li.disabled { opacity:alpha(0.3); opacity: 0.3; filter:Alpha(Opacity=30);}
+/* кнопки */
+.el-rte .toolbar ul li.about {background-position:-829px -5px;}
+.el-rte .toolbar ul li.save {background-position:-30px -2px;}
+.el-rte .toolbar ul li.new {background-position:-55px -2px}
+.el-rte .toolbar ul li.copy {background-position:-78px -2px}
+.el-rte .toolbar ul li.css {background-position:-801px -5px}
+.el-rte .toolbar ul li.cut {background-position:-104px -2px}
+.el-rte .toolbar ul li.paste {background-position:-128px -2px}
+.el-rte .toolbar ul li.pastetext {background-position:-534px -2px}
+.el-rte .toolbar ul li.pasteformattext {background-position:-154px -2px}
+.el-rte .toolbar ul li.removeformat {background-position:-180px -2px}
+.el-rte .toolbar ul li.docstructure {background-position:-712px -4px}
+.el-rte .toolbar ul li.undo {background-position:-205px -2px}
+.el-rte .toolbar ul li.redo {background-position:-230px -2px}
+.el-rte .toolbar ul li.bold {background-position:-252px -2px; }
+.el-rte .toolbar ul li.italic {background-position:-270px -2px;}
+.el-rte .toolbar ul li.underline {background-position:-290px -2px; }
+.el-rte .toolbar ul li.strikethrough {background-position:-149px -29px}
+.el-rte .toolbar ul li.subscript {background-position:-54px -29px}
+.el-rte .toolbar ul li.superscript {background-position:-76px -29px}
+.el-rte .toolbar ul li.justifyleft {background-position:-311px -2px}
+.el-rte .toolbar ul li.justifycenter {background-position:-335px -2px}
+.el-rte .toolbar ul li.justifyright {background-position:-360px -2px}
+.el-rte .toolbar ul li.justifyfull {background-position:-174px -29px}
+.el-rte .toolbar ul li.insertunorderedlist {background-position:-100px -29px}
+.el-rte .toolbar ul li.insertorderedlist {background-position:-124px -29px}
+.el-rte .toolbar ul li.outdent {background-position:-6px -29px}
+.el-rte .toolbar ul li.indent {background-position:-32px -29px}
+.el-rte .toolbar ul li.blockquote {background-position:-220px -30px}
+.el-rte .toolbar ul li.div {background-position:-655px -29px}
+.el-rte .toolbar ul li.stopfloat {background-position:-771px -5px}
+.el-rte .toolbar ul li.nbsp {background-position:-580px -2px}
+.el-rte .toolbar ul li.forecolor {background-position:-372px -30px}
+.el-rte .toolbar ul li.hilitecolor {background-position:-395px -30px}
+.el-rte .toolbar ul li.link {background-position:-244px -29px}
+.el-rte .toolbar ul li.unlink {background-position:-270px -29px}
+.el-rte .toolbar ul li.anchor {background-position:-296px -30px}
+.el-rte .toolbar ul li.image {background-position:-384px -2px}
+.el-rte .toolbar ul li.flash {background-position:-410px -2px}
+.el-rte .toolbar ul li.file {background-position:-436px -3px}
+.el-rte .toolbar ul li.table {background-position:-421px -30px}
+.el-rte .toolbar ul li.tableprops {background-position:-602px -29px}
+.el-rte .toolbar ul li.tbcellprops {background-position:-806px -27px}
+.el-rte .toolbar ul li.tablerm {background-position:-461px -2px}
+.el-rte .toolbar ul li.tbrowbefore {background-position:-683px -4px}
+.el-rte .toolbar ul li.tbrowafter {background-position:-654px -4px}
+.el-rte .toolbar ul li.tbrowrm {background-position:-500px -30px}
+.el-rte .toolbar ul li.tbcolbefore {background-position:-741px -27px}
+.el-rte .toolbar ul li.tbcolafter {background-position:-772px -27px}
+.el-rte .toolbar ul li.tbcolrm {background-position:-526px -30px}
+.el-rte .toolbar ul li.tbcellsmerge {background-position:-552px -30px}
+.el-rte .toolbar ul li.tbcellsplit {background-position:-629px -29px}
+.el-rte .toolbar ul li.smiley {background-position:-322px -29px}
+.el-rte .toolbar ul li.spec-text {background-position:-487px -2px}
+.el-rte .toolbar ul li.print {background-position:-509px -2px}
+.el-rte .toolbar ul li.horizontalrule {background-position:-199px -29px}
+.el-rte .toolbar ul li.fullscreen {background-position:-348px -30px}
+.el-rte .toolbar ul li.elfinder {background-position:-436px -2px}
+.el-rte .toolbar ul li.ltr {background-position:-855px -27px}
+.el-rte .toolbar ul li.rtl {background-position:-855px -3px}
+.el-rte .toolbar ul li.pagebreak {background-position:-711px -28px}
+
+
+/* рабочая зона (обертка над iframe) */
+.el-rte .workzone { border:1px solid #eee; border-top:none; height:400px;}
+.el-rte.small .workzone { min-height:250px; }
+
+/* source code */
+.el-rte textarea { width:100%; height:100%; border:none; zoom:1; outline:none;}
+.el-rte.small textarea { min-height:250px;}
+/* редактор */
+.el-rte iframe {
+ width: 100%;
+ height:400px;
+
+ outline:none;
+ border:0 solid;
+ padding:0;
+ margin:0;
+ background:#fff;
+ z-index:100;
+}
+.el-rte.small iframe { min-height:250px;}
+
+/* панель статуса (путь) */
+.el-rte .statusbar {
+ height: 21px;
+ padding: 0 9px;
+ font: 11px/21px 'monaco', 'andale mono', 'lucida console', monospace;
+ background-color:#eee;
+ border-top:1px solid #ccc;
+ border-top:none;
+}
+
+.el-rte-rtl .statusbar {
+ direction:rtl;
+/* text-align:right;*/
+}
+
+/* табы */
+.el-rte .tabsbar { display: block; }
+.el-rte .tabsbar .tab {
+ float:left;
+ margin-right:2px;
+ padding: 6px 17px;
+ font-size: .82em;
+ font-weight:bold;
+ color:#777;
+ text-align:center;
+ border:1px solid #eee;
+ border-top:none;
+ background: #fff;
+ cursor: default;
+}
+.el-rte .tabsbar div.active { background: #eee; color:#444; }
+.el-rte-rtl .tabsbar .tab { float:right; }
+
+/* выпадающие меню */
+/* container for elselect */
+.el-rte .toolbar ul li.el-select {
+ height:22px;
+ width : 120px;
+ border:1px solid #ccc;
+ font-size:.82em;
+ cursor: default;
+ background-position:-475px -30px;
+}
+
+.el-rte .toolbar ul li.el-select.hover {
+ background-color:#fefefe;
+}
+
+.el-rte .toolbar ul li.el-select label {
+ height:19px;
+ padding: 3px 5px 0 5px;
+ float:none; /* Joomla 1.6 compat */
+ width:96px; /* Joomla 1.6 compat */
+}
+
+/* textarea & iframe в диплогах вставки текста */
+.el-rte-paste-input {
+ width : 99%;
+ height: 250px;
+ border: 1px solid #ccc;
+ padding:0;
+ margin:0;
+ outline:none;
+}
+/* индикатор выбраного цвета на кнопке */
+.el-rte .toolbar ul li div.color-indicator {
+ width:18px;
+ height:4px;
+ margin:16px 0 2px 2px;
+ background-color: #000;
+}
+.el-rte-rtl .toolbar ul li div.color-indicator {
+ margin:16px 2px 2px 0;
+}
+/* colors palette */
+.el-palette { top:20px; }
+
+.el-dialogform, .el-dialogform td { font-size:.9em; }
+.el-dialogform select { font-size:.9em;}
+.ui-dialog .ui-dialog-buttonpane { padding: .4em, 1em;}
+.ui-dialog .ui-dialog-buttonpane button { margin: .3em .4em .1em 0; font-size:.9em;}
+.ui-dialog .ui-dialog-titlebar { padding: .3em 1em .3em; }
+/*.ui-dialog-buttonset { padding:0; background-color:#333;}*/
+/* диалоговые окна */
+.el-dialogform label {
+ display:block;
+}
+.el-dialogform label input {
+ margin-right:2px;
+}
+.el-dialogform iframe.el-rte-preview {
+ width : 100%;
+ height : 235px;
+ margin:0;
+ padding:0;
+ outline:none;
+ border:none;
+}
+.el-dialogform fieldset {
+ border:1px solid #ccc;
+ padding : 0;
+}
+.el-dialogform fieldset legend {
+ font-size:.9em;
+ padding: .1em .5em;
+ margin: 0 0 5px 1em;
+ border:1px solid #ccc;
+ background-color: #eee;
+}
+.el-dialogform p { padding:.2em .3em;}
+.el-dialogform h3 { color:#555; padding:1.2em 0 0 0; margin:0; font-size:1.2em; }
+
+.el-dialogform h4 { color:#555;font-size:1em; padding:0; margin: 3px 9px; }
+
+.elrte-logo {
+ width:48px;
+ height:46px;
+ float:left;
+ margin:.5em 1em;
+ background:url('../images/elrte-toolbar.png') -880px -7px no-repeat;
+}
+.elrte-ver { font-size:.9em; padding-left:.7em;}
+.elrte-copy { font-size:.9em; padding-left:.3em;}
+table.elrte-authors { margin-bottom:1em;}
+table.elrte-authors td { border-bottom:1px solid #eee;}
+/* widgets */
+.el-borderselect {}
+.el-borderselect table { margin:0; }
+.el-borderselect table td { padding : 0 2px 0 0; vertical-align:middle; }
+.el-borderselect input { margin:0; border:1px solid #ccc; }
+
+.el-paddinginput { display: block; white-space: nowrap; }
+.el-paddinginput input { margin :0 1px 0 0; border:1px solid #ccc; }
+.el-paddinginput select { padding:0; }
+
+.el-rte-smiley { margin:5px; }
--- a/koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/elrte.full.js
+++ a/koha-tmpl/intranet-tmpl/prog/en/js/elrte-1.1/js/elrte.full.js
@@ -0,0 +1,8646 @@
+/*!
+ * elRTE WYSIWYG HTML-editor
+ * Version 1.1 (2010-09-20)
+ * http://elrte.org
+ *
+ * Copyright 2010, Studio 42 Ltd.
+ * Licensed under a 3 clauses BSD license
+ */
+
+/**
+ * @class eli18n
+ * Javascript applications localization
+ *
+ * @param Object o - class options. Object. {textdomain : 'имя_группы_сообщений', messages : {textdomain1 : {}[, textdomain2 : {}]...}}
+ *
+ * Usage:
+ *
+ * var msgs = { Hello : 'Превэд', 'Hello %user' : 'Превед %user' };
+ * //load messages and set default textdomain
+ * var translator = new eli18n( {textdomain : 'test', messages : {test : msgs}} )
+ * window.console.log(translator.translate('Hello'));
+ * window.console.log(translator.format('Hello %user', {user : 'David Blain'}))
+ * // create new textdomain
+ * translator.load({test2 : {'Goodbye' : 'Ja, deva mata!'} })
+ * // and use it, without changing default one
+ * window.console.log(translator.translate('Goodbye', 'test2'));
+ *
+ * @author: Dmitry (dio) Levashov dio@std42.ru
+ * license: BSD license
+ **/
+function eli18n(o) {
+
+ /**
+ * Get/set default textdomain
+ *
+ * @param String d new textdomain name
+ * @return String default textdomain
+ **/
+ this.textdomain = function(d) {
+ return this.messages[d] ? this._domain = d : this._domain;
+ }
+
+ o && o.messages && this.load(o.messages);
+ o && o.textdomain && this.textdomain(o.textdomain);
+}
+
+eli18n.prototype = new function() {
+
+ /**
+ * @var Object messages (key - messages in English or message handler, value - message in selected language)
+ **/
+ this.messages = {};
+ /**
+ * @var String default textdomain
+ **/
+ this._domain = '';
+
+ /**
+ * Load new messages
+ *
+ * @param Object msgs - messages (key - textdomain name, value - messages Object)
+ * @return Object this
+ **/
+ this.load = function(msgs) {
+ if (typeof(msgs) == 'object') {
+ for (var d in msgs) {
+ var _msgs = msgs[d];
+ if (typeof(_msgs) == 'object') {
+ if (!this.messages[d]) {
+ this.messages[d] = {};
+ }
+ for (var k in _msgs) {
+ if (typeof(_msgs[k]) == 'string') {
+ this.messages[d][k] = _msgs[k];
+ }
+ }
+ }
+ }
+ }
+ return this;
+ }
+
+ /**
+ * Return translated message, if message exists in required or default textdomain, otherwise returns original message
+ *
+ * @param String msg - message
+ * @param String d - textdomain. If empty, default textdomain will be used
+ * @return String translated message
+ **/
+ this.translate = function(msg, d) {
+ var d = d && this.messages[d] ? d : this._domain;
+ return this.messages[d] && this.messages[d][msg] ? this.messages[d][msg] : msg;
+
+ }
+
+ /**
+ * Translate message and replace placeholders (%placeholder)
+ *
+ * @param String msg - message
+ * @param Object replacement for placeholders (keys - placeholders name without leading %, values - replacements)
+ * @param String d - textdomain. If empty, default textdomain will be used
+ * @return String translated message
+ **/
+ this.format = function(msg, data, d) {
+ msg = this.translate(msg, d);
+ if (typeof(data) == 'object') {
+ for (var i in data) {
+ msg = msg.replace('%'+i, this.translate(data[i], d));
+ }
+ }
+ return msg;
+ }
+}
+/**
+ * @class elDialogForm
+ * Wraper for jquery.ui.dialog and jquery.ui.tabs
+ * Create form in dialog. You can decorate it as you wish - with tabs or/and tables
+ *
+ * Usage:
+ * var d = new elDialogForm(opts)
+ * d.append(['Field name: ', $('')])
+ * .separator()
+ * .append(['Another field name: ', $('')])
+ * .open()
+ * will create dialog with pair text field separated by horizontal rule
+ * Calling append() with 2 additional arguments ( d.append([..], null, true))
+ * - will create table in dialog and put text inputs and labels in table cells
+ *
+ * Dialog with tabs:
+ * var d = new elDialogForm(opts)
+ * d.tab('first', 'First tab label)
+ * .tab('second', 'Second tab label)
+ * .append(['Field name: ', $('')], 'first', true) - add label and input to first tab in table (table will create automagicaly)
+ * .append(['Field name 2: ', $('')], 'second', true) - same in secon tab
+ *
+ * Options:
+ * class - css class for dialog
+ * submit - form submit event callback. Accept 2 args - event and this object
+ * ajaxForm - arguments for ajaxForm, if needed (dont forget include jquery.form.js)
+ * tabs - arguments for ui.tabs
+ * dialog - arguments for ui.dialog
+ * name - hidden text field in wich selected value will saved
+ *
+ * Notice!
+ * When close dialog, it will destroing insead of dialog('close'). Reason - strange bug with tabs in dialog on secondary opening.
+ *
+ * @author: Dmitry Levashov (dio) dio@std42.ru
+ *
+ **/
+
+function elDialogForm(o) {
+ var self = this;
+
+ var defaults = {
+ 'class' : 'el-dialogform',
+ submit : function(e, d) { window.console && window.console.log && window.console.log('submit called'); d.close(); },
+ form : { action : window.location.href, method : 'post' },
+ ajaxForm : null,
+ validate : null,
+ spinner : 'Loading',
+ tabs : { active: 0 },
+ tabPrefix : 'el-df-tab-',
+ dialog : {
+ title : 'dialog',
+ autoOpen : false,
+ modal : true,
+ resizable : false,
+ buttons : {
+ Cancel : function() { self.close(); },
+ Ok : function() { self.form.trigger('submit'); }
+ }
+ }
+ };
+
+ this.opts = jQuery.extend(true, defaults, o, {dialog : { autoOpen : false, close : function() { self.close(); } }});
+
+ if (this.opts.rtl) {
+ this.opts['class'] += ' el-dialogform-rtl';
+ }
+
+ if (o && o.dialog && o.dialog.buttons && typeof(o.dialog.buttons) == 'object') {
+ this.opts.dialog.buttons = o.dialog.buttons;
+ }
+ this.ul = null;
+ this.tabs = {};
+ this._table = null;
+ this.dialog = jQuery('
').addClass(this.opts['class']).dialog(this.opts.dialog);
+ this.message = jQuery('').hide().appendTo(this.dialog);
+ this.error = jQuery('').hide().appendTo(this.dialog);
+ this.spinner = jQuery('').hide().appendTo(this.dialog);
+ this.content = jQuery('').appendTo(this.dialog)
+ this.form = jQuery('').attr(this.opts.form).appendTo(this.content);
+
+ if (this.opts.submit) {
+ this.form.bind('submit', function(e) { self.opts.submit(e, self) })
+ }
+ if (this.opts.ajaxForm && jQuery.fn.ajaxForm) {
+ this.form.ajaxForm(this.opts.ajaxForm);
+ }
+ if (this.opts.validate) {
+ this.form.validate(this.opts.validate);
+ }
+
+ this.option = function(name, value) {
+ return this.dialog.dialog('option', name, value)
+ }
+
+ this.showError = function(msg, hideContent) {
+ this.hideMessage();
+ this.hideSpinner();
+ this.error.html(msg).show();
+ hideContent && this.content.hide();
+ return this;
+ }
+
+ this.hideError= function() {
+ this.error.text('').hide();
+ this.content.show();
+ return this;
+ }
+
+ this.showSpinner = function(txt) {
+ this.error.hide();
+ this.message.hide();
+ this.content.hide();
+ this.spinner.text(txt||this.opts.spinner).show();
+ this.option('buttons', {});
+ return this;
+ }
+
+ this.hideSpinner = function() {
+ this.content.show();
+ this.spinner.hide();
+ return this;
+ }
+
+ this.showMessage = function(txt, hideContent) {
+ this.hideError();
+ this.hideSpinner();
+ this.message.html(txt||'').show();
+ hideContent && this.content.hide();
+ return this;
+ }
+
+ this.hideMessage = function() {
+ this.message.hide();
+ this.content.show();
+ return this;
+ }
+
+ /**
+ * Create new tab
+ * @param string id - tab id
+ * @param string title - tab name
+ * @return elDialogForm
+ **/
+ this.tab = function(id, title) {
+ id = this.opts.tabPrefix+id;
+
+ if (!this.ul) {
+ this.ul = jQuery('').prependTo(this.form);
+ }
+ jQuery('').append(jQuery('').attr('href', '#'+id).html(title)).appendTo(this.ul);
+ this.tabs[id] = {tab : jQuery('').attr('id', id).addClass('tab').appendTo(this.form), table : null};
+ return this;
+ }
+
+ /**
+ * Create new table
+ * @param string id tab id, if set - table will create in tab, otherwise - in dialog
+ * @return elDialogForm
+ **/
+ this.table = function(id) {
+ id = id && id.indexOf(this.opts.tabPrefix) == -1 ? this.opts.tabPrefix+id : id;
+ if (id && this.tabs && this.tabs[id]) {
+ this.tabs[id].table = jQuery('').appendTo(this.tabs[id].tab);
+ } else {
+ this._table = jQuery('').appendTo(this.form);
+ }
+ return this;
+ }
+
+ /**
+ * Append html, dom nodes or jQuery objects to dialog or tab
+ * @param array|object|string data object(s) to append to dialog
+ * @param string tid tab id, if adding to tab
+ * @param bool t if true - data will added in table (creating automagicaly)
+ * @return elDialogForm
+ **/
+ this.append = function(data, tid, t) {
+ tid = tid ? 'el-df-tab-'+tid : '';
+
+ if (!data) {
+ return this;
+ }
+
+ if (tid && this.tabs[tid]) {
+ if (t) {
+ !this.tabs[tid].table && this.table(tid);
+ var tr = jQuery('
').appendTo(this.tabs[tid].table);
+ if (!jQuery.isArray(data)) {
+ tr.append(jQuery(' | ').append(data));
+ } else {
+ for (var i=0; i < data.length; i++) {
+ tr.append(jQuery(' | ').append(data[i]));
+ };
+ }
+ } else {
+ if (!jQuery.isArray(data)) {
+ this.tabs[tid].tab.append(data)
+ } else {
+ for (var i=0; i < data.length; i++) {
+ this.tabs[tid].tab.append(data[i]);
+ };
+ }
+ }
+
+ } else {
+ if (!t) {
+ if (!jQuery.isArray(data)) {
+ this.form.append(data);
+ } else {
+ for (var i=0; i < data.length; i++) {
+ this.form.append(data[i]);
+ };
+ }
+ } else {
+ if (!this._table) {
+ this.table();
+ }
+ var tr = jQuery('
').appendTo(this._table);
+ if (!jQuery.isArray(data)) {
+ tr.append(jQuery(' | ').append(data));
+ } else {
+ for (var i=0; i < data.length; i++) {
+ tr.append(jQuery(' | ').append(data[i]));
+ };
+ }
+ }
+ }
+ return this;
+ }
+
+ /**
+ * Append separator (div class="separator") to dialog or tab
+ * @param string tid tab id, if adding to tab
+ * @return elDialogForm
+ **/
+ this.separator = function(tid) {
+ tid = 'el-df-tab-'+tid;
+ if (this.tabs && this.tabs[tid]) {
+ this.tabs[tid].tab.append(jQuery('').addClass('separator'));
+ this.tabs[tid].table && this.table(tid);
+ } else {
+ this.form.append(jQuery('').addClass('separator'));
+ }
+ return this;
+ }
+
+ /**
+ * Open dialog window
+ * @return elDialogForm
+ **/
+ this.open = function() {
+ this.ul && this.form.tabs(this.opts.tabs);
+ this.form.find(':text').keyup(function(e) {
+ if (e.keyCode == 13) {
+ self.form.submit();
+ }
+ });
+
+ this.dialog.attr('unselectable', 'on').dialog('open');
+ var self = this;
+ if (this.form && this.form.find(':text').length) {
+ setTimeout(function() { self.form.find(':text')[0].focus(); }, 20);
+ }
+
+ return this;
+ }
+
+ /**
+ * Close dialog window and destroy content
+ * @return void
+ **/
+ this.close = function() {
+ if (typeof(this.opts.close) == 'function') {
+ this.opts.close();
+ }
+ this.dialog.dialog('destroy').remove();
+ }
+
+}
+
+/**
+ * elColorPicker. JQuery plugin
+ * Create drop-down colors palette.
+ *
+ * Usage:
+ * $(selector).elColorPicker(opts)
+ *
+ * set color after init:
+ * var c = $(selector).elColorPicker(opts)
+ * c.val('#ffff99)
+ *
+ * Get selected color:
+ * var color = c.val();
+ *
+ * Notice!
+ * Palette created only after first click on element (lazzy loading)
+ *
+ * Options:
+ * colors - colors array (by default display 256 web safe colors)
+ * color - current (selected) color
+ * class - css class for display "button" (element on wich plugin was called)
+ * paletteClass - css class for colors palette
+ * palettePosition - string indicate where palette will created:
+ * 'inner' - palette will attach to element (acceptable in most cases)
+ * 'outer' - palette will attach to document.body.
+ * Use, when create color picker inside element with overflow == 'hidden', for example in ui.dialog
+ * update - function wich update button view on select color (by default set selected color as background)
+ * change - callback, called when color was selected (by default write color to console.log)
+ * name - hidden text field in wich selected color value will saved
+ *
+ * @author: Dmitry Levashov (dio) dio@std42.ru
+ *
+ **/
+(function($) {
+
+ $.fn.elColorPicker = function(o) {
+ var self = this;
+ var opts = $.extend({}, $.fn.elColorPicker.defaults, o);
+ this.hidden = $('').attr('name', opts.name).val(opts.color||'').appendTo(this);
+ this.palette = null;
+ this.preview = null;
+ this.input = null;
+
+ function setColor(c) {
+ self.val(c);
+ opts.change && opts.change(self.val());
+ self.palette.slideUp();
+ }
+
+ function init() {
+ self.palette = $('').addClass(opts.paletteClass+' rounded-3');
+ for (var i=0; i < opts.colors.length; i++) {
+ $('')
+ .addClass('color')
+ .css('background-color', opts.colors[i])
+ .attr({title : opts.colors[i], unselectable : 'on'})
+ .appendTo(self.palette)
+ .mouseenter(function() {
+ var v = $(this).attr('title');
+ self.input.val(v);
+ self.preview.css('background-color', v);
+ })
+ .click(function(e) {
+ e.stopPropagation();
+ setColor($(this).attr('title'));
+ });
+ };
+ self.input = $('')
+ .addClass('rounded-3')
+ .attr('size', 8)
+ .click(function(e) {
+ e.stopPropagation();
+ })
+ .keydown(function(e) {
+ if (e.ctrlKey || e.metaKey) {
+ return true;
+ }
+ var k = e.keyCode;
+ // on esc - close palette
+ if (k == 27) {
+ return self.mouseleave();
+ }
+ // allow input only hex color value
+ if (k!=8 && k != 13 && k!=46 && k!=37 && k != 39 && (k<48 || k>57) && (k<65 || k > 70)) {
+ return false;
+ }
+ var c = $(this).val();
+ if (c.length == 7 || c.length == 0) {
+ if (k == 13) {
+ e.stopPropagation();
+ e.preventDefault();
+ setColor(c);
+ self.palette.slideUp();
+ }
+ if (e.keyCode != 8 && e.keyCode != 46 && k!=37 && k != 39) {
+ return false;
+ }
+ }
+ })
+ .keyup(function(e) {
+ var c = $(this).val();
+ c.length == 7 && /^#[0-9abcdef]{6}$/i.test(c) && self.val(c);
+ });
+
+ self.preview = $('')
+ .addClass('preview rounded-3')
+ .click(function(e) {
+ e.stopPropagation();
+ setColor(self.input.val());
+ });
+
+ self.palette
+ .append($('').addClass('clearfix'))
+ .append($('').addClass('panel').append(self.input).append(self.preview));
+
+ if (opts.palettePosition == 'outer') {
+ self.palette.hide()
+ .appendTo(self.parents('body').eq(0))
+ .mouseleave(function() {
+ $(this).slideUp();
+ self.val(self.val());
+ })
+ self.mouseleave(function(e) {
+ if (e.relatedTarget != self.palette.get(0)) {
+ self.palette.slideUp();
+ self.val(self.val());
+ }
+ })
+ } else {
+ self.append(self.palette.hide())
+ .mouseleave(function(e) {
+ self.palette.slideUp();
+ self.val(self.val());
+ });
+ }
+ self.val(self.val());
+ }
+
+ this.empty().addClass(opts['class']+' rounded-3')
+ .css({'position' : 'relative', 'background-color' : opts.color||''})
+ .click(function(e) {
+ if (!self.hasClass('disabled')) {
+ !self.palette && init();
+ if (opts.palettePosition == 'outer' && self.palette.css('display') == 'none') {
+ var o = $(this).offset();
+ var w = self.palette.width();
+ var l = self.parents('body').width() - o.left >= w ? o.left : o.left + $(this).outerWidth() - w;
+ self.palette.css({left : l+'px', top : o.top+$(this).height()+1+'px'});
+ }
+ self.palette.slideToggle();
+ }
+ });
+
+ this.val = function(v) {
+ if (!v && v!=='') {
+ return this.hidden.val();
+ } else {
+ this.hidden.val(v);
+ if (opts.update) {
+ opts.update(this.hidden.val());
+ } else {
+ this.css('background-color', v);
+ }
+
+ if (self.palette) {
+ self.preview.css('background-color', v);
+ self.input.val(v);
+ }
+ }
+ return this;
+ }
+
+ return this;
+ }
+
+ $.fn.elColorPicker.defaults = {
+ 'class' : 'el-colorpicker',
+ paletteClass : 'el-palette',
+ palettePosition : 'inner',
+ name : 'color',
+ color : '',
+ update : null,
+ change : function(c) { },
+ 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'
+ ]
+ };
+
+})(jQuery);
+/**
+ * jQuery plugin. Create group of text input, elSelect and elColorPicker.
+ * Allow input border-width, border-style and border-color. Used in elRTE
+ *
+ * @author: Dmitry Levashov (dio) dio@std42.ru
+ **/
+(function($) {
+
+ $.fn.elBorderSelect = function(o) {
+
+ var $self = this;
+ var self = this.eq(0);
+ var opts = $.extend({}, $.fn.elBorderSelect.defaults, o);
+ var width = $('')
+ .attr({'name' : opts.name+'[width]', size : 3}).css('text-align', 'right')
+ .change(function() { $self.change(); });
+
+ var color = $('').css('position', 'relative')
+ .elColorPicker({
+ 'class' : 'el-colorpicker ui-icon ui-icon-pencil',
+ name : opts.name+'[color]',
+ palettePosition : 'outer',
+ change : function() { $self.change(); }
+ });
+
+
+ var style = $('').elSelect({
+ tpl : '
',
+ tpls : { '' : '%label'},
+ maxHeight : opts.styleHeight || null,
+ select : function() { $self.change(); },
+ src : {
+ '' : 'none',
+ solid : 'solid',
+ dashed : 'dashed',
+ dotted : 'dotted',
+ 'double' : 'double',
+ groove : 'groove',
+ ridge : 'ridge',
+ inset : 'inset',
+ outset : 'outset'
+ }
+ });
+
+ self.empty()
+ .addClass(opts['class'])
+ .attr('name', opts.name||'')
+ .append(
+ $('').attr('cellspacing', 0).append(
+ $('
')
+ .append($(' | ').append(width).append(' px'))
+ .append($(' | ').append(style))
+ .append($(' | ').append(color))
+ )
+ );
+
+ function rgb2hex(str) {
+ function hex(x) {
+ hexDigits = ["0", "1", "2", "3", "4", "5", "6", "7", "8","9", "a", "b", "c", "d", "e", "f"];
+ return !x ? "00" : hexDigits[(x - x % 16) / 16] + hexDigits[x% 16];
+ }
+ var rgb = (str||'').match(/\(([0-9]{1,3}),\s*([0-9]{1,3}),\s*([0-9]{1,3})\)/);
+ return rgb ? "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]) : '';
+ }
+
+ function toPixels(num) {
+ if (!num) {
+ return num;
+ }
+ var m = num.match(/([0-9]+\.?[0-9]*)\s*(px|pt|em|%)/);
+ if (m) {
+ num = m[1];
+ unit = m[2];
+ }
+ if (num[0] == '.') {
+ num = '0'+num;
+ }
+ num = parseFloat(num);
+
+ if (isNaN(num)) {
+ return '';
+ }
+ var base = parseInt($(document.body).css('font-size')) || 16;
+ switch (unit) {
+ case 'em': return parseInt(num*base);
+ case 'pt': return parseInt(num*base/12);
+ case '%' : return parseInt(num*base/100);
+ }
+ return num;
+ }
+
+ this.change = function() {
+ opts.change && opts.change(this.val());
+ }
+
+ this.val = function(v) {
+ if (!v && v !== '') {
+ var w = parseInt(width.val());
+ return {width : !isNaN(w) ? w+'px' : '', style : style.val(), color : color.val()};
+ } else {
+ var m, w, s, c, b = '';
+ if (v.nodeName || v.css) {
+ if (!v.css) {
+ v = $(v);
+ }
+ var b = v.css('border')
+ if ((b = v.css('border'))) {
+ w = s = c = b;
+ } else {
+ w = v.css('border-width');
+ s = v.css('border-style');
+ c = v.css('border-color');
+ }
+
+ } else {
+ w = v.width||'';
+ s = v.style||'';
+ c = v.color||'';
+ }
+
+ width.val(toPixels(w));
+ var m = s ? s.match(/(solid|dashed|dotted|double|groove|ridge|inset|outset)/i) :'';
+ style.val(m ? m[1] : '');
+ color.val(rgb2hex(c));
+ return this;
+ }
+ }
+
+ this.val(opts.value);
+ return this;
+ }
+
+ $.fn.elBorderSelect.defaults = {
+ name : 'el-borderselect',
+ 'class' : 'el-borderselect',
+ value : {},
+ change : null
+ }
+
+})(jQuery);
+/**
+ * jQuery plugin. Create group of text input fields and selects for setting padding/margin. Used in elRTE
+ *
+ * @author: Dmitry Levashov (dio) dio@std42.ru
+ **/
+(function($) {
+
+ $.fn.elPaddingInput = function(o) {
+ var self = this;
+ var opts = $.extend({}, $.fn.elPaddingInput.defaults, {name : this.attr('name')}, o);
+ this.regexps = {
+ main : new RegExp(opts.type == 'padding' ? 'padding\s*:\s*([^;"]+)' : 'margin\s*:\s*([^;"]+)', 'im'),
+ left : new RegExp(opts.type == 'padding' ? 'padding-left\s*:\s*([^;"]+)' : 'margin-left\s*:\s*([^;"]+)', 'im'),
+ top : new RegExp(opts.type == 'padding' ? 'padding-top\s*:\s*([^;"]+)' : 'margin-top\s*:\s*([^;"]+)', 'im'),
+ right : new RegExp(opts.type == 'padding' ? 'padding-right\s*:\s*([^;"]+)' : 'margin-right\s*:\s*([^;"]+)', 'im'),
+ bottom : new RegExp(opts.type == 'padding' ? 'padding-bottom\s*:\s*([^;"]+)' : 'margin-bottom\s*:\s*([^;"]+)', 'im')
+ };
+
+ $.each(['left', 'top', 'right', 'bottom'], function() {
+
+ self[this] = $('')
+ .attr('size', 3)
+ .css('text-align', 'right')
+ .css('border-'+this, '2px solid red')
+ .bind('change', function() { $(this).val(parseNum($(this).val())); change(); })
+ .attr('name', opts.name+'['+this+']');
+ });
+ $.each(['uleft', 'utop', 'uright', 'ubottom'], function() {
+ self[this] = $('')
+ .append('')
+ .append('')
+ .append('')
+ .bind('change', function() { change(); })
+ .attr('name', opts.name+'['+this+']');
+ if (opts.percents) {
+ self[this].append('');
+ }
+ });
+
+ this.empty().addClass(opts['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(v) {
+ if (!v && v!=='') {
+ var l = parseNum(this.left.val());
+ var t = parseNum(this.top.val());
+ var r = parseNum(this.right.val());
+ var b = parseNum(this.bottom.val());
+ var ret = {
+ left : l=='auto' || l==0 ? l : (l!=='' ? l+this.uleft.val() : ''),
+ top : t=='auto' || t==0 ? t : (t!=='' ? t+this.utop.val() : ''),
+ right : r=='auto' || r==0 ? r : (r!=='' ? r+this.uright.val() : ''),
+ bottom : b=='auto' || b==0 ? b : (b!=='' ? b+this.ubottom.val() : ''),
+ css : ''
+ };
+ if (ret.left!=='' && ret.right!=='' && ret.top!=='' && ret.bottom!=='') {
+ if (ret.left == ret.right && ret.top == ret.bottom) {
+ ret.css = ret.top+' '+ret.left;
+ } else{
+ ret.css = ret.top+' '+ret.right+' '+ret.bottom+' '+ret.left;
+ }
+ }
+
+ return ret;
+ } else {
+
+ if (v.nodeName || v.css) {
+ if (!v.css) {
+ v = $(v);
+ }
+ var val = {left : '', top : '', right: '', bottom : ''};
+ var style = (v.attr('style')||'').toLowerCase();
+
+ if (style) {
+ style = $.trim(style);
+ var m = style.match(this.regexps.main);
+ if (m) {
+ var tmp = $.trim(m[1]).replace(/\s+/g, ' ').split(' ', 4);
+ val.top = tmp[0];
+ val.right = tmp[1] && tmp[1]!=='' ? tmp[1] : val.top;
+ val.bottom = tmp[2] && tmp[2]!=='' ? tmp[2] : val.top;
+ val.left = tmp[3] && tmp[3]!=='' ? tmp[3] : val.right;
+ } else {
+ $.each(['left', 'top', 'right', 'bottom'], function() {
+ var name = this.toString();
+ m = style.match(self.regexps[name]);
+ if (m) {
+ val[name] = m[1];
+ }
+ });
+ }
+ }
+ var v = val;
+ }
+
+ $.each(['left', 'top', 'right', 'bottom'], function() {
+ var name = this.toString();
+ if (typeof(v[name]) != 'undefined' && v[name] !== null) {
+ v[name] = v[name].toString();
+ var _v = parseNum(v[name]);
+ self[name].val(_v);
+ var m = v[name].match(/(px|em|pt|%)/i);
+ self['u'+name].val(m ? m[1] : 'px');
+ }
+ });
+ return this;
+ }
+ }
+
+ function parseNum(num) {
+ num = $.trim(num.toString());
+ if (num[0] == '.') {
+ num = '0'+num;
+ }
+ n = parseFloat(num);
+ return !isNaN(n) ? n : (num == 'auto' ? num : '');
+ }
+
+ function change() {
+ opts.change && opts.change(self);
+ }
+
+ this.val(opts.value);
+
+ return this;
+ }
+
+ $.fn.elPaddingInput.defaults = {
+ name : 'el-paddinginput',
+ 'class' : 'el-paddinginput',
+ type : 'padding',
+ value : {},
+ percents : true,
+ change : null
+ }
+
+})(jQuery);
+/**
+ * elSelect JQuery plugin
+ * Replacement for select input
+ * Allow to put any html and css decoration in drop-down list
+ *
+ * Usage:
+ * $(selector).elSelect(opts)
+ *
+ * set value after init:
+ * var c = $(selector).elSelect(opts)
+ * c.val('some value')
+ *
+ * Get selected value:
+ * var val = c.val();
+ *
+ * Notice!
+ * 1. When called on multiply elements, elSelect create drop-down list only for fist element
+ * 2. Elements list created only after first click on element (lazzy loading)
+ *
+ * Options:
+ * src - object with pairs value:label to create drop-down list
+ * value - current (selected) value
+ * class - css class for display "button" (element on wich plugin was called)
+ * listClass - css class for drop down elements list
+ * select - callback, called when value was selected (by default write value to console.log)
+ * name - hidden text field in wich selected value will saved
+ * maxHeight - elements list max height (if height greater - scroll will appear)
+ * tpl - template for element in list (contains 2 vars: %var - for src key, %label - for src[val] )
+ * labelTpl - template for label (current selected element) (contains 2 placeholders: %var - for src key, %label - for src[val] )
+ *
+ * @author: Dmitry Levashov (dio) dio@std42.ru
+ **/
+(function($) {
+
+ $.fn.elSelect = function(o) {
+ var $self = this;
+ var self = this.eq(0);
+ var opts = $.extend({}, $.fn.elSelect.defaults, o);
+ var hidden = $('').attr('name', opts.name);
+ var label = $('').attr({unselectable : 'on'}).addClass('rounded-left-3');
+ var list = null;
+ var ieWidth = null;
+
+ if (self.get(0).nodeName == 'SELECT') {
+ opts.src = {};
+ self.children('option').each(function() {
+ opts.src[$(this).val()] = $(this).text();
+ });
+ opts.value = self.val();
+ opts.name = self.attr('name');
+ self.replaceWith((self = $('')));
+ }
+
+ if (!opts.value || !opts.src[opts.val]) {
+ opts.value = null;
+ var i = 0;
+ for (var v in opts.src) {
+ if (i++ == 0) {
+ opts.value = v;
+ }
+ }
+ }
+
+ this.val = function(v) {
+ if (!v && v!=='') {
+ return hidden.val();
+ } else {
+ if (opts.src[v]) {
+ hidden.val(v);
+ updateLabel(v);
+ if (list) {
+ list.children().each(function() {
+ if ($(this).attr('name') == v) {
+ $(this).addClass('active');
+ } else {
+ $(this).removeClass('active');
+ }
+ });
+ }
+ }
+ return this;
+ }
+ }
+
+ // update label content
+ function updateLabel(v) {
+ var tpl = opts.labelTpl || opts.tpls[v] || opts.tpl;
+ label.html(tpl.replace(/%val/g, v).replace(/%label/, opts.src[v])).children().attr({unselectable : 'on'});
+ }
+
+ // init "select"
+ self.empty()
+ .addClass(opts['class']+' rounded-3')
+ .attr({unselectable : 'on'})
+ .append(hidden)
+ .append(label)
+ .hover(
+ function() { $(this).addClass('hover') },
+ function() { $(this).removeClass('hover') }
+ )
+ .click(function(e) {
+ !list && init();
+ list.slideToggle();
+ // stupid ie inherit width from parent
+ if ($.browser.msie && !ieWidth) {
+ list.children().each(function() {
+ ieWidth = Math.max(ieWidth, $(this).width());
+ });
+ if (ieWidth > list.width()) {
+ list.width(ieWidth+40);
+ }
+ }
+ });
+
+ this.val(opts.value);
+
+ // create drop-down list
+ function init() {
+ // not ul because of ie is stupid with mouseleave in it :(
+ list = $('')
+ .addClass(opts.listClass+' rounded-3')
+ .hide()
+ .appendTo(self.mouseleave(function(e) { list.slideUp(); }));
+
+ for (var v in opts.src) {
+ var tpl = opts.tpls[v] || opts.tpl;
+ $('')
+ .attr('name', v)
+ .append( $(tpl.replace(/%val/g, v).replace(/%label/g, opts.src[v])).attr({unselectable : 'on'}) )
+ .appendTo(list)
+ .hover(
+ function() { $(this).addClass('hover') },
+ function() { $(this).removeClass('hover') }
+ )
+ .click(function(e) {
+ e.stopPropagation();
+ e.preventDefault();
+
+ var v = $(this).attr('name');
+ $self.val(v);
+ opts.select(v);
+ list.slideUp();
+ });
+ };
+
+ var w = self.outerWidth();
+ if (list.width() < w) {
+ list.width(w);
+ }
+
+ var h = list.height();
+ if (opts.maxHeight>0 && h>opts.maxHeight) {
+ list.height(opts.maxHeight);
+ }
+
+ $self.val(hidden.val());
+ }
+
+ return this;
+ }
+
+ $.fn.elSelect.defaults = {
+ name : 'el-select',
+ 'class' : 'el-select',
+ listClass : 'list',
+ labelTpl : null,
+ tpl : '<%val>%label%val>',
+ tpls : {},
+ value : null,
+ src : {},
+ select : function(v) { window.console && window.console.log && window.console.log('selected: '+v); },
+ maxHeight : 410
+ }
+
+})(jQuery);
+/*
+ * elRTE - WSWING editor for web
+ *
+ * Usage:
+ * var opts = {
+ * .... // see elRTE.options.js
+ * }
+ * var editor = new elRTE($('#my-id').get(0), opts)
+ * or
+ * $('#my-id').elrte(opts)
+ *
+ * $('#my-id) may be textarea or any DOM Element with text
+ *
+ * @author: Dmitry Levashov (dio) dio@std42.ru
+ * Copyright: Studio 42, http://www.std42.ru
+ */
+(function($) {
+
+elRTE = function(target, opts) {
+ if (!target || !target.nodeName) {
+ return alert('elRTE: argument "target" is not DOM Element');
+ }
+ var self = this, html;
+ this.version = '1.1';
+ this.build = '2010-09-20';
+ this.options = $.extend(true, {}, this.options, opts);
+ this.browser = $.browser;
+ this.target = $(target);
+
+ this.lang = (''+this.options.lang).toLowerCase();
+ 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 = $('');
+ this.iframe = document.createElement('iframe');
+ // this.source = $('').hide();
+ this.workzone = $('').append(this.iframe).append(this.source);
+ this.statusbar = $('');
+ this.tabsbar = $('');
+ this.editor = $('').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)
+
+ /**
+ * Sync iframes/textareas height with workzone height
+ *
+ * @return void
+ */
+ this.updateHeight = function() {
+ self.workzone.add(self.iframe).add(self.source).height(self.workzone.height());
+ }
+
+ /**
+ * Turn editor resizable on/off if allowed
+ *
+ * @param Boolean
+ * @return void
+ **/
+ this.resizable = function(r) {
+ var self = this;
+ if (this.options.resizable && $.fn.resizable) {
+ if (r) {
+ this.editor.resizable({handles : 'se', alsoResize : this.workzone, minWidth :300, minHeight : 200 }).bind('resize', self.updateHeight);
+ } else {
+ this.editor.resizable('destroy').unbind('resize', self.updateHeight);
+ }
+ }
+ }
+
+ /* attach editor to document */
+ this.editor.insertAfter(target);
+ /* init editor textarea */
+ var content = '';
+ if (target.nodeName == 'TEXTAREA') {
+ this.source = this.target;
+ this.source.insertAfter(this.iframe).hide();
+ content = this.target.val();
+ } else {
+ this.source = $('').insertAfter(this.iframe).hide();
+ content = this.target.hide().html();
+ }
+ this.source.attr('name', this.target.attr('name')||this.target.attr('id'));
+ content = $.trim(content);
+ if (!content) {
+ content = ' ';
+ }
+
+ /* add tabs */
+ if (this.options.allowSource) {
+ this.tabsbar.append(''+self.i18n('Editor')+'
'+self.i18n('Source')+'
')
+ .children('.tab').click(function(e) {
+ if (!$(this).hasClass('active')) {
+ self.tabsbar.children('.tab').toggleClass('active');
+ self.workzone.children().toggle();
+
+ if ($(this).hasClass('editor')) {
+ self.updateEditor();
+ self.window.focus();
+ self.ui.update(true);
+ } else {
+ self.updateSource();
+ self.source.focus();
+ if ($.browser.msie) {
+ // @todo
+ } else {
+ self.source[0].setSelectionRange(0, 0);
+ }
+ self.ui.disable();
+ self.statusbar.empty();
+
+ }
+ }
+
+ });
+ }
+
+ this.window = this.iframe.contentWindow;
+ this.doc = this.iframe.contentWindow.document;
+ this.$doc = $(this.doc);
+
+ /* put content into iframe */
+ html = '';
+ $.each(self.options.cssfiles, function() {
+ html += '';
+ });
+ this.doc.open();
+ var s = this.filter.wysiwyg(content),
+ cl = this.rtl ? ' class="el-rte-rtl"' : '';
+ this.doc.write(self.options.doctype+html+''+(s)+'');
+ this.doc.close();
+
+ /* make iframe editable */
+ if ($.browser.msie) {
+ this.doc.body.contentEditable = true;
+ } else {
+ try { this.doc.designMode = "on"; }
+ catch(e) { }
+ this.doc.execCommand('styleWithCSS', false, this.options.styleWithCSS);
+ }
+
+ if (this.options.height>0) {
+ this.workzone.height(this.options.height);
+
+ }
+ this.updateHeight();
+ this.resizable(true);
+ this.window.focus();
+
+ this.history = new this.history(this);
+
+ /* init selection object */
+ this.selection = new this.selection(this);
+ /* init buttons */
+ this.ui = new this.ui(this);
+
+
+ /* bind updateSource to parent form submit */
+ this.target.parents('form').bind('submit', function(e) {
+ self.source.parents('form').find('[name="el-select"]').remove()
+ self.beforeSave();
+ });
+
+ // on tab press - insert \t and prevent move focus
+ this.source.bind('keydown', function(e) {
+ if (e.keyCode == 9) {
+ e.preventDefault();
+
+ if ($.browser.msie) {
+ var r = document.selection.createRange();
+ r.text = "\t"+r.text;
+ this.focus();
+ } else {
+ var before = this.value.substr(0, this.selectionStart),
+ after = this.value.substr(this.selectionEnd);
+ this.value = before+"\t"+after;
+ this.setSelectionRange(before.length+1, before.length+1);
+ }
+ }
+ });
+
+ /* update buttons on click and keyup */
+ this.$doc.bind('mouseup', function() {
+ self.ui.update();
+ })
+ .bind('dragstart', function(e) {
+ e.preventDefault();
+ e.stopPropagation();
+ })
+ .bind('keyup', function(e) {
+ if ((e.keyCode >= 8 && e.keyCode <= 13) || (e.keyCode>=32 && e.keyCode<= 40) || e.keyCode == 46 || (e.keyCode >=96 && e.keyCode <= 111)) {
+ // self.log('keyup '+e.keyCode)
+ self.ui.update();
+ }
+ })
+ .bind('keydown', function(e) {
+ if ((e.metaKey || e.ctrlKey) && e.keyCode == 65) {
+ self.ui.update();
+ } else if (e.keyCode == 13) {
+ var n = self.selection.getNode();
+ // self.log(n)
+ if (self.dom.selfOrParent(n, /^PRE$/)) {
+ self.selection.insertNode(self.doc.createTextNode("\r\n"));
+ return false;
+ } else if ($.browser.safari && e.shiftKey) {
+ self.selection.insertNode(self.doc.createElement('br'))
+ return false;
+ }
+ }
+ })
+
+ this.typing = false;
+ this.lastKey = null;
+
+ this.$doc.bind('keydown', function(e) {
+ if ((e.keyCode>=48 && e.keyCode <=57) || e.keyCode==61 || e.keyCode == 109 || (e.keyCode>=65 && e.keyCode<=90) || e.keyCode==188 ||e.keyCode==190 || e.keyCode==191 || (e.keyCode>=219 && e.keyCode<=222)) {
+ if (!self.typing) {
+ self.history.add(true);
+ }
+ self.typing = true;
+ self.lastKey = null;
+ } else if (e.keyCode == 8 || e.keyCode == 46 || e.keyCode == 32 || e.keyCode == 13) {
+ if (e.keyCode != self.lastKey) {
+ self.history.add(true);
+ }
+ self.lastKey = e.keyCode;
+ self.typing = false;
+ }
+
+ })
+ .bind('mouseup', function() {
+ self.typing = false;
+ self.lastKey = null;
+ })
+ .bind('paste', function(e) {
+ if (!self.options.allowPaste) {
+ // paste denied
+ e.stopPropagation();
+ e.preventDefault();
+ } else {
+ var n = $(self.dom.create('div'))[0],
+ r = self.doc.createTextNode('_');
+ self.history.add(true);
+ self.typing = true;
+ self.lastKey = null;
+ n.appendChild(r);
+ self.selection.deleteContents().insertNode(n);
+ self.selection.select(r);
+ setTimeout(function() {
+ if (n.parentNode) {
+ // clean sandbox content
+ $(n).html(self.filter.proccess('paste', $(n).html()));
+ r = n.lastChild;
+ self.dom.unwrap(n);
+ if (r) {
+ self.selection.select(r);
+ self.selection.collapse(false);
+ }
+ } else {
+ // smth wrong - clean all doc
+ n.parentNode && n.parentNode.removeChild(n);
+ self.val(self.filter.proccess('paste', self.filter.wysiwyg2wysiwyg($(self.doc.body).html())));
+ self.selection.select(self.doc.body.firstChild);
+ self.selection.collapse(true);
+ }
+ $(self.doc.body).mouseup(); // to activate history buutons
+ }, 15);
+ }
+ });
+
+ if ($.browser.msie) {
+ this.$doc.bind('keyup', function(e) {
+ if (e.keyCode == 86 && (e.metaKey||e.ctrlKey)) {
+ self.history.add(true);
+ self.typing = true;
+ self.lastKey = null;
+ self.selection.saveIERange();
+ self.val(self.filter.proccess('paste', self.filter.wysiwyg2wysiwyg($(self.doc.body).html())));
+ self.selection.restoreIERange();
+ $(self.doc.body).mouseup();
+ this.ui.update();
+ }
+ });
+ }
+
+ if ($.browser.safari) {
+ this.$doc.bind('click', function(e) {
+ $(self.doc.body).find('.elrte-webkit-hl').removeClass('elrte-webkit-hl');
+ if (e.target.nodeName == 'IMG') {
+ $(e.target).addClass('elrte-webkit-hl');
+ }
+ }).bind('keyup', function(e) {
+ $(self.doc.body).find('.elrte-webkit-hl').removeClass('elrte-webkit-hl');
+ })
+ }
+
+ // this.resizable(true)
+ this.window.focus();
+ // this.log(this.editor.parents('form').find('[name="el-select"]'))
+
+
+}
+
+/**
+ * Return message translated to selected language
+ *
+ * @param string msg message text in english
+ * @return string
+ **/
+elRTE.prototype.i18n = function(msg) {
+ return this._i18n.translate(msg);
+}
+
+
+
+/**
+ * Display editor
+ *
+ * @return void
+ **/
+elRTE.prototype.open = function() {
+ this.editor.show();
+}
+
+/**
+ * Hide editor and display elements on wich editor was created
+ *
+ * @return void
+ **/
+elRTE.prototype.close = function() {
+ this.editor.hide();
+}
+
+elRTE.prototype.updateEditor = function() {
+ this.val(this.source.val());
+}
+
+elRTE.prototype.updateSource = function() {
+ this.source.val(this.filter.source($(this.doc.body).html()));
+}
+
+/**
+ * Return edited text
+ *
+ * @return String
+ **/
+elRTE.prototype.val = function(v) {
+ if (typeof(v) == 'string') {
+ v = ''+v;
+ if (this.source.is(':visible')) {
+ this.source.val(this.filter.source2source(v));
+ } else {
+ if ($.browser.msie) {
+ this.doc.body.innerHTML = '
'+this.filter.wysiwyg(v);
+ this.doc.body.removeChild(this.doc.body.firstChild);
+ } else {
+ this.doc.body.innerHTML = this.filter.wysiwyg(v);
+ }
+
+ }
+ } else {
+ if (this.source.is(':visible')) {
+ return this.filter.source2source(this.source.val());
+ } else {
+ return this.filter.source($(this.doc.body).html());
+ }
+ }
+}
+
+elRTE.prototype.beforeSave = function() {
+ this.source.val(this.val()||'');
+}
+
+/**
+ * Submit form
+ *
+ * @return void
+ **/
+elRTE.prototype.save = function() {
+ this.beforeSave();
+ this.editor.parents('form').submit();
+}
+
+elRTE.prototype.log = function(msg) {
+ if (window.console && window.console.log) {
+ window.console.log(msg);
+ }
+
+}
+
+elRTE.prototype.i18Messages = {};
+
+$.fn.elrte = function(o, v) {
+ var cmd = typeof(o) == 'string' ? o : '', ret;
+
+ this.each(function() {
+ if (!this.elrte) {
+ this.elrte = new elRTE(this, typeof(o) == 'object' ? o : {});
+ }
+ switch (cmd) {
+ case 'open':
+ case 'show':
+ this.elrte.open();
+ break;
+ case 'close':
+ case 'hide':
+ this.elrte.close();
+ break;
+ case 'updateSource':
+ this.elrte.updateSource();
+ break;
+ }
+ });
+
+ if (cmd == 'val') {
+ if (!this.length) {
+ return '';
+ } else if (this.length == 1) {
+ return v ? this[0].elrte.val(v) : this[0].elrte.val();
+ } else {
+ ret = {}
+ this.each(function() {
+ ret[this.elrte.source.attr('name')] = this.elrte.val();
+ });
+ return ret;
+ }
+ }
+ return this;
+}
+
+})(jQuery);
+/*
+ * DOM utilites for elRTE
+ *
+ * @author: Dmitry Levashov (dio) dio@std42.ru
+ */
+(function($) {
+elRTE.prototype.dom = function(rte) {
+ this.rte = rte;
+ var self = 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)$/
+ };
+
+ /********************************************************/
+ /* Утилиты */
+ /********************************************************/
+
+ /**
+ * Возвращает body редактируемого документа
+ *
+ * @return Element
+ **/
+ this.root = function() {
+ return this.rte.body;
+ }
+
+ this.create = function(t) {
+ return this.rte.doc.createElement(t);
+ }
+
+ /**
+ * Return node for bookmark with unique ID
+ *
+ * @return DOMElement
+ **/
+ this.createBookmark = function() {
+ var b = this.rte.doc.createElement('span');
+ b.id = 'elrte-bm-'+Math.random().toString().substr(2);
+ $(b).addClass('elrtebm');
+ return b;
+ }
+
+ /**
+ * Вовращает индекс элемента внутри родителя
+ *
+ * @param Element n нода
+ * @return integer
+ **/
+ this.indexOf = function(n) {
+ var ndx = 0;
+ n = $(n);
+ while ((n = n.prev()) && n.length) {
+ ndx++;
+ }
+ return ndx;
+ }
+
+ /**
+ * Вовращает значение аттрибута в нижнем регистре (ох уж этот IE)
+ *
+ * @param Element n нода
+ * @param String attr имя аттрибута
+ * @return string
+ **/
+ this.attr = function(n, attr) {
+ var v = '';
+ if (n.nodeType == 1) {
+ v = $(n).attr(attr);
+ if (v && attr != 'src' && attr != 'href') {
+ v = v.toString().toLowerCase();
+ }
+ }
+ return v||'';
+ }
+
+ /**
+ * Вовращает ближайший общий контейнер для 2-х эл-тов
+ *
+ * @param Element n нода1
+ * @param Element n нода2
+ * @return Element
+ **/
+ this.findCommonAncestor = function(n1, n2) {
+ if (!n1 || !n2) {
+ return this.rte.log('dom.findCommonAncestor invalid arguments');
+ }
+ if (n1 == n2) {
+ return n1;
+ } else if (n1.nodeName == 'BODY' || n2.nodeName == 'BODY') {
+ return this.rte.doc.body;
+ }
+ var p1 = $(n1).parents(), p2 = $(n2).parents(), l = p2.length-1, c = p2[l];
+ for (var i = p1.length - 1; i >= 0; i--, l--){
+ if (p1[i] == p2[l]) {
+ c = p1[i];
+ } else {
+ break;
+ }
+ };
+ return c;
+ }
+ /**
+ * Вовращает TRUE, если нода пустая
+ * пустой считаем ноды:
+ * - текстовые эл-ты, содержащие пустую строку или тег br
+ * - текстовые ноды с пустой строкой
+ *
+ * @param DOMElement n нода
+ * @return bool
+ **/
+ this.isEmpty = function(n) {
+ if (n.nodeType == 1) {
+ return this.regExp.textNodes.test(n.nodeName) ? $.trim($(n).text()).length == 0 : false;
+ } else if (n.nodeType == 3) {
+ return /^(TABLE|THEAD|TFOOT|TBODY|TR|UL|OL|DL)$/.test(n.parentNode.nodeName)
+ || n.nodeValue == ''
+ || ($.trim(n.nodeValue).length== 0 && !(n.nextSibling && n.previousSibling && n.nextSibling.nodeType==1 && n.previousSibling.nodeType==1 && !this.regExp.block.test(n.nextSibling.nodeName) && !this.regExp.block.test(n.previousSibling.nodeName) ));
+ }
+ return true;
+ }
+
+ /********************************************************/
+ /* Перемещение по DOM */
+ /********************************************************/
+
+ /**
+ * Вовращает следующую соседнюю ноду (не включаются текстовые ноды не создающие значимые пробелы между инлайн элементами)
+ *
+ * @param DOMElement n нода
+ * @return DOMElement
+ **/
+ this.next = function(n) {
+ while (n.nextSibling && (n = n.nextSibling)) {
+ if (n.nodeType == 1 || (n.nodeType == 3 && !this.isEmpty(n))) {
+ return n;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Вовращает предыдующую соседнюю ноду (не включаются текстовые ноды не создающие значимые пробелы между инлайн элементами)
+ *
+ * @param DOMElement n нода
+ * @return DOMElement
+ **/
+ this.prev = function(n) {
+ while (n.previousSibling && (n = n.previousSibling)) {
+ if (n.nodeType == 1 || (n.nodeType ==3 && !this.isEmpty(n))) {
+ return n;
+ }
+ }
+ return null;
+ }
+
+ this.isPrev = function(n, prev) {
+ while ((n = this.prev(n))) {
+ if (n == prev) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Вовращает все следующие соседнии ноды (не включаются текстовые ноды не создающие значимые пробелы между инлайн элементами)
+ *
+ * @param DOMElement n нода
+ * @return Array
+ **/
+ this.nextAll = function(n) {
+ var ret = [];
+ while ((n = this.next(n))) {
+ ret.push(n);
+ }
+ return ret;
+ }
+
+ /**
+ * Вовращает все предыдующие соседнии ноды (не включаются текстовые ноды не создающие значимые пробелы между инлайн элементами)
+ *
+ * @param DOMElement n нода
+ * @return Array
+ **/
+ this.prevAll = function(n) {
+ var ret = [];
+ while ((n = this.prev(n))) {
+ ret.push(n);
+ }
+ return ret;
+ }
+
+ /**
+ * Вовращает все следующие соседнии inline ноды (не включаются текстовые ноды не создающие значимые пробелы между инлайн элементами)
+ *
+ * @param DOMElement n нода
+ * @return Array
+ **/
+ this.toLineEnd = function(n) {
+ var ret = [];
+ while ((n = this.next(n)) && n.nodeName != 'BR' && n.nodeName != 'HR' && this.isInline(n)) {
+ ret.push(n);
+ }
+ return ret;
+ }
+
+ /**
+ * Вовращает все предыдующие соседнии inline ноды (не включаются текстовые ноды не создающие значимые пробелы между инлайн элементами)
+ *
+ * @param DOMElement n нода
+ * @return Array
+ **/
+ this.toLineStart = function(n) {
+ var ret = [];
+ while ((n = this.prev(n)) && n.nodeName != 'BR' && n.nodeName != 'HR' && this.isInline(n) ) {
+ ret.unshift(n);
+ }
+ return ret;
+ }
+
+ /**
+ * Вовращает TRUE, если нода - первый непустой эл-т внутри родителя
+ *
+ * @param Element n нода
+ * @return bool
+ **/
+ this.isFirstNotEmpty = function(n) {
+ while ((n = this.prev(n))) {
+ if (n.nodeType == 1 || (n.nodeType == 3 && $.trim(n.nodeValue)!='' ) ) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Вовращает TRUE, если нода - последний непустой эл-т внутри родителя
+ *
+ * @param Element n нода
+ * @return bool
+ **/
+ this.isLastNotEmpty = function(n) {
+ while ((n = this.next(n))) {
+ if (!this.isEmpty(n)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Вовращает TRUE, если нода - единственный непустой эл-т внутри родителя
+ *
+ * @param DOMElement n нода
+ * @return bool
+ **/
+ this.isOnlyNotEmpty = function(n) {
+ return this.isFirstNotEmpty(n) && this.isLastNotEmpty(n);
+ }
+
+ /**
+ * Вовращает последний непустой дочерний эл-т ноды или FALSE
+ *
+ * @param Element n нода
+ * @return Element
+ **/
+ this.findLastNotEmpty = function(n) {
+ this.rte.log('findLastNotEmpty Who is here 0_o');
+ if (n.nodeType == 1 && (l = n.lastChild)) {
+ if (!this.isEmpty(l)) {
+ return l;
+ }
+ while (l.previousSibling && (l = l.previousSibling)) {
+ if (!this.isEmpty(l)) {
+ return l;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Возвращает TRUE, если нода "inline"
+ *
+ * @param DOMElement n нода
+ * @return bool
+ **/
+ this.isInline = function(n) {
+ if (n.nodeType == 3) {
+ return true;
+ } else if (n.nodeType == 1) {
+ n = $(n);
+ var d = n.css('display');
+ var f = n.css('float');
+ return d == 'inline' || d == 'inline-block' || f == 'left' || f == 'right';
+ }
+ return true;
+ }
+
+
+ /********************************************************/
+ /* Поиск элементов */
+ /********************************************************/
+
+ this.is = function(n, f) {
+ if (n && n.nodeName) {
+ if (typeof(f) == 'string') {
+ f = this.regExp[f]||/.?/;
+ }
+ if (f instanceof RegExp && n.nodeName) {
+ return f.test(n.nodeName);
+ } else if (typeof(f) == 'function') {
+ return f(n);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Вовращает элемент(ы) отвечающие условиям поиска
+ *
+ * @param DOMElement||Array n нода
+ * @param RegExp||String filter фильтр условия поиска (RegExp или имя ключа this.regExp или *)
+ * @return DOMElement||Array
+ **/
+ this.filter = function(n, filter) {
+ var ret = [], i;
+ if (!n.push) {
+ return this.is(n, filter) ? n : null;
+ }
+ for (i=0; i < n.length; i++) {
+ if (this.is(n[i], filter)) {
+ ret.push(n[i]);
+ }
+ };
+ return ret;
+ }
+
+
+ /**
+ * Вовращает массив родительских элементов, отвечающих условиям поиска
+ *
+ * @param DOMElement n нода, родителей, которой ищем
+ * @param RegExp||String filter фильтр условия поиска (RegExp или имя ключа this.regExp или *)
+ * @return Array
+ **/
+ this.parents = function(n, filter) {
+ var ret = [];
+
+ while (n && (n = n.parentNode) && n.nodeName != 'BODY' && n.nodeName != 'HTML') {
+ if (this.is(n, filter)) {
+ ret.push(n);
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * Вовращает ближайший родительский эл-т, отвечающий условиям поиска
+ *
+ * @param DOMElement n нода, родителя, которой ищем
+ * @param RegExp||String f фильтр условия поиска (RegExp или имя ключа this.regExp или *)
+ * @return DOMElement
+ **/
+ this.parent = function(n, f) {
+ return this.parents(n, f)[0] || null;
+ }
+
+ /**
+ * Вовращает или саму ноду или ее ближайшего родителя, если выполняются условия sf для самой ноды или pf для родителя
+ *
+ * @param DOMElement n нода, родителя, которой ищем
+ * @param RegExp||String sf фильтр условия для самой ноды
+ * @param RegExp||String pf фильтр условия для родителя
+ * @return DOMElement
+ **/
+ this.selfOrParent = function(n, sf, pf) {
+ return this.is(n, sf) ? n : this.parent(n, pf||sf);
+ }
+
+ /**
+ * Вовращает родительскую ноду - ссылку
+ *
+ * @param Element n нода
+ * @return Element
+ **/
+ this.selfOrParentLink = function(n) {
+ n = this.selfOrParent(n, /^A$/);
+ return n && n.href ? n : null;
+ }
+
+ /**
+ * Вовращает TRUE, если нода - anchor
+ *
+ * @param Element n нода
+ * @return bool
+ **/
+ this.selfOrParentAnchor = function(n) {
+ n = this.selfOrParent(n, /^A$/);
+ return n && !n.href && n.name ? n : null;
+ }
+
+ /**
+ * Вовращает массив дочерних ссылок
+ *
+ * @param DOMElement n нода
+ * @return Array
+ **/
+ this.childLinks = function(n) {
+ var res = [];
+ $('a[href]', n).each(function() { res.push(this); });
+ return res;
+ }
+
+ this.selectionHas = function(f) {
+ var n = this.rte.selection.cloneContents(), i;
+ if (n && n.childNodes && n.childNodes.length) {
+ for (i=0; i < n.childNodes.length; i++) {
+ if (typeof(f) == 'function') {
+ if (f(n.childNodes[i])) {
+ return true;
+ }
+ } else if (n instanceof RegExp) {
+ if (f.test(n.childNodes[i].nodeName)) {
+ return true;
+ }
+ }
+ };
+ }
+
+ return false;
+ }
+ /********************************************************/
+ /* Изменения DOM */
+ /********************************************************/
+
+ /**
+ * Оборачивает одну ноду другой
+ *
+ * @param DOMElement n оборачиваемая нода
+ * @param DOMElement w нода обертка или имя тега
+ * @return DOMElement
+ **/
+ this.wrap = function(n, w) {
+ n = $.isArray(n) ? n : [n];
+ w = w.nodeName ? w : this.create(w);
+
+ if (n[0] && n[0].nodeType && n[0].parentNode) {
+ w = n[0].parentNode.insertBefore(w, n[0]);
+ $(n).each(function() {
+ if (this!=w) {
+ w.appendChild(this);
+ }
+ });
+ }
+
+ return w;
+ }
+
+ /**
+ * Replace node with its contents
+ *
+ * @param DOMElement n node
+ * @return void
+ **/
+ this.unwrap = function(n) {
+ while (n.firstChild) {
+ n.parentNode.insertBefore(n.firstChild, n);
+ }
+ n.parentNode.removeChild(n);
+ }
+
+ /**
+ * Оборачивает все содержимое ноды
+ *
+ * @param DOMElement n оборачиваемая нода
+ * @param DOMElement w нода обертка или имя тега
+ * @return DOMElement
+ **/
+ this.wrapContents = function(n, w) {
+ w = w.nodeName ? w : this.create(w);
+ for (var i=0; i < n.childNodes.length; i++) {
+ w.appendChild(n.childNodes[i]);
+ };
+ n.appendChild(w);
+ return w;
+ }
+
+ this.cleanNode = function(n) {
+
+ if (n.nodeType != 1) {
+ return;
+ }
+ if (/^(P|LI)$/.test(n.nodeName) && (l = this.findLastNotEmpty(n)) && l.nodeName == 'BR') {
+ $(l).remove();
+ }
+ $n = $(n);
+ $n.children().each(function() {
+ this.cleanNode(this);
+ });
+ if (n.nodeName != 'BODY' && !/^(TABLE|TR|TD)$/.test(n) && this.isEmpty(n)) {
+ return $n.remove();
+ }
+ if ($n.attr('style') === '') {
+ $n.removeAttr('style');
+ }
+ if (this.rte.browser.safari && $n.hasClass('Apple-span')) {
+ $n.removeClass('Apple-span');
+ }
+ if (n.nodeName == 'SPAN' && !$n.attr('style') && !$n.attr('class') && !$n.attr('id')) {
+ $n.replaceWith($n.html());
+ }
+ }
+
+ this.cleanChildNodes = function(n) {
+ var cmd = this.cleanNode;
+ $(n).children().each(function() { cmd(this); });
+ }
+
+ /********************************************************/
+ /* Таблицы */
+ /********************************************************/
+
+ this.tableMatrix = function(n) {
+ var mx = [];
+ if (n && n.nodeName == 'TABLE') {
+ var max = 0;
+ function _pos(r) {
+ for (var i=0; i<=max; i++) {
+ if (!mx[r][i]) {
+ return i;
+ }
+ };
+ }
+
+ $(n).find('tr').each(function(r) {
+ if (!$.isArray(mx[r])) {
+ mx[r] = [];
+ }
+
+ $(this).children('td,th').each(function() {
+ var w = parseInt($(this).attr('colspan')||1);
+ var h = parseInt($(this).attr('rowspan')||1);
+ var i = _pos(r);
+ for (var y=0; yremove')
+ } else if (l ');
+ }
+ }
+ }
+
+ }
+ }
+
+ this.tableColumn = function(n, ext, fix) {
+ n = this.selfOrParent(n, /^TD|TH$/);
+ var tb = this.selfOrParent(n, /^TABLE$/);
+ ret = [];
+ info = {offset : [], delta : []};
+ if (n && tb) {
+ fix && this.fixTable(tb);
+ var mx = this.tableMatrix(tb);
+ var _s = false;
+ var x;
+ for (var r=0; r=0) {
+ for(var r=0; r').addClass('elrtetesturl').appendTo(document.body)[0];
+ // media replacement image base url
+ this.url = (typeof(n.currentStyle )!= "undefined" ? n.currentStyle['backgroundImage'] : document.defaultView.getComputedStyle(n, null)['backgroundImage']).replace(/^url\((['"]?)([\s\S]+\/)[\s\S]+\1\)$/i, "$2");
+ $(n).remove();
+
+ this.rte = rte;
+ // flag - return xhtml tags?
+ this.xhtml = /xhtml/i.test(rte.options.doctype);
+ // boolean attributes
+ this.boolAttrs = rte.utils.makeObject('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'.split(','));
+ // tag regexp
+ this.tagRegExp = /<(\/?)([\w:]+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*\/?>/g;
+ // opened tag regexp
+ this.openTagRegExp = /<([\w:]+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*\/?>/g;
+ // attributes regexp
+ this.attrRegExp = /(\w+)(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^\s]+))?/g;
+ // script tag regexp
+ this.scriptRegExp = /";
+ return '';
+ })
+ .replace(this.yMapsRegExp, function(t, a) {
+ a = self.parseAttrs(a);
+ a['class']['elrte-yandex-maps'] = 'elrte-yandex-maps';
+ a['class']['elrte-protected'] = 'elrte-protected';
+ return '';
+ })
+ .replace(this.gMapsRegExp, function(t, a) {
+ var id = 'gmaps'+Math.random().toString().substring(2), w, h;
+ a = self.parseAttrs(a);
+ w = parseInt(a.width||a.style.width||100);
+ h = parseInt(a.height||a.style.height||100);
+ self.scripts[id] = t;
+ return '
';
+ })
+ .replace(this.objRegExp, function(t, a, c) {
+ var m = c.match(self.embRegExp),
+ o = { obj : self.parseAttrs(a), embed : m && m.length ? self.parseAttrs(m[0].substring(7)) : null, params : [] },
+ i = self.rte.utils.mediaInfo(o.embed ? o.embed.type||'' : '', o.obj.classid||'');
+
+ if (i) {
+ if ((m = c.match(self.paramRegExp))) {
+ $.each(m, function(i, p) {
+ o.params.push(self.parseAttrs(p.substring(6)));
+ });
+ }
+ !o.obj.classid && (o.obj.classid = i.classid[0]);
+ !o.obj.codebase && (o.obj.codebase = i.codebase);
+ o.embed && !o.embed.type && (o.embed.type = i.type);
+ // ie bug with empty attrs
+ o.obj.width == '1' && delete o.obj.width;
+ o.obj.height == '1' && delete o.obj.height;
+ if (o.embed) {
+ o.embed.width == '1' && delete o.embed.width;
+ o.embed.height == '1' && delete o.embed.height;
+ }
+ return img(o, i.type);
+ }
+ return t;
+ })
+ .replace(this.embRegExp, function(t, n, a) {
+ var a = self.parseAttrs(a),
+ i = self.rte.utils.mediaInfo(a.type||'');
+ // ie bug with empty attrs
+ a.width == '1' && delete a.width;
+ a.height == '1' && delete a.height;
+ return i ? img({ embed : a }, i.type) : t;
+ })
+ .replace(this.vimeoRegExp, function(t, n, a) {
+ a = self.parseAttrs(a);
+ delete a.frameborder;
+ a.width == '1' && delete a.width;
+ a.height == '1' && delete a.height;
+ a.type = 'application/x-shockwave-flash';
+ return img({ embed : a }, 'application/x-shockwave-flash');
+ })
+ .replace(/<\/(embed|param)>/gi, '')
+ .replace(this.pbRegExp, function() {
+ return '
';
+ });
+
+
+ n = $('
'+html+'
');
+ // remove empty spans and merge nested spans
+ n.find('span:not([id]):not([class])').each(function() {
+ var t = $(this);
+
+ if (!t.attr('style')) {
+ t.children().length ? self.rte.dom.unwrap(this) : t.remove();
+ }
+ }).end().find('span span:only-child').each(function() {
+ var t = $(this),
+ p = t.parent().eq(0),
+ tid = t.attr('id'),
+ pid = p.attr('id'), id, s, c;
+
+ if (self.rte.dom.is(this, 'onlyChild') && (!tid || !pid)) {
+ c = $.trim(p.attr('class')+' '+t.attr('class'))
+ c && p.attr('class', c);
+ s = self.rte.utils.serializeStyle($.extend(self.rte.utils.parseStyle($(this).attr('style')||''), self.rte.utils.parseStyle($(p).attr('style')||'')));
+ s && p.attr('style', s);
+ id = tid||pid;
+ id && p.attr('id', id);
+ this.firstChild ? $(this.firstChild).unwrap() : t.remove();
+ }
+ });
+
+
+
+ if (!this.rte.options.allowTextNodes) {
+ // wrap inline nodes with p
+ var dom = this.rte.dom,
+ nodes = [],
+ w = [];
+
+ if ($.browser.msie) {
+ for (var i = 0; i
/gi, "")
+ .replace(/\<\!--\s*ELRTE_SCRIPT\:\s*(script\d+)\s*--\>/gi, function(t, n) {
+ if (self.scripts[n]) {
+ t = self.scripts[n];
+ delete self.scripts[n];
+ }
+ return t||'';
+ })
+ .replace(/\<\!-- ELRTE_COMMENT([\s\S]*?) --\>/gi, "$1")
+ .replace(this.serviceClassRegExp, function(t, n, a, e) {
+ var a = self.parseAttrs(a), j, o = '';
+ // alert(t)
+ if (a['class']['elrte-media']) {
+ // alert(a.rel)
+ // return ''
+ // j = a.rel ? JSON.parse(self.rte.utils.decode(a.rel)) : {};
+ j = self.scripts[a.rel]||{};
+ // alert(j)
+ // j = a.rel ? $.parseJSON(self.rte.utils.decode(a.rel)) : {};
+ j.params && $.each(j.params, function(i, p) {
+ o += '\n";
+ });
+ j.embed && (o+='