First public release

* elRTE 1.0rc2
     * elFinder 1.0.1
This commit is contained in:
Troex Nevelin
2009-11-09 07:11:43 +03:00
parent dddf93b857
commit 975a47f223
118 changed files with 13908 additions and 0 deletions
+101
View File
@@ -0,0 +1,101 @@
_ _____ _______ ______
| | | __ \ |__ __| | ____|
___ | | | |__) | | | | |__
/ _ \ | | | _ / | | | __|
| __/ | | | | \ \ | | | |____
\___| |_| |_| \_\ |_| |______|
Description
===========
www.elrte.ru / dev@std42.ru
elRTE is an open-source WYSIWYG HTML-editor written in JavaScript using
jQuery UI. It allows easy editing HTML-pages on your site. You can use it in
any commercial or non-commercial projects.
Features:
* Rich text editing, change its appearance and style
* Insert and manage various HTML elements with formatting (images, tables,
lists and etc.)
* View and edit HTML-code
* Normal and full screen mode
elRTE was developed for ELDORADO.CMS, but now it is standalone and can be
easily integrated into other content management systems.
Other features:
* Advanced work with CSS
- Set indentation (margins, paddings) for images and table cells (seperate
for each direction)
- Control border properties (width, style, color) with convenient dialogs
- Write element properties as CSS-style always when possible
* Lightweight (139Kb - elRTE+elFinder in one file), easy to integrate
* Interface appearance is configured from one CSS file
* No templates used
* i18n. The editor can be easily localized to any language. Currently
available in English (default), Russian, German and Ukrainian languages
* elRTE comes with web file manager elFinder, but can also be used with any
other
* Flexible for extensions
elRTE tested in Firefox 3.5, Internet Explorer 7 and 8, Safari 4, Opera 10 and
Chrome.
File manager elFinder requires connector, currently available only in PHP.
Documentation
=============
http://www.elrte.ru/en/doc/
Documentation for developers will be available shortly.
Authors
=======
Programming: Dmitry "dio" Levashov <dio@std42.ru>
Techsupport, make file and testing: Troex Nevelin <troex@fury.scancode.ru>
Design: Valentin Razumnih
We hope our tools will be helpful for you.
License:
========
elRTE and elFinder is issued under a BSD license.
elRTE and elFInder uses jQuery, jQuery-UI, jQuery.form и jQuery.metadata,
witch is issued under MIT and GPL licenses.
MIT and GPL licenses applies to jQuery, jQuery-UI and jQuery plugins that are
distributed with elRTE and elFinder.
This software is available under a 3 clauses BSD license:
Copyright (c) 2009, Studio 42 Ltd.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Studio 42 Ltd. nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY Studio 42 Ltd. ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Studio 42 Ltd. BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+1
View File
@@ -0,0 +1 @@
*
+1
View File
@@ -0,0 +1 @@
*
+51
View File
@@ -0,0 +1,51 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>elFinder from source</title>
<!-- jQuery and plugins -->
<link rel="stylesheet" href="js/ui-themes/base/ui.all.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery-ui-1.7.2.custom.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.metadata.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.form.js" type="text/javascript" charset="utf-8"></script>
<!-- css for widgets -->
<link rel="stylesheet" href="src/ellib/css/elcommon.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="src/ellib/css/eldialogform.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="src/ellib/css/eldirtree.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="src/ellib/css/elcontextmenu.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="src/elfinder/css/elfinder.css" type="text/css" media="screen" title="no title" charset="utf-8">
<!-- common js and widgets -->
<script src="src/ellib/js/eli18n.js" type="text/javascript" charset="utf-8"></script>
<script src="src/ellib/js/elcookie.js" type="text/javascript" charset="utf-8"></script>
<script src="src/ellib/js/eldialogform.js" type="text/javascript" charset="utf-8"></script>
<script src="src/ellib/js/jquery.eldirtree.js" type="text/javascript" charset="utf-8"></script>
<script src="src/ellib/js/jquery.elcontextmenu.js" type="text/javascript" charset="utf-8"></script>
<!-- elFinder -->
<script src="src/elfinder/js/elfinder.js" type="text/javascript" charset="utf-8"></script>
<!-- russian messages -->
<script src="src/elfinder/js/i18n/elfinder.ru.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$().ready(function() {
$('#finder').elfinder({
lang : 'ru',
url : 'src/elfinder/connectors/php/connector.php',
editorCallback : function(url) { window.console.log(url)}
});
})
</script>
<style type="text/css" media="screen">
body { padding:20px;}
</style>
</head>
<body>
<div id="finder">
</div>
</body>
</html>
+39
View File
@@ -0,0 +1,39 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>elFinder</title>
<!-- jQuery and plugins -->
<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery-ui-1.7.2.custom.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.form.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.metadata.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="js/ui-themes/base/ui.all.css" type="text/css" media="screen" title="no title" charset="utf-8">
<!-- elFinder css -->
<link rel="stylesheet" href="css/elfinder.full.css" type="text/css" media="screen" title="no title" charset="utf-8">
<!-- elFinder -->
<script src="js/elfinder.min.js" type="text/javascript" charset="utf-8"></script>
<!-- russian messages -->
<script src="js/i18n/elfinder.ru.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$().ready(function() {
$('#finder').elfinder({
// lang : 'ru',
url : 'connectors/php/connector.php'
});
})
</script>
<style type="text/css" media="screen">
body { padding:20px;}
</style>
</head>
<body>
<div id="finder">
</div>
</body>
</html>
+122
View File
@@ -0,0 +1,122 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>elRTE from source</title>
<!-- jQuery and plugins -->
<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery-ui-1.7.2.custom.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.form.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.metadata.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="js/ui-themes/base/ui.all.css" type="text/css" media="screen" title="no title" charset="utf-8">
<!-- css for widgets -->
<link rel="stylesheet" href="src/ellib/css/elcommon.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="src/ellib/css/elcolorpicker.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="src/ellib/css/elcontextmenu.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="src/ellib/css/eldialogform.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="src/ellib/css/eldirtree.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="src/ellib/css/elpaddinginput.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="src/ellib/css/elselect.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="src/elfinder/css/elfinder.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="src/elrte/css/elrte.css" type="text/css" media="screen" title="no title" charset="utf-8">
<!-- common js and widgets -->
<script src="src/ellib/js/elcookie.js" type="text/javascript" charset="utf-8"></script>
<script src="src/ellib/js/eli18n.js" type="text/javascript" charset="utf-8"></script>
<script src="src/ellib/js/eldialogform.js" type="text/javascript" charset="utf-8"></script>
<script src="src/ellib/js/jquery.elcolorpicker.js" type="text/javascript" charset="utf-8"></script>
<script src="src/ellib/js/jquery.elborderselect.js" type="text/javascript" charset="utf-8"></script>
<script src="src/ellib/js/jquery.elcontextmenu.js" type="text/javascript" charset="utf-8"></script>
<script src="src/ellib/js/jquery.eldirtree.js" type="text/javascript" charset="utf-8"></script>
<script src="src/ellib/js/jquery.elpaddinginput.js" type="text/javascript" charset="utf-8"></script>
<script src="src/ellib/js/jquery.elselect.js" type="text/javascript" charset="utf-8"></script>
<!-- elFinder -->
<script src="src/elfinder/js/elfinder.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elfinder/js/i18n/elfinder.ru.js" type="text/javascript" charset="utf-8"></script>
<!-- elRTE -->
<script src="src/elrte/js/elRTE.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/elRTE.options.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/elRTE.utils.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/elRTE.DOM.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/elRTE.selection.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/elRTE.w3cRange.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/elRTE.ui.js" type="text/javascript" charset="utf-8"></script>
<!-- russian messages for elRTE -->
<script src="src/elrte/js/i18n/elrte.ru.js" type="text/javascript" charset="utf-8"></script>
<!-- elRTE buttons -->
<script src="src/elrte/js/ui/anchor.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/blockquote.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/copy.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/div.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/docstructure.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/elfinder.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/fontname.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/fontsize.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/forecolor.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/formatblock.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/fullscreen.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/horizontalrule.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/image.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/indent.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/justifyleft.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/link.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/nbsp.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/outdent.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/pasteformattext.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/pastetext.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/save.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/stopfloat.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/table.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/tablerm.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/tbcellprops.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/tbcellsmerge.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/tbcellsplit.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/tbcollbefore.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/tbcolrm.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/tbrowrm.js" type="text/javascript" charset="utf-8"></script>
<script src="src/elrte/js/ui/unlink.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$().ready(function() {
var opts = {
cssClass : 'el-rte',
lang : 'ru',
height : 450,
toolbar : 'maxi',
cssfiles : ['src/elrte/css/elrte-inner.css'],
fmAllow : true,
fmOpen : function(callback) {
$('<div />').elfinder({
url : 'connectors/php/connector.php',
dialog : { width : 900, modal : true, title : 'Files' },
editorCallback : callback
})
}
}
$('#editor').elrte(opts);
})
</script>
<style type="text/css" media="screen">
body { padding:20px;}
</style>
</head>
<body>
<div id="editor">
<h2>ДУГЛАС АДАМС - Путеводитель "Автостопом по Галактике"<br>
DOUGLAS ADAMS - The Hitchhiker's Guide to the Galaxy</h2><img src="http://upload.wikimedia.org/wikipedia/en/1/1c/Hitchhiker%27s_Guide_%28book_cover%29.jpg" style="float: left; margin-top: 0px; margin-right: 20px; margin-left: 20px;" title="" alt="" height="229" width="140"><h3>Вот что сообщает Галактический Путеводитель на предмет <span style="background-color: rgb(255, 255, 153);">полотенец</span>:</h3><div style="text-align: justify; padding-left: 0px;">&nbsp;&nbsp;<span style="background-color: rgb(255, 255, 153);">Полотенце</span>, возможно, самый необходимый предмет для межзвездного путешественника. Оно имеет некоторую практическую ценность - вы можете: завернуться в него, чтобы согреться, прыгая по холодным лунам Джаглан-Беты; использовать его, как подстилку, лежа на мраморном песке пляжей Сантрагинуса V, и вдыхая пьянящий &nbsp;морской воздух; спать на нем под огненно-красными звездами на пустынной планете Какрафун; сделать из него парус, чтобы спуститься на плоту по ленивой реке Мотт; намочить его и завязать узлом, чтобы использовать, как оружие в рукопашной; обвязать им голову, чтобы избежать ядовитого дыма или взгляда Прожорного Заглотозавера с Трааля (умопомрачительно глупое животное: оно считает, что раз вы его не видите, то и оно вас не видит; тупое, как сапог от скафандра, но очень, очень прожорливое); <span style="background-color: rgb(255, 255, 153);">полотенцем</span> можно размахивать, подавая сигнал бедствия; и, разумеется, вытираться, если оно все еще чистое.</div><br><br><hr style="width: 100%; height: 1px;" noshade="true"><br>
<div style="padding: 15px; margin-left: 10px; float: right; width: 150px; background-color: rgb(255, 255, 153); color: rgb(255, 51, 0); text-align: center; font-size: xx-large;"><strong>DON'T<br>PANIC</strong></div><div style="text-align: justify;">&nbsp;&nbsp;In many of the more relaxed civilizations on the Outer Eastern Rim of the Galaxy, the <span class="" style="text-decoration: underline;">Hitch-Hiker's Guide</span> has already supplanted the great Encyclopaedia Galactica as the standard repository of all knowledge and wisdom, for though it has many omissions and contains much that is apocryphal, or at least wildly inaccurate, it scores over the older, more pedestrian work in two important respects. First, it is slightly cheaper; and secondly it has the words <i>DON'T PANIC</i> inscribed in large friendly letters on its cover.<br><br></div>
<p style="padding-left: 40px; color: rgb(0, 51, 102);">"And the wheel," <span style="color: rgb(0, 0, 0);">said the Captain,</span> "What about this wheel thingy? It sounds a terribly interesting project."</p>
<p style="padding-left: 40px; color: rgb(153, 51, 51);">"Ah," <span style="color: rgb(0, 0, 0);">said the marketing girl, </span>"Well, we're having a little difficulty there."</p>
<p style="padding-left: 40px; color: rgb(0, 51, 102);">"Difficulty?"&nbsp;<span style="color: rgb(0, 0, 0);">exclaimed Ford.</span> "Difficulty? What do you mean, difficulty? It's the single simplest machine in the entire Universe!"</p>
<p style="padding-left: 40px;">The marketing girl soured him with a look.</p>
<p style="padding-left: 40px;"><span style="color: rgb(153, 51, 51);">"Alright, Mr. Wiseguy,"</span> she said, <span style="color: rgb(153, 51, 51);">"if you're so clever, you tell us what colour it should be."</span></p>
<br>
</div>
</body>
</html>
+60
View File
@@ -0,0 +1,60 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>elRTE</title>
<!-- jQuery and plugins -->
<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery-ui-1.7.2.custom.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.form.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.metadata.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="js/ui-themes/base/ui.all.css" type="text/css" media="screen" title="no title" charset="utf-8">
<!-- elRTE & elFinder css -->
<link rel="stylesheet" href="css/elrtefinder.full.css" type="text/css" media="screen" title="no title" charset="utf-8">
<!-- elRTE & elFinder -->
<script src="js/elrtefinder.min.js" type="text/javascript" charset="utf-8"></script>
<!-- russian message -->
<script src="js/i18n/elfinder.ru.js" type="text/javascript" charset="utf-8"></script>
<script src="js/i18n/elrte.ru.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$().ready(function() {
var opts = {
cssClass : 'el-rte',
// lang : 'ru',
height : 600,
toolbar : 'eldorado',
cssfiles : ['css/elrte-inner.css'],
fmAllow : true,
fmOpen : function(callback) {
$('<div />').elfinder({
url : 'connectors/php/connector.php',
dialog : { width : 900, modal : true, title : 'Files' },
editorCallback : callback
})
}
}
$('#editor').elrte(opts);
})
</script>
<style type="text/css" media="screen">
body { padding:20px;}
</style>
</head>
<body>
<div id="editor">
<h2>ДУГЛАС АДАМС - Путеводитель "Автостопом по Галактике"<br>
DOUGLAS ADAMS - The Hitchhiker's Guide to the Galaxy</h2><img src="http://upload.wikimedia.org/wikipedia/en/1/1c/Hitchhiker%27s_Guide_%28book_cover%29.jpg" style="float: left; margin-top: 0px; margin-right: 20px; margin-left: 20px;" title="" alt="" height="229" width="140"><h3>Вот что сообщает Галактический Путеводитель на предмет <span style="background-color: rgb(255, 255, 153);">полотенец</span>:</h3><div style="text-align: justify; padding-left: 0px;">&nbsp;&nbsp;<span style="background-color: rgb(255, 255, 153);">Полотенце</span>, возможно, самый необходимый предмет для межзвездного путешественника. Оно имеет некоторую практическую ценность - вы можете: завернуться в него, чтобы согреться, прыгая по холодным лунам Джаглан-Беты; использовать его, как подстилку, лежа на мраморном песке пляжей Сантрагинуса V, и вдыхая пьянящий &nbsp;морской воздух; спать на нем под огненно-красными звездами на пустынной планете Какрафун; сделать из него парус, чтобы спуститься на плоту по ленивой реке Мотт; намочить его и завязать узлом, чтобы использовать, как оружие в рукопашной; обвязать им голову, чтобы избежать ядовитого дыма или взгляда Прожорного Заглотозавера с Трааля (умопомрачительно глупое животное: оно считает, что раз вы его не видите, то и оно вас не видит; тупое, как сапог от скафандра, но очень, очень прожорливое); <span style="background-color: rgb(255, 255, 153);">полотенцем</span> можно размахивать, подавая сигнал бедствия; и, разумеется, вытираться, если оно все еще чистое.</div><br><br><hr style="width: 100%; height: 1px;" noshade="true"><br>
<div style="padding: 15px; margin-left: 10px; float: right; width: 150px; background-color: rgb(255, 255, 153); color: rgb(255, 51, 0); text-align: center; font-size: xx-large;"><strong>DON'T<br>PANIC</strong></div><div style="text-align: justify;">&nbsp;&nbsp;In many of the more relaxed civilizations on the Outer Eastern Rim of the Galaxy, the <span class="" style="text-decoration: underline;">Hitch-Hiker's Guide</span> has already supplanted the great Encyclopaedia Galactica as the standard repository of all knowledge and wisdom, for though it has many omissions and contains much that is apocryphal, or at least wildly inaccurate, it scores over the older, more pedestrian work in two important respects. First, it is slightly cheaper; and secondly it has the words <i>DON'T PANIC</i> inscribed in large friendly letters on its cover.<br><br></div>
<p style="padding-left: 40px; color: rgb(0, 51, 102);">"And the wheel," <span style="color: rgb(0, 0, 0);">said the Captain,</span> "What about this wheel thingy? It sounds a terribly interesting project."</p>
<p style="padding-left: 40px; color: rgb(153, 51, 51);">"Ah," <span style="color: rgb(0, 0, 0);">said the marketing girl, </span>"Well, we're having a little difficulty there."</p>
<p style="padding-left: 40px; color: rgb(0, 51, 102);">"Difficulty?"&nbsp;<span style="color: rgb(0, 0, 0);">exclaimed Ford.</span> "Difficulty? What do you mean, difficulty? It's the single simplest machine in the entire Universe!"</p>
<p style="padding-left: 40px;">The marketing girl soured him with a look.</p>
<p style="padding-left: 40px;"><span style="color: rgb(153, 51, 51);">"Alright, Mr. Wiseguy,"</span> she said, <span style="color: rgb(153, 51, 51);">"if you're so clever, you tell us what colour it should be."</span></p>
<br>
</div>
</body>
</html>
+1
View File
@@ -0,0 +1 @@
*
+1
View File
@@ -0,0 +1 @@
*
+9
View File
@@ -0,0 +1,9 @@
elfinder.full.css
elfinder.full.js
elfinder.min.js
elrte.full.css
elrte.full.js
elrte.min.js
elrtefinder.full.css
elrtefinder.full.js
elrtefinder.min.js
+60
View File
File diff suppressed because one or more lines are too long
+653
View File
@@ -0,0 +1,653 @@
/*
* jQuery Form Plugin
* version: 2.33 (22-SEP-2009)
* @requires jQuery v1.2.6 or later
*
* Examples and documentation at: http://malsup.com/jquery/form/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
;(function($) {
/*
Usage Note:
-----------
Do not use both ajaxSubmit and ajaxForm on the same form. These
functions are intended to be exclusive. Use ajaxSubmit if you want
to bind your own submit handler to the form. For example,
$(document).ready(function() {
$('#myForm').bind('submit', function() {
$(this).ajaxSubmit({
target: '#output'
});
return false; // <-- important!
});
});
Use ajaxForm when you want the plugin to manage all the event binding
for you. For example,
$(document).ready(function() {
$('#myForm').ajaxForm({
target: '#output'
});
});
When using ajaxForm, the ajaxSubmit function will be invoked for you
at the appropriate time.
*/
/**
* ajaxSubmit() provides a mechanism for immediately submitting
* an HTML form using AJAX.
*/
$.fn.ajaxSubmit = function(options) {
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
if (!this.length) {
log('ajaxSubmit: skipping submit process - no element selected');
return this;
}
if (typeof options == 'function')
options = { success: options };
var url = $.trim(this.attr('action'));
if (url) {
// clean url (don't include hash vaue)
url = (url.match(/^([^#]+)/)||[])[1];
}
url = url || window.location.href || '';
options = $.extend({
url: url,
type: this.attr('method') || 'GET'
}, options || {});
// hook for manipulating the form data before it is extracted;
// convenient for use with rich editors like tinyMCE or FCKEditor
var veto = {};
this.trigger('form-pre-serialize', [this, options, veto]);
if (veto.veto) {
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
return this;
}
// provide opportunity to alter form data before it is serialized
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
log('ajaxSubmit: submit aborted via beforeSerialize callback');
return this;
}
var a = this.formToArray(options.semantic);
if (options.data) {
options.extraData = options.data;
for (var n in options.data) {
if(options.data[n] instanceof Array) {
for (var k in options.data[n])
a.push( { name: n, value: options.data[n][k] } );
}
else
a.push( { name: n, value: options.data[n] } );
}
}
// give pre-submit callback an opportunity to abort the submit
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
log('ajaxSubmit: submit aborted via beforeSubmit callback');
return this;
}
// fire vetoable 'validate' event
this.trigger('form-submit-validate', [a, this, options, veto]);
if (veto.veto) {
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
return this;
}
var q = $.param(a);
if (options.type.toUpperCase() == 'GET') {
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
options.data = null; // data is null for 'get'
}
else
options.data = q; // data is the query string for 'post'
var $form = this, callbacks = [];
if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
// perform a load on the target only if dataType is not provided
if (!options.dataType && options.target) {
var oldSuccess = options.success || function(){};
callbacks.push(function(data) {
$(options.target).html(data).each(oldSuccess, arguments);
});
}
else if (options.success)
callbacks.push(options.success);
options.success = function(data, status) {
for (var i=0, max=callbacks.length; i < max; i++)
callbacks[i].apply(options, [data, status, $form]);
};
// are there files to upload?
var files = $('input:file', this).fieldValue();
var found = false;
for (var j=0; j < files.length; j++)
if (files[j])
found = true;
var multipart = false;
// var mp = 'multipart/form-data';
// multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
// options.iframe allows user to force iframe mode
if (options.iframe || found || multipart) {
// hack to fix Safari hang (thanks to Tim Molendijk for this)
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
if (options.closeKeepAlive)
$.get(options.closeKeepAlive, fileUpload);
else
fileUpload();
}
else
$.ajax(options);
// fire 'notify' event
this.trigger('form-submit-notify', [this, options]);
return this;
// private function for handling file uploads (hat tip to YAHOO!)
function fileUpload() {
var form = $form[0];
if ($(':input[name=submit]', form).length) {
alert('Error: Form elements must not be named "submit".');
return;
}
var opts = $.extend({}, $.ajaxSettings, options);
var s = $.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);
var id = 'jqFormIO' + (new Date().getTime());
var $io = $('<iframe id="' + id + '" name="' + id + '" src="about:blank" />');
var io = $io[0];
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
var xhr = { // mock object
aborted: 0,
responseText: null,
responseXML: null,
status: 0,
statusText: 'n/a',
getAllResponseHeaders: function() {},
getResponseHeader: function() {},
setRequestHeader: function() {},
abort: function() {
this.aborted = 1;
$io.attr('src','about:blank'); // abort op in progress
}
};
var g = opts.global;
// trigger ajax global events so that activity/block indicators work like normal
if (g && ! $.active++) $.event.trigger("ajaxStart");
if (g) $.event.trigger("ajaxSend", [xhr, opts]);
if (s.beforeSend && s.beforeSend(xhr, s) === false) {
s.global && $.active--;
return;
}
if (xhr.aborted)
return;
var cbInvoked = 0;
var timedOut = 0;
// add submitting element to data if we know it
var sub = form.clk;
if (sub) {
var n = sub.name;
if (n && !sub.disabled) {
options.extraData = options.extraData || {};
options.extraData[n] = sub.value;
if (sub.type == "image") {
options.extraData[name+'.x'] = form.clk_x;
options.extraData[name+'.y'] = form.clk_y;
}
}
}
// take a breath so that pending repaints get some cpu time before the upload starts
setTimeout(function() {
// make sure form attrs are set
var t = $form.attr('target'), a = $form.attr('action');
// update form attrs in IE friendly way
form.setAttribute('target',id);
if (form.getAttribute('method') != 'POST')
form.setAttribute('method', 'POST');
if (form.getAttribute('action') != opts.url)
form.setAttribute('action', opts.url);
// ie borks in some cases when setting encoding
if (! options.skipEncodingOverride) {
$form.attr({
encoding: 'multipart/form-data',
enctype: 'multipart/form-data'
});
}
// support timout
if (opts.timeout)
setTimeout(function() { timedOut = true; cb(); }, opts.timeout);
// add "extra" data to form if provided in options
var extraInputs = [];
try {
if (options.extraData)
for (var n in options.extraData)
extraInputs.push(
$('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />')
.appendTo(form)[0]);
// add iframe to doc and submit the form
$io.appendTo('body');
io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
form.submit();
}
finally {
// reset attrs and remove "extra" input elements
form.setAttribute('action',a);
t ? form.setAttribute('target', t) : $form.removeAttr('target');
$(extraInputs).remove();
}
}, 10);
var domCheckCount = 50;
function cb() {
if (cbInvoked++) return;
io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
var ok = true;
try {
if (timedOut) throw 'timeout';
// extract the server response from the iframe
var data, doc;
doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
var isXml = opts.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
log('isXml='+isXml);
if (!isXml && (doc.body == null || doc.body.innerHTML == '')) {
if (--domCheckCount) {
// in some browsers (Opera) the iframe DOM is not always traversable when
// the onload callback fires, so we loop a bit to accommodate
cbInvoked = 0;
setTimeout(cb, 100);
return;
}
log('Could not access iframe DOM after 50 tries.');
return;
}
xhr.responseText = doc.body ? doc.body.innerHTML : null;
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
xhr.getResponseHeader = function(header){
var headers = {'content-type': opts.dataType};
return headers[header];
};
if (opts.dataType == 'json' || opts.dataType == 'script') {
// see if user embedded response in textarea
var ta = doc.getElementsByTagName('textarea')[0];
if (ta)
xhr.responseText = ta.value;
else {
// account for browsers injecting pre around json response
var pre = doc.getElementsByTagName('pre')[0];
if (pre)
xhr.responseText = pre.innerHTML;
}
}
else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
xhr.responseXML = toXml(xhr.responseText);
}
data = $.httpData(xhr, opts.dataType);
}
catch(e){
ok = false;
$.handleError(opts, xhr, 'error', e);
}
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
if (ok) {
opts.success(data, 'success');
if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
}
if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
if (g && ! --$.active) $.event.trigger("ajaxStop");
if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
// clean up
setTimeout(function() {
$io.remove();
xhr.responseXML = null;
}, 100);
};
function toXml(s, doc) {
if (window.ActiveXObject) {
doc = new ActiveXObject('Microsoft.XMLDOM');
doc.async = 'false';
doc.loadXML(s);
}
else
doc = (new DOMParser()).parseFromString(s, 'text/xml');
return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
};
};
};
/**
* ajaxForm() provides a mechanism for fully automating form submission.
*
* The advantages of using this method instead of ajaxSubmit() are:
*
* 1: This method will include coordinates for <input type="image" /> elements (if the element
* is used to submit the form).
* 2. This method will include the submit element's name/value data (for the element that was
* used to submit the form).
* 3. This method binds the submit() method to the form for you.
*
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
* passes the options argument along after properly binding events for submit elements and
* the form itself.
*/
$.fn.ajaxForm = function(options) {
return this.ajaxFormUnbind().bind('submit.form-plugin', function() {
$(this).ajaxSubmit(options);
return false;
}).bind('click.form-plugin', function(e) {
var $el = $(e.target);
if (!($el.is(":submit,input:image"))) {
return;
}
var form = this;
form.clk = e.target;
if (e.target.type == 'image') {
if (e.offsetX != undefined) {
form.clk_x = e.offsetX;
form.clk_y = e.offsetY;
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
var offset = $el.offset();
form.clk_x = e.pageX - offset.left;
form.clk_y = e.pageY - offset.top;
} else {
form.clk_x = e.pageX - e.target.offsetLeft;
form.clk_y = e.pageY - e.target.offsetTop;
}
}
// clear form vars
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 10);
});
};
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
$.fn.ajaxFormUnbind = function() {
return this.unbind('submit.form-plugin click.form-plugin');
};
/**
* formToArray() gathers form element data into an array of objects that can
* be passed to any of the following ajax functions: $.get, $.post, or load.
* Each object in the array has both a 'name' and 'value' property. An example of
* an array for a simple login form might be:
*
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
*
* It is this array that is passed to pre-submit callback functions provided to the
* ajaxSubmit() and ajaxForm() methods.
*/
$.fn.formToArray = function(semantic) {
var a = [];
if (this.length == 0) return a;
var form = this[0];
var els = semantic ? form.getElementsByTagName('*') : form.elements;
if (!els) return a;
for(var i=0, max=els.length; i < max; i++) {
var el = els[i];
var n = el.name;
if (!n) continue;
if (semantic && form.clk && el.type == "image") {
// handle image inputs on the fly when semantic == true
if(!el.disabled && form.clk == el) {
a.push({name: n, value: $(el).val()});
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
}
continue;
}
var v = $.fieldValue(el, true);
if (v && v.constructor == Array) {
for(var j=0, jmax=v.length; j < jmax; j++)
a.push({name: n, value: v[j]});
}
else if (v !== null && typeof v != 'undefined')
a.push({name: n, value: v});
}
if (!semantic && form.clk) {
// input type=='image' are not found in elements array! handle it here
var $input = $(form.clk), input = $input[0], n = input.name;
if (n && !input.disabled && input.type == 'image') {
a.push({name: n, value: $input.val()});
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
}
}
return a;
};
/**
* Serializes form data into a 'submittable' string. This method will return a string
* in the format: name1=value1&amp;name2=value2
*/
$.fn.formSerialize = function(semantic) {
//hand off to jQuery.param for proper encoding
return $.param(this.formToArray(semantic));
};
/**
* Serializes all field elements in the jQuery object into a query string.
* This method will return a string in the format: name1=value1&amp;name2=value2
*/
$.fn.fieldSerialize = function(successful) {
var a = [];
this.each(function() {
var n = this.name;
if (!n) return;
var v = $.fieldValue(this, successful);
if (v && v.constructor == Array) {
for (var i=0,max=v.length; i < max; i++)
a.push({name: n, value: v[i]});
}
else if (v !== null && typeof v != 'undefined')
a.push({name: this.name, value: v});
});
//hand off to jQuery.param for proper encoding
return $.param(a);
};
/**
* Returns the value(s) of the element in the matched set. For example, consider the following form:
*
* <form><fieldset>
* <input name="A" type="text" />
* <input name="A" type="text" />
* <input name="B" type="checkbox" value="B1" />
* <input name="B" type="checkbox" value="B2"/>
* <input name="C" type="radio" value="C1" />
* <input name="C" type="radio" value="C2" />
* </fieldset></form>
*
* var v = $(':text').fieldValue();
* // if no values are entered into the text inputs
* v == ['','']
* // if values entered into the text inputs are 'foo' and 'bar'
* v == ['foo','bar']
*
* var v = $(':checkbox').fieldValue();
* // if neither checkbox is checked
* v === undefined
* // if both checkboxes are checked
* v == ['B1', 'B2']
*
* var v = $(':radio').fieldValue();
* // if neither radio is checked
* v === undefined
* // if first radio is checked
* v == ['C1']
*
* The successful argument controls whether or not the field element must be 'successful'
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
* The default value of the successful argument is true. If this value is false the value(s)
* for each element is returned.
*
* Note: This method *always* returns an array. If no valid value can be determined the
* array will be empty, otherwise it will contain one or more values.
*/
$.fn.fieldValue = function(successful) {
for (var val=[], i=0, max=this.length; i < max; i++) {
var el = this[i];
var v = $.fieldValue(el, successful);
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
continue;
v.constructor == Array ? $.merge(val, v) : val.push(v);
}
return val;
};
/**
* Returns the value of the field element.
*/
$.fieldValue = function(el, successful) {
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
if (typeof successful == 'undefined') successful = true;
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
(t == 'checkbox' || t == 'radio') && !el.checked ||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
tag == 'select' && el.selectedIndex == -1))
return null;
if (tag == 'select') {
var index = el.selectedIndex;
if (index < 0) return null;
var a = [], ops = el.options;
var one = (t == 'select-one');
var max = (one ? index+1 : ops.length);
for(var i=(one ? index : 0); i < max; i++) {
var op = ops[i];
if (op.selected) {
var v = op.value;
if (!v) // extra pain for IE...
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
if (one) return v;
a.push(v);
}
}
return a;
}
return el.value;
};
/**
* Clears the form data. Takes the following actions on the form's input fields:
* - input text fields will have their 'value' property set to the empty string
* - select elements will have their 'selectedIndex' property set to -1
* - checkbox and radio inputs will have their 'checked' property set to false
* - inputs of type submit, button, reset, and hidden will *not* be effected
* - button elements will *not* be effected
*/
$.fn.clearForm = function() {
return this.each(function() {
$('input,select,textarea', this).clearFields();
});
};
/**
* Clears the selected form elements.
*/
$.fn.clearFields = $.fn.clearInputs = function() {
return this.each(function() {
var t = this.type, tag = this.tagName.toLowerCase();
if (t == 'text' || t == 'password' || tag == 'textarea')
this.value = '';
else if (t == 'checkbox' || t == 'radio')
this.checked = false;
else if (tag == 'select')
this.selectedIndex = -1;
});
};
/**
* Resets the form data. Causes all form elements to be reset to their original value.
*/
$.fn.resetForm = function() {
return this.each(function() {
// guard against an input with the name of 'reset'
// note that IE reports the reset function as an 'object'
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
this.reset();
});
};
/**
* Enables or disables any matching elements.
*/
$.fn.enable = function(b) {
if (b == undefined) b = true;
return this.each(function() {
this.disabled = !b;
});
};
/**
* Checks/unchecks any matching checkboxes or radio buttons and
* selects/deselects and matching option elements.
*/
$.fn.selected = function(select) {
if (select == undefined) select = true;
return this.each(function() {
var t = this.type;
if (t == 'checkbox' || t == 'radio')
this.checked = select;
else if (this.tagName.toLowerCase() == 'option') {
var $sel = $(this).parent('select');
if (select && $sel[0] && $sel[0].type == 'select-one') {
// deselect all other options
$sel.find('option').selected(false);
}
this.selected = select;
}
});
};
// helper fn for console logging
// set $.fn.ajaxSubmit.debug to true to enable debug logging
function log() {
if ($.fn.ajaxSubmit.debug && window.console && window.console.log)
window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments,''));
};
})(jQuery);
Vendored Executable
+19
View File
File diff suppressed because one or more lines are too long
+148
View File
@@ -0,0 +1,148 @@
/*
* Metadata - jQuery plugin for parsing metadata from elements
*
* Copyright (c) 2006 John Resig, Yehuda Katz, Jörn Zaefferer, Paul McLanahan
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.metadata.js 3640 2007-10-11 18:34:38Z pmclanahan $
*
*/
/**
* Sets the type of metadata to use. Metadata is encoded in JSON, and each property
* in the JSON will become a property of the element itself.
*
* There are four supported types of metadata storage:
*
* attr: Inside an attribute. The name parameter indicates *which* attribute.
*
* class: Inside the class attribute, wrapped in curly braces: { }
*
* elem: Inside a child element (e.g. a script tag). The
* name parameter indicates *which* element.
* html5: Values are stored in data-* attributes.
*
* The metadata for an element is loaded the first time the element is accessed via jQuery.
*
* As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
* matched by expr, then redefine the metadata type and run another $(expr) for other elements.
*
* @name $.metadata.setType
*
* @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
* @before $.metadata.setType("class")
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
* @desc Reads metadata from the class attribute
*
* @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
* @before $.metadata.setType("attr", "data")
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
* @desc Reads metadata from a "data" attribute
*
* @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
* @before $.metadata.setType("elem", "script")
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
* @desc Reads metadata from a nested script element
*
* @example <p id="one" class="some_class" data-item_id="1" data-item_label="Label">This is a p</p>
* @before $.metadata.setType("html5")
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
* @desc Reads metadata from a series of data-* attributes
*
* @param String type The encoding type
* @param String name The name of the attribute to be used to get metadata (optional)
* @cat Plugins/Metadata
* @descr Sets the type of encoding to be used when loading metadata for the first time
* @type undefined
* @see metadata()
*/
(function($) {
$.extend({
metadata : {
defaults : {
type: 'class',
name: 'metadata',
cre: /({.*})/,
single: 'metadata'
},
setType: function( type, name ){
this.defaults.type = type;
this.defaults.name = name;
},
get: function( elem, opts ){
var settings = $.extend({},this.defaults,opts);
// check for empty string in single property
if ( !settings.single.length ) settings.single = 'metadata';
var data = $.data(elem, settings.single);
// returned cached data if it already exists
if ( data ) return data;
data = "{}";
var getData = function(data) {
if(typeof data != "string") return data;
if( data.indexOf('{') < 0 ) {
data = eval("(" + data + ")");
}
}
var getObject = function(data) {
if(typeof data != "string") return data;
data = eval("(" + data + ")");
return data;
}
if ( settings.type == "html5" ) {
var object = {};
$( elem.attributes ).each(function() {
var name = this.nodeName;
if(name.match(/^data-/)) name = name.replace(/^data-/, '');
else return true;
object[name] = getObject(this.nodeValue);
});
} else {
if ( settings.type == "class" ) {
var m = settings.cre.exec( elem.className );
if ( m )
data = m[1];
} else if ( settings.type == "elem" ) {
if( !elem.getElementsByTagName ) return;
var e = elem.getElementsByTagName(settings.name);
if ( e.length )
data = $.trim(e[0].innerHTML);
} else if ( elem.getAttribute != undefined ) {
var attr = elem.getAttribute( settings.name );
if ( attr )
data = attr;
}
object = getObject(data.indexOf("{") < 0 ? "{" + data + "}" : data);
}
$.data( elem, settings.single, object );
return object;
}
}
});
/**
* Returns the metadata object for the first member of the jQuery object.
*
* @name metadata
* @descr Returns element's metadata object
* @param Object opts An object contianing settings to override the defaults
* @type jQuery
* @cat Plugins/Metadata
*/
$.fn.metadata = function( opts ){
return $.metadata.get( this[0], opts );
};
})(jQuery);
Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

