Merge branch 'release-1.4.5'
5
.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
node_modules
|
||||
dist
|
||||
test/instrumented/
|
||||
node_modules
|
||||
test/instrumented/
|
||||
*.nupkg
|
@ -1,6 +1,26 @@
|
||||
X-editable changelog
|
||||
=============================
|
||||
|
||||
Version 1.4.5 Jun 23, 2013
|
||||
----------------------------
|
||||
[enh #245] highlight element after update (vitalets)
|
||||
[enh] select2 now works with ajax source (vitalets)
|
||||
[bug] fix datefield (datetimefield) to return null for incorrect dates (vitalets)
|
||||
[bug #224] do not close popup when it is saving value (vitalets)
|
||||
[enh] added `submitValue` to `save` event params (vitalets)
|
||||
[enh #259] allow `getValue` method to return value itself, not object (vitalets)
|
||||
[enh] add `destroy` method to inputs (vitalets)
|
||||
[enh #164] allow emptytext to be html (vitalets)
|
||||
[enh #78] allow html in editable content (vitalets)
|
||||
[enh] update container position when datetimepicker viewMode changes (vitalets)
|
||||
[enh #255] remove xxxView options from first level config of datetimepicker (vitalets)
|
||||
[enh] if `display` defined as function call it on init (vitalets)
|
||||
[enh #218] sourceCache now disables cache totally (vitalets)
|
||||
[bug #156] solve conflict of bootstrap datepicker and jQuery UI datepicker (vitalets)
|
||||
[enh] update bootstrap-datepicker to 1.1.2 (vitalets)
|
||||
[enh] allow follow links in disabled state (vitalets)
|
||||
[enh] update combodate to 1.0.4, fix #222 (vitalets)
|
||||
|
||||
|
||||
Version 1.4.4 May 4, 2013
|
||||
----------------------------
|
||||
|
@ -2,14 +2,14 @@
|
||||
<package >
|
||||
<metadata>
|
||||
<id>x-editable</id>
|
||||
<version>1.4.4</version>
|
||||
<version>1.4.5</version>
|
||||
<authors>Vitaliy Potapov</authors>
|
||||
<owners>Vitaliy Potapov</owners>
|
||||
<licenseUrl>https://github.com/vitalets/x-editable/blob/master/LICENSE-MIT</licenseUrl>
|
||||
<projectUrl>http://vitalets.github.com/x-editable</projectUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery</description>
|
||||
<releaseNotes>Bootstrap datetimepicker and more</releaseNotes>
|
||||
<releaseNotes>Select2 with ajax source and more</releaseNotes>
|
||||
<copyright>Copyright 2012-2013</copyright>
|
||||
<tags>edit-in-place editable bootstrap jquery</tags>
|
||||
<dependencies>
|
||||
|
35
README.md
@ -1,16 +1,35 @@
|
||||
# X-editable
|
||||
|
||||
In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery.
|
||||
It is a new life of [bootstrap-editable plugin](http://github.com/vitalets/bootstrap-editable) that was strongly refactored and improved.
|
||||
|
||||
## Demo + Docs + Download
|
||||
See **http://vitalets.github.com/x-editable**
|
||||
## Live demo
|
||||
**http://vitalets.github.io/x-editable/demo.html**
|
||||
|
||||
## Installation
|
||||
|
||||
### Manual download
|
||||
Use **http://vitalets.github.io/x-editable**
|
||||
|
||||
### Bower
|
||||
````
|
||||
bower install x-editable
|
||||
````
|
||||
|
||||
### CDN
|
||||
````js
|
||||
<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.4.5/bootstrap-editable/css/bootstrap-editable.css" rel="stylesheet"/>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.4.5/bootstrap-editable/js/bootstrap-editable.min.js"></script>
|
||||
````
|
||||
|
||||
## Documentation
|
||||
**http://vitalets.github.io/x-editable**
|
||||
|
||||
|
||||
## Reporting issues
|
||||
When creating issues please provide [jsFiddle](http://jsfiddle.net) example. You can easily fork one of **jsFiddle templates**:
|
||||
1. [bootstrap](http://jsfiddle.net/xBB5x/195)
|
||||
2. [jqueryui](http://jsfiddle.net/xBB5x/196)
|
||||
3. [plain](http://jsfiddle.net/xBB5x/197)
|
||||
When creating issues please provide [jsFiddle](http://jsfiddle.net) example. You can easily fork one of following:
|
||||
1. [jsFiddle bootstrap template](http://jsfiddle.net/xBB5x/195)
|
||||
2. [jsFiddle jqueryui template](http://jsfiddle.net/xBB5x/196)
|
||||
3. [jsFiddle jquery template](http://jsfiddle.net/xBB5x/197)
|
||||
Your feedback is very appreciated!
|
||||
|
||||
## Contribution
|
||||
@ -68,4 +87,4 @@ Thanks for your support!
|
||||
|
||||
## License
|
||||
Copyright (c) 2012 Vitaliy Potapov
|
||||
Licensed under the MIT licenses.
|
||||
Licensed under the MIT license.
|
16
bower.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "x-editable",
|
||||
"version": "1.4.5",
|
||||
"main": "dist/README.md",
|
||||
"ignore": [
|
||||
"*.*",
|
||||
"LICENSE-MIT",
|
||||
"node_modules",
|
||||
"components",
|
||||
"src",
|
||||
"test"
|
||||
],
|
||||
"dependencies": {
|
||||
"jquery": "~1"
|
||||
}
|
||||
}
|
201
dist/CHANGELOG.txt
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
X-editable changelog
|
||||
=============================
|
||||
|
||||
Version 1.4.5 Jun 23, 2013
|
||||
----------------------------
|
||||
[enh #245] highlight element after update (vitalets)
|
||||
[enh] select2 now works with ajax source (vitalets)
|
||||
[bug] fix datefield (datetimefield) to return null for incorrect dates (vitalets)
|
||||
[bug #224] do not close popup when it is saving value (vitalets)
|
||||
[enh] added `submitValue` to `save` event params (vitalets)
|
||||
[enh #259] allow `getValue` method to return value itself, not object (vitalets)
|
||||
[enh] add `destroy` method to inputs (vitalets)
|
||||
[enh #164] allow emptytext to be html (vitalets)
|
||||
[enh #78] allow html in editable content (vitalets)
|
||||
[enh] update container position when datetimepicker viewMode changes (vitalets)
|
||||
[enh #255] remove xxxView options from first level config of datetimepicker (vitalets)
|
||||
[enh] if `display` defined as function call it on init (vitalets)
|
||||
[enh #218] sourceCache now disables cache totally (vitalets)
|
||||
[bug #156] solve conflict of bootstrap datepicker and jQuery UI datepicker (vitalets)
|
||||
[enh] update bootstrap-datepicker to 1.1.2 (vitalets)
|
||||
[enh] allow follow links in disabled state (vitalets)
|
||||
[enh] update combodate to 1.0.4, fix #222 (vitalets)
|
||||
|
||||
|
||||
Version 1.4.4 May 4, 2013
|
||||
----------------------------
|
||||
[enh #219] added `error` callback (joekaiser)
|
||||
[enh #198] new value of showbuttons: 'bottom' (vitalets)
|
||||
[enh #192] add class editable-popup to have diferent css for popup and inline (vitalets)
|
||||
[enh] update to bootstrap-datepicker 1.0.2 (vitalets)
|
||||
[enh] update to combodate 1.0.3 with yearDescending and roundTime options (vitalets)
|
||||
[enh] add 'use strict' directive (vitalets)
|
||||
[enh #202] allow pk=0 (mdeweerd)
|
||||
[enh #183] move datepicker icon to center of button (vitalets)
|
||||
[enh] upgrade to select2 3.3.2 (vitalets)
|
||||
[enh #176] update to bootstrap 2.3.1 (vitalets)
|
||||
[bug #171] clear in date & datetime when showbuttons=false (vitalets)
|
||||
[bug #166] clear button for input type=number (vitalets)
|
||||
[bug #65] checklist don't show checked for single value (vitalets)
|
||||
[enh #188] added bootstrap datetime (adeg, vitalets)
|
||||
[bug] editable-poshytip on inline mode tries to write in $.Poshytip (vitalets)
|
||||
|
||||
|
||||
Version 1.4.3 Mar 8, 2013
|
||||
----------------------------
|
||||
[bug #32] hotfix for jQuery UI 1.9+ (vitalets)
|
||||
|
||||
|
||||
Version 1.4.2 Mar 7, 2013
|
||||
----------------------------
|
||||
[enh #132] combodate options can be defined via data-combodate json string (vitalets)
|
||||
[enh] source defined as function now has scope of element and can return string used as url (vitalets)
|
||||
[bug #99] select2 with Hierarchical Data (kev360)
|
||||
[bug #81] wysihtml5: fix inserting image (vitalets)
|
||||
[bug] remove $.browser from wysihtml5 input to support jQuery 1.9 (vitalets)
|
||||
[bug #142] editable poshytip jquery 1.9+ compatibility (spiderpug)
|
||||
[enh #126] Update bootstrap datepicker library and add minViewMode to options (kev360)
|
||||
[enh #150] select2 with showbuttons = false (vitalets)
|
||||
[bug #149] datepicker not shown when showbuttons = false (vitalets)
|
||||
[bug #133] clear button incorect position due to parent line-height property (vitalets)
|
||||
[bug #141] data-value ignored for empty elements (vitalets)
|
||||
[bug #137] fix empty class for delegated element (vitalets)
|
||||
[enh #121] add support of momentjs 2.0.0 in combodate (vitalets)
|
||||
|
||||
|
||||
Version 1.4.1 Jan 18, 2013
|
||||
----------------------------
|
||||
[enh #62] new option `selector` to work with delegated targets (vitalets)
|
||||
[enh] new option `unsavedclass` to set css class when value was not sent to server (vitalets)
|
||||
[enh] new option `emptyclass` to set css class when element is empty (vitalets)
|
||||
[enh #59] select2 input (vitalets)
|
||||
[enh #17] typeahead input (vitalets)
|
||||
[enh] select: support of OPTGROUP via `children` key in source (vitalets)
|
||||
[enh] checklist: set checked via prop instead of attr (vitalets)
|
||||
|
||||
|
||||
Version 1.4.0 Jan 11, 2013
|
||||
----------------------------
|
||||
[enh] added new input type: combodate (vitalets)
|
||||
[bug #68] allow arrays for data attributes (adimitrov)
|
||||
[enh] setValue method updates input if form is open (vitalets)
|
||||
[enh] select: change source via option method, see #61 (vitalets)
|
||||
[bug] select: source loaded twice if sourceCache = false (vitalets)
|
||||
[enh] added `destroy` method, see #61 (vitalets)
|
||||
[enh] textarea: added `rows` property (vitalets)
|
||||
[enh #60] added wysihtml5 input (vitalets)
|
||||
[enh] added IOS-style clear button for text inputs (vitalets)
|
||||
[enh] date inputs changed in inline mode (vitalets)
|
||||
[enh #51] popup/inline modes can be toggled via `mode` config option. No more *-inline.js versions of files (vitalets)
|
||||
[enh] update bootstrap-datepicker to upstream (vitalets)
|
||||
[enh] 'display' method: added param 'response' allowing to show text directly from server (vitalets)
|
||||
[enh] new util method `$.fn.editableutils.itemsByValue` to easily get selected items for sourced-inputs (vitalets)
|
||||
[enh] convert newlines to <br> in error message for more pretty display (vitalets)
|
||||
[enh #57] remove css height for textarea (vitalets)
|
||||
[enh] if new value for select is 'null' source should not load (vitalets)
|
||||
[enh #53] 'name' no more appended to source defined as url (vitalets)
|
||||
[enh #46] move 'img' dir outside 'css' (vitalets)
|
||||
[enh #48] fix handling of newlines in textarea input (jmfontaine)
|
||||
[enh #47] set select source to function (brianchance)
|
||||
[bug] fix inline container move on next line in IE7 (vitalets)
|
||||
|
||||
|
||||
Version 1.3.0 Dec 10, 2012
|
||||
----------------------------
|
||||
[enh] added html5 inputs support: password, email, url, tel, number, range (vitalets)
|
||||
[bug #43] fix for bootstrap 2.2.2 (vitalets)
|
||||
[enh #41] 'abstract' class renamed to 'abstractinput' as abstract is reserved word (vitalets)
|
||||
[enh #40] 'params' option defined as function overwrites original ajax data instead of appending (vitalets)
|
||||
[bug] datepicker: error when click on arrows after clear date (vitalets)
|
||||
[enh] 'hidden' event: added possible value of reason param - 'nochange'. Occurs when form is submitted but value was not changed (vitalets)
|
||||
[enh] 'submit' method changed: error-callback's parameter simplified (vitalets)
|
||||
[enh] 'submit' method changed: now when response 200 OK it does not set pk automatically (vitalets)
|
||||
[enh] 'submit' method changed: removed dataType='json'. Use 'ajaxOptions' to specify dataType if needed (vitalets)
|
||||
[enh] removed default ajax dataType='json'. Use 'ajaxOptions' to specify dataType if needed (vitalets)
|
||||
[enh] select: do not show 'sourceError' in element during autotext execution (vitalets)
|
||||
|
||||
|
||||
Version 1.2.0 Dec 6, 2012
|
||||
----------------------------
|
||||
[enh #36] 'submit' method: added 'ajaxOptions' property to modify ajax request (vitalets)
|
||||
[enh] inputs now internally use 'value2submit' method instead of previous 'value2str' (vitalets)
|
||||
[enh] editableContainer removed from docs (vitalets)
|
||||
[enh] editableContainer: removed 'autohide' option and 'cancel' event. Use 'hidden' event instead (vitalets)
|
||||
[enh] 'hidden' event: added param 'reason' that points to reason caused hiding (vitalets)
|
||||
[enh] 'select' submit by enter (vitalets)
|
||||
[bug #37] fix incorrectly shown datepicker in jquery 1.7.1 + webkit (vitalets)
|
||||
[enh] added url param 'jquery' to run tests in different versions of jquery, e.g. '&jquery=1.7.2' (vitalets)
|
||||
[enh] 'enablefocus' option removed. More efficient to use 'save/hide' events to set focus to any element (vitalets)
|
||||
[enh] 'init' event was added due to removal of render event (vitalets)
|
||||
[enh] 'render' event was removed, use 'display' callback instead (vitalets)
|
||||
[enh] 'checklist' submit value as array, not comma separated string (vitalets)
|
||||
[enh] 'checklist' was refactored: options 'viewseparator', 'limit', 'limitText' are supressed by 'display' callback (vitalets)
|
||||
[enh] new option: 'display' callback. Makes far more flexible rendering value into element's text. (vitalets)
|
||||
[bug] fix typos (atrophic)
|
||||
[enh] all callbacks scope changed to element (vitalets)
|
||||
[enh] new option: 'savenochange' to save or cancel value when it was not changed in form (vitalets)
|
||||
[enh] composite pk can be defined as JSON in data-pk attribute (vitalets)
|
||||
[enh #30] new option 'sourceCache' true|false to disable cache for select (vitalets)
|
||||
[bug #34] inputclass span* broken with fluid bootstrap layout. Classes changed to 'input-*'. (vitalets)
|
||||
[enh] utils now added to $.fn.editableutils instead of $.fn.editableform.utils (vitalets)
|
||||
[enh] input types now added to $.fn.editabletypes instead of $.fn.editableform.types (vitalets)
|
||||
[enh] playground and tests now use requirejs (vitalets)
|
||||
[bug #27] 'today' button toggle bug in bootstrap-datepicker (vitalets)
|
||||
|
||||
|
||||
Version 1.1.1 Nov 30, 2012
|
||||
----------------------------
|
||||
[enh] 'showbuttons' option to hide buttons in form (vitalets)
|
||||
[enh] object can be passed in 'option' method to set several options at once (vitalets)
|
||||
[enh #20] toggle editable by 'dblclick' and 'mouseenter' (vitalets)
|
||||
[enh] added 'inputs-ext' directory with sample input 'address'. They will not be concatenated to main files (vitalets)
|
||||
[enh #13] 'onblur' option: to cancel, submit or ignore when user clicks outside the form (vitalets)
|
||||
[enh] 'ajaxOptions' parameter for advanced ajax configuration (vitalets)
|
||||
[enh] 'success' callback can return object to overwrite submitted value (vitalets)
|
||||
|
||||
|
||||
Version 1.1.0 Nov 27, 2012
|
||||
----------------------------
|
||||
[enh #11] icon cancel changed to 'cross' (tarciozemel)
|
||||
[enh] added support for IE7+ (vitalets)
|
||||
[enh #9] 'name' or 'id' is not required anymore (vitalets)
|
||||
[enh] 'clear' button added in date and dateui (vitalets)
|
||||
[enh] form template changed: added DIV.editable-input, DIV.editable.buttons and $.fn.editableform.buttons (vitalets)
|
||||
[enh] new input type: checklist (vitalets)
|
||||
[enh] updated docs: inputs dropdown menu, global templates section (vitalets)
|
||||
|
||||
|
||||
Version 1.0.1 Nov 22, 2012
|
||||
----------------------------
|
||||
[enh] contribution guide in README.md (vitalets)
|
||||
[enh #7] 'shown', 'hidden' events added (vitalets)
|
||||
[enh #1] params can be a function to calculate it dynamically (vitalets)
|
||||
[enh #6] do not preventDefault() in click when toggle='manual'. This allows to have clickable links (vitalets)
|
||||
[bug #3] should not mark element with unsave css if url is user's function (vitalets)
|
||||
|
||||
|
||||
Version 1.0.0 Nov 19, 2012
|
||||
----------------------------
|
||||
Initial release. This library is new life of bootstrap-editable (1.1.4) that was strongly refactored and improved.
|
||||
Main features:
|
||||
- support not only bootstrap but any core library: bootstrap, jquery-ui or pure jquery
|
||||
- different container classes to show form: popover, tooltip, poshytip, etc
|
||||
- inline and popup versions
|
||||
- new directory structure and logic in separate js files allowing easy contribution
|
||||
|
||||
It is not fully compatible with bootstrap-editable but has mainly the same interface and api.
|
||||
Here list of differences to help you to upgrade your application:
|
||||
|
||||
[change] 'toggle' option value can be only click|manual (not toggling element id). In case of 'manual' you should write handler calling 'show' method.
|
||||
[change] 'validate' option cannot be defined as object anymore.
|
||||
[change] events 'init', 'update', 'shown', 'hidden' removed. Events 'save', 'cancel' added. Event 'render' remains.
|
||||
[change] input's option 'template' renamed to 'tpl' (to exclude conflict with container's template).
|
||||
[change] value can be stored internally as object (previously was always string). Useful for date input.
|
||||
[change] 'error' callback option is removed. 'success' callback remained.
|
||||
[enh] 'source' option in select can be array of structure [{value: 1, text: 'abc'}, {...}]. This allows to keep ordering of items in dropdown list. Previous format is supported for compatibility.
|
||||
[enh] api method 'setValue' to set manually value of editable.
|
||||
[change] locales directory is excluded from bootstrap-datepicker input. If you need localization you should jus download corresponding file from github.
|
||||
[change] date and dateui specific options can be set only via 'datepicker' option in first level of config (previously it was possible to set some options directly in config, e.g. weekStart).
|
||||
[change] if 'url' option defined as function - it is used as submit method instead of ajax (previously it was dynamically return url string and ajax occurred anyway)
|
||||
|
||||
Also all known bugs of bootstrap-editable were closed.
|
22
dist/LICENSE-MIT
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
Copyright (c) 2012 Vitaliy Potapov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
90
dist/README.md
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
# X-editable
|
||||
|
||||
In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery.
|
||||
|
||||
## Live demo
|
||||
**http://vitalets.github.io/x-editable/demo.html**
|
||||
|
||||
## Installation
|
||||
|
||||
### Manual download
|
||||
Use **http://vitalets.github.io/x-editable**
|
||||
|
||||
### Bower
|
||||
````
|
||||
bower install x-editable
|
||||
````
|
||||
|
||||
### CDN
|
||||
````js
|
||||
<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.4.5/bootstrap-editable/css/bootstrap-editable.css" rel="stylesheet"/>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.4.5/bootstrap-editable/js/bootstrap-editable.min.js"></script>
|
||||
````
|
||||
|
||||
## Documentation
|
||||
**http://vitalets.github.io/x-editable**
|
||||
|
||||
|
||||
## Reporting issues
|
||||
When creating issues please provide [jsFiddle](http://jsfiddle.net) example. You can easily fork one of following:
|
||||
1. [jsFiddle bootstrap template](http://jsfiddle.net/xBB5x/195)
|
||||
2. [jsFiddle jqueryui template](http://jsfiddle.net/xBB5x/196)
|
||||
3. [jsFiddle jquery template](http://jsfiddle.net/xBB5x/197)
|
||||
Your feedback is very appreciated!
|
||||
|
||||
## Contribution
|
||||
A few steps how to start contributing:
|
||||
|
||||
1.[Fork X-editable](https://github.com/vitalets/x-editable/fork) and pull the latest changes from <code>dev</code> branch
|
||||
|
||||
2.Arrange local directory structure. It should be:
|
||||
**x-editable**
|
||||
| -- **lib** (repo related to <code>dev</code> and <code>master</code> branches)
|
||||
| -- **gh-pages** (repo related to <code>gh-pages</code> branch for docs & demo)
|
||||
| -- **playground** (simple node-server and html page for testing, [playground_1.2.zip](https://github.com/downloads/vitalets/x-editable/playground_1.2.zip), **updated in 1.2.0!**)
|
||||
|
||||
To make it easy follow this script ( _assuming you have [nodejs](http://nodejs.org) installed_ ).
|
||||
Please replace <code><your-github-name></code> with your name:
|
||||
````
|
||||
mkdir x-editable
|
||||
cd x-editable
|
||||
|
||||
#lib
|
||||
git clone https://github.com/<your-github-name>/x-editable.git -b dev lib
|
||||
cd lib
|
||||
#install gruntjs globally - building tool
|
||||
npm install -g grunt
|
||||
#install other dependencies - grunt-contrib
|
||||
npm install
|
||||
cd ..
|
||||
|
||||
#gh-pages
|
||||
git clone https://github.com/<your-github-name>/x-editable.git -b gh-pages gh-pages
|
||||
cd gh-pages
|
||||
npm install
|
||||
cd ..
|
||||
|
||||
#playground
|
||||
#download playground.zip from https://github.com/downloads/vitalets/x-editable/playground_1.2.zip
|
||||
unzip playground.zip
|
||||
cd playground
|
||||
npm install
|
||||
````
|
||||
3.That's it! You can start editing files in **lib/src** directory or create new editable input/container/whatever.
|
||||
To test the result go to **playground**, start server <code>node server.js</code> and open in your browser [http://localhost:3000/playground](http://localhost:3000/playground).
|
||||
|
||||
4.To run unit tests you can open it directly in browser **lib/test/index.html**.
|
||||
Or use grunt's _qunit_ task <code>grunt test</code>. For that you also need to [install PhantomJS](https://github.com/gruntjs/grunt/blob/master/docs/faq.md#why-does-grunt-complain-that-phantomjs-isnt-installed)
|
||||
|
||||
5.To build distributive run <code>grunt build</code> in **lib** directory. Result will appear in **lib/dist**.
|
||||
|
||||
6.To build docs run <code>build data-docs-dist</code> in **gh-pages** directory. Result will appear in **gh-pages/*.html**.
|
||||
Do not edit **index.html** and **docs.html** directly! Instead look at [Handlebars](https://github.com/wycats/handlebars.js) templates in **generator/templates**.
|
||||
|
||||
7.Commit changes on <code>dev</code> / <code>gh-pages-dev</code> branch and make pull request as usual.
|
||||
|
||||
Thanks for your support!
|
||||
|
||||
## License
|
||||
Copyright (c) 2012 Vitaliy Potapov
|
||||
Licensed under the MIT license.
|
651
dist/bootstrap-editable/css/bootstrap-editable.css
vendored
Normal file
@ -0,0 +1,651 @@
|
||||
/*! X-editable - v1.4.5
|
||||
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
||||
* http://github.com/vitalets/x-editable
|
||||
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
||||
|
||||
.editableform {
|
||||
margin-bottom: 0; /* overwrites bootstrap margin */
|
||||
}
|
||||
|
||||
.editableform .control-group {
|
||||
margin-bottom: 0; /* overwrites bootstrap margin */
|
||||
white-space: nowrap; /* prevent wrapping buttons on new line */
|
||||
line-height: 20px; /* overwriting bootstrap line-height. See #133 */
|
||||
}
|
||||
|
||||
.editable-buttons {
|
||||
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
|
||||
vertical-align: top;
|
||||
margin-left: 7px;
|
||||
/* inline-block emulation for IE7*/
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
|
||||
.editable-buttons.editable-buttons-bottom {
|
||||
display: block;
|
||||
margin-top: 7px;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.editable-input {
|
||||
vertical-align: top;
|
||||
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
|
||||
width: auto; /* bootstrap-responsive has width: 100% that breakes layout */
|
||||
white-space: normal; /* reset white-space decalred in parent*/
|
||||
/* display-inline emulation for IE7*/
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
|
||||
.editable-buttons .editable-cancel {
|
||||
margin-left: 7px;
|
||||
}
|
||||
|
||||
/*for jquery-ui buttons need set height to look more pretty*/
|
||||
.editable-buttons button.ui-button-icon-only {
|
||||
height: 24px;
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
.editableform-loading {
|
||||
background: url('../img/loading.gif') center center no-repeat;
|
||||
height: 25px;
|
||||
width: auto;
|
||||
min-width: 25px;
|
||||
}
|
||||
|
||||
.editable-inline .editableform-loading {
|
||||
background-position: left 5px;
|
||||
}
|
||||
|
||||
.editable-error-block {
|
||||
max-width: 300px;
|
||||
margin: 5px 0 0 0;
|
||||
width: auto;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
/*add padding for jquery ui*/
|
||||
.editable-error-block.ui-state-error {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.editable-error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/* ---- For specific types ---- */
|
||||
|
||||
.editableform .editable-date {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
float: left;
|
||||
}
|
||||
|
||||
/* move datepicker icon to center of add-on button. See https://github.com/vitalets/x-editable/issues/183 */
|
||||
.editable-inline .add-on .icon-th {
|
||||
margin-top: 3px;
|
||||
margin-left: 1px;
|
||||
}
|
||||
|
||||
|
||||
/* checklist vertical alignment */
|
||||
.editable-checklist label input[type="checkbox"],
|
||||
.editable-checklist label span {
|
||||
vertical-align: middle;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.editable-checklist label {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* set exact width of textarea to fit buttons toolbar */
|
||||
.editable-wysihtml5 {
|
||||
width: 566px;
|
||||
height: 250px;
|
||||
}
|
||||
|
||||
/* clear button shown as link in date inputs */
|
||||
.editable-clear {
|
||||
clear: both;
|
||||
font-size: 0.9em;
|
||||
text-decoration: none;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* IOS-style clear button for text inputs */
|
||||
.editable-clear-x {
|
||||
background: url('../img/clear.png') center center no-repeat;
|
||||
display: block;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
position: absolute;
|
||||
opacity: 0.6;
|
||||
z-index: 100;
|
||||
|
||||
top: 50%;
|
||||
right: 6px;
|
||||
margin-top: -6px;
|
||||
|
||||
}
|
||||
|
||||
.editable-clear-x:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
.editable-container.editable-popup {
|
||||
max-width: none !important; /* without this rule poshytip/tooltip does not stretch */
|
||||
}
|
||||
|
||||
.editable-container.popover {
|
||||
width: auto; /* without this rule popover does not stretch */
|
||||
}
|
||||
|
||||
.editable-container.editable-inline {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: auto;
|
||||
/* inline-block emulation for IE7*/
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
|
||||
.editable-container.ui-widget {
|
||||
font-size: inherit; /* jqueryui widget font 1.1em too big, overwrite it */
|
||||
}
|
||||
.editable-click,
|
||||
a.editable-click,
|
||||
a.editable-click:hover {
|
||||
text-decoration: none;
|
||||
border-bottom: dashed 1px #0088cc;
|
||||
}
|
||||
|
||||
.editable-click.editable-disabled,
|
||||
a.editable-click.editable-disabled,
|
||||
a.editable-click.editable-disabled:hover {
|
||||
color: #585858;
|
||||
cursor: default;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.editable-empty, .editable-empty:hover, .editable-empty:focus{
|
||||
font-style: italic;
|
||||
color: #DD1144;
|
||||
/* border-bottom: none; */
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.editable-unsaved {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.editable-unsaved:after {
|
||||
/* content: '*'*/
|
||||
}
|
||||
|
||||
.editable-bg-transition {
|
||||
-webkit-transition: background-color 1400ms ease-out;
|
||||
-moz-transition: background-color 1400ms ease-out;
|
||||
-o-transition: background-color 1400ms ease-out;
|
||||
-ms-transition: background-color 1400ms ease-out;
|
||||
transition: background-color 1400ms ease-out;
|
||||
}
|
||||
|
||||
/*see https://github.com/vitalets/x-editable/issues/139 */
|
||||
.form-horizontal .editable
|
||||
{
|
||||
padding-top: 5px;
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Datepicker for Bootstrap
|
||||
*
|
||||
* Copyright 2012 Stefan Petre
|
||||
* Improvements by Andrew Rowls
|
||||
* Licensed under the Apache License v2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*/
|
||||
.datepicker {
|
||||
padding: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
direction: ltr;
|
||||
/*.dow {
|
||||
border-top: 1px solid #ddd !important;
|
||||
}*/
|
||||
|
||||
}
|
||||
.datepicker-inline {
|
||||
width: 220px;
|
||||
}
|
||||
.datepicker.datepicker-rtl {
|
||||
direction: rtl;
|
||||
}
|
||||
.datepicker.datepicker-rtl table tr td span {
|
||||
float: right;
|
||||
}
|
||||
.datepicker-dropdown {
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
.datepicker-dropdown:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 7px solid transparent;
|
||||
border-right: 7px solid transparent;
|
||||
border-bottom: 7px solid #ccc;
|
||||
border-bottom-color: rgba(0, 0, 0, 0.2);
|
||||
position: absolute;
|
||||
top: -7px;
|
||||
left: 6px;
|
||||
}
|
||||
.datepicker-dropdown:after {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-bottom: 6px solid #ffffff;
|
||||
position: absolute;
|
||||
top: -6px;
|
||||
left: 7px;
|
||||
}
|
||||
.datepicker > div {
|
||||
display: none;
|
||||
}
|
||||
.datepicker.days div.datepicker-days {
|
||||
display: block;
|
||||
}
|
||||
.datepicker.months div.datepicker-months {
|
||||
display: block;
|
||||
}
|
||||
.datepicker.years div.datepicker-years {
|
||||
display: block;
|
||||
}
|
||||
.datepicker table {
|
||||
margin: 0;
|
||||
}
|
||||
.datepicker td,
|
||||
.datepicker th {
|
||||
text-align: center;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
border: none;
|
||||
}
|
||||
.table-striped .datepicker table tr td,
|
||||
.table-striped .datepicker table tr th {
|
||||
background-color: transparent;
|
||||
}
|
||||
.datepicker table tr td.day:hover {
|
||||
background: #eeeeee;
|
||||
cursor: pointer;
|
||||
}
|
||||
.datepicker table tr td.old,
|
||||
.datepicker table tr td.new {
|
||||
color: #999999;
|
||||
}
|
||||
.datepicker table tr td.disabled,
|
||||
.datepicker table tr td.disabled:hover {
|
||||
background: none;
|
||||
color: #999999;
|
||||
cursor: default;
|
||||
}
|
||||
.datepicker table tr td.today,
|
||||
.datepicker table tr td.today:hover,
|
||||
.datepicker table tr td.today.disabled,
|
||||
.datepicker table tr td.today.disabled:hover {
|
||||
background-color: #fde19a;
|
||||
background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a));
|
||||
background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: -o-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0);
|
||||
border-color: #fdf59a #fdf59a #fbed50;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #000;
|
||||
}
|
||||
.datepicker table tr td.today:hover,
|
||||
.datepicker table tr td.today:hover:hover,
|
||||
.datepicker table tr td.today.disabled:hover,
|
||||
.datepicker table tr td.today.disabled:hover:hover,
|
||||
.datepicker table tr td.today:active,
|
||||
.datepicker table tr td.today:hover:active,
|
||||
.datepicker table tr td.today.disabled:active,
|
||||
.datepicker table tr td.today.disabled:hover:active,
|
||||
.datepicker table tr td.today.active,
|
||||
.datepicker table tr td.today:hover.active,
|
||||
.datepicker table tr td.today.disabled.active,
|
||||
.datepicker table tr td.today.disabled:hover.active,
|
||||
.datepicker table tr td.today.disabled,
|
||||
.datepicker table tr td.today:hover.disabled,
|
||||
.datepicker table tr td.today.disabled.disabled,
|
||||
.datepicker table tr td.today.disabled:hover.disabled,
|
||||
.datepicker table tr td.today[disabled],
|
||||
.datepicker table tr td.today:hover[disabled],
|
||||
.datepicker table tr td.today.disabled[disabled],
|
||||
.datepicker table tr td.today.disabled:hover[disabled] {
|
||||
background-color: #fdf59a;
|
||||
}
|
||||
.datepicker table tr td.today:active,
|
||||
.datepicker table tr td.today:hover:active,
|
||||
.datepicker table tr td.today.disabled:active,
|
||||
.datepicker table tr td.today.disabled:hover:active,
|
||||
.datepicker table tr td.today.active,
|
||||
.datepicker table tr td.today:hover.active,
|
||||
.datepicker table tr td.today.disabled.active,
|
||||
.datepicker table tr td.today.disabled:hover.active {
|
||||
background-color: #fbf069 \9;
|
||||
}
|
||||
.datepicker table tr td.today:hover:hover {
|
||||
color: #000;
|
||||
}
|
||||
.datepicker table tr td.today.active:hover {
|
||||
color: #fff;
|
||||
}
|
||||
.datepicker table tr td.range,
|
||||
.datepicker table tr td.range:hover,
|
||||
.datepicker table tr td.range.disabled,
|
||||
.datepicker table tr td.range.disabled:hover {
|
||||
background: #eeeeee;
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.datepicker table tr td.range.today,
|
||||
.datepicker table tr td.range.today:hover,
|
||||
.datepicker table tr td.range.today.disabled,
|
||||
.datepicker table tr td.range.today.disabled:hover {
|
||||
background-color: #f3d17a;
|
||||
background-image: -moz-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: -ms-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f3c17a), to(#f3e97a));
|
||||
background-image: -webkit-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: -o-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3c17a', endColorstr='#f3e97a', GradientType=0);
|
||||
border-color: #f3e97a #f3e97a #edde34;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.datepicker table tr td.range.today:hover,
|
||||
.datepicker table tr td.range.today:hover:hover,
|
||||
.datepicker table tr td.range.today.disabled:hover,
|
||||
.datepicker table tr td.range.today.disabled:hover:hover,
|
||||
.datepicker table tr td.range.today:active,
|
||||
.datepicker table tr td.range.today:hover:active,
|
||||
.datepicker table tr td.range.today.disabled:active,
|
||||
.datepicker table tr td.range.today.disabled:hover:active,
|
||||
.datepicker table tr td.range.today.active,
|
||||
.datepicker table tr td.range.today:hover.active,
|
||||
.datepicker table tr td.range.today.disabled.active,
|
||||
.datepicker table tr td.range.today.disabled:hover.active,
|
||||
.datepicker table tr td.range.today.disabled,
|
||||
.datepicker table tr td.range.today:hover.disabled,
|
||||
.datepicker table tr td.range.today.disabled.disabled,
|
||||
.datepicker table tr td.range.today.disabled:hover.disabled,
|
||||
.datepicker table tr td.range.today[disabled],
|
||||
.datepicker table tr td.range.today:hover[disabled],
|
||||
.datepicker table tr td.range.today.disabled[disabled],
|
||||
.datepicker table tr td.range.today.disabled:hover[disabled] {
|
||||
background-color: #f3e97a;
|
||||
}
|
||||
.datepicker table tr td.range.today:active,
|
||||
.datepicker table tr td.range.today:hover:active,
|
||||
.datepicker table tr td.range.today.disabled:active,
|
||||
.datepicker table tr td.range.today.disabled:hover:active,
|
||||
.datepicker table tr td.range.today.active,
|
||||
.datepicker table tr td.range.today:hover.active,
|
||||
.datepicker table tr td.range.today.disabled.active,
|
||||
.datepicker table tr td.range.today.disabled:hover.active {
|
||||
background-color: #efe24b \9;
|
||||
}
|
||||
.datepicker table tr td.selected,
|
||||
.datepicker table tr td.selected:hover,
|
||||
.datepicker table tr td.selected.disabled,
|
||||
.datepicker table tr td.selected.disabled:hover {
|
||||
background-color: #9e9e9e;
|
||||
background-image: -moz-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: -ms-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b3b3b3), to(#808080));
|
||||
background-image: -webkit-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: -o-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: linear-gradient(top, #b3b3b3, #808080);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b3b3b3', endColorstr='#808080', GradientType=0);
|
||||
border-color: #808080 #808080 #595959;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.datepicker table tr td.selected:hover,
|
||||
.datepicker table tr td.selected:hover:hover,
|
||||
.datepicker table tr td.selected.disabled:hover,
|
||||
.datepicker table tr td.selected.disabled:hover:hover,
|
||||
.datepicker table tr td.selected:active,
|
||||
.datepicker table tr td.selected:hover:active,
|
||||
.datepicker table tr td.selected.disabled:active,
|
||||
.datepicker table tr td.selected.disabled:hover:active,
|
||||
.datepicker table tr td.selected.active,
|
||||
.datepicker table tr td.selected:hover.active,
|
||||
.datepicker table tr td.selected.disabled.active,
|
||||
.datepicker table tr td.selected.disabled:hover.active,
|
||||
.datepicker table tr td.selected.disabled,
|
||||
.datepicker table tr td.selected:hover.disabled,
|
||||
.datepicker table tr td.selected.disabled.disabled,
|
||||
.datepicker table tr td.selected.disabled:hover.disabled,
|
||||
.datepicker table tr td.selected[disabled],
|
||||
.datepicker table tr td.selected:hover[disabled],
|
||||
.datepicker table tr td.selected.disabled[disabled],
|
||||
.datepicker table tr td.selected.disabled:hover[disabled] {
|
||||
background-color: #808080;
|
||||
}
|
||||
.datepicker table tr td.selected:active,
|
||||
.datepicker table tr td.selected:hover:active,
|
||||
.datepicker table tr td.selected.disabled:active,
|
||||
.datepicker table tr td.selected.disabled:hover:active,
|
||||
.datepicker table tr td.selected.active,
|
||||
.datepicker table tr td.selected:hover.active,
|
||||
.datepicker table tr td.selected.disabled.active,
|
||||
.datepicker table tr td.selected.disabled:hover.active {
|
||||
background-color: #666666 \9;
|
||||
}
|
||||
.datepicker table tr td.active,
|
||||
.datepicker table tr td.active:hover,
|
||||
.datepicker table tr td.active.disabled,
|
||||
.datepicker table tr td.active.disabled:hover {
|
||||
background-color: #006dcc;
|
||||
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
|
||||
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: linear-gradient(top, #0088cc, #0044cc);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
|
||||
border-color: #0044cc #0044cc #002a80;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.datepicker table tr td.active:hover,
|
||||
.datepicker table tr td.active:hover:hover,
|
||||
.datepicker table tr td.active.disabled:hover,
|
||||
.datepicker table tr td.active.disabled:hover:hover,
|
||||
.datepicker table tr td.active:active,
|
||||
.datepicker table tr td.active:hover:active,
|
||||
.datepicker table tr td.active.disabled:active,
|
||||
.datepicker table tr td.active.disabled:hover:active,
|
||||
.datepicker table tr td.active.active,
|
||||
.datepicker table tr td.active:hover.active,
|
||||
.datepicker table tr td.active.disabled.active,
|
||||
.datepicker table tr td.active.disabled:hover.active,
|
||||
.datepicker table tr td.active.disabled,
|
||||
.datepicker table tr td.active:hover.disabled,
|
||||
.datepicker table tr td.active.disabled.disabled,
|
||||
.datepicker table tr td.active.disabled:hover.disabled,
|
||||
.datepicker table tr td.active[disabled],
|
||||
.datepicker table tr td.active:hover[disabled],
|
||||
.datepicker table tr td.active.disabled[disabled],
|
||||
.datepicker table tr td.active.disabled:hover[disabled] {
|
||||
background-color: #0044cc;
|
||||
}
|
||||
.datepicker table tr td.active:active,
|
||||
.datepicker table tr td.active:hover:active,
|
||||
.datepicker table tr td.active.disabled:active,
|
||||
.datepicker table tr td.active.disabled:hover:active,
|
||||
.datepicker table tr td.active.active,
|
||||
.datepicker table tr td.active:hover.active,
|
||||
.datepicker table tr td.active.disabled.active,
|
||||
.datepicker table tr td.active.disabled:hover.active {
|
||||
background-color: #003399 \9;
|
||||
}
|
||||
.datepicker table tr td span {
|
||||
display: block;
|
||||
width: 23%;
|
||||
height: 54px;
|
||||
line-height: 54px;
|
||||
float: left;
|
||||
margin: 1%;
|
||||
cursor: pointer;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.datepicker table tr td span:hover {
|
||||
background: #eeeeee;
|
||||
}
|
||||
.datepicker table tr td span.disabled,
|
||||
.datepicker table tr td span.disabled:hover {
|
||||
background: none;
|
||||
color: #999999;
|
||||
cursor: default;
|
||||
}
|
||||
.datepicker table tr td span.active,
|
||||
.datepicker table tr td span.active:hover,
|
||||
.datepicker table tr td span.active.disabled,
|
||||
.datepicker table tr td span.active.disabled:hover {
|
||||
background-color: #006dcc;
|
||||
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
|
||||
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: linear-gradient(top, #0088cc, #0044cc);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
|
||||
border-color: #0044cc #0044cc #002a80;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.datepicker table tr td span.active:hover,
|
||||
.datepicker table tr td span.active:hover:hover,
|
||||
.datepicker table tr td span.active.disabled:hover,
|
||||
.datepicker table tr td span.active.disabled:hover:hover,
|
||||
.datepicker table tr td span.active:active,
|
||||
.datepicker table tr td span.active:hover:active,
|
||||
.datepicker table tr td span.active.disabled:active,
|
||||
.datepicker table tr td span.active.disabled:hover:active,
|
||||
.datepicker table tr td span.active.active,
|
||||
.datepicker table tr td span.active:hover.active,
|
||||
.datepicker table tr td span.active.disabled.active,
|
||||
.datepicker table tr td span.active.disabled:hover.active,
|
||||
.datepicker table tr td span.active.disabled,
|
||||
.datepicker table tr td span.active:hover.disabled,
|
||||
.datepicker table tr td span.active.disabled.disabled,
|
||||
.datepicker table tr td span.active.disabled:hover.disabled,
|
||||
.datepicker table tr td span.active[disabled],
|
||||
.datepicker table tr td span.active:hover[disabled],
|
||||
.datepicker table tr td span.active.disabled[disabled],
|
||||
.datepicker table tr td span.active.disabled:hover[disabled] {
|
||||
background-color: #0044cc;
|
||||
}
|
||||
.datepicker table tr td span.active:active,
|
||||
.datepicker table tr td span.active:hover:active,
|
||||
.datepicker table tr td span.active.disabled:active,
|
||||
.datepicker table tr td span.active.disabled:hover:active,
|
||||
.datepicker table tr td span.active.active,
|
||||
.datepicker table tr td span.active:hover.active,
|
||||
.datepicker table tr td span.active.disabled.active,
|
||||
.datepicker table tr td span.active.disabled:hover.active {
|
||||
background-color: #003399 \9;
|
||||
}
|
||||
.datepicker table tr td span.old,
|
||||
.datepicker table tr td span.new {
|
||||
color: #999999;
|
||||
}
|
||||
.datepicker th.datepicker-switch {
|
||||
width: 145px;
|
||||
}
|
||||
.datepicker thead tr:first-child th,
|
||||
.datepicker tfoot tr th {
|
||||
cursor: pointer;
|
||||
}
|
||||
.datepicker thead tr:first-child th:hover,
|
||||
.datepicker tfoot tr th:hover {
|
||||
background: #eeeeee;
|
||||
}
|
||||
.datepicker .cw {
|
||||
font-size: 10px;
|
||||
width: 12px;
|
||||
padding: 0 2px 0 5px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.datepicker thead tr:first-child th.cw {
|
||||
cursor: default;
|
||||
background-color: transparent;
|
||||
}
|
||||
.input-append.date .add-on i,
|
||||
.input-prepend.date .add-on i {
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
.input-daterange input {
|
||||
text-align: center;
|
||||
}
|
||||
.input-daterange input:first-child {
|
||||
-webkit-border-radius: 3px 0 0 3px;
|
||||
-moz-border-radius: 3px 0 0 3px;
|
||||
border-radius: 3px 0 0 3px;
|
||||
}
|
||||
.input-daterange input:last-child {
|
||||
-webkit-border-radius: 0 3px 3px 0;
|
||||
-moz-border-radius: 0 3px 3px 0;
|
||||
border-radius: 0 3px 3px 0;
|
||||
}
|
||||
.input-daterange .add-on {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
min-width: 16px;
|
||||
height: 18px;
|
||||
padding: 4px 5px;
|
||||
font-weight: normal;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 0 #ffffff;
|
||||
vertical-align: middle;
|
||||
background-color: #eeeeee;
|
||||
border: 1px solid #ccc;
|
||||
margin-left: -5px;
|
||||
margin-right: -5px;
|
||||
}
|
BIN
dist/bootstrap-editable/img/clear.png
vendored
Normal file
After ![]() (image error) Size: 509 B |
BIN
dist/bootstrap-editable/img/loading.gif
vendored
Normal file
After ![]() (image error) Size: 1.8 KiB |
6621
dist/bootstrap-editable/js/bootstrap-editable.js
vendored
Normal file
5
dist/bootstrap-editable/js/bootstrap-editable.min.js
vendored
Normal file
9
dist/inputs-ext/address/address.css
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
.editable-address {
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.editable-address span {
|
||||
width: 70px;
|
||||
display: inline-block;
|
||||
}
|
170
dist/inputs-ext/address/address.js
vendored
Normal file
@ -0,0 +1,170 @@
|
||||
/**
|
||||
Address editable input.
|
||||
Internally value stored as {city: "Moscow", street: "Lenina", building: "15"}
|
||||
|
||||
@class address
|
||||
@extends abstractinput
|
||||
@final
|
||||
@example
|
||||
<a href="#" id="address" data-type="address" data-pk="1">awesome</a>
|
||||
<script>
|
||||
$(function(){
|
||||
$('#address').editable({
|
||||
url: '/post',
|
||||
title: 'Enter city, street and building #',
|
||||
value: {
|
||||
city: "Moscow",
|
||||
street: "Lenina",
|
||||
building: "15"
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
**/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
var Address = function (options) {
|
||||
this.init('address', options, Address.defaults);
|
||||
};
|
||||
|
||||
//inherit from Abstract input
|
||||
$.fn.editableutils.inherit(Address, $.fn.editabletypes.abstractinput);
|
||||
|
||||
$.extend(Address.prototype, {
|
||||
/**
|
||||
Renders input from tpl
|
||||
|
||||
@method render()
|
||||
**/
|
||||
render: function() {
|
||||
this.$input = this.$tpl.find('input');
|
||||
},
|
||||
|
||||
/**
|
||||
Default method to show value in element. Can be overwritten by display option.
|
||||
|
||||
@method value2html(value, element)
|
||||
**/
|
||||
value2html: function(value, element) {
|
||||
if(!value) {
|
||||
$(element).empty();
|
||||
return;
|
||||
}
|
||||
var html = $('<div>').text(value.city).html() + ', ' + $('<div>').text(value.street).html() + ' st., bld. ' + $('<div>').text(value.building).html();
|
||||
$(element).html(html);
|
||||
},
|
||||
|
||||
/**
|
||||
Gets value from element's html
|
||||
|
||||
@method html2value(html)
|
||||
**/
|
||||
html2value: function(html) {
|
||||
/*
|
||||
you may write parsing method to get value by element's html
|
||||
e.g. "Moscow, st. Lenina, bld. 15" => {city: "Moscow", street: "Lenina", building: "15"}
|
||||
but for complex structures it's not recommended.
|
||||
Better set value directly via javascript, e.g.
|
||||
editable({
|
||||
value: {
|
||||
city: "Moscow",
|
||||
street: "Lenina",
|
||||
building: "15"
|
||||
}
|
||||
});
|
||||
*/
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
Converts value to string.
|
||||
It is used in internal comparing (not for sending to server).
|
||||
|
||||
@method value2str(value)
|
||||
**/
|
||||
value2str: function(value) {
|
||||
var str = '';
|
||||
if(value) {
|
||||
for(var k in value) {
|
||||
str = str + k + ':' + value[k] + ';';
|
||||
}
|
||||
}
|
||||
return str;
|
||||
},
|
||||
|
||||
/*
|
||||
Converts string to value. Used for reading value from 'data-value' attribute.
|
||||
|
||||
@method str2value(str)
|
||||
*/
|
||||
str2value: function(str) {
|
||||
/*
|
||||
this is mainly for parsing value defined in data-value attribute.
|
||||
If you will always set value by javascript, no need to overwrite it
|
||||
*/
|
||||
return str;
|
||||
},
|
||||
|
||||
/**
|
||||
Sets value of input.
|
||||
|
||||
@method value2input(value)
|
||||
@param {mixed} value
|
||||
**/
|
||||
value2input: function(value) {
|
||||
if(!value) {
|
||||
return;
|
||||
}
|
||||
this.$input.filter('[name="city"]').val(value.city);
|
||||
this.$input.filter('[name="street"]').val(value.street);
|
||||
this.$input.filter('[name="building"]').val(value.building);
|
||||
},
|
||||
|
||||
/**
|
||||
Returns value of input.
|
||||
|
||||
@method input2value()
|
||||
**/
|
||||
input2value: function() {
|
||||
return {
|
||||
city: this.$input.filter('[name="city"]').val(),
|
||||
street: this.$input.filter('[name="street"]').val(),
|
||||
building: this.$input.filter('[name="building"]').val()
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
Activates input: sets focus on the first field.
|
||||
|
||||
@method activate()
|
||||
**/
|
||||
activate: function() {
|
||||
this.$input.filter('[name="city"]').focus();
|
||||
},
|
||||
|
||||
/**
|
||||
Attaches handler to submit form in case of 'showbuttons=false' mode
|
||||
|
||||
@method autosubmit()
|
||||
**/
|
||||
autosubmit: function() {
|
||||
this.$input.keydown(function (e) {
|
||||
if (e.which === 13) {
|
||||
$(this).closest('form').submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Address.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
|
||||
tpl: '<div class="editable-address"><label><span>City: </span><input type="text" name="city" class="input-small"></label></div>'+
|
||||
'<div class="editable-address"><label><span>Street: </span><input type="text" name="street" class="input-small"></label></div>'+
|
||||
'<div class="editable-address"><label><span>Building: </span><input type="text" name="building" class="input-mini"></label></div>',
|
||||
|
||||
inputclass: ''
|
||||
});
|
||||
|
||||
$.fn.editabletypes.address = Address;
|
||||
|
||||
}(window.jQuery));
|
102
dist/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/bootstrap-wysihtml5-0.0.2.css
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
ul.wysihtml5-toolbar {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: block;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar::after {
|
||||
clear: both;
|
||||
display: table;
|
||||
content: "";
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar > li {
|
||||
float: left;
|
||||
display: list-item;
|
||||
list-style: none;
|
||||
margin: 0 5px 10px 0;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar a[data-wysihtml5-command=bold] {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar a[data-wysihtml5-command=italic] {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar a[data-wysihtml5-command=underline] {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar a.btn.wysihtml5-command-active {
|
||||
background-image: none;
|
||||
-webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
-moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
background-color: #E6E6E6;
|
||||
background-color: #D9D9D9;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
ul.wysihtml5-commands-disabled .dropdown-menu {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar div.wysihtml5-colors {
|
||||
display:block;
|
||||
width: 50px;
|
||||
height: 20px;
|
||||
margin-top: 2px;
|
||||
margin-left: 5px;
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar a.wysihtml5-colors-title {
|
||||
padding-left: 70px;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="black"] {
|
||||
background: black !important;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="silver"] {
|
||||
background: silver !important;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="gray"] {
|
||||
background: gray !important;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="maroon"] {
|
||||
background: maroon !important;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="red"] {
|
||||
background: red !important;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="purple"] {
|
||||
background: purple !important;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="green"] {
|
||||
background: green !important;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="olive"] {
|
||||
background: olive !important;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="navy"] {
|
||||
background: navy !important;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="blue"] {
|
||||
background: blue !important;
|
||||
}
|
||||
|
||||
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="orange"] {
|
||||
background: orange !important;
|
||||
}
|
499
dist/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/bootstrap-wysihtml5-0.0.2.js
vendored
Normal file
@ -0,0 +1,499 @@
|
||||
!function($, wysi) {
|
||||
"use strict";
|
||||
|
||||
var tpl = {
|
||||
"font-styles": function(locale, options) {
|
||||
var size = (options && options.size) ? ' btn-'+options.size : '';
|
||||
return "<li class='dropdown'>" +
|
||||
"<a class='btn dropdown-toggle" + size + "' data-toggle='dropdown' href='#'>" +
|
||||
"<i class='icon-font'></i> <span class='current-font'>" + locale.font_styles.normal + "</span> <b class='caret'></b>" +
|
||||
"</a>" +
|
||||
"<ul class='dropdown-menu'>" +
|
||||
"<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='div' tabindex='-1'>" + locale.font_styles.normal + "</a></li>" +
|
||||
"<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='h1' tabindex='-1'>" + locale.font_styles.h1 + "</a></li>" +
|
||||
"<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='h2' tabindex='-1'>" + locale.font_styles.h2 + "</a></li>" +
|
||||
"<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='h3' tabindex='-1'>" + locale.font_styles.h3 + "</a></li>" +
|
||||
"</ul>" +
|
||||
"</li>";
|
||||
},
|
||||
|
||||
"emphasis": function(locale, options) {
|
||||
var size = (options && options.size) ? ' btn-'+options.size : '';
|
||||
return "<li>" +
|
||||
"<div class='btn-group'>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='bold' title='CTRL+B' tabindex='-1'>" + locale.emphasis.bold + "</a>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='italic' title='CTRL+I' tabindex='-1'>" + locale.emphasis.italic + "</a>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='underline' title='CTRL+U' tabindex='-1'>" + locale.emphasis.underline + "</a>" +
|
||||
"</div>" +
|
||||
"</li>";
|
||||
},
|
||||
|
||||
"lists": function(locale, options) {
|
||||
var size = (options && options.size) ? ' btn-'+options.size : '';
|
||||
return "<li>" +
|
||||
"<div class='btn-group'>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='insertUnorderedList' title='" + locale.lists.unordered + "' tabindex='-1'><i class='icon-list'></i></a>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='insertOrderedList' title='" + locale.lists.ordered + "' tabindex='-1'><i class='icon-th-list'></i></a>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='Outdent' title='" + locale.lists.outdent + "' tabindex='-1'><i class='icon-indent-right'></i></a>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='Indent' title='" + locale.lists.indent + "' tabindex='-1'><i class='icon-indent-left'></i></a>" +
|
||||
"</div>" +
|
||||
"</li>";
|
||||
},
|
||||
|
||||
"link": function(locale, options) {
|
||||
var size = (options && options.size) ? ' btn-'+options.size : '';
|
||||
return "<li>" +
|
||||
"<div class='bootstrap-wysihtml5-insert-link-modal modal hide fade'>" +
|
||||
"<div class='modal-header'>" +
|
||||
"<a class='close' data-dismiss='modal'>×</a>" +
|
||||
"<h3>" + locale.link.insert + "</h3>" +
|
||||
"</div>" +
|
||||
"<div class='modal-body'>" +
|
||||
"<input value='http://' class='bootstrap-wysihtml5-insert-link-url input-xlarge'>" +
|
||||
"</div>" +
|
||||
"<div class='modal-footer'>" +
|
||||
"<a href='#' class='btn' data-dismiss='modal'>" + locale.link.cancel + "</a>" +
|
||||
"<a href='#' class='btn btn-primary' data-dismiss='modal'>" + locale.link.insert + "</a>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='createLink' title='" + locale.link.insert + "' tabindex='-1'><i class='icon-share'></i></a>" +
|
||||
"</li>";
|
||||
},
|
||||
|
||||
"image": function(locale, options) {
|
||||
var size = (options && options.size) ? ' btn-'+options.size : '';
|
||||
return "<li>" +
|
||||
"<div class='bootstrap-wysihtml5-insert-image-modal modal hide fade'>" +
|
||||
"<div class='modal-header'>" +
|
||||
"<a class='close' data-dismiss='modal'>×</a>" +
|
||||
"<h3>" + locale.image.insert + "</h3>" +
|
||||
"</div>" +
|
||||
"<div class='modal-body'>" +
|
||||
"<input value='http://' class='bootstrap-wysihtml5-insert-image-url input-xlarge'>" +
|
||||
"</div>" +
|
||||
"<div class='modal-footer'>" +
|
||||
"<a href='#' class='btn' data-dismiss='modal'>" + locale.image.cancel + "</a>" +
|
||||
"<a href='#' class='btn btn-primary' data-dismiss='modal'>" + locale.image.insert + "</a>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='insertImage' title='" + locale.image.insert + "' tabindex='-1'><i class='icon-picture'></i></a>" +
|
||||
"</li>";
|
||||
},
|
||||
|
||||
"html": function(locale, options) {
|
||||
var size = (options && options.size) ? ' btn-'+options.size : '';
|
||||
return "<li>" +
|
||||
"<div class='btn-group'>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-action='change_view' title='" + locale.html.edit + "' tabindex='-1'><i class='icon-pencil'></i></a>" +
|
||||
"</div>" +
|
||||
"</li>";
|
||||
},
|
||||
|
||||
"color": function(locale, options) {
|
||||
var size = (options && options.size) ? ' btn-'+options.size : '';
|
||||
return "<li class='dropdown'>" +
|
||||
"<a class='btn dropdown-toggle" + size + "' data-toggle='dropdown' href='#' tabindex='-1'>" +
|
||||
"<span class='current-color'>" + locale.colours.black + "</span> <b class='caret'></b>" +
|
||||
"</a>" +
|
||||
"<ul class='dropdown-menu'>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='black'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='black'>" + locale.colours.black + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='silver'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='silver'>" + locale.colours.silver + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='gray'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='gray'>" + locale.colours.gray + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='maroon'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='maroon'>" + locale.colours.maroon + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='red'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='red'>" + locale.colours.red + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='purple'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='purple'>" + locale.colours.purple + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='green'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='green'>" + locale.colours.green + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='olive'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='olive'>" + locale.colours.olive + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='navy'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='navy'>" + locale.colours.navy + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='blue'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='blue'>" + locale.colours.blue + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='orange'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='orange'>" + locale.colours.orange + "</a></li>" +
|
||||
"</ul>" +
|
||||
"</li>";
|
||||
}
|
||||
};
|
||||
|
||||
var templates = function(key, locale, options) {
|
||||
return tpl[key](locale, options);
|
||||
};
|
||||
|
||||
|
||||
var Wysihtml5 = function(el, options) {
|
||||
this.el = el;
|
||||
var toolbarOpts = options || defaultOptions;
|
||||
for(var t in toolbarOpts.customTemplates) {
|
||||
tpl[t] = toolbarOpts.customTemplates[t];
|
||||
}
|
||||
this.toolbar = this.createToolbar(el, toolbarOpts);
|
||||
this.editor = this.createEditor(options);
|
||||
|
||||
window.editor = this.editor;
|
||||
|
||||
$('iframe.wysihtml5-sandbox').each(function(i, el){
|
||||
$(el.contentWindow).off('focus.wysihtml5').on({
|
||||
'focus.wysihtml5' : function(){
|
||||
$('li.dropdown').removeClass('open');
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Wysihtml5.prototype = {
|
||||
|
||||
constructor: Wysihtml5,
|
||||
|
||||
createEditor: function(options) {
|
||||
options = options || {};
|
||||
|
||||
// Add the toolbar to a clone of the options object so multiple instances
|
||||
// of the WYISYWG don't break because "toolbar" is already defined
|
||||
options = $.extend(true, {}, options);
|
||||
options.toolbar = this.toolbar[0];
|
||||
|
||||
var editor = new wysi.Editor(this.el[0], options);
|
||||
|
||||
if(options && options.events) {
|
||||
for(var eventName in options.events) {
|
||||
editor.on(eventName, options.events[eventName]);
|
||||
}
|
||||
}
|
||||
return editor;
|
||||
},
|
||||
|
||||
createToolbar: function(el, options) {
|
||||
var self = this;
|
||||
var toolbar = $("<ul/>", {
|
||||
'class' : "wysihtml5-toolbar",
|
||||
'style': "display:none"
|
||||
});
|
||||
var culture = options.locale || defaultOptions.locale || "en";
|
||||
for(var key in defaultOptions) {
|
||||
var value = false;
|
||||
|
||||
if(options[key] !== undefined) {
|
||||
if(options[key] === true) {
|
||||
value = true;
|
||||
}
|
||||
} else {
|
||||
value = defaultOptions[key];
|
||||
}
|
||||
|
||||
if(value === true) {
|
||||
toolbar.append(templates(key, locale[culture], options));
|
||||
|
||||
if(key === "html") {
|
||||
this.initHtml(toolbar);
|
||||
}
|
||||
|
||||
if(key === "link") {
|
||||
this.initInsertLink(toolbar);
|
||||
}
|
||||
|
||||
if(key === "image") {
|
||||
this.initInsertImage(toolbar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(options.toolbar) {
|
||||
for(key in options.toolbar) {
|
||||
toolbar.append(options.toolbar[key]);
|
||||
}
|
||||
}
|
||||
|
||||
toolbar.find("a[data-wysihtml5-command='formatBlock']").click(function(e) {
|
||||
var target = e.target || e.srcElement;
|
||||
var el = $(target);
|
||||
self.toolbar.find('.current-font').text(el.html());
|
||||
});
|
||||
|
||||
toolbar.find("a[data-wysihtml5-command='foreColor']").click(function(e) {
|
||||
var target = e.target || e.srcElement;
|
||||
var el = $(target);
|
||||
self.toolbar.find('.current-color').text(el.html());
|
||||
});
|
||||
|
||||
this.el.before(toolbar);
|
||||
|
||||
return toolbar;
|
||||
},
|
||||
|
||||
initHtml: function(toolbar) {
|
||||
var changeViewSelector = "a[data-wysihtml5-action='change_view']";
|
||||
toolbar.find(changeViewSelector).click(function(e) {
|
||||
toolbar.find('a.btn').not(changeViewSelector).toggleClass('disabled');
|
||||
});
|
||||
},
|
||||
|
||||
initInsertImage: function(toolbar) {
|
||||
var self = this;
|
||||
var insertImageModal = toolbar.find('.bootstrap-wysihtml5-insert-image-modal');
|
||||
var urlInput = insertImageModal.find('.bootstrap-wysihtml5-insert-image-url');
|
||||
var insertButton = insertImageModal.find('a.btn-primary');
|
||||
var initialValue = urlInput.val();
|
||||
var caretBookmark;
|
||||
|
||||
var insertImage = function() {
|
||||
var url = urlInput.val();
|
||||
urlInput.val(initialValue);
|
||||
self.editor.currentView.element.focus();
|
||||
if (caretBookmark) {
|
||||
self.editor.composer.selection.setBookmark(caretBookmark);
|
||||
caretBookmark = null;
|
||||
}
|
||||
self.editor.composer.commands.exec("insertImage", url);
|
||||
};
|
||||
|
||||
urlInput.keypress(function(e) {
|
||||
if(e.which == 13) {
|
||||
insertImage();
|
||||
insertImageModal.modal('hide');
|
||||
}
|
||||
});
|
||||
|
||||
insertButton.click(insertImage);
|
||||
|
||||
insertImageModal.on('shown', function() {
|
||||
urlInput.focus();
|
||||
});
|
||||
|
||||
insertImageModal.on('hide', function() {
|
||||
self.editor.currentView.element.focus();
|
||||
});
|
||||
|
||||
toolbar.find('a[data-wysihtml5-command=insertImage]').click(function() {
|
||||
var activeButton = $(this).hasClass("wysihtml5-command-active");
|
||||
|
||||
if (!activeButton) {
|
||||
self.editor.currentView.element.focus(false);
|
||||
caretBookmark = self.editor.composer.selection.getBookmark();
|
||||
insertImageModal.appendTo('body').modal('show');
|
||||
insertImageModal.on('click.dismiss.modal', '[data-dismiss="modal"]', function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
initInsertLink: function(toolbar) {
|
||||
var self = this;
|
||||
var insertLinkModal = toolbar.find('.bootstrap-wysihtml5-insert-link-modal');
|
||||
var urlInput = insertLinkModal.find('.bootstrap-wysihtml5-insert-link-url');
|
||||
var insertButton = insertLinkModal.find('a.btn-primary');
|
||||
var initialValue = urlInput.val();
|
||||
var caretBookmark;
|
||||
|
||||
var insertLink = function() {
|
||||
var url = urlInput.val();
|
||||
urlInput.val(initialValue);
|
||||
self.editor.currentView.element.focus();
|
||||
if (caretBookmark) {
|
||||
self.editor.composer.selection.setBookmark(caretBookmark);
|
||||
caretBookmark = null;
|
||||
}
|
||||
self.editor.composer.commands.exec("createLink", {
|
||||
href: url,
|
||||
target: "_blank",
|
||||
rel: "nofollow"
|
||||
});
|
||||
};
|
||||
var pressedEnter = false;
|
||||
|
||||
urlInput.keypress(function(e) {
|
||||
if(e.which == 13) {
|
||||
insertLink();
|
||||
insertLinkModal.modal('hide');
|
||||
}
|
||||
});
|
||||
|
||||
insertButton.click(insertLink);
|
||||
|
||||
insertLinkModal.on('shown', function() {
|
||||
urlInput.focus();
|
||||
});
|
||||
|
||||
insertLinkModal.on('hide', function() {
|
||||
self.editor.currentView.element.focus();
|
||||
});
|
||||
|
||||
toolbar.find('a[data-wysihtml5-command=createLink]').click(function() {
|
||||
var activeButton = $(this).hasClass("wysihtml5-command-active");
|
||||
|
||||
if (!activeButton) {
|
||||
self.editor.currentView.element.focus(false);
|
||||
caretBookmark = self.editor.composer.selection.getBookmark();
|
||||
insertLinkModal.appendTo('body').modal('show');
|
||||
insertLinkModal.on('click.dismiss.modal', '[data-dismiss="modal"]', function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// these define our public api
|
||||
var methods = {
|
||||
resetDefaults: function() {
|
||||
$.fn.wysihtml5.defaultOptions = $.extend(true, {}, $.fn.wysihtml5.defaultOptionsCache);
|
||||
},
|
||||
bypassDefaults: function(options) {
|
||||
return this.each(function () {
|
||||
var $this = $(this);
|
||||
$this.data('wysihtml5', new Wysihtml5($this, options));
|
||||
});
|
||||
},
|
||||
shallowExtend: function (options) {
|
||||
var settings = $.extend({}, $.fn.wysihtml5.defaultOptions, options || {});
|
||||
var that = this;
|
||||
return methods.bypassDefaults.apply(that, [settings]);
|
||||
},
|
||||
deepExtend: function(options) {
|
||||
var settings = $.extend(true, {}, $.fn.wysihtml5.defaultOptions, options || {});
|
||||
var that = this;
|
||||
return methods.bypassDefaults.apply(that, [settings]);
|
||||
},
|
||||
init: function(options) {
|
||||
var that = this;
|
||||
return methods.shallowExtend.apply(that, [options]);
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.wysihtml5 = function ( method ) {
|
||||
if ( methods[method] ) {
|
||||
return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
|
||||
} else if ( typeof method === 'object' || ! method ) {
|
||||
return methods.init.apply( this, arguments );
|
||||
} else {
|
||||
$.error( 'Method ' + method + ' does not exist on jQuery.wysihtml5' );
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.wysihtml5.Constructor = Wysihtml5;
|
||||
|
||||
var defaultOptions = $.fn.wysihtml5.defaultOptions = {
|
||||
"font-styles": true,
|
||||
"color": false,
|
||||
"emphasis": true,
|
||||
"lists": true,
|
||||
"html": false,
|
||||
"link": true,
|
||||
"image": true,
|
||||
events: {},
|
||||
parserRules: {
|
||||
classes: {
|
||||
// (path_to_project/lib/css/wysiwyg-color.css)
|
||||
"wysiwyg-color-silver" : 1,
|
||||
"wysiwyg-color-gray" : 1,
|
||||
"wysiwyg-color-white" : 1,
|
||||
"wysiwyg-color-maroon" : 1,
|
||||
"wysiwyg-color-red" : 1,
|
||||
"wysiwyg-color-purple" : 1,
|
||||
"wysiwyg-color-fuchsia" : 1,
|
||||
"wysiwyg-color-green" : 1,
|
||||
"wysiwyg-color-lime" : 1,
|
||||
"wysiwyg-color-olive" : 1,
|
||||
"wysiwyg-color-yellow" : 1,
|
||||
"wysiwyg-color-navy" : 1,
|
||||
"wysiwyg-color-blue" : 1,
|
||||
"wysiwyg-color-teal" : 1,
|
||||
"wysiwyg-color-aqua" : 1,
|
||||
"wysiwyg-color-orange" : 1
|
||||
},
|
||||
tags: {
|
||||
"b": {},
|
||||
"i": {},
|
||||
"br": {},
|
||||
"ol": {},
|
||||
"ul": {},
|
||||
"li": {},
|
||||
"h1": {},
|
||||
"h2": {},
|
||||
"h3": {},
|
||||
"blockquote": {},
|
||||
"u": 1,
|
||||
"img": {
|
||||
"check_attributes": {
|
||||
"width": "numbers",
|
||||
"alt": "alt",
|
||||
"src": "url",
|
||||
"height": "numbers"
|
||||
}
|
||||
},
|
||||
"a": {
|
||||
set_attributes: {
|
||||
target: "_blank",
|
||||
rel: "nofollow"
|
||||
},
|
||||
check_attributes: {
|
||||
href: "url" // important to avoid XSS
|
||||
}
|
||||
},
|
||||
"span": 1,
|
||||
"div": 1,
|
||||
// to allow save and edit files with code tag hacks
|
||||
"code": 1,
|
||||
"pre": 1
|
||||
}
|
||||
},
|
||||
stylesheets: ["./lib/css/wysiwyg-color.css"], // (path_to_project/lib/css/wysiwyg-color.css)
|
||||
locale: "en"
|
||||
};
|
||||
|
||||
if (typeof $.fn.wysihtml5.defaultOptionsCache === 'undefined') {
|
||||
$.fn.wysihtml5.defaultOptionsCache = $.extend(true, {}, $.fn.wysihtml5.defaultOptions);
|
||||
}
|
||||
|
||||
var locale = $.fn.wysihtml5.locale = {
|
||||
en: {
|
||||
font_styles: {
|
||||
normal: "Normal text",
|
||||
h1: "Heading 1",
|
||||
h2: "Heading 2",
|
||||
h3: "Heading 3"
|
||||
},
|
||||
emphasis: {
|
||||
bold: "Bold",
|
||||
italic: "Italic",
|
||||
underline: "Underline"
|
||||
},
|
||||
lists: {
|
||||
unordered: "Unordered list",
|
||||
ordered: "Ordered list",
|
||||
outdent: "Outdent",
|
||||
indent: "Indent"
|
||||
},
|
||||
link: {
|
||||
insert: "Insert link",
|
||||
cancel: "Cancel"
|
||||
},
|
||||
image: {
|
||||
insert: "Insert image",
|
||||
cancel: "Cancel"
|
||||
},
|
||||
html: {
|
||||
edit: "Edit HTML"
|
||||
},
|
||||
colours: {
|
||||
black: "Black",
|
||||
silver: "Silver",
|
||||
gray: "Grey",
|
||||
maroon: "Maroon",
|
||||
red: "Red",
|
||||
purple: "Purple",
|
||||
green: "Green",
|
||||
olive: "Olive",
|
||||
navy: "Navy",
|
||||
blue: "Blue",
|
||||
orange: "Orange"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}(window.jQuery, window.wysihtml5);
|
1
dist/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/bootstrap-wysihtml5-0.0.2.min.js
vendored
Normal file
9521
dist/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/wysihtml5-0.3.0.js
vendored
Normal file
261
dist/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/wysihtml5-0.3.0.min.js
vendored
Normal file
@ -0,0 +1,261 @@
|
||||
/*
|
||||
wysihtml5 v0.3.0
|
||||
https://github.com/xing/wysihtml5
|
||||
|
||||
Author: Christopher Blum (https://github.com/tiff)
|
||||
|
||||
Copyright (C) 2012 XING AG
|
||||
Licensed under the MIT license (MIT)
|
||||
|
||||
Rangy, a cross-browser JavaScript range and selection library
|
||||
http://code.google.com/p/rangy/
|
||||
|
||||
Copyright 2011, Tim Down
|
||||
Licensed under the MIT license.
|
||||
Version: 1.2.2
|
||||
Build date: 13 November 2011
|
||||
*/
|
||||
var wysihtml5={version:"0.3.0",commands:{},dom:{},quirks:{},toolbar:{},lang:{},selection:{},views:{},INVISIBLE_SPACE:"\ufeff",EMPTY_FUNCTION:function(){},ELEMENT_NODE:1,TEXT_NODE:3,BACKSPACE_KEY:8,ENTER_KEY:13,ESCAPE_KEY:27,SPACE_KEY:32,DELETE_KEY:46};
|
||||
window.rangy=function(){function b(a,b){var c=typeof a[b];return c==k||!!(c==h&&a[b])||"unknown"==c}function c(a,b){return!!(typeof a[b]==h&&a[b])}function a(a,b){return typeof a[b]!=j}function d(a){return function(b,c){for(var d=c.length;d--;)if(!a(b,c[d]))return!1;return!0}}function e(a){return a&&m(a,r)&&x(a,q)}function f(a){window.alert("Rangy not supported in your browser. Reason: "+a);o.initialized=!0;o.supported=!1}function g(){if(!o.initialized){var a,d=!1,h=!1;b(document,"createRange")&&
|
||||
(a=document.createRange(),m(a,p)&&x(a,n)&&(d=!0),a.detach());if((a=c(document,"body")?document.body:document.getElementsByTagName("body")[0])&&b(a,"createTextRange"))a=a.createTextRange(),e(a)&&(h=!0);!d&&!h&&f("Neither Range nor TextRange are implemented");o.initialized=!0;o.features={implementsDomRange:d,implementsTextRange:h};d=w.concat(z);h=0;for(a=d.length;h<a;++h)try{d[h](o)}catch(j){c(window,"console")&&b(window.console,"log")&&window.console.log("Init listener threw an exception. Continuing.",
|
||||
j)}}}function i(a){this.name=a;this.supported=this.initialized=!1}var h="object",k="function",j="undefined",n="startContainer startOffset endContainer endOffset collapsed commonAncestorContainer START_TO_START START_TO_END END_TO_START END_TO_END".split(" "),p="setStart setStartBefore setStartAfter setEnd setEndBefore setEndAfter collapse selectNode selectNodeContents compareBoundaryPoints deleteContents extractContents cloneContents insertNode surroundContents cloneRange toString detach".split(" "),
|
||||
q="boundingHeight boundingLeft boundingTop boundingWidth htmlText text".split(" "),r="collapse compareEndPoints duplicate getBookmark moveToBookmark moveToElementText parentElement pasteHTML select setEndPoint getBoundingClientRect".split(" "),m=d(b),s=d(c),x=d(a),o={version:"1.2.2",initialized:!1,supported:!0,util:{isHostMethod:b,isHostObject:c,isHostProperty:a,areHostMethods:m,areHostObjects:s,areHostProperties:x,isTextRange:e},features:{},modules:{},config:{alertOnWarn:!1,preferTextRange:!1}};
|
||||
o.fail=f;o.warn=function(a){a="Rangy warning: "+a;o.config.alertOnWarn?window.alert(a):typeof window.console!=j&&typeof window.console.log!=j&&window.console.log(a)};({}).hasOwnProperty?o.util.extend=function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}:f("hasOwnProperty not supported");var z=[],w=[];o.init=g;o.addInitListener=function(a){o.initialized?a(o):z.push(a)};var y=[];o.addCreateMissingNativeApiListener=function(a){y.push(a)};o.createMissingNativeApi=function(a){a=a||window;g();
|
||||
for(var b=0,c=y.length;b<c;++b)y[b](a)};i.prototype.fail=function(a){this.initialized=!0;this.supported=!1;throw Error("Module '"+this.name+"' failed to load: "+a);};i.prototype.warn=function(a){o.warn("Module "+this.name+": "+a)};i.prototype.createError=function(a){return Error("Error in Rangy "+this.name+" module: "+a)};o.createModule=function(a,b){var c=new i(a);o.modules[a]=c;w.push(function(a){b(a,c);c.initialized=!0;c.supported=!0})};o.requireModules=function(a){for(var b=0,c=a.length,d,h;b<
|
||||
c;++b){h=a[b];d=o.modules[h];if(!d||!(d instanceof i))throw Error("Module '"+h+"' not found");if(!d.supported)throw Error("Module '"+h+"' not supported");}};var A=!1,s=function(){A||(A=!0,o.initialized||g())};if(typeof window==j)f("No window found");else if(typeof document==j)f("No document found");else return b(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",s,!1),b(window,"addEventListener")?window.addEventListener("load",s,!1):b(window,"attachEvent")?window.attachEvent("onload",
|
||||
s):f("Window does not have required addEventListener or attachEvent method"),o}();
|
||||
rangy.createModule("DomUtil",function(b,c){function a(a){for(var b=0;a=a.previousSibling;)b++;return b}function d(a,b){var c=[],d;for(d=a;d;d=d.parentNode)c.push(d);for(d=b;d;d=d.parentNode)if(m(c,d))return d;return null}function e(a,b,c){for(c=c?a:a.parentNode;c;){a=c.parentNode;if(a===b)return c;c=a}return null}function f(a){a=a.nodeType;return 3==a||4==a||8==a}function g(a,b){var c=b.nextSibling,d=b.parentNode;c?d.insertBefore(a,c):d.appendChild(a);return a}function i(a){if(9==a.nodeType)return a;
|
||||
if(typeof a.ownerDocument!=p)return a.ownerDocument;if(typeof a.document!=p)return a.document;if(a.parentNode)return i(a.parentNode);throw Error("getDocument: no document found for node");}function h(a){return!a?"[No node]":f(a)?'"'+a.data+'"':1==a.nodeType?"<"+a.nodeName+(a.id?' id="'+a.id+'"':"")+">["+a.childNodes.length+"]":a.nodeName}function k(a){this._next=this.root=a}function j(a,b){this.node=a;this.offset=b}function n(a){this.code=this[a];this.codeName=a;this.message="DOMException: "+this.codeName}
|
||||
var p="undefined",q=b.util;q.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||c.fail("document missing a Node creation method");q.isHostMethod(document,"getElementsByTagName")||c.fail("document missing getElementsByTagName method");var r=document.createElement("div");q.areHostMethods(r,["insertBefore","appendChild","cloneNode"])||c.fail("Incomplete Element implementation");q.isHostProperty(r,"innerHTML")||c.fail("Element is missing innerHTML property");r=document.createTextNode("test");
|
||||
q.areHostMethods(r,["splitText","deleteData","insertData","appendData","cloneNode"])||c.fail("Incomplete Text Node implementation");var m=function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1};k.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a=this._current=this._next,b;if(this._current){b=a.firstChild;if(!b)for(b=null;a!==this.root&&!(b=a.nextSibling);)a=a.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root=
|
||||
null}};j.prototype={equals:function(a){return this.node===a.node&this.offset==a.offset},inspect:function(){return"[DomPosition("+h(this.node)+":"+this.offset+")]"}};n.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11};n.prototype.toString=function(){return this.message};b.dom={arrayContains:m,isHtmlNamespace:function(a){var b;return typeof a.namespaceURI==p||null===(b=a.namespaceURI)||"http://www.w3.org/1999/xhtml"==
|
||||
b},parentElement:function(a){a=a.parentNode;return 1==a.nodeType?a:null},getNodeIndex:a,getNodeLength:function(a){var b;return f(a)?a.length:(b=a.childNodes)?b.length:0},getCommonAncestor:d,isAncestorOf:function(a,b,c){for(b=c?b:b.parentNode;b;){if(b===a)return!0;b=b.parentNode}return!1},getClosestAncestorIn:e,isCharacterDataNode:f,insertAfter:g,splitDataNode:function(a,b){var c=a.cloneNode(!1);c.deleteData(0,b);a.deleteData(b,a.length-b);g(c,a);return c},getDocument:i,getWindow:function(a){a=i(a);
|
||||
if(typeof a.defaultView!=p)return a.defaultView;if(typeof a.parentWindow!=p)return a.parentWindow;throw Error("Cannot get a window object for node");},getIframeWindow:function(a){if(typeof a.contentWindow!=p)return a.contentWindow;if(typeof a.contentDocument!=p)return a.contentDocument.defaultView;throw Error("getIframeWindow: No Window object found for iframe element");},getIframeDocument:function(a){if(typeof a.contentDocument!=p)return a.contentDocument;if(typeof a.contentWindow!=p)return a.contentWindow.document;
|
||||
throw Error("getIframeWindow: No Document object found for iframe element");},getBody:function(a){return q.isHostObject(a,"body")?a.body:a.getElementsByTagName("body")[0]},getRootContainer:function(a){for(var b;b=a.parentNode;)a=b;return a},comparePoints:function(b,c,h,j){var k;if(b==h)return c===j?0:c<j?-1:1;if(k=e(h,b,!0))return c<=a(k)?-1:1;if(k=e(b,h,!0))return a(k)<j?-1:1;c=d(b,h);b=b===c?c:e(b,c,!0);h=h===c?c:e(h,c,!0);if(b===h)throw Error("comparePoints got to case 4 and childA and childB are the same!");
|
||||
for(c=c.firstChild;c;){if(c===b)return-1;if(c===h)return 1;c=c.nextSibling}throw Error("Should not be here!");},inspectNode:h,fragmentFromNodeChildren:function(a){for(var b=i(a).createDocumentFragment(),c;c=a.firstChild;)b.appendChild(c);return b},createIterator:function(a){return new k(a)},DomPosition:j};b.DOMException=n});
|
||||
rangy.createModule("DomRange",function(b){function c(a,b){return 3!=a.nodeType&&(l.isAncestorOf(a,b.startContainer,!0)||l.isAncestorOf(a,b.endContainer,!0))}function a(a){return l.getDocument(a.startContainer)}function d(a,b,c){if(b=a._listeners[b])for(var d=0,h=b.length;d<h;++d)b[d].call(a,{target:a,args:c})}function e(a){return new u(a.parentNode,l.getNodeIndex(a))}function f(a){return new u(a.parentNode,l.getNodeIndex(a)+1)}function g(a,b,c){var d=11==a.nodeType?a.firstChild:a;l.isCharacterDataNode(b)?
|
||||
c==b.length?l.insertAfter(a,b):b.parentNode.insertBefore(a,0==c?b:l.splitDataNode(b,c)):c>=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[c]);return d}function i(b){for(var c,d,h=a(b.range).createDocumentFragment();d=b.next();){c=b.isPartiallySelectedSubtree();d=d.cloneNode(!c);c&&(c=b.getSubtreeIterator(),d.appendChild(i(c)),c.detach(!0));if(10==d.nodeType)throw new B("HIERARCHY_REQUEST_ERR");h.appendChild(d)}return h}function h(a,b,c){for(var d,e,c=c||{stop:!1};d=a.next();)if(a.isPartiallySelectedSubtree())if(!1===
|
||||
b(d)){c.stop=!0;break}else{if(d=a.getSubtreeIterator(),h(d,b,c),d.detach(!0),c.stop)break}else for(d=l.createIterator(d);e=d.next();)if(!1===b(e)){c.stop=!0;return}}function k(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),k(b),b.detach(!0)):a.remove()}function j(b){for(var c,d=a(b.range).createDocumentFragment(),h;c=b.next();){b.isPartiallySelectedSubtree()?(c=c.cloneNode(!1),h=b.getSubtreeIterator(),c.appendChild(j(h)),h.detach(!0)):b.remove();if(10==c.nodeType)throw new B("HIERARCHY_REQUEST_ERR");
|
||||
d.appendChild(c)}return d}function n(a,b,c){var d=!(!b||!b.length),e,j=!!c;d&&(e=RegExp("^("+b.join("|")+")$"));var k=[];h(new q(a,!1),function(a){(!d||e.test(a.nodeType))&&(!j||c(a))&&k.push(a)});return k}function p(a){return"["+("undefined"==typeof a.getName?"Range":a.getName())+"("+l.inspectNode(a.startContainer)+":"+a.startOffset+", "+l.inspectNode(a.endContainer)+":"+a.endOffset+")]"}function q(a,b){this.range=a;this.clonePartiallySelectedTextNodes=b;if(!a.collapsed){this.sc=a.startContainer;
|
||||
this.so=a.startOffset;this.ec=a.endContainer;this.eo=a.endOffset;var c=a.commonAncestorContainer;this.sc===this.ec&&l.isCharacterDataNode(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc===c&&!l.isCharacterDataNode(this.sc)?this.sc.childNodes[this.so]:l.getClosestAncestorIn(this.sc,c,!0),this._last=this.ec===c&&!l.isCharacterDataNode(this.ec)?this.ec.childNodes[this.eo-1]:l.getClosestAncestorIn(this.ec,c,!0))}}function r(a){this.code=
|
||||
this[a];this.codeName=a;this.message="RangeException: "+this.codeName}function m(a,b,c){this.nodes=n(a,b,c);this._next=this.nodes[0];this._position=0}function s(a){return function(b,c){for(var d,h=c?b:b.parentNode;h;){d=h.nodeType;if(l.arrayContains(a,d))return h;h=h.parentNode}return null}}function x(a,b){if($(a,b))throw new r("INVALID_NODE_TYPE_ERR");}function o(a){if(!a.startContainer)throw new B("INVALID_STATE_ERR");}function z(a,b){if(!l.arrayContains(b,a.nodeType))throw new r("INVALID_NODE_TYPE_ERR");
|
||||
}function w(a,b){if(0>b||b>(l.isCharacterDataNode(a)?a.length:a.childNodes.length))throw new B("INDEX_SIZE_ERR");}function y(a,b){if(O(a,!0)!==O(b,!0))throw new B("WRONG_DOCUMENT_ERR");}function A(a){if(aa(a,!0))throw new B("NO_MODIFICATION_ALLOWED_ERR");}function t(a,b){if(!a)throw new B(b);}function v(a){o(a);if(!l.arrayContains(G,a.startContainer.nodeType)&&!O(a.startContainer,!0)||!l.arrayContains(G,a.endContainer.nodeType)&&!O(a.endContainer,!0)||!(a.startOffset<=(l.isCharacterDataNode(a.startContainer)?
|
||||
a.startContainer.length:a.startContainer.childNodes.length))||!(a.endOffset<=(l.isCharacterDataNode(a.endContainer)?a.endContainer.length:a.endContainer.childNodes.length)))throw Error("Range error: Range is no longer valid after DOM mutation ("+a.inspect()+")");}function D(){}function K(a){a.START_TO_START=Q;a.START_TO_END=U;a.END_TO_END=ba;a.END_TO_START=V;a.NODE_BEFORE=W;a.NODE_AFTER=X;a.NODE_BEFORE_AND_AFTER=Y;a.NODE_INSIDE=R}function F(a){K(a);K(a.prototype)}function E(a,b){return function(){v(this);
|
||||
var c=this.startContainer,d=this.startOffset,e=this.commonAncestorContainer,j=new q(this,!0);c!==e&&(c=l.getClosestAncestorIn(c,e,!0),d=f(c),c=d.node,d=d.offset);h(j,A);j.reset();e=a(j);j.detach();b(this,c,d,c,d);return e}}function I(a,d,h){function g(a,b){return function(c){o(this);z(c,L);z(M(c),G);c=(a?e:f)(c);(b?i:n)(this,c.node,c.offset)}}function i(a,b,c){var h=a.endContainer,e=a.endOffset;if(b!==a.startContainer||c!==a.startOffset){if(M(b)!=M(h)||1==l.comparePoints(b,c,h,e))h=b,e=c;d(a,b,c,
|
||||
h,e)}}function n(a,b,c){var h=a.startContainer,e=a.startOffset;if(b!==a.endContainer||c!==a.endOffset){if(M(b)!=M(h)||-1==l.comparePoints(b,c,h,e))h=b,e=c;d(a,h,e,b,c)}}a.prototype=new D;b.util.extend(a.prototype,{setStart:function(a,b){o(this);x(a,!0);w(a,b);i(this,a,b)},setEnd:function(a,b){o(this);x(a,!0);w(a,b);n(this,a,b)},setStartBefore:g(!0,!0),setStartAfter:g(!1,!0),setEndBefore:g(!0,!1),setEndAfter:g(!1,!1),collapse:function(a){v(this);a?d(this,this.startContainer,this.startOffset,this.startContainer,
|
||||
this.startOffset):d(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){o(this);x(a,!0);d(this,a,0,a,l.getNodeLength(a))},selectNode:function(a){o(this);x(a,!1);z(a,L);var b=e(a),a=f(a);d(this,b.node,b.offset,a.node,a.offset)},extractContents:E(j,d),deleteContents:E(k,d),canSurroundContents:function(){v(this);A(this.startContainer);A(this.endContainer);var a=new q(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);a.detach();return!b},
|
||||
detach:function(){h(this)},splitBoundaries:function(){v(this);var a=this.startContainer,b=this.startOffset,c=this.endContainer,h=this.endOffset,e=a===c;l.isCharacterDataNode(c)&&(0<h&&h<c.length)&&l.splitDataNode(c,h);l.isCharacterDataNode(a)&&(0<b&&b<a.length)&&(a=l.splitDataNode(a,b),e?(h-=b,c=a):c==a.parentNode&&h>=l.getNodeIndex(a)&&h++,b=0);d(this,a,b,c,h)},normalizeBoundaries:function(){v(this);var a=this.startContainer,b=this.startOffset,c=this.endContainer,h=this.endOffset,e=function(a){var b=
|
||||
a.nextSibling;b&&b.nodeType==a.nodeType&&(c=a,h=a.length,a.appendData(b.data),b.parentNode.removeChild(b))},j=function(d){var e=d.previousSibling;if(e&&e.nodeType==d.nodeType){a=d;var j=d.length;b=e.length;d.insertData(0,e.data);e.parentNode.removeChild(e);a==c?(h+=b,c=a):c==d.parentNode&&(e=l.getNodeIndex(d),h==e?(c=d,h=j):h>e&&h--)}},k=!0;l.isCharacterDataNode(c)?c.length==h&&e(c):(0<h&&(k=c.childNodes[h-1])&&l.isCharacterDataNode(k)&&e(k),k=!this.collapsed);k?l.isCharacterDataNode(a)?0==b&&j(a):
|
||||
b<a.childNodes.length&&(e=a.childNodes[b])&&l.isCharacterDataNode(e)&&j(e):(a=c,b=h);d(this,a,b,c,h)},collapseToPoint:function(a,b){o(this);x(a,!0);w(a,b);(a!==this.startContainer||b!==this.startOffset||a!==this.endContainer||b!==this.endOffset)&&d(this,a,b,a,b)}});F(a)}function N(a){a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset;a.commonAncestorContainer=a.collapsed?a.startContainer:l.getCommonAncestor(a.startContainer,a.endContainer)}function J(a,b,c,h,e){var j=a.startContainer!==
|
||||
b||a.startOffset!==c,k=a.endContainer!==h||a.endOffset!==e;a.startContainer=b;a.startOffset=c;a.endContainer=h;a.endOffset=e;N(a);d(a,"boundarychange",{startMoved:j,endMoved:k})}function C(a){this.startContainer=a;this.startOffset=0;this.endContainer=a;this.endOffset=0;this._listeners={boundarychange:[],detach:[]};N(this)}b.requireModules(["DomUtil"]);var l=b.dom,u=l.DomPosition,B=b.DOMException;q.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current=
|
||||
null;this._next=this._first},hasNext:function(){return!!this._next},next:function(){var a=this._current=this._next;a&&(this._next=a!==this._last?a.nextSibling:null,l.isCharacterDataNode(a)&&this.clonePartiallySelectedTextNodes&&(a===this.ec&&(a=a.cloneNode(!0)).deleteData(this.eo,a.length-this.eo),this._current===this.sc&&(a=a.cloneNode(!0)).deleteData(0,this.so)));return a},remove:function(){var a=this._current,b,c;l.isCharacterDataNode(a)&&(a===this.sc||a===this.ec)?(b=a===this.sc?this.so:0,c=a===
|
||||
this.ec?this.eo:a.length,b!=c&&a.deleteData(b,c-b)):a.parentNode&&a.parentNode.removeChild(a)},isPartiallySelectedSubtree:function(){return c(this._current,this.range)},getSubtreeIterator:function(){var b;if(this.isSingleCharacterDataNode)b=this.range.cloneRange(),b.collapse();else{b=new C(a(this.range));var c=this._current,d=c,h=0,e=c,j=l.getNodeLength(c);l.isAncestorOf(c,this.sc,!0)&&(d=this.sc,h=this.so);l.isAncestorOf(c,this.ec,!0)&&(e=this.ec,j=this.eo);J(b,d,h,e,j)}return new q(b,this.clonePartiallySelectedTextNodes)},
|
||||
detach:function(a){a&&this.range.detach();this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};r.prototype={BAD_BOUNDARYPOINTS_ERR:1,INVALID_NODE_TYPE_ERR:2};r.prototype.toString=function(){return this.message};m.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){this._current=this._next;this._next=this.nodes[++this._position];return this._current},detach:function(){this._current=this._next=this.nodes=null}};var L=[1,3,4,5,
|
||||
7,8,10],G=[2,9,11],P=[1,3,4,5,7,8,10,11],H=[1,3,4,5,7,8],M=l.getRootContainer,O=s([9,11]),aa=s([5,6,10,12]),$=s([6,10,12]),Z=document.createElement("style"),S=!1;try{Z.innerHTML="<b>x</b>",S=3==Z.firstChild.nodeType}catch(ca){}b.features.htmlParsingConforms=S;var T="startContainer startOffset endContainer endOffset collapsed commonAncestorContainer".split(" "),Q=0,U=1,ba=2,V=3,W=0,X=1,Y=2,R=3;D.prototype={attachListener:function(a,b){this._listeners[a].push(b)},compareBoundaryPoints:function(a,b){v(this);
|
||||
y(this.startContainer,b.startContainer);var c=a==V||a==Q?"start":"end",d=a==U||a==Q?"start":"end";return l.comparePoints(this[c+"Container"],this[c+"Offset"],b[d+"Container"],b[d+"Offset"])},insertNode:function(a){v(this);z(a,P);A(this.startContainer);if(l.isAncestorOf(a,this.startContainer,!0))throw new B("HIERARCHY_REQUEST_ERR");this.setStartBefore(g(a,this.startContainer,this.startOffset))},cloneContents:function(){v(this);var b,c;if(this.collapsed)return a(this).createDocumentFragment();if(this.startContainer===
|
||||
this.endContainer&&l.isCharacterDataNode(this.startContainer))return b=this.startContainer.cloneNode(!0),b.data=b.data.slice(this.startOffset,this.endOffset),c=a(this).createDocumentFragment(),c.appendChild(b),c;c=new q(this,!0);b=i(c);c.detach();return b},canSurroundContents:function(){v(this);A(this.startContainer);A(this.endContainer);var a=new q(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);a.detach();return!b},surroundContents:function(a){z(a,H);if(!this.canSurroundContents())throw new r("BAD_BOUNDARYPOINTS_ERR");
|
||||
var b=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);g(a,this.startContainer,this.startOffset);a.appendChild(b);this.selectNode(a)},cloneRange:function(){v(this);for(var b=new C(a(this)),c=T.length,d;c--;)d=T[c],b[d]=this[d];return b},toString:function(){v(this);var a=this.startContainer;if(a===this.endContainer&&l.isCharacterDataNode(a))return 3==a.nodeType||4==a.nodeType?a.data.slice(this.startOffset,this.endOffset):"";var b=[],a=new q(this,!0);h(a,function(a){(3==
|
||||
a.nodeType||4==a.nodeType)&&b.push(a.data)});a.detach();return b.join("")},compareNode:function(a){v(this);var b=a.parentNode,c=l.getNodeIndex(a);if(!b)throw new B("NOT_FOUND_ERR");a=this.comparePoint(b,c);b=this.comparePoint(b,c+1);return 0>a?0<b?Y:W:0<b?X:R},comparePoint:function(a,b){v(this);t(a,"HIERARCHY_REQUEST_ERR");y(a,this.startContainer);return 0>l.comparePoints(a,b,this.startContainer,this.startOffset)?-1:0<l.comparePoints(a,b,this.endContainer,this.endOffset)?1:0},createContextualFragment:S?
|
||||
function(a){var b=this.startContainer,c=l.getDocument(b);if(!b)throw new B("INVALID_STATE_ERR");var d=null;1==b.nodeType?d=b:l.isCharacterDataNode(b)&&(d=l.parentElement(b));d=null===d||"HTML"==d.nodeName&&l.isHtmlNamespace(l.getDocument(d).documentElement)&&l.isHtmlNamespace(d)?c.createElement("body"):d.cloneNode(!1);d.innerHTML=a;return l.fragmentFromNodeChildren(d)}:function(b){o(this);var c=a(this).createElement("body");c.innerHTML=b;return l.fragmentFromNodeChildren(c)},toHtml:function(){v(this);
|
||||
var b=a(this).createElement("div");b.appendChild(this.cloneContents());return b.innerHTML},intersectsNode:function(b,c){v(this);t(b,"NOT_FOUND_ERR");if(l.getDocument(b)!==a(this))return!1;var d=b.parentNode,h=l.getNodeIndex(b);t(d,"NOT_FOUND_ERR");var e=l.comparePoints(d,h,this.endContainer,this.endOffset),d=l.comparePoints(d,h+1,this.startContainer,this.startOffset);return c?0>=e&&0<=d:0>e&&0<d},isPointInRange:function(a,b){v(this);t(a,"HIERARCHY_REQUEST_ERR");y(a,this.startContainer);return 0<=
|
||||
l.comparePoints(a,b,this.startContainer,this.startOffset)&&0>=l.comparePoints(a,b,this.endContainer,this.endOffset)},intersectsRange:function(b,c){v(this);if(a(b)!=a(this))throw new B("WRONG_DOCUMENT_ERR");var d=l.comparePoints(this.startContainer,this.startOffset,b.endContainer,b.endOffset),h=l.comparePoints(this.endContainer,this.endOffset,b.startContainer,b.startOffset);return c?0>=d&&0<=h:0>d&&0<h},intersection:function(a){if(this.intersectsRange(a)){var b=l.comparePoints(this.startContainer,
|
||||
this.startOffset,a.startContainer,a.startOffset),c=l.comparePoints(this.endContainer,this.endOffset,a.endContainer,a.endOffset),d=this.cloneRange();-1==b&&d.setStart(a.startContainer,a.startOffset);1==c&&d.setEnd(a.endContainer,a.endOffset);return d}return null},union:function(a){if(this.intersectsRange(a,!0)){var b=this.cloneRange();-1==l.comparePoints(a.startContainer,a.startOffset,this.startContainer,this.startOffset)&&b.setStart(a.startContainer,a.startOffset);1==l.comparePoints(a.endContainer,
|
||||
a.endOffset,this.endContainer,this.endOffset)&&b.setEnd(a.endContainer,a.endOffset);return b}throw new r("Ranges do not intersect");},containsNode:function(a,b){return b?this.intersectsNode(a,!1):this.compareNode(a)==R},containsNodeContents:function(a){return 0<=this.comparePoint(a,0)&&0>=this.comparePoint(a,l.getNodeLength(a))},containsRange:function(a){return this.intersection(a).equals(a)},containsNodeText:function(a){var b=this.cloneRange();b.selectNode(a);var c=b.getNodes([3]);return 0<c.length?
|
||||
(b.setStart(c[0],0),a=c.pop(),b.setEnd(a,a.length),a=this.containsRange(b),b.detach(),a):this.containsNodeContents(a)},createNodeIterator:function(a,b){v(this);return new m(this,a,b)},getNodes:function(a,b){v(this);return n(this,a,b)},getDocument:function(){return a(this)},collapseBefore:function(a){o(this);this.setEndBefore(a);this.collapse(!1)},collapseAfter:function(a){o(this);this.setStartAfter(a);this.collapse(!0)},getName:function(){return"DomRange"},equals:function(a){return C.rangesEqual(this,
|
||||
a)},inspect:function(){return p(this)}};I(C,J,function(a){o(a);a.startContainer=a.startOffset=a.endContainer=a.endOffset=null;a.collapsed=a.commonAncestorContainer=null;d(a,"detach",null);a._listeners=null});b.rangePrototype=D.prototype;C.rangeProperties=T;C.RangeIterator=q;C.copyComparisonConstants=F;C.createPrototypeRange=I;C.inspect=p;C.getRangeDocument=a;C.rangesEqual=function(a,b){return a.startContainer===b.startContainer&&a.startOffset===b.startOffset&&a.endContainer===b.endContainer&&a.endOffset===
|
||||
b.endOffset};b.DomRange=C;b.RangeException=r});
|
||||
rangy.createModule("WrappedRange",function(b){function c(a,b,c,d){var g=a.duplicate();g.collapse(c);var i=g.parentElement();e.isAncestorOf(b,i,!0)||(i=b);if(!i.canHaveHTML)return new f(i.parentNode,e.getNodeIndex(i));var b=e.getDocument(i).createElement("span"),r,m=c?"StartToStart":"StartToEnd";do i.insertBefore(b,b.previousSibling),g.moveToElementText(b);while(0<(r=g.compareEndPoints(m,a))&&b.previousSibling);m=b.nextSibling;if(-1==r&&m&&e.isCharacterDataNode(m)){g.setEndPoint(c?"EndToStart":"EndToEnd",
|
||||
a);if(/[\r\n]/.test(m.data)){i=g.duplicate();c=i.text.replace(/\r\n/g,"\r").length;for(c=i.moveStart("character",c);-1==i.compareEndPoints("StartToEnd",i);)c++,i.moveStart("character",1)}else c=g.text.length;i=new f(m,c)}else m=(d||!c)&&b.previousSibling,i=(c=(d||c)&&b.nextSibling)&&e.isCharacterDataNode(c)?new f(c,0):m&&e.isCharacterDataNode(m)?new f(m,m.length):new f(i,e.getNodeIndex(b));b.parentNode.removeChild(b);return i}function a(a,b){var c,d,f=a.offset,g=e.getDocument(a.node),i=g.body.createTextRange(),
|
||||
m=e.isCharacterDataNode(a.node);m?(c=a.node,d=c.parentNode):(c=a.node.childNodes,c=f<c.length?c[f]:null,d=a.node);g=g.createElement("span");g.innerHTML="&#feff;";c?d.insertBefore(g,c):d.appendChild(g);i.moveToElementText(g);i.collapse(!b);d.removeChild(g);if(m)i[b?"moveStart":"moveEnd"]("character",f);return i}b.requireModules(["DomUtil","DomRange"]);var d,e=b.dom,f=e.DomPosition,g=b.DomRange;if(b.features.implementsDomRange&&(!b.features.implementsTextRange||!b.config.preferTextRange))(function(){function a(b){for(var c=
|
||||
j.length,d;c--;)d=j[c],b[d]=b.nativeRange[d]}var c,j=g.rangeProperties,f;d=function(b){if(!b)throw Error("Range must be specified");this.nativeRange=b;a(this)};g.createPrototypeRange(d,function(a,b,c,d,h){var e=a.endContainer!==d||a.endOffset!=h;if(a.startContainer!==b||a.startOffset!=c||e)a.setEnd(d,h),a.setStart(b,c)},function(a){a.nativeRange.detach();a.detached=!0;for(var b=j.length,c;b--;)c=j[b],a[c]=null});c=d.prototype;c.selectNode=function(b){this.nativeRange.selectNode(b);a(this)};c.deleteContents=
|
||||
function(){this.nativeRange.deleteContents();a(this)};c.extractContents=function(){var b=this.nativeRange.extractContents();a(this);return b};c.cloneContents=function(){return this.nativeRange.cloneContents()};c.surroundContents=function(b){this.nativeRange.surroundContents(b);a(this)};c.collapse=function(b){this.nativeRange.collapse(b);a(this)};c.cloneRange=function(){return new d(this.nativeRange.cloneRange())};c.refresh=function(){a(this)};c.toString=function(){return this.nativeRange.toString()};
|
||||
var i=document.createTextNode("test");e.getBody(document).appendChild(i);var q=document.createRange();q.setStart(i,0);q.setEnd(i,0);try{q.setStart(i,1),c.setStart=function(b,c){this.nativeRange.setStart(b,c);a(this)},c.setEnd=function(b,c){this.nativeRange.setEnd(b,c);a(this)},f=function(b){return function(c){this.nativeRange[b](c);a(this)}}}catch(r){c.setStart=function(b,c){try{this.nativeRange.setStart(b,c)}catch(d){this.nativeRange.setEnd(b,c),this.nativeRange.setStart(b,c)}a(this)},c.setEnd=function(b,
|
||||
c){try{this.nativeRange.setEnd(b,c)}catch(d){this.nativeRange.setStart(b,c),this.nativeRange.setEnd(b,c)}a(this)},f=function(b,c){return function(d){try{this.nativeRange[b](d)}catch(e){this.nativeRange[c](d),this.nativeRange[b](d)}a(this)}}}c.setStartBefore=f("setStartBefore","setEndBefore");c.setStartAfter=f("setStartAfter","setEndAfter");c.setEndBefore=f("setEndBefore","setStartBefore");c.setEndAfter=f("setEndAfter","setStartAfter");q.selectNodeContents(i);c.selectNodeContents=q.startContainer==
|
||||
i&&q.endContainer==i&&0==q.startOffset&&q.endOffset==i.length?function(b){this.nativeRange.selectNodeContents(b);a(this)}:function(a){this.setStart(a,0);this.setEnd(a,g.getEndOffset(a))};q.selectNodeContents(i);q.setEnd(i,3);f=document.createRange();f.selectNodeContents(i);f.setEnd(i,4);f.setStart(i,2);c.compareBoundaryPoints=-1==q.compareBoundaryPoints(q.START_TO_END,f)&1==q.compareBoundaryPoints(q.END_TO_START,f)?function(a,b){b=b.nativeRange||b;a==b.START_TO_END?a=b.END_TO_START:a==b.END_TO_START&&
|
||||
(a=b.START_TO_END);return this.nativeRange.compareBoundaryPoints(a,b)}:function(a,b){return this.nativeRange.compareBoundaryPoints(a,b.nativeRange||b)};b.util.isHostMethod(q,"createContextualFragment")&&(c.createContextualFragment=function(a){return this.nativeRange.createContextualFragment(a)});e.getBody(document).removeChild(i);q.detach();f.detach()})(),b.createNativeRange=function(a){a=a||document;return a.createRange()};else if(b.features.implementsTextRange){d=function(a){this.textRange=a;this.refresh()};
|
||||
d.prototype=new g(document);d.prototype.refresh=function(){var a,b,d=this.textRange;a=d.parentElement();var f=d.duplicate();f.collapse(!0);b=f.parentElement();f=d.duplicate();f.collapse(!1);d=f.parentElement();b=b==d?b:e.getCommonAncestor(b,d);b=b==a?b:e.getCommonAncestor(a,b);0==this.textRange.compareEndPoints("StartToEnd",this.textRange)?b=a=c(this.textRange,b,!0,!0):(a=c(this.textRange,b,!0,!1),b=c(this.textRange,b,!1,!1));this.setStart(a.node,a.offset);this.setEnd(b.node,b.offset)};g.copyComparisonConstants(d);
|
||||
var i=function(){return this}();"undefined"==typeof i.Range&&(i.Range=d);b.createNativeRange=function(a){a=a||document;return a.body.createTextRange()}}b.features.implementsTextRange&&(d.rangeToTextRange=function(b){if(b.collapsed)return a(new f(b.startContainer,b.startOffset),!0);var c=a(new f(b.startContainer,b.startOffset),!0),d=a(new f(b.endContainer,b.endOffset),!1),b=e.getDocument(b.startContainer).body.createTextRange();b.setEndPoint("StartToStart",c);b.setEndPoint("EndToEnd",d);return b});
|
||||
d.prototype.getName=function(){return"WrappedRange"};b.WrappedRange=d;b.createRange=function(a){a=a||document;return new d(b.createNativeRange(a))};b.createRangyRange=function(a){a=a||document;return new g(a)};b.createIframeRange=function(a){return b.createRange(e.getIframeDocument(a))};b.createIframeRangyRange=function(a){return b.createRangyRange(e.getIframeDocument(a))};b.addCreateMissingNativeApiListener(function(a){a=a.document;if(typeof a.createRange=="undefined")a.createRange=function(){return b.createRange(this)};
|
||||
a=a=null})});
|
||||
rangy.createModule("WrappedSelection",function(b,c){function a(a){return(a||window).getSelection()}function d(a){return(a||window).document.selection}function e(a,b,c){var d=c?"end":"start",c=c?"start":"end";a.anchorNode=b[d+"Container"];a.anchorOffset=b[d+"Offset"];a.focusNode=b[c+"Container"];a.focusOffset=b[c+"Offset"]}function f(a){a.anchorNode=a.focusNode=null;a.anchorOffset=a.focusOffset=0;a.rangeCount=0;a.isCollapsed=!0;a._ranges.length=0}function g(a){var c;a instanceof x?(c=a._selectionNativeRange,
|
||||
c||(c=b.createNativeRange(m.getDocument(a.startContainer)),c.setEnd(a.endContainer,a.endOffset),c.setStart(a.startContainer,a.startOffset),a._selectionNativeRange=c,a.attachListener("detach",function(){this._selectionNativeRange=null}))):a instanceof o?c=a.nativeRange:b.features.implementsDomRange&&a instanceof m.getWindow(a.startContainer).Range&&(c=a);return c}function i(a){var b=a.getNodes(),c;a:if(!b.length||1!=b[0].nodeType)c=!1;else{c=1;for(var d=b.length;c<d;++c)if(!m.isAncestorOf(b[0],b[c])){c=
|
||||
!1;break a}c=!0}if(!c)throw Error("getSingleElementFromRange: range "+a.inspect()+" did not consist of a single element");return b[0]}function h(a,b){var c=new o(b);a._ranges=[c];e(a,c,!1);a.rangeCount=1;a.isCollapsed=c.collapsed}function k(a){a._ranges.length=0;if("None"==a.docSelection.type)f(a);else{var c=a.docSelection.createRange();if(c&&"undefined"!=typeof c.text)h(a,c);else{a.rangeCount=c.length;for(var d,j=m.getDocument(c.item(0)),k=0;k<a.rangeCount;++k)d=b.createRange(j),d.selectNode(c.item(k)),
|
||||
a._ranges.push(d);a.isCollapsed=1==a.rangeCount&&a._ranges[0].collapsed;e(a,a._ranges[a.rangeCount-1],!1)}}}function j(a,b){for(var c=a.docSelection.createRange(),d=i(b),e=m.getDocument(c.item(0)),e=m.getBody(e).createControlRange(),h=0,j=c.length;h<j;++h)e.add(c.item(h));try{e.add(d)}catch(f){throw Error("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)");}e.select();k(a)}function n(a,b,c){this.nativeSelection=a;this.docSelection=b;this._ranges=
|
||||
[];this.win=c;this.refresh()}function p(a,b){for(var c=m.getDocument(b[0].startContainer),c=m.getBody(c).createControlRange(),d=0,e;d<rangeCount;++d){e=i(b[d]);try{c.add(e)}catch(h){throw Error("setRanges(): Element within the one of the specified Ranges could not be added to control selection (does it have layout?)");}}c.select();k(a)}function q(a,b){if(a.anchorNode&&m.getDocument(a.anchorNode)!==m.getDocument(b))throw new z("WRONG_DOCUMENT_ERR");}function r(a){var b=[],c=new w(a.anchorNode,a.anchorOffset),
|
||||
d=new w(a.focusNode,a.focusOffset),e="function"==typeof a.getName?a.getName():"Selection";if("undefined"!=typeof a.rangeCount)for(var h=0,j=a.rangeCount;h<j;++h)b[h]=x.inspect(a.getRangeAt(h));return"["+e+"(Ranges: "+b.join(", ")+")(anchor: "+c.inspect()+", focus: "+d.inspect()+"]"}b.requireModules(["DomUtil","DomRange","WrappedRange"]);b.config.checkSelectionRanges=!0;var m=b.dom,s=b.util,x=b.DomRange,o=b.WrappedRange,z=b.DOMException,w=m.DomPosition,y,A,t=b.util.isHostMethod(window,"getSelection"),
|
||||
v=b.util.isHostObject(document,"selection"),D=v&&(!t||b.config.preferTextRange);D?(y=d,b.isSelectionValid=function(a){var a=(a||window).document,b=a.selection;return"None"!=b.type||m.getDocument(b.createRange().parentElement())==a}):t?(y=a,b.isSelectionValid=function(){return!0}):c.fail("Neither document.selection or window.getSelection() detected.");b.getNativeSelection=y;var t=y(),K=b.createNativeRange(document),F=m.getBody(document),E=s.areHostObjects(t,s.areHostProperties(t,["anchorOffset","focusOffset"]));
|
||||
b.features.selectionHasAnchorAndFocus=E;var I=s.isHostMethod(t,"extend");b.features.selectionHasExtend=I;var N="number"==typeof t.rangeCount;b.features.selectionHasRangeCount=N;var J=!1,C=!0;s.areHostMethods(t,["addRange","getRangeAt","removeAllRanges"])&&("number"==typeof t.rangeCount&&b.features.implementsDomRange)&&function(){var a=document.createElement("iframe");F.appendChild(a);var b=m.getIframeDocument(a);b.open();b.write("<html><head></head><body>12</body></html>");b.close();var c=m.getIframeWindow(a).getSelection(),
|
||||
d=b.documentElement.lastChild.firstChild,b=b.createRange();b.setStart(d,1);b.collapse(true);c.addRange(b);C=c.rangeCount==1;c.removeAllRanges();var e=b.cloneRange();b.setStart(d,0);e.setEnd(d,2);c.addRange(b);c.addRange(e);J=c.rangeCount==2;b.detach();e.detach();F.removeChild(a)}();b.features.selectionSupportsMultipleRanges=J;b.features.collapsedNonEditableSelectionsSupported=C;var l=!1,u;F&&s.isHostMethod(F,"createControlRange")&&(u=F.createControlRange(),s.areHostProperties(u,["item","add"])&&(l=
|
||||
!0));b.features.implementsControlRange=l;A=E?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:function(a){return a.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:false};var B;s.isHostMethod(t,"getRangeAt")?B=function(a,b){try{return a.getRangeAt(b)}catch(c){return null}}:E&&(B=function(a){var c=m.getDocument(a.anchorNode),c=b.createRange(c);c.setStart(a.anchorNode,a.anchorOffset);c.setEnd(a.focusNode,a.focusOffset);if(c.collapsed!==this.isCollapsed){c.setStart(a.focusNode,
|
||||
a.focusOffset);c.setEnd(a.anchorNode,a.anchorOffset)}return c});b.getSelection=function(a){var a=a||window,b=a._rangySelection,c=y(a),e=v?d(a):null;if(b){b.nativeSelection=c;b.docSelection=e;b.refresh(a)}else{b=new n(c,e,a);a._rangySelection=b}return b};b.getIframeSelection=function(a){return b.getSelection(m.getIframeWindow(a))};u=n.prototype;if(!D&&E&&s.areHostMethods(t,["removeAllRanges","addRange"])){u.removeAllRanges=function(){this.nativeSelection.removeAllRanges();f(this)};var L=function(a,
|
||||
c){var d=x.getRangeDocument(c),d=b.createRange(d);d.collapseToPoint(c.endContainer,c.endOffset);a.nativeSelection.addRange(g(d));a.nativeSelection.extend(c.startContainer,c.startOffset);a.refresh()};u.addRange=N?function(a,c){if(l&&v&&this.docSelection.type=="Control")j(this,a);else if(c&&I)L(this,a);else{var d;if(J)d=this.rangeCount;else{this.removeAllRanges();d=0}this.nativeSelection.addRange(g(a));this.rangeCount=this.nativeSelection.rangeCount;if(this.rangeCount==d+1){if(b.config.checkSelectionRanges)(d=
|
||||
B(this.nativeSelection,this.rangeCount-1))&&!x.rangesEqual(d,a)&&(a=new o(d));this._ranges[this.rangeCount-1]=a;e(this,a,H(this.nativeSelection));this.isCollapsed=A(this)}else this.refresh()}}:function(a,b){if(b&&I)L(this,a);else{this.nativeSelection.addRange(g(a));this.refresh()}};u.setRanges=function(a){if(l&&a.length>1)p(this,a);else{this.removeAllRanges();for(var b=0,c=a.length;b<c;++b)this.addRange(a[b])}}}else if(s.isHostMethod(t,"empty")&&s.isHostMethod(K,"select")&&l&&D)u.removeAllRanges=
|
||||
function(){try{this.docSelection.empty();if(this.docSelection.type!="None"){var a;if(this.anchorNode)a=m.getDocument(this.anchorNode);else if(this.docSelection.type=="Control"){var b=this.docSelection.createRange();b.length&&(a=m.getDocument(b.item(0)).body.createTextRange())}if(a){a.body.createTextRange().select();this.docSelection.empty()}}}catch(c){}f(this)},u.addRange=function(a){if(this.docSelection.type=="Control")j(this,a);else{o.rangeToTextRange(a).select();this._ranges[0]=a;this.rangeCount=
|
||||
1;this.isCollapsed=this._ranges[0].collapsed;e(this,a,false)}},u.setRanges=function(a){this.removeAllRanges();var b=a.length;b>1?p(this,a):b&&this.addRange(a[0])};else return c.fail("No means of selecting a Range or TextRange was found"),!1;u.getRangeAt=function(a){if(a<0||a>=this.rangeCount)throw new z("INDEX_SIZE_ERR");return this._ranges[a]};var G;if(D)G=function(a){var c;if(b.isSelectionValid(a.win))c=a.docSelection.createRange();else{c=m.getBody(a.win.document).createTextRange();c.collapse(true)}a.docSelection.type==
|
||||
"Control"?k(a):c&&typeof c.text!="undefined"?h(a,c):f(a)};else if(s.isHostMethod(t,"getRangeAt")&&"number"==typeof t.rangeCount)G=function(a){if(l&&v&&a.docSelection.type=="Control")k(a);else{a._ranges.length=a.rangeCount=a.nativeSelection.rangeCount;if(a.rangeCount){for(var c=0,d=a.rangeCount;c<d;++c)a._ranges[c]=new b.WrappedRange(a.nativeSelection.getRangeAt(c));e(a,a._ranges[a.rangeCount-1],H(a.nativeSelection));a.isCollapsed=A(a)}else f(a)}};else if(E&&"boolean"==typeof t.isCollapsed&&"boolean"==
|
||||
typeof K.collapsed&&b.features.implementsDomRange)G=function(a){var b;b=a.nativeSelection;if(b.anchorNode){b=B(b,0);a._ranges=[b];a.rangeCount=1;b=a.nativeSelection;a.anchorNode=b.anchorNode;a.anchorOffset=b.anchorOffset;a.focusNode=b.focusNode;a.focusOffset=b.focusOffset;a.isCollapsed=A(a)}else f(a)};else return c.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;u.refresh=function(a){var b=a?this._ranges.slice(0):null;G(this);if(a){a=b.length;if(a!=this._ranges.length)return false;
|
||||
for(;a--;)if(!x.rangesEqual(b[a],this._ranges[a]))return false;return true}};var P=function(a,b){var c=a.getAllRanges(),d=false;a.removeAllRanges();for(var e=0,h=c.length;e<h;++e)d||b!==c[e]?a.addRange(c[e]):d=true;a.rangeCount||f(a)};u.removeRange=l?function(a){if(this.docSelection.type=="Control"){for(var b=this.docSelection.createRange(),a=i(a),c=m.getDocument(b.item(0)),c=m.getBody(c).createControlRange(),d,e=false,h=0,j=b.length;h<j;++h){d=b.item(h);d!==a||e?c.add(b.item(h)):e=true}c.select();
|
||||
k(this)}else P(this,a)}:function(a){P(this,a)};var H;!D&&E&&b.features.implementsDomRange?(H=function(a){var b=false;a.anchorNode&&(b=m.comparePoints(a.anchorNode,a.anchorOffset,a.focusNode,a.focusOffset)==1);return b},u.isBackwards=function(){return H(this)}):H=u.isBackwards=function(){return false};u.toString=function(){for(var a=[],b=0,c=this.rangeCount;b<c;++b)a[b]=""+this._ranges[b];return a.join("")};u.collapse=function(a,c){q(this,a);var d=b.createRange(m.getDocument(a));d.collapseToPoint(a,
|
||||
c);this.removeAllRanges();this.addRange(d);this.isCollapsed=true};u.collapseToStart=function(){if(this.rangeCount){var a=this._ranges[0];this.collapse(a.startContainer,a.startOffset)}else throw new z("INVALID_STATE_ERR");};u.collapseToEnd=function(){if(this.rangeCount){var a=this._ranges[this.rangeCount-1];this.collapse(a.endContainer,a.endOffset)}else throw new z("INVALID_STATE_ERR");};u.selectAllChildren=function(a){q(this,a);var c=b.createRange(m.getDocument(a));c.selectNodeContents(a);this.removeAllRanges();
|
||||
this.addRange(c)};u.deleteFromDocument=function(){if(l&&v&&this.docSelection.type=="Control"){for(var a=this.docSelection.createRange(),b;a.length;){b=a.item(0);a.remove(b);b.parentNode.removeChild(b)}this.refresh()}else if(this.rangeCount){a=this.getAllRanges();this.removeAllRanges();b=0;for(var c=a.length;b<c;++b)a[b].deleteContents();this.addRange(a[c-1])}};u.getAllRanges=function(){return this._ranges.slice(0)};u.setSingleRange=function(a){this.setRanges([a])};u.containsNode=function(a,b){for(var c=
|
||||
0,d=this._ranges.length;c<d;++c)if(this._ranges[c].containsNode(a,b))return true;return false};u.toHtml=function(){var a="";if(this.rangeCount){for(var a=x.getRangeDocument(this._ranges[0]).createElement("div"),b=0,c=this._ranges.length;b<c;++b)a.appendChild(this._ranges[b].cloneContents());a=a.innerHTML}return a};u.getName=function(){return"WrappedSelection"};u.inspect=function(){return r(this)};u.detach=function(){this.win=this.anchorNode=this.focusNode=this.win._rangySelection=null};n.inspect=
|
||||
r;b.Selection=n;b.selectionPrototype=u;b.addCreateMissingNativeApiListener(function(a){if(typeof a.getSelection=="undefined")a.getSelection=function(){return b.getSelection(this)};a=null})});var Base=function(){};
|
||||
Base.extend=function(b,c){var a=Base.prototype.extend;Base._prototyping=!0;var d=new this;a.call(d,b);d.base=function(){};delete Base._prototyping;var e=d.constructor,f=d.constructor=function(){if(!Base._prototyping)if(this._constructing||this.constructor==f)this._constructing=!0,e.apply(this,arguments),delete this._constructing;else if(null!=arguments[0])return(arguments[0].extend||a).call(arguments[0],d)};f.ancestor=this;f.extend=this.extend;f.forEach=this.forEach;f.implement=this.implement;f.prototype=
|
||||
d;f.toString=this.toString;f.valueOf=function(a){return"object"==a?f:e.valueOf()};a.call(f,c);"function"==typeof f.init&&f.init();return f};
|
||||
Base.prototype={extend:function(b,c){if(1<arguments.length){var a=this[b];if(a&&"function"==typeof c&&(!a.valueOf||a.valueOf()!=c.valueOf())&&/\bbase\b/.test(c)){var d=c.valueOf(),c=function(){var b=this.base||Base.prototype.base;this.base=a;var c=d.apply(this,arguments);this.base=b;return c};c.valueOf=function(a){return"object"==a?c:d};c.toString=Base.toString}this[b]=c}else if(b){var e=Base.prototype.extend;!Base._prototyping&&"function"!=typeof this&&(e=this.extend||e);for(var f={toSource:null},
|
||||
g=["constructor","toString","valueOf"],i=Base._prototyping?0:1;h=g[i++];)b[h]!=f[h]&&e.call(this,h,b[h]);for(var h in b)f[h]||e.call(this,h,b[h])}return this}};
|
||||
Base=Base.extend({constructor:function(b){this.extend(b)}},{ancestor:Object,version:"1.1",forEach:function(b,c,a){for(var d in b)void 0===this.prototype[d]&&c.call(a,b[d],d,b)},implement:function(){for(var b=0;b<arguments.length;b++)if("function"==typeof arguments[b])arguments[b](this.prototype);else this.prototype.extend(arguments[b]);return this},toString:function(){return""+this.valueOf()}});
|
||||
wysihtml5.browser=function(){var b=navigator.userAgent,c=document.createElement("div"),a=-1!==b.indexOf("MSIE")&&-1===b.indexOf("Opera"),d=-1!==b.indexOf("Gecko")&&-1===b.indexOf("KHTML"),e=-1!==b.indexOf("AppleWebKit/"),f=-1!==b.indexOf("Chrome/"),g=-1!==b.indexOf("Opera/");return{USER_AGENT:b,supported:function(){var a=this.USER_AGENT.toLowerCase(),b="contentEditable"in c,d=document.execCommand&&document.queryCommandSupported&&document.queryCommandState,e=document.querySelector&&document.querySelectorAll,
|
||||
a=this.isIos()&&5>(/ipad|iphone|ipod/.test(a)&&a.match(/ os (\d+).+? like mac os x/)||[,0])[1]||-1!==a.indexOf("opera mobi")||-1!==a.indexOf("hpwos/");return b&&d&&e&&!a},isTouchDevice:function(){return this.supportsEvent("touchmove")},isIos:function(){var a=this.USER_AGENT.toLowerCase();return-1!==a.indexOf("webkit")&&-1!==a.indexOf("mobile")},supportsSandboxedIframes:function(){return a},throwsMixedContentWarningWhenIframeSrcIsEmpty:function(){return!("querySelector"in document)},displaysCaretInEmptyContentEditableCorrectly:function(){return!d},
|
||||
hasCurrentStyleProperty:function(){return"currentStyle"in c},insertsLineBreaksOnReturn:function(){return d},supportsPlaceholderAttributeOn:function(a){return"placeholder"in a},supportsEvent:function(a){var b;if(!(b="on"+a in c))c.setAttribute("on"+a,"return;"),b="function"===typeof c["on"+a];return b},supportsEventsInIframeCorrectly:function(){return!g},firesOnDropOnlyWhenOnDragOverIsCancelled:function(){return e||d},supportsDataTransfer:function(){try{return e&&(window.Clipboard||window.DataTransfer).prototype.getData}catch(a){return!1}},
|
||||
supportsHTML5Tags:function(a){a=a.createElement("div");a.innerHTML="<article>foo</article>";return"<article>foo</article>"===a.innerHTML.toLowerCase()},supportsCommand:function(){var b={formatBlock:a,insertUnorderedList:a||g||e,insertOrderedList:a||g||e},c={insertHTML:d};return function(a,d){if(!b[d]){try{return a.queryCommandSupported(d)}catch(e){}try{return a.queryCommandEnabled(d)}catch(f){return!!c[d]}}return!1}}(),doesAutoLinkingInContentEditable:function(){return a},canDisableAutoLinking:function(){return this.supportsCommand(document,
|
||||
"AutoUrlDetect")},clearsContentEditableCorrectly:function(){return d||g||e},supportsGetAttributeCorrectly:function(){return"1"!=document.createElement("td").getAttribute("rowspan")},canSelectImagesInContentEditable:function(){return d||a||g},clearsListsInContentEditableCorrectly:function(){return d||a||e},autoScrollsToCaret:function(){return!e},autoClosesUnclosedTags:function(){var a=c.cloneNode(!1),b;a.innerHTML="<p><div></div>";a=a.innerHTML.toLowerCase();b="<p></p><div></div>"===a||"<p><div></div></p>"===
|
||||
a;this.autoClosesUnclosedTags=function(){return b};return b},supportsNativeGetElementsByClassName:function(){return-1!==(""+document.getElementsByClassName).indexOf("[native code]")},supportsSelectionModify:function(){return"getSelection"in window&&"modify"in window.getSelection()},supportsClassList:function(){return"classList"in c},needsSpaceAfterLineBreak:function(){return g},supportsSpeechApiOn:function(a){return 11<=(b.match(/Chrome\/(\d+)/)||[,0])[1]&&("onwebkitspeechchange"in a||"speech"in a)},
|
||||
crashesWhenDefineProperty:function(b){return a&&("XMLHttpRequest"===b||"XDomainRequest"===b)},doesAsyncFocus:function(){return a},hasProblemsSettingCaretAfterImg:function(){return a},hasUndoInContextMenu:function(){return d||f||g}}}();
|
||||
wysihtml5.lang.array=function(b){return{contains:function(c){if(b.indexOf)return-1!==b.indexOf(c);for(var a=0,d=b.length;a<d;a++)if(b[a]===c)return!0;return!1},without:function(c){for(var c=wysihtml5.lang.array(c),a=[],d=0,e=b.length;d<e;d++)c.contains(b[d])||a.push(b[d]);return a},get:function(){for(var c=0,a=b.length,d=[];c<a;c++)d.push(b[c]);return d}}};
|
||||
wysihtml5.lang.Dispatcher=Base.extend({observe:function(b,c){this.events=this.events||{};this.events[b]=this.events[b]||[];this.events[b].push(c);return this},on:function(){return this.observe.apply(this,wysihtml5.lang.array(arguments).get())},fire:function(b,c){this.events=this.events||{};for(var a=this.events[b]||[],d=0;d<a.length;d++)a[d].call(this,c);return this},stopObserving:function(b,c){this.events=this.events||{};var a=0,d,e;if(b){d=this.events[b]||[];for(e=[];a<d.length;a++)d[a]!==c&&c&&
|
||||
e.push(d[a]);this.events[b]=e}else this.events={};return this}});wysihtml5.lang.object=function(b){return{merge:function(c){for(var a in c)b[a]=c[a];return this},get:function(){return b},clone:function(){var c={},a;for(a in b)c[a]=b[a];return c},isArray:function(){return"[object Array]"===Object.prototype.toString.call(b)}}};
|
||||
(function(){var b=/^\s+/,c=/\s+$/;wysihtml5.lang.string=function(a){a=""+a;return{trim:function(){return a.replace(b,"").replace(c,"")},interpolate:function(b){for(var c in b)a=this.replace("#{"+c+"}").by(b[c]);return a},replace:function(b){return{by:function(c){return a.split(b).join(c)}}}}}})();
|
||||
(function(b){function c(a){return a.replace(e,function(a,b){var c=(b.match(f)||[])[1]||"",d=i[c],b=b.replace(f,"");b.split(d).length>b.split(c).length&&(b+=c,c="");var e=d=b;b.length>g&&(e=e.substr(0,g)+"...");"www."===d.substr(0,4)&&(d="http://"+d);return'<a href="'+d+'">'+e+"</a>"+c})}function a(h){if(!d.contains(h.nodeName))if(h.nodeType===b.TEXT_NODE&&h.data.match(e)){var f=h.parentNode,j;j=f.ownerDocument;var g=j._wysihtml5_tempElement;g||(g=j._wysihtml5_tempElement=j.createElement("div"));j=
|
||||
g;j.innerHTML="<span></span>"+c(h.data);for(j.removeChild(j.firstChild);j.firstChild;)f.insertBefore(j.firstChild,h);f.removeChild(h)}else{f=b.lang.array(h.childNodes).get();j=f.length;for(g=0;g<j;g++)a(f[g]);return h}}var d=b.lang.array("CODE PRE A SCRIPT HEAD TITLE STYLE".split(" ")),e=/((https?:\/\/|www\.)[^\s<]{3,})/gi,f=/([^\w\/\-](,?))$/i,g=100,i={")":"(","]":"[","}":"{"};b.dom.autoLink=function(b){var c;a:{c=b;for(var e;c.parentNode;){c=c.parentNode;e=c.nodeName;if(d.contains(e)){c=!0;break a}if("body"===
|
||||
e)break}c=!1}if(c)return b;b===b.ownerDocument.documentElement&&(b=b.ownerDocument.body);return a(b)};b.dom.autoLink.URL_REG_EXP=e})(wysihtml5);
|
||||
(function(b){var c=b.browser.supportsClassList(),a=b.dom;a.addClass=function(b,e){if(c)return b.classList.add(e);a.hasClass(b,e)||(b.className+=" "+e)};a.removeClass=function(a,b){if(c)return a.classList.remove(b);a.className=a.className.replace(RegExp("(^|\\s+)"+b+"(\\s+|$)")," ")};a.hasClass=function(a,b){if(c)return a.classList.contains(b);var f=a.className;return 0<f.length&&(f==b||RegExp("(^|\\s)"+b+"(\\s|$)").test(f))}})(wysihtml5);
|
||||
wysihtml5.dom.contains=function(){var b=document.documentElement;if(b.contains)return function(b,a){a.nodeType!==wysihtml5.ELEMENT_NODE&&(a=a.parentNode);return b!==a&&b.contains(a)};if(b.compareDocumentPosition)return function(b,a){return!!(b.compareDocumentPosition(a)&16)}}();
|
||||
wysihtml5.dom.convertToList=function(){function b(b,a){var d=b.createElement("li");a.appendChild(d);return d}return function(c,a){if("UL"===c.nodeName||"OL"===c.nodeName||"MENU"===c.nodeName)return c;var d=c.ownerDocument,e=d.createElement(a),f=c.querySelectorAll("br"),g=f.length,i,h,k,j,n;for(n=0;n<g;n++)for(i=f[n];(h=i.parentNode)&&h!==c&&h.lastChild===i;){if("block"===wysihtml5.dom.getStyle("display").from(h)){h.removeChild(i);break}wysihtml5.dom.insert(i).after(i.parentNode)}f=wysihtml5.lang.array(c.childNodes).get();
|
||||
g=f.length;for(n=0;n<g;n++)j=j||b(d,e),i=f[n],h="block"===wysihtml5.dom.getStyle("display").from(i),k="BR"===i.nodeName,h?(j=j.firstChild?b(d,e):j,j.appendChild(i),j=null):k?j=j.firstChild?null:j:j.appendChild(i);c.parentNode.replaceChild(e,c);return e}}();wysihtml5.dom.copyAttributes=function(b){return{from:function(c){return{to:function(a){for(var d,e=0,f=b.length;e<f;e++)d=b[e],"undefined"!==typeof c[d]&&""!==c[d]&&(a[d]=c[d]);return{andTo:arguments.callee}}}}}};
|
||||
(function(b){var c=["-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing"],a=function(a){var e;a:for(var f=0,g=c.length;f<g;f++)if("border-box"===b.getStyle(c[f]).from(a)){e=c[f];break a}return e?parseInt(b.getStyle("width").from(a),10)<a.offsetWidth:!1};b.copyStyles=function(d){return{from:function(e){a(e)&&(d=wysihtml5.lang.array(d).without(c));for(var f="",g=d.length,i=0,h;i<g;i++)h=d[i],f+=h+":"+b.getStyle(h).from(e)+";";return{to:function(a){b.setStyles(f).on(a);return{andTo:arguments.callee}}}}}}})(wysihtml5.dom);
|
||||
(function(b){b.dom.delegate=function(c,a,d,e){return b.dom.observe(c,d,function(d){for(var g=d.target,i=b.lang.array(c.querySelectorAll(a));g&&g!==c;){if(i.contains(g)){e.call(g,d);break}g=g.parentNode}})}})(wysihtml5);
|
||||
wysihtml5.dom.getAsDom=function(){var b="abbr article aside audio bdi canvas command datalist details figcaption figure footer header hgroup keygen mark meter nav output progress rp rt ruby svg section source summary time track video wbr".split(" ");return function(c,a){var a=a||document,d;if("object"===typeof c&&c.nodeType)d=a.createElement("div"),d.appendChild(c);else if(wysihtml5.browser.supportsHTML5Tags(a))d=a.createElement("div"),d.innerHTML=c;else{d=a;if(!d._wysihtml5_supportsHTML5Tags){for(var e=
|
||||
0,f=b.length;e<f;e++)d.createElement(b[e]);d._wysihtml5_supportsHTML5Tags=!0}d=a;e=d.createElement("div");e.style.display="none";d.body.appendChild(e);try{e.innerHTML=c}catch(g){}d.body.removeChild(e);d=e}return d}}();
|
||||
wysihtml5.dom.getParentElement=function(){function b(b,a){return!a||!a.length?!0:"string"===typeof a?b===a:wysihtml5.lang.array(a).contains(b)}return function(c,a,d){d=d||50;if(a.className||a.classRegExp){a:{for(var e=a.nodeName,f=a.className,a=a.classRegExp;d--&&c&&"BODY"!==c.nodeName;){var g;if(g=c.nodeType===wysihtml5.ELEMENT_NODE)if(g=b(c.nodeName,e)){g=f;var i=(c.className||"").match(a)||[];g=!g?!!i.length:i[i.length-1]===g}if(g)break a;c=c.parentNode}c=null}return c}a:{e=a.nodeName;for(f=d;f--&&
|
||||
c&&"BODY"!==c.nodeName;){if(b(c.nodeName,e))break a;c=c.parentNode}c=null}return c}}();
|
||||
wysihtml5.dom.getStyle=function(){function b(b){return b.replace(a,function(a){return a.charAt(1).toUpperCase()})}var c={"float":"styleFloat"in document.createElement("div").style?"styleFloat":"cssFloat"},a=/\-[a-z]/g;return function(a){return{from:function(e){if(e.nodeType===wysihtml5.ELEMENT_NODE){var f=e.ownerDocument,g=c[a]||b(a),i=e.style,h=e.currentStyle,k=i[g];if(k)return k;if(h)try{return h[g]}catch(j){}var g=f.defaultView||f.parentWindow,f=("height"===a||"width"===a)&&"TEXTAREA"===e.nodeName,
|
||||
n;if(g.getComputedStyle)return f&&(n=i.overflow,i.overflow="hidden"),e=g.getComputedStyle(e,null).getPropertyValue(a),f&&(i.overflow=n||""),e}}}}}();wysihtml5.dom.hasElementWithTagName=function(){var b={},c=1;return function(a,d){var e=(a._wysihtml5_identifier||(a._wysihtml5_identifier=c++))+":"+d,f=b[e];f||(f=b[e]=a.getElementsByTagName(d));return 0<f.length}}();
|
||||
(function(b){var c={},a=1;b.dom.hasElementWithClassName=function(d,e){if(!b.browser.supportsNativeGetElementsByClassName())return!!d.querySelector("."+e);var f=(d._wysihtml5_identifier||(d._wysihtml5_identifier=a++))+":"+e,g=c[f];g||(g=c[f]=d.getElementsByClassName(e));return 0<g.length}})(wysihtml5);wysihtml5.dom.insert=function(b){return{after:function(c){c.parentNode.insertBefore(b,c.nextSibling)},before:function(c){c.parentNode.insertBefore(b,c)},into:function(c){c.appendChild(b)}}};
|
||||
wysihtml5.dom.insertCSS=function(b){b=b.join("\n");return{into:function(c){var a=c.head||c.getElementsByTagName("head")[0],d=c.createElement("style");d.type="text/css";d.styleSheet?d.styleSheet.cssText=b:d.appendChild(c.createTextNode(b));a&&a.appendChild(d)}}};
|
||||
wysihtml5.dom.observe=function(b,c,a){for(var c="string"===typeof c?[c]:c,d,e,f=0,g=c.length;f<g;f++)e=c[f],b.addEventListener?b.addEventListener(e,a,!1):(d=function(c){"target"in c||(c.target=c.srcElement);c.preventDefault=c.preventDefault||function(){this.returnValue=false};c.stopPropagation=c.stopPropagation||function(){this.cancelBubble=true};a.call(b,c)},b.attachEvent("on"+e,d));return{stop:function(){for(var e,h=0,f=c.length;h<f;h++)e=c[h],b.removeEventListener?b.removeEventListener(e,a,!1):
|
||||
b.detachEvent("on"+e,d)}}};
|
||||
wysihtml5.dom.parse=function(){function b(c,e){var h=c.childNodes,f=h.length,g;g=a[c.nodeType];var k=0;g=g&&g(c);if(!g)return null;for(k=0;k<f;k++)(newChild=b(h[k],e))&&g.appendChild(newChild);return e&&1>=g.childNodes.length&&g.nodeName.toLowerCase()===d&&!g.attributes.length?g.firstChild:g}function c(a,b){var b=b.toLowerCase(),c;if(c="IMG"==a.nodeName)if(c="src"==b){var d;try{d=a.complete&&!a.mozMatchesSelector(":-moz-broken")}catch(e){a.complete&&"complete"===a.readyState&&(d=!0)}c=!0===d}return c?
|
||||
a.src:i&&"outerHTML"in a?-1!=a.outerHTML.toLowerCase().indexOf(" "+b+"=")?a.getAttribute(b):null:a.getAttribute(b)}var a={1:function(a){var b,f,i=g.tags;f=a.nodeName.toLowerCase();b=a.scopeName;if(a._wysihtml5)return null;a._wysihtml5=1;if("wysihtml5-temp"===a.className)return null;b&&"HTML"!=b&&(f=b+":"+f);"outerHTML"in a&&!wysihtml5.browser.autoClosesUnclosedTags()&&("P"===a.nodeName&&"</p>"!==a.outerHTML.slice(-4).toLowerCase())&&(f="div");if(f in i){b=i[f];if(!b||b.remove)return null;b="string"===
|
||||
typeof b?{rename_tag:b}:b}else if(a.firstChild)b={rename_tag:d};else return null;f=a.ownerDocument.createElement(b.rename_tag||f);var i={},r=b.set_class,m=b.add_class,s=b.set_attributes,x=b.check_attributes,o=g.classes,z=0,w=[];b=[];var y=[],A=[],t;s&&(i=wysihtml5.lang.object(s).clone());if(x)for(t in x)if(s=h[x[t]])s=s(c(a,t)),"string"===typeof s&&(i[t]=s);r&&w.push(r);if(m)for(t in m)if(s=k[m[t]])r=s(c(a,t)),"string"===typeof r&&w.push(r);o["_wysihtml5-temp-placeholder"]=1;(A=a.getAttribute("class"))&&
|
||||
(w=w.concat(A.split(e)));for(m=w.length;z<m;z++)a=w[z],o[a]&&b.push(a);for(o=b.length;o--;)a=b[o],wysihtml5.lang.array(y).contains(a)||y.unshift(a);y.length&&(i["class"]=y.join(" "));for(t in i)try{f.setAttribute(t,i[t])}catch(v){}i.src&&("undefined"!==typeof i.width&&f.setAttribute("width",i.width),"undefined"!==typeof i.height&&f.setAttribute("height",i.height));return f},3:function(a){return a.ownerDocument.createTextNode(a.data)}},d="span",e=/\s+/,f={tags:{},classes:{}},g={},i=!wysihtml5.browser.supportsGetAttributeCorrectly(),
|
||||
h={url:function(){var a=/^https?:\/\//i;return function(b){return!b||!b.match(a)?null:b.replace(a,function(a){return a.toLowerCase()})}}(),alt:function(){var a=/[^ a-z0-9_\-]/gi;return function(b){return!b?"":b.replace(a,"")}}(),numbers:function(){var a=/\D/g;return function(b){return(b=(b||"").replace(a,""))||null}}()},k={align_img:function(){var a={left:"wysiwyg-float-left",right:"wysiwyg-float-right"};return function(b){return a[(""+b).toLowerCase()]}}(),align_text:function(){var a={left:"wysiwyg-text-align-left",
|
||||
right:"wysiwyg-text-align-right",center:"wysiwyg-text-align-center",justify:"wysiwyg-text-align-justify"};return function(b){return a[(""+b).toLowerCase()]}}(),clear_br:function(){var a={left:"wysiwyg-clear-left",right:"wysiwyg-clear-right",both:"wysiwyg-clear-both",all:"wysiwyg-clear-both"};return function(b){return a[(""+b).toLowerCase()]}}(),size_font:function(){var a={1:"wysiwyg-font-size-xx-small",2:"wysiwyg-font-size-small",3:"wysiwyg-font-size-medium",4:"wysiwyg-font-size-large",5:"wysiwyg-font-size-x-large",
|
||||
6:"wysiwyg-font-size-xx-large",7:"wysiwyg-font-size-xx-large","-":"wysiwyg-font-size-smaller","+":"wysiwyg-font-size-larger"};return function(b){return a[(""+b).charAt(0)]}}()};return function(a,c,d,e){wysihtml5.lang.object(g).merge(f).merge(c).get();for(var d=d||a.ownerDocument||document,c=d.createDocumentFragment(),h="string"===typeof a,a=h?wysihtml5.dom.getAsDom(a,d):a;a.firstChild;)d=a.firstChild,a.removeChild(d),(d=b(d,e))&&c.appendChild(d);a.innerHTML="";a.appendChild(c);return h?wysihtml5.quirks.getCorrectInnerHTML(a):
|
||||
a}}();wysihtml5.dom.removeEmptyTextNodes=function(b){for(var c=wysihtml5.lang.array(b.childNodes).get(),a=c.length,d=0;d<a;d++)b=c[d],b.nodeType===wysihtml5.TEXT_NODE&&""===b.data&&b.parentNode.removeChild(b)};wysihtml5.dom.renameElement=function(b,c){for(var a=b.ownerDocument.createElement(c),d;d=b.firstChild;)a.appendChild(d);wysihtml5.dom.copyAttributes(["align","className"]).from(b).to(a);b.parentNode.replaceChild(a,b);return a};
|
||||
wysihtml5.dom.replaceWithChildNodes=function(b){if(b.parentNode)if(b.firstChild){for(var c=b.ownerDocument.createDocumentFragment();b.firstChild;)c.appendChild(b.firstChild);b.parentNode.replaceChild(c,b)}else b.parentNode.removeChild(b)};
|
||||
(function(b){function c(a){var b=a.ownerDocument.createElement("br");a.appendChild(b)}b.resolveList=function(a){if(!("MENU"!==a.nodeName&&"UL"!==a.nodeName&&"OL"!==a.nodeName)){var d=a.ownerDocument.createDocumentFragment(),e=a.previousElementSibling||a.previousSibling,f,g,i;for(e&&"block"!==b.getStyle("display").from(e)&&c(d);i=a.firstChild;){for(f=i.lastChild;e=i.firstChild;)g=(g=e===f)&&"block"!==b.getStyle("display").from(e)&&"BR"!==e.nodeName,d.appendChild(e),g&&c(d);i.parentNode.removeChild(i)}a.parentNode.replaceChild(d,
|
||||
a)}}})(wysihtml5.dom);
|
||||
(function(b){var c=document,a="parent top opener frameElement frames localStorage globalStorage sessionStorage indexedDB".split(" "),d="open close openDialog showModalDialog alert confirm prompt openDatabase postMessage XMLHttpRequest XDomainRequest".split(" "),e=["referrer","write","open","close"];b.dom.Sandbox=Base.extend({constructor:function(a,c){this.callback=a||b.EMPTY_FUNCTION;this.config=b.lang.object({}).merge(c).get();this.iframe=this._createIframe()},insertInto:function(a){"string"===typeof a&&
|
||||
(a=c.getElementById(a));a.appendChild(this.iframe)},getIframe:function(){return this.iframe},getWindow:function(){this._readyError()},getDocument:function(){this._readyError()},destroy:function(){var a=this.getIframe();a.parentNode.removeChild(a)},_readyError:function(){throw Error("wysihtml5.Sandbox: Sandbox iframe isn't loaded yet");},_createIframe:function(){var a=this,d=c.createElement("iframe");d.className="wysihtml5-sandbox";b.dom.setAttributes({security:"restricted",allowtransparency:"true",
|
||||
frameborder:0,width:0,height:0,marginwidth:0,marginheight:0}).on(d);b.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()&&(d.src="javascript:'<html></html>'");d.onload=function(){d.onreadystatechange=d.onload=null;a._onLoadIframe(d)};d.onreadystatechange=function(){if(/loaded|complete/.test(d.readyState)){d.onreadystatechange=d.onload=null;a._onLoadIframe(d)}};return d},_onLoadIframe:function(f){if(b.dom.contains(c.documentElement,f)){var g=this,i=f.contentWindow,h=f.contentWindow.document,k=
|
||||
this._getHtml({charset:c.characterSet||c.charset||"utf-8",stylesheets:this.config.stylesheets});h.open("text/html","replace");h.write(k);h.close();this.getWindow=function(){return f.contentWindow};this.getDocument=function(){return f.contentWindow.document};i.onerror=function(a,b,c){throw Error("wysihtml5.Sandbox: "+a,b,c);};if(!b.browser.supportsSandboxedIframes()){var j,k=0;for(j=a.length;k<j;k++)this._unset(i,a[k]);k=0;for(j=d.length;k<j;k++)this._unset(i,d[k],b.EMPTY_FUNCTION);k=0;for(j=e.length;k<
|
||||
j;k++)this._unset(h,e[k]);this._unset(h,"cookie","",!0)}this.loaded=!0;setTimeout(function(){g.callback(g)},0)}},_getHtml:function(a){var c=a.stylesheets,d="",e=0,k;if(c="string"===typeof c?[c]:c)for(k=c.length;e<k;e++)d+='<link rel="stylesheet" href="'+c[e]+'">';a.stylesheets=d;return b.lang.string('<!DOCTYPE html><html><head><meta charset="#{charset}">#{stylesheets}</head><body></body></html>').interpolate(a)},_unset:function(a,c,d,e){try{a[c]=d}catch(k){}try{a.__defineGetter__(c,function(){return d})}catch(j){}if(e)try{a.__defineSetter__(c,
|
||||
function(){})}catch(n){}if(!b.browser.crashesWhenDefineProperty(c))try{var p={get:function(){return d}};e&&(p.set=function(){});Object.defineProperty(a,c,p)}catch(q){}}})})(wysihtml5);(function(){var b={className:"class"};wysihtml5.dom.setAttributes=function(c){return{on:function(a){for(var d in c)a.setAttribute(b[d]||d,c[d])}}}})();
|
||||
wysihtml5.dom.setStyles=function(b){return{on:function(c){c=c.style;if("string"===typeof b)c.cssText+=";"+b;else for(var a in b)"float"===a?(c.cssFloat=b[a],c.styleFloat=b[a]):c[a]=b[a]}}};
|
||||
(function(b){b.simulatePlaceholder=function(c,a,d){var e=function(){a.hasPlaceholderSet()&&a.clear();b.removeClass(a.element,"placeholder")},f=function(){a.isEmpty()&&(a.setValue(d),b.addClass(a.element,"placeholder"))};c.observe("set_placeholder",f).observe("unset_placeholder",e).observe("focus:composer",e).observe("paste:composer",e).observe("blur:composer",f);f()}})(wysihtml5.dom);
|
||||
(function(b){var c=document.documentElement;"textContent"in c?(b.setTextContent=function(a,b){a.textContent=b},b.getTextContent=function(a){return a.textContent}):"innerText"in c?(b.setTextContent=function(a,b){a.innerText=b},b.getTextContent=function(a){return a.innerText}):(b.setTextContent=function(a,b){a.nodeValue=b},b.getTextContent=function(a){return a.nodeValue})})(wysihtml5.dom);
|
||||
wysihtml5.quirks.cleanPastedHTML=function(){var b={"a u":wysihtml5.dom.replaceWithChildNodes};return function(c,a,d){var a=a||b,d=d||c.ownerDocument||document,e="string"===typeof c,f,g,i,h=0,c=e?wysihtml5.dom.getAsDom(c,d):c;for(i in a){f=c.querySelectorAll(i);d=a[i];for(g=f.length;h<g;h++)d(f[h])}return e?c.innerHTML:c}}();
|
||||
(function(b){var c=b.dom;b.quirks.ensureProperClearing=function(){var a=function(){var a=this;setTimeout(function(){var b=a.innerHTML.toLowerCase();if("<p> </p>"==b||"<p> </p><p> </p>"==b)a.innerHTML=""},0)};return function(b){c.observe(b.element,["cut","keydown"],a)}}();b.quirks.ensureProperClearingOfLists=function(){var a=["OL","UL","MENU"];return function(d){c.observe(d.element,"keydown",function(e){if(e.keyCode===b.BACKSPACE_KEY){var f=d.selection.getSelectedNode(),e=d.element;
|
||||
e.firstChild&&b.lang.array(a).contains(e.firstChild.nodeName)&&(f=c.getParentElement(f,{nodeName:a}))&&f==e.firstChild&&1>=f.childNodes.length&&(f.firstChild?""===f.firstChild.innerHTML:1)&&f.parentNode.removeChild(f)}})}}()})(wysihtml5);
|
||||
(function(b){b.quirks.getCorrectInnerHTML=function(c){var a=c.innerHTML;if(-1===a.indexOf("%7E"))return a;var c=c.querySelectorAll("[href*='~'], [src*='~']"),d,e,f,g;g=0;for(f=c.length;g<f;g++)d=c[g].href||c[g].src,e=b.lang.string(d).replace("~").by("%7E"),a=b.lang.string(a).replace(e).by(d);return a}})(wysihtml5);
|
||||
(function(b){var c=b.dom,a="LI P H1 H2 H3 H4 H5 H6".split(" "),d=["UL","OL","MENU"];b.quirks.insertLineBreakOnReturn=function(e){function f(a){if(a=c.getParentElement(a,{nodeName:["P","DIV"]},2)){var d=document.createTextNode(b.INVISIBLE_SPACE);c.insert(d).before(a);c.replaceWithChildNodes(a);e.selection.selectNode(d)}}c.observe(e.element.ownerDocument,"keydown",function(g){var i=g.keyCode;if(!(g.shiftKey||i!==b.ENTER_KEY&&i!==b.BACKSPACE_KEY)){var h=e.selection.getSelectedNode();(h=c.getParentElement(h,
|
||||
{nodeName:a},4))?"LI"===h.nodeName&&(i===b.ENTER_KEY||i===b.BACKSPACE_KEY)?setTimeout(function(){var a=e.selection.getSelectedNode(),b;a&&((b=c.getParentElement(a,{nodeName:d},2))||f(a))},0):h.nodeName.match(/H[1-6]/)&&i===b.ENTER_KEY&&setTimeout(function(){f(e.selection.getSelectedNode())},0):i===b.ENTER_KEY&&!b.browser.insertsLineBreaksOnReturn()&&(e.commands.exec("insertLineBreak"),g.preventDefault())}})}})(wysihtml5);
|
||||
(function(b){b.quirks.redraw=function(c){b.dom.addClass(c,"wysihtml5-quirks-redraw");b.dom.removeClass(c,"wysihtml5-quirks-redraw");try{var a=c.ownerDocument;a.execCommand("italic",!1,null);a.execCommand("italic",!1,null)}catch(d){}}})(wysihtml5);
|
||||
(function(b){var c=b.dom;b.Selection=Base.extend({constructor:function(a){window.rangy.init();this.editor=a;this.composer=a.composer;this.doc=this.composer.doc},getBookmark:function(){var a=this.getRange();return a&&a.cloneRange()},setBookmark:function(a){a&&this.setSelection(a)},setBefore:function(a){var b=rangy.createRange(this.doc);b.setStartBefore(a);b.setEndBefore(a);return this.setSelection(b)},setAfter:function(a){var b=rangy.createRange(this.doc);b.setStartAfter(a);b.setEndAfter(a);return this.setSelection(b)},
|
||||
selectNode:function(a){var d=rangy.createRange(this.doc),e=a.nodeType===b.ELEMENT_NODE,f="canHaveHTML"in a?a.canHaveHTML:"IMG"!==a.nodeName,g=e?a.innerHTML:a.data,g=""===g||g===b.INVISIBLE_SPACE,i=c.getStyle("display").from(a),i="block"===i||"list-item"===i;if(g&&e&&f)try{a.innerHTML=b.INVISIBLE_SPACE}catch(h){}f?d.selectNodeContents(a):d.selectNode(a);f&&g&&e?d.collapse(i):f&&g&&(d.setStartAfter(a),d.setEndAfter(a));this.setSelection(d)},getSelectedNode:function(a){if(a&&this.doc.selection&&"Control"===
|
||||
this.doc.selection.type&&(a=this.doc.selection.createRange())&&a.length)return a.item(0);a=this.getSelection(this.doc);return a.focusNode===a.anchorNode?a.focusNode:(a=this.getRange(this.doc))?a.commonAncestorContainer:this.doc.body},executeAndRestore:function(a,c){var e=this.doc.body,f=c&&e.scrollTop,g=c&&e.scrollLeft,i='<span class="_wysihtml5-temp-placeholder">'+b.INVISIBLE_SPACE+"</span>",h=this.getRange(this.doc);if(h){i=h.createContextualFragment(i);h.insertNode(i);try{a(h.startContainer,h.endContainer)}catch(k){setTimeout(function(){throw k;
|
||||
},0)}(caretPlaceholder=this.doc.querySelector("._wysihtml5-temp-placeholder"))?(h=rangy.createRange(this.doc),h.selectNode(caretPlaceholder),h.deleteContents(),this.setSelection(h)):e.focus();c&&(e.scrollTop=f,e.scrollLeft=g);try{caretPlaceholder.parentNode.removeChild(caretPlaceholder)}catch(j){}}else a(e,e)},executeAndRestoreSimple:function(a){var b,c,f=this.getRange(),g=this.doc.body,i;if(f){b=f.getNodes([3]);g=b[0]||f.startContainer;i=b[b.length-1]||f.endContainer;b=g===f.startContainer?f.startOffset:
|
||||
0;c=i===f.endContainer?f.endOffset:i.length;try{a(f.startContainer,f.endContainer)}catch(h){setTimeout(function(){throw h;},0)}a=rangy.createRange(this.doc);try{a.setStart(g,b)}catch(k){}try{a.setEnd(i,c)}catch(j){}try{this.setSelection(a)}catch(n){}}else a(g,g)},insertHTML:function(a){var a=rangy.createRange(this.doc).createContextualFragment(a),b=a.lastChild;this.insertNode(a);b&&this.setAfter(b)},insertNode:function(a){var b=this.getRange();b&&b.insertNode(a)},surround:function(a){var b=this.getRange();
|
||||
if(b)try{b.surroundContents(a),this.selectNode(a)}catch(c){a.appendChild(b.extractContents()),b.insertNode(a)}},scrollIntoView:function(){var a=this.doc,c=a.documentElement.scrollHeight>a.documentElement.offsetHeight,e;if(!(e=a._wysihtml5ScrollIntoViewElement))e=a.createElement("span"),e.innerHTML=b.INVISIBLE_SPACE;e=a._wysihtml5ScrollIntoViewElement=e;if(c){this.insertNode(e);var c=e,f=0;if(c.parentNode){do f+=c.offsetTop||0,c=c.offsetParent;while(c)}c=f;e.parentNode.removeChild(e);c>a.body.scrollTop&&
|
||||
(a.body.scrollTop=c)}},selectLine:function(){b.browser.supportsSelectionModify()?this._selectLine_W3C():this.doc.selection&&this._selectLine_MSIE()},_selectLine_W3C:function(){var a=this.doc.defaultView.getSelection();a.modify("extend","left","lineboundary");a.modify("extend","right","lineboundary")},_selectLine_MSIE:function(){var a=this.doc.selection.createRange(),b=a.boundingTop,c=this.doc.body.scrollWidth,f;if(a.moveToPoint){0===b&&(f=this.doc.createElement("span"),this.insertNode(f),b=f.offsetTop,
|
||||
f.parentNode.removeChild(f));b+=1;for(f=-10;f<c;f+=2)try{a.moveToPoint(f,b);break}catch(g){}for(f=this.doc.selection.createRange();0<=c;c--)try{f.moveToPoint(c,b);break}catch(i){}a.setEndPoint("EndToEnd",f);a.select()}},getText:function(){var a=this.getSelection();return a?a.toString():""},getNodes:function(a,b){var c=this.getRange();return c?c.getNodes([a],b):[]},getRange:function(){var a=this.getSelection();return a&&a.rangeCount&&a.getRangeAt(0)},getSelection:function(){return rangy.getSelection(this.doc.defaultView||
|
||||
this.doc.parentWindow)},setSelection:function(a){return rangy.getSelection(this.doc.defaultView||this.doc.parentWindow).setSingleRange(a)}})})(wysihtml5);
|
||||
(function(b,c){function a(a,b){return c.dom.isCharacterDataNode(a)?0==b?!!a.previousSibling:b==a.length?!!a.nextSibling:!0:0<b&&b<a.childNodes.length}function d(a,b,e){var f;c.dom.isCharacterDataNode(b)&&(0==e?(e=c.dom.getNodeIndex(b),b=b.parentNode):e==b.length?(e=c.dom.getNodeIndex(b)+1,b=b.parentNode):f=c.dom.splitDataNode(b,e));if(!f){f=b.cloneNode(!1);f.id&&f.removeAttribute("id");for(var g;g=b.childNodes[e];)f.appendChild(g);c.dom.insertAfter(f,b)}return b==a?f:d(a,f.parentNode,c.dom.getNodeIndex(f))}
|
||||
function e(a){this.firstTextNode=(this.isElementMerge=a.nodeType==b.ELEMENT_NODE)?a.lastChild:a;this.textNodes=[this.firstTextNode]}function f(a,b,c,d){this.tagNames=a||[g];this.cssClass=b||"";this.similarClassRegExp=c;this.normalize=d;this.applyToAnyTagName=!1}var g="span",i=/\s+/g;e.prototype={doMerge:function(){for(var a=[],b,c,d=0,e=this.textNodes.length;d<e;++d)b=this.textNodes[d],c=b.parentNode,a[d]=b.data,d&&(c.removeChild(b),c.hasChildNodes()||c.parentNode.removeChild(c));return this.firstTextNode.data=
|
||||
a=a.join("")},getLength:function(){for(var a=this.textNodes.length,b=0;a--;)b+=this.textNodes[a].length;return b},toString:function(){for(var a=[],b=0,c=this.textNodes.length;b<c;++b)a[b]="'"+this.textNodes[b].data+"'";return"[Merge("+a.join(",")+")]"}};f.prototype={getAncestorWithClass:function(a){for(var d;a;){if(this.cssClass)if(d=this.cssClass,a.className){var e=a.className.match(this.similarClassRegExp)||[];d=e[e.length-1]===d}else d=!1;else d=!0;if(a.nodeType==b.ELEMENT_NODE&&c.dom.arrayContains(this.tagNames,
|
||||
a.tagName.toLowerCase())&&d)return a;a=a.parentNode}return!1},postApply:function(a,b){for(var c=a[0],d=a[a.length-1],f=[],g,i=c,m=d,s=0,x=d.length,o,z,w=0,y=a.length;w<y;++w)if(o=a[w],z=this.getAdjacentMergeableTextNode(o.parentNode,!1)){if(g||(g=new e(z),f.push(g)),g.textNodes.push(o),o===c&&(i=g.firstTextNode,s=i.length),o===d)m=g.firstTextNode,x=g.getLength()}else g=null;if(c=this.getAdjacentMergeableTextNode(d.parentNode,!0))g||(g=new e(d),f.push(g)),g.textNodes.push(c);if(f.length){w=0;for(y=
|
||||
f.length;w<y;++w)f[w].doMerge();b.setStart(i,s);b.setEnd(m,x)}},getAdjacentMergeableTextNode:function(a,c){var d=a.nodeType==b.TEXT_NODE,e=d?a.parentNode:a,f=c?"nextSibling":"previousSibling";if(d){if((d=a[f])&&d.nodeType==b.TEXT_NODE)return d}else if((d=e[f])&&this.areElementsMergeable(a,d))return d[c?"firstChild":"lastChild"];return null},areElementsMergeable:function(a,b){var d;if(d=c.dom.arrayContains(this.tagNames,(a.tagName||"").toLowerCase()))if(d=c.dom.arrayContains(this.tagNames,(b.tagName||
|
||||
"").toLowerCase()))if(d=a.className.replace(i," ")==b.className.replace(i," "))a:if(a.attributes.length!=b.attributes.length)d=!1;else{d=0;for(var e=a.attributes.length,f,g;d<e;++d)if(f=a.attributes[d],g=f.name,"class"!=g&&(g=b.attributes.getNamedItem(g),f.specified!=g.specified||f.specified&&f.nodeValue!==g.nodeValue)){d=!1;break a}d=!0}return d},createContainer:function(a){a=a.createElement(this.tagNames[0]);this.cssClass&&(a.className=this.cssClass);return a},applyToTextNode:function(a){var b=
|
||||
a.parentNode;1==b.childNodes.length&&c.dom.arrayContains(this.tagNames,b.tagName.toLowerCase())?this.cssClass&&(a=this.cssClass,b.className?(b.className&&(b.className=b.className.replace(this.similarClassRegExp,"")),b.className+=" "+a):b.className=a):(b=this.createContainer(c.dom.getDocument(a)),a.parentNode.insertBefore(b,a),b.appendChild(a))},isRemovable:function(a){return c.dom.arrayContains(this.tagNames,a.tagName.toLowerCase())&&b.lang.string(a.className).trim()==this.cssClass},undoToTextNode:function(b,
|
||||
c,e){c.containsNode(e)||(b=c.cloneRange(),b.selectNode(e),b.isPointInRange(c.endContainer,c.endOffset)&&a(c.endContainer,c.endOffset)&&(d(e,c.endContainer,c.endOffset),c.setEndAfter(e)),b.isPointInRange(c.startContainer,c.startOffset)&&a(c.startContainer,c.startOffset)&&(e=d(e,c.startContainer,c.startOffset)));this.similarClassRegExp&&e.className&&(e.className=e.className.replace(this.similarClassRegExp,""));if(this.isRemovable(e)){c=e;for(e=c.parentNode;c.firstChild;)e.insertBefore(c.firstChild,
|
||||
c);e.removeChild(c)}},applyToRange:function(a){var c=a.getNodes([b.TEXT_NODE]);if(!c.length)try{var d=this.createContainer(a.endContainer.ownerDocument);a.surroundContents(d);this.selectNode(a,d);return}catch(e){}a.splitBoundaries();c=a.getNodes([b.TEXT_NODE]);if(c.length){for(var f=0,g=c.length;f<g;++f)d=c[f],this.getAncestorWithClass(d)||this.applyToTextNode(d);a.setStart(c[0],0);d=c[c.length-1];a.setEnd(d,d.length);this.normalize&&this.postApply(c,a)}},undoToRange:function(a){var c=a.getNodes([b.TEXT_NODE]),
|
||||
d,e;c.length?(a.splitBoundaries(),c=a.getNodes([b.TEXT_NODE])):(c=a.endContainer.ownerDocument.createTextNode(b.INVISIBLE_SPACE),a.insertNode(c),a.selectNode(c),c=[c]);for(var f=0,g=c.length;f<g;++f)d=c[f],(e=this.getAncestorWithClass(d))&&this.undoToTextNode(d,a,e);1==g?this.selectNode(a,c[0]):(a.setStart(c[0],0),d=c[c.length-1],a.setEnd(d,d.length),this.normalize&&this.postApply(c,a))},selectNode:function(a,c){var d=c.nodeType===b.ELEMENT_NODE,e="canHaveHTML"in c?c.canHaveHTML:!0,f=d?c.innerHTML:
|
||||
c.data;if((f=""===f||f===b.INVISIBLE_SPACE)&&d&&e)try{c.innerHTML=b.INVISIBLE_SPACE}catch(g){}a.selectNodeContents(c);f&&d?a.collapse(!1):f&&(a.setStartAfter(c),a.setEndAfter(c))},getTextSelectedByRange:function(a,b){var c=b.cloneRange();c.selectNodeContents(a);var d=c.intersection(b),d=d?d.toString():"";c.detach();return d},isAppliedToRange:function(a){var c=[],d,e=a.getNodes([b.TEXT_NODE]);if(!e.length)return(d=this.getAncestorWithClass(a.startContainer))?[d]:!1;for(var f=0,g=e.length,i;f<g;++f){i=
|
||||
this.getTextSelectedByRange(e[f],a);d=this.getAncestorWithClass(e[f]);if(""!=i&&!d)return!1;c.push(d)}return c},toggleRange:function(a){this.isAppliedToRange(a)?this.undoToRange(a):this.applyToRange(a)}};b.selection.HTMLApplier=f})(wysihtml5,rangy);
|
||||
wysihtml5.Commands=Base.extend({constructor:function(b){this.editor=b;this.composer=b.composer;this.doc=this.composer.doc},support:function(b){return wysihtml5.browser.supportsCommand(this.doc,b)},exec:function(b,c){var a=wysihtml5.commands[b],d=wysihtml5.lang.array(arguments).get(),e=a&&a.exec,f=null;this.editor.fire("beforecommand:composer");if(e)d.unshift(this.composer),f=e.apply(a,d);else try{f=this.doc.execCommand(b,!1,c)}catch(g){}this.editor.fire("aftercommand:composer");return f},state:function(b,
|
||||
c){var a=wysihtml5.commands[b],d=wysihtml5.lang.array(arguments).get(),e=a&&a.state;if(e)return d.unshift(this.composer),e.apply(a,d);try{return this.doc.queryCommandState(b)}catch(f){return!1}},value:function(b){var c=wysihtml5.commands[b],a=c&&c.value;if(a)return a.call(c,this.composer,b);try{return this.doc.queryCommandValue(b)}catch(d){return null}}});
|
||||
(function(b){b.commands.bold={exec:function(c,a){return b.commands.formatInline.exec(c,a,"b")},state:function(c,a){return b.commands.formatInline.state(c,a,"b")},value:function(){}}})(wysihtml5);
|
||||
(function(b){function c(c,g){var i=c.doc,h="_wysihtml5-temp-"+ +new Date,k=0,j,n,p;b.commands.formatInline.exec(c,a,d,h,/non-matching-class/g);j=i.querySelectorAll(d+"."+h);for(h=j.length;k<h;k++)for(p in n=j[k],n.removeAttribute("class"),g)n.setAttribute(p,g[p]);k=n;1===h&&(p=e.getTextContent(n),h=!!n.querySelector("*"),p=""===p||p===b.INVISIBLE_SPACE,!h&&p&&(e.setTextContent(n,g.text||n.href),i=i.createTextNode(" "),c.selection.setAfter(n),c.selection.insertNode(i),k=i));c.selection.setAfter(k)}
|
||||
var a,d="A",e=b.dom;b.commands.createLink={exec:function(a,b,d){var h=this.state(a,b);h?a.selection.executeAndRestore(function(){for(var a=h.length,b=0,c,d,f;b<a;b++)c=h[b],d=e.getParentElement(c,{nodeName:"code"}),f=e.getTextContent(c),f.match(e.autoLink.URL_REG_EXP)&&!d?e.renameElement(c,"code"):e.replaceWithChildNodes(c)}):(d="object"===typeof d?d:{href:d},c(a,d))},state:function(a,c){return b.commands.formatInline.state(a,c,"A")},value:function(){return a}}})(wysihtml5);
|
||||
(function(b){var c=/wysiwyg-font-size-[a-z\-]+/g;b.commands.fontSize={exec:function(a,d,e){return b.commands.formatInline.exec(a,d,"span","wysiwyg-font-size-"+e,c)},state:function(a,d,e){return b.commands.formatInline.state(a,d,"span","wysiwyg-font-size-"+e,c)},value:function(){}}})(wysihtml5);
|
||||
(function(b){var c=/wysiwyg-color-[a-z]+/g;b.commands.foreColor={exec:function(a,d,e){return b.commands.formatInline.exec(a,d,"span","wysiwyg-color-"+e,c)},state:function(a,d,e){return b.commands.formatInline.state(a,d,"span","wysiwyg-color-"+e,c)},value:function(){}}})(wysihtml5);
|
||||
(function(b){function c(a){for(a=a.previousSibling;a&&a.nodeType===b.TEXT_NODE&&!b.lang.string(a.data).trim();)a=a.previousSibling;return a}function a(a){for(a=a.nextSibling;a&&a.nodeType===b.TEXT_NODE&&!b.lang.string(a.data).trim();)a=a.nextSibling;return a}function d(a){return"BR"===a.nodeName||"block"===g.getStyle("display").from(a)?!0:!1}function e(a,c,d,e){if(e)var f=g.observe(a,"DOMNodeInserted",function(a){var a=a.target,c;a.nodeType===b.ELEMENT_NODE&&(c=g.getStyle("display").from(a),"inline"!==
|
||||
c.substr(0,6)&&(a.className+=" "+e))});a.execCommand(c,!1,d);f&&f.stop()}function f(b,d){b.selection.selectLine();b.selection.surround(d);var e=a(d),f=c(d);e&&"BR"===e.nodeName&&e.parentNode.removeChild(e);f&&"BR"===f.nodeName&&f.parentNode.removeChild(f);(e=d.lastChild)&&"BR"===e.nodeName&&e.parentNode.removeChild(e);b.selection.selectNode(d)}var g=b.dom,i="H1 H2 H3 H4 H5 H6 P BLOCKQUOTE DIV".split(" ");b.commands.formatBlock={exec:function(h,k,j,n,p){var q=h.doc,r=this.state(h,k,j,n,p),m,j="string"===
|
||||
typeof j?j.toUpperCase():j;if(r)h.selection.executeAndRestoreSimple(function(){p&&(r.className=r.className.replace(p,""));var e=!!b.lang.string(r.className).trim();if(!e&&r.nodeName===(j||"DIV")){var e=r,f=e.ownerDocument,h=a(e),i=c(e);h&&!d(h)&&e.parentNode.insertBefore(f.createElement("br"),h);i&&!d(i)&&e.parentNode.insertBefore(f.createElement("br"),e);g.replaceWithChildNodes(r)}else e&&g.renameElement(r,"DIV")});else{if(null===j||b.lang.array(i).contains(j))if(m=h.selection.getSelectedNode(),
|
||||
r=g.getParentElement(m,{nodeName:i})){h.selection.executeAndRestoreSimple(function(){j&&(r=g.renameElement(r,j));if(n){var a=r;a.className?(a.className=a.className.replace(p,""),a.className+=" "+n):a.className=n}});return}h.commands.support(k)?e(q,k,j||"DIV",n):(r=q.createElement(j||"DIV"),n&&(r.className=n),f(h,r))}},state:function(a,b,c,d,e){c="string"===typeof c?c.toUpperCase():c;a=a.selection.getSelectedNode();return g.getParentElement(a,{nodeName:c,className:d,classRegExp:e})},value:function(){}}})(wysihtml5);
|
||||
(function(b){function c(c,f,g){var i=c+":"+f;if(!d[i]){var h=d,k=b.selection.HTMLApplier,j=a[c],c=j?[c.toLowerCase(),j.toLowerCase()]:[c.toLowerCase()];h[i]=new k(c,f,g,!0)}return d[i]}var a={strong:"b",em:"i",b:"strong",i:"em"},d={};b.commands.formatInline={exec:function(a,b,d,i,h){b=a.selection.getRange();if(!b)return!1;c(d,i,h).toggleRange(b);a.selection.setSelection(b)},state:function(d,f,g,i,h){var f=d.doc,k=a[g]||g;if(!b.dom.hasElementWithTagName(f,g)&&!b.dom.hasElementWithTagName(f,k)||i&&
|
||||
!b.dom.hasElementWithClassName(f,i))return!1;d=d.selection.getRange();return!d?!1:c(g,i,h).isAppliedToRange(d)},value:function(){}}})(wysihtml5);(function(b){b.commands.insertHTML={exec:function(b,a,d){b.commands.support(a)?b.doc.execCommand(a,!1,d):b.selection.insertHTML(d)},state:function(){return!1},value:function(){}}})(wysihtml5);
|
||||
(function(b){b.commands.insertImage={exec:function(c,a,d){var d="object"===typeof d?d:{src:d},e=c.doc,a=this.state(c),f;if(a)c.selection.setBefore(a),d=a.parentNode,d.removeChild(a),b.dom.removeEmptyTextNodes(d),"A"===d.nodeName&&!d.firstChild&&(c.selection.setAfter(d),d.parentNode.removeChild(d)),b.quirks.redraw(c.element);else{a=e.createElement("IMG");for(f in d)a[f]=d[f];c.selection.insertNode(a);b.browser.hasProblemsSettingCaretAfterImg()?(d=e.createTextNode(b.INVISIBLE_SPACE),c.selection.insertNode(d),
|
||||
c.selection.setAfter(d)):c.selection.setAfter(a)}},state:function(c){var a;if(!b.dom.hasElementWithTagName(c.doc,"IMG"))return!1;a=c.selection.getSelectedNode();if(!a)return!1;if("IMG"===a.nodeName)return a;if(a.nodeType!==b.ELEMENT_NODE)return!1;a=c.selection.getText();if(a=b.lang.string(a).trim())return!1;c=c.selection.getNodes(b.ELEMENT_NODE,function(a){return"IMG"===a.nodeName});return 1!==c.length?!1:c[0]},value:function(b){return(b=this.state(b))&&b.src}}})(wysihtml5);
|
||||
(function(b){var c="<br>"+(b.browser.needsSpaceAfterLineBreak()?" ":"");b.commands.insertLineBreak={exec:function(a,d){a.commands.support(d)?(a.doc.execCommand(d,!1,null),b.browser.autoScrollsToCaret()||a.selection.scrollIntoView()):a.commands.exec("insertHTML",c)},state:function(){return!1},value:function(){}}})(wysihtml5);
|
||||
(function(b){b.commands.insertOrderedList={exec:function(c,a){var d=c.doc,e=c.selection.getSelectedNode(),f=b.dom.getParentElement(e,{nodeName:"OL"}),g=b.dom.getParentElement(e,{nodeName:"UL"}),e="_wysihtml5-temp-"+(new Date).getTime(),i;c.commands.support(a)?d.execCommand(a,!1,null):f?c.selection.executeAndRestoreSimple(function(){b.dom.resolveList(f)}):g?c.selection.executeAndRestoreSimple(function(){b.dom.renameElement(g,"ol")}):(c.commands.exec("formatBlock","div",e),i=d.querySelector("."+e),
|
||||
d=""===i.innerHTML||i.innerHTML===b.INVISIBLE_SPACE,c.selection.executeAndRestoreSimple(function(){f=b.dom.convertToList(i,"ol")}),d&&c.selection.selectNode(f.querySelector("li")))},state:function(c){c=c.selection.getSelectedNode();return b.dom.getParentElement(c,{nodeName:"OL"})},value:function(){}}})(wysihtml5);
|
||||
(function(b){b.commands.insertUnorderedList={exec:function(c,a){var d=c.doc,e=c.selection.getSelectedNode(),f=b.dom.getParentElement(e,{nodeName:"UL"}),g=b.dom.getParentElement(e,{nodeName:"OL"}),e="_wysihtml5-temp-"+(new Date).getTime(),i;c.commands.support(a)?d.execCommand(a,!1,null):f?c.selection.executeAndRestoreSimple(function(){b.dom.resolveList(f)}):g?c.selection.executeAndRestoreSimple(function(){b.dom.renameElement(g,"ul")}):(c.commands.exec("formatBlock","div",e),i=d.querySelector("."+e),
|
||||
d=""===i.innerHTML||i.innerHTML===b.INVISIBLE_SPACE,c.selection.executeAndRestoreSimple(function(){f=b.dom.convertToList(i,"ul")}),d&&c.selection.selectNode(f.querySelector("li")))},state:function(c){c=c.selection.getSelectedNode();return b.dom.getParentElement(c,{nodeName:"UL"})},value:function(){}}})(wysihtml5);(function(b){b.commands.italic={exec:function(c,a){return b.commands.formatInline.exec(c,a,"i")},state:function(c,a){return b.commands.formatInline.state(c,a,"i")},value:function(){}}})(wysihtml5);
|
||||
(function(b){var c=/wysiwyg-text-align-[a-z]+/g;b.commands.justifyCenter={exec:function(a){return b.commands.formatBlock.exec(a,"formatBlock",null,"wysiwyg-text-align-center",c)},state:function(a){return b.commands.formatBlock.state(a,"formatBlock",null,"wysiwyg-text-align-center",c)},value:function(){}}})(wysihtml5);
|
||||
(function(b){var c=/wysiwyg-text-align-[a-z]+/g;b.commands.justifyLeft={exec:function(a){return b.commands.formatBlock.exec(a,"formatBlock",null,"wysiwyg-text-align-left",c)},state:function(a){return b.commands.formatBlock.state(a,"formatBlock",null,"wysiwyg-text-align-left",c)},value:function(){}}})(wysihtml5);
|
||||
(function(b){var c=/wysiwyg-text-align-[a-z]+/g;b.commands.justifyRight={exec:function(a){return b.commands.formatBlock.exec(a,"formatBlock",null,"wysiwyg-text-align-right",c)},state:function(a){return b.commands.formatBlock.state(a,"formatBlock",null,"wysiwyg-text-align-right",c)},value:function(){}}})(wysihtml5);(function(b){b.commands.underline={exec:function(c,a){return b.commands.formatInline.exec(c,a,"u")},state:function(c,a){return b.commands.formatInline.state(c,a,"u")},value:function(){}}})(wysihtml5);
|
||||
(function(b){var c='<span id="_wysihtml5-undo" class="_wysihtml5-temp">'+b.INVISIBLE_SPACE+"</span>",a='<span id="_wysihtml5-redo" class="_wysihtml5-temp">'+b.INVISIBLE_SPACE+"</span>",d=b.dom;b.UndoManager=b.lang.Dispatcher.extend({constructor:function(a){this.editor=a;this.composer=a.composer;this.element=this.composer.element;this.history=[this.composer.getValue()];this.position=1;this.composer.commands.support("insertHTML")&&this._observe()},_observe:function(){var e=this,f=this.composer.sandbox.getDocument(),
|
||||
g;d.observe(this.element,"keydown",function(a){if(!(a.altKey||!a.ctrlKey&&!a.metaKey)){var b=a.keyCode,c=90===b&&a.shiftKey||89===b;90===b&&!a.shiftKey?(e.undo(),a.preventDefault()):c&&(e.redo(),a.preventDefault())}});d.observe(this.element,"keydown",function(a){a=a.keyCode;a!==g&&(g=a,(8===a||46===a)&&e.transact())});if(b.browser.hasUndoInContextMenu()){var i,h,k=function(){for(var a;a=f.querySelector("._wysihtml5-temp");)a.parentNode.removeChild(a);clearInterval(i)};d.observe(this.element,"contextmenu",
|
||||
function(){k();e.composer.selection.executeAndRestoreSimple(function(){e.element.lastChild&&e.composer.selection.setAfter(e.element.lastChild);f.execCommand("insertHTML",!1,c);f.execCommand("insertHTML",!1,a);f.execCommand("undo",!1,null)});i=setInterval(function(){f.getElementById("_wysihtml5-redo")?(k(),e.redo()):f.getElementById("_wysihtml5-undo")||(k(),e.undo())},400);h||(h=!0,d.observe(document,"mousedown",k),d.observe(f,["mousedown","paste","cut","copy"],k))})}this.editor.observe("newword:composer",
|
||||
function(){e.transact()}).observe("beforecommand:composer",function(){e.transact()})},transact:function(){var a=this.history[this.position-1],b=this.composer.getValue();if(b!=a){if(40<(this.history.length=this.position))this.history.shift(),this.position--;this.position++;this.history.push(b)}},undo:function(){this.transact();1>=this.position||(this.set(this.history[--this.position-1]),this.editor.fire("undo:composer"))},redo:function(){this.position>=this.history.length||(this.set(this.history[++this.position-
|
||||
1]),this.editor.fire("redo:composer"))},set:function(a){this.composer.setValue(a);this.editor.focus(!0)}})})(wysihtml5);
|
||||
wysihtml5.views.View=Base.extend({constructor:function(b,c,a){this.parent=b;this.element=c;this.config=a;this._observeViewChange()},_observeViewChange:function(){var b=this;this.parent.observe("beforeload",function(){b.parent.observe("change_view",function(c){c===b.name?(b.parent.currentView=b,b.show(),setTimeout(function(){b.focus()},0)):b.hide()})})},focus:function(){if(this.element.ownerDocument.querySelector(":focus")!==this.element)try{this.element.focus()}catch(b){}},hide:function(){this.element.style.display=
|
||||
"none"},show:function(){this.element.style.display=""},disable:function(){this.element.setAttribute("disabled","disabled")},enable:function(){this.element.removeAttribute("disabled")}});
|
||||
(function(b){var c=b.dom,a=b.browser;b.views.Composer=b.views.View.extend({name:"composer",CARET_HACK:"<br>",constructor:function(a,b,c){this.base(a,b,c);this.textarea=this.parent.textarea;this._initSandbox()},clear:function(){this.element.innerHTML=a.displaysCaretInEmptyContentEditableCorrectly()?"":this.CARET_HACK},getValue:function(a){var c=this.isEmpty()?"":b.quirks.getCorrectInnerHTML(this.element);a&&(c=this.parent.parse(c));return c=b.lang.string(c).replace(b.INVISIBLE_SPACE).by("")},setValue:function(a,
|
||||
b){b&&(a=this.parent.parse(a));this.element.innerHTML=a},show:function(){this.iframe.style.display=this._displayStyle||"";this.disable();this.enable()},hide:function(){this._displayStyle=c.getStyle("display").from(this.iframe);"none"===this._displayStyle&&(this._displayStyle=null);this.iframe.style.display="none"},disable:function(){this.element.removeAttribute("contentEditable");this.base()},enable:function(){this.element.setAttribute("contentEditable","true");this.base()},focus:function(a){b.browser.doesAsyncFocus()&&
|
||||
this.hasPlaceholderSet()&&this.clear();this.base();var c=this.element.lastChild;a&&c&&("BR"===c.nodeName?this.selection.setBefore(this.element.lastChild):this.selection.setAfter(this.element.lastChild))},getTextContent:function(){return c.getTextContent(this.element)},hasPlaceholderSet:function(){return this.getTextContent()==this.textarea.element.getAttribute("placeholder")},isEmpty:function(){var a=this.element.innerHTML;return""===a||a===this.CARET_HACK||this.hasPlaceholderSet()||""===this.getTextContent()&&
|
||||
!this.element.querySelector("blockquote, ul, ol, img, embed, object, table, iframe, svg, video, audio, button, input, select, textarea")},_initSandbox:function(){var a=this;this.sandbox=new c.Sandbox(function(){a._create()},{stylesheets:this.config.stylesheets});this.iframe=this.sandbox.getIframe();var b=document.createElement("input");b.type="hidden";b.name="_wysihtml5_mode";b.value=1;var f=this.textarea.element;c.insert(this.iframe).after(f);c.insert(b).after(f)},_create:function(){var d=this;this.doc=
|
||||
this.sandbox.getDocument();this.element=this.doc.body;this.textarea=this.parent.textarea;this.element.innerHTML=this.textarea.getValue(!0);this.enable();this.selection=new b.Selection(this.parent);this.commands=new b.Commands(this.parent);c.copyAttributes("className spellcheck title lang dir accessKey".split(" ")).from(this.textarea.element).to(this.element);c.addClass(this.element,this.config.composerClassName);this.config.style&&this.style();this.observe();var e=this.config.name;e&&(c.addClass(this.element,
|
||||
e),c.addClass(this.iframe,e));(e="string"===typeof this.config.placeholder?this.config.placeholder:this.textarea.element.getAttribute("placeholder"))&&c.simulatePlaceholder(this.parent,this,e);this.commands.exec("styleWithCSS",!1);this._initAutoLinking();this._initObjectResizing();this._initUndoManager();(this.textarea.element.hasAttribute("autofocus")||document.querySelector(":focus")==this.textarea.element)&&setTimeout(function(){d.focus()},100);b.quirks.insertLineBreakOnReturn(this);a.clearsContentEditableCorrectly()||
|
||||
b.quirks.ensureProperClearing(this);a.clearsListsInContentEditableCorrectly()||b.quirks.ensureProperClearingOfLists(this);this.initSync&&this.config.sync&&this.initSync();this.textarea.hide();this.parent.fire("beforeload").fire("load")},_initAutoLinking:function(){var d=this,e=a.canDisableAutoLinking(),f=a.doesAutoLinkingInContentEditable();e&&this.commands.exec("autoUrlDetect",!1);if(this.config.autoLink){(!f||f&&e)&&this.parent.observe("newword:composer",function(){d.selection.executeAndRestore(function(a,
|
||||
b){c.autoLink(b.parentNode)})});var g=this.sandbox.getDocument().getElementsByTagName("a"),i=c.autoLink.URL_REG_EXP,h=function(a){a=b.lang.string(c.getTextContent(a)).trim();"www."===a.substr(0,4)&&(a="http://"+a);return a};c.observe(this.element,"keydown",function(a){if(g.length){var a=d.selection.getSelectedNode(a.target.ownerDocument),b=c.getParentElement(a,{nodeName:"A"},4),e;b&&(e=h(b),setTimeout(function(){var a=h(b);a!==e&&a.match(i)&&b.setAttribute("href",a)},0))}})}},_initObjectResizing:function(){var d=
|
||||
["width","height"],e=d.length,f=this.element;this.commands.exec("enableObjectResizing",this.config.allowObjectResizing);this.config.allowObjectResizing?a.supportsEvent("resizeend")&&c.observe(f,"resizeend",function(a){for(var a=a.target||a.srcElement,c=a.style,h=0,k;h<e;h++)k=d[h],c[k]&&(a.setAttribute(k,parseInt(c[k],10)),c[k]="");b.quirks.redraw(f)}):a.supportsEvent("resizestart")&&c.observe(f,"resizestart",function(a){a.preventDefault()})},_initUndoManager:function(){new b.UndoManager(this.parent)}})})(wysihtml5);
|
||||
(function(b){var c=b.dom,a=document,d=window,e=a.createElement("div"),f="background-color color cursor font-family font-size font-style font-variant font-weight line-height letter-spacing text-align text-decoration text-indent text-rendering word-break word-wrap word-spacing".split(" "),g="background-color border-collapse border-bottom-color border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-style border-top-width clear display float margin-bottom margin-left margin-right margin-top outline-color outline-offset outline-width outline-style padding-left padding-right padding-top padding-bottom position top left right bottom z-index vertical-align text-align -webkit-box-sizing -moz-box-sizing -ms-box-sizing box-sizing -webkit-box-shadow -moz-box-shadow -ms-box-shadow box-shadow -webkit-border-top-right-radius -moz-border-radius-topright border-top-right-radius -webkit-border-bottom-right-radius -moz-border-radius-bottomright border-bottom-right-radius -webkit-border-bottom-left-radius -moz-border-radius-bottomleft border-bottom-left-radius -webkit-border-top-left-radius -moz-border-radius-topleft border-top-left-radius width height".split(" "),
|
||||
i="width height top left right bottom".split(" "),h=["html { height: 100%; }","body { min-height: 100%; padding: 0; margin: 0; margin-top: -1px; padding-top: 1px; }","._wysihtml5-temp { display: none; }",b.browser.isGecko?"body.placeholder { color: graytext !important; }":"body.placeholder { color: #a9a9a9 !important; }","body[disabled] { background-color: #eee !important; color: #999 !important; cursor: default !important; }","img:-moz-broken { -moz-force-broken-image-icon: 1; height: 24px; width: 24px; }"],
|
||||
k=function(b){if(b.setActive)try{b.setActive()}catch(e){}else{var f=b.style,h=a.documentElement.scrollTop||a.body.scrollTop,g=a.documentElement.scrollLeft||a.body.scrollLeft,f={position:f.position,top:f.top,left:f.left,WebkitUserSelect:f.WebkitUserSelect};c.setStyles({position:"absolute",top:"-99999px",left:"-99999px",WebkitUserSelect:"none"}).on(b);b.focus();c.setStyles(f).on(b);d.scrollTo&&d.scrollTo(g,h)}};b.views.Composer.prototype.style=function(){var j=this,n=a.querySelector(":focus"),p=this.textarea.element,
|
||||
q=p.hasAttribute("placeholder"),r=q&&p.getAttribute("placeholder");this.focusStylesHost=this.focusStylesHost||e.cloneNode(!1);this.blurStylesHost=this.blurStylesHost||e.cloneNode(!1);q&&p.removeAttribute("placeholder");p===n&&p.blur();c.copyStyles(g).from(p).to(this.iframe).andTo(this.blurStylesHost);c.copyStyles(f).from(p).to(this.element).andTo(this.blurStylesHost);c.insertCSS(h).into(this.element.ownerDocument);k(p);c.copyStyles(g).from(p).to(this.focusStylesHost);c.copyStyles(f).from(p).to(this.focusStylesHost);
|
||||
var m=b.lang.array(g).without(["display"]);n?n.focus():p.blur();q&&p.setAttribute("placeholder",r);if(!b.browser.hasCurrentStyleProperty())var s=c.observe(d,"resize",function(){if(c.contains(document.documentElement,j.iframe)){var a=c.getStyle("display").from(p),b=c.getStyle("display").from(j.iframe);p.style.display="";j.iframe.style.display="none";c.copyStyles(i).from(p).to(j.iframe).andTo(j.focusStylesHost).andTo(j.blurStylesHost);j.iframe.style.display=b;p.style.display=a}else s.stop()});this.parent.observe("focus:composer",
|
||||
function(){c.copyStyles(m).from(j.focusStylesHost).to(j.iframe);c.copyStyles(f).from(j.focusStylesHost).to(j.element)});this.parent.observe("blur:composer",function(){c.copyStyles(m).from(j.blurStylesHost).to(j.iframe);c.copyStyles(f).from(j.blurStylesHost).to(j.element)});return this}})(wysihtml5);
|
||||
(function(b){var c=b.dom,a=b.browser,d={66:"bold",73:"italic",85:"underline"};b.views.Composer.prototype.observe=function(){var e=this,f=this.getValue(),g=this.sandbox.getIframe(),i=this.element,h=a.supportsEventsInIframeCorrectly()?i:this.sandbox.getWindow(),k=a.supportsEvent("drop")?["drop","paste"]:["dragdrop","paste"];c.observe(g,"DOMNodeRemoved",function(){clearInterval(j);e.parent.fire("destroy:composer")});var j=setInterval(function(){c.contains(document.documentElement,g)||(clearInterval(j),
|
||||
e.parent.fire("destroy:composer"))},250);c.observe(h,"focus",function(){e.parent.fire("focus").fire("focus:composer");setTimeout(function(){f=e.getValue()},0)});c.observe(h,"blur",function(){f!==e.getValue()&&e.parent.fire("change").fire("change:composer");e.parent.fire("blur").fire("blur:composer")});b.browser.isIos()&&c.observe(i,"blur",function(){var a=i.ownerDocument.createElement("input"),b=document.documentElement.scrollTop||document.body.scrollTop,c=document.documentElement.scrollLeft||document.body.scrollLeft;
|
||||
try{e.selection.insertNode(a)}catch(d){i.appendChild(a)}a.focus();a.parentNode.removeChild(a);window.scrollTo(c,b)});c.observe(i,"dragenter",function(){e.parent.fire("unset_placeholder")});a.firesOnDropOnlyWhenOnDragOverIsCancelled()&&c.observe(i,["dragover","dragenter"],function(a){a.preventDefault()});c.observe(i,k,function(b){var c=b.dataTransfer,d;c&&a.supportsDataTransfer()&&(d=c.getData("text/html")||c.getData("text/plain"));d?(i.focus(),e.commands.exec("insertHTML",d),e.parent.fire("paste").fire("paste:composer"),
|
||||
b.stopPropagation(),b.preventDefault()):setTimeout(function(){e.parent.fire("paste").fire("paste:composer")},0)});c.observe(i,"keyup",function(a){a=a.keyCode;(a===b.SPACE_KEY||a===b.ENTER_KEY)&&e.parent.fire("newword:composer")});this.parent.observe("paste:composer",function(){setTimeout(function(){e.parent.fire("newword:composer")},0)});a.canSelectImagesInContentEditable()||c.observe(i,"mousedown",function(a){var b=a.target;"IMG"===b.nodeName&&(e.selection.selectNode(b),a.preventDefault())});c.observe(i,
|
||||
"keydown",function(a){var b=d[a.keyCode];if((a.ctrlKey||a.metaKey)&&!a.altKey&&b)e.commands.exec(b),a.preventDefault()});c.observe(i,"keydown",function(a){var c=e.selection.getSelectedNode(!0),d=a.keyCode;if(c&&"IMG"===c.nodeName&&(d===b.BACKSPACE_KEY||d===b.DELETE_KEY))d=c.parentNode,d.removeChild(c),"A"===d.nodeName&&!d.firstChild&&d.parentNode.removeChild(d),setTimeout(function(){b.quirks.redraw(i)},0),a.preventDefault()});var n={IMG:"Image: ",A:"Link: "};c.observe(i,"mouseover",function(a){var a=
|
||||
a.target,b=a.nodeName;!("A"!==b&&"IMG"!==b)&&!a.hasAttribute("title")&&(b=n[b]+(a.getAttribute("href")||a.getAttribute("src")),a.setAttribute("title",b))})}})(wysihtml5);
|
||||
(function(b){b.views.Synchronizer=Base.extend({constructor:function(b,a,d){this.editor=b;this.textarea=a;this.composer=d;this._observe()},fromComposerToTextarea:function(c){this.textarea.setValue(b.lang.string(this.composer.getValue()).trim(),c)},fromTextareaToComposer:function(b){var a=this.textarea.getValue();a?this.composer.setValue(a,b):(this.composer.clear(),this.editor.fire("set_placeholder"))},sync:function(b){"textarea"===this.editor.currentView.name?this.fromTextareaToComposer(b):this.fromComposerToTextarea(b)},
|
||||
_observe:function(){var c,a=this,d=this.textarea.element.form,e=function(){c=setInterval(function(){a.fromComposerToTextarea()},400)},f=function(){clearInterval(c);c=null};e();d&&(b.dom.observe(d,"submit",function(){a.sync(!0)}),b.dom.observe(d,"reset",function(){setTimeout(function(){a.fromTextareaToComposer()},0)}));this.editor.observe("change_view",function(b){if(b==="composer"&&!c){a.fromTextareaToComposer(true);e()}else if(b==="textarea"){a.fromComposerToTextarea(true);f()}});this.editor.observe("destroy:composer",
|
||||
f)}})})(wysihtml5);
|
||||
wysihtml5.views.Textarea=wysihtml5.views.View.extend({name:"textarea",constructor:function(b,c,a){this.base(b,c,a);this._observe()},clear:function(){this.element.value=""},getValue:function(b){var c=this.isEmpty()?"":this.element.value;b&&(c=this.parent.parse(c));return c},setValue:function(b,c){c&&(b=this.parent.parse(b));this.element.value=b},hasPlaceholderSet:function(){var b=wysihtml5.browser.supportsPlaceholderAttributeOn(this.element),c=this.element.getAttribute("placeholder")||null,a=this.element.value;
|
||||
return b&&!a||a===c},isEmpty:function(){return!wysihtml5.lang.string(this.element.value).trim()||this.hasPlaceholderSet()},_observe:function(){var b=this.element,c=this.parent,a={focusin:"focus",focusout:"blur"},d=wysihtml5.browser.supportsEvent("focusin")?["focusin","focusout","change"]:["focus","blur","change"];c.observe("beforeload",function(){wysihtml5.dom.observe(b,d,function(b){b=a[b.type]||b.type;c.fire(b).fire(b+":textarea")});wysihtml5.dom.observe(b,["paste","drop"],function(){setTimeout(function(){c.fire("paste").fire("paste:textarea")},
|
||||
0)})})}});
|
||||
(function(b){var c=b.dom;b.toolbar.Dialog=b.lang.Dispatcher.extend({constructor:function(a,b){this.link=a;this.container=b},_observe:function(){if(!this._observed){var a=this,d=function(b){var c=a._serialize();c==a.elementToChange?a.fire("edit",c):a.fire("save",c);a.hide();b.preventDefault();b.stopPropagation()};c.observe(a.link,"click",function(){c.hasClass(a.link,"wysihtml5-command-dialog-opened")&&setTimeout(function(){a.hide()},0)});c.observe(this.container,"keydown",function(c){var e=c.keyCode;
|
||||
e===b.ENTER_KEY&&d(c);e===b.ESCAPE_KEY&&a.hide()});c.delegate(this.container,"[data-wysihtml5-dialog-action=save]","click",d);c.delegate(this.container,"[data-wysihtml5-dialog-action=cancel]","click",function(b){a.fire("cancel");a.hide();b.preventDefault();b.stopPropagation()});for(var e=this.container.querySelectorAll("input, select, textarea"),f=0,g=e.length,i=function(){clearInterval(a.interval)};f<g;f++)c.observe(e[f],"change",i);this._observed=!0}},_serialize:function(){for(var a=this.elementToChange||
|
||||
{},b=this.container.querySelectorAll("[data-wysihtml5-dialog-field]"),c=b.length,f=0;f<c;f++)a[b[f].getAttribute("data-wysihtml5-dialog-field")]=b[f].value;return a},_interpolate:function(a){for(var b,c,f=document.querySelector(":focus"),g=this.container.querySelectorAll("[data-wysihtml5-dialog-field]"),i=g.length,h=0;h<i;h++)b=g[h],b!==f&&!(a&&"hidden"===b.type)&&(c=b.getAttribute("data-wysihtml5-dialog-field"),c=this.elementToChange?this.elementToChange[c]||"":b.defaultValue,b.value=c)},show:function(a){var b=
|
||||
this,e=this.container.querySelector("input, select, textarea");this.elementToChange=a;this._observe();this._interpolate();a&&(this.interval=setInterval(function(){b._interpolate(!0)},500));c.addClass(this.link,"wysihtml5-command-dialog-opened");this.container.style.display="";this.fire("show");if(e&&!a)try{e.focus()}catch(f){}},hide:function(){clearInterval(this.interval);this.elementToChange=null;c.removeClass(this.link,"wysihtml5-command-dialog-opened");this.container.style.display="none";this.fire("hide")}})})(wysihtml5);
|
||||
(function(b){var c=b.dom,a={position:"relative"},d={left:0,margin:0,opacity:0,overflow:"hidden",padding:0,position:"absolute",top:0,zIndex:1},e={cursor:"inherit",fontSize:"50px",height:"50px",marginTop:"-25px",outline:0,padding:0,position:"absolute",right:"-4px",top:"50%"},f={"x-webkit-speech":"",speech:""};b.toolbar.Speech=function(g,i){var h=document.createElement("input");if(b.browser.supportsSpeechApiOn(h)){var k=document.createElement("div");b.lang.object(d).merge({width:i.offsetWidth+"px",height:i.offsetHeight+
|
||||
"px"});c.insert(h).into(k);c.insert(k).into(i);c.setStyles(e).on(h);c.setAttributes(f).on(h);c.setStyles(d).on(k);c.setStyles(a).on(i);c.observe(h,"onwebkitspeechchange"in h?"webkitspeechchange":"speechchange",function(){g.execCommand("insertText",h.value);h.value=""});c.observe(h,"click",function(a){c.hasClass(i,"wysihtml5-command-disabled")&&a.preventDefault();a.stopPropagation()})}else i.style.display="none"}})(wysihtml5);
|
||||
(function(b){var c=b.dom;b.toolbar.Toolbar=Base.extend({constructor:function(a,c){this.editor=a;this.container="string"===typeof c?document.getElementById(c):c;this.composer=a.composer;this._getLinks("command");this._getLinks("action");this._observe();this.show();for(var e=this.container.querySelectorAll("[data-wysihtml5-command=insertSpeech]"),f=e.length,g=0;g<f;g++)new b.toolbar.Speech(this,e[g])},_getLinks:function(a){for(var c=this[a+"Links"]=b.lang.array(this.container.querySelectorAll("[data-wysihtml5-"+
|
||||
a+"]")).get(),e=c.length,f=0,g=this[a+"Mapping"]={},i,h,k,j,n;f<e;f++)i=c[f],k=i.getAttribute("data-wysihtml5-"+a),j=i.getAttribute("data-wysihtml5-"+a+"-value"),h=this.container.querySelector("[data-wysihtml5-"+a+"-group='"+k+"']"),n=this._getDialog(i,k),g[k+":"+j]={link:i,group:h,name:k,value:j,dialog:n,state:!1}},_getDialog:function(a,c){var e=this,f=this.container.querySelector("[data-wysihtml5-dialog='"+c+"']"),g,i;f&&(g=new b.toolbar.Dialog(a,f),g.observe("show",function(){i=e.composer.selection.getBookmark();
|
||||
e.editor.fire("show:dialog",{command:c,dialogContainer:f,commandLink:a})}),g.observe("save",function(b){i&&e.composer.selection.setBookmark(i);e._execCommand(c,b);e.editor.fire("save:dialog",{command:c,dialogContainer:f,commandLink:a})}),g.observe("cancel",function(){e.editor.focus(!1);e.editor.fire("cancel:dialog",{command:c,dialogContainer:f,commandLink:a})}));return g},execCommand:function(a,b){if(!this.commandsDisabled){var c=this.commandMapping[a+":"+b];c&&c.dialog&&!c.state?c.dialog.show():
|
||||
this._execCommand(a,b)}},_execCommand:function(a,b){this.editor.focus(!1);this.composer.commands.exec(a,b);this._updateLinkStates()},execAction:function(a){var b=this.editor;switch(a){case "change_view":b.currentView===b.textarea?b.fire("change_view","composer"):b.fire("change_view","textarea")}},_observe:function(){for(var a=this,b=this.editor,e=this.container,f=this.commandLinks.concat(this.actionLinks),g=f.length,i=0;i<g;i++)c.setAttributes({href:"javascript:;",unselectable:"on"}).on(f[i]);c.delegate(e,
|
||||
"[data-wysihtml5-command]","mousedown",function(a){a.preventDefault()});c.delegate(e,"[data-wysihtml5-command]","click",function(b){var c=this.getAttribute("data-wysihtml5-command"),d=this.getAttribute("data-wysihtml5-command-value");a.execCommand(c,d);b.preventDefault()});c.delegate(e,"[data-wysihtml5-action]","click",function(b){var c=this.getAttribute("data-wysihtml5-action");a.execAction(c);b.preventDefault()});b.observe("focus:composer",function(){a.bookmark=null;clearInterval(a.interval);a.interval=
|
||||
setInterval(function(){a._updateLinkStates()},500)});b.observe("blur:composer",function(){clearInterval(a.interval)});b.observe("destroy:composer",function(){clearInterval(a.interval)});b.observe("change_view",function(b){setTimeout(function(){a.commandsDisabled="composer"!==b;a._updateLinkStates();a.commandsDisabled?c.addClass(e,"wysihtml5-commands-disabled"):c.removeClass(e,"wysihtml5-commands-disabled")},0)})},_updateLinkStates:function(){var a=this.commandMapping,d=this.actionMapping,e,f,g;for(e in a)if(g=
|
||||
a[e],this.commandsDisabled?(f=!1,c.removeClass(g.link,"wysihtml5-command-active"),g.group&&c.removeClass(g.group,"wysihtml5-command-active"),g.dialog&&g.dialog.hide()):(f=this.composer.commands.state(g.name,g.value),b.lang.object(f).isArray()&&(f=1===f.length?f[0]:!0),c.removeClass(g.link,"wysihtml5-command-disabled"),g.group&&c.removeClass(g.group,"wysihtml5-command-disabled")),g.state!==f)(g.state=f)?(c.addClass(g.link,"wysihtml5-command-active"),g.group&&c.addClass(g.group,"wysihtml5-command-active"),
|
||||
g.dialog&&("object"===typeof f?g.dialog.show(f):g.dialog.hide())):(c.removeClass(g.link,"wysihtml5-command-active"),g.group&&c.removeClass(g.group,"wysihtml5-command-active"),g.dialog&&g.dialog.hide());for(e in d)a=d[e],"change_view"===a.name&&(a.state=this.editor.currentView===this.editor.textarea,a.state?c.addClass(a.link,"wysihtml5-action-active"):c.removeClass(a.link,"wysihtml5-action-active"))},show:function(){this.container.style.display=""},hide:function(){this.container.style.display="none"}})})(wysihtml5);
|
||||
(function(b){var c={name:void 0,style:!0,toolbar:void 0,autoLink:!0,parserRules:{tags:{br:{},span:{},div:{},p:{}},classes:{}},parser:b.dom.parse,composerClassName:"wysihtml5-editor",bodyClassName:"wysihtml5-supported",stylesheets:[],placeholderText:void 0,allowObjectResizing:!0,supportTouchDevices:!0};b.Editor=b.lang.Dispatcher.extend({constructor:function(a,d){this.textareaElement="string"===typeof a?document.getElementById(a):a;this.config=b.lang.object({}).merge(c).merge(d).get();this.currentView=
|
||||
this.textarea=new b.views.Textarea(this,this.textareaElement,this.config);this._isCompatible=b.browser.supported();if(!this._isCompatible||!this.config.supportTouchDevices&&b.browser.isTouchDevice()){var e=this;setTimeout(function(){e.fire("beforeload").fire("load")},0)}else{b.dom.addClass(document.body,this.config.bodyClassName);this.currentView=this.composer=new b.views.Composer(this,this.textareaElement,this.config);"function"===typeof this.config.parser&&this._initParser();this.observe("beforeload",
|
||||
function(){this.synchronizer=new b.views.Synchronizer(this,this.textarea,this.composer);this.config.toolbar&&(this.toolbar=new b.toolbar.Toolbar(this,this.config.toolbar))});try{console.log("Heya! This page is using wysihtml5 for rich text editing. Check out https://github.com/xing/wysihtml5")}catch(f){}}},isCompatible:function(){return this._isCompatible},clear:function(){this.currentView.clear();return this},getValue:function(a){return this.currentView.getValue(a)},setValue:function(a,b){if(!a)return this.clear();
|
||||
this.currentView.setValue(a,b);return this},focus:function(a){this.currentView.focus(a);return this},disable:function(){this.currentView.disable();return this},enable:function(){this.currentView.enable();return this},isEmpty:function(){return this.currentView.isEmpty()},hasPlaceholderSet:function(){return this.currentView.hasPlaceholderSet()},parse:function(a){var c=this.config.parser(a,this.config.parserRules,this.composer.sandbox.getDocument(),!0);"object"===typeof a&&b.quirks.redraw(a);return c},
|
||||
_initParser:function(){this.observe("paste:composer",function(){var a=this;a.composer.selection.executeAndRestore(function(){b.quirks.cleanPastedHTML(a.composer.element);a.parse(a.composer.element)},!0)});this.observe("paste:textarea",function(){this.textarea.setValue(this.parse(this.textarea.getValue()))})}})})(wysihtml5);
|
67
dist/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/wysiwyg-color.css
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
.wysiwyg-color-black {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.wysiwyg-color-silver {
|
||||
color: silver;
|
||||
}
|
||||
|
||||
.wysiwyg-color-gray {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
.wysiwyg-color-white {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.wysiwyg-color-maroon {
|
||||
color: maroon;
|
||||
}
|
||||
|
||||
.wysiwyg-color-red {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.wysiwyg-color-purple {
|
||||
color: purple;
|
||||
}
|
||||
|
||||
.wysiwyg-color-fuchsia {
|
||||
color: fuchsia;
|
||||
}
|
||||
|
||||
.wysiwyg-color-green {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.wysiwyg-color-lime {
|
||||
color: lime;
|
||||
}
|
||||
|
||||
.wysiwyg-color-olive {
|
||||
color: olive;
|
||||
}
|
||||
|
||||
.wysiwyg-color-yellow {
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.wysiwyg-color-navy {
|
||||
color: navy;
|
||||
}
|
||||
|
||||
.wysiwyg-color-blue {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.wysiwyg-color-teal {
|
||||
color: teal;
|
||||
}
|
||||
|
||||
.wysiwyg-color-aqua {
|
||||
color: aqua;
|
||||
}
|
||||
|
||||
.wysiwyg-color-orange {
|
||||
color: orange;
|
||||
}
|
124
dist/inputs-ext/wysihtml5/wysihtml5.js
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
/**
|
||||
Bootstrap wysihtml5 editor. Based on [bootstrap-wysihtml5](https://github.com/jhollingworth/bootstrap-wysihtml5).
|
||||
You should include this input **manually** with dependent js and css files from `inputs-ext` directory.
|
||||
|
||||
<link href="js/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/bootstrap-wysihtml5-0.0.2.css" rel="stylesheet" type="text/css"></link>
|
||||
<script src="js/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/wysihtml5-0.3.0.min.js"></script>
|
||||
<script src="js/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/bootstrap-wysihtml5-0.0.2.min.js"></script>
|
||||
<script src="js/inputs-ext/wysihtml5/wysihtml5.js"></script>
|
||||
|
||||
**Note:** It's better to use fresh bootstrap-wysihtml5 from it's [master branch](https://github.com/jhollingworth/bootstrap-wysihtml5/tree/master/src) as there is update for correct image insertion.
|
||||
|
||||
@class wysihtml5
|
||||
@extends abstractinput
|
||||
@final
|
||||
@since 1.4.0
|
||||
@example
|
||||
<div id="comments" data-type="wysihtml5" data-pk="1"><h2>awesome</h2> comment!</div>
|
||||
<script>
|
||||
$(function(){
|
||||
$('#comments').editable({
|
||||
url: '/post',
|
||||
title: 'Enter comments'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
**/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
var Wysihtml5 = function (options) {
|
||||
this.init('wysihtml5', options, Wysihtml5.defaults);
|
||||
|
||||
//extend wysihtml5 manually as $.extend not recursive
|
||||
this.options.wysihtml5 = $.extend({}, Wysihtml5.defaults.wysihtml5, options.wysihtml5);
|
||||
};
|
||||
|
||||
$.fn.editableutils.inherit(Wysihtml5, $.fn.editabletypes.abstractinput);
|
||||
|
||||
$.extend(Wysihtml5.prototype, {
|
||||
render: function () {
|
||||
var deferred = $.Deferred(),
|
||||
msieOld;
|
||||
|
||||
//generate unique id as it required for wysihtml5
|
||||
this.$input.attr('id', 'textarea_'+(new Date()).getTime());
|
||||
|
||||
this.setClass();
|
||||
this.setAttr('placeholder');
|
||||
|
||||
//resolve deffered when widget loaded
|
||||
$.extend(this.options.wysihtml5, {
|
||||
events: {
|
||||
load: function() {
|
||||
deferred.resolve();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.$input.wysihtml5(this.options.wysihtml5);
|
||||
|
||||
/*
|
||||
In IE8 wysihtml5 iframe stays on the same line with buttons toolbar (inside popover).
|
||||
The only solution I found is to add <br>. If you fine better way, please send PR.
|
||||
*/
|
||||
msieOld = /msie\s*(8|7|6)/.test(navigator.userAgent.toLowerCase());
|
||||
if(msieOld) {
|
||||
this.$input.before('<br><br>');
|
||||
}
|
||||
|
||||
return deferred.promise();
|
||||
},
|
||||
|
||||
value2html: function(value, element) {
|
||||
$(element).html(value);
|
||||
},
|
||||
|
||||
html2value: function(html) {
|
||||
return html;
|
||||
},
|
||||
|
||||
value2input: function(value) {
|
||||
this.$input.data("wysihtml5").editor.setValue(value, true);
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
this.$input.data("wysihtml5").editor.focus();
|
||||
}
|
||||
});
|
||||
|
||||
Wysihtml5.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
|
||||
/**
|
||||
@property tpl
|
||||
@default <textarea></textarea>
|
||||
**/
|
||||
tpl:'<textarea></textarea>',
|
||||
/**
|
||||
@property inputclass
|
||||
@default editable-wysihtml5
|
||||
**/
|
||||
inputclass: 'editable-wysihtml5',
|
||||
/**
|
||||
Placeholder attribute of input. Shown when input is empty.
|
||||
|
||||
@property placeholder
|
||||
@type string
|
||||
@default null
|
||||
**/
|
||||
placeholder: null,
|
||||
/**
|
||||
Wysihtml5 default options.
|
||||
See https://github.com/jhollingworth/bootstrap-wysihtml5#options
|
||||
|
||||
@property wysihtml5
|
||||
@type object
|
||||
@default {stylesheets: false}
|
||||
**/
|
||||
wysihtml5: {
|
||||
stylesheets: false //see https://github.com/jhollingworth/bootstrap-wysihtml5/issues/183
|
||||
}
|
||||
});
|
||||
|
||||
$.fn.editabletypes.wysihtml5 = Wysihtml5;
|
||||
|
||||
}(window.jQuery));
|
201
dist/jquery-editable/css/jquery-editable.css
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
/*! X-editable - v1.4.5
|
||||
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
||||
* http://github.com/vitalets/x-editable
|
||||
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
||||
|
||||
.editableform {
|
||||
margin-bottom: 0; /* overwrites bootstrap margin */
|
||||
}
|
||||
|
||||
.editableform .control-group {
|
||||
margin-bottom: 0; /* overwrites bootstrap margin */
|
||||
white-space: nowrap; /* prevent wrapping buttons on new line */
|
||||
line-height: 20px; /* overwriting bootstrap line-height. See #133 */
|
||||
}
|
||||
|
||||
.editable-buttons {
|
||||
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
|
||||
vertical-align: top;
|
||||
margin-left: 7px;
|
||||
/* inline-block emulation for IE7*/
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
|
||||
.editable-buttons.editable-buttons-bottom {
|
||||
display: block;
|
||||
margin-top: 7px;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.editable-input {
|
||||
vertical-align: top;
|
||||
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
|
||||
width: auto; /* bootstrap-responsive has width: 100% that breakes layout */
|
||||
white-space: normal; /* reset white-space decalred in parent*/
|
||||
/* display-inline emulation for IE7*/
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
|
||||
.editable-buttons .editable-cancel {
|
||||
margin-left: 7px;
|
||||
}
|
||||
|
||||
/*for jquery-ui buttons need set height to look more pretty*/
|
||||
.editable-buttons button.ui-button-icon-only {
|
||||
height: 24px;
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
.editableform-loading {
|
||||
background: url('../img/loading.gif') center center no-repeat;
|
||||
height: 25px;
|
||||
width: auto;
|
||||
min-width: 25px;
|
||||
}
|
||||
|
||||
.editable-inline .editableform-loading {
|
||||
background-position: left 5px;
|
||||
}
|
||||
|
||||
.editable-error-block {
|
||||
max-width: 300px;
|
||||
margin: 5px 0 0 0;
|
||||
width: auto;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
/*add padding for jquery ui*/
|
||||
.editable-error-block.ui-state-error {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.editable-error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/* ---- For specific types ---- */
|
||||
|
||||
.editableform .editable-date {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
float: left;
|
||||
}
|
||||
|
||||
/* move datepicker icon to center of add-on button. See https://github.com/vitalets/x-editable/issues/183 */
|
||||
.editable-inline .add-on .icon-th {
|
||||
margin-top: 3px;
|
||||
margin-left: 1px;
|
||||
}
|
||||
|
||||
|
||||
/* checklist vertical alignment */
|
||||
.editable-checklist label input[type="checkbox"],
|
||||
.editable-checklist label span {
|
||||
vertical-align: middle;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.editable-checklist label {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* set exact width of textarea to fit buttons toolbar */
|
||||
.editable-wysihtml5 {
|
||||
width: 566px;
|
||||
height: 250px;
|
||||
}
|
||||
|
||||
/* clear button shown as link in date inputs */
|
||||
.editable-clear {
|
||||
clear: both;
|
||||
font-size: 0.9em;
|
||||
text-decoration: none;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* IOS-style clear button for text inputs */
|
||||
.editable-clear-x {
|
||||
background: url('../img/clear.png') center center no-repeat;
|
||||
display: block;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
position: absolute;
|
||||
opacity: 0.6;
|
||||
z-index: 100;
|
||||
|
||||
top: 50%;
|
||||
right: 6px;
|
||||
margin-top: -6px;
|
||||
|
||||
}
|
||||
|
||||
.editable-clear-x:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
.editable-container.editable-popup {
|
||||
max-width: none !important; /* without this rule poshytip/tooltip does not stretch */
|
||||
}
|
||||
|
||||
.editable-container.popover {
|
||||
width: auto; /* without this rule popover does not stretch */
|
||||
}
|
||||
|
||||
.editable-container.editable-inline {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: auto;
|
||||
/* inline-block emulation for IE7*/
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
|
||||
.editable-container.ui-widget {
|
||||
font-size: inherit; /* jqueryui widget font 1.1em too big, overwrite it */
|
||||
}
|
||||
.editable-click,
|
||||
a.editable-click,
|
||||
a.editable-click:hover {
|
||||
text-decoration: none;
|
||||
border-bottom: dashed 1px #0088cc;
|
||||
}
|
||||
|
||||
.editable-click.editable-disabled,
|
||||
a.editable-click.editable-disabled,
|
||||
a.editable-click.editable-disabled:hover {
|
||||
color: #585858;
|
||||
cursor: default;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.editable-empty, .editable-empty:hover, .editable-empty:focus{
|
||||
font-style: italic;
|
||||
color: #DD1144;
|
||||
/* border-bottom: none; */
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.editable-unsaved {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.editable-unsaved:after {
|
||||
/* content: '*'*/
|
||||
}
|
||||
|
||||
.editable-bg-transition {
|
||||
-webkit-transition: background-color 1400ms ease-out;
|
||||
-moz-transition: background-color 1400ms ease-out;
|
||||
-o-transition: background-color 1400ms ease-out;
|
||||
-ms-transition: background-color 1400ms ease-out;
|
||||
transition: background-color 1400ms ease-out;
|
||||
}
|
||||
|
||||
/*see https://github.com/vitalets/x-editable/issues/139 */
|
||||
.form-horizontal .editable
|
||||
{
|
||||
padding-top: 5px;
|
||||
display:inline-block;
|
||||
}
|
||||
|
BIN
dist/jquery-editable/img/clear.png
vendored
Normal file
After ![]() (image error) Size: 509 B |
BIN
dist/jquery-editable/img/loading.gif
vendored
Normal file
After ![]() (image error) Size: 1.8 KiB |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/animated-overlay.gif
vendored
Normal file
After ![]() (image error) Size: 1.7 KiB |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png
vendored
Normal file
After ![]() (image error) Size: 212 B |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/ui-bg_flat_55_fbec88_40x100.png
vendored
Normal file
After ![]() (image error) Size: 206 B |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png
vendored
Normal file
After ![]() (image error) Size: 336 B |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/ui-bg_glass_85_dfeffc_1x400.png
vendored
Normal file
After ![]() (image error) Size: 341 B |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/ui-bg_glass_95_fef1ec_1x400.png
vendored
Normal file
After ![]() (image error) Size: 332 B |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png
vendored
Normal file
After ![]() (image error) Size: 5.7 KiB |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png
vendored
Normal file
After ![]() (image error) Size: 333 B |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png
vendored
Normal file
After ![]() (image error) Size: 292 B |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/ui-icons_217bc0_256x240.png
vendored
Normal file
After ![]() (image error) Size: 4.4 KiB |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/ui-icons_2e83ff_256x240.png
vendored
Normal file
After ![]() (image error) Size: 4.4 KiB |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/ui-icons_469bdd_256x240.png
vendored
Normal file
After ![]() (image error) Size: 4.4 KiB |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/ui-icons_6da8d5_256x240.png
vendored
Normal file
After ![]() (image error) Size: 4.4 KiB |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/ui-icons_cd0a0a_256x240.png
vendored
Normal file
After ![]() (image error) Size: 4.4 KiB |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/ui-icons_d8e7f3_256x240.png
vendored
Normal file
After ![]() (image error) Size: 4.4 KiB |
BIN
dist/jquery-editable/jquery-ui-datepicker/css/redmond/images/ui-icons_f9bd01_256x240.png
vendored
Normal file
After ![]() (image error) Size: 4.4 KiB |
649
dist/jquery-editable/jquery-ui-datepicker/css/redmond/jquery-ui-1.10.2.custom.css
vendored
Normal file
@ -0,0 +1,649 @@
|
||||
/*! jQuery UI - v1.10.2 - 2013-04-07
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.core.css, jquery.ui.datepicker.css
|
||||
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande%2CLucida%20Sans%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=5px&bgColorHeader=5c9ccc&bgTextureHeader=gloss_wave&bgImgOpacityHeader=55&borderColorHeader=4297d7&fcHeader=ffffff&iconColorHeader=d8e7f3&bgColorContent=fcfdfd&bgTextureContent=inset_hard&bgImgOpacityContent=100&borderColorContent=a6c9e2&fcContent=222222&iconColorContent=469bdd&bgColorDefault=dfeffc&bgTextureDefault=glass&bgImgOpacityDefault=85&borderColorDefault=c5dbec&fcDefault=2e6e9e&iconColorDefault=6da8d5&bgColorHover=d0e5f5&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=79b7e7&fcHover=1d5987&iconColorHover=217bc0&bgColorActive=f5f8f9&bgTextureActive=inset_hard&bgImgOpacityActive=100&borderColorActive=79b7e7&fcActive=e17009&iconColorActive=f9bd01&bgColorHighlight=fbec88&bgTextureHighlight=flat&bgImgOpacityHighlight=55&borderColorHighlight=fad42e&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
|
||||
* Copyright 2013 jQuery Foundation and other contributors Licensed MIT */
|
||||
|
||||
/* Layout helpers
|
||||
----------------------------------*/
|
||||
.ui-helper-hidden {
|
||||
display: none;
|
||||
}
|
||||
.ui-helper-hidden-accessible {
|
||||
border: 0;
|
||||
clip: rect(0 0 0 0);
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
}
|
||||
.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:before,
|
||||
.ui-helper-clearfix:after {
|
||||
content: "";
|
||||
display: table;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.ui-helper-clearfix:after {
|
||||
clear: both;
|
||||
}
|
||||
.ui-helper-clearfix {
|
||||
min-height: 0; /* support: IE7 */
|
||||
}
|
||||
.ui-helper-zfix {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
filter:Alpha(Opacity=0);
|
||||
}
|
||||
|
||||
.ui-front {
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
|
||||
/* 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: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.ui-datepicker {
|
||||
width: 17em;
|
||||
padding: .2em .2em 0;
|
||||
display: none;
|
||||
}
|
||||
.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 {
|
||||
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 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,
|
||||
.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%;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
/* 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,
|
||||
.ui-datepicker-rtl .ui-datepicker-group {
|
||||
float: right;
|
||||
}
|
||||
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
|
||||
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
|
||||
border-right-width: 0;
|
||||
border-left-width: 1px;
|
||||
}
|
||||
|
||||
/* Component containers
|
||||
----------------------------------*/
|
||||
.ui-widget {
|
||||
font-family: Lucida Grande,Lucida Sans,Arial,sans-serif;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
.ui-widget .ui-widget {
|
||||
font-size: 1em;
|
||||
}
|
||||
.ui-widget input,
|
||||
.ui-widget select,
|
||||
.ui-widget textarea,
|
||||
.ui-widget button {
|
||||
font-family: Lucida Grande,Lucida Sans,Arial,sans-serif;
|
||||
font-size: 1em;
|
||||
}
|
||||
.ui-widget-content {
|
||||
border: 1px solid #a6c9e2;
|
||||
background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x;
|
||||
color: #222222;
|
||||
}
|
||||
.ui-widget-content a {
|
||||
color: #222222;
|
||||
}
|
||||
.ui-widget-header {
|
||||
border: 1px solid #4297d7;
|
||||
background: #5c9ccc url(images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
}
|
||||
.ui-widget-header a {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* Interaction states
|
||||
----------------------------------*/
|
||||
.ui-state-default,
|
||||
.ui-widget-content .ui-state-default,
|
||||
.ui-widget-header .ui-state-default {
|
||||
border: 1px solid #c5dbec;
|
||||
background: #dfeffc url(images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x;
|
||||
font-weight: bold;
|
||||
color: #2e6e9e;
|
||||
}
|
||||
.ui-state-default a,
|
||||
.ui-state-default a:link,
|
||||
.ui-state-default a:visited {
|
||||
color: #2e6e9e;
|
||||
text-decoration: none;
|
||||
}
|
||||
.ui-state-hover,
|
||||
.ui-widget-content .ui-state-hover,
|
||||
.ui-widget-header .ui-state-hover,
|
||||
.ui-state-focus,
|
||||
.ui-widget-content .ui-state-focus,
|
||||
.ui-widget-header .ui-state-focus {
|
||||
border: 1px solid #79b7e7;
|
||||
background: #d0e5f5 url(images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x;
|
||||
font-weight: bold;
|
||||
color: #1d5987;
|
||||
}
|
||||
.ui-state-hover a,
|
||||
.ui-state-hover a:hover,
|
||||
.ui-state-hover a:link,
|
||||
.ui-state-hover a:visited {
|
||||
color: #1d5987;
|
||||
text-decoration: none;
|
||||
}
|
||||
.ui-state-active,
|
||||
.ui-widget-content .ui-state-active,
|
||||
.ui-widget-header .ui-state-active {
|
||||
border: 1px solid #79b7e7;
|
||||
background: #f5f8f9 url(images/ui-bg_inset-hard_100_f5f8f9_1x100.png) 50% 50% repeat-x;
|
||||
font-weight: bold;
|
||||
color: #e17009;
|
||||
}
|
||||
.ui-state-active a,
|
||||
.ui-state-active a:link,
|
||||
.ui-state-active a:visited {
|
||||
color: #e17009;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Interaction Cues
|
||||
----------------------------------*/
|
||||
.ui-state-highlight,
|
||||
.ui-widget-content .ui-state-highlight,
|
||||
.ui-widget-header .ui-state-highlight {
|
||||
border: 1px solid #fad42e;
|
||||
background: #fbec88 url(images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x;
|
||||
color: #363636;
|
||||
}
|
||||
.ui-state-highlight a,
|
||||
.ui-widget-content .ui-state-highlight a,
|
||||
.ui-widget-header .ui-state-highlight a {
|
||||
color: #363636;
|
||||
}
|
||||
.ui-state-error,
|
||||
.ui-widget-content .ui-state-error,
|
||||
.ui-widget-header .ui-state-error {
|
||||
border: 1px solid #cd0a0a;
|
||||
background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x;
|
||||
color: #cd0a0a;
|
||||
}
|
||||
.ui-state-error a,
|
||||
.ui-widget-content .ui-state-error a,
|
||||
.ui-widget-header .ui-state-error a {
|
||||
color: #cd0a0a;
|
||||
}
|
||||
.ui-state-error-text,
|
||||
.ui-widget-content .ui-state-error-text,
|
||||
.ui-widget-header .ui-state-error-text {
|
||||
color: #cd0a0a;
|
||||
}
|
||||
.ui-priority-primary,
|
||||
.ui-widget-content .ui-priority-primary,
|
||||
.ui-widget-header .ui-priority-primary {
|
||||
font-weight: bold;
|
||||
}
|
||||
.ui-priority-secondary,
|
||||
.ui-widget-content .ui-priority-secondary,
|
||||
.ui-widget-header .ui-priority-secondary {
|
||||
opacity: .7;
|
||||
filter:Alpha(Opacity=70);
|
||||
font-weight: normal;
|
||||
}
|
||||
.ui-state-disabled,
|
||||
.ui-widget-content .ui-state-disabled,
|
||||
.ui-widget-header .ui-state-disabled {
|
||||
opacity: .35;
|
||||
filter:Alpha(Opacity=35);
|
||||
background-image: none;
|
||||
}
|
||||
.ui-state-disabled .ui-icon {
|
||||
filter:Alpha(Opacity=35); /* For IE8 - See #6059 */
|
||||
}
|
||||
|
||||
/* Icons
|
||||
----------------------------------*/
|
||||
|
||||
/* states and images */
|
||||
.ui-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
.ui-icon,
|
||||
.ui-widget-content .ui-icon {
|
||||
background-image: url(images/ui-icons_469bdd_256x240.png);
|
||||
}
|
||||
.ui-widget-header .ui-icon {
|
||||
background-image: url(images/ui-icons_d8e7f3_256x240.png);
|
||||
}
|
||||
.ui-state-default .ui-icon {
|
||||
background-image: url(images/ui-icons_6da8d5_256x240.png);
|
||||
}
|
||||
.ui-state-hover .ui-icon,
|
||||
.ui-state-focus .ui-icon {
|
||||
background-image: url(images/ui-icons_217bc0_256x240.png);
|
||||
}
|
||||
.ui-state-active .ui-icon {
|
||||
background-image: url(images/ui-icons_f9bd01_256x240.png);
|
||||
}
|
||||
.ui-state-highlight .ui-icon {
|
||||
background-image: url(images/ui-icons_2e83ff_256x240.png);
|
||||
}
|
||||
.ui-state-error .ui-icon,
|
||||
.ui-state-error-text .ui-icon {
|
||||
background-image: url(images/ui-icons_cd0a0a_256x240.png);
|
||||
}
|
||||
|
||||
/* positioning */
|
||||
.ui-icon-blank { background-position: 16px 16px; }
|
||||
.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-on { background-position: -96px -144px; }
|
||||
.ui-icon-radio-off { 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-start { background-position: -80px -160px; }
|
||||
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
|
||||
.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-all,
|
||||
.ui-corner-top,
|
||||
.ui-corner-left,
|
||||
.ui-corner-tl {
|
||||
border-top-left-radius: 5px;
|
||||
}
|
||||
.ui-corner-all,
|
||||
.ui-corner-top,
|
||||
.ui-corner-right,
|
||||
.ui-corner-tr {
|
||||
border-top-right-radius: 5px;
|
||||
}
|
||||
.ui-corner-all,
|
||||
.ui-corner-bottom,
|
||||
.ui-corner-left,
|
||||
.ui-corner-bl {
|
||||
border-bottom-left-radius: 5px;
|
||||
}
|
||||
.ui-corner-all,
|
||||
.ui-corner-bottom,
|
||||
.ui-corner-right,
|
||||
.ui-corner-br {
|
||||
border-bottom-right-radius: 5px;
|
||||
}
|
||||
|
||||
/* Overlays */
|
||||
.ui-widget-overlay {
|
||||
background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;
|
||||
opacity: .3;
|
||||
filter: Alpha(Opacity=30);
|
||||
}
|
||||
.ui-widget-shadow {
|
||||
margin: -8px 0 0 -8px;
|
||||
padding: 8px;
|
||||
background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;
|
||||
opacity: .3;
|
||||
filter: Alpha(Opacity=30);
|
||||
border-radius: 8px;
|
||||
}
|
5
dist/jquery-editable/jquery-ui-datepicker/css/redmond/jquery-ui-1.10.2.custom.min.css
vendored
Normal file
2352
dist/jquery-editable/jquery-ui-datepicker/js/jquery-ui-1.10.2.custom.js
vendored
Normal file
7
dist/jquery-editable/jquery-ui-datepicker/js/jquery-ui-1.10.2.custom.min.js
vendored
Normal file
4815
dist/jquery-editable/js/jquery-editable-poshytip.js
vendored
Normal file
5
dist/jquery-editable/js/jquery-editable-poshytip.min.js
vendored
Normal file
201
dist/jqueryui-editable/css/jqueryui-editable.css
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
/*! X-editable - v1.4.5
|
||||
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
||||
* http://github.com/vitalets/x-editable
|
||||
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
||||
|
||||
.editableform {
|
||||
margin-bottom: 0; /* overwrites bootstrap margin */
|
||||
}
|
||||
|
||||
.editableform .control-group {
|
||||
margin-bottom: 0; /* overwrites bootstrap margin */
|
||||
white-space: nowrap; /* prevent wrapping buttons on new line */
|
||||
line-height: 20px; /* overwriting bootstrap line-height. See #133 */
|
||||
}
|
||||
|
||||
.editable-buttons {
|
||||
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
|
||||
vertical-align: top;
|
||||
margin-left: 7px;
|
||||
/* inline-block emulation for IE7*/
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
|
||||
.editable-buttons.editable-buttons-bottom {
|
||||
display: block;
|
||||
margin-top: 7px;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.editable-input {
|
||||
vertical-align: top;
|
||||
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
|
||||
width: auto; /* bootstrap-responsive has width: 100% that breakes layout */
|
||||
white-space: normal; /* reset white-space decalred in parent*/
|
||||
/* display-inline emulation for IE7*/
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
|
||||
.editable-buttons .editable-cancel {
|
||||
margin-left: 7px;
|
||||
}
|
||||
|
||||
/*for jquery-ui buttons need set height to look more pretty*/
|
||||
.editable-buttons button.ui-button-icon-only {
|
||||
height: 24px;
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
.editableform-loading {
|
||||
background: url('../img/loading.gif') center center no-repeat;
|
||||
height: 25px;
|
||||
width: auto;
|
||||
min-width: 25px;
|
||||
}
|
||||
|
||||
.editable-inline .editableform-loading {
|
||||
background-position: left 5px;
|
||||
}
|
||||
|
||||
.editable-error-block {
|
||||
max-width: 300px;
|
||||
margin: 5px 0 0 0;
|
||||
width: auto;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
/*add padding for jquery ui*/
|
||||
.editable-error-block.ui-state-error {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.editable-error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/* ---- For specific types ---- */
|
||||
|
||||
.editableform .editable-date {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
float: left;
|
||||
}
|
||||
|
||||
/* move datepicker icon to center of add-on button. See https://github.com/vitalets/x-editable/issues/183 */
|
||||
.editable-inline .add-on .icon-th {
|
||||
margin-top: 3px;
|
||||
margin-left: 1px;
|
||||
}
|
||||
|
||||
|
||||
/* checklist vertical alignment */
|
||||
.editable-checklist label input[type="checkbox"],
|
||||
.editable-checklist label span {
|
||||
vertical-align: middle;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.editable-checklist label {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* set exact width of textarea to fit buttons toolbar */
|
||||
.editable-wysihtml5 {
|
||||
width: 566px;
|
||||
height: 250px;
|
||||
}
|
||||
|
||||
/* clear button shown as link in date inputs */
|
||||
.editable-clear {
|
||||
clear: both;
|
||||
font-size: 0.9em;
|
||||
text-decoration: none;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* IOS-style clear button for text inputs */
|
||||
.editable-clear-x {
|
||||
background: url('../img/clear.png') center center no-repeat;
|
||||
display: block;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
position: absolute;
|
||||
opacity: 0.6;
|
||||
z-index: 100;
|
||||
|
||||
top: 50%;
|
||||
right: 6px;
|
||||
margin-top: -6px;
|
||||
|
||||
}
|
||||
|
||||
.editable-clear-x:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
.editable-container.editable-popup {
|
||||
max-width: none !important; /* without this rule poshytip/tooltip does not stretch */
|
||||
}
|
||||
|
||||
.editable-container.popover {
|
||||
width: auto; /* without this rule popover does not stretch */
|
||||
}
|
||||
|
||||
.editable-container.editable-inline {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: auto;
|
||||
/* inline-block emulation for IE7*/
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
|
||||
.editable-container.ui-widget {
|
||||
font-size: inherit; /* jqueryui widget font 1.1em too big, overwrite it */
|
||||
}
|
||||
.editable-click,
|
||||
a.editable-click,
|
||||
a.editable-click:hover {
|
||||
text-decoration: none;
|
||||
border-bottom: dashed 1px #0088cc;
|
||||
}
|
||||
|
||||
.editable-click.editable-disabled,
|
||||
a.editable-click.editable-disabled,
|
||||
a.editable-click.editable-disabled:hover {
|
||||
color: #585858;
|
||||
cursor: default;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.editable-empty, .editable-empty:hover, .editable-empty:focus{
|
||||
font-style: italic;
|
||||
color: #DD1144;
|
||||
/* border-bottom: none; */
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.editable-unsaved {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.editable-unsaved:after {
|
||||
/* content: '*'*/
|
||||
}
|
||||
|
||||
.editable-bg-transition {
|
||||
-webkit-transition: background-color 1400ms ease-out;
|
||||
-moz-transition: background-color 1400ms ease-out;
|
||||
-o-transition: background-color 1400ms ease-out;
|
||||
-ms-transition: background-color 1400ms ease-out;
|
||||
transition: background-color 1400ms ease-out;
|
||||
}
|
||||
|
||||
/*see https://github.com/vitalets/x-editable/issues/139 */
|
||||
.form-horizontal .editable
|
||||
{
|
||||
padding-top: 5px;
|
||||
display:inline-block;
|
||||
}
|
||||
|
BIN
dist/jqueryui-editable/img/clear.png
vendored
Normal file
After ![]() (image error) Size: 509 B |
BIN
dist/jqueryui-editable/img/loading.gif
vendored
Normal file
After ![]() (image error) Size: 1.8 KiB |
4749
dist/jqueryui-editable/js/jqueryui-editable.js
vendored
Normal file
5
dist/jqueryui-editable/js/jqueryui-editable.min.js
vendored
Normal file
2
grunt.js
@ -12,9 +12,9 @@ function getFiles() {
|
||||
form: [forms+'editable-form-bootstrap.js'],
|
||||
container: [containers+'editable-popover.js'],
|
||||
inputs: [
|
||||
inputs+'date/bootstrap-datepicker/js/bootstrap-datepicker.js',
|
||||
inputs+'date/date.js',
|
||||
inputs+'date/datefield.js',
|
||||
inputs+'date/bootstrap-datepicker/js/bootstrap-datepicker.js',
|
||||
inputs+'datetime/datetime.js',
|
||||
inputs+'datetime/datetimefield.js',
|
||||
//don't build datetime lib, should be included manually
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "X-editable",
|
||||
"title": "X-editable",
|
||||
"description": "In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery",
|
||||
"version": "1.4.4",
|
||||
"version": "1.4.5",
|
||||
"homepage": "http://github.com/vitalets/x-editable",
|
||||
"author": {
|
||||
"name": "Vitaliy Potapov",
|
||||
|
@ -33,6 +33,9 @@ Applied as jQuery method.
|
||||
this.formOptions.scope = this.$element[0];
|
||||
|
||||
this.initContainer();
|
||||
|
||||
//flag to hide container, when saving value will finish
|
||||
this.delayedHide = false;
|
||||
|
||||
//bind 'destroyed' listener to destroy container when element is removed from dom
|
||||
this.$element.on('destroyed', $.proxy(function(){
|
||||
@ -137,7 +140,14 @@ Applied as jQuery method.
|
||||
save: $.proxy(this.save, this), //click on submit button (value changed)
|
||||
nochange: $.proxy(function(){ this.hide('nochange'); }, this), //click on submit button (value NOT changed)
|
||||
cancel: $.proxy(function(){ this.hide('cancel'); }, this), //click on calcel button
|
||||
show: $.proxy(this.setPosition, this), //re-position container every time form is shown (occurs each time after loading state)
|
||||
show: $.proxy(function() {
|
||||
if(this.delayedHide) {
|
||||
this.hide(this.delayedHide.reason);
|
||||
this.delayedHide = false;
|
||||
} else {
|
||||
this.setPosition();
|
||||
}
|
||||
}, this), //re-position container every time form is shown (occurs each time after loading state)
|
||||
rendering: $.proxy(this.setPosition, this), //this allows to place container correctly when loading shown
|
||||
resize: $.proxy(this.setPosition, this), //this allows to re-position container when form size is changed
|
||||
rendered: $.proxy(function(){
|
||||
@ -181,11 +191,11 @@ Applied as jQuery method.
|
||||
|
||||
/*
|
||||
Currently, form is re-rendered on every show.
|
||||
The main reason is that we dont know, what container will do with content when closed:
|
||||
remove(), detach() or just hide().
|
||||
The main reason is that we dont know, what will container do with content when closed:
|
||||
remove(), detach() or just hide() - it depends on container.
|
||||
|
||||
Detaching form itself before hide and re-insert before show is good solution,
|
||||
but visually it looks ugly, as container changes size before hide.
|
||||
but visually it looks ugly --> container changes size before hide.
|
||||
*/
|
||||
|
||||
//if form already exist - delete previous data
|
||||
@ -218,10 +228,18 @@ Applied as jQuery method.
|
||||
return;
|
||||
}
|
||||
|
||||
//if form is saving value, schedule hide
|
||||
if(this.$form.data('editableform').isSaving) {
|
||||
this.delayedHide = {reason: reason};
|
||||
return;
|
||||
} else {
|
||||
this.delayedHide = false;
|
||||
}
|
||||
|
||||
this.$element.removeClass('editable-open');
|
||||
this.innerHide();
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
Fired when container was hidden. It occurs on both save or cancel.
|
||||
**Note:** Bootstrap popover has own `hidden` event that now cannot be separated from x-editable's one.
|
||||
The workaround is to check `arguments.length` that is always `2` for x-editable.
|
||||
@ -235,20 +253,20 @@ Applied as jQuery method.
|
||||
//auto-open next editable
|
||||
$(this).closest('tr').next().find('.editable').editable('show');
|
||||
}
|
||||
});
|
||||
**/
|
||||
});
|
||||
**/
|
||||
this.$element.triggerHandler('hidden', reason || 'manual');
|
||||
},
|
||||
|
||||
|
||||
/* internal show method. To be overwritten in child classes */
|
||||
innerShow: function () {
|
||||
|
||||
},
|
||||
|
||||
|
||||
/* internal hide method. To be overwritten in child classes */
|
||||
innerHide: function () {
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
Toggles container visibility (show / hide)
|
||||
@ -293,7 +311,7 @@ Applied as jQuery method.
|
||||
**/
|
||||
this.$element.triggerHandler('save', params);
|
||||
|
||||
//hide must be after trigger, as saving value may require methods od plugin, applied to input
|
||||
//hide must be after trigger, as saving value may require methods of plugin, applied to input
|
||||
this.hide('save');
|
||||
},
|
||||
|
||||
@ -453,7 +471,7 @@ Applied as jQuery method.
|
||||
onblur: 'cancel',
|
||||
|
||||
/**
|
||||
Animation speed (inline mode)
|
||||
Animation speed (inline mode only)
|
||||
@property anim
|
||||
@type string
|
||||
@default false
|
||||
|
@ -59,7 +59,7 @@
|
||||
*/
|
||||
/*jshint laxcomma: true*/
|
||||
setPosition: function () {
|
||||
|
||||
|
||||
(function() {
|
||||
var $tip = this.tip()
|
||||
, inside
|
||||
|
@ -43,7 +43,7 @@
|
||||
this.call('update', $content);
|
||||
this.call('show');
|
||||
|
||||
this.tip().addClass('editable-container');
|
||||
this.tip().addClass(this.containerClass);
|
||||
this.$form.data('editableform').input.activate();
|
||||
},
|
||||
|
||||
|
@ -218,6 +218,27 @@
|
||||
$.error('Unknown type: '+ type);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
//see http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr
|
||||
supportsTransitions: function () {
|
||||
var b = document.body || document.documentElement,
|
||||
s = b.style,
|
||||
p = 'transition',
|
||||
v = ['Moz', 'Webkit', 'Khtml', 'O', 'ms'];
|
||||
|
||||
if(typeof s[p] === 'string') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Tests for vendor specific prop
|
||||
p = p.charAt(0).toUpperCase() + p.substr(1);
|
||||
for(var i=0; i<v.length; i++) {
|
||||
if(typeof s[v[i] + p] === 'string') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -60,6 +60,10 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
||||
//show loading state
|
||||
this.showLoading();
|
||||
|
||||
//flag showing is form now saving value to server.
|
||||
//It is needed to wait when closing form.
|
||||
this.isSaving = false;
|
||||
|
||||
/**
|
||||
Fired when rendering starts
|
||||
@event rendering
|
||||
@ -212,31 +216,38 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
||||
return;
|
||||
}
|
||||
|
||||
//convert value for submitting to server
|
||||
var submitValue = this.input.value2submit(newValue);
|
||||
|
||||
this.isSaving = true;
|
||||
|
||||
//sending data to server
|
||||
$.when(this.save(newValue))
|
||||
$.when(this.save(submitValue))
|
||||
.done($.proxy(function(response) {
|
||||
this.isSaving = false;
|
||||
|
||||
//run success callback
|
||||
var res = typeof this.options.success === 'function' ? this.options.success.call(this.options.scope, response, newValue) : null;
|
||||
|
||||
|
||||
//if success callback returns false --> keep form open and do not activate input
|
||||
if(res === false) {
|
||||
this.error(false);
|
||||
this.showForm(false);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//if success callback returns string --> keep form open, show error and activate input
|
||||
if(typeof res === 'string') {
|
||||
this.error(res);
|
||||
this.showForm();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//if success callback returns object like {newValue: <something>} --> use that value instead of submitted
|
||||
//it is usefull if you want to chnage value in url-function
|
||||
if(res && typeof res === 'object' && res.hasOwnProperty('newValue')) {
|
||||
newValue = res.newValue;
|
||||
}
|
||||
}
|
||||
|
||||
//clear error message
|
||||
this.error(false);
|
||||
@ -246,37 +257,42 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
||||
@event save
|
||||
@param {Object} event event object
|
||||
@param {Object} params additional params
|
||||
@param {mixed} params.newValue submitted value
|
||||
@param {mixed} params.newValue raw new value
|
||||
@param {mixed} params.submitValue submitted value as string
|
||||
@param {Object} params.response ajax response
|
||||
|
||||
@example
|
||||
$('#form-div').on('save'), function(e, params){
|
||||
if(params.newValue === 'username') {...}
|
||||
});
|
||||
**/
|
||||
this.$div.triggerHandler('save', {newValue: newValue, response: response});
|
||||
});
|
||||
**/
|
||||
this.$div.triggerHandler('save', {newValue: newValue, submitValue: submitValue, response: response});
|
||||
}, this))
|
||||
.fail($.proxy(function(xhr) {
|
||||
this.isSaving = false;
|
||||
|
||||
var msg;
|
||||
if(typeof this.options.error === 'function') {
|
||||
msg = this.options.error.call(this.options.scope, xhr, newValue);
|
||||
} else {
|
||||
msg = typeof xhr === 'string' ? xhr : xhr.responseText || xhr.statusText || 'Unknown error!';
|
||||
}
|
||||
|
||||
|
||||
this.error(msg);
|
||||
this.showForm();
|
||||
}, this));
|
||||
},
|
||||
|
||||
save: function(newValue) {
|
||||
//convert value for submitting to server
|
||||
var submitValue = this.input.value2submit(newValue);
|
||||
|
||||
save: function(submitValue) {
|
||||
//try parse composite pk defined as json string in data-pk
|
||||
this.options.pk = $.fn.editableutils.tryParseJson(this.options.pk, true);
|
||||
|
||||
var pk = (typeof this.options.pk === 'function') ? this.options.pk.call(this.options.scope) : this.options.pk,
|
||||
/*
|
||||
send on server in following cases:
|
||||
1. url is function
|
||||
2. url is string AND (pk defined OR send option = always)
|
||||
*/
|
||||
send = !!(typeof this.options.url === 'function' || (this.options.url && ((this.options.send === 'always') || (this.options.send === 'auto' && pk !== null && pk !== undefined)))),
|
||||
params;
|
||||
|
||||
|
@ -28,6 +28,14 @@ a.editable-click.editable-disabled:hover {
|
||||
/* content: '*'*/
|
||||
}
|
||||
|
||||
.editable-bg-transition {
|
||||
-webkit-transition: background-color 1400ms ease-out;
|
||||
-moz-transition: background-color 1400ms ease-out;
|
||||
-o-transition: background-color 1400ms ease-out;
|
||||
-ms-transition: background-color 1400ms ease-out;
|
||||
transition: background-color 1400ms ease-out;
|
||||
}
|
||||
|
||||
/*see https://github.com/vitalets/x-editable/issues/139 */
|
||||
.form-horizontal .editable
|
||||
{
|
||||
|
@ -16,6 +16,11 @@ Makes editable any HTML element on the page. Applied as jQuery method.
|
||||
} else {
|
||||
this.init();
|
||||
}
|
||||
|
||||
//check for transition support
|
||||
if(this.options.highlight && !$.fn.editableutils.supportsTransitions()) {
|
||||
this.options.highlight = false;
|
||||
}
|
||||
};
|
||||
|
||||
Editable.prototype = {
|
||||
@ -60,25 +65,33 @@ Makes editable any HTML element on the page. Applied as jQuery method.
|
||||
if(this.options.toggle !== 'manual') {
|
||||
this.$element.addClass('editable-click');
|
||||
this.$element.on(this.options.toggle + '.editable', $.proxy(function(e){
|
||||
//prevent following link
|
||||
e.preventDefault();
|
||||
//prevent following link if editable enabled
|
||||
if(!this.options.disabled) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
//stop propagation not required because in document click handler it checks event target
|
||||
//e.stopPropagation();
|
||||
|
||||
if(this.options.toggle === 'mouseenter') {
|
||||
//for hover only show container
|
||||
this.show();
|
||||
this.show();
|
||||
} else {
|
||||
//when toggle='click' we should not close all other containers as they will be closed automatically in document click listener
|
||||
var closeAll = (this.options.toggle !== 'click');
|
||||
this.toggle(closeAll);
|
||||
}
|
||||
}
|
||||
}, this));
|
||||
} else {
|
||||
this.$element.attr('tabindex', -1); //do not stop focus on element when toggled manually
|
||||
}
|
||||
|
||||
//if display is function it's far more convinient to have autotext = always to render correctly on init
|
||||
//see https://github.com/vitalets/x-editable-yii/issues/34
|
||||
if(typeof this.options.display === 'function') {
|
||||
this.options.autotext = 'always';
|
||||
}
|
||||
|
||||
//check conditions for autotext:
|
||||
switch(this.options.autotext) {
|
||||
case 'always':
|
||||
@ -257,12 +270,29 @@ Makes editable any HTML element on the page. Applied as jQuery method.
|
||||
return;
|
||||
}
|
||||
|
||||
this.isEmpty = isEmpty !== undefined ? isEmpty : $.trim(this.$element.text()) === '';
|
||||
/*
|
||||
isEmpty may be set directly as param of method.
|
||||
It is required when we enable/disable field and can't rely on content
|
||||
as node content is text: "Empty" that is not empty %)
|
||||
*/
|
||||
if(isEmpty !== undefined) {
|
||||
this.isEmpty = isEmpty;
|
||||
} else {
|
||||
//detect empty
|
||||
if($.trim(this.$element.html()) === '') {
|
||||
this.isEmpty = true;
|
||||
} else if($.trim(this.$element.text()) !== '') {
|
||||
this.isEmpty = false;
|
||||
} else {
|
||||
//e.g. '<img>'
|
||||
this.isEmpty = !this.$element.height() || !this.$element.width();
|
||||
}
|
||||
}
|
||||
|
||||
//emptytext shown only for enabled
|
||||
if(!this.options.disabled) {
|
||||
if (this.isEmpty) {
|
||||
this.$element.text(this.options.emptytext);
|
||||
this.$element.html(this.options.emptytext);
|
||||
if(this.options.emptyclass) {
|
||||
this.$element.addClass(this.options.emptyclass);
|
||||
}
|
||||
@ -357,6 +387,21 @@ Makes editable any HTML element on the page. Applied as jQuery method.
|
||||
}
|
||||
}
|
||||
|
||||
//highlight when saving
|
||||
if(this.options.highlight) {
|
||||
var $e = this.$element,
|
||||
$bgColor = $e.css('background-color');
|
||||
|
||||
$e.css('background-color', this.options.highlight);
|
||||
setTimeout(function(){
|
||||
$e.css('background-color', $bgColor);
|
||||
$e.addClass('editable-bg-transition');
|
||||
setTimeout(function(){
|
||||
$e.removeClass('editable-bg-transition');
|
||||
}, 1700);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
//set new value
|
||||
this.setValue(params.newValue, false, params.response);
|
||||
|
||||
@ -423,6 +468,8 @@ Makes editable any HTML element on the page. Applied as jQuery method.
|
||||
if(this.container) {
|
||||
this.container.destroy();
|
||||
}
|
||||
|
||||
this.input.destroy();
|
||||
|
||||
if(this.options.toggle !== 'manual') {
|
||||
this.$element.removeClass('editable-click');
|
||||
@ -480,28 +527,37 @@ Makes editable any HTML element on the page. Applied as jQuery method.
|
||||
/**
|
||||
Returns current values of editable elements.
|
||||
Note that it returns an **object** with name-value pairs, not a value itself. It allows to get data from several elements.
|
||||
If value of some editable is `null` or `undefined` it is excluded from result object.
|
||||
If value of some editable is `null` or `undefined` it is excluded from result object.
|
||||
When param `isSingle` is set to **true** - it is supposed you have single element and will return value of editable instead of object.
|
||||
|
||||
@method getValue()
|
||||
@param {bool} isSingle whether to return just value of single element
|
||||
@returns {Object} object of element names and values
|
||||
@example
|
||||
$('#username, #fullname').editable('getValue');
|
||||
// possible result:
|
||||
//result:
|
||||
{
|
||||
username: "superuser",
|
||||
fullname: "John"
|
||||
}
|
||||
//isSingle = true
|
||||
$('#username').editable('getValue', true);
|
||||
//result "superuser"
|
||||
**/
|
||||
case 'getValue':
|
||||
this.each(function () {
|
||||
var $this = $(this), data = $this.data(datakey);
|
||||
if (data && data.value !== undefined && data.value !== null) {
|
||||
result[data.options.name] = data.input.value2submit(data.value);
|
||||
}
|
||||
});
|
||||
if(arguments.length === 2 && arguments[1] === true) { //isSingle = true
|
||||
result = this.eq(0).data(datakey).value;
|
||||
} else {
|
||||
this.each(function () {
|
||||
var $this = $(this), data = $this.data(datakey);
|
||||
if (data && data.value !== undefined && data.value !== null) {
|
||||
result[data.options.name] = data.input.value2submit(data.value);
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
|
||||
/**
|
||||
/**
|
||||
This method collects values from several editable elements and submit them all to server.
|
||||
Internally it runs client-side validation for all fields and submits only in case of success.
|
||||
See <a href="#newrecord">creating new records</a> for details.
|
||||
@ -725,7 +781,16 @@ Makes editable any HTML element on the page. Applied as jQuery method.
|
||||
});
|
||||
</script>
|
||||
**/
|
||||
selector: null
|
||||
selector: null,
|
||||
/**
|
||||
Color used to highlight element after update. Implemented via CSS3 transition, works in modern browsers.
|
||||
|
||||
@property highlight
|
||||
@type string|boolean
|
||||
@since 1.4.5
|
||||
@default #FFFF80
|
||||
**/
|
||||
highlight: '#FFFF80'
|
||||
};
|
||||
|
||||
}(window.jQuery));
|
||||
|
@ -7,23 +7,23 @@ To create your own input you can inherit from this class.
|
||||
**/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
|
||||
//types
|
||||
$.fn.editabletypes = {};
|
||||
|
||||
|
||||
var AbstractInput = function () { };
|
||||
|
||||
AbstractInput.prototype = {
|
||||
/**
|
||||
Initializes input
|
||||
|
||||
|
||||
@method init()
|
||||
**/
|
||||
init: function(type, options, defaults) {
|
||||
this.type = type;
|
||||
this.options = $.extend({}, defaults, options);
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
this method called before render to init $tpl that is inserted in DOM
|
||||
*/
|
||||
@ -37,107 +37,107 @@ To create your own input you can inherit from this class.
|
||||
/**
|
||||
Renders input from tpl. Can return jQuery deferred object.
|
||||
Can be overwritten in child objects
|
||||
|
||||
@method render()
|
||||
**/
|
||||
|
||||
@method render()
|
||||
**/
|
||||
render: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
Sets element's html by value.
|
||||
|
||||
@method value2html(value, element)
|
||||
|
||||
@method value2html(value, element)
|
||||
@param {mixed} value
|
||||
@param {DOMElement} element
|
||||
**/
|
||||
**/
|
||||
value2html: function(value, element) {
|
||||
$(element).text(value);
|
||||
$(element).text($.trim(value));
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
Converts element's html to value
|
||||
|
||||
@method html2value(html)
|
||||
|
||||
@method html2value(html)
|
||||
@param {string} html
|
||||
@returns {mixed}
|
||||
**/
|
||||
**/
|
||||
html2value: function(html) {
|
||||
return $('<div>').html(html).text();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
Converts value to string (for internal compare). For submitting to server used value2submit().
|
||||
|
||||
|
||||
@method value2str(value)
|
||||
@param {mixed} value
|
||||
@returns {string}
|
||||
**/
|
||||
**/
|
||||
value2str: function(value) {
|
||||
return value;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
Converts string received from server into value. Usually from `data-value` attribute.
|
||||
|
||||
@method str2value(str)
|
||||
|
||||
@method str2value(str)
|
||||
@param {string} str
|
||||
@returns {mixed}
|
||||
**/
|
||||
**/
|
||||
str2value: function(str) {
|
||||
return str;
|
||||
},
|
||||
|
||||
/**
|
||||
Converts value for submitting to server. Result can be string or object.
|
||||
|
||||
|
||||
@method value2submit(value)
|
||||
@param {mixed} value
|
||||
@returns {mixed}
|
||||
**/
|
||||
**/
|
||||
value2submit: function(value) {
|
||||
return value;
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
Sets value of input.
|
||||
|
||||
|
||||
@method value2input(value)
|
||||
@param {mixed} value
|
||||
**/
|
||||
**/
|
||||
value2input: function(value) {
|
||||
this.$input.val(value);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
Returns value of input. Value can be object (e.g. datepicker)
|
||||
|
||||
|
||||
@method input2value()
|
||||
**/
|
||||
**/
|
||||
input2value: function() {
|
||||
return this.$input.val();
|
||||
},
|
||||
|
||||
/**
|
||||
Activates input. For text it sets focus.
|
||||
|
||||
|
||||
@method activate()
|
||||
**/
|
||||
**/
|
||||
activate: function() {
|
||||
if(this.$input.is(':visible')) {
|
||||
this.$input.focus();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
Creates input.
|
||||
|
||||
|
||||
@method clear()
|
||||
**/
|
||||
clear: function() {
|
||||
this.$input.val(null);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
method to escape html.
|
||||
**/
|
||||
@ -147,18 +147,24 @@ To create your own input you can inherit from this class.
|
||||
|
||||
/**
|
||||
attach handler to automatically submit form when value changed (useful when buttons not shown)
|
||||
**/
|
||||
**/
|
||||
autosubmit: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
Additional actions when destroying element
|
||||
**/
|
||||
destroy: function() {
|
||||
},
|
||||
|
||||
// -------- helper functions --------
|
||||
setClass: function() {
|
||||
if(this.options.inputclass) {
|
||||
this.$input.addClass(this.options.inputclass);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
setAttr: function(attr) {
|
||||
if (this.options[attr] !== undefined && this.options[attr] !== null) {
|
||||
this.$input.attr(attr, this.options[attr]);
|
||||
|
@ -1,10 +1,20 @@
|
||||
/**
|
||||
* Combodate - 1.0.3
|
||||
* Combodate - 1.0.4
|
||||
* Dropdown date and time picker.
|
||||
* Converts text input into dropdowns to pick day, month, year, hour, minute and second.
|
||||
* Uses momentjs as datetime library http://momentjs.com.
|
||||
* For i18n include corresponding file from https://github.com/timrwood/moment/tree/master/lang
|
||||
*
|
||||
* Confusion at noon and midnight - see http://en.wikipedia.org/wiki/12-hour_clock#Confusion_at_noon_and_midnight
|
||||
* In combodate:
|
||||
* 12:00 pm --> 12:00 (24-h format, midday)
|
||||
* 12:00 am --> 00:00 (24-h format, midnight, start of day)
|
||||
*
|
||||
* Differs from momentjs parse rules:
|
||||
* 00:00 pm, 12:00 pm --> 12:00 (24-h format, day not change)
|
||||
* 00:00 am, 12:00 am --> 00:00 (24-h format, day not change)
|
||||
*
|
||||
*
|
||||
* Author: Vitaliy Potapov
|
||||
* Project page: http://github.com/vitalets/combodate
|
||||
* Copyright (c) 2012 Vitaliy Potapov. Released under MIT License.
|
||||
@ -154,9 +164,10 @@
|
||||
|
||||
for(i=0; i<=11; i++) {
|
||||
if(longNames) {
|
||||
name = moment().month(i).format('MMMM');
|
||||
//see https://github.com/timrwood/momentjs.com/pull/36
|
||||
name = moment().date(1).month(i).format('MMMM');
|
||||
} else if(shortNames) {
|
||||
name = moment().month(i).format('MMM');
|
||||
name = moment().date(1).month(i).format('MMM');
|
||||
} else if(twoDigit) {
|
||||
name = this.leadZero(i+1);
|
||||
} else {
|
||||
@ -192,9 +203,10 @@
|
||||
h12 = this.options.template.indexOf('h') !== -1,
|
||||
h24 = this.options.template.indexOf('H') !== -1,
|
||||
twoDigit = this.options.template.toLowerCase().indexOf('hh') !== -1,
|
||||
min = h12 ? 1 : 0,
|
||||
max = h12 ? 12 : 23;
|
||||
|
||||
for(i=0; i<=max; i++) {
|
||||
for(i=min; i<=max; i++) {
|
||||
name = twoDigit ? this.leadZero(i) : i;
|
||||
items.push([i, name]);
|
||||
}
|
||||
@ -243,7 +255,7 @@
|
||||
},
|
||||
|
||||
/*
|
||||
Returns current date value.
|
||||
Returns current date value from combos.
|
||||
If format not specified - `options.format` used.
|
||||
If format = `null` - Moment object returned.
|
||||
*/
|
||||
@ -272,12 +284,14 @@
|
||||
return '';
|
||||
}
|
||||
|
||||
//convert hours if 12h format
|
||||
//convert hours 12h --> 24h
|
||||
if(this.$ampm) {
|
||||
values.hour = this.$ampm.val() === 'am' ? values.hour : values.hour+12;
|
||||
if(values.hour === 24) {
|
||||
values.hour = 0;
|
||||
}
|
||||
//12:00 pm --> 12:00 (24-h format, midday), 12:00 am --> 00:00 (24-h format, midnight, start of day)
|
||||
if(values.hour === 12) {
|
||||
values.hour = this.$ampm.val() === 'am' ? 0 : 12;
|
||||
} else {
|
||||
values.hour = this.$ampm.val() === 'am' ? values.hour : values.hour+12;
|
||||
}
|
||||
}
|
||||
|
||||
dt = moment([values.year, values.month, values.day, values.hour, values.minute, values.second]);
|
||||
@ -328,11 +342,17 @@
|
||||
});
|
||||
|
||||
if(this.$ampm) {
|
||||
if(values.hour > 12) {
|
||||
values.hour -= 12;
|
||||
//12:00 pm --> 12:00 (24-h format, midday), 12:00 am --> 00:00 (24-h format, midnight, start of day)
|
||||
if(values.hour >= 12) {
|
||||
values.ampm = 'pm';
|
||||
if(values.hour > 12) {
|
||||
values.hour -= 12;
|
||||
}
|
||||
} else {
|
||||
values.ampm = 'am';
|
||||
values.ampm = 'am';
|
||||
if(values.hour === 0) {
|
||||
values.hour = 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@
|
||||
border-color: #fdf59a #fdf59a #fbed50;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #000 !important;
|
||||
color: #000;
|
||||
}
|
||||
.datepicker table tr td.today:hover,
|
||||
.datepicker table tr td.today:hover:hover,
|
||||
@ -145,6 +145,124 @@
|
||||
.datepicker table tr td.today.disabled:hover.active {
|
||||
background-color: #fbf069 \9;
|
||||
}
|
||||
.datepicker table tr td.today:hover:hover {
|
||||
color: #000;
|
||||
}
|
||||
.datepicker table tr td.today.active:hover {
|
||||
color: #fff;
|
||||
}
|
||||
.datepicker table tr td.range,
|
||||
.datepicker table tr td.range:hover,
|
||||
.datepicker table tr td.range.disabled,
|
||||
.datepicker table tr td.range.disabled:hover {
|
||||
background: #eeeeee;
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.datepicker table tr td.range.today,
|
||||
.datepicker table tr td.range.today:hover,
|
||||
.datepicker table tr td.range.today.disabled,
|
||||
.datepicker table tr td.range.today.disabled:hover {
|
||||
background-color: #f3d17a;
|
||||
background-image: -moz-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: -ms-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f3c17a), to(#f3e97a));
|
||||
background-image: -webkit-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: -o-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3c17a', endColorstr='#f3e97a', GradientType=0);
|
||||
border-color: #f3e97a #f3e97a #edde34;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.datepicker table tr td.range.today:hover,
|
||||
.datepicker table tr td.range.today:hover:hover,
|
||||
.datepicker table tr td.range.today.disabled:hover,
|
||||
.datepicker table tr td.range.today.disabled:hover:hover,
|
||||
.datepicker table tr td.range.today:active,
|
||||
.datepicker table tr td.range.today:hover:active,
|
||||
.datepicker table tr td.range.today.disabled:active,
|
||||
.datepicker table tr td.range.today.disabled:hover:active,
|
||||
.datepicker table tr td.range.today.active,
|
||||
.datepicker table tr td.range.today:hover.active,
|
||||
.datepicker table tr td.range.today.disabled.active,
|
||||
.datepicker table tr td.range.today.disabled:hover.active,
|
||||
.datepicker table tr td.range.today.disabled,
|
||||
.datepicker table tr td.range.today:hover.disabled,
|
||||
.datepicker table tr td.range.today.disabled.disabled,
|
||||
.datepicker table tr td.range.today.disabled:hover.disabled,
|
||||
.datepicker table tr td.range.today[disabled],
|
||||
.datepicker table tr td.range.today:hover[disabled],
|
||||
.datepicker table tr td.range.today.disabled[disabled],
|
||||
.datepicker table tr td.range.today.disabled:hover[disabled] {
|
||||
background-color: #f3e97a;
|
||||
}
|
||||
.datepicker table tr td.range.today:active,
|
||||
.datepicker table tr td.range.today:hover:active,
|
||||
.datepicker table tr td.range.today.disabled:active,
|
||||
.datepicker table tr td.range.today.disabled:hover:active,
|
||||
.datepicker table tr td.range.today.active,
|
||||
.datepicker table tr td.range.today:hover.active,
|
||||
.datepicker table tr td.range.today.disabled.active,
|
||||
.datepicker table tr td.range.today.disabled:hover.active {
|
||||
background-color: #efe24b \9;
|
||||
}
|
||||
.datepicker table tr td.selected,
|
||||
.datepicker table tr td.selected:hover,
|
||||
.datepicker table tr td.selected.disabled,
|
||||
.datepicker table tr td.selected.disabled:hover {
|
||||
background-color: #9e9e9e;
|
||||
background-image: -moz-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: -ms-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b3b3b3), to(#808080));
|
||||
background-image: -webkit-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: -o-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: linear-gradient(top, #b3b3b3, #808080);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b3b3b3', endColorstr='#808080', GradientType=0);
|
||||
border-color: #808080 #808080 #595959;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.datepicker table tr td.selected:hover,
|
||||
.datepicker table tr td.selected:hover:hover,
|
||||
.datepicker table tr td.selected.disabled:hover,
|
||||
.datepicker table tr td.selected.disabled:hover:hover,
|
||||
.datepicker table tr td.selected:active,
|
||||
.datepicker table tr td.selected:hover:active,
|
||||
.datepicker table tr td.selected.disabled:active,
|
||||
.datepicker table tr td.selected.disabled:hover:active,
|
||||
.datepicker table tr td.selected.active,
|
||||
.datepicker table tr td.selected:hover.active,
|
||||
.datepicker table tr td.selected.disabled.active,
|
||||
.datepicker table tr td.selected.disabled:hover.active,
|
||||
.datepicker table tr td.selected.disabled,
|
||||
.datepicker table tr td.selected:hover.disabled,
|
||||
.datepicker table tr td.selected.disabled.disabled,
|
||||
.datepicker table tr td.selected.disabled:hover.disabled,
|
||||
.datepicker table tr td.selected[disabled],
|
||||
.datepicker table tr td.selected:hover[disabled],
|
||||
.datepicker table tr td.selected.disabled[disabled],
|
||||
.datepicker table tr td.selected.disabled:hover[disabled] {
|
||||
background-color: #808080;
|
||||
}
|
||||
.datepicker table tr td.selected:active,
|
||||
.datepicker table tr td.selected:hover:active,
|
||||
.datepicker table tr td.selected.disabled:active,
|
||||
.datepicker table tr td.selected.disabled:hover:active,
|
||||
.datepicker table tr td.selected.active,
|
||||
.datepicker table tr td.selected:hover.active,
|
||||
.datepicker table tr td.selected.disabled.active,
|
||||
.datepicker table tr td.selected.disabled:hover.active {
|
||||
background-color: #666666 \9;
|
||||
}
|
||||
.datepicker table tr td.active,
|
||||
.datepicker table tr td.active:hover,
|
||||
.datepicker table tr td.active.disabled,
|
||||
@ -268,18 +386,19 @@
|
||||
.datepicker table tr td span.active.disabled:hover.active {
|
||||
background-color: #003399 \9;
|
||||
}
|
||||
.datepicker table tr td span.old {
|
||||
.datepicker table tr td span.old,
|
||||
.datepicker table tr td span.new {
|
||||
color: #999999;
|
||||
}
|
||||
.datepicker th.switch {
|
||||
.datepicker th.datepicker-switch {
|
||||
width: 145px;
|
||||
}
|
||||
.datepicker thead tr:first-child th,
|
||||
.datepicker tfoot tr:first-child th {
|
||||
.datepicker tfoot tr th {
|
||||
cursor: pointer;
|
||||
}
|
||||
.datepicker thead tr:first-child th:hover,
|
||||
.datepicker tfoot tr:first-child th:hover {
|
||||
.datepicker tfoot tr th:hover {
|
||||
background: #eeeeee;
|
||||
}
|
||||
.datepicker .cw {
|
||||
@ -299,3 +418,32 @@
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
.input-daterange input {
|
||||
text-align: center;
|
||||
}
|
||||
.input-daterange input:first-child {
|
||||
-webkit-border-radius: 3px 0 0 3px;
|
||||
-moz-border-radius: 3px 0 0 3px;
|
||||
border-radius: 3px 0 0 3px;
|
||||
}
|
||||
.input-daterange input:last-child {
|
||||
-webkit-border-radius: 0 3px 3px 0;
|
||||
-moz-border-radius: 0 3px 3px 0;
|
||||
border-radius: 0 3px 3px 0;
|
||||
}
|
||||
.input-daterange .add-on {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
min-width: 16px;
|
||||
height: 18px;
|
||||
padding: 4px 5px;
|
||||
font-weight: normal;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 0 #ffffff;
|
||||
vertical-align: middle;
|
||||
background-color: #eeeeee;
|
||||
border: 1px solid #ccc;
|
||||
margin-left: -5px;
|
||||
margin-right: -5px;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
* limitations under the License.
|
||||
* ========================================================= */
|
||||
|
||||
!function( $ ) {
|
||||
(function( $ ) {
|
||||
|
||||
function UTCDate(){
|
||||
return new Date(Date.UTC.apply(Date, arguments));
|
||||
@ -33,12 +33,9 @@
|
||||
var Datepicker = function(element, options) {
|
||||
var that = this;
|
||||
|
||||
this._process_options(options);
|
||||
|
||||
this.element = $(element);
|
||||
this.language = options.language||this.element.data('date-language')||"en";
|
||||
this.language = this.language in dates ? this.language : this.language.split('-')[0]; //Check if "de-DE" style date is available, if not language should fallback to 2 letter code eg "de"
|
||||
this.language = this.language in dates ? this.language : "en";
|
||||
this.isRTL = dates[this.language].rtl||false;
|
||||
this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||dates[this.language].format||'mm/dd/yyyy');
|
||||
this.isInline = false;
|
||||
this.isInput = this.element.is('input');
|
||||
this.component = this.element.is('.date') ? this.element.find('.add-on, .btn') : false;
|
||||
@ -46,13 +43,6 @@
|
||||
if(this.component && this.component.length === 0)
|
||||
this.component = false;
|
||||
|
||||
this.forceParse = true;
|
||||
if ('forceParse' in options) {
|
||||
this.forceParse = options.forceParse;
|
||||
} else if ('dateForceParse' in this.element.data()) {
|
||||
this.forceParse = this.element.data('date-force-parse');
|
||||
}
|
||||
|
||||
this.picker = $(DPGlobal.template);
|
||||
this._buildEvents();
|
||||
this._attachEvents();
|
||||
@ -62,65 +52,17 @@
|
||||
} else {
|
||||
this.picker.addClass('datepicker-dropdown dropdown-menu');
|
||||
}
|
||||
if (this.isRTL){
|
||||
|
||||
if (this.o.rtl){
|
||||
this.picker.addClass('datepicker-rtl');
|
||||
this.picker.find('.prev i, .next i')
|
||||
.toggleClass('icon-arrow-left icon-arrow-right');
|
||||
}
|
||||
|
||||
this.autoclose = false;
|
||||
if ('autoclose' in options) {
|
||||
this.autoclose = options.autoclose;
|
||||
} else if ('dateAutoclose' in this.element.data()) {
|
||||
this.autoclose = this.element.data('date-autoclose');
|
||||
}
|
||||
|
||||
this.keyboardNavigation = true;
|
||||
if ('keyboardNavigation' in options) {
|
||||
this.keyboardNavigation = options.keyboardNavigation;
|
||||
} else if ('dateKeyboardNavigation' in this.element.data()) {
|
||||
this.keyboardNavigation = this.element.data('date-keyboard-navigation');
|
||||
}
|
||||
this.viewMode = this.o.startView;
|
||||
|
||||
this.viewMode = this.startViewMode = 0;
|
||||
switch(options.startView || this.element.data('date-start-view')){
|
||||
case 2:
|
||||
case 'decade':
|
||||
this.viewMode = this.startViewMode = 2;
|
||||
break;
|
||||
case 1:
|
||||
case 'year':
|
||||
this.viewMode = this.startViewMode = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
this.minViewMode = options.minViewMode||this.element.data('date-min-view-mode')||0;
|
||||
if (typeof this.minViewMode === 'string') {
|
||||
switch (this.minViewMode) {
|
||||
case 'months':
|
||||
this.minViewMode = 1;
|
||||
break;
|
||||
case 'years':
|
||||
this.minViewMode = 2;
|
||||
break;
|
||||
default:
|
||||
this.minViewMode = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.viewMode = this.startViewMode = Math.max(this.startViewMode, this.minViewMode);
|
||||
|
||||
this.todayBtn = (options.todayBtn||this.element.data('date-today-btn')||false);
|
||||
this.todayHighlight = (options.todayHighlight||this.element.data('date-today-highlight')||false);
|
||||
|
||||
this.calendarWeeks = false;
|
||||
if ('calendarWeeks' in options) {
|
||||
this.calendarWeeks = options.calendarWeeks;
|
||||
} else if ('dateCalendarWeeks' in this.element.data()) {
|
||||
this.calendarWeeks = this.element.data('date-calendar-weeks');
|
||||
}
|
||||
if (this.calendarWeeks)
|
||||
if (this.o.calendarWeeks)
|
||||
this.picker.find('tfoot th.today')
|
||||
.attr('colspan', function(i, val){
|
||||
return parseInt(val) + 1;
|
||||
@ -128,14 +70,10 @@
|
||||
|
||||
this._allow_update = false;
|
||||
|
||||
this.weekStart = ((options.weekStart||this.element.data('date-weekstart')||dates[this.language].weekStart||0) % 7);
|
||||
this.weekEnd = ((this.weekStart + 6) % 7);
|
||||
this.startDate = -Infinity;
|
||||
this.endDate = Infinity;
|
||||
this.daysOfWeekDisabled = [];
|
||||
this.setStartDate(options.startDate||this.element.data('date-startdate'));
|
||||
this.setEndDate(options.endDate||this.element.data('date-enddate'));
|
||||
this.setDaysOfWeekDisabled(options.daysOfWeekDisabled||this.element.data('date-days-of-week-disabled'));
|
||||
this.setStartDate(this.o.startDate);
|
||||
this.setEndDate(this.o.endDate);
|
||||
this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
|
||||
|
||||
this.fillDow();
|
||||
this.fillMonths();
|
||||
|
||||
@ -152,6 +90,68 @@
|
||||
Datepicker.prototype = {
|
||||
constructor: Datepicker,
|
||||
|
||||
_process_options: function(opts){
|
||||
// Store raw options for reference
|
||||
this._o = $.extend({}, this._o, opts);
|
||||
// Processed options
|
||||
var o = this.o = $.extend({}, this._o);
|
||||
|
||||
// Check if "de-DE" style date is available, if not language should
|
||||
// fallback to 2 letter code eg "de"
|
||||
var lang = o.language;
|
||||
if (!dates[lang]) {
|
||||
lang = lang.split('-')[0];
|
||||
if (!dates[lang])
|
||||
lang = defaults.language;
|
||||
}
|
||||
o.language = lang;
|
||||
|
||||
switch(o.startView){
|
||||
case 2:
|
||||
case 'decade':
|
||||
o.startView = 2;
|
||||
break;
|
||||
case 1:
|
||||
case 'year':
|
||||
o.startView = 1;
|
||||
break;
|
||||
default:
|
||||
o.startView = 0;
|
||||
}
|
||||
|
||||
switch (o.minViewMode) {
|
||||
case 1:
|
||||
case 'months':
|
||||
o.minViewMode = 1;
|
||||
break;
|
||||
case 2:
|
||||
case 'years':
|
||||
o.minViewMode = 2;
|
||||
break;
|
||||
default:
|
||||
o.minViewMode = 0;
|
||||
}
|
||||
|
||||
o.startView = Math.max(o.startView, o.minViewMode);
|
||||
|
||||
o.weekStart %= 7;
|
||||
o.weekEnd = ((o.weekStart + 6) % 7);
|
||||
|
||||
var format = DPGlobal.parseFormat(o.format)
|
||||
if (o.startDate !== -Infinity) {
|
||||
o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
|
||||
}
|
||||
if (o.endDate !== Infinity) {
|
||||
o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
|
||||
}
|
||||
|
||||
o.daysOfWeekDisabled = o.daysOfWeekDisabled||[];
|
||||
if (!$.isArray(o.daysOfWeekDisabled))
|
||||
o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/);
|
||||
o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function (d) {
|
||||
return parseInt(d, 10);
|
||||
});
|
||||
},
|
||||
_events: [],
|
||||
_secondaryEvents: [],
|
||||
_applyEvents: function(evs){
|
||||
@ -212,7 +212,12 @@
|
||||
[$(document), {
|
||||
mousedown: $.proxy(function (e) {
|
||||
// Clicked outside the datepicker, hide it
|
||||
if ($(e.target).closest('.datepicker.datepicker-inline, .datepicker.datepicker-dropdown').length === 0) {
|
||||
if (!(
|
||||
this.element.is(e.target) ||
|
||||
this.element.find(e.target).size() ||
|
||||
this.picker.is(e.target) ||
|
||||
this.picker.find(e.target).size()
|
||||
)) {
|
||||
this.hide();
|
||||
}
|
||||
}, this)
|
||||
@ -233,6 +238,19 @@
|
||||
_detachSecondaryEvents: function(){
|
||||
this._unapplyEvents(this._secondaryEvents);
|
||||
},
|
||||
_trigger: function(event, altdate){
|
||||
var date = altdate || this.date,
|
||||
local_date = new Date(date.getTime() + (date.getTimezoneOffset()*60000));
|
||||
|
||||
this.element.trigger({
|
||||
type: event,
|
||||
date: local_date,
|
||||
format: $.proxy(function(altformat){
|
||||
var format = altformat || this.o.format;
|
||||
return DPGlobal.formatDate(date, format, this.o.language);
|
||||
}, this)
|
||||
});
|
||||
},
|
||||
|
||||
show: function(e) {
|
||||
if (!this.isInline)
|
||||
@ -244,10 +262,7 @@
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
this.element.trigger({
|
||||
type: 'show',
|
||||
date: this.date
|
||||
});
|
||||
this._trigger('show');
|
||||
},
|
||||
|
||||
hide: function(e){
|
||||
@ -255,21 +270,18 @@
|
||||
if (!this.picker.is(':visible')) return;
|
||||
this.picker.hide().detach();
|
||||
this._detachSecondaryEvents();
|
||||
this.viewMode = this.startViewMode;
|
||||
this.viewMode = this.o.startView;
|
||||
this.showMode();
|
||||
|
||||
if (
|
||||
this.forceParse &&
|
||||
this.o.forceParse &&
|
||||
(
|
||||
this.isInput && this.element.val() ||
|
||||
this.hasInput && this.element.find('input').val()
|
||||
)
|
||||
)
|
||||
this.setValue();
|
||||
this.element.trigger({
|
||||
type: 'hide',
|
||||
date: this.date
|
||||
});
|
||||
this._trigger('hide');
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
@ -307,7 +319,6 @@
|
||||
if (this.component){
|
||||
this.element.find('input').val(formatted);
|
||||
}
|
||||
this.element.data('date', formatted);
|
||||
} else {
|
||||
this.element.val(formatted);
|
||||
}
|
||||
@ -315,36 +326,24 @@
|
||||
|
||||
getFormattedDate: function(format) {
|
||||
if (format === undefined)
|
||||
format = this.format;
|
||||
return DPGlobal.formatDate(this.date, format, this.language);
|
||||
format = this.o.format;
|
||||
return DPGlobal.formatDate(this.date, format, this.o.language);
|
||||
},
|
||||
|
||||
setStartDate: function(startDate){
|
||||
this.startDate = startDate||-Infinity;
|
||||
if (this.startDate !== -Infinity) {
|
||||
this.startDate = DPGlobal.parseDate(this.startDate, this.format, this.language);
|
||||
}
|
||||
this._process_options({startDate: startDate});
|
||||
this.update();
|
||||
this.updateNavArrows();
|
||||
},
|
||||
|
||||
setEndDate: function(endDate){
|
||||
this.endDate = endDate||Infinity;
|
||||
if (this.endDate !== Infinity) {
|
||||
this.endDate = DPGlobal.parseDate(this.endDate, this.format, this.language);
|
||||
}
|
||||
this._process_options({endDate: endDate});
|
||||
this.update();
|
||||
this.updateNavArrows();
|
||||
},
|
||||
|
||||
setDaysOfWeekDisabled: function(daysOfWeekDisabled){
|
||||
this.daysOfWeekDisabled = daysOfWeekDisabled||[];
|
||||
if (!$.isArray(this.daysOfWeekDisabled)) {
|
||||
this.daysOfWeekDisabled = this.daysOfWeekDisabled.split(/,\s*/);
|
||||
}
|
||||
this.daysOfWeekDisabled = $.map(this.daysOfWeekDisabled, function (d) {
|
||||
return parseInt(d, 10);
|
||||
});
|
||||
this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
|
||||
this.update();
|
||||
this.updateNavArrows();
|
||||
},
|
||||
@ -373,16 +372,17 @@
|
||||
fromArgs = true;
|
||||
} else {
|
||||
date = this.isInput ? this.element.val() : this.element.data('date') || this.element.find('input').val();
|
||||
delete this.element.data().date;
|
||||
}
|
||||
|
||||
this.date = DPGlobal.parseDate(date, this.format, this.language);
|
||||
this.date = DPGlobal.parseDate(date, this.o.format, this.o.language);
|
||||
|
||||
if(fromArgs) this.setValue();
|
||||
|
||||
if (this.date < this.startDate) {
|
||||
this.viewDate = new Date(this.startDate);
|
||||
} else if (this.date > this.endDate) {
|
||||
this.viewDate = new Date(this.endDate);
|
||||
if (this.date < this.o.startDate) {
|
||||
this.viewDate = new Date(this.o.startDate);
|
||||
} else if (this.date > this.o.endDate) {
|
||||
this.viewDate = new Date(this.o.endDate);
|
||||
} else {
|
||||
this.viewDate = new Date(this.date);
|
||||
}
|
||||
@ -390,15 +390,15 @@
|
||||
},
|
||||
|
||||
fillDow: function(){
|
||||
var dowCnt = this.weekStart,
|
||||
var dowCnt = this.o.weekStart,
|
||||
html = '<tr>';
|
||||
if(this.calendarWeeks){
|
||||
if(this.o.calendarWeeks){
|
||||
var cell = '<th class="cw"> </th>';
|
||||
html += cell;
|
||||
this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);
|
||||
}
|
||||
while (dowCnt < this.weekStart + 7) {
|
||||
html += '<th class="dow">'+dates[this.language].daysMin[(dowCnt++)%7]+'</th>';
|
||||
while (dowCnt < this.o.weekStart + 7) {
|
||||
html += '<th class="dow">'+dates[this.o.language].daysMin[(dowCnt++)%7]+'</th>';
|
||||
}
|
||||
html += '</tr>';
|
||||
this.picker.find('.datepicker-days thead').append(html);
|
||||
@ -408,46 +408,93 @@
|
||||
var html = '',
|
||||
i = 0;
|
||||
while (i < 12) {
|
||||
html += '<span class="month">'+dates[this.language].monthsShort[i++]+'</span>';
|
||||
html += '<span class="month">'+dates[this.o.language].monthsShort[i++]+'</span>';
|
||||
}
|
||||
this.picker.find('.datepicker-months td').html(html);
|
||||
},
|
||||
|
||||
setRange: function(range){
|
||||
if (!range || !range.length)
|
||||
delete this.range;
|
||||
else
|
||||
this.range = $.map(range, function(d){ return d.valueOf(); });
|
||||
this.fill();
|
||||
},
|
||||
|
||||
getClassNames: function(date){
|
||||
var cls = [],
|
||||
year = this.viewDate.getUTCFullYear(),
|
||||
month = this.viewDate.getUTCMonth(),
|
||||
currentDate = this.date.valueOf(),
|
||||
today = new Date();
|
||||
if (date.getUTCFullYear() < year || (date.getUTCFullYear() == year && date.getUTCMonth() < month)) {
|
||||
cls.push('old');
|
||||
} else if (date.getUTCFullYear() > year || (date.getUTCFullYear() == year && date.getUTCMonth() > month)) {
|
||||
cls.push('new');
|
||||
}
|
||||
// Compare internal UTC date with local today, not UTC today
|
||||
if (this.o.todayHighlight &&
|
||||
date.getUTCFullYear() == today.getFullYear() &&
|
||||
date.getUTCMonth() == today.getMonth() &&
|
||||
date.getUTCDate() == today.getDate()) {
|
||||
cls.push('today');
|
||||
}
|
||||
if (currentDate && date.valueOf() == currentDate) {
|
||||
cls.push('active');
|
||||
}
|
||||
if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate ||
|
||||
$.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1) {
|
||||
cls.push('disabled');
|
||||
}
|
||||
if (this.range){
|
||||
if (date > this.range[0] && date < this.range[this.range.length-1]){
|
||||
cls.push('range');
|
||||
}
|
||||
if ($.inArray(date.valueOf(), this.range) != -1){
|
||||
cls.push('selected');
|
||||
}
|
||||
}
|
||||
return cls;
|
||||
},
|
||||
|
||||
fill: function() {
|
||||
var d = new Date(this.viewDate),
|
||||
year = d.getUTCFullYear(),
|
||||
month = d.getUTCMonth(),
|
||||
startYear = this.startDate !== -Infinity ? this.startDate.getUTCFullYear() : -Infinity,
|
||||
startMonth = this.startDate !== -Infinity ? this.startDate.getUTCMonth() : -Infinity,
|
||||
endYear = this.endDate !== Infinity ? this.endDate.getUTCFullYear() : Infinity,
|
||||
endMonth = this.endDate !== Infinity ? this.endDate.getUTCMonth() : Infinity,
|
||||
startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
|
||||
startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
|
||||
endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
|
||||
endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
|
||||
currentDate = this.date && this.date.valueOf(),
|
||||
today = new Date();
|
||||
this.picker.find('.datepicker-days thead th.switch')
|
||||
.text(dates[this.language].months[month]+' '+year);
|
||||
tooltip;
|
||||
this.picker.find('.datepicker-days thead th.datepicker-switch')
|
||||
.text(dates[this.o.language].months[month]+' '+year);
|
||||
this.picker.find('tfoot th.today')
|
||||
.text(dates[this.language].today)
|
||||
.toggle(this.todayBtn !== false);
|
||||
.text(dates[this.o.language].today)
|
||||
.toggle(this.o.todayBtn !== false);
|
||||
this.picker.find('tfoot th.clear')
|
||||
.text(dates[this.o.language].clear)
|
||||
.toggle(this.o.clearBtn !== false);
|
||||
this.updateNavArrows();
|
||||
this.fillMonths();
|
||||
var prevMonth = UTCDate(year, month-1, 28,0,0,0,0),
|
||||
day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
|
||||
prevMonth.setUTCDate(day);
|
||||
prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7)%7);
|
||||
prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);
|
||||
var nextMonth = new Date(prevMonth);
|
||||
nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
|
||||
nextMonth = nextMonth.valueOf();
|
||||
var html = [];
|
||||
var clsName;
|
||||
while(prevMonth.valueOf() < nextMonth) {
|
||||
if (prevMonth.getUTCDay() == this.weekStart) {
|
||||
if (prevMonth.getUTCDay() == this.o.weekStart) {
|
||||
html.push('<tr>');
|
||||
if(this.calendarWeeks){
|
||||
if(this.o.calendarWeeks){
|
||||
// ISO 8601: First week contains first thursday.
|
||||
// ISO also states week starts on Monday, but we can be more abstract here.
|
||||
var
|
||||
// Start of current week: based on weekstart/current date
|
||||
ws = new Date(+prevMonth + (this.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
|
||||
ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
|
||||
// Thursday of this week
|
||||
th = new Date(+ws + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
|
||||
// First Thursday of year, year from thursday
|
||||
@ -458,28 +505,26 @@
|
||||
|
||||
}
|
||||
}
|
||||
clsName = '';
|
||||
if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() < month)) {
|
||||
clsName += ' old';
|
||||
} else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() > month)) {
|
||||
clsName += ' new';
|
||||
}
|
||||
// Compare internal UTC date with local today, not UTC today
|
||||
if (this.todayHighlight &&
|
||||
prevMonth.getUTCFullYear() == today.getFullYear() &&
|
||||
prevMonth.getUTCMonth() == today.getMonth() &&
|
||||
prevMonth.getUTCDate() == today.getDate()) {
|
||||
clsName += ' today';
|
||||
}
|
||||
if (currentDate && prevMonth.valueOf() == currentDate) {
|
||||
clsName += ' active';
|
||||
}
|
||||
if (prevMonth.valueOf() < this.startDate || prevMonth.valueOf() > this.endDate ||
|
||||
$.inArray(prevMonth.getUTCDay(), this.daysOfWeekDisabled) !== -1) {
|
||||
clsName += ' disabled';
|
||||
}
|
||||
html.push('<td class="day'+clsName+'">'+prevMonth.getUTCDate() + '</td>');
|
||||
if (prevMonth.getUTCDay() == this.weekEnd) {
|
||||
clsName = this.getClassNames(prevMonth);
|
||||
clsName.push('day');
|
||||
|
||||
var before = this.o.beforeShowDay(prevMonth);
|
||||
if (before === undefined)
|
||||
before = {};
|
||||
else if (typeof(before) === 'boolean')
|
||||
before = {enabled: before};
|
||||
else if (typeof(before) === 'string')
|
||||
before = {classes: before};
|
||||
if (before.enabled === false)
|
||||
clsName.push('disabled');
|
||||
if (before.classes)
|
||||
clsName = clsName.concat(before.classes.split(/\s+/));
|
||||
if (before.tooltip)
|
||||
tooltip = before.tooltip;
|
||||
|
||||
clsName = $.unique(clsName);
|
||||
html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + '>'+prevMonth.getUTCDate() + '</td>');
|
||||
if (prevMonth.getUTCDay() == this.o.weekEnd) {
|
||||
html.push('</tr>');
|
||||
}
|
||||
prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
|
||||
@ -514,7 +559,7 @@
|
||||
.find('td');
|
||||
year -= 1;
|
||||
for (var i = -1; i < 11; i++) {
|
||||
html += '<span class="year'+(i == -1 || i == 10 ? ' old' : '')+(currentYear == year ? ' active' : '')+(year < startYear || year > endYear ? ' disabled' : '')+'">'+year+'</span>';
|
||||
html += '<span class="year'+(i == -1 ? ' old' : i == 10 ? ' new' : '')+(currentYear == year ? ' active' : '')+(year < startYear || year > endYear ? ' disabled' : '')+'">'+year+'</span>';
|
||||
year += 1;
|
||||
}
|
||||
yearCont.html(html);
|
||||
@ -528,12 +573,12 @@
|
||||
month = d.getUTCMonth();
|
||||
switch (this.viewMode) {
|
||||
case 0:
|
||||
if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth()) {
|
||||
if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()) {
|
||||
this.picker.find('.prev').css({visibility: 'hidden'});
|
||||
} else {
|
||||
this.picker.find('.prev').css({visibility: 'visible'});
|
||||
}
|
||||
if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth()) {
|
||||
if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()) {
|
||||
this.picker.find('.next').css({visibility: 'hidden'});
|
||||
} else {
|
||||
this.picker.find('.next').css({visibility: 'visible'});
|
||||
@ -541,12 +586,12 @@
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()) {
|
||||
if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()) {
|
||||
this.picker.find('.prev').css({visibility: 'hidden'});
|
||||
} else {
|
||||
this.picker.find('.prev').css({visibility: 'visible'});
|
||||
}
|
||||
if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()) {
|
||||
if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()) {
|
||||
this.picker.find('.next').css({visibility: 'hidden'});
|
||||
} else {
|
||||
this.picker.find('.next').css({visibility: 'visible'});
|
||||
@ -562,7 +607,7 @@
|
||||
switch(target[0].nodeName.toLowerCase()) {
|
||||
case 'th':
|
||||
switch(target[0].className) {
|
||||
case 'switch':
|
||||
case 'datepicker-switch':
|
||||
this.showMode(1);
|
||||
break;
|
||||
case 'prev':
|
||||
@ -584,9 +629,22 @@
|
||||
date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
|
||||
|
||||
this.showMode(-2);
|
||||
var which = this.todayBtn == 'linked' ? null : 'view';
|
||||
var which = this.o.todayBtn == 'linked' ? null : 'view';
|
||||
this._setDate(date, which);
|
||||
break;
|
||||
case 'clear':
|
||||
var element;
|
||||
if (this.isInput)
|
||||
element = this.element;
|
||||
else if (this.component)
|
||||
element = this.element.find('input');
|
||||
if (element)
|
||||
element.val("").change();
|
||||
this._trigger('changeDate');
|
||||
this.update();
|
||||
if (this.o.autoclose)
|
||||
this.hide();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'span':
|
||||
@ -597,11 +655,8 @@
|
||||
var month = target.parent().find('span').index(target);
|
||||
var year = this.viewDate.getUTCFullYear();
|
||||
this.viewDate.setUTCMonth(month);
|
||||
this.element.trigger({
|
||||
type: 'changeMonth',
|
||||
date: this.viewDate
|
||||
});
|
||||
if ( this.minViewMode == 1 ) {
|
||||
this._trigger('changeMonth', this.viewDate);
|
||||
if (this.o.minViewMode === 1) {
|
||||
this._setDate(UTCDate(year, month, day,0,0,0,0));
|
||||
}
|
||||
} else {
|
||||
@ -609,11 +664,8 @@
|
||||
var day = 1;
|
||||
var month = 0;
|
||||
this.viewDate.setUTCFullYear(year);
|
||||
this.element.trigger({
|
||||
type: 'changeYear',
|
||||
date: this.viewDate
|
||||
});
|
||||
if ( this.minViewMode == 2 ) {
|
||||
this._trigger('changeYear', this.viewDate);
|
||||
if (this.o.minViewMode === 2) {
|
||||
this._setDate(UTCDate(year, month, day,0,0,0,0));
|
||||
}
|
||||
}
|
||||
@ -650,15 +702,12 @@
|
||||
|
||||
_setDate: function(date, which){
|
||||
if (!which || which == 'date')
|
||||
this.date = date;
|
||||
this.date = new Date(date);
|
||||
if (!which || which == 'view')
|
||||
this.viewDate = date;
|
||||
this.viewDate = new Date(date);
|
||||
this.fill();
|
||||
this.setValue();
|
||||
this.element.trigger({
|
||||
type: 'changeDate',
|
||||
date: this.date
|
||||
});
|
||||
this._trigger('changeDate');
|
||||
var element;
|
||||
if (this.isInput) {
|
||||
element = this.element;
|
||||
@ -667,7 +716,7 @@
|
||||
}
|
||||
if (element) {
|
||||
element.change();
|
||||
if (this.autoclose && (!which || which == 'date')) {
|
||||
if (this.o.autoclose && (!which || which == 'date')) {
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
@ -718,7 +767,7 @@
|
||||
},
|
||||
|
||||
dateWithinRange: function(date){
|
||||
return date >= this.startDate && date <= this.endDate;
|
||||
return date >= this.o.startDate && date <= this.o.endDate;
|
||||
},
|
||||
|
||||
keydown: function(e){
|
||||
@ -737,7 +786,7 @@
|
||||
break;
|
||||
case 37: // left
|
||||
case 39: // right
|
||||
if (!this.keyboardNavigation) break;
|
||||
if (!this.o.keyboardNavigation) break;
|
||||
dir = e.keyCode == 37 ? -1 : 1;
|
||||
if (e.ctrlKey){
|
||||
newDate = this.moveYear(this.date, dir);
|
||||
@ -762,7 +811,7 @@
|
||||
break;
|
||||
case 38: // up
|
||||
case 40: // down
|
||||
if (!this.keyboardNavigation) break;
|
||||
if (!this.o.keyboardNavigation) break;
|
||||
dir = e.keyCode == 38 ? -1 : 1;
|
||||
if (e.ctrlKey){
|
||||
newDate = this.moveYear(this.date, dir);
|
||||
@ -794,10 +843,7 @@
|
||||
break;
|
||||
}
|
||||
if (dateChanged){
|
||||
this.element.trigger({
|
||||
type: 'changeDate',
|
||||
date: this.date
|
||||
});
|
||||
this._trigger('changeDate');
|
||||
var element;
|
||||
if (this.isInput) {
|
||||
element = this.element;
|
||||
@ -812,7 +858,7 @@
|
||||
|
||||
showMode: function(dir) {
|
||||
if (dir) {
|
||||
this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir));
|
||||
this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));
|
||||
}
|
||||
/*
|
||||
vitalets: fixing bug of very special conditions:
|
||||
@ -829,24 +875,151 @@
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.datepicker = function ( option ) {
|
||||
var DateRangePicker = function(element, options){
|
||||
this.element = $(element);
|
||||
this.inputs = $.map(options.inputs, function(i){ return i.jquery ? i[0] : i; });
|
||||
delete options.inputs;
|
||||
|
||||
$(this.inputs)
|
||||
.datepicker(options)
|
||||
.bind('changeDate', $.proxy(this.dateUpdated, this));
|
||||
|
||||
this.pickers = $.map(this.inputs, function(i){ return $(i).data('datepicker'); });
|
||||
this.updateDates();
|
||||
};
|
||||
DateRangePicker.prototype = {
|
||||
updateDates: function(){
|
||||
this.dates = $.map(this.pickers, function(i){ return i.date; });
|
||||
this.updateRanges();
|
||||
},
|
||||
updateRanges: function(){
|
||||
var range = $.map(this.dates, function(d){ return d.valueOf(); });
|
||||
$.each(this.pickers, function(i, p){
|
||||
p.setRange(range);
|
||||
});
|
||||
},
|
||||
dateUpdated: function(e){
|
||||
var dp = $(e.target).data('datepicker'),
|
||||
new_date = dp.getUTCDate(),
|
||||
i = $.inArray(e.target, this.inputs),
|
||||
l = this.inputs.length;
|
||||
if (i == -1) return;
|
||||
|
||||
if (new_date < this.dates[i]){
|
||||
// Date being moved earlier/left
|
||||
while (i>=0 && new_date < this.dates[i]){
|
||||
this.pickers[i--].setUTCDate(new_date);
|
||||
}
|
||||
}
|
||||
else if (new_date > this.dates[i]){
|
||||
// Date being moved later/right
|
||||
while (i<l && new_date > this.dates[i]){
|
||||
this.pickers[i++].setUTCDate(new_date);
|
||||
}
|
||||
}
|
||||
this.updateDates();
|
||||
},
|
||||
remove: function(){
|
||||
$.map(this.pickers, function(p){ p.remove(); });
|
||||
delete this.element.data().datepicker;
|
||||
}
|
||||
};
|
||||
|
||||
function opts_from_el(el, prefix){
|
||||
// Derive options from element data-attrs
|
||||
var data = $(el).data(),
|
||||
out = {}, inkey,
|
||||
replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])'),
|
||||
prefix = new RegExp('^' + prefix.toLowerCase());
|
||||
for (var key in data)
|
||||
if (prefix.test(key)){
|
||||
inkey = key.replace(replace, function(_,a){ return a.toLowerCase(); });
|
||||
out[inkey] = data[key];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function opts_from_locale(lang){
|
||||
// Derive options from locale plugins
|
||||
var out = {};
|
||||
// Check if "de-DE" style date is available, if not language should
|
||||
// fallback to 2 letter code eg "de"
|
||||
if (!dates[lang]) {
|
||||
lang = lang.split('-')[0]
|
||||
if (!dates[lang])
|
||||
return;
|
||||
}
|
||||
var d = dates[lang];
|
||||
$.each(locale_opts, function(i,k){
|
||||
if (k in d)
|
||||
out[k] = d[k];
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
var old = $.fn.datepicker;
|
||||
var datepicker = $.fn.datepicker = function ( option ) {
|
||||
var args = Array.apply(null, arguments);
|
||||
args.shift();
|
||||
return this.each(function () {
|
||||
var internal_return,
|
||||
this_return;
|
||||
this.each(function () {
|
||||
var $this = $(this),
|
||||
data = $this.data('datepicker'),
|
||||
options = typeof option == 'object' && option;
|
||||
if (!data) {
|
||||
$this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options))));
|
||||
var elopts = opts_from_el(this, 'date'),
|
||||
// Preliminary otions
|
||||
xopts = $.extend({}, defaults, elopts, options),
|
||||
locopts = opts_from_locale(xopts.language),
|
||||
// Options priority: js args, data-attrs, locales, defaults
|
||||
opts = $.extend({}, defaults, locopts, elopts, options);
|
||||
if ($this.is('.input-daterange') || opts.inputs){
|
||||
var ropts = {
|
||||
inputs: opts.inputs || $this.find('input').toArray()
|
||||
};
|
||||
$this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts))));
|
||||
}
|
||||
else{
|
||||
$this.data('datepicker', (data = new Datepicker(this, opts)));
|
||||
}
|
||||
}
|
||||
if (typeof option == 'string' && typeof data[option] == 'function') {
|
||||
data[option].apply(data, args);
|
||||
internal_return = data[option].apply(data, args);
|
||||
if (internal_return !== undefined)
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (internal_return !== undefined)
|
||||
return internal_return;
|
||||
else
|
||||
return this;
|
||||
};
|
||||
|
||||
$.fn.datepicker.defaults = {
|
||||
var defaults = $.fn.datepicker.defaults = {
|
||||
autoclose: false,
|
||||
beforeShowDay: $.noop,
|
||||
calendarWeeks: false,
|
||||
clearBtn: false,
|
||||
daysOfWeekDisabled: [],
|
||||
endDate: Infinity,
|
||||
forceParse: true,
|
||||
format: 'mm/dd/yyyy',
|
||||
keyboardNavigation: true,
|
||||
language: 'en',
|
||||
minViewMode: 0,
|
||||
rtl: false,
|
||||
startDate: -Infinity,
|
||||
startView: 0,
|
||||
todayBtn: false,
|
||||
todayHighlight: false,
|
||||
weekStart: 0
|
||||
};
|
||||
var locale_opts = $.fn.datepicker.locale_opts = [
|
||||
'format',
|
||||
'rtl',
|
||||
'weekStart'
|
||||
];
|
||||
$.fn.datepicker.Constructor = Datepicker;
|
||||
var dates = $.fn.datepicker.dates = {
|
||||
en: {
|
||||
@ -855,7 +1028,8 @@
|
||||
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
|
||||
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
||||
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
||||
today: "Today"
|
||||
today: "Today",
|
||||
clear: "Clear"
|
||||
}
|
||||
};
|
||||
|
||||
@ -896,6 +1070,8 @@
|
||||
},
|
||||
parseDate: function(date, format, language) {
|
||||
if (date instanceof Date) return date;
|
||||
if (typeof format === 'string')
|
||||
format = DPGlobal.parseFormat(format);
|
||||
if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)) {
|
||||
var part_re = /([\-+]\d+)([dmwy])/,
|
||||
parts = date.match(/([\-+]\d+)([dmwy])/g),
|
||||
@ -986,6 +1162,8 @@
|
||||
return date;
|
||||
},
|
||||
formatDate: function(date, format, language){
|
||||
if (typeof format === 'string')
|
||||
format = DPGlobal.parseFormat(format);
|
||||
var val = {
|
||||
d: date.getUTCDate(),
|
||||
D: dates[language].daysShort[date.getUTCDay()],
|
||||
@ -1000,7 +1178,7 @@
|
||||
val.mm = (val.m < 10 ? '0' : '') + val.m;
|
||||
var date = [],
|
||||
seps = $.extend([], format.separators);
|
||||
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
|
||||
for (var i=0, cnt = format.parts.length; i <= cnt; i++) {
|
||||
if (seps.length)
|
||||
date.push(seps.shift());
|
||||
date.push(val[format.parts[i]]);
|
||||
@ -1010,12 +1188,12 @@
|
||||
headTemplate: '<thead>'+
|
||||
'<tr>'+
|
||||
'<th class="prev"><i class="icon-arrow-left"/></th>'+
|
||||
'<th colspan="5" class="switch"></th>'+
|
||||
'<th colspan="5" class="datepicker-switch"></th>'+
|
||||
'<th class="next"><i class="icon-arrow-right"/></th>'+
|
||||
'</tr>'+
|
||||
'</thead>',
|
||||
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
|
||||
footTemplate: '<tfoot><tr><th colspan="7" class="today"></th></tr></tfoot>'
|
||||
footTemplate: '<tfoot><tr><th colspan="7" class="today"></th></tr><tr><th colspan="7" class="clear"></th></tr></tfoot>'
|
||||
};
|
||||
DPGlobal.template = '<div class="datepicker">'+
|
||||
'<div class="datepicker-days">'+
|
||||
@ -1043,4 +1221,34 @@
|
||||
|
||||
$.fn.datepicker.DPGlobal = DPGlobal;
|
||||
|
||||
}( window.jQuery );
|
||||
|
||||
/* DATEPICKER NO CONFLICT
|
||||
* =================== */
|
||||
|
||||
$.fn.datepicker.noConflict = function(){
|
||||
$.fn.datepicker = old;
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/* DATEPICKER DATA-API
|
||||
* ================== */
|
||||
|
||||
$(document).on(
|
||||
'focus.datepicker.data-api click.datepicker.data-api',
|
||||
'[data-provide="datepicker"]',
|
||||
function(e){
|
||||
var $this = $(this);
|
||||
if ($this.data('datepicker')) return;
|
||||
e.preventDefault();
|
||||
// component click requires us to explicitly show it
|
||||
datepicker.call($this, 'show');
|
||||
}
|
||||
);
|
||||
$(function(){
|
||||
//$('[data-provide="datepicker-inline"]').datepicker();
|
||||
//vit: changed to support noConflict()
|
||||
datepicker.call($('[data-provide="datepicker-inline"]'));
|
||||
});
|
||||
|
||||
}( window.jQuery ));
|
||||
|
@ -26,6 +26,12 @@ $(function(){
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
//store bootstrap-datepicker as bdateicker to exclude conflict with jQuery UI one
|
||||
$.fn.bdatepicker = $.fn.datepicker.noConflict();
|
||||
if(!$.fn.datepicker) { //if there were no other datepickers, keep also original name
|
||||
$.fn.datepicker = $.fn.bdatepicker;
|
||||
}
|
||||
|
||||
var Date = function (options) {
|
||||
this.init('date', options, Date.defaults);
|
||||
this.initPicker(options, Date.defaults);
|
||||
@ -52,7 +58,7 @@ $(function(){
|
||||
this.options.datepicker.language = this.options.datepicker.language || 'en';
|
||||
|
||||
//store DPglobal
|
||||
this.dpg = $.fn.datepicker.DPGlobal;
|
||||
this.dpg = $.fn.bdatepicker.DPGlobal;
|
||||
|
||||
//store parsed formats
|
||||
this.parsedFormat = this.dpg.parseFormat(this.options.format);
|
||||
@ -60,7 +66,7 @@ $(function(){
|
||||
},
|
||||
|
||||
render: function () {
|
||||
this.$input.datepicker(this.options.datepicker);
|
||||
this.$input.bdatepicker(this.options.datepicker);
|
||||
|
||||
//"clear" link
|
||||
if(this.options.clear) {
|
||||
@ -75,55 +81,55 @@ $(function(){
|
||||
},
|
||||
|
||||
value2html: function(value, element) {
|
||||
var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
|
||||
var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
|
||||
Date.superclass.value2html(text, element);
|
||||
},
|
||||
|
||||
html2value: function(html) {
|
||||
return html ? this.dpg.parseDate(html, this.parsedViewFormat, this.options.datepicker.language) : null;
|
||||
return this.parseDate(html, this.parsedViewFormat);
|
||||
},
|
||||
|
||||
|
||||
value2str: function(value) {
|
||||
return value ? this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language) : '';
|
||||
},
|
||||
|
||||
str2value: function(str) {
|
||||
return str ? this.dpg.parseDate(str, this.parsedFormat, this.options.datepicker.language) : null;
|
||||
},
|
||||
|
||||
value2submit: function(value) {
|
||||
return this.value2str(value);
|
||||
},
|
||||
},
|
||||
|
||||
value2input: function(value) {
|
||||
this.$input.datepicker('update', value);
|
||||
},
|
||||
|
||||
input2value: function() {
|
||||
return this.$input.data('datepicker').date;
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
this.$input.data('datepicker').date = null;
|
||||
this.$input.find('.active').removeClass('active');
|
||||
if(!this.options.showbuttons) {
|
||||
this.$input.closest('form').submit();
|
||||
}
|
||||
},
|
||||
|
||||
autosubmit: function() {
|
||||
this.$input.on('mouseup', '.day', function(e){
|
||||
if($(e.currentTarget).is('.old') || $(e.currentTarget).is('.new')) {
|
||||
return;
|
||||
}
|
||||
var $form = $(this).closest('form');
|
||||
setTimeout(function() {
|
||||
$form.submit();
|
||||
}, 200);
|
||||
});
|
||||
str2value: function(str) {
|
||||
return this.parseDate(str, this.parsedFormat);
|
||||
},
|
||||
|
||||
value2submit: function(value) {
|
||||
return this.value2str(value);
|
||||
},
|
||||
|
||||
value2input: function(value) {
|
||||
this.$input.bdatepicker('update', value);
|
||||
},
|
||||
|
||||
input2value: function() {
|
||||
return this.$input.data('datepicker').date;
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
this.$input.data('datepicker').date = null;
|
||||
this.$input.find('.active').removeClass('active');
|
||||
if(!this.options.showbuttons) {
|
||||
this.$input.closest('form').submit();
|
||||
}
|
||||
},
|
||||
|
||||
autosubmit: function() {
|
||||
this.$input.on('mouseup', '.day', function(e){
|
||||
if($(e.currentTarget).is('.old') || $(e.currentTarget).is('.new')) {
|
||||
return;
|
||||
}
|
||||
var $form = $(this).closest('form');
|
||||
setTimeout(function() {
|
||||
$form.submit();
|
||||
}, 200);
|
||||
});
|
||||
//changedate is not suitable as it triggered when showing datepicker. see #149
|
||||
/*
|
||||
this.$input.on('changeDate', function(e){
|
||||
@ -133,10 +139,29 @@ $(function(){
|
||||
}, 200);
|
||||
});
|
||||
*/
|
||||
},
|
||||
|
||||
/*
|
||||
For incorrect date bootstrap-datepicker returns current date that is not suitable
|
||||
for datefield.
|
||||
This function returns null for incorrect date.
|
||||
*/
|
||||
parseDate: function(str, format) {
|
||||
var date = null, formattedBack;
|
||||
if(str) {
|
||||
date = this.dpg.parseDate(str, format, this.options.datepicker.language);
|
||||
if(typeof str === 'string') {
|
||||
formattedBack = this.dpg.formatDate(date, format, this.options.datepicker.language);
|
||||
if(str !== formattedBack) {
|
||||
date = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
Date.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
|
||||
/**
|
||||
@property tpl
|
||||
@ -146,30 +171,30 @@ $(function(){
|
||||
/**
|
||||
@property inputclass
|
||||
@default null
|
||||
**/
|
||||
**/
|
||||
inputclass: null,
|
||||
/**
|
||||
Format used for sending value to server. Also applied when converting date from <code>data-value</code> attribute.<br>
|
||||
Possible tokens are: <code>d, dd, m, mm, yy, yyyy</code>
|
||||
|
||||
|
||||
@property format
|
||||
@type string
|
||||
@default yyyy-mm-dd
|
||||
**/
|
||||
**/
|
||||
format:'yyyy-mm-dd',
|
||||
/**
|
||||
Format used for displaying date. Also applied when converting date from element's text on init.
|
||||
If not specified equals to <code>format</code>
|
||||
|
||||
|
||||
@property viewformat
|
||||
@type string
|
||||
@default null
|
||||
**/
|
||||
viewformat: null,
|
||||
**/
|
||||
viewformat: null,
|
||||
/**
|
||||
Configuration of datepicker.
|
||||
Full list of options: http://vitalets.github.com/bootstrap-datepicker
|
||||
|
||||
|
||||
@property datepicker
|
||||
@type object
|
||||
@default {
|
||||
@ -188,13 +213,13 @@ $(function(){
|
||||
/**
|
||||
Text shown as clear date button.
|
||||
If <code>false</code> clear button will not be rendered.
|
||||
|
||||
|
||||
@property clear
|
||||
@type boolean|string
|
||||
@default 'x clear'
|
||||
@default 'x clear'
|
||||
**/
|
||||
clear: '× clear'
|
||||
});
|
||||
});
|
||||
|
||||
$.fn.editabletypes.date = Date;
|
||||
|
||||
|
@ -23,8 +23,9 @@ Automatically shown in inline mode.
|
||||
this.$input = this.$tpl.find('input');
|
||||
this.setClass();
|
||||
this.setAttr('placeholder');
|
||||
|
||||
this.$tpl.datepicker(this.options.datepicker);
|
||||
|
||||
//bootstrap-datepicker is set `bdateicker` to exclude conflict with jQuery UI one. (in date.js)
|
||||
this.$tpl.bdatepicker(this.options.datepicker);
|
||||
|
||||
//need to disable original event handlers
|
||||
this.$input.off('focus keydown');
|
||||
@ -32,14 +33,14 @@ Automatically shown in inline mode.
|
||||
//update value of datepicker
|
||||
this.$input.keyup($.proxy(function(){
|
||||
this.$tpl.removeData('date');
|
||||
this.$tpl.datepicker('update');
|
||||
this.$tpl.bdatepicker('update');
|
||||
}, this));
|
||||
|
||||
},
|
||||
|
||||
value2input: function(value) {
|
||||
this.$input.val(value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '');
|
||||
this.$tpl.datepicker('update');
|
||||
this.$tpl.bdatepicker('update');
|
||||
},
|
||||
|
||||
input2value: function() {
|
||||
|
@ -32,7 +32,7 @@
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
.datetimepicker-dropdown:before {
|
||||
[class*=" datetimepicker-dropdown"]:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 7px solid transparent;
|
||||
@ -40,40 +40,64 @@
|
||||
border-bottom: 7px solid #ccc;
|
||||
border-bottom-color: rgba(0, 0, 0, 0.2);
|
||||
position: absolute;
|
||||
top: -7px;
|
||||
left: 6px;
|
||||
}
|
||||
.datetimepicker-dropdown:after {
|
||||
[class*=" datetimepicker-dropdown"]:after {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-bottom: 6px solid #ffffff;
|
||||
position: absolute;
|
||||
top: -6px;
|
||||
left: 7px;
|
||||
}
|
||||
.datetimepicker-dropdown-left:before {
|
||||
[class*=" datetimepicker-dropdown-top"]:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 7px solid transparent;
|
||||
border-right: 7px solid transparent;
|
||||
border-bottom: 7px solid #ccc;
|
||||
border-bottom-color: rgba(0, 0, 0, 0.2);
|
||||
position: absolute;
|
||||
border-top: 7px solid #ccc;
|
||||
border-top-color: rgba(0, 0, 0, 0.2);
|
||||
border-bottom: 0;
|
||||
}
|
||||
[class*=" datetimepicker-dropdown-top"]:after {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-top: 6px solid #ffffff;
|
||||
border-bottom: 0;
|
||||
}
|
||||
.datetimepicker-dropdown-bottom-right:before {
|
||||
top: -7px;
|
||||
right: 6px;
|
||||
}
|
||||
.datetimepicker-dropdown-left:after {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-bottom: 6px solid #ffffff;
|
||||
position: absolute;
|
||||
.datetimepicker-dropdown-bottom-right:after {
|
||||
top: -6px;
|
||||
right: 7px;
|
||||
}
|
||||
.datetimepicker-dropdown-bottom-left:before {
|
||||
top: -7px;
|
||||
left: 6px;
|
||||
}
|
||||
.datetimepicker-dropdown-bottom-left:after {
|
||||
top: -6px;
|
||||
left: 7px;
|
||||
}
|
||||
.datetimepicker-dropdown-top-right:before {
|
||||
bottom: -7px;
|
||||
right: 6px;
|
||||
}
|
||||
.datetimepicker-dropdown-top-right:after {
|
||||
bottom: -6px;
|
||||
right: 7px;
|
||||
}
|
||||
.datetimepicker-dropdown-top-left:before {
|
||||
bottom: -7px;
|
||||
left: 6px;
|
||||
}
|
||||
.datetimepicker-dropdown-top-left:after {
|
||||
bottom: -6px;
|
||||
left: 7px;
|
||||
}
|
||||
.datetimepicker > div {
|
||||
display: none;
|
||||
}
|
||||
|
@ -53,10 +53,17 @@
|
||||
this.linkFormat = DPGlobal.parseFormat(options.linkFormat || this.element.data('link-format') || DPGlobal.getDefaultFormat(this.formatType, 'link'), this.formatType);
|
||||
this.minuteStep = options.minuteStep || this.element.data('minute-step') || 5;
|
||||
this.pickerPosition = options.pickerPosition || this.element.data('picker-position') || 'bottom-right';
|
||||
this.showMeridian = options.showMeridian || this.element.data('show-meridian') || false;
|
||||
this.initialDate = options.initialDate || new Date();
|
||||
this.showMeridian = options.showMeridian || this.element.data('show-meridian') || false;
|
||||
this.initialDate = options.initialDate || new Date();
|
||||
|
||||
this._attachEvents();
|
||||
|
||||
this.formatViewType = "datetime";
|
||||
if ('formatViewType' in options) {
|
||||
this.formatViewType = options.formatViewType;
|
||||
} else if ('formatViewType' in this.element.data()) {
|
||||
this.formatViewType = this.element.data('formatViewType');
|
||||
}
|
||||
|
||||
this.minView = 0;
|
||||
if ('minView' in options) {
|
||||
@ -83,13 +90,13 @@
|
||||
this.startViewMode = DPGlobal.convertViewMode(this.startViewMode);
|
||||
this.viewMode = this.startViewMode;
|
||||
|
||||
this.viewSelect = this.minView;
|
||||
if ('viewSelect' in options) {
|
||||
this.viewSelect = options.viewSelect;
|
||||
} else if ('viewSelect' in this.element.data()) {
|
||||
this.viewSelect = this.element.data('view-select');
|
||||
}
|
||||
this.viewSelect = DPGlobal.convertViewMode(this.viewSelect);
|
||||
this.viewSelect = this.minView;
|
||||
if ('viewSelect' in options) {
|
||||
this.viewSelect = options.viewSelect;
|
||||
} else if ('viewSelect' in this.element.data()) {
|
||||
this.viewSelect = this.element.data('view-select');
|
||||
}
|
||||
this.viewSelect = DPGlobal.convertViewMode(this.viewSelect);
|
||||
|
||||
this.forceParse = true;
|
||||
if ('forceParse' in options) {
|
||||
@ -108,11 +115,7 @@
|
||||
if (this.isInline) {
|
||||
this.picker.addClass('datetimepicker-inline');
|
||||
} else {
|
||||
if (this.component && this.pickerPosition == 'bottom-left') {
|
||||
this.picker.addClass('datetimepicker-dropdown-left dropdown-menu');
|
||||
} else {
|
||||
this.picker.addClass('datetimepicker-dropdown dropdown-menu');
|
||||
}
|
||||
this.picker.addClass('datetimepicker-dropdown-' + this.pickerPosition + ' dropdown-menu');
|
||||
}
|
||||
if (this.isRTL){
|
||||
this.picker.addClass('datetimepicker-rtl');
|
||||
@ -301,15 +304,28 @@
|
||||
}
|
||||
},
|
||||
|
||||
setFormat: function(format) {
|
||||
this.format = DPGlobal.parseFormat(format, this.formatType);
|
||||
var element;
|
||||
if (this.isInput) {
|
||||
element = this.element;
|
||||
} else if (this.component){
|
||||
element = this.element.find('input');
|
||||
}
|
||||
if (element && element.val()) {
|
||||
this.setValue();
|
||||
}
|
||||
},
|
||||
|
||||
setValue: function() {
|
||||
var formatted = this.getFormattedDate();
|
||||
if (!this.isInput) {
|
||||
if (this.component){
|
||||
this.element.find('input').prop('value', formatted);
|
||||
this.element.find('input').val(formatted);
|
||||
}
|
||||
this.element.data('date', formatted);
|
||||
} else {
|
||||
this.element.prop('value', formatted);
|
||||
this.element.val(formatted);
|
||||
}
|
||||
if (this.linkField) {
|
||||
$('#' + this.linkField).val(this.getFormattedDate(this.linkFormat));
|
||||
@ -354,21 +370,26 @@
|
||||
place: function(){
|
||||
if(this.isInline) return;
|
||||
var zIndex = parseInt(this.element.parents().filter(function() {
|
||||
return $(this).css('z-index') != 'auto';
|
||||
}).first().css('z-index'))+10;
|
||||
var offset, left;
|
||||
return $(this).css('z-index') != 'auto';
|
||||
}).first().css('z-index'))+10;
|
||||
var offset, top, left;
|
||||
if (this.component) {
|
||||
offset = this.component.offset();
|
||||
left = offset.left;
|
||||
if (this.pickerPosition == 'bottom-left') {
|
||||
if (this.pickerPosition == 'bottom-left' || this.pickerPosition == 'top-left') {
|
||||
left += this.component.outerWidth() - this.picker.outerWidth();
|
||||
}
|
||||
} else {
|
||||
offset = this.element.offset();
|
||||
left = offset.left;
|
||||
}
|
||||
if (this.pickerPosition == 'top-left' || this.pickerPosition == 'top-right') {
|
||||
top = offset.top - this.picker.outerHeight();
|
||||
} else {
|
||||
top = offset.top + this.height;
|
||||
}
|
||||
this.picker.css({
|
||||
top: offset.top + this.height,
|
||||
top: top,
|
||||
left: left,
|
||||
zIndex: zIndex
|
||||
});
|
||||
@ -380,7 +401,7 @@
|
||||
date = arguments[0];
|
||||
fromArgs = true;
|
||||
} else {
|
||||
date = this.isInput ? this.element.prop('value') : this.element.data('date') || this.element.find('input').prop('value') || this.initialDate;
|
||||
date = this.element.data('date') || (this.isInput ? this.element.val() : this.element.find('input').val()) || this.initialDate;
|
||||
}
|
||||
|
||||
if (!date) {
|
||||
@ -439,11 +460,22 @@
|
||||
today = new Date();
|
||||
this.picker.find('.datetimepicker-days thead th:eq(1)')
|
||||
.text(dates[this.language].months[month]+' '+year);
|
||||
this.picker.find('.datetimepicker-hours thead th:eq(1)')
|
||||
.text(dayMonth+' '+dates[this.language].months[month]+' '+year);
|
||||
this.picker.find('.datetimepicker-minutes thead th:eq(1)')
|
||||
.text(dayMonth+' '+dates[this.language].months[month]+' '+year);
|
||||
this.picker.find('tfoot th.today')
|
||||
if (this.formatViewType == "time") {
|
||||
var hourConverted = hours % 12 ? hours % 12 : 12;
|
||||
var hoursDisplay = (hourConverted < 10 ? '0' : '') + hourConverted;
|
||||
var minutesDisplay = (minutes < 10 ? '0' : '') + minutes;
|
||||
var meridianDisplay = dates[this.language].meridiem[hours < 12 ? 0 : 1];
|
||||
this.picker.find('.datetimepicker-hours thead th:eq(1)')
|
||||
.text(hoursDisplay + ':' + minutesDisplay + ' ' + meridianDisplay.toUpperCase());
|
||||
this.picker.find('.datetimepicker-minutes thead th:eq(1)')
|
||||
.text(hoursDisplay + ':' + minutesDisplay + ' ' + meridianDisplay.toUpperCase());
|
||||
} else {
|
||||
this.picker.find('.datetimepicker-hours thead th:eq(1)')
|
||||
.text(dayMonth + ' ' + dates[this.language].months[month] + ' ' + year);
|
||||
this.picker.find('.datetimepicker-minutes thead th:eq(1)')
|
||||
.text(dayMonth + ' ' + dates[this.language].months[month] + ' ' + year);
|
||||
}
|
||||
this.picker.find('tfoot th.today')
|
||||
.text(dates[this.language].today)
|
||||
.toggle(this.todayBtn !== false);
|
||||
this.updateNavArrows();
|
||||
@ -451,9 +483,9 @@
|
||||
/*var prevMonth = UTCDate(year, month, 0,0,0,0,0);
|
||||
prevMonth.setUTCDate(prevMonth.getDate() - (prevMonth.getUTCDay() - this.weekStart + 7)%7);*/
|
||||
var prevMonth = UTCDate(year, month-1, 28,0,0,0,0),
|
||||
day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
|
||||
prevMonth.setUTCDate(day);
|
||||
prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7)%7);
|
||||
day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
|
||||
prevMonth.setUTCDate(day);
|
||||
prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7)%7);
|
||||
var nextMonth = new Date(prevMonth);
|
||||
nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
|
||||
nextMonth = nextMonth.valueOf();
|
||||
@ -492,7 +524,7 @@
|
||||
this.picker.find('.datetimepicker-days tbody').empty().append(html.join(''));
|
||||
|
||||
html = [];
|
||||
var txt = '', meridian = '', meridianOld = '';
|
||||
var txt = '', meridian = '', meridianOld = '';
|
||||
for (var i=0;i<24;i++) {
|
||||
var actual = UTCDate(year, month, dayMonth, i);
|
||||
clsName = '';
|
||||
@ -502,29 +534,29 @@
|
||||
} else if (hours == i) {
|
||||
clsName += ' active';
|
||||
}
|
||||
if (this.showMeridian && dates[this.language].meridiem.length == 2) {
|
||||
meridian = (i<12?dates[this.language].meridiem[0]:dates[this.language].meridiem[1]);
|
||||
if (meridian != meridianOld) {
|
||||
if (meridianOld != '') {
|
||||
html.push('</fieldset>');
|
||||
}
|
||||
html.push('<fieldset class="hour"><legend>'+meridian.toUpperCase()+'</legend>');
|
||||
}
|
||||
meridianOld = meridian;
|
||||
txt = (i%12?i%12:12);
|
||||
html.push('<span class="hour'+clsName+' hour_'+(i<12?'am':'pm')+'">'+txt+'</span>');
|
||||
if (i == 23) {
|
||||
html.push('</fieldset>');
|
||||
}
|
||||
} else {
|
||||
txt = i+':00';
|
||||
html.push('<span class="hour'+clsName+'">'+txt+'</span>');
|
||||
}
|
||||
if (this.showMeridian && dates[this.language].meridiem.length == 2) {
|
||||
meridian = (i<12?dates[this.language].meridiem[0]:dates[this.language].meridiem[1]);
|
||||
if (meridian != meridianOld) {
|
||||
if (meridianOld != '') {
|
||||
html.push('</fieldset>');
|
||||
}
|
||||
html.push('<fieldset class="hour"><legend>'+meridian.toUpperCase()+'</legend>');
|
||||
}
|
||||
meridianOld = meridian;
|
||||
txt = (i%12?i%12:12);
|
||||
html.push('<span class="hour'+clsName+' hour_'+(i<12?'am':'pm')+'">'+txt+'</span>');
|
||||
if (i == 23) {
|
||||
html.push('</fieldset>');
|
||||
}
|
||||
} else {
|
||||
txt = i+':00';
|
||||
html.push('<span class="hour'+clsName+'">'+txt+'</span>');
|
||||
}
|
||||
}
|
||||
this.picker.find('.datetimepicker-hours td').html(html.join(''));
|
||||
|
||||
html = [];
|
||||
txt = '', meridian = '', meridianOld = '';
|
||||
txt = '', meridian = '', meridianOld = '';
|
||||
for(var i=0;i<60;i+=this.minuteStep) {
|
||||
var actual = UTCDate(year, month, dayMonth, hours, i, 0);
|
||||
clsName = '';
|
||||
@ -533,26 +565,26 @@
|
||||
} else if (Math.floor(minutes/this.minuteStep) == Math.floor(i/this.minuteStep)) {
|
||||
clsName += ' active';
|
||||
}
|
||||
if (this.showMeridian && dates[this.language].meridiem.length == 2) {
|
||||
meridian = (hours<12?dates[this.language].meridiem[0]:dates[this.language].meridiem[1]);
|
||||
if (meridian != meridianOld) {
|
||||
if (meridianOld != '') {
|
||||
html.push('</fieldset>');
|
||||
}
|
||||
html.push('<fieldset class="minute"><legend>'+meridian.toUpperCase()+'</legend>');
|
||||
}
|
||||
meridianOld = meridian;
|
||||
txt = (hours%12?hours%12:12);
|
||||
//html.push('<span class="minute'+clsName+' minute_'+(hours<12?'am':'pm')+'">'+txt+'</span>');
|
||||
html.push('<span class="minute'+clsName+'">'+txt+':'+(i<10?'0'+i:i)+'</span>');
|
||||
if (i == 59) {
|
||||
html.push('</fieldset>');
|
||||
}
|
||||
} else {
|
||||
txt = i+':00';
|
||||
//html.push('<span class="hour'+clsName+'">'+txt+'</span>');
|
||||
html.push('<span class="minute'+clsName+'">'+hours+':'+(i<10?'0'+i:i)+'</span>');
|
||||
}
|
||||
if (this.showMeridian && dates[this.language].meridiem.length == 2) {
|
||||
meridian = (hours<12?dates[this.language].meridiem[0]:dates[this.language].meridiem[1]);
|
||||
if (meridian != meridianOld) {
|
||||
if (meridianOld != '') {
|
||||
html.push('</fieldset>');
|
||||
}
|
||||
html.push('<fieldset class="minute"><legend>'+meridian.toUpperCase()+'</legend>');
|
||||
}
|
||||
meridianOld = meridian;
|
||||
txt = (hours%12?hours%12:12);
|
||||
//html.push('<span class="minute'+clsName+' minute_'+(hours<12?'am':'pm')+'">'+txt+'</span>');
|
||||
html.push('<span class="minute'+clsName+'">'+txt+':'+(i<10?'0'+i:i)+'</span>');
|
||||
if (i == 59) {
|
||||
html.push('</fieldset>');
|
||||
}
|
||||
} else {
|
||||
txt = i+':00';
|
||||
//html.push('<span class="hour'+clsName+'">'+txt+'</span>');
|
||||
html.push('<span class="minute'+clsName+'">'+hours+':'+(i<10?'0'+i:i)+'</span>');
|
||||
}
|
||||
}
|
||||
this.picker.find('.datetimepicker-minutes td').html(html.join(''));
|
||||
|
||||
@ -588,6 +620,7 @@
|
||||
year += 1;
|
||||
}
|
||||
yearCont.html(html);
|
||||
this.place();
|
||||
},
|
||||
|
||||
updateNavArrows: function() {
|
||||
@ -607,9 +640,9 @@
|
||||
this.picker.find('.prev').css({visibility: 'visible'});
|
||||
}
|
||||
if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()
|
||||
&& month >= this.endDate.getUTCMonth()
|
||||
&& day >= this.endDate.getUTCDate()
|
||||
&& hour >= this.endDate.getUTCHours()) {
|
||||
&& month >= this.endDate.getUTCMonth()
|
||||
&& day >= this.endDate.getUTCDate()
|
||||
&& hour >= this.endDate.getUTCHours()) {
|
||||
this.picker.find('.next').css({visibility: 'hidden'});
|
||||
} else {
|
||||
this.picker.find('.next').css({visibility: 'visible'});
|
||||
@ -624,8 +657,8 @@
|
||||
this.picker.find('.prev').css({visibility: 'visible'});
|
||||
}
|
||||
if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()
|
||||
&& month >= this.endDate.getUTCMonth()
|
||||
&& day >= this.endDate.getUTCDate()) {
|
||||
&& month >= this.endDate.getUTCMonth()
|
||||
&& day >= this.endDate.getUTCDate()) {
|
||||
this.picker.find('.next').css({visibility: 'hidden'});
|
||||
} else {
|
||||
this.picker.find('.next').css({visibility: 'visible'});
|
||||
@ -639,7 +672,7 @@
|
||||
this.picker.find('.prev').css({visibility: 'visible'});
|
||||
}
|
||||
if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()
|
||||
&& month >= this.endDate.getUTCMonth()) {
|
||||
&& month >= this.endDate.getUTCMonth()) {
|
||||
this.picker.find('.next').css({visibility: 'hidden'});
|
||||
} else {
|
||||
this.picker.find('.next').css({visibility: 'visible'});
|
||||
@ -717,25 +750,25 @@
|
||||
break;
|
||||
case 'span':
|
||||
if (!target.is('.disabled')) {
|
||||
var year = this.viewDate.getUTCFullYear(),
|
||||
month = this.viewDate.getUTCMonth(),
|
||||
day = this.viewDate.getUTCDate(),
|
||||
hours = this.viewDate.getUTCHours(),
|
||||
minutes = this.viewDate.getUTCMinutes(),
|
||||
seconds = this.viewDate.getUTCSeconds();
|
||||
var year = this.viewDate.getUTCFullYear(),
|
||||
month = this.viewDate.getUTCMonth(),
|
||||
day = this.viewDate.getUTCDate(),
|
||||
hours = this.viewDate.getUTCHours(),
|
||||
minutes = this.viewDate.getUTCMinutes(),
|
||||
seconds = this.viewDate.getUTCSeconds();
|
||||
|
||||
if (target.is('.month')) {
|
||||
this.viewDate.setUTCDate(1);
|
||||
month = target.parent().find('span').index(target);
|
||||
day = this.viewDate.getUTCDate();
|
||||
day = this.viewDate.getUTCDate();
|
||||
this.viewDate.setUTCMonth(month);
|
||||
this.element.trigger({
|
||||
type: 'changeMonth',
|
||||
date: this.viewDate
|
||||
});
|
||||
if (this.viewSelect >= 3) {
|
||||
this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
|
||||
}
|
||||
if (this.viewSelect >= 3) {
|
||||
this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
|
||||
}
|
||||
} else if (target.is('.year')) {
|
||||
this.viewDate.setUTCDate(1);
|
||||
year = parseInt(target.text(), 10) || 0;
|
||||
@ -744,36 +777,36 @@
|
||||
type: 'changeYear',
|
||||
date: this.viewDate
|
||||
});
|
||||
if (this.viewSelect >= 4) {
|
||||
this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
|
||||
}
|
||||
if (this.viewSelect >= 4) {
|
||||
this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
|
||||
}
|
||||
} else if (target.is('.hour')){
|
||||
hours = parseInt(target.text(), 10) || 0;
|
||||
if (target.hasClass('hour_am') || target.hasClass('hour_pm')) {
|
||||
if (hours == 12 && target.hasClass('hour_am')) {
|
||||
hours = 0;
|
||||
} else if (hours != 12 && target.hasClass('hour_pm')) {
|
||||
hours += 12;
|
||||
}
|
||||
}
|
||||
this.viewDate.setUTCHours(hours);
|
||||
if (target.hasClass('hour_am') || target.hasClass('hour_pm')) {
|
||||
if (hours == 12 && target.hasClass('hour_am')) {
|
||||
hours = 0;
|
||||
} else if (hours != 12 && target.hasClass('hour_pm')) {
|
||||
hours += 12;
|
||||
}
|
||||
}
|
||||
this.viewDate.setUTCHours(hours);
|
||||
this.element.trigger({
|
||||
type: 'changeHour',
|
||||
date: this.viewDate
|
||||
});
|
||||
if (this.viewSelect >= 1) {
|
||||
this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
|
||||
}
|
||||
if (this.viewSelect >= 1) {
|
||||
this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
|
||||
}
|
||||
} else if (target.is('.minute')){
|
||||
minutes = parseInt(target.text().substr(target.text().indexOf(':')+1), 10) || 0;
|
||||
this.viewDate.setUTCMinutes(minutes);
|
||||
this.viewDate.setUTCMinutes(minutes);
|
||||
this.element.trigger({
|
||||
type: 'changeMinute',
|
||||
date: this.viewDate
|
||||
});
|
||||
if (this.viewSelect >= 0) {
|
||||
this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
|
||||
}
|
||||
if (this.viewSelect >= 0) {
|
||||
this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
|
||||
}
|
||||
}
|
||||
if (this.viewMode != 0) {
|
||||
var oldViewMode = this.viewMode;
|
||||
@ -813,16 +846,16 @@
|
||||
month += 1;
|
||||
}
|
||||
}
|
||||
this.viewDate.setUTCDate(day);
|
||||
this.viewDate.setUTCMonth(month);
|
||||
this.viewDate.setUTCFullYear(year);
|
||||
this.element.trigger({
|
||||
type: 'changeDay',
|
||||
date: this.viewDate
|
||||
});
|
||||
if (this.viewSelect >= 2) {
|
||||
this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
|
||||
}
|
||||
this.viewDate.setUTCDate(day);
|
||||
this.viewDate.setUTCMonth(month);
|
||||
this.viewDate.setUTCFullYear(year);
|
||||
this.element.trigger({
|
||||
type: 'changeDay',
|
||||
date: this.viewDate
|
||||
});
|
||||
if (this.viewSelect >= 2) {
|
||||
this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
|
||||
}
|
||||
}
|
||||
var oldViewMode = this.viewMode;
|
||||
this.showMode(-1);
|
||||
@ -841,10 +874,6 @@
|
||||
if (!which || which == 'view')
|
||||
this.viewDate = date;
|
||||
this.fill();
|
||||
this.element.trigger({
|
||||
type: 'changeDate',
|
||||
date: this.date
|
||||
});
|
||||
this.setValue();
|
||||
var element;
|
||||
if (this.isInput) {
|
||||
@ -858,6 +887,10 @@
|
||||
//this.hide();
|
||||
}
|
||||
}
|
||||
this.element.trigger({
|
||||
type: 'changeDate',
|
||||
date: this.date
|
||||
});
|
||||
},
|
||||
|
||||
moveMinute: function(date, dir){
|
||||
@ -950,28 +983,28 @@
|
||||
case 39: // right
|
||||
if (!this.keyboardNavigation) break;
|
||||
dir = e.keyCode == 37 ? -1 : 1;
|
||||
viewMode = this.viewMode;
|
||||
if (e.ctrlKey) {
|
||||
viewMode += 2;
|
||||
} else if (e.shiftKey) {
|
||||
viewMode += 1;
|
||||
}
|
||||
if (viewMode == 4) {
|
||||
viewMode = this.viewMode;
|
||||
if (e.ctrlKey) {
|
||||
viewMode += 2;
|
||||
} else if (e.shiftKey) {
|
||||
viewMode += 1;
|
||||
}
|
||||
if (viewMode == 4) {
|
||||
newDate = this.moveYear(this.date, dir);
|
||||
newViewDate = this.moveYear(this.viewDate, dir);
|
||||
} else if (viewMode == 3) {
|
||||
} else if (viewMode == 3) {
|
||||
newDate = this.moveMonth(this.date, dir);
|
||||
newViewDate = this.moveMonth(this.viewDate, dir);
|
||||
} else if (viewMode == 2) {
|
||||
} else if (viewMode == 2) {
|
||||
newDate = this.moveDate(this.date, dir);
|
||||
newViewDate = this.moveDate(this.viewDate, dir);
|
||||
} else if (viewMode == 1) {
|
||||
} else if (viewMode == 1) {
|
||||
newDate = this.moveHour(this.date, dir);
|
||||
newViewDate = this.moveHour(this.viewDate, dir);
|
||||
} else if (viewMode == 0) {
|
||||
} else if (viewMode == 0) {
|
||||
newDate = this.moveMinute(this.date, dir);
|
||||
newViewDate = this.moveMinute(this.viewDate, dir);
|
||||
}
|
||||
}
|
||||
if (this.dateWithinRange(newDate)){
|
||||
this.date = newDate;
|
||||
this.viewDate = newViewDate;
|
||||
@ -985,33 +1018,33 @@
|
||||
case 40: // down
|
||||
if (!this.keyboardNavigation) break;
|
||||
dir = e.keyCode == 38 ? -1 : 1;
|
||||
viewMode = this.viewMode;
|
||||
if (e.ctrlKey) {
|
||||
viewMode += 2;
|
||||
} else if (e.shiftKey) {
|
||||
viewMode += 1;
|
||||
}
|
||||
if (viewMode == 4) {
|
||||
viewMode = this.viewMode;
|
||||
if (e.ctrlKey) {
|
||||
viewMode += 2;
|
||||
} else if (e.shiftKey) {
|
||||
viewMode += 1;
|
||||
}
|
||||
if (viewMode == 4) {
|
||||
newDate = this.moveYear(this.date, dir);
|
||||
newViewDate = this.moveYear(this.viewDate, dir);
|
||||
} else if (viewMode == 3) {
|
||||
} else if (viewMode == 3) {
|
||||
newDate = this.moveMonth(this.date, dir);
|
||||
newViewDate = this.moveMonth(this.viewDate, dir);
|
||||
} else if (viewMode == 2) {
|
||||
} else if (viewMode == 2) {
|
||||
newDate = this.moveDate(this.date, dir * 7);
|
||||
newViewDate = this.moveDate(this.viewDate, dir * 7);
|
||||
} else if (viewMode == 1) {
|
||||
if (this.showMeridian) {
|
||||
newDate = this.moveHour(this.date, dir * 6);
|
||||
newViewDate = this.moveHour(this.viewDate, dir * 6);
|
||||
} else {
|
||||
newDate = this.moveHour(this.date, dir * 4);
|
||||
newViewDate = this.moveHour(this.viewDate, dir * 4);
|
||||
}
|
||||
} else if (viewMode == 0) {
|
||||
} else if (viewMode == 1) {
|
||||
if (this.showMeridian) {
|
||||
newDate = this.moveHour(this.date, dir * 6);
|
||||
newViewDate = this.moveHour(this.viewDate, dir * 6);
|
||||
} else {
|
||||
newDate = this.moveHour(this.date, dir * 4);
|
||||
newViewDate = this.moveHour(this.viewDate, dir * 4);
|
||||
}
|
||||
} else if (viewMode == 0) {
|
||||
newDate = this.moveMinute(this.date, dir * 4);
|
||||
newViewDate = this.moveMinute(this.viewDate, dir * 4);
|
||||
}
|
||||
}
|
||||
if (this.dateWithinRange(newDate)){
|
||||
this.date = newDate;
|
||||
this.viewDate = newViewDate;
|
||||
@ -1022,19 +1055,19 @@
|
||||
}
|
||||
break;
|
||||
case 13: // enter
|
||||
if (this.viewMode != 0) {
|
||||
var oldViewMode = this.viewMode;
|
||||
this.showMode(-1);
|
||||
this.fill();
|
||||
if (oldViewMode == this.viewMode && this.autoclose) {
|
||||
this.hide();
|
||||
}
|
||||
} else {
|
||||
this.fill();
|
||||
if (this.autoclose) {
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
if (this.viewMode != 0) {
|
||||
var oldViewMode = this.viewMode;
|
||||
this.showMode(-1);
|
||||
this.fill();
|
||||
if (oldViewMode == this.viewMode && this.autoclose) {
|
||||
this.hide();
|
||||
}
|
||||
} else {
|
||||
this.fill();
|
||||
if (this.autoclose) {
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
e.preventDefault();
|
||||
break;
|
||||
case 9: // tab
|
||||
@ -1042,10 +1075,6 @@
|
||||
break;
|
||||
}
|
||||
if (dateChanged){
|
||||
this.element.trigger({
|
||||
type: 'changeDate',
|
||||
date: this.date
|
||||
});
|
||||
var element;
|
||||
if (this.isInput) {
|
||||
element = this.element;
|
||||
@ -1055,6 +1084,10 @@
|
||||
if (element) {
|
||||
element.change();
|
||||
}
|
||||
this.element.trigger({
|
||||
type: 'changeDate',
|
||||
date: this.date
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -1062,17 +1095,24 @@
|
||||
if (dir) {
|
||||
var newViewMode = Math.max(0, Math.min(DPGlobal.modes.length - 1, this.viewMode + dir));
|
||||
if (newViewMode >= this.minView && newViewMode <= this.maxView) {
|
||||
this.element.trigger({
|
||||
type: 'changeMode',
|
||||
date: this.viewDate,
|
||||
oldViewMode: this.viewMode,
|
||||
newViewMode: newViewMode
|
||||
});
|
||||
|
||||
this.viewMode = newViewMode;
|
||||
}
|
||||
}
|
||||
/*
|
||||
vitalets: fixing bug of very special conditions:
|
||||
jquery 1.7.1 + webkit + show inline datetimepicker in bootstrap popover.
|
||||
Method show() does not set display css correctly and datetimepicker is not shown.
|
||||
Changed to .css('display', 'block') solve the problem.
|
||||
See https://github.com/vitalets/x-editable/issues/37
|
||||
vitalets: fixing bug of very special conditions:
|
||||
jquery 1.7.1 + webkit + show inline datetimepicker in bootstrap popover.
|
||||
Method show() does not set display css correctly and datetimepicker is not shown.
|
||||
Changed to .css('display', 'block') solve the problem.
|
||||
See https://github.com/vitalets/x-editable/issues/37
|
||||
|
||||
In jquery 1.7.2+ everything works fine.
|
||||
In jquery 1.7.2+ everything works fine.
|
||||
*/
|
||||
//this.picker.find('>div').hide().filter('.datetimepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
|
||||
this.picker.find('>div').hide().filter('.datetimepicker-'+DPGlobal.modes[this.viewMode].clsName).css('display', 'block');
|
||||
@ -1187,7 +1227,7 @@
|
||||
parseDate: function(date, format, language, type) {
|
||||
if (date instanceof Date) {
|
||||
var dateUTC = new Date(date.valueOf() - date.getTimezoneOffset() * 60000);
|
||||
dateUTC.setMilliseconds(0);
|
||||
dateUTC.setMilliseconds(0);
|
||||
return dateUTC;
|
||||
}
|
||||
if (/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(date)) {
|
||||
@ -1254,7 +1294,7 @@
|
||||
val, filtered, part;
|
||||
setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
|
||||
setters_map['dd'] = setters_map['d'];
|
||||
setters_map['P'] = setters_map['p'];
|
||||
setters_map['P'] = setters_map['p'];
|
||||
date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds());
|
||||
if (parts.length == format.parts.length) {
|
||||
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
|
||||
@ -1278,10 +1318,10 @@
|
||||
});
|
||||
val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
|
||||
break;
|
||||
case 'p':
|
||||
case 'P':
|
||||
val = $.inArray(parts[i].toLowerCase(), dates[language].meridiem);
|
||||
break;
|
||||
case 'p':
|
||||
case 'P':
|
||||
val = $.inArray(parts[i].toLowerCase(), dates[language].meridiem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
parsed[part] = val;
|
||||
@ -1320,9 +1360,9 @@
|
||||
// second
|
||||
s: date.getUTCSeconds()
|
||||
};
|
||||
val.H = (val.h%12==0? 12 : val.h%12);
|
||||
val.HH = (val.H < 10 ? '0' : '') + val.H;
|
||||
val.P = val.p.toUpperCase();
|
||||
val.H = (val.h%12==0? 12 : val.h%12);
|
||||
val.HH = (val.H < 10 ? '0' : '') + val.H;
|
||||
val.P = val.p.toUpperCase();
|
||||
val.hh = (val.h < 10 ? '0' : '') + val.h;
|
||||
val.ii = (val.i < 10 ? '0' : '') + val.i;
|
||||
val.ss = (val.s < 10 ? '0' : '') + val.s;
|
||||
|
@ -5,7 +5,7 @@ Before usage you should manually include dependent js and css:
|
||||
|
||||
<link href="css/datetimepicker.css" rel="stylesheet" type="text/css"></link>
|
||||
<script src="js/bootstrap-datetimepicker.js"></script>
|
||||
|
||||
|
||||
For **i18n** you should include js file from here: https://github.com/smalot/bootstrap-datetimepicker/tree/master/js/locales
|
||||
and set `language` option.
|
||||
|
||||
@ -30,14 +30,14 @@ $(function(){
|
||||
**/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
|
||||
var DateTime = function (options) {
|
||||
this.init('datetime', options, DateTime.defaults);
|
||||
this.initPicker(options, DateTime.defaults);
|
||||
};
|
||||
|
||||
$.fn.editableutils.inherit(DateTime, $.fn.editabletypes.abstractinput);
|
||||
|
||||
|
||||
$.extend(DateTime.prototype, {
|
||||
initPicker: function(options, defaults) {
|
||||
//'format' is set directly from settings or data-* attributes
|
||||
@ -46,13 +46,13 @@ $(function(){
|
||||
if(!this.options.viewformat) {
|
||||
this.options.viewformat = this.options.format;
|
||||
}
|
||||
|
||||
|
||||
//overriding datetimepicker config (as by default jQuery extend() is not recursive)
|
||||
//since 1.4 datetimepicker internally uses viewformat instead of format. Format is for submit only
|
||||
this.options.datetimepicker = $.extend({}, defaults.datetimepicker, options.datetimepicker, {
|
||||
format: this.options.viewformat
|
||||
});
|
||||
|
||||
|
||||
//language
|
||||
this.options.datetimepicker.language = this.options.datetimepicker.language || 'en';
|
||||
|
||||
@ -62,16 +62,21 @@ $(function(){
|
||||
//store parsed formats
|
||||
this.parsedFormat = this.dpg.parseFormat(this.options.format, this.options.formatType);
|
||||
this.parsedViewFormat = this.dpg.parseFormat(this.options.viewformat, this.options.formatType);
|
||||
|
||||
//
|
||||
this.options.datetimepicker.startView = this.options.startView;
|
||||
this.options.datetimepicker.minView = this.options.minView;
|
||||
this.options.datetimepicker.maxView = this.options.maxView;
|
||||
},
|
||||
|
||||
|
||||
render: function () {
|
||||
this.$input.datetimepicker(this.options.datetimepicker);
|
||||
|
||||
|
||||
//adjust container position when viewMode changes
|
||||
//see https://github.com/smalot/bootstrap-datetimepicker/pull/80
|
||||
this.$input.on('changeMode', function(e) {
|
||||
var f = $(this).closest('form').parent();
|
||||
//timeout here, otherwise container changes position before form has new size
|
||||
setTimeout(function(){
|
||||
f.triggerHandler('resize');
|
||||
}, 0);
|
||||
});
|
||||
|
||||
//"clear" link
|
||||
if(this.options.clear) {
|
||||
this.$clear = $('<a href="#"></a>').html(this.options.clear).click($.proxy(function(e){
|
||||
@ -79,11 +84,11 @@ $(function(){
|
||||
e.stopPropagation();
|
||||
this.clear();
|
||||
}, this));
|
||||
|
||||
|
||||
this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
value2html: function(value, element) {
|
||||
//formatDate works with UTCDate!
|
||||
var text = value ? this.dpg.formatDate(this.toUTC(value), this.parsedViewFormat, this.options.datetimepicker.language, this.options.formatType) : '';
|
||||
@ -91,45 +96,45 @@ $(function(){
|
||||
DateTime.superclass.value2html(text, element);
|
||||
} else {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
html2value: function(html) {
|
||||
//parseDate return utc date!
|
||||
var value = html ? this.dpg.parseDate(html, this.parsedViewFormat, this.options.datetimepicker.language, this.options.formatType) : null;
|
||||
var value = this.parseDate(html, this.parsedViewFormat);
|
||||
return value ? this.fromUTC(value) : null;
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
value2str: function(value) {
|
||||
//formatDate works with UTCDate!
|
||||
return value ? this.dpg.formatDate(this.toUTC(value), this.parsedFormat, this.options.datetimepicker.language, this.options.formatType) : '';
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
str2value: function(str) {
|
||||
//parseDate return utc date!
|
||||
var value = str ? this.dpg.parseDate(str, this.parsedFormat, this.options.datetimepicker.language, this.options.formatType) : null;
|
||||
var value = this.parseDate(str, this.parsedFormat);
|
||||
return value ? this.fromUTC(value) : null;
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
value2submit: function(value) {
|
||||
return this.value2str(value);
|
||||
},
|
||||
},
|
||||
|
||||
value2input: function(value) {
|
||||
if(value) {
|
||||
this.$input.data('datetimepicker').setDate(value);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
input2value: function() {
|
||||
//date may be cleared, in that case getDate() triggers error
|
||||
var dt = this.$input.data('datetimepicker');
|
||||
return dt.date ? dt.getDate() : null;
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
},
|
||||
|
||||
|
||||
clear: function() {
|
||||
this.$input.data('datetimepicker').date = null;
|
||||
this.$input.find('.active').removeClass('active');
|
||||
@ -137,7 +142,7 @@ $(function(){
|
||||
this.$input.closest('form').submit();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
autosubmit: function() {
|
||||
this.$input.on('mouseup', '.minute', function(e){
|
||||
var $form = $(this).closest('form');
|
||||
@ -146,19 +151,38 @@ $(function(){
|
||||
}, 200);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
//convert date from local to utc
|
||||
toUTC: function(value) {
|
||||
return value ? new Date(value.valueOf() - value.getTimezoneOffset() * 60000) : value;
|
||||
},
|
||||
|
||||
|
||||
//convert date from utc to local
|
||||
fromUTC: function(value) {
|
||||
return value ? new Date(value.valueOf() + value.getTimezoneOffset() * 60000) : value;
|
||||
},
|
||||
|
||||
/*
|
||||
For incorrect date bootstrap-datetimepicker returns current date that is not suitable
|
||||
for datetimefield.
|
||||
This function returns null for incorrect date.
|
||||
*/
|
||||
parseDate: function(str, format) {
|
||||
var date = null, formattedBack;
|
||||
if(str) {
|
||||
date = this.dpg.parseDate(str, format, this.options.datetimepicker.language, this.options.formatType);
|
||||
if(typeof str === 'string') {
|
||||
formattedBack = this.dpg.formatDate(date, format, this.options.datetimepicker.language, this.options.formatType);
|
||||
if(str !== formattedBack) {
|
||||
date = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
DateTime.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
|
||||
/**
|
||||
@property tpl
|
||||
@ -168,7 +192,7 @@ $(function(){
|
||||
/**
|
||||
@property inputclass
|
||||
@default null
|
||||
**/
|
||||
**/
|
||||
inputclass: null,
|
||||
/**
|
||||
Format used for sending value to server. Also applied when converting date from <code>data-value</code> attribute.<br>
|
||||
@ -187,12 +211,12 @@ $(function(){
|
||||
@property viewformat
|
||||
@type string
|
||||
@default null
|
||||
**/
|
||||
viewformat: null,
|
||||
**/
|
||||
viewformat: null,
|
||||
/**
|
||||
Configuration of datetimepicker.
|
||||
Full list of options: https://github.com/smalot/bootstrap-datetimepicker
|
||||
|
||||
|
||||
@property datetimepicker
|
||||
@type object
|
||||
@default { }
|
||||
@ -204,13 +228,13 @@ $(function(){
|
||||
/**
|
||||
Text shown as clear date button.
|
||||
If <code>false</code> clear button will not be rendered.
|
||||
|
||||
|
||||
@property clear
|
||||
@type boolean|string
|
||||
@default 'x clear'
|
||||
@default 'x clear'
|
||||
**/
|
||||
clear: '× clear'
|
||||
});
|
||||
});
|
||||
|
||||
$.fn.editabletypes.datetime = DateTime;
|
||||
|
||||
|
@ -58,30 +58,33 @@ List - abstract class for inputs that have source option loaded from js array or
|
||||
// ------------- additional functions ------------
|
||||
|
||||
onSourceReady: function (success, error) {
|
||||
//run source if it function
|
||||
var source;
|
||||
if ($.isFunction(this.options.source)) {
|
||||
source = this.options.source.call(this.options.scope);
|
||||
this.sourceData = null;
|
||||
//note: if function returns the same source as URL - sourceData will be taken from cahce and no extra request performed
|
||||
} else {
|
||||
source = this.options.source;
|
||||
}
|
||||
|
||||
//if allready loaded just call success
|
||||
if($.isArray(this.sourceData)) {
|
||||
if(this.options.sourceCache && $.isArray(this.sourceData)) {
|
||||
success.call(this);
|
||||
return;
|
||||
}
|
||||
|
||||
// try parse json in single quotes (for double quotes jquery does automatically)
|
||||
//try parse json in single quotes (for double quotes jquery does automatically)
|
||||
try {
|
||||
this.options.source = $.fn.editableutils.tryParseJson(this.options.source, false);
|
||||
source = $.fn.editableutils.tryParseJson(source, false);
|
||||
} catch (e) {
|
||||
error.call(this);
|
||||
return;
|
||||
}
|
||||
|
||||
var source = this.options.source;
|
||||
|
||||
//run source if it function
|
||||
if ($.isFunction(source)) {
|
||||
source = source.call(this.options.scope);
|
||||
}
|
||||
|
||||
//loading from url
|
||||
if (typeof source === 'string') {
|
||||
//try to get from cache
|
||||
//try to get sourceData from cache
|
||||
if(this.options.sourceCache) {
|
||||
var cacheID = source,
|
||||
cache;
|
||||
|
@ -34,6 +34,7 @@ Integrations
|
||||
* [Django](https://github.com/applegrew/django-select2)
|
||||
* [Symfony](https://github.com/19Gerhard85/sfSelect2WidgetsPlugin)
|
||||
* [Bootstrap](https://github.com/t0m/select2-bootstrap-css) (CSS skin)
|
||||
* [Yii](https://github.com/tonybolzan/yii-select2)
|
||||
|
||||
Internationalization (i18n)
|
||||
---------------------------
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "select2",
|
||||
"version": "3.3.2",
|
||||
"main": ["select2.js", "select2.css", "select2.png", "select2x2.png", "spinner.gif"],
|
||||
"version": "3.4.0",
|
||||
"main": ["select2.js", "select2.css", "select2.png", "select2x2.png", "select2-spinner.gif"],
|
||||
"dependencies": {
|
||||
"jquery": "~1.4.4"
|
||||
"jquery": ">= 1.7.1"
|
||||
}
|
||||
}
|
||||
|
87
src/inputs/select2/lib/select2.css
vendored
@ -1,7 +1,8 @@
|
||||
/*
|
||||
Version: 3.3.2 Timestamp: Mon Mar 25 12:14:18 PDT 2013
|
||||
Version: 3.4.0 Timestamp: Tue May 14 08:27:33 PDT 2013
|
||||
*/
|
||||
.select2-container {
|
||||
margin: 0;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
/* inline-block for ie7 */
|
||||
@ -81,6 +82,10 @@ Version: 3.3.2 Timestamp: Mon Mar 25 12:14:18 PDT 2013
|
||||
background-image: linear-gradient(top, #eeeeee 0%,#ffffff 90%);
|
||||
}
|
||||
|
||||
.select2-container.select2-allowclear .select2-choice span {
|
||||
margin-right: 42px;
|
||||
}
|
||||
|
||||
.select2-container .select2-choice span {
|
||||
margin-right: 26px;
|
||||
display: block;
|
||||
@ -94,11 +99,11 @@ Version: 3.3.2 Timestamp: Mon Mar 25 12:14:18 PDT 2013
|
||||
}
|
||||
|
||||
.select2-container .select2-choice abbr {
|
||||
display: block;
|
||||
display: none;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
position: absolute;
|
||||
right: 26px;
|
||||
right: 24px;
|
||||
top: 8px;
|
||||
|
||||
font-size: 1px;
|
||||
@ -109,6 +114,11 @@ Version: 3.3.2 Timestamp: Mon Mar 25 12:14:18 PDT 2013
|
||||
cursor: pointer;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.select2-container.select2-allowclear .select2-choice abbr {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.select2-container .select2-choice abbr:hover {
|
||||
background-position: right -11px;
|
||||
cursor: pointer;
|
||||
@ -119,11 +129,6 @@ Version: 3.3.2 Timestamp: Mon Mar 25 12:14:18 PDT 2013
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 9998;
|
||||
background-color: #fff;
|
||||
opacity: 0;
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; /* works in IE 8 */
|
||||
filter: "alpha(opacity=0)"; /* expected to work in IE 8 */
|
||||
filter: alpha(opacity=0); /* IE 4-7 */
|
||||
}
|
||||
|
||||
.select2-drop {
|
||||
@ -147,6 +152,15 @@ Version: 3.3.2 Timestamp: Mon Mar 25 12:14:18 PDT 2013
|
||||
box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
|
||||
}
|
||||
|
||||
.select2-drop-auto-width {
|
||||
border-top: 1px solid #aaa;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.select2-drop-auto-width .select2-search {
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
.select2-drop.select2-drop-above {
|
||||
margin-top: 1px;
|
||||
border-top: 1px solid #aaa;
|
||||
@ -162,7 +176,7 @@ Version: 3.3.2 Timestamp: Mon Mar 25 12:14:18 PDT 2013
|
||||
}
|
||||
|
||||
.select2-container .select2-choice div {
|
||||
display: block;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
@ -209,12 +223,6 @@ Version: 3.3.2 Timestamp: Mon Mar 25 12:14:18 PDT 2013
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.select2-search-hidden {
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: -10000px;
|
||||
}
|
||||
|
||||
.select2-search input {
|
||||
width: 100%;
|
||||
height: auto !important;
|
||||
@ -292,6 +300,20 @@ Version: 3.3.2 Timestamp: Mon Mar 25 12:14:18 PDT 2013
|
||||
background-image: linear-gradient(top, #ffffff 0%,#eeeeee 50%);
|
||||
}
|
||||
|
||||
.select2-dropdown-open.select2-drop-above .select2-choice,
|
||||
.select2-dropdown-open.select2-drop-above .select2-choices {
|
||||
border: 1px solid #5897fb;
|
||||
border-top-color: transparent;
|
||||
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, white), color-stop(0.5, #eeeeee));
|
||||
background-image: -webkit-linear-gradient(center top, white 0%, #eeeeee 50%);
|
||||
background-image: -moz-linear-gradient(center top, white 0%, #eeeeee 50%);
|
||||
background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
|
||||
background-image: -ms-linear-gradient(bottom, #ffffff 0%,#eeeeee 50%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff',GradientType=0 );
|
||||
background-image: linear-gradient(bottom, #ffffff 0%,#eeeeee 50%);
|
||||
}
|
||||
|
||||
.select2-dropdown-open .select2-choice div {
|
||||
background: transparent;
|
||||
border-left: none;
|
||||
@ -314,6 +336,7 @@ Version: 3.3.2 Timestamp: Mon Mar 25 12:14:18 PDT 2013
|
||||
|
||||
.select2-results ul.select2-result-sub {
|
||||
margin: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.select2-results ul.select2-result-sub > li .select2-result-label { padding-left: 20px }
|
||||
@ -420,7 +443,7 @@ disabled look for disabled choices in the results dropdown
|
||||
}
|
||||
|
||||
.select2-container.select2-container-disabled .select2-choice abbr {
|
||||
display: none
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
@ -579,8 +602,8 @@ disabled look for disabled choices in the results dropdown
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
|
||||
.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close {
|
||||
display: none;
|
||||
.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close { display: none;
|
||||
background:none;
|
||||
}
|
||||
/* end multiselect */
|
||||
|
||||
@ -590,17 +613,31 @@ disabled look for disabled choices in the results dropdown
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.select2-offscreen {
|
||||
border: 0;
|
||||
.select2-offscreen, .select2-offscreen:focus {
|
||||
clip: rect(0 0 0 0);
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
border: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
outline: 0;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
.select2-display-none {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.select2-measure-scrollbar {
|
||||
position: absolute;
|
||||
top: -10000px;
|
||||
left: -10000px;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
overflow: scroll;
|
||||
}
|
||||
/* Retina-ize icons */
|
||||
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi) {
|
||||
|
@ -11,7 +11,7 @@
|
||||
"tag",
|
||||
"tagging"
|
||||
],
|
||||
"version": "3.3.2",
|
||||
"version": "3.4.0",
|
||||
"author": {
|
||||
"name": "Igor Vaynberg",
|
||||
"url": "https://github.com/ivaynberg"
|
||||
@ -31,6 +31,6 @@
|
||||
"docs": "http://ivaynberg.github.com/select2/",
|
||||
"download": "https://github.com/ivaynberg/select2/tags",
|
||||
"dependencies": {
|
||||
"jquery": ">=1.4.6"
|
||||
"jquery": ">=1.7.1"
|
||||
}
|
||||
}
|
||||
|
932
src/inputs/select2/lib/select2.js
vendored
6
src/inputs/select2/lib/select2.min.js
vendored
15
src/inputs/select2/lib/select2_locale_de.js
vendored
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Select2 German translation
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "Keine Übereinstimmungen gefunden"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "Bitte " + n + " Zeichen mehr eingeben"; },
|
||||
formatInputTooLong: function (input, max) { var n = input.length - max; return "Bitte " + n + " Zeichen weniger eingeben"; },
|
||||
formatSelectionTooBig: function (limit) { return "Sie können nur " + limit + " Eintr" + (limit === 1 ? "ag" : "äge") + " auswählen"; },
|
||||
formatLoadMore: function (pageNumber) { return "Lade mehr Ergebnisse..."; },
|
||||
formatSearching: function () { return "Suche..."; }
|
||||
});
|
||||
})(jQuery);
|
@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Select2 <Language> translation.
|
||||
*
|
||||
* Author: Your Name <your@email>
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "No matches found"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "Please enter " + n + " more character" + (n == 1 ? "" : "s"); },
|
||||
formatInputTooLong: function (input, max) { var n = input.length - max; return "Please enter " + n + " less character" + (n == 1? "" : "s"); },
|
||||
formatSelectionTooBig: function (limit) { return "You can only select " + limit + " item" + (limit == 1 ? "" : "s"); },
|
||||
formatLoadMore: function (pageNumber) { return "Loading more results..."; },
|
||||
formatSearching: function () { return "Searching..."; }
|
||||
});
|
||||
})(jQuery);
|
15
src/inputs/select2/lib/select2_locale_es.js
vendored
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Select2 Spanish translation
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "No se encontraron resultados"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "Por favor adicione " + n + " caracter" + (n == 1? "" : "es"); },
|
||||
formatInputTooLong: function (input, max) { var n = input.length - max; return "Por favor elimine " + n + " caracter" + (n == 1? "" : "es"); },
|
||||
formatSelectionTooBig: function (limit) { return "Solo puede seleccionar " + limit + " elemento" + (limit == 1 ? "" : "s"); },
|
||||
formatLoadMore: function (pageNumber) { return "Cargando más resultados..."; },
|
||||
formatSearching: function () { return "Buscando..."; }
|
||||
});
|
||||
})(jQuery);
|
43
src/inputs/select2/lib/select2_locale_eu.js
vendored
@ -1,43 +0,0 @@
|
||||
/**
|
||||
* Select2 Basque translation.
|
||||
*
|
||||
* Author: Julen Ruiz Aizpuru <julenx at gmail dot com>
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () {
|
||||
return "Ez da bat datorrenik aurkitu";
|
||||
},
|
||||
formatInputTooShort: function (input, min) {
|
||||
var n = min - input.length;
|
||||
if (n === 1) {
|
||||
return "Idatzi karaktere bat gehiago";
|
||||
} else {
|
||||
return "Idatzi " + n + " karaktere gehiago";
|
||||
}
|
||||
},
|
||||
formatInputTooLong: function (input, max) {
|
||||
var n = input.length - max;
|
||||
if (n === 1) {
|
||||
return "Idatzi karaktere bat gutxiago";
|
||||
} else {
|
||||
return "Idatzi " + n + " karaktere gutxiago";
|
||||
}
|
||||
},
|
||||
formatSelectionTooBig: function (limit) {
|
||||
if (limit === 1 ) {
|
||||
return "Elementu bakarra hauta dezakezu";
|
||||
} else {
|
||||
return limit + " elementu hauta ditzakezu soilik";
|
||||
}
|
||||
},
|
||||
formatLoadMore: function (pageNumber) {
|
||||
return "Emaitza gehiago kargatzen...";
|
||||
},
|
||||
formatSearching: function () {
|
||||
return "Bilatzen...";
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
15
src/inputs/select2/lib/select2_locale_fr.js
vendored
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Select2 French translation
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "Aucun résultat trouvé"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "Merci de saisir " + n + " caractère" + (n == 1? "" : "s") + " de plus"; },
|
||||
formatInputTooLong: function (input, max) { var n = input.length - max; return "Merci de saisir " + n + " caractère" + (n == 1? "" : "s") + " de moins"; },
|
||||
formatSelectionTooBig: function (limit) { return "Vous pouvez seulement sélectionner " + limit + " élément" + (limit == 1 ? "" : "s"); },
|
||||
formatLoadMore: function (pageNumber) { return "Chargement de résultats supplémentaires..."; },
|
||||
formatSearching: function () { return "Recherche en cours..."; }
|
||||
});
|
||||
})(jQuery);
|
42
src/inputs/select2/lib/select2_locale_hr.js
vendored
@ -1,42 +0,0 @@
|
||||
/**
|
||||
* Select2 Croatian translation.
|
||||
*
|
||||
* Author: Edi Modrić <edi.modric@gmail.com>
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
var specialNumbers = {
|
||||
1: function(n) { return (n % 100 != 11 ? "znak" : "znakova"); },
|
||||
2: function(n) { return (n % 100 != 12 ? "znaka" : "znakova"); },
|
||||
3: function(n) { return (n % 100 != 13 ? "znaka" : "znakova"); },
|
||||
4: function(n) { return (n % 100 != 14 ? "znaka" : "znakova"); }
|
||||
};
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "Nema rezultata"; },
|
||||
formatInputTooShort: function (input, min) {
|
||||
var n = min - input.length;
|
||||
var nMod10 = n % 10;
|
||||
|
||||
if (nMod10 > 0 && nMod10 < 5) {
|
||||
return "Unesite još " + n + " " + specialNumbers[nMod10](n);
|
||||
}
|
||||
|
||||
return "Unesite još " + n + " znakova";
|
||||
},
|
||||
formatInputTooLong: function (input, max) {
|
||||
var n = input.length - max;
|
||||
var nMod10 = n % 10;
|
||||
|
||||
if (nMod10 > 0 && nMod10 < 5) {
|
||||
return "Unesite " + n + " " + specialNumbers[nMod10](n) + " manje";
|
||||
}
|
||||
|
||||
return "Unesite " + n + " znakova manje";
|
||||
},
|
||||
formatSelectionTooBig: function (limit) { return "Maksimalan broj odabranih stavki je " + limit; },
|
||||
formatLoadMore: function (pageNumber) { return "Učitavanje rezultata..."; },
|
||||
formatSearching: function () { return "Pretraga..."; }
|
||||
});
|
||||
})(jQuery);
|
15
src/inputs/select2/lib/select2_locale_hu.js
vendored
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Select2 Hungarian translation
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "Nincs találat."; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "Túl rövid. Még " + n + " karakter hiányzik."; },
|
||||
formatInputTooLong: function (input, max) { var n = input.length - max; return "Túl hosszú. " + n + " kerekterrel több mint kellene."; },
|
||||
formatSelectionTooBig: function (limit) { return "Csak " + limit + " elemet lehet kiválasztani."; },
|
||||
formatLoadMore: function (pageNumber) { return "Töltés..."; },
|
||||
formatSearching: function () { return "Keresés..."; }
|
||||
});
|
||||
})(jQuery);
|
15
src/inputs/select2/lib/select2_locale_it.js
vendored
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Select2 Italian translation
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "Nessuna corrispondenza trovata"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "Inserisci ancora " + n + " caratter" + (n == 1? "e" : "i"); },
|
||||
formatInputTooLong: function (input, max) { var n = input.length - max; return "Inserisci " + n + " caratter" + (n == 1? "e" : "i") + " in meno"; },
|
||||
formatSelectionTooBig: function (limit) { return "Puoi selezionare solo " + limit + " element" + (limit == 1 ? "o" : "i"); },
|
||||
formatLoadMore: function (pageNumber) { return "Caricamento in corso..."; },
|
||||
formatSearching: function () { return "Ricerca..."; }
|
||||
});
|
||||
})(jQuery);
|
15
src/inputs/select2/lib/select2_locale_nl.js
vendored
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Select2 Dutch translation
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "Geen resultaten gevonden"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "Vul " + n + " karakter" + (n == 1? "" : "s") + " meer in"; },
|
||||
formatInputTooLong: function (input, max) { var n = input.length - max; return "Vul " + n + " karakter" + (n == 1? "" : "s") + " minder in"; },
|
||||
formatSelectionTooBig: function (limit) { return "Maximaal " + limit + " item" + (limit == 1 ? "" : "s") + " toegestaan"; },
|
||||
formatLoadMore: function (pageNumber) { return "Meer resultaten laden..."; },
|
||||
formatSearching: function () { return "Zoeken..."; },
|
||||
});
|
||||
})(jQuery);
|
15
src/inputs/select2/lib/select2_locale_pt-BR.js
vendored
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Select2 Brazilian Portuguese translation
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "Nenhum resultado encontrado"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "Informe " + n + " caracter" + (n == 1? "" : "es"); },
|
||||
formatInputTooLong: function (input, max) { var n = input.length - max; return "Apague " + n + " caracter" + (n == 1? "" : "es"); },
|
||||
formatSelectionTooBig: function (limit) { return "Só é possível selecionar " + limit + " elemento" + (limit == 1 ? "" : "s"); },
|
||||
formatLoadMore: function (pageNumber) { return "Carregando mais resultados..."; },
|
||||
formatSearching: function () { return "Buscando..."; }
|
||||
});
|
||||
})(jQuery);
|
15
src/inputs/select2/lib/select2_locale_pt-PT.js
vendored
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Select2 Portuguese (Portugal) translation
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "Nenhum resultado encontrado"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "Introduza " + n + " caracter" + (n == 1 ? "" : "es"); },
|
||||
formatInputTooLong: function (input, max) { var n = input.length - max; return "Apague " + n + " caracter" + (n == 1 ? "" : "es"); },
|
||||
formatSelectionTooBig: function (limit) { return "Só é possível selecionar " + limit + " elemento" + (limit == 1 ? "" : "s"); },
|
||||
formatLoadMore: function (pageNumber) { return "A carregar mais resultados..."; },
|
||||
formatSearching: function () { return "A pesquisar..."; }
|
||||
});
|
||||
})(jQuery);
|
15
src/inputs/select2/lib/select2_locale_ro.js
vendored
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Select2 Romanian translation.
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "Nu a fost găsit nimic"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "Vă rugăm să introduceți incă " + n + " caracter" + (n == 1 ? "" : "e"); },
|
||||
formatInputTooLong: function (input, max) { var n = input.length - max; return "Vă rugăm să introduceți mai puțin de " + n + " caracter" + (n == 1? "" : "e"); },
|
||||
formatSelectionTooBig: function (limit) { return "Aveți voie să selectați cel mult " + limit + " element" + (limit == 1 ? "" : "e"); },
|
||||
formatLoadMore: function (pageNumber) { return "Se încarcă..."; },
|
||||
formatSearching: function () { return "Căutare..."; }
|
||||
});
|
||||
})(jQuery);
|
15
src/inputs/select2/lib/select2_locale_ru.js
vendored
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Select2 Russian translation
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "Совпадений не найдено"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "Пожалуйста, введите еще " + n + " символ" + (n == 1 ? "" : ((n > 1)&&(n < 5) ? "а" : "ов")); },
|
||||
formatInputTooLong: function (input, max) { var n = input.length - max; return "Пожалуйста, введите на " + n + " символ" + (n == 1 ? "" : ((n > 1)&&(n < 5)? "а" : "ов")) + " меньше"; },
|
||||
formatSelectionTooBig: function (limit) { return "Вы можете выбрать не более " + limit + " элемент" + (limit == 1 ? "" : ((limit > 1)&&(limit < 5)? "а" : "ов")); },
|
||||
formatLoadMore: function (pageNumber) { return "Загрузка данных..."; },
|
||||
formatSearching: function () { return "Поиск..."; }
|
||||
});
|
||||
})(jQuery);
|
48
src/inputs/select2/lib/select2_locale_sk.js
vendored
@ -1,48 +0,0 @@
|
||||
/**
|
||||
* Select2 Slovak translation.
|
||||
*
|
||||
* Author: David Vallner <david@vallner.net>
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
// use text for the numbers 2 through 4
|
||||
var smallNumbers = {
|
||||
2: function(masc) { return (masc ? "dva" : "dve"); },
|
||||
3: function() { return "tri"; },
|
||||
4: function() { return "štyri"; }
|
||||
}
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "Nenašli sa žiadne položky"; },
|
||||
formatInputTooShort: function (input, min) {
|
||||
var n = min - input.length;
|
||||
if (n == 1) {
|
||||
return "Prosím zadajte ešte jeden znak";
|
||||
} else if (n <= 4) {
|
||||
return "Prosím zadajte ešte ďalšie "+smallNumbers[n](true)+" znaky";
|
||||
} else {
|
||||
return "Prosím zadajte ešte ďalších "+n+" znakov";
|
||||
}
|
||||
},
|
||||
formatInputTooLong: function (input, max) {
|
||||
var n = input.length - max;
|
||||
if (n == 1) {
|
||||
return "Prosím zadajte o jeden znak menej";
|
||||
} else if (n <= 4) {
|
||||
return "Prosím zadajte o "+smallNumbers[n](true)+" znaky menej";
|
||||
} else {
|
||||
return "Prosím zadajte o "+n+" znakov menej";
|
||||
}
|
||||
},
|
||||
formatSelectionTooBig: function (limit) {
|
||||
if (limit == 1) {
|
||||
return "Môžete zvoliť len jednu položku";
|
||||
} else if (limit <= 4) {
|
||||
return "Môžete zvoliť najviac "+smallNumbers[limit](false)+" položky";
|
||||
} else {
|
||||
return "Môžete zvoliť najviac "+limit+" položiek";
|
||||
}
|
||||
},
|
||||
formatLoadMore: function (pageNumber) { return "Načítavajú sa ďalšie výsledky..."; },
|
||||
formatSearching: function () { return "Vyhľadávanie..."; }
|
||||
});
|
||||
})(jQuery);
|
17
src/inputs/select2/lib/select2_locale_sv.js
vendored
@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Select2 Swedish translation.
|
||||
*
|
||||
* Author: Jens Rantil <jens.rantil@telavox.com>
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "Inga träffar"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "Var god skriv in " + n + (n>1 ? " till tecken" : " tecken till"); },
|
||||
formatInputTooLong: function (input, max) { var n = input.length - max; return "Var god sudda ut " + n + " tecken"; },
|
||||
formatSelectionTooBig: function (limit) { return "Du kan max välja " + limit + " element"; },
|
||||
formatLoadMore: function (pageNumber) { return "Laddar fler resultat..."; },
|
||||
formatSearching: function () { return "Söker..."; }
|
||||
});
|
||||
})(jQuery);
|
17
src/inputs/select2/lib/select2_locale_tr.js
vendored
@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Select2 Turkish translation.
|
||||
*
|
||||
* Author: Salim KAYABAŞI <salim.kayabasi@gmail.com>
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "Sonuç bulunamadı"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "En az " + n + " karakter daha girmelisiniz"; },
|
||||
formatInputTooLong: function (input, max) { var n = input.length - max; return n + " karakter azaltmalısınız"; },
|
||||
formatSelectionTooBig: function (limit) { return "Sadece " + limit + " seçim yapabilirsiniz"; },
|
||||
formatLoadMore: function (pageNumber) { return "Daha fazla ..."; },
|
||||
formatSearching: function () { return "Aranıyor..."; }
|
||||
});
|
||||
})(jQuery);
|
17
src/inputs/select2/lib/select2_locale_ua.js
vendored
@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Select2 <Language> translation.
|
||||
*
|
||||
* Author: bigmihail <bigmihail@bigmir.net>
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "Нічого не знайдено"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length, s = ["", "и", "ів"], p = [2,0,1,1,1,2]; return "Введіть буль ласка ще " + n + " символ" + s[ (n%100>4 && n%100<=20)? 2 : p[Math.min(n%10, 5)] ]; },
|
||||
formatInputTooLong: function (input, max) { var n = input.length - max, s = ["", "и", "ів"], p = [2,0,1,1,1,2]; return "Введіть буль ласка на " + n + " символ" + s[ (n%100>4 && n%100<=20)? 2 : p[Math.min(n%10, 5)] ] + " менше"; },
|
||||
formatSelectionTooBig: function (limit) {var s = ["", "и", "ів"], p = [2,0,1,1,1,2]; return "Ви можете вибрати лише " + limit + " елемент" + s[ (limit%100>4 && limit%100<=20)? 2 : p[Math.min(limit%10, 5)] ]; },
|
||||
formatLoadMore: function (pageNumber) { return "Завантаження даних..."; },
|
||||
formatSearching: function () { return "Пошук..."; }
|
||||
});
|
||||
})(jQuery);
|
14
src/inputs/select2/lib/select2_locale_zh-CN.js
vendored
@ -1,14 +0,0 @@
|
||||
/**
|
||||
* Select2 Chinese translation
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatNoMatches: function () { return "没有找到匹配项"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "请再输入" + n + "个字符";},
|
||||
formatInputTooLong: function (input, max) { var n = input.length - max; return "请删掉" + n + "个字符";},
|
||||
formatSelectionTooBig: function (limit) { return "你只能选择最多" + limit + "项"; },
|
||||
formatLoadMore: function (pageNumber) { return "加载结果中..."; },
|
||||
formatSearching: function () { return "搜索中..."; }
|
||||
});
|
||||
})(jQuery);
|
172
src/inputs/select2/select2.js
vendored
@ -1,24 +1,28 @@
|
||||
/**
|
||||
Select2 input. Based on amazing work of Igor Vaynberg https://github.com/ivaynberg/select2.
|
||||
Please see [original docs](http://ivaynberg.github.com/select2) for detailed description and options.
|
||||
You should manually include select2 distributive:
|
||||
Please see [original select2 docs](http://ivaynberg.github.com/select2) for detailed description and options.
|
||||
Compatible **select2 version is 3.4.1**!
|
||||
You should manually download and include select2 distributive:
|
||||
|
||||
<link href="select2/select2.css" rel="stylesheet" type="text/css"></link>
|
||||
<script src="select2/select2.js"></script>
|
||||
|
||||
For make it **Bootstrap-styled** you can use css from [here](https://github.com/t0m/select2-bootstrap-css):
|
||||
To make it **bootstrap-styled** you can use css from [here](https://github.com/t0m/select2-bootstrap-css):
|
||||
|
||||
<link href="select2-bootstrap.css" rel="stylesheet" type="text/css"></link>
|
||||
|
||||
**Note:** currently `ajax` source for select2 is not supported, as it's not possible to load it in closed select2 state.
|
||||
The solution is to load source manually and assign statically.
|
||||
**Note:** currently `autotext` feature does not work for select2 with `ajax` remote source.
|
||||
You need initially put both `data-value` and element's text youself:
|
||||
|
||||
<a href="#" data-type="select2" data-value="1">Text1</a>
|
||||
|
||||
|
||||
@class select2
|
||||
@extends abstractinput
|
||||
@since 1.4.1
|
||||
@final
|
||||
@example
|
||||
<a href="#" id="country" data-type="select2" data-pk="1" data-value="ru" data-url="/post" data-original-title="Select country"></a>
|
||||
<a href="#" id="country" data-type="select2" data-pk="1" data-value="ru" data-url="/post" data-title="Select country"></a>
|
||||
<script>
|
||||
$(function(){
|
||||
$('#country').editable({
|
||||
@ -39,56 +43,47 @@ $(function(){
|
||||
|
||||
var Constructor = function (options) {
|
||||
this.init('select2', options, Constructor.defaults);
|
||||
|
||||
|
||||
options.select2 = options.select2 || {};
|
||||
|
||||
this.sourceData = null;
|
||||
|
||||
var that = this,
|
||||
mixin = { //mixin to select2 options
|
||||
placeholder: options.placeholder
|
||||
};
|
||||
|
||||
//detect whether it is multi-valued
|
||||
this.isMultiple = options.select2.tags || options.select2.multiple;
|
||||
|
||||
//if not `tags` mode, we need define initSelection to set data from source
|
||||
if(!options.select2.tags) {
|
||||
if(options.source) {
|
||||
mixin.data = options.source;
|
||||
}
|
||||
|
||||
//this function can be defaulted in seletc2. See https://github.com/ivaynberg/select2/issues/710
|
||||
mixin.initSelection = function (element, callback) {
|
||||
//temp: try update results
|
||||
/*
|
||||
if(options.select2 && options.select2.ajax) {
|
||||
console.log('attached');
|
||||
var original = $(element).data('select2').postprocessResults;
|
||||
console.log(original);
|
||||
$(element).data('select2').postprocessResults = function(data, initial) {
|
||||
console.log('postprocess');
|
||||
// this.element.triggerHandler('loaded', [data]);
|
||||
original.apply(this, arguments);
|
||||
}
|
||||
|
||||
// $(element).on('loaded', function(){console.log('loaded');});
|
||||
$(element).data('select2').updateResults(true);
|
||||
}
|
||||
*/
|
||||
|
||||
var val = that.str2value(element.val()),
|
||||
data = $.fn.editableutils.itemsByValue(val, mixin.data, 'id');
|
||||
|
||||
//for single-valued mode should not use array. Take first element instead.
|
||||
if($.isArray(data) && data.length && !that.isMultiple) {
|
||||
data = data[0];
|
||||
}
|
||||
|
||||
callback(data);
|
||||
};
|
||||
//placeholder
|
||||
if(options.placeholder) {
|
||||
options.select2.placeholder = options.placeholder;
|
||||
}
|
||||
|
||||
//if not `tags` mode, use source
|
||||
if(!options.select2.tags && options.source) {
|
||||
var source = options.source;
|
||||
//if source is function, call it (once!)
|
||||
if ($.isFunction(options.source)) {
|
||||
source = options.source.call(options.scope);
|
||||
}
|
||||
|
||||
if (typeof source === 'string') {
|
||||
options.select2.ajax = options.select2.ajax || {};
|
||||
//some default ajax params
|
||||
if(!options.select2.ajax.data) {
|
||||
options.select2.ajax.data = function(term) {return { query:term };};
|
||||
}
|
||||
if(!options.select2.ajax.results) {
|
||||
options.select2.ajax.results = function(data) { return {results:data };};
|
||||
}
|
||||
options.select2.ajax.url = source;
|
||||
} else {
|
||||
//check format and convert x-editable format to select2 format (if needed)
|
||||
this.sourceData = this.convertSource(source);
|
||||
options.select2.data = this.sourceData;
|
||||
}
|
||||
}
|
||||
|
||||
//overriding objects in config (as by default jQuery extend() is not recursive)
|
||||
this.options.select2 = $.extend({}, Constructor.defaults.select2, mixin, options.select2);
|
||||
this.options.select2 = $.extend({}, Constructor.defaults.select2, options.select2);
|
||||
|
||||
//detect whether it is multi-valued
|
||||
this.isMultiple = this.options.select2.tags || this.options.select2.multiple;
|
||||
this.isRemote = ('ajax' in this.options.select2);
|
||||
};
|
||||
|
||||
$.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput);
|
||||
@ -96,21 +91,17 @@ $(function(){
|
||||
$.extend(Constructor.prototype, {
|
||||
render: function() {
|
||||
this.setClass();
|
||||
|
||||
//apply select2
|
||||
this.$input.select2(this.options.select2);
|
||||
|
||||
//when data is loaded via ajax, we need to know when it's done
|
||||
if('ajax' in this.options.select2) {
|
||||
/*
|
||||
console.log('attached');
|
||||
var original = this.$input.data('select2').postprocessResults;
|
||||
this.$input.data('select2').postprocessResults = function(data, initial) {
|
||||
this.element.triggerHandler('loaded', [data]);
|
||||
original.apply(this, arguments);
|
||||
}
|
||||
*/
|
||||
//when data is loaded via ajax, we need to know when it's done to populate listData
|
||||
if(this.isRemote) {
|
||||
//listen to loaded event to populate data
|
||||
this.$input.on('select2-loaded', $.proxy(function(e) {
|
||||
this.sourceData = e.items.results;
|
||||
}, this));
|
||||
}
|
||||
|
||||
|
||||
//trigger resize of editableform to re-position container in multi-valued mode
|
||||
if(this.isMultiple) {
|
||||
@ -122,20 +113,16 @@ $(function(){
|
||||
|
||||
value2html: function(value, element) {
|
||||
var text = '', data;
|
||||
if(this.$input) { //called when submitting form and select2 already exists
|
||||
data = this.$input.select2('data');
|
||||
} else { //on init (autotext)
|
||||
//here select2 instance not created yet and data may be even not loaded.
|
||||
//we can check data/tags property of select config and if exist lookup text
|
||||
if(this.options.select2.tags) {
|
||||
data = value;
|
||||
} else if(this.options.select2.data) {
|
||||
data = $.fn.editableutils.itemsByValue(value, this.options.select2.data, 'id');
|
||||
} else {
|
||||
//if('ajax' in this.options.select2) {
|
||||
}
|
||||
|
||||
if(this.options.select2.tags) { //in tags mode just assign value
|
||||
data = value;
|
||||
} else if(this.sourceData) {
|
||||
data = $.fn.editableutils.itemsByValue(value, this.sourceData, 'id');
|
||||
} else {
|
||||
//can not get list of possible values (e.g. autotext for select2 with ajax source)
|
||||
}
|
||||
|
||||
//data may be array (when multiple values allowed)
|
||||
if($.isArray(data)) {
|
||||
//collect selected data and show with separator
|
||||
text = [];
|
||||
@ -156,7 +143,26 @@ $(function(){
|
||||
},
|
||||
|
||||
value2input: function(value) {
|
||||
this.$input.val(value).trigger('change', true); //second argument needed to separate initial change from user's click (for autosubmit)
|
||||
//for remote source .val() is not working, need to look in sourceData
|
||||
if(this.isRemote) {
|
||||
//todo: check value for array
|
||||
var item, items;
|
||||
//if sourceData loaded, use it to get text for display
|
||||
if(this.sourceData) {
|
||||
items = $.fn.editableutils.itemsByValue(value, this.sourceData, 'id');
|
||||
if(items.length) {
|
||||
item = items[0];
|
||||
}
|
||||
}
|
||||
//if item not found by sourceData, use element text (e.g. for the first show)
|
||||
if(!item) {
|
||||
item = {id: value, text: $(this.options.scope).text()};
|
||||
}
|
||||
//select2('data', ...) allows to set both id and text --> usefull for initial show when items are not loaded
|
||||
this.$input.select2('data', item).trigger('change', true); //second argument needed to separate initial change from user's click (for autosubmit)
|
||||
} else {
|
||||
this.$input.val(value).trigger('change', true); //second argument needed to separate initial change from user's click (for autosubmit)
|
||||
}
|
||||
},
|
||||
|
||||
input2value: function() {
|
||||
@ -189,6 +195,22 @@ $(function(){
|
||||
$(this).closest('form').submit();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/*
|
||||
Converts source from x-editable format: {value: 1, text: "1"} to
|
||||
select2 format: {id: 1, text: "1"}
|
||||
*/
|
||||
convertSource: function(source) {
|
||||
if($.isArray(source) && source.length && source[0].value !== undefined) {
|
||||
for(var i = 0; i<source.length; i++) {
|
||||
if(source[i].value !== undefined) {
|
||||
source[i].id = source[i].value;
|
||||
delete source[i].value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return source;
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -21,6 +21,7 @@
|
||||
<div>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
<div id="qunit-fixture1"></div>
|
||||
<div id="async-fixture" style="padding-left:300px"></div>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -36,8 +36,10 @@ $(function () {
|
||||
|
||||
//groups as array
|
||||
window.groupsArr = [];
|
||||
window.groupsArr2 = [];
|
||||
for(var i in groups) {
|
||||
groupsArr.push({value: i, text: groups[i]});
|
||||
groupsArr2.push({id: i, text: groups[i]});
|
||||
}
|
||||
|
||||
window.size = groupsArr.length;
|
||||
@ -46,6 +48,16 @@ $(function () {
|
||||
url: 'groups.php',
|
||||
responseText: groups
|
||||
});
|
||||
|
||||
$.mockjax({
|
||||
url: 'groupsArr',
|
||||
responseText: groupsArr
|
||||
});
|
||||
|
||||
$.mockjax({
|
||||
url: 'groupsArr2',
|
||||
responseText: groupsArr2
|
||||
});
|
||||
|
||||
$.mockjax({
|
||||
url: 'groups-error.php',
|
||||
|
@ -66,7 +66,19 @@ $(function () {
|
||||
equal(values.comment, '', 'textarea empty value') ;
|
||||
ok(!('sex' in values), 'select value not present') ;
|
||||
ok(!('dob' in values), 'date value not present') ;
|
||||
});
|
||||
});
|
||||
|
||||
test("getValue with isSingle = true", function () {
|
||||
var v = '123',
|
||||
e = $(
|
||||
'<a href="#" data-type="text" id="username">'+v+'</a>' +
|
||||
'<a href="#" data-type="textarea" id="comment">456</a>'
|
||||
).appendTo('#qunit-fixture').editable();
|
||||
|
||||
//check get value
|
||||
var value = e.editable('getValue', true);
|
||||
equal(value, v, 'value ok');
|
||||
});
|
||||
|
||||
test("'init' event", function () {
|
||||
expect(1);
|
||||
@ -138,12 +150,13 @@ $(function () {
|
||||
});
|
||||
|
||||
asyncTest("event: save / hidden (reason: save)", function () {
|
||||
expect(2);
|
||||
expect(3);
|
||||
var val = '1',
|
||||
e = $('<a href="#" data-pk="1" data-type="select" data-url="post.php" data-name="text" data-value="'+val+'"></a>').appendTo(fx);
|
||||
|
||||
e.on('save', function(event, params) {
|
||||
equal(params.newValue, 2, 'save triggered, value correct');
|
||||
equal(params.submitValue, '2', 'submitValue property correct');
|
||||
});
|
||||
|
||||
e.on('hidden', function(event, reason) {
|
||||
@ -167,6 +180,33 @@ $(function () {
|
||||
}, timeout);
|
||||
});
|
||||
|
||||
asyncTest("hide when saving value", function () {
|
||||
var newVal = 2,
|
||||
e = $('<a href="#" data-pk="1" data-type="select" data-url="post.php" data-name="text" data-value="1"></a>')
|
||||
.appendTo(fx)
|
||||
.editable({
|
||||
source: groupsArr
|
||||
});
|
||||
|
||||
e.click();
|
||||
var p = tip(e);
|
||||
p.find('select').val(2);
|
||||
p.find('form').submit();
|
||||
|
||||
e.parent().click();
|
||||
|
||||
ok(p.is(':visible'), 'popover still visible');
|
||||
|
||||
setTimeout(function() {
|
||||
equal(e.data('editable').value, newVal, 'new value saved');
|
||||
ok(!p.is(':visible'), 'popover closed');
|
||||
|
||||
e.remove();
|
||||
start();
|
||||
}, timeout);
|
||||
|
||||
});
|
||||
|
||||
test("show/hide/toggle methods", function () {
|
||||
var e = $('<a href="#" data-pk="1" data-url="post.php" data-name="text1">abc</a>').appendTo('#qunit-fixture').editable();
|
||||
e.editable('show');
|
||||
|
@ -5,7 +5,7 @@ $(function () {
|
||||
module("date", {
|
||||
setup: function(){
|
||||
fx = $('#async-fixture');
|
||||
dpg = $.fn.datepicker.DPGlobal;
|
||||
dpg = $.fn.bdatepicker.DPGlobal;
|
||||
$.support.transition = false;
|
||||
mode = $.fn.editable.defaults.mode;
|
||||
$.fn.editable.defaults.mode = 'popup';
|
||||
|