+404
View File
@@ -0,0 +1,404 @@
/*
* jQuery UI CSS Framework
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
*/
/* Layout helpers
----------------------------------*/
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
.ui-helper-clearfix { display: inline-block; }
/* required comment for clearfix to work in Opera \*/
* html .ui-helper-clearfix { height:1%; }
.ui-helper-clearfix { display:block; }
/* end clearfix */
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
/* Interaction Cues
----------------------------------*/
.ui-state-disabled { cursor: default !important; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/*
* jQuery UI CSS Framework
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
* To view and modify this theme, visit http://jqueryui.com/themeroller/
*/
/* Component containers
----------------------------------*/
.ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; }
.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; }
.ui-widget-content a { color: #222222/*{fcContent}*/; }
.ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; }
.ui-widget-header a { color: #222222/*{fcHeader}*/; }
/* Interaction states
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; outline: none; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; outline: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(images/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; outline: none; }
.ui-state-hover a, .ui-state-hover a:hover { color: #212121/*{fcHover}*/; text-decoration: none; outline: none; }
.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; outline: none; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; outline: none; text-decoration: none; }
/* Interaction Cues
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636/*{fcHighlight}*/; }
.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }
.ui-state-error a, .ui-widget-content .ui-state-error a { color: #cd0a0a/*{fcError}*/; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #cd0a0a/*{fcError}*/; }
.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; }
.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; }
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; }
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; }
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; }
/* positioning */
.ui-icon-carat-1-n { background-position: 0 0; }
.ui-icon-carat-1-ne { background-position: -16px 0; }
.ui-icon-carat-1-e { background-position: -32px 0; }
.ui-icon-carat-1-se { background-position: -48px 0; }
.ui-icon-carat-1-s { background-position: -64px 0; }
.ui-icon-carat-1-sw { background-position: -80px 0; }
.ui-icon-carat-1-w { background-position: -96px 0; }
.ui-icon-carat-1-nw { background-position: -112px 0; }
.ui-icon-carat-2-n-s { background-position: -128px 0; }
.ui-icon-carat-2-e-w { background-position: -144px 0; }
.ui-icon-triangle-1-n { background-position: 0 -16px; }
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
.ui-icon-triangle-1-e { background-position: -32px -16px; }
.ui-icon-triangle-1-se { background-position: -48px -16px; }
.ui-icon-triangle-1-s { background-position: -64px -16px; }
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
.ui-icon-triangle-1-w { background-position: -96px -16px; }
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.ui-icon-arrow-1-n { background-position: 0 -32px; }
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
.ui-icon-arrow-1-e { background-position: -32px -32px; }
.ui-icon-arrow-1-se { background-position: -48px -32px; }
.ui-icon-arrow-1-s { background-position: -64px -32px; }
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
.ui-icon-arrow-1-w { background-position: -96px -32px; }
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.ui-icon-arrow-4 { background-position: 0 -80px; }
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
.ui-icon-extlink { background-position: -32px -80px; }
.ui-icon-newwin { background-position: -48px -80px; }
.ui-icon-refresh { background-position: -64px -80px; }
.ui-icon-shuffle { background-position: -80px -80px; }
.ui-icon-transfer-e-w { background-position: -96px -80px; }
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
.ui-icon-folder-collapsed { background-position: 0 -96px; }
.ui-icon-folder-open { background-position: -16px -96px; }
.ui-icon-document { background-position: -32px -96px; }
.ui-icon-document-b { background-position: -48px -96px; }
.ui-icon-note { background-position: -64px -96px; }
.ui-icon-mail-closed { background-position: -80px -96px; }
.ui-icon-mail-open { background-position: -96px -96px; }
.ui-icon-suitcase { background-position: -112px -96px; }
.ui-icon-comment { background-position: -128px -96px; }
.ui-icon-person { background-position: -144px -96px; }
.ui-icon-print { background-position: -160px -96px; }
.ui-icon-trash { background-position: -176px -96px; }
.ui-icon-locked { background-position: -192px -96px; }
.ui-icon-unlocked { background-position: -208px -96px; }
.ui-icon-bookmark { background-position: -224px -96px; }
.ui-icon-tag { background-position: -240px -96px; }
.ui-icon-home { background-position: 0 -112px; }
.ui-icon-flag { background-position: -16px -112px; }
.ui-icon-calendar { background-position: -32px -112px; }
.ui-icon-cart { background-position: -48px -112px; }
.ui-icon-pencil { background-position: -64px -112px; }
.ui-icon-clock { background-position: -80px -112px; }
.ui-icon-disk { background-position: -96px -112px; }
.ui-icon-calculator { background-position: -112px -112px; }
.ui-icon-zoomin { background-position: -128px -112px; }
.ui-icon-zoomout { background-position: -144px -112px; }
.ui-icon-search { background-position: -160px -112px; }
.ui-icon-wrench { background-position: -176px -112px; }
.ui-icon-gear { background-position: -192px -112px; }
.ui-icon-heart { background-position: -208px -112px; }
.ui-icon-star { background-position: -224px -112px; }
.ui-icon-link { background-position: -240px -112px; }
.ui-icon-cancel { background-position: 0 -128px; }
.ui-icon-plus { background-position: -16px -128px; }
.ui-icon-plusthick { background-position: -32px -128px; }
.ui-icon-minus { background-position: -48px -128px; }
.ui-icon-minusthick { background-position: -64px -128px; }
.ui-icon-close { background-position: -80px -128px; }
.ui-icon-closethick { background-position: -96px -128px; }
.ui-icon-key { background-position: -112px -128px; }
.ui-icon-lightbulb { background-position: -128px -128px; }
.ui-icon-scissors { background-position: -144px -128px; }
.ui-icon-clipboard { background-position: -160px -128px; }
.ui-icon-copy { background-position: -176px -128px; }
.ui-icon-contact { background-position: -192px -128px; }
.ui-icon-image { background-position: -208px -128px; }
.ui-icon-video { background-position: -224px -128px; }
.ui-icon-script { background-position: -240px -128px; }
.ui-icon-alert { background-position: 0 -144px; }
.ui-icon-info { background-position: -16px -144px; }
.ui-icon-notice { background-position: -32px -144px; }
.ui-icon-help { background-position: -48px -144px; }
.ui-icon-check { background-position: -64px -144px; }
.ui-icon-bullet { background-position: -80px -144px; }
.ui-icon-radio-off { background-position: -96px -144px; }
.ui-icon-radio-on { background-position: -112px -144px; }
.ui-icon-pin-w { background-position: -128px -144px; }
.ui-icon-pin-s { background-position: -144px -144px; }
.ui-icon-play { background-position: 0 -160px; }
.ui-icon-pause { background-position: -16px -160px; }
.ui-icon-seek-next { background-position: -32px -160px; }
.ui-icon-seek-prev { background-position: -48px -160px; }
.ui-icon-seek-end { background-position: -64px -160px; }
.ui-icon-seek-first { background-position: -80px -160px; }
.ui-icon-stop { background-position: -96px -160px; }
.ui-icon-eject { background-position: -112px -160px; }
.ui-icon-volume-off { background-position: -128px -160px; }
.ui-icon-volume-on { background-position: -144px -160px; }
.ui-icon-power { background-position: 0 -176px; }
.ui-icon-signal-diag { background-position: -16px -176px; }
.ui-icon-signal { background-position: -32px -176px; }
.ui-icon-battery-0 { background-position: -48px -176px; }
.ui-icon-battery-1 { background-position: -64px -176px; }
.ui-icon-battery-2 { background-position: -80px -176px; }
.ui-icon-battery-3 { background-position: -96px -176px; }
.ui-icon-circle-plus { background-position: 0 -192px; }
.ui-icon-circle-minus { background-position: -16px -192px; }
.ui-icon-circle-close { background-position: -32px -192px; }
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
.ui-icon-circle-zoomin { background-position: -176px -192px; }
.ui-icon-circle-zoomout { background-position: -192px -192px; }
.ui-icon-circle-check { background-position: -208px -192px; }
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
.ui-icon-circlesmall-close { background-position: -32px -208px; }
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
.ui-icon-squaresmall-close { background-position: -80px -208px; }
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
/* Misc visuals
----------------------------------*/
/* Corner radius */
.ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; }
.ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; }
.ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; }
.ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; }
.ui-corner-top { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; }
.ui-corner-bottom { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; }
.ui-corner-right { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; }
.ui-corner-left { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; }
.ui-corner-all { -moz-border-radius: 4px/*{cornerRadius}*/; -webkit-border-radius: 4px/*{cornerRadius}*/; }
/* Overlays */
.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; }/* Accordion
----------------------------------*/
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
.ui-accordion .ui-accordion-li-fix { display: inline; }
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; }
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; }
.ui-accordion .ui-accordion-content-active { display: block; }/* Datepicker
----------------------------------*/
.ui-datepicker { width: 17em; padding: .2em .2em 0; }
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
.ui-datepicker .ui-datepicker-prev { left:2px; }
.ui-datepicker .ui-datepicker-next { right:2px; }
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; }
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year { width: 49%;}
.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; }
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
.ui-datepicker td { border: 0; padding: 1px; }
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
/* with multiple calendars */
.ui-datepicker.ui-datepicker-multi { width:auto; }
.ui-datepicker-multi .ui-datepicker-group { float:left; }
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
.ui-datepicker-row-break { clear:both; width:100%; }
/* RTL support */
.ui-datepicker-rtl { direction: rtl; }
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
.ui-datepicker-cover {
display: none; /*sorry for IE5*/
display/**/: block; /*sorry for IE5*/
position: absolute; /*must have*/
z-index: -1; /*must have*/
filter: mask(); /*must have*/
top: -4px; /*must have*/
left: -4px; /*must have*/
width: 200px; /*must have*/
height: 200px; /*must have*/
}/* Dialog
----------------------------------*/
.ui-dialog { position: relative; padding: .2em; width: 300px; }
.ui-dialog .ui-dialog-titlebar { padding: .5em .3em .3em 1em; position: relative; }
.ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em; }
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
.ui-draggable .ui-dialog-titlebar { cursor: move; }
/* Progressbar
----------------------------------*/
.ui-progressbar { height:2em; text-align: left; }
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/* Resizable
----------------------------------*/
.ui-resizable { position: relative;}
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; }
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; }
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; }
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; }
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Slider
----------------------------------*/
.ui-slider { position: relative; text-align: left; }
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; }
.ui-slider-horizontal { height: .8em; }
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
.ui-slider-vertical { width: .8em; height: 100px; }
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs
----------------------------------*/
.ui-tabs { padding: .2em; zoom: 1; }
.ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: .2em .2em 0; }
.ui-tabs .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; }
.ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: .5em 1em; }
.ui-tabs .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 1px; border-bottom-width: 0; }
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
.ui-tabs .ui-tabs-panel { padding: 1em 1.4em; display: block; border-width: 0; background: none; }
.ui-tabs .ui-tabs-hide { display: none !important; }
+9
View File
@@ -0,0 +1,9 @@
/* Accordion
----------------------------------*/
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
.ui-accordion .ui-accordion-li-fix { display: inline; }
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; }
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; }
.ui-accordion .ui-accordion-content-active { display: block; }
+2
View File
@@ -0,0 +1,2 @@
@import "ui.base.css";
@import "ui.theme.css";
+9
View File
@@ -0,0 +1,9 @@
@import url("ui.core.css");
/*@import url("ui.accordion.css");*/
/*@import url("ui.datepicker.css");*/
@import url("ui.dialog.css");
/*@import url("ui.progressbar.css");*/
@import url("ui.resizable.css");
/*@import url("ui.slider.css");*/
@import url("ui.tabs.css");
+37
View File
@@ -0,0 +1,37 @@
/*
* jQuery UI CSS Framework
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
*/
/* Layout helpers
----------------------------------*/
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
.ui-helper-clearfix { display: inline-block; }
/* required comment for clearfix to work in Opera \*/
* html .ui-helper-clearfix { height:1%; }
.ui-helper-clearfix { display:block; }
/* end clearfix */
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
/* Interaction Cues
----------------------------------*/
.ui-state-disabled { cursor: default !important; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+62
View File
@@ -0,0 +1,62 @@
/* Datepicker
----------------------------------*/
.ui-datepicker { width: 17em; padding: .2em .2em 0; }
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
.ui-datepicker .ui-datepicker-prev { left:2px; }
.ui-datepicker .ui-datepicker-next { right:2px; }
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; }
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year { width: 49%;}
.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; }
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
.ui-datepicker td { border: 0; padding: 1px; }
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
/* with multiple calendars */
.ui-datepicker.ui-datepicker-multi { width:auto; }
.ui-datepicker-multi .ui-datepicker-group { float:left; }
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
.ui-datepicker-row-break { clear:both; width:100%; }
/* RTL support */
.ui-datepicker-rtl { direction: rtl; }
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
.ui-datepicker-cover {
display: none; /*sorry for IE5*/
display/**/: block; /*sorry for IE5*/
position: absolute; /*must have*/
z-index: -1; /*must have*/
filter: mask(); /*must have*/
top: -4px; /*must have*/
left: -4px; /*must have*/
width: 200px; /*must have*/
height: 200px; /*must have*/
}
+13
View File
@@ -0,0 +1,13 @@
/* Dialog
----------------------------------*/
.ui-dialog { position: relative; padding: .2em; width: 300px; }
.ui-dialog .ui-dialog-titlebar { padding: .5em .3em .3em 1em; position: relative; }
.ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em; }
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
.ui-draggable .ui-dialog-titlebar { cursor: move; }
+4
View File
@@ -0,0 +1,4 @@
/* Progressbar
----------------------------------*/
.ui-progressbar { height:2em; text-align: left; }
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
+13
View File
@@ -0,0 +1,13 @@
/* Resizable
----------------------------------*/
.ui-resizable { position: relative;}
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; }
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; }
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; }
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; }
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}
+17
View File
@@ -0,0 +1,17 @@
/* Slider
----------------------------------*/
.ui-slider { position: relative; text-align: left; }
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; }
.ui-slider-horizontal { height: .8em; }
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
.ui-slider-vertical { width: .8em; height: 100px; }
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
.ui-slider-vertical .ui-slider-range-max { top: 0; }
+11
View File
@@ -0,0 +1,11 @@
/* Tabs
----------------------------------*/
.ui-tabs { padding: .2em; zoom: 1; }
.ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: .2em .2em 0; }
.ui-tabs .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; }
.ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: .5em 1em; }
.ui-tabs .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 1px; border-bottom-width: 0; }
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
.ui-tabs .ui-tabs-panel { padding: 1em 1.4em; display: block; border-width: 0; background: none; }
.ui-tabs .ui-tabs-hide { display: none !important; }
+245
View File
@@ -0,0 +1,245 @@
/*
* jQuery UI CSS Framework
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
* To view and modify this theme, visit http://jqueryui.com/themeroller/
*/
/* Component containers
----------------------------------*/
.ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; }
.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; }
.ui-widget-content a { color: #222222/*{fcContent}*/; }
.ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; }
.ui-widget-header a { color: #222222/*{fcHeader}*/; }
/* Interaction states
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; outline: none; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; outline: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(images/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; outline: none; }
.ui-state-hover a, .ui-state-hover a:hover { color: #212121/*{fcHover}*/; text-decoration: none; outline: none; }
.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; outline: none; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; outline: none; text-decoration: none; }
/* Interaction Cues
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636/*{fcHighlight}*/; }
.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }
.ui-state-error a, .ui-widget-content .ui-state-error a { color: #cd0a0a/*{fcError}*/; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #cd0a0a/*{fcError}*/; }
.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; }
.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; }
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; }
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; }
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; }
/* positioning */
.ui-icon-carat-1-n { background-position: 0 0; }
.ui-icon-carat-1-ne { background-position: -16px 0; }
.ui-icon-carat-1-e { background-position: -32px 0; }
.ui-icon-carat-1-se { background-position: -48px 0; }
.ui-icon-carat-1-s { background-position: -64px 0; }
.ui-icon-carat-1-sw { background-position: -80px 0; }
.ui-icon-carat-1-w { background-position: -96px 0; }
.ui-icon-carat-1-nw { background-position: -112px 0; }
.ui-icon-carat-2-n-s { background-position: -128px 0; }
.ui-icon-carat-2-e-w { background-position: -144px 0; }
.ui-icon-triangle-1-n { background-position: 0 -16px; }
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
.ui-icon-triangle-1-e { background-position: -32px -16px; }
.ui-icon-triangle-1-se { background-position: -48px -16px; }
.ui-icon-triangle-1-s { background-position: -64px -16px; }
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
.ui-icon-triangle-1-w { background-position: -96px -16px; }
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.ui-icon-arrow-1-n { background-position: 0 -32px; }
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
.ui-icon-arrow-1-e { background-position: -32px -32px; }
.ui-icon-arrow-1-se { background-position: -48px -32px; }
.ui-icon-arrow-1-s { background-position: -64px -32px; }
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
.ui-icon-arrow-1-w { background-position: -96px -32px; }
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.ui-icon-arrow-4 { background-position: 0 -80px; }
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
.ui-icon-extlink { background-position: -32px -80px; }
.ui-icon-newwin { background-position: -48px -80px; }
.ui-icon-refresh { background-position: -64px -80px; }
.ui-icon-shuffle { background-position: -80px -80px; }
.ui-icon-transfer-e-w { background-position: -96px -80px; }
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
.ui-icon-folder-collapsed { background-position: 0 -96px; }
.ui-icon-folder-open { background-position: -16px -96px; }
.ui-icon-document { background-position: -32px -96px; }
.ui-icon-document-b { background-position: -48px -96px; }
.ui-icon-note { background-position: -64px -96px; }
.ui-icon-mail-closed { background-position: -80px -96px; }
.ui-icon-mail-open { background-position: -96px -96px; }
.ui-icon-suitcase { background-position: -112px -96px; }
.ui-icon-comment { background-position: -128px -96px; }
.ui-icon-person { background-position: -144px -96px; }
.ui-icon-print { background-position: -160px -96px; }
.ui-icon-trash { background-position: -176px -96px; }
.ui-icon-locked { background-position: -192px -96px; }
.ui-icon-unlocked { background-position: -208px -96px; }
.ui-icon-bookmark { background-position: -224px -96px; }
.ui-icon-tag { background-position: -240px -96px; }
.ui-icon-home { background-position: 0 -112px; }
.ui-icon-flag { background-position: -16px -112px; }
.ui-icon-calendar { background-position: -32px -112px; }
.ui-icon-cart { background-position: -48px -112px; }
.ui-icon-pencil { background-position: -64px -112px; }
.ui-icon-clock { background-position: -80px -112px; }
.ui-icon-disk { background-position: -96px -112px; }
.ui-icon-calculator { background-position: -112px -112px; }
.ui-icon-zoomin { background-position: -128px -112px; }
.ui-icon-zoomout { background-position: -144px -112px; }
.ui-icon-search { background-position: -160px -112px; }
.ui-icon-wrench { background-position: -176px -112px; }
.ui-icon-gear { background-position: -192px -112px; }
.ui-icon-heart { background-position: -208px -112px; }
.ui-icon-star { background-position: -224px -112px; }
.ui-icon-link { background-position: -240px -112px; }
.ui-icon-cancel { background-position: 0 -128px; }
.ui-icon-plus { background-position: -16px -128px; }
.ui-icon-plusthick { background-position: -32px -128px; }
.ui-icon-minus { background-position: -48px -128px; }
.ui-icon-minusthick { background-position: -64px -128px; }
.ui-icon-close { background-position: -80px -128px; }
.ui-icon-closethick { background-position: -96px -128px; }
.ui-icon-key { background-position: -112px -128px; }
.ui-icon-lightbulb { background-position: -128px -128px; }
.ui-icon-scissors { background-position: -144px -128px; }
.ui-icon-clipboard { background-position: -160px -128px; }
.ui-icon-copy { background-position: -176px -128px; }
.ui-icon-contact { background-position: -192px -128px; }
.ui-icon-image { background-position: -208px -128px; }
.ui-icon-video { background-position: -224px -128px; }
.ui-icon-script { background-position: -240px -128px; }
.ui-icon-alert { background-position: 0 -144px; }
.ui-icon-info { background-position: -16px -144px; }
.ui-icon-notice { background-position: -32px -144px; }
.ui-icon-help { background-position: -48px -144px; }
.ui-icon-check { background-position: -64px -144px; }
.ui-icon-bullet { background-position: -80px -144px; }
.ui-icon-radio-off { background-position: -96px -144px; }
.ui-icon-radio-on { background-position: -112px -144px; }
.ui-icon-pin-w { background-position: -128px -144px; }
.ui-icon-pin-s { background-position: -144px -144px; }
.ui-icon-play { background-position: 0 -160px; }
.ui-icon-pause { background-position: -16px -160px; }
.ui-icon-seek-next { background-position: -32px -160px; }
.ui-icon-seek-prev { background-position: -48px -160px; }
.ui-icon-seek-end { background-position: -64px -160px; }
.ui-icon-seek-first { background-position: -80px -160px; }
.ui-icon-stop { background-position: -96px -160px; }
.ui-icon-eject { background-position: -112px -160px; }
.ui-icon-volume-off { background-position: -128px -160px; }
.ui-icon-volume-on { background-position: -144px -160px; }
.ui-icon-power { background-position: 0 -176px; }
.ui-icon-signal-diag { background-position: -16px -176px; }
.ui-icon-signal { background-position: -32px -176px; }
.ui-icon-battery-0 { background-position: -48px -176px; }
.ui-icon-battery-1 { background-position: -64px -176px; }
.ui-icon-battery-2 { background-position: -80px -176px; }
.ui-icon-battery-3 { background-position: -96px -176px; }
.ui-icon-circle-plus { background-position: 0 -192px; }
.ui-icon-circle-minus { background-position: -16px -192px; }
.ui-icon-circle-close { background-position: -32px -192px; }
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
.ui-icon-circle-zoomin { background-position: -176px -192px; }
.ui-icon-circle-zoomout { background-position: -192px -192px; }
.ui-icon-circle-check { background-position: -208px -192px; }
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
.ui-icon-circlesmall-close { background-position: -32px -208px; }
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
.ui-icon-squaresmall-close { background-position: -80px -208px; }
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
/* Misc visuals
----------------------------------*/
/* Corner radius */
.ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; }
.ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; }
.ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; }
.ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; }
.ui-corner-top { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; }
.ui-corner-bottom { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; }
.ui-corner-right { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; }
.ui-corner-left { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; }
.ui-corner-all { -moz-border-radius: 4px/*{cornerRadius}*/; -webkit-border-radius: 4px/*{cornerRadius}*/; }
/* Overlays */
.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; }
+9
View File
@@ -0,0 +1,9 @@
elfinder.full.css
elfinder.full.js
elfinder.min.js
elrte.full.css
elrte.full.js
elrte.min.js
elrtefinder.full.css
elrtefinder.full.js
elrtefinder.min.js
+259
View File
@@ -0,0 +1,259 @@
# build relese
# author: Troex Nevelin <troex@fury.scancode.ru>
Q= @
CAT= cat
RM= rm
CP= cp
SRC= .
DST= ..
CSS= ${DST}/css
JS= ${DST}/js
I18N= ${DST}/js/i18n
CONN= ${DST}/connectors
IMG= ${DST}/images
# used as ${COMPRESSOR} OUT IN
COMPRESSOR= java -jar ../../yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar \
--charset utf8 -o
PHONY: help
all: elrte elfinder elrtefinder
clean: clean-elrte clean-elfinder clean-elrtefinder
install: elrte-install elfinder-install elrtefinder-install
uninstall: ellib-uninstall elrte-uninstall elfinder-uninstall elrtefinder-uninstall \
connectors-uninstall
distclean: uninstall clean
help:
@echo 'Makefile for release build automation'
@echo ' Packages:'
@echo ' elrte - elRTE WYSIWYG html editor'
@echo ' elfinder - elFinder file manager for web'
@echo ' elrtefinder - bundled elRTE and elFinder in one pack'
@echo ''
@echo ' MAKE targets:'
@echo ' all - build all packages'
@echo ' help - show this message'
@echo ' install - install all packages, will auto build'
@echo ' uninstall - remove all generated files from DST (${DST})'
@echo ' clean - remove generated files from SRC (${SRC})'
@echo ' distclean - preform uninstall and clean'
@echo ''
@echo ' Individual package targets are possible. To build single package replace PACKAGE'
@echo ' with name from "Packages" section:'
@echo ' PACKAGE'
@echo ' PACKAGE-install'
@echo ' PACKAGE-unstall'
@echo ' clean-PACKAGE'
# define objects
# elLib
ellib_img_obj= ${SRC}/ellib/images/eldirtree.png \
${SRC}/ellib/images/loading.gif
ellib_img_obj_dst=${IMG}/eldirtree.png \
${IMG}/loading.gif
# elRTE
elrte_css= elrte.full.css
elrte_css_obj= ${SRC}/ellib/css/elcommon.css \
${SRC}/ellib/css/elcolorpicker.css \
${SRC}/ellib/css/elcontextmenu.css \
${SRC}/ellib/css/eldialogform.css \
${SRC}/ellib/css/eldirtree.css \
${SRC}/ellib/css/elpaddinginput.css \
${SRC}/ellib/css/elselect.css \
${SRC}/elrte/css/elrte.css
elrte_js= elrte.full.js
elrte_js_min= elrte.min.js
elrte_js_obj= ${SRC}/ellib/js/elcookie.js \
${SRC}/ellib/js/eli18n.js \
${SRC}/ellib/js/eldialogform.js \
${SRC}/ellib/js/jquery.elcolorpicker.js \
${SRC}/ellib/js/jquery.elborderselect.js \
${SRC}/ellib/js/jquery.elcontextmenu.js \
${SRC}/ellib/js/jquery.eldirtree.js \
${SRC}/ellib/js/jquery.elpaddinginput.js \
${SRC}/ellib/js/jquery.elselect.js \
${SRC}/elrte/js/elRTE.js \
${SRC}/elrte/js/elRTE.*.js \
${SRC}/elrte/js/ui/*.js
# elFinder
elfinder_css= elfinder.full.css
elfinder_css_obj= ${SRC}/ellib/css/elcommon.css \
${SRC}/ellib/css/eldialogform.css \
${SRC}/ellib/css/eldirtree.css \
${SRC}/ellib/css/elcontextmenu.css \
${SRC}/elfinder/css/elfinder.css
elfinder_js= elfinder.full.js
elfinder_js_min= elfinder.min.js
elfinder_js_obj= ${SRC}/ellib/js/eli18n.js \
${SRC}/ellib/js/elcookie.js \
${SRC}/ellib/js/eldialogform.js \
${SRC}/ellib/js/jquery.eldirtree.js \
${SRC}/ellib/js/jquery.elcontextmenu.js \
${SRC}/elfinder/js/elfinder.js
# elRTE + elFinder
elrtefin_css= elrtefinder.full.css
elrtefin_css_obj= ${SRC}/ellib/css/elcommon.css \
${SRC}/ellib/css/elcolorpicker.css \
${SRC}/ellib/css/elcontextmenu.css \
${SRC}/ellib/css/eldialogform.css \
${SRC}/ellib/css/eldirtree.css \
${SRC}/ellib/css/elpaddinginput.css \
${SRC}/ellib/css/elselect.css \
${SRC}/elfinder/css/elfinder.css \
${SRC}/elrte/css/elrte.css
elrtefin_js= elrtefinder.full.js
elrtefin_js_min= elrtefinder.min.js
elrtefin_js_obj= ${SRC}/ellib/js/elcookie.js \
${SRC}/ellib/js/eli18n.js \
${SRC}/ellib/js/eldialogform.js \
${SRC}/ellib/js/jquery.elcolorpicker.js \
${SRC}/ellib/js/jquery.elborderselect.js \
${SRC}/ellib/js/jquery.elcontextmenu.js \
${SRC}/ellib/js/jquery.eldirtree.js \
${SRC}/ellib/js/jquery.elpaddinginput.js \
${SRC}/ellib/js/jquery.elselect.js \
${SRC}/elfinder/js/elfinder.js \
${SRC}/elrte/js/elRTE.js \
${SRC}/elrte/js/elRTE.*.js \
${SRC}/elrte/js/ui/*.js
# elLib
ellib-install:
${CP} ${ellib_img_obj} ${IMG}/
ellib-uninstall:
${RM} -f ${ellib_img_obj_dst}
# elRTE
elrte: ${elrte_css} ${elrte_js}
elrte-install: elrte ellib-install
${CP} ${elrte_css} ${SRC}/elrte/css/elrte-inner.css ${CSS}/
${CP} ${elrte_js} ${JS}/
${CP} ${SRC}/elrte/js/i18n/elrte.??.js ${I18N}/
${CP} ${SRC}/elrte/images/elrte-* ${IMG}/
${elrte_css}:
${CAT} ${elrte_css_obj} > $@
${elrte_js}:
${CAT} ${elrte_js_obj} > $@
elrte-uninstall:
${RM} -f ${CSS}/${elrte_css} ${CSS}/elrte-inner.css \
${JS}/${elrte_js} ${JS}/${elrte_js_min} ${I18N}/elrte.??.js ${IMG}/elrte-*
clean-elrte:
${RM} -f ${elrte_css} ${elrte_js} ${elrte_js_min}
# elFinder
elfinder: ${elfinder_css} ${elfinder_js}
elfinder-install: elfinder ellib-install connectors-install
${CP} ${elfinder_css} ${CSS}/
${CP} ${elfinder_js} ${JS}/
${CP} ${SRC}/elfinder/js/i18n/elfinder.??.js ${I18N}/
${CP} ${SRC}/elfinder/images/elfinder-* ${IMG}/
${elfinder_css}:
${CAT} ${elfinder_css_obj} > $@
${elfinder_js}:
${CAT} ${elfinder_js_obj} > $@
elfinder-uninstall:
${RM} -f ${CSS}/${elfinder_css} ${JS}/${elfinder_js} ${JS}/${elfinder_js_min} \
${I18N}/elfinder.??.js ${IMG}/elfinder-*
clean-elfinder:
${RM} -f ${elfinder_css} ${elfinder_js} ${elfinder_js_min}
# elRTE + elFinder
elrtefinder: ${elrtefin_css} ${elrtefin_js}
elrtefinder-install: elrtefinder ellib-install connectors-install
${CP} ${elrtefin_css} ${SRC}/elrte/css/elrte-inner.css ${CSS}/
${CP} ${elrtefin_js} ${JS}/
${CP} ${SRC}/elrte/css/elrte-inner.css ${CSS}/
${CP} ${SRC}/elrte/js/i18n/elrte.??.js ${I18N}/
${CP} ${SRC}/elfinder/js/i18n/elfinder.??.js ${I18N}/
${elrtefin_css}:
${CAT} ${elrtefin_css_obj} > $@
${elrtefin_js}:
${CAT} ${elrtefin_js_obj} > $@
elrtefinder-uninstall:
${RM} -f ${CSS}/${elrtefin_css} ${CSS}/elrte-inner.css \
${JS}/${elrtefin_js} ${JS}/${elrtefin_js_min} \
${I18N}/elfinder.??.js ${I18N}/elrte.??.js
clean-elrtefinder:
${RM} -f ${elrtefin_css} ${elrtefin_js} ${elrtefin_js_min}
# connectors
connectors-install:
${CP} -R ${SRC}/elfinder/connectors/* ${CONN}/
${CP} ${CONN}/php/connector.php ${CONN}/php/connector.php.tmp
${CAT} ${CONN}/php/connector.php.tmp \
| sed -e s_/src/elfinder/connectors/php_/connectors/php_ \
> ${CONN}/php/connector.php
${RM} ${CONN}/php/connector.php.tmp
connectors-uninstall:
${RM} -rf ${CONN}/*
# compressor
elrte-compress:
${COMPRESSOR} ${elrte_js_min} ${elrte_js}
elfinder-compress:
${COMPRESSOR} ${elfinder_js_min} ${elfinder_js}
elrtefinder-compress:
${COMPRESSOR} ${elrtefin_js_min} ${elrtefin_js}
elrte-compress-install:
${CP} ${SRC}/${elrte_js_min} ${JS}/
elfinder-compress-install:
${CP} ${SRC}/${elfinder_js_min} ${JS}/
elrtefinder-compress-install:
${CP} ${SRC}/${elrtefin_js_min} ${JS}/
ifdef COMPRESSOR
elrte: elrte-compress
elfinder: elfinder-compress
elrtefinder: elrtefinder-compress
elrte-install: elrte-compress-install
elfinder-install: elfinder-compress-install
elrtefinder-install: elrtefinder-compress-install
endif
+39
View File
@@ -0,0 +1,39 @@
<?php
error_reporting(0);
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinder.class.php';
$path = str_replace($_SERVER['DOCUMENT_ROOT'], '', dirname(__FILE__));
$path = str_replace('/src/elfinder/connectors/php', '', $path);
$rootDir = $_SERVER['DOCUMENT_ROOT'].$path.DIRECTORY_SEPARATOR.'files';
$rootURL = 'http://'.$_SERVER['HTTP_HOST'].$path.'/files/';
// echo $rootDir.'<br>'.$rootURL;
$dir = $rootDir.DIRECTORY_SEPARATOR.'Documents';
$opts = array(
'root' => $rootDir,
'URL' => $rootURL,
'tplDir' => realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.'tpl'),
'lang' => 'ru',
'defaults' => array(
'read' => true,
'write' => false
),
'perms' => array(
$dir => array(
'read' => true,
'write'=> true
)
)
);
$translator = new elTranslator();
$translator->loadMessages('ru', dirname(__FILE__).DIRECTORY_SEPARATOR.'i18n'.DIRECTORY_SEPARATOR.'ru.php', 'elMsg');
$fm = new elFinder($opts);
$fm->setTranslator($translator);
$fm->autorun();
?>
File diff suppressed because it is too large Load Diff
+88
View File
@@ -0,0 +1,88 @@
<?php
/**
* Messages for Finder module
* lang = ru, charset = UTF-8
*/
$elMsg = array();
$elMsg['File name'] = 'Имя файла';
$elMsg['Back'] = 'Назад';
$elMsg['Reload'] = 'Обновить';
$elMsg['Select file'] = 'Выбрать файл';
$elMsg['Open'] = 'Открыть';
$elMsg['Rename'] = 'Переименовать';
$elMsg['Edit text document'] = 'Редактировать текстовый файл';
$elMsg['Delete'] = 'Удалить';
$elMsg['Get info'] = 'Свойство';
$elMsg['Create directory'] = 'Создать папку';
$elMsg['Upload files'] = 'Загрузить файл';
$elMsg['Copy'] = 'Копировать';
$elMsg['Cut'] = 'Вырезать';
$elMsg['Paste'] = 'Вставить';
$elMsg['View as big icons'] = 'Большие иконки';
$elMsg['View as small icons'] = 'Маленькие иконки';
$elMsg['View as list'] = 'Список';
$elMsg['Toggle view of actions results dialogs'] = 'Отключить/Включить оповещение о действиях';
$elMsg['Help'] = 'Помощь';
$elMsg['Files'] = 'Файлы';
$elMsg['Access'] = 'Доступ';
$elMsg['Date modified'] = 'Изменен';
$elMsg['Name'] = 'Имя';
$elMsg['Size'] = 'Размер';
$elMsg['Kind'] = 'Тип';
$elMsg['Directory'] = 'Папка';
$elMsg['read '] = 'чтение';
$elMsg['write'] = 'запись';
$elMsg['read write'] = 'чтение/запись';
$elMsg['Modified'] = 'Изменен';
$elMsg['Last opened'] = 'Открыт';
$elMsg['Access denied!'] = 'Доступ запрещен!';
$elMsg['File was not found. Invalid parameters.'] = 'Файл не найден. Неверные параметры.';
$elMsg['File not found'] = 'Файл не найден.';
$elMsg['File was not found.'] = 'Файл не найден.';
$elMsg['Dimensions'] = 'Разрешение';
$elMsg['Charset'] = 'Кодировка';
$elMsg['Unable to create directory. Invalid parameters.'] = 'Не удается создать папку. Неверные параметры.';
$elMsg['Invalid directory name'] = 'Неправильное имя папки';
$elMsg['Directory or file with the same name already exists'] = 'Папка или файл с таким именем уже существует';
$elMsg['Unable to create directory %s'] = 'Не удается создать папку %s';
$elMsg['Directory %s was created'] = 'Папка %s создана';
$elMsg['Unable to rename. Invalid parameters.'] = 'Не удалось переименовать. Неверные параметры.';
$elMsg['New name is equal to old one.'] = 'Именя совпадают';
$elMsg['File or directory with the same name already exists'] = 'Файл или папка с таким именем уже существует';
$elMsg['Rename %s to %s failed'] = 'Не удалось переименовать %s в %s ';
$elMsg['%s was renamed to %s'] = '%s переименован в %s';
$elMsg['File was saved'] = 'Файл сохранен';
$elMsg['Unable to save file'] = 'Не удается сохранить файл';
$elMsg['Unable to paste files. Invalid parameters.'] = 'Не удается сохранить файл. Неверные параметры.';
$elMsg['Unable to paste files. No one file was copied.'] = 'Не удается сохранить файл. Не один файл не был скопирован';
$elMsg['File does not exists'] = 'Файл не существует';
$elMsg['Unable to copy %s'] = 'Не удается скопировать %s';
$elMsg['Unable to delete %s'] = 'Не удается удалить %s';
$elMsg['Paste complite'] = 'Выполнено';
$elMsg['Unable to delete. Invalid parameters.'] = 'Не удается удалить. Неверные параметры.';
$elMsg['Files removed'] = 'Файл удален';
$elMsg['Unable to upload files. Invalid parameters.'] = 'Не удается загрузить файлы. Неверные параметры.';
$elMsg['Access denied.'] = 'Доступ запрещен!';
$elMsg['Select at least one file to upload'] = 'Выберите как минимум один файл для загрузки';
$elMsg['File exceeds the maximum allowed filesize'] = 'Файл превышает максимально допустимый размер';
$elMsg['File was only partially uploaded'] = 'Файл был получен не полностью';
$elMsg['No file was uploaded'] = 'Файлы не были загружены';
$elMsg['Missing a temporary folder'] = 'Невозможно найти папку для временных файлов';
$elMsg['Failed to write file to disk'] = 'Ошибка записи файла на диск';
$elMsg['Not allowed file type'] = 'Не допускается тип файла';
$elMsg['Invalid file name'] = 'Неправильное имя файла';
$elMsg['Unable to save uploaded file'] = 'Не удается сохранить загруженный файл';
$elMsg['Files upload failed'] = 'Сбой при загрузке файлов';
$elMsg['Files successfully uploaded'] = 'Файлы успешно загружены';
$elMsg['Following files was uploaded: %s'] = 'Были загружены следующие файлы: %s';
$elMsg['Image'] = 'Изображение';
$elMsg['Text document'] = 'Текстовый документ';
$elMsg['Audio file'] = 'Аудио файл';
$elMsg['Video file'] = 'Видео файл';
$elMsg['Unknown'] = 'Неопределенно';
$elMsg['is not an image'] = 'не является изображением';
$elMsg['File'] = 'Файл';
$elMsg['Unable to load image '] = 'Невозможно загрузить изображение ';
$elMsg['Unable to resize image '] = 'Невозможно изменить размер изображения ';
?>
@@ -0,0 +1,41 @@
<div class="el-finder rounded-3">
<!-- <div class="el-finder-toolbar"> -->
<ul class="el-finder-toolbar">
<li class="rounded-3 button-back" title="{Back}"></li>
<li class="rounded-3 button-reload" title="{Reload}"></li>
<li class="rounded-3 button-delim"></li>
<li class="rounded-3 button-select" title="{Select file}"></li>
<li class="rounded-3 button-info" title="{Get info}"></li>
<li class="rounded-3 button-open" title="{Open}"></li>
<li class="rounded-3 button-rename" title="{Rename}"></li>
<li class="rounded-3 button-edit" title="{Edit text document}"></li>
<li class="rounded-3 button-rm" title="{Delete}"></li>
<li class="rounded-3 button-delim"></li>
<li class="rounded-3 button-copy" title="{Copy}"></li>
<li class="rounded-3 button-cut" title="{Cut}"></li>
<li class="rounded-3 button-paste" title="{Paste}"></li>
<li class="rounded-3 button-delim"></li>
<li class="rounded-3 button-mkdir" title="{Create directory}"></li>
<li class="rounded-3 button-upload" title="{Upload files}"></li>
<li class="rounded-3 button-delim"></li>
<li class="rounded-3 button-ibig" title="{View as big icons}"></li>
<li class="rounded-3 button-ismall" title="{View as small icons}"></li>
<li class="rounded-3 button-list" title="{View as list}"></li>
<li class="rounded-3 button-delim"></li>
<li class="rounded-3 button-reports" title="{Toggle view of actions results dialogs}"></li>
<li class="rounded-3 button-delim"></li>
<li class="rounded-3 button-help" title="{Help}"></li>
</ul>
<!-- </div> -->
<div class="el-finder-workzone">
<div class="el-finder-nav">
{FM_TREE}
</div>
<div class="el-finder-cwd">
{FM_CONTENT}
</div>
</div>
<div class="el-finder-statusbar">
<kbd>{Files}: <span class="files-num">0</span> / <span class="files-size">0 Kb</span></kbd>
</div>
</div>
@@ -0,0 +1,10 @@
<div class='{info} view-{view}'>
<!-- BEGIN FILE -->
<div class="item {type} " key="{hash}" read="{read}" write="{write}">
<div class="icon icon-{icon_class} rounded-3" {style}></div>
<div class="basename rounded-3" title="{basename}">{name}</div>
</div>
<!-- END FILE -->
</div>
<!-- BEGIN ACCESS_DENIED --><h1 style="color:red;text-align:center">Access denied</h1><!-- END ACCESS_DENIED -->
+28
View File
@@ -0,0 +1,28 @@
<div class='{info}'>
<table class="view-list" cellspacing="1">
<thead>
<tr>
<th>{Name}</th>
<th width="85">{Access}</th>
<th width="135">{Date modified}</th>
<th class="size" width="60">{Size}</th>
<th width="155">{Kind}</th>
</tr>
</thead>
<!-- BEGIN FILE -->
<tbody>
<tr class="item {type} {rowClass}" key="{hash}" read="{read}" write="{write}">
<td>
<div class="icon icon-{icon_class}"> </div>
<div class="basename" title="{basename}">{basename}</div>
</td>
<td>{access}</td>
<td>{mdate}</td>
<td class="size">{hsize}</td>
<td>{kind}</td>
</tr>
<!-- END FILE -->
</tbody>
</table>
</div>
<!-- BEGIN ACCESS_DENIED --><h1 style="color:red;text-align:center">{Access denied}</h1><!-- END ACCESS_DENIED -->
@@ -0,0 +1,8 @@
<ul class="el-dir-tree">
<li><a key="{fm_root_hash}" class="el-tree-root" href="#">{home}</a>
{tree}
</li>
</ul>
+251
View File
@@ -0,0 +1,251 @@
.el-finder {
width:100%;
border:1px solid #ccc;
background-color:#fff;
font:12px trebuchet ms,lucida grande,verdana,sans-serif;
}
.ui-dialog .el-finder { width:99%; margin:1px auto; }
.el-finder a { color : #444; }
.el-finder .disabled { opacity:0.35; filter:Alpha(Opacity=35);}
ul.el-finder-toolbar {
padding:5px 7px;
background:#eee;
margin:0;
list-style:none;
display:block;
}
ul.el-finder-toolbar li {
display:inline-block;
display: -moz-inline-stack;
display: inline-block;
height:22px;
width:22px;
vertical-align: top;
zoom: 1;
*display: inline;
margin:1px 1px;
background:url('../images/elfinder-toolbar.png') no-repeat;
border:1px solid #ccc;
}
/*подсветка при наведение */
ul.el-finder-toolbar li:hover { border:1px solid #54b9bf; }
/*Кнопки */
ul.el-finder-toolbar li.button-hover { border:1px solid #54b9bf;}
ul.el-finder-toolbar li.button-delim { background-position: -4px 1px; border:none; width:3px;}
ul.el-finder-toolbar li.button-back { background-position: 0 -23px;}
ul.el-finder-toolbar li.button-reload { background-position: 0 -44px;}
ul.el-finder-toolbar li.button-info { background-position: 0 -297px;}
ul.el-finder-toolbar li.button-select { background-position: 0 -341px;}
ul.el-finder-toolbar li.button-open { background-position: 0 -394px;}
ul.el-finder-toolbar li.button-edit { background-position: -1px -367px;}
ul.el-finder-toolbar li.button-rename { background-position: 0 -317px;}
ul.el-finder-toolbar li.button-mkdir { background-position: 0 -66px;}
ul.el-finder-toolbar li.button-upload { background-position: 0 -108px;}
ul.el-finder-toolbar li.button-rm { background-position: 0 -86px;}
ul.el-finder-toolbar li.button-copy { background-position: 0 -130px;}
ul.el-finder-toolbar li.button-cut { background-position: 0 -154px;}
ul.el-finder-toolbar li.button-paste { background-position: 0 -176px;}
ul.el-finder-toolbar li.button-ibig { background-position: 0 -196px;}
ul.el-finder-toolbar li.button-ismall { background-position: 0 -215px;}
ul.el-finder-toolbar li.button-list { background-position: 0 -235px;}
ul.el-finder-toolbar li.button-reports { background-position: 0 -255px;}
ul.el-finder-toolbar li.button-help { background-position: 0 -275px;}
.el-finder-workzone {
clear:both;
border-top:1px solid #ccc;
border-bottom:1px solid #ccc;
}
.el-finder-nav {
float: left;
width : 170px;
padding:3px 5px;
overflow:auto;
}
.el-finder-cwd {
border-left:1px solid #ccc;
overflow:auto;
min-height:300px;
}
.el-finder-statusbar {
background:#eee;
text-align:right;
font-size:10px;
vertical-align:middle;
padding: 3px 15px;
}
/* -------------- */
/* вид - список */
.el-finder table.view-list { width:100%; }
.el-finder table.view-list th {
background:#fbf9ee;
border: 1px solid #fcefa1;
padding:1px 5px;
color:#555;
}
.el-finder table.view-list td {
border: 1px solid #eee;
padding:0px 5px 2px 5px;
vertical-align:middle;
}
.el-finder table.view-list .size { text-align:right; }
.el-finder table.view-list tr.odd {
background: #EEF5FD;
}
.el-finder table.view-list td div.icon {
width:18px;
height:18px;
float:left;
margin-right:5px;
background:url(../images/elfinder-icons-small.png) no-repeat;
background-position: 0 -450px;
}
.el-finder table.view-list td div.icon-unknown {background-position: 0 -450px; }
.el-finder table.view-list td div.icon-directory {background-position: 0 -157px; }
.el-finder table.view-list td div.icon-image {background-position: 0 -228px; }
.el-finder table.view-list td div.icon-audio { background-position: 0 -21px; }
.el-finder table.view-list td div.icon-video { background-position: 0 -42px; }
.el-finder table.view-list td div.icon-plain { background-position: 0 -137px; }
.el-finder table.view-list td div.icon-x-shellscript { background-position: 0 -425px; }
.el-finder table.view-list td div.icon-x-php { background-position: 0 -380px; }
.el-finder table.view-list td div.icon-rtf { background-position: 0 -404px; }
.el-finder table.view-list td div.icon-x-c { background-position: 0 -114px; }
.el-finder table.view-list td div.icon-x-shockwave-flash { background-position: 0 -356px; }
.el-finder table.view-list td div.icon-octet-stream { background-position: 0 1px; }
.el-finder table.view-list td div.basename { padding-top:5px; }
.el-finder table.view-list td div.basename input { width: 70%;}
.el-finder table.view-list tr.selected { background:#eee;}
/* вид - маленькие иконки */
.el-finder .view-ismall {}
.el-finder .view-ismall .item {
/* display:inline-block; */
display: -moz-inline-stack;
display: inline-block;
height:48px;
width:75px;
vertical-align: top;
zoom: 1;
*display: inline;
margin:1px 1px;
overflow:hidden;
font-size: 11px;
text-align:center;
}
.el-finder .view-ismall .basename,
.el-finder .view-ibig .basename {
text-align:center;
cursor: default;
white-space:nowrap;
padding:1px 0;
}
.el-finder .basename input { width:98%; border:1px solid #ccc;}
.el-finder .view-ismall div.icon {
width:32px;
height:24px;
margin:2px auto;
background:url(../images/elfinder-icons-small.png) no-repeat;
background-position: 8px -450px;
}
.el-finder .view-ismall div.icon-unknown { background-position: 8px -450px; }
.el-finder .view-ismall div.icon-directory { background-position: 8px -157px; }
.el-finder .view-ismall div.icon-image { background-position: 8px -228px; }
.el-finder .view-ismall div.icon-audio { background-position: 8px -21px; }
.el-finder .view-ismall div.icon-video { background-position: 8px -42px; }
.el-finder .view-ismall div.icon-archive { background-position: 8px -64px; }
.el-finder .view-ismall div.icon-plain { background-position: 8px -137px; }
.el-finder .view-ismall div.icon-x-shellscript { background-position: 8px -425px; }
.el-finder .view-ismall div.icon-x-php { background-position: 8px -380px; }
.el-finder .view-ismall div.icon-rtf { background-position: 8px -404px; }
.el-finder .view-ismall div.icon-x-c { background-position: 8px -114px; }
.el-finder .view-ismall div.icon-x-shockwave-flash { background-position: 8px -356px; }
.el-finder .view-ismall div.icon-octet-stream { background-position: 8px 1px; }
.el-finder .selected div.icon, .el-finder .selected .basename { background-color:#eee;}
/* вид - большие иконки */
.el-finder .view-ibig {}
.el-finder .view-ibig .item {
display:inline-block;
display: -moz-inline-stack;
display: inline-block;
height:73px;
width:120px;
vertical-align: top;
zoom: 1;
*display: inline;
margin:1px 1px;
overflow:hidden;
font-size: 12px;
text-align:center;
}
.el-finder .view-ibig div.icon {
width:55px;
height:50px;
margin:2px auto;
background:url(../images/elfinder-icons-big.png) 2px -992px no-repeat;
}
.el-finder .view-ibig div.icon-unknown { background-position: 4px -992px; }
.el-finder .view-ibig div.icon-directory { background-position: 4px -371px; }
.el-finder .view-ibig div.icon-image { background-position: 4px -496px; }
.el-finder .view-ibig div.icon-audio { background-position: 4px -75px; }
.el-finder .view-ibig div.icon-video { background-position: 4px -127px; }
.el-finder .view-ibig div.icon-archive { background-position: 4px -189px; }
.el-finder .view-ibig div.icon-plain { background-position: 4px -313px; }
.el-finder .view-ibig div.icon-x-shellscript { background-position: 4px -929px; }
.el-finder .view-ibig div.icon-x-php { background-position: 4px -806px; }
.el-finder .view-ibig div.icon-rtf { background-position: 4px -866px; }
.el-finder .view-ibig div.icon-x-c { background-position: 4px -253px; }
.el-finder .view-ibig div.icon-x-shockwave-flash { background-position: 4px -127px; }
.el-finder .view-ibig div.icon-octet-stream { background-position: 4px 2px; }
.el-finder .view-ibig .selected .icon { background-color:#eee; }
/* add icons to context menu */
.el-contextmenu .icon {
display:inline-block;
display: -moz-inline-stack;
display: inline-block;
height:18px;
width:18px;
vertical-align: top;
zoom: 1;
*display: inline;
margin:-0.3em .7em 0 .2em;
background:url('../images/elfinder-toolbar.png') no-repeat;
}
.el-contextmenu .icon-open { background-position: -1px -394px; }
.el-contextmenu .icon-rename { background-position: -2px -319px; }
.el-contextmenu .icon-rm { background-position: -1px -88px; }
.el-contextmenu .icon-copy { background-position: -1px -132px; }
.el-contextmenu .icon-cut { background-position: -1px -156px; }
.el-contextmenu .icon-info { background-position: -1px -298px; }
.el-contextmenu .icon-select { background-position: -1px -341px; }
.el-contextmenu .icon-reload { background-position: -2px -44px; }
.el-contextmenu .icon-mkdir { background-position: -2px -66px; }
.el-contextmenu .icon-upload { background-position: -2px -109px; }
.el-contextmenu .icon-paste { background-position: -2px -177px; }
Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

+984
View File
@@ -0,0 +1,984 @@
(function($) {
/*
* elFinder - File manager for web
*
* Usage:
* var opts = {
* url : 'http://site.com/elfinder/connector.php', // connector URL
* dialog : null, // open in dialog window
* height : 450,
* lang : 'en', // language (required translations files for connector and js)
* editorCallback : function(url) { do_smth_with_file_url(url) }, // callback for work with web-editors
* editTextFiles : true // allow edit text files
* }
* $('#my-id').elfinder(opts);
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* Copyright: Studio 42, http://www.std42.ru
*/
$.fn.elfinder = function(o) {
var options = {};
var version = '1.01';
/* варианты вида теkущей директории */
var views = ['list', 'ismall', 'ibig'];
if (o && o.constructor == Object) {
options = $.extend({}, $.fn.elfinder.defaults, o);
}
if (!options.url) {
alert('Invalid configuration! Connector URL required!');
return;
}
return this.each(function() {
var self = this;
var $self = $(this);
var id = $self.attr('id');
/* дерево дир (jQuery) */
this.tree = null;
/* навигация по дереву дир (jQuery) */
this.nav = null;
/* панель со списком файлов в дир (jQuery) */
this.cwd = null;
/* элемент для отображения кол-ва файлов в дир (jQuery) */
this.fnum = null;
/* элемент для отображения размера файлов в дир (jQuery) */
this.fsize = null;
/* информация о текущей директории */
this.info = {};
/* История перемещений по директориям */
this.history = [];
/* Кнопки на тулбаре */
this.buttons = {};
/* Буффер для копирования файлов */
this.buffer = [];
/* Объект - переводчик */
this._i18n = new eli18n({textdomain : 'elfinder', messages : { elfinder : $.fn.elfinder.i18Messages[options.lang] || {}} });
/* Куки для хранения выбраного вида директории */
this.cookieView = 'elfinder-view-'+id;
/* Куки, хранят инф - отображать или нет отчеты о выполненных командах */
this.cookieReports = 'elfinder-reports-'+id;
/**
* Возвращает перевод на текущий язык или само сообщение
*
* @param String msg
* @return String
**/
this.i18n = function(msg) {
return self._i18n.translate(msg);
}
/* Вид текущей директории */
var v = elcookie(this.cookieView);
this.view = v && $.inArray(v, views) ? v : 'list';
var r = elcookie(this.cookieReports);
this.showReports = r ? (r>0?1:0) : 1;
/* селекторы контекстного меню */
var selectors = {
'.dir-r' : [
{label : '<span class="icon icon-open"></span>'+this.i18n("Open"), action : function(o) { self._open($(o))} },
{},
{label : '<span class="icon icon-copy"></span>'+this.i18n("Copy"), action : function(o) { self.copy()} },
{},
{label : '<span class="icon icon-info"></span>'+this.i18n("Get info"), action : function(o) { self.getInfo($(o))} }
],
'.dir-rw' : [
{label : '<span class="icon icon-open"></span>'+this.i18n("Open"), action : function(o) { self._open($(o))} },
{label : '<span class="icon icon-rename"></span>'+this.i18n("Rename"), action : function(o) { self.rename($(o))} },
{label : '<span class="icon icon-rm"></span>'+this.i18n("Delete"), action : function(o) { self.rm()} },
{},
{label : '<span class="icon icon-copy"></span>'+this.i18n("Copy"), action : function(o) { self.copy()} },
{label : '<span class="icon icon-cut"></span>'+this.i18n("Cut"), action : function(o) { self.copy(true)} },
{},
{label : '<span class="icon icon-info"></span>'+this.i18n("Get info"), action : function(o) { self.getInfo($(o))} }
],
'.file-r' : [
{label : '<span class="icon icon-open"></span>'+this.i18n("Open"), action : function(o) { self._open($(o))} },
{},
{label : '<span class="icon icon-copy"></span>'+this.i18n("Copy"), action : function(o) { self.copy()} },
{},
{label : '<span class="icon icon-info"></span>'+this.i18n("Get info"), action : function(o) { self.getInfo($(o))} }
],
'.file-rw' : [
{label : '<span class="icon icon-open"></span>'+this.i18n("Open"), action : function(o) { self._open($(o))} },
{label : '<span class="icon icon-rename"></span>'+this.i18n("Rename"), action : function(o) { self.rename($(o))} },
{label : '<span class="icon icon-rm"></span>'+this.i18n("Delete"), action : function(o) { self.rm()} },
{},
{label : '<span class="icon icon-copy"></span>'+this.i18n("Copy"), action : function(o) { self.copy()} },
{label : '<span class="icon icon-cut"></span>'+this.i18n("Cut"), action : function(o) { self.copy(true)} },
{},
{label : '<span class="icon icon-info"></span>'+this.i18n("Get info"), action : function(o) { self.getInfo($(o))} }
],
'.image-r' : [
{label : '<span class="icon icon-open"></span>'+this.i18n("Open"), action : function(o) { self._open($(o))} },
{},
{label : '<span class="icon icon-copy"></span>'+this.i18n("Copy"), action : function(o) { self.copy()} },
{},
{label : '<span class="icon icon-info"></span>'+this.i18n("Get info"), action : function(o) { self.getInfo($(o))} }
],
'.image-rw' : [
{label : '<span class="icon icon-open"></span>'+this.i18n("Open"), action : function(o) { self._open($(o))} },
{label : '<span class="icon icon-rename"></span>'+this.i18n("Rename"), action : function(o) { self.rename($(o))} },
{label : '<span class="icon icon-rm"></span>'+this.i18n("Delete"), action : function(o) { self.rm()} },
{},
{label : '<span class="icon icon-copy"></span>'+this.i18n("Copy"), action : function(o) { self.copy()} },
{label : '<span class="icon icon-cut"></span>'+this.i18n("Cut"), action : function(o) { self.copy(true)} },
{},
{label : '<span class="icon icon-info"></span>'+this.i18n("Get info"), action : function(o) { self.getInfo($(o))} }
],
'.el-finder-cwd' : [ ]
};
if (options.editorCallback) {
var s = { label : '<span class="icon icon-select"></span>'+this.i18n("Select file"), action : function(o) { self.selectFile($(o)); } };
selectors['.file-r'].unshift(s);
selectors['.file-rw'].unshift(s);
selectors['.image-r'].unshift(s);
selectors['.image-rw'].unshift(s);
}
if (!this.loaded) {
if (!this.options) {
this.options = options;
if (this.options.dialog) {
$.extend(this.options.dialog, { close : function() { self.loaded = false; $self.dialog('destroy') }})
}
}
$.ajax({
url : this.options.url,
cache : false,
data : {view : this.view},
error : function(r, t, e) { alert(t+' '+e) },
success : function(data) { self.init(data); }
});
}
if (o == 'open') {
this.open();
} else if (o == 'close') {
this.close()
}
/**
* Открывает файловый менеджер
*
**/
this.open = function() {
if (this.options.dialog) {
$self.dialog('open');
} else {
$self.show();
}
}
/**
* Закрывает файловый менеджер
*
**/
this.close = function() {
if (this.options.dialog) {
this.loaded = false;
$self.dialog('close');
} else {
$self.hide();
}
}
/**
* Загружает файловый менеджер
*
**/
this.init = function(html) {
$self.empty().html(html);
if (!$self.children('.el-finder').length) {
return $self.empty().html(this.i18n('Invalid backend configuration'));
}
this.loaded = true;
var m = $self.find('ul.el-finder-toolbar');
this.buttons = {
back : m.children('.button-back' ).click(function() { !$(this).hasClass('disabled') && self.back(); }),
reload : m.children('.button-reload').bind('click', self.reload),
select : m.children('.button-select' ).click(function() { !$(this).hasClass('disabled') && self.selectFile(self._selected(true)); }),
open : m.children('.button-open' ).click(function() { !$(this).hasClass('disabled') && self._open(self._selected(true)); }),
edit : m.children('.button-edit' ).click(function() { !$(this).hasClass('disabled') && self.edit(self._selected(true)); }),
rename : m.children('.button-rename').click(function() { !$(this).hasClass('disabled') && self.info.write && self.rename(self._selected(true)); }),
rm : m.children('.button-rm').click(function() { !$(this).hasClass('disabled') && self.info.write && self.rm(); }),
info : m.children('.button-info' ).click(function() { !$(this).hasClass('disabled') && self.getInfo(self._selected(true)); }),
mkdir : m.children('.button-mkdir' ).click(function() { !$(this).hasClass('disabled') && self.info.write && self.mkdir(); }),
upload : m.children('.button-upload').click(function() { !$(this).hasClass('disabled') && self.info.write && self.upload(); }),
copy : m.children('.button-copy').click(function() { !$(this).hasClass('disabled') && self.copy(); }),
cut : m.children('.button-cut').click(function() { !$(this).hasClass('disabled') && self.copy(self.info.write); }),
paste : m.children('.button-paste').click(function() { !$(this).hasClass('disabled') && self.info.write && self.paste(); }),
ibig : m.children('.button-ibig').click(function() { !$(this).hasClass('disabled') && self.swithchView('ibig'); }),
ismall : m.children('.button-ismall').click(function() { !$(this).hasClass('disabled') && self.swithchView('ismall'); }),
list : m.children('.button-list').click(function() { !$(this).hasClass('disabled') && self.swithchView('list'); }),
reports : m.children('.button-reports').bind('click', self.switchReports),
help : m.children('.button-help').bind('click', self.help)
}
if (!this.options.editorCallback) {
this.buttons.select.hide();
}
if (!this.options.editTextFiles) {
this.buttons.edit.hide();
}
this.fnum = $self.find('.files-num');
this.fsize = $self.find('.files-size');
this.cwd = $self.find('.el-finder-cwd')
.click(function(e) {
if (e.target == this) {
self.cwd.find('.selected').removeClass('selected');
self.updateToolbar();
}
})
.bind('update', function() {
self.info = self.cwd.children().eq(0).metadata();
/** да, live было бы лучше но когда диалог в диалоге - в сафари live не работает **/
$(this).find('.item')
.bind('dblclick', function(e) {
e.stopPropagation()
var $this = $(this);
if (!$this.hasClass('disabled')) {
self._open($(this));
}
})
.bind('click', function(e) {
var $this = $(this);
var s = $this.hasClass('selected');
if (!e.ctrlKey && !e.metaKey && !e.shiftKey) {
self.cwd.find('.selected').removeClass('selected');
} else if (e.shiftKey) {
var prev = $this.prevAll('.selected').get(0);
var next = $this.nextAll('.selected').get(0);
var stop = false;
if (prev) {
$this.prevAll('.item').each(function() {
if (this == prev) {
stop = true;
$(this).addClass('selected');
} else if (!stop) {
$(this).addClass('selected');
} else {
$(this).removeClass('selected');
}
});
$this.nextAll('.selected').removeClass('selected');
} else if (next) {
$this.nextAll('.item').each(function() {
if (this == next) {
stop = true;
$(this).addClass('selected');
} else if (!stop) {
$(this).addClass('selected');
} else {
$(this).removeClass('selected');
}
});
$this.prevAll('.selected').removeClass('selected');
}
}
if (!s) {
$this.addClass('selected');
} else {
$this.removeClass('selected');
}
self.updateToolbar();
});
if (!self.info.write) {
selectors['.el-finder-cwd'] = [{label : '<span class="icon icon-reload"></span>'+self.i18n("Reload"), action : function(o) { self.reload(); } }];
} else {
selectors['.el-finder-cwd'] = [
{label : '<span class="icon icon-reload"></span>'+self.i18n("Reload"), action : function(o) { self.reload(); } },
{},
{label : '<span class="icon icon-paste"></span>'+self.i18n("Paste"), action : function(o) { self.paste(); } },
{},
{label : '<span class="icon icon-mkdir"></span>'+self.i18n("Create directory"), action : function(o) { self.mkdir(); } },
{label : '<span class="icon icon-upload"></span>'+self.i18n("Upload files"), action : function(o) { self.upload(); } }
]
}
$.elcontextmenu(selectors, self, function(e) {
if (window.opera && !e.ctrlKey) {
return;
}
if (!$(e.currentTarget).hasClass('el-finder-cwd')) {
$(e.currentTarget).addClass('selected');
}
});
self.updateToolbar();
self._unlock();
self.fnum.text(self.info.filesNum);
self.fsize.text(self.info.filesSize);
});
this.nav = $self.find('.el-finder-nav')
.bind('update', function() {
self.tree = $self.find('.el-dir-tree').eldirtree({callback : self.cd });
self.tree.find('[key="'+self.info.key+'"]').trigger('cd');
self._unlock();
});
if (this.options.height) {
this.cwd.css('height', this.options.height+'px');
this.nav.css('height', this.options.height+'px');
}
this.cwd.trigger('update');
this.nav.trigger('update');
if(this.options.dialog) {
$self.dialog(this.options.dialog).parent().find('.ui-dialog-content').css('padding', '0');
}
$(document).bind('keydown', function(e) {
if (e.keyCode == 46 || (e.metaKey && e.keyCode == 8)) {
self.rm();
} else if (e.ctrlKey||e.metaKey) {
if (e.keyCode == 67) {
self.copy()
} else if (e.keyCode == 88) {
self.copy(true)
} else if (e.keyCode == 86) {
self.paste();
}
}
});
}
/**
* Обновляет кнопки на тулбаре
*
**/
this.updateToolbar = function() {
if (self.history.length) {
self.buttons.back.removeClass('disabled');
} else {
self.buttons.back.addClass('disabled');
}
var s = this._selected();
if (this.options.editorCallback) {
if (s && s.length==1 && !s.eq(0).hasClass('dir-r') && !s.eq(0).hasClass('dir-rw')) {
self.buttons.select.removeClass('disabled');
} else {
self.buttons.select.addClass('disabled');
}
}
if (this.options.editTextFiles ) {
if (s && s.length==1 && s.eq(0).attr('class').match(/text/)) {
self.buttons.edit.removeClass('disabled');
} else {
self.buttons.edit.addClass('disabled');
}
}
if (s) {
self.buttons.open.removeClass('disabled');
self.buttons.info.removeClass('disabled');
self.buttons.copy.removeClass('disabled');
if (self.info.write) {
self.buttons.rename.removeClass('disabled');
self.buttons.rm.removeClass('disabled');
self.buttons.cut.removeClass('disabled');
}
} else {
self.buttons.open.addClass('disabled');
self.buttons.info.addClass('disabled');
self.buttons.rename.addClass('disabled');
self.buttons.copy.addClass('disabled');
self.buttons.rm.addClass('disabled');
self.buttons.cut.addClass('disabled');
}
if (self.buffer.length) {
self.buttons.paste.removeClass('disabled');
} else {
self.buttons.paste.addClass('disabled');
}
if (self.info.write) {
self.buttons.mkdir.removeClass('disabled');
self.buttons.upload.removeClass('disabled');
} else {
self.buttons.rename.addClass('disabled');
self.buttons.mkdir.addClass('disabled');
self.buttons.upload.addClass('disabled');
self.buttons.paste.addClass('disabled');
}
for (var i=0; i < views.length; i++) {
var view = views[i];
if (view == self.view) {
self.buttons[view].addClass('disabled');
} else {
self.buttons[view].removeClass('disabled');
}
};
if (self.showReports>0) {
self.buttons.reports.removeClass('disabled');
} else {
self.buttons.reports.addClass('disabled');
}
}
/**
* Переход в директорию или открытие файла
*
* @param DOMElement o
**/
this._open = function(o) {
if (o) {
if (o.hasClass('dir-r') || o.hasClass('dir-rw')) {
this.cd(o);
} else {
window.open(options.url+'?cmd=open&current='+this.info.key+'&target='+o.attr('key'), null, 'top=50,left=50,scrollbars=yes,resizable=yes');
}
}
}
/**
* Переход в директорию
*
* @param DOMElement||number o
**/
this.cd = function(o) {
self._lock();
self.history.push(self.info.key);
var t = typeof(o) == 'object' ? o.attr('key') : o;
$.ajax({
url : options.url,
cache : false,
data : {cmd : 'cd', target : t, view : self.view},
error : function(r, t, e) { self._showError(t+' '+e); self._unlock(); },
success : function(cwd) {
self.cwd.empty().html(cwd).trigger('update');
self.nav.trigger('update');
}
});
}
/**
* Обновление текущей директории
*
**/
this.reload = function() {
self.cd(self.info.key);
$.ajax({
url : options.url,
data : {cmd : 'tree', target : self.info.key},
error : function(r, t, e) { self._showError(t+' '+e); self._unlock(); },
success : function(tree) { self.nav.html(tree).trigger('update'); }
});
}
/**
* History go back
*
**/
this.back = function() {
if (!this.buttons.back.hasClass('disabled') && this.history.length) {
this.cd(this.history.pop());
this.history.pop();
}
}
/**
* Select file for editor (elRTE)
* Call options.editorCallback(fileURL)
*
**/
this.selectFile = function(o) {
if (options.editorCallback) {
$.ajax({
url : options.url,
dataType : 'json',
data : {cmd : 'url', current : self.info.key, target : $(o).attr('key')},
error : function(r, t, e) { self._showError(t+' '+e) },
success : function(data) {
options.editorCallback(data.url);
if (self.options.dialog) {
self.close();
}
}
});
}
}
/**
* Информация о файле/директории
*
* @param DOMElement o
**/
this.getInfo = function(o) {
if (o) {
self._lock();
$.ajax({
url : options.url,
data : {cmd : 'info', current : self.info.key, target : o.attr('key')},
error : function(r, t, e) { self._showError(t+' '+e); self._unlock(); },
success : function(data) {
var d = new elDialogForm({
dialog : {
title : self.i18n('File info'),
buttons : { Ok : function() { d.close(); } }
}
});
d.append(data).open();
self._unlock();
}
});
}
}
/**
* Copy/cut files/dirs
*
**/
this.copy = function(cut) {
this.buffer = [];
var s = this._selected();
if (s) {
this.buffer = [this.info.key, [], !!(this.info.write && cut)];
$.each(s, function() {
self.buffer[1].push($(this).attr('key'));
});
}
this.updateToolbar();
}
/**
* Paste files/dirs
*
**/
this.paste = function() {
if (this.buffer.length) {
self._lock();
$.ajax({
url : options.url,
dataType : 'json',
data : {
cmd : 'copy',
current : self.info.key,
source : self.buffer[0],
'files[]' : self.buffer[1],
move : self.buffer[2]
},
error : function(r, t, e) { self._showError(t+' '+e); self._unlock(); },
success : function(data) {
self._unlock();
if (data.error) {
self._showError(data.error);
self.buffer = [];
self.updateToolbar();
} else if (self.showReports) {
self._showMessage(data.message);
} else {
self.reload();
}
}
});
}
}
/**
* Переименование файла/директории
*
* @param DOMElement o
**/
this.rename = function(o) {
if (o) {
var b = o.find('.basename').eq(0);
var name = b.text();
var real = b.attr('title');
var input = $('<input type="text" />').val(real)
.keyup(function(e) {
if (e.keyCode == 27) {
restore();
} else if (e.keyCode == 13) {
rename();
}
})
.bind('change blur', function() { rename(); })
.click(function(e) { e.stopPropagation(); });
b.empty().append(input);
input.select();
if (!$.browser.safari) {
input.focus();
}
}
function restore() {
b.empty().text(name);
}
function rename() {
var newname = $.trim(input.val());
if (!self._checkName(newname)) {
b.empty().text(name);
return self._showError(self.i18n('Invalid name'), null, true);
} else if (newname == real) {
return restore();
}
b.empty().text(newname);
$.ajax({
url : options.url,
dataType : 'json',
data : {cmd : 'rename', current : self.info.key, target : o.attr('key'), newname : newname},
error : function(r, t, e) { self._showError(t||e); },
success : function(data) {
if (data.error) {
self._showError(data.error);
} else if (self.showReports) {
self._showMessage(data.message);
} else {
self.reload();
}
}
});
}
}
/**
* Edit text file
*
* @param DOMElement o
**/
this.edit = function(o) {
var name = o.find('.basename').eq(0).attr('title')
function edit(data) {
var d = new elDialogForm({
submit : function() { },
form : { action : options.url },
dialog : { title : name, width : 800 },
ajaxForm : {
dataType : 'json',
beforeSubmit : function() { d.showSpinner(self.i18n('Sending data'), true); return true},
error : function(r, t, e) { self._showError(t||e, d); self._unlock(); },
success : function(data) {
self._unlock();
if (data.error) {
self._showError(data.error, d);
self.buffer = [];
self.updateToolbar();
} else if (self.showReports) {
self._showMessage(data.message, d);
} else {
self.reload();
d.close();
}
}
}
});
d.append($('<input type="hidden" />').attr('name', 'cmd').val('edit'))
.append($('<input type="hidden" />').attr('name', 'current').val(self.info.key))
.append($('<input type="hidden" />').attr('name', 'target').val(o.attr('key')))
.append($('<input type="hidden" />').attr('name', 'cmd').val('edit'))
.append($('<textarea />').attr({name : 'content', rows : 20}).css('width', '99%').val(data))
.open();
}
$.ajax({
url : self.options.url,
data : {cmd : 'open', current : self.info.key, target : o.attr('key')},
error : function(r, t, e) { self._showError(t+' '+e); self._unlock(); },
success : function(data) { edit(data); }
});
}
/**
* Удаление файлов/директорий
*
* @param DOMElement o
**/
this.rm = function() {
var o = this._selected();
if (o) {
var d = new elDialogForm({
submit : function(e) { e.preventDefault(); rm(); },
dialog : { title : self.i18n('Confirmation required') }
});
d.showError(self.i18n('Are you shure you want to remove files?<br /> This cannot be undone!')).open();
}
function rm() {
d.showSpinner(self.i18n('Sending data'));
var t = [];
o.each(function() { t.push($(this).attr('key')) });
$.ajax({
url : options.url,
dataType : 'json',
data : {cmd : 'rm', current : self.info.key, 'target[]' : t},
error : function(r, t, e) { self._showError(t||e, d); },
success : function(data) {
if (data.error) {
self._showError(data.error, d);
} else if (self.showReports) {
self._showMessage(data.message, d);
} else {
self.reload();
d.close();
}
}
});
}
}
/**
* Новая директория
*
**/
this.mkdir = function() {
var n = $('<input type="text" />');
var d = new elDialogForm({
submit : function(e) { e.preventDefault(); mkdir(); },
dialog : { title : self.i18n('Create directory') }
});
d.append([self.i18n('Directory name'), n], false, true).open();
function mkdir() {
var name = $.trim(n.val());
if (!name) {
d.close();
} else if (!self._checkName(name)) {
d.showError(self.i18n('Invalid directory name'))
.option('buttons', {
Cancel : function() { d.close(); },
Ok : function() { d.form.trigger('submit'); }
});
} else {
d.showSpinner(self.i18n('Sending data'), true);
$.ajax({
url : options.url,
dataType : 'json',
data : {cmd : 'mkdir', current : self.info.key, dirname : name},
error : function(r, t, e) { self._showError(t||e, d); },
success : function(data) {
if (data.error) {
d.showError(data.error)
.option('buttons', {
Cancel : function() { d.close(); },
Ok : function() { d.form.trigger('submit'); }
});
} else if (self.showReports) {
self._showMessage(data.message, d);
} else {
self.reload();
d.close();
}
}
});
}
}
}
/**
* Загрузка файлов
*
**/
this.upload = function() {
var d = new elDialogForm({
submit : function() { },
form : { action : options.url, enctype : 'multipart/form-data'},
dialog : { title : self.i18n('Upload files') },
ajaxForm : {
beforeSubmit : function(formData, jqForm, options) {
var submit = false
$('input[name="fm-file\[\]"]', jqForm).each( function() {
if ($(this).val().length){
submit = true;
}
});
if (!submit) {
d.showError(self.i18n('Select at least one file to upload'));
} else {
d.showSpinner(self.i18n('Sending data'), true);
}
return submit;
},
dataType : 'json',
error : function(r, t, e) { self._showError(t||e, d) },
success : function(data) {
if (data.error) {
self._showError(data.error+'<br />'+data.failed.join('<br />'), d);
} else if (self.showReports || data.failed.length) {
var err = !data.failed.length
? ''
: '<div class="el-dialogform-error">'+self.i18n('Following files was not uploaded:<br />')+data.failed.join('<br />')+'</div>';
d.showMessage(data.message + err, true).option('buttons', { Ok : function() { self.reload(); d.close(); } });
} else {
self.reload();
d.close();
}
}
}
});
var i = $('<input type="file" name="fm-file[]" />');
var b = $('<span />').css('cursor', 'default')
.append($('<span />').addClass('ui-icon ui-icon-circle-plus').css({'float' : 'left', 'margin-right' : '.3em'}))
.append(self.i18n('Add field'))
.click(function() {
d.append(i.clone(), false, true);
});
if (self.info.allowed) {
d.append(self.i18n('You can upload only files with following types: ')+self.info.allowed).separator();
}
d.append(self.i18n('Maximum allowed files size is ')+self.info.postMaxSize)
.separator()
.append($('<input type="hidden" />').attr('name', 'current').val(self.info.key))
.append($('<input type="hidden" />').attr('name', 'cmd').val('upload'))
.append(i.clone(), false, true)
.append(i.clone(), false, true)
.append(i.clone(), false, true)
.separator()
.append(b)
.open();
function send() {
d.showSpinner(self.i18n('Sending data'), true);
}
}
/**
* Переключение внешнего вида
*
* @param String v
**/
this.swithchView = function(v) {
self.view = v;
elcookie(self.cookieView, v, {expires: 1, path : '/'});
self.reload();
}
/**
* Включение/выключение показа отчетов о успешных действиях
*
**/
this.switchReports = function() {
self.showReports = self.showReports ? 0 : 1;
elcookie(self.cookieReports, self.showReports, {expires: 1, path : '/'});
self.buttons.reports.toggleClass('disabled');
}
/**
* Display help window
*
**/
this.help = function() {
var d = new elDialogForm({
dialog : {
width : 500,
title : self.i18n('Help'),
buttons : { Ok : function() { d.close(); } }
}
});
var h = '<b>'+self.i18n('elFinder: Web file manager')+'.<br /> '+self.i18n('Version')+': '+version+'</b><br />';
if (options.lang=='en') {
h += 'elFinder works similar to file manager on your computer. <br /> To make actions on files/folders use icons on top panel. If icon action it is not clear for you, hold mouse cursor over it to see the hint. <br /> Manipulations with existing files/folders can be done through the context menu (mouse right-click). <br /> To copy/delete a group of files/folders, select them using Shift/Alt(Command) + mouse left-click.';
} else {
h += '<br />'+self.i18n('helpText');
}
var a = self.i18n('Copyright: Studio 42 LTD')+', 2009<br />'
+self.i18n('Programming: Dmitry (dio) Levashov, dio@std42.ru')+'<br />'
+self.i18n('Techsupport, make file and testing: Troex Nevelin, troex@fury.scancode.ru')+'<br />'
+self.i18n('Design: Valentin Razumnih')+'<br />'
+self.i18n('License: BSD License')+'<br /><a href="http://www.elrte.ru">www.elrte.ru</a><br />dev@std42.ru'
d.tab('help', self.i18n('Help')).tab('authors', self.i18n('Authors'))
.append(h, 'help')
.append(a, 'authors')
.open();
}
/*******************************************/
// вспомогательные методы
/*******************************************/
this._selected = function(first) {
var s = self.cwd.find('.selected');
if (s.length) {
return first ? s.eq(0) : s;
}
return null;
}
this._lock = function() {
self.nav.addClass('disabled');
self.cwd.addClass('disabled');
}
this._unlock = function() {
self.nav.removeClass('disabled');
self.cwd.removeClass('disabled');
}
this._showMessage = function(msg, d) {
if (!d) {
d = new elDialogForm({ dialog : { title : self.i18n('Message') } });
}
d.showMessage(msg, true).open().option('buttons', { Ok : function() { self.reload(); d.close(); } });
}
this._showError = function(msg, d, noReload) {
if (!d) {
d = new elDialogForm({ dialog : { title : self.i18n('Error') } });
}
d.showError(msg, true).open().option('buttons', { Ok : function() { self.reload(); d.close(); } });
}
/**
* Проверяет имя на допустимые символы
*
**/
this._checkName = function(name) {
return name.search('^[^\/@\!%"\']+$') != -1;
}
});
function log(msg) {
window.console && window.console.log && window.console.log(msg);
}
return this;
}
$.fn.elfinder.defaults = {
url : '',
dialog : null,
height : 450,
lang : 'en',
editorCallback : null,
editTextFiles : true
};
$.fn.elfinder.i18Messages = {};
})(jQuery);
+42
View File
@@ -0,0 +1,42 @@
(function($) {
$.fn.elfinder.i18Messages.ru = {
'Invalid backend configuration' : 'Неправильная конфигурация',
'Reload' : 'Обновить',
'Open' : 'Открыть',
'Copy' : 'Копировать',
'Paste' : 'Вставить',
'Rename' : 'Переименовать',
'Delete' : 'Удалить',
'Cut' : 'Вырезать',
'Select file' : 'Выбрать файл',
'Invalid name' : 'Некорректное имя',
'Sending data' : 'Отправляю данные',
'Confirmation required' : 'Требуется подтверждение',
'Are you shure you want to remove files?<br /> This cannot be undone!' : 'Вы уверены, что хотите удалить файл? <br />Действие необратимо.',
'Create directory' : 'Создать папку',
'Directory name' : 'Имя папки',
'Invalid directory name' : 'Некорректное имя папки',
'Upload files' : 'Загрузить файл',
'Select at least one file to upload' : 'Выберите, как минимум, один файл для загрузки',
'Following files was not uploaded:<br />' : 'Следующие файлы не были загружены: <br />',
'You can upload only files with following types: ' : 'Вы можете загружать файлы только следующих типов: ',
'Maximum allowed files size is ' : 'Максимальный размер файлов ',
'Help' : 'Помощь',
'Message' : 'Сообщение',
'Error' : 'Ошибка',
'Add field' : 'Добавить поле',
'File info' : 'Свойства объекта',
'Get info' : 'Свойства',
'Authors' : 'Авторы',
'elFinder: Web file manager' : 'elFinder: Файловый менеджер для Web',
'Version' : 'Версия',
'Copyright: Studio 42 LTD' : 'Copyright: Студия 42',
'Programming: Dmitry (dio) Levashov, dio@std42.ru' : 'Программирование: Дмитрий (dio) Левашов, dio@std42.ru',
'Techsupport, make file and testing: Troex Nevelin, troex@fury.scancode.ru' : 'Техподдержка, make file и тестирование: Troex Nevelin, troex@fury.scancode.ru',
'Design: Valentin Razumnih' : 'Дизайн: Валентин Разумных',
'License: BSD License' : 'Лицензия: BSD License',
'helpText' : 'elFinder работает аналогично файловому менеджеру в вашем компьютере.<br />Чтобы совершать действия с файлами/папками, воспользуйтесь иконками на верхней панели или контекстным меню. Если назначение иконки для вас не очевидно, задержите курсор мыши над ней, чтобы увидеть подсказку. <br />Манипуляции с существующими файлами/папками можно производить через контекстное меню (правый клик мыши).<br /> Для копирования/удаления группы файлов/папок выделите их Shift/Alt(Command) + левый клик мыши или воспользуйтесь привычными сочетаниями клавиш.'
};
})(jQuery);
+42
View File
@@ -0,0 +1,42 @@
(function($) {
$.fn.elfinder.i18Messages.ua = {
'Invalid backend configuration' : 'Невірна конфігурація',
'Reload' : 'Оновити',
'Open' : 'Відкрити',
'Copy' : 'Копіювати',
'Paste' : 'Вставити',
'Rename' : 'Перейменувати',
'Delete' : 'Видалити',
'Cut' : 'Вирізати',
'Select file' : 'Вибрати файл',
'Invalid name' : 'Некоректний ім&rsquo;я',
'Sending data' : 'Відправляю дані',
'Confirmation required' : 'Необхідно підтвердити',
'Are you shure you want to remove files?<br /> This cannot be undone!' : 'Ви впевнені, що хочете видалити файл? <br /> Дія є незворотнім.',
'Create directory' : 'Створити папку',
'Directory name' : 'Iм&rsquo;я папки',
'Invalid directory name' : 'Некоректний назву папки',
'Upload files' : 'Завантажити файл',
'Select at least one file to upload' : 'Виберіть, як мінімум, один файл для завантаження',
'Following files was not uploaded:<br />' : 'Наступні файли не були завантажені: <br />',
'You can upload only files with following types: ' : 'Ви можете завантажувати файли тільки таких типів: ',
'Maximum allowed files size is ' : 'Максимальний розмір файлів ',
'Help' : 'Допомога',
'Message' : 'Повідомлення',
'Error' : 'Помилка',
'Add field' : 'Додати поле',
'File info' : 'Властивості об&rsquo;єкту',
'Get info' : 'Властивості',
'Authors' : 'Автори',
'elFinder: Web file manager' : 'elFinder: Файловий менеджер для Web',
'Version' : 'Версія',
'Copyright: Studio 42 LTD' : 'Copyright: Студия 42',
'Programming: Dmitry (dio) Levashov, dio@std42.ru' : 'Програмування: Дмитрий (dio) Левашов, dio@std42.ru',
'Techsupport, make file and testing: Troex Nevelin, troex@fury.scancode.ru' : 'Техподдержка, make file и тестирование: Troex Nevelin, troex@fury.scancode.ru',
'Design: Valentin Razumnih' : 'Дизайн: Валентин Разумных',
'License: BSD License' : 'Ліцензія: BSD License',
'helpText' : 'elFinder работает аналогично файловому менеджеру в вашем компьютере.<br />Чтобы совершать действия с файлами/папками, воспользуйтесь иконками на верхней панели или контекстным меню. Если назначение иконки для вас не очевидно, задержите курсор мыши над ней, чтобы увидеть подсказку. <br />Манипуляции с существующими файлами/папками можно производить через контекстное меню (правый клик мыши).<br /> Для копирования/удаления группы файлов/папок выделите их Shift/Alt(Command) + левый клик мыши или воспользуйтесь привычными сочетаниями клавиш.'
};
})(jQuery);
+50
View File
@@ -0,0 +1,50 @@
/* 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;
}
+29
View File
@@ -0,0 +1,29 @@
@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; }
+15
View File
@@ -0,0 +1,15 @@
.el-contextmenu {
position:absolute;
background:#fff;
cursor:default;
border:1px solid #ccc;
z-index: 10000;
padding:5px 0;
}
.el-contextmenu div {
margin:0;
padding:.5em 7em .3em .7em;
font:12px trebuchet ms,lucida grande,verdana,sans-serif;
}
.el-contextmenu div.delim { margin:0; padding:0; height:1px; border-top:1px solid #eee;display:block;}
.el-contextmenu-hover { background:#99ccff; }
+70
View File
@@ -0,0 +1,70 @@
/* dialog container */
.ui-widget .el-dialogform {
padding:5px 3px;
}
.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;
}
+59
View File
@@ -0,0 +1,59 @@
ul.el-dir-tree, ul.el-dir-tree ul, ul.el-dir-tree li {
list-style:none;
margin:0;
padding:0;
}
ul.el-dir-tree li {
list-style:none;
cursor: default;
white-space:nowrap;
font:12px trebuchet ms,lucida grande,verdana,sans-serif;
}
/* nested directory */
ul.el-dir-tree li ul {
padding: 0 0 0 16px;
margin: 0;
}
/* inserted div before link */
ul.el-dir-tree li div {
float:left;
width:10px;
height:22px;
cursor: default;
}
/* collapsed folder and arrow */
ul.el-dir-tree li .el-dir-collapsed {
background:url('../images/eldirtree.png') 0 0 no-repeat;
}
/* collapsed arrow */
ul.el-dir-tree li div.el-dir-collapsed {
background-position: -3px 7px;
}
/* expanded arrow */
ul.el-dir-tree li div.el-dir-expanded {
background-position: -3px -9px;
}
/* collapsed folder */
ul.el-dir-tree li a.el-dir-collapsed {
background-position:3px -29px;
}
/* expanded folder */
ul.el-dir-tree li a.el-dir-expanded {
background-position: 3px -53px;
}
ul.el-dir-tree li a {
line-height:22px;
vertical-align:bottom;
padding: 4px 23px 2px 23px;
color:#444;
text-decoration:none;
cursor: default;
}
/* selected dir */
ul.el-dir-tree li a.selected {
background-color:#eee;
}
+11
View File
@@ -0,0 +1,11 @@
.el-paddinginput {
display: block;
white-space: nowrap;
}
.el-paddinginput input {
margin :0 1px 0 0;
border:1px solid #ccc;
}
.el-paddinginput select {
padding:0;
}
+49
View File
@@ -0,0 +1,49 @@
@charset "UTF-8";
* { margin:0; padding: 0; }
html, body, div, span,
applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, ins, kbd, q, s, samp,
small, strike, strong, tt, var,
dd, dl, dt, li, ol, ul,
fieldset, form, label, legend, caption
{
margin:0; padding: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
text-align: left;
vertical-align: baseline;
}
html, body, div, span,
applet, object, iframe,
fieldset, form, label, legend { border: 0 solid; }
/* IE5 & IE6 likes it */
* html body * { overflow:visible; }
* html iframe,
* html frame { overflow:auto; }
/* Включаем вертикальный скролл в FF & Safari */
html { height: 100%; margin-bottom: 1px; }
/** Default body **/
body {
font-size: 100.01%; /* Fix for font size in old Opera */
color: #000;
background: #fff;
text-align: left;
}
/* Исправляем слишком мелкий select */
option { padding-left: 0.4em; }
select { padding: 1px; }
/* No image borders */
img, a img, :link img, :visited img { border: 0; }
a { outline: none; }
+56
View File
@@ -0,0 +1,56 @@
/* 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;
}
/* 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;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

+30
View File
@@ -0,0 +1,30 @@
function elcookie(name, value, opts) {
if (typeof value == 'undefined') {
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
var test = name+'=';
for (var i=0; i<cookies.length; i++) {
var c = $.trim(cookies[i]);
if (c.substring(0, name.length+1) == test) {
return decodeURIComponent(c.substring(name.length+1));
}
}
}
return '';
} else {
opts = $.extend({expires : '', path : '', domain : '', secure : false}, opts);
if (value===null) {
value = '';
opts.expires = -1;
}
var expires = '';
if (opts.expires) {
var d = opts.expires.toUTCString ? opts.expires : new Date();
if (typeof opts.expires == 'number') {
d.setTime(d.getTime() + (opts.expires * 24 * 60 * 60 * 1000));
}
expires = '; expires='+d.toUTCString();
}
document.cookie = name+'='+encodeURIComponent(value)+expires+(opts.path ? '; path='+opts.path : '')+(opts.domain ? '; domain='+opts.domain : '')+(opts.secure ? '; secure' : '');
}
}
+266
View File
@@ -0,0 +1,266 @@
/**
* @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: ', $('<input type="text" name="f1" />')])
* .separator()
* .append(['Another field name: ', $('<input type="text" name="f2" />')])
* .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: ', $('<input type="text" name="f1" />')], 'first', true) - add label and input to first tab in table (table will create automagicaly)
* .append(['Field name 2: ', $('<input type="text" name="f2" />')], '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 = $.extend(true, defaults, o, {dialog : { autoOpen : false, close : function() { self.close(); } }});
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 = $('<div />').addClass(this.opts['class']).dialog(this.opts.dialog);
this.message = $('<div class="el-dialogform-message rounded-5" />').hide().appendTo(this.dialog);
this.error = $('<div class="el-dialogform-error rounded-5" />').hide().appendTo(this.dialog);
this.spinner = $('<div class="spinner" />').hide().appendTo(this.dialog);
this.content = $('<div class="el-dialogform-content" />').appendTo(this.dialog)
this.form = $('<form />').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 && $.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 = $('<ul />').prependTo(this.form);
}
$('<li />').append($('<a />').attr('href', '#'+id).html(title)).appendTo(this.ul);
this.tabs[id] = {tab : $('<div />').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 = $('<table />').appendTo(this.tabs[id].tab);
} else {
this._table = $('<table />').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 = $('<tr />').appendTo(this.tabs[tid].table);
if (!$.isArray(data)) {
tr.append($('<td />').append(data));
} else {
for (var i=0; i < data.length; i++) {
tr.append($('<td />').append(data[i]));
};
}
} else {
if (!$.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 (!$.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 = $('<tr />').appendTo(this._table);
if (!$.isArray(data)) {
tr.append($('<td />').append(data));
} else {
for (var i=0; i < data.length; i++) {
tr.append($('<td />').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($('<div />').addClass('separator'));
this.tabs[tid].table && this.table(tid);
} else {
this.form.append($('<div />').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');
this.form.find(':text').eq(0).focus();
return this;
}
/**
* Close dialog window and destroy content
* @return void
**/
this.close = function() {
this.dialog.dialog('destroy').remove();
}
}
+104
View File
@@ -0,0 +1,104 @@
/**
* @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;
}
}
+137
View File
@@ -0,0 +1,137 @@
/**
* 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 = $('<input type="text" />')
.attr({'name' : opts.name+'[width]', size : 3}).css('text-align', 'right')
.change(function() { $self.change(); });
var color = $('<div />').css('position', 'relative')
.elColorPicker({
'class' : 'el-colorpicker ui-icon ui-icon-pencil',
name : opts.name+'[color]',
palettePosition : 'outer',
change : function() { $self.change(); }
});
var style = $('<div />').elSelect({
tpl : '<div style="border-bottom:4px %val #000;width:100%;margin:7px 0"> </div>',
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(
$('<table />').attr('cellspacing', 0).append(
$('<tr />')
.append($('<td />').append(width).append(' px'))
.append($('<td />').append(style))
.append($('<td />').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) {
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.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);
+231
View File
@@ -0,0 +1,231 @@
/**
* 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 = $('<input type="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 = $('<div />').addClass(opts.paletteClass+' rounded-3');
for (var i=0; i < opts.colors.length; i++) {
$('<div />')
.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 = $('<input type="text" />')
.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 = $('<div />')
.addClass('preview rounded-3')
.click(function(e) {
e.stopPropagation();
setColor(self.input.val());
});
self.palette
.append($('<div />').addClass('clearfix'))
.append($('<div />').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) { window.console && window.console.log && window.console.log(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);
+91
View File
@@ -0,0 +1,91 @@
/**
* jQuery plugin. Context menu
*
* Usage:
* var opts = {
* '.dir-r' : [
* {label : '<span class="icon icon-open"></span> Open', action : function(o) { window.console.log(o); } },
* {},
* {label : '<span class="icon icon-rename"></span> Rename', action : function(o) { window.console.log(o); } },
* {},
* {label : '<span class="icon icon-remove"></span> Remove', action : function(o) { window.console.log(o); } }
* ]
* }
* $('#selector').elcontextmenu(opts);
*
* @author: Dmitry Levashov (dio) dio@std42.ru
**/
(function($) {
var selectors = {};
var menu = document.createElement('div');
/**
* Bind function showmenu on right click
*
* @param Object - context menu options. Object.
* @context DOMElement - context for menu. if not set, document.body used
* @callback Function - callback for menu click
**/
$.elcontextmenu = function(options, context, callback) {
context = context||document.body;
$(menu).hide().addClass('el-contextmenu rounded-5').appendTo(document.body);
for (name in options) {
selectors[name] = options[name];
$(name, context).bind(window.opera?'click':'contextmenu', showmenu);
}
menu.callback = callback;
};
function showmenu(event) {
event.stopPropagation();
reset();
if (window.opera && !event.ctrlKey) {
return;
} else {
$(document.body).mousedown(function(event){ reset(); });
}
for (name in selectors) {
if ($.inArray(event.currentTarget, $(name)) > -1) {
if (menu.callback) {
menu.callback(event);
}
variants = selectors[name]
$(variants).each( function() {
if (!this.label) {
$('<div />').addClass('delim').appendTo(menu);
} else {
var action = this.action
$('<div></div>').html(this.label).mousedown(function(clickEvent) {
clickEvent.stopPropagation();
reset();
if (typeof(action) == 'function') {
action(event.currentTarget);
}
})
.hover(
function() { $(this).addClass('el-contextmenu-hover'); },
function() { $(this).removeClass('el-contextmenu-hover'); }
)
.appendTo(menu);
}
})
}
}
var size = {
'height' : $(window).height(),
'width' : $(window).width(),
'sT' : $(window).scrollTop(),
'cW' : $(menu).width(),
'cH' : $(menu).height()
};
$(menu).css({
'left' : ((event.clientX + size.cW) > size.width ? ( event.clientX - size.cW) : event.clientX),
'top' : ((event.clientY + size.cH) > size.height && event.clientY > size.cH ? (event.clientY + size.sT - size.cH) : event.clientY + size.sT)
}).show();
return false;
}
function reset(event){ $(menu).hide().empty(); }
})(jQuery);
+55
View File
@@ -0,0 +1,55 @@
/**
* jQuery plugin. Create directory tree, like Finder or Explorer directory tree
* Used in elFinder.
*
* @author: Dmitry Levashov (dio) dio@std42.ru
**/
(function($) {
$.fn.eldirtree = function(o) {
if (!options) {
var options = o && o.constructor == Object
? $.extend({}, $.fn.eldirtree.defaults, o)
: $.fn.eldirtree.defaults;
}
return this.each(function() {
var self = this;
if (!this.loaded) {
this.loaded = true;
var root = $(this).addClass(options.cssClass)
.find('li').prepend($('<div />')).filter(':has(ul)').children('div').addClass('el-dir-collapsed').click(function(e) {
if ($(this).hasClass('el-dir-expanded')) {
$(this).removeClass('el-dir-expanded').next('a').removeClass('el-dir-expanded').parent('li').children('ul').hide();
} else {
$(this).addClass('el-dir-expanded').next('a').addClass('el-dir-expanded').parent('li').children('ul').show();
}
}).end().end().end()
.children('li').find('a').addClass('el-dir-collapsed rounded-3').end();
if (root.length == 1) {
root.children('a, div').addClass('el-dir-expanded').end().find('ul li ul').hide();
} else {
root.find('ul').hide();
}
root.find('a').bind('click cd', function(e) {
e.stopPropagation();
e.preventDefault();
root.find('a').removeClass('selected');
$(this).addClass('selected').parent().parents('li').filter(':has(ul)').children('a, div').addClass('el-dir-expanded').end().children('ul').show();
e.type == 'click' && options.callback($(this));
})
root.eq(0).children('a').addClass('selected');
}
});
}
$.fn.eldirtree.defaults = {
cssClass : 'el-dir-tree',
callback : function() {}
};
})(jQuery);
+138
View File
@@ -0,0 +1,138 @@
/**
* 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] = $('<input type="text" />')
.attr('size', 3)
.css('text-align', 'right')
.bind('change', function() { $(this).val(parseNum($(this).val())); change(); })
.attr('name', opts.name+'['+this+']');
});
$.each(['uleft', 'utop', 'uright', 'ubottom'], function() {
self[this] = $('<select />')
.append('<option value="px">px</option>')
.append('<option value="em">em</option>')
.append('<option value="pt">pt</option>')
.bind('change', function() { change(); })
.attr('name', opts.name+'['+this+']');
if (opts.percents) {
self[this].append('<option value="%">%</option>');
}
});
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);
+175
View File
@@ -0,0 +1,175 @@
/**
* 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 = $('<input type="hidden" />').attr('name', opts.name);
var label = $('<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 = $('<div />')));
}
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 = $('<div />')
.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;
$('<div />')
.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 : 310
}
})(jQuery);
+20
View File
@@ -0,0 +1,20 @@
/*@import "styling.css";*/
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
{ border:1px dotted #99ccff; }
body.el-rte-structure .el-rte-anchor {
display:inline-block;
vertical-align:baseline;
width:12px;
height:12px;
border:1px dotted #ccc;
background: url('../images/elrte-toolbar.png') -564px -8px no-repeat;
}
+231
View File
@@ -0,0 +1,231 @@
/* контейнер */
.el-rte {
font-family: Trebuchet MS, Verdana, Geneva,sans-serif;
}
.el-rte.el-fullscreen {
position:absolute;
width:100%;
height:100%;
top:0;
left:0;
z-index:101;
}
/* панель инструментов */
.el-rte .toolbar { background:#eee; padding:3px 7px 2px 7px; border:1px solid #ccc; }
/* панель кнопок */
.el-rte .toolbar ul {
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') -857px -2px no-repeat;
}
/* первая панель кнопок */
.el-rte .toolbar ul.first {
background:transparent;
padding-left:0;
}
/* кнопка */
.el-rte .toolbar ul li {
display:inline-block;
display: -moz-inline-stack;
display: inline-block;
height:22px;
width:22px;
vertical-align: top;
zoom: 1;
*display: inline;
margin:1px 1px;
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; }
/* кнопки */
.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.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.media {background-position:-410px -1px}
.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}
/* рабочая зона (обертка над iframe) */
.el-rte .workzone { border:1px solid #eee; border-top:none;height:100%; min-height:400px; }
.el-rte.small .workzone { min-height:250px; }
/* source code */
.el-rte textarea { width:100%; height:100%; min-height:400px; border:none; zoom:1;}
.el-rte.small textarea { min-height:250px;}
/* редактор */
.el-rte iframe {
width: 100%;
min-height:400px;
height:100%;
outline:0;
border:none;
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 .tabsbar { display: block; margin-bottom:.7em; }
.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; }
/* выпадающие меню */
/* 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;
}
/* 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;
}
/* colors palette */
.el-palette { top:20px; }
/* диалоговые окна */
.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;
}
/* 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; }
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

+611
View File
@@ -0,0 +1,611 @@
/*
* DOM utilites for elRTE
*
* @author: Dmitry Levashov (dio) dio@std42.ru
*/
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);
}
/**
* Вовращает индекс элемента внутри родителя
*
* @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;
}
/********************************************************/
/* Поиск элементов */
/********************************************************/
/**
* Вовращает элемент(ы) отвечающие условиям поиска
*
* @param DOMElement||Array n нода
* @param RegExp||String filter фильтр условия поиска (RegExp или имя ключа this.regExp или *)
* @return DOMElement||Array
**/
this.filter = function(n, filter) {
filter = this.regExp[filter] || filter;
if (!n.push) {
return n.nodeName && filter.test(n.nodeName) ? n : null;
}
var ret = [];
for (var i=0; i < n.length; i++) {
if (n[i].nodeName && n[i].nodeName && filter.test(n[i].nodeName)) {
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 = [];
filter = filter == '*' ? /.?/ : (this.regExp[filter] || filter);
filter = this.regExp[filter] || filter;
while (n && (n = n.parentNode) && n.nodeName != 'BODY' && n.nodeName != 'HTML') {
if (filter.test(n.nodeName)) {
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.filter(n, sf) || 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;
}
/********************************************************/
/* Изменения DOM */
/********************************************************/
/**
* Оборачивает одну ноду другой
*
* @param DOMElement n оборачиваемая нода
* @param DOMElement w нода обертка или имя тега
* @return DOMElement
**/
this.wrap = function(n, w) {
n = n.length ? n : [n];
w = w.nodeName ? w : this.create(w);
w = n[0].parentNode.insertBefore(w, n[0]);
$(n).each(function() {
if (this!=w) {
w.appendChild(this);
}
})
return w;
}
/**
* Оборачивает все содержимое ноды
*
* @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; y<h; y++) {
for (var x=0; x<w; x++) {
var _y = r+y;
if (!$.isArray(mx[_y])) {
mx[_y] = [];
}
var d = x==0 && y==0 ? this : (y==0 ? x : "-");
mx[_y][i+x] = d;
}
};
max= Math.max(max, mx[r].length);
});
});
}
return mx;
}
this.indexesOfCell = function(n, tbm) {
for (var rnum=0; rnum < tbm.length; rnum++) {
for (var cnum=0; cnum < tbm[rnum].length; cnum++) {
if (tbm[rnum][cnum] == n) {
return [rnum, cnum];
}
};
};
}
this.fixTable = function(n) {
if (n && n.nodeName == 'TABLE') {
var tb = $(n);
//tb.find('tr:empty').remove();
var mx = this.tableMatrix(n);
var x = 0;
$.each(mx, function() {
x = Math.max(x, this.length);
});
if (x==0) {
return tb.remove();
}
// for (var i=0; i<mx.length; i++) {
// this.rte.log(mx[i]);
// }
for (var r=0; r<mx.length; r++) {
var l = mx[r].length;
//this.rte.log(r+' : '+l)
if (l==0) {
//this.rte.log('remove: '+tb.find('tr').eq(r))
tb.find('tr').eq(r).remove();
// tb.find('tr').eq(r).append('<td>remove</td>')
} else if (l<x) {
var cnt = x-l;
var row = tb.find('tr').eq(r);
for (i=0; i<cnt; i++) {
row.append('<td>&nbsp;</td>');
}
}
}
}
}
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<mx.length; r++) {
for (var _x=0; _x<mx[r].length; _x++) {
if (mx[r][_x] == n) {
x = _x;
_s = true;
break;
}
}
if (_s) {
break;
}
}
// this.rte.log('matrix');
// for (var i=0; i<mx.length; i++) {
// this.rte.log(mx[i]);
// }
if (x>=0) {
for(var r=0; r<mx.length; r++) {
var tmp = mx[r][x]||null;
if (tmp) {
if (tmp.nodeName) {
ret.push(tmp);
if (ext) {
info.delta.push(0);
info.offset.push(x);
}
} else {
var d = parseInt(tmp);
if (!isNaN(d) && mx[r][x-d] && mx[r][x-d].nodeName) {
ret.push(mx[r][x-d]);
if (ext) {
info.delta.push(d);
info.offset.push(x);
}
}
}
}
}
}
}
return !ext ? ret : {column : ret, info : info};
}
}
+314
View File
@@ -0,0 +1,314 @@
/*
* 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) {
var self = this;
this.version = '1.0 RC1';
this.options = $.extend(true, {}, this.options, opts);
this.browser = $.browser;
this.editor = $('<div />').addClass(this.options.cssClass);
this.toolbar = $('<div />').addClass('toolbar').appendTo(this.editor);
this.iframe = document.createElement('iframe');
this.workzone = $('<div />').addClass('workzone').appendTo(this.editor).append(this.iframe);
this.statusbar = $('<div />').addClass('statusbar').appendTo(this.editor);
this.tabsbar = $('<div />').addClass('tabsbar').appendTo(this.editor);
this.source = $('<textarea />').appendTo(this.workzone).hide();
this.target = null;
this.doc = null;
this.window = null;
this.utils = new this.utils(this);
this.dom = new this.dom(this);
this._i18n = new eli18n({textdomain : 'rte', messages : { rte : this.i18Messages[this.options.lang] || {}} });
if (!target || !target.nodeName) {
alert('elRTE: argument "target" is not DOM Element');
return;
}
this.init = function() {
this.options.height>0 && this.workzone.height(this.options.height);
var src = this.filter(target.nodeName == 'TEXTAREA' ? $(target).val() : $(target).html(), true);
this.source.val(src);
this.source.attr('name', $(target).attr('name')||$(target).attr('id'));
if (this.options.allowSource) {
this.tabsbar.append($('<div />').text(self.i18n('Editor')).addClass('tab editor rounded-bottom-7 active'))
.append($('<div />').text(self.i18n('Source')).addClass('tab source rounded-bottom-7'))
.append($('<div />').addClass('clearfix'));
}
this.target = $(target).replaceWith(this.editor);
this.window = this.iframe.contentWindow;
this.doc = this.iframe.contentWindow.document;
html = '<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
if (self.options.cssfiles.length) {
$.each(self.options.cssfiles, function() {
html += '<link rel="stylesheet" type="text/css" href="'+this+'" />';
});
}
html = self.options.doctype+html+'</head><body>'+src+'</body></html>';
this.doc.open();
this.doc.write(html);
this.doc.close();
if(!this.doc.body.firstChild) {
this.doc.body.appendChild(this.doc.createElement('br'));
}
if (this.browser.msie) {
//this.source.attr('rows', parseInt(this.options.height/17));
this.doc.body.contentEditable = true;
} else {
try { this.doc.designMode = "on"; }
catch(e) { }
this.doc.execCommand('styleWithCSS', false, this.options.styleWithCSS);
}
this.window.focus();
this.selection = new this.selection(this);
this.ui = new this.ui(this);
this.editor.parents('form').eq(0).submit(function(e) {
if (self.source.css('display') == 'none') {
self.updateSource();
}
self.toolbar.find(':hidden').remove();
});
$(this.doc)
.keydown(function(e) {
if (self.browser.safari && e.keyCode == 13) {
if (e.shiftKey || !self.dom.parent(self.selection.getNode(), /^(P|LI)$/)) {
self.selection.insertNode(self.doc.createElement('br'))
return false;
}
}
})
.bind('keyup mouseup', function(e) {
if (e.type == 'mouseup' || e.ctrlKey || e.metaKey || (e.keyCode >= 8 && e.keyCode <= 13) || (e.keyCode>=32 && e.keyCode<= 40) || e.keyCode == 46 || (e.keyCode >=96 && e.keyCode <= 111)) {
self.ui.update();
}
});
}
this.init();
}
/**
* 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();
this.target.hide();
}
/**
* Hide editor and display elements on wich editor was created
*
* @return void
**/
elRTE.prototype.close = function() {
this.editor.hide();
this.target.show();
}
elRTE.prototype.updateEditor = function() {
$(this.doc.body).html( this.filter(this.source.val(), true) );
this.window.focus();
this.ui.update(true);
}
elRTE.prototype.updateSource = function() {
this.source.val(this.filter($(this.doc.body).html()));
}
/**
* Return edited text
*
* @return String
**/
elRTE.prototype.val = function(val) {
if (val) {
$(this.doc.body).html( this.filter(val, true) );
} else {
this.updateSource();
return this.source.val();
}
}
/**
* Submit form
*
* @return void
**/
elRTE.prototype.save = function() {
this.editor.parents('form').submit();
}
elRTE.prototype.filter = function(v, input) {
var html = '';
var node = $('<span />');
if (!v.nodeType) {
html = $.trim(v);
} else {
html = $.trim(v.nodeType == 1 ? $(v).html() : v.nodeValue);
}
var sw = this.options.stripWhiteSpace;
$.each(this.filters.html, function() {
html = this(html, sw);
});
node.html(html);
if (input) {
node.find('a').each(function() {
if ($(this).attr('name')) {
$(this).addClass('el-rte-anchor');
}
});
} else {
node.find('a.el-rte-anchor').each(function() {
if ($.trim($(this).attr('class')) == 'el-rte-anchor') {
$(this).removeAttr('class');
} else {
$(this).removeClass('el-rte-anchor');
}
});
}
$.each(this.filters.dom, function() {
node = this(node);
});
return node.html();
}
elRTE.prototype.filters = {
dom : [
function(n) {
n.find('[align]').not('tbody,tr').each(function() {
var a = ($(this).attr('align')||'').toLowerCase();
if ((this.nodeName != 'TD' && this.nodeName != 'TH') || a != 'left') {
$(this).css('text-align', a).removeAttr('align');
}
})
.end().end().find('[border],[bordercolor]').each(function() {
var w = parseInt($(this).attr('border')) || 1,
c = $(this).attr('bordercolor') || '#000';
$(this).css('border', w+'px solid '+c).removeAttr('border').removeAttr('bordercolor');
})
.end().find('[bgcolor]').each(function() {
$(this).css('background-color', $(this).attr('bgcolor')).removeAttr('bgcolor');
}).end().find('[background]').each(function() {
$(this).css('background', 'url('+$(this).attr('background')+')' ).removeAttr('background');
})
.end().find('img[hspace],[vspace]').each(function() {
var v = parseInt($(this).attr('vspace'))||0,
h = parseInt($(this).attr('hspace'))||0;
if (v>0 || h>0) {
$(this).css('margin', (v>0?v:0)+'px '+(h>0?h:0)+'px');
}
$(this).removeAttr('hspace').removeAttr('vspace');
})
.end().find('[clear]').each(function() {
var c = ($(this).attr('clear')||"").toLowerCase();
$(this).css('clear', c == 'all' ? 'both' : c);
});
if ($.browser.safari) {
n.find('.Apple-style-span').removeClass('Apple-style-span');
}
return n;
}
],
html : [
function(html, stripWhiteSpace) {
var fsize = {
1 : 'xx-small',
2 : 'x-small',
3 : 'small',
4 : 'medium',
5 : 'large',
6 : 'x-large',
7 : 'xx-large'
}
html = html.replace(/<font([^>]*)/i, function(str, attr) {
var css = '', m = attr.match(/size=('|")(\d)/i);
if (m && m[2] && fsize[m[2]]) {
css = 'font-size: '+fsize[m[2]]+'; ';
}
m = attr.match(/face=('|")([a-z0-9\s,]+)/i);
if (m && m[2]) {
css += 'font-family: '+m[2];
}
return '<span'+(css ? ' style="'+css+'"' : '');
})
.replace(/<\/font/i, '</span')
.replace(/<b(\s[^>]*)?>/i, '<strong$1>')
.replace(/<\/b\s*>/i, '</strong>')
.replace(/<i(\s[^>]*)?>/i, '<em$1>')
.replace(/<\/i\s*>/i, '</em>')
.replace(/((class|style)="")/i, '');
//.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/, '')
if (stripWhiteSpace) {
html = html.replace(/\r?\n(\s)*/mg, "\n");
}
return html
}
]
}
elRTE.prototype.log = function(msg) {
if (window.console && window.console.log) {
window.console.log(msg);
}
}
elRTE.prototype.i18Messages = {};
$.fn.elrte = function(o) {
return this.each(function() {
var rte = new elRTE(this, o);
});
}
})(jQuery);
+135
View File
@@ -0,0 +1,135 @@
/*
* elRTE configuration
*
* @param doctype - doctype for editor iframe
* @param cssClass - css class for editor
* @param cssFiles - array of css files, witch will inlude in iframe
* @param height - not used now (may be deleted in future)
* @param lang - interface language (requires file in i18n dir)
* @param toolbar - name of toolbar to load
* @param absoluteURLs - convert files and images urls to absolute or not
* @param allowSource - is source editing allowing
* @param stripWhiteSpace - strip лишние whitespaces/tabs or not
* @param styleWithCSS - use style=... instead of strong etc.
* @param fmAllow - allow using file manger (elFinder)
* @param fmOpen - callback for open file manager
* @param buttons - object with pairs of buttons classes names and titles (when create new button, you have to add iys name here)
* @param panels - named groups of buttons
* @param panelNames - title of panels (required for one planned feature)
* @param toolbars - named redy to use toolbals (you may combine your own toolbar)
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* Copyright: Studio 42, http://www.std42.ru
*/
elRTE.prototype.options = {
doctype : '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
cssClass : 'el-rte',
cssfiles : [],
height : null,
lang : 'en',
toolbar : 'normal',
absoluteURLs : true,
allowSource : true,
stripWhiteSpace : false,
styleWithCSS : false,
fmAllow : true,
fmOpen : null,
buttons : {
'save' : 'Save',
'copy' : 'Copy',
'cut' : 'Cut',
'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',
'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',
'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'
},
panels : {
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', 'nbsp'],
links : ['link', 'unlink', 'anchor'],
images : ['image'],
media : ['image'],
tables : ['table', 'tableprops', 'tablerm', 'tbrowbefore', 'tbrowafter', 'tbrowrm', 'tbcolbefore', 'tbcolafter', 'tbcolrm', 'tbcellprops', 'tbcellsmerge', 'tbcellsplit'],
elfinder : ['elfinder'],
fullscreen : ['fullscreen']
},
toolbars : {
tiny : ['style'],
compact : ['save', 'undoredo', 'style', 'alignment', 'lists', 'links', 'fullscreen'],
normal : ['save', 'copypaste', 'undoredo', 'style', 'alignment', 'colors', 'indent', 'lists', 'links', 'elements', 'images', 'fullscreen'],
complite : ['save', 'copypaste', 'undoredo', 'style', 'alignment', 'colors', 'format', 'indent', 'lists', 'links', 'elements', 'media', 'fullscreen'],
maxi : ['save', 'copypaste', 'undoredo', 'style', 'alignment', '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',
links : 'Links',
images : 'Images',
media : 'Media',
tables : 'Tables',
elfinder : 'File manager (elFinder)'
}
};
+639
View File
@@ -0,0 +1,639 @@
/**
* @class selection - elRTE utils for working with text selection
*
* @param elRTE rte объект-редактор
*
* @author: Dmitry Levashov (dio) dio@std42.ru
**/
elRTE.prototype.selection = function(rte) {
this.rte = rte;
var self = this;
this.w3cRange = null;
var start, end, node, bm;
$(this.rte.doc)
.keyup(function(e) {
if (e.ctrlKey || e.metaKey || (e.keyCode >= 8 && e.keyCode <= 13) || (e.keyCode>=32 && e.keyCode<= 40) || e.keyCode == 46 || (e.keyCode >=96 && e.keyCode <= 111)) {
self.cleanCache();
}
})
.mousedown(function(e) {
if (e.target.nodeName == 'HTML') {
start = self.rte.doc.body;
} else {
start = e.target;
}
end = node = null;
})
.mouseup(function(e) {
if (e.target.nodeName == 'HTML') {
end = self.rte.doc.body;
} else {
end = e.target;
}
end = e.target;
node = null;
}).click();
/**
* возвращает selection
*
* @return Selection
**/
function selection() {
return self.rte.window.getSelection ? self.rte.window.getSelection() : self.rte.window.document.selection;
}
/**
* Вспомогательная функция
* Возвращает самого верхнего родителя, отвечающего условию - текущая нода - его единственная непустая дочерняя нода
*
* @param DOMElement n нода, для которой ищем родителя
* @param DOMElement p если задана - нода, выше которой не поднимаемся
* @param String s строна поиска (left||right||null)
* @return DOMElement
**/
function realSelected(n, p, s) {
while (n.nodeName != 'BODY' && n.parentNode && n.parentNode.nodeName != 'BODY' && (p ? n!== p && n.parentNode != p : 1) && ((s=='left' && self.rte.dom.isFirstNotEmpty(n)) || (s=='right' && self.rte.dom.isLastNotEmpty(n)) || (self.rte.dom.isFirstNotEmpty(n) && self.rte.dom.isLastNotEmpty(n))) ) {
n = n.parentNode;
}
return n;
}
/**
* Возвращает TRUE, если выделение "схлопнуто"
*
* @return bool
**/
this.collapsed = function() {
return this.getRangeAt().isCollapsed();
}
/**
* "Схлопывает" выделение
*
* @param bool toStart схлопнуть к начальной точке
* @return void
**/
this.collapse = function(toStart) {
this.getRangeAt().collapse(toStart ? true : false);
}
/**
* Возвращает TextRange
* Для нормальных браузеров - нативный range
* для "самизнаетечего" - эмуляцию w3c range
*
* @return range|w3cRange
**/
this.getRangeAt = function(updateW3cRange) {
if (this.rte.browser.msie) {
if (!this.w3cRange) {
this.w3cRange = new this.rte.w3cRange(this.rte);
}
updateW3cRange && this.w3cRange.update();
return this.w3cRange;
}
var s = selection();
var r = s.rangeCount > 0 ? s.getRangeAt(0) : this.rte.doc.createRange();
r.getStart = function() {
return this.startContainer.nodeType==1
? this.startContainer.childNodes[Math.min(this.startOffset, this.startContainer.childNodes.length-1)]
: this.startContainer;
}
r.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;
}
r.isCollapsed = function() {
return this.collapsed;
}
return r;
}
this.saveIERange = function() {
if ($.browser.msie) {
bm = this.getRangeAt().getBookmark();
}
}
this.restoreIERange = function() {
$.browser.msie && bm && this.getRangeAt().moveToBookmark(bm);
}
/**
* Выделяет ноды
*
* @param DOMNode s нода начала выделения
* @param DOMNode e нода конца выделения
* @return selection
**/
this.select = function(s, e) {
e = e||s;
var r = this.getRangeAt();
r.setStartBefore(s);
r.setEndAfter(e);
if (this.rte.browser.msie) {
r.select();
} else {
var s = selection();
s.removeAllRanges();
s.addRange(r);
}
return this.cleanCache();
}
/**
* Выделяет содержимое ноды
*
* @param Element n нода
* @return selection
**/
this.selectContents = function(n) {
var r = this.getRangeAt();
if (n && n.nodeType == 1) {
if (this.rte.browser.msie) {
r.range();
r.r.moveToElementText(n.parentNode);
r.r.select();
} else {
try {
r.selectNodeContents(n);
} catch (e) {
return this.rte.log('unable select node contents '+n);
}
var s = selection();
s.removeAllRanges();
s.addRange(r);
}
}
return this;
}
/**
* Вставляет ноду в текущее выделение
*
* @param Element n нода
* @return selection
**/
this.insertNode = function(n, collapse) {
if (collapse && !this.collapsed()) {
this.collapse();
}
if (this.rte.browser.msie) {
var html = n.nodeType == 3 ? n.nodeValue : $(this.rte.dom.create('span')).append($(n)).html();
var r = this.getRangeAt();
r.insertNode(html);
} else {
var r = this.getRangeAt();
r.insertNode(n);
r.setStartAfter(n);
r.setEndAfter(n);
var s = selection();
s.removeAllRanges();
s.addRange(r);
}
return this.cleanCache();
}
/**
* Вставляет html в текущее выделение
*
* @param Element n нода
* @return selection
**/
this.insertHtml = function(html, collapse) {
if (collapse && !this.collapsed()) {
this.collapse();
}
if (this.rte.browser.msie) {
this.getRangeAt().range().pasteHTML(html);
} else {
var n = $(this.rte.dom.create('span')).html(html||'').get(0);
this.insertNode(n);
$(n).replaceWith($(n).html());
}
return this.cleanCache();
}
/**
* Вставляет ноду в текущее выделение
*
* @param Element n нода
* @return selection
**/
this.insertText = function(text, collapse) {
var n = this.rte.doc.createTextNode(text);
return this.insertHtml(n.nodeValue);
}
/**
* Очищает кэш
*
* @return selection
**/
this.cleanCache = function() {
start = end = node = null;
return this;
}
/**
* Возвращает ноду начала выделения
*
* @return DOMElement
**/
this.getStart = function() {
if (!start) {
var r = this.getRangeAt();
start = r.getStart();
}
return start;
}
/**
* Возвращает ноду конца выделения
*
* @return DOMElement
**/
this.getEnd = function() {
if (!end) {
var r = this.getRangeAt();
end = r.getEnd();
}
return end;
}
/**
* Возвращает выбраную ноду (общий контейнер всех выбранных нод)
*
* @return Element
**/
this.getNode = function() {
if (!node) {
node = this.rte.dom.findCommonAncestor(this.getStart(), this.getEnd());
}
return node;
}
/**
* Возвращает массив выбранных нод
*
* @param Object o параметры получения и обработки выбраных нод
* @return Array
**/
this.selected = function(o) {
var opts = {
collapsed : false, // вернуть выделение, даже если оно схлопнуто
blocks : false, // блочное выделение
filter : false, // фильтр результатов
wrap : 'text', // что оборачиваем
tag : 'span' // во что оборачиваем
}
opts = $.extend({}, opts, o);
// блочное выделение - ищем блочную ноду, но не таблицу
if (opts.blocks) {
var n = this.getNode(), _n = null;
if (_n = this.rte.dom.selfOrParent(n, 'selectionBlock') ) {
return [_n];
}
}
var sel = this.selectedRaw(opts.collapsed, opts.blocks);
var ret = [];
var buffer = [];
var ndx = null;
// оборачиваем ноды в буффере
function wrap() {
function allowParagraph() {
for (var i=0; i < buffer.length; i++) {
if (buffer[i].nodeType == 1 && (self.rte.dom.selfOrParent(buffer[i], /^P$/) || $(buffer[i]).find('p').length>0)) {
return false;
}
};
return true;
}
if (buffer.length>0) {
var tag = opts.tag == 'p' && !allowParagraph() ? 'div' : opts.tag;
var n = self.rte.dom.wrap(buffer, tag);
ret[ndx] = n;
ndx = null;
buffer = [];
}
}
// добавляем ноды в буффер
function addToBuffer(n) {
if (n.nodeType == 1) {
if (/^(THEAD|TFOOT|TBODY|COL|COLGROUP|TR)$/.test(n.nodeName)) {
$(n).find('td,th').each(function() {
var tag = opts.tag == 'p' && $(this).find('p').length>0 ? 'div' : opts.tag;
var n = self.rte.dom.wrapContents(this, tag);
return ret.push(n);
})
} else if (/^(CAPTION|TD|TH|LI|DT|DD)$/.test(n.nodeName)) {
var tag = opts.tag == 'p' && $(n).find('p').length>0 ? 'div' : opts.tag;
var n = self.rte.dom.wrapContents(n, tag);
return ret.push(n);
}
}
var prev = buffer.length>0 ? buffer[buffer.length-1] : null;
if (prev && prev != self.rte.dom.prev(n)) {
wrap();
}
buffer.push(n);
if (ndx === null) {
ndx = ret.length;
ret.push('dummy'); // заглушка для оборачиваемых элементов
}
}
if (sel.nodes.length>0) {
for (var i=0; i < sel.nodes.length; i++) {
var n = sel.nodes[i];
// первую и посл текстовые ноды разрезаем, если необходимо
if (n.nodeType == 3 && (i==0 || i == sel.nodes.length-1) && $.trim(n.nodeValue).length>0) {
if (i==0 && sel.so>0) {
n = n.splitText(sel.so);
}
if (i == sel.nodes.length-1 && sel.eo>0) {
n.splitText(i==0 && sel.so>0 ? sel.eo - sel.so : sel.eo);
}
}
switch (opts.wrap) {
// оборачиваем только текстовые ноды с br
case 'text':
if ((n.nodeType == 1 && n.nodeName == 'BR') || (n.nodeType == 3 && $.trim(n.nodeValue).length>0)) {
addToBuffer(n);
} else if (n.nodeType == 1) {
ret.push(n);
}
break;
// оборачиваем все инлайн элементы
case 'inline':
if (this.rte.dom.isInline(n)) {
addToBuffer(n);
} else if (n.nodeType == 1) {
ret.push(n);
}
break;
// оборачиваем все
case 'all':
if (n.nodeType == 1 || !this.rte.dom.isEmpty(n)) {
addToBuffer(n);
}
break;
// ничего не оборачиваем
default:
if (n.nodeType == 1 || !this.rte.dom.isEmpty(n)) {
ret.push(n);
}
}
};
wrap();
}
// this.rte.log('buffer')
// this.rte.log(buffer)
// this.rte.log('ret')
// this.rte.log(ret)
return opts.filter ? this.rte.dom.filter(ret, opts.filter) : ret;
}
this.dump = function(ca, s, e, so, eo) {
var r = this.getRangeAt();
this.rte.log('commonAncestorContainer');
this.rte.log(ca || r.commonAncestorContainer);
// this.rte.log('commonAncestorContainer childs num')
// this/rte.log((ca||r.commonAncestorContainer).childNodes.length)
this.rte.log('startContainer');
this.rte.log(s || r.startContainer);
this.rte.log('startOffset: '+(so>=0 ? so : r.startOffset));
this.rte.log('endContainer');
this.rte.log(e||r.endContainer);
this.rte.log('endOffset: '+(eo>=0 ? eo : r.endOffset));
}
/**
* Возвращает массив выбранных нод, как есть
*
* @param bool возвращать если выделение схлопнуто
* @param bool "блочное" выделение (текстовые ноды включаются полностью, не зависимо от offset)
* @return Array
**/
this.selectedRaw = function(collapsed, blocks) {
var res = {so : null, eo : null, nodes : []};
var r = this.getRangeAt(true);
var ca = r.commonAncestorContainer;
var s, e; // start & end nodes
var sf = false; // start node fully selected
var ef = false; // end node fully selected
// возвращает true, если нода не текстовая или выделена полностью
function isFullySelected(n, s, e) {
if (n.nodeType == 3) {
e = e>=0 ? e : n.nodeValue.length;
return (s==0 && e==n.nodeValue.length) || $.trim(n.nodeValue).length == $.trim(n.nodeValue.substring(s, e)).length;
}
return true;
}
// возвращает true, если нода пустая или в ней не выделено ни одного непробельного символа
function isEmptySelected(n, s, e) {
if (n.nodeType == 1) {
return self.rte.dom.isEmpty(n);
} else if (n.nodeType == 3) {
return $.trim(n.nodeValue.substring(s||0, e>=0 ? e : n.nodeValue.length)).length == 0;
}
return true;
}
//this.dump()
// начальная нода
if (r.startContainer.nodeType == 1) {
if (r.startOffset<r.startContainer.childNodes.length) {
s = r.startContainer.childNodes[r.startOffset];
res.so = s.nodeType == 1 ? null : 0;
} else {
s = r.startContainer.childNodes[r.startOffset-1];
res.so = s.nodeType == 1 ? null : s.nodeValue.length;
}
} else {
s = r.startContainer;
res.so = r.startOffset;
}
// выделение схлопнуто
if (r.collapsed) {
if (collapsed) {
// блочное выделение
if (blocks) {
s = realSelected(s);
if (!this.rte.dom.isEmpty(s) || (s = this.rte.dom.next(s))) {
res.nodes = [s];
}
// добавляем инлайн соседей
if (this.rte.dom.isInline(s)) {
res.nodes = this.rte.dom.toLineStart(s).concat(res.nodes, this.rte.dom.toLineEnd(s));
}
// offset для текстовых нод
if (res.nodes.length>0) {
res.so = res.nodes[0].nodeType == 1 ? null : 0;
res.eo = res.nodes[res.nodes.length-1].nodeType == 1 ? null : res.nodes[res.nodes.length-1].nodeValue.length;
}
} else if (!this.rte.dom.isEmpty(s)) {
res.nodes = [s];
}
}
return res;
}
// конечная нода
if (r.endContainer.nodeType == 1) {
e = r.endContainer.childNodes[r.endOffset-1];
res.eo = e.nodeType == 1 ? null : e.nodeValue.length;
} else {
e = r.endContainer;
res.eo = r.endOffset;
}
// this.rte.log('select 1')
//this.dump(ca, s, e, res.so, res.eo)
// начальная нода выделена полностью - поднимаемся наверх по левой стороне
if (s.nodeType == 1 || blocks || isFullySelected(s, res.so, s.nodeValue.length)) {
// this.rte.log('start text node is fully selected')
s = realSelected(s, ca, 'left');
sf = true;
res.so = s.nodeType == 1 ? null : 0;
}
// конечная нода выделена полностью - поднимаемся наверх по правой стороне
if (e.nodeType == 1 || blocks || isFullySelected(e, 0, res.eo)) {
// this.rte.log('end text node is fully selected')
e = realSelected(e, ca, 'right');
ef = true;
res.eo = e.nodeType == 1 ? null : e.nodeValue.length;
}
// блочное выделение - если ноды не элементы - поднимаемся к родителю, но ниже контейнера
if (blocks) {
if (s.nodeType != 1 && s.parentNode != ca && s.parentNode.nodeName != 'BODY') {
s = s.parentNode;
res.so = null;
}
if (e.nodeType != 1 && e.parentNode != ca && e.parentNode.nodeName != 'BODY') {
e = e.parentNode;
res.eo = null;
}
}
// если контенер выделен полностью, поднимаемся наверх насколько можно
if (s.parentNode == e.parentNode && s.parentNode.nodeName != 'BODY' && (sf && this.rte.dom.isFirstNotEmpty(s)) && (ef && this.rte.dom.isLastNotEmpty(e))) {
// this.rte.log('common parent')
s = e = s.parentNode;
res.so = s.nodeType == 1 ? null : 0;
res.eo = e.nodeType == 1 ? null : e.nodeValue.length;
}
// начальная нода == конечной ноде
if (s == e) {
// this.rte.log('start is end')
if (!this.rte.dom.isEmpty(s)) {
res.nodes.push(s);
}
return res;
}
// this.rte.log('start 2')
//this.dump(ca, s, e, res.so, res.eo)
// находим начальную и конечную точки - ноды из иерархии родителей начальной и конечно ноды, у которых родитель - контейнер
var sp = s;
while (sp.nodeName != 'BODY' && sp.parentNode !== ca && sp.parentNode.nodeName != 'BODY') {
sp = sp.parentNode;
}
//this.rte.log(s.nodeName)
// this.rte.log('start point')
// this.rte.log(sp)
var ep = e;
// this.rte.log(ep)
while (ep.nodeName != 'BODY' && ep.parentNode !== ca && ep.parentNode.nodeName != 'BODY') {
this.rte.log(ep)
ep = ep.parentNode;
}
// this.rte.log('end point')
// this.rte.log(ep)
// если начальная нода не пустая - добавляем ее
if (!isEmptySelected(s, res.so, s.nodeType==3 ? s.nodeValue.length : null)) {
res.nodes.push(s);
}
// поднимаемся от начальной ноды до начальной точки
var n = s;
while (n !== sp) {
var _n = n;
while ((_n = this.rte.dom.next(_n))) {
res.nodes.push(_n);
}
n = n.parentNode;
}
// от начальной точки до конечной точки
n = sp;
while ((n = this.rte.dom.next(n)) && n!= ep ) {
// this.rte.log(n)
res.nodes.push(n);
}
// поднимаемся от конечной ноды до конечной точки, результат переворачиваем
var tmp = [];
n = e;
while (n !== ep) {
var _n = n;
while ((_n = this.rte.dom.prev(_n))) {
tmp.push(_n);
}
n = n.parentNode;
}
if (tmp.length) {
res.nodes = res.nodes.concat(tmp.reverse());
}
// если конечная нода не пустая и != начальной - добавляем ее
if (!isEmptySelected(e, 0, e.nodeType==3 ? res.eo : null)) {
res.nodes.push(e);
}
if (blocks) {
// добавляем инлайн соседей слева
if (this.rte.dom.isInline(s)) {
res.nodes = this.rte.dom.toLineStart(s).concat(res.nodes);
res.so = res.nodes[0].nodeType == 1 ? null : 0;
}
// добавляем инлайн соседей справа
if (this.rte.dom.isInline(e)) {
res.nodes = res.nodes.concat(this.rte.dom.toLineEnd(e));
res.eo = res.nodes[res.nodes.length-1].nodeType == 1 ? null : res.nodes[res.nodes.length-1].nodeValue.length;
}
}
// все радуются! :)
return res;
}
}
+158
View File
@@ -0,0 +1,158 @@
/**
* @class elRTE User interface controller
*
* @param elRTE rte объект-редактор
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* Copyright: Studio 42, http://www.std42.ru
**/
elRTE.prototype.ui = function(rte) {
var self = this;
this.rte = rte;
this._buttons = [];
for (var i in this.buttons) {
if (i != 'button') {
this.buttons[i].prototype = this.buttons.button.prototype;
}
}
// создаем панели и кнопки
var toolbar = rte.options.toolbar && rte.options.toolbars[rte.options.toolbar] ? rte.options.toolbar : 'normal';
var panels = this.rte.options.toolbars[toolbar];
for (var i in panels) {
var name = panels[i];
var panel = $('<ul />').addClass('panel-'.name).appendTo(this.rte.toolbar);
if (i == 0) {
panel.addClass('first');
}
for (var j in this.rte.options.panels[name]) {
var n = this.rte.options.panels[name][j];
var c = this.buttons[n] || this.buttons.button;
var b = new c(this.rte, n);
panel.append(b.domElem);
this._buttons.push(b);
}
}
/**
* Переключает вид редактора между окном редактирования и исходника
**/
this.rte.tabsbar.children('.tab').click(function(e) {
if (!$(e.currentTarget).hasClass('active')) {
self.rte.tabsbar.children('.tab').toggleClass('active');
self.rte.workzone.children().toggle();
if ($(e.currentTarget).hasClass('editor')) {
self.rte.updateEditor();
} else {
self.rte.updateSource();
$.each(self._buttons, function() {
!this.active && this.domElem.addClass('disabled');
});
self.rte.source.focus();
}
}
});
this.update();
}
/**
* Обновляет кнопки - вызывает метод update() для каждой кнопки
*
* @return void
**/
elRTE.prototype.ui.prototype.update = function(cleanCache) {
cleanCache && this.rte.selection.cleanCache();
var n = this.rte.selection.getNode();
var p = this.rte.dom.parents(n, '*');
var path = '';
if (p.length) {
$.each(p.reverse(), function() {
path += ' &raquo; '+ this.nodeName.toLowerCase();
});
}
if (n.nodeType == 1 && n.nodeName != 'BODY') {
path += ' &raquo; '+ n.nodeName.toLowerCase();
}
this.rte.statusbar.html(path)
$.each(this._buttons, function() {
this.update();
});
this.rte.window.focus();
}
elRTE.prototype.ui.prototype.buttons = {
/**
* @class кнопка на toolbar редактора
* реализует поведение по умолчанию и является родителей для других кнопок
*
* @param elRTE rte объект-редактор
* @param String name название кнопки (команда исполняемая document.execCommand())
**/
button : function(rte, name) {
var self = this;
this.rte = rte;
this.active = false;
this.name = name;
this.val = null;
this.domElem = $('<li />')
.addClass(name+' rounded-3')
.attr({name : name, title : this.rte.i18n(this.rte.options.buttons[name] || name), unselectable : 'on'})
.hover(
function() { $(this).addClass('hover'); },
function() { $(this).removeClass('hover'); }
)
.click( function(e) {
e.stopPropagation();
e.preventDefault();
if (!$(this).hasClass('disabled')) {
self.command();
}
});
}
}
/**
* Обработчик нажатия на кнопку на тулбаре. Выполнение команды или открытие окна|меню и тд
*
* @return void
**/
elRTE.prototype.ui.prototype.buttons.button.prototype.command = function() {
try {
this.rte.doc.execCommand(this.name, false, this.val);
} catch(e) {
this.rte.log('commands failed: '+this.name);
}
this.rte.ui.update(true);
}
/**
* Обновляет состояние кнопки
*
* @return void
**/
elRTE.prototype.ui.prototype.buttons.button.prototype.update = function() {
try {
if (!this.rte.doc.queryCommandEnabled(this.name)) {
return this.domElem.addClass('disabled');
} else {
this.domElem.removeClass('disabled');
}
} catch (e) {
return;
}
try {
if (this.rte.doc.queryCommandState(this.name)) {
this.domElem.addClass('active');
} else {
this.domElem.removeClass('active');
}
} catch (e) { }
}
+114
View File
@@ -0,0 +1,114 @@
/*
* Misc utils for elRTE
*
* @param Object rte - editor
* @todo Подумать, что из этого реально нужно и навести порядок. Возможно часть перенести в ellib
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* Copyright: Studio 42, http://www.std42.ru
*/
elRTE.prototype.utils = function(rte) {
this.rte = rte;
this.url = null;
// domo arigato, Steave, http://blog.stevenlevithan.com/archives/parseuri
this.reg = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;
this.baseURL = '';
this.path = '';
var self = this;
this.rgb2hex = function(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]) : '';
}
this.toPixels = function(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;
}
// TODO: add parse rel path ../../etc
this.absoluteURL = function(url) {
!this.url && this._url();
url = $.trim(url);
if (!url) {
return '';
}
// ссылки на якоря не переводим в абс
if (url[0] == '#') {
return url;
}
var u = this.parseURL(url);
if (!u.host && !u.path && !u.anchor) {
//this.rte.log('Invalid URL: '+url)
return '';
}
if (!this.rte.options.absoluteURLs) {
return url;
}
if (u.protocol) {
//this.rte.log('url already absolute: '+url);
return url;
}
if (u.host && (u.host.indexOf('.')!=-1 || u.host == 'localhost')) {
//this.rte.log('no protocol');
return this.url.protocol+'://'+url;
}
if (url[0] == '/') {
url = this.baseURL+url;
} else {
if (url.indexOf('./') == 0) {
url = url.substring(2);
}
url = this.baseURL+this.path+url;
}
return url;
}
this.parseURL = function(url) {
var u = url.match(this.reg);
var ret = {};
$.each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], function(i) {
ret[this] = u[i];
});
if (!ret.host.match(/[a-z0-9]/i)) {
ret.host = '';
}
return ret;
}
this.trimEventCallback = function(c) {
c = c ? c.toString() : '';
return $.trim(c.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);
}
}
+329
View File
@@ -0,0 +1,329 @@
/**
* @class w3cRange - w3c text range emulation for "strange" browsers
*
* @param elRTE rte объект-редактор
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* Copyright: Studio 42, http://www.std42.ru
**/
elRTE.prototype.w3cRange = function(rte) {
var self = this;
this.rte = rte;
this.r = null;
this.collapsed = true;
this.startContainer = null;
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(e) {
this.r = this.rte.doc.body.createTextRange();
}
return this.r;
}
this.insertNode = function(html) {
this.range();
self.r.collapse(false)
var r = self.r.duplicate();
r.pasteHTML(html);
}
this.getBookmark = function() {
this.range();
if (this.r.item) {
var n = this.r.item(0);
this.r = this.rte.doc.body.createTextRange();
this.r.moveToElementText(n);
}
return this.r.getBookmark();
}
this.moveToBookmark = function(bm) {
this.rte.window.focus();
this.range().moveToBookmark(bm);
this.r.select();
}
/**
* Обновляет данные о выделенных нодах
*
* @return void
**/
this.update = function() {
function _findPos(start) {
var marker = '\uFEFF';
var ndx = offset = 0;
var r = self.r.duplicate();
r.collapse(start);
var p = r.parentElement();
if (!p || p.nodeName == 'HTML') {
return {parent : self.rte.doc.body, ndx : ndx, offset : offset};
}
r.pasteHTML(marker);
childs = p.childNodes;
for (var i=0; i < childs.length; i++) {
var n = childs[i];
if (i>0 && (n.nodeType!==3 || childs[i-1].nodeType !==3)) {
ndx++;
}
if (n.nodeType !== 3) {
offset = 0;
} else {
var pos = n.nodeValue.indexOf(marker);
if (pos !== -1) {
offset += pos;
break;
}
offset += n.nodeValue.length;
}
};
r.moveStart('character', -1);
r.text = '';
return {parent : p, ndx : Math.min(ndx, p.childNodes.length-1), offset : offset};
}
this.range();
this.startContainer = this.endContainer = null;
if (this.r.item) {
this.collapsed = false;
var i = this.r.item(0);
this.setStart(i.parentNode, this.rte.dom.indexOf(i));
this.setEnd(i.parentNode, this.startOffset+1);
} else {
this.collapsed = this.r.boundingWidth == 0;
var start = _findPos(true);
var end = _findPos(false);
start.parent.normalize();
end.parent.normalize();
start.ndx = Math.min(start.ndx, start.parent.childNodes.length-1);
end.ndx = Math.min(end.ndx, end.parent.childNodes.length-1);
if (start.parent.childNodes[start.ndx].nodeType && start.parent.childNodes[start.ndx].nodeType == 1) {
this.setStart(start.parent, start.ndx);
} else {
this.setStart(start.parent.childNodes[start.ndx], start.offset);
}
if (end.parent.childNodes[end.ndx].nodeType && end.parent.childNodes[end.ndx].nodeType == 1) {
this.setEnd(end.parent, end.ndx);
} else {
this.setEnd(end.parent.childNodes[end.ndx], end.offset);
}
// this.dump();
this.select();
}
return this;
}
this.isCollapsed = function() {
this.range();
this.collapsed = this.r.item ? false : this.r.boundingWidth == 0;
return this.collapsed;
}
/**
* "Схлопывает" выделение
*
* @param bool toStart - схлопывать выделение к началу или к концу
* @return void
**/
this.collapse = function(toStart) {
this.range();
if (this.r.item) {
var n = this.r.item(0);
this.r = this.rte.doc.body.createTextRange();
this.r.moveToElementText(n);
}
this.r.collapse(toStart);
this.r.select();
this.collapsed = true;
}
this.getStart = function() {
this.range();
if (this.r.item) {
return this.r.item(0);
}
var r = this.r.duplicate();
r.collapse(true);
var s = r.parentElement();
return s && s.nodeName == 'BODY' ? s.firstChild : s;
}
this.getEnd = function() {
this.range();
if (this.r.item) {
return this.r.item(0);
}
var r = this.r.duplicate();
r.collapse(false);
var e = r.parentElement();
return e && e.nodeName == 'BODY' ? e.lastChild : e;
}
/**
* Устанавливает начaло выделения на указаную ноду
*
* @param Element node нода
* @param Number offset отступ от начала ноды
* @return void
**/
this.setStart = function(node, offset) {
this.startContainer = node;
this.startOffset = offset;
if (this.endContainer) {
this.commonAncestorContainer = this.rte.dom.findCommonAncestor(this.startContainer, this.endContainer);
}
}
/**
* Устанавливает конец выделения на указаную ноду
*
* @param Element node нода
* @param Number offset отступ от конца ноды
* @return void
**/
this.setEnd = function(node, offset) {
this.endContainer = node;
this.endOffset = offset;
if (this.startContainer) {
this.commonAncestorContainer = this.rte.dom.findCommonAncestor(this.startContainer, this.endContainer);
}
}
/**
* Устанавливает начaло выделения перед указаной нодой
*
* @param Element node нода
* @return void
**/
this.setStartBefore = function(n) {
if (n.parentNode) {
this.setStart(n.parentNode, this.rte.dom.indexOf(n));
}
}
/**
* Устанавливает начaло выделения после указаной ноды
*
* @param Element node нода
* @return void
**/
this.setStartAfter = function(n) {
if (n.parentNode) {
this.setStart(n.parentNode, this.rte.dom.indexOf(n)+1);
}
}
/**
* Устанавливает конец выделения перед указаной нодой
*
* @param Element node нода
* @return void
**/
this.setEndBefore = function(n) {
if (n.parentNode) {
this.setEnd(n.parentNode, this.rte.dom.indexOf(n));
}
}
/**
* Устанавливает конец выделения после указаной ноды
*
* @param Element node нода
* @return void
**/
this.setEndAfter = function(n) {
if (n.parentNode) {
this.setEnd(n.parentNode, this.rte.dom.indexOf(n)+1);
}
}
/**
* Устанавливает новое выделение после изменений
*
* @return void
**/
this.select = function() {
// thanks tinymice authors
function getPos(n, o) {
if (n.nodeType != 3) {
return -1;
}
var c ='\uFEFF';
var val = n.nodeValue;
var r = self.rte.doc.body.createTextRange();
n.nodeValue = val.substring(0, o) + c + val.substring(o);
r.moveToElementText(n.parentNode);
r.findText(c);
var p = Math.abs(r.moveStart('character', -0xFFFFF));
n.nodeValue = val;
return p;
};
this.r = this.rte.doc.body.createTextRange();
var so = this.startOffset;
var eo = this.endOffset;
var s = this.startContainer.nodeType == 1
? this.startContainer.childNodes[Math.min(so, this.startContainer.childNodes.length - 1)]
: this.startContainer;
var e = this.endContainer.nodeType == 1
? this.endContainer.childNodes[Math.min(so == eo ? eo : eo - 1, this.endContainer.childNodes.length - 1)]
: this.endContainer;
if (this.collapsed) {
if (s.nodeType == 3) {
var p = getPos(s, so);
this.r.move('character', p);
} else {
this.r.moveToElementText(s);
this.r.collapse(true);
}
} else {
var r = this.rte.doc.body.createTextRange();
var sp = getPos(s, so);
var ep = getPos(e, eo);
if (s.nodeType == 3) {
this.r.move('character', sp);
} else {
this.r.moveToElementText(s);
}
if (e.nodeType == 3) {
r.move('character', ep);
} else {
r.moveToElementText(e);
}
this.r.setEndPoint('EndToEnd', r);
}
try {
this.r.select();
} catch(e) {
}
if (r) {
r = null;
}
}
this.dump = function() {
this.rte.log('collapsed: '+this.collapsed);
//this.rte.log('commonAncestorContainer: '+this.commonAncestorContainer.nodeName||'#text')
this.rte.log('startContainer: '+(this.startContainer ? this.startContainer.nodeName : 'non'));
this.rte.log('startOffset: '+this.startOffset);
this.rte.log('endContainer: '+(this.endContainer ? this.endContainer.nodeName : 'none'));
this.rte.log('endOffset: '+this.endOffset);
}
}
+163
View File
@@ -0,0 +1,163 @@
// German language
elRTE.prototype.i18Messages.de = {
'Editor' : 'Editor',
'Source' : 'Quellcode',
// Panel Name
'Copy/Pase' : 'Kopieren/Einfügen',
'Undo/Redo' : 'Rückgängig/Wiederherstellen',
'Text styles' : 'Textstile',
'Colors' : 'Farbe',
'Alignment' : 'Alignment',
'Indent/Outdent' : 'Einrücken / Ausrücken',
'Text format' : 'Format',
'Lists' : 'Listen',
'Misc elements' : 'Sonstige elemente',
'Links' : 'Link',
'Images' : 'Bild',
'Media' : 'Media datei',
'Tables' : 'Tabelle',
'File manager (elFinder)' : 'Datei-Manager (elFinder)',
// button names
'Save' : 'Speichern',
'Copy' : 'Ausschneiden',
'Cut' : 'Kopieren',
'Paste' : 'Einfügen',
'Paste only text' : 'Fügen sie nur text',
'Paste formatted text' : 'Fügen sie formatierten text',
'Clean format' : 'Formatierungen entfernen',
'Undo last action' : 'Rückgängig',
'Redo previous action' : 'Wiederherstellen',
'Bold' : 'Fett',
'Italic' : 'Kursiv',
'Underline' : 'Unterstrichen',
'Strikethrough' : 'Durchgestrichen',
'Superscript' : 'Hochgestellt',
'Subscript' : 'Tiefgestellt',
'Align left' : 'Linksbündig',
'Ailgn right' : 'Rechtsbündig',
'Align center' : 'Zentriert',
'Align full' : 'Blocksatz',
'Font color' : 'Textfarbe',
'Background color' : 'Hintergrundfarbe',
'Indent' : 'Einzug erhöhen',
'Outdent' : 'Einzug verringern',
'Format' : 'Format',
'Font size' : 'Größe',
'Font' : 'Schriftart',
'Ordered list' : 'Nummerierte Liste',
'Unordered list' : 'Liste',
'Horizontal rule' : 'Horizontale Linie',
'Blockquote' : 'Zitatblock',
'Block element (DIV)' : 'Block-Element (DIV)',
'Link' : 'Link',
'Delete link' : 'Link entfernen',
'Bookmark' : 'Anker einfügen/editieren',
'Image' : 'Bild',
'Table' : 'Tabelle',
'Delete table' : 'Tabelle löschen',
'Insert row before' : 'Zeile oberhalb einfügen',
'Insert row after' : 'Zeile unterhalb einfügen',
'Delete row' : 'Zeile entfernen',
'Insert column before' : 'Spalte links davor einfügen',
'Insert column after' : 'Spalte rechts danach einfügen',
'Delete column' : 'Spalte löschen',
'Merge table cells' : 'Zellen verbinden',
'Split table cell' : 'Zelle teilen',
'Toggle display document structure' : 'Blöcke anzeigen',
'Table cell properties' : 'Zellen-Eigenschaften',
'Table properties' : 'Tabellen-Eigenschaften',
'Toggle full screen mode' : 'Editor maximieren',
'Open file manager' : 'Server',
'Non breakable space' : 'Non-breaking space',
'Stop element floating' : 'Deaktivieren Sie flow-Element Text',
// dialogs
'Warning' : 'ACHTUNG',
'Properies' : 'Properies',
'Popup' : 'Pop-up',
'Advanced' : 'mehr',
'Events' : 'Veranstaltungen',
'Width' : 'Breite',
'Height' : 'Höhe',
'Left' : 'Links',
'Center' : 'Zentrum',
'Right' : 'Rechts',
'Border' : 'Rahmen',
'Background' : 'Hintergrundfarbe',
'Css class' : 'Css class',
'Css style' : 'Css style',
'No' : 'Nein',
'Title' : 'Titel',
'Script direction' : 'Richtung Schreiben',
'Language' : 'Sprache',
'Charset' : 'Charset',
'Not set' : 'nicht',
'Left to right' : 'Links nach Rechts',
'Right to left' : 'Rechts nach Links',
'In this window' : 'Gleiches Fenster (_self)',
'In new window (_blank)' : 'Neues Fenster (_blank)',
'In new parent window (_parent)' : 'Oberes Fenster (_parent)',
'In top frame (_top)' : 'Oberstes Fenster (_top)',
'URL' : '',
'Open in' : '',
// copy
'This operation is disabled in your browser on security reason. Use shortcut instead.' : 'Dieser Vorgang ist in Ihrem Browser aus Sicherheitsgründen deaktiviert. Tastenkombination statt.',
// format
'Heading 1' : 'Überschrift 1',
'Heading 2' : 'Überschrift 2',
'Heading 3' : 'Überschrift 3',
'Heading 4' : 'Überschrift 4',
'Heading 5' : 'Überschrift 5',
'Heading 6' : 'Überschrift 6',
'Paragraph' : 'Formatiert',
'Address' : 'Addresse',
'Preformatted' : '',
// font size
'Small (8pt)' : '',
'Small (10px)' : '',
'Small (12pt)' : '',
'Normal (14pt)' : '',
'Large (18pt)' : '',
'Large (24pt)' : '',
'Large (36pt)' : '',
// bookmark
'Bookmark name' : 'Anker Name',
// link
'Link URL' : '(URL)',
'Target' : 'Zielseite',
'Open link in popup window' : 'Link in einem Popup-Fenster',
'URL' : '',
'Window name' : 'Pop-up Fenster-Name',
'Window size' : 'Größe',
'Window position' : 'Position',
'Location bar' : 'Adress-Leiste',
'Menu bar' : 'Menü-Leiste',
'Toolbar' : 'Werkzeugleiste',
'Scrollbars' : 'Rollbalken',
'Status bar' : 'Statusleiste',
'Resizable' : 'Vergrößerbar',
'Depedent' : 'Abhängig (Netscape)',
'Add return false' : 'add (return false)',
'Target MIME type' : 'MIME type',
'Relationship page to target (rel)' : '',
'Relationship target to page (rev)' : '',
'Tab index' : '',
'Access key' : 'Zugriffstaste',
// image
'Size' : 'Größe',
'Preview' : 'Vorschau',
'Margins' : '',
'Alt text' : 'Alt',
'Image URL' : 'URL',
// table
'Spacing' : 'Abstand (spacing)',
'Padding' : 'Abstand (padding)',
'Rows' : 'Zeile',
'Columns' : 'Spalte',
'Groups' : 'Gruppen',
'Cells' : 'Zellen',
'Caption' : 'Tabellen-Eigenschaften',
'Inner borders' : 'Innere Grenzen'
}
+174
View File
@@ -0,0 +1,174 @@
elRTE.prototype.i18Messages.ru = {
'Editor' : 'Редактор',
'Source' : 'Исходник',
// названия панелей
'Copy/Pase' : 'Копирование/Вставка',
'Undo/Redo' : 'Отмена/Повтор действия',
'Text styles' : 'Стили текста',
'Colors' : 'Цвета',
'Alignment' : 'Выравнивание',
'Indent/Outdent' : 'Отступы',
'Text format' : 'Форматирование',
'Lists' : 'Списки',
'Misc elements' : 'Разные элементы',
'Links' : 'Ссылки',
'Images' : 'Изображения',
'Media' : 'Media файлы',
'Tables' : 'Таблицы',
'File manager (elFinder)' : 'Файловый менеджер (elFinder)',
// названия кнопок
'Save' : 'Сохранить',
'Copy' : 'Копировать',
'Cut' : 'Вырезать',
'Paste' : 'Вставить',
'Paste only text' : 'Вставить только текст',
'Paste formatted text' : 'Вставить форматированый текст',
'Clean format' : 'Удалить форматирование',
'Undo last action' : 'Отменить действие',
'Redo previous action' : 'Повторить действие ',
'Bold' : 'Жирный',
'Italic' : 'Курсив',
'Underline' : 'Подчеркнутый',
'Strikethrough' : 'Перечеркнутый',
'Superscript' : 'Верхний регистр',
'Subscript' : 'Нижний регистр',
'Align left' : 'Выровнять налево',
'Ailgn right' : 'Выровнять направо',
'Align center' : 'Выровнять по центру',
'Align full' : 'Выровнять по краям',
'Font color' : 'Цвет шрифта',
'Background color' : 'Цвет заливки',
'Indent' : 'Увеличить отступ',
'Outdent' : 'Уменьшить отступ',
'Format' : 'Форматирование',
'Font size' : 'Размер шрифта',
'Font' : 'Шрифт',
'Ordered list' : 'Нумерованый список',
'Unordered list' : 'Ненумерованый список',
'Horizontal rule' : 'Горизонтальная линия',
'Blockquote' : 'Цитата',
'Block element (DIV)' : 'Блочный элемент (DIV)',
'Link' : 'Ссылка',
'Delete link' : 'Удалить ссылку',
'Bookmark' : 'Закладка',
'Image' : 'Изображение',
'Table' : 'Таблица',
'Delete table' : 'Удалить таблицу',
'Insert row before' : 'Вставить ряд до',
'Insert row after' : 'Вставить ряд после',
'Delete row' : 'Удалить ряд',
'Insert column before' : 'Вставить колонку до',
'Insert column after' : 'Вставить колонку после',
'Delete column' : 'Удалить колонку',
'Merge table cells' : 'Склеить ячейки',
'Split table cell' : 'Разделить ячейку',
'Toggle display document structure' : 'Показать структуру документа/невидимые элементы',
'Table cell properties' : 'Свойство ячейки',
'Table properties' : 'Свойство таблицы',
'Toggle full screen mode' : 'Во весь экран',
'Open file manager' : 'Открыть файловый менеджер',
'Non breakable space' : 'Неразрывный пробел',
'Stop element floating' : 'Отключить обтекание элементов текстом',
// dialogs
'Warning' : 'Внимание',
'Properies' : 'Свойства',
'Popup' : 'Новое окно',
'Advanced' : 'Дополнительно',
'Events' : 'События',
'Width' : 'Ширина',
'Height' : 'Высота',
'Left' : 'Слева',
'Center' : 'По центру',
'Right' : 'Справа',
'Border' : 'Бордюр',
'Background' : 'Фон',
'Css class' : 'Css класс',
'Css style' : 'Css cтиль',
'No' : 'Нет',
'Title' : 'Заголовок',
'Script direction' : 'Направление письма',
'Language' : 'Язык',
'Charset' : 'Кодировка',
'Not set' : 'Не установлено',
'Left to right' : 'Слево направо',
'Right to left' : 'Справа налево',
'In this window' : 'В этом окне',
'In new window (_blank)' : 'В новом окне (_blank)',
'In new parent window (_parent)' : 'В родительском окне (_parent)',
'In top frame (_top)' : 'В верхнем фрейме (_top)',
'URL' : '',
'Open in' : 'Открыть',
'Open file manger' : 'Открыть файловый менеджер',
// copy
'This operation is disabled in your browser on security reason. Use shortcut instead.' : 'Действие запрещено в вашем браузере по соображениям безопастности. Используйте сочетание клавиш',
// format
'Heading 1' : 'Заголовок 1',
'Heading 2' : 'Заголовок 2',
'Heading 3' : 'Заголовок 3',
'Heading 4' : 'Заголовок 4',
'Heading 5' : 'Заголовок 5',
'Heading 6' : 'Заголовок 6',
'Paragraph' : 'Параграф',
'Address' : 'Адрес',
'Preformatted' : '',
// font size
'Small (8pt)' : 'Мелкий (8pt)',
'Small (10px)' : 'Маленький (10px)',
'Small (12pt)' : 'Небольшой (12pt)',
'Normal (14pt)' : 'Обычный (14pt)',
'Large (18pt)' : 'Большой (18pt)',
'Large (24pt)' : 'Крупный (24pt)',
'Large (36pt)' : 'Огромный (36pt)',
// bookmark
'Bookmark name' : 'Имя закладки',
// link
'Link URL' : 'Адрес ссылки (URL)',
'Target' : 'Цель',
'Select bookmark' : 'Выбрать закладку',
'Open link in popup window' : 'Открыть ссылку во всплывающем окне',
'URL' : '',
'Window name' : 'Название окна',
'Window size' : 'Размер окна',
'Window position' : 'Позиция окна',
'Location bar' : 'Панель локации',
'Menu bar' : 'Панель меню',
'Toolbar' : 'Панель инструментов',
'Scrollbars' : 'Полосы прокрутки',
'Status bar' : 'Строка состояния',
'Resizable' : 'Изменение размера',
'Depedent' : 'Зависимый (Netscape)',
'Add return false' : 'Добавить (return false)',
'Target MIME type' : 'MIME type цели',
'Relationship page to target (rel)' : 'Отношение страницы к цели (rel)',
'Relationship target to page (rev)' : 'Отношение цели к странице (rev)',
'Tab index' : '',
'Access key' : 'Клавиша доступа',
// image
'Size' : 'Размер',
'Preview' : 'Предварительный просмотр',
'Margins' : 'Отступы',
'Alt text' : 'Описание (Alt)',
'Image URL' : 'URL',
// table
'Spacing' : 'Промежуток (spacing)',
'Padding' : 'Отступ (padding)',
'Rows' : 'Строки',
'Columns' : 'Колонки',
'Groups' : 'Группы',
'Cells' : 'Ячейки',
'Caption' : 'Заголовок таблицы',
'Inner borders' : 'Внутренний бордюр',
// table cell
'Table cell type' : 'Тип ячейки',
'Data' : 'Данные',
'Header' : 'Заголовок',
'Justify' : 'По краям',
'Paddings' : 'Отступы',
'Apply to' : 'Применить к',
'Current cell' : 'Выбранная ячейка',
'All cells in row' : 'Все ячейки в ряду',
'All cells in column' : 'Все ячейки в столбце',
'All cells in table' : 'Все ячейки таблицы'
}
+175
View File
@@ -0,0 +1,175 @@
elRTE.prototype.i18Messages.ua = {
'Editor' : 'Редактор',
'Source' : 'Джерело',
// Назви панелей
'Copy / Pase' : 'Копіювання / Вставка',
'Undo / Redo' : 'Скасувати / Повтор дії',
'Text styles' : 'Стилі тексту',
'Colors': 'Кольори',
'Alignment': 'Вирівнювання',
'Indent / Outdent': 'Відступи',
'Text format': 'Форматування',
'Lists': 'Списки',
'Misc elements': 'Різні елементи',
'Links': 'Посилання',
'Images': 'Малюнки',
'Media': 'Media файли',
'Tables': 'Таблиці',
'File manager (elFinder)' : 'Файловый менеджер (elFinder)',
// Назви кнопок
'Save': 'Зберегти',
'Copy': 'Копіювати',
'Cut': 'Вирізати',
'Paste': 'Вставити',
'Paste only text': 'Вставити тільки текст',
'Paste formatted text': 'Вставити форматування тексту',
'Clean format': 'Видалити форматування',
'Undo last action': 'Скасувати дію',
'Redo previous action': 'Повторити дію',
'Bold': 'Товстий',
'Italic': 'Курсив',
'Underline': 'Підкреслений',
'Strikethrough': 'Перекреслений',
'Superscript': 'Верхній регістр',
'Subscript': 'Нижній регістр',
'Align left': 'Вирівняти ліворуч',
'Ailgn right': 'Вирівняти праворуч',
'Align center': 'Вирівняти по центру',
'Align full': 'Вирівняти по краях',
'Font color': 'Колір тексту',
'Background color': 'Колір залікві',
'Indent': 'Збільшити відступ',
'Outdent': 'Зменшити відступ',
'Format': 'Форматування',
'Font size': 'Розмір шрифту',
'Font': 'Шрифт',
'Ordered list': 'Нумерований список',
'Unordered list': 'Ненумерований список',
'Horizontal rule': 'Горизонтальна лінія',
'Blockquote': 'Цитата',
'Block element (DIV)' : 'Блочный элемент (DIV)',
'Link': 'Посилання',
'Delete link': 'Видалити посилання',
'Bookmark': 'Закладка',
'Image': 'Зображення',
'Table': 'Таблиця',
'Delete table': 'Видалити таблицю',
'Insert row before': 'Вставити ряд до',
'Insert row after': 'Вставити ряд після',
'Delete row': 'Видалити ряд',
'Insert column before': 'Вставити колонку до',
'Insert column after': 'Вставити колонку після',
'Delete column': 'Видалити колонку',
'Merge table cells': 'склеїти осередку',
'Split table cell': 'Розділити клітинку',
'Toggle display document structure': 'Показати структуру документа / невидимі елементи',
'Table cell properties': 'Властивість клітинку',
'Table properties': 'Властивість таблиці',
'Toggle full screen mode' : 'Во весь экран',
'Open file manager' : 'Открыть файловый менеджер',
'Non breakable space' : 'Неразрывный пробел',
'Stop element floating' : 'Отключить обтекание элементов текстом',
//Dialogs
'Warning': 'Увага',
'Properies': 'Властивості',
'Popup': 'Нове вікно',
'Advanced': 'Більше',
'Events': 'Події',
'Width': 'Ширина',
'Height': 'Висота',
'Left' : 'Слева',
'Center' : 'По центру',
'Right' : 'Справа',
'Border': 'Бордюр',
'Background': 'Фон',
'Css class': 'Css клас',
'Css style': 'Css style',
'No': 'Ні',
'Title': 'Заголовок',
'Script direction': 'Направлення письма',
'Language': 'Мова',
'Charset': 'Кодування',
'Not set': 'Не встановлено',
'Left to right': 'Зліва направо',
'Right to left': 'Справа наліво',
'In this window': 'У цьому вікні',
'In new window (_blank)': 'У новому вікні (_blank)',
'In new parent window (_parent)': 'У батьківському вікні (_parent)',
'In top frame (_top)': 'У верхньому фреймі (_top)',
'URL':'',
'Open in': 'Відкрити',
// Copy
'This operation is disabled in your browser on security reason. Use shortcut instead. ' : 'Дія заборонено у вашому браузері з міркувань безпеки. Використовуйте клавіші ',
// Format
'Heading 1' : 'Заголовок 1',
'Heading 2' : 'Заголовок 2',
'Heading 3' : 'Заголовок 3',
'Heading 4' : 'Заголовок 4',
'Heading 5' : 'Заголовок 5',
'Heading 6' : 'Заголовок 6',
'Paragraph' : 'Параграф',
'Address' : 'Адрес',
'Preformatted':'',
// Font size
'Small (8pt)': 'Дрібний (8pt)',
'Small (10px)': 'Маленький (10px)',
'Small (12pt)': 'Невеликий (12pt)',
'Normal (14pt)': 'Звичайний (14pt)',
'Large (18pt)': 'Великий (18pt)',
'Large (24pt)': 'Крупний (24pt)',
'Large (36pt)': 'Величезний (36pt)',
// Bookmark
'Bookmark name': 'Ім&rsquo;я закладки',
// Link
'Link URL': 'Адреса ссиклі (URL)',
'Target': 'Мета',
'Select bookmark' : 'Выбрать закладку',
'Open link in popup window': 'Відкрити посилання у спливаючому вікні',
'URL':'',
'Window name': 'Назва вікна',
'Window size': 'Розмір вікна',
'Window position': 'Позиція вікна',
'Open link in popup window': 'Відкрити посилання у спливаючому вікні',
'Window name': 'Назва вікна',
'Window size': 'Розмір вікна',
'Window position': 'Позиція вікна',
'Location bar': 'Панель локації',
'Menu bar': 'Панель меню',
'Toolbar': 'Панель інструментів',
'Scrollbars': 'Смуги прокрутки',
'Status bar': 'Рядок стану',
'Resizable': 'Зміна розміру',
'Depedent': 'Залежний (Netscape)',
'Add return false': 'Додати (return false)',
'Target MIME type': 'MIME type цілі',
'Relationship page to target (rel)': 'Ставлення сторінки до мети (rel) ',
'Relationship target to page (rev)': 'Відношення мети до сторінки (rev)',
'Tab index':'',
'Access key': 'Клавіша доступу',
// Image
'Size': 'Розмір',
'Preview': 'Попередній перегляд',
'Margins': 'Відступи',
'Alt text': 'Опис (Alt)',
'Image URL': 'URL',
// Table
'Spacing' : 'Проміжок (spacing)',
'Padding' : 'Відступ (padding)',
'Rows' : 'Рядок ',
'Columns' : 'Колонки',
'Groups' : 'Группы',
'Cells' : 'Ячейки',
'Caption' : 'Заголовок таблиці',
'Inner borders' : 'Внутрішній бордюр' ,
// table cell
'Table cell type' : 'Тип ячейки',
'Data' : 'Данные',
'Header' : 'Заголовок',
'Justify' : 'По краям',
'Paddings' : 'Отступы',
'Apply to' : 'Применить к',
'Current cell' : 'Выбранная ячейка',
'All cells in row' : 'Все ячейки в ряду',
'All cells in column' : 'Все ячейки в столбце',
'All cells in table' : 'Все ячейки таблицы'
};
+57
View File
@@ -0,0 +1,57 @@
/**
* @class кнопка - Закладка (открывает диалоговое окно)
*
* @param elRTE rte объект-редактор
* @param String name название кнопки
*
* @author: Dmitry Levashov (dio) dio@std42.ru
**/
elRTE.prototype.ui.prototype.buttons.anchor = function(rte, name) {
this.constructor.prototype.constructor.call(this, rte, name);
this.input = $('<input type="text" />').attr('name', 'anchor').attr('size', '16')
var self = this;
this.command = function() {
var opts = {
submit : function(e, d) { e.stopPropagation(); e.preventDefault(); d.close(); self.set(); },
dialog : {
title : this.rte.i18n('Bookmark')
}
}
this.anchor = this.rte.dom.selfOrParentAnchor(this.rte.selection.getEnd()) || rte.dom.create('a');
!this.rte.selection.collapsed() && this.rte.selection.collapse(false);
this.input.val($(this.anchor).addClass('el-rte-anchor').attr('name'));
this.rte.selection.saveIERange();
var d = new elDialogForm(opts);
d.append([this.rte.i18n('Bookmark name'), this.input], null, true).open();
}
this.update = function() {
var n = this.rte.selection.getNode();
if (this.rte.dom.selfOrParentLink(n)) {
this.domElem.addClass('disabled');
} else if (this.rte.dom.selfOrParentAnchor(n)) {
this.domElem.removeClass('disabled').addClass('active');
} else {
this.domElem.removeClass('disabled').removeClass('active');
}
}
this.set = function() {
var n = $.trim(this.input.val());
this.rte.selection.restoreIERange();
this.rte.log(this.anchor.parentNode)
if (n) {
if (!this.anchor.parentNode) {
this.rte.selection.insertHtml('<a name="'+n+'" title="'+this.rte.i18n('Bookmark')+': '+n+'" class="el-rte-anchor"></a>');
} else {
this.anchor.name = n;
this.anchor.title = this.rte.i18n('Bookmark')+': '+n;
}
} else if (this.anchor.parentNode) {
this.anchor.parentNode.removeChild(this.anchor);
}
}
}
+37
View File
@@ -0,0 +1,37 @@
/**
* @class кнопка - Цитата
* Если выделение схлопнуто и находится внутри цитаты - она удаляется
* Новые цитаты создаются только из несхлопнутого выделения
*
* @param elRTE rte объект-редактор
* @param String name название кнопки
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* @copyright: Studio 42, http://www.std42.ru
**/
elRTE.prototype.ui.prototype.buttons.blockquote = function(rte, name) {
this.constructor.prototype.constructor.call(this, rte, name);
this.command = function() {
var n, nodes;
if (this.rte.selection.collapsed() && (n = this.rte.dom.selfOrParent(this.rte.selection.getNode(), /^BLOCKQUOTE$/))) {
$(n).replaceWith($(n).html());
} else {
nodes = this.rte.selection.selected({wrap : 'all', tag : 'blockquote'});
nodes.length && this.rte.selection.select(nodes[0], nodes[nodes.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');
} else {
this.domElem.addClass('disabled').removeClass('active');
}
} else {
this.domElem.removeClass('disabled').removeClass('active');
}
}
}
+43
View File
@@ -0,0 +1,43 @@
/**
* @class кнопки "копировать/вырезать/вставить"
* в firefox показывает предложение нажать Ctl+c, в остальных - копирует
*
* @param elRTE rte объект-редактор
* @param String name название кнопки
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* @copyright: Studio 42, http://www.std42.ru
**/
elRTE.prototype.ui.prototype.buttons.copy = function(rte, name) {
this.constructor.prototype.constructor.call(this, rte, name);
this.command = function() {
if (this.rte.browser.mozilla) {
try {
this.rte.doc.execCommand(this.name, false, null);
} catch (e) {
var s = ' Ctl + C';
if (this.name == 'cut') {
s = ' Ctl + X';
} else if (this.name == 'paste') {
s = ' Ctl + V';
}
var opts = {
dialog : {
title : this.rte.i18n('Warning'),
buttons : { Ok : function() { $(this).dialog('close'); } }
}
}
var d = new elDialogForm(opts);
d.append(this.rte.i18n('This operation is disabled in your browser on security reason. Use shortcut instead.')+': '+s).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;
+38
View File
@@ -0,0 +1,38 @@
/**
* @class кнопка - DIV
* Если выделение схлопнуто и находится внутри div'a - он удаляется
* Новые div'ы создаются только из несхлопнутого выделения
*
* @param elRTE rte объект-редактор
* @param String name название кнопки
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* @copyright: Studio 42, http://www.std42.ru
**/
elRTE.prototype.ui.prototype.buttons.div = function(rte, name) {
this.constructor.prototype.constructor.call(this, rte, name);
this.command = function() {
var n, nodes;
if (this.rte.selection.collapsed() && (n = this.rte.dom.selfOrParent(this.rte.selection.getNode(), /^DIV$/))) {
$(n).replaceWith($(n).html());
} else {
nodes = this.rte.selection.selected({wrap : 'all', tag : 'div'});
nodes.length && this.rte.selection.select(nodes[0], nodes[nodes.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');
} else {
this.domElem.addClass('disabled').removeClass('active');
}
} else {
this.domElem.removeClass('disabled').removeClass('active');
}
}
}
+23
View File
@@ -0,0 +1,23 @@
/**
* @class кнопка - Включение/выключение показа структуры документа
*
* @param elRTE rte объект-редактор
* @param String name название кнопки
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* @copyright: Studio 42, http://www.std42.ru
**/
elRTE.prototype.ui.prototype.buttons.docstructure = function(rte, name) {
this.constructor.prototype.constructor.call(this, rte, name);
this.command = function() {
this.domElem.toggleClass('active');
$(this.rte.doc.body).toggleClass('el-rte-structure');
}
this.command();
this.update = function() {
this.domElem.removeClass('disabled');
}
}
+27
View File
@@ -0,0 +1,27 @@
/**
* @class button - open elfinder window (not needed for image or link buttons).Used in ELDORADO.CMS for easy file manipulations.
*
* @param elRTE rte объект-редактор
* @param String name название кнопки
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* @copyright: Studio 42, http://www.std42.ru
**/
elRTE.prototype.ui.prototype.buttons.elfinder = function(rte, name) {
this.constructor.prototype.constructor.call(this, rte, name);
var self = this;
this.command = function() {
if (self.rte.options.fmAllow && typeof(self.rte.options.fmOpen) == 'function') {
self.rte.options.fmOpen( function(url) { self.rte.log(url) } );
}
}
this.update = function() {
if (self.rte.options.fmAllow && typeof(self.rte.options.fmOpen) == 'function') {
this.domElem.removeClass('disabled');
} else {
this.domElem.addClass('disabled');
}
}
}
+61
View File
@@ -0,0 +1,61 @@
/**
* @class drop-down menu - font-family for selected text
*
* @param elRTE rte объект-редактор
* @param String name название кнопки
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* @copyright: Studio 42, http://www.std42.ru
**/
elRTE.prototype.ui.prototype.buttons.fontname = function(rte, name) {
this.constructor.prototype.constructor.call(this, rte, name);
var self = this;
var opts = {
tpl : '<span style="font-family:%val">%label</span>',
select : function(v) { self.set(v); },
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'
}
}
this.select = this.domElem.elSelect(opts);
this.command = function() {
}
this.set = function(size) {
var nodes = this.rte.selection.selected({filter : 'textContainsNodes'});
$.each(nodes, function() {
$this = /^(THEAD|TFOOT|TBODY|COL|COLGROUP|TR)$/.test(this.nodeName) ? $(this).find('td,th') : $(this);
$(this).css('font-family', size).find('[style]').css('font-family', '');
});
this.rte.ui.update();
}
this.update = function() {
this.domElem.removeClass('disabled');
var n = this.rte.selection.getNode();
if (n.nodeType != 1) {
n = n.parentNode;
}
var v = $(n).css('font-family');
v = v ? v.toString().toLowerCase().replace(/,\s+/g, ',').replace(/'|"/g, '') : '';
this.select.val(opts.src[v] ? v : '');
}
}
+49
View File
@@ -0,0 +1,49 @@
/**
* @class drop-down menu - font size for selected text
*
* @param elRTE rte объект-редактор
* @param String name название кнопки
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* @copyright: Studio 42, http://www.std42.ru
**/
elRTE.prototype.ui.prototype.buttons.fontsize = function(rte, name) {
this.constructor.prototype.constructor.call(this, rte, name);
var self = this;
var opts = {
labelTpl : '%label',
tpl : '<span style="font-size:%val;line-height:1.2em">%label</span>',
select : function(v) { self.set(v); },
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)')
}
}
this.select = this.domElem.elSelect(opts);
this.command = function() {
}
this.set = function(size) {
var nodes = this.rte.selection.selected({filter : 'textContainsNodes'});
$.each(nodes, function() {
$this = /^(THEAD|TFOOT|TBODY|COL|COLGROUP|TR)$/.test(this.nodeName) ? $(this).find('td,th') : $(this);
$this.css('font-size', size).find("[style]").css('font-size', '');
});
this.rte.ui.update();
}
this.update = function() {
this.domElem.removeClass('disabled');
var n = this.rte.selection.getNode();
this.select.val((m = this.rte.dom.attr(n, 'style').match(/font-size:\s*([^;]+)/i)) ? m[1] : '');
}
}
+56
View File
@@ -0,0 +1,56 @@
/**
* @class color pallete for text color and background
*
* @param elRTE rte объект-редактор
* @param String name название кнопки
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* @copyright: Studio 42, http://www.std42.ru
**/
elRTE.prototype.ui.prototype.buttons.forecolor = function(rte, name) {
var self = this;
this.constructor.prototype.constructor.call(this, rte, name);
var opts = {
'class' : '',
color : this.defaultColor,
update : function(c) { self.indicator.css('background-color', c); },
change : function(c) { self.set(c) }
}
this.defaultColor = this.rte.utils.rgb2hex( $(this.rte.doc.body).css(this.name=='forecolor' ? 'color' : 'background-color') );
this.picker = this.domElem.elColorPicker(opts);
this.indicator = $('<div />').addClass('color-indicator').prependTo(this.domElem);
this.command = function() {
}
this.set = function(c) {
if (!this.rte.selection.collapsed()) {
var nodes = this.rte.selection.selected({collapse : false, wrap : 'text'});
var css = this.name == 'forecolor' ? 'color' : 'background-color';
$.each(nodes, function() {
if (/^(THEAD|TBODY|TFOOT|TR)$/.test(this.nodeName)) {
$(this).find('td,th').each(function() {
$(this).css(css, c).find('*').css(css, '');
})
} else {
$(this).css(css, c).find('*').css(css, '');
}
});
this.rte.ui.update(true);
}
}
this.update = function() {
this.domElem.removeClass('disabled');
var n = this.rte.selection.getNode();
if (n.nodeType != 1) {
n = n.parentNode;
}
var v = $(n).css(this.name == 'forecolor' ? 'color' : 'background-color');
this.picker.val(v && v!='transparent' ? this.rte.utils.rgb2hex(v): this.defaultColor);
}
}
elRTE.prototype.ui.prototype.buttons.hilitecolor = elRTE.prototype.ui.prototype.buttons.forecolor;
+99
View File
@@ -0,0 +1,99 @@
/**
* @class drop-down menu - formatting text block
*
* @param elRTE rte объект-редактор
* @param String name название кнопки
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* @copyright: Studio 42, http://www.std42.ru
**/
elRTE.prototype.ui.prototype.buttons.formatblock = function(rte, name) {
this.constructor.prototype.constructor.call(this, rte, name);
var cmd = this.rte.browser.msie
? function(v) { self.val = v; self.constructor.prototype.command.call(self); }
: function(v) { self.ieCommand(v); }
var self = this;
var opts = {
labelTpl : '%label',
tpls : {'' : '%label'},
select : function(v) { self.formatBlock(v); },
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')
}
}
this.select = this.domElem.elSelect(opts);
this.command = function() {
}
this.formatBlock = function(v) {
function format(n, tag) {
function replaceChilds(p) {
$(p).find('h1,h2,h3,h4,h5,h6,p,address,pre').each(function() {
$(this).replaceWith($(this).html());
});
}
if (/^(LI|DT|DD)$/.test(n.nodeName)) {
replaceChilds(n);
self.rte.dom.wrapContents(n, tag);
} else if (/^(UL|OL|DL)$/.test(n.nodeName)) {
var html = '';
$(n).children().each(function() {
replaceChilds(this);
html += $(this).html();
});
$(n).replaceWith($(self.rte.dom.create(tag)).html(html||''));
} else {
replaceChilds(n);
$(n).replaceWith( $(self.rte.dom.create(tag)).html($(n).html()));
}
}
tag = v == 'span' ? '' : v.toUpperCase();
var nodes = this.rte.selection.selected({
collapsed : true,
blocks : true,
wrap : 'inline',
tag : 'span'
});
for (var i=0; i<nodes.length; i++) {
var n = nodes[i];
if (tag) {
if (/^(TABLE|THEAD|TBODY|TFOOT|TR)$/.test(n.nodeName)) {
$(n).find('td,th').each(function() { format(this, tag); });
} else {
format(n, tag);
}
} else {
if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(n.nodeName)) {
$(n).replaceWith($(this.rte.dom.create('div')).html($(n).html()||''));
}
}
};
this.rte.ui.update();
}
this.update = function() {
this.domElem.removeClass('disabled');
var n = this.rte.dom.selfOrParent(this.rte.selection.getNode(), /^(H[1-6]|P|ADDRESS|PRE)$/);
this.select.val(n ? n.nodeName.toLowerCase() : 'span');
}
}
+48
View File
@@ -0,0 +1,48 @@
/**
* @class button - switch to fullscreen mode and back
*
* @param elRTE rte объект-редактор
* @param String name название кнопки
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* @copyright: Studio 42, http://www.std42.ru
**/
elRTE.prototype.ui.prototype.buttons.fullscreen = function(rte, name) {
this.constructor.prototype.constructor.call(this, rte, name);
this.active = true;
this.parents = [];
this.height = 0;
var self = this;
this.command = function() {
if (this.rte.editor.hasClass('el-fullscreen')) {
for (var i=0; i < this.parents.length; i++) {
$(this.parents[i]).css('position', 'relative');
};
this.parents = [];
this.rte.editor.removeClass('el-fullscreen');
this.rte.workzone.height(this.height);
this.domElem.removeClass('active');
} else {
this.parents = [];
var p = this.rte.editor.parents().each(function() {
if (this.nodeName != 'BODY' && this.name != 'HTML' && $(this).css('position') == 'relative') {
self.parents.push(this);
$(this).css('position', 'static');
}
});
this.height = this.rte.workzone.height();
this.rte.editor.addClass('el-fullscreen');
var h = parseInt(this.rte.editor.height() - this.rte.toolbar.height() - this.rte.statusbar.height() - this.rte.tabsbar.height() - 17);
h>0 && this.rte.workzone.height(h);
this.domElem.addClass('active');
}
}
this.update = function() {
this.domElem.removeClass('disabled');
}
}
+96
View File
@@ -0,0 +1,96 @@
/**
* @class button - horizontal rule (open dialog window)
*
* @param elRTE rte объект-редактор
* @param String name название кнопки
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* @copyright: Studio 42, http://www.std42.ru
**/
elRTE.prototype.ui.prototype.buttons.horizontalrule = function(rte, name) {
this.constructor.prototype.constructor.call(this, rte, name);
var self = this;
this.src = {
width : $('<input type="text" />').attr({'name' : 'width', 'size' : 4}).css('text-align', 'right'),
wunit : $('<select />').attr('name', 'wunit')
.append($('<option />').val('%').text('%'))
.append($('<option />').val('px').text('px'))
.val('%'),
height : $('<input type="text" />').attr({'name' : 'height', 'size' : 4}).css('text-align', 'right'),
bg : $('<div />'),
border : $('<div />'),
'class' : $('<input type="text" />').css('width', '100%'),
style : $('<input type="text" />').css('width', '100%')
}
this.command = function() {
this.src.bg.elColorPicker({palettePosition : 'outer', 'class' : 'el-colorpicker ui-icon ui-icon-pencil'});
var n = this.rte.selection.getEnd();
this.hr = n.nodeName == 'HR' ? $(n) : $(rte.doc.createElement('hr')).css({width : '100%', height : '1px'});
this.src.border.elBorderSelect({styleHeight : 73, value : this.hr});
var _w = this.hr.css('width') || this.hr.attr('width');
this.src.width.val(parseInt(_w) || 100);
this.src.wunit.val(_w.indexOf('px') != -1 ? 'px' : '%');
this.src.height.val( this.rte.utils.toPixels(this.hr.css('height') || this.hr.attr('height')) || 1) ;
this.src.bg.val(this.rte.utils.rgb2hex(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 opts = {
submit : function(e, d) { e.stopPropagation(); e.preventDefault(); self.set(); d.close(); },
dialog : {
title : this.rte.i18n('Horizontal rule')
}
}
var d = new elDialogForm(opts);
d.append([this.rte.i18n('Width'), $('<span />').append(this.src.width).append(this.src.wunit) ], null, true)
.append([this.rte.i18n('Height'), $('<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();
}
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.hr.parentNode && this.rte.selection.insertNode(this.hr.get(0));
var attr = {
noshade : true,
style : this.src.style.val()
}
var b = this.src.border.val();
var css = {
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 : b.width && b.style ? b.width+' '+b.style+' '+b.color : ''
}
this.hr.removeAttr('class')
.removeAttr('style')
.removeAttr('width')
.removeAttr('height')
.removeAttr('align')
.attr(attr)
.css(css);
if (this.src['class'].val()) {
this.hr.attr('class', this.src['class'].val());
}
}
}
+422
View File
@@ -0,0 +1,422 @@
/**
* @class button - insert/edit image (open dialog window)
*
* @param elRTE rte объект-редактор
* @param String name название кнопки
*
* @author: Dmitry Levashov (dio) dio@std42.ru
* Copyright: Studio 42, http://www.std42.ru
**/
elRTE.prototype.ui.prototype.buttons.image = function(rte, name) {
this.constructor.prototype.constructor.call(this, rte, name);
var self = this;
this.img = null
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 : $('<input type="text" />').css('width', '100%'),
title : $('<input type="text" />').css('width', '100%'),
alt : $('<input type="text" />').css('width', '100%'),
width : $('<input type="text" />').attr('size', 5).css('text-align', 'right'),
height : $('<input type="text" />').attr('size', 5).css('text-align', 'right'),
margin : $('<div />'),
align : $('<select />').css('width', '100%')
.append($('<option />').val('').text(this.rte.i18n('Not set', 'dialogs')))
.append($('<option />').val('left' ).text(this.rte.i18n('Left')))
.append($('<option />').val('right' ).text(this.rte.i18n('Right')))
.append($('<option />').val('top' ).text(this.rte.i18n('Top')))
.append($('<option />').val('text-top' ).text(this.rte.i18n('Text top')))
.append($('<option />').val('middle' ).text(this.rte.i18n('middle')))
.append($('<option />').val('baseline' ).text(this.rte.i18n('Baseline')))
.append($('<option />').val('bottom' ).text(this.rte.i18n('Bottom')))
.append($('<option />').val('text-bottom').text(this.rte.i18n('Text bottom'))),
border : $('<div />')
},
adv : {
id : $('<input type="text" />').css('width', '100%'),
'class' : $('<input type="text" />').css('width', '100%'),
style : $('<input type="text" />').css('width', '100%'),
longdesc : $('<input type="text" />').css('width', '100%')
},
// link : {
// href : $('<input type="text" />').css('width', '100%'),
// title : $('<input type="text" />').css('width', '100%')
// },
events : {}
}
$.each(
['onblur', 'onfocus', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmouseout', 'onmouseleave', 'onkeydown', 'onkeypress', 'onkeyup'],
function() {
self.src.events[this] = $('<input type="text" />').css('width', '100%');
});
$.each(self.src, function() {
for (var n in this) {
this[n].attr('name', n);
}
});
}
this.command = function() {
!this.src && this.init();
this.rte.browser.msie && this.rte.selection.saveIERange();
this.src.main.border.elBorderSelect({ change : function() { self.updateImg(); }, name : 'border' });
this.src.main.margin.elPaddingInput({ type : 'margin' });
this.cleanValues();
this.src.main.src.val('');
var n = this.rte.selection.getEnd();
this.preview = null;
this.prevImg = null;
this.link = null;
if (n.nodeName == 'IMG') {
this.img = $(n);
} else {
this.img = $(this.rte.doc.createElement('img'));
}
var opts = {
submit : function(e, d) { e.stopPropagation(); e.preventDefault(); self.set(); d.close(); },
dialog : {
width : 520,
position : 'top',
title : this.rte.i18n('Image')
}
}
var d = new elDialogForm(opts);
if (this.rte.options.fmAllow && this.rte.options.fmOpen) {
var src = $('<span />').append(this.src.main.src.css('width', '88%'))
.append(
$('<span />').addClass('ui-state-default ui-corner-all')
.css({'float' : 'right', 'margin-right' : '3px'})
.attr('title', self.rte.i18n('Open file manger'))
.append($('<span />').addClass('ui-icon ui-icon-folder-open'))
.click( function() {
self.rte.options.fmOpen( function(url) { self.src.main.src.val(url).change() } );
})
.hover(function() {$(this).addClass('ui-state-hover')}, function() { $(this).removeClass('ui-state-hover')})
);
} else {
var src = this.src.main.src;
}
d.tab('main', this.rte.i18n('Properies'))
.append([this.rte.i18n('Image URL'), src], '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'), $('<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)
for (var tab in this.src) {
if (tab != 'main') {
d.tab(tab, this.rte.i18n(this.labels[tab]));
for (var name in this.src[tab]) {
var l = this.rte.i18n(this.labels[name] ? this.labels[name] : name);
if (tab == 'events') {
this.src[tab][name].val(this.rte.utils.trimEventCallback(this.img.attr(name)));
} else if (tab == 'link') {
if (this.link) {
this.src[tab][name].val(name == 'href' ? this.rte.utils.absoluteURL(this.link.attr(name)) : this.link.attr(name));
}
} else {
this.src[tab][name].val(this.img.attr(name)||'');
}
d.append([l, this.src[tab][name]], tab, true);
}
}
};
d.open();
var fs = $('<fieldset />').append($('<legend />').text(this.rte.i18n('Preview')))
d.append(fs, 'main');
var frame = document.createElement('iframe');
$(frame).attr('src', '#').addClass('el-rte-preview').appendTo(fs);
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"> </body></html>';
frame.contentWindow.document.open();
frame.contentWindow.document.write(html);
frame.contentWindow.document.close();
this.frame = frame.contentWindow.document
this.preview = $(frame.contentWindow.document.body)
.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');
if (this.img.attr('src')) {
this.prevImg = $(this.frame.createElement('img'))
.attr('src', this.rte.utils.absoluteURL(this.img.attr('src')))
this.prevImg.attr('width', this.img.attr('width'))
.attr('height', this.img.attr('height'))
.attr('title', this.img.attr('title')||'')
.attr('alt', this.img.attr('alt')||'')
.attr('style', this.img.attr('style')||'')
for (var n in this.src.adv) {
var a = this.img.attr(n);
if (a) {
this.prevImg.attr(n, a)
}
}
this.preview.prepend(this.prevImg);
this.updateValues();
}
$.each(this.src, function() {
$.each(this, function() {
if (this === self.src.main.src) {
this.bind('change', function() { self.updatePreview(); });
} else if (this == self.src.main.width || this == self.src.main.height) {
this.bind('change', function(e) {self.updateDimesions(e);});
} else {
this.bind('change', function() { self.updateImg(); });
}
});
});
// this.src.link.href.change(function() {
// var $this = $(this);
// $this.val(self.rte.utils.absoluteURL($this.val()));
// });
}
/**
* Устанавливает значения полей формы из аттрибутов prevImg
* Вызывается после загрузки prevImg
*
**/
this.updateValues = function() {
var i = this.prevImg.get(0);
this.origW = this.prevImg.attr('width');
this.origH = this.prevImg.attr('height');
this.src.main.src.val(this.rte.dom.attr(i, 'src'));
this.src.main.title.val(this.rte.dom.attr(i, 'title'));
this.src.main.alt.val(this.rte.dom.attr(i, 'alt'));
this.src.main.width.val(this.origW);
this.src.main.height.val(this.origH);
this.src.adv['class'].val(this.rte.dom.attr(i, 'class'));
this.src.main.margin.val(this.prevImg)
var f = this.prevImg.css('float');
this.src.main.align.val(f == 'left' || f == 'right' ? f : (this.prevImg.css('vertical-align')||''));
this.src.main.border.val(this.prevImg)
this.src.adv.style.val(this.rte.dom.attr(i, 'style'));
}
/**
* Очищает поля формы
*
**/
this.cleanValues = function() {
$.each(this.src, function() {
$.each(this, function() {
var $this = $(this);
if ($this.attr('name') != 'src') {
$this.val('');
}
});
});
}
/**
* Устанавливает аттрибуты prevImg из полей формы
*
**/
this.updateImg = function() {
this.prevImg.attr({
style : $.trim(this.src.adv.style.val()),
title : $.trim(this.src.main.title.val()),
alt : $.trim(this.src.main.alt.val()),
width : parseInt(this.src.main.width.val()),
height : parseInt(this.src.main.height.val())
});
var a = this.src.main.align.val();
var f = a == 'left' || a == 'right' ? a : '';
var b = this.src.main.border.val();
var m = this.src.main.margin.val();
this.prevImg.css('float', f);
this.prevImg.css('vertical-align', f ? '' : a);
this.prevImg.css('border', $.trim(b.width+' '+b.style+' '+b.color));
if (m.css) {
this.prevImg.css('margin', m.css);
} else {
this.prevImg.css('margin-top', m.top);
this.prevImg.css('margin-right', m.right);
this.prevImg.css('margin-bottom', m.bottom);
this.prevImg.css('margin-left', m.left);
}
$.each([this.src.events, this.src.adv], function() {
$.each(this, function() {
var $this = $(this);
var n = $this.attr('name');
if (n != 'style') {
var v = $.trim($this.val());
if (v) {
self.prevImg.attr(n, v);
} else {
self.prevImg.removeAttr(n);
}
}
});
});
}
/**
* Обновляет форму выбора изображения
*
**/
this.updatePreview = function() {
var imgsrc = this.prevImg ? this.prevImg.attr('src') : '';
var src = $.trim(this.src.main.src.val());
if (!src || src !=imgsrc) { // new image or empty src
if (this.prevImg) {
this.prevImg.remove();
this.prevImg = null;
}
this.cleanValues();
if (src) { // new image
this.prevImg = $(this.frame.createElement('img'))
.attr('src', this.rte.utils.absoluteURL(src))
.bind('load', function() {
self.updateValues();
})
this.preview.prepend(this.prevImg);
self.updateValues();
}
} else { // update existsed image
this.updateImg();
}
}
this.updateDimesions = function(e) {
var w = parseInt(this.src.main.width.val()) || 0;
var h = parseInt(this.src.main.height.val()) || 0;
if (w > 0 && h > 0) {
if (e.currentTarget == this.src.main.width.get(0)) {
this.src.main.height.val(parseInt(w*this.origH/this.origW));
} else {
this.src.main.width.val(parseInt(h*this.origW/this.origH));
}
} else {
this.src.main.width.val(this.origW);
this.src.main.height.val(this.origH);
}
this.updateImg();
}
this.set = function() {
if (!this.prevImg || !this.prevImg.attr('width')) {
this.img && this.img.remove();
this.link && this.rte.doc.execCommand('unlink', false, null);
} else {
if (!this.img.parents().length) {
this.rte.browser.msie && this.rte.selection.restoreIERange();
this.img = $(this.rte.doc.createElement('img'));
}
this.img.attr({
src : this.rte.utils.absoluteURL($.trim(this.src.main.src.val())),
style : $.trim(this.rte.dom.attr(this.prevImg.get(0), 'style')),
title : $.trim(this.src.main.title.val()),
alt : $.trim(this.src.main.alt.val()),
width : parseInt(this.src.main.width.val()),
height : parseInt(this.src.main.height.val())
});
for (var _n in this.src.adv) {
if (_n != 'style') {
var val = this.src.adv[_n].val();
if (val) {
this.img.attr(_n, val);
} else {
this.img.removeAttr(_n)
}
}
}
for (var _n in this.src.events) {
var val = this.src.events[_n].val();
if (val) {
this.img.attr(_n, val);
} else {
this.img.removeAttr(_n)
}
}
if (!this.img.parents().length) {
this.rte.selection.insertNode(this.img.get(0))
}
// Link
// var href = this.rte.utils.absoluteURL(this.src.link.href.val());
// var title = $.trim(this.src.link.title.val());
// if (!href) {
// if (this.link) {
// this.link.replaceWith(this.prevImg);
// }
// } else {
// if (this.link) {
// this.link.attr('href', href).removeAttr('target').removeAttr('title');
// title && this.alink.attr('title', title);
// } else {
// this.link = $(this.rte.doc.createElement('a')).attr('href', href);
// title && this.link.attr('title', title);
// this.prevImg.wrap(this.link);
// }
// }
}
this.rte.ui.update();
}
this.update = function() {
this.domElem.removeClass('disabled');
var n = this.rte.selection.getEnd();
if (n.nodeName == 'IMG') {
this.domElem.addClass('active');
} else {
this.domElem.removeClass('active');
}
}
}

Some files were not shown because too many files have changed in this diff Show More