# HG changeset patch # User Thierry Florac # Date 1434528010 -7200 # Node ID a361355b55c7c92ca9dc227c7a7e8abb2e98a817 # Parent fd8fb93e1b6a54a76e8bf9da3a1382d70679710a Version 0.1.0 diff -r fd8fb93e1b6a -r a361355b55c7 .installed.cfg --- a/.installed.cfg Wed May 20 15:01:45 2015 +0200 +++ b/.installed.cfg Wed Jun 17 10:00:10 2015 +0200 @@ -1,31 +1,63 @@ [buildout] -installed_develop_eggs = /home/borax/Dropbox/src/PyAMS/pyams_skin/develop-eggs/pyams-skin.egg-link -parts = i18n pyflakes test package +installed_develop_eggs = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs/pyams-file.egg-link +parts = package i18n pyflakes test + +[package] +__buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/fanstatic-compile + /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/pyams_upgrade + /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/prequest + /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/pviews + /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/pshell + /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/pdistreport + /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/pcreate + /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/pserve + /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/ptweens + /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/proutes +__buildout_signature__ = zc.recipe.egg-2.0.1-py3.4.egg setuptools-12.2-py3.4.egg zc.buildout-2.3.1-py3.4.egg +_b = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin +_d = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs +_e = /var/local/env/pyams/eggs +bin-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin +develop-eggs-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs +eggs = fanstatic + pyams_file + pyams_skin + pyams_utils + pyams_viewlet + pyramid + z3c.form + z3c.table + zope.component + zope.componentvocabulary + zope.interface + zope.traversing +eggs-directory = /var/local/env/pyams/eggs +recipe = zc.recipe.egg [i18n] -__buildout_installed__ = /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/pybabel - /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/polint - /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/pot-create -__buildout_signature__ = zc.recipe.egg-2.0.1-py3.4.egg setuptools-12.0.5-py3.4.egg zc.buildout-2.3.1-py3.4.egg -_b = /home/borax/Dropbox/src/PyAMS/pyams_skin/bin -_d = /home/borax/Dropbox/src/PyAMS/pyams_skin/develop-eggs +__buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/pybabel + /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/polint + /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/pot-create +__buildout_signature__ = zc.recipe.egg-2.0.1-py3.4.egg setuptools-12.2-py3.4.egg zc.buildout-2.3.1-py3.4.egg +_b = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin +_d = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs _e = /var/local/env/pyams/eggs -bin-directory = /home/borax/Dropbox/src/PyAMS/pyams_skin/bin -develop-eggs-directory = /home/borax/Dropbox/src/PyAMS/pyams_skin/develop-eggs +bin-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin +develop-eggs-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs eggs = babel lingua eggs-directory = /var/local/env/pyams/eggs recipe = zc.recipe.egg [pyflakes] -__buildout_installed__ = /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/pyflakes - /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/pyflakes -__buildout_signature__ = zc.recipe.egg-2.0.1-py3.4.egg setuptools-12.0.5-py3.4.egg zc.buildout-2.3.1-py3.4.egg -_b = /home/borax/Dropbox/src/PyAMS/pyams_skin/bin -_d = /home/borax/Dropbox/src/PyAMS/pyams_skin/develop-eggs +__buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/pyflakes + /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/pyflakes +__buildout_signature__ = zc.recipe.egg-2.0.1-py3.4.egg setuptools-12.2-py3.4.egg zc.buildout-2.3.1-py3.4.egg +_b = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin +_d = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs _e = /var/local/env/pyams/eggs -bin-directory = /home/borax/Dropbox/src/PyAMS/pyams_skin/bin -develop-eggs-directory = /home/borax/Dropbox/src/PyAMS/pyams_skin/develop-eggs +bin-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin +develop-eggs-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs eggs = pyflakes eggs-directory = /var/local/env/pyams/eggs entry-points = pyflakes=pyflakes.scripts.pyflakes:main @@ -34,65 +66,16 @@ scripts = pyflakes [test] -__buildout_installed__ = /home/borax/Dropbox/src/PyAMS/pyams_skin/parts/test - /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/test -__buildout_signature__ = zc.recipe.testrunner-2.0.0-py3.4.egg zc.recipe.egg-2.0.1-py3.4.egg setuptools-12.0.5-py3.4.egg zope.testrunner-4.4.6-py3.4.egg zc.buildout-2.3.1-py3.4.egg zope.interface-4.1.2-py3.4-linux-x86_64.egg zope.exceptions-4.0.7-py3.4.egg six-8ad56e9feeb914de21341cbb261cc34e -_b = /home/borax/Dropbox/src/PyAMS/pyams_skin/bin -_d = /home/borax/Dropbox/src/PyAMS/pyams_skin/develop-eggs +__buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/parts/test + /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/test +__buildout_signature__ = zc.recipe.testrunner-2.0.0-py3.4.egg zc.recipe.egg-2.0.1-py3.4.egg setuptools-12.2-py3.4.egg zope.testrunner-4.4.6-py3.4.egg zc.buildout-2.3.1-py3.4.egg zope.interface-4.1.2-py3.4-linux-x86_64.egg zope.exceptions-4.0.7-py3.4.egg six-e6b62e54b4df360c40dfcbb76c1ecf1a +_b = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin +_d = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs _e = /var/local/env/pyams/eggs -bin-directory = /home/borax/Dropbox/src/PyAMS/pyams_skin/bin -develop-eggs-directory = /home/borax/Dropbox/src/PyAMS/pyams_skin/develop-eggs +bin-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin +develop-eggs-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs eggs = pyams_skin [test] eggs-directory = /var/local/env/pyams/eggs -location = /home/borax/Dropbox/src/PyAMS/pyams_skin/parts/test +location = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/parts/test recipe = zc.recipe.testrunner -script = /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/test - -[package] -__buildout_installed__ = /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/fanstatic-compile - /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/proutes - /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/pserve - /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/ptweens - /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/pviews - /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/prequest - /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/pshell - /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/pdistreport - /home/borax/Dropbox/src/PyAMS/pyams_skin/bin/pcreate -__buildout_signature__ = zc.recipe.egg-2.0.1-py3.4.egg setuptools-12.0.5-py3.4.egg zc.buildout-2.3.1-py3.4.egg -_b = /home/borax/Dropbox/src/PyAMS/pyams_skin/bin -_d = /home/borax/Dropbox/src/PyAMS/pyams_skin/develop-eggs -_e = /var/local/env/pyams/eggs -bin-directory = /home/borax/Dropbox/src/PyAMS/pyams_skin/bin -develop-eggs-directory = /home/borax/Dropbox/src/PyAMS/pyams_skin/develop-eggs -eggs = pyams_skin - fanstatic - pyramid - z3c.form - zope.component - zope.interface -eggs-directory = /var/local/env/pyams/eggs -recipe = zc.recipe.egg - -[buildout] -parts = pyflakes test package i18n - -[buildout] -parts = test package i18n pyflakes - -[buildout] -parts = package i18n pyflakes test - -[buildout] -installed_develop_eggs = /home/borax/Dropbox/src/PyAMS/pyams_skin/develop-eggs/pyams-skin.egg-link - -[buildout] -parts = i18n pyflakes test package - -[buildout] -parts = pyflakes test package i18n - -[buildout] -parts = test package i18n pyflakes - -[buildout] -parts = package i18n pyflakes test +script = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/bin/test diff -r fd8fb93e1b6a -r a361355b55c7 buildout.cfg --- a/buildout.cfg Wed May 20 15:01:45 2015 +0200 +++ b/buildout.cfg Wed Jun 17 10:00:10 2015 +0200 @@ -19,6 +19,7 @@ src = src develop = . + /var/local/src/pyams/pyams_file /var/local/src/pyams/pyams_utils /var/local/src/pyams/pyams_viewlet /var/local/src/pyams/ext/lingua @@ -32,8 +33,9 @@ [package] recipe = zc.recipe.egg eggs = + fanstatic + pyams_file pyams_skin - fanstatic pyams_utils pyams_viewlet pyramid diff -r fd8fb93e1b6a -r a361355b55c7 setup.py --- a/setup.py Wed May 20 15:01:45 2015 +0200 +++ b/setup.py Wed Jun 17 10:00:10 2015 +0200 @@ -60,6 +60,7 @@ 'setuptools', # -*- Extra requirements: -*- 'fanstatic', + 'pyams_file', 'pyams_utils', 'pyams_viewlet', 'pyramid', diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin.egg-info/SOURCES.txt --- a/src/pyams_skin.egg-info/SOURCES.txt Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin.egg-info/SOURCES.txt Wed Jun 17 10:00:10 2015 +0200 @@ -26,7 +26,12 @@ src/pyams_skin/interfaces/configuration.py src/pyams_skin/interfaces/container.py src/pyams_skin/interfaces/resources.py +src/pyams_skin/interfaces/tinymce.py src/pyams_skin/interfaces/viewlet.py +src/pyams_skin/locales/pyams_skin.pot +src/pyams_skin/locales/fr/LC_MESSAGES/pyams_skin.mo +src/pyams_skin/locales/fr/LC_MESSAGES/pyams_skin.po +src/pyams_skin/resources/.dropbox src/pyams_skin/resources/css/myams.css src/pyams_skin/resources/css/myams.min.css src/pyams_skin/resources/css/ext/bootstrap-3.3.2.css @@ -36,13 +41,16 @@ src/pyams_skin/resources/css/ext/bootstrap.css.map src/pyams_skin/resources/css/ext/font-awesome-4.3.0.css src/pyams_skin/resources/css/ext/font-awesome-4.3.0.min.css +src/pyams_skin/resources/css/ext/jquery-datetimepicker.css +src/pyams_skin/resources/css/ext/jquery-datetimepicker.min.css src/pyams_skin/resources/css/ext/jquery-fancybox-2.1.5.css src/pyams_skin/resources/css/ext/jquery-fancybox-2.1.5.min.css src/pyams_skin/resources/css/ext/jquery-imgareaselect.css src/pyams_skin/resources/css/ext/jquery-imgareaselect.min.css -src/pyams_skin/resources/css/ext/jquery-imgareaselect.min.min.css src/pyams_skin/resources/css/ext/jquery-mCustomScrollbar.css src/pyams_skin/resources/css/ext/jquery-mCustomScrollbar.min.css +src/pyams_skin/resources/css/ext/jquery-minicolors.css +src/pyams_skin/resources/css/ext/jquery-minicolors.min.css src/pyams_skin/resources/css/ext/jquery-tipsy.css src/pyams_skin/resources/css/ext/jquery-tipsy.min.css src/pyams_skin/resources/css/ext/jquery-ui-1.11.2.css @@ -121,9 +129,10 @@ src/pyams_skin/resources/js/ext/bootstrap-slider.min.js src/pyams_skin/resources/js/ext/jquery-2.1.3.js src/pyams_skin/resources/js/ext/jquery-2.1.3.min.js +src/pyams_skin/resources/js/ext/jquery-color-2.1.2.js +src/pyams_skin/resources/js/ext/jquery-color-2.1.2.min.js src/pyams_skin/resources/js/ext/jquery-dataTables-1.9.4.js src/pyams_skin/resources/js/ext/jquery-dataTables-1.9.4.min.js -src/pyams_skin/resources/js/ext/jquery-dataTables-1.9.4.min.min.js src/pyams_skin/resources/js/ext/jquery-dataTables-autoFill.js src/pyams_skin/resources/js/ext/jquery-dataTables-autoFill.min.js src/pyams_skin/resources/js/ext/jquery-dataTables-colReorder.js @@ -150,6 +159,8 @@ src/pyams_skin/resources/js/ext/jquery-dataTables-scroller.min.js src/pyams_skin/resources/js/ext/jquery-dataTables-tableTools.js src/pyams_skin/resources/js/ext/jquery-dataTables-tableTools.min.js +src/pyams_skin/resources/js/ext/jquery-datetimepicker.js +src/pyams_skin/resources/js/ext/jquery-datetimepicker.min.js src/pyams_skin/resources/js/ext/jquery-easypiechart.min.js src/pyams_skin/resources/js/ext/jquery-fancybox-2.1.5.js src/pyams_skin/resources/js/ext/jquery-fancybox-2.1.5.min.js @@ -165,6 +176,8 @@ src/pyams_skin/resources/js/ext/jquery-mCustomScrollbar.js src/pyams_skin/resources/js/ext/jquery-mCustomScrollbar.min.js src/pyams_skin/resources/js/ext/jquery-maskedinput-1.3.1.min.js +src/pyams_skin/resources/js/ext/jquery-minicolors.js +src/pyams_skin/resources/js/ext/jquery-minicolors.min.js src/pyams_skin/resources/js/ext/jquery-mousewheel.min.js src/pyams_skin/resources/js/ext/jquery-plot-0.7.js src/pyams_skin/resources/js/ext/jquery-plot-0.7.min.js @@ -180,6 +193,8 @@ src/pyams_skin/resources/js/ext/jquery-scrollTo.min.js src/pyams_skin/resources/js/ext/jquery-select2-3.5.2.js src/pyams_skin/resources/js/ext/jquery-select2-3.5.2.min.js +src/pyams_skin/resources/js/ext/jquery-select2-sortable.js +src/pyams_skin/resources/js/ext/jquery-select2-sortable.min.js src/pyams_skin/resources/js/ext/jquery-smartclick.js src/pyams_skin/resources/js/ext/jquery-smartclick.min.js src/pyams_skin/resources/js/ext/jquery-sparkline-2.1.1.min.js @@ -193,12 +208,638 @@ src/pyams_skin/resources/js/ext/jquery-ui-1.11.2.min.js src/pyams_skin/resources/js/ext/jquery-validate-1.11.1.js src/pyams_skin/resources/js/ext/jquery-validate-1.11.1.min.js +src/pyams_skin/resources/js/ext/jquery-xmlrpc.js +src/pyams_skin/resources/js/ext/jquery-xmlrpc.min.js src/pyams_skin/resources/js/ext/fancybox-helpers/fancybox-buttons.js src/pyams_skin/resources/js/ext/fancybox-helpers/fancybox-buttons.min.js src/pyams_skin/resources/js/ext/fancybox-helpers/fancybox-media.js src/pyams_skin/resources/js/ext/fancybox-helpers/fancybox-media.min.js src/pyams_skin/resources/js/ext/fancybox-helpers/fancybox-thumbs.js src/pyams_skin/resources/js/ext/fancybox-helpers/fancybox-thumbs.min.js +src/pyams_skin/resources/js/ext/tinymce/jquery.tinymce.min.js +src/pyams_skin/resources/js/ext/tinymce/license.txt +src/pyams_skin/resources/js/ext/tinymce/tinymce.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/jquery.tinymce.js +src/pyams_skin/resources/js/ext/tinymce/dev/jquery.tinymce.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/jquery.tinymce.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/license.txt +src/pyams_skin/resources/js/ext/tinymce/dev/tinymce.jquery.js +src/pyams_skin/resources/js/ext/tinymce/dev/tinymce.jquery.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/tinymce.jquery.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/tinymce.js +src/pyams_skin/resources/js/ext/tinymce/dev/tinymce.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/tinymce.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/AddOnManager.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/AddOnManager.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/Compat.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/Compat.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/Editor.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/Editor.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/EditorCommands.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/EditorCommands.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/EditorManager.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/EditorManager.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/EditorObservable.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/EditorObservable.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/EnterKey.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/EnterKey.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/Env.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/Env.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/FocusManager.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/FocusManager.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ForceBlocks.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ForceBlocks.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/Formatter.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/Formatter.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/LegacyInput.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/LegacyInput.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/NodeChange.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/NodeChange.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/Shortcuts.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/Shortcuts.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/UndoManager.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/UndoManager.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/WindowManager.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/WindowManager.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/BookmarkManager.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/BookmarkManager.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/ControlSelection.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/ControlSelection.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/DOMUtils.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/DOMUtils.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/DomQuery.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/DomQuery.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/ElementUtils.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/ElementUtils.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/EventUtils.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/EventUtils.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Range.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Range.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/RangeUtils.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/RangeUtils.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/ScriptLoader.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/ScriptLoader.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Selection.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Selection.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Serializer.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Serializer.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Sizzle.jQuery.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Sizzle.jQuery.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Sizzle.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Sizzle.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/StyleSheetLoader.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/StyleSheetLoader.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/TreeWalker.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/TreeWalker.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/TridentSelection.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/TridentSelection.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/fmt/Preview.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/fmt/Preview.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/DomParser.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/DomParser.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Entities.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Entities.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Node.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Node.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/SaxParser.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/SaxParser.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Schema.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Schema.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Serializer.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Serializer.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Styles.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Styles.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Writer.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Writer.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/AbsoluteLayout.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/AbsoluteLayout.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Button.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Button.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ButtonGroup.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ButtonGroup.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Checkbox.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Checkbox.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Collection.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Collection.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ColorBox.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ColorBox.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ColorButton.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ColorButton.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ColorPicker.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ColorPicker.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ComboBox.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ComboBox.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Container.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Container.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Control.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Control.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/DomUtils.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/DomUtils.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/DragHelper.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/DragHelper.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ElementPath.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ElementPath.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Factory.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Factory.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FieldSet.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FieldSet.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FilePicker.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FilePicker.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FitLayout.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FitLayout.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FlexLayout.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FlexLayout.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FloatPanel.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FloatPanel.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FlowLayout.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FlowLayout.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Form.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Form.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FormItem.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FormItem.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FormatControls.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FormatControls.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/GridLayout.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/GridLayout.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Iframe.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Iframe.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/KeyboardNavigation.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/KeyboardNavigation.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Label.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Label.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Layout.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Layout.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ListBox.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ListBox.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Menu.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Menu.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MenuBar.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MenuBar.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MenuButton.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MenuButton.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MenuItem.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MenuItem.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MessageBox.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MessageBox.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Movable.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Movable.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Panel.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Panel.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/PanelButton.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/PanelButton.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Path.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Path.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Radio.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Radio.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Resizable.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Resizable.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ResizeHandle.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ResizeHandle.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Scrollable.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Scrollable.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Selector.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Selector.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Spacer.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Spacer.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/SplitButton.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/SplitButton.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/StackLayout.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/StackLayout.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/TabPanel.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/TabPanel.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/TextBox.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/TextBox.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Throbber.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Throbber.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Toolbar.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Toolbar.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Tooltip.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Tooltip.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Widget.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Widget.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Window.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Window.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Class.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Class.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Color.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Color.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/EventDispatcher.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/EventDispatcher.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/I18n.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/I18n.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/JSON.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/JSON.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/JSONP.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/JSONP.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/JSONRequest.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/JSONRequest.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/LocalStorage.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/LocalStorage.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Observable.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Observable.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Quirks.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Quirks.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Tools.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Tools.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/URI.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/URI.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/VK.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/VK.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/XHR.js +src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/XHR.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/langs/fr.js +src/pyams_skin/resources/js/ext/tinymce/dev/langs/fr.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/langs/readme.md +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/advlist/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/advlist/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/advlist/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/anchor/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/anchor/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/anchor/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/anchor/plugin.min.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/autolink/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/autolink/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/autolink/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/autolink/plugin.min.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/autoresize/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/autoresize/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/autoresize/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/autoresize/plugin.min.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/autosave/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/autosave/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/autosave/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/autosave/plugin.min.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/bbcode/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/bbcode/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/bbcode/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/bbcode/plugin.min.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/charmap/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/charmap/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/charmap/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/code/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/code/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/code/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/colorpicker/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/colorpicker/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/colorpicker/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/plugin.min.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/tiny_mce_popup.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/tiny_mce_popup.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/css/dialog.css +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/css/dialog.min.css +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/img/buttons.png +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/img/icons.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/img/items.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/img/menu_arrow.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/img/menu_check.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/img/progress.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/img/tabs.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/utils/editable_selects.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/utils/editable_selects.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/utils/form_utils.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/utils/form_utils.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/utils/mctabs.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/utils/mctabs.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/utils/validate.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/compat3x/utils/validate.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/contextmenu/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/contextmenu/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/contextmenu/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/directionality/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/directionality/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/directionality/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-cool.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-cry.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-embarassed.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-foot-in-mouth.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-frown.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-innocent.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-kiss.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-laughing.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-money-mouth.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-sealed.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-smile.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-surprised.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-tongue-out.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-undecided.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-wink.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/emoticons/img/smiley-yell.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/example/dialog.html +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/example/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/example/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/example/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/example_dependency/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/example_dependency/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/fullpage/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/fullpage/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/fullpage/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/fullscreen/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/fullscreen/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/fullscreen/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/hr/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/hr/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/hr/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/hr/plugin.min.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/image/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/image/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/image/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/importcss/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/importcss/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/importcss/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/insertdatetime/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/insertdatetime/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/insertdatetime/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/insertdatetime/plugin.min.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/layer/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/layer/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/layer/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/legacyoutput/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/legacyoutput/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/legacyoutput/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/link/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/link/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/link/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/lists/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/lists/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/lists/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/media/moxieplayer.swf +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/media/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/media/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/media/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/nonbreaking/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/nonbreaking/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/nonbreaking/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/nonbreaking/plugin.min.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/noneditable/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/noneditable/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/noneditable/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/noneditable/plugin.min.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/pagebreak/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/pagebreak/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/pagebreak/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/pagebreak/plugin.min.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/plugin.dev.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/plugin.dev.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/classes/Clipboard.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/classes/Clipboard.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/classes/Plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/classes/Plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/classes/Quirks.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/classes/Quirks.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/classes/Utils.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/classes/Utils.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/classes/WordFilter.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/classes/WordFilter.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/preview/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/preview/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/preview/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/preview/plugin.min.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/print/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/print/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/print/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/save/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/save/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/save/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/searchreplace/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/searchreplace/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/searchreplace/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/plugin.dev.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/plugin.dev.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/classes/DomTextMatcher.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/classes/DomTextMatcher.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/classes/Plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/classes/Plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/tabfocus/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/tabfocus/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/tabfocus/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/plugin.dev.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/plugin.dev.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/CellSelection.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/CellSelection.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/Dialogs.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/Dialogs.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/Plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/Plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/Quirks.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/Quirks.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/TableGrid.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/TableGrid.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/template/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/template/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/template/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/textcolor/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/textcolor/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/textcolor/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/textpattern/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/textpattern/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/textpattern/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/textpattern/plugin.min.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/plugin.min.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/css/visualblocks.css +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/css/visualblocks.min.css +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/address.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/article.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/aside.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/blockquote.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/div.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/dl.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/figure.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/h1.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/h2.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/h3.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/h4.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/h5.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/h6.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/hgroup.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/ol.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/p.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/pre.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/section.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualblocks/img/ul.gif +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualchars/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualchars/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualchars/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/wordcount/plugin.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/wordcount/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/plugins/wordcount/plugin.min.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/AbsoluteLayout.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Animations.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Button.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ButtonGroup.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Checkbox.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ColorBox.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ColorButton.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ColorPicker.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ComboBox.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Container.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Content.Inline.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Content.Objects.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Content.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/FieldSet.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/FitLayout.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/FloatPanel.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/FlowLayout.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Icons.Ie7.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Icons.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Iframe.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Label.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ListBox.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Menu.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/MenuBar.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/MenuButton.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/MenuItem.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Mixins.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Panel.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Path.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Radio.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Reset.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ResizeHandle.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Scrollable.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Spacer.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/SplitButton.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/StackLayout.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/TabPanel.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/TextBox.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Throbber.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/TinyMCE.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ToolTip.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Variables.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Window.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/content.inline.min.css +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/content.inline.min.min.css +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/content.min.css +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/content.min.min.css +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.dev.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.ie7.dev.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.ie7.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.ie7.min.css +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.ie7.min.min.css +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.min.css +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.min.min.css +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.modern.dev.less +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/readme.md +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce-small.eot +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce-small.json +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce-small.svg +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce-small.ttf +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce-small.woff +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce.eot +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce.json +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce.svg +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce.ttf +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce.woff +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/img/anchor.gif +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/img/loader.gif +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/img/object.gif +src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/img/trans.gif +src/pyams_skin/resources/js/ext/tinymce/dev/themes/modern/theme.js +src/pyams_skin/resources/js/ext/tinymce/dev/themes/modern/theme.min.js +src/pyams_skin/resources/js/ext/tinymce/dev/themes/modern/theme.min.min.js +src/pyams_skin/resources/js/ext/tinymce/langs/fr.js +src/pyams_skin/resources/js/ext/tinymce/langs/fr.min.js +src/pyams_skin/resources/js/ext/tinymce/langs/readme.md +src/pyams_skin/resources/js/ext/tinymce/plugins/advlist/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/anchor/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/autolink/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/autoresize/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/autosave/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/bbcode/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/charmap/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/code/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/colorpicker/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/contextmenu/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/directionality/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-cool.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-cry.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-embarassed.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-frown.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-innocent.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-kiss.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-laughing.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-money-mouth.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-sealed.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-smile.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-surprised.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-tongue-out.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-undecided.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-wink.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/emoticons/img/smiley-yell.gif +src/pyams_skin/resources/js/ext/tinymce/plugins/example/dialog.html +src/pyams_skin/resources/js/ext/tinymce/plugins/example/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/example_dependency/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/fullpage/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/fullscreen/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/hr/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/image/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/importcss/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/insertdatetime/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/layer/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/legacyoutput/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/link/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/lists/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/media/moxieplayer.swf +src/pyams_skin/resources/js/ext/tinymce/plugins/media/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/nonbreaking/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/noneditable/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/pagebreak/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/paste/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/preview/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/print/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/save/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/searchreplace/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/spellchecker/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/tabfocus/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/table/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/template/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/textcolor/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/textpattern/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/visualblocks/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/visualblocks/css/visualblocks.css +src/pyams_skin/resources/js/ext/tinymce/plugins/visualblocks/css/visualblocks.min.css +src/pyams_skin/resources/js/ext/tinymce/plugins/visualchars/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/plugins/wordcount/plugin.min.js +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/content.inline.min.css +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/content.inline.min.min.css +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/content.min.css +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/content.min.min.css +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/skin.ie7.min.css +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/skin.ie7.min.min.css +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/skin.min.css +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/skin.min.min.css +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce-small.eot +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce-small.svg +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce-small.ttf +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce-small.woff +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce.eot +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce.svg +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce.ttf +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce.woff +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/img/anchor.gif +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/img/loader.gif +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/img/object.gif +src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/img/trans.gif +src/pyams_skin/resources/js/ext/tinymce/themes/modern/theme.min.js src/pyams_skin/resources/js/i18n/myams_fr.js src/pyams_skin/resources/js/i18n/myams_fr.min.js src/pyams_skin/resources/less/anims.less @@ -235,6 +876,7 @@ src/pyams_skin/templates/layout.pt src/pyams_skin/templates/modal-layout.pt src/pyams_skin/templates/table.pt +src/pyams_skin/templates/widget-layout.pt src/pyams_skin/tests/__init__.py src/pyams_skin/tests/test_utilsdocs.py src/pyams_skin/tests/test_utilsdocstrings.py diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin.egg-info/requires.txt --- a/src/pyams_skin.egg-info/requires.txt Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin.egg-info/requires.txt Wed Jun 17 10:00:10 2015 +0200 @@ -1,5 +1,6 @@ setuptools fanstatic +pyams_file pyams_utils pyams_viewlet pyramid diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/configuration.py --- a/src/pyams_skin/configuration.py Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/configuration.py Wed Jun 17 10:00:10 2015 +0200 @@ -17,8 +17,9 @@ import pkg_resources # import interfaces -from pyams_skin.interfaces.configuration import IStaticConfiguration, IConfiguration, SKIN_CONFIGURATION_KEY -from pyams_utils.interfaces.site import IConfigurationManager, IConfigurationFactory +from pyams_skin.interfaces.configuration import IStaticConfiguration, IConfiguration, \ + SKIN_CONFIGURATION_KEY +from pyams_utils.interfaces.site import IStaticConfigurationManager, IConfigurationManager, IConfigurationFactory from pyams_utils.interfaces.tales import ITALESExtension from zope.annotation.interfaces import IAnnotations from zope.traversing.interfaces import ITraversable @@ -40,7 +41,7 @@ from pyams_skin import _ -@adapter_config(context=(Interface, Interface, Interface), provides=IStaticConfiguration) +@adapter_config(context=(IStaticConfigurationManager, Interface, Interface), provides=IStaticConfiguration) class StaticConfiguration(object): """Default static configuration""" @@ -83,8 +84,9 @@ def render(self, context=None): if context is None: context = self.context + target = get_parent(context, IStaticConfigurationManager) registry = self.request.registry - return registry.queryMultiAdapter((context, self.request, self.view), IStaticConfiguration) + return registry.queryMultiAdapter((target, self.request, self.view), IStaticConfiguration) @implementer(IConfiguration) diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/configure.zcml --- a/src/pyams_skin/configure.zcml Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/configure.zcml Wed Jun 17 10:00:10 2015 +0200 @@ -27,6 +27,11 @@ layer=".layer.IPyAMSLayer" /> + + diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/interfaces/__init__.py --- a/src/pyams_skin/interfaces/__init__.py Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/interfaces/__init__.py Wed Jun 17 10:00:10 2015 +0200 @@ -77,6 +77,10 @@ """Inner page marker interface""" +class IWidgetInnerPage(IInnerPage): + """Inner page with widget marker interface""" + + class IModalPage(Interface): """Modal page marker interface""" @@ -102,8 +106,16 @@ title = TextLine(title='Page title') + title_badge = TextLine(title="Title badge") + + title_badge_class = TextLine(title="Title badge class") + subtitle = TextLine(title='Page sub-title') + subtitle_badge = TextLine(title="Sub-title badge") + + subtitle_badge_class = TextLine(title="Sub-title badge class") + class IContentHelp(Interface): """Content help block""" @@ -122,6 +134,12 @@ vocabulary='PyAMS HTML renderers') +class IContentTitle(Interface): + """Content title interface""" + + title = Attribute("Content title") + + class IContentSearch(Interface): """Content search interface""" diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/interfaces/tinymce.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/interfaces/tinymce.py Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,27 @@ +# +# Copyright (c) 2008-2015 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + + +# import standard library + +# import interfaces + +# import packages +from zope.interface import Interface, Attribute + + +class ITinyMCEConfiguration(Interface): + """TinyMCE plug-in configuration""" + + configuration = Attribute("TinyMCE editor configuration") diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/interfaces/viewlet.py --- a/src/pyams_skin/interfaces/viewlet.py Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/interfaces/viewlet.py Wed Jun 17 10:00:10 2015 +0200 @@ -117,7 +117,7 @@ icon_class = TextLine(title="Shortcut icon class") - label = Attribute("Shortcut title") + label = TextLine(title="Shortcut title") url = TextLine(title="Shortcut target URL") @@ -247,6 +247,14 @@ # +# Widget title extensions viewlet manager +# + +class IWidgetTitleViewletManager(IViewletManager): + """Widget title viewlet manager""" + + +# # Toolbar viewlet manager # @@ -318,4 +326,4 @@ """Context actions viewlet manager""" css_class = TextLine(title="Button CSS class", - default='btn btn-xs btn-primary dropdown-toggle') + default='btn btn-xs btn-default dropdown-toggle') diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/locales/fr/LC_MESSAGES/pyams_skin.mo Binary file src/pyams_skin/locales/fr/LC_MESSAGES/pyams_skin.mo has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/locales/fr/LC_MESSAGES/pyams_skin.po --- a/src/pyams_skin/locales/fr/LC_MESSAGES/pyams_skin.po Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/locales/fr/LC_MESSAGES/pyams_skin.po Wed Jun 17 10:00:10 2015 +0200 @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE 1.0\n" -"POT-Creation-Date: 2015-03-03 16:35+0100\n" +"POT-Creation-Date: 2015-06-01 14:43+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" @@ -15,41 +15,61 @@ "Content-Transfer-Encoding: 8bit\n" "Generated-By: Lingua 3.8\n" -#: src/pyams_skin/configuration.py:50 src/pyams_skin/configuration.py:53 -#: src/pyams_skin/interfaces/configuration.py:59 -#: src/pyams_skin/interfaces/configuration.py:71 +#: src/pyams_skin/configuration.py:54 src/pyams_skin/configuration.py:57 +#: src/pyams_skin/interfaces/configuration.py:60 +#: src/pyams_skin/interfaces/configuration.py:72 msgid "Search..." msgstr "Rechercher..." -#: src/pyams_skin/table.py:60 +#: src/pyams_skin/table.py:62 msgid "Container elements" msgstr "Contenu" -#: src/pyams_skin/table.py:139 +#: src/pyams_skin/table.py:149 msgid "Name" msgstr "Nom" -#: src/pyams_skin/table.py:149 +#: src/pyams_skin/table.py:171 msgid "Properties" msgstr "Propriétés" -#: src/pyams_skin/table.py:187 +#: src/pyams_skin/table.py:219 +msgid "Actions" +msgstr "Actions" + +#: src/pyams_skin/table.py:240 msgid "Delete object" msgstr "Supprimer l'objet" +#: src/pyams_skin/page.py:75 +msgid "< subtitle >" +msgstr "< sous-titre >" + #: src/pyams_skin/skin.py:38 msgid "Default PyAMS skin" msgstr "Skin PyAMS par défaut" -#: src/pyams_skin/templates/layout.pt:63 +#: src/pyams_skin/container.py:57 +msgid "No provided object_name argument!" +msgstr "Argument 'object_name' non fourni !" + +#: src/pyams_skin/container.py:61 +msgid "Given plug-in name doesn't exist!" +msgstr "Le plug-in indiqué n'existe pas !" + +#: src/pyams_skin/templates/header.pt:5 +msgid "Back to previous page" +msgstr "Revenir à la page précédente" + +#: src/pyams_skin/templates/layout.pt:62 msgid "Hide menu" msgstr "Masquer le menu" -#: src/pyams_skin/templates/layout.pt:72 +#: src/pyams_skin/templates/layout.pt:71 msgid "Logout" msgstr "Déconnexion" -#: src/pyams_skin/templates/layout.pt:162 +#: src/pyams_skin/templates/layout.pt:164 msgid "" "<span><i class='text-warning fa fa-warning'></i> " "WARNING: this will reset all your widgets status!</span>" @@ -62,10 +82,14 @@ msgid "Management interface" msgstr "Panneau de configuration" -#: src/pyams_skin/viewlet/toolbar/__init__.py:92 +#: src/pyams_skin/viewlet/toolbar/__init__.py:98 msgid "Add..." msgstr "Ajouter..." +#: src/pyams_skin/viewlet/toolbar/__init__.py:107 +msgid "Actions..." +msgstr "Actions..." + #: src/pyams_skin/viewlet/activity/__init__.py:43 #, python-format msgid "Last update: {0}" @@ -77,30 +101,42 @@ "<i class='fa fa-refresh fa-spin'></i> Chargement en " "cours..." -#: src/pyams_skin/interfaces/configuration.py:123 +#: src/pyams_skin/interfaces/configuration.py:124 msgid "Title" msgstr "Titre" -#: src/pyams_skin/interfaces/configuration.py:124 +#: src/pyams_skin/interfaces/configuration.py:125 msgid "Application title displayed in title bar" msgstr "Titre de l'application affiché dans la barre de menu" -#: src/pyams_skin/interfaces/configuration.py:127 +#: src/pyams_skin/interfaces/configuration.py:128 msgid "Description" msgstr "Description" -#: src/pyams_skin/interfaces/configuration.py:128 +#: src/pyams_skin/interfaces/configuration.py:129 msgid "Main application description" msgstr "Description principale de l'application ou du site" -#: src/pyams_skin/interfaces/configuration.py:131 +#: src/pyams_skin/interfaces/configuration.py:132 msgid "Author" msgstr "Auteur" -#: src/pyams_skin/interfaces/configuration.py:132 +#: src/pyams_skin/interfaces/configuration.py:133 msgid "Public author name" msgstr "Nom public de l'auteur" +#: src/pyams_skin/interfaces/configuration.py:137 +msgid "Browser favourite icon" +msgstr "Icône des favoris" + +#: src/pyams_skin/interfaces/configuration.py:140 +msgid "Logo" +msgstr "Logo" + +#: src/pyams_skin/interfaces/configuration.py:141 +msgid "Image containing application logo" +msgstr "Image contenant le logo de l'application ou du site" + #: src/pyams_skin/interfaces/__init__.py:61 msgid "Presentation skin" msgstr "Modèle de présentation" diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/locales/pyams_skin.pot --- a/src/pyams_skin/locales/pyams_skin.pot Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/locales/pyams_skin.pot Wed Jun 17 10:00:10 2015 +0200 @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE 1.0\n" -"POT-Creation-Date: 2015-03-03 16:35+0100\n" +"POT-Creation-Date: 2015-06-01 14:43+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" @@ -16,41 +16,61 @@ "Content-Transfer-Encoding: 8bit\n" "Generated-By: Lingua 3.10.dev0\n" -#: ./src/pyams_skin/configuration.py:50 ./src/pyams_skin/configuration.py:53 -#: ./src/pyams_skin/interfaces/configuration.py:59 -#: ./src/pyams_skin/interfaces/configuration.py:71 +#: ./src/pyams_skin/configuration.py:54 ./src/pyams_skin/configuration.py:57 +#: ./src/pyams_skin/interfaces/configuration.py:60 +#: ./src/pyams_skin/interfaces/configuration.py:72 msgid "Search..." msgstr "" -#: ./src/pyams_skin/table.py:60 +#: ./src/pyams_skin/table.py:62 msgid "Container elements" msgstr "" -#: ./src/pyams_skin/table.py:139 +#: ./src/pyams_skin/table.py:149 msgid "Name" msgstr "" -#: ./src/pyams_skin/table.py:149 +#: ./src/pyams_skin/table.py:171 msgid "Properties" msgstr "" -#: ./src/pyams_skin/table.py:187 +#: ./src/pyams_skin/table.py:219 +msgid "Actions" +msgstr "" + +#: ./src/pyams_skin/table.py:240 msgid "Delete object" msgstr "" +#: ./src/pyams_skin/page.py:75 +msgid "< subtitle >" +msgstr "" + #: ./src/pyams_skin/skin.py:38 msgid "Default PyAMS skin" msgstr "" -#: ./src/pyams_skin/templates/layout.pt:63 +#: ./src/pyams_skin/container.py:57 +msgid "No provided object_name argument!" +msgstr "" + +#: ./src/pyams_skin/container.py:61 +msgid "Given plug-in name doesn't exist!" +msgstr "" + +#: ./src/pyams_skin/templates/header.pt:5 +msgid "Back to previous page" +msgstr "" + +#: ./src/pyams_skin/templates/layout.pt:62 msgid "Hide menu" msgstr "" -#: ./src/pyams_skin/templates/layout.pt:72 +#: ./src/pyams_skin/templates/layout.pt:71 msgid "Logout" msgstr "" -#: ./src/pyams_skin/templates/layout.pt:162 +#: ./src/pyams_skin/templates/layout.pt:164 msgid "" "<span><i class='text-warning fa fa-warning'></i> " "WARNING: this will reset all your widgets status!</span>" @@ -60,10 +80,14 @@ msgid "Management interface" msgstr "" -#: ./src/pyams_skin/viewlet/toolbar/__init__.py:92 +#: ./src/pyams_skin/viewlet/toolbar/__init__.py:98 msgid "Add..." msgstr "" +#: ./src/pyams_skin/viewlet/toolbar/__init__.py:107 +msgid "Actions..." +msgstr "" + #: ./src/pyams_skin/viewlet/activity/__init__.py:43 #, python-format msgid "Last update: {0}" @@ -73,30 +97,42 @@ msgid "<i class='fa fa-refresh fa-spin'></i> Loading..." msgstr "" -#: ./src/pyams_skin/interfaces/configuration.py:123 +#: ./src/pyams_skin/interfaces/configuration.py:124 msgid "Title" msgstr "" -#: ./src/pyams_skin/interfaces/configuration.py:124 +#: ./src/pyams_skin/interfaces/configuration.py:125 msgid "Application title displayed in title bar" msgstr "" -#: ./src/pyams_skin/interfaces/configuration.py:127 +#: ./src/pyams_skin/interfaces/configuration.py:128 msgid "Description" msgstr "" -#: ./src/pyams_skin/interfaces/configuration.py:128 +#: ./src/pyams_skin/interfaces/configuration.py:129 msgid "Main application description" msgstr "" -#: ./src/pyams_skin/interfaces/configuration.py:131 +#: ./src/pyams_skin/interfaces/configuration.py:132 msgid "Author" msgstr "" -#: ./src/pyams_skin/interfaces/configuration.py:132 +#: ./src/pyams_skin/interfaces/configuration.py:133 msgid "Public author name" msgstr "" +#: ./src/pyams_skin/interfaces/configuration.py:137 +msgid "Browser favourite icon" +msgstr "" + +#: ./src/pyams_skin/interfaces/configuration.py:140 +msgid "Logo" +msgstr "" + +#: ./src/pyams_skin/interfaces/configuration.py:141 +msgid "Image containing application logo" +msgstr "" + #: ./src/pyams_skin/interfaces/__init__.py:61 msgid "Presentation skin" msgstr "" diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/page.py --- a/src/pyams_skin/page.py Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/page.py Wed Jun 17 10:00:10 2015 +0200 @@ -16,12 +16,13 @@ # import standard library # import interfaces -from pyams_skin.interfaces import IInnerPage, IModalPage, IPageHeader +from pyams_skin.interfaces import IInnerPage, IModalPage, IPageHeader, IContentTitle from pyams_skin.layer import IPyAMSLayer # import packages from pyams_pagelet.pagelet import pagelet_config from pyams_template.template import template_config +from pyams_utils.adapter import ContextRequestViewAdapter from pyams_viewlet.viewlet import contentprovider_config from zope.interface import implementer, Interface @@ -52,3 +53,27 @@ def update(self): registry = self.request.registry self.header = registry.queryMultiAdapter((self.context, self.request, self.view), IPageHeader) + + +class DefaultPageHeaderAdapter(ContextRequestViewAdapter): + """Default page header adapter""" + + back_url = None + back_target = None + + icon_class = 'fa fa-fw' + + @property + def title(self): + adapter = self.request.registry.queryMultiAdapter((self.context, self.request, self.view), IContentTitle) + if adapter is None: + adapter = IContentTitle(self.context, None) + if adapter is not None: + return adapter.title + + title_badge = None + title_badge_class = 'badge inbox-badge bg-color-red' + + subtitle = None + subtitle_badge = None + subtitle_badge_class = 'badge inbox-badge bg-color-red' diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/css/myams.css --- a/src/pyams_skin/resources/css/myams.css Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/resources/css/myams.css Wed Jun 17 10:00:10 2015 +0200 @@ -5257,7 +5257,7 @@ margin: 0; display: none; background: rgba(91, 103, 113, 0.8); - padding: 7px 0; + padding: 2px 0; } nav ul ul > li:hover b { color: #D5D9E2; @@ -5266,6 +5266,11 @@ margin: 0; padding: 0; } +nav ul ul li.divider { + height: 1px; + margin-left: 30px; + padding: 0; +} nav ul ul li > a { padding-left: 42px; font-size: 12px; @@ -7378,6 +7383,11 @@ padding: 4px 8px!important; line-height: 1.3!important; } +.table-small td, +.table-small th { + padding: 2px 8px!important; + line-height: 1.2!important; +} .table-mini td, .table-mini th { padding: 1px 8px!important; @@ -8684,6 +8694,10 @@ .ams-form .form-group { padding: 5px 10px; } +.ams-form.form-tight .form-group, +.ams-form .form-tight .form-group { + padding: 1px 10px; +} .ams-form label.checkbox, .ams-form label.radio { padding-top: 0; @@ -9114,6 +9128,23 @@ height: 14px; line-height: 1em; } +.ams-form .input span.textarea-widget, +.ams-form .textarea span.textarea-widget { + display: block; + width: 100%; + min-height: 14px; + padding: 4px 0; + border-bottom: 1px solid #ccc!important; +} +.ams-form .input .i18n-content input[readonly], +.ams-form .select .i18n-content select[readonly], +.ams-form .textarea .i18n-content textarea[readonly] { + border-width: 0!important; +} +.ams-form .input .i18n-content .textarea-widget { + display: block; + min-height: 12px; +} .ams-form .input input:focus + .tooltip, .ams-form .textarea textarea:focus + .tooltip { opacity: 1; @@ -10343,6 +10374,9 @@ padding: 6px 4px 3px; border: 1px solid #fff; } +.mce-edit-area > iframe { + min-height: 400px!important; +} .client-form header { padding: 15px 13px; margin: 0; @@ -10924,6 +10958,10 @@ margin-left: 10px; float: left; } +.ams-widget > header > h2 + .btn, +.ams-widget > header > h2 + .btn-group { + margin-left: 20px; +} .rtl .ams-widget > header { padding: 0 7px 0 0; } @@ -10964,12 +11002,12 @@ margin: 0; padding: 13px 13px 0; background-color: #fff !important; - border-width: 1px 1px 2px; + border-width: 1px; border-style: solid; + border-color: #ccc!important; +} +.ams-widget > header + div { border-top: 0; - border-right-color: #CCC !important; - border-bottom-color: #CCC !important; - border-left-color: #CCC !important; } .ams-widget .widget-body { position: relative; @@ -11940,7 +11978,7 @@ } .select2-container-multi .select2-choices .select2-search-choice { padding: 1px 28px 1px 8px; - margin: 2px 0 2px 2px; + margin: 2px; position: relative; line-height: 18px; color: #fff; @@ -11965,8 +12003,12 @@ .select2-container-multi .select2-choices .select2-search-choice.ui-sortable-handle { cursor: move; } +.with-icons .select2-container-multi .select2-choices .select2-search-choice.ui-sortable-handle { + margin-right: 1px; +} .select2-container-multi.ordered .select2-choices li { float: none; + cursor: move; } .select2-container-multi.ordered .select2-choices li.ui-state-highlight { margin: 2px 0 2px 2px; @@ -12065,7 +12107,7 @@ overflow: hidden; padding: 0; } -label.with-icon > i.icon-append + .select2-parent .select2-choices { +label.with-icon > i.icon-append + .select2-parent > .select2-choices { padding-right: 29px; } .multiselect-container { @@ -15124,6 +15166,7 @@ position: fixed; width: 100%; height: 100%; + z-index: 990; } .modal-dialog.modal-max { width: 98%; @@ -15147,6 +15190,9 @@ max-width: 450px; } } +.modal-dialog .modal-body .modal-viewport { + min-height: 140px; +} .modal-dialog .suffix .alert { margin-bottom: 0; border-radius: 0 0 5px 5px; diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/css/myams.min.css --- a/src/pyams_skin/resources/css/myams.min.css Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/resources/css/myams.min.css Wed Jun 17 10:00:10 2015 +0200 @@ -1,1 +1,1 @@ -.txt-color-blue{color:#60747c!important}.txt-color-blueLight{color:#ccdadf!important}.txt-color-blueDark{color:#4c4f53!important}.txt-color-green{color:#356e35!important}.txt-color-greenLight{color:#71843f!important}.txt-color-greenDark{color:#496949!important}.txt-color-red{color:#931313!important}.txt-color-yellow{color:#d4c737!important}.txt-color-yellowLight{color:#fff03d!important}.txt-color-orange{color:#c79121!important}.txt-color-orangeLight{color:#ee9000!important}.txt-color-orangeDark{color:#a57225!important}.txt-color-pink{color:#ac5287!important}.txt-color-pinkDark{color:#a8829f!important}.txt-color-purple{color:#65596b!important}.txt-color-darken{color:#404040!important}.txt-color-silver{color:#b4b4b4!important}.txt-color-lighten{color:#d5e7ec!important}.txt-color-white{color:#dedede!important}.txt-color-grayDark{color:#525252!important}.txt-color-magenta{color:#6e3671!important}.txt-color-teal{color:#568a89!important}.txt-color-redLight{color:#a65858!important}.txt-color-active{color:#3276b1!important}.txt-color-activeBg{color:#cedbf7!important}.bg-color-blue{background-color:#60747c!important}.bg-color-blueLight{background-color:#ccdadf!important}.bg-color-blueDark{background-color:#4c4f53!important}.bg-color-green{background-color:#356e35!important}.bg-color-greenLight{background-color:#71843f!important}.bg-color-greenDark{background-color:#496949!important}.bg-color-red{background-color:#931313!important}.bg-color-yellow{background-color:#d4c737!important}.bg-color-yellowLight{background-color:#fff03d!important}.bg-color-orange{background-color:#c79121!important}.bg-color-orangeLight{background-color:#ee9000!important}.bg-color-orangeDark{background-color:#a57225!important}.bg-color-pink{background-color:#ac5287!important}.bg-color-pinkDark{background-color:#a8829f!important}.bg-color-purple{background-color:#65596b!important}.bg-color-darken{background-color:#404040!important}.bg-color-silver{background-color:#b4b4b4!important}.bg-color-lighten{background-color:#d5e7ec!important}.bg-color-white{background-color:#dedede!important}.bg-color-grayDark{background-color:#525252!important}.bg-color-magenta{background-color:#6e3671!important}.bg-color-teal{background-color:#568a89!important}.bg-color-redLight{background-color:#a65858!important}.bg-color-active{background-color:#3276b1!important}.bg-color-activeBg{background-color:#cedbf7!important}@-webkit-keyframes flash{0%,100%,50%{opacity:1}25%,75%{opacity:0}}@keyframes flash{0%,100%,50%{opacity:1}25%,75%{opacity:0}}@-webkit-keyframes shake{0%,100%{-webkit-transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px)}}@keyframes shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}@-webkit-keyframes bounce{0%,100%,20%,50%,80%{-webkit-transform:translateY(0)}40%{-webkit-transform:translateY(-30px)}60%{-webkit-transform:translateY(-15px)}}@keyframes bounce{0%,100%,20%,50%,80%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}40%{-webkit-transform:translateY(-30px);-ms-transform:translateY(-30px);transform:translateY(-30px)}60%{-webkit-transform:translateY(-15px);-ms-transform:translateY(-15px);transform:translateY(-15px)}}@-webkit-keyframes tada{0%{-webkit-transform:scale(1)}10%,20%{-webkit-transform:scale(0.9) rotate(-3deg)}30%,50%,70%,90%{-webkit-transform:scale(1.1) rotate(3deg)}40%,60%,80%{-webkit-transform:scale(1.1) rotate(-3deg)}100%{-webkit-transform:scale(1) rotate(0)}}@keyframes tada{0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}10%,20%{-webkit-transform:scale(0.9) rotate(-3deg);-ms-transform:scale(0.9) rotate(-3deg);transform:scale(0.9) rotate(-3deg)}30%,50%,70%,90%{-webkit-transform:scale(1.1) rotate(3deg);-ms-transform:scale(1.1) rotate(3deg);transform:scale(1.1) rotate(3deg)}40%,60%,80%{-webkit-transform:scale(1.1) rotate(-3deg);-ms-transform:scale(1.1) rotate(-3deg);transform:scale(1.1) rotate(-3deg)}100%{-webkit-transform:scale(1) rotate(0);-ms-transform:scale(1) rotate(0);transform:scale(1) rotate(0)}}@-webkit-keyframes swing{100%,20%,40%,60%,80%{-webkit-transform-origin:top center}20%{-webkit-transform:rotate(15deg)}40%{-webkit-transform:rotate(-10deg)}60%{-webkit-transform:rotate(5deg)}80%{-webkit-transform:rotate(-5deg)}100%{-webkit-transform:rotate(0deg)}}@keyframes swing{20%{-webkit-transform:rotate(15deg);-ms-transform:rotate(15deg);transform:rotate(15deg)}40%{-webkit-transform:rotate(-10deg);-ms-transform:rotate(-10deg);transform:rotate(-10deg)}60%{-webkit-transform:rotate(5deg);-ms-transform:rotate(5deg);transform:rotate(5deg)}80%{-webkit-transform:rotate(-5deg);-ms-transform:rotate(-5deg);transform:rotate(-5deg)}100%{-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg)}}@-webkit-keyframes wobble{0%{-webkit-transform:translateX(0)}15%{-webkit-transform:translateX(-25%) rotate(-5deg)}30%{-webkit-transform:translateX(20%) rotate(3deg)}45%{-webkit-transform:translateX(-15%) rotate(-3deg)}60%{-webkit-transform:translateX(10%) rotate(2deg)}75%{-webkit-transform:translateX(-5%) rotate(-1deg)}100%{-webkit-transform:translateX(0)}}@keyframes wobble{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}15%{-webkit-transform:translateX(-25%) rotate(-5deg);-ms-transform:translateX(-25%) rotate(-5deg);transform:translateX(-25%) rotate(-5deg)}30%{-webkit-transform:translateX(20%) rotate(3deg);-ms-transform:translateX(20%) rotate(3deg);transform:translateX(20%) rotate(3deg)}45%{-webkit-transform:translateX(-15%) rotate(-3deg);-ms-transform:translateX(-15%) rotate(-3deg);transform:translateX(-15%) rotate(-3deg)}60%{-webkit-transform:translateX(10%) rotate(2deg);-ms-transform:translateX(10%) rotate(2deg);transform:translateX(10%) rotate(2deg)}75%{-webkit-transform:translateX(-5%) rotate(-1deg);-ms-transform:translateX(-5%) rotate(-1deg);transform:translateX(-5%) rotate(-1deg)}100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes pulse{0%{-webkit-transform:scale(1)}50%{-webkit-transform:scale(1.1)}100%{-webkit-transform:scale(1)}}@keyframes pulse{0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}100%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}@-webkit-keyframes flip{0%{-webkit-transform:perspective(400px) translateZ(0) rotateY(0) scale(1);-webkit-animation-timing-function:ease-out}40%{-webkit-transform:perspective(400px) translateZ(150px) rotateY(170deg) scale(1);-webkit-animation-timing-function:ease-out}50%{-webkit-transform:perspective(400px) translateZ(150px) rotateY(190deg) scale(1);-webkit-animation-timing-function:ease-in}80%{-webkit-transform:perspective(400px) translateZ(0) rotateY(360deg) scale(0.95);-webkit-animation-timing-function:ease-in}100%{-webkit-transform:perspective(400px) translateZ(0) rotateY(360deg) scale(1);-webkit-animation-timing-function:ease-in}}@keyframes flip{0%{-webkit-transform:perspective(400px) translateZ(0) rotateY(0) scale(1);-ms-transform:perspective(400px) translateZ(0) rotateY(0) scale(1);transform:perspective(400px) translateZ(0) rotateY(0) scale(1);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}40%{-webkit-transform:perspective(400px) translateZ(150px) rotateY(170deg) scale(1);-ms-transform:perspective(400px) translateZ(150px) rotateY(170deg) scale(1);transform:perspective(400px) translateZ(150px) rotateY(170deg) scale(1);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}50%{-webkit-transform:perspective(400px) translateZ(150px) rotateY(190deg) scale(1);-ms-transform:perspective(400px) translateZ(150px) rotateY(190deg) scale(1);transform:perspective(400px) translateZ(150px) rotateY(190deg) scale(1);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}80%{-webkit-transform:perspective(400px) translateZ(0) rotateY(360deg) scale(0.95);-ms-transform:perspective(400px) translateZ(0) rotateY(360deg) scale(0.95);transform:perspective(400px) translateZ(0) rotateY(360deg) scale(0.95);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}100%{-webkit-transform:perspective(400px) translateZ(0) rotateY(360deg) scale(1);-ms-transform:perspective(400px) translateZ(0) rotateY(360deg) scale(1);transform:perspective(400px) translateZ(0) rotateY(360deg) scale(1);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}}@-webkit-keyframes flipInX{0%{-webkit-transform:perspective(400px) rotateX(90deg);opacity:0}40%{-webkit-transform:perspective(400px) rotateX(-10deg)}70%{-webkit-transform:perspective(400px) rotateX(10deg)}100%{-webkit-transform:perspective(400px) rotateX(0deg);opacity:1}}@keyframes flipInX{0%{-webkit-transform:perspective(400px) rotateX(90deg);-ms-transform:perspective(400px) rotateX(90deg);transform:perspective(400px) rotateX(90deg);opacity:0}40%{-webkit-transform:perspective(400px) rotateX(-10deg);-ms-transform:perspective(400px) rotateX(-10deg);transform:perspective(400px) rotateX(-10deg)}70%{-webkit-transform:perspective(400px) rotateX(10deg);-ms-transform:perspective(400px) rotateX(10deg);transform:perspective(400px) rotateX(10deg)}100%{-webkit-transform:perspective(400px) rotateX(0deg);-ms-transform:perspective(400px) rotateX(0deg);transform:perspective(400px) rotateX(0deg);opacity:1}}@-webkit-keyframes flipOutX{0%{-webkit-transform:perspective(400px) rotateX(0deg);opacity:1}100%{-webkit-transform:perspective(400px) rotateX(90deg);opacity:0}}@keyframes flipOutX{0%{-webkit-transform:perspective(400px) rotateX(0deg);-ms-transform:perspective(400px) rotateX(0deg);transform:perspective(400px) rotateX(0deg);opacity:1}100%{-webkit-transform:perspective(400px) rotateX(90deg);-ms-transform:perspective(400px) rotateX(90deg);transform:perspective(400px) rotateX(90deg);opacity:0}}@-webkit-keyframes flipInY{0%{-webkit-transform:perspective(400px) rotateY(90deg);opacity:0}40%{-webkit-transform:perspective(400px) rotateY(-10deg)}70%{-webkit-transform:perspective(400px) rotateY(10deg)}100%{-webkit-transform:perspective(400px) rotateY(0deg);opacity:1}}@keyframes flipInY{0%{-webkit-transform:perspective(400px) rotateY(90deg);-ms-transform:perspective(400px) rotateY(90deg);transform:perspective(400px) rotateY(90deg);opacity:0}40%{-webkit-transform:perspective(400px) rotateY(-10deg);-ms-transform:perspective(400px) rotateY(-10deg);transform:perspective(400px) rotateY(-10deg)}70%{-webkit-transform:perspective(400px) rotateY(10deg);-ms-transform:perspective(400px) rotateY(10deg);transform:perspective(400px) rotateY(10deg)}100%{-webkit-transform:perspective(400px) rotateY(0deg);-ms-transform:perspective(400px) rotateY(0deg);transform:perspective(400px) rotateY(0deg);opacity:1}}@-webkit-keyframes flipOutY{0%{-webkit-transform:perspective(400px) rotateY(0deg);opacity:1}100%{-webkit-transform:perspective(400px) rotateY(90deg);opacity:0}}@keyframes flipOutY{0%{-webkit-transform:perspective(400px) rotateY(0deg);-ms-transform:perspective(400px) rotateY(0deg);transform:perspective(400px) rotateY(0deg);opacity:1}100%{-webkit-transform:perspective(400px) rotateY(90deg);-ms-transform:perspective(400px) rotateY(90deg);transform:perspective(400px) rotateY(90deg);opacity:0}}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes fadeInUp{0%{opacity:0;-webkit-transform:translateY(20px)}100%{opacity:1;-webkit-transform:translateY(0)}}@keyframes fadeInUp{0%{opacity:0;-webkit-transform:translateY(20px);-ms-transform:translateY(20px);transform:translateY(20px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes fadeInDown{0%{opacity:0;-webkit-transform:translateY(-20px)}100%{opacity:1;-webkit-transform:translateY(0)}}@keyframes fadeInDown{0%{opacity:0;-webkit-transform:translateY(-20px);-ms-transform:translateY(-20px);transform:translateY(-20px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes fadeInLeft{0%{opacity:0;-webkit-transform:translateX(-20px)}100%{opacity:1;-webkit-transform:translateX(0)}}@keyframes fadeInLeft{0%{opacity:0;-webkit-transform:translateX(-20px);-ms-transform:translateX(-20px);transform:translateX(-20px)}100%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes fadeInRight{0%{opacity:0;-webkit-transform:translateX(20px)}100%{opacity:1;-webkit-transform:translateX(0)}}@keyframes fadeInRight{0%{opacity:0;-webkit-transform:translateX(20px);-ms-transform:translateX(20px);transform:translateX(20px)}100%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0)}}@keyframes fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes fadeInDownBig{0%{opacity:0;-webkit-transform:translateY(-2000px)}100%{opacity:1;-webkit-transform:translateY(0)}}@keyframes fadeInDownBig{0%{opacity:0;-webkit-transform:translateY(-2000px);-ms-transform:translateY(-2000px);transform:translateY(-2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes fadeInLeftBig{0%{opacity:0;-webkit-transform:translateX(-2000px)}100%{opacity:1;-webkit-transform:translateX(0)}}@keyframes fadeInLeftBig{0%{opacity:0;-webkit-transform:translateX(-2000px);-ms-transform:translateX(-2000px);transform:translateX(-2000px)}100%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes fadeInRightBig{0%{opacity:0;-webkit-transform:translateX(2000px)}100%{opacity:1;-webkit-transform:translateX(0)}}@keyframes fadeInRightBig{0%{opacity:0;-webkit-transform:translateX(2000px);-ms-transform:translateX(2000px);transform:translateX(2000px)}100%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-webkit-keyframes fadeOutUp{0%{opacity:1;-webkit-transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(-20px)}}@keyframes fadeOutUp{0%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(-20px);-ms-transform:translateY(-20px);transform:translateY(-20px)}}@-webkit-keyframes fadeOutDown{0%{opacity:1;-webkit-transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(20px)}}@keyframes fadeOutDown{0%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(20px);-ms-transform:translateY(20px);transform:translateY(20px)}}@-webkit-keyframes fadeOutLeft{0%{opacity:1;-webkit-transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(-20px)}}@keyframes fadeOutLeft{0%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(-20px);-ms-transform:translateX(-20px);transform:translateX(-20px)}}@-webkit-keyframes fadeOutRight{0%{opacity:1;-webkit-transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(20px)}}@keyframes fadeOutRight{0%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(20px);-ms-transform:translateX(20px);transform:translateX(20px)}}@-webkit-keyframes fadeOutUpBig{0%{opacity:1;-webkit-transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(-2000px)}}@keyframes fadeOutUpBig{0%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(-2000px);-ms-transform:translateY(-2000px);transform:translateY(-2000px)}}@-webkit-keyframes fadeOutDownBig{0%{opacity:1;-webkit-transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(2000px)}}@keyframes fadeOutDownBig{0%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}}@-webkit-keyframes fadeOutLeftBig{0%{opacity:1;-webkit-transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(-2000px)}}@keyframes fadeOutLeftBig{0%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(-2000px);-ms-transform:translateX(-2000px);transform:translateX(-2000px)}}@-webkit-keyframes fadeOutRightBig{0%{opacity:1;-webkit-transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(2000px)}}@keyframes fadeOutRightBig{0%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(2000px);-ms-transform:translateX(2000px);transform:translateX(2000px)}}@-webkit-keyframes bounceIn{0%{opacity:0;-webkit-transform:scale(0.3)}50%{opacity:1;-webkit-transform:scale(1.05)}70%{-webkit-transform:scale(0.9)}100%{-webkit-transform:scale(1)}}@keyframes bounceIn{0%{opacity:0;-webkit-transform:scale(0.3);-ms-transform:scale(0.3);transform:scale(0.3)}50%{opacity:1;-webkit-transform:scale(1.05);-ms-transform:scale(1.05);transform:scale(1.05)}70%{-webkit-transform:scale(0.9);-ms-transform:scale(0.9);transform:scale(0.9)}100%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}@-webkit-keyframes slideInDown{0%{opacity:0;-webkit-transform:translateY(-2000px)}100%{-webkit-transform:translateY(0)}}@keyframes slideInDown{0%{opacity:0;-webkit-transform:translateY(-2000px);-ms-transform:translateY(-2000px);transform:translateY(-2000px)}100%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes slideInLeft{0%{opacity:0;-webkit-transform:translateX(-2000px)}100%{-webkit-transform:translateX(0)}}@keyframes slideInLeft{0%{opacity:0;-webkit-transform:translateX(-2000px);-ms-transform:translateX(-2000px);transform:translateX(-2000px)}100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes slideInRight{0%{opacity:0;-webkit-transform:translateX(2000px)}100%{-webkit-transform:translateX(0)}}@keyframes slideInRight{0%{opacity:0;-webkit-transform:translateX(2000px);-ms-transform:translateX(2000px);transform:translateX(2000px)}100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes slideOutLeft{0%{-webkit-transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(-2000px)}}@keyframes slideOutLeft{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(-2000px);-ms-transform:translateX(-2000px);transform:translateX(-2000px)}}@-webkit-keyframes slideOutRight{0%{-webkit-transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(2000px)}}@keyframes slideOutRight{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(2000px);-ms-transform:translateX(2000px);transform:translateX(2000px)}}@-webkit-keyframes slideOutUp{0%{-webkit-transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(-2000px)}}@keyframes slideOutUp{0%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(-2000px);-ms-transform:translateY(-2000px);transform:translateY(-2000px)}}@-webkit-keyframes bounceInUp{0%{opacity:0;-webkit-transform:translateY(2000px)}60%{opacity:1;-webkit-transform:translateY(-30px)}80%{-webkit-transform:translateY(10px)}100%{-webkit-transform:translateY(0)}}@keyframes bounceInUp{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}60%{opacity:1;-webkit-transform:translateY(-30px);-ms-transform:translateY(-30px);transform:translateY(-30px)}80%{-webkit-transform:translateY(10px);-ms-transform:translateY(10px);transform:translateY(10px)}100%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes bounceInDown{0%{opacity:0;-webkit-transform:translateY(-2000px)}60%{opacity:1;-webkit-transform:translateY(30px)}80%{-webkit-transform:translateY(-10px)}100%{-webkit-transform:translateY(0)}}@keyframes bounceInDown{0%{opacity:0;-webkit-transform:translateY(-2000px);-ms-transform:translateY(-2000px);transform:translateY(-2000px)}60%{opacity:1;-webkit-transform:translateY(30px);-ms-transform:translateY(30px);transform:translateY(30px)}80%{-webkit-transform:translateY(-10px);-ms-transform:translateY(-10px);transform:translateY(-10px)}100%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes bounceInLeft{0%{opacity:0;-webkit-transform:translateX(-2000px)}60%{opacity:1;-webkit-transform:translateX(30px)}80%{-webkit-transform:translateX(-10px)}100%{-webkit-transform:translateX(0)}}@keyframes bounceInLeft{0%{opacity:0;-webkit-transform:translateX(-2000px);-ms-transform:translateX(-2000px);transform:translateX(-2000px)}60%{opacity:1;-webkit-transform:translateX(30px);-ms-transform:translateX(30px);transform:translateX(30px)}80%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes bounceInRight{0%{opacity:0;-webkit-transform:translateX(2000px)}60%{opacity:1;-webkit-transform:translateX(-30px)}80%{-webkit-transform:translateX(10px)}100%{-webkit-transform:translateX(0)}}@keyframes bounceInRight{0%{opacity:0;-webkit-transform:translateX(2000px);-ms-transform:translateX(2000px);transform:translateX(2000px)}60%{opacity:1;-webkit-transform:translateX(-30px);-ms-transform:translateX(-30px);transform:translateX(-30px)}80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes bounceOut{0%{-webkit-transform:scale(1)}25%{-webkit-transform:scale(0.95)}50%{opacity:1;-webkit-transform:scale(1.1)}100%{opacity:0;-webkit-transform:scale(0.3)}}@keyframes bounceOut{0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}25%{-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95)}50%{opacity:1;-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}100%{opacity:0;-webkit-transform:scale(0.3);-ms-transform:scale(0.3);transform:scale(0.3)}}@-webkit-keyframes bounceOutUp{0%{-webkit-transform:translateY(0)}20%{opacity:1;-webkit-transform:translateY(20px)}100%{opacity:0;-webkit-transform:translateY(-2000px)}}@keyframes bounceOutUp{0%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}20%{opacity:1;-webkit-transform:translateY(20px);-ms-transform:translateY(20px);transform:translateY(20px)}100%{opacity:0;-webkit-transform:translateY(-2000px);-ms-transform:translateY(-2000px);transform:translateY(-2000px)}}@-webkit-keyframes bounceOutDown{0%{-webkit-transform:translateY(0)}20%{opacity:1;-webkit-transform:translateY(-20px)}100%{opacity:0;-webkit-transform:translateY(2000px)}}@keyframes bounceOutDown{0%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}20%{opacity:1;-webkit-transform:translateY(-20px);-ms-transform:translateY(-20px);transform:translateY(-20px)}100%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}}@-webkit-keyframes bounceOutLeft{0%{-webkit-transform:translateX(0)}20%{opacity:1;-webkit-transform:translateX(20px)}100%{opacity:0;-webkit-transform:translateX(-2000px)}}@keyframes bounceOutLeft{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}20%{opacity:1;-webkit-transform:translateX(20px);-ms-transform:translateX(20px);transform:translateX(20px)}100%{opacity:0;-webkit-transform:translateX(-2000px);-ms-transform:translateX(-2000px);transform:translateX(-2000px)}}@-webkit-keyframes bounceOutRight{0%{-webkit-transform:translateX(0)}20%{opacity:1;-webkit-transform:translateX(-20px)}100%{opacity:0;-webkit-transform:translateX(2000px)}}@keyframes bounceOutRight{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}20%{opacity:1;-webkit-transform:translateX(-20px);-ms-transform:translateX(-20px);transform:translateX(-20px)}100%{opacity:0;-webkit-transform:translateX(2000px);-ms-transform:translateX(2000px);transform:translateX(2000px)}}@-webkit-keyframes rotateIn{0%{-webkit-transform-origin:center center;-webkit-transform:rotate(-200deg);opacity:0}100%{-webkit-transform-origin:center center;-webkit-transform:rotate(0);opacity:1}}@keyframes rotateIn{0%{-webkit-transform-origin:center center;-ms-transform-origin:center center;transform-origin:center center;-webkit-transform:rotate(-200deg);-ms-transform:rotate(-200deg);transform:rotate(-200deg);opacity:0}100%{-webkit-transform-origin:center center;-ms-transform-origin:center center;transform-origin:center center;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}}@-webkit-keyframes rotateInUpLeft{0%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(90deg);opacity:0}100%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(0);opacity:1}}@keyframes rotateInUpLeft{0%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);opacity:0}100%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}}@-webkit-keyframes rotateInDownLeft{0%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(-90deg);opacity:0}100%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(0);opacity:1}}@keyframes rotateInDownLeft{0%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);opacity:0}100%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}}@-webkit-keyframes rotateInUpRight{0%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(-90deg);opacity:0}100%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(0);opacity:1}}@keyframes rotateInUpRight{0%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);opacity:0}100%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}}@-webkit-keyframes rotateInDownRight{0%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(90deg);opacity:0}100%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(0);opacity:1}}@keyframes rotateInDownRight{0%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);opacity:0}100%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}}@-webkit-keyframes rotateOut{0%{-webkit-transform-origin:center center;-webkit-transform:rotate(0);opacity:1}100%{-webkit-transform-origin:center center;-webkit-transform:rotate(200deg);opacity:0}}@keyframes rotateOut{0%{-webkit-transform-origin:center center;-ms-transform-origin:center center;transform-origin:center center;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}100%{-webkit-transform-origin:center center;-ms-transform-origin:center center;transform-origin:center center;-webkit-transform:rotate(200deg);-ms-transform:rotate(200deg);transform:rotate(200deg);opacity:0}}@-webkit-keyframes rotateOutUpLeft{0%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(0);opacity:1}100%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(-90deg);opacity:0}}@keyframes rotateOutUpLeft{0%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}100%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);opacity:0}}@-webkit-keyframes rotateOutDownLeft{0%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(0);opacity:1}100%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(90deg);opacity:0}}@keyframes rotateOutDownLeft{0%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}100%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);opacity:0}}@-webkit-keyframes rotateOutUpRight{0%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(0);opacity:1}100%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(90deg);opacity:0}}@keyframes rotateOutUpRight{0%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}100%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);opacity:0}}@-webkit-keyframes rotateOutDownRight{0%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(0);opacity:1}100%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(-90deg);opacity:0}}@keyframes rotateOutDownRight{0%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}100%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);opacity:0}}@-webkit-keyframes hinge{0%{-webkit-transform:rotate(0);-webkit-transform-origin:top left;-webkit-animation-timing-function:ease-in-out}20%,60%{-webkit-transform:rotate(80deg);-webkit-transform-origin:top left;-webkit-animation-timing-function:ease-in-out}40%{-webkit-transform:rotate(60deg);-webkit-transform-origin:top left;-webkit-animation-timing-function:ease-in-out}80%{-webkit-transform:rotate(60deg) translateY(0);opacity:1;-webkit-transform-origin:top left;-webkit-animation-timing-function:ease-in-out}100%{-webkit-transform:translateY(700px);opacity:0}}@keyframes hinge{0%{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);-webkit-transform-origin:top left;-ms-transform-origin:top left;transform-origin:top left;-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}20%,60%{-webkit-transform:rotate(80deg);-ms-transform:rotate(80deg);transform:rotate(80deg);-webkit-transform-origin:top left;-ms-transform-origin:top left;transform-origin:top left;-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}40%{-webkit-transform:rotate(60deg);-ms-transform:rotate(60deg);transform:rotate(60deg);-webkit-transform-origin:top left;-ms-transform-origin:top left;transform-origin:top left;-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}80%{-webkit-transform:rotate(60deg) translateY(0);-ms-transform:rotate(60deg) translateY(0);transform:rotate(60deg) translateY(0);opacity:1;-webkit-transform-origin:top left;-ms-transform-origin:top left;transform-origin:top left;-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}100%{-webkit-transform:translateY(700px);-ms-transform:translateY(700px);transform:translateY(700px);opacity:0}}@-webkit-keyframes rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0deg)}}@keyframes rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0deg);-ms-transform:translateX(0) rotate(0deg);transform:translateX(0) rotate(0deg)}}@-webkit-keyframes rollOut{0%{opacity:1;-webkit-transform:translateX(0) rotate(0deg)}100%{opacity:0;-webkit-transform:translateX(100%) rotate(120deg)}}@keyframes rollOut{0%{opacity:1;-webkit-transform:translateX(0) rotate(0deg);-ms-transform:translateX(0) rotate(0deg);transform:translateX(0) rotate(0deg)}100%{opacity:0;-webkit-transform:translateX(100%) rotate(120deg);-ms-transform:translateX(100%) rotate(120deg);transform:translateX(100%) rotate(120deg)}}@-webkit-keyframes lightSpeedIn{0%{-webkit-transform:translateX(100%) skewX(-30deg);opacity:0}60%{-webkit-transform:translateX(-20%) skewX(30deg);opacity:1}80%{-webkit-transform:translateX(0) skewX(-15deg);opacity:1}100%{-webkit-transform:translateX(0) skewX(0deg);opacity:1}}@keyframes lightSpeedIn{0%{-webkit-transform:translateX(100%) skewX(-30deg);-ms-transform:translateX(100%) skewX(-30deg);transform:translateX(100%) skewX(-30deg);opacity:0}60%{-webkit-transform:translateX(-20%) skewX(30deg);-ms-transform:translateX(-20%) skewX(30deg);transform:translateX(-20%) skewX(30deg);opacity:1}80%{-webkit-transform:translateX(0) skewX(-15deg);-ms-transform:translateX(0) skewX(-15deg);transform:translateX(0) skewX(-15deg);opacity:1}100%{-webkit-transform:translateX(0) skewX(0deg);-ms-transform:translateX(0) skewX(0deg);transform:translateX(0) skewX(0deg);opacity:1}}@-webkit-keyframes lightSpeedOut{0%{-webkit-transform:translateX(0) skewX(0deg);opacity:1}100%{-webkit-transform:translateX(100%) skewX(-30deg);opacity:0}}@keyframes lightSpeedOut{0%{-webkit-transform:translateX(0) skewX(0deg);-ms-transform:translateX(0) skewX(0deg);transform:translateX(0) skewX(0deg);opacity:1}100%{-webkit-transform:translateX(100%) skewX(-30deg);-ms-transform:translateX(100%) skewX(-30deg);transform:translateX(100%) skewX(-30deg);opacity:0}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-ms-keyframes spin{0%{-ms-transform:rotate(0deg)}100%{-ms-transform:rotate(359deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);-ms-transform:rotate(359deg);transform:rotate(359deg)}}@-webkit-keyframes loading{0%{background-position:0 -400px}100%{background-position:-7px -400px}}@-ms-keyframes loading{0%{background-position:0 -400px}100%{background-position:-7px -400px}}@keyframes loading{0%{background-position:0 -400px}100%{background-position:-7px -400px}}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-webkit-keyframes pace-spinner{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-ms-keyframes pace-spinner{0%{-ms-transform:rotate(0deg);transform:rotate(0deg)}100%{-ms-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes pace-spinner{0%{-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg)}}.animated{-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.animated.fast{-webkit-animation-duration:.4s;-ms-animation-duration:.4s;animation-duration:.4s}.animated.hinge{-webkit-animation-duration:2s;animation-duration:2s}.animated.flash{-webkit-animation-name:flash;animation-name:flash}.animated.shake{-webkit-animation-name:shake;animation-name:shake}.animated.bounce{-webkit-animation-name:bounce;animation-name:bounce}.animated.tada{-webkit-animation-name:tada;animation-name:tada}.animated.swing{-webkit-transform-origin:top center;-ms-transform-origin:top center;transform-origin:top center;-webkit-animation-name:swing;animation-name:swing}.animated.wobble{-webkit-animation-name:wobble;animation-name:wobble}.animated.pulse{-webkit-animation-name:pulse;animation-name:pulse}.animated.flip{-webkit-backface-visibility:visible!important;-webkit-animation-name:flip;-ms-backface-visibility:visible!important;backface-visibility:visible!important;animation-name:flip}.animated.flipInX{-webkit-backface-visibility:visible!important;-webkit-animation-name:flipInX;-ms-backface-visibility:visible!important;backface-visibility:visible!important;animation-name:flipInX}.animated.flipOutX{-webkit-animation-name:flipOutX;-webkit-backface-visibility:visible!important;animation-name:flipOutX;-ms-backface-visibility:visible!important;backface-visibility:visible!important}.animated.flipInY{-webkit-backface-visibility:visible!important;-webkit-animation-name:flipInY;-ms-backface-visibility:visible!important;backface-visibility:visible!important;animation-name:flipInY}.animated.flipOutY{-webkit-backface-visibility:visible!important;-webkit-animation-name:flipOutY;-ms-backface-visibility:visible!important;backface-visibility:visible!important;animation-name:flipOutY}.animated.fadeIn{-webkit-animation-name:fadeIn;animation-name:fadeIn}.animated.fadeInUp{-webkit-animation-name:fadeInUp;animation-name:fadeInUp}.animated.fadeInDown{-webkit-animation-name:fadeInDown;animation-name:fadeInDown}.animated.fadeInLeft{-webkit-animation-name:fadeInLeft;animation-name:fadeInLeft}.animated.fadeInRight{-webkit-animation-name:fadeInRight;animation-name:fadeInRight}.animated.fadeInUpBig{-webkit-animation-name:fadeInUpBig;animation-name:fadeInUpBig}.animated.fadeInDownBig{-webkit-animation-name:fadeInDownBig;animation-name:fadeInDownBig}.animated.fadeInLeftBig{-webkit-animation-name:fadeInLeftBig;animation-name:fadeInLeftBig}.animated.fadeInRightBig{-webkit-animation-name:fadeInRightBig;animation-name:fadeInRightBig}.animated.fadeOut{-webkit-animation-name:fadeOut;animation-name:fadeOut}.animated.fadeOutUp{-webkit-animation-name:fadeOutUp;animation-name:fadeOutUp}.animated.fadeOutDown{-webkit-animation-name:fadeOutDown;animation-name:fadeOutDown}.animated.fadeOutLeft{-webkit-animation-name:fadeOutLeft;animation-name:fadeOutLeft}.animated.fadeOutRight{-webkit-animation-name:fadeOutRight;animation-name:fadeOutRight}.animated.fadeOutUpBig{-webkit-animation-name:fadeOutUpBig;animation-name:fadeOutUpBig}.animated.fadeOutDownBig{-webkit-animation-name:fadeOutDownBig;animation-name:fadeOutDownBig}.animated.fadeOutLeftBig{-webkit-animation-name:fadeOutLeftBig;animation-name:fadeOutLeftBig}.animated.fadeOutRightBig{-webkit-animation-name:fadeOutRightBig;animation-name:fadeOutRightBig}.animated.bounceIn{-webkit-animation-name:bounceIn;animation-name:bounceIn}.animated.slideInDown{-webkit-animation-name:slideInDown;animation-name:slideInDown}.animated.slideInLeft{-webkit-animation-name:slideInLeft;animation-name:slideInLeft}.animated.slideInRight{-webkit-animation-name:slideInRight;animation-name:slideInRight}.animated.slideOutLeft{-webkit-animation-name:slideOutLeft;animation-name:slideOutLeft}.animated.slideOutRight{-webkit-animation-name:slideOutRight;animation-name:slideOutRight}.animated.slideOutUp{-webkit-animation-name:slideOutUp;animation-name:slideOutUp}.animated.bounceInUp{-webkit-animation-name:bounceInUp;animation-name:bounceInUp}.animated.bounceInDown{-webkit-animation-name:bounceInDown;animation-name:bounceInDown}.animated.bounceInLeft{-webkit-animation-name:bounceInLeft;animation-name:bounceInLeft}.animated.bounceInRight{-webkit-animation-name:bounceInRight;animation-name:bounceInRight}.animated.bounceOut{-webkit-animation-name:bounceOut;animation-name:bounceOut}.animated.bounceOutUp{-webkit-animation-name:bounceOutUp;animation-name:bounceOutUp}.animated.bounceOutDown{-webkit-animation-name:bounceOutDown;animation-name:bounceOutDown}.animated.bounceOutLeft{-webkit-animation-name:bounceOutLeft;animation-name:bounceOutLeft}.animated.bounceOutRight{-webkit-animation-name:bounceOutRight;animation-name:bounceOutRight}.animated.rotateIn{-webkit-animation-name:rotateIn;animation-name:rotateIn}.animated.rotateInUpLeft{-webkit-animation-name:rotateInUpLeft;animation-name:rotateInUpLeft}.animated.rotateInDownLeft{-webkit-animation-name:rotateInDownLeft;animation-name:rotateInDownLeft}.animated.rotateInUpRight{-webkit-animation-name:rotateInUpRight;animation-name:rotateInUpRight}.animated.rotateInDownRight{-webkit-animation-name:rotateInDownRight;animation-name:rotateInDownRight}.animated.rotateOut{-webkit-animation-name:rotateOut;animation-name:rotateOut}.animated.rotateOutUpLeft{-webkit-animation-name:rotateOutUpLeft;animation-name:rotateOutUpLeft}.animated.rotateOutDownLeft{-webkit-animation-name:rotateOutDownLeft;animation-name:rotateOutDownLeft}.animated.rotateOutUpRight{-webkit-animation-name:rotateOutUpRight;animation-name:rotateOutUpRight}.animated.rotateOutDownRight{-webkit-animation-name:rotateOutDownRight;animation-name:rotateOutDownRight}.animated.rollIn{-webkit-animation-name:rollIn;animation-name:rollIn}.animated.rollOut{-webkit-animation-name:rollOut;animation-name:rollOut}.animated.lightSpeedIn{-webkit-animation-name:lightSpeedIn;animation-name:lightSpeedIn;-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out;-webkit-animation-duration:.5s;animation-duration:.5s}.animated.lightSpeedOut{-webkit-animation-name:lightSpeedOut;animation-name:lightSpeedOut;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-duration:.25s;animation-duration:.25s}.animated.fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}[class*=" bg-"],[class^=bg-]{-webkit-filter:none!important;filter:none!important}.square{display:block;float:left;margin-right:10px;height:20px;width:20px}.fa-stack-1em{width:1em!important;height:1em!important;line-height:1em!important}.icon-color-good{color:#40ac2b}.icon-color-bad{color:#ed1c24}.percent-sign:after{content:" %";line-height:normal}.degree-sign:after{content:" °F";line-height:normal}.ui-state-default .ui-icon[class*=" icon-"]{background:0;margin-left:-12px}.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-e:before{content:"\f105";font-family:FontAwesome;font-size:14px;display:inline}.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-first,.ui-icon-seek-start{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}.ui-button-icon-primary.ui-icon[class*=" icon-"]:before,.ui-button-icon-primary.ui-icon[class^=icon-]:before,.ui-button-icon-secondary.ui-icon[class*=" icon-"]:before,.ui-button-icon-secondary.ui-icon[class^=icon-]:before{font-size:inherit;margin-left:7px!important;margin-left:5px;display:inline;text-decoration:inherit;color:inherit}@font-face{font-family:'Ubuntu';src:url('./fonts/Ubuntu-C.eot');src:url('./fonts/Ubuntu-C.eot?#iefix') format('embedded-opentype'),url('./fonts/Ubuntu-C.woff') format('woff'),url('./fonts/Ubuntu-C.ttf') format('truetype'),url('./fonts/Ubuntu-C.svg') format('svg');font-weight:normal;font-style:normal}@font-face{font-family:'Ubuntu-Light';src:url('./fonts/Ubuntu-L.eot');src:url('./fonts/Ubuntu-L.eot?#iefix') format('embedded-opentype'),url('./fonts/Ubuntu-L.woff') format('woff'),url('./fonts/Ubuntu-L.ttf') format('truetype'),url('./fonts/Ubuntu-L.svg') format('svg');font-weight:normal;font-style:normal}@font-face{font-family:'Ubuntu-Bold';src:url('./fonts/Ubuntu-B.eot');src:url('./fonts/Ubuntu-B.eot?#iefix') format('embedded-opentype'),url('./fonts/Ubuntu-B.woff') format('woff'),url('./fonts/Ubuntu-B.ttf') format('truetype'),url('./fonts/Ubuntu-B.svg') format('svg');font-weight:bold;font-style:normal}html,body{font-family:Ubuntu,Arial,Helvetica,sans-serif}a:active,a:focus,a:hover,button,button:active,button:focus,embed,input::-moz-focus-inner,object{outline:0}.hidden{display:none}.hidden-desktop{display:none!important}.no-visible{visibility:hidden!important}.pull-right{float:right!Important}.pull-left{float:left!Important}.align-top{vertical-align:top!important}.align-base{vertical-align:baseline!important}.opacity-25{opacity:.25!important}.opacity-50{opacity:.5!important}.opacity-75{opacity:.75!important}.opacity-100,.opaque{opacity:1!important}.disabled{color:#fff}.btn-default.disabled{color:#999}xmp{overflow:auto}.text-italic{font-style:italic!important}.text-dashed{text-decoration:line-through}.nowrap{white-space:nowrap}.truncated{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.no-space{margin:0}.no-space>[class*=col-]{margin:0!important;padding-right:0;padding-left:0}.no-margin{margin:0!important}.no-x-margin{margin-left:0!important;margin-right:0!important}.no-y-margin{margin-top:0!important;margin-bottom:0!important}.margin-2{margin:2px!important}.margin-5{margin:5px!important}.margin-10{margin:10px!important}.margin-20{margin:20px!important}.margin-x-2{margin-left:2px!important;margin-right:2px!important}.margin-x-5{margin-left:5px!important;margin-right:5px!important}.margin-x-10{margin-left:10px!important;margin-right:10px!important}.margin-x-20{margin-left:20px!important;margin-right:20px!important}.margin-y-2{margin-top:2px!important;margin-bottom:2px!important}.margin-y-5{margin-top:5px!important;margin-bottom:5px!important}.margin-y-10{margin-top:10px!important;margin-bottom:10px!important}.margin-y-20{margin-top:20px!important;margin-bottom:20px!important}.margin-top-0{margin-top:0!important}.margin-top-2{margin-top:2px!important}.margin-top-5{margin-top:5px!important}.margin-top-10{margin-top:10px!important}.margin-top-20{margin-top:20px!important}.margin-bottom-0{margin-bottom:0!important}.margin-bottom-2{margin-bottom:2px!important}.margin-bottom-5{margin-bottom:5px!important}.margin-bottom-10{margin-bottom:10px!important}.margin-bottom-20{margin-bottom:20px!important}.margin-left-0{margin-left:0!important}.margin-left-2{margin-left:2px!important}.margin-left-5{margin-left:5px!important}.margin-left-10{margin-left:10px!important}.margin-left-20{margin-left:20px!important}.margin-right-0{margin-right:0!important}.margin-right-2{margin-right:2px!important}.margin-right-5{margin-right:5px!important}.margin-right-10{margin-right:10px!important}.margin-right-20{margin-right:20px!important}.shift-topleft-2{margin-top:-2px!important;margin-left:-2px!important}.shift-topleft-4{margin-top:-4px!important;margin-left:-4px!important}.shift-topright-2{margin-top:-2px!important;margin-right:-2px!important}.shift-topright-4{margin-top:-4px!important;margin-right:-4px!important}.shift-bottomleft-2{margin-bottom:-2px!important;margin-left:-2px!important}.shift-bottomleft-4{margin-bottom:-4px!important;margin-left:-4px!important}.shift-bottomright-2{margin-bottom:-2px!important;margin-right:-2px!important}.shift-bottomright-4{margin-bottom:-4px!important;margin-right:-4px!important}.bordered{border:1px solid #ccc}.bordered:hover{border:1px solid #bbb}.bordered.nohover:hover{border-color:#ccc}.no-border,.well[class*=" bg-"].no-border{border-width:0!important}.no-border-transparent{border-color:transparent!important}.no-border-radius{border-radius:0}.border-0{border-width:0!important}.border-1{border-width:1px!important}.radius-4{border-radius:4px!important}.radius-top-4{border-top-left-radius:4px!important;border-top-right-radius:4px!important}.radius-bottom-4{border-bottom-left-radius:4px!important;border-bottom-right-radius:4px!important}.radius-left-4{border-top-left-radius:4px!important;border-bottom-left-radius:4px!important}.radius-right-4{border-top-right-radius:4px!important;border-bottom-right-radius:4px!important}.width-100{width:100px;max-width:100px}.width-200{width:200px;max-width:200px}.width-300{width:300px;max-width:300px}.width-400{width:400px;max-width:400px}.width-500{width:500px;max-width:500px}.padding-5{padding:5px!important}.padding-7{padding:7px!important}.padding-10{padding:10px!important}.padding-20{padding:20px!important}.padding-x-0{padding-left:0!important;padding-right:0!important}.padding-x-5{padding-left:5px!important;padding-right:5px!important}.padding-x-10{padding-left:10px!important;padding-right:10px!important}.padding-x-20{padding-left:20px!important;padding-right:20px!important}.padding-y-0{padding-top:0!important;padding-bottom:0!important}.padding-y-5{padding-top:5px!important;padding-bottom:5px!important}.padding-y-10{padding-top:10px!important;padding-bottom:10px!important}.padding-y-20{padding-top:20px!important;padding-bottom:20px!important}.padding-top-0{padding-top:0!important}.padding-top-5{padding-top:5px!important}.padding-top-10{padding-top:10px!important}.padding-top-20{padding-top:20px!important}.padding-bottom-0{padding-bottom:0!important}.padding-bottom-5{padding-bottom:5px!important}.padding-bottom-10{padding-bottom:10px!important}.padding-bottom-20{padding-bottom:20px!important}.padding-left-0{padding-left:0!important}.padding-left-5{padding-left:5px!important}.padding-left-10{padding-left:10px!important}.padding-left-20{padding-left:20px!important}.padding-right-0{padding-right:0!important}.padding-right-5{padding-right:5px!important}.padding-right-10{padding-right:10px!important}.padding-right-20{padding-right:20px!important}.no-padding{padding:0!important}.no-padding .md-editor,.widget-body.no-padding .cke_chrome{border:0}.no-padding>pre{margin:30px}.no-padding .dataTables_wrapper table,.no-padding>table{border:0!important;margin-bottom:0!important}.no-padding .dataTables_wrapper table tr td:first-child,.no-padding>table tr td:first-child,.no-padding .dataTables_wrapper table tr th:first-child,.no-padding>table tr th:first-child{border-left:0!important}.no-padding .dataTables_wrapper table tr td:last-child,.no-padding>table tr td:last-child,.no-padding .dataTables_wrapper table tr th:last-child,.no-padding>table tr th:last-child{border-right:0!important}.no-padding .dataTables_wrapper table tr:last-child td,.no-padding>table tr:last-child td{border-bottom:0}.no-padding-bottom{padding-bottom:0!important}.no-x-padding{padding-left:0!important;padding-right:0!important}.no-y-padding{padding-top:0!important;padding-bottom:0!important}.no-content-padding{margin:-10px -14px 0 -14px}@media(min-width:768px) and (max-width:880px){.no-content-padding{margin:0 -14px!important}}@media(max-width:767px){.no-content-padding{margin:0 -5px!important}}@media only screen and (min-width:0) and (max-width:679px){.no-content-padding{margin:0 -5px!important}}@media only screen and (min-width:320px) and (max-width:479px){.no-content-padding{margin:0 -5px!important}}.no-height{line-height:0}.clearfix,.inner-space:after{zoom:1}.clearfix:after,.inner-space:after{clear:both}.clearfix:after,.inner-space:after,.clearfix:before,.inner-space:before{display:block;visibility:hidden;overflow:hidden;content:"\0020";height:0;font-size:0;line-height:0}.display-inline{display:inline-block!important}.display-normal{display:inline!important}.hover-transparent{opacity:.5}.hover-transparent:hover{opacity:1}.row-seperator-header{margin:15px 14px 20px;border-bottom:0;display:block;color:#646464;font-size:20px;font-weight:400}.text-align-center,.text-center{text-align:center!important}.text-align-left,.text-left{text-align:left!important}.text-align-right,.text-right{text-align:right!important}.center-canvas,.center-child-canvas>canvas{display:block!important;margin:0 auto!important}.semi-bold{font-weight:400!important}.bold{font-weight:900!important}.ultra-light{font-weight:300!important}.font-xs{font-size:85%!important}.font-sm{font-size:95%!important}.font-md{font-size:130%!important}.font-lg{font-size:160%!important}.font-xl{font-size:200%!important}.font-400{font-size:400%!important}.badge{font-size:11px;padding:4px 6px 1px}.label{padding:.3em .6em .1em}.cursor-pointer{cursor:pointer}.selected{border:1px solid #0091d9!important}tr.selected{background-color:#dcebff}.selected:before{display:block;position:absolute;content:"\f00c";color:#fff;right:4px;font-family:FontAwesome;z-index:1002}tr.selected:before{display:none}.selected:after{width:0;height:0;border-top:35px solid #0091d9;border-left:35px solid rgba(0,0,0,0);position:absolute;display:block;right:0;content:".";top:0;z-index:1001}tr.selected:after{display:none}html{margin:0;padding:0;height:100%;overflow-x:hidden!important;background-color:#e5e2cf}body{margin:0;padding:0;height:100%;overflow:hidden;background-color:#e5e2cf;direction:ltr}body.container{position:relative;padding:0;border-left:1px solid #bfbfbf;border-right:1px solid #bfbfbf;-webkit-box-shadow:0 2px 70px rgba(0,0,0,0.45);box-shadow:0 2px 70px rgba(0,0,0,0.45)}body.nooverflow{position:fixed;overflow:hidden;width:100%}#main{display:block;margin-left:220px;padding:0;min-height:500px;-webkit-transition:all .1s ease-out;transition:all .1s ease-out}@media(max-width:979px){#main{margin-left:0}}#content{padding:10px;position:relative;left:0;-webkit-transition:left .1s ease-out;transition:left .1s ease-out}@media(max-width:767px){#content{padding-left:5px;padding-right:5px}}.page-title{margin:12px 0 15px}.page-title a:hover,.page-title a:active{text-decoration:none}.page-title span{font-size:16px;color:#333;display:inline-block;vertical-align:1px}.page-title span i{padding:0 5px}aside{display:block;width:220px;overflow:hidden;min-height:100%}aside,aside nav li.divider{background:#829db0}#header{display:block;height:49px;position:relative;margin:0;padding:0 13px 0 0;background-color:#f3f3f3;background-image:-webkit-gradient(linear,0 0,0 100%,from(#f3f3f3),to(#e2e2e2));background-image:-webkit-gradient(linear,top left,bottom left,from(#f3f3f3),to(#e2e2e2));background-image:-webkit-linear-gradient(top,#f3f3f3,#e2e2e2);background-image:linear-gradient(to bottom,#f3f3f3,#e2e2e2);background-repeat:repeat-x}@media(max-width:767px){#header{padding-right:5px}}@media only screen and (max-width:679px){#header{padding-right:5px;background:#fff}}#header>div{display:inline-block;vertical-align:middle;height:49px;float:left}#header>div.open{font-weight:700}.fixed-header #header{position:fixed;width:100%;z-index:1001}.container.fixed-header #header{max-width:1164px}.fixed-header #header .ajax-dropdown{z-index:1000}.fixed-header #shortcut{position:fixed}.fixed-header #main{margin-top:49px}#top-links>div{display:inline-block;float:left}@media(min-width:768px) and (max-width:1089px){#top-links>div{display:none}#top-links>div:first-child{display:inline-block}}@media(max-width:767px){#top-links>div{display:none}}.top-menu{display:inline-block;padding:7px 13px 0;position:relative}@media(max-width:767px){.top-menu{display:none}}.top-menu>span{display:block}.top-menu>:first-child{display:block;color:#bfbfbf;font-size:10px;font-weight:700;text-transform:uppercase;text-shadow:0 0 1px #fff;padding-left:0;text-align:left}.top-tabs{display:inline-block;padding:7px 13px 0;position:relative}.top-tabs>span{display:block}.top-tabs>:first-child{display:block;color:#bfbfbf;font-size:10px;font-weight:700;text-transform:uppercase;text-shadow:0 0 1px #fff;padding-left:5px;text-align:left}.top-tabs .nav-tabs li a{padding:2px 10px 3px!important;border-color:#ccc #ccc transparent;box-shadow:0 -2px 3px #ccc;margin-top:3px!important}.top-tabs .nav-tabs li.active a{margin-top:3px!important;padding:2px 10px 3px!important}.top-selector{max-width:97%;white-space:nowrap;background:0;border:0;padding:0;text-align:left;color:#555;font-size:14px;cursor:pointer}.top-selector:hover{color:#333}@media(max-width:979px){#login-info{display:none}}#login-info>span{display:inline-block;height:39px;float:left}#login-info>span .badge{position:absolute;top:-5px;right:-9px;cursor:pointer;background:#0091d9;display:inline-block;font-size:10px;-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,0.1),inset 0 -1px 0 rgba(0,0,0,0.07);box-shadow:inset 1px 1px 0 rgba(0,0,0,0.1),inset 0 -1px 0 rgba(0,0,0,0.07);color:#fff;font-weight:700;border-radius:50%;padding:3px;text-align:center;line-height:normal}#login-info span#activity{border-radius:2px;cursor:default!important;display:inline-block;font-weight:700;height:24px;width:24px;padding:2px;text-align:center;text-decoration:none!important;-moz-user-select:none;-webkit-user-select:none;background-color:#f8f8f8;background-image:-webkit-gradient(linear,left top,left bottom,from(#f8f8f8),to(#f1f1f1));background-image:-webkit-gradient(linear,top left,bottom left,from(#f8f8f8),to(#f1f1f1));background-image:-webkit-linear-gradient(top,#f8f8f8,#f1f1f1);background-image:linear-gradient(top,#f8f8f8,#f1f1f1);border:1px solid #bfbfbf;color:#c4bab6;font-size:19px;margin:5px 0 0;position:relative}#login-info span#activity:hover{border:1px solid #bfbfbf;-webkit-transition:all 0s;transition:all 0s;cursor:pointer!important;-webkit-box-shadow:inset 0 0 4px 1px rgba(0,0,0,0.08);box-shadow:inset 0 0 4px 1px rgba(0,0,0,0.08)}.authomatic{display:inline-block;width:21px;height:21px;margin:2px 0!important;padding:3px!important;text-align:center}.authomatic:hover{background-color:#ccc;border-radius:3px}#logo{display:inline-block;width:175px;margin-top:7px;margin-left:9px}@media(min-width:768px) and (max-width:880px){#logo{margin-top:10px}}@media(max-width:767px){#logo{margin-top:10px;margin-left:4px}}@media only screen and (min-width:0) and (max-width:679px){#logo{margin-top:10px;margin-left:4px}}@media only screen and (min-width:320px) and (max-width:479px){#logo{width:135px;margin-top:10px;margin-left:4px}}#logo img{max-width:175px;max-height:36px;padding-left:3px}#logo-group{width:220px}@media only screen and (min-width:480px) and (max-width:1089px){#logo-group{width:175px}}@media only screen and (min-width:320px) and (max-width:479px){#logo-group{width:169px!important}}.uv-icon{position:absolute!important;left:155px!important;top:5px!important;z-index:500!important}@media only screen and (min-width:0) and (max-width:1089px){.uv-icon{left:130px!important}}#activity.active .badge{background:#006fa6!important}.header-search{position:relative}@media(max-width:767px){.header-search{display:none}}.header-search.pull-right{margin-left:6px}@media(max-width:979px){.header-search.pull-right{margin-left:0}}.header-search>input[type=text]{display:block;-webkit-box-sizing:border-box;box-sizing:border-box;-moz-box-sizing:border-box;min-width:200px;width:100%;height:30px;padding:0 10px;outline:0;border-width:1px;border-style:solid;border-radius:0;border-color:#bfbfbf;background:#fff;color:#404040;appearance:normal;-moz-appearance:none;-webkit-appearance:none;margin-top:10px;line-height:normal}@media(min-width:768px) and (max-width:979px){.header-search>input[type=text]{margin-top:9px}}.header-search>button{background:0;border:0;color:#6d6a69;font-size:17px;height:30px;line-height:30px;margin:0;padding:0;position:absolute;right:0;top:10px;width:30px;z-index:2}#search-mobile{display:none}@media(max-width:767px){#search-mobile{display:block}}@media only screen and (min-width:0) and (max-width:679px){#search-mobile{display:block}}@media only screen and (min-width:320px) and (max-width:479px){#search-mobile{margin-left:0}}@media(max-width:767px){.search-mobile .header-search{display:block;position:absolute;top:0;width:100%;height:49px;background:#333;padding:0 2px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;left:0}.search-mobile .header-search>input[type=text]{margin-top:2px;height:45px;border-color:#333;padding-right:75px}.search-mobile .header-search>button{height:29px;line-height:29px;background:#DDD;right:44px}.search-mobile #search-mobile{display:none}.search-mobile #cancel-search-js{display:block}}#cancel-search-js{position:absolute;display:none;background:#a90329;z-index:3;color:#fff;padding:0;right:10px;top:10px;text-align:center;height:29px;line-height:29px;width:30px;font-size:17px;text-decoration:none!important}#left-panel{position:absolute;top:49px;left:0;z-index:1002;-webkit-transition:left .1s ease-out;transition:left .1s ease-out}@media(max-width:979px){#left-panel{left:-220px}}.fixed-navigation #left-panel{position:fixed;z-index:998}@media(max-width:767px){.fixed-navigation #left-panel{position:absolute!important}}#left-panel #ajax-gear{position:absolute;left:calc(49%);top:5px}#left-panel .version{position:absolute;bottom:2px;width:100%;text-align:center;font-size:11px;color:#333}#ribbon{height:40px;background:#6f8696;padding:0 40px 0 13px;position:relative}@media(max-width:767px){#ribbon{padding-left:5px;padding-right:5px}}@media only screen and (min-width:0) and (max-width:679px){#ribbon{border-bottom:1px solid #cfcfcf;border-top:1px solid #e6e6e6;background:#f5f5f5}}#ribbon .breadcrumb{display:inline-block;margin:0;padding:12px 34px 10px 0!important;background:0;vertical-align:top}#ribbon .breadcrumb,#ribbon .breadcrumb a{color:#ddd!important;text-decoration:none!Important}@media only screen and (min-width:0) and (max-width:679px){#ribbon .breadcrumb,#ribbon .breadcrumb a{color:#6d6c6c!important}}#ribbon .breadcrumb>li+li:before{padding:0 1px 0 5px}#ribbon .breadcrumb li:last-child,#ribbon .breadcrumb>.active{color:#eee}@media only screen and (min-width:0) and (max-width:679px){#ribbon .breadcrumb li:last-child,#ribbon .breadcrumb>.active{color:#333!important}}.fixed-ribbon #ribbon{position:fixed;right:0;left:220px;top:49px;z-index:999}@media(max-width:979px){.fixed-ribbon #ribbon{left:0}}.container.fixed-ribbon #ribbon{width:944px;left:590px}.fixed-ribbon #content{padding-top:50px}@media(max-width:767px){.fixed-ribbon #content{padding-top:52px}}.minified.fixed-ribbon #ribbon{left:45px}.hidden-menu.fixed-ribbon #ribbon{left:10px}@media(max-width:979px){.hidden-menu.fixed-ribbon #ribbon{left:220px}}.hidden-ribbon #ribbon{height:1px;min-height:1px;max-height:1px}.hidden-ribbon #ribbon>*{display:none}.ribbon{position:absolute;right:9px;top:-4px}.header-dropdown-list{list-style:none;float:right;position:relative;margin:0;padding-left:10px}.header-dropdown-list>li{display:inline-block;padding-right:5px}.header-dropdown-list>li>.dropdown-toggle{margin-top:16px;display:block}.smart-accordion-default.panel-group .panel+.panel{margin-top:-1px}.smart-accordion-default.panel-group .panel-heading{padding:0}.smart-accordion-default.panel-group .panel-title a{display:block;padding:10px 15px;text-decoration:none!important}.smart-accordion-default .panel-group .panel,.smart-accordion-default .panel-heading{border-radius:0}.smart-accordion-default .panel-default{border-color:#c3c3c3}.smart-accordion-default .panel-default>.panel-heading{background-color:#fcfcfc}.smart-accordion-default .panel-title>a.collapsed>.fa,.smart-accordion-default .panel-title>a>:first-child{display:none}.smart-accordion-default .panel-title>a.collapsed>:first-child{display:inline-block}.no-padding .smart-accordion-default>div{border-left:0!important;border-right:0!important}.no-padding .smart-accordion-default>div:first-child{border-top:0!important}.no-padding .smart-accordion-default>div:last-child{border-bottom:0!important}#logo-group *,.login-info,.login-info *,.minified .menu-item-parent{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.login-info{display:block;font-size:12px;height:39px;color:#333;border:solid transparent;margin:2px 0 0 10px!important;float:right}.login-info a,.login-info strong{text-transform:capitalize;font-size:14px;display:inline-block;color:#333;text-decoration:none;margin-left:5px}.login-info a:hover,.login-info strong{color:#666}.login-info a.btn{margin-top:5px}.login-info a.btn-danger,.login-info a.btn-success,.login-info a.btn-primary{color:#dedede}.login-info span{display:inline-block;padding:0 0 0 10px}.login-info span a.btn-success{margin-top:-10px}.login-info img{width:25px;height:auto;display:inline-block;vertical-align:middle;margin-top:-3px;margin-right:7px;margin-left:0;border-left:3px solid #fff}.minifyme{border-bottom:1px solid #302f2f;background:#454545;color:#a8a8a8;text-align:center;padding:1px 0 0;width:36px;height:28px;display:block;position:absolute;right:-3px;border-radius:5px 0 0 5px;cursor:pointer;margin-top:5px;font-size:19px;-webkit-transition:all .1s linear 0s;transition:all .1s linear 0s}.minifyme:hover{background:#646464;color:#e4e4e4;right:0}.minified .minifyme{right:0;color:#a8a8a8;position:relative;width:100%;border-radius:0;margin:0;height:32px;font-size:23px}.minified .minifyme .fa:before{content:"\f0a9"}.minified #left-panel{width:45px;overflow:visible}@media(max-width:979px){.minified #left-panel{left:0}}.minified #main{margin-left:45px}.minified #left-panel>ul>li,.minified nav>ul>li{overflow:visible}.minified #left-panel>ul>li>ul::before,.minified nav>ul>li>ul::before{border-left:0}.minified #left-panel>ul>li,.minified nav>ul>li,.minified #left-panel>ul>li a,.minified nav>ul>li a{position:relative}.minified #left-panel ul>li>a,.minified nav ul>li>a{padding:12px 11px 10px;display:block}.minified #left-panel>ul>li>a .fa.fa-fw,.minified nav>ul>li>a .fa.fa-fw{display:block;width:auto;text-align:center;padding:0}.minified #left-panel>ul>li>a>i,.minified nav>ul>li>a>i{text-align:center;margin:0;display:block}.minified #left-panel>ul>li.active>a::before,.minified nav>ul>li.active>a::before{content:"\f0d9"}.minified #left-panel ul ul li a,.minified nav ul ul li a{padding-top:5px;padding-bottom:5px;padding-left:14px}.minified #left-panel ul ul li li a,.minified nav ul ul li li a{padding-left:25px}.minified #left-panel>ul ul li::before,.minified nav>ul ul li::before,.minified #left-panel>ul>li>ul::before,.minified nav>ul>li>ul::before{left:12px}.minified #left-panel>ul>li>a .menu-item-parent,.minified nav>ul>li>a .menu-item-parent,.minified #left-panel>ul>li>a>b,.minified nav>ul>li>a>b{display:none}.minified #left-panel>ul>li>a>.menu-item-parent,.minified nav>ul>li>a>.menu-item-parent{display:none;position:absolute;left:40px;top:-3px;width:186px;height:36px;line-height:38px;background-color:#f5f5f5;color:#333;z-index:3;-webkit-box-shadow:2px 1px 2px 0 rgba(0,0,0,0.2);box-shadow:2px 1px 2px 0 rgba(0,0,0,0.2);border-left:1px solid #bfbfbf;border-top:1px solid #d8d4d4;border-bottom:1px solid #fff;padding-left:12px}.minified #left-panel>ul>li>ul,.minified nav>ul>li>ul{display:none!important;position:absolute;left:40px;width:200px;z-index:5;border:1px solid #bfbfbf;min-height:180px;-webkit-box-shadow:1px 1px 2px 0 rgba(0,0,0,0.2);box-shadow:1px 1px 2px 0 rgba(0,0,0,0.2);background:#627685;margin-top:-3px}.minified #left-panel ul>li>ul>li>ul,.minified nav ul>li>ul>li>ul{position:relative;left:13px;border:0;margin-left:-12px;width:197px}.minified #left-panel>ul>li:hover>a>.menu-item-parent,.minified nav>ul>li:hover>a>.menu-item-parent,.minified #left-panel>ul>li:hover>ul,.minified nav>ul>li:hover>ul{display:block!important}.minified #left-panel>ul>li>ul>li,.minified nav>ul>li>ul>li{background-color:rgba(91,103,113,0.8)}.minified #left-panel>ul>li>ul>li>ul>li,.minified nav>ul>li>ul>li>ul>li{background-color:#627685}.minified #left-panel>ul>li>ul>li>a,.minified nav>ul>li>ul>li>a,.minified #left-panel>ul>li>ul>li>ul>li>a,.minified nav>ul>li>ul>li>ul>li>a{padding-top:7px;padding-bottom:7px}.minified #left-panel>ul>li>ul>li>ul>li a,.minified nav>ul>li>ul>li>ul>li a{padding-top:6px;padding-bottom:6px}.minified #left-panel>ul>ul,.minified nav>ul>ul{min-height:100px!important;max-height:180px!important;overflow-y:scroll;overflow-x:hidden;background:#ed1c24!important}.minified #left-panel>ul ul li::before,.minified nav>ul ul li::before{border:0}.minified #left-panel ul ul ul ul li a,.minified nav ul ul ul ul li a{padding-left:45px}.minified #left-panel ul ul ul ul ul li a,.minified nav ul ul ul ul ul li a{padding-left:62px}.minified #left-panel ul ul ul ul ul ul li a,.minified nav ul ul ul ul ul ul li a{padding-left:82px}.minified #left-panel .version{display:none}.minified .slimScrollDiv,.minified .slimScrollDiv>:first-child{overflow:visible!important}.minified .slimScrollBar,.minified .slimScrollRail{display:none}.slimScrollDiv,.slimScrollDiv>:first-child{overflow:hidden}@media(max-width:979px){#hide-menu i,#logout i{color:#6d6a69;font-size:100%}}@media(min-width:0) and (max-width:880px){#hide-menu i,#logout i{font-size:121%}}.hidden-menu #left-panel{left:-210px;z-index:1002}@media(max-width:979px){.hidden-menu #left-panel{left:0}}.hidden-menu #left-panel:hover{left:0}.hidden-menu #main{margin-left:10px}.minified.hidden-menu #main{margin-left:0}@media(max-width:979px){.hidden-menu #main{position:relative;left:210px}}@media(max-width:979px){.hidden-menu #hide-menu i{color:#fff}}@media(min-width:768px) and (max-width:880px){.hidden-menu #hide-menu i::before{content:"\f0c9"}}@media(max-width:767px){.hidden-menu #hide-menu i{color:#fff}.hidden-menu #hide-menu i::before{content:"\f0c9"}}.hidden-menu #hide-menu>:first-child>a{background-color:#e8e8e8;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#5a5a5a),color-stop(100%,#686868));background-image:-webkit-linear-gradient(to bottom,#5a5a5a 0,#686868 100%);background-image:-webkit-gradient(linear,top left,bottom left,from(#5a5a5a),to(#686868));background-image:-webkit-linear-gradient(top,#5a5a5a 0,#686868 100%);background-image:linear-gradient(to bottom,#5a5a5a 0,#686868 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5A5A5A',endColorstr='#686868',GradientType=0);color:#fff;border-color:#494949;-webkit-box-shadow:inset 0 0 3px 1px rgba(0,0,0,0.15);box-shadow:inset 0 0 3px 1px rgba(0,0,0,0.15)}@media(min-width:768px) and (max-width:979px){.hidden-menu #hide-menu>:first-child>a{margin-top:9px;width:40px}}.hidden-menu #hide-menu>:first-child>a:active{-webkit-box-shadow:inset 0 0 6px 1px rgba(0,0,0,0.2);box-shadow:inset 0 0 6px 1px rgba(0,0,0,0.2)}.hidden-menu .minifyme,.minified #hide-menu{display:none}.no-menu #left-panel{left:-220px;z-index:0}.no-menu #main{margin-left:0}.no-menu #hide-menu{display:none}#shortcut{position:absolute;top:0;left:0;height:auto;width:100%;background-color:#33302f;background-color:rgba(0,0,0,0.85);z-index:1009;display:none;color:#fff;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#shortcut ul{padding:15px 20px 10px;list-style:none;margin:0;-webkit-box-shadow:0 4px 10px rgba(0,0,0,0.3);box-shadow:0 4px 10px rgba(0,0,0,0.3);border-bottom:1px solid #423f3f}#shortcut ul li{display:inline-block;width:auto}#shortcut ul li .ams-metro-tile{margin:0 3px 3px;border:0;border-radius:0}#shortcut ul li .ams-metro-tile:hover{color:#fff;text-decoration:none}#shortcut ul li .ams-metro-tile:active,#shortcut ul li .ams-metro-tile:focus{left:0;top:0}#shortcut .version{position:absolute;right:10px;bottom:10px}.shortcut-on #response-btn{display:none!important}.shortcut-on #left-bar .navbar,.shortcut-on #main .navbar{border:0!important}#sparks{display:block;list-style:none;margin:10px 0 0;padding:0;text-align:right}@media only screen and (min-width:320px) and (max-width:479px){#sparks{text-align:center;background:#e0e0e0;padding:10px 0;margin-bottom:15px}}#sparks li{display:inline-block;border-left:1px dotted #c7c7c7;padding:0 10px;max-height:47px;overflow:hidden;text-align:left;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box}@media only screen and (min-width:320px) and (max-width:479px){#sparks li{padding:0 10px 0 20px}}#sparks li:last-child{padding-right:0}#sparks li:first-child{border-left:0;padding-left:0}#sparks li h5{color:#555;float:left;font-size:11px;font-weight:400;margin:-3px 0 0 0;padding:0;border:0;text-transform:uppercase}#sparks li span{color:#636363;display:block}.sparks-info{min-width:70px}.sparks-info span{font-size:18px;line-height:20px;margin:0;text-transform:none}.sparks-info .sparkline{display:block;float:right;margin:3px 0 0 20px}#heat-fill{display:block;position:relative;margin-bottom:20px;background:#333;height:7px;width:200px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAAABCAIAAAAU3Xa1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0IDc5LjE1MTQ4MSwgMjAxMy8wMy8xMy0xMjowOToxNSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDowMDE4MkZGMzMzOTgxMUUzODZBQUNFQUNFOTk0NEUxRiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowMDE4MkZGNDMzOTgxMUUzODZBQUNFQUNFOTk0NEUxRiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjAwMTgyRkYxMzM5ODExRTM4NkFBQ0VBQ0U5OTQ0RTFGIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjAwMTgyRkYyMzM5ODExRTM4NkFBQ0VBQ0U5OTQ0RTFGIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+rG8MDAAAAM5JREFUeNpUUtESwyAIg8ft9v8/W4ElBPWKV1AIiKEeEWVuVlWjINSVONBnirQDxukNgcuyTQsBzLHMDsLIQQw+nIL71JqNJ5GZJXApFNpmtlagQjfS2xGbkFA4Iwu+hu0sK3Wl3nOwNv7TvPrWk3X0eW9dK1pU9hK2eTuWb2ySJmlziutA3iBxmblPNvA5PNsuUpoDY80+Z0SW1IRpDEqwC58C14tsr1f8le8si0aojdADr/1UjaclsFashX8GGkL9wDxtRsV6ft/PX4ABADRzhOVIOJaAAAAAAElFTkSuQmCC)}.fill-a,.fill-b{width:20px;text-align:right;overflow:hidden;text-overflow:ellipsis;display:block;background:#fff;padding-right:4px;position:absolute;left:0;margin-top:-7px;font-weight:700}.fill-b{text-align:left;position:absolute;right:0;left:auto;top:0;width:60px;padding-left:4px;padding-right:0}.cke_top{background:rgba(248,248,248,0.9)!important;background-image:none!important}.MessageBox{width:100%;height:100%;position:fixed;top:0;left:0;background:rgba(0,0,0,0.6);z-index:100000}@media screen and (max-width:450px) and (max-width:767px){.MessageBox{width:100%;height:100%;position:fixed;top:0;left:0;background:rgba(0,0,0,0.6);z-index:100000}}.MessageBoxContainer{top:35%;color:#fff;position:relative;width:100%;background-color:#232323;background-color:rgba(0,0,0,0.8);padding:20px}@media screen and (max-width:450px) and (max-width:767px){.MessageBoxContainer{top:25%;color:#fff;position:relative;width:100%;background-color:#232323}}.MessageBoxContainer input,.MessageBoxContainer select{width:50%;padding:5px}@media screen and (max-width:450px) and (max-width:767px){.MessageBoxContainer input,.MessageBoxContainer select{width:50%;padding:5px}}.MessageBoxMiddle{position:relative;left:20%;width:60%}@media screen and (max-width:450px) and (max-width:767px){.MessageBoxMiddle{position:relative;left:0;width:100%;padding:3px}}.MessageBoxMiddle .MsgTitle{letter-spacing:-1px;font-size:24px;font-weight:300}@media screen and (max-width:450px) and (max-width:767px){.MessageBoxMiddle .MsgTitle{font-size:22px}}.MessageBoxMiddle .pText{font-style:30px}@media screen and (max-width:450px) and (max-width:767px){.MessageBoxMiddle{font-style:10px}}.MessageBoxButtonSection{width:100%;height:30px}@media screen and (max-width:450px) and (max-width:767px){.MessageBoxButtonSection{width:100%;height:30px}}.MessageBoxButtonSection button{float:right;margin-right:7px;padding-left:15px;padding-right:15px;font-size:14px;font-weight:700}@media screen and (max-width:450px) and (max-width:767px){.MessageBoxButtonSection button{float:right;margin-right:5px;padding-left:15px;padding-right:15px}}.LoadingBoxContainer{top:20%;color:#fff;position:relative;width:100%;background-color:#232323}.LoadingBoxContainer .MsgTitle{font-size:26px}.LoadingBoxContainer .pText{font-style:30px}.LoadingBoxMiddle{position:relative;left:20%;width:50%;padding:10px}#LoadingPoints{position:absolute}#divMiniIcons{position:fixed;width:415px;right:10px;bottom:180px;z-index:9999;float:right}#divMiniIcons .cajita{text-align:center;vertical-align:middle;padding:4px 6px;color:#FFF;float:right;cursor:pointer;display:block;background-color:red;font-size:17px;margin-left:4px;margin-top:5px}#divMiniIcons .cajita:active{top:1px;left:1px;position:relative}#divSmallBoxes{position:fixed;right:0;top:0;z-index:9999}@media screen and (max-width:450px) and (max-width:767px){#divSmallBoxes{position:fixed;width:90%;right:0;top:0}}.BigBox{position:fixed;right:10px;bottom:10px;background-color:#004d60;padding:10px 10px 5px;width:390px;height:150px;color:#fff;z-index:99999;box-sizing:content-box;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;border-left:5px solid rgba(0,0,0,0.15);overflow:hidden}.BigBox span{font-size:17px;font-weight:300;letter-spacing:-1px;padding:5px 0!important;display:block}.BigBox p{font-size:13px;margin-top:10px}@media screen and (max-width:450px) and (max-width:767px){.BigBox{width:88%}}.BigBox .bigboxicon{font-size:30px;text-align:left;position:absolute;top:120px;left:6px;z-index:0}.BigBox .bigboxnumber{width:100%;text-align:right;font-size:25px}.SmallBox{position:absolute;right:5px;top:20px;width:420px;color:#fff;z-index:9999;overflow:hidden;border:1px solid transparent}@media screen and (max-width:450px) and (max-width:767px){.SmallBox{width:95%}}.SmallBox:hover{border:1px solid #fff;cursor:pointer}@media screen and (max-width:450px) and (max-width:767px){.SmallBox:hover{-webkit-box-shadow:0 0 10px #888;box-shadow:0 0 10px #888;cursor:pointer}}.SmallBox .foto{font-size:30px;position:absolute;left:20px}.SmallBox .textoFull{width:93%;float:left;padding-left:20px}@media screen and (max-width:450px) and (max-width:767px){.SmallBox .textoFull{width:93%;float:left;padding-left:20px}}.SmallBox .textoFoto{width:78%;margin:3px 20px 3px 80px;float:left}@media screen and (max-width:450px) and (max-width:767px){.SmallBox .textoFoto{width:55%;margin:3px 20px 3px 80px;float:left}}.SmallBox span{font-size:17px;font-weight:300;letter-spacing:-1px;display:block;margin:4px 0}@media screen and (max-width:450px) and (max-width:767px){.SmallBox span{font-size:16px}}.SmallBox p{font-size:13px;margin-top:2px}@media screen and (max-width:450px) and (max-width:767px){.SmallBox p{font-size:12px;margin-top:2px}}.btnClose{position:absolute;right:10px;height:16px;width:15px;cursor:pointer;font-size:18px;opacity:.5;display:block;top:15px}.btnClose:hover{opacity:1}.miniPic{position:absolute;bottom:8px;right:9px}.miniIcon{height:100%;font-size:20px}nav{padding-top:40px}nav ul{width:100%;padding:40px 28px 25px 0;padding:0;margin:0;font-size:13px;line-height:.5em;list-style:none;position:relative;background-color:#627685}nav ul li{overflow:hidden}nav ul li.divider{height:20px;border:0}nav ul li.header{font-family:"Ubuntu-Light",Arial,Helvetica,sans-serif;font-size:14px;font-weight:bold;color:#eee;background-color:#b13510;border-top-color:#d44918;border-bottom-color:#a13812;padding:4px 10px 4px 20px;line-height:18px}nav ul li.header:not(:first-child){margin-top:10px}.minified #left-panel nav ul li.header{padding:5px;color:#b94015;line-height:0;max-height:10px;overflow:hidden}nav ul li a{line-height:normal;font-size:14px;padding:10px 10px 10px 11px;color:#f4e8cf;display:block;font-weight:400;text-decoration:none!important;position:relative}nav ul li a:active{background:#616161!important}nav ul li a:focus{color:#c9c9c9}nav ul li a:hover{color:#fff;text-decoration:none}nav ul li.active>a{background-color:#627685;color:#fff!important;position:relative}nav ul li.active>a:before{content:"\f0d9";font-family:FontAwesome;display:block;height:27px;line-height:14px;width:27px;position:absolute;right:-21px;font-size:20px;color:#eee}nav ul li.active.open>a:before{content:""}nav ul li.active.open>a.active:before{content:"\f0d9"}nav ul li li{border-bottom:0;position:relative}nav ul .active>a{color:#fefefe!important;position:relative}nav ul b{float:right;font-size:14px;margin-top:-1px}nav ul span.menu-item-parent{display:inline-block;margin:0;padding:0}nav ul ul{margin:0;display:none;background:rgba(91,103,113,0.8);padding:7px 0}nav ul ul>li:hover b{color:#d5d9e2}nav ul ul li{margin:0;padding:0}nav ul ul li>a{padding-left:42px;font-size:12px;font-weight:400;outline:0}nav ul ul li>a:hover{background-color:#46545e;color:#fff}nav ul ul li>a.active{margin-left:30px;padding-left:12px;background-color:#296191}.minified nav ul ul li>a.active{margin-left:0}nav ul ul ul{background:0;padding:0}nav ul ul ul li a{color:#bfbfbf;padding:8px 10px 8px 60px;font-size:11px}nav ul ul ul li a:hover{background-color:#46545e;color:#fff}nav ul ul ul li a.active{margin-left:50px;padding-left:10px}nav ul ul ul ul li a{padding-left:90px}nav ul ul ul ul li a.active{margin-left:80px;padding-left:10px}nav ul ul ul ul ul li a{padding-left:110px}nav ul ul ul ul ul li a.active{margin-left:100px;padding-left:10px}nav ul ul ul ul ul ul li a{padding-left:130px}nav ul ul ul ul ul ul li a.active{margin-left:120px;padding-left:10px}nav ul ul b{color:#b3b3b3}nav>ul>li{border-top:1px solid #718999;border-bottom:1px solid #576975}nav>ul>li:hover>ul::before,nav>ul>li:hover>ul>li::before{border-color:#acacac!important}nav>ul>li>a>.badge.pull-right{margin-right:15px}nav>ul>li>a b{position:absolute!important;right:10px;top:10px}nav>ul>li>a>i{margin-right:5px;width:15px;display:inline-block;text-align:center;position:relative}nav>ul>li>a>i>em{font-size:9px;display:block;padding:2px;position:absolute;top:-8px;right:-6px;text-decoration:none;font-style:normal;background:#ed1c24;color:#fff;min-width:13px;border-radius:50%;max-height:13px;line-height:8px;font-weight:700;vertical-align:baseline;white-space:nowrap;text-align:center;border:1px solid rgba(255,255,255,0.1)}nav>ul>li>ul::before{content:"";display:block;position:absolute;z-index:1;left:23px;top:0;bottom:0;border-left:1px solid #7a7a7a}nav>ul>li>ul>li>a,nav>ul>li>ul>li>ul>li>a{padding-top:5px;padding-bottom:5px}nav>ul ul li a i{font-size:14px!important;width:18px!important;text-align:center!important}nav>ul ul li::before{content:"";display:block;position:absolute;width:8px;left:23px;top:13px;border-top:1px solid #7a7a7a;z-index:1}nav>ul ul ul li::before{content:"";display:block;position:absolute;width:18px;left:10px;top:17px;border-top:1px solid transparent}@media(min-width:768px){.navbar-nav>li>a{padding-top:17px;padding-bottom:15px}}.ui-menu{display:block;width:155px;padding:2px;-webkit-box-shadow:0 2px 4px rgba(30,30,100,0.25);box-shadow:0 2px 4px rgba(30,30,100,0.25);background:#fff;border:1px solid rgba(0,0,0,0.2);z-index:1;list-style:none;margin:0;margin-bottom:2em;outline:0}.ui-menu .ui-menu{margin-top:-3px;position:absolute;list-style:none}.ui-menu .ui-menu-item{margin:0;padding:0;width:100%;list-style:none;list-style-image:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}.ui-menu .ui-menu-item a{text-decoration:none;display:block;padding:2px .4em;line-height:1.5;min-height:0;font-weight:400}.ui-menu .ui-menu-item a.ui-corner-all{border-radius:0}.ui-menu .ui-menu-item a.ui-state-active,.ui-menu .ui-menu-item a.ui-state-focus,.ui-menu .ui-menu-item a.ui-widget-content{font-weight:700;margin:0;background-color:#428bca;border-color:#357ebd;color:#FFF;display:block;white-space:nowrap}.ui-menu .ui-menu-item a.ui-state-active{padding:1px .4em}.ui-menu .ui-menu-item a .ui-menu-icon{width:auto;height:auto;top:0;left:auto;right:auto;bottom:auto;text-indent:0}.ui-menu .ui-menu-divider{margin:5px -2px 5px -2px;height:0;font-size:0;line-height:0;border-width:1px 0 0}.ui-menu .ui-state-disabled{margin:.4em 0 .2em!important;background:none!important;color:#999!important;font-weight:400!important;cursor:default;line-height:1.5}.ui-menu .ui-state-disabled a{cursor:default}.ui-menu .ui-menu-icons{position:relative}.ui-menu .ui-menu-icons .ui-menu-item a{position:relative;padding-left:2em}.ui-menu .ui-icon{position:absolute;top:.2em;left:.2em}.ui-menu .ui-menu-icon{position:static;float:right}.dropdown-menu>li>a:hover{background-color:#e0e0e0}.open>.dropdown-menu{-webkit-animation-name:flipInX;animation-name:flipInX;-webkit-animation-duration:.4s;animation-duration:.4s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.dropdown-menu .small.divider{margin:3px 0}.dropdown-menu-xs{min-width:37px}.dropdown-menu-xs>li>a{padding:3px 10px}.dropdown-menu-xs>li>a:hover i{color:#fff!important}.dropdown-submenu{position:relative}.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px}.dropdown-submenu:hover>.dropdown-menu{display:block}.dropdown-submenu>a:after{display:block;content:" ";float:right;width:0;height:0;border-color:transparent;border-style:solid;border-width:5px 0 5px 5px;border-left-color:#bfbfbf;margin-top:5px;margin-right:-10px}.dropdown-submenu:hover>a:after{border-left-color:#fff}.dropdown-submenu.pull-left{float:none}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:10px}.ajax-dropdown{position:absolute;display:none;z-index:1003;top:48px;left:16px;width:344px;height:435px;border-radius:0;-webkit-box-shadow:0 2px 4px rgba(30,30,100,0.25);box-shadow:0 2px 4px rgba(30,30,100,0.25);padding:10px;background:#fff;border:1px solid #b3b3b3}@media only screen and (min-width:320px) and (max-width:479px){.ajax-dropdown{width:299px;height:320px;left:0;top:49px}}.ajax-dropdown:after,.ajax-dropdown:before{bottom:100%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}.ajax-dropdown:before{border-color:rgba(131,131,131,0);border-bottom-color:#838383;border-width:8px;left:50%;margin-left:-8px}@media only screen and (min-width:320px) and (max-width:479px){.ajax-dropdown:before{margin-left:-14px}}.ajax-dropdown:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:7px;left:50%;margin-left:-7px}@media only screen and (min-width:320px) and (max-width:479px){.ajax-dropdown:after{margin-left:-13px}}.ajax-dropdown>:last-child{font-size:13px;display:block;padding:5px 0;line-height:22px;font-weight:400}.ajax-dropdown>:first-child{margin:0 0 3px;padding:0 0 9px}.ajax-dropdown .fa-4x.fa-border{border-width:3px;border-radius:50%;display:block;margin:0 auto;width:46px;text-align:center;color:#d1d1d1;border-color:#d1d1d1}.ajax-dropdown .btn-group .btn{font-weight:700;text-transform:capitalize}.ajax-dropdown .btn-group>:nth-child(2){border-right-width:0;border-left-width:0}.ajax-dropdown .btn-group .btn:active{top:0;left:0}.active+.ajax-dropdown{-webkit-animation-name:flipInY;animation-name:flipInY;-webkit-animation-duration:.7s;animation-duration:.7s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.dropdown-large{position:static!important}.dropdown-menu-large{margin-left:16px;margin-right:16px;padding:20px 0}.dropdown-menu-large>li>ul{padding:0;margin:0}.dropdown-menu-large>li>ul>li{list-style:none}.dropdown-menu-large>li>ul>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.428571429;color:#333;white-space:normal}.dropdown-menu-large>li ul>li>a:focus,.dropdown-menu-large>li ul>li>a:hover{text-decoration:none;color:#262626;background-color:#f5f5f5}.dropdown-menu-large .disabled>a,.dropdown-menu-large .disabled>a:focus,.dropdown-menu-large .disabled>a:hover{color:#999}.dropdown-menu-large .disabled>a:focus,.dropdown-menu-large .disabled>a:hover{text-decoration:none;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);cursor:not-allowed}.dropdown-menu-large .dropdown-header{color:#428bca;font-size:18px}@media(max-width:768px){.dropdown-menu-large{margin-left:0;margin-right:0}.dropdown-menu-large>li{margin-bottom:30px}.dropdown-menu-large>li:last-child{margin-bottom:0}.dropdown-menu-large .dropdown-header{padding:3px 15px!important}}.wijmo-wijmenu{padding:0 20px;background-color:#222;background-repeat:repeat-x;background-image:-webkit-gradient(linear,top left,bottom left,from(#333),to(#222));background-image:-webkit-linear-gradient(top,#333,#222);background-image:linear-gradient(top,#333,#222);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333',endColorstr='#222222',GradientType=0);-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.25),inset 0 -1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 3px rgba(0,0,0,0.25),inset 0 -1px 0 rgba(0,0,0,0.1)}.wijmo-wijmenu .ui-state-default .wijmo-wijmenu-text{color:#bfbfbf}.wijmo-wijmenu .ui-state-hover{background:#444;background:rgba(255,255,255,0.05)}.wijmo-wijmenu .ui-state-hover .wijmo-wijmenu-text{color:#fff}.wijmo-wijmenu .ui-widget-header h3{position:relative;margin-top:1px;padding:0}.wijmo-wijmenu h3 a{color:#fff;display:block;float:left;font-size:20px;font-weight:200;line-height:1;margin-left:-20px;margin-top:1px;padding:8px 20px 12px}.wijmo-wijmenu h3 a:hover{background-color:rgba(255,255,255,0.05);color:#fff;text-decoration:none}.wijmo-wijmenu .ui-widget-header{border:0}.wijmo-wijmenu .wijmo-wijmenu-parent .wijmo-wijmenu-child{padding:.3em 0}.wijmo-wijmenu .wijmo-wijmenu-item{margin:0;border:0}.wijmo-wijmenu .wijmo-wijmenu-item .wijmo-wijmenu-child{background:#333;border:0;margin:0;padding:6px 0;width:160px;border-radius:0 0 6px 6px;-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.2);box-shadow:0 2px 4px rgba(0,0,0,0.2)}.wijmo-wijmenu a.wijmo-wijmenu-link{margin:0;line-height:19px;padding:10px 10px 11px;border:0;border-radius:0}.wijmo-wijmenu .wijmo-wijmenu-child .wijmo-wijmenu-link{display:block;float:none;padding:4px 15px;width:auto}.wijmo-wijmenu .wijmo-wijmenu-child .wijmo-wijmenu-text{float:none}.wijmo-wijmenu .wijmo-wijmenu-item .wijmo-wijmenu-child .ui-state-hover{background:#191919}.wijmo-wijmenu .wijmo-wijmenu-item .wijmo-wijmenu-separator{padding:5px 0;background-image:none;background-color:#222;border-top:1px solid #444;border-bottom:0;border-left:0;border-right:0}.wijmo-wijmenu .wijmo-wijmenu-item input{-moz-transition:none 0s ease 0s;background-color:rgba(255,255,255,0.3);border:1px solid #111;border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.1) inset,0 1px 0 rgba(255,255,255,0.25);box-shadow:0 1px 2px rgba(0,0,0,0.1) inset,0 1px 0 rgba(255,255,255,0.25);color:rgba(255,255,255,0.75);font-family:Ubuntu,Helvetica,Arial,sans-serif;line-height:1;margin:5px 10px 0;padding:4px 9px;width:100px}.wijmo-wijmenu .wijmo-wijmenu-item input:hover{background-color:rgba(255,255,255,0.5);color:#fff}.wijmo-wijmenu .wijmo-wijmenu-item input:focus{background-color:#fff;border:0 none;-webkit-box-shadow:0 0 3px rgba(0,0,0,0.15);box-shadow:0 0 3px rgba(0,0,0,0.15);color:#404040;outline:0 none;padding:5px 10px;text-shadow:0 1px 0 #fff}.wijmo-wijmenu .ui-state-default{text-shadow:none;-webkit-box-shadow:none;box-shadow:none;color:#bfbfbf;-webkit-filter:none;filter:none}.tabs-below>.nav-tabs,.tabs-left>.nav-tabs,.tabs-right>.nav-tabs{border-bottom:0}.nav-tabs.bordered{background:#fff;border:1px solid #ddd}.nav-tabs.bordered>:first-child a{border-left-width:0!important}.nav-tabs.bordered+.tab-content{border:1px solid #ddd;border-top:0}.nav-tabs>li>a{padding:4px 10px;border-radius:0;color:#333}.nav-tabs>li>a.xsmall{line-height:1.0;padding:3px 8px}.nav-tabs>li>a .label{display:inline-block;font-size:11px;margin-left:5px;opacity:.5}.nav-tabs>li>a .badge{font-size:11px;padding:4px 5px 2px;opacity:.5;margin-left:5px;min-width:17px;font-weight:400}.tabs-left .nav-tabs>li>a .badge{margin-right:5px;margin-left:0}.nav-tabs>li>a>.fa{opacity:.5}.nav-tabs.small>li>a{padding:2px 8px;font-size:90%}.nav-tabs.tiny>li>a{padding:1px 6px;font-size:75%}.nav-tabs>li.active>a{-webkit-box-shadow:0 -2px 0 #3276b1;box-shadow:0 -2px 0 #3276b1;border-top-width:0!important;margin-top:1px!important;font-weight:700}.nav-tabs>li.active>a .badge,.nav-tabs>li.active>a .label,.nav-tabs>li.active>a>.fa{opacity:1}.tabs-left .nav-tabs>li.active>a{-webkit-box-shadow:-2px 0 0 #3276b1;box-shadow:-2px 0 0 #3276b1;border-top-width:1px!important;border-left:0!important;margin-left:1px!important}.tabs-right .nav-tabs>li.active>a{-webkit-box-shadow:2px 0 0 #3276b1;box-shadow:2px 0 0 #57889c;border-top-width:1px!important;border-right:0!important;margin-right:1px!important}.tabs-below .nav-tabs>li.active>a{-webkit-box-shadow:0 2px 0 #3276b1;box-shadow:0 2px 0 #3276b1;border-bottom-width:0!important;border-top:0!important;margin-top:0!important}.tabs-left>.nav-tabs>li,.tabs-right>.nav-tabs>li,.tabs-left>.nav-pills>li,.tabs-right>.nav-pills>li{float:none}.tabs-left>.nav-tabs>li>a,.tabs-right>.nav-tabs>li>a,.tabs-left>.nav-pills>li>a,.tabs-right>.nav-pills>li>a{min-width:74px;margin-right:0;margin-bottom:3px}.tabs-left .nav-pills>li.active>a{border:0!important;box-shadow:none!important;-webkit-box-shadow:none!important}.tabs-left>.nav-pills,.tabs-left>.nav-tabs{float:left;margin-right:19px;border-right:1px solid #ddd}.tabs-left>.nav-pills{border-right:0}.tabs-left>.nav-tabs>li>a{margin-right:-1px}.tabs-left>.nav-tabs>li>a:focus,.tabs-left>.nav-tabs>li>a:hover{border-color:#eee #d5d5d5 #eee #eee}.tabs-left>.nav-tabs .active>a,.tabs-left>.nav-tabs .active>a:focus,.tabs-left>.nav-tabs .active>a:hover{border-color:#d5d5d5 transparent #d5d5d5 #ddd;*border-right-color:#fff}.tabs-left>.tab-content{margin-left:109px}.tabs-right>.nav-tabs{float:right;margin-left:19px;border-left:1px solid #ddd}.tabs-right>.nav-tabs>li>a{margin-left:-1px}.tabs-right>.nav-tabs>li>a:focus,.tabs-right>.nav-tabs>li>a:hover{border-color:#eee #eee #eee #ddd}.tabs-right>.nav-tabs .active>a,.tabs-right>.nav-tabs .active>a:focus,.tabs-right>.nav-tabs .active>a:hover{border-color:#ddd #ddd #ddd transparent;*border-left-color:#fff}.tabs-pull-right.nav-tabs>li,.tabs-pull-right.nav-pills>li{float:right}.tabs-pull-right.nav-tabs>li:first-child>a,.tabs-pull-right.nav-pills>li:first-child>a{margin-right:1px}.tabs-pull-right.bordered.nav-pills>li:first-child>a,.tabs-pull-right.bordered.nav-tabs>li:first-child>a{border-left-width:1px!important;margin-right:0;border-right-width:0}.tabs-below>.nav-tabs{border-top:1px solid #ddd}.tabs-below>.nav-tabs>li{margin-top:-1px;margin-bottom:0}.tabs-below>.nav-tabs>li>a:focus,.tabs-below>.nav-tabs>li>a:hover{border-top-color:#ddd;border-bottom-color:transparent}.tabs-below>.nav-tabs>.active>a,.tabs-below>.nav-tabs>.active>a:focus,.tabs-below>.nav-tabs>.active>a:hover{border-color:transparent #ddd #ddd}.pill-content>.pill-pane,.tab-content>.pill-pane,.pill-content>.tab-pane,.tab-content>.tab-pane{display:none}.pill-content>.active,.tab-content>.active,.pill-content>.active,.tab-content>.active{display:block}.pill-content.transparent,.tab-content.transparent{background-color:transparent}.pill-content.bordered,.tab-content.bordered,.pill-content.bordered:hover,.tab-content.bordered:hover{border-color:#ddd;border-top:0}.ams-widget>header>.nav-tabs.pull-left>li:first-child a{border-left-width:0!important}h1,h2,h3,h4{margin:0;font-family:"Ubuntu-Bold",Arial,Helvetica,Sans-Serif;font-weight:300}h1{letter-spacing:-1px;font-size:24px;margin:10px 0}h1 small{font-size:18px;font-weight:300;letter-spacing:-1px}h2{letter-spacing:-1px;font-size:22px;margin:20px 0 15px;line-height:normal}h3{display:block;font-size:19px;font-weight:400;margin:16px 0 10px;line-height:normal}h4{line-height:normal;font-size:17px;font-weight:300;margin:12px 0 8px}h5{font-size:15px;font-weight:300;margin:10px 0 6px;line-height:normal}h6{font-size:14px;margin:10px 0 4px;font-weight:300;line-height:normal}hr .simple{margin-top:10px;margin-bottom:10px;border-style:dashed}li.nodot{list-style-type:none}img.online{border-left-color:#40ac2b!important}img.busy{border-left-color:#ed1c24!important}img.offline{border-left-color:#ddd!important}img.away{border-left-color:#ffc40d!important}[data-ams-url],[data-ams-click-handler]{cursor:pointer}label{font-weight:400}article.sortable-grid{min-height:30px}.caret{border-top:5px solid;border-right:5px solid transparent;border-left:5px solid transparent}.fixed{position:fixed}@media(max-width:768px){.xs-fixed{position:fixed}}@media(min-width:768px) and (max-width:992px){.sm-fixed{position:fixed}}@media(min-width:992px) and (max-width:1200px){.md-fixed{position:fixed}}@media(min-width:1200px){.lg-fixed{position:fixed}}.outside{position:absolute;left:-9999px}@media(max-width:979px){.visible-tablet{display:inline-block!important}}@media(max-width:979px){.hidden-tablet,.display-inline.hidden-tablet{display:none!important}}@media only screen and (min-width:0) and (max-width:679px){.hidden-tablet{display:none!important}}@media only screen and (min-width:320px) and (max-width:479px){.visible-mobile{display:inline-block!important}}@media only screen and (min-width:320px) and (max-width:479px){.hidden-mobile{display:none!important}}.viewport-y{overflow-y:auto}.viewport-y.viewport-100{max-height:100px}.viewport-y.viewport-200{max-height:200px}.viewport-y.viewport-300{max-height:300px}.viewport-y.viewport-600{max-height:600px}.viewport-y.viewport-400{max-height:400px}.viewport-y.viewport-500{max-height:500px}.viewport-y.viewport-600{max-height:600px}.viewport-x{overflow-x:auto}.viewport-x.viewport-100{max-width:100px}.viewport-x.viewport-200{max-width:200px}.viewport-x.viewport-300{max-width:300px}.viewport-x.viewport-400{max-width:400px}.viewport-x.viewport-500{max-width:500px}.viewport-x.viewport-600{max-width:600px}.height-100{min-height:100px}.height-200{min-height:200px}.height-300{min-height:300px}.height-400{min-height:400px}.height-500{min-height:500px}.height-600{min-height:600px}.lead{font-size:19px}.alert{margin-bottom:20px;margin-top:0;color:#675100;border-width:0;border-left-width:5px;padding:10px;border-radius:0}.alert .close{top:0;right:-5px;line-height:20px}.alert-heading{font-weight:600}.alert-danger{border-color:#963b49;color:#fff;background:#c46a69;text-shadow:none}.alert-warning{border-color:#e5c693;color:#6b6d31;background:#ecdfb0}.alert-success{border-color:#8eb589;color:#296829;background:#cee0cf}.alert-info{border-color:#9cb4c5;color:#346597;background:#d6dde7}.alert ul{margin-left:25px;list-style-position:outside;list-style-type:square}.ams-form>.alert{margin:5px;padding:5px;box-shadow:none!important;-webkit-box-shadow:none!important;border-radius:0!important}.help{font-size:90%;padding:5px!important}.help p{margin:0 0 1px;line-height:1.15}.modal-dialog .help{margin-bottom:5px!important}.well{background:#fbfbfb;border:1px solid #ddd;box-shadow:0 1px 1px #ececec;-webkit-box-shadow:0 1px 1px #ececec;position:relative}.well.well-clean{-webkit-box-shadow:none;box-shadow:none;border-color:transparent}.well.well-glass{-webkit-box-shadow:none;box-shadow:none;border-color:transparent;background-color:rgba(255,255,255,0.25);color:#fff}.well.well-light{background:#fff;border:1px solid #e2e2e2}.widget-body .well{margin-bottom:0}.well.transparent{border:0!important;background:none!important}.ams-widget.well.transparent>div,.ams-widget.well.transparent>div .widget-body{padding:0!important}.well[class*=" bg-"],.well[class^=bg-]{border:1px solid #555!important}.note{margin-top:6px;padding:0 1px;font-size:11px;line-height:15px;color:#999}.subscript{font-size:21px;color:#999}.display-image{margin-top:-60px;margin-right:20px}.terms-body{max-height:400px;overflow:auto}.timeline-seperator{display:block;text-align:center;color:#999;margin:20px 0 0}.timeline-seperator>:first-child{padding:4px 5px;border:1px dashed rgba(0,0,0,0.1);background:#fff;font-size:11px;border-radius:4px}.timeline-seperator .btn,.timeline-seperator .btn+.dropdown-menu{margin-right:15px}.timeline-seperator:after{display:block;content:" ";margin:0 20px;border-bottom:1px dashed rgba(0,0,0,0.1);margin-top:-8px}.progress{position:relative;margin-bottom:20px;overflow:hidden;height:22px;background:#eee;box-shadow:0 1px 0 transparent,0 0 0 1px #e3e3e3 inset;-webkit-box-shadow:0 1px 0 transparent,0 0 0 1px #e3e3e3 inset;border-radius:0}.progress-bar{float:left;width:0;height:100%;font-size:11px;color:#fff;text-align:center;background-color:#57889c;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);font-weight:700;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-image:url(../img/pattern/overlay-pattern.png)}.progress-striped .progress-bar{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-ms-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-danger{background-color:#a90329}.progress-striped .progress-bar-danger{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-success{background-color:#739e73}.progress-striped .progress-bar-success{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#c79121}.progress-striped .progress-bar-warning{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#57889c}.progress-striped .progress-bar-info{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress .bar-info,.progress-info .bar{background:#57889c}.progress-micro{height:3px!important;line-height:3px!important}.progress-xs{height:7px!important;line-height:7px!important}.progress-sm{height:14px!important;line-height:14px!important}.progress-lg{height:30px!important;line-height:30px!important}.progress .progress-bar{position:absolute;overflow:hidden;line-height:20px}.progress .progressbar-back-text{position:absolute;width:100%;height:100%;font-size:12px;line-height:20px;text-align:center}.progress .progressbar-front-text{display:block;width:100%;font-size:12px;line-height:20px;text-align:center}.progress.right .progress-bar{right:0}.progress.right .progressbar-front-text{position:absolute;right:0}.progress.vertical{width:25px;height:100%;min-height:150px;margin-right:20px;display:inline-block;margin-bottom:0}.progress.vertical.bottom{position:relative}.progress.vertical.bottom .progress-bar{position:absolute;bottom:0}.progress.vertical.bottom .progressbar-front-text{position:absolute;bottom:0}.progress.vertical .progress-bar{width:100%;height:0;-webkit-transition:height .6s ease;transition:height .6s ease}.progress.wide-bar{width:40px}.dd{position:relative;display:block;margin:0;padding:0;max-width:600px;list-style:none;font-size:13px;line-height:20px}@media only screen and (min-width:700px){.dd{float:left;width:100%}.dd+.dd{margin-left:2%}}.dd-header.calender-spacer{height:46px;display:block}.dd-list{display:block;position:relative;margin:0;padding:0;list-style:none}.dd-list .dd-list{padding-left:30px}.dd-collapsed .dd-list{display:none}.dd-empty{border:1px dashed #bbb;min-height:100px;background-color:#eee;background-image:-webkit-linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff),-webkit-linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff);background-image:linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff),linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff);-webkit-background-size:60px 60px;background-size:60px 60px;background-position:0 0,30px 30px}.dd-empty,.dd-placeholder{margin:5px 0;padding:0;min-height:30px;background:#f2fbff;border:1px dashed #b6bcbf;-webkit-box-sizing:border-box;box-sizing:border-box;-moz-box-sizing:border-box}.dd-empty,.dd-item,.dd-placeholder{display:block;position:relative;margin:0;padding:0;min-height:20px;font-size:13px;line-height:20px}.dd-handle{display:block;font-size:15px;margin:5px 0;padding:7px 15px;color:#333;text-decoration:none;border:1px solid #cfcfcf;background:#fbfbfb}.dd-handle:hover,.dd-handle:hover+.dd-list .dd-handle{background:#fddfb3!important;border:1px solid #faa937;color:#333!important}.dd-handle>span{font-size:13px;color:#777}.dd-hover>.dd-handle{background:#2ea8e5!important}.dd-item>button{position:relative;cursor:pointer;float:left;width:25px;height:20px;margin:7px 10px;line-height:22px!important;padding:0;text-indent:100%;white-space:nowrap;overflow:hidden;border:0;background:rgba(0,0,0,0);text-align:center;display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:18px}.dd-item>button:before{content:'\f055';display:block;position:absolute;width:100%;text-align:center;text-indent:0;color:#0091d9}.dd-item>button[data-action=collapse]:before{content:'\f056';color:#a90329}.dd-dragel{position:absolute;pointer-events:none;z-index:9999}.dd-dragel>.dd-item .dd-handle{margin-top:0}.dd-dragel>.dd-item>.dd-handle{border-left-width:4px}.dd-dragel .dd-handle{-webkit-box-shadow:2px 4px 6px 0 rgba(0,0,0,0.1);box-shadow:2px 4px 6px 0 rgba(0,0,0,0.1)}.dd-dragel>li.dd-item.dd3-item{position:relative;top:10px;left:10px;z-index:999}.vertical-bars{padding:0;margin:0}.vertical-bars:after{content:"";display:block;height:0;clear:both}.vertical-bars li{padding:14px 0;width:25%;display:block;float:left;text-align:center}.vertical-bars li:first-child{border-left:0}.vertical-bars>li>.progress.vertical{margin:0 auto;float:none}.vertical-bars>li>.progress.vertical:first-child{margin-left:auto}.bar-holder{padding:18px 15px}.bar-holder:first-child{border-top:0}.bar-holder .progress{margin:0}.pagination.pagination-alt>li>a{box-shadow:none;-webkit-box-shadow:none;border:0;margin-left:-1px}.pagination.pagination-alt>li:first-child>a{padding-left:0}.pagination>li>a,.pagination>li>span{padding:7px 12px 5px;box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05);-webkit-box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05)}.pagination-xs>li>a,.pagination-xs>li>span{padding:5px 9px 3px;font-size:12px}.panel-purple{border-color:#6e587a}.panel-purple>.panel-heading{color:#fff;background-color:#6e587a;border-color:#6e587a}.panel-greenLight{border-color:#71843f}.panel-greenLight>.panel-heading{color:#fff;background-color:#71843f;border-color:#71843f}.panel-greenDark{border-color:#496949}.panel-greenDark>.panel-heading{color:#fff;background-color:#496949;border-color:#496949}.panel-darken{border-color:#333}.panel-darken>.panel-heading{color:#fff;background-color:#404040;border-color:#404040}.panel-pink{border-color:#ac5287}.panel-pink>.panel-heading{color:#fff;background-color:#ac5287;border-color:#ac5287}.panel-green{border-color:#356e35}.panel-green>.panel-heading{color:#fff;background-color:#356e35;border-color:#356e35}.panel-blueLight{border-color:#92a2a8}.panel-blueLight>.panel-heading{color:#fff;background-color:#92a2a8;border-color:#92a2a8}.panel-pinkDark{border-color:#a8829f}.panel-pinkDark>.panel-heading{color:#fff;background-color:#a8829f;border-color:#a8829f}.panel-redLight{border-color:#a65858}.panel-redLight>.panel-heading{color:#fff;background-color:#a65858;border-color:#a65858}.panel-red{border-color:#a90329}.panel-red>.panel-heading{color:#fff;background-color:#a90329;border-color:#a90329}.panel-teal{border-color:#568a89}.panel-teal>.panel-heading{color:#fff;background-color:#568a89;border-color:#568a89}.panel-orange{border-color:#c79121}.panel-orange>.panel-heading{color:#fff;background-color:#c79121;border-color:#c79121}.panel-blueDark{border-color:#4c4f53}.panel-blueDark>.panel-heading{color:#fff;background-color:#4c4f53;border-color:#4c4f53}.panel-magenta{border-color:#6e3671}.panel-magenta>.panel-heading{color:#fff;background-color:#6e3671;border-color:#6e3671}.panel-blue{border-color:#57889c}.panel-blue>.panel-heading{color:#fff;background-color:#57889c;border-color:#57889c}.panel-footer>.btn-block{border-radius:0;border-bottom:0;border-left:0;border-right:0}.notification-body{padding:0 0 0 3px;margin:0;list-style:none}.notification-body *,.notification-body:after *,.notification-body:before *{box-sizing:border-box!important;-webkit-box-sizing:border-box!important;-moz-box-sizing:border-box!important}.notification-body>li{border-bottom:1px solid #e9e9e9;position:relative}.notification-body>li>span{background:#fff;display:block;min-height:25px;overflow:hidden;padding:8px 10px 13px;white-space:normal}.notification-body>li>span:hover{background:#f0f4f7;color:#667f8f}.notification-body>li a.msg{padding-left:50px!important}.notification-body>li a,.notification-body>li a span{display:block;position:relative;overflow:hidden}.notification-body>li a,.notification-body>li a:hover{text-decoration:none}.notification-body>li:hover .progress{background:#fff;box-shadow:0 1px 0 rgba(0,0,0,0),0 0 0 1px #a7a7a7 inset;-webkit-box-shadow:0 1px 0 rgba(0,0,0,0),0 0 0 1px #ccc inset}.notification-body>li:hover .text-muted{color:#333}.notification-body .from{font-size:14px;line-height:normal;color:#333;font-weight:400;margin-right:60px;margin-bottom:6px;height:20px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.notification-body .unread{background:#ffffe0}.notification-body .unread .unread .from{font-weight:700}.notification-body time{position:absolute;top:3px;right:0;font-size:11px;font-weight:400;color:#058dc7}.notification-body .msg-body,.notification-body .subject{font-size:13px;color:#a0a0a0;max-height:35px;width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.notification-body .subject{font-size:13px;color:#333;max-height:22px}.ajax-notifications{height:365px;display:block;overflow:auto;margin-right:-10px;margin-left:-10px;border-bottom:1px solid #cecece;border-top:1px solid #cecece;background:#e9e9e9}@media only screen and (min-width:320px) and (max-width:479px){.ajax-notifications{height:250px}}.ajax-notifications>.alert.alert-transparent{background-color:transparent;border-color:transparent;color:#757575;margin:13px 10px}.ajax-notifications>.alert>:first-child{margin-bottom:10px;font-weight:400}.arrow-box-up:before,.arrow-box-up:after{bottom:100%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}.arrow-box-up:before{border-color:rgba(131,131,131,0);border-bottom-color:#838383;border-width:8px;left:50%;margin-left:-8px}.arrow-box-up:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:7px;left:50%;margin-left:-7px}.arrow-box-up-right:before,.arrow-box-up-right:after{bottom:100%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}.arrow-box-up-right:before{border-color:rgba(131,131,131,0);border-bottom-color:#838383;border-width:8px;right:9px;margin-left:-8px}.arrow-box-up-right:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:7px;right:10px;margin-left:-7px}.tooltip-inner{padding:5px 10px;font-size:11px;font-family:Ubuntu,Arial,Helvetica,sans-serif;font-weight:700;border-radius:0}.jqstooltip{padding:7px!important;border-radius:3px!important;border:0!important;background-color:#000!important;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box}.jqstooltip .jqsfield{font-family:Ubuntu,Arial,sans-serif;font-size:11px}.dd3-content{display:block;margin:5px 0;padding:6px 10px 8px 40px;font-size:15px;color:#333;text-decoration:none;border:1px solid #cfcfcf;background:#fbfbfb}.dd3-content:hover{color:#2ea8e5;background:#fff}.dd-dragel>.dd3-item>.dd3-content{margin:0}.dd3-item>button{margin-left:38px}.dd3-handle{position:absolute;margin:0;left:0;top:0;cursor:move;width:30px;text-indent:100%;white-space:nowrap;overflow:hidden;border:1px solid #aaa;background:#bfbfbf;background:-webkit-gradient(linear,top left,bottom left,from(#ddd),to(#bbb));background:-webkit-linear-gradient(top,#ddd 0,#bbb 100%);background:linear-gradient(top,#ddd 0,#bbb 100%);display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:18px;padding:8px 15px}.dd3-handle:before{content:'\f0c9';display:block;position:absolute;left:0;top:3px;width:100%;text-align:center;text-indent:0;color:#818181;font-weight:400;line-height:28px}.dd3-handle:hover:before{color:#c27616}.nestable-lists{display:block;clear:both;padding:30px 0;width:100%;border:0;border-top:2px solid #bfbfbf;border-bottom:2px solid #bfbfbf}#nestable-menu{padding:0;margin:10px 0 20px}#nestable-output,#nestable2-output{width:100%;padding:5px}.custom-scroll::-webkit-scrollbar{-webkit-overflow-scrolling:touch;height:10px;width:10px}.custom-scroll::-webkit-scrollbar:hover{background-color:#e9e9e9;border:1px solid #dbdbdb}.custom-scroll::-webkit-scrollbar-button:start:decrement,.custom-scroll::-webkit-scrollbar-button:end:increment{background:0;display:block;height:0}.custom-scroll::-webkit-scrollbar-track{-webkit-background-clip:padding-box;background-clip:padding-box;border:solid transparent}.custom-scroll::-webkit-scrollbar-track-piece{-o-border-radius:0;background-color:transparent;border-radius:0}.custom-scroll::-webkit-scrollbar-thumb{-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,0.1),inset 0 -1px 0 rgba(0,0,0,0.07);-webkit-background-clip:padding-box;background-clip:padding-box;background-color:rgba(0,0,0,0.2);border:0;box-shadow:inset 1px 1px 0 rgba(0,0,0,0.1),inset 0 -1px 0 rgba(0,0,0,0.07)}.custom-scroll::-webkit-scrollbar-thumb:vertical,.custom-scroll::-webkit-scrollbar-thumb:horizontal{-o-border-radius:0;background-color:#bfbfbf;border-radius:0}.custom-scroll::-webkit-scrollbar-thumb:active{-webkit-box-shadow:inset 1px 1px 3px rgba(0,0,0,0.33);background-color:rgba(0,0,0,0.44);box-shadow:inset 1px 1px 3px rgba(0,0,0,0.33)}.custom-scroll::-webkit-scrollbar-thumb:hover{background-color:#959595}.air{position:absolute;z-index:5}.air-bottom{bottom:0}.air-top{top:0}.air-top-right{top:0;right:0}.air-top-left{top:0;left:0}.air-bottom-left{bottom:0;left:0}.air-bottom-right{bottom:0;right:0}.tree{min-height:20px;border-radius:4px}.tree li{list-style-type:none;margin:0;padding:3px 0 3px 5px;position:relative}.tree li:after,.tree li:before{content:'';left:-20px;position:absolute;right:auto}.tree li:before{border-left:1px solid #999;bottom:50px;height:100%;top:-5px;width:1px;-webkit-transition:"border-color 0.1s ease 0.1s";transition:"border-color 0.1s ease 0.1s"}.tree li:last-child::before{height:30px}.tree li:after{border-top:1px solid #999;height:20px;top:14px;width:25px}.tree li:hover{background:rgba(0,0,0,0.15)}.tree li>span{border:1px dotted #999;border-radius:5px;display:inline-block;padding:4px 8px;text-decoration:none;-webkit-transition:color .2s ease .1s,background-color .2s ease .1s,border-color .3s ease .2s;transition:color .2s ease .1s,background-color .2s ease .1s,border-color .3s ease .2s}.tree li>span>i{padding-right:4px}.tree li.parent_li>span{padding:7px}.tree li>span{cursor:pointer}.tree li>span:hover,.tree li>span:hover+ul li>span{background:#eee;border:1px solid #94a0b4;color:#000}.tree ul ul{padding-left:34px;padding-top:5px}.tree>ul{padding-left:0}.tree>ul>li:after,.tree>ul>li:before{border:0}.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.pace-inactive{display:none}.pace .pace-progress{background:#3276b1;position:fixed;z-index:2000;top:0;left:0;height:2px;-webkit-transition:width 1s;transition:width 1s}.pace .pace-progress-inner{display:block;position:absolute;right:0;width:100px;height:100%;-webkit-box-shadow:0 0 10px #29d,0 0 5px #29d;box-shadow:0 0 10px #29d,0 0 5px #29d;opacity:1;-webkit-transform:rotate(3deg) translate(0,-4px);-ms-transform:rotate(3deg) translate(0,-4px);transform:rotate(3deg) translate(0,-4px)}.pace .pace-activity{display:block;position:fixed;z-index:2000;top:63px;right:40px;width:14px;height:14px;border:solid 2px transparent;border-top-color:#29d;border-left-color:#29d;border-radius:10px;-webkit-animation:pace-spinner 400ms linear infinite;-ms-animation:pace-spinner 400ms linear infinite;animation:pace-spinner 400ms linear infinite}.table-full{width:100%}.table-wrap{overflow:auto}.table.has-tickbox thead tr th:first-child{width:18px}.table.has-tickbox.ams-form tbody tr td:first-child .checkbox,.table.has-tickbox.ams-form tbody tr td:first-child .radio,.table.has-tickbox.ams-form thead tr th:first-child .checkbox,.table.has-tickbox.ams-form thead tr th:first-child .radio{padding:0!important}.table-dnd tbody tr.dragging-row td{background-color:#cedbf7!important}.table-dnd tbody tr td:first-child{padding-left:20px!important}.table-dnd tbody td.drag-handle{background:transparent url('../img/vert-drag-handle.png') scroll no-repeat left 50%}.table-tight td,.table-tight th{padding:4px 8px!important;line-height:1.3!important}.table-mini td,.table-mini th{padding:1px 8px!important;line-height:1.1!important}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-width:1px}.table-bordered .no-padding>.table-bordered{border:0!important}.table-bordered .no-padding>.table-bordered tbody tr td:first-child,.table-bordered .no-padding>.table-bordered thead tr td:first-child,.table-bordered .no-padding>.table-bordered thead tr th:first-child{border-left-width:0!important}.table-bordered .no-padding>.table-bordered tbody tr td:last-child,.table-bordered .no-padding>.table-bordered thead tr th:last-child{border-right-width:0!important}.table-bordered .no-padding>.table-bordered tbody tr:last-child td{border-bottom-width:0!important}.no-padding .note-editable .table-bordered{border:1px solid #ddd!important}tr.bordered-bottom th,tr.bordered-bottom td{border-bottom:1px solid #ddd}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#eee}th.checker,td.checker{width:30px}th.actions-menu{width:70px}th.action,td.action{width:26px}.dt-row{padding:4px 10px}.dt-top-row{height:0;line-height:0;position:relative}.dt-bottom-row{background:#fafafa;font-size:11px;overflow:hidden;padding:5px 10px;border-top:1px solid #ccc;-webkit-box-shadow:inset 0 1px #fff;-ms-box-shadow:inset 0 1px #fff;box-shadow:inset 0 1px #fff}.modal-dialog .ams-form .dt-bottom-row{padding:5px 10px!important}.modal-dialog .ams-form .dt-bottom-row .row{margin:0}.dataTables_length{position:absolute;right:13px;top:-35px}.dataTables_length select{width:60px;padding:3px;font-size:13px;border:1px solid #bbb}.dataTables_filter{position:absolute;left:10px;top:-35px}.dataTables_filter input{padding:3px 8px 1px;font-size:13px}.dataTables_filter .form-control{height:28px}.dataTables_filter .input-group{width:180px!important}.dataTables_filter input select{border:1px solid #bbb}.dataTables_paginate{margin:4px 0 0}.dataTables_paginate .pagination{margin:0}.dataTables_paginate .btn-group a{color:#2e5f87}.dataTables_wrapper{position:relative}.dataTables_wrapper table.table{clear:both;max-width:inherit;margin-bottom:0}.dataTables_wrapper table.table thead th{white-space:nowrap;text-overflow:ellipsis;-ms-text-overflow:ellipsis}.dataTables_wrapper table.table thead .sorting,.dataTables_wrapper table.table thead .sorting_asc,.dataTables_wrapper table.table thead .sorting_asc_disabled,.dataTables_wrapper table.table thead .sorting_desc,.dataTables_wrapper table.table thead .sorting_desc_disabled{cursor:pointer;padding-right:20px}.dataTables_wrapper table.table thead .sorting{background:url(../img/datatable/sort_both.png) no-repeat center right}.dataTables_wrapper table.table thead .sorting_asc{background:url(../img/datatable/sort_asc.png) no-repeat center right}.dataTables_wrapper table.table thead .sorting_desc{background:url(../img/datatable/sort_desc.png) no-repeat center right}.dataTables_wrapper table.table thead .sorting_asc_disabled{background:url(../img/datatable/sort_asc_disabled.png) no-repeat center right}.dataTables_wrapper table.table thead .sorting_desc_disabled{background:url(../img/datatable/sort_desc_disabled.png) no-repeat center right}.dataTables_wrapper table.table tbody tr.active th,.dataTables_wrapper table.table tbody tr.active td{background-color:#08C;color:#fff}.dataTables_wrapper table.table tbody tr.active:hover td,.dataTables_wrapper table.table tbody tr.active:hover th{background-color:#0075b0!important}.dataTables_wrapper table.dataTable th:active{outline:0}.dataTables_wrapper .table-striped tbody tr.active:nth-child(odd) td,.dataTables_wrapper .table-striped tbody tr.active:nth-child(odd) th{background-color:#017ebc}.dataTables_wrapper select{min-height:inherit}.dataTables_wrapper table+.row{margin-bottom:0;margin-top:10px}.dataTables_wrapper .dt_actions{float:left;margin-right:20px}.dataTables_wrapper .bottom,.dataTables_wrapper .top{background-color:#f5f5f5;border:1px solid #CCC;padding:15px}.dataTables_wrapper div.DTTT .btn:hover{text-decoration:none!important}.dataTables_wrapper ul.DTTT_dropdown.dropdown-menu a{color:#333!important}.dataTables_wrapper ul.DTTT_dropdown.dropdown-menu li:hover a{background-color:#08c;color:#fff!important}.dataTables_wrapper div.DTTT_print_info.modal{height:150px;margin-top:-75px;text-align:center}.dataTables_wrapper div.DTTT_print_info h6{font-weight:400;font-size:28px;line-height:28px;margin:1em}.dataTables_wrapper div.DTTT_print_info p{font-size:14px;line-height:20px}.dataTables_wrapper div.DTFC_LeftFootWrapper table,.dataTables_wrapper div.DTFC_LeftHeadWrapper table,.dataTables_wrapper table.DTFC_Cloned tr.even{background-color:#fff}.dataTables_wrapper div.DTFC_LeftHeadWrapper table{margin-bottom:0!important;border-top-right-radius:0!important;border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}.dataTables_scrollBody{-webkit-overflow-scrolling:touch}.top .dataTables_info{float:none}div.dt-bottom-row .dataTables_info{float:left;padding-top:10px;font-size:12px}.dataTables_full{width:100%!important}.dataTables_empty{text-align:center!important;font-size:15px;background:#fff!important;padding:20px 0!important;cursor:default}.dataTables_scroll{clear:both}.dataTables_scrollHeadInner table.table-bordered{border-radius:4px 4px 0 0}.dataTables_scrollHeadInner table.table-bordered,.dataTables_scrollHeadInner table.table-bordered thead{border-bottom:0}.dataTables_scrollBody table{border-top:0}.dataTables_processing{position:absolute;top:50%;margin-top:-24px;z-index:100;left:50%;width:250px;margin-left:-125px;border:1px solid #ddd;text-align:center;color:#000;background:#fff;font-size:15px!important;-webkit-box-shadow:0 0 4px rgba(0,0,0,0.2);-ms-box-shadow:0 0 4px rgba(0,0,0,0.2);box-shadow:0 0 4px rgba(0,0,0,0.2);padding:10px 0}.dataTables_wrapper .center{text-align:center}.dataTables_wrapper .details,.dataTables_wrapper .details:hover{background:#ddd!important}.dataTables_wrapper .details table td{background:#fff!important}.dataTables_scrollHeadInner table.table,.dataTables_wrapper .details table.table{margin:0!important}.dataTables_scrollHead table{margin-bottom:0!important;border-bottom-left-radius:0;border-bottom-right-radius:0}.dataTables_scrollHead table thead tr:last-child th:first-child{border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}.DTFC_LeftHeadWrapper table thead tr:last-child td:first-child,.DTFC_LeftHeadWrapper table thead tr:last-child th:first-child{border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}.DTFC_LeftBodyWrapper table,.dataTables_scrollBody table{border-top:0;margin-bottom:0!important}.DTFC_LeftBodyWrapper tbody tr:first-child td,.DTFC_LeftBodyWrapper tbody tr:first-child th,div.DTFC_LeftFootWrapper table,div.dataTables_scrollBody tbody tr:first-child th,div.dataTables_scrollFoot table{border-top:0}.ColVis{position:absolute;right:83px;top:-35px}.ColVis_collection{position:relative;width:180px;background-color:#fff;border:1px solid rgba(0,0,0,0.2);-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.2);box-shadow:0 2px 4px rgba(0,0,0,0.2);z-index:1102;padding-top:3px;padding-left:10px;list-style-type:none;list-style-position:outside}.ColVis_collection .ColVis_Button{position:relative;margin-right:3px;height:30px;background-color:#fff;border:1px solid #d0d0d0;cursor:hand;padding:3px 5px}.ColVis_collection button.ColVis_Button{padding:4px 12px;height:26px;background-color:#fff;border:0;width:100%;float:none;font-size:12px}.ColVis_collection button.ColVis_Button+button.ColVis_Button{border-top:1px solid #e1e1e1}.ColVis_collection button.ColVis_Button button.ColVis_Button input{margin:0}button.ColVis_Button{padding:4px 5px;text-align:left}button.ColVis_Button::-moz-focus-inner{border:0!important;padding:0}.ColVis_collectionBackground{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#000;z-index:1100}div.ColVis_catcher{position:absolute;z-index:1101}span.ColVis_radio{display:inline-block;width:20px;vertical-align:-2px}.ColVis_text_hover,div.ColVis_collection button.ColVis_Button:hover{background:#f2f2f2;color:#222}table.DTCR_clonedTable{background-color:#fff;z-index:202}div.DTCR_pointer{width:1px;background-color:#0259c4;z-index:201}ul.DTTT_dropdown.dropdown-menu li{position:relative}ul.DTTT_dropdown.dropdown-menu li:hover a{background-color:#f2f2f2;color:#333!important}.table_tools_group{position:absolute;right:83px;top:-37px}.DTTT.btn-group{position:absolute;top:-38px;right:83px}.DTTT_dropdown{z-index:2002}.DTFC_LeftHeadWrapper{border-bottom:1px solid #ddd}div.DTTT_container{position:relative;float:right;margin-bottom:1em}a.DTTT_button,button.DTTT_button,div.DTTT_button{position:relative;float:left;margin-right:3px;padding:5px 8px;border:1px solid #999;cursor:pointer;*cursor:hand;font-size:.88em;color:#000!important;-o-border-radius:2px;border-radius:2px;-webkit-box-shadow:1px 1px 3px #ccc;-ms-box-shadow:1px 1px 3px #ccc;-o-box-shadow:1px 1px 3px #ccc;box-shadow:1px 1px 3px #ccc;background:#fff;background:-webkit-gradient(linear,top left,bottom left,from(#fff),color-stop(89%,#f3f3f3),to(#f9f9f9));background:-webkit-linear-gradient(top,#fff 0,#f3f3f3 89%,#f9f9f9 100%);background:linear-gradient(top,#fff 0,#f3f3f3 89%,#f9f9f9 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff',endColorstr='#f9f9f9',GradientType=0)}a.DTTT_button:hover,button.DTTT_button:hover,div.DTTT_button:hover{border:1px solid #666;text-decoration:none!important;-webkit-box-shadow:1px 1px 3px #999;-ms-box-shadow:1px 1px 3px #999;-o-box-shadow:1px 1px 3px #999;box-shadow:1px 1px 3px #999;background:#f3f3f3;background:-webkit-gradient(linear,top left,bottom left,from(#f3f3f3),color-stop(89%,#e2e2e2),to(#f4f4f4));background:-webkit-linear-gradient(top,#f3f3f3 0,#e2e2e2 89%,#f4f4f4 100%);background:linear-gradient(top,#f3f3f3 0,#e2e2e2 89%,#f4f4f4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3f3f3',endColorstr='#f4f4f4',GradientType=0)}button.DTTT_button{height:30px;padding:3px 8px}.DTTT_button embed{outline:0}a.DTTT_disabled,button.DTTT_disabled,div.DTTT_disabled{color:#999;border:1px solid #d0d0d0;background:#fff;background:-webkit-gradient(linear,top left,bottom left,from(#fff),color-stop(89%,#f9f9f9),to(#fafafa));background:-webkit-linear-gradient(top,#fff 0,#f9f9f9 89%,#fafafa 100%);background:linear-gradient(top,#fff 0,#f9f9f9 89%,#fafafa 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff',endColorstr='#fafafa',GradientType=0)}table.DTTT_selectable tbody tr{cursor:pointer;*cursor:hand}table.dataTable tr.DTTT_selected.odd td.sorting_1,table.dataTable tr.DTTT_selected.odd td.sorting_2,table.dataTable tr.DTTT_selected.odd td.sorting_3{background-color:#9fafd1}table.dataTable tr.DTTT_selected.even td.sorting_1,table.dataTable tr.DTTT_selected.even td.sorting_2,table.dataTable tr.DTTT_selected.even td.sorting_3{background-color:#b0bed9}div.DTTT_collection{width:150px;padding:8px 8px 4px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.4);background-color:#f3f3f3;background-color:rgba(255,255,255,0.3);overflow:hidden;z-index:2002;-o-border-radius:5px;border-radius:5px;-webkit-box-shadow:3px 3px 5px rgba(0,0,0,0.3);-ms-box-shadow:3px 3px 5px rgba(0,0,0,0.3);-o-box-shadow:3px 3px 5px rgba(0,0,0,0.3);box-shadow:3px 3px 5px rgba(0,0,0,0.3)}div.DTTT_collection a.DTTT_button,div.DTTT_collection button.DTTT_button,div.DTTT_collection div.DTTT_button{position:relative;left:0;right:0;display:block;float:none;margin-bottom:4px;-webkit-box-shadow:1px 1px 3px #999;-ms-box-shadow:1px 1px 3px #999;-o-box-shadow:1px 1px 3px #999;box-shadow:1px 1px 3px #999}div.DTTT_collection_background{z-index:2001}.DTTT_print_info{position:fixed;top:50%;left:50%;width:400px;height:150px;margin-left:-200px;margin-top:-75px;text-align:center;color:#333;padding:10px 30px;background:#fff;background:-webkit-gradient(linear,top left,bottom left,from(#fff),color-stop(89%,#f3f3f3),to(#f9f9f9));background:-webkit-linear-gradient(top,#fff 0,#f3f3f3 89%,#f9f9f9 100%);background:linear-gradient(top,#fff 0,#f3f3f3 89%,#f9f9f9 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff',endColorstr='#f9f9f9',GradientType=0);opacity:.95;border:1px solid #000;border:1px solid rgba(0,0,0,0.5);-o-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0,0,0,0.5);-ms-box-shadow:0 3px 7px rgba(0,0,0,0.5);-o-box-shadow:0 3px 7px rgba(0,0,0,0.5);box-shadow:0 3px 7px rgba(0,0,0,0.5)}.DTTT_print_info h6{font-weight:400;font-size:28px;line-height:28px;margin:1em}.DTTT_print_info p{font-size:14px;line-height:20px}.form hr{margin-left:-13px;margin-right:-13px;border-color:rgba(0,0,0,0.1);margin-top:20px;margin-bottom:20px}.form fieldset{display:block;border:0;background:rgba(255,255,255,0.9);position:relative}.form header,.form legend{display:block;padding:8px 0;border-bottom:1px dashed rgba(0,0,0,0.2);background:#fff;font-size:16px;font-weight:300;color:#222;margin:25px 0 20px}.no-padding .form header{margin:25px 14px 0}.form header:first-child{margin-top:10px}.form .form-group:last-child,.form .form-group:last-child .note,.form fieldset .form-group:last-child,.form fieldset .form-group:last-child .note{margin-bottom:0}fieldset{position:relative}legend{font-weight:400;margin-top:0;background:0}i.hint{vertical-align:super;opacity:.5}i.hint:hover{opacity:.9!important}.nohints i.hint{display:none}.input-group-addon{padding:6px 10px 5px;border-radius:0;transition:background-color .3s;-webkit-transition:background-color .3s}.input-group-addon .fa{font-size:14px}.input-group-addon .fa-2x,.input-group-addon .fa-lg{font-size:2em}.input-group-addon .fa-3x,.input-group-addon .fa-4x,.input-group-addon .fa-5x{font-size:30px}.input-group-addon .checkbox,.input-group-addon .radio{min-height:0;margin-right:0!important;padding-top:0}.input-group-addon label input[type=checkbox].checkbox+span,.input-group-addon label input[type=checkbox].checkbox+span:before,.input-group-addon label input[type=radio].radiobox+span,.input-group-addon label input[type=radio].radiobox+span:before{margin-right:0}.input-group-addon .onoffswitch,.input-group-addon .onoffswitch-label{margin:0}input[type=text]:focus+.input-group-addon{border-color:#0091d9;background-color:#72a0ce;color:#fff}.has-warning input[type=text]:focus+.input-group-addon{border-color:#7f6a1e;background-color:#cead35;color:#fff}.has-error input[type=text]:focus+.input-group-addon{border-color:#c46a69;background-color:#c46a69;color:#fff}.has-success input[type=text]:focus+.input-group-addon{border-color:#446b46;background-color:#588a5a;color:#fff}.input-icon-left>i{right:auto;left:24px}.input-icon-left .form-control{padding-left:29px}.input-icon-right{position:relative}.input-icon-right .form-control{padding-right:27px}.input-icon-left>i,.input-icon-right>i{position:absolute;right:10px;top:30%;font-size:16px;color:#bfbfbf}.form-actions{display:block;padding:13px 14px 15px;border-top:1px solid rgba(0,0,0,0.1);background:rgba(249,249,249,0.9);margin-top:25px;margin-left:-13px;margin-right:-13px;margin-bottom:-13px;text-align:right}.well .form-actions{margin-left:-19px;margin-right:-19px;margin-bottom:-19px}.well.well-lg .form-actions{margin-left:-24px;margin-right:-24px;margin-bottom:-24px}.well.well-sm .form-actions{margin-left:-9px;margin-right:-9px;margin-bottom:-9px}.popover-content .form-actions{margin:0 -14px -9px;border-radius:0 0 3px 3px;padding:9px 14px}.no-padding .form .form-actions{margin:0;display:block;padding:13px 14px 15px;border-top:1px solid rgba(0,0,0,0.1);background:rgba(248,248,248,0.9);text-align:right;margin-top:25px}:focus{outline:0!important}.filter_column input{padding:0 3px}.filter_column input,.filter_column select{width:100%;color:rgba(0,0,0,0.5);border:1px solid #CCC;border-radius:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.uneditable-input:focus,input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus,.filter_column input:focus,.filter_column select:focus,select:focus,textarea:focus{border-color:rgba(82,168,236,0.8);outline:0;outline:thin dotted 9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6)}.form-control{padding:7px 12px 5px}.form-control,.input-lg,.input-sm,.input-xs{border-radius:0!important}.input-xs{height:24px;padding:3px 10px 1px;font-size:11px;line-height:1.5}.fileinput{padding-top:3px}input[type=checkbox].checkbox,input[type=radio].radiobox{visibility:hidden;position:absolute;z-index:20;width:18px;height:18px}.checkbox input[type=checkbox].checkbox+span,.checkbox input[type=radio].radiobox+span,.checkbox-inline input[type=checkbox].checkbox+span,.checkbox-inline input[type=radio].radiobox+span,.radio input[type=checkbox].checkbox+span,.radio input[type=radio].radiobox+span,.radiobox-inline input[type=checkbox].checkbox+span,.radiobox-inline input[type=radio].radiobox+span{margin-left:-20px}.form-inline .checkbox input[type=checkbox].checkbox+span,.form-inline .checkbox input[type=radio].radiobox+span,.form-inline .checkbox-inline input[type=checkbox].checkbox+span,.form-inline .checkbox-inline input[type=radio].radiobox+span,.form-inline .radio input[type=checkbox].checkbox+span,.form-inline .radio input[type=radio].radiobox+span,.form-inline .radiobox-inline input[type=checkbox].checkbox+span,.form-inline .radiobox-inline input[type=radio].radiobox+span{margin-left:0}input[type=checkbox].checkbox+span,input[type=radio].radiobox+span,label input[type=checkbox].checkbox+span,label input[type=radio].radiobox+span{vertical-align:middle;line-height:20px}input[type=checkbox].checkbox+span,input[type=radio].radiobox+span,input[type=checkbox].checkbox+span:after,input[type=radio].radiobox+span:after,input[type=checkbox].checkbox:before,input[type=radio].radiobox:before{box-sizing:content-box!important;-webkit-box-sizing:content-box!important;-moz-box-sizing:content-box!important}label input[type=checkbox].checkbox+span,label input[type=radio].radiobox+span{position:relative;z-index:19;display:inline-block;margin:0;line-height:17px;min-height:14px;min-width:14px;margin-right:5px}label input[type=checkbox].checkbox+span:hover,label input[type=radio].radiobox+span:hover{cursor:pointer}label input[type=checkbox].checkbox+span:before,label input[type=radio].radiobox+span:before{font-family:FontAwesome;font-size:12px;border-radius:0;content:"\a0";display:inline-block;text-align:center;vertical-align:middle;padding:1px;height:12px;line-height:12px;min-width:12px;margin-right:5px;border:1px solid #bfbfbf;background-color:#f4f4f4;font-weight:400;margin-top:-1px}label input[type=checkbox].checkbox+span:before{content:"\a0"}label input[type=checkbox].checkbox:checked+span{font-weight:700}label input[type=checkbox].checkbox:checked+span:before{content:"\f00c";color:#2e7bcc}label input[type=checkbox].checkbox.style-1+span:before{color:#333;background:#fff;text-shadow:none;-webkit-box-shadow:none!important;box-shadow:none!important;border-width:1px;height:12px;line-height:13px;min-width:12px}label input[type=checkbox].checkbox.style-1:checked+span{font-weight:400}label input[type=checkbox].checkbox.style-1:checked+span:before{color:#333;border-color:#333}label input[type=checkbox].checkbox.style-2+span:before{background:0;border-color:#c1c1c1;-webkit-box-shadow:none;box-shadow:none}label input[type=checkbox].checkbox.style-2:checked+span{font-weight:400}label input[type=checkbox].checkbox.style-2:checked+span:before{content:"\f00c";color:#66665e;border-color:#4d90fe;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIFdpbmRvd3MiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MUQ0MEM4RUFEQUE4MTFFMkEwMjM5NzlCRjAxM0UwRjciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MUQ0MEM4RUJEQUE4MTFFMkEwMjM5NzlCRjAxM0UwRjciPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoxRDQwQzhFOERBQTgxMUUyQTAyMzk3OUJGMDEzRTBGNyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoxRDQwQzhFOURBQTgxMUUyQTAyMzk3OUJGMDEzRTBGNyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PsD/PVAAAAAQSURBVHjaYv7//78vQIABAAlYA05NMPppAAAAAElFTkSuQmCC) #fff}label input[type=checkbox].checkbox.style-3:checked+span:before{color:#fff;border-color:#a90329;background:#a90329}label:active input[type=checkbox].checkbox+span:before{-webkit-box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4);box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4)}label:hover input[type=checkbox].checkbox+span:before{color:#2e7bcc;border-color:#2e7bcc}label:hover input[type=checkbox].checkbox.style-1+span:before{border-color:#333}label:hover input[type=checkbox].checkbox.style-2+span:before{-webkit-box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.1),0 1px 0 0 rgba(255,255,255,0.2);box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.1),0 1px 0 0 rgba(255,255,255,0.2)}label:hover input[type=checkbox].checkbox.style-2:checked+span:before{-webkit-box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4);box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4)}label:hover input[type=checkbox].checkbox.style-3+span:before{color:#fff;border-color:#a90327}label:active input[type=checkbox].checkbox:checked+span:before{color:#fff;background:#2e7bcc;border-color:#2e7bcc}label:active input[type=checkbox].checkbox.style-1:checked+span:before{color:#fff;background:#333;border-color:#333}label:active input[type=checkbox].checkbox.style-2+span:before,label:active input[type=checkbox].checkbox.style-2:checked+span:before{color:#66665e;background:0;border-color:#c1c1c1;-webkit-box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4);box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4)}label:active input[type=checkbox].checkbox.style-3:checked+span:before{color:#a90329;background:#fff;border-color:#a90329}label input[type=checkbox][disabled].checkbox+span,label input[type=checkbox][disabled].checkbox:checked+span{color:#a7a7a7;cursor:not-allowed}label input[type=checkbox][disabled].checkbox:checked+span:before{content:"\f00c"}label input[type=checkbox][disabled].checkbox.style-2:checked+span:before{content:"\f00c"}label input[type=checkbox][disabled].checkbox+span:before,label input[type=checkbox][disabled].checkbox:checked+span:before,label input[type=checkbox][disabled].checkbox:checked+span:before{background:#eee!important;border-color:#CCC!important;-webkit-box-shadow:none;color:#a7a7a7;box-shadow:none!important}label:hover input[type=checkbox][disabled].checkbox:checked+span:before{color:#a7a7a7;cursor:not-allowed}label:hover input[type=checkbox][disabled].checkbox:checked+span:before{background:#eee!important;border-color:#CCC!important;-webkit-box-shadow:none;color:#a7a7a7;box-shadow:none!important}label input[type=radio].radiobox+span:before{content:"\a0";border-radius:50%;-webkit-box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.1),0 1px 0 0 rgba(255,255,255,0.2);box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.1),0 1px 0 0 rgba(255,255,255,0.2)}label input[type=radio].radiobox:checked+span{font-weight:700}label input[type=radio].radiobox:checked+span:before{content:"\f111";color:#2e7bcc}label input[type=radio].radiobox.style-1+span:before{font-size:9px;background:#fff;text-shadow:none;-webkit-box-shadow:none!important;box-shadow:none!important;border-width:1px;height:13px;line-height:13px;min-width:13px}label input[type=radio].radiobox.style-1:checked+span:before{font-size:10px;color:#333;border-color:#333;background:#fff}label input[type=radio].radiobox.style-1:checked+span{font-weight:400}label input[type=radio].radiobox.style-2:checked+span{font-weight:400}label input[type=radio].radiobox.style-2:checked+span:before{color:#66665e;border-color:#4d90fe;font-size:9px}label input[type=radio].radiobox.style-3:checked+span:before{color:#a90329;border-color:#a90329}label:hover input[type=radio].radiobox+span:before,label:hover input[type=radio].radiobox:checked+span:before{color:#2e7bcc;border-color:#2e7bcc}label:hover input[type=radio].radiobox.style-1+span:before,label:hover input[type=radio].radiobox.style-1:checked+span:before{color:#333;border-color:#333;background:#fff}label:hover input[type=radio].radiobox.style-2:checked+span:before{color:#66665e;border-color:#4d90fe}label:hover input[type=radio].radiobox.style-3+span:before,label:hover input[type=radio].radiobox.style-3:checked+span:before{color:#a90329;border-color:#a90329}label:active input[type=radio].radiobox+span:before{-webkit-box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4);box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4)}label input[type=radio][disabled].radiobox+span,label input[type=radio][disabled].radiobox:checked+span,label input[type=radio][disabled].radiobox:checked+span:before{color:#a7a7a7;cursor:not-allowed}label input[type=radio][disabled].radiobox:checked+span:before{content:"\f111"}label input[type=radio][disabled].radiobox+span:before,label input[type=radio][disabled].radiobox:checked+span:before{background:#eee!important;border-color:#CCC!important;-webkit-box-shadow:none;box-shadow:none;color:#a7a7a7}label:active input[type=radio][disabled].radiobox:checked+span:before,label:hover input[type=radio][disabled].radiobox:checked+span:before{background:#eee!important;border-color:#CCC!important;-webkit-box-shadow:none;box-shadow:none;color:#a7a7a7}textarea.clone{position:absolute;visibility:hidden}.textarea-div{background-color:#FFF;border:1px solid #CCC;border-bottom:0;margin:10px 0 0}.textarea-controls{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:5px;display:block;background-color:#FFF;border:1px solid #CCC;border-top:0;height:43px;line-height:33px;overflow:hidden}.textarea-controls>label{margin:3px 10px 0}.textarea-controls .ams-form .checkbox{padding-left:22px!important}.typearea{cursor:text;overflow-x:hidden;overflow-y:auto;max-height:90px;padding:5px 25px 5px 5px;position:relative;border-bottom:1px solid #EEE}.typearea textarea{width:100%;border-color:transparent!important;box-sizing:border-box;box-shadow:none;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-webkit-box-shadow:none;overflow:hidden;padding:0;margin:0;-webkit-transition:height .2s;transition:height .2s;outline:0;resize:none;min-height:61px}.error-box{max-width:900px;margin:0 auto}.error-text{font-weight:400;color:#fff;letter-spacing:-4px;font-size:700%;margin-bottom:30px;text-shadow:0 1px 0 #ccc,0 2px 0 #bfbfbf,0 3px 0 #bbb,0 4px 0 #b9b9b9,0 5px 0 #aaa,0 6px 1px rgba(0,0,0,0.1),0 0 5px rgba(0,0,0,0.1),0 1px 3px rgba(0,0,0,0.3),0 3px 5px rgba(0,0,0,0.2),0 5px 10px rgba(0,0,0,0.25),0 10px 10px rgba(0,0,0,0.2),0 20px 20px rgba(0,0,0,0.15)}.error-search{width:300px;margin:0 auto 20px}.error-icon-shadow{text-shadow:0 1px 0 #803838,0 2px 0 #a85d5d,0 3px 0 #b86565,0 4px 0 #d86f6f,0 5px 0 #b3a5a5,0 6px 1px rgba(131,51,51,0.1),0 0 5px rgba(102,30,30,0.1),0 1px 3px rgba(95,15,15,0.3),0 3px 5px rgba(100,23,23,0.2),0 5px 10px rgba(114,30,30,0.25),0 10px 10px rgba(94,15,15,0.2),0 20px 20px rgba(121,38,38,0.15)}.form-inline .checkbox,.form-inline .radiobox{padding-left:0}.ams-form{position:relative;margin:0;outline:0;color:#333}.ams-form *,.ams-form :after,.ams-form :before{margin:0;padding:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.ams-form header{display:block;padding:8px 0;border-bottom:1px dashed rgba(0,0,0,0.2);background:#fff;font-size:16px;font-weight:300;color:#232323;margin:10px 14px 0}.modal-dialog .ams-form header{margin:10px -2px 0 0}.ams-form fieldset{display:block;position:relative;padding:10px 15px 5px;border:0;background:rgba(255,255,255,0.9)}.ams-form fieldset[disabled]>section,.ams-form fieldset[disabled]>article,.ams-form fieldset[disabled]>div{opacity:.5}.ams-form fieldset[disabled] LEGEND.checker .checkbox{cursor:pointer}.ams-form fieldset.switched{margin-bottom:0!important}.ams-form fieldset.switched>section,.ams-form fieldset.switched>article,.ams-form fieldset.switched>div{display:none}.ams-form fieldset.switched legend{border-bottom:0}.ams-form fieldset.switched+fieldset{margin-top:0!important}.ams-form fieldset.bordered{margin:10px;border:1px solid rgba(192,192,192,0.8);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.ams-form fieldset.bordered.switched{border:1px solid transparent}.ams-form fieldset.bordered legend{width:auto;padding:3px 10px 1px;border:1px solid rgba(192,192,192,0.8);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.ams-form fieldset>fieldset.bordered{margin:10px 0}.ams-form fieldset+fieldset{border-top:1px solid rgba(0,0,0,0.1)}.ams-form legend{padding-top:10px}.ams-form legend.inner,.ams-form legend .inner{font-weight:300;font-size:14.5px!important}.ams-form legend.switcher{cursor:pointer}.ams-form legend.checker,.ams-form legend.switcher{font-weight:300;font-size:16.5px;border:0;padding-bottom:0}.ams-form legend.checker label[for],.ams-form legend.switcher label[for]{cursor:pointer}.ams-form legend .fa{color:#3276b1;font-size:75%}.ams-form legend .fa.fa-stack{font-size:100%;width:1em;height:1em;line-height:1em}.ams-form legend .hint{vertical-align:top;font-size:1em}.ams-form legend label.checkbox{display:inline-block;margin-bottom:0;min-height:18px}.ams-form legend label.checkbox i{position:absolute;left:3px;top:-1px}.ams-form>.modal-viewport>fieldset>legend{padding-top:0}.ams-form section{margin-bottom:10px;position:relative}.ams-form .form-group{padding:5px 10px}.ams-form label.checkbox,.ams-form label.radio{padding-top:0}.ams-form label.input-file img.thumbnail{display:inline-block;margin:4px 10px 0 4px!important;padding:4px!important}.ams-form input.input-lg{height:44px;padding:10px 16px;font-size:17px;line-height:1.33}.ams-form input.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5}.ams-form input.input-xs{height:24px;padding:2px 10px;font-size:11px;line-height:1.5}.ams-form select.input-sm{height:30px;line-height:15px;font-size:12px}.ams-form select.input-sm+i{height:10px}.ams-form select.input-lg{height:44px;line-height:22px;font-size:17px}.ams-form select.input-lg+i{height:11px;top:17px}.ams-form .row{margin:0 -15px}.ams-form .row:after{display:table;content:'';clear:both}.ams-form .col-1{width:8.33%}.ams-form .col-2{width:16.66%}.ams-form .col-3{width:25%}.ams-form .col-4{width:33.33%}.ams-form .col-5{width:41.66%}.ams-form .col-6{width:50%}.ams-form .col-8{width:66.67%}.ams-form .col-9{width:75%}.ams-form .col-10{width:83.33%}.ams-form .col{float:left;min-height:1px;padding-right:15px;padding-left:15px;-webkit-box-sizing:border-box;box-sizing:border-box;-moz-box-sizing:border-box}@media screen and (max-width:600px){.ams-form .col{float:none;width:100%}}@media screen and (max-width:600px){.ams-form .col .label{text-align:left;padding-left:20px}}.ams-form footer{display:block;padding:7px 25px 15px;border-top:1px solid rgba(0,0,0,0.1);background:rgba(248,248,248,0.9)}.ams-form footer:after{display:table;clear:both;content:''}.ams-form footer .btn{float:right;height:31px;margin:10px 0 0 5px;padding:0 22px;font:300 15px/29px Ubuntu,Helvetica,Arial,sans-serif;cursor:pointer}.ams-form footer .btn.btn-info{float:left}.ams-form footer .submit-message{display:inline-block}.ams-form .message{display:none;color:#6fb679}.ams-form .message i{display:block;margin:0 auto 20px;width:81px;height:81px;border:1px solid #6fb679;border-radius:50%;font-size:30px;line-height:81px}.ams-form.submitted fieldset,.ams-form.submitted footer{display:none}.ams-form.submitted .message{display:block;padding:25px 30px;background:rgba(255,255,255,0.9);font:300 18px/27px Ubuntu,Helvetica,Arial,sans-serif;text-align:center}.ams-form .note{margin-top:6px;padding:0 1px;font-size:11px;line-height:15px;color:#999}.ams-form .note a{font-size:13px}.ams-form .note-success{color:#6fb679}.ams-form .control-label{display:block;margin-top:4px;margin-bottom:6px;padding-top:0;line-height:19px;font-weight:400;font-size:13px;color:#666;text-align:right}@media screen and (max-width:992px){.ams-form .control-label{text-align:left;margin-bottom:0}}.ams-form .control-label.col{text-align:right}@media screen and (max-width:600px){.ams-form .control-label.col{text-align:left;padding-left:20px}}.ams-form .control-label span{margin-right:10px}.ams-form .control-label span::after{content:" *";color:transparent}.ams-form .control-label span>.hint{margin-top:-2px}.ams-form .control-label .col{margin:0;padding-top:7px}.ams-form label.input span.textline-field{display:block;margin-top:4px;margin-bottom:6px;padding-top:0;line-height:19px;font-size:13px}.ams-form .required-field .control-label span::after{color:red}.ams-form .tooltip{position:absolute;z-index:99999;left:-9999px;padding:2px 8px 3px;font-size:11px;line-height:16px;font-weight:400;background:rgba(0,0,0,0.9);color:#fff;opacity:0;transition:margin .3s,opacity .3s;-webkit-transition:margin .3s,opacity .3s}.ams-form .tooltip:after{position:absolute;content:''}.ams-form .tooltip-top-right{bottom:100%;margin-bottom:15px}.ams-form .tooltip-top-right:after{top:100%;right:11px;border-top:4px solid rgba(0,0,0,0.9);border-right:4px solid transparent;border-left:4px solid transparent}.ams-form .input input:focus+.tooltip-top-right,.ams-form .textarea textarea:focus+.tooltip-top-right{right:0;left:auto;margin-bottom:5px}.ams-form .tooltip-top-left{bottom:100%;margin-bottom:15px}.ams-form .tooltip-top-left:after{top:100%;left:11px;border-top:4px solid rgba(0,0,0,0.9);border-right:4px solid transparent;border-left:4px solid transparent}.ams-form .input input:focus+.tooltip-top-left,.ams-form .textarea textarea:focus+.tooltip-top-left{right:auto;left:0;margin-bottom:5px}.ams-form .tooltip-right{top:4px;white-space:nowrap;margin-left:15px}.ams-form .tooltip-right:after{top:6px;right:100%;border-top:4px solid transparent;border-right:4px solid rgba(0,0,0,0.9);border-bottom:4px solid transparent}.ams-form .input input:focus+.tooltip-right,.ams-form .textarea textarea:focus+.tooltip-right{left:100%;margin-left:5px}.ams-form .tooltip-left{top:4px;white-space:nowrap;margin-right:15px}.ams-form .tooltip-left:after{top:6px;left:100%;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid rgba(0,0,0,0.9)}.ams-form .input input:focus+.tooltip-left,.ams-form .textarea textarea:focus+.tooltip-left{right:100%;left:auto;margin-right:5px}.ams-form .tooltip-bottom-right{top:100%;margin-top:15px}.ams-form .tooltip-bottom-right:after{bottom:100%;right:11px;border-right:4px solid transparent;border-bottom:4px solid rgba(0,0,0,0.9);border-left:4px solid transparent}.ams-form .input input:focus+.tooltip-bottom-right,.ams-form .textarea textarea:focus+.tooltip-bottom-right{right:0;left:auto;margin-top:5px}.ams-form .tooltip-bottom-left{top:100%;margin-top:15px}.ams-form .tooltip-bottom-left:after{bottom:100%;left:11px;border-right:4px solid transparent;border-bottom:4px solid rgba(0,0,0,0.9);border-left:4px solid transparent}.ams-form .input input:focus+.tooltip-bottom-left,.ams-form .textarea textarea:focus+.tooltip-bottom-left{right:auto;left:0;margin-top:5px}.ams-form .inline-group{margin:0 -30px -4px 0}.ams-form .inline-group:after{content:'';display:table;clear:both}.ams-form .inline-group .checkbox,.ams-form .inline-group .radio{float:left;margin-right:30px}.ams-form .inline-group .checkbox:last-child,.ams-form .inline-group .radio:last-child{margin-bottom:4px}.ams-form .input .inline-group{margin:0 0 -4px 0}.ams-form .btn{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.ams-form .button{float:right;height:31px;overflow:hidden;margin:10px 0 0 5px;padding:0 25px;outline:0;border:0;font:300 15px/31px Ubuntu,Helvetica,Arial,sans-serif;text-decoration:none;color:#fff;cursor:pointer;background-color:#3276b1;opacity:.8;transition:opacity .2s;-webkit-transition:opacity .2s}.ams-form .button:hover{opacity:1}.ams-form .button.button-secondary{background-color:#b3b3b3}.ams-form .button,.ams-form .checkbox,.ams-form .input,.ams-form .radio,.ams-form .select,.ams-form .textarea,.ams-form .toggle{display:block;position:relative;font-weight:400}.ams-form .input input,.ams-form .select select,.ams-form .textarea textarea{display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;width:100%;height:28px;padding:6px 8px;outline:0;border-width:1px;border-style:solid;border-radius:0;background:#fff;font:13px/16px Ubuntu,Helvetica,Arial,sans-serif;color:#404040;appearance:normal;-moz-appearance:none;-webkit-appearance:none}.ams-form .input input[readonly],.ams-form .select select[readonly],.ams-form .textarea textarea[readonly]{border-bottom:1px solid #ccc!important}.ams-form .input input.display-mode,.ams-form .select select.display-mode,.ams-form .textarea textarea.display-mode{border:0;padding:0;margin-top:2px;margin-bottom:3px;height:14px;line-height:1em}.ams-form .input input:focus+.tooltip,.ams-form .textarea textarea:focus+.tooltip{opacity:1}.ams-form .input .icon-prepend+input,.ams-form .textarea .icon-prepend+textarea{padding-left:37px}.ams-form .input .icon-append+input,.ams-form .textarea .icon-append+textarea{padding-right:37px}.ams-form .input .icon-prepend+.icon-append+input,.ams-form .textarea .icon-prepend+.icon-append+textarea{padding-left:37px}.ams-form .input.with-icons .icon-append-2+input{padding-right:60px}.ams-form .input-file{position:relative}.ams-form .input-file .button{position:absolute;top:3px;right:3px;float:none;height:22px;margin:0;padding:0 14px;font-size:13px;line-height:22px}.ams-form .input-file .button:hover{-webkit-box-shadow:none;box-shadow:none}.ams-form .input-file .button input{position:absolute;top:0;right:0;padding:0;font-size:30px;cursor:pointer;opacity:0}.ams-form .select select{padding:5px}.ams-form .select i{position:absolute;top:9px;right:11px;width:5px;height:11px;background:#fff}.ams-form .select i:before,.ams-form .select i:after{content:'';position:absolute;right:0;border-right:4px solid transparent;border-left:4px solid transparent}.ams-form .select i:before{top:0;border-bottom:4px solid #404040}.ams-form .select i:after{bottom:0;border-top:4px solid #404040}.ams-form .select-widget .selected-option{display:inline-block;padding:4px 8px}.ams-form .select-multiple select{height:auto}.ams-form .textarea textarea{height:auto;resize:none}.ams-form .textarea-resizable textarea{resize:vertical}.ams-form .textarea-expandable textarea{height:31px}.ams-form .textarea-expandable textarea:focus{height:auto}.ams-form .checkbox,.ams-form .radio{margin-bottom:4px;padding-left:25px;line-height:25px;color:#404040;cursor:pointer;font-size:13px}.ams-form .checkbox:last-child,.ams-form .radio:last-child{margin-bottom:0}.ams-form .checkbox i,.ams-form .radio i{display:block;position:absolute;top:3px;left:0;width:17px;height:17px;outline:0;border-width:1px;border-style:solid;background:#FFF}.ams-form .checkbox input,.ams-form .radio input{position:absolute;left:-9999px}.ams-form .checkbox input+i:after,.ams-form .radio input+i:after{position:absolute;opacity:0;transition:opacity .1s;-webkit-transition:opacity .1s}.ams-form .checkbox input:checked+i:after,.ams-form .radio input:checked+i:after{opacity:1}.ams-form .radio input+i:after{background-color:#3276b1}.ams-form .checkbox input+i:after{content:'\f00c';top:-1px;left:1px;width:15px;height:15px;font:400 16px/19px FontAwesome;text-align:center}.ams-form .checkbox input+i:after{color:#3276b1}.ams-form .checkbox input:checked:hover+i:after{content:'\f00d'}.ams-form .checkbox input:checked:disabled:hover+i:after{content:'\f00c'}.ams-form .radio input+i:after{content:'';top:4px;left:4px;width:9px;height:9px;border-radius:50%}.ams-form .checkbox+.checkbox,.ams-form .radio+.radio{margin-top:0}.ams-form.table td .checkbox i,.ams-form.table td .radio i,.ams-form.table th .checkbox i,.ams-form.table th .radio i{top:0!important}.ams-form .inner .checkbox{min-height:13px}.ams-form .inner .checkbox i{width:13px;height:13px}.ams-form .inner .checkbox input+i:after{width:11px;height:11px;font:300 12px/16px FontAwesome}.ams-form .toggle{margin-bottom:4px;padding-right:61px;font-size:15px;line-height:25px;color:#404040;cursor:pointer}.ams-form .toggle:last-child{margin-bottom:0}.ams-form .toggle.state-error input:checked+i{background:#fff0f0}.ams-form .toggle.state-success input:checked+i{background:#f0fff0}.ams-form .toggle input{position:absolute;left:-9999px}.ams-form .toggle input:checked+i:before{right:36px}.ams-form .toggle input:checked+i:after{content:attr(data-swchon-text);text-align:right}.ams-form .toggle i{display:block;position:absolute;content:'';top:4px;right:0;width:49px;height:17px;border-width:1px;border-style:solid;border-radius:12px;background:#fff}.ams-form .toggle i:before{display:block;position:absolute;content:'';z-index:1;top:4px;right:4px;width:9px;height:9px;border-radius:50%;opacity:1;transition:right .2s;-webkit-transition:right .2s;background-color:#3276b1}.ams-form .toggle i:after{position:absolute;content:attr(data-swchoff-text);top:2px;right:8px;left:8px;font-style:normal;font-size:9px;line-height:17px;font-weight:700;text-align:left;color:#5f5f5f}.ams-form .checkbox:hover i,.ams-form .radio:hover i,.ams-form .toggle:hover i{-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.1);box-shadow:inset 0 1px 1px rgba(0,0,0,0.1)}.ams-form .checkbox:active i,.ams-form .radio:active i,.ams-form .toggle:active i{background:#f0f0f0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.1);box-shadow:inset 0 1px 1px rgba(0,0,0,0.1)}.ams-form .checkbox input:checked+i,.ams-form .radio input:checked+i,.ams-form .toggle input:checked+i{border-color:#3276b1}.ams-form .rating{margin-bottom:4px;font-size:13px;line-height:25px;color:#404040}.ams-form .rating:last-child{margin-bottom:0}.ams-form .rating.state-error+em{margin-top:-4px;margin-bottom:4px}.ams-form .rating input{position:absolute;left:-9999px}.ams-form .rating input+label:hover,.ams-form .rating input+label:hover ~ label{color:#3276b1}.ams-form .rating input:checked ~ label{color:#3276b1}.ams-form .rating label{display:block;float:right;height:17px;margin-top:5px;padding:0 2px;font-size:17px;line-height:17px;cursor:pointer;color:#ccc;transition:color .3s;-webkit-transition:color .3s}.ams-form .icon-append,.ams-form .icon-prepend{position:absolute;top:4px;width:20px;height:20px;font-size:14px;line-height:20px;text-align:center;color:#a2a2a2}.ams-form .icon-append.fa-stack .fa-stack-2x,.ams-form .icon-prepend.fa-stack .fa-stack-2x{font-size:1.6em;left:1px}.ams-form .icon-append.fa-stack .fa-stack-1x,.ams-form .icon-prepend.fa-stack .fa-stack-1x{left:1px;top:1px}.ams-form .icon-append{right:4px;padding-left:2px;border-left-width:1px;border-left-style:solid}.ams-form .icon-append-2{right:31px}.ams-form .icon-prepend{left:4px;padding-right:2px;border-right-width:1px;border-right-style:solid}.ams-form .icon-prepend-2{left:31px}.ams-form .checkbox i,.ams-form .icon-append,.ams-form .icon-prepend,.ams-form .input input,.ams-form .radio i,.ams-form .select select,.ams-form .textarea textarea,.ams-form .toggle i{border-color:#ccc;transition:border-color .3s;-webkit-transition:border-color .3s}.ams-form .input.bordered:hover,.ams-form .checkbox:hover i,.ams-form .input:hover input,.ams-form .radio:hover i,.ams-form .select:hover select,.ams-form .textarea:hover textarea,.ams-form .toggle:hover i{border-color:rgba(82,168,236,0.7)}.ams-form .checkbox input:focus+i,.ams-form .input input:focus,.ams-form .radio input:focus+i,.ams-form .select select:focus,.ams-form .textarea textarea:focus,.ams-form .toggle input:focus+i{border-color:rgba(82,168,236,0.7);outline:0;outline:thin dotted 9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.7);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.7);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.7)}.ams-form .checkbox.state-error i,.ams-form .radio.state-error i,.ams-form .state-error input,.ams-form .state-error select,.ams-form .state-error textarea,.ams-form .toggle.state-error i{background:#fff0f0;border-color:rgba(255,60,60,0.8)!important}.ams-form .checkbox.state-error i:focus,.ams-form .radio.state-error i:focus,.ams-form .state-error input:focus,.ams-form .state-error select:focus,.ams-form .state-error textarea:focus,.ams-form .toggle.state-error i:focus{-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(255,60,60,0.6)!important;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(255,60,60,0.6)!important;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(255,60,60,0.6)!important}.ams-form .state-error .select2-container .select2-choice,.ams-form .state-error .select2-container .select2-choices{border-color:rgba(255,60,60,0.8)!important}.ams-form .state-error .select2-container .select2-choice:focus,.ams-form .state-error .select2-container .select2-choices:focus{-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(255,60,60,0.6)!important;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(255,60,60,0.6)!important;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(255,60,60,0.6)!important}.ams-form .checkbox.state-success i,.ams-form .radio.state-success i,.ams-form .state-success input,.ams-form .state-success select,.ams-form .state-success textarea,.ams-form .toggle.state-success i{background:#f0fff0;border-color:#7dc27d}.ams-form .button.state-disabled,.ams-form .checkbox.state-disabled,.ams-form .input.state-disabled input,.ams-form .radio.state-disabled,.ams-form .select.state-disabled,.ams-form .textarea.state-disabled,.ams-form .toggle.state-disabled{cursor:default!important;opacity:.6!important}.ams-form .checkbox.state-disabled:hover i,.ams-form .input.state-disabled:hover input,.ams-form .radio.state-disabled:hover i,.ams-form .select.state-disabled:hover select,.ams-form .textarea.state-disabled:hover textarea,.ams-form .toggle.state-disabled:hover i{border-color:#e5e5e5!important}.ams-form .state-disabled.checkbox input+i:after,.ams-form .state-disabled.checkbox input:checked+i,.ams-form .state-disabled.radio input+i:after,.ams-form .state-disabled.radio input:checked+i,.ams-form .state-disabled.toggle input:checked+i{border-color:#e5e5e5!important;color:#333!important}.ams-form .ui-widget-content .ui-spinner-input{margin:0;border:0;-webkit-box-shadow:none!important;box-shadow:none!important;height:29px}.ams-form .state-error{color:#d56161}.ams-form .state-error select+i{background:#fff0f0;-webkit-box-shadow:0 0 0 9px #fff0f0;box-shadow:0 0 0 9px #fff0f0}.ams-form .state-error+em{display:block;margin-top:6px;padding:0 1px;font-style:normal;font-size:11px;line-height:15px;color:#d56161}.ams-form .state-success select+i{background:#f0fff0;-webkit-box-shadow:0 0 0 9px #f0fff0;box-shadow:0 0 0 9px #f0fff0}.ams-form .state-disabled.radio input+i:after{background-color:#333}.ams-form .form-tiny .form-group{padding:0 10px}.ams-form .form-tiny .control-label{margin-top:2px;margin-bottom:3px;line-height:14px}.ams-form .form-tiny label.input span.textline-field{margin-top:2px;margin-bottom:3px;line-height:14px}.ams-form .form-nomargin .control-label,.ams-form.form-nomargin .control-label{margin-top:0;margin-bottom:0}.ams-form .form-nomargin label.input span.textline-field,.ams-form.form-nomargin label.input span.textline-field{margin-top:0;margin-bottom:0}.ams-form .form-nopadding .form-group,.ams-form.form-nopadding .form-group{padding:0 10px 1px}.ams-form-modal{position:fixed;z-index:1;display:none;width:400px}.ams-form-modal-overlay{position:fixed;top:0;left:0;display:none;width:100%;height:100%;background:rgba(0,0,0,0.7)}.state-error .icon-append,.state-error .icon-prepend{color:#ed1c24}.editableform{margin-bottom:0}.editableform .control-group{margin-bottom:0;white-space:nowrap}.editableform .editable-date{padding:0;margin:0;float:left}.editableform-loading{background:url(../img/loading.gif) center center no-repeat;height:25px;width:auto;min-width:25px}.editable-buttons{display:inline-block;vertical-align:top;margin-left:7px;zoom:1;*display:inline}.editable-buttons.editable-buttons-bottom{display:block;margin-top:7px;margin-left:0}.editable-buttons .editable-cancel{margin-left:7px}.editable-buttons button.ui-button-icon-only{height:24px;width:30px}.editable-inline .add-on .icon-th{margin-top:3px;margin-left:1px}.editable-inline .editableform-loading{background-position:left 5px}.editable-input{vertical-align:top;display:inline-block;width:auto;white-space:normal;zoom:1;*display:inline}.editable-input .datepicker{top:0;left:0;padding:4px}.editable-input .datepicker: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}.editable-input .datepicker:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;position:absolute;top:-6px;left:7px}.editable-input .datepicker>div{display:none}.editable-input .datepicker table{width:100%;min-width:214px;margin:0}.editable-input .datepicker thead tr:first-child th{cursor:pointer}.editable-input .datepicker thead tr:first-child th:hover{background:#eee}.editable-input .datepicker td,.editable-input .datepicker th{text-align:center;width:24px;height:20px}.editable-input .datepicker th.switch{width:145px}.editable-input .datepicker th.next,.editable-input .datepicker th.prev{font-size:19.5px}.editable-input .datepicker td span{display:block;width:47px;height:54px;line-height:54px;float:left;margin:2px;cursor:pointer}.editable-input .datepicker td span:hover{background:#eee}.editable-input .datepicker td span.active{background:#3276b1;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);border-radius:3px}.editable-input .datepicker td span.old{color:#555}.editable-input .datepicker td.day:hover{background:#eee;cursor:pointer}.editable-input .datepicker td.day.disabled,.editable-input .datepicker td.new,.editable-input .datepicker td.old{color:#555}.editable-input .datepicker td.active,.editable-input .datepicker td.active:hover{background:#3276b1;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);border-radius:3px}.editable-input .datepicker.prev i,.editable-input .datepicker.next i{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:14px}.editable-input .datepicker.prev i:before{content:"\f060"}.editable-input .datepicker.next i:before{content:"\f061"}.editable-checklist label{white-space:nowrap}.editable-checklist label input[type=checkbox],.editable-checklist label span{vertical-align:middle;margin:0}.editable-wysihtml5{width:566px;height:250px}.editable-pre-wrapped{white-space:pre-wrap}.editable-container.editable-popup{max-width:none!important}.editable-container.popover{width:auto}.editable-container.editable-inline{display:inline-block;vertical-align:middle;width:auto;zoom:1;*display:inline}.editable-container.ui-widget{font-size:inherit;z-index:9990}.editable-click,a.editable-click,a.editable-click:hover{text-decoration:none;border-bottom:dashed 1px #08c}.editable-click.editable-disabled,a.editable-click.editable-disabled,a.editable-click.editable-disabled:hover{color:#585858;cursor:default;border-bottom:0}.editable-empty,.editable-empty:focus,.editable-empty:hover{font-style:italic;color:#D14;text-decoration:none}.editable-unsaved{font-weight:700}.editable-bg-transition{-webkit-transition:background-color 1400ms ease-out;transition:background-color 1400ms ease-out}.form-horizontal .editable{padding-top:5px;display:inline-block}.editable-address{display:block;margin-bottom:5px}.editable-address span{width:70px;display:inline-block}.editable-clear{clear:both;font-size:.9em;text-decoration:none;text-align:right}.editable-clear-x{background:url(../img/clear.png) center center no-repeat;display:block;width:13px;height:13px;position:absolute;opacity:.6;z-index:100;top:50%;right:6px;margin-top:-6px}.editable-clear-x:hover{opacity:1}.editable-error-block{max-width:300px;margin:5px 0 0;width:auto;white-space:normal}.editable-error-block.ui-state-error{padding:3px}.editable-error{color:red}.input-append.date .add-on i,.input-prepend.date .add-on i{display:block;cursor:pointer;width:16px;height:16px}.ui-timepicker-div .ui-widget-header{margin-bottom:8px}.ui-timepicker-div dl{text-align:left}.ui-timepicker-div dl dt{float:left;clear:left;padding:0 0 0 5px}.ui-timepicker-div dl dd{margin:17px 10px 12px 40%}.ui-timepicker-div td{font-size:90%}.ui-tpicker-grid-label{background:0;border:0;margin:0;padding:0}.ui-timepicker-rtl{direction:rtl}.ui-timepicker-rtl dl{text-align:right;padding:0 5px 0 0}.ui-timepicker-rtl dl dt{float:right;clear:right}.ui-timepicker-rtl dl dd{margin:0 40% 10px 10px}#login{background:#fff;overflow:visible}#login .container{border:0}#login #header{margin:0;height:71px;border-bottom:1px solid #eee!important;overflow:hidden;padding:0 30px;-webkit-background-clip:padding-box;border-width:0;min-height:28px;background:#f4f4f4!important;margin-bottom:20px}@media(min-width:768px) and (max-width:880px){#login #header{padding:0 5px!important}}@media only screen and (min-width:0) and (max-width:679px){#login #header{padding:0 5px!important}}#login #header #logo{margin-top:22px;margin-left:0}@media only screen and (min-width:0) and (max-width:679px){#login #header #logo{margin-top:22px}}#login #header #logo img{width:137px}@media only screen and (min-width:0) and (max-width:679px){#login #header #logo img{width:135px}}#login-header-space{float:right;text-align:right;display:block;vertical-align:middle;line-height:71px}#login-header-space>:first-child{font-size:13px;margin-right:14px;vertical-align:-3px;font-weight:400}#login-header-space>*{display:inline-block}#login-header-space .btn{font-weight:700;text-transform:uppercase}#login #main{background:#fff;margin:0}#login .hero{background-image:url(../img/gradient/login.png);background-repeat:no-repeat;background-position:0 137px;height:360px;width:100%;float:left}#login h4.paragraph-header{color:#565656;font-size:15px;font-weight:400;line-height:22px;margin-top:15px;width:270px}#login h5.about-heading{color:#565656;font-size:15px;font-weight:700;line-height:24px;margin:0 0 5px}#login .login-header-big{font-weight:400}#login .login-desc-box-l{min-height:350px;width:50%}#login .login-app-icons{vertical-align:top;margin-top:90px;width:300px}.bootstrapWizard{display:block;list-style:none;padding:0;position:relative;width:100%}.bootstrapWizard a:active,.bootstrapWizard a:focus,.bootstrapWizard a:hover{text-decoration:none}.bootstrapWizard li{display:block;float:left;width:25%;text-align:center;padding-left:0}.bootstrapWizard li:before{border-top:3px solid #55606e;content:"";display:block;font-size:0;overflow:hidden;position:relative;top:11px;right:1px;width:100%;z-index:1}.bootstrapWizard li:first-child:before{left:50%;max-width:50%}.bootstrapWizard li:last-child:before{max-width:50%;width:50%}.bootstrapWizard li .step{background:#b2b5b9;color:#fff;display:inline;font-size:15px;font-weight:700;padding:7px 13px;border:3px solid transparent;border-radius:50%;line-height:normal;position:relative;text-align:center;z-index:2;-webkit-transition:all .1s linear 0s;transition:all .1s linear 0s}.bootstrapWizard li .step i{font-size:10px;font-weight:400;position:relative;top:-1.5px}.bootstrapWizard li.complete .step{background:#0aa66e;padding:1px 6px;border:3px solid #55606e}.bootstrapWizard li.active .step,.bootstrapWizard li.active.complete .step{background:#0091d9;color:#fff;font-weight:700;padding:7px 13px;font-size:15px;border-radius:50%;border:3px solid #55606e}.bootstrapWizard li .title{color:#bfbfbf;display:block;font-size:13px;line-height:15px;max-width:100%;position:relative;table-layout:fixed;text-align:center;top:20px;word-wrap:break-word;z-index:104}.bootstrapWizard li.active .title,.bootstrapWizard li.complete .title{color:#2b3d53}.wizard-actions{display:block;list-style:none;padding:0;position:relative;width:100%}.wizard-actions li{display:inline}.fuelux .wizard{position:relative;overflow:hidden;background-color:#f9f9f9;border:1px solid #d4d4d4;border-radius:4px;*zoom:1;-webkit-box-shadow:0 1px 4px rgba(0,0,0,0.065);box-shadow:0 1px 4px rgba(0,0,0,0.065)}.fuelux .wizard:after,.fuelux .wizard:before{display:table;line-height:0;content:""}.fuelux .wizard:after{clear:both}.fuelux .wizard ul{width:4000px;padding:0;margin:0;list-style:none outside none}.fuelux .wizard ul.previous-disabled li.complete{cursor:default}.fuelux .wizard ul.previous-disabled li.complete:hover{color:#356e35;cursor:default;background:#f3f4f5}.fuelux .wizard ul.previous-disabled li.complete:hover .chevron:before{border-left-color:#f3f4f5}.fuelux .wizard ul li{position:relative;float:left;height:46px;padding:0 20px 0 30px;margin:0;font-size:16px;line-height:46px;color:#999;cursor:default;background:#ededed}.fuelux .wizard ul li:first-child{padding-left:20px;border-radius:4px 0 0 4px}.fuelux .wizard ul li.complete{color:#296829;background:#f3f4f5}.fuelux .wizard ul li.complete:hover{cursor:pointer;background:#e7eff8}.fuelux .wizard ul li.complete:hover .chevron:before{border-left:14px solid #e7eff8}.fuelux .wizard ul li.complete .chevron:before{border-left:14px solid #f3f4f5}.fuelux .wizard ul li.active{color:#3a87ad;background:#f1f6fc}.fuelux .wizard ul li.active .chevron:before{border-left:14px solid #f1f6fc}.fuelux .wizard ul li .chevron{position:absolute;top:0;right:-14px;z-index:1;display:block;border:24px solid transparent;border-right:0;border-left:14px solid #d4d4d4}.fuelux .wizard ul li .chevron:before{position:absolute;top:-24px;right:1px;display:block;border:24px solid transparent;border-right:0;border-left:14px solid #ededed;content:""}.fuelux .wizard ul li .badge{margin-right:8px}.fuelux .wizard .actions{position:absolute;right:0;z-index:2;float:right;padding-right:15px;padding-left:15px;line-height:46px;vertical-align:middle;background-color:#eee;border-left:1px solid #d4d4d4}.fuelux .wizard .actions a{margin-right:8px;font-size:12px;line-height:45px}.fuelux .wizard .actions .btn-prev i{margin-right:5px}.fuelux .wizard .actions .btn-next i{margin-left:5px}.fuelux .fuelux .step-content .step-pane{display:none}.fuelux .fuelux .step-content .active{display:block}.fuelux .fuelux .step-content .active .btn-group .active{display:inline-block}.ams-metro-tile{float:left;display:block;background-color:#fff;width:100px;height:70px;cursor:pointer;-webkit-box-shadow:inset 0 0 1px #FFC;box-shadow:inset 0 0 1px #FFC;border:1px dotted #c5c5c5;text-decoration:none;color:#fff;font-weight:300;font-smooth:always;margin:0 10px 20px 0;padding:5px;position:relative}.ams-metro-tile:hover{z-index:10;-webkit-transform:scale(1.07);-moz-transform:scale(1.07)}.ams-metro-tile.big-cubes{width:120px;height:120px}.ams-metro-tile.double{width:249px}.ams-metro-tile:active{top:1px;left:1px}.ams-metro-tile .iconbox{text-align:center}.ams-metro-tile .iconbox i{display:block;margin:15px auto 0;height:75px}.ams-metro-tile .iconbox span{display:block;text-align:left;line-height:1em}.ams-metro-tile .iconbox span>span{position:absolute;right:-5px;bottom:-10px;border-radius:50%;padding:6px 4px 3px;border:1px solid #fff}.client-form header{padding:15px 13px;margin:0;border-bottom-style:solid;border-bottom-color:rgba(0,0,0,0.1);background:rgba(248,248,248,0.9)}.customfile-button{padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid #ccc;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.btn,a:link,button{-webkit-tap-highlight-color:rgba(169,3,41,0.5)}button{background-color:#ddd}button:hover{background-color:#ccc}.btns{margin:0;padding:0;list-style:none}.btns>li{display:inline-block;margin-bottom:7px}.btn{padding:6px 12px;border-radius:2px;box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05);-webkit-box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05)}.btn-toolbar .btn{padding:4px}.btn:active{position:relative;top:1px;left:1px}.btn.btn-ribbon{background-color:#5b6771;color:#fff;padding:1px 5px;line-height:20px;vertical-align:middle;height:21px;display:block;border:0;float:left;margin:0 8px 0 0;cursor:pointer}.btn.btn-ribbon>i{font-size:111%}.btn-xs{padding:1px 5px;line-height:1.3em}.btn-sm{padding:3px 10px}.btn-lg{padding:9px 15px}.btn-xl{padding:11px 15px}.btn-circle{width:30px;height:30px;text-align:center;padding:7px 0 5px;font-size:12px;line-height:18px;border-radius:50%}.btn-circle.btn-lg{width:50px;height:50px;padding:9px 15px 7px;font-size:18px;line-height:30px;border-radius:50%}.btn-circle.btn-xl{width:70px;height:70px;padding:11px 15px 9px;font-size:24px;line-height:50px;border-radius:50%}.btn-metro{margin:0 0 20px;padding-top:15px;padding-bottom:15px}.btn-metro>span{display:block;vertical-align:bottom;margin-top:10px;text-transform:uppercase}.btn-metro>span>span.label{position:absolute;top:0;right:0}.btn-label{position:relative;left:-12px;display:inline-block;padding:7px 12px 5px;background:rgba(0,0,0,0.15);border-radius:3px 0 0 3px}.btn-labeled{padding-top:0;padding-bottom:0}.btn-select-tick i{display:none}.btn-select-tick .btn:hover i{opacity:.3;display:block}.btn-select-tick .active i{display:block;opacity:1!important}.btn-header.pull-right{margin-left:6px}@media(min-width:768px) and (max-width:979px){.btn-header a{margin-top:9px!important}}@media(min-width:768px) and (max-width:880px){.btn-header a{margin-top:9px!important;line-height:26px!important}}@media(max-width:767px){.btn-header a{margin-top:5px!important;width:40px!important;height:39px!important;line-height:34px!important}}@media only screen and (min-width:0) and (max-width:679px){.btn-header a{margin-top:5px!important;width:40px!important;height:39px!important;line-height:34px!important}}@media only screen and (min-width:320px) and (max-width:479px){.btn-header a{margin-top:5px!important;width:40px!important;height:39px!important;line-height:34px!important}}.btn-header a>span{font-size:13px;font-weight:400;line-height:30px;height:30px;display:inline-block}@media(min-width:768px) and (max-width:880px){.btn-header.transparent a{border:0!important;background:0;margin-left:0;width:25px!important;-webkit-box-shadow:none!important;box-shadow:none!important}.btn-header.transparent a:hover{color:#a90329}}@media(max-width:767px){.btn-header.transparent a:hover{color:#a90329}}@media only screen and (min-width:0) and (max-width:679px){.btn-header.transparent a{border:0!important;background:0;margin-left:0;width:25px!important;-webkit-box-shadow:none!important;box-shadow:none!important}.btn-header.transparent a:hover{color:#a90329}}@media only screen and (min-width:320px) and (max-width:479px){.btn-header.transparent a{border:0!important;background:0;margin-left:0;width:25px!important;-webkit-box-shadow:none!important;box-shadow:none!important}.btn-header.transparent a:hover{color:#a90329}}.btn-header>:first-child>a{border-radius:2px;cursor:default!important;display:inline-block;font-weight:700;height:30px;min-width:30px;padding:3px;text-align:center;text-decoration:none!important;-moz-user-select:none;-webkit-user-select:none;background-color:#f8f8f8;background-image:-webkit-gradient(linear,left top,left bottom,from(#f8f8f8),to(#f1f1f1));background-image:-webkit-gradient(linear,top left,bottom left,from(#f8f8f8),to(#f1f1f1));background-image:-webkit-linear-gradient(top,#f8f8f8,#f1f1f1);background-image:linear-gradient(top,#f8f8f8,#f1f1f1);border:1px solid #bfbfbf;color:#6d6a69;font-size:17px;margin:10px 0 0}.btn-header>:first-child>a:hover{border:1px solid #bfbfbf;color:#222;-webkit-transition:all 0s;transition:all 0s;cursor:pointer;-webkit-box-shadow:inset 0 0 4px 1px rgba(0,0,0,0.08);box-shadow:inset 0 0 4px 1px rgba(0,0,0,0.08)}.btn-header>:first-child>a:active{background-color:#e8e8e8;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#e8e8e8),color-stop(100%,#ededed));background-image:-webkit-gradient(linear,top left,bottom left,from(#e8e8e8),to(#ededed));background-image:-webkit-linear-gradient(top,#e8e8e8 0,#ededed 100%);background-image:linear-gradient(to bottom,#e8e8e8 0,#ededed 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e8e8e8',endColorstr='#ededed',GradientType=0);-webkit-box-shadow:inset 0 0 3px 1px rgba(0,0,0,0.15);box-shadow:inset 0 0 3px 1px rgba(0,0,0,0.15)}.ribbon-button-alignment{padding-top:10px;display:inline-block}.ribbon-button-alignment.pull-right>.btn.btn-ribbon{margin:0 0 0 8px}.header-btn{margin-top:5px}.widget-header>:first-child{margin:13px 0}.widget-toolbar{display:inline-block;position:relative;float:right;width:auto;height:29px;line-height:29px;border-left:1px solid rgba(0,0,0,0.09);cursor:pointer;padding:0 8px;text-align:center}.widget-toolbar.no-border{border-left:0}.widget-toolbar>:first-child{text-align:left}.widget-toolbar .ams-form label.checkbox,.widget-toolbar .ams-form label.radio{line-height:29px}.widget-toolbar .ams-form .icon-append,.widget-toolbar .ams-form .icon-prepend{top:3px!important}.widget-toolbar.ams-form .icon-append,.widget-toolbar.ams-form .icon-prepend{top:3px!important}.widget-toolbar>.ams-form{margin-top:2px}.widget-toolbar>.ams-form .toggle:last-child{font-size:12px;line-height:29px}.widget-toolbar>.ams-form .checkbox input+i,.widget-toolbar>.ams-form .radio input+i,.widget-toolbar>.ams-form .toggle input+i{border-width:1px;border-color:#c7c7c7!important;margin-top:-1px;-webkit-box-shadow:0 1px 1px #FFF,0 1px 1px #858585 inset;box-shadow:0 1px 1px #FFF,0 1px 1px #858585 inset}.widget-toolbar .btn-group{margin-top:-3px}.widget-toolbar>.btn{margin-top:-3px;font-size:12px!important;padding:1px 8px!important}.widget-toolbar>.label{display:inline-block;vertical-align:middle;margin-top:-3px;text-align:center;font-size:12px;padding:4px 7px}.widget-toolbar>.badge{padding:5px;font-size:14px;border-radius:50%;font-weight:400;min-width:24px;text-align:center!important}.widget-toolbar .progress{width:130px;margin:7px 0 0;height:18px!important;font-size:12px;box-shadow:0 1px 0 rgba(0,0,0,0),0 0 0 1px #d1d1d1 inset;-webkit-box-shadow:0 1px 0 rgba(0,0,0,0),0 0 0 1px #d1d1d1 inset}.widget-toolbar .progress-bar{font-size:12px}.widget-toolbar .pagination{margin:4px 0}.widget-toolbar .pagination>li>a{padding:2px 7px}.widget-toolbar .widget-text-input{max-width:220px}.widget-toolbar input[type=text]{height:28px!important;margin-top:2px}.widget-body.no-padding{padding:0;margin:0}.widget-body.no-padding .alert{margin:5px 5px 0;padding:10px;box-shadow:none!important;-webkit-box-shadow:none!important;border-radius:0!important}.widget-body>table{margin-bottom:0}.widget-body-ajax-loading::before{display:block;position:absolute;content:url(../img/ajax-loader.gif);padding-top:18%;text-align:center;font-weight:700;font-size:16px;color:#fff;background:rgba(255,255,255,0.4);height:100%;z-index:1;width:100%}.widget-body-ajax-loading:hover{cursor:wait!important}.widget-body-toolbar,.ams-form.widget-body-toolbar{display:block;padding:8px 10px;margin:-13px -13px 13px;min-height:42px;border-bottom:1px solid #ccc;background:#fafafa}.no-padding .widget-body-toolbar,.no-padding .ams-form.widget-body-toolbar,.no-padding.widget-body-toolbar,.no-padding.ams-form.widget-body-toolbar{display:block;margin:0}.ams-form .widget-body-toolbar .inline-group,.widget-body-toolbar.ams-form .inline-group{float:left;margin-top:4px}.widget-body-toolbar .btn{vertical-align:middle}.widget-body-toolbar .btn-xs{margin-top:5px}.no-widget-toolbar .widget-body-toolbar{display:none}.widget-content-padding{padding:20px}.widget-content-padding .well{margin-bottom:0}.widget-footer{display:block;position:relative;min-height:32px;vertical-align:middle;margin:0 -13px -13px;padding:5px;border-top:1px solid #e4e4e4;text-align:right;background-color:#f8f7f7}.no-padding .widget-footer{margin:0}.widget-footer.ams-form>label{margin-top:4px;display:block}.ams-widget{position:relative;margin:0 0 15px;padding:0;-khtml-border-radius:0;border-radius:0}.ams-widget header .nav-tabs{border-bottom-color:transparent}.ams-widget header .nav-tabs>li>a{border-radius:0;border:0;padding:5px 15px 4px}.ams-widget header .nav-tabs>li.active>a,.ams-widget header .nav-tabs>li.active>a:focus,.ams-widget header .nav-tabs>li.active>a:hover{color:#555;background-color:#FFF;border:1px solid #c2c2c2;border-bottom-color:transparent;border-top:0;cursor:default}.ams-widget header:first-child .nav-tabs{float:left}.ams-widget header:first-child .nav-tabs li{padding-left:0}.ams-widget header:first-child .nav-tabs li a{color:#333}.ams-widget header:first-child .nav-tabs.pull-right li:last-child a{margin-right:0!important;border-right:0!important}.ams-widget header .nav-pills{margin:3px}.ams-widget header .nav-pills>li>a{padding:3px 5px 4px}.ams-widget header>.btn-group{margin-top:-13px;margin-left:5px}.ams-widget>header{height:30px;padding:0;line-height:40px;color:#333;border:1px solid #c2c2c2;background:#fafafa}.ams-widget>header h2{display:inline-block;position:relative;width:auto;height:100%;margin:0;font-size:14px;line-height:31px;font-weight:400;letter-spacing:0}@media only screen and (min-width:320px) and (max-width:479px){.ams-widget>header h2{width:135px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}}.rtl .ams-widget>header h2{float:right;text-align:right}.ams-widget>header>h2{margin-left:10px;float:left}.rtl .ams-widget>header{padding:0 7px 0 0}.ams-widget>header .widget-icon{display:block;float:left;width:16px;height:16px;margin:10px 10px 0 0;zoom:1;z-index:400}.rtl .ams-widget>header .widget-icon{float:right;margin:10px 0 0 7px}.ams-widget>header>.widget-icon{display:block;position:relative;float:left;margin:0 -10px 0 2px;width:28px;height:28px;font-size:111%;line-height:29px;text-align:center}.ams-widget>header>:first-child.widget-icon{margin-left:0}.ams-widget>div{position:relative;float:left;width:100%;font-size:13px;-khtml-border-radius:0;border-radius:0;margin:0;padding:13px 13px 0;background-color:#fff!important;border-width:1px 1px 2px;border-style:solid;border-top:0;border-right-color:#CCC!important;border-bottom-color:#CCC!important;border-left-color:#CCC!important}.ams-widget .widget-body{position:relative;min-height:100px;padding-bottom:13px}.ams-widget .widget-body.widget-hide-overflow{overflow:hidden}.ams-widget.well{margin:0 0 30px}.ams-widget.well header{display:none}.ams-widget.well>div{border:0!important;box-shadow:none!important;-webkit-box-shadow:none!important}.ams-widget.well.transparent .widget-body.no-padding{margin:0!important}.ams-widget-ctrls{width:auto;float:right;padding:0;margin:0}.ams-widget-ctrls a{display:inline-block;padding:0;margin:0;text-decoration:none;font-size:14px;text-align:center;line-height:29px;color:#333}.ams-widget-ctrls .button-icon{position:relative;float:left;min-width:28px;height:28px;font-family:Ubuntu,Arial,Helvetica,sans-serif;border-left:1px solid rgba(0,0,0,0.09)}.ams-widget-ctrls .button-icon :hover{background-color:rgba(0,0,0,0.05)}.rtl .ams-widget-ctrls .button-icon{margin:0 0 5px 5px}.rtl .ams-widget-ctrls{float:left;padding:10px 0 0 3px;margin:0}.ams-widget-loader{display:none;float:right;width:28px;height:28px;margin:0;text-align:center;line-height:28px;background-repeat:no-repeat;background-position:center center}.rtl .ams-widget-loader{float:left}.ams-widget-editbox{display:none;padding:10px;border-bottom:1px solid #b1b1b1;background-color:#fff;margin:-13px -13px 13px}.no-padding .ams-widget-editbox{margin:0 0 10px}.ams-widget,.ams-widget-editbox,.ams-widget>div{zoom:1}.ams-widget:after,.ams-widget-editbox:after,.ams-widget>div:after{clear:both}.ams-widget:before,.ams-widget-editbox:before,.ams-widget>div:before,.ams-widget:after,.ams-widget-editbox:after,.ams-widget>div:after{display:block;visibility:hidden;overflow:hidden;content:"\0020";height:0;font-size:0;line-height:0}.ui-sortable .ams-widget-sortable>header{cursor:move;line-height:normal;-khtml-border-radius:0;border-radius:0;-webkit-box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05);box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05)}.ui-sortable .ams-widget-sortable.ams-widget-collapsed>header{-khtml-border-radius:0;border-radius:0}.ams-widget-timestamp{margin:10px 0 0;color:#868686;font-size:12px;font-style:italic}.ams-widget-placeholder{margin-bottom:28px;padding:0;background-color:#FFC;border:1px dashed #a7a7a7;-khtml-border-radius:0;border-radius:0;-webkit-box-sizing:border-box;-khtml-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.ams-widget-remove-colors{color:#333!important;padding:0!important;background:none!important}.ams-widget-color-magenta>header{color:#fff;background:#6e3671;border-color:#6e3671!important}.ams-widget-color-magenta .nav-tabs li:not(.active) a,.ams-widget-color-magenta>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-magenta .nav-tabs li a:hover{color:#333!important}.ams-widget-color-pink>header{color:#fff;background:#ac5287;border-color:#ac5287!important}.ams-widget-color-pink .nav-tabs li:not(.active) a,.ams-widget-color-pink>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-pink .nav-tabs li a:hover{color:#333!important}.ams-widget-color-pinkDark>header{color:#fff;background:#a8829f;border-color:#a8829f!important}.ams-widget-color-pinkDark .nav-tabs li:not(.active) a,.ams-widget-color-pinkDark>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-pinkDark .nav-tabs li a:hover{color:#333!important}.ams-widget-color-yellow>header{color:#fff;background:#d4c737;border-color:#d4c737!important}.ams-widget-color-yellow .nav-tabs li:not(.active) a,.ams-widget-color-yellow>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-yellow .nav-tabs li a:hover{color:#333!important}.ams-widget-color-orange>header{color:#fff;background:#c79121;border-color:#c79121!important}.ams-widget-color-orange .nav-tabs li:not(.active) a,.ams-widget-color-orange>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-orange .nav-tabs li a:hover{color:#333!important}.ams-widget-color-orangeDark>header{color:#fff;background:#a57225;border-color:#a57225!important}.ams-widget-color-orangeDark .nav-tabs li:not(.active) a,.ams-widget-color-orangeDark>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-orangeDark .nav-tabs li a:hover{color:#333!important}.ams-widget-color-darken>header{color:#fff;background:#404040;border-color:#404040!important}.ams-widget-color-darken .nav-tabs li:not(.active) a,.ams-widget-color-darken>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-darken .nav-tabs li a:hover{color:#333!important}.ams-widget-color-purple>header{color:#fff;background:#65596b;border-color:#65596b!important}.ams-widget-color-purple .nav-tabs li:not(.active) a,.ams-widget-color-purple>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-purple .nav-tabs li a:hover{color:#333!important}.ams-widget-color-teal>header{color:#fff;background:#568a89;border-color:#568a89!important}.ams-widget-color-teal .nav-tabs li:not(.active) a,.ams-widget-color-teal>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-teal .nav-tabs li a:hover{color:#333!important}.ams-widget-color-blueDark>header{color:#fff;background:#4c4f53;border-color:#4c4f53!important}.ams-widget-color-blueDark .nav-tabs li:not(.active) a,.ams-widget-color-blueDark>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-blueDark .nav-tabs li a:hover{color:#333!important}.ams-widget-color-blue>header{color:#fff;background:#60747c;border-color:#60747c!important}.ams-widget-color-blue .nav-tabs li:not(.active) a,.ams-widget-color-blue>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-blue .nav-tabs li a:hover{color:#333!important}.ams-widget-color-blueLight>header{color:#fff;background:#ccdadf;border-color:#ccdadf!important}.ams-widget-color-blueLight .nav-tabs li:not(.active) a,.ams-widget-color-blueLight>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-blueLight .nav-tabs li a:hover{color:#333!important}.ams-widget-color-red>header{color:#fff;background:#931313;border-color:#931313!important}.ams-widget-color-red .nav-tabs li:not(.active) a,.ams-widget-color-red>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-red .nav-tabs li a:hover{color:#333!important}.ams-widget-color-redLight>header{color:#fff;background:#a65858;border-color:#a65858!important}.ams-widget-color-redLight .nav-tabs li:not(.active) a,.ams-widget-color-redLight>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-redLight .nav-tabs li a:hover{color:#333!important}.ams-widget-color-white>header{color:#c8c8c8;background:#dedede;border-color:#c8c8c8!important}.ams-widget-color-white .nav-tabs li:not(.active) a,.ams-widget-color-white>header>.ams-widget-ctrls a{color:#c8c8c8!important}.ams-widget-color-white .nav-tabs li a:hover{color:#838383!important}.ams-widget-color-greenDark>header{color:#fff;background:#496949;border-color:#496949!important}.ams-widget-color-greenDark .nav-tabs li:not(.active) a,.ams-widget-color-greenDark>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-greenDark .nav-tabs li a:hover{color:#333!important}.ams-widget-color-green>header{color:#fff;background:#356e35;border-color:#356e35!important}.ams-widget-color-green .nav-tabs li:not(.active) a,.ams-widget-color-green>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-green .nav-tabs li a:hover{color:#333!important}.ams-widget-color-greenLight>header{color:#fff;background:#71843f;border-color:#71843f!important}.ams-widget-color-greenLight .nav-tabs li:not(.active) a,.ams-widget-color-greenLight>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-greenLight .nav-tabs li a:hover{color:#333!important}#ams-widget-fullscreen-mode{position:fixed;width:100%;height:100%;top:0;left:0;z-index:99999}#ams-widget-fullscreen-mode .ams-widget{margin:0;-khtml-border-radius:0;border-radius:0}#ams-widget-fullscreen-mode>div{overflow-y:scroll;-khtml-border-radius:0;border-radius:0}#ams-widget-fullscreen-mode>div>header{cursor:default}.onoffswitch{position:relative;width:50px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;margin-top:3px;margin-bottom:3px;margin-left:5px;display:inline-block;vertical-align:middle}.onoffswitch-container{margin-top:4px;margin-left:7px;display:inline-block}.onoffswitch-checkbox{display:none}.onoffswitch-label{display:block;overflow:hidden;cursor:pointer;border:1px solid #626262;border-radius:50px;border-color:#adadad #b3b3b3 #9e9e9e;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.onoffswitch-inner{width:200%;margin-left:-100%;display:block}.onoffswitch-inner:after,.onoffswitch-inner:before{float:left;width:50%;height:15px;padding:0;line-height:17px;font-size:10px;font-family:Ubuntu,Trebuchet,Arial,sans-serif;font-weight:700;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.onoffswitch-inner:before{content:attr(data-swchon-text);text-shadow:0 -1px 0 #333;padding-left:7px;background-color:#3276b1;color:#fff;-webkit-box-shadow:inset 0 2px 6px rgba(0,0,0,0.5),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 6px rgba(0,0,0,0.5),0 1px 2px rgba(0,0,0,0.05);text-align:left}.onoffswitch-inner:after{content:attr(data-swchoff-text);padding-right:7px;text-shadow:0 -1px 0 #fff;background-color:#fff;color:#555;text-align:right;-webkit-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)}.onoffswitch-switch{width:19px;height:19px;margin:-2px;background:#fff;border:1px solid #9a9a9a;border-radius:50px;position:absolute;top:0;bottom:0;right:32px;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;background-color:#f4f4f4;background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#eee));background-image:-webkit-gradient(linear,top left,bottom left,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,#eee);background-image:linear-gradient(to bottom,#fff,#eee);background-repeat:repeat-x;-webkit-box-shadow:1px 1px 4px 0 rgba(0,0,0,0.3);box-shadow:1px 1px 4px 0 rgba(0,0,0,0.3)}.onoffswitch-checkbox+.onoffswitch-label .onoffswitch-switch:before,.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-switch:before{content:"\f00d";color:#a90329;display:block;text-align:center;line-height:19px;font-size:10px;text-shadow:0 -1px 0 #fff;font-weight:700;font-family:FontAwesome}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-switch:before{content:"\f00c";color:#57889c}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-inner{margin-left:0;display:block}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-switch{right:0}.onoffswitch-switch:hover{background-color:#eee}.onoffswitch-switch:active{background-color:#eee;-webkit-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)}.onoffswitch-checkbox:checked:disabled+.onoffswitch-label .onoffswitch-inner:before,.onoffswitch-checkbox:disabled+.onoffswitch-label .onoffswitch-inner:after{text-shadow:0 1px 0 #fff;background:#bfbfbf;color:#333}.onoffswitch-checkbox:checked:disabled+.onoffswitch-label .onoffswitch-switch,.onoffswitch-checkbox:disabled+.onoffswitch-label .onoffswitch-switch{background-color:#f4f4f4;background-image:-webkit-gradient(linear,0 0,0 100%,from(#bfbfbf),to(#f4f4f4));background-image:-webkit-gradient(linear,top left,bottom left,from(#bfbfbf),to(#f4f4f4));background-image:-webkit-linear-gradient(top,#bfbfbf,#f4f4f4);background-image:linear-gradient(to bottom,#bfbfbf,#f4f4f4);-webkit-box-shadow:none!important;box-shadow:none!important}.onoffswitch-checkbox:checked:disabled+.onoffswitch-label .onoffswitch-label,.onoffswitch-checkbox:disabled+.onoffswitch-label{border-color:#ababab #999 #878787!important}.onoffswitch-checkbox:checked+.onoffswitch-label{border-color:#3276b1 #2a6395 #255681}.onoffswitch+span,.onoffswitch-title{display:inline-block;vertical-align:middle;margin-top:-5px}label.with-icon .select2-parent{margin-right:27px}label.with-icons .select2-parent{margin-right:54px}.select2-container{margin:0;position:relative;display:inline-block;zoom:1;*display:inline;vertical-align:middle}.select2-container .select2-choice{display:block;height:26px;padding:0 0 0 8px;overflow:hidden;position:relative;border:1px solid #ccc;white-space:nowrap;line-height:26px;color:#444;text-decoration:none;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#fff}label.bordered .select2-container .select2-choice{border-color:transparent}.select2-container .select2-choice:hover{border:1px solid rgba(82,168,236,0.7)}.select2-container .select2-choice>.select2-chosen{margin-right:26px;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.select2-container .select2-choice>.select2-chosen abbr{display:none;width:12px;height:12px;position:absolute;right:24px;top:8px;font-size:1px;text-decoration:none;border:0;cursor:pointer;outline:0}.select2-container .select2-choice>.select2-chosen abbr:hover{cursor:pointer}.select2-container.select2-drop-above .select2-choice{border-bottom-color:#ccc}.select2-container.select2-allowclear .select2-choice .select2-chosen{margin-right:42px}.select2-container.select2-allowclear .select2-choice abbr{display:inline-block}.select2-container .select2-arrow{display:inline-block;width:20px;height:20px;position:absolute;right:3px;top:3px;padding:0 0 0 2px;border-left:1px solid #ccc;line-height:22px;-webkit-background-clip:padding-box}.select2-container .select2-arrow b{width:100%;height:100%;display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:relative;font-size:14px}.select2-container .select2-arrow b:before{content:"\f107";width:100%;height:100%;text-align:center;display:block}.select2-container,.select2-drop,.select2-search,.select2-search input{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.select2-container-active .select2-choice,.select2-container-active .select2-choices{border:1px solid rgba(82,168,236,0.7)!important;outline:0}.select2-drop-mask{border:0;margin:0;padding:0;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:9998;background:#fff;filter:alpha(opacity=0)}.select2-drop{margin-top:-1px;width:100%;position:absolute;z-index:9999;top:100%;background:#fff;color:#000;border:1px solid #ccc;border-top:0;-webkit-box-shadow:0 4px 5px rgba(0,0,0,0.15);box-shadow:0 4px 5px rgba(0,0,0,0.15)}.select2-drop.select2-drop-above{margin-bottom:0;border-top:1px solid rgba(82,168,236,0.7);border-top-width:3px;border-bottom:0;-webkit-box-shadow:0 -4px 5px rgba(0,0,0,0.15);box-shadow:0 -4px 5px rgba(0,0,0,0.15)}.select2-drop.select2-drop-above.select2-drop-active{border-top-width:3px}.select2-drop.select2-drop-above .select2-search input{margin-top:4px}.select2-drop.select2-drop-above .select2-search:before{top:34%}.select2-drop-auto-width{border-top:1px solid #ccc;width:auto}.select2-drop-auto-width .select2-search{padding-top:4px}.select2-drop-active{border:1px solid rgba(82,168,236,0.7);border-top:0;border-bottom-width:3px}.select2-search{display:inline-block;width:100%;min-height:26px;margin:0;padding-left:4px;padding-right:4px;position:relative;z-index:10000;white-space:nowrap}.select2-search:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:absolute;content:"\f002";top:25%;right:10px;color:#686868!important}.select2-search input{width:100%;height:auto!important;min-height:26px;padding:4px 20px 3px 5px;margin:0;outline:0;font-size:1em;border:1px solid #aaa;-webkit-box-shadow:none;box-shadow:none;background:#fff;background:-webkit-gradient(linear,left bottom,left top,color-stop(0.85,#fff),color-stop(0.99,#eee));background:-webkit-linear-gradient(center bottom,#fff 85%,#eee 99%);background:-webkit-gradient(linear,top left,bottom left,from(#fff),to(#eee));background:-webkit-linear-gradient(top,#fff 85%,#eee 99%);background:linear-gradient(top,#fff 85%,#eee 99%)}.select2-search input.select2-active{background-origin:padding-box;background:#fff url(../img/select2-spinner.gif) no-repeat right 24px top 50%;background:url(../img/select2-spinner.gif) no-repeat right 24px top 50%,-webkit-gradient(linear,left bottom,left top,color-stop(0.85,#fff),color-stop(0.99,#eee));background:url(../img/select2-spinner.gif) no-repeat right 24px top 50%,-webkit-linear-gradient(center bottom,#fff 85%,#eee 99%);background:url(../img/select2-spinner.gif) no-repeat right 24px top 50%,-webkit-gradient(linear,top left,bottom left,from(#fff),to(#eee));background:url(../img/select2-spinner.gif) no-repeat right 24px top 50%,-webkit-linear-gradient(top,#fff 85%,#eee 99%);background:url(../img/select2-spinner.gif) no-repeat right 24px top 50%,linear-gradient(top,#fff 85%,#eee 99%)}.select2-dropdown-open .select2-choice{border-bottom-color:transparent;-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset;border-bottom-left-radius:0;border-bottom-right-radius:0;background-color:#fff}.select2-dropdown-open.select2-drop-above .select2-choice,.select2-dropdown-open.select2-drop-above .select2-choices{border:1px solid #5d98cc;border-top-color:transparent}.select2-dropdown-open .select2-choice .select2-arrow{background:0;border-left:0;-webkit-filter:none;filter:none}.select2-dropdown-open .select2-choice .select2-arrow b{background-position:-18px 1px}.select2-results{max-height:200px;padding:0 0 0 4px;margin:4px 4px 4px 0;position:relative;overflow-x:hidden;overflow-y:auto;-webkit-tap-highlight-color:rgba(0,0,0,0)}.select2-results .select2-selected{opacity:.5}.select2-results ul.select2-result-sub{margin:0;padding-left:0}.select2-results ul.select2-result-sub>li .select2-result-label{padding-left:20px}.select2-results ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:40px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:60px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:80px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:100px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:110px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:120px}.select2-results li{list-style:none;display:list-item;background-image:none}.select2-results li.select2-result-with-children>.select2-result-label{font-weight:700}.select2-results .select2-result-label{padding:3px 7px 4px;margin:0;cursor:pointer;min-height:1em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.select2-results .select2-highlighted{background:#3276b1;color:#fff}.select2-results li em{background:#feffde;font-style:normal}.select2-results .select2-highlighted em{background:0}.select2-results .select2-highlighted ul{background:#fff;color:#000}.select2-results .select2-no-results,.select2-results .select2-searching,.select2-results .select2-selection-limit{background:#f4f4f4;display:list-item;padding:3px 5px;opacity:.5}.select2-results-results .select2-disabled{background:#f4f4f4;display:list-item;cursor:default}.select2-results-results .select2-disabled.select2-highlighted{color:#666;background:#f4f4f4;display:list-item;cursor:default}.select2-results-results .select2-selected{display:none}.select2-no-results{padding-left:20px}.select2-no-results:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f05a";margin-right:5px}.select2-more-results{background:#f4f4f4;display:list-item}.select2-more-results.select2-active{background:#f4f4f4 url(../img/select2-spinner.gif) no-repeat 100%}.select2-default{color:#999!important}.select2-container.select2-container-disabled .select2-choice{background-color:#f4f4f4;background-image:none;border:1px solid #ddd;cursor:default}.select2-container.select2-container-disabled .select2-choice .select2-arrow{background-color:#f4f4f4;background-image:none;border-left:0}.select2-container.select2-container-disabled .select2-choice abbr{display:none}.select2-container-multi.select2-container-active .select2-choices{border:1px solid rgba(82,168,236,0.7);outline:0}.select2-container-multi .select2-choices{height:auto!important;height:1%;min-height:26px;margin:0;padding:0;position:relative;border:1px solid #ccc;cursor:text;overflow:hidden;background-color:#fff}label.bordered .select2-container-multi .select2-choices{border-color:transparent}.select2-container-multi .select2-choices:hover{border:1px solid rgba(82,168,236,0.7)!important}label.bordered .select2-container-multi .select2-choices:hover{border-color:transparent!important}.select2-container-multi .select2-choices li{float:left;list-style:none}.select2-container-multi .select2-choices .select2-search-field{margin:0;padding:0;white-space:nowrap}.select2-container-multi .select2-choices .select2-search-field input{max-height:24px;padding:3px 5px;margin:1px 0;font-family:Ubuntu,sans-serif;font-size:100%;color:#666;outline:0;border:0;-webkit-box-shadow:none;box-shadow:none;background:transparent!important}.select2-container-multi .select2-choices .select2-search-field input.select2-active{background:#fff url(../img/select2-spinner.gif) no-repeat 99%!important}.select2-container-multi .select2-choices .select2-search-choice{padding:1px 28px 1px 8px;margin:2px 0 2px 2px;position:relative;line-height:18px;color:#fff;cursor:default;border:1px solid #2a6395;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#3276b1}.select2-container-multi .select2-choices .select2-search-choice .select2-chosen{cursor:default}.select2-container-multi .select2-choices .select2-search-choice-focus{opacity:.8}.select2-container-multi .select2-choices .select2-search-choice.ui-sortable-handle{cursor:move}.select2-container-multi.ordered .select2-choices li{float:none}.select2-container-multi.ordered .select2-choices li.ui-state-highlight{margin:2px 0 2px 2px;height:20px;background-color:#ddd;border:1px solid #ddd}.select2-container-multi .select2-search-choice-close{display:block;top:0;right:-2px;padding:3px 0 3px 6px}.select2-container-multi .select2-search-choice-close:hover{background:rgba(0,0,0,0.3)}.select2-container-multi.select2-container-disabled .select2-choices{background-color:#f4f4f4;background-image:none;border:1px solid transparent;border-bottom:1px solid #ccc;cursor:default}.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice{padding:1px 5px;border:1px solid #4a90cc;background-image:none;background-color:#86b4dd;cursor:not-allowed}.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close{display:none;background:0}.select2-locked{padding:3px 5px!important}.select2-search-choice-close{display:block;min-width:20px;min-height:14px;position:absolute;right:3px;top:3px;margin:0;padding:0;font-size:15px;text-decoration:none!important;font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.select2-search-choice-close:before{color:#fff;content:"\f057"}.select2-result-selectable .select2-match,.select2-result-unselectable .select2-match{text-decoration:underline}.select2-offscreen,.select2-offscreen:focus{clip:rect(0 0 0 0)!important;width:1px!important;height:1px!important;border:0!important;margin:0!important;padding:0!important;overflow:hidden!important;position:absolute!important;outline:0!important;left:0!important;top:0!important}.select2-display-none{display:none}.select2-measure-scrollbar{position:absolute;top:-10000px;left:-10000px;width:100px;height:100px;overflow:scroll}.select2-hidden-accessible{position:absolute;border:0;clip:rect(0 0 0 0);height:1px;width:1px;margin:-1px;overflow:hidden;padding:0}label.with-icon>i.icon-append+.select2-parent .select2-choices{padding-right:29px}.multiselect-container{position:absolute;list-style-type:none;margin:0;padding:0}.multiselect-container .input-group{margin:5px}.multiselect-container>li{padding:0}.multiselect-container>li>a.multiselect-all label{font-weight:700}.multiselect-container>li>a>label{margin:0;height:100%;cursor:pointer;font-weight:400}.multiselect-container>li>a>label.checkbox,.multiselect-container>li>a>label.radio{margin:0}.multiselect-container>li>a>label>input[type=checkbox]{margin-bottom:5px}.multiselect-container>li>label.multiselect-group{margin:0;padding:3px 20px;height:100%;font-weight:700}.btn-group>.btn-group:nth-child(2)>.multiselect.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.color-select{list-style:none;margin:0;padding:4px;min-width:166px;max-width:156px;right:-3px}.color-select li{display:block;margin:2px;float:left}.color-select li span{display:block;width:22px;height:22px;padding:0;background:#333;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;border:1px solid rgba(0,0,0,0.1);cursor:pointer}.color-select li span:hover{border:3px solid rgba(0,0,0,0.2)}.widget-toolbar .dropdown-menu.color-select{right:-1px}.color-box{display:block;position:relative;width:22px;height:22px;padding:0;background:#333;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;border:1px solid rgba(255,255,255,0.3)!important;cursor:pointer;vertical-align:middle;outline:1px solid rgba(0,0,0,0.1);background:rgba(255,255,255,0.3)!important}.color-box:hover,.open .color-box{outline:1px solid rgba(0,0,0,0.1)!important}.color-box:hover{-webkit-transform:scale(1.07);-moz-transform:scale(1.07)}.color-box:active{top:1px;left:1px}.widget-toolbar>.color-box{margin-top:7px;width:18px;height:18px;outline:1px solid rgba(0,0,0,0.2)}.widget-toolbar>.color-box:active,.widget-toolbar>.color-box:focus,.widget-toolbar>.color-box:hover{outline:1px solid rgba(0,0,0,0.25)!important}.ams-widget #calendar{margin-top:-18px}#calendar-buttons{position:absolute;right:14px;top:5px}#calendar-container{position:relative}#external-events>li{margin:6px 4px 6px 0;display:inline-block}#external-events>li>:first-child{padding:5px 10px 10px;cursor:move;display:block}#external-events>li>:first-child:after{color:#fff;color:rgba(255,255,255,0.7);content:attr(data-description);font-size:11px;font-weight:400;display:block;line-height:0;margin:7px 0;text-transform:lowercase}.fc{direction:ltr;text-align:left}.fc .fc-header-space{padding-left:10px}.fc table,html .fc{font-size:12px}.fc table{border-collapse:collapse;border-spacing:0}.fc th,.fc td{padding:0;vertical-align:top}.fc .ui-resizable-handle{display:block;position:absolute;z-index:99999;overflow:hidden;font-size:300%;line-height:50%}.fc .ui-draggable-dragging .fc-event-bg{display:none}.fc-border-separate thead tr,.fc-border-separate .table thead tr{background-color:#eee;background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#fafafa));background-image:-webkit-linear-gradient(top,#f2f2f2 0,#fafafa 100%);background-image:-linear-gradient(top,#f2f2f2 0,#fafafa 100%);font-size:12px}.fc-border-separate thead tr th{padding:4px;line-height:1.428571429}tr td.fc-first,tr.fc-first th.fc-first{border-left:0}tr.fc-last td{border-bottom:0}.fc-header .fc-button{margin-bottom:1em;vertical-align:top;margin-right:-1px}.fc-header .fc-corner-right{margin-right:1px}.fc-header .ui-corner-right{margin-right:0}.fc-header .fc-state-hover,.fc-header .ui-state-hover{z-index:2}.fc-header .fc-state-down{z-index:3}.fc-header .fc-state-active,.fc-header .ui-state-active{z-index:4}.fc-header td{white-space:nowrap}.fc-header-left{width:25%;text-align:left}.fc-header-center{text-align:center}.fc-header-right{width:25%;text-align:right}.fc-header-title{display:inline-block;vertical-align:top}.fc-header-title h2{margin-top:0;white-space:nowrap}.ams-widget .fc-header-title h2{text-shadow:0 1px 0 #fff;margin-top:-12px;margin-left:10px;font-size:14px;font-weight:700;margin-bottom:0}.fc-content{clear:both}.fc-view{width:100%;overflow:hidden}.fc-widget-content,.fc-widget-header{border:1px solid #ccc;border-right:0}.fc-state-highlight{background:#ffc}.fc-cell-overlay{background:#9cf;opacity:.2;filter:alpha(opacity=20)}.fc-button{position:relative;display:inline-block;cursor:pointer}.fc-button-inner{position:relative;float:left;overflow:hidden}.fc-state-default{border-width:1px 0}.fc-state-default .fc-button-inner{border-width:0 1px}.fc-state-default,.fc-state-default .fc-button-inner{border-style:solid;border-color:#ccc #bbb #aaa;background:#f3f3f3;color:#000}.fc-state-default .fc-button-effect{position:absolute;top:50%;left:0}.fc-state-default .fc-button-effect span{position:absolute;top:-100px;left:0;width:500px;height:100px;border-width:100px 0 0 1px;border-style:solid;border-color:#fff;background:#444;opacity:.09;filter:alpha(opacity=9)}.fc-state-hover .fc-button-inner{border-color:#999}.fc-state-down .fc-button-inner{border-color:#555;background:#777}.fc-state-active .fc-button-inner{border-color:#555;background:#777;color:#fff}.fc-state-disabled{cursor:default}.fc-state-disabled .fc-button-inner{color:#999;border-color:#ddd}.fc-state-disabled .fc-button-effect{display:none}.fc-button-content{position:relative;float:left;height:1.9em;line-height:1.9em;padding:0 .6em;white-space:nowrap}.fc-button-content .fc-icon-wrap{position:relative;float:left;top:50%}.fc-button-content .ui-icon{position:relative;float:left;margin-top:-50%;*margin-top:0;*top:-50%}.fc-event{border-style:solid;border-width:0;font-size:.85em;cursor:default}.fc-rtl .fc-event{text-align:right}.fc-event-draggable,a.fc-event{cursor:pointer}a.fc-event{text-decoration:none}.fc-event-skin{color:#FFF;border-right:0!important;cursor:move}.fc-event-skin .fa:before{display:block;font-size:14px;position:absolute;right:4px;top:3px}.fc-event-inner{position:relative;width:100%;height:100%;border-style:solid;border-width:0;overflow:hidden}.fc-event-hori{border-width:1px 0;margin-bottom:1px}.fc-event-hori .ui-resizable-e{top:0!important;right:-3px!important;width:7px!important;height:100%!important;cursor:e-resize}.fc-event-hori .ui-resizable-w{top:0!important;left:-3px!important;width:7px!important;height:100%!important;cursor:w-resize}.fc-event-hori .ui-resizable-handle{_padding-bottom:14px}.fc-corner-left{margin-left:1px}.fc-corner-left .fc-button-inner,.fc-corner-left .fc-event-inner{margin-left:-1px}.fc-corner-right{margin-right:1px}.fc-corner-right .fc-button-inner,.fc-corner-right .fc-event-inner{margin-right:-1px}.fc-corner-right .fc-event-inner{border-left:6px solid rgba(0,0,0,0.15);padding-left:2px;padding-right:15px}.fc-corner-top{margin-top:1px}.fc-corner-top .fc-event-inner{margin-top:-1px;border-top-width:1px}.fc-corner-bottom{margin-bottom:1px}.fc-corner-bottom .fc-event-inner{margin-bottom:-1px;border-bottom-width:1px}table.fc-table-separate{border-collapse:separate}.fc-table-separate td,.fc-table-separate th{border-width:1px 0 0 1px}.fc-table-separate td.fc-last,.fc-table-separate th.fc-last{border-right-width:1px}.fc-table-separate tr.fc-last td,.fc-table-separate tr.fc-last th{border-bottom-width:1px}.fc-table-separate tbody tr.fc-first td,.fc-table-separate tbody tr.fc-first th{border-top-width:0}.fc-grid th{text-align:center}.fc-grid .fc-day-number{float:right;padding:0 2px}.fc-grid .fc-other-month .fc-day-number{opacity:.3;filter:alpha(opacity=30)}.fc-grid .fc-day-content{clear:both;padding:2px 2px 1px}.fc-grid .fc-event-time{font-weight:700}.fc-rtl .fc-grid .fc-day-number{float:left}.fc-rtl .fc-grid .fc-event-time{float:right}.fc-agenda table{border-collapse:separate}.fc-agenda .fc-agenda-axis{width:50px;padding:0 4px;vertical-align:middle;text-align:right;white-space:nowrap;font-weight:400}.fc-agenda .fc-day-content{padding:2px 2px 1px}.fc-agenda-days th{text-align:center}.fc-agenda-days .fc-agenda-axis{border-right-width:1px}.fc-agenda-days .fc-col0{border-left-width:0}.fc-agenda-allday th{border-width:0 1px}.fc-agenda-allday .fc-day-content{min-height:34px;_height:34px}.fc-agenda-divider-inner{height:2px;overflow:hidden}.fc-widget-header .fc-agenda-divider-inner{background:#eee}.fc-agenda-slots th{border-width:1px 1px 0}.fc-agenda-slots td{border-width:1px 0 0;background:0}.fc-agenda-slots td div{height:20px}.fc-agenda-slots tr.fc-slot0 td,.fc-agenda-slots tr.fc-slot0 th{border-top-width:0}.fc-agenda-slots tr.fc-minor td,.fc-agenda-slots tr.fc-minor th{border-top-style:dotted}.fc-agenda-slots tr.fc-minor th.ui-widget-header{*border-top-style:solid}.fc-event-time,.fc-event-title{padding:3px 0 2px 3px;display:inline-block;line-height:16px;font-weight:700;font-size:11px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.fc-event-vert{border-width:0 1px}.fc-event-vert .fc-event-content,.fc-event-vert .fc-event-head{position:relative;z-index:2;width:100%;overflow:hidden}.fc-event-vert .fc-event-time{white-space:nowrap;font-size:10px}.fc-event-vert .fc-event-bg{position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;background:#fff;opacity:.3;filter:alpha(opacity=30)}.fc-event-vert .ui-resizable-s{bottom:0!important;width:100%!important;height:8px!important;overflow:hidden!important;line-height:8px!important;font-size:11px!important;font-family:monospace;text-align:center;cursor:s-resize}.fc-select-helper .fc-event-bg{display:none}.fc-agenda .ui-resizable-resizing{_overflow:hidden}.colorpicker{padding-left:30px!important}.bootstrap-timepicker{position:relative}.bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu{left:auto;right:0}.bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu:before{left:auto;right:12px}.bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu:after{left:auto;right:13px}.bootstrap-timepicker .add-on{cursor:pointer}.bootstrap-timepicker .add-on i{display:inline-block;width:16px;height:16px}@media(max-width:767px){.bootstrap-timepicker,.bootstrap-timepicker .dropdown-menu{width:100%}}.bootstrap-timepicker-widget.dropdown-menu{padding:4px}.bootstrap-timepicker-widget.dropdown-menu.open{display:inline-block}.bootstrap-timepicker-widget.dropdown-menu:before{border-bottom:7px solid rgba(0,0,0,0.2);border-left:7px solid transparent;border-right:7px solid transparent;content:"";display:inline-block;position:absolute}.bootstrap-timepicker-widget.dropdown-menu:after{border-bottom:6px solid #FFF;border-left:6px solid transparent;border-right:6px solid transparent;content:"";display:inline-block;position:absolute}.bootstrap-timepicker-widget.timepicker-orient-left:before{left:6px}.bootstrap-timepicker-widget.timepicker-orient-left:after{left:7px}.bootstrap-timepicker-widget.timepicker-orient-right:before{right:6px}.bootstrap-timepicker-widget.timepicker-orient-right:after{right:7px}.bootstrap-timepicker-widget.timepicker-orient-top:before{top:-7px}.bootstrap-timepicker-widget.timepicker-orient-top:after{top:-6px}.bootstrap-timepicker-widget.timepicker-orient-bottom:before{bottom:-7px;border-bottom:0;border-top:7px solid #999}.bootstrap-timepicker-widget.timepicker-orient-bottom:after{bottom:-6px;border-bottom:0;border-top:6px solid #fff}.bootstrap-timepicker-widget a.btn,.bootstrap-timepicker-widget input{border-radius:4px}.bootstrap-timepicker-widget table{width:100%;margin:0}.bootstrap-timepicker-widget table table td{text-align:center;height:30px;margin:0;padding:2px}.bootstrap-timepicker-widget table table td:not(.separator){min-width:30px}.bootstrap-timepicker-widget table table td span{width:100%}.bootstrap-timepicker-widget table table td a{border:1px transparent solid;width:100%;display:inline-block;margin:0;padding:8px 0;outline:0;color:#333}.bootstrap-timepicker-widget table table td a:hover{text-decoration:none;background-color:#eee;border-radius:4px;border-color:#ddd}.bootstrap-timepicker-widget table table td a i{margin-top:2px;font-size:18px}.bootstrap-timepicker-widget table table td input{width:25px;margin:0;text-align:center}@media(min-width:767px){.bootstrap-timepicker-widget.modal{width:200px;margin-left:-100px}}.bootstrap-timepicker-widget .modal-content{padding:4px}.note-editor{border:1px solid #a9a9a9}.note-editor.fullscreen{position:fixed;top:0;left:0;z-index:1050;width:100%}.note-editor.fullscreen.fullscreen .note-editable{background-color:#fff}.note-editor.codeview .note-editable,.note-editor.fullscreen .note-resizebar{display:none}.note-editor.codeview .note-codeable{display:block}.note-editor .note-toolbar{padding-bottom:5px;padding-left:5px;margin:0;background-color:#f5f5f5;border-bottom:1px solid #a9a9a9}.note-editor .note-toolbar>.btn-group{margin-top:5px;margin-right:5px;margin-left:0}.note-editor .note-toolbar .note-table .dropdown-menu{min-width:0;padding:5px}.note-editor .note-toolbar .note-table .dropdown-menu .note-dimension-picker{font-size:18px}.note-editor .note-toolbar .note-table .dropdown-menu .note-dimension-picker .note-dimension-picker-mousecatcher{position:absolute!important;z-index:3;width:10em;height:10em;cursor:pointer}.note-editor .note-toolbar .note-table .note-table .dropdown-menu .note-dimension-picker .note-dimension-picker-unhighlighted{position:relative!important;z-index:1;width:5em;height:5em;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC) repeat}.note-editor .note-toolbar .note-table .note-table .dropdown-menu .note-dimension-picker .note-dimension-picker-highlighted{position:absolute!important;z-index:2;width:1em;height:1em;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIjd6vvD2f9LKLW+AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKwNDEVT0AAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC) repeat}.note-editor .note-toolbar .note-style blockquote,.note-editor .note-toolbar .note-editor .note-toolbar .note-style h1,.note-editor .note-toolbar .note-editor .note-toolbar .note-style h2,.note-editor .note-toolbar .note-editor .note-toolbar .note-style h3,.note-editor .note-toolbar .note-editor .note-toolbar .note-style h4,.note-editor .note-toolbar .note-editor .note-toolbar .note-style h5,.note-editor .note-toolbar .note-editor .note-toolbar .note-style h6{margin:0}.note-editor .note-toolbar .note-color .dropdown-toggle{width:20px;padding-left:5px}.note-editor .note-toolbar .note-color .dropdown-menu{min-width:290px}.note-editor .note-toolbar .note-color .dropdown-menu .btn-group{margin:0}.note-editor .note-toolbar .note-color .dropdown-menu .btn-group:first-child{margin:0 5px}.note-editor .note-toolbar .note-color .dropdown-menu .btn-group .note-palette-title{margin:2px 7px;font-size:12px;text-align:center;border-bottom:1px solid #eee}.note-editor .note-toolbar .note-color .dropdown-menu .btn-group .note-color-reset{padding:0 3px;margin:5px;font-size:12px;cursor:pointer;border-radius:5px}.note-editor .note-toolbar .note-color .dropdown-menu .btn-group .note-color-reset:hover{background:#eee}.note-editor .note-toolbar .note-para .dropdown-menu{min-width:153px;padding:5px}.note-editor .note-toolbar .note-para .note-para li:first-child{margin-bottom:5px}.note-editor .note-statusbar{background-color:#f5f5f5}.note-editor .note-statusbar .note-resizebar{width:100%;height:8px;cursor:s-resize}.note-editor .note-statusbar .note-resizebar .note-icon-bar{width:20px;margin:1px auto;border-top:1px solid #a9a9a9}.note-editor .note-popover .popover{max-width:none}.note-editor .note-popover .popover .popover-content{padding:5px}.note-editor .note-popover .popover .popover-content a{display:inline-block;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}.note-editor .note-popover .popover .popover-content .btn-group+.btn-group{margin-left:5px}.note-editor .note-popover .popover .arrow{left:20px}.note-editor .note-handle .note-control-selection{position:absolute;display:none;border:1px solid #000}.note-editor .note-handle .note-control-selection>div{position:absolute}.note-editor .note-handle .note-control-selection .note-control-selection-bg{width:100%;height:100%;background-color:#000;-webkit-opacity:.3;-khtml-opacity:.3;-moz-opacity:.3;opacity:.3;-ms-filter:alpha(opacity=30);filter:alpha(opacity=30)}.note-editor .note-handle .note-control-selection .note-control-handle,.note-editor .note-handle .note-control-selection .note-control-holder{width:7px;height:7px;border:1px solid #000}.note-editor .note-handle .note-control-selection .note-control-sizing{width:7px;height:7px;background-color:#fff;border:1px solid #000}.note-editor .note-handle .note-control-selection .note-control-nw{top:-5px;left:-5px;border-right:0;border-bottom:0}.note-editor .note-handle .note-control-selection .note-control-ne{top:-5px;right:-5px;border-bottom:0;border-left:0}.note-editor .note-handle .note-control-selection .note-control-sw{bottom:-5px;left:-5px;border-top:0;border-right:0}.note-editor .note-handle .note-control-selection .note-control-se{right:-5px;bottom:-5px;cursor:se-resize}.note-editor .note-handle .note-control-selection .note-control-selection-info{right:0;bottom:0;padding:5px;margin:5px;font-size:12px;color:#fff;background-color:#000;border-radius:5px;-webkit-opacity:.7;-khtml-opacity:.7;-moz-opacity:.7;opacity:.7;-ms-filter:alpha(opacity=70);filter:alpha(opacity=70)}.note-editor .note-dialog>div{display:none}.note-editor .note-dialog .note-image-dialog .note-dropzone{min-height:200px;font-size:30px;line-height:6;color:#d3d3d3;text-align:center;border:4px dashed #d3d3d3}.note-editor .note-dialog .note-help-dialog{font-size:12px;color:#ccc;background:0;background-color:#222!important;border:0;-webkit-opacity:.9;-khtml-opacity:.9;-moz-opacity:.9;opacity:.9;-ms-filter:alpha(opacity=90);filter:alpha(opacity=90)}.note-editor .note-dialog .note-help-dialog .modal-content{background:0;border:1px solid #fff;border-radius:5px;-webkit-box-shadow:none;box-shadow:none}.note-editor .note-dialog .note-help-dialog a{font-size:12px;color:#fff}.note-editor .note-dialog .note-help-dialog .title{padding-bottom:5px;font-size:14px;font-weight:700;color:#fff;border-bottom:#fff 1px solid}.note-editor .note-dialog .note-help-dialog .modal-close{font-size:14px;color:#dd0;cursor:pointer}.note-editor .note-dialog .note-help-dialog .note-shortcut-layout{width:100%}.note-editor .note-dialog .note-help-dialog .note-shortcut-layout td{vertical-align:top}.note-editor .note-dialog .note-help-dialog .note-shortcut{margin-top:8px}.note-editor .note-dialog .note-help-dialog .note-shortcut th{font-size:13px;color:#dd0;text-align:left}.note-editor .note-dialog .note-help-dialog .note-shortcut th:first-child{min-width:110px;padding-right:10px;font-family:"Courier New";color:#dd0;text-align:right}.note-editor .note-editable{padding:10px;overflow:scroll;outline:0}.note-editor .note-codeable{display:none;width:100%;padding:10px;margin-bottom:0;font-family:Menlo,Monaco,monospace,sans-serif;font-size:14px;color:#ccc;background-color:#222;border:0;border-radius:0;-webkit-box-shadow:none;box-shadow:none;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;resize:none}.note-editor .dropdown-menu{min-width:90px}.note-editor .dropdown-menu.right{right:0;left:auto}.note-editor .dropdown-menu.right::before{right:9px;left:auto!important}.note-editor .dropdown-menu.right::after{right:10px;left:auto!important}.note-editor .dropdown-menu .dropdown-menu li a i{color:#00bfff;visibility:hidden}.note-editor .dropdown-menu .dropdown-menu li a.checked i{visibility:visible}.note-editor .note-color-palette{line-height:1}.note-editor .note-color-palette div .note-color-btn{width:17px;height:17px;padding:0;margin:0;border:1px solid #fff}.note-editor .note-color-palette div .note-color-btn:hover{border:1px solid #000}.no-padding .note-editor{border:0}.note-editor .note-editable{background-color:rgba(48,126,204,0.05)}.note-editor .note-editable:focus{background-color:#fff}.note-editor .note-statusbar .note-resizebar{border-top:1px solid #dbdbdb}.note-editor .note-statusbar:hover{background:#EEE}.note-editor .note-statusbar:active{background:#eaeaea}.md-editor{display:block;border:1px solid #ddd}.md-editor.active{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.md-editor .md-footer,.md-editor>.md-header{display:block;padding:6px 4px;background:#f5f5f5}.md-editor>.md-preview{background:#fff;border-top:1px dashed #ddd;border-bottom:1px dashed #ddd;min-height:10px;padding:10px}.md-editor>textarea{font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:13px;outline:0;outline:thin dotted \9;margin:0;display:block;width:100%;border:0;padding:10px;border-top:1px dashed #ddd;border-bottom:1px dashed #ddd;border-radius:0;-webkit-box-shadow:none;box-shadow:none;background:#eee}.md-editor>textarea:focus{-webkit-box-shadow:none;box-shadow:none;background:#fff}.twitter-typeahead .tt-hint,.twitter-typeahead .tt-query{margin-bottom:0}.tt-dropdown-menu{min-width:160px;margin-top:2px;padding:5px 0;background-color:#fff;border:1px solid #bfbfbf;border:1px solid rgba(0,0,0,0.2);*border-right-width:2px;*border-bottom-width:2px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);-webkit-background-clip:padding-box;background-clip:padding-box}.tt-suggestion{display:block;padding:3px 20px}.tt-suggestion.tt-is-under-cursor{color:#fff;background-color:#0081c2}.tt-suggestion.tt-is-under-cursor a{color:#fff}.tt-suggestion p{margin:0}.dropzone,.dropzone *,.dropzone-previews,.dropzone-previews *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.dropzone .dz-preview,.dropzone-previews .dz-preview{background:rgba(255,255,255,0.8);position:relative;display:inline-block;margin:10px;vertical-align:top;border:1px solid #acacac;padding:6px;-webkit-box-shadow:1px 1px 4px rgba(0,0,0,0.16);box-shadow:1px 1px 4px rgba(0,0,0,0.16);font-size:14px}.dropzone .dz-preview.dz-file-preview,.dropzone-previews .dz-preview.dz-file-preview{display:none}.dropzone .dz-preview .dz-details,.dropzone-previews .dz-preview .dz-details{width:100px;height:100px;position:relative;background:#ebebeb;padding:5px;margin-bottom:22px}.dropzone .dz-preview .dz-details .dz-filename,.dropzone-previews .dz-preview .dz-details .dz-filename{overflow:hidden;height:100%}.dropzone .dz-preview .dz-details img,.dropzone-previews .dz-preview .dz-details img{position:absolute;top:0;left:0;width:100px;height:100px}.dropzone .dz-preview .dz-details .dz-size,.dropzone-previews .dz-preview .dz-details .dz-size{position:absolute;bottom:-28px;left:3px;height:28px;line-height:28px}.dropzone .dz-preview.dz-error .dz-error-mark,.dropzone-previews .dz-preview.dz-error .dz-error-mark,.dropzone .dz-preview.dz-success .dz-success-mark,.dropzone-previews .dz-preview.dz-success .dz-success-mark{display:block;opacity:1;-ms-filter:none;-webkit-filter:none;filter:none}.dropzone .dz-preview:hover .dz-details img,.dropzone-previews .dz-preview:hover .dz-details img{display:none}.dropzone .dz-preview .dz-error-mark,.dropzone-previews .dz-preview .dz-error-mark,.dropzone .dz-preview .dz-success-mark,.dropzone-previews .dz-preview .dz-success-mark{display:block;position:absolute;width:40px;height:40px;font-size:30px;text-align:center;right:-10px;top:-10px;opacity:0;-ms-filter:"alpha(Opacity=0)";filter:alpha(opacity=0);-webkit-transition:opacity .4s ease-in-out;transition:opacity .4s ease-in-out;background-image:url(../img/dropzone/spritemap.png);background-repeat:no-repeat}.dropzone .dz-preview .dz-error-mark span,.dropzone-previews .dz-preview .dz-error-mark span,.dropzone .dz-preview .dz-success-mark span,.dropzone-previews .dz-preview .dz-success-mark span{display:none}.dropzone .dz-preview .dz-success-mark,.dropzone-previews .dz-preview .dz-success-mark{color:#8cc657;background-position:-268px -163px}.dropzone .dz-preview .dz-error-mark,.dropzone-previews .dz-preview .dz-error-mark{color:#ee162d;background-position:-268px -123px}.dropzone .dz-preview.dz-error .dz-progress .dz-upload,.dropzone-previews .dz-preview.dz-error .dz-progress .dz-upload{background:#ee1e2d}.dropzone .dz-preview .dz-progress,.dropzone-previews .dz-preview .dz-progress{position:absolute;top:100px;left:6px;right:6px;height:6px;background:#d7d7d7;display:none}.dropzone .dz-preview .dz-progress .dz-upload,.dropzone-previews .dz-preview .dz-progress .dz-upload{position:absolute;bottom:0;background-color:#8cc657;-webkit-animation:loading .4s linear infinite;-ms-animation:loading .4s linear infinite;animation:loading .4s linear infinite;-webkit-transition:width .3s ease-in-out;transition:width .3s ease-in-out;border-radius:2px;top:0;left:0;width:0;height:100%;background-image:url(../img/dropzone/spritemap.png);background-repeat:repeat-x;background-position:0 -400px}.dropzone .dz-preview.dz-processing .dz-progress,.dropzone-previews .dz-preview.dz-processing .dz-progress{display:block}.dropzone .dz-preview .dz-error-message,.dropzone-previews .dz-preview .dz-error-message{position:absolute;top:-5px;left:-20px;background:rgba(245,245,245,0.8);padding:8px 10px;color:#800;min-width:140px;max-width:500px;z-index:500;display:block;opacity:0;-ms-filter:"alpha(Opacity=0)";filter:alpha(opacity=0);-webkit-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out}.dropzone .dz-preview:hover.dz-error .dz-error-message,.dropzone-previews .dz-preview:hover.dz-error .dz-error-message{display:block;opacity:1;-ms-filter:none;-webkit-filter:none;filter:none}.dropzone .dz-preview.dz-image-preview:hover .dz-details img,.dropzone-previews .dz-preview.dz-image-preview:hover .dz-details img{display:block;opacity:.1;-ms-filter:"alpha(Opacity=10)";filter:alpha(opacity=10)}.dropzone .dz-preview.dz-success .dz-progress,.dropzone-previews .dz-preview.dz-success .dz-progress{display:block;opacity:0;-ms-filter:"alpha(Opacity=0)";filter:alpha(opacity=0);-webkit-transition:opacity .4s ease-in-out;transition:opacity .4s ease-in-out}.dropzone a.dz-remove,.dropzone-previews a.dz-remove{background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fafafa),color-stop(1,#eee));background-image:-webkit-gradient(linear,top left,bottom left,from(#fafafa),to(#eee));background-image:-webkit-linear-gradient(top,#fafafa 0,#eee 100%);background-image:linear-gradient(top,#fafafa 0,#eee 100%);border-radius:2px;border:1px solid #eee;text-decoration:none;display:block;padding:4px 5px;text-align:center;color:#aaa;margin-top:26px}.dropzone a.dz-remove:hover,.dropzone-previews a.dz-remove:hover{color:#666}.dropzone{position:relative;padding:1em;border:1px solid rgba(0,0,0,0.03);min-height:360px;border-radius:3px;background:rgba(0,0,0,0.03);background-image:-webkit-gradient(linear,left top,right bottom,color-stop(0.25,rgba(0,0,0,0.03)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(0,0,0,0.03)),color-stop(0.75,rgba(0,0,0,0.03)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(135deg,rgba(0,0,0,0.03) 25%,transparent 25%,transparent 50%,rgba(0,0,0,0.03) 50%,rgba(0,0,0,0.03) 75%,transparent 75%,transparent);background-image:-webkit-linear-gradient(315deg,rgba(0,0,0,0.03) 25%,transparent 25%,transparent 50%,rgba(0,0,0,0.03) 50%,rgba(0,0,0,0.03) 75%,transparent 75%,transparent);background-image:linear-gradient(135deg,rgba(0,0,0,0.03) 25%,transparent 25%,transparent 50%,rgba(0,0,0,0.03) 50%,rgba(0,0,0,0.03) 75%,transparent 75%,transparent);background-color:#fafcfd;-webkit-background-size:16px 16px;background-size:16px 16px}.dropzone .dz-drag-hover{background:rgba(0,0,0,0.04)}.dropzone.dz-clickable,.dropzone.dz-clickable .dz-message,.dropzone.dz-clickable .dz-message span{cursor:pointer}.dropzone.dz-clickable *{cursor:default}.dropzone .dz-message{opacity:1;-ms-filter:none;-webkit-filter:none;filter:none}.dropzone .dz-drag-hover{background-image:-webkit-gradient(linear,left top,right bottom,color-stop(0.25,rgba(0,0,0,0.03)),color-stop(0.25,rgba(0,0,0,0)),color-stop(0.5,rgba(0,0,0,0)),color-stop(0.5,rgba(0,0,0,0.03)),color-stop(0.75,rgba(0,0,0,0.03)),color-stop(0.75,rgba(0,0,0,0)),to(rgba(0,0,0,0)));background-image:-webkit-linear-gradient(135deg,rgba(0,0,0,0.03) 25%,rgba(0,0,0,0) 25%,rgba(0,0,0,0) 50%,rgba(0,0,0,0.03) 50%,rgba(0,0,0,0.03) 75%,rgba(0,0,0,0) 75%,rgba(0,0,0,0));background-image:-webkit-linear-gradient(315deg,rgba(0,0,0,0.03) 25%,rgba(0,0,0,0) 25%,rgba(0,0,0,0) 50%,rgba(0,0,0,0.03) 50%,rgba(0,0,0,0.03) 75%,rgba(0,0,0,0) 75%,rgba(0,0,0,0));background-image:linear-gradient(135deg,rgba(0,0,0,0.03) 25%,rgba(0,0,0,0) 25%,rgba(0,0,0,0) 50%,rgba(0,0,0,0.03) 50%,rgba(0,0,0,0.03) 75%,rgba(0,0,0,0) 75%,rgba(0,0,0,0));background-color:#fafafa;-webkit-background-size:22px 22px;background-size:22px 22px;border:5px dashed #ccc}.dropzone .dz-default.dz-message{opacity:1;-ms-filter:none;-webkit-filter:none;filter:none;-webkit-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out;background-image:url(../img/dropzone/spritemap.png);background-repeat:no-repeat;background-position:0 0;position:absolute;width:428px;height:123px;margin-left:-214px;margin-top:-61.5px;top:50%;left:50%}.dropzone .dz-default.dz-message span{display:none}.dropzone.dz-square .dz-default.dz-message{background-position:0 -123px;width:268px;margin-left:-134px;height:174px;margin-top:-87px}.dropzone.dz-drag-hover .dz-message{opacity:.15;-ms-filter:"alpha(Opacity=15)";filter:alpha(opacity=15)}.dropzone.dz-started .dz-message{display:block;opacity:0;-ms-filter:"alpha(Opacity=0)";filter:alpha(opacity=0)}.irs{position:relative;display:block;height:40px}.irs-line{position:relative;display:block;overflow:hidden;height:8px;top:25px;background:#eee}.irs-line-left,.irs-line-mid,.irs-line-right{position:absolute;display:block;top:0;height:8px}.irs-line-left{left:0;width:10%}.irs-line-mid{left:10%;width:80%}.irs-line-right{right:0;width:10%}.irs-diapason{position:absolute;display:block;left:0;width:100%}.irs-slider{position:absolute;display:block;cursor:default;z-index:1;width:10px;height:22px;top:17px;border:1px solid #fff;background:#858585}.irs-slider:hover{background:#6c6c6c}.irs-slider.single{left:10px}.irs-slider.single:before{position:absolute;display:block;content:"";top:-50%;left:-150%;width:400%;height:200%;background:rgba(0,0,0,0)}.irs-slider.from{left:100px}.irs-slider.from:before{position:absolute;display:block;content:"";top:-50%;left:-300%;width:400%;height:200%;background:rgba(0,0,0,0)}.irs-slider.to{left:300px}.irs-slider.to:before{position:absolute;display:block;content:"";top:-50%;left:0;width:400%;height:200%;background:rgba(0,0,0,0)}.irs-slider.last{z-index:2}.irs-max,.irs-min{color:#999;font-size:12px;line-height:1.333;text-shadow:none;top:0;padding:1px 3px;background:rgba(0,0,0,0.1);border-radius:0}.lt-ie9 .irs-max,.lt-ie9 .irs-min{background:#bfbfbf}.irs-min{position:absolute;display:block;left:0;cursor:default}.irs-max{position:absolute;display:block;right:0;cursor:default}.irs-from,.irs-single,.irs-to{position:absolute;display:block;top:0;left:0;cursor:default;white-space:nowrap}.lt-ie9 .irs-from,.lt-ie9 .irs-single,.lt-ie9 .irs-to{background:#999}.irs-grid{position:absolute;display:none;bottom:0;left:0;width:100%;height:20px}.irs-with-grid{height:60px}.irs-with-grid .irs-grid{display:block}.irs-grid-pol{position:absolute;top:0;left:0;width:1px;height:8px;background:#99a4ac}.irs-grid-pol.small{height:4px}.irs-grid-text{position:absolute;bottom:0;left:0;width:100px;white-space:nowrap;text-align:center;font-size:9px;line-height:9px;color:#99a4ac}.irs-diapason{background:#3276b1;height:8px;top:25px}.irs .irs-from,.irs .irs-single,.irs .irs-to{color:#fff;font-size:10px;line-height:1.333;text-shadow:none;padding:1px 5px;background:rgba(0,0,0,0.4);border-radius:0}#irs-active-slider{background:#686868;-webkit-box-shadow:rgba(0,0,0,0.3) 1px 1px 1px 0;box-shadow:rgba(0,0,0,0.3) 1px 1px 1px 0;width:12px;height:24px;top:16px}.google_maps{width:100%;height:350px;position:relative}.google_maps *{box-sizing:content-box;-webkit-box-sizing:content-box;-moz-box-sizing:content-box}.google_maps img{max-width:none}.slider{margin-top:0;margin-bottom:30px}.slider.slider-vertical{margin-bottom:0;margin-right:5px}.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{display:block;min-height:0}.ui-helper-clearfix:after,.ui-helper-clearfix:before{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}* html .ui-helper-clearfix{height:1%}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:alpha(opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;width:16px;height:16px;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget{font-family:Ubuntu,Helvetica,Arial,sans-serif;font-size:13px}.ui-widget :active{outline:0}.ui-widget .ui-widget{font-size:13px}.ui-widget button,.ui-widget input,.ui-widget select,.ui-widget textarea{font-family:Ubuntu,Helvetica,Arial,sans-serif;font-size:inherit}.ui-widget-content{border:1px solid #aaa;background:#fff;color:#404040}.ui-widget-content .ui-icon{background:none!important}.ui-widget-header{font-weight:700;background-color:#f5f5f5;border-color:#DDD;color:#333}.ui-widget-header a{color:#222}.ui-widget-overlay{position:fixed;background:#AAA;width:100%;height:200%;top:0;left:0;z-index:999;opacity:.3;filter:alpha(opacity=30)}.ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa;opacity:.3;filter:alpha(opacity=30);border-radius:8px}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{color:#333;background-color:#fff;font-weight:400;border:1px solid #ccc}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#555;text-decoration:none}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{text-shadow:none}.ui-state-default,.ui-state-error,.ui-state-highlight{position:relative;border-width:1px;border-style:solid}.ui-state-default p,.ui-state-error p,.ui-state-highlight p{font-size:13px;font-weight:400;line-height:18px;margin:7px 15px}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#2d6987}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.ui-state-error a,.ui-state-error-text,.ui-widget-content .ui-state-error a,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error a,.ui-widget-header .ui-state-error-text{color:#953b39}.ui-state-focus,.ui-state-hover,.ui-widget-content .ui-state-focus,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-focus,.ui-widget-header .ui-state-hover{color:#333;background-color:#ebebeb;border-color:#adadad;text-decoration:none}.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited{color:#333;text-decoration:none}.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #adadad;font-weight:400;color:#333}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#333;text-decoration:none}.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,.ui-widget-content .ui-state-disabled .ui-icon,.ui-widget-header .ui-state-disabled .ui-icon{filter:alpha(opacity=35)}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:700}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:alpha(opacity=70);font-weight:400}.ui-corner-all{border-radius:0}.ui-corner-left,.ui-corner-tl,.ui-corner-top{border-top-left-radius:4px}.ui-corner-right,.ui-corner-top,.ui-corner-tr{border-top-right-radius:4px}.ui-corner-bl,.ui-corner-bottom,.ui-corner-left{border-bottom-left-radius:4px}.ui-corner-bottom,.ui-corner-br,.ui-corner-right{border-bottom-right-radius:4px}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}input[type=color].ui-autocomplete-loading,input[type=date].ui-autocomplete-loading,input[type=datetime-local].ui-autocomplete-loading,input[type=datetime].ui-autocomplete-loading,input[type=email].ui-autocomplete-loading,input[type=month].ui-autocomplete-loading,input[type=number].ui-autocomplete-loading,input[type=password].ui-autocomplete-loading,input[type=search].ui-autocomplete-loading,input[type=tel].ui-autocomplete-loading,input[type=text].ui-autocomplete-loading,input[type=time].ui-autocomplete-loading,input[type=url].ui-autocomplete-loading,input[type=week].ui-autocomplete-loading{background-image:url(../img/select2-spinner.gif)!important;background-repeat:no-repeat;background-position:99% 50%;padding-right:27px}.ui-btn-lg{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.ui-btn-sm,.ui-btn-xs{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.ui-btn-xs{padding:1px 5px}.ui-btn-block{display:block;width:100%;padding-right:0;padding-left:0}.ui-btn-block+.ui-btn-block{margin-top:5px}input[type=button].ui-btn-block,input[type=reset].ui-btn-block,input[type=submit].ui-btn-block{width:100%}.ui-button{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid #ccc;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.ui-button:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.ui-button:focus,.ui-button:hover{color:#333;background-color:#ebebeb;border-color:#adadad;text-decoration:none}fieldset[disabled] .ui-button,fieldset[disabled] .ui-button.ui-state-active,fieldset[disabled] .ui-button:active,fieldset[disabled] .ui-button:focus,fieldset[disabled] .ui-button:hover,.ui-button.disabled,.ui-button.disabled.active,.ui-button.disabled:active,.ui-button.disabled:focus,.ui-button.disabled:hover,.ui-button[disabled],.ui-button[disabled].active,.ui-button[disabled]:active,.ui-button[disabled]:focus,.ui-button[disabled]:hover{background-color:#fff;border-color:#ccc}.ui-button-text-icon-primary .ui-button-icon-primary{float:left}.ui-button-text-icon-primary{padding:2px 7px 3px}.ui-button-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.ui-button-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.ui-button-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.ui-button-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.ui-button-inverse{color:#fff;background-color:#222;border-color:#080808}.ui-button-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.ui-button-error{color:#fff;background-color:#c43c35;border-color:#882a25}.ui-button-danger:hover,.ui-button-info:hover,.ui-button-inverse:hover,.ui-button-primary:hover,.ui-button-success:hover,.ui-button-warning:hover{text-decoration:none}.ui-button-primary:focus,.ui-button-primary:hover{color:#fff;background-color:#3276b1;border-color:#285e8e}.ui-button-success:hover{color:#fff;background-color:#47a447;border-color:#398439}.ui-button-info:hover{color:#fff;background-color:#39b3d7;border-color:#269abc}.ui-button-danger:hover{color:#fff;background-color:#d2322d;border-color:#ac2925}.ui-button-warning:hover{color:#fff;background-color:#ed9c28;border-color:#d58512}.ui-button-inverse:hover{color:#fff;background-color:#363636;border-color:#000}.ui-button-icon-only{width:2.2em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button-text-icon-primary .ui-button-icon-primary.ui-icon{margin-top:5px}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999px;display:none}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-icons-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon{margin-bottom:0;margin-top:0;top:50%}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px;margin-right:-6px}.ui-button-icons-only .ui-button-icon-primary,.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary{left:.5em}.ui-button-icons-only .ui-button-icon-secondary,.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-state-active{color:#fff;background-color:#428bca;border-color:#357ebd}.ui-buttonset .ui-state-active.ui-state-hover{color:#fff;background-color:#3276b1;border-color:#285e8e}.ui-buttonset .ui-button{margin-left:0;margin-right:-0.4em}button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-slider{position:relative;text-align:left}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{-webkit-filter:inherit;filter:inherit}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:16px;height:18px;cursor:default}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0;color:#fff;background-color:#0e90d2;background-image:-webkit-gradient(linear,0 0,0 100%,from(#149bdf),to(#0480be));background-image:-webkit-gradient(linear,top left,bottom left,from(#149bdf),to(#0480be));background-image:-webkit-linear-gradient(top,#149bdf,#0480be);background-image:linear-gradient(to bottom,#149bdf,#0480be);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf',endColorstr='#ff0480be',GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:width .6s ease;transition:width .6s ease}.ui-slider-horizontal{height:10px;background:#d5d5d5;border:0}.ui-slider-horizontal .ui-slider-handle{top:-0.2em;margin-left:-0.5em;background-color:#fff;border-color:#CCC}.ui-slider-horizontal .ui-slider-handle:focus{background-color:#fff;border-color:#357ebd}.ui-slider-horizontal .ui-slider-handle:hover{background-color:#fff;border-color:#285e8e;outline:0}.ui-slider-horizontal .ui-slider-handle:active{background-color:#428bca;border-color:#3276b1}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-0.3em;margin-left:0;margin-bottom:-0.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-tabs{position:relative;border:0;border-radius:0}.ui-tabs .ui-tabs-panel{display:block;border-radius:0;background:0}.ui-tabs .ui-tabs-nav{margin-bottom:0;border:solid #ddd;border-width:0 0 1px;border-radius:0;background:0}.ui-tabs .ui-tabs-nav li{position:relative;top:0;float:left;margin-bottom:-1px;margin-right:3px;border:0;list-style:none;white-space:nowrap;background:0;-webkit-filter:none;filter:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active:hover{background:#fff;cursor:text}.ui-tabs .ui-tabs-nav li.ui-tabs-active a{border:1px solid #ddd;border-bottom:1px solid #fff;background-color:#fff;color:#555;font-weight:700;border-top-width:0!important;margin-top:1px!important;-webkit-box-shadow:0 -2px 0 #57889c;box-shadow:0 -2px 0 #57889c}.ui-tabs .ui-tabs-nav li a{float:left;padding:8px 12px;font-weight:400;text-decoration:none;outline:0;background:0;border-radius:0;background-color:#f5f5f5;border:1px solid #f5f5f5;border-bottom:1px solid #ddd;color:#838383}.ui-tabs .ui-tabs-nav li a:hover{border:1px solid #f5f5f5;border-bottom:1px solid #ddd;background-color:#f5f5f5}.ui-tabs .ui-tabs-nav li.ui-state-disabled a,.ui-tabs .ui-tabs-nav li.ui-tabs-active a,.ui-tabs .ui-tabs-nav li.ui-tabs-loading a{cursor:text}.ui-tabs .ui-tabs-nav .ui-state-default{border:0;-webkit-box-shadow:none;box-shadow:none}.ui-tabs .ui-tabs-panel{border:1px solid #ddd;margin:0;padding:10px 13px;border-top:0}.ui-tabs .ui-tabs-hide{display:none!important}.ui-tooltip{display:block;font-size:11px;opacity:.8;position:absolute;visibility:visible;z-index:1024;max-width:200px;background:#000;border:1px solid #000;color:#FFF;padding:3px 8px;text-align:center;text-decoration:none;-webkit-box-shadow:inset 0 1px 0 #000;box-shadow:inset 0 1px 0 #000;border-radius:4px}body .ui-tooltip{border-width:1px}.ui-spinner{position:relative;display:inline-block;overflow:hidden;width:100%;padding:0;vertical-align:middle}.ui-spinner-input{margin:0!important;height:30px;padding:6px 24px 6px 12px;border:0;background:0;vertical-align:middle}.ui-spinner-input.spinner-left{padding:6px 12px 6px 24px}.ui-spinner-input.spinner-left+.ui-spinner-button,.ui-spinner-input.spinner-left+.ui-spinner-button+.ui-spinner-button{right:auto;left:0}.ui-spinner-input.spinner-both{padding:6px 30px}.ui-spinner-input.spinner-both+.ui-spinner-button+.ui-spinner-button{left:0;right:auto}.ui-spinner-input.spinner-both+.ui-spinner-button,.ui-spinner-input.spinner-both+.ui-spinner-button+.ui-spinner-button{height:30px;width:25px}.ui-spinner-input.spinner-both+.ui-spinner-up+.ui-spinner-down:before,.ui-spinner-input.spinner-both+.ui-spinner-up:before{margin-top:8px}.ui-spinner-button{width:19px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:0;border-bottom:0;border-right:0}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-down,.ui-spinner-up{background:#739e73;border-radius:0}.ui-spinner-down:before,.ui-spinner-up:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f067";color:#fff;font-size:14px;margin-top:1px}.ui-spinner-down>:first-child,.ui-spinner-up>:first-child{display:none}.ui-spinner-up{top:0}.ui-spinner-up:active,.ui-spinner-up:focus,.ui-spinner-up:hover{background:#5b835b}.ui-spinner-down{bottom:0;background:#c2032f}.ui-spinner-down:before{content:"\f068"}.ui-spinner-down:active,.ui-spinner-down:focus,.ui-spinner-down:hover{background:#77021d}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-datepicker{width:20em;padding:.2em .2em 0;display:none;z-index:9999!important}.ui-datepicker-inline{z-index:9000!important}.ui-datepicker-header{position:relative;border:0;font-weight:700;width:100%;padding:4px 0;background-color:#f5f5f5;color:gray}.ui-datepicker-next,.ui-datepicker-prev{position:absolute;top:2px;width:5.6em;height:1.8em;text-align:center;margin-top:2px;cursor:pointer}.ui-datepicker-next>:first-child,.ui-datepicker-prev>:first-child{text-indent:0!important}.ui-datepicker-next span,.ui-datepicker-prev span{display:block;position:absolute;text-align:center;top:50%;margin-top:-8px;width:5.8em}.ui-datepicker-prev{left:2px}.ui-datepicker-next{right:2px}.ui-datepicker-title{margin:0 5.8em;line-height:1.8em;text-align:center}.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;border:0;font-weight:700;color:gray}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td:hover{color:#fff}.ui-datepicker td a{margin-bottom:0;border:0}.ui-datepicker td a,.ui-datepicker td span{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker td .ui-state-default{border:0;background:0;margin-bottom:0;padding:5px;color:gray;text-align:center;-webkit-filter:none;filter:none}.ui-datepicker td .ui-state-highlight{color:#fff;background-color:#a90329;text-shadow:0 -1px 0 rgba(0,0,0,0.25);border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);border-radius:0}.ui-datepicker td .ui-state-active{color:#333;background-color:#ebebeb;margin-bottom:0;font-size:normal;text-shadow:0;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);border-radius:0}.ui-datepicker td .ui-state-hover{color:#fff;background:#428bca;background-color:#428bca;text-shadow:0 -1px 0 rgba(0,0,0,0.25);border-color:#357ebd;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);border-radius:0}.ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em;width:auto;overflow:visible}.ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.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-detepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicket-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}.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}.ui-datepicker-cover{display:none;display:block;position:absolute;z-index:-1;-webkit-filter:mask();filter:mask();top:-4px;left:-4px;width:200px;height:200px}.ui-datepicker-today a{background-color:#bfbfbf;cursor:pointer;padding:0 4px;margin-bottom:0}.ui-datepicker-today a:hover{background-color:gray;color:#fff}.ui-progressbar{height:2em;margin-bottom:20px;border:0;overflow:hidden;background-color:#f7f7f7;background-image:-webkit-gradient(linear,0 0,0 100%,from(#f5f5f5),to(#f9f9f9));background-image:-webkit-gradient(linear,top left,bottom left,from(#f5f5f5),to(#f9f9f9));background-image:-webkit-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:linear-gradient(to bottom,#f5f5f5,#f9f9f9);background-repeat:repeat-x;border-radius:0;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#fff9f9f9',GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1)}.ui-progressbar .ui-progressbar-value{margin:0;height:100%;color:#fff;background-color:#428bca;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:width .6s ease;transition:width .6s ease}.ui-progressbar .ui-progressbar-overlay{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px;-webkit-animation:progress-bar-stripes 2s linear infinite;-ms-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;z-index:99999;display:block}.ui-resizable-autohide .ui-resizable-handle,.ui-resizable-disabled .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted #000}.ui-accordion{width:100%}.ui-accordion .ui-accordion-li-fix{display:inline}.ui-accordion .ui-accordion-header{display:block;position:relative;margin-top:-2px;border-color:#ddd!important;padding:10px 15px 10px 36px!important;cursor:pointer;min-height:0;background-color:#fbfbfb;border-radius:0;font-size:15px}.ui-accordion .ui-accordion-header-active{border-bottom:0!important}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-noicons{padding-left:.7em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px;text-indent:0!important;background-image:none!important;text-align:center;line-height:normal;left:12px!important;margin-top:-6px!important;font-size:14px!important}.ui-accordion .ui-accordion-content{margin-top:-3px;border-radius:0;border-top:0 none;border-color:#ddd!important;padding:15px;position:relative;top:1px;margin-bottom:2px;overflow:auto;display:none}.ui-accordion .ui-accordion-content-active{display:block}.ui-accordion-header-active+.ui-accordion-content{border-top:1px solid #ddd}.noUi-target *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-touch-callout:none;-ms-touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;cursor:default}.noUi-target *[disabled] .noUi-base{background:#999}.noUi-target *[disabled] .noUi-connect{background:#BBB}.noUi-base{width:100%;height:14px;position:relative;max-width:100%;max-height:100%;border:1px solid #bfbfbf;z-index:1}.noUi-origin-lower{background:#72a8d7}.noUi-handle{background:#858585;height:30px;width:16px;border:1px solid #fff;margin:-8px 0 0 -8px;cursor:default}.noUi-handle:hover{background:#6c6c6c}.noUi-active{cursor:default;-webkit-box-shadow:rgba(0,0,0,0.1) 1px 1px 1px 0;box-shadow:rgba(0,0,0,0.1) 1px 1px 1px 0;background:#686868;height:32px;width:18px;margin:-9px 0 0 -8px;border:0}.noUi-active:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;content:"";display:block;height:100%;border:1px solid #ddd}.noUi-connect{background:#3276b1}.noUi-background{background:#eee;border:0}.noUi-origin{position:absolute;right:0;top:0;bottom:0;z-index:0}.noUi-origin-upper{background:inherit!important}.noUi-z-index{z-index:10}.noUi-vertical{width:10px;height:100%}.noUi-vertical .noUi-origin{bottom:0;left:0}.noUi-vertical .noUi-handle{margin:-8px 0 0 -3px}.noUi-state-tap .noUi-origin{-webkit-transition:left .3s,top .3s;transition:left .3s,top .3s}.modal-backdrop,.modal-backdrop.fade.in{position:fixed;width:100%;height:100%}.modal-dialog.modal-max{width:98%;max-width:98%}@media only screen and (min-width:768px){.modal-dialog.modal-large{width:80%;max-width:900px}}@media only screen and (min-width:768px){.modal-dialog.modal-medium{width:60%;max-width:650px}}@media only screen and (min-width:768px){.modal-dialog.modal-small{width:40%;max-width:450px}}.modal-dialog .suffix .alert{margin-bottom:0;border-radius:0 0 5px 5px}.modal-title img{margin:0 15px 0 0}.modal-overflow .modal-body{overflow:hidden}.ui-dialog{position:absolute;top:0;left:0;padding:0;width:300px;overflow:hidden;-webkit-background-clip:padding-box;background-clip:padding-box;background-color:#fff;border-radius:3px;-webkit-box-shadow:0 5px 15px rgba(0,0,0,0.5);box-shadow:0 5px 15px rgba(0,0,0,0.5);border:1px solid rgba(0,0,0,0.2);outline:medium none;z-index:1050}.ui-dialog .ui-dialog-titlebar{position:relative;padding:0 10px;background:#fff;border-color:#fff;font-size:18px;text-decoration:none;border:0 0 0 1px solid;border-bottom-right-radius:0;border-bottom-left-radius:0;border-bottom:1px solid #ccc;border-bottom-color:#eee}.ui-dialog .ui-dialog-title{float:left;margin:0;color:#404040;font-weight:700;padding:5px;text-overflow:ellipsis;overflow:hidden}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:19px;margin:-16px 4px 0 0;padding:1px;height:18px;font-size:20px;font-weight:700;line-height:13.5px;text-shadow:0 1px 0 #fff;filter:alpha(opacity=25);-khtml-opacity:.25;-moz-opacity:.25;opacity:.25;background:0;border:0;-webkit-box-shadow:none;box-shadow:none}.ui-dialog .ui-dialog-titlebar-close:before{content:"\f00d";font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:13px}.ui-dialog .ui-dialog-titlebar-close:focus,.ui-dialog .ui-dialog-titlebar-close:hover{padding:1px;filter:alpha(opacity=90);-moz-opacity:.9;opacity:.9}.ui-dialog .ui-dialog-titlebar-close span{display:block;margin:1px;text-indent:9999px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:0;overflow:auto}.ui-dialog .ui-dialog-buttonpane{margin:13px 0 0;padding:19px 15px 20px;border-top:1px solid #eee;border-width:1px 0 0;border-radius:0 0 6px 6px;background-image:none;background-color:#fff;-webkit-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff;text-align:right}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:0 .4em 0 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:14px;height:14px;right:3px;bottom:3px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-dialog-buttonpane .ui-dialog-buttonset .ui-button{color:#fff;background-color:#428bca;border-color:#357ebd}.ui-dialog-buttonpane .ui-dialog-buttonset .ui-button.ui-state-hover{color:#fff;background-color:#3276b1;border-color:#285e8e}.ui-dialog-buttonset .ui-button:not(:first-child){cursor:pointer;display:inline-block;color:#333;background-color:#fff;border:1px solid #ccc;-webkit-transition:.1s linear all;transition:.1s linear all;overflow:visible}.ui-dialog-buttonset .ui-button:not(:first-child) .ui-state-hover{color:#333;background-color:#ebebeb;border-color:#adadad;text-decoration:none}.ui-dialog-buttonset .ui-button.ui-button-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.ui-dialog-buttonset .ui-button.ui-button-info.ui-state-hover{color:#fff;background-color:#39b3d7;border-color:#269abc}.ui-dialog-buttonset .ui-button.ui-button-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.ui-dialog-buttonset .ui-button.ui-button-success.ui-state-hover{color:#fff;background-color:#47a447;border-color:#398439}.ui-dialog-buttonset .ui-button.ui-button-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.ui-dialog-buttonset .ui-button.ui-button-warning.ui-state-hover{color:#fff;background-color:#ed9c28;border-color:#d58512}.ui-dialog-buttonset .ui-button.ui-button-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.ui-dialog-buttonset .ui-button.ui-button-danger.ui-state-hover{color:#fff;background-color:#d2322d;border-color:#ac2925}.ui-dialog-buttonset .ui-button.ui-button-inverse{color:#fff;background-color:#222;border-color:#080808}.ui-dialog-buttonset .ui-button.ui-button-inverse.ui-state-hover{color:#fff;background-color:#363636;border-color:#000}.modal-overflow{position:relative}.modal-overflow .scrollmarker{position:absolute;width:100%;height:20px}.modal-overflow .scrollmarker.top{background:-moz-linear-gradient(top,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#3276b1),color-stop(17%,rgba(50,118,177,0.83)),color-stop(100%,rgba(50,118,177,0)));background:-webkit-linear-gradient(top,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:-o-linear-gradient(top,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:-ms-linear-gradient(top,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:linear-gradient(to bottom,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%)}.modal-overflow .scrollmarker.bottom{background:-moz-linear-gradient(bottom,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:-webkit-gradient(linear,left bottom,left top,color-stop(0%,#3276b1),color-stop(17%,rgba(50,118,177,0.83)),color-stop(100%,rgba(50,118,177,0)));background:-webkit-linear-gradient(bottom,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:-o-linear-gradient(bottom,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:-ms-linear-gradient(bottom,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:linear-gradient(to top,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%)}.pricing-big{border:0!important}.pricing-big .panel-heading{border-radius:5px 5px 0 0}.pricing-big .panel-title{text-transform:capitalize;font-size:18px;padding:20px 0;text-align:center;border-radius:5px 5px 0 0;margin:0;font-weight:700}.pricing-big .the-price{padding:20px 0;background:#333;text-align:center;font-size:24px;font-weight:700;color:#FFF;-webkit-box-shadow:none!important;box-shadow:none!important}.pricing-big .subscript{font-size:18px;color:#999;margin-left:5px}.pricing-big .panel-footer{border-radius:0 0 5px 5px;background-color:#f2f2f2!important}.pricing-big .panel-footer>div{padding:15px 0 10px;display:block;font-size:13px}.pricing-big .panel-footer .btn{padding:15px 0;border-radius:3px;font-weight:700;font-size:14px}.pricing-big .panel-footer .btn span{font-weight:400;font-style:italic}.pricing-big table{background:#fafafa;padding:20px 15px;height:230px;text-align:left}.price-features{background:#fafafa;padding:20px 15px;min-height:230px;font-size:13.5px}.price-features .price-features li+li{margin-top:10px}.superbox *,.superbox :after,.superbox :before{margin:0;padding:0;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-font-smoothing:antialiased;-moz-font-smoothing:antialiased;-o-font-smoothing:antialiased;font-smoothing:antialiased;text-rendering:optimizeLegibility}.superbox-list{display:inline-block;*display:inline;zoom:1;width:12.5%;padding:5px;position:relative}.superbox-list.active:before{content:"\f0d8";font-family:FontAwesome;display:block;position:absolute;left:43%;bottom:-34px;z-index:2;text-align:center;font-size:45px;color:#222}@media only screen and (min-width:320px){.superbox-list{width:50%}}@media only screen and (min-width:486px){.superbox-list{width:25%}}@media only screen and (min-width:768px){.superbox-list{width:16.66666667%}}@media only screen and (min-width:1025px){.superbox-list{width:12.5%}}@media only screen and (min-width:1824px){.superbox-list{width:12.5%}}.superbox-img{max-width:100%;width:100%;cursor:pointer}.superbox-show{text-align:left;position:relative;background-color:#222;width:100%;float:left;padding:25px 0 12px 25px;display:none;margin:5px 0}.superbox-current-img{max-width:100%;float:left;padding-right:25px;padding-bottom:13px}.superbox-img:hover{opacity:.8}.superbox-float{float:left}.superbox-close{opacity:.7;cursor:pointer;position:absolute;top:15px;right:15px;-webkit-transition:all .1s linear 0s;transition:all .1s linear 0s}.superbox-close:hover{opacity:1}.superbox-imageinfo{display:inline-block;max-width:500px;color:#fff;padding:0 25px 0 0}.superbox-imageinfo span{font-size:13px;color:#a19994;margin-right:-2px;padding-top:10px;display:inline-block;padding-bottom:13px}.superbox-imageinfo>:first-child{margin-bottom:10px;font-weight:700}.superbox-imageinfo span p:last-child{margin-top:30px}.bootstrap-tagsinput{display:block;width:100%;min-height:32px;padding:1px 3px;font-size:13px;line-height:1.428571429;color:#555;vertical-align:middle;background-color:#FFF;border:1px solid #CCC;border-radius:0}.bootstrap-tagsinput>span{border-radius:0!important;font-weight:400;padding:3px 28px 4px 8px;font-size:13px;border:1px solid #285e8e;background:#3276b1}.bootstrap-tagsinput input{border:0;-webkit-box-shadow:none;box-shadow:none;outline:0;background-color:transparent;padding:0;margin:0;width:auto!important;max-width:inherit}.bootstrap-tagsinput input:focus{border:0;-webkit-box-shadow:none;box-shadow:none}.bootstrap-tagsinput .tag{color:#FFF;position:relative;margin:3px 0 3px 2px;display:inline-block}.bootstrap-tagsinput .tag [data-role=remove]{display:block;top:-1px;right:0;padding:3px 4px 3px 5px;width:23px;height:22px;position:absolute;cursor:pointer}.bootstrap-tagsinput .tag [data-role=remove]:after{content:"\f057";font-family:fontAwesome;padding:2px 1px;line-height:17px;font-size:15px;text-align:center}.bootstrap-tagsinput .tag [data-role=remove]:hover{background:rgba(0,0,0,0.3);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05)}.bootstrap-tagsinput .tag [data-role=remove]:hover:active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.slider{display:inline-block;vertical-align:middle;position:relative}.slider.slider-horizontal{width:100%!important;height:20px}.slider.slider-horizontal .slider-track{height:10px;width:100%;margin-top:-5px;top:50%;left:0}.slider.slider-horizontal .slider-selection{height:100%;top:0;bottom:0}.slider.slider-horizontal .slider-selection+.slider-handle.triangle+.slider-handle.triangle:before{content:"\f0d9"}.slider.slider-horizontal .slider-handle{margin-left:-10px;margin-top:-5px}.slider.slider-horizontal .slider-handle.triangle{width:20px;height:20px;filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);border:0;line-height:21px;color:#797777;text-shadow:0 1px 0 rgba(255,255,255,0.8)}.slider.slider-horizontal .slider-handle.triangle:before{content:"\f0da";font-size:34px}.slider.slider-vertical{height:210px;width:20px}.slider.slider-vertical .slider-track{width:10px;height:100%;margin-left:-5px;left:50%;top:0}.slider.slider-vertical .slider-selection{width:100%;left:0;top:0;bottom:0}.slider.slider-vertical .slider-selection+.slider-handle.triangle+.slider-handle.triangle:before{content:"\f0d8";text-shadow:0 -1px 0 rgba(255,255,255,0.8)}.slider.slider-vertical .slider-handle{margin-left:-5px;margin-top:-10px}.slider.slider-vertical .slider-handle.triangle{width:20px;height:20px;filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);border:0;line-height:21px;color:#797777;text-shadow:0 -1px 0 rgba(255,255,255,0.8)}.slider.slider-vertical .slider-handle.triangle:before{content:"\f0d7";font-size:32px;text-shadow:0 1px 0 rgba(255,255,255,0.8)}.slider input{display:none}.slider .tooltip-inner{white-space:nowrap}.slider-track{position:absolute;cursor:pointer;background:#e5e5e5}.slider-danger+.slider-track>.slider-selection{background:#a90329}.slider-warning+.slider-track>.slider-selection{background:#c79121}.slider-info+.slider-track>.slider-selection{background:#57889c}.slider-success+.slider-track>.slider-selection{background:#739e73}.slider-selection{position:absolute;background:#3276b1}.slider-handle{position:absolute;width:20px;height:20px;border:1px solid #FFF;background:#858585;display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;line-height:18px;font-size:10px;color:#ccc;text-shadow:0 1px 0 rgba(77,77,77,0.5);filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.slider-handle:before{content:"\f0c9"}.slider-handle.round{border-radius:20px;width:20px;height:20px}.slider-handle.triangle{background:transparent none}.fd-form-element-hidden{display:none}.fd-slider{width:100%;height:20px;margin:0}.fd-slider-vertical{width:20px;height:100%;margin:0 10px 10px 0}.fd-slider,.fd-slider-vertical{display:block;position:relative;text-decoration:none;border:0 none;-moz-user-select:none;-khtml-user-select:none;-webkit-touch-callout:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.fd-slider-inner{display:none}.fd-slider-bar{position:absolute;display:block;z-index:2;height:6px;width:100%;border:1px solid #bbb;border-bottom:1px solid #fff;border-right:1px solid #fff;margin:0;padding:0;overflow:hidden;line-height:4px;top:8px;border-radius:4px;-webkit-background-clip:padding-box;background-clip:padding-box;background-color:#333}.fd-slider-range{position:absolute;display:block;z-index:3;height:6px;margin:0;padding:0 2px 0 0;overflow:hidden;top:9px;border-radius:2px;-webkit-background-clip:padding-box;background-clip:padding-box;background-color:#eee}.fd-slider-handle{position:absolute;display:block;padding:0;margin:0 0 0 1px;z-index:3;top:5px;left:0;width:12px;height:12px;line-height:1px!important;outline:0 none;background:#eee;border:1px solid #aaa;border-radius:12px;-webkit-user-select:none;-webkit-touch-callout:none;-moz-user-select:none;-moz-user-focus:none;-moz-outline:0 none;-ms-user-select:none;user-select:none}.fd-slider-handle:focus{outline:0 none;border:0 none;-moz-user-focus:normal}.fd-slider-handle:before,.fd-slider-handle:after{opacity:0;-webkit-transition-property:opacity;-webkit-transition-duration:1s;-webkit-transition-delay:1s;transition-property:opacity;transition-duration:1s;transition-delay:1s}button.fd-slider-handle:focus::-moz-focus-inner{border-color:transparent}.oldie .fd-slider-handle:after,.oldie .fd-slider-handle:before{display:none}body.fd-slider-drag-horizontal,body.fd-slider-drag-horizontal *,body.fd-slider-drag-vertical,body.fd-slider-drag-vertical *{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.fd-slider-active .fd-slider-handle :before,.fd-slider-focused .fd-slider-handle :before,.fd-slider-hover .fd-slider-handle :before{display:block;position:absolute;top:-21px;left:-8px;margin:0;width:20px;padding:3px;height:14px;line-height:12px;text-align:center;font-size:10px;font-weight:700;color:#fff;text-shadow:1px 1px 1px #1a3a95;background:#2f6ee0;z-index:1;content:attr(aria-valuetext);border-radius:3px;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-box-shadow:0 0 4px #aaa;box-shadow:0 0 4px #999;opacity:1}.fd-slider-active .fd-slider-handle:after,.fd-slider-focused .fd-slider-handle:after,.fd-slider-hover .fd-slider-handle:after{outline:0;content:"";display:block;position:absolute;top:-9px;left:50%;margin:0 0 0 -5px;background:#2f6ee0;z-index:2;width:10px;height:10px;overflow:hidden;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-o-transform:rotate(45deg);-webkit-box-shadow:0 0 4px #aaa;box-shadow:0 0 4px #aaa;clip:rect(4px,14px,14px,4px);opacity:1}.chart{height:220px;margin:20px 5px 10px 10px}.chart-small{height:100px;width:100%}.chart-large{height:235px;width:100%}.chart-xl{height:297px;width:100%}#flotTip{padding:3px 5px;background-color:#fff;z-index:9999;color:#333;-webkit-box-shadow:0 1px 8px rgba(0,0,0,0.1);box-shadow:0 1px 8px rgba(0,0,0,0.1);font-size:14px;border:1px solid #c1c1c1;-khtml-border-radius:4px;border-radius:4px}#flotTip span{color:#38812d;font-weight:700}.has-legend{margin-top:30px!important}.has-legend-unique{margin-top:19px!important}.legendLabel span{display:block;margin:0 5px}.legendColorBox{padding-left:10px;vertical-align:top;padding-top:5px}.legendColorBox div>div{width:4px;height:4px;border-radius:50%;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box}.morris-hover{position:absolute;z-index:1001}.morris-hover.morris-default-style{border-radius:10px;padding:6px;color:#666;background:rgba(255,255,255,0.8);border:solid 2px rgba(230,230,230,0.8);font-family:Ubuntu,sans-serif;font-size:12px;text-align:center}.morris-hover.morris-default-style .morris-hover-row-label{font-weight:700;margin:.25em 0}.morris-hover.morris-default-style .morris-hover-point{white-space:nowrap;margin:.1em 0}.easyPieChart{position:relative;text-align:center}.easyPieChart canvas{position:absolute;top:0;left:0}.easy-pie-chart{display:inline-block}.easy-pie-chart .percent{color:#444;font-size:12px;font-weight:700}.easy-pie-title{display:inline-block;margin:10px 6px 0;font-size:12px;font-weight:400;text-transform:uppercase;width:100px;height:19px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.easy-pie-title .icon-color-bad,.easy-pie-title .icon-color-good{font-size:18px}.show-stat-buttons{float:left;width:100%}@media(max-width:767px){.show-stat-buttons{padding-left:10px!important;padding-right:10px!important}}@media only screen and (min-width:0) and (max-width:679px){.show-stat-buttons{padding-left:10px!important;padding-right:10px!important}}@media only screen and (min-width:320px) and (max-width:479px){.show-stat-buttons{padding-left:10px!important;padding-right:10px!important}}.show-stats{padding-top:6px!important}.show-stats .progress{height:7px;border-radius:0;margin-top:3px;margin-bottom:15px}.show-stats .show-stat-buttons>:first-child{padding-right:5px}@media(max-width:979px){.show-stats .show-stat-buttons>:first-child{padding-right:13px}}.show-stats .show-stat-buttons>:last-child{padding-left:5px}@media(max-width:979px){.show-stats .show-stat-buttons>:last-child{padding-left:13px}}.show-stat-microcharts{margin-left:-10px;margin-right:-10px}.show-stat-microcharts>div{border-right:1px solid #dadada!important;border-top:1px solid #dadada!important;margin-top:10px!important;height:65px;overflow:hidden;padding:7px 9px}@media(max-width:767px){.show-stat-microcharts>div{margin-top:0!important;border-right:0!important}}@media only screen and (min-width:0) and (max-width:679px){.show-stat-microcharts>div{margin-top:0!important;border-right:0!important}}@media only screen and (min-width:320px) and (max-width:479px){.show-stat-microcharts>div{margin-top:0!important;border-right:0!important}}.show-stat-microcharts>:last-child{border-right:0!important}.show-stat-microcharts .sparkline{margin-top:10px;margin-right:8px;opacity:.7}.show-stat-microcharts .sparkline:hover{opacity:1}.smaller-stat{margin:0;padding:0;list-style:none}.smaller-stat li{margin-top:3px;margin-right:0}.smaller-stat li:first-child{margin-top:8px}.smaller-stat span.label{width:40px;display:block;text-align:left;opacity:.5;cursor:default}.smaller-stat span.label:hover{opacity:1}.jvectormap-label{position:absolute;display:none;border:solid 1px #cdcdcd;border-radius:3px;background:#292929;color:#fff;font-family:Ubuntu,sans-serif,Verdana;font-size:smaller;padding:3px}.jvectormap-zoomin{top:0}.jvectormap-zoomout{top:24px}.jvectormap-zoomin,.jvectormap-zoomout{position:absolute;background:#292929;padding:4px;width:22px;height:22px;cursor:pointer;line-height:10px;text-align:center;font-size:14px;border-radius:2px;box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05);-webkit-box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05);background-color:#fff;border:1px solid #bfbfbf}.jvectormap-zoomin:hover,.jvectormap-zoomout:hover{background:#eee;border-color:#d9d9d9}.vector-map{height:300px;width:100%;padding:10px}#chat-container{position:absolute;width:250px;height:270px;z-index:2;border-left:1px solid #cdcecf;right:-251px;top:0;background:#fff;transition-duration:.25s;-webkit-transition-duration:.25s}#chat-container:hover,#chat-container:hover .chat-list-open-close{border-color:#a7a7a7}#chat-container *,#chat-container :after,#chat-container :before{box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box}#chat-container input[type=text]{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}#chat-container.open{right:0;top:0}#chat-container.open .chat-list-open-close i:before{content:"\f00d"!important}#chat-container.open .chat-list-open-close b{display:none}#chat-container .chat-list-open-close{display:block;width:25px;height:25px;border:1px solid #cdcecf;border-right:1px solid #f2f4f8!important;position:absolute;left:-32px;top:7%;border-radius:50% 0 0 50%;padding:3px 1px 3px 5px;font-size:21px;line-height:22px;cursor:pointer;color:#868686;-webkit-box-shadow:inset 0 .2em 0 rgba(0,0,0,0.05);box-shadow:inset 0 .2em 0 rgba(0,0,0,0.05);background:#f2f4f8;text-align:center}#chat-container .chat-list-open-close b{position:absolute;right:0;background:#ed1c24;line-height:9px;height:10px;width:10px;top:3px;border:1px solid #FFF;border-radius:3px;font-size:9px;text-align:center;vertical-align:middle;color:#fff;font-weight:400}#chat-container .chat-list-body{height:217px;overflow-y:scroll;overflow-x:hidden;display:block;padding:0;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;background:#f2f4f8}#chat-container #chat-users{list-style:none;margin:10px 0;padding:0}#chat-container #chat-users li{margin-bottom:3px;margin-left:5px}#chat-container #chat-users li a{display:block;font-size:13px;color:#3d3d3d;text-decoration:none!important;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding:3px 8px 3px 3px;line-height:33px;vertical-align:middle}#chat-container #chat-users li a:hover{background:#e0e4ee}#chat-container #chat-users li a img{width:33px;height:auto;margin-right:10px}#chat-container #chat-users li a i{color:#acacac;font-size:8px;line-height:34px;font-style:normal}#chat-container #chat-users li a i.last-online{font-size:12px;letter-spacing:-1px}#chat-container .chat-list-footer{overflow:hidden;border-top:1px solid #CCC;padding:10px;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}#chat-container .chat-list-footer input[type=text]{border:1px solid #bababa!important}#chat-container .control-group{padding:0}.chat-body{background:#fafafa;background:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJod…EiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fafafa),color-stop(100%,#fff));background:-webkit-linear-gradient(top,#fafafa 0,#fff 100%);background:-webkit-gradient(linear,top left,bottom left,from(#f5fcff),to(#fff));background:-webkit-linear-gradient(top,#f5fcff 0,#fff 100%);background:linear-gradient(to bottom,#f5fcff 0,#fff 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fafafa',endColorstr='#ffffff',GradientType=0);-webkit-box-shadow:inset 2px 2px 5px rgba(0,0,0,0.04);box-shadow:inset 2px 2px 5px rgba(0,0,0,0.04);display:block;height:270px;overflow-y:scroll;overflow-x:hidden;padding:10px;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;border:1px solid #fff;border-top:0}.chat-body ul{margin:0;padding:0}.chat-body li:first-child{margin-top:10px}.chat-body li.message{display:block;position:relative;margin:20px 20px 0}.chat-body li.message img{display:inline-block;border-left:4px solid #fff;position:absolute}.chat-body li.message img.online{border-left-color:#00a300}.chat-body li.message img.offline{border-left-color:#ddd}.chat-body li.message img.busy{border-left-color:#a90329}.chat-body li.message img.away{border-left-color:#ffc40d}.chat-body li.message .message-text{display:inline-block;vertical-align:top;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding:0;margin-left:65px;line-height:normal}.chat-body li.message .message-text time{position:absolute;top:1px;right:0;font-size:10px;line-height:10px;color:#afafaf}.chat-body li.message .message-text .chat-file{display:block;margin:3px 0;padding:4px;border:1px dotted #ddd;background:rgba(0,0,0,0.05);border-radius:4px;text-align:right;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.chat-body li.message .message-text .chat-file:nth-child(3){margin-top:15px}.chat-body li.message .message-text .chat-file.row-fluid [class*=span]{min-height:10px!important}.chat-body li.message .message-text .chat-file b{font-style:italic;white-space:nowrap;width:250px;overflow:hidden;text-overflow:ellipsis;text-align:left}@media(min-width:768px) and (max-width:880px){.chat-body li.message .message-text .chat-file b{width:150px}}@media only screen and (min-width:320px) and (max-width:479px){.chat-body li.message .message-text .chat-file b{width:150px}}@media(max-width:480px){.chat-body li.message .message-text .chat-file b{width:150px}}.chat-body li.message .message-text a.username{display:block;font-weight:700;margin-bottom:4px;vertical-align:top;line-height:14px;font-size:14px;letter-spacing:-1px;text-decoration:none!important}.chat-footer{border-top:1px solid rgba(0,0,0,0.1);background:rgba(248,248,248,0.9);padding:0 10px 15px;position:relative;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.profile-message{background:none!important;height:auto!important;box-shadow:none!important;-webkit-box-shadow:none!important;overflow:hidden}.profile-message li.message.message-reply{margin-left:85px!important;background:#f7f7f7;padding:10px;margin:3px 0 0 20px}.profile-message li.message.message-reply img{width:35px!important}.profile-message li.message.message-reply .message-text{margin-left:45px!important}.profile-message .wall-comment-reply{margin-left:85px;margin-bottom:20px}.cajita img{width:23px;height:23px;padding-left:3px;padding-top:3px}#pageslide{display:none;position:absolute;position:fixed;top:0;height:100%;z-index:999999;width:305px;padding:20px;background-color:#004d60;color:#FFF;-webkit-box-shadow:inset 0 0 5px 5px #222;-moz-shadow:inset 0 0 0 0 #222;box-shadow:inset 0 0 0 0 #222}.purehtml{color:#fff;font-size:16px}#inbox-table{font-size:13px;border-top:0;border-left-color:transparent!important;border-right-color:transparent!important}#inbox-table tbody tr:hover{cursor:pointer;background:#e4e4e4}#inbox-table tr td{border-right:0;border-left:0;line-height:26px;padding:6px 4px 7px!important}#inbox-table .inbox-table-icon{padding-left:15px!important}@media(max-width:979px){#inbox-table .inbox-table-icon{padding-left:10px!important}}#inbox-table tbody tr th{overflow:hidden}#inbox-table.table tbody>tr>td{border-color:#fff!important}#inbox-table .checkbox,#inbox-table .radio{margin-top:-1px;margin-bottom:0}.minified .inbox-badge{border-radius:50%;font-size:9px;padding:2px;position:absolute;top:6px;right:6px;background:#ed1c24;min-width:13px}.inbox-body{position:relative}.inbox-body .table-wrap{background:#fff;padding:10px 14px 7px;position:relative;margin-left:200px}@media(max-width:1024px){.inbox-body .table-wrap{margin-left:0!important}}@media(max-width:979px){.inbox-body .table-wrap{padding:0!important}}.inbox-body.no-content-padding{margin-top:0;background:#fff}.inbox-nav-bar{height:70px;margin-bottom:0;padding:20px 14px;background:#fff}@media(max-width:979px){.inbox-nav-bar{padding-left:5px;padding-right:5px}}@media(min-width:768px) and (max-width:880px){.inbox-nav-bar.no-content-padding{margin-top:-10px!important}}@media(max-width:767px){.inbox-nav-bar.no-content-padding{margin-top:-10px!important}}@media only screen and (min-width:0) and (max-width:679px){.inbox-nav-bar.no-content-padding{margin-top:-10px!important}}@media only screen and (min-width:320px) and (max-width:479px){.inbox-nav-bar.no-content-padding{margin-top:-10px!important}}.inbox-nav-bar .page-title{display:inline-block;margin:0;width:196px;line-height:33px;vertical-align:middle}.inbox-footer{height:52px;padding:15px 14px 0;border-top:1px solid #cecece;background:#2a2725;position:absolute;bottom:-53px;width:100%}.inbox-footer .btn-group,.inbox-paging{margin-left:10px}.inbox-data-attachment,.inbox-table-icon{width:28px;text-align:left;padding-left:12px!important;padding-right:0!important}.inbox-data-from{width:200px}.inbox-data-from>:first-child{width:200px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.inbox-data-date{width:80px;padding-left:7px!important;padding-right:0!important}.inbox-data-message>:first-child{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;height:27px;color:#8a8a8a}@media(max-width:979px){.inbox-data-message>:first-child{height:50px;overflow:hidden}}.inbox-data-message>:first-child span{color:#111}.inbox-data-message>:first-child span.label{color:#fff}@media(max-width:979px){.inbox-data-message>:first-child>:first-child{display:block!important;font-size:14px}}.inbox-data-message>:first-child>:first-child:after{content:" - "}.inbox-checkbox-triggered{display:inline-block}.inbox-checkbox-triggered>.btn-group{margin-right:10px}.inbox-checkbox-triggered>.btn-group .btn{padding-left:14px;padding-right:14px}@media(max-width:979px){.inbox-checkbox-triggered>.btn-group .btn{padding-left:10px;padding-right:10px}}.inbox-side-bar{height:100%;position:absolute;background:#fff;display:block;width:200px;padding:10px 0 10px 14px}@media(max-width:1024px){.inbox-side-bar{display:none!important}}.inbox-side-bar h6{font-weight:400;font-size:11px;display:block;padding:0 15px;text-transform:uppercase;color:#838383}.inbox-side-bar h6 a{font-size:14px;margin-top:-2px}.inbox-side-bar h6 .tooltip{text-transform:none!important}.inbox-side-bar>.btn{margin-bottom:35px}.inbox-side-bar .input-group{margin-bottom:25px}.inbox-space{display:block;width:185px}.inbox-space>.progress{margin-top:5px}.inbox .inbox-menu-lg{list-style:none;padding:0;margin:0 0 20px}.inbox .inbox-menu-lg .inbox-menu-lg li{display:block;width:100%}.inbox .inbox-menu-lg .inbox-menu-lg li a{display:block;padding:6px 15px 7px;font-size:13px;color:#333}.inbox .inbox-menu-lg .inbox-menu-lg li a:hover{text-decoration:none;background:#f4f4f4}.inbox .inbox-menu-lg .inbox-menu-lg li.active a{font-weight:700;background:#f0f0f0;border-bottom:1px solid #e7e7e7;color:#3276b1}.inbox .inbox-menu-sm{list-style:none;padding:0;margin:0 0 20px}.inbox .inbox-menu-sm .inbox-menu-sm li{display:block;width:100%}.inbox .inbox-menu-sm .inbox-menu-sm li a{display:block;padding:8px 15px 10px;font-size:13px;color:#333}.inbox .inbox-menu-sm .inbox-menu-sm li a:hover{text-decoration:none;background:#f4f4f4}.inbox .inbox-menu-sm .inbox-menu-sm li.active a{font-weight:700;background:#f0f0f0;border-bottom:1px solid #e7e7e7;color:#3276b1}.inbox-info-bar{padding:10px 0;border-bottom:1px solid #bfbfbf}.inbox-info-bar .form-group{margin:0}.inbox-info-bar .form-group input,.inbox-info-bar .select2-container-multi .select2-choices{border-color:#fff!important}.inbox-info-bar .select2-choices>div{display:none}.inbox-info-bar .col-md-1,.inbox-info-bar .col-md-11{padding-left:0;padding-right:0}@media(max-width:1024px){.inbox-info-bar .col-md-1,.inbox-info-bar .col-md-11{padding-left:26px;padding-right:26px}}.inbox-info-bar img{width:35px;height:auto;display:inline-block;vertical-align:middle;margin-right:7px;margin-left:2px;border-left:3px solid #fff}.inbox-info-bar em{position:absolute;top:6px;right:20px;text-align:right;font-style:normal}.inbox-download .inbox-message{padding:15px 4px;border-bottom:1px solid #bfbfbf}.inbox-download-list{list-style:none;margin:5px 0 0;padding:0}.inbox-download-list li{display:inline-block;margin:0 5px 0 0;vertical-align:top}.inbox-download-list li>:first-child{margin-bottom:0;width:150px;overflow:hidden}.inbox-download-list li>:first-child:hover{background:#fff;border-color:silver}.inbox-download-list li>:first-child>:first-child{text-align:center;display:block;color:#d6d6d6}.inbox-download-list li>:first-child>:first-child>.fa{font-size:150px}.inbox-download-list li>:first-child>:first-child>img{max-width:120px}.inbox-compose-footer{padding:10px;background:#f5f5f5;border-bottom:1px solid #a9a9a9}.inbox-compose-footer,.inbox-download,.inbox-info-bar,.inbox-message{margin-right:240px;position:relative}@media(max-width:1280px){.inbox-compose-footer,.inbox-download,.inbox-info-bar,.inbox-message{margin-right:0}}@media(max-width:979px){.inbox-table-icon>:first-child{margin-top:12px}}.unread td{background:#fff}.unread .inbox-data-date>:first-child,.unread .inbox-data-from>:first-child,.unread .inbox-data-message>:first-child>:first-child{font-weight:700}tr.highlight td,tr.unread.highlight td{background:#ffc!important;color:#333}#compose-mail-mini{margin-left:4px}.email-open-header{margin:-10px 0 0 0;font-size:20px;border-bottom:1px solid #bfbfbf;border-top:1px solid #eee;padding:15px 3px}.email-open-header>span{font-size:10px;font-weight:400;padding:3px 5px;letter-spacing:normal;text-transform:uppercase;vertical-align:middle;line-height:33px;background:#acacac}.email-infobox{display:block;width:180px;border-bottom:1px solid #bfbfbf;padding-bottom:0;padding-top:15px;position:absolute;top:65px;right:15px}@media(max-width:1280px){.email-infobox .email-infobox{display:none}}.email-reply-text>div{border-left:1px solid #d6d6d6;padding-left:10px;margin-left:50px;color:#a9a9a9}.email-reply-text>:first-child{padding-left:45px}.profile-pic{text-align:right}.profile-pic>img{border-radius:0;position:relative;border:5px solid #fff;top:-30px;display:inline-block;text-align:right;z-index:4;width:120px;margin-bottom:-30px}.profile-carousel .carousel-inner{max-height:150px}.friends-list li{margin-bottom:10px}.friends-list li img{width:35px;border:1px solid #fff;outline:1px solid #bfbfbf}.search-results{padding:18px 5px}.search-results+.search-results{border-top:1px dashed #e3e3e3}.search-results>:first-child{margin-bottom:4px;font-weight:400}.search-results>:first-child a{text-decoration:underline}.search-results .url{font-style:normal;font-size:14px}.search-results img{display:inline-block;margin-top:4px;margin-right:4px;width:80px}.search-results>div{display:inline-block;vertical-align:top}.search-results .note{margin:0;line-height:normal}.search-results .note a{text-decoration:none!important;color:#333}.search-results .note a:hover{color:#ed1c24}.todo{margin:0;padding:0;min-height:5px;list-style:none}.todo>li{display:block;position:relative;overflow:hidden;border-bottom:1px solid #e7e7e7;margin:0 5px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAQCAYAAADagWXwAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0IDc5LjE1MTQ4MSwgMjAxMy8wMy8xMy0xMjowOToxNSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo0RkQ1OEY4NTM4NUIxMUUzQjdCMUMxQzJCQUE3MTMxOCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo0RkQ1OEY4NjM4NUIxMUUzQjdCMUMxQzJCQUE3MTMxOCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjRGRDU4RjgzMzg1QjExRTNCN0IxQzFDMkJBQTcxMzE4IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjRGRDU4Rjg0Mzg1QjExRTNCN0IxQzFDMkJBQTcxMzE4Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+pTD+wgAAACtJREFUeNpimDBhwn8gYABhdDYjiIELMDHgAUwTJ06Ea0VnjxpLO2MBAgwAGYZLegQbQ3UAAAAASUVORK5CYII=) 1px 11px no-repeat}.todo>li:last-child,.todo>li:only-child{border-bottom:0}.todo>li>:first-child{display:block;border-right:1px solid #ffe1eb;height:100%;padding:6px 11px 6px 18px;width:20px;vertical-align:top;position:absolute}.todo>li>:first-child:hover{cursor:move}.todo>li.complete{background:0}.todo>li.complete.complete>:first-child:hover{cursor:default}.todo>li.complete>*{text-decoration:line-through;font-style:italic}.todo>li.ui-sortable-helper{border-top:1px solid #eee;background:rgba(113,132,63,0.1)}.todo>li>p{height:100%;margin-left:52px;border-left:1px solid #ffe1eb;display:inline-block;padding:8px 0 6px 7px;margin-bottom:0;min-height:37px;line-height:normal;font-size:14px;font-weight:500;color:#333}.todo>li>p>span{display:block;line-height:12px;font-size:10px;font-weight:400}.todo>li>p>:first-child{margin-top:-5px;color:#999;margin-bottom:4px}.todo>li>p>.date{color:#bfbfbf}.todo-group-title{margin:0;line-height:31px;padding:0 0 0 10px;background:#fafafa;border-bottom:1px solid #e7e7e7;border-top:1px solid #f4f4f4;color:#999} \ No newline at end of file +.txt-color-blue{color:#60747c!important}.txt-color-blueLight{color:#ccdadf!important}.txt-color-blueDark{color:#4c4f53!important}.txt-color-green{color:#356e35!important}.txt-color-greenLight{color:#71843f!important}.txt-color-greenDark{color:#496949!important}.txt-color-red{color:#931313!important}.txt-color-yellow{color:#d4c737!important}.txt-color-yellowLight{color:#fff03d!important}.txt-color-orange{color:#c79121!important}.txt-color-orangeLight{color:#ee9000!important}.txt-color-orangeDark{color:#a57225!important}.txt-color-pink{color:#ac5287!important}.txt-color-pinkDark{color:#a8829f!important}.txt-color-purple{color:#65596b!important}.txt-color-darken{color:#404040!important}.txt-color-silver{color:#b4b4b4!important}.txt-color-lighten{color:#d5e7ec!important}.txt-color-white{color:#dedede!important}.txt-color-grayDark{color:#525252!important}.txt-color-magenta{color:#6e3671!important}.txt-color-teal{color:#568a89!important}.txt-color-redLight{color:#a65858!important}.txt-color-active{color:#3276b1!important}.txt-color-activeBg{color:#cedbf7!important}.bg-color-blue{background-color:#60747c!important}.bg-color-blueLight{background-color:#ccdadf!important}.bg-color-blueDark{background-color:#4c4f53!important}.bg-color-green{background-color:#356e35!important}.bg-color-greenLight{background-color:#71843f!important}.bg-color-greenDark{background-color:#496949!important}.bg-color-red{background-color:#931313!important}.bg-color-yellow{background-color:#d4c737!important}.bg-color-yellowLight{background-color:#fff03d!important}.bg-color-orange{background-color:#c79121!important}.bg-color-orangeLight{background-color:#ee9000!important}.bg-color-orangeDark{background-color:#a57225!important}.bg-color-pink{background-color:#ac5287!important}.bg-color-pinkDark{background-color:#a8829f!important}.bg-color-purple{background-color:#65596b!important}.bg-color-darken{background-color:#404040!important}.bg-color-silver{background-color:#b4b4b4!important}.bg-color-lighten{background-color:#d5e7ec!important}.bg-color-white{background-color:#dedede!important}.bg-color-grayDark{background-color:#525252!important}.bg-color-magenta{background-color:#6e3671!important}.bg-color-teal{background-color:#568a89!important}.bg-color-redLight{background-color:#a65858!important}.bg-color-active{background-color:#3276b1!important}.bg-color-activeBg{background-color:#cedbf7!important}@-webkit-keyframes flash{0%,100%,50%{opacity:1}25%,75%{opacity:0}}@keyframes flash{0%,100%,50%{opacity:1}25%,75%{opacity:0}}@-webkit-keyframes shake{0%,100%{-webkit-transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px)}}@keyframes shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}@-webkit-keyframes bounce{0%,100%,20%,50%,80%{-webkit-transform:translateY(0)}40%{-webkit-transform:translateY(-30px)}60%{-webkit-transform:translateY(-15px)}}@keyframes bounce{0%,100%,20%,50%,80%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}40%{-webkit-transform:translateY(-30px);-ms-transform:translateY(-30px);transform:translateY(-30px)}60%{-webkit-transform:translateY(-15px);-ms-transform:translateY(-15px);transform:translateY(-15px)}}@-webkit-keyframes tada{0%{-webkit-transform:scale(1)}10%,20%{-webkit-transform:scale(0.9) rotate(-3deg)}30%,50%,70%,90%{-webkit-transform:scale(1.1) rotate(3deg)}40%,60%,80%{-webkit-transform:scale(1.1) rotate(-3deg)}100%{-webkit-transform:scale(1) rotate(0)}}@keyframes tada{0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}10%,20%{-webkit-transform:scale(0.9) rotate(-3deg);-ms-transform:scale(0.9) rotate(-3deg);transform:scale(0.9) rotate(-3deg)}30%,50%,70%,90%{-webkit-transform:scale(1.1) rotate(3deg);-ms-transform:scale(1.1) rotate(3deg);transform:scale(1.1) rotate(3deg)}40%,60%,80%{-webkit-transform:scale(1.1) rotate(-3deg);-ms-transform:scale(1.1) rotate(-3deg);transform:scale(1.1) rotate(-3deg)}100%{-webkit-transform:scale(1) rotate(0);-ms-transform:scale(1) rotate(0);transform:scale(1) rotate(0)}}@-webkit-keyframes swing{100%,20%,40%,60%,80%{-webkit-transform-origin:top center}20%{-webkit-transform:rotate(15deg)}40%{-webkit-transform:rotate(-10deg)}60%{-webkit-transform:rotate(5deg)}80%{-webkit-transform:rotate(-5deg)}100%{-webkit-transform:rotate(0deg)}}@keyframes swing{20%{-webkit-transform:rotate(15deg);-ms-transform:rotate(15deg);transform:rotate(15deg)}40%{-webkit-transform:rotate(-10deg);-ms-transform:rotate(-10deg);transform:rotate(-10deg)}60%{-webkit-transform:rotate(5deg);-ms-transform:rotate(5deg);transform:rotate(5deg)}80%{-webkit-transform:rotate(-5deg);-ms-transform:rotate(-5deg);transform:rotate(-5deg)}100%{-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg)}}@-webkit-keyframes wobble{0%{-webkit-transform:translateX(0)}15%{-webkit-transform:translateX(-25%) rotate(-5deg)}30%{-webkit-transform:translateX(20%) rotate(3deg)}45%{-webkit-transform:translateX(-15%) rotate(-3deg)}60%{-webkit-transform:translateX(10%) rotate(2deg)}75%{-webkit-transform:translateX(-5%) rotate(-1deg)}100%{-webkit-transform:translateX(0)}}@keyframes wobble{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}15%{-webkit-transform:translateX(-25%) rotate(-5deg);-ms-transform:translateX(-25%) rotate(-5deg);transform:translateX(-25%) rotate(-5deg)}30%{-webkit-transform:translateX(20%) rotate(3deg);-ms-transform:translateX(20%) rotate(3deg);transform:translateX(20%) rotate(3deg)}45%{-webkit-transform:translateX(-15%) rotate(-3deg);-ms-transform:translateX(-15%) rotate(-3deg);transform:translateX(-15%) rotate(-3deg)}60%{-webkit-transform:translateX(10%) rotate(2deg);-ms-transform:translateX(10%) rotate(2deg);transform:translateX(10%) rotate(2deg)}75%{-webkit-transform:translateX(-5%) rotate(-1deg);-ms-transform:translateX(-5%) rotate(-1deg);transform:translateX(-5%) rotate(-1deg)}100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes pulse{0%{-webkit-transform:scale(1)}50%{-webkit-transform:scale(1.1)}100%{-webkit-transform:scale(1)}}@keyframes pulse{0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}100%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}@-webkit-keyframes flip{0%{-webkit-transform:perspective(400px) translateZ(0) rotateY(0) scale(1);-webkit-animation-timing-function:ease-out}40%{-webkit-transform:perspective(400px) translateZ(150px) rotateY(170deg) scale(1);-webkit-animation-timing-function:ease-out}50%{-webkit-transform:perspective(400px) translateZ(150px) rotateY(190deg) scale(1);-webkit-animation-timing-function:ease-in}80%{-webkit-transform:perspective(400px) translateZ(0) rotateY(360deg) scale(0.95);-webkit-animation-timing-function:ease-in}100%{-webkit-transform:perspective(400px) translateZ(0) rotateY(360deg) scale(1);-webkit-animation-timing-function:ease-in}}@keyframes flip{0%{-webkit-transform:perspective(400px) translateZ(0) rotateY(0) scale(1);-ms-transform:perspective(400px) translateZ(0) rotateY(0) scale(1);transform:perspective(400px) translateZ(0) rotateY(0) scale(1);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}40%{-webkit-transform:perspective(400px) translateZ(150px) rotateY(170deg) scale(1);-ms-transform:perspective(400px) translateZ(150px) rotateY(170deg) scale(1);transform:perspective(400px) translateZ(150px) rotateY(170deg) scale(1);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}50%{-webkit-transform:perspective(400px) translateZ(150px) rotateY(190deg) scale(1);-ms-transform:perspective(400px) translateZ(150px) rotateY(190deg) scale(1);transform:perspective(400px) translateZ(150px) rotateY(190deg) scale(1);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}80%{-webkit-transform:perspective(400px) translateZ(0) rotateY(360deg) scale(0.95);-ms-transform:perspective(400px) translateZ(0) rotateY(360deg) scale(0.95);transform:perspective(400px) translateZ(0) rotateY(360deg) scale(0.95);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}100%{-webkit-transform:perspective(400px) translateZ(0) rotateY(360deg) scale(1);-ms-transform:perspective(400px) translateZ(0) rotateY(360deg) scale(1);transform:perspective(400px) translateZ(0) rotateY(360deg) scale(1);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}}@-webkit-keyframes flipInX{0%{-webkit-transform:perspective(400px) rotateX(90deg);opacity:0}40%{-webkit-transform:perspective(400px) rotateX(-10deg)}70%{-webkit-transform:perspective(400px) rotateX(10deg)}100%{-webkit-transform:perspective(400px) rotateX(0deg);opacity:1}}@keyframes flipInX{0%{-webkit-transform:perspective(400px) rotateX(90deg);-ms-transform:perspective(400px) rotateX(90deg);transform:perspective(400px) rotateX(90deg);opacity:0}40%{-webkit-transform:perspective(400px) rotateX(-10deg);-ms-transform:perspective(400px) rotateX(-10deg);transform:perspective(400px) rotateX(-10deg)}70%{-webkit-transform:perspective(400px) rotateX(10deg);-ms-transform:perspective(400px) rotateX(10deg);transform:perspective(400px) rotateX(10deg)}100%{-webkit-transform:perspective(400px) rotateX(0deg);-ms-transform:perspective(400px) rotateX(0deg);transform:perspective(400px) rotateX(0deg);opacity:1}}@-webkit-keyframes flipOutX{0%{-webkit-transform:perspective(400px) rotateX(0deg);opacity:1}100%{-webkit-transform:perspective(400px) rotateX(90deg);opacity:0}}@keyframes flipOutX{0%{-webkit-transform:perspective(400px) rotateX(0deg);-ms-transform:perspective(400px) rotateX(0deg);transform:perspective(400px) rotateX(0deg);opacity:1}100%{-webkit-transform:perspective(400px) rotateX(90deg);-ms-transform:perspective(400px) rotateX(90deg);transform:perspective(400px) rotateX(90deg);opacity:0}}@-webkit-keyframes flipInY{0%{-webkit-transform:perspective(400px) rotateY(90deg);opacity:0}40%{-webkit-transform:perspective(400px) rotateY(-10deg)}70%{-webkit-transform:perspective(400px) rotateY(10deg)}100%{-webkit-transform:perspective(400px) rotateY(0deg);opacity:1}}@keyframes flipInY{0%{-webkit-transform:perspective(400px) rotateY(90deg);-ms-transform:perspective(400px) rotateY(90deg);transform:perspective(400px) rotateY(90deg);opacity:0}40%{-webkit-transform:perspective(400px) rotateY(-10deg);-ms-transform:perspective(400px) rotateY(-10deg);transform:perspective(400px) rotateY(-10deg)}70%{-webkit-transform:perspective(400px) rotateY(10deg);-ms-transform:perspective(400px) rotateY(10deg);transform:perspective(400px) rotateY(10deg)}100%{-webkit-transform:perspective(400px) rotateY(0deg);-ms-transform:perspective(400px) rotateY(0deg);transform:perspective(400px) rotateY(0deg);opacity:1}}@-webkit-keyframes flipOutY{0%{-webkit-transform:perspective(400px) rotateY(0deg);opacity:1}100%{-webkit-transform:perspective(400px) rotateY(90deg);opacity:0}}@keyframes flipOutY{0%{-webkit-transform:perspective(400px) rotateY(0deg);-ms-transform:perspective(400px) rotateY(0deg);transform:perspective(400px) rotateY(0deg);opacity:1}100%{-webkit-transform:perspective(400px) rotateY(90deg);-ms-transform:perspective(400px) rotateY(90deg);transform:perspective(400px) rotateY(90deg);opacity:0}}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes fadeInUp{0%{opacity:0;-webkit-transform:translateY(20px)}100%{opacity:1;-webkit-transform:translateY(0)}}@keyframes fadeInUp{0%{opacity:0;-webkit-transform:translateY(20px);-ms-transform:translateY(20px);transform:translateY(20px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes fadeInDown{0%{opacity:0;-webkit-transform:translateY(-20px)}100%{opacity:1;-webkit-transform:translateY(0)}}@keyframes fadeInDown{0%{opacity:0;-webkit-transform:translateY(-20px);-ms-transform:translateY(-20px);transform:translateY(-20px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes fadeInLeft{0%{opacity:0;-webkit-transform:translateX(-20px)}100%{opacity:1;-webkit-transform:translateX(0)}}@keyframes fadeInLeft{0%{opacity:0;-webkit-transform:translateX(-20px);-ms-transform:translateX(-20px);transform:translateX(-20px)}100%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes fadeInRight{0%{opacity:0;-webkit-transform:translateX(20px)}100%{opacity:1;-webkit-transform:translateX(0)}}@keyframes fadeInRight{0%{opacity:0;-webkit-transform:translateX(20px);-ms-transform:translateX(20px);transform:translateX(20px)}100%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0)}}@keyframes fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes fadeInDownBig{0%{opacity:0;-webkit-transform:translateY(-2000px)}100%{opacity:1;-webkit-transform:translateY(0)}}@keyframes fadeInDownBig{0%{opacity:0;-webkit-transform:translateY(-2000px);-ms-transform:translateY(-2000px);transform:translateY(-2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes fadeInLeftBig{0%{opacity:0;-webkit-transform:translateX(-2000px)}100%{opacity:1;-webkit-transform:translateX(0)}}@keyframes fadeInLeftBig{0%{opacity:0;-webkit-transform:translateX(-2000px);-ms-transform:translateX(-2000px);transform:translateX(-2000px)}100%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes fadeInRightBig{0%{opacity:0;-webkit-transform:translateX(2000px)}100%{opacity:1;-webkit-transform:translateX(0)}}@keyframes fadeInRightBig{0%{opacity:0;-webkit-transform:translateX(2000px);-ms-transform:translateX(2000px);transform:translateX(2000px)}100%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-webkit-keyframes fadeOutUp{0%{opacity:1;-webkit-transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(-20px)}}@keyframes fadeOutUp{0%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(-20px);-ms-transform:translateY(-20px);transform:translateY(-20px)}}@-webkit-keyframes fadeOutDown{0%{opacity:1;-webkit-transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(20px)}}@keyframes fadeOutDown{0%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(20px);-ms-transform:translateY(20px);transform:translateY(20px)}}@-webkit-keyframes fadeOutLeft{0%{opacity:1;-webkit-transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(-20px)}}@keyframes fadeOutLeft{0%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(-20px);-ms-transform:translateX(-20px);transform:translateX(-20px)}}@-webkit-keyframes fadeOutRight{0%{opacity:1;-webkit-transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(20px)}}@keyframes fadeOutRight{0%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(20px);-ms-transform:translateX(20px);transform:translateX(20px)}}@-webkit-keyframes fadeOutUpBig{0%{opacity:1;-webkit-transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(-2000px)}}@keyframes fadeOutUpBig{0%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(-2000px);-ms-transform:translateY(-2000px);transform:translateY(-2000px)}}@-webkit-keyframes fadeOutDownBig{0%{opacity:1;-webkit-transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(2000px)}}@keyframes fadeOutDownBig{0%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}}@-webkit-keyframes fadeOutLeftBig{0%{opacity:1;-webkit-transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(-2000px)}}@keyframes fadeOutLeftBig{0%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(-2000px);-ms-transform:translateX(-2000px);transform:translateX(-2000px)}}@-webkit-keyframes fadeOutRightBig{0%{opacity:1;-webkit-transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(2000px)}}@keyframes fadeOutRightBig{0%{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(2000px);-ms-transform:translateX(2000px);transform:translateX(2000px)}}@-webkit-keyframes bounceIn{0%{opacity:0;-webkit-transform:scale(0.3)}50%{opacity:1;-webkit-transform:scale(1.05)}70%{-webkit-transform:scale(0.9)}100%{-webkit-transform:scale(1)}}@keyframes bounceIn{0%{opacity:0;-webkit-transform:scale(0.3);-ms-transform:scale(0.3);transform:scale(0.3)}50%{opacity:1;-webkit-transform:scale(1.05);-ms-transform:scale(1.05);transform:scale(1.05)}70%{-webkit-transform:scale(0.9);-ms-transform:scale(0.9);transform:scale(0.9)}100%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}@-webkit-keyframes slideInDown{0%{opacity:0;-webkit-transform:translateY(-2000px)}100%{-webkit-transform:translateY(0)}}@keyframes slideInDown{0%{opacity:0;-webkit-transform:translateY(-2000px);-ms-transform:translateY(-2000px);transform:translateY(-2000px)}100%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes slideInLeft{0%{opacity:0;-webkit-transform:translateX(-2000px)}100%{-webkit-transform:translateX(0)}}@keyframes slideInLeft{0%{opacity:0;-webkit-transform:translateX(-2000px);-ms-transform:translateX(-2000px);transform:translateX(-2000px)}100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes slideInRight{0%{opacity:0;-webkit-transform:translateX(2000px)}100%{-webkit-transform:translateX(0)}}@keyframes slideInRight{0%{opacity:0;-webkit-transform:translateX(2000px);-ms-transform:translateX(2000px);transform:translateX(2000px)}100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes slideOutLeft{0%{-webkit-transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(-2000px)}}@keyframes slideOutLeft{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(-2000px);-ms-transform:translateX(-2000px);transform:translateX(-2000px)}}@-webkit-keyframes slideOutRight{0%{-webkit-transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(2000px)}}@keyframes slideOutRight{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}100%{opacity:0;-webkit-transform:translateX(2000px);-ms-transform:translateX(2000px);transform:translateX(2000px)}}@-webkit-keyframes slideOutUp{0%{-webkit-transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(-2000px)}}@keyframes slideOutUp{0%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(-2000px);-ms-transform:translateY(-2000px);transform:translateY(-2000px)}}@-webkit-keyframes bounceInUp{0%{opacity:0;-webkit-transform:translateY(2000px)}60%{opacity:1;-webkit-transform:translateY(-30px)}80%{-webkit-transform:translateY(10px)}100%{-webkit-transform:translateY(0)}}@keyframes bounceInUp{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}60%{opacity:1;-webkit-transform:translateY(-30px);-ms-transform:translateY(-30px);transform:translateY(-30px)}80%{-webkit-transform:translateY(10px);-ms-transform:translateY(10px);transform:translateY(10px)}100%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes bounceInDown{0%{opacity:0;-webkit-transform:translateY(-2000px)}60%{opacity:1;-webkit-transform:translateY(30px)}80%{-webkit-transform:translateY(-10px)}100%{-webkit-transform:translateY(0)}}@keyframes bounceInDown{0%{opacity:0;-webkit-transform:translateY(-2000px);-ms-transform:translateY(-2000px);transform:translateY(-2000px)}60%{opacity:1;-webkit-transform:translateY(30px);-ms-transform:translateY(30px);transform:translateY(30px)}80%{-webkit-transform:translateY(-10px);-ms-transform:translateY(-10px);transform:translateY(-10px)}100%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes bounceInLeft{0%{opacity:0;-webkit-transform:translateX(-2000px)}60%{opacity:1;-webkit-transform:translateX(30px)}80%{-webkit-transform:translateX(-10px)}100%{-webkit-transform:translateX(0)}}@keyframes bounceInLeft{0%{opacity:0;-webkit-transform:translateX(-2000px);-ms-transform:translateX(-2000px);transform:translateX(-2000px)}60%{opacity:1;-webkit-transform:translateX(30px);-ms-transform:translateX(30px);transform:translateX(30px)}80%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes bounceInRight{0%{opacity:0;-webkit-transform:translateX(2000px)}60%{opacity:1;-webkit-transform:translateX(-30px)}80%{-webkit-transform:translateX(10px)}100%{-webkit-transform:translateX(0)}}@keyframes bounceInRight{0%{opacity:0;-webkit-transform:translateX(2000px);-ms-transform:translateX(2000px);transform:translateX(2000px)}60%{opacity:1;-webkit-transform:translateX(-30px);-ms-transform:translateX(-30px);transform:translateX(-30px)}80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes bounceOut{0%{-webkit-transform:scale(1)}25%{-webkit-transform:scale(0.95)}50%{opacity:1;-webkit-transform:scale(1.1)}100%{opacity:0;-webkit-transform:scale(0.3)}}@keyframes bounceOut{0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}25%{-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95)}50%{opacity:1;-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}100%{opacity:0;-webkit-transform:scale(0.3);-ms-transform:scale(0.3);transform:scale(0.3)}}@-webkit-keyframes bounceOutUp{0%{-webkit-transform:translateY(0)}20%{opacity:1;-webkit-transform:translateY(20px)}100%{opacity:0;-webkit-transform:translateY(-2000px)}}@keyframes bounceOutUp{0%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}20%{opacity:1;-webkit-transform:translateY(20px);-ms-transform:translateY(20px);transform:translateY(20px)}100%{opacity:0;-webkit-transform:translateY(-2000px);-ms-transform:translateY(-2000px);transform:translateY(-2000px)}}@-webkit-keyframes bounceOutDown{0%{-webkit-transform:translateY(0)}20%{opacity:1;-webkit-transform:translateY(-20px)}100%{opacity:0;-webkit-transform:translateY(2000px)}}@keyframes bounceOutDown{0%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}20%{opacity:1;-webkit-transform:translateY(-20px);-ms-transform:translateY(-20px);transform:translateY(-20px)}100%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}}@-webkit-keyframes bounceOutLeft{0%{-webkit-transform:translateX(0)}20%{opacity:1;-webkit-transform:translateX(20px)}100%{opacity:0;-webkit-transform:translateX(-2000px)}}@keyframes bounceOutLeft{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}20%{opacity:1;-webkit-transform:translateX(20px);-ms-transform:translateX(20px);transform:translateX(20px)}100%{opacity:0;-webkit-transform:translateX(-2000px);-ms-transform:translateX(-2000px);transform:translateX(-2000px)}}@-webkit-keyframes bounceOutRight{0%{-webkit-transform:translateX(0)}20%{opacity:1;-webkit-transform:translateX(-20px)}100%{opacity:0;-webkit-transform:translateX(2000px)}}@keyframes bounceOutRight{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}20%{opacity:1;-webkit-transform:translateX(-20px);-ms-transform:translateX(-20px);transform:translateX(-20px)}100%{opacity:0;-webkit-transform:translateX(2000px);-ms-transform:translateX(2000px);transform:translateX(2000px)}}@-webkit-keyframes rotateIn{0%{-webkit-transform-origin:center center;-webkit-transform:rotate(-200deg);opacity:0}100%{-webkit-transform-origin:center center;-webkit-transform:rotate(0);opacity:1}}@keyframes rotateIn{0%{-webkit-transform-origin:center center;-ms-transform-origin:center center;transform-origin:center center;-webkit-transform:rotate(-200deg);-ms-transform:rotate(-200deg);transform:rotate(-200deg);opacity:0}100%{-webkit-transform-origin:center center;-ms-transform-origin:center center;transform-origin:center center;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}}@-webkit-keyframes rotateInUpLeft{0%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(90deg);opacity:0}100%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(0);opacity:1}}@keyframes rotateInUpLeft{0%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);opacity:0}100%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}}@-webkit-keyframes rotateInDownLeft{0%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(-90deg);opacity:0}100%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(0);opacity:1}}@keyframes rotateInDownLeft{0%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);opacity:0}100%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}}@-webkit-keyframes rotateInUpRight{0%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(-90deg);opacity:0}100%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(0);opacity:1}}@keyframes rotateInUpRight{0%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);opacity:0}100%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}}@-webkit-keyframes rotateInDownRight{0%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(90deg);opacity:0}100%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(0);opacity:1}}@keyframes rotateInDownRight{0%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);opacity:0}100%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}}@-webkit-keyframes rotateOut{0%{-webkit-transform-origin:center center;-webkit-transform:rotate(0);opacity:1}100%{-webkit-transform-origin:center center;-webkit-transform:rotate(200deg);opacity:0}}@keyframes rotateOut{0%{-webkit-transform-origin:center center;-ms-transform-origin:center center;transform-origin:center center;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}100%{-webkit-transform-origin:center center;-ms-transform-origin:center center;transform-origin:center center;-webkit-transform:rotate(200deg);-ms-transform:rotate(200deg);transform:rotate(200deg);opacity:0}}@-webkit-keyframes rotateOutUpLeft{0%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(0);opacity:1}100%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(-90deg);opacity:0}}@keyframes rotateOutUpLeft{0%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}100%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);opacity:0}}@-webkit-keyframes rotateOutDownLeft{0%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(0);opacity:1}100%{-webkit-transform-origin:left bottom;-webkit-transform:rotate(90deg);opacity:0}}@keyframes rotateOutDownLeft{0%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}100%{-webkit-transform-origin:left bottom;-ms-transform-origin:left bottom;transform-origin:left bottom;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);opacity:0}}@-webkit-keyframes rotateOutUpRight{0%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(0);opacity:1}100%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(90deg);opacity:0}}@keyframes rotateOutUpRight{0%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}100%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);opacity:0}}@-webkit-keyframes rotateOutDownRight{0%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(0);opacity:1}100%{-webkit-transform-origin:right bottom;-webkit-transform:rotate(-90deg);opacity:0}}@keyframes rotateOutDownRight{0%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);opacity:1}100%{-webkit-transform-origin:right bottom;-ms-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);opacity:0}}@-webkit-keyframes hinge{0%{-webkit-transform:rotate(0);-webkit-transform-origin:top left;-webkit-animation-timing-function:ease-in-out}20%,60%{-webkit-transform:rotate(80deg);-webkit-transform-origin:top left;-webkit-animation-timing-function:ease-in-out}40%{-webkit-transform:rotate(60deg);-webkit-transform-origin:top left;-webkit-animation-timing-function:ease-in-out}80%{-webkit-transform:rotate(60deg) translateY(0);opacity:1;-webkit-transform-origin:top left;-webkit-animation-timing-function:ease-in-out}100%{-webkit-transform:translateY(700px);opacity:0}}@keyframes hinge{0%{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);-webkit-transform-origin:top left;-ms-transform-origin:top left;transform-origin:top left;-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}20%,60%{-webkit-transform:rotate(80deg);-ms-transform:rotate(80deg);transform:rotate(80deg);-webkit-transform-origin:top left;-ms-transform-origin:top left;transform-origin:top left;-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}40%{-webkit-transform:rotate(60deg);-ms-transform:rotate(60deg);transform:rotate(60deg);-webkit-transform-origin:top left;-ms-transform-origin:top left;transform-origin:top left;-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}80%{-webkit-transform:rotate(60deg) translateY(0);-ms-transform:rotate(60deg) translateY(0);transform:rotate(60deg) translateY(0);opacity:1;-webkit-transform-origin:top left;-ms-transform-origin:top left;transform-origin:top left;-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}100%{-webkit-transform:translateY(700px);-ms-transform:translateY(700px);transform:translateY(700px);opacity:0}}@-webkit-keyframes rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0deg)}}@keyframes rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0deg);-ms-transform:translateX(0) rotate(0deg);transform:translateX(0) rotate(0deg)}}@-webkit-keyframes rollOut{0%{opacity:1;-webkit-transform:translateX(0) rotate(0deg)}100%{opacity:0;-webkit-transform:translateX(100%) rotate(120deg)}}@keyframes rollOut{0%{opacity:1;-webkit-transform:translateX(0) rotate(0deg);-ms-transform:translateX(0) rotate(0deg);transform:translateX(0) rotate(0deg)}100%{opacity:0;-webkit-transform:translateX(100%) rotate(120deg);-ms-transform:translateX(100%) rotate(120deg);transform:translateX(100%) rotate(120deg)}}@-webkit-keyframes lightSpeedIn{0%{-webkit-transform:translateX(100%) skewX(-30deg);opacity:0}60%{-webkit-transform:translateX(-20%) skewX(30deg);opacity:1}80%{-webkit-transform:translateX(0) skewX(-15deg);opacity:1}100%{-webkit-transform:translateX(0) skewX(0deg);opacity:1}}@keyframes lightSpeedIn{0%{-webkit-transform:translateX(100%) skewX(-30deg);-ms-transform:translateX(100%) skewX(-30deg);transform:translateX(100%) skewX(-30deg);opacity:0}60%{-webkit-transform:translateX(-20%) skewX(30deg);-ms-transform:translateX(-20%) skewX(30deg);transform:translateX(-20%) skewX(30deg);opacity:1}80%{-webkit-transform:translateX(0) skewX(-15deg);-ms-transform:translateX(0) skewX(-15deg);transform:translateX(0) skewX(-15deg);opacity:1}100%{-webkit-transform:translateX(0) skewX(0deg);-ms-transform:translateX(0) skewX(0deg);transform:translateX(0) skewX(0deg);opacity:1}}@-webkit-keyframes lightSpeedOut{0%{-webkit-transform:translateX(0) skewX(0deg);opacity:1}100%{-webkit-transform:translateX(100%) skewX(-30deg);opacity:0}}@keyframes lightSpeedOut{0%{-webkit-transform:translateX(0) skewX(0deg);-ms-transform:translateX(0) skewX(0deg);transform:translateX(0) skewX(0deg);opacity:1}100%{-webkit-transform:translateX(100%) skewX(-30deg);-ms-transform:translateX(100%) skewX(-30deg);transform:translateX(100%) skewX(-30deg);opacity:0}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-ms-keyframes spin{0%{-ms-transform:rotate(0deg)}100%{-ms-transform:rotate(359deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);-ms-transform:rotate(359deg);transform:rotate(359deg)}}@-webkit-keyframes loading{0%{background-position:0 -400px}100%{background-position:-7px -400px}}@-ms-keyframes loading{0%{background-position:0 -400px}100%{background-position:-7px -400px}}@keyframes loading{0%{background-position:0 -400px}100%{background-position:-7px -400px}}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-webkit-keyframes pace-spinner{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-ms-keyframes pace-spinner{0%{-ms-transform:rotate(0deg);transform:rotate(0deg)}100%{-ms-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes pace-spinner{0%{-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg)}}.animated{-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.animated.fast{-webkit-animation-duration:.4s;-ms-animation-duration:.4s;animation-duration:.4s}.animated.hinge{-webkit-animation-duration:2s;animation-duration:2s}.animated.flash{-webkit-animation-name:flash;animation-name:flash}.animated.shake{-webkit-animation-name:shake;animation-name:shake}.animated.bounce{-webkit-animation-name:bounce;animation-name:bounce}.animated.tada{-webkit-animation-name:tada;animation-name:tada}.animated.swing{-webkit-transform-origin:top center;-ms-transform-origin:top center;transform-origin:top center;-webkit-animation-name:swing;animation-name:swing}.animated.wobble{-webkit-animation-name:wobble;animation-name:wobble}.animated.pulse{-webkit-animation-name:pulse;animation-name:pulse}.animated.flip{-webkit-backface-visibility:visible!important;-webkit-animation-name:flip;-ms-backface-visibility:visible!important;backface-visibility:visible!important;animation-name:flip}.animated.flipInX{-webkit-backface-visibility:visible!important;-webkit-animation-name:flipInX;-ms-backface-visibility:visible!important;backface-visibility:visible!important;animation-name:flipInX}.animated.flipOutX{-webkit-animation-name:flipOutX;-webkit-backface-visibility:visible!important;animation-name:flipOutX;-ms-backface-visibility:visible!important;backface-visibility:visible!important}.animated.flipInY{-webkit-backface-visibility:visible!important;-webkit-animation-name:flipInY;-ms-backface-visibility:visible!important;backface-visibility:visible!important;animation-name:flipInY}.animated.flipOutY{-webkit-backface-visibility:visible!important;-webkit-animation-name:flipOutY;-ms-backface-visibility:visible!important;backface-visibility:visible!important;animation-name:flipOutY}.animated.fadeIn{-webkit-animation-name:fadeIn;animation-name:fadeIn}.animated.fadeInUp{-webkit-animation-name:fadeInUp;animation-name:fadeInUp}.animated.fadeInDown{-webkit-animation-name:fadeInDown;animation-name:fadeInDown}.animated.fadeInLeft{-webkit-animation-name:fadeInLeft;animation-name:fadeInLeft}.animated.fadeInRight{-webkit-animation-name:fadeInRight;animation-name:fadeInRight}.animated.fadeInUpBig{-webkit-animation-name:fadeInUpBig;animation-name:fadeInUpBig}.animated.fadeInDownBig{-webkit-animation-name:fadeInDownBig;animation-name:fadeInDownBig}.animated.fadeInLeftBig{-webkit-animation-name:fadeInLeftBig;animation-name:fadeInLeftBig}.animated.fadeInRightBig{-webkit-animation-name:fadeInRightBig;animation-name:fadeInRightBig}.animated.fadeOut{-webkit-animation-name:fadeOut;animation-name:fadeOut}.animated.fadeOutUp{-webkit-animation-name:fadeOutUp;animation-name:fadeOutUp}.animated.fadeOutDown{-webkit-animation-name:fadeOutDown;animation-name:fadeOutDown}.animated.fadeOutLeft{-webkit-animation-name:fadeOutLeft;animation-name:fadeOutLeft}.animated.fadeOutRight{-webkit-animation-name:fadeOutRight;animation-name:fadeOutRight}.animated.fadeOutUpBig{-webkit-animation-name:fadeOutUpBig;animation-name:fadeOutUpBig}.animated.fadeOutDownBig{-webkit-animation-name:fadeOutDownBig;animation-name:fadeOutDownBig}.animated.fadeOutLeftBig{-webkit-animation-name:fadeOutLeftBig;animation-name:fadeOutLeftBig}.animated.fadeOutRightBig{-webkit-animation-name:fadeOutRightBig;animation-name:fadeOutRightBig}.animated.bounceIn{-webkit-animation-name:bounceIn;animation-name:bounceIn}.animated.slideInDown{-webkit-animation-name:slideInDown;animation-name:slideInDown}.animated.slideInLeft{-webkit-animation-name:slideInLeft;animation-name:slideInLeft}.animated.slideInRight{-webkit-animation-name:slideInRight;animation-name:slideInRight}.animated.slideOutLeft{-webkit-animation-name:slideOutLeft;animation-name:slideOutLeft}.animated.slideOutRight{-webkit-animation-name:slideOutRight;animation-name:slideOutRight}.animated.slideOutUp{-webkit-animation-name:slideOutUp;animation-name:slideOutUp}.animated.bounceInUp{-webkit-animation-name:bounceInUp;animation-name:bounceInUp}.animated.bounceInDown{-webkit-animation-name:bounceInDown;animation-name:bounceInDown}.animated.bounceInLeft{-webkit-animation-name:bounceInLeft;animation-name:bounceInLeft}.animated.bounceInRight{-webkit-animation-name:bounceInRight;animation-name:bounceInRight}.animated.bounceOut{-webkit-animation-name:bounceOut;animation-name:bounceOut}.animated.bounceOutUp{-webkit-animation-name:bounceOutUp;animation-name:bounceOutUp}.animated.bounceOutDown{-webkit-animation-name:bounceOutDown;animation-name:bounceOutDown}.animated.bounceOutLeft{-webkit-animation-name:bounceOutLeft;animation-name:bounceOutLeft}.animated.bounceOutRight{-webkit-animation-name:bounceOutRight;animation-name:bounceOutRight}.animated.rotateIn{-webkit-animation-name:rotateIn;animation-name:rotateIn}.animated.rotateInUpLeft{-webkit-animation-name:rotateInUpLeft;animation-name:rotateInUpLeft}.animated.rotateInDownLeft{-webkit-animation-name:rotateInDownLeft;animation-name:rotateInDownLeft}.animated.rotateInUpRight{-webkit-animation-name:rotateInUpRight;animation-name:rotateInUpRight}.animated.rotateInDownRight{-webkit-animation-name:rotateInDownRight;animation-name:rotateInDownRight}.animated.rotateOut{-webkit-animation-name:rotateOut;animation-name:rotateOut}.animated.rotateOutUpLeft{-webkit-animation-name:rotateOutUpLeft;animation-name:rotateOutUpLeft}.animated.rotateOutDownLeft{-webkit-animation-name:rotateOutDownLeft;animation-name:rotateOutDownLeft}.animated.rotateOutUpRight{-webkit-animation-name:rotateOutUpRight;animation-name:rotateOutUpRight}.animated.rotateOutDownRight{-webkit-animation-name:rotateOutDownRight;animation-name:rotateOutDownRight}.animated.rollIn{-webkit-animation-name:rollIn;animation-name:rollIn}.animated.rollOut{-webkit-animation-name:rollOut;animation-name:rollOut}.animated.lightSpeedIn{-webkit-animation-name:lightSpeedIn;animation-name:lightSpeedIn;-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out;-webkit-animation-duration:.5s;animation-duration:.5s}.animated.lightSpeedOut{-webkit-animation-name:lightSpeedOut;animation-name:lightSpeedOut;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-duration:.25s;animation-duration:.25s}.animated.fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}[class*=" bg-"],[class^=bg-]{-webkit-filter:none!important;filter:none!important}.square{display:block;float:left;margin-right:10px;height:20px;width:20px}.fa-stack-1em{width:1em!important;height:1em!important;line-height:1em!important}.icon-color-good{color:#40ac2b}.icon-color-bad{color:#ed1c24}.percent-sign:after{content:" %";line-height:normal}.degree-sign:after{content:" °F";line-height:normal}.ui-state-default .ui-icon[class*=" icon-"]{background:0;margin-left:-12px}.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-e:before{content:"\f105";font-family:FontAwesome;font-size:14px;display:inline}.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-first,.ui-icon-seek-start{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}.ui-button-icon-primary.ui-icon[class*=" icon-"]:before,.ui-button-icon-primary.ui-icon[class^=icon-]:before,.ui-button-icon-secondary.ui-icon[class*=" icon-"]:before,.ui-button-icon-secondary.ui-icon[class^=icon-]:before{font-size:inherit;margin-left:7px!important;margin-left:5px;display:inline;text-decoration:inherit;color:inherit}@font-face{font-family:'Ubuntu';src:url('./fonts/Ubuntu-C.eot');src:url('./fonts/Ubuntu-C.eot?#iefix') format('embedded-opentype'),url('./fonts/Ubuntu-C.woff') format('woff'),url('./fonts/Ubuntu-C.ttf') format('truetype'),url('./fonts/Ubuntu-C.svg') format('svg');font-weight:normal;font-style:normal}@font-face{font-family:'Ubuntu-Light';src:url('./fonts/Ubuntu-L.eot');src:url('./fonts/Ubuntu-L.eot?#iefix') format('embedded-opentype'),url('./fonts/Ubuntu-L.woff') format('woff'),url('./fonts/Ubuntu-L.ttf') format('truetype'),url('./fonts/Ubuntu-L.svg') format('svg');font-weight:normal;font-style:normal}@font-face{font-family:'Ubuntu-Bold';src:url('./fonts/Ubuntu-B.eot');src:url('./fonts/Ubuntu-B.eot?#iefix') format('embedded-opentype'),url('./fonts/Ubuntu-B.woff') format('woff'),url('./fonts/Ubuntu-B.ttf') format('truetype'),url('./fonts/Ubuntu-B.svg') format('svg');font-weight:bold;font-style:normal}html,body{font-family:Ubuntu,Arial,Helvetica,sans-serif}a:active,a:focus,a:hover,button,button:active,button:focus,embed,input::-moz-focus-inner,object{outline:0}.hidden{display:none}.hidden-desktop{display:none!important}.no-visible{visibility:hidden!important}.pull-right{float:right!Important}.pull-left{float:left!Important}.align-top{vertical-align:top!important}.align-base{vertical-align:baseline!important}.opacity-25{opacity:.25!important}.opacity-50{opacity:.5!important}.opacity-75{opacity:.75!important}.opacity-100,.opaque{opacity:1!important}.disabled{color:#fff}.btn-default.disabled{color:#999}xmp{overflow:auto}.text-italic{font-style:italic!important}.text-dashed{text-decoration:line-through}.nowrap{white-space:nowrap}.truncated{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.no-space{margin:0}.no-space>[class*=col-]{margin:0!important;padding-right:0;padding-left:0}.no-margin{margin:0!important}.no-x-margin{margin-left:0!important;margin-right:0!important}.no-y-margin{margin-top:0!important;margin-bottom:0!important}.margin-2{margin:2px!important}.margin-5{margin:5px!important}.margin-10{margin:10px!important}.margin-20{margin:20px!important}.margin-x-2{margin-left:2px!important;margin-right:2px!important}.margin-x-5{margin-left:5px!important;margin-right:5px!important}.margin-x-10{margin-left:10px!important;margin-right:10px!important}.margin-x-20{margin-left:20px!important;margin-right:20px!important}.margin-y-2{margin-top:2px!important;margin-bottom:2px!important}.margin-y-5{margin-top:5px!important;margin-bottom:5px!important}.margin-y-10{margin-top:10px!important;margin-bottom:10px!important}.margin-y-20{margin-top:20px!important;margin-bottom:20px!important}.margin-top-0{margin-top:0!important}.margin-top-2{margin-top:2px!important}.margin-top-5{margin-top:5px!important}.margin-top-10{margin-top:10px!important}.margin-top-20{margin-top:20px!important}.margin-bottom-0{margin-bottom:0!important}.margin-bottom-2{margin-bottom:2px!important}.margin-bottom-5{margin-bottom:5px!important}.margin-bottom-10{margin-bottom:10px!important}.margin-bottom-20{margin-bottom:20px!important}.margin-left-0{margin-left:0!important}.margin-left-2{margin-left:2px!important}.margin-left-5{margin-left:5px!important}.margin-left-10{margin-left:10px!important}.margin-left-20{margin-left:20px!important}.margin-right-0{margin-right:0!important}.margin-right-2{margin-right:2px!important}.margin-right-5{margin-right:5px!important}.margin-right-10{margin-right:10px!important}.margin-right-20{margin-right:20px!important}.shift-topleft-2{margin-top:-2px!important;margin-left:-2px!important}.shift-topleft-4{margin-top:-4px!important;margin-left:-4px!important}.shift-topright-2{margin-top:-2px!important;margin-right:-2px!important}.shift-topright-4{margin-top:-4px!important;margin-right:-4px!important}.shift-bottomleft-2{margin-bottom:-2px!important;margin-left:-2px!important}.shift-bottomleft-4{margin-bottom:-4px!important;margin-left:-4px!important}.shift-bottomright-2{margin-bottom:-2px!important;margin-right:-2px!important}.shift-bottomright-4{margin-bottom:-4px!important;margin-right:-4px!important}.bordered{border:1px solid #ccc}.bordered:hover{border:1px solid #bbb}.bordered.nohover:hover{border-color:#ccc}.no-border,.well[class*=" bg-"].no-border{border-width:0!important}.no-border-transparent{border-color:transparent!important}.no-border-radius{border-radius:0}.border-0{border-width:0!important}.border-1{border-width:1px!important}.radius-4{border-radius:4px!important}.radius-top-4{border-top-left-radius:4px!important;border-top-right-radius:4px!important}.radius-bottom-4{border-bottom-left-radius:4px!important;border-bottom-right-radius:4px!important}.radius-left-4{border-top-left-radius:4px!important;border-bottom-left-radius:4px!important}.radius-right-4{border-top-right-radius:4px!important;border-bottom-right-radius:4px!important}.width-100{width:100px;max-width:100px}.width-200{width:200px;max-width:200px}.width-300{width:300px;max-width:300px}.width-400{width:400px;max-width:400px}.width-500{width:500px;max-width:500px}.padding-5{padding:5px!important}.padding-7{padding:7px!important}.padding-10{padding:10px!important}.padding-20{padding:20px!important}.padding-x-0{padding-left:0!important;padding-right:0!important}.padding-x-5{padding-left:5px!important;padding-right:5px!important}.padding-x-10{padding-left:10px!important;padding-right:10px!important}.padding-x-20{padding-left:20px!important;padding-right:20px!important}.padding-y-0{padding-top:0!important;padding-bottom:0!important}.padding-y-5{padding-top:5px!important;padding-bottom:5px!important}.padding-y-10{padding-top:10px!important;padding-bottom:10px!important}.padding-y-20{padding-top:20px!important;padding-bottom:20px!important}.padding-top-0{padding-top:0!important}.padding-top-5{padding-top:5px!important}.padding-top-10{padding-top:10px!important}.padding-top-20{padding-top:20px!important}.padding-bottom-0{padding-bottom:0!important}.padding-bottom-5{padding-bottom:5px!important}.padding-bottom-10{padding-bottom:10px!important}.padding-bottom-20{padding-bottom:20px!important}.padding-left-0{padding-left:0!important}.padding-left-5{padding-left:5px!important}.padding-left-10{padding-left:10px!important}.padding-left-20{padding-left:20px!important}.padding-right-0{padding-right:0!important}.padding-right-5{padding-right:5px!important}.padding-right-10{padding-right:10px!important}.padding-right-20{padding-right:20px!important}.no-padding{padding:0!important}.no-padding .md-editor,.widget-body.no-padding .cke_chrome{border:0}.no-padding>pre{margin:30px}.no-padding .dataTables_wrapper table,.no-padding>table{border:0!important;margin-bottom:0!important}.no-padding .dataTables_wrapper table tr td:first-child,.no-padding>table tr td:first-child,.no-padding .dataTables_wrapper table tr th:first-child,.no-padding>table tr th:first-child{border-left:0!important}.no-padding .dataTables_wrapper table tr td:last-child,.no-padding>table tr td:last-child,.no-padding .dataTables_wrapper table tr th:last-child,.no-padding>table tr th:last-child{border-right:0!important}.no-padding .dataTables_wrapper table tr:last-child td,.no-padding>table tr:last-child td{border-bottom:0}.no-padding-bottom{padding-bottom:0!important}.no-x-padding{padding-left:0!important;padding-right:0!important}.no-y-padding{padding-top:0!important;padding-bottom:0!important}.no-content-padding{margin:-10px -14px 0 -14px}@media(min-width:768px) and (max-width:880px){.no-content-padding{margin:0 -14px!important}}@media(max-width:767px){.no-content-padding{margin:0 -5px!important}}@media only screen and (min-width:0) and (max-width:679px){.no-content-padding{margin:0 -5px!important}}@media only screen and (min-width:320px) and (max-width:479px){.no-content-padding{margin:0 -5px!important}}.no-height{line-height:0}.clearfix,.inner-space:after{zoom:1}.clearfix:after,.inner-space:after{clear:both}.clearfix:after,.inner-space:after,.clearfix:before,.inner-space:before{display:block;visibility:hidden;overflow:hidden;content:"\0020";height:0;font-size:0;line-height:0}.display-inline{display:inline-block!important}.display-normal{display:inline!important}.hover-transparent{opacity:.5}.hover-transparent:hover{opacity:1}.row-seperator-header{margin:15px 14px 20px;border-bottom:0;display:block;color:#646464;font-size:20px;font-weight:400}.text-align-center,.text-center{text-align:center!important}.text-align-left,.text-left{text-align:left!important}.text-align-right,.text-right{text-align:right!important}.center-canvas,.center-child-canvas>canvas{display:block!important;margin:0 auto!important}.semi-bold{font-weight:400!important}.bold{font-weight:900!important}.ultra-light{font-weight:300!important}.font-xs{font-size:85%!important}.font-sm{font-size:95%!important}.font-md{font-size:130%!important}.font-lg{font-size:160%!important}.font-xl{font-size:200%!important}.font-400{font-size:400%!important}.badge{font-size:11px;padding:4px 6px 1px}.label{padding:.3em .6em .1em}.cursor-pointer{cursor:pointer}.selected{border:1px solid #0091d9!important}tr.selected{background-color:#dcebff}.selected:before{display:block;position:absolute;content:"\f00c";color:#fff;right:4px;font-family:FontAwesome;z-index:1002}tr.selected:before{display:none}.selected:after{width:0;height:0;border-top:35px solid #0091d9;border-left:35px solid rgba(0,0,0,0);position:absolute;display:block;right:0;content:".";top:0;z-index:1001}tr.selected:after{display:none}html{margin:0;padding:0;height:100%;overflow-x:hidden!important;background-color:#e5e2cf}body{margin:0;padding:0;height:100%;overflow:hidden;background-color:#e5e2cf;direction:ltr}body.container{position:relative;padding:0;border-left:1px solid #bfbfbf;border-right:1px solid #bfbfbf;-webkit-box-shadow:0 2px 70px rgba(0,0,0,0.45);box-shadow:0 2px 70px rgba(0,0,0,0.45)}body.nooverflow{position:fixed;overflow:hidden;width:100%}#main{display:block;margin-left:220px;padding:0;min-height:500px;-webkit-transition:all .1s ease-out;transition:all .1s ease-out}@media(max-width:979px){#main{margin-left:0}}#content{padding:10px;position:relative;left:0;-webkit-transition:left .1s ease-out;transition:left .1s ease-out}@media(max-width:767px){#content{padding-left:5px;padding-right:5px}}.page-title{margin:12px 0 15px}.page-title a:hover,.page-title a:active{text-decoration:none}.page-title span{font-size:16px;color:#333;display:inline-block;vertical-align:1px}.page-title span i{padding:0 5px}aside{display:block;width:220px;overflow:hidden;min-height:100%}aside,aside nav li.divider{background:#829db0}#header{display:block;height:49px;position:relative;margin:0;padding:0 13px 0 0;background-color:#f3f3f3;background-image:-webkit-gradient(linear,0 0,0 100%,from(#f3f3f3),to(#e2e2e2));background-image:-webkit-gradient(linear,top left,bottom left,from(#f3f3f3),to(#e2e2e2));background-image:-webkit-linear-gradient(top,#f3f3f3,#e2e2e2);background-image:linear-gradient(to bottom,#f3f3f3,#e2e2e2);background-repeat:repeat-x}@media(max-width:767px){#header{padding-right:5px}}@media only screen and (max-width:679px){#header{padding-right:5px;background:#fff}}#header>div{display:inline-block;vertical-align:middle;height:49px;float:left}#header>div.open{font-weight:700}.fixed-header #header{position:fixed;width:100%;z-index:1001}.container.fixed-header #header{max-width:1164px}.fixed-header #header .ajax-dropdown{z-index:1000}.fixed-header #shortcut{position:fixed}.fixed-header #main{margin-top:49px}#top-links>div{display:inline-block;float:left}@media(min-width:768px) and (max-width:1089px){#top-links>div{display:none}#top-links>div:first-child{display:inline-block}}@media(max-width:767px){#top-links>div{display:none}}.top-menu{display:inline-block;padding:7px 13px 0;position:relative}@media(max-width:767px){.top-menu{display:none}}.top-menu>span{display:block}.top-menu>:first-child{display:block;color:#bfbfbf;font-size:10px;font-weight:700;text-transform:uppercase;text-shadow:0 0 1px #fff;padding-left:0;text-align:left}.top-tabs{display:inline-block;padding:7px 13px 0;position:relative}.top-tabs>span{display:block}.top-tabs>:first-child{display:block;color:#bfbfbf;font-size:10px;font-weight:700;text-transform:uppercase;text-shadow:0 0 1px #fff;padding-left:5px;text-align:left}.top-tabs .nav-tabs li a{padding:2px 10px 3px!important;border-color:#ccc #ccc transparent;box-shadow:0 -2px 3px #ccc;margin-top:3px!important}.top-tabs .nav-tabs li.active a{margin-top:3px!important;padding:2px 10px 3px!important}.top-selector{max-width:97%;white-space:nowrap;background:0;border:0;padding:0;text-align:left;color:#555;font-size:14px;cursor:pointer}.top-selector:hover{color:#333}@media(max-width:979px){#login-info{display:none}}#login-info>span{display:inline-block;height:39px;float:left}#login-info>span .badge{position:absolute;top:-5px;right:-9px;cursor:pointer;background:#0091d9;display:inline-block;font-size:10px;-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,0.1),inset 0 -1px 0 rgba(0,0,0,0.07);box-shadow:inset 1px 1px 0 rgba(0,0,0,0.1),inset 0 -1px 0 rgba(0,0,0,0.07);color:#fff;font-weight:700;border-radius:50%;padding:3px;text-align:center;line-height:normal}#login-info span#activity{border-radius:2px;cursor:default!important;display:inline-block;font-weight:700;height:24px;width:24px;padding:2px;text-align:center;text-decoration:none!important;-moz-user-select:none;-webkit-user-select:none;background-color:#f8f8f8;background-image:-webkit-gradient(linear,left top,left bottom,from(#f8f8f8),to(#f1f1f1));background-image:-webkit-gradient(linear,top left,bottom left,from(#f8f8f8),to(#f1f1f1));background-image:-webkit-linear-gradient(top,#f8f8f8,#f1f1f1);background-image:linear-gradient(top,#f8f8f8,#f1f1f1);border:1px solid #bfbfbf;color:#c4bab6;font-size:19px;margin:5px 0 0;position:relative}#login-info span#activity:hover{border:1px solid #bfbfbf;-webkit-transition:all 0s;transition:all 0s;cursor:pointer!important;-webkit-box-shadow:inset 0 0 4px 1px rgba(0,0,0,0.08);box-shadow:inset 0 0 4px 1px rgba(0,0,0,0.08)}.authomatic{display:inline-block;width:21px;height:21px;margin:2px 0!important;padding:3px!important;text-align:center}.authomatic:hover{background-color:#ccc;border-radius:3px}#logo{display:inline-block;width:175px;margin-top:7px;margin-left:9px}@media(min-width:768px) and (max-width:880px){#logo{margin-top:10px}}@media(max-width:767px){#logo{margin-top:10px;margin-left:4px}}@media only screen and (min-width:0) and (max-width:679px){#logo{margin-top:10px;margin-left:4px}}@media only screen and (min-width:320px) and (max-width:479px){#logo{width:135px;margin-top:10px;margin-left:4px}}#logo img{max-width:175px;max-height:36px;padding-left:3px}#logo-group{width:220px}@media only screen and (min-width:480px) and (max-width:1089px){#logo-group{width:175px}}@media only screen and (min-width:320px) and (max-width:479px){#logo-group{width:169px!important}}.uv-icon{position:absolute!important;left:155px!important;top:5px!important;z-index:500!important}@media only screen and (min-width:0) and (max-width:1089px){.uv-icon{left:130px!important}}#activity.active .badge{background:#006fa6!important}.header-search{position:relative}@media(max-width:767px){.header-search{display:none}}.header-search.pull-right{margin-left:6px}@media(max-width:979px){.header-search.pull-right{margin-left:0}}.header-search>input[type=text]{display:block;-webkit-box-sizing:border-box;box-sizing:border-box;-moz-box-sizing:border-box;min-width:200px;width:100%;height:30px;padding:0 10px;outline:0;border-width:1px;border-style:solid;border-radius:0;border-color:#bfbfbf;background:#fff;color:#404040;appearance:normal;-moz-appearance:none;-webkit-appearance:none;margin-top:10px;line-height:normal}@media(min-width:768px) and (max-width:979px){.header-search>input[type=text]{margin-top:9px}}.header-search>button{background:0;border:0;color:#6d6a69;font-size:17px;height:30px;line-height:30px;margin:0;padding:0;position:absolute;right:0;top:10px;width:30px;z-index:2}#search-mobile{display:none}@media(max-width:767px){#search-mobile{display:block}}@media only screen and (min-width:0) and (max-width:679px){#search-mobile{display:block}}@media only screen and (min-width:320px) and (max-width:479px){#search-mobile{margin-left:0}}@media(max-width:767px){.search-mobile .header-search{display:block;position:absolute;top:0;width:100%;height:49px;background:#333;padding:0 2px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;left:0}.search-mobile .header-search>input[type=text]{margin-top:2px;height:45px;border-color:#333;padding-right:75px}.search-mobile .header-search>button{height:29px;line-height:29px;background:#DDD;right:44px}.search-mobile #search-mobile{display:none}.search-mobile #cancel-search-js{display:block}}#cancel-search-js{position:absolute;display:none;background:#a90329;z-index:3;color:#fff;padding:0;right:10px;top:10px;text-align:center;height:29px;line-height:29px;width:30px;font-size:17px;text-decoration:none!important}#left-panel{position:absolute;top:49px;left:0;z-index:1002;-webkit-transition:left .1s ease-out;transition:left .1s ease-out}@media(max-width:979px){#left-panel{left:-220px}}.fixed-navigation #left-panel{position:fixed;z-index:998}@media(max-width:767px){.fixed-navigation #left-panel{position:absolute!important}}#left-panel #ajax-gear{position:absolute;left:calc(49%);top:5px}#left-panel .version{position:absolute;bottom:2px;width:100%;text-align:center;font-size:11px;color:#333}#ribbon{height:40px;background:#6f8696;padding:0 40px 0 13px;position:relative}@media(max-width:767px){#ribbon{padding-left:5px;padding-right:5px}}@media only screen and (min-width:0) and (max-width:679px){#ribbon{border-bottom:1px solid #cfcfcf;border-top:1px solid #e6e6e6;background:#f5f5f5}}#ribbon .breadcrumb{display:inline-block;margin:0;padding:12px 34px 10px 0!important;background:0;vertical-align:top}#ribbon .breadcrumb,#ribbon .breadcrumb a{color:#ddd!important;text-decoration:none!Important}@media only screen and (min-width:0) and (max-width:679px){#ribbon .breadcrumb,#ribbon .breadcrumb a{color:#6d6c6c!important}}#ribbon .breadcrumb>li+li:before{padding:0 1px 0 5px}#ribbon .breadcrumb li:last-child,#ribbon .breadcrumb>.active{color:#eee}@media only screen and (min-width:0) and (max-width:679px){#ribbon .breadcrumb li:last-child,#ribbon .breadcrumb>.active{color:#333!important}}.fixed-ribbon #ribbon{position:fixed;right:0;left:220px;top:49px;z-index:999}@media(max-width:979px){.fixed-ribbon #ribbon{left:0}}.container.fixed-ribbon #ribbon{width:944px;left:590px}.fixed-ribbon #content{padding-top:50px}@media(max-width:767px){.fixed-ribbon #content{padding-top:52px}}.minified.fixed-ribbon #ribbon{left:45px}.hidden-menu.fixed-ribbon #ribbon{left:10px}@media(max-width:979px){.hidden-menu.fixed-ribbon #ribbon{left:220px}}.hidden-ribbon #ribbon{height:1px;min-height:1px;max-height:1px}.hidden-ribbon #ribbon>*{display:none}.ribbon{position:absolute;right:9px;top:-4px}.header-dropdown-list{list-style:none;float:right;position:relative;margin:0;padding-left:10px}.header-dropdown-list>li{display:inline-block;padding-right:5px}.header-dropdown-list>li>.dropdown-toggle{margin-top:16px;display:block}.smart-accordion-default.panel-group .panel+.panel{margin-top:-1px}.smart-accordion-default.panel-group .panel-heading{padding:0}.smart-accordion-default.panel-group .panel-title a{display:block;padding:10px 15px;text-decoration:none!important}.smart-accordion-default .panel-group .panel,.smart-accordion-default .panel-heading{border-radius:0}.smart-accordion-default .panel-default{border-color:#c3c3c3}.smart-accordion-default .panel-default>.panel-heading{background-color:#fcfcfc}.smart-accordion-default .panel-title>a.collapsed>.fa,.smart-accordion-default .panel-title>a>:first-child{display:none}.smart-accordion-default .panel-title>a.collapsed>:first-child{display:inline-block}.no-padding .smart-accordion-default>div{border-left:0!important;border-right:0!important}.no-padding .smart-accordion-default>div:first-child{border-top:0!important}.no-padding .smart-accordion-default>div:last-child{border-bottom:0!important}#logo-group *,.login-info,.login-info *,.minified .menu-item-parent{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.login-info{display:block;font-size:12px;height:39px;color:#333;border:solid transparent;margin:2px 0 0 10px!important;float:right}.login-info a,.login-info strong{text-transform:capitalize;font-size:14px;display:inline-block;color:#333;text-decoration:none;margin-left:5px}.login-info a:hover,.login-info strong{color:#666}.login-info a.btn{margin-top:5px}.login-info a.btn-danger,.login-info a.btn-success,.login-info a.btn-primary{color:#dedede}.login-info span{display:inline-block;padding:0 0 0 10px}.login-info span a.btn-success{margin-top:-10px}.login-info img{width:25px;height:auto;display:inline-block;vertical-align:middle;margin-top:-3px;margin-right:7px;margin-left:0;border-left:3px solid #fff}.minifyme{border-bottom:1px solid #302f2f;background:#454545;color:#a8a8a8;text-align:center;padding:1px 0 0;width:36px;height:28px;display:block;position:absolute;right:-3px;border-radius:5px 0 0 5px;cursor:pointer;margin-top:5px;font-size:19px;-webkit-transition:all .1s linear 0s;transition:all .1s linear 0s}.minifyme:hover{background:#646464;color:#e4e4e4;right:0}.minified .minifyme{right:0;color:#a8a8a8;position:relative;width:100%;border-radius:0;margin:0;height:32px;font-size:23px}.minified .minifyme .fa:before{content:"\f0a9"}.minified #left-panel{width:45px;overflow:visible}@media(max-width:979px){.minified #left-panel{left:0}}.minified #main{margin-left:45px}.minified #left-panel>ul>li,.minified nav>ul>li{overflow:visible}.minified #left-panel>ul>li>ul::before,.minified nav>ul>li>ul::before{border-left:0}.minified #left-panel>ul>li,.minified nav>ul>li,.minified #left-panel>ul>li a,.minified nav>ul>li a{position:relative}.minified #left-panel ul>li>a,.minified nav ul>li>a{padding:12px 11px 10px;display:block}.minified #left-panel>ul>li>a .fa.fa-fw,.minified nav>ul>li>a .fa.fa-fw{display:block;width:auto;text-align:center;padding:0}.minified #left-panel>ul>li>a>i,.minified nav>ul>li>a>i{text-align:center;margin:0;display:block}.minified #left-panel>ul>li.active>a::before,.minified nav>ul>li.active>a::before{content:"\f0d9"}.minified #left-panel ul ul li a,.minified nav ul ul li a{padding-top:5px;padding-bottom:5px;padding-left:14px}.minified #left-panel ul ul li li a,.minified nav ul ul li li a{padding-left:25px}.minified #left-panel>ul ul li::before,.minified nav>ul ul li::before,.minified #left-panel>ul>li>ul::before,.minified nav>ul>li>ul::before{left:12px}.minified #left-panel>ul>li>a .menu-item-parent,.minified nav>ul>li>a .menu-item-parent,.minified #left-panel>ul>li>a>b,.minified nav>ul>li>a>b{display:none}.minified #left-panel>ul>li>a>.menu-item-parent,.minified nav>ul>li>a>.menu-item-parent{display:none;position:absolute;left:40px;top:-3px;width:186px;height:36px;line-height:38px;background-color:#f5f5f5;color:#333;z-index:3;-webkit-box-shadow:2px 1px 2px 0 rgba(0,0,0,0.2);box-shadow:2px 1px 2px 0 rgba(0,0,0,0.2);border-left:1px solid #bfbfbf;border-top:1px solid #d8d4d4;border-bottom:1px solid #fff;padding-left:12px}.minified #left-panel>ul>li>ul,.minified nav>ul>li>ul{display:none!important;position:absolute;left:40px;width:200px;z-index:5;border:1px solid #bfbfbf;min-height:180px;-webkit-box-shadow:1px 1px 2px 0 rgba(0,0,0,0.2);box-shadow:1px 1px 2px 0 rgba(0,0,0,0.2);background:#627685;margin-top:-3px}.minified #left-panel ul>li>ul>li>ul,.minified nav ul>li>ul>li>ul{position:relative;left:13px;border:0;margin-left:-12px;width:197px}.minified #left-panel>ul>li:hover>a>.menu-item-parent,.minified nav>ul>li:hover>a>.menu-item-parent,.minified #left-panel>ul>li:hover>ul,.minified nav>ul>li:hover>ul{display:block!important}.minified #left-panel>ul>li>ul>li,.minified nav>ul>li>ul>li{background-color:rgba(91,103,113,0.8)}.minified #left-panel>ul>li>ul>li>ul>li,.minified nav>ul>li>ul>li>ul>li{background-color:#627685}.minified #left-panel>ul>li>ul>li>a,.minified nav>ul>li>ul>li>a,.minified #left-panel>ul>li>ul>li>ul>li>a,.minified nav>ul>li>ul>li>ul>li>a{padding-top:7px;padding-bottom:7px}.minified #left-panel>ul>li>ul>li>ul>li a,.minified nav>ul>li>ul>li>ul>li a{padding-top:6px;padding-bottom:6px}.minified #left-panel>ul>ul,.minified nav>ul>ul{min-height:100px!important;max-height:180px!important;overflow-y:scroll;overflow-x:hidden;background:#ed1c24!important}.minified #left-panel>ul ul li::before,.minified nav>ul ul li::before{border:0}.minified #left-panel ul ul ul ul li a,.minified nav ul ul ul ul li a{padding-left:45px}.minified #left-panel ul ul ul ul ul li a,.minified nav ul ul ul ul ul li a{padding-left:62px}.minified #left-panel ul ul ul ul ul ul li a,.minified nav ul ul ul ul ul ul li a{padding-left:82px}.minified #left-panel .version{display:none}.minified .slimScrollDiv,.minified .slimScrollDiv>:first-child{overflow:visible!important}.minified .slimScrollBar,.minified .slimScrollRail{display:none}.slimScrollDiv,.slimScrollDiv>:first-child{overflow:hidden}@media(max-width:979px){#hide-menu i,#logout i{color:#6d6a69;font-size:100%}}@media(min-width:0) and (max-width:880px){#hide-menu i,#logout i{font-size:121%}}.hidden-menu #left-panel{left:-210px;z-index:1002}@media(max-width:979px){.hidden-menu #left-panel{left:0}}.hidden-menu #left-panel:hover{left:0}.hidden-menu #main{margin-left:10px}.minified.hidden-menu #main{margin-left:0}@media(max-width:979px){.hidden-menu #main{position:relative;left:210px}}@media(max-width:979px){.hidden-menu #hide-menu i{color:#fff}}@media(min-width:768px) and (max-width:880px){.hidden-menu #hide-menu i::before{content:"\f0c9"}}@media(max-width:767px){.hidden-menu #hide-menu i{color:#fff}.hidden-menu #hide-menu i::before{content:"\f0c9"}}.hidden-menu #hide-menu>:first-child>a{background-color:#e8e8e8;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#5a5a5a),color-stop(100%,#686868));background-image:-webkit-linear-gradient(to bottom,#5a5a5a 0,#686868 100%);background-image:-webkit-gradient(linear,top left,bottom left,from(#5a5a5a),to(#686868));background-image:-webkit-linear-gradient(top,#5a5a5a 0,#686868 100%);background-image:linear-gradient(to bottom,#5a5a5a 0,#686868 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5A5A5A',endColorstr='#686868',GradientType=0);color:#fff;border-color:#494949;-webkit-box-shadow:inset 0 0 3px 1px rgba(0,0,0,0.15);box-shadow:inset 0 0 3px 1px rgba(0,0,0,0.15)}@media(min-width:768px) and (max-width:979px){.hidden-menu #hide-menu>:first-child>a{margin-top:9px;width:40px}}.hidden-menu #hide-menu>:first-child>a:active{-webkit-box-shadow:inset 0 0 6px 1px rgba(0,0,0,0.2);box-shadow:inset 0 0 6px 1px rgba(0,0,0,0.2)}.hidden-menu .minifyme,.minified #hide-menu{display:none}.no-menu #left-panel{left:-220px;z-index:0}.no-menu #main{margin-left:0}.no-menu #hide-menu{display:none}#shortcut{position:absolute;top:0;left:0;height:auto;width:100%;background-color:#33302f;background-color:rgba(0,0,0,0.85);z-index:1009;display:none;color:#fff;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#shortcut ul{padding:15px 20px 10px;list-style:none;margin:0;-webkit-box-shadow:0 4px 10px rgba(0,0,0,0.3);box-shadow:0 4px 10px rgba(0,0,0,0.3);border-bottom:1px solid #423f3f}#shortcut ul li{display:inline-block;width:auto}#shortcut ul li .ams-metro-tile{margin:0 3px 3px;border:0;border-radius:0}#shortcut ul li .ams-metro-tile:hover{color:#fff;text-decoration:none}#shortcut ul li .ams-metro-tile:active,#shortcut ul li .ams-metro-tile:focus{left:0;top:0}#shortcut .version{position:absolute;right:10px;bottom:10px}.shortcut-on #response-btn{display:none!important}.shortcut-on #left-bar .navbar,.shortcut-on #main .navbar{border:0!important}#sparks{display:block;list-style:none;margin:10px 0 0;padding:0;text-align:right}@media only screen and (min-width:320px) and (max-width:479px){#sparks{text-align:center;background:#e0e0e0;padding:10px 0;margin-bottom:15px}}#sparks li{display:inline-block;border-left:1px dotted #c7c7c7;padding:0 10px;max-height:47px;overflow:hidden;text-align:left;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box}@media only screen and (min-width:320px) and (max-width:479px){#sparks li{padding:0 10px 0 20px}}#sparks li:last-child{padding-right:0}#sparks li:first-child{border-left:0;padding-left:0}#sparks li h5{color:#555;float:left;font-size:11px;font-weight:400;margin:-3px 0 0 0;padding:0;border:0;text-transform:uppercase}#sparks li span{color:#636363;display:block}.sparks-info{min-width:70px}.sparks-info span{font-size:18px;line-height:20px;margin:0;text-transform:none}.sparks-info .sparkline{display:block;float:right;margin:3px 0 0 20px}#heat-fill{display:block;position:relative;margin-bottom:20px;background:#333;height:7px;width:200px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAAABCAIAAAAU3Xa1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0IDc5LjE1MTQ4MSwgMjAxMy8wMy8xMy0xMjowOToxNSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDowMDE4MkZGMzMzOTgxMUUzODZBQUNFQUNFOTk0NEUxRiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowMDE4MkZGNDMzOTgxMUUzODZBQUNFQUNFOTk0NEUxRiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjAwMTgyRkYxMzM5ODExRTM4NkFBQ0VBQ0U5OTQ0RTFGIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjAwMTgyRkYyMzM5ODExRTM4NkFBQ0VBQ0U5OTQ0RTFGIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+rG8MDAAAAM5JREFUeNpUUtESwyAIg8ft9v8/W4ElBPWKV1AIiKEeEWVuVlWjINSVONBnirQDxukNgcuyTQsBzLHMDsLIQQw+nIL71JqNJ5GZJXApFNpmtlagQjfS2xGbkFA4Iwu+hu0sK3Wl3nOwNv7TvPrWk3X0eW9dK1pU9hK2eTuWb2ySJmlziutA3iBxmblPNvA5PNsuUpoDY80+Z0SW1IRpDEqwC58C14tsr1f8le8si0aojdADr/1UjaclsFashX8GGkL9wDxtRsV6ft/PX4ABADRzhOVIOJaAAAAAAElFTkSuQmCC)}.fill-a,.fill-b{width:20px;text-align:right;overflow:hidden;text-overflow:ellipsis;display:block;background:#fff;padding-right:4px;position:absolute;left:0;margin-top:-7px;font-weight:700}.fill-b{text-align:left;position:absolute;right:0;left:auto;top:0;width:60px;padding-left:4px;padding-right:0}.cke_top{background:rgba(248,248,248,0.9)!important;background-image:none!important}.MessageBox{width:100%;height:100%;position:fixed;top:0;left:0;background:rgba(0,0,0,0.6);z-index:100000}@media screen and (max-width:450px) and (max-width:767px){.MessageBox{width:100%;height:100%;position:fixed;top:0;left:0;background:rgba(0,0,0,0.6);z-index:100000}}.MessageBoxContainer{top:35%;color:#fff;position:relative;width:100%;background-color:#232323;background-color:rgba(0,0,0,0.8);padding:20px}@media screen and (max-width:450px) and (max-width:767px){.MessageBoxContainer{top:25%;color:#fff;position:relative;width:100%;background-color:#232323}}.MessageBoxContainer input,.MessageBoxContainer select{width:50%;padding:5px}@media screen and (max-width:450px) and (max-width:767px){.MessageBoxContainer input,.MessageBoxContainer select{width:50%;padding:5px}}.MessageBoxMiddle{position:relative;left:20%;width:60%}@media screen and (max-width:450px) and (max-width:767px){.MessageBoxMiddle{position:relative;left:0;width:100%;padding:3px}}.MessageBoxMiddle .MsgTitle{letter-spacing:-1px;font-size:24px;font-weight:300}@media screen and (max-width:450px) and (max-width:767px){.MessageBoxMiddle .MsgTitle{font-size:22px}}.MessageBoxMiddle .pText{font-style:30px}@media screen and (max-width:450px) and (max-width:767px){.MessageBoxMiddle{font-style:10px}}.MessageBoxButtonSection{width:100%;height:30px}@media screen and (max-width:450px) and (max-width:767px){.MessageBoxButtonSection{width:100%;height:30px}}.MessageBoxButtonSection button{float:right;margin-right:7px;padding-left:15px;padding-right:15px;font-size:14px;font-weight:700}@media screen and (max-width:450px) and (max-width:767px){.MessageBoxButtonSection button{float:right;margin-right:5px;padding-left:15px;padding-right:15px}}.LoadingBoxContainer{top:20%;color:#fff;position:relative;width:100%;background-color:#232323}.LoadingBoxContainer .MsgTitle{font-size:26px}.LoadingBoxContainer .pText{font-style:30px}.LoadingBoxMiddle{position:relative;left:20%;width:50%;padding:10px}#LoadingPoints{position:absolute}#divMiniIcons{position:fixed;width:415px;right:10px;bottom:180px;z-index:9999;float:right}#divMiniIcons .cajita{text-align:center;vertical-align:middle;padding:4px 6px;color:#FFF;float:right;cursor:pointer;display:block;background-color:red;font-size:17px;margin-left:4px;margin-top:5px}#divMiniIcons .cajita:active{top:1px;left:1px;position:relative}#divSmallBoxes{position:fixed;right:0;top:0;z-index:9999}@media screen and (max-width:450px) and (max-width:767px){#divSmallBoxes{position:fixed;width:90%;right:0;top:0}}.BigBox{position:fixed;right:10px;bottom:10px;background-color:#004d60;padding:10px 10px 5px;width:390px;height:150px;color:#fff;z-index:99999;box-sizing:content-box;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;border-left:5px solid rgba(0,0,0,0.15);overflow:hidden}.BigBox span{font-size:17px;font-weight:300;letter-spacing:-1px;padding:5px 0!important;display:block}.BigBox p{font-size:13px;margin-top:10px}@media screen and (max-width:450px) and (max-width:767px){.BigBox{width:88%}}.BigBox .bigboxicon{font-size:30px;text-align:left;position:absolute;top:120px;left:6px;z-index:0}.BigBox .bigboxnumber{width:100%;text-align:right;font-size:25px}.SmallBox{position:absolute;right:5px;top:20px;width:420px;color:#fff;z-index:9999;overflow:hidden;border:1px solid transparent}@media screen and (max-width:450px) and (max-width:767px){.SmallBox{width:95%}}.SmallBox:hover{border:1px solid #fff;cursor:pointer}@media screen and (max-width:450px) and (max-width:767px){.SmallBox:hover{-webkit-box-shadow:0 0 10px #888;box-shadow:0 0 10px #888;cursor:pointer}}.SmallBox .foto{font-size:30px;position:absolute;left:20px}.SmallBox .textoFull{width:93%;float:left;padding-left:20px}@media screen and (max-width:450px) and (max-width:767px){.SmallBox .textoFull{width:93%;float:left;padding-left:20px}}.SmallBox .textoFoto{width:78%;margin:3px 20px 3px 80px;float:left}@media screen and (max-width:450px) and (max-width:767px){.SmallBox .textoFoto{width:55%;margin:3px 20px 3px 80px;float:left}}.SmallBox span{font-size:17px;font-weight:300;letter-spacing:-1px;display:block;margin:4px 0}@media screen and (max-width:450px) and (max-width:767px){.SmallBox span{font-size:16px}}.SmallBox p{font-size:13px;margin-top:2px}@media screen and (max-width:450px) and (max-width:767px){.SmallBox p{font-size:12px;margin-top:2px}}.btnClose{position:absolute;right:10px;height:16px;width:15px;cursor:pointer;font-size:18px;opacity:.5;display:block;top:15px}.btnClose:hover{opacity:1}.miniPic{position:absolute;bottom:8px;right:9px}.miniIcon{height:100%;font-size:20px}nav{padding-top:40px}nav ul{width:100%;padding:40px 28px 25px 0;padding:0;margin:0;font-size:13px;line-height:.5em;list-style:none;position:relative;background-color:#627685}nav ul li{overflow:hidden}nav ul li.divider{height:20px;border:0}nav ul li.header{font-family:"Ubuntu-Light",Arial,Helvetica,sans-serif;font-size:14px;font-weight:bold;color:#eee;background-color:#b13510;border-top-color:#d44918;border-bottom-color:#a13812;padding:4px 10px 4px 20px;line-height:18px}nav ul li.header:not(:first-child){margin-top:10px}.minified #left-panel nav ul li.header{padding:5px;color:#b94015;line-height:0;max-height:10px;overflow:hidden}nav ul li a{line-height:normal;font-size:14px;padding:10px 10px 10px 11px;color:#f4e8cf;display:block;font-weight:400;text-decoration:none!important;position:relative}nav ul li a:active{background:#616161!important}nav ul li a:focus{color:#c9c9c9}nav ul li a:hover{color:#fff;text-decoration:none}nav ul li.active>a{background-color:#627685;color:#fff!important;position:relative}nav ul li.active>a:before{content:"\f0d9";font-family:FontAwesome;display:block;height:27px;line-height:14px;width:27px;position:absolute;right:-21px;font-size:20px;color:#eee}nav ul li.active.open>a:before{content:""}nav ul li.active.open>a.active:before{content:"\f0d9"}nav ul li li{border-bottom:0;position:relative}nav ul .active>a{color:#fefefe!important;position:relative}nav ul b{float:right;font-size:14px;margin-top:-1px}nav ul span.menu-item-parent{display:inline-block;margin:0;padding:0}nav ul ul{margin:0;display:none;background:rgba(91,103,113,0.8);padding:2px 0}nav ul ul>li:hover b{color:#d5d9e2}nav ul ul li{margin:0;padding:0}nav ul ul li.divider{height:1px;margin-left:30px;padding:0}nav ul ul li>a{padding-left:42px;font-size:12px;font-weight:400;outline:0}nav ul ul li>a:hover{background-color:#46545e;color:#fff}nav ul ul li>a.active{margin-left:30px;padding-left:12px;background-color:#296191}.minified nav ul ul li>a.active{margin-left:0}nav ul ul ul{background:0;padding:0}nav ul ul ul li a{color:#bfbfbf;padding:8px 10px 8px 60px;font-size:11px}nav ul ul ul li a:hover{background-color:#46545e;color:#fff}nav ul ul ul li a.active{margin-left:50px;padding-left:10px}nav ul ul ul ul li a{padding-left:90px}nav ul ul ul ul li a.active{margin-left:80px;padding-left:10px}nav ul ul ul ul ul li a{padding-left:110px}nav ul ul ul ul ul li a.active{margin-left:100px;padding-left:10px}nav ul ul ul ul ul ul li a{padding-left:130px}nav ul ul ul ul ul ul li a.active{margin-left:120px;padding-left:10px}nav ul ul b{color:#b3b3b3}nav>ul>li{border-top:1px solid #718999;border-bottom:1px solid #576975}nav>ul>li:hover>ul::before,nav>ul>li:hover>ul>li::before{border-color:#acacac!important}nav>ul>li>a>.badge.pull-right{margin-right:15px}nav>ul>li>a b{position:absolute!important;right:10px;top:10px}nav>ul>li>a>i{margin-right:5px;width:15px;display:inline-block;text-align:center;position:relative}nav>ul>li>a>i>em{font-size:9px;display:block;padding:2px;position:absolute;top:-8px;right:-6px;text-decoration:none;font-style:normal;background:#ed1c24;color:#fff;min-width:13px;border-radius:50%;max-height:13px;line-height:8px;font-weight:700;vertical-align:baseline;white-space:nowrap;text-align:center;border:1px solid rgba(255,255,255,0.1)}nav>ul>li>ul::before{content:"";display:block;position:absolute;z-index:1;left:23px;top:0;bottom:0;border-left:1px solid #7a7a7a}nav>ul>li>ul>li>a,nav>ul>li>ul>li>ul>li>a{padding-top:5px;padding-bottom:5px}nav>ul ul li a i{font-size:14px!important;width:18px!important;text-align:center!important}nav>ul ul li::before{content:"";display:block;position:absolute;width:8px;left:23px;top:13px;border-top:1px solid #7a7a7a;z-index:1}nav>ul ul ul li::before{content:"";display:block;position:absolute;width:18px;left:10px;top:17px;border-top:1px solid transparent}@media(min-width:768px){.navbar-nav>li>a{padding-top:17px;padding-bottom:15px}}.ui-menu{display:block;width:155px;padding:2px;-webkit-box-shadow:0 2px 4px rgba(30,30,100,0.25);box-shadow:0 2px 4px rgba(30,30,100,0.25);background:#fff;border:1px solid rgba(0,0,0,0.2);z-index:1;list-style:none;margin:0;margin-bottom:2em;outline:0}.ui-menu .ui-menu{margin-top:-3px;position:absolute;list-style:none}.ui-menu .ui-menu-item{margin:0;padding:0;width:100%;list-style:none;list-style-image:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}.ui-menu .ui-menu-item a{text-decoration:none;display:block;padding:2px .4em;line-height:1.5;min-height:0;font-weight:400}.ui-menu .ui-menu-item a.ui-corner-all{border-radius:0}.ui-menu .ui-menu-item a.ui-state-active,.ui-menu .ui-menu-item a.ui-state-focus,.ui-menu .ui-menu-item a.ui-widget-content{font-weight:700;margin:0;background-color:#428bca;border-color:#357ebd;color:#FFF;display:block;white-space:nowrap}.ui-menu .ui-menu-item a.ui-state-active{padding:1px .4em}.ui-menu .ui-menu-item a .ui-menu-icon{width:auto;height:auto;top:0;left:auto;right:auto;bottom:auto;text-indent:0}.ui-menu .ui-menu-divider{margin:5px -2px 5px -2px;height:0;font-size:0;line-height:0;border-width:1px 0 0}.ui-menu .ui-state-disabled{margin:.4em 0 .2em!important;background:none!important;color:#999!important;font-weight:400!important;cursor:default;line-height:1.5}.ui-menu .ui-state-disabled a{cursor:default}.ui-menu .ui-menu-icons{position:relative}.ui-menu .ui-menu-icons .ui-menu-item a{position:relative;padding-left:2em}.ui-menu .ui-icon{position:absolute;top:.2em;left:.2em}.ui-menu .ui-menu-icon{position:static;float:right}.dropdown-menu>li>a:hover{background-color:#e0e0e0}.open>.dropdown-menu{-webkit-animation-name:flipInX;animation-name:flipInX;-webkit-animation-duration:.4s;animation-duration:.4s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.dropdown-menu .small.divider{margin:3px 0}.dropdown-menu-xs{min-width:37px}.dropdown-menu-xs>li>a{padding:3px 10px}.dropdown-menu-xs>li>a:hover i{color:#fff!important}.dropdown-submenu{position:relative}.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px}.dropdown-submenu:hover>.dropdown-menu{display:block}.dropdown-submenu>a:after{display:block;content:" ";float:right;width:0;height:0;border-color:transparent;border-style:solid;border-width:5px 0 5px 5px;border-left-color:#bfbfbf;margin-top:5px;margin-right:-10px}.dropdown-submenu:hover>a:after{border-left-color:#fff}.dropdown-submenu.pull-left{float:none}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:10px}.ajax-dropdown{position:absolute;display:none;z-index:1003;top:48px;left:16px;width:344px;height:435px;border-radius:0;-webkit-box-shadow:0 2px 4px rgba(30,30,100,0.25);box-shadow:0 2px 4px rgba(30,30,100,0.25);padding:10px;background:#fff;border:1px solid #b3b3b3}@media only screen and (min-width:320px) and (max-width:479px){.ajax-dropdown{width:299px;height:320px;left:0;top:49px}}.ajax-dropdown:after,.ajax-dropdown:before{bottom:100%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}.ajax-dropdown:before{border-color:rgba(131,131,131,0);border-bottom-color:#838383;border-width:8px;left:50%;margin-left:-8px}@media only screen and (min-width:320px) and (max-width:479px){.ajax-dropdown:before{margin-left:-14px}}.ajax-dropdown:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:7px;left:50%;margin-left:-7px}@media only screen and (min-width:320px) and (max-width:479px){.ajax-dropdown:after{margin-left:-13px}}.ajax-dropdown>:last-child{font-size:13px;display:block;padding:5px 0;line-height:22px;font-weight:400}.ajax-dropdown>:first-child{margin:0 0 3px;padding:0 0 9px}.ajax-dropdown .fa-4x.fa-border{border-width:3px;border-radius:50%;display:block;margin:0 auto;width:46px;text-align:center;color:#d1d1d1;border-color:#d1d1d1}.ajax-dropdown .btn-group .btn{font-weight:700;text-transform:capitalize}.ajax-dropdown .btn-group>:nth-child(2){border-right-width:0;border-left-width:0}.ajax-dropdown .btn-group .btn:active{top:0;left:0}.active+.ajax-dropdown{-webkit-animation-name:flipInY;animation-name:flipInY;-webkit-animation-duration:.7s;animation-duration:.7s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.dropdown-large{position:static!important}.dropdown-menu-large{margin-left:16px;margin-right:16px;padding:20px 0}.dropdown-menu-large>li>ul{padding:0;margin:0}.dropdown-menu-large>li>ul>li{list-style:none}.dropdown-menu-large>li>ul>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.428571429;color:#333;white-space:normal}.dropdown-menu-large>li ul>li>a:focus,.dropdown-menu-large>li ul>li>a:hover{text-decoration:none;color:#262626;background-color:#f5f5f5}.dropdown-menu-large .disabled>a,.dropdown-menu-large .disabled>a:focus,.dropdown-menu-large .disabled>a:hover{color:#999}.dropdown-menu-large .disabled>a:focus,.dropdown-menu-large .disabled>a:hover{text-decoration:none;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);cursor:not-allowed}.dropdown-menu-large .dropdown-header{color:#428bca;font-size:18px}@media(max-width:768px){.dropdown-menu-large{margin-left:0;margin-right:0}.dropdown-menu-large>li{margin-bottom:30px}.dropdown-menu-large>li:last-child{margin-bottom:0}.dropdown-menu-large .dropdown-header{padding:3px 15px!important}}.wijmo-wijmenu{padding:0 20px;background-color:#222;background-repeat:repeat-x;background-image:-webkit-gradient(linear,top left,bottom left,from(#333),to(#222));background-image:-webkit-linear-gradient(top,#333,#222);background-image:linear-gradient(top,#333,#222);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333',endColorstr='#222222',GradientType=0);-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.25),inset 0 -1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 3px rgba(0,0,0,0.25),inset 0 -1px 0 rgba(0,0,0,0.1)}.wijmo-wijmenu .ui-state-default .wijmo-wijmenu-text{color:#bfbfbf}.wijmo-wijmenu .ui-state-hover{background:#444;background:rgba(255,255,255,0.05)}.wijmo-wijmenu .ui-state-hover .wijmo-wijmenu-text{color:#fff}.wijmo-wijmenu .ui-widget-header h3{position:relative;margin-top:1px;padding:0}.wijmo-wijmenu h3 a{color:#fff;display:block;float:left;font-size:20px;font-weight:200;line-height:1;margin-left:-20px;margin-top:1px;padding:8px 20px 12px}.wijmo-wijmenu h3 a:hover{background-color:rgba(255,255,255,0.05);color:#fff;text-decoration:none}.wijmo-wijmenu .ui-widget-header{border:0}.wijmo-wijmenu .wijmo-wijmenu-parent .wijmo-wijmenu-child{padding:.3em 0}.wijmo-wijmenu .wijmo-wijmenu-item{margin:0;border:0}.wijmo-wijmenu .wijmo-wijmenu-item .wijmo-wijmenu-child{background:#333;border:0;margin:0;padding:6px 0;width:160px;border-radius:0 0 6px 6px;-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.2);box-shadow:0 2px 4px rgba(0,0,0,0.2)}.wijmo-wijmenu a.wijmo-wijmenu-link{margin:0;line-height:19px;padding:10px 10px 11px;border:0;border-radius:0}.wijmo-wijmenu .wijmo-wijmenu-child .wijmo-wijmenu-link{display:block;float:none;padding:4px 15px;width:auto}.wijmo-wijmenu .wijmo-wijmenu-child .wijmo-wijmenu-text{float:none}.wijmo-wijmenu .wijmo-wijmenu-item .wijmo-wijmenu-child .ui-state-hover{background:#191919}.wijmo-wijmenu .wijmo-wijmenu-item .wijmo-wijmenu-separator{padding:5px 0;background-image:none;background-color:#222;border-top:1px solid #444;border-bottom:0;border-left:0;border-right:0}.wijmo-wijmenu .wijmo-wijmenu-item input{-moz-transition:none 0s ease 0s;background-color:rgba(255,255,255,0.3);border:1px solid #111;border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.1) inset,0 1px 0 rgba(255,255,255,0.25);box-shadow:0 1px 2px rgba(0,0,0,0.1) inset,0 1px 0 rgba(255,255,255,0.25);color:rgba(255,255,255,0.75);font-family:Ubuntu,Helvetica,Arial,sans-serif;line-height:1;margin:5px 10px 0;padding:4px 9px;width:100px}.wijmo-wijmenu .wijmo-wijmenu-item input:hover{background-color:rgba(255,255,255,0.5);color:#fff}.wijmo-wijmenu .wijmo-wijmenu-item input:focus{background-color:#fff;border:0 none;-webkit-box-shadow:0 0 3px rgba(0,0,0,0.15);box-shadow:0 0 3px rgba(0,0,0,0.15);color:#404040;outline:0 none;padding:5px 10px;text-shadow:0 1px 0 #fff}.wijmo-wijmenu .ui-state-default{text-shadow:none;-webkit-box-shadow:none;box-shadow:none;color:#bfbfbf;-webkit-filter:none;filter:none}.tabs-below>.nav-tabs,.tabs-left>.nav-tabs,.tabs-right>.nav-tabs{border-bottom:0}.nav-tabs.bordered{background:#fff;border:1px solid #ddd}.nav-tabs.bordered>:first-child a{border-left-width:0!important}.nav-tabs.bordered+.tab-content{border:1px solid #ddd;border-top:0}.nav-tabs>li>a{padding:4px 10px;border-radius:0;color:#333}.nav-tabs>li>a.xsmall{line-height:1.0;padding:3px 8px}.nav-tabs>li>a .label{display:inline-block;font-size:11px;margin-left:5px;opacity:.5}.nav-tabs>li>a .badge{font-size:11px;padding:4px 5px 2px;opacity:.5;margin-left:5px;min-width:17px;font-weight:400}.tabs-left .nav-tabs>li>a .badge{margin-right:5px;margin-left:0}.nav-tabs>li>a>.fa{opacity:.5}.nav-tabs.small>li>a{padding:2px 8px;font-size:90%}.nav-tabs.tiny>li>a{padding:1px 6px;font-size:75%}.nav-tabs>li.active>a{-webkit-box-shadow:0 -2px 0 #3276b1;box-shadow:0 -2px 0 #3276b1;border-top-width:0!important;margin-top:1px!important;font-weight:700}.nav-tabs>li.active>a .badge,.nav-tabs>li.active>a .label,.nav-tabs>li.active>a>.fa{opacity:1}.tabs-left .nav-tabs>li.active>a{-webkit-box-shadow:-2px 0 0 #3276b1;box-shadow:-2px 0 0 #3276b1;border-top-width:1px!important;border-left:0!important;margin-left:1px!important}.tabs-right .nav-tabs>li.active>a{-webkit-box-shadow:2px 0 0 #3276b1;box-shadow:2px 0 0 #57889c;border-top-width:1px!important;border-right:0!important;margin-right:1px!important}.tabs-below .nav-tabs>li.active>a{-webkit-box-shadow:0 2px 0 #3276b1;box-shadow:0 2px 0 #3276b1;border-bottom-width:0!important;border-top:0!important;margin-top:0!important}.tabs-left>.nav-tabs>li,.tabs-right>.nav-tabs>li,.tabs-left>.nav-pills>li,.tabs-right>.nav-pills>li{float:none}.tabs-left>.nav-tabs>li>a,.tabs-right>.nav-tabs>li>a,.tabs-left>.nav-pills>li>a,.tabs-right>.nav-pills>li>a{min-width:74px;margin-right:0;margin-bottom:3px}.tabs-left .nav-pills>li.active>a{border:0!important;box-shadow:none!important;-webkit-box-shadow:none!important}.tabs-left>.nav-pills,.tabs-left>.nav-tabs{float:left;margin-right:19px;border-right:1px solid #ddd}.tabs-left>.nav-pills{border-right:0}.tabs-left>.nav-tabs>li>a{margin-right:-1px}.tabs-left>.nav-tabs>li>a:focus,.tabs-left>.nav-tabs>li>a:hover{border-color:#eee #d5d5d5 #eee #eee}.tabs-left>.nav-tabs .active>a,.tabs-left>.nav-tabs .active>a:focus,.tabs-left>.nav-tabs .active>a:hover{border-color:#d5d5d5 transparent #d5d5d5 #ddd;*border-right-color:#fff}.tabs-left>.tab-content{margin-left:109px}.tabs-right>.nav-tabs{float:right;margin-left:19px;border-left:1px solid #ddd}.tabs-right>.nav-tabs>li>a{margin-left:-1px}.tabs-right>.nav-tabs>li>a:focus,.tabs-right>.nav-tabs>li>a:hover{border-color:#eee #eee #eee #ddd}.tabs-right>.nav-tabs .active>a,.tabs-right>.nav-tabs .active>a:focus,.tabs-right>.nav-tabs .active>a:hover{border-color:#ddd #ddd #ddd transparent;*border-left-color:#fff}.tabs-pull-right.nav-tabs>li,.tabs-pull-right.nav-pills>li{float:right}.tabs-pull-right.nav-tabs>li:first-child>a,.tabs-pull-right.nav-pills>li:first-child>a{margin-right:1px}.tabs-pull-right.bordered.nav-pills>li:first-child>a,.tabs-pull-right.bordered.nav-tabs>li:first-child>a{border-left-width:1px!important;margin-right:0;border-right-width:0}.tabs-below>.nav-tabs{border-top:1px solid #ddd}.tabs-below>.nav-tabs>li{margin-top:-1px;margin-bottom:0}.tabs-below>.nav-tabs>li>a:focus,.tabs-below>.nav-tabs>li>a:hover{border-top-color:#ddd;border-bottom-color:transparent}.tabs-below>.nav-tabs>.active>a,.tabs-below>.nav-tabs>.active>a:focus,.tabs-below>.nav-tabs>.active>a:hover{border-color:transparent #ddd #ddd}.pill-content>.pill-pane,.tab-content>.pill-pane,.pill-content>.tab-pane,.tab-content>.tab-pane{display:none}.pill-content>.active,.tab-content>.active,.pill-content>.active,.tab-content>.active{display:block}.pill-content.transparent,.tab-content.transparent{background-color:transparent}.pill-content.bordered,.tab-content.bordered,.pill-content.bordered:hover,.tab-content.bordered:hover{border-color:#ddd;border-top:0}.ams-widget>header>.nav-tabs.pull-left>li:first-child a{border-left-width:0!important}h1,h2,h3,h4{margin:0;font-family:"Ubuntu-Bold",Arial,Helvetica,Sans-Serif;font-weight:300}h1{letter-spacing:-1px;font-size:24px;margin:10px 0}h1 small{font-size:18px;font-weight:300;letter-spacing:-1px}h2{letter-spacing:-1px;font-size:22px;margin:20px 0 15px;line-height:normal}h3{display:block;font-size:19px;font-weight:400;margin:16px 0 10px;line-height:normal}h4{line-height:normal;font-size:17px;font-weight:300;margin:12px 0 8px}h5{font-size:15px;font-weight:300;margin:10px 0 6px;line-height:normal}h6{font-size:14px;margin:10px 0 4px;font-weight:300;line-height:normal}hr .simple{margin-top:10px;margin-bottom:10px;border-style:dashed}li.nodot{list-style-type:none}img.online{border-left-color:#40ac2b!important}img.busy{border-left-color:#ed1c24!important}img.offline{border-left-color:#ddd!important}img.away{border-left-color:#ffc40d!important}[data-ams-url],[data-ams-click-handler]{cursor:pointer}label{font-weight:400}article.sortable-grid{min-height:30px}.caret{border-top:5px solid;border-right:5px solid transparent;border-left:5px solid transparent}.fixed{position:fixed}@media(max-width:768px){.xs-fixed{position:fixed}}@media(min-width:768px) and (max-width:992px){.sm-fixed{position:fixed}}@media(min-width:992px) and (max-width:1200px){.md-fixed{position:fixed}}@media(min-width:1200px){.lg-fixed{position:fixed}}.outside{position:absolute;left:-9999px}@media(max-width:979px){.visible-tablet{display:inline-block!important}}@media(max-width:979px){.hidden-tablet,.display-inline.hidden-tablet{display:none!important}}@media only screen and (min-width:0) and (max-width:679px){.hidden-tablet{display:none!important}}@media only screen and (min-width:320px) and (max-width:479px){.visible-mobile{display:inline-block!important}}@media only screen and (min-width:320px) and (max-width:479px){.hidden-mobile{display:none!important}}.viewport-y{overflow-y:auto}.viewport-y.viewport-100{max-height:100px}.viewport-y.viewport-200{max-height:200px}.viewport-y.viewport-300{max-height:300px}.viewport-y.viewport-600{max-height:600px}.viewport-y.viewport-400{max-height:400px}.viewport-y.viewport-500{max-height:500px}.viewport-y.viewport-600{max-height:600px}.viewport-x{overflow-x:auto}.viewport-x.viewport-100{max-width:100px}.viewport-x.viewport-200{max-width:200px}.viewport-x.viewport-300{max-width:300px}.viewport-x.viewport-400{max-width:400px}.viewport-x.viewport-500{max-width:500px}.viewport-x.viewport-600{max-width:600px}.height-100{min-height:100px}.height-200{min-height:200px}.height-300{min-height:300px}.height-400{min-height:400px}.height-500{min-height:500px}.height-600{min-height:600px}.lead{font-size:19px}.alert{margin-bottom:20px;margin-top:0;color:#675100;border-width:0;border-left-width:5px;padding:10px;border-radius:0}.alert .close{top:0;right:-5px;line-height:20px}.alert-heading{font-weight:600}.alert-danger{border-color:#963b49;color:#fff;background:#c46a69;text-shadow:none}.alert-warning{border-color:#e5c693;color:#6b6d31;background:#ecdfb0}.alert-success{border-color:#8eb589;color:#296829;background:#cee0cf}.alert-info{border-color:#9cb4c5;color:#346597;background:#d6dde7}.alert ul{margin-left:25px;list-style-position:outside;list-style-type:square}.ams-form>.alert{margin:5px;padding:5px;box-shadow:none!important;-webkit-box-shadow:none!important;border-radius:0!important}.help{font-size:90%;padding:5px!important}.help p{margin:0 0 1px;line-height:1.15}.modal-dialog .help{margin-bottom:5px!important}.well{background:#fbfbfb;border:1px solid #ddd;box-shadow:0 1px 1px #ececec;-webkit-box-shadow:0 1px 1px #ececec;position:relative}.well.well-clean{-webkit-box-shadow:none;box-shadow:none;border-color:transparent}.well.well-glass{-webkit-box-shadow:none;box-shadow:none;border-color:transparent;background-color:rgba(255,255,255,0.25);color:#fff}.well.well-light{background:#fff;border:1px solid #e2e2e2}.widget-body .well{margin-bottom:0}.well.transparent{border:0!important;background:none!important}.ams-widget.well.transparent>div,.ams-widget.well.transparent>div .widget-body{padding:0!important}.well[class*=" bg-"],.well[class^=bg-]{border:1px solid #555!important}.note{margin-top:6px;padding:0 1px;font-size:11px;line-height:15px;color:#999}.subscript{font-size:21px;color:#999}.display-image{margin-top:-60px;margin-right:20px}.terms-body{max-height:400px;overflow:auto}.timeline-seperator{display:block;text-align:center;color:#999;margin:20px 0 0}.timeline-seperator>:first-child{padding:4px 5px;border:1px dashed rgba(0,0,0,0.1);background:#fff;font-size:11px;border-radius:4px}.timeline-seperator .btn,.timeline-seperator .btn+.dropdown-menu{margin-right:15px}.timeline-seperator:after{display:block;content:" ";margin:0 20px;border-bottom:1px dashed rgba(0,0,0,0.1);margin-top:-8px}.progress{position:relative;margin-bottom:20px;overflow:hidden;height:22px;background:#eee;box-shadow:0 1px 0 transparent,0 0 0 1px #e3e3e3 inset;-webkit-box-shadow:0 1px 0 transparent,0 0 0 1px #e3e3e3 inset;border-radius:0}.progress-bar{float:left;width:0;height:100%;font-size:11px;color:#fff;text-align:center;background-color:#57889c;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);font-weight:700;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-image:url(../img/pattern/overlay-pattern.png)}.progress-striped .progress-bar{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-ms-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-danger{background-color:#a90329}.progress-striped .progress-bar-danger{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-success{background-color:#739e73}.progress-striped .progress-bar-success{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#c79121}.progress-striped .progress-bar-warning{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#57889c}.progress-striped .progress-bar-info{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress .bar-info,.progress-info .bar{background:#57889c}.progress-micro{height:3px!important;line-height:3px!important}.progress-xs{height:7px!important;line-height:7px!important}.progress-sm{height:14px!important;line-height:14px!important}.progress-lg{height:30px!important;line-height:30px!important}.progress .progress-bar{position:absolute;overflow:hidden;line-height:20px}.progress .progressbar-back-text{position:absolute;width:100%;height:100%;font-size:12px;line-height:20px;text-align:center}.progress .progressbar-front-text{display:block;width:100%;font-size:12px;line-height:20px;text-align:center}.progress.right .progress-bar{right:0}.progress.right .progressbar-front-text{position:absolute;right:0}.progress.vertical{width:25px;height:100%;min-height:150px;margin-right:20px;display:inline-block;margin-bottom:0}.progress.vertical.bottom{position:relative}.progress.vertical.bottom .progress-bar{position:absolute;bottom:0}.progress.vertical.bottom .progressbar-front-text{position:absolute;bottom:0}.progress.vertical .progress-bar{width:100%;height:0;-webkit-transition:height .6s ease;transition:height .6s ease}.progress.wide-bar{width:40px}.dd{position:relative;display:block;margin:0;padding:0;max-width:600px;list-style:none;font-size:13px;line-height:20px}@media only screen and (min-width:700px){.dd{float:left;width:100%}.dd+.dd{margin-left:2%}}.dd-header.calender-spacer{height:46px;display:block}.dd-list{display:block;position:relative;margin:0;padding:0;list-style:none}.dd-list .dd-list{padding-left:30px}.dd-collapsed .dd-list{display:none}.dd-empty{border:1px dashed #bbb;min-height:100px;background-color:#eee;background-image:-webkit-linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff),-webkit-linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff);background-image:linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff),linear-gradient(45deg,#fff 25%,transparent 25%,transparent 75%,#fff 75%,#fff);-webkit-background-size:60px 60px;background-size:60px 60px;background-position:0 0,30px 30px}.dd-empty,.dd-placeholder{margin:5px 0;padding:0;min-height:30px;background:#f2fbff;border:1px dashed #b6bcbf;-webkit-box-sizing:border-box;box-sizing:border-box;-moz-box-sizing:border-box}.dd-empty,.dd-item,.dd-placeholder{display:block;position:relative;margin:0;padding:0;min-height:20px;font-size:13px;line-height:20px}.dd-handle{display:block;font-size:15px;margin:5px 0;padding:7px 15px;color:#333;text-decoration:none;border:1px solid #cfcfcf;background:#fbfbfb}.dd-handle:hover,.dd-handle:hover+.dd-list .dd-handle{background:#fddfb3!important;border:1px solid #faa937;color:#333!important}.dd-handle>span{font-size:13px;color:#777}.dd-hover>.dd-handle{background:#2ea8e5!important}.dd-item>button{position:relative;cursor:pointer;float:left;width:25px;height:20px;margin:7px 10px;line-height:22px!important;padding:0;text-indent:100%;white-space:nowrap;overflow:hidden;border:0;background:rgba(0,0,0,0);text-align:center;display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:18px}.dd-item>button:before{content:'\f055';display:block;position:absolute;width:100%;text-align:center;text-indent:0;color:#0091d9}.dd-item>button[data-action=collapse]:before{content:'\f056';color:#a90329}.dd-dragel{position:absolute;pointer-events:none;z-index:9999}.dd-dragel>.dd-item .dd-handle{margin-top:0}.dd-dragel>.dd-item>.dd-handle{border-left-width:4px}.dd-dragel .dd-handle{-webkit-box-shadow:2px 4px 6px 0 rgba(0,0,0,0.1);box-shadow:2px 4px 6px 0 rgba(0,0,0,0.1)}.dd-dragel>li.dd-item.dd3-item{position:relative;top:10px;left:10px;z-index:999}.vertical-bars{padding:0;margin:0}.vertical-bars:after{content:"";display:block;height:0;clear:both}.vertical-bars li{padding:14px 0;width:25%;display:block;float:left;text-align:center}.vertical-bars li:first-child{border-left:0}.vertical-bars>li>.progress.vertical{margin:0 auto;float:none}.vertical-bars>li>.progress.vertical:first-child{margin-left:auto}.bar-holder{padding:18px 15px}.bar-holder:first-child{border-top:0}.bar-holder .progress{margin:0}.pagination.pagination-alt>li>a{box-shadow:none;-webkit-box-shadow:none;border:0;margin-left:-1px}.pagination.pagination-alt>li:first-child>a{padding-left:0}.pagination>li>a,.pagination>li>span{padding:7px 12px 5px;box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05);-webkit-box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05)}.pagination-xs>li>a,.pagination-xs>li>span{padding:5px 9px 3px;font-size:12px}.panel-purple{border-color:#6e587a}.panel-purple>.panel-heading{color:#fff;background-color:#6e587a;border-color:#6e587a}.panel-greenLight{border-color:#71843f}.panel-greenLight>.panel-heading{color:#fff;background-color:#71843f;border-color:#71843f}.panel-greenDark{border-color:#496949}.panel-greenDark>.panel-heading{color:#fff;background-color:#496949;border-color:#496949}.panel-darken{border-color:#333}.panel-darken>.panel-heading{color:#fff;background-color:#404040;border-color:#404040}.panel-pink{border-color:#ac5287}.panel-pink>.panel-heading{color:#fff;background-color:#ac5287;border-color:#ac5287}.panel-green{border-color:#356e35}.panel-green>.panel-heading{color:#fff;background-color:#356e35;border-color:#356e35}.panel-blueLight{border-color:#92a2a8}.panel-blueLight>.panel-heading{color:#fff;background-color:#92a2a8;border-color:#92a2a8}.panel-pinkDark{border-color:#a8829f}.panel-pinkDark>.panel-heading{color:#fff;background-color:#a8829f;border-color:#a8829f}.panel-redLight{border-color:#a65858}.panel-redLight>.panel-heading{color:#fff;background-color:#a65858;border-color:#a65858}.panel-red{border-color:#a90329}.panel-red>.panel-heading{color:#fff;background-color:#a90329;border-color:#a90329}.panel-teal{border-color:#568a89}.panel-teal>.panel-heading{color:#fff;background-color:#568a89;border-color:#568a89}.panel-orange{border-color:#c79121}.panel-orange>.panel-heading{color:#fff;background-color:#c79121;border-color:#c79121}.panel-blueDark{border-color:#4c4f53}.panel-blueDark>.panel-heading{color:#fff;background-color:#4c4f53;border-color:#4c4f53}.panel-magenta{border-color:#6e3671}.panel-magenta>.panel-heading{color:#fff;background-color:#6e3671;border-color:#6e3671}.panel-blue{border-color:#57889c}.panel-blue>.panel-heading{color:#fff;background-color:#57889c;border-color:#57889c}.panel-footer>.btn-block{border-radius:0;border-bottom:0;border-left:0;border-right:0}.notification-body{padding:0 0 0 3px;margin:0;list-style:none}.notification-body *,.notification-body:after *,.notification-body:before *{box-sizing:border-box!important;-webkit-box-sizing:border-box!important;-moz-box-sizing:border-box!important}.notification-body>li{border-bottom:1px solid #e9e9e9;position:relative}.notification-body>li>span{background:#fff;display:block;min-height:25px;overflow:hidden;padding:8px 10px 13px;white-space:normal}.notification-body>li>span:hover{background:#f0f4f7;color:#667f8f}.notification-body>li a.msg{padding-left:50px!important}.notification-body>li a,.notification-body>li a span{display:block;position:relative;overflow:hidden}.notification-body>li a,.notification-body>li a:hover{text-decoration:none}.notification-body>li:hover .progress{background:#fff;box-shadow:0 1px 0 rgba(0,0,0,0),0 0 0 1px #a7a7a7 inset;-webkit-box-shadow:0 1px 0 rgba(0,0,0,0),0 0 0 1px #ccc inset}.notification-body>li:hover .text-muted{color:#333}.notification-body .from{font-size:14px;line-height:normal;color:#333;font-weight:400;margin-right:60px;margin-bottom:6px;height:20px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.notification-body .unread{background:#ffffe0}.notification-body .unread .unread .from{font-weight:700}.notification-body time{position:absolute;top:3px;right:0;font-size:11px;font-weight:400;color:#058dc7}.notification-body .msg-body,.notification-body .subject{font-size:13px;color:#a0a0a0;max-height:35px;width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.notification-body .subject{font-size:13px;color:#333;max-height:22px}.ajax-notifications{height:365px;display:block;overflow:auto;margin-right:-10px;margin-left:-10px;border-bottom:1px solid #cecece;border-top:1px solid #cecece;background:#e9e9e9}@media only screen and (min-width:320px) and (max-width:479px){.ajax-notifications{height:250px}}.ajax-notifications>.alert.alert-transparent{background-color:transparent;border-color:transparent;color:#757575;margin:13px 10px}.ajax-notifications>.alert>:first-child{margin-bottom:10px;font-weight:400}.arrow-box-up:before,.arrow-box-up:after{bottom:100%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}.arrow-box-up:before{border-color:rgba(131,131,131,0);border-bottom-color:#838383;border-width:8px;left:50%;margin-left:-8px}.arrow-box-up:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:7px;left:50%;margin-left:-7px}.arrow-box-up-right:before,.arrow-box-up-right:after{bottom:100%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}.arrow-box-up-right:before{border-color:rgba(131,131,131,0);border-bottom-color:#838383;border-width:8px;right:9px;margin-left:-8px}.arrow-box-up-right:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:7px;right:10px;margin-left:-7px}.tooltip-inner{padding:5px 10px;font-size:11px;font-family:Ubuntu,Arial,Helvetica,sans-serif;font-weight:700;border-radius:0}.jqstooltip{padding:7px!important;border-radius:3px!important;border:0!important;background-color:#000!important;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box}.jqstooltip .jqsfield{font-family:Ubuntu,Arial,sans-serif;font-size:11px}.dd3-content{display:block;margin:5px 0;padding:6px 10px 8px 40px;font-size:15px;color:#333;text-decoration:none;border:1px solid #cfcfcf;background:#fbfbfb}.dd3-content:hover{color:#2ea8e5;background:#fff}.dd-dragel>.dd3-item>.dd3-content{margin:0}.dd3-item>button{margin-left:38px}.dd3-handle{position:absolute;margin:0;left:0;top:0;cursor:move;width:30px;text-indent:100%;white-space:nowrap;overflow:hidden;border:1px solid #aaa;background:#bfbfbf;background:-webkit-gradient(linear,top left,bottom left,from(#ddd),to(#bbb));background:-webkit-linear-gradient(top,#ddd 0,#bbb 100%);background:linear-gradient(top,#ddd 0,#bbb 100%);display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:18px;padding:8px 15px}.dd3-handle:before{content:'\f0c9';display:block;position:absolute;left:0;top:3px;width:100%;text-align:center;text-indent:0;color:#818181;font-weight:400;line-height:28px}.dd3-handle:hover:before{color:#c27616}.nestable-lists{display:block;clear:both;padding:30px 0;width:100%;border:0;border-top:2px solid #bfbfbf;border-bottom:2px solid #bfbfbf}#nestable-menu{padding:0;margin:10px 0 20px}#nestable-output,#nestable2-output{width:100%;padding:5px}.custom-scroll::-webkit-scrollbar{-webkit-overflow-scrolling:touch;height:10px;width:10px}.custom-scroll::-webkit-scrollbar:hover{background-color:#e9e9e9;border:1px solid #dbdbdb}.custom-scroll::-webkit-scrollbar-button:start:decrement,.custom-scroll::-webkit-scrollbar-button:end:increment{background:0;display:block;height:0}.custom-scroll::-webkit-scrollbar-track{-webkit-background-clip:padding-box;background-clip:padding-box;border:solid transparent}.custom-scroll::-webkit-scrollbar-track-piece{-o-border-radius:0;background-color:transparent;border-radius:0}.custom-scroll::-webkit-scrollbar-thumb{-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,0.1),inset 0 -1px 0 rgba(0,0,0,0.07);-webkit-background-clip:padding-box;background-clip:padding-box;background-color:rgba(0,0,0,0.2);border:0;box-shadow:inset 1px 1px 0 rgba(0,0,0,0.1),inset 0 -1px 0 rgba(0,0,0,0.07)}.custom-scroll::-webkit-scrollbar-thumb:vertical,.custom-scroll::-webkit-scrollbar-thumb:horizontal{-o-border-radius:0;background-color:#bfbfbf;border-radius:0}.custom-scroll::-webkit-scrollbar-thumb:active{-webkit-box-shadow:inset 1px 1px 3px rgba(0,0,0,0.33);background-color:rgba(0,0,0,0.44);box-shadow:inset 1px 1px 3px rgba(0,0,0,0.33)}.custom-scroll::-webkit-scrollbar-thumb:hover{background-color:#959595}.air{position:absolute;z-index:5}.air-bottom{bottom:0}.air-top{top:0}.air-top-right{top:0;right:0}.air-top-left{top:0;left:0}.air-bottom-left{bottom:0;left:0}.air-bottom-right{bottom:0;right:0}.tree{min-height:20px;border-radius:4px}.tree li{list-style-type:none;margin:0;padding:3px 0 3px 5px;position:relative}.tree li:after,.tree li:before{content:'';left:-20px;position:absolute;right:auto}.tree li:before{border-left:1px solid #999;bottom:50px;height:100%;top:-5px;width:1px;-webkit-transition:"border-color 0.1s ease 0.1s";transition:"border-color 0.1s ease 0.1s"}.tree li:last-child::before{height:30px}.tree li:after{border-top:1px solid #999;height:20px;top:14px;width:25px}.tree li:hover{background:rgba(0,0,0,0.15)}.tree li>span{border:1px dotted #999;border-radius:5px;display:inline-block;padding:4px 8px;text-decoration:none;-webkit-transition:color .2s ease .1s,background-color .2s ease .1s,border-color .3s ease .2s;transition:color .2s ease .1s,background-color .2s ease .1s,border-color .3s ease .2s}.tree li>span>i{padding-right:4px}.tree li.parent_li>span{padding:7px}.tree li>span{cursor:pointer}.tree li>span:hover,.tree li>span:hover+ul li>span{background:#eee;border:1px solid #94a0b4;color:#000}.tree ul ul{padding-left:34px;padding-top:5px}.tree>ul{padding-left:0}.tree>ul>li:after,.tree>ul>li:before{border:0}.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.pace-inactive{display:none}.pace .pace-progress{background:#3276b1;position:fixed;z-index:2000;top:0;left:0;height:2px;-webkit-transition:width 1s;transition:width 1s}.pace .pace-progress-inner{display:block;position:absolute;right:0;width:100px;height:100%;-webkit-box-shadow:0 0 10px #29d,0 0 5px #29d;box-shadow:0 0 10px #29d,0 0 5px #29d;opacity:1;-webkit-transform:rotate(3deg) translate(0,-4px);-ms-transform:rotate(3deg) translate(0,-4px);transform:rotate(3deg) translate(0,-4px)}.pace .pace-activity{display:block;position:fixed;z-index:2000;top:63px;right:40px;width:14px;height:14px;border:solid 2px transparent;border-top-color:#29d;border-left-color:#29d;border-radius:10px;-webkit-animation:pace-spinner 400ms linear infinite;-ms-animation:pace-spinner 400ms linear infinite;animation:pace-spinner 400ms linear infinite}.table-full{width:100%}.table-wrap{overflow:auto}.table.has-tickbox thead tr th:first-child{width:18px}.table.has-tickbox.ams-form tbody tr td:first-child .checkbox,.table.has-tickbox.ams-form tbody tr td:first-child .radio,.table.has-tickbox.ams-form thead tr th:first-child .checkbox,.table.has-tickbox.ams-form thead tr th:first-child .radio{padding:0!important}.table-dnd tbody tr.dragging-row td{background-color:#cedbf7!important}.table-dnd tbody tr td:first-child{padding-left:20px!important}.table-dnd tbody td.drag-handle{background:transparent url('../img/vert-drag-handle.png') scroll no-repeat left 50%}.table-tight td,.table-tight th{padding:4px 8px!important;line-height:1.3!important}.table-small td,.table-small th{padding:2px 8px!important;line-height:1.2!important}.table-mini td,.table-mini th{padding:1px 8px!important;line-height:1.1!important}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-width:1px}.table-bordered .no-padding>.table-bordered{border:0!important}.table-bordered .no-padding>.table-bordered tbody tr td:first-child,.table-bordered .no-padding>.table-bordered thead tr td:first-child,.table-bordered .no-padding>.table-bordered thead tr th:first-child{border-left-width:0!important}.table-bordered .no-padding>.table-bordered tbody tr td:last-child,.table-bordered .no-padding>.table-bordered thead tr th:last-child{border-right-width:0!important}.table-bordered .no-padding>.table-bordered tbody tr:last-child td{border-bottom-width:0!important}.no-padding .note-editable .table-bordered{border:1px solid #ddd!important}tr.bordered-bottom th,tr.bordered-bottom td{border-bottom:1px solid #ddd}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#eee}th.checker,td.checker{width:30px}th.actions-menu{width:70px}th.action,td.action{width:26px}.dt-row{padding:4px 10px}.dt-top-row{height:0;line-height:0;position:relative}.dt-bottom-row{background:#fafafa;font-size:11px;overflow:hidden;padding:5px 10px;border-top:1px solid #ccc;-webkit-box-shadow:inset 0 1px #fff;-ms-box-shadow:inset 0 1px #fff;box-shadow:inset 0 1px #fff}.modal-dialog .ams-form .dt-bottom-row{padding:5px 10px!important}.modal-dialog .ams-form .dt-bottom-row .row{margin:0}.dataTables_length{position:absolute;right:13px;top:-35px}.dataTables_length select{width:60px;padding:3px;font-size:13px;border:1px solid #bbb}.dataTables_filter{position:absolute;left:10px;top:-35px}.dataTables_filter input{padding:3px 8px 1px;font-size:13px}.dataTables_filter .form-control{height:28px}.dataTables_filter .input-group{width:180px!important}.dataTables_filter input select{border:1px solid #bbb}.dataTables_paginate{margin:4px 0 0}.dataTables_paginate .pagination{margin:0}.dataTables_paginate .btn-group a{color:#2e5f87}.dataTables_wrapper{position:relative}.dataTables_wrapper table.table{clear:both;max-width:inherit;margin-bottom:0}.dataTables_wrapper table.table thead th{white-space:nowrap;text-overflow:ellipsis;-ms-text-overflow:ellipsis}.dataTables_wrapper table.table thead .sorting,.dataTables_wrapper table.table thead .sorting_asc,.dataTables_wrapper table.table thead .sorting_asc_disabled,.dataTables_wrapper table.table thead .sorting_desc,.dataTables_wrapper table.table thead .sorting_desc_disabled{cursor:pointer;padding-right:20px}.dataTables_wrapper table.table thead .sorting{background:url(../img/datatable/sort_both.png) no-repeat center right}.dataTables_wrapper table.table thead .sorting_asc{background:url(../img/datatable/sort_asc.png) no-repeat center right}.dataTables_wrapper table.table thead .sorting_desc{background:url(../img/datatable/sort_desc.png) no-repeat center right}.dataTables_wrapper table.table thead .sorting_asc_disabled{background:url(../img/datatable/sort_asc_disabled.png) no-repeat center right}.dataTables_wrapper table.table thead .sorting_desc_disabled{background:url(../img/datatable/sort_desc_disabled.png) no-repeat center right}.dataTables_wrapper table.table tbody tr.active th,.dataTables_wrapper table.table tbody tr.active td{background-color:#08C;color:#fff}.dataTables_wrapper table.table tbody tr.active:hover td,.dataTables_wrapper table.table tbody tr.active:hover th{background-color:#0075b0!important}.dataTables_wrapper table.dataTable th:active{outline:0}.dataTables_wrapper .table-striped tbody tr.active:nth-child(odd) td,.dataTables_wrapper .table-striped tbody tr.active:nth-child(odd) th{background-color:#017ebc}.dataTables_wrapper select{min-height:inherit}.dataTables_wrapper table+.row{margin-bottom:0;margin-top:10px}.dataTables_wrapper .dt_actions{float:left;margin-right:20px}.dataTables_wrapper .bottom,.dataTables_wrapper .top{background-color:#f5f5f5;border:1px solid #CCC;padding:15px}.dataTables_wrapper div.DTTT .btn:hover{text-decoration:none!important}.dataTables_wrapper ul.DTTT_dropdown.dropdown-menu a{color:#333!important}.dataTables_wrapper ul.DTTT_dropdown.dropdown-menu li:hover a{background-color:#08c;color:#fff!important}.dataTables_wrapper div.DTTT_print_info.modal{height:150px;margin-top:-75px;text-align:center}.dataTables_wrapper div.DTTT_print_info h6{font-weight:400;font-size:28px;line-height:28px;margin:1em}.dataTables_wrapper div.DTTT_print_info p{font-size:14px;line-height:20px}.dataTables_wrapper div.DTFC_LeftFootWrapper table,.dataTables_wrapper div.DTFC_LeftHeadWrapper table,.dataTables_wrapper table.DTFC_Cloned tr.even{background-color:#fff}.dataTables_wrapper div.DTFC_LeftHeadWrapper table{margin-bottom:0!important;border-top-right-radius:0!important;border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}.dataTables_scrollBody{-webkit-overflow-scrolling:touch}.top .dataTables_info{float:none}div.dt-bottom-row .dataTables_info{float:left;padding-top:10px;font-size:12px}.dataTables_full{width:100%!important}.dataTables_empty{text-align:center!important;font-size:15px;background:#fff!important;padding:20px 0!important;cursor:default}.dataTables_scroll{clear:both}.dataTables_scrollHeadInner table.table-bordered{border-radius:4px 4px 0 0}.dataTables_scrollHeadInner table.table-bordered,.dataTables_scrollHeadInner table.table-bordered thead{border-bottom:0}.dataTables_scrollBody table{border-top:0}.dataTables_processing{position:absolute;top:50%;margin-top:-24px;z-index:100;left:50%;width:250px;margin-left:-125px;border:1px solid #ddd;text-align:center;color:#000;background:#fff;font-size:15px!important;-webkit-box-shadow:0 0 4px rgba(0,0,0,0.2);-ms-box-shadow:0 0 4px rgba(0,0,0,0.2);box-shadow:0 0 4px rgba(0,0,0,0.2);padding:10px 0}.dataTables_wrapper .center{text-align:center}.dataTables_wrapper .details,.dataTables_wrapper .details:hover{background:#ddd!important}.dataTables_wrapper .details table td{background:#fff!important}.dataTables_scrollHeadInner table.table,.dataTables_wrapper .details table.table{margin:0!important}.dataTables_scrollHead table{margin-bottom:0!important;border-bottom-left-radius:0;border-bottom-right-radius:0}.dataTables_scrollHead table thead tr:last-child th:first-child{border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}.DTFC_LeftHeadWrapper table thead tr:last-child td:first-child,.DTFC_LeftHeadWrapper table thead tr:last-child th:first-child{border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}.DTFC_LeftBodyWrapper table,.dataTables_scrollBody table{border-top:0;margin-bottom:0!important}.DTFC_LeftBodyWrapper tbody tr:first-child td,.DTFC_LeftBodyWrapper tbody tr:first-child th,div.DTFC_LeftFootWrapper table,div.dataTables_scrollBody tbody tr:first-child th,div.dataTables_scrollFoot table{border-top:0}.ColVis{position:absolute;right:83px;top:-35px}.ColVis_collection{position:relative;width:180px;background-color:#fff;border:1px solid rgba(0,0,0,0.2);-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.2);box-shadow:0 2px 4px rgba(0,0,0,0.2);z-index:1102;padding-top:3px;padding-left:10px;list-style-type:none;list-style-position:outside}.ColVis_collection .ColVis_Button{position:relative;margin-right:3px;height:30px;background-color:#fff;border:1px solid #d0d0d0;cursor:hand;padding:3px 5px}.ColVis_collection button.ColVis_Button{padding:4px 12px;height:26px;background-color:#fff;border:0;width:100%;float:none;font-size:12px}.ColVis_collection button.ColVis_Button+button.ColVis_Button{border-top:1px solid #e1e1e1}.ColVis_collection button.ColVis_Button button.ColVis_Button input{margin:0}button.ColVis_Button{padding:4px 5px;text-align:left}button.ColVis_Button::-moz-focus-inner{border:0!important;padding:0}.ColVis_collectionBackground{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#000;z-index:1100}div.ColVis_catcher{position:absolute;z-index:1101}span.ColVis_radio{display:inline-block;width:20px;vertical-align:-2px}.ColVis_text_hover,div.ColVis_collection button.ColVis_Button:hover{background:#f2f2f2;color:#222}table.DTCR_clonedTable{background-color:#fff;z-index:202}div.DTCR_pointer{width:1px;background-color:#0259c4;z-index:201}ul.DTTT_dropdown.dropdown-menu li{position:relative}ul.DTTT_dropdown.dropdown-menu li:hover a{background-color:#f2f2f2;color:#333!important}.table_tools_group{position:absolute;right:83px;top:-37px}.DTTT.btn-group{position:absolute;top:-38px;right:83px}.DTTT_dropdown{z-index:2002}.DTFC_LeftHeadWrapper{border-bottom:1px solid #ddd}div.DTTT_container{position:relative;float:right;margin-bottom:1em}a.DTTT_button,button.DTTT_button,div.DTTT_button{position:relative;float:left;margin-right:3px;padding:5px 8px;border:1px solid #999;cursor:pointer;*cursor:hand;font-size:.88em;color:#000!important;-o-border-radius:2px;border-radius:2px;-webkit-box-shadow:1px 1px 3px #ccc;-ms-box-shadow:1px 1px 3px #ccc;-o-box-shadow:1px 1px 3px #ccc;box-shadow:1px 1px 3px #ccc;background:#fff;background:-webkit-gradient(linear,top left,bottom left,from(#fff),color-stop(89%,#f3f3f3),to(#f9f9f9));background:-webkit-linear-gradient(top,#fff 0,#f3f3f3 89%,#f9f9f9 100%);background:linear-gradient(top,#fff 0,#f3f3f3 89%,#f9f9f9 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff',endColorstr='#f9f9f9',GradientType=0)}a.DTTT_button:hover,button.DTTT_button:hover,div.DTTT_button:hover{border:1px solid #666;text-decoration:none!important;-webkit-box-shadow:1px 1px 3px #999;-ms-box-shadow:1px 1px 3px #999;-o-box-shadow:1px 1px 3px #999;box-shadow:1px 1px 3px #999;background:#f3f3f3;background:-webkit-gradient(linear,top left,bottom left,from(#f3f3f3),color-stop(89%,#e2e2e2),to(#f4f4f4));background:-webkit-linear-gradient(top,#f3f3f3 0,#e2e2e2 89%,#f4f4f4 100%);background:linear-gradient(top,#f3f3f3 0,#e2e2e2 89%,#f4f4f4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3f3f3',endColorstr='#f4f4f4',GradientType=0)}button.DTTT_button{height:30px;padding:3px 8px}.DTTT_button embed{outline:0}a.DTTT_disabled,button.DTTT_disabled,div.DTTT_disabled{color:#999;border:1px solid #d0d0d0;background:#fff;background:-webkit-gradient(linear,top left,bottom left,from(#fff),color-stop(89%,#f9f9f9),to(#fafafa));background:-webkit-linear-gradient(top,#fff 0,#f9f9f9 89%,#fafafa 100%);background:linear-gradient(top,#fff 0,#f9f9f9 89%,#fafafa 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff',endColorstr='#fafafa',GradientType=0)}table.DTTT_selectable tbody tr{cursor:pointer;*cursor:hand}table.dataTable tr.DTTT_selected.odd td.sorting_1,table.dataTable tr.DTTT_selected.odd td.sorting_2,table.dataTable tr.DTTT_selected.odd td.sorting_3{background-color:#9fafd1}table.dataTable tr.DTTT_selected.even td.sorting_1,table.dataTable tr.DTTT_selected.even td.sorting_2,table.dataTable tr.DTTT_selected.even td.sorting_3{background-color:#b0bed9}div.DTTT_collection{width:150px;padding:8px 8px 4px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.4);background-color:#f3f3f3;background-color:rgba(255,255,255,0.3);overflow:hidden;z-index:2002;-o-border-radius:5px;border-radius:5px;-webkit-box-shadow:3px 3px 5px rgba(0,0,0,0.3);-ms-box-shadow:3px 3px 5px rgba(0,0,0,0.3);-o-box-shadow:3px 3px 5px rgba(0,0,0,0.3);box-shadow:3px 3px 5px rgba(0,0,0,0.3)}div.DTTT_collection a.DTTT_button,div.DTTT_collection button.DTTT_button,div.DTTT_collection div.DTTT_button{position:relative;left:0;right:0;display:block;float:none;margin-bottom:4px;-webkit-box-shadow:1px 1px 3px #999;-ms-box-shadow:1px 1px 3px #999;-o-box-shadow:1px 1px 3px #999;box-shadow:1px 1px 3px #999}div.DTTT_collection_background{z-index:2001}.DTTT_print_info{position:fixed;top:50%;left:50%;width:400px;height:150px;margin-left:-200px;margin-top:-75px;text-align:center;color:#333;padding:10px 30px;background:#fff;background:-webkit-gradient(linear,top left,bottom left,from(#fff),color-stop(89%,#f3f3f3),to(#f9f9f9));background:-webkit-linear-gradient(top,#fff 0,#f3f3f3 89%,#f9f9f9 100%);background:linear-gradient(top,#fff 0,#f3f3f3 89%,#f9f9f9 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff',endColorstr='#f9f9f9',GradientType=0);opacity:.95;border:1px solid #000;border:1px solid rgba(0,0,0,0.5);-o-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0,0,0,0.5);-ms-box-shadow:0 3px 7px rgba(0,0,0,0.5);-o-box-shadow:0 3px 7px rgba(0,0,0,0.5);box-shadow:0 3px 7px rgba(0,0,0,0.5)}.DTTT_print_info h6{font-weight:400;font-size:28px;line-height:28px;margin:1em}.DTTT_print_info p{font-size:14px;line-height:20px}.form hr{margin-left:-13px;margin-right:-13px;border-color:rgba(0,0,0,0.1);margin-top:20px;margin-bottom:20px}.form fieldset{display:block;border:0;background:rgba(255,255,255,0.9);position:relative}.form header,.form legend{display:block;padding:8px 0;border-bottom:1px dashed rgba(0,0,0,0.2);background:#fff;font-size:16px;font-weight:300;color:#222;margin:25px 0 20px}.no-padding .form header{margin:25px 14px 0}.form header:first-child{margin-top:10px}.form .form-group:last-child,.form .form-group:last-child .note,.form fieldset .form-group:last-child,.form fieldset .form-group:last-child .note{margin-bottom:0}fieldset{position:relative}legend{font-weight:400;margin-top:0;background:0}i.hint{vertical-align:super;opacity:.5}i.hint:hover{opacity:.9!important}.nohints i.hint{display:none}.input-group-addon{padding:6px 10px 5px;border-radius:0;transition:background-color .3s;-webkit-transition:background-color .3s}.input-group-addon .fa{font-size:14px}.input-group-addon .fa-2x,.input-group-addon .fa-lg{font-size:2em}.input-group-addon .fa-3x,.input-group-addon .fa-4x,.input-group-addon .fa-5x{font-size:30px}.input-group-addon .checkbox,.input-group-addon .radio{min-height:0;margin-right:0!important;padding-top:0}.input-group-addon label input[type=checkbox].checkbox+span,.input-group-addon label input[type=checkbox].checkbox+span:before,.input-group-addon label input[type=radio].radiobox+span,.input-group-addon label input[type=radio].radiobox+span:before{margin-right:0}.input-group-addon .onoffswitch,.input-group-addon .onoffswitch-label{margin:0}input[type=text]:focus+.input-group-addon{border-color:#0091d9;background-color:#72a0ce;color:#fff}.has-warning input[type=text]:focus+.input-group-addon{border-color:#7f6a1e;background-color:#cead35;color:#fff}.has-error input[type=text]:focus+.input-group-addon{border-color:#c46a69;background-color:#c46a69;color:#fff}.has-success input[type=text]:focus+.input-group-addon{border-color:#446b46;background-color:#588a5a;color:#fff}.input-icon-left>i{right:auto;left:24px}.input-icon-left .form-control{padding-left:29px}.input-icon-right{position:relative}.input-icon-right .form-control{padding-right:27px}.input-icon-left>i,.input-icon-right>i{position:absolute;right:10px;top:30%;font-size:16px;color:#bfbfbf}.form-actions{display:block;padding:13px 14px 15px;border-top:1px solid rgba(0,0,0,0.1);background:rgba(249,249,249,0.9);margin-top:25px;margin-left:-13px;margin-right:-13px;margin-bottom:-13px;text-align:right}.well .form-actions{margin-left:-19px;margin-right:-19px;margin-bottom:-19px}.well.well-lg .form-actions{margin-left:-24px;margin-right:-24px;margin-bottom:-24px}.well.well-sm .form-actions{margin-left:-9px;margin-right:-9px;margin-bottom:-9px}.popover-content .form-actions{margin:0 -14px -9px;border-radius:0 0 3px 3px;padding:9px 14px}.no-padding .form .form-actions{margin:0;display:block;padding:13px 14px 15px;border-top:1px solid rgba(0,0,0,0.1);background:rgba(248,248,248,0.9);text-align:right;margin-top:25px}:focus{outline:0!important}.filter_column input{padding:0 3px}.filter_column input,.filter_column select{width:100%;color:rgba(0,0,0,0.5);border:1px solid #CCC;border-radius:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.uneditable-input:focus,input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus,.filter_column input:focus,.filter_column select:focus,select:focus,textarea:focus{border-color:rgba(82,168,236,0.8);outline:0;outline:thin dotted 9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6)}.form-control{padding:7px 12px 5px}.form-control,.input-lg,.input-sm,.input-xs{border-radius:0!important}.input-xs{height:24px;padding:3px 10px 1px;font-size:11px;line-height:1.5}.fileinput{padding-top:3px}input[type=checkbox].checkbox,input[type=radio].radiobox{visibility:hidden;position:absolute;z-index:20;width:18px;height:18px}.checkbox input[type=checkbox].checkbox+span,.checkbox input[type=radio].radiobox+span,.checkbox-inline input[type=checkbox].checkbox+span,.checkbox-inline input[type=radio].radiobox+span,.radio input[type=checkbox].checkbox+span,.radio input[type=radio].radiobox+span,.radiobox-inline input[type=checkbox].checkbox+span,.radiobox-inline input[type=radio].radiobox+span{margin-left:-20px}.form-inline .checkbox input[type=checkbox].checkbox+span,.form-inline .checkbox input[type=radio].radiobox+span,.form-inline .checkbox-inline input[type=checkbox].checkbox+span,.form-inline .checkbox-inline input[type=radio].radiobox+span,.form-inline .radio input[type=checkbox].checkbox+span,.form-inline .radio input[type=radio].radiobox+span,.form-inline .radiobox-inline input[type=checkbox].checkbox+span,.form-inline .radiobox-inline input[type=radio].radiobox+span{margin-left:0}input[type=checkbox].checkbox+span,input[type=radio].radiobox+span,label input[type=checkbox].checkbox+span,label input[type=radio].radiobox+span{vertical-align:middle;line-height:20px}input[type=checkbox].checkbox+span,input[type=radio].radiobox+span,input[type=checkbox].checkbox+span:after,input[type=radio].radiobox+span:after,input[type=checkbox].checkbox:before,input[type=radio].radiobox:before{box-sizing:content-box!important;-webkit-box-sizing:content-box!important;-moz-box-sizing:content-box!important}label input[type=checkbox].checkbox+span,label input[type=radio].radiobox+span{position:relative;z-index:19;display:inline-block;margin:0;line-height:17px;min-height:14px;min-width:14px;margin-right:5px}label input[type=checkbox].checkbox+span:hover,label input[type=radio].radiobox+span:hover{cursor:pointer}label input[type=checkbox].checkbox+span:before,label input[type=radio].radiobox+span:before{font-family:FontAwesome;font-size:12px;border-radius:0;content:"\a0";display:inline-block;text-align:center;vertical-align:middle;padding:1px;height:12px;line-height:12px;min-width:12px;margin-right:5px;border:1px solid #bfbfbf;background-color:#f4f4f4;font-weight:400;margin-top:-1px}label input[type=checkbox].checkbox+span:before{content:"\a0"}label input[type=checkbox].checkbox:checked+span{font-weight:700}label input[type=checkbox].checkbox:checked+span:before{content:"\f00c";color:#2e7bcc}label input[type=checkbox].checkbox.style-1+span:before{color:#333;background:#fff;text-shadow:none;-webkit-box-shadow:none!important;box-shadow:none!important;border-width:1px;height:12px;line-height:13px;min-width:12px}label input[type=checkbox].checkbox.style-1:checked+span{font-weight:400}label input[type=checkbox].checkbox.style-1:checked+span:before{color:#333;border-color:#333}label input[type=checkbox].checkbox.style-2+span:before{background:0;border-color:#c1c1c1;-webkit-box-shadow:none;box-shadow:none}label input[type=checkbox].checkbox.style-2:checked+span{font-weight:400}label input[type=checkbox].checkbox.style-2:checked+span:before{content:"\f00c";color:#66665e;border-color:#4d90fe;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIFdpbmRvd3MiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MUQ0MEM4RUFEQUE4MTFFMkEwMjM5NzlCRjAxM0UwRjciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MUQ0MEM4RUJEQUE4MTFFMkEwMjM5NzlCRjAxM0UwRjciPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoxRDQwQzhFOERBQTgxMUUyQTAyMzk3OUJGMDEzRTBGNyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoxRDQwQzhFOURBQTgxMUUyQTAyMzk3OUJGMDEzRTBGNyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PsD/PVAAAAAQSURBVHjaYv7//78vQIABAAlYA05NMPppAAAAAElFTkSuQmCC) #fff}label input[type=checkbox].checkbox.style-3:checked+span:before{color:#fff;border-color:#a90329;background:#a90329}label:active input[type=checkbox].checkbox+span:before{-webkit-box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4);box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4)}label:hover input[type=checkbox].checkbox+span:before{color:#2e7bcc;border-color:#2e7bcc}label:hover input[type=checkbox].checkbox.style-1+span:before{border-color:#333}label:hover input[type=checkbox].checkbox.style-2+span:before{-webkit-box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.1),0 1px 0 0 rgba(255,255,255,0.2);box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.1),0 1px 0 0 rgba(255,255,255,0.2)}label:hover input[type=checkbox].checkbox.style-2:checked+span:before{-webkit-box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4);box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4)}label:hover input[type=checkbox].checkbox.style-3+span:before{color:#fff;border-color:#a90327}label:active input[type=checkbox].checkbox:checked+span:before{color:#fff;background:#2e7bcc;border-color:#2e7bcc}label:active input[type=checkbox].checkbox.style-1:checked+span:before{color:#fff;background:#333;border-color:#333}label:active input[type=checkbox].checkbox.style-2+span:before,label:active input[type=checkbox].checkbox.style-2:checked+span:before{color:#66665e;background:0;border-color:#c1c1c1;-webkit-box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4);box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4)}label:active input[type=checkbox].checkbox.style-3:checked+span:before{color:#a90329;background:#fff;border-color:#a90329}label input[type=checkbox][disabled].checkbox+span,label input[type=checkbox][disabled].checkbox:checked+span{color:#a7a7a7;cursor:not-allowed}label input[type=checkbox][disabled].checkbox:checked+span:before{content:"\f00c"}label input[type=checkbox][disabled].checkbox.style-2:checked+span:before{content:"\f00c"}label input[type=checkbox][disabled].checkbox+span:before,label input[type=checkbox][disabled].checkbox:checked+span:before,label input[type=checkbox][disabled].checkbox:checked+span:before{background:#eee!important;border-color:#CCC!important;-webkit-box-shadow:none;color:#a7a7a7;box-shadow:none!important}label:hover input[type=checkbox][disabled].checkbox:checked+span:before{color:#a7a7a7;cursor:not-allowed}label:hover input[type=checkbox][disabled].checkbox:checked+span:before{background:#eee!important;border-color:#CCC!important;-webkit-box-shadow:none;color:#a7a7a7;box-shadow:none!important}label input[type=radio].radiobox+span:before{content:"\a0";border-radius:50%;-webkit-box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.1),0 1px 0 0 rgba(255,255,255,0.2);box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.1),0 1px 0 0 rgba(255,255,255,0.2)}label input[type=radio].radiobox:checked+span{font-weight:700}label input[type=radio].radiobox:checked+span:before{content:"\f111";color:#2e7bcc}label input[type=radio].radiobox.style-1+span:before{font-size:9px;background:#fff;text-shadow:none;-webkit-box-shadow:none!important;box-shadow:none!important;border-width:1px;height:13px;line-height:13px;min-width:13px}label input[type=radio].radiobox.style-1:checked+span:before{font-size:10px;color:#333;border-color:#333;background:#fff}label input[type=radio].radiobox.style-1:checked+span{font-weight:400}label input[type=radio].radiobox.style-2:checked+span{font-weight:400}label input[type=radio].radiobox.style-2:checked+span:before{color:#66665e;border-color:#4d90fe;font-size:9px}label input[type=radio].radiobox.style-3:checked+span:before{color:#a90329;border-color:#a90329}label:hover input[type=radio].radiobox+span:before,label:hover input[type=radio].radiobox:checked+span:before{color:#2e7bcc;border-color:#2e7bcc}label:hover input[type=radio].radiobox.style-1+span:before,label:hover input[type=radio].radiobox.style-1:checked+span:before{color:#333;border-color:#333;background:#fff}label:hover input[type=radio].radiobox.style-2:checked+span:before{color:#66665e;border-color:#4d90fe}label:hover input[type=radio].radiobox.style-3+span:before,label:hover input[type=radio].radiobox.style-3:checked+span:before{color:#a90329;border-color:#a90329}label:active input[type=radio].radiobox+span:before{-webkit-box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4);box-shadow:inset 0 2px 3px 0 rgba(0,0,0,0.3),0 1px 0 0 rgba(255,255,255,0.4)}label input[type=radio][disabled].radiobox+span,label input[type=radio][disabled].radiobox:checked+span,label input[type=radio][disabled].radiobox:checked+span:before{color:#a7a7a7;cursor:not-allowed}label input[type=radio][disabled].radiobox:checked+span:before{content:"\f111"}label input[type=radio][disabled].radiobox+span:before,label input[type=radio][disabled].radiobox:checked+span:before{background:#eee!important;border-color:#CCC!important;-webkit-box-shadow:none;box-shadow:none;color:#a7a7a7}label:active input[type=radio][disabled].radiobox:checked+span:before,label:hover input[type=radio][disabled].radiobox:checked+span:before{background:#eee!important;border-color:#CCC!important;-webkit-box-shadow:none;box-shadow:none;color:#a7a7a7}textarea.clone{position:absolute;visibility:hidden}.textarea-div{background-color:#FFF;border:1px solid #CCC;border-bottom:0;margin:10px 0 0}.textarea-controls{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:5px;display:block;background-color:#FFF;border:1px solid #CCC;border-top:0;height:43px;line-height:33px;overflow:hidden}.textarea-controls>label{margin:3px 10px 0}.textarea-controls .ams-form .checkbox{padding-left:22px!important}.typearea{cursor:text;overflow-x:hidden;overflow-y:auto;max-height:90px;padding:5px 25px 5px 5px;position:relative;border-bottom:1px solid #EEE}.typearea textarea{width:100%;border-color:transparent!important;box-sizing:border-box;box-shadow:none;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-webkit-box-shadow:none;overflow:hidden;padding:0;margin:0;-webkit-transition:height .2s;transition:height .2s;outline:0;resize:none;min-height:61px}.error-box{max-width:900px;margin:0 auto}.error-text{font-weight:400;color:#fff;letter-spacing:-4px;font-size:700%;margin-bottom:30px;text-shadow:0 1px 0 #ccc,0 2px 0 #bfbfbf,0 3px 0 #bbb,0 4px 0 #b9b9b9,0 5px 0 #aaa,0 6px 1px rgba(0,0,0,0.1),0 0 5px rgba(0,0,0,0.1),0 1px 3px rgba(0,0,0,0.3),0 3px 5px rgba(0,0,0,0.2),0 5px 10px rgba(0,0,0,0.25),0 10px 10px rgba(0,0,0,0.2),0 20px 20px rgba(0,0,0,0.15)}.error-search{width:300px;margin:0 auto 20px}.error-icon-shadow{text-shadow:0 1px 0 #803838,0 2px 0 #a85d5d,0 3px 0 #b86565,0 4px 0 #d86f6f,0 5px 0 #b3a5a5,0 6px 1px rgba(131,51,51,0.1),0 0 5px rgba(102,30,30,0.1),0 1px 3px rgba(95,15,15,0.3),0 3px 5px rgba(100,23,23,0.2),0 5px 10px rgba(114,30,30,0.25),0 10px 10px rgba(94,15,15,0.2),0 20px 20px rgba(121,38,38,0.15)}.form-inline .checkbox,.form-inline .radiobox{padding-left:0}.ams-form{position:relative;margin:0;outline:0;color:#333}.ams-form *,.ams-form :after,.ams-form :before{margin:0;padding:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.ams-form header{display:block;padding:8px 0;border-bottom:1px dashed rgba(0,0,0,0.2);background:#fff;font-size:16px;font-weight:300;color:#232323;margin:10px 14px 0}.modal-dialog .ams-form header{margin:10px -2px 0 0}.ams-form fieldset{display:block;position:relative;padding:10px 15px 5px;border:0;background:rgba(255,255,255,0.9)}.ams-form fieldset[disabled]>section,.ams-form fieldset[disabled]>article,.ams-form fieldset[disabled]>div{opacity:.5}.ams-form fieldset[disabled] LEGEND.checker .checkbox{cursor:pointer}.ams-form fieldset.switched{margin-bottom:0!important}.ams-form fieldset.switched>section,.ams-form fieldset.switched>article,.ams-form fieldset.switched>div{display:none}.ams-form fieldset.switched legend{border-bottom:0}.ams-form fieldset.switched+fieldset{margin-top:0!important}.ams-form fieldset.bordered{margin:10px;border:1px solid rgba(192,192,192,0.8);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.ams-form fieldset.bordered.switched{border:1px solid transparent}.ams-form fieldset.bordered legend{width:auto;padding:3px 10px 1px;border:1px solid rgba(192,192,192,0.8);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.ams-form fieldset>fieldset.bordered{margin:10px 0}.ams-form fieldset+fieldset{border-top:1px solid rgba(0,0,0,0.1)}.ams-form legend{padding-top:10px}.ams-form legend.inner,.ams-form legend .inner{font-weight:300;font-size:14.5px!important}.ams-form legend.switcher{cursor:pointer}.ams-form legend.checker,.ams-form legend.switcher{font-weight:300;font-size:16.5px;border:0;padding-bottom:0}.ams-form legend.checker label[for],.ams-form legend.switcher label[for]{cursor:pointer}.ams-form legend .fa{color:#3276b1;font-size:75%}.ams-form legend .fa.fa-stack{font-size:100%;width:1em;height:1em;line-height:1em}.ams-form legend .hint{vertical-align:top;font-size:1em}.ams-form legend label.checkbox{display:inline-block;margin-bottom:0;min-height:18px}.ams-form legend label.checkbox i{position:absolute;left:3px;top:-1px}.ams-form>.modal-viewport>fieldset>legend{padding-top:0}.ams-form section{margin-bottom:10px;position:relative}.ams-form .form-group{padding:5px 10px}.ams-form.form-tight .form-group,.ams-form .form-tight .form-group{padding:1px 10px}.ams-form label.checkbox,.ams-form label.radio{padding-top:0}.ams-form label.input-file img.thumbnail{display:inline-block;margin:4px 10px 0 4px!important;padding:4px!important}.ams-form input.input-lg{height:44px;padding:10px 16px;font-size:17px;line-height:1.33}.ams-form input.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5}.ams-form input.input-xs{height:24px;padding:2px 10px;font-size:11px;line-height:1.5}.ams-form select.input-sm{height:30px;line-height:15px;font-size:12px}.ams-form select.input-sm+i{height:10px}.ams-form select.input-lg{height:44px;line-height:22px;font-size:17px}.ams-form select.input-lg+i{height:11px;top:17px}.ams-form .row{margin:0 -15px}.ams-form .row:after{display:table;content:'';clear:both}.ams-form .col-1{width:8.33%}.ams-form .col-2{width:16.66%}.ams-form .col-3{width:25%}.ams-form .col-4{width:33.33%}.ams-form .col-5{width:41.66%}.ams-form .col-6{width:50%}.ams-form .col-8{width:66.67%}.ams-form .col-9{width:75%}.ams-form .col-10{width:83.33%}.ams-form .col{float:left;min-height:1px;padding-right:15px;padding-left:15px;-webkit-box-sizing:border-box;box-sizing:border-box;-moz-box-sizing:border-box}@media screen and (max-width:600px){.ams-form .col{float:none;width:100%}}@media screen and (max-width:600px){.ams-form .col .label{text-align:left;padding-left:20px}}.ams-form footer{display:block;padding:7px 25px 15px;border-top:1px solid rgba(0,0,0,0.1);background:rgba(248,248,248,0.9)}.ams-form footer:after{display:table;clear:both;content:''}.ams-form footer .btn{float:right;height:31px;margin:10px 0 0 5px;padding:0 22px;font:300 15px/29px Ubuntu,Helvetica,Arial,sans-serif;cursor:pointer}.ams-form footer .btn.btn-info{float:left}.ams-form footer .submit-message{display:inline-block}.ams-form .message{display:none;color:#6fb679}.ams-form .message i{display:block;margin:0 auto 20px;width:81px;height:81px;border:1px solid #6fb679;border-radius:50%;font-size:30px;line-height:81px}.ams-form.submitted fieldset,.ams-form.submitted footer{display:none}.ams-form.submitted .message{display:block;padding:25px 30px;background:rgba(255,255,255,0.9);font:300 18px/27px Ubuntu,Helvetica,Arial,sans-serif;text-align:center}.ams-form .note{margin-top:6px;padding:0 1px;font-size:11px;line-height:15px;color:#999}.ams-form .note a{font-size:13px}.ams-form .note-success{color:#6fb679}.ams-form .control-label{display:block;margin-top:4px;margin-bottom:6px;padding-top:0;line-height:19px;font-weight:400;font-size:13px;color:#666;text-align:right}@media screen and (max-width:992px){.ams-form .control-label{text-align:left;margin-bottom:0}}.ams-form .control-label.col{text-align:right}@media screen and (max-width:600px){.ams-form .control-label.col{text-align:left;padding-left:20px}}.ams-form .control-label span{margin-right:10px}.ams-form .control-label span::after{content:" *";color:transparent}.ams-form .control-label span>.hint{margin-top:-2px}.ams-form .control-label .col{margin:0;padding-top:7px}.ams-form label.input span.textline-field{display:block;margin-top:4px;margin-bottom:6px;padding-top:0;line-height:19px;font-size:13px}.ams-form .required-field .control-label span::after{color:red}.ams-form .tooltip{position:absolute;z-index:99999;left:-9999px;padding:2px 8px 3px;font-size:11px;line-height:16px;font-weight:400;background:rgba(0,0,0,0.9);color:#fff;opacity:0;transition:margin .3s,opacity .3s;-webkit-transition:margin .3s,opacity .3s}.ams-form .tooltip:after{position:absolute;content:''}.ams-form .tooltip-top-right{bottom:100%;margin-bottom:15px}.ams-form .tooltip-top-right:after{top:100%;right:11px;border-top:4px solid rgba(0,0,0,0.9);border-right:4px solid transparent;border-left:4px solid transparent}.ams-form .input input:focus+.tooltip-top-right,.ams-form .textarea textarea:focus+.tooltip-top-right{right:0;left:auto;margin-bottom:5px}.ams-form .tooltip-top-left{bottom:100%;margin-bottom:15px}.ams-form .tooltip-top-left:after{top:100%;left:11px;border-top:4px solid rgba(0,0,0,0.9);border-right:4px solid transparent;border-left:4px solid transparent}.ams-form .input input:focus+.tooltip-top-left,.ams-form .textarea textarea:focus+.tooltip-top-left{right:auto;left:0;margin-bottom:5px}.ams-form .tooltip-right{top:4px;white-space:nowrap;margin-left:15px}.ams-form .tooltip-right:after{top:6px;right:100%;border-top:4px solid transparent;border-right:4px solid rgba(0,0,0,0.9);border-bottom:4px solid transparent}.ams-form .input input:focus+.tooltip-right,.ams-form .textarea textarea:focus+.tooltip-right{left:100%;margin-left:5px}.ams-form .tooltip-left{top:4px;white-space:nowrap;margin-right:15px}.ams-form .tooltip-left:after{top:6px;left:100%;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid rgba(0,0,0,0.9)}.ams-form .input input:focus+.tooltip-left,.ams-form .textarea textarea:focus+.tooltip-left{right:100%;left:auto;margin-right:5px}.ams-form .tooltip-bottom-right{top:100%;margin-top:15px}.ams-form .tooltip-bottom-right:after{bottom:100%;right:11px;border-right:4px solid transparent;border-bottom:4px solid rgba(0,0,0,0.9);border-left:4px solid transparent}.ams-form .input input:focus+.tooltip-bottom-right,.ams-form .textarea textarea:focus+.tooltip-bottom-right{right:0;left:auto;margin-top:5px}.ams-form .tooltip-bottom-left{top:100%;margin-top:15px}.ams-form .tooltip-bottom-left:after{bottom:100%;left:11px;border-right:4px solid transparent;border-bottom:4px solid rgba(0,0,0,0.9);border-left:4px solid transparent}.ams-form .input input:focus+.tooltip-bottom-left,.ams-form .textarea textarea:focus+.tooltip-bottom-left{right:auto;left:0;margin-top:5px}.ams-form .inline-group{margin:0 -30px -4px 0}.ams-form .inline-group:after{content:'';display:table;clear:both}.ams-form .inline-group .checkbox,.ams-form .inline-group .radio{float:left;margin-right:30px}.ams-form .inline-group .checkbox:last-child,.ams-form .inline-group .radio:last-child{margin-bottom:4px}.ams-form .input .inline-group{margin:0 0 -4px 0}.ams-form .btn{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.ams-form .button{float:right;height:31px;overflow:hidden;margin:10px 0 0 5px;padding:0 25px;outline:0;border:0;font:300 15px/31px Ubuntu,Helvetica,Arial,sans-serif;text-decoration:none;color:#fff;cursor:pointer;background-color:#3276b1;opacity:.8;transition:opacity .2s;-webkit-transition:opacity .2s}.ams-form .button:hover{opacity:1}.ams-form .button.button-secondary{background-color:#b3b3b3}.ams-form .button,.ams-form .checkbox,.ams-form .input,.ams-form .radio,.ams-form .select,.ams-form .textarea,.ams-form .toggle{display:block;position:relative;font-weight:400}.ams-form .input input,.ams-form .select select,.ams-form .textarea textarea{display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;width:100%;height:28px;padding:6px 8px;outline:0;border-width:1px;border-style:solid;border-radius:0;background:#fff;font:13px/16px Ubuntu,Helvetica,Arial,sans-serif;color:#404040;appearance:normal;-moz-appearance:none;-webkit-appearance:none}.ams-form .input input[readonly],.ams-form .select select[readonly],.ams-form .textarea textarea[readonly]{border-bottom:1px solid #ccc!important}.ams-form .input input.display-mode,.ams-form .select select.display-mode,.ams-form .textarea textarea.display-mode{border:0;padding:0;margin-top:2px;margin-bottom:3px;height:14px;line-height:1em}.ams-form .input span.textarea-widget,.ams-form .textarea span.textarea-widget{display:block;width:100%;min-height:14px;padding:4px 0;border-bottom:1px solid #ccc!important}.ams-form .input .i18n-content input[readonly],.ams-form .select .i18n-content select[readonly],.ams-form .textarea .i18n-content textarea[readonly]{border-width:0!important}.ams-form .input .i18n-content .textarea-widget{display:block;min-height:12px}.ams-form .input input:focus+.tooltip,.ams-form .textarea textarea:focus+.tooltip{opacity:1}.ams-form .input .icon-prepend+input,.ams-form .textarea .icon-prepend+textarea{padding-left:37px}.ams-form .input .icon-append+input,.ams-form .textarea .icon-append+textarea{padding-right:37px}.ams-form .input .icon-prepend+.icon-append+input,.ams-form .textarea .icon-prepend+.icon-append+textarea{padding-left:37px}.ams-form .input.with-icons .icon-append-2+input{padding-right:60px}.ams-form .input-file{position:relative}.ams-form .input-file .button{position:absolute;top:3px;right:3px;float:none;height:22px;margin:0;padding:0 14px;font-size:13px;line-height:22px}.ams-form .input-file .button:hover{-webkit-box-shadow:none;box-shadow:none}.ams-form .input-file .button input{position:absolute;top:0;right:0;padding:0;font-size:30px;cursor:pointer;opacity:0}.ams-form .select select{padding:5px}.ams-form .select i{position:absolute;top:9px;right:11px;width:5px;height:11px;background:#fff}.ams-form .select i:before,.ams-form .select i:after{content:'';position:absolute;right:0;border-right:4px solid transparent;border-left:4px solid transparent}.ams-form .select i:before{top:0;border-bottom:4px solid #404040}.ams-form .select i:after{bottom:0;border-top:4px solid #404040}.ams-form .select-widget .selected-option{display:inline-block;padding:4px 8px}.ams-form .select-multiple select{height:auto}.ams-form .textarea textarea{height:auto;resize:none}.ams-form .textarea-resizable textarea{resize:vertical}.ams-form .textarea-expandable textarea{height:31px}.ams-form .textarea-expandable textarea:focus{height:auto}.ams-form .checkbox,.ams-form .radio{margin-bottom:4px;padding-left:25px;line-height:25px;color:#404040;cursor:pointer;font-size:13px}.ams-form .checkbox:last-child,.ams-form .radio:last-child{margin-bottom:0}.ams-form .checkbox i,.ams-form .radio i{display:block;position:absolute;top:3px;left:0;width:17px;height:17px;outline:0;border-width:1px;border-style:solid;background:#FFF}.ams-form .checkbox input,.ams-form .radio input{position:absolute;left:-9999px}.ams-form .checkbox input+i:after,.ams-form .radio input+i:after{position:absolute;opacity:0;transition:opacity .1s;-webkit-transition:opacity .1s}.ams-form .checkbox input:checked+i:after,.ams-form .radio input:checked+i:after{opacity:1}.ams-form .radio input+i:after{background-color:#3276b1}.ams-form .checkbox input+i:after{content:'\f00c';top:-1px;left:1px;width:15px;height:15px;font:400 16px/19px FontAwesome;text-align:center}.ams-form .checkbox input+i:after{color:#3276b1}.ams-form .checkbox input:checked:hover+i:after{content:'\f00d'}.ams-form .checkbox input:checked:disabled:hover+i:after{content:'\f00c'}.ams-form .radio input+i:after{content:'';top:4px;left:4px;width:9px;height:9px;border-radius:50%}.ams-form .checkbox+.checkbox,.ams-form .radio+.radio{margin-top:0}.ams-form.table td .checkbox i,.ams-form.table td .radio i,.ams-form.table th .checkbox i,.ams-form.table th .radio i{top:0!important}.ams-form .inner .checkbox{min-height:13px}.ams-form .inner .checkbox i{width:13px;height:13px}.ams-form .inner .checkbox input+i:after{width:11px;height:11px;font:300 12px/16px FontAwesome}.ams-form .toggle{margin-bottom:4px;padding-right:61px;font-size:15px;line-height:25px;color:#404040;cursor:pointer}.ams-form .toggle:last-child{margin-bottom:0}.ams-form .toggle.state-error input:checked+i{background:#fff0f0}.ams-form .toggle.state-success input:checked+i{background:#f0fff0}.ams-form .toggle input{position:absolute;left:-9999px}.ams-form .toggle input:checked+i:before{right:36px}.ams-form .toggle input:checked+i:after{content:attr(data-swchon-text);text-align:right}.ams-form .toggle i{display:block;position:absolute;content:'';top:4px;right:0;width:49px;height:17px;border-width:1px;border-style:solid;border-radius:12px;background:#fff}.ams-form .toggle i:before{display:block;position:absolute;content:'';z-index:1;top:4px;right:4px;width:9px;height:9px;border-radius:50%;opacity:1;transition:right .2s;-webkit-transition:right .2s;background-color:#3276b1}.ams-form .toggle i:after{position:absolute;content:attr(data-swchoff-text);top:2px;right:8px;left:8px;font-style:normal;font-size:9px;line-height:17px;font-weight:700;text-align:left;color:#5f5f5f}.ams-form .checkbox:hover i,.ams-form .radio:hover i,.ams-form .toggle:hover i{-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.1);box-shadow:inset 0 1px 1px rgba(0,0,0,0.1)}.ams-form .checkbox:active i,.ams-form .radio:active i,.ams-form .toggle:active i{background:#f0f0f0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.1);box-shadow:inset 0 1px 1px rgba(0,0,0,0.1)}.ams-form .checkbox input:checked+i,.ams-form .radio input:checked+i,.ams-form .toggle input:checked+i{border-color:#3276b1}.ams-form .rating{margin-bottom:4px;font-size:13px;line-height:25px;color:#404040}.ams-form .rating:last-child{margin-bottom:0}.ams-form .rating.state-error+em{margin-top:-4px;margin-bottom:4px}.ams-form .rating input{position:absolute;left:-9999px}.ams-form .rating input+label:hover,.ams-form .rating input+label:hover ~ label{color:#3276b1}.ams-form .rating input:checked ~ label{color:#3276b1}.ams-form .rating label{display:block;float:right;height:17px;margin-top:5px;padding:0 2px;font-size:17px;line-height:17px;cursor:pointer;color:#ccc;transition:color .3s;-webkit-transition:color .3s}.ams-form .icon-append,.ams-form .icon-prepend{position:absolute;top:4px;width:20px;height:20px;font-size:14px;line-height:20px;text-align:center;color:#a2a2a2}.ams-form .icon-append.fa-stack .fa-stack-2x,.ams-form .icon-prepend.fa-stack .fa-stack-2x{font-size:1.6em;left:1px}.ams-form .icon-append.fa-stack .fa-stack-1x,.ams-form .icon-prepend.fa-stack .fa-stack-1x{left:1px;top:1px}.ams-form .icon-append{right:4px;padding-left:2px;border-left-width:1px;border-left-style:solid}.ams-form .icon-append-2{right:31px}.ams-form .icon-prepend{left:4px;padding-right:2px;border-right-width:1px;border-right-style:solid}.ams-form .icon-prepend-2{left:31px}.ams-form .checkbox i,.ams-form .icon-append,.ams-form .icon-prepend,.ams-form .input input,.ams-form .radio i,.ams-form .select select,.ams-form .textarea textarea,.ams-form .toggle i{border-color:#ccc;transition:border-color .3s;-webkit-transition:border-color .3s}.ams-form .input.bordered:hover,.ams-form .checkbox:hover i,.ams-form .input:hover input,.ams-form .radio:hover i,.ams-form .select:hover select,.ams-form .textarea:hover textarea,.ams-form .toggle:hover i{border-color:rgba(82,168,236,0.7)}.ams-form .checkbox input:focus+i,.ams-form .input input:focus,.ams-form .radio input:focus+i,.ams-form .select select:focus,.ams-form .textarea textarea:focus,.ams-form .toggle input:focus+i{border-color:rgba(82,168,236,0.7);outline:0;outline:thin dotted 9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.7);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.7);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.7)}.ams-form .checkbox.state-error i,.ams-form .radio.state-error i,.ams-form .state-error input,.ams-form .state-error select,.ams-form .state-error textarea,.ams-form .toggle.state-error i{background:#fff0f0;border-color:rgba(255,60,60,0.8)!important}.ams-form .checkbox.state-error i:focus,.ams-form .radio.state-error i:focus,.ams-form .state-error input:focus,.ams-form .state-error select:focus,.ams-form .state-error textarea:focus,.ams-form .toggle.state-error i:focus{-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(255,60,60,0.6)!important;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(255,60,60,0.6)!important;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(255,60,60,0.6)!important}.ams-form .state-error .select2-container .select2-choice,.ams-form .state-error .select2-container .select2-choices{border-color:rgba(255,60,60,0.8)!important}.ams-form .state-error .select2-container .select2-choice:focus,.ams-form .state-error .select2-container .select2-choices:focus{-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(255,60,60,0.6)!important;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(255,60,60,0.6)!important;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(255,60,60,0.6)!important}.ams-form .checkbox.state-success i,.ams-form .radio.state-success i,.ams-form .state-success input,.ams-form .state-success select,.ams-form .state-success textarea,.ams-form .toggle.state-success i{background:#f0fff0;border-color:#7dc27d}.ams-form .button.state-disabled,.ams-form .checkbox.state-disabled,.ams-form .input.state-disabled input,.ams-form .radio.state-disabled,.ams-form .select.state-disabled,.ams-form .textarea.state-disabled,.ams-form .toggle.state-disabled{cursor:default!important;opacity:.6!important}.ams-form .checkbox.state-disabled:hover i,.ams-form .input.state-disabled:hover input,.ams-form .radio.state-disabled:hover i,.ams-form .select.state-disabled:hover select,.ams-form .textarea.state-disabled:hover textarea,.ams-form .toggle.state-disabled:hover i{border-color:#e5e5e5!important}.ams-form .state-disabled.checkbox input+i:after,.ams-form .state-disabled.checkbox input:checked+i,.ams-form .state-disabled.radio input+i:after,.ams-form .state-disabled.radio input:checked+i,.ams-form .state-disabled.toggle input:checked+i{border-color:#e5e5e5!important;color:#333!important}.ams-form .ui-widget-content .ui-spinner-input{margin:0;border:0;-webkit-box-shadow:none!important;box-shadow:none!important;height:29px}.ams-form .state-error{color:#d56161}.ams-form .state-error select+i{background:#fff0f0;-webkit-box-shadow:0 0 0 9px #fff0f0;box-shadow:0 0 0 9px #fff0f0}.ams-form .state-error+em{display:block;margin-top:6px;padding:0 1px;font-style:normal;font-size:11px;line-height:15px;color:#d56161}.ams-form .state-success select+i{background:#f0fff0;-webkit-box-shadow:0 0 0 9px #f0fff0;box-shadow:0 0 0 9px #f0fff0}.ams-form .state-disabled.radio input+i:after{background-color:#333}.ams-form .form-tiny .form-group{padding:0 10px}.ams-form .form-tiny .control-label{margin-top:2px;margin-bottom:3px;line-height:14px}.ams-form .form-tiny label.input span.textline-field{margin-top:2px;margin-bottom:3px;line-height:14px}.ams-form .form-nomargin .control-label,.ams-form.form-nomargin .control-label{margin-top:0;margin-bottom:0}.ams-form .form-nomargin label.input span.textline-field,.ams-form.form-nomargin label.input span.textline-field{margin-top:0;margin-bottom:0}.ams-form .form-nopadding .form-group,.ams-form.form-nopadding .form-group{padding:0 10px 1px}.ams-form-modal{position:fixed;z-index:1;display:none;width:400px}.ams-form-modal-overlay{position:fixed;top:0;left:0;display:none;width:100%;height:100%;background:rgba(0,0,0,0.7)}.state-error .icon-append,.state-error .icon-prepend{color:#ed1c24}.editableform{margin-bottom:0}.editableform .control-group{margin-bottom:0;white-space:nowrap}.editableform .editable-date{padding:0;margin:0;float:left}.editableform-loading{background:url(../img/loading.gif) center center no-repeat;height:25px;width:auto;min-width:25px}.editable-buttons{display:inline-block;vertical-align:top;margin-left:7px;zoom:1;*display:inline}.editable-buttons.editable-buttons-bottom{display:block;margin-top:7px;margin-left:0}.editable-buttons .editable-cancel{margin-left:7px}.editable-buttons button.ui-button-icon-only{height:24px;width:30px}.editable-inline .add-on .icon-th{margin-top:3px;margin-left:1px}.editable-inline .editableform-loading{background-position:left 5px}.editable-input{vertical-align:top;display:inline-block;width:auto;white-space:normal;zoom:1;*display:inline}.editable-input .datepicker{top:0;left:0;padding:4px}.editable-input .datepicker: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}.editable-input .datepicker:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;position:absolute;top:-6px;left:7px}.editable-input .datepicker>div{display:none}.editable-input .datepicker table{width:100%;min-width:214px;margin:0}.editable-input .datepicker thead tr:first-child th{cursor:pointer}.editable-input .datepicker thead tr:first-child th:hover{background:#eee}.editable-input .datepicker td,.editable-input .datepicker th{text-align:center;width:24px;height:20px}.editable-input .datepicker th.switch{width:145px}.editable-input .datepicker th.next,.editable-input .datepicker th.prev{font-size:19.5px}.editable-input .datepicker td span{display:block;width:47px;height:54px;line-height:54px;float:left;margin:2px;cursor:pointer}.editable-input .datepicker td span:hover{background:#eee}.editable-input .datepicker td span.active{background:#3276b1;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);border-radius:3px}.editable-input .datepicker td span.old{color:#555}.editable-input .datepicker td.day:hover{background:#eee;cursor:pointer}.editable-input .datepicker td.day.disabled,.editable-input .datepicker td.new,.editable-input .datepicker td.old{color:#555}.editable-input .datepicker td.active,.editable-input .datepicker td.active:hover{background:#3276b1;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);border-radius:3px}.editable-input .datepicker.prev i,.editable-input .datepicker.next i{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:14px}.editable-input .datepicker.prev i:before{content:"\f060"}.editable-input .datepicker.next i:before{content:"\f061"}.editable-checklist label{white-space:nowrap}.editable-checklist label input[type=checkbox],.editable-checklist label span{vertical-align:middle;margin:0}.editable-wysihtml5{width:566px;height:250px}.editable-pre-wrapped{white-space:pre-wrap}.editable-container.editable-popup{max-width:none!important}.editable-container.popover{width:auto}.editable-container.editable-inline{display:inline-block;vertical-align:middle;width:auto;zoom:1;*display:inline}.editable-container.ui-widget{font-size:inherit;z-index:9990}.editable-click,a.editable-click,a.editable-click:hover{text-decoration:none;border-bottom:dashed 1px #08c}.editable-click.editable-disabled,a.editable-click.editable-disabled,a.editable-click.editable-disabled:hover{color:#585858;cursor:default;border-bottom:0}.editable-empty,.editable-empty:focus,.editable-empty:hover{font-style:italic;color:#D14;text-decoration:none}.editable-unsaved{font-weight:700}.editable-bg-transition{-webkit-transition:background-color 1400ms ease-out;transition:background-color 1400ms ease-out}.form-horizontal .editable{padding-top:5px;display:inline-block}.editable-address{display:block;margin-bottom:5px}.editable-address span{width:70px;display:inline-block}.editable-clear{clear:both;font-size:.9em;text-decoration:none;text-align:right}.editable-clear-x{background:url(../img/clear.png) center center no-repeat;display:block;width:13px;height:13px;position:absolute;opacity:.6;z-index:100;top:50%;right:6px;margin-top:-6px}.editable-clear-x:hover{opacity:1}.editable-error-block{max-width:300px;margin:5px 0 0;width:auto;white-space:normal}.editable-error-block.ui-state-error{padding:3px}.editable-error{color:red}.input-append.date .add-on i,.input-prepend.date .add-on i{display:block;cursor:pointer;width:16px;height:16px}.ui-timepicker-div .ui-widget-header{margin-bottom:8px}.ui-timepicker-div dl{text-align:left}.ui-timepicker-div dl dt{float:left;clear:left;padding:0 0 0 5px}.ui-timepicker-div dl dd{margin:17px 10px 12px 40%}.ui-timepicker-div td{font-size:90%}.ui-tpicker-grid-label{background:0;border:0;margin:0;padding:0}.ui-timepicker-rtl{direction:rtl}.ui-timepicker-rtl dl{text-align:right;padding:0 5px 0 0}.ui-timepicker-rtl dl dt{float:right;clear:right}.ui-timepicker-rtl dl dd{margin:0 40% 10px 10px}#login{background:#fff;overflow:visible}#login .container{border:0}#login #header{margin:0;height:71px;border-bottom:1px solid #eee!important;overflow:hidden;padding:0 30px;-webkit-background-clip:padding-box;border-width:0;min-height:28px;background:#f4f4f4!important;margin-bottom:20px}@media(min-width:768px) and (max-width:880px){#login #header{padding:0 5px!important}}@media only screen and (min-width:0) and (max-width:679px){#login #header{padding:0 5px!important}}#login #header #logo{margin-top:22px;margin-left:0}@media only screen and (min-width:0) and (max-width:679px){#login #header #logo{margin-top:22px}}#login #header #logo img{width:137px}@media only screen and (min-width:0) and (max-width:679px){#login #header #logo img{width:135px}}#login-header-space{float:right;text-align:right;display:block;vertical-align:middle;line-height:71px}#login-header-space>:first-child{font-size:13px;margin-right:14px;vertical-align:-3px;font-weight:400}#login-header-space>*{display:inline-block}#login-header-space .btn{font-weight:700;text-transform:uppercase}#login #main{background:#fff;margin:0}#login .hero{background-image:url(../img/gradient/login.png);background-repeat:no-repeat;background-position:0 137px;height:360px;width:100%;float:left}#login h4.paragraph-header{color:#565656;font-size:15px;font-weight:400;line-height:22px;margin-top:15px;width:270px}#login h5.about-heading{color:#565656;font-size:15px;font-weight:700;line-height:24px;margin:0 0 5px}#login .login-header-big{font-weight:400}#login .login-desc-box-l{min-height:350px;width:50%}#login .login-app-icons{vertical-align:top;margin-top:90px;width:300px}.bootstrapWizard{display:block;list-style:none;padding:0;position:relative;width:100%}.bootstrapWizard a:active,.bootstrapWizard a:focus,.bootstrapWizard a:hover{text-decoration:none}.bootstrapWizard li{display:block;float:left;width:25%;text-align:center;padding-left:0}.bootstrapWizard li:before{border-top:3px solid #55606e;content:"";display:block;font-size:0;overflow:hidden;position:relative;top:11px;right:1px;width:100%;z-index:1}.bootstrapWizard li:first-child:before{left:50%;max-width:50%}.bootstrapWizard li:last-child:before{max-width:50%;width:50%}.bootstrapWizard li .step{background:#b2b5b9;color:#fff;display:inline;font-size:15px;font-weight:700;padding:7px 13px;border:3px solid transparent;border-radius:50%;line-height:normal;position:relative;text-align:center;z-index:2;-webkit-transition:all .1s linear 0s;transition:all .1s linear 0s}.bootstrapWizard li .step i{font-size:10px;font-weight:400;position:relative;top:-1.5px}.bootstrapWizard li.complete .step{background:#0aa66e;padding:1px 6px;border:3px solid #55606e}.bootstrapWizard li.active .step,.bootstrapWizard li.active.complete .step{background:#0091d9;color:#fff;font-weight:700;padding:7px 13px;font-size:15px;border-radius:50%;border:3px solid #55606e}.bootstrapWizard li .title{color:#bfbfbf;display:block;font-size:13px;line-height:15px;max-width:100%;position:relative;table-layout:fixed;text-align:center;top:20px;word-wrap:break-word;z-index:104}.bootstrapWizard li.active .title,.bootstrapWizard li.complete .title{color:#2b3d53}.wizard-actions{display:block;list-style:none;padding:0;position:relative;width:100%}.wizard-actions li{display:inline}.fuelux .wizard{position:relative;overflow:hidden;background-color:#f9f9f9;border:1px solid #d4d4d4;border-radius:4px;*zoom:1;-webkit-box-shadow:0 1px 4px rgba(0,0,0,0.065);box-shadow:0 1px 4px rgba(0,0,0,0.065)}.fuelux .wizard:after,.fuelux .wizard:before{display:table;line-height:0;content:""}.fuelux .wizard:after{clear:both}.fuelux .wizard ul{width:4000px;padding:0;margin:0;list-style:none outside none}.fuelux .wizard ul.previous-disabled li.complete{cursor:default}.fuelux .wizard ul.previous-disabled li.complete:hover{color:#356e35;cursor:default;background:#f3f4f5}.fuelux .wizard ul.previous-disabled li.complete:hover .chevron:before{border-left-color:#f3f4f5}.fuelux .wizard ul li{position:relative;float:left;height:46px;padding:0 20px 0 30px;margin:0;font-size:16px;line-height:46px;color:#999;cursor:default;background:#ededed}.fuelux .wizard ul li:first-child{padding-left:20px;border-radius:4px 0 0 4px}.fuelux .wizard ul li.complete{color:#296829;background:#f3f4f5}.fuelux .wizard ul li.complete:hover{cursor:pointer;background:#e7eff8}.fuelux .wizard ul li.complete:hover .chevron:before{border-left:14px solid #e7eff8}.fuelux .wizard ul li.complete .chevron:before{border-left:14px solid #f3f4f5}.fuelux .wizard ul li.active{color:#3a87ad;background:#f1f6fc}.fuelux .wizard ul li.active .chevron:before{border-left:14px solid #f1f6fc}.fuelux .wizard ul li .chevron{position:absolute;top:0;right:-14px;z-index:1;display:block;border:24px solid transparent;border-right:0;border-left:14px solid #d4d4d4}.fuelux .wizard ul li .chevron:before{position:absolute;top:-24px;right:1px;display:block;border:24px solid transparent;border-right:0;border-left:14px solid #ededed;content:""}.fuelux .wizard ul li .badge{margin-right:8px}.fuelux .wizard .actions{position:absolute;right:0;z-index:2;float:right;padding-right:15px;padding-left:15px;line-height:46px;vertical-align:middle;background-color:#eee;border-left:1px solid #d4d4d4}.fuelux .wizard .actions a{margin-right:8px;font-size:12px;line-height:45px}.fuelux .wizard .actions .btn-prev i{margin-right:5px}.fuelux .wizard .actions .btn-next i{margin-left:5px}.fuelux .fuelux .step-content .step-pane{display:none}.fuelux .fuelux .step-content .active{display:block}.fuelux .fuelux .step-content .active .btn-group .active{display:inline-block}.ams-metro-tile{float:left;display:block;background-color:#fff;width:100px;height:70px;cursor:pointer;-webkit-box-shadow:inset 0 0 1px #FFC;box-shadow:inset 0 0 1px #FFC;border:1px dotted #c5c5c5;text-decoration:none;color:#fff;font-weight:300;font-smooth:always;margin:0 10px 20px 0;padding:5px;position:relative}.ams-metro-tile:hover{z-index:10;-webkit-transform:scale(1.07);-moz-transform:scale(1.07)}.ams-metro-tile.big-cubes{width:120px;height:120px}.ams-metro-tile.double{width:249px}.ams-metro-tile:active{top:1px;left:1px}.ams-metro-tile .iconbox{text-align:center}.ams-metro-tile .iconbox i{display:block;margin:15px auto 0;height:75px}.ams-metro-tile .iconbox span{display:block;text-align:left;line-height:1em}.ams-metro-tile .iconbox span>span{position:absolute;right:-5px;bottom:-10px;border-radius:50%;padding:6px 4px 3px;border:1px solid #fff}.mce-edit-area>iframe{min-height:400px!important}.client-form header{padding:15px 13px;margin:0;border-bottom-style:solid;border-bottom-color:rgba(0,0,0,0.1);background:rgba(248,248,248,0.9)}.customfile-button{padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid #ccc;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.btn,a:link,button{-webkit-tap-highlight-color:rgba(169,3,41,0.5)}button{background-color:#ddd}button:hover{background-color:#ccc}.btns{margin:0;padding:0;list-style:none}.btns>li{display:inline-block;margin-bottom:7px}.btn{padding:6px 12px;border-radius:2px;box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05);-webkit-box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05)}.btn-toolbar .btn{padding:4px}.btn:active{position:relative;top:1px;left:1px}.btn.btn-ribbon{background-color:#5b6771;color:#fff;padding:1px 5px;line-height:20px;vertical-align:middle;height:21px;display:block;border:0;float:left;margin:0 8px 0 0;cursor:pointer}.btn.btn-ribbon>i{font-size:111%}.btn-xs{padding:1px 5px;line-height:1.3em}.btn-sm{padding:3px 10px}.btn-lg{padding:9px 15px}.btn-xl{padding:11px 15px}.btn-circle{width:30px;height:30px;text-align:center;padding:7px 0 5px;font-size:12px;line-height:18px;border-radius:50%}.btn-circle.btn-lg{width:50px;height:50px;padding:9px 15px 7px;font-size:18px;line-height:30px;border-radius:50%}.btn-circle.btn-xl{width:70px;height:70px;padding:11px 15px 9px;font-size:24px;line-height:50px;border-radius:50%}.btn-metro{margin:0 0 20px;padding-top:15px;padding-bottom:15px}.btn-metro>span{display:block;vertical-align:bottom;margin-top:10px;text-transform:uppercase}.btn-metro>span>span.label{position:absolute;top:0;right:0}.btn-label{position:relative;left:-12px;display:inline-block;padding:7px 12px 5px;background:rgba(0,0,0,0.15);border-radius:3px 0 0 3px}.btn-labeled{padding-top:0;padding-bottom:0}.btn-select-tick i{display:none}.btn-select-tick .btn:hover i{opacity:.3;display:block}.btn-select-tick .active i{display:block;opacity:1!important}.btn-header.pull-right{margin-left:6px}@media(min-width:768px) and (max-width:979px){.btn-header a{margin-top:9px!important}}@media(min-width:768px) and (max-width:880px){.btn-header a{margin-top:9px!important;line-height:26px!important}}@media(max-width:767px){.btn-header a{margin-top:5px!important;width:40px!important;height:39px!important;line-height:34px!important}}@media only screen and (min-width:0) and (max-width:679px){.btn-header a{margin-top:5px!important;width:40px!important;height:39px!important;line-height:34px!important}}@media only screen and (min-width:320px) and (max-width:479px){.btn-header a{margin-top:5px!important;width:40px!important;height:39px!important;line-height:34px!important}}.btn-header a>span{font-size:13px;font-weight:400;line-height:30px;height:30px;display:inline-block}@media(min-width:768px) and (max-width:880px){.btn-header.transparent a{border:0!important;background:0;margin-left:0;width:25px!important;-webkit-box-shadow:none!important;box-shadow:none!important}.btn-header.transparent a:hover{color:#a90329}}@media(max-width:767px){.btn-header.transparent a:hover{color:#a90329}}@media only screen and (min-width:0) and (max-width:679px){.btn-header.transparent a{border:0!important;background:0;margin-left:0;width:25px!important;-webkit-box-shadow:none!important;box-shadow:none!important}.btn-header.transparent a:hover{color:#a90329}}@media only screen and (min-width:320px) and (max-width:479px){.btn-header.transparent a{border:0!important;background:0;margin-left:0;width:25px!important;-webkit-box-shadow:none!important;box-shadow:none!important}.btn-header.transparent a:hover{color:#a90329}}.btn-header>:first-child>a{border-radius:2px;cursor:default!important;display:inline-block;font-weight:700;height:30px;min-width:30px;padding:3px;text-align:center;text-decoration:none!important;-moz-user-select:none;-webkit-user-select:none;background-color:#f8f8f8;background-image:-webkit-gradient(linear,left top,left bottom,from(#f8f8f8),to(#f1f1f1));background-image:-webkit-gradient(linear,top left,bottom left,from(#f8f8f8),to(#f1f1f1));background-image:-webkit-linear-gradient(top,#f8f8f8,#f1f1f1);background-image:linear-gradient(top,#f8f8f8,#f1f1f1);border:1px solid #bfbfbf;color:#6d6a69;font-size:17px;margin:10px 0 0}.btn-header>:first-child>a:hover{border:1px solid #bfbfbf;color:#222;-webkit-transition:all 0s;transition:all 0s;cursor:pointer;-webkit-box-shadow:inset 0 0 4px 1px rgba(0,0,0,0.08);box-shadow:inset 0 0 4px 1px rgba(0,0,0,0.08)}.btn-header>:first-child>a:active{background-color:#e8e8e8;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#e8e8e8),color-stop(100%,#ededed));background-image:-webkit-gradient(linear,top left,bottom left,from(#e8e8e8),to(#ededed));background-image:-webkit-linear-gradient(top,#e8e8e8 0,#ededed 100%);background-image:linear-gradient(to bottom,#e8e8e8 0,#ededed 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e8e8e8',endColorstr='#ededed',GradientType=0);-webkit-box-shadow:inset 0 0 3px 1px rgba(0,0,0,0.15);box-shadow:inset 0 0 3px 1px rgba(0,0,0,0.15)}.ribbon-button-alignment{padding-top:10px;display:inline-block}.ribbon-button-alignment.pull-right>.btn.btn-ribbon{margin:0 0 0 8px}.header-btn{margin-top:5px}.widget-header>:first-child{margin:13px 0}.widget-toolbar{display:inline-block;position:relative;float:right;width:auto;height:29px;line-height:29px;border-left:1px solid rgba(0,0,0,0.09);cursor:pointer;padding:0 8px;text-align:center}.widget-toolbar.no-border{border-left:0}.widget-toolbar>:first-child{text-align:left}.widget-toolbar .ams-form label.checkbox,.widget-toolbar .ams-form label.radio{line-height:29px}.widget-toolbar .ams-form .icon-append,.widget-toolbar .ams-form .icon-prepend{top:3px!important}.widget-toolbar.ams-form .icon-append,.widget-toolbar.ams-form .icon-prepend{top:3px!important}.widget-toolbar>.ams-form{margin-top:2px}.widget-toolbar>.ams-form .toggle:last-child{font-size:12px;line-height:29px}.widget-toolbar>.ams-form .checkbox input+i,.widget-toolbar>.ams-form .radio input+i,.widget-toolbar>.ams-form .toggle input+i{border-width:1px;border-color:#c7c7c7!important;margin-top:-1px;-webkit-box-shadow:0 1px 1px #FFF,0 1px 1px #858585 inset;box-shadow:0 1px 1px #FFF,0 1px 1px #858585 inset}.widget-toolbar .btn-group{margin-top:-3px}.widget-toolbar>.btn{margin-top:-3px;font-size:12px!important;padding:1px 8px!important}.widget-toolbar>.label{display:inline-block;vertical-align:middle;margin-top:-3px;text-align:center;font-size:12px;padding:4px 7px}.widget-toolbar>.badge{padding:5px;font-size:14px;border-radius:50%;font-weight:400;min-width:24px;text-align:center!important}.widget-toolbar .progress{width:130px;margin:7px 0 0;height:18px!important;font-size:12px;box-shadow:0 1px 0 rgba(0,0,0,0),0 0 0 1px #d1d1d1 inset;-webkit-box-shadow:0 1px 0 rgba(0,0,0,0),0 0 0 1px #d1d1d1 inset}.widget-toolbar .progress-bar{font-size:12px}.widget-toolbar .pagination{margin:4px 0}.widget-toolbar .pagination>li>a{padding:2px 7px}.widget-toolbar .widget-text-input{max-width:220px}.widget-toolbar input[type=text]{height:28px!important;margin-top:2px}.widget-body.no-padding{padding:0;margin:0}.widget-body.no-padding .alert{margin:5px 5px 0;padding:10px;box-shadow:none!important;-webkit-box-shadow:none!important;border-radius:0!important}.widget-body>table{margin-bottom:0}.widget-body-ajax-loading::before{display:block;position:absolute;content:url(../img/ajax-loader.gif);padding-top:18%;text-align:center;font-weight:700;font-size:16px;color:#fff;background:rgba(255,255,255,0.4);height:100%;z-index:1;width:100%}.widget-body-ajax-loading:hover{cursor:wait!important}.widget-body-toolbar,.ams-form.widget-body-toolbar{display:block;padding:8px 10px;margin:-13px -13px 13px;min-height:42px;border-bottom:1px solid #ccc;background:#fafafa}.no-padding .widget-body-toolbar,.no-padding .ams-form.widget-body-toolbar,.no-padding.widget-body-toolbar,.no-padding.ams-form.widget-body-toolbar{display:block;margin:0}.ams-form .widget-body-toolbar .inline-group,.widget-body-toolbar.ams-form .inline-group{float:left;margin-top:4px}.widget-body-toolbar .btn{vertical-align:middle}.widget-body-toolbar .btn-xs{margin-top:5px}.no-widget-toolbar .widget-body-toolbar{display:none}.widget-content-padding{padding:20px}.widget-content-padding .well{margin-bottom:0}.widget-footer{display:block;position:relative;min-height:32px;vertical-align:middle;margin:0 -13px -13px;padding:5px;border-top:1px solid #e4e4e4;text-align:right;background-color:#f8f7f7}.no-padding .widget-footer{margin:0}.widget-footer.ams-form>label{margin-top:4px;display:block}.ams-widget{position:relative;margin:0 0 15px;padding:0;-khtml-border-radius:0;border-radius:0}.ams-widget header .nav-tabs{border-bottom-color:transparent}.ams-widget header .nav-tabs>li>a{border-radius:0;border:0;padding:5px 15px 4px}.ams-widget header .nav-tabs>li.active>a,.ams-widget header .nav-tabs>li.active>a:focus,.ams-widget header .nav-tabs>li.active>a:hover{color:#555;background-color:#FFF;border:1px solid #c2c2c2;border-bottom-color:transparent;border-top:0;cursor:default}.ams-widget header:first-child .nav-tabs{float:left}.ams-widget header:first-child .nav-tabs li{padding-left:0}.ams-widget header:first-child .nav-tabs li a{color:#333}.ams-widget header:first-child .nav-tabs.pull-right li:last-child a{margin-right:0!important;border-right:0!important}.ams-widget header .nav-pills{margin:3px}.ams-widget header .nav-pills>li>a{padding:3px 5px 4px}.ams-widget header>.btn-group{margin-top:-13px;margin-left:5px}.ams-widget>header{height:30px;padding:0;line-height:40px;color:#333;border:1px solid #c2c2c2;background:#fafafa}.ams-widget>header h2{display:inline-block;position:relative;width:auto;height:100%;margin:0;font-size:14px;line-height:31px;font-weight:400;letter-spacing:0}@media only screen and (min-width:320px) and (max-width:479px){.ams-widget>header h2{width:135px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}}.rtl .ams-widget>header h2{float:right;text-align:right}.ams-widget>header>h2{margin-left:10px;float:left}.ams-widget>header>h2+.btn,.ams-widget>header>h2+.btn-group{margin-left:20px}.rtl .ams-widget>header{padding:0 7px 0 0}.ams-widget>header .widget-icon{display:block;float:left;width:16px;height:16px;margin:10px 10px 0 0;zoom:1;z-index:400}.rtl .ams-widget>header .widget-icon{float:right;margin:10px 0 0 7px}.ams-widget>header>.widget-icon{display:block;position:relative;float:left;margin:0 -10px 0 2px;width:28px;height:28px;font-size:111%;line-height:29px;text-align:center}.ams-widget>header>:first-child.widget-icon{margin-left:0}.ams-widget>div{position:relative;float:left;width:100%;font-size:13px;-khtml-border-radius:0;border-radius:0;margin:0;padding:13px 13px 0;background-color:#fff!important;border-width:1px;border-style:solid;border-color:#ccc!important}.ams-widget>header+div{border-top:0}.ams-widget .widget-body{position:relative;min-height:100px;padding-bottom:13px}.ams-widget .widget-body.widget-hide-overflow{overflow:hidden}.ams-widget.well{margin:0 0 30px}.ams-widget.well header{display:none}.ams-widget.well>div{border:0!important;box-shadow:none!important;-webkit-box-shadow:none!important}.ams-widget.well.transparent .widget-body.no-padding{margin:0!important}.ams-widget-ctrls{width:auto;float:right;padding:0;margin:0}.ams-widget-ctrls a{display:inline-block;padding:0;margin:0;text-decoration:none;font-size:14px;text-align:center;line-height:29px;color:#333}.ams-widget-ctrls .button-icon{position:relative;float:left;min-width:28px;height:28px;font-family:Ubuntu,Arial,Helvetica,sans-serif;border-left:1px solid rgba(0,0,0,0.09)}.ams-widget-ctrls .button-icon :hover{background-color:rgba(0,0,0,0.05)}.rtl .ams-widget-ctrls .button-icon{margin:0 0 5px 5px}.rtl .ams-widget-ctrls{float:left;padding:10px 0 0 3px;margin:0}.ams-widget-loader{display:none;float:right;width:28px;height:28px;margin:0;text-align:center;line-height:28px;background-repeat:no-repeat;background-position:center center}.rtl .ams-widget-loader{float:left}.ams-widget-editbox{display:none;padding:10px;border-bottom:1px solid #b1b1b1;background-color:#fff;margin:-13px -13px 13px}.no-padding .ams-widget-editbox{margin:0 0 10px}.ams-widget,.ams-widget-editbox,.ams-widget>div{zoom:1}.ams-widget:after,.ams-widget-editbox:after,.ams-widget>div:after{clear:both}.ams-widget:before,.ams-widget-editbox:before,.ams-widget>div:before,.ams-widget:after,.ams-widget-editbox:after,.ams-widget>div:after{display:block;visibility:hidden;overflow:hidden;content:"\0020";height:0;font-size:0;line-height:0}.ui-sortable .ams-widget-sortable>header{cursor:move;line-height:normal;-khtml-border-radius:0;border-radius:0;-webkit-box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05);box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05)}.ui-sortable .ams-widget-sortable.ams-widget-collapsed>header{-khtml-border-radius:0;border-radius:0}.ams-widget-timestamp{margin:10px 0 0;color:#868686;font-size:12px;font-style:italic}.ams-widget-placeholder{margin-bottom:28px;padding:0;background-color:#FFC;border:1px dashed #a7a7a7;-khtml-border-radius:0;border-radius:0;-webkit-box-sizing:border-box;-khtml-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.ams-widget-remove-colors{color:#333!important;padding:0!important;background:none!important}.ams-widget-color-magenta>header{color:#fff;background:#6e3671;border-color:#6e3671!important}.ams-widget-color-magenta .nav-tabs li:not(.active) a,.ams-widget-color-magenta>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-magenta .nav-tabs li a:hover{color:#333!important}.ams-widget-color-pink>header{color:#fff;background:#ac5287;border-color:#ac5287!important}.ams-widget-color-pink .nav-tabs li:not(.active) a,.ams-widget-color-pink>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-pink .nav-tabs li a:hover{color:#333!important}.ams-widget-color-pinkDark>header{color:#fff;background:#a8829f;border-color:#a8829f!important}.ams-widget-color-pinkDark .nav-tabs li:not(.active) a,.ams-widget-color-pinkDark>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-pinkDark .nav-tabs li a:hover{color:#333!important}.ams-widget-color-yellow>header{color:#fff;background:#d4c737;border-color:#d4c737!important}.ams-widget-color-yellow .nav-tabs li:not(.active) a,.ams-widget-color-yellow>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-yellow .nav-tabs li a:hover{color:#333!important}.ams-widget-color-orange>header{color:#fff;background:#c79121;border-color:#c79121!important}.ams-widget-color-orange .nav-tabs li:not(.active) a,.ams-widget-color-orange>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-orange .nav-tabs li a:hover{color:#333!important}.ams-widget-color-orangeDark>header{color:#fff;background:#a57225;border-color:#a57225!important}.ams-widget-color-orangeDark .nav-tabs li:not(.active) a,.ams-widget-color-orangeDark>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-orangeDark .nav-tabs li a:hover{color:#333!important}.ams-widget-color-darken>header{color:#fff;background:#404040;border-color:#404040!important}.ams-widget-color-darken .nav-tabs li:not(.active) a,.ams-widget-color-darken>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-darken .nav-tabs li a:hover{color:#333!important}.ams-widget-color-purple>header{color:#fff;background:#65596b;border-color:#65596b!important}.ams-widget-color-purple .nav-tabs li:not(.active) a,.ams-widget-color-purple>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-purple .nav-tabs li a:hover{color:#333!important}.ams-widget-color-teal>header{color:#fff;background:#568a89;border-color:#568a89!important}.ams-widget-color-teal .nav-tabs li:not(.active) a,.ams-widget-color-teal>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-teal .nav-tabs li a:hover{color:#333!important}.ams-widget-color-blueDark>header{color:#fff;background:#4c4f53;border-color:#4c4f53!important}.ams-widget-color-blueDark .nav-tabs li:not(.active) a,.ams-widget-color-blueDark>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-blueDark .nav-tabs li a:hover{color:#333!important}.ams-widget-color-blue>header{color:#fff;background:#60747c;border-color:#60747c!important}.ams-widget-color-blue .nav-tabs li:not(.active) a,.ams-widget-color-blue>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-blue .nav-tabs li a:hover{color:#333!important}.ams-widget-color-blueLight>header{color:#fff;background:#ccdadf;border-color:#ccdadf!important}.ams-widget-color-blueLight .nav-tabs li:not(.active) a,.ams-widget-color-blueLight>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-blueLight .nav-tabs li a:hover{color:#333!important}.ams-widget-color-red>header{color:#fff;background:#931313;border-color:#931313!important}.ams-widget-color-red .nav-tabs li:not(.active) a,.ams-widget-color-red>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-red .nav-tabs li a:hover{color:#333!important}.ams-widget-color-redLight>header{color:#fff;background:#a65858;border-color:#a65858!important}.ams-widget-color-redLight .nav-tabs li:not(.active) a,.ams-widget-color-redLight>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-redLight .nav-tabs li a:hover{color:#333!important}.ams-widget-color-white>header{color:#c8c8c8;background:#dedede;border-color:#c8c8c8!important}.ams-widget-color-white .nav-tabs li:not(.active) a,.ams-widget-color-white>header>.ams-widget-ctrls a{color:#c8c8c8!important}.ams-widget-color-white .nav-tabs li a:hover{color:#838383!important}.ams-widget-color-greenDark>header{color:#fff;background:#496949;border-color:#496949!important}.ams-widget-color-greenDark .nav-tabs li:not(.active) a,.ams-widget-color-greenDark>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-greenDark .nav-tabs li a:hover{color:#333!important}.ams-widget-color-green>header{color:#fff;background:#356e35;border-color:#356e35!important}.ams-widget-color-green .nav-tabs li:not(.active) a,.ams-widget-color-green>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-green .nav-tabs li a:hover{color:#333!important}.ams-widget-color-greenLight>header{color:#fff;background:#71843f;border-color:#71843f!important}.ams-widget-color-greenLight .nav-tabs li:not(.active) a,.ams-widget-color-greenLight>header>.ams-widget-ctrls a{color:#fff!important}.ams-widget-color-greenLight .nav-tabs li a:hover{color:#333!important}#ams-widget-fullscreen-mode{position:fixed;width:100%;height:100%;top:0;left:0;z-index:99999}#ams-widget-fullscreen-mode .ams-widget{margin:0;-khtml-border-radius:0;border-radius:0}#ams-widget-fullscreen-mode>div{overflow-y:scroll;-khtml-border-radius:0;border-radius:0}#ams-widget-fullscreen-mode>div>header{cursor:default}.onoffswitch{position:relative;width:50px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;margin-top:3px;margin-bottom:3px;margin-left:5px;display:inline-block;vertical-align:middle}.onoffswitch-container{margin-top:4px;margin-left:7px;display:inline-block}.onoffswitch-checkbox{display:none}.onoffswitch-label{display:block;overflow:hidden;cursor:pointer;border:1px solid #626262;border-radius:50px;border-color:#adadad #b3b3b3 #9e9e9e;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.onoffswitch-inner{width:200%;margin-left:-100%;display:block}.onoffswitch-inner:after,.onoffswitch-inner:before{float:left;width:50%;height:15px;padding:0;line-height:17px;font-size:10px;font-family:Ubuntu,Trebuchet,Arial,sans-serif;font-weight:700;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.onoffswitch-inner:before{content:attr(data-swchon-text);text-shadow:0 -1px 0 #333;padding-left:7px;background-color:#3276b1;color:#fff;-webkit-box-shadow:inset 0 2px 6px rgba(0,0,0,0.5),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 6px rgba(0,0,0,0.5),0 1px 2px rgba(0,0,0,0.05);text-align:left}.onoffswitch-inner:after{content:attr(data-swchoff-text);padding-right:7px;text-shadow:0 -1px 0 #fff;background-color:#fff;color:#555;text-align:right;-webkit-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)}.onoffswitch-switch{width:19px;height:19px;margin:-2px;background:#fff;border:1px solid #9a9a9a;border-radius:50px;position:absolute;top:0;bottom:0;right:32px;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;background-color:#f4f4f4;background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#eee));background-image:-webkit-gradient(linear,top left,bottom left,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,#eee);background-image:linear-gradient(to bottom,#fff,#eee);background-repeat:repeat-x;-webkit-box-shadow:1px 1px 4px 0 rgba(0,0,0,0.3);box-shadow:1px 1px 4px 0 rgba(0,0,0,0.3)}.onoffswitch-checkbox+.onoffswitch-label .onoffswitch-switch:before,.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-switch:before{content:"\f00d";color:#a90329;display:block;text-align:center;line-height:19px;font-size:10px;text-shadow:0 -1px 0 #fff;font-weight:700;font-family:FontAwesome}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-switch:before{content:"\f00c";color:#57889c}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-inner{margin-left:0;display:block}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-switch{right:0}.onoffswitch-switch:hover{background-color:#eee}.onoffswitch-switch:active{background-color:#eee;-webkit-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)}.onoffswitch-checkbox:checked:disabled+.onoffswitch-label .onoffswitch-inner:before,.onoffswitch-checkbox:disabled+.onoffswitch-label .onoffswitch-inner:after{text-shadow:0 1px 0 #fff;background:#bfbfbf;color:#333}.onoffswitch-checkbox:checked:disabled+.onoffswitch-label .onoffswitch-switch,.onoffswitch-checkbox:disabled+.onoffswitch-label .onoffswitch-switch{background-color:#f4f4f4;background-image:-webkit-gradient(linear,0 0,0 100%,from(#bfbfbf),to(#f4f4f4));background-image:-webkit-gradient(linear,top left,bottom left,from(#bfbfbf),to(#f4f4f4));background-image:-webkit-linear-gradient(top,#bfbfbf,#f4f4f4);background-image:linear-gradient(to bottom,#bfbfbf,#f4f4f4);-webkit-box-shadow:none!important;box-shadow:none!important}.onoffswitch-checkbox:checked:disabled+.onoffswitch-label .onoffswitch-label,.onoffswitch-checkbox:disabled+.onoffswitch-label{border-color:#ababab #999 #878787!important}.onoffswitch-checkbox:checked+.onoffswitch-label{border-color:#3276b1 #2a6395 #255681}.onoffswitch+span,.onoffswitch-title{display:inline-block;vertical-align:middle;margin-top:-5px}label.with-icon .select2-parent{margin-right:27px}label.with-icons .select2-parent{margin-right:54px}.select2-container{margin:0;position:relative;display:inline-block;zoom:1;*display:inline;vertical-align:middle}.select2-container .select2-choice{display:block;height:26px;padding:0 0 0 8px;overflow:hidden;position:relative;border:1px solid #ccc;white-space:nowrap;line-height:26px;color:#444;text-decoration:none;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#fff}label.bordered .select2-container .select2-choice{border-color:transparent}.select2-container .select2-choice:hover{border:1px solid rgba(82,168,236,0.7)}.select2-container .select2-choice>.select2-chosen{margin-right:26px;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.select2-container .select2-choice>.select2-chosen abbr{display:none;width:12px;height:12px;position:absolute;right:24px;top:8px;font-size:1px;text-decoration:none;border:0;cursor:pointer;outline:0}.select2-container .select2-choice>.select2-chosen abbr:hover{cursor:pointer}.select2-container.select2-drop-above .select2-choice{border-bottom-color:#ccc}.select2-container.select2-allowclear .select2-choice .select2-chosen{margin-right:42px}.select2-container.select2-allowclear .select2-choice abbr{display:inline-block}.select2-container .select2-arrow{display:inline-block;width:20px;height:20px;position:absolute;right:3px;top:3px;padding:0 0 0 2px;border-left:1px solid #ccc;line-height:22px;-webkit-background-clip:padding-box}.select2-container .select2-arrow b{width:100%;height:100%;display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:relative;font-size:14px}.select2-container .select2-arrow b:before{content:"\f107";width:100%;height:100%;text-align:center;display:block}.select2-container,.select2-drop,.select2-search,.select2-search input{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.select2-container-active .select2-choice,.select2-container-active .select2-choices{border:1px solid rgba(82,168,236,0.7)!important;outline:0}.select2-drop-mask{border:0;margin:0;padding:0;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:9998;background:#fff;filter:alpha(opacity=0)}.select2-drop{margin-top:-1px;width:100%;position:absolute;z-index:9999;top:100%;background:#fff;color:#000;border:1px solid #ccc;border-top:0;-webkit-box-shadow:0 4px 5px rgba(0,0,0,0.15);box-shadow:0 4px 5px rgba(0,0,0,0.15)}.select2-drop.select2-drop-above{margin-bottom:0;border-top:1px solid rgba(82,168,236,0.7);border-top-width:3px;border-bottom:0;-webkit-box-shadow:0 -4px 5px rgba(0,0,0,0.15);box-shadow:0 -4px 5px rgba(0,0,0,0.15)}.select2-drop.select2-drop-above.select2-drop-active{border-top-width:3px}.select2-drop.select2-drop-above .select2-search input{margin-top:4px}.select2-drop.select2-drop-above .select2-search:before{top:34%}.select2-drop-auto-width{border-top:1px solid #ccc;width:auto}.select2-drop-auto-width .select2-search{padding-top:4px}.select2-drop-active{border:1px solid rgba(82,168,236,0.7);border-top:0;border-bottom-width:3px}.select2-search{display:inline-block;width:100%;min-height:26px;margin:0;padding-left:4px;padding-right:4px;position:relative;z-index:10000;white-space:nowrap}.select2-search:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:absolute;content:"\f002";top:25%;right:10px;color:#686868!important}.select2-search input{width:100%;height:auto!important;min-height:26px;padding:4px 20px 3px 5px;margin:0;outline:0;font-size:1em;border:1px solid #aaa;-webkit-box-shadow:none;box-shadow:none;background:#fff;background:-webkit-gradient(linear,left bottom,left top,color-stop(0.85,#fff),color-stop(0.99,#eee));background:-webkit-linear-gradient(center bottom,#fff 85%,#eee 99%);background:-webkit-gradient(linear,top left,bottom left,from(#fff),to(#eee));background:-webkit-linear-gradient(top,#fff 85%,#eee 99%);background:linear-gradient(top,#fff 85%,#eee 99%)}.select2-search input.select2-active{background-origin:padding-box;background:#fff url(../img/select2-spinner.gif) no-repeat right 24px top 50%;background:url(../img/select2-spinner.gif) no-repeat right 24px top 50%,-webkit-gradient(linear,left bottom,left top,color-stop(0.85,#fff),color-stop(0.99,#eee));background:url(../img/select2-spinner.gif) no-repeat right 24px top 50%,-webkit-linear-gradient(center bottom,#fff 85%,#eee 99%);background:url(../img/select2-spinner.gif) no-repeat right 24px top 50%,-webkit-gradient(linear,top left,bottom left,from(#fff),to(#eee));background:url(../img/select2-spinner.gif) no-repeat right 24px top 50%,-webkit-linear-gradient(top,#fff 85%,#eee 99%);background:url(../img/select2-spinner.gif) no-repeat right 24px top 50%,linear-gradient(top,#fff 85%,#eee 99%)}.select2-dropdown-open .select2-choice{border-bottom-color:transparent;-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset;border-bottom-left-radius:0;border-bottom-right-radius:0;background-color:#fff}.select2-dropdown-open.select2-drop-above .select2-choice,.select2-dropdown-open.select2-drop-above .select2-choices{border:1px solid #5d98cc;border-top-color:transparent}.select2-dropdown-open .select2-choice .select2-arrow{background:0;border-left:0;-webkit-filter:none;filter:none}.select2-dropdown-open .select2-choice .select2-arrow b{background-position:-18px 1px}.select2-results{max-height:200px;padding:0 0 0 4px;margin:4px 4px 4px 0;position:relative;overflow-x:hidden;overflow-y:auto;-webkit-tap-highlight-color:rgba(0,0,0,0)}.select2-results .select2-selected{opacity:.5}.select2-results ul.select2-result-sub{margin:0;padding-left:0}.select2-results ul.select2-result-sub>li .select2-result-label{padding-left:20px}.select2-results ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:40px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:60px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:80px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:100px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:110px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:120px}.select2-results li{list-style:none;display:list-item;background-image:none}.select2-results li.select2-result-with-children>.select2-result-label{font-weight:700}.select2-results .select2-result-label{padding:3px 7px 4px;margin:0;cursor:pointer;min-height:1em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.select2-results .select2-highlighted{background:#3276b1;color:#fff}.select2-results li em{background:#feffde;font-style:normal}.select2-results .select2-highlighted em{background:0}.select2-results .select2-highlighted ul{background:#fff;color:#000}.select2-results .select2-no-results,.select2-results .select2-searching,.select2-results .select2-selection-limit{background:#f4f4f4;display:list-item;padding:3px 5px;opacity:.5}.select2-results-results .select2-disabled{background:#f4f4f4;display:list-item;cursor:default}.select2-results-results .select2-disabled.select2-highlighted{color:#666;background:#f4f4f4;display:list-item;cursor:default}.select2-results-results .select2-selected{display:none}.select2-no-results{padding-left:20px}.select2-no-results:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f05a";margin-right:5px}.select2-more-results{background:#f4f4f4;display:list-item}.select2-more-results.select2-active{background:#f4f4f4 url(../img/select2-spinner.gif) no-repeat 100%}.select2-default{color:#999!important}.select2-container.select2-container-disabled .select2-choice{background-color:#f4f4f4;background-image:none;border:1px solid #ddd;cursor:default}.select2-container.select2-container-disabled .select2-choice .select2-arrow{background-color:#f4f4f4;background-image:none;border-left:0}.select2-container.select2-container-disabled .select2-choice abbr{display:none}.select2-container-multi.select2-container-active .select2-choices{border:1px solid rgba(82,168,236,0.7);outline:0}.select2-container-multi .select2-choices{height:auto!important;height:1%;min-height:26px;margin:0;padding:0;position:relative;border:1px solid #ccc;cursor:text;overflow:hidden;background-color:#fff}label.bordered .select2-container-multi .select2-choices{border-color:transparent}.select2-container-multi .select2-choices:hover{border:1px solid rgba(82,168,236,0.7)!important}label.bordered .select2-container-multi .select2-choices:hover{border-color:transparent!important}.select2-container-multi .select2-choices li{float:left;list-style:none}.select2-container-multi .select2-choices .select2-search-field{margin:0;padding:0;white-space:nowrap}.select2-container-multi .select2-choices .select2-search-field input{max-height:24px;padding:3px 5px;margin:1px 0;font-family:Ubuntu,sans-serif;font-size:100%;color:#666;outline:0;border:0;-webkit-box-shadow:none;box-shadow:none;background:transparent!important}.select2-container-multi .select2-choices .select2-search-field input.select2-active{background:#fff url(../img/select2-spinner.gif) no-repeat 99%!important}.select2-container-multi .select2-choices .select2-search-choice{padding:1px 28px 1px 8px;margin:2px;position:relative;line-height:18px;color:#fff;cursor:default;border:1px solid #2a6395;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#3276b1}.select2-container-multi .select2-choices .select2-search-choice .select2-chosen{cursor:default}.select2-container-multi .select2-choices .select2-search-choice-focus{opacity:.8}.select2-container-multi .select2-choices .select2-search-choice.ui-sortable-handle{cursor:move}.with-icons .select2-container-multi .select2-choices .select2-search-choice.ui-sortable-handle{margin-right:1px}.select2-container-multi.ordered .select2-choices li{float:none;cursor:move}.select2-container-multi.ordered .select2-choices li.ui-state-highlight{margin:2px 0 2px 2px;height:20px;background-color:#ddd;border:1px solid #ddd}.select2-container-multi .select2-search-choice-close{display:block;top:0;right:-2px;padding:3px 0 3px 6px}.select2-container-multi .select2-search-choice-close:hover{background:rgba(0,0,0,0.3)}.select2-container-multi.select2-container-disabled .select2-choices{background-color:#f4f4f4;background-image:none;border:1px solid transparent;border-bottom:1px solid #ccc;cursor:default}.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice{padding:1px 5px;border:1px solid #4a90cc;background-image:none;background-color:#86b4dd;cursor:not-allowed}.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close{display:none;background:0}.select2-locked{padding:3px 5px!important}.select2-search-choice-close{display:block;min-width:20px;min-height:14px;position:absolute;right:3px;top:3px;margin:0;padding:0;font-size:15px;text-decoration:none!important;font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.select2-search-choice-close:before{color:#fff;content:"\f057"}.select2-result-selectable .select2-match,.select2-result-unselectable .select2-match{text-decoration:underline}.select2-offscreen,.select2-offscreen:focus{clip:rect(0 0 0 0)!important;width:1px!important;height:1px!important;border:0!important;margin:0!important;padding:0!important;overflow:hidden!important;position:absolute!important;outline:0!important;left:0!important;top:0!important}.select2-display-none{display:none}.select2-measure-scrollbar{position:absolute;top:-10000px;left:-10000px;width:100px;height:100px;overflow:scroll}.select2-hidden-accessible{position:absolute;border:0;clip:rect(0 0 0 0);height:1px;width:1px;margin:-1px;overflow:hidden;padding:0}label.with-icon>i.icon-append+.select2-parent>.select2-choices{padding-right:29px}.multiselect-container{position:absolute;list-style-type:none;margin:0;padding:0}.multiselect-container .input-group{margin:5px}.multiselect-container>li{padding:0}.multiselect-container>li>a.multiselect-all label{font-weight:700}.multiselect-container>li>a>label{margin:0;height:100%;cursor:pointer;font-weight:400}.multiselect-container>li>a>label.checkbox,.multiselect-container>li>a>label.radio{margin:0}.multiselect-container>li>a>label>input[type=checkbox]{margin-bottom:5px}.multiselect-container>li>label.multiselect-group{margin:0;padding:3px 20px;height:100%;font-weight:700}.btn-group>.btn-group:nth-child(2)>.multiselect.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.color-select{list-style:none;margin:0;padding:4px;min-width:166px;max-width:156px;right:-3px}.color-select li{display:block;margin:2px;float:left}.color-select li span{display:block;width:22px;height:22px;padding:0;background:#333;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;border:1px solid rgba(0,0,0,0.1);cursor:pointer}.color-select li span:hover{border:3px solid rgba(0,0,0,0.2)}.widget-toolbar .dropdown-menu.color-select{right:-1px}.color-box{display:block;position:relative;width:22px;height:22px;padding:0;background:#333;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;border:1px solid rgba(255,255,255,0.3)!important;cursor:pointer;vertical-align:middle;outline:1px solid rgba(0,0,0,0.1);background:rgba(255,255,255,0.3)!important}.color-box:hover,.open .color-box{outline:1px solid rgba(0,0,0,0.1)!important}.color-box:hover{-webkit-transform:scale(1.07);-moz-transform:scale(1.07)}.color-box:active{top:1px;left:1px}.widget-toolbar>.color-box{margin-top:7px;width:18px;height:18px;outline:1px solid rgba(0,0,0,0.2)}.widget-toolbar>.color-box:active,.widget-toolbar>.color-box:focus,.widget-toolbar>.color-box:hover{outline:1px solid rgba(0,0,0,0.25)!important}.ams-widget #calendar{margin-top:-18px}#calendar-buttons{position:absolute;right:14px;top:5px}#calendar-container{position:relative}#external-events>li{margin:6px 4px 6px 0;display:inline-block}#external-events>li>:first-child{padding:5px 10px 10px;cursor:move;display:block}#external-events>li>:first-child:after{color:#fff;color:rgba(255,255,255,0.7);content:attr(data-description);font-size:11px;font-weight:400;display:block;line-height:0;margin:7px 0;text-transform:lowercase}.fc{direction:ltr;text-align:left}.fc .fc-header-space{padding-left:10px}.fc table,html .fc{font-size:12px}.fc table{border-collapse:collapse;border-spacing:0}.fc th,.fc td{padding:0;vertical-align:top}.fc .ui-resizable-handle{display:block;position:absolute;z-index:99999;overflow:hidden;font-size:300%;line-height:50%}.fc .ui-draggable-dragging .fc-event-bg{display:none}.fc-border-separate thead tr,.fc-border-separate .table thead tr{background-color:#eee;background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#fafafa));background-image:-webkit-linear-gradient(top,#f2f2f2 0,#fafafa 100%);background-image:-linear-gradient(top,#f2f2f2 0,#fafafa 100%);font-size:12px}.fc-border-separate thead tr th{padding:4px;line-height:1.428571429}tr td.fc-first,tr.fc-first th.fc-first{border-left:0}tr.fc-last td{border-bottom:0}.fc-header .fc-button{margin-bottom:1em;vertical-align:top;margin-right:-1px}.fc-header .fc-corner-right{margin-right:1px}.fc-header .ui-corner-right{margin-right:0}.fc-header .fc-state-hover,.fc-header .ui-state-hover{z-index:2}.fc-header .fc-state-down{z-index:3}.fc-header .fc-state-active,.fc-header .ui-state-active{z-index:4}.fc-header td{white-space:nowrap}.fc-header-left{width:25%;text-align:left}.fc-header-center{text-align:center}.fc-header-right{width:25%;text-align:right}.fc-header-title{display:inline-block;vertical-align:top}.fc-header-title h2{margin-top:0;white-space:nowrap}.ams-widget .fc-header-title h2{text-shadow:0 1px 0 #fff;margin-top:-12px;margin-left:10px;font-size:14px;font-weight:700;margin-bottom:0}.fc-content{clear:both}.fc-view{width:100%;overflow:hidden}.fc-widget-content,.fc-widget-header{border:1px solid #ccc;border-right:0}.fc-state-highlight{background:#ffc}.fc-cell-overlay{background:#9cf;opacity:.2;filter:alpha(opacity=20)}.fc-button{position:relative;display:inline-block;cursor:pointer}.fc-button-inner{position:relative;float:left;overflow:hidden}.fc-state-default{border-width:1px 0}.fc-state-default .fc-button-inner{border-width:0 1px}.fc-state-default,.fc-state-default .fc-button-inner{border-style:solid;border-color:#ccc #bbb #aaa;background:#f3f3f3;color:#000}.fc-state-default .fc-button-effect{position:absolute;top:50%;left:0}.fc-state-default .fc-button-effect span{position:absolute;top:-100px;left:0;width:500px;height:100px;border-width:100px 0 0 1px;border-style:solid;border-color:#fff;background:#444;opacity:.09;filter:alpha(opacity=9)}.fc-state-hover .fc-button-inner{border-color:#999}.fc-state-down .fc-button-inner{border-color:#555;background:#777}.fc-state-active .fc-button-inner{border-color:#555;background:#777;color:#fff}.fc-state-disabled{cursor:default}.fc-state-disabled .fc-button-inner{color:#999;border-color:#ddd}.fc-state-disabled .fc-button-effect{display:none}.fc-button-content{position:relative;float:left;height:1.9em;line-height:1.9em;padding:0 .6em;white-space:nowrap}.fc-button-content .fc-icon-wrap{position:relative;float:left;top:50%}.fc-button-content .ui-icon{position:relative;float:left;margin-top:-50%;*margin-top:0;*top:-50%}.fc-event{border-style:solid;border-width:0;font-size:.85em;cursor:default}.fc-rtl .fc-event{text-align:right}.fc-event-draggable,a.fc-event{cursor:pointer}a.fc-event{text-decoration:none}.fc-event-skin{color:#FFF;border-right:0!important;cursor:move}.fc-event-skin .fa:before{display:block;font-size:14px;position:absolute;right:4px;top:3px}.fc-event-inner{position:relative;width:100%;height:100%;border-style:solid;border-width:0;overflow:hidden}.fc-event-hori{border-width:1px 0;margin-bottom:1px}.fc-event-hori .ui-resizable-e{top:0!important;right:-3px!important;width:7px!important;height:100%!important;cursor:e-resize}.fc-event-hori .ui-resizable-w{top:0!important;left:-3px!important;width:7px!important;height:100%!important;cursor:w-resize}.fc-event-hori .ui-resizable-handle{_padding-bottom:14px}.fc-corner-left{margin-left:1px}.fc-corner-left .fc-button-inner,.fc-corner-left .fc-event-inner{margin-left:-1px}.fc-corner-right{margin-right:1px}.fc-corner-right .fc-button-inner,.fc-corner-right .fc-event-inner{margin-right:-1px}.fc-corner-right .fc-event-inner{border-left:6px solid rgba(0,0,0,0.15);padding-left:2px;padding-right:15px}.fc-corner-top{margin-top:1px}.fc-corner-top .fc-event-inner{margin-top:-1px;border-top-width:1px}.fc-corner-bottom{margin-bottom:1px}.fc-corner-bottom .fc-event-inner{margin-bottom:-1px;border-bottom-width:1px}table.fc-table-separate{border-collapse:separate}.fc-table-separate td,.fc-table-separate th{border-width:1px 0 0 1px}.fc-table-separate td.fc-last,.fc-table-separate th.fc-last{border-right-width:1px}.fc-table-separate tr.fc-last td,.fc-table-separate tr.fc-last th{border-bottom-width:1px}.fc-table-separate tbody tr.fc-first td,.fc-table-separate tbody tr.fc-first th{border-top-width:0}.fc-grid th{text-align:center}.fc-grid .fc-day-number{float:right;padding:0 2px}.fc-grid .fc-other-month .fc-day-number{opacity:.3;filter:alpha(opacity=30)}.fc-grid .fc-day-content{clear:both;padding:2px 2px 1px}.fc-grid .fc-event-time{font-weight:700}.fc-rtl .fc-grid .fc-day-number{float:left}.fc-rtl .fc-grid .fc-event-time{float:right}.fc-agenda table{border-collapse:separate}.fc-agenda .fc-agenda-axis{width:50px;padding:0 4px;vertical-align:middle;text-align:right;white-space:nowrap;font-weight:400}.fc-agenda .fc-day-content{padding:2px 2px 1px}.fc-agenda-days th{text-align:center}.fc-agenda-days .fc-agenda-axis{border-right-width:1px}.fc-agenda-days .fc-col0{border-left-width:0}.fc-agenda-allday th{border-width:0 1px}.fc-agenda-allday .fc-day-content{min-height:34px;_height:34px}.fc-agenda-divider-inner{height:2px;overflow:hidden}.fc-widget-header .fc-agenda-divider-inner{background:#eee}.fc-agenda-slots th{border-width:1px 1px 0}.fc-agenda-slots td{border-width:1px 0 0;background:0}.fc-agenda-slots td div{height:20px}.fc-agenda-slots tr.fc-slot0 td,.fc-agenda-slots tr.fc-slot0 th{border-top-width:0}.fc-agenda-slots tr.fc-minor td,.fc-agenda-slots tr.fc-minor th{border-top-style:dotted}.fc-agenda-slots tr.fc-minor th.ui-widget-header{*border-top-style:solid}.fc-event-time,.fc-event-title{padding:3px 0 2px 3px;display:inline-block;line-height:16px;font-weight:700;font-size:11px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.fc-event-vert{border-width:0 1px}.fc-event-vert .fc-event-content,.fc-event-vert .fc-event-head{position:relative;z-index:2;width:100%;overflow:hidden}.fc-event-vert .fc-event-time{white-space:nowrap;font-size:10px}.fc-event-vert .fc-event-bg{position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;background:#fff;opacity:.3;filter:alpha(opacity=30)}.fc-event-vert .ui-resizable-s{bottom:0!important;width:100%!important;height:8px!important;overflow:hidden!important;line-height:8px!important;font-size:11px!important;font-family:monospace;text-align:center;cursor:s-resize}.fc-select-helper .fc-event-bg{display:none}.fc-agenda .ui-resizable-resizing{_overflow:hidden}.colorpicker{padding-left:30px!important}.bootstrap-timepicker{position:relative}.bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu{left:auto;right:0}.bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu:before{left:auto;right:12px}.bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu:after{left:auto;right:13px}.bootstrap-timepicker .add-on{cursor:pointer}.bootstrap-timepicker .add-on i{display:inline-block;width:16px;height:16px}@media(max-width:767px){.bootstrap-timepicker,.bootstrap-timepicker .dropdown-menu{width:100%}}.bootstrap-timepicker-widget.dropdown-menu{padding:4px}.bootstrap-timepicker-widget.dropdown-menu.open{display:inline-block}.bootstrap-timepicker-widget.dropdown-menu:before{border-bottom:7px solid rgba(0,0,0,0.2);border-left:7px solid transparent;border-right:7px solid transparent;content:"";display:inline-block;position:absolute}.bootstrap-timepicker-widget.dropdown-menu:after{border-bottom:6px solid #FFF;border-left:6px solid transparent;border-right:6px solid transparent;content:"";display:inline-block;position:absolute}.bootstrap-timepicker-widget.timepicker-orient-left:before{left:6px}.bootstrap-timepicker-widget.timepicker-orient-left:after{left:7px}.bootstrap-timepicker-widget.timepicker-orient-right:before{right:6px}.bootstrap-timepicker-widget.timepicker-orient-right:after{right:7px}.bootstrap-timepicker-widget.timepicker-orient-top:before{top:-7px}.bootstrap-timepicker-widget.timepicker-orient-top:after{top:-6px}.bootstrap-timepicker-widget.timepicker-orient-bottom:before{bottom:-7px;border-bottom:0;border-top:7px solid #999}.bootstrap-timepicker-widget.timepicker-orient-bottom:after{bottom:-6px;border-bottom:0;border-top:6px solid #fff}.bootstrap-timepicker-widget a.btn,.bootstrap-timepicker-widget input{border-radius:4px}.bootstrap-timepicker-widget table{width:100%;margin:0}.bootstrap-timepicker-widget table table td{text-align:center;height:30px;margin:0;padding:2px}.bootstrap-timepicker-widget table table td:not(.separator){min-width:30px}.bootstrap-timepicker-widget table table td span{width:100%}.bootstrap-timepicker-widget table table td a{border:1px transparent solid;width:100%;display:inline-block;margin:0;padding:8px 0;outline:0;color:#333}.bootstrap-timepicker-widget table table td a:hover{text-decoration:none;background-color:#eee;border-radius:4px;border-color:#ddd}.bootstrap-timepicker-widget table table td a i{margin-top:2px;font-size:18px}.bootstrap-timepicker-widget table table td input{width:25px;margin:0;text-align:center}@media(min-width:767px){.bootstrap-timepicker-widget.modal{width:200px;margin-left:-100px}}.bootstrap-timepicker-widget .modal-content{padding:4px}.note-editor{border:1px solid #a9a9a9}.note-editor.fullscreen{position:fixed;top:0;left:0;z-index:1050;width:100%}.note-editor.fullscreen.fullscreen .note-editable{background-color:#fff}.note-editor.codeview .note-editable,.note-editor.fullscreen .note-resizebar{display:none}.note-editor.codeview .note-codeable{display:block}.note-editor .note-toolbar{padding-bottom:5px;padding-left:5px;margin:0;background-color:#f5f5f5;border-bottom:1px solid #a9a9a9}.note-editor .note-toolbar>.btn-group{margin-top:5px;margin-right:5px;margin-left:0}.note-editor .note-toolbar .note-table .dropdown-menu{min-width:0;padding:5px}.note-editor .note-toolbar .note-table .dropdown-menu .note-dimension-picker{font-size:18px}.note-editor .note-toolbar .note-table .dropdown-menu .note-dimension-picker .note-dimension-picker-mousecatcher{position:absolute!important;z-index:3;width:10em;height:10em;cursor:pointer}.note-editor .note-toolbar .note-table .note-table .dropdown-menu .note-dimension-picker .note-dimension-picker-unhighlighted{position:relative!important;z-index:1;width:5em;height:5em;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC) repeat}.note-editor .note-toolbar .note-table .note-table .dropdown-menu .note-dimension-picker .note-dimension-picker-highlighted{position:absolute!important;z-index:2;width:1em;height:1em;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIjd6vvD2f9LKLW+AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKwNDEVT0AAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC) repeat}.note-editor .note-toolbar .note-style blockquote,.note-editor .note-toolbar .note-editor .note-toolbar .note-style h1,.note-editor .note-toolbar .note-editor .note-toolbar .note-style h2,.note-editor .note-toolbar .note-editor .note-toolbar .note-style h3,.note-editor .note-toolbar .note-editor .note-toolbar .note-style h4,.note-editor .note-toolbar .note-editor .note-toolbar .note-style h5,.note-editor .note-toolbar .note-editor .note-toolbar .note-style h6{margin:0}.note-editor .note-toolbar .note-color .dropdown-toggle{width:20px;padding-left:5px}.note-editor .note-toolbar .note-color .dropdown-menu{min-width:290px}.note-editor .note-toolbar .note-color .dropdown-menu .btn-group{margin:0}.note-editor .note-toolbar .note-color .dropdown-menu .btn-group:first-child{margin:0 5px}.note-editor .note-toolbar .note-color .dropdown-menu .btn-group .note-palette-title{margin:2px 7px;font-size:12px;text-align:center;border-bottom:1px solid #eee}.note-editor .note-toolbar .note-color .dropdown-menu .btn-group .note-color-reset{padding:0 3px;margin:5px;font-size:12px;cursor:pointer;border-radius:5px}.note-editor .note-toolbar .note-color .dropdown-menu .btn-group .note-color-reset:hover{background:#eee}.note-editor .note-toolbar .note-para .dropdown-menu{min-width:153px;padding:5px}.note-editor .note-toolbar .note-para .note-para li:first-child{margin-bottom:5px}.note-editor .note-statusbar{background-color:#f5f5f5}.note-editor .note-statusbar .note-resizebar{width:100%;height:8px;cursor:s-resize}.note-editor .note-statusbar .note-resizebar .note-icon-bar{width:20px;margin:1px auto;border-top:1px solid #a9a9a9}.note-editor .note-popover .popover{max-width:none}.note-editor .note-popover .popover .popover-content{padding:5px}.note-editor .note-popover .popover .popover-content a{display:inline-block;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}.note-editor .note-popover .popover .popover-content .btn-group+.btn-group{margin-left:5px}.note-editor .note-popover .popover .arrow{left:20px}.note-editor .note-handle .note-control-selection{position:absolute;display:none;border:1px solid #000}.note-editor .note-handle .note-control-selection>div{position:absolute}.note-editor .note-handle .note-control-selection .note-control-selection-bg{width:100%;height:100%;background-color:#000;-webkit-opacity:.3;-khtml-opacity:.3;-moz-opacity:.3;opacity:.3;-ms-filter:alpha(opacity=30);filter:alpha(opacity=30)}.note-editor .note-handle .note-control-selection .note-control-handle,.note-editor .note-handle .note-control-selection .note-control-holder{width:7px;height:7px;border:1px solid #000}.note-editor .note-handle .note-control-selection .note-control-sizing{width:7px;height:7px;background-color:#fff;border:1px solid #000}.note-editor .note-handle .note-control-selection .note-control-nw{top:-5px;left:-5px;border-right:0;border-bottom:0}.note-editor .note-handle .note-control-selection .note-control-ne{top:-5px;right:-5px;border-bottom:0;border-left:0}.note-editor .note-handle .note-control-selection .note-control-sw{bottom:-5px;left:-5px;border-top:0;border-right:0}.note-editor .note-handle .note-control-selection .note-control-se{right:-5px;bottom:-5px;cursor:se-resize}.note-editor .note-handle .note-control-selection .note-control-selection-info{right:0;bottom:0;padding:5px;margin:5px;font-size:12px;color:#fff;background-color:#000;border-radius:5px;-webkit-opacity:.7;-khtml-opacity:.7;-moz-opacity:.7;opacity:.7;-ms-filter:alpha(opacity=70);filter:alpha(opacity=70)}.note-editor .note-dialog>div{display:none}.note-editor .note-dialog .note-image-dialog .note-dropzone{min-height:200px;font-size:30px;line-height:6;color:#d3d3d3;text-align:center;border:4px dashed #d3d3d3}.note-editor .note-dialog .note-help-dialog{font-size:12px;color:#ccc;background:0;background-color:#222!important;border:0;-webkit-opacity:.9;-khtml-opacity:.9;-moz-opacity:.9;opacity:.9;-ms-filter:alpha(opacity=90);filter:alpha(opacity=90)}.note-editor .note-dialog .note-help-dialog .modal-content{background:0;border:1px solid #fff;border-radius:5px;-webkit-box-shadow:none;box-shadow:none}.note-editor .note-dialog .note-help-dialog a{font-size:12px;color:#fff}.note-editor .note-dialog .note-help-dialog .title{padding-bottom:5px;font-size:14px;font-weight:700;color:#fff;border-bottom:#fff 1px solid}.note-editor .note-dialog .note-help-dialog .modal-close{font-size:14px;color:#dd0;cursor:pointer}.note-editor .note-dialog .note-help-dialog .note-shortcut-layout{width:100%}.note-editor .note-dialog .note-help-dialog .note-shortcut-layout td{vertical-align:top}.note-editor .note-dialog .note-help-dialog .note-shortcut{margin-top:8px}.note-editor .note-dialog .note-help-dialog .note-shortcut th{font-size:13px;color:#dd0;text-align:left}.note-editor .note-dialog .note-help-dialog .note-shortcut th:first-child{min-width:110px;padding-right:10px;font-family:"Courier New";color:#dd0;text-align:right}.note-editor .note-editable{padding:10px;overflow:scroll;outline:0}.note-editor .note-codeable{display:none;width:100%;padding:10px;margin-bottom:0;font-family:Menlo,Monaco,monospace,sans-serif;font-size:14px;color:#ccc;background-color:#222;border:0;border-radius:0;-webkit-box-shadow:none;box-shadow:none;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;resize:none}.note-editor .dropdown-menu{min-width:90px}.note-editor .dropdown-menu.right{right:0;left:auto}.note-editor .dropdown-menu.right::before{right:9px;left:auto!important}.note-editor .dropdown-menu.right::after{right:10px;left:auto!important}.note-editor .dropdown-menu .dropdown-menu li a i{color:#00bfff;visibility:hidden}.note-editor .dropdown-menu .dropdown-menu li a.checked i{visibility:visible}.note-editor .note-color-palette{line-height:1}.note-editor .note-color-palette div .note-color-btn{width:17px;height:17px;padding:0;margin:0;border:1px solid #fff}.note-editor .note-color-palette div .note-color-btn:hover{border:1px solid #000}.no-padding .note-editor{border:0}.note-editor .note-editable{background-color:rgba(48,126,204,0.05)}.note-editor .note-editable:focus{background-color:#fff}.note-editor .note-statusbar .note-resizebar{border-top:1px solid #dbdbdb}.note-editor .note-statusbar:hover{background:#EEE}.note-editor .note-statusbar:active{background:#eaeaea}.md-editor{display:block;border:1px solid #ddd}.md-editor.active{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.md-editor .md-footer,.md-editor>.md-header{display:block;padding:6px 4px;background:#f5f5f5}.md-editor>.md-preview{background:#fff;border-top:1px dashed #ddd;border-bottom:1px dashed #ddd;min-height:10px;padding:10px}.md-editor>textarea{font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:13px;outline:0;outline:thin dotted \9;margin:0;display:block;width:100%;border:0;padding:10px;border-top:1px dashed #ddd;border-bottom:1px dashed #ddd;border-radius:0;-webkit-box-shadow:none;box-shadow:none;background:#eee}.md-editor>textarea:focus{-webkit-box-shadow:none;box-shadow:none;background:#fff}.twitter-typeahead .tt-hint,.twitter-typeahead .tt-query{margin-bottom:0}.tt-dropdown-menu{min-width:160px;margin-top:2px;padding:5px 0;background-color:#fff;border:1px solid #bfbfbf;border:1px solid rgba(0,0,0,0.2);*border-right-width:2px;*border-bottom-width:2px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);-webkit-background-clip:padding-box;background-clip:padding-box}.tt-suggestion{display:block;padding:3px 20px}.tt-suggestion.tt-is-under-cursor{color:#fff;background-color:#0081c2}.tt-suggestion.tt-is-under-cursor a{color:#fff}.tt-suggestion p{margin:0}.dropzone,.dropzone *,.dropzone-previews,.dropzone-previews *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.dropzone .dz-preview,.dropzone-previews .dz-preview{background:rgba(255,255,255,0.8);position:relative;display:inline-block;margin:10px;vertical-align:top;border:1px solid #acacac;padding:6px;-webkit-box-shadow:1px 1px 4px rgba(0,0,0,0.16);box-shadow:1px 1px 4px rgba(0,0,0,0.16);font-size:14px}.dropzone .dz-preview.dz-file-preview,.dropzone-previews .dz-preview.dz-file-preview{display:none}.dropzone .dz-preview .dz-details,.dropzone-previews .dz-preview .dz-details{width:100px;height:100px;position:relative;background:#ebebeb;padding:5px;margin-bottom:22px}.dropzone .dz-preview .dz-details .dz-filename,.dropzone-previews .dz-preview .dz-details .dz-filename{overflow:hidden;height:100%}.dropzone .dz-preview .dz-details img,.dropzone-previews .dz-preview .dz-details img{position:absolute;top:0;left:0;width:100px;height:100px}.dropzone .dz-preview .dz-details .dz-size,.dropzone-previews .dz-preview .dz-details .dz-size{position:absolute;bottom:-28px;left:3px;height:28px;line-height:28px}.dropzone .dz-preview.dz-error .dz-error-mark,.dropzone-previews .dz-preview.dz-error .dz-error-mark,.dropzone .dz-preview.dz-success .dz-success-mark,.dropzone-previews .dz-preview.dz-success .dz-success-mark{display:block;opacity:1;-ms-filter:none;-webkit-filter:none;filter:none}.dropzone .dz-preview:hover .dz-details img,.dropzone-previews .dz-preview:hover .dz-details img{display:none}.dropzone .dz-preview .dz-error-mark,.dropzone-previews .dz-preview .dz-error-mark,.dropzone .dz-preview .dz-success-mark,.dropzone-previews .dz-preview .dz-success-mark{display:block;position:absolute;width:40px;height:40px;font-size:30px;text-align:center;right:-10px;top:-10px;opacity:0;-ms-filter:"alpha(Opacity=0)";filter:alpha(opacity=0);-webkit-transition:opacity .4s ease-in-out;transition:opacity .4s ease-in-out;background-image:url(../img/dropzone/spritemap.png);background-repeat:no-repeat}.dropzone .dz-preview .dz-error-mark span,.dropzone-previews .dz-preview .dz-error-mark span,.dropzone .dz-preview .dz-success-mark span,.dropzone-previews .dz-preview .dz-success-mark span{display:none}.dropzone .dz-preview .dz-success-mark,.dropzone-previews .dz-preview .dz-success-mark{color:#8cc657;background-position:-268px -163px}.dropzone .dz-preview .dz-error-mark,.dropzone-previews .dz-preview .dz-error-mark{color:#ee162d;background-position:-268px -123px}.dropzone .dz-preview.dz-error .dz-progress .dz-upload,.dropzone-previews .dz-preview.dz-error .dz-progress .dz-upload{background:#ee1e2d}.dropzone .dz-preview .dz-progress,.dropzone-previews .dz-preview .dz-progress{position:absolute;top:100px;left:6px;right:6px;height:6px;background:#d7d7d7;display:none}.dropzone .dz-preview .dz-progress .dz-upload,.dropzone-previews .dz-preview .dz-progress .dz-upload{position:absolute;bottom:0;background-color:#8cc657;-webkit-animation:loading .4s linear infinite;-ms-animation:loading .4s linear infinite;animation:loading .4s linear infinite;-webkit-transition:width .3s ease-in-out;transition:width .3s ease-in-out;border-radius:2px;top:0;left:0;width:0;height:100%;background-image:url(../img/dropzone/spritemap.png);background-repeat:repeat-x;background-position:0 -400px}.dropzone .dz-preview.dz-processing .dz-progress,.dropzone-previews .dz-preview.dz-processing .dz-progress{display:block}.dropzone .dz-preview .dz-error-message,.dropzone-previews .dz-preview .dz-error-message{position:absolute;top:-5px;left:-20px;background:rgba(245,245,245,0.8);padding:8px 10px;color:#800;min-width:140px;max-width:500px;z-index:500;display:block;opacity:0;-ms-filter:"alpha(Opacity=0)";filter:alpha(opacity=0);-webkit-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out}.dropzone .dz-preview:hover.dz-error .dz-error-message,.dropzone-previews .dz-preview:hover.dz-error .dz-error-message{display:block;opacity:1;-ms-filter:none;-webkit-filter:none;filter:none}.dropzone .dz-preview.dz-image-preview:hover .dz-details img,.dropzone-previews .dz-preview.dz-image-preview:hover .dz-details img{display:block;opacity:.1;-ms-filter:"alpha(Opacity=10)";filter:alpha(opacity=10)}.dropzone .dz-preview.dz-success .dz-progress,.dropzone-previews .dz-preview.dz-success .dz-progress{display:block;opacity:0;-ms-filter:"alpha(Opacity=0)";filter:alpha(opacity=0);-webkit-transition:opacity .4s ease-in-out;transition:opacity .4s ease-in-out}.dropzone a.dz-remove,.dropzone-previews a.dz-remove{background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fafafa),color-stop(1,#eee));background-image:-webkit-gradient(linear,top left,bottom left,from(#fafafa),to(#eee));background-image:-webkit-linear-gradient(top,#fafafa 0,#eee 100%);background-image:linear-gradient(top,#fafafa 0,#eee 100%);border-radius:2px;border:1px solid #eee;text-decoration:none;display:block;padding:4px 5px;text-align:center;color:#aaa;margin-top:26px}.dropzone a.dz-remove:hover,.dropzone-previews a.dz-remove:hover{color:#666}.dropzone{position:relative;padding:1em;border:1px solid rgba(0,0,0,0.03);min-height:360px;border-radius:3px;background:rgba(0,0,0,0.03);background-image:-webkit-gradient(linear,left top,right bottom,color-stop(0.25,rgba(0,0,0,0.03)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(0,0,0,0.03)),color-stop(0.75,rgba(0,0,0,0.03)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(135deg,rgba(0,0,0,0.03) 25%,transparent 25%,transparent 50%,rgba(0,0,0,0.03) 50%,rgba(0,0,0,0.03) 75%,transparent 75%,transparent);background-image:-webkit-linear-gradient(315deg,rgba(0,0,0,0.03) 25%,transparent 25%,transparent 50%,rgba(0,0,0,0.03) 50%,rgba(0,0,0,0.03) 75%,transparent 75%,transparent);background-image:linear-gradient(135deg,rgba(0,0,0,0.03) 25%,transparent 25%,transparent 50%,rgba(0,0,0,0.03) 50%,rgba(0,0,0,0.03) 75%,transparent 75%,transparent);background-color:#fafcfd;-webkit-background-size:16px 16px;background-size:16px 16px}.dropzone .dz-drag-hover{background:rgba(0,0,0,0.04)}.dropzone.dz-clickable,.dropzone.dz-clickable .dz-message,.dropzone.dz-clickable .dz-message span{cursor:pointer}.dropzone.dz-clickable *{cursor:default}.dropzone .dz-message{opacity:1;-ms-filter:none;-webkit-filter:none;filter:none}.dropzone .dz-drag-hover{background-image:-webkit-gradient(linear,left top,right bottom,color-stop(0.25,rgba(0,0,0,0.03)),color-stop(0.25,rgba(0,0,0,0)),color-stop(0.5,rgba(0,0,0,0)),color-stop(0.5,rgba(0,0,0,0.03)),color-stop(0.75,rgba(0,0,0,0.03)),color-stop(0.75,rgba(0,0,0,0)),to(rgba(0,0,0,0)));background-image:-webkit-linear-gradient(135deg,rgba(0,0,0,0.03) 25%,rgba(0,0,0,0) 25%,rgba(0,0,0,0) 50%,rgba(0,0,0,0.03) 50%,rgba(0,0,0,0.03) 75%,rgba(0,0,0,0) 75%,rgba(0,0,0,0));background-image:-webkit-linear-gradient(315deg,rgba(0,0,0,0.03) 25%,rgba(0,0,0,0) 25%,rgba(0,0,0,0) 50%,rgba(0,0,0,0.03) 50%,rgba(0,0,0,0.03) 75%,rgba(0,0,0,0) 75%,rgba(0,0,0,0));background-image:linear-gradient(135deg,rgba(0,0,0,0.03) 25%,rgba(0,0,0,0) 25%,rgba(0,0,0,0) 50%,rgba(0,0,0,0.03) 50%,rgba(0,0,0,0.03) 75%,rgba(0,0,0,0) 75%,rgba(0,0,0,0));background-color:#fafafa;-webkit-background-size:22px 22px;background-size:22px 22px;border:5px dashed #ccc}.dropzone .dz-default.dz-message{opacity:1;-ms-filter:none;-webkit-filter:none;filter:none;-webkit-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out;background-image:url(../img/dropzone/spritemap.png);background-repeat:no-repeat;background-position:0 0;position:absolute;width:428px;height:123px;margin-left:-214px;margin-top:-61.5px;top:50%;left:50%}.dropzone .dz-default.dz-message span{display:none}.dropzone.dz-square .dz-default.dz-message{background-position:0 -123px;width:268px;margin-left:-134px;height:174px;margin-top:-87px}.dropzone.dz-drag-hover .dz-message{opacity:.15;-ms-filter:"alpha(Opacity=15)";filter:alpha(opacity=15)}.dropzone.dz-started .dz-message{display:block;opacity:0;-ms-filter:"alpha(Opacity=0)";filter:alpha(opacity=0)}.irs{position:relative;display:block;height:40px}.irs-line{position:relative;display:block;overflow:hidden;height:8px;top:25px;background:#eee}.irs-line-left,.irs-line-mid,.irs-line-right{position:absolute;display:block;top:0;height:8px}.irs-line-left{left:0;width:10%}.irs-line-mid{left:10%;width:80%}.irs-line-right{right:0;width:10%}.irs-diapason{position:absolute;display:block;left:0;width:100%}.irs-slider{position:absolute;display:block;cursor:default;z-index:1;width:10px;height:22px;top:17px;border:1px solid #fff;background:#858585}.irs-slider:hover{background:#6c6c6c}.irs-slider.single{left:10px}.irs-slider.single:before{position:absolute;display:block;content:"";top:-50%;left:-150%;width:400%;height:200%;background:rgba(0,0,0,0)}.irs-slider.from{left:100px}.irs-slider.from:before{position:absolute;display:block;content:"";top:-50%;left:-300%;width:400%;height:200%;background:rgba(0,0,0,0)}.irs-slider.to{left:300px}.irs-slider.to:before{position:absolute;display:block;content:"";top:-50%;left:0;width:400%;height:200%;background:rgba(0,0,0,0)}.irs-slider.last{z-index:2}.irs-max,.irs-min{color:#999;font-size:12px;line-height:1.333;text-shadow:none;top:0;padding:1px 3px;background:rgba(0,0,0,0.1);border-radius:0}.lt-ie9 .irs-max,.lt-ie9 .irs-min{background:#bfbfbf}.irs-min{position:absolute;display:block;left:0;cursor:default}.irs-max{position:absolute;display:block;right:0;cursor:default}.irs-from,.irs-single,.irs-to{position:absolute;display:block;top:0;left:0;cursor:default;white-space:nowrap}.lt-ie9 .irs-from,.lt-ie9 .irs-single,.lt-ie9 .irs-to{background:#999}.irs-grid{position:absolute;display:none;bottom:0;left:0;width:100%;height:20px}.irs-with-grid{height:60px}.irs-with-grid .irs-grid{display:block}.irs-grid-pol{position:absolute;top:0;left:0;width:1px;height:8px;background:#99a4ac}.irs-grid-pol.small{height:4px}.irs-grid-text{position:absolute;bottom:0;left:0;width:100px;white-space:nowrap;text-align:center;font-size:9px;line-height:9px;color:#99a4ac}.irs-diapason{background:#3276b1;height:8px;top:25px}.irs .irs-from,.irs .irs-single,.irs .irs-to{color:#fff;font-size:10px;line-height:1.333;text-shadow:none;padding:1px 5px;background:rgba(0,0,0,0.4);border-radius:0}#irs-active-slider{background:#686868;-webkit-box-shadow:rgba(0,0,0,0.3) 1px 1px 1px 0;box-shadow:rgba(0,0,0,0.3) 1px 1px 1px 0;width:12px;height:24px;top:16px}.google_maps{width:100%;height:350px;position:relative}.google_maps *{box-sizing:content-box;-webkit-box-sizing:content-box;-moz-box-sizing:content-box}.google_maps img{max-width:none}.slider{margin-top:0;margin-bottom:30px}.slider.slider-vertical{margin-bottom:0;margin-right:5px}.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{display:block;min-height:0}.ui-helper-clearfix:after,.ui-helper-clearfix:before{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}* html .ui-helper-clearfix{height:1%}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:alpha(opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;width:16px;height:16px;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget{font-family:Ubuntu,Helvetica,Arial,sans-serif;font-size:13px}.ui-widget :active{outline:0}.ui-widget .ui-widget{font-size:13px}.ui-widget button,.ui-widget input,.ui-widget select,.ui-widget textarea{font-family:Ubuntu,Helvetica,Arial,sans-serif;font-size:inherit}.ui-widget-content{border:1px solid #aaa;background:#fff;color:#404040}.ui-widget-content .ui-icon{background:none!important}.ui-widget-header{font-weight:700;background-color:#f5f5f5;border-color:#DDD;color:#333}.ui-widget-header a{color:#222}.ui-widget-overlay{position:fixed;background:#AAA;width:100%;height:200%;top:0;left:0;z-index:999;opacity:.3;filter:alpha(opacity=30)}.ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa;opacity:.3;filter:alpha(opacity=30);border-radius:8px}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{color:#333;background-color:#fff;font-weight:400;border:1px solid #ccc}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#555;text-decoration:none}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{text-shadow:none}.ui-state-default,.ui-state-error,.ui-state-highlight{position:relative;border-width:1px;border-style:solid}.ui-state-default p,.ui-state-error p,.ui-state-highlight p{font-size:13px;font-weight:400;line-height:18px;margin:7px 15px}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#2d6987}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.ui-state-error a,.ui-state-error-text,.ui-widget-content .ui-state-error a,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error a,.ui-widget-header .ui-state-error-text{color:#953b39}.ui-state-focus,.ui-state-hover,.ui-widget-content .ui-state-focus,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-focus,.ui-widget-header .ui-state-hover{color:#333;background-color:#ebebeb;border-color:#adadad;text-decoration:none}.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited{color:#333;text-decoration:none}.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #adadad;font-weight:400;color:#333}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#333;text-decoration:none}.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,.ui-widget-content .ui-state-disabled .ui-icon,.ui-widget-header .ui-state-disabled .ui-icon{filter:alpha(opacity=35)}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:700}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:alpha(opacity=70);font-weight:400}.ui-corner-all{border-radius:0}.ui-corner-left,.ui-corner-tl,.ui-corner-top{border-top-left-radius:4px}.ui-corner-right,.ui-corner-top,.ui-corner-tr{border-top-right-radius:4px}.ui-corner-bl,.ui-corner-bottom,.ui-corner-left{border-bottom-left-radius:4px}.ui-corner-bottom,.ui-corner-br,.ui-corner-right{border-bottom-right-radius:4px}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}input[type=color].ui-autocomplete-loading,input[type=date].ui-autocomplete-loading,input[type=datetime-local].ui-autocomplete-loading,input[type=datetime].ui-autocomplete-loading,input[type=email].ui-autocomplete-loading,input[type=month].ui-autocomplete-loading,input[type=number].ui-autocomplete-loading,input[type=password].ui-autocomplete-loading,input[type=search].ui-autocomplete-loading,input[type=tel].ui-autocomplete-loading,input[type=text].ui-autocomplete-loading,input[type=time].ui-autocomplete-loading,input[type=url].ui-autocomplete-loading,input[type=week].ui-autocomplete-loading{background-image:url(../img/select2-spinner.gif)!important;background-repeat:no-repeat;background-position:99% 50%;padding-right:27px}.ui-btn-lg{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.ui-btn-sm,.ui-btn-xs{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.ui-btn-xs{padding:1px 5px}.ui-btn-block{display:block;width:100%;padding-right:0;padding-left:0}.ui-btn-block+.ui-btn-block{margin-top:5px}input[type=button].ui-btn-block,input[type=reset].ui-btn-block,input[type=submit].ui-btn-block{width:100%}.ui-button{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid #ccc;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.ui-button:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.ui-button:focus,.ui-button:hover{color:#333;background-color:#ebebeb;border-color:#adadad;text-decoration:none}fieldset[disabled] .ui-button,fieldset[disabled] .ui-button.ui-state-active,fieldset[disabled] .ui-button:active,fieldset[disabled] .ui-button:focus,fieldset[disabled] .ui-button:hover,.ui-button.disabled,.ui-button.disabled.active,.ui-button.disabled:active,.ui-button.disabled:focus,.ui-button.disabled:hover,.ui-button[disabled],.ui-button[disabled].active,.ui-button[disabled]:active,.ui-button[disabled]:focus,.ui-button[disabled]:hover{background-color:#fff;border-color:#ccc}.ui-button-text-icon-primary .ui-button-icon-primary{float:left}.ui-button-text-icon-primary{padding:2px 7px 3px}.ui-button-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.ui-button-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.ui-button-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.ui-button-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.ui-button-inverse{color:#fff;background-color:#222;border-color:#080808}.ui-button-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.ui-button-error{color:#fff;background-color:#c43c35;border-color:#882a25}.ui-button-danger:hover,.ui-button-info:hover,.ui-button-inverse:hover,.ui-button-primary:hover,.ui-button-success:hover,.ui-button-warning:hover{text-decoration:none}.ui-button-primary:focus,.ui-button-primary:hover{color:#fff;background-color:#3276b1;border-color:#285e8e}.ui-button-success:hover{color:#fff;background-color:#47a447;border-color:#398439}.ui-button-info:hover{color:#fff;background-color:#39b3d7;border-color:#269abc}.ui-button-danger:hover{color:#fff;background-color:#d2322d;border-color:#ac2925}.ui-button-warning:hover{color:#fff;background-color:#ed9c28;border-color:#d58512}.ui-button-inverse:hover{color:#fff;background-color:#363636;border-color:#000}.ui-button-icon-only{width:2.2em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button-text-icon-primary .ui-button-icon-primary.ui-icon{margin-top:5px}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999px;display:none}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-icons-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon{margin-bottom:0;margin-top:0;top:50%}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px;margin-right:-6px}.ui-button-icons-only .ui-button-icon-primary,.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary{left:.5em}.ui-button-icons-only .ui-button-icon-secondary,.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-state-active{color:#fff;background-color:#428bca;border-color:#357ebd}.ui-buttonset .ui-state-active.ui-state-hover{color:#fff;background-color:#3276b1;border-color:#285e8e}.ui-buttonset .ui-button{margin-left:0;margin-right:-0.4em}button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-slider{position:relative;text-align:left}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{-webkit-filter:inherit;filter:inherit}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:16px;height:18px;cursor:default}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0;color:#fff;background-color:#0e90d2;background-image:-webkit-gradient(linear,0 0,0 100%,from(#149bdf),to(#0480be));background-image:-webkit-gradient(linear,top left,bottom left,from(#149bdf),to(#0480be));background-image:-webkit-linear-gradient(top,#149bdf,#0480be);background-image:linear-gradient(to bottom,#149bdf,#0480be);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf',endColorstr='#ff0480be',GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:width .6s ease;transition:width .6s ease}.ui-slider-horizontal{height:10px;background:#d5d5d5;border:0}.ui-slider-horizontal .ui-slider-handle{top:-0.2em;margin-left:-0.5em;background-color:#fff;border-color:#CCC}.ui-slider-horizontal .ui-slider-handle:focus{background-color:#fff;border-color:#357ebd}.ui-slider-horizontal .ui-slider-handle:hover{background-color:#fff;border-color:#285e8e;outline:0}.ui-slider-horizontal .ui-slider-handle:active{background-color:#428bca;border-color:#3276b1}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-0.3em;margin-left:0;margin-bottom:-0.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-tabs{position:relative;border:0;border-radius:0}.ui-tabs .ui-tabs-panel{display:block;border-radius:0;background:0}.ui-tabs .ui-tabs-nav{margin-bottom:0;border:solid #ddd;border-width:0 0 1px;border-radius:0;background:0}.ui-tabs .ui-tabs-nav li{position:relative;top:0;float:left;margin-bottom:-1px;margin-right:3px;border:0;list-style:none;white-space:nowrap;background:0;-webkit-filter:none;filter:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active:hover{background:#fff;cursor:text}.ui-tabs .ui-tabs-nav li.ui-tabs-active a{border:1px solid #ddd;border-bottom:1px solid #fff;background-color:#fff;color:#555;font-weight:700;border-top-width:0!important;margin-top:1px!important;-webkit-box-shadow:0 -2px 0 #57889c;box-shadow:0 -2px 0 #57889c}.ui-tabs .ui-tabs-nav li a{float:left;padding:8px 12px;font-weight:400;text-decoration:none;outline:0;background:0;border-radius:0;background-color:#f5f5f5;border:1px solid #f5f5f5;border-bottom:1px solid #ddd;color:#838383}.ui-tabs .ui-tabs-nav li a:hover{border:1px solid #f5f5f5;border-bottom:1px solid #ddd;background-color:#f5f5f5}.ui-tabs .ui-tabs-nav li.ui-state-disabled a,.ui-tabs .ui-tabs-nav li.ui-tabs-active a,.ui-tabs .ui-tabs-nav li.ui-tabs-loading a{cursor:text}.ui-tabs .ui-tabs-nav .ui-state-default{border:0;-webkit-box-shadow:none;box-shadow:none}.ui-tabs .ui-tabs-panel{border:1px solid #ddd;margin:0;padding:10px 13px;border-top:0}.ui-tabs .ui-tabs-hide{display:none!important}.ui-tooltip{display:block;font-size:11px;opacity:.8;position:absolute;visibility:visible;z-index:1024;max-width:200px;background:#000;border:1px solid #000;color:#FFF;padding:3px 8px;text-align:center;text-decoration:none;-webkit-box-shadow:inset 0 1px 0 #000;box-shadow:inset 0 1px 0 #000;border-radius:4px}body .ui-tooltip{border-width:1px}.ui-spinner{position:relative;display:inline-block;overflow:hidden;width:100%;padding:0;vertical-align:middle}.ui-spinner-input{margin:0!important;height:30px;padding:6px 24px 6px 12px;border:0;background:0;vertical-align:middle}.ui-spinner-input.spinner-left{padding:6px 12px 6px 24px}.ui-spinner-input.spinner-left+.ui-spinner-button,.ui-spinner-input.spinner-left+.ui-spinner-button+.ui-spinner-button{right:auto;left:0}.ui-spinner-input.spinner-both{padding:6px 30px}.ui-spinner-input.spinner-both+.ui-spinner-button+.ui-spinner-button{left:0;right:auto}.ui-spinner-input.spinner-both+.ui-spinner-button,.ui-spinner-input.spinner-both+.ui-spinner-button+.ui-spinner-button{height:30px;width:25px}.ui-spinner-input.spinner-both+.ui-spinner-up+.ui-spinner-down:before,.ui-spinner-input.spinner-both+.ui-spinner-up:before{margin-top:8px}.ui-spinner-button{width:19px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:0;border-bottom:0;border-right:0}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-down,.ui-spinner-up{background:#739e73;border-radius:0}.ui-spinner-down:before,.ui-spinner-up:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f067";color:#fff;font-size:14px;margin-top:1px}.ui-spinner-down>:first-child,.ui-spinner-up>:first-child{display:none}.ui-spinner-up{top:0}.ui-spinner-up:active,.ui-spinner-up:focus,.ui-spinner-up:hover{background:#5b835b}.ui-spinner-down{bottom:0;background:#c2032f}.ui-spinner-down:before{content:"\f068"}.ui-spinner-down:active,.ui-spinner-down:focus,.ui-spinner-down:hover{background:#77021d}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-datepicker{width:20em;padding:.2em .2em 0;display:none;z-index:9999!important}.ui-datepicker-inline{z-index:9000!important}.ui-datepicker-header{position:relative;border:0;font-weight:700;width:100%;padding:4px 0;background-color:#f5f5f5;color:gray}.ui-datepicker-next,.ui-datepicker-prev{position:absolute;top:2px;width:5.6em;height:1.8em;text-align:center;margin-top:2px;cursor:pointer}.ui-datepicker-next>:first-child,.ui-datepicker-prev>:first-child{text-indent:0!important}.ui-datepicker-next span,.ui-datepicker-prev span{display:block;position:absolute;text-align:center;top:50%;margin-top:-8px;width:5.8em}.ui-datepicker-prev{left:2px}.ui-datepicker-next{right:2px}.ui-datepicker-title{margin:0 5.8em;line-height:1.8em;text-align:center}.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;border:0;font-weight:700;color:gray}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td:hover{color:#fff}.ui-datepicker td a{margin-bottom:0;border:0}.ui-datepicker td a,.ui-datepicker td span{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker td .ui-state-default{border:0;background:0;margin-bottom:0;padding:5px;color:gray;text-align:center;-webkit-filter:none;filter:none}.ui-datepicker td .ui-state-highlight{color:#fff;background-color:#a90329;text-shadow:0 -1px 0 rgba(0,0,0,0.25);border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);border-radius:0}.ui-datepicker td .ui-state-active{color:#333;background-color:#ebebeb;margin-bottom:0;font-size:normal;text-shadow:0;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);border-radius:0}.ui-datepicker td .ui-state-hover{color:#fff;background:#428bca;background-color:#428bca;text-shadow:0 -1px 0 rgba(0,0,0,0.25);border-color:#357ebd;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);border-radius:0}.ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em;width:auto;overflow:visible}.ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.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-detepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicket-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}.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}.ui-datepicker-cover{display:none;display:block;position:absolute;z-index:-1;-webkit-filter:mask();filter:mask();top:-4px;left:-4px;width:200px;height:200px}.ui-datepicker-today a{background-color:#bfbfbf;cursor:pointer;padding:0 4px;margin-bottom:0}.ui-datepicker-today a:hover{background-color:gray;color:#fff}.ui-progressbar{height:2em;margin-bottom:20px;border:0;overflow:hidden;background-color:#f7f7f7;background-image:-webkit-gradient(linear,0 0,0 100%,from(#f5f5f5),to(#f9f9f9));background-image:-webkit-gradient(linear,top left,bottom left,from(#f5f5f5),to(#f9f9f9));background-image:-webkit-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:linear-gradient(to bottom,#f5f5f5,#f9f9f9);background-repeat:repeat-x;border-radius:0;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#fff9f9f9',GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1)}.ui-progressbar .ui-progressbar-value{margin:0;height:100%;color:#fff;background-color:#428bca;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:width .6s ease;transition:width .6s ease}.ui-progressbar .ui-progressbar-overlay{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px;-webkit-animation:progress-bar-stripes 2s linear infinite;-ms-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;z-index:99999;display:block}.ui-resizable-autohide .ui-resizable-handle,.ui-resizable-disabled .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted #000}.ui-accordion{width:100%}.ui-accordion .ui-accordion-li-fix{display:inline}.ui-accordion .ui-accordion-header{display:block;position:relative;margin-top:-2px;border-color:#ddd!important;padding:10px 15px 10px 36px!important;cursor:pointer;min-height:0;background-color:#fbfbfb;border-radius:0;font-size:15px}.ui-accordion .ui-accordion-header-active{border-bottom:0!important}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-noicons{padding-left:.7em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px;text-indent:0!important;background-image:none!important;text-align:center;line-height:normal;left:12px!important;margin-top:-6px!important;font-size:14px!important}.ui-accordion .ui-accordion-content{margin-top:-3px;border-radius:0;border-top:0 none;border-color:#ddd!important;padding:15px;position:relative;top:1px;margin-bottom:2px;overflow:auto;display:none}.ui-accordion .ui-accordion-content-active{display:block}.ui-accordion-header-active+.ui-accordion-content{border-top:1px solid #ddd}.noUi-target *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-touch-callout:none;-ms-touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;cursor:default}.noUi-target *[disabled] .noUi-base{background:#999}.noUi-target *[disabled] .noUi-connect{background:#BBB}.noUi-base{width:100%;height:14px;position:relative;max-width:100%;max-height:100%;border:1px solid #bfbfbf;z-index:1}.noUi-origin-lower{background:#72a8d7}.noUi-handle{background:#858585;height:30px;width:16px;border:1px solid #fff;margin:-8px 0 0 -8px;cursor:default}.noUi-handle:hover{background:#6c6c6c}.noUi-active{cursor:default;-webkit-box-shadow:rgba(0,0,0,0.1) 1px 1px 1px 0;box-shadow:rgba(0,0,0,0.1) 1px 1px 1px 0;background:#686868;height:32px;width:18px;margin:-9px 0 0 -8px;border:0}.noUi-active:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;content:"";display:block;height:100%;border:1px solid #ddd}.noUi-connect{background:#3276b1}.noUi-background{background:#eee;border:0}.noUi-origin{position:absolute;right:0;top:0;bottom:0;z-index:0}.noUi-origin-upper{background:inherit!important}.noUi-z-index{z-index:10}.noUi-vertical{width:10px;height:100%}.noUi-vertical .noUi-origin{bottom:0;left:0}.noUi-vertical .noUi-handle{margin:-8px 0 0 -3px}.noUi-state-tap .noUi-origin{-webkit-transition:left .3s,top .3s;transition:left .3s,top .3s}.modal-backdrop,.modal-backdrop.fade.in{position:fixed;width:100%;height:100%;z-index:990}.modal-dialog.modal-max{width:98%;max-width:98%}@media only screen and (min-width:768px){.modal-dialog.modal-large{width:80%;max-width:900px}}@media only screen and (min-width:768px){.modal-dialog.modal-medium{width:60%;max-width:650px}}@media only screen and (min-width:768px){.modal-dialog.modal-small{width:40%;max-width:450px}}.modal-dialog .modal-body .modal-viewport{min-height:140px}.modal-dialog .suffix .alert{margin-bottom:0;border-radius:0 0 5px 5px}.modal-title img{margin:0 15px 0 0}.modal-overflow .modal-body{overflow:hidden}.ui-dialog{position:absolute;top:0;left:0;padding:0;width:300px;overflow:hidden;-webkit-background-clip:padding-box;background-clip:padding-box;background-color:#fff;border-radius:3px;-webkit-box-shadow:0 5px 15px rgba(0,0,0,0.5);box-shadow:0 5px 15px rgba(0,0,0,0.5);border:1px solid rgba(0,0,0,0.2);outline:medium none;z-index:1050}.ui-dialog .ui-dialog-titlebar{position:relative;padding:0 10px;background:#fff;border-color:#fff;font-size:18px;text-decoration:none;border:0 0 0 1px solid;border-bottom-right-radius:0;border-bottom-left-radius:0;border-bottom:1px solid #ccc;border-bottom-color:#eee}.ui-dialog .ui-dialog-title{float:left;margin:0;color:#404040;font-weight:700;padding:5px;text-overflow:ellipsis;overflow:hidden}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:19px;margin:-16px 4px 0 0;padding:1px;height:18px;font-size:20px;font-weight:700;line-height:13.5px;text-shadow:0 1px 0 #fff;filter:alpha(opacity=25);-khtml-opacity:.25;-moz-opacity:.25;opacity:.25;background:0;border:0;-webkit-box-shadow:none;box-shadow:none}.ui-dialog .ui-dialog-titlebar-close:before{content:"\f00d";font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:13px}.ui-dialog .ui-dialog-titlebar-close:focus,.ui-dialog .ui-dialog-titlebar-close:hover{padding:1px;filter:alpha(opacity=90);-moz-opacity:.9;opacity:.9}.ui-dialog .ui-dialog-titlebar-close span{display:block;margin:1px;text-indent:9999px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:0;overflow:auto}.ui-dialog .ui-dialog-buttonpane{margin:13px 0 0;padding:19px 15px 20px;border-top:1px solid #eee;border-width:1px 0 0;border-radius:0 0 6px 6px;background-image:none;background-color:#fff;-webkit-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff;text-align:right}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:0 .4em 0 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:14px;height:14px;right:3px;bottom:3px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-dialog-buttonpane .ui-dialog-buttonset .ui-button{color:#fff;background-color:#428bca;border-color:#357ebd}.ui-dialog-buttonpane .ui-dialog-buttonset .ui-button.ui-state-hover{color:#fff;background-color:#3276b1;border-color:#285e8e}.ui-dialog-buttonset .ui-button:not(:first-child){cursor:pointer;display:inline-block;color:#333;background-color:#fff;border:1px solid #ccc;-webkit-transition:.1s linear all;transition:.1s linear all;overflow:visible}.ui-dialog-buttonset .ui-button:not(:first-child) .ui-state-hover{color:#333;background-color:#ebebeb;border-color:#adadad;text-decoration:none}.ui-dialog-buttonset .ui-button.ui-button-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.ui-dialog-buttonset .ui-button.ui-button-info.ui-state-hover{color:#fff;background-color:#39b3d7;border-color:#269abc}.ui-dialog-buttonset .ui-button.ui-button-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.ui-dialog-buttonset .ui-button.ui-button-success.ui-state-hover{color:#fff;background-color:#47a447;border-color:#398439}.ui-dialog-buttonset .ui-button.ui-button-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.ui-dialog-buttonset .ui-button.ui-button-warning.ui-state-hover{color:#fff;background-color:#ed9c28;border-color:#d58512}.ui-dialog-buttonset .ui-button.ui-button-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.ui-dialog-buttonset .ui-button.ui-button-danger.ui-state-hover{color:#fff;background-color:#d2322d;border-color:#ac2925}.ui-dialog-buttonset .ui-button.ui-button-inverse{color:#fff;background-color:#222;border-color:#080808}.ui-dialog-buttonset .ui-button.ui-button-inverse.ui-state-hover{color:#fff;background-color:#363636;border-color:#000}.modal-overflow{position:relative}.modal-overflow .scrollmarker{position:absolute;width:100%;height:20px}.modal-overflow .scrollmarker.top{background:-moz-linear-gradient(top,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#3276b1),color-stop(17%,rgba(50,118,177,0.83)),color-stop(100%,rgba(50,118,177,0)));background:-webkit-linear-gradient(top,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:-o-linear-gradient(top,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:-ms-linear-gradient(top,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:linear-gradient(to bottom,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%)}.modal-overflow .scrollmarker.bottom{background:-moz-linear-gradient(bottom,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:-webkit-gradient(linear,left bottom,left top,color-stop(0%,#3276b1),color-stop(17%,rgba(50,118,177,0.83)),color-stop(100%,rgba(50,118,177,0)));background:-webkit-linear-gradient(bottom,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:-o-linear-gradient(bottom,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:-ms-linear-gradient(bottom,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%);background:linear-gradient(to top,#3276b1 0,rgba(50,118,177,0.83) 17%,rgba(50,118,177,0) 100%)}.pricing-big{border:0!important}.pricing-big .panel-heading{border-radius:5px 5px 0 0}.pricing-big .panel-title{text-transform:capitalize;font-size:18px;padding:20px 0;text-align:center;border-radius:5px 5px 0 0;margin:0;font-weight:700}.pricing-big .the-price{padding:20px 0;background:#333;text-align:center;font-size:24px;font-weight:700;color:#FFF;-webkit-box-shadow:none!important;box-shadow:none!important}.pricing-big .subscript{font-size:18px;color:#999;margin-left:5px}.pricing-big .panel-footer{border-radius:0 0 5px 5px;background-color:#f2f2f2!important}.pricing-big .panel-footer>div{padding:15px 0 10px;display:block;font-size:13px}.pricing-big .panel-footer .btn{padding:15px 0;border-radius:3px;font-weight:700;font-size:14px}.pricing-big .panel-footer .btn span{font-weight:400;font-style:italic}.pricing-big table{background:#fafafa;padding:20px 15px;height:230px;text-align:left}.price-features{background:#fafafa;padding:20px 15px;min-height:230px;font-size:13.5px}.price-features .price-features li+li{margin-top:10px}.superbox *,.superbox :after,.superbox :before{margin:0;padding:0;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-font-smoothing:antialiased;-moz-font-smoothing:antialiased;-o-font-smoothing:antialiased;font-smoothing:antialiased;text-rendering:optimizeLegibility}.superbox-list{display:inline-block;*display:inline;zoom:1;width:12.5%;padding:5px;position:relative}.superbox-list.active:before{content:"\f0d8";font-family:FontAwesome;display:block;position:absolute;left:43%;bottom:-34px;z-index:2;text-align:center;font-size:45px;color:#222}@media only screen and (min-width:320px){.superbox-list{width:50%}}@media only screen and (min-width:486px){.superbox-list{width:25%}}@media only screen and (min-width:768px){.superbox-list{width:16.66666667%}}@media only screen and (min-width:1025px){.superbox-list{width:12.5%}}@media only screen and (min-width:1824px){.superbox-list{width:12.5%}}.superbox-img{max-width:100%;width:100%;cursor:pointer}.superbox-show{text-align:left;position:relative;background-color:#222;width:100%;float:left;padding:25px 0 12px 25px;display:none;margin:5px 0}.superbox-current-img{max-width:100%;float:left;padding-right:25px;padding-bottom:13px}.superbox-img:hover{opacity:.8}.superbox-float{float:left}.superbox-close{opacity:.7;cursor:pointer;position:absolute;top:15px;right:15px;-webkit-transition:all .1s linear 0s;transition:all .1s linear 0s}.superbox-close:hover{opacity:1}.superbox-imageinfo{display:inline-block;max-width:500px;color:#fff;padding:0 25px 0 0}.superbox-imageinfo span{font-size:13px;color:#a19994;margin-right:-2px;padding-top:10px;display:inline-block;padding-bottom:13px}.superbox-imageinfo>:first-child{margin-bottom:10px;font-weight:700}.superbox-imageinfo span p:last-child{margin-top:30px}.bootstrap-tagsinput{display:block;width:100%;min-height:32px;padding:1px 3px;font-size:13px;line-height:1.428571429;color:#555;vertical-align:middle;background-color:#FFF;border:1px solid #CCC;border-radius:0}.bootstrap-tagsinput>span{border-radius:0!important;font-weight:400;padding:3px 28px 4px 8px;font-size:13px;border:1px solid #285e8e;background:#3276b1}.bootstrap-tagsinput input{border:0;-webkit-box-shadow:none;box-shadow:none;outline:0;background-color:transparent;padding:0;margin:0;width:auto!important;max-width:inherit}.bootstrap-tagsinput input:focus{border:0;-webkit-box-shadow:none;box-shadow:none}.bootstrap-tagsinput .tag{color:#FFF;position:relative;margin:3px 0 3px 2px;display:inline-block}.bootstrap-tagsinput .tag [data-role=remove]{display:block;top:-1px;right:0;padding:3px 4px 3px 5px;width:23px;height:22px;position:absolute;cursor:pointer}.bootstrap-tagsinput .tag [data-role=remove]:after{content:"\f057";font-family:fontAwesome;padding:2px 1px;line-height:17px;font-size:15px;text-align:center}.bootstrap-tagsinput .tag [data-role=remove]:hover{background:rgba(0,0,0,0.3);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05)}.bootstrap-tagsinput .tag [data-role=remove]:hover:active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.slider{display:inline-block;vertical-align:middle;position:relative}.slider.slider-horizontal{width:100%!important;height:20px}.slider.slider-horizontal .slider-track{height:10px;width:100%;margin-top:-5px;top:50%;left:0}.slider.slider-horizontal .slider-selection{height:100%;top:0;bottom:0}.slider.slider-horizontal .slider-selection+.slider-handle.triangle+.slider-handle.triangle:before{content:"\f0d9"}.slider.slider-horizontal .slider-handle{margin-left:-10px;margin-top:-5px}.slider.slider-horizontal .slider-handle.triangle{width:20px;height:20px;filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);border:0;line-height:21px;color:#797777;text-shadow:0 1px 0 rgba(255,255,255,0.8)}.slider.slider-horizontal .slider-handle.triangle:before{content:"\f0da";font-size:34px}.slider.slider-vertical{height:210px;width:20px}.slider.slider-vertical .slider-track{width:10px;height:100%;margin-left:-5px;left:50%;top:0}.slider.slider-vertical .slider-selection{width:100%;left:0;top:0;bottom:0}.slider.slider-vertical .slider-selection+.slider-handle.triangle+.slider-handle.triangle:before{content:"\f0d8";text-shadow:0 -1px 0 rgba(255,255,255,0.8)}.slider.slider-vertical .slider-handle{margin-left:-5px;margin-top:-10px}.slider.slider-vertical .slider-handle.triangle{width:20px;height:20px;filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);border:0;line-height:21px;color:#797777;text-shadow:0 -1px 0 rgba(255,255,255,0.8)}.slider.slider-vertical .slider-handle.triangle:before{content:"\f0d7";font-size:32px;text-shadow:0 1px 0 rgba(255,255,255,0.8)}.slider input{display:none}.slider .tooltip-inner{white-space:nowrap}.slider-track{position:absolute;cursor:pointer;background:#e5e5e5}.slider-danger+.slider-track>.slider-selection{background:#a90329}.slider-warning+.slider-track>.slider-selection{background:#c79121}.slider-info+.slider-track>.slider-selection{background:#57889c}.slider-success+.slider-track>.slider-selection{background:#739e73}.slider-selection{position:absolute;background:#3276b1}.slider-handle{position:absolute;width:20px;height:20px;border:1px solid #FFF;background:#858585;display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:400;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;line-height:18px;font-size:10px;color:#ccc;text-shadow:0 1px 0 rgba(77,77,77,0.5);filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.slider-handle:before{content:"\f0c9"}.slider-handle.round{border-radius:20px;width:20px;height:20px}.slider-handle.triangle{background:transparent none}.fd-form-element-hidden{display:none}.fd-slider{width:100%;height:20px;margin:0}.fd-slider-vertical{width:20px;height:100%;margin:0 10px 10px 0}.fd-slider,.fd-slider-vertical{display:block;position:relative;text-decoration:none;border:0 none;-moz-user-select:none;-khtml-user-select:none;-webkit-touch-callout:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.fd-slider-inner{display:none}.fd-slider-bar{position:absolute;display:block;z-index:2;height:6px;width:100%;border:1px solid #bbb;border-bottom:1px solid #fff;border-right:1px solid #fff;margin:0;padding:0;overflow:hidden;line-height:4px;top:8px;border-radius:4px;-webkit-background-clip:padding-box;background-clip:padding-box;background-color:#333}.fd-slider-range{position:absolute;display:block;z-index:3;height:6px;margin:0;padding:0 2px 0 0;overflow:hidden;top:9px;border-radius:2px;-webkit-background-clip:padding-box;background-clip:padding-box;background-color:#eee}.fd-slider-handle{position:absolute;display:block;padding:0;margin:0 0 0 1px;z-index:3;top:5px;left:0;width:12px;height:12px;line-height:1px!important;outline:0 none;background:#eee;border:1px solid #aaa;border-radius:12px;-webkit-user-select:none;-webkit-touch-callout:none;-moz-user-select:none;-moz-user-focus:none;-moz-outline:0 none;-ms-user-select:none;user-select:none}.fd-slider-handle:focus{outline:0 none;border:0 none;-moz-user-focus:normal}.fd-slider-handle:before,.fd-slider-handle:after{opacity:0;-webkit-transition-property:opacity;-webkit-transition-duration:1s;-webkit-transition-delay:1s;transition-property:opacity;transition-duration:1s;transition-delay:1s}button.fd-slider-handle:focus::-moz-focus-inner{border-color:transparent}.oldie .fd-slider-handle:after,.oldie .fd-slider-handle:before{display:none}body.fd-slider-drag-horizontal,body.fd-slider-drag-horizontal *,body.fd-slider-drag-vertical,body.fd-slider-drag-vertical *{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.fd-slider-active .fd-slider-handle :before,.fd-slider-focused .fd-slider-handle :before,.fd-slider-hover .fd-slider-handle :before{display:block;position:absolute;top:-21px;left:-8px;margin:0;width:20px;padding:3px;height:14px;line-height:12px;text-align:center;font-size:10px;font-weight:700;color:#fff;text-shadow:1px 1px 1px #1a3a95;background:#2f6ee0;z-index:1;content:attr(aria-valuetext);border-radius:3px;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-box-shadow:0 0 4px #aaa;box-shadow:0 0 4px #999;opacity:1}.fd-slider-active .fd-slider-handle:after,.fd-slider-focused .fd-slider-handle:after,.fd-slider-hover .fd-slider-handle:after{outline:0;content:"";display:block;position:absolute;top:-9px;left:50%;margin:0 0 0 -5px;background:#2f6ee0;z-index:2;width:10px;height:10px;overflow:hidden;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-o-transform:rotate(45deg);-webkit-box-shadow:0 0 4px #aaa;box-shadow:0 0 4px #aaa;clip:rect(4px,14px,14px,4px);opacity:1}.chart{height:220px;margin:20px 5px 10px 10px}.chart-small{height:100px;width:100%}.chart-large{height:235px;width:100%}.chart-xl{height:297px;width:100%}#flotTip{padding:3px 5px;background-color:#fff;z-index:9999;color:#333;-webkit-box-shadow:0 1px 8px rgba(0,0,0,0.1);box-shadow:0 1px 8px rgba(0,0,0,0.1);font-size:14px;border:1px solid #c1c1c1;-khtml-border-radius:4px;border-radius:4px}#flotTip span{color:#38812d;font-weight:700}.has-legend{margin-top:30px!important}.has-legend-unique{margin-top:19px!important}.legendLabel span{display:block;margin:0 5px}.legendColorBox{padding-left:10px;vertical-align:top;padding-top:5px}.legendColorBox div>div{width:4px;height:4px;border-radius:50%;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box}.morris-hover{position:absolute;z-index:1001}.morris-hover.morris-default-style{border-radius:10px;padding:6px;color:#666;background:rgba(255,255,255,0.8);border:solid 2px rgba(230,230,230,0.8);font-family:Ubuntu,sans-serif;font-size:12px;text-align:center}.morris-hover.morris-default-style .morris-hover-row-label{font-weight:700;margin:.25em 0}.morris-hover.morris-default-style .morris-hover-point{white-space:nowrap;margin:.1em 0}.easyPieChart{position:relative;text-align:center}.easyPieChart canvas{position:absolute;top:0;left:0}.easy-pie-chart{display:inline-block}.easy-pie-chart .percent{color:#444;font-size:12px;font-weight:700}.easy-pie-title{display:inline-block;margin:10px 6px 0;font-size:12px;font-weight:400;text-transform:uppercase;width:100px;height:19px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.easy-pie-title .icon-color-bad,.easy-pie-title .icon-color-good{font-size:18px}.show-stat-buttons{float:left;width:100%}@media(max-width:767px){.show-stat-buttons{padding-left:10px!important;padding-right:10px!important}}@media only screen and (min-width:0) and (max-width:679px){.show-stat-buttons{padding-left:10px!important;padding-right:10px!important}}@media only screen and (min-width:320px) and (max-width:479px){.show-stat-buttons{padding-left:10px!important;padding-right:10px!important}}.show-stats{padding-top:6px!important}.show-stats .progress{height:7px;border-radius:0;margin-top:3px;margin-bottom:15px}.show-stats .show-stat-buttons>:first-child{padding-right:5px}@media(max-width:979px){.show-stats .show-stat-buttons>:first-child{padding-right:13px}}.show-stats .show-stat-buttons>:last-child{padding-left:5px}@media(max-width:979px){.show-stats .show-stat-buttons>:last-child{padding-left:13px}}.show-stat-microcharts{margin-left:-10px;margin-right:-10px}.show-stat-microcharts>div{border-right:1px solid #dadada!important;border-top:1px solid #dadada!important;margin-top:10px!important;height:65px;overflow:hidden;padding:7px 9px}@media(max-width:767px){.show-stat-microcharts>div{margin-top:0!important;border-right:0!important}}@media only screen and (min-width:0) and (max-width:679px){.show-stat-microcharts>div{margin-top:0!important;border-right:0!important}}@media only screen and (min-width:320px) and (max-width:479px){.show-stat-microcharts>div{margin-top:0!important;border-right:0!important}}.show-stat-microcharts>:last-child{border-right:0!important}.show-stat-microcharts .sparkline{margin-top:10px;margin-right:8px;opacity:.7}.show-stat-microcharts .sparkline:hover{opacity:1}.smaller-stat{margin:0;padding:0;list-style:none}.smaller-stat li{margin-top:3px;margin-right:0}.smaller-stat li:first-child{margin-top:8px}.smaller-stat span.label{width:40px;display:block;text-align:left;opacity:.5;cursor:default}.smaller-stat span.label:hover{opacity:1}.jvectormap-label{position:absolute;display:none;border:solid 1px #cdcdcd;border-radius:3px;background:#292929;color:#fff;font-family:Ubuntu,sans-serif,Verdana;font-size:smaller;padding:3px}.jvectormap-zoomin{top:0}.jvectormap-zoomout{top:24px}.jvectormap-zoomin,.jvectormap-zoomout{position:absolute;background:#292929;padding:4px;width:22px;height:22px;cursor:pointer;line-height:10px;text-align:center;font-size:14px;border-radius:2px;box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05);-webkit-box-shadow:inset 0 -2px 0 rgba(0,0,0,0.05);background-color:#fff;border:1px solid #bfbfbf}.jvectormap-zoomin:hover,.jvectormap-zoomout:hover{background:#eee;border-color:#d9d9d9}.vector-map{height:300px;width:100%;padding:10px}#chat-container{position:absolute;width:250px;height:270px;z-index:2;border-left:1px solid #cdcecf;right:-251px;top:0;background:#fff;transition-duration:.25s;-webkit-transition-duration:.25s}#chat-container:hover,#chat-container:hover .chat-list-open-close{border-color:#a7a7a7}#chat-container *,#chat-container :after,#chat-container :before{box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box}#chat-container input[type=text]{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}#chat-container.open{right:0;top:0}#chat-container.open .chat-list-open-close i:before{content:"\f00d"!important}#chat-container.open .chat-list-open-close b{display:none}#chat-container .chat-list-open-close{display:block;width:25px;height:25px;border:1px solid #cdcecf;border-right:1px solid #f2f4f8!important;position:absolute;left:-32px;top:7%;border-radius:50% 0 0 50%;padding:3px 1px 3px 5px;font-size:21px;line-height:22px;cursor:pointer;color:#868686;-webkit-box-shadow:inset 0 .2em 0 rgba(0,0,0,0.05);box-shadow:inset 0 .2em 0 rgba(0,0,0,0.05);background:#f2f4f8;text-align:center}#chat-container .chat-list-open-close b{position:absolute;right:0;background:#ed1c24;line-height:9px;height:10px;width:10px;top:3px;border:1px solid #FFF;border-radius:3px;font-size:9px;text-align:center;vertical-align:middle;color:#fff;font-weight:400}#chat-container .chat-list-body{height:217px;overflow-y:scroll;overflow-x:hidden;display:block;padding:0;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;background:#f2f4f8}#chat-container #chat-users{list-style:none;margin:10px 0;padding:0}#chat-container #chat-users li{margin-bottom:3px;margin-left:5px}#chat-container #chat-users li a{display:block;font-size:13px;color:#3d3d3d;text-decoration:none!important;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding:3px 8px 3px 3px;line-height:33px;vertical-align:middle}#chat-container #chat-users li a:hover{background:#e0e4ee}#chat-container #chat-users li a img{width:33px;height:auto;margin-right:10px}#chat-container #chat-users li a i{color:#acacac;font-size:8px;line-height:34px;font-style:normal}#chat-container #chat-users li a i.last-online{font-size:12px;letter-spacing:-1px}#chat-container .chat-list-footer{overflow:hidden;border-top:1px solid #CCC;padding:10px;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}#chat-container .chat-list-footer input[type=text]{border:1px solid #bababa!important}#chat-container .control-group{padding:0}.chat-body{background:#fafafa;background:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJod…EiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fafafa),color-stop(100%,#fff));background:-webkit-linear-gradient(top,#fafafa 0,#fff 100%);background:-webkit-gradient(linear,top left,bottom left,from(#f5fcff),to(#fff));background:-webkit-linear-gradient(top,#f5fcff 0,#fff 100%);background:linear-gradient(to bottom,#f5fcff 0,#fff 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fafafa',endColorstr='#ffffff',GradientType=0);-webkit-box-shadow:inset 2px 2px 5px rgba(0,0,0,0.04);box-shadow:inset 2px 2px 5px rgba(0,0,0,0.04);display:block;height:270px;overflow-y:scroll;overflow-x:hidden;padding:10px;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;border:1px solid #fff;border-top:0}.chat-body ul{margin:0;padding:0}.chat-body li:first-child{margin-top:10px}.chat-body li.message{display:block;position:relative;margin:20px 20px 0}.chat-body li.message img{display:inline-block;border-left:4px solid #fff;position:absolute}.chat-body li.message img.online{border-left-color:#00a300}.chat-body li.message img.offline{border-left-color:#ddd}.chat-body li.message img.busy{border-left-color:#a90329}.chat-body li.message img.away{border-left-color:#ffc40d}.chat-body li.message .message-text{display:inline-block;vertical-align:top;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding:0;margin-left:65px;line-height:normal}.chat-body li.message .message-text time{position:absolute;top:1px;right:0;font-size:10px;line-height:10px;color:#afafaf}.chat-body li.message .message-text .chat-file{display:block;margin:3px 0;padding:4px;border:1px dotted #ddd;background:rgba(0,0,0,0.05);border-radius:4px;text-align:right;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.chat-body li.message .message-text .chat-file:nth-child(3){margin-top:15px}.chat-body li.message .message-text .chat-file.row-fluid [class*=span]{min-height:10px!important}.chat-body li.message .message-text .chat-file b{font-style:italic;white-space:nowrap;width:250px;overflow:hidden;text-overflow:ellipsis;text-align:left}@media(min-width:768px) and (max-width:880px){.chat-body li.message .message-text .chat-file b{width:150px}}@media only screen and (min-width:320px) and (max-width:479px){.chat-body li.message .message-text .chat-file b{width:150px}}@media(max-width:480px){.chat-body li.message .message-text .chat-file b{width:150px}}.chat-body li.message .message-text a.username{display:block;font-weight:700;margin-bottom:4px;vertical-align:top;line-height:14px;font-size:14px;letter-spacing:-1px;text-decoration:none!important}.chat-footer{border-top:1px solid rgba(0,0,0,0.1);background:rgba(248,248,248,0.9);padding:0 10px 15px;position:relative;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.profile-message{background:none!important;height:auto!important;box-shadow:none!important;-webkit-box-shadow:none!important;overflow:hidden}.profile-message li.message.message-reply{margin-left:85px!important;background:#f7f7f7;padding:10px;margin:3px 0 0 20px}.profile-message li.message.message-reply img{width:35px!important}.profile-message li.message.message-reply .message-text{margin-left:45px!important}.profile-message .wall-comment-reply{margin-left:85px;margin-bottom:20px}.cajita img{width:23px;height:23px;padding-left:3px;padding-top:3px}#pageslide{display:none;position:absolute;position:fixed;top:0;height:100%;z-index:999999;width:305px;padding:20px;background-color:#004d60;color:#FFF;-webkit-box-shadow:inset 0 0 5px 5px #222;-moz-shadow:inset 0 0 0 0 #222;box-shadow:inset 0 0 0 0 #222}.purehtml{color:#fff;font-size:16px}#inbox-table{font-size:13px;border-top:0;border-left-color:transparent!important;border-right-color:transparent!important}#inbox-table tbody tr:hover{cursor:pointer;background:#e4e4e4}#inbox-table tr td{border-right:0;border-left:0;line-height:26px;padding:6px 4px 7px!important}#inbox-table .inbox-table-icon{padding-left:15px!important}@media(max-width:979px){#inbox-table .inbox-table-icon{padding-left:10px!important}}#inbox-table tbody tr th{overflow:hidden}#inbox-table.table tbody>tr>td{border-color:#fff!important}#inbox-table .checkbox,#inbox-table .radio{margin-top:-1px;margin-bottom:0}.minified .inbox-badge{border-radius:50%;font-size:9px;padding:2px;position:absolute;top:6px;right:6px;background:#ed1c24;min-width:13px}.inbox-body{position:relative}.inbox-body .table-wrap{background:#fff;padding:10px 14px 7px;position:relative;margin-left:200px}@media(max-width:1024px){.inbox-body .table-wrap{margin-left:0!important}}@media(max-width:979px){.inbox-body .table-wrap{padding:0!important}}.inbox-body.no-content-padding{margin-top:0;background:#fff}.inbox-nav-bar{height:70px;margin-bottom:0;padding:20px 14px;background:#fff}@media(max-width:979px){.inbox-nav-bar{padding-left:5px;padding-right:5px}}@media(min-width:768px) and (max-width:880px){.inbox-nav-bar.no-content-padding{margin-top:-10px!important}}@media(max-width:767px){.inbox-nav-bar.no-content-padding{margin-top:-10px!important}}@media only screen and (min-width:0) and (max-width:679px){.inbox-nav-bar.no-content-padding{margin-top:-10px!important}}@media only screen and (min-width:320px) and (max-width:479px){.inbox-nav-bar.no-content-padding{margin-top:-10px!important}}.inbox-nav-bar .page-title{display:inline-block;margin:0;width:196px;line-height:33px;vertical-align:middle}.inbox-footer{height:52px;padding:15px 14px 0;border-top:1px solid #cecece;background:#2a2725;position:absolute;bottom:-53px;width:100%}.inbox-footer .btn-group,.inbox-paging{margin-left:10px}.inbox-data-attachment,.inbox-table-icon{width:28px;text-align:left;padding-left:12px!important;padding-right:0!important}.inbox-data-from{width:200px}.inbox-data-from>:first-child{width:200px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.inbox-data-date{width:80px;padding-left:7px!important;padding-right:0!important}.inbox-data-message>:first-child{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;height:27px;color:#8a8a8a}@media(max-width:979px){.inbox-data-message>:first-child{height:50px;overflow:hidden}}.inbox-data-message>:first-child span{color:#111}.inbox-data-message>:first-child span.label{color:#fff}@media(max-width:979px){.inbox-data-message>:first-child>:first-child{display:block!important;font-size:14px}}.inbox-data-message>:first-child>:first-child:after{content:" - "}.inbox-checkbox-triggered{display:inline-block}.inbox-checkbox-triggered>.btn-group{margin-right:10px}.inbox-checkbox-triggered>.btn-group .btn{padding-left:14px;padding-right:14px}@media(max-width:979px){.inbox-checkbox-triggered>.btn-group .btn{padding-left:10px;padding-right:10px}}.inbox-side-bar{height:100%;position:absolute;background:#fff;display:block;width:200px;padding:10px 0 10px 14px}@media(max-width:1024px){.inbox-side-bar{display:none!important}}.inbox-side-bar h6{font-weight:400;font-size:11px;display:block;padding:0 15px;text-transform:uppercase;color:#838383}.inbox-side-bar h6 a{font-size:14px;margin-top:-2px}.inbox-side-bar h6 .tooltip{text-transform:none!important}.inbox-side-bar>.btn{margin-bottom:35px}.inbox-side-bar .input-group{margin-bottom:25px}.inbox-space{display:block;width:185px}.inbox-space>.progress{margin-top:5px}.inbox .inbox-menu-lg{list-style:none;padding:0;margin:0 0 20px}.inbox .inbox-menu-lg .inbox-menu-lg li{display:block;width:100%}.inbox .inbox-menu-lg .inbox-menu-lg li a{display:block;padding:6px 15px 7px;font-size:13px;color:#333}.inbox .inbox-menu-lg .inbox-menu-lg li a:hover{text-decoration:none;background:#f4f4f4}.inbox .inbox-menu-lg .inbox-menu-lg li.active a{font-weight:700;background:#f0f0f0;border-bottom:1px solid #e7e7e7;color:#3276b1}.inbox .inbox-menu-sm{list-style:none;padding:0;margin:0 0 20px}.inbox .inbox-menu-sm .inbox-menu-sm li{display:block;width:100%}.inbox .inbox-menu-sm .inbox-menu-sm li a{display:block;padding:8px 15px 10px;font-size:13px;color:#333}.inbox .inbox-menu-sm .inbox-menu-sm li a:hover{text-decoration:none;background:#f4f4f4}.inbox .inbox-menu-sm .inbox-menu-sm li.active a{font-weight:700;background:#f0f0f0;border-bottom:1px solid #e7e7e7;color:#3276b1}.inbox-info-bar{padding:10px 0;border-bottom:1px solid #bfbfbf}.inbox-info-bar .form-group{margin:0}.inbox-info-bar .form-group input,.inbox-info-bar .select2-container-multi .select2-choices{border-color:#fff!important}.inbox-info-bar .select2-choices>div{display:none}.inbox-info-bar .col-md-1,.inbox-info-bar .col-md-11{padding-left:0;padding-right:0}@media(max-width:1024px){.inbox-info-bar .col-md-1,.inbox-info-bar .col-md-11{padding-left:26px;padding-right:26px}}.inbox-info-bar img{width:35px;height:auto;display:inline-block;vertical-align:middle;margin-right:7px;margin-left:2px;border-left:3px solid #fff}.inbox-info-bar em{position:absolute;top:6px;right:20px;text-align:right;font-style:normal}.inbox-download .inbox-message{padding:15px 4px;border-bottom:1px solid #bfbfbf}.inbox-download-list{list-style:none;margin:5px 0 0;padding:0}.inbox-download-list li{display:inline-block;margin:0 5px 0 0;vertical-align:top}.inbox-download-list li>:first-child{margin-bottom:0;width:150px;overflow:hidden}.inbox-download-list li>:first-child:hover{background:#fff;border-color:silver}.inbox-download-list li>:first-child>:first-child{text-align:center;display:block;color:#d6d6d6}.inbox-download-list li>:first-child>:first-child>.fa{font-size:150px}.inbox-download-list li>:first-child>:first-child>img{max-width:120px}.inbox-compose-footer{padding:10px;background:#f5f5f5;border-bottom:1px solid #a9a9a9}.inbox-compose-footer,.inbox-download,.inbox-info-bar,.inbox-message{margin-right:240px;position:relative}@media(max-width:1280px){.inbox-compose-footer,.inbox-download,.inbox-info-bar,.inbox-message{margin-right:0}}@media(max-width:979px){.inbox-table-icon>:first-child{margin-top:12px}}.unread td{background:#fff}.unread .inbox-data-date>:first-child,.unread .inbox-data-from>:first-child,.unread .inbox-data-message>:first-child>:first-child{font-weight:700}tr.highlight td,tr.unread.highlight td{background:#ffc!important;color:#333}#compose-mail-mini{margin-left:4px}.email-open-header{margin:-10px 0 0 0;font-size:20px;border-bottom:1px solid #bfbfbf;border-top:1px solid #eee;padding:15px 3px}.email-open-header>span{font-size:10px;font-weight:400;padding:3px 5px;letter-spacing:normal;text-transform:uppercase;vertical-align:middle;line-height:33px;background:#acacac}.email-infobox{display:block;width:180px;border-bottom:1px solid #bfbfbf;padding-bottom:0;padding-top:15px;position:absolute;top:65px;right:15px}@media(max-width:1280px){.email-infobox .email-infobox{display:none}}.email-reply-text>div{border-left:1px solid #d6d6d6;padding-left:10px;margin-left:50px;color:#a9a9a9}.email-reply-text>:first-child{padding-left:45px}.profile-pic{text-align:right}.profile-pic>img{border-radius:0;position:relative;border:5px solid #fff;top:-30px;display:inline-block;text-align:right;z-index:4;width:120px;margin-bottom:-30px}.profile-carousel .carousel-inner{max-height:150px}.friends-list li{margin-bottom:10px}.friends-list li img{width:35px;border:1px solid #fff;outline:1px solid #bfbfbf}.search-results{padding:18px 5px}.search-results+.search-results{border-top:1px dashed #e3e3e3}.search-results>:first-child{margin-bottom:4px;font-weight:400}.search-results>:first-child a{text-decoration:underline}.search-results .url{font-style:normal;font-size:14px}.search-results img{display:inline-block;margin-top:4px;margin-right:4px;width:80px}.search-results>div{display:inline-block;vertical-align:top}.search-results .note{margin:0;line-height:normal}.search-results .note a{text-decoration:none!important;color:#333}.search-results .note a:hover{color:#ed1c24}.todo{margin:0;padding:0;min-height:5px;list-style:none}.todo>li{display:block;position:relative;overflow:hidden;border-bottom:1px solid #e7e7e7;margin:0 5px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAQCAYAAADagWXwAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0IDc5LjE1MTQ4MSwgMjAxMy8wMy8xMy0xMjowOToxNSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo0RkQ1OEY4NTM4NUIxMUUzQjdCMUMxQzJCQUE3MTMxOCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo0RkQ1OEY4NjM4NUIxMUUzQjdCMUMxQzJCQUE3MTMxOCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjRGRDU4RjgzMzg1QjExRTNCN0IxQzFDMkJBQTcxMzE4IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjRGRDU4Rjg0Mzg1QjExRTNCN0IxQzFDMkJBQTcxMzE4Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+pTD+wgAAACtJREFUeNpimDBhwn8gYABhdDYjiIELMDHgAUwTJ06Ea0VnjxpLO2MBAgwAGYZLegQbQ3UAAAAASUVORK5CYII=) 1px 11px no-repeat}.todo>li:last-child,.todo>li:only-child{border-bottom:0}.todo>li>:first-child{display:block;border-right:1px solid #ffe1eb;height:100%;padding:6px 11px 6px 18px;width:20px;vertical-align:top;position:absolute}.todo>li>:first-child:hover{cursor:move}.todo>li.complete{background:0}.todo>li.complete.complete>:first-child:hover{cursor:default}.todo>li.complete>*{text-decoration:line-through;font-style:italic}.todo>li.ui-sortable-helper{border-top:1px solid #eee;background:rgba(113,132,63,0.1)}.todo>li>p{height:100%;margin-left:52px;border-left:1px solid #ffe1eb;display:inline-block;padding:8px 0 6px 7px;margin-bottom:0;min-height:37px;line-height:normal;font-size:14px;font-weight:500;color:#333}.todo>li>p>span{display:block;line-height:12px;font-size:10px;font-weight:400}.todo>li>p>:first-child{margin-top:-5px;color:#999;margin-bottom:4px}.todo>li>p>.date{color:#bfbfbf}.todo-group-title{margin:0;line-height:31px;padding:0 0 0 10px;background:#fafafa;border-bottom:1px solid #e7e7e7;border-top:1px solid #f4f4f4;color:#999} \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/AddOnManager.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/AddOnManager.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,265 @@ +/** + * AddOnManager.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles the loading of themes/plugins or other add-ons and their language packs. + * + * @class tinymce.AddOnManager + */ +define("tinymce/AddOnManager", [ + "tinymce/dom/ScriptLoader", + "tinymce/util/Tools" +], function(ScriptLoader, Tools) { + var each = Tools.each; + + function AddOnManager() { + var self = this; + + self.items = []; + self.urls = {}; + self.lookup = {}; + } + + AddOnManager.prototype = { + /** + * Returns the specified add on by the short name. + * + * @method get + * @param {String} name Add-on to look for. + * @return {tinymce.Theme/tinymce.Plugin} Theme or plugin add-on instance or undefined. + */ + get: function(name) { + if (this.lookup[name]) { + return this.lookup[name].instance; + } else { + return undefined; + } + }, + + dependencies: function(name) { + var result; + + if (this.lookup[name]) { + result = this.lookup[name].dependencies; + } + + return result || []; + }, + + /** + * Loads a language pack for the specified add-on. + * + * @method requireLangPack + * @param {String} name Short name of the add-on. + * @param {String} languages Optional comma or space separated list of languages to check if it matches the name. + */ + requireLangPack: function(name, languages) { + var language = AddOnManager.language; + + if (language && AddOnManager.languageLoad !== false) { + if (languages) { + languages = ',' + languages + ','; + + // Load short form sv.js or long form sv_SE.js + if (languages.indexOf(',' + language.substr(0, 2) + ',') != -1) { + language = language.substr(0, 2); + } else if (languages.indexOf(',' + language + ',') == -1) { + return; + } + } + + ScriptLoader.ScriptLoader.add(this.urls[name] + '/langs/' + language + '.js'); + } + }, + + /** + * Adds a instance of the add-on by it's short name. + * + * @method add + * @param {String} id Short name/id for the add-on. + * @param {tinymce.Theme/tinymce.Plugin} addOn Theme or plugin to add. + * @return {tinymce.Theme/tinymce.Plugin} The same theme or plugin instance that got passed in. + * @example + * // Create a simple plugin + * tinymce.create('tinymce.plugins.TestPlugin', { + * TestPlugin: function(ed, url) { + * ed.on('click', function(e) { + * ed.windowManager.alert('Hello World!'); + * }); + * } + * }); + * + * // Register plugin using the add method + * tinymce.PluginManager.add('test', tinymce.plugins.TestPlugin); + * + * // Initialize TinyMCE + * tinymce.init({ + * ... + * plugins: '-test' // Init the plugin but don't try to load it + * }); + */ + add: function(id, addOn, dependencies) { + this.items.push(addOn); + this.lookup[id] = {instance: addOn, dependencies: dependencies}; + + return addOn; + }, + + createUrl: function(baseUrl, dep) { + if (typeof dep === "object") { + return dep; + } else { + return {prefix: baseUrl.prefix, resource: dep, suffix: baseUrl.suffix}; + } + }, + + /** + * Add a set of components that will make up the add-on. Using the url of the add-on name as the base url. + * This should be used in development mode. A new compressor/javascript munger process will ensure that the + * components are put together into the plugin.js file and compressed correctly. + * + * @method addComponents + * @param {String} pluginName name of the plugin to load scripts from (will be used to get the base url for the plugins). + * @param {Array} scripts Array containing the names of the scripts to load. + */ + addComponents: function(pluginName, scripts) { + var pluginUrl = this.urls[pluginName]; + + each(scripts, function(script) { + ScriptLoader.ScriptLoader.add(pluginUrl + "/" + script); + }); + }, + + /** + * Loads an add-on from a specific url. + * + * @method load + * @param {String} name Short name of the add-on that gets loaded. + * @param {String} addOnUrl URL to the add-on that will get loaded. + * @param {function} callback Optional callback to execute ones the add-on is loaded. + * @param {Object} scope Optional scope to execute the callback in. + * @example + * // Loads a plugin from an external URL + * tinymce.PluginManager.load('myplugin', '/some/dir/someplugin/plugin.js'); + * + * // Initialize TinyMCE + * tinymce.init({ + * ... + * plugins: '-myplugin' // Don't try to load it again + * }); + */ + load: function(name, addOnUrl, callback, scope) { + var self = this, url = addOnUrl; + + function loadDependencies() { + var dependencies = self.dependencies(name); + + each(dependencies, function(dep) { + var newUrl = self.createUrl(addOnUrl, dep); + + self.load(newUrl.resource, newUrl, undefined, undefined); + }); + + if (callback) { + if (scope) { + callback.call(scope); + } else { + callback.call(ScriptLoader); + } + } + } + + if (self.urls[name]) { + return; + } + + if (typeof addOnUrl === "object") { + url = addOnUrl.prefix + addOnUrl.resource + addOnUrl.suffix; + } + + if (url.indexOf('/') !== 0 && url.indexOf('://') == -1) { + url = AddOnManager.baseURL + '/' + url; + } + + self.urls[name] = url.substring(0, url.lastIndexOf('/')); + + if (self.lookup[name]) { + loadDependencies(); + } else { + ScriptLoader.ScriptLoader.add(url, loadDependencies, scope); + } + } + }; + + AddOnManager.PluginManager = new AddOnManager(); + AddOnManager.ThemeManager = new AddOnManager(); + + return AddOnManager; +}); + +/** + * TinyMCE theme class. + * + * @class tinymce.Theme + */ + +/** + * This method is responsible for rendering/generating the overall user interface with toolbars, buttons, iframe containers etc. + * + * @method renderUI + * @param {Object} obj Object parameter containing the targetNode DOM node that will be replaced visually with an editor instance. + * @return {Object} an object with items like iframeContainer, editorContainer, sizeContainer, deltaWidth, deltaHeight. + */ + +/** + * Plugin base class, this is a pseudo class that describes how a plugin is to be created for TinyMCE. The methods below are all optional. + * + * @class tinymce.Plugin + * @example + * tinymce.PluginManager.add('example', function(editor, url) { + * // Add a button that opens a window + * editor.addButton('example', { + * text: 'My button', + * icon: false, + * onclick: function() { + * // Open window + * editor.windowManager.open({ + * title: 'Example plugin', + * body: [ + * {type: 'textbox', name: 'title', label: 'Title'} + * ], + * onsubmit: function(e) { + * // Insert content when the window form is submitted + * editor.insertContent('Title: ' + e.data.title); + * } + * }); + * } + * }); + * + * // Adds a menu item to the tools menu + * editor.addMenuItem('example', { + * text: 'Example plugin', + * context: 'tools', + * onclick: function() { + * // Open window with a specific url + * editor.windowManager.open({ + * title: 'TinyMCE site', + * url: 'http://www.tinymce.com', + * width: 800, + * height: 600, + * buttons: [{ + * text: 'Close', + * onclick: 'close' + * }] + * }); + * } + * }); + * }); + */ diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/Compat.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/Compat.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,84 @@ +/** + * Compat.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * TinyMCE core class. + * + * @static + * @class tinymce + * @borrow-members tinymce.EditorManager + * @borrow-members tinymce.util.Tools + */ +define("tinymce/Compat", [ + "tinymce/dom/DOMUtils", + "tinymce/dom/EventUtils", + "tinymce/dom/ScriptLoader", + "tinymce/AddOnManager", + "tinymce/util/Tools", + "tinymce/Env" +], function(DOMUtils, EventUtils, ScriptLoader, AddOnManager, Tools, Env) { + var tinymce = window.tinymce; + + /** + * @property {tinymce.dom.DOMUtils} DOM Global DOM instance. + * @property {tinymce.dom.ScriptLoader} ScriptLoader Global ScriptLoader instance. + * @property {tinymce.AddOnManager} PluginManager Global PluginManager instance. + * @property {tinymce.AddOnManager} ThemeManager Global ThemeManager instance. + */ + tinymce.DOM = DOMUtils.DOM; + tinymce.ScriptLoader = ScriptLoader.ScriptLoader; + tinymce.PluginManager = AddOnManager.PluginManager; + tinymce.ThemeManager = AddOnManager.ThemeManager; + + tinymce.dom = tinymce.dom || {}; + tinymce.dom.Event = EventUtils.Event; + + Tools.each(Tools, function(func, key) { + tinymce[key] = func; + }); + + Tools.each('isOpera isWebKit isIE isGecko isMac'.split(' '), function(name) { + tinymce[name] = Env[name.substr(2).toLowerCase()]; + }); + + return {}; +}); + +// Describe the different namespaces + +/** + * Root level namespace this contains classes directly releated to the TinyMCE editor. + * + * @namespace tinymce + */ + +/** + * Contains classes for handling the browsers DOM. + * + * @namespace tinymce.dom + */ + +/** + * Contains html parser and serializer logic. + * + * @namespace tinymce.html + */ + +/** + * Contains the different UI types such as buttons, listboxes etc. + * + * @namespace tinymce.ui + */ + +/** + * Contains various utility classes such as json parser, cookies etc. + * + * @namespace tinymce.util + */ diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/Editor.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/Editor.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,2070 @@ +/** + * Editor.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*jshint scripturl:true */ + +/** + * Include the base event class documentation. + * + * @include ../../../tools/docs/tinymce.Event.js + */ + +/** + * This class contains the core logic for a TinyMCE editor. + * + * @class tinymce.Editor + * @mixes tinymce.util.Observable + * @example + * // Add a class to all paragraphs in the editor. + * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'someclass'); + * + * // Gets the current editors selection as text + * tinymce.activeEditor.selection.getContent({format: 'text'}); + * + * // Creates a new editor instance + * var ed = new tinymce.Editor('textareaid', { + * some_setting: 1 + * }, tinymce.EditorManager); + * + * // Select each item the user clicks on + * ed.on('click', function(e) { + * ed.selection.select(e.target); + * }); + * + * ed.render(); + */ +define("tinymce/Editor", [ + "tinymce/dom/DOMUtils", + "tinymce/dom/DomQuery", + "tinymce/AddOnManager", + "tinymce/NodeChange", + "tinymce/html/Node", + "tinymce/dom/Serializer", + "tinymce/html/Serializer", + "tinymce/dom/Selection", + "tinymce/Formatter", + "tinymce/UndoManager", + "tinymce/EnterKey", + "tinymce/ForceBlocks", + "tinymce/EditorCommands", + "tinymce/util/URI", + "tinymce/dom/ScriptLoader", + "tinymce/dom/EventUtils", + "tinymce/WindowManager", + "tinymce/html/Schema", + "tinymce/html/DomParser", + "tinymce/util/Quirks", + "tinymce/Env", + "tinymce/util/Tools", + "tinymce/EditorObservable", + "tinymce/Shortcuts" +], function( + DOMUtils, DomQuery, AddOnManager, NodeChange, Node, DomSerializer, Serializer, + Selection, Formatter, UndoManager, EnterKey, ForceBlocks, EditorCommands, + URI, ScriptLoader, EventUtils, WindowManager, + Schema, DomParser, Quirks, Env, Tools, EditorObservable, Shortcuts +) { + // Shorten these names + var DOM = DOMUtils.DOM, ThemeManager = AddOnManager.ThemeManager, PluginManager = AddOnManager.PluginManager; + var extend = Tools.extend, each = Tools.each, explode = Tools.explode; + var inArray = Tools.inArray, trim = Tools.trim, resolve = Tools.resolve; + var Event = EventUtils.Event; + var isGecko = Env.gecko, ie = Env.ie; + + /** + * Include documentation for all the events. + * + * @include ../../../tools/docs/tinymce.Editor.js + */ + + /** + * Constructs a editor instance by id. + * + * @constructor + * @method Editor + * @param {String} id Unique id for the editor. + * @param {Object} settings Settings for the editor. + * @param {tinymce.EditorManager} editorManager EditorManager instance. + * @author Moxiecode + */ + function Editor(id, settings, editorManager) { + var self = this, documentBaseUrl, baseUri; + + documentBaseUrl = self.documentBaseUrl = editorManager.documentBaseURL; + baseUri = editorManager.baseURI; + + /** + * Name/value collection with editor settings. + * + * @property settings + * @type Object + * @example + * // Get the value of the theme setting + * tinymce.activeEditor.windowManager.alert("You are using the " + tinymce.activeEditor.settings.theme + " theme"); + */ + self.settings = settings = extend({ + id: id, + theme: 'modern', + delta_width: 0, + delta_height: 0, + popup_css: '', + plugins: '', + document_base_url: documentBaseUrl, + add_form_submit_trigger: true, + submit_patch: true, + add_unload_trigger: true, + convert_urls: true, + relative_urls: true, + remove_script_host: true, + object_resizing: true, + doctype: '', + visual: true, + font_size_style_values: 'xx-small,x-small,small,medium,large,x-large,xx-large', + + // See: http://www.w3.org/TR/CSS2/fonts.html#propdef-font-size + font_size_legacy_values: 'xx-small,small,medium,large,x-large,xx-large,300%', + forced_root_block: 'p', + hidden_input: true, + padd_empty_editor: true, + render_ui: true, + indentation: '30px', + inline_styles: true, + convert_fonts_to_spans: true, + indent: 'simple', + indent_before: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + + 'tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist', + indent_after: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + + 'tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist', + validate: true, + entity_encoding: 'named', + url_converter: self.convertURL, + url_converter_scope: self, + ie7_compat: true + }, settings); + + AddOnManager.language = settings.language || 'en'; + AddOnManager.languageLoad = settings.language_load; + + AddOnManager.baseURL = editorManager.baseURL; + + /** + * Editor instance id, normally the same as the div/textarea that was replaced. + * + * @property id + * @type String + */ + self.id = settings.id = id; + + /** + * State to force the editor to return false on a isDirty call. + * + * @property isNotDirty + * @type Boolean + * @example + * function ajaxSave() { + * var ed = tinymce.get('elm1'); + * + * // Save contents using some XHR call + * alert(ed.getContent()); + * + * ed.isNotDirty = true; // Force not dirty state + * } + */ + self.isNotDirty = true; + + /** + * Name/Value object containting plugin instances. + * + * @property plugins + * @type Object + * @example + * // Execute a method inside a plugin directly + * tinymce.activeEditor.plugins.someplugin.someMethod(); + */ + self.plugins = {}; + + /** + * URI object to document configured for the TinyMCE instance. + * + * @property documentBaseURI + * @type tinymce.util.URI + * @example + * // Get relative URL from the location of document_base_url + * tinymce.activeEditor.documentBaseURI.toRelative('/somedir/somefile.htm'); + * + * // Get absolute URL from the location of document_base_url + * tinymce.activeEditor.documentBaseURI.toAbsolute('somefile.htm'); + */ + self.documentBaseURI = new URI(settings.document_base_url || documentBaseUrl, { + base_uri: baseUri + }); + + /** + * URI object to current document that holds the TinyMCE editor instance. + * + * @property baseURI + * @type tinymce.util.URI + * @example + * // Get relative URL from the location of the API + * tinymce.activeEditor.baseURI.toRelative('/somedir/somefile.htm'); + * + * // Get absolute URL from the location of the API + * tinymce.activeEditor.baseURI.toAbsolute('somefile.htm'); + */ + self.baseURI = baseUri; + + /** + * Array with CSS files to load into the iframe. + * + * @property contentCSS + * @type Array + */ + self.contentCSS = []; + + /** + * Array of CSS styles to add to head of document when the editor loads. + * + * @property contentStyles + * @type Array + */ + self.contentStyles = []; + + // Creates all events like onClick, onSetContent etc see Editor.Events.js for the actual logic + self.shortcuts = new Shortcuts(self); + self.loadedCSS = {}; + self.editorCommands = new EditorCommands(self); + + if (settings.target) { + self.targetElm = settings.target; + } + + self.suffix = editorManager.suffix; + self.editorManager = editorManager; + self.inline = settings.inline; + + if (settings.cache_suffix) { + Env.cacheSuffix = settings.cache_suffix.replace(/^[\?\&]+/, ''); + } + + // Call setup + editorManager.fire('SetupEditor', self); + self.execCallback('setup', self); + + /** + * Dom query instance with default scope to the editor document and default element is the body of the editor. + * + * @property $ + * @type tinymce.dom.DomQuery + * @example + * tinymce.activeEditor.$('p').css('color', 'red'); + * tinymce.activeEditor.$().append('

new

'); + */ + self.$ = DomQuery.overrideDefaults(function() { + return { + context: self.inline ? self.getBody() : self.getDoc(), + element: self.getBody() + }; + }); + } + + Editor.prototype = { + /** + * Renderes the editor/adds it to the page. + * + * @method render + */ + render: function() { + var self = this, settings = self.settings, id = self.id, suffix = self.suffix; + + function readyHandler() { + DOM.unbind(window, 'ready', readyHandler); + self.render(); + } + + // Page is not loaded yet, wait for it + if (!Event.domLoaded) { + DOM.bind(window, 'ready', readyHandler); + return; + } + + // Element not found, then skip initialization + if (!self.getElement()) { + return; + } + + // No editable support old iOS versions etc + if (!Env.contentEditable) { + return; + } + + // Hide target element early to prevent content flashing + if (!settings.inline) { + self.orgVisibility = self.getElement().style.visibility; + self.getElement().style.visibility = 'hidden'; + } else { + self.inline = true; + } + + var form = self.getElement().form || DOM.getParent(id, 'form'); + if (form) { + self.formElement = form; + + // Add hidden input for non input elements inside form elements + if (settings.hidden_input && !/TEXTAREA|INPUT/i.test(self.getElement().nodeName)) { + DOM.insertAfter(DOM.create('input', {type: 'hidden', name: id}), id); + self.hasHiddenInput = true; + } + + // Pass submit/reset from form to editor instance + self.formEventDelegate = function(e) { + self.fire(e.type, e); + }; + + DOM.bind(form, 'submit reset', self.formEventDelegate); + + // Reset contents in editor when the form is reset + self.on('reset', function() { + self.setContent(self.startContent, {format: 'raw'}); + }); + + // Check page uses id="submit" or name="submit" for it's submit button + if (settings.submit_patch && !form.submit.nodeType && !form.submit.length && !form._mceOldSubmit) { + form._mceOldSubmit = form.submit; + form.submit = function() { + self.editorManager.triggerSave(); + self.isNotDirty = true; + + return form._mceOldSubmit(form); + }; + } + } + + /** + * Window manager reference, use this to open new windows and dialogs. + * + * @property windowManager + * @type tinymce.WindowManager + * @example + * // Shows an alert message + * tinymce.activeEditor.windowManager.alert('Hello world!'); + * + * // Opens a new dialog with the file.htm file and the size 320x240 + * // It also adds a custom parameter this can be retrieved by using tinyMCEPopup.getWindowArg inside the dialog. + * tinymce.activeEditor.windowManager.open({ + * url: 'file.htm', + * width: 320, + * height: 240 + * }, { + * custom_param: 1 + * }); + */ + self.windowManager = new WindowManager(self); + + if (settings.encoding == 'xml') { + self.on('GetContent', function(e) { + if (e.save) { + e.content = DOM.encode(e.content); + } + }); + } + + if (settings.add_form_submit_trigger) { + self.on('submit', function() { + if (self.initialized) { + self.save(); + } + }); + } + + if (settings.add_unload_trigger) { + self._beforeUnload = function() { + if (self.initialized && !self.destroyed && !self.isHidden()) { + self.save({format: 'raw', no_events: true, set_dirty: false}); + } + }; + + self.editorManager.on('BeforeUnload', self._beforeUnload); + } + + // Load scripts + function loadScripts() { + var scriptLoader = ScriptLoader.ScriptLoader; + + if (settings.language && settings.language != 'en' && !settings.language_url) { + settings.language_url = self.editorManager.baseURL + '/langs/' + settings.language + '.js'; + } + + if (settings.language_url) { + scriptLoader.add(settings.language_url); + } + + if (settings.theme && typeof settings.theme != "function" && + settings.theme.charAt(0) != '-' && !ThemeManager.urls[settings.theme]) { + var themeUrl = settings.theme_url; + + if (themeUrl) { + themeUrl = self.documentBaseURI.toAbsolute(themeUrl); + } else { + themeUrl = 'themes/' + settings.theme + '/theme' + suffix + '.js'; + } + + ThemeManager.load(settings.theme, themeUrl); + } + + if (Tools.isArray(settings.plugins)) { + settings.plugins = settings.plugins.join(' '); + } + + each(settings.external_plugins, function(url, name) { + PluginManager.load(name, url); + settings.plugins += ' ' + name; + }); + + each(settings.plugins.split(/[ ,]/), function(plugin) { + plugin = trim(plugin); + + if (plugin && !PluginManager.urls[plugin]) { + if (plugin.charAt(0) == '-') { + plugin = plugin.substr(1, plugin.length); + + var dependencies = PluginManager.dependencies(plugin); + + each(dependencies, function(dep) { + var defaultSettings = { + prefix: 'plugins/', + resource: dep, + suffix: '/plugin' + suffix + '.js' + }; + + dep = PluginManager.createUrl(defaultSettings, dep); + PluginManager.load(dep.resource, dep); + }); + } else { + PluginManager.load(plugin, { + prefix: 'plugins/', + resource: plugin, + suffix: '/plugin' + suffix + '.js' + }); + } + } + }); + + scriptLoader.loadQueue(function() { + if (!self.removed) { + self.init(); + } + }); + } + + loadScripts(); + }, + + /** + * Initializes the editor this will be called automatically when + * all plugins/themes and language packs are loaded by the rendered method. + * This method will setup the iframe and create the theme and plugin instances. + * + * @method init + */ + init: function() { + var self = this, settings = self.settings, elm = self.getElement(); + var w, h, minHeight, n, o, Theme, url, bodyId, bodyClass, re, i, initializedPlugins = []; + + this.editorManager.i18n.setCode(settings.language); + self.rtl = this.editorManager.i18n.rtl; + self.editorManager.add(self); + + settings.aria_label = settings.aria_label || DOM.getAttrib(elm, 'aria-label', self.getLang('aria.rich_text_area')); + + /** + * Reference to the theme instance that was used to generate the UI. + * + * @property theme + * @type tinymce.Theme + * @example + * // Executes a method on the theme directly + * tinymce.activeEditor.theme.someMethod(); + */ + if (settings.theme) { + if (typeof settings.theme != "function") { + settings.theme = settings.theme.replace(/-/, ''); + Theme = ThemeManager.get(settings.theme); + self.theme = new Theme(self, ThemeManager.urls[settings.theme]); + + if (self.theme.init) { + self.theme.init(self, ThemeManager.urls[settings.theme] || self.documentBaseUrl.replace(/\/$/, ''), self.$); + } + } else { + self.theme = settings.theme; + } + } + + function initPlugin(plugin) { + var Plugin = PluginManager.get(plugin), pluginUrl, pluginInstance; + + pluginUrl = PluginManager.urls[plugin] || self.documentBaseUrl.replace(/\/$/, ''); + plugin = trim(plugin); + if (Plugin && inArray(initializedPlugins, plugin) === -1) { + each(PluginManager.dependencies(plugin), function(dep) { + initPlugin(dep); + }); + + pluginInstance = new Plugin(self, pluginUrl, self.$); + + self.plugins[plugin] = pluginInstance; + + if (pluginInstance.init) { + pluginInstance.init(self, pluginUrl); + initializedPlugins.push(plugin); + } + } + } + + // Create all plugins + each(settings.plugins.replace(/\-/g, '').split(/[ ,]/), initPlugin); + + // Measure box + if (settings.render_ui && self.theme) { + self.orgDisplay = elm.style.display; + + if (typeof settings.theme != "function") { + w = settings.width || elm.style.width || elm.offsetWidth; + h = settings.height || elm.style.height || elm.offsetHeight; + minHeight = settings.min_height || 100; + re = /^[0-9\.]+(|px)$/i; + + if (re.test('' + w)) { + w = Math.max(parseInt(w, 10), 100); + } + + if (re.test('' + h)) { + h = Math.max(parseInt(h, 10), minHeight); + } + + // Render UI + o = self.theme.renderUI({ + targetNode: elm, + width: w, + height: h, + deltaWidth: settings.delta_width, + deltaHeight: settings.delta_height + }); + + // Resize editor + if (!settings.content_editable) { + h = (o.iframeHeight || h) + (typeof h == 'number' ? (o.deltaHeight || 0) : ''); + if (h < minHeight) { + h = minHeight; + } + } + } else { + o = settings.theme(self, elm); + + // Convert element type to id:s + if (o.editorContainer.nodeType) { + o.editorContainer = o.editorContainer.id = o.editorContainer.id || self.id + "_parent"; + } + + // Convert element type to id:s + if (o.iframeContainer.nodeType) { + o.iframeContainer = o.iframeContainer.id = o.iframeContainer.id || self.id + "_iframecontainer"; + } + + // Use specified iframe height or the targets offsetHeight + h = o.iframeHeight || elm.offsetHeight; + } + + self.editorContainer = o.editorContainer; + } + + // Load specified content CSS last + if (settings.content_css) { + each(explode(settings.content_css), function(u) { + self.contentCSS.push(self.documentBaseURI.toAbsolute(u)); + }); + } + + // Load specified content CSS last + if (settings.content_style) { + self.contentStyles.push(settings.content_style); + } + + // Content editable mode ends here + if (settings.content_editable) { + elm = n = o = null; // Fix IE leak + return self.initContentBody(); + } + + self.iframeHTML = settings.doctype + ''; + + // We only need to override paths if we have to + // IE has a bug where it remove site absolute urls to relative ones if this is specified + if (settings.document_base_url != self.documentBaseUrl) { + self.iframeHTML += ''; + } + + // IE8 doesn't support carets behind images setting ie7_compat would force IE8+ to run in IE7 compat mode. + if (!Env.caretAfter && settings.ie7_compat) { + self.iframeHTML += ''; + } + + self.iframeHTML += ''; + + // Load the CSS by injecting them into the HTML this will reduce "flicker" + for (i = 0; i < self.contentCSS.length; i++) { + var cssUrl = self.contentCSS[i]; + self.iframeHTML += ( + '' + ); + self.loadedCSS[cssUrl] = true; + } + + bodyId = settings.body_id || 'tinymce'; + if (bodyId.indexOf('=') != -1) { + bodyId = self.getParam('body_id', '', 'hash'); + bodyId = bodyId[self.id] || bodyId; + } + + bodyClass = settings.body_class || ''; + if (bodyClass.indexOf('=') != -1) { + bodyClass = self.getParam('body_class', '', 'hash'); + bodyClass = bodyClass[self.id] || ''; + } + + if (settings.content_security_policy) { + self.iframeHTML += ''; + } + + self.iframeHTML += '
'; + + /*eslint no-script-url:0 */ + var domainRelaxUrl = 'javascript:(function(){' + + 'document.open();document.domain="' + document.domain + '";' + + 'var ed = window.parent.tinymce.get("' + self.id + '");document.write(ed.iframeHTML);' + + 'document.close();ed.initContentBody(true);})()'; + + // Domain relaxing is required since the user has messed around with document.domain + if (document.domain != location.hostname) { + url = domainRelaxUrl; + } + + // Create iframe + // TODO: ACC add the appropriate description on this. + var ifr = DOM.create('iframe', { + id: self.id + "_ifr", + //src: url || 'javascript:""', // Workaround for HTTPS warning in IE6/7 + frameBorder: '0', + allowTransparency: "true", + title: self.editorManager.translate( + "Rich Text Area. Press ALT-F9 for menu. " + + "Press ALT-F10 for toolbar. Press ALT-0 for help" + ), + style: { + width: '100%', + height: h, + display: 'block' // Important for Gecko to render the iframe correctly + } + }); + + ifr.onload = function() { + ifr.onload = null; + self.fire("load"); + }; + + DOM.setAttrib(ifr, "src", url || 'javascript:""'); + + self.contentAreaContainer = o.iframeContainer; + self.iframeElement = ifr; + + n = DOM.add(o.iframeContainer, ifr); + + // Try accessing the document this will fail on IE when document.domain is set to the same as location.hostname + // Then we have to force domain relaxing using the domainRelaxUrl approach very ugly!! + if (ie) { + try { + self.getDoc(); + } catch (e) { + n.src = url = domainRelaxUrl; + } + } + + if (o.editorContainer) { + DOM.get(o.editorContainer).style.display = self.orgDisplay; + self.hidden = DOM.isHidden(o.editorContainer); + } + + self.getElement().style.display = 'none'; + DOM.setAttrib(self.id, 'aria-hidden', true); + + if (!url) { + self.initContentBody(); + } + + elm = n = o = null; // Cleanup + }, + + /** + * This method get called by the init method ones the iframe is loaded. + * It will fill the iframe with contents, setups DOM and selection objects for the iframe. + * + * @method initContentBody + * @private + */ + initContentBody: function(skipWrite) { + var self = this, settings = self.settings, targetElm = self.getElement(), doc = self.getDoc(), body, contentCssText; + + // Restore visibility on target element + if (!settings.inline) { + self.getElement().style.visibility = self.orgVisibility; + } + + // Setup iframe body + if (!skipWrite && !settings.content_editable) { + doc.open(); + doc.write(self.iframeHTML); + doc.close(); + } + + if (settings.content_editable) { + self.on('remove', function() { + var bodyEl = this.getBody(); + + DOM.removeClass(bodyEl, 'mce-content-body'); + DOM.removeClass(bodyEl, 'mce-edit-focus'); + DOM.setAttrib(bodyEl, 'contentEditable', null); + }); + + DOM.addClass(targetElm, 'mce-content-body'); + self.contentDocument = doc = settings.content_document || document; + self.contentWindow = settings.content_window || window; + self.bodyElement = targetElm; + + // Prevent leak in IE + settings.content_document = settings.content_window = null; + + // TODO: Fix this + settings.root_name = targetElm.nodeName.toLowerCase(); + } + + // It will not steal focus while setting contentEditable + body = self.getBody(); + body.disabled = true; + + if (!settings.readonly) { + if (self.inline && DOM.getStyle(body, 'position', true) == 'static') { + body.style.position = 'relative'; + } + + body.contentEditable = self.getParam('content_editable_state', true); + } + + body.disabled = false; + + /** + * Schema instance, enables you to validate elements and it's children. + * + * @property schema + * @type tinymce.html.Schema + */ + self.schema = new Schema(settings); + + /** + * DOM instance for the editor. + * + * @property dom + * @type tinymce.dom.DOMUtils + * @example + * // Adds a class to all paragraphs within the editor + * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'someclass'); + */ + self.dom = new DOMUtils(doc, { + keep_values: true, + url_converter: self.convertURL, + url_converter_scope: self, + hex_colors: settings.force_hex_style_colors, + class_filter: settings.class_filter, + update_styles: true, + root_element: self.inline ? self.getBody() : null, + collect: settings.content_editable, + schema: self.schema, + onSetAttrib: function(e) { + self.fire('SetAttrib', e); + } + }); + + /** + * HTML parser will be used when contents is inserted into the editor. + * + * @property parser + * @type tinymce.html.DomParser + */ + self.parser = new DomParser(settings, self.schema); + + // Convert src and href into data-mce-src, data-mce-href and data-mce-style + self.parser.addAttributeFilter('src,href,style,tabindex', function(nodes, name) { + var i = nodes.length, node, dom = self.dom, value, internalName; + + while (i--) { + node = nodes[i]; + value = node.attr(name); + internalName = 'data-mce-' + name; + + // Add internal attribute if we need to we don't on a refresh of the document + if (!node.attributes.map[internalName]) { + if (name === "style") { + value = dom.serializeStyle(dom.parseStyle(value), node.name); + + if (!value.length) { + value = null; + } + + node.attr(internalName, value); + node.attr(name, value); + } else if (name === "tabindex") { + node.attr(internalName, value); + node.attr(name, null); + } else { + node.attr(internalName, self.convertURL(value, name, node.name)); + } + } + } + }); + + // Keep scripts from executing + self.parser.addNodeFilter('script', function(nodes) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i]; + node.attr('type', 'mce-' + (node.attr('type') || 'no/type')); + } + }); + + self.parser.addNodeFilter('#cdata', function(nodes) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i]; + node.type = 8; + node.name = '#comment'; + node.value = '[CDATA[' + node.value + ']]'; + } + }); + + self.parser.addNodeFilter('p,h1,h2,h3,h4,h5,h6,div', function(nodes) { + var i = nodes.length, node, nonEmptyElements = self.schema.getNonEmptyElements(); + + while (i--) { + node = nodes[i]; + + if (node.isEmpty(nonEmptyElements)) { + node.append(new Node('br', 1)).shortEnded = true; + } + } + }); + + /** + * DOM serializer for the editor. Will be used when contents is extracted from the editor. + * + * @property serializer + * @type tinymce.dom.Serializer + * @example + * // Serializes the first paragraph in the editor into a string + * tinymce.activeEditor.serializer.serialize(tinymce.activeEditor.dom.select('p')[0]); + */ + self.serializer = new DomSerializer(settings, self); + + /** + * Selection instance for the editor. + * + * @property selection + * @type tinymce.dom.Selection + * @example + * // Sets some contents to the current selection in the editor + * tinymce.activeEditor.selection.setContent('Some contents'); + * + * // Gets the current selection + * alert(tinymce.activeEditor.selection.getContent()); + * + * // Selects the first paragraph found + * tinymce.activeEditor.selection.select(tinymce.activeEditor.dom.select('p')[0]); + */ + self.selection = new Selection(self.dom, self.getWin(), self.serializer, self); + + /** + * Formatter instance. + * + * @property formatter + * @type tinymce.Formatter + */ + self.formatter = new Formatter(self); + + /** + * Undo manager instance, responsible for handling undo levels. + * + * @property undoManager + * @type tinymce.UndoManager + * @example + * // Undoes the last modification to the editor + * tinymce.activeEditor.undoManager.undo(); + */ + self.undoManager = new UndoManager(self); + + self.forceBlocks = new ForceBlocks(self); + self.enterKey = new EnterKey(self); + self._nodeChangeDispatcher = new NodeChange(self); + + self.fire('PreInit'); + + if (!settings.browser_spellcheck && !settings.gecko_spellcheck) { + doc.body.spellcheck = false; // Gecko + DOM.setAttrib(body, "spellcheck", "false"); + } + + self.fire('PostRender'); + + self.quirks = new Quirks(self); + + if (settings.directionality) { + body.dir = settings.directionality; + } + + if (settings.nowrap) { + body.style.whiteSpace = "nowrap"; + } + + if (settings.protect) { + self.on('BeforeSetContent', function(e) { + each(settings.protect, function(pattern) { + e.content = e.content.replace(pattern, function(str) { + return ''; + }); + }); + }); + } + + self.on('SetContent', function() { + self.addVisual(self.getBody()); + }); + + // Remove empty contents + if (settings.padd_empty_editor) { + self.on('PostProcess', function(e) { + e.content = e.content.replace(/^(]*>( | |\s|\u00a0|)<\/p>[\r\n]*|
[\r\n]*)$/, ''); + }); + } + + self.load({initial: true, format: 'html'}); + self.startContent = self.getContent({format: 'raw'}); + + /** + * Is set to true after the editor instance has been initialized + * + * @property initialized + * @type Boolean + * @example + * function isEditorInitialized(editor) { + * return editor && editor.initialized; + * } + */ + self.initialized = true; + self.bindPendingEventDelegates(); + + self.fire('init'); + self.focus(true); + self.nodeChanged({initial: true}); + self.execCallback('init_instance_callback', self); + + // Add editor specific CSS styles + if (self.contentStyles.length > 0) { + contentCssText = ''; + + each(self.contentStyles, function(style) { + contentCssText += style + "\r\n"; + }); + + self.dom.addStyle(contentCssText); + } + + // Load specified content CSS last + each(self.contentCSS, function(cssUrl) { + if (!self.loadedCSS[cssUrl]) { + self.dom.loadCSS(cssUrl); + self.loadedCSS[cssUrl] = true; + } + }); + + // Handle auto focus + if (settings.auto_focus) { + setTimeout(function() { + var editor; + + if (settings.auto_focus === true) { + editor = self; + } else { + editor = self.editorManager.get(settings.auto_focus); + } + + if (!editor.destroyed) { + editor.focus(); + } + }, 100); + } + + // Clean up references for IE + targetElm = doc = body = null; + }, + + /** + * Focuses/activates the editor. This will set this editor as the activeEditor in the tinymce collection + * it will also place DOM focus inside the editor. + * + * @method focus + * @param {Boolean} skipFocus Skip DOM focus. Just set is as the active editor. + */ + focus: function(skipFocus) { + var self = this, selection = self.selection, contentEditable = self.settings.content_editable, rng; + var controlElm, doc = self.getDoc(), body; + + if (!skipFocus) { + // Get selected control element + rng = selection.getRng(); + if (rng.item) { + controlElm = rng.item(0); + } + + self._refreshContentEditable(); + + // Focus the window iframe + if (!contentEditable) { + // WebKit needs this call to fire focusin event properly see #5948 + // But Opera pre Blink engine will produce an empty selection so skip Opera + if (!Env.opera) { + self.getBody().focus(); + } + + self.getWin().focus(); + } + + // Focus the body as well since it's contentEditable + if (isGecko || contentEditable) { + body = self.getBody(); + + // Check for setActive since it doesn't scroll to the element + if (body.setActive) { + // IE 11 sometimes throws "Invalid function" then fallback to focus + try { + body.setActive(); + } catch (ex) { + body.focus(); + } + } else { + body.focus(); + } + + if (contentEditable) { + selection.normalize(); + } + } + + // Restore selected control element + // This is needed when for example an image is selected within a + // layer a call to focus will then remove the control selection + if (controlElm && controlElm.ownerDocument == doc) { + rng = doc.body.createControlRange(); + rng.addElement(controlElm); + rng.select(); + } + } + + self.editorManager.setActive(self); + }, + + /** + * Executes a legacy callback. This method is useful to call old 2.x option callbacks. + * There new event model is a better way to add callback so this method might be removed in the future. + * + * @method execCallback + * @param {String} name Name of the callback to execute. + * @return {Object} Return value passed from callback function. + */ + execCallback: function(name) { + var self = this, callback = self.settings[name], scope; + + if (!callback) { + return; + } + + // Look through lookup + if (self.callbackLookup && (scope = self.callbackLookup[name])) { + callback = scope.func; + scope = scope.scope; + } + + if (typeof callback === 'string') { + scope = callback.replace(/\.\w+$/, ''); + scope = scope ? resolve(scope) : 0; + callback = resolve(callback); + self.callbackLookup = self.callbackLookup || {}; + self.callbackLookup[name] = {func: callback, scope: scope}; + } + + return callback.apply(scope || self, Array.prototype.slice.call(arguments, 1)); + }, + + /** + * Translates the specified string by replacing variables with language pack items it will also check if there is + * a key mathcin the input. + * + * @method translate + * @param {String} text String to translate by the language pack data. + * @return {String} Translated string. + */ + translate: function(text) { + var lang = this.settings.language || 'en', i18n = this.editorManager.i18n; + + if (!text) { + return ''; + } + + return i18n.data[lang + '.' + text] || text.replace(/\{\#([^\}]+)\}/g, function(a, b) { + return i18n.data[lang + '.' + b] || '{#' + b + '}'; + }); + }, + + /** + * Returns a language pack item by name/key. + * + * @method getLang + * @param {String} name Name/key to get from the language pack. + * @param {String} defaultVal Optional default value to retrive. + */ + getLang: function(name, defaultVal) { + return ( + this.editorManager.i18n.data[(this.settings.language || 'en') + '.' + name] || + (defaultVal !== undefined ? defaultVal : '{#' + name + '}') + ); + }, + + /** + * Returns a configuration parameter by name. + * + * @method getParam + * @param {String} name Configruation parameter to retrive. + * @param {String} defaultVal Optional default value to return. + * @param {String} type Optional type parameter. + * @return {String} Configuration parameter value or default value. + * @example + * // Returns a specific config value from the currently active editor + * var someval = tinymce.activeEditor.getParam('myvalue'); + * + * // Returns a specific config value from a specific editor instance by id + * var someval2 = tinymce.get('my_editor').getParam('myvalue'); + */ + getParam: function(name, defaultVal, type) { + var value = name in this.settings ? this.settings[name] : defaultVal, output; + + if (type === 'hash') { + output = {}; + + if (typeof value === 'string') { + each(value.indexOf('=') > 0 ? value.split(/[;,](?![^=;,]*(?:[;,]|$))/) : value.split(','), function(value) { + value = value.split('='); + + if (value.length > 1) { + output[trim(value[0])] = trim(value[1]); + } else { + output[trim(value[0])] = trim(value); + } + }); + } else { + output = value; + } + + return output; + } + + return value; + }, + + /** + * Distpaches out a onNodeChange event to all observers. This method should be called when you + * need to update the UI states or element path etc. + * + * @method nodeChanged + * @param {Object} args Optional args to pass to NodeChange event handlers. + */ + nodeChanged: function(args) { + this._nodeChangeDispatcher.nodeChanged(args); + }, + + /** + * Adds a button that later gets created by the theme in the editors toolbars. + * + * @method addButton + * @param {String} name Button name to add. + * @param {Object} settings Settings object with title, cmd etc. + * @example + * // Adds a custom button to the editor that inserts contents when clicked + * tinymce.init({ + * ... + * + * toolbar: 'example' + * + * setup: function(ed) { + * ed.addButton('example', { + * title: 'My title', + * image: '../js/tinymce/plugins/example/img/example.gif', + * onclick: function() { + * ed.insertContent('Hello world!!'); + * } + * }); + * } + * }); + */ + addButton: function(name, settings) { + var self = this; + + if (settings.cmd) { + settings.onclick = function() { + self.execCommand(settings.cmd); + }; + } + + if (!settings.text && !settings.icon) { + settings.icon = name; + } + + self.buttons = self.buttons || {}; + settings.tooltip = settings.tooltip || settings.title; + self.buttons[name] = settings; + }, + + /** + * Adds a menu item to be used in the menus of the theme. There might be multiple instances + * of this menu item for example it might be used in the main menus of the theme but also in + * the context menu so make sure that it's self contained and supports multiple instances. + * + * @method addMenuItem + * @param {String} name Menu item name to add. + * @param {Object} settings Settings object with title, cmd etc. + * @example + * // Adds a custom menu item to the editor that inserts contents when clicked + * // The context option allows you to add the menu item to an existing default menu + * tinymce.init({ + * ... + * + * setup: function(ed) { + * ed.addMenuItem('example', { + * text: 'My menu item', + * context: 'tools', + * onclick: function() { + * ed.insertContent('Hello world!!'); + * } + * }); + * } + * }); + */ + addMenuItem: function(name, settings) { + var self = this; + + if (settings.cmd) { + settings.onclick = function() { + self.execCommand(settings.cmd); + }; + } + + self.menuItems = self.menuItems || {}; + self.menuItems[name] = settings; + }, + + /** + * Adds a custom command to the editor, you can also override existing commands with this method. + * The command that you add can be executed with execCommand. + * + * @method addCommand + * @param {String} name Command name to add/override. + * @param {addCommandCallback} callback Function to execute when the command occurs. + * @param {Object} scope Optional scope to execute the function in. + * @example + * // Adds a custom command that later can be executed using execCommand + * tinymce.init({ + * ... + * + * setup: function(ed) { + * // Register example command + * ed.addCommand('mycommand', function(ui, v) { + * ed.windowManager.alert('Hello world!! Selection: ' + ed.selection.getContent({format: 'text'})); + * }); + * } + * }); + */ + addCommand: function(name, callback, scope) { + /** + * Callback function that gets called when a command is executed. + * + * @callback addCommandCallback + * @param {Boolean} ui Display UI state true/false. + * @param {Object} value Optional value for command. + * @return {Boolean} True/false state if the command was handled or not. + */ + this.editorCommands.addCommand(name, callback, scope); + }, + + /** + * Adds a custom query state command to the editor, you can also override existing commands with this method. + * The command that you add can be executed with queryCommandState function. + * + * @method addQueryStateHandler + * @param {String} name Command name to add/override. + * @param {addQueryStateHandlerCallback} callback Function to execute when the command state retrival occurs. + * @param {Object} scope Optional scope to execute the function in. + */ + addQueryStateHandler: function(name, callback, scope) { + /** + * Callback function that gets called when a queryCommandState is executed. + * + * @callback addQueryStateHandlerCallback + * @return {Boolean} True/false state if the command is enabled or not like is it bold. + */ + this.editorCommands.addQueryStateHandler(name, callback, scope); + }, + + /** + * Adds a custom query value command to the editor, you can also override existing commands with this method. + * The command that you add can be executed with queryCommandValue function. + * + * @method addQueryValueHandler + * @param {String} name Command name to add/override. + * @param {addQueryValueHandlerCallback} callback Function to execute when the command value retrival occurs. + * @param {Object} scope Optional scope to execute the function in. + */ + addQueryValueHandler: function(name, callback, scope) { + /** + * Callback function that gets called when a queryCommandValue is executed. + * + * @callback addQueryValueHandlerCallback + * @return {Object} Value of the command or undefined. + */ + this.editorCommands.addQueryValueHandler(name, callback, scope); + }, + + /** + * Adds a keyboard shortcut for some command or function. + * + * @method addShortcut + * @param {String} pattern Shortcut pattern. Like for example: ctrl+alt+o. + * @param {String} desc Text description for the command. + * @param {String/Function} cmdFunc Command name string or function to execute when the key is pressed. + * @param {Object} sc Optional scope to execute the function in. + * @return {Boolean} true/false state if the shortcut was added or not. + */ + addShortcut: function(pattern, desc, cmdFunc, scope) { + this.shortcuts.add(pattern, desc, cmdFunc, scope); + }, + + /** + * Executes a command on the current instance. These commands can be TinyMCE internal commands prefixed with "mce" or + * they can be build in browser commands such as "Bold". A compleate list of browser commands is available on MSDN or Mozilla.org. + * This function will dispatch the execCommand function on each plugin, theme or the execcommand_callback option if none of these + * return true it will handle the command as a internal browser command. + * + * @method execCommand + * @param {String} cmd Command name to execute, for example mceLink or Bold. + * @param {Boolean} ui True/false state if a UI (dialog) should be presented or not. + * @param {mixed} value Optional command value, this can be anything. + * @param {Object} args Optional arguments object. + */ + execCommand: function(cmd, ui, value, args) { + return this.editorCommands.execCommand(cmd, ui, value, args); + }, + + /** + * Returns a command specific state, for example if bold is enabled or not. + * + * @method queryCommandState + * @param {string} cmd Command to query state from. + * @return {Boolean} Command specific state, for example if bold is enabled or not. + */ + queryCommandState: function(cmd) { + return this.editorCommands.queryCommandState(cmd); + }, + + /** + * Returns a command specific value, for example the current font size. + * + * @method queryCommandValue + * @param {string} cmd Command to query value from. + * @return {Object} Command specific value, for example the current font size. + */ + queryCommandValue: function(cmd) { + return this.editorCommands.queryCommandValue(cmd); + }, + + /** + * Returns true/false if the command is supported or not. + * + * @method queryCommandSupported + * @param {String} cmd Command that we check support for. + * @return {Boolean} true/false if the command is supported or not. + */ + queryCommandSupported: function(cmd) { + return this.editorCommands.queryCommandSupported(cmd); + }, + + /** + * Shows the editor and hides any textarea/div that the editor is supposed to replace. + * + * @method show + */ + show: function() { + var self = this; + + if (self.hidden) { + self.hidden = false; + + if (self.inline) { + self.getBody().contentEditable = true; + } else { + DOM.show(self.getContainer()); + DOM.hide(self.id); + } + + self.load(); + self.fire('show'); + } + }, + + /** + * Hides the editor and shows any textarea/div that the editor is supposed to replace. + * + * @method hide + */ + hide: function() { + var self = this, doc = self.getDoc(); + + if (!self.hidden) { + // Fixed bug where IE has a blinking cursor left from the editor + if (ie && doc && !self.inline) { + doc.execCommand('SelectAll'); + } + + // We must save before we hide so Safari doesn't crash + self.save(); + + if (self.inline) { + self.getBody().contentEditable = false; + + // Make sure the editor gets blurred + if (self == self.editorManager.focusedEditor) { + self.editorManager.focusedEditor = null; + } + } else { + DOM.hide(self.getContainer()); + DOM.setStyle(self.id, 'display', self.orgDisplay); + } + + self.hidden = true; + self.fire('hide'); + } + }, + + /** + * Returns true/false if the editor is hidden or not. + * + * @method isHidden + * @return {Boolean} True/false if the editor is hidden or not. + */ + isHidden: function() { + return !!this.hidden; + }, + + /** + * Sets the progress state, this will display a throbber/progess for the editor. + * This is ideal for asycronous operations like an AJAX save call. + * + * @method setProgressState + * @param {Boolean} state Boolean state if the progress should be shown or hidden. + * @param {Number} time Optional time to wait before the progress gets shown. + * @return {Boolean} Same as the input state. + * @example + * // Show progress for the active editor + * tinymce.activeEditor.setProgressState(true); + * + * // Hide progress for the active editor + * tinymce.activeEditor.setProgressState(false); + * + * // Show progress after 3 seconds + * tinymce.activeEditor.setProgressState(true, 3000); + */ + setProgressState: function(state, time) { + this.fire('ProgressState', {state: state, time: time}); + }, + + /** + * Loads contents from the textarea or div element that got converted into an editor instance. + * This method will move the contents from that textarea or div into the editor by using setContent + * so all events etc that method has will get dispatched as well. + * + * @method load + * @param {Object} args Optional content object, this gets passed around through the whole load process. + * @return {String} HTML string that got set into the editor. + */ + load: function(args) { + var self = this, elm = self.getElement(), html; + + if (elm) { + args = args || {}; + args.load = true; + + html = self.setContent(elm.value !== undefined ? elm.value : elm.innerHTML, args); + args.element = elm; + + if (!args.no_events) { + self.fire('LoadContent', args); + } + + args.element = elm = null; + + return html; + } + }, + + /** + * Saves the contents from a editor out to the textarea or div element that got converted into an editor instance. + * This method will move the HTML contents from the editor into that textarea or div by getContent + * so all events etc that method has will get dispatched as well. + * + * @method save + * @param {Object} args Optional content object, this gets passed around through the whole save process. + * @return {String} HTML string that got set into the textarea/div. + */ + save: function(args) { + var self = this, elm = self.getElement(), html, form; + + if (!elm || !self.initialized) { + return; + } + + args = args || {}; + args.save = true; + + args.element = elm; + html = args.content = self.getContent(args); + + if (!args.no_events) { + self.fire('SaveContent', args); + } + + html = args.content; + + if (!/TEXTAREA|INPUT/i.test(elm.nodeName)) { + // Update DIV element when not in inline mode + if (!self.inline) { + elm.innerHTML = html; + } + + // Update hidden form element + if ((form = DOM.getParent(self.id, 'form'))) { + each(form.elements, function(elm) { + if (elm.name == self.id) { + elm.value = html; + return false; + } + }); + } + } else { + elm.value = html; + } + + args.element = elm = null; + + if (args.set_dirty !== false) { + self.isNotDirty = true; + } + + return html; + }, + + /** + * Sets the specified content to the editor instance, this will cleanup the content before it gets set using + * the different cleanup rules options. + * + * @method setContent + * @param {String} content Content to set to editor, normally HTML contents but can be other formats as well. + * @param {Object} args Optional content object, this gets passed around through the whole set process. + * @return {String} HTML string that got set into the editor. + * @example + * // Sets the HTML contents of the activeEditor editor + * tinymce.activeEditor.setContent('some html'); + * + * // Sets the raw contents of the activeEditor editor + * tinymce.activeEditor.setContent('some html', {format: 'raw'}); + * + * // Sets the content of a specific editor (my_editor in this example) + * tinymce.get('my_editor').setContent(data); + * + * // Sets the bbcode contents of the activeEditor editor if the bbcode plugin was added + * tinymce.activeEditor.setContent('[b]some[/b] html', {format: 'bbcode'}); + */ + setContent: function(content, args) { + var self = this, body = self.getBody(), forcedRootBlockName; + + // Setup args object + args = args || {}; + args.format = args.format || 'html'; + args.set = true; + args.content = content; + + // Do preprocessing + if (!args.no_events) { + self.fire('BeforeSetContent', args); + } + + content = args.content; + + // Padd empty content in Gecko and Safari. Commands will otherwise fail on the content + // It will also be impossible to place the caret in the editor unless there is a BR element present + if (content.length === 0 || /^\s+$/.test(content)) { + forcedRootBlockName = self.settings.forced_root_block; + + // Check if forcedRootBlock is configured and that the block is a valid child of the body + if (forcedRootBlockName && self.schema.isValidChild(body.nodeName.toLowerCase(), forcedRootBlockName.toLowerCase())) { + // Padd with bogus BR elements on modern browsers and IE 7 and 8 since they don't render empty P tags properly + content = ie && ie < 11 ? '' : '
'; + content = self.dom.createHTML(forcedRootBlockName, self.settings.forced_root_block_attrs, content); + } else if (!ie) { + // We need to add a BR when forced_root_block is disabled on non IE browsers to place the caret + content = '
'; + } + + self.dom.setHTML(body, content); + + self.fire('SetContent', args); + } else { + // Parse and serialize the html + if (args.format !== 'raw') { + content = new Serializer({}, self.schema).serialize( + self.parser.parse(content, {isRootContent: true}) + ); + } + + // Set the new cleaned contents to the editor + args.content = trim(content); + self.dom.setHTML(body, args.content); + + // Do post processing + if (!args.no_events) { + self.fire('SetContent', args); + } + + // Don't normalize selection if the focused element isn't the body in + // content editable mode since it will steal focus otherwise + /*if (!self.settings.content_editable || document.activeElement === self.getBody()) { + self.selection.normalize(); + }*/ + } + + return args.content; + }, + + /** + * Gets the content from the editor instance, this will cleanup the content before it gets returned using + * the different cleanup rules options. + * + * @method getContent + * @param {Object} args Optional content object, this gets passed around through the whole get process. + * @return {String} Cleaned content string, normally HTML contents. + * @example + * // Get the HTML contents of the currently active editor + * console.debug(tinymce.activeEditor.getContent()); + * + * // Get the raw contents of the currently active editor + * tinymce.activeEditor.getContent({format: 'raw'}); + * + * // Get content of a specific editor: + * tinymce.get('content id').getContent() + */ + getContent: function(args) { + var self = this, content, body = self.getBody(); + + // Setup args object + args = args || {}; + args.format = args.format || 'html'; + args.get = true; + args.getInner = true; + + // Do preprocessing + if (!args.no_events) { + self.fire('BeforeGetContent', args); + } + + // Get raw contents or by default the cleaned contents + if (args.format == 'raw') { + content = body.innerHTML; + } else if (args.format == 'text') { + content = body.innerText || body.textContent; + } else { + content = self.serializer.serialize(body, args); + } + + // Trim whitespace in beginning/end of HTML + if (args.format != 'text') { + args.content = trim(content); + } else { + args.content = content; + } + + // Do post processing + if (!args.no_events) { + self.fire('GetContent', args); + } + + return args.content; + }, + + /** + * Inserts content at caret position. + * + * @method insertContent + * @param {String} content Content to insert. + * @param {Object} args Optional args to pass to insert call. + */ + insertContent: function(content, args) { + if (args) { + content = extend({content: content}, args); + } + + this.execCommand('mceInsertContent', false, content); + }, + + /** + * Returns true/false if the editor is dirty or not. It will get dirty if the user has made modifications to the contents. + * + * @method isDirty + * @return {Boolean} True/false if the editor is dirty or not. It will get dirty if the user has made modifications to the contents. + * @example + * if (tinymce.activeEditor.isDirty()) + * alert("You must save your contents."); + */ + isDirty: function() { + return !this.isNotDirty; + }, + + /** + * Returns the editors container element. The container element wrappes in + * all the elements added to the page for the editor. Such as UI, iframe etc. + * + * @method getContainer + * @return {Element} HTML DOM element for the editor container. + */ + getContainer: function() { + var self = this; + + if (!self.container) { + self.container = DOM.get(self.editorContainer || self.id + '_parent'); + } + + return self.container; + }, + + /** + * Returns the editors content area container element. The this element is the one who + * holds the iframe or the editable element. + * + * @method getContentAreaContainer + * @return {Element} HTML DOM element for the editor area container. + */ + getContentAreaContainer: function() { + return this.contentAreaContainer; + }, + + /** + * Returns the target element/textarea that got replaced with a TinyMCE editor instance. + * + * @method getElement + * @return {Element} HTML DOM element for the replaced element. + */ + getElement: function() { + if (!this.targetElm) { + this.targetElm = DOM.get(this.id); + } + + return this.targetElm; + }, + + /** + * Returns the iframes window object. + * + * @method getWin + * @return {Window} Iframe DOM window object. + */ + getWin: function() { + var self = this, elm; + + if (!self.contentWindow) { + elm = self.iframeElement; + + if (elm) { + self.contentWindow = elm.contentWindow; + } + } + + return self.contentWindow; + }, + + /** + * Returns the iframes document object. + * + * @method getDoc + * @return {Document} Iframe DOM document object. + */ + getDoc: function() { + var self = this, win; + + if (!self.contentDocument) { + win = self.getWin(); + + if (win) { + self.contentDocument = win.document; + } + } + + return self.contentDocument; + }, + + /** + * Returns the root element of the editable area. + * For a non-inline iframe-based editor, returns the iframe's body element. + * + * @method getBody + * @return {Element} The root element of the editable area. + */ + getBody: function() { + return this.bodyElement || this.getDoc().body; + }, + + /** + * URL converter function this gets executed each time a user adds an img, a or + * any other element that has a URL in it. This will be called both by the DOM and HTML + * manipulation functions. + * + * @method convertURL + * @param {string} url URL to convert. + * @param {string} name Attribute name src, href etc. + * @param {string/HTMLElement} elm Tag name or HTML DOM element depending on HTML or DOM insert. + * @return {string} Converted URL string. + */ + convertURL: function(url, name, elm) { + var self = this, settings = self.settings; + + // Use callback instead + if (settings.urlconverter_callback) { + return self.execCallback('urlconverter_callback', url, elm, true, name); + } + + // Don't convert link href since thats the CSS files that gets loaded into the editor also skip local file URLs + if (!settings.convert_urls || (elm && elm.nodeName == 'LINK') || url.indexOf('file:') === 0 || url.length === 0) { + return url; + } + + // Convert to relative + if (settings.relative_urls) { + return self.documentBaseURI.toRelative(url); + } + + // Convert to absolute + url = self.documentBaseURI.toAbsolute(url, settings.remove_script_host); + + return url; + }, + + /** + * Adds visual aid for tables, anchors etc so they can be more easily edited inside the editor. + * + * @method addVisual + * @param {Element} elm Optional root element to loop though to find tables etc that needs the visual aid. + */ + addVisual: function(elm) { + var self = this, settings = self.settings, dom = self.dom, cls; + + elm = elm || self.getBody(); + + if (self.hasVisual === undefined) { + self.hasVisual = settings.visual; + } + + each(dom.select('table,a', elm), function(elm) { + var value; + + switch (elm.nodeName) { + case 'TABLE': + cls = settings.visual_table_class || 'mce-item-table'; + value = dom.getAttrib(elm, 'border'); + + if ((!value || value == '0') && self.hasVisual) { + dom.addClass(elm, cls); + } else { + dom.removeClass(elm, cls); + } + + return; + + case 'A': + if (!dom.getAttrib(elm, 'href', false)) { + value = dom.getAttrib(elm, 'name') || elm.id; + cls = settings.visual_anchor_class || 'mce-item-anchor'; + + if (value && self.hasVisual) { + dom.addClass(elm, cls); + } else { + dom.removeClass(elm, cls); + } + } + + return; + } + }); + + self.fire('VisualAid', {element: elm, hasVisual: self.hasVisual}); + }, + + /** + * Removes the editor from the dom and tinymce collection. + * + * @method remove + */ + remove: function() { + var self = this; + + if (!self.removed) { + self.save(); + self.removed = 1; + self.unbindAllNativeEvents(); + + // Remove any hidden input + if (self.hasHiddenInput) { + DOM.remove(self.getElement().nextSibling); + } + + if (!self.inline) { + // IE 9 has a bug where the selection stops working if you place the + // caret inside the editor then remove the iframe + if (ie && ie < 10) { + self.getDoc().execCommand('SelectAll', false, null); + } + + DOM.setStyle(self.id, 'display', self.orgDisplay); + self.getBody().onload = null; // Prevent #6816 + } + + self.fire('remove'); + + self.editorManager.remove(self); + DOM.remove(self.getContainer()); + self.destroy(); + } + }, + + /** + * Destroys the editor instance by removing all events, element references or other resources + * that could leak memory. This method will be called automatically when the page is unloaded + * but you can also call it directly if you know what you are doing. + * + * @method destroy + * @param {Boolean} automatic Optional state if the destroy is an automatic destroy or user called one. + */ + destroy: function(automatic) { + var self = this, form; + + // One time is enough + if (self.destroyed) { + return; + } + + // If user manually calls destroy and not remove + // Users seems to have logic that calls destroy instead of remove + if (!automatic && !self.removed) { + self.remove(); + return; + } + + if (!automatic) { + self.editorManager.off('beforeunload', self._beforeUnload); + + // Manual destroy + if (self.theme && self.theme.destroy) { + self.theme.destroy(); + } + + // Destroy controls, selection and dom + self.selection.destroy(); + self.dom.destroy(); + } + + form = self.formElement; + if (form) { + if (form._mceOldSubmit) { + form.submit = form._mceOldSubmit; + form._mceOldSubmit = null; + } + + DOM.unbind(form, 'submit reset', self.formEventDelegate); + } + + self.contentAreaContainer = self.formElement = self.container = self.editorContainer = null; + self.bodyElement = self.contentDocument = self.contentWindow = null; + self.iframeElement = self.targetElm = null; + + if (self.selection) { + self.selection = self.selection.win = self.selection.dom = self.selection.dom.doc = null; + } + + self.destroyed = 1; + }, + + // Internal functions + + _refreshContentEditable: function() { + var self = this, body, parent; + + // Check if the editor was hidden and the re-initalize contentEditable mode by removing and adding the body again + if (self._isHidden()) { + body = self.getBody(); + parent = body.parentNode; + + parent.removeChild(body); + parent.appendChild(body); + + body.focus(); + } + }, + + _isHidden: function() { + var sel; + + if (!isGecko) { + return 0; + } + + // Weird, wheres that cursor selection? + sel = this.selection.getSel(); + return (!sel || !sel.rangeCount || sel.rangeCount === 0); + } + }; + + extend(Editor.prototype, EditorObservable); + + return Editor; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/EditorCommands.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/EditorCommands.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,999 @@ +/** + * EditorCommands.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class enables you to add custom editor commands and it contains + * overrides for native browser commands to address various bugs and issues. + * + * @class tinymce.EditorCommands + */ +define("tinymce/EditorCommands", [ + "tinymce/html/Serializer", + "tinymce/Env", + "tinymce/util/Tools", + "tinymce/dom/ElementUtils", + "tinymce/dom/RangeUtils", + "tinymce/dom/TreeWalker" +], function(Serializer, Env, Tools, ElementUtils, RangeUtils, TreeWalker) { + // Added for compression purposes + var each = Tools.each, extend = Tools.extend; + var map = Tools.map, inArray = Tools.inArray, explode = Tools.explode; + var isGecko = Env.gecko, isIE = Env.ie, isOldIE = Env.ie && Env.ie < 11; + var TRUE = true, FALSE = false; + + return function(editor) { + var dom, selection, formatter, + commands = {state: {}, exec: {}, value: {}}, + settings = editor.settings, + bookmark; + + editor.on('PreInit', function() { + dom = editor.dom; + selection = editor.selection; + settings = editor.settings; + formatter = editor.formatter; + }); + + /** + * Executes the specified command. + * + * @method execCommand + * @param {String} command Command to execute. + * @param {Boolean} ui Optional user interface state. + * @param {Object} value Optional value for command. + * @return {Boolean} true/false if the command was found or not. + */ + function execCommand(command, ui, value, args) { + var func, customCommand, state = 0; + + if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(command) && (!args || !args.skip_focus)) { + editor.focus(); + } + + args = extend({}, args); + args = editor.fire('BeforeExecCommand', {command: command, ui: ui, value: value}); + if (args.isDefaultPrevented()) { + return false; + } + + customCommand = command.toLowerCase(); + if ((func = commands.exec[customCommand])) { + func(customCommand, ui, value); + editor.fire('ExecCommand', {command: command, ui: ui, value: value}); + return true; + } + + // Plugin commands + each(editor.plugins, function(p) { + if (p.execCommand && p.execCommand(command, ui, value)) { + editor.fire('ExecCommand', {command: command, ui: ui, value: value}); + state = true; + return false; + } + }); + + if (state) { + return state; + } + + // Theme commands + if (editor.theme && editor.theme.execCommand && editor.theme.execCommand(command, ui, value)) { + editor.fire('ExecCommand', {command: command, ui: ui, value: value}); + return true; + } + + // Browser commands + try { + state = editor.getDoc().execCommand(command, ui, value); + } catch (ex) { + // Ignore old IE errors + } + + if (state) { + editor.fire('ExecCommand', {command: command, ui: ui, value: value}); + return true; + } + + return false; + } + + /** + * Queries the current state for a command for example if the current selection is "bold". + * + * @method queryCommandState + * @param {String} command Command to check the state of. + * @return {Boolean/Number} true/false if the selected contents is bold or not, -1 if it's not found. + */ + function queryCommandState(command) { + var func; + + // Is hidden then return undefined + if (editor._isHidden()) { + return; + } + + command = command.toLowerCase(); + if ((func = commands.state[command])) { + return func(command); + } + + // Browser commands + try { + return editor.getDoc().queryCommandState(command); + } catch (ex) { + // Fails sometimes see bug: 1896577 + } + + return false; + } + + /** + * Queries the command value for example the current fontsize. + * + * @method queryCommandValue + * @param {String} command Command to check the value of. + * @return {Object} Command value of false if it's not found. + */ + function queryCommandValue(command) { + var func; + + // Is hidden then return undefined + if (editor._isHidden()) { + return; + } + + command = command.toLowerCase(); + if ((func = commands.value[command])) { + return func(command); + } + + // Browser commands + try { + return editor.getDoc().queryCommandValue(command); + } catch (ex) { + // Fails sometimes see bug: 1896577 + } + } + + /** + * Adds commands to the command collection. + * + * @method addCommands + * @param {Object} command_list Name/value collection with commands to add, the names can also be comma separated. + * @param {String} type Optional type to add, defaults to exec. Can be value or state as well. + */ + function addCommands(command_list, type) { + type = type || 'exec'; + + each(command_list, function(callback, command) { + each(command.toLowerCase().split(','), function(command) { + commands[type][command] = callback; + }); + }); + } + + function addCommand(command, callback, scope) { + command = command.toLowerCase(); + commands.exec[command] = function(command, ui, value, args) { + return callback.call(scope || editor, ui, value, args); + }; + } + + /** + * Returns true/false if the command is supported or not. + * + * @method queryCommandSupported + * @param {String} cmd Command that we check support for. + * @return {Boolean} true/false if the command is supported or not. + */ + function queryCommandSupported(command) { + command = command.toLowerCase(); + + if (commands.exec[command]) { + return true; + } + + // Browser commands + try { + return editor.getDoc().queryCommandSupported(command); + } catch (ex) { + // Fails sometimes see bug: 1896577 + } + + return false; + } + + function addQueryStateHandler(command, callback, scope) { + command = command.toLowerCase(); + commands.state[command] = function() { + return callback.call(scope || editor); + }; + } + + function addQueryValueHandler(command, callback, scope) { + command = command.toLowerCase(); + commands.value[command] = function() { + return callback.call(scope || editor); + }; + } + + function hasCustomCommand(command) { + command = command.toLowerCase(); + return !!commands.exec[command]; + } + + // Expose public methods + extend(this, { + execCommand: execCommand, + queryCommandState: queryCommandState, + queryCommandValue: queryCommandValue, + queryCommandSupported: queryCommandSupported, + addCommands: addCommands, + addCommand: addCommand, + addQueryStateHandler: addQueryStateHandler, + addQueryValueHandler: addQueryValueHandler, + hasCustomCommand: hasCustomCommand + }); + + // Private methods + + function execNativeCommand(command, ui, value) { + if (ui === undefined) { + ui = FALSE; + } + + if (value === undefined) { + value = null; + } + + return editor.getDoc().execCommand(command, ui, value); + } + + function isFormatMatch(name) { + return formatter.match(name); + } + + function toggleFormat(name, value) { + formatter.toggle(name, value ? {value: value} : undefined); + editor.nodeChanged(); + } + + function storeSelection(type) { + bookmark = selection.getBookmark(type); + } + + function restoreSelection() { + selection.moveToBookmark(bookmark); + } + + // Add execCommand overrides + addCommands({ + // Ignore these, added for compatibility + 'mceResetDesignMode,mceBeginUndoLevel': function() {}, + + // Add undo manager logic + 'mceEndUndoLevel,mceAddUndoLevel': function() { + editor.undoManager.add(); + }, + + 'Cut,Copy,Paste': function(command) { + var doc = editor.getDoc(), failed; + + // Try executing the native command + try { + execNativeCommand(command); + } catch (ex) { + // Command failed + failed = TRUE; + } + + // Present alert message about clipboard access not being available + if (failed || !doc.queryCommandSupported(command)) { + var msg = editor.translate( + "Your browser doesn't support direct access to the clipboard. " + + "Please use the Ctrl+X/C/V keyboard shortcuts instead." + ); + + if (Env.mac) { + msg = msg.replace(/Ctrl\+/g, '\u2318+'); + } + + editor.windowManager.alert(msg); + } + }, + + // Override unlink command + unlink: function() { + if (selection.isCollapsed()) { + var elm = selection.getNode(); + if (elm.tagName == 'A') { + editor.dom.remove(elm, true); + } + + return; + } + + formatter.remove("link"); + }, + + // Override justify commands to use the text formatter engine + 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull': function(command) { + var align = command.substring(7); + + if (align == 'full') { + align = 'justify'; + } + + // Remove all other alignments first + each('left,center,right,justify'.split(','), function(name) { + if (align != name) { + formatter.remove('align' + name); + } + }); + + toggleFormat('align' + align); + execCommand('mceRepaint'); + }, + + // Override list commands to fix WebKit bug + 'InsertUnorderedList,InsertOrderedList': function(command) { + var listElm, listParent; + + execNativeCommand(command); + + // WebKit produces lists within block elements so we need to split them + // we will replace the native list creation logic to custom logic later on + // TODO: Remove this when the list creation logic is removed + listElm = dom.getParent(selection.getNode(), 'ol,ul'); + if (listElm) { + listParent = listElm.parentNode; + + // If list is within a text block then split that block + if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) { + storeSelection(); + dom.split(listParent, listElm); + restoreSelection(); + } + } + }, + + // Override commands to use the text formatter engine + 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function(command) { + toggleFormat(command); + }, + + // Override commands to use the text formatter engine + 'ForeColor,HiliteColor,FontName': function(command, ui, value) { + toggleFormat(command, value); + }, + + FontSize: function(command, ui, value) { + var fontClasses, fontSizes; + + // Convert font size 1-7 to styles + if (value >= 1 && value <= 7) { + fontSizes = explode(settings.font_size_style_values); + fontClasses = explode(settings.font_size_classes); + + if (fontClasses) { + value = fontClasses[value - 1] || value; + } else { + value = fontSizes[value - 1] || value; + } + } + + toggleFormat(command, value); + }, + + RemoveFormat: function(command) { + formatter.remove(command); + }, + + mceBlockQuote: function() { + toggleFormat('blockquote'); + }, + + FormatBlock: function(command, ui, value) { + return toggleFormat(value || 'p'); + }, + + mceCleanup: function() { + var bookmark = selection.getBookmark(); + + editor.setContent(editor.getContent({cleanup: TRUE}), {cleanup: TRUE}); + + selection.moveToBookmark(bookmark); + }, + + mceRemoveNode: function(command, ui, value) { + var node = value || selection.getNode(); + + // Make sure that the body node isn't removed + if (node != editor.getBody()) { + storeSelection(); + editor.dom.remove(node, TRUE); + restoreSelection(); + } + }, + + mceSelectNodeDepth: function(command, ui, value) { + var counter = 0; + + dom.getParent(selection.getNode(), function(node) { + if (node.nodeType == 1 && counter++ == value) { + selection.select(node); + return FALSE; + } + }, editor.getBody()); + }, + + mceSelectNode: function(command, ui, value) { + selection.select(value); + }, + + mceInsertContent: function(command, ui, value) { + var parser, serializer, parentNode, rootNode, fragment, args; + var marker, rng, node, node2, bookmarkHtml, merge; + var textInlineElements = editor.schema.getTextInlineElements(); + + function trimOrPaddLeftRight(html) { + var rng, container, offset; + + rng = selection.getRng(true); + container = rng.startContainer; + offset = rng.startOffset; + + function hasSiblingText(siblingName) { + return container[siblingName] && container[siblingName].nodeType == 3; + } + + if (container.nodeType == 3) { + if (offset > 0) { + html = html.replace(/^ /, ' '); + } else if (!hasSiblingText('previousSibling')) { + html = html.replace(/^ /, ' '); + } + + if (offset < container.length) { + html = html.replace(/ (
|)$/, ' '); + } else if (!hasSiblingText('nextSibling')) { + html = html.replace(/( | )(
|)$/, ' '); + } + } + + return html; + } + + // Removes   from a [b] c -> a  c -> a c + function trimNbspAfterDeleteAndPaddValue() { + var rng, container, offset; + + rng = selection.getRng(true); + container = rng.startContainer; + offset = rng.startOffset; + + if (container.nodeType == 3 && rng.collapsed) { + if (container.data[offset] === '\u00a0') { + container.deleteData(offset, 1); + + if (!/[\u00a0| ]$/.test(value)) { + value += ' '; + } + } else if (container.data[offset - 1] === '\u00a0') { + container.deleteData(offset - 1, 1); + + if (!/[\u00a0| ]$/.test(value)) { + value = ' ' + value; + } + } + } + } + + function markInlineFormatElements(fragment) { + if (merge) { + for (node = fragment.firstChild; node; node = node.walk(true)) { + if (textInlineElements[node.name]) { + node.attr('data-mce-new', "true"); + } + } + } + } + + function reduceInlineTextElements() { + if (merge) { + var root = editor.getBody(), elementUtils = new ElementUtils(dom); + + each(dom.select('*[data-mce-new]'), function(node) { + node.removeAttribute('data-mce-new'); + + for (var testNode = node.parentNode; testNode && testNode != root; testNode = testNode.parentNode) { + if (elementUtils.compare(testNode, node)) { + dom.remove(node, true); + } + } + }); + } + } + + if (typeof value != 'string') { + merge = value.merge; + value = value.content; + } + + // Check for whitespace before/after value + if (/^ | $/.test(value)) { + value = trimOrPaddLeftRight(value); + } + + // Setup parser and serializer + parser = editor.parser; + serializer = new Serializer({}, editor.schema); + bookmarkHtml = '​'; + + // Run beforeSetContent handlers on the HTML to be inserted + args = {content: value, format: 'html', selection: true}; + editor.fire('BeforeSetContent', args); + value = args.content; + + // Add caret at end of contents if it's missing + if (value.indexOf('{$caret}') == -1) { + value += '{$caret}'; + } + + // Replace the caret marker with a span bookmark element + value = value.replace(/\{\$caret\}/, bookmarkHtml); + + // If selection is at |

then move it into

|

+ rng = selection.getRng(); + var caretElement = rng.startContainer || (rng.parentElement ? rng.parentElement() : null); + var body = editor.getBody(); + if (caretElement === body && selection.isCollapsed()) { + if (dom.isBlock(body.firstChild) && dom.isEmpty(body.firstChild)) { + rng = dom.createRng(); + rng.setStart(body.firstChild, 0); + rng.setEnd(body.firstChild, 0); + selection.setRng(rng); + } + } + + // Insert node maker where we will insert the new HTML and get it's parent + if (!selection.isCollapsed()) { + editor.getDoc().execCommand('Delete', false, null); + trimNbspAfterDeleteAndPaddValue(); + } + + parentNode = selection.getNode(); + + // Parse the fragment within the context of the parent node + var parserArgs = {context: parentNode.nodeName.toLowerCase()}; + fragment = parser.parse(value, parserArgs); + + markInlineFormatElements(fragment); + + // Move the caret to a more suitable location + node = fragment.lastChild; + if (node.attr('id') == 'mce_marker') { + marker = node; + + for (node = node.prev; node; node = node.walk(true)) { + if (node.type == 3 || !dom.isBlock(node.name)) { + if (editor.schema.isValidChild(node.parent.name, 'span')) { + node.parent.insert(marker, node, node.name === 'br'); + } + break; + } + } + } + + // If parser says valid we can insert the contents into that parent + if (!parserArgs.invalid) { + value = serializer.serialize(fragment); + + // Check if parent is empty or only has one BR element then set the innerHTML of that parent + node = parentNode.firstChild; + node2 = parentNode.lastChild; + if (!node || (node === node2 && node.nodeName === 'BR')) { + dom.setHTML(parentNode, value); + } else { + selection.setContent(value); + } + } else { + // If the fragment was invalid within that context then we need + // to parse and process the parent it's inserted into + + // Insert bookmark node and get the parent + selection.setContent(bookmarkHtml); + parentNode = selection.getNode(); + rootNode = editor.getBody(); + + // Opera will return the document node when selection is in root + if (parentNode.nodeType == 9) { + parentNode = node = rootNode; + } else { + node = parentNode; + } + + // Find the ancestor just before the root element + while (node !== rootNode) { + parentNode = node; + node = node.parentNode; + } + + // Get the outer/inner HTML depending on if we are in the root and parser and serialize that + value = parentNode == rootNode ? rootNode.innerHTML : dom.getOuterHTML(parentNode); + value = serializer.serialize( + parser.parse( + // Need to replace by using a function since $ in the contents would otherwise be a problem + value.replace(//i, function() { + return serializer.serialize(fragment); + }) + ) + ); + + // Set the inner/outer HTML depending on if we are in the root or not + if (parentNode == rootNode) { + dom.setHTML(rootNode, value); + } else { + dom.setOuterHTML(parentNode, value); + } + } + + reduceInlineTextElements(); + + marker = dom.get('mce_marker'); + selection.scrollIntoView(marker); + + // Move selection before marker and remove it + rng = dom.createRng(); + + // If previous sibling is a text node set the selection to the end of that node + node = marker.previousSibling; + if (node && node.nodeType == 3) { + rng.setStart(node, node.nodeValue.length); + + // TODO: Why can't we normalize on IE + if (!isIE) { + node2 = marker.nextSibling; + if (node2 && node2.nodeType == 3) { + node.appendData(node2.data); + node2.parentNode.removeChild(node2); + } + } + } else { + // If the previous sibling isn't a text node or doesn't exist set the selection before the marker node + rng.setStartBefore(marker); + rng.setEndBefore(marker); + } + + // Remove the marker node and set the new range + dom.remove(marker); + selection.setRng(rng); + + // Dispatch after event and add any visual elements needed + editor.fire('SetContent', args); + editor.addVisual(); + }, + + mceInsertRawHTML: function(command, ui, value) { + selection.setContent('tiny_mce_marker'); + editor.setContent( + editor.getContent().replace(/tiny_mce_marker/g, function() { + return value; + }) + ); + }, + + mceToggleFormat: function(command, ui, value) { + toggleFormat(value); + }, + + mceSetContent: function(command, ui, value) { + editor.setContent(value); + }, + + 'Indent,Outdent': function(command) { + var intentValue, indentUnit, value; + + // Setup indent level + intentValue = settings.indentation; + indentUnit = /[a-z%]+$/i.exec(intentValue); + intentValue = parseInt(intentValue, 10); + + if (!queryCommandState('InsertUnorderedList') && !queryCommandState('InsertOrderedList')) { + // If forced_root_blocks is set to false we don't have a block to indent so lets create a div + if (!settings.forced_root_block && !dom.getParent(selection.getNode(), dom.isBlock)) { + formatter.apply('div'); + } + + each(selection.getSelectedBlocks(), function(element) { + if (element.nodeName != "LI") { + var indentStyleName = editor.getParam('indent_use_margin', false) ? 'margin' : 'padding'; + + indentStyleName += dom.getStyle(element, 'direction', true) == 'rtl' ? 'Right' : 'Left'; + + if (command == 'outdent') { + value = Math.max(0, parseInt(element.style[indentStyleName] || 0, 10) - intentValue); + dom.setStyle(element, indentStyleName, value ? value + indentUnit : ''); + } else { + value = (parseInt(element.style[indentStyleName] || 0, 10) + intentValue) + indentUnit; + dom.setStyle(element, indentStyleName, value); + } + } + }); + } else { + execNativeCommand(command); + } + }, + + mceRepaint: function() { + if (isGecko) { + try { + storeSelection(TRUE); + + if (selection.getSel()) { + selection.getSel().selectAllChildren(editor.getBody()); + } + + selection.collapse(TRUE); + restoreSelection(); + } catch (ex) { + // Ignore + } + } + }, + + InsertHorizontalRule: function() { + editor.execCommand('mceInsertContent', false, '
'); + }, + + mceToggleVisualAid: function() { + editor.hasVisual = !editor.hasVisual; + editor.addVisual(); + }, + + mceReplaceContent: function(command, ui, value) { + editor.execCommand('mceInsertContent', false, value.replace(/\{\$selection\}/g, selection.getContent({format: 'text'}))); + }, + + mceInsertLink: function(command, ui, value) { + var anchor; + + if (typeof value == 'string') { + value = {href: value}; + } + + anchor = dom.getParent(selection.getNode(), 'a'); + + // Spaces are never valid in URLs and it's a very common mistake for people to make so we fix it here. + value.href = value.href.replace(' ', '%20'); + + // Remove existing links if there could be child links or that the href isn't specified + if (!anchor || !value.href) { + formatter.remove('link'); + } + + // Apply new link to selection + if (value.href) { + formatter.apply('link', value, anchor); + } + }, + + selectAll: function() { + var root = dom.getRoot(), rng; + + if (selection.getRng().setStart) { + rng = dom.createRng(); + rng.setStart(root, 0); + rng.setEnd(root, root.childNodes.length); + selection.setRng(rng); + } else { + // IE will render it's own root level block elements and sometimes + // even put font elements in them when the user starts typing. So we need to + // move the selection to a more suitable element from this: + // |

to this:

|

+ rng = selection.getRng(); + if (!rng.item) { + rng.moveToElementText(root); + rng.select(); + } + } + }, + + "delete": function() { + execNativeCommand("Delete"); + + // Check if body is empty after the delete call if so then set the contents + // to an empty string and move the caret to any block produced by that operation + // this fixes the issue with root blocks not being properly produced after a delete call on IE + var body = editor.getBody(); + + if (dom.isEmpty(body)) { + editor.setContent(''); + + if (body.firstChild && dom.isBlock(body.firstChild)) { + editor.selection.setCursorLocation(body.firstChild, 0); + } else { + editor.selection.setCursorLocation(body, 0); + } + } + }, + + mceNewDocument: function() { + editor.setContent(''); + }, + + InsertLineBreak: function(command, ui, value) { + // We load the current event in from EnterKey.js when appropriate to heed + // certain event-specific variations such as ctrl-enter in a list + var evt = value; + var brElm, extraBr, marker; + var rng = selection.getRng(true); + new RangeUtils(dom).normalize(rng); + + var offset = rng.startOffset; + var container = rng.startContainer; + + // Resolve node index + if (container.nodeType == 1 && container.hasChildNodes()) { + var isAfterLastNodeInContainer = offset > container.childNodes.length - 1; + + container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container; + if (isAfterLastNodeInContainer && container.nodeType == 3) { + offset = container.nodeValue.length; + } else { + offset = 0; + } + } + + var parentBlock = dom.getParent(container, dom.isBlock); + var parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5 + var containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null; + var containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5 + + // Enter inside block contained within a LI then split or insert before/after LI + var isControlKey = evt && evt.ctrlKey; + if (containerBlockName == 'LI' && !isControlKey) { + parentBlock = containerBlock; + parentBlockName = containerBlockName; + } + + // Walks the parent block to the right and look for BR elements + function hasRightSideContent() { + var walker = new TreeWalker(container, parentBlock), node; + var nonEmptyElementsMap = editor.schema.getNonEmptyElements(); + + while ((node = walker.next())) { + if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) { + return true; + } + } + } + + if (container && container.nodeType == 3 && offset >= container.nodeValue.length) { + // Insert extra BR element at the end block elements + if (!isOldIE && !hasRightSideContent()) { + brElm = dom.create('br'); + rng.insertNode(brElm); + rng.setStartAfter(brElm); + rng.setEndAfter(brElm); + extraBr = true; + } + } + + brElm = dom.create('br'); + rng.insertNode(brElm); + + // Rendering modes below IE8 doesn't display BR elements in PRE unless we have a \n before it + var documentMode = dom.doc.documentMode; + if (isOldIE && parentBlockName == 'PRE' && (!documentMode || documentMode < 8)) { + brElm.parentNode.insertBefore(dom.doc.createTextNode('\r'), brElm); + } + + // Insert temp marker and scroll to that + marker = dom.create('span', {}, ' '); + brElm.parentNode.insertBefore(marker, brElm); + selection.scrollIntoView(marker); + dom.remove(marker); + + if (!extraBr) { + rng.setStartAfter(brElm); + rng.setEndAfter(brElm); + } else { + rng.setStartBefore(brElm); + rng.setEndBefore(brElm); + } + + selection.setRng(rng); + editor.undoManager.add(); + + return TRUE; + } + }); + + // Add queryCommandState overrides + addCommands({ + // Override justify commands + 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull': function(command) { + var name = 'align' + command.substring(7); + var nodes = selection.isCollapsed() ? [dom.getParent(selection.getNode(), dom.isBlock)] : selection.getSelectedBlocks(); + var matches = map(nodes, function(node) { + return !!formatter.matchNode(node, name); + }); + return inArray(matches, TRUE) !== -1; + }, + + 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function(command) { + return isFormatMatch(command); + }, + + mceBlockQuote: function() { + return isFormatMatch('blockquote'); + }, + + Outdent: function() { + var node; + + if (settings.inline_styles) { + if ((node = dom.getParent(selection.getStart(), dom.isBlock)) && parseInt(node.style.paddingLeft, 10) > 0) { + return TRUE; + } + + if ((node = dom.getParent(selection.getEnd(), dom.isBlock)) && parseInt(node.style.paddingLeft, 10) > 0) { + return TRUE; + } + } + + return ( + queryCommandState('InsertUnorderedList') || + queryCommandState('InsertOrderedList') || + (!settings.inline_styles && !!dom.getParent(selection.getNode(), 'BLOCKQUOTE')) + ); + }, + + 'InsertUnorderedList,InsertOrderedList': function(command) { + var list = dom.getParent(selection.getNode(), 'ul,ol'); + + return list && + ( + command === 'insertunorderedlist' && list.tagName === 'UL' || + command === 'insertorderedlist' && list.tagName === 'OL' + ); + } + }, 'state'); + + // Add queryCommandValue overrides + addCommands({ + 'FontSize,FontName': function(command) { + var value = 0, parent; + + if ((parent = dom.getParent(selection.getNode(), 'span'))) { + if (command == 'fontsize') { + value = parent.style.fontSize; + } else { + value = parent.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase(); + } + } + + return value; + } + }, 'value'); + + // Add undo manager logic + addCommands({ + Undo: function() { + editor.undoManager.undo(); + }, + + Redo: function() { + editor.undoManager.redo(); + } + }); + }; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/EditorManager.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/EditorManager.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,654 @@ +/** + * EditorManager.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class used as a factory for manager for tinymce.Editor instances. + * + * @example + * tinymce.EditorManager.init({}); + * + * @class tinymce.EditorManager + * @mixes tinymce.util.Observable + * @static + */ +define("tinymce/EditorManager", [ + "tinymce/Editor", + "tinymce/dom/DomQuery", + "tinymce/dom/DOMUtils", + "tinymce/util/URI", + "tinymce/Env", + "tinymce/util/Tools", + "tinymce/util/Observable", + "tinymce/util/I18n", + "tinymce/FocusManager" +], function(Editor, DomQuery, DOMUtils, URI, Env, Tools, Observable, I18n, FocusManager) { + var DOM = DOMUtils.DOM; + var explode = Tools.explode, each = Tools.each, extend = Tools.extend; + var instanceCounter = 0, beforeUnloadDelegate, EditorManager; + + function removeEditorFromList(editor) { + var editors = EditorManager.editors, removedFromList; + + delete editors[editor.id]; + + for (var i = 0; i < editors.length; i++) { + if (editors[i] == editor) { + editors.splice(i, 1); + removedFromList = true; + break; + } + } + + // Select another editor since the active one was removed + if (EditorManager.activeEditor == editor) { + EditorManager.activeEditor = editors[0]; + } + + // Clear focusedEditor if necessary, so that we don't try to blur the destroyed editor + if (EditorManager.focusedEditor == editor) { + EditorManager.focusedEditor = null; + } + + return removedFromList; + } + + function purgeDestroyedEditor(editor) { + // User has manually destroyed the editor lets clean up the mess + if (editor && !(editor.getContainer() || editor.getBody()).parentNode) { + removeEditorFromList(editor); + editor.unbindAllNativeEvents(); + editor.destroy(true); + editor = null; + } + + return editor; + } + + EditorManager = { + /** + * Dom query instance. + * + * @property $ + * @type tinymce.dom.DomQuery + */ + $: DomQuery, + + /** + * Major version of TinyMCE build. + * + * @property majorVersion + * @type String + */ + majorVersion: '@@majorVersion@@', + + /** + * Minor version of TinyMCE build. + * + * @property minorVersion + * @type String + */ + minorVersion: '@@minorVersion@@', + + /** + * Release date of TinyMCE build. + * + * @property releaseDate + * @type String + */ + releaseDate: '@@releaseDate@@', + + /** + * Collection of editor instances. + * + * @property editors + * @type Object + * @example + * for (edId in tinymce.editors) + * tinymce.editors[edId].save(); + */ + editors: [], + + /** + * Collection of language pack data. + * + * @property i18n + * @type Object + */ + i18n: I18n, + + /** + * Currently active editor instance. + * + * @property activeEditor + * @type tinymce.Editor + * @example + * tinyMCE.activeEditor.selection.getContent(); + * tinymce.EditorManager.activeEditor.selection.getContent(); + */ + activeEditor: null, + + setup: function() { + var self = this, baseURL, documentBaseURL, suffix = "", preInit, src; + + // Get base URL for the current document + documentBaseURL = document.location.href; + + // Check if the URL is a document based format like: http://site/dir/file and file:/// + // leave other formats like applewebdata://... intact + if (/^[^:]+:\/\/\/?[^\/]+\//.test(documentBaseURL)) { + documentBaseURL = documentBaseURL.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, ''); + + if (!/[\/\\]$/.test(documentBaseURL)) { + documentBaseURL += '/'; + } + } + + // If tinymce is defined and has a base use that or use the old tinyMCEPreInit + preInit = window.tinymce || window.tinyMCEPreInit; + if (preInit) { + baseURL = preInit.base || preInit.baseURL; + suffix = preInit.suffix; + } else { + // Get base where the tinymce script is located + var scripts = document.getElementsByTagName('script'); + for (var i = 0; i < scripts.length; i++) { + src = scripts[i].src; + + // Script types supported: + // tinymce.js tinymce.min.js tinymce.dev.js + // tinymce.jquery.js tinymce.jquery.min.js tinymce.jquery.dev.js + // tinymce.full.js tinymce.full.min.js tinymce.full.dev.js + if (/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(src)) { + if (src.indexOf('.min') != -1) { + suffix = '.min'; + } + + baseURL = src.substring(0, src.lastIndexOf('/')); + break; + } + } + + // We didn't find any baseURL by looking at the script elements + // Try to use the document.currentScript as a fallback + if (!baseURL && document.currentScript) { + src = document.currentScript.src; + + if (src.indexOf('.min') != -1) { + suffix = '.min'; + } + + baseURL = src.substring(0, src.lastIndexOf('/')); + } + } + + /** + * Base URL where the root directory if TinyMCE is located. + * + * @property baseURL + * @type String + */ + self.baseURL = new URI(documentBaseURL).toAbsolute(baseURL); + + /** + * Document base URL where the current document is located. + * + * @property documentBaseURL + * @type String + */ + self.documentBaseURL = documentBaseURL; + + /** + * Absolute baseURI for the installation path of TinyMCE. + * + * @property baseURI + * @type tinymce.util.URI + */ + self.baseURI = new URI(self.baseURL); + + /** + * Current suffix to add to each plugin/theme that gets loaded for example ".min". + * + * @property suffix + * @type String + */ + self.suffix = suffix; + + self.focusManager = new FocusManager(self); + }, + + /** + * Initializes a set of editors. This method will create editors based on various settings. + * + * @method init + * @param {Object} settings Settings object to be passed to each editor instance. + * @example + * // Initializes a editor using the longer method + * tinymce.EditorManager.init({ + * some_settings : 'some value' + * }); + * + * // Initializes a editor instance using the shorter version + * tinyMCE.init({ + * some_settings : 'some value' + * }); + */ + init: function(settings) { + var self = this, editors = []; + + function createId(elm) { + var id = elm.id; + + // Use element id, or unique name or generate a unique id + if (!id) { + id = elm.name; + + if (id && !DOM.get(id)) { + id = elm.name; + } else { + // Generate unique name + id = DOM.uniqueId(); + } + + elm.setAttribute('id', id); + } + + return id; + } + + function createEditor(id, settings, targetElm) { + if (!purgeDestroyedEditor(self.get(id))) { + var editor = new Editor(id, settings, self); + + editor.targetElm = editor.targetElm || targetElm; + editors.push(editor); + editor.render(); + } + } + + function execCallback(name) { + var callback = settings[name]; + + if (!callback) { + return; + } + + return callback.apply(self, Array.prototype.slice.call(arguments, 2)); + } + + function hasClass(elm, className) { + return className.constructor === RegExp ? className.test(elm.className) : DOM.hasClass(elm, className); + } + + function readyHandler() { + var l, co; + + DOM.unbind(window, 'ready', readyHandler); + + execCallback('onpageload'); + + if (settings.types) { + // Process type specific selector + each(settings.types, function(type) { + each(DOM.select(type.selector), function(elm) { + createEditor(createId(elm), extend({}, settings, type), elm); + }); + }); + + return; + } else if (settings.selector) { + // Process global selector + each(DOM.select(settings.selector), function(elm) { + createEditor(createId(elm), settings, elm); + }); + + return; + } else if (settings.target) { + createEditor(createId(settings.target), settings); + } + + // Fallback to old setting + switch (settings.mode) { + case "exact": + l = settings.elements || ''; + + if (l.length > 0) { + each(explode(l), function(id) { + var elm; + + if ((elm = DOM.get(id))) { + createEditor(id, settings, elm); + } else { + each(document.forms, function(f) { + each(f.elements, function(e) { + if (e.name === id) { + id = 'mce_editor_' + instanceCounter++; + DOM.setAttrib(e, 'id', id); + createEditor(id, settings, e); + } + }); + }); + } + }); + } + break; + + case "textareas": + case "specific_textareas": + each(DOM.select('textarea'), function(elm) { + if (settings.editor_deselector && hasClass(elm, settings.editor_deselector)) { + return; + } + + if (!settings.editor_selector || hasClass(elm, settings.editor_selector)) { + createEditor(createId(elm), settings, elm); + } + }); + break; + } + + // Call onInit when all editors are initialized + if (settings.oninit) { + l = co = 0; + + each(editors, function(ed) { + co++; + + if (!ed.initialized) { + // Wait for it + ed.on('init', function() { + l++; + + // All done + if (l == co) { + execCallback('oninit'); + } + }); + } else { + l++; + } + + // All done + if (l == co) { + execCallback('oninit'); + } + }); + } + } + + self.settings = settings; + + DOM.bind(window, 'ready', readyHandler); + }, + + /** + * Returns a editor instance by id. + * + * @method get + * @param {String/Number} id Editor instance id or index to return. + * @return {tinymce.Editor} Editor instance to return. + * @example + * // Adds an onclick event to an editor by id (shorter version) + * tinymce.get('mytextbox').on('click', function(e) { + * ed.windowManager.alert('Hello world!'); + * }); + * + * // Adds an onclick event to an editor by id (longer version) + * tinymce.EditorManager.get('mytextbox').on('click', function(e) { + * ed.windowManager.alert('Hello world!'); + * }); + */ + get: function(id) { + if (!arguments.length) { + return this.editors; + } + + return id in this.editors ? this.editors[id] : null; + }, + + /** + * Adds an editor instance to the editor collection. This will also set it as the active editor. + * + * @method add + * @param {tinymce.Editor} editor Editor instance to add to the collection. + * @return {tinymce.Editor} The same instance that got passed in. + */ + add: function(editor) { + var self = this, editors = self.editors; + + // Add named and index editor instance + editors[editor.id] = editor; + editors.push(editor); + + // Doesn't call setActive method since we don't want + // to fire a bunch of activate/deactivate calls while initializing + self.activeEditor = editor; + + /** + * Fires when an editor is added to the EditorManager collection. + * + * @event AddEditor + * @param {Object} e Event arguments. + */ + self.fire('AddEditor', {editor: editor}); + + if (!beforeUnloadDelegate) { + beforeUnloadDelegate = function() { + self.fire('BeforeUnload'); + }; + + DOM.bind(window, 'beforeunload', beforeUnloadDelegate); + } + + return editor; + }, + + /** + * Creates an editor instance and adds it to the EditorManager collection. + * + * @method createEditor + * @param {String} id Instance id to use for editor. + * @param {Object} settings Editor instance settings. + * @return {tinymce.Editor} Editor instance that got created. + */ + createEditor: function(id, settings) { + return this.add(new Editor(id, settings, this)); + }, + + /** + * Removes a editor or editors form page. + * + * @example + * // Remove all editors bound to divs + * tinymce.remove('div'); + * + * // Remove all editors bound to textareas + * tinymce.remove('textarea'); + * + * // Remove all editors + * tinymce.remove(); + * + * // Remove specific instance by id + * tinymce.remove('#id'); + * + * @method remove + * @param {tinymce.Editor/String/Object} [selector] CSS selector or editor instance to remove. + * @return {tinymce.Editor} The editor that got passed in will be return if it was found otherwise null. + */ + remove: function(selector) { + var self = this, i, editors = self.editors, editor; + + // Remove all editors + if (!selector) { + for (i = editors.length - 1; i >= 0; i--) { + self.remove(editors[i]); + } + + return; + } + + // Remove editors by selector + if (typeof selector == "string") { + selector = selector.selector || selector; + + each(DOM.select(selector), function(elm) { + editor = editors[elm.id]; + + if (editor) { + self.remove(editor); + } + }); + + return; + } + + // Remove specific editor + editor = selector; + + // Not in the collection + if (!editors[editor.id]) { + return null; + } + + /** + * Fires when an editor is removed from EditorManager collection. + * + * @event RemoveEditor + * @param {Object} e Event arguments. + */ + if (removeEditorFromList(editor)) { + self.fire('RemoveEditor', {editor: editor}); + } + + if (!editors.length) { + DOM.unbind(window, 'beforeunload', beforeUnloadDelegate); + } + + editor.remove(); + + return editor; + }, + + /** + * Executes a specific command on the currently active editor. + * + * @method execCommand + * @param {String} c Command to perform for example Bold. + * @param {Boolean} u Optional boolean state if a UI should be presented for the command or not. + * @param {String} v Optional value parameter like for example an URL to a link. + * @return {Boolean} true/false if the command was executed or not. + */ + execCommand: function(cmd, ui, value) { + var self = this, editor = self.get(value); + + // Manager commands + switch (cmd) { + case "mceAddEditor": + if (!self.get(value)) { + new Editor(value, self.settings, self).render(); + } + + return true; + + case "mceRemoveEditor": + if (editor) { + editor.remove(); + } + + return true; + + case 'mceToggleEditor': + if (!editor) { + self.execCommand('mceAddEditor', 0, value); + return true; + } + + if (editor.isHidden()) { + editor.show(); + } else { + editor.hide(); + } + + return true; + } + + // Run command on active editor + if (self.activeEditor) { + return self.activeEditor.execCommand(cmd, ui, value); + } + + return false; + }, + + /** + * Calls the save method on all editor instances in the collection. This can be useful when a form is to be submitted. + * + * @method triggerSave + * @example + * // Saves all contents + * tinyMCE.triggerSave(); + */ + triggerSave: function() { + each(this.editors, function(editor) { + editor.save(); + }); + }, + + /** + * Adds a language pack, this gets called by the loaded language files like en.js. + * + * @method addI18n + * @param {String} code Optional language code. + * @param {Object} items Name/value object with translations. + */ + addI18n: function(code, items) { + I18n.add(code, items); + }, + + /** + * Translates the specified string using the language pack items. + * + * @method translate + * @param {String/Array/Object} text String to translate + * @return {String} Translated string. + */ + translate: function(text) { + return I18n.translate(text); + }, + + /** + * Sets the active editor instance and fires the deactivate/activate events. + * + * @method setActive + * @param {tinymce.Editor} editor Editor instance to set as the active instance. + */ + setActive: function(editor) { + var activeEditor = this.activeEditor; + + if (this.activeEditor != editor) { + if (activeEditor) { + activeEditor.fire('deactivate', {relatedTarget: editor}); + } + + editor.fire('activate', {relatedTarget: activeEditor}); + } + + this.activeEditor = editor; + } + }; + + extend(EditorManager, Observable); + + EditorManager.setup(); + + // Export EditorManager as tinymce/tinymce in global namespace + window.tinymce = window.tinyMCE = EditorManager; + + return EditorManager; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/EditorObservable.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/EditorObservable.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,204 @@ +/** + * EditorObservable.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This mixin contains the event logic for the tinymce.Editor class. + * + * @mixin tinymce.EditorObservable + * @extends tinymce.util.Observable + */ +define("tinymce/EditorObservable", [ + "tinymce/util/Observable", + "tinymce/dom/DOMUtils", + "tinymce/util/Tools" +], function(Observable, DOMUtils, Tools) { + var DOM = DOMUtils.DOM, customEventRootDelegates; + + /** + * Returns the event target so for the specified event. Some events fire + * only on document, some fire on documentElement etc. This also handles the + * custom event root setting where it returns that element instead of the body. + * + * @private + * @param {tinymce.Editor} editor Editor instance to get event target from. + * @param {String} eventName Name of the event for example "click". + * @return {Element/Document} HTML Element or document target to bind on. + */ + function getEventTarget(editor, eventName) { + if (eventName == 'selectionchange') { + return editor.getDoc(); + } + + // Need to bind mousedown/mouseup etc to document not body in iframe mode + // Since the user might click on the HTML element not the BODY + if (!editor.inline && /^mouse|click|contextmenu|drop|dragover|dragend/.test(eventName)) { + return editor.getDoc().documentElement; + } + + // Bind to event root instead of body if it's defined + if (editor.settings.event_root) { + if (!editor.eventRoot) { + editor.eventRoot = DOM.select(editor.settings.event_root)[0]; + } + + return editor.eventRoot; + } + + return editor.getBody(); + } + + /** + * Binds a event delegate for the specified name this delegate will fire + * the event to the editor dispatcher. + * + * @private + * @param {tinymce.Editor} editor Editor instance to get event target from. + * @param {String} eventName Name of the event for example "click". + */ + function bindEventDelegate(editor, eventName) { + var eventRootElm = getEventTarget(editor, eventName), delegate; + + if (!editor.delegates) { + editor.delegates = {}; + } + + if (editor.delegates[eventName]) { + return; + } + + if (editor.settings.event_root) { + if (!customEventRootDelegates) { + customEventRootDelegates = {}; + editor.editorManager.on('removeEditor', function() { + var name; + + if (!editor.editorManager.activeEditor) { + if (customEventRootDelegates) { + for (name in customEventRootDelegates) { + editor.dom.unbind(getEventTarget(editor, name)); + } + + customEventRootDelegates = null; + } + } + }); + } + + if (customEventRootDelegates[eventName]) { + return; + } + + delegate = function(e) { + var target = e.target, editors = editor.editorManager.editors, i = editors.length; + + while (i--) { + var body = editors[i].getBody(); + + if (body === target || DOM.isChildOf(target, body)) { + if (!editors[i].hidden) { + editors[i].fire(eventName, e); + } + } + } + }; + + customEventRootDelegates[eventName] = delegate; + DOM.bind(eventRootElm, eventName, delegate); + } else { + delegate = function(e) { + if (!editor.hidden) { + editor.fire(eventName, e); + } + }; + + DOM.bind(eventRootElm, eventName, delegate); + editor.delegates[eventName] = delegate; + } + } + + var EditorObservable = { + /** + * Bind any pending event delegates. This gets executed after the target body/document is created. + * + * @private + */ + bindPendingEventDelegates: function() { + var self = this; + + Tools.each(self._pendingNativeEvents, function(name) { + bindEventDelegate(self, name); + }); + }, + + /** + * Toggles a native event on/off this is called by the EventDispatcher when + * the first native event handler is added and when the last native event handler is removed. + * + * @private + */ + toggleNativeEvent: function(name, state) { + var self = this; + + if (self.settings.readonly) { + return; + } + + // Never bind focus/blur since the FocusManager fakes those + if (name == "focus" || name == "blur") { + return; + } + + if (state) { + if (self.initialized) { + bindEventDelegate(self, name); + } else { + if (!self._pendingNativeEvents) { + self._pendingNativeEvents = [name]; + } else { + self._pendingNativeEvents.push(name); + } + } + } else if (self.initialized) { + self.dom.unbind(getEventTarget(self, name), name, self.delegates[name]); + delete self.delegates[name]; + } + }, + + /** + * Unbinds all native event handlers that means delegates, custom events bound using the Events API etc. + * + * @private + */ + unbindAllNativeEvents: function() { + var self = this, name; + + if (self.delegates) { + for (name in self.delegates) { + self.dom.unbind(getEventTarget(self, name), name, self.delegates[name]); + } + + delete self.delegates; + } + + if (!self.inline) { + self.getBody().onload = null; + self.dom.unbind(self.getWin()); + self.dom.unbind(self.getDoc()); + } + + self.dom.unbind(self.getBody()); + self.dom.unbind(self.getContainer()); + } + }; + + EditorObservable = Tools.extend({}, Observable, EditorObservable); + + return EditorObservable; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/EnterKey.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/EnterKey.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,638 @@ +/** + * EnterKey.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Contains logic for handling the enter key to split/generate block elements. + */ +define("tinymce/EnterKey", [ + "tinymce/dom/TreeWalker", + "tinymce/dom/RangeUtils", + "tinymce/Env" +], function(TreeWalker, RangeUtils, Env) { + var isIE = Env.ie && Env.ie < 11; + + return function(editor) { + var dom = editor.dom, selection = editor.selection, settings = editor.settings; + var undoManager = editor.undoManager, schema = editor.schema, nonEmptyElementsMap = schema.getNonEmptyElements(), + moveCaretBeforeOnEnterElementsMap = schema.getMoveCaretBeforeOnEnterElements(); + + function handleEnterKey(evt) { + var rng, tmpRng, editableRoot, container, offset, parentBlock, documentMode, shiftKey, + newBlock, fragment, containerBlock, parentBlockName, containerBlockName, newBlockName, isAfterLastNodeInContainer; + + // Returns true if the block can be split into two blocks or not + function canSplitBlock(node) { + return node && + dom.isBlock(node) && + !/^(TD|TH|CAPTION|FORM)$/.test(node.nodeName) && + !/^(fixed|absolute)/i.test(node.style.position) && + dom.getContentEditable(node) !== "true"; + } + + // Renders empty block on IE + function renderBlockOnIE(block) { + var oldRng; + + if (dom.isBlock(block)) { + oldRng = selection.getRng(); + block.appendChild(dom.create('span', null, '\u00a0')); + selection.select(block); + block.lastChild.outerHTML = ''; + selection.setRng(oldRng); + } + } + + // Remove the first empty inline element of the block so this:

x

becomes this:

x

+ function trimInlineElementsOnLeftSideOfBlock(block) { + var node = block, firstChilds = [], i; + + if (!node) { + return; + } + + // Find inner most first child ex:

*

+ while ((node = node.firstChild)) { + if (dom.isBlock(node)) { + return; + } + + if (node.nodeType == 1 && !nonEmptyElementsMap[node.nodeName.toLowerCase()]) { + firstChilds.push(node); + } + } + + i = firstChilds.length; + while (i--) { + node = firstChilds[i]; + if (!node.hasChildNodes() || (node.firstChild == node.lastChild && node.firstChild.nodeValue === '')) { + dom.remove(node); + } else { + // Remove see #5381 + if (node.nodeName == "A" && (node.innerText || node.textContent) === ' ') { + dom.remove(node); + } + } + } + } + + // Moves the caret to a suitable position within the root for example in the first non + // pure whitespace text node or before an image + function moveToCaretPosition(root) { + var walker, node, rng, lastNode = root, tempElm; + function firstNonWhiteSpaceNodeSibling(node) { + while (node) { + if (node.nodeType == 1 || (node.nodeType == 3 && node.data && /[\r\n\s]/.test(node.data))) { + return node; + } + + node = node.nextSibling; + } + } + + if (!root) { + return; + } + + // Old IE versions doesn't properly render blocks with br elements in them + // For example


wont be rendered correctly in a contentEditable area + // until you remove the br producing

+ if (Env.ie && Env.ie < 9 && parentBlock && parentBlock.firstChild) { + if (parentBlock.firstChild == parentBlock.lastChild && parentBlock.firstChild.tagName == 'BR') { + dom.remove(parentBlock.firstChild); + } + } + + if (/^(LI|DT|DD)$/.test(root.nodeName)) { + var firstChild = firstNonWhiteSpaceNodeSibling(root.firstChild); + + if (firstChild && /^(UL|OL|DL)$/.test(firstChild.nodeName)) { + root.insertBefore(dom.doc.createTextNode('\u00a0'), root.firstChild); + } + } + + rng = dom.createRng(); + + // Normalize whitespace to remove empty text nodes. Fix for: #6904 + // Gecko will be able to place the caret in empty text nodes but it won't render propery + // Older IE versions will sometimes crash so for now ignore all IE versions + if (!Env.ie) { + root.normalize(); + } + + if (root.hasChildNodes()) { + walker = new TreeWalker(root, root); + + while ((node = walker.current())) { + if (node.nodeType == 3) { + rng.setStart(node, 0); + rng.setEnd(node, 0); + break; + } + + if (moveCaretBeforeOnEnterElementsMap[node.nodeName.toLowerCase()]) { + rng.setStartBefore(node); + rng.setEndBefore(node); + break; + } + + lastNode = node; + node = walker.next(); + } + + if (!node) { + rng.setStart(lastNode, 0); + rng.setEnd(lastNode, 0); + } + } else { + if (root.nodeName == 'BR') { + if (root.nextSibling && dom.isBlock(root.nextSibling)) { + // Trick on older IE versions to render the caret before the BR between two lists + if (!documentMode || documentMode < 9) { + tempElm = dom.create('br'); + root.parentNode.insertBefore(tempElm, root); + } + + rng.setStartBefore(root); + rng.setEndBefore(root); + } else { + rng.setStartAfter(root); + rng.setEndAfter(root); + } + } else { + rng.setStart(root, 0); + rng.setEnd(root, 0); + } + } + + selection.setRng(rng); + + // Remove tempElm created for old IE:s + dom.remove(tempElm); + selection.scrollIntoView(root); + } + + function setForcedBlockAttrs(node) { + var forcedRootBlockName = settings.forced_root_block; + + if (forcedRootBlockName && forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) { + dom.setAttribs(node, settings.forced_root_block_attrs); + } + } + + // Creates a new block element by cloning the current one or creating a new one if the name is specified + // This function will also copy any text formatting from the parent block and add it to the new one + function createNewBlock(name) { + var node = container, block, clonedNode, caretNode, textInlineElements = schema.getTextInlineElements(); + + if (name || parentBlockName == "TABLE") { + block = dom.create(name || newBlockName); + setForcedBlockAttrs(block); + } else { + block = parentBlock.cloneNode(false); + } + + caretNode = block; + + // Clone any parent styles + if (settings.keep_styles !== false) { + do { + if (textInlineElements[node.nodeName]) { + // Never clone a caret containers + if (node.id == '_mce_caret') { + continue; + } + + clonedNode = node.cloneNode(false); + dom.setAttrib(clonedNode, 'id', ''); // Remove ID since it needs to be document unique + + if (block.hasChildNodes()) { + clonedNode.appendChild(block.firstChild); + block.appendChild(clonedNode); + } else { + caretNode = clonedNode; + block.appendChild(clonedNode); + } + } + } while ((node = node.parentNode)); + } + + // BR is needed in empty blocks on non IE browsers + if (!isIE) { + caretNode.innerHTML = '
'; + } + + return block; + } + + // Returns true/false if the caret is at the start/end of the parent block element + function isCaretAtStartOrEndOfBlock(start) { + var walker, node, name; + + // Caret is in the middle of a text node like "a|b" + if (container.nodeType == 3 && (start ? offset > 0 : offset < container.nodeValue.length)) { + return false; + } + + // If after the last element in block node edge case for #5091 + if (container.parentNode == parentBlock && isAfterLastNodeInContainer && !start) { + return true; + } + + // If the caret if before the first element in parentBlock + if (start && container.nodeType == 1 && container == parentBlock.firstChild) { + return true; + } + + // Caret can be before/after a table + if (container.nodeName === "TABLE" || (container.previousSibling && container.previousSibling.nodeName == "TABLE")) { + return (isAfterLastNodeInContainer && !start) || (!isAfterLastNodeInContainer && start); + } + + // Walk the DOM and look for text nodes or non empty elements + walker = new TreeWalker(container, parentBlock); + + // If caret is in beginning or end of a text block then jump to the next/previous node + if (container.nodeType == 3) { + if (start && offset === 0) { + walker.prev(); + } else if (!start && offset == container.nodeValue.length) { + walker.next(); + } + } + + while ((node = walker.current())) { + if (node.nodeType === 1) { + // Ignore bogus elements + if (!node.getAttribute('data-mce-bogus')) { + // Keep empty elements like but not trailing br:s like

text|

+ name = node.nodeName.toLowerCase(); + if (nonEmptyElementsMap[name] && name !== 'br') { + return false; + } + } + } else if (node.nodeType === 3 && !/^[ \t\r\n]*$/.test(node.nodeValue)) { + return false; + } + + if (start) { + walker.prev(); + } else { + walker.next(); + } + } + + return true; + } + + // Wraps any text nodes or inline elements in the specified forced root block name + function wrapSelfAndSiblingsInDefaultBlock(container, offset) { + var newBlock, parentBlock, startNode, node, next, rootBlockName, blockName = newBlockName || 'P'; + + // Not in a block element or in a table cell or caption + parentBlock = dom.getParent(container, dom.isBlock); + rootBlockName = editor.getBody().nodeName.toLowerCase(); + if (!parentBlock || !canSplitBlock(parentBlock)) { + parentBlock = parentBlock || editableRoot; + + if (!parentBlock.hasChildNodes()) { + newBlock = dom.create(blockName); + setForcedBlockAttrs(newBlock); + parentBlock.appendChild(newBlock); + rng.setStart(newBlock, 0); + rng.setEnd(newBlock, 0); + return newBlock; + } + + // Find parent that is the first child of parentBlock + node = container; + while (node.parentNode != parentBlock) { + node = node.parentNode; + } + + // Loop left to find start node start wrapping at + while (node && !dom.isBlock(node)) { + startNode = node; + node = node.previousSibling; + } + + if (startNode && schema.isValidChild(rootBlockName, blockName.toLowerCase())) { + newBlock = dom.create(blockName); + setForcedBlockAttrs(newBlock); + startNode.parentNode.insertBefore(newBlock, startNode); + + // Start wrapping until we hit a block + node = startNode; + while (node && !dom.isBlock(node)) { + next = node.nextSibling; + newBlock.appendChild(node); + node = next; + } + + // Restore range to it's past location + rng.setStart(container, offset); + rng.setEnd(container, offset); + } + } + + return container; + } + + // Inserts a block or br before/after or in the middle of a split list of the LI is empty + function handleEmptyListItem() { + function isFirstOrLastLi(first) { + var node = containerBlock[first ? 'firstChild' : 'lastChild']; + + // Find first/last element since there might be whitespace there + while (node) { + if (node.nodeType == 1) { + break; + } + + node = node[first ? 'nextSibling' : 'previousSibling']; + } + + return node === parentBlock; + } + + function getContainerBlock() { + var containerBlockParent = containerBlock.parentNode; + + if (/^(LI|DT|DD)$/.test(containerBlockParent.nodeName)) { + return containerBlockParent; + } + + return containerBlock; + } + + // Check if we are in an nested list + var containerBlockParentName = containerBlock.parentNode.nodeName; + if (/^(OL|UL|LI)$/.test(containerBlockParentName)) { + newBlockName = 'LI'; + } + + newBlock = newBlockName ? createNewBlock(newBlockName) : dom.create('BR'); + + if (isFirstOrLastLi(true) && isFirstOrLastLi()) { + if (containerBlockParentName == 'LI') { + // Nested list is inside a LI + dom.insertAfter(newBlock, getContainerBlock()); + } else { + // Is first and last list item then replace the OL/UL with a text block + dom.replace(newBlock, containerBlock); + } + } else if (isFirstOrLastLi(true)) { + if (containerBlockParentName == 'LI') { + // List nested in an LI then move the list to a new sibling LI + dom.insertAfter(newBlock, getContainerBlock()); + newBlock.appendChild(dom.doc.createTextNode(' ')); // Needed for IE so the caret can be placed + newBlock.appendChild(containerBlock); + } else { + // First LI in list then remove LI and add text block before list + containerBlock.parentNode.insertBefore(newBlock, containerBlock); + } + } else if (isFirstOrLastLi()) { + // Last LI in list then remove LI and add text block after list + dom.insertAfter(newBlock, getContainerBlock()); + renderBlockOnIE(newBlock); + } else { + // Middle LI in list the split the list and insert a text block in the middle + // Extract after fragment and insert it after the current block + containerBlock = getContainerBlock(); + tmpRng = rng.cloneRange(); + tmpRng.setStartAfter(parentBlock); + tmpRng.setEndAfter(containerBlock); + fragment = tmpRng.extractContents(); + + if (newBlockName == 'LI' && fragment.firstChild.nodeName == 'LI') { + newBlock = fragment.firstChild; + dom.insertAfter(fragment, containerBlock); + } else { + dom.insertAfter(fragment, containerBlock); + dom.insertAfter(newBlock, containerBlock); + } + } + + dom.remove(parentBlock); + moveToCaretPosition(newBlock); + undoManager.add(); + } + + // Inserts a BR element if the forced_root_block option is set to false or empty string + function insertBr() { + editor.execCommand("InsertLineBreak", false, evt); + } + + // Trims any linebreaks at the beginning of node user for example when pressing enter in a PRE element + function trimLeadingLineBreaks(node) { + do { + if (node.nodeType === 3) { + node.nodeValue = node.nodeValue.replace(/^[\r\n]+/, ''); + } + + node = node.firstChild; + } while (node); + } + + function getEditableRoot(node) { + var root = dom.getRoot(), parent, editableRoot; + + // Get all parents until we hit a non editable parent or the root + parent = node; + while (parent !== root && dom.getContentEditable(parent) !== "false") { + if (dom.getContentEditable(parent) === "true") { + editableRoot = parent; + } + + parent = parent.parentNode; + } + + return parent !== root ? editableRoot : root; + } + + // Adds a BR at the end of blocks that only contains an IMG or INPUT since + // these might be floated and then they won't expand the block + function addBrToBlockIfNeeded(block) { + var lastChild; + + // IE will render the blocks correctly other browsers needs a BR + if (!isIE) { + block.normalize(); // Remove empty text nodes that got left behind by the extract + + // Check if the block is empty or contains a floated last child + lastChild = block.lastChild; + if (!lastChild || (/^(left|right)$/gi.test(dom.getStyle(lastChild, 'float', true)))) { + dom.add(block, 'br'); + } + } + } + + rng = selection.getRng(true); + + // Event is blocked by some other handler for example the lists plugin + if (evt.isDefaultPrevented()) { + return; + } + + // Delete any selected contents + if (!rng.collapsed) { + editor.execCommand('Delete'); + return; + } + + // Setup range items and newBlockName + new RangeUtils(dom).normalize(rng); + container = rng.startContainer; + offset = rng.startOffset; + newBlockName = (settings.force_p_newlines ? 'p' : '') || settings.forced_root_block; + newBlockName = newBlockName ? newBlockName.toUpperCase() : ''; + documentMode = dom.doc.documentMode; + shiftKey = evt.shiftKey; + + // Resolve node index + if (container.nodeType == 1 && container.hasChildNodes()) { + isAfterLastNodeInContainer = offset > container.childNodes.length - 1; + + container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container; + if (isAfterLastNodeInContainer && container.nodeType == 3) { + offset = container.nodeValue.length; + } else { + offset = 0; + } + } + + // Get editable root node normaly the body element but sometimes a div or span + editableRoot = getEditableRoot(container); + + // If there is no editable root then enter is done inside a contentEditable false element + if (!editableRoot) { + return; + } + + undoManager.beforeChange(); + + // If editable root isn't block nor the root of the editor + if (!dom.isBlock(editableRoot) && editableRoot != dom.getRoot()) { + if (!newBlockName || shiftKey) { + insertBr(); + } + + return; + } + + // Wrap the current node and it's sibling in a default block if it's needed. + // for example this text|text2 will become this

text|text2

+ // This won't happen if root blocks are disabled or the shiftKey is pressed + if ((newBlockName && !shiftKey) || (!newBlockName && shiftKey)) { + container = wrapSelfAndSiblingsInDefaultBlock(container, offset); + } + + // Find parent block and setup empty block paddings + parentBlock = dom.getParent(container, dom.isBlock); + containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null; + + // Setup block names + parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5 + containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5 + + // Enter inside block contained within a LI then split or insert before/after LI + if (containerBlockName == 'LI' && !evt.ctrlKey) { + parentBlock = containerBlock; + parentBlockName = containerBlockName; + } + + // Handle enter in list item + if (/^(LI|DT|DD)$/.test(parentBlockName)) { + if (!newBlockName && shiftKey) { + insertBr(); + return; + } + + // Handle enter inside an empty list item + if (dom.isEmpty(parentBlock)) { + handleEmptyListItem(); + return; + } + } + + // Don't split PRE tags but insert a BR instead easier when writing code samples etc + if (parentBlockName == 'PRE' && settings.br_in_pre !== false) { + if (!shiftKey) { + insertBr(); + return; + } + } else { + // If no root block is configured then insert a BR by default or if the shiftKey is pressed + if ((!newBlockName && !shiftKey && parentBlockName != 'LI') || (newBlockName && shiftKey)) { + insertBr(); + return; + } + } + + // If parent block is root then never insert new blocks + if (newBlockName && parentBlock === editor.getBody()) { + return; + } + + // Default block name if it's not configured + newBlockName = newBlockName || 'P'; + + // Insert new block before/after the parent block depending on caret location + if (isCaretAtStartOrEndOfBlock()) { + // If the caret is at the end of a header we produce a P tag after it similar to Word unless we are in a hgroup + if (/^(H[1-6]|PRE|FIGURE)$/.test(parentBlockName) && containerBlockName != 'HGROUP') { + newBlock = createNewBlock(newBlockName); + } else { + newBlock = createNewBlock(); + } + + // Split the current container block element if enter is pressed inside an empty inner block element + if (settings.end_container_on_empty_block && canSplitBlock(containerBlock) && dom.isEmpty(parentBlock)) { + // Split container block for example a BLOCKQUOTE at the current blockParent location for example a P + newBlock = dom.split(containerBlock, parentBlock); + } else { + dom.insertAfter(newBlock, parentBlock); + } + + moveToCaretPosition(newBlock); + } else if (isCaretAtStartOrEndOfBlock(true)) { + // Insert new block before + newBlock = parentBlock.parentNode.insertBefore(createNewBlock(), parentBlock); + renderBlockOnIE(newBlock); + moveToCaretPosition(parentBlock); + } else { + // Extract after fragment and insert it after the current block + tmpRng = rng.cloneRange(); + tmpRng.setEndAfter(parentBlock); + fragment = tmpRng.extractContents(); + trimLeadingLineBreaks(fragment); + newBlock = fragment.firstChild; + dom.insertAfter(fragment, parentBlock); + trimInlineElementsOnLeftSideOfBlock(newBlock); + addBrToBlockIfNeeded(parentBlock); + moveToCaretPosition(newBlock); + } + + dom.setAttrib(newBlock, 'id', ''); // Remove ID since it needs to be document unique + + // Allow custom handling of new blocks + editor.fire('NewBlock', {newBlock: newBlock}); + + undoManager.add(); + } + + editor.on('keydown', function(evt) { + if (evt.keyCode == 13) { + if (handleEnterKey(evt) !== false) { + evt.preventDefault(); + } + } + }); + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/Env.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/Env.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,150 @@ +/** + * Env.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class contains various environment constants like browser versions etc. + * Normally you don't want to sniff specific browser versions but sometimes you have + * to when it's impossible to feature detect. So use this with care. + * + * @class tinymce.Env + * @static + */ +define("tinymce/Env", [], function() { + var nav = navigator, userAgent = nav.userAgent; + var opera, webkit, ie, ie11, ie12, gecko, mac, iDevice, android; + + opera = window.opera && window.opera.buildNumber; + android = /Android/.test(userAgent); + webkit = /WebKit/.test(userAgent); + ie = !webkit && !opera && (/MSIE/gi).test(userAgent) && (/Explorer/gi).test(nav.appName); + ie = ie && /MSIE (\w+)\./.exec(userAgent)[1]; + ie11 = userAgent.indexOf('Trident/') != -1 && (userAgent.indexOf('rv:') != -1 || nav.appName.indexOf('Netscape') != -1) ? 11 : false; + ie12 = (document.msElementsFromPoint && !ie && !ie11) ? 12 : false; + ie = ie || ie11 || ie12; + gecko = !webkit && !ie11 && /Gecko/.test(userAgent); + mac = userAgent.indexOf('Mac') != -1; + iDevice = /(iPad|iPhone)/.test(userAgent); + + if (ie12) { + webkit = false; + } + + // Is a iPad/iPhone and not on iOS5 sniff the WebKit version since older iOS WebKit versions + // says it has contentEditable support but there is no visible caret. + var contentEditable = !iDevice || userAgent.match(/AppleWebKit\/(\d*)/)[1] >= 534; + + return { + /** + * Constant that is true if the browser is Opera. + * + * @property opera + * @type Boolean + * @final + */ + opera: opera, + + /** + * Constant that is true if the browser is WebKit (Safari/Chrome). + * + * @property webKit + * @type Boolean + * @final + */ + webkit: webkit, + + /** + * Constant that is more than zero if the browser is IE. + * + * @property ie + * @type Boolean + * @final + */ + ie: ie, + + /** + * Constant that is true if the browser is Gecko. + * + * @property gecko + * @type Boolean + * @final + */ + gecko: gecko, + + /** + * Constant that is true if the os is Mac OS. + * + * @property mac + * @type Boolean + * @final + */ + mac: mac, + + /** + * Constant that is true if the os is iOS. + * + * @property iOS + * @type Boolean + * @final + */ + iOS: iDevice, + + /** + * Constant that is true if the os is android. + * + * @property android + * @type Boolean + * @final + */ + android: android, + + /** + * Constant that is true if the browser supports editing. + * + * @property contentEditable + * @type Boolean + * @final + */ + contentEditable: contentEditable, + + /** + * Transparent image data url. + * + * @property transparentSrc + * @type Boolean + * @final + */ + transparentSrc: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", + + /** + * Returns true/false if the browser can or can't place the caret after a inline block like an image. + * + * @property noCaretAfter + * @type Boolean + * @final + */ + caretAfter: ie != 8, + + /** + * Constant that is true if the browser supports native DOM Ranges. IE 9+. + * + * @property range + * @type Boolean + */ + range: window.getSelection && "Range" in window, + + /** + * Returns the IE document mode for non IE browsers this will fake IE 10. + * + * @property documentMode + * @type Number + */ + documentMode: ie && !ie12 ? (document.documentMode || 7) : 10 + }; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/FocusManager.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/FocusManager.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,264 @@ +/** + * FocusManager.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class manages the focus/blur state of the editor. This class is needed since some + * browsers fire false focus/blur states when the selection is moved to a UI dialog or similar. + * + * This class will fire two events focus and blur on the editor instances that got affected. + * It will also handle the restore of selection when the focus is lost and returned. + * + * @class tinymce.FocusManager + */ +define("tinymce/FocusManager", [ + "tinymce/dom/DOMUtils", + "tinymce/Env" +], function(DOMUtils, Env) { + var selectionChangeHandler, documentFocusInHandler, documentMouseUpHandler, DOM = DOMUtils.DOM; + + /** + * Constructs a new focus manager instance. + * + * @constructor FocusManager + * @param {tinymce.EditorManager} editorManager Editor manager instance to handle focus for. + */ + function FocusManager(editorManager) { + function getActiveElement() { + try { + return document.activeElement; + } catch (ex) { + // IE sometimes fails to get the activeElement when resizing table + // TODO: Investigate this + return document.body; + } + } + + // We can't store a real range on IE 11 since it gets mutated so we need to use a bookmark object + // TODO: Move this to a separate range utils class since it's it's logic is present in Selection as well. + function createBookmark(dom, rng) { + if (rng && rng.startContainer) { + // Verify that the range is within the root of the editor + if (!dom.isChildOf(rng.startContainer, dom.getRoot()) || !dom.isChildOf(rng.endContainer, dom.getRoot())) { + return; + } + + return { + startContainer: rng.startContainer, + startOffset: rng.startOffset, + endContainer: rng.endContainer, + endOffset: rng.endOffset + }; + } + + return rng; + } + + function bookmarkToRng(editor, bookmark) { + var rng; + + if (bookmark.startContainer) { + rng = editor.getDoc().createRange(); + rng.setStart(bookmark.startContainer, bookmark.startOffset); + rng.setEnd(bookmark.endContainer, bookmark.endOffset); + } else { + rng = bookmark; + } + + return rng; + } + + function isUIElement(elm) { + return !!DOM.getParent(elm, FocusManager.isEditorUIElement); + } + + function registerEvents(e) { + var editor = e.editor; + + editor.on('init', function() { + // Gecko/WebKit has ghost selections in iframes and IE only has one selection per browser tab + if (editor.inline || Env.ie) { + // Use the onbeforedeactivate event when available since it works better see #7023 + if ("onbeforedeactivate" in document && Env.ie < 9) { + editor.dom.bind(editor.getBody(), 'beforedeactivate', function(e) { + if (e.target != editor.getBody()) { + return; + } + + try { + editor.lastRng = editor.selection.getRng(); + } catch (ex) { + // IE throws "Unexcpected call to method or property access" some times so lets ignore it + } + }); + } else { + // On other browsers take snapshot on nodechange in inline mode since they have Ghost selections for iframes + editor.on('nodechange mouseup keyup', function(e) { + var node = getActiveElement(); + + // Only act on manual nodechanges + if (e.type == 'nodechange' && e.selectionChange) { + return; + } + + // IE 11 reports active element as iframe not body of iframe + if (node && node.id == editor.id + '_ifr') { + node = editor.getBody(); + } + + if (editor.dom.isChildOf(node, editor.getBody())) { + editor.lastRng = editor.selection.getRng(); + } + }); + } + + // Handles the issue with WebKit not retaining selection within inline document + // If the user releases the mouse out side the body since a mouse up event wont occur on the body + if (Env.webkit && !selectionChangeHandler) { + selectionChangeHandler = function() { + var activeEditor = editorManager.activeEditor; + + if (activeEditor && activeEditor.selection) { + var rng = activeEditor.selection.getRng(); + + // Store when it's non collapsed + if (rng && !rng.collapsed) { + editor.lastRng = rng; + } + } + }; + + DOM.bind(document, 'selectionchange', selectionChangeHandler); + } + } + }); + + editor.on('setcontent', function() { + editor.lastRng = null; + }); + + // Remove last selection bookmark on mousedown see #6305 + editor.on('mousedown', function() { + editor.selection.lastFocusBookmark = null; + }); + + editor.on('focusin', function() { + var focusedEditor = editorManager.focusedEditor; + + if (editor.selection.lastFocusBookmark) { + editor.selection.setRng(bookmarkToRng(editor, editor.selection.lastFocusBookmark)); + editor.selection.lastFocusBookmark = null; + } + + if (focusedEditor != editor) { + if (focusedEditor) { + focusedEditor.fire('blur', {focusedEditor: editor}); + } + + editorManager.setActive(editor); + editorManager.focusedEditor = editor; + editor.fire('focus', {blurredEditor: focusedEditor}); + editor.focus(true); + } + + editor.lastRng = null; + }); + + editor.on('focusout', function() { + window.setTimeout(function() { + var focusedEditor = editorManager.focusedEditor; + + // Still the same editor the the blur was outside any editor UI + if (!isUIElement(getActiveElement()) && focusedEditor == editor) { + editor.fire('blur', {focusedEditor: null}); + editorManager.focusedEditor = null; + + // Make sure selection is valid could be invalid if the editor is blured and removed before the timeout occurs + if (editor.selection) { + editor.selection.lastFocusBookmark = null; + } + } + }, 0); + }); + + // Check if focus is moved to an element outside the active editor by checking if the target node + // isn't within the body of the activeEditor nor a UI element such as a dialog child control + if (!documentFocusInHandler) { + documentFocusInHandler = function(e) { + var activeEditor = editorManager.activeEditor; + + if (activeEditor && e.target.ownerDocument == document) { + // Check to make sure we have a valid selection don't update the bookmark if it's + // a focusin to the body of the editor see #7025 + if (activeEditor.selection && e.target != activeEditor.getBody()) { + activeEditor.selection.lastFocusBookmark = createBookmark(activeEditor.dom, activeEditor.lastRng); + } + + // Fire a blur event if the element isn't a UI element + if (e.target != document.body && !isUIElement(e.target) && editorManager.focusedEditor == activeEditor) { + activeEditor.fire('blur', {focusedEditor: null}); + editorManager.focusedEditor = null; + } + } + }; + + DOM.bind(document, 'focusin', documentFocusInHandler); + } + + // Handle edge case when user starts the selection inside the editor and releases + // the mouse outside the editor producing a new selection. This weird workaround is needed since + // Gecko doesn't have the "selectionchange" event we need to do this. Fixes: #6843 + if (editor.inline && !documentMouseUpHandler) { + documentMouseUpHandler = function(e) { + var activeEditor = editorManager.activeEditor; + + if (activeEditor.inline && !activeEditor.dom.isChildOf(e.target, activeEditor.getBody())) { + var rng = activeEditor.selection.getRng(); + + if (!rng.collapsed) { + activeEditor.lastRng = rng; + } + } + }; + + DOM.bind(document, 'mouseup', documentMouseUpHandler); + } + } + + function unregisterDocumentEvents(e) { + if (editorManager.focusedEditor == e.editor) { + editorManager.focusedEditor = null; + } + + if (!editorManager.activeEditor) { + DOM.unbind(document, 'selectionchange', selectionChangeHandler); + DOM.unbind(document, 'focusin', documentFocusInHandler); + DOM.unbind(document, 'mouseup', documentMouseUpHandler); + selectionChangeHandler = documentFocusInHandler = documentMouseUpHandler = null; + } + } + + editorManager.on('AddEditor', registerEvents); + editorManager.on('RemoveEditor', unregisterDocumentEvents); + } + + /** + * Returns true if the specified element is part of the UI for example an button or text input. + * + * @method isEditorUIElement + * @param {Element} elm Element to check if it's part of the UI or not. + * @return {Boolean} True/false state if the element is part of the UI or not. + */ + FocusManager.isEditorUIElement = function(elm) { + // Needs to be converted to string since svg can have focus: #6776 + return elm.className.toString().indexOf('mce-') !== -1; + }; + + return FocusManager; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ForceBlocks.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ForceBlocks.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,132 @@ +/** + * ForceBlocks.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +define("tinymce/ForceBlocks", [], function() { + return function(editor) { + var settings = editor.settings, dom = editor.dom, selection = editor.selection; + var schema = editor.schema, blockElements = schema.getBlockElements(); + + function addRootBlocks() { + var node = selection.getStart(), rootNode = editor.getBody(), rng; + var startContainer, startOffset, endContainer, endOffset, rootBlockNode; + var tempNode, offset = -0xFFFFFF, wrapped, restoreSelection; + var tmpRng, rootNodeName, forcedRootBlock; + + forcedRootBlock = settings.forced_root_block; + + if (!node || node.nodeType !== 1 || !forcedRootBlock) { + return; + } + + // Check if node is wrapped in block + while (node && node != rootNode) { + if (blockElements[node.nodeName]) { + return; + } + + node = node.parentNode; + } + + // Get current selection + rng = selection.getRng(); + if (rng.setStart) { + startContainer = rng.startContainer; + startOffset = rng.startOffset; + endContainer = rng.endContainer; + endOffset = rng.endOffset; + + try { + restoreSelection = editor.getDoc().activeElement === rootNode; + } catch (ex) { + // IE throws unspecified error here sometimes + } + } else { + // Force control range into text range + if (rng.item) { + node = rng.item(0); + rng = editor.getDoc().body.createTextRange(); + rng.moveToElementText(node); + } + + restoreSelection = rng.parentElement().ownerDocument === editor.getDoc(); + tmpRng = rng.duplicate(); + tmpRng.collapse(true); + startOffset = tmpRng.move('character', offset) * -1; + + if (!tmpRng.collapsed) { + tmpRng = rng.duplicate(); + tmpRng.collapse(false); + endOffset = (tmpRng.move('character', offset) * -1) - startOffset; + } + } + + // Wrap non block elements and text nodes + node = rootNode.firstChild; + rootNodeName = rootNode.nodeName.toLowerCase(); + while (node) { + // TODO: Break this up, too complex + if (((node.nodeType === 3 || (node.nodeType == 1 && !blockElements[node.nodeName]))) && + schema.isValidChild(rootNodeName, forcedRootBlock.toLowerCase())) { + // Remove empty text nodes + if (node.nodeType === 3 && node.nodeValue.length === 0) { + tempNode = node; + node = node.nextSibling; + dom.remove(tempNode); + continue; + } + + if (!rootBlockNode) { + rootBlockNode = dom.create(forcedRootBlock, editor.settings.forced_root_block_attrs); + node.parentNode.insertBefore(rootBlockNode, node); + wrapped = true; + } + + tempNode = node; + node = node.nextSibling; + rootBlockNode.appendChild(tempNode); + } else { + rootBlockNode = null; + node = node.nextSibling; + } + } + + if (wrapped && restoreSelection) { + if (rng.setStart) { + rng.setStart(startContainer, startOffset); + rng.setEnd(endContainer, endOffset); + selection.setRng(rng); + } else { + // Only select if the previous selection was inside the document to prevent auto focus in quirks mode + try { + rng = editor.getDoc().body.createTextRange(); + rng.moveToElementText(rootNode); + rng.collapse(true); + rng.moveStart('character', startOffset); + + if (endOffset > 0) { + rng.moveEnd('character', endOffset); + } + + rng.select(); + } catch (ex) { + // Ignore + } + } + + editor.nodeChanged(); + } + } + + // Force root blocks + if (settings.forced_root_block) { + editor.on('NodeChange', addRootBlocks); + } + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/Formatter.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/Formatter.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,2330 @@ +/** + * Formatter.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Text formatter engine class. This class is used to apply formats like bold, italic, font size + * etc to the current selection or specific nodes. This engine was build to replace the browsers + * default formatting logic for execCommand due to it's inconsistent and buggy behavior. + * + * @class tinymce.Formatter + * @example + * tinymce.activeEditor.formatter.register('mycustomformat', { + * inline: 'span', + * styles: {color: '#ff0000'} + * }); + * + * tinymce.activeEditor.formatter.apply('mycustomformat'); + */ +define("tinymce/Formatter", [ + "tinymce/dom/TreeWalker", + "tinymce/dom/RangeUtils", + "tinymce/dom/BookmarkManager", + "tinymce/dom/ElementUtils", + "tinymce/util/Tools", + "tinymce/fmt/Preview" +], function(TreeWalker, RangeUtils, BookmarkManager, ElementUtils, Tools, Preview) { + /** + * Constructs a new formatter instance. + * + * @constructor Formatter + * @param {tinymce.Editor} ed Editor instance to construct the formatter engine to. + */ + return function(ed) { + var formats = {}, + dom = ed.dom, + selection = ed.selection, + rangeUtils = new RangeUtils(dom), + isValid = ed.schema.isValidChild, + isBlock = dom.isBlock, + forcedRootBlock = ed.settings.forced_root_block, + nodeIndex = dom.nodeIndex, + INVISIBLE_CHAR = '\uFEFF', + MCE_ATTR_RE = /^(src|href|style)$/, + FALSE = false, + TRUE = true, + formatChangeData, + undef, + getContentEditable = dom.getContentEditable, + disableCaretContainer, + markCaretContainersBogus, + isBookmarkNode = BookmarkManager.isBookmarkNode; + + var each = Tools.each, + grep = Tools.grep, + walk = Tools.walk, + extend = Tools.extend; + + function isTextBlock(name) { + if (name.nodeType) { + name = name.nodeName; + } + + return !!ed.schema.getTextBlockElements()[name.toLowerCase()]; + } + + function isTableCell(node) { + return /^(TH|TD)$/.test(node.nodeName); + } + + function getParents(node, selector) { + return dom.getParents(node, selector, dom.getRoot()); + } + + function isCaretNode(node) { + return node.nodeType === 1 && node.id === '_mce_caret'; + } + + function defaultFormats() { + register({ + valigntop: [ + {selector: 'td,th', styles: {'verticalAlign': 'top'}} + ], + + valignmiddle: [ + {selector: 'td,th', styles: {'verticalAlign': 'middle'}} + ], + + valignbottom: [ + {selector: 'td,th', styles: {'verticalAlign': 'bottom'}} + ], + + alignleft: [ + {selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'left'}, defaultBlock: 'div'}, + {selector: 'img,table', collapsed: false, styles: {'float': 'left'}} + ], + + aligncenter: [ + {selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'center'}, defaultBlock: 'div'}, + {selector: 'img', collapsed: false, styles: {display: 'block', marginLeft: 'auto', marginRight: 'auto'}}, + {selector: 'table', collapsed: false, styles: {marginLeft: 'auto', marginRight: 'auto'}} + ], + + alignright: [ + {selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'right'}, defaultBlock: 'div'}, + {selector: 'img,table', collapsed: false, styles: {'float': 'right'}} + ], + + alignjustify: [ + {selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'justify'}, defaultBlock: 'div'} + ], + + bold: [ + {inline: 'strong', remove: 'all'}, + {inline: 'span', styles: {fontWeight: 'bold'}}, + {inline: 'b', remove: 'all'} + ], + + italic: [ + {inline: 'em', remove: 'all'}, + {inline: 'span', styles: {fontStyle: 'italic'}}, + {inline: 'i', remove: 'all'} + ], + + underline: [ + {inline: 'span', styles: {textDecoration: 'underline'}, exact: true}, + {inline: 'u', remove: 'all'} + ], + + strikethrough: [ + {inline: 'span', styles: {textDecoration: 'line-through'}, exact: true}, + {inline: 'strike', remove: 'all'} + ], + + forecolor: {inline: 'span', styles: {color: '%value'}, links: true, remove_similar: true}, + hilitecolor: {inline: 'span', styles: {backgroundColor: '%value'}, links: true, remove_similar: true}, + fontname: {inline: 'span', styles: {fontFamily: '%value'}}, + fontsize: {inline: 'span', styles: {fontSize: '%value'}}, + fontsize_class: {inline: 'span', attributes: {'class': '%value'}}, + blockquote: {block: 'blockquote', wrapper: 1, remove: 'all'}, + subscript: {inline: 'sub'}, + superscript: {inline: 'sup'}, + code: {inline: 'code'}, + + link: {inline: 'a', selector: 'a', remove: 'all', split: true, deep: true, + onmatch: function() { + return true; + }, + + onformat: function(elm, fmt, vars) { + each(vars, function(value, key) { + dom.setAttrib(elm, key, value); + }); + } + }, + + removeformat: [ + { + selector: 'b,strong,em,i,font,u,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins', + remove: 'all', + split: true, + expand: false, + block_expand: true, + deep: true + }, + {selector: 'span', attributes: ['style', 'class'], remove: 'empty', split: true, expand: false, deep: true}, + {selector: '*', attributes: ['style', 'class'], split: false, expand: false, deep: true} + ] + }); + + // Register default block formats + each('p h1 h2 h3 h4 h5 h6 div address pre div dt dd samp'.split(/\s/), function(name) { + register(name, {block: name, remove: 'all'}); + }); + + // Register user defined formats + register(ed.settings.formats); + } + + function addKeyboardShortcuts() { + // Add some inline shortcuts + ed.addShortcut('meta+b', 'bold_desc', 'Bold'); + ed.addShortcut('meta+i', 'italic_desc', 'Italic'); + ed.addShortcut('meta+u', 'underline_desc', 'Underline'); + + // BlockFormat shortcuts keys + for (var i = 1; i <= 6; i++) { + ed.addShortcut('access+' + i, '', ['FormatBlock', false, 'h' + i]); + } + + ed.addShortcut('access+7', '', ['FormatBlock', false, 'p']); + ed.addShortcut('access+8', '', ['FormatBlock', false, 'div']); + ed.addShortcut('access+9', '', ['FormatBlock', false, 'address']); + } + + // Public functions + + /** + * Returns the format by name or all formats if no name is specified. + * + * @method get + * @param {String} name Optional name to retrive by. + * @return {Array/Object} Array/Object with all registred formats or a specific format. + */ + function get(name) { + return name ? formats[name] : formats; + } + + /** + * Registers a specific format by name. + * + * @method register + * @param {Object/String} name Name of the format for example "bold". + * @param {Object/Array} format Optional format object or array of format variants + * can only be omitted if the first arg is an object. + */ + function register(name, format) { + if (name) { + if (typeof name !== 'string') { + each(name, function(format, name) { + register(name, format); + }); + } else { + // Force format into array and add it to internal collection + format = format.length ? format : [format]; + + each(format, function(format) { + // Set deep to false by default on selector formats this to avoid removing + // alignment on images inside paragraphs when alignment is changed on paragraphs + if (format.deep === undef) { + format.deep = !format.selector; + } + + // Default to true + if (format.split === undef) { + format.split = !format.selector || format.inline; + } + + // Default to true + if (format.remove === undef && format.selector && !format.inline) { + format.remove = 'none'; + } + + // Mark format as a mixed format inline + block level + if (format.selector && format.inline) { + format.mixed = true; + format.block_expand = true; + } + + // Split classes if needed + if (typeof format.classes === 'string') { + format.classes = format.classes.split(/\s+/); + } + }); + + formats[name] = format; + } + } + } + + /** + * Unregister a specific format by name. + * + * @method unregister + * @param {String} name Name of the format for example "bold". + */ + function unregister(name) { + if (name && formats[name]) { + delete formats[name]; + } + + return formats; + } + + function getTextDecoration(node) { + var decoration; + + ed.dom.getParent(node, function(n) { + decoration = ed.dom.getStyle(n, 'text-decoration'); + return decoration && decoration !== 'none'; + }); + + return decoration; + } + + function processUnderlineAndColor(node) { + var textDecoration; + if (node.nodeType === 1 && node.parentNode && node.parentNode.nodeType === 1) { + textDecoration = getTextDecoration(node.parentNode); + if (ed.dom.getStyle(node, 'color') && textDecoration) { + ed.dom.setStyle(node, 'text-decoration', textDecoration); + } else if (ed.dom.getStyle(node, 'text-decoration') === textDecoration) { + ed.dom.setStyle(node, 'text-decoration', null); + } + } + } + + /** + * Applies the specified format to the current selection or specified node. + * + * @method apply + * @param {String} name Name of format to apply. + * @param {Object} vars Optional list of variables to replace within format before applying it. + * @param {Node} node Optional node to apply the format to defaults to current selection. + */ + function apply(name, vars, node) { + var formatList = get(name), format = formatList[0], bookmark, rng, isCollapsed = !node && selection.isCollapsed(); + + function setElementFormat(elm, fmt) { + fmt = fmt || format; + + if (elm) { + if (fmt.onformat) { + fmt.onformat(elm, fmt, vars, node); + } + + each(fmt.styles, function(value, name) { + dom.setStyle(elm, name, replaceVars(value, vars)); + }); + + // Needed for the WebKit span spam bug + // TODO: Remove this once WebKit/Blink fixes this + if (fmt.styles) { + var styleVal = dom.getAttrib(elm, 'style'); + + if (styleVal) { + elm.setAttribute('data-mce-style', styleVal); + } + } + + each(fmt.attributes, function(value, name) { + dom.setAttrib(elm, name, replaceVars(value, vars)); + }); + + each(fmt.classes, function(value) { + value = replaceVars(value, vars); + + if (!dom.hasClass(elm, value)) { + dom.addClass(elm, value); + } + }); + } + } + + function adjustSelectionToVisibleSelection() { + function findSelectionEnd(start, end) { + var walker = new TreeWalker(end); + for (node = walker.current(); node; node = walker.prev()) { + if (node.childNodes.length > 1 || node == start || node.tagName == 'BR') { + return node; + } + } + } + + // Adjust selection so that a end container with a end offset of zero is not included in the selection + // as this isn't visible to the user. + var rng = ed.selection.getRng(); + var start = rng.startContainer; + var end = rng.endContainer; + + if (start != end && rng.endOffset === 0) { + var newEnd = findSelectionEnd(start, end); + var endOffset = newEnd.nodeType == 3 ? newEnd.length : newEnd.childNodes.length; + + rng.setEnd(newEnd, endOffset); + } + + return rng; + } + + function applyRngStyle(rng, bookmark, node_specific) { + var newWrappers = [], wrapName, wrapElm, contentEditable = true; + + // Setup wrapper element + wrapName = format.inline || format.block; + wrapElm = dom.create(wrapName); + setElementFormat(wrapElm); + + rangeUtils.walk(rng, function(nodes) { + var currentWrapElm; + + /** + * Process a list of nodes wrap them. + */ + function process(node) { + var nodeName, parentName, found, hasContentEditableState, lastContentEditable; + + lastContentEditable = contentEditable; + nodeName = node.nodeName.toLowerCase(); + parentName = node.parentNode.nodeName.toLowerCase(); + + // Node has a contentEditable value + if (node.nodeType === 1 && getContentEditable(node)) { + lastContentEditable = contentEditable; + contentEditable = getContentEditable(node) === "true"; + hasContentEditableState = true; // We don't want to wrap the container only it's children + } + + // Stop wrapping on br elements + if (isEq(nodeName, 'br')) { + currentWrapElm = 0; + + // Remove any br elements when we wrap things + if (format.block) { + dom.remove(node); + } + + return; + } + + // If node is wrapper type + if (format.wrapper && matchNode(node, name, vars)) { + currentWrapElm = 0; + return; + } + + // Can we rename the block + // TODO: Break this if up, too complex + if (contentEditable && !hasContentEditableState && format.block && + !format.wrapper && isTextBlock(nodeName) && isValid(parentName, wrapName)) { + node = dom.rename(node, wrapName); + setElementFormat(node); + newWrappers.push(node); + currentWrapElm = 0; + return; + } + + // Handle selector patterns + if (format.selector) { + // Look for matching formats + each(formatList, function(format) { + // Check collapsed state if it exists + if ('collapsed' in format && format.collapsed !== isCollapsed) { + return; + } + + if (dom.is(node, format.selector) && !isCaretNode(node)) { + setElementFormat(node, format); + found = true; + } + }); + + // Continue processing if a selector match wasn't found and a inline element is defined + if (!format.inline || found) { + currentWrapElm = 0; + return; + } + } + + // Is it valid to wrap this item + // TODO: Break this if up, too complex + if (contentEditable && !hasContentEditableState && isValid(wrapName, nodeName) && isValid(parentName, wrapName) && + !(!node_specific && node.nodeType === 3 && + node.nodeValue.length === 1 && + node.nodeValue.charCodeAt(0) === 65279) && + !isCaretNode(node) && + (!format.inline || !isBlock(node))) { + // Start wrapping + if (!currentWrapElm) { + // Wrap the node + currentWrapElm = dom.clone(wrapElm, FALSE); + node.parentNode.insertBefore(currentWrapElm, node); + newWrappers.push(currentWrapElm); + } + + currentWrapElm.appendChild(node); + } else { + // Start a new wrapper for possible children + currentWrapElm = 0; + + each(grep(node.childNodes), process); + + if (hasContentEditableState) { + contentEditable = lastContentEditable; // Restore last contentEditable state from stack + } + + // End the last wrapper + currentWrapElm = 0; + } + } + + // Process siblings from range + each(nodes, process); + }); + + // Apply formats to links as well to get the color of the underline to change as well + if (format.links === true) { + each(newWrappers, function(node) { + function process(node) { + if (node.nodeName === 'A') { + setElementFormat(node, format); + } + + each(grep(node.childNodes), process); + } + + process(node); + }); + } + + // Cleanup + each(newWrappers, function(node) { + var childCount; + + function getChildCount(node) { + var count = 0; + + each(node.childNodes, function(node) { + if (!isWhiteSpaceNode(node) && !isBookmarkNode(node)) { + count++; + } + }); + + return count; + } + + function mergeStyles(node) { + var child, clone; + + each(node.childNodes, function(node) { + if (node.nodeType == 1 && !isBookmarkNode(node) && !isCaretNode(node)) { + child = node; + return FALSE; // break loop + } + }); + + // If child was found and of the same type as the current node + if (child && !isBookmarkNode(child) && matchName(child, format)) { + clone = dom.clone(child, FALSE); + setElementFormat(clone); + + dom.replace(clone, node, TRUE); + dom.remove(child, 1); + } + + return clone || node; + } + + childCount = getChildCount(node); + + // Remove empty nodes but only if there is multiple wrappers and they are not block + // elements so never remove single

since that would remove the + // currrent empty block element where the caret is at + if ((newWrappers.length > 1 || !isBlock(node)) && childCount === 0) { + dom.remove(node, 1); + return; + } + + if (format.inline || format.wrapper) { + // Merges the current node with it's children of similar type to reduce the number of elements + if (!format.exact && childCount === 1) { + node = mergeStyles(node); + } + + // Remove/merge children + each(formatList, function(format) { + // Merge all children of similar type will move styles from child to parent + // this: text + // will become: text + each(dom.select(format.inline, node), function(child) { + if (isBookmarkNode(child)) { + return; + } + + removeFormat(format, vars, child, format.exact ? child : null); + }); + }); + + // Remove child if direct parent is of same type + if (matchNode(node.parentNode, name, vars)) { + dom.remove(node, 1); + node = 0; + return TRUE; + } + + // Look for parent with similar style format + if (format.merge_with_parents) { + dom.getParent(node.parentNode, function(parent) { + if (matchNode(parent, name, vars)) { + dom.remove(node, 1); + node = 0; + return TRUE; + } + }); + } + + // Merge next and previous siblings if they are similar texttext becomes texttext + if (node && format.merge_siblings !== false) { + node = mergeSiblings(getNonWhiteSpaceSibling(node), node); + node = mergeSiblings(node, getNonWhiteSpaceSibling(node, TRUE)); + } + } + }); + } + + if (format) { + if (node) { + if (node.nodeType) { + rng = dom.createRng(); + rng.setStartBefore(node); + rng.setEndAfter(node); + applyRngStyle(expandRng(rng, formatList), null, true); + } else { + applyRngStyle(node, null, true); + } + } else { + if (!isCollapsed || !format.inline || dom.select('td.mce-item-selected,th.mce-item-selected').length) { + // Obtain selection node before selection is unselected by applyRngStyle() + var curSelNode = ed.selection.getNode(); + + // If the formats have a default block and we can't find a parent block then + // start wrapping it with a DIV this is for forced_root_blocks: false + // It's kind of a hack but people should be using the default block type P since all desktop editors work that way + if (!forcedRootBlock && formatList[0].defaultBlock && !dom.getParent(curSelNode, dom.isBlock)) { + apply(formatList[0].defaultBlock); + } + + // Apply formatting to selection + ed.selection.setRng(adjustSelectionToVisibleSelection()); + bookmark = selection.getBookmark(); + applyRngStyle(expandRng(selection.getRng(TRUE), formatList), bookmark); + + // Colored nodes should be underlined so that the color of the underline matches the text color. + if (format.styles && (format.styles.color || format.styles.textDecoration)) { + walk(curSelNode, processUnderlineAndColor, 'childNodes'); + processUnderlineAndColor(curSelNode); + } + + selection.moveToBookmark(bookmark); + moveStart(selection.getRng(TRUE)); + ed.nodeChanged(); + } else { + performCaretAction('apply', name, vars); + } + } + } + } + + /** + * Removes the specified format from the current selection or specified node. + * + * @method remove + * @param {String} name Name of format to remove. + * @param {Object} vars Optional list of variables to replace within format before removing it. + * @param {Node/Range} node Optional node or DOM range to remove the format from defaults to current selection. + */ + function remove(name, vars, node, similar) { + var formatList = get(name), format = formatList[0], bookmark, rng, contentEditable = true; + + // Merges the styles for each node + function process(node) { + var children, i, l, lastContentEditable, hasContentEditableState; + + // Node has a contentEditable value + if (node.nodeType === 1 && getContentEditable(node)) { + lastContentEditable = contentEditable; + contentEditable = getContentEditable(node) === "true"; + hasContentEditableState = true; // We don't want to wrap the container only it's children + } + + // Grab the children first since the nodelist might be changed + children = grep(node.childNodes); + + // Process current node + if (contentEditable && !hasContentEditableState) { + for (i = 0, l = formatList.length; i < l; i++) { + if (removeFormat(formatList[i], vars, node, node)) { + break; + } + } + } + + // Process the children + if (format.deep) { + if (children.length) { + for (i = 0, l = children.length; i < l; i++) { + process(children[i]); + } + + if (hasContentEditableState) { + contentEditable = lastContentEditable; // Restore last contentEditable state from stack + } + } + } + } + + function findFormatRoot(container) { + var formatRoot; + + // Find format root + each(getParents(container.parentNode).reverse(), function(parent) { + var format; + + // Find format root element + if (!formatRoot && parent.id != '_start' && parent.id != '_end') { + // Is the node matching the format we are looking for + format = matchNode(parent, name, vars, similar); + if (format && format.split !== false) { + formatRoot = parent; + } + } + }); + + return formatRoot; + } + + function wrapAndSplit(formatRoot, container, target, split) { + var parent, clone, lastClone, firstClone, i, formatRootParent; + + // Format root found then clone formats and split it + if (formatRoot) { + formatRootParent = formatRoot.parentNode; + + for (parent = container.parentNode; parent && parent != formatRootParent; parent = parent.parentNode) { + clone = dom.clone(parent, FALSE); + + for (i = 0; i < formatList.length; i++) { + if (removeFormat(formatList[i], vars, clone, clone)) { + clone = 0; + break; + } + } + + // Build wrapper node + if (clone) { + if (lastClone) { + clone.appendChild(lastClone); + } + + if (!firstClone) { + firstClone = clone; + } + + lastClone = clone; + } + } + + // Never split block elements if the format is mixed + if (split && (!format.mixed || !isBlock(formatRoot))) { + container = dom.split(formatRoot, container); + } + + // Wrap container in cloned formats + if (lastClone) { + target.parentNode.insertBefore(lastClone, target); + firstClone.appendChild(target); + } + } + + return container; + } + + function splitToFormatRoot(container) { + return wrapAndSplit(findFormatRoot(container), container, container, true); + } + + function unwrap(start) { + var node = dom.get(start ? '_start' : '_end'), + out = node[start ? 'firstChild' : 'lastChild']; + + // If the end is placed within the start the result will be removed + // So this checks if the out node is a bookmark node if it is it + // checks for another more suitable node + if (isBookmarkNode(out)) { + out = out[start ? 'firstChild' : 'lastChild']; + } + + // Since dom.remove removes empty text nodes then we need to try to find a better node + if (out.nodeType == 3 && out.data.length === 0) { + out = start ? node.previousSibling || node.nextSibling : node.nextSibling || node.previousSibling; + } + + dom.remove(node, true); + + return out; + } + + function removeRngStyle(rng) { + var startContainer, endContainer; + var commonAncestorContainer = rng.commonAncestorContainer; + + rng = expandRng(rng, formatList, TRUE); + + if (format.split) { + startContainer = getContainer(rng, TRUE); + endContainer = getContainer(rng); + + if (startContainer != endContainer) { + // WebKit will render the table incorrectly if we wrap a TH or TD in a SPAN + // so let's see if we can use the first child instead + // This will happen if you triple click a table cell and use remove formatting + if (/^(TR|TH|TD)$/.test(startContainer.nodeName) && startContainer.firstChild) { + if (startContainer.nodeName == "TR") { + startContainer = startContainer.firstChild.firstChild || startContainer; + } else { + startContainer = startContainer.firstChild || startContainer; + } + } + + // Try to adjust endContainer as well if cells on the same row were selected - bug #6410 + if (commonAncestorContainer && + /^T(HEAD|BODY|FOOT|R)$/.test(commonAncestorContainer.nodeName) && + isTableCell(endContainer) && endContainer.firstChild) { + endContainer = endContainer.firstChild || endContainer; + } + + if (dom.isChildOf(startContainer, endContainer) && !isTableCell(startContainer) && !isTableCell(endContainer)) { + startContainer = wrap(startContainer, 'span', {id: '_start', 'data-mce-type': 'bookmark'}); + splitToFormatRoot(startContainer); + startContainer = unwrap(TRUE); + return; + } else { + // Wrap start/end nodes in span element since these might be cloned/moved + startContainer = wrap(startContainer, 'span', {id: '_start', 'data-mce-type': 'bookmark'}); + endContainer = wrap(endContainer, 'span', {id: '_end', 'data-mce-type': 'bookmark'}); + + // Split start/end + splitToFormatRoot(startContainer); + splitToFormatRoot(endContainer); + + // Unwrap start/end to get real elements again + startContainer = unwrap(TRUE); + endContainer = unwrap(); + } + } else { + startContainer = endContainer = splitToFormatRoot(startContainer); + } + + // Update range positions since they might have changed after the split operations + rng.startContainer = startContainer.parentNode ? startContainer.parentNode : startContainer; + rng.startOffset = nodeIndex(startContainer); + rng.endContainer = endContainer.parentNode ? endContainer.parentNode : endContainer; + rng.endOffset = nodeIndex(endContainer) + 1; + } + + // Remove items between start/end + rangeUtils.walk(rng, function(nodes) { + each(nodes, function(node) { + process(node); + + // Remove parent span if it only contains text-decoration: underline, yet a parent node is also underlined. + if (node.nodeType === 1 && ed.dom.getStyle(node, 'text-decoration') === 'underline' && + node.parentNode && getTextDecoration(node.parentNode) === 'underline') { + removeFormat({ + 'deep': false, + 'exact': true, + 'inline': 'span', + 'styles': { + 'textDecoration': 'underline' + } + }, null, node); + } + }); + }); + } + + // Handle node + if (node) { + if (node.nodeType) { + rng = dom.createRng(); + rng.setStartBefore(node); + rng.setEndAfter(node); + removeRngStyle(rng); + } else { + removeRngStyle(node); + } + + return; + } + + if (!selection.isCollapsed() || !format.inline || dom.select('td.mce-item-selected,th.mce-item-selected').length) { + bookmark = selection.getBookmark(); + removeRngStyle(selection.getRng(TRUE)); + selection.moveToBookmark(bookmark); + + // Check if start element still has formatting then we are at: "text|text" + // and need to move the start into the next text node + if (format.inline && match(name, vars, selection.getStart())) { + moveStart(selection.getRng(true)); + } + + ed.nodeChanged(); + } else { + performCaretAction('remove', name, vars, similar); + } + } + + /** + * Toggles the specified format on/off. + * + * @method toggle + * @param {String} name Name of format to apply/remove. + * @param {Object} vars Optional list of variables to replace within format before applying/removing it. + * @param {Node} node Optional node to apply the format to or remove from. Defaults to current selection. + */ + function toggle(name, vars, node) { + var fmt = get(name); + + if (match(name, vars, node) && (!('toggle' in fmt[0]) || fmt[0].toggle)) { + remove(name, vars, node); + } else { + apply(name, vars, node); + } + } + + /** + * Return true/false if the specified node has the specified format. + * + * @method matchNode + * @param {Node} node Node to check the format on. + * @param {String} name Format name to check. + * @param {Object} vars Optional list of variables to replace before checking it. + * @param {Boolean} similar Match format that has similar properties. + * @return {Object} Returns the format object it matches or undefined if it doesn't match. + */ + function matchNode(node, name, vars, similar) { + var formatList = get(name), format, i, classes; + + function matchItems(node, format, item_name) { + var key, value, items = format[item_name], i; + + // Custom match + if (format.onmatch) { + return format.onmatch(node, format, item_name); + } + + // Check all items + if (items) { + // Non indexed object + if (items.length === undef) { + for (key in items) { + if (items.hasOwnProperty(key)) { + if (item_name === 'attributes') { + value = dom.getAttrib(node, key); + } else { + value = getStyle(node, key); + } + + if (similar && !value && !format.exact) { + return; + } + + if ((!similar || format.exact) && !isEq(value, normalizeStyleValue(replaceVars(items[key], vars), key))) { + return; + } + } + } + } else { + // Only one match needed for indexed arrays + for (i = 0; i < items.length; i++) { + if (item_name === 'attributes' ? dom.getAttrib(node, items[i]) : getStyle(node, items[i])) { + return format; + } + } + } + } + + return format; + } + + if (formatList && node) { + // Check each format in list + for (i = 0; i < formatList.length; i++) { + format = formatList[i]; + + // Name name, attributes, styles and classes + if (matchName(node, format) && matchItems(node, format, 'attributes') && matchItems(node, format, 'styles')) { + // Match classes + if ((classes = format.classes)) { + for (i = 0; i < classes.length; i++) { + if (!dom.hasClass(node, classes[i])) { + return; + } + } + } + + return format; + } + } + } + } + + /** + * Matches the current selection or specified node against the specified format name. + * + * @method match + * @param {String} name Name of format to match. + * @param {Object} vars Optional list of variables to replace before checking it. + * @param {Node} node Optional node to check. + * @return {boolean} true/false if the specified selection/node matches the format. + */ + function match(name, vars, node) { + var startNode; + + function matchParents(node) { + var root = dom.getRoot(); + + if (node === root) { + return false; + } + + // Find first node with similar format settings + node = dom.getParent(node, function(node) { + return node.parentNode === root || !!matchNode(node, name, vars, true); + }); + + // Do an exact check on the similar format element + return matchNode(node, name, vars); + } + + // Check specified node + if (node) { + return matchParents(node); + } + + // Check selected node + node = selection.getNode(); + if (matchParents(node)) { + return TRUE; + } + + // Check start node if it's different + startNode = selection.getStart(); + if (startNode != node) { + if (matchParents(startNode)) { + return TRUE; + } + } + + return FALSE; + } + + /** + * Matches the current selection against the array of formats and returns a new array with matching formats. + * + * @method matchAll + * @param {Array} names Name of format to match. + * @param {Object} vars Optional list of variables to replace before checking it. + * @return {Array} Array with matched formats. + */ + function matchAll(names, vars) { + var startElement, matchedFormatNames = [], checkedMap = {}; + + // Check start of selection for formats + startElement = selection.getStart(); + dom.getParent(startElement, function(node) { + var i, name; + + for (i = 0; i < names.length; i++) { + name = names[i]; + + if (!checkedMap[name] && matchNode(node, name, vars)) { + checkedMap[name] = true; + matchedFormatNames.push(name); + } + } + }, dom.getRoot()); + + return matchedFormatNames; + } + + /** + * Returns true/false if the specified format can be applied to the current selection or not. It + * will currently only check the state for selector formats, it returns true on all other format types. + * + * @method canApply + * @param {String} name Name of format to check. + * @return {boolean} true/false if the specified format can be applied to the current selection/node. + */ + function canApply(name) { + var formatList = get(name), startNode, parents, i, x, selector; + + if (formatList) { + startNode = selection.getStart(); + parents = getParents(startNode); + + for (x = formatList.length - 1; x >= 0; x--) { + selector = formatList[x].selector; + + // Format is not selector based then always return TRUE + // Is it has a defaultBlock then it's likely it can be applied for example align on a non block element line + if (!selector || formatList[x].defaultBlock) { + return TRUE; + } + + for (i = parents.length - 1; i >= 0; i--) { + if (dom.is(parents[i], selector)) { + return TRUE; + } + } + } + } + + return FALSE; + } + + /** + * Executes the specified callback when the current selection matches the formats or not. + * + * @method formatChanged + * @param {String} formats Comma separated list of formats to check for. + * @param {function} callback Callback with state and args when the format is changed/toggled on/off. + * @param {Boolean} similar True/false state if the match should handle similar or exact formats. + */ + function formatChanged(formats, callback, similar) { + var currentFormats; + + // Setup format node change logic + if (!formatChangeData) { + formatChangeData = {}; + currentFormats = {}; + + ed.on('NodeChange', function(e) { + var parents = getParents(e.element), matchedFormats = {}; + + // Ignore bogus nodes like the tag created by moveStart() + parents = Tools.grep(parents, function(node) { + return node.nodeType == 1 && !node.getAttribute('data-mce-bogus'); + }); + + // Check for new formats + each(formatChangeData, function(callbacks, format) { + each(parents, function(node) { + if (matchNode(node, format, {}, callbacks.similar)) { + if (!currentFormats[format]) { + // Execute callbacks + each(callbacks, function(callback) { + callback(true, {node: node, format: format, parents: parents}); + }); + + currentFormats[format] = callbacks; + } + + matchedFormats[format] = callbacks; + return false; + } + }); + }); + + // Check if current formats still match + each(currentFormats, function(callbacks, format) { + if (!matchedFormats[format]) { + delete currentFormats[format]; + + each(callbacks, function(callback) { + callback(false, {node: e.element, format: format, parents: parents}); + }); + } + }); + }); + } + + // Add format listeners + each(formats.split(','), function(format) { + if (!formatChangeData[format]) { + formatChangeData[format] = []; + formatChangeData[format].similar = similar; + } + + formatChangeData[format].push(callback); + }); + + return this; + } + + /** + * Returns a preview css text for the specified format. + * + * @method getCssText + * @param {String/Object} format Format to generate preview css text for. + * @return {String} Css text for the specified format. + * @example + * var cssText1 = editor.formatter.getCssText('bold'); + * var cssText2 = editor.formatter.getCssText({inline: 'b'}); + */ + function getCssText(format) { + return Preview.getCssText(ed, format); + } + + // Expose to public + extend(this, { + get: get, + register: register, + unregister: unregister, + apply: apply, + remove: remove, + toggle: toggle, + match: match, + matchAll: matchAll, + matchNode: matchNode, + canApply: canApply, + formatChanged: formatChanged, + getCssText: getCssText + }); + + // Initialize + defaultFormats(); + addKeyboardShortcuts(); + ed.on('BeforeGetContent', function(e) { + if (markCaretContainersBogus && e.format != 'raw') { + markCaretContainersBogus(); + } + }); + ed.on('mouseup keydown', function(e) { + if (disableCaretContainer) { + disableCaretContainer(e); + } + }); + + // Private functions + + /** + * Checks if the specified nodes name matches the format inline/block or selector. + * + * @private + * @param {Node} node Node to match against the specified format. + * @param {Object} format Format object o match with. + * @return {boolean} true/false if the format matches. + */ + function matchName(node, format) { + // Check for inline match + if (isEq(node, format.inline)) { + return TRUE; + } + + // Check for block match + if (isEq(node, format.block)) { + return TRUE; + } + + // Check for selector match + if (format.selector) { + return node.nodeType == 1 && dom.is(node, format.selector); + } + } + + /** + * Compares two string/nodes regardless of their case. + * + * @private + * @param {String/Node} Node or string to compare. + * @param {String/Node} Node or string to compare. + * @return {boolean} True/false if they match. + */ + function isEq(str1, str2) { + str1 = str1 || ''; + str2 = str2 || ''; + + str1 = '' + (str1.nodeName || str1); + str2 = '' + (str2.nodeName || str2); + + return str1.toLowerCase() == str2.toLowerCase(); + } + + /** + * Returns the style by name on the specified node. This method modifies the style + * contents to make it more easy to match. This will resolve a few browser issues. + * + * @private + * @param {Node} node to get style from. + * @param {String} name Style name to get. + * @return {String} Style item value. + */ + function getStyle(node, name) { + return normalizeStyleValue(dom.getStyle(node, name), name); + } + + /** + * Normalize style value by name. This method modifies the style contents + * to make it more easy to match. This will resolve a few browser issues. + * + * @private + * @param {Node} node to get style from. + * @param {String} name Style name to get. + * @return {String} Style item value. + */ + function normalizeStyleValue(value, name) { + // Force the format to hex + if (name == 'color' || name == 'backgroundColor') { + value = dom.toHex(value); + } + + // Opera will return bold as 700 + if (name == 'fontWeight' && value == 700) { + value = 'bold'; + } + + // Normalize fontFamily so "'Font name', Font" becomes: "Font name,Font" + if (name == 'fontFamily') { + value = value.replace(/[\'\"]/g, '').replace(/,\s+/g, ','); + } + + return '' + value; + } + + /** + * Replaces variables in the value. The variable format is %var. + * + * @private + * @param {String} value Value to replace variables in. + * @param {Object} vars Name/value array with variables to replace. + * @return {String} New value with replaced variables. + */ + function replaceVars(value, vars) { + if (typeof value != "string") { + value = value(vars); + } else if (vars) { + value = value.replace(/%(\w+)/g, function(str, name) { + return vars[name] || str; + }); + } + + return value; + } + + function isWhiteSpaceNode(node) { + return node && node.nodeType === 3 && /^([\t \r\n]+|)$/.test(node.nodeValue); + } + + function wrap(node, name, attrs) { + var wrapper = dom.create(name, attrs); + + node.parentNode.insertBefore(wrapper, node); + wrapper.appendChild(node); + + return wrapper; + } + + /** + * Expands the specified range like object to depending on format. + * + * For example on block formats it will move the start/end position + * to the beginning of the current block. + * + * @private + * @param {Object} rng Range like object. + * @param {Array} formats Array with formats to expand by. + * @return {Object} Expanded range like object. + */ + function expandRng(rng, format, remove) { + var lastIdx, leaf, endPoint, + startContainer = rng.startContainer, + startOffset = rng.startOffset, + endContainer = rng.endContainer, + endOffset = rng.endOffset; + + // This function walks up the tree if there is no siblings before/after the node + function findParentContainer(start) { + var container, parent, sibling, siblingName, root; + + container = parent = start ? startContainer : endContainer; + siblingName = start ? 'previousSibling' : 'nextSibling'; + root = dom.getRoot(); + + function isBogusBr(node) { + return node.nodeName == "BR" && node.getAttribute('data-mce-bogus') && !node.nextSibling; + } + + // If it's a text node and the offset is inside the text + if (container.nodeType == 3 && !isWhiteSpaceNode(container)) { + if (start ? startOffset > 0 : endOffset < container.nodeValue.length) { + return container; + } + } + + /*eslint no-constant-condition:0 */ + while (true) { + // Stop expanding on block elements + if (!format[0].block_expand && isBlock(parent)) { + return parent; + } + + // Walk left/right + for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) { + if (!isBookmarkNode(sibling) && !isWhiteSpaceNode(sibling) && !isBogusBr(sibling)) { + return parent; + } + } + + // Check if we can move up are we at root level or body level + if (parent.parentNode == root) { + container = parent; + break; + } + + parent = parent.parentNode; + } + + return container; + } + + // This function walks down the tree to find the leaf at the selection. + // The offset is also returned as if node initially a leaf, the offset may be in the middle of the text node. + function findLeaf(node, offset) { + if (offset === undef) { + offset = node.nodeType === 3 ? node.length : node.childNodes.length; + } + + while (node && node.hasChildNodes()) { + node = node.childNodes[offset]; + if (node) { + offset = node.nodeType === 3 ? node.length : node.childNodes.length; + } + } + return {node: node, offset: offset}; + } + + // If index based start position then resolve it + if (startContainer.nodeType == 1 && startContainer.hasChildNodes()) { + lastIdx = startContainer.childNodes.length - 1; + startContainer = startContainer.childNodes[startOffset > lastIdx ? lastIdx : startOffset]; + + if (startContainer.nodeType == 3) { + startOffset = 0; + } + } + + // If index based end position then resolve it + if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) { + lastIdx = endContainer.childNodes.length - 1; + endContainer = endContainer.childNodes[endOffset > lastIdx ? lastIdx : endOffset - 1]; + + if (endContainer.nodeType == 3) { + endOffset = endContainer.nodeValue.length; + } + } + + // Expands the node to the closes contentEditable false element if it exists + function findParentContentEditable(node) { + var parent = node; + + while (parent) { + if (parent.nodeType === 1 && getContentEditable(parent)) { + return getContentEditable(parent) === "false" ? parent : node; + } + + parent = parent.parentNode; + } + + return node; + } + + function findWordEndPoint(container, offset, start) { + var walker, node, pos, lastTextNode; + + function findSpace(node, offset) { + var pos, pos2, str = node.nodeValue; + + if (typeof offset == "undefined") { + offset = start ? str.length : 0; + } + + if (start) { + pos = str.lastIndexOf(' ', offset); + pos2 = str.lastIndexOf('\u00a0', offset); + pos = pos > pos2 ? pos : pos2; + + // Include the space on remove to avoid tag soup + if (pos !== -1 && !remove) { + pos++; + } + } else { + pos = str.indexOf(' ', offset); + pos2 = str.indexOf('\u00a0', offset); + pos = pos !== -1 && (pos2 === -1 || pos < pos2) ? pos : pos2; + } + + return pos; + } + + if (container.nodeType === 3) { + pos = findSpace(container, offset); + + if (pos !== -1) { + return {container: container, offset: pos}; + } + + lastTextNode = container; + } + + // Walk the nodes inside the block + walker = new TreeWalker(container, dom.getParent(container, isBlock) || ed.getBody()); + while ((node = walker[start ? 'prev' : 'next']())) { + if (node.nodeType === 3) { + lastTextNode = node; + pos = findSpace(node); + + if (pos !== -1) { + return {container: node, offset: pos}; + } + } else if (isBlock(node)) { + break; + } + } + + if (lastTextNode) { + if (start) { + offset = 0; + } else { + offset = lastTextNode.length; + } + + return {container: lastTextNode, offset: offset}; + } + } + + function findSelectorEndPoint(container, sibling_name) { + var parents, i, y, curFormat; + + if (container.nodeType == 3 && container.nodeValue.length === 0 && container[sibling_name]) { + container = container[sibling_name]; + } + + parents = getParents(container); + for (i = 0; i < parents.length; i++) { + for (y = 0; y < format.length; y++) { + curFormat = format[y]; + + // If collapsed state is set then skip formats that doesn't match that + if ("collapsed" in curFormat && curFormat.collapsed !== rng.collapsed) { + continue; + } + + if (dom.is(parents[i], curFormat.selector)) { + return parents[i]; + } + } + } + + return container; + } + + function findBlockEndPoint(container, sibling_name) { + var node, root = dom.getRoot(); + + // Expand to block of similar type + if (!format[0].wrapper) { + node = dom.getParent(container, format[0].block, root); + } + + // Expand to first wrappable block element or any block element + if (!node) { + node = dom.getParent(container.nodeType == 3 ? container.parentNode : container, function(node) { + // Fixes #6183 where it would expand to editable parent element in inline mode + return node != root && isTextBlock(node); + }); + } + + // Exclude inner lists from wrapping + if (node && format[0].wrapper) { + node = getParents(node, 'ul,ol').reverse()[0] || node; + } + + // Didn't find a block element look for first/last wrappable element + if (!node) { + node = container; + + while (node[sibling_name] && !isBlock(node[sibling_name])) { + node = node[sibling_name]; + + // Break on BR but include it will be removed later on + // we can't remove it now since we need to check if it can be wrapped + if (isEq(node, 'br')) { + break; + } + } + } + + return node || container; + } + + // Expand to closest contentEditable element + startContainer = findParentContentEditable(startContainer); + endContainer = findParentContentEditable(endContainer); + + // Exclude bookmark nodes if possible + if (isBookmarkNode(startContainer.parentNode) || isBookmarkNode(startContainer)) { + startContainer = isBookmarkNode(startContainer) ? startContainer : startContainer.parentNode; + startContainer = startContainer.nextSibling || startContainer; + + if (startContainer.nodeType == 3) { + startOffset = 0; + } + } + + if (isBookmarkNode(endContainer.parentNode) || isBookmarkNode(endContainer)) { + endContainer = isBookmarkNode(endContainer) ? endContainer : endContainer.parentNode; + endContainer = endContainer.previousSibling || endContainer; + + if (endContainer.nodeType == 3) { + endOffset = endContainer.length; + } + } + + if (format[0].inline) { + if (rng.collapsed) { + // Expand left to closest word boundary + endPoint = findWordEndPoint(startContainer, startOffset, true); + if (endPoint) { + startContainer = endPoint.container; + startOffset = endPoint.offset; + } + + // Expand right to closest word boundary + endPoint = findWordEndPoint(endContainer, endOffset); + if (endPoint) { + endContainer = endPoint.container; + endOffset = endPoint.offset; + } + } + + // Avoid applying formatting to a trailing space. + leaf = findLeaf(endContainer, endOffset); + if (leaf.node) { + while (leaf.node && leaf.offset === 0 && leaf.node.previousSibling) { + leaf = findLeaf(leaf.node.previousSibling); + } + + if (leaf.node && leaf.offset > 0 && leaf.node.nodeType === 3 && + leaf.node.nodeValue.charAt(leaf.offset - 1) === ' ') { + + if (leaf.offset > 1) { + endContainer = leaf.node; + endContainer.splitText(leaf.offset - 1); + } + } + } + } + + // Move start/end point up the tree if the leaves are sharp and if we are in different containers + // Example * becomes !: !

*texttext*

! + // This will reduce the number of wrapper elements that needs to be created + // Move start point up the tree + if (format[0].inline || format[0].block_expand) { + if (!format[0].inline || (startContainer.nodeType != 3 || startOffset === 0)) { + startContainer = findParentContainer(true); + } + + if (!format[0].inline || (endContainer.nodeType != 3 || endOffset === endContainer.nodeValue.length)) { + endContainer = findParentContainer(); + } + } + + // Expand start/end container to matching selector + if (format[0].selector && format[0].expand !== FALSE && !format[0].inline) { + // Find new startContainer/endContainer if there is better one + startContainer = findSelectorEndPoint(startContainer, 'previousSibling'); + endContainer = findSelectorEndPoint(endContainer, 'nextSibling'); + } + + // Expand start/end container to matching block element or text node + if (format[0].block || format[0].selector) { + // Find new startContainer/endContainer if there is better one + startContainer = findBlockEndPoint(startContainer, 'previousSibling'); + endContainer = findBlockEndPoint(endContainer, 'nextSibling'); + + // Non block element then try to expand up the leaf + if (format[0].block) { + if (!isBlock(startContainer)) { + startContainer = findParentContainer(true); + } + + if (!isBlock(endContainer)) { + endContainer = findParentContainer(); + } + } + } + + // Setup index for startContainer + if (startContainer.nodeType == 1) { + startOffset = nodeIndex(startContainer); + startContainer = startContainer.parentNode; + } + + // Setup index for endContainer + if (endContainer.nodeType == 1) { + endOffset = nodeIndex(endContainer) + 1; + endContainer = endContainer.parentNode; + } + + // Return new range like object + return { + startContainer: startContainer, + startOffset: startOffset, + endContainer: endContainer, + endOffset: endOffset + }; + } + + function isColorFormatAndAnchor(node, format) { + return format.links && node.tagName == 'A'; + } + + /** + * Removes the specified format for the specified node. It will also remove the node if it doesn't have + * any attributes if the format specifies it to do so. + * + * @private + * @param {Object} format Format object with items to remove from node. + * @param {Object} vars Name/value object with variables to apply to format. + * @param {Node} node Node to remove the format styles on. + * @param {Node} compare_node Optional compare node, if specified the styles will be compared to that node. + * @return {Boolean} True/false if the node was removed or not. + */ + function removeFormat(format, vars, node, compare_node) { + var i, attrs, stylesModified; + + // Check if node matches format + if (!matchName(node, format) && !isColorFormatAndAnchor(node, format)) { + return FALSE; + } + + // Should we compare with format attribs and styles + if (format.remove != 'all') { + // Remove styles + each(format.styles, function(value, name) { + value = normalizeStyleValue(replaceVars(value, vars), name); + + // Indexed array + if (typeof name === 'number') { + name = value; + compare_node = 0; + } + + if (format.remove_similar || (!compare_node || isEq(getStyle(compare_node, name), value))) { + dom.setStyle(node, name, ''); + } + + stylesModified = 1; + }); + + // Remove style attribute if it's empty + if (stylesModified && dom.getAttrib(node, 'style') === '') { + node.removeAttribute('style'); + node.removeAttribute('data-mce-style'); + } + + // Remove attributes + each(format.attributes, function(value, name) { + var valueOut; + + value = replaceVars(value, vars); + + // Indexed array + if (typeof name === 'number') { + name = value; + compare_node = 0; + } + + if (!compare_node || isEq(dom.getAttrib(compare_node, name), value)) { + // Keep internal classes + if (name == 'class') { + value = dom.getAttrib(node, name); + if (value) { + // Build new class value where everything is removed except the internal prefixed classes + valueOut = ''; + each(value.split(/\s+/), function(cls) { + if (/mce\-\w+/.test(cls)) { + valueOut += (valueOut ? ' ' : '') + cls; + } + }); + + // We got some internal classes left + if (valueOut) { + dom.setAttrib(node, name, valueOut); + return; + } + } + } + + // IE6 has a bug where the attribute doesn't get removed correctly + if (name == "class") { + node.removeAttribute('className'); + } + + // Remove mce prefixed attributes + if (MCE_ATTR_RE.test(name)) { + node.removeAttribute('data-mce-' + name); + } + + node.removeAttribute(name); + } + }); + + // Remove classes + each(format.classes, function(value) { + value = replaceVars(value, vars); + + if (!compare_node || dom.hasClass(compare_node, value)) { + dom.removeClass(node, value); + } + }); + + // Check for non internal attributes + attrs = dom.getAttribs(node); + for (i = 0; i < attrs.length; i++) { + if (attrs[i].nodeName.indexOf('_') !== 0) { + return FALSE; + } + } + } + + // Remove the inline child if it's empty for example or + if (format.remove != 'none') { + removeNode(node, format); + return TRUE; + } + } + + /** + * Removes the node and wrap it's children in paragraphs before doing so or + * appends BR elements to the beginning/end of the block element if forcedRootBlocks is disabled. + * + * If the div in the node below gets removed: + * text
text
text + * + * Output becomes: + * text

text
text + * + * So when the div is removed the result is: + * text
text
text + * + * @private + * @param {Node} node Node to remove + apply BR/P elements to. + * @param {Object} format Format rule. + * @return {Node} Input node. + */ + function removeNode(node, format) { + var parentNode = node.parentNode, rootBlockElm; + + function find(node, next, inc) { + node = getNonWhiteSpaceSibling(node, next, inc); + + return !node || (node.nodeName == 'BR' || isBlock(node)); + } + + if (format.block) { + if (!forcedRootBlock) { + // Append BR elements if needed before we remove the block + if (isBlock(node) && !isBlock(parentNode)) { + if (!find(node, FALSE) && !find(node.firstChild, TRUE, 1)) { + node.insertBefore(dom.create('br'), node.firstChild); + } + + if (!find(node, TRUE) && !find(node.lastChild, FALSE, 1)) { + node.appendChild(dom.create('br')); + } + } + } else { + // Wrap the block in a forcedRootBlock if we are at the root of document + if (parentNode == dom.getRoot()) { + if (!format.list_block || !isEq(node, format.list_block)) { + each(grep(node.childNodes), function(node) { + if (isValid(forcedRootBlock, node.nodeName.toLowerCase())) { + if (!rootBlockElm) { + rootBlockElm = wrap(node, forcedRootBlock); + dom.setAttribs(rootBlockElm, ed.settings.forced_root_block_attrs); + } else { + rootBlockElm.appendChild(node); + } + } else { + rootBlockElm = 0; + } + }); + } + } + } + } + + // Never remove nodes that isn't the specified inline element if a selector is specified too + if (format.selector && format.inline && !isEq(format.inline, node)) { + return; + } + + dom.remove(node, 1); + } + + /** + * Returns the next/previous non whitespace node. + * + * @private + * @param {Node} node Node to start at. + * @param {boolean} next (Optional) Include next or previous node defaults to previous. + * @param {boolean} inc (Optional) Include the current node in checking. Defaults to false. + * @return {Node} Next or previous node or undefined if it wasn't found. + */ + function getNonWhiteSpaceSibling(node, next, inc) { + if (node) { + next = next ? 'nextSibling' : 'previousSibling'; + + for (node = inc ? node : node[next]; node; node = node[next]) { + if (node.nodeType == 1 || !isWhiteSpaceNode(node)) { + return node; + } + } + } + } + + /** + * Merges the next/previous sibling element if they match. + * + * @private + * @param {Node} prev Previous node to compare/merge. + * @param {Node} next Next node to compare/merge. + * @return {Node} Next node if we didn't merge and prev node if we did. + */ + function mergeSiblings(prev, next) { + var sibling, tmpSibling, elementUtils = new ElementUtils(dom); + + function findElementSibling(node, sibling_name) { + for (sibling = node; sibling; sibling = sibling[sibling_name]) { + if (sibling.nodeType == 3 && sibling.nodeValue.length !== 0) { + return node; + } + + if (sibling.nodeType == 1 && !isBookmarkNode(sibling)) { + return sibling; + } + } + + return node; + } + + // Check if next/prev exists and that they are elements + if (prev && next) { + // If previous sibling is empty then jump over it + prev = findElementSibling(prev, 'previousSibling'); + next = findElementSibling(next, 'nextSibling'); + + // Compare next and previous nodes + if (elementUtils.compare(prev, next)) { + // Append nodes between + for (sibling = prev.nextSibling; sibling && sibling != next;) { + tmpSibling = sibling; + sibling = sibling.nextSibling; + prev.appendChild(tmpSibling); + } + + // Remove next node + dom.remove(next); + + // Move children into prev node + each(grep(next.childNodes), function(node) { + prev.appendChild(node); + }); + + return prev; + } + } + + return next; + } + + function getContainer(rng, start) { + var container, offset, lastIdx; + + container = rng[start ? 'startContainer' : 'endContainer']; + offset = rng[start ? 'startOffset' : 'endOffset']; + + if (container.nodeType == 1) { + lastIdx = container.childNodes.length - 1; + + if (!start && offset) { + offset--; + } + + container = container.childNodes[offset > lastIdx ? lastIdx : offset]; + } + + // If start text node is excluded then walk to the next node + if (container.nodeType === 3 && start && offset >= container.nodeValue.length) { + container = new TreeWalker(container, ed.getBody()).next() || container; + } + + // If end text node is excluded then walk to the previous node + if (container.nodeType === 3 && !start && offset === 0) { + container = new TreeWalker(container, ed.getBody()).prev() || container; + } + + return container; + } + + function performCaretAction(type, name, vars, similar) { + var caretContainerId = '_mce_caret', debug = ed.settings.caret_debug; + + // Creates a caret container bogus element + function createCaretContainer(fill) { + var caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true, style: debug ? 'color:red' : ''}); + + if (fill) { + caretContainer.appendChild(ed.getDoc().createTextNode(INVISIBLE_CHAR)); + } + + return caretContainer; + } + + function isCaretContainerEmpty(node, nodes) { + while (node) { + if ((node.nodeType === 3 && node.nodeValue !== INVISIBLE_CHAR) || node.childNodes.length > 1) { + return false; + } + + // Collect nodes + if (nodes && node.nodeType === 1) { + nodes.push(node); + } + + node = node.firstChild; + } + + return true; + } + + // Returns any parent caret container element + function getParentCaretContainer(node) { + while (node) { + if (node.id === caretContainerId) { + return node; + } + + node = node.parentNode; + } + } + + // Finds the first text node in the specified node + function findFirstTextNode(node) { + var walker; + + if (node) { + walker = new TreeWalker(node, node); + + for (node = walker.current(); node; node = walker.next()) { + if (node.nodeType === 3) { + return node; + } + } + } + } + + // Removes the caret container for the specified node or all on the current document + function removeCaretContainer(node, move_caret) { + var child, rng; + + if (!node) { + node = getParentCaretContainer(selection.getStart()); + + if (!node) { + while ((node = dom.get(caretContainerId))) { + removeCaretContainer(node, false); + } + } + } else { + rng = selection.getRng(true); + + if (isCaretContainerEmpty(node)) { + if (move_caret !== false) { + rng.setStartBefore(node); + rng.setEndBefore(node); + } + + dom.remove(node); + } else { + child = findFirstTextNode(node); + + if (child.nodeValue.charAt(0) === INVISIBLE_CHAR) { + child.deleteData(0, 1); + + // Fix for bug #6976 + if (rng.startContainer == child && rng.startOffset > 0) { + rng.setStart(child, rng.startOffset - 1); + } + + if (rng.endContainer == child && rng.endOffset > 0) { + rng.setEnd(child, rng.endOffset - 1); + } + } + + dom.remove(node, 1); + } + + selection.setRng(rng); + } + } + + // Applies formatting to the caret postion + function applyCaretFormat() { + var rng, caretContainer, textNode, offset, bookmark, container, text; + + rng = selection.getRng(true); + offset = rng.startOffset; + container = rng.startContainer; + text = container.nodeValue; + + caretContainer = getParentCaretContainer(selection.getStart()); + if (caretContainer) { + textNode = findFirstTextNode(caretContainer); + } + + // Expand to word is caret is in the middle of a text node and the char before/after is a alpha numeric character + if (text && offset > 0 && offset < text.length && /\w/.test(text.charAt(offset)) && /\w/.test(text.charAt(offset - 1))) { + // Get bookmark of caret position + bookmark = selection.getBookmark(); + + // Collapse bookmark range (WebKit) + rng.collapse(true); + + // Expand the range to the closest word and split it at those points + rng = expandRng(rng, get(name)); + rng = rangeUtils.split(rng); + + // Apply the format to the range + apply(name, vars, rng); + + // Move selection back to caret position + selection.moveToBookmark(bookmark); + } else { + if (!caretContainer || textNode.nodeValue !== INVISIBLE_CHAR) { + caretContainer = createCaretContainer(true); + textNode = caretContainer.firstChild; + + rng.insertNode(caretContainer); + offset = 1; + + apply(name, vars, caretContainer); + } else { + apply(name, vars, caretContainer); + } + + // Move selection to text node + selection.setCursorLocation(textNode, offset); + } + } + + function removeCaretFormat() { + var rng = selection.getRng(true), container, offset, bookmark, + hasContentAfter, node, formatNode, parents = [], i, caretContainer; + + container = rng.startContainer; + offset = rng.startOffset; + node = container; + + if (container.nodeType == 3) { + if (offset != container.nodeValue.length) { + hasContentAfter = true; + } + + node = node.parentNode; + } + + while (node) { + if (matchNode(node, name, vars, similar)) { + formatNode = node; + break; + } + + if (node.nextSibling) { + hasContentAfter = true; + } + + parents.push(node); + node = node.parentNode; + } + + // Node doesn't have the specified format + if (!formatNode) { + return; + } + + // Is there contents after the caret then remove the format on the element + if (hasContentAfter) { + // Get bookmark of caret position + bookmark = selection.getBookmark(); + + // Collapse bookmark range (WebKit) + rng.collapse(true); + + // Expand the range to the closest word and split it at those points + rng = expandRng(rng, get(name), true); + rng = rangeUtils.split(rng); + + // Remove the format from the range + remove(name, vars, rng); + + // Move selection back to caret position + selection.moveToBookmark(bookmark); + } else { + caretContainer = createCaretContainer(); + + node = caretContainer; + for (i = parents.length - 1; i >= 0; i--) { + node.appendChild(dom.clone(parents[i], false)); + node = node.firstChild; + } + + // Insert invisible character into inner most format element + node.appendChild(dom.doc.createTextNode(INVISIBLE_CHAR)); + node = node.firstChild; + + var block = dom.getParent(formatNode, isTextBlock); + + if (block && dom.isEmpty(block)) { + // Replace formatNode with caretContainer when removing format from empty block like

|

+ formatNode.parentNode.replaceChild(caretContainer, formatNode); + } else { + // Insert caret container after the formated node + dom.insertAfter(caretContainer, formatNode); + } + + // Move selection to text node + selection.setCursorLocation(node, 1); + + // If the formatNode is empty, we can remove it safely. + if (dom.isEmpty(formatNode)) { + dom.remove(formatNode); + } + } + } + + // Checks if the parent caret container node isn't empty if that is the case it + // will remove the bogus state on all children that isn't empty + function unmarkBogusCaretParents() { + var caretContainer; + + caretContainer = getParentCaretContainer(selection.getStart()); + if (caretContainer && !dom.isEmpty(caretContainer)) { + walk(caretContainer, function(node) { + if (node.nodeType == 1 && node.id !== caretContainerId && !dom.isEmpty(node)) { + dom.setAttrib(node, 'data-mce-bogus', null); + } + }, 'childNodes'); + } + } + + // Only bind the caret events once + if (!ed._hasCaretEvents) { + // Mark current caret container elements as bogus when getting the contents so we don't end up with empty elements + markCaretContainersBogus = function() { + var nodes = [], i; + + if (isCaretContainerEmpty(getParentCaretContainer(selection.getStart()), nodes)) { + // Mark children + i = nodes.length; + while (i--) { + dom.setAttrib(nodes[i], 'data-mce-bogus', '1'); + } + } + }; + + disableCaretContainer = function(e) { + var keyCode = e.keyCode; + + removeCaretContainer(); + + // Remove caret container on keydown and it's a backspace, enter or left/right arrow keys + // Backspace key needs to check if the range is collapsed due to bug #6780 + if ((keyCode == 8 && selection.isCollapsed()) || keyCode == 37 || keyCode == 39) { + removeCaretContainer(getParentCaretContainer(selection.getStart())); + } + + unmarkBogusCaretParents(); + }; + + // Remove bogus state if they got filled by contents using editor.selection.setContent + ed.on('SetContent', function(e) { + if (e.selection) { + unmarkBogusCaretParents(); + } + }); + ed._hasCaretEvents = true; + } + + // Do apply or remove caret format + if (type == "apply") { + applyCaretFormat(); + } else { + removeCaretFormat(); + } + } + + /** + * Moves the start to the first suitable text node. + */ + function moveStart(rng) { + var container = rng.startContainer, + offset = rng.startOffset, isAtEndOfText, + walker, node, nodes, tmpNode; + + // Convert text node into index if possible + if (container.nodeType == 3 && offset >= container.nodeValue.length) { + // Get the parent container location and walk from there + offset = nodeIndex(container); + container = container.parentNode; + isAtEndOfText = true; + } + + // Move startContainer/startOffset in to a suitable node + if (container.nodeType == 1) { + nodes = container.childNodes; + container = nodes[Math.min(offset, nodes.length - 1)]; + walker = new TreeWalker(container, dom.getParent(container, dom.isBlock)); + + // If offset is at end of the parent node walk to the next one + if (offset > nodes.length - 1 || isAtEndOfText) { + walker.next(); + } + + for (node = walker.current(); node; node = walker.next()) { + if (node.nodeType == 3 && !isWhiteSpaceNode(node)) { + // IE has a "neat" feature where it moves the start node into the closest element + // we can avoid this by inserting an element before it and then remove it after we set the selection + tmpNode = dom.create('a', {'data-mce-bogus': 'all'}, INVISIBLE_CHAR); + node.parentNode.insertBefore(tmpNode, node); + + // Set selection and remove tmpNode + rng.setStart(node, 0); + selection.setRng(rng); + dom.remove(tmpNode); + + return; + } + } + } + } + }; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/LegacyInput.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/LegacyInput.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,76 @@ +/** + * LegacyInput.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +define("tinymce/LegacyInput", [ + "tinymce/EditorManager", + "tinymce/util/Tools" +], function(EditorManager, Tools) { + var each = Tools.each, explode = Tools.explode; + + EditorManager.on('AddEditor', function(e) { + var editor = e.editor; + + editor.on('preInit', function() { + var filters, fontSizes, dom, settings = editor.settings; + + function replaceWithSpan(node, styles) { + each(styles, function(value, name) { + if (value) { + dom.setStyle(node, name, value); + } + }); + + dom.rename(node, 'span'); + } + + function convert(e) { + dom = editor.dom; + + if (settings.convert_fonts_to_spans) { + each(dom.select('font,u,strike', e.node), function(node) { + filters[node.nodeName.toLowerCase()](dom, node); + }); + } + } + + if (settings.inline_styles) { + fontSizes = explode(settings.font_size_legacy_values); + + filters = { + font: function(dom, node) { + replaceWithSpan(node, { + backgroundColor: node.style.backgroundColor, + color: node.color, + fontFamily: node.face, + fontSize: fontSizes[parseInt(node.size, 10) - 1] + }); + }, + + u: function(dom, node) { + // HTML5 allows U element + if (editor.settings.schema === "html4") { + replaceWithSpan(node, { + textDecoration: 'underline' + }); + } + }, + + strike: function(dom, node) { + replaceWithSpan(node, { + textDecoration: 'line-through' + }); + } + }; + + editor.on('PreProcess SetContent', convert); + } + }); + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/NodeChange.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/NodeChange.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,153 @@ +/** + * NodeChange.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles the nodechange event dispatching both manual and though selection change events. + * + * @class tinymce.NodeChange + * @private + */ +define("tinymce/NodeChange", [ + "tinymce/dom/RangeUtils", + "tinymce/Env" +], function(RangeUtils, Env) { + return function(editor) { + var lastRng, lastPath = []; + + /** + * Returns true/false if the current element path has been changed or not. + * + * @private + * @return {Boolean} True if the element path is the same false if it's not. + */ + function isSameElementPath(startElm) { + var i, currentPath; + + currentPath = editor.$(startElm).parentsUntil(editor.getBody()).add(startElm); + if (currentPath.length === lastPath.length) { + for (i = currentPath.length; i >= 0; i--) { + if (currentPath[i] !== lastPath[i]) { + break; + } + } + + if (i === -1) { + lastPath = currentPath; + return true; + } + } + + lastPath = currentPath; + + return false; + } + + // Gecko doesn't support the "selectionchange" event + if (!('onselectionchange' in editor.getDoc())) { + editor.on('NodeChange Click MouseUp KeyUp Focus', function(e) { + var nativeRng, fakeRng; + + // Since DOM Ranges mutate on modification + // of the DOM we need to clone it's contents + nativeRng = editor.selection.getRng(); + fakeRng = { + startContainer: nativeRng.startContainer, + startOffset: nativeRng.startOffset, + endContainer: nativeRng.endContainer, + endOffset: nativeRng.endOffset + }; + + // Always treat nodechange as a selectionchange since applying + // formatting to the current range wouldn't update the range but it's parent + if (e.type == 'nodechange' || !RangeUtils.compareRanges(fakeRng, lastRng)) { + editor.fire('SelectionChange'); + } + + lastRng = fakeRng; + }); + } + + // IE has a bug where it fires a selectionchange on right click that has a range at the start of the body + // When the contextmenu event fires the selection is located at the right location + editor.on('contextmenu', function() { + editor.fire('SelectionChange'); + }); + + // Selection change is delayed ~200ms on IE when you click inside the current range + editor.on('SelectionChange', function() { + var startElm = editor.selection.getStart(true); + + // IE 8 will fire a selectionchange event with an incorrect selection + // when focusing out of table cells. Click inside cell -> toolbar = Invalid SelectionChange event + if (!Env.range && editor.selection.isCollapsed()) { + return; + } + + if (!isSameElementPath(startElm) && editor.dom.isChildOf(startElm, editor.getBody())) { + editor.nodeChanged({selectionChange: true}); + } + }); + + // Fire an extra nodeChange on mouseup for compatibility reasons + editor.on('MouseUp', function(e) { + if (!e.isDefaultPrevented()) { + // Delay nodeChanged call for WebKit edge case issue where the range + // isn't updated until after you click outside a selected image + if (editor.selection.getNode().nodeName == 'IMG') { + setTimeout(function() { + editor.nodeChanged(); + }, 0); + } else { + editor.nodeChanged(); + } + } + }); + + /** + * Distpaches out a onNodeChange event to all observers. This method should be called when you + * need to update the UI states or element path etc. + * + * @method nodeChanged + * @param {Object} args Optional args to pass to NodeChange event handlers. + */ + this.nodeChanged = function(args) { + var selection = editor.selection, node, parents, root; + + // Fix for bug #1896577 it seems that this can not be fired while the editor is loading + if (editor.initialized && selection && !editor.settings.disable_nodechange && !editor.settings.readonly) { + // Get start node + root = editor.getBody(); + node = selection.getStart() || root; + node = node.ownerDocument != editor.getDoc() ? editor.getBody() : node; + + // Edge case for

|

+ if (node.nodeName == 'IMG' && selection.isCollapsed()) { + node = node.parentNode; + } + + // Get parents and add them to object + parents = []; + editor.dom.getParent(node, function(node) { + if (node === root) { + return true; + } + + parents.push(node); + }); + + args = args || {}; + args.element = node; + args.parents = parents; + + editor.fire('NodeChange', args); + } + }; + }; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/Shortcuts.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/Shortcuts.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,171 @@ +/** + * Shortcuts.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Contains all logic for handling of keyboard shortcuts. + * + * @example + * editor.shortcuts.add('ctrl+a', function() {}); + * editor.shortcuts.add('meta+a', function() {}); // "meta" maps to Command on Mac and Ctrl on PC + * editor.shortcuts.add('ctrl+alt+a', function() {}); + * editor.shortcuts.add('access+a', function() {}); // "access" maps to ctrl+alt on Mac and shift+alt on PC + */ +define("tinymce/Shortcuts", [ + "tinymce/util/Tools", + "tinymce/Env" +], function(Tools, Env) { + var each = Tools.each, explode = Tools.explode; + + var keyCodeLookup = { + "f9": 120, + "f10": 121, + "f11": 122 + }; + + var modifierNames = Tools.makeMap('alt,ctrl,shift,meta,access'); + + return function(editor) { + var self = this, shortcuts = {}; + + function createShortcut(pattern, desc, cmdFunc, scope) { + var id, key, shortcut; + + shortcut = { + func: cmdFunc, + scope: scope || editor, + desc: editor.translate(desc) + }; + + // Parse modifiers and keys ctrl+alt+b for example + each(explode(pattern, '+'), function(value) { + if (value in modifierNames) { + shortcut[value] = true; + } else { + // Allow numeric keycodes like ctrl+219 for ctrl+[ + if (/^[0-9]{2,}$/.test(value)) { + shortcut.keyCode = parseInt(value, 10); + } else { + shortcut.charCode = value.charCodeAt(0); + shortcut.keyCode = keyCodeLookup[value] || value.toUpperCase().charCodeAt(0); + } + } + }); + + // Generate unique id for modifier combination and set default state for unused modifiers + id = [shortcut.keyCode]; + for (key in modifierNames) { + if (shortcut[key]) { + id.push(key); + } else { + shortcut[key] = false; + } + } + shortcut.id = id.join(','); + + // Handle special access modifier differently depending on Mac/Win + if (shortcut.access) { + shortcut.alt = true; + + if (Env.mac) { + shortcut.ctrl = true; + } else { + shortcut.shift = true; + } + } + + // Handle special meta modifier differently depending on Mac/Win + if (shortcut.meta) { + if (Env.mac) { + shortcut.meta = true; + } else { + shortcut.ctrl = true; + shortcut.meta = false; + } + } + + return shortcut; + } + + editor.on('keyup keypress keydown', function(e) { + if ((e.altKey || e.ctrlKey || e.metaKey) && !e.isDefaultPrevented()) { + each(shortcuts, function(shortcut) { + if (shortcut.ctrl != e.ctrlKey || shortcut.meta != e.metaKey) { + return; + } + + if (shortcut.alt != e.altKey || shortcut.shift != e.shiftKey) { + return; + } + + if (e.keyCode == shortcut.keyCode || (e.charCode && e.charCode == shortcut.charCode)) { + e.preventDefault(); + + if (e.type == "keydown") { + shortcut.func.call(shortcut.scope); + } + + return true; + } + }); + } + }); + + /** + * Adds a keyboard shortcut for some command or function. + * + * @method addShortcut + * @param {String} pattern Shortcut pattern. Like for example: ctrl+alt+o. + * @param {String} desc Text description for the command. + * @param {String/Function} cmdFunc Command name string or function to execute when the key is pressed. + * @param {Object} sc Optional scope to execute the function in. + * @return {Boolean} true/false state if the shortcut was added or not. + */ + self.add = function(pattern, desc, cmdFunc, scope) { + var cmd; + + cmd = cmdFunc; + + if (typeof cmdFunc === 'string') { + cmdFunc = function() { + editor.execCommand(cmd, false, null); + }; + } else if (Tools.isArray(cmd)) { + cmdFunc = function() { + editor.execCommand(cmd[0], cmd[1], cmd[2]); + }; + } + + each(explode(pattern.toLowerCase()), function(pattern) { + var shortcut = createShortcut(pattern, desc, cmdFunc, scope); + shortcuts[shortcut.id] = shortcut; + }); + + return true; + }; + + /** + * Remove a keyboard shortcut by pattern. + * + * @method remove + * @param {String} pattern Shortcut pattern. Like for example: ctrl+alt+o. + * @return {Boolean} true/false state if the shortcut was removed or not. + */ + self.remove = function(pattern) { + var shortcut = createShortcut(pattern); + + if (shortcuts[shortcut.id]) { + delete shortcuts[shortcut.id]; + return true; + } + + return false; + }; + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/UndoManager.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/UndoManager.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,379 @@ +/** + * UndoManager.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles the undo/redo history levels for the editor. Since the build in undo/redo has major drawbacks a custom one was needed. + * + * @class tinymce.UndoManager + */ +define("tinymce/UndoManager", [ + "tinymce/util/VK", + "tinymce/Env", + "tinymce/util/Tools", + "tinymce/html/SaxParser" +], function(VK, Env, Tools, SaxParser) { + var trim = Tools.trim, trimContentRegExp; + + trimContentRegExp = new RegExp([ + ']+data-mce-bogus[^>]+>[\u200B\uFEFF]+<\\/span>', // Trim bogus spans like caret containers + '\\s?data-mce-selected="[^"]+"' // Trim temporaty data-mce prefixed attributes like data-mce-selected + ].join('|'), 'gi'); + + return function(editor) { + var self = this, index = 0, data = [], beforeBookmark, isFirstTypedCharacter, locks = 0; + + /** + * Returns a trimmed version of the editor contents to be used for the undo level. This + * will remove any data-mce-bogus="all" marked elements since these are used for UI it will also + * remove the data-mce-selected attributes used for selection of objects and caret containers. + * It will keep all data-mce-bogus="1" elements since these can be used to place the caret etc and will + * be removed by the serialization logic when you save. + * + * @private + * @return {String} HTML contents of the editor excluding some internal bogus elements. + */ + function getContent() { + var content = editor.getContent({format: 'raw', no_events: 1}); + var bogusAllRegExp = /<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g; + var endTagIndex, index, matchLength, matches, shortEndedElements, schema = editor.schema; + + content = content.replace(trimContentRegExp, ''); + shortEndedElements = schema.getShortEndedElements(); + + // Remove all bogus elements marked with "all" + while ((matches = bogusAllRegExp.exec(content))) { + index = bogusAllRegExp.lastIndex; + matchLength = matches[0].length; + + if (shortEndedElements[matches[1]]) { + endTagIndex = index; + } else { + endTagIndex = SaxParser.findEndTag(schema, content, index); + } + + content = content.substring(0, index - matchLength) + content.substring(endTagIndex); + bogusAllRegExp.lastIndex = index - matchLength; + } + + return trim(content); + } + + function setDirty(state) { + editor.isNotDirty = !state; + } + + function addNonTypingUndoLevel(e) { + self.typing = false; + self.add({}, e); + } + + // Add initial undo level when the editor is initialized + editor.on('init', function() { + self.add(); + }); + + // Get position before an execCommand is processed + editor.on('BeforeExecCommand', function(e) { + var cmd = e.command; + + if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint') { + self.beforeChange(); + } + }); + + // Add undo level after an execCommand call was made + editor.on('ExecCommand', function(e) { + var cmd = e.command; + + if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint') { + addNonTypingUndoLevel(e); + } + }); + + editor.on('ObjectResizeStart', function() { + self.beforeChange(); + }); + + editor.on('SaveContent ObjectResized blur', addNonTypingUndoLevel); + editor.on('DragEnd', addNonTypingUndoLevel); + + editor.on('KeyUp', function(e) { + var keyCode = e.keyCode; + + if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 45 || keyCode == 13 || e.ctrlKey) { + addNonTypingUndoLevel(); + editor.nodeChanged(); + } + + if (keyCode == 46 || keyCode == 8 || (Env.mac && (keyCode == 91 || keyCode == 93))) { + editor.nodeChanged(); + } + + // Fire a TypingUndo event on the first character entered + if (isFirstTypedCharacter && self.typing) { + // Make it dirty if the content was changed after typing the first character + if (!editor.isDirty()) { + setDirty(data[0] && getContent() != data[0].content); + + // Fire initial change event + if (!editor.isNotDirty) { + editor.fire('change', {level: data[0], lastLevel: null}); + } + } + + editor.fire('TypingUndo'); + isFirstTypedCharacter = false; + editor.nodeChanged(); + } + }); + + editor.on('KeyDown', function(e) { + var keyCode = e.keyCode; + + // Is caracter positon keys left,right,up,down,home,end,pgdown,pgup,enter + if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 45) { + if (self.typing) { + addNonTypingUndoLevel(e); + } + + return; + } + + // If key isn't Ctrl+Alt/AltGr + var modKey = (e.ctrlKey && !e.altKey) || e.metaKey; + if ((keyCode < 16 || keyCode > 20) && keyCode != 224 && keyCode != 91 && !self.typing && !modKey) { + self.beforeChange(); + self.typing = true; + self.add({}, e); + isFirstTypedCharacter = true; + } + }); + + editor.on('MouseDown', function(e) { + if (self.typing) { + addNonTypingUndoLevel(e); + } + }); + + // Add keyboard shortcuts for undo/redo keys + editor.addShortcut('meta+z', '', 'Undo'); + editor.addShortcut('meta+y,meta+shift+z', '', 'Redo'); + + editor.on('AddUndo Undo Redo ClearUndos', function(e) { + if (!e.isDefaultPrevented()) { + editor.nodeChanged(); + } + }); + + /*eslint consistent-this:0 */ + self = { + // Explose for debugging reasons + data: data, + + /** + * State if the user is currently typing or not. This will add a typing operation into one undo + * level instead of one new level for each keystroke. + * + * @field {Boolean} typing + */ + typing: false, + + /** + * Stores away a bookmark to be used when performing an undo action so that the selection is before + * the change has been made. + * + * @method beforeChange + */ + beforeChange: function() { + if (!locks) { + beforeBookmark = editor.selection.getBookmark(2, true); + } + }, + + /** + * Adds a new undo level/snapshot to the undo list. + * + * @method add + * @param {Object} level Optional undo level object to add. + * @param {DOMEvent} Event Optional event responsible for the creation of the undo level. + * @return {Object} Undo level that got added or null it a level wasn't needed. + */ + add: function(level, event) { + var i, settings = editor.settings, lastLevel; + + level = level || {}; + level.content = getContent(); + + if (locks || editor.removed) { + return null; + } + + lastLevel = data[index]; + if (editor.fire('BeforeAddUndo', {level: level, lastLevel: lastLevel, originalEvent: event}).isDefaultPrevented()) { + return null; + } + + // Add undo level if needed + if (lastLevel && lastLevel.content == level.content) { + return null; + } + + // Set before bookmark on previous level + if (data[index]) { + data[index].beforeBookmark = beforeBookmark; + } + + // Time to compress + if (settings.custom_undo_redo_levels) { + if (data.length > settings.custom_undo_redo_levels) { + for (i = 0; i < data.length - 1; i++) { + data[i] = data[i + 1]; + } + + data.length--; + index = data.length; + } + } + + // Get a non intrusive normalized bookmark + level.bookmark = editor.selection.getBookmark(2, true); + + // Crop array if needed + if (index < data.length - 1) { + data.length = index + 1; + } + + data.push(level); + index = data.length - 1; + + var args = {level: level, lastLevel: lastLevel, originalEvent: event}; + + editor.fire('AddUndo', args); + + if (index > 0) { + setDirty(true); + editor.fire('change', args); + } + + return level; + }, + + /** + * Undoes the last action. + * + * @method undo + * @return {Object} Undo level or null if no undo was performed. + */ + undo: function() { + var level; + + if (self.typing) { + self.add(); + self.typing = false; + } + + if (index > 0) { + level = data[--index]; + + // Undo to first index then set dirty state to false + if (index === 0) { + setDirty(false); + } + + editor.setContent(level.content, {format: 'raw'}); + editor.selection.moveToBookmark(level.beforeBookmark); + + editor.fire('undo', {level: level}); + } + + return level; + }, + + /** + * Redoes the last action. + * + * @method redo + * @return {Object} Redo level or null if no redo was performed. + */ + redo: function() { + var level; + + if (index < data.length - 1) { + level = data[++index]; + + editor.setContent(level.content, {format: 'raw'}); + editor.selection.moveToBookmark(level.bookmark); + setDirty(true); + + editor.fire('redo', {level: level}); + } + + return level; + }, + + /** + * Removes all undo levels. + * + * @method clear + */ + clear: function() { + data = []; + index = 0; + self.typing = false; + editor.fire('ClearUndos'); + }, + + /** + * Returns true/false if the undo manager has any undo levels. + * + * @method hasUndo + * @return {Boolean} true/false if the undo manager has any undo levels. + */ + hasUndo: function() { + // Has undo levels or typing and content isn't the same as the initial level + return index > 0 || (self.typing && data[0] && getContent() != data[0].content); + }, + + /** + * Returns true/false if the undo manager has any redo levels. + * + * @method hasRedo + * @return {Boolean} true/false if the undo manager has any redo levels. + */ + hasRedo: function() { + return index < data.length - 1 && !this.typing; + }, + + /** + * Executes the specified function in an undo transation. The selection + * before the modification will be stored to the undo stack and if the DOM changes + * it will add a new undo level. Any methods within the transation that adds undo levels will + * be ignored. So a transation can include calls to execCommand or editor.insertContent. + * + * @method transact + * @param {function} callback Function to execute dom manipulation logic in. + */ + transact: function(callback) { + self.beforeChange(); + + try { + locks++; + callback(); + } finally { + locks--; + } + + self.add(); + } + }; + + return self; + }; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/WindowManager.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/WindowManager.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,241 @@ +/** + * WindowManager.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles the creation of native windows and dialogs. This class can be extended to provide for example inline dialogs. + * + * @class tinymce.WindowManager + * @example + * // Opens a new dialog with the file.htm file and the size 320x240 + * // It also adds a custom parameter this can be retrieved by using tinyMCEPopup.getWindowArg inside the dialog. + * tinymce.activeEditor.windowManager.open({ + * url: 'file.htm', + * width: 320, + * height: 240 + * }, { + * custom_param: 1 + * }); + * + * // Displays an alert box using the active editors window manager instance + * tinymce.activeEditor.windowManager.alert('Hello world!'); + * + * // Displays an confirm box and an alert message will be displayed depending on what you choose in the confirm + * tinymce.activeEditor.windowManager.confirm("Do you want to do something", function(s) { + * if (s) + * tinymce.activeEditor.windowManager.alert("Ok"); + * else + * tinymce.activeEditor.windowManager.alert("Cancel"); + * }); + */ +define("tinymce/WindowManager", [ + "tinymce/ui/Window", + "tinymce/ui/MessageBox" +], function(Window, MessageBox) { + return function(editor) { + var self = this, windows = []; + + function getTopMostWindow() { + if (windows.length) { + return windows[windows.length - 1]; + } + } + + self.windows = windows; + + editor.on('remove', function() { + var i = windows.length; + + while (i--) { + windows[i].close(); + } + }); + + /** + * Opens a new window. + * + * @method open + * @param {Object} args Optional name/value settings collection contains things like width/height/url etc. + * @option {String} title Window title. + * @option {String} file URL of the file to open in the window. + * @option {Number} width Width in pixels. + * @option {Number} height Height in pixels. + * @option {Boolean} autoScroll Specifies whether the popup window can have scrollbars if required (i.e. content + * larger than the popup size specified). + */ + self.open = function(args, params) { + var win; + + editor.editorManager.setActive(editor); + + args.title = args.title || ' '; + + // Handle URL + args.url = args.url || args.file; // Legacy + if (args.url) { + args.width = parseInt(args.width || 320, 10); + args.height = parseInt(args.height || 240, 10); + } + + // Handle body + if (args.body) { + args.items = { + defaults: args.defaults, + type: args.bodyType || 'form', + items: args.body + }; + } + + if (!args.url && !args.buttons) { + args.buttons = [ + {text: 'Ok', subtype: 'primary', onclick: function() { + win.find('form')[0].submit(); + }}, + + {text: 'Cancel', onclick: function() { + win.close(); + }} + ]; + } + + win = new Window(args); + windows.push(win); + + win.on('close', function() { + var i = windows.length; + + while (i--) { + if (windows[i] === win) { + windows.splice(i, 1); + } + } + + if (!windows.length) { + editor.focus(); + } + }); + + // Handle data + if (args.data) { + win.on('postRender', function() { + this.find('*').each(function(ctrl) { + var name = ctrl.name(); + + if (name in args.data) { + ctrl.value(args.data[name]); + } + }); + }); + } + + // store args and parameters + win.features = args || {}; + win.params = params || {}; + + // Takes a snapshot in the FocusManager of the selection before focus is lost to dialog + if (windows.length === 1) { + editor.nodeChanged(); + } + + return win.renderTo().reflow(); + }; + + /** + * Creates a alert dialog. Please don't use the blocking behavior of this + * native version use the callback method instead then it can be extended. + * + * @method alert + * @param {String} message Text to display in the new alert dialog. + * @param {function} callback Callback function to be executed after the user has selected ok. + * @param {Object} scope Optional scope to execute the callback in. + * @example + * // Displays an alert box using the active editors window manager instance + * tinymce.activeEditor.windowManager.alert('Hello world!'); + */ + self.alert = function(message, callback, scope) { + MessageBox.alert(message, function() { + if (callback) { + callback.call(scope || this); + } else { + editor.focus(); + } + }); + }; + + /** + * Creates a confirm dialog. Please don't use the blocking behavior of this + * native version use the callback method instead then it can be extended. + * + * @method confirm + * @param {String} messageText to display in the new confirm dialog. + * @param {function} callback Callback function to be executed after the user has selected ok or cancel. + * @param {Object} scope Optional scope to execute the callback in. + * @example + * // Displays an confirm box and an alert message will be displayed depending on what you choose in the confirm + * tinymce.activeEditor.windowManager.confirm("Do you want to do something", function(s) { + * if (s) + * tinymce.activeEditor.windowManager.alert("Ok"); + * else + * tinymce.activeEditor.windowManager.alert("Cancel"); + * }); + */ + self.confirm = function(message, callback, scope) { + MessageBox.confirm(message, function(state) { + callback.call(scope || this, state); + }); + }; + + /** + * Closes the top most window. + * + * @method close + */ + self.close = function() { + if (getTopMostWindow()) { + getTopMostWindow().close(); + } + }; + + /** + * Returns the params of the last window open call. This can be used in iframe based + * dialog to get params passed from the tinymce plugin. + * + * @example + * var dialogArguments = top.tinymce.activeEditor.windowManager.getParams(); + * + * @method getParams + * @return {Object} Name/value object with parameters passed from windowManager.open call. + */ + self.getParams = function() { + return getTopMostWindow() ? getTopMostWindow().params : null; + }; + + /** + * Sets the params of the last opened window. + * + * @method setParams + * @param {Object} params Params object to set for the last opened window. + */ + self.setParams = function(params) { + if (getTopMostWindow()) { + getTopMostWindow().params = params; + } + }; + + /** + * Returns the currently opened window objects. + * + * @method getWindows + * @return {Array} Array of the currently opened windows. + */ + self.getWindows = function() { + return windows; + }; + }; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/BookmarkManager.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/BookmarkManager.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,389 @@ +/** + * BookmarkManager.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles selection bookmarks. + * + * @class tinymce.dom.BookmarkManager + */ +define("tinymce/dom/BookmarkManager", [ + "tinymce/Env", + "tinymce/util/Tools" +], function(Env, Tools) { + /** + * Constructs a new BookmarkManager instance for a specific selection instance. + * + * @constructor + * @method BookmarkManager + * @param {tinymce.dom.Selection} selection Selection instance to handle bookmarks for. + */ + function BookmarkManager(selection) { + var dom = selection.dom; + + /** + * Returns a bookmark location for the current selection. This bookmark object + * can then be used to restore the selection after some content modification to the document. + * + * @method getBookmark + * @param {Number} type Optional state if the bookmark should be simple or not. Default is complex. + * @param {Boolean} normalized Optional state that enables you to get a position that it would be after normalization. + * @return {Object} Bookmark object, use moveToBookmark with this object to restore the selection. + * @example + * // Stores a bookmark of the current selection + * var bm = tinymce.activeEditor.selection.getBookmark(); + * + * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content'); + * + * // Restore the selection bookmark + * tinymce.activeEditor.selection.moveToBookmark(bm); + */ + this.getBookmark = function(type, normalized) { + var rng, rng2, id, collapsed, name, element, chr = '', styles; + + function findIndex(name, element) { + var index = 0; + + Tools.each(dom.select(name), function(node, i) { + if (node == element) { + index = i; + } + }); + + return index; + } + + function normalizeTableCellSelection(rng) { + function moveEndPoint(start) { + var container, offset, childNodes, prefix = start ? 'start' : 'end'; + + container = rng[prefix + 'Container']; + offset = rng[prefix + 'Offset']; + + if (container.nodeType == 1 && container.nodeName == "TR") { + childNodes = container.childNodes; + container = childNodes[Math.min(start ? offset : offset - 1, childNodes.length - 1)]; + if (container) { + offset = start ? 0 : container.childNodes.length; + rng['set' + (start ? 'Start' : 'End')](container, offset); + } + } + } + + moveEndPoint(true); + moveEndPoint(); + + return rng; + } + + function getLocation() { + var rng = selection.getRng(true), root = dom.getRoot(), bookmark = {}; + + function getPoint(rng, start) { + var container = rng[start ? 'startContainer' : 'endContainer'], + offset = rng[start ? 'startOffset' : 'endOffset'], point = [], node, childNodes, after = 0; + + if (container.nodeType == 3) { + if (normalized) { + for (node = container.previousSibling; node && node.nodeType == 3; node = node.previousSibling) { + offset += node.nodeValue.length; + } + } + + point.push(offset); + } else { + childNodes = container.childNodes; + + if (offset >= childNodes.length && childNodes.length) { + after = 1; + offset = Math.max(0, childNodes.length - 1); + } + + point.push(dom.nodeIndex(childNodes[offset], normalized) + after); + } + + for (; container && container != root; container = container.parentNode) { + point.push(dom.nodeIndex(container, normalized)); + } + + return point; + } + + bookmark.start = getPoint(rng, true); + + if (!selection.isCollapsed()) { + bookmark.end = getPoint(rng); + } + + return bookmark; + } + + if (type == 2) { + element = selection.getNode(); + name = element ? element.nodeName : null; + + if (name == 'IMG') { + return {name: name, index: findIndex(name, element)}; + } + + if (selection.tridentSel) { + return selection.tridentSel.getBookmark(type); + } + + return getLocation(); + } + + // Handle simple range + if (type) { + return {rng: selection.getRng()}; + } + + rng = selection.getRng(); + id = dom.uniqueId(); + collapsed = selection.isCollapsed(); + styles = 'overflow:hidden;line-height:0px'; + + // Explorer method + if (rng.duplicate || rng.item) { + // Text selection + if (!rng.item) { + rng2 = rng.duplicate(); + + try { + // Insert start marker + rng.collapse(); + rng.pasteHTML('' + chr + ''); + + // Insert end marker + if (!collapsed) { + rng2.collapse(false); + + // Detect the empty space after block elements in IE and move the + // end back one character

] becomes

]

+ rng.moveToElementText(rng2.parentElement()); + if (rng.compareEndPoints('StartToEnd', rng2) === 0) { + rng2.move('character', -1); + } + + rng2.pasteHTML('' + chr + ''); + } + } catch (ex) { + // IE might throw unspecified error so lets ignore it + return null; + } + } else { + // Control selection + element = rng.item(0); + name = element.nodeName; + + return {name: name, index: findIndex(name, element)}; + } + } else { + element = selection.getNode(); + name = element.nodeName; + if (name == 'IMG') { + return {name: name, index: findIndex(name, element)}; + } + + // W3C method + rng2 = normalizeTableCellSelection(rng.cloneRange()); + + // Insert end marker + if (!collapsed) { + rng2.collapse(false); + rng2.insertNode(dom.create('span', {'data-mce-type': "bookmark", id: id + '_end', style: styles}, chr)); + } + + rng = normalizeTableCellSelection(rng); + rng.collapse(true); + rng.insertNode(dom.create('span', {'data-mce-type': "bookmark", id: id + '_start', style: styles}, chr)); + } + + selection.moveToBookmark({id: id, keep: 1}); + + return {id: id}; + }; + + /** + * Restores the selection to the specified bookmark. + * + * @method moveToBookmark + * @param {Object} bookmark Bookmark to restore selection from. + * @return {Boolean} true/false if it was successful or not. + * @example + * // Stores a bookmark of the current selection + * var bm = tinymce.activeEditor.selection.getBookmark(); + * + * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content'); + * + * // Restore the selection bookmark + * tinymce.activeEditor.selection.moveToBookmark(bm); + */ + this.moveToBookmark = function(bookmark) { + var rng, root, startContainer, endContainer, startOffset, endOffset; + + function setEndPoint(start) { + var point = bookmark[start ? 'start' : 'end'], i, node, offset, children; + + if (point) { + offset = point[0]; + + // Find container node + for (node = root, i = point.length - 1; i >= 1; i--) { + children = node.childNodes; + + if (point[i] > children.length - 1) { + return; + } + + node = children[point[i]]; + } + + // Move text offset to best suitable location + if (node.nodeType === 3) { + offset = Math.min(point[0], node.nodeValue.length); + } + + // Move element offset to best suitable location + if (node.nodeType === 1) { + offset = Math.min(point[0], node.childNodes.length); + } + + // Set offset within container node + if (start) { + rng.setStart(node, offset); + } else { + rng.setEnd(node, offset); + } + } + + return true; + } + + function restoreEndPoint(suffix) { + var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev, keep = bookmark.keep; + + if (marker) { + node = marker.parentNode; + + if (suffix == 'start') { + if (!keep) { + idx = dom.nodeIndex(marker); + } else { + node = marker.firstChild; + idx = 1; + } + + startContainer = endContainer = node; + startOffset = endOffset = idx; + } else { + if (!keep) { + idx = dom.nodeIndex(marker); + } else { + node = marker.firstChild; + idx = 1; + } + + endContainer = node; + endOffset = idx; + } + + if (!keep) { + prev = marker.previousSibling; + next = marker.nextSibling; + + // Remove all marker text nodes + Tools.each(Tools.grep(marker.childNodes), function(node) { + if (node.nodeType == 3) { + node.nodeValue = node.nodeValue.replace(/\uFEFF/g, ''); + } + }); + + // Remove marker but keep children if for example contents where inserted into the marker + // Also remove duplicated instances of the marker for example by a + // split operation or by WebKit auto split on paste feature + while ((marker = dom.get(bookmark.id + '_' + suffix))) { + dom.remove(marker, 1); + } + + // If siblings are text nodes then merge them unless it's Opera since it some how removes the node + // and we are sniffing since adding a lot of detection code for a browser with 3% of the market + // isn't worth the effort. Sorry, Opera but it's just a fact + if (prev && next && prev.nodeType == next.nodeType && prev.nodeType == 3 && !Env.opera) { + idx = prev.nodeValue.length; + prev.appendData(next.nodeValue); + dom.remove(next); + + if (suffix == 'start') { + startContainer = endContainer = prev; + startOffset = endOffset = idx; + } else { + endContainer = prev; + endOffset = idx; + } + } + } + } + } + + function addBogus(node) { + // Adds a bogus BR element for empty block elements + if (dom.isBlock(node) && !node.innerHTML && !Env.ie) { + node.innerHTML = '
'; + } + + return node; + } + + if (bookmark) { + if (bookmark.start) { + rng = dom.createRng(); + root = dom.getRoot(); + + if (selection.tridentSel) { + return selection.tridentSel.moveToBookmark(bookmark); + } + + if (setEndPoint(true) && setEndPoint()) { + selection.setRng(rng); + } + } else if (bookmark.id) { + // Restore start/end points + restoreEndPoint('start'); + restoreEndPoint('end'); + + if (startContainer) { + rng = dom.createRng(); + rng.setStart(addBogus(startContainer), startOffset); + rng.setEnd(addBogus(endContainer), endOffset); + selection.setRng(rng); + } + } else if (bookmark.name) { + selection.select(dom.select(bookmark.name)[bookmark.index]); + } else if (bookmark.rng) { + selection.setRng(bookmark.rng); + } + } + }; + } + + /** + * Returns true/false if the specified node is a bookmark node or not. + * + * @static + * @method isBookmarkNode + * @param {DOMNode} node DOM Node to check if it's a bookmark node or not. + * @return {Boolean} true/false if the node is a bookmark node or not. + */ + BookmarkManager.isBookmarkNode = function(node) { + return node && node.tagName === 'SPAN' && node.getAttribute('data-mce-type') === 'bookmark'; + }; + + return BookmarkManager; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/ControlSelection.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/ControlSelection.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,593 @@ +/** + * ControlSelection.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles control selection of elements. Controls are elements + * that can be resized and needs to be selected as a whole. It adds custom resize handles + * to all browser engines that support properly disabling the built in resize logic. + * + * @class tinymce.dom.ControlSelection + */ +define("tinymce/dom/ControlSelection", [ + "tinymce/util/VK", + "tinymce/util/Tools", + "tinymce/Env" +], function(VK, Tools, Env) { + return function(selection, editor) { + var dom = editor.dom, each = Tools.each; + var selectedElm, selectedElmGhost, resizeHelper, resizeHandles, selectedHandle, lastMouseDownEvent; + var startX, startY, selectedElmX, selectedElmY, startW, startH, ratio, resizeStarted; + var width, height, editableDoc = editor.getDoc(), rootDocument = document, isIE = Env.ie && Env.ie < 11; + var abs = Math.abs, round = Math.round, rootElement = editor.getBody(), startScrollWidth, startScrollHeight; + + // Details about each resize handle how to scale etc + resizeHandles = { + // Name: x multiplier, y multiplier, delta size x, delta size y + n: [0.5, 0, 0, -1], + e: [1, 0.5, 1, 0], + s: [0.5, 1, 0, 1], + w: [0, 0.5, -1, 0], + nw: [0, 0, -1, -1], + ne: [1, 0, 1, -1], + se: [1, 1, 1, 1], + sw: [0, 1, -1, 1] + }; + + // Add CSS for resize handles, cloned element and selected + var rootClass = '.mce-content-body'; + editor.contentStyles.push( + rootClass + ' div.mce-resizehandle {' + + 'position: absolute;' + + 'border: 1px solid black;' + + 'background: #FFF;' + + 'width: 5px;' + + 'height: 5px;' + + 'z-index: 10000' + + '}' + + rootClass + ' .mce-resizehandle:hover {' + + 'background: #000' + + '}' + + rootClass + ' img[data-mce-selected], hr[data-mce-selected] {' + + 'outline: 1px solid black;' + + 'resize: none' + // Have been talks about implementing this in browsers + '}' + + rootClass + ' .mce-clonedresizable {' + + 'position: absolute;' + + (Env.gecko ? '' : 'outline: 1px dashed black;') + // Gecko produces trails while resizing + 'opacity: .5;' + + 'filter: alpha(opacity=50);' + + 'z-index: 10000' + + '}' + + rootClass + ' .mce-resize-helper {' + + 'background: #555;' + + 'background: rgba(0,0,0,0.75);' + + 'border-radius: 3px;' + + 'border: 1px;' + + 'color: white;' + + 'display: none;' + + 'font-family: sans-serif;' + + 'font-size: 12px;' + + 'white-space: nowrap;' + + 'line-height: 14px;' + + 'margin: 5px 10px;' + + 'padding: 5px;' + + 'position: absolute;' + + 'z-index: 10001' + + '}' + ); + + function isResizable(elm) { + var selector = editor.settings.object_resizing; + + if (selector === false || Env.iOS) { + return false; + } + + if (typeof selector != 'string') { + selector = 'table,img,div'; + } + + if (elm.getAttribute('data-mce-resize') === 'false') { + return false; + } + + return editor.dom.is(elm, selector); + } + + function resizeGhostElement(e) { + var deltaX, deltaY, proportional; + var resizeHelperX, resizeHelperY; + + // Calc new width/height + deltaX = e.screenX - startX; + deltaY = e.screenY - startY; + + // Calc new size + width = deltaX * selectedHandle[2] + startW; + height = deltaY * selectedHandle[3] + startH; + + // Never scale down lower than 5 pixels + width = width < 5 ? 5 : width; + height = height < 5 ? 5 : height; + + if (selectedElm.nodeName == "IMG" && editor.settings.resize_img_proportional !== false) { + proportional = !VK.modifierPressed(e); + } else { + proportional = VK.modifierPressed(e) || (selectedElm.nodeName == "IMG" && selectedHandle[2] * selectedHandle[3] !== 0); + } + + // Constrain proportions + if (proportional) { + if (abs(deltaX) > abs(deltaY)) { + height = round(width * ratio); + width = round(height / ratio); + } else { + width = round(height / ratio); + height = round(width * ratio); + } + } + + // Update ghost size + dom.setStyles(selectedElmGhost, { + width: width, + height: height + }); + + // Update resize helper position + resizeHelperX = selectedHandle.startPos.x + deltaX; + resizeHelperY = selectedHandle.startPos.y + deltaY; + resizeHelperX = resizeHelperX > 0 ? resizeHelperX : 0; + resizeHelperY = resizeHelperY > 0 ? resizeHelperY : 0; + + dom.setStyles(resizeHelper, { + left: resizeHelperX, + top: resizeHelperY, + display: 'block' + }); + + resizeHelper.innerHTML = width + ' × ' + height; + + // Update ghost X position if needed + if (selectedHandle[2] < 0 && selectedElmGhost.clientWidth <= width) { + dom.setStyle(selectedElmGhost, 'left', selectedElmX + (startW - width)); + } + + // Update ghost Y position if needed + if (selectedHandle[3] < 0 && selectedElmGhost.clientHeight <= height) { + dom.setStyle(selectedElmGhost, 'top', selectedElmY + (startH - height)); + } + + // Calculate how must overflow we got + deltaX = rootElement.scrollWidth - startScrollWidth; + deltaY = rootElement.scrollHeight - startScrollHeight; + + // Re-position the resize helper based on the overflow + if (deltaX + deltaY !== 0) { + dom.setStyles(resizeHelper, { + left: resizeHelperX - deltaX, + top: resizeHelperY - deltaY + }); + } + + if (!resizeStarted) { + editor.fire('ObjectResizeStart', {target: selectedElm, width: startW, height: startH}); + resizeStarted = true; + } + } + + function endGhostResize() { + resizeStarted = false; + + function setSizeProp(name, value) { + if (value) { + // Resize by using style or attribute + if (selectedElm.style[name] || !editor.schema.isValid(selectedElm.nodeName.toLowerCase(), name)) { + dom.setStyle(selectedElm, name, value); + } else { + dom.setAttrib(selectedElm, name, value); + } + } + } + + // Set width/height properties + setSizeProp('width', width); + setSizeProp('height', height); + + dom.unbind(editableDoc, 'mousemove', resizeGhostElement); + dom.unbind(editableDoc, 'mouseup', endGhostResize); + + if (rootDocument != editableDoc) { + dom.unbind(rootDocument, 'mousemove', resizeGhostElement); + dom.unbind(rootDocument, 'mouseup', endGhostResize); + } + + // Remove ghost/helper and update resize handle positions + dom.remove(selectedElmGhost); + dom.remove(resizeHelper); + + if (!isIE || selectedElm.nodeName == "TABLE") { + showResizeRect(selectedElm); + } + + editor.fire('ObjectResized', {target: selectedElm, width: width, height: height}); + dom.setAttrib(selectedElm, 'style', dom.getAttrib(selectedElm, 'style')); + editor.nodeChanged(); + } + + function showResizeRect(targetElm, mouseDownHandleName, mouseDownEvent) { + var position, targetWidth, targetHeight, e, rect; + + unbindResizeHandleEvents(); + + // Get position and size of target + position = dom.getPos(targetElm, rootElement); + selectedElmX = position.x; + selectedElmY = position.y; + rect = targetElm.getBoundingClientRect(); // Fix for Gecko offsetHeight for table with caption + targetWidth = rect.width || (rect.right - rect.left); + targetHeight = rect.height || (rect.bottom - rect.top); + + // Reset width/height if user selects a new image/table + if (selectedElm != targetElm) { + detachResizeStartListener(); + selectedElm = targetElm; + width = height = 0; + } + + // Makes it possible to disable resizing + e = editor.fire('ObjectSelected', {target: targetElm}); + + if (isResizable(targetElm) && !e.isDefaultPrevented()) { + each(resizeHandles, function(handle, name) { + var handleElm, handlerContainerElm; + + function startDrag(e) { + startX = e.screenX; + startY = e.screenY; + startW = selectedElm.clientWidth; + startH = selectedElm.clientHeight; + ratio = startH / startW; + selectedHandle = handle; + + handle.startPos = { + x: targetWidth * handle[0] + selectedElmX, + y: targetHeight * handle[1] + selectedElmY + }; + + startScrollWidth = rootElement.scrollWidth; + startScrollHeight = rootElement.scrollHeight; + + selectedElmGhost = selectedElm.cloneNode(true); + dom.addClass(selectedElmGhost, 'mce-clonedresizable'); + dom.setAttrib(selectedElmGhost, 'data-mce-bogus', 'all'); + selectedElmGhost.contentEditable = false; // Hides IE move layer cursor + selectedElmGhost.unSelectabe = true; + dom.setStyles(selectedElmGhost, { + left: selectedElmX, + top: selectedElmY, + margin: 0 + }); + + selectedElmGhost.removeAttribute('data-mce-selected'); + rootElement.appendChild(selectedElmGhost); + + dom.bind(editableDoc, 'mousemove', resizeGhostElement); + dom.bind(editableDoc, 'mouseup', endGhostResize); + + if (rootDocument != editableDoc) { + dom.bind(rootDocument, 'mousemove', resizeGhostElement); + dom.bind(rootDocument, 'mouseup', endGhostResize); + } + + resizeHelper = dom.add(rootElement, 'div', { + 'class': 'mce-resize-helper', + 'data-mce-bogus': 'all' + }, startW + ' × ' + startH); + } + + if (mouseDownHandleName) { + // Drag started by IE native resizestart + if (name == mouseDownHandleName) { + startDrag(mouseDownEvent); + } + + return; + } + + // Get existing or render resize handle + handleElm = dom.get('mceResizeHandle' + name); + if (!handleElm) { + handlerContainerElm = rootElement; + + handleElm = dom.add(handlerContainerElm, 'div', { + id: 'mceResizeHandle' + name, + 'data-mce-bogus': 'all', + 'class': 'mce-resizehandle', + unselectable: true, + style: 'cursor:' + name + '-resize; margin:0; padding:0' + }); + + // Hides IE move layer cursor + // If we set it on Chrome we get this wounderful bug: #6725 + if (Env.ie) { + handleElm.contentEditable = false; + } + } else { + dom.show(handleElm); + } + + if (!handle.elm) { + dom.bind(handleElm, 'mousedown', function(e) { + e.stopImmediatePropagation(); + e.preventDefault(); + startDrag(e); + }); + + handle.elm = handleElm; + } + + // Position element + dom.setStyles(handleElm, { + left: (targetWidth * handle[0] + selectedElmX) - (handleElm.offsetWidth / 2), + top: (targetHeight * handle[1] + selectedElmY) - (handleElm.offsetHeight / 2) + }); + }); + } else { + hideResizeRect(); + } + + selectedElm.setAttribute('data-mce-selected', '1'); + } + + function hideResizeRect() { + var name, handleElm; + + unbindResizeHandleEvents(); + + if (selectedElm) { + selectedElm.removeAttribute('data-mce-selected'); + } + + for (name in resizeHandles) { + handleElm = dom.get('mceResizeHandle' + name); + if (handleElm) { + dom.unbind(handleElm); + dom.remove(handleElm); + } + } + } + + function updateResizeRect(e) { + var startElm, controlElm; + + function isChildOrEqual(node, parent) { + if (node) { + do { + if (node === parent) { + return true; + } + } while ((node = node.parentNode)); + } + } + + // Ignore all events while resizing + if (resizeStarted) { + return; + } + + // Remove data-mce-selected from all elements since they might have been copied using Ctrl+c/v + each(dom.select('img[data-mce-selected],hr[data-mce-selected]'), function(img) { + img.removeAttribute('data-mce-selected'); + }); + + controlElm = e.type == 'mousedown' ? e.target : selection.getNode(); + controlElm = dom.$(controlElm).closest(isIE ? 'table' : 'table,img,hr')[0]; + + if (isChildOrEqual(controlElm, rootElement)) { + disableGeckoResize(); + startElm = selection.getStart(true); + + if (isChildOrEqual(startElm, controlElm) && isChildOrEqual(selection.getEnd(true), controlElm)) { + if (!isIE || (controlElm != startElm && startElm.nodeName !== 'IMG')) { + showResizeRect(controlElm); + return; + } + } + } + + hideResizeRect(); + } + + function attachEvent(elm, name, func) { + if (elm && elm.attachEvent) { + elm.attachEvent('on' + name, func); + } + } + + function detachEvent(elm, name, func) { + if (elm && elm.detachEvent) { + elm.detachEvent('on' + name, func); + } + } + + function resizeNativeStart(e) { + var target = e.srcElement, pos, name, corner, cornerX, cornerY, relativeX, relativeY; + + pos = target.getBoundingClientRect(); + relativeX = lastMouseDownEvent.clientX - pos.left; + relativeY = lastMouseDownEvent.clientY - pos.top; + + // Figure out what corner we are draging on + for (name in resizeHandles) { + corner = resizeHandles[name]; + + cornerX = target.offsetWidth * corner[0]; + cornerY = target.offsetHeight * corner[1]; + + if (abs(cornerX - relativeX) < 8 && abs(cornerY - relativeY) < 8) { + selectedHandle = corner; + break; + } + } + + // Remove native selection and let the magic begin + resizeStarted = true; + editor.fire('ObjectResizeStart', { + target: selectedElm, + width: selectedElm.clientWidth, + height: selectedElm.clientHeight + }); + editor.getDoc().selection.empty(); + showResizeRect(target, name, lastMouseDownEvent); + } + + function nativeControlSelect(e) { + var target = e.srcElement; + + if (target != selectedElm) { + editor.fire('ObjectSelected', {target: target}); + detachResizeStartListener(); + + if (target.id.indexOf('mceResizeHandle') === 0) { + e.returnValue = false; + return; + } + + if (target.nodeName == 'IMG' || target.nodeName == 'TABLE') { + hideResizeRect(); + selectedElm = target; + attachEvent(target, 'resizestart', resizeNativeStart); + } + } + } + + function detachResizeStartListener() { + detachEvent(selectedElm, 'resizestart', resizeNativeStart); + } + + function unbindResizeHandleEvents() { + for (var name in resizeHandles) { + var handle = resizeHandles[name]; + + if (handle.elm) { + dom.unbind(handle.elm); + delete handle.elm; + } + } + } + + function disableGeckoResize() { + try { + // Disable object resizing on Gecko + editor.getDoc().execCommand('enableObjectResizing', false, false); + } catch (ex) { + // Ignore + } + } + + function controlSelect(elm) { + var ctrlRng; + + if (!isIE) { + return; + } + + ctrlRng = editableDoc.body.createControlRange(); + + try { + ctrlRng.addElement(elm); + ctrlRng.select(); + return true; + } catch (ex) { + // Ignore since the element can't be control selected for example a P tag + } + } + + editor.on('init', function() { + if (isIE) { + // Hide the resize rect on resize and reselect the image + editor.on('ObjectResized', function(e) { + if (e.target.nodeName != 'TABLE') { + hideResizeRect(); + controlSelect(e.target); + } + }); + + attachEvent(rootElement, 'controlselect', nativeControlSelect); + + editor.on('mousedown', function(e) { + lastMouseDownEvent = e; + }); + } else { + disableGeckoResize(); + + if (Env.ie >= 11) { + // TODO: Drag/drop doesn't work + editor.on('mouseup', function(e) { + var nodeName = e.target.nodeName; + + if (!resizeStarted && /^(TABLE|IMG|HR)$/.test(nodeName)) { + editor.selection.select(e.target, nodeName == 'TABLE'); + editor.nodeChanged(); + } + }); + + editor.dom.bind(rootElement, 'mscontrolselect', function(e) { + if (/^(TABLE|IMG|HR)$/.test(e.target.nodeName)) { + e.preventDefault(); + + // This moves the selection from being a control selection to a text like selection like in WebKit #6753 + // TODO: Fix this the day IE works like other browsers without this nasty native ugly control selections. + if (e.target.tagName == 'IMG') { + window.setTimeout(function() { + editor.selection.select(e.target); + }, 0); + } + } + }); + } + } + + editor.on('nodechange ResizeEditor', updateResizeRect); + + // Update resize rect while typing in a table + editor.on('keydown keyup', function(e) { + if (selectedElm && selectedElm.nodeName == "TABLE") { + updateResizeRect(e); + } + }); + + editor.on('hide', hideResizeRect); + + // Hide rect on focusout since it would float on top of windows otherwise + //editor.on('focusout', hideResizeRect); + }); + + editor.on('remove', unbindResizeHandleEvents); + + function destroy() { + selectedElm = selectedElmGhost = null; + + if (isIE) { + detachResizeStartListener(); + detachEvent(rootElement, 'controlselect', nativeControlSelect); + } + } + + return { + isResizable: isResizable, + showResizeRect: showResizeRect, + hideResizeRect: hideResizeRect, + updateResizeRect: updateResizeRect, + controlSelect: controlSelect, + destroy: destroy + }; + }; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/DOMUtils.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/DOMUtils.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1835 @@ +/** + * DOMUtils.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Utility class for various DOM manipulation and retrieval functions. + * + * @class tinymce.dom.DOMUtils + * @example + * // Add a class to an element by id in the page + * tinymce.DOM.addClass('someid', 'someclass'); + * + * // Add a class to an element by id inside the editor + * tinymce.activeEditor.dom.addClass('someid', 'someclass'); + */ +define("tinymce/dom/DOMUtils", [ + "tinymce/dom/Sizzle", + "tinymce/dom/DomQuery", + "tinymce/html/Styles", + "tinymce/dom/EventUtils", + "tinymce/dom/TreeWalker", + "tinymce/dom/Range", + "tinymce/html/Entities", + "tinymce/Env", + "tinymce/util/Tools", + "tinymce/dom/StyleSheetLoader" +], function(Sizzle, $, Styles, EventUtils, TreeWalker, Range, Entities, Env, Tools, StyleSheetLoader) { + // Shorten names + var each = Tools.each, is = Tools.is, grep = Tools.grep, trim = Tools.trim; + var isIE = Env.ie; + var simpleSelectorRe = /^([a-z0-9],?)+$/i; + var whiteSpaceRegExp = /^[ \t\r\n]*$/; + + function setupAttrHooks(domUtils, settings) { + var attrHooks = {}, keepValues = settings.keep_values, keepUrlHook; + + keepUrlHook = { + set: function($elm, value, name) { + if (settings.url_converter) { + value = settings.url_converter.call(settings.url_converter_scope || domUtils, value, name, $elm[0]); + } + + $elm.attr('data-mce-' + name, value).attr(name, value); + }, + + get: function($elm, name) { + return $elm.attr('data-mce-' + name) || $elm.attr(name); + } + }; + + attrHooks = { + style: { + set: function($elm, value) { + if (value !== null && typeof value === 'object') { + $elm.css(value); + return; + } + + if (keepValues) { + $elm.attr('data-mce-style', value); + } + + $elm.attr('style', value); + }, + + get: function($elm) { + var value = $elm.attr('data-mce-style') || $elm.attr('style'); + + value = domUtils.serializeStyle(domUtils.parseStyle(value), $elm[0].nodeName); + + return value; + } + } + }; + + if (keepValues) { + attrHooks.href = attrHooks.src = keepUrlHook; + } + + return attrHooks; + } + + /** + * Constructs a new DOMUtils instance. Consult the Wiki for more details on settings etc for this class. + * + * @constructor + * @method DOMUtils + * @param {Document} d Document reference to bind the utility class to. + * @param {settings} s Optional settings collection. + */ + function DOMUtils(doc, settings) { + var self = this, blockElementsMap; + + self.doc = doc; + self.win = window; + self.files = {}; + self.counter = 0; + self.stdMode = !isIE || doc.documentMode >= 8; + self.boxModel = !isIE || doc.compatMode == "CSS1Compat" || self.stdMode; + self.styleSheetLoader = new StyleSheetLoader(doc); + self.boundEvents = []; + self.settings = settings = settings || {}; + self.schema = settings.schema; + self.styles = new Styles({ + url_converter: settings.url_converter, + url_converter_scope: settings.url_converter_scope + }, settings.schema); + + self.fixDoc(doc); + self.events = settings.ownEvents ? new EventUtils(settings.proxy) : EventUtils.Event; + self.attrHooks = setupAttrHooks(self, settings); + blockElementsMap = settings.schema ? settings.schema.getBlockElements() : {}; + self.$ = $.overrideDefaults(function() { + return { + context: doc, + element: self.getRoot() + }; + }); + + /** + * Returns true/false if the specified element is a block element or not. + * + * @method isBlock + * @param {Node/String} node Element/Node to check. + * @return {Boolean} True/False state if the node is a block element or not. + */ + self.isBlock = function(node) { + // Fix for #5446 + if (!node) { + return false; + } + + // This function is called in module pattern style since it might be executed with the wrong this scope + var type = node.nodeType; + + // If it's a node then check the type and use the nodeName + if (type) { + return !!(type === 1 && blockElementsMap[node.nodeName]); + } + + return !!blockElementsMap[node]; + }; + } + + DOMUtils.prototype = { + $$: function(elm) { + if (typeof elm == 'string') { + elm = this.get(elm); + } + + return this.$(elm); + }, + + root: null, + + fixDoc: function(doc) { + var settings = this.settings, name; + + if (isIE && settings.schema) { + // Add missing HTML 4/5 elements to IE + ('abbr article aside audio canvas ' + + 'details figcaption figure footer ' + + 'header hgroup mark menu meter nav ' + + 'output progress section summary ' + + 'time video').replace(/\w+/g, function(name) { + doc.createElement(name); + }); + + // Create all custom elements + for (name in settings.schema.getCustomElements()) { + doc.createElement(name); + } + } + }, + + clone: function(node, deep) { + var self = this, clone, doc; + + // TODO: Add feature detection here in the future + if (!isIE || node.nodeType !== 1 || deep) { + return node.cloneNode(deep); + } + + doc = self.doc; + + // Make a HTML5 safe shallow copy + if (!deep) { + clone = doc.createElement(node.nodeName); + + // Copy attribs + each(self.getAttribs(node), function(attr) { + self.setAttrib(clone, attr.nodeName, self.getAttrib(node, attr.nodeName)); + }); + + return clone; + } + + return clone.firstChild; + }, + + /** + * Returns the root node of the document. This is normally the body but might be a DIV. Parents like getParent will not + * go above the point of this root node. + * + * @method getRoot + * @return {Element} Root element for the utility class. + */ + getRoot: function() { + var self = this; + + return self.settings.root_element || self.doc.body; + }, + + /** + * Returns the viewport of the window. + * + * @method getViewPort + * @param {Window} win Optional window to get viewport of. + * @return {Object} Viewport object with fields x, y, w and h. + */ + getViewPort: function(win) { + var doc, rootElm; + + win = !win ? this.win : win; + doc = win.document; + rootElm = this.boxModel ? doc.documentElement : doc.body; + + // Returns viewport size excluding scrollbars + return { + x: win.pageXOffset || rootElm.scrollLeft, + y: win.pageYOffset || rootElm.scrollTop, + w: win.innerWidth || rootElm.clientWidth, + h: win.innerHeight || rootElm.clientHeight + }; + }, + + /** + * Returns the rectangle for a specific element. + * + * @method getRect + * @param {Element/String} elm Element object or element ID to get rectangle from. + * @return {object} Rectangle for specified element object with x, y, w, h fields. + */ + getRect: function(elm) { + var self = this, pos, size; + + elm = self.get(elm); + pos = self.getPos(elm); + size = self.getSize(elm); + + return { + x: pos.x, y: pos.y, + w: size.w, h: size.h + }; + }, + + /** + * Returns the size dimensions of the specified element. + * + * @method getSize + * @param {Element/String} elm Element object or element ID to get rectangle from. + * @return {object} Rectangle for specified element object with w, h fields. + */ + getSize: function(elm) { + var self = this, w, h; + + elm = self.get(elm); + w = self.getStyle(elm, 'width'); + h = self.getStyle(elm, 'height'); + + // Non pixel value, then force offset/clientWidth + if (w.indexOf('px') === -1) { + w = 0; + } + + // Non pixel value, then force offset/clientWidth + if (h.indexOf('px') === -1) { + h = 0; + } + + return { + w: parseInt(w, 10) || elm.offsetWidth || elm.clientWidth, + h: parseInt(h, 10) || elm.offsetHeight || elm.clientHeight + }; + }, + + /** + * Returns a node by the specified selector function. This function will + * loop through all parent nodes and call the specified function for each node. + * If the function then returns true indicating that it has found what it was looking for, the loop execution will then end + * and the node it found will be returned. + * + * @method getParent + * @param {Node/String} node DOM node to search parents on or ID string. + * @param {function} selector Selection function or CSS selector to execute on each node. + * @param {Node} root Optional root element, never go below this point. + * @return {Node} DOM Node or null if it wasn't found. + */ + getParent: function(node, selector, root) { + return this.getParents(node, selector, root, false); + }, + + /** + * Returns a node list of all parents matching the specified selector function or pattern. + * If the function then returns true indicating that it has found what it was looking for and that node will be collected. + * + * @method getParents + * @param {Node/String} node DOM node to search parents on or ID string. + * @param {function} selector Selection function to execute on each node or CSS pattern. + * @param {Node} root Optional root element, never go below this point. + * @return {Array} Array of nodes or null if it wasn't found. + */ + getParents: function(node, selector, root, collect) { + var self = this, selectorVal, result = []; + + node = self.get(node); + collect = collect === undefined; + + // Default root on inline mode + root = root || (self.getRoot().nodeName != 'BODY' ? self.getRoot().parentNode : null); + + // Wrap node name as func + if (is(selector, 'string')) { + selectorVal = selector; + + if (selector === '*') { + selector = function(node) { + return node.nodeType == 1; + }; + } else { + selector = function(node) { + return self.is(node, selectorVal); + }; + } + } + + while (node) { + if (node == root || !node.nodeType || node.nodeType === 9) { + break; + } + + if (!selector || selector(node)) { + if (collect) { + result.push(node); + } else { + return node; + } + } + + node = node.parentNode; + } + + return collect ? result : null; + }, + + /** + * Returns the specified element by ID or the input element if it isn't a string. + * + * @method get + * @param {String/Element} n Element id to look for or element to just pass though. + * @return {Element} Element matching the specified id or null if it wasn't found. + */ + get: function(elm) { + var name; + + if (elm && this.doc && typeof elm == 'string') { + name = elm; + elm = this.doc.getElementById(elm); + + // IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick + if (elm && elm.id !== name) { + return this.doc.getElementsByName(name)[1]; + } + } + + return elm; + }, + + /** + * Returns the next node that matches selector or function + * + * @method getNext + * @param {Node} node Node to find siblings from. + * @param {String/function} selector Selector CSS expression or function. + * @return {Node} Next node item matching the selector or null if it wasn't found. + */ + getNext: function(node, selector) { + return this._findSib(node, selector, 'nextSibling'); + }, + + /** + * Returns the previous node that matches selector or function + * + * @method getPrev + * @param {Node} node Node to find siblings from. + * @param {String/function} selector Selector CSS expression or function. + * @return {Node} Previous node item matching the selector or null if it wasn't found. + */ + getPrev: function(node, selector) { + return this._findSib(node, selector, 'previousSibling'); + }, + + // #ifndef jquery + + /** + * Selects specific elements by a CSS level 3 pattern. For example "div#a1 p.test". + * This function is optimized for the most common patterns needed in TinyMCE but it also performs well enough + * on more complex patterns. + * + * @method select + * @param {String} selector CSS level 3 pattern to select/find elements by. + * @param {Object} scope Optional root element/scope element to search in. + * @return {Array} Array with all matched elements. + * @example + * // Adds a class to all paragraphs in the currently active editor + * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'someclass'); + * + * // Adds a class to all spans that have the test class in the currently active editor + * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('span.test'), 'someclass') + */ + select: function(selector, scope) { + var self = this; + + /*eslint new-cap:0 */ + return Sizzle(selector, self.get(scope) || self.settings.root_element || self.doc, []); + }, + + /** + * Returns true/false if the specified element matches the specified css pattern. + * + * @method is + * @param {Node/NodeList} elm DOM node to match or an array of nodes to match. + * @param {String} selector CSS pattern to match the element against. + */ + is: function(elm, selector) { + var i; + + // If it isn't an array then try to do some simple selectors instead of Sizzle for to boost performance + if (elm.length === undefined) { + // Simple all selector + if (selector === '*') { + return elm.nodeType == 1; + } + + // Simple selector just elements + if (simpleSelectorRe.test(selector)) { + selector = selector.toLowerCase().split(/,/); + elm = elm.nodeName.toLowerCase(); + + for (i = selector.length - 1; i >= 0; i--) { + if (selector[i] == elm) { + return true; + } + } + + return false; + } + } + + // Is non element + if (elm.nodeType && elm.nodeType != 1) { + return false; + } + + var elms = elm.nodeType ? [elm] : elm; + + /*eslint new-cap:0 */ + return Sizzle(selector, elms[0].ownerDocument || elms[0], null, elms).length > 0; + }, + + // #endif + + /** + * Adds the specified element to another element or elements. + * + * @method add + * @param {String/Element/Array} parentElm Element id string, DOM node element or array of ids or elements to add to. + * @param {String/Element} name Name of new element to add or existing element to add. + * @param {Object} attrs Optional object collection with arguments to add to the new element(s). + * @param {String} html Optional inner HTML contents to add for each element. + * @return {Element/Array} Element that got created, or an array of created elements if multiple input elements + * were passed in. + * @example + * // Adds a new paragraph to the end of the active editor + * tinymce.activeEditor.dom.add(tinymce.activeEditor.getBody(), 'p', {title: 'my title'}, 'Some content'); + */ + add: function(parentElm, name, attrs, html, create) { + var self = this; + + return this.run(parentElm, function(parentElm) { + var newElm; + + newElm = is(name, 'string') ? self.doc.createElement(name) : name; + self.setAttribs(newElm, attrs); + + if (html) { + if (html.nodeType) { + newElm.appendChild(html); + } else { + self.setHTML(newElm, html); + } + } + + return !create ? parentElm.appendChild(newElm) : newElm; + }); + }, + + /** + * Creates a new element. + * + * @method create + * @param {String} name Name of new element. + * @param {Object} attrs Optional object name/value collection with element attributes. + * @param {String} html Optional HTML string to set as inner HTML of the element. + * @return {Element} HTML DOM node element that got created. + * @example + * // Adds an element where the caret/selection is in the active editor + * var el = tinymce.activeEditor.dom.create('div', {id: 'test', 'class': 'myclass'}, 'some content'); + * tinymce.activeEditor.selection.setNode(el); + */ + create: function(name, attrs, html) { + return this.add(this.doc.createElement(name), name, attrs, html, 1); + }, + + /** + * Creates HTML string for element. The element will be closed unless an empty inner HTML string is passed in. + * + * @method createHTML + * @param {String} name Name of new element. + * @param {Object} attrs Optional object name/value collection with element attributes. + * @param {String} html Optional HTML string to set as inner HTML of the element. + * @return {String} String with new HTML element, for example:
test. + * @example + * // Creates a html chunk and inserts it at the current selection/caret location + * tinymce.activeEditor.selection.setContent(tinymce.activeEditor.dom.createHTML('a', {href: 'test.html'}, 'some line')); + */ + createHTML: function(name, attrs, html) { + var outHtml = '', key; + + outHtml += '<' + name; + + for (key in attrs) { + if (attrs.hasOwnProperty(key) && attrs[key] !== null && typeof attrs[key] != 'undefined') { + outHtml += ' ' + key + '="' + this.encode(attrs[key]) + '"'; + } + } + + // A call to tinymce.is doesn't work for some odd reason on IE9 possible bug inside their JS runtime + if (typeof html != "undefined") { + return outHtml + '>' + html + ''; + } + + return outHtml + ' />'; + }, + + /** + * Creates a document fragment out of the specified HTML string. + * + * @method createFragment + * @param {String} html Html string to create fragment from. + * @return {DocumentFragment} Document fragment node. + */ + createFragment: function(html) { + var frag, node, doc = this.doc, container; + + container = doc.createElement("div"); + frag = doc.createDocumentFragment(); + + if (html) { + container.innerHTML = html; + } + + while ((node = container.firstChild)) { + frag.appendChild(node); + } + + return frag; + }, + + /** + * Removes/deletes the specified element(s) from the DOM. + * + * @method remove + * @param {String/Element/Array} node ID of element or DOM element object or array containing multiple elements/ids. + * @param {Boolean} keepChildren Optional state to keep children or not. If set to true all children will be + * placed at the location of the removed element. + * @return {Element/Array} HTML DOM element that got removed, or an array of removed elements if multiple input elements + * were passed in. + * @example + * // Removes all paragraphs in the active editor + * tinymce.activeEditor.dom.remove(tinymce.activeEditor.dom.select('p')); + * + * // Removes an element by id in the document + * tinymce.DOM.remove('mydiv'); + */ + remove: function(node, keepChildren) { + node = this.$$(node); + + if (keepChildren) { + node.each(function() { + var child; + + while ((child = this.firstChild)) { + if (child.nodeType == 3 && child.data.length === 0) { + this.removeChild(child); + } else { + this.parentNode.insertBefore(child, this); + } + } + }).remove(); + } else { + node.remove(); + } + + return node.length > 1 ? node.toArray() : node[0]; + }, + + /** + * Sets the CSS style value on a HTML element. The name can be a camelcase string + * or the CSS style name like background-color. + * + * @method setStyle + * @param {String/Element/Array} n HTML element/Element ID or Array of elements/ids to set CSS style value on. + * @param {String} na Name of the style value to set. + * @param {String} v Value to set on the style. + * @example + * // Sets a style value on all paragraphs in the currently active editor + * tinymce.activeEditor.dom.setStyle(tinymce.activeEditor.dom.select('p'), 'background-color', 'red'); + * + * // Sets a style value to an element by id in the current document + * tinymce.DOM.setStyle('mydiv', 'background-color', 'red'); + */ + setStyle: function(elm, name, value) { + elm = this.$$(elm).css(name, value); + + if (this.settings.update_styles) { + elm.attr('data-mce-style', null); + } + }, + + /** + * Returns the current style or runtime/computed value of an element. + * + * @method getStyle + * @param {String/Element} elm HTML element or element id string to get style from. + * @param {String} name Style name to return. + * @param {Boolean} computed Computed style. + * @return {String} Current style or computed style value of an element. + */ + getStyle: function(elm, name, computed) { + elm = this.$$(elm); + + if (computed) { + return elm.css(name); + } + + // Camelcase it, if needed + name = name.replace(/-(\D)/g, function(a, b) { + return b.toUpperCase(); + }); + + if (name == 'float') { + name = isIE ? 'styleFloat' : 'cssFloat'; + } + + return elm[0] && elm[0].style ? elm[0].style[name] : undefined; + }, + + /** + * Sets multiple styles on the specified element(s). + * + * @method setStyles + * @param {Element/String/Array} e DOM element, element id string or array of elements/ids to set styles on. + * @param {Object} o Name/Value collection of style items to add to the element(s). + * @example + * // Sets styles on all paragraphs in the currently active editor + * tinymce.activeEditor.dom.setStyles(tinymce.activeEditor.dom.select('p'), {'background-color': 'red', 'color': 'green'}); + * + * // Sets styles to an element by id in the current document + * tinymce.DOM.setStyles('mydiv', {'background-color': 'red', 'color': 'green'}); + */ + setStyles: function(elm, styles) { + elm = this.$$(elm).css(styles); + + if (this.settings.update_styles) { + elm.attr('data-mce-style', null); + } + }, + + /** + * Removes all attributes from an element or elements. + * + * @method removeAllAttribs + * @param {Element/String/Array} e DOM element, element id string or array of elements/ids to remove attributes from. + */ + removeAllAttribs: function(e) { + return this.run(e, function(e) { + var i, attrs = e.attributes; + for (i = attrs.length - 1; i >= 0; i--) { + e.removeAttributeNode(attrs.item(i)); + } + }); + }, + + /** + * Sets the specified attribute of an element or elements. + * + * @method setAttrib + * @param {Element/String/Array} e DOM element, element id string or array of elements/ids to set attribute on. + * @param {String} n Name of attribute to set. + * @param {String} v Value to set on the attribute - if this value is falsy like null, 0 or '' it will remove the attribute instead. + * @example + * // Sets class attribute on all paragraphs in the active editor + * tinymce.activeEditor.dom.setAttrib(tinymce.activeEditor.dom.select('p'), 'class', 'myclass'); + * + * // Sets class attribute on a specific element in the current page + * tinymce.dom.setAttrib('mydiv', 'class', 'myclass'); + */ + setAttrib: function(elm, name, value) { + var self = this, originalValue, hook, settings = self.settings; + + if (value === '') { + value = null; + } + + elm = self.$$(elm); + originalValue = elm.attr(name); + + if (!elm.length) { + return; + } + + hook = self.attrHooks[name]; + if (hook && hook.set) { + hook.set(elm, value, name); + } else { + elm.attr(name, value); + } + + if (originalValue != value && settings.onSetAttrib) { + settings.onSetAttrib({ + attrElm: elm, + attrName: name, + attrValue: value + }); + } + }, + + /** + * Sets two or more specified attributes of an element or elements. + * + * @method setAttribs + * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set attributes on. + * @param {Object} attrs Name/Value collection of attribute items to add to the element(s). + * @example + * // Sets class and title attributes on all paragraphs in the active editor + * tinymce.activeEditor.dom.setAttribs(tinymce.activeEditor.dom.select('p'), {'class': 'myclass', title: 'some title'}); + * + * // Sets class and title attributes on a specific element in the current page + * tinymce.DOM.setAttribs('mydiv', {'class': 'myclass', title: 'some title'}); + */ + setAttribs: function(elm, attrs) { + var self = this; + + self.$$(elm).each(function(i, node) { + each(attrs, function(value, name) { + self.setAttrib(node, name, value); + }); + }); + }, + + /** + * Returns the specified attribute by name. + * + * @method getAttrib + * @param {String/Element} elm Element string id or DOM element to get attribute from. + * @param {String} name Name of attribute to get. + * @param {String} defaultVal Optional default value to return if the attribute didn't exist. + * @return {String} Attribute value string, default value or null if the attribute wasn't found. + */ + getAttrib: function(elm, name, defaultVal) { + var self = this, hook, value; + + elm = self.$$(elm); + + if (elm.length) { + hook = self.attrHooks[name]; + + if (hook && hook.get) { + value = hook.get(elm, name); + } else { + value = elm.attr(name); + } + } + + if (typeof value == 'undefined') { + value = defaultVal || ''; + } + + return value; + }, + + /** + * Returns the absolute x, y position of a node. The position will be returned in an object with x, y fields. + * + * @method getPos + * @param {Element/String} elm HTML element or element id to get x, y position from. + * @param {Element} rootElm Optional root element to stop calculations at. + * @return {object} Absolute position of the specified element object with x, y fields. + */ + getPos: function(elm, rootElm) { + var self = this, x = 0, y = 0, offsetParent, doc = self.doc, body = doc.body, pos; + + elm = self.get(elm); + rootElm = rootElm || body; + + if (elm) { + // Use getBoundingClientRect if it exists since it's faster than looping offset nodes + // Fallback to offsetParent calculations if the body isn't static better since it stops at the body root + if (rootElm === body && elm.getBoundingClientRect && $(body).css('position') === 'static') { + pos = elm.getBoundingClientRect(); + rootElm = self.boxModel ? doc.documentElement : body; + + // Add scroll offsets from documentElement or body since IE with the wrong box model will use d.body and so do WebKit + // Also remove the body/documentelement clientTop/clientLeft on IE 6, 7 since they offset the position + x = pos.left + (doc.documentElement.scrollLeft || body.scrollLeft) - rootElm.clientLeft; + y = pos.top + (doc.documentElement.scrollTop || body.scrollTop) - rootElm.clientTop; + + return {x: x, y: y}; + } + + offsetParent = elm; + while (offsetParent && offsetParent != rootElm && offsetParent.nodeType) { + x += offsetParent.offsetLeft || 0; + y += offsetParent.offsetTop || 0; + offsetParent = offsetParent.offsetParent; + } + + offsetParent = elm.parentNode; + while (offsetParent && offsetParent != rootElm && offsetParent.nodeType) { + x -= offsetParent.scrollLeft || 0; + y -= offsetParent.scrollTop || 0; + offsetParent = offsetParent.parentNode; + } + } + + return {x: x, y: y}; + }, + + /** + * Parses the specified style value into an object collection. This parser will also + * merge and remove any redundant items that browsers might have added. It will also convert non-hex + * colors to hex values. Urls inside the styles will also be converted to absolute/relative based on settings. + * + * @method parseStyle + * @param {String} cssText Style value to parse, for example: border:1px solid red;. + * @return {Object} Object representation of that style, for example: {border: '1px solid red'} + */ + parseStyle: function(cssText) { + return this.styles.parse(cssText); + }, + + /** + * Serializes the specified style object into a string. + * + * @method serializeStyle + * @param {Object} styles Object to serialize as string, for example: {border: '1px solid red'} + * @param {String} name Optional element name. + * @return {String} String representation of the style object, for example: border: 1px solid red. + */ + serializeStyle: function(styles, name) { + return this.styles.serialize(styles, name); + }, + + /** + * Adds a style element at the top of the document with the specified cssText content. + * + * @method addStyle + * @param {String} cssText CSS Text style to add to top of head of document. + */ + addStyle: function(cssText) { + var self = this, doc = self.doc, head, styleElm; + + // Prevent inline from loading the same styles twice + if (self !== DOMUtils.DOM && doc === document) { + var addedStyles = DOMUtils.DOM.addedStyles; + + addedStyles = addedStyles || []; + if (addedStyles[cssText]) { + return; + } + + addedStyles[cssText] = true; + DOMUtils.DOM.addedStyles = addedStyles; + } + + // Create style element if needed + styleElm = doc.getElementById('mceDefaultStyles'); + if (!styleElm) { + styleElm = doc.createElement('style'); + styleElm.id = 'mceDefaultStyles'; + styleElm.type = 'text/css'; + + head = doc.getElementsByTagName('head')[0]; + if (head.firstChild) { + head.insertBefore(styleElm, head.firstChild); + } else { + head.appendChild(styleElm); + } + } + + // Append style data to old or new style element + if (styleElm.styleSheet) { + styleElm.styleSheet.cssText += cssText; + } else { + styleElm.appendChild(doc.createTextNode(cssText)); + } + }, + + /** + * Imports/loads the specified CSS file into the document bound to the class. + * + * @method loadCSS + * @param {String} u URL to CSS file to load. + * @example + * // Loads a CSS file dynamically into the current document + * tinymce.DOM.loadCSS('somepath/some.css'); + * + * // Loads a CSS file into the currently active editor instance + * tinymce.activeEditor.dom.loadCSS('somepath/some.css'); + * + * // Loads a CSS file into an editor instance by id + * tinymce.get('someid').dom.loadCSS('somepath/some.css'); + * + * // Loads multiple CSS files into the current document + * tinymce.DOM.loadCSS('somepath/some.css,somepath/someother.css'); + */ + loadCSS: function(url) { + var self = this, doc = self.doc, head; + + // Prevent inline from loading the same CSS file twice + if (self !== DOMUtils.DOM && doc === document) { + DOMUtils.DOM.loadCSS(url); + return; + } + + if (!url) { + url = ''; + } + + head = doc.getElementsByTagName('head')[0]; + + each(url.split(','), function(url) { + var link; + + url = Tools._addCacheSuffix(url); + + if (self.files[url]) { + return; + } + + self.files[url] = true; + link = self.create('link', {rel: 'stylesheet', href: url}); + + // IE 8 has a bug where dynamically loading stylesheets would produce a 1 item remaining bug + // This fix seems to resolve that issue by recalcing the document once a stylesheet finishes loading + // It's ugly but it seems to work fine. + if (isIE && doc.documentMode && doc.recalc) { + link.onload = function() { + if (doc.recalc) { + doc.recalc(); + } + + link.onload = null; + }; + } + + head.appendChild(link); + }); + }, + + /** + * Adds a class to the specified element or elements. + * + * @method addClass + * @param {String/Element/Array} elm Element ID string or DOM element or array with elements or IDs. + * @param {String} cls Class name to add to each element. + * @return {String/Array} String with new class value or array with new class values for all elements. + * @example + * // Adds a class to all paragraphs in the active editor + * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'myclass'); + * + * // Adds a class to a specific element in the current page + * tinymce.DOM.addClass('mydiv', 'myclass'); + */ + addClass: function(elm, cls) { + this.$$(elm).addClass(cls); + }, + + /** + * Removes a class from the specified element or elements. + * + * @method removeClass + * @param {String/Element/Array} elm Element ID string or DOM element or array with elements or IDs. + * @param {String} cls Class name to remove from each element. + * @return {String/Array} String of remaining class name(s), or an array of strings if multiple input elements + * were passed in. + * @example + * // Removes a class from all paragraphs in the active editor + * tinymce.activeEditor.dom.removeClass(tinymce.activeEditor.dom.select('p'), 'myclass'); + * + * // Removes a class from a specific element in the current page + * tinymce.DOM.removeClass('mydiv', 'myclass'); + */ + removeClass: function(elm, cls) { + this.toggleClass(elm, cls, false); + }, + + /** + * Returns true if the specified element has the specified class. + * + * @method hasClass + * @param {String/Element} n HTML element or element id string to check CSS class on. + * @param {String} c CSS class to check for. + * @return {Boolean} true/false if the specified element has the specified class. + */ + hasClass: function(elm, cls) { + return this.$$(elm).hasClass(cls); + }, + + /** + * Toggles the specified class on/off. + * + * @method toggleClass + * @param {Element} elm Element to toggle class on. + * @param {[type]} cls Class to toggle on/off. + * @param {[type]} state Optional state to set. + */ + toggleClass: function(elm, cls, state) { + this.$$(elm).toggleClass(cls, state).each(function() { + if (this.className === '') { + $(this).attr('class', null); + } + }); + }, + + /** + * Shows the specified element(s) by ID by setting the "display" style. + * + * @method show + * @param {String/Element/Array} elm ID of DOM element or DOM element or array with elements or IDs to show. + */ + show: function(elm) { + this.$$(elm).show(); + }, + + /** + * Hides the specified element(s) by ID by setting the "display" style. + * + * @method hide + * @param {String/Element/Array} e ID of DOM element or DOM element or array with elements or IDs to hide. + * @example + * // Hides an element by id in the document + * tinymce.DOM.hide('myid'); + */ + hide: function(elm) { + this.$$(elm).hide(); + }, + + /** + * Returns true/false if the element is hidden or not by checking the "display" style. + * + * @method isHidden + * @param {String/Element} e Id or element to check display state on. + * @return {Boolean} true/false if the element is hidden or not. + */ + isHidden: function(elm) { + return this.$$(elm).css('display') == 'none'; + }, + + /** + * Returns a unique id. This can be useful when generating elements on the fly. + * This method will not check if the element already exists. + * + * @method uniqueId + * @param {String} prefix Optional prefix to add in front of all ids - defaults to "mce_". + * @return {String} Unique id. + */ + uniqueId: function(prefix) { + return (!prefix ? 'mce_' : prefix) + (this.counter++); + }, + + /** + * Sets the specified HTML content inside the element or elements. The HTML will first be processed. This means + * URLs will get converted, hex color values fixed etc. Check processHTML for details. + * + * @method setHTML + * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set HTML inside of. + * @param {String} h HTML content to set as inner HTML of the element. + * @example + * // Sets the inner HTML of all paragraphs in the active editor + * tinymce.activeEditor.dom.setHTML(tinymce.activeEditor.dom.select('p'), 'some inner html'); + * + * // Sets the inner HTML of an element by id in the document + * tinymce.DOM.setHTML('mydiv', 'some inner html'); + */ + setHTML: function(elm, html) { + elm = this.$$(elm); + + if (isIE) { + elm.each(function(i, target) { + if (target.canHaveHTML === false) { + return; + } + + // Remove all child nodes, IE keeps empty text nodes in DOM + while (target.firstChild) { + target.removeChild(target.firstChild); + } + + try { + // IE will remove comments from the beginning + // unless you padd the contents with something + target.innerHTML = '
' + html; + target.removeChild(target.firstChild); + } catch (ex) { + // IE sometimes produces an unknown runtime error on innerHTML if it's a div inside a p + $('
').html('
' + html).contents().slice(1).appendTo(target); + } + + return html; + }); + } else { + elm.html(html); + } + }, + + /** + * Returns the outer HTML of an element. + * + * @method getOuterHTML + * @param {String/Element} elm Element ID or element object to get outer HTML from. + * @return {String} Outer HTML string. + * @example + * tinymce.DOM.getOuterHTML(editorElement); + * tinymce.activeEditor.getOuterHTML(tinymce.activeEditor.getBody()); + */ + getOuterHTML: function(elm) { + elm = this.get(elm); + + // Older FF doesn't have outerHTML 3.6 is still used by some orgaizations + return elm.nodeType == 1 && "outerHTML" in elm ? elm.outerHTML : $('
').append($(elm).clone()).html(); + }, + + /** + * Sets the specified outer HTML on an element or elements. + * + * @method setOuterHTML + * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set outer HTML on. + * @param {Object} html HTML code to set as outer value for the element. + * @param {Document} doc Optional document scope to use in this process - defaults to the document of the DOM class. + * @example + * // Sets the outer HTML of all paragraphs in the active editor + * tinymce.activeEditor.dom.setOuterHTML(tinymce.activeEditor.dom.select('p'), '
some html
'); + * + * // Sets the outer HTML of an element by id in the document + * tinymce.DOM.setOuterHTML('mydiv', '
some html
'); + */ + setOuterHTML: function(elm, html) { + var self = this; + + self.$$(elm).each(function() { + try { + // Older FF doesn't have outerHTML 3.6 is still used by some orgaizations + if ("outerHTML" in this) { + this.outerHTML = html; + return; + } + } catch (ex) { + // Ignore + } + + // OuterHTML for IE it sometimes produces an "unknown runtime error" + self.remove($(this).html(html), true); + }); + }, + + /** + * Entity decodes a string. This method decodes any HTML entities, such as å. + * + * @method decode + * @param {String} s String to decode entities on. + * @return {String} Entity decoded string. + */ + decode: Entities.decode, + + /** + * Entity encodes a string. This method encodes the most common entities, such as <>"&. + * + * @method encode + * @param {String} text String to encode with entities. + * @return {String} Entity encoded string. + */ + encode: Entities.encodeAllRaw, + + /** + * Inserts an element after the reference element. + * + * @method insertAfter + * @param {Element} node Element to insert after the reference. + * @param {Element/String/Array} reference_node Reference element, element id or array of elements to insert after. + * @return {Element/Array} Element that got added or an array with elements. + */ + insertAfter: function(node, referenceNode) { + referenceNode = this.get(referenceNode); + + return this.run(node, function(node) { + var parent, nextSibling; + + parent = referenceNode.parentNode; + nextSibling = referenceNode.nextSibling; + + if (nextSibling) { + parent.insertBefore(node, nextSibling); + } else { + parent.appendChild(node); + } + + return node; + }); + }, + + /** + * Replaces the specified element or elements with the new element specified. The new element will + * be cloned if multiple input elements are passed in. + * + * @method replace + * @param {Element} newElm New element to replace old ones with. + * @param {Element/String/Array} oldELm Element DOM node, element id or array of elements or ids to replace. + * @param {Boolean} k Optional keep children state, if set to true child nodes from the old object will be added to new ones. + */ + replace: function(newElm, oldElm, keepChildren) { + var self = this; + + return self.run(oldElm, function(oldElm) { + if (is(oldElm, 'array')) { + newElm = newElm.cloneNode(true); + } + + if (keepChildren) { + each(grep(oldElm.childNodes), function(node) { + newElm.appendChild(node); + }); + } + + return oldElm.parentNode.replaceChild(newElm, oldElm); + }); + }, + + /** + * Renames the specified element and keeps its attributes and children. + * + * @method rename + * @param {Element} elm Element to rename. + * @param {String} name Name of the new element. + * @return {Element} New element or the old element if it needed renaming. + */ + rename: function(elm, name) { + var self = this, newElm; + + if (elm.nodeName != name.toUpperCase()) { + // Rename block element + newElm = self.create(name); + + // Copy attribs to new block + each(self.getAttribs(elm), function(attrNode) { + self.setAttrib(newElm, attrNode.nodeName, self.getAttrib(elm, attrNode.nodeName)); + }); + + // Replace block + self.replace(newElm, elm, 1); + } + + return newElm || elm; + }, + + /** + * Find the common ancestor of two elements. This is a shorter method than using the DOM Range logic. + * + * @method findCommonAncestor + * @param {Element} a Element to find common ancestor of. + * @param {Element} b Element to find common ancestor of. + * @return {Element} Common ancestor element of the two input elements. + */ + findCommonAncestor: function(a, b) { + var ps = a, pe; + + while (ps) { + pe = b; + + while (pe && ps != pe) { + pe = pe.parentNode; + } + + if (ps == pe) { + break; + } + + ps = ps.parentNode; + } + + if (!ps && a.ownerDocument) { + return a.ownerDocument.documentElement; + } + + return ps; + }, + + /** + * Parses the specified RGB color value and returns a hex version of that color. + * + * @method toHex + * @param {String} rgbVal RGB string value like rgb(1,2,3) + * @return {String} Hex version of that RGB value like #FF00FF. + */ + toHex: function(rgbVal) { + return this.styles.toHex(Tools.trim(rgbVal)); + }, + + /** + * Executes the specified function on the element by id or dom element node or array of elements/id. + * + * @method run + * @param {String/Element/Array} Element ID or DOM element object or array with ids or elements. + * @param {function} f Function to execute for each item. + * @param {Object} s Optional scope to execute the function in. + * @return {Object/Array} Single object, or an array of objects if multiple input elements were passed in. + */ + run: function(elm, func, scope) { + var self = this, result; + + if (typeof elm === 'string') { + elm = self.get(elm); + } + + if (!elm) { + return false; + } + + scope = scope || this; + if (!elm.nodeType && (elm.length || elm.length === 0)) { + result = []; + + each(elm, function(elm, i) { + if (elm) { + if (typeof elm == 'string') { + elm = self.get(elm); + } + + result.push(func.call(scope, elm, i)); + } + }); + + return result; + } + + return func.call(scope, elm); + }, + + /** + * Returns a NodeList with attributes for the element. + * + * @method getAttribs + * @param {HTMLElement/string} elm Element node or string id to get attributes from. + * @return {NodeList} NodeList with attributes. + */ + getAttribs: function(elm) { + var attrs; + + elm = this.get(elm); + + if (!elm) { + return []; + } + + if (isIE) { + attrs = []; + + // Object will throw exception in IE + if (elm.nodeName == 'OBJECT') { + return elm.attributes; + } + + // IE doesn't keep the selected attribute if you clone option elements + if (elm.nodeName === 'OPTION' && this.getAttrib(elm, 'selected')) { + attrs.push({specified: 1, nodeName: 'selected'}); + } + + // It's crazy that this is faster in IE but it's because it returns all attributes all the time + var attrRegExp = /<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi; + elm.cloneNode(false).outerHTML.replace(attrRegExp, '').replace(/[\w:\-]+/gi, function(a) { + attrs.push({specified: 1, nodeName: a}); + }); + + return attrs; + } + + return elm.attributes; + }, + + /** + * Returns true/false if the specified node is to be considered empty or not. + * + * @example + * tinymce.DOM.isEmpty(node, {img: true}); + * @method isEmpty + * @param {Object} elements Optional name/value object with elements that are automatically treated as non-empty elements. + * @return {Boolean} true/false if the node is empty or not. + */ + isEmpty: function(node, elements) { + var self = this, i, attributes, type, walker, name, brCount = 0; + + node = node.firstChild; + if (node) { + walker = new TreeWalker(node, node.parentNode); + elements = elements || (self.schema ? self.schema.getNonEmptyElements() : null); + + do { + type = node.nodeType; + + if (type === 1) { + // Ignore bogus elements + if (node.getAttribute('data-mce-bogus')) { + continue; + } + + // Keep empty elements like + name = node.nodeName.toLowerCase(); + if (elements && elements[name]) { + // Ignore single BR elements in blocks like


or


+ if (name === 'br') { + brCount++; + continue; + } + + return false; + } + + // Keep elements with data-bookmark attributes or name attribute like + attributes = self.getAttribs(node); + i = attributes.length; + while (i--) { + name = attributes[i].nodeName; + if (name === "name" || name === 'data-mce-bookmark') { + return false; + } + } + } + + // Keep comment nodes + if (type == 8) { + return false; + } + + // Keep non whitespace text nodes + if ((type === 3 && !whiteSpaceRegExp.test(node.nodeValue))) { + return false; + } + } while ((node = walker.next())); + } + + return brCount <= 1; + }, + + /** + * Creates a new DOM Range object. This will use the native DOM Range API if it's + * available. If it's not, it will fall back to the custom TinyMCE implementation. + * + * @method createRng + * @return {DOMRange} DOM Range object. + * @example + * var rng = tinymce.DOM.createRng(); + * alert(rng.startContainer + "," + rng.startOffset); + */ + createRng: function() { + var doc = this.doc; + + return doc.createRange ? doc.createRange() : new Range(this); + }, + + /** + * Returns the index of the specified node within its parent. + * + * @method nodeIndex + * @param {Node} node Node to look for. + * @param {boolean} normalized Optional true/false state if the index is what it would be after a normalization. + * @return {Number} Index of the specified node. + */ + nodeIndex: function(node, normalized) { + var idx = 0, lastNodeType, nodeType; + + if (node) { + for (lastNodeType = node.nodeType, node = node.previousSibling; node; node = node.previousSibling) { + nodeType = node.nodeType; + + // Normalize text nodes + if (normalized && nodeType == 3) { + if (nodeType == lastNodeType || !node.nodeValue.length) { + continue; + } + } + idx++; + lastNodeType = nodeType; + } + } + + return idx; + }, + + /** + * Splits an element into two new elements and places the specified split + * element or elements between the new ones. For example splitting the paragraph at the bold element in + * this example

abcabc123

would produce

abc

abc

123

. + * + * @method split + * @param {Element} parentElm Parent element to split. + * @param {Element} splitElm Element to split at. + * @param {Element} replacementElm Optional replacement element to replace the split element with. + * @return {Element} Returns the split element or the replacement element if that is specified. + */ + split: function(parentElm, splitElm, replacementElm) { + var self = this, r = self.createRng(), bef, aft, pa; + + // W3C valid browsers tend to leave empty nodes to the left/right side of the contents - this makes sense + // but we don't want that in our code since it serves no purpose for the end user + // For example splitting this html at the bold element: + //

text 1CHOPtext 2

+ // would produce: + //

text 1

CHOP

text 2

+ // this function will then trim off empty edges and produce: + //

text 1

CHOP

text 2

+ function trimNode(node) { + var i, children = node.childNodes, type = node.nodeType; + + function surroundedBySpans(node) { + var previousIsSpan = node.previousSibling && node.previousSibling.nodeName == 'SPAN'; + var nextIsSpan = node.nextSibling && node.nextSibling.nodeName == 'SPAN'; + return previousIsSpan && nextIsSpan; + } + + if (type == 1 && node.getAttribute('data-mce-type') == 'bookmark') { + return; + } + + for (i = children.length - 1; i >= 0; i--) { + trimNode(children[i]); + } + + if (type != 9) { + // Keep non whitespace text nodes + if (type == 3 && node.nodeValue.length > 0) { + // If parent element isn't a block or there isn't any useful contents for example "

" + // Also keep text nodes with only spaces if surrounded by spans. + // eg. "

a b

" should keep space between a and b + var trimmedLength = trim(node.nodeValue).length; + if (!self.isBlock(node.parentNode) || trimmedLength > 0 || trimmedLength === 0 && surroundedBySpans(node)) { + return; + } + } else if (type == 1) { + // If the only child is a bookmark then move it up + children = node.childNodes; + + // TODO fix this complex if + if (children.length == 1 && children[0] && children[0].nodeType == 1 && + children[0].getAttribute('data-mce-type') == 'bookmark') { + node.parentNode.insertBefore(children[0], node); + } + + // Keep non empty elements or img, hr etc + if (children.length || /^(br|hr|input|img)$/i.test(node.nodeName)) { + return; + } + } + + self.remove(node); + } + + return node; + } + + if (parentElm && splitElm) { + // Get before chunk + r.setStart(parentElm.parentNode, self.nodeIndex(parentElm)); + r.setEnd(splitElm.parentNode, self.nodeIndex(splitElm)); + bef = r.extractContents(); + + // Get after chunk + r = self.createRng(); + r.setStart(splitElm.parentNode, self.nodeIndex(splitElm) + 1); + r.setEnd(parentElm.parentNode, self.nodeIndex(parentElm) + 1); + aft = r.extractContents(); + + // Insert before chunk + pa = parentElm.parentNode; + pa.insertBefore(trimNode(bef), parentElm); + + // Insert middle chunk + if (replacementElm) { + pa.replaceChild(replacementElm, splitElm); + } else { + pa.insertBefore(splitElm, parentElm); + } + + // Insert after chunk + pa.insertBefore(trimNode(aft), parentElm); + self.remove(parentElm); + + return replacementElm || splitElm; + } + }, + + /** + * Adds an event handler to the specified object. + * + * @method bind + * @param {Element/Document/Window/Array} target Target element to bind events to. + * handler to or an array of elements/ids/documents. + * @param {String} name Name of event handler to add, for example: click. + * @param {function} func Function to execute when the event occurs. + * @param {Object} scope Optional scope to execute the function in. + * @return {function} Function callback handler the same as the one passed in. + */ + bind: function(target, name, func, scope) { + var self = this; + + if (Tools.isArray(target)) { + var i = target.length; + + while (i--) { + target[i] = self.bind(target[i], name, func, scope); + } + + return target; + } + + // Collect all window/document events bound by editor instance + if (self.settings.collect && (target === self.doc || target === self.win)) { + self.boundEvents.push([target, name, func, scope]); + } + + return self.events.bind(target, name, func, scope || self); + }, + + /** + * Removes the specified event handler by name and function from an element or collection of elements. + * + * @method unbind + * @param {Element/Document/Window/Array} target Target element to unbind events on. + * @param {String} name Event handler name, for example: "click" + * @param {function} func Function to remove. + * @return {bool/Array} Bool state of true if the handler was removed, or an array of states if multiple input elements + * were passed in. + */ + unbind: function(target, name, func) { + var self = this, i; + + if (Tools.isArray(target)) { + i = target.length; + + while (i--) { + target[i] = self.unbind(target[i], name, func); + } + + return target; + } + + // Remove any bound events matching the input + if (self.boundEvents && (target === self.doc || target === self.win)) { + i = self.boundEvents.length; + + while (i--) { + var item = self.boundEvents[i]; + + if (target == item[0] && (!name || name == item[1]) && (!func || func == item[2])) { + this.events.unbind(item[0], item[1], item[2]); + } + } + } + + return this.events.unbind(target, name, func); + }, + + /** + * Fires the specified event name with object on target. + * + * @method fire + * @param {Node/Document/Window} target Target element or object to fire event on. + * @param {String} name Name of the event to fire. + * @param {Object} evt Event object to send. + * @return {Event} Event object. + */ + fire: function(target, name, evt) { + return this.events.fire(target, name, evt); + }, + + // Returns the content editable state of a node + getContentEditable: function(node) { + var contentEditable; + + // Check type + if (!node || node.nodeType != 1) { + return null; + } + + // Check for fake content editable + contentEditable = node.getAttribute("data-mce-contenteditable"); + if (contentEditable && contentEditable !== "inherit") { + return contentEditable; + } + + // Check for real content editable + return node.contentEditable !== "inherit" ? node.contentEditable : null; + }, + + getContentEditableParent: function(node) { + var root = this.getRoot(), state = null; + + for (; node && node !== root; node = node.parentNode) { + state = this.getContentEditable(node); + + if (state !== null) { + break; + } + } + + return state; + }, + + /** + * Destroys all internal references to the DOM to solve IE leak issues. + * + * @method destroy + */ + destroy: function() { + var self = this; + + // Unbind all events bound to window/document by editor instance + if (self.boundEvents) { + var i = self.boundEvents.length; + + while (i--) { + var item = self.boundEvents[i]; + this.events.unbind(item[0], item[1], item[2]); + } + + self.boundEvents = null; + } + + // Restore sizzle document to window.document + // Since the current document might be removed producing "Permission denied" on IE see #6325 + if (Sizzle.setDocument) { + Sizzle.setDocument(); + } + + self.win = self.doc = self.root = self.events = self.frag = null; + }, + + isChildOf: function(node, parent) { + while (node) { + if (parent === node) { + return true; + } + + node = node.parentNode; + } + + return false; + }, + + // #ifdef debug + + dumpRng: function(r) { + return ( + 'startContainer: ' + r.startContainer.nodeName + + ', startOffset: ' + r.startOffset + + ', endContainer: ' + r.endContainer.nodeName + + ', endOffset: ' + r.endOffset + ); + }, + + // #endif + + _findSib: function(node, selector, name) { + var self = this, func = selector; + + if (node) { + // If expression make a function of it using is + if (typeof func == 'string') { + func = function(node) { + return self.is(node, selector); + }; + } + + // Loop all siblings + for (node = node[name]; node; node = node[name]) { + if (func(node)) { + return node; + } + } + } + + return null; + } + }; + + /** + * Instance of DOMUtils for the current document. + * + * @static + * @property DOM + * @type tinymce.dom.DOMUtils + * @example + * // Example of how to add a class to some element by id + * tinymce.DOM.addClass('someid', 'someclass'); + */ + DOMUtils.DOM = new DOMUtils(document); + + return DOMUtils; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/DomQuery.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/DomQuery.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1568 @@ +/** + * DomQuery.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class mimics most of the jQuery API: + * + * This is whats currently implemented: + * - Utility functions + * - DOM traversial + * - DOM manipulation + * - Event binding + * + * This is not currently implemented: + * - Dimension + * - Ajax + * - Animation + * - Advanced chaining + * + * @example + * var $ = tinymce.dom.DomQuery; + * $('p').attr('attr', 'value').addClass('class'); + * + * @class tinymce.dom.DomQuery + */ +define("tinymce/dom/DomQuery", [ + "tinymce/dom/EventUtils", + "tinymce/dom/Sizzle", + "tinymce/util/Tools", + "tinymce/Env" +], function(EventUtils, Sizzle, Tools, Env) { + var doc = document, push = Array.prototype.push, slice = Array.prototype.slice; + var rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/; + var Event = EventUtils.Event, undef; + + function isDefined(obj) { + return typeof obj !== 'undefined'; + } + + function isString(obj) { + return typeof obj === 'string'; + } + + function isWindow(obj) { + return obj && obj == obj.window; + } + + function createFragment(html, fragDoc) { + var frag, node, container; + + fragDoc = fragDoc || doc; + container = fragDoc.createElement('div'); + frag = fragDoc.createDocumentFragment(); + container.innerHTML = html; + + while ((node = container.firstChild)) { + frag.appendChild(node); + } + + return frag; + } + + function domManipulate(targetNodes, sourceItem, callback, reverse) { + var i; + + if (isString(sourceItem)) { + sourceItem = createFragment(sourceItem, getElementDocument(targetNodes[0])); + } else if (sourceItem.length && !sourceItem.nodeType) { + sourceItem = DomQuery.makeArray(sourceItem); + + if (reverse) { + for (i = sourceItem.length - 1; i >= 0; i--) { + domManipulate(targetNodes, sourceItem[i], callback, reverse); + } + } else { + for (i = 0; i < sourceItem.length; i++) { + domManipulate(targetNodes, sourceItem[i], callback, reverse); + } + } + + return targetNodes; + } + + if (sourceItem.nodeType) { + i = targetNodes.length; + while (i--) { + callback.call(targetNodes[i], sourceItem); + } + } + + return targetNodes; + } + + function hasClass(node, className) { + return node && className && (' ' + node.className + ' ').indexOf(' ' + className + ' ') !== -1; + } + + function wrap(elements, wrapper, all) { + var lastParent, newWrapper; + + wrapper = DomQuery(wrapper)[0]; + + elements.each(function() { + var self = this; + + if (!all || lastParent != self.parentNode) { + lastParent = self.parentNode; + newWrapper = wrapper.cloneNode(false); + self.parentNode.insertBefore(newWrapper, self); + newWrapper.appendChild(self); + } else { + newWrapper.appendChild(self); + } + }); + + return elements; + } + + var numericCssMap = Tools.makeMap('fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom', ' '); + var booleanMap = Tools.makeMap('checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected', ' '); + var propFix = { + 'for': 'htmlFor', + 'class': 'className', + 'readonly': 'readOnly' + }; + var cssFix = { + 'float': 'cssFloat' + }; + + var attrHooks = {}, cssHooks = {}; + + function DomQuery(selector, context) { + /*eslint new-cap:0 */ + return new DomQuery.fn.init(selector, context); + } + + function inArray(item, array) { + var i; + + if (array.indexOf) { + return array.indexOf(item); + } + + i = array.length; + while (i--) { + if (array[i] === item) { + return i; + } + } + + return -1; + } + + var whiteSpaceRegExp = /^\s*|\s*$/g; + + function trim(str) { + return (str === null || str === undef) ? '' : ("" + str).replace(whiteSpaceRegExp, ''); + } + + function each(obj, callback) { + var length, key, i, undef, value; + + if (obj) { + length = obj.length; + + if (length === undef) { + // Loop object items + for (key in obj) { + if (obj.hasOwnProperty(key)) { + value = obj[key]; + if (callback.call(value, key, value) === false) { + break; + } + } + } + } else { + // Loop array items + for (i = 0; i < length; i++) { + value = obj[i]; + if (callback.call(value, i, value) === false) { + break; + } + } + } + } + + return obj; + } + + function grep(array, callback) { + var out = []; + + each(array, function(i, item) { + if (callback(item, i)) { + out.push(item); + } + }); + + return out; + } + + function getElementDocument(element) { + if (!element) { + return doc; + } + + if (element.nodeType == 9) { + return element; + } + + return element.ownerDocument; + } + + DomQuery.fn = DomQuery.prototype = { + constructor: DomQuery, + + /** + * Selector for the current set. + * + * @property selector + * @type String + */ + selector: "", + + /** + * Context used to create the set. + * + * @property context + * @type Element + */ + context: null, + + /** + * Number of items in the current set. + * + * @property length + * @type Number + */ + length: 0, + + /** + * Constructs a new DomQuery instance with the specified selector or context. + * + * @constructor + * @method init + * @param {String/Array/DomQuery} selector Optional CSS selector/Array or array like object or HTML string. + * @param {Document/Element} context Optional context to search in. + */ + init: function(selector, context) { + var self = this, match, node; + + if (!selector) { + return self; + } + + if (selector.nodeType) { + self.context = self[0] = selector; + self.length = 1; + + return self; + } + + if (context && context.nodeType) { + self.context = context; + } else { + if (context) { + return DomQuery(selector).attr(context); + } else { + self.context = context = document; + } + } + + if (isString(selector)) { + self.selector = selector; + + if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) { + match = [null, selector, null]; + } else { + match = rquickExpr.exec(selector); + } + + if (match) { + if (match[1]) { + node = createFragment(selector, getElementDocument(context)).firstChild; + + while (node) { + push.call(self, node); + node = node.nextSibling; + } + } else { + node = getElementDocument(context).getElementById(match[2]); + + if (!node) { + return self; + } + + if (node.id !== match[2]) { + return self.find(selector); + } + + self.length = 1; + self[0] = node; + } + } else { + return DomQuery(context).find(selector); + } + } else { + this.add(selector, false); + } + + return self; + }, + + /** + * Converts the current set to an array. + * + * @method toArray + * @param {Array} Array of all nodes in set. + */ + toArray: function() { + return Tools.toArray(this); + }, + + /** + * Adds new nodes to the set. + * + * @method add + * @param {Array/tinymce.dom.DomQuery} items Array of all nodes to add to set. + * @return {tinymce.dom.DomQuery} New instance with nodes added. + */ + add: function(items, sort) { + var self = this, nodes, i; + + if (isString(items)) { + return self.add(DomQuery(items)); + } + + if (sort !== false) { + nodes = DomQuery.unique(self.toArray().concat(DomQuery.makeArray(items))); + self.length = nodes.length; + for (i = 0; i < nodes.length; i++) { + self[i] = nodes[i]; + } + } else { + push.apply(self, DomQuery.makeArray(items)); + } + + return self; + }, + + /** + * Sets/gets attributes on the elements in the current set. + * + * @method attr + * @param {String/Object} name Name of attribute to get or an object with attributes to set. + * @param {String} value Optional value to set. + * @return {tinymce.dom.DomQuery/String} Current set or the specified attribute when only the name is specified. + */ + attr: function(name, value) { + var self = this, hook; + + if (typeof name === "object") { + each(name, function(name, value) { + self.attr(name, value); + }); + } else if (isDefined(value)) { + this.each(function() { + var hook; + + if (this.nodeType === 1) { + hook = attrHooks[name]; + if (hook && hook.set) { + hook.set(this, value); + return; + } + + if (value === null) { + this.removeAttribute(name, 2); + } else { + this.setAttribute(name, value, 2); + } + } + }); + } else { + if (self[0] && self[0].nodeType === 1) { + hook = attrHooks[name]; + if (hook && hook.get) { + return hook.get(self[0], name); + } + + if (booleanMap[name]) { + return self.prop(name) ? name : undef; + } + + value = self[0].getAttribute(name, 2); + + if (value === null) { + value = undef; + } + } + + return value; + } + + return self; + }, + + /** + * Removes attributse on the elements in the current set. + * + * @method removeAttr + * @param {String/Object} name Name of attribute to remove. + * @return {tinymce.dom.DomQuery/String} Current set. + */ + removeAttr: function(name) { + return this.attr(name, null); + }, + + /** + * Sets/gets properties on the elements in the current set. + * + * @method attr + * @param {String/Object} name Name of property to get or an object with properties to set. + * @param {String} value Optional value to set. + * @return {tinymce.dom.DomQuery/String} Current set or the specified property when only the name is specified. + */ + prop: function(name, value) { + var self = this; + + name = propFix[name] || name; + + if (typeof name === "object") { + each(name, function(name, value) { + self.prop(name, value); + }); + } else if (isDefined(value)) { + this.each(function() { + if (this.nodeType == 1) { + this[name] = value; + } + }); + } else { + if (self[0] && self[0].nodeType && name in self[0]) { + return self[0][name]; + } + + return value; + } + + return self; + }, + + /** + * Sets/gets styles on the elements in the current set. + * + * @method css + * @param {String/Object} name Name of style to get or an object with styles to set. + * @param {String} value Optional value to set. + * @return {tinymce.dom.DomQuery/String} Current set or the specified style when only the name is specified. + */ + css: function(name, value) { + var self = this, elm, hook; + + function camel(name) { + return name.replace(/-(\D)/g, function(a, b) { + return b.toUpperCase(); + }); + } + + function dashed(name) { + return name.replace(/[A-Z]/g, function(a) { + return '-' + a; + }); + } + + if (typeof name === "object") { + each(name, function(name, value) { + self.css(name, value); + }); + } else { + if (isDefined(value)) { + name = camel(name); + + // Default px suffix on these + if (typeof value === 'number' && !numericCssMap[name]) { + value += 'px'; + } + + self.each(function() { + var style = this.style; + + hook = cssHooks[name]; + if (hook && hook.set) { + hook.set(this, value); + return; + } + + try { + this.style[cssFix[name] || name] = value; + } catch (ex) { + // Ignore + } + + if (value === null || value === '') { + if (style.removeProperty) { + style.removeProperty(dashed(name)); + } else { + style.removeAttribute(name); + } + } + }); + } else { + elm = self[0]; + + hook = cssHooks[name]; + if (hook && hook.get) { + return hook.get(elm); + } + + if (elm.ownerDocument.defaultView) { + try { + return elm.ownerDocument.defaultView.getComputedStyle(elm, null).getPropertyValue(dashed(name)); + } catch (ex) { + return undef; + } + } else if (elm.currentStyle) { + return elm.currentStyle[camel(name)]; + } + } + } + + return self; + }, + + /** + * Removes all nodes in set from the document. + * + * @method remove + * @return {tinymce.dom.DomQuery} Current set with the removed nodes. + */ + remove: function() { + var self = this, node, i = this.length; + + while (i--) { + node = self[i]; + Event.clean(node); + + if (node.parentNode) { + node.parentNode.removeChild(node); + } + } + + return this; + }, + + /** + * Empties all elements in set. + * + * @method empty + * @return {tinymce.dom.DomQuery} Current set with the empty nodes. + */ + empty: function() { + var self = this, node, i = this.length; + + while (i--) { + node = self[i]; + while (node.firstChild) { + node.removeChild(node.firstChild); + } + } + + return this; + }, + + /** + * Sets or gets the HTML of the current set or first set node. + * + * @method html + * @param {String} value Optional innerHTML value to set on each element. + * @return {tinymce.dom.DomQuery/String} Current set or the innerHTML of the first element. + */ + html: function(value) { + var self = this, i; + + if (isDefined(value)) { + i = self.length; + + try { + while (i--) { + self[i].innerHTML = value; + } + } catch (ex) { + // Workaround for "Unknown runtime error" when DIV is added to P on IE + DomQuery(self[i]).empty().append(value); + } + + return self; + } + + return self[0] ? self[0].innerHTML : ''; + }, + + /** + * Sets or gets the text of the current set or first set node. + * + * @method text + * @param {String} value Optional innerText value to set on each element. + * @return {tinymce.dom.DomQuery/String} Current set or the innerText of the first element. + */ + text: function(value) { + var self = this, i; + + if (isDefined(value)) { + i = self.length; + while (i--) { + if ("innerText" in self[i]) { + self[i].innerText = value; + } else { + self[0].textContent = value; + } + } + + return self; + } + + return self[0] ? (self[0].innerText || self[0].textContent) : ''; + }, + + /** + * Appends the specified node/html or node set to the current set nodes. + * + * @method append + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to append to each element in set. + * @return {tinymce.dom.DomQuery} Current set. + */ + append: function() { + return domManipulate(this, arguments, function(node) { + if (this.nodeType === 1) { + this.appendChild(node); + } + }); + }, + + /** + * Prepends the specified node/html or node set to the current set nodes. + * + * @method prepend + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to prepend to each element in set. + * @return {tinymce.dom.DomQuery} Current set. + */ + prepend: function() { + return domManipulate(this, arguments, function(node) { + if (this.nodeType === 1) { + this.insertBefore(node, this.firstChild); + } + }, true); + }, + + /** + * Adds the specified elements before current set nodes. + * + * @method before + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to add before to each element in set. + * @return {tinymce.dom.DomQuery} Current set. + */ + before: function() { + var self = this; + + if (self[0] && self[0].parentNode) { + return domManipulate(self, arguments, function(node) { + this.parentNode.insertBefore(node, this); + }); + } + + return self; + }, + + /** + * Adds the specified elements after current set nodes. + * + * @method after + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to add after to each element in set. + * @return {tinymce.dom.DomQuery} Current set. + */ + after: function() { + var self = this; + + if (self[0] && self[0].parentNode) { + return domManipulate(self, arguments, function(node) { + this.parentNode.insertBefore(node, this.nextSibling); + }, true); + } + + return self; + }, + + /** + * Appends the specified set nodes to the specified selector/instance. + * + * @method appendTo + * @param {String/Element/Array/tinymce.dom.DomQuery} val Item to append the current set to. + * @return {tinymce.dom.DomQuery} Current set with the appended nodes. + */ + appendTo: function(val) { + DomQuery(val).append(this); + + return this; + }, + + /** + * Prepends the specified set nodes to the specified selector/instance. + * + * @method prependTo + * @param {String/Element/Array/tinymce.dom.DomQuery} val Item to prepend the current set to. + * @return {tinymce.dom.DomQuery} Current set with the prepended nodes. + */ + prependTo: function(val) { + DomQuery(val).prepend(this); + + return this; + }, + + /** + * Replaces the nodes in set with the specified content. + * + * @method replaceWith + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to replace nodes with. + * @return {tinymce.dom.DomQuery} Set with replaced nodes. + */ + replaceWith: function(content) { + return this.before(content).remove(); + }, + + /** + * Wraps all elements in set with the specified wrapper. + * + * @method wrap + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to wrap nodes with. + * @return {tinymce.dom.DomQuery} Set with wrapped nodes. + */ + wrap: function(wrapper) { + return wrap(this, wrapper); + }, + + /** + * Wraps all nodes in set with the specified wrapper. If the nodes are siblings all of them + * will be wrapped in the same wrapper. + * + * @method wrapAll + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to wrap nodes with. + * @return {tinymce.dom.DomQuery} Set with wrapped nodes. + */ + wrapAll: function(wrapper) { + return wrap(this, wrapper, true); + }, + + /** + * Wraps all elements inner contents in set with the specified wrapper. + * + * @method wrapInner + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to wrap nodes with. + * @return {tinymce.dom.DomQuery} Set with wrapped nodes. + */ + wrapInner: function(wrapper) { + this.each(function() { + DomQuery(this).contents().wrapAll(wrapper); + }); + + return this; + }, + + /** + * Unwraps all elements by removing the parent element of each item in set. + * + * @method unwrap + * @return {tinymce.dom.DomQuery} Set with unwrapped nodes. + */ + unwrap: function() { + return this.parent().each(function() { + DomQuery(this).replaceWith(this.childNodes); + }); + }, + + /** + * Clones all nodes in set. + * + * @method clone + * @return {tinymce.dom.DomQuery} Set with cloned nodes. + */ + clone: function() { + var result = []; + + this.each(function() { + result.push(this.cloneNode(true)); + }); + + return DomQuery(result); + }, + + /** + * Adds the specified class name to the current set elements. + * + * @method addClass + * @param {String} className Class name to add. + * @return {tinymce.dom.DomQuery} Current set. + */ + addClass: function(className) { + return this.toggleClass(className, true); + }, + + /** + * Removes the specified class name to the current set elements. + * + * @method removeClass + * @param {String} className Class name to remove. + * @return {tinymce.dom.DomQuery} Current set. + */ + removeClass: function(className) { + return this.toggleClass(className, false); + }, + + /** + * Toggles the specified class name on the current set elements. + * + * @method toggleClass + * @param {String} className Class name to add/remove. + * @param {Boolean} state Optional state to toggle on/off. + * @return {tinymce.dom.DomQuery} Current set. + */ + toggleClass: function(className, state) { + var self = this; + + // Functions are not supported + if (typeof className != 'string') { + return self; + } + + if (className.indexOf(' ') !== -1) { + each(className.split(' '), function() { + self.toggleClass(this, state); + }); + } else { + self.each(function(index, node) { + var existingClassName, classState; + + classState = hasClass(node, className); + if (classState !== state) { + existingClassName = node.className; + + if (classState) { + node.className = trim((" " + existingClassName + " ").replace(' ' + className + ' ', ' ')); + } else { + node.className += existingClassName ? ' ' + className : className; + } + } + }); + } + + return self; + }, + + /** + * Returns true/false if the first item in set has the specified class. + * + * @method hasClass + * @param {String} className Class name to check for. + * @return {Boolean} True/false if the set has the specified class. + */ + hasClass: function(className) { + return hasClass(this[0], className); + }, + + /** + * Executes the callback function for each item DomQuery collection. If you return false in the + * callback it will break the loop. + * + * @method each + * @param {function} callback Callback function to execute for each item. + * @return {tinymce.dom.DomQuery} Current set. + */ + each: function(callback) { + return each(this, callback); + }, + + /** + * Binds an event with callback function to the elements in set. + * + * @method on + * @param {String} name Name of the event to bind. + * @param {function} callback Callback function to execute when the event occurs. + * @return {tinymce.dom.DomQuery} Current set. + */ + on: function(name, callback) { + return this.each(function() { + Event.bind(this, name, callback); + }); + }, + + /** + * Unbinds an event with callback function to the elements in set. + * + * @method off + * @param {String} name Optional name of the event to bind. + * @param {function} callback Optional callback function to execute when the event occurs. + * @return {tinymce.dom.DomQuery} Current set. + */ + off: function(name, callback) { + return this.each(function() { + Event.unbind(this, name, callback); + }); + }, + + /** + * Triggers the specified event by name or event object. + * + * @method trigger + * @param {String/Object} name Name of the event to trigger or event object. + * @return {tinymce.dom.DomQuery} Current set. + */ + trigger: function(name) { + return this.each(function() { + if (typeof name == 'object') { + Event.fire(this, name.type, name); + } else { + Event.fire(this, name); + } + }); + }, + + /** + * Shows all elements in set. + * + * @method show + * @return {tinymce.dom.DomQuery} Current set. + */ + show: function() { + return this.css('display', ''); + }, + + /** + * Hides all elements in set. + * + * @method hide + * @return {tinymce.dom.DomQuery} Current set. + */ + hide: function() { + return this.css('display', 'none'); + }, + + /** + * Slices the current set. + * + * @method slice + * @param {Number} start Start index to slice at. + * @param {Number} end Optional ened index to end slice at. + * @return {tinymce.dom.DomQuery} Sliced set. + */ + slice: function() { + return new DomQuery(slice.apply(this, arguments)); + }, + + /** + * Makes the set equal to the specified index. + * + * @method eq + * @param {Number} index Index to set it equal to. + * @return {tinymce.dom.DomQuery} Single item set. + */ + eq: function(index) { + return index === -1 ? this.slice(index) : this.slice(index, +index + 1); + }, + + /** + * Makes the set equal to first element in set. + * + * @method first + * @return {tinymce.dom.DomQuery} Single item set. + */ + first: function() { + return this.eq(0); + }, + + /** + * Makes the set equal to last element in set. + * + * @method last + * @return {tinymce.dom.DomQuery} Single item set. + */ + last: function() { + return this.eq(-1); + }, + + /** + * Finds elements by the specified selector for each element in set. + * + * @method find + * @param {String} selector Selector to find elements by. + * @return {tinymce.dom.DomQuery} Set with matches elements. + */ + find: function(selector) { + var i, l, ret = []; + + for (i = 0, l = this.length; i < l; i++) { + DomQuery.find(selector, this[i], ret); + } + + return DomQuery(ret); + }, + + /** + * Filters the current set with the specified selector. + * + * @method filter + * @param {String/function} selector Selector to filter elements by. + * @return {tinymce.dom.DomQuery} Set with filtered elements. + */ + filter: function(selector) { + if (typeof selector == 'function') { + return DomQuery(grep(this.toArray(), function(item, i) { + return selector(i, item); + })); + } + + return DomQuery(DomQuery.filter(selector, this.toArray())); + }, + + /** + * Gets the current node or any partent matching the specified selector. + * + * @method closest + * @param {String/Element/tinymce.dom.DomQuery} selector Selector or element to find. + * @return {tinymce.dom.DomQuery} Set with closest elements. + */ + closest: function(selector) { + var result = []; + + if (selector instanceof DomQuery) { + selector = selector[0]; + } + + this.each(function(i, node) { + while (node) { + if (typeof selector == 'string' && DomQuery(node).is(selector)) { + result.push(node); + break; + } else if (node == selector) { + result.push(node); + break; + } + + node = node.parentNode; + } + }); + + return DomQuery(result); + }, + + /** + * Returns the offset of the first element in set or sets the top/left css properties of all elements in set. + * + * @method offset + * @param {Object} offset Optional offset object to set on each item. + * @return {Object/tinymce.dom.DomQuery} Returns the first element offset or the current set if you specified an offset. + */ + offset: function(offset) { + var elm, doc, docElm; + var x = 0, y = 0, pos; + + if (!offset) { + elm = this[0]; + + if (elm) { + doc = elm.ownerDocument; + docElm = doc.documentElement; + + if (elm.getBoundingClientRect) { + pos = elm.getBoundingClientRect(); + x = pos.left + (docElm.scrollLeft || doc.body.scrollLeft) - docElm.clientLeft; + y = pos.top + (docElm.scrollTop || doc.body.scrollTop) - docElm.clientTop; + } + } + + return { + left: x, + top: y + }; + } + + return this.css(offset); + }, + + push: push, + sort: [].sort, + splice: [].splice + }; + + // Static members + Tools.extend(DomQuery, { + /** + * Extends the specified object with one or more objects. + * + * @static + * @method extend + * @param {Object} target Target object to extend with new items. + * @param {Object..} object Object to extend the target with. + * @return {Object} Extended input object. + */ + extend: Tools.extend, + + /** + * Creates an array out of an array like object. + * + * @static + * @method makeArray + * @param {Object} object Object to convert to array. + * @return {Arrau} Array produced from object. + */ + makeArray: function(array) { + if (isWindow(array) || array.nodeType) { + return [array]; + } + + return Tools.toArray(array); + }, + + /** + * Returns the index of the specified item inside the array. + * + * @static + * @method inArray + * @param {Object} item Item to look for. + * @param {Array} array Array to look for item in. + * @return {Number} Index of the item or -1. + */ + inArray: inArray, + + /** + * Returns true/false if the specified object is an array or not. + * + * @static + * @method isArray + * @param {Object} array Object to check if it's an array or not. + * @return {Boolean} True/false if the object is an array. + */ + isArray: Tools.isArray, + + /** + * Executes the callback function for each item in array/object. If you return false in the + * callback it will break the loop. + * + * @static + * @method each + * @param {Object} obj Object to iterate. + * @param {function} callback Callback function to execute for each item. + */ + each: each, + + /** + * Removes whitespace from the beginning and end of a string. + * + * @static + * @method trim + * @param {String} str String to remove whitespace from. + * @return {String} New string with removed whitespace. + */ + trim: trim, + + /** + * Filters out items from the input array by calling the specified function for each item. + * If the function returns false the item will be excluded if it returns true it will be included. + * + * @static + * @method grep + * @param {Array} array Array of items to loop though. + * @param {function} callback Function to call for each item. Include/exclude depends on it's return value. + * @return {Array} New array with values imported and filtered based in input. + * @example + * // Filter out some items, this will return an array with 4 and 5 + * var items = DomQuery.grep([1, 2, 3, 4, 5], function(v) {return v > 3;}); + */ + grep: grep, + + // Sizzle + find: Sizzle, + expr: Sizzle.selectors, + unique: Sizzle.uniqueSort, + text: Sizzle.getText, + contains: Sizzle.contains, + filter: function(expr, elems, not) { + var i = elems.length; + + if (not) { + expr = ":not(" + expr + ")"; + } + + while (i--) { + if (elems[i].nodeType != 1) { + elems.splice(i, 1); + } + } + + if (elems.length === 1) { + elems = DomQuery.find.matchesSelector(elems[0], expr) ? [elems[0]] : []; + } else { + elems = DomQuery.find.matches(expr, elems); + } + + return elems; + } + }); + + function dir(el, prop, until) { + var matched = [], cur = el[prop]; + + if (typeof until != 'string' && until instanceof DomQuery) { + until = until[0]; + } + + while (cur && cur.nodeType !== 9) { + if (until !== undefined) { + if (cur === until) { + break; + } + + if (typeof until == 'string' && DomQuery(cur).is(until)) { + break; + } + } + + if (cur.nodeType === 1) { + matched.push(cur); + } + + cur = cur[prop]; + } + + return matched; + } + + function sibling(node, siblingName, nodeType, until) { + var result = []; + + if (until instanceof DomQuery) { + until = until[0]; + } + + for (; node; node = node[siblingName]) { + if (nodeType && node.nodeType !== nodeType) { + continue; + } + + if (until !== undefined) { + if (node === until) { + break; + } + + if (typeof until == 'string' && DomQuery(node).is(until)) { + break; + } + } + + result.push(node); + } + + return result; + } + + function firstSibling(node, siblingName, nodeType) { + for (node = node[siblingName]; node; node = node[siblingName]) { + if (node.nodeType == nodeType) { + return node; + } + } + + return null; + } + + each({ + /** + * Returns a new collection with the parent of each item in current collection matching the optional selector. + * + * @method parent + * @param {String} selector Selector to match parents agains. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching parents. + */ + parent: function(node) { + var parent = node.parentNode; + + return parent && parent.nodeType !== 11 ? parent : null; + }, + + /** + * Returns a new collection with the all the parents of each item in current collection matching the optional selector. + * + * @method parents + * @param {String} selector Selector to match parents agains. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching parents. + */ + parents: function(node) { + return dir(node, "parentNode"); + }, + + /** + * Returns a new collection with next sibling of each item in current collection matching the optional selector. + * + * @method next + * @param {String} selector Selector to match the next element against. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + next: function(node) { + return firstSibling(node, 'nextSibling', 1); + }, + + /** + * Returns a new collection with previous sibling of each item in current collection matching the optional selector. + * + * @method prev + * @param {String} selector Selector to match the previous element against. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + prev: function(node) { + return firstSibling(node, 'previousSibling', 1); + }, + + /** + * Returns all child elements matching the optional selector. + * + * @method children + * @param {String} selector Selector to match the elements against. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + children: function(node) { + return sibling(node.firstChild, 'nextSibling', 1); + }, + + /** + * Returns all child nodes matching the optional selector. + * + * @method contents + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + contents: function(node) { + return Tools.toArray((node.nodeName === "iframe" ? node.contentDocument || node.contentWindow.document : node).childNodes); + } + }, function(name, fn) { + DomQuery.fn[name] = function(selector) { + var self = this, result = []; + + self.each(function() { + var nodes = fn.call(result, this, selector, result); + + if (nodes) { + if (DomQuery.isArray(nodes)) { + result.push.apply(result, nodes); + } else { + result.push(nodes); + } + } + }); + + // If traversing on multiple elements we might get the same elements twice + if (this.length > 1) { + result = DomQuery.unique(result); + + if (name.indexOf('parents') === 0) { + result = result.reverse(); + } + } + + result = DomQuery(result); + + if (selector) { + return result.filter(selector); + } + + return result; + }; + }); + + each({ + /** + * Returns a new collection with the all the parents until the matching selector/element + * of each item in current collection matching the optional selector. + * + * @method parentsUntil + * @param {String/Element/tinymce.dom.DomQuery} until Until the matching selector or element. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching parents. + */ + parentsUntil: function(node, until) { + return dir(node, "parentNode", until); + }, + + /** + * Returns a new collection with all next siblings of each item in current collection matching the optional selector. + * + * @method nextUntil + * @param {String/Element/tinymce.dom.DomQuery} until Until the matching selector or element. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + nextUntil: function(node, until) { + return sibling(node, 'nextSibling', 1, until).slice(1); + }, + + /** + * Returns a new collection with all previous siblings of each item in current collection matching the optional selector. + * + * @method prevUntil + * @param {String/Element/tinymce.dom.DomQuery} until Until the matching selector or element. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + prevUntil: function(node, until) { + return sibling(node, 'previousSibling', 1, until).slice(1); + } + }, function(name, fn) { + DomQuery.fn[name] = function(selector, filter) { + var self = this, result = []; + + self.each(function() { + var nodes = fn.call(result, this, selector, result); + + if (nodes) { + if (DomQuery.isArray(nodes)) { + result.push.apply(result, nodes); + } else { + result.push(nodes); + } + } + }); + + // If traversing on multiple elements we might get the same elements twice + if (this.length > 1) { + result = DomQuery.unique(result); + + if (name.indexOf('parents') === 0 || name === 'prevUntil') { + result = result.reverse(); + } + } + + result = DomQuery(result); + + if (filter) { + return result.filter(filter); + } + + return result; + }; + }); + + /** + * Returns true/false if the current set items matches the selector. + * + * @method is + * @param {String} selector Selector to match the elements against. + * @return {Boolean} True/false if the current set matches the selector. + */ + DomQuery.fn.is = function(selector) { + return !!selector && this.filter(selector).length > 0; + }; + + DomQuery.fn.init.prototype = DomQuery.fn; + + DomQuery.overrideDefaults = function(callback) { + var defaults; + + function sub(selector, context) { + defaults = defaults || callback(); + + if (arguments.length === 0) { + selector = defaults.element; + } + + if (!context) { + context = defaults.context; + } + + return new sub.fn.init(selector, context); + } + + DomQuery.extend(sub, this); + + return sub; + }; + + function appendHooks(targetHooks, prop, hooks) { + each(hooks, function(name, func) { + targetHooks[name] = targetHooks[name] || {}; + targetHooks[name][prop] = func; + }); + } + + if (Env.ie && Env.ie < 8) { + appendHooks(attrHooks, 'get', { + maxlength: function(elm) { + var value = elm.maxLength; + + if (value === 0x7fffffff) { + return undef; + } + + return value; + }, + + size: function(elm) { + var value = elm.size; + + if (value === 20) { + return undef; + } + + return value; + }, + + 'class': function(elm) { + return elm.className; + }, + + style: function(elm) { + var value = elm.style.cssText; + + if (value.length === 0) { + return undef; + } + + return value; + } + }); + + appendHooks(attrHooks, 'set', { + 'class': function(elm, value) { + elm.className = value; + }, + + style: function(elm, value) { + elm.style.cssText = value; + } + }); + } + + if (Env.ie && Env.ie < 9) { + /*jshint sub:true */ + /*eslint dot-notation: 0*/ + cssFix['float'] = 'styleFloat'; + + appendHooks(cssHooks, 'set', { + opacity: function(elm, value) { + var style = elm.style; + + if (value === null || value === '') { + style.removeAttribute('filter'); + } else { + style.zoom = 1; + style.filter = 'alpha(opacity=' + (value * 100) + ')'; + } + } + }); + } + + DomQuery.attrHooks = attrHooks; + DomQuery.cssHooks = cssHooks; + + return DomQuery; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/ElementUtils.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/ElementUtils.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,117 @@ +/** + * ElementUtils.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Utility class for various element specific functions. + * + * @private + */ +define("tinymce/dom/ElementUtils", [ + "tinymce/dom/BookmarkManager", + "tinymce/util/Tools" +], function(BookmarkManager, Tools) { + var each = Tools.each; + + function ElementUtils(dom) { + /** + * Compares two nodes and checks if it's attributes and styles matches. + * This doesn't compare classes as items since their order is significant. + * + * @method compare + * @param {Node} node1 First node to compare with. + * @param {Node} node2 Second node to compare with. + * @return {boolean} True/false if the nodes are the same or not. + */ + this.compare = function(node1, node2) { + // Not the same name + if (node1.nodeName != node2.nodeName) { + return false; + } + + /** + * Returns all the nodes attributes excluding internal ones, styles and classes. + * + * @private + * @param {Node} node Node to get attributes from. + * @return {Object} Name/value object with attributes and attribute values. + */ + function getAttribs(node) { + var attribs = {}; + + each(dom.getAttribs(node), function(attr) { + var name = attr.nodeName.toLowerCase(); + + // Don't compare internal attributes or style + if (name.indexOf('_') !== 0 && name !== 'style' && name !== 'data-mce-style') { + attribs[name] = dom.getAttrib(node, name); + } + }); + + return attribs; + } + + /** + * Compares two objects checks if it's key + value exists in the other one. + * + * @private + * @param {Object} obj1 First object to compare. + * @param {Object} obj2 Second object to compare. + * @return {boolean} True/false if the objects matches or not. + */ + function compareObjects(obj1, obj2) { + var value, name; + + for (name in obj1) { + // Obj1 has item obj2 doesn't have + if (obj1.hasOwnProperty(name)) { + value = obj2[name]; + + // Obj2 doesn't have obj1 item + if (typeof value == "undefined") { + return false; + } + + // Obj2 item has a different value + if (obj1[name] != value) { + return false; + } + + // Delete similar value + delete obj2[name]; + } + } + + // Check if obj 2 has something obj 1 doesn't have + for (name in obj2) { + // Obj2 has item obj1 doesn't have + if (obj2.hasOwnProperty(name)) { + return false; + } + } + + return true; + } + + // Attribs are not the same + if (!compareObjects(getAttribs(node1), getAttribs(node2))) { + return false; + } + + // Styles are not the same + if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style')))) { + return false; + } + + return !BookmarkManager.isBookmarkNode(node1) && !BookmarkManager.isBookmarkNode(node2); + }; + } + + return ElementUtils; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/EventUtils.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/EventUtils.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,563 @@ +/** + * EventUtils.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*jshint loopfunc:true*/ +/*eslint no-loop-func:0 */ + +/** + * This class wraps the browsers native event logic with more convenient methods. + * + * @class tinymce.dom.EventUtils + */ +define("tinymce/dom/EventUtils", [], function() { + "use strict"; + + var eventExpandoPrefix = "mce-data-"; + var mouseEventRe = /^(?:mouse|contextmenu)|click/; + var deprecated = {keyLocation: 1, layerX: 1, layerY: 1, returnValue: 1}; + + /** + * Binds a native event to a callback on the speified target. + */ + function addEvent(target, name, callback, capture) { + if (target.addEventListener) { + target.addEventListener(name, callback, capture || false); + } else if (target.attachEvent) { + target.attachEvent('on' + name, callback); + } + } + + /** + * Unbinds a native event callback on the specified target. + */ + function removeEvent(target, name, callback, capture) { + if (target.removeEventListener) { + target.removeEventListener(name, callback, capture || false); + } else if (target.detachEvent) { + target.detachEvent('on' + name, callback); + } + } + + /** + * Normalizes a native event object or just adds the event specific methods on a custom event. + */ + function fix(originalEvent, data) { + var name, event = data || {}, undef; + + // Dummy function that gets replaced on the delegation state functions + function returnFalse() { + return false; + } + + // Dummy function that gets replaced on the delegation state functions + function returnTrue() { + return true; + } + + // Copy all properties from the original event + for (name in originalEvent) { + // layerX/layerY is deprecated in Chrome and produces a warning + if (!deprecated[name]) { + event[name] = originalEvent[name]; + } + } + + // Normalize target IE uses srcElement + if (!event.target) { + event.target = event.srcElement || document; + } + + // Calculate pageX/Y if missing and clientX/Y available + if (originalEvent && mouseEventRe.test(originalEvent.type) && originalEvent.pageX === undef && originalEvent.clientX !== undef) { + var eventDoc = event.target.ownerDocument || document; + var doc = eventDoc.documentElement; + var body = eventDoc.body; + + event.pageX = originalEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - + (doc && doc.clientLeft || body && body.clientLeft || 0); + + event.pageY = originalEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - + (doc && doc.clientTop || body && body.clientTop || 0); + } + + // Add preventDefault method + event.preventDefault = function() { + event.isDefaultPrevented = returnTrue; + + // Execute preventDefault on the original event object + if (originalEvent) { + if (originalEvent.preventDefault) { + originalEvent.preventDefault(); + } else { + originalEvent.returnValue = false; // IE + } + } + }; + + // Add stopPropagation + event.stopPropagation = function() { + event.isPropagationStopped = returnTrue; + + // Execute stopPropagation on the original event object + if (originalEvent) { + if (originalEvent.stopPropagation) { + originalEvent.stopPropagation(); + } else { + originalEvent.cancelBubble = true; // IE + } + } + }; + + // Add stopImmediatePropagation + event.stopImmediatePropagation = function() { + event.isImmediatePropagationStopped = returnTrue; + event.stopPropagation(); + }; + + // Add event delegation states + if (!event.isDefaultPrevented) { + event.isDefaultPrevented = returnFalse; + event.isPropagationStopped = returnFalse; + event.isImmediatePropagationStopped = returnFalse; + } + + return event; + } + + /** + * Bind a DOMContentLoaded event across browsers and executes the callback once the page DOM is initialized. + * It will also set/check the domLoaded state of the event_utils instance so ready isn't called multiple times. + */ + function bindOnReady(win, callback, eventUtils) { + var doc = win.document, event = {type: 'ready'}; + + if (eventUtils.domLoaded) { + callback(event); + return; + } + + // Gets called when the DOM is ready + function readyHandler() { + if (!eventUtils.domLoaded) { + eventUtils.domLoaded = true; + callback(event); + } + } + + function waitForDomLoaded() { + // Check complete or interactive state if there is a body + // element on some iframes IE 8 will produce a null body + if (doc.readyState === "complete" || (doc.readyState === "interactive" && doc.body)) { + removeEvent(doc, "readystatechange", waitForDomLoaded); + readyHandler(); + } + } + + function tryScroll() { + try { + // If IE is used, use the trick by Diego Perini licensed under MIT by request to the author. + // http://javascript.nwbox.com/IEContentLoaded/ + doc.documentElement.doScroll("left"); + } catch (ex) { + setTimeout(tryScroll, 0); + return; + } + + readyHandler(); + } + + // Use W3C method + if (doc.addEventListener) { + if (doc.readyState === "complete") { + readyHandler(); + } else { + addEvent(win, 'DOMContentLoaded', readyHandler); + } + } else { + // Use IE method + addEvent(doc, "readystatechange", waitForDomLoaded); + + // Wait until we can scroll, when we can the DOM is initialized + if (doc.documentElement.doScroll && win.self === win.top) { + tryScroll(); + } + } + + // Fallback if any of the above methods should fail for some odd reason + addEvent(win, 'load', readyHandler); + } + + /** + * This class enables you to bind/unbind native events to elements and normalize it's behavior across browsers. + */ + function EventUtils() { + var self = this, events = {}, count, expando, hasFocusIn, hasMouseEnterLeave, mouseEnterLeave; + + expando = eventExpandoPrefix + (+new Date()).toString(32); + hasMouseEnterLeave = "onmouseenter" in document.documentElement; + hasFocusIn = "onfocusin" in document.documentElement; + mouseEnterLeave = {mouseenter: 'mouseover', mouseleave: 'mouseout'}; + count = 1; + + // State if the DOMContentLoaded was executed or not + self.domLoaded = false; + self.events = events; + + /** + * Executes all event handler callbacks for a specific event. + * + * @private + * @param {Event} evt Event object. + * @param {String} id Expando id value to look for. + */ + function executeHandlers(evt, id) { + var callbackList, i, l, callback, container = events[id]; + + callbackList = container && container[evt.type]; + if (callbackList) { + for (i = 0, l = callbackList.length; i < l; i++) { + callback = callbackList[i]; + + // Check if callback exists might be removed if a unbind is called inside the callback + if (callback && callback.func.call(callback.scope, evt) === false) { + evt.preventDefault(); + } + + // Should we stop propagation to immediate listeners + if (evt.isImmediatePropagationStopped()) { + return; + } + } + } + } + + /** + * Binds a callback to an event on the specified target. + * + * @method bind + * @param {Object} target Target node/window or custom object. + * @param {String} names Name of the event to bind. + * @param {function} callback Callback function to execute when the event occurs. + * @param {Object} scope Scope to call the callback function on, defaults to target. + * @return {function} Callback function that got bound. + */ + self.bind = function(target, names, callback, scope) { + var id, callbackList, i, name, fakeName, nativeHandler, capture, win = window; + + // Native event handler function patches the event and executes the callbacks for the expando + function defaultNativeHandler(evt) { + executeHandlers(fix(evt || win.event), id); + } + + // Don't bind to text nodes or comments + if (!target || target.nodeType === 3 || target.nodeType === 8) { + return; + } + + // Create or get events id for the target + if (!target[expando]) { + id = count++; + target[expando] = id; + events[id] = {}; + } else { + id = target[expando]; + } + + // Setup the specified scope or use the target as a default + scope = scope || target; + + // Split names and bind each event, enables you to bind multiple events with one call + names = names.split(' '); + i = names.length; + while (i--) { + name = names[i]; + nativeHandler = defaultNativeHandler; + fakeName = capture = false; + + // Use ready instead of DOMContentLoaded + if (name === "DOMContentLoaded") { + name = "ready"; + } + + // DOM is already ready + if (self.domLoaded && name === "ready" && target.readyState == 'complete') { + callback.call(scope, fix({type: name})); + continue; + } + + // Handle mouseenter/mouseleaver + if (!hasMouseEnterLeave) { + fakeName = mouseEnterLeave[name]; + + if (fakeName) { + nativeHandler = function(evt) { + var current, related; + + current = evt.currentTarget; + related = evt.relatedTarget; + + // Check if related is inside the current target if it's not then the event should + // be ignored since it's a mouseover/mouseout inside the element + if (related && current.contains) { + // Use contains for performance + related = current.contains(related); + } else { + while (related && related !== current) { + related = related.parentNode; + } + } + + // Fire fake event + if (!related) { + evt = fix(evt || win.event); + evt.type = evt.type === 'mouseout' ? 'mouseleave' : 'mouseenter'; + evt.target = current; + executeHandlers(evt, id); + } + }; + } + } + + // Fake bubbeling of focusin/focusout + if (!hasFocusIn && (name === "focusin" || name === "focusout")) { + capture = true; + fakeName = name === "focusin" ? "focus" : "blur"; + nativeHandler = function(evt) { + evt = fix(evt || win.event); + evt.type = evt.type === 'focus' ? 'focusin' : 'focusout'; + executeHandlers(evt, id); + }; + } + + // Setup callback list and bind native event + callbackList = events[id][name]; + if (!callbackList) { + events[id][name] = callbackList = [{func: callback, scope: scope}]; + callbackList.fakeName = fakeName; + callbackList.capture = capture; + //callbackList.callback = callback; + + // Add the nativeHandler to the callback list so that we can later unbind it + callbackList.nativeHandler = nativeHandler; + + // Check if the target has native events support + + if (name === "ready") { + bindOnReady(target, nativeHandler, self); + } else { + addEvent(target, fakeName || name, nativeHandler, capture); + } + } else { + if (name === "ready" && self.domLoaded) { + callback({type: name}); + } else { + // If it already has an native handler then just push the callback + callbackList.push({func: callback, scope: scope}); + } + } + } + + target = callbackList = 0; // Clean memory for IE + + return callback; + }; + + /** + * Unbinds the specified event by name, name and callback or all events on the target. + * + * @method unbind + * @param {Object} target Target node/window or custom object. + * @param {String} names Optional event name to unbind. + * @param {function} callback Optional callback function to unbind. + * @return {EventUtils} Event utils instance. + */ + self.unbind = function(target, names, callback) { + var id, callbackList, i, ci, name, eventMap; + + // Don't bind to text nodes or comments + if (!target || target.nodeType === 3 || target.nodeType === 8) { + return self; + } + + // Unbind event or events if the target has the expando + id = target[expando]; + if (id) { + eventMap = events[id]; + + // Specific callback + if (names) { + names = names.split(' '); + i = names.length; + while (i--) { + name = names[i]; + callbackList = eventMap[name]; + + // Unbind the event if it exists in the map + if (callbackList) { + // Remove specified callback + if (callback) { + ci = callbackList.length; + while (ci--) { + if (callbackList[ci].func === callback) { + var nativeHandler = callbackList.nativeHandler; + var fakeName = callbackList.fakeName, capture = callbackList.capture; + + // Clone callbackList since unbind inside a callback would otherwise break the handlers loop + callbackList = callbackList.slice(0, ci).concat(callbackList.slice(ci + 1)); + callbackList.nativeHandler = nativeHandler; + callbackList.fakeName = fakeName; + callbackList.capture = capture; + + eventMap[name] = callbackList; + } + } + } + + // Remove all callbacks if there isn't a specified callback or there is no callbacks left + if (!callback || callbackList.length === 0) { + delete eventMap[name]; + removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture); + } + } + } + } else { + // All events for a specific element + for (name in eventMap) { + callbackList = eventMap[name]; + removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture); + } + + eventMap = {}; + } + + // Check if object is empty, if it isn't then we won't remove the expando map + for (name in eventMap) { + return self; + } + + // Delete event object + delete events[id]; + + // Remove expando from target + try { + // IE will fail here since it can't delete properties from window + delete target[expando]; + } catch (ex) { + // IE will set it to null + target[expando] = null; + } + } + + return self; + }; + + /** + * Fires the specified event on the specified target. + * + * @method fire + * @param {Object} target Target node/window or custom object. + * @param {String} name Event name to fire. + * @param {Object} args Optional arguments to send to the observers. + * @return {EventUtils} Event utils instance. + */ + self.fire = function(target, name, args) { + var id; + + // Don't bind to text nodes or comments + if (!target || target.nodeType === 3 || target.nodeType === 8) { + return self; + } + + // Build event object by patching the args + args = fix(null, args); + args.type = name; + args.target = target; + + do { + // Found an expando that means there is listeners to execute + id = target[expando]; + if (id) { + executeHandlers(args, id); + } + + // Walk up the DOM + target = target.parentNode || target.ownerDocument || target.defaultView || target.parentWindow; + } while (target && !args.isPropagationStopped()); + + return self; + }; + + /** + * Removes all bound event listeners for the specified target. This will also remove any bound + * listeners to child nodes within that target. + * + * @method clean + * @param {Object} target Target node/window object. + * @return {EventUtils} Event utils instance. + */ + self.clean = function(target) { + var i, children, unbind = self.unbind; + + // Don't bind to text nodes or comments + if (!target || target.nodeType === 3 || target.nodeType === 8) { + return self; + } + + // Unbind any element on the specificed target + if (target[expando]) { + unbind(target); + } + + // Target doesn't have getElementsByTagName it's probably a window object then use it's document to find the children + if (!target.getElementsByTagName) { + target = target.document; + } + + // Remove events from each child element + if (target && target.getElementsByTagName) { + unbind(target); + + children = target.getElementsByTagName('*'); + i = children.length; + while (i--) { + target = children[i]; + + if (target[expando]) { + unbind(target); + } + } + } + + return self; + }; + + /** + * Destroys the event object. Call this on IE to remove memory leaks. + */ + self.destroy = function() { + events = {}; + }; + + // Legacy function for canceling events + self.cancel = function(e) { + if (e) { + e.preventDefault(); + e.stopImmediatePropagation(); + } + + return false; + }; + } + + EventUtils.Event = new EventUtils(); + EventUtils.Event.bind(window, 'ready', function() {}); + + return EventUtils; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Range.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Range.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,777 @@ +/** + * Range.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +define("tinymce/dom/Range", [ + "tinymce/util/Tools" +], function(Tools) { + // Range constructor + function Range(dom) { + var self = this, + doc = dom.doc, + EXTRACT = 0, + CLONE = 1, + DELETE = 2, + TRUE = true, + FALSE = false, + START_OFFSET = 'startOffset', + START_CONTAINER = 'startContainer', + END_CONTAINER = 'endContainer', + END_OFFSET = 'endOffset', + extend = Tools.extend, + nodeIndex = dom.nodeIndex; + + function createDocumentFragment() { + return doc.createDocumentFragment(); + } + + function setStart(n, o) { + _setEndPoint(TRUE, n, o); + } + + function setEnd(n, o) { + _setEndPoint(FALSE, n, o); + } + + function setStartBefore(n) { + setStart(n.parentNode, nodeIndex(n)); + } + + function setStartAfter(n) { + setStart(n.parentNode, nodeIndex(n) + 1); + } + + function setEndBefore(n) { + setEnd(n.parentNode, nodeIndex(n)); + } + + function setEndAfter(n) { + setEnd(n.parentNode, nodeIndex(n) + 1); + } + + function collapse(ts) { + if (ts) { + self[END_CONTAINER] = self[START_CONTAINER]; + self[END_OFFSET] = self[START_OFFSET]; + } else { + self[START_CONTAINER] = self[END_CONTAINER]; + self[START_OFFSET] = self[END_OFFSET]; + } + + self.collapsed = TRUE; + } + + function selectNode(n) { + setStartBefore(n); + setEndAfter(n); + } + + function selectNodeContents(n) { + setStart(n, 0); + setEnd(n, n.nodeType === 1 ? n.childNodes.length : n.nodeValue.length); + } + + function compareBoundaryPoints(h, r) { + var sc = self[START_CONTAINER], so = self[START_OFFSET], ec = self[END_CONTAINER], eo = self[END_OFFSET], + rsc = r.startContainer, rso = r.startOffset, rec = r.endContainer, reo = r.endOffset; + + // Check START_TO_START + if (h === 0) { + return _compareBoundaryPoints(sc, so, rsc, rso); + } + + // Check START_TO_END + if (h === 1) { + return _compareBoundaryPoints(ec, eo, rsc, rso); + } + + // Check END_TO_END + if (h === 2) { + return _compareBoundaryPoints(ec, eo, rec, reo); + } + + // Check END_TO_START + if (h === 3) { + return _compareBoundaryPoints(sc, so, rec, reo); + } + } + + function deleteContents() { + _traverse(DELETE); + } + + function extractContents() { + return _traverse(EXTRACT); + } + + function cloneContents() { + return _traverse(CLONE); + } + + function insertNode(n) { + var startContainer = this[START_CONTAINER], + startOffset = this[START_OFFSET], nn, o; + + // Node is TEXT_NODE or CDATA + if ((startContainer.nodeType === 3 || startContainer.nodeType === 4) && startContainer.nodeValue) { + if (!startOffset) { + // At the start of text + startContainer.parentNode.insertBefore(n, startContainer); + } else if (startOffset >= startContainer.nodeValue.length) { + // At the end of text + dom.insertAfter(n, startContainer); + } else { + // Middle, need to split + nn = startContainer.splitText(startOffset); + startContainer.parentNode.insertBefore(n, nn); + } + } else { + // Insert element node + if (startContainer.childNodes.length > 0) { + o = startContainer.childNodes[startOffset]; + } + + if (o) { + startContainer.insertBefore(n, o); + } else { + if (startContainer.nodeType == 3) { + dom.insertAfter(n, startContainer); + } else { + startContainer.appendChild(n); + } + } + } + } + + function surroundContents(n) { + var f = self.extractContents(); + + self.insertNode(n); + n.appendChild(f); + self.selectNode(n); + } + + function cloneRange() { + return extend(new Range(dom), { + startContainer: self[START_CONTAINER], + startOffset: self[START_OFFSET], + endContainer: self[END_CONTAINER], + endOffset: self[END_OFFSET], + collapsed: self.collapsed, + commonAncestorContainer: self.commonAncestorContainer + }); + } + + // Private methods + + function _getSelectedNode(container, offset) { + var child; + + if (container.nodeType == 3 /* TEXT_NODE */) { + return container; + } + + if (offset < 0) { + return container; + } + + child = container.firstChild; + while (child && offset > 0) { + --offset; + child = child.nextSibling; + } + + if (child) { + return child; + } + + return container; + } + + function _isCollapsed() { + return (self[START_CONTAINER] == self[END_CONTAINER] && self[START_OFFSET] == self[END_OFFSET]); + } + + function _compareBoundaryPoints(containerA, offsetA, containerB, offsetB) { + var c, offsetC, n, cmnRoot, childA, childB; + + // In the first case the boundary-points have the same container. A is before B + // if its offset is less than the offset of B, A is equal to B if its offset is + // equal to the offset of B, and A is after B if its offset is greater than the + // offset of B. + if (containerA == containerB) { + if (offsetA == offsetB) { + return 0; // equal + } + + if (offsetA < offsetB) { + return -1; // before + } + + return 1; // after + } + + // In the second case a child node C of the container of A is an ancestor + // container of B. In this case, A is before B if the offset of A is less than or + // equal to the index of the child node C and A is after B otherwise. + c = containerB; + while (c && c.parentNode != containerA) { + c = c.parentNode; + } + + if (c) { + offsetC = 0; + n = containerA.firstChild; + + while (n != c && offsetC < offsetA) { + offsetC++; + n = n.nextSibling; + } + + if (offsetA <= offsetC) { + return -1; // before + } + + return 1; // after + } + + // In the third case a child node C of the container of B is an ancestor container + // of A. In this case, A is before B if the index of the child node C is less than + // the offset of B and A is after B otherwise. + c = containerA; + while (c && c.parentNode != containerB) { + c = c.parentNode; + } + + if (c) { + offsetC = 0; + n = containerB.firstChild; + + while (n != c && offsetC < offsetB) { + offsetC++; + n = n.nextSibling; + } + + if (offsetC < offsetB) { + return -1; // before + } + + return 1; // after + } + + // In the fourth case, none of three other cases hold: the containers of A and B + // are siblings or descendants of sibling nodes. In this case, A is before B if + // the container of A is before the container of B in a pre-order traversal of the + // Ranges' context tree and A is after B otherwise. + cmnRoot = dom.findCommonAncestor(containerA, containerB); + childA = containerA; + + while (childA && childA.parentNode != cmnRoot) { + childA = childA.parentNode; + } + + if (!childA) { + childA = cmnRoot; + } + + childB = containerB; + while (childB && childB.parentNode != cmnRoot) { + childB = childB.parentNode; + } + + if (!childB) { + childB = cmnRoot; + } + + if (childA == childB) { + return 0; // equal + } + + n = cmnRoot.firstChild; + while (n) { + if (n == childA) { + return -1; // before + } + + if (n == childB) { + return 1; // after + } + + n = n.nextSibling; + } + } + + function _setEndPoint(st, n, o) { + var ec, sc; + + if (st) { + self[START_CONTAINER] = n; + self[START_OFFSET] = o; + } else { + self[END_CONTAINER] = n; + self[END_OFFSET] = o; + } + + // If one boundary-point of a Range is set to have a root container + // other than the current one for the Range, the Range is collapsed to + // the new position. This enforces the restriction that both boundary- + // points of a Range must have the same root container. + ec = self[END_CONTAINER]; + while (ec.parentNode) { + ec = ec.parentNode; + } + + sc = self[START_CONTAINER]; + while (sc.parentNode) { + sc = sc.parentNode; + } + + if (sc == ec) { + // The start position of a Range is guaranteed to never be after the + // end position. To enforce this restriction, if the start is set to + // be at a position after the end, the Range is collapsed to that + // position. + if (_compareBoundaryPoints(self[START_CONTAINER], self[START_OFFSET], self[END_CONTAINER], self[END_OFFSET]) > 0) { + self.collapse(st); + } + } else { + self.collapse(st); + } + + self.collapsed = _isCollapsed(); + self.commonAncestorContainer = dom.findCommonAncestor(self[START_CONTAINER], self[END_CONTAINER]); + } + + function _traverse(how) { + var c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep; + + if (self[START_CONTAINER] == self[END_CONTAINER]) { + return _traverseSameContainer(how); + } + + for (c = self[END_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) { + if (p == self[START_CONTAINER]) { + return _traverseCommonStartContainer(c, how); + } + + ++endContainerDepth; + } + + for (c = self[START_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) { + if (p == self[END_CONTAINER]) { + return _traverseCommonEndContainer(c, how); + } + + ++startContainerDepth; + } + + depthDiff = startContainerDepth - endContainerDepth; + + startNode = self[START_CONTAINER]; + while (depthDiff > 0) { + startNode = startNode.parentNode; + depthDiff--; + } + + endNode = self[END_CONTAINER]; + while (depthDiff < 0) { + endNode = endNode.parentNode; + depthDiff++; + } + + // ascend the ancestor hierarchy until we have a common parent. + for (sp = startNode.parentNode, ep = endNode.parentNode; sp != ep; sp = sp.parentNode, ep = ep.parentNode) { + startNode = sp; + endNode = ep; + } + + return _traverseCommonAncestors(startNode, endNode, how); + } + + function _traverseSameContainer(how) { + var frag, s, sub, n, cnt, sibling, xferNode, start, len; + + if (how != DELETE) { + frag = createDocumentFragment(); + } + + // If selection is empty, just return the fragment + if (self[START_OFFSET] == self[END_OFFSET]) { + return frag; + } + + // Text node needs special case handling + if (self[START_CONTAINER].nodeType == 3 /* TEXT_NODE */) { + // get the substring + s = self[START_CONTAINER].nodeValue; + sub = s.substring(self[START_OFFSET], self[END_OFFSET]); + + // set the original text node to its new value + if (how != CLONE) { + n = self[START_CONTAINER]; + start = self[START_OFFSET]; + len = self[END_OFFSET] - self[START_OFFSET]; + + if (start === 0 && len >= n.nodeValue.length - 1) { + n.parentNode.removeChild(n); + } else { + n.deleteData(start, len); + } + + // Nothing is partially selected, so collapse to start point + self.collapse(TRUE); + } + + if (how == DELETE) { + return; + } + + if (sub.length > 0) { + frag.appendChild(doc.createTextNode(sub)); + } + + return frag; + } + + // Copy nodes between the start/end offsets. + n = _getSelectedNode(self[START_CONTAINER], self[START_OFFSET]); + cnt = self[END_OFFSET] - self[START_OFFSET]; + + while (n && cnt > 0) { + sibling = n.nextSibling; + xferNode = _traverseFullySelected(n, how); + + if (frag) { + frag.appendChild(xferNode); + } + + --cnt; + n = sibling; + } + + // Nothing is partially selected, so collapse to start point + if (how != CLONE) { + self.collapse(TRUE); + } + + return frag; + } + + function _traverseCommonStartContainer(endAncestor, how) { + var frag, n, endIdx, cnt, sibling, xferNode; + + if (how != DELETE) { + frag = createDocumentFragment(); + } + + n = _traverseRightBoundary(endAncestor, how); + + if (frag) { + frag.appendChild(n); + } + + endIdx = nodeIndex(endAncestor); + cnt = endIdx - self[START_OFFSET]; + + if (cnt <= 0) { + // Collapse to just before the endAncestor, which + // is partially selected. + if (how != CLONE) { + self.setEndBefore(endAncestor); + self.collapse(FALSE); + } + + return frag; + } + + n = endAncestor.previousSibling; + while (cnt > 0) { + sibling = n.previousSibling; + xferNode = _traverseFullySelected(n, how); + + if (frag) { + frag.insertBefore(xferNode, frag.firstChild); + } + + --cnt; + n = sibling; + } + + // Collapse to just before the endAncestor, which + // is partially selected. + if (how != CLONE) { + self.setEndBefore(endAncestor); + self.collapse(FALSE); + } + + return frag; + } + + function _traverseCommonEndContainer(startAncestor, how) { + var frag, startIdx, n, cnt, sibling, xferNode; + + if (how != DELETE) { + frag = createDocumentFragment(); + } + + n = _traverseLeftBoundary(startAncestor, how); + if (frag) { + frag.appendChild(n); + } + + startIdx = nodeIndex(startAncestor); + ++startIdx; // Because we already traversed it + + cnt = self[END_OFFSET] - startIdx; + n = startAncestor.nextSibling; + while (n && cnt > 0) { + sibling = n.nextSibling; + xferNode = _traverseFullySelected(n, how); + + if (frag) { + frag.appendChild(xferNode); + } + + --cnt; + n = sibling; + } + + if (how != CLONE) { + self.setStartAfter(startAncestor); + self.collapse(TRUE); + } + + return frag; + } + + function _traverseCommonAncestors(startAncestor, endAncestor, how) { + var n, frag, startOffset, endOffset, cnt, sibling, nextSibling; + + if (how != DELETE) { + frag = createDocumentFragment(); + } + + n = _traverseLeftBoundary(startAncestor, how); + if (frag) { + frag.appendChild(n); + } + + startOffset = nodeIndex(startAncestor); + endOffset = nodeIndex(endAncestor); + ++startOffset; + + cnt = endOffset - startOffset; + sibling = startAncestor.nextSibling; + + while (cnt > 0) { + nextSibling = sibling.nextSibling; + n = _traverseFullySelected(sibling, how); + + if (frag) { + frag.appendChild(n); + } + + sibling = nextSibling; + --cnt; + } + + n = _traverseRightBoundary(endAncestor, how); + + if (frag) { + frag.appendChild(n); + } + + if (how != CLONE) { + self.setStartAfter(startAncestor); + self.collapse(TRUE); + } + + return frag; + } + + function _traverseRightBoundary(root, how) { + var next = _getSelectedNode(self[END_CONTAINER], self[END_OFFSET] - 1), parent, clonedParent; + var prevSibling, clonedChild, clonedGrandParent, isFullySelected = next != self[END_CONTAINER]; + + if (next == root) { + return _traverseNode(next, isFullySelected, FALSE, how); + } + + parent = next.parentNode; + clonedParent = _traverseNode(parent, FALSE, FALSE, how); + + while (parent) { + while (next) { + prevSibling = next.previousSibling; + clonedChild = _traverseNode(next, isFullySelected, FALSE, how); + + if (how != DELETE) { + clonedParent.insertBefore(clonedChild, clonedParent.firstChild); + } + + isFullySelected = TRUE; + next = prevSibling; + } + + if (parent == root) { + return clonedParent; + } + + next = parent.previousSibling; + parent = parent.parentNode; + + clonedGrandParent = _traverseNode(parent, FALSE, FALSE, how); + + if (how != DELETE) { + clonedGrandParent.appendChild(clonedParent); + } + + clonedParent = clonedGrandParent; + } + } + + function _traverseLeftBoundary(root, how) { + var next = _getSelectedNode(self[START_CONTAINER], self[START_OFFSET]), isFullySelected = next != self[START_CONTAINER]; + var parent, clonedParent, nextSibling, clonedChild, clonedGrandParent; + + if (next == root) { + return _traverseNode(next, isFullySelected, TRUE, how); + } + + parent = next.parentNode; + clonedParent = _traverseNode(parent, FALSE, TRUE, how); + + while (parent) { + while (next) { + nextSibling = next.nextSibling; + clonedChild = _traverseNode(next, isFullySelected, TRUE, how); + + if (how != DELETE) { + clonedParent.appendChild(clonedChild); + } + + isFullySelected = TRUE; + next = nextSibling; + } + + if (parent == root) { + return clonedParent; + } + + next = parent.nextSibling; + parent = parent.parentNode; + + clonedGrandParent = _traverseNode(parent, FALSE, TRUE, how); + + if (how != DELETE) { + clonedGrandParent.appendChild(clonedParent); + } + + clonedParent = clonedGrandParent; + } + } + + function _traverseNode(n, isFullySelected, isLeft, how) { + var txtValue, newNodeValue, oldNodeValue, offset, newNode; + + if (isFullySelected) { + return _traverseFullySelected(n, how); + } + + if (n.nodeType == 3 /* TEXT_NODE */) { + txtValue = n.nodeValue; + + if (isLeft) { + offset = self[START_OFFSET]; + newNodeValue = txtValue.substring(offset); + oldNodeValue = txtValue.substring(0, offset); + } else { + offset = self[END_OFFSET]; + newNodeValue = txtValue.substring(0, offset); + oldNodeValue = txtValue.substring(offset); + } + + if (how != CLONE) { + n.nodeValue = oldNodeValue; + } + + if (how == DELETE) { + return; + } + + newNode = dom.clone(n, FALSE); + newNode.nodeValue = newNodeValue; + + return newNode; + } + + if (how == DELETE) { + return; + } + + return dom.clone(n, FALSE); + } + + function _traverseFullySelected(n, how) { + if (how != DELETE) { + return how == CLONE ? dom.clone(n, TRUE) : n; + } + + n.parentNode.removeChild(n); + } + + function toStringIE() { + return dom.create('body', null, cloneContents()).outerText; + } + + extend(self, { + // Inital states + startContainer: doc, + startOffset: 0, + endContainer: doc, + endOffset: 0, + collapsed: TRUE, + commonAncestorContainer: doc, + + // Range constants + START_TO_START: 0, + START_TO_END: 1, + END_TO_END: 2, + END_TO_START: 3, + + // Public methods + setStart: setStart, + setEnd: setEnd, + setStartBefore: setStartBefore, + setStartAfter: setStartAfter, + setEndBefore: setEndBefore, + setEndAfter: setEndAfter, + collapse: collapse, + selectNode: selectNode, + selectNodeContents: selectNodeContents, + compareBoundaryPoints: compareBoundaryPoints, + deleteContents: deleteContents, + extractContents: extractContents, + cloneContents: cloneContents, + insertNode: insertNode, + surroundContents: surroundContents, + cloneRange: cloneRange, + toStringIE: toStringIE + }); + + return self; + } + + // Older IE versions doesn't let you override toString by it's constructor so we have to stick it in the prototype + Range.prototype.toString = function() { + return this.toStringIE(); + }; + + return Range; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/RangeUtils.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/RangeUtils.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,540 @@ +/** + * RangeUtils.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class contains a few utility methods for ranges. + * + * @class tinymce.dom.RangeUtils + */ +define("tinymce/dom/RangeUtils", [ + "tinymce/util/Tools", + "tinymce/dom/TreeWalker" +], function(Tools, TreeWalker) { + var each = Tools.each; + + function getEndChild(container, index) { + var childNodes = container.childNodes; + + index--; + + if (index > childNodes.length - 1) { + index = childNodes.length - 1; + } else if (index < 0) { + index = 0; + } + + return childNodes[index] || container; + } + + function RangeUtils(dom) { + /** + * Walks the specified range like object and executes the callback for each sibling collection it finds. + * + * @method walk + * @param {Object} rng Range like object. + * @param {function} callback Callback function to execute for each sibling collection. + */ + this.walk = function(rng, callback) { + var startContainer = rng.startContainer, + startOffset = rng.startOffset, + endContainer = rng.endContainer, + endOffset = rng.endOffset, + ancestor, startPoint, + endPoint, node, parent, siblings, nodes; + + // Handle table cell selection the table plugin enables + // you to fake select table cells and perform formatting actions on them + nodes = dom.select('td.mce-item-selected,th.mce-item-selected'); + if (nodes.length > 0) { + each(nodes, function(node) { + callback([node]); + }); + + return; + } + + /** + * Excludes start/end text node if they are out side the range + * + * @private + * @param {Array} nodes Nodes to exclude items from. + * @return {Array} Array with nodes excluding the start/end container if needed. + */ + function exclude(nodes) { + var node; + + // First node is excluded + node = nodes[0]; + if (node.nodeType === 3 && node === startContainer && startOffset >= node.nodeValue.length) { + nodes.splice(0, 1); + } + + // Last node is excluded + node = nodes[nodes.length - 1]; + if (endOffset === 0 && nodes.length > 0 && node === endContainer && node.nodeType === 3) { + nodes.splice(nodes.length - 1, 1); + } + + return nodes; + } + + /** + * Collects siblings + * + * @private + * @param {Node} node Node to collect siblings from. + * @param {String} name Name of the sibling to check for. + * @return {Array} Array of collected siblings. + */ + function collectSiblings(node, name, end_node) { + var siblings = []; + + for (; node && node != end_node; node = node[name]) { + siblings.push(node); + } + + return siblings; + } + + /** + * Find an end point this is the node just before the common ancestor root. + * + * @private + * @param {Node} node Node to start at. + * @param {Node} root Root/ancestor element to stop just before. + * @return {Node} Node just before the root element. + */ + function findEndPoint(node, root) { + do { + if (node.parentNode == root) { + return node; + } + + node = node.parentNode; + } while (node); + } + + function walkBoundary(start_node, end_node, next) { + var siblingName = next ? 'nextSibling' : 'previousSibling'; + + for (node = start_node, parent = node.parentNode; node && node != end_node; node = parent) { + parent = node.parentNode; + siblings = collectSiblings(node == start_node ? node : node[siblingName], siblingName); + + if (siblings.length) { + if (!next) { + siblings.reverse(); + } + + callback(exclude(siblings)); + } + } + } + + // If index based start position then resolve it + if (startContainer.nodeType == 1 && startContainer.hasChildNodes()) { + startContainer = startContainer.childNodes[startOffset]; + } + + // If index based end position then resolve it + if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) { + endContainer = getEndChild(endContainer, endOffset); + } + + // Same container + if (startContainer == endContainer) { + return callback(exclude([startContainer])); + } + + // Find common ancestor and end points + ancestor = dom.findCommonAncestor(startContainer, endContainer); + + // Process left side + for (node = startContainer; node; node = node.parentNode) { + if (node === endContainer) { + return walkBoundary(startContainer, ancestor, true); + } + + if (node === ancestor) { + break; + } + } + + // Process right side + for (node = endContainer; node; node = node.parentNode) { + if (node === startContainer) { + return walkBoundary(endContainer, ancestor); + } + + if (node === ancestor) { + break; + } + } + + // Find start/end point + startPoint = findEndPoint(startContainer, ancestor) || startContainer; + endPoint = findEndPoint(endContainer, ancestor) || endContainer; + + // Walk left leaf + walkBoundary(startContainer, startPoint, true); + + // Walk the middle from start to end point + siblings = collectSiblings( + startPoint == startContainer ? startPoint : startPoint.nextSibling, + 'nextSibling', + endPoint == endContainer ? endPoint.nextSibling : endPoint + ); + + if (siblings.length) { + callback(exclude(siblings)); + } + + // Walk right leaf + walkBoundary(endContainer, endPoint); + }; + + /** + * Splits the specified range at it's start/end points. + * + * @private + * @param {Range/RangeObject} rng Range to split. + * @return {Object} Range position object. + */ + this.split = function(rng) { + var startContainer = rng.startContainer, + startOffset = rng.startOffset, + endContainer = rng.endContainer, + endOffset = rng.endOffset; + + function splitText(node, offset) { + return node.splitText(offset); + } + + // Handle single text node + if (startContainer == endContainer && startContainer.nodeType == 3) { + if (startOffset > 0 && startOffset < startContainer.nodeValue.length) { + endContainer = splitText(startContainer, startOffset); + startContainer = endContainer.previousSibling; + + if (endOffset > startOffset) { + endOffset = endOffset - startOffset; + startContainer = endContainer = splitText(endContainer, endOffset).previousSibling; + endOffset = endContainer.nodeValue.length; + startOffset = 0; + } else { + endOffset = 0; + } + } + } else { + // Split startContainer text node if needed + if (startContainer.nodeType == 3 && startOffset > 0 && startOffset < startContainer.nodeValue.length) { + startContainer = splitText(startContainer, startOffset); + startOffset = 0; + } + + // Split endContainer text node if needed + if (endContainer.nodeType == 3 && endOffset > 0 && endOffset < endContainer.nodeValue.length) { + endContainer = splitText(endContainer, endOffset).previousSibling; + endOffset = endContainer.nodeValue.length; + } + } + + return { + startContainer: startContainer, + startOffset: startOffset, + endContainer: endContainer, + endOffset: endOffset + }; + }; + + /** + * Normalizes the specified range by finding the closest best suitable caret location. + * + * @private + * @param {Range} rng Range to normalize. + * @return {Boolean} True/false if the specified range was normalized or not. + */ + this.normalize = function(rng) { + var normalized, collapsed; + + function normalizeEndPoint(start) { + var container, offset, walker, body = dom.getRoot(), node, nonEmptyElementsMap; + var directionLeft, isAfterNode; + + function hasBrBeforeAfter(node, left) { + var walker = new TreeWalker(node, dom.getParent(node.parentNode, dom.isBlock) || body); + + while ((node = walker[left ? 'prev' : 'next']())) { + if (node.nodeName === "BR") { + return true; + } + } + } + + function isPrevNode(node, name) { + return node.previousSibling && node.previousSibling.nodeName == name; + } + + // Walks the dom left/right to find a suitable text node to move the endpoint into + // It will only walk within the current parent block or body and will stop if it hits a block or a BR/IMG + function findTextNodeRelative(left, startNode) { + var walker, lastInlineElement, parentBlockContainer; + + startNode = startNode || container; + parentBlockContainer = dom.getParent(startNode.parentNode, dom.isBlock) || body; + + // Lean left before the BR element if it's the only BR within a block element. Gecko bug: #6680 + // This:


|

becomes

|

+ if (left && startNode.nodeName == 'BR' && isAfterNode && dom.isEmpty(parentBlockContainer)) { + container = startNode.parentNode; + offset = dom.nodeIndex(startNode); + normalized = true; + return; + } + + // Walk left until we hit a text node we can move to or a block/br/img + walker = new TreeWalker(startNode, parentBlockContainer); + while ((node = walker[left ? 'prev' : 'next']())) { + // Break if we hit a non content editable node + if (dom.getContentEditableParent(node) === "false") { + return; + } + + // Found text node that has a length + if (node.nodeType === 3 && node.nodeValue.length > 0) { + container = node; + offset = left ? node.nodeValue.length : 0; + normalized = true; + return; + } + + // Break if we find a block or a BR/IMG/INPUT etc + if (dom.isBlock(node) || nonEmptyElementsMap[node.nodeName.toLowerCase()]) { + return; + } + + lastInlineElement = node; + } + + // Only fetch the last inline element when in caret mode for now + if (collapsed && lastInlineElement) { + container = lastInlineElement; + normalized = true; + offset = 0; + } + } + + container = rng[(start ? 'start' : 'end') + 'Container']; + offset = rng[(start ? 'start' : 'end') + 'Offset']; + isAfterNode = container.nodeType == 1 && offset === container.childNodes.length; + nonEmptyElementsMap = dom.schema.getNonEmptyElements(); + directionLeft = start; + + if (container.nodeType == 1 && offset > container.childNodes.length - 1) { + directionLeft = false; + } + + // If the container is a document move it to the body element + if (container.nodeType === 9) { + container = dom.getRoot(); + offset = 0; + } + + // If the container is body try move it into the closest text node or position + if (container === body) { + // If start is before/after a image, table etc + if (directionLeft) { + node = container.childNodes[offset > 0 ? offset - 1 : 0]; + if (node) { + if (nonEmptyElementsMap[node.nodeName] || node.nodeName == "TABLE") { + return; + } + } + } + + // Resolve the index + if (container.hasChildNodes()) { + offset = Math.min(!directionLeft && offset > 0 ? offset - 1 : offset, container.childNodes.length - 1); + container = container.childNodes[offset]; + offset = 0; + + // Don't walk into elements that doesn't have any child nodes like a IMG + if (container.hasChildNodes() && !/TABLE/.test(container.nodeName)) { + // Walk the DOM to find a text node to place the caret at or a BR + node = container; + walker = new TreeWalker(container, body); + + do { + // Found a text node use that position + if (node.nodeType === 3 && node.nodeValue.length > 0) { + offset = directionLeft ? 0 : node.nodeValue.length; + container = node; + normalized = true; + break; + } + + // Found a BR/IMG element that we can place the caret before + if (nonEmptyElementsMap[node.nodeName.toLowerCase()]) { + offset = dom.nodeIndex(node); + container = node.parentNode; + + // Put caret after image when moving the end point + if (node.nodeName == "IMG" && !directionLeft) { + offset++; + } + + normalized = true; + break; + } + } while ((node = (directionLeft ? walker.next() : walker.prev()))); + } + } + } + + // Lean the caret to the left if possible + if (collapsed) { + // So this: x|x + // Becomes: x|x + // Seems that only gecko has issues with this + if (container.nodeType === 3 && offset === 0) { + findTextNodeRelative(true); + } + + // Lean left into empty inline elements when the caret is before a BR + // So this: |
+ // Becomes: |
+ // Seems that only gecko has issues with this. + // Special edge case for

x|

since we don't want

x|

+ if (container.nodeType === 1) { + node = container.childNodes[offset]; + + // Offset is after the containers last child + // then use the previous child for normalization + if (!node) { + node = container.childNodes[offset - 1]; + } + + if (node && node.nodeName === 'BR' && !isPrevNode(node, 'A') && + !hasBrBeforeAfter(node) && !hasBrBeforeAfter(node, true)) { + findTextNodeRelative(true, node); + } + } + } + + // Lean the start of the selection right if possible + // So this: x[x] + // Becomes: x[x] + if (directionLeft && !collapsed && container.nodeType === 3 && offset === container.nodeValue.length) { + findTextNodeRelative(false); + } + + // Set endpoint if it was normalized + if (normalized) { + rng['set' + (start ? 'Start' : 'End')](container, offset); + } + } + + collapsed = rng.collapsed; + + normalizeEndPoint(true); + + if (!collapsed) { + normalizeEndPoint(); + } + + // If it was collapsed then make sure it still is + if (normalized && collapsed) { + rng.collapse(true); + } + + return normalized; + }; + } + + /** + * Compares two ranges and checks if they are equal. + * + * @static + * @method compareRanges + * @param {DOMRange} rng1 First range to compare. + * @param {DOMRange} rng2 First range to compare. + * @return {Boolean} true/false if the ranges are equal. + */ + RangeUtils.compareRanges = function(rng1, rng2) { + if (rng1 && rng2) { + // Compare native IE ranges + if (rng1.item || rng1.duplicate) { + // Both are control ranges and the selected element matches + if (rng1.item && rng2.item && rng1.item(0) === rng2.item(0)) { + return true; + } + + // Both are text ranges and the range matches + if (rng1.isEqual && rng2.isEqual && rng2.isEqual(rng1)) { + return true; + } + } else { + // Compare w3c ranges + return rng1.startContainer == rng2.startContainer && rng1.startOffset == rng2.startOffset; + } + } + + return false; + }; + + /** + * Gets the caret range for the given x/y location. + * + * @static + * @method getCaretRangeFromPoint + * @param {Number} x X coordinate for range + * @param {Number} y Y coordinate for range + * @param {Document} doc Document that x/y are relative to + * @returns {Range} caret range + */ + RangeUtils.getCaretRangeFromPoint = function(x, y, doc) { + var rng, point; + + if (doc.caretPositionFromPoint) { + point = doc.caretPositionFromPoint(x, y); + rng = doc.createRange(); + rng.setStart(point.offsetNode, point.offset); + rng.collapse(true); + } else if (doc.caretRangeFromPoint) { + rng = doc.caretRangeFromPoint(x, y); + } else if (doc.body.createTextRange) { + rng = doc.body.createTextRange(); + + try { + rng.moveToPoint(x, y); + rng.collapse(true); + } catch (ex) { + // Append to top or bottom depending on drop location + rng.collapse(y < doc.body.clientHeight); + } + } + + return rng; + }; + + RangeUtils.getNode = function(container, offset) { + if (container.nodeType == 1 && container.hasChildNodes()) { + if (offset >= container.childNodes.length) { + offset = container.childNodes.length - 1; + } + + container = container.childNodes[offset]; + } + + return container; + }; + + return RangeUtils; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/ScriptLoader.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/ScriptLoader.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,255 @@ +/** + * ScriptLoader.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*globals console*/ + +/** + * This class handles asynchronous/synchronous loading of JavaScript files it will execute callbacks + * when various items gets loaded. This class is useful to load external JavaScript files. + * + * @class tinymce.dom.ScriptLoader + * @example + * // Load a script from a specific URL using the global script loader + * tinymce.ScriptLoader.load('somescript.js'); + * + * // Load a script using a unique instance of the script loader + * var scriptLoader = new tinymce.dom.ScriptLoader(); + * + * scriptLoader.load('somescript.js'); + * + * // Load multiple scripts + * var scriptLoader = new tinymce.dom.ScriptLoader(); + * + * scriptLoader.add('somescript1.js'); + * scriptLoader.add('somescript2.js'); + * scriptLoader.add('somescript3.js'); + * + * scriptLoader.loadQueue(function() { + * alert('All scripts are now loaded.'); + * }); + */ +define("tinymce/dom/ScriptLoader", [ + "tinymce/dom/DOMUtils", + "tinymce/util/Tools" +], function(DOMUtils, Tools) { + var DOM = DOMUtils.DOM; + var each = Tools.each, grep = Tools.grep; + + function ScriptLoader() { + var QUEUED = 0, + LOADING = 1, + LOADED = 2, + states = {}, + queue = [], + scriptLoadedCallbacks = {}, + queueLoadedCallbacks = [], + loading = 0, + undef; + + /** + * Loads a specific script directly without adding it to the load queue. + * + * @method load + * @param {String} url Absolute URL to script to add. + * @param {function} callback Optional callback function to execute ones this script gets loaded. + * @param {Object} scope Optional scope to execute callback in. + */ + function loadScript(url, callback) { + var dom = DOM, elm, id; + + // Execute callback when script is loaded + function done() { + dom.remove(id); + + if (elm) { + elm.onreadystatechange = elm.onload = elm = null; + } + + callback(); + } + + function error() { + /*eslint no-console:0 */ + + // Report the error so it's easier for people to spot loading errors + if (typeof console !== "undefined" && console.log) { + console.log("Failed to load: " + url); + } + + // We can't mark it as done if there is a load error since + // A) We don't want to produce 404 errors on the server and + // B) the onerror event won't fire on all browsers. + // done(); + } + + id = dom.uniqueId(); + + // Create new script element + elm = document.createElement('script'); + elm.id = id; + elm.type = 'text/javascript'; + elm.src = Tools._addCacheSuffix(url); + + // Seems that onreadystatechange works better on IE 10 onload seems to fire incorrectly + if ("onreadystatechange" in elm) { + elm.onreadystatechange = function() { + if (/loaded|complete/.test(elm.readyState)) { + done(); + } + }; + } else { + elm.onload = done; + } + + // Add onerror event will get fired on some browsers but not all of them + elm.onerror = error; + + // Add script to document + (document.getElementsByTagName('head')[0] || document.body).appendChild(elm); + } + + /** + * Returns true/false if a script has been loaded or not. + * + * @method isDone + * @param {String} url URL to check for. + * @return {Boolean} true/false if the URL is loaded. + */ + this.isDone = function(url) { + return states[url] == LOADED; + }; + + /** + * Marks a specific script to be loaded. This can be useful if a script got loaded outside + * the script loader or to skip it from loading some script. + * + * @method markDone + * @param {string} u Absolute URL to the script to mark as loaded. + */ + this.markDone = function(url) { + states[url] = LOADED; + }; + + /** + * Adds a specific script to the load queue of the script loader. + * + * @method add + * @param {String} url Absolute URL to script to add. + * @param {function} callback Optional callback function to execute ones this script gets loaded. + * @param {Object} scope Optional scope to execute callback in. + */ + this.add = this.load = function(url, callback, scope) { + var state = states[url]; + + // Add url to load queue + if (state == undef) { + queue.push(url); + states[url] = QUEUED; + } + + if (callback) { + // Store away callback for later execution + if (!scriptLoadedCallbacks[url]) { + scriptLoadedCallbacks[url] = []; + } + + scriptLoadedCallbacks[url].push({ + func: callback, + scope: scope || this + }); + } + }; + + /** + * Starts the loading of the queue. + * + * @method loadQueue + * @param {function} callback Optional callback to execute when all queued items are loaded. + * @param {Object} scope Optional scope to execute the callback in. + */ + this.loadQueue = function(callback, scope) { + this.loadScripts(queue, callback, scope); + }; + + /** + * Loads the specified queue of files and executes the callback ones they are loaded. + * This method is generally not used outside this class but it might be useful in some scenarios. + * + * @method loadScripts + * @param {Array} scripts Array of queue items to load. + * @param {function} callback Optional callback to execute ones all items are loaded. + * @param {Object} scope Optional scope to execute callback in. + */ + this.loadScripts = function(scripts, callback, scope) { + var loadScripts; + + function execScriptLoadedCallbacks(url) { + // Execute URL callback functions + each(scriptLoadedCallbacks[url], function(callback) { + callback.func.call(callback.scope); + }); + + scriptLoadedCallbacks[url] = undef; + } + + queueLoadedCallbacks.push({ + func: callback, + scope: scope || this + }); + + loadScripts = function() { + var loadingScripts = grep(scripts); + + // Current scripts has been handled + scripts.length = 0; + + // Load scripts that needs to be loaded + each(loadingScripts, function(url) { + // Script is already loaded then execute script callbacks directly + if (states[url] == LOADED) { + execScriptLoadedCallbacks(url); + return; + } + + // Is script not loading then start loading it + if (states[url] != LOADING) { + states[url] = LOADING; + loading++; + + loadScript(url, function() { + states[url] = LOADED; + loading--; + + execScriptLoadedCallbacks(url); + + // Load more scripts if they where added by the recently loaded script + loadScripts(); + }); + } + }); + + // No scripts are currently loading then execute all pending queue loaded callbacks + if (!loading) { + each(queueLoadedCallbacks, function(callback) { + callback.func.call(callback.scope); + }); + + queueLoadedCallbacks.length = 0; + } + }; + + loadScripts(); + }; + } + + ScriptLoader.ScriptLoader = new ScriptLoader(); + + return ScriptLoader; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Selection.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Selection.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,990 @@ +/** + * Selection.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles text and control selection it's an crossbrowser utility class. + * Consult the TinyMCE Wiki API for more details and examples on how to use this class. + * + * @class tinymce.dom.Selection + * @example + * // Getting the currently selected node for the active editor + * alert(tinymce.activeEditor.selection.getNode().nodeName); + */ +define("tinymce/dom/Selection", [ + "tinymce/dom/TreeWalker", + "tinymce/dom/TridentSelection", + "tinymce/dom/ControlSelection", + "tinymce/dom/RangeUtils", + "tinymce/dom/BookmarkManager", + "tinymce/Env", + "tinymce/util/Tools" +], function(TreeWalker, TridentSelection, ControlSelection, RangeUtils, BookmarkManager, Env, Tools) { + var each = Tools.each, trim = Tools.trim; + var isIE = Env.ie; + + /** + * Constructs a new selection instance. + * + * @constructor + * @method Selection + * @param {tinymce.dom.DOMUtils} dom DOMUtils object reference. + * @param {Window} win Window to bind the selection object to. + * @param {tinymce.dom.Serializer} serializer DOM serialization class to use for getContent. + */ + function Selection(dom, win, serializer, editor) { + var self = this; + + self.dom = dom; + self.win = win; + self.serializer = serializer; + self.editor = editor; + self.bookmarkManager = new BookmarkManager(self); + self.controlSelection = new ControlSelection(self, editor); + + // No W3C Range support + if (!self.win.getSelection) { + self.tridentSel = new TridentSelection(self); + } + } + + Selection.prototype = { + /** + * Move the selection cursor range to the specified node and offset. + * If there is no node specified it will move it to the first suitable location within the body. + * + * @method setCursorLocation + * @param {Node} node Optional node to put the cursor in. + * @param {Number} offset Optional offset from the start of the node to put the cursor at. + */ + setCursorLocation: function(node, offset) { + var self = this, rng = self.dom.createRng(); + + if (!node) { + self._moveEndPoint(rng, self.editor.getBody(), true); + self.setRng(rng); + } else { + rng.setStart(node, offset); + rng.setEnd(node, offset); + self.setRng(rng); + self.collapse(false); + } + }, + + /** + * Returns the selected contents using the DOM serializer passed in to this class. + * + * @method getContent + * @param {Object} s Optional settings class with for example output format text or html. + * @return {String} Selected contents in for example HTML format. + * @example + * // Alerts the currently selected contents + * alert(tinymce.activeEditor.selection.getContent()); + * + * // Alerts the currently selected contents as plain text + * alert(tinymce.activeEditor.selection.getContent({format: 'text'})); + */ + getContent: function(args) { + var self = this, rng = self.getRng(), tmpElm = self.dom.create("body"); + var se = self.getSel(), whiteSpaceBefore, whiteSpaceAfter, fragment; + + args = args || {}; + whiteSpaceBefore = whiteSpaceAfter = ''; + args.get = true; + args.format = args.format || 'html'; + args.selection = true; + self.editor.fire('BeforeGetContent', args); + + if (args.format == 'text') { + return self.isCollapsed() ? '' : (rng.text || (se.toString ? se.toString() : '')); + } + + if (rng.cloneContents) { + fragment = rng.cloneContents(); + + if (fragment) { + tmpElm.appendChild(fragment); + } + } else if (rng.item !== undefined || rng.htmlText !== undefined) { + // IE will produce invalid markup if elements are present that + // it doesn't understand like custom elements or HTML5 elements. + // Adding a BR in front of the contents and then remoiving it seems to fix it though. + tmpElm.innerHTML = '
' + (rng.item ? rng.item(0).outerHTML : rng.htmlText); + tmpElm.removeChild(tmpElm.firstChild); + } else { + tmpElm.innerHTML = rng.toString(); + } + + // Keep whitespace before and after + if (/^\s/.test(tmpElm.innerHTML)) { + whiteSpaceBefore = ' '; + } + + if (/\s+$/.test(tmpElm.innerHTML)) { + whiteSpaceAfter = ' '; + } + + args.getInner = true; + + args.content = self.isCollapsed() ? '' : whiteSpaceBefore + self.serializer.serialize(tmpElm, args) + whiteSpaceAfter; + self.editor.fire('GetContent', args); + + return args.content; + }, + + /** + * Sets the current selection to the specified content. If any contents is selected it will be replaced + * with the contents passed in to this function. If there is no selection the contents will be inserted + * where the caret is placed in the editor/page. + * + * @method setContent + * @param {String} content HTML contents to set could also be other formats depending on settings. + * @param {Object} args Optional settings object with for example data format. + * @example + * // Inserts some HTML contents at the current selection + * tinymce.activeEditor.selection.setContent('Some contents'); + */ + setContent: function(content, args) { + var self = this, rng = self.getRng(), caretNode, doc = self.win.document, frag, temp; + + args = args || {format: 'html'}; + args.set = true; + args.selection = true; + content = args.content = content; + + // Dispatch before set content event + if (!args.no_events) { + self.editor.fire('BeforeSetContent', args); + } + + content = args.content; + + if (rng.insertNode) { + // Make caret marker since insertNode places the caret in the beginning of text after insert + content += '_'; + + // Delete and insert new node + if (rng.startContainer == doc && rng.endContainer == doc) { + // WebKit will fail if the body is empty since the range is then invalid and it can't insert contents + doc.body.innerHTML = content; + } else { + rng.deleteContents(); + + if (doc.body.childNodes.length === 0) { + doc.body.innerHTML = content; + } else { + // createContextualFragment doesn't exists in IE 9 DOMRanges + if (rng.createContextualFragment) { + rng.insertNode(rng.createContextualFragment(content)); + } else { + // Fake createContextualFragment call in IE 9 + frag = doc.createDocumentFragment(); + temp = doc.createElement('div'); + + frag.appendChild(temp); + temp.outerHTML = content; + + rng.insertNode(frag); + } + } + } + + // Move to caret marker + caretNode = self.dom.get('__caret'); + + // Make sure we wrap it compleatly, Opera fails with a simple select call + rng = doc.createRange(); + rng.setStartBefore(caretNode); + rng.setEndBefore(caretNode); + self.setRng(rng); + + // Remove the caret position + self.dom.remove('__caret'); + + try { + self.setRng(rng); + } catch (ex) { + // Might fail on Opera for some odd reason + } + } else { + if (rng.item) { + // Delete content and get caret text selection + doc.execCommand('Delete', false, null); + rng = self.getRng(); + } + + // Explorer removes spaces from the beginning of pasted contents + if (/^\s+/.test(content)) { + rng.pasteHTML('_' + content); + self.dom.remove('__mce_tmp'); + } else { + rng.pasteHTML(content); + } + } + + // Dispatch set content event + if (!args.no_events) { + self.editor.fire('SetContent', args); + } + }, + + /** + * Returns the start element of a selection range. If the start is in a text + * node the parent element will be returned. + * + * @method getStart + * @param {Boolean} real Optional state to get the real parent when the selection is collapsed not the closest element. + * @return {Element} Start element of selection range. + */ + getStart: function(real) { + var self = this, rng = self.getRng(), startElement, parentElement, checkRng, node; + + if (rng.duplicate || rng.item) { + // Control selection, return first item + if (rng.item) { + return rng.item(0); + } + + // Get start element + checkRng = rng.duplicate(); + checkRng.collapse(1); + startElement = checkRng.parentElement(); + if (startElement.ownerDocument !== self.dom.doc) { + startElement = self.dom.getRoot(); + } + + // Check if range parent is inside the start element, then return the inner parent element + // This will fix issues when a single element is selected, IE would otherwise return the wrong start element + parentElement = node = rng.parentElement(); + while ((node = node.parentNode)) { + if (node == startElement) { + startElement = parentElement; + break; + } + } + + return startElement; + } else { + startElement = rng.startContainer; + + if (startElement.nodeType == 1 && startElement.hasChildNodes()) { + if (!real || !rng.collapsed) { + startElement = startElement.childNodes[Math.min(startElement.childNodes.length - 1, rng.startOffset)]; + } + } + + if (startElement && startElement.nodeType == 3) { + return startElement.parentNode; + } + + return startElement; + } + }, + + /** + * Returns the end element of a selection range. If the end is in a text + * node the parent element will be returned. + * + * @method getEnd + * @param {Boolean} real Optional state to get the real parent when the selection is collapsed not the closest element. + * @return {Element} End element of selection range. + */ + getEnd: function(real) { + var self = this, rng = self.getRng(), endElement, endOffset; + + if (rng.duplicate || rng.item) { + if (rng.item) { + return rng.item(0); + } + + rng = rng.duplicate(); + rng.collapse(0); + endElement = rng.parentElement(); + if (endElement.ownerDocument !== self.dom.doc) { + endElement = self.dom.getRoot(); + } + + if (endElement && endElement.nodeName == 'BODY') { + return endElement.lastChild || endElement; + } + + return endElement; + } else { + endElement = rng.endContainer; + endOffset = rng.endOffset; + + if (endElement.nodeType == 1 && endElement.hasChildNodes()) { + if (!real || !rng.collapsed) { + endElement = endElement.childNodes[endOffset > 0 ? endOffset - 1 : endOffset]; + } + } + + if (endElement && endElement.nodeType == 3) { + return endElement.parentNode; + } + + return endElement; + } + }, + + /** + * Returns a bookmark location for the current selection. This bookmark object + * can then be used to restore the selection after some content modification to the document. + * + * @method getBookmark + * @param {Number} type Optional state if the bookmark should be simple or not. Default is complex. + * @param {Boolean} normalized Optional state that enables you to get a position that it would be after normalization. + * @return {Object} Bookmark object, use moveToBookmark with this object to restore the selection. + * @example + * // Stores a bookmark of the current selection + * var bm = tinymce.activeEditor.selection.getBookmark(); + * + * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content'); + * + * // Restore the selection bookmark + * tinymce.activeEditor.selection.moveToBookmark(bm); + */ + getBookmark: function(type, normalized) { + return this.bookmarkManager.getBookmark(type, normalized); + }, + + /** + * Restores the selection to the specified bookmark. + * + * @method moveToBookmark + * @param {Object} bookmark Bookmark to restore selection from. + * @return {Boolean} true/false if it was successful or not. + * @example + * // Stores a bookmark of the current selection + * var bm = tinymce.activeEditor.selection.getBookmark(); + * + * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content'); + * + * // Restore the selection bookmark + * tinymce.activeEditor.selection.moveToBookmark(bm); + */ + moveToBookmark: function(bookmark) { + return this.bookmarkManager.moveToBookmark(bookmark); + }, + + /** + * Selects the specified element. This will place the start and end of the selection range around the element. + * + * @method select + * @param {Element} node HMTL DOM element to select. + * @param {Boolean} content Optional bool state if the contents should be selected or not on non IE browser. + * @return {Element} Selected element the same element as the one that got passed in. + * @example + * // Select the first paragraph in the active editor + * tinymce.activeEditor.selection.select(tinymce.activeEditor.dom.select('p')[0]); + */ + select: function(node, content) { + var self = this, dom = self.dom, rng = dom.createRng(), idx; + + // Clear stored range set by FocusManager + self.lastFocusBookmark = null; + + if (node) { + if (!content && self.controlSelection.controlSelect(node)) { + return; + } + + idx = dom.nodeIndex(node); + rng.setStart(node.parentNode, idx); + rng.setEnd(node.parentNode, idx + 1); + + // Find first/last text node or BR element + if (content) { + self._moveEndPoint(rng, node, true); + self._moveEndPoint(rng, node); + } + + self.setRng(rng); + } + + return node; + }, + + /** + * Returns true/false if the selection range is collapsed or not. Collapsed means if it's a caret or a larger selection. + * + * @method isCollapsed + * @return {Boolean} true/false state if the selection range is collapsed or not. + * Collapsed means if it's a caret or a larger selection. + */ + isCollapsed: function() { + var self = this, rng = self.getRng(), sel = self.getSel(); + + if (!rng || rng.item) { + return false; + } + + if (rng.compareEndPoints) { + return rng.compareEndPoints('StartToEnd', rng) === 0; + } + + return !sel || rng.collapsed; + }, + + /** + * Collapse the selection to start or end of range. + * + * @method collapse + * @param {Boolean} toStart Optional boolean state if to collapse to end or not. Defaults to start. + */ + collapse: function(toStart) { + var self = this, rng = self.getRng(), node; + + // Control range on IE + if (rng.item) { + node = rng.item(0); + rng = self.win.document.body.createTextRange(); + rng.moveToElementText(node); + } + + rng.collapse(!!toStart); + self.setRng(rng); + }, + + /** + * Returns the browsers internal selection object. + * + * @method getSel + * @return {Selection} Internal browser selection object. + */ + getSel: function() { + var win = this.win; + + return win.getSelection ? win.getSelection() : win.document.selection; + }, + + /** + * Returns the browsers internal range object. + * + * @method getRng + * @param {Boolean} w3c Forces a compatible W3C range on IE. + * @return {Range} Internal browser range object. + * @see http://www.quirksmode.org/dom/range_intro.html + * @see http://www.dotvoid.com/2001/03/using-the-range-object-in-mozilla/ + */ + getRng: function(w3c) { + var self = this, selection, rng, elm, doc = self.win.document, ieRng; + + function tryCompareBoundaryPoints(how, sourceRange, destinationRange) { + try { + return sourceRange.compareBoundaryPoints(how, destinationRange); + } catch (ex) { + // Gecko throws wrong document exception if the range points + // to nodes that where removed from the dom #6690 + // Browsers should mutate existing DOMRange instances so that they always point + // to something in the document this is not the case in Gecko works fine in IE/WebKit/Blink + // For performance reasons just return -1 + return -1; + } + } + + // Use last rng passed from FocusManager if it's available this enables + // calls to editor.selection.getStart() to work when caret focus is lost on IE + if (!w3c && self.lastFocusBookmark) { + var bookmark = self.lastFocusBookmark; + + // Convert bookmark to range IE 11 fix + if (bookmark.startContainer) { + rng = doc.createRange(); + rng.setStart(bookmark.startContainer, bookmark.startOffset); + rng.setEnd(bookmark.endContainer, bookmark.endOffset); + } else { + rng = bookmark; + } + + return rng; + } + + // Found tridentSel object then we need to use that one + if (w3c && self.tridentSel) { + return self.tridentSel.getRangeAt(0); + } + + try { + if ((selection = self.getSel())) { + if (selection.rangeCount > 0) { + rng = selection.getRangeAt(0); + } else { + rng = selection.createRange ? selection.createRange() : doc.createRange(); + } + } + } catch (ex) { + // IE throws unspecified error here if TinyMCE is placed in a frame/iframe + } + + // We have W3C ranges and it's IE then fake control selection since IE9 doesn't handle that correctly yet + // IE 11 doesn't support the selection object so we check for that as well + if (isIE && rng && rng.setStart && doc.selection) { + try { + // IE will sometimes throw an exception here + ieRng = doc.selection.createRange(); + } catch (ex) { + + } + + if (ieRng && ieRng.item) { + elm = ieRng.item(0); + rng = doc.createRange(); + rng.setStartBefore(elm); + rng.setEndAfter(elm); + } + } + + // No range found then create an empty one + // This can occur when the editor is placed in a hidden container element on Gecko + // Or on IE when there was an exception + if (!rng) { + rng = doc.createRange ? doc.createRange() : doc.body.createTextRange(); + } + + // If range is at start of document then move it to start of body + if (rng.setStart && rng.startContainer.nodeType === 9 && rng.collapsed) { + elm = self.dom.getRoot(); + rng.setStart(elm, 0); + rng.setEnd(elm, 0); + } + + if (self.selectedRange && self.explicitRange) { + if (tryCompareBoundaryPoints(rng.START_TO_START, rng, self.selectedRange) === 0 && + tryCompareBoundaryPoints(rng.END_TO_END, rng, self.selectedRange) === 0) { + // Safari, Opera and Chrome only ever select text which causes the range to change. + // This lets us use the originally set range if the selection hasn't been changed by the user. + rng = self.explicitRange; + } else { + self.selectedRange = null; + self.explicitRange = null; + } + } + + return rng; + }, + + /** + * Changes the selection to the specified DOM range. + * + * @method setRng + * @param {Range} rng Range to select. + */ + setRng: function(rng, forward) { + var self = this, sel; + + if (!rng) { + return; + } + + // Is IE specific range + if (rng.select) { + try { + rng.select(); + } catch (ex) { + // Needed for some odd IE bug #1843306 + } + + return; + } + + if (!self.tridentSel) { + sel = self.getSel(); + + if (sel) { + self.explicitRange = rng; + + try { + sel.removeAllRanges(); + sel.addRange(rng); + } catch (ex) { + // IE might throw errors here if the editor is within a hidden container and selection is changed + } + + // Forward is set to false and we have an extend function + if (forward === false && sel.extend) { + sel.collapse(rng.endContainer, rng.endOffset); + sel.extend(rng.startContainer, rng.startOffset); + } + + // adding range isn't always successful so we need to check range count otherwise an exception can occur + self.selectedRange = sel.rangeCount > 0 ? sel.getRangeAt(0) : null; + } + } else { + // Is W3C Range fake range on IE + if (rng.cloneRange) { + try { + self.tridentSel.addRange(rng); + return; + } catch (ex) { + //IE9 throws an error here if called before selection is placed in the editor + } + } + } + }, + + /** + * Sets the current selection to the specified DOM element. + * + * @method setNode + * @param {Element} elm Element to set as the contents of the selection. + * @return {Element} Returns the element that got passed in. + * @example + * // Inserts a DOM node at current selection/caret location + * tinymce.activeEditor.selection.setNode(tinymce.activeEditor.dom.create('img', {src: 'some.gif', title: 'some title'})); + */ + setNode: function(elm) { + var self = this; + + self.setContent(self.dom.getOuterHTML(elm)); + + return elm; + }, + + /** + * Returns the currently selected element or the common ancestor element for both start and end of the selection. + * + * @method getNode + * @return {Element} Currently selected element or common ancestor element. + * @example + * // Alerts the currently selected elements node name + * alert(tinymce.activeEditor.selection.getNode().nodeName); + */ + getNode: function() { + var self = this, rng = self.getRng(), elm; + var startContainer = rng.startContainer, endContainer = rng.endContainer; + var startOffset = rng.startOffset, endOffset = rng.endOffset, root = self.dom.getRoot(); + + function skipEmptyTextNodes(node, forwards) { + var orig = node; + + while (node && node.nodeType === 3 && node.length === 0) { + node = forwards ? node.nextSibling : node.previousSibling; + } + + return node || orig; + } + + // Range maybe lost after the editor is made visible again + if (!rng) { + return root; + } + + if (rng.setStart) { + elm = rng.commonAncestorContainer; + + // Handle selection a image or other control like element such as anchors + if (!rng.collapsed) { + if (startContainer == endContainer) { + if (endOffset - startOffset < 2) { + if (startContainer.hasChildNodes()) { + elm = startContainer.childNodes[startOffset]; + } + } + } + + // If the anchor node is a element instead of a text node then return this element + //if (tinymce.isWebKit && sel.anchorNode && sel.anchorNode.nodeType == 1) + // return sel.anchorNode.childNodes[sel.anchorOffset]; + + // Handle cases where the selection is immediately wrapped around a node and return that node instead of it's parent. + // This happens when you double click an underlined word in FireFox. + if (startContainer.nodeType === 3 && endContainer.nodeType === 3) { + if (startContainer.length === startOffset) { + startContainer = skipEmptyTextNodes(startContainer.nextSibling, true); + } else { + startContainer = startContainer.parentNode; + } + + if (endOffset === 0) { + endContainer = skipEmptyTextNodes(endContainer.previousSibling, false); + } else { + endContainer = endContainer.parentNode; + } + + if (startContainer && startContainer === endContainer) { + return startContainer; + } + } + } + + if (elm && elm.nodeType == 3) { + return elm.parentNode; + } + + return elm; + } + + elm = rng.item ? rng.item(0) : rng.parentElement(); + + // IE 7 might return elements outside the iframe + if (elm.ownerDocument !== self.win.document) { + elm = root; + } + + return elm; + }, + + getSelectedBlocks: function(startElm, endElm) { + var self = this, dom = self.dom, node, root, selectedBlocks = []; + + root = dom.getRoot(); + startElm = dom.getParent(startElm || self.getStart(), dom.isBlock); + endElm = dom.getParent(endElm || self.getEnd(), dom.isBlock); + + if (startElm && startElm != root) { + selectedBlocks.push(startElm); + } + + if (startElm && endElm && startElm != endElm) { + node = startElm; + + var walker = new TreeWalker(startElm, root); + while ((node = walker.next()) && node != endElm) { + if (dom.isBlock(node)) { + selectedBlocks.push(node); + } + } + } + + if (endElm && startElm != endElm && endElm != root) { + selectedBlocks.push(endElm); + } + + return selectedBlocks; + }, + + isForward: function() { + var dom = this.dom, sel = this.getSel(), anchorRange, focusRange; + + // No support for selection direction then always return true + if (!sel || !sel.anchorNode || !sel.focusNode) { + return true; + } + + anchorRange = dom.createRng(); + anchorRange.setStart(sel.anchorNode, sel.anchorOffset); + anchorRange.collapse(true); + + focusRange = dom.createRng(); + focusRange.setStart(sel.focusNode, sel.focusOffset); + focusRange.collapse(true); + + return anchorRange.compareBoundaryPoints(anchorRange.START_TO_START, focusRange) <= 0; + }, + + normalize: function() { + var self = this, rng = self.getRng(); + + if (Env.range && new RangeUtils(self.dom).normalize(rng)) { + self.setRng(rng, self.isForward()); + } + + return rng; + }, + + /** + * Executes callback when the current selection starts/stops matching the specified selector. The current + * state will be passed to the callback as it's first argument. + * + * @method selectorChanged + * @param {String} selector CSS selector to check for. + * @param {function} callback Callback with state and args when the selector is matches or not. + */ + selectorChanged: function(selector, callback) { + var self = this, currentSelectors; + + if (!self.selectorChangedData) { + self.selectorChangedData = {}; + currentSelectors = {}; + + self.editor.on('NodeChange', function(e) { + var node = e.element, dom = self.dom, parents = dom.getParents(node, null, dom.getRoot()), matchedSelectors = {}; + + // Check for new matching selectors + each(self.selectorChangedData, function(callbacks, selector) { + each(parents, function(node) { + if (dom.is(node, selector)) { + if (!currentSelectors[selector]) { + // Execute callbacks + each(callbacks, function(callback) { + callback(true, {node: node, selector: selector, parents: parents}); + }); + + currentSelectors[selector] = callbacks; + } + + matchedSelectors[selector] = callbacks; + return false; + } + }); + }); + + // Check if current selectors still match + each(currentSelectors, function(callbacks, selector) { + if (!matchedSelectors[selector]) { + delete currentSelectors[selector]; + + each(callbacks, function(callback) { + callback(false, {node: node, selector: selector, parents: parents}); + }); + } + }); + }); + } + + // Add selector listeners + if (!self.selectorChangedData[selector]) { + self.selectorChangedData[selector] = []; + } + + self.selectorChangedData[selector].push(callback); + + return self; + }, + + getScrollContainer: function() { + var scrollContainer, node = this.dom.getRoot(); + + while (node && node.nodeName != 'BODY') { + if (node.scrollHeight > node.clientHeight) { + scrollContainer = node; + break; + } + + node = node.parentNode; + } + + return scrollContainer; + }, + + scrollIntoView: function(elm) { + var y, viewPort, self = this, dom = self.dom, root = dom.getRoot(), viewPortY, viewPortH; + + function getPos(elm) { + var x = 0, y = 0; + + var offsetParent = elm; + while (offsetParent && offsetParent.nodeType) { + x += offsetParent.offsetLeft || 0; + y += offsetParent.offsetTop || 0; + offsetParent = offsetParent.offsetParent; + } + + return {x: x, y: y}; + } + + if (root.nodeName != 'BODY') { + var scrollContainer = self.getScrollContainer(); + if (scrollContainer) { + y = getPos(elm).y - getPos(scrollContainer).y; + viewPortH = scrollContainer.clientHeight; + viewPortY = scrollContainer.scrollTop; + if (y < viewPortY || y + 25 > viewPortY + viewPortH) { + scrollContainer.scrollTop = y < viewPortY ? y : y - viewPortH + 25; + } + + return; + } + } + + viewPort = dom.getViewPort(self.editor.getWin()); + y = dom.getPos(elm).y; + viewPortY = viewPort.y; + viewPortH = viewPort.h; + if (y < viewPort.y || y + 25 > viewPortY + viewPortH) { + self.editor.getWin().scrollTo(0, y < viewPortY ? y : y - viewPortH + 25); + } + }, + + placeCaretAt: function(clientX, clientY) { + var doc = this.editor.getDoc(), rng, point; + + if (doc.caretPositionFromPoint) { + point = doc.caretPositionFromPoint(clientX, clientY); + rng = doc.createRange(); + rng.setStart(point.offsetNode, point.offset); + rng.collapse(true); + } else if (doc.caretRangeFromPoint) { + rng = doc.caretRangeFromPoint(clientX, clientY); + } else if (doc.body.createTextRange) { + rng = doc.body.createTextRange(); + + try { + rng.moveToPoint(clientX, clientY); + rng.collapse(true); + } catch (ex) { + rng.collapse(clientY < doc.body.clientHeight); + } + } + + this.setRng(rng); + }, + + _moveEndPoint: function(rng, node, start) { + var root = node, walker = new TreeWalker(node, root); + var nonEmptyElementsMap = this.dom.schema.getNonEmptyElements(); + + do { + // Text node + if (node.nodeType == 3 && trim(node.nodeValue).length !== 0) { + if (start) { + rng.setStart(node, 0); + } else { + rng.setEnd(node, node.nodeValue.length); + } + + return; + } + + // BR/IMG/INPUT elements but not table cells + if (nonEmptyElementsMap[node.nodeName] && !/^(TD|TH)$/.test(node.nodeName)) { + if (start) { + rng.setStartBefore(node); + } else { + if (node.nodeName == 'BR') { + rng.setEndBefore(node); + } else { + rng.setEndAfter(node); + } + } + + return; + } + + // Found empty text block old IE can place the selection inside those + if (Env.ie && Env.ie < 11 && this.dom.isBlock(node) && this.dom.isEmpty(node)) { + if (start) { + rng.setStart(node, 0); + } else { + rng.setEnd(node, 0); + } + + return; + } + } while ((node = (start ? walker.next() : walker.prev()))); + + // Failed to find any text node or other suitable location then move to the root of body + if (root.nodeName == 'BODY') { + if (start) { + rng.setStart(root, 0); + } else { + rng.setEnd(root, root.childNodes.length); + } + } + }, + + destroy: function() { + this.win = null; + this.controlSelection.destroy(); + } + }; + + return Selection; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Serializer.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Serializer.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,402 @@ +/** + * Serializer.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to serialize DOM trees into a string. Consult the TinyMCE Wiki API for + * more details and examples on how to use this class. + * + * @class tinymce.dom.Serializer + */ +define("tinymce/dom/Serializer", [ + "tinymce/dom/DOMUtils", + "tinymce/html/DomParser", + "tinymce/html/Entities", + "tinymce/html/Serializer", + "tinymce/html/Node", + "tinymce/html/Schema", + "tinymce/Env", + "tinymce/util/Tools" +], function(DOMUtils, DomParser, Entities, Serializer, Node, Schema, Env, Tools) { + var each = Tools.each, trim = Tools.trim; + var DOM = DOMUtils.DOM; + + /** + * Constructs a new DOM serializer class. + * + * @constructor + * @method Serializer + * @param {Object} settings Serializer settings object. + * @param {tinymce.Editor} editor Optional editor to bind events to and get schema/dom from. + */ + return function(settings, editor) { + var dom, schema, htmlParser; + + if (editor) { + dom = editor.dom; + schema = editor.schema; + } + + // Default DOM and Schema if they are undefined + dom = dom || DOM; + schema = schema || new Schema(settings); + settings.entity_encoding = settings.entity_encoding || 'named'; + settings.remove_trailing_brs = "remove_trailing_brs" in settings ? settings.remove_trailing_brs : true; + + htmlParser = new DomParser(settings, schema); + + // Convert tabindex back to elements when serializing contents + htmlParser.addAttributeFilter('data-mce-tabindex', function(nodes, name) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i]; + node.attr('tabindex', node.attributes.map['data-mce-tabindex']); + node.attr(name, null); + } + }); + + // Convert move data-mce-src, data-mce-href and data-mce-style into nodes or process them if needed + htmlParser.addAttributeFilter('src,href,style', function(nodes, name) { + var i = nodes.length, node, value, internalName = 'data-mce-' + name; + var urlConverter = settings.url_converter, urlConverterScope = settings.url_converter_scope, undef; + + while (i--) { + node = nodes[i]; + + value = node.attributes.map[internalName]; + if (value !== undef) { + // Set external name to internal value and remove internal + node.attr(name, value.length > 0 ? value : null); + node.attr(internalName, null); + } else { + // No internal attribute found then convert the value we have in the DOM + value = node.attributes.map[name]; + + if (name === "style") { + value = dom.serializeStyle(dom.parseStyle(value), node.name); + } else if (urlConverter) { + value = urlConverter.call(urlConverterScope, value, name, node.name); + } + + node.attr(name, value.length > 0 ? value : null); + } + } + }); + + // Remove internal classes mceItem<..> or mceSelected + htmlParser.addAttributeFilter('class', function(nodes) { + var i = nodes.length, node, value; + + while (i--) { + node = nodes[i]; + value = node.attr('class'); + + if (value) { + value = node.attr('class').replace(/(?:^|\s)mce-item-\w+(?!\S)/g, ''); + node.attr('class', value.length > 0 ? value : null); + } + } + }); + + // Remove bookmark elements + htmlParser.addAttributeFilter('data-mce-type', function(nodes, name, args) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i]; + + if (node.attributes.map['data-mce-type'] === 'bookmark' && !args.cleanup) { + node.remove(); + } + } + }); + + htmlParser.addNodeFilter('noscript', function(nodes) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i].firstChild; + + if (node) { + node.value = Entities.decode(node.value); + } + } + }); + + // Force script into CDATA sections and remove the mce- prefix also add comments around styles + htmlParser.addNodeFilter('script,style', function(nodes, name) { + var i = nodes.length, node, value, type; + + function trim(value) { + /*jshint maxlen:255 */ + /*eslint max-len:0 */ + return value.replace(/()/g, '\n') + .replace(/^[\r\n]*|[\r\n]*$/g, '') + .replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g, ''); + } + + while (i--) { + node = nodes[i]; + value = node.firstChild ? node.firstChild.value : ''; + + if (name === "script") { + // Remove mce- prefix from script elements and remove default type since the user specified + // a script element without type attribute + type = node.attr('type'); + if (type) { + node.attr('type', type == 'mce-no/type' ? null : type.replace(/^mce\-/, '')); + } + + if (value.length > 0) { + node.firstChild.value = '// '; + } + } else { + if (value.length > 0) { + node.firstChild.value = ''; + } + } + } + }); + + // Convert comments to cdata and handle protected comments + htmlParser.addNodeFilter('#comment', function(nodes) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i]; + + if (node.value.indexOf('[CDATA[') === 0) { + node.name = '#cdata'; + node.type = 4; + node.value = node.value.replace(/^\[CDATA\[|\]\]$/g, ''); + } else if (node.value.indexOf('mce:protected ') === 0) { + node.name = "#text"; + node.type = 3; + node.raw = true; + node.value = unescape(node.value).substr(14); + } + } + }); + + htmlParser.addNodeFilter('xml:namespace,input', function(nodes, name) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i]; + if (node.type === 7) { + node.remove(); + } else if (node.type === 1) { + if (name === "input" && !("type" in node.attributes.map)) { + node.attr('type', 'text'); + } + } + } + }); + + // Fix list elements, TODO: Replace this later + if (settings.fix_list_elements) { + htmlParser.addNodeFilter('ul,ol', function(nodes) { + var i = nodes.length, node, parentNode; + + while (i--) { + node = nodes[i]; + parentNode = node.parent; + + if (parentNode.name === 'ul' || parentNode.name === 'ol') { + if (node.prev && node.prev.name === 'li') { + node.prev.append(node); + } + } + } + }); + } + + // Remove internal data attributes + htmlParser.addAttributeFilter( + 'data-mce-src,data-mce-href,data-mce-style,' + + 'data-mce-selected,data-mce-expando,' + + 'data-mce-type,data-mce-resize', + + function(nodes, name) { + var i = nodes.length; + + while (i--) { + nodes[i].attr(name, null); + } + } + ); + + // Return public methods + return { + /** + * Schema instance that was used to when the Serializer was constructed. + * + * @field {tinymce.html.Schema} schema + */ + schema: schema, + + /** + * Adds a node filter function to the parser used by the serializer, the parser will collect the specified nodes by name + * and then execute the callback ones it has finished parsing the document. + * + * @example + * parser.addNodeFilter('p,h1', function(nodes, name) { + * for (var i = 0; i < nodes.length; i++) { + * console.log(nodes[i].name); + * } + * }); + * @method addNodeFilter + * @method {String} name Comma separated list of nodes to collect. + * @param {function} callback Callback function to execute once it has collected nodes. + */ + addNodeFilter: htmlParser.addNodeFilter, + + /** + * Adds a attribute filter function to the parser used by the serializer, the parser will + * collect nodes that has the specified attributes + * and then execute the callback ones it has finished parsing the document. + * + * @example + * parser.addAttributeFilter('src,href', function(nodes, name) { + * for (var i = 0; i < nodes.length; i++) { + * console.log(nodes[i].name); + * } + * }); + * @method addAttributeFilter + * @method {String} name Comma separated list of nodes to collect. + * @param {function} callback Callback function to execute once it has collected nodes. + */ + addAttributeFilter: htmlParser.addAttributeFilter, + + /** + * Serializes the specified browser DOM node into a HTML string. + * + * @method serialize + * @param {DOMNode} node DOM node to serialize. + * @param {Object} args Arguments option that gets passed to event handlers. + */ + serialize: function(node, args) { + var self = this, impl, doc, oldDoc, htmlSerializer, content; + + // Explorer won't clone contents of script and style and the + // selected index of select elements are cleared on a clone operation. + if (Env.ie && dom.select('script,style,select,map').length > 0) { + content = node.innerHTML; + node = node.cloneNode(false); + dom.setHTML(node, content); + } else { + node = node.cloneNode(true); + } + + // Nodes needs to be attached to something in WebKit/Opera + // This fix will make DOM ranges and make Sizzle happy! + impl = node.ownerDocument.implementation; + if (impl.createHTMLDocument) { + // Create an empty HTML document + doc = impl.createHTMLDocument(""); + + // Add the element or it's children if it's a body element to the new document + each(node.nodeName == 'BODY' ? node.childNodes : [node], function(node) { + doc.body.appendChild(doc.importNode(node, true)); + }); + + // Grab first child or body element for serialization + if (node.nodeName != 'BODY') { + node = doc.body.firstChild; + } else { + node = doc.body; + } + + // set the new document in DOMUtils so createElement etc works + oldDoc = dom.doc; + dom.doc = doc; + } + + args = args || {}; + args.format = args.format || 'html'; + + // Don't wrap content if we want selected html + if (args.selection) { + args.forced_root_block = ''; + } + + // Pre process + if (!args.no_events) { + args.node = node; + self.onPreProcess(args); + } + + // Setup serializer + htmlSerializer = new Serializer(settings, schema); + + // Parse and serialize HTML + args.content = htmlSerializer.serialize( + htmlParser.parse(trim(args.getInner ? node.innerHTML : dom.getOuterHTML(node)), args) + ); + + // Replace all BOM characters for now until we can find a better solution + if (!args.cleanup) { + args.content = args.content.replace(/\uFEFF/g, ''); + } + + // Post process + if (!args.no_events) { + self.onPostProcess(args); + } + + // Restore the old document if it was changed + if (oldDoc) { + dom.doc = oldDoc; + } + + args.node = null; + + return args.content; + }, + + /** + * Adds valid elements rules to the serializers schema instance this enables you to specify things + * like what elements should be outputted and what attributes specific elements might have. + * Consult the Wiki for more details on this format. + * + * @method addRules + * @param {String} rules Valid elements rules string to add to schema. + */ + addRules: function(rules) { + schema.addValidElements(rules); + }, + + /** + * Sets the valid elements rules to the serializers schema instance this enables you to specify things + * like what elements should be outputted and what attributes specific elements might have. + * Consult the Wiki for more details on this format. + * + * @method setRules + * @param {String} rules Valid elements rules string. + */ + setRules: function(rules) { + schema.setValidElements(rules); + }, + + onPreProcess: function(args) { + if (editor) { + editor.fire('PreProcess', args); + } + }, + + onPostProcess: function(args) { + if (editor) { + editor.fire('PostProcess', args); + } + } + }; + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Sizzle.jQuery.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Sizzle.jQuery.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,23 @@ +/** + * Sizzle.jQuery.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global jQuery:true */ + +/* + * Fake Sizzle using jQuery. + */ +define("tinymce/dom/Sizzle", [], function() { + // Detect if jQuery is loaded + if (!window.jQuery) { + throw new Error("Load jQuery first"); + } + + return jQuery.find; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Sizzle.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/Sizzle.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,2038 @@ +/** + * Sizzle.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + * + * @ignore-file + */ + +/*jshint bitwise:false, expr:true, noempty:false, sub:true, eqnull:true, latedef:false, maxlen:255 */ +/*eslint dot-notation:0, no-empty:0, no-cond-assign:0, no-unused-expressions:0, new-cap:0 */ +/*eslint no-nested-ternary:0, func-style:0, no-bitwise:0, max-len:0, brace-style:0, no-return-assign:0, no-multi-spaces:0 */ + +/** + * Sizzle CSS Selector Engine v@VERSION + * http://sizzlejs.com/ + * + * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: @DATE + */ +define("tinymce/dom/Sizzle", [], function() { +var i, + support, + Expr, + getText, + isXML, + tokenize, + compile, + select, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + -(new Date()), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + // General-purpose constants + strundefined = typeof undefined, + MAX_NEGATIVE = 1 << 31, + + // Instance methods + hasOwn = ({}).hasOwnProperty, + arr = [], + pop = arr.pop, + push_native = arr.push, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf if we can't use a native one + indexOf = arr.indexOf || function( elem ) { + var i = 0, + len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + + // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", + + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + + "*\\]", + + pseudos = ":(" + identifier + ")(?:\\((" + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), + + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + identifier + ")" ), + "CLASS": new RegExp( "^\\.(" + identifier + ")" ), + "TAG": new RegExp( "^(" + identifier + "|[*])" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + rescape = /'|\\/g, + + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox<24 + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + high < 0 ? + // BMP codepoint + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }; + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var match, elem, m, nodeType, + // QSA vars + i, groups, old, nid, newContext, newSelector; + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + + context = context || document; + results = results || []; + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { + return []; + } + + if ( documentIsHTML && !seed ) { + + // Shortcuts + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document (jQuery #6963) + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && support.getElementsByClassName ) { + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // QSA path + if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + nid = old = expando; + newContext = context; + newSelector = nodeType === 9 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + toSelector( groups[i] ); + } + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {Function(string, Object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key + " " ] = value); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created div and expects a boolean result + */ +function assert( fn ) { + var div = document.createElement("div"); + + try { + return !!fn( div ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( div.parentNode ) { + div.parentNode.removeChild( div ); + } + // release memory in IE + div = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = attrs.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + ( ~b.sourceIndex || MAX_NEGATIVE ) - + ( ~a.sourceIndex || MAX_NEGATIVE ); + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */ +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Checks a node for validity as a Sizzle context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */ +function testContext( context ) { + return context && typeof context.getElementsByTagName !== strundefined && context; +} + +// Expose support vars for convenience +support = Sizzle.support = {}; + +/** + * Detects XML nodes + * @param {Element|Object} elem An element or a document + * @returns {Boolean} True iff elem is a non-HTML XML node + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var hasCompare, + doc = node ? node.ownerDocument || node : preferredDoc, + parent = doc.defaultView; + + // If no document and documentElement is available, return + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Set our document + document = doc; + docElem = doc.documentElement; + + // Support tests + documentIsHTML = !isXML( doc ); + + // Support: IE>8 + // If iframe document is assigned to "document" variable and if iframe has been reloaded, + // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 + // IE6-8 do not support the defaultView property so parent will be undefined + if ( parent && parent !== parent.top ) { + // IE11 does not have attachEvent, so all must suffer + if ( parent.addEventListener ) { + parent.addEventListener( "unload", function() { + setDocument(); + }, false ); + } else if ( parent.attachEvent ) { + parent.attachEvent( "onunload", function() { + setDocument(); + }); + } + } + + /* Attributes + ---------------------------------------------------------------------- */ + + // Support: IE<8 + // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) + support.attributes = assert(function( div ) { + div.className = "i"; + return !div.getAttribute("className"); + }); + + /* getElement(s)By* + ---------------------------------------------------------------------- */ + + // Check if getElementsByTagName("*") returns only elements + support.getElementsByTagName = assert(function( div ) { + div.appendChild( doc.createComment("") ); + return !div.getElementsByTagName("*").length; + }); + + // Support: IE<9 + support.getElementsByClassName = rnative.test( doc.getElementsByClassName ); + + // Support: IE<10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert(function( div ) { + docElem.appendChild( div ).id = expando; + return !doc.getElementsByName || !doc.getElementsByName( expando ).length; + }); + + // ID find and filter + if ( support.getById ) { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && documentIsHTML ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [ m ] : []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + } else { + // Support: IE6/7 + // getElementById is not reliable as a find shortcut + delete Expr.find["ID"]; + + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + } + + // Tag + Expr.find["TAG"] = support.getElementsByTagName ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var elem, + tmp = [], + i = 0, + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( (elem = results[i++]) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Class + Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { + if ( documentIsHTML ) { + return context.getElementsByClassName( className ); + } + }; + + /* QSA/matchesSelector + ---------------------------------------------------------------------- */ + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21) + // We allow this because of a bug in IE8/9 that throws an error + // whenever `document.activeElement` is accessed on an iframe + // So, we allow :focus to pass through QSA all the time to avoid the IE error + // See http://bugs.jquery.com/ticket/13378 + rbuggyQSA = []; + + if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explicitly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = ""; + + // Support: IE8, Opera 11-12.16 + // Nothing should be selected when empty strings follow ^= or $= or *= + // The test attribute must be unknown in Opera but "safe" for WinRT + // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( div.querySelectorAll("[msallowcapture^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + } + + // Support: IE8 + // Boolean attributes and "value" are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + }); + + assert(function( div ) { + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + var input = doc.createElement("input"); + input.setAttribute( "type", "hidden" ); + div.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE8 + // Enforce case-sensitivity of name attribute + if ( div.querySelectorAll("[name=d]").length ) { + rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + div.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || + docElem.webkitMatchesSelector || + docElem.mozMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( div, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); + + /* Contains + ---------------------------------------------------------------------- */ + hasCompare = rnative.test( docElem.compareDocumentPosition ); + + // Element contains another + // Purposefully does not implement inclusive descendent + // As in, an element does not contain itself + contains = hasCompare || rnative.test( docElem.contains ) ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + /* Sorting + ---------------------------------------------------------------------- */ + + // Document order sorting + sortOrder = hasCompare ? + function( a, b ) { + + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if ( compare ) { + return compare; + } + + // Calculate position if both inputs belong to the same document + compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : + + // Otherwise we know they are disconnected + 1; + + // Disconnected nodes + if ( compare & 1 || + (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { + + // Choose the first element that is related to our preferred document + if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { + return -1; + } + if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + } : + function( a, b ) { + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Parentless nodes are either documents or disconnected + if ( !aup || !bup ) { + return a === doc ? -1 : + b === doc ? 1 : + aup ? -1 : + bup ? 1 : + sortInput ? + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + return doc; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + if ( support.matchesSelector && documentIsHTML && + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch(e) {} + } + + return Sizzle( expr, document, null, [ elem ] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ], + // Don't get fooled by Object.prototype properties (jQuery #13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + return val !== undefined ? + val : + support.attributes || !documentIsHTML ? + elem.getAttribute( name ) : + (val = elem.getAttributeNode(name)) && val.specified ? + val.value : + null; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + j = 0, + i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice( 0 ); + results.sort( sortOrder ); + + if ( hasDuplicate ) { + while ( (elem = results[i++]) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; +}; + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + while ( (node = elem[i++]) ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (jQuery #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[6] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[3] ) { + match[2] = match[4] || match[5] || ""; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeNameSelector ) { + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === "*" ? + function() { return true; } : + function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, outerCache, node, diff, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + // Seek `elem` from a previously-cached index + outerCache = parent[ expando ] || (parent[ expando ] = {}); + cache = outerCache[ type ] || []; + nodeIndex = cache[0] === dirruns && cache[1]; + diff = cache[0] === dirruns && cache[2]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + // Use previously-cached element index if available + } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { + diff = cache[1]; + + // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) + } else { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { + // Cache the index of each encountered element + if ( useCache ) { + (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + text = text.replace( runescape, funescape ); + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifier + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeType < 6 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + + // Support: IE<8 + // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + +tokenize = Sizzle.tokenize = function( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( (tokens = []) ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push({ + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + }); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push({ + value: matched, + type: type, + matches: match + }); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +}; + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var oldCache, outerCache, + newCache = [ dirruns, doneName ]; + + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + if ( (oldCache = outerCache[ dir ]) && + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { + + // Assign to newCache so results back-propagate to previous elements + return (newCache[ 2 ] = oldCache[ 2 ]); + } else { + // Reuse newcache so results back-propagate to previous elements + outerCache[ dir ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { + return true; + } + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) + ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, outermost ) { + var elem, j, matcher, + matchedCount = 0, + i = "0", + unmatched = seed && [], + setMatched = [], + contextBackup = outermostContext, + // We must always have either seed elements or outermost context + elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), + len = elems.length; + + if ( outermost ) { + outermostContext = context !== document && context; + } + + // Add elements passing elementMatchers directly to results + // Keep `i` a string if there are no elements so `matchedCount` will be "00" below + // Support: IE<9, Safari + // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id + for ( ; i !== len && (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !match ) { + match = tokenize( selector ); + } + i = match.length; + while ( i-- ) { + cached = matcherFromTokens( match[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + + // Save selector and tokenization + cached.selector = selector; + } + return cached; +}; + +/** + * A low-level selection function that works with Sizzle's compiled + * selector functions + * @param {String|Function} selector A selector or a pre-compiled + * selector function built with Sizzle.compile + * @param {Element} context + * @param {Array} [results] + * @param {Array} [seed] A set of elements to match against + */ +select = Sizzle.select = function( selector, context, results, seed ) { + var i, tokens, token, type, find, + compiled = typeof selector === "function" && selector, + match = !seed && tokenize( (selector = compiled.selector || selector) ); + + results = results || []; + + // Try to minimize operations if there is no seed and only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + support.getById && context.nodeType === 9 && documentIsHTML && + Expr.relative[ tokens[1].type ] ) { + + context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; + if ( !context ) { + return results; + + // Precompiled matchers will still verify ancestry, so step up a level + } else if ( compiled ) { + context = context.parentNode; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + + // Compile and execute a filtering function if one is not provided + // Provide `match` to avoid retokenization if we modified the selector above + ( compiled || compile( selector, match ) )( + seed, + context, + !documentIsHTML, + results, + rsibling.test( selector ) && testContext( context.parentNode ) || context + ); + return results; +}; + +// One-time assignments + +// Sort stability +support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; + +// Support: Chrome 14-35+ +// Always assume duplicates if they aren't passed to the comparison function +support.detectDuplicates = !!hasDuplicate; + +// Initialize against the default document +setDocument(); + +// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Detached nodes confoundingly follow *each other* +support.sortDetached = assert(function( div1 ) { + // Should return 1, but returns 4 (following) + return div1.compareDocumentPosition( document.createElement("div") ) & 1; +}); + +// Support: IE<8 +// Prevent attribute/property "interpolation" +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert(function( div ) { + div.innerHTML = ""; + return div.firstChild.getAttribute("href") === "#" ; +}) ) { + addHandle( "type|href|height|width", function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); + } + }); +} + +// Support: IE<9 +// Use defaultValue in place of getAttribute("value") +if ( !support.attributes || !assert(function( div ) { + div.innerHTML = ""; + div.firstChild.setAttribute( "value", "" ); + return div.firstChild.getAttribute( "value" ) === ""; +}) ) { + addHandle( "value", function( elem, name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { + return elem.defaultValue; + } + }); +} + +// Support: IE<9 +// Use getAttributeNode to fetch booleans when getAttribute lies +if ( !assert(function( div ) { + return div.getAttribute("disabled") == null; +}) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return elem[ name ] === true ? name.toLowerCase() : + (val = elem.getAttributeNode( name )) && val.specified ? + val.value : + null; + } + }); +} + +// EXPOSE +return Sizzle; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/StyleSheetLoader.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/StyleSheetLoader.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,189 @@ +/** + * StyleSheetLoader.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles loading of external stylesheets and fires events when these are loaded. + * + * @class tinymce.dom.StyleSheetLoader + * @private + */ +define("tinymce/dom/StyleSheetLoader", [ + "tinymce/util/Tools" +], function(Tools) { + "use strict"; + + return function(document, settings) { + var idCount = 0, loadedStates = {}, maxLoadTime; + + settings = settings || {}; + maxLoadTime = settings.maxLoadTime || 5000; + + function appendToHead(node) { + document.getElementsByTagName('head')[0].appendChild(node); + } + + /** + * Loads the specified css style sheet file and call the loadedCallback once it's finished loading. + * + * @method load + * @param {String} url Url to be loaded. + * @param {Function} loadedCallback Callback to be executed when loaded. + * @param {Function} errorCallback Callback to be executed when failed loading. + */ + function load(url, loadedCallback, errorCallback) { + var link, style, startTime, state; + + function passed() { + var callbacks = state.passed, i = callbacks.length; + + while (i--) { + callbacks[i](); + } + + state.status = 2; + state.passed = []; + state.failed = []; + } + + function failed() { + var callbacks = state.failed, i = callbacks.length; + + while (i--) { + callbacks[i](); + } + + state.status = 3; + state.passed = []; + state.failed = []; + } + + // Sniffs for older WebKit versions that have the link.onload but a broken one + function isOldWebKit() { + var webKitChunks = navigator.userAgent.match(/WebKit\/(\d*)/); + return !!(webKitChunks && webKitChunks[1] < 536); + } + + // Calls the waitCallback until the test returns true or the timeout occurs + function wait(testCallback, waitCallback) { + if (!testCallback()) { + // Wait for timeout + if ((new Date().getTime()) - startTime < maxLoadTime) { + window.setTimeout(waitCallback, 0); + } else { + failed(); + } + } + } + + // Workaround for WebKit that doesn't properly support the onload event for link elements + // Or WebKit that fires the onload event before the StyleSheet is added to the document + function waitForWebKitLinkLoaded() { + wait(function() { + var styleSheets = document.styleSheets, styleSheet, i = styleSheets.length, owner; + + while (i--) { + styleSheet = styleSheets[i]; + owner = styleSheet.ownerNode ? styleSheet.ownerNode : styleSheet.owningElement; + if (owner && owner.id === link.id) { + passed(); + return true; + } + } + }, waitForWebKitLinkLoaded); + } + + // Workaround for older Geckos that doesn't have any onload event for StyleSheets + function waitForGeckoLinkLoaded() { + wait(function() { + try { + // Accessing the cssRules will throw an exception until the CSS file is loaded + var cssRules = style.sheet.cssRules; + passed(); + return !!cssRules; + } catch (ex) { + // Ignore + } + }, waitForGeckoLinkLoaded); + } + + url = Tools._addCacheSuffix(url); + + if (!loadedStates[url]) { + state = { + passed: [], + failed: [] + }; + + loadedStates[url] = state; + } else { + state = loadedStates[url]; + } + + if (loadedCallback) { + state.passed.push(loadedCallback); + } + + if (errorCallback) { + state.failed.push(errorCallback); + } + + // Is loading wait for it to pass + if (state.status == 1) { + return; + } + + // Has finished loading and was success + if (state.status == 2) { + passed(); + return; + } + + // Has finished loading and was a failure + if (state.status == 3) { + failed(); + return; + } + + // Start loading + state.status = 1; + link = document.createElement('link'); + link.rel = 'stylesheet'; + link.type = 'text/css'; + link.id = 'u' + (idCount++); + link.async = false; + link.defer = false; + startTime = new Date().getTime(); + + // Feature detect onload on link element and sniff older webkits since it has an broken onload event + if ("onload" in link && !isOldWebKit()) { + link.onload = waitForWebKitLinkLoaded; + link.onerror = failed; + } else { + // Sniff for old Firefox that doesn't support the onload event on link elements + // TODO: Remove this in the future when everyone uses modern browsers + if (navigator.userAgent.indexOf("Firefox") > 0) { + style = document.createElement('style'); + style.textContent = '@import "' + url + '"'; + waitForGeckoLinkLoaded(); + appendToHead(style); + return; + } else { + // Use the id owner on older webkits + waitForWebKitLinkLoaded(); + } + } + + appendToHead(link); + link.href = url; + } + + this.load = load; + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/TreeWalker.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/TreeWalker.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,93 @@ +/** + * TreeWalker.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * TreeWalker class enables you to walk the DOM in a linear manner. + * + * @class tinymce.dom.TreeWalker + * @example + * var walker = new tinymce.dom.TreeWalker(startNode); + * + * do { + * console.log(walker.current()); + * } while (walker.next()); + */ +define("tinymce/dom/TreeWalker", [], function() { + /** + * Constructs a new TreeWalker instance. + * + * @constructor + * @method TreeWalker + * @param {Node} startNode Node to start walking from. + * @param {node} rootNode Optional root node to never walk out of. + */ + return function(startNode, rootNode) { + var node = startNode; + + function findSibling(node, startName, siblingName, shallow) { + var sibling, parent; + + if (node) { + // Walk into nodes if it has a start + if (!shallow && node[startName]) { + return node[startName]; + } + + // Return the sibling if it has one + if (node != rootNode) { + sibling = node[siblingName]; + if (sibling) { + return sibling; + } + + // Walk up the parents to look for siblings + for (parent = node.parentNode; parent && parent != rootNode; parent = parent.parentNode) { + sibling = parent[siblingName]; + if (sibling) { + return sibling; + } + } + } + } + } + + /** + * Returns the current node. + * + * @method current + * @return {Node} Current node where the walker is. + */ + this.current = function() { + return node; + }; + + /** + * Walks to the next node in tree. + * + * @method next + * @return {Node} Current node where the walker is after moving to the next node. + */ + this.next = function(shallow) { + node = findSibling(node, 'firstChild', 'nextSibling', shallow); + return node; + }; + + /** + * Walks to the previous node in tree. + * + * @method prev + * @return {Node} Current node where the walker is after moving to the previous node. + */ + this.prev = function(shallow) { + node = findSibling(node, 'lastChild', 'previousSibling', shallow); + return node; + }; + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/TridentSelection.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/dom/TridentSelection.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,506 @@ +/** + * TridentSelection.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Selection class for old explorer versions. This one fakes the + * native selection object available on modern browsers. + * + * @class tinymce.dom.TridentSelection + */ +define("tinymce/dom/TridentSelection", [], function() { + function Selection(selection) { + var self = this, dom = selection.dom, FALSE = false; + + function getPosition(rng, start) { + var checkRng, startIndex = 0, endIndex, inside, + children, child, offset, index, position = -1, parent; + + // Setup test range, collapse it and get the parent + checkRng = rng.duplicate(); + checkRng.collapse(start); + parent = checkRng.parentElement(); + + // Check if the selection is within the right document + if (parent.ownerDocument !== selection.dom.doc) { + return; + } + + // IE will report non editable elements as it's parent so look for an editable one + while (parent.contentEditable === "false") { + parent = parent.parentNode; + } + + // If parent doesn't have any children then return that we are inside the element + if (!parent.hasChildNodes()) { + return {node: parent, inside: 1}; + } + + // Setup node list and endIndex + children = parent.children; + endIndex = children.length - 1; + + // Perform a binary search for the position + while (startIndex <= endIndex) { + index = Math.floor((startIndex + endIndex) / 2); + + // Move selection to node and compare the ranges + child = children[index]; + checkRng.moveToElementText(child); + position = checkRng.compareEndPoints(start ? 'StartToStart' : 'EndToEnd', rng); + + // Before/after or an exact match + if (position > 0) { + endIndex = index - 1; + } else if (position < 0) { + startIndex = index + 1; + } else { + return {node: child}; + } + } + + // Check if child position is before or we didn't find a position + if (position < 0) { + // No element child was found use the parent element and the offset inside that + if (!child) { + checkRng.moveToElementText(parent); + checkRng.collapse(true); + child = parent; + inside = true; + } else { + checkRng.collapse(false); + } + + // Walk character by character in text node until we hit the selected range endpoint, + // hit the end of document or parent isn't the right one + // We need to walk char by char since rng.text or rng.htmlText will trim line endings + offset = 0; + while (checkRng.compareEndPoints(start ? 'StartToStart' : 'StartToEnd', rng) !== 0) { + if (checkRng.move('character', 1) === 0 || parent != checkRng.parentElement()) { + break; + } + + offset++; + } + } else { + // Child position is after the selection endpoint + checkRng.collapse(true); + + // Walk character by character in text node until we hit the selected range endpoint, hit + // the end of document or parent isn't the right one + offset = 0; + while (checkRng.compareEndPoints(start ? 'StartToStart' : 'StartToEnd', rng) !== 0) { + if (checkRng.move('character', -1) === 0 || parent != checkRng.parentElement()) { + break; + } + + offset++; + } + } + + return {node: child, position: position, offset: offset, inside: inside}; + } + + // Returns a W3C DOM compatible range object by using the IE Range API + function getRange() { + var ieRange = selection.getRng(), domRange = dom.createRng(), element, collapsed, tmpRange, element2, bookmark; + + // If selection is outside the current document just return an empty range + element = ieRange.item ? ieRange.item(0) : ieRange.parentElement(); + if (element.ownerDocument != dom.doc) { + return domRange; + } + + collapsed = selection.isCollapsed(); + + // Handle control selection + if (ieRange.item) { + domRange.setStart(element.parentNode, dom.nodeIndex(element)); + domRange.setEnd(domRange.startContainer, domRange.startOffset + 1); + + return domRange; + } + + function findEndPoint(start) { + var endPoint = getPosition(ieRange, start), container, offset, textNodeOffset = 0, sibling, undef, nodeValue; + + container = endPoint.node; + offset = endPoint.offset; + + if (endPoint.inside && !container.hasChildNodes()) { + domRange[start ? 'setStart' : 'setEnd'](container, 0); + return; + } + + if (offset === undef) { + domRange[start ? 'setStartBefore' : 'setEndAfter'](container); + return; + } + + if (endPoint.position < 0) { + sibling = endPoint.inside ? container.firstChild : container.nextSibling; + + if (!sibling) { + domRange[start ? 'setStartAfter' : 'setEndAfter'](container); + return; + } + + if (!offset) { + if (sibling.nodeType == 3) { + domRange[start ? 'setStart' : 'setEnd'](sibling, 0); + } else { + domRange[start ? 'setStartBefore' : 'setEndBefore'](sibling); + } + + return; + } + + // Find the text node and offset + while (sibling) { + if (sibling.nodeType == 3) { + nodeValue = sibling.nodeValue; + textNodeOffset += nodeValue.length; + + // We are at or passed the position we where looking for + if (textNodeOffset >= offset) { + container = sibling; + textNodeOffset -= offset; + textNodeOffset = nodeValue.length - textNodeOffset; + break; + } + } + + sibling = sibling.nextSibling; + } + } else { + // Find the text node and offset + sibling = container.previousSibling; + + if (!sibling) { + return domRange[start ? 'setStartBefore' : 'setEndBefore'](container); + } + + // If there isn't any text to loop then use the first position + if (!offset) { + if (container.nodeType == 3) { + domRange[start ? 'setStart' : 'setEnd'](sibling, container.nodeValue.length); + } else { + domRange[start ? 'setStartAfter' : 'setEndAfter'](sibling); + } + + return; + } + + while (sibling) { + if (sibling.nodeType == 3) { + textNodeOffset += sibling.nodeValue.length; + + // We are at or passed the position we where looking for + if (textNodeOffset >= offset) { + container = sibling; + textNodeOffset -= offset; + break; + } + } + + sibling = sibling.previousSibling; + } + } + + domRange[start ? 'setStart' : 'setEnd'](container, textNodeOffset); + } + + try { + // Find start point + findEndPoint(true); + + // Find end point if needed + if (!collapsed) { + findEndPoint(); + } + } catch (ex) { + // IE has a nasty bug where text nodes might throw "invalid argument" when you + // access the nodeValue or other properties of text nodes. This seems to happend when + // text nodes are split into two nodes by a delete/backspace call. So lets detect it and try to fix it. + if (ex.number == -2147024809) { + // Get the current selection + bookmark = self.getBookmark(2); + + // Get start element + tmpRange = ieRange.duplicate(); + tmpRange.collapse(true); + element = tmpRange.parentElement(); + + // Get end element + if (!collapsed) { + tmpRange = ieRange.duplicate(); + tmpRange.collapse(false); + element2 = tmpRange.parentElement(); + element2.innerHTML = element2.innerHTML; + } + + // Remove the broken elements + element.innerHTML = element.innerHTML; + + // Restore the selection + self.moveToBookmark(bookmark); + + // Since the range has moved we need to re-get it + ieRange = selection.getRng(); + + // Find start point + findEndPoint(true); + + // Find end point if needed + if (!collapsed) { + findEndPoint(); + } + } else { + throw ex; // Throw other errors + } + } + + return domRange; + } + + this.getBookmark = function(type) { + var rng = selection.getRng(), bookmark = {}; + + function getIndexes(node) { + var parent, root, children, i, indexes = []; + + parent = node.parentNode; + root = dom.getRoot().parentNode; + + while (parent != root && parent.nodeType !== 9) { + children = parent.children; + + i = children.length; + while (i--) { + if (node === children[i]) { + indexes.push(i); + break; + } + } + + node = parent; + parent = parent.parentNode; + } + + return indexes; + } + + function getBookmarkEndPoint(start) { + var position; + + position = getPosition(rng, start); + if (position) { + return { + position: position.position, + offset: position.offset, + indexes: getIndexes(position.node), + inside: position.inside + }; + } + } + + // Non ubstructive bookmark + if (type === 2) { + // Handle text selection + if (!rng.item) { + bookmark.start = getBookmarkEndPoint(true); + + if (!selection.isCollapsed()) { + bookmark.end = getBookmarkEndPoint(); + } + } else { + bookmark.start = {ctrl: true, indexes: getIndexes(rng.item(0))}; + } + } + + return bookmark; + }; + + this.moveToBookmark = function(bookmark) { + var rng, body = dom.doc.body; + + function resolveIndexes(indexes) { + var node, i, idx, children; + + node = dom.getRoot(); + for (i = indexes.length - 1; i >= 0; i--) { + children = node.children; + idx = indexes[i]; + + if (idx <= children.length - 1) { + node = children[idx]; + } + } + + return node; + } + + function setBookmarkEndPoint(start) { + var endPoint = bookmark[start ? 'start' : 'end'], moveLeft, moveRng, undef, offset; + + if (endPoint) { + moveLeft = endPoint.position > 0; + + moveRng = body.createTextRange(); + moveRng.moveToElementText(resolveIndexes(endPoint.indexes)); + + offset = endPoint.offset; + if (offset !== undef) { + moveRng.collapse(endPoint.inside || moveLeft); + moveRng.moveStart('character', moveLeft ? -offset : offset); + } else { + moveRng.collapse(start); + } + + rng.setEndPoint(start ? 'StartToStart' : 'EndToStart', moveRng); + + if (start) { + rng.collapse(true); + } + } + } + + if (bookmark.start) { + if (bookmark.start.ctrl) { + rng = body.createControlRange(); + rng.addElement(resolveIndexes(bookmark.start.indexes)); + rng.select(); + } else { + rng = body.createTextRange(); + setBookmarkEndPoint(true); + setBookmarkEndPoint(); + rng.select(); + } + } + }; + + this.addRange = function(rng) { + var ieRng, ctrlRng, startContainer, startOffset, endContainer, endOffset, sibling, + doc = selection.dom.doc, body = doc.body, nativeRng, ctrlElm; + + function setEndPoint(start) { + var container, offset, marker, tmpRng, nodes; + + marker = dom.create('a'); + container = start ? startContainer : endContainer; + offset = start ? startOffset : endOffset; + tmpRng = ieRng.duplicate(); + + if (container == doc || container == doc.documentElement) { + container = body; + offset = 0; + } + + if (container.nodeType == 3) { + container.parentNode.insertBefore(marker, container); + tmpRng.moveToElementText(marker); + tmpRng.moveStart('character', offset); + dom.remove(marker); + ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng); + } else { + nodes = container.childNodes; + + if (nodes.length) { + if (offset >= nodes.length) { + dom.insertAfter(marker, nodes[nodes.length - 1]); + } else { + container.insertBefore(marker, nodes[offset]); + } + + tmpRng.moveToElementText(marker); + } else if (container.canHaveHTML) { + // Empty node selection for example
|
+ // Setting innerHTML with a span marker then remove that marker seems to keep empty block elements open + container.innerHTML = ''; + marker = container.firstChild; + tmpRng.moveToElementText(marker); + tmpRng.collapse(FALSE); // Collapse false works better than true for some odd reason + } + + ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng); + dom.remove(marker); + } + } + + // Setup some shorter versions + startContainer = rng.startContainer; + startOffset = rng.startOffset; + endContainer = rng.endContainer; + endOffset = rng.endOffset; + ieRng = body.createTextRange(); + + // If single element selection then try making a control selection out of it + if (startContainer == endContainer && startContainer.nodeType == 1) { + // Trick to place the caret inside an empty block element like

+ if (startOffset == endOffset && !startContainer.hasChildNodes()) { + if (startContainer.canHaveHTML) { + // Check if previous sibling is an empty block if it is then we need to render it + // IE would otherwise move the caret into the sibling instead of the empty startContainer see: #5236 + // Example this:

|

would become this:

|

+ sibling = startContainer.previousSibling; + if (sibling && !sibling.hasChildNodes() && dom.isBlock(sibling)) { + sibling.innerHTML = ''; + } else { + sibling = null; + } + + startContainer.innerHTML = ''; + ieRng.moveToElementText(startContainer.lastChild); + ieRng.select(); + dom.doc.selection.clear(); + startContainer.innerHTML = ''; + + if (sibling) { + sibling.innerHTML = ''; + } + return; + } else { + startOffset = dom.nodeIndex(startContainer); + startContainer = startContainer.parentNode; + } + } + + if (startOffset == endOffset - 1) { + try { + ctrlElm = startContainer.childNodes[startOffset]; + ctrlRng = body.createControlRange(); + ctrlRng.addElement(ctrlElm); + ctrlRng.select(); + + // Check if the range produced is on the correct element and is a control range + // On IE 8 it will select the parent contentEditable container if you select an inner element see: #5398 + nativeRng = selection.getRng(); + if (nativeRng.item && ctrlElm === nativeRng.item(0)) { + return; + } + } catch (ex) { + // Ignore + } + } + } + + // Set start/end point of selection + setEndPoint(true); + setEndPoint(); + + // Select the new range and scroll it into view + ieRng.select(); + }; + + // Expose range method + this.getRangeAt = getRange; + } + + return Selection; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/fmt/Preview.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/fmt/Preview.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,151 @@ +/** + * Preview.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Internal class for generating previews styles for formats. + * + * Example: + * Preview.getCssText(editor, 'bold'); + * + * @class tinymce.fmt.Preview + * @private + */ +define("tinymce/fmt/Preview", [ + "tinymce/util/Tools" +], function(Tools) { + var each = Tools.each; + + function getCssText(editor, format) { + var name, previewElm, dom = editor.dom; + var previewCss = '', parentFontSize, previewStyles; + + previewStyles = editor.settings.preview_styles; + + // No preview forced + if (previewStyles === false) { + return ''; + } + + // Default preview + if (!previewStyles) { + previewStyles = 'font-family font-size font-weight font-style text-decoration ' + + 'text-transform color background-color border border-radius outline text-shadow'; + } + + // Removes any variables since these can't be previewed + function removeVars(val) { + return val.replace(/%(\w+)/g, ''); + } + + // Create block/inline element to use for preview + if (typeof format == "string") { + format = editor.formatter.get(format); + if (!format) { + return; + } + + format = format[0]; + } + + name = format.block || format.inline || 'span'; + previewElm = dom.create(name); + + // Add format styles to preview element + each(format.styles, function(value, name) { + value = removeVars(value); + + if (value) { + dom.setStyle(previewElm, name, value); + } + }); + + // Add attributes to preview element + each(format.attributes, function(value, name) { + value = removeVars(value); + + if (value) { + dom.setAttrib(previewElm, name, value); + } + }); + + // Add classes to preview element + each(format.classes, function(value) { + value = removeVars(value); + + if (!dom.hasClass(previewElm, value)) { + dom.addClass(previewElm, value); + } + }); + + editor.fire('PreviewFormats'); + + // Add the previewElm outside the visual area + dom.setStyles(previewElm, {position: 'absolute', left: -0xFFFF}); + editor.getBody().appendChild(previewElm); + + // Get parent container font size so we can compute px values out of em/% for older IE:s + parentFontSize = dom.getStyle(editor.getBody(), 'fontSize', true); + parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0; + + each(previewStyles.split(' '), function(name) { + var value = dom.getStyle(previewElm, name, true); + + // If background is transparent then check if the body has a background color we can use + if (name == 'background-color' && /transparent|rgba\s*\([^)]+,\s*0\)/.test(value)) { + value = dom.getStyle(editor.getBody(), name, true); + + // Ignore white since it's the default color, not the nicest fix + // TODO: Fix this by detecting runtime style + if (dom.toHex(value).toLowerCase() == '#ffffff') { + return; + } + } + + if (name == 'color') { + // Ignore black since it's the default color, not the nicest fix + // TODO: Fix this by detecting runtime style + if (dom.toHex(value).toLowerCase() == '#000000') { + return; + } + } + + // Old IE won't calculate the font size so we need to do that manually + if (name == 'font-size') { + if (/em|%$/.test(value)) { + if (parentFontSize === 0) { + return; + } + + // Convert font size from em/% to px + value = parseFloat(value, 10) / (/%$/.test(value) ? 100 : 1); + value = (value * parentFontSize) + 'px'; + } + } + + if (name == "border" && value) { + previewCss += 'padding:0 2px;'; + } + + previewCss += name + ':' + value + ';'; + }); + + editor.fire('AfterPreviewFormats'); + + //previewCss += 'line-height:normal'; + + dom.remove(previewElm); + + return previewCss; + } + + return { + getCssText: getCssText + }; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/DomParser.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/DomParser.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,804 @@ +/** + * DomParser.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class parses HTML code into a DOM like structure of nodes it will remove redundant whitespace and make + * sure that the node tree is valid according to the specified schema. + * So for example:

a

b

c

will become

a

b

c

+ * + * @example + * var parser = new tinymce.html.DomParser({validate: true}, schema); + * var rootNode = parser.parse('

content

'); + * + * @class tinymce.html.DomParser + * @version 3.4 + */ +define("tinymce/html/DomParser", [ + "tinymce/html/Node", + "tinymce/html/Schema", + "tinymce/html/SaxParser", + "tinymce/util/Tools" +], function(Node, Schema, SaxParser, Tools) { + var makeMap = Tools.makeMap, each = Tools.each, explode = Tools.explode, extend = Tools.extend; + + /** + * Constructs a new DomParser instance. + * + * @constructor + * @method DomParser + * @param {Object} settings Name/value collection of settings. comment, cdata, text, start and end are callbacks. + * @param {tinymce.html.Schema} schema HTML Schema class to use when parsing. + */ + return function(settings, schema) { + var self = this, nodeFilters = {}, attributeFilters = [], matchedNodes = {}, matchedAttributes = {}; + + settings = settings || {}; + settings.validate = "validate" in settings ? settings.validate : true; + settings.root_name = settings.root_name || 'body'; + self.schema = schema = schema || new Schema(); + + function fixInvalidChildren(nodes) { + var ni, node, parent, parents, newParent, currentNode, tempNode, childNode, i; + var nonEmptyElements, nonSplitableElements, textBlockElements, sibling, nextNode; + + nonSplitableElements = makeMap('tr,td,th,tbody,thead,tfoot,table'); + nonEmptyElements = schema.getNonEmptyElements(); + textBlockElements = schema.getTextBlockElements(); + + for (ni = 0; ni < nodes.length; ni++) { + node = nodes[ni]; + + // Already removed or fixed + if (!node.parent || node.fixed) { + continue; + } + + // If the invalid element is a text block and the text block is within a parent LI element + // Then unwrap the first text block and convert other sibling text blocks to LI elements similar to Word/Open Office + if (textBlockElements[node.name] && node.parent.name == 'li') { + // Move sibling text blocks after LI element + sibling = node.next; + while (sibling) { + if (textBlockElements[sibling.name]) { + sibling.name = 'li'; + sibling.fixed = true; + node.parent.insert(sibling, node.parent); + } else { + break; + } + + sibling = sibling.next; + } + + // Unwrap current text block + node.unwrap(node); + continue; + } + + // Get list of all parent nodes until we find a valid parent to stick the child into + parents = [node]; + for (parent = node.parent; parent && !schema.isValidChild(parent.name, node.name) && + !nonSplitableElements[parent.name]; parent = parent.parent) { + parents.push(parent); + } + + // Found a suitable parent + if (parent && parents.length > 1) { + // Reverse the array since it makes looping easier + parents.reverse(); + + // Clone the related parent and insert that after the moved node + newParent = currentNode = self.filterNode(parents[0].clone()); + + // Start cloning and moving children on the left side of the target node + for (i = 0; i < parents.length - 1; i++) { + if (schema.isValidChild(currentNode.name, parents[i].name)) { + tempNode = self.filterNode(parents[i].clone()); + currentNode.append(tempNode); + } else { + tempNode = currentNode; + } + + for (childNode = parents[i].firstChild; childNode && childNode != parents[i + 1];) { + nextNode = childNode.next; + tempNode.append(childNode); + childNode = nextNode; + } + + currentNode = tempNode; + } + + if (!newParent.isEmpty(nonEmptyElements)) { + parent.insert(newParent, parents[0], true); + parent.insert(node, newParent); + } else { + parent.insert(node, parents[0], true); + } + + // Check if the element is empty by looking through it's contents and special treatment for


+ parent = parents[0]; + if (parent.isEmpty(nonEmptyElements) || parent.firstChild === parent.lastChild && parent.firstChild.name === 'br') { + parent.empty().remove(); + } + } else if (node.parent) { + // If it's an LI try to find a UL/OL for it or wrap it + if (node.name === 'li') { + sibling = node.prev; + if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) { + sibling.append(node); + continue; + } + + sibling = node.next; + if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) { + sibling.insert(node, sibling.firstChild, true); + continue; + } + + node.wrap(self.filterNode(new Node('ul', 1))); + continue; + } + + // Try wrapping the element in a DIV + if (schema.isValidChild(node.parent.name, 'div') && schema.isValidChild('div', node.name)) { + node.wrap(self.filterNode(new Node('div', 1))); + } else { + // We failed wrapping it, then remove or unwrap it + if (node.name === 'style' || node.name === 'script') { + node.empty().remove(); + } else { + node.unwrap(); + } + } + } + } + } + + /** + * Runs the specified node though the element and attributes filters. + * + * @method filterNode + * @param {tinymce.html.Node} Node the node to run filters on. + * @return {tinymce.html.Node} The passed in node. + */ + self.filterNode = function(node) { + var i, name, list; + + // Run element filters + if (name in nodeFilters) { + list = matchedNodes[name]; + + if (list) { + list.push(node); + } else { + matchedNodes[name] = [node]; + } + } + + // Run attribute filters + i = attributeFilters.length; + while (i--) { + name = attributeFilters[i].name; + + if (name in node.attributes.map) { + list = matchedAttributes[name]; + + if (list) { + list.push(node); + } else { + matchedAttributes[name] = [node]; + } + } + } + + return node; + }; + + /** + * Adds a node filter function to the parser, the parser will collect the specified nodes by name + * and then execute the callback ones it has finished parsing the document. + * + * @example + * parser.addNodeFilter('p,h1', function(nodes, name) { + * for (var i = 0; i < nodes.length; i++) { + * console.log(nodes[i].name); + * } + * }); + * @method addNodeFilter + * @method {String} name Comma separated list of nodes to collect. + * @param {function} callback Callback function to execute once it has collected nodes. + */ + self.addNodeFilter = function(name, callback) { + each(explode(name), function(name) { + var list = nodeFilters[name]; + + if (!list) { + nodeFilters[name] = list = []; + } + + list.push(callback); + }); + }; + + /** + * Adds a attribute filter function to the parser, the parser will collect nodes that has the specified attributes + * and then execute the callback ones it has finished parsing the document. + * + * @example + * parser.addAttributeFilter('src,href', function(nodes, name) { + * for (var i = 0; i < nodes.length; i++) { + * console.log(nodes[i].name); + * } + * }); + * @method addAttributeFilter + * @method {String} name Comma separated list of nodes to collect. + * @param {function} callback Callback function to execute once it has collected nodes. + */ + self.addAttributeFilter = function(name, callback) { + each(explode(name), function(name) { + var i; + + for (i = 0; i < attributeFilters.length; i++) { + if (attributeFilters[i].name === name) { + attributeFilters[i].callbacks.push(callback); + return; + } + } + + attributeFilters.push({name: name, callbacks: [callback]}); + }); + }; + + /** + * Parses the specified HTML string into a DOM like node tree and returns the result. + * + * @example + * var rootNode = new DomParser({...}).parse('text'); + * @method parse + * @param {String} html Html string to sax parse. + * @param {Object} args Optional args object that gets passed to all filter functions. + * @return {tinymce.html.Node} Root node containing the tree. + */ + self.parse = function(html, args) { + var parser, rootNode, node, nodes, i, l, fi, fl, list, name, validate; + var blockElements, startWhiteSpaceRegExp, invalidChildren = [], isInWhiteSpacePreservedElement; + var endWhiteSpaceRegExp, allWhiteSpaceRegExp, isAllWhiteSpaceRegExp, whiteSpaceElements; + var children, nonEmptyElements, rootBlockName; + + args = args || {}; + matchedNodes = {}; + matchedAttributes = {}; + blockElements = extend(makeMap('script,style,head,html,body,title,meta,param'), schema.getBlockElements()); + nonEmptyElements = schema.getNonEmptyElements(); + children = schema.children; + validate = settings.validate; + rootBlockName = "forced_root_block" in args ? args.forced_root_block : settings.forced_root_block; + + whiteSpaceElements = schema.getWhiteSpaceElements(); + startWhiteSpaceRegExp = /^[ \t\r\n]+/; + endWhiteSpaceRegExp = /[ \t\r\n]+$/; + allWhiteSpaceRegExp = /[ \t\r\n]+/g; + isAllWhiteSpaceRegExp = /^[ \t\r\n]+$/; + + function addRootBlocks() { + var node = rootNode.firstChild, next, rootBlockNode; + + // Removes whitespace at beginning and end of block so: + //

x

->

x

+ function trim(rootBlockNode) { + if (rootBlockNode) { + node = rootBlockNode.firstChild; + if (node && node.type == 3) { + node.value = node.value.replace(startWhiteSpaceRegExp, ''); + } + + node = rootBlockNode.lastChild; + if (node && node.type == 3) { + node.value = node.value.replace(endWhiteSpaceRegExp, ''); + } + } + } + + // Check if rootBlock is valid within rootNode for example if P is valid in H1 if H1 is the contentEditabe root + if (!schema.isValidChild(rootNode.name, rootBlockName.toLowerCase())) { + return; + } + + while (node) { + next = node.next; + + if (node.type == 3 || (node.type == 1 && node.name !== 'p' && + !blockElements[node.name] && !node.attr('data-mce-type'))) { + if (!rootBlockNode) { + // Create a new root block element + rootBlockNode = createNode(rootBlockName, 1); + rootBlockNode.attr(settings.forced_root_block_attrs); + rootNode.insert(rootBlockNode, node); + rootBlockNode.append(node); + } else { + rootBlockNode.append(node); + } + } else { + trim(rootBlockNode); + rootBlockNode = null; + } + + node = next; + } + + trim(rootBlockNode); + } + + function createNode(name, type) { + var node = new Node(name, type), list; + + if (name in nodeFilters) { + list = matchedNodes[name]; + + if (list) { + list.push(node); + } else { + matchedNodes[name] = [node]; + } + } + + return node; + } + + function removeWhitespaceBefore(node) { + var textNode, textVal, sibling; + + for (textNode = node.prev; textNode && textNode.type === 3;) { + textVal = textNode.value.replace(endWhiteSpaceRegExp, ''); + + if (textVal.length > 0) { + textNode.value = textVal; + textNode = textNode.prev; + } else { + sibling = textNode.prev; + textNode.remove(); + textNode = sibling; + } + } + } + + function cloneAndExcludeBlocks(input) { + var name, output = {}; + + for (name in input) { + if (name !== 'li' && name != 'p') { + output[name] = input[name]; + } + } + + return output; + } + + parser = new SaxParser({ + validate: validate, + allow_script_urls: settings.allow_script_urls, + allow_conditional_comments: settings.allow_conditional_comments, + + // Exclude P and LI from DOM parsing since it's treated better by the DOM parser + self_closing_elements: cloneAndExcludeBlocks(schema.getSelfClosingElements()), + + cdata: function(text) { + node.append(createNode('#cdata', 4)).value = text; + }, + + text: function(text, raw) { + var textNode; + + // Trim all redundant whitespace on non white space elements + if (!isInWhiteSpacePreservedElement) { + text = text.replace(allWhiteSpaceRegExp, ' '); + + if (node.lastChild && blockElements[node.lastChild.name]) { + text = text.replace(startWhiteSpaceRegExp, ''); + } + } + + // Do we need to create the node + if (text.length !== 0) { + textNode = createNode('#text', 3); + textNode.raw = !!raw; + node.append(textNode).value = text; + } + }, + + comment: function(text) { + node.append(createNode('#comment', 8)).value = text; + }, + + pi: function(name, text) { + node.append(createNode(name, 7)).value = text; + removeWhitespaceBefore(node); + }, + + doctype: function(text) { + var newNode; + + newNode = node.append(createNode('#doctype', 10)); + newNode.value = text; + removeWhitespaceBefore(node); + }, + + start: function(name, attrs, empty) { + var newNode, attrFiltersLen, elementRule, attrName, parent; + + elementRule = validate ? schema.getElementRule(name) : {}; + if (elementRule) { + newNode = createNode(elementRule.outputName || name, 1); + newNode.attributes = attrs; + newNode.shortEnded = empty; + + node.append(newNode); + + // Check if node is valid child of the parent node is the child is + // unknown we don't collect it since it's probably a custom element + parent = children[node.name]; + if (parent && children[newNode.name] && !parent[newNode.name]) { + invalidChildren.push(newNode); + } + + attrFiltersLen = attributeFilters.length; + while (attrFiltersLen--) { + attrName = attributeFilters[attrFiltersLen].name; + + if (attrName in attrs.map) { + list = matchedAttributes[attrName]; + + if (list) { + list.push(newNode); + } else { + matchedAttributes[attrName] = [newNode]; + } + } + } + + // Trim whitespace before block + if (blockElements[name]) { + removeWhitespaceBefore(newNode); + } + + // Change current node if the element wasn't empty i.e not
or + if (!empty) { + node = newNode; + } + + // Check if we are inside a whitespace preserved element + if (!isInWhiteSpacePreservedElement && whiteSpaceElements[name]) { + isInWhiteSpacePreservedElement = true; + } + } + }, + + end: function(name) { + var textNode, elementRule, text, sibling, tempNode; + + elementRule = validate ? schema.getElementRule(name) : {}; + if (elementRule) { + if (blockElements[name]) { + if (!isInWhiteSpacePreservedElement) { + // Trim whitespace of the first node in a block + textNode = node.firstChild; + if (textNode && textNode.type === 3) { + text = textNode.value.replace(startWhiteSpaceRegExp, ''); + + // Any characters left after trim or should we remove it + if (text.length > 0) { + textNode.value = text; + textNode = textNode.next; + } else { + sibling = textNode.next; + textNode.remove(); + textNode = sibling; + + // Remove any pure whitespace siblings + while (textNode && textNode.type === 3) { + text = textNode.value; + sibling = textNode.next; + + if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) { + textNode.remove(); + textNode = sibling; + } + + textNode = sibling; + } + } + } + + // Trim whitespace of the last node in a block + textNode = node.lastChild; + if (textNode && textNode.type === 3) { + text = textNode.value.replace(endWhiteSpaceRegExp, ''); + + // Any characters left after trim or should we remove it + if (text.length > 0) { + textNode.value = text; + textNode = textNode.prev; + } else { + sibling = textNode.prev; + textNode.remove(); + textNode = sibling; + + // Remove any pure whitespace siblings + while (textNode && textNode.type === 3) { + text = textNode.value; + sibling = textNode.prev; + + if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) { + textNode.remove(); + textNode = sibling; + } + + textNode = sibling; + } + } + } + } + + // Trim start white space + // Removed due to: #5424 + /*textNode = node.prev; + if (textNode && textNode.type === 3) { + text = textNode.value.replace(startWhiteSpaceRegExp, ''); + + if (text.length > 0) + textNode.value = text; + else + textNode.remove(); + }*/ + } + + // Check if we exited a whitespace preserved element + if (isInWhiteSpacePreservedElement && whiteSpaceElements[name]) { + isInWhiteSpacePreservedElement = false; + } + + // Handle empty nodes + if (elementRule.removeEmpty || elementRule.paddEmpty) { + if (node.isEmpty(nonEmptyElements)) { + if (elementRule.paddEmpty) { + node.empty().append(new Node('#text', '3')).value = '\u00a0'; + } else { + // Leave nodes that have a name like + if (!node.attributes.map.name && !node.attributes.map.id) { + tempNode = node.parent; + + if (blockElements[node.name]) { + node.empty().remove(); + } else { + node.unwrap(); + } + + node = tempNode; + return; + } + } + } + } + + node = node.parent; + } + } + }, schema); + + rootNode = node = new Node(args.context || settings.root_name, 11); + + parser.parse(html); + + // Fix invalid children or report invalid children in a contextual parsing + if (validate && invalidChildren.length) { + if (!args.context) { + fixInvalidChildren(invalidChildren); + } else { + args.invalid = true; + } + } + + // Wrap nodes in the root into block elements if the root is body + if (rootBlockName && (rootNode.name == 'body' || args.isRootContent)) { + addRootBlocks(); + } + + // Run filters only when the contents is valid + if (!args.invalid) { + // Run node filters + for (name in matchedNodes) { + list = nodeFilters[name]; + nodes = matchedNodes[name]; + + // Remove already removed children + fi = nodes.length; + while (fi--) { + if (!nodes[fi].parent) { + nodes.splice(fi, 1); + } + } + + for (i = 0, l = list.length; i < l; i++) { + list[i](nodes, name, args); + } + } + + // Run attribute filters + for (i = 0, l = attributeFilters.length; i < l; i++) { + list = attributeFilters[i]; + + if (list.name in matchedAttributes) { + nodes = matchedAttributes[list.name]; + + // Remove already removed children + fi = nodes.length; + while (fi--) { + if (!nodes[fi].parent) { + nodes.splice(fi, 1); + } + } + + for (fi = 0, fl = list.callbacks.length; fi < fl; fi++) { + list.callbacks[fi](nodes, list.name, args); + } + } + } + } + + return rootNode; + }; + + // Remove
at end of block elements Gecko and WebKit injects BR elements to + // make it possible to place the caret inside empty blocks. This logic tries to remove + // these elements and keep br elements that where intended to be there intact + if (settings.remove_trailing_brs) { + self.addNodeFilter('br', function(nodes) { + var i, l = nodes.length, node, blockElements = extend({}, schema.getBlockElements()); + var nonEmptyElements = schema.getNonEmptyElements(), parent, lastParent, prev, prevName; + var elementRule, textNode; + + // Remove brs from body element as well + blockElements.body = 1; + + // Must loop forwards since it will otherwise remove all brs in

a


+ for (i = 0; i < l; i++) { + node = nodes[i]; + parent = node.parent; + + if (blockElements[node.parent.name] && node === parent.lastChild) { + // Loop all nodes to the left of the current node and check for other BR elements + // excluding bookmarks since they are invisible + prev = node.prev; + while (prev) { + prevName = prev.name; + + // Ignore bookmarks + if (prevName !== "span" || prev.attr('data-mce-type') !== 'bookmark') { + // Found a non BR element + if (prevName !== "br") { + break; + } + + // Found another br it's a

structure then don't remove anything + if (prevName === 'br') { + node = null; + break; + } + } + + prev = prev.prev; + } + + if (node) { + node.remove(); + + // Is the parent to be considered empty after we removed the BR + if (parent.isEmpty(nonEmptyElements)) { + elementRule = schema.getElementRule(parent.name); + + // Remove or padd the element depending on schema rule + if (elementRule) { + if (elementRule.removeEmpty) { + parent.remove(); + } else if (elementRule.paddEmpty) { + parent.empty().append(new Node('#text', 3)).value = '\u00a0'; + } + } + } + } + } else { + // Replaces BR elements inside inline elements like


+ // so they become

 

+ lastParent = node; + while (parent && parent.firstChild === lastParent && parent.lastChild === lastParent) { + lastParent = parent; + + if (blockElements[parent.name]) { + break; + } + + parent = parent.parent; + } + + if (lastParent === parent) { + textNode = new Node('#text', 3); + textNode.value = '\u00a0'; + node.replace(textNode); + } + } + } + }); + } + + // Force anchor names closed, unless the setting "allow_html_in_named_anchor" is explicitly included. + if (!settings.allow_html_in_named_anchor) { + self.addAttributeFilter('id,name', function(nodes) { + var i = nodes.length, sibling, prevSibling, parent, node; + + while (i--) { + node = nodes[i]; + if (node.name === 'a' && node.firstChild && !node.attr('href')) { + parent = node.parent; + + // Move children after current node + sibling = node.lastChild; + do { + prevSibling = sibling.prev; + parent.insert(sibling, node); + sibling = prevSibling; + } while (sibling); + } + } + }); + } + + if (settings.validate && schema.getValidClasses()) { + self.addAttributeFilter('class', function(nodes) { + var i = nodes.length, node, classList, ci, className, classValue; + var validClasses = schema.getValidClasses(), validClassesMap, valid; + + while (i--) { + node = nodes[i]; + classList = node.attr('class').split(' '); + classValue = ''; + + for (ci = 0; ci < classList.length; ci++) { + className = classList[ci]; + valid = false; + + validClassesMap = validClasses['*']; + if (validClassesMap && validClassesMap[className]) { + valid = true; + } + + validClassesMap = validClasses[node.name]; + if (!valid && validClassesMap && validClassesMap[className]) { + valid = true; + } + + if (valid) { + if (classValue) { + classValue += ' '; + } + + classValue += className; + } + } + + if (!classValue.length) { + classValue = null; + } + + node.attr('class', classValue); + } + }); + } + }; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Entities.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Entities.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,268 @@ +/** + * Entities.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*jshint bitwise:false */ +/*eslint no-bitwise:0 */ + +/** + * Entity encoder class. + * + * @class tinymce.html.Entities + * @static + * @version 3.4 + */ +define("tinymce/html/Entities", [ + "tinymce/util/Tools" +], function(Tools) { + var makeMap = Tools.makeMap; + + var namedEntities, baseEntities, reverseEntities, + attrsCharsRegExp = /[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + textCharsRegExp = /[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + rawCharsRegExp = /[<>&\"\']/g, + entityRegExp = /&#([a-z0-9]+);?|&([a-z0-9]+);/gi, + asciiMap = { + 128: "\u20AC", 130: "\u201A", 131: "\u0192", 132: "\u201E", 133: "\u2026", 134: "\u2020", + 135: "\u2021", 136: "\u02C6", 137: "\u2030", 138: "\u0160", 139: "\u2039", 140: "\u0152", + 142: "\u017D", 145: "\u2018", 146: "\u2019", 147: "\u201C", 148: "\u201D", 149: "\u2022", + 150: "\u2013", 151: "\u2014", 152: "\u02DC", 153: "\u2122", 154: "\u0161", 155: "\u203A", + 156: "\u0153", 158: "\u017E", 159: "\u0178" + }; + + // Raw entities + baseEntities = { + '\"': '"', // Needs to be escaped since the YUI compressor would otherwise break the code + "'": ''', + '<': '<', + '>': '>', + '&': '&', + '\u0060': '`' + }; + + // Reverse lookup table for raw entities + reverseEntities = { + '<': '<', + '>': '>', + '&': '&', + '"': '"', + ''': "'" + }; + + // Decodes text by using the browser + function nativeDecode(text) { + var elm; + + elm = document.createElement("div"); + elm.innerHTML = text; + + return elm.textContent || elm.innerText || text; + } + + // Build a two way lookup table for the entities + function buildEntitiesLookup(items, radix) { + var i, chr, entity, lookup = {}; + + if (items) { + items = items.split(','); + radix = radix || 10; + + // Build entities lookup table + for (i = 0; i < items.length; i += 2) { + chr = String.fromCharCode(parseInt(items[i], radix)); + + // Only add non base entities + if (!baseEntities[chr]) { + entity = '&' + items[i + 1] + ';'; + lookup[chr] = entity; + lookup[entity] = chr; + } + } + + return lookup; + } + } + + // Unpack entities lookup where the numbers are in radix 32 to reduce the size + namedEntities = buildEntitiesLookup( + '50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' + + '5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' + + '5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' + + '5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' + + '68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' + + '6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' + + '6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' + + '75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' + + '7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' + + '7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' + + 'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' + + 'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' + + 't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' + + 'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' + + 'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' + + '81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' + + '8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' + + '8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' + + '8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' + + '8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' + + 'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' + + 'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' + + 'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' + + '80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' + + '811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32); + + var Entities = { + /** + * Encodes the specified string using raw entities. This means only the required XML base entities will be endoded. + * + * @method encodeRaw + * @param {String} text Text to encode. + * @param {Boolean} attr Optional flag to specify if the text is attribute contents. + * @return {String} Entity encoded text. + */ + encodeRaw: function(text, attr) { + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { + return baseEntities[chr] || chr; + }); + }, + + /** + * Encoded the specified text with both the attributes and text entities. This function will produce larger text contents + * since it doesn't know if the context is within a attribute or text node. This was added for compatibility + * and is exposed as the DOMUtils.encode function. + * + * @method encodeAllRaw + * @param {String} text Text to encode. + * @return {String} Entity encoded text. + */ + encodeAllRaw: function(text) { + return ('' + text).replace(rawCharsRegExp, function(chr) { + return baseEntities[chr] || chr; + }); + }, + + /** + * Encodes the specified string using numeric entities. The core entities will be + * encoded as named ones but all non lower ascii characters will be encoded into numeric entities. + * + * @method encodeNumeric + * @param {String} text Text to encode. + * @param {Boolean} attr Optional flag to specify if the text is attribute contents. + * @return {String} Entity encoded text. + */ + encodeNumeric: function(text, attr) { + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { + // Multi byte sequence convert it to a single entity + if (chr.length > 1) { + return '&#' + (((chr.charCodeAt(0) - 0xD800) * 0x400) + (chr.charCodeAt(1) - 0xDC00) + 0x10000) + ';'; + } + + return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';'; + }); + }, + + /** + * Encodes the specified string using named entities. The core entities will be encoded + * as named ones but all non lower ascii characters will be encoded into named entities. + * + * @method encodeNamed + * @param {String} text Text to encode. + * @param {Boolean} attr Optional flag to specify if the text is attribute contents. + * @param {Object} entities Optional parameter with entities to use. + * @return {String} Entity encoded text. + */ + encodeNamed: function(text, attr, entities) { + entities = entities || namedEntities; + + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { + return baseEntities[chr] || entities[chr] || chr; + }); + }, + + /** + * Returns an encode function based on the name(s) and it's optional entities. + * + * @method getEncodeFunc + * @param {String} name Comma separated list of encoders for example named,numeric. + * @param {String} entities Optional parameter with entities to use instead of the built in set. + * @return {function} Encode function to be used. + */ + getEncodeFunc: function(name, entities) { + entities = buildEntitiesLookup(entities) || namedEntities; + + function encodeNamedAndNumeric(text, attr) { + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { + return baseEntities[chr] || entities[chr] || '&#' + chr.charCodeAt(0) + ';' || chr; + }); + } + + function encodeCustomNamed(text, attr) { + return Entities.encodeNamed(text, attr, entities); + } + + // Replace + with , to be compatible with previous TinyMCE versions + name = makeMap(name.replace(/\+/g, ',')); + + // Named and numeric encoder + if (name.named && name.numeric) { + return encodeNamedAndNumeric; + } + + // Named encoder + if (name.named) { + // Custom names + if (entities) { + return encodeCustomNamed; + } + + return Entities.encodeNamed; + } + + // Numeric + if (name.numeric) { + return Entities.encodeNumeric; + } + + // Raw encoder + return Entities.encodeRaw; + }, + + /** + * Decodes the specified string, this will replace entities with raw UTF characters. + * + * @method decode + * @param {String} text Text to entity decode. + * @return {String} Entity decoded string. + */ + decode: function(text) { + return text.replace(entityRegExp, function(all, numeric) { + if (numeric) { + if (numeric.charAt(0).toLowerCase() === 'x') { + numeric = parseInt(numeric.substr(1), 16); + } else { + numeric = parseInt(numeric, 10); + } + + // Support upper UTF + if (numeric > 0xFFFF) { + numeric -= 0x10000; + + return String.fromCharCode(0xD800 + (numeric >> 10), 0xDC00 + (numeric & 0x3FF)); + } else { + return asciiMap[numeric] || String.fromCharCode(numeric); + } + } + + return reverseEntities[all] || namedEntities[all] || nativeDecode(all); + }); + } + }; + + return Entities; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Node.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Node.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,496 @@ +/** + * Node.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is a minimalistic implementation of a DOM like node used by the DomParser class. + * + * @example + * var node = new tinymce.html.Node('strong', 1); + * someRoot.append(node); + * + * @class tinymce.html.Node + * @version 3.4 + */ +define("tinymce/html/Node", [], function() { + var whiteSpaceRegExp = /^[ \t\r\n]*$/, typeLookup = { + '#text': 3, + '#comment': 8, + '#cdata': 4, + '#pi': 7, + '#doctype': 10, + '#document-fragment': 11 + }; + + // Walks the tree left/right + function walk(node, root_node, prev) { + var sibling, parent, startName = prev ? 'lastChild' : 'firstChild', siblingName = prev ? 'prev' : 'next'; + + // Walk into nodes if it has a start + if (node[startName]) { + return node[startName]; + } + + // Return the sibling if it has one + if (node !== root_node) { + sibling = node[siblingName]; + + if (sibling) { + return sibling; + } + + // Walk up the parents to look for siblings + for (parent = node.parent; parent && parent !== root_node; parent = parent.parent) { + sibling = parent[siblingName]; + + if (sibling) { + return sibling; + } + } + } + } + + /** + * Constructs a new Node instance. + * + * @constructor + * @method Node + * @param {String} name Name of the node type. + * @param {Number} type Numeric type representing the node. + */ + function Node(name, type) { + this.name = name; + this.type = type; + + if (type === 1) { + this.attributes = []; + this.attributes.map = {}; + } + } + + Node.prototype = { + /** + * Replaces the current node with the specified one. + * + * @example + * someNode.replace(someNewNode); + * + * @method replace + * @param {tinymce.html.Node} node Node to replace the current node with. + * @return {tinymce.html.Node} The old node that got replaced. + */ + replace: function(node) { + var self = this; + + if (node.parent) { + node.remove(); + } + + self.insert(node, self); + self.remove(); + + return self; + }, + + /** + * Gets/sets or removes an attribute by name. + * + * @example + * someNode.attr("name", "value"); // Sets an attribute + * console.log(someNode.attr("name")); // Gets an attribute + * someNode.attr("name", null); // Removes an attribute + * + * @method attr + * @param {String} name Attribute name to set or get. + * @param {String} value Optional value to set. + * @return {String/tinymce.html.Node} String or undefined on a get operation or the current node on a set operation. + */ + attr: function(name, value) { + var self = this, attrs, i, undef; + + if (typeof name !== "string") { + for (i in name) { + self.attr(i, name[i]); + } + + return self; + } + + if ((attrs = self.attributes)) { + if (value !== undef) { + // Remove attribute + if (value === null) { + if (name in attrs.map) { + delete attrs.map[name]; + + i = attrs.length; + while (i--) { + if (attrs[i].name === name) { + attrs = attrs.splice(i, 1); + return self; + } + } + } + + return self; + } + + // Set attribute + if (name in attrs.map) { + // Set attribute + i = attrs.length; + while (i--) { + if (attrs[i].name === name) { + attrs[i].value = value; + break; + } + } + } else { + attrs.push({name: name, value: value}); + } + + attrs.map[name] = value; + + return self; + } else { + return attrs.map[name]; + } + } + }, + + /** + * Does a shallow clones the node into a new node. It will also exclude id attributes since + * there should only be one id per document. + * + * @example + * var clonedNode = node.clone(); + * + * @method clone + * @return {tinymce.html.Node} New copy of the original node. + */ + clone: function() { + var self = this, clone = new Node(self.name, self.type), i, l, selfAttrs, selfAttr, cloneAttrs; + + // Clone element attributes + if ((selfAttrs = self.attributes)) { + cloneAttrs = []; + cloneAttrs.map = {}; + + for (i = 0, l = selfAttrs.length; i < l; i++) { + selfAttr = selfAttrs[i]; + + // Clone everything except id + if (selfAttr.name !== 'id') { + cloneAttrs[cloneAttrs.length] = {name: selfAttr.name, value: selfAttr.value}; + cloneAttrs.map[selfAttr.name] = selfAttr.value; + } + } + + clone.attributes = cloneAttrs; + } + + clone.value = self.value; + clone.shortEnded = self.shortEnded; + + return clone; + }, + + /** + * Wraps the node in in another node. + * + * @example + * node.wrap(wrapperNode); + * + * @method wrap + */ + wrap: function(wrapper) { + var self = this; + + self.parent.insert(wrapper, self); + wrapper.append(self); + + return self; + }, + + /** + * Unwraps the node in other words it removes the node but keeps the children. + * + * @example + * node.unwrap(); + * + * @method unwrap + */ + unwrap: function() { + var self = this, node, next; + + for (node = self.firstChild; node;) { + next = node.next; + self.insert(node, self, true); + node = next; + } + + self.remove(); + }, + + /** + * Removes the node from it's parent. + * + * @example + * node.remove(); + * + * @method remove + * @return {tinymce.html.Node} Current node that got removed. + */ + remove: function() { + var self = this, parent = self.parent, next = self.next, prev = self.prev; + + if (parent) { + if (parent.firstChild === self) { + parent.firstChild = next; + + if (next) { + next.prev = null; + } + } else { + prev.next = next; + } + + if (parent.lastChild === self) { + parent.lastChild = prev; + + if (prev) { + prev.next = null; + } + } else { + next.prev = prev; + } + + self.parent = self.next = self.prev = null; + } + + return self; + }, + + /** + * Appends a new node as a child of the current node. + * + * @example + * node.append(someNode); + * + * @method append + * @param {tinymce.html.Node} node Node to append as a child of the current one. + * @return {tinymce.html.Node} The node that got appended. + */ + append: function(node) { + var self = this, last; + + if (node.parent) { + node.remove(); + } + + last = self.lastChild; + if (last) { + last.next = node; + node.prev = last; + self.lastChild = node; + } else { + self.lastChild = self.firstChild = node; + } + + node.parent = self; + + return node; + }, + + /** + * Inserts a node at a specific position as a child of the current node. + * + * @example + * parentNode.insert(newChildNode, oldChildNode); + * + * @method insert + * @param {tinymce.html.Node} node Node to insert as a child of the current node. + * @param {tinymce.html.Node} ref_node Reference node to set node before/after. + * @param {Boolean} before Optional state to insert the node before the reference node. + * @return {tinymce.html.Node} The node that got inserted. + */ + insert: function(node, ref_node, before) { + var parent; + + if (node.parent) { + node.remove(); + } + + parent = ref_node.parent || this; + + if (before) { + if (ref_node === parent.firstChild) { + parent.firstChild = node; + } else { + ref_node.prev.next = node; + } + + node.prev = ref_node.prev; + node.next = ref_node; + ref_node.prev = node; + } else { + if (ref_node === parent.lastChild) { + parent.lastChild = node; + } else { + ref_node.next.prev = node; + } + + node.next = ref_node.next; + node.prev = ref_node; + ref_node.next = node; + } + + node.parent = parent; + + return node; + }, + + /** + * Get all children by name. + * + * @method getAll + * @param {String} name Name of the child nodes to collect. + * @return {Array} Array with child nodes matchin the specified name. + */ + getAll: function(name) { + var self = this, node, collection = []; + + for (node = self.firstChild; node; node = walk(node, self)) { + if (node.name === name) { + collection.push(node); + } + } + + return collection; + }, + + /** + * Removes all children of the current node. + * + * @method empty + * @return {tinymce.html.Node} The current node that got cleared. + */ + empty: function() { + var self = this, nodes, i, node; + + // Remove all children + if (self.firstChild) { + nodes = []; + + // Collect the children + for (node = self.firstChild; node; node = walk(node, self)) { + nodes.push(node); + } + + // Remove the children + i = nodes.length; + while (i--) { + node = nodes[i]; + node.parent = node.firstChild = node.lastChild = node.next = node.prev = null; + } + } + + self.firstChild = self.lastChild = null; + + return self; + }, + + /** + * Returns true/false if the node is to be considered empty or not. + * + * @example + * node.isEmpty({img: true}); + * @method isEmpty + * @param {Object} elements Name/value object with elements that are automatically treated as non empty elements. + * @return {Boolean} true/false if the node is empty or not. + */ + isEmpty: function(elements) { + var self = this, node = self.firstChild, i, name; + + if (node) { + do { + if (node.type === 1) { + // Ignore bogus elements + if (node.attributes.map['data-mce-bogus']) { + continue; + } + + // Keep empty elements like + if (elements[node.name]) { + return false; + } + + // Keep bookmark nodes and name attribute like
+ i = node.attributes.length; + while (i--) { + name = node.attributes[i].name; + if (name === "name" || name.indexOf('data-mce-bookmark') === 0) { + return false; + } + } + } + + // Keep comments + if (node.type === 8) { + return false; + } + + // Keep non whitespace text nodes + if ((node.type === 3 && !whiteSpaceRegExp.test(node.value))) { + return false; + } + } while ((node = walk(node, self))); + } + + return true; + }, + + /** + * Walks to the next or previous node and returns that node or null if it wasn't found. + * + * @method walk + * @param {Boolean} prev Optional previous node state defaults to false. + * @return {tinymce.html.Node} Node that is next to or previous of the current node. + */ + walk: function(prev) { + return walk(this, null, prev); + } + }; + + /** + * Creates a node of a specific type. + * + * @static + * @method create + * @param {String} name Name of the node type to create for example "b" or "#text". + * @param {Object} attrs Name/value collection of attributes that will be applied to elements. + */ + Node.create = function(name, attrs) { + var node, attrName; + + // Create node + node = new Node(name, typeLookup[name] || 1); + + // Add attributes if needed + if (attrs) { + for (attrName in attrs) { + node.attr(attrName, attrs[attrName]); + } + } + + return node; + }; + + return Node; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/SaxParser.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/SaxParser.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,474 @@ +/** + * SaxParser.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*eslint max-depth:[2, 9] */ + +/** + * This class parses HTML code using pure JavaScript and executes various events for each item it finds. It will + * always execute the events in the right order for tag soup code like

. It will also remove elements + * and attributes that doesn't fit the schema if the validate setting is enabled. + * + * @example + * var parser = new tinymce.html.SaxParser({ + * validate: true, + * + * comment: function(text) { + * console.log('Comment:', text); + * }, + * + * cdata: function(text) { + * console.log('CDATA:', text); + * }, + * + * text: function(text, raw) { + * console.log('Text:', text, 'Raw:', raw); + * }, + * + * start: function(name, attrs, empty) { + * console.log('Start:', name, attrs, empty); + * }, + * + * end: function(name) { + * console.log('End:', name); + * }, + * + * pi: function(name, text) { + * console.log('PI:', name, text); + * }, + * + * doctype: function(text) { + * console.log('DocType:', text); + * } + * }, schema); + * @class tinymce.html.SaxParser + * @version 3.4 + */ +define("tinymce/html/SaxParser", [ + "tinymce/html/Schema", + "tinymce/html/Entities", + "tinymce/util/Tools" +], function(Schema, Entities, Tools) { + var each = Tools.each; + + /** + * Returns the index of the end tag for a specific start tag. This can be + * used to skip all children of a parent element from being processed. + * + * @private + * @method findEndTag + * @param {tinymce.html.Schema} schema Schema instance to use to match short ended elements. + * @param {String} html HTML string to find the end tag in. + * @param {Number} startIndex Indext to start searching at should be after the start tag. + * @return {Number} Index of the end tag. + */ + function findEndTag(schema, html, startIndex) { + var count = 1, index, matches, tokenRegExp, shortEndedElements; + + shortEndedElements = schema.getShortEndedElements(); + tokenRegExp = /<([!?\/])?([A-Za-z0-9\-_\:\.]+)((?:\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\/|\s+)>/g; + tokenRegExp.lastIndex = index = startIndex; + + while ((matches = tokenRegExp.exec(html))) { + index = tokenRegExp.lastIndex; + + if (matches[1] === '/') { // End element + count--; + } else if (!matches[1]) { // Start element + if (matches[2] in shortEndedElements) { + continue; + } + + count++; + } + + if (count === 0) { + break; + } + } + + return index; + } + + /** + * Constructs a new SaxParser instance. + * + * @constructor + * @method SaxParser + * @param {Object} settings Name/value collection of settings. comment, cdata, text, start and end are callbacks. + * @param {tinymce.html.Schema} schema HTML Schema class to use when parsing. + */ + function SaxParser(settings, schema) { + var self = this; + + function noop() {} + + settings = settings || {}; + self.schema = schema = schema || new Schema(); + + if (settings.fix_self_closing !== false) { + settings.fix_self_closing = true; + } + + // Add handler functions from settings and setup default handlers + each('comment cdata text start end pi doctype'.split(' '), function(name) { + if (name) { + self[name] = settings[name] || noop; + } + }); + + /** + * Parses the specified HTML string and executes the callbacks for each item it finds. + * + * @example + * new SaxParser({...}).parse('text'); + * @method parse + * @param {String} html Html string to sax parse. + */ + self.parse = function(html) { + var self = this, matches, index = 0, value, endRegExp, stack = [], attrList, i, text, name; + var isInternalElement, removeInternalElements, shortEndedElements, fillAttrsMap, isShortEnded; + var validate, elementRule, isValidElement, attr, attribsValue, validAttributesMap, validAttributePatterns; + var attributesRequired, attributesDefault, attributesForced; + var anyAttributesRequired, selfClosing, tokenRegExp, attrRegExp, specialElements, attrValue, idCount = 0; + var decode = Entities.decode, fixSelfClosing, filteredUrlAttrs = Tools.makeMap('src,href,data,background,formaction,poster'); + var scriptUriRegExp = /((java|vb)script|mhtml):/i, dataUriRegExp = /^data:/i; + + function processEndTag(name) { + var pos, i; + + // Find position of parent of the same type + pos = stack.length; + while (pos--) { + if (stack[pos].name === name) { + break; + } + } + + // Found parent + if (pos >= 0) { + // Close all the open elements + for (i = stack.length - 1; i >= pos; i--) { + name = stack[i]; + + if (name.valid) { + self.end(name.name); + } + } + + // Remove the open elements from the stack + stack.length = pos; + } + } + + function parseAttribute(match, name, value, val2, val3) { + var attrRule, i, trimRegExp = /[\s\u0000-\u001F]+/g; + + name = name.toLowerCase(); + value = name in fillAttrsMap ? name : decode(value || val2 || val3 || ''); // Handle boolean attribute than value attribute + + // Validate name and value pass through all data- attributes + if (validate && !isInternalElement && name.indexOf('data-') !== 0) { + attrRule = validAttributesMap[name]; + + // Find rule by pattern matching + if (!attrRule && validAttributePatterns) { + i = validAttributePatterns.length; + while (i--) { + attrRule = validAttributePatterns[i]; + if (attrRule.pattern.test(name)) { + break; + } + } + + // No rule matched + if (i === -1) { + attrRule = null; + } + } + + // No attribute rule found + if (!attrRule) { + return; + } + + // Validate value + if (attrRule.validValues && !(value in attrRule.validValues)) { + return; + } + } + + // Block any javascript: urls or non image data uris + if (filteredUrlAttrs[name] && !settings.allow_script_urls) { + var uri = value.replace(trimRegExp, ''); + + try { + // Might throw malformed URI sequence + uri = decodeURIComponent(uri); + } catch (ex) { + // Fallback to non UTF-8 decoder + uri = unescape(uri); + } + + if (scriptUriRegExp.test(uri)) { + return; + } + + if (!settings.allow_html_data_urls && dataUriRegExp.test(uri) && !/^data:image\//i.test(uri)) { + return; + } + } + + // Add attribute to list and map + attrList.map[name] = value; + attrList.push({ + name: name, + value: value + }); + } + + // Precompile RegExps and map objects + tokenRegExp = new RegExp('<(?:' + + '(?:!--([\\w\\W]*?)-->)|' + // Comment + '(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|' + // CDATA + '(?:!DOCTYPE([\\w\\W]*?)>)|' + // DOCTYPE + '(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + // PI + '(?:\\/([^>]+)>)|' + // End element + '(?:([A-Za-z0-9\\-_\\:\\.]+)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/|\\s+)>)' + // Start element + ')', 'g'); + + attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g; + + // Setup lookup tables for empty elements and boolean attributes + shortEndedElements = schema.getShortEndedElements(); + selfClosing = settings.self_closing_elements || schema.getSelfClosingElements(); + fillAttrsMap = schema.getBoolAttrs(); + validate = settings.validate; + removeInternalElements = settings.remove_internals; + fixSelfClosing = settings.fix_self_closing; + specialElements = schema.getSpecialElements(); + + while ((matches = tokenRegExp.exec(html))) { + // Text + if (index < matches.index) { + self.text(decode(html.substr(index, matches.index - index))); + } + + if ((value = matches[6])) { // End element + value = value.toLowerCase(); + + // IE will add a ":" in front of elements it doesn't understand like custom elements or HTML5 elements + if (value.charAt(0) === ':') { + value = value.substr(1); + } + + processEndTag(value); + } else if ((value = matches[7])) { // Start element + value = value.toLowerCase(); + + // IE will add a ":" in front of elements it doesn't understand like custom elements or HTML5 elements + if (value.charAt(0) === ':') { + value = value.substr(1); + } + + isShortEnded = value in shortEndedElements; + + // Is self closing tag for example an
  • after an open
  • + if (fixSelfClosing && selfClosing[value] && stack.length > 0 && stack[stack.length - 1].name === value) { + processEndTag(value); + } + + // Validate element + if (!validate || (elementRule = schema.getElementRule(value))) { + isValidElement = true; + + // Grab attributes map and patters when validation is enabled + if (validate) { + validAttributesMap = elementRule.attributes; + validAttributePatterns = elementRule.attributePatterns; + } + + // Parse attributes + if ((attribsValue = matches[8])) { + isInternalElement = attribsValue.indexOf('data-mce-type') !== -1; // Check if the element is an internal element + + // If the element has internal attributes then remove it if we are told to do so + if (isInternalElement && removeInternalElements) { + isValidElement = false; + } + + attrList = []; + attrList.map = {}; + + attribsValue.replace(attrRegExp, parseAttribute); + } else { + attrList = []; + attrList.map = {}; + } + + // Process attributes if validation is enabled + if (validate && !isInternalElement) { + attributesRequired = elementRule.attributesRequired; + attributesDefault = elementRule.attributesDefault; + attributesForced = elementRule.attributesForced; + anyAttributesRequired = elementRule.removeEmptyAttrs; + + // Check if any attribute exists + if (anyAttributesRequired && !attrList.length) { + isValidElement = false; + } + + // Handle forced attributes + if (attributesForced) { + i = attributesForced.length; + while (i--) { + attr = attributesForced[i]; + name = attr.name; + attrValue = attr.value; + + if (attrValue === '{$uid}') { + attrValue = 'mce_' + idCount++; + } + + attrList.map[name] = attrValue; + attrList.push({name: name, value: attrValue}); + } + } + + // Handle default attributes + if (attributesDefault) { + i = attributesDefault.length; + while (i--) { + attr = attributesDefault[i]; + name = attr.name; + + if (!(name in attrList.map)) { + attrValue = attr.value; + + if (attrValue === '{$uid}') { + attrValue = 'mce_' + idCount++; + } + + attrList.map[name] = attrValue; + attrList.push({name: name, value: attrValue}); + } + } + } + + // Handle required attributes + if (attributesRequired) { + i = attributesRequired.length; + while (i--) { + if (attributesRequired[i] in attrList.map) { + break; + } + } + + // None of the required attributes where found + if (i === -1) { + isValidElement = false; + } + } + + // Invalidate element if it's marked as bogus + if ((attr = attrList.map['data-mce-bogus'])) { + if (attr === 'all') { + index = findEndTag(schema, html, tokenRegExp.lastIndex); + tokenRegExp.lastIndex = index; + continue; + } + + isValidElement = false; + } + } + + if (isValidElement) { + self.start(value, attrList, isShortEnded); + } + } else { + isValidElement = false; + } + + // Treat script, noscript and style a bit different since they may include code that looks like elements + if ((endRegExp = specialElements[value])) { + endRegExp.lastIndex = index = matches.index + matches[0].length; + + if ((matches = endRegExp.exec(html))) { + if (isValidElement) { + text = html.substr(index, matches.index - index); + } + + index = matches.index + matches[0].length; + } else { + text = html.substr(index); + index = html.length; + } + + if (isValidElement) { + if (text.length > 0) { + self.text(text, true); + } + + self.end(value); + } + + tokenRegExp.lastIndex = index; + continue; + } + + // Push value on to stack + if (!isShortEnded) { + if (!attribsValue || attribsValue.indexOf('/') != attribsValue.length - 1) { + stack.push({name: value, valid: isValidElement}); + } else if (isValidElement) { + self.end(value); + } + } + } else if ((value = matches[1])) { // Comment + // Padd comment value to avoid browsers from parsing invalid comments as HTML + if (value.charAt(0) === '>') { + value = ' ' + value; + } + + if (!settings.allow_conditional_comments && value.substr(0, 3) === '[if') { + value = ' ' + value; + } + + self.comment(value); + } else if ((value = matches[2])) { // CDATA + self.cdata(value); + } else if ((value = matches[3])) { // DOCTYPE + self.doctype(value); + } else if ((value = matches[4])) { // PI + self.pi(value, matches[5]); + } + + index = matches.index + matches[0].length; + } + + // Text + if (index < html.length) { + self.text(decode(html.substr(index))); + } + + // Close any open elements + for (i = stack.length - 1; i >= 0; i--) { + value = stack[i]; + + if (value.valid) { + self.end(value.name); + } + } + }; + } + + SaxParser.findEndTag = findEndTag; + + return SaxParser; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Schema.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Schema.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1002 @@ +/** + * Schema.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Schema validator class. + * + * @class tinymce.html.Schema + * @example + * if (tinymce.activeEditor.schema.isValidChild('p', 'span')) + * alert('span is valid child of p.'); + * + * if (tinymce.activeEditor.schema.getElementRule('p')) + * alert('P is a valid element.'); + * + * @class tinymce.html.Schema + * @version 3.4 + */ +define("tinymce/html/Schema", [ + "tinymce/util/Tools" +], function(Tools) { + var mapCache = {}, dummyObj = {}; + var makeMap = Tools.makeMap, each = Tools.each, extend = Tools.extend, explode = Tools.explode, inArray = Tools.inArray; + + function split(items, delim) { + return items ? items.split(delim || ' ') : []; + } + + /** + * Builds a schema lookup table + * + * @private + * @param {String} type html4, html5 or html5-strict schema type. + * @return {Object} Schema lookup table. + */ + function compileSchema(type) { + var schema = {}, globalAttributes, blockContent; + var phrasingContent, flowContent, html4BlockContent, html4PhrasingContent; + + function add(name, attributes, children) { + var ni, i, attributesOrder, args = arguments; + + function arrayToMap(array, obj) { + var map = {}, i, l; + + for (i = 0, l = array.length; i < l; i++) { + map[array[i]] = obj || {}; + } + + return map; + } + + children = children || []; + attributes = attributes || ""; + + if (typeof children === "string") { + children = split(children); + } + + // Split string children + for (i = 3; i < args.length; i++) { + if (typeof args[i] === "string") { + args[i] = split(args[i]); + } + + children.push.apply(children, args[i]); + } + + name = split(name); + ni = name.length; + while (ni--) { + attributesOrder = [].concat(globalAttributes, split(attributes)); + schema[name[ni]] = { + attributes: arrayToMap(attributesOrder), + attributesOrder: attributesOrder, + children: arrayToMap(children, dummyObj) + }; + } + } + + function addAttrs(name, attributes) { + var ni, schemaItem, i, l; + + name = split(name); + ni = name.length; + attributes = split(attributes); + while (ni--) { + schemaItem = schema[name[ni]]; + for (i = 0, l = attributes.length; i < l; i++) { + schemaItem.attributes[attributes[i]] = {}; + schemaItem.attributesOrder.push(attributes[i]); + } + } + } + + // Use cached schema + if (mapCache[type]) { + return mapCache[type]; + } + + // Attributes present on all elements + globalAttributes = split("id accesskey class dir lang style tabindex title"); + + // Event attributes can be opt-in/opt-out + /*eventAttributes = split("onabort onblur oncancel oncanplay oncanplaythrough onchange onclick onclose oncontextmenu oncuechange " + + "ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended " + + "onerror onfocus oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart " + + "onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel onpause onplay onplaying onprogress onratechange " + + "onreset onscroll onseeked onseeking onseeking onselect onshow onstalled onsubmit onsuspend ontimeupdate onvolumechange " + + "onwaiting" + );*/ + + // Block content elements + blockContent = split( + "address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul" + ); + + // Phrasing content elements from the HTML5 spec (inline) + phrasingContent = split( + "a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd " + + "label map noscript object q s samp script select small span strong sub sup " + + "textarea u var #text #comment" + ); + + // Add HTML5 items to globalAttributes, blockContent, phrasingContent + if (type != "html4") { + globalAttributes.push.apply(globalAttributes, split("contenteditable contextmenu draggable dropzone " + + "hidden spellcheck translate")); + blockContent.push.apply(blockContent, split("article aside details dialog figure header footer hgroup section nav")); + phrasingContent.push.apply(phrasingContent, split("audio canvas command datalist mark meter output progress time wbr " + + "video ruby bdi keygen")); + } + + // Add HTML4 elements unless it's html5-strict + if (type != "html5-strict") { + globalAttributes.push("xml:lang"); + + html4PhrasingContent = split("acronym applet basefont big font strike tt"); + phrasingContent.push.apply(phrasingContent, html4PhrasingContent); + + each(html4PhrasingContent, function(name) { + add(name, "", phrasingContent); + }); + + html4BlockContent = split("center dir isindex noframes"); + blockContent.push.apply(blockContent, html4BlockContent); + + // Flow content elements from the HTML5 spec (block+inline) + flowContent = [].concat(blockContent, phrasingContent); + + each(html4BlockContent, function(name) { + add(name, "", flowContent); + }); + } + + // Flow content elements from the HTML5 spec (block+inline) + flowContent = flowContent || [].concat(blockContent, phrasingContent); + + // HTML4 base schema TODO: Move HTML5 specific attributes to HTML5 specific if statement + // Schema items , , + add("html", "manifest", "head body"); + add("head", "", "base command link meta noscript script style title"); + add("title hr noscript br"); + add("base", "href target"); + add("link", "href rel media hreflang type sizes hreflang"); + add("meta", "name http-equiv content charset"); + add("style", "media type scoped"); + add("script", "src async defer type charset"); + add("body", "onafterprint onbeforeprint onbeforeunload onblur onerror onfocus " + + "onhashchange onload onmessage onoffline ononline onpagehide onpageshow " + + "onpopstate onresize onscroll onstorage onunload", flowContent); + add("address dt dd div caption", "", flowContent); + add("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn", "", phrasingContent); + add("blockquote", "cite", flowContent); + add("ol", "reversed start type", "li"); + add("ul", "", "li"); + add("li", "value", flowContent); + add("dl", "", "dt dd"); + add("a", "href target rel media hreflang type", phrasingContent); + add("q", "cite", phrasingContent); + add("ins del", "cite datetime", flowContent); + add("img", "src sizes srcset alt usemap ismap width height"); + add("iframe", "src name width height", flowContent); + add("embed", "src type width height"); + add("object", "data type typemustmatch name usemap form width height", flowContent, "param"); + add("param", "name value"); + add("map", "name", flowContent, "area"); + add("area", "alt coords shape href target rel media hreflang type"); + add("table", "border", "caption colgroup thead tfoot tbody tr" + (type == "html4" ? " col" : "")); + add("colgroup", "span", "col"); + add("col", "span"); + add("tbody thead tfoot", "", "tr"); + add("tr", "", "td th"); + add("td", "colspan rowspan headers", flowContent); + add("th", "colspan rowspan headers scope abbr", flowContent); + add("form", "accept-charset action autocomplete enctype method name novalidate target", flowContent); + add("fieldset", "disabled form name", flowContent, "legend"); + add("label", "form for", phrasingContent); + add("input", "accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate " + + "formtarget height list max maxlength min multiple name pattern readonly required size src step type value width" + ); + add("button", "disabled form formaction formenctype formmethod formnovalidate formtarget name type value", + type == "html4" ? flowContent : phrasingContent); + add("select", "disabled form multiple name required size", "option optgroup"); + add("optgroup", "disabled label", "option"); + add("option", "disabled label selected value"); + add("textarea", "cols dirname disabled form maxlength name readonly required rows wrap"); + add("menu", "type label", flowContent, "li"); + add("noscript", "", flowContent); + + // Extend with HTML5 elements + if (type != "html4") { + add("wbr"); + add("ruby", "", phrasingContent, "rt rp"); + add("figcaption", "", flowContent); + add("mark rt rp summary bdi", "", phrasingContent); + add("canvas", "width height", flowContent); + add("video", "src crossorigin poster preload autoplay mediagroup loop " + + "muted controls width height buffered", flowContent, "track source"); + add("audio", "src crossorigin preload autoplay mediagroup loop muted controls buffered volume", flowContent, "track source"); + add("picture", "", "img source"); + add("source", "src srcset type media sizes"); + add("track", "kind src srclang label default"); + add("datalist", "", phrasingContent, "option"); + add("article section nav aside header footer", "", flowContent); + add("hgroup", "", "h1 h2 h3 h4 h5 h6"); + add("figure", "", flowContent, "figcaption"); + add("time", "datetime", phrasingContent); + add("dialog", "open", flowContent); + add("command", "type label icon disabled checked radiogroup command"); + add("output", "for form name", phrasingContent); + add("progress", "value max", phrasingContent); + add("meter", "value min max low high optimum", phrasingContent); + add("details", "open", flowContent, "summary"); + add("keygen", "autofocus challenge disabled form keytype name"); + } + + // Extend with HTML4 attributes unless it's html5-strict + if (type != "html5-strict") { + addAttrs("script", "language xml:space"); + addAttrs("style", "xml:space"); + addAttrs("object", "declare classid code codebase codetype archive standby align border hspace vspace"); + addAttrs("embed", "align name hspace vspace"); + addAttrs("param", "valuetype type"); + addAttrs("a", "charset name rev shape coords"); + addAttrs("br", "clear"); + addAttrs("applet", "codebase archive code object alt name width height align hspace vspace"); + addAttrs("img", "name longdesc align border hspace vspace"); + addAttrs("iframe", "longdesc frameborder marginwidth marginheight scrolling align"); + addAttrs("font basefont", "size color face"); + addAttrs("input", "usemap align"); + addAttrs("select", "onchange"); + addAttrs("textarea"); + addAttrs("h1 h2 h3 h4 h5 h6 div p legend caption", "align"); + addAttrs("ul", "type compact"); + addAttrs("li", "type"); + addAttrs("ol dl menu dir", "compact"); + addAttrs("pre", "width xml:space"); + addAttrs("hr", "align noshade size width"); + addAttrs("isindex", "prompt"); + addAttrs("table", "summary width frame rules cellspacing cellpadding align bgcolor"); + addAttrs("col", "width align char charoff valign"); + addAttrs("colgroup", "width align char charoff valign"); + addAttrs("thead", "align char charoff valign"); + addAttrs("tr", "align char charoff valign bgcolor"); + addAttrs("th", "axis align char charoff valign nowrap bgcolor width height"); + addAttrs("form", "accept"); + addAttrs("td", "abbr axis scope align char charoff valign nowrap bgcolor width height"); + addAttrs("tfoot", "align char charoff valign"); + addAttrs("tbody", "align char charoff valign"); + addAttrs("area", "nohref"); + addAttrs("body", "background bgcolor text link vlink alink"); + } + + // Extend with HTML5 attributes unless it's html4 + if (type != "html4") { + addAttrs("input button select textarea", "autofocus"); + addAttrs("input textarea", "placeholder"); + addAttrs("a", "download"); + addAttrs("link script img", "crossorigin"); + addAttrs("iframe", "sandbox seamless allowfullscreen"); // Excluded: srcdoc + } + + // Special: iframe, ruby, video, audio, label + + // Delete children of the same name from it's parent + // For example: form can't have a child of the name form + each(split('a form meter progress dfn'), function(name) { + if (schema[name]) { + delete schema[name].children[name]; + } + }); + + // Delete header, footer, sectioning and heading content descendants + /*each('dt th address', function(name) { + delete schema[name].children[name]; + });*/ + + // Caption can't have tables + delete schema.caption.children.table; + + // TODO: LI:s can only have value if parent is OL + + // TODO: Handle transparent elements + // a ins del canvas map + + mapCache[type] = schema; + + return schema; + } + + function compileElementMap(value, mode) { + var styles; + + if (value) { + styles = {}; + + if (typeof value == 'string') { + value = { + '*': value + }; + } + + // Convert styles into a rule list + each(value, function(value, key) { + styles[key] = styles[key.toUpperCase()] = mode == 'map' ? makeMap(value, /[, ]/) : explode(value, /[, ]/); + }); + } + + return styles; + } + + /** + * Constructs a new Schema instance. + * + * @constructor + * @method Schema + * @param {Object} settings Name/value settings object. + */ + return function(settings) { + var self = this, elements = {}, children = {}, patternElements = [], validStyles, invalidStyles, schemaItems; + var whiteSpaceElementsMap, selfClosingElementsMap, shortEndedElementsMap, boolAttrMap, validClasses; + var blockElementsMap, nonEmptyElementsMap, moveCaretBeforeOnEnterElementsMap, textBlockElementsMap, textInlineElementsMap; + var customElementsMap = {}, specialElements = {}; + + // Creates an lookup table map object for the specified option or the default value + function createLookupTable(option, default_value, extendWith) { + var value = settings[option]; + + if (!value) { + // Get cached default map or make it if needed + value = mapCache[option]; + + if (!value) { + value = makeMap(default_value, ' ', makeMap(default_value.toUpperCase(), ' ')); + value = extend(value, extendWith); + + mapCache[option] = value; + } + } else { + // Create custom map + value = makeMap(value, /[, ]/, makeMap(value.toUpperCase(), /[, ]/)); + } + + return value; + } + + settings = settings || {}; + schemaItems = compileSchema(settings.schema); + + // Allow all elements and attributes if verify_html is set to false + if (settings.verify_html === false) { + settings.valid_elements = '*[*]'; + } + + validStyles = compileElementMap(settings.valid_styles); + invalidStyles = compileElementMap(settings.invalid_styles, 'map'); + validClasses = compileElementMap(settings.valid_classes, 'map'); + + // Setup map objects + whiteSpaceElementsMap = createLookupTable('whitespace_elements', 'pre script noscript style textarea video audio iframe object'); + selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr'); + shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link ' + + 'meta param embed source wbr track'); + boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize ' + + 'noshade nowrap readonly selected autoplay loop controls'); + nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object script', shortEndedElementsMap); + moveCaretBeforeOnEnterElementsMap = createLookupTable('move_caret_before_on_enter_elements', 'table', nonEmptyElementsMap); + textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' + + 'blockquote center dir fieldset header footer article section hgroup aside nav figure'); + blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' + + 'th tr td li ol ul caption dl dt dd noscript menu isindex option ' + + 'datalist select optgroup', textBlockElementsMap); + textInlineElementsMap = createLookupTable('text_inline_elements', 'span strong b em i font strike u var cite ' + + 'dfn code mark q sup sub samp'); + + each((settings.special || 'script noscript style textarea').split(' '), function(name) { + specialElements[name] = new RegExp('<\/' + name + '[^>]*>', 'gi'); + }); + + // Converts a wildcard expression string to a regexp for example *a will become /.*a/. + function patternToRegExp(str) { + return new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$'); + } + + // Parses the specified valid_elements string and adds to the current rules + // This function is a bit hard to read since it's heavily optimized for speed + function addValidElements(validElements) { + var ei, el, ai, al, matches, element, attr, attrData, elementName, attrName, attrType, attributes, attributesOrder, + prefix, outputName, globalAttributes, globalAttributesOrder, key, value, + elementRuleRegExp = /^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)\])?$/, + attrRuleRegExp = /^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/, + hasPatternsRegExp = /[*?+]/; + + if (validElements) { + // Split valid elements into an array with rules + validElements = split(validElements, ','); + + if (elements['@']) { + globalAttributes = elements['@'].attributes; + globalAttributesOrder = elements['@'].attributesOrder; + } + + // Loop all rules + for (ei = 0, el = validElements.length; ei < el; ei++) { + // Parse element rule + matches = elementRuleRegExp.exec(validElements[ei]); + if (matches) { + // Setup local names for matches + prefix = matches[1]; + elementName = matches[2]; + outputName = matches[3]; + attrData = matches[5]; + + // Create new attributes and attributesOrder + attributes = {}; + attributesOrder = []; + + // Create the new element + element = { + attributes: attributes, + attributesOrder: attributesOrder + }; + + // Padd empty elements prefix + if (prefix === '#') { + element.paddEmpty = true; + } + + // Remove empty elements prefix + if (prefix === '-') { + element.removeEmpty = true; + } + + if (matches[4] === '!') { + element.removeEmptyAttrs = true; + } + + // Copy attributes from global rule into current rule + if (globalAttributes) { + for (key in globalAttributes) { + attributes[key] = globalAttributes[key]; + } + + attributesOrder.push.apply(attributesOrder, globalAttributesOrder); + } + + // Attributes defined + if (attrData) { + attrData = split(attrData, '|'); + for (ai = 0, al = attrData.length; ai < al; ai++) { + matches = attrRuleRegExp.exec(attrData[ai]); + if (matches) { + attr = {}; + attrType = matches[1]; + attrName = matches[2].replace(/::/g, ':'); + prefix = matches[3]; + value = matches[4]; + + // Required + if (attrType === '!') { + element.attributesRequired = element.attributesRequired || []; + element.attributesRequired.push(attrName); + attr.required = true; + } + + // Denied from global + if (attrType === '-') { + delete attributes[attrName]; + attributesOrder.splice(inArray(attributesOrder, attrName), 1); + continue; + } + + // Default value + if (prefix) { + // Default value + if (prefix === '=') { + element.attributesDefault = element.attributesDefault || []; + element.attributesDefault.push({name: attrName, value: value}); + attr.defaultValue = value; + } + + // Forced value + if (prefix === ':') { + element.attributesForced = element.attributesForced || []; + element.attributesForced.push({name: attrName, value: value}); + attr.forcedValue = value; + } + + // Required values + if (prefix === '<') { + attr.validValues = makeMap(value, '?'); + } + } + + // Check for attribute patterns + if (hasPatternsRegExp.test(attrName)) { + element.attributePatterns = element.attributePatterns || []; + attr.pattern = patternToRegExp(attrName); + element.attributePatterns.push(attr); + } else { + // Add attribute to order list if it doesn't already exist + if (!attributes[attrName]) { + attributesOrder.push(attrName); + } + + attributes[attrName] = attr; + } + } + } + } + + // Global rule, store away these for later usage + if (!globalAttributes && elementName == '@') { + globalAttributes = attributes; + globalAttributesOrder = attributesOrder; + } + + // Handle substitute elements such as b/strong + if (outputName) { + element.outputName = elementName; + elements[outputName] = element; + } + + // Add pattern or exact element + if (hasPatternsRegExp.test(elementName)) { + element.pattern = patternToRegExp(elementName); + patternElements.push(element); + } else { + elements[elementName] = element; + } + } + } + } + } + + function setValidElements(validElements) { + elements = {}; + patternElements = []; + + addValidElements(validElements); + + each(schemaItems, function(element, name) { + children[name] = element.children; + }); + } + + // Adds custom non HTML elements to the schema + function addCustomElements(customElements) { + var customElementRegExp = /^(~)?(.+)$/; + + if (customElements) { + // Flush cached items since we are altering the default maps + mapCache.text_block_elements = mapCache.block_elements = null; + + each(split(customElements, ','), function(rule) { + var matches = customElementRegExp.exec(rule), + inline = matches[1] === '~', + cloneName = inline ? 'span' : 'div', + name = matches[2]; + + children[name] = children[cloneName]; + customElementsMap[name] = cloneName; + + // If it's not marked as inline then add it to valid block elements + if (!inline) { + blockElementsMap[name.toUpperCase()] = {}; + blockElementsMap[name] = {}; + } + + // Add elements clone if needed + if (!elements[name]) { + var customRule = elements[cloneName]; + + customRule = extend({}, customRule); + delete customRule.removeEmptyAttrs; + delete customRule.removeEmpty; + + elements[name] = customRule; + } + + // Add custom elements at span/div positions + each(children, function(element, elmName) { + if (element[cloneName]) { + children[elmName] = element = extend({}, children[elmName]); + element[name] = element[cloneName]; + } + }); + }); + } + } + + // Adds valid children to the schema object + function addValidChildren(validChildren) { + var childRuleRegExp = /^([+\-]?)(\w+)\[([^\]]+)\]$/; + + if (validChildren) { + each(split(validChildren, ','), function(rule) { + var matches = childRuleRegExp.exec(rule), parent, prefix; + + if (matches) { + prefix = matches[1]; + + // Add/remove items from default + if (prefix) { + parent = children[matches[2]]; + } else { + parent = children[matches[2]] = {'#comment': {}}; + } + + parent = children[matches[2]]; + + each(split(matches[3], '|'), function(child) { + if (prefix === '-') { + // Clone the element before we delete + // things in it to not mess up default schemas + children[matches[2]] = parent = extend({}, children[matches[2]]); + + delete parent[child]; + } else { + parent[child] = {}; + } + }); + } + }); + } + } + + function getElementRule(name) { + var element = elements[name], i; + + // Exact match found + if (element) { + return element; + } + + // No exact match then try the patterns + i = patternElements.length; + while (i--) { + element = patternElements[i]; + + if (element.pattern.test(name)) { + return element; + } + } + } + + if (!settings.valid_elements) { + // No valid elements defined then clone the elements from the schema spec + each(schemaItems, function(element, name) { + elements[name] = { + attributes: element.attributes, + attributesOrder: element.attributesOrder + }; + + children[name] = element.children; + }); + + // Switch these on HTML4 + if (settings.schema != "html5") { + each(split('strong/b em/i'), function(item) { + item = split(item, '/'); + elements[item[1]].outputName = item[0]; + }); + } + + // Add default alt attribute for images + elements.img.attributesDefault = [{name: 'alt', value: ''}]; + + // Remove these if they are empty by default + each(split('ol ul sub sup blockquote span font a table tbody tr strong em b i'), function(name) { + if (elements[name]) { + elements[name].removeEmpty = true; + } + }); + + // Padd these by default + each(split('p h1 h2 h3 h4 h5 h6 th td pre div address caption'), function(name) { + elements[name].paddEmpty = true; + }); + + // Remove these if they have no attributes + each(split('span'), function(name) { + elements[name].removeEmptyAttrs = true; + }); + + // Remove these by default + // TODO: Reenable in 4.1 + /*each(split('script style'), function(name) { + delete elements[name]; + });*/ + } else { + setValidElements(settings.valid_elements); + } + + addCustomElements(settings.custom_elements); + addValidChildren(settings.valid_children); + addValidElements(settings.extended_valid_elements); + + // Todo: Remove this when we fix list handling to be valid + addValidChildren('+ol[ul|ol],+ul[ul|ol]'); + + // Delete invalid elements + if (settings.invalid_elements) { + each(explode(settings.invalid_elements), function(item) { + if (elements[item]) { + delete elements[item]; + } + }); + } + + // If the user didn't allow span only allow internal spans + if (!getElementRule('span')) { + addValidElements('span[!data-mce-type|*]'); + } + + /** + * Name/value map object with valid parents and children to those parents. + * + * @example + * children = { + * div:{p:{}, h1:{}} + * }; + * @field children + * @type Object + */ + self.children = children; + + /** + * Name/value map object with valid styles for each element. + * + * @method getValidStyles + * @type Object + */ + self.getValidStyles = function() { + return validStyles; + }; + + /** + * Name/value map object with valid styles for each element. + * + * @method getInvalidStyles + * @type Object + */ + self.getInvalidStyles = function() { + return invalidStyles; + }; + + /** + * Name/value map object with valid classes for each element. + * + * @method getValidClasses + * @type Object + */ + self.getValidClasses = function() { + return validClasses; + }; + + /** + * Returns a map with boolean attributes. + * + * @method getBoolAttrs + * @return {Object} Name/value lookup map for boolean attributes. + */ + self.getBoolAttrs = function() { + return boolAttrMap; + }; + + /** + * Returns a map with block elements. + * + * @method getBlockElements + * @return {Object} Name/value lookup map for block elements. + */ + self.getBlockElements = function() { + return blockElementsMap; + }; + + /** + * Returns a map with text block elements. Such as: p,h1-h6,div,address + * + * @method getTextBlockElements + * @return {Object} Name/value lookup map for block elements. + */ + self.getTextBlockElements = function() { + return textBlockElementsMap; + }; + + /** + * Returns a map of inline text format nodes for example strong/span or ins. + * + * @method getTextInlineElements + * @return {Object} Name/value lookup map for text format elements. + */ + self.getTextInlineElements = function() { + return textInlineElementsMap; + }; + + /** + * Returns a map with short ended elements such as BR or IMG. + * + * @method getShortEndedElements + * @return {Object} Name/value lookup map for short ended elements. + */ + self.getShortEndedElements = function() { + return shortEndedElementsMap; + }; + + /** + * Returns a map with self closing tags such as
  • . + * + * @method getSelfClosingElements + * @return {Object} Name/value lookup map for self closing tags elements. + */ + self.getSelfClosingElements = function() { + return selfClosingElementsMap; + }; + + /** + * Returns a map with elements that should be treated as contents regardless if it has text + * content in them or not such as TD, VIDEO or IMG. + * + * @method getNonEmptyElements + * @return {Object} Name/value lookup map for non empty elements. + */ + self.getNonEmptyElements = function() { + return nonEmptyElementsMap; + }; + + /** + * Returns a map with elements that the caret should be moved in front of after enter is + * pressed + * + * @method getMoveCaretBeforeOnEnterElements + * @return {Object} Name/value lookup map for elements to place the caret in front of. + */ + self.getMoveCaretBeforeOnEnterElements = function() { + return moveCaretBeforeOnEnterElementsMap; + }; + + /** + * Returns a map with elements where white space is to be preserved like PRE or SCRIPT. + * + * @method getWhiteSpaceElements + * @return {Object} Name/value lookup map for white space elements. + */ + self.getWhiteSpaceElements = function() { + return whiteSpaceElementsMap; + }; + + /** + * Returns a map with special elements. These are elements that needs to be parsed + * in a special way such as script, style, textarea etc. The map object values + * are regexps used to find the end of the element. + * + * @method getSpecialElements + * @return {Object} Name/value lookup map for special elements. + */ + self.getSpecialElements = function() { + return specialElements; + }; + + /** + * Returns true/false if the specified element and it's child is valid or not + * according to the schema. + * + * @method isValidChild + * @param {String} name Element name to check for. + * @param {String} child Element child to verify. + * @return {Boolean} True/false if the element is a valid child of the specified parent. + */ + self.isValidChild = function(name, child) { + var parent = children[name]; + + return !!(parent && parent[child]); + }; + + /** + * Returns true/false if the specified element name and optional attribute is + * valid according to the schema. + * + * @method isValid + * @param {String} name Name of element to check. + * @param {String} attr Optional attribute name to check for. + * @return {Boolean} True/false if the element and attribute is valid. + */ + self.isValid = function(name, attr) { + var attrPatterns, i, rule = getElementRule(name); + + // Check if it's a valid element + if (rule) { + if (attr) { + // Check if attribute name exists + if (rule.attributes[attr]) { + return true; + } + + // Check if attribute matches a regexp pattern + attrPatterns = rule.attributePatterns; + if (attrPatterns) { + i = attrPatterns.length; + while (i--) { + if (attrPatterns[i].pattern.test(name)) { + return true; + } + } + } + } else { + return true; + } + } + + // No match + return false; + }; + + /** + * Returns true/false if the specified element is valid or not + * according to the schema. + * + * @method getElementRule + * @param {String} name Element name to check for. + * @return {Object} Element object or undefined if the element isn't valid. + */ + self.getElementRule = getElementRule; + + /** + * Returns an map object of all custom elements. + * + * @method getCustomElements + * @return {Object} Name/value map object of all custom elements. + */ + self.getCustomElements = function() { + return customElementsMap; + }; + + /** + * Parses a valid elements string and adds it to the schema. The valid elements + * format is for example "element[attr=default|otherattr]". + * Existing rules will be replaced with the ones specified, so this extends the schema. + * + * @method addValidElements + * @param {String} valid_elements String in the valid elements format to be parsed. + */ + self.addValidElements = addValidElements; + + /** + * Parses a valid elements string and sets it to the schema. The valid elements + * format is for example "element[attr=default|otherattr]". + * Existing rules will be replaced with the ones specified, so this extends the schema. + * + * @method setValidElements + * @param {String} valid_elements String in the valid elements format to be parsed. + */ + self.setValidElements = setValidElements; + + /** + * Adds custom non HTML elements to the schema. + * + * @method addCustomElements + * @param {String} custom_elements Comma separated list of custom elements to add. + */ + self.addCustomElements = addCustomElements; + + /** + * Parses a valid children string and adds them to the schema structure. The valid children + * format is for example: "element[child1|child2]". + * + * @method addValidChildren + * @param {String} valid_children Valid children elements string to parse + */ + self.addValidChildren = addValidChildren; + + self.elements = elements; + }; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Serializer.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Serializer.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,156 @@ +/** + * Serializer.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to serialize down the DOM tree into a string using a Writer instance. + * + * + * @example + * new tinymce.html.Serializer().serialize(new tinymce.html.DomParser().parse('

    text

    ')); + * @class tinymce.html.Serializer + * @version 3.4 + */ +define("tinymce/html/Serializer", [ + "tinymce/html/Writer", + "tinymce/html/Schema" +], function(Writer, Schema) { + /** + * Constructs a new Serializer instance. + * + * @constructor + * @method Serializer + * @param {Object} settings Name/value settings object. + * @param {tinymce.html.Schema} schema Schema instance to use. + */ + return function(settings, schema) { + var self = this, writer = new Writer(settings); + + settings = settings || {}; + settings.validate = "validate" in settings ? settings.validate : true; + + self.schema = schema = schema || new Schema(); + self.writer = writer; + + /** + * Serializes the specified node into a string. + * + * @example + * new tinymce.html.Serializer().serialize(new tinymce.html.DomParser().parse('

    text

    ')); + * @method serialize + * @param {tinymce.html.Node} node Node instance to serialize. + * @return {String} String with HTML based on DOM tree. + */ + self.serialize = function(node) { + var handlers, validate; + + validate = settings.validate; + + handlers = { + // #text + 3: function(node) { + writer.text(node.value, node.raw); + }, + + // #comment + 8: function(node) { + writer.comment(node.value); + }, + + // Processing instruction + 7: function(node) { + writer.pi(node.name, node.value); + }, + + // Doctype + 10: function(node) { + writer.doctype(node.value); + }, + + // CDATA + 4: function(node) { + writer.cdata(node.value); + }, + + // Document fragment + 11: function(node) { + if ((node = node.firstChild)) { + do { + walk(node); + } while ((node = node.next)); + } + } + }; + + writer.reset(); + + function walk(node) { + var handler = handlers[node.type], name, isEmpty, attrs, attrName, attrValue, sortedAttrs, i, l, elementRule; + + if (!handler) { + name = node.name; + isEmpty = node.shortEnded; + attrs = node.attributes; + + // Sort attributes + if (validate && attrs && attrs.length > 1) { + sortedAttrs = []; + sortedAttrs.map = {}; + + elementRule = schema.getElementRule(node.name); + for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) { + attrName = elementRule.attributesOrder[i]; + + if (attrName in attrs.map) { + attrValue = attrs.map[attrName]; + sortedAttrs.map[attrName] = attrValue; + sortedAttrs.push({name: attrName, value: attrValue}); + } + } + + for (i = 0, l = attrs.length; i < l; i++) { + attrName = attrs[i].name; + + if (!(attrName in sortedAttrs.map)) { + attrValue = attrs.map[attrName]; + sortedAttrs.map[attrName] = attrValue; + sortedAttrs.push({name: attrName, value: attrValue}); + } + } + + attrs = sortedAttrs; + } + + writer.start(node.name, attrs, isEmpty); + + if (!isEmpty) { + if ((node = node.firstChild)) { + do { + walk(node); + } while ((node = node.next)); + } + + writer.end(name); + } + } else { + handler(node); + } + } + + // Serialize element and treat all non elements as fragments + if (node.type == 1 && !settings.inner) { + walk(node); + } else { + handlers[11](node); + } + + return writer.getContent(); + }; + }; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Styles.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Styles.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,363 @@ +/** + * Styles.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to parse CSS styles it also compresses styles to reduce the output size. + * + * @example + * var Styles = new tinymce.html.Styles({ + * url_converter: function(url) { + * return url; + * } + * }); + * + * styles = Styles.parse('border: 1px solid red'); + * styles.color = 'red'; + * + * console.log(new tinymce.html.StyleSerializer().serialize(styles)); + * + * @class tinymce.html.Styles + * @version 3.4 + */ +define("tinymce/html/Styles", [], function() { + return function(settings, schema) { + /*jshint maxlen:255 */ + /*eslint max-len:0 */ + var rgbRegExp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi, + urlOrStrRegExp = /(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi, + styleRegExp = /\s*([^:]+):\s*([^;]+);?/g, + trimRightRegExp = /\s+$/, + undef, i, encodingLookup = {}, encodingItems, validStyles, invalidStyles, invisibleChar = '\uFEFF'; + + settings = settings || {}; + + if (schema) { + validStyles = schema.getValidStyles(); + invalidStyles = schema.getInvalidStyles(); + } + + encodingItems = ('\\" \\\' \\; \\: ; : ' + invisibleChar).split(' '); + for (i = 0; i < encodingItems.length; i++) { + encodingLookup[encodingItems[i]] = invisibleChar + i; + encodingLookup[invisibleChar + i] = encodingItems[i]; + } + + function toHex(match, r, g, b) { + function hex(val) { + val = parseInt(val, 10).toString(16); + + return val.length > 1 ? val : '0' + val; // 0 -> 00 + } + + return '#' + hex(r) + hex(g) + hex(b); + } + + return { + /** + * Parses the specified RGB color value and returns a hex version of that color. + * + * @method toHex + * @param {String} color RGB string value like rgb(1,2,3) + * @return {String} Hex version of that RGB value like #FF00FF. + */ + toHex: function(color) { + return color.replace(rgbRegExp, toHex); + }, + + /** + * Parses the specified style value into an object collection. This parser will also + * merge and remove any redundant items that browsers might have added. It will also convert non hex + * colors to hex values. Urls inside the styles will also be converted to absolute/relative based on settings. + * + * @method parse + * @param {String} css Style value to parse for example: border:1px solid red;. + * @return {Object} Object representation of that style like {border: '1px solid red'} + */ + parse: function(css) { + var styles = {}, matches, name, value, isEncoded, urlConverter = settings.url_converter; + var urlConverterScope = settings.url_converter_scope || this; + + function compress(prefix, suffix, noJoin) { + var top, right, bottom, left; + + top = styles[prefix + '-top' + suffix]; + if (!top) { + return; + } + + right = styles[prefix + '-right' + suffix]; + if (!right) { + return; + } + + bottom = styles[prefix + '-bottom' + suffix]; + if (!bottom) { + return; + } + + left = styles[prefix + '-left' + suffix]; + if (!left) { + return; + } + + var box = [top, right, bottom, left]; + i = box.length - 1; + while (i--) { + if (box[i] !== box[i + 1]) { + break; + } + } + + if (i > -1 && noJoin) { + return; + } + + styles[prefix + suffix] = i == -1 ? box[0] : box.join(' '); + delete styles[prefix + '-top' + suffix]; + delete styles[prefix + '-right' + suffix]; + delete styles[prefix + '-bottom' + suffix]; + delete styles[prefix + '-left' + suffix]; + } + + /** + * Checks if the specific style can be compressed in other words if all border-width are equal. + */ + function canCompress(key) { + var value = styles[key], i; + + if (!value) { + return; + } + + value = value.split(' '); + i = value.length; + while (i--) { + if (value[i] !== value[0]) { + return false; + } + } + + styles[key] = value[0]; + + return true; + } + + /** + * Compresses multiple styles into one style. + */ + function compress2(target, a, b, c) { + if (!canCompress(a)) { + return; + } + + if (!canCompress(b)) { + return; + } + + if (!canCompress(c)) { + return; + } + + // Compress + styles[target] = styles[a] + ' ' + styles[b] + ' ' + styles[c]; + delete styles[a]; + delete styles[b]; + delete styles[c]; + } + + // Encodes the specified string by replacing all \" \' ; : with _ + function encode(str) { + isEncoded = true; + + return encodingLookup[str]; + } + + // Decodes the specified string by replacing all _ with it's original value \" \' etc + // It will also decode the \" \' if keep_slashes is set to fale or omitted + function decode(str, keep_slashes) { + if (isEncoded) { + str = str.replace(/\uFEFF[0-9]/g, function(str) { + return encodingLookup[str]; + }); + } + + if (!keep_slashes) { + str = str.replace(/\\([\'\";:])/g, "$1"); + } + + return str; + } + + function processUrl(match, url, url2, url3, str, str2) { + str = str || str2; + + if (str) { + str = decode(str); + + // Force strings into single quote format + return "'" + str.replace(/\'/g, "\\'") + "'"; + } + + url = decode(url || url2 || url3); + + if (!settings.allow_script_urls) { + var scriptUrl = url.replace(/[\s\r\n]+/, ''); + + if (/(java|vb)script:/i.test(scriptUrl)) { + return ""; + } + + if (!settings.allow_svg_data_urls && /^data:image\/svg/i.test(scriptUrl)) { + return ""; + } + } + + // Convert the URL to relative/absolute depending on config + if (urlConverter) { + url = urlConverter.call(urlConverterScope, url, 'style'); + } + + // Output new URL format + return "url('" + url.replace(/\'/g, "\\'") + "')"; + } + + if (css) { + css = css.replace(/[\u0000-\u001F]/g, ''); + + // Encode \" \' % and ; and : inside strings so they don't interfere with the style parsing + css = css.replace(/\\[\"\';:\uFEFF]/g, encode).replace(/\"[^\"]+\"|\'[^\']+\'/g, function(str) { + return str.replace(/[;:]/g, encode); + }); + + // Parse styles + while ((matches = styleRegExp.exec(css))) { + name = matches[1].replace(trimRightRegExp, '').toLowerCase(); + value = matches[2].replace(trimRightRegExp, ''); + + // Decode escaped sequences like \65 -> e + /*jshint loopfunc:true*/ + /*eslint no-loop-func:0 */ + value = value.replace(/\\[0-9a-f]+/g, function(e) { + return String.fromCharCode(parseInt(e.substr(1), 16)); + }); + + if (name && value.length > 0) { + // Don't allow behavior name or expression/comments within the values + if (!settings.allow_script_urls && (name == "behavior" || /expression\s*\(|\/\*|\*\//.test(value))) { + continue; + } + + // Opera will produce 700 instead of bold in their style values + if (name === 'font-weight' && value === '700') { + value = 'bold'; + } else if (name === 'color' || name === 'background-color') { // Lowercase colors like RED + value = value.toLowerCase(); + } + + // Convert RGB colors to HEX + value = value.replace(rgbRegExp, toHex); + + // Convert URLs and force them into url('value') format + value = value.replace(urlOrStrRegExp, processUrl); + styles[name] = isEncoded ? decode(value, true) : value; + } + + styleRegExp.lastIndex = matches.index + matches[0].length; + } + // Compress the styles to reduce it's size for example IE will expand styles + compress("border", "", true); + compress("border", "-width"); + compress("border", "-color"); + compress("border", "-style"); + compress("padding", ""); + compress("margin", ""); + compress2('border', 'border-width', 'border-style', 'border-color'); + + // Remove pointless border, IE produces these + if (styles.border === 'medium none') { + delete styles.border; + } + + // IE 11 will produce a border-image: none when getting the style attribute from

    + // So lets asume it shouldn't be there + if (styles['border-image'] === 'none') { + delete styles['border-image']; + } + } + + return styles; + }, + + /** + * Serializes the specified style object into a string. + * + * @method serialize + * @param {Object} styles Object to serialize as string for example: {border: '1px solid red'} + * @param {String} elementName Optional element name, if specified only the styles that matches the schema will be serialized. + * @return {String} String representation of the style object for example: border: 1px solid red. + */ + serialize: function(styles, elementName) { + var css = '', name, value; + + function serializeStyles(name) { + var styleList, i, l, value; + + styleList = validStyles[name]; + if (styleList) { + for (i = 0, l = styleList.length; i < l; i++) { + name = styleList[i]; + value = styles[name]; + + if (value !== undef && value.length > 0) { + css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';'; + } + } + } + } + + function isValid(name, elementName) { + var styleMap; + + styleMap = invalidStyles['*']; + if (styleMap && styleMap[name]) { + return false; + } + + styleMap = invalidStyles[elementName]; + if (styleMap && styleMap[name]) { + return false; + } + + return true; + } + + // Serialize styles according to schema + if (elementName && validStyles) { + // Serialize global styles and element specific styles + serializeStyles('*'); + serializeStyles(elementName); + } else { + // Output the styles in the order they are inside the object + for (name in styles) { + value = styles[name]; + + if (value !== undef && value.length > 0) { + if (!invalidStyles || isValid(name, elementName)) { + css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';'; + } + } + } + } + + return css; + } + }; + }; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Writer.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/html/Writer.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,199 @@ +/** + * Writer.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to write HTML tags out it can be used with the Serializer or the SaxParser. + * + * @class tinymce.html.Writer + * @example + * var writer = new tinymce.html.Writer({indent: true}); + * var parser = new tinymce.html.SaxParser(writer).parse('


    '); + * console.log(writer.getContent()); + * + * @class tinymce.html.Writer + * @version 3.4 + */ +define("tinymce/html/Writer", [ + "tinymce/html/Entities", + "tinymce/util/Tools" +], function(Entities, Tools) { + var makeMap = Tools.makeMap; + + /** + * Constructs a new Writer instance. + * + * @constructor + * @method Writer + * @param {Object} settings Name/value settings object. + */ + return function(settings) { + var html = [], indent, indentBefore, indentAfter, encode, htmlOutput; + + settings = settings || {}; + indent = settings.indent; + indentBefore = makeMap(settings.indent_before || ''); + indentAfter = makeMap(settings.indent_after || ''); + encode = Entities.getEncodeFunc(settings.entity_encoding || 'raw', settings.entities); + htmlOutput = settings.element_format == "html"; + + return { + /** + * Writes the a start element such as

    . + * + * @method start + * @param {String} name Name of the element. + * @param {Array} attrs Optional attribute array or undefined if it hasn't any. + * @param {Boolean} empty Optional empty state if the tag should end like
    . + */ + start: function(name, attrs, empty) { + var i, l, attr, value; + + if (indent && indentBefore[name] && html.length > 0) { + value = html[html.length - 1]; + + if (value.length > 0 && value !== '\n') { + html.push('\n'); + } + } + + html.push('<', name); + + if (attrs) { + for (i = 0, l = attrs.length; i < l; i++) { + attr = attrs[i]; + html.push(' ', attr.name, '="', encode(attr.value, true), '"'); + } + } + + if (!empty || htmlOutput) { + html[html.length] = '>'; + } else { + html[html.length] = ' />'; + } + + if (empty && indent && indentAfter[name] && html.length > 0) { + value = html[html.length - 1]; + + if (value.length > 0 && value !== '\n') { + html.push('\n'); + } + } + }, + + /** + * Writes the a end element such as

    . + * + * @method end + * @param {String} name Name of the element. + */ + end: function(name) { + var value; + + /*if (indent && indentBefore[name] && html.length > 0) { + value = html[html.length - 1]; + + if (value.length > 0 && value !== '\n') + html.push('\n'); + }*/ + + html.push(''); + + if (indent && indentAfter[name] && html.length > 0) { + value = html[html.length - 1]; + + if (value.length > 0 && value !== '\n') { + html.push('\n'); + } + } + }, + + /** + * Writes a text node. + * + * @method text + * @param {String} text String to write out. + * @param {Boolean} raw Optional raw state if true the contents wont get encoded. + */ + text: function(text, raw) { + if (text.length > 0) { + html[html.length] = raw ? text : encode(text); + } + }, + + /** + * Writes a cdata node such as . + * + * @method cdata + * @param {String} text String to write out inside the cdata. + */ + cdata: function(text) { + html.push(''); + }, + + /** + * Writes a comment node such as . + * + * @method cdata + * @param {String} text String to write out inside the comment. + */ + comment: function(text) { + html.push(''); + }, + + /** + * Writes a PI node such as . + * + * @method pi + * @param {String} name Name of the pi. + * @param {String} text String to write out inside the pi. + */ + pi: function(name, text) { + if (text) { + html.push(''); + } else { + html.push(''); + } + + if (indent) { + html.push('\n'); + } + }, + + /** + * Writes a doctype node such as . + * + * @method doctype + * @param {String} text String to write out inside the doctype. + */ + doctype: function(text) { + html.push('', indent ? '\n' : ''); + }, + + /** + * Resets the internal buffer if one wants to reuse the writer. + * + * @method reset + */ + reset: function() { + html.length = 0; + }, + + /** + * Returns the contents that got serialized. + * + * @method getContent + * @return {String} HTML contents that got written down. + */ + getContent: function() { + return html.join('').replace(/\n$/, ''); + } + }; + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/AbsoluteLayout.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/AbsoluteLayout.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,63 @@ +/** + * AbsoluteLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * LayoutManager for absolute positioning. This layout manager is more of + * a base class for other layouts but can be created and used directly. + * + * @-x-less AbsoluteLayout.less + * @class tinymce.ui.AbsoluteLayout + * @extends tinymce.ui.Layout + */ +define("tinymce/ui/AbsoluteLayout", [ + "tinymce/ui/Layout" +], function(Layout) { + "use strict"; + + return Layout.extend({ + Defaults: { + containerClass: 'abs-layout', + controlClass: 'abs-layout-item' + }, + + /** + * Recalculates the positions of the controls in the specified container. + * + * @method recalc + * @param {tinymce.ui.Container} container Container instance to recalc. + */ + recalc: function(container) { + container.items().filter(':visible').each(function(ctrl) { + var settings = ctrl.settings; + + ctrl.layoutRect({ + x: settings.x, + y: settings.y, + w: settings.w, + h: settings.h + }); + + if (ctrl.recalc) { + ctrl.recalc(); + } + }); + }, + + /** + * Renders the specified container and any layout specific HTML. + * + * @method renderHtml + * @param {tinymce.ui.Container} container Container to render HTML for. + */ + renderHtml: function(container) { + return '
    ' + this._super(container); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Button.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Button.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,170 @@ +/** + * Button.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to create buttons. You can create them directly or through the Factory. + * + * @example + * // Create and render a button to the body element + * tinymce.ui.Factory.create({ + * type: 'button', + * text: 'My button' + * }).renderTo(document.body); + * + * @-x-less Button.less + * @class tinymce.ui.Button + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Button", [ + "tinymce/ui/Widget" +], function(Widget) { + "use strict"; + + return Widget.extend({ + Defaults: { + classes: "widget btn", + role: "button" + }, + + /** + * Constructs a new button instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {String} size Size of the button small|medium|large. + * @setting {String} image Image to use for icon. + * @setting {String} icon Icon to use for button. + */ + init: function(settings) { + var self = this, size; + + self.on('click mousedown', function(e) { + e.preventDefault(); + }); + + self._super(settings); + size = settings.size; + + if (settings.subtype) { + self.addClass(settings.subtype); + } + + if (size) { + self.addClass('btn-' + size); + } + }, + + /** + * Sets/gets the current button icon. + * + * @method icon + * @param {String} [icon] New icon identifier. + * @return {String|tinymce.ui.MenuButton} Current icon or current MenuButton instance. + */ + icon: function(icon) { + var self = this, prefix = self.classPrefix; + + if (typeof icon == 'undefined') { + return self.settings.icon; + } + + self.settings.icon = icon; + icon = icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : ''; + + if (self._rendered) { + var btnElm = self.getEl().firstChild, iconElm = btnElm.getElementsByTagName('i')[0]; + + if (icon) { + if (!iconElm || iconElm != btnElm.firstChild) { + iconElm = document.createElement('i'); + btnElm.insertBefore(iconElm, btnElm.firstChild); + } + + iconElm.className = icon; + } else if (iconElm) { + btnElm.removeChild(iconElm); + } + + self.text(self._text); // Set text again to fix whitespace between icon + text + } + + return self; + }, + + /** + * Repaints the button for example after it's been resizes by a layout engine. + * + * @method repaint + */ + repaint: function() { + var btnStyle = this.getEl().firstChild.style; + + btnStyle.width = btnStyle.height = "100%"; + + this._super(); + }, + + /** + * Sets/gets the current button text. + * + * @method text + * @param {String} [text] New button text. + * @return {String|tinymce.ui.Button} Current text or current Button instance. + */ + text: function(text) { + var self = this; + + if (self._rendered) { + var textNode = self.getEl().lastChild.lastChild; + if (textNode) { + textNode.data = self.translate(text); + } + } + + return self._super(text); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix; + var icon = self.settings.icon, image; + + image = self.settings.image; + if (image) { + icon = 'none'; + + // Support for [high dpi, low dpi] image sources + if (typeof image != "string") { + image = window.getSelection ? image[0] : image[1]; + } + + image = ' style="background-image: url(\'' + image + '\')"'; + } else { + image = ''; + } + + icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : ''; + + return ( + '
    ' + + '' + + '
    ' + ); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ButtonGroup.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ButtonGroup.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,62 @@ +/** + * ButtonGroup.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This control enables you to put multiple buttons into a group. This is + * useful when you want to combine similar toolbar buttons into a group. + * + * @example + * // Create and render a buttongroup with two buttons to the body element + * tinymce.ui.Factory.create({ + * type: 'buttongroup', + * items: [ + * {text: 'Button A'}, + * {text: 'Button B'} + * ] + * }).renderTo(document.body); + * + * @-x-less ButtonGroup.less + * @class tinymce.ui.ButtonGroup + * @extends tinymce.ui.Container + */ +define("tinymce/ui/ButtonGroup", [ + "tinymce/ui/Container" +], function(Container) { + "use strict"; + + return Container.extend({ + Defaults: { + defaultType: 'button', + role: 'group' + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout; + + self.addClass('btn-group'); + self.preRender(); + layout.preRender(self); + + return ( + '
    ' + + '
    ' + + (self.settings.html || '') + layout.renderHtml(self) + + '
    ' + + '
    ' + ); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Checkbox.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Checkbox.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,119 @@ +/** + * Checkbox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This control creates a custom checkbox. + * + * @example + * // Create and render a checkbox to the body element + * tinymce.ui.Factory.create({ + * type: 'checkbox', + * checked: true, + * text: 'My checkbox' + * }).renderTo(document.body); + * + * @-x-less Checkbox.less + * @class tinymce.ui.Checkbox + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Checkbox", [ + "tinymce/ui/Widget" +], function(Widget) { + "use strict"; + + return Widget.extend({ + Defaults: { + classes: "checkbox", + role: "checkbox", + checked: false + }, + + /** + * Constructs a new Checkbox instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Boolean} checked True if the checkbox should be checked by default. + */ + init: function(settings) { + var self = this; + + self._super(settings); + + self.on('click mousedown', function(e) { + e.preventDefault(); + }); + + self.on('click', function(e) { + e.preventDefault(); + + if (!self.disabled()) { + self.checked(!self.checked()); + } + }); + + self.checked(self.settings.checked); + }, + + /** + * Getter/setter function for the checked state. + * + * @method checked + * @param {Boolean} [state] State to be set. + * @return {Boolean|tinymce.ui.Checkbox} True/false or checkbox if it's a set operation. + */ + checked: function(state) { + var self = this; + + if (typeof state != "undefined") { + if (state) { + self.addClass('checked'); + } else { + self.removeClass('checked'); + } + + self._checked = state; + self.aria('checked', state); + + return self; + } + + return self._checked; + }, + + /** + * Getter/setter function for the value state. + * + * @method value + * @param {Boolean} [state] State to be set. + * @return {Boolean|tinymce.ui.Checkbox} True/false or checkbox if it's a set operation. + */ + value: function(state) { + return this.checked(state); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix; + + return ( + '
    ' + + '' + + '' + self.encode(self._text) + '' + + '
    ' + ); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Collection.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Collection.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,430 @@ +/** + * Collection.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Control collection, this class contains control instances and it enables you to + * perform actions on all the contained items. This is very similar to how jQuery works. + * + * @example + * someCollection.show().disabled(true); + * + * @class tinymce.ui.Collection + */ +define("tinymce/ui/Collection", [ + "tinymce/util/Tools", + "tinymce/ui/Selector", + "tinymce/util/Class" +], function(Tools, Selector, Class) { + "use strict"; + + var Collection, proto, push = Array.prototype.push, slice = Array.prototype.slice; + + proto = { + /** + * Current number of contained control instances. + * + * @field length + * @type Number + */ + length: 0, + + /** + * Constructor for the collection. + * + * @constructor + * @method init + * @param {Array} items Optional array with items to add. + */ + init: function(items) { + if (items) { + this.add(items); + } + }, + + /** + * Adds new items to the control collection. + * + * @method add + * @param {Array} items Array if items to add to collection. + * @return {tinymce.ui.Collection} Current collection instance. + */ + add: function(items) { + var self = this; + + // Force single item into array + if (!Tools.isArray(items)) { + if (items instanceof Collection) { + self.add(items.toArray()); + } else { + push.call(self, items); + } + } else { + push.apply(self, items); + } + + return self; + }, + + /** + * Sets the contents of the collection. This will remove any existing items + * and replace them with the ones specified in the input array. + * + * @method set + * @param {Array} items Array with items to set into the Collection. + * @return {tinymce.ui.Collection} Collection instance. + */ + set: function(items) { + var self = this, len = self.length, i; + + self.length = 0; + self.add(items); + + // Remove old entries + for (i = self.length; i < len; i++) { + delete self[i]; + } + + return self; + }, + + /** + * Filters the collection item based on the specified selector expression or selector function. + * + * @method filter + * @param {String} selector Selector expression to filter items by. + * @return {tinymce.ui.Collection} Collection containing the filtered items. + */ + filter: function(selector) { + var self = this, i, l, matches = [], item, match; + + // Compile string into selector expression + if (typeof selector === "string") { + selector = new Selector(selector); + + match = function(item) { + return selector.match(item); + }; + } else { + // Use selector as matching function + match = selector; + } + + for (i = 0, l = self.length; i < l; i++) { + item = self[i]; + + if (match(item)) { + matches.push(item); + } + } + + return new Collection(matches); + }, + + /** + * Slices the items within the collection. + * + * @method slice + * @param {Number} index Index to slice at. + * @param {Number} len Optional length to slice. + * @return {tinymce.ui.Collection} Current collection. + */ + slice: function() { + return new Collection(slice.apply(this, arguments)); + }, + + /** + * Makes the current collection equal to the specified index. + * + * @method eq + * @param {Number} index Index of the item to set the collection to. + * @return {tinymce.ui.Collection} Current collection. + */ + eq: function(index) { + return index === -1 ? this.slice(index) : this.slice(index, +index + 1); + }, + + /** + * Executes the specified callback on each item in collection. + * + * @method each + * @param {function} callback Callback to execute for each item in collection. + * @return {tinymce.ui.Collection} Current collection instance. + */ + each: function(callback) { + Tools.each(this, callback); + + return this; + }, + + /** + * Returns an JavaScript array object of the contents inside the collection. + * + * @method toArray + * @return {Array} Array with all items from collection. + */ + toArray: function() { + return Tools.toArray(this); + }, + + /** + * Finds the index of the specified control or return -1 if it isn't in the collection. + * + * @method indexOf + * @param {Control} ctrl Control instance to look for. + * @return {Number} Index of the specified control or -1. + */ + indexOf: function(ctrl) { + var self = this, i = self.length; + + while (i--) { + if (self[i] === ctrl) { + break; + } + } + + return i; + }, + + /** + * Returns a new collection of the contents in reverse order. + * + * @method reverse + * @return {tinymce.ui.Collection} Collection instance with reversed items. + */ + reverse: function() { + return new Collection(Tools.toArray(this).reverse()); + }, + + /** + * Returns true/false if the class exists or not. + * + * @method hasClass + * @param {String} cls Class to check for. + * @return {Boolean} true/false state if the class exists or not. + */ + hasClass: function(cls) { + return this[0] ? this[0].hasClass(cls) : false; + }, + + /** + * Sets/gets the specific property on the items in the collection. The same as executing control.(); + * + * @method prop + * @param {String} name Property name to get/set. + * @param {Object} value Optional object value to set. + * @return {tinymce.ui.Collection} Current collection instance or value of the first item on a get operation. + */ + prop: function(name, value) { + var self = this, undef, item; + + if (value !== undef) { + self.each(function(item) { + if (item[name]) { + item[name](value); + } + }); + + return self; + } + + item = self[0]; + + if (item && item[name]) { + return item[name](); + } + }, + + /** + * Executes the specific function name with optional arguments an all items in collection if it exists. + * + * @example collection.exec("myMethod", arg1, arg2, arg3); + * @method exec + * @param {String} name Name of the function to execute. + * @param {Object} ... Multiple arguments to pass to each function. + * @return {tinymce.ui.Collection} Current collection. + */ + exec: function(name) { + var self = this, args = Tools.toArray(arguments).slice(1); + + self.each(function(item) { + if (item[name]) { + item[name].apply(item, args); + } + }); + + return self; + }, + + /** + * Remove all items from collection and DOM. + * + * @method remove + * @return {tinymce.ui.Collection} Current collection. + */ + remove: function() { + var i = this.length; + + while (i--) { + this[i].remove(); + } + + return this; + } + + /** + * Fires the specified event by name and arguments on the control. This will execute all + * bound event handlers. + * + * @method fire + * @param {String} name Name of the event to fire. + * @param {Object} args Optional arguments to pass to the event. + * @return {tinymce.ui.Collection} Current collection instance. + */ + // fire: function(event, args) {}, -- Generated by code below + + /** + * Binds a callback to the specified event. This event can both be + * native browser events like "click" or custom ones like PostRender. + * + * The callback function will have two parameters the first one being the control that received the event + * the second one will be the event object either the browsers native event object or a custom JS object. + * + * @method on + * @param {String} name Name of the event to bind. For example "click". + * @param {String/function} callback Callback function to execute ones the event occurs. + * @return {tinymce.ui.Collection} Current collection instance. + */ + // on: function(name, callback) {}, -- Generated by code below + + /** + * Unbinds the specified event and optionally a specific callback. If you omit the name + * parameter all event handlers will be removed. If you omit the callback all event handles + * by the specified name will be removed. + * + * @method off + * @param {String} name Optional name for the event to unbind. + * @param {function} callback Optional callback function to unbind. + * @return {tinymce.ui.Collection} Current collection instance. + */ + // off: function(name, callback) {}, -- Generated by code below + + /** + * Shows the items in the current collection. + * + * @method show + * @return {tinymce.ui.Collection} Current collection instance. + */ + // show: function() {}, -- Generated by code below + + /** + * Hides the items in the current collection. + * + * @method hide + * @return {tinymce.ui.Collection} Current collection instance. + */ + // hide: function() {}, -- Generated by code below + + /** + * Sets/gets the text contents of the items in the current collection. + * + * @method text + * @return {tinymce.ui.Collection} Current collection instance or text value of the first item on a get operation. + */ + // text: function(value) {}, -- Generated by code below + + /** + * Sets/gets the name contents of the items in the current collection. + * + * @method name + * @return {tinymce.ui.Collection} Current collection instance or name value of the first item on a get operation. + */ + // name: function(value) {}, -- Generated by code below + + /** + * Sets/gets the disabled state on the items in the current collection. + * + * @method disabled + * @return {tinymce.ui.Collection} Current collection instance or disabled state of the first item on a get operation. + */ + // disabled: function(state) {}, -- Generated by code below + + /** + * Sets/gets the active state on the items in the current collection. + * + * @method active + * @return {tinymce.ui.Collection} Current collection instance or active state of the first item on a get operation. + */ + // active: function(state) {}, -- Generated by code below + + /** + * Sets/gets the selected state on the items in the current collection. + * + * @method selected + * @return {tinymce.ui.Collection} Current collection instance or selected state of the first item on a get operation. + */ + // selected: function(state) {}, -- Generated by code below + + /** + * Sets/gets the selected state on the items in the current collection. + * + * @method visible + * @return {tinymce.ui.Collection} Current collection instance or visible state of the first item on a get operation. + */ + // visible: function(state) {}, -- Generated by code below + + /** + * Adds a class to all items in the collection. + * + * @method addClass + * @param {String} cls Class to add to each item. + * @return {tinymce.ui.Collection} Current collection instance. + */ + // addClass: function(cls) {}, -- Generated by code below + + /** + * Removes the specified class from all items in collection. + * + * @method removeClass + * @param {String} cls Class to remove from each item. + * @return {tinymce.ui.Collection} Current collection instance. + */ + // removeClass: function(cls) {}, -- Generated by code below + }; + + // Extend tinymce.ui.Collection prototype with some generated control specific methods + Tools.each('fire on off show hide addClass removeClass append prepend before after reflow'.split(' '), function(name) { + proto[name] = function() { + var args = Tools.toArray(arguments); + + this.each(function(ctrl) { + if (name in ctrl) { + ctrl[name].apply(ctrl, args); + } + }); + + return this; + }; + }); + + // Extend tinymce.ui.Collection prototype with some property methods + Tools.each('text name disabled active selected checked visible parent value data'.split(' '), function(name) { + proto[name] = function(value) { + return this.prop(name, value); + }; + }); + + // Create class based on the new prototype + Collection = Class.extend(proto); + + // Stick Collection into Selector to prevent circual references + Selector.Collection = Collection; + + return Collection; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ColorBox.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ColorBox.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,72 @@ +/** + * ColorBox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This widget lets you enter colors and browse for colors by pressing the color button. It also displays + * a preview of the current color. + * + * @-x-less ColorBox.less + * @class tinymce.ui.ColorBox + * @extends tinymce.ui.ComboBox + */ +define("tinymce/ui/ColorBox", [ + "tinymce/ui/ComboBox" +], function(ComboBox) { + "use strict"; + + return ComboBox.extend({ + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this; + + settings.spellcheck = false; + + if (settings.onaction) { + settings.icon = 'none'; + } + + self._super(settings); + + self.addClass('colorbox'); + self.on('change keyup postrender', function() { + self.repaintColor(self.value()); + }); + }, + + repaintColor: function(value) { + var elm = this.getEl().getElementsByTagName('i')[0]; + + if (elm) { + try { + elm.style.background = value; + } catch (ex) { + // Ignore + } + } + }, + + value: function(value) { + var self = this; + + if (typeof value != "undefined") { + if (self._rendered) { + self.repaintColor(value); + } + } + + return self._super(value); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ColorButton.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ColorButton.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,118 @@ +/** + * ColorButton.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a color button control. This is a split button in which the main + * button has a visual representation of the currently selected color. When clicked + * the caret button displays a color picker, allowing the user to select a new color. + * + * @-x-less ColorButton.less + * @class tinymce.ui.ColorButton + * @extends tinymce.ui.PanelButton + */ +define("tinymce/ui/ColorButton", [ + "tinymce/ui/PanelButton", + "tinymce/dom/DOMUtils" +], function(PanelButton, DomUtils) { + "use strict"; + + var DOM = DomUtils.DOM; + + return PanelButton.extend({ + /** + * Constructs a new ColorButton instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + this._super(settings); + this.addClass('colorbutton'); + }, + + /** + * Getter/setter for the current color. + * + * @method color + * @param {String} [color] Color to set. + * @return {String|tinymce.ui.ColorButton} Current color or current instance. + */ + color: function(color) { + if (color) { + this._color = color; + this.getEl('preview').style.backgroundColor = color; + return this; + } + + return this._color; + }, + + /** + * Resets the current color. + * + * @method resetColor + * @return {tinymce.ui.ColorButton} Current instance. + */ + resetColor: function() { + this._color = null; + this.getEl('preview').style.backgroundColor = null; + return this; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix; + var icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : ''; + var image = self.settings.image ? ' style="background-image: url(\'' + self.settings.image + '\')"' : ''; + + return ( + '
    ' + + '' + + '' + + '
    ' + ); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this, onClickHandler = self.settings.onclick; + + self.on('click', function(e) { + if (e.aria && e.aria.key == 'down') { + return; + } + + if (e.control == self && !DOM.getParent(e.target, '.' + self.classPrefix + 'open')) { + e.stopImmediatePropagation(); + onClickHandler.call(self, e); + } + }); + + delete self.settings.onclick; + + return self._super(); + } + }); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ColorPicker.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ColorPicker.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,206 @@ +/** + * ColorPicker.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Color picker widget lets you select colors. + * + * @-x-less ColorPicker.less + * @class tinymce.ui.ColorPicker + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/ColorPicker", [ + "tinymce/ui/Widget", + "tinymce/ui/DragHelper", + "tinymce/ui/DomUtils", + "tinymce/util/Color" +], function(Widget, DragHelper, DomUtils, Color) { + "use strict"; + + return Widget.extend({ + Defaults: { + classes: "widget colorpicker" + }, + + /** + * Constructs a new colorpicker instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {String} color Initial color value. + */ + init: function(settings) { + this._super(settings); + }, + + postRender: function() { + var self = this, color = self.color(), hsv, hueRootElm, huePointElm, svRootElm, svPointElm; + + hueRootElm = self.getEl('h'); + huePointElm = self.getEl('hp'); + svRootElm = self.getEl('sv'); + svPointElm = self.getEl('svp'); + + function getPos(elm, event) { + var pos = DomUtils.getPos(elm), x, y; + + x = event.pageX - pos.x; + y = event.pageY - pos.y; + + x = Math.max(0, Math.min(x / elm.clientWidth, 1)); + y = Math.max(0, Math.min(y / elm.clientHeight, 1)); + + return { + x: x, + y: y + }; + } + + function updateColor(hsv, hueUpdate) { + var hue = (360 - hsv.h) / 360; + + DomUtils.css(huePointElm, { + top: (hue * 100) + '%' + }); + + if (!hueUpdate) { + DomUtils.css(svPointElm, { + left: hsv.s + '%', + top: (100 - hsv.v) + '%' + }); + } + + svRootElm.style.background = new Color({s: 100, v: 100, h: hsv.h}).toHex(); + self.color().parse({s: hsv.s, v: hsv.v, h: hsv.h}); + } + + function updateSaturationAndValue(e) { + var pos; + + pos = getPos(svRootElm, e); + hsv.s = pos.x * 100; + hsv.v = (1 - pos.y) * 100; + + updateColor(hsv); + self.fire('change'); + } + + function updateHue(e) { + var pos; + + pos = getPos(hueRootElm, e); + hsv = color.toHsv(); + hsv.h = (1 - pos.y) * 360; + updateColor(hsv, true); + self.fire('change'); + } + + self._repaint = function() { + hsv = color.toHsv(); + updateColor(hsv); + }; + + self._super(); + + self._svdraghelper = new DragHelper(self._id + '-sv', { + start: updateSaturationAndValue, + drag: updateSaturationAndValue + }); + + self._hdraghelper = new DragHelper(self._id + '-h', { + start: updateHue, + drag: updateHue + }); + + self._repaint(); + }, + + rgb: function() { + return this.color().toRgb(); + }, + + value: function(value) { + var self = this; + + if (arguments.length) { + self.color().parse(value); + + if (self._rendered) { + self._repaint(); + } + } else { + return self.color().toHex(); + } + }, + + color: function() { + if (!this._color) { + this._color = new Color(); + } + + return this._color; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix, hueHtml; + var stops = '#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000'; + + function getOldIeFallbackHtml() { + var i, l, html = '', gradientPrefix, stopsList; + + gradientPrefix = 'filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='; + stopsList = stops.split(','); + for (i = 0, l = stopsList.length - 1; i < l; i++) { + html += ( + '
    ' + ); + } + + return html; + } + + var gradientCssText = ( + 'background: -ms-linear-gradient(top,' + stops + ');' + + 'background: linear-gradient(to bottom,' + stops + ');' + ); + + hueHtml = ( + '
    ' + + getOldIeFallbackHtml() + + '
    ' + + '
    ' + ); + + return ( + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + hueHtml + + '
    ' + ); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ComboBox.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ComboBox.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,332 @@ +/** + * ComboBox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a combobox control. Select box that you select a value from or + * type a value into. + * + * @-x-less ComboBox.less + * @class tinymce.ui.ComboBox + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/ComboBox", [ + "tinymce/ui/Widget", + "tinymce/ui/Factory", + "tinymce/ui/DomUtils" +], function(Widget, Factory, DomUtils) { + "use strict"; + + return Widget.extend({ + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {String} placeholder Placeholder text to display. + */ + init: function(settings) { + var self = this; + + self._super(settings); + self.addClass('combobox'); + self.subinput = true; + self.ariaTarget = 'inp'; // TODO: Figure out a better way + + settings = self.settings; + settings.menu = settings.menu || settings.values; + + if (settings.menu) { + settings.icon = 'caret'; + } + + self.on('click', function(e) { + var elm = e.target, root = self.getEl(); + + while (elm && elm != root) { + if (elm.id && elm.id.indexOf('-open') != -1) { + self.fire('action'); + + if (settings.menu) { + self.showMenu(); + + if (e.aria) { + self.menu.items()[0].focus(); + } + } + } + + elm = elm.parentNode; + } + }); + + // TODO: Rework this + self.on('keydown', function(e) { + if (e.target.nodeName == "INPUT" && e.keyCode == 13) { + self.parents().reverse().each(function(ctrl) { + e.preventDefault(); + self.fire('change'); + + if (ctrl.hasEventListeners('submit') && ctrl.toJSON) { + ctrl.fire('submit', {data: ctrl.toJSON()}); + return false; + } + }); + } + }); + + if (settings.placeholder) { + self.addClass('placeholder'); + + self.on('focusin', function() { + if (!self._hasOnChange) { + DomUtils.on(self.getEl('inp'), 'change', function() { + self.fire('change'); + }); + + self._hasOnChange = true; + } + + if (self.hasClass('placeholder')) { + self.getEl('inp').value = ''; + self.removeClass('placeholder'); + } + }); + + self.on('focusout', function() { + if (self.value().length === 0) { + self.getEl('inp').value = settings.placeholder; + self.addClass('placeholder'); + } + }); + } + }, + + showMenu: function() { + var self = this, settings = self.settings, menu; + + if (!self.menu) { + menu = settings.menu || []; + + // Is menu array then auto constuct menu control + if (menu.length) { + menu = { + type: 'menu', + items: menu + }; + } else { + menu.type = menu.type || 'menu'; + } + + self.menu = Factory.create(menu).parent(self).renderTo(self.getContainerElm()); + self.fire('createmenu'); + self.menu.reflow(); + self.menu.on('cancel', function(e) { + if (e.control === self.menu) { + self.focus(); + } + }); + + self.menu.on('show hide', function(e) { + e.control.items().each(function(ctrl) { + ctrl.active(ctrl.value() == self.value()); + }); + }).fire('show'); + + self.menu.on('select', function(e) { + self.value(e.control.value()); + }); + + self.on('focusin', function(e) { + if (e.target.tagName.toUpperCase() == 'INPUT') { + self.menu.hide(); + } + }); + + self.aria('expanded', true); + } + + self.menu.show(); + self.menu.layoutRect({w: self.layoutRect().w}); + self.menu.moveRel(self.getEl(), self.isRtl() ? ['br-tr', 'tr-br'] : ['bl-tl', 'tl-bl']); + }, + + /** + * Getter/setter function for the control value. + * + * @method value + * @param {String} [value] Value to be set. + * @return {String|tinymce.ui.ComboBox} Value or self if it's a set operation. + */ + value: function(value) { + var self = this; + + if (typeof value != "undefined") { + self._value = value; + self.removeClass('placeholder'); + + if (self._rendered) { + self.getEl('inp').value = value; + } + + return self; + } + + if (self._rendered) { + value = self.getEl('inp').value; + + if (value != self.settings.placeholder) { + return value; + } + + return ''; + } + + return self._value; + }, + + /** + * Getter/setter function for the disabled state. + * + * @method value + * @param {Boolean} [state] State to be set. + * @return {Boolean|tinymce.ui.ComboBox} True/false or self if it's a set operation. + */ + disabled: function(state) { + var self = this; + + if (self._rendered && typeof state != 'undefined') { + self.getEl('inp').disabled = state; + } + + return self._super(state); + }, + + /** + * Focuses the input area of the control. + * + * @method focus + */ + focus: function() { + this.getEl('inp').focus(); + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this, elm = self.getEl(), openElm = self.getEl('open'), rect = self.layoutRect(); + var width, lineHeight; + + if (openElm) { + width = rect.w - DomUtils.getSize(openElm).width - 10; + } else { + width = rect.w - 10; + } + + // Detect old IE 7+8 add lineHeight to align caret vertically in the middle + var doc = document; + if (doc.all && (!doc.documentMode || doc.documentMode <= 8)) { + lineHeight = (self.layoutRect().h - 2) + 'px'; + } + + DomUtils.css(elm.firstChild, { + width: width, + lineHeight: lineHeight + }); + + self._super(); + + return self; + }, + + /** + * Post render method. Called after the control has been rendered to the target. + * + * @method postRender + * @return {tinymce.ui.ComboBox} Current combobox instance. + */ + postRender: function() { + var self = this; + + DomUtils.on(this.getEl('inp'), 'change', function() { + self.fire('change'); + }); + + return self._super(); + }, + + remove: function() { + DomUtils.off(this.getEl('inp')); + this._super(); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, settings = self.settings, prefix = self.classPrefix; + var value = settings.value || settings.placeholder || ''; + var icon, text, openBtnHtml = '', extraAttrs = ''; + + if ("spellcheck" in settings) { + extraAttrs += ' spellcheck="' + settings.spellcheck + '"'; + } + + if (settings.maxLength) { + extraAttrs += ' maxlength="' + settings.maxLength + '"'; + } + + if (settings.size) { + extraAttrs += ' size="' + settings.size + '"'; + } + + if (settings.subtype) { + extraAttrs += ' type="' + settings.subtype + '"'; + } + + if (self.disabled()) { + extraAttrs += ' disabled="disabled"'; + } + + icon = settings.icon; + if (icon && icon != 'caret') { + icon = prefix + 'ico ' + prefix + 'i-' + settings.icon; + } + + text = self._text; + + if (icon || text) { + openBtnHtml = ( + '
    ' + + '' + + '
    ' + ); + + self.addClass('has-open'); + } + + return ( + '
    ' + + '' + + openBtnHtml + + '
    ' + ); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Container.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Container.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,495 @@ +/** + * Container.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Container control. This is extended by all controls that can have + * children such as panels etc. You can also use this class directly as an + * generic container instance. The container doesn't have any specific role or style. + * + * @-x-less Container.less + * @class tinymce.ui.Container + * @extends tinymce.ui.Control + */ +define("tinymce/ui/Container", [ + "tinymce/ui/Control", + "tinymce/ui/Collection", + "tinymce/ui/Selector", + "tinymce/ui/Factory", + "tinymce/ui/KeyboardNavigation", + "tinymce/util/Tools", + "tinymce/ui/DomUtils" +], function(Control, Collection, Selector, Factory, KeyboardNavigation, Tools, DomUtils) { + "use strict"; + + var selectorCache = {}; + + return Control.extend({ + layout: '', + innerClass: 'container-inner', + + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Array} items Items to add to container in JSON format or control instances. + * @setting {String} layout Layout manager by name to use. + * @setting {Object} defaults Default settings to apply to all items. + */ + init: function(settings) { + var self = this; + + self._super(settings); + settings = self.settings; + self._fixed = settings.fixed; + self._items = new Collection(); + + if (self.isRtl()) { + self.addClass('rtl'); + } + + self.addClass('container'); + self.addClass('container-body', 'body'); + + if (settings.containerCls) { + self.addClass(settings.containerCls); + } + + self._layout = Factory.create((settings.layout || self.layout) + 'layout'); + + if (self.settings.items) { + self.add(self.settings.items); + } + + // TODO: Fix this! + self._hasBody = true; + }, + + /** + * Returns a collection of child items that the container currently have. + * + * @method items + * @return {tinymce.ui.Collection} Control collection direct child controls. + */ + items: function() { + return this._items; + }, + + /** + * Find child controls by selector. + * + * @method find + * @param {String} selector Selector CSS pattern to find children by. + * @return {tinymce.ui.Collection} Control collection with child controls. + */ + find: function(selector) { + selector = selectorCache[selector] = selectorCache[selector] || new Selector(selector); + + return selector.find(this); + }, + + /** + * Adds one or many items to the current container. This will create instances of + * the object representations if needed. + * + * @method add + * @param {Array/Object/tinymce.ui.Control} items Array or item that will be added to the container. + * @return {tinymce.ui.Collection} Current collection control. + */ + add: function(items) { + var self = this; + + self.items().add(self.create(items)).parent(self); + + return self; + }, + + /** + * Focuses the current container instance. This will look + * for the first control in the container and focus that. + * + * @method focus + * @param {Boolean} keyboard Optional true/false if the focus was a keyboard focus or not. + * @return {tinymce.ui.Collection} Current instance. + */ + focus: function(keyboard) { + var self = this, focusCtrl, keyboardNav, items; + + if (keyboard) { + keyboardNav = self.keyboardNav || self.parents().eq(-1)[0].keyboardNav; + + if (keyboardNav) { + keyboardNav.focusFirst(self); + return; + } + } + + items = self.find('*'); + + // TODO: Figure out a better way to auto focus alert dialog buttons + if (self.statusbar) { + items.add(self.statusbar.items()); + } + + items.each(function(ctrl) { + if (ctrl.settings.autofocus) { + focusCtrl = null; + return false; + } + + if (ctrl.canFocus) { + focusCtrl = focusCtrl || ctrl; + } + }); + + if (focusCtrl) { + focusCtrl.focus(); + } + + return self; + }, + + /** + * Replaces the specified child control with a new control. + * + * @method replace + * @param {tinymce.ui.Control} oldItem Old item to be replaced. + * @param {tinymce.ui.Control} newItem New item to be inserted. + */ + replace: function(oldItem, newItem) { + var ctrlElm, items = this.items(), i = items.length; + + // Replace the item in collection + while (i--) { + if (items[i] === oldItem) { + items[i] = newItem; + break; + } + } + + if (i >= 0) { + // Remove new item from DOM + ctrlElm = newItem.getEl(); + if (ctrlElm) { + ctrlElm.parentNode.removeChild(ctrlElm); + } + + // Remove old item from DOM + ctrlElm = oldItem.getEl(); + if (ctrlElm) { + ctrlElm.parentNode.removeChild(ctrlElm); + } + } + + // Adopt the item + newItem.parent(this); + }, + + /** + * Creates the specified items. If any of the items is plain JSON style objects + * it will convert these into real tinymce.ui.Control instances. + * + * @method create + * @param {Array} items Array of items to convert into control instances. + * @return {Array} Array with control instances. + */ + create: function(items) { + var self = this, settings, ctrlItems = []; + + // Non array structure, then force it into an array + if (!Tools.isArray(items)) { + items = [items]; + } + + // Add default type to each child control + Tools.each(items, function(item) { + if (item) { + // Construct item if needed + if (!(item instanceof Control)) { + // Name only then convert it to an object + if (typeof item == "string") { + item = {type: item}; + } + + // Create control instance based on input settings and default settings + settings = Tools.extend({}, self.settings.defaults, item); + item.type = settings.type = settings.type || item.type || self.settings.defaultType || + (settings.defaults ? settings.defaults.type : null); + item = Factory.create(settings); + } + + ctrlItems.push(item); + } + }); + + return ctrlItems; + }, + + /** + * Renders new control instances. + * + * @private + */ + renderNew: function() { + var self = this; + + // Render any new items + self.items().each(function(ctrl, index) { + var containerElm, fragment; + + ctrl.parent(self); + + if (!ctrl._rendered) { + containerElm = self.getEl('body'); + fragment = DomUtils.createFragment(ctrl.renderHtml()); + + // Insert or append the item + if (containerElm.hasChildNodes() && index <= containerElm.childNodes.length - 1) { + containerElm.insertBefore(fragment, containerElm.childNodes[index]); + } else { + containerElm.appendChild(fragment); + } + + ctrl.postRender(); + } + }); + + self._layout.applyClasses(self); + self._lastRect = null; + + return self; + }, + + /** + * Appends new instances to the current container. + * + * @method append + * @param {Array/tinymce.ui.Collection} items Array if controls to append. + * @return {tinymce.ui.Container} Current container instance. + */ + append: function(items) { + return this.add(items).renderNew(); + }, + + /** + * Prepends new instances to the current container. + * + * @method prepend + * @param {Array/tinymce.ui.Collection} items Array if controls to prepend. + * @return {tinymce.ui.Container} Current container instance. + */ + prepend: function(items) { + var self = this; + + self.items().set(self.create(items).concat(self.items().toArray())); + + return self.renderNew(); + }, + + /** + * Inserts an control at a specific index. + * + * @method insert + * @param {Array/tinymce.ui.Collection} items Array if controls to insert. + * @param {Number} index Index to insert controls at. + * @param {Boolean} [before=false] Inserts controls before the index. + */ + insert: function(items, index, before) { + var self = this, curItems, beforeItems, afterItems; + + items = self.create(items); + curItems = self.items(); + + if (!before && index < curItems.length - 1) { + index += 1; + } + + if (index >= 0 && index < curItems.length) { + beforeItems = curItems.slice(0, index).toArray(); + afterItems = curItems.slice(index).toArray(); + curItems.set(beforeItems.concat(items, afterItems)); + } + + return self.renderNew(); + }, + + /** + * Populates the form fields from the specified JSON data object. + * + * Control items in the form that matches the data will have it's value set. + * + * @method fromJSON + * @param {Object} data JSON data object to set control values by. + * @return {tinymce.ui.Container} Current form instance. + */ + fromJSON: function(data) { + var self = this; + + for (var name in data) { + self.find('#' + name).value(data[name]); + } + + return self; + }, + + /** + * Serializes the form into a JSON object by getting all items + * that has a name and a value. + * + * @method toJSON + * @return {Object} JSON object with form data. + */ + toJSON: function() { + var self = this, data = {}; + + self.find('*').each(function(ctrl) { + var name = ctrl.name(), value = ctrl.value(); + + if (name && typeof value != "undefined") { + data[name] = value; + } + }); + + return data; + }, + + preRender: function() { + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, role = this.settings.role; + + self.preRender(); + layout.preRender(self); + + return ( + '
    ' + + '
    ' + + (self.settings.html || '') + layout.renderHtml(self) + + '
    ' + + '
    ' + ); + }, + + /** + * Post render method. Called after the control has been rendered to the target. + * + * @method postRender + * @return {tinymce.ui.Container} Current combobox instance. + */ + postRender: function() { + var self = this, box; + + self.items().exec('postRender'); + self._super(); + + self._layout.postRender(self); + self._rendered = true; + + if (self.settings.style) { + DomUtils.css(self.getEl(), self.settings.style); + } + + if (self.settings.border) { + box = self.borderBox(); + DomUtils.css(self.getEl(), { + 'border-top-width': box.top, + 'border-right-width': box.right, + 'border-bottom-width': box.bottom, + 'border-left-width': box.left + }); + } + + if (!self.parent()) { + self.keyboardNav = new KeyboardNavigation({ + root: self + }); + } + + return self; + }, + + /** + * Initializes the current controls layout rect. + * This will be executed by the layout managers to determine the + * default minWidth/minHeight etc. + * + * @method initLayoutRect + * @return {Object} Layout rect instance. + */ + initLayoutRect: function() { + var self = this, layoutRect = self._super(); + + // Recalc container size by asking layout manager + self._layout.recalc(self); + + return layoutRect; + }, + + /** + * Recalculates the positions of the controls in the current container. + * This is invoked by the reflow method and shouldn't be called directly. + * + * @method recalc + */ + recalc: function() { + var self = this, rect = self._layoutRect, lastRect = self._lastRect; + + if (!lastRect || lastRect.w != rect.w || lastRect.h != rect.h) { + self._layout.recalc(self); + rect = self.layoutRect(); + self._lastRect = {x: rect.x, y: rect.y, w: rect.w, h: rect.h}; + return true; + } + }, + + /** + * Reflows the current container and it's children and possible parents. + * This should be used after you for example append children to the current control so + * that the layout managers know that they need to reposition everything. + * + * @example + * container.append({type: 'button', text: 'My button'}).reflow(); + * + * @method reflow + * @return {tinymce.ui.Container} Current container instance. + */ + reflow: function() { + var i; + + if (this.visible()) { + Control.repaintControls = []; + Control.repaintControls.map = {}; + + this.recalc(); + i = Control.repaintControls.length; + + while (i--) { + Control.repaintControls[i].repaint(); + } + + // TODO: Fix me! + if (this.settings.layout !== "flow" && this.settings.layout !== "stack") { + this.repaint(); + } + + Control.repaintControls = []; + } + + return this; + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Control.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Control.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1479 @@ +/** + * Control.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*eslint consistent-this:0 */ + +/** + * This is the base class for all controls and containers. All UI control instances inherit + * from this one as it has the base logic needed by all of them. + * + * @class tinymce.ui.Control + */ +define("tinymce/ui/Control", [ + "tinymce/util/Class", + "tinymce/util/Tools", + "tinymce/util/EventDispatcher", + "tinymce/ui/Collection", + "tinymce/ui/DomUtils" +], function(Class, Tools, EventDispatcher, Collection, DomUtils) { + "use strict"; + + var hasMouseWheelEventSupport = "onmousewheel" in document; + var hasWheelEventSupport = false; + var classPrefix = "mce-"; + + function getEventDispatcher(obj) { + if (!obj._eventDispatcher) { + obj._eventDispatcher = new EventDispatcher({ + scope: obj, + toggleEvent: function(name, state) { + if (state && EventDispatcher.isNative(name)) { + if (!obj._nativeEvents) { + obj._nativeEvents = {}; + } + + obj._nativeEvents[name] = true; + + if (obj._rendered) { + obj.bindPendingEvents(); + } + } + } + }); + } + + return obj._eventDispatcher; + } + + var Control = Class.extend({ + Statics: { + classPrefix: classPrefix + }, + + isRtl: function() { + return Control.rtl; + }, + + /** + * Class/id prefix to use for all controls. + * + * @final + * @field {String} classPrefix + */ + classPrefix: classPrefix, + + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {String} style Style CSS properties to add. + * @setting {String} border Border box values example: 1 1 1 1 + * @setting {String} padding Padding box values example: 1 1 1 1 + * @setting {String} margin Margin box values example: 1 1 1 1 + * @setting {Number} minWidth Minimal width for the control. + * @setting {Number} minHeight Minimal height for the control. + * @setting {String} classes Space separated list of classes to add. + * @setting {String} role WAI-ARIA role to use for control. + * @setting {Boolean} hidden Is the control hidden by default. + * @setting {Boolean} disabled Is the control disabled by default. + * @setting {String} name Name of the control instance. + */ + init: function(settings) { + var self = this, classes, i; + + self.settings = settings = Tools.extend({}, self.Defaults, settings); + + // Initial states + self._id = settings.id || DomUtils.id(); + self._text = self._name = ''; + self._width = self._height = 0; + self._aria = {role: settings.role}; + this._elmCache = {}; + + // Setup classes + classes = settings.classes; + if (classes) { + classes = classes.split(' '); + classes.map = {}; + i = classes.length; + while (i--) { + classes.map[classes[i]] = true; + } + } + + self._classes = classes || []; + self.visible(true); + + // Set some properties + Tools.each('title text width height name classes visible disabled active value'.split(' '), function(name) { + var value = settings[name], undef; + + if (value !== undef) { + self[name](value); + } else if (self['_' + name] === undef) { + self['_' + name] = false; + } + }); + + self.on('click', function() { + if (self.disabled()) { + return false; + } + }); + + // TODO: Is this needed duplicate code see above? + if (settings.classes) { + Tools.each(settings.classes.split(' '), function(cls) { + self.addClass(cls); + }); + } + + /** + * Name/value object with settings for the current control. + * + * @field {Object} settings + */ + self.settings = settings; + + self._borderBox = self.parseBox(settings.border); + self._paddingBox = self.parseBox(settings.padding); + self._marginBox = self.parseBox(settings.margin); + + if (settings.hidden) { + self.hide(); + } + }, + + // Will generate getter/setter methods for these properties + Properties: 'parent,title,text,width,height,disabled,active,name,value', + + // Will generate empty dummy functions for these + Methods: 'renderHtml', + + /** + * Returns the root element to render controls into. + * + * @method getContainerElm + * @return {Element} HTML DOM element to render into. + */ + getContainerElm: function() { + return document.body; + }, + + /** + * Returns a control instance for the current DOM element. + * + * @method getParentCtrl + * @param {Element} elm HTML dom element to get parent control from. + * @return {tinymce.ui.Control} Control instance or undefined. + */ + getParentCtrl: function(elm) { + var ctrl, lookup = this.getRoot().controlIdLookup; + + while (elm && lookup) { + ctrl = lookup[elm.id]; + if (ctrl) { + break; + } + + elm = elm.parentNode; + } + + return ctrl; + }, + + /** + * Parses the specified box value. A box value contains 1-4 properties in clockwise order. + * + * @method parseBox + * @param {String/Number} value Box value "0 1 2 3" or "0" etc. + * @return {Object} Object with top/right/bottom/left properties. + * @private + */ + parseBox: function(value) { + var len, radix = 10; + + if (!value) { + return; + } + + if (typeof value === "number") { + value = value || 0; + + return { + top: value, + left: value, + bottom: value, + right: value + }; + } + + value = value.split(' '); + len = value.length; + + if (len === 1) { + value[1] = value[2] = value[3] = value[0]; + } else if (len === 2) { + value[2] = value[0]; + value[3] = value[1]; + } else if (len === 3) { + value[3] = value[1]; + } + + return { + top: parseInt(value[0], radix) || 0, + right: parseInt(value[1], radix) || 0, + bottom: parseInt(value[2], radix) || 0, + left: parseInt(value[3], radix) || 0 + }; + }, + + borderBox: function() { + return this._borderBox; + }, + + paddingBox: function() { + return this._paddingBox; + }, + + marginBox: function() { + return this._marginBox; + }, + + measureBox: function(elm, prefix) { + function getStyle(name) { + var defaultView = document.defaultView; + + if (defaultView) { + // Remove camelcase + name = name.replace(/[A-Z]/g, function(a) { + return '-' + a; + }); + + return defaultView.getComputedStyle(elm, null).getPropertyValue(name); + } + + return elm.currentStyle[name]; + } + + function getSide(name) { + var val = parseFloat(getStyle(name), 10); + + return isNaN(val) ? 0 : val; + } + + return { + top: getSide(prefix + "TopWidth"), + right: getSide(prefix + "RightWidth"), + bottom: getSide(prefix + "BottomWidth"), + left: getSide(prefix + "LeftWidth") + }; + }, + + /** + * Initializes the current controls layout rect. + * This will be executed by the layout managers to determine the + * default minWidth/minHeight etc. + * + * @method initLayoutRect + * @return {Object} Layout rect instance. + */ + initLayoutRect: function() { + var self = this, settings = self.settings, borderBox, layoutRect; + var elm = self.getEl(), width, height, minWidth, minHeight, autoResize; + var startMinWidth, startMinHeight, initialSize; + + // Measure the current element + borderBox = self._borderBox = self._borderBox || self.measureBox(elm, 'border'); + self._paddingBox = self._paddingBox || self.measureBox(elm, 'padding'); + self._marginBox = self._marginBox || self.measureBox(elm, 'margin'); + initialSize = DomUtils.getSize(elm); + + // Setup minWidth/minHeight and width/height + startMinWidth = settings.minWidth; + startMinHeight = settings.minHeight; + minWidth = startMinWidth || initialSize.width; + minHeight = startMinHeight || initialSize.height; + width = settings.width; + height = settings.height; + autoResize = settings.autoResize; + autoResize = typeof autoResize != "undefined" ? autoResize : !width && !height; + + width = width || minWidth; + height = height || minHeight; + + var deltaW = borderBox.left + borderBox.right; + var deltaH = borderBox.top + borderBox.bottom; + + var maxW = settings.maxWidth || 0xFFFF; + var maxH = settings.maxHeight || 0xFFFF; + + // Setup initial layout rect + self._layoutRect = layoutRect = { + x: settings.x || 0, + y: settings.y || 0, + w: width, + h: height, + deltaW: deltaW, + deltaH: deltaH, + contentW: width - deltaW, + contentH: height - deltaH, + innerW: width - deltaW, + innerH: height - deltaH, + startMinWidth: startMinWidth || 0, + startMinHeight: startMinHeight || 0, + minW: Math.min(minWidth, maxW), + minH: Math.min(minHeight, maxH), + maxW: maxW, + maxH: maxH, + autoResize: autoResize, + scrollW: 0 + }; + + self._lastLayoutRect = {}; + + return layoutRect; + }, + + /** + * Getter/setter for the current layout rect. + * + * @method layoutRect + * @param {Object} [newRect] Optional new layout rect. + * @return {tinymce.ui.Control/Object} Current control or rect object. + */ + layoutRect: function(newRect) { + var self = this, curRect = self._layoutRect, lastLayoutRect, size, deltaWidth, deltaHeight, undef, repaintControls; + + // Initialize default layout rect + if (!curRect) { + curRect = self.initLayoutRect(); + } + + // Set new rect values + if (newRect) { + // Calc deltas between inner and outer sizes + deltaWidth = curRect.deltaW; + deltaHeight = curRect.deltaH; + + // Set x position + if (newRect.x !== undef) { + curRect.x = newRect.x; + } + + // Set y position + if (newRect.y !== undef) { + curRect.y = newRect.y; + } + + // Set minW + if (newRect.minW !== undef) { + curRect.minW = newRect.minW; + } + + // Set minH + if (newRect.minH !== undef) { + curRect.minH = newRect.minH; + } + + // Set new width and calculate inner width + size = newRect.w; + if (size !== undef) { + size = size < curRect.minW ? curRect.minW : size; + size = size > curRect.maxW ? curRect.maxW : size; + curRect.w = size; + curRect.innerW = size - deltaWidth; + } + + // Set new height and calculate inner height + size = newRect.h; + if (size !== undef) { + size = size < curRect.minH ? curRect.minH : size; + size = size > curRect.maxH ? curRect.maxH : size; + curRect.h = size; + curRect.innerH = size - deltaHeight; + } + + // Set new inner width and calculate width + size = newRect.innerW; + if (size !== undef) { + size = size < curRect.minW - deltaWidth ? curRect.minW - deltaWidth : size; + size = size > curRect.maxW - deltaWidth ? curRect.maxW - deltaWidth : size; + curRect.innerW = size; + curRect.w = size + deltaWidth; + } + + // Set new height and calculate inner height + size = newRect.innerH; + if (size !== undef) { + size = size < curRect.minH - deltaHeight ? curRect.minH - deltaHeight : size; + size = size > curRect.maxH - deltaHeight ? curRect.maxH - deltaHeight : size; + curRect.innerH = size; + curRect.h = size + deltaHeight; + } + + // Set new contentW + if (newRect.contentW !== undef) { + curRect.contentW = newRect.contentW; + } + + // Set new contentH + if (newRect.contentH !== undef) { + curRect.contentH = newRect.contentH; + } + + // Compare last layout rect with the current one to see if we need to repaint or not + lastLayoutRect = self._lastLayoutRect; + if (lastLayoutRect.x !== curRect.x || lastLayoutRect.y !== curRect.y || + lastLayoutRect.w !== curRect.w || lastLayoutRect.h !== curRect.h) { + repaintControls = Control.repaintControls; + + if (repaintControls) { + if (repaintControls.map && !repaintControls.map[self._id]) { + repaintControls.push(self); + repaintControls.map[self._id] = true; + } + } + + lastLayoutRect.x = curRect.x; + lastLayoutRect.y = curRect.y; + lastLayoutRect.w = curRect.w; + lastLayoutRect.h = curRect.h; + } + + return self; + } + + return curRect; + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this, style, bodyStyle, rect, borderBox, borderW = 0, borderH = 0, lastRepaintRect, round; + + // Use Math.round on all values on IE < 9 + round = !document.createRange ? Math.round : function(value) { + return value; + }; + + style = self.getEl().style; + rect = self._layoutRect; + lastRepaintRect = self._lastRepaintRect || {}; + + borderBox = self._borderBox; + borderW = borderBox.left + borderBox.right; + borderH = borderBox.top + borderBox.bottom; + + if (rect.x !== lastRepaintRect.x) { + style.left = round(rect.x) + 'px'; + lastRepaintRect.x = rect.x; + } + + if (rect.y !== lastRepaintRect.y) { + style.top = round(rect.y) + 'px'; + lastRepaintRect.y = rect.y; + } + + if (rect.w !== lastRepaintRect.w) { + style.width = round(rect.w - borderW) + 'px'; + lastRepaintRect.w = rect.w; + } + + if (rect.h !== lastRepaintRect.h) { + style.height = round(rect.h - borderH) + 'px'; + lastRepaintRect.h = rect.h; + } + + // Update body if needed + if (self._hasBody && rect.innerW !== lastRepaintRect.innerW) { + bodyStyle = self.getEl('body').style; + bodyStyle.width = round(rect.innerW) + 'px'; + lastRepaintRect.innerW = rect.innerW; + } + + if (self._hasBody && rect.innerH !== lastRepaintRect.innerH) { + bodyStyle = bodyStyle || self.getEl('body').style; + bodyStyle.height = round(rect.innerH) + 'px'; + lastRepaintRect.innerH = rect.innerH; + } + + self._lastRepaintRect = lastRepaintRect; + self.fire('repaint', {}, false); + }, + + /** + * Binds a callback to the specified event. This event can both be + * native browser events like "click" or custom ones like PostRender. + * + * The callback function will be passed a DOM event like object that enables yout do stop propagation. + * + * @method on + * @param {String} name Name of the event to bind. For example "click". + * @param {String/function} callback Callback function to execute ones the event occurs. + * @return {tinymce.ui.Control} Current control object. + */ + on: function(name, callback) { + var self = this; + + function resolveCallbackName(name) { + var callback, scope; + + if (typeof name != 'string') { + return name; + } + + return function(e) { + if (!callback) { + self.parentsAndSelf().each(function(ctrl) { + var callbacks = ctrl.settings.callbacks; + + if (callbacks && (callback = callbacks[name])) { + scope = ctrl; + return false; + } + }); + } + + return callback.call(scope, e); + }; + } + + getEventDispatcher(self).on(name, resolveCallbackName(callback)); + + return self; + }, + + /** + * Unbinds the specified event and optionally a specific callback. If you omit the name + * parameter all event handlers will be removed. If you omit the callback all event handles + * by the specified name will be removed. + * + * @method off + * @param {String} [name] Name for the event to unbind. + * @param {function} [callback] Callback function to unbind. + * @return {mxex.ui.Control} Current control object. + */ + off: function(name, callback) { + getEventDispatcher(this).off(name, callback); + return this; + }, + + /** + * Fires the specified event by name and arguments on the control. This will execute all + * bound event handlers. + * + * @method fire + * @param {String} name Name of the event to fire. + * @param {Object} [args] Arguments to pass to the event. + * @param {Boolean} [bubble] Value to control bubbeling. Defaults to true. + * @return {Object} Current arguments object. + */ + fire: function(name, args, bubble) { + var self = this; + + args = args || {}; + + if (!args.control) { + args.control = self; + } + + args = getEventDispatcher(self).fire(name, args); + + // Bubble event up to parents + if (bubble !== false && self.parent) { + var parent = self.parent(); + while (parent && !args.isPropagationStopped()) { + parent.fire(name, args, false); + parent = parent.parent(); + } + } + + return args; + }, + + /** + * Returns true/false if the specified event has any listeners. + * + * @method hasEventListeners + * @param {String} name Name of the event to check for. + * @return {Boolean} True/false state if the event has listeners. + */ + hasEventListeners: function(name) { + return getEventDispatcher(this).has(name); + }, + + /** + * Returns a control collection with all parent controls. + * + * @method parents + * @param {String} selector Optional selector expression to find parents. + * @return {tinymce.ui.Collection} Collection with all parent controls. + */ + parents: function(selector) { + var self = this, ctrl, parents = new Collection(); + + // Add each parent to collection + for (ctrl = self.parent(); ctrl; ctrl = ctrl.parent()) { + parents.add(ctrl); + } + + // Filter away everything that doesn't match the selector + if (selector) { + parents = parents.filter(selector); + } + + return parents; + }, + + /** + * Returns the current control and it's parents. + * + * @method parentsAndSelf + * @param {String} selector Optional selector expression to find parents. + * @return {tinymce.ui.Collection} Collection with all parent controls. + */ + parentsAndSelf: function(selector) { + return new Collection(this).add(this.parents(selector)); + }, + + /** + * Returns the control next to the current control. + * + * @method next + * @return {tinymce.ui.Control} Next control instance. + */ + next: function() { + var parentControls = this.parent().items(); + + return parentControls[parentControls.indexOf(this) + 1]; + }, + + /** + * Returns the control previous to the current control. + * + * @method prev + * @return {tinymce.ui.Control} Previous control instance. + */ + prev: function() { + var parentControls = this.parent().items(); + + return parentControls[parentControls.indexOf(this) - 1]; + }, + + /** + * Find the common ancestor for two control instances. + * + * @method findCommonAncestor + * @param {tinymce.ui.Control} ctrl1 First control. + * @param {tinymce.ui.Control} ctrl2 Second control. + * @return {tinymce.ui.Control} Ancestor control instance. + */ + findCommonAncestor: function(ctrl1, ctrl2) { + var parentCtrl; + + while (ctrl1) { + parentCtrl = ctrl2; + + while (parentCtrl && ctrl1 != parentCtrl) { + parentCtrl = parentCtrl.parent(); + } + + if (ctrl1 == parentCtrl) { + break; + } + + ctrl1 = ctrl1.parent(); + } + + return ctrl1; + }, + + /** + * Returns true/false if the specific control has the specific class. + * + * @method hasClass + * @param {String} cls Class to check for. + * @param {String} [group] Sub element group name. + * @return {Boolean} True/false if the control has the specified class. + */ + hasClass: function(cls, group) { + var classes = this._classes[group || 'control']; + + cls = this.classPrefix + cls; + + return classes && !!classes.map[cls]; + }, + + /** + * Adds the specified class to the control + * + * @method addClass + * @param {String} cls Class to check for. + * @param {String} [group] Sub element group name. + * @return {tinymce.ui.Control} Current control object. + */ + addClass: function(cls, group) { + var self = this, classes, elm; + + cls = this.classPrefix + cls; + classes = self._classes[group || 'control']; + + if (!classes) { + classes = []; + classes.map = {}; + self._classes[group || 'control'] = classes; + } + + if (!classes.map[cls]) { + classes.map[cls] = cls; + classes.push(cls); + + if (self._rendered) { + elm = self.getEl(group); + + if (elm) { + elm.className = classes.join(' '); + } + } + } + + return self; + }, + + /** + * Removes the specified class from the control. + * + * @method removeClass + * @param {String} cls Class to remove. + * @param {String} [group] Sub element group name. + * @return {tinymce.ui.Control} Current control object. + */ + removeClass: function(cls, group) { + var self = this, classes, i, elm; + + cls = this.classPrefix + cls; + classes = self._classes[group || 'control']; + if (classes && classes.map[cls]) { + delete classes.map[cls]; + + i = classes.length; + while (i--) { + if (classes[i] === cls) { + classes.splice(i, 1); + } + } + } + + if (self._rendered) { + elm = self.getEl(group); + + if (elm) { + elm.className = classes.join(' '); + } + } + + return self; + }, + + /** + * Toggles the specified class on the control. + * + * @method toggleClass + * @param {String} cls Class to remove. + * @param {Boolean} state True/false state to add/remove class. + * @param {String} [group] Sub element group name. + * @return {tinymce.ui.Control} Current control object. + */ + toggleClass: function(cls, state, group) { + var self = this; + + if (state) { + self.addClass(cls, group); + } else { + self.removeClass(cls, group); + } + + return self; + }, + + /** + * Returns the class string for the specified group name. + * + * @method classes + * @param {String} [group] Group to get clases by. + * @return {String} Classes for the specified group. + */ + classes: function(group) { + var classes = this._classes[group || 'control']; + + return classes ? classes.join(' ') : ''; + }, + + /** + * Sets the inner HTML of the control element. + * + * @method innerHtml + * @param {String} html Html string to set as inner html. + * @return {tinymce.ui.Control} Current control object. + */ + innerHtml: function(html) { + DomUtils.innerHtml(this.getEl(), html); + return this; + }, + + /** + * Returns the control DOM element or sub element. + * + * @method getEl + * @param {String} [suffix] Suffix to get element by. + * @return {Element} HTML DOM element for the current control or it's children. + */ + getEl: function(suffix) { + var id = suffix ? this._id + '-' + suffix : this._id; + + if (!this._elmCache[id]) { + this._elmCache[id] = DomUtils.get(id); + } + + return this._elmCache[id]; + }, + + /** + * Sets/gets the visible for the control. + * + * @method visible + * @param {Boolean} state Value to set to control. + * @return {Boolean/tinymce.ui.Control} Current control on a set operation or current state on a get. + */ + visible: function(state) { + var self = this, parentCtrl; + + if (typeof state !== "undefined") { + if (self._visible !== state) { + if (self._rendered) { + self.getEl().style.display = state ? '' : 'none'; + } + + self._visible = state; + + // Parent container needs to reflow + parentCtrl = self.parent(); + if (parentCtrl) { + parentCtrl._lastRect = null; + } + + self.fire(state ? 'show' : 'hide'); + } + + return self; + } + + return self._visible; + }, + + /** + * Sets the visible state to true. + * + * @method show + * @return {tinymce.ui.Control} Current control instance. + */ + show: function() { + return this.visible(true); + }, + + /** + * Sets the visible state to false. + * + * @method hide + * @return {tinymce.ui.Control} Current control instance. + */ + hide: function() { + return this.visible(false); + }, + + /** + * Focuses the current control. + * + * @method focus + * @return {tinymce.ui.Control} Current control instance. + */ + focus: function() { + try { + this.getEl().focus(); + } catch (ex) { + // Ignore IE error + } + + return this; + }, + + /** + * Blurs the current control. + * + * @method blur + * @return {tinymce.ui.Control} Current control instance. + */ + blur: function() { + this.getEl().blur(); + + return this; + }, + + /** + * Sets the specified aria property. + * + * @method aria + * @param {String} name Name of the aria property to set. + * @param {String} value Value of the aria property. + * @return {tinymce.ui.Control} Current control instance. + */ + aria: function(name, value) { + var self = this, elm = self.getEl(self.ariaTarget); + + if (typeof value === "undefined") { + return self._aria[name]; + } else { + self._aria[name] = value; + } + + if (self._rendered) { + elm.setAttribute(name == 'role' ? name : 'aria-' + name, value); + } + + return self; + }, + + /** + * Encodes the specified string with HTML entities. It will also + * translate the string to different languages. + * + * @method encode + * @param {String/Object/Array} text Text to entity encode. + * @param {Boolean} [translate=true] False if the contents shouldn't be translated. + * @return {String} Encoded and possible traslated string. + */ + encode: function(text, translate) { + if (translate !== false) { + text = this.translate(text); + } + + return (text || '').replace(/[&<>"]/g, function(match) { + return '&#' + match.charCodeAt(0) + ';'; + }); + }, + + /** + * Returns the translated string. + * + * @method translate + * @param {String} text Text to translate. + * @return {String} Translated string or the same as the input. + */ + translate: function(text) { + return Control.translate ? Control.translate(text) : text; + }, + + /** + * Adds items before the current control. + * + * @method before + * @param {Array/tinymce.ui.Collection} items Array of items to prepend before this control. + * @return {tinymce.ui.Control} Current control instance. + */ + before: function(items) { + var self = this, parent = self.parent(); + + if (parent) { + parent.insert(items, parent.items().indexOf(self), true); + } + + return self; + }, + + /** + * Adds items after the current control. + * + * @method after + * @param {Array/tinymce.ui.Collection} items Array of items to append after this control. + * @return {tinymce.ui.Control} Current control instance. + */ + after: function(items) { + var self = this, parent = self.parent(); + + if (parent) { + parent.insert(items, parent.items().indexOf(self)); + } + + return self; + }, + + /** + * Removes the current control from DOM and from UI collections. + * + * @method remove + * @return {tinymce.ui.Control} Current control instance. + */ + remove: function() { + var self = this, elm = self.getEl(), parent = self.parent(), newItems, i; + + if (self.items) { + var controls = self.items().toArray(); + i = controls.length; + while (i--) { + controls[i].remove(); + } + } + + if (parent && parent.items) { + newItems = []; + + parent.items().each(function(item) { + if (item !== self) { + newItems.push(item); + } + }); + + parent.items().set(newItems); + parent._lastRect = null; + } + + if (self._eventsRoot && self._eventsRoot == self) { + DomUtils.off(elm); + } + + var lookup = self.getRoot().controlIdLookup; + if (lookup) { + delete lookup[self._id]; + } + + if (elm && elm.parentNode) { + elm.parentNode.removeChild(elm); + } + + self._rendered = false; + + return self; + }, + + /** + * Renders the control before the specified element. + * + * @method renderBefore + * @param {Element} elm Element to render before. + * @return {tinymce.ui.Control} Current control instance. + */ + renderBefore: function(elm) { + var self = this; + + elm.parentNode.insertBefore(DomUtils.createFragment(self.renderHtml()), elm); + self.postRender(); + + return self; + }, + + /** + * Renders the control to the specified element. + * + * @method renderBefore + * @param {Element} elm Element to render to. + * @return {tinymce.ui.Control} Current control instance. + */ + renderTo: function(elm) { + var self = this; + + elm = elm || self.getContainerElm(); + elm.appendChild(DomUtils.createFragment(self.renderHtml())); + self.postRender(); + + return self; + }, + + /** + * Post render method. Called after the control has been rendered to the target. + * + * @method postRender + * @return {tinymce.ui.Control} Current control instance. + */ + postRender: function() { + var self = this, settings = self.settings, elm, box, parent, name, parentEventsRoot; + + // Bind on settings + for (name in settings) { + if (name.indexOf("on") === 0) { + self.on(name.substr(2), settings[name]); + } + } + + if (self._eventsRoot) { + for (parent = self.parent(); !parentEventsRoot && parent; parent = parent.parent()) { + parentEventsRoot = parent._eventsRoot; + } + + if (parentEventsRoot) { + for (name in parentEventsRoot._nativeEvents) { + self._nativeEvents[name] = true; + } + } + } + + self.bindPendingEvents(); + + if (settings.style) { + elm = self.getEl(); + if (elm) { + elm.setAttribute('style', settings.style); + elm.style.cssText = settings.style; + } + } + + if (!self._visible) { + DomUtils.css(self.getEl(), 'display', 'none'); + } + + if (self.settings.border) { + box = self.borderBox(); + DomUtils.css(self.getEl(), { + 'border-top-width': box.top, + 'border-right-width': box.right, + 'border-bottom-width': box.bottom, + 'border-left-width': box.left + }); + } + + // Add instance to lookup + var root = self.getRoot(); + if (!root.controlIdLookup) { + root.controlIdLookup = {}; + } + + root.controlIdLookup[self._id] = self; + + for (var key in self._aria) { + self.aria(key, self._aria[key]); + } + + self.fire('postrender', {}, false); + }, + + /** + * Scrolls the current control into view. + * + * @method scrollIntoView + * @param {String} align Alignment in view top|center|bottom. + * @return {tinymce.ui.Control} Current control instance. + */ + scrollIntoView: function(align) { + function getOffset(elm, rootElm) { + var x, y, parent = elm; + + x = y = 0; + while (parent && parent != rootElm && parent.nodeType) { + x += parent.offsetLeft || 0; + y += parent.offsetTop || 0; + parent = parent.offsetParent; + } + + return {x: x, y: y}; + } + + var elm = this.getEl(), parentElm = elm.parentNode; + var x, y, width, height, parentWidth, parentHeight; + var pos = getOffset(elm, parentElm); + + x = pos.x; + y = pos.y; + width = elm.offsetWidth; + height = elm.offsetHeight; + parentWidth = parentElm.clientWidth; + parentHeight = parentElm.clientHeight; + + if (align == "end") { + x -= parentWidth - width; + y -= parentHeight - height; + } else if (align == "center") { + x -= (parentWidth / 2) - (width / 2); + y -= (parentHeight / 2) - (height / 2); + } + + parentElm.scrollLeft = x; + parentElm.scrollTop = y; + + return this; + }, + + /** + * Binds pending DOM events. + * + * @private + */ + bindPendingEvents: function() { + var self = this, i, l, parents, eventRootCtrl, nativeEvents, name; + + function delegate(e) { + var control = self.getParentCtrl(e.target); + + if (control) { + control.fire(e.type, e); + } + } + + function mouseLeaveHandler() { + var ctrl = eventRootCtrl._lastHoverCtrl; + + if (ctrl) { + ctrl.fire("mouseleave", {target: ctrl.getEl()}); + + ctrl.parents().each(function(ctrl) { + ctrl.fire("mouseleave", {target: ctrl.getEl()}); + }); + + eventRootCtrl._lastHoverCtrl = null; + } + } + + function mouseEnterHandler(e) { + var ctrl = self.getParentCtrl(e.target), lastCtrl = eventRootCtrl._lastHoverCtrl, idx = 0, i, parents, lastParents; + + // Over on a new control + if (ctrl !== lastCtrl) { + eventRootCtrl._lastHoverCtrl = ctrl; + + parents = ctrl.parents().toArray().reverse(); + parents.push(ctrl); + + if (lastCtrl) { + lastParents = lastCtrl.parents().toArray().reverse(); + lastParents.push(lastCtrl); + + for (idx = 0; idx < lastParents.length; idx++) { + if (parents[idx] !== lastParents[idx]) { + break; + } + } + + for (i = lastParents.length - 1; i >= idx; i--) { + lastCtrl = lastParents[i]; + lastCtrl.fire("mouseleave", { + target: lastCtrl.getEl() + }); + } + } + + for (i = idx; i < parents.length; i++) { + ctrl = parents[i]; + ctrl.fire("mouseenter", { + target: ctrl.getEl() + }); + } + } + } + + function fixWheelEvent(e) { + e.preventDefault(); + + if (e.type == "mousewheel") { + e.deltaY = -1 / 40 * e.wheelDelta; + + if (e.wheelDeltaX) { + e.deltaX = -1 / 40 * e.wheelDeltaX; + } + } else { + e.deltaX = 0; + e.deltaY = e.detail; + } + + e = self.fire("wheel", e); + } + + self._rendered = true; + + nativeEvents = self._nativeEvents; + if (nativeEvents) { + // Find event root element if it exists + parents = self.parents().toArray(); + parents.unshift(self); + for (i = 0, l = parents.length; !eventRootCtrl && i < l; i++) { + eventRootCtrl = parents[i]._eventsRoot; + } + + // Event root wasn't found the use the root control + if (!eventRootCtrl) { + eventRootCtrl = parents[parents.length - 1] || self; + } + + // Set the eventsRoot property on children that didn't have it + self._eventsRoot = eventRootCtrl; + for (l = i, i = 0; i < l; i++) { + parents[i]._eventsRoot = eventRootCtrl; + } + + var eventRootDelegates = eventRootCtrl._delegates; + if (!eventRootDelegates) { + eventRootDelegates = eventRootCtrl._delegates = {}; + } + + // Bind native event delegates + for (name in nativeEvents) { + if (!nativeEvents) { + return false; + } + + if (name === "wheel" && !hasWheelEventSupport) { + if (hasMouseWheelEventSupport) { + DomUtils.on(self.getEl(), "mousewheel", fixWheelEvent); + } else { + DomUtils.on(self.getEl(), "DOMMouseScroll", fixWheelEvent); + } + + continue; + } + + // Special treatment for mousenter/mouseleave since these doesn't bubble + if (name === "mouseenter" || name === "mouseleave") { + // Fake mousenter/mouseleave + if (!eventRootCtrl._hasMouseEnter) { + DomUtils.on(eventRootCtrl.getEl(), "mouseleave", mouseLeaveHandler); + DomUtils.on(eventRootCtrl.getEl(), "mouseover", mouseEnterHandler); + eventRootCtrl._hasMouseEnter = 1; + } + } else if (!eventRootDelegates[name]) { + DomUtils.on(eventRootCtrl.getEl(), name, delegate); + eventRootDelegates[name] = true; + } + + // Remove the event once it's bound + nativeEvents[name] = false; + } + } + }, + + getRoot: function() { + var ctrl = this, rootControl, parents = []; + + while (ctrl) { + if (ctrl.rootControl) { + rootControl = ctrl.rootControl; + break; + } + + parents.push(ctrl); + rootControl = ctrl; + ctrl = ctrl.parent(); + } + + if (!rootControl) { + rootControl = this; + } + + var i = parents.length; + while (i--) { + parents[i].rootControl = rootControl; + } + + return rootControl; + }, + + /** + * Reflows the current control and it's parents. + * This should be used after you for example append children to the current control so + * that the layout managers know that they need to reposition everything. + * + * @example + * container.append({type: 'button', text: 'My button'}).reflow(); + * + * @method reflow + * @return {tinymce.ui.Control} Current control instance. + */ + reflow: function() { + this.repaint(); + + return this; + } + + /** + * Sets/gets the parent container for the control. + * + * @method parent + * @param {tinymce.ui.Container} parent Optional parent to set. + * @return {tinymce.ui.Control} Parent control or the current control on a set action. + */ + // parent: function(parent) {} -- Generated + + /** + * Sets/gets the text for the control. + * + * @method text + * @param {String} value Value to set to control. + * @return {String/tinymce.ui.Control} Current control on a set operation or current value on a get. + */ + // text: function(value) {} -- Generated + + /** + * Sets/gets the width for the control. + * + * @method width + * @param {Number} value Value to set to control. + * @return {Number/tinymce.ui.Control} Current control on a set operation or current value on a get. + */ + // width: function(value) {} -- Generated + + /** + * Sets/gets the height for the control. + * + * @method height + * @param {Number} value Value to set to control. + * @return {Number/tinymce.ui.Control} Current control on a set operation or current value on a get. + */ + // height: function(value) {} -- Generated + + /** + * Sets/gets the disabled state on the control. + * + * @method disabled + * @param {Boolean} state Value to set to control. + * @return {Boolean/tinymce.ui.Control} Current control on a set operation or current state on a get. + */ + // disabled: function(state) {} -- Generated + + /** + * Sets/gets the active for the control. + * + * @method active + * @param {Boolean} state Value to set to control. + * @return {Boolean/tinymce.ui.Control} Current control on a set operation or current state on a get. + */ + // active: function(state) {} -- Generated + + /** + * Sets/gets the name for the control. + * + * @method name + * @param {String} value Value to set to control. + * @return {String/tinymce.ui.Control} Current control on a set operation or current value on a get. + */ + // name: function(value) {} -- Generated + + /** + * Sets/gets the title for the control. + * + * @method title + * @param {String} value Value to set to control. + * @return {String/tinymce.ui.Control} Current control on a set operation or current value on a get. + */ + // title: function(value) {} -- Generated + }); + + return Control; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/DomUtils.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/DomUtils.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,101 @@ +/** + * DOMUtils.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +define("tinymce/ui/DomUtils", [ + "tinymce/util/Tools", + "tinymce/dom/DOMUtils" +], function(Tools, DOMUtils) { + "use strict"; + + var count = 0; + + return { + id: function() { + return 'mceu_' + (count++); + }, + + createFragment: function(html) { + return DOMUtils.DOM.createFragment(html); + }, + + getWindowSize: function() { + return DOMUtils.DOM.getViewPort(); + }, + + getSize: function(elm) { + var width, height; + + if (elm.getBoundingClientRect) { + var rect = elm.getBoundingClientRect(); + + width = Math.max(rect.width || (rect.right - rect.left), elm.offsetWidth); + height = Math.max(rect.height || (rect.bottom - rect.bottom), elm.offsetHeight); + } else { + width = elm.offsetWidth; + height = elm.offsetHeight; + } + + return {width: width, height: height}; + }, + + getPos: function(elm, root) { + return DOMUtils.DOM.getPos(elm, root); + }, + + getViewPort: function(win) { + return DOMUtils.DOM.getViewPort(win); + }, + + get: function(id) { + return document.getElementById(id); + }, + + addClass: function(elm, cls) { + return DOMUtils.DOM.addClass(elm, cls); + }, + + removeClass: function(elm, cls) { + return DOMUtils.DOM.removeClass(elm, cls); + }, + + hasClass: function(elm, cls) { + return DOMUtils.DOM.hasClass(elm, cls); + }, + + toggleClass: function(elm, cls, state) { + return DOMUtils.DOM.toggleClass(elm, cls, state); + }, + + css: function(elm, name, value) { + return DOMUtils.DOM.setStyle(elm, name, value); + }, + + getRuntimeStyle: function(elm, name) { + return DOMUtils.DOM.getStyle(elm, name, true); + }, + + on: function(target, name, callback, scope) { + return DOMUtils.DOM.bind(target, name, callback, scope); + }, + + off: function(target, name, callback) { + return DOMUtils.DOM.unbind(target, name, callback); + }, + + fire: function(target, name, args) { + return DOMUtils.DOM.fire(target, name, args); + }, + + innerHtml: function(elm, html) { + // Workaround for
    in

    bug on IE 8 #6178 + DOMUtils.DOM.setHTML(elm, html); + } + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/DragHelper.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/DragHelper.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,135 @@ +/** + * DragHelper.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Drag/drop helper class. + * + * @example + * var dragHelper = new tinymce.ui.DragHelper('mydiv', { + * start: function(evt) { + * }, + * + * drag: function(evt) { + * }, + * + * end: function(evt) { + * } + * }); + * + * @class tinymce.ui.DragHelper + */ +define("tinymce/ui/DragHelper", [ + "tinymce/ui/DomUtils" +], function(DomUtils) { + "use strict"; + + function getDocumentSize() { + var doc = document, documentElement, body, scrollWidth, clientWidth; + var offsetWidth, scrollHeight, clientHeight, offsetHeight, max = Math.max; + + documentElement = doc.documentElement; + body = doc.body; + + scrollWidth = max(documentElement.scrollWidth, body.scrollWidth); + clientWidth = max(documentElement.clientWidth, body.clientWidth); + offsetWidth = max(documentElement.offsetWidth, body.offsetWidth); + + scrollHeight = max(documentElement.scrollHeight, body.scrollHeight); + clientHeight = max(documentElement.clientHeight, body.clientHeight); + offsetHeight = max(documentElement.offsetHeight, body.offsetHeight); + + return { + width: scrollWidth < offsetWidth ? clientWidth : scrollWidth, + height: scrollHeight < offsetHeight ? clientHeight : scrollHeight + }; + } + + return function(id, settings) { + var eventOverlayElm, doc = document, downButton, start, stop, drag, startX, startY; + + settings = settings || {}; + + function getHandleElm() { + return doc.getElementById(settings.handle || id); + } + + start = function(e) { + var docSize = getDocumentSize(), handleElm, cursor; + + e.preventDefault(); + downButton = e.button; + handleElm = getHandleElm(); + startX = e.screenX; + startY = e.screenY; + + // Grab cursor from handle + if (window.getComputedStyle) { + cursor = window.getComputedStyle(handleElm, null).getPropertyValue("cursor"); + } else { + cursor = handleElm.runtimeStyle.cursor; + } + + // Create event overlay and add it to document + eventOverlayElm = doc.createElement('div'); + DomUtils.css(eventOverlayElm, { + position: "absolute", + top: 0, left: 0, + width: docSize.width, + height: docSize.height, + zIndex: 0x7FFFFFFF, + opacity: 0.0001, + cursor: cursor + }); + + doc.body.appendChild(eventOverlayElm); + + // Bind mouse events + DomUtils.on(doc, 'mousemove', drag); + DomUtils.on(doc, 'mouseup', stop); + + // Begin drag + settings.start(e); + }; + + drag = function(e) { + if (e.button !== downButton) { + return stop(e); + } + + e.deltaX = e.screenX - startX; + e.deltaY = e.screenY - startY; + + e.preventDefault(); + settings.drag(e); + }; + + stop = function(e) { + DomUtils.off(doc, 'mousemove', drag); + DomUtils.off(doc, 'mouseup', stop); + + eventOverlayElm.parentNode.removeChild(eventOverlayElm); + + if (settings.stop) { + settings.stop(e); + } + }; + + /** + * Destroys the drag/drop helper instance. + * + * @method destroy + */ + this.destroy = function() { + DomUtils.off(getHandleElm()); + }; + + DomUtils.on(getHandleElm(), 'mousedown', start); + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ElementPath.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ElementPath.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,79 @@ +/** + * ElementPath.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This control creates an path for the current selections parent elements in TinyMCE. + * + * @class tinymce.ui.ElementPath + * @extends tinymce.ui.Path + */ +define("tinymce/ui/ElementPath", [ + "tinymce/ui/Path", + "tinymce/EditorManager" +], function(Path, EditorManager) { + return Path.extend({ + /** + * Post render method. Called after the control has been rendered to the target. + * + * @method postRender + * @return {tinymce.ui.ElementPath} Current combobox instance. + */ + postRender: function() { + var self = this, editor = EditorManager.activeEditor; + + function isHidden(elm) { + if (elm.nodeType === 1) { + if (elm.nodeName == "BR" || !!elm.getAttribute('data-mce-bogus')) { + return true; + } + + if (elm.getAttribute('data-mce-type') === 'bookmark') { + return true; + } + } + + return false; + } + + if (editor.settings.elementpath !== false) { + self.on('select', function(e) { + editor.focus(); + editor.selection.select(this.data()[e.index].element); + editor.nodeChanged(); + }); + + editor.on('nodeChange', function(e) { + var outParents = [], parents = e.parents, i = parents.length; + + while (i--) { + if (parents[i].nodeType == 1 && !isHidden(parents[i])) { + var args = editor.fire('ResolveName', { + name: parents[i].nodeName.toLowerCase(), + target: parents[i] + }); + + if (!args.isDefaultPrevented()) { + outParents.push({name: args.name, element: parents[i]}); + } + + if (args.isPropagationStopped()) { + break; + } + } + } + + self.data(outParents); + }); + } + + return self._super(); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Factory.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Factory.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,105 @@ +/** + * Factory.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +/** + * This class is a factory for control instances. This enables you + * to create instances of controls without having to require the UI controls directly. + * + * It also allow you to override or add new control types. + * + * @class tinymce.ui.Factory + */ +define("tinymce/ui/Factory", [], function() { + "use strict"; + + var types = {}, namespaceInit; + + return { + /** + * Adds a new control instance type to the factory. + * + * @method add + * @param {String} type Type name for example "button". + * @param {function} typeClass Class type function. + */ + add: function(type, typeClass) { + types[type.toLowerCase()] = typeClass; + }, + + /** + * Returns true/false if the specified type exists or not. + * + * @method has + * @param {String} type Type to look for. + * @return {Boolean} true/false if the control by name exists. + */ + has: function(type) { + return !!types[type.toLowerCase()]; + }, + + /** + * Creates a new control instance based on the settings provided. The instance created will be + * based on the specified type property it can also create whole structures of components out of + * the specified JSON object. + * + * @example + * tinymce.ui.Factory.create({ + * type: 'button', + * text: 'Hello world!' + * }); + * + * @method create + * @param {Object/String} settings Name/Value object with items used to create the type. + * @return {tinymce.ui.Control} Control instance based on the specified type. + */ + create: function(type, settings) { + var ControlType, name, namespace; + + // Build type lookup + if (!namespaceInit) { + namespace = tinymce.ui; + + for (name in namespace) { + types[name.toLowerCase()] = namespace[name]; + } + + namespaceInit = true; + } + + // If string is specified then use it as the type + if (typeof type == 'string') { + settings = settings || {}; + settings.type = type; + } else { + settings = type; + type = settings.type; + } + + // Find control type + type = type.toLowerCase(); + ControlType = types[type]; + + // #if debug + + if (!ControlType) { + throw new Error("Could not find control by type: " + type); + } + + // #endif + + ControlType = new ControlType(settings); + ControlType.type = type; // Set the type on the instance, this will be used by the Selector engine + + return ControlType; + } + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FieldSet.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FieldSet.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,59 @@ +/** + * FieldSet.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates fieldset containers. + * + * @-x-less FieldSet.less + * @class tinymce.ui.FieldSet + * @extends tinymce.ui.Form + */ +define("tinymce/ui/FieldSet", [ + "tinymce/ui/Form" +], function(Form) { + "use strict"; + + return Form.extend({ + Defaults: { + containerCls: 'fieldset', + layout: 'flex', + direction: 'column', + align: 'stretch', + flex: 1, + padding: "25 15 5 15", + labelGap: 30, + spacing: 10, + border: 1 + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, prefix = self.classPrefix; + + self.preRender(); + layout.preRender(self); + + return ( + '

    ' + + (self.settings.title ? ('' + + self.settings.title + '') : '') + + '
    ' + + (self.settings.html || '') + layout.renderHtml(self) + + '
    ' + + '
    ' + ); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FilePicker.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FilePicker.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,85 @@ +/** + * FilePicker.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +/** + * This class creates a file picker control. + * + * @class tinymce.ui.FilePicker + * @extends tinymce.ui.ComboBox + */ +define("tinymce/ui/FilePicker", [ + "tinymce/ui/ComboBox", + "tinymce/util/Tools" +], function(ComboBox, Tools) { + "use strict"; + + return ComboBox.extend({ + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this, editor = tinymce.activeEditor, editorSettings = editor.settings; + var actionCallback, fileBrowserCallback, fileBrowserCallbackTypes; + + settings.spellcheck = false; + + fileBrowserCallbackTypes = editorSettings.file_picker_types || editorSettings.file_browser_callback_types; + if (fileBrowserCallbackTypes) { + fileBrowserCallbackTypes = Tools.makeMap(fileBrowserCallbackTypes, /[, ]/); + } + + if (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[settings.filetype]) { + fileBrowserCallback = editorSettings.file_picker_callback; + if (fileBrowserCallback && (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[settings.filetype])) { + actionCallback = function() { + var meta = self.fire('beforecall').meta; + + meta = Tools.extend({filetype: settings.filetype}, meta); + + // file_picker_callback(callback, currentValue, metaData) + fileBrowserCallback.call( + editor, + function(value, meta) { + self.value(value).fire('change', {meta: meta}); + }, + self.value(), + meta + ); + }; + } else { + // Legacy callback: file_picker_callback(id, currentValue, filetype, window) + fileBrowserCallback = editorSettings.file_browser_callback; + if (fileBrowserCallback && (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[settings.filetype])) { + actionCallback = function() { + fileBrowserCallback( + self.getEl('inp').id, + self.value(), + settings.filetype, + window + ); + }; + } + } + } + + if (actionCallback) { + settings.icon = 'browse'; + settings.onaction = actionCallback; + } + + self._super(settings); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FitLayout.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FitLayout.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,48 @@ +/** + * FitLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This layout manager will resize the control to be the size of it's parent container. + * In other words width: 100% and height: 100%. + * + * @-x-less FitLayout.less + * @class tinymce.ui.FitLayout + * @extends tinymce.ui.AbsoluteLayout + */ +define("tinymce/ui/FitLayout", [ + "tinymce/ui/AbsoluteLayout" +], function(AbsoluteLayout) { + "use strict"; + + return AbsoluteLayout.extend({ + /** + * Recalculates the positions of the controls in the specified container. + * + * @method recalc + * @param {tinymce.ui.Container} container Container instance to recalc. + */ + recalc: function(container) { + var contLayoutRect = container.layoutRect(), paddingBox = container.paddingBox(); + + container.items().filter(':visible').each(function(ctrl) { + ctrl.layoutRect({ + x: paddingBox.left, + y: paddingBox.top, + w: contLayoutRect.innerW - paddingBox.right - paddingBox.left, + h: contLayoutRect.innerH - paddingBox.top - paddingBox.bottom + }); + + if (ctrl.recalc) { + ctrl.recalc(); + } + }); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FlexLayout.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FlexLayout.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,246 @@ +/** + * FlexLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This layout manager works similar to the CSS flex box. + * + * @setting {String} direction row|row-reverse|column|column-reverse + * @setting {Number} flex A positive-number to flex by. + * @setting {String} align start|end|center|stretch + * @setting {String} pack start|end|justify + * + * @class tinymce.ui.FlexLayout + * @extends tinymce.ui.AbsoluteLayout + */ +define("tinymce/ui/FlexLayout", [ + "tinymce/ui/AbsoluteLayout" +], function(AbsoluteLayout) { + "use strict"; + + return AbsoluteLayout.extend({ + /** + * Recalculates the positions of the controls in the specified container. + * + * @method recalc + * @param {tinymce.ui.Container} container Container instance to recalc. + */ + recalc: function(container) { + // A ton of variables, needs to be in the same scope for performance + var i, l, items, contLayoutRect, contPaddingBox, contSettings, align, pack, spacing, totalFlex, availableSpace, direction; + var ctrl, ctrlLayoutRect, ctrlSettings, flex, maxSizeItems = [], size, maxSize, ratio, rect, pos, maxAlignEndPos; + var sizeName, minSizeName, posName, maxSizeName, beforeName, innerSizeName, deltaSizeName, contentSizeName; + var alignAxisName, alignInnerSizeName, alignSizeName, alignMinSizeName, alignBeforeName, alignAfterName; + var alignDeltaSizeName, alignContentSizeName; + var max = Math.max, min = Math.min; + + // Get container items, properties and settings + items = container.items().filter(':visible'); + contLayoutRect = container.layoutRect(); + contPaddingBox = container._paddingBox; + contSettings = container.settings; + direction = container.isRtl() ? (contSettings.direction || 'row-reversed') : contSettings.direction; + align = contSettings.align; + pack = container.isRtl() ? (contSettings.pack || 'end') : contSettings.pack; + spacing = contSettings.spacing || 0; + + if (direction == "row-reversed" || direction == "column-reverse") { + items = items.set(items.toArray().reverse()); + direction = direction.split('-')[0]; + } + + // Setup axis variable name for row/column direction since the calculations is the same + if (direction == "column") { + posName = "y"; + sizeName = "h"; + minSizeName = "minH"; + maxSizeName = "maxH"; + innerSizeName = "innerH"; + beforeName = 'top'; + deltaSizeName = "deltaH"; + contentSizeName = "contentH"; + + alignBeforeName = "left"; + alignSizeName = "w"; + alignAxisName = "x"; + alignInnerSizeName = "innerW"; + alignMinSizeName = "minW"; + alignAfterName = "right"; + alignDeltaSizeName = "deltaW"; + alignContentSizeName = "contentW"; + } else { + posName = "x"; + sizeName = "w"; + minSizeName = "minW"; + maxSizeName = "maxW"; + innerSizeName = "innerW"; + beforeName = 'left'; + deltaSizeName = "deltaW"; + contentSizeName = "contentW"; + + alignBeforeName = "top"; + alignSizeName = "h"; + alignAxisName = "y"; + alignInnerSizeName = "innerH"; + alignMinSizeName = "minH"; + alignAfterName = "bottom"; + alignDeltaSizeName = "deltaH"; + alignContentSizeName = "contentH"; + } + + // Figure out total flex, availableSpace and collect any max size elements + availableSpace = contLayoutRect[innerSizeName] - contPaddingBox[beforeName] - contPaddingBox[beforeName]; + maxAlignEndPos = totalFlex = 0; + for (i = 0, l = items.length; i < l; i++) { + ctrl = items[i]; + ctrlLayoutRect = ctrl.layoutRect(); + ctrlSettings = ctrl.settings; + flex = ctrlSettings.flex; + availableSpace -= (i < l - 1 ? spacing : 0); + + if (flex > 0) { + totalFlex += flex; + + // Flexed item has a max size then we need to check if we will hit that size + if (ctrlLayoutRect[maxSizeName]) { + maxSizeItems.push(ctrl); + } + + ctrlLayoutRect.flex = flex; + } + + availableSpace -= ctrlLayoutRect[minSizeName]; + + // Calculate the align end position to be used to check for overflow/underflow + size = contPaddingBox[alignBeforeName] + ctrlLayoutRect[alignMinSizeName] + contPaddingBox[alignAfterName]; + if (size > maxAlignEndPos) { + maxAlignEndPos = size; + } + } + + // Calculate minW/minH + rect = {}; + if (availableSpace < 0) { + rect[minSizeName] = contLayoutRect[minSizeName] - availableSpace + contLayoutRect[deltaSizeName]; + } else { + rect[minSizeName] = contLayoutRect[innerSizeName] - availableSpace + contLayoutRect[deltaSizeName]; + } + + rect[alignMinSizeName] = maxAlignEndPos + contLayoutRect[alignDeltaSizeName]; + + rect[contentSizeName] = contLayoutRect[innerSizeName] - availableSpace; + rect[alignContentSizeName] = maxAlignEndPos; + rect.minW = min(rect.minW, contLayoutRect.maxW); + rect.minH = min(rect.minH, contLayoutRect.maxH); + rect.minW = max(rect.minW, contLayoutRect.startMinWidth); + rect.minH = max(rect.minH, contLayoutRect.startMinHeight); + + // Resize container container if minSize was changed + if (contLayoutRect.autoResize && (rect.minW != contLayoutRect.minW || rect.minH != contLayoutRect.minH)) { + rect.w = rect.minW; + rect.h = rect.minH; + + container.layoutRect(rect); + this.recalc(container); + + // Forced recalc for example if items are hidden/shown + if (container._lastRect === null) { + var parentCtrl = container.parent(); + if (parentCtrl) { + parentCtrl._lastRect = null; + parentCtrl.recalc(); + } + } + + return; + } + + // Handle max size elements, check if they will become to wide with current options + ratio = availableSpace / totalFlex; + for (i = 0, l = maxSizeItems.length; i < l; i++) { + ctrl = maxSizeItems[i]; + ctrlLayoutRect = ctrl.layoutRect(); + maxSize = ctrlLayoutRect[maxSizeName]; + size = ctrlLayoutRect[minSizeName] + ctrlLayoutRect.flex * ratio; + + if (size > maxSize) { + availableSpace -= (ctrlLayoutRect[maxSizeName] - ctrlLayoutRect[minSizeName]); + totalFlex -= ctrlLayoutRect.flex; + ctrlLayoutRect.flex = 0; + ctrlLayoutRect.maxFlexSize = maxSize; + } else { + ctrlLayoutRect.maxFlexSize = 0; + } + } + + // Setup new ratio, target layout rect, start position + ratio = availableSpace / totalFlex; + pos = contPaddingBox[beforeName]; + rect = {}; + + // Handle pack setting moves the start position to end, center + if (totalFlex === 0) { + if (pack == "end") { + pos = availableSpace + contPaddingBox[beforeName]; + } else if (pack == "center") { + pos = Math.round( + (contLayoutRect[innerSizeName] / 2) - ((contLayoutRect[innerSizeName] - availableSpace) / 2) + ) + contPaddingBox[beforeName]; + + if (pos < 0) { + pos = contPaddingBox[beforeName]; + } + } else if (pack == "justify") { + pos = contPaddingBox[beforeName]; + spacing = Math.floor(availableSpace / (items.length - 1)); + } + } + + // Default aligning (start) the other ones needs to be calculated while doing the layout + rect[alignAxisName] = contPaddingBox[alignBeforeName]; + + // Start laying out controls + for (i = 0, l = items.length; i < l; i++) { + ctrl = items[i]; + ctrlLayoutRect = ctrl.layoutRect(); + size = ctrlLayoutRect.maxFlexSize || ctrlLayoutRect[minSizeName]; + + // Align the control on the other axis + if (align === "center") { + rect[alignAxisName] = Math.round((contLayoutRect[alignInnerSizeName] / 2) - (ctrlLayoutRect[alignSizeName] / 2)); + } else if (align === "stretch") { + rect[alignSizeName] = max( + ctrlLayoutRect[alignMinSizeName] || 0, + contLayoutRect[alignInnerSizeName] - contPaddingBox[alignBeforeName] - contPaddingBox[alignAfterName] + ); + rect[alignAxisName] = contPaddingBox[alignBeforeName]; + } else if (align === "end") { + rect[alignAxisName] = contLayoutRect[alignInnerSizeName] - ctrlLayoutRect[alignSizeName] - contPaddingBox.top; + } + + // Calculate new size based on flex + if (ctrlLayoutRect.flex > 0) { + size += ctrlLayoutRect.flex * ratio; + } + + rect[sizeName] = size; + rect[posName] = pos; + ctrl.layoutRect(rect); + + // Recalculate containers + if (ctrl.recalc) { + ctrl.recalc(); + } + + // Move x/y position + pos += size + spacing; + } + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FloatPanel.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FloatPanel.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,400 @@ +/** + * FloatPanel.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a floating panel. + * + * @-x-less FloatPanel.less + * @class tinymce.ui.FloatPanel + * @extends tinymce.ui.Panel + * @mixes tinymce.ui.Movable + * @mixes tinymce.ui.Resizable + */ +define("tinymce/ui/FloatPanel", [ + "tinymce/ui/Panel", + "tinymce/ui/Movable", + "tinymce/ui/Resizable", + "tinymce/ui/DomUtils" +], function(Panel, Movable, Resizable, DomUtils) { + "use strict"; + + var documentClickHandler, documentScrollHandler, windowResizeHandler, visiblePanels = []; + var zOrder = [], hasModal; + + function bindDocumentClickHandler() { + function isChildOf(ctrl, parent) { + while (ctrl) { + if (ctrl == parent) { + return true; + } + + ctrl = ctrl.parent(); + } + } + + if (!documentClickHandler) { + documentClickHandler = function(e) { + // Gecko fires click event and in the wrong order on Mac so lets normalize + if (e.button == 2) { + return; + } + + // Hide any float panel when a click is out side that float panel and the + // float panels direct parent for example a click on a menu button + var i = visiblePanels.length; + while (i--) { + var panel = visiblePanels[i], clickCtrl = panel.getParentCtrl(e.target); + + if (panel.settings.autohide) { + if (clickCtrl) { + if (isChildOf(clickCtrl, panel) || panel.parent() === clickCtrl) { + continue; + } + } + + e = panel.fire('autohide', {target: e.target}); + if (!e.isDefaultPrevented()) { + panel.hide(); + } + } + } + }; + + DomUtils.on(document, 'click', documentClickHandler); + } + } + + function bindDocumentScrollHandler() { + if (!documentScrollHandler) { + documentScrollHandler = function() { + var i; + + i = visiblePanels.length; + while (i--) { + repositionPanel(visiblePanels[i]); + } + }; + + DomUtils.on(window, 'scroll', documentScrollHandler); + } + } + + function bindWindowResizeHandler() { + if (!windowResizeHandler) { + var docElm = document.documentElement, clientWidth = docElm.clientWidth, clientHeight = docElm.clientHeight; + + windowResizeHandler = function() { + // Workaround for #7065 IE 7 fires resize events event though the window wasn't resized + if (!document.all || clientWidth != docElm.clientWidth || clientHeight != docElm.clientHeight) { + clientWidth = docElm.clientWidth; + clientHeight = docElm.clientHeight; + FloatPanel.hideAll(); + } + }; + + DomUtils.on(window, 'resize', windowResizeHandler); + } + } + + /** + * Repositions the panel to the top of page if the panel is outside of the visual viewport. It will + * also reposition all child panels of the current panel. + */ + function repositionPanel(panel) { + var scrollY = DomUtils.getViewPort().y; + + function toggleFixedChildPanels(fixed, deltaY) { + var parent; + + for (var i = 0; i < visiblePanels.length; i++) { + if (visiblePanels[i] != panel) { + parent = visiblePanels[i].parent(); + + while (parent && (parent = parent.parent())) { + if (parent == panel) { + visiblePanels[i].fixed(fixed).moveBy(0, deltaY).repaint(); + } + } + } + } + } + + if (panel.settings.autofix) { + if (!panel._fixed) { + panel._autoFixY = panel.layoutRect().y; + + if (panel._autoFixY < scrollY) { + panel.fixed(true).layoutRect({y: 0}).repaint(); + toggleFixedChildPanels(true, scrollY - panel._autoFixY); + } + } else { + if (panel._autoFixY > scrollY) { + panel.fixed(false).layoutRect({y: panel._autoFixY}).repaint(); + toggleFixedChildPanels(false, panel._autoFixY - scrollY); + } + } + } + } + + function addRemove(add, ctrl) { + var i, zIndex = FloatPanel.zIndex || 0xFFFF, topModal; + + if (add) { + zOrder.push(ctrl); + } else { + i = zOrder.length; + + while (i--) { + if (zOrder[i] === ctrl) { + zOrder.splice(i, 1); + } + } + } + + if (zOrder.length) { + for (i = 0; i < zOrder.length; i++) { + if (zOrder[i].modal) { + zIndex++; + topModal = zOrder[i]; + } + + zOrder[i].getEl().style.zIndex = zIndex; + zOrder[i].zIndex = zIndex; + zIndex++; + } + } + + var modalBlockEl = document.getElementById(ctrl.classPrefix + 'modal-block'); + + if (topModal) { + DomUtils.css(modalBlockEl, 'z-index', topModal.zIndex - 1); + } else if (modalBlockEl) { + modalBlockEl.parentNode.removeChild(modalBlockEl); + hasModal = false; + } + + FloatPanel.currentZIndex = zIndex; + } + + var FloatPanel = Panel.extend({ + Mixins: [Movable, Resizable], + + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Boolean} autohide Automatically hide the panel. + */ + init: function(settings) { + var self = this; + + self._super(settings); + self._eventsRoot = self; + + self.addClass('floatpanel'); + + // Hide floatpanes on click out side the root button + if (settings.autohide) { + bindDocumentClickHandler(); + bindWindowResizeHandler(); + visiblePanels.push(self); + } + + if (settings.autofix) { + bindDocumentScrollHandler(); + + self.on('move', function() { + repositionPanel(this); + }); + } + + self.on('postrender show', function(e) { + if (e.control == self) { + var modalBlockEl, prefix = self.classPrefix; + + if (self.modal && !hasModal) { + modalBlockEl = DomUtils.createFragment('
    '); + modalBlockEl = modalBlockEl.firstChild; + + self.getContainerElm().appendChild(modalBlockEl); + + setTimeout(function() { + DomUtils.addClass(modalBlockEl, prefix + 'in'); + DomUtils.addClass(self.getEl(), prefix + 'in'); + }, 0); + + hasModal = true; + } + + addRemove(true, self); + } + }); + + self.on('show', function() { + self.parents().each(function(ctrl) { + if (ctrl._fixed) { + self.fixed(true); + return false; + } + }); + }); + + if (settings.popover) { + self._preBodyHtml = '
    '; + self.addClass('popover').addClass('bottom').addClass(self.isRtl() ? 'end' : 'start'); + } + }, + + fixed: function(state) { + var self = this; + + if (self._fixed != state) { + if (self._rendered) { + var viewport = DomUtils.getViewPort(); + + if (state) { + self.layoutRect().y -= viewport.y; + } else { + self.layoutRect().y += viewport.y; + } + } + + self.toggleClass('fixed', state); + self._fixed = state; + } + + return self; + }, + + /** + * Shows the current float panel. + * + * @method show + * @return {tinymce.ui.FloatPanel} Current floatpanel instance. + */ + show: function() { + var self = this, i, state = self._super(); + + i = visiblePanels.length; + while (i--) { + if (visiblePanels[i] === self) { + break; + } + } + + if (i === -1) { + visiblePanels.push(self); + } + + return state; + }, + + /** + * Hides the current float panel. + * + * @method hide + * @return {tinymce.ui.FloatPanel} Current floatpanel instance. + */ + hide: function() { + removeVisiblePanel(this); + addRemove(false, this); + + return this._super(); + }, + + /** + * Hide all visible float panels with he autohide setting enabled. This is for + * manually hiding floating menus or panels. + * + * @method hideAll + */ + hideAll: function() { + FloatPanel.hideAll(); + }, + + /** + * Closes the float panel. This will remove the float panel from page and fire the close event. + * + * @method close + */ + close: function() { + var self = this; + + if (!self.fire('close').isDefaultPrevented()) { + self.remove(); + addRemove(false, self); + } + + return self; + }, + + /** + * Removes the float panel from page. + * + * @method remove + */ + remove: function() { + removeVisiblePanel(this); + this._super(); + }, + + postRender: function() { + var self = this; + + if (self.settings.bodyRole) { + this.getEl('body').setAttribute('role', self.settings.bodyRole); + } + + return self._super(); + } + }); + + /** + * Hide all visible float panels with he autohide setting enabled. This is for + * manually hiding floating menus or panels. + * + * @static + * @method hideAll + */ + FloatPanel.hideAll = function() { + var i = visiblePanels.length; + + while (i--) { + var panel = visiblePanels[i]; + + if (panel && panel.settings.autohide) { + panel.hide(); + visiblePanels.splice(i, 1); + } + } + }; + + function removeVisiblePanel(panel) { + var i; + + i = visiblePanels.length; + while (i--) { + if (visiblePanels[i] === panel) { + visiblePanels.splice(i, 1); + } + } + + i = zOrder.length; + while (i--) { + if (zOrder[i] === panel) { + zOrder.splice(i, 1); + } + } + } + + return FloatPanel; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FlowLayout.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FlowLayout.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,42 @@ +/** + * FlowLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This layout manager will place the controls by using the browsers native layout. + * + * @-x-less FlowLayout.less + * @class tinymce.ui.FlowLayout + * @extends tinymce.ui.Layout + */ +define("tinymce/ui/FlowLayout", [ + "tinymce/ui/Layout" +], function(Layout) { + return Layout.extend({ + Defaults: { + containerClass: 'flow-layout', + controlClass: 'flow-layout-item', + endClass: 'break' + }, + + /** + * Recalculates the positions of the controls in the specified container. + * + * @method recalc + * @param {tinymce.ui.Container} container Container instance to recalc. + */ + recalc: function(container) { + container.items().filter(':visible').each(function(ctrl) { + if (ctrl.recalc) { + ctrl.recalc(); + } + }); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Form.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Form.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,171 @@ +/** + * Form.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a form container. A form container has the ability + * to automatically wrap items in tinymce.ui.FormItem instances. + * + * Each FormItem instance is a container for the label and the item. + * + * @example + * tinymce.ui.Factory.create({ + * type: 'form', + * items: [ + * {type: 'textbox', label: 'My text box'} + * ] + * }).renderTo(document.body); + * + * @class tinymce.ui.Form + * @extends tinymce.ui.Container + */ +define("tinymce/ui/Form", [ + "tinymce/ui/Container", + "tinymce/ui/FormItem", + "tinymce/util/Tools" +], function(Container, FormItem, Tools) { + "use strict"; + + return Container.extend({ + Defaults: { + containerCls: 'form', + layout: 'flex', + direction: 'column', + align: 'stretch', + flex: 1, + padding: 20, + labelGap: 30, + spacing: 10, + callbacks: { + submit: function() { + this.submit(); + } + } + }, + + /** + * This method gets invoked before the control is rendered. + * + * @method preRender + */ + preRender: function() { + var self = this, items = self.items(); + + if (!self.settings.formItemDefaults) { + self.settings.formItemDefaults = { + layout: 'flex', + autoResize: "overflow", + defaults: {flex: 1} + }; + } + + // Wrap any labeled items in FormItems + items.each(function(ctrl) { + var formItem, label = ctrl.settings.label; + + if (label) { + formItem = new FormItem(Tools.extend({ + items: { + type: 'label', + id: ctrl._id + '-l', + text: label, + flex: 0, + forId: ctrl._id, + disabled: ctrl.disabled() + } + }, self.settings.formItemDefaults)); + + formItem.type = 'formitem'; + ctrl.aria('labelledby', ctrl._id + '-l'); + + if (typeof ctrl.settings.flex == "undefined") { + ctrl.settings.flex = 1; + } + + self.replace(ctrl, formItem); + formItem.add(ctrl); + } + }); + }, + + /** + * Recalcs label widths. + * + * @private + */ + recalcLabels: function() { + var self = this, maxLabelWidth = 0, labels = [], i, labelGap, items; + + if (self.settings.labelGapCalc === false) { + return; + } + + if (self.settings.labelGapCalc == "children") { + items = self.find('formitem'); + } else { + items = self.items(); + } + + items.filter('formitem').each(function(item) { + var labelCtrl = item.items()[0], labelWidth = labelCtrl.getEl().clientWidth; + + maxLabelWidth = labelWidth > maxLabelWidth ? labelWidth : maxLabelWidth; + labels.push(labelCtrl); + }); + + labelGap = self.settings.labelGap || 0; + + i = labels.length; + while (i--) { + labels[i].settings.minWidth = maxLabelWidth + labelGap; + } + }, + + /** + * Getter/setter for the visibility state. + * + * @method visible + * @param {Boolean} [state] True/false state to show/hide. + * @return {tinymce.ui.Form|Boolean} True/false state or current control. + */ + visible: function(state) { + var val = this._super(state); + + if (state === true && this._rendered) { + this.recalcLabels(); + } + + return val; + }, + + /** + * Fires a submit event with the serialized form. + * + * @method submit + * @return {Object} Event arguments object. + */ + submit: function() { + return this.fire('submit', {data: this.toJSON()}); + }, + + /** + * Post render method. Called after the control has been rendered to the target. + * + * @method postRender + * @return {tinymce.ui.ComboBox} Current combobox instance. + */ + postRender: function() { + var self = this; + + self._super(); + self.recalcLabels(); + self.fromJSON(self.settings.data); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FormItem.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FormItem.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,56 @@ +/** + * FormItem.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is a container created by the form element with + * a label and control item. + * + * @class tinymce.ui.FormItem + * @extends tinymce.ui.Container + * @setting {String} label Label to display for the form item. + */ +define("tinymce/ui/FormItem", [ + "tinymce/ui/Container" +], function(Container) { + "use strict"; + + return Container.extend({ + Defaults: { + layout: 'flex', + align: 'center', + defaults: { + flex: 1 + } + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, prefix = self.classPrefix; + + self.addClass('formitem'); + layout.preRender(self); + + return ( + '
    ' + + (self.settings.title ? ('
    ' + + self.settings.title + '
    ') : '') + + '
    ' + + (self.settings.html || '') + layout.renderHtml(self) + + '
    ' + + '
    ' + ); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FormatControls.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FormatControls.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,539 @@ +/** + * FormatControls.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Internal class containing all TinyMCE specific control types such as + * format listboxes, fontlist boxes, toolbar buttons etc. + * + * @class tinymce.ui.FormatControls + */ +define("tinymce/ui/FormatControls", [ + "tinymce/ui/Control", + "tinymce/ui/Widget", + "tinymce/ui/FloatPanel", + "tinymce/util/Tools", + "tinymce/EditorManager", + "tinymce/Env" +], function(Control, Widget, FloatPanel, Tools, EditorManager, Env) { + var each = Tools.each; + + EditorManager.on('AddEditor', function(e) { + if (e.editor.rtl) { + Control.rtl = true; + } + + registerControls(e.editor); + }); + + Control.translate = function(text) { + return EditorManager.translate(text); + }; + + Widget.tooltips = !Env.iOS; + + function registerControls(editor) { + var formatMenu; + + function createListBoxChangeHandler(items, formatName) { + return function() { + var self = this; + + editor.on('nodeChange', function(e) { + var formatter = editor.formatter; + var value = null; + + each(e.parents, function(node) { + each(items, function(item) { + if (formatName) { + if (formatter.matchNode(node, formatName, {value: item.value})) { + value = item.value; + } + } else { + if (formatter.matchNode(node, item.value)) { + value = item.value; + } + } + + if (value) { + return false; + } + }); + + if (value) { + return false; + } + }); + + self.value(value); + }); + }; + } + + function createFormats(formats) { + formats = formats.replace(/;$/, '').split(';'); + + var i = formats.length; + while (i--) { + formats[i] = formats[i].split('='); + } + + return formats; + } + + function createFormatMenu() { + var count = 0, newFormats = []; + + var defaultStyleFormats = [ + {title: 'Headings', items: [ + {title: 'Heading 1', format: 'h1'}, + {title: 'Heading 2', format: 'h2'}, + {title: 'Heading 3', format: 'h3'}, + {title: 'Heading 4', format: 'h4'}, + {title: 'Heading 5', format: 'h5'}, + {title: 'Heading 6', format: 'h6'} + ]}, + + {title: 'Inline', items: [ + {title: 'Bold', icon: 'bold', format: 'bold'}, + {title: 'Italic', icon: 'italic', format: 'italic'}, + {title: 'Underline', icon: 'underline', format: 'underline'}, + {title: 'Strikethrough', icon: 'strikethrough', format: 'strikethrough'}, + {title: 'Superscript', icon: 'superscript', format: 'superscript'}, + {title: 'Subscript', icon: 'subscript', format: 'subscript'}, + {title: 'Code', icon: 'code', format: 'code'} + ]}, + + {title: 'Blocks', items: [ + {title: 'Paragraph', format: 'p'}, + {title: 'Blockquote', format: 'blockquote'}, + {title: 'Div', format: 'div'}, + {title: 'Pre', format: 'pre'} + ]}, + + {title: 'Alignment', items: [ + {title: 'Left', icon: 'alignleft', format: 'alignleft'}, + {title: 'Center', icon: 'aligncenter', format: 'aligncenter'}, + {title: 'Right', icon: 'alignright', format: 'alignright'}, + {title: 'Justify', icon: 'alignjustify', format: 'alignjustify'} + ]} + ]; + + function createMenu(formats) { + var menu = []; + + if (!formats) { + return; + } + + each(formats, function(format) { + var menuItem = { + text: format.title, + icon: format.icon + }; + + if (format.items) { + menuItem.menu = createMenu(format.items); + } else { + var formatName = format.format || "custom" + count++; + + if (!format.format) { + format.name = formatName; + newFormats.push(format); + } + + menuItem.format = formatName; + menuItem.cmd = format.cmd; + } + + menu.push(menuItem); + }); + + return menu; + } + + function createStylesMenu() { + var menu; + + if (editor.settings.style_formats_merge) { + if (editor.settings.style_formats) { + menu = createMenu(defaultStyleFormats.concat(editor.settings.style_formats)); + } else { + menu = createMenu(defaultStyleFormats); + } + } else { + menu = createMenu(editor.settings.style_formats || defaultStyleFormats); + } + + return menu; + } + + editor.on('init', function() { + each(newFormats, function(format) { + editor.formatter.register(format.name, format); + }); + }); + + return { + type: 'menu', + items: createStylesMenu(), + onPostRender: function(e) { + editor.fire('renderFormatsMenu', {control: e.control}); + }, + itemDefaults: { + preview: true, + + textStyle: function() { + if (this.settings.format) { + return editor.formatter.getCssText(this.settings.format); + } + }, + + onPostRender: function() { + var self = this; + + self.parent().on('show', function() { + var formatName, command; + + formatName = self.settings.format; + if (formatName) { + self.disabled(!editor.formatter.canApply(formatName)); + self.active(editor.formatter.match(formatName)); + } + + command = self.settings.cmd; + if (command) { + self.active(editor.queryCommandState(command)); + } + }); + }, + + onclick: function() { + if (this.settings.format) { + toggleFormat(this.settings.format); + } + + if (this.settings.cmd) { + editor.execCommand(this.settings.cmd); + } + } + } + }; + } + + formatMenu = createFormatMenu(); + + // Simple format controls : + each({ + bold: 'Bold', + italic: 'Italic', + underline: 'Underline', + strikethrough: 'Strikethrough', + subscript: 'Subscript', + superscript: 'Superscript' + }, function(text, name) { + editor.addButton(name, { + tooltip: text, + onPostRender: function() { + var self = this; + + // TODO: Fix this + if (editor.formatter) { + editor.formatter.formatChanged(name, function(state) { + self.active(state); + }); + } else { + editor.on('init', function() { + editor.formatter.formatChanged(name, function(state) { + self.active(state); + }); + }); + } + }, + onclick: function() { + toggleFormat(name); + } + }); + }); + + // Simple command controls :[,] + each({ + outdent: ['Decrease indent', 'Outdent'], + indent: ['Increase indent', 'Indent'], + cut: ['Cut', 'Cut'], + copy: ['Copy', 'Copy'], + paste: ['Paste', 'Paste'], + help: ['Help', 'mceHelp'], + selectall: ['Select all', 'SelectAll'], + removeformat: ['Clear formatting', 'RemoveFormat'], + visualaid: ['Visual aids', 'mceToggleVisualAid'], + newdocument: ['New document', 'mceNewDocument'] + }, function(item, name) { + editor.addButton(name, { + tooltip: item[0], + cmd: item[1] + }); + }); + + // Simple command controls with format state + each({ + blockquote: ['Blockquote', 'mceBlockQuote'], + numlist: ['Numbered list', 'InsertOrderedList'], + bullist: ['Bullet list', 'InsertUnorderedList'], + subscript: ['Subscript', 'Subscript'], + superscript: ['Superscript', 'Superscript'], + alignleft: ['Align left', 'JustifyLeft'], + aligncenter: ['Align center', 'JustifyCenter'], + alignright: ['Align right', 'JustifyRight'], + alignjustify: ['Justify', 'JustifyFull'] + }, function(item, name) { + editor.addButton(name, { + tooltip: item[0], + cmd: item[1], + onPostRender: function() { + var self = this; + + // TODO: Fix this + if (editor.formatter) { + editor.formatter.formatChanged(name, function(state) { + self.active(state); + }); + } else { + editor.on('init', function() { + editor.formatter.formatChanged(name, function(state) { + self.active(state); + }); + }); + } + } + }); + }); + + function toggleUndoRedoState(type) { + return function() { + var self = this; + + type = type == 'redo' ? 'hasRedo' : 'hasUndo'; + + function checkState() { + return editor.undoManager ? editor.undoManager[type]() : false; + } + + self.disabled(!checkState()); + editor.on('Undo Redo AddUndo TypingUndo ClearUndos', function() { + self.disabled(!checkState()); + }); + }; + } + + function toggleVisualAidState() { + var self = this; + + editor.on('VisualAid', function(e) { + self.active(e.hasVisual); + }); + + self.active(editor.hasVisual); + } + + editor.addButton('undo', { + tooltip: 'Undo', + onPostRender: toggleUndoRedoState('undo'), + cmd: 'undo' + }); + + editor.addButton('redo', { + tooltip: 'Redo', + onPostRender: toggleUndoRedoState('redo'), + cmd: 'redo' + }); + + editor.addMenuItem('newdocument', { + text: 'New document', + icon: 'newdocument', + cmd: 'mceNewDocument' + }); + + editor.addMenuItem('undo', { + text: 'Undo', + icon: 'undo', + shortcut: 'Meta+Z', + onPostRender: toggleUndoRedoState('undo'), + cmd: 'undo' + }); + + editor.addMenuItem('redo', { + text: 'Redo', + icon: 'redo', + shortcut: 'Meta+Y', + onPostRender: toggleUndoRedoState('redo'), + cmd: 'redo' + }); + + editor.addMenuItem('visualaid', { + text: 'Visual aids', + selectable: true, + onPostRender: toggleVisualAidState, + cmd: 'mceToggleVisualAid' + }); + + each({ + cut: ['Cut', 'Cut', 'Meta+X'], + copy: ['Copy', 'Copy', 'Meta+C'], + paste: ['Paste', 'Paste', 'Meta+V'], + selectall: ['Select all', 'SelectAll', 'Meta+A'], + bold: ['Bold', 'Bold', 'Meta+B'], + italic: ['Italic', 'Italic', 'Meta+I'], + underline: ['Underline', 'Underline'], + strikethrough: ['Strikethrough', 'Strikethrough'], + subscript: ['Subscript', 'Subscript'], + superscript: ['Superscript', 'Superscript'], + removeformat: ['Clear formatting', 'RemoveFormat'] + }, function(item, name) { + editor.addMenuItem(name, { + text: item[0], + icon: name, + shortcut: item[2], + cmd: item[1] + }); + }); + + editor.on('mousedown', function() { + FloatPanel.hideAll(); + }); + + function toggleFormat(fmt) { + if (fmt.control) { + fmt = fmt.control.value(); + } + + if (fmt) { + editor.execCommand('mceToggleFormat', false, fmt); + } + } + + editor.addButton('styleselect', { + type: 'menubutton', + text: 'Formats', + menu: formatMenu + }); + + editor.addButton('formatselect', function() { + var items = [], blocks = createFormats(editor.settings.block_formats || + 'Paragraph=p;' + + 'Heading 1=h1;' + + 'Heading 2=h2;' + + 'Heading 3=h3;' + + 'Heading 4=h4;' + + 'Heading 5=h5;' + + 'Heading 6=h6;' + + 'Preformatted=pre' + ); + + each(blocks, function(block) { + items.push({ + text: block[0], + value: block[1], + textStyle: function() { + return editor.formatter.getCssText(block[1]); + } + }); + }); + + return { + type: 'listbox', + text: blocks[0][0], + values: items, + fixedWidth: true, + onselect: toggleFormat, + onPostRender: createListBoxChangeHandler(items) + }; + }); + + editor.addButton('fontselect', function() { + var defaultFontsFormats = + 'Andale Mono=andale mono,monospace;' + + 'Arial=arial,helvetica,sans-serif;' + + 'Arial Black=arial black,sans-serif;' + + 'Book Antiqua=book antiqua,palatino,serif;' + + 'Comic Sans MS=comic sans ms,sans-serif;' + + 'Courier New=courier new,courier,monospace;' + + 'Georgia=georgia,palatino,serif;' + + 'Helvetica=helvetica,arial,sans-serif;' + + 'Impact=impact,sans-serif;' + + 'Symbol=symbol;' + + 'Tahoma=tahoma,arial,helvetica,sans-serif;' + + 'Terminal=terminal,monaco,monospace;' + + 'Times New Roman=times new roman,times,serif;' + + 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' + + 'Verdana=verdana,geneva,sans-serif;' + + 'Webdings=webdings;' + + 'Wingdings=wingdings,zapf dingbats'; + + var items = [], fonts = createFormats(editor.settings.font_formats || defaultFontsFormats); + + each(fonts, function(font) { + items.push({ + text: {raw: font[0]}, + value: font[1], + textStyle: font[1].indexOf('dings') == -1 ? 'font-family:' + font[1] : '' + }); + }); + + return { + type: 'listbox', + text: 'Font Family', + tooltip: 'Font Family', + values: items, + fixedWidth: true, + onPostRender: createListBoxChangeHandler(items, 'fontname'), + onselect: function(e) { + if (e.control.settings.value) { + editor.execCommand('FontName', false, e.control.settings.value); + } + } + }; + }); + + editor.addButton('fontsizeselect', function() { + var items = [], defaultFontsizeFormats = '8pt 10pt 12pt 14pt 18pt 24pt 36pt'; + var fontsize_formats = editor.settings.fontsize_formats || defaultFontsizeFormats; + + each(fontsize_formats.split(' '), function(item) { + var text = item, value = item; + // Allow text=value font sizes. + var values = item.split('='); + if (values.length > 1) { + text = values[0]; + value = values[1]; + } + items.push({text: text, value: value}); + }); + + return { + type: 'listbox', + text: 'Font Sizes', + tooltip: 'Font Sizes', + values: items, + fixedWidth: true, + onPostRender: createListBoxChangeHandler(items, 'fontsize'), + onclick: function(e) { + if (e.control.settings.value) { + editor.execCommand('FontSize', false, e.control.settings.value); + } + } + }; + }); + + editor.addMenuItem('formats', { + text: 'Formats', + menu: formatMenu + }); + } +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/GridLayout.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/GridLayout.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,233 @@ +/** + * GridLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This layout manager places controls in a grid. + * + * @setting {Number} spacing Spacing between controls. + * @setting {Number} spacingH Horizontal spacing between controls. + * @setting {Number} spacingV Vertical spacing between controls. + * @setting {Number} columns Number of columns to use. + * @setting {String/Array} alignH start|end|center|stretch or array of values for each column. + * @setting {String/Array} alignV start|end|center|stretch or array of values for each column. + * @setting {String} pack start|end + * + * @class tinymce.ui.GridLayout + * @extends tinymce.ui.AbsoluteLayout + */ +define("tinymce/ui/GridLayout", [ + "tinymce/ui/AbsoluteLayout" +], function(AbsoluteLayout) { + "use strict"; + + return AbsoluteLayout.extend({ + /** + * Recalculates the positions of the controls in the specified container. + * + * @method recalc + * @param {tinymce.ui.Container} container Container instance to recalc. + */ + recalc: function(container) { + var settings = container.settings, rows, cols, items, contLayoutRect, width, height, rect, + ctrlLayoutRect, ctrl, x, y, posX, posY, ctrlSettings, contPaddingBox, align, spacingH, spacingV, alignH, alignV, maxX, maxY, + colWidths = [], rowHeights = [], ctrlMinWidth, ctrlMinHeight, availableWidth, availableHeight, reverseRows, idx; + + // Get layout settings + settings = container.settings; + items = container.items().filter(':visible'); + contLayoutRect = container.layoutRect(); + cols = settings.columns || Math.ceil(Math.sqrt(items.length)); + rows = Math.ceil(items.length / cols); + spacingH = settings.spacingH || settings.spacing || 0; + spacingV = settings.spacingV || settings.spacing || 0; + alignH = settings.alignH || settings.align; + alignV = settings.alignV || settings.align; + contPaddingBox = container._paddingBox; + reverseRows = 'reverseRows' in settings ? settings.reverseRows : container.isRtl(); + + if (alignH && typeof alignH == "string") { + alignH = [alignH]; + } + + if (alignV && typeof alignV == "string") { + alignV = [alignV]; + } + + // Zero padd columnWidths + for (x = 0; x < cols; x++) { + colWidths.push(0); + } + + // Zero padd rowHeights + for (y = 0; y < rows; y++) { + rowHeights.push(0); + } + + // Calculate columnWidths and rowHeights + for (y = 0; y < rows; y++) { + for (x = 0; x < cols; x++) { + ctrl = items[y * cols + x]; + + // Out of bounds + if (!ctrl) { + break; + } + + ctrlLayoutRect = ctrl.layoutRect(); + ctrlMinWidth = ctrlLayoutRect.minW; + ctrlMinHeight = ctrlLayoutRect.minH; + + colWidths[x] = ctrlMinWidth > colWidths[x] ? ctrlMinWidth : colWidths[x]; + rowHeights[y] = ctrlMinHeight > rowHeights[y] ? ctrlMinHeight : rowHeights[y]; + } + } + + // Calculate maxX + availableWidth = contLayoutRect.innerW - contPaddingBox.left - contPaddingBox.right; + for (maxX = 0, x = 0; x < cols; x++) { + maxX += colWidths[x] + (x > 0 ? spacingH : 0); + availableWidth -= (x > 0 ? spacingH : 0) + colWidths[x]; + } + + // Calculate maxY + availableHeight = contLayoutRect.innerH - contPaddingBox.top - contPaddingBox.bottom; + for (maxY = 0, y = 0; y < rows; y++) { + maxY += rowHeights[y] + (y > 0 ? spacingV : 0); + availableHeight -= (y > 0 ? spacingV : 0) + rowHeights[y]; + } + + maxX += contPaddingBox.left + contPaddingBox.right; + maxY += contPaddingBox.top + contPaddingBox.bottom; + + // Calculate minW/minH + rect = {}; + rect.minW = maxX + (contLayoutRect.w - contLayoutRect.innerW); + rect.minH = maxY + (contLayoutRect.h - contLayoutRect.innerH); + + rect.contentW = rect.minW - contLayoutRect.deltaW; + rect.contentH = rect.minH - contLayoutRect.deltaH; + rect.minW = Math.min(rect.minW, contLayoutRect.maxW); + rect.minH = Math.min(rect.minH, contLayoutRect.maxH); + rect.minW = Math.max(rect.minW, contLayoutRect.startMinWidth); + rect.minH = Math.max(rect.minH, contLayoutRect.startMinHeight); + + // Resize container container if minSize was changed + if (contLayoutRect.autoResize && (rect.minW != contLayoutRect.minW || rect.minH != contLayoutRect.minH)) { + rect.w = rect.minW; + rect.h = rect.minH; + + container.layoutRect(rect); + this.recalc(container); + + // Forced recalc for example if items are hidden/shown + if (container._lastRect === null) { + var parentCtrl = container.parent(); + if (parentCtrl) { + parentCtrl._lastRect = null; + parentCtrl.recalc(); + } + } + + return; + } + + // Update contentW/contentH so absEnd moves correctly + if (contLayoutRect.autoResize) { + rect = container.layoutRect(rect); + rect.contentW = rect.minW - contLayoutRect.deltaW; + rect.contentH = rect.minH - contLayoutRect.deltaH; + } + + var flexV; + + if (settings.packV == 'start') { + flexV = 0; + } else { + flexV = availableHeight > 0 ? Math.floor(availableHeight / rows) : 0; + } + + // Calculate totalFlex + var totalFlex = 0; + var flexWidths = settings.flexWidths; + if (flexWidths) { + for (x = 0; x < flexWidths.length; x++) { + totalFlex += flexWidths[x]; + } + } else { + totalFlex = cols; + } + + // Calculate new column widths based on flex values + var ratio = availableWidth / totalFlex; + for (x = 0; x < cols; x++) { + colWidths[x] += flexWidths ? flexWidths[x] * ratio : ratio; + } + + // Move/resize controls + posY = contPaddingBox.top; + for (y = 0; y < rows; y++) { + posX = contPaddingBox.left; + height = rowHeights[y] + flexV; + + for (x = 0; x < cols; x++) { + if (reverseRows) { + idx = y * cols + cols - 1 - x; + } else { + idx = y * cols + x; + } + + ctrl = items[idx]; + + // No more controls to render then break + if (!ctrl) { + break; + } + + // Get control settings and calculate x, y + ctrlSettings = ctrl.settings; + ctrlLayoutRect = ctrl.layoutRect(); + width = Math.max(colWidths[x], ctrlLayoutRect.startMinWidth); + ctrlLayoutRect.x = posX; + ctrlLayoutRect.y = posY; + + // Align control horizontal + align = ctrlSettings.alignH || (alignH ? (alignH[x] || alignH[0]) : null); + if (align == "center") { + ctrlLayoutRect.x = posX + (width / 2) - (ctrlLayoutRect.w / 2); + } else if (align == "right") { + ctrlLayoutRect.x = posX + width - ctrlLayoutRect.w; + } else if (align == "stretch") { + ctrlLayoutRect.w = width; + } + + // Align control vertical + align = ctrlSettings.alignV || (alignV ? (alignV[x] || alignV[0]) : null); + if (align == "center") { + ctrlLayoutRect.y = posY + (height / 2) - (ctrlLayoutRect.h / 2); + } else if (align == "bottom") { + ctrlLayoutRect.y = posY + height - ctrlLayoutRect.h; + } else if (align == "stretch") { + ctrlLayoutRect.h = height; + } + + ctrl.layoutRect(ctrlLayoutRect); + + posX += width + spacingH; + + if (ctrl.recalc) { + ctrl.recalc(); + } + } + + posY += height + spacingV; + } + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Iframe.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Iframe.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,84 @@ +/** + * Iframe.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*jshint scripturl:true */ + +/** + * This class creates an iframe. + * + * @setting {String} url Url to open in the iframe. + * + * @-x-less Iframe.less + * @class tinymce.ui.Iframe + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Iframe", [ + "tinymce/ui/Widget" +], function(Widget) { + "use strict"; + + return Widget.extend({ + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this; + + self.addClass('iframe'); + self.canFocus = false; + + /*eslint no-script-url:0 */ + return ( + '' + ); + }, + + /** + * Setter for the iframe source. + * + * @method src + * @param {String} src Source URL for iframe. + */ + src: function(src) { + this.getEl().src = src; + }, + + /** + * Inner HTML for the iframe. + * + * @method html + * @param {String} html HTML string to set as HTML inside the iframe. + * @param {function} callback Optional callback to execute when the iframe body is filled with contents. + * @return {tinymce.ui.Iframe} Current iframe control. + */ + html: function(html, callback) { + var self = this, body = this.getEl().contentWindow.document.body; + + // Wait for iframe to initialize IE 10 takes time + if (!body) { + setTimeout(function() { + self.html(html); + }, 0); + } else { + body.innerHTML = html; + + if (callback) { + callback(); + } + } + + return this; + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/KeyboardNavigation.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/KeyboardNavigation.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,398 @@ +/** + * KeyboardNavigation.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles keyboard navigation of controls and elements. + * + * @class tinymce.ui.KeyboardNavigation + */ +define("tinymce/ui/KeyboardNavigation", [ +], function() { + "use strict"; + + /** + * This class handles all keyboard navigation for WAI-ARIA support. Each root container + * gets an instance of this class. + * + * @constructor + */ + return function(settings) { + var root = settings.root, focusedElement, focusedControl; + + try { + focusedElement = document.activeElement; + } catch (ex) { + // IE sometimes fails to return a proper element + focusedElement = document.body; + } + + focusedControl = root.getParentCtrl(focusedElement); + + /** + * Returns the currently focused elements wai aria role of the currently + * focused element or specified element. + * + * @private + * @param {Element} elm Optional element to get role from. + * @return {String} Role of specified element. + */ + function getRole(elm) { + elm = elm || focusedElement; + + return elm && elm.getAttribute('role'); + } + + /** + * Returns the wai role of the parent element of the currently + * focused element or specified element. + * + * @private + * @param {Element} elm Optional element to get parent role from. + * @return {String} Role of the first parent that has a role. + */ + function getParentRole(elm) { + var role, parent = elm || focusedElement; + + while ((parent = parent.parentNode)) { + if ((role = getRole(parent))) { + return role; + } + } + } + + /** + * Returns a wai aria property by name for example aria-selected. + * + * @private + * @param {String} name Name of the aria property to get for example "disabled". + * @return {String} Aria property value. + */ + function getAriaProp(name) { + var elm = focusedElement; + + if (elm) { + return elm.getAttribute('aria-' + name); + } + } + + /** + * Is the element a text input element or not. + * + * @private + * @param {Element} elm Element to check if it's an text input element or not. + * @return {Boolean} True/false if the element is a text element or not. + */ + function isTextInputElement(elm) { + var tagName = elm.tagName.toUpperCase(); + + // Notice: since type can be "email" etc we don't check the type + // So all input elements gets treated as text input elements + return tagName == "INPUT" || tagName == "TEXTAREA"; + } + + /** + * Returns true/false if the specified element can be focused or not. + * + * @private + * @param {Element} elm DOM element to check if it can be focused or not. + * @return {Boolean} True/false if the element can have focus. + */ + function canFocus(elm) { + if (isTextInputElement(elm) && !elm.hidden) { + return true; + } + + if (/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell)$/.test(getRole(elm))) { + return true; + } + + return false; + } + + /** + * Returns an array of focusable visible elements within the specified container element. + * + * @private + * @param {Element} elm DOM element to find focusable elements within. + * @return {Array} Array of focusable elements. + */ + function getFocusElements(elm) { + var elements = []; + + function collect(elm) { + if (elm.nodeType != 1 || elm.style.display == 'none') { + return; + } + + if (canFocus(elm)) { + elements.push(elm); + } + + for (var i = 0; i < elm.childNodes.length; i++) { + collect(elm.childNodes[i]); + } + } + + collect(elm || root.getEl()); + + return elements; + } + + /** + * Returns the navigation root control for the specified control. The navigation root + * is the control that the keyboard navigation gets scoped to for example a menubar or toolbar group. + * It will look for parents of the specified target control or the currently focused control if this option is omitted. + * + * @private + * @param {tinymce.ui.Control} targetControl Optional target control to find root of. + * @return {tinymce.ui.Control} Navigation root control. + */ + function getNavigationRoot(targetControl) { + var navigationRoot, controls; + + targetControl = targetControl || focusedControl; + controls = targetControl.parents().toArray(); + controls.unshift(targetControl); + + for (var i = 0; i < controls.length; i++) { + navigationRoot = controls[i]; + + if (navigationRoot.settings.ariaRoot) { + break; + } + } + + return navigationRoot; + } + + /** + * Focuses the first item in the specified targetControl element or the last aria index if the + * navigation root has the ariaRemember option enabled. + * + * @private + * @param {tinymce.ui.Control} targetControl Target control to focus the first item in. + */ + function focusFirst(targetControl) { + var navigationRoot = getNavigationRoot(targetControl); + var focusElements = getFocusElements(navigationRoot.getEl()); + + if (navigationRoot.settings.ariaRemember && "lastAriaIndex" in navigationRoot) { + moveFocusToIndex(navigationRoot.lastAriaIndex, focusElements); + } else { + moveFocusToIndex(0, focusElements); + } + } + + /** + * Moves the focus to the specified index within the elements list. + * This will scope the index to the size of the element list if it changed. + * + * @private + * @param {Number} idx Specified index to move to. + * @param {Array} elements Array with dom elements to move focus within. + * @return {Number} Input index or a changed index if it was out of range. + */ + function moveFocusToIndex(idx, elements) { + if (idx < 0) { + idx = elements.length - 1; + } else if (idx >= elements.length) { + idx = 0; + } + + if (elements[idx]) { + elements[idx].focus(); + } + + return idx; + } + + /** + * Moves the focus forwards or backwards. + * + * @private + * @param {Number} dir Direction to move in positive means forward, negative means backwards. + * @param {Array} elements Optional array of elements to move within defaults to the current navigation roots elements. + */ + function moveFocus(dir, elements) { + var idx = -1, navigationRoot = getNavigationRoot(); + + elements = elements || getFocusElements(navigationRoot.getEl()); + + for (var i = 0; i < elements.length; i++) { + if (elements[i] === focusedElement) { + idx = i; + } + } + + idx += dir; + navigationRoot.lastAriaIndex = moveFocusToIndex(idx, elements); + } + + /** + * Moves the focus to the left this is called by the left key. + * + * @private + */ + function left() { + var parentRole = getParentRole(); + + if (parentRole == "tablist") { + moveFocus(-1, getFocusElements(focusedElement.parentNode)); + } else if (focusedControl.parent().submenu) { + cancel(); + } else { + moveFocus(-1); + } + } + + /** + * Moves the focus to the right this is called by the right key. + * + * @private + */ + function right() { + var role = getRole(), parentRole = getParentRole(); + + if (parentRole == "tablist") { + moveFocus(1, getFocusElements(focusedElement.parentNode)); + } else if (role == "menuitem" && parentRole == "menu" && getAriaProp('haspopup')) { + enter(); + } else { + moveFocus(1); + } + } + + /** + * Moves the focus to the up this is called by the up key. + * + * @private + */ + function up() { + moveFocus(-1); + } + + /** + * Moves the focus to the up this is called by the down key. + * + * @private + */ + function down() { + var role = getRole(), parentRole = getParentRole(); + + if (role == "menuitem" && parentRole == "menubar") { + enter(); + } else if (role == "button" && getAriaProp('haspopup')) { + enter({key: 'down'}); + } else { + moveFocus(1); + } + } + + /** + * Moves the focus to the next item or previous item depending on shift key. + * + * @private + * @param {DOMEvent} e DOM event object. + */ + function tab(e) { + var parentRole = getParentRole(); + + if (parentRole == "tablist") { + var elm = getFocusElements(focusedControl.getEl('body'))[0]; + + if (elm) { + elm.focus(); + } + } else { + moveFocus(e.shiftKey ? -1 : 1); + } + } + + /** + * Calls the cancel event on the currently focused control. This is normally done using the Esc key. + * + * @private + */ + function cancel() { + focusedControl.fire('cancel'); + } + + /** + * Calls the click event on the currently focused control. This is normally done using the Enter/Space keys. + * + * @private + * @param {Object} aria Optional aria data to pass along with the enter event. + */ + function enter(aria) { + aria = aria || {}; + focusedControl.fire('click', {target: focusedElement, aria: aria}); + } + + root.on('keydown', function(e) { + function handleNonTabOrEscEvent(e, handler) { + // Ignore non tab keys for text elements + if (isTextInputElement(focusedElement)) { + return; + } + + if (handler(e) !== false) { + e.preventDefault(); + } + } + + if (e.isDefaultPrevented()) { + return; + } + + switch (e.keyCode) { + case 37: // DOM_VK_LEFT + handleNonTabOrEscEvent(e, left); + break; + + case 39: // DOM_VK_RIGHT + handleNonTabOrEscEvent(e, right); + break; + + case 38: // DOM_VK_UP + handleNonTabOrEscEvent(e, up); + break; + + case 40: // DOM_VK_DOWN + handleNonTabOrEscEvent(e, down); + break; + + case 27: // DOM_VK_ESCAPE + cancel(); + break; + + case 14: // DOM_VK_ENTER + case 13: // DOM_VK_RETURN + case 32: // DOM_VK_SPACE + handleNonTabOrEscEvent(e, enter); + break; + + case 9: // DOM_VK_TAB + if (tab(e) !== false) { + e.preventDefault(); + } + break; + } + }); + + root.on('focusin', function(e) { + focusedElement = e.target; + focusedControl = e.control; + }); + + return { + focusFirst: focusFirst + }; + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Label.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Label.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,125 @@ +/** + * Label.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a label element. A label is a simple text control + * that can be bound to other controls. + * + * @-x-less Label.less + * @class tinymce.ui.Label + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Label", [ + "tinymce/ui/Widget", + "tinymce/ui/DomUtils" +], function(Widget, DomUtils) { + "use strict"; + + return Widget.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @param {Boolean} multiline Multiline label. + */ + init: function(settings) { + var self = this; + + self._super(settings); + self.addClass('widget'); + self.addClass('label'); + self.canFocus = false; + + if (settings.multiline) { + self.addClass('autoscroll'); + } + + if (settings.strong) { + self.addClass('strong'); + } + }, + + /** + * Initializes the current controls layout rect. + * This will be executed by the layout managers to determine the + * default minWidth/minHeight etc. + * + * @method initLayoutRect + * @return {Object} Layout rect instance. + */ + initLayoutRect: function() { + var self = this, layoutRect = self._super(); + + if (self.settings.multiline) { + var size = DomUtils.getSize(self.getEl()); + + // Check if the text fits within maxW if not then try word wrapping it + if (size.width > layoutRect.maxW) { + layoutRect.minW = layoutRect.maxW; + self.addClass('multiline'); + } + + self.getEl().style.width = layoutRect.minW + 'px'; + layoutRect.startMinH = layoutRect.h = layoutRect.minH = Math.min(layoutRect.maxH, DomUtils.getSize(self.getEl()).height); + } + + return layoutRect; + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this; + + if (!self.settings.multiline) { + self.getEl().style.lineHeight = self.layoutRect().h + 'px'; + } + + return self._super(); + }, + + /** + * Sets/gets the current label text. + * + * @method text + * @param {String} [text] New label text. + * @return {String|tinymce.ui.Label} Current text or current label instance. + */ + text: function(text) { + var self = this; + + if (self._rendered && text) { + this.innerHtml(self.encode(text)); + } + + return self._super(text); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, forId = self.settings.forId; + + return ( + '' + ); + } + }); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Layout.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Layout.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,114 @@ +/** + * Layout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Base layout manager class. + * + * @class tinymce.ui.Layout + */ +define("tinymce/ui/Layout", [ + "tinymce/util/Class", + "tinymce/util/Tools" +], function(Class, Tools) { + "use strict"; + + return Class.extend({ + Defaults: { + firstControlClass: 'first', + lastControlClass: 'last' + }, + + /** + * Constructs a layout instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + this.settings = Tools.extend({}, this.Defaults, settings); + }, + + /** + * This method gets invoked before the layout renders the controls. + * + * @method preRender + * @param {tinymce.ui.Container} container Container instance to preRender. + */ + preRender: function(container) { + container.addClass(this.settings.containerClass, 'body'); + }, + + /** + * Applies layout classes to the container. + * + * @private + */ + applyClasses: function(container) { + var self = this, settings = self.settings, items, firstClass, lastClass; + + items = container.items().filter(':visible'); + firstClass = settings.firstControlClass; + lastClass = settings.lastControlClass; + + items.each(function(item) { + item.removeClass(firstClass).removeClass(lastClass); + + if (settings.controlClass) { + item.addClass(settings.controlClass); + } + }); + + items.eq(0).addClass(firstClass); + items.eq(-1).addClass(lastClass); + }, + + /** + * Renders the specified container and any layout specific HTML. + * + * @method renderHtml + * @param {tinymce.ui.Container} container Container to render HTML for. + */ + renderHtml: function(container) { + var self = this, settings = self.settings, items, html = ''; + + items = container.items(); + items.eq(0).addClass(settings.firstControlClass); + items.eq(-1).addClass(settings.lastControlClass); + + items.each(function(item) { + if (settings.controlClass) { + item.addClass(settings.controlClass); + } + + html += item.renderHtml(); + }); + + return html; + }, + + /** + * Recalculates the positions of the controls in the specified container. + * + * @method recalc + * @param {tinymce.ui.Container} container Container instance to recalc. + */ + recalc: function() { + }, + + /** + * This method gets invoked after the layout renders the controls. + * + * @method postRender + * @param {tinymce.ui.Container} container Container instance to postRender. + */ + postRender: function() { + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ListBox.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ListBox.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,143 @@ +/** + * ListBox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new list box control. + * + * @-x-less ListBox.less + * @class tinymce.ui.ListBox + * @extends tinymce.ui.MenuButton + */ +define("tinymce/ui/ListBox", [ + "tinymce/ui/MenuButton" +], function(MenuButton) { + "use strict"; + + return MenuButton.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Array} values Array with values to add to list box. + */ + init: function(settings) { + var self = this, values, selected, selectedText, lastItemCtrl; + + function setSelected(menuValues) { + // Try to find a selected value + for (var i = 0; i < menuValues.length; i++) { + selected = menuValues[i].selected || settings.value === menuValues[i].value; + + if (selected) { + selectedText = selectedText || menuValues[i].text; + self._value = menuValues[i].value; + break; + } + + // If the value has a submenu, try to find the selected values in that menu + if (menuValues[i].menu) { + setSelected(menuValues[i].menu); + } + } + } + + self._values = values = settings.values; + if (values) { + setSelected(values); + + // Default with first item + if (!selected && values.length > 0) { + selectedText = values[0].text; + self._value = values[0].value; + } + + settings.menu = values; + } + + settings.text = settings.text || selectedText || values[0].text; + + self._super(settings); + self.addClass('listbox'); + + self.on('select', function(e) { + var ctrl = e.control; + + if (lastItemCtrl) { + e.lastControl = lastItemCtrl; + } + + if (settings.multiple) { + ctrl.active(!ctrl.active()); + } else { + self.value(e.control.settings.value); + } + + lastItemCtrl = ctrl; + }); + }, + + /** + * Getter/setter function for the control value. + * + * @method value + * @param {String} [value] Value to be set. + * @return {Boolean/tinymce.ui.ListBox} Value or self if it's a set operation. + */ + value: function(value) { + var self = this, active, selectedText, menu; + + function activateByValue(menu, value) { + menu.items().each(function(ctrl) { + active = ctrl.value() === value; + + if (active) { + selectedText = selectedText || ctrl.text(); + } + + ctrl.active(active); + + if (ctrl.menu) { + activateByValue(ctrl.menu, value); + } + }); + } + + function setActiveValues(menuValues) { + for (var i = 0; i < menuValues.length; i++) { + active = menuValues[i].value == value; + + if (active) { + selectedText = selectedText || menuValues[i].text; + } + + menuValues[i].active = active; + + if (menuValues[i].menu) { + setActiveValues(menuValues[i].menu); + } + } + } + + if (typeof value != "undefined") { + if (self.menu) { + activateByValue(self.menu, value); + } else { + menu = self.settings.menu; + setActiveValues(menu); + } + + self.text(selectedText || this.settings.text); + } + + return self._super(value); + } + }); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Menu.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Menu.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,140 @@ +/** + * Menu.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new menu. + * + * @-x-less Menu.less + * @class tinymce.ui.Menu + * @extends tinymce.ui.FloatPanel + */ +define("tinymce/ui/Menu", [ + "tinymce/ui/FloatPanel", + "tinymce/ui/MenuItem", + "tinymce/util/Tools" +], function(FloatPanel, MenuItem, Tools) { + "use strict"; + + var Menu = FloatPanel.extend({ + Defaults: { + defaultType: 'menuitem', + border: 1, + layout: 'stack', + role: 'application', + bodyRole: 'menu', + ariaRoot: true + }, + + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this; + + settings.autohide = true; + settings.constrainToViewport = true; + + if (settings.itemDefaults) { + var items = settings.items, i = items.length; + + while (i--) { + items[i] = Tools.extend({}, settings.itemDefaults, items[i]); + } + } + + self._super(settings); + self.addClass('menu'); + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + this.toggleClass('menu-align', true); + + this._super(); + + this.getEl().style.height = ''; + this.getEl('body').style.height = ''; + + return this; + }, + + /** + * Hides/closes the menu. + * + * @method cancel + */ + cancel: function() { + var self = this; + + self.hideAll(); + self.fire('select'); + }, + + /** + * Hide menu and all sub menus. + * + * @method hideAll + */ + hideAll: function() { + var self = this; + + this.find('menuitem').exec('hideMenu'); + + return self._super(); + }, +/* + getContainerElm: function() { + var doc = document, id = this.classPrefix + 'menucontainer'; + + var elm = doc.getElementById(id); + if (!elm) { + elm = doc.createElement('div'); + elm.id = id; + elm.setAttribute('role', 'application'); + elm.className = this.classPrefix + '-reset'; + elm.style.position = 'absolute'; + elm.style.top = elm.style.left = '0'; + elm.style.overflow = 'visible'; + doc.body.appendChild(elm); + } + + return elm; + }, +*/ + /** + * Invoked before the menu is rendered. + * + * @method preRender + */ + preRender: function() { + var self = this; + + self.items().each(function(ctrl) { + var settings = ctrl.settings; + + if (settings.icon || settings.selectable) { + self._hasIcons = true; + return false; + } + }); + + return self._super(); + } + }); + + return Menu; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MenuBar.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MenuBar.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,33 @@ +/** + * MenuBar.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new menubar. + * + * @-x-less MenuBar.less + * @class tinymce.ui.MenuBar + * @extends tinymce.ui.Toolbar + */ +define("tinymce/ui/MenuBar", [ + "tinymce/ui/Toolbar" +], function(Toolbar) { + "use strict"; + + return Toolbar.extend({ + Defaults: { + role: 'menubar', + containerCls: 'menubar', + ariaRoot: true, + defaults: { + type: 'menubutton' + } + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MenuButton.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MenuButton.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,260 @@ +/** + * MenuButton.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new menu button. + * + * @-x-less MenuButton.less + * @class tinymce.ui.MenuButton + * @extends tinymce.ui.Button + */ +define("tinymce/ui/MenuButton", [ + "tinymce/ui/Button", + "tinymce/ui/Factory", + "tinymce/ui/MenuBar" +], function(Button, Factory, MenuBar) { + "use strict"; + + // TODO: Maybe add as some global function + function isChildOf(node, parent) { + while (node) { + if (parent === node) { + return true; + } + + node = node.parentNode; + } + + return false; + } + + var MenuButton = Button.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this; + + self._renderOpen = true; + self._super(settings); + + self.addClass('menubtn'); + + if (settings.fixedWidth) { + self.addClass('fixed-width'); + } + + self.aria('haspopup', true); + self.hasPopup = true; + }, + + /** + * Shows the menu for the button. + * + * @method showMenu + */ + showMenu: function() { + var self = this, settings = self.settings, menu; + + if (self.menu && self.menu.visible()) { + return self.hideMenu(); + } + + if (!self.menu) { + menu = settings.menu || []; + + // Is menu array then auto constuct menu control + if (menu.length) { + menu = { + type: 'menu', + items: menu + }; + } else { + menu.type = menu.type || 'menu'; + } + + self.menu = Factory.create(menu).parent(self).renderTo(); + self.fire('createmenu'); + self.menu.reflow(); + self.menu.on('cancel', function(e) { + if (e.control.parent() === self.menu) { + e.stopPropagation(); + self.focus(); + self.hideMenu(); + } + }); + + // Move focus to button when a menu item is selected/clicked + self.menu.on('select', function() { + self.focus(); + }); + + self.menu.on('show hide', function(e) { + if (e.control == self.menu) { + self.activeMenu(e.type == 'show'); + } + + self.aria('expanded', e.type == 'show'); + }).fire('show'); + } + + self.menu.show(); + self.menu.layoutRect({w: self.layoutRect().w}); + self.menu.moveRel(self.getEl(), self.isRtl() ? ['br-tr', 'tr-br'] : ['bl-tl', 'tl-bl']); + }, + + /** + * Hides the menu for the button. + * + * @method hideMenu + */ + hideMenu: function() { + var self = this; + + if (self.menu) { + self.menu.items().each(function(item) { + if (item.hideMenu) { + item.hideMenu(); + } + }); + + self.menu.hide(); + } + }, + + /** + * Sets the active menu state. + * + * @private + */ + activeMenu: function(state) { + this.toggleClass('active', state); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix; + var icon = self.settings.icon, image; + + image = self.settings.image; + if (image) { + icon = 'none'; + + // Support for [high dpi, low dpi] image sources + if (typeof image != "string") { + image = window.getSelection ? image[0] : image[1]; + } + + image = ' style="background-image: url(\'' + image + '\')"'; + } else { + image = ''; + } + + icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : ''; + + self.aria('role', self.parent() instanceof MenuBar ? 'menuitem' : 'button'); + + return ( + '
    ' + + '' + + '
    ' + ); + }, + + /** + * Gets invoked after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self.on('click', function(e) { + if (e.control === self && isChildOf(e.target, self.getEl())) { + self.showMenu(); + + if (e.aria) { + self.menu.items()[0].focus(); + } + } + }); + + self.on('mouseenter', function(e) { + var overCtrl = e.control, parent = self.parent(), hasVisibleSiblingMenu; + + if (overCtrl && parent && overCtrl instanceof MenuButton && overCtrl.parent() == parent) { + parent.items().filter('MenuButton').each(function(ctrl) { + if (ctrl.hideMenu && ctrl != overCtrl) { + if (ctrl.menu && ctrl.menu.visible()) { + hasVisibleSiblingMenu = true; + } + + ctrl.hideMenu(); + } + }); + + if (hasVisibleSiblingMenu) { + overCtrl.focus(); // Fix for: #5887 + overCtrl.showMenu(); + } + } + }); + + return self._super(); + }, + + /** + * Sets/gets the current button text. + * + * @method text + * @param {String} [text] New button text. + * @return {String|tinymce.ui.MenuButton} Current text or current MenuButton instance. + */ + text: function(text) { + var self = this, i, children; + + if (self._rendered) { + children = self.getEl('open').getElementsByTagName('span'); + for (i = 0; i < children.length; i++) { + children[i].innerHTML = (self.settings.icon && text ? '\u00a0' : '') + self.encode(text); + } + } + + return this._super(text); + }, + + /** + * Removes the control and it's menus. + * + * @method remove + */ + remove: function() { + this._super(); + + if (this.menu) { + this.menu.remove(); + } + } + }); + + return MenuButton; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MenuItem.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MenuItem.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,322 @@ +/** + * MenuItem.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new menu item. + * + * @-x-less MenuItem.less + * @class tinymce.ui.MenuItem + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/MenuItem", [ + "tinymce/ui/Widget", + "tinymce/ui/Factory", + "tinymce/Env" +], function(Widget, Factory, Env) { + "use strict"; + + return Widget.extend({ + Defaults: { + border: 0, + role: 'menuitem' + }, + + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Boolean} selectable Selectable menu. + * @setting {Array} menu Submenu array with items. + * @setting {String} shortcut Shortcut to display for menu item. Example: Ctrl+X + */ + init: function(settings) { + var self = this; + + self.hasPopup = true; + + self._super(settings); + + settings = self.settings; + + self.addClass('menu-item'); + + if (settings.menu) { + self.addClass('menu-item-expand'); + } + + if (settings.preview) { + self.addClass('menu-item-preview'); + } + + if (self._text === '-' || self._text === '|') { + self.addClass('menu-item-sep'); + self.aria('role', 'separator'); + self._text = '-'; + } + + if (settings.selectable) { + self.aria('role', 'menuitemcheckbox'); + self.addClass('menu-item-checkbox'); + settings.icon = 'selected'; + } + + if (!settings.preview && !settings.selectable) { + self.addClass('menu-item-normal'); + } + + self.on('mousedown', function(e) { + e.preventDefault(); + }); + + if (settings.menu && !settings.ariaHideMenu) { + self.aria('haspopup', true); + } + }, + + /** + * Returns true/false if the menuitem has sub menu. + * + * @method hasMenus + * @return {Boolean} True/false state if it has submenu. + */ + hasMenus: function() { + return !!this.settings.menu; + }, + + /** + * Shows the menu for the menu item. + * + * @method showMenu + */ + showMenu: function() { + var self = this, settings = self.settings, menu, parent = self.parent(); + + parent.items().each(function(ctrl) { + if (ctrl !== self) { + ctrl.hideMenu(); + } + }); + + if (settings.menu) { + menu = self.menu; + + if (!menu) { + menu = settings.menu; + + // Is menu array then auto constuct menu control + if (menu.length) { + menu = { + type: 'menu', + items: menu + }; + } else { + menu.type = menu.type || 'menu'; + } + + if (parent.settings.itemDefaults) { + menu.itemDefaults = parent.settings.itemDefaults; + } + + menu = self.menu = Factory.create(menu).parent(self).renderTo(); + menu.reflow(); + menu.on('cancel', function(e) { + e.stopPropagation(); + self.focus(); + menu.hide(); + }); + menu.on('show hide', function(e) { + e.control.items().each(function(ctrl) { + ctrl.active(ctrl.settings.selected); + }); + }).fire('show'); + + menu.on('hide', function(e) { + if (e.control === menu) { + self.removeClass('selected'); + } + }); + + menu.submenu = true; + } else { + menu.show(); + } + + menu._parentMenu = parent; + + menu.addClass('menu-sub'); + + var rel = menu.testMoveRel( + self.getEl(), + self.isRtl() ? ['tl-tr', 'bl-br', 'tr-tl', 'br-bl'] : ['tr-tl', 'br-bl', 'tl-tr', 'bl-br'] + ); + + menu.moveRel(self.getEl(), rel); + menu.rel = rel; + + rel = 'menu-sub-' + rel; + menu.removeClass(menu._lastRel); + menu.addClass(rel); + menu._lastRel = rel; + + self.addClass('selected'); + self.aria('expanded', true); + } + }, + + /** + * Hides the menu for the menu item. + * + * @method hideMenu + */ + hideMenu: function() { + var self = this; + + if (self.menu) { + self.menu.items().each(function(item) { + if (item.hideMenu) { + item.hideMenu(); + } + }); + + self.menu.hide(); + self.aria('expanded', false); + } + + return self; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, settings = self.settings, prefix = self.classPrefix, text = self.encode(self._text); + var icon = self.settings.icon, image = '', shortcut = settings.shortcut; + + // Converts shortcut format to Mac/PC variants + function convertShortcut(shortcut) { + var i, value, replace = {}; + + if (Env.mac) { + replace = { + alt: '⌥', + ctrl: '⌘', + shift: '⇧', + meta: '⌘' + }; + } else { + replace = { + meta: 'Ctrl' + }; + } + + shortcut = shortcut.split('+'); + + for (i = 0; i < shortcut.length; i++) { + value = replace[shortcut[i].toLowerCase()]; + + if (value) { + shortcut[i] = value; + } + } + + return shortcut.join('+'); + } + + if (icon) { + self.parent().addClass('menu-has-icons'); + } + + if (settings.image) { + icon = 'none'; + image = ' style="background-image: url(\'' + settings.image + '\')"'; + } + + if (shortcut) { + shortcut = convertShortcut(shortcut); + } + + icon = prefix + 'ico ' + prefix + 'i-' + (self.settings.icon || 'none'); + + return ( + '
    ' + + (text !== '-' ? '\u00a0' : '') + + (text !== '-' ? '' + text + '' : '') + + (shortcut ? '
    ' + shortcut + '
    ' : '') + + (settings.menu ? '
    ' : '') + + '
    ' + ); + }, + + /** + * Gets invoked after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this, settings = self.settings; + + var textStyle = settings.textStyle; + if (typeof textStyle == "function") { + textStyle = textStyle.call(this); + } + + if (textStyle) { + var textElm = self.getEl('text'); + if (textElm) { + textElm.setAttribute('style', textStyle); + } + } + + self.on('mouseenter click', function(e) { + if (e.control === self) { + if (!settings.menu && e.type === 'click') { + self.fire('select'); + self.parent().hideAll(); + } else { + self.showMenu(); + + if (e.aria) { + self.menu.focus(true); + } + } + } + }); + + self._super(); + + return self; + }, + + active: function(state) { + if (typeof state != "undefined") { + this.aria('checked', state); + } + + return this._super(state); + }, + + /** + * Removes the control and it's menus. + * + * @method remove + */ + remove: function() { + this._super(); + + if (this.menu) { + this.menu.remove(); + } + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MessageBox.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/MessageBox.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,202 @@ +/** + * MessageBox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to create MessageBoxes like alerts/confirms etc. + * + * @class tinymce.ui.MessageBox + * @extends tinymce.ui.Window + */ +define("tinymce/ui/MessageBox", [ + "tinymce/ui/Window" +], function(Window) { + "use strict"; + + var MessageBox = Window.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + settings = { + border: 1, + padding: 20, + layout: 'flex', + pack: "center", + align: "center", + containerCls: 'panel', + autoScroll: true, + buttons: {type: "button", text: "Ok", action: "ok"}, + items: { + type: "label", + multiline: true, + maxWidth: 500, + maxHeight: 200 + } + }; + + this._super(settings); + }, + + Statics: { + /** + * Ok buttons constant. + * + * @static + * @final + * @field {Number} OK + */ + OK: 1, + + /** + * Ok/cancel buttons constant. + * + * @static + * @final + * @field {Number} OK_CANCEL + */ + OK_CANCEL: 2, + + /** + * yes/no buttons constant. + * + * @static + * @final + * @field {Number} YES_NO + */ + YES_NO: 3, + + /** + * yes/no/cancel buttons constant. + * + * @static + * @final + * @field {Number} YES_NO_CANCEL + */ + YES_NO_CANCEL: 4, + + /** + * Constructs a new message box and renders it to the body element. + * + * @static + * @method msgBox + * @param {Object} settings Name/value object with settings. + */ + msgBox: function(settings) { + var buttons, callback = settings.callback || function() {}; + + function createButton(text, status, primary) { + return { + type: "button", + text: text, + subtype: primary ? 'primary' : '', + onClick: function(e) { + e.control.parents()[1].close(); + callback(status); + } + }; + } + + switch (settings.buttons) { + case MessageBox.OK_CANCEL: + buttons = [ + createButton('Ok', true, true), + createButton('Cancel', false) + ]; + break; + + case MessageBox.YES_NO: + case MessageBox.YES_NO_CANCEL: + buttons = [ + createButton('Yes', 1, true), + createButton('No', 0) + ]; + + if (settings.buttons == MessageBox.YES_NO_CANCEL) { + buttons.push(createButton('Cancel', -1)); + } + break; + + default: + buttons = [ + createButton('Ok', true, true) + ]; + break; + } + + return new Window({ + padding: 20, + x: settings.x, + y: settings.y, + minWidth: 300, + minHeight: 100, + layout: "flex", + pack: "center", + align: "center", + buttons: buttons, + title: settings.title, + role: 'alertdialog', + items: { + type: "label", + multiline: true, + maxWidth: 500, + maxHeight: 200, + text: settings.text + }, + onPostRender: function() { + this.aria('describedby', this.items()[0]._id); + }, + onClose: settings.onClose, + onCancel: function() { + callback(false); + } + }).renderTo(document.body).reflow(); + }, + + /** + * Creates a new alert dialog. + * + * @method alert + * @param {Object} settings Settings for the alert dialog. + * @param {function} [callback] Callback to execute when the user makes a choice. + */ + alert: function(settings, callback) { + if (typeof settings == "string") { + settings = {text: settings}; + } + + settings.callback = callback; + return MessageBox.msgBox(settings); + }, + + /** + * Creates a new confirm dialog. + * + * @method confirm + * @param {Object} settings Settings for the confirm dialog. + * @param {function} [callback] Callback to execute when the user makes a choice. + */ + confirm: function(settings, callback) { + if (typeof settings == "string") { + settings = {text: settings}; + } + + settings.callback = callback; + settings.buttons = MessageBox.OK_CANCEL; + + return MessageBox.msgBox(settings); + } + } + }); + + return MessageBox; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Movable.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Movable.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,200 @@ +/** + * Movable.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Movable mixin. Makes controls movable absolute and relative to other elements. + * + * @mixin tinymce.ui.Movable + */ +define("tinymce/ui/Movable", [ + "tinymce/ui/DomUtils" +], function(DomUtils) { + "use strict"; + + function calculateRelativePosition(ctrl, targetElm, rel) { + var ctrlElm, pos, x, y, selfW, selfH, targetW, targetH, viewport, size; + + viewport = DomUtils.getViewPort(); + + // Get pos of target + pos = DomUtils.getPos(targetElm); + x = pos.x; + y = pos.y; + + if (ctrl._fixed && DomUtils.getRuntimeStyle(document.body, 'position') == 'static') { + x -= viewport.x; + y -= viewport.y; + } + + // Get size of self + ctrlElm = ctrl.getEl(); + size = DomUtils.getSize(ctrlElm); + selfW = size.width; + selfH = size.height; + + // Get size of target + size = DomUtils.getSize(targetElm); + targetW = size.width; + targetH = size.height; + + // Parse align string + rel = (rel || '').split(''); + + // Target corners + if (rel[0] === 'b') { + y += targetH; + } + + if (rel[1] === 'r') { + x += targetW; + } + + if (rel[0] === 'c') { + y += Math.round(targetH / 2); + } + + if (rel[1] === 'c') { + x += Math.round(targetW / 2); + } + + // Self corners + if (rel[3] === 'b') { + y -= selfH; + } + + if (rel[4] === 'r') { + x -= selfW; + } + + if (rel[3] === 'c') { + y -= Math.round(selfH / 2); + } + + if (rel[4] === 'c') { + x -= Math.round(selfW / 2); + } + + return { + x: x, + y: y, + w: selfW, + h: selfH + }; + } + + return { + /** + * Tests various positions to get the most suitable one. + * + * @method testMoveRel + * @param {DOMElement} elm Element to position against. + * @param {Array} rels Array with relative positions. + * @return {String} Best suitable relative position. + */ + testMoveRel: function(elm, rels) { + var viewPortRect = DomUtils.getViewPort(); + + for (var i = 0; i < rels.length; i++) { + var pos = calculateRelativePosition(this, elm, rels[i]); + + if (this._fixed) { + if (pos.x > 0 && pos.x + pos.w < viewPortRect.w && pos.y > 0 && pos.y + pos.h < viewPortRect.h) { + return rels[i]; + } + } else { + if (pos.x > viewPortRect.x && pos.x + pos.w < viewPortRect.w + viewPortRect.x && + pos.y > viewPortRect.y && pos.y + pos.h < viewPortRect.h + viewPortRect.y) { + return rels[i]; + } + } + } + + return rels[0]; + }, + + /** + * Move relative to the specified element. + * + * @method moveRel + * @param {Element} elm Element to move relative to. + * @param {String} rel Relative mode. For example: br-tl. + * @return {tinymce.ui.Control} Current control instance. + */ + moveRel: function(elm, rel) { + if (typeof rel != 'string') { + rel = this.testMoveRel(elm, rel); + } + + var pos = calculateRelativePosition(this, elm, rel); + return this.moveTo(pos.x, pos.y); + }, + + /** + * Move by a relative x, y values. + * + * @method moveBy + * @param {Number} dx Relative x position. + * @param {Number} dy Relative y position. + * @return {tinymce.ui.Control} Current control instance. + */ + moveBy: function(dx, dy) { + var self = this, rect = self.layoutRect(); + + self.moveTo(rect.x + dx, rect.y + dy); + + return self; + }, + + /** + * Move to absolute position. + * + * @method moveTo + * @param {Number} x Absolute x position. + * @param {Number} y Absolute y position. + * @return {tinymce.ui.Control} Current control instance. + */ + moveTo: function(x, y) { + var self = this; + + // TODO: Move this to some global class + function contrain(value, max, size) { + if (value < 0) { + return 0; + } + + if (value + size > max) { + value = max - size; + return value < 0 ? 0 : value; + } + + return value; + } + + if (self.settings.constrainToViewport) { + var viewPortRect = DomUtils.getViewPort(window); + var layoutRect = self.layoutRect(); + + x = contrain(x, viewPortRect.w + viewPortRect.x, layoutRect.w); + y = contrain(y, viewPortRect.h + viewPortRect.y, layoutRect.h); + } + + if (self._rendered) { + self.layoutRect({x: x, y: y}).repaint(); + } else { + self.settings.x = x; + self.settings.y = y; + } + + self.fire('move', {x: x, y: y}); + + return self; + } + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Panel.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Panel.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,67 @@ +/** + * Panel.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new panel. + * + * @-x-less Panel.less + * @class tinymce.ui.Panel + * @extends tinymce.ui.Container + * @mixes tinymce.ui.Scrollable + */ +define("tinymce/ui/Panel", [ + "tinymce/ui/Container", + "tinymce/ui/Scrollable" +], function(Container, Scrollable) { + "use strict"; + + return Container.extend({ + Defaults: { + layout: 'fit', + containerCls: 'panel' + }, + + Mixins: [Scrollable], + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, innerHtml = self.settings.html; + + self.preRender(); + layout.preRender(self); + + if (typeof innerHtml == "undefined") { + innerHtml = ( + '
    ' + + layout.renderHtml(self) + + '
    ' + ); + } else { + if (typeof innerHtml == 'function') { + innerHtml = innerHtml.call(self); + } + + self._hasBody = false; + } + + return ( + '
    ' + + (self._preBodyHtml || '') + + innerHtml + + '
    ' + ); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/PanelButton.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/PanelButton.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,114 @@ +/** + * PanelButton.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new panel button. + * + * @class tinymce.ui.PanelButton + * @extends tinymce.ui.Button + */ +define("tinymce/ui/PanelButton", [ + "tinymce/ui/Button", + "tinymce/ui/FloatPanel" +], function(Button, FloatPanel) { + "use strict"; + + return Button.extend({ + /** + * Shows the panel for the button. + * + * @method showPanel + */ + showPanel: function() { + var self = this, settings = self.settings; + + self.active(true); + + if (!self.panel) { + var panelSettings = settings.panel; + + // Wrap panel in grid layout if type if specified + // This makes it possible to add forms or other containers directly in the panel option + if (panelSettings.type) { + panelSettings = { + layout: 'grid', + items: panelSettings + }; + } + + panelSettings.role = panelSettings.role || 'dialog'; + panelSettings.popover = true; + panelSettings.autohide = true; + panelSettings.ariaRoot = true; + + self.panel = new FloatPanel(panelSettings).on('hide', function() { + self.active(false); + }).on('cancel', function(e) { + e.stopPropagation(); + self.focus(); + self.hidePanel(); + }).parent(self).renderTo(self.getContainerElm()); + + self.panel.fire('show'); + self.panel.reflow(); + } else { + self.panel.show(); + } + + self.panel.moveRel(self.getEl(), settings.popoverAlign || (self.isRtl() ? ['bc-tr', 'bc-tc'] : ['bc-tl', 'bc-tc'])); + }, + + /** + * Hides the panel for the button. + * + * @method hidePanel + */ + hidePanel: function() { + var self = this; + + if (self.panel) { + self.panel.hide(); + } + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self.aria('haspopup', true); + + self.on('click', function(e) { + if (e.control === self) { + if (self.panel && self.panel.visible()) { + self.hidePanel(); + } else { + self.showPanel(); + self.panel.focus(!!e.aria); + } + } + }); + + return self._super(); + }, + + remove: function() { + if (this.panel) { + this.panel.remove(); + this.panel = null; + } + + return this._super(); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Path.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Path.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,140 @@ +/** + * Path.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new path control. + * + * @-x-less Path.less + * @class tinymce.ui.Path + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Path", [ + "tinymce/ui/Widget" +], function(Widget) { + "use strict"; + + return Widget.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {String} delimiter Delimiter to display between items in path. + */ + init: function(settings) { + var self = this; + + if (!settings.delimiter) { + settings.delimiter = '\u00BB'; + } + + self._super(settings); + self.addClass('path'); + self.canFocus = true; + + self.on('click', function(e) { + var index, target = e.target; + + if ((index = target.getAttribute('data-index'))) { + self.fire('select', {value: self.data()[index], index: index}); + } + }); + }, + + /** + * Focuses the current control. + * + * @method focus + * @return {tinymce.ui.Control} Current control instance. + */ + focus: function() { + var self = this; + + self.getEl().firstChild.focus(); + + return self; + }, + + /** + * Sets/gets the data to be used for the path. + * + * @method data + * @param {Array} data Array with items name is rendered to path. + */ + data: function(data) { + var self = this; + + if (typeof data !== "undefined") { + self._data = data; + self.update(); + + return self; + } + + return self._data; + }, + + /** + * Updated the path. + * + * @private + */ + update: function() { + this.innerHtml(this._getPathHtml()); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self._super(); + + self.data(self.settings.data); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this; + + return ( + '
    ' + + self._getPathHtml() + + '
    ' + ); + }, + + _getPathHtml: function() { + var self = this, parts = self._data || [], i, l, html = '', prefix = self.classPrefix; + + for (i = 0, l = parts.length; i < l; i++) { + html += ( + (i > 0 ? '' : '') + + '
    ' + parts[i].name + '
    ' + ); + } + + if (!html) { + html = '
    \u00a0
    '; + } + + return html; + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Radio.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Radio.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,29 @@ +/** + * Radio.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new radio button. + * + * @-x-less Radio.less + * @class tinymce.ui.Radio + * @extends tinymce.ui.Checkbox + */ +define("tinymce/ui/Radio", [ + "tinymce/ui/Checkbox" +], function(Checkbox) { + "use strict"; + + return Checkbox.extend({ + Defaults: { + classes: "radio", + role: "radio" + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Resizable.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Resizable.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,68 @@ +/** + * Resizable.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Resizable mixin. Enables controls to be resized. + * + * @mixin tinymce.ui.Resizable + */ +define("tinymce/ui/Resizable", [ + "tinymce/ui/DomUtils" +], function(DomUtils) { + "use strict"; + + return { + /** + * Resizes the control to contents. + * + * @method resizeToContent + */ + resizeToContent: function() { + this._layoutRect.autoResize = true; + this._lastRect = null; + this.reflow(); + }, + + /** + * Resizes the control to a specific width/height. + * + * @method resizeTo + * @param {Number} w Control width. + * @param {Number} h Control height. + * @return {tinymce.ui.Control} Current control instance. + */ + resizeTo: function(w, h) { + // TODO: Fix hack + if (w <= 1 || h <= 1) { + var rect = DomUtils.getWindowSize(); + + w = w <= 1 ? w * rect.w : w; + h = h <= 1 ? h * rect.h : h; + } + + this._layoutRect.autoResize = false; + return this.layoutRect({minW: w, minH: h, w: w, h: h}).reflow(); + }, + + /** + * Resizes the control to a specific relative width/height. + * + * @method resizeBy + * @param {Number} dw Relative control width. + * @param {Number} dh Relative control height. + * @return {tinymce.ui.Control} Current control instance. + */ + resizeBy: function(dw, dh) { + var self = this, rect = self.layoutRect(); + + return self.resizeTo(rect.w + dw, rect.h + dh); + } + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ResizeHandle.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/ResizeHandle.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,86 @@ +/** + * ResizeHandle.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Renders a resize handle that fires ResizeStart, Resize and ResizeEnd events. + * + * @-x-less ResizeHandle.less + * @class tinymce.ui.ResizeHandle + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/ResizeHandle", [ + "tinymce/ui/Widget", + "tinymce/ui/DragHelper" +], function(Widget, DragHelper) { + "use strict"; + + return Widget.extend({ + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, prefix = self.classPrefix; + + self.addClass('resizehandle'); + + if (self.settings.direction == "both") { + self.addClass('resizehandle-both'); + } + + self.canFocus = false; + + return ( + '
    ' + + '' + + '
    ' + ); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self._super(); + + self.resizeDragHelper = new DragHelper(this._id, { + start: function() { + self.fire('ResizeStart'); + }, + + drag: function(e) { + if (self.settings.direction != "both") { + e.deltaX = 0; + } + + self.fire('Resize', e); + }, + + stop: function() { + self.fire('ResizeEnd'); + } + }); + }, + + remove: function() { + if (this.resizeDragHelper) { + this.resizeDragHelper.destroy(); + } + + return this._super(); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Scrollable.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Scrollable.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,149 @@ +/** + * Scrollable.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This mixin makes controls scrollable using custom scrollbars. + * + * @-x-less Scrollable.less + * @mixin tinymce.ui.Scrollable + */ +define("tinymce/ui/Scrollable", [ + "tinymce/ui/DomUtils", + "tinymce/ui/DragHelper" +], function(DomUtils, DragHelper) { + "use strict"; + + return { + init: function() { + var self = this; + self.on('repaint', self.renderScroll); + }, + + renderScroll: function() { + var self = this, margin = 2; + + function repaintScroll() { + var hasScrollH, hasScrollV, bodyElm; + + function repaintAxis(axisName, posName, sizeName, contentSizeName, hasScroll, ax) { + var containerElm, scrollBarElm, scrollThumbElm; + var containerSize, scrollSize, ratio, rect; + var posNameLower, sizeNameLower; + + scrollBarElm = self.getEl('scroll' + axisName); + if (scrollBarElm) { + posNameLower = posName.toLowerCase(); + sizeNameLower = sizeName.toLowerCase(); + + if (self.getEl('absend')) { + DomUtils.css(self.getEl('absend'), posNameLower, self.layoutRect()[contentSizeName] - 1); + } + + if (!hasScroll) { + DomUtils.css(scrollBarElm, 'display', 'none'); + return; + } + + DomUtils.css(scrollBarElm, 'display', 'block'); + containerElm = self.getEl('body'); + scrollThumbElm = self.getEl('scroll' + axisName + "t"); + containerSize = containerElm["client" + sizeName] - (margin * 2); + containerSize -= hasScrollH && hasScrollV ? scrollBarElm["client" + ax] : 0; + scrollSize = containerElm["scroll" + sizeName]; + ratio = containerSize / scrollSize; + + rect = {}; + rect[posNameLower] = containerElm["offset" + posName] + margin; + rect[sizeNameLower] = containerSize; + DomUtils.css(scrollBarElm, rect); + + rect = {}; + rect[posNameLower] = containerElm["scroll" + posName] * ratio; + rect[sizeNameLower] = containerSize * ratio; + DomUtils.css(scrollThumbElm, rect); + } + } + + bodyElm = self.getEl('body'); + hasScrollH = bodyElm.scrollWidth > bodyElm.clientWidth; + hasScrollV = bodyElm.scrollHeight > bodyElm.clientHeight; + + repaintAxis("h", "Left", "Width", "contentW", hasScrollH, "Height"); + repaintAxis("v", "Top", "Height", "contentH", hasScrollV, "Width"); + } + + function addScroll() { + function addScrollAxis(axisName, posName, sizeName, deltaPosName, ax) { + var scrollStart, axisId = self._id + '-scroll' + axisName, prefix = self.classPrefix; + + self.getEl().appendChild(DomUtils.createFragment( + '
    ' + + '
    ' + + '
    ' + )); + + self.draghelper = new DragHelper(axisId + 't', { + start: function() { + scrollStart = self.getEl('body')["scroll" + posName]; + DomUtils.addClass(DomUtils.get(axisId), prefix + 'active'); + }, + + drag: function(e) { + var ratio, hasScrollH, hasScrollV, containerSize, layoutRect = self.layoutRect(); + + hasScrollH = layoutRect.contentW > layoutRect.innerW; + hasScrollV = layoutRect.contentH > layoutRect.innerH; + containerSize = self.getEl('body')["client" + sizeName] - (margin * 2); + containerSize -= hasScrollH && hasScrollV ? self.getEl('scroll' + axisName)["client" + ax] : 0; + + ratio = containerSize / self.getEl('body')["scroll" + sizeName]; + self.getEl('body')["scroll" + posName] = scrollStart + (e["delta" + deltaPosName] / ratio); + }, + + stop: function() { + DomUtils.removeClass(DomUtils.get(axisId), prefix + 'active'); + } + }); +/* + self.on('click', function(e) { + if (e.target.id == self._id + '-scrollv') { + + } + });*/ + } + + self.addClass('scroll'); + + addScrollAxis("v", "Top", "Height", "Y", "Width"); + addScrollAxis("h", "Left", "Width", "X", "Height"); + } + + if (self.settings.autoScroll) { + if (!self._hasScroll) { + self._hasScroll = true; + addScroll(); + + self.on('wheel', function(e) { + var bodyEl = self.getEl('body'); + + bodyEl.scrollLeft += (e.deltaX || 0) * 10; + bodyEl.scrollTop += e.deltaY * 10; + + repaintScroll(); + }); + + DomUtils.on(self.getEl('body'), "scroll", repaintScroll); + } + + repaintScroll(); + } + } + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Selector.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Selector.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,369 @@ +/** + * Selector.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*eslint no-nested-ternary:0 */ + +/** + * Selector engine, enables you to select controls by using CSS like expressions. + * We currently only support basic CSS expressions to reduce the size of the core + * and the ones we support should be enough for most cases. + * + * @example + * Supported expressions: + * element + * element#name + * element.class + * element[attr] + * element[attr*=value] + * element[attr~=value] + * element[attr!=value] + * element[attr^=value] + * element[attr$=value] + * element: + * element:not() + * element:first + * element:last + * element:odd + * element:even + * element element + * element > element + * + * @class tinymce.ui.Selector + */ +define("tinymce/ui/Selector", [ + "tinymce/util/Class" +], function(Class) { + "use strict"; + + /** + * Produces an array with a unique set of objects. It will not compare the values + * but the references of the objects. + * + * @private + * @method unqiue + * @param {Array} array Array to make into an array with unique items. + * @return {Array} Array with unique items. + */ + function unique(array) { + var uniqueItems = [], i = array.length, item; + + while (i--) { + item = array[i]; + + if (!item.__checked) { + uniqueItems.push(item); + item.__checked = 1; + } + } + + i = uniqueItems.length; + while (i--) { + delete uniqueItems[i].__checked; + } + + return uniqueItems; + } + + var expression = /^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i; + + /*jshint maxlen:255 */ + /*eslint max-len:0 */ + var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, + whiteSpace = /^\s*|\s*$/g, + Collection; + + var Selector = Class.extend({ + /** + * Constructs a new Selector instance. + * + * @constructor + * @method init + * @param {String} selector CSS like selector expression. + */ + init: function(selector) { + var match = this.match; + + function compileNameFilter(name) { + if (name) { + name = name.toLowerCase(); + + return function(item) { + return name === '*' || item.type === name; + }; + } + } + + function compileIdFilter(id) { + if (id) { + return function(item) { + return item._name === id; + }; + } + } + + function compileClassesFilter(classes) { + if (classes) { + classes = classes.split('.'); + + return function(item) { + var i = classes.length; + + while (i--) { + if (!item.hasClass(classes[i])) { + return false; + } + } + + return true; + }; + } + } + + function compileAttrFilter(name, cmp, check) { + if (name) { + return function(item) { + var value = item[name] ? item[name]() : ''; + + return !cmp ? !!check : + cmp === "=" ? value === check : + cmp === "*=" ? value.indexOf(check) >= 0 : + cmp === "~=" ? (" " + value + " ").indexOf(" " + check + " ") >= 0 : + cmp === "!=" ? value != check : + cmp === "^=" ? value.indexOf(check) === 0 : + cmp === "$=" ? value.substr(value.length - check.length) === check : + false; + }; + } + } + + function compilePsuedoFilter(name) { + var notSelectors; + + if (name) { + name = /(?:not\((.+)\))|(.+)/i.exec(name); + + if (!name[1]) { + name = name[2]; + + return function(item, index, length) { + return name === 'first' ? index === 0 : + name === 'last' ? index === length - 1 : + name === 'even' ? index % 2 === 0 : + name === 'odd' ? index % 2 === 1 : + item[name] ? item[name]() : + false; + }; + } else { + // Compile not expression + notSelectors = parseChunks(name[1], []); + + return function(item) { + return !match(item, notSelectors); + }; + } + } + } + + function compile(selector, filters, direct) { + var parts; + + function add(filter) { + if (filter) { + filters.push(filter); + } + } + + // Parse expression into parts + parts = expression.exec(selector.replace(whiteSpace, '')); + + add(compileNameFilter(parts[1])); + add(compileIdFilter(parts[2])); + add(compileClassesFilter(parts[3])); + add(compileAttrFilter(parts[4], parts[5], parts[6])); + add(compilePsuedoFilter(parts[7])); + + // Mark the filter with psuedo for performance + filters.psuedo = !!parts[7]; + filters.direct = direct; + + return filters; + } + + // Parser logic based on Sizzle by John Resig + function parseChunks(selector, selectors) { + var parts = [], extra, matches, i; + + do { + chunker.exec(""); + matches = chunker.exec(selector); + + if (matches) { + selector = matches[3]; + parts.push(matches[1]); + + if (matches[2]) { + extra = matches[3]; + break; + } + } + } while (matches); + + if (extra) { + parseChunks(extra, selectors); + } + + selector = []; + for (i = 0; i < parts.length; i++) { + if (parts[i] != '>') { + selector.push(compile(parts[i], [], parts[i - 1] === '>')); + } + } + + selectors.push(selector); + + return selectors; + } + + this._selectors = parseChunks(selector, []); + }, + + /** + * Returns true/false if the selector matches the specified control. + * + * @method match + * @param {tinymce.ui.Control} control Control to match agains the selector. + * @param {Array} selectors Optional array of selectors, mostly used internally. + * @return {Boolean} true/false state if the control matches or not. + */ + match: function(control, selectors) { + var i, l, si, sl, selector, fi, fl, filters, index, length, siblings, count, item; + + selectors = selectors || this._selectors; + for (i = 0, l = selectors.length; i < l; i++) { + selector = selectors[i]; + sl = selector.length; + item = control; + count = 0; + + for (si = sl - 1; si >= 0; si--) { + filters = selector[si]; + + while (item) { + // Find the index and length since a psuedo filter like :first needs it + if (filters.psuedo) { + siblings = item.parent().items(); + index = length = siblings.length; + while (index--) { + if (siblings[index] === item) { + break; + } + } + } + + for (fi = 0, fl = filters.length; fi < fl; fi++) { + if (!filters[fi](item, index, length)) { + fi = fl + 1; + break; + } + } + + if (fi === fl) { + count++; + break; + } else { + // If it didn't match the right most expression then + // break since it's no point looking at the parents + if (si === sl - 1) { + break; + } + } + + item = item.parent(); + } + } + + // If we found all selectors then return true otherwise continue looking + if (count === sl) { + return true; + } + } + + return false; + }, + + /** + * Returns a tinymce.ui.Collection with matches of the specified selector inside the specified container. + * + * @method find + * @param {tinymce.ui.Control} container Container to look for items in. + * @return {tinymce.ui.Collection} Collection with matched elements. + */ + find: function(container) { + var matches = [], i, l, selectors = this._selectors; + + function collect(items, selector, index) { + var i, l, fi, fl, item, filters = selector[index]; + + for (i = 0, l = items.length; i < l; i++) { + item = items[i]; + + // Run each filter agains the item + for (fi = 0, fl = filters.length; fi < fl; fi++) { + if (!filters[fi](item, i, l)) { + fi = fl + 1; + break; + } + } + + // All filters matched the item + if (fi === fl) { + // Matched item is on the last expression like: panel toolbar [button] + if (index == selector.length - 1) { + matches.push(item); + } else { + // Collect next expression type + if (item.items) { + collect(item.items(), selector, index + 1); + } + } + } else if (filters.direct) { + return; + } + + // Collect child items + if (item.items) { + collect(item.items(), selector, index); + } + } + } + + if (container.items) { + for (i = 0, l = selectors.length; i < l; i++) { + collect(container.items(), selectors[i], 0); + } + + // Unique the matches if needed + if (l > 1) { + matches = unique(matches); + } + } + + // Fix for circular reference + if (!Collection) { + // TODO: Fix me! + Collection = Selector.Collection; + } + + return new Collection(matches); + } + }); + + return Selector; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Spacer.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Spacer.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,39 @@ +/** + * Spacer.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a spacer. This control is used in flex layouts for example. + * + * @-x-less Spacer.less + * @class tinymce.ui.Spacer + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Spacer", [ + "tinymce/ui/Widget" +], function(Widget) { + "use strict"; + + return Widget.extend({ + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this; + + self.addClass('spacer'); + self.canFocus = false; + + return '
    '; + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/SplitButton.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/SplitButton.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,135 @@ +/** + * SplitButton.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a split button. + * + * @-x-less SplitButton.less + * @class tinymce.ui.SplitButton + * @extends tinymce.ui.MenuButton + */ +define("tinymce/ui/SplitButton", [ + "tinymce/ui/MenuButton", + "tinymce/ui/DomUtils" +], function(MenuButton, DomUtils) { + return MenuButton.extend({ + Defaults: { + classes: "widget btn splitbtn", + role: "button" + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this, elm = self.getEl(), rect = self.layoutRect(), mainButtonElm, menuButtonElm; + + self._super(); + + mainButtonElm = elm.firstChild; + menuButtonElm = elm.lastChild; + + DomUtils.css(mainButtonElm, { + width: rect.w - DomUtils.getSize(menuButtonElm).width, + height: rect.h - 2 + }); + + DomUtils.css(menuButtonElm, { + height: rect.h - 2 + }); + + return self; + }, + + /** + * Sets the active menu state. + * + * @private + */ + activeMenu: function(state) { + var self = this; + + DomUtils.toggleClass(self.getEl().lastChild, self.classPrefix + 'active', state); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix, image; + var icon = self.settings.icon; + + image = self.settings.image; + if (image) { + icon = 'none'; + + // Support for [high dpi, low dpi] image sources + if (typeof image != "string") { + image = window.getSelection ? image[0] : image[1]; + } + + image = ' style="background-image: url(\'' + image + '\')"'; + } else { + image = ''; + } + + icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : ''; + + return ( + '
    ' + + '' + + '' + + '
    ' + ); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this, onClickHandler = self.settings.onclick; + + self.on('click', function(e) { + var node = e.target; + + if (e.control == this) { + // Find clicks that is on the main button + while (node) { + if ((e.aria && e.aria.key != 'down') || (node.nodeName == 'BUTTON' && node.className.indexOf('open') == -1)) { + e.stopImmediatePropagation(); + onClickHandler.call(this, e); + return; + } + + node = node.parentNode; + } + } + }); + + delete self.settings.onclick; + + return self._super(); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/StackLayout.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/StackLayout.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,30 @@ +/** + * StackLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This layout uses the browsers layout when the items are blocks. + * + * @-x-less StackLayout.less + * @class tinymce.ui.StackLayout + * @extends tinymce.ui.FlowLayout + */ +define("tinymce/ui/StackLayout", [ + "tinymce/ui/FlowLayout" +], function(FlowLayout) { + "use strict"; + + return FlowLayout.extend({ + Defaults: { + containerClass: 'stack-layout', + controlClass: 'stack-layout-item', + endClass: 'break' + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/TabPanel.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/TabPanel.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,177 @@ +/** + * TabPanel.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a tab panel control. + * + * @-x-less TabPanel.less + * @class tinymce.ui.TabPanel + * @extends tinymce.ui.Panel + * + * @setting {Number} activeTab Active tab index. + */ +define("tinymce/ui/TabPanel", [ + "tinymce/ui/Panel", + "tinymce/ui/DomUtils" +], function(Panel, DomUtils) { + "use strict"; + + return Panel.extend({ + Defaults: { + layout: 'absolute', + defaults: { + type: 'panel' + } + }, + + /** + * Activates the specified tab by index. + * + * @method activateTab + * @param {Number} idx Index of the tab to activate. + */ + activateTab: function(idx) { + var activeTabElm; + + if (this.activeTabId) { + activeTabElm = this.getEl(this.activeTabId); + DomUtils.removeClass(activeTabElm, this.classPrefix + 'active'); + activeTabElm.setAttribute('aria-selected', "false"); + } + + this.activeTabId = 't' + idx; + + activeTabElm = this.getEl('t' + idx); + activeTabElm.setAttribute('aria-selected', "true"); + DomUtils.addClass(activeTabElm, this.classPrefix + 'active'); + + this.items()[idx].show().fire('showtab'); + this.reflow(); + + this.items().each(function(item, i) { + if (idx != i) { + item.hide(); + } + }); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, tabsHtml = '', prefix = self.classPrefix; + + self.preRender(); + layout.preRender(self); + + self.items().each(function(ctrl, i) { + var id = self._id + '-t' + i; + + ctrl.aria('role', 'tabpanel'); + ctrl.aria('labelledby', id); + + tabsHtml += ( + '' + ); + }); + + return ( + '
    ' + + '
    ' + + tabsHtml + + '
    ' + + '
    ' + + layout.renderHtml(self) + + '
    ' + + '
    ' + ); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self._super(); + + self.settings.activeTab = self.settings.activeTab || 0; + self.activateTab(self.settings.activeTab); + + this.on('click', function(e) { + var targetParent = e.target.parentNode; + + if (e.target.parentNode.id == self._id + '-head') { + var i = targetParent.childNodes.length; + + while (i--) { + if (targetParent.childNodes[i] == e.target) { + self.activateTab(i); + } + } + } + }); + }, + + /** + * Initializes the current controls layout rect. + * This will be executed by the layout managers to determine the + * default minWidth/minHeight etc. + * + * @method initLayoutRect + * @return {Object} Layout rect instance. + */ + initLayoutRect: function() { + var self = this, rect, minW, minH; + + minW = DomUtils.getSize(self.getEl('head')).width; + minW = minW < 0 ? 0 : minW; + minH = 0; + + self.items().each(function(item) { + minW = Math.max(minW, item.layoutRect().minW); + minH = Math.max(minH, item.layoutRect().minH); + }); + + self.items().each(function(ctrl) { + ctrl.settings.x = 0; + ctrl.settings.y = 0; + ctrl.settings.w = minW; + ctrl.settings.h = minH; + + ctrl.layoutRect({ + x: 0, + y: 0, + w: minW, + h: minH + }); + }); + + var headH = DomUtils.getSize(self.getEl('head')).height; + + self.settings.minWidth = minW; + self.settings.minHeight = minH + headH; + + rect = self._super(); + rect.deltaH += headH; + rect.innerH = rect.h - rect.deltaH; + + return rect; + } + }); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/TextBox.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/TextBox.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,214 @@ +/** + * TextBox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new textbox. + * + * @-x-less TextBox.less + * @class tinymce.ui.TextBox + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/TextBox", [ + "tinymce/ui/Widget", + "tinymce/ui/DomUtils" +], function(Widget, DomUtils) { + "use strict"; + + return Widget.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Boolean} multiline True if the textbox is a multiline control. + * @setting {Number} maxLength Max length for the textbox. + * @setting {Number} size Size of the textbox in characters. + */ + init: function(settings) { + var self = this; + + self._super(settings); + + self._value = settings.value || ''; + self.addClass('textbox'); + + if (settings.multiline) { + self.addClass('multiline'); + } else { + // TODO: Rework this + self.on('keydown', function(e) { + if (e.keyCode == 13) { + self.parents().reverse().each(function(ctrl) { + e.preventDefault(); + + if (ctrl.hasEventListeners('submit') && ctrl.toJSON) { + ctrl.fire('submit', {data: ctrl.toJSON()}); + return false; + } + }); + } + }); + } + }, + + /** + * Getter/setter function for the disabled state. + * + * @method value + * @param {Boolean} [state] State to be set. + * @return {Boolean|tinymce.ui.ComboBox} True/false or self if it's a set operation. + */ + disabled: function(state) { + var self = this; + + if (self._rendered && typeof state != 'undefined') { + self.getEl().disabled = state; + } + + return self._super(state); + }, + + /** + * Getter/setter function for the control value. + * + * @method value + * @param {String} [value] Value to be set. + * @return {String|tinymce.ui.ComboBox} Value or self if it's a set operation. + */ + value: function(value) { + var self = this; + + if (typeof value != "undefined") { + self._value = value; + + if (self._rendered) { + self.getEl().value = value; + } + + return self; + } + + if (self._rendered) { + return self.getEl().value; + } + + return self._value; + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this, style, rect, borderBox, borderW = 0, borderH = 0, lastRepaintRect; + + style = self.getEl().style; + rect = self._layoutRect; + lastRepaintRect = self._lastRepaintRect || {}; + + // Detect old IE 7+8 add lineHeight to align caret vertically in the middle + var doc = document; + if (!self.settings.multiline && doc.all && (!doc.documentMode || doc.documentMode <= 8)) { + style.lineHeight = (rect.h - borderH) + 'px'; + } + + borderBox = self._borderBox; + borderW = borderBox.left + borderBox.right + 8; + borderH = borderBox.top + borderBox.bottom + (self.settings.multiline ? 8 : 0); + + if (rect.x !== lastRepaintRect.x) { + style.left = rect.x + 'px'; + lastRepaintRect.x = rect.x; + } + + if (rect.y !== lastRepaintRect.y) { + style.top = rect.y + 'px'; + lastRepaintRect.y = rect.y; + } + + if (rect.w !== lastRepaintRect.w) { + style.width = (rect.w - borderW) + 'px'; + lastRepaintRect.w = rect.w; + } + + if (rect.h !== lastRepaintRect.h) { + style.height = (rect.h - borderH) + 'px'; + lastRepaintRect.h = rect.h; + } + + self._lastRepaintRect = lastRepaintRect; + self.fire('repaint', {}, false); + + return self; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, settings = self.settings, value = self.encode(self._value, false), extraAttrs = ''; + + if ("spellcheck" in settings) { + extraAttrs += ' spellcheck="' + settings.spellcheck + '"'; + } + + if (settings.maxLength) { + extraAttrs += ' maxlength="' + settings.maxLength + '"'; + } + + if (settings.size) { + extraAttrs += ' size="' + settings.size + '"'; + } + + if (settings.subtype) { + extraAttrs += ' type="' + settings.subtype + '"'; + } + + if (self.disabled()) { + extraAttrs += ' disabled="disabled"'; + } + + if (settings.multiline) { + return ( + '' + ); + } + + return ''; + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + DomUtils.on(self.getEl(), 'change', function(e) { + self.fire('change', e); + }); + + return self._super(); + }, + + remove: function() { + DomUtils.off(this.getEl()); + this._super(); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Throbber.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Throbber.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,74 @@ +/** + * Throbber.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class enables you to display a Throbber for any element. + * + * @-x-less Throbber.less + * @class tinymce.ui.Throbber + */ +define("tinymce/ui/Throbber", [ + "tinymce/ui/DomUtils", + "tinymce/ui/Control" +], function(DomUtils, Control) { + "use strict"; + + /** + * Constructs a new throbber. + * + * @constructor + * @param {Element} elm DOM Html element to display throbber in. + * @param {Boolean} inline Optional true/false state if the throbber should be appended to end of element for infinite scroll. + */ + return function(elm, inline) { + var self = this, state, classPrefix = Control.classPrefix; + + /** + * Shows the throbber. + * + * @method show + * @param {Number} [time] Time to wait before showing. + * @return {tinymce.ui.Throbber} Current throbber instance. + */ + self.show = function(time) { + self.hide(); + + state = true; + + window.setTimeout(function() { + if (state) { + elm.appendChild(DomUtils.createFragment( + '
    ' + )); + } + }, time || 0); + + return self; + }; + + /** + * Hides the throbber. + * + * @method hide + * @return {tinymce.ui.Throbber} Current throbber instance. + */ + self.hide = function() { + var child = elm.lastChild; + + if (child && child.className.indexOf('throbber') != -1) { + child.parentNode.removeChild(child); + } + + state = false; + + return self; + }; + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Toolbar.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Toolbar.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,54 @@ +/** + * Toolbar.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new toolbar. + * + * @class tinymce.ui.Toolbar + * @extends tinymce.ui.Container + */ +define("tinymce/ui/Toolbar", [ + "tinymce/ui/Container" +], function(Container) { + "use strict"; + + return Container.extend({ + Defaults: { + role: 'toolbar', + layout: 'flow' + }, + + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this; + + self._super(settings); + self.addClass('toolbar'); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self.items().addClass('toolbar-item'); + + return self._super(); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Tooltip.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Tooltip.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,86 @@ +/** + * Tooltip.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a tooltip instance. + * + * @-x-less ToolTip.less + * @class tinymce.ui.ToolTip + * @extends tinymce.ui.Control + * @mixes tinymce.ui.Movable + */ +define("tinymce/ui/Tooltip", [ + "tinymce/ui/Control", + "tinymce/ui/Movable" +], function(Control, Movable) { + return Control.extend({ + Mixins: [Movable], + + Defaults: { + classes: 'widget tooltip tooltip-n' + }, + + /** + * Sets/gets the current label text. + * + * @method text + * @param {String} [text] New label text. + * @return {String|tinymce.ui.Tooltip} Current text or current label instance. + */ + text: function(value) { + var self = this; + + if (typeof value != "undefined") { + self._value = value; + + if (self._rendered) { + self.getEl().lastChild.innerHTML = self.encode(value); + } + + return self; + } + + return self._value; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, prefix = self.classPrefix; + + return ( + '' + ); + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this, style, rect; + + style = self.getEl().style; + rect = self._layoutRect; + + style.left = rect.x + 'px'; + style.top = rect.y + 'px'; + style.zIndex = 0xFFFF + 0xFFFF; + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Widget.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Widget.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,157 @@ +/** + * Widget.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Widget base class a widget is a control that has a tooltip and some basic states. + * + * @class tinymce.ui.Widget + * @extends tinymce.ui.Control + */ +define("tinymce/ui/Widget", [ + "tinymce/ui/Control", + "tinymce/ui/Tooltip" +], function(Control, Tooltip) { + "use strict"; + + var tooltip; + + var Widget = Control.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {String} tooltip Tooltip text to display when hovering. + * @setting {Boolean} autofocus True if the control should be focused when rendered. + * @setting {String} text Text to display inside widget. + */ + init: function(settings) { + var self = this; + + self._super(settings); + settings = self.settings; + self.canFocus = true; + + if (settings.tooltip && Widget.tooltips !== false) { + self.on('mouseenter', function(e) { + var tooltip = self.tooltip().moveTo(-0xFFFF); + + if (e.control == self) { + var rel = tooltip.text(settings.tooltip).show().testMoveRel(self.getEl(), ['bc-tc', 'bc-tl', 'bc-tr']); + + tooltip.toggleClass('tooltip-n', rel == 'bc-tc'); + tooltip.toggleClass('tooltip-nw', rel == 'bc-tl'); + tooltip.toggleClass('tooltip-ne', rel == 'bc-tr'); + + tooltip.moveRel(self.getEl(), rel); + } else { + tooltip.hide(); + } + }); + + self.on('mouseleave mousedown click', function() { + self.tooltip().hide(); + }); + } + + self.aria('label', settings.ariaLabel || settings.tooltip); + }, + + /** + * Returns the current tooltip instance. + * + * @method tooltip + * @return {tinymce.ui.Tooltip} Tooltip instance. + */ + tooltip: function() { + if (!tooltip) { + tooltip = new Tooltip({type: 'tooltip'}); + tooltip.renderTo(); + } + + return tooltip; + }, + + /** + * Sets/gets the active state of the widget. + * + * @method active + * @param {Boolean} [state] State if the control is active. + * @return {Boolean|tinymce.ui.Widget} True/false or current widget instance. + */ + active: function(state) { + var self = this, undef; + + if (state !== undef) { + self.aria('pressed', state); + self.toggleClass('active', state); + } + + return self._super(state); + }, + + /** + * Sets/gets the disabled state of the widget. + * + * @method disabled + * @param {Boolean} [state] State if the control is disabled. + * @return {Boolean|tinymce.ui.Widget} True/false or current widget instance. + */ + disabled: function(state) { + var self = this, undef; + + if (state !== undef) { + self.aria('disabled', state); + self.toggleClass('disabled', state); + } + + return self._super(state); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this, settings = self.settings; + + self._rendered = true; + + self._super(); + + if (!self.parent() && (settings.width || settings.height)) { + self.initLayoutRect(); + self.repaint(); + } + + if (settings.autofocus) { + self.focus(); + } + }, + + /** + * Removes the current control from DOM and from UI collections. + * + * @method remove + * @return {tinymce.ui.Control} Current control instance. + */ + remove: function() { + this._super(); + + if (tooltip) { + tooltip.remove(); + tooltip = null; + } + } + }); + + return Widget; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Window.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Window.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,384 @@ +/** + * Window.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new window. + * + * @-x-less Window.less + * @class tinymce.ui.Window + * @extends tinymce.ui.FloatPanel + */ +define("tinymce/ui/Window", [ + "tinymce/ui/FloatPanel", + "tinymce/ui/Panel", + "tinymce/ui/DomUtils", + "tinymce/ui/DragHelper" +], function(FloatPanel, Panel, DomUtils, DragHelper) { + "use strict"; + + var Window = FloatPanel.extend({ + modal: true, + + Defaults: { + border: 1, + layout: 'flex', + containerCls: 'panel', + role: 'dialog', + callbacks: { + submit: function() { + this.fire('submit', {data: this.toJSON()}); + }, + + close: function() { + this.close(); + } + } + }, + + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this; + + self._super(settings); + + if (self.isRtl()) { + self.addClass('rtl'); + } + + self.addClass('window'); + self._fixed = true; + + // Create statusbar + if (settings.buttons) { + self.statusbar = new Panel({ + layout: 'flex', + border: '1 0 0 0', + spacing: 3, + padding: 10, + align: 'center', + pack: self.isRtl() ? 'start' : 'end', + defaults: { + type: 'button' + }, + items: settings.buttons + }); + + self.statusbar.addClass('foot'); + self.statusbar.parent(self); + } + + self.on('click', function(e) { + if (e.target.className.indexOf(self.classPrefix + 'close') != -1) { + self.close(); + } + }); + + self.on('cancel', function() { + self.close(); + }); + + self.aria('describedby', self.describedBy || self._id + '-none'); + self.aria('label', settings.title); + self._fullscreen = false; + }, + + /** + * Recalculates the positions of the controls in the current container. + * This is invoked by the reflow method and shouldn't be called directly. + * + * @method recalc + */ + recalc: function() { + var self = this, statusbar = self.statusbar, layoutRect, width, x, needsRecalc; + + if (self._fullscreen) { + self.layoutRect(DomUtils.getWindowSize()); + self.layoutRect().contentH = self.layoutRect().innerH; + } + + self._super(); + + layoutRect = self.layoutRect(); + + // Resize window based on title width + if (self.settings.title && !self._fullscreen) { + width = layoutRect.headerW; + if (width > layoutRect.w) { + x = layoutRect.x - Math.max(0, width / 2); + self.layoutRect({w: width, x: x}); + needsRecalc = true; + } + } + + // Resize window based on statusbar width + if (statusbar) { + statusbar.layoutRect({w: self.layoutRect().innerW}).recalc(); + + width = statusbar.layoutRect().minW + layoutRect.deltaW; + if (width > layoutRect.w) { + x = layoutRect.x - Math.max(0, width - layoutRect.w); + self.layoutRect({w: width, x: x}); + needsRecalc = true; + } + } + + // Recalc body and disable auto resize + if (needsRecalc) { + self.recalc(); + } + }, + + /** + * Initializes the current controls layout rect. + * This will be executed by the layout managers to determine the + * default minWidth/minHeight etc. + * + * @method initLayoutRect + * @return {Object} Layout rect instance. + */ + initLayoutRect: function() { + var self = this, layoutRect = self._super(), deltaH = 0, headEl; + + // Reserve vertical space for title + if (self.settings.title && !self._fullscreen) { + headEl = self.getEl('head'); + + var size = DomUtils.getSize(headEl); + + layoutRect.headerW = size.width; + layoutRect.headerH = size.height; + + deltaH += layoutRect.headerH; + } + + // Reserve vertical space for statusbar + if (self.statusbar) { + deltaH += self.statusbar.layoutRect().h; + } + + layoutRect.deltaH += deltaH; + layoutRect.minH += deltaH; + //layoutRect.innerH -= deltaH; + layoutRect.h += deltaH; + + var rect = DomUtils.getWindowSize(); + + layoutRect.x = Math.max(0, rect.w / 2 - layoutRect.w / 2); + layoutRect.y = Math.max(0, rect.h / 2 - layoutRect.h / 2); + + return layoutRect; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, id = self._id, prefix = self.classPrefix; + var settings = self.settings, headerHtml = '', footerHtml = '', html = settings.html; + + self.preRender(); + layout.preRender(self); + + if (settings.title) { + headerHtml = ( + '
    ' + + '
    ' + self.encode(settings.title) + '
    ' + + '' + + '
    ' + + '
    ' + ); + } + + if (settings.url) { + html = ''; + } + + if (typeof html == "undefined") { + html = layout.renderHtml(self); + } + + if (self.statusbar) { + footerHtml = self.statusbar.renderHtml(); + } + + return ( + '
    ' + + '
    ' + + headerHtml + + '
    ' + + html + + '
    ' + + footerHtml + + '
    ' + + '
    ' + ); + }, + + /** + * Switches the window fullscreen mode. + * + * @method fullscreen + * @param {Boolean} state True/false state. + * @return {tinymce.ui.Window} Current window instance. + */ + fullscreen: function(state) { + var self = this, documentElement = document.documentElement, slowRendering, prefix = self.classPrefix, layoutRect; + + if (state != self._fullscreen) { + DomUtils.on(window, 'resize', function() { + var time; + + if (self._fullscreen) { + // Time the layout time if it's to slow use a timeout to not hog the CPU + if (!slowRendering) { + time = new Date().getTime(); + + var rect = DomUtils.getWindowSize(); + self.moveTo(0, 0).resizeTo(rect.w, rect.h); + + if ((new Date().getTime()) - time > 50) { + slowRendering = true; + } + } else { + if (!self._timer) { + self._timer = setTimeout(function() { + var rect = DomUtils.getWindowSize(); + self.moveTo(0, 0).resizeTo(rect.w, rect.h); + + self._timer = 0; + }, 50); + } + } + } + }); + + layoutRect = self.layoutRect(); + self._fullscreen = state; + + if (!state) { + self._borderBox = self.parseBox(self.settings.border); + self.getEl('head').style.display = ''; + layoutRect.deltaH += layoutRect.headerH; + DomUtils.removeClass(documentElement, prefix + 'fullscreen'); + DomUtils.removeClass(document.body, prefix + 'fullscreen'); + self.removeClass('fullscreen'); + self.moveTo(self._initial.x, self._initial.y).resizeTo(self._initial.w, self._initial.h); + } else { + self._initial = {x: layoutRect.x, y: layoutRect.y, w: layoutRect.w, h: layoutRect.h}; + + self._borderBox = self.parseBox('0'); + self.getEl('head').style.display = 'none'; + layoutRect.deltaH -= layoutRect.headerH + 2; + DomUtils.addClass(documentElement, prefix + 'fullscreen'); + DomUtils.addClass(document.body, prefix + 'fullscreen'); + self.addClass('fullscreen'); + + var rect = DomUtils.getWindowSize(); + self.moveTo(0, 0).resizeTo(rect.w, rect.h); + } + } + + return self.reflow(); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this, startPos; + + setTimeout(function() { + self.addClass('in'); + }, 0); + + self._super(); + + if (self.statusbar) { + self.statusbar.postRender(); + } + + self.focus(); + + this.dragHelper = new DragHelper(self._id + '-dragh', { + start: function() { + startPos = { + x: self.layoutRect().x, + y: self.layoutRect().y + }; + }, + + drag: function(e) { + self.moveTo(startPos.x + e.deltaX, startPos.y + e.deltaY); + } + }); + + self.on('submit', function(e) { + if (!e.isDefaultPrevented()) { + self.close(); + } + }); + }, + + /** + * Fires a submit event with the serialized form. + * + * @method submit + * @return {Object} Event arguments object. + */ + submit: function() { + return this.fire('submit', {data: this.toJSON()}); + }, + + /** + * Removes the current control from DOM and from UI collections. + * + * @method remove + * @return {tinymce.ui.Control} Current control instance. + */ + remove: function() { + var self = this, prefix = self.classPrefix; + + self.dragHelper.destroy(); + self._super(); + + if (self.statusbar) { + this.statusbar.remove(); + } + + if (self._fullscreen) { + DomUtils.removeClass(document.documentElement, prefix + 'fullscreen'); + DomUtils.removeClass(document.body, prefix + 'fullscreen'); + } + }, + + /** + * Returns the contentWindow object of the iframe if it exists. + * + * @method getContentWindow + * @return {Window} window object or null. + */ + getContentWindow: function() { + var ifr = this.getEl().getElementsByTagName('iframe')[0]; + return ifr ? ifr.contentWindow : null; + } + }); + + return Window; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Class.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Class.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,165 @@ +/** + * Class.js + * + * Copyright 2003-2012, Moxiecode Systems AB, All rights reserved. + */ + +/** + * This utilitiy class is used for easier inheritage. + * + * Features: + * * Exposed super functions: this._super(); + * * Mixins + * * Dummy functions + * * Property functions: var value = object.value(); and object.value(newValue); + * * Static functions + * * Defaults settings + */ +define("tinymce/util/Class", [ + "tinymce/util/Tools" +], function(Tools) { + var each = Tools.each, extend = Tools.extend; + + var extendClass, initializing; + + function Class() { + } + + // Provides classical inheritance, based on code made by John Resig + Class.extend = extendClass = function(prop) { + var self = this, _super = self.prototype, prototype, name, member; + + // The dummy class constructor + function Class() { + var i, mixins, mixin, self = this; + + // All construction is actually done in the init method + if (!initializing) { + // Run class constuctor + if (self.init) { + self.init.apply(self, arguments); + } + + // Run mixin constructors + mixins = self.Mixins; + if (mixins) { + i = mixins.length; + while (i--) { + mixin = mixins[i]; + if (mixin.init) { + mixin.init.apply(self, arguments); + } + } + } + } + } + + // Dummy function, needs to be extended in order to provide functionality + function dummy() { + return this; + } + + // Creates a overloaded method for the class + // this enables you to use this._super(); to call the super function + function createMethod(name, fn) { + return function() { + var self = this, tmp = self._super, ret; + + self._super = _super[name]; + ret = fn.apply(self, arguments); + self._super = tmp; + + return ret; + }; + } + + // Instantiate a base class (but only create the instance, + // don't run the init constructor) + initializing = true; + + /*eslint new-cap:0 */ + prototype = new self(); + initializing = false; + + // Add mixins + if (prop.Mixins) { + each(prop.Mixins, function(mixin) { + mixin = mixin; + + for (var name in mixin) { + if (name !== "init") { + prop[name] = mixin[name]; + } + } + }); + + if (_super.Mixins) { + prop.Mixins = _super.Mixins.concat(prop.Mixins); + } + } + + // Generate dummy methods + if (prop.Methods) { + each(prop.Methods.split(','), function(name) { + prop[name] = dummy; + }); + } + + // Generate property methods + if (prop.Properties) { + each(prop.Properties.split(','), function(name) { + var fieldName = '_' + name; + + prop[name] = function(value) { + var self = this, undef; + + // Set value + if (value !== undef) { + self[fieldName] = value; + + return self; + } + + // Get value + return self[fieldName]; + }; + }); + } + + // Static functions + if (prop.Statics) { + each(prop.Statics, function(func, name) { + Class[name] = func; + }); + } + + // Default settings + if (prop.Defaults && _super.Defaults) { + prop.Defaults = extend({}, _super.Defaults, prop.Defaults); + } + + // Copy the properties over onto the new prototype + for (name in prop) { + member = prop[name]; + + if (typeof member == "function" && _super[name]) { + prototype[name] = createMethod(name, member); + } else { + prototype[name] = member; + } + } + + // Populate our constructed prototype object + Class.prototype = prototype; + + // Enforce the constructor to be what we expect + Class.constructor = Class; + + // And make this class extendible + Class.extend = extendClass; + + return Class; + }; + + return Class; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Color.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Color.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,235 @@ +/** + * Color.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class lets you parse/serialize colors and convert rgb/hsb. + * + * @class tinymce.util.Color + * @example + * var white = new tinymce.util.Color({r: 255, g: 255, b: 255}); + * var red = new tinymce.util.Color('#FF0000'); + * + * console.log(white.toHex(), red.toHsv()); + */ +define("tinymce/util/Color", [], function() { + var min = Math.min, max = Math.max, round = Math.round; + + /** + * Constructs a new color instance. + * + * @constructor + * @method Color + * @param {String} value Optional initial value to parse. + */ + function Color(value) { + var self = this, r = 0, g = 0, b = 0; + + function rgb2hsv(r, g, b) { + var h, s, v, d, minRGB, maxRGB; + + h = 0; + s = 0; + v = 0; + r = r / 255; + g = g / 255; + b = b / 255; + + minRGB = min(r, min(g, b)); + maxRGB = max(r, max(g, b)); + + if (minRGB == maxRGB) { + v = minRGB; + + return { + h: 0, + s: 0, + v: v * 100 + }; + } + + /*eslint no-nested-ternary:0 */ + d = (r == minRGB) ? g - b : ((b == minRGB) ? r - g : b - r); + h = (r == minRGB) ? 3 : ((b == minRGB) ? 1 : 5); + h = 60 * (h - d / (maxRGB - minRGB)); + s = (maxRGB - minRGB) / maxRGB; + v = maxRGB; + + return { + h: round(h), + s: round(s * 100), + v: round(v * 100) + }; + } + + function hsvToRgb(hue, saturation, brightness) { + var side, chroma, x, match; + + hue = (parseInt(hue, 10) || 0) % 360; + saturation = parseInt(saturation, 10) / 100; + brightness = parseInt(brightness, 10) / 100; + saturation = max(0, min(saturation, 1)); + brightness = max(0, min(brightness, 1)); + + if (saturation === 0) { + r = g = b = round(255 * brightness); + return; + } + + side = hue / 60; + chroma = brightness * saturation; + x = chroma * (1 - Math.abs(side % 2 - 1)); + match = brightness - chroma; + + switch (Math.floor(side)) { + case 0: + r = chroma; + g = x; + b = 0; + break; + + case 1: + r = x; + g = chroma; + b = 0; + break; + + case 2: + r = 0; + g = chroma; + b = x; + break; + + case 3: + r = 0; + g = x; + b = chroma; + break; + + case 4: + r = x; + g = 0; + b = chroma; + break; + + case 5: + r = chroma; + g = 0; + b = x; + break; + + default: + r = g = b = 0; + } + + r = round(255 * (r + match)); + g = round(255 * (g + match)); + b = round(255 * (b + match)); + } + + /** + * Returns the hex string of the current color. For example: #ff00ff + * + * @method toHex + * @return {String} Hex string of current color. + */ + function toHex() { + function hex(val) { + val = parseInt(val, 10).toString(16); + + return val.length > 1 ? val : '0' + val; + } + + return '#' + hex(r) + hex(g) + hex(b); + } + + /** + * Returns the r, g, b values of the color. Each channel has a range from 0-255. + * + * @method toRgb + * @return {Object} Object with r, g, b fields. + */ + function toRgb() { + return { + r: r, + g: g, + b: b + }; + } + + /** + * Returns the h, s, v values of the color. Ranges: h=0-360, s=0-100, v=0-100. + * + * @method toHsv + * @return {Object} Object with h, s, v fields. + */ + function toHsv() { + return rgb2hsv(r, g, b); + } + + /** + * Parses the specified value and populates the color instance. + * + * Supported format examples: + * * rbg(255,0,0) + * * #ff0000 + * * #fff + * * {r: 255, g: 0, b: 0} + * * {h: 360, s: 100, v: 100} + * + * @method parse + * @param {Object/String} value Color value to parse. + * @return {tinymce.util.Color} Current color instance. + */ + function parse(value) { + var matches; + + if (typeof value == 'object') { + if ("r" in value) { + r = value.r; + g = value.g; + b = value.b; + } else if ("v" in value) { + hsvToRgb(value.h, value.s, value.v); + } + } else { + if ((matches = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(value))) { + r = parseInt(matches[1], 10); + g = parseInt(matches[2], 10); + b = parseInt(matches[3], 10); + } else if ((matches = /#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(value))) { + r = parseInt(matches[1], 16); + g = parseInt(matches[2], 16); + b = parseInt(matches[3], 16); + } else if ((matches = /#([0-F])([0-F])([0-F])/gi.exec(value))) { + r = parseInt(matches[1] + matches[1], 16); + g = parseInt(matches[2] + matches[2], 16); + b = parseInt(matches[3] + matches[3], 16); + } + } + + r = r < 0 ? 0 : (r > 255 ? 255 : r); + g = g < 0 ? 0 : (g > 255 ? 255 : g); + b = b < 0 ? 0 : (b > 255 ? 255 : b); + + return self; + } + + if (value) { + parse(value); + } + + self.toRgb = toRgb; + self.toHsv = toHsv; + self.toHex = toHex; + self.parse = parse; + } + + return Color; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/EventDispatcher.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/EventDispatcher.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,294 @@ +/** + * EventDispatcher.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class lets you add/remove and fire events by name on the specified scope. This makes + * it easy to add event listener logic to any class. + * + * @class tinymce.util.EventDispatcher + * @example + * var eventDispatcher = new EventDispatcher(); + * + * eventDispatcher.on('click', function() {console.log('data');}); + * eventDispatcher.fire('click', {data: 123}); + */ +define("tinymce/util/EventDispatcher", [ + "tinymce/util/Tools" +], function(Tools) { + var nativeEvents = Tools.makeMap( + "focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange " + + "mouseout mouseenter mouseleave wheel keydown keypress keyup input contextmenu dragstart dragend dragover " + + "draggesture dragdrop drop drag submit " + + "compositionstart compositionend compositionupdate touchstart touchend", + ' ' + ); + + function Dispatcher(settings) { + var self = this, scope, bindings = {}, toggleEvent; + + function returnFalse() { + return false; + } + + function returnTrue() { + return true; + } + + settings = settings || {}; + scope = settings.scope || self; + toggleEvent = settings.toggleEvent || returnFalse; + + /** + * Fires the specified event by name. + * + * @method fire + * @param {String} name Name of the event to fire. + * @param {Object?} args Event arguments. + * @return {Object} Event args instance passed in. + * @example + * instance.fire('event', {...}); + */ + function fire(name, args) { + var handlers, i, l, callback; + + name = name.toLowerCase(); + args = args || {}; + args.type = name; + + // Setup target is there isn't one + if (!args.target) { + args.target = scope; + } + + // Add event delegation methods if they are missing + if (!args.preventDefault) { + // Add preventDefault method + args.preventDefault = function() { + args.isDefaultPrevented = returnTrue; + }; + + // Add stopPropagation + args.stopPropagation = function() { + args.isPropagationStopped = returnTrue; + }; + + // Add stopImmediatePropagation + args.stopImmediatePropagation = function() { + args.isImmediatePropagationStopped = returnTrue; + }; + + // Add event delegation states + args.isDefaultPrevented = returnFalse; + args.isPropagationStopped = returnFalse; + args.isImmediatePropagationStopped = returnFalse; + } + + if (settings.beforeFire) { + settings.beforeFire(args); + } + + handlers = bindings[name]; + if (handlers) { + for (i = 0, l = handlers.length; i < l; i++) { + callback = handlers[i]; + + // Unbind handlers marked with "once" + if (callback.once) { + off(name, callback.func); + } + + // Stop immediate propagation if needed + if (args.isImmediatePropagationStopped()) { + args.stopPropagation(); + return args; + } + + // If callback returns false then prevent default and stop all propagation + if (callback.func.call(scope, args) === false) { + args.preventDefault(); + return args; + } + } + } + + return args; + } + + /** + * Binds an event listener to a specific event by name. + * + * @method on + * @param {String} name Event name or space separated list of events to bind. + * @param {callback} callback Callback to be executed when the event occurs. + * @param {Boolean} first Optional flag if the event should be prepended. Use this with care. + * @return {Object} Current class instance. + * @example + * instance.on('event', function(e) { + * // Callback logic + * }); + */ + function on(name, callback, prepend, extra) { + var handlers, names, i; + + if (callback === false) { + callback = returnFalse; + } + + if (callback) { + callback = { + func: callback + }; + + if (extra) { + Tools.extend(callback, extra); + } + + names = name.toLowerCase().split(' '); + i = names.length; + while (i--) { + name = names[i]; + handlers = bindings[name]; + if (!handlers) { + handlers = bindings[name] = []; + toggleEvent(name, true); + } + + if (prepend) { + handlers.unshift(callback); + } else { + handlers.push(callback); + } + } + } + + return self; + } + + /** + * Unbinds an event listener to a specific event by name. + * + * @method off + * @param {String?} name Name of the event to unbind. + * @param {callback?} callback Callback to unbind. + * @return {Object} Current class instance. + * @example + * // Unbind specific callback + * instance.off('event', handler); + * + * // Unbind all listeners by name + * instance.off('event'); + * + * // Unbind all events + * instance.off(); + */ + function off(name, callback) { + var i, handlers, bindingName, names, hi; + + if (name) { + names = name.toLowerCase().split(' '); + i = names.length; + while (i--) { + name = names[i]; + handlers = bindings[name]; + + // Unbind all handlers + if (!name) { + for (bindingName in bindings) { + toggleEvent(bindingName, false); + delete bindings[bindingName]; + } + + return self; + } + + if (handlers) { + // Unbind all by name + if (!callback) { + handlers.length = 0; + } else { + // Unbind specific ones + hi = handlers.length; + while (hi--) { + if (handlers[hi].func === callback) { + handlers = handlers.slice(0, hi).concat(handlers.slice(hi + 1)); + bindings[name] = handlers; + } + } + } + + if (!handlers.length) { + toggleEvent(name, false); + delete bindings[name]; + } + } + } + } else { + for (name in bindings) { + toggleEvent(name, false); + } + + bindings = {}; + } + + return self; + } + + /** + * Binds an event listener to a specific event by name + * and automatically unbind the event once the callback fires. + * + * @method once + * @param {String} name Event name or space separated list of events to bind. + * @param {callback} callback Callback to be executed when the event occurs. + * @param {Boolean} first Optional flag if the event should be prepended. Use this with care. + * @return {Object} Current class instance. + * @example + * instance.once('event', function(e) { + * // Callback logic + * }); + */ + function once(name, callback, prepend) { + return on(name, callback, prepend, {once: true}); + } + + /** + * Returns true/false if the dispatcher has a event of the specified name. + * + * @method has + * @param {String} name Name of the event to check for. + * @return {Boolean} true/false if the event exists or not. + */ + function has(name) { + name = name.toLowerCase(); + return !(!bindings[name] || bindings[name].length === 0); + } + + // Expose + self.fire = fire; + self.on = on; + self.off = off; + self.once = once; + self.has = has; + } + + /** + * Returns true/false if the specified event name is a native browser event or not. + * + * @method isNative + * @param {String} name Name to check if it's native. + * @return {Boolean} true/false if the event is native or not. + * @static + */ + Dispatcher.isNative = function(name) { + return !!nativeEvents[name.toLowerCase()]; + }; + + return Dispatcher; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/I18n.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/I18n.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,115 @@ +/** + * I18n.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * I18n class that handles translation of TinyMCE UI. + * Uses po style with csharp style parameters. + * + * @class tinymce.util.I18n + */ +define("tinymce/util/I18n", [], function() { + "use strict"; + + var data = {}, code = "en"; + + return { + /** + * Sets the current language code. + * + * @method setCode + * @param {String} newCode Current language code. + */ + setCode: function(newCode) { + if (newCode) { + code = newCode; + this.rtl = this.data[newCode] ? this.data[newCode]._dir === 'rtl' : false; + } + }, + + /** + * Returns the current language code. + * + * @return {String} Current language code. + */ + getCode: function() { + return code; + }, + + /** + * Property gets set to true if a RTL language pack was loaded. + * + * @property rtl + * @type Boolean + */ + rtl: false, + + /** + * Adds translations for a specific language code. + * + * @method add + * @param {String} code Language code like sv_SE. + * @param {Array} items Name/value array with English en_US to sv_SE. + */ + add: function(code, items) { + var langData = data[code]; + + if (!langData) { + data[code] = langData = {}; + } + + for (var name in items) { + langData[name] = items[name]; + } + + this.setCode(code); + }, + + /** + * Translates the specified text. + * + * It has a few formats: + * I18n.translate("Text"); + * I18n.translate(["Text {0}/{1}", 0, 1]); + * I18n.translate({raw: "Raw string"}); + * + * @method translate + * @param {String/Object/Array} text Text to translate. + * @return {String} String that got translated. + */ + translate: function(text) { + var langData; + + langData = data[code]; + if (!langData) { + langData = {}; + } + + if (typeof text == "undefined") { + return text; + } + + if (typeof text != "string" && text.raw) { + return text.raw; + } + + if (text.push) { + var values = text.slice(1); + + text = (langData[text[0]] || text[0]).replace(/\{([0-9]+)\}/g, function(match1, match2) { + return values[match2]; + }); + } + + return (langData[text] || text).replace(/{context:\w+}$/, ''); + }, + + data: data + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/JSON.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/JSON.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,109 @@ +/** + * JSON.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * JSON parser and serializer class. + * + * @class tinymce.util.JSON + * @static + * @example + * // JSON parse a string into an object + * var obj = tinymce.util.JSON.parse(somestring); + * + * // JSON serialize a object into an string + * var str = tinymce.util.JSON.serialize(obj); + */ +define("tinymce/util/JSON", [], function() { + function serialize(o, quote) { + var i, v, t, name; + + quote = quote || '"'; + + if (o === null) { + return 'null'; + } + + t = typeof o; + + if (t == 'string') { + v = '\bb\tt\nn\ff\rr\""\'\'\\\\'; + + return quote + o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g, function(a, b) { + // Make sure single quotes never get encoded inside double quotes for JSON compatibility + if (quote === '"' && a === "'") { + return a; + } + + i = v.indexOf(b); + + if (i + 1) { + return '\\' + v.charAt(i + 1); + } + + a = b.charCodeAt().toString(16); + + return '\\u' + '0000'.substring(a.length) + a; + }) + quote; + } + + if (t == 'object') { + if (o.hasOwnProperty && Object.prototype.toString.call(o) === '[object Array]') { + for (i = 0, v = '['; i < o.length; i++) { + v += (i > 0 ? ',' : '') + serialize(o[i], quote); + } + + return v + ']'; + } + + v = '{'; + + for (name in o) { + if (o.hasOwnProperty(name)) { + v += typeof o[name] != 'function' ? (v.length > 1 ? ',' + quote : quote) + name + + quote + ':' + serialize(o[name], quote) : ''; + } + } + + return v + '}'; + } + + return '' + o; + } + + return { + /** + * Serializes the specified object as a JSON string. + * + * @method serialize + * @param {Object} obj Object to serialize as a JSON string. + * @param {String} quote Optional quote string defaults to ". + * @return {string} JSON string serialized from input. + */ + serialize: serialize, + + /** + * Unserializes/parses the specified JSON string into a object. + * + * @method parse + * @param {string} s JSON String to parse into a JavaScript object. + * @return {Object} Object from input JSON string or undefined if it failed. + */ + parse: function(text) { + try { + // Trick uglify JS + return window[String.fromCharCode(101) + 'val']('(' + text + ')'); + } catch (ex) { + // Ignore + } + } + + /**#@-*/ + }; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/JSONP.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/JSONP.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,38 @@ +/** + * JSONP.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +define("tinymce/util/JSONP", [ + "tinymce/dom/DOMUtils" +], function(DOMUtils) { + return { + callbacks: {}, + count: 0, + + send: function(settings) { + var self = this, dom = DOMUtils.DOM, count = settings.count !== undefined ? settings.count : self.count; + var id = 'tinymce_jsonp_' + count; + + self.callbacks[count] = function(json) { + dom.remove(id); + delete self.callbacks[count]; + + settings.callback(json); + }; + + dom.add(dom.doc.body, 'script', { + id: id, + src: settings.url, + type: 'text/javascript' + }); + + self.count++; + } + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/JSONRequest.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/JSONRequest.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,110 @@ +/** + * JSONRequest.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class enables you to use JSON-RPC to call backend methods. + * + * @class tinymce.util.JSONRequest + * @example + * var json = new tinymce.util.JSONRequest({ + * url: 'somebackend.php' + * }); + * + * // Send RPC call 1 + * json.send({ + * method: 'someMethod1', + * params: ['a', 'b'], + * success: function(result) { + * console.dir(result); + * } + * }); + * + * // Send RPC call 2 + * json.send({ + * method: 'someMethod2', + * params: ['a', 'b'], + * success: function(result) { + * console.dir(result); + * } + * }); + */ +define("tinymce/util/JSONRequest", [ + "tinymce/util/JSON", + "tinymce/util/XHR", + "tinymce/util/Tools" +], function(JSON, XHR, Tools) { + var extend = Tools.extend; + + function JSONRequest(settings) { + this.settings = extend({}, settings); + this.count = 0; + } + + /** + * Simple helper function to send a JSON-RPC request without the need to initialize an object. + * Consult the Wiki API documentation for more details on what you can pass to this function. + * + * @method sendRPC + * @static + * @param {Object} o Call object where there are three field id, method and params this object should also contain callbacks etc. + */ + JSONRequest.sendRPC = function(o) { + return new JSONRequest().send(o); + }; + + JSONRequest.prototype = { + /** + * Sends a JSON-RPC call. Consult the Wiki API documentation for more details on what you can pass to this function. + * + * @method send + * @param {Object} args Call object where there are three field id, method and params this object should also contain callbacks etc. + */ + send: function(args) { + var ecb = args.error, scb = args.success; + + args = extend(this.settings, args); + + args.success = function(c, x) { + c = JSON.parse(c); + + if (typeof c == 'undefined') { + c = { + error: 'JSON Parse error.' + }; + } + + if (c.error) { + ecb.call(args.error_scope || args.scope, c.error, x); + } else { + scb.call(args.success_scope || args.scope, c.result); + } + }; + + args.error = function(ty, x) { + if (ecb) { + ecb.call(args.error_scope || args.scope, ty, x); + } + }; + + args.data = JSON.serialize({ + id: args.id || 'c' + (this.count++), + method: args.method, + params: args.params + }); + + // JSON content type for Ruby on rails. Bug: #1883287 + args.content_type = 'application/json'; + + XHR.send(args); + } + }; + + return JSONRequest; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/LocalStorage.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/LocalStorage.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,213 @@ +/** + * LocalStorage.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class will simulate LocalStorage on IE 7 and return the native version on modern browsers. + * Storage is done using userData on IE 7 and a special serialization format. The format is designed + * to be as small as possible by making sure that the keys and values doesn't need to be encoded. This + * makes it possible to store for example HTML data. + * + * Storage format for userData: + * ,,,,... + * + * For example this data key1=value1,key2=value2 would be: + * 4,key1,6,value1,4,key2,6,value2 + * + * @class tinymce.util.LocalStorage + * @static + * @version 4.0 + * @example + * tinymce.util.LocalStorage.setItem('key', 'value'); + * var value = tinymce.util.LocalStorage.getItem('key'); + */ +define("tinymce/util/LocalStorage", [], function() { + var LocalStorage, storageElm, items, keys, userDataKey, hasOldIEDataSupport; + + // Check for native support + try { + if (window.localStorage) { + return localStorage; + } + } catch (ex) { + // Ignore + } + + userDataKey = "tinymce"; + storageElm = document.documentElement; + hasOldIEDataSupport = !!storageElm.addBehavior; + + if (hasOldIEDataSupport) { + storageElm.addBehavior('#default#userData'); + } + + /** + * Gets the keys names and updates LocalStorage.length property. Since IE7 doesn't have any getters/setters. + */ + function updateKeys() { + keys = []; + + for (var key in items) { + keys.push(key); + } + + LocalStorage.length = keys.length; + } + + /** + * Loads the userData string and parses it into the items structure. + */ + function load() { + var key, data, value, pos = 0; + + items = {}; + + // localStorage can be disabled on WebKit/Gecko so make a dummy storage + if (!hasOldIEDataSupport) { + return; + } + + function next(end) { + var value, nextPos; + + nextPos = end !== undefined ? pos + end : data.indexOf(',', pos); + if (nextPos === -1 || nextPos > data.length) { + return null; + } + + value = data.substring(pos, nextPos); + pos = nextPos + 1; + + return value; + } + + storageElm.load(userDataKey); + data = storageElm.getAttribute(userDataKey) || ''; + + do { + var offset = next(); + if (offset === null) { + break; + } + + key = next(parseInt(offset, 32) || 0); + if (key !== null) { + offset = next(); + if (offset === null) { + break; + } + + value = next(parseInt(offset, 32) || 0); + + if (key) { + items[key] = value; + } + } + } while (key !== null); + + updateKeys(); + } + + /** + * Saves the items structure into a the userData format. + */ + function save() { + var value, data = ''; + + // localStorage can be disabled on WebKit/Gecko so make a dummy storage + if (!hasOldIEDataSupport) { + return; + } + + for (var key in items) { + value = items[key]; + data += (data ? ',' : '') + key.length.toString(32) + ',' + key + ',' + value.length.toString(32) + ',' + value; + } + + storageElm.setAttribute(userDataKey, data); + + try { + storageElm.save(userDataKey); + } catch (ex) { + // Ignore disk full + } + + updateKeys(); + } + + LocalStorage = { + /** + * Length of the number of items in storage. + * + * @property length + * @type Number + * @return {Number} Number of items in storage. + */ + //length:0, + + /** + * Returns the key name by index. + * + * @method key + * @param {Number} index Index of key to return. + * @return {String} Key value or null if it wasn't found. + */ + key: function(index) { + return keys[index]; + }, + + /** + * Returns the value if the specified key or null if it wasn't found. + * + * @method getItem + * @param {String} key Key of item to retrive. + * @return {String} Value of the specified item or null if it wasn't found. + */ + getItem: function(key) { + return key in items ? items[key] : null; + }, + + /** + * Sets the value of the specified item by it's key. + * + * @method setItem + * @param {String} key Key of the item to set. + * @param {String} value Value of the item to set. + */ + setItem: function(key, value) { + items[key] = "" + value; + save(); + }, + + /** + * Removes the specified item by key. + * + * @method removeItem + * @param {String} key Key of item to remove. + */ + removeItem: function(key) { + delete items[key]; + save(); + }, + + /** + * Removes all items. + * + * @method clear + */ + clear: function() { + items = {}; + save(); + } + }; + + load(); + + return LocalStorage; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Observable.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Observable.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,129 @@ +/** + * Observable.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This mixin will add event binding logic to classes. + * + * @mixin tinymce.util.Observable + */ +define("tinymce/util/Observable", [ + "tinymce/util/EventDispatcher" +], function(EventDispatcher) { + function getEventDispatcher(obj) { + if (!obj._eventDispatcher) { + obj._eventDispatcher = new EventDispatcher({ + scope: obj, + toggleEvent: function(name, state) { + if (EventDispatcher.isNative(name) && obj.toggleNativeEvent) { + obj.toggleNativeEvent(name, state); + } + } + }); + } + + return obj._eventDispatcher; + } + + return { + /** + * Fires the specified event by name. + * + * @method fire + * @param {String} name Name of the event to fire. + * @param {Object?} args Event arguments. + * @param {Boolean?} bubble True/false if the event is to be bubbled. + * @return {Object} Event args instance passed in. + * @example + * instance.fire('event', {...}); + */ + fire: function(name, args, bubble) { + var self = this; + + // Prevent all events except the remove event after the instance has been removed + if (self.removed && name !== "remove") { + return args; + } + + args = getEventDispatcher(self).fire(name, args, bubble); + + // Bubble event up to parents + if (bubble !== false && self.parent) { + var parent = self.parent(); + while (parent && !args.isPropagationStopped()) { + parent.fire(name, args, false); + parent = parent.parent(); + } + } + + return args; + }, + + /** + * Binds an event listener to a specific event by name. + * + * @method on + * @param {String} name Event name or space separated list of events to bind. + * @param {callback} callback Callback to be executed when the event occurs. + * @param {Boolean} first Optional flag if the event should be prepended. Use this with care. + * @return {Object} Current class instance. + * @example + * instance.on('event', function(e) { + * // Callback logic + * }); + */ + on: function(name, callback, prepend) { + return getEventDispatcher(this).on(name, callback, prepend); + }, + + /** + * Unbinds an event listener to a specific event by name. + * + * @method off + * @param {String?} name Name of the event to unbind. + * @param {callback?} callback Callback to unbind. + * @return {Object} Current class instance. + * @example + * // Unbind specific callback + * instance.off('event', handler); + * + * // Unbind all listeners by name + * instance.off('event'); + * + * // Unbind all events + * instance.off(); + */ + off: function(name, callback) { + return getEventDispatcher(this).off(name, callback); + }, + + /** + * Bind the event callback and once it fires the callback is removed. + * + * @method once + * @param {String} name Name of the event to bind. + * @param {callback} callback Callback to bind only once. + * @return {Object} Current class instance. + */ + once: function(name, callback) { + return getEventDispatcher(this).once(name, callback); + }, + + /** + * Returns true/false if the object has a event of the specified name. + * + * @method hasEventListeners + * @param {String} name Name of the event to check for. + * @return {Boolean} true/false if the event exists or not. + */ + hasEventListeners: function(name) { + return getEventDispatcher(this).has(name); + } + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Quirks.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/classes/util/Quirks.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1577 @@ +/** + * Quirks.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + * + * @ignore-file + */ + +/** + * This file includes fixes for various browser quirks it's made to make it easy to add/remove browser specific fixes. + * + * @class tinymce.util.Quirks + */ +define("tinymce/util/Quirks", [ + "tinymce/util/VK", + "tinymce/dom/RangeUtils", + "tinymce/dom/TreeWalker", + "tinymce/html/Node", + "tinymce/html/Entities", + "tinymce/Env", + "tinymce/util/Tools" +], function(VK, RangeUtils, TreeWalker, Node, Entities, Env, Tools) { + return function(editor) { + var each = Tools.each, $ = editor.$; + var BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE, dom = editor.dom, selection = editor.selection, + settings = editor.settings, parser = editor.parser, serializer = editor.serializer; + var isGecko = Env.gecko, isIE = Env.ie, isWebKit = Env.webkit; + var mceInternalUrlPrefix = 'data:text/mce-internal,'; + var mceInternalDataType = isIE ? 'Text' : 'URL'; + + /** + * Executes a command with a specific state this can be to enable/disable browser editing features. + */ + function setEditorCommandState(cmd, state) { + try { + editor.getDoc().execCommand(cmd, false, state); + } catch (ex) { + // Ignore + } + } + + /** + * Returns current IE document mode. + */ + function getDocumentMode() { + var documentMode = editor.getDoc().documentMode; + + return documentMode ? documentMode : 6; + } + + /** + * Returns true/false if the event is prevented or not. + * + * @private + * @param {Event} e Event object. + * @return {Boolean} true/false if the event is prevented or not. + */ + function isDefaultPrevented(e) { + return e.isDefaultPrevented(); + } + + /** + * Sets Text/URL data on the event's dataTransfer object to a special data:text/mce-internal url. + * This is to workaround the inability to set custom contentType on IE and Safari. + * The editor's selected content is encoded into this url so drag and drop between editors will work. + * + * @private + * @param {DragEvent} e Event object + */ + function setMceInteralContent(e) { + var selectionHtml; + + if (e.dataTransfer) { + if (editor.selection.isCollapsed() && e.target.tagName == 'IMG') { + selection.select(e.target); + } + + selectionHtml = editor.selection.getContent(); + + // Safari/IE doesn't support custom dataTransfer items so we can only use URL and Text + if (selectionHtml.length > 0) { + e.dataTransfer.setData(mceInternalDataType, mceInternalUrlPrefix + escape(selectionHtml)); + } + } + } + + /** + * Gets content of special data:text/mce-internal url on the event's dataTransfer object. + * This is to workaround the inability to set custom contentType on IE and Safari. + * The editor's selected content is encoded into this url so drag and drop between editors will work. + * + * @private + * @param {DragEvent} e Event object + * @returns {String} mce-internal content + */ + function getMceInternalContent(e) { + var internalContent, content; + + if (e.dataTransfer) { + internalContent = e.dataTransfer.getData(mceInternalDataType); + + if (internalContent && internalContent.indexOf(mceInternalUrlPrefix) >= 0) { + content = unescape(internalContent.substr(mceInternalUrlPrefix.length)); + } + } + + return content; + } + + /** + * Inserts contents using the paste clipboard command if it's available if it isn't it will fallback + * to the core command. + * + * @private + * @param {String} content Content to insert at selection. + */ + function insertClipboardContents(content) { + if (editor.queryCommandSupported('mceInsertClipboardContent')) { + editor.execCommand('mceInsertClipboardContent', false, {content: content}); + } else { + editor.execCommand('mceInsertContent', false, content); + } + } + + /** + * Fixes a WebKit bug when deleting contents using backspace or delete key. + * WebKit will produce a span element if you delete across two block elements. + * + * Example: + *

    a

    |b

    + * + * Will produce this on backspace: + *

    ab

    + * + * This fixes the backspace to produce: + *

    a|b

    + * + * See bug: https://bugs.webkit.org/show_bug.cgi?id=45784 + * + * This fixes the following delete scenarios: + * 1. Delete by pressing backspace key. + * 2. Delete by pressing delete key. + * 3. Delete by pressing backspace key with ctrl/cmd (Word delete). + * 4. Delete by pressing delete key with ctrl/cmd (Word delete). + * 5. Delete by drag/dropping contents inside the editor. + * 6. Delete by using Cut Ctrl+X/Cmd+X. + * 7. Delete by selecting contents and writing a character. + * + * This code is a ugly hack since writing full custom delete logic for just this bug + * fix seemed like a huge task. I hope we can remove this before the year 2030. + */ + function cleanupStylesWhenDeleting() { + var doc = editor.getDoc(), dom = editor.dom, selection = editor.selection; + var MutationObserver = window.MutationObserver, olderWebKit, dragStartRng; + + // Add mini polyfill for older WebKits + // TODO: Remove this when old Safari versions gets updated + if (!MutationObserver) { + olderWebKit = true; + + MutationObserver = function() { + var records = [], target; + + function nodeInsert(e) { + var target = e.relatedNode || e.target; + records.push({target: target, addedNodes: [target]}); + } + + function attrModified(e) { + var target = e.relatedNode || e.target; + records.push({target: target, attributeName: e.attrName}); + } + + this.observe = function(node) { + target = node; + target.addEventListener('DOMSubtreeModified', nodeInsert, false); + target.addEventListener('DOMNodeInsertedIntoDocument', nodeInsert, false); + target.addEventListener('DOMNodeInserted', nodeInsert, false); + target.addEventListener('DOMAttrModified', attrModified, false); + }; + + this.disconnect = function() { + target.removeEventListener('DOMSubtreeModified', nodeInsert, false); + target.removeEventListener('DOMNodeInsertedIntoDocument', nodeInsert, false); + target.removeEventListener('DOMNodeInserted', nodeInsert, false); + target.removeEventListener('DOMAttrModified', attrModified, false); + }; + + this.takeRecords = function() { + return records; + }; + }; + } + + function isTrailingBr(node) { + var blockElements = dom.schema.getBlockElements(), rootNode = editor.getBody(); + + if (node.nodeName != 'BR') { + return false; + } + + for (node = node; node != rootNode && !blockElements[node.nodeName]; node = node.parentNode) { + if (node.nextSibling) { + return false; + } + } + + return true; + } + + function isSiblingsIgnoreWhiteSpace(node1, node2) { + var node; + + for (node = node1.nextSibling; node && node != node2; node = node.nextSibling) { + if (node.nodeType == 3 && $.trim(node.data).length === 0) { + continue; + } + + if (node !== node2) { + return false; + } + } + + return node === node2; + } + + function findCaretNode(node, forward, startNode) { + var walker, current, nonEmptyElements; + + nonEmptyElements = dom.schema.getNonEmptyElements(); + + walker = new TreeWalker(startNode || node, node); + + while ((current = walker[forward ? 'next' : 'prev']())) { + if (nonEmptyElements[current.nodeName] && !isTrailingBr(current)) { + return current; + } + + if (current.nodeType == 3 && current.data.length > 0) { + return current; + } + } + } + + function deleteRangeBetweenTextBlocks(rng) { + var startBlock, endBlock, caretNodeBefore, caretNodeAfter, textBlockElements; + + if (rng.collapsed) { + return; + } + + startBlock = dom.getParent(RangeUtils.getNode(rng.startContainer, rng.startOffset), dom.isBlock); + endBlock = dom.getParent(RangeUtils.getNode(rng.endContainer, rng.endOffset), dom.isBlock); + textBlockElements = editor.schema.getTextBlockElements(); + + if (startBlock == endBlock) { + return; + } + + if (!textBlockElements[startBlock.nodeName] || !textBlockElements[endBlock.nodeName]) { + return; + } + + if (dom.getContentEditable(startBlock) === "false" || dom.getContentEditable(endBlock) === "false") { + return; + } + + rng.deleteContents(); + + caretNodeBefore = findCaretNode(startBlock, false); + caretNodeAfter = findCaretNode(endBlock, true); + + if (!dom.isEmpty(endBlock)) { + $(startBlock).append(endBlock.childNodes); + } + + $(endBlock).remove(); + + if (caretNodeBefore) { + if (caretNodeBefore.nodeType == 1) { + if (caretNodeBefore.nodeName == "BR") { + rng.setStartBefore(caretNodeBefore); + rng.setEndBefore(caretNodeBefore); + } else { + rng.setStartAfter(caretNodeBefore); + rng.setEndAfter(caretNodeBefore); + } + } else { + rng.setStart(caretNodeBefore, caretNodeBefore.data.length); + rng.setEnd(caretNodeBefore, caretNodeBefore.data.length); + } + } else if (caretNodeAfter) { + if (caretNodeAfter.nodeType == 1) { + rng.setStartBefore(caretNodeAfter); + rng.setEndBefore(caretNodeAfter); + } else { + rng.setStart(caretNodeAfter, 0); + rng.setEnd(caretNodeAfter, 0); + } + } + + selection.setRng(rng); + + return true; + } + + function expandBetweenBlocks(rng, isForward) { + var caretNode, targetCaretNode, textBlock, targetTextBlock, container, offset; + + if (!rng.collapsed) { + return rng; + } + + container = rng.startContainer; + offset = rng.startOffset; + + if (container.nodeType == 3) { + if (isForward) { + if (offset < container.data.length) { + return rng; + } + } else { + if (offset > 0) { + return rng; + } + } + } + + caretNode = RangeUtils.getNode(rng.startContainer, rng.startOffset); + textBlock = dom.getParent(caretNode, dom.isBlock); + targetCaretNode = findCaretNode(editor.getBody(), isForward, caretNode); + targetTextBlock = dom.getParent(targetCaretNode, dom.isBlock); + + if (!caretNode || !targetCaretNode) { + return rng; + } + + if (targetTextBlock && textBlock != targetTextBlock) { + if (!isForward) { + if (!isSiblingsIgnoreWhiteSpace(targetTextBlock, textBlock)) { + return rng; + } + + if (targetCaretNode.nodeType == 1) { + if (targetCaretNode.nodeName == "BR") { + rng.setStartBefore(targetCaretNode); + } else { + rng.setStartAfter(targetCaretNode); + } + } else { + rng.setStart(targetCaretNode, targetCaretNode.data.length); + } + + if (caretNode.nodeType == 1) { + rng.setEnd(caretNode, 0); + } else { + rng.setEndBefore(caretNode); + } + } else { + if (!isSiblingsIgnoreWhiteSpace(textBlock, targetTextBlock)) { + return rng; + } + + if (caretNode.nodeType == 1) { + if (caretNode.nodeName == "BR") { + rng.setStartBefore(caretNode); + } else { + rng.setStartAfter(caretNode); + } + } else { + rng.setStart(caretNode, caretNode.data.length); + } + + if (targetCaretNode.nodeType == 1) { + rng.setEnd(targetCaretNode, 0); + } else { + rng.setEndBefore(targetCaretNode); + } + } + } + + return rng; + } + + function handleTextBlockMergeDelete(isForward) { + var rng = selection.getRng(); + + rng = expandBetweenBlocks(rng, isForward); + + if (deleteRangeBetweenTextBlocks(rng)) { + return true; + } + } + + function customDelete(isForward) { + var mutationObserver, rng, caretElement; + + if (handleTextBlockMergeDelete(isForward)) { + return; + } + + Tools.each(editor.getBody().getElementsByTagName('*'), function(elm) { + // Mark existing spans + if (elm.tagName == 'SPAN') { + elm.setAttribute('mce-data-marked', 1); + } + + // Make sure all elements has a data-mce-style attribute + if (!elm.hasAttribute('data-mce-style') && elm.hasAttribute('style')) { + editor.dom.setAttrib(elm, 'style', editor.dom.getAttrib(elm, 'style')); + } + }); + + // Observe added nodes and style attribute changes + mutationObserver = new MutationObserver(function() {}); + mutationObserver.observe(editor.getDoc(), { + childList: true, + attributes: true, + subtree: true, + attributeFilter: ['style'] + }); + + editor.getDoc().execCommand(isForward ? 'ForwardDelete' : 'Delete', false, null); + + rng = editor.selection.getRng(); + caretElement = rng.startContainer.parentNode; + + Tools.each(mutationObserver.takeRecords(), function(record) { + if (!dom.isChildOf(record.target, editor.getBody())) { + return; + } + + // Restore style attribute to previous value + if (record.attributeName == "style") { + var oldValue = record.target.getAttribute('data-mce-style'); + + if (oldValue) { + record.target.setAttribute("style", oldValue); + } else { + record.target.removeAttribute("style"); + } + } + + // Remove all spans that isn't maked and retain selection + Tools.each(record.addedNodes, function(node) { + if (node.nodeName == "SPAN" && !node.getAttribute('mce-data-marked')) { + var offset, container; + + if (node == caretElement) { + offset = rng.startOffset; + container = node.firstChild; + } + + dom.remove(node, true); + + if (container) { + rng.setStart(container, offset); + rng.setEnd(container, offset); + editor.selection.setRng(rng); + } + } + }); + }); + + mutationObserver.disconnect(); + + // Remove any left over marks + Tools.each(editor.dom.select('span[mce-data-marked]'), function(span) { + span.removeAttribute('mce-data-marked'); + }); + } + + editor.on('keydown', function(e) { + var isForward = e.keyCode == DELETE, isMetaOrCtrl = e.ctrlKey || e.metaKey; + + if (!isDefaultPrevented(e) && (isForward || e.keyCode == BACKSPACE)) { + var rng = editor.selection.getRng(), container = rng.startContainer, offset = rng.startOffset; + + // Ignore non meta delete in the where there is text before/after the caret + if (!isMetaOrCtrl && rng.collapsed && container.nodeType == 3) { + if (isForward ? offset < container.data.length : offset > 0) { + return; + } + } + + e.preventDefault(); + + if (isMetaOrCtrl) { + editor.selection.getSel().modify("extend", isForward ? "forward" : "backward", e.metaKey ? "lineboundary" : "word"); + } + + customDelete(isForward); + } + }); + + // Handle case where text is deleted by typing over + editor.on('keypress', function(e) { + if (!isDefaultPrevented(e) && !selection.isCollapsed() && e.charCode && !VK.metaKeyPressed(e)) { + var rng, currentFormatNodes, fragmentNode, blockParent, caretNode, charText; + + rng = editor.selection.getRng(); + charText = String.fromCharCode(e.charCode); + e.preventDefault(); + + // Keep track of current format nodes + currentFormatNodes = $(rng.startContainer).parents().filter(function(idx, node) { + return !!editor.schema.getTextInlineElements()[node.nodeName]; + }); + + customDelete(true); + + // Check if the browser removed them + currentFormatNodes = currentFormatNodes.filter(function(idx, node) { + return !$.contains(editor.getBody(), node); + }); + + // Then re-add them + if (currentFormatNodes.length) { + fragmentNode = dom.createFragment(); + + currentFormatNodes.each(function(idx, formatNode) { + formatNode = formatNode.cloneNode(false); + + if (fragmentNode.hasChildNodes()) { + formatNode.appendChild(fragmentNode.firstChild); + fragmentNode.appendChild(formatNode); + } else { + caretNode = formatNode; + fragmentNode.appendChild(formatNode); + } + + fragmentNode.appendChild(formatNode); + }); + + caretNode.appendChild(editor.getDoc().createTextNode(charText)); + + // Prevent edge case where older WebKit would add an extra BR element + blockParent = dom.getParent(rng.startContainer, dom.isBlock); + if (dom.isEmpty(blockParent)) { + $(blockParent).empty().append(fragmentNode); + } else { + rng.insertNode(fragmentNode); + } + + rng.setStart(caretNode.firstChild, 1); + rng.setEnd(caretNode.firstChild, 1); + editor.selection.setRng(rng); + } else { + editor.selection.setContent(charText); + } + } + }); + + editor.addCommand('Delete', function() { + customDelete(); + }); + + editor.addCommand('ForwardDelete', function() { + customDelete(true); + }); + + // Older WebKits doesn't properly handle the clipboard so we can't add the rest + if (olderWebKit) { + return; + } + + editor.on('dragstart', function(e) { + dragStartRng = selection.getRng(); + setMceInteralContent(e); + }); + + editor.on('drop', function(e) { + if (!isDefaultPrevented(e)) { + var internalContent = getMceInternalContent(e); + if (internalContent) { + e.preventDefault(); + + // Safari has a weird issue where drag/dropping images sometimes + // produces a green plus icon. When this happens the caretRangeFromPoint + // will return "null" even though the x, y coordinate is correct. + // But if we detach the insert from the drop event we will get a proper range + window.setTimeout(function() { + var pointRng = RangeUtils.getCaretRangeFromPoint(e.x, e.y, doc); + + if (dragStartRng) { + selection.setRng(dragStartRng); + dragStartRng = null; + } + + customDelete(); + selection.setRng(pointRng); + insertClipboardContents(internalContent); + }, 0); + } + } + }); + + editor.on('cut', function(e) { + if (!isDefaultPrevented(e) && e.clipboardData) { + e.preventDefault(); + e.clipboardData.clearData(); + e.clipboardData.setData('text/html', editor.selection.getContent()); + e.clipboardData.setData('text/plain', editor.selection.getContent({format: 'text'})); + customDelete(true); + } + }); + } + + /** + * Makes sure that the editor body becomes empty when backspace or delete is pressed in empty editors. + * + * For example: + *

    |

    + * + * Or: + *

    |

    + * + * Or: + * [

    ] + */ + function emptyEditorWhenDeleting() { + function serializeRng(rng) { + var body = dom.create("body"); + var contents = rng.cloneContents(); + body.appendChild(contents); + return selection.serializer.serialize(body, {format: 'html'}); + } + + function allContentsSelected(rng) { + if (!rng.setStart) { + if (rng.item) { + return false; + } + + var bodyRng = rng.duplicate(); + bodyRng.moveToElementText(editor.getBody()); + return RangeUtils.compareRanges(rng, bodyRng); + } + + var selection = serializeRng(rng); + + var allRng = dom.createRng(); + allRng.selectNode(editor.getBody()); + + var allSelection = serializeRng(allRng); + return selection === allSelection; + } + + editor.on('keydown', function(e) { + var keyCode = e.keyCode, isCollapsed, body; + + // Empty the editor if it's needed for example backspace at

    |

    + if (!isDefaultPrevented(e) && (keyCode == DELETE || keyCode == BACKSPACE)) { + isCollapsed = editor.selection.isCollapsed(); + body = editor.getBody(); + + // Selection is collapsed but the editor isn't empty + if (isCollapsed && !dom.isEmpty(body)) { + return; + } + + // Selection isn't collapsed but not all the contents is selected + if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) { + return; + } + + // Manually empty the editor + e.preventDefault(); + editor.setContent(''); + + if (body.firstChild && dom.isBlock(body.firstChild)) { + editor.selection.setCursorLocation(body.firstChild, 0); + } else { + editor.selection.setCursorLocation(body, 0); + } + + editor.nodeChanged(); + } + }); + } + + /** + * WebKit doesn't select all the nodes in the body when you press Ctrl+A. + * IE selects more than the contents [

    a

    ] instead of

    [a] see bug #6438 + * This selects the whole body so that backspace/delete logic will delete everything + */ + function selectAll() { + editor.shortcuts.add('meta+a', null, 'SelectAll'); + } + + /** + * WebKit has a weird issue where it some times fails to properly convert keypresses to input method keystrokes. + * The IME on Mac doesn't initialize when it doesn't fire a proper focus event. + * + * This seems to happen when the user manages to click the documentElement element then the window doesn't get proper focus until + * you enter a character into the editor. + * + * It also happens when the first focus in made to the body. + * + * See: https://bugs.webkit.org/show_bug.cgi?id=83566 + */ + function inputMethodFocus() { + if (!editor.settings.content_editable) { + // Case 1 IME doesn't initialize if you focus the document + dom.bind(editor.getDoc(), 'focusin', function() { + selection.setRng(selection.getRng()); + }); + + // Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event + // Needs to be both down/up due to weird rendering bug on Chrome Windows + dom.bind(editor.getDoc(), 'mousedown mouseup', function(e) { + if (e.target == editor.getDoc().documentElement) { + editor.getBody().focus(); + + if (e.type == 'mousedown') { + // Edge case for mousedown, drag select and mousedown again within selection on Chrome Windows to render caret + selection.placeCaretAt(e.clientX, e.clientY); + } else { + selection.setRng(selection.getRng()); + } + } + }); + } + } + + /** + * Backspacing in FireFox/IE from a paragraph into a horizontal rule results in a floating text node because the + * browser just deletes the paragraph - the browser fails to merge the text node with a horizontal rule so it is + * left there. TinyMCE sees a floating text node and wraps it in a paragraph on the key up event (ForceBlocks.js + * addRootBlocks), meaning the action does nothing. With this code, FireFox/IE matche the behaviour of other + * browsers. + * + * It also fixes a bug on Firefox where it's impossible to delete HR elements. + */ + function removeHrOnBackspace() { + editor.on('keydown', function(e) { + if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) { + // Check if there is any HR elements this is faster since getRng on IE 7 & 8 is slow + if (!editor.getBody().getElementsByTagName('hr').length) { + return; + } + + if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) { + var node = selection.getNode(); + var previousSibling = node.previousSibling; + + if (node.nodeName == 'HR') { + dom.remove(node); + e.preventDefault(); + return; + } + + if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "hr") { + dom.remove(previousSibling); + e.preventDefault(); + } + } + } + }); + } + + /** + * Firefox 3.x has an issue where the body element won't get proper focus if you click out + * side it's rectangle. + */ + function focusBody() { + // Fix for a focus bug in FF 3.x where the body element + // wouldn't get proper focus if the user clicked on the HTML element + if (!window.Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4 + editor.on('mousedown', function(e) { + if (!isDefaultPrevented(e) && e.target.nodeName === "HTML") { + var body = editor.getBody(); + + // Blur the body it's focused but not correctly focused + body.blur(); + + // Refocus the body after a little while + setTimeout(function() { + body.focus(); + }, 0); + } + }); + } + } + + /** + * WebKit has a bug where it isn't possible to select image, hr or anchor elements + * by clicking on them so we need to fake that. + */ + function selectControlElements() { + editor.on('click', function(e) { + var target = e.target; + + // Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250 + // WebKit can't even do simple things like selecting an image + // Needs to be the setBaseAndExtend or it will fail to select floated images + if (/^(IMG|HR)$/.test(target.nodeName)) { + e.preventDefault(); + selection.getSel().setBaseAndExtent(target, 0, target, 1); + editor.nodeChanged(); + } + + if (target.nodeName == 'A' && dom.hasClass(target, 'mce-item-anchor')) { + e.preventDefault(); + selection.select(target); + } + }); + } + + /** + * Fixes a Gecko bug where the style attribute gets added to the wrong element when deleting between two block elements. + * + * Fixes do backspace/delete on this: + *

    bla[ck

    r]ed

    + * + * Would become: + *

    bla|ed

    + * + * Instead of: + *

    bla|ed

    + */ + function removeStylesWhenDeletingAcrossBlockElements() { + function getAttributeApplyFunction() { + var template = dom.getAttribs(selection.getStart().cloneNode(false)); + + return function() { + var target = selection.getStart(); + + if (target !== editor.getBody()) { + dom.setAttrib(target, "style", null); + + each(template, function(attr) { + target.setAttributeNode(attr.cloneNode(true)); + }); + } + }; + } + + function isSelectionAcrossElements() { + return !selection.isCollapsed() && + dom.getParent(selection.getStart(), dom.isBlock) != dom.getParent(selection.getEnd(), dom.isBlock); + } + + editor.on('keypress', function(e) { + var applyAttributes; + + if (!isDefaultPrevented(e) && (e.keyCode == 8 || e.keyCode == 46) && isSelectionAcrossElements()) { + applyAttributes = getAttributeApplyFunction(); + editor.getDoc().execCommand('delete', false, null); + applyAttributes(); + e.preventDefault(); + return false; + } + }); + + dom.bind(editor.getDoc(), 'cut', function(e) { + var applyAttributes; + + if (!isDefaultPrevented(e) && isSelectionAcrossElements()) { + applyAttributes = getAttributeApplyFunction(); + + setTimeout(function() { + applyAttributes(); + }, 0); + } + }); + } + + /** + * Screen readers on IE needs to have the role application set on the body. + */ + function ensureBodyHasRoleApplication() { + document.body.setAttribute("role", "application"); + } + + /** + * Backspacing into a table behaves differently depending upon browser type. + * Therefore, disable Backspace when cursor immediately follows a table. + */ + function disableBackspaceIntoATable() { + editor.on('keydown', function(e) { + if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) { + if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) { + var previousSibling = selection.getNode().previousSibling; + if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "table") { + e.preventDefault(); + return false; + } + } + } + }); + } + + /** + * Old IE versions can't properly render BR elements in PRE tags white in contentEditable mode. So this + * logic adds a \n before the BR so that it will get rendered. + */ + function addNewLinesBeforeBrInPre() { + // IE8+ rendering mode does the right thing with BR in PRE + if (getDocumentMode() > 7) { + return; + } + + // Enable display: none in area and add a specific class that hides all BR elements in PRE to + // avoid the caret from getting stuck at the BR elements while pressing the right arrow key + setEditorCommandState('RespectVisibilityInDesign', true); + editor.contentStyles.push('.mceHideBrInPre pre br {display: none}'); + dom.addClass(editor.getBody(), 'mceHideBrInPre'); + + // Adds a \n before all BR elements in PRE to get them visual + parser.addNodeFilter('pre', function(nodes) { + var i = nodes.length, brNodes, j, brElm, sibling; + + while (i--) { + brNodes = nodes[i].getAll('br'); + j = brNodes.length; + while (j--) { + brElm = brNodes[j]; + + // Add \n before BR in PRE elements on older IE:s so the new lines get rendered + sibling = brElm.prev; + if (sibling && sibling.type === 3 && sibling.value.charAt(sibling.value - 1) != '\n') { + sibling.value += '\n'; + } else { + brElm.parent.insert(new Node('#text', 3), brElm, true).value = '\n'; + } + } + } + }); + + // Removes any \n before BR elements in PRE since other browsers and in contentEditable=false mode they will be visible + serializer.addNodeFilter('pre', function(nodes) { + var i = nodes.length, brNodes, j, brElm, sibling; + + while (i--) { + brNodes = nodes[i].getAll('br'); + j = brNodes.length; + while (j--) { + brElm = brNodes[j]; + sibling = brElm.prev; + if (sibling && sibling.type == 3) { + sibling.value = sibling.value.replace(/\r?\n$/, ''); + } + } + } + }); + } + + /** + * Moves style width/height to attribute width/height when the user resizes an image on IE. + */ + function removePreSerializedStylesWhenSelectingControls() { + dom.bind(editor.getBody(), 'mouseup', function() { + var value, node = selection.getNode(); + + // Moved styles to attributes on IMG eements + if (node.nodeName == 'IMG') { + // Convert style width to width attribute + if ((value = dom.getStyle(node, 'width'))) { + dom.setAttrib(node, 'width', value.replace(/[^0-9%]+/g, '')); + dom.setStyle(node, 'width', ''); + } + + // Convert style height to height attribute + if ((value = dom.getStyle(node, 'height'))) { + dom.setAttrib(node, 'height', value.replace(/[^0-9%]+/g, '')); + dom.setStyle(node, 'height', ''); + } + } + }); + } + + /** + * Removes a blockquote when backspace is pressed at the beginning of it. + * + * For example: + *

    |x

    + * + * Becomes: + *

    |x

    + */ + function removeBlockQuoteOnBackSpace() { + // Add block quote deletion handler + editor.on('keydown', function(e) { + var rng, container, offset, root, parent; + + if (isDefaultPrevented(e) || e.keyCode != VK.BACKSPACE) { + return; + } + + rng = selection.getRng(); + container = rng.startContainer; + offset = rng.startOffset; + root = dom.getRoot(); + parent = container; + + if (!rng.collapsed || offset !== 0) { + return; + } + + while (parent && parent.parentNode && parent.parentNode.firstChild == parent && parent.parentNode != root) { + parent = parent.parentNode; + } + + // Is the cursor at the beginning of a blockquote? + if (parent.tagName === 'BLOCKQUOTE') { + // Remove the blockquote + editor.formatter.toggle('blockquote', null, parent); + + // Move the caret to the beginning of container + rng = dom.createRng(); + rng.setStart(container, 0); + rng.setEnd(container, 0); + selection.setRng(rng); + } + }); + } + + /** + * Sets various Gecko editing options on mouse down and before a execCommand to disable inline table editing that is broken etc. + */ + function setGeckoEditingOptions() { + function setOpts() { + editor._refreshContentEditable(); + + setEditorCommandState("StyleWithCSS", false); + setEditorCommandState("enableInlineTableEditing", false); + + if (!settings.object_resizing) { + setEditorCommandState("enableObjectResizing", false); + } + } + + if (!settings.readonly) { + editor.on('BeforeExecCommand MouseDown', setOpts); + } + } + + /** + * Fixes a gecko link bug, when a link is placed at the end of block elements there is + * no way to move the caret behind the link. This fix adds a bogus br element after the link. + * + * For example this: + *

    x

    + * + * Becomes this: + *

    x

    + */ + function addBrAfterLastLinks() { + function fixLinks() { + each(dom.select('a'), function(node) { + var parentNode = node.parentNode, root = dom.getRoot(); + + if (parentNode.lastChild === node) { + while (parentNode && !dom.isBlock(parentNode)) { + if (parentNode.parentNode.lastChild !== parentNode || parentNode === root) { + return; + } + + parentNode = parentNode.parentNode; + } + + dom.add(parentNode, 'br', {'data-mce-bogus': 1}); + } + }); + } + + editor.on('SetContent ExecCommand', function(e) { + if (e.type == "setcontent" || e.command === 'mceInsertLink') { + fixLinks(); + } + }); + } + + /** + * WebKit will produce DIV elements here and there by default. But since TinyMCE uses paragraphs by + * default we want to change that behavior. + */ + function setDefaultBlockType() { + if (settings.forced_root_block) { + editor.on('init', function() { + setEditorCommandState('DefaultParagraphSeparator', settings.forced_root_block); + }); + } + } + + /** + * Removes ghost selections from images/tables on Gecko. + */ + function removeGhostSelection() { + editor.on('Undo Redo SetContent', function(e) { + if (!e.initial) { + editor.execCommand('mceRepaint'); + } + }); + } + + /** + * Deletes the selected image on IE instead of navigating to previous page. + */ + function deleteControlItemOnBackSpace() { + editor.on('keydown', function(e) { + var rng; + + if (!isDefaultPrevented(e) && e.keyCode == BACKSPACE) { + rng = editor.getDoc().selection.createRange(); + if (rng && rng.item) { + e.preventDefault(); + editor.undoManager.beforeChange(); + dom.remove(rng.item(0)); + editor.undoManager.add(); + } + } + }); + } + + /** + * IE10 doesn't properly render block elements with the right height until you add contents to them. + * This fixes that by adding a padding-right to all empty text block elements. + * See: https://connect.microsoft.com/IE/feedback/details/743881 + */ + function renderEmptyBlocksFix() { + var emptyBlocksCSS; + + // IE10+ + if (getDocumentMode() >= 10) { + emptyBlocksCSS = ''; + each('p div h1 h2 h3 h4 h5 h6'.split(' '), function(name, i) { + emptyBlocksCSS += (i > 0 ? ',' : '') + name + ':empty'; + }); + + editor.contentStyles.push(emptyBlocksCSS + '{padding-right: 1px !important}'); + } + } + + /** + * Old IE versions can't retain contents within noscript elements so this logic will store the contents + * as a attribute and the insert that value as it's raw text when the DOM is serialized. + */ + function keepNoScriptContents() { + if (getDocumentMode() < 9) { + parser.addNodeFilter('noscript', function(nodes) { + var i = nodes.length, node, textNode; + + while (i--) { + node = nodes[i]; + textNode = node.firstChild; + + if (textNode) { + node.attr('data-mce-innertext', textNode.value); + } + } + }); + + serializer.addNodeFilter('noscript', function(nodes) { + var i = nodes.length, node, textNode, value; + + while (i--) { + node = nodes[i]; + textNode = nodes[i].firstChild; + + if (textNode) { + textNode.value = Entities.decode(textNode.value); + } else { + // Old IE can't retain noscript value so an attribute is used to store it + value = node.attributes.map['data-mce-innertext']; + if (value) { + node.attr('data-mce-innertext', null); + textNode = new Node('#text', 3); + textNode.value = value; + textNode.raw = true; + node.append(textNode); + } + } + } + }); + } + } + + /** + * IE has an issue where you can't select/move the caret by clicking outside the body if the document is in standards mode. + */ + function fixCaretSelectionOfDocumentElementOnIe() { + var doc = dom.doc, body = doc.body, started, startRng, htmlElm; + + // Return range from point or null if it failed + function rngFromPoint(x, y) { + var rng = body.createTextRange(); + + try { + rng.moveToPoint(x, y); + } catch (ex) { + // IE sometimes throws and exception, so lets just ignore it + rng = null; + } + + return rng; + } + + // Fires while the selection is changing + function selectionChange(e) { + var pointRng; + + // Check if the button is down or not + if (e.button) { + // Create range from mouse position + pointRng = rngFromPoint(e.x, e.y); + + if (pointRng) { + // Check if pointRange is before/after selection then change the endPoint + if (pointRng.compareEndPoints('StartToStart', startRng) > 0) { + pointRng.setEndPoint('StartToStart', startRng); + } else { + pointRng.setEndPoint('EndToEnd', startRng); + } + + pointRng.select(); + } + } else { + endSelection(); + } + } + + // Removes listeners + function endSelection() { + var rng = doc.selection.createRange(); + + // If the range is collapsed then use the last start range + if (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0) { + startRng.select(); + } + + dom.unbind(doc, 'mouseup', endSelection); + dom.unbind(doc, 'mousemove', selectionChange); + startRng = started = 0; + } + + // Make HTML element unselectable since we are going to handle selection by hand + doc.documentElement.unselectable = true; + + // Detect when user selects outside BODY + dom.bind(doc, 'mousedown contextmenu', function(e) { + if (e.target.nodeName === 'HTML') { + if (started) { + endSelection(); + } + + // Detect vertical scrollbar, since IE will fire a mousedown on the scrollbar and have target set as HTML + htmlElm = doc.documentElement; + if (htmlElm.scrollHeight > htmlElm.clientHeight) { + return; + } + + started = 1; + // Setup start position + startRng = rngFromPoint(e.x, e.y); + if (startRng) { + // Listen for selection change events + dom.bind(doc, 'mouseup', endSelection); + dom.bind(doc, 'mousemove', selectionChange); + + dom.getRoot().focus(); + startRng.select(); + } + } + }); + } + + /** + * Fixes selection issues where the caret can be placed between two inline elements like a|b + * this fix will lean the caret right into the closest inline element. + */ + function normalizeSelection() { + // Normalize selection for example a|a becomes a|a except for Ctrl+A since it selects everything + editor.on('keyup focusin mouseup', function(e) { + if (e.keyCode != 65 || !VK.metaKeyPressed(e)) { + selection.normalize(); + } + }, true); + } + + /** + * Forces Gecko to render a broken image icon if it fails to load an image. + */ + function showBrokenImageIcon() { + editor.contentStyles.push( + 'img:-moz-broken {' + + '-moz-force-broken-image-icon:1;' + + 'min-width:24px;' + + 'min-height:24px' + + '}' + ); + } + + /** + * iOS has a bug where it's impossible to type if the document has a touchstart event + * bound and the user touches the document while having the on screen keyboard visible. + * + * The touch event moves the focus to the parent document while having the caret inside the iframe + * this fix moves the focus back into the iframe document. + */ + function restoreFocusOnKeyDown() { + if (!editor.inline) { + editor.on('keydown', function() { + if (document.activeElement == document.body) { + editor.getWin().focus(); + } + }); + } + } + + /** + * IE 11 has an annoying issue where you can't move focus into the editor + * by clicking on the white area HTML element. We used to be able to to fix this with + * the fixCaretSelectionOfDocumentElementOnIe fix. But since M$ removed the selection + * object it's not possible anymore. So we need to hack in a ungly CSS to force the + * body to be at least 150px. If the user clicks the HTML element out side this 150px region + * we simply move the focus into the first paragraph. Not ideal since you loose the + * positioning of the caret but goot enough for most cases. + */ + function bodyHeight() { + if (!editor.inline) { + editor.contentStyles.push('body {min-height: 150px}'); + editor.on('click', function(e) { + if (e.target.nodeName == 'HTML') { + var rng; + + // Need to store away non collapsed ranges since the focus call will mess that up see #7382 + rng = editor.selection.getRng(); + editor.getBody().focus(); + editor.selection.setRng(rng); + editor.selection.normalize(); + editor.nodeChanged(); + } + }); + } + } + + /** + * Firefox on Mac OS will move the browser back to the previous page if you press CMD+Left arrow. + * You might then loose all your work so we need to block that behavior and replace it with our own. + */ + function blockCmdArrowNavigation() { + if (Env.mac) { + editor.on('keydown', function(e) { + if (VK.metaKeyPressed(e) && (e.keyCode == 37 || e.keyCode == 39)) { + e.preventDefault(); + editor.selection.getSel().modify('move', e.keyCode == 37 ? 'backward' : 'forward', 'lineboundary'); + } + }); + } + } + + /** + * Disables the autolinking in IE 9+ this is then re-enabled by the autolink plugin. + */ + function disableAutoUrlDetect() { + setEditorCommandState("AutoUrlDetect", false); + } + + /** + * IE 11 has a fantastic bug where it will produce two trailing BR elements to iframe bodies when + * the iframe is hidden by display: none on a parent container. The DOM is actually out of sync + * with innerHTML in this case. It's like IE adds shadow DOM BR elements that appears on innerHTML + * but not as the lastChild of the body. However is we add a BR element to the body then remove it + * it doesn't seem to add these BR elements makes sence right?! + * + * Example of what happens: text becomes text

    + */ + function doubleTrailingBrElements() { + if (!editor.inline) { + editor.on('focus blur beforegetcontent', function() { + var br = editor.dom.create('br'); + editor.getBody().appendChild(br); + br.parentNode.removeChild(br); + }, true); + } + } + + /** + * iOS 7.1 introduced two new bugs: + * 1) It's possible to open links within a contentEditable area by clicking on them. + * 2) If you hold down the finger it will display the link/image touch callout menu. + */ + function tapLinksAndImages() { + editor.on('click', function(e) { + var elm = e.target; + + do { + if (elm.tagName === 'A') { + e.preventDefault(); + return; + } + } while ((elm = elm.parentNode)); + }); + + editor.contentStyles.push('.mce-content-body {-webkit-touch-callout: none}'); + } + + /** + * iOS Safari and possible other browsers have a bug where it won't fire + * a click event when a contentEditable is focused. This function fakes click events + * by using touchstart/touchend and measuring the time and distance travelled. + */ + function touchClickEvent() { + editor.on('touchstart', function(e) { + var elm, time, startTouch, changedTouches; + + elm = e.target; + time = new Date().getTime(); + changedTouches = e.changedTouches; + + if (!changedTouches || changedTouches.length > 1) { + return; + } + + startTouch = changedTouches[0]; + + editor.once('touchend', function(e) { + var endTouch = e.changedTouches[0], args; + + if (new Date().getTime() - time > 500) { + return; + } + + if (Math.abs(startTouch.clientX - endTouch.clientX) > 5) { + return; + } + + if (Math.abs(startTouch.clientY - endTouch.clientY) > 5) { + return; + } + + args = { + target: elm + }; + + each('pageX pageY clientX clientY screenX screenY'.split(' '), function(key) { + args[key] = endTouch[key]; + }); + + args = editor.fire('click', args); + + if (!args.isDefaultPrevented()) { + // iOS WebKit can't place the caret properly once + // you bind touch events so we need to do this manually + // TODO: Expand to the closest word? Touble tap still works. + editor.selection.placeCaretAt(endTouch.clientX, endTouch.clientY); + editor.nodeChanged(); + } + }); + }); + } + + /** + * WebKit has a bug where it will allow forms to be submitted if they are inside a contentEditable element. + * For example this:
    + + \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/example/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/example/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,68 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*jshint unused:false */ +/*global tinymce:true */ + +/** + * Example plugin that adds a toolbar button and menu item. + */ +tinymce.PluginManager.add('example', function(editor, url) { + // Add a button that opens a window + editor.addButton('example', { + text: 'My button', + icon: false, + onclick: function() { + // Open window + editor.windowManager.open({ + title: 'Example plugin', + body: [ + {type: 'textbox', name: 'title', label: 'Title'} + ], + onsubmit: function(e) { + // Insert content when the window form is submitted + editor.insertContent('Title: ' + e.data.title); + } + }); + } + }); + + // Adds a menu item to the tools menu + editor.addMenuItem('example', { + text: 'Example plugin', + context: 'tools', + onclick: function() { + // Open window with a specific url + editor.windowManager.open({ + title: 'TinyMCE site', + url: url + '/dialog.html', + width: 600, + height: 400, + buttons: [ + { + text: 'Insert', + onclick: function() { + // Top most window object + var win = editor.windowManager.getWindows()[0]; + + // Insert the contents of the dialog.html textarea into the editor + editor.insertContent(win.getContentWindow().document.getElementById('content').value); + + // Close the window + win.close(); + } + }, + + {text: 'Close', onclick: 'close'} + ] + }); + } + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/example/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/example/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("example",function(b,a){b.addButton("example",{text:"My button",icon:false,onclick:function(){b.windowManager.open({title:"Example plugin",body:[{type:"textbox",name:"title",label:"Title"}],onsubmit:function(c){b.insertContent("Title: "+c.data.title)}})}});b.addMenuItem("example",{text:"Example plugin",context:"tools",onclick:function(){b.windowManager.open({title:"TinyMCE site",url:a+"/dialog.html",width:600,height:400,buttons:[{text:"Insert",onclick:function(){var c=b.windowManager.getWindows()[0];b.insertContent(c.getContentWindow().document.getElementById("content").value);c.close()}},{text:"Close",onclick:"close"}]})}})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/example_dependency/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/example_dependency/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,22 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*jshint unused:false */ +/*global tinymce:true */ + +/** + * Register the plugin, specifying the list of the plugins that this plugin depends on. They are specified in a list, + * with the list loaded in order. plugins in this list will be initialised when this plugin is initialized. (before the + * init method is called). plugins in a depends list should typically be specified using the short name). If necessary + * this can be done with an object which has the url to the plugin and the shortname. + */ +tinymce.PluginManager.add('example_dependency', function() { + // Example logic here +}, ['example']); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/example_dependency/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/example_dependency/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("example_dependency",function(){},["example"]); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/fullpage/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/fullpage/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,490 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +tinymce.PluginManager.add('fullpage', function(editor) { + var each = tinymce.each, Node = tinymce.html.Node; + var head, foot; + + function showDialog() { + var data = htmlToData(); + + editor.windowManager.open({ + title: 'Document properties', + data: data, + defaults: {type: 'textbox', size: 40}, + body: [ + {name: 'title', label: 'Title'}, + {name: 'keywords', label: 'Keywords'}, + {name: 'description', label: 'Description'}, + {name: 'robots', label: 'Robots'}, + {name: 'author', label: 'Author'}, + {name: 'docencoding', label: 'Encoding'} + ], + onSubmit: function(e) { + dataToHtml(tinymce.extend(data, e.data)); + } + }); + } + + function htmlToData() { + var headerFragment = parseHeader(), data = {}, elm, matches; + + function getAttr(elm, name) { + var value = elm.attr(name); + + return value || ''; + } + + // Default some values + data.fontface = editor.getParam("fullpage_default_fontface", ""); + data.fontsize = editor.getParam("fullpage_default_fontsize", ""); + + // Parse XML PI + elm = headerFragment.firstChild; + if (elm.type == 7) { + data.xml_pi = true; + matches = /encoding="([^"]+)"/.exec(elm.value); + if (matches) { + data.docencoding = matches[1]; + } + } + + // Parse doctype + elm = headerFragment.getAll('#doctype')[0]; + if (elm) { + data.doctype = '"; + } + + // Parse title element + elm = headerFragment.getAll('title')[0]; + if (elm && elm.firstChild) { + data.title = elm.firstChild.value; + } + + // Parse meta elements + each(headerFragment.getAll('meta'), function(meta) { + var name = meta.attr('name'), httpEquiv = meta.attr('http-equiv'), matches; + + if (name) { + data[name.toLowerCase()] = meta.attr('content'); + } else if (httpEquiv == "Content-Type") { + matches = /charset\s*=\s*(.*)\s*/gi.exec(meta.attr('content')); + + if (matches) { + data.docencoding = matches[1]; + } + } + }); + + // Parse html attribs + elm = headerFragment.getAll('html')[0]; + if (elm) { + data.langcode = getAttr(elm, 'lang') || getAttr(elm, 'xml:lang'); + } + + // Parse stylesheets + data.stylesheets = []; + tinymce.each(headerFragment.getAll('link'), function(link) { + if (link.attr('rel') == 'stylesheet') { + data.stylesheets.push(link.attr('href')); + } + }); + + // Parse body parts + elm = headerFragment.getAll('body')[0]; + if (elm) { + data.langdir = getAttr(elm, 'dir'); + data.style = getAttr(elm, 'style'); + data.visited_color = getAttr(elm, 'vlink'); + data.link_color = getAttr(elm, 'link'); + data.active_color = getAttr(elm, 'alink'); + } + + return data; + } + + function dataToHtml(data) { + var headerFragment, headElement, html, elm, value, dom = editor.dom; + + function setAttr(elm, name, value) { + elm.attr(name, value ? value : undefined); + } + + function addHeadNode(node) { + if (headElement.firstChild) { + headElement.insert(node, headElement.firstChild); + } else { + headElement.append(node); + } + } + + headerFragment = parseHeader(); + headElement = headerFragment.getAll('head')[0]; + if (!headElement) { + elm = headerFragment.getAll('html')[0]; + headElement = new Node('head', 1); + + if (elm.firstChild) { + elm.insert(headElement, elm.firstChild, true); + } else { + elm.append(headElement); + } + } + + // Add/update/remove XML-PI + elm = headerFragment.firstChild; + if (data.xml_pi) { + value = 'version="1.0"'; + + if (data.docencoding) { + value += ' encoding="' + data.docencoding + '"'; + } + + if (elm.type != 7) { + elm = new Node('xml', 7); + headerFragment.insert(elm, headerFragment.firstChild, true); + } + + elm.value = value; + } else if (elm && elm.type == 7) { + elm.remove(); + } + + // Add/update/remove doctype + elm = headerFragment.getAll('#doctype')[0]; + if (data.doctype) { + if (!elm) { + elm = new Node('#doctype', 10); + + if (data.xml_pi) { + headerFragment.insert(elm, headerFragment.firstChild); + } else { + addHeadNode(elm); + } + } + + elm.value = data.doctype.substring(9, data.doctype.length - 1); + } else if (elm) { + elm.remove(); + } + + // Add meta encoding + elm = null; + each(headerFragment.getAll('meta'), function(meta) { + if (meta.attr('http-equiv') == 'Content-Type') { + elm = meta; + } + }); + + if (data.docencoding) { + if (!elm) { + elm = new Node('meta', 1); + elm.attr('http-equiv', 'Content-Type'); + elm.shortEnded = true; + addHeadNode(elm); + } + + elm.attr('content', 'text/html; charset=' + data.docencoding); + } else if (elm) { + elm.remove(); + } + + // Add/update/remove title + elm = headerFragment.getAll('title')[0]; + if (data.title) { + if (!elm) { + elm = new Node('title', 1); + addHeadNode(elm); + } else { + elm.empty(); + } + + elm.append(new Node('#text', 3)).value = data.title; + } else if (elm) { + elm.remove(); + } + + // Add/update/remove meta + each('keywords,description,author,copyright,robots'.split(','), function(name) { + var nodes = headerFragment.getAll('meta'), i, meta, value = data[name]; + + for (i = 0; i < nodes.length; i++) { + meta = nodes[i]; + + if (meta.attr('name') == name) { + if (value) { + meta.attr('content', value); + } else { + meta.remove(); + } + + return; + } + } + + if (value) { + elm = new Node('meta', 1); + elm.attr('name', name); + elm.attr('content', value); + elm.shortEnded = true; + + addHeadNode(elm); + } + }); + + var currentStyleSheetsMap = {}; + tinymce.each(headerFragment.getAll('link'), function(stylesheet) { + if (stylesheet.attr('rel') == 'stylesheet') { + currentStyleSheetsMap[stylesheet.attr('href')] = stylesheet; + } + }); + + // Add new + tinymce.each(data.stylesheets, function(stylesheet) { + if (!currentStyleSheetsMap[stylesheet]) { + elm = new Node('link', 1); + elm.attr({ + rel: 'stylesheet', + text: 'text/css', + href: stylesheet + }); + elm.shortEnded = true; + addHeadNode(elm); + } + + delete currentStyleSheetsMap[stylesheet]; + }); + + // Delete old + tinymce.each(currentStyleSheetsMap, function(stylesheet) { + stylesheet.remove(); + }); + + // Update body attributes + elm = headerFragment.getAll('body')[0]; + if (elm) { + setAttr(elm, 'dir', data.langdir); + setAttr(elm, 'style', data.style); + setAttr(elm, 'vlink', data.visited_color); + setAttr(elm, 'link', data.link_color); + setAttr(elm, 'alink', data.active_color); + + // Update iframe body as well + dom.setAttribs(editor.getBody(), { + style: data.style, + dir: data.dir, + vLink: data.visited_color, + link: data.link_color, + aLink: data.active_color + }); + } + + // Set html attributes + elm = headerFragment.getAll('html')[0]; + if (elm) { + setAttr(elm, 'lang', data.langcode); + setAttr(elm, 'xml:lang', data.langcode); + } + + // No need for a head element + if (!headElement.firstChild) { + headElement.remove(); + } + + // Serialize header fragment and crop away body part + html = new tinymce.html.Serializer({ + validate: false, + indent: true, + apply_source_formatting: true, + indent_before: 'head,html,body,meta,title,script,link,style', + indent_after: 'head,html,body,meta,title,script,link,style' + }).serialize(headerFragment); + + head = html.substring(0, html.indexOf('')); + } + + function parseHeader() { + // Parse the contents with a DOM parser + return new tinymce.html.DomParser({ + validate: false, + root_name: '#document' + }).parse(head); + } + + function setContent(evt) { + var startPos, endPos, content = evt.content, headerFragment, styles = '', dom = editor.dom, elm; + + if (evt.selection) { + return; + } + + function low(s) { + return s.replace(/<\/?[A-Z]+/g, function(a) { + return a.toLowerCase(); + }); + } + + // Ignore raw updated if we already have a head, this will fix issues with undo/redo keeping the head/foot separate + if (evt.format == 'raw' && head) { + return; + } + + if (evt.source_view && editor.getParam('fullpage_hide_in_source_view')) { + return; + } + + // Fixed so new document/setContent('') doesn't remove existing header/footer except when it's in source code view + if (content.length === 0 && !evt.source_view) { + content = tinymce.trim(head) + '\n' + tinymce.trim(content) + '\n' + tinymce.trim(foot); + } + + // Parse out head, body and footer + content = content.replace(/<(\/?)BODY/gi, '<$1body'); + startPos = content.indexOf('', startPos); + head = low(content.substring(0, startPos + 1)); + + endPos = content.indexOf('\n'; + } + + header += editor.getParam('fullpage_default_doctype', ''); + header += '\n\n\n'; + + if ((value = editor.getParam('fullpage_default_title'))) { + header += '' + value + '\n'; + } + + if ((value = editor.getParam('fullpage_default_encoding'))) { + header += '\n'; + } + + if ((value = editor.getParam('fullpage_default_font_family'))) { + styles += 'font-family: ' + value + ';'; + } + + if ((value = editor.getParam('fullpage_default_font_size'))) { + styles += 'font-size: ' + value + ';'; + } + + if ((value = editor.getParam('fullpage_default_text_color'))) { + styles += 'color: ' + value + ';'; + } + + header += '\n\n'; + + return header; + } + + function getContent(evt) { + if (!evt.selection && (!evt.source_view || !editor.getParam('fullpage_hide_in_source_view'))) { + evt.content = tinymce.trim(head) + '\n' + tinymce.trim(evt.content) + '\n' + tinymce.trim(foot); + } + } + + editor.addCommand('mceFullPageProperties', showDialog); + + editor.addButton('fullpage', { + title: 'Document properties', + cmd: 'mceFullPageProperties' + }); + + editor.addMenuItem('fullpage', { + text: 'Document properties', + cmd: 'mceFullPageProperties', + context: 'file' + }); + + editor.on('BeforeSetContent', setContent); + editor.on('GetContent', getContent); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/fullpage/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/fullpage/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("fullpage",function(d){var j=tinymce.each,f=tinymce.html.Node;var h,k;function i(){var m=l();d.windowManager.open({title:"Document properties",data:m,defaults:{type:"textbox",size:40},body:[{name:"title",label:"Title"},{name:"keywords",label:"Keywords"},{name:"description",label:"Description"},{name:"robots",label:"Robots"},{name:"author",label:"Author"},{name:"docencoding",label:"Encoding"}],onSubmit:function(n){g(tinymce.extend(m,n.data))}})}function l(){var n=e(),p={},q,o;function m(t,r){var s=t.attr(r);return s||""}p.fontface=d.getParam("fullpage_default_fontface","");p.fontsize=d.getParam("fullpage_default_fontsize","");q=n.firstChild;if(q.type==7){p.xml_pi=true;o=/encoding="([^"]+)"/.exec(q.value);if(o){p.docencoding=o[1]}}q=n.getAll("#doctype")[0];if(q){p.doctype=""}q=n.getAll("title")[0];if(q&&q.firstChild){p.title=q.firstChild.value}j(n.getAll("meta"),function(u){var s=u.attr("name"),r=u.attr("http-equiv"),t;if(s){p[s.toLowerCase()]=u.attr("content")}else{if(r=="Content-Type"){t=/charset\s*=\s*(.*)\s*/gi.exec(u.attr("content"));if(t){p.docencoding=t[1]}}}});q=n.getAll("html")[0];if(q){p.langcode=m(q,"lang")||m(q,"xml:lang")}p.stylesheets=[];tinymce.each(n.getAll("link"),function(r){if(r.attr("rel")=="stylesheet"){p.stylesheets.push(r.attr("href"))}});q=n.getAll("body")[0];if(q){p.langdir=m(q,"dir");p.style=m(q,"style");p.visited_color=m(q,"vlink");p.link_color=m(q,"link");p.active_color=m(q,"alink")}return p}function g(q){var p,n,s,u,v,o=d.dom;function m(y,w,x){y.attr(w,x?x:undefined)}function t(w){if(n.firstChild){n.insert(w,n.firstChild)}else{n.append(w)}}p=e();n=p.getAll("head")[0];if(!n){u=p.getAll("html")[0];n=new f("head",1);if(u.firstChild){u.insert(n,u.firstChild,true)}else{u.append(n)}}u=p.firstChild;if(q.xml_pi){v='version="1.0"';if(q.docencoding){v+=' encoding="'+q.docencoding+'"'}if(u.type!=7){u=new f("xml",7);p.insert(u,p.firstChild,true)}u.value=v}else{if(u&&u.type==7){u.remove()}}u=p.getAll("#doctype")[0];if(q.doctype){if(!u){u=new f("#doctype",10);if(q.xml_pi){p.insert(u,p.firstChild)}else{t(u)}}u.value=q.doctype.substring(9,q.doctype.length-1)}else{if(u){u.remove()}}u=null;j(p.getAll("meta"),function(w){if(w.attr("http-equiv")=="Content-Type"){u=w}});if(q.docencoding){if(!u){u=new f("meta",1);u.attr("http-equiv","Content-Type");u.shortEnded=true;t(u)}u.attr("content","text/html; charset="+q.docencoding)}else{if(u){u.remove()}}u=p.getAll("title")[0];if(q.title){if(!u){u=new f("title",1);t(u)}else{u.empty()}u.append(new f("#text",3)).value=q.title}else{if(u){u.remove()}}j("keywords,description,author,copyright,robots".split(","),function(x){var w=p.getAll("meta"),y,A,z=q[x];for(y=0;y"))}function e(){return new tinymce.html.DomParser({validate:false,root_name:"#document"}).parse(h)}function b(v){var s,m,r=v.content,o,w="",n=d.dom,t;if(v.selection){return}function u(x){return x.replace(/<\/?[A-Z]+/g,function(y){return y.toLowerCase()})}if(v.format=="raw"&&h){return}if(v.source_view&&d.getParam("fullpage_hide_in_source_view")){return}if(r.length===0&&!v.source_view){r=tinymce.trim(h)+"\n"+tinymce.trim(r)+"\n"+tinymce.trim(k)}r=r.replace(/<(\/?)BODY/gi,"<$1body");s=r.indexOf("",s);h=u(r.substring(0,s+1));m=r.indexOf("\n"}o=e();j(o.getAll("style"),function(x){if(x.firstChild){w+=x.firstChild.value}});t=o.getAll("body")[0];if(t){n.setAttribs(d.getBody(),{style:t.attr("style")||"",dir:t.attr("dir")||"",vLink:t.attr("vlink")||"",link:t.attr("link")||"",aLink:t.attr("alink")||""})}n.remove("fullpage_styles");var q=d.getDoc().getElementsByTagName("head")[0];if(w){n.add(q,"style",{id:"fullpage_styles"},w);t=n.get("fullpage_styles");if(t.styleSheet){t.styleSheet.cssText=w}}var p={};tinymce.each(q.getElementsByTagName("link"),function(x){if(x.rel=="stylesheet"&&x.getAttribute("data-mce-fullpage")){p[x.href]=x}});tinymce.each(o.getAll("link"),function(y){var x=y.attr("href");if(!p[x]&&y.attr("rel")=="stylesheet"){n.add(q,"link",{rel:"stylesheet",text:"text/css",href:x,"data-mce-fullpage":"1"})}delete p[x]});tinymce.each(p,function(x){x.parentNode.removeChild(x)})}function a(){var o="",n,m="";if(d.getParam("fullpage_default_xml_pi")){o+='\n'}o+=d.getParam("fullpage_default_doctype","");o+="\n\n\n";if((n=d.getParam("fullpage_default_title"))){o+=""+n+"\n"}if((n=d.getParam("fullpage_default_encoding"))){o+='\n'}if((n=d.getParam("fullpage_default_font_family"))){m+="font-family: "+n+";"}if((n=d.getParam("fullpage_default_font_size"))){m+="font-size: "+n+";"}if((n=d.getParam("fullpage_default_text_color"))){m+="color: "+n+";"}o+="\n\n";return o}function c(m){if(!m.selection&&(!m.source_view||!d.getParam("fullpage_hide_in_source_view"))){m.content=tinymce.trim(h)+"\n"+tinymce.trim(m.content)+"\n"+tinymce.trim(k)}}d.addCommand("mceFullPageProperties",i);d.addButton("fullpage",{title:"Document properties",cmd:"mceFullPageProperties"});d.addMenuItem("fullpage",{text:"Document properties",cmd:"mceFullPageProperties",context:"file"});d.on("BeforeSetContent",b);d.on("GetContent",c)}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/fullscreen/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/fullscreen/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,136 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +tinymce.PluginManager.add('fullscreen', function(editor) { + var fullscreenState = false, DOM = tinymce.DOM, iframeWidth, iframeHeight, resizeHandler; + var containerWidth, containerHeight; + + if (editor.settings.inline) { + return; + } + + function getWindowSize() { + var w, h, win = window, doc = document; + var body = doc.body; + + // Old IE + if (body.offsetWidth) { + w = body.offsetWidth; + h = body.offsetHeight; + } + + // Modern browsers + if (win.innerWidth && win.innerHeight) { + w = win.innerWidth; + h = win.innerHeight; + } + + return {w: w, h: h}; + } + + function toggleFullscreen() { + var body = document.body, documentElement = document.documentElement, editorContainerStyle; + var editorContainer, iframe, iframeStyle; + + function resize() { + DOM.setStyle(iframe, 'height', getWindowSize().h - (editorContainer.clientHeight - iframe.clientHeight)); + } + + fullscreenState = !fullscreenState; + + editorContainer = editor.getContainer(); + editorContainerStyle = editorContainer.style; + iframe = editor.getContentAreaContainer().firstChild; + iframeStyle = iframe.style; + + if (fullscreenState) { + iframeWidth = iframeStyle.width; + iframeHeight = iframeStyle.height; + iframeStyle.width = iframeStyle.height = '100%'; + containerWidth = editorContainerStyle.width; + containerHeight = editorContainerStyle.height; + editorContainerStyle.width = editorContainerStyle.height = ''; + + DOM.addClass(body, 'mce-fullscreen'); + DOM.addClass(documentElement, 'mce-fullscreen'); + DOM.addClass(editorContainer, 'mce-fullscreen'); + + DOM.bind(window, 'resize', resize); + resize(); + resizeHandler = resize; + } else { + iframeStyle.width = iframeWidth; + iframeStyle.height = iframeHeight; + + if (containerWidth) { + editorContainerStyle.width = containerWidth; + } + + if (containerHeight) { + editorContainerStyle.height = containerHeight; + } + + DOM.removeClass(body, 'mce-fullscreen'); + DOM.removeClass(documentElement, 'mce-fullscreen'); + DOM.removeClass(editorContainer, 'mce-fullscreen'); + DOM.unbind(window, 'resize', resizeHandler); + } + + editor.fire('FullscreenStateChanged', {state: fullscreenState}); + } + + editor.on('init', function() { + editor.addShortcut('Meta+Alt+F', '', toggleFullscreen); + }); + + editor.on('remove', function() { + if (resizeHandler) { + DOM.unbind(window, 'resize', resizeHandler); + } + }); + + editor.addCommand('mceFullScreen', toggleFullscreen); + + editor.addMenuItem('fullscreen', { + text: 'Fullscreen', + shortcut: 'Meta+Alt+F', + selectable: true, + onClick: toggleFullscreen, + onPostRender: function() { + var self = this; + + editor.on('FullscreenStateChanged', function(e) { + self.active(e.state); + }); + }, + context: 'view' + }); + + editor.addButton('fullscreen', { + tooltip: 'Fullscreen', + shortcut: 'Meta+Alt+F', + onClick: toggleFullscreen, + onPostRender: function() { + var self = this; + + editor.on('FullscreenStateChanged', function(e) { + self.active(e.state); + }); + } + }); + + return { + isFullscreen: function() { + return fullscreenState; + } + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/fullscreen/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/fullscreen/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("fullscreen",function(g){var d=false,i=tinymce.DOM,f,e,b;var h,j;if(g.settings.inline){return}function c(){var l,m,o=window,n=document;var k=n.body;if(k.offsetWidth){l=k.offsetWidth;m=k.offsetHeight}if(o.innerWidth&&o.innerHeight){l=o.innerWidth;m=o.innerHeight}return{w:l,h:m}}function a(){var l=document.body,q=document.documentElement,o;var p,n,k;function m(){i.setStyle(n,"height",c().h-(p.clientHeight-n.clientHeight))}d=!d;p=g.getContainer();o=p.style;n=g.getContentAreaContainer().firstChild;k=n.style;if(d){f=k.width;e=k.height;k.width=k.height="100%";h=o.width;j=o.height;o.width=o.height="";i.addClass(l,"mce-fullscreen");i.addClass(q,"mce-fullscreen");i.addClass(p,"mce-fullscreen");i.bind(window,"resize",m);m();b=m}else{k.width=f;k.height=e;if(h){o.width=h}if(j){o.height=j}i.removeClass(l,"mce-fullscreen");i.removeClass(q,"mce-fullscreen");i.removeClass(p,"mce-fullscreen");i.unbind(window,"resize",b)}g.fire("FullscreenStateChanged",{state:d})}g.on("init",function(){g.addShortcut("Meta+Alt+F","",a)});g.on("remove",function(){if(b){i.unbind(window,"resize",b)}});g.addCommand("mceFullScreen",a);g.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Meta+Alt+F",selectable:true,onClick:a,onPostRender:function(){var k=this;g.on("FullscreenStateChanged",function(l){k.active(l.state)})},context:"view"});g.addButton("fullscreen",{tooltip:"Fullscreen",shortcut:"Meta+Alt+F",onClick:a,onPostRender:function(){var k=this;g.on("FullscreenStateChanged",function(l){k.active(l.state)})}});return{isFullscreen:function(){return d}}}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/hr/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/hr/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,30 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +tinymce.PluginManager.add('hr', function(editor) { + editor.addCommand('InsertHorizontalRule', function() { + editor.execCommand('mceInsertContent', false, '
    '); + }); + + editor.addButton('hr', { + icon: 'hr', + tooltip: 'Horizontal line', + cmd: 'InsertHorizontalRule' + }); + + editor.addMenuItem('hr', { + icon: 'hr', + text: 'Horizontal line', + cmd: 'InsertHorizontalRule', + context: 'insert' + }); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/hr/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/hr/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("hr",function(a){a.addCommand("InsertHorizontalRule",function(){a.execCommand("mceInsertContent",false,"
    ")});a.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"});a.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/image/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/image/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,548 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +tinymce.PluginManager.add('image', function(editor) { + function getImageSize(url, callback) { + var img = document.createElement('img'); + + function done(width, height) { + if (img.parentNode) { + img.parentNode.removeChild(img); + } + + callback({width: width, height: height}); + } + + img.onload = function() { + done(img.clientWidth, img.clientHeight); + }; + + img.onerror = function() { + done(); + }; + + var style = img.style; + style.visibility = 'hidden'; + style.position = 'fixed'; + style.bottom = style.left = 0; + style.width = style.height = 'auto'; + + document.body.appendChild(img); + img.src = url; + } + + function buildListItems(inputList, itemCallback, startItems) { + function appendItems(values, output) { + output = output || []; + + tinymce.each(values, function(item) { + var menuItem = {text: item.text || item.title}; + + if (item.menu) { + menuItem.menu = appendItems(item.menu); + } else { + menuItem.value = item.value; + itemCallback(menuItem); + } + + output.push(menuItem); + }); + + return output; + } + + return appendItems(inputList, startItems || []); + } + + function createImageList(callback) { + return function() { + var imageList = editor.settings.image_list; + + if (typeof imageList == "string") { + tinymce.util.XHR.send({ + url: imageList, + success: function(text) { + callback(tinymce.util.JSON.parse(text)); + } + }); + } else if (typeof imageList == "function") { + imageList(callback); + } else { + callback(imageList); + } + }; + } + + function showDialog(imageList) { + var win, data = {}, dom = editor.dom, imgElm = editor.selection.getNode(); + var width, height, imageListCtrl, classListCtrl, imageDimensions = editor.settings.image_dimensions !== false; + + function recalcSize() { + var widthCtrl, heightCtrl, newWidth, newHeight; + + widthCtrl = win.find('#width')[0]; + heightCtrl = win.find('#height')[0]; + + if (!widthCtrl || !heightCtrl) { + return; + } + + newWidth = widthCtrl.value(); + newHeight = heightCtrl.value(); + + if (win.find('#constrain')[0].checked() && width && height && newWidth && newHeight) { + if (width != newWidth) { + newHeight = Math.round((newWidth / width) * newHeight); + + if (!isNaN(newHeight)) { + heightCtrl.value(newHeight); + } + } else { + newWidth = Math.round((newHeight / height) * newWidth); + + if (!isNaN(newWidth)) { + widthCtrl.value(newWidth); + } + } + } + + width = newWidth; + height = newHeight; + } + + function onSubmitForm() { + function waitLoad(imgElm) { + function selectImage() { + imgElm.onload = imgElm.onerror = null; + + if (editor.selection) { + editor.selection.select(imgElm); + editor.nodeChanged(); + } + } + + imgElm.onload = function() { + if (!data.width && !data.height && imageDimensions) { + dom.setAttribs(imgElm, { + width: imgElm.clientWidth, + height: imgElm.clientHeight + }); + } + + selectImage(); + }; + + imgElm.onerror = selectImage; + } + + updateStyle(); + recalcSize(); + + data = tinymce.extend(data, win.toJSON()); + + if (!data.alt) { + data.alt = ''; + } + + if (!data.title) { + data.title = ''; + } + + if (data.width === '') { + data.width = null; + } + + if (data.height === '') { + data.height = null; + } + + if (!data.style) { + data.style = null; + } + + // Setup new data excluding style properties + /*eslint dot-notation: 0*/ + data = { + src: data.src, + alt: data.alt, + title: data.title, + width: data.width, + height: data.height, + style: data.style, + "class": data["class"] + }; + + editor.undoManager.transact(function() { + if (!data.src) { + if (imgElm) { + dom.remove(imgElm); + editor.focus(); + editor.nodeChanged(); + } + + return; + } + + if (data.title === "") { + data.title = null; + } + + if (!imgElm) { + data.id = '__mcenew'; + editor.focus(); + editor.selection.setContent(dom.createHTML('img', data)); + imgElm = dom.get('__mcenew'); + dom.setAttrib(imgElm, 'id', null); + } else { + dom.setAttribs(imgElm, data); + } + + waitLoad(imgElm); + }); + } + + function removePixelSuffix(value) { + if (value) { + value = value.replace(/px$/, ''); + } + + return value; + } + + function srcChange(e) { + var srcURL, prependURL, absoluteURLPattern, meta = e.meta || {}; + + if (imageListCtrl) { + imageListCtrl.value(editor.convertURL(this.value(), 'src')); + } + + tinymce.each(meta, function(value, key) { + win.find('#' + key).value(value); + }); + + if (!meta.width && !meta.height) { + srcURL = editor.convertURL(this.value(), 'src'); + + // Pattern test the src url and make sure we haven't already prepended the url + prependURL = editor.settings.image_prepend_url; + absoluteURLPattern = new RegExp('^(?:[a-z]+:)?//', 'i'); + if (prependURL && !absoluteURLPattern.test(srcURL) && srcURL.substring(0, prependURL.length) !== prependURL) { + srcURL = prependURL + srcURL; + } + + this.value(srcURL); + + getImageSize(editor.documentBaseURI.toAbsolute(this.value()), function(data) { + if (data.width && data.height && imageDimensions) { + width = data.width; + height = data.height; + + win.find('#width').value(width); + win.find('#height').value(height); + } + }); + } + } + + width = dom.getAttrib(imgElm, 'width'); + height = dom.getAttrib(imgElm, 'height'); + + if (imgElm.nodeName == 'IMG' && !imgElm.getAttribute('data-mce-object') && !imgElm.getAttribute('data-mce-placeholder')) { + data = { + src: dom.getAttrib(imgElm, 'src'), + alt: dom.getAttrib(imgElm, 'alt'), + title: dom.getAttrib(imgElm, 'title'), + "class": dom.getAttrib(imgElm, 'class'), + width: width, + height: height + }; + } else { + imgElm = null; + } + + if (imageList) { + imageListCtrl = { + type: 'listbox', + label: 'Image list', + values: buildListItems( + imageList, + function(item) { + item.value = editor.convertURL(item.value || item.url, 'src'); + }, + [{text: 'None', value: ''}] + ), + value: data.src && editor.convertURL(data.src, 'src'), + onselect: function(e) { + var altCtrl = win.find('#alt'); + + if (!altCtrl.value() || (e.lastControl && altCtrl.value() == e.lastControl.text())) { + altCtrl.value(e.control.text()); + } + + win.find('#src').value(e.control.value()).fire('change'); + }, + onPostRender: function() { + imageListCtrl = this; + } + }; + } + + if (editor.settings.image_class_list) { + classListCtrl = { + name: 'class', + type: 'listbox', + label: 'Class', + values: buildListItems( + editor.settings.image_class_list, + function(item) { + if (item.value) { + item.textStyle = function() { + return editor.formatter.getCssText({inline: 'img', classes: [item.value]}); + }; + } + } + ) + }; + } + + // General settings shared between simple and advanced dialogs + var generalFormItems = [ + { + name: 'src', + type: 'filepicker', + filetype: 'image', + label: 'Source', + autofocus: true, + onchange: srcChange + }, + imageListCtrl + ]; + + if (editor.settings.image_description !== false) { + generalFormItems.push({name: 'alt', type: 'textbox', label: 'Image description'}); + } + + if (editor.settings.image_title) { + generalFormItems.push({name: 'title', type: 'textbox', label: 'Image Title'}); + } + + if (imageDimensions) { + generalFormItems.push({ + type: 'container', + label: 'Dimensions', + layout: 'flex', + direction: 'row', + align: 'center', + spacing: 5, + items: [ + {name: 'width', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Width'}, + {type: 'label', text: 'x'}, + {name: 'height', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Height'}, + {name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'} + ] + }); + } + + generalFormItems.push(classListCtrl); + + function mergeMargins(css) { + if (css.margin) { + + var splitMargin = css.margin.split(" "); + + switch (splitMargin.length) { + case 1: //margin: toprightbottomleft; + css['margin-top'] = css['margin-top'] || splitMargin[0]; + css['margin-right'] = css['margin-right'] || splitMargin[0]; + css['margin-bottom'] = css['margin-bottom'] || splitMargin[0]; + css['margin-left'] = css['margin-left'] || splitMargin[0]; + break; + case 2: //margin: topbottom rightleft; + css['margin-top'] = css['margin-top'] || splitMargin[0]; + css['margin-right'] = css['margin-right'] || splitMargin[1]; + css['margin-bottom'] = css['margin-bottom'] || splitMargin[0]; + css['margin-left'] = css['margin-left'] || splitMargin[1]; + break; + case 3: //margin: top rightleft bottom; + css['margin-top'] = css['margin-top'] || splitMargin[0]; + css['margin-right'] = css['margin-right'] || splitMargin[1]; + css['margin-bottom'] = css['margin-bottom'] || splitMargin[2]; + css['margin-left'] = css['margin-left'] || splitMargin[1]; + break; + case 4: //margin: top right bottom left; + css['margin-top'] = css['margin-top'] || splitMargin[0]; + css['margin-right'] = css['margin-right'] || splitMargin[1]; + css['margin-bottom'] = css['margin-bottom'] || splitMargin[2]; + css['margin-left'] = css['margin-left'] || splitMargin[3]; + } + delete css.margin; + } + return css; + } + + function updateStyle() { + function addPixelSuffix(value) { + if (value.length > 0 && /^[0-9]+$/.test(value)) { + value += 'px'; + } + + return value; + } + + if (!editor.settings.image_advtab) { + return; + } + + var data = win.toJSON(), + css = dom.parseStyle(data.style); + + css = mergeMargins(css); + + if (data.vspace) { + css['margin-top'] = css['margin-bottom'] = addPixelSuffix(data.vspace); + } + if (data.hspace) { + css['margin-left'] = css['margin-right'] = addPixelSuffix(data.hspace); + } + if (data.border) { + css['border-width'] = addPixelSuffix(data.border); + } + + win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css)))); + } + + function updateVSpaceHSpaceBorder() { + if (!editor.settings.image_advtab) { + return; + } + + var data = win.toJSON(), + css = dom.parseStyle(data.style); + + win.find('#vspace').value(""); + win.find('#hspace').value(""); + + css = mergeMargins(css); + + //Move opposite equal margins to vspace/hspace field + if ((css['margin-top'] && css['margin-bottom']) || (css['margin-right'] && css['margin-left'])) { + if (css['margin-top'] === css['margin-bottom']) { + win.find('#vspace').value(removePixelSuffix(css['margin-top'])); + } else { + win.find('#vspace').value(''); + } + if (css['margin-right'] === css['margin-left']) { + win.find('#hspace').value(removePixelSuffix(css['margin-right'])); + } else { + win.find('#hspace').value(''); + } + } + + //Move border-width + if (css['border-width']) { + win.find('#border').value(removePixelSuffix(css['border-width'])); + } + + win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css)))); + + } + + if (editor.settings.image_advtab) { + // Parse styles from img + if (imgElm) { + if (imgElm.style.marginLeft && imgElm.style.marginRight && imgElm.style.marginLeft === imgElm.style.marginRight) { + data.hspace = removePixelSuffix(imgElm.style.marginLeft); + } + if (imgElm.style.marginTop && imgElm.style.marginBottom && imgElm.style.marginTop === imgElm.style.marginBottom) { + data.vspace = removePixelSuffix(imgElm.style.marginTop); + } + if (imgElm.style.borderWidth) { + data.border = removePixelSuffix(imgElm.style.borderWidth); + } + + data.style = editor.dom.serializeStyle(editor.dom.parseStyle(editor.dom.getAttrib(imgElm, 'style'))); + } + + // Advanced dialog shows general+advanced tabs + win = editor.windowManager.open({ + title: 'Insert/edit image', + data: data, + bodyType: 'tabpanel', + body: [ + { + title: 'General', + type: 'form', + items: generalFormItems + }, + + { + title: 'Advanced', + type: 'form', + pack: 'start', + items: [ + { + label: 'Style', + name: 'style', + type: 'textbox', + onchange: updateVSpaceHSpaceBorder + }, + { + type: 'form', + layout: 'grid', + packV: 'start', + columns: 2, + padding: 0, + alignH: ['left', 'right'], + defaults: { + type: 'textbox', + maxWidth: 50, + onchange: updateStyle + }, + items: [ + {label: 'Vertical space', name: 'vspace'}, + {label: 'Horizontal space', name: 'hspace'}, + {label: 'Border', name: 'border'} + ] + } + ] + } + ], + onSubmit: onSubmitForm + }); + } else { + // Simple default dialog + win = editor.windowManager.open({ + title: 'Insert/edit image', + data: data, + body: generalFormItems, + onSubmit: onSubmitForm + }); + } + } + + editor.addButton('image', { + icon: 'image', + tooltip: 'Insert/edit image', + onclick: createImageList(showDialog), + stateSelector: 'img:not([data-mce-object],[data-mce-placeholder])' + }); + + editor.addMenuItem('image', { + icon: 'image', + text: 'Insert/edit image', + onclick: createImageList(showDialog), + context: 'insert', + prependToContext: true + }); + + editor.addCommand('mceImage', createImageList(showDialog)); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/image/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/image/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("image",function(e){function c(h,j){var g=document.createElement("img");function f(l,k){if(g.parentNode){g.parentNode.removeChild(g)}j({width:l,height:k})}g.onload=function(){f(g.clientWidth,g.clientHeight)};g.onerror=function(){f()};var i=g.style;i.visibility="hidden";i.position="fixed";i.bottom=i.left=0;i.width=i.height="auto";document.body.appendChild(g);g.src=h}function d(h,f,i){function g(k,j){j=j||[];tinymce.each(k,function(m){var l={text:m.text||m.title};if(m.menu){l.menu=g(m.menu)}else{l.value=m.value;f(l)}j.push(l)});return j}return g(h,i||[])}function b(f){return function(){var g=e.settings.image_list;if(typeof g=="string"){tinymce.util.XHR.send({url:g,success:function(h){f(tinymce.util.JSON.parse(h))}})}else{if(typeof g=="function"){g(f)}else{f(g)}}}}function a(p){var j,w={},r=e.dom,g=e.selection.getNode();var o,m,s,i,k=e.settings.image_dimensions!==false;function f(){var y,A,z,x;y=j.find("#width")[0];A=j.find("#height")[0];if(!y||!A){return}z=y.value();x=A.value();if(j.find("#constrain")[0].checked()&&o&&m&&z&&x){if(o!=z){x=Math.round((z/o)*x);if(!isNaN(x)){A.value(x)}}else{z=Math.round((x/m)*z);if(!isNaN(z)){y.value(z)}}}o=z;m=x}function l(){function x(z){function y(){z.onload=z.onerror=null;if(e.selection){e.selection.select(z);e.nodeChanged()}}z.onload=function(){if(!w.width&&!w.height&&k){r.setAttribs(z,{width:z.clientWidth,height:z.clientHeight})}y()};z.onerror=y}n();f();w=tinymce.extend(w,j.toJSON());if(!w.alt){w.alt=""}if(!w.title){w.title=""}if(w.width===""){w.width=null}if(w.height===""){w.height=null}if(!w.style){w.style=null}w={src:w.src,alt:w.alt,title:w.title,width:w.width,height:w.height,style:w.style,"class":w["class"]};e.undoManager.transact(function(){if(!w.src){if(g){r.remove(g);e.focus();e.nodeChanged()}return}if(w.title===""){w.title=null}if(!g){w.id="__mcenew";e.focus();e.selection.setContent(r.createHTML("img",w));g=r.get("__mcenew");r.setAttrib(g,"id",null)}else{r.setAttribs(g,w)}x(g)})}function v(x){if(x){x=x.replace(/px$/,"")}return x}function q(A){var B,y,x,z=A.meta||{};if(s){s.value(e.convertURL(this.value(),"src"))}tinymce.each(z,function(D,C){j.find("#"+C).value(D)});if(!z.width&&!z.height){B=e.convertURL(this.value(),"src");y=e.settings.image_prepend_url;x=new RegExp("^(?:[a-z]+:)?//","i");if(y&&!x.test(B)&&B.substring(0,y.length)!==y){B=y+B}this.value(B);c(e.documentBaseURI.toAbsolute(this.value()),function(C){if(C.width&&C.height&&k){o=C.width;m=C.height;j.find("#width").value(o);j.find("#height").value(m)}})}}o=r.getAttrib(g,"width");m=r.getAttrib(g,"height");if(g.nodeName=="IMG"&&!g.getAttribute("data-mce-object")&&!g.getAttribute("data-mce-placeholder")){w={src:r.getAttrib(g,"src"),alt:r.getAttrib(g,"alt"),title:r.getAttrib(g,"title"),"class":r.getAttrib(g,"class"),width:o,height:m}}else{g=null}if(p){s={type:"listbox",label:"Image list",values:d(p,function(x){x.value=e.convertURL(x.value||x.url,"src")},[{text:"None",value:""}]),value:w.src&&e.convertURL(w.src,"src"),onselect:function(x){var y=j.find("#alt");if(!y.value()||(x.lastControl&&y.value()==x.lastControl.text())){y.value(x.control.text())}j.find("#src").value(x.control.value()).fire("change")},onPostRender:function(){s=this}}}if(e.settings.image_class_list){i={name:"class",type:"listbox",label:"Class",values:d(e.settings.image_class_list,function(x){if(x.value){x.textStyle=function(){return e.formatter.getCssText({inline:"img",classes:[x.value]})}}})}}var u=[{name:"src",type:"filepicker",filetype:"image",label:"Source",autofocus:true,onchange:q},s];if(e.settings.image_description!==false){u.push({name:"alt",type:"textbox",label:"Image description"})}if(e.settings.image_title){u.push({name:"title",type:"textbox",label:"Image Title"})}if(k){u.push({type:"container",label:"Dimensions",layout:"flex",direction:"row",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:3,onchange:f,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:3,onchange:f,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:true,text:"Constrain proportions"}]})}u.push(i);function t(y){if(y.margin){var x=y.margin.split(" ");switch(x.length){case 1:y["margin-top"]=y["margin-top"]||x[0];y["margin-right"]=y["margin-right"]||x[0];y["margin-bottom"]=y["margin-bottom"]||x[0];y["margin-left"]=y["margin-left"]||x[0];break;case 2:y["margin-top"]=y["margin-top"]||x[0];y["margin-right"]=y["margin-right"]||x[1];y["margin-bottom"]=y["margin-bottom"]||x[0];y["margin-left"]=y["margin-left"]||x[1];break;case 3:y["margin-top"]=y["margin-top"]||x[0];y["margin-right"]=y["margin-right"]||x[1];y["margin-bottom"]=y["margin-bottom"]||x[2];y["margin-left"]=y["margin-left"]||x[1];break;case 4:y["margin-top"]=y["margin-top"]||x[0];y["margin-right"]=y["margin-right"]||x[1];y["margin-bottom"]=y["margin-bottom"]||x[2];y["margin-left"]=y["margin-left"]||x[3]}delete y.margin}return y}function n(){function z(A){if(A.length>0&&/^[0-9]+$/.test(A)){A+="px"}return A}if(!e.settings.image_advtab){return}var y=j.toJSON(),x=r.parseStyle(y.style);x=t(x);if(y.vspace){x["margin-top"]=x["margin-bottom"]=z(y.vspace)}if(y.hspace){x["margin-left"]=x["margin-right"]=z(y.hspace)}if(y.border){x["border-width"]=z(y.border)}j.find("#style").value(r.serializeStyle(r.parseStyle(r.serializeStyle(x))))}function h(){if(!e.settings.image_advtab){return}var y=j.toJSON(),x=r.parseStyle(y.style);j.find("#vspace").value("");j.find("#hspace").value("");x=t(x);if((x["margin-top"]&&x["margin-bottom"])||(x["margin-right"]&&x["margin-left"])){if(x["margin-top"]===x["margin-bottom"]){j.find("#vspace").value(v(x["margin-top"]))}else{j.find("#vspace").value("")}if(x["margin-right"]===x["margin-left"]){j.find("#hspace").value(v(x["margin-right"]))}else{j.find("#hspace").value("")}}if(x["border-width"]){j.find("#border").value(v(x["border-width"]))}j.find("#style").value(r.serializeStyle(r.parseStyle(r.serializeStyle(x))))}if(e.settings.image_advtab){if(g){if(g.style.marginLeft&&g.style.marginRight&&g.style.marginLeft===g.style.marginRight){w.hspace=v(g.style.marginLeft)}if(g.style.marginTop&&g.style.marginBottom&&g.style.marginTop===g.style.marginBottom){w.vspace=v(g.style.marginTop)}if(g.style.borderWidth){w.border=v(g.style.borderWidth)}w.style=e.dom.serializeStyle(e.dom.parseStyle(e.dom.getAttrib(g,"style")))}j=e.windowManager.open({title:"Insert/edit image",data:w,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},{title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox",onchange:h},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,alignH:["left","right"],defaults:{type:"textbox",maxWidth:50,onchange:n},items:[{label:"Vertical space",name:"vspace"},{label:"Horizontal space",name:"hspace"},{label:"Border",name:"border"}]}]}],onSubmit:l})}else{j=e.windowManager.open({title:"Insert/edit image",data:w,body:u,onSubmit:l})}}e.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:b(a),stateSelector:"img:not([data-mce-object],[data-mce-placeholder])"});e.addMenuItem("image",{icon:"image",text:"Insert/edit image",onclick:b(a),context:"insert",prependToContext:true});e.addCommand("mceImage",b(a))}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/importcss/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/importcss/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,195 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +tinymce.PluginManager.add('importcss', function(editor) { + var self = this, each = tinymce.each; + + function compileFilter(filter) { + if (typeof filter == "string") { + return function(value) { + return value.indexOf(filter) !== -1; + }; + } else if (filter instanceof RegExp) { + return function(value) { + return filter.test(value); + }; + } + + return filter; + } + + function getSelectors(doc, fileFilter) { + var selectors = [], contentCSSUrls = {}; + + function append(styleSheet, imported) { + var href = styleSheet.href, rules; + + if (!href || !fileFilter(href, imported)) { + return; + } + + each(styleSheet.imports, function(styleSheet) { + append(styleSheet, true); + }); + + try { + rules = styleSheet.cssRules || styleSheet.rules; + } catch (e) { + // Firefox fails on rules to remote domain for example: + // @import url(//fonts.googleapis.com/css?family=Pathway+Gothic+One); + } + + each(rules, function(cssRule) { + if (cssRule.styleSheet) { + append(cssRule.styleSheet, true); + } else if (cssRule.selectorText) { + each(cssRule.selectorText.split(','), function(selector) { + selectors.push(tinymce.trim(selector)); + }); + } + }); + } + + each(editor.contentCSS, function(url) { + contentCSSUrls[url] = true; + }); + + if (!fileFilter) { + fileFilter = function(href, imported) { + return imported || contentCSSUrls[href]; + }; + } + + try { + each(doc.styleSheets, function(styleSheet) { + append(styleSheet); + }); + } catch (e) {} + + return selectors; + } + + function convertSelectorToFormat(selectorText) { + var format; + + // Parse simple element.class1, .class1 + var selector = /^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(selectorText); + if (!selector) { + return; + } + + var elementName = selector[1]; + var classes = selector[2].substr(1).split('.').join(' '); + var inlineSelectorElements = tinymce.makeMap('a,img'); + + // element.class - Produce block formats + if (selector[1]) { + format = { + title: selectorText + }; + + if (editor.schema.getTextBlockElements()[elementName]) { + // Text block format ex: h1.class1 + format.block = elementName; + } else if (editor.schema.getBlockElements()[elementName] || inlineSelectorElements[elementName.toLowerCase()]) { + // Block elements such as table.class and special inline elements such as a.class or img.class + format.selector = elementName; + } else { + // Inline format strong.class1 + format.inline = elementName; + } + } else if (selector[2]) { + // .class - Produce inline span with classes + format = { + inline: 'span', + title: selectorText.substr(1), + classes: classes + }; + } + + // Append to or override class attribute + if (editor.settings.importcss_merge_classes !== false) { + format.classes = classes; + } else { + format.attributes = {"class": classes}; + } + + return format; + } + + editor.on('renderFormatsMenu', function(e) { + var settings = editor.settings, selectors = {}; + var selectorConverter = settings.importcss_selector_converter || convertSelectorToFormat; + var selectorFilter = compileFilter(settings.importcss_selector_filter), ctrl = e.control; + + if (!editor.settings.importcss_append) { + ctrl.items().remove(); + } + + // Setup new groups collection by cloning the configured one + var groups = []; + tinymce.each(settings.importcss_groups, function(group) { + group = tinymce.extend({}, group); + group.filter = compileFilter(group.filter); + groups.push(group); + }); + + each(getSelectors(e.doc || editor.getDoc(), compileFilter(settings.importcss_file_filter)), function(selector) { + if (selector.indexOf('.mce-') === -1) { + if (!selectors[selector] && (!selectorFilter || selectorFilter(selector))) { + var format = selectorConverter.call(self, selector), menu; + + if (format) { + var formatName = format.name || tinymce.DOM.uniqueId(); + + if (groups) { + for (var i = 0; i < groups.length; i++) { + if (!groups[i].filter || groups[i].filter(selector)) { + if (!groups[i].item) { + groups[i].item = {text: groups[i].title, menu: []}; + } + + menu = groups[i].item.menu; + break; + } + } + } + + editor.formatter.register(formatName, format); + + var menuItem = tinymce.extend({}, ctrl.settings.itemDefaults, { + text: format.title, + format: formatName + }); + + if (menu) { + menu.push(menuItem); + } else { + ctrl.add(menuItem); + } + } + + selectors[selector] = true; + } + } + }); + + each(groups, function(group) { + ctrl.add(group.item); + }); + + e.control.renderNew(); + }); + + // Expose default convertSelectorToFormat implementation + self.convertSelectorToFormat = convertSelectorToFormat; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/importcss/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/importcss/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("importcss",function(d){var b=this,e=tinymce.each;function c(g){if(typeof g=="string"){return function(h){return h.indexOf(g)!==-1}}else{if(g instanceof RegExp){return function(h){return g.test(h)}}}return g}function a(l,j){var i=[],h={};function g(q,p){var m=q.href,o;if(!m||!j(m,p)){return}e(q.imports,function(r){g(r,true)});try{o=q.cssRules||q.rules}catch(n){}e(o,function(r){if(r.styleSheet){g(r.styleSheet,true)}else{if(r.selectorText){e(r.selectorText.split(","),function(s){i.push(tinymce.trim(s))})}}})}e(d.contentCSS,function(m){h[m]=true});if(!j){j=function(m,n){return n||h[m]}}try{e(l.styleSheets,function(m){g(m)})}catch(k){}return i}function f(k){var l;var h=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(k);if(!h){return}var g=h[1];var i=h[2].substr(1).split(".").join(" ");var j=tinymce.makeMap("a,img");if(h[1]){l={title:k};if(d.schema.getTextBlockElements()[g]){l.block=g}else{if(d.schema.getBlockElements()[g]||j[g.toLowerCase()]){l.selector=g}else{l.inline=g}}}else{if(h[2]){l={inline:"span",title:k.substr(1),classes:i}}}if(d.settings.importcss_merge_classes!==false){l.classes=i}else{l.attributes={"class":i}}return l}d.on("renderFormatsMenu",function(m){var j=d.settings,i={};var h=j.importcss_selector_converter||f;var l=c(j.importcss_selector_filter),k=m.control;if(!d.settings.importcss_append){k.items().remove()}var g=[];tinymce.each(j.importcss_groups,function(n){n=tinymce.extend({},n);n.filter=c(n.filter);g.push(n)});e(a(m.doc||d.getDoc(),c(j.importcss_file_filter)),function(n){if(n.indexOf(".mce-")===-1){if(!i[n]&&(!l||l(n))){var r=h.call(b,n),s;if(r){var q=r.name||tinymce.DOM.uniqueId();if(g){for(var o=0;o' + html + ''; + + var timeElm = editor.dom.getParent(editor.selection.getStart(), 'time'); + if (timeElm) { + editor.dom.setOuterHTML(timeElm, html); + return; + } + } + + editor.insertContent(html); + } + + editor.addCommand('mceInsertDate', function() { + insertDateTime(editor.getParam("insertdatetime_dateformat", editor.translate("%Y-%m-%d"))); + }); + + editor.addCommand('mceInsertTime', function() { + insertDateTime(editor.getParam("insertdatetime_timeformat", editor.translate('%H:%M:%S'))); + }); + + editor.addButton('insertdatetime', { + type: 'splitbutton', + title: 'Insert date/time', + onclick: function() { + insertDateTime(lastFormat || defaultButtonTimeFormat); + }, + menu: menuItems + }); + + tinymce.each(editor.settings.insertdatetime_formats || [ + "%H:%M:%S", + "%Y-%m-%d", + "%I:%M:%S %p", + "%D" + ], function(fmt) { + if (!defaultButtonTimeFormat) { + defaultButtonTimeFormat = fmt; + } + + menuItems.push({ + text: getDateTime(fmt), + onclick: function() { + lastFormat = fmt; + insertDateTime(fmt); + } + }); + }); + + editor.addMenuItem('insertdatetime', { + icon: 'date', + text: 'Insert date/time', + menu: menuItems, + context: 'insert' + }); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/insertdatetime/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/insertdatetime/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("insertdatetime",function(f){var j="Sun Mon Tue Wed Thu Fri Sat Sun".split(" ");var b="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" ");var g="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ");var e="January February March April May June July August September October November December".split(" ");var a=[],d,i;function c(k,m){function l(p,n){p=""+p;if(p.length'+l+"";var n=f.dom.getParent(f.selection.getStart(),"time");if(n){f.dom.setOuterHTML(n,l);return}}f.insertContent(l)}f.addCommand("mceInsertDate",function(){h(f.getParam("insertdatetime_dateformat",f.translate("%Y-%m-%d")))});f.addCommand("mceInsertTime",function(){h(f.getParam("insertdatetime_timeformat",f.translate("%H:%M:%S")))});f.addButton("insertdatetime",{type:"splitbutton",title:"Insert date/time",onclick:function(){h(d||i)},menu:a});tinymce.each(f.settings.insertdatetime_formats||["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"],function(k){if(!i){i=k}a.push({text:c(k),onclick:function(){d=k;h(k)}})});f.addMenuItem("insertdatetime",{icon:"date",text:"Insert date/time",menu:a,context:"insert"})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/layer/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/layer/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,225 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +tinymce.PluginManager.add('layer', function(editor) { + function getParentLayer(node) { + do { + if (node.className && node.className.indexOf('mceItemLayer') != -1) { + return node; + } + } while ((node = node.parentNode)); + } + + function visualAid(e) { + var dom = editor.dom; + + tinymce.each(dom.select('div,p', e), function(e) { + if (/^(absolute|relative|fixed)$/i.test(e.style.position)) { + if (e.hasVisual) { + dom.addClass(e, 'mceItemVisualAid'); + } else { + dom.removeClass(e, 'mceItemVisualAid'); + } + + dom.addClass(e, 'mceItemLayer'); + } + }); + } + + function move(d) { + var i, z = [], le = getParentLayer(editor.selection.getNode()), ci = -1, fi = -1, nl; + + nl = []; + tinymce.walk(editor.getBody(), function(n) { + if (n.nodeType == 1 && /^(absolute|relative|static)$/i.test(n.style.position)) { + nl.push(n); + } + }, 'childNodes'); + + // Find z-indexes + for (i = 0; i < nl.length; i++) { + z[i] = nl[i].style.zIndex ? parseInt(nl[i].style.zIndex, 10) : 0; + + if (ci < 0 && nl[i] == le) { + ci = i; + } + } + + if (d < 0) { + // Move back + + // Try find a lower one + for (i = 0; i < z.length; i++) { + if (z[i] < z[ci]) { + fi = i; + break; + } + } + + if (fi > -1) { + nl[ci].style.zIndex = z[fi]; + nl[fi].style.zIndex = z[ci]; + } else { + if (z[ci] > 0) { + nl[ci].style.zIndex = z[ci] - 1; + } + } + } else { + // Move forward + + // Try find a higher one + for (i = 0; i < z.length; i++) { + if (z[i] > z[ci]) { + fi = i; + break; + } + } + + if (fi > -1) { + nl[ci].style.zIndex = z[fi]; + nl[fi].style.zIndex = z[ci]; + } else { + nl[ci].style.zIndex = z[ci] + 1; + } + } + + editor.execCommand('mceRepaint'); + } + + function insertLayer() { + var dom = editor.dom, p = dom.getPos(dom.getParent(editor.selection.getNode(), '*')); + var body = editor.getBody(); + + editor.dom.add(body, 'div', { + style: { + position: 'absolute', + left: p.x, + top: (p.y > 20 ? p.y : 20), + width: 100, + height: 100 + }, + 'class': 'mceItemVisualAid mceItemLayer' + }, editor.selection.getContent() || editor.getLang('layer.content')); + + // Workaround for IE where it messes up the JS engine if you insert a layer on IE 6,7 + if (tinymce.Env.ie) { + dom.setHTML(body, body.innerHTML); + } + } + + function toggleAbsolute() { + var le = getParentLayer(editor.selection.getNode()); + + if (!le) { + le = editor.dom.getParent(editor.selection.getNode(), 'DIV,P,IMG'); + } + + if (le) { + if (le.style.position.toLowerCase() == "absolute") { + editor.dom.setStyles(le, { + position: '', + left: '', + top: '', + width: '', + height: '' + }); + + editor.dom.removeClass(le, 'mceItemVisualAid'); + editor.dom.removeClass(le, 'mceItemLayer'); + } else { + if (!le.style.left) { + le.style.left = 20 + 'px'; + } + + if (!le.style.top) { + le.style.top = 20 + 'px'; + } + + if (!le.style.width) { + le.style.width = le.width ? (le.width + 'px') : '100px'; + } + + if (!le.style.height) { + le.style.height = le.height ? (le.height + 'px') : '100px'; + } + + le.style.position = "absolute"; + + editor.dom.setAttrib(le, 'data-mce-style', ''); + editor.addVisual(editor.getBody()); + } + + editor.execCommand('mceRepaint'); + editor.nodeChanged(); + } + } + + // Register commands + editor.addCommand('mceInsertLayer', insertLayer); + + editor.addCommand('mceMoveForward', function() { + move(1); + }); + + editor.addCommand('mceMoveBackward', function() { + move(-1); + }); + + editor.addCommand('mceMakeAbsolute', function() { + toggleAbsolute(); + }); + + // Register buttons + editor.addButton('moveforward', {title: 'layer.forward_desc', cmd: 'mceMoveForward'}); + editor.addButton('movebackward', {title: 'layer.backward_desc', cmd: 'mceMoveBackward'}); + editor.addButton('absolute', {title: 'layer.absolute_desc', cmd: 'mceMakeAbsolute'}); + editor.addButton('insertlayer', {title: 'layer.insertlayer_desc', cmd: 'mceInsertLayer'}); + + editor.on('init', function() { + if (tinymce.Env.ie) { + editor.getDoc().execCommand('2D-Position', false, true); + } + }); + + // Remove serialized styles when selecting a layer since it might be changed by a drag operation + editor.on('mouseup', function(e) { + var layer = getParentLayer(e.target); + + if (layer) { + editor.dom.setAttrib(layer, 'data-mce-style', ''); + } + }); + + // Fixes edit focus issues with layers on Gecko + // This will enable designMode while inside a layer and disable it when outside + editor.on('mousedown', function(e) { + var node = e.target, doc = editor.getDoc(), parent; + + if (tinymce.Env.gecko) { + if (getParentLayer(node)) { + if (doc.designMode !== 'on') { + doc.designMode = 'on'; + + // Repaint caret + node = doc.body; + parent = node.parentNode; + parent.removeChild(node); + parent.appendChild(node); + } + } else if (doc.designMode == 'on') { + doc.designMode = 'off'; + } + } + }); + + editor.on('NodeChange', visualAid); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/layer/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/layer/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("layer",function(e){function f(g){do{if(g.className&&g.className.indexOf("mceItemLayer")!=-1){return g}}while((g=g.parentNode))}function a(g){var h=e.dom;tinymce.each(h.select("div,p",g),function(i){if(/^(absolute|relative|fixed)$/i.test(i.style.position)){if(i.hasVisual){h.addClass(i,"mceItemVisualAid")}else{h.removeClass(i,"mceItemVisualAid")}h.addClass(i,"mceItemLayer")}})}function c(m){var k,l=[],j=f(e.selection.getNode()),h=-1,n=-1,g;g=[];tinymce.walk(e.getBody(),function(i){if(i.nodeType==1&&/^(absolute|relative|static)$/i.test(i.style.position)){g.push(i)}},"childNodes");for(k=0;k-1){g[h].style.zIndex=l[n];g[n].style.zIndex=l[h]}else{if(l[h]>0){g[h].style.zIndex=l[h]-1}}}else{for(k=0;kl[h]){n=k;break}}if(n>-1){g[h].style.zIndex=l[n];g[n].style.zIndex=l[h]}else{g[h].style.zIndex=l[h]+1}}e.execCommand("mceRepaint")}function b(){var i=e.dom,h=i.getPos(i.getParent(e.selection.getNode(),"*"));var g=e.getBody();e.dom.add(g,"div",{style:{position:"absolute",left:h.x,top:(h.y>20?h.y:20),width:100,height:100},"class":"mceItemVisualAid mceItemLayer"},e.selection.getContent()||e.getLang("layer.content"));if(tinymce.Env.ie){i.setHTML(g,g.innerHTML)}}function d(){var g=f(e.selection.getNode());if(!g){g=e.dom.getParent(e.selection.getNode(),"DIV,P,IMG")}if(g){if(g.style.position.toLowerCase()=="absolute"){e.dom.setStyles(g,{position:"",left:"",top:"",width:"",height:""});e.dom.removeClass(g,"mceItemVisualAid");e.dom.removeClass(g,"mceItemLayer")}else{if(!g.style.left){g.style.left=20+"px"}if(!g.style.top){g.style.top=20+"px"}if(!g.style.width){g.style.width=g.width?(g.width+"px"):"100px"}if(!g.style.height){g.style.height=g.height?(g.height+"px"):"100px"}g.style.position="absolute";e.dom.setAttrib(g,"data-mce-style","");e.addVisual(e.getBody())}e.execCommand("mceRepaint");e.nodeChanged()}}e.addCommand("mceInsertLayer",b);e.addCommand("mceMoveForward",function(){c(1)});e.addCommand("mceMoveBackward",function(){c(-1)});e.addCommand("mceMakeAbsolute",function(){d()});e.addButton("moveforward",{title:"layer.forward_desc",cmd:"mceMoveForward"});e.addButton("movebackward",{title:"layer.backward_desc",cmd:"mceMoveBackward"});e.addButton("absolute",{title:"layer.absolute_desc",cmd:"mceMakeAbsolute"});e.addButton("insertlayer",{title:"layer.insertlayer_desc",cmd:"mceInsertLayer"});e.on("init",function(){if(tinymce.Env.ie){e.getDoc().execCommand("2D-Position",false,true)}});e.on("mouseup",function(h){var g=f(h.target);if(g){e.dom.setAttrib(g,"data-mce-style","")}});e.on("mousedown",function(j){var h=j.target,i=e.getDoc(),g;if(tinymce.Env.gecko){if(f(h)){if(i.designMode!=="on"){i.designMode="on";h=i.body;g=h.parentNode;g.removeChild(h);g.appendChild(h)}}else{if(i.designMode=="on"){i.designMode="off"}}}});e.on("NodeChange",a)}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/legacyoutput/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/legacyoutput/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,211 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + * + * This plugin will force TinyMCE to produce deprecated legacy output such as font elements, u elements, align + * attributes and so forth. There are a few cases where these old items might be needed for example in email applications or with Flash + * + * However you should NOT use this plugin if you are building some system that produces web contents such as a CMS. All these elements are + * not apart of the newer specifications for HTML and XHTML. + */ + +/*global tinymce:true */ + +(function(tinymce) { + // Override inline_styles setting to force TinyMCE to produce deprecated contents + tinymce.on('AddEditor', function(e) { + e.editor.settings.inline_styles = false; + }); + + tinymce.PluginManager.add('legacyoutput', function(editor, url, $) { + editor.on('init', function() { + var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', + fontSizes = tinymce.explode(editor.settings.font_size_style_values), + schema = editor.schema; + + // Override some internal formats to produce legacy elements and attributes + editor.formatter.register({ + // Change alignment formats to use the deprecated align attribute + alignleft: {selector: alignElements, attributes: {align: 'left'}}, + aligncenter: {selector: alignElements, attributes: {align: 'center'}}, + alignright: {selector: alignElements, attributes: {align: 'right'}}, + alignjustify: {selector: alignElements, attributes: {align: 'justify'}}, + + // Change the basic formatting elements to use deprecated element types + bold: [ + {inline: 'b', remove: 'all'}, + {inline: 'strong', remove: 'all'}, + {inline: 'span', styles: {fontWeight: 'bold'}} + ], + italic: [ + {inline: 'i', remove: 'all'}, + {inline: 'em', remove: 'all'}, + {inline: 'span', styles: {fontStyle: 'italic'}} + ], + underline: [ + {inline: 'u', remove: 'all'}, + {inline: 'span', styles: {textDecoration: 'underline'}, exact: true} + ], + strikethrough: [ + {inline: 'strike', remove: 'all'}, + {inline: 'span', styles: {textDecoration: 'line-through'}, exact: true} + ], + + // Change font size and font family to use the deprecated font element + fontname: {inline: 'font', attributes: {face: '%value'}}, + fontsize: { + inline: 'font', + attributes: { + size: function(vars) { + return tinymce.inArray(fontSizes, vars.value) + 1; + } + } + }, + + // Setup font elements for colors as well + forecolor: {inline: 'font', attributes: {color: '%value'}}, + hilitecolor: {inline: 'font', styles: {backgroundColor: '%value'}} + }); + + // Check that deprecated elements are allowed if not add them + tinymce.each('b,i,u,strike'.split(','), function(name) { + schema.addValidElements(name + '[*]'); + }); + + // Add font element if it's missing + if (!schema.getElementRule("font")) { + schema.addValidElements("font[face|size|color|style]"); + } + + // Add the missing and depreacted align attribute for the serialization engine + tinymce.each(alignElements.split(','), function(name) { + var rule = schema.getElementRule(name); + + if (rule) { + if (!rule.attributes.align) { + rule.attributes.align = {}; + rule.attributesOrder.push('align'); + } + } + }); + }); + + editor.addButton('fontsizeselect', function() { + var items = [], defaultFontsizeFormats = '8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7'; + var fontsize_formats = editor.settings.fontsize_formats || defaultFontsizeFormats; + + editor.$.each(fontsize_formats.split(' '), function(i, item) { + var text = item, value = item; + var values = item.split('='); + + if (values.length > 1) { + text = values[0]; + value = values[1]; + } + + items.push({text: text, value: value}); + }); + + return { + type: 'listbox', + text: 'Font Sizes', + tooltip: 'Font Sizes', + values: items, + fixedWidth: true, + onPostRender: function() { + var self = this; + + editor.on('NodeChange', function() { + var fontElm; + + fontElm = editor.dom.getParent(editor.selection.getNode(), 'font'); + if (fontElm) { + self.value(fontElm.size); + } else { + self.value(''); + } + }); + }, + onclick: function(e) { + if (e.control.settings.value) { + editor.execCommand('FontSize', false, e.control.settings.value); + } + } + }; + }); + + editor.addButton('fontselect', function() { + function createFormats(formats) { + formats = formats.replace(/;$/, '').split(';'); + + var i = formats.length; + while (i--) { + formats[i] = formats[i].split('='); + } + + return formats; + } + + var defaultFontsFormats = + 'Andale Mono=andale mono,monospace;' + + 'Arial=arial,helvetica,sans-serif;' + + 'Arial Black=arial black,sans-serif;' + + 'Book Antiqua=book antiqua,palatino,serif;' + + 'Comic Sans MS=comic sans ms,sans-serif;' + + 'Courier New=courier new,courier,monospace;' + + 'Georgia=georgia,palatino,serif;' + + 'Helvetica=helvetica,arial,sans-serif;' + + 'Impact=impact,sans-serif;' + + 'Symbol=symbol;' + + 'Tahoma=tahoma,arial,helvetica,sans-serif;' + + 'Terminal=terminal,monaco,monospace;' + + 'Times New Roman=times new roman,times,serif;' + + 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' + + 'Verdana=verdana,geneva,sans-serif;' + + 'Webdings=webdings;' + + 'Wingdings=wingdings,zapf dingbats'; + + var items = [], fonts = createFormats(editor.settings.font_formats || defaultFontsFormats); + + $.each(fonts, function(i, font) { + items.push({ + text: {raw: font[0]}, + value: font[1], + textStyle: font[1].indexOf('dings') == -1 ? 'font-family:' + font[1] : '' + }); + }); + + return { + type: 'listbox', + text: 'Font Family', + tooltip: 'Font Family', + values: items, + fixedWidth: true, + onPostRender: function() { + var self = this; + + editor.on('NodeChange', function() { + var fontElm; + + fontElm = editor.dom.getParent(editor.selection.getNode(), 'font'); + if (fontElm) { + self.value(fontElm.face); + } else { + self.value(''); + } + }); + }, + onselect: function(e) { + if (e.control.settings.value) { + editor.execCommand('FontName', false, e.control.settings.value); + } + } + }; + }); + }); +})(tinymce); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/legacyoutput/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/legacyoutput/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +(function(a){a.on("AddEditor",function(b){b.editor.settings.inline_styles=false});a.PluginManager.add("legacyoutput",function(c,b,d){c.on("init",function(){var e="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",g=a.explode(c.settings.font_size_style_values),f=c.schema;c.formatter.register({alignleft:{selector:e,attributes:{align:"left"}},aligncenter:{selector:e,attributes:{align:"center"}},alignright:{selector:e,attributes:{align:"right"}},alignjustify:{selector:e,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:true}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:true}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(h){return a.inArray(g,h.value)+1}}},forecolor:{inline:"font",attributes:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}});a.each("b,i,u,strike".split(","),function(h){f.addValidElements(h+"[*]")});if(!f.getElementRule("font")){f.addValidElements("font[face|size|color|style]")}a.each(e.split(","),function(h){var i=f.getElementRule(h);if(i){if(!i.attributes.align){i.attributes.align={};i.attributesOrder.push("align")}}})});c.addButton("fontsizeselect",function(){var e=[],g="8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7";var f=c.settings.fontsize_formats||g;c.$.each(f.split(" "),function(j,k){var m=k,l=k;var h=k.split("=");if(h.length>1){m=h[0];l=h[1]}e.push({text:m,value:l})});return{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:e,fixedWidth:true,onPostRender:function(){var h=this;c.on("NodeChange",function(){var i;i=c.dom.getParent(c.selection.getNode(),"font");if(i){h.value(i.size)}else{h.value("")}})},onclick:function(h){if(h.control.settings.value){c.execCommand("FontSize",false,h.control.settings.value)}}}});c.addButton("fontselect",function(){function e(j){j=j.replace(/;$/,"").split(";");var k=j.length;while(k--){j[k]=j[k].split("=")}return j}var g="Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats";var f=[],h=e(c.settings.font_formats||g);d.each(h,function(k,j){f.push({text:{raw:j[0]},value:j[1],textStyle:j[1].indexOf("dings")==-1?"font-family:"+j[1]:""})});return{type:"listbox",text:"Font Family",tooltip:"Font Family",values:f,fixedWidth:true,onPostRender:function(){var i=this;c.on("NodeChange",function(){var j;j=c.dom.getParent(c.selection.getNode(),"font");if(j){i.value(j.face)}else{i.value("")}})},onselect:function(i){if(i.control.settings.value){c.execCommand("FontName",false,i.control.settings.value)}}}})})})(tinymce); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/link/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/link/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,402 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +tinymce.PluginManager.add('link', function(editor) { + function createLinkList(callback) { + return function() { + var linkList = editor.settings.link_list; + + if (typeof linkList == "string") { + tinymce.util.XHR.send({ + url: linkList, + success: function(text) { + callback(tinymce.util.JSON.parse(text)); + } + }); + } else if (typeof linkList == "function") { + linkList(callback); + } else { + callback(linkList); + } + }; + } + + function buildListItems(inputList, itemCallback, startItems) { + function appendItems(values, output) { + output = output || []; + + tinymce.each(values, function(item) { + var menuItem = {text: item.text || item.title}; + + if (item.menu) { + menuItem.menu = appendItems(item.menu); + } else { + menuItem.value = item.value; + + if (itemCallback) { + itemCallback(menuItem); + } + } + + output.push(menuItem); + }); + + return output; + } + + return appendItems(inputList, startItems || []); + } + + function showDialog(linkList) { + var data = {}, selection = editor.selection, dom = editor.dom, selectedElm, anchorElm, initialText; + var win, onlyText, textListCtrl, linkListCtrl, relListCtrl, targetListCtrl, classListCtrl, linkTitleCtrl, value; + + function linkListChangeHandler(e) { + var textCtrl = win.find('#text'); + + if (!textCtrl.value() || (e.lastControl && textCtrl.value() == e.lastControl.text())) { + textCtrl.value(e.control.text()); + } + + win.find('#href').value(e.control.value()); + } + + function buildAnchorListControl(url) { + var anchorList = []; + + tinymce.each(editor.dom.select('a:not([href])'), function(anchor) { + var id = anchor.name || anchor.id; + + if (id) { + anchorList.push({ + text: id, + value: '#' + id, + selected: url.indexOf('#' + id) != -1 + }); + } + }); + + if (anchorList.length) { + anchorList.unshift({text: 'None', value: ''}); + + return { + name: 'anchor', + type: 'listbox', + label: 'Anchors', + values: anchorList, + onselect: linkListChangeHandler + }; + } + } + + function updateText() { + if (!initialText && data.text.length === 0 && onlyText) { + this.parent().parent().find('#text')[0].value(this.value()); + } + } + + function urlChange(e) { + var meta = e.meta || {}; + + if (linkListCtrl) { + linkListCtrl.value(editor.convertURL(this.value(), 'href')); + } + + tinymce.each(e.meta, function(value, key) { + win.find('#' + key).value(value); + }); + + if (!meta.text) { + updateText.call(this); + } + } + + function isOnlyTextSelected(anchorElm) { + var html = selection.getContent(); + + // Partial html and not a fully selected anchor element + if (/]+>[^<]+<\/a>$/.test(html) || html.indexOf('href=') == -1)) { + return false; + } + + if (anchorElm) { + var nodes = anchorElm.childNodes, i; + + if (nodes.length === 0) { + return false; + } + + for (i = nodes.length - 1; i >= 0; i--) { + if (nodes[i].nodeType != 3) { + return false; + } + } + } + + return true; + } + + selectedElm = selection.getNode(); + anchorElm = dom.getParent(selectedElm, 'a[href]'); + onlyText = isOnlyTextSelected(); + + data.text = initialText = anchorElm ? (anchorElm.innerText || anchorElm.textContent) : selection.getContent({format: 'text'}); + data.href = anchorElm ? dom.getAttrib(anchorElm, 'href') : ''; + + if (anchorElm) { + data.target = dom.getAttrib(anchorElm, 'target'); + } else if (editor.settings.default_link_target) { + data.target = editor.settings.default_link_target; + } + + if ((value = dom.getAttrib(anchorElm, 'rel'))) { + data.rel = value; + } + + if ((value = dom.getAttrib(anchorElm, 'class'))) { + data['class'] = value; + } + + if ((value = dom.getAttrib(anchorElm, 'title'))) { + data.title = value; + } + + if (onlyText) { + textListCtrl = { + name: 'text', + type: 'textbox', + size: 40, + label: 'Text to display', + onchange: function() { + data.text = this.value(); + } + }; + } + + if (linkList) { + linkListCtrl = { + type: 'listbox', + label: 'Link list', + values: buildListItems( + linkList, + function(item) { + item.value = editor.convertURL(item.value || item.url, 'href'); + }, + [{text: 'None', value: ''}] + ), + onselect: linkListChangeHandler, + value: editor.convertURL(data.href, 'href'), + onPostRender: function() { + linkListCtrl = this; + } + }; + } + + if (editor.settings.target_list !== false) { + if (!editor.settings.target_list) { + editor.settings.target_list = [ + {text: 'None', value: ''}, + {text: 'New window', value: '_blank'} + ]; + } + + targetListCtrl = { + name: 'target', + type: 'listbox', + label: 'Target', + values: buildListItems(editor.settings.target_list) + }; + } + + if (editor.settings.rel_list) { + relListCtrl = { + name: 'rel', + type: 'listbox', + label: 'Rel', + values: buildListItems(editor.settings.rel_list) + }; + } + + if (editor.settings.link_class_list) { + classListCtrl = { + name: 'class', + type: 'listbox', + label: 'Class', + values: buildListItems( + editor.settings.link_class_list, + function(item) { + if (item.value) { + item.textStyle = function() { + return editor.formatter.getCssText({inline: 'a', classes: [item.value]}); + }; + } + } + ) + }; + } + + if (editor.settings.link_title !== false) { + linkTitleCtrl = { + name: 'title', + type: 'textbox', + label: 'Title', + value: data.title + }; + } + + win = editor.windowManager.open({ + title: 'Insert link', + data: data, + body: [ + { + name: 'href', + type: 'filepicker', + filetype: 'file', + size: 40, + autofocus: true, + label: 'Url', + onchange: urlChange, + onkeyup: updateText + }, + textListCtrl, + linkTitleCtrl, + buildAnchorListControl(data.href), + linkListCtrl, + relListCtrl, + targetListCtrl, + classListCtrl + ], + onSubmit: function(e) { + /*eslint dot-notation: 0*/ + var href; + + data = tinymce.extend(data, e.data); + href = data.href; + + // Delay confirm since onSubmit will move focus + function delayedConfirm(message, callback) { + var rng = editor.selection.getRng(); + + window.setTimeout(function() { + editor.windowManager.confirm(message, function(state) { + editor.selection.setRng(rng); + callback(state); + }); + }, 0); + } + + function insertLink() { + var linkAttrs = { + href: href, + target: data.target ? data.target : null, + rel: data.rel ? data.rel : null, + "class": data["class"] ? data["class"] : null, + title: data.title ? data.title : null + }; + + if (anchorElm) { + editor.focus(); + + if (onlyText && data.text != initialText) { + if ("innerText" in anchorElm) { + anchorElm.innerText = data.text; + } else { + anchorElm.textContent = data.text; + } + } + + dom.setAttribs(anchorElm, linkAttrs); + + selection.select(anchorElm); + editor.undoManager.add(); + } else { + if (onlyText) { + editor.insertContent(dom.createHTML('a', linkAttrs, dom.encode(data.text))); + } else { + editor.execCommand('mceInsertLink', false, linkAttrs); + } + } + } + + if (!href) { + editor.execCommand('unlink'); + return; + } + + // Is email and not //user@domain.com + if (href.indexOf('@') > 0 && href.indexOf('//') == -1 && href.indexOf('mailto:') == -1) { + delayedConfirm( + 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?', + function(state) { + if (state) { + href = 'mailto:' + href; + } + + insertLink(); + } + ); + + return; + } + + // Is not protocol prefixed + if ((editor.settings.link_assume_external_targets && !/^\w+:/i.test(href)) || + (!editor.settings.link_assume_external_targets && /^\s*www\./i.test(href))) { + delayedConfirm( + 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?', + function(state) { + if (state) { + href = 'http://' + href; + } + + insertLink(); + } + ); + + return; + } + + insertLink(); + } + }); + } + + editor.addButton('link', { + icon: 'link', + tooltip: 'Insert/edit link', + shortcut: 'Meta+K', + onclick: createLinkList(showDialog), + stateSelector: 'a[href]' + }); + + editor.addButton('unlink', { + icon: 'unlink', + tooltip: 'Remove link', + cmd: 'unlink', + stateSelector: 'a[href]' + }); + + editor.addShortcut('Meta+K', '', createLinkList(showDialog)); + editor.addCommand('mceLink', createLinkList(showDialog)); + + this.showDialog = showDialog; + + editor.addMenuItem('link', { + icon: 'link', + text: 'Insert/edit link', + shortcut: 'Meta+K', + onclick: createLinkList(showDialog), + stateSelector: 'a[href]', + context: 'insert', + prependToContext: true + }); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/link/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/link/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("link",function(d){function b(e){return function(){var f=d.settings.link_list;if(typeof f=="string"){tinymce.util.XHR.send({url:f,success:function(g){e(tinymce.util.JSON.parse(g))}})}else{if(typeof f=="function"){f(e)}else{e(f)}}}}function c(g,e,h){function f(j,i){i=i||[];tinymce.each(j,function(l){var k={text:l.text||l.title};if(l.menu){k.menu=f(l.menu)}else{k.value=l.value;if(e){e(k)}}i.push(k)});return i}return f(g,h||[])}function a(j){var x={},y=d.selection,t=d.dom,v,n,o;var i,l,k,g,p,m,h,q,r;function u(z){var A=i.find("#text");if(!A.value()||(z.lastControl&&A.value()==z.lastControl.text())){A.value(z.control.text())}i.find("#href").value(z.control.value())}function f(z){var A=[];tinymce.each(d.dom.select("a:not([href])"),function(B){var C=B.name||B.id;if(C){A.push({text:C,value:"#"+C,selected:z.indexOf("#"+C)!=-1})}});if(A.length){A.unshift({text:"None",value:""});return{name:"anchor",type:"listbox",label:"Anchors",values:A,onselect:u}}}function s(){if(!o&&x.text.length===0&&l){this.parent().parent().find("#text")[0].value(this.value())}}function e(A){var z=A.meta||{};if(g){g.value(d.convertURL(this.value(),"href"))}tinymce.each(A.meta,function(C,B){i.find("#"+B).value(C)});if(!z.text){s.call(this)}}function w(A){var C=y.getContent();if(/]+>[^<]+<\/a>$/.test(C)||C.indexOf("href=")==-1)){return false}if(A){var z=A.childNodes,B;if(z.length===0){return false}for(B=z.length-1;B>=0;B--){if(z[B].nodeType!=3){return false}}}return true}v=y.getNode();n=t.getParent(v,"a[href]");l=w();x.text=o=n?(n.innerText||n.textContent):y.getContent({format:"text"});x.href=n?t.getAttrib(n,"href"):"";if(n){x.target=t.getAttrib(n,"target")}else{if(d.settings.default_link_target){x.target=d.settings.default_link_target}}if((r=t.getAttrib(n,"rel"))){x.rel=r}if((r=t.getAttrib(n,"class"))){x["class"]=r}if((r=t.getAttrib(n,"title"))){x.title=r}if(l){k={name:"text",type:"textbox",size:40,label:"Text to display",onchange:function(){x.text=this.value()}}}if(j){g={type:"listbox",label:"Link list",values:c(j,function(z){z.value=d.convertURL(z.value||z.url,"href")},[{text:"None",value:""}]),onselect:u,value:d.convertURL(x.href,"href"),onPostRender:function(){g=this}}}if(d.settings.target_list!==false){if(!d.settings.target_list){d.settings.target_list=[{text:"None",value:""},{text:"New window",value:"_blank"}]}m={name:"target",type:"listbox",label:"Target",values:c(d.settings.target_list)}}if(d.settings.rel_list){p={name:"rel",type:"listbox",label:"Rel",values:c(d.settings.rel_list)}}if(d.settings.link_class_list){h={name:"class",type:"listbox",label:"Class",values:c(d.settings.link_class_list,function(z){if(z.value){z.textStyle=function(){return d.formatter.getCssText({inline:"a",classes:[z.value]})}}})}}if(d.settings.link_title!==false){q={name:"title",type:"textbox",label:"Title",value:x.title}}i=d.windowManager.open({title:"Insert link",data:x,body:[{name:"href",type:"filepicker",filetype:"file",size:40,autofocus:true,label:"Url",onchange:e,onkeyup:s},k,q,f(x.href),g,p,m,h],onSubmit:function(C){var z;x=tinymce.extend(x,C.data);z=x.href;function B(E,F){var D=d.selection.getRng();window.setTimeout(function(){d.windowManager.confirm(E,function(G){d.selection.setRng(D);F(G)})},0)}function A(){var D={href:z,target:x.target?x.target:null,rel:x.rel?x.rel:null,"class":x["class"]?x["class"]:null,title:x.title?x.title:null};if(n){d.focus();if(l&&x.text!=o){if("innerText" in n){n.innerText=x.text}else{n.textContent=x.text}}t.setAttribs(n,D);y.select(n);d.undoManager.add()}else{if(l){d.insertContent(t.createHTML("a",D,t.encode(x.text)))}else{d.execCommand("mceInsertLink",false,D)}}}if(!z){d.execCommand("unlink");return}if(z.indexOf("@")>0&&z.indexOf("//")==-1&&z.indexOf("mailto:")==-1){B("The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",function(D){if(D){z="mailto:"+z}A()});return}if((d.settings.link_assume_external_targets&&!/^\w+:/i.test(z))||(!d.settings.link_assume_external_targets&&/^\s*www\./i.test(z))){B("The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",function(D){if(D){z="http://"+z}A()});return}A()}})}d.addButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Meta+K",onclick:b(a),stateSelector:"a[href]"});d.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink",stateSelector:"a[href]"});d.addShortcut("Meta+K","",b(a));d.addCommand("mceLink",b(a));this.showDialog=a;d.addMenuItem("link",{icon:"link",text:"Insert/edit link",shortcut:"Meta+K",onclick:b(a),stateSelector:"a[href]",context:"insert",prependToContext:true})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/lists/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/lists/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,813 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ +/*eslint consistent-this:0 */ + +tinymce.PluginManager.add('lists', function(editor) { + var self = this; + + function isListNode(node) { + return node && (/^(OL|UL|DL)$/).test(node.nodeName); + } + + function isFirstChild(node) { + return node.parentNode.firstChild == node; + } + + function isLastChild(node) { + return node.parentNode.lastChild == node; + } + + function isTextBlock(node) { + return node && !!editor.schema.getTextBlockElements()[node.nodeName]; + } + + editor.on('init', function() { + var dom = editor.dom, selection = editor.selection; + + /** + * Returns a range bookmark. This will convert indexed bookmarks into temporary span elements with + * index 0 so that they can be restored properly after the DOM has been modified. Text bookmarks will not have spans + * added to them since they can be restored after a dom operation. + * + * So this:

    ||

    + * becomes:

    ||

    + * + * @param {DOMRange} rng DOM Range to get bookmark on. + * @return {Object} Bookmark object. + */ + function createBookmark(rng) { + var bookmark = {}; + + function setupEndPoint(start) { + var offsetNode, container, offset; + + container = rng[start ? 'startContainer' : 'endContainer']; + offset = rng[start ? 'startOffset' : 'endOffset']; + + if (container.nodeType == 1) { + offsetNode = dom.create('span', {'data-mce-type': 'bookmark'}); + + if (container.hasChildNodes()) { + offset = Math.min(offset, container.childNodes.length - 1); + + if (start) { + container.insertBefore(offsetNode, container.childNodes[offset]); + } else { + dom.insertAfter(offsetNode, container.childNodes[offset]); + } + } else { + container.appendChild(offsetNode); + } + + container = offsetNode; + offset = 0; + } + + bookmark[start ? 'startContainer' : 'endContainer'] = container; + bookmark[start ? 'startOffset' : 'endOffset'] = offset; + } + + setupEndPoint(true); + + if (!rng.collapsed) { + setupEndPoint(); + } + + return bookmark; + } + + /** + * Moves the selection to the current bookmark and removes any selection container wrappers. + * + * @param {Object} bookmark Bookmark object to move selection to. + */ + function moveToBookmark(bookmark) { + function restoreEndPoint(start) { + var container, offset, node; + + function nodeIndex(container) { + var node = container.parentNode.firstChild, idx = 0; + + while (node) { + if (node == container) { + return idx; + } + + // Skip data-mce-type=bookmark nodes + if (node.nodeType != 1 || node.getAttribute('data-mce-type') != 'bookmark') { + idx++; + } + + node = node.nextSibling; + } + + return -1; + } + + container = node = bookmark[start ? 'startContainer' : 'endContainer']; + offset = bookmark[start ? 'startOffset' : 'endOffset']; + + if (!container) { + return; + } + + if (container.nodeType == 1) { + offset = nodeIndex(container); + container = container.parentNode; + dom.remove(node); + } + + bookmark[start ? 'startContainer' : 'endContainer'] = container; + bookmark[start ? 'startOffset' : 'endOffset'] = offset; + } + + restoreEndPoint(true); + restoreEndPoint(); + + var rng = dom.createRng(); + + rng.setStart(bookmark.startContainer, bookmark.startOffset); + + if (bookmark.endContainer) { + rng.setEnd(bookmark.endContainer, bookmark.endOffset); + } + + selection.setRng(rng); + } + + function createNewTextBlock(contentNode, blockName) { + var node, textBlock, fragment = dom.createFragment(), hasContentNode; + var blockElements = editor.schema.getBlockElements(); + + if (editor.settings.forced_root_block) { + blockName = blockName || editor.settings.forced_root_block; + } + + if (blockName) { + textBlock = dom.create(blockName); + + if (textBlock.tagName === editor.settings.forced_root_block) { + dom.setAttribs(textBlock, editor.settings.forced_root_block_attrs); + } + + fragment.appendChild(textBlock); + } + + if (contentNode) { + while ((node = contentNode.firstChild)) { + var nodeName = node.nodeName; + + if (!hasContentNode && (nodeName != 'SPAN' || node.getAttribute('data-mce-type') != 'bookmark')) { + hasContentNode = true; + } + + if (blockElements[nodeName]) { + fragment.appendChild(node); + textBlock = null; + } else { + if (blockName) { + if (!textBlock) { + textBlock = dom.create(blockName); + fragment.appendChild(textBlock); + } + + textBlock.appendChild(node); + } else { + fragment.appendChild(node); + } + } + } + } + + if (!editor.settings.forced_root_block) { + fragment.appendChild(dom.create('br')); + } else { + // BR is needed in empty blocks on non IE browsers + if (!hasContentNode && (!tinymce.Env.ie || tinymce.Env.ie > 10)) { + textBlock.appendChild(dom.create('br', {'data-mce-bogus': '1'})); + } + } + + return fragment; + } + + function getSelectedListItems() { + return tinymce.grep(selection.getSelectedBlocks(), function(block) { + return /^(LI|DT|DD)$/.test(block.nodeName); + }); + } + + function splitList(ul, li, newBlock) { + var tmpRng, fragment, bookmarks, node; + + function removeAndKeepBookmarks(targetNode) { + tinymce.each(bookmarks, function(node) { + targetNode.parentNode.insertBefore(node, li.parentNode); + }); + + dom.remove(targetNode); + } + + bookmarks = dom.select('span[data-mce-type="bookmark"]', ul); + newBlock = newBlock || createNewTextBlock(li); + tmpRng = dom.createRng(); + tmpRng.setStartAfter(li); + tmpRng.setEndAfter(ul); + fragment = tmpRng.extractContents(); + + for (node = fragment.firstChild; node; node = node.firstChild) { + if (node.nodeName == 'LI' && dom.isEmpty(node)) { + dom.remove(node); + break; + } + } + + if (!dom.isEmpty(fragment)) { + dom.insertAfter(fragment, ul); + } + + dom.insertAfter(newBlock, ul); + + if (dom.isEmpty(li.parentNode)) { + removeAndKeepBookmarks(li.parentNode); + } + + dom.remove(li); + + if (dom.isEmpty(ul)) { + dom.remove(ul); + } + } + + function mergeWithAdjacentLists(listBlock) { + var sibling, node; + + sibling = listBlock.nextSibling; + if (sibling && isListNode(sibling) && sibling.nodeName == listBlock.nodeName) { + while ((node = sibling.firstChild)) { + listBlock.appendChild(node); + } + + dom.remove(sibling); + } + + sibling = listBlock.previousSibling; + if (sibling && isListNode(sibling) && sibling.nodeName == listBlock.nodeName) { + while ((node = sibling.firstChild)) { + listBlock.insertBefore(node, listBlock.firstChild); + } + + dom.remove(sibling); + } + } + + /** + * Normalizes the all lists in the specified element. + */ + function normalizeList(element) { + tinymce.each(tinymce.grep(dom.select('ol,ul', element)), function(ul) { + var sibling, parentNode = ul.parentNode; + + // Move UL/OL to previous LI if it's the only child of a LI + if (parentNode.nodeName == 'LI' && parentNode.firstChild == ul) { + sibling = parentNode.previousSibling; + if (sibling && sibling.nodeName == 'LI') { + sibling.appendChild(ul); + + if (dom.isEmpty(parentNode)) { + dom.remove(parentNode); + } + } + } + + // Append OL/UL to previous LI if it's in a parent OL/UL i.e. old HTML4 + if (isListNode(parentNode)) { + sibling = parentNode.previousSibling; + if (sibling && sibling.nodeName == 'LI') { + sibling.appendChild(ul); + } + } + }); + } + + function outdent(li) { + var ul = li.parentNode, ulParent = ul.parentNode, newBlock; + + function removeEmptyLi(li) { + if (dom.isEmpty(li)) { + dom.remove(li); + } + } + + if (li.nodeName == 'DD') { + dom.rename(li, 'DT'); + return true; + } + + if (isFirstChild(li) && isLastChild(li)) { + if (ulParent.nodeName == "LI") { + dom.insertAfter(li, ulParent); + removeEmptyLi(ulParent); + dom.remove(ul); + } else if (isListNode(ulParent)) { + dom.remove(ul, true); + } else { + ulParent.insertBefore(createNewTextBlock(li), ul); + dom.remove(ul); + } + + return true; + } else if (isFirstChild(li)) { + if (ulParent.nodeName == "LI") { + dom.insertAfter(li, ulParent); + li.appendChild(ul); + removeEmptyLi(ulParent); + } else if (isListNode(ulParent)) { + ulParent.insertBefore(li, ul); + } else { + ulParent.insertBefore(createNewTextBlock(li), ul); + dom.remove(li); + } + + return true; + } else if (isLastChild(li)) { + if (ulParent.nodeName == "LI") { + dom.insertAfter(li, ulParent); + } else if (isListNode(ulParent)) { + dom.insertAfter(li, ul); + } else { + dom.insertAfter(createNewTextBlock(li), ul); + dom.remove(li); + } + + return true; + } else { + if (ulParent.nodeName == 'LI') { + ul = ulParent; + newBlock = createNewTextBlock(li, 'LI'); + } else if (isListNode(ulParent)) { + newBlock = createNewTextBlock(li, 'LI'); + } else { + newBlock = createNewTextBlock(li); + } + + splitList(ul, li, newBlock); + normalizeList(ul.parentNode); + + return true; + } + + return false; + } + + function indent(li) { + var sibling, newList; + + function mergeLists(from, to) { + var node; + + if (isListNode(from)) { + while ((node = li.lastChild.firstChild)) { + to.appendChild(node); + } + + dom.remove(from); + } + } + + if (li.nodeName == 'DT') { + dom.rename(li, 'DD'); + return true; + } + + sibling = li.previousSibling; + + if (sibling && isListNode(sibling)) { + sibling.appendChild(li); + return true; + } + + if (sibling && sibling.nodeName == 'LI' && isListNode(sibling.lastChild)) { + sibling.lastChild.appendChild(li); + mergeLists(li.lastChild, sibling.lastChild); + return true; + } + + sibling = li.nextSibling; + + if (sibling && isListNode(sibling)) { + sibling.insertBefore(li, sibling.firstChild); + return true; + } + + if (sibling && sibling.nodeName == 'LI' && isListNode(li.lastChild)) { + return false; + } + + sibling = li.previousSibling; + if (sibling && sibling.nodeName == 'LI') { + newList = dom.create(li.parentNode.nodeName); + sibling.appendChild(newList); + newList.appendChild(li); + mergeLists(li.lastChild, newList); + return true; + } + + return false; + } + + function indentSelection() { + var listElements = getSelectedListItems(); + + if (listElements.length) { + var bookmark = createBookmark(selection.getRng(true)); + + for (var i = 0; i < listElements.length; i++) { + if (!indent(listElements[i]) && i === 0) { + break; + } + } + + moveToBookmark(bookmark); + editor.nodeChanged(); + + return true; + } + } + + function outdentSelection() { + var listElements = getSelectedListItems(); + + if (listElements.length) { + var bookmark = createBookmark(selection.getRng(true)); + var i, y, root = editor.getBody(); + + i = listElements.length; + while (i--) { + var node = listElements[i].parentNode; + + while (node && node != root) { + y = listElements.length; + while (y--) { + if (listElements[y] === node) { + listElements.splice(i, 1); + break; + } + } + + node = node.parentNode; + } + } + + for (i = 0; i < listElements.length; i++) { + if (!outdent(listElements[i]) && i === 0) { + break; + } + } + + moveToBookmark(bookmark); + editor.nodeChanged(); + + return true; + } + } + + function applyList(listName) { + var rng = selection.getRng(true), bookmark = createBookmark(rng), listItemName = 'LI'; + + listName = listName.toUpperCase(); + + if (listName == 'DL') { + listItemName = 'DT'; + } + + function getSelectedTextBlocks() { + var textBlocks = [], root = editor.getBody(); + + function getEndPointNode(start) { + var container, offset; + + container = rng[start ? 'startContainer' : 'endContainer']; + offset = rng[start ? 'startOffset' : 'endOffset']; + + // Resolve node index + if (container.nodeType == 1) { + container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container; + } + + while (container.parentNode != root) { + if (isTextBlock(container)) { + return container; + } + + if (/^(TD|TH)$/.test(container.parentNode.nodeName)) { + return container; + } + + container = container.parentNode; + } + + return container; + } + + var startNode = getEndPointNode(true); + var endNode = getEndPointNode(); + var block, siblings = []; + + for (var node = startNode; node; node = node.nextSibling) { + siblings.push(node); + + if (node == endNode) { + break; + } + } + + tinymce.each(siblings, function(node) { + if (isTextBlock(node)) { + textBlocks.push(node); + block = null; + return; + } + + if (dom.isBlock(node) || node.nodeName == 'BR') { + if (node.nodeName == 'BR') { + dom.remove(node); + } + + block = null; + return; + } + + var nextSibling = node.nextSibling; + if (tinymce.dom.BookmarkManager.isBookmarkNode(node)) { + if (isTextBlock(nextSibling) || (!nextSibling && node.parentNode == root)) { + block = null; + return; + } + } + + if (!block) { + block = dom.create('p'); + node.parentNode.insertBefore(block, node); + textBlocks.push(block); + } + + block.appendChild(node); + }); + + return textBlocks; + } + + tinymce.each(getSelectedTextBlocks(), function(block) { + var listBlock, sibling; + + sibling = block.previousSibling; + if (sibling && isListNode(sibling) && sibling.nodeName == listName) { + listBlock = sibling; + block = dom.rename(block, listItemName); + sibling.appendChild(block); + } else { + listBlock = dom.create(listName); + block.parentNode.insertBefore(listBlock, block); + listBlock.appendChild(block); + block = dom.rename(block, listItemName); + } + + mergeWithAdjacentLists(listBlock); + }); + + moveToBookmark(bookmark); + } + + function removeList() { + var bookmark = createBookmark(selection.getRng(true)), root = editor.getBody(); + + tinymce.each(getSelectedListItems(), function(li) { + var node, rootList; + + if (dom.isEmpty(li)) { + outdent(li); + return; + } + + for (node = li; node && node != root; node = node.parentNode) { + if (isListNode(node)) { + rootList = node; + } + } + + splitList(rootList, li); + }); + + moveToBookmark(bookmark); + } + + function toggleList(listName) { + var parentList = dom.getParent(selection.getStart(), 'OL,UL,DL'); + + if (parentList) { + if (parentList.nodeName == listName) { + removeList(listName); + } else { + var bookmark = createBookmark(selection.getRng(true)); + mergeWithAdjacentLists(dom.rename(parentList, listName)); + moveToBookmark(bookmark); + } + } else { + applyList(listName); + } + } + + function queryListCommandState(listName) { + return function() { + var parentList = dom.getParent(editor.selection.getStart(), 'UL,OL,DL'); + + return parentList && parentList.nodeName == listName; + }; + } + + self.backspaceDelete = function(isForward) { + function findNextCaretContainer(rng, isForward) { + var node = rng.startContainer, offset = rng.startOffset; + var nonEmptyBlocks, walker; + + if (node.nodeType == 3 && (isForward ? offset < node.data.length : offset > 0)) { + return node; + } + + nonEmptyBlocks = editor.schema.getNonEmptyElements(); + walker = new tinymce.dom.TreeWalker(rng.startContainer); + + while ((node = walker[isForward ? 'next' : 'prev']())) { + if (node.nodeName == 'LI' && !node.hasChildNodes()) { + return node; + } + + if (nonEmptyBlocks[node.nodeName]) { + return node; + } + + if (node.nodeType == 3 && node.data.length > 0) { + return node; + } + } + } + + function mergeLiElements(fromElm, toElm) { + var node, listNode, ul = fromElm.parentNode; + + if (isListNode(toElm.lastChild)) { + listNode = toElm.lastChild; + } + + node = toElm.lastChild; + if (node && node.nodeName == 'BR' && fromElm.hasChildNodes()) { + dom.remove(node); + } + + if (dom.isEmpty(toElm)) { + dom.$(toElm).empty(); + } + + if (!dom.isEmpty(fromElm)) { + while ((node = fromElm.firstChild)) { + toElm.appendChild(node); + } + } + + if (listNode) { + toElm.appendChild(listNode); + } + + dom.remove(fromElm); + + if (dom.isEmpty(ul)) { + dom.remove(ul); + } + } + + if (selection.isCollapsed()) { + var li = dom.getParent(selection.getStart(), 'LI'); + + if (li) { + var rng = selection.getRng(true); + var otherLi = dom.getParent(findNextCaretContainer(rng, isForward), 'LI'); + + if (otherLi && otherLi != li) { + var bookmark = createBookmark(rng); + + if (isForward) { + mergeLiElements(otherLi, li); + } else { + mergeLiElements(li, otherLi); + } + + moveToBookmark(bookmark); + + return true; + } else if (!otherLi) { + if (!isForward && removeList(li.parentNode.nodeName)) { + return true; + } + } + } + } + }; + + editor.on('BeforeExecCommand', function(e) { + var cmd = e.command.toLowerCase(), isHandled; + + if (cmd == "indent") { + if (indentSelection()) { + isHandled = true; + } + } else if (cmd == "outdent") { + if (outdentSelection()) { + isHandled = true; + } + } + + if (isHandled) { + editor.fire('ExecCommand', {command: e.command}); + e.preventDefault(); + return true; + } + }); + + editor.addCommand('InsertUnorderedList', function() { + toggleList('UL'); + }); + + editor.addCommand('InsertOrderedList', function() { + toggleList('OL'); + }); + + editor.addCommand('InsertDefinitionList', function() { + toggleList('DL'); + }); + + editor.addQueryStateHandler('InsertUnorderedList', queryListCommandState('UL')); + editor.addQueryStateHandler('InsertOrderedList', queryListCommandState('OL')); + editor.addQueryStateHandler('InsertDefinitionList', queryListCommandState('DL')); + + editor.on('keydown', function(e) { + // Check for tab but not ctrl/cmd+tab since it switches browser tabs + if (e.keyCode != 9 || tinymce.util.VK.metaKeyPressed(e)) { + return; + } + + if (editor.dom.getParent(editor.selection.getStart(), 'LI,DT,DD')) { + e.preventDefault(); + + if (e.shiftKey) { + outdentSelection(); + } else { + indentSelection(); + } + } + }); + }); + + editor.addButton('indent', { + icon: 'indent', + title: 'Increase indent', + cmd: 'Indent', + onPostRender: function() { + var ctrl = this; + + editor.on('nodechange', function() { + var blocks = editor.selection.getSelectedBlocks(); + var disable = false; + + for (var i = 0, l = blocks.length; !disable && i < l; i++) { + var tag = blocks[i].nodeName; + + disable = (tag == 'LI' && isFirstChild(blocks[i]) || tag == 'UL' || tag == 'OL' || tag == 'DD'); + } + + ctrl.disabled(disable); + }); + } + }); + + editor.on('keydown', function(e) { + if (e.keyCode == tinymce.util.VK.BACKSPACE) { + if (self.backspaceDelete()) { + e.preventDefault(); + } + } else if (e.keyCode == tinymce.util.VK.DELETE) { + if (self.backspaceDelete(true)) { + e.preventDefault(); + } + } + }); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/lists/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/lists/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("lists",function(d){var a=this;function b(g){return g&&(/^(OL|UL|DL)$/).test(g.nodeName)}function c(g){return g.parentNode.firstChild==g}function f(g){return g.parentNode.lastChild==g}function e(g){return g&&!!d.schema.getTextBlockElements()[g.nodeName]}d.on("init",function(){var n=d.dom,v=d.selection;function u(x){var y={};function z(D){var B,A,C;A=x[D?"startContainer":"endContainer"];C=x[D?"startOffset":"endOffset"];if(A.nodeType==1){B=n.create("span",{"data-mce-type":"bookmark"});if(A.hasChildNodes()){C=Math.min(C,A.childNodes.length-1);if(D){A.insertBefore(B,A.childNodes[C])}else{n.insertAfter(B,A.childNodes[C])}}else{A.appendChild(B)}A=B;C=0}y[D?"startContainer":"endContainer"]=A;y[D?"startOffset":"endOffset"]=C}z(true);if(!x.collapsed){z()}return y}function t(y){function z(E){var A,C,B;function D(G){var H=G.parentNode.firstChild,F=0;while(H){if(H==G){return F}if(H.nodeType!=1||H.getAttribute("data-mce-type")!="bookmark"){F++}H=H.nextSibling}return -1}A=B=y[E?"startContainer":"endContainer"];C=y[E?"startOffset":"endOffset"];if(!A){return}if(A.nodeType==1){C=D(A);A=A.parentNode;n.remove(B)}y[E?"startContainer":"endContainer"]=A;y[E?"startOffset":"endOffset"]=C}z(true);z();var x=n.createRng();x.setStart(y.startContainer,y.startOffset);if(y.endContainer){x.setEnd(y.endContainer,y.endOffset)}v.setRng(x)}function k(x,B){var D,y,A=n.createFragment(),z;var C=d.schema.getBlockElements();if(d.settings.forced_root_block){B=B||d.settings.forced_root_block}if(B){y=n.create(B);if(y.tagName===d.settings.forced_root_block){n.setAttribs(y,d.settings.forced_root_block_attrs)}A.appendChild(y)}if(x){while((D=x.firstChild)){var E=D.nodeName;if(!z&&(E!="SPAN"||D.getAttribute("data-mce-type")!="bookmark")){z=true}if(C[E]){A.appendChild(D);y=null}else{if(B){if(!y){y=n.create(B);A.appendChild(y)}y.appendChild(D)}else{A.appendChild(D)}}}}if(!d.settings.forced_root_block){A.appendChild(n.create("br"))}else{if(!z&&(!tinymce.Env.ie||tinymce.Env.ie>10)){y.appendChild(n.create("br",{"data-mce-bogus":"1"}))}}return A}function p(){return tinymce.grep(v.getSelectedBlocks(),function(x){return/^(LI|DT|DD)$/.test(x.nodeName)})}function o(A,x,E){var z,y,B,C;function D(F){tinymce.each(B,function(G){F.parentNode.insertBefore(G,x.parentNode)});n.remove(F)}B=n.select('span[data-mce-type="bookmark"]',A);E=E||k(x);z=n.createRng();z.setStartAfter(x);z.setEndAfter(A);y=z.extractContents();for(C=y.firstChild;C;C=C.firstChild){if(C.nodeName=="LI"&&n.isEmpty(C)){n.remove(C);break}}if(!n.isEmpty(y)){n.insertAfter(y,A)}n.insertAfter(E,A);if(n.isEmpty(x.parentNode)){D(x.parentNode)}n.remove(x);if(n.isEmpty(A)){n.remove(A)}}function w(x){var y,z;y=x.nextSibling;if(y&&b(y)&&y.nodeName==x.nodeName){while((z=y.firstChild)){x.appendChild(z)}n.remove(y)}y=x.previousSibling;if(y&&b(y)&&y.nodeName==x.nodeName){while((z=y.firstChild)){x.insertBefore(z,x.firstChild)}n.remove(y)}}function g(x){tinymce.each(tinymce.grep(n.select("ol,ul",x)),function(z){var A,y=z.parentNode;if(y.nodeName=="LI"&&y.firstChild==z){A=y.previousSibling;if(A&&A.nodeName=="LI"){A.appendChild(z);if(n.isEmpty(y)){n.remove(y)}}}if(b(y)){A=y.previousSibling;if(A&&A.nodeName=="LI"){A.appendChild(z)}}})}function s(y){var z=y.parentNode,x=z.parentNode,B;function A(C){if(n.isEmpty(C)){n.remove(C)}}if(y.nodeName=="DD"){n.rename(y,"DT");return true}if(c(y)&&f(y)){if(x.nodeName=="LI"){n.insertAfter(y,x);A(x);n.remove(z)}else{if(b(x)){n.remove(z,true)}else{x.insertBefore(k(y),z);n.remove(z)}}return true}else{if(c(y)){if(x.nodeName=="LI"){n.insertAfter(y,x);y.appendChild(z);A(x)}else{if(b(x)){x.insertBefore(y,z)}else{x.insertBefore(k(y),z);n.remove(y)}}return true}else{if(f(y)){if(x.nodeName=="LI"){n.insertAfter(y,x)}else{if(b(x)){n.insertAfter(y,z)}else{n.insertAfter(k(y),z);n.remove(y)}}return true}else{if(x.nodeName=="LI"){z=x;B=k(y,"LI")}else{if(b(x)){B=k(y,"LI")}else{B=k(y)}}o(z,y,B);g(z.parentNode);return true}}}return false}function i(x){var z,y;function A(D,C){var B;if(b(D)){while((B=x.lastChild.firstChild)){C.appendChild(B)}n.remove(D)}}if(x.nodeName=="DT"){n.rename(x,"DD");return true}z=x.previousSibling;if(z&&b(z)){z.appendChild(x);return true}if(z&&z.nodeName=="LI"&&b(z.lastChild)){z.lastChild.appendChild(x);A(x.lastChild,z.lastChild);return true}z=x.nextSibling;if(z&&b(z)){z.insertBefore(x,z.firstChild);return true}if(z&&z.nodeName=="LI"&&b(x.lastChild)){return false}z=x.previousSibling;if(z&&z.nodeName=="LI"){y=n.create(x.parentNode.nodeName);z.appendChild(y);y.appendChild(x);A(x.lastChild,y);return true}return false}function h(){var y=p();if(y.length){var z=u(v.getRng(true));for(var x=0;x0)){return G}E=d.schema.getNonEmptyElements();I=new tinymce.dom.TreeWalker(F.startContainer);while((G=I[H?"next":"prev"]())){if(G.nodeName=="LI"&&!G.hasChildNodes()){return G}if(E[G.nodeName]){return G}if(G.nodeType==3&&G.data.length>0){return G}}}function D(F,I){var H,G,E=F.parentNode;if(b(I.lastChild)){G=I.lastChild}H=I.lastChild;if(H&&H.nodeName=="BR"&&F.hasChildNodes()){n.remove(H)}if(n.isEmpty(I)){n.$(I).empty()}if(!n.isEmpty(F)){while((H=F.firstChild)){I.appendChild(H)}}if(G){I.appendChild(G)}n.remove(F);if(n.isEmpty(E)){n.remove(E)}}if(v.isCollapsed()){var x=n.getParent(v.getStart(),"LI");if(x){var z=v.getRng(true);var y=n.getParent(C(z,B),"LI");if(y&&y!=x){var A=u(z);if(B){D(y,x)}else{D(x,y)}t(A);return true}else{if(!y){if(!B&&r(x.parentNode.nodeName)){return true}}}}}};d.on("BeforeExecCommand",function(z){var y=z.command.toLowerCase(),x;if(y=="indent"){if(h()){x=true}}else{if(y=="outdent"){if(q()){x=true}}}if(x){d.fire("ExecCommand",{command:z.command});z.preventDefault();return true}});d.addCommand("InsertUnorderedList",function(){m("UL")});d.addCommand("InsertOrderedList",function(){m("OL")});d.addCommand("InsertDefinitionList",function(){m("DL")});d.addQueryStateHandler("InsertUnorderedList",l("UL"));d.addQueryStateHandler("InsertOrderedList",l("OL"));d.addQueryStateHandler("InsertDefinitionList",l("DL"));d.on("keydown",function(x){if(x.keyCode!=9||tinymce.util.VK.metaKeyPressed(x)){return}if(d.dom.getParent(d.selection.getStart(),"LI,DT,DD")){x.preventDefault();if(x.shiftKey){q()}else{h()}}})});d.addButton("indent",{icon:"indent",title:"Increase indent",cmd:"Indent",onPostRender:function(){var g=this;d.on("nodechange",function(){var n=d.selection.getSelectedBlocks();var k=false;for(var m=0,j=n.length;!k&&m= 0; y--) { + if (beforeObjects[i] == afterObjects[y]) { + afterObjects.splice(y, 1); + } + } + } + + editor.selection.select(afterObjects[0]); + editor.nodeChanged(); + } + }); + } + + function getSource() { + var elm = editor.selection.getNode(); + + if (elm.getAttribute('data-mce-object')) { + return editor.selection.getContent(); + } + } + + function dataToHtml(data) { + var html = ''; + + if (!data.source1) { + tinymce.extend(data, htmlToData(data.embed)); + if (!data.source1) { + return ''; + } + } + + if (!data.source2) { + data.source2 = ''; + } + + if (!data.poster) { + data.poster = ''; + } + + data.source1 = editor.convertURL(data.source1, "source"); + data.source2 = editor.convertURL(data.source2, "source"); + data.source1mime = guessMime(data.source1); + data.source2mime = guessMime(data.source2); + data.poster = editor.convertURL(data.poster, "poster"); + data.flashPlayerUrl = editor.convertURL(url + '/moxieplayer.swf', "movie"); + + tinymce.each(urlPatterns, function(pattern) { + var match, i, url; + + if ((match = pattern.regex.exec(data.source1))) { + url = pattern.url; + + for (i = 0; match[i]; i++) { + /*jshint loopfunc:true*/ + /*eslint no-loop-func:0 */ + url = url.replace('$' + i, function() { + return match[i]; + }); + } + + data.source1 = url; + data.type = pattern.type; + data.width = data.width || pattern.w; + data.height = data.height || pattern.h; + } + }); + + if (data.embed) { + html = updateHtml(data.embed, data, true); + } else { + var videoScript = getVideoScriptMatch(data.source1); + if (videoScript) { + data.type = 'script'; + data.width = videoScript.width; + data.height = videoScript.height; + } + + data.width = data.width || 300; + data.height = data.height || 150; + + tinymce.each(data, function(value, key) { + data[key] = editor.dom.encode(value); + }); + + if (data.type == "iframe") { + html += ''; + } else if (data.source1mime == "application/x-shockwave-flash") { + html += ''; + + if (data.poster) { + html += ''; + } + + html += ''; + } else if (data.source1mime.indexOf('audio') != -1) { + if (editor.settings.audio_template_callback) { + html = editor.settings.audio_template_callback(data); + } else { + html += ( + '' + ); + } + } else if (data.type == "script") { + html += ''; + } else { + if (editor.settings.video_template_callback) { + html = editor.settings.video_template_callback(data); + } else { + html = ( + '' + ); + } + } + } + + return html; + } + + function htmlToData(html) { + var data = {}; + + new tinymce.html.SaxParser({ + validate: false, + allow_conditional_comments: true, + special: 'script,noscript', + start: function(name, attrs) { + if (!data.source1 && name == "param") { + data.source1 = attrs.map.movie; + } + + if (name == "iframe" || name == "object" || name == "embed" || name == "video" || name == "audio") { + if (!data.type) { + data.type = name; + } + + data = tinymce.extend(attrs.map, data); + } + + if (name == "script") { + var videoScript = getVideoScriptMatch(attrs.map.src); + if (!videoScript) { + return; + } + + data = { + type: "script", + source1: attrs.map.src, + width: videoScript.width, + height: videoScript.height + }; + } + + if (name == "source") { + if (!data.source1) { + data.source1 = attrs.map.src; + } else if (!data.source2) { + data.source2 = attrs.map.src; + } + } + + if (name == "img" && !data.poster) { + data.poster = attrs.map.src; + } + } + }).parse(html); + + data.source1 = data.source1 || data.src || data.data; + data.source2 = data.source2 || ''; + data.poster = data.poster || ''; + + return data; + } + + function getData(element) { + if (element.getAttribute('data-mce-object')) { + return htmlToData(editor.serializer.serialize(element, {selection: true})); + } + + return {}; + } + + function sanitize(html) { + if (editor.settings.media_filter_html === false) { + return html; + } + + var writer = new tinymce.html.Writer(); + + new tinymce.html.SaxParser({ + validate: false, + allow_conditional_comments: false, + special: 'script,noscript', + + comment: function(text) { + writer.comment(text); + }, + + cdata: function(text) { + writer.cdata(text); + }, + + text: function(text, raw) { + writer.text(text, raw); + }, + + start: function(name, attrs, empty) { + if (name == 'script' || name == 'noscript') { + return; + } + + for (var i = 0; i < attrs.length; i++) { + if (attrs[i].name.indexOf('on') === 0) { + return; + } + } + + writer.start(name, attrs, empty); + }, + + end: function(name) { + if (name == 'script' || name == 'noscript') { + return; + } + + writer.end(name); + } + }, new tinymce.html.Schema({})).parse(html); + + return writer.getContent(); + } + + function updateHtml(html, data, updateAll) { + var writer = new tinymce.html.Writer(); + var sourceCount = 0, hasImage; + + function setAttributes(attrs, updatedAttrs) { + var name, i, value, attr; + + for (name in updatedAttrs) { + value = "" + updatedAttrs[name]; + + if (attrs.map[name]) { + i = attrs.length; + while (i--) { + attr = attrs[i]; + + if (attr.name == name) { + if (value) { + attrs.map[name] = value; + attr.value = value; + } else { + delete attrs.map[name]; + attrs.splice(i, 1); + } + } + } + } else if (value) { + attrs.push({ + name: name, + value: value + }); + + attrs.map[name] = value; + } + } + } + + new tinymce.html.SaxParser({ + validate: false, + allow_conditional_comments: true, + special: 'script,noscript', + + comment: function(text) { + writer.comment(text); + }, + + cdata: function(text) { + writer.cdata(text); + }, + + text: function(text, raw) { + writer.text(text, raw); + }, + + start: function(name, attrs, empty) { + switch (name) { + case "video": + case "object": + case "embed": + case "img": + case "iframe": + setAttributes(attrs, { + width: data.width, + height: data.height + }); + break; + } + + if (updateAll) { + switch (name) { + case "video": + setAttributes(attrs, { + poster: data.poster, + src: "" + }); + + if (data.source2) { + setAttributes(attrs, { + src: "" + }); + } + break; + + case "iframe": + setAttributes(attrs, { + src: data.source1 + }); + break; + + case "source": + sourceCount++; + + if (sourceCount <= 2) { + setAttributes(attrs, { + src: data["source" + sourceCount], + type: data["source" + sourceCount + "mime"] + }); + + if (!data["source" + sourceCount]) { + return; + } + } + break; + + case "img": + if (!data.poster) { + return; + } + + hasImage = true; + break; + } + } + + writer.start(name, attrs, empty); + }, + + end: function(name) { + if (name == "video" && updateAll) { + for (var index = 1; index <= 2; index++) { + if (data["source" + index]) { + var attrs = []; + attrs.map = {}; + + if (sourceCount < index) { + setAttributes(attrs, { + src: data["source" + index], + type: data["source" + index + "mime"] + }); + + writer.start("source", attrs, true); + } + } + } + } + + if (data.poster && name == "object" && updateAll && !hasImage) { + var imgAttrs = []; + imgAttrs.map = {}; + + setAttributes(imgAttrs, { + src: data.poster, + width: data.width, + height: data.height + }); + + writer.start("img", imgAttrs, true); + } + + writer.end(name); + } + }, new tinymce.html.Schema({})).parse(html); + + return writer.getContent(); + } + + editor.on('ResolveName', function(e) { + var name; + + if (e.target.nodeType == 1 && (name = e.target.getAttribute("data-mce-object"))) { + e.name = name; + } + }); + + editor.on('preInit', function() { + // Make sure that any messy HTML is retained inside these + var specialElements = editor.schema.getSpecialElements(); + tinymce.each('video audio iframe object'.split(' '), function(name) { + specialElements[name] = new RegExp('<\/' + name + '[^>]*>', 'gi'); + }); + + // Allow elements + //editor.schema.addValidElements('object[id|style|width|height|classid|codebase|*],embed[id|style|width|height|type|src|*],video[*],audio[*]'); + + // Set allowFullscreen attribs as boolean + var boolAttrs = editor.schema.getBoolAttrs(); + tinymce.each('webkitallowfullscreen mozallowfullscreen allowfullscreen'.split(' '), function(name) { + boolAttrs[name] = {}; + }); + + // Converts iframe, video etc into placeholder images + editor.parser.addNodeFilter('iframe,video,audio,object,embed,script', function(nodes, name) { + var i = nodes.length, ai, node, placeHolder, attrName, attrValue, attribs, innerHtml; + var videoScript; + + while (i--) { + node = nodes[i]; + if (!node.parent) { + continue; + } + + if (node.name == 'script') { + videoScript = getVideoScriptMatch(node.attr('src')); + if (!videoScript) { + continue; + } + } + + placeHolder = new tinymce.html.Node('img', 1); + placeHolder.shortEnded = true; + + if (videoScript) { + if (videoScript.width) { + node.attr('width', videoScript.width.toString()); + } + + if (videoScript.height) { + node.attr('height', videoScript.height.toString()); + } + } + + // Prefix all attributes except width, height and style since we + // will add these to the placeholder + attribs = node.attributes; + ai = attribs.length; + while (ai--) { + attrName = attribs[ai].name; + attrValue = attribs[ai].value; + + if (attrName !== "width" && attrName !== "height" && attrName !== "style") { + if (attrName == "data" || attrName == "src") { + attrValue = editor.convertURL(attrValue, attrName); + } + + placeHolder.attr('data-mce-p-' + attrName, attrValue); + } + } + + // Place the inner HTML contents inside an escaped attribute + // This enables us to copy/paste the fake object + innerHtml = node.firstChild && node.firstChild.value; + if (innerHtml) { + placeHolder.attr("data-mce-html", escape(innerHtml)); + placeHolder.firstChild = null; + } + + placeHolder.attr({ + width: node.attr('width') || "300", + height: node.attr('height') || (name == "audio" ? "30" : "150"), + style: node.attr('style'), + src: tinymce.Env.transparentSrc, + "data-mce-object": name, + "class": "mce-object mce-object-" + name + }); + + node.replace(placeHolder); + } + }); + + // Replaces placeholder images with real elements for video, object, iframe etc + editor.serializer.addAttributeFilter('data-mce-object', function(nodes, name) { + var i = nodes.length, node, realElm, ai, attribs, innerHtml, innerNode, realElmName; + + while (i--) { + node = nodes[i]; + if (!node.parent) { + continue; + } + + realElmName = node.attr(name); + realElm = new tinymce.html.Node(realElmName, 1); + + // Add width/height to everything but audio + if (realElmName != "audio" && realElmName != "script") { + realElm.attr({ + width: node.attr('width'), + height: node.attr('height') + }); + } + + realElm.attr({ + style: node.attr('style') + }); + + // Unprefix all placeholder attributes + attribs = node.attributes; + ai = attribs.length; + while (ai--) { + var attrName = attribs[ai].name; + + if (attrName.indexOf('data-mce-p-') === 0) { + realElm.attr(attrName.substr(11), attribs[ai].value); + } + } + + if (realElmName == "script") { + realElm.attr('type', 'text/javascript'); + } + + // Inject innerhtml + innerHtml = node.attr('data-mce-html'); + if (innerHtml) { + innerNode = new tinymce.html.Node('#text', 3); + innerNode.raw = true; + innerNode.value = sanitize(unescape(innerHtml)); + realElm.append(innerNode); + } + + node.replace(realElm); + } + }); + }); + + editor.on('ObjectSelected', function(e) { + var objectType = e.target.getAttribute('data-mce-object'); + + if (objectType == "audio" || objectType == "script") { + e.preventDefault(); + } + }); + + editor.on('objectResized', function(e) { + var target = e.target, html; + + if (target.getAttribute('data-mce-object')) { + html = target.getAttribute('data-mce-html'); + if (html) { + html = unescape(html); + target.setAttribute('data-mce-html', escape( + updateHtml(html, { + width: e.width, + height: e.height + }) + )); + } + } + }); + + editor.addButton('media', { + tooltip: 'Insert/edit video', + onclick: showDialog, + stateSelector: ['img[data-mce-object=video]', 'img[data-mce-object=iframe]'] + }); + + editor.addMenuItem('media', { + icon: 'media', + text: 'Insert/edit video', + onclick: showDialog, + context: 'insert', + prependToContext: true + }); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/media/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/media/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("media",function(e,b){var m=[{regex:/youtu\.be\/([\w\-.]+)/,type:"iframe",w:425,h:350,url:"//www.youtube.com/embed/$1"},{regex:/youtube\.com(.+)v=([^&]+)/,type:"iframe",w:425,h:350,url:"//www.youtube.com/embed/$2"},{regex:/vimeo\.com\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc"},{regex:/vimeo\.com\/(.*)\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$2?title=0&byline=0"},{regex:/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,type:"iframe",w:425,h:350,url:'//maps.google.com/maps/ms?msid=$2&output=embed"'}];var k=(tinymce.Env.ie&&tinymce.Env.ie<=8)?"onChange":"onInput";function a(n){n=n.toLowerCase();if(n.indexOf(".mp3")!=-1){return"audio/mpeg"}if(n.indexOf(".wav")!=-1){return"audio/wav"}if(n.indexOf(".mp4")!=-1){return"video/mp4"}if(n.indexOf(".webm")!=-1){return"video/webm"}if(n.indexOf(".ogg")!=-1){return"video/ogg"}if(n.indexOf(".swf")!=-1){return"application/x-shockwave-flash"}return""}function j(p){var o=e.settings.media_scripts;if(o){for(var n=0;n=0;z--){if(x[w]==v[z]){v.splice(z,1)}}}e.selection.select(v[0]);e.nodeChanged()}})}function f(){var n=e.selection.getNode();if(n.getAttribute("data-mce-object")){return e.selection.getContent()}}function h(p){var o="";if(!p.source1){tinymce.extend(p,l(p.embed));if(!p.source1){return""}}if(!p.source2){p.source2=""}if(!p.poster){p.poster=""}p.source1=e.convertURL(p.source1,"source");p.source2=e.convertURL(p.source2,"source");p.source1mime=a(p.source1);p.source2mime=a(p.source2);p.poster=e.convertURL(p.poster,"poster");p.flashPlayerUrl=e.convertURL(b+"/moxieplayer.swf","movie");tinymce.each(m,function(t){var r,s,q;if((r=t.regex.exec(p.source1))){q=t.url;for(s=0;r[s];s++){q=q.replace("$"+s,function(){return r[s]})}p.source1=q;p.type=t.type;p.width=p.width||t.w;p.height=p.height||t.h}});if(p.embed){o=g(p.embed,p,true)}else{var n=j(p.source1);if(n){p.type="script";p.width=n.width;p.height=n.height}p.width=p.width||300;p.height=p.height||150;tinymce.each(p,function(r,q){p[q]=e.dom.encode(r)});if(p.type=="iframe"){o+=''}else{if(p.source1mime=="application/x-shockwave-flash"){o+='';if(p.poster){o+=''}o+=""}else{if(p.source1mime.indexOf("audio")!=-1){if(e.settings.audio_template_callback){o=e.settings.audio_template_callback(p)}else{o+=('")}}else{if(p.type=="script"){o+='\n'; + moduleCount++; + } + + // Expose globally + exports.define = define; + exports.require = require; + + expose(["tinymce/pasteplugin/Utils"]); + + load('classes/Utils.js'); + load('classes/Clipboard.js'); + load('classes/WordFilter.js'); + load('classes/Quirks.js'); + load('classes/Plugin.js'); + + writeScripts(); +})(this); + +// $hash: bc2f915b9558e72dc8a3bd07314a5bfe \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1606 @@ +/** + * Compiled inline version. (Library mode) + */ + +/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */ +/*globals $code */ + +(function(exports, undefined) { + "use strict"; + + var modules = {}; + + function require(ids, callback) { + var module, defs = []; + + for (var i = 0; i < ids.length; ++i) { + module = modules[ids[i]] || resolve(ids[i]); + if (!module) { + throw 'module definition dependecy not found: ' + ids[i]; + } + + defs.push(module); + } + + callback.apply(null, defs); + } + + function define(id, dependencies, definition) { + if (typeof id !== 'string') { + throw 'invalid module definition, module id must be defined and be a string'; + } + + if (dependencies === undefined) { + throw 'invalid module definition, dependencies must be specified'; + } + + if (definition === undefined) { + throw 'invalid module definition, definition function must be specified'; + } + + require(dependencies, function() { + modules[id] = definition.apply(null, arguments); + }); + } + + function defined(id) { + return !!modules[id]; + } + + function resolve(id) { + var target = exports; + var fragments = id.split(/[.\/]/); + + for (var fi = 0; fi < fragments.length; ++fi) { + if (!target[fragments[fi]]) { + return; + } + + target = target[fragments[fi]]; + } + + return target; + } + + function expose(ids) { + for (var i = 0; i < ids.length; i++) { + var target = exports; + var id = ids[i]; + var fragments = id.split(/[.\/]/); + + for (var fi = 0; fi < fragments.length - 1; ++fi) { + if (target[fragments[fi]] === undefined) { + target[fragments[fi]] = {}; + } + + target = target[fragments[fi]]; + } + + target[fragments[fragments.length - 1]] = modules[id]; + } + } + +// Included from: js/tinymce/plugins/paste/classes/Utils.js + +/** + * Utils.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class contails various utility functions for the paste plugin. + * + * @class tinymce.pasteplugin.Utils + */ +define("tinymce/pasteplugin/Utils", [ + "tinymce/util/Tools", + "tinymce/html/DomParser", + "tinymce/html/Schema" +], function(Tools, DomParser, Schema) { + function filter(content, items) { + Tools.each(items, function(v) { + if (v.constructor == RegExp) { + content = content.replace(v, ''); + } else { + content = content.replace(v[0], v[1]); + } + }); + + return content; + } + + /** + * Gets the innerText of the specified element. It will handle edge cases + * and works better than textContent on Gecko. + * + * @param {String} html HTML string to get text from. + * @return {String} String of text with line feeds. + */ + function innerText(html) { + var schema = new Schema(), domParser = new DomParser({}, schema), text = ''; + var shortEndedElements = schema.getShortEndedElements(); + var ignoreElements = Tools.makeMap('script noscript style textarea video audio iframe object', ' '); + var blockElements = schema.getBlockElements(); + + function walk(node) { + var name = node.name, currentNode = node; + + if (name === 'br') { + text += '\n'; + return; + } + + // img/input/hr + if (shortEndedElements[name]) { + text += ' '; + } + + // Ingore script, video contents + if (ignoreElements[name]) { + text += ' '; + return; + } + + if (node.type == 3) { + text += node.value; + } + + // Walk all children + if (!node.shortEnded) { + if ((node = node.firstChild)) { + do { + walk(node); + } while ((node = node.next)); + } + } + + // Add \n or \n\n for blocks or P + if (blockElements[name] && currentNode.next) { + text += '\n'; + + if (name == 'p') { + text += '\n'; + } + } + } + + html = filter(html, [ + //g // Conditional comments + ]); + + walk(domParser.parse(html)); + + return text; + } + + /** + * Trims the specified HTML by removing all WebKit fragments, all elements wrapping the body trailing BR elements etc. + * + * @param {String} html Html string to trim contents on. + * @return {String} Html contents that got trimmed. + */ + function trimHtml(html) { + function trimSpaces(all, s1, s2) { + // WebKit   meant to preserve multiple spaces but instead inserted around all inline tags, + // including the spans with inline styles created on paste + if (!s1 && !s2) { + return ' '; + } + + return '\u00a0'; + } + + html = filter(html, [ + /^[\s\S]*]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g, // Remove anything but the contents within the BODY element + /|/g, // Inner fragments (tables from excel on mac) + [/( ?)\u00a0<\/span>( ?)/g, trimSpaces], + /
    $/i // Trailing BR elements + ]); + + return html; + } + + return { + filter: filter, + innerText: innerText, + trimHtml: trimHtml + }; +}); + +// Included from: js/tinymce/plugins/paste/classes/Clipboard.js + +/** + * Clipboard.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class contains logic for getting HTML contents out of the clipboard. + * + * We need to make a lot of ugly hacks to get the contents out of the clipboard since + * the W3C Clipboard API is broken in all browsers that have it: Gecko/WebKit/Blink. + * We might rewrite this the way those API:s stabilize. Browsers doesn't handle pasting + * from applications like Word the same way as it does when pasting into a contentEditable area + * so we need to do lots of extra work to try to get to this clipboard data. + * + * Current implementation steps: + * 1. On keydown with paste keys Ctrl+V or Shift+Insert create + * a paste bin element and move focus to that element. + * 2. Wait for the browser to fire a "paste" event and get the contents out of the paste bin. + * 3. Check if the paste was successful if true, process the HTML. + * (4). If the paste was unsuccessful use IE execCommand, Clipboard API, document.dataTransfer old WebKit API etc. + * + * @class tinymce.pasteplugin.Clipboard + * @private + */ +define("tinymce/pasteplugin/Clipboard", [ + "tinymce/Env", + "tinymce/dom/RangeUtils", + "tinymce/util/VK", + "tinymce/pasteplugin/Utils" +], function(Env, RangeUtils, VK, Utils) { + return function(editor) { + var self = this, pasteBinElm, lastRng, keyboardPasteTimeStamp = 0, draggingInternally = false; + var pasteBinDefaultContent = '%MCEPASTEBIN%', keyboardPastePlainTextState; + var mceInternalUrlPrefix = 'data:text/mce-internal,'; + + /** + * Pastes the specified HTML. This means that the HTML is filtered and then + * inserted at the current selection in the editor. It will also fire paste events + * for custom user filtering. + * + * @param {String} html HTML code to paste into the current selection. + */ + function pasteHtml(html) { + var args, dom = editor.dom; + + args = editor.fire('BeforePastePreProcess', {content: html}); // Internal event used by Quirks + args = editor.fire('PastePreProcess', args); + html = args.content; + + if (!args.isDefaultPrevented()) { + // User has bound PastePostProcess events then we need to pass it through a DOM node + // This is not ideal but we don't want to let the browser mess up the HTML for example + // some browsers add   to P tags etc + if (editor.hasEventListeners('PastePostProcess') && !args.isDefaultPrevented()) { + // We need to attach the element to the DOM so Sizzle selectors work on the contents + var tempBody = dom.add(editor.getBody(), 'div', {style: 'display:none'}, html); + args = editor.fire('PastePostProcess', {node: tempBody}); + dom.remove(tempBody); + html = args.node.innerHTML; + } + + if (!args.isDefaultPrevented()) { + editor.insertContent(html, {merge: editor.settings.paste_merge_formats !== false}); + } + } + } + + /** + * Pastes the specified text. This means that the plain text is processed + * and converted into BR and P elements. It will fire paste events for custom filtering. + * + * @param {String} text Text to paste as the current selection location. + */ + function pasteText(text) { + text = editor.dom.encode(text).replace(/\r\n/g, '\n'); + + var startBlock = editor.dom.getParent(editor.selection.getStart(), editor.dom.isBlock); + + // Create start block html for example

    + var forcedRootBlockName = editor.settings.forced_root_block; + var forcedRootBlockStartHtml; + if (forcedRootBlockName) { + forcedRootBlockStartHtml = editor.dom.createHTML(forcedRootBlockName, editor.settings.forced_root_block_attrs); + forcedRootBlockStartHtml = forcedRootBlockStartHtml.substr(0, forcedRootBlockStartHtml.length - 3) + '>'; + } + + if ((startBlock && /^(PRE|DIV)$/.test(startBlock.nodeName)) || !forcedRootBlockName) { + text = Utils.filter(text, [ + [/\n/g, "
    "] + ]); + } else { + text = Utils.filter(text, [ + [/\n\n/g, "

    " + forcedRootBlockStartHtml], + [/^(.*<\/p>)(

    )$/, forcedRootBlockStartHtml + '$1'], + [/\n/g, "
    "] + ]); + + if (text.indexOf('

    ') != -1) { + text = forcedRootBlockStartHtml + text; + } + } + + pasteHtml(text); + } + + /** + * Creates a paste bin element as close as possible to the current caret location and places the focus inside that element + * so that when the real paste event occurs the contents gets inserted into this element + * instead of the current editor selection element. + */ + function createPasteBin() { + var dom = editor.dom, body = editor.getBody(); + var viewport = editor.dom.getViewPort(editor.getWin()), scrollTop = viewport.y, top = 20; + var scrollContainer; + + lastRng = editor.selection.getRng(); + + if (editor.inline) { + scrollContainer = editor.selection.getScrollContainer(); + + // Can't always rely on scrollTop returning a useful value. + // It returns 0 if the browser doesn't support scrollTop for the element or is non-scrollable + if (scrollContainer && scrollContainer.scrollTop > 0) { + scrollTop = scrollContainer.scrollTop; + } + } + + /** + * Returns the rect of the current caret if the caret is in an empty block before a + * BR we insert a temporary invisible character that we get the rect this way we always get a proper rect. + * + * TODO: This might be useful in core. + */ + function getCaretRect(rng) { + var rects, textNode, node, container = rng.startContainer; + + rects = rng.getClientRects(); + if (rects.length) { + return rects[0]; + } + + if (!rng.collapsed || container.nodeType != 1) { + return; + } + + node = container.childNodes[lastRng.startOffset]; + + // Skip empty whitespace nodes + while (node && node.nodeType == 3 && !node.data.length) { + node = node.nextSibling; + } + + if (!node) { + return; + } + + // Check if the location is |
    + // TODO: Might need to expand this to say | + if (node.tagName == 'BR') { + textNode = dom.doc.createTextNode('\uFEFF'); + node.parentNode.insertBefore(textNode, node); + + rng = dom.createRng(); + rng.setStartBefore(textNode); + rng.setEndAfter(textNode); + + rects = rng.getClientRects(); + dom.remove(textNode); + } + + if (rects.length) { + return rects[0]; + } + } + + // Calculate top cordinate this is needed to avoid scrolling to top of document + // We want the paste bin to be as close to the caret as possible to avoid scrolling + if (lastRng.getClientRects) { + var rect = getCaretRect(lastRng); + + if (rect) { + // Client rects gets us closes to the actual + // caret location in for example a wrapped paragraph block + top = scrollTop + (rect.top - dom.getPos(body).y); + } else { + top = scrollTop; + + // Check if we can find a closer location by checking the range element + var container = lastRng.startContainer; + if (container) { + if (container.nodeType == 3 && container.parentNode != body) { + container = container.parentNode; + } + + if (container.nodeType == 1) { + top = dom.getPos(container, scrollContainer || body).y; + } + } + } + } + + // Create a pastebin + pasteBinElm = dom.add(editor.getBody(), 'div', { + id: "mcepastebin", + contentEditable: true, + "data-mce-bogus": "all", + style: 'position: absolute; top: ' + top + 'px;' + + 'width: 10px; height: 10px; overflow: hidden; opacity: 0' + }, pasteBinDefaultContent); + + // Move paste bin out of sight since the controlSelection rect gets displayed otherwise on IE and Gecko + if (Env.ie || Env.gecko) { + dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) == 'rtl' ? 0xFFFF : -0xFFFF); + } + + // Prevent focus events from bubbeling fixed FocusManager issues + dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function(e) { + e.stopPropagation(); + }); + + pasteBinElm.focus(); + editor.selection.select(pasteBinElm, true); + } + + /** + * Removes the paste bin if it exists. + */ + function removePasteBin() { + if (pasteBinElm) { + var pasteBinClone; + + // WebKit/Blink might clone the div so + // lets make sure we remove all clones + // TODO: Man o man is this ugly. WebKit is the new IE! Remove this if they ever fix it! + while ((pasteBinClone = editor.dom.get('mcepastebin'))) { + editor.dom.remove(pasteBinClone); + editor.dom.unbind(pasteBinClone); + } + + if (lastRng) { + editor.selection.setRng(lastRng); + } + } + + pasteBinElm = lastRng = null; + } + + /** + * Returns the contents of the paste bin as a HTML string. + * + * @return {String} Get the contents of the paste bin. + */ + function getPasteBinHtml() { + var html = '', pasteBinClones, i, clone, cloneHtml; + + // Since WebKit/Chrome might clone the paste bin when pasting + // for example: we need to check if any of them contains some useful html. + // TODO: Man o man is this ugly. WebKit is the new IE! Remove this if they ever fix it! + pasteBinClones = editor.dom.select('div[id=mcepastebin]'); + for (i = 0; i < pasteBinClones.length; i++) { + clone = pasteBinClones[i]; + + // Pasting plain text produces pastebins in pastebinds makes sence right!? + if (clone.firstChild && clone.firstChild.id == 'mcepastebin') { + clone = clone.firstChild; + } + + cloneHtml = clone.innerHTML; + if (html != pasteBinDefaultContent) { + html += cloneHtml; + } + } + + return html; + } + + /** + * Gets various content types out of a datatransfer object. + * + * @param {DataTransfer} dataTransfer Event fired on paste. + * @return {Object} Object with mime types and data for those mime types. + */ + function getDataTransferItems(dataTransfer) { + var data = {}; + + if (dataTransfer) { + // Use old WebKit/IE API + if (dataTransfer.getData) { + var legacyText = dataTransfer.getData('Text'); + if (legacyText && legacyText.length > 0) { + if (legacyText.indexOf(mceInternalUrlPrefix) == -1) { + data['text/plain'] = legacyText; + } + } + } + + if (dataTransfer.types) { + for (var i = 0; i < dataTransfer.types.length; i++) { + var contentType = dataTransfer.types[i]; + data[contentType] = dataTransfer.getData(contentType); + } + } + } + + return data; + } + + /** + * Gets various content types out of the Clipboard API. It will also get the + * plain text using older IE and WebKit API:s. + * + * @param {ClipboardEvent} clipboardEvent Event fired on paste. + * @return {Object} Object with mime types and data for those mime types. + */ + function getClipboardContent(clipboardEvent) { + return getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer); + } + + /** + * Checks if the clipboard contains image data if it does it will take that data + * and convert it into a data url image and paste that image at the caret location. + * + * @param {ClipboardEvent} e Paste/drop event object. + * @param {DOMRange} rng Optional rng object to move selection to. + * @return {Boolean} true/false if the image data was found or not. + */ + function pasteImageData(e, rng) { + var dataTransfer = e.clipboardData || e.dataTransfer; + + function processItems(items) { + var i, item, reader, hadImage = false; + + function pasteImage(reader) { + if (rng) { + editor.selection.setRng(rng); + rng = null; + } + + pasteHtml(''); + } + + if (items) { + for (i = 0; i < items.length; i++) { + item = items[i]; + + if (/^image\/(jpeg|png|gif|bmp)$/.test(item.type)) { + reader = new FileReader(); + reader.onload = pasteImage.bind(null, reader); + reader.readAsDataURL(item.getAsFile ? item.getAsFile() : item); + + e.preventDefault(); + hadImage = true; + } + } + } + + return hadImage; + } + + if (editor.settings.paste_data_images && dataTransfer) { + return processItems(dataTransfer.items) || processItems(dataTransfer.files); + } + } + + /** + * Chrome on Android doesn't support proper clipboard access so we have no choice but to allow the browser default behavior. + * + * @param {Event} e Paste event object to check if it contains any data. + * @return {Boolean} true/false if the clipboard is empty or not. + */ + function isBrokenAndroidClipboardEvent(e) { + var clipboardData = e.clipboardData; + + return navigator.userAgent.indexOf('Android') != -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0; + } + + function getCaretRangeFromEvent(e) { + return RangeUtils.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc()); + } + + function hasContentType(clipboardContent, mimeType) { + return mimeType in clipboardContent && clipboardContent[mimeType].length > 0; + } + + function isKeyboardPasteEvent(e) { + return (VK.metaKeyPressed(e) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45); + } + + function registerEventHandlers() { + editor.on('keydown', function(e) { + function removePasteBinOnKeyUp(e) { + // Ctrl+V or Shift+Insert + if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) { + removePasteBin(); + } + } + + // Ctrl+V or Shift+Insert + if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) { + keyboardPastePlainTextState = e.shiftKey && e.keyCode == 86; + + // Edge case on Safari on Mac where it doesn't handle Cmd+Shift+V correctly + // it fires the keydown but no paste or keyup so we are left with a paste bin + if (keyboardPastePlainTextState && Env.webkit && navigator.userAgent.indexOf('Version/') != -1) { + return; + } + + // Prevent undoManager keydown handler from making an undo level with the pastebin in it + e.stopImmediatePropagation(); + + keyboardPasteTimeStamp = new Date().getTime(); + + // IE doesn't support Ctrl+Shift+V and it doesn't even produce a paste event + // so lets fake a paste event and let IE use the execCommand/dataTransfer methods + if (Env.ie && keyboardPastePlainTextState) { + e.preventDefault(); + editor.fire('paste', {ieFake: true}); + return; + } + + removePasteBin(); + createPasteBin(); + + // Remove pastebin if we get a keyup and no paste event + // For example pasting a file in IE 11 will not produce a paste event + editor.once('keyup', removePasteBinOnKeyUp); + editor.once('paste', function() { + editor.off('keyup', removePasteBinOnKeyUp); + }); + } + }); + + editor.on('paste', function(e) { + // Getting content from the Clipboard can take some time + var clipboardTimer = new Date().getTime(); + var clipboardContent = getClipboardContent(e); + var clipboardDelay = new Date().getTime() - clipboardTimer; + + var isKeyBoardPaste = (new Date().getTime() - keyboardPasteTimeStamp - clipboardDelay) < 1000; + var plainTextMode = self.pasteFormat == "text" || keyboardPastePlainTextState; + + keyboardPastePlainTextState = false; + + if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) { + removePasteBin(); + return; + } + + if (pasteImageData(e)) { + removePasteBin(); + return; + } + + // Not a keyboard paste prevent default paste and try to grab the clipboard contents using different APIs + if (!isKeyBoardPaste) { + e.preventDefault(); + } + + // Try IE only method if paste isn't a keyboard paste + if (Env.ie && (!isKeyBoardPaste || e.ieFake)) { + createPasteBin(); + + editor.dom.bind(pasteBinElm, 'paste', function(e) { + e.stopPropagation(); + }); + + editor.getDoc().execCommand('Paste', false, null); + clipboardContent["text/html"] = getPasteBinHtml(); + } + + setTimeout(function() { + var content; + + // Grab HTML from Clipboard API or paste bin as a fallback + if (hasContentType(clipboardContent, 'text/html')) { + content = clipboardContent['text/html']; + } else { + content = getPasteBinHtml(); + + // If paste bin is empty try using plain text mode + // since that is better than nothing right + if (content == pasteBinDefaultContent) { + plainTextMode = true; + } + } + + content = Utils.trimHtml(content); + + // WebKit has a nice bug where it clones the paste bin if you paste from for example notepad + // so we need to force plain text mode in this case + if (pasteBinElm && pasteBinElm.firstChild && pasteBinElm.firstChild.id === 'mcepastebin') { + plainTextMode = true; + } + + removePasteBin(); + + // If we got nothing from clipboard API and pastebin then we could try the last resort: plain/text + if (!content.length) { + plainTextMode = true; + } + + // Grab plain text from Clipboard API or convert existing HTML to plain text + if (plainTextMode) { + // Use plain text contents from Clipboard API unless the HTML contains paragraphs then + // we should convert the HTML to plain text since works better when pasting HTML/Word contents as plain text + if (hasContentType(clipboardContent, 'text/plain') && content.indexOf('

    ') == -1) { + content = clipboardContent['text/plain']; + } else { + content = Utils.innerText(content); + } + } + + // If the content is the paste bin default HTML then it was + // impossible to get the cliboard data out. + if (content == pasteBinDefaultContent) { + if (!isKeyBoardPaste) { + editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.'); + } + + return; + } + + if (plainTextMode) { + pasteText(content); + } else { + pasteHtml(content); + } + }, 0); + }); + + editor.on('dragstart dragend', function(e) { + draggingInternally = e.type == 'dragstart'; + }); + + editor.on('drop', function(e) { + var rng = getCaretRangeFromEvent(e); + + if (e.isDefaultPrevented() || draggingInternally) { + return; + } + + if (pasteImageData(e, rng)) { + return; + } + + if (rng && editor.settings.paste_filter_drop !== false) { + var dropContent = getDataTransferItems(e.dataTransfer); + var content = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain']; + + if (content) { + e.preventDefault(); + + editor.undoManager.transact(function() { + if (dropContent['mce-internal']) { + editor.execCommand('Delete'); + } + + editor.selection.setRng(rng); + + content = Utils.trimHtml(content); + + if (!dropContent['text/html']) { + pasteText(content); + } else { + pasteHtml(content); + } + }); + } + } + }); + + editor.on('dragover dragend', function(e) { + if (editor.settings.paste_data_images) { + e.preventDefault(); + } + }); + } + + self.pasteHtml = pasteHtml; + self.pasteText = pasteText; + + editor.on('preInit', function() { + registerEventHandlers(); + + // Remove all data images from paste for example from Gecko + // except internal images like video elements + editor.parser.addNodeFilter('img', function(nodes) { + if (!editor.settings.paste_data_images) { + var i = nodes.length; + + while (i--) { + var src = nodes[i].attributes.map.src; + + // Some browsers automatically produce data uris on paste + // Safari on Mac produces webkit-fake-url see: https://bugs.webkit.org/show_bug.cgi?id=49141 + if (src && /^(data:image|webkit\-fake\-url)/.test(src)) { + if (!nodes[i].attr('data-mce-object') && src !== Env.transparentSrc) { + nodes[i].remove(); + } + } + } + } + }); + }); + }; +}); + +// Included from: js/tinymce/plugins/paste/classes/WordFilter.js + +/** + * WordFilter.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class parses word HTML into proper TinyMCE markup. + * + * @class tinymce.pasteplugin.WordFilter + * @private + */ +define("tinymce/pasteplugin/WordFilter", [ + "tinymce/util/Tools", + "tinymce/html/DomParser", + "tinymce/html/Schema", + "tinymce/html/Serializer", + "tinymce/html/Node", + "tinymce/pasteplugin/Utils" +], function(Tools, DomParser, Schema, Serializer, Node, Utils) { + /** + * Checks if the specified content is from any of the following sources: MS Word/Office 365/Google docs. + */ + function isWordContent(content) { + return ( + (/]+id="?docs-internal-[^>]*>/gi, ''); + content = content.replace(/
    /gi, ''); + + retainStyleProperties = settings.paste_retain_style_properties; + if (retainStyleProperties) { + validStyles = Tools.makeMap(retainStyleProperties.split(/[, ]/)); + } + + /** + * Converts fake bullet and numbered lists to real semantic OL/UL. + * + * @param {tinymce.html.Node} node Root node to convert children of. + */ + function convertFakeListsToProperLists(node) { + var currentListNode, prevListNode, lastLevel = 1; + + function getText(node) { + var txt = ''; + + if (node.type === 3) { + return node.value; + } + + if ((node = node.firstChild)) { + do { + txt += getText(node); + } while ((node = node.next)); + } + + return txt; + } + + function trimListStart(node, regExp) { + if (node.type === 3) { + if (regExp.test(node.value)) { + node.value = node.value.replace(regExp, ''); + return false; + } + } + + if ((node = node.firstChild)) { + do { + if (!trimListStart(node, regExp)) { + return false; + } + } while ((node = node.next)); + } + + return true; + } + + function removeIgnoredNodes(node) { + if (node._listIgnore) { + node.remove(); + return; + } + + if ((node = node.firstChild)) { + do { + removeIgnoredNodes(node); + } while ((node = node.next)); + } + } + + function convertParagraphToLi(paragraphNode, listName, start) { + var level = paragraphNode._listLevel || lastLevel; + + // Handle list nesting + if (level != lastLevel) { + if (level < lastLevel) { + // Move to parent list + if (currentListNode) { + currentListNode = currentListNode.parent.parent; + } + } else { + // Create new list + prevListNode = currentListNode; + currentListNode = null; + } + } + + if (!currentListNode || currentListNode.name != listName) { + prevListNode = prevListNode || currentListNode; + currentListNode = new Node(listName, 1); + + if (start > 1) { + currentListNode.attr('start', '' + start); + } + + paragraphNode.wrap(currentListNode); + } else { + currentListNode.append(paragraphNode); + } + + paragraphNode.name = 'li'; + + // Append list to previous list if it exists + if (level > lastLevel && prevListNode) { + prevListNode.lastChild.append(currentListNode); + } + + lastLevel = level; + + // Remove start of list item "1. " or "· " etc + removeIgnoredNodes(paragraphNode); + trimListStart(paragraphNode, /^\u00a0+/); + trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/); + trimListStart(paragraphNode, /^\u00a0+/); + } + + // Build a list of all root level elements before we start + // altering them in the loop below. + var elements = [], child = node.firstChild; + while (typeof child !== 'undefined' && child !== null) { + elements.push(child); + + child = child.walk(); + if (child !== null) { + while (typeof child !== 'undefined' && child.parent !== node) { + child = child.walk(); + } + } + } + + for (var i = 0; i < elements.length; i++) { + node = elements[i]; + + if (node.name == 'p' && node.firstChild) { + // Find first text node in paragraph + var nodeText = getText(node); + + // Detect unordered lists look for bullets + if (isBulletList(nodeText)) { + convertParagraphToLi(node, 'ul'); + continue; + } + + // Detect ordered lists 1., a. or ixv. + if (isNumericList(nodeText)) { + // Parse OL start number + var matches = /([0-9]+)\./.exec(nodeText); + var start = 1; + if (matches) { + start = parseInt(matches[1], 10); + } + + convertParagraphToLi(node, 'ol', start); + continue; + } + + // Convert paragraphs marked as lists but doesn't look like anything + if (node._listLevel) { + convertParagraphToLi(node, 'ul', 1); + continue; + } + + currentListNode = null; + } else { + // If the root level element isn't a p tag which can be + // processed by convertParagraphToLi, it interrupts the + // lists, causing a new list to start instead of having + // elements from the next list inserted above this tag. + prevListNode = currentListNode; + currentListNode = null; + } + } + } + + function filterStyles(node, styleValue) { + var outputStyles = {}, matches, styles = editor.dom.parseStyle(styleValue); + + Tools.each(styles, function(value, name) { + // Convert various MS styles to W3C styles + switch (name) { + case 'mso-list': + // Parse out list indent level for lists + matches = /\w+ \w+([0-9]+)/i.exec(styleValue); + if (matches) { + node._listLevel = parseInt(matches[1], 10); + } + + // Remove these nodes o + // Since the span gets removed we mark the text node and the span + if (/Ignore/i.test(value) && node.firstChild) { + node._listIgnore = true; + node.firstChild._listIgnore = true; + } + + break; + + case "horiz-align": + name = "text-align"; + break; + + case "vert-align": + name = "vertical-align"; + break; + + case "font-color": + case "mso-foreground": + name = "color"; + break; + + case "mso-background": + case "mso-highlight": + name = "background"; + break; + + case "font-weight": + case "font-style": + if (value != "normal") { + outputStyles[name] = value; + } + return; + + case "mso-element": + // Remove track changes code + if (/^(comment|comment-list)$/i.test(value)) { + node.remove(); + return; + } + + break; + } + + if (name.indexOf('mso-comment') === 0) { + node.remove(); + return; + } + + // Never allow mso- prefixed names + if (name.indexOf('mso-') === 0) { + return; + } + + // Output only valid styles + if (retainStyleProperties == "all" || (validStyles && validStyles[name])) { + outputStyles[name] = value; + } + }); + + // Convert bold style to "b" element + if (/(bold)/i.test(outputStyles["font-weight"])) { + delete outputStyles["font-weight"]; + node.wrap(new Node("b", 1)); + } + + // Convert italic style to "i" element + if (/(italic)/i.test(outputStyles["font-style"])) { + delete outputStyles["font-style"]; + node.wrap(new Node("i", 1)); + } + + // Serialize the styles and see if there is something left to keep + outputStyles = editor.dom.serializeStyle(outputStyles, node.name); + if (outputStyles) { + return outputStyles; + } + + return null; + } + + if (settings.paste_enable_default_filters === false) { + return; + } + + // Detect is the contents is Word junk HTML + if (isWordContent(e.content)) { + e.wordContent = true; // Mark it for other processors + + // Remove basic Word junk + content = Utils.filter(content, [ + // Word comments like conditional comments etc + //gi, + + // Remove comments, scripts (e.g., msoShowComment), XML tag, VML content, + // MS Office namespaced tags, and a few other tags + /<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi, + + // Convert into for line-though + [/<(\/?)s>/gi, "<$1strike>"], + + // Replace nsbp entites to char since it's easier to handle + [/ /gi, "\u00a0"], + + // Convert ___ to string of alternating + // breaking/non-breaking spaces of same length + [/([\s\u00a0]*)<\/span>/gi, + function(str, spaces) { + return (spaces.length > 0) ? + spaces.replace(/./, " ").slice(Math.floor(spaces.length / 2)).split("").join("\u00a0") : ""; + } + ] + ]); + + var validElements = settings.paste_word_valid_elements; + if (!validElements) { + validElements = ( + '-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' + + '-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' + + 'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody' + ); + } + + // Setup strict schema + var schema = new Schema({ + valid_elements: validElements, + valid_children: '-li[p]' + }); + + // Add style/class attribute to all element rules since the user might have removed them from + // paste_word_valid_elements config option and we need to check them for properties + Tools.each(schema.elements, function(rule) { + /*eslint dot-notation:0*/ + if (!rule.attributes["class"]) { + rule.attributes["class"] = {}; + rule.attributesOrder.push("class"); + } + + if (!rule.attributes.style) { + rule.attributes.style = {}; + rule.attributesOrder.push("style"); + } + }); + + // Parse HTML into DOM structure + var domParser = new DomParser({}, schema); + + // Filter styles to remove "mso" specific styles and convert some of them + domParser.addAttributeFilter('style', function(nodes) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i]; + node.attr('style', filterStyles(node, node.attr('style'))); + + // Remove pointess spans + if (node.name == 'span' && node.parent && !node.attributes.length) { + node.unwrap(); + } + } + }); + + // Check the class attribute for comments or del items and remove those + domParser.addAttributeFilter('class', function(nodes) { + var i = nodes.length, node, className; + + while (i--) { + node = nodes[i]; + + className = node.attr('class'); + if (/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)) { + node.remove(); + } + + node.attr('class', null); + } + }); + + // Remove all del elements since we don't want the track changes code in the editor + domParser.addNodeFilter('del', function(nodes) { + var i = nodes.length; + + while (i--) { + nodes[i].remove(); + } + }); + + // Keep some of the links and anchors + domParser.addNodeFilter('a', function(nodes) { + var i = nodes.length, node, href, name; + + while (i--) { + node = nodes[i]; + href = node.attr('href'); + name = node.attr('name'); + + if (href && href.indexOf('#_msocom_') != -1) { + node.remove(); + continue; + } + + if (href && href.indexOf('file://') === 0) { + href = href.split('#')[1]; + if (href) { + href = '#' + href; + } + } + + if (!href && !name) { + node.unwrap(); + } else { + // Remove all named anchors that aren't specific to TOC, Footnotes or Endnotes + if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) { + node.unwrap(); + continue; + } + + node.attr({ + href: href, + name: name + }); + } + } + }); + + // Parse into DOM structure + var rootNode = domParser.parse(content); + + // Process DOM + if (settings.paste_convert_word_fake_lists !== false) { + convertFakeListsToProperLists(rootNode); + } + + // Serialize DOM back to HTML + e.content = new Serializer({}, schema).serialize(rootNode); + } + }); + } + + WordFilter.isWordContent = isWordContent; + + return WordFilter; +}); + +// Included from: js/tinymce/plugins/paste/classes/Quirks.js + +/** + * Quirks.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class contains various fixes for browsers. These issues can not be feature + * detected since we have no direct control over the clipboard. However we might be able + * to remove some of these fixes once the browsers gets updated/fixed. + * + * @class tinymce.pasteplugin.Quirks + * @private + */ +define("tinymce/pasteplugin/Quirks", [ + "tinymce/Env", + "tinymce/util/Tools", + "tinymce/pasteplugin/WordFilter", + "tinymce/pasteplugin/Utils" +], function(Env, Tools, WordFilter, Utils) { + "use strict"; + + return function(editor) { + function addPreProcessFilter(filterFunc) { + editor.on('BeforePastePreProcess', function(e) { + e.content = filterFunc(e.content); + }); + } + + /** + * Removes BR elements after block elements. IE9 has a nasty bug where it puts a BR element after each + * block element when pasting from word. This removes those elements. + * + * This: + *

    a


    b

    + * + * Becomes: + *

    a

    b

    + */ + function removeExplorerBrElementsAfterBlocks(html) { + // Only filter word specific content + if (!WordFilter.isWordContent(html)) { + return html; + } + + // Produce block regexp based on the block elements in schema + var blockElements = []; + + Tools.each(editor.schema.getBlockElements(), function(block, blockName) { + blockElements.push(blockName); + }); + + var explorerBlocksRegExp = new RegExp( + '(?:
     [\\s\\r\\n]+|
    )*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:
     [\\s\\r\\n]+|
    )*', + 'g' + ); + + // Remove BR:s from: X
    + html = Utils.filter(html, [ + [explorerBlocksRegExp, '$1'] + ]); + + // IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break + html = Utils.filter(html, [ + [/

    /g, '

    '], // Replace multiple BR elements with uppercase BR to keep them intact + [/
    /g, ' '], // Replace single br elements with space since they are word wrap BR:s + [/

    /g, '
    '] // Replace back the double brs but into a single BR + ]); + + return html; + } + + /** + * WebKit has a nasty bug where the all computed styles gets added to style attributes when copy/pasting contents. + * This fix solves that by simply removing the whole style attribute. + * + * The paste_webkit_styles option can be set to specify what to keep: + * paste_webkit_styles: "none" // Keep no styles + * paste_webkit_styles: "all", // Keep all of them + * paste_webkit_styles: "font-weight color" // Keep specific ones + * + * @param {String} content Content that needs to be processed. + * @return {String} Processed contents. + */ + function removeWebKitStyles(content) { + // Passthrough all styles from Word and let the WordFilter handle that junk + if (WordFilter.isWordContent(content)) { + return content; + } + + // Filter away styles that isn't matching the target node + var webKitStyles = editor.settings.paste_webkit_styles; + + if (editor.settings.paste_remove_styles_if_webkit === false || webKitStyles == "all") { + return content; + } + + if (webKitStyles) { + webKitStyles = webKitStyles.split(/[, ]/); + } + + // Keep specific styles that doesn't match the current node computed style + if (webKitStyles) { + var dom = editor.dom, node = editor.selection.getNode(); + + content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function(all, before, value, after) { + var inputStyles = dom.parseStyle(value, 'span'), outputStyles = {}; + + if (webKitStyles === "none") { + return before + after; + } + + for (var i = 0; i < webKitStyles.length; i++) { + var inputValue = inputStyles[webKitStyles[i]], currentValue = dom.getStyle(node, webKitStyles[i], true); + + if (/color/.test(webKitStyles[i])) { + inputValue = dom.toHex(inputValue); + currentValue = dom.toHex(currentValue); + } + + if (currentValue != inputValue) { + outputStyles[webKitStyles[i]] = inputValue; + } + } + + outputStyles = dom.serializeStyle(outputStyles, 'span'); + if (outputStyles) { + return before + ' style="' + outputStyles + '"' + after; + } + + return before + after; + }); + } else { + // Remove all external styles + content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3'); + } + + // Keep internal styles + content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function(all, before, value, after) { + return before + ' style="' + value + '"' + after; + }); + + return content; + } + + // Sniff browsers and apply fixes since we can't feature detect + if (Env.webkit) { + addPreProcessFilter(removeWebKitStyles); + } + + if (Env.ie) { + addPreProcessFilter(removeExplorerBrElementsAfterBlocks); + } + }; +}); + +// Included from: js/tinymce/plugins/paste/classes/Plugin.js + +/** + * Plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class contains the tinymce plugin logic for the paste plugin. + * + * @class tinymce.pasteplugin.Plugin + * @private + */ +define("tinymce/pasteplugin/Plugin", [ + "tinymce/PluginManager", + "tinymce/pasteplugin/Clipboard", + "tinymce/pasteplugin/WordFilter", + "tinymce/pasteplugin/Quirks" +], function(PluginManager, Clipboard, WordFilter, Quirks) { + var userIsInformed; + + PluginManager.add('paste', function(editor) { + var self = this, clipboard, settings = editor.settings; + + function togglePlainTextPaste() { + if (clipboard.pasteFormat == "text") { + this.active(false); + clipboard.pasteFormat = "html"; + } else { + clipboard.pasteFormat = "text"; + this.active(true); + + if (!userIsInformed) { + editor.windowManager.alert( + 'Paste is now in plain text mode. Contents will now ' + + 'be pasted as plain text until you toggle this option off.' + ); + + userIsInformed = true; + } + } + } + + self.clipboard = clipboard = new Clipboard(editor); + self.quirks = new Quirks(editor); + self.wordFilter = new WordFilter(editor); + + if (editor.settings.paste_as_text) { + self.clipboard.pasteFormat = "text"; + } + + if (settings.paste_preprocess) { + editor.on('PastePreProcess', function(e) { + settings.paste_preprocess.call(self, self, e); + }); + } + + if (settings.paste_postprocess) { + editor.on('PastePostProcess', function(e) { + settings.paste_postprocess.call(self, self, e); + }); + } + + editor.addCommand('mceInsertClipboardContent', function(ui, value) { + if (value.content) { + self.clipboard.pasteHtml(value.content); + } + + if (value.text) { + self.clipboard.pasteText(value.text); + } + }); + + // Block all drag/drop events + if (editor.paste_block_drop) { + editor.on('dragend dragover draggesture dragdrop drop drag', function(e) { + e.preventDefault(); + e.stopPropagation(); + }); + } + + // Prevent users from dropping data images on Gecko + if (!editor.settings.paste_data_images) { + editor.on('drop', function(e) { + var dataTransfer = e.dataTransfer; + + if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) { + e.preventDefault(); + } + }); + } + + editor.addButton('pastetext', { + icon: 'pastetext', + tooltip: 'Paste as text', + onclick: togglePlainTextPaste, + active: self.clipboard.pasteFormat == "text" + }); + + editor.addMenuItem('pastetext', { + text: 'Paste as text', + selectable: true, + active: clipboard.pasteFormat, + onclick: togglePlainTextPaste + }); + }); +}); + +expose(["tinymce/pasteplugin/Utils"]); +})(this); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +(function(b,g){var d={};function c(m,n){var l,j=[];for(var k=0;k/g]);o(v.parse(r));return u}function j(o){function p(s,r,q){if(!r&&!q){return" "}return"\u00a0"}o=k(o,[/^[\s\S]*]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g,/|/g,[/( ?)\u00a0<\/span>( ?)/g,p],/
    $/i]);return o}return{filter:k,innerText:m,trimHtml:j}});h("tinymce/pasteplugin/Clipboard",["tinymce/Env","tinymce/dom/RangeUtils","tinymce/util/VK","tinymce/pasteplugin/Utils"],function(i,j,l,k){return function(q){var y=this,o,D,n=0,C=false;var r="%MCEPASTEBIN%",E;var s="data:text/mce-internal,";function A(K){var J,L=q.dom;J=q.fire("BeforePastePreProcess",{content:K});J=q.fire("PastePreProcess",J);K=J.content;if(!J.isDefaultPrevented()){if(q.hasEventListeners("PastePostProcess")&&!J.isDefaultPrevented()){var I=L.add(q.getBody(),"div",{style:"display:none"},K);J=q.fire("PastePostProcess",{node:I});L.remove(I);K=J.node.innerHTML}if(!J.isDefaultPrevented()){q.insertContent(K,{merge:q.settings.paste_merge_formats!==false})}}}function B(L){L=q.dom.encode(L).replace(/\r\n/g,"\n");var J=q.dom.getParent(q.selection.getStart(),q.dom.isBlock);var I=q.settings.forced_root_block;var K;if(I){K=q.dom.createHTML(I,q.settings.forced_root_block_attrs);K=K.substr(0,K.length-3)+">"}if((J&&/^(PRE|DIV)$/.test(J.nodeName))||!I){L=k.filter(L,[[/\n/g,"
    "]])}else{L=k.filter(L,[[/\n\n/g,"

    "+K],[/^(.*<\/p>)(

    )$/,K+"$1"],[/\n/g,"
    "]]);if(L.indexOf("

    ")!=-1){L=K+L}}A(L)}function t(){var K=q.dom,L=q.getBody();var M=q.dom.getViewPort(q.getWin()),J=M.y,O=20;var Q;D=q.selection.getRng();if(q.inline){Q=q.selection.getScrollContainer();if(Q&&Q.scrollTop>0){J=Q.scrollTop}}function N(S){var T,V,U,R=S.startContainer;T=S.getClientRects();if(T.length){return T[0]}if(!S.collapsed||R.nodeType!=1){return}U=R.childNodes[D.startOffset];while(U&&U.nodeType==3&&!U.data.length){U=U.nextSibling}if(!U){return}if(U.tagName=="BR"){V=K.doc.createTextNode("\uFEFF");U.parentNode.insertBefore(V,U);S=K.createRng();S.setStartBefore(V);S.setEndAfter(V);T=S.getClientRects();K.remove(V)}if(T.length){return T[0]}}if(D.getClientRects){var P=N(D);if(P){O=J+(P.top-K.getPos(L).y)}else{O=J;var I=D.startContainer;if(I){if(I.nodeType==3&&I.parentNode!=L){I=I.parentNode}if(I.nodeType==1){O=K.getPos(I,Q||L).y}}}}o=K.add(q.getBody(),"div",{id:"mcepastebin",contentEditable:true,"data-mce-bogus":"all",style:"position: absolute; top: "+O+"px;width: 10px; height: 10px; overflow: hidden; opacity: 0"},r);if(i.ie||i.gecko){K.setStyle(o,"left",K.getStyle(L,"direction",true)=="rtl"?65535:-65535)}K.bind(o,"beforedeactivate focusin focusout",function(R){R.stopPropagation()});o.focus();q.selection.select(o,true)}function H(){if(o){var I;while((I=q.dom.get("mcepastebin"))){q.dom.remove(I);q.dom.unbind(I)}if(D){q.selection.setRng(D)}}o=D=null}function G(){var L="",J,K,M,I;J=q.dom.select("div[id=mcepastebin]");for(K=0;K0){if(M.indexOf(s)==-1){J["text/plain"]=M}}}if(K.types){for(var I=0;I')}if(N){for(P=0;P0}function F(I){return(l.metaKeyPressed(I)&&I.keyCode==86)||(I.shiftKey&&I.keyCode==45)}function p(){q.on("keydown",function(I){function J(K){if(F(K)&&!K.isDefaultPrevented()){H()}}if(F(I)&&!I.isDefaultPrevented()){E=I.shiftKey&&I.keyCode==86;if(E&&i.webkit&&navigator.userAgent.indexOf("Version/")!=-1){return}I.stopImmediatePropagation();n=new Date().getTime();if(i.ie&&E){I.preventDefault();q.fire("paste",{ieFake:true});return}H();t();q.once("keyup",J);q.once("paste",function(){q.off("keyup",J)})}});q.on("paste",function(M){var N=new Date().getTime();var L=w(M);var J=new Date().getTime()-N;var I=(new Date().getTime()-n-J)<1000;var K=y.pasteFormat=="text"||E;E=false;if(M.isDefaultPrevented()||z(M)){H();return}if(u(M)){H();return}if(!I){M.preventDefault()}if(i.ie&&(!I||M.ieFake)){t();q.dom.bind(o,"paste",function(O){O.stopPropagation()});q.getDoc().execCommand("Paste",false,null);L["text/html"]=G()}setTimeout(function(){var O;if(x(L,"text/html")){O=L["text/html"]}else{O=G();if(O==r){K=true}}O=k.trimHtml(O);if(o&&o.firstChild&&o.firstChild.id==="mcepastebin"){K=true}H();if(!O.length){K=true}if(K){if(x(L,"text/plain")&&O.indexOf("

    ")==-1){O=L["text/plain"]}else{O=k.innerText(O)}}if(O==r){if(!I){q.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.")}return}if(K){B(O)}else{A(O)}},0)});q.on("dragstart dragend",function(I){C=I.type=="dragstart"});q.on("drop",function(L){var I=m(L);if(L.isDefaultPrevented()||C){return}if(u(L,I)){return}if(I&&q.settings.paste_filter_drop!==false){var J=v(L.dataTransfer);var K=J["mce-internal"]||J["text/html"]||J["text/plain"];if(K){L.preventDefault();q.undoManager.transact(function(){if(J["mce-internal"]){q.execCommand("Delete")}q.selection.setRng(I);K=k.trimHtml(K);if(!J["text/html"]){B(K)}else{A(K)}})}}});q.on("dragover dragend",function(I){if(q.settings.paste_data_images){I.preventDefault()}})}y.pasteHtml=A;y.pasteText=B;q.on("preInit",function(){p();q.parser.addNodeFilter("img",function(I){if(!q.settings.paste_data_images){var J=I.length;while(J--){var K=I[J].attributes.map.src;if(K&&/^(data:image|webkit\-fake\-url)/.test(K)){if(!I[J].attr("data-mce-object")&&K!==i.transparentSrc){I[J].remove()}}}}})})}});h("tinymce/pasteplugin/WordFilter",["tinymce/util/Tools","tinymce/html/DomParser","tinymce/html/Schema","tinymce/html/Serializer","tinymce/html/Node","tinymce/pasteplugin/Utils"],function(i,r,l,n,m,k){function q(s){return((/]+id="?docs-internal-[^>]*>/gi,"");C=C.replace(/
    /gi,"");B=s.paste_retain_style_properties;if(B){x=i.makeMap(B.split(/[, ]/))}function z(K){var H,Q,F=1;function P(T){var S="";if(T.type===3){return T.value}if((T=T.firstChild)){do{S+=P(T)}while((T=T.next))}return S}function N(T,S){if(T.type===3){if(S.test(T.value)){T.value=T.value.replace(S,"");return false}}if((T=T.firstChild)){do{if(!N(T,S)){return false}}while((T=T.next))}return true}function J(S){if(S._listIgnore){S.remove();return}if((S=S.firstChild)){do{J(S)}while((S=S.next))}}function R(S,T,V){var U=S._listLevel||F;if(U!=F){if(U1){H.attr("start",""+V)}S.wrap(H)}else{H.append(S)}S.name="li";if(U>F&&Q){Q.lastChild.append(H)}F=U;J(S);N(S,/^\u00a0+/);N(S,/^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/);N(S,/^\u00a0+/)}var E=[],I=K.firstChild;while(typeof I!=="undefined"&&I!==null){E.push(I);I=I.walk();if(I!==null){while(typeof I!=="undefined"&&I.parent!==K){I=I.walk()}}}for(var L=0;L/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/ /gi,"\u00a0"],[/([\s\u00a0]*)<\/span>/gi,function(F,E){return(E.length>0)?E.replace(/./," ").slice(Math.floor(E.length/2)).split("").join("\u00a0"):""}]]);var v=s.paste_word_valid_elements;if(!v){v=("-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody")}var y=new l({valid_elements:v,valid_children:"-li[p]"});i.each(y.elements,function(E){if(!E.attributes["class"]){E.attributes["class"]={};E.attributesOrder.push("class")}if(!E.attributes.style){E.attributes.style={};E.attributesOrder.push("style")}});var D=new r({},y);D.addAttributeFilter("style",function(E){var F=E.length,G;while(F--){G=E[F];G.attr("style",u(G,G.attr("style")));if(G.name=="span"&&G.parent&&!G.attributes.length){G.unwrap()}}});D.addAttributeFilter("class",function(E){var F=E.length,H,G;while(F--){H=E[F];G=H.attr("class");if(/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(G)){H.remove()}H.attr("class",null)}});D.addNodeFilter("del",function(E){var F=E.length;while(F--){E[F].remove()}});D.addNodeFilter("a",function(F){var H=F.length,I,E,G;while(H--){I=F[H];E=I.attr("href");G=I.attr("name");if(E&&E.indexOf("#_msocom_")!=-1){I.remove();continue}if(E&&E.indexOf("file://")===0){E=E.split("#")[1];if(E){E="#"+E}}if(!E&&!G){I.unwrap()}else{if(G&&!/^_?(?:toc|edn|ftn)/i.test(G)){I.unwrap();continue}I.attr({href:E,name:G})}}});var w=D.parse(C);if(s.paste_convert_word_fake_lists!==false){z(w)}A.content=new n({},y).serialize(w)}})}p.isWordContent=q;return p});h("tinymce/pasteplugin/Quirks",["tinymce/Env","tinymce/util/Tools","tinymce/pasteplugin/WordFilter","tinymce/pasteplugin/Utils"],function(i,j,l,k){return function(o){function p(q){o.on("BeforePastePreProcess",function(r){r.content=q(r.content)})}function n(q){if(!l.isWordContent(q)){return q}var r=[];j.each(o.schema.getBlockElements(),function(u,t){r.push(t)});var s=new RegExp("(?:
     [\\s\\r\\n]+|
    )*(<\\/?("+r.join("|")+")[^>]*>)(?:
     [\\s\\r\\n]+|
    )*","g");q=k.filter(q,[[s,"$1"]]);q=k.filter(q,[[/

    /g,"

    "],[/
    /g," "],[/

    /g,"
    "]]);return q}function m(s){if(l.isWordContent(s)){return s}var q=o.settings.paste_webkit_styles;if(o.settings.paste_remove_styles_if_webkit===false||q=="all"){return s}if(q){q=q.split(/[, ]/)}if(q){var t=o.dom,r=o.selection.getNode();s=s.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,function(B,z,A,u){var v=t.parseStyle(A,"span"),y={};if(q==="none"){return z+u}for(var x=0;x]+) style="([^"]*)"([^>]*>)/gi,"$1$3")}s=s.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,function(u,w,v,x){return w+' style="'+v+'"'+x});return s}if(i.webkit){p(m)}if(i.ie){p(n)}}});h("tinymce/pasteplugin/Plugin",["tinymce/PluginManager","tinymce/pasteplugin/Clipboard","tinymce/pasteplugin/WordFilter","tinymce/pasteplugin/Quirks"],function(i,m,l,j){var k;i.add("paste",function(q){var o=this,r,p=q.settings;function n(){if(r.pasteFormat=="text"){this.active(false);r.pasteFormat="html"}else{r.pasteFormat="text";this.active(true);if(!k){q.windowManager.alert("Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.");k=true}}}o.clipboard=r=new m(q);o.quirks=new j(q);o.wordFilter=new l(q);if(q.settings.paste_as_text){o.clipboard.pasteFormat="text"}if(p.paste_preprocess){q.on("PastePreProcess",function(s){p.paste_preprocess.call(o,o,s)})}if(p.paste_postprocess){q.on("PastePostProcess",function(s){p.paste_postprocess.call(o,o,s)})}q.addCommand("mceInsertClipboardContent",function(t,s){if(s.content){o.clipboard.pasteHtml(s.content)}if(s.text){o.clipboard.pasteText(s.text)}});if(q.paste_block_drop){q.on("dragend dragover draggesture dragdrop drop drag",function(s){s.preventDefault();s.stopPropagation()})}if(!q.settings.paste_data_images){q.on("drop",function(t){var s=t.dataTransfer;if(s&&s.files&&s.files.length>0){t.preventDefault()}})}q.addButton("pastetext",{icon:"pastetext",tooltip:"Paste as text",onclick:n,active:o.clipboard.pasteFormat=="text"});q.addMenuItem("pastetext",{text:"Paste as text",selectable:true,active:r.pasteFormat,onclick:n})})});a(["tinymce/pasteplugin/Utils"])})(this); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/preview/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/preview/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,88 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +tinymce.PluginManager.add('preview', function(editor) { + var settings = editor.settings, sandbox = !tinymce.Env.ie; + + editor.addCommand('mcePreview', function() { + editor.windowManager.open({ + title: 'Preview', + width: parseInt(editor.getParam("plugin_preview_width", "650"), 10), + height: parseInt(editor.getParam("plugin_preview_height", "500"), 10), + html: '', + buttons: { + text: 'Close', + onclick: function() { + this.parent().parent().close(); + } + }, + onPostRender: function() { + var previewHtml, headHtml = ''; + + headHtml += ''; + + tinymce.each(editor.contentCSS, function(url) { + headHtml += ''; + }); + + var bodyId = settings.body_id || 'tinymce'; + if (bodyId.indexOf('=') != -1) { + bodyId = editor.getParam('body_id', '', 'hash'); + bodyId = bodyId[editor.id] || bodyId; + } + + var bodyClass = settings.body_class || ''; + if (bodyClass.indexOf('=') != -1) { + bodyClass = editor.getParam('body_class', '', 'hash'); + bodyClass = bodyClass[editor.id] || ''; + } + + var dirAttr = editor.settings.directionality ? ' dir="' + editor.settings.directionality + '"' : ''; + + previewHtml = ( + '' + + '' + + '' + + headHtml + + '' + + '' + + editor.getContent() + + '' + + '' + ); + + if (!sandbox) { + // IE 6-11 doesn't support data uris on iframes + // so I guess they will have to be less secure since we can't sandbox on those + // TODO: Use sandbox if future versions of IE supports iframes with data: uris. + var doc = this.getEl('body').firstChild.contentWindow.document; + doc.open(); + doc.write(previewHtml); + doc.close(); + } else { + this.getEl('body').firstChild.src = 'data:text/html;charset=utf-8,' + encodeURIComponent(previewHtml); + } + } + }); + }); + + editor.addButton('preview', { + title: 'Preview', + cmd: 'mcePreview' + }); + + editor.addMenuItem('preview', { + text: 'Preview', + cmd: 'mcePreview', + context: 'view' + }); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/preview/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/preview/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("preview",function(c){var b=c.settings,a=!tinymce.Env.ie;c.addCommand("mcePreview",function(){c.windowManager.open({title:"Preview",width:parseInt(c.getParam("plugin_preview_width","650"),10),height:parseInt(c.getParam("plugin_preview_height","500"),10),html:'",buttons:{text:"Close",onclick:function(){this.parent().parent().close()}},onPostRender:function(){var d,g="";g+='';tinymce.each(c.contentCSS,function(j){g+=''});var h=b.body_id||"tinymce";if(h.indexOf("=")!=-1){h=c.getParam("body_id","","hash");h=h[c.id]||h}var f=b.body_class||"";if(f.indexOf("=")!=-1){f=c.getParam("body_class","","hash");f=f[c.id]||""}var e=c.settings.directionality?' dir="'+c.settings.directionality+'"':"";d=(""+g+'"+c.getContent()+"");if(!a){var i=this.getEl("body").firstChild.contentWindow.document;i.open();i.write(d);i.close()}else{this.getEl("body").firstChild.src="data:text/html;charset=utf-8,"+encodeURIComponent(d)}}})});c.addButton("preview",{title:"Preview",cmd:"mcePreview"});c.addMenuItem("preview",{text:"Preview",cmd:"mcePreview",context:"view"})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/print/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/print/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,32 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +tinymce.PluginManager.add('print', function(editor) { + editor.addCommand('mcePrint', function() { + editor.getWin().print(); + }); + + editor.addButton('print', { + title: 'Print', + cmd: 'mcePrint' + }); + + editor.addShortcut('Meta+P', '', 'mcePrint'); + + editor.addMenuItem('print', { + text: 'Print', + cmd: 'mcePrint', + icon: 'print', + shortcut: 'Meta+P', + context: 'file' + }); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/print/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/print/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("print",function(a){a.addCommand("mcePrint",function(){a.getWin().print()});a.addButton("print",{title:"Print",cmd:"mcePrint"});a.addShortcut("Meta+P","","mcePrint");a.addMenuItem("print",{text:"Print",cmd:"mcePrint",icon:"print",shortcut:"Meta+P",context:"file"})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/save/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/save/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,94 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +tinymce.PluginManager.add('save', function(editor) { + function save() { + var formObj; + + formObj = tinymce.DOM.getParent(editor.id, 'form'); + + if (editor.getParam("save_enablewhendirty", true) && !editor.isDirty()) { + return; + } + + tinymce.triggerSave(); + + // Use callback instead + if (editor.getParam("save_onsavecallback")) { + if (editor.execCallback('save_onsavecallback', editor)) { + editor.startContent = tinymce.trim(editor.getContent({format: 'raw'})); + editor.nodeChanged(); + } + + return; + } + + if (formObj) { + editor.isNotDirty = true; + + if (!formObj.onsubmit || formObj.onsubmit()) { + if (typeof formObj.submit == "function") { + formObj.submit(); + } else { + editor.windowManager.alert("Error: Form submit field collision."); + } + } + + editor.nodeChanged(); + } else { + editor.windowManager.alert("Error: No form element found."); + } + } + + function cancel() { + var h = tinymce.trim(editor.startContent); + + // Use callback instead + if (editor.getParam("save_oncancelcallback")) { + editor.execCallback('save_oncancelcallback', editor); + return; + } + + editor.setContent(h); + editor.undoManager.clear(); + editor.nodeChanged(); + } + + function stateToggle() { + var self = this; + + editor.on('nodeChange', function() { + self.disabled(editor.getParam("save_enablewhendirty", true) && !editor.isDirty()); + }); + } + + editor.addCommand('mceSave', save); + editor.addCommand('mceCancel', cancel); + + editor.addButton('save', { + icon: 'save', + text: 'Save', + cmd: 'mceSave', + disabled: true, + onPostRender: stateToggle + }); + + editor.addButton('cancel', { + text: 'Cancel', + icon: false, + cmd: 'mceCancel', + disabled: true, + onPostRender: stateToggle + }); + + editor.addShortcut('Meta+S', '', 'mceSave'); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/save/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/save/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("save",function(b){function d(){var e;e=tinymce.DOM.getParent(b.id,"form");if(b.getParam("save_enablewhendirty",true)&&!b.isDirty()){return}tinymce.triggerSave();if(b.getParam("save_onsavecallback")){if(b.execCallback("save_onsavecallback",b)){b.startContent=tinymce.trim(b.getContent({format:"raw"}));b.nodeChanged()}return}if(e){b.isNotDirty=true;if(!e.onsubmit||e.onsubmit()){if(typeof e.submit=="function"){e.submit()}else{b.windowManager.alert("Error: Form submit field collision.")}}b.nodeChanged()}else{b.windowManager.alert("Error: No form element found.")}}function c(){var e=tinymce.trim(b.startContent);if(b.getParam("save_oncancelcallback")){b.execCallback("save_oncancelcallback",b);return}b.setContent(e);b.undoManager.clear();b.nodeChanged()}function a(){var e=this;b.on("nodeChange",function(){e.disabled(b.getParam("save_enablewhendirty",true)&&!b.isDirty())})}b.addCommand("mceSave",d);b.addCommand("mceCancel",c);b.addButton("save",{icon:"save",text:"Save",cmd:"mceSave",disabled:true,onPostRender:a});b.addButton("cancel",{text:"Cancel",icon:false,cmd:"mceCancel",disabled:true,onPostRender:a});b.addShortcut("Meta+S","","mceSave")}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/searchreplace/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/searchreplace/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,594 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*jshint smarttabs:true, undef:true, unused:true, latedef:true, curly:true, bitwise:true */ +/*eslint no-labels:0, no-constant-condition: 0 */ +/*global tinymce:true */ + +(function() { + // Based on work developed by: James Padolsey http://james.padolsey.com + // released under UNLICENSE that is compatible with LGPL + // TODO: Handle contentEditable edgecase: + //

    texttexttexttexttext

    + function findAndReplaceDOMText(regex, node, replacementNode, captureGroup, schema) { + var m, matches = [], text, count = 0, doc; + var blockElementsMap, hiddenTextElementsMap, shortEndedElementsMap; + + doc = node.ownerDocument; + blockElementsMap = schema.getBlockElements(); // H1-H6, P, TD etc + hiddenTextElementsMap = schema.getWhiteSpaceElements(); // TEXTAREA, PRE, STYLE, SCRIPT + shortEndedElementsMap = schema.getShortEndedElements(); // BR, IMG, INPUT + + function getMatchIndexes(m, captureGroup) { + captureGroup = captureGroup || 0; + + if (!m[0]) { + throw 'findAndReplaceDOMText cannot handle zero-length matches'; + } + + var index = m.index; + + if (captureGroup > 0) { + var cg = m[captureGroup]; + + if (!cg) { + throw 'Invalid capture group'; + } + + index += m[0].indexOf(cg); + m[0] = cg; + } + + return [index, index + m[0].length, [m[0]]]; + } + + function getText(node) { + var txt; + + if (node.nodeType === 3) { + return node.data; + } + + if (hiddenTextElementsMap[node.nodeName] && !blockElementsMap[node.nodeName]) { + return ''; + } + + txt = ''; + + if (blockElementsMap[node.nodeName] || shortEndedElementsMap[node.nodeName]) { + txt += '\n'; + } + + if ((node = node.firstChild)) { + do { + txt += getText(node); + } while ((node = node.nextSibling)); + } + + return txt; + } + + function stepThroughMatches(node, matches, replaceFn) { + var startNode, endNode, startNodeIndex, + endNodeIndex, innerNodes = [], atIndex = 0, curNode = node, + matchLocation = matches.shift(), matchIndex = 0; + + out: while (true) { + if (blockElementsMap[curNode.nodeName] || shortEndedElementsMap[curNode.nodeName]) { + atIndex++; + } + + if (curNode.nodeType === 3) { + if (!endNode && curNode.length + atIndex >= matchLocation[1]) { + // We've found the ending + endNode = curNode; + endNodeIndex = matchLocation[1] - atIndex; + } else if (startNode) { + // Intersecting node + innerNodes.push(curNode); + } + + if (!startNode && curNode.length + atIndex > matchLocation[0]) { + // We've found the match start + startNode = curNode; + startNodeIndex = matchLocation[0] - atIndex; + } + + atIndex += curNode.length; + } + + if (startNode && endNode) { + curNode = replaceFn({ + startNode: startNode, + startNodeIndex: startNodeIndex, + endNode: endNode, + endNodeIndex: endNodeIndex, + innerNodes: innerNodes, + match: matchLocation[2], + matchIndex: matchIndex + }); + + // replaceFn has to return the node that replaced the endNode + // and then we step back so we can continue from the end of the + // match: + atIndex -= (endNode.length - endNodeIndex); + startNode = null; + endNode = null; + innerNodes = []; + matchLocation = matches.shift(); + matchIndex++; + + if (!matchLocation) { + break; // no more matches + } + } else if ((!hiddenTextElementsMap[curNode.nodeName] || blockElementsMap[curNode.nodeName]) && curNode.firstChild) { + // Move down + curNode = curNode.firstChild; + continue; + } else if (curNode.nextSibling) { + // Move forward: + curNode = curNode.nextSibling; + continue; + } + + // Move forward or up: + while (true) { + if (curNode.nextSibling) { + curNode = curNode.nextSibling; + break; + } else if (curNode.parentNode !== node) { + curNode = curNode.parentNode; + } else { + break out; + } + } + } + } + + /** + * Generates the actual replaceFn which splits up text nodes + * and inserts the replacement element. + */ + function genReplacer(nodeName) { + var makeReplacementNode; + + if (typeof nodeName != 'function') { + var stencilNode = nodeName.nodeType ? nodeName : doc.createElement(nodeName); + + makeReplacementNode = function(fill, matchIndex) { + var clone = stencilNode.cloneNode(false); + + clone.setAttribute('data-mce-index', matchIndex); + + if (fill) { + clone.appendChild(doc.createTextNode(fill)); + } + + return clone; + }; + } else { + makeReplacementNode = nodeName; + } + + return function(range) { + var before, after, parentNode, startNode = range.startNode, + endNode = range.endNode, matchIndex = range.matchIndex; + + if (startNode === endNode) { + var node = startNode; + + parentNode = node.parentNode; + if (range.startNodeIndex > 0) { + // Add `before` text node (before the match) + before = doc.createTextNode(node.data.substring(0, range.startNodeIndex)); + parentNode.insertBefore(before, node); + } + + // Create the replacement node: + var el = makeReplacementNode(range.match[0], matchIndex); + parentNode.insertBefore(el, node); + if (range.endNodeIndex < node.length) { + // Add `after` text node (after the match) + after = doc.createTextNode(node.data.substring(range.endNodeIndex)); + parentNode.insertBefore(after, node); + } + + node.parentNode.removeChild(node); + + return el; + } else { + // Replace startNode -> [innerNodes...] -> endNode (in that order) + before = doc.createTextNode(startNode.data.substring(0, range.startNodeIndex)); + after = doc.createTextNode(endNode.data.substring(range.endNodeIndex)); + var elA = makeReplacementNode(startNode.data.substring(range.startNodeIndex), matchIndex); + var innerEls = []; + + for (var i = 0, l = range.innerNodes.length; i < l; ++i) { + var innerNode = range.innerNodes[i]; + var innerEl = makeReplacementNode(innerNode.data, matchIndex); + innerNode.parentNode.replaceChild(innerEl, innerNode); + innerEls.push(innerEl); + } + + var elB = makeReplacementNode(endNode.data.substring(0, range.endNodeIndex), matchIndex); + + parentNode = startNode.parentNode; + parentNode.insertBefore(before, startNode); + parentNode.insertBefore(elA, startNode); + parentNode.removeChild(startNode); + + parentNode = endNode.parentNode; + parentNode.insertBefore(elB, endNode); + parentNode.insertBefore(after, endNode); + parentNode.removeChild(endNode); + + return elB; + } + }; + } + + text = getText(node); + if (!text) { + return; + } + + if (regex.global) { + while ((m = regex.exec(text))) { + matches.push(getMatchIndexes(m, captureGroup)); + } + } else { + m = text.match(regex); + matches.push(getMatchIndexes(m, captureGroup)); + } + + if (matches.length) { + count = matches.length; + stepThroughMatches(node, matches, genReplacer(replacementNode)); + } + + return count; + } + + function Plugin(editor) { + var self = this, currentIndex = -1; + + function showDialog() { + var last = {}; + + function updateButtonStates() { + win.statusbar.find('#next').disabled(!findSpansByIndex(currentIndex + 1).length); + win.statusbar.find('#prev').disabled(!findSpansByIndex(currentIndex - 1).length); + } + + function notFoundAlert() { + tinymce.ui.MessageBox.alert('Could not find the specified string.', function() { + win.find('#find')[0].focus(); + }); + } + + var win = tinymce.ui.Factory.create({ + type: 'window', + layout: "flex", + pack: "center", + align: "center", + onClose: function() { + editor.focus(); + self.done(); + }, + onSubmit: function(e) { + var count, caseState, text, wholeWord; + + e.preventDefault(); + + caseState = win.find('#case').checked(); + wholeWord = win.find('#words').checked(); + + text = win.find('#find').value(); + if (!text.length) { + self.done(false); + win.statusbar.items().slice(1).disabled(true); + return; + } + + if (last.text == text && last.caseState == caseState && last.wholeWord == wholeWord) { + if (findSpansByIndex(currentIndex + 1).length === 0) { + notFoundAlert(); + return; + } + + self.next(); + updateButtonStates(); + return; + } + + count = self.find(text, caseState, wholeWord); + if (!count) { + notFoundAlert(); + } + + win.statusbar.items().slice(1).disabled(count === 0); + updateButtonStates(); + + last = { + text: text, + caseState: caseState, + wholeWord: wholeWord + }; + }, + buttons: [ + {text: "Find", onclick: function() { + win.submit(); + }}, + {text: "Replace", disabled: true, onclick: function() { + if (!self.replace(win.find('#replace').value())) { + win.statusbar.items().slice(1).disabled(true); + currentIndex = -1; + last = {}; + } + }}, + {text: "Replace all", disabled: true, onclick: function() { + self.replace(win.find('#replace').value(), true, true); + win.statusbar.items().slice(1).disabled(true); + last = {}; + }}, + {type: "spacer", flex: 1}, + {text: "Prev", name: 'prev', disabled: true, onclick: function() { + self.prev(); + updateButtonStates(); + }}, + {text: "Next", name: 'next', disabled: true, onclick: function() { + self.next(); + updateButtonStates(); + }} + ], + title: "Find and replace", + items: { + type: "form", + padding: 20, + labelGap: 30, + spacing: 10, + items: [ + {type: 'textbox', name: 'find', size: 40, label: 'Find', value: editor.selection.getNode().src}, + {type: 'textbox', name: 'replace', size: 40, label: 'Replace with'}, + {type: 'checkbox', name: 'case', text: 'Match case', label: ' '}, + {type: 'checkbox', name: 'words', text: 'Whole words', label: ' '} + ] + } + }).renderTo().reflow(); + } + + self.init = function(ed) { + ed.addMenuItem('searchreplace', { + text: 'Find and replace', + shortcut: 'Meta+F', + onclick: showDialog, + separator: 'before', + context: 'edit' + }); + + ed.addButton('searchreplace', { + tooltip: 'Find and replace', + shortcut: 'Meta+F', + onclick: showDialog + }); + + ed.addCommand("SearchReplace", showDialog); + ed.shortcuts.add('Meta+F', '', showDialog); + }; + + function getElmIndex(elm) { + var value = elm.getAttribute('data-mce-index'); + + if (typeof value == "number") { + return "" + value; + } + + return value; + } + + function markAllMatches(regex) { + var node, marker; + + marker = editor.dom.create('span', { + "data-mce-bogus": 1 + }); + + marker.className = 'mce-match-marker'; // IE 7 adds class="mce-match-marker" and class=mce-match-marker + node = editor.getBody(); + + self.done(false); + + return findAndReplaceDOMText(regex, node, marker, false, editor.schema); + } + + function unwrap(node) { + var parentNode = node.parentNode; + + if (node.firstChild) { + parentNode.insertBefore(node.firstChild, node); + } + + node.parentNode.removeChild(node); + } + + function findSpansByIndex(index) { + var nodes, spans = []; + + nodes = tinymce.toArray(editor.getBody().getElementsByTagName('span')); + if (nodes.length) { + for (var i = 0; i < nodes.length; i++) { + var nodeIndex = getElmIndex(nodes[i]); + + if (nodeIndex === null || !nodeIndex.length) { + continue; + } + + if (nodeIndex === index.toString()) { + spans.push(nodes[i]); + } + } + } + + return spans; + } + + function moveSelection(forward) { + var testIndex = currentIndex, dom = editor.dom; + + forward = forward !== false; + + if (forward) { + testIndex++; + } else { + testIndex--; + } + + dom.removeClass(findSpansByIndex(currentIndex), 'mce-match-marker-selected'); + + var spans = findSpansByIndex(testIndex); + if (spans.length) { + dom.addClass(findSpansByIndex(testIndex), 'mce-match-marker-selected'); + editor.selection.scrollIntoView(spans[0]); + return testIndex; + } + + return -1; + } + + function removeNode(node) { + node.parentNode.removeChild(node); + } + + self.find = function(text, matchCase, wholeWord) { + text = text.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + text = wholeWord ? '\\b' + text + '\\b' : text; + + var count = markAllMatches(new RegExp(text, matchCase ? 'g' : 'gi')); + + if (count) { + currentIndex = -1; + currentIndex = moveSelection(true); + } + + return count; + }; + + self.next = function() { + var index = moveSelection(true); + + if (index !== -1) { + currentIndex = index; + } + }; + + self.prev = function() { + var index = moveSelection(false); + + if (index !== -1) { + currentIndex = index; + } + }; + + self.replace = function(text, forward, all) { + var i, nodes, node, matchIndex, currentMatchIndex, nextIndex = currentIndex, hasMore; + + forward = forward !== false; + + node = editor.getBody(); + nodes = tinymce.toArray(node.getElementsByTagName('span')); + for (i = 0; i < nodes.length; i++) { + var nodeIndex = getElmIndex(nodes[i]); + + if (nodeIndex === null || !nodeIndex.length) { + continue; + } + + matchIndex = currentMatchIndex = parseInt(nodeIndex, 10); + if (all || matchIndex === currentIndex) { + if (text.length) { + nodes[i].firstChild.nodeValue = text; + unwrap(nodes[i]); + } else { + removeNode(nodes[i]); + } + + while (nodes[++i]) { + matchIndex = getElmIndex(nodes[i]); + + if (nodeIndex === null || !nodeIndex.length) { + continue; + } + + if (matchIndex === currentMatchIndex) { + removeNode(nodes[i]); + } else { + i--; + break; + } + } + + if (forward) { + nextIndex--; + } + } else if (currentMatchIndex > currentIndex) { + nodes[i].setAttribute('data-mce-index', currentMatchIndex - 1); + } + } + + editor.undoManager.add(); + currentIndex = nextIndex; + + if (forward) { + hasMore = findSpansByIndex(nextIndex + 1).length > 0; + self.next(); + } else { + hasMore = findSpansByIndex(nextIndex - 1).length > 0; + self.prev(); + } + + return !all && hasMore; + }; + + self.done = function(keepEditorSelection) { + var i, nodes, startContainer, endContainer; + + nodes = tinymce.toArray(editor.getBody().getElementsByTagName('span')); + for (i = 0; i < nodes.length; i++) { + var nodeIndex = getElmIndex(nodes[i]); + + if (nodeIndex !== null && nodeIndex.length) { + if (nodeIndex === currentIndex.toString()) { + if (!startContainer) { + startContainer = nodes[i].firstChild; + } + + endContainer = nodes[i].firstChild; + } + + unwrap(nodes[i]); + } + } + + if (startContainer && endContainer) { + var rng = editor.dom.createRng(); + rng.setStart(startContainer, 0); + rng.setEnd(endContainer, endContainer.data.length); + + if (keepEditorSelection !== false) { + editor.selection.setRng(rng); + } + + return rng; + } + }; + } + + tinymce.PluginManager.add('searchreplace', Plugin); +})(); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/searchreplace/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/searchreplace/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +(function(){function b(n,f,c,t,h){var g,i=[],s,l=0,o;var r,d,k;o=f.ownerDocument;r=h.getBlockElements();d=h.getWhiteSpaceElements();k=h.getShortEndedElements();function p(u,v){v=v||0;if(!u[0]){throw"findAndReplaceDOMText cannot handle zero-length matches"}var w=u.index;if(v>0){var x=u[v];if(!x){throw"Invalid capture group"}w+=u[0].indexOf(x);u[0]=x}return[w,w+u[0].length,[u[0]]]}function q(u){var m;if(u.nodeType===3){return u.data}if(d[u.nodeName]&&!r[u.nodeName]){return""}m="";if(r[u.nodeName]||k[u.nodeName]){m+="\n"}if((u=u.firstChild)){do{m+=q(u)}while((u=u.nextSibling))}return m}function j(w,y,C){var u,B,z,v,D=[],A=0,x=w,m=y.shift(),E=0;out:while(true){if(r[x.nodeName]||k[x.nodeName]){A++}if(x.nodeType===3){if(!B&&x.length+A>=m[1]){B=x;v=m[1]-A}else{if(u){D.push(x)}}if(!u&&x.length+A>m[0]){u=x;z=m[0]-A}A+=x.length}if(u&&B){x=C({startNode:u,startNodeIndex:z,endNode:B,endNodeIndex:v,innerNodes:D,match:m[2],matchIndex:E});A-=(B.length-v);u=null;B=null;D=[];m=y.shift();E++;if(!m){break}}else{if((!d[x.nodeName]||r[x.nodeName])&&x.firstChild){x=x.firstChild;continue}else{if(x.nextSibling){x=x.nextSibling;continue}}}while(true){if(x.nextSibling){x=x.nextSibling;break}else{if(x.parentNode!==w){x=x.parentNode}else{break out}}}}}function e(v){var m;if(typeof v!="function"){var u=v.nodeType?v:o.createElement(v);m=function(x,w){var y=u.cloneNode(false);y.setAttribute("data-mce-index",w);if(x){y.appendChild(o.createTextNode(x))}return y}}else{m=v}return function(C){var J,w,D,y=C.startNode,F=C.endNode,K=C.matchIndex;if(y===F){var z=y;D=z.parentNode;if(C.startNodeIndex>0){J=o.createTextNode(z.data.substring(0,C.startNodeIndex));D.insertBefore(J,z)}var x=m(C.match[0],K);D.insertBefore(x,z);if(C.endNodeIndexh){m[r].setAttribute("data-mce-index",q-1)}}}f.undoManager.add();h=s;if(t){n=c(s+1).length>0;l.next()}else{n=c(s-1).length>0;l.prev()}return !v&&n};l.done=function(o){var p,n,q,r;n=tinymce.toArray(f.getBody().getElementsByTagName("span"));for(p=0;ptexttexttexttexttext

    + return function(node, editor) { + var m, matches = [], text, dom = editor.dom; + var blockElementsMap, hiddenTextElementsMap, shortEndedElementsMap; + + blockElementsMap = editor.schema.getBlockElements(); // H1-H6, P, TD etc + hiddenTextElementsMap = editor.schema.getWhiteSpaceElements(); // TEXTAREA, PRE, STYLE, SCRIPT + shortEndedElementsMap = editor.schema.getShortEndedElements(); // BR, IMG, INPUT + + function createMatch(m, data) { + if (!m[0]) { + throw 'findAndReplaceDOMText cannot handle zero-length matches'; + } + + return { + start: m.index, + end: m.index + m[0].length, + text: m[0], + data: data + }; + } + + function getText(node) { + var txt; + + if (node.nodeType === 3) { + return node.data; + } + + if (hiddenTextElementsMap[node.nodeName] && !blockElementsMap[node.nodeName]) { + return ''; + } + + txt = ''; + + if (blockElementsMap[node.nodeName] || shortEndedElementsMap[node.nodeName]) { + txt += '\n'; + } + + if ((node = node.firstChild)) { + do { + txt += getText(node); + } while ((node = node.nextSibling)); + } + + return txt; + } + + function stepThroughMatches(node, matches, replaceFn) { + var startNode, endNode, startNodeIndex, + endNodeIndex, innerNodes = [], atIndex = 0, curNode = node, + matchLocation, matchIndex = 0; + + matches = matches.slice(0); + matches.sort(function(a, b) { + return a.start - b.start; + }); + + matchLocation = matches.shift(); + + out: while (true) { + if (blockElementsMap[curNode.nodeName] || shortEndedElementsMap[curNode.nodeName]) { + atIndex++; + } + + if (curNode.nodeType === 3) { + if (!endNode && curNode.length + atIndex >= matchLocation.end) { + // We've found the ending + endNode = curNode; + endNodeIndex = matchLocation.end - atIndex; + } else if (startNode) { + // Intersecting node + innerNodes.push(curNode); + } + + if (!startNode && curNode.length + atIndex > matchLocation.start) { + // We've found the match start + startNode = curNode; + startNodeIndex = matchLocation.start - atIndex; + } + + atIndex += curNode.length; + } + + if (startNode && endNode) { + curNode = replaceFn({ + startNode: startNode, + startNodeIndex: startNodeIndex, + endNode: endNode, + endNodeIndex: endNodeIndex, + innerNodes: innerNodes, + match: matchLocation.text, + matchIndex: matchIndex + }); + + // replaceFn has to return the node that replaced the endNode + // and then we step back so we can continue from the end of the + // match: + atIndex -= (endNode.length - endNodeIndex); + startNode = null; + endNode = null; + innerNodes = []; + matchLocation = matches.shift(); + matchIndex++; + + if (!matchLocation) { + break; // no more matches + } + } else if ((!hiddenTextElementsMap[curNode.nodeName] || blockElementsMap[curNode.nodeName]) && curNode.firstChild) { + // Move down + curNode = curNode.firstChild; + continue; + } else if (curNode.nextSibling) { + // Move forward: + curNode = curNode.nextSibling; + continue; + } + + // Move forward or up: + while (true) { + if (curNode.nextSibling) { + curNode = curNode.nextSibling; + break; + } else if (curNode.parentNode !== node) { + curNode = curNode.parentNode; + } else { + break out; + } + } + } + } + + /** + * Generates the actual replaceFn which splits up text nodes + * and inserts the replacement element. + */ + function genReplacer(callback) { + function makeReplacementNode(fill, matchIndex) { + var match = matches[matchIndex]; + + if (!match.stencil) { + match.stencil = callback(match); + } + + var clone = match.stencil.cloneNode(false); + clone.setAttribute('data-mce-index', matchIndex); + + if (fill) { + clone.appendChild(dom.doc.createTextNode(fill)); + } + + return clone; + } + + return function(range) { + var before, after, parentNode, startNode = range.startNode, + endNode = range.endNode, matchIndex = range.matchIndex, + doc = dom.doc; + + if (startNode === endNode) { + var node = startNode; + + parentNode = node.parentNode; + if (range.startNodeIndex > 0) { + // Add "before" text node (before the match) + before = doc.createTextNode(node.data.substring(0, range.startNodeIndex)); + parentNode.insertBefore(before, node); + } + + // Create the replacement node: + var el = makeReplacementNode(range.match, matchIndex); + parentNode.insertBefore(el, node); + if (range.endNodeIndex < node.length) { + // Add "after" text node (after the match) + after = doc.createTextNode(node.data.substring(range.endNodeIndex)); + parentNode.insertBefore(after, node); + } + + node.parentNode.removeChild(node); + + return el; + } else { + // Replace startNode -> [innerNodes...] -> endNode (in that order) + before = doc.createTextNode(startNode.data.substring(0, range.startNodeIndex)); + after = doc.createTextNode(endNode.data.substring(range.endNodeIndex)); + var elA = makeReplacementNode(startNode.data.substring(range.startNodeIndex), matchIndex); + var innerEls = []; + + for (var i = 0, l = range.innerNodes.length; i < l; ++i) { + var innerNode = range.innerNodes[i]; + var innerEl = makeReplacementNode(innerNode.data, matchIndex); + innerNode.parentNode.replaceChild(innerEl, innerNode); + innerEls.push(innerEl); + } + + var elB = makeReplacementNode(endNode.data.substring(0, range.endNodeIndex), matchIndex); + + parentNode = startNode.parentNode; + parentNode.insertBefore(before, startNode); + parentNode.insertBefore(elA, startNode); + parentNode.removeChild(startNode); + + parentNode = endNode.parentNode; + parentNode.insertBefore(elB, endNode); + parentNode.insertBefore(after, endNode); + parentNode.removeChild(endNode); + + return elB; + } + }; + } + + function unwrapElement(element) { + var parentNode = element.parentNode; + parentNode.insertBefore(element.firstChild, element); + element.parentNode.removeChild(element); + } + + function getWrappersByIndex(index) { + var elements = node.getElementsByTagName('*'), wrappers = []; + + index = typeof index == "number" ? "" + index : null; + + for (var i = 0; i < elements.length; i++) { + var element = elements[i], dataIndex = element.getAttribute('data-mce-index'); + + if (dataIndex !== null && dataIndex.length) { + if (dataIndex === index || index === null) { + wrappers.push(element); + } + } + } + + return wrappers; + } + + /** + * Returns the index of a specific match object or -1 if it isn't found. + * + * @param {Match} match Text match object. + * @return {Number} Index of match or -1 if it isn't found. + */ + function indexOf(match) { + var i = matches.length; + while (i--) { + if (matches[i] === match) { + return i; + } + } + + return -1; + } + + /** + * Filters the matches. If the callback returns true it stays if not it gets removed. + * + * @param {Function} callback Callback to execute for each match. + * @return {DomTextMatcher} Current DomTextMatcher instance. + */ + function filter(callback) { + var filteredMatches = []; + + each(function(match, i) { + if (callback(match, i)) { + filteredMatches.push(match); + } + }); + + matches = filteredMatches; + + /*jshint validthis:true*/ + return this; + } + + /** + * Executes the specified callback for each match. + * + * @param {Function} callback Callback to execute for each match. + * @return {DomTextMatcher} Current DomTextMatcher instance. + */ + function each(callback) { + for (var i = 0, l = matches.length; i < l; i++) { + if (callback(matches[i], i) === false) { + break; + } + } + + /*jshint validthis:true*/ + return this; + } + + /** + * Wraps the current matches with nodes created by the specified callback. + * Multiple clones of these matches might occur on matches that are on multiple nodex. + * + * @param {Function} callback Callback to execute in order to create elements for matches. + * @return {DomTextMatcher} Current DomTextMatcher instance. + */ + function wrap(callback) { + if (matches.length) { + stepThroughMatches(node, matches, genReplacer(callback)); + } + + /*jshint validthis:true*/ + return this; + } + + /** + * Finds the specified regexp and adds them to the matches collection. + * + * @param {RegExp} regex Global regexp to search the current node by. + * @param {Object} [data] Optional custom data element for the match. + * @return {DomTextMatcher} Current DomTextMatcher instance. + */ + function find(regex, data) { + if (text && regex.global) { + while ((m = regex.exec(text))) { + matches.push(createMatch(m, data)); + } + } + + return this; + } + + /** + * Unwraps the specified match object or all matches if unspecified. + * + * @param {Object} [match] Optional match object. + * @return {DomTextMatcher} Current DomTextMatcher instance. + */ + function unwrap(match) { + var i, elements = getWrappersByIndex(match ? indexOf(match) : null); + + i = elements.length; + while (i--) { + unwrapElement(elements[i]); + } + + return this; + } + + /** + * Returns a match object by the specified DOM element. + * + * @param {DOMElement} element Element to return match object for. + * @return {Object} Match object for the specified element. + */ + function matchFromElement(element) { + return matches[element.getAttribute('data-mce-index')]; + } + + /** + * Returns a DOM element from the specified match element. This will be the first element if it's split + * on multiple nodes. + * + * @param {Object} match Match element to get first element of. + * @return {DOMElement} DOM element for the specified match object. + */ + function elementFromMatch(match) { + return getWrappersByIndex(indexOf(match))[0]; + } + + /** + * Adds match the specified range for example a grammar line. + * + * @param {Number} start Start offset. + * @param {Number} length Length of the text. + * @param {Object} data Custom data object for match. + * @return {DomTextMatcher} Current DomTextMatcher instance. + */ + function add(start, length, data) { + matches.push({ + start: start, + end: start + length, + text: text.substr(start, length), + data: data + }); + + return this; + } + + /** + * Returns a DOM range for the specified match. + * + * @param {Object} match Match object to get range for. + * @return {DOMRange} DOM Range for the specified match. + */ + function rangeFromMatch(match) { + var wrappers = getWrappersByIndex(indexOf(match)); + + var rng = editor.dom.createRng(); + rng.setStartBefore(wrappers[0]); + rng.setEndAfter(wrappers[wrappers.length - 1]); + + return rng; + } + + /** + * Replaces the specified match with the specified text. + * + * @param {Object} match Match object to replace. + * @param {String} text Text to replace the match with. + * @return {DOMRange} DOM range produced after the replace. + */ + function replace(match, text) { + var rng = rangeFromMatch(match); + + rng.deleteContents(); + + if (text.length > 0) { + rng.insertNode(editor.dom.doc.createTextNode(text)); + } + + return rng; + } + + /** + * Resets the DomTextMatcher instance. This will remove any wrapped nodes and remove any matches. + * + * @return {[type]} [description] + */ + function reset() { + matches.splice(0, matches.length); + unwrap(); + + return this; + } + + text = getText(node); + + return { + text: text, + matches: matches, + each: each, + filter: filter, + reset: reset, + matchFromElement: matchFromElement, + elementFromMatch: elementFromMatch, + find: find, + add: add, + wrap: wrap, + unwrap: unwrap, + replace: replace, + rangeFromMatch: rangeFromMatch, + indexOf: indexOf + }; + }; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/classes/Plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/classes/Plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,436 @@ +/** + * Plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*jshint camelcase:false */ + +/** + * This class contains all core logic for the spellchecker plugin. + * + * @class tinymce.spellcheckerplugin.Plugin + * @private + */ +define("tinymce/spellcheckerplugin/Plugin", [ + "tinymce/spellcheckerplugin/DomTextMatcher", + "tinymce/PluginManager", + "tinymce/util/Tools", + "tinymce/ui/Menu", + "tinymce/dom/DOMUtils", + "tinymce/util/XHR", + "tinymce/util/URI", + "tinymce/util/JSON" +], function(DomTextMatcher, PluginManager, Tools, Menu, DOMUtils, XHR, URI, JSON) { + PluginManager.add('spellchecker', function(editor, url) { + var languageMenuItems, self = this, lastSuggestions, started, suggestionsMenu, settings = editor.settings; + var hasDictionarySupport; + + function getTextMatcher() { + if (!self.textMatcher) { + self.textMatcher = new DomTextMatcher(editor.getBody(), editor); + } + + return self.textMatcher; + } + + function buildMenuItems(listName, languageValues) { + var items = []; + + Tools.each(languageValues, function(languageValue) { + items.push({ + selectable: true, + text: languageValue.name, + data: languageValue.value + }); + }); + + return items; + } + + var languagesString = settings.spellchecker_languages || + 'English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr_FR,' + + 'German=de,Italian=it,Polish=pl,Portuguese=pt_BR,' + + 'Spanish=es,Swedish=sv'; + + languageMenuItems = buildMenuItems('Language', + Tools.map(languagesString.split(','), function(langPair) { + langPair = langPair.split('='); + + return { + name: langPair[0], + value: langPair[1] + }; + }) + ); + + function isEmpty(obj) { + /*jshint unused:false*/ + /*eslint no-unused-vars:0 */ + for (var name in obj) { + return false; + } + + return true; + } + + function showSuggestions(word, spans) { + var items = [], suggestions = lastSuggestions[word]; + + Tools.each(suggestions, function(suggestion) { + items.push({ + text: suggestion, + onclick: function() { + editor.insertContent(editor.dom.encode(suggestion)); + editor.dom.remove(spans); + checkIfFinished(); + } + }); + }); + + items.push({text: '-'}); + + if (hasDictionarySupport) { + items.push({text: 'Add to Dictionary', onclick: function() { + addToDictionary(word, spans); + }}); + } + + items.push.apply(items, [ + {text: 'Ignore', onclick: function() { + ignoreWord(word, spans); + }}, + + {text: 'Ignore all', onclick: function() { + ignoreWord(word, spans, true); + }} + ]); + + // Render menu + suggestionsMenu = new Menu({ + items: items, + context: 'contextmenu', + onautohide: function(e) { + if (e.target.className.indexOf('spellchecker') != -1) { + e.preventDefault(); + } + }, + onhide: function() { + suggestionsMenu.remove(); + suggestionsMenu = null; + } + }); + + suggestionsMenu.renderTo(document.body); + + // Position menu + var pos = DOMUtils.DOM.getPos(editor.getContentAreaContainer()); + var targetPos = editor.dom.getPos(spans[0]); + var root = editor.dom.getRoot(); + + // Adjust targetPos for scrolling in the editor + if (root.nodeName == 'BODY') { + targetPos.x -= root.ownerDocument.documentElement.scrollLeft || root.scrollLeft; + targetPos.y -= root.ownerDocument.documentElement.scrollTop || root.scrollTop; + } else { + targetPos.x -= root.scrollLeft; + targetPos.y -= root.scrollTop; + } + + pos.x += targetPos.x; + pos.y += targetPos.y; + + suggestionsMenu.moveTo(pos.x, pos.y + spans[0].offsetHeight); + } + + function getWordCharPattern() { + // Regexp for finding word specific characters this will split words by + // spaces, quotes, copy right characters etc. It's escaped with unicode characters + // to make it easier to output scripts on servers using different encodings + // so if you add any characters outside the 128 byte range make sure to escape it + return editor.getParam('spellchecker_wordchar_pattern') || new RegExp("[^" + + "\\s!\"#$%&()*+,-./:;<=>?@[\\]^_{|}`" + + "\u00a7\u00a9\u00ab\u00ae\u00b1\u00b6\u00b7\u00b8\u00bb" + + "\u00bc\u00bd\u00be\u00bf\u00d7\u00f7\u00a4\u201d\u201c\u201e\u00a0\u2002\u2003\u2009" + + "]+", "g"); + } + + function defaultSpellcheckCallback(method, text, doneCallback, errorCallback) { + var data = {method: method}, postData = ''; + + if (method == "spellcheck") { + data.text = text; + data.lang = settings.spellchecker_language; + } + + if (method == "addToDictionary") { + data.word = text; + } + + Tools.each(data, function(value, key) { + if (postData) { + postData += '&'; + } + + postData += key + '=' + encodeURIComponent(value); + }); + + XHR.send({ + url: new URI(url).toAbsolute(settings.spellchecker_rpc_url), + type: "post", + content_type: 'application/x-www-form-urlencoded', + data: postData, + success: function(result) { + result = JSON.parse(result); + + if (!result) { + errorCallback("Sever response wasn't proper JSON."); + } else if (result.error) { + errorCallback(result.error); + } else { + doneCallback(result); + } + }, + error: function(type, xhr) { + errorCallback("Spellchecker request error: " + xhr.status); + } + }); + } + + function sendRpcCall(name, data, successCallback, errorCallback) { + var spellCheckCallback = settings.spellchecker_callback || defaultSpellcheckCallback; + spellCheckCallback.call(self, name, data, successCallback, errorCallback); + } + + function spellcheck() { + if (started) { + finish(); + return; + } else { + finish(); + } + + function errorCallback(message) { + editor.windowManager.alert(message); + editor.setProgressState(false); + finish(); + } + + editor.setProgressState(true); + sendRpcCall("spellcheck", getTextMatcher().text, markErrors, errorCallback); + editor.focus(); + } + + function checkIfFinished() { + if (!editor.dom.select('span.mce-spellchecker-word').length) { + finish(); + } + } + + function addToDictionary(word, spans) { + editor.setProgressState(true); + + sendRpcCall("addToDictionary", word, function() { + editor.setProgressState(false); + editor.dom.remove(spans, true); + checkIfFinished(); + }, function(message) { + editor.windowManager.alert(message); + editor.setProgressState(false); + }); + } + + function ignoreWord(word, spans, all) { + editor.selection.collapse(); + + if (all) { + Tools.each(editor.dom.select('span.mce-spellchecker-word'), function(span) { + if (span.getAttribute('data-mce-word') == word) { + editor.dom.remove(span, true); + } + }); + } else { + editor.dom.remove(spans, true); + } + + checkIfFinished(); + } + + function finish() { + getTextMatcher().reset(); + self.textMatcher = null; + + if (started) { + started = false; + editor.fire('SpellcheckEnd'); + } + } + + function getElmIndex(elm) { + var value = elm.getAttribute('data-mce-index'); + + if (typeof value == "number") { + return "" + value; + } + + return value; + } + + function findSpansByIndex(index) { + var nodes, spans = []; + + nodes = Tools.toArray(editor.getBody().getElementsByTagName('span')); + if (nodes.length) { + for (var i = 0; i < nodes.length; i++) { + var nodeIndex = getElmIndex(nodes[i]); + + if (nodeIndex === null || !nodeIndex.length) { + continue; + } + + if (nodeIndex === index.toString()) { + spans.push(nodes[i]); + } + } + } + + return spans; + } + + editor.on('click', function(e) { + var target = e.target; + + if (target.className == "mce-spellchecker-word") { + e.preventDefault(); + + var spans = findSpansByIndex(getElmIndex(target)); + + if (spans.length > 0) { + var rng = editor.dom.createRng(); + rng.setStartBefore(spans[0]); + rng.setEndAfter(spans[spans.length - 1]); + editor.selection.setRng(rng); + showSuggestions(target.getAttribute('data-mce-word'), spans); + } + } + }); + + editor.addMenuItem('spellchecker', { + text: 'Spellcheck', + context: 'tools', + onclick: spellcheck, + selectable: true, + onPostRender: function() { + var self = this; + + self.active(started); + + editor.on('SpellcheckStart SpellcheckEnd', function() { + self.active(started); + }); + } + }); + + function updateSelection(e) { + var selectedLanguage = settings.spellchecker_language; + + e.control.items().each(function(ctrl) { + ctrl.active(ctrl.settings.data === selectedLanguage); + }); + } + + /** + * Find the specified words and marks them. It will also show suggestions for those words. + * + * @example + * editor.plugins.spellchecker.markErrors({ + * dictionary: true, + * words: { + * "word1": ["suggestion 1", "Suggestion 2"] + * } + * }); + * @param {Object} data Data object containing the words with suggestions. + */ + function markErrors(data) { + var suggestions; + + if (data.words) { + hasDictionarySupport = !!data.dictionary; + suggestions = data.words; + } else { + // Fallback to old format + suggestions = data; + } + + editor.setProgressState(false); + + if (isEmpty(suggestions)) { + editor.windowManager.alert('No misspellings found'); + started = false; + return; + } + + lastSuggestions = suggestions; + + getTextMatcher().find(getWordCharPattern()).filter(function(match) { + return !!suggestions[match.text]; + }).wrap(function(match) { + return editor.dom.create('span', { + "class": 'mce-spellchecker-word', + "data-mce-bogus": 1, + "data-mce-word": match.text + }); + }); + + started = true; + editor.fire('SpellcheckStart'); + } + + var buttonArgs = { + tooltip: 'Spellcheck', + onclick: spellcheck, + onPostRender: function() { + var self = this; + + editor.on('SpellcheckStart SpellcheckEnd', function() { + self.active(started); + }); + } + }; + + if (languageMenuItems.length > 1) { + buttonArgs.type = 'splitbutton'; + buttonArgs.menu = languageMenuItems; + buttonArgs.onshow = updateSelection; + buttonArgs.onselect = function(e) { + settings.spellchecker_language = e.control.settings.data; + }; + } + + editor.addButton('spellchecker', buttonArgs); + editor.addCommand('mceSpellCheck', spellcheck); + + editor.on('remove', function() { + if (suggestionsMenu) { + suggestionsMenu.remove(); + suggestionsMenu = null; + } + }); + + editor.on('change', checkIfFinished); + + this.getTextMatcher = getTextMatcher; + this.getWordCharPattern = getWordCharPattern; + this.markErrors = markErrors; + this.getLanguage = function() { + return settings.spellchecker_language; + }; + + // Set default spellchecker language if it's not specified + settings.spellchecker_language = settings.spellchecker_language || settings.language || 'en'; + }); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/plugin.dev.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/plugin.dev.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,117 @@ +/** + * Inline development version. Only to be used while developing since it uses document.write to load scripts. + */ + +/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */ +/*globals $code */ + +(function(exports) { + "use strict"; + + var html = "", baseDir; + var modules = {}, exposedModules = [], moduleCount = 0; + + var scripts = document.getElementsByTagName('script'); + for (var i = 0; i < scripts.length; i++) { + var src = scripts[i].src; + + if (src.indexOf('/plugin.dev.js') != -1) { + baseDir = src.substring(0, src.lastIndexOf('/')); + } + } + + function require(ids, callback) { + var module, defs = []; + + for (var i = 0; i < ids.length; ++i) { + module = modules[ids[i]] || resolve(ids[i]); + if (!module) { + throw 'module definition dependecy not found: ' + ids[i]; + } + + defs.push(module); + } + + callback.apply(null, defs); + } + + function resolve(id) { + var target = exports; + var fragments = id.split(/[.\/]/); + + for (var fi = 0; fi < fragments.length; ++fi) { + if (!target[fragments[fi]]) { + return; + } + + target = target[fragments[fi]]; + } + + return target; + } + + function register(id) { + var target = exports; + var fragments = id.split(/[.\/]/); + + for (var fi = 0; fi < fragments.length - 1; ++fi) { + if (target[fragments[fi]] === undefined) { + target[fragments[fi]] = {}; + } + + target = target[fragments[fi]]; + } + + target[fragments[fragments.length - 1]] = modules[id]; + } + + function define(id, dependencies, definition) { + if (typeof id !== 'string') { + throw 'invalid module definition, module id must be defined and be a string'; + } + + if (dependencies === undefined) { + throw 'invalid module definition, dependencies must be specified'; + } + + if (definition === undefined) { + throw 'invalid module definition, definition function must be specified'; + } + + require(dependencies, function() { + modules[id] = definition.apply(null, arguments); + }); + + if (--moduleCount === 0) { + for (var i = 0; i < exposedModules.length; i++) { + register(exposedModules[i]); + } + } + } + + function expose(ids) { + exposedModules = ids; + } + + function writeScripts() { + document.write(html); + } + + function load(path) { + html += '\n'; + moduleCount++; + } + + // Expose globally + exports.define = define; + exports.require = require; + + expose(["tinymce/spellcheckerplugin/DomTextMatcher"]); + + load('classes/DomTextMatcher.js'); + load('classes/Plugin.js'); + + writeScripts(); +})(this); + +// $hash: 71db3b0268e64137c268d50724a7efdc \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,996 @@ +/** + * Compiled inline version. (Library mode) + */ + +/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */ +/*globals $code */ + +(function(exports, undefined) { + "use strict"; + + var modules = {}; + + function require(ids, callback) { + var module, defs = []; + + for (var i = 0; i < ids.length; ++i) { + module = modules[ids[i]] || resolve(ids[i]); + if (!module) { + throw 'module definition dependecy not found: ' + ids[i]; + } + + defs.push(module); + } + + callback.apply(null, defs); + } + + function define(id, dependencies, definition) { + if (typeof id !== 'string') { + throw 'invalid module definition, module id must be defined and be a string'; + } + + if (dependencies === undefined) { + throw 'invalid module definition, dependencies must be specified'; + } + + if (definition === undefined) { + throw 'invalid module definition, definition function must be specified'; + } + + require(dependencies, function() { + modules[id] = definition.apply(null, arguments); + }); + } + + function defined(id) { + return !!modules[id]; + } + + function resolve(id) { + var target = exports; + var fragments = id.split(/[.\/]/); + + for (var fi = 0; fi < fragments.length; ++fi) { + if (!target[fragments[fi]]) { + return; + } + + target = target[fragments[fi]]; + } + + return target; + } + + function expose(ids) { + for (var i = 0; i < ids.length; i++) { + var target = exports; + var id = ids[i]; + var fragments = id.split(/[.\/]/); + + for (var fi = 0; fi < fragments.length - 1; ++fi) { + if (target[fragments[fi]] === undefined) { + target[fragments[fi]] = {}; + } + + target = target[fragments[fi]]; + } + + target[fragments[fragments.length - 1]] = modules[id]; + } + } + +// Included from: js/tinymce/plugins/spellchecker/classes/DomTextMatcher.js + +/** + * DomTextMatcher.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*eslint no-labels:0, no-constant-condition: 0 */ + +/** + * This class logic for filtering text and matching words. + * + * @class tinymce.spellcheckerplugin.TextFilter + * @private + */ +define("tinymce/spellcheckerplugin/DomTextMatcher", [], function() { + // Based on work developed by: James Padolsey http://james.padolsey.com + // released under UNLICENSE that is compatible with LGPL + // TODO: Handle contentEditable edgecase: + //

    texttexttexttexttext

    + return function(node, editor) { + var m, matches = [], text, dom = editor.dom; + var blockElementsMap, hiddenTextElementsMap, shortEndedElementsMap; + + blockElementsMap = editor.schema.getBlockElements(); // H1-H6, P, TD etc + hiddenTextElementsMap = editor.schema.getWhiteSpaceElements(); // TEXTAREA, PRE, STYLE, SCRIPT + shortEndedElementsMap = editor.schema.getShortEndedElements(); // BR, IMG, INPUT + + function createMatch(m, data) { + if (!m[0]) { + throw 'findAndReplaceDOMText cannot handle zero-length matches'; + } + + return { + start: m.index, + end: m.index + m[0].length, + text: m[0], + data: data + }; + } + + function getText(node) { + var txt; + + if (node.nodeType === 3) { + return node.data; + } + + if (hiddenTextElementsMap[node.nodeName] && !blockElementsMap[node.nodeName]) { + return ''; + } + + txt = ''; + + if (blockElementsMap[node.nodeName] || shortEndedElementsMap[node.nodeName]) { + txt += '\n'; + } + + if ((node = node.firstChild)) { + do { + txt += getText(node); + } while ((node = node.nextSibling)); + } + + return txt; + } + + function stepThroughMatches(node, matches, replaceFn) { + var startNode, endNode, startNodeIndex, + endNodeIndex, innerNodes = [], atIndex = 0, curNode = node, + matchLocation, matchIndex = 0; + + matches = matches.slice(0); + matches.sort(function(a, b) { + return a.start - b.start; + }); + + matchLocation = matches.shift(); + + out: while (true) { + if (blockElementsMap[curNode.nodeName] || shortEndedElementsMap[curNode.nodeName]) { + atIndex++; + } + + if (curNode.nodeType === 3) { + if (!endNode && curNode.length + atIndex >= matchLocation.end) { + // We've found the ending + endNode = curNode; + endNodeIndex = matchLocation.end - atIndex; + } else if (startNode) { + // Intersecting node + innerNodes.push(curNode); + } + + if (!startNode && curNode.length + atIndex > matchLocation.start) { + // We've found the match start + startNode = curNode; + startNodeIndex = matchLocation.start - atIndex; + } + + atIndex += curNode.length; + } + + if (startNode && endNode) { + curNode = replaceFn({ + startNode: startNode, + startNodeIndex: startNodeIndex, + endNode: endNode, + endNodeIndex: endNodeIndex, + innerNodes: innerNodes, + match: matchLocation.text, + matchIndex: matchIndex + }); + + // replaceFn has to return the node that replaced the endNode + // and then we step back so we can continue from the end of the + // match: + atIndex -= (endNode.length - endNodeIndex); + startNode = null; + endNode = null; + innerNodes = []; + matchLocation = matches.shift(); + matchIndex++; + + if (!matchLocation) { + break; // no more matches + } + } else if ((!hiddenTextElementsMap[curNode.nodeName] || blockElementsMap[curNode.nodeName]) && curNode.firstChild) { + // Move down + curNode = curNode.firstChild; + continue; + } else if (curNode.nextSibling) { + // Move forward: + curNode = curNode.nextSibling; + continue; + } + + // Move forward or up: + while (true) { + if (curNode.nextSibling) { + curNode = curNode.nextSibling; + break; + } else if (curNode.parentNode !== node) { + curNode = curNode.parentNode; + } else { + break out; + } + } + } + } + + /** + * Generates the actual replaceFn which splits up text nodes + * and inserts the replacement element. + */ + function genReplacer(callback) { + function makeReplacementNode(fill, matchIndex) { + var match = matches[matchIndex]; + + if (!match.stencil) { + match.stencil = callback(match); + } + + var clone = match.stencil.cloneNode(false); + clone.setAttribute('data-mce-index', matchIndex); + + if (fill) { + clone.appendChild(dom.doc.createTextNode(fill)); + } + + return clone; + } + + return function(range) { + var before, after, parentNode, startNode = range.startNode, + endNode = range.endNode, matchIndex = range.matchIndex, + doc = dom.doc; + + if (startNode === endNode) { + var node = startNode; + + parentNode = node.parentNode; + if (range.startNodeIndex > 0) { + // Add "before" text node (before the match) + before = doc.createTextNode(node.data.substring(0, range.startNodeIndex)); + parentNode.insertBefore(before, node); + } + + // Create the replacement node: + var el = makeReplacementNode(range.match, matchIndex); + parentNode.insertBefore(el, node); + if (range.endNodeIndex < node.length) { + // Add "after" text node (after the match) + after = doc.createTextNode(node.data.substring(range.endNodeIndex)); + parentNode.insertBefore(after, node); + } + + node.parentNode.removeChild(node); + + return el; + } else { + // Replace startNode -> [innerNodes...] -> endNode (in that order) + before = doc.createTextNode(startNode.data.substring(0, range.startNodeIndex)); + after = doc.createTextNode(endNode.data.substring(range.endNodeIndex)); + var elA = makeReplacementNode(startNode.data.substring(range.startNodeIndex), matchIndex); + var innerEls = []; + + for (var i = 0, l = range.innerNodes.length; i < l; ++i) { + var innerNode = range.innerNodes[i]; + var innerEl = makeReplacementNode(innerNode.data, matchIndex); + innerNode.parentNode.replaceChild(innerEl, innerNode); + innerEls.push(innerEl); + } + + var elB = makeReplacementNode(endNode.data.substring(0, range.endNodeIndex), matchIndex); + + parentNode = startNode.parentNode; + parentNode.insertBefore(before, startNode); + parentNode.insertBefore(elA, startNode); + parentNode.removeChild(startNode); + + parentNode = endNode.parentNode; + parentNode.insertBefore(elB, endNode); + parentNode.insertBefore(after, endNode); + parentNode.removeChild(endNode); + + return elB; + } + }; + } + + function unwrapElement(element) { + var parentNode = element.parentNode; + parentNode.insertBefore(element.firstChild, element); + element.parentNode.removeChild(element); + } + + function getWrappersByIndex(index) { + var elements = node.getElementsByTagName('*'), wrappers = []; + + index = typeof index == "number" ? "" + index : null; + + for (var i = 0; i < elements.length; i++) { + var element = elements[i], dataIndex = element.getAttribute('data-mce-index'); + + if (dataIndex !== null && dataIndex.length) { + if (dataIndex === index || index === null) { + wrappers.push(element); + } + } + } + + return wrappers; + } + + /** + * Returns the index of a specific match object or -1 if it isn't found. + * + * @param {Match} match Text match object. + * @return {Number} Index of match or -1 if it isn't found. + */ + function indexOf(match) { + var i = matches.length; + while (i--) { + if (matches[i] === match) { + return i; + } + } + + return -1; + } + + /** + * Filters the matches. If the callback returns true it stays if not it gets removed. + * + * @param {Function} callback Callback to execute for each match. + * @return {DomTextMatcher} Current DomTextMatcher instance. + */ + function filter(callback) { + var filteredMatches = []; + + each(function(match, i) { + if (callback(match, i)) { + filteredMatches.push(match); + } + }); + + matches = filteredMatches; + + /*jshint validthis:true*/ + return this; + } + + /** + * Executes the specified callback for each match. + * + * @param {Function} callback Callback to execute for each match. + * @return {DomTextMatcher} Current DomTextMatcher instance. + */ + function each(callback) { + for (var i = 0, l = matches.length; i < l; i++) { + if (callback(matches[i], i) === false) { + break; + } + } + + /*jshint validthis:true*/ + return this; + } + + /** + * Wraps the current matches with nodes created by the specified callback. + * Multiple clones of these matches might occur on matches that are on multiple nodex. + * + * @param {Function} callback Callback to execute in order to create elements for matches. + * @return {DomTextMatcher} Current DomTextMatcher instance. + */ + function wrap(callback) { + if (matches.length) { + stepThroughMatches(node, matches, genReplacer(callback)); + } + + /*jshint validthis:true*/ + return this; + } + + /** + * Finds the specified regexp and adds them to the matches collection. + * + * @param {RegExp} regex Global regexp to search the current node by. + * @param {Object} [data] Optional custom data element for the match. + * @return {DomTextMatcher} Current DomTextMatcher instance. + */ + function find(regex, data) { + if (text && regex.global) { + while ((m = regex.exec(text))) { + matches.push(createMatch(m, data)); + } + } + + return this; + } + + /** + * Unwraps the specified match object or all matches if unspecified. + * + * @param {Object} [match] Optional match object. + * @return {DomTextMatcher} Current DomTextMatcher instance. + */ + function unwrap(match) { + var i, elements = getWrappersByIndex(match ? indexOf(match) : null); + + i = elements.length; + while (i--) { + unwrapElement(elements[i]); + } + + return this; + } + + /** + * Returns a match object by the specified DOM element. + * + * @param {DOMElement} element Element to return match object for. + * @return {Object} Match object for the specified element. + */ + function matchFromElement(element) { + return matches[element.getAttribute('data-mce-index')]; + } + + /** + * Returns a DOM element from the specified match element. This will be the first element if it's split + * on multiple nodes. + * + * @param {Object} match Match element to get first element of. + * @return {DOMElement} DOM element for the specified match object. + */ + function elementFromMatch(match) { + return getWrappersByIndex(indexOf(match))[0]; + } + + /** + * Adds match the specified range for example a grammar line. + * + * @param {Number} start Start offset. + * @param {Number} length Length of the text. + * @param {Object} data Custom data object for match. + * @return {DomTextMatcher} Current DomTextMatcher instance. + */ + function add(start, length, data) { + matches.push({ + start: start, + end: start + length, + text: text.substr(start, length), + data: data + }); + + return this; + } + + /** + * Returns a DOM range for the specified match. + * + * @param {Object} match Match object to get range for. + * @return {DOMRange} DOM Range for the specified match. + */ + function rangeFromMatch(match) { + var wrappers = getWrappersByIndex(indexOf(match)); + + var rng = editor.dom.createRng(); + rng.setStartBefore(wrappers[0]); + rng.setEndAfter(wrappers[wrappers.length - 1]); + + return rng; + } + + /** + * Replaces the specified match with the specified text. + * + * @param {Object} match Match object to replace. + * @param {String} text Text to replace the match with. + * @return {DOMRange} DOM range produced after the replace. + */ + function replace(match, text) { + var rng = rangeFromMatch(match); + + rng.deleteContents(); + + if (text.length > 0) { + rng.insertNode(editor.dom.doc.createTextNode(text)); + } + + return rng; + } + + /** + * Resets the DomTextMatcher instance. This will remove any wrapped nodes and remove any matches. + * + * @return {[type]} [description] + */ + function reset() { + matches.splice(0, matches.length); + unwrap(); + + return this; + } + + text = getText(node); + + return { + text: text, + matches: matches, + each: each, + filter: filter, + reset: reset, + matchFromElement: matchFromElement, + elementFromMatch: elementFromMatch, + find: find, + add: add, + wrap: wrap, + unwrap: unwrap, + replace: replace, + rangeFromMatch: rangeFromMatch, + indexOf: indexOf + }; + }; +}); + +// Included from: js/tinymce/plugins/spellchecker/classes/Plugin.js + +/** + * Plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*jshint camelcase:false */ + +/** + * This class contains all core logic for the spellchecker plugin. + * + * @class tinymce.spellcheckerplugin.Plugin + * @private + */ +define("tinymce/spellcheckerplugin/Plugin", [ + "tinymce/spellcheckerplugin/DomTextMatcher", + "tinymce/PluginManager", + "tinymce/util/Tools", + "tinymce/ui/Menu", + "tinymce/dom/DOMUtils", + "tinymce/util/XHR", + "tinymce/util/URI", + "tinymce/util/JSON" +], function(DomTextMatcher, PluginManager, Tools, Menu, DOMUtils, XHR, URI, JSON) { + PluginManager.add('spellchecker', function(editor, url) { + var languageMenuItems, self = this, lastSuggestions, started, suggestionsMenu, settings = editor.settings; + var hasDictionarySupport; + + function getTextMatcher() { + if (!self.textMatcher) { + self.textMatcher = new DomTextMatcher(editor.getBody(), editor); + } + + return self.textMatcher; + } + + function buildMenuItems(listName, languageValues) { + var items = []; + + Tools.each(languageValues, function(languageValue) { + items.push({ + selectable: true, + text: languageValue.name, + data: languageValue.value + }); + }); + + return items; + } + + var languagesString = settings.spellchecker_languages || + 'English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr_FR,' + + 'German=de,Italian=it,Polish=pl,Portuguese=pt_BR,' + + 'Spanish=es,Swedish=sv'; + + languageMenuItems = buildMenuItems('Language', + Tools.map(languagesString.split(','), function(langPair) { + langPair = langPair.split('='); + + return { + name: langPair[0], + value: langPair[1] + }; + }) + ); + + function isEmpty(obj) { + /*jshint unused:false*/ + /*eslint no-unused-vars:0 */ + for (var name in obj) { + return false; + } + + return true; + } + + function showSuggestions(word, spans) { + var items = [], suggestions = lastSuggestions[word]; + + Tools.each(suggestions, function(suggestion) { + items.push({ + text: suggestion, + onclick: function() { + editor.insertContent(editor.dom.encode(suggestion)); + editor.dom.remove(spans); + checkIfFinished(); + } + }); + }); + + items.push({text: '-'}); + + if (hasDictionarySupport) { + items.push({text: 'Add to Dictionary', onclick: function() { + addToDictionary(word, spans); + }}); + } + + items.push.apply(items, [ + {text: 'Ignore', onclick: function() { + ignoreWord(word, spans); + }}, + + {text: 'Ignore all', onclick: function() { + ignoreWord(word, spans, true); + }} + ]); + + // Render menu + suggestionsMenu = new Menu({ + items: items, + context: 'contextmenu', + onautohide: function(e) { + if (e.target.className.indexOf('spellchecker') != -1) { + e.preventDefault(); + } + }, + onhide: function() { + suggestionsMenu.remove(); + suggestionsMenu = null; + } + }); + + suggestionsMenu.renderTo(document.body); + + // Position menu + var pos = DOMUtils.DOM.getPos(editor.getContentAreaContainer()); + var targetPos = editor.dom.getPos(spans[0]); + var root = editor.dom.getRoot(); + + // Adjust targetPos for scrolling in the editor + if (root.nodeName == 'BODY') { + targetPos.x -= root.ownerDocument.documentElement.scrollLeft || root.scrollLeft; + targetPos.y -= root.ownerDocument.documentElement.scrollTop || root.scrollTop; + } else { + targetPos.x -= root.scrollLeft; + targetPos.y -= root.scrollTop; + } + + pos.x += targetPos.x; + pos.y += targetPos.y; + + suggestionsMenu.moveTo(pos.x, pos.y + spans[0].offsetHeight); + } + + function getWordCharPattern() { + // Regexp for finding word specific characters this will split words by + // spaces, quotes, copy right characters etc. It's escaped with unicode characters + // to make it easier to output scripts on servers using different encodings + // so if you add any characters outside the 128 byte range make sure to escape it + return editor.getParam('spellchecker_wordchar_pattern') || new RegExp("[^" + + "\\s!\"#$%&()*+,-./:;<=>?@[\\]^_{|}`" + + "\u00a7\u00a9\u00ab\u00ae\u00b1\u00b6\u00b7\u00b8\u00bb" + + "\u00bc\u00bd\u00be\u00bf\u00d7\u00f7\u00a4\u201d\u201c\u201e\u00a0\u2002\u2003\u2009" + + "]+", "g"); + } + + function defaultSpellcheckCallback(method, text, doneCallback, errorCallback) { + var data = {method: method}, postData = ''; + + if (method == "spellcheck") { + data.text = text; + data.lang = settings.spellchecker_language; + } + + if (method == "addToDictionary") { + data.word = text; + } + + Tools.each(data, function(value, key) { + if (postData) { + postData += '&'; + } + + postData += key + '=' + encodeURIComponent(value); + }); + + XHR.send({ + url: new URI(url).toAbsolute(settings.spellchecker_rpc_url), + type: "post", + content_type: 'application/x-www-form-urlencoded', + data: postData, + success: function(result) { + result = JSON.parse(result); + + if (!result) { + errorCallback("Sever response wasn't proper JSON."); + } else if (result.error) { + errorCallback(result.error); + } else { + doneCallback(result); + } + }, + error: function(type, xhr) { + errorCallback("Spellchecker request error: " + xhr.status); + } + }); + } + + function sendRpcCall(name, data, successCallback, errorCallback) { + var spellCheckCallback = settings.spellchecker_callback || defaultSpellcheckCallback; + spellCheckCallback.call(self, name, data, successCallback, errorCallback); + } + + function spellcheck() { + if (started) { + finish(); + return; + } else { + finish(); + } + + function errorCallback(message) { + editor.windowManager.alert(message); + editor.setProgressState(false); + finish(); + } + + editor.setProgressState(true); + sendRpcCall("spellcheck", getTextMatcher().text, markErrors, errorCallback); + editor.focus(); + } + + function checkIfFinished() { + if (!editor.dom.select('span.mce-spellchecker-word').length) { + finish(); + } + } + + function addToDictionary(word, spans) { + editor.setProgressState(true); + + sendRpcCall("addToDictionary", word, function() { + editor.setProgressState(false); + editor.dom.remove(spans, true); + checkIfFinished(); + }, function(message) { + editor.windowManager.alert(message); + editor.setProgressState(false); + }); + } + + function ignoreWord(word, spans, all) { + editor.selection.collapse(); + + if (all) { + Tools.each(editor.dom.select('span.mce-spellchecker-word'), function(span) { + if (span.getAttribute('data-mce-word') == word) { + editor.dom.remove(span, true); + } + }); + } else { + editor.dom.remove(spans, true); + } + + checkIfFinished(); + } + + function finish() { + getTextMatcher().reset(); + self.textMatcher = null; + + if (started) { + started = false; + editor.fire('SpellcheckEnd'); + } + } + + function getElmIndex(elm) { + var value = elm.getAttribute('data-mce-index'); + + if (typeof value == "number") { + return "" + value; + } + + return value; + } + + function findSpansByIndex(index) { + var nodes, spans = []; + + nodes = Tools.toArray(editor.getBody().getElementsByTagName('span')); + if (nodes.length) { + for (var i = 0; i < nodes.length; i++) { + var nodeIndex = getElmIndex(nodes[i]); + + if (nodeIndex === null || !nodeIndex.length) { + continue; + } + + if (nodeIndex === index.toString()) { + spans.push(nodes[i]); + } + } + } + + return spans; + } + + editor.on('click', function(e) { + var target = e.target; + + if (target.className == "mce-spellchecker-word") { + e.preventDefault(); + + var spans = findSpansByIndex(getElmIndex(target)); + + if (spans.length > 0) { + var rng = editor.dom.createRng(); + rng.setStartBefore(spans[0]); + rng.setEndAfter(spans[spans.length - 1]); + editor.selection.setRng(rng); + showSuggestions(target.getAttribute('data-mce-word'), spans); + } + } + }); + + editor.addMenuItem('spellchecker', { + text: 'Spellcheck', + context: 'tools', + onclick: spellcheck, + selectable: true, + onPostRender: function() { + var self = this; + + self.active(started); + + editor.on('SpellcheckStart SpellcheckEnd', function() { + self.active(started); + }); + } + }); + + function updateSelection(e) { + var selectedLanguage = settings.spellchecker_language; + + e.control.items().each(function(ctrl) { + ctrl.active(ctrl.settings.data === selectedLanguage); + }); + } + + /** + * Find the specified words and marks them. It will also show suggestions for those words. + * + * @example + * editor.plugins.spellchecker.markErrors({ + * dictionary: true, + * words: { + * "word1": ["suggestion 1", "Suggestion 2"] + * } + * }); + * @param {Object} data Data object containing the words with suggestions. + */ + function markErrors(data) { + var suggestions; + + if (data.words) { + hasDictionarySupport = !!data.dictionary; + suggestions = data.words; + } else { + // Fallback to old format + suggestions = data; + } + + editor.setProgressState(false); + + if (isEmpty(suggestions)) { + editor.windowManager.alert('No misspellings found'); + started = false; + return; + } + + lastSuggestions = suggestions; + + getTextMatcher().find(getWordCharPattern()).filter(function(match) { + return !!suggestions[match.text]; + }).wrap(function(match) { + return editor.dom.create('span', { + "class": 'mce-spellchecker-word', + "data-mce-bogus": 1, + "data-mce-word": match.text + }); + }); + + started = true; + editor.fire('SpellcheckStart'); + } + + var buttonArgs = { + tooltip: 'Spellcheck', + onclick: spellcheck, + onPostRender: function() { + var self = this; + + editor.on('SpellcheckStart SpellcheckEnd', function() { + self.active(started); + }); + } + }; + + if (languageMenuItems.length > 1) { + buttonArgs.type = 'splitbutton'; + buttonArgs.menu = languageMenuItems; + buttonArgs.onshow = updateSelection; + buttonArgs.onselect = function(e) { + settings.spellchecker_language = e.control.settings.data; + }; + } + + editor.addButton('spellchecker', buttonArgs); + editor.addCommand('mceSpellCheck', spellcheck); + + editor.on('remove', function() { + if (suggestionsMenu) { + suggestionsMenu.remove(); + suggestionsMenu = null; + } + }); + + editor.on('change', checkIfFinished); + + this.getTextMatcher = getTextMatcher; + this.getWordCharPattern = getWordCharPattern; + this.markErrors = markErrors; + this.getLanguage = function() { + return settings.spellchecker_language; + }; + + // Set default spellchecker language if it's not specified + settings.spellchecker_language = settings.spellchecker_language || settings.language || 'en'; + }); +}); + +expose(["tinymce/spellcheckerplugin/DomTextMatcher"]); +})(this); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/spellchecker/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +(function(b,g){var d={};function c(m,n){var l,j=[];for(var k=0;k=m.end){R=N;L=m.end-Q}else{if(K){T.push(N)}}if(!K&&N.length+Q>m.start){K=N;P=m.start-Q}Q+=N.length}if(K&&R){N=S({startNode:K,startNodeIndex:P,endNode:R,endNodeIndex:L,innerNodes:T,match:m.text,matchIndex:U});Q-=(R.length-L);K=null;R=null;T=[];m=O.shift();U++;if(!m){break}}else{if((!t[N.nodeName]||y[N.nodeName])&&N.firstChild){N=N.firstChild;continue}else{if(N.nextSibling){N=N.nextSibling;continue}}}while(true){if(N.nextSibling){N=N.nextSibling;break}else{if(N.parentNode!==M){N=N.parentNode}else{break out}}}}}function v(K){function m(N,L){var M=k[L];if(!M.stencil){M.stencil=K(M)}var O=M.stencil.cloneNode(false);O.setAttribute("data-mce-index",L);if(N){O.appendChild(G.doc.createTextNode(N))}return O}return function(R){var Y,L,S,N=R.startNode,U=R.endNode,Z=R.matchIndex,aa=G.doc;if(N===U){var O=N;S=O.parentNode;if(R.startNodeIndex>0){Y=aa.createTextNode(O.data.substring(0,R.startNodeIndex));S.insertBefore(Y,O)}var M=m(R.match,Z);S.insertBefore(M,O);if(R.endNodeIndex0){m.insertNode(n.dom.doc.createTextNode(L))}return m}function J(){k.splice(0,k.length);A();return this}s=i(C);return{text:s,matches:k,each:l,filter:r,reset:J,matchFromElement:z,elementFromMatch:u,find:x,add:w,wrap:q,unwrap:A,replace:I,rangeFromMatch:p,indexOf:j}}});h("tinymce/spellcheckerplugin/Plugin",["tinymce/spellcheckerplugin/DomTextMatcher","tinymce/PluginManager","tinymce/util/Tools","tinymce/ui/Menu","tinymce/dom/DOMUtils","tinymce/util/XHR","tinymce/util/URI","tinymce/util/JSON"],function(p,k,j,m,n,l,i,o){k.add("spellchecker",function(r,u){var z,A=this,Q,q,H,M=r.settings;var N;function P(){if(!A.textMatcher){A.textMatcher=new p(r.getBody(),r)}return A.textMatcher}function I(T,R){var S=[];j.each(R,function(U){S.push({selectable:true,text:U.name,data:U.value})});return S}var J=M.spellchecker_languages||"English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr_FR,German=de,Italian=it,Polish=pl,Portuguese=pt_BR,Spanish=es,Swedish=sv";z=I("Language",j.map(J.split(","),function(R){R=R.split("=");return{name:R[0],value:R[1]}}));function y(S){for(var R in S){return false}return true}function s(W,U){var T=[],R=Q[W];j.each(R,function(Y){T.push({text:Y,onclick:function(){r.insertContent(r.dom.encode(Y));r.dom.remove(U);K()}})});T.push({text:"-"});if(N){T.push({text:"Add to Dictionary",onclick:function(){v(W,U)}})}T.push.apply(T,[{text:"Ignore",onclick:function(){C(W,U)}},{text:"Ignore all",onclick:function(){C(W,U,true)}}]);H=new m({items:T,context:"contextmenu",onautohide:function(Y){if(Y.target.className.indexOf("spellchecker")!=-1){Y.preventDefault()}},onhide:function(){H.remove();H=null}});H.renderTo(document.body);var X=n.DOM.getPos(r.getContentAreaContainer());var V=r.dom.getPos(U[0]);var S=r.dom.getRoot();if(S.nodeName=="BODY"){V.x-=S.ownerDocument.documentElement.scrollLeft||S.scrollLeft;V.y-=S.ownerDocument.documentElement.scrollTop||S.scrollTop}else{V.x-=S.scrollLeft;V.y-=S.scrollTop}X.x+=V.x;X.y+=V.y;H.moveTo(X.x,X.y+U[0].offsetHeight)}function G(){return r.getParam("spellchecker_wordchar_pattern")||new RegExp('[^\\s!"#$%&()*+,-./:;<=>?@[\\]^_{|}`\u00a7\u00a9\u00ab\u00ae\u00b1\u00b6\u00b7\u00b8\u00bb\u00bc\u00bd\u00be\u00bf\u00d7\u00f7\u00a4\u201d\u201c\u201e\u00a0\u2002\u2003\u2009]+',"g")}function t(W,V,S,T){var U={method:W},R="";if(W=="spellcheck"){U.text=V;U.lang=M.spellchecker_language}if(W=="addToDictionary"){U.word=V}j.each(U,function(Y,X){if(R){R+="&"}R+=X+"="+encodeURIComponent(Y)});l.send({url:new i(u).toAbsolute(M.spellchecker_rpc_url),type:"post",content_type:"application/x-www-form-urlencoded",data:R,success:function(X){X=o.parse(X);if(!X){T("Sever response wasn't proper JSON.")}else{if(X.error){T(X.error)}else{S(X)}}},error:function(X,Y){T("Spellchecker request error: "+Y.status)}})}function L(U,V,R,T){var S=M.spellchecker_callback||t;S.call(A,U,V,R,T)}function O(){if(q){F();return}else{F()}function R(S){r.windowManager.alert(S);r.setProgressState(false);F()}r.setProgressState(true);L("spellcheck",P().text,B,R);r.focus()}function K(){if(!r.dom.select("span.mce-spellchecker-word").length){F()}}function v(S,R){r.setProgressState(true);L("addToDictionary",S,function(){r.setProgressState(false);r.dom.remove(R,true);K()},function(T){r.windowManager.alert(T);r.setProgressState(false)})}function C(T,R,S){r.selection.collapse();if(S){j.each(r.dom.select("span.mce-spellchecker-word"),function(U){if(U.getAttribute("data-mce-word")==T){r.dom.remove(U,true)}})}else{r.dom.remove(R,true)}K()}function F(){P().reset();A.textMatcher=null;if(q){q=false;r.fire("SpellcheckEnd")}}function x(S){var R=S.getAttribute("data-mce-index");if(typeof R=="number"){return""+R}return R}function w(S){var R,U=[];R=j.toArray(r.getBody().getElementsByTagName("span"));if(R.length){for(var T=0;T0){var R=r.dom.createRng();R.setStartBefore(S[0]);R.setEndAfter(S[S.length-1]);r.selection.setRng(R);s(T.getAttribute("data-mce-word"),S)}}});r.addMenuItem("spellchecker",{text:"Spellcheck",context:"tools",onclick:O,selectable:true,onPostRender:function(){var R=this;R.active(q);r.on("SpellcheckStart SpellcheckEnd",function(){R.active(q)})}});function E(S){var R=M.spellchecker_language;S.control.items().each(function(T){T.active(T.settings.data===R)})}function B(S){var R;if(S.words){N=!!S.dictionary;R=S.words}else{R=S}r.setProgressState(false);if(y(R)){r.windowManager.alert("No misspellings found");q=false;return}Q=R;P().find(G()).filter(function(T){return !!R[T.text]}).wrap(function(T){return r.dom.create("span",{"class":"mce-spellchecker-word","data-mce-bogus":1,"data-mce-word":T.text})});q=true;r.fire("SpellcheckStart")}var D={tooltip:"Spellcheck",onclick:O,onPostRender:function(){var R=this;r.on("SpellcheckStart SpellcheckEnd",function(){R.active(q)})}};if(z.length>1){D.type="splitbutton";D.menu=z;D.onshow=E;D.onselect=function(R){M.spellchecker_language=R.control.settings.data}}r.addButton("spellchecker",D);r.addCommand("mceSpellCheck",O);r.on("remove",function(){if(H){H.remove();H=null}});r.on("change",K);this.getTextMatcher=P;this.getWordCharPattern=G;this.markErrors=B;this.getLanguage=function(){return M.spellchecker_language};M.spellchecker_language=M.spellchecker_language||M.language||"en"})});a(["tinymce/spellcheckerplugin/DomTextMatcher"])})(this); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/tabfocus/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/tabfocus/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,120 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +tinymce.PluginManager.add('tabfocus', function(editor) { + var DOM = tinymce.DOM, each = tinymce.each, explode = tinymce.explode; + + function tabCancel(e) { + if (e.keyCode === 9 && !e.ctrlKey && !e.altKey && !e.metaKey) { + e.preventDefault(); + } + } + + function tabHandler(e) { + var x, el, v, i; + + if (e.keyCode !== 9 || e.ctrlKey || e.altKey || e.metaKey || e.isDefaultPrevented()) { + return; + } + + function find(direction) { + el = DOM.select(':input:enabled,*[tabindex]:not(iframe)'); + + function canSelectRecursive(e) { + return e.nodeName === "BODY" || (e.type != 'hidden' && + e.style.display != "none" && + e.style.visibility != "hidden" && canSelectRecursive(e.parentNode)); + } + + function canSelect(el) { + return /INPUT|TEXTAREA|BUTTON/.test(el.tagName) && tinymce.get(e.id) && el.tabIndex != -1 && canSelectRecursive(el); + } + + each(el, function(e, i) { + if (e.id == editor.id) { + x = i; + return false; + } + }); + if (direction > 0) { + for (i = x + 1; i < el.length; i++) { + if (canSelect(el[i])) { + return el[i]; + } + } + } else { + for (i = x - 1; i >= 0; i--) { + if (canSelect(el[i])) { + return el[i]; + } + } + } + + return null; + } + + v = explode(editor.getParam('tab_focus', editor.getParam('tabfocus_elements', ':prev,:next'))); + + if (v.length == 1) { + v[1] = v[0]; + v[0] = ':prev'; + } + + // Find element to focus + if (e.shiftKey) { + if (v[0] == ':prev') { + el = find(-1); + } else { + el = DOM.get(v[0]); + } + } else { + if (v[1] == ':next') { + el = find(1); + } else { + el = DOM.get(v[1]); + } + } + + if (el) { + var focusEditor = tinymce.get(el.id || el.name); + + if (el.id && focusEditor) { + focusEditor.focus(); + } else { + window.setTimeout(function() { + if (!tinymce.Env.webkit) { + window.focus(); + } + + el.focus(); + }, 10); + } + + e.preventDefault(); + } + } + + editor.on('init', function() { + if (editor.inline) { + // Remove default tabIndex in inline mode + tinymce.DOM.setAttrib(editor.getBody(), 'tabIndex', null); + } + + editor.on('keyup', tabCancel); + + if (tinymce.Env.gecko) { + editor.on('keypress keydown', tabHandler); + } else { + editor.on('keydown', tabHandler); + } + }); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/tabfocus/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/tabfocus/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("tabfocus",function(d){var e=tinymce.DOM,f=tinymce.each,c=tinymce.explode;function a(g){if(g.keyCode===9&&!g.ctrlKey&&!g.altKey&&!g.metaKey){g.preventDefault()}}function b(m){var g,k,h,j;if(m.keyCode!==9||m.ctrlKey||m.altKey||m.metaKey||m.isDefaultPrevented()){return}function n(p){k=e.select(":input:enabled,*[tabindex]:not(iframe)");function o(q){return q.nodeName==="BODY"||(q.type!="hidden"&&q.style.display!="none"&&q.style.visibility!="hidden"&&o(q.parentNode))}function i(q){return/INPUT|TEXTAREA|BUTTON/.test(q.tagName)&&tinymce.get(m.id)&&q.tabIndex!=-1&&o(q)}f(k,function(r,q){if(r.id==d.id){g=q;return false}});if(p>0){for(j=g+1;j=0;j--){if(i(k[j])){return k[j]}}}return null}h=c(d.getParam("tab_focus",d.getParam("tabfocus_elements",":prev,:next")));if(h.length==1){h[1]=h[0];h[0]=":prev"}if(m.shiftKey){if(h[0]==":prev"){k=n(-1)}else{k=e.get(h[0])}}else{if(h[1]==":next"){k=n(1)}else{k=e.get(h[1])}}if(k){var l=tinymce.get(k.id||k.name);if(k.id&&l){l.focus()}else{window.setTimeout(function(){if(!tinymce.Env.webkit){window.focus()}k.focus()},10)}m.preventDefault()}}d.on("init",function(){if(d.inline){tinymce.DOM.setAttrib(d.getBody(),"tabIndex",null)}d.on("keyup",a);if(tinymce.Env.gecko){d.on("keypress keydown",b)}else{d.on("keydown",b)}})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/CellSelection.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/CellSelection.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,176 @@ +/** + * CellSelection.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles table cell selection by faking it using a css class that gets applied + * to cells when dragging the mouse from one cell to another. + * + * @class tinymce.tableplugin.CellSelection + * @private + */ +define("tinymce/tableplugin/CellSelection", [ + "tinymce/tableplugin/TableGrid", + "tinymce/dom/TreeWalker", + "tinymce/util/Tools" +], function(TableGrid, TreeWalker, Tools) { + return function(editor) { + var dom = editor.dom, tableGrid, startCell, startTable, hasCellSelection = true, resizing; + + function clear(force) { + // Restore selection possibilities + editor.getBody().style.webkitUserSelect = ''; + + if (force || hasCellSelection) { + editor.dom.removeClass( + editor.dom.select('td.mce-item-selected,th.mce-item-selected'), + 'mce-item-selected' + ); + + hasCellSelection = false; + } + } + + function cellSelectionHandler(e) { + var sel, table, target = e.target; + + if (resizing) { + return; + } + + if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) { + table = dom.getParent(target, 'table'); + if (table == startTable) { + if (!tableGrid) { + tableGrid = new TableGrid(editor, table); + tableGrid.setStartCell(startCell); + + editor.getBody().style.webkitUserSelect = 'none'; + } + + tableGrid.setEndCell(target); + hasCellSelection = true; + } + + // Remove current selection + sel = editor.selection.getSel(); + + try { + if (sel.removeAllRanges) { + sel.removeAllRanges(); + } else { + sel.empty(); + } + } catch (ex) { + // IE9 might throw errors here + } + + e.preventDefault(); + } + } + + // Add cell selection logic + editor.on('MouseDown', function(e) { + if (e.button != 2 && !resizing) { + clear(); + + startCell = dom.getParent(e.target, 'td,th'); + startTable = dom.getParent(startCell, 'table'); + } + }); + + editor.on('mouseover', cellSelectionHandler); + + editor.on('remove', function() { + dom.unbind(editor.getDoc(), 'mouseover', cellSelectionHandler); + }); + + editor.on('MouseUp', function() { + var rng, sel = editor.selection, selectedCells, walker, node, lastNode; + + function setPoint(node, start) { + var walker = new TreeWalker(node, node); + + do { + // Text node + if (node.nodeType == 3 && Tools.trim(node.nodeValue).length !== 0) { + if (start) { + rng.setStart(node, 0); + } else { + rng.setEnd(node, node.nodeValue.length); + } + + return; + } + + // BR element + if (node.nodeName == 'BR') { + if (start) { + rng.setStartBefore(node); + } else { + rng.setEndBefore(node); + } + + return; + } + } while ((node = (start ? walker.next() : walker.prev()))); + } + + // Move selection to startCell + if (startCell) { + if (tableGrid) { + editor.getBody().style.webkitUserSelect = ''; + } + + // Try to expand text selection as much as we can only Gecko supports cell selection + selectedCells = dom.select('td.mce-item-selected,th.mce-item-selected'); + if (selectedCells.length > 0) { + rng = dom.createRng(); + node = selectedCells[0]; + rng.setStartBefore(node); + rng.setEndAfter(node); + + setPoint(node, 1); + walker = new TreeWalker(node, dom.getParent(selectedCells[0], 'table')); + + do { + if (node.nodeName == 'TD' || node.nodeName == 'TH') { + if (!dom.hasClass(node, 'mce-item-selected')) { + break; + } + + lastNode = node; + } + } while ((node = walker.next())); + + setPoint(lastNode); + + sel.setRng(rng); + } + + editor.nodeChanged(); + startCell = tableGrid = startTable = null; + } + }); + + editor.on('KeyUp Drop SetContent', function(e) { + clear(e.type == 'setcontent'); + startCell = tableGrid = startTable = null; + resizing = false; + }); + + editor.on('ObjectResizeStart ObjectResized', function(e) { + resizing = e.type != 'objectresized'; + }); + + return { + clear: clear + }; + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/Dialogs.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/Dialogs.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,824 @@ +/** + * Dialogs.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*eslint dot-notation:0*/ + +/** + * ... + * + * @class tinymce.tableplugin.Dialogs + * @private + */ +define("tinymce/tableplugin/Dialogs", [ + "tinymce/util/Tools", + "tinymce/Env" +], function(Tools, Env) { + var each = Tools.each; + + return function(editor) { + var self = this; + + function createColorPickAction() { + var colorPickerCallback = editor.settings.color_picker_callback; + + if (colorPickerCallback) { + return function() { + var self = this; + + colorPickerCallback.call( + editor, + function(value) { + self.value(value).fire('change'); + }, + self.value() + ); + }; + } + } + + function createStyleForm(dom) { + return { + title: 'Advanced', + type: 'form', + defaults: { + onchange: function() { + updateStyle(dom, this.parents().reverse()[0], this.name() == "style"); + } + }, + items: [ + { + label: 'Style', + name: 'style', + type: 'textbox' + }, + + { + type: 'form', + padding: 0, + formItemDefaults: { + layout: 'grid', + alignH: ['start', 'right'] + }, + defaults: { + size: 7 + }, + items: [ + { + label: 'Border color', + type: 'colorbox', + name: 'borderColor', + onaction: createColorPickAction() + }, + + { + label: 'Background color', + type: 'colorbox', + name: 'backgroundColor', + onaction: createColorPickAction() + } + ] + } + ] + }; + } + + function removePxSuffix(size) { + return size ? size.replace(/px$/, '') : ""; + } + + function addSizeSuffix(size) { + if (/^[0-9]+$/.test(size)) { + size += "px"; + } + + return size; + } + + function unApplyAlign(elm) { + each('left center right'.split(' '), function(name) { + editor.formatter.remove('align' + name, {}, elm); + }); + } + + function unApplyVAlign(elm) { + each('top middle bottom'.split(' '), function(name) { + editor.formatter.remove('valign' + name, {}, elm); + }); + } + + function buildListItems(inputList, itemCallback, startItems) { + function appendItems(values, output) { + output = output || []; + + Tools.each(values, function(item) { + var menuItem = {text: item.text || item.title}; + + if (item.menu) { + menuItem.menu = appendItems(item.menu); + } else { + menuItem.value = item.value; + + if (itemCallback) { + itemCallback(menuItem); + } + } + + output.push(menuItem); + }); + + return output; + } + + return appendItems(inputList, startItems || []); + } + + function updateStyle(dom, win, isStyleCtrl) { + var data = win.toJSON(); + var css = dom.parseStyle(data.style); + + if (isStyleCtrl) { + win.find('#borderColor').value(css["border-color"] || '')[0].fire('change'); + win.find('#backgroundColor').value(css["background-color"] || '')[0].fire('change'); + } else { + css["border-color"] = data.borderColor; + css["background-color"] = data.backgroundColor; + } + + win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css)))); + } + + function appendStylesToData(dom, data, elm) { + var css = dom.parseStyle(dom.getAttrib(elm, 'style')); + + if (css["border-color"]) { + data.borderColor = css["border-color"]; + } + + if (css["background-color"]) { + data.backgroundColor = css["background-color"]; + } + + data.style = dom.serializeStyle(css); + } + + function mergeStyles(dom, elm, styles) { + var css = dom.parseStyle(dom.getAttrib(elm, 'style')); + + each(styles, function(style) { + css[style.name] = style.value; + }); + + dom.setAttrib(elm, 'style', dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css)))); + } + + self.tableProps = function() { + self.table(true); + }; + + self.table = function(isProps) { + var dom = editor.dom, tableElm, colsCtrl, rowsCtrl, classListCtrl, data = {}, generalTableForm, stylesToMerge; + + function onSubmitTableForm() { + + //Explore the layers of the table till we find the first layer of tds or ths + function styleTDTH (elm, name, value) { + if (elm.tagName === "TD" || elm.tagName === "TH") { + dom.setStyle(elm, name, value); + } else { + if (elm.children) { + for (var i = 0; i < elm.children.length; i++) { + styleTDTH(elm.children[i], name, value); + } + } + } + } + + var captionElm; + + updateStyle(dom, this); + data = Tools.extend(data, this.toJSON()); + + if (data["class"] === false) { + delete data["class"]; + } + + editor.undoManager.transact(function() { + if (!tableElm) { + tableElm = editor.plugins.table.insertTable(data.cols || 1, data.rows || 1); + } + + editor.dom.setAttribs(tableElm, { + style: data.style, + 'class': data['class'] + }); + + if (editor.settings.table_style_by_css) { + stylesToMerge = []; + stylesToMerge.push({name: 'border', value: data.border}); + stylesToMerge.push({name: 'border-spacing', value: addSizeSuffix(data.cellspacing)}); + mergeStyles(dom, tableElm, stylesToMerge); + dom.setAttribs(tableElm, { + 'data-mce-border-color': data.borderColor, + 'data-mce-cell-padding': data.cellpadding, + 'data-mce-border': data.border + }); + if (tableElm.children) { + for (var i = 0; i < tableElm.children.length; i++) { + styleTDTH(tableElm.children[i], 'border', data.border); + styleTDTH(tableElm.children[i], 'padding', addSizeSuffix(data.cellpadding)); + } + } + } else { + editor.dom.setAttribs(tableElm, { + border: data.border, + cellpadding: data.cellpadding, + cellspacing: data.cellspacing + }); + } + + if (dom.getAttrib(tableElm, 'width') && !editor.settings.table_style_by_css) { + dom.setAttrib(tableElm, 'width', removePxSuffix(data.width)); + } else { + dom.setStyle(tableElm, 'width', addSizeSuffix(data.width)); + } + + dom.setStyle(tableElm, 'height', addSizeSuffix(data.height)); + + // Toggle caption on/off + captionElm = dom.select('caption', tableElm)[0]; + + if (captionElm && !data.caption) { + dom.remove(captionElm); + } + + if (!captionElm && data.caption) { + captionElm = dom.create('caption'); + captionElm.innerHTML = !Env.ie ? '
    ' : '\u00a0'; + tableElm.insertBefore(captionElm, tableElm.firstChild); + } + unApplyAlign(tableElm); + if (data.align) { + editor.formatter.apply('align' + data.align, {}, tableElm); + } + + editor.focus(); + editor.addVisual(); + }); + } + + function getTDTHOverallStyle (elm, name) { + var cells = editor.dom.select("td,th", elm), firstChildStyle; + + function checkChildren(firstChildStyle, elms) { + + for (var i = 0; i < elms.length; i++) { + var currentStyle = dom.getStyle(elms[i], name); + if (typeof firstChildStyle === "undefined") { + firstChildStyle = currentStyle; + } + if (firstChildStyle != currentStyle) { + return ""; + } + } + + return firstChildStyle; + + } + + firstChildStyle = checkChildren(firstChildStyle, cells); + + return firstChildStyle; + } + + if (isProps === true) { + tableElm = dom.getParent(editor.selection.getStart(), 'table'); + + if (tableElm) { + data = { + width: removePxSuffix(dom.getStyle(tableElm, 'width') || dom.getAttrib(tableElm, 'width')), + height: removePxSuffix(dom.getStyle(tableElm, 'height') || dom.getAttrib(tableElm, 'height')), + cellspacing: removePxSuffix(dom.getStyle(tableElm, 'border-spacing') || + dom.getAttrib(tableElm, 'cellspacing')), + cellpadding: dom.getAttrib(tableElm, 'data-mce-cell-padding') || dom.getAttrib(tableElm, 'cellpadding') || + getTDTHOverallStyle(tableElm, 'padding'), + border: dom.getAttrib(tableElm, 'data-mce-border') || dom.getAttrib(tableElm, 'border') || + getTDTHOverallStyle(tableElm, 'border'), + borderColor: dom.getAttrib(tableElm, 'data-mce-border-color'), + caption: !!dom.select('caption', tableElm)[0], + 'class': dom.getAttrib(tableElm, 'class') + }; + + each('left center right'.split(' '), function(name) { + if (editor.formatter.matchNode(tableElm, 'align' + name)) { + data.align = name; + } + }); + } + } else { + colsCtrl = {label: 'Cols', name: 'cols'}; + rowsCtrl = {label: 'Rows', name: 'rows'}; + } + + if (editor.settings.table_class_list) { + if (data["class"]) { + data["class"] = data["class"].replace(/\s*mce\-item\-table\s*/g, ''); + } + + classListCtrl = { + name: 'class', + type: 'listbox', + label: 'Class', + values: buildListItems( + editor.settings.table_class_list, + function(item) { + if (item.value) { + item.textStyle = function() { + return editor.formatter.getCssText({block: 'table', classes: [item.value]}); + }; + } + } + ) + }; + } + + generalTableForm = { + type: 'form', + layout: 'flex', + direction: 'column', + labelGapCalc: 'children', + padding: 0, + items: [ + { + type: 'form', + labelGapCalc: false, + padding: 0, + layout: 'grid', + columns: 2, + defaults: { + type: 'textbox', + maxWidth: 50 + }, + items: (editor.settings.table_appearance_options !== false) ? [ + colsCtrl, + rowsCtrl, + {label: 'Width', name: 'width'}, + {label: 'Height', name: 'height'}, + {label: 'Cell spacing', name: 'cellspacing'}, + {label: 'Cell padding', name: 'cellpadding'}, + {label: 'Border', name: 'border'}, + {label: 'Caption', name: 'caption', type: 'checkbox'} + ] : [ + colsCtrl, + rowsCtrl, + {label: 'Width', name: 'width'}, + {label: 'Height', name: 'height'} + ] + }, + + { + label: 'Alignment', + name: 'align', + type: 'listbox', + text: 'None', + values: [ + {text: 'None', value: ''}, + {text: 'Left', value: 'left'}, + {text: 'Center', value: 'center'}, + {text: 'Right', value: 'right'} + ] + }, + + classListCtrl + ] + }; + + if (editor.settings.table_advtab !== false) { + appendStylesToData(dom, data, tableElm); + + editor.windowManager.open({ + title: "Table properties", + data: data, + bodyType: 'tabpanel', + body: [ + { + title: 'General', + type: 'form', + items: generalTableForm + }, + createStyleForm(dom) + ], + + onsubmit: onSubmitTableForm + }); + } else { + editor.windowManager.open({ + title: "Table properties", + data: data, + body: generalTableForm, + onsubmit: onSubmitTableForm + }); + } + }; + + self.merge = function(grid, cell) { + editor.windowManager.open({ + title: "Merge cells", + body: [ + {label: 'Cols', name: 'cols', type: 'textbox', value: '1', size: 10}, + {label: 'Rows', name: 'rows', type: 'textbox', value: '1', size: 10} + ], + onsubmit: function() { + var data = this.toJSON(); + + editor.undoManager.transact(function() { + grid.merge(cell, data.cols, data.rows); + }); + } + }); + }; + + self.cell = function() { + var dom = editor.dom, cellElm, data, classListCtrl, cells = []; + + function onSubmitCellForm() { + updateStyle(dom, this); + data = Tools.extend(data, this.toJSON()); + + editor.undoManager.transact(function() { + each(cells, function(cellElm) { + editor.dom.setAttribs(cellElm, { + scope: data.scope, + style: data.style, + 'class': data['class'] + }); + + editor.dom.setStyles(cellElm, { + width: addSizeSuffix(data.width), + height: addSizeSuffix(data.height) + }); + + // Switch cell type + if (data.type && cellElm.nodeName.toLowerCase() != data.type) { + cellElm = dom.rename(cellElm, data.type); + } + + // Apply/remove alignment + unApplyAlign(cellElm); + if (data.align) { + editor.formatter.apply('align' + data.align, {}, cellElm); + } + + // Apply/remove vertical alignment + unApplyVAlign(cellElm); + if (data.valign) { + editor.formatter.apply('valign' + data.valign, {}, cellElm); + } + }); + + editor.focus(); + }); + } + + // Get selected cells or the current cell + cells = editor.dom.select('td.mce-item-selected,th.mce-item-selected'); + cellElm = editor.dom.getParent(editor.selection.getStart(), 'td,th'); + if (!cells.length && cellElm) { + cells.push(cellElm); + } + + cellElm = cellElm || cells[0]; + + if (!cellElm) { + // If this element is null, return now to avoid crashing. + return; + } + + data = { + width: removePxSuffix(dom.getStyle(cellElm, 'width') || dom.getAttrib(cellElm, 'width')), + height: removePxSuffix(dom.getStyle(cellElm, 'height') || dom.getAttrib(cellElm, 'height')), + scope: dom.getAttrib(cellElm, 'scope'), + 'class': dom.getAttrib(cellElm, 'class') + }; + + data.type = cellElm.nodeName.toLowerCase(); + + each('left center right'.split(' '), function(name) { + if (editor.formatter.matchNode(cellElm, 'align' + name)) { + data.align = name; + } + }); + + each('top middle bottom'.split(' '), function(name) { + if (editor.formatter.matchNode(cellElm, 'valign' + name)) { + data.valign = name; + } + }); + + if (editor.settings.table_cell_class_list) { + classListCtrl = { + name: 'class', + type: 'listbox', + label: 'Class', + values: buildListItems( + editor.settings.table_cell_class_list, + function(item) { + if (item.value) { + item.textStyle = function() { + return editor.formatter.getCssText({block: 'td', classes: [item.value]}); + }; + } + } + ) + }; + } + + var generalCellForm = { + type: 'form', + layout: 'flex', + direction: 'column', + labelGapCalc: 'children', + padding: 0, + items: [ + { + type: 'form', + layout: 'grid', + columns: 2, + labelGapCalc: false, + padding: 0, + defaults: { + type: 'textbox', + maxWidth: 50 + }, + items: [ + {label: 'Width', name: 'width'}, + {label: 'Height', name: 'height'}, + { + label: 'Cell type', + name: 'type', + type: 'listbox', + text: 'None', + minWidth: 90, + maxWidth: null, + values: [ + {text: 'Cell', value: 'td'}, + {text: 'Header cell', value: 'th'} + ] + }, + { + label: 'Scope', + name: 'scope', + type: 'listbox', + text: 'None', + minWidth: 90, + maxWidth: null, + values: [ + {text: 'None', value: ''}, + {text: 'Row', value: 'row'}, + {text: 'Column', value: 'col'}, + {text: 'Row group', value: 'rowgroup'}, + {text: 'Column group', value: 'colgroup'} + ] + }, + { + label: 'H Align', + name: 'align', + type: 'listbox', + text: 'None', + minWidth: 90, + maxWidth: null, + values: [ + {text: 'None', value: ''}, + {text: 'Left', value: 'left'}, + {text: 'Center', value: 'center'}, + {text: 'Right', value: 'right'} + ] + }, + { + label: 'V Align', + name: 'valign', + type: 'listbox', + text: 'None', + minWidth: 90, + maxWidth: null, + values: [ + {text: 'None', value: ''}, + {text: 'Top', value: 'top'}, + {text: 'Middle', value: 'middle'}, + {text: 'Bottom', value: 'bottom'} + ] + } + ] + }, + + classListCtrl + ] + }; + + if (editor.settings.table_cell_advtab !== false) { + appendStylesToData(dom, data, cellElm); + + editor.windowManager.open({ + title: "Cell properties", + bodyType: 'tabpanel', + data: data, + body: [ + { + title: 'General', + type: 'form', + items: generalCellForm + }, + + createStyleForm(dom) + ], + + onsubmit: onSubmitCellForm + }); + } else { + editor.windowManager.open({ + title: "Cell properties", + data: data, + body: generalCellForm, + onsubmit: onSubmitCellForm + }); + } + }; + + self.row = function() { + var dom = editor.dom, tableElm, cellElm, rowElm, classListCtrl, data, rows = [], generalRowForm; + + function onSubmitRowForm() { + var tableElm, oldParentElm, parentElm; + + updateStyle(dom, this); + data = Tools.extend(data, this.toJSON()); + + editor.undoManager.transact(function() { + var toType = data.type; + + each(rows, function(rowElm) { + editor.dom.setAttribs(rowElm, { + scope: data.scope, + style: data.style, + 'class': data['class'] + }); + + editor.dom.setStyles(rowElm, { + height: addSizeSuffix(data.height) + }); + + if (toType != rowElm.parentNode.nodeName.toLowerCase()) { + tableElm = dom.getParent(rowElm, 'table'); + + oldParentElm = rowElm.parentNode; + parentElm = dom.select(toType, tableElm)[0]; + if (!parentElm) { + parentElm = dom.create(toType); + if (tableElm.firstChild) { + tableElm.insertBefore(parentElm, tableElm.firstChild); + } else { + tableElm.appendChild(parentElm); + } + } + + parentElm.appendChild(rowElm); + + if (!oldParentElm.hasChildNodes()) { + dom.remove(oldParentElm); + } + } + + // Apply/remove alignment + unApplyAlign(rowElm); + if (data.align) { + editor.formatter.apply('align' + data.align, {}, rowElm); + } + }); + + editor.focus(); + }); + } + + tableElm = editor.dom.getParent(editor.selection.getStart(), 'table'); + cellElm = editor.dom.getParent(editor.selection.getStart(), 'td,th'); + + each(tableElm.rows, function(row) { + each(row.cells, function(cell) { + if (dom.hasClass(cell, 'mce-item-selected') || cell == cellElm) { + rows.push(row); + return false; + } + }); + }); + + rowElm = rows[0]; + if (!rowElm) { + // If this element is null, return now to avoid crashing. + return; + } + + data = { + height: removePxSuffix(dom.getStyle(rowElm, 'height') || dom.getAttrib(rowElm, 'height')), + scope: dom.getAttrib(rowElm, 'scope'), + 'class': dom.getAttrib(rowElm, 'class') + }; + + data.type = rowElm.parentNode.nodeName.toLowerCase(); + + each('left center right'.split(' '), function(name) { + if (editor.formatter.matchNode(rowElm, 'align' + name)) { + data.align = name; + } + }); + + if (editor.settings.table_row_class_list) { + classListCtrl = { + name: 'class', + type: 'listbox', + label: 'Class', + values: buildListItems( + editor.settings.table_row_class_list, + function(item) { + if (item.value) { + item.textStyle = function() { + return editor.formatter.getCssText({block: 'tr', classes: [item.value]}); + }; + } + } + ) + }; + } + + generalRowForm = { + type: 'form', + columns: 2, + padding: 0, + defaults: { + type: 'textbox' + }, + items: [ + { + type: 'listbox', + name: 'type', + label: 'Row type', + text: 'None', + maxWidth: null, + values: [ + {text: 'Header', value: 'thead'}, + {text: 'Body', value: 'tbody'}, + {text: 'Footer', value: 'tfoot'} + ] + }, + { + type: 'listbox', + name: 'align', + label: 'Alignment', + text: 'None', + maxWidth: null, + values: [ + {text: 'None', value: ''}, + {text: 'Left', value: 'left'}, + {text: 'Center', value: 'center'}, + {text: 'Right', value: 'right'} + ] + }, + {label: 'Height', name: 'height'}, + classListCtrl + ] + }; + + if (editor.settings.table_row_advtab !== false) { + appendStylesToData(dom, data, rowElm); + + editor.windowManager.open({ + title: "Row properties", + data: data, + bodyType: 'tabpanel', + body: [ + { + title: 'General', + type: 'form', + items: generalRowForm + }, + createStyleForm(dom) + ], + + onsubmit: onSubmitRowForm + }); + } else { + editor.windowManager.open({ + title: "Row properties", + data: data, + body: generalRowForm, + onsubmit: onSubmitRowForm + }); + } + }; + }; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/Plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/Plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,436 @@ +/** + * Plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class contains all core logic for the table plugin. + * + * @class tinymce.tableplugin.Plugin + * @private + */ +define("tinymce/tableplugin/Plugin", [ + "tinymce/tableplugin/TableGrid", + "tinymce/tableplugin/Quirks", + "tinymce/tableplugin/CellSelection", + "tinymce/tableplugin/Dialogs", + "tinymce/util/Tools", + "tinymce/dom/TreeWalker", + "tinymce/Env", + "tinymce/PluginManager" +], function(TableGrid, Quirks, CellSelection, Dialogs, Tools, TreeWalker, Env, PluginManager) { + var each = Tools.each; + + function Plugin(editor) { + var clipboardRows, self = this, dialogs = new Dialogs(editor); + + function cmd(command) { + return function() { + editor.execCommand(command); + }; + } + + function insertTable(cols, rows) { + var y, x, html, tableElm; + + html = '
    '; + + for (y = 0; y < rows; y++) { + html += ''; + + for (x = 0; x < cols; x++) { + html += ''; + } + + html += ''; + } + + html += '
    ' + (Env.ie ? " " : '
    ') + '
    '; + + editor.undoManager.transact(function() { + editor.insertContent(html); + + tableElm = editor.dom.get('__mce'); + editor.dom.setAttrib(tableElm, 'id', null); + + editor.dom.setAttribs(tableElm, editor.settings.table_default_attributes || {}); + editor.dom.setStyles(tableElm, editor.settings.table_default_styles || {}); + }); + + return tableElm; + } + + function handleDisabledState(ctrl, selector) { + function bindStateListener() { + ctrl.disabled(!editor.dom.getParent(editor.selection.getStart(), selector)); + + editor.selection.selectorChanged(selector, function(state) { + ctrl.disabled(!state); + }); + } + + if (editor.initialized) { + bindStateListener(); + } else { + editor.on('init', bindStateListener); + } + } + + function postRender() { + /*jshint validthis:true*/ + handleDisabledState(this, 'table'); + } + + function postRenderCell() { + /*jshint validthis:true*/ + handleDisabledState(this, 'td,th'); + } + + function generateTableGrid() { + var html = ''; + + html = ''; + + for (var y = 0; y < 10; y++) { + html += ''; + + for (var x = 0; x < 10; x++) { + html += ''; + } + + html += ''; + } + + html += '
    '; + + html += '

    '; + + return html; + } + + function selectGrid(tx, ty, control) { + var table = control.getEl().getElementsByTagName('table')[0]; + var x, y, focusCell, cell, active; + var rtl = control.isRtl() || control.parent().rel == 'tl-tr'; + + table.nextSibling.innerHTML = (tx + 1) + ' x ' + (ty + 1); + + if (rtl) { + tx = 9 - tx; + } + + for (y = 0; y < 10; y++) { + for (x = 0; x < 10; x++) { + cell = table.rows[y].childNodes[x].firstChild; + active = (rtl ? x >= tx : x <= tx) && y <= ty; + + editor.dom.toggleClass(cell, 'mce-active', active); + + if (active) { + focusCell = cell; + } + } + } + + return focusCell.parentNode; + } + + if (editor.settings.table_grid === false) { + editor.addMenuItem('inserttable', { + text: 'Insert table', + icon: 'table', + context: 'table', + onclick: dialogs.table + }); + } else { + editor.addMenuItem('inserttable', { + text: 'Insert table', + icon: 'table', + context: 'table', + ariaHideMenu: true, + onclick: function(e) { + if (e.aria) { + this.parent().hideAll(); + e.stopImmediatePropagation(); + dialogs.table(); + } + }, + onshow: function() { + selectGrid(0, 0, this.menu.items()[0]); + }, + onhide: function() { + var elements = this.menu.items()[0].getEl().getElementsByTagName('a'); + editor.dom.removeClass(elements, 'mce-active'); + editor.dom.addClass(elements[0], 'mce-active'); + }, + menu: [ + { + type: 'container', + html: generateTableGrid(), + + onPostRender: function() { + this.lastX = this.lastY = 0; + }, + + onmousemove: function(e) { + var target = e.target, x, y; + + if (target.tagName.toUpperCase() == 'A') { + x = parseInt(target.getAttribute('data-mce-x'), 10); + y = parseInt(target.getAttribute('data-mce-y'), 10); + + if (this.isRtl() || this.parent().rel == 'tl-tr') { + x = 9 - x; + } + + if (x !== this.lastX || y !== this.lastY) { + selectGrid(x, y, e.control); + + this.lastX = x; + this.lastY = y; + } + } + }, + + onclick: function(e) { + var self = this; + + if (e.target.tagName.toUpperCase() == 'A') { + e.preventDefault(); + e.stopPropagation(); + self.parent().cancel(); + + editor.undoManager.transact(function() { + insertTable(self.lastX + 1, self.lastY + 1); + }); + + editor.addVisual(); + } + } + } + ] + }); + } + + editor.addMenuItem('tableprops', { + text: 'Table properties', + context: 'table', + onPostRender: postRender, + onclick: dialogs.tableProps + }); + + editor.addMenuItem('deletetable', { + text: 'Delete table', + context: 'table', + onPostRender: postRender, + cmd: 'mceTableDelete' + }); + + editor.addMenuItem('cell', { + separator: 'before', + text: 'Cell', + context: 'table', + menu: [ + {text: 'Cell properties', onclick: cmd('mceTableCellProps'), onPostRender: postRenderCell}, + {text: 'Merge cells', onclick: cmd('mceTableMergeCells'), onPostRender: postRenderCell}, + {text: 'Split cell', onclick: cmd('mceTableSplitCells'), onPostRender: postRenderCell} + ] + }); + + editor.addMenuItem('row', { + text: 'Row', + context: 'table', + menu: [ + {text: 'Insert row before', onclick: cmd('mceTableInsertRowBefore'), onPostRender: postRenderCell}, + {text: 'Insert row after', onclick: cmd('mceTableInsertRowAfter'), onPostRender: postRenderCell}, + {text: 'Delete row', onclick: cmd('mceTableDeleteRow'), onPostRender: postRenderCell}, + {text: 'Row properties', onclick: cmd('mceTableRowProps'), onPostRender: postRenderCell}, + {text: '-'}, + {text: 'Cut row', onclick: cmd('mceTableCutRow'), onPostRender: postRenderCell}, + {text: 'Copy row', onclick: cmd('mceTableCopyRow'), onPostRender: postRenderCell}, + {text: 'Paste row before', onclick: cmd('mceTablePasteRowBefore'), onPostRender: postRenderCell}, + {text: 'Paste row after', onclick: cmd('mceTablePasteRowAfter'), onPostRender: postRenderCell} + ] + }); + + editor.addMenuItem('column', { + text: 'Column', + context: 'table', + menu: [ + {text: 'Insert column before', onclick: cmd('mceTableInsertColBefore'), onPostRender: postRenderCell}, + {text: 'Insert column after', onclick: cmd('mceTableInsertColAfter'), onPostRender: postRenderCell}, + {text: 'Delete column', onclick: cmd('mceTableDeleteCol'), onPostRender: postRenderCell} + ] + }); + + var menuItems = []; + each("inserttable tableprops deletetable | cell row column".split(' '), function(name) { + if (name == '|') { + menuItems.push({text: '-'}); + } else { + menuItems.push(editor.menuItems[name]); + } + }); + + editor.addButton("table", { + type: "menubutton", + title: "Table", + menu: menuItems + }); + + // Select whole table is a table border is clicked + if (!Env.isIE) { + editor.on('click', function(e) { + e = e.target; + + if (e.nodeName === 'TABLE') { + editor.selection.select(e); + editor.nodeChanged(); + } + }); + } + + self.quirks = new Quirks(editor); + + editor.on('Init', function() { + self.cellSelection = new CellSelection(editor); + }); + + editor.on('PreInit', function() { + // Remove internal data attributes + editor.serializer.addAttributeFilter( + 'data-mce-cell-padding,data-mce-border,data-mce-border-color', + function(nodes, name) { + + var i = nodes.length; + + while (i--) { + nodes[i].attr(name, null); + } + }); + }); + + // Register action commands + each({ + mceTableSplitCells: function(grid) { + grid.split(); + }, + + mceTableMergeCells: function(grid) { + var cell; + + cell = editor.dom.getParent(editor.selection.getStart(), 'th,td'); + + if (!editor.dom.select('td.mce-item-selected,th.mce-item-selected').length) { + dialogs.merge(grid, cell); + } else { + grid.merge(); + } + }, + + mceTableInsertRowBefore: function(grid) { + grid.insertRow(true); + }, + + mceTableInsertRowAfter: function(grid) { + grid.insertRow(); + }, + + mceTableInsertColBefore: function(grid) { + grid.insertCol(true); + }, + + mceTableInsertColAfter: function(grid) { + grid.insertCol(); + }, + + mceTableDeleteCol: function(grid) { + grid.deleteCols(); + }, + + mceTableDeleteRow: function(grid) { + grid.deleteRows(); + }, + + mceTableCutRow: function(grid) { + clipboardRows = grid.cutRows(); + }, + + mceTableCopyRow: function(grid) { + clipboardRows = grid.copyRows(); + }, + + mceTablePasteRowBefore: function(grid) { + grid.pasteRows(clipboardRows, true); + }, + + mceTablePasteRowAfter: function(grid) { + grid.pasteRows(clipboardRows); + }, + + mceTableDelete: function(grid) { + grid.deleteTable(); + } + }, function(func, name) { + editor.addCommand(name, function() { + var grid = new TableGrid(editor); + + if (grid) { + func(grid); + editor.execCommand('mceRepaint'); + self.cellSelection.clear(); + } + }); + }); + + // Register dialog commands + each({ + mceInsertTable: dialogs.table, + mceTableProps: function() { + dialogs.table(true); + }, + mceTableRowProps: dialogs.row, + mceTableCellProps: dialogs.cell + }, function(func, name) { + editor.addCommand(name, function(ui, val) { + func(val); + }); + }); + + // Enable tab key cell navigation + if (editor.settings.table_tab_navigation !== false) { + editor.on('keydown', function(e) { + var cellElm, grid, delta; + + if (e.keyCode == 9) { + cellElm = editor.dom.getParent(editor.selection.getStart(), 'th,td'); + + if (cellElm) { + e.preventDefault(); + + grid = new TableGrid(editor); + delta = e.shiftKey ? -1 : 1; + + editor.undoManager.transact(function() { + if (!grid.moveRelIdx(cellElm, delta) && delta > 0) { + grid.insertRow(); + grid.refresh(); + grid.moveRelIdx(cellElm, delta); + } + }); + } + } + }); + } + + self.insertTable = insertTable; + } + + PluginManager.add('table', Plugin); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/Quirks.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/Quirks.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,372 @@ +/** + * Quirks.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class includes fixes for various browser quirks. + * + * @class tinymce.tableplugin.Quirks + * @private + */ +define("tinymce/tableplugin/Quirks", [ + "tinymce/util/VK", + "tinymce/Env", + "tinymce/util/Tools" +], function(VK, Env, Tools) { + var each = Tools.each; + + function getSpanVal(td, name) { + return parseInt(td.getAttribute(name) || 1, 10); + } + + return function(editor) { + /** + * Fixed caret movement around tables on WebKit. + */ + function moveWebKitSelection() { + function eventHandler(e) { + var key = e.keyCode; + + function handle(upBool, sourceNode) { + var siblingDirection = upBool ? 'previousSibling' : 'nextSibling'; + var currentRow = editor.dom.getParent(sourceNode, 'tr'); + var siblingRow = currentRow[siblingDirection]; + + if (siblingRow) { + moveCursorToRow(editor, sourceNode, siblingRow, upBool); + e.preventDefault(); + return true; + } else { + var tableNode = editor.dom.getParent(currentRow, 'table'); + var middleNode = currentRow.parentNode; + var parentNodeName = middleNode.nodeName.toLowerCase(); + if (parentNodeName === 'tbody' || parentNodeName === (upBool ? 'tfoot' : 'thead')) { + var targetParent = getTargetParent(upBool, tableNode, middleNode, 'tbody'); + if (targetParent !== null) { + return moveToRowInTarget(upBool, targetParent, sourceNode); + } + } + return escapeTable(upBool, currentRow, siblingDirection, tableNode); + } + } + + function getTargetParent(upBool, topNode, secondNode, nodeName) { + var tbodies = editor.dom.select('>' + nodeName, topNode); + var position = tbodies.indexOf(secondNode); + if (upBool && position === 0 || !upBool && position === tbodies.length - 1) { + return getFirstHeadOrFoot(upBool, topNode); + } else if (position === -1) { + var topOrBottom = secondNode.tagName.toLowerCase() === 'thead' ? 0 : tbodies.length - 1; + return tbodies[topOrBottom]; + } else { + return tbodies[position + (upBool ? -1 : 1)]; + } + } + + function getFirstHeadOrFoot(upBool, parent) { + var tagName = upBool ? 'thead' : 'tfoot'; + var headOrFoot = editor.dom.select('>' + tagName, parent); + return headOrFoot.length !== 0 ? headOrFoot[0] : null; + } + + function moveToRowInTarget(upBool, targetParent, sourceNode) { + var targetRow = getChildForDirection(targetParent, upBool); + + if (targetRow) { + moveCursorToRow(editor, sourceNode, targetRow, upBool); + } + + e.preventDefault(); + return true; + } + + function escapeTable(upBool, currentRow, siblingDirection, table) { + var tableSibling = table[siblingDirection]; + + if (tableSibling) { + moveCursorToStartOfElement(tableSibling); + return true; + } else { + var parentCell = editor.dom.getParent(table, 'td,th'); + if (parentCell) { + return handle(upBool, parentCell, e); + } else { + var backUpSibling = getChildForDirection(currentRow, !upBool); + moveCursorToStartOfElement(backUpSibling); + e.preventDefault(); + return false; + } + } + } + + function getChildForDirection(parent, up) { + var child = parent && parent[up ? 'lastChild' : 'firstChild']; + // BR is not a valid table child to return in this case we return the table cell + return child && child.nodeName === 'BR' ? editor.dom.getParent(child, 'td,th') : child; + } + + function moveCursorToStartOfElement(n) { + editor.selection.setCursorLocation(n, 0); + } + + function isVerticalMovement() { + return key == VK.UP || key == VK.DOWN; + } + + function isInTable(editor) { + var node = editor.selection.getNode(); + var currentRow = editor.dom.getParent(node, 'tr'); + return currentRow !== null; + } + + function columnIndex(column) { + var colIndex = 0; + var c = column; + while (c.previousSibling) { + c = c.previousSibling; + colIndex = colIndex + getSpanVal(c, "colspan"); + } + return colIndex; + } + + function findColumn(rowElement, columnIndex) { + var c = 0, r = 0; + + each(rowElement.children, function(cell, i) { + c = c + getSpanVal(cell, "colspan"); + r = i; + if (c > columnIndex) { + return false; + } + }); + return r; + } + + function moveCursorToRow(ed, node, row, upBool) { + var srcColumnIndex = columnIndex(editor.dom.getParent(node, 'td,th')); + var tgtColumnIndex = findColumn(row, srcColumnIndex); + var tgtNode = row.childNodes[tgtColumnIndex]; + var rowCellTarget = getChildForDirection(tgtNode, upBool); + moveCursorToStartOfElement(rowCellTarget || tgtNode); + } + + function shouldFixCaret(preBrowserNode) { + var newNode = editor.selection.getNode(); + var newParent = editor.dom.getParent(newNode, 'td,th'); + var oldParent = editor.dom.getParent(preBrowserNode, 'td,th'); + + return newParent && newParent !== oldParent && checkSameParentTable(newParent, oldParent); + } + + function checkSameParentTable(nodeOne, NodeTwo) { + return editor.dom.getParent(nodeOne, 'TABLE') === editor.dom.getParent(NodeTwo, 'TABLE'); + } + + if (isVerticalMovement() && isInTable(editor)) { + var preBrowserNode = editor.selection.getNode(); + setTimeout(function() { + if (shouldFixCaret(preBrowserNode)) { + handle(!e.shiftKey && key === VK.UP, preBrowserNode, e); + } + }, 0); + } + } + + editor.on('KeyDown', function(e) { + eventHandler(e); + }); + } + + function fixBeforeTableCaretBug() { + // Checks if the selection/caret is at the start of the specified block element + function isAtStart(rng, par) { + var doc = par.ownerDocument, rng2 = doc.createRange(), elm; + + rng2.setStartBefore(par); + rng2.setEnd(rng.endContainer, rng.endOffset); + + elm = doc.createElement('body'); + elm.appendChild(rng2.cloneContents()); + + // Check for text characters of other elements that should be treated as content + return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length === 0; + } + + // Fixes an bug where it's impossible to place the caret before a table in Gecko + // this fix solves it by detecting when the caret is at the beginning of such a table + // and then manually moves the caret infront of the table + editor.on('KeyDown', function(e) { + var rng, table, dom = editor.dom; + + // On gecko it's not possible to place the caret before a table + if (e.keyCode == 37 || e.keyCode == 38) { + rng = editor.selection.getRng(); + table = dom.getParent(rng.startContainer, 'table'); + + if (table && editor.getBody().firstChild == table) { + if (isAtStart(rng, table)) { + rng = dom.createRng(); + + rng.setStartBefore(table); + rng.setEndBefore(table); + + editor.selection.setRng(rng); + + e.preventDefault(); + } + } + } + }); + } + + // Fixes an issue on Gecko where it's impossible to place the caret behind a table + // This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled + function fixTableCaretPos() { + editor.on('KeyDown SetContent VisualAid', function() { + var last; + + // Skip empty text nodes from the end + for (last = editor.getBody().lastChild; last; last = last.previousSibling) { + if (last.nodeType == 3) { + if (last.nodeValue.length > 0) { + break; + } + } else if (last.nodeType == 1 && (last.tagName == 'BR' || !last.getAttribute('data-mce-bogus'))) { + break; + } + } + + if (last && last.nodeName == 'TABLE') { + if (editor.settings.forced_root_block) { + editor.dom.add( + editor.getBody(), + editor.settings.forced_root_block, + editor.settings.forced_root_block_attrs, + Env.ie && Env.ie < 11 ? ' ' : '
    ' + ); + } else { + editor.dom.add(editor.getBody(), 'br', {'data-mce-bogus': '1'}); + } + } + }); + + editor.on('PreProcess', function(o) { + var last = o.node.lastChild; + + if (last && (last.nodeName == "BR" || (last.childNodes.length == 1 && + (last.firstChild.nodeName == 'BR' || last.firstChild.nodeValue == '\u00a0'))) && + last.previousSibling && last.previousSibling.nodeName == "TABLE") { + editor.dom.remove(last); + } + }); + } + + // this nasty hack is here to work around some WebKit selection bugs. + function fixTableCellSelection() { + function tableCellSelected(ed, rng, n, currentCell) { + // The decision of when a table cell is selected is somewhat involved. The fact that this code is + // required is actually a pointer to the root cause of this bug. A cell is selected when the start + // and end offsets are 0, the start container is a text, and the selection node is either a TR (most cases) + // or the parent of the table (in the case of the selection containing the last cell of a table). + var TEXT_NODE = 3, table = ed.dom.getParent(rng.startContainer, 'TABLE'); + var tableParent, allOfCellSelected, tableCellSelection; + + if (table) { + tableParent = table.parentNode; + } + + allOfCellSelected = rng.startContainer.nodeType == TEXT_NODE && + rng.startOffset === 0 && + rng.endOffset === 0 && + currentCell && + (n.nodeName == "TR" || n == tableParent); + + tableCellSelection = (n.nodeName == "TD" || n.nodeName == "TH") && !currentCell; + + return allOfCellSelected || tableCellSelection; + } + + function fixSelection() { + var rng = editor.selection.getRng(); + var n = editor.selection.getNode(); + var currentCell = editor.dom.getParent(rng.startContainer, 'TD,TH'); + + if (!tableCellSelected(editor, rng, n, currentCell)) { + return; + } + + if (!currentCell) { + currentCell = n; + } + + // Get the very last node inside the table cell + var end = currentCell.lastChild; + while (end.lastChild) { + end = end.lastChild; + } + + // Select the entire table cell. Nothing outside of the table cell should be selected. + if (end.nodeType == 3) { + rng.setEnd(end, end.data.length); + editor.selection.setRng(rng); + } + } + + editor.on('KeyDown', function() { + fixSelection(); + }); + + editor.on('MouseDown', function(e) { + if (e.button != 2) { + fixSelection(); + } + }); + } + + /** + * Delete table if all cells are selected. + */ + function deleteTable() { + editor.on('keydown', function(e) { + if ((e.keyCode == VK.DELETE || e.keyCode == VK.BACKSPACE) && !e.isDefaultPrevented()) { + var table = editor.dom.getParent(editor.selection.getStart(), 'table'); + + if (table) { + var cells = editor.dom.select('td,th', table), i = cells.length; + while (i--) { + if (!editor.dom.hasClass(cells[i], 'mce-item-selected')) { + return; + } + } + + e.preventDefault(); + editor.execCommand('mceTableDelete'); + } + } + }); + } + + deleteTable(); + + if (Env.webkit) { + moveWebKitSelection(); + fixTableCellSelection(); + } + + if (Env.gecko) { + fixBeforeTableCaretBug(); + fixTableCaretPos(); + } + + if (Env.ie > 10) { + fixBeforeTableCaretBug(); + fixTableCaretPos(); + } + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/TableGrid.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/classes/TableGrid.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,864 @@ +/** + * TableGrid.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a grid out of a table element. This + * makes it a whole lot easier to handle complex tables with + * col/row spans. + * + * @class tinymce.tableplugin.TableGrid + * @private + */ +define("tinymce/tableplugin/TableGrid", [ + "tinymce/util/Tools", + "tinymce/Env" +], function(Tools, Env) { + var each = Tools.each; + + function getSpanVal(td, name) { + return parseInt(td.getAttribute(name) || 1, 10); + } + + return function(editor, table) { + var grid, gridWidth, startPos, endPos, selectedCell, selection = editor.selection, dom = selection.dom; + + function buildGrid() { + var startY = 0; + + grid = []; + gridWidth = 0; + + each(['thead', 'tbody', 'tfoot'], function(part) { + var rows = dom.select('> ' + part + ' tr', table); + + each(rows, function(tr, y) { + y += startY; + + each(dom.select('> td, > th', tr), function(td, x) { + var x2, y2, rowspan, colspan; + + // Skip over existing cells produced by rowspan + if (grid[y]) { + while (grid[y][x]) { + x++; + } + } + + // Get col/rowspan from cell + rowspan = getSpanVal(td, 'rowspan'); + colspan = getSpanVal(td, 'colspan'); + + // Fill out rowspan/colspan right and down + for (y2 = y; y2 < y + rowspan; y2++) { + if (!grid[y2]) { + grid[y2] = []; + } + + for (x2 = x; x2 < x + colspan; x2++) { + grid[y2][x2] = { + part: part, + real: y2 == y && x2 == x, + elm: td, + rowspan: rowspan, + colspan: colspan + }; + } + } + + gridWidth = Math.max(gridWidth, x + 1); + }); + }); + + startY += rows.length; + }); + } + + function cloneNode(node, children) { + node = node.cloneNode(children); + node.removeAttribute('id'); + + return node; + } + + function getCell(x, y) { + var row; + + row = grid[y]; + if (row) { + return row[x]; + } + } + + function setSpanVal(td, name, val) { + if (td) { + val = parseInt(val, 10); + + if (val === 1) { + td.removeAttribute(name, 1); + } else { + td.setAttribute(name, val, 1); + } + } + } + + function isCellSelected(cell) { + return cell && (dom.hasClass(cell.elm, 'mce-item-selected') || cell == selectedCell); + } + + function getSelectedRows() { + var rows = []; + + each(table.rows, function(row) { + each(row.cells, function(cell) { + if (dom.hasClass(cell, 'mce-item-selected') || (selectedCell && cell == selectedCell.elm)) { + rows.push(row); + return false; + } + }); + }); + + return rows; + } + + function deleteTable() { + var rng = dom.createRng(); + + rng.setStartAfter(table); + rng.setEndAfter(table); + + selection.setRng(rng); + + dom.remove(table); + } + + function cloneCell(cell) { + var formatNode, cloneFormats = {}; + + if (editor.settings.table_clone_elements !== false) { + cloneFormats = Tools.makeMap( + (editor.settings.table_clone_elements || 'strong em b i span font h1 h2 h3 h4 h5 h6 p div').toUpperCase(), + /[ ,]/ + ); + } + + // Clone formats + Tools.walk(cell, function(node) { + var curNode; + + if (node.nodeType == 3) { + each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) { + if (!cloneFormats[node.nodeName]) { + return; + } + + node = cloneNode(node, false); + + if (!formatNode) { + formatNode = curNode = node; + } else if (curNode) { + curNode.appendChild(node); + } + + curNode = node; + }); + + // Add something to the inner node + if (curNode) { + curNode.innerHTML = Env.ie ? ' ' : '
    '; + } + + return false; + } + }, 'childNodes'); + + cell = cloneNode(cell, false); + setSpanVal(cell, 'rowSpan', 1); + setSpanVal(cell, 'colSpan', 1); + + if (formatNode) { + cell.appendChild(formatNode); + } else { + if (!Env.ie || Env.ie > 10) { + cell.innerHTML = '
    '; + } + } + + return cell; + } + + function cleanup() { + var rng = dom.createRng(), row; + + // Empty rows + each(dom.select('tr', table), function(tr) { + if (tr.cells.length === 0) { + dom.remove(tr); + } + }); + + // Empty table + if (dom.select('tr', table).length === 0) { + rng.setStartBefore(table); + rng.setEndBefore(table); + selection.setRng(rng); + dom.remove(table); + return; + } + + // Empty header/body/footer + each(dom.select('thead,tbody,tfoot', table), function(part) { + if (part.rows.length === 0) { + dom.remove(part); + } + }); + + // Restore selection to start position if it still exists + buildGrid(); + + // If we have a valid startPos object + if (startPos) { + // Restore the selection to the closest table position + row = grid[Math.min(grid.length - 1, startPos.y)]; + if (row) { + selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true); + selection.collapse(true); + } + } + } + + function fillLeftDown(x, y, rows, cols) { + var tr, x2, r, c, cell; + + tr = grid[y][x].elm.parentNode; + for (r = 1; r <= rows; r++) { + tr = dom.getNext(tr, 'tr'); + + if (tr) { + // Loop left to find real cell + for (x2 = x; x2 >= 0; x2--) { + cell = grid[y + r][x2].elm; + + if (cell.parentNode == tr) { + // Append clones after + for (c = 1; c <= cols; c++) { + dom.insertAfter(cloneCell(cell), cell); + } + + break; + } + } + + if (x2 == -1) { + // Insert nodes before first cell + for (c = 1; c <= cols; c++) { + tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]); + } + } + } + } + } + + function split() { + each(grid, function(row, y) { + each(row, function(cell, x) { + var colSpan, rowSpan, i; + + if (isCellSelected(cell)) { + cell = cell.elm; + colSpan = getSpanVal(cell, 'colspan'); + rowSpan = getSpanVal(cell, 'rowspan'); + + if (colSpan > 1 || rowSpan > 1) { + setSpanVal(cell, 'rowSpan', 1); + setSpanVal(cell, 'colSpan', 1); + + // Insert cells right + for (i = 0; i < colSpan - 1; i++) { + dom.insertAfter(cloneCell(cell), cell); + } + + fillLeftDown(x, y, rowSpan - 1, colSpan); + } + } + }); + }); + } + + function merge(cell, cols, rows) { + var pos, startX, startY, endX, endY, x, y, startCell, endCell, children, count; + + // Use specified cell and cols/rows + if (cell) { + pos = getPos(cell); + startX = pos.x; + startY = pos.y; + endX = startX + (cols - 1); + endY = startY + (rows - 1); + } else { + startPos = endPos = null; + + // Calculate start/end pos by checking for selected cells in grid works better with context menu + each(grid, function(row, y) { + each(row, function(cell, x) { + if (isCellSelected(cell)) { + if (!startPos) { + startPos = {x: x, y: y}; + } + + endPos = {x: x, y: y}; + } + }); + }); + + // Use selection, but make sure startPos is valid before accessing + if (startPos) { + startX = startPos.x; + startY = startPos.y; + endX = endPos.x; + endY = endPos.y; + } + } + + // Find start/end cells + startCell = getCell(startX, startY); + endCell = getCell(endX, endY); + + // Check if the cells exists and if they are of the same part for example tbody = tbody + if (startCell && endCell && startCell.part == endCell.part) { + // Split and rebuild grid + split(); + buildGrid(); + + // Set row/col span to start cell + startCell = getCell(startX, startY).elm; + setSpanVal(startCell, 'colSpan', (endX - startX) + 1); + setSpanVal(startCell, 'rowSpan', (endY - startY) + 1); + + // Remove other cells and add it's contents to the start cell + for (y = startY; y <= endY; y++) { + for (x = startX; x <= endX; x++) { + if (!grid[y] || !grid[y][x]) { + continue; + } + + cell = grid[y][x].elm; + + /*jshint loopfunc:true */ + /*eslint no-loop-func:0 */ + if (cell != startCell) { + // Move children to startCell + children = Tools.grep(cell.childNodes); + each(children, function(node) { + startCell.appendChild(node); + }); + + // Remove bogus nodes if there is children in the target cell + if (children.length) { + children = Tools.grep(startCell.childNodes); + count = 0; + each(children, function(node) { + if (node.nodeName == 'BR' && dom.getAttrib(node, 'data-mce-bogus') && count++ < children.length - 1) { + startCell.removeChild(node); + } + }); + } + + dom.remove(cell); + } + } + } + + // Remove empty rows etc and restore caret location + cleanup(); + } + } + + function insertRow(before) { + var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell, rowSpan; + + // Find first/last row + each(grid, function(row, y) { + each(row, function(cell) { + if (isCellSelected(cell)) { + cell = cell.elm; + rowElm = cell.parentNode; + newRow = cloneNode(rowElm, false); + posY = y; + + if (before) { + return false; + } + } + }); + + if (before) { + return !posY; + } + }); + + // If posY is undefined there is nothing for us to do here...just return to avoid crashing below + if (posY === undefined) { + return; + } + + for (x = 0; x < grid[0].length; x++) { + // Cell not found could be because of an invalid table structure + if (!grid[posY][x]) { + continue; + } + + cell = grid[posY][x].elm; + + if (cell != lastCell) { + if (!before) { + rowSpan = getSpanVal(cell, 'rowspan'); + if (rowSpan > 1) { + setSpanVal(cell, 'rowSpan', rowSpan + 1); + continue; + } + } else { + // Check if cell above can be expanded + if (posY > 0 && grid[posY - 1][x]) { + otherCell = grid[posY - 1][x].elm; + rowSpan = getSpanVal(otherCell, 'rowSpan'); + if (rowSpan > 1) { + setSpanVal(otherCell, 'rowSpan', rowSpan + 1); + continue; + } + } + } + + // Insert new cell into new row + newCell = cloneCell(cell); + setSpanVal(newCell, 'colSpan', cell.colSpan); + + newRow.appendChild(newCell); + + lastCell = cell; + } + } + + if (newRow.hasChildNodes()) { + if (!before) { + dom.insertAfter(newRow, rowElm); + } else { + rowElm.parentNode.insertBefore(newRow, rowElm); + } + } + } + + function insertCol(before) { + var posX, lastCell; + + // Find first/last column + each(grid, function(row) { + each(row, function(cell, x) { + if (isCellSelected(cell)) { + posX = x; + + if (before) { + return false; + } + } + }); + + if (before) { + return !posX; + } + }); + + each(grid, function(row, y) { + var cell, rowSpan, colSpan; + + if (!row[posX]) { + return; + } + + cell = row[posX].elm; + if (cell != lastCell) { + colSpan = getSpanVal(cell, 'colspan'); + rowSpan = getSpanVal(cell, 'rowspan'); + + if (colSpan == 1) { + if (!before) { + dom.insertAfter(cloneCell(cell), cell); + fillLeftDown(posX, y, rowSpan - 1, colSpan); + } else { + cell.parentNode.insertBefore(cloneCell(cell), cell); + fillLeftDown(posX, y, rowSpan - 1, colSpan); + } + } else { + setSpanVal(cell, 'colSpan', cell.colSpan + 1); + } + + lastCell = cell; + } + }); + } + + function deleteCols() { + var cols = []; + + // Get selected column indexes + each(grid, function(row) { + each(row, function(cell, x) { + if (isCellSelected(cell) && Tools.inArray(cols, x) === -1) { + each(grid, function(row) { + var cell = row[x].elm, colSpan; + + colSpan = getSpanVal(cell, 'colSpan'); + + if (colSpan > 1) { + setSpanVal(cell, 'colSpan', colSpan - 1); + } else { + dom.remove(cell); + } + }); + + cols.push(x); + } + }); + }); + + cleanup(); + } + + function deleteRows() { + var rows; + + function deleteRow(tr) { + var pos, lastCell; + + // Move down row spanned cells + each(tr.cells, function(cell) { + var rowSpan = getSpanVal(cell, 'rowSpan'); + + if (rowSpan > 1) { + setSpanVal(cell, 'rowSpan', rowSpan - 1); + pos = getPos(cell); + fillLeftDown(pos.x, pos.y, 1, 1); + } + }); + + // Delete cells + pos = getPos(tr.cells[0]); + each(grid[pos.y], function(cell) { + var rowSpan; + + cell = cell.elm; + + if (cell != lastCell) { + rowSpan = getSpanVal(cell, 'rowSpan'); + + if (rowSpan <= 1) { + dom.remove(cell); + } else { + setSpanVal(cell, 'rowSpan', rowSpan - 1); + } + + lastCell = cell; + } + }); + } + + // Get selected rows and move selection out of scope + rows = getSelectedRows(); + + // Delete all selected rows + each(rows.reverse(), function(tr) { + deleteRow(tr); + }); + + cleanup(); + } + + function cutRows() { + var rows = getSelectedRows(); + + dom.remove(rows); + cleanup(); + + return rows; + } + + function copyRows() { + var rows = getSelectedRows(); + + each(rows, function(row, i) { + rows[i] = cloneNode(row, true); + }); + + return rows; + } + + function pasteRows(rows, before) { + var selectedRows = getSelectedRows(), + targetRow = selectedRows[before ? 0 : selectedRows.length - 1], + targetCellCount = targetRow.cells.length; + + // Nothing to paste + if (!rows) { + return; + } + + // Calc target cell count + each(grid, function(row) { + var match; + + targetCellCount = 0; + each(row, function(cell) { + if (cell.real) { + targetCellCount += cell.colspan; + } + + if (cell.elm.parentNode == targetRow) { + match = 1; + } + }); + + if (match) { + return false; + } + }); + + if (!before) { + rows.reverse(); + } + + each(rows, function(row) { + var i, cellCount = row.cells.length, cell; + + // Remove col/rowspans + for (i = 0; i < cellCount; i++) { + cell = row.cells[i]; + setSpanVal(cell, 'colSpan', 1); + setSpanVal(cell, 'rowSpan', 1); + } + + // Needs more cells + for (i = cellCount; i < targetCellCount; i++) { + row.appendChild(cloneCell(row.cells[cellCount - 1])); + } + + // Needs less cells + for (i = targetCellCount; i < cellCount; i++) { + dom.remove(row.cells[i]); + } + + // Add before/after + if (before) { + targetRow.parentNode.insertBefore(row, targetRow); + } else { + dom.insertAfter(row, targetRow); + } + }); + + // Remove current selection + dom.removeClass(dom.select('td.mce-item-selected,th.mce-item-selected'), 'mce-item-selected'); + } + + function getPos(target) { + var pos; + + each(grid, function(row, y) { + each(row, function(cell, x) { + if (cell.elm == target) { + pos = {x: x, y: y}; + return false; + } + }); + + return !pos; + }); + + return pos; + } + + function setStartCell(cell) { + startPos = getPos(cell); + } + + function findEndPos() { + var maxX, maxY; + + maxX = maxY = 0; + + each(grid, function(row, y) { + each(row, function(cell, x) { + var colSpan, rowSpan; + + if (isCellSelected(cell)) { + cell = grid[y][x]; + + if (x > maxX) { + maxX = x; + } + + if (y > maxY) { + maxY = y; + } + + if (cell.real) { + colSpan = cell.colspan - 1; + rowSpan = cell.rowspan - 1; + + if (colSpan) { + if (x + colSpan > maxX) { + maxX = x + colSpan; + } + } + + if (rowSpan) { + if (y + rowSpan > maxY) { + maxY = y + rowSpan; + } + } + } + } + }); + }); + + return {x: maxX, y: maxY}; + } + + function setEndCell(cell) { + var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan, x, y; + + endPos = getPos(cell); + + if (startPos && endPos) { + // Get start/end positions + startX = Math.min(startPos.x, endPos.x); + startY = Math.min(startPos.y, endPos.y); + endX = Math.max(startPos.x, endPos.x); + endY = Math.max(startPos.y, endPos.y); + + // Expand end positon to include spans + maxX = endX; + maxY = endY; + + // Expand startX + for (y = startY; y <= maxY; y++) { + cell = grid[y][startX]; + + if (!cell.real) { + if (startX - (cell.colspan - 1) < startX) { + startX -= cell.colspan - 1; + } + } + } + + // Expand startY + for (x = startX; x <= maxX; x++) { + cell = grid[startY][x]; + + if (!cell.real) { + if (startY - (cell.rowspan - 1) < startY) { + startY -= cell.rowspan - 1; + } + } + } + + // Find max X, Y + for (y = startY; y <= endY; y++) { + for (x = startX; x <= endX; x++) { + cell = grid[y][x]; + + if (cell.real) { + colSpan = cell.colspan - 1; + rowSpan = cell.rowspan - 1; + + if (colSpan) { + if (x + colSpan > maxX) { + maxX = x + colSpan; + } + } + + if (rowSpan) { + if (y + rowSpan > maxY) { + maxY = y + rowSpan; + } + } + } + } + } + + // Remove current selection + dom.removeClass(dom.select('td.mce-item-selected,th.mce-item-selected'), 'mce-item-selected'); + + // Add new selection + for (y = startY; y <= maxY; y++) { + for (x = startX; x <= maxX; x++) { + if (grid[y][x]) { + dom.addClass(grid[y][x].elm, 'mce-item-selected'); + } + } + } + } + } + + function moveRelIdx(cellElm, delta) { + var pos, index, cell; + + pos = getPos(cellElm); + index = pos.y * gridWidth + pos.x; + + do { + index += delta; + cell = getCell(index % gridWidth, Math.floor(index / gridWidth)); + + if (!cell) { + break; + } + + if (cell.elm != cellElm) { + selection.select(cell.elm, true); + + if (dom.isEmpty(cell.elm)) { + selection.collapse(true); + } + + return true; + } + } while (cell.elm == cellElm); + + return false; + } + + table = table || dom.getParent(selection.getStart(), 'table'); + + buildGrid(); + + selectedCell = dom.getParent(selection.getStart(), 'th,td'); + if (selectedCell) { + startPos = getPos(selectedCell); + endPos = findEndPos(); + selectedCell = getCell(startPos.x, startPos.y); + } + + Tools.extend(this, { + deleteTable: deleteTable, + split: split, + merge: merge, + insertRow: insertRow, + insertCol: insertCol, + deleteCols: deleteCols, + deleteRows: deleteRows, + cutRows: cutRows, + copyRows: copyRows, + pasteRows: pasteRows, + getPos: getPos, + setStartCell: setStartCell, + setEndCell: setEndCell, + moveRelIdx: moveRelIdx, + refresh: buildGrid + }); + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/plugin.dev.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/plugin.dev.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,118 @@ +/** + * Inline development version. Only to be used while developing since it uses document.write to load scripts. + */ + +/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */ +/*globals $code */ + +(function(exports) { + "use strict"; + + var html = "", baseDir; + var modules = {}, exposedModules = [], moduleCount = 0; + + var scripts = document.getElementsByTagName('script'); + for (var i = 0; i < scripts.length; i++) { + var src = scripts[i].src; + + if (src.indexOf('/plugin.dev.js') != -1) { + baseDir = src.substring(0, src.lastIndexOf('/')); + } + } + + function require(ids, callback) { + var module, defs = []; + + for (var i = 0; i < ids.length; ++i) { + module = modules[ids[i]] || resolve(ids[i]); + if (!module) { + throw 'module definition dependecy not found: ' + ids[i]; + } + + defs.push(module); + } + + callback.apply(null, defs); + } + + function resolve(id) { + var target = exports; + var fragments = id.split(/[.\/]/); + + for (var fi = 0; fi < fragments.length; ++fi) { + if (!target[fragments[fi]]) { + return; + } + + target = target[fragments[fi]]; + } + + return target; + } + + function register(id) { + var target = exports; + var fragments = id.split(/[.\/]/); + + for (var fi = 0; fi < fragments.length - 1; ++fi) { + if (target[fragments[fi]] === undefined) { + target[fragments[fi]] = {}; + } + + target = target[fragments[fi]]; + } + + target[fragments[fragments.length - 1]] = modules[id]; + } + + function define(id, dependencies, definition) { + if (typeof id !== 'string') { + throw 'invalid module definition, module id must be defined and be a string'; + } + + if (dependencies === undefined) { + throw 'invalid module definition, dependencies must be specified'; + } + + if (definition === undefined) { + throw 'invalid module definition, definition function must be specified'; + } + + require(dependencies, function() { + modules[id] = definition.apply(null, arguments); + }); + + if (--moduleCount === 0) { + for (var i = 0; i < exposedModules.length; i++) { + register(exposedModules[i]); + } + } + } + + function expose(ids) { + exposedModules = ids; + } + + function writeScripts() { + document.write(html); + } + + function load(path) { + html += '\n'; + moduleCount++; + } + + // Expose globally + exports.define = define; + exports.require = require; + + load('classes/TableGrid.js'); + load('classes/Quirks.js'); + load('classes/CellSelection.js'); + load('classes/Dialogs.js'); + load('classes/Plugin.js'); + + writeScripts(); +})(this); + +// $hash: 712fc4092f1b9967704422d7ed4cd0b4 \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,2769 @@ +/** + * Compiled inline version. (Library mode) + */ + +/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */ +/*globals $code */ + +(function(exports, undefined) { + "use strict"; + + var modules = {}; + + function require(ids, callback) { + var module, defs = []; + + for (var i = 0; i < ids.length; ++i) { + module = modules[ids[i]] || resolve(ids[i]); + if (!module) { + throw 'module definition dependecy not found: ' + ids[i]; + } + + defs.push(module); + } + + callback.apply(null, defs); + } + + function define(id, dependencies, definition) { + if (typeof id !== 'string') { + throw 'invalid module definition, module id must be defined and be a string'; + } + + if (dependencies === undefined) { + throw 'invalid module definition, dependencies must be specified'; + } + + if (definition === undefined) { + throw 'invalid module definition, definition function must be specified'; + } + + require(dependencies, function() { + modules[id] = definition.apply(null, arguments); + }); + } + + function defined(id) { + return !!modules[id]; + } + + function resolve(id) { + var target = exports; + var fragments = id.split(/[.\/]/); + + for (var fi = 0; fi < fragments.length; ++fi) { + if (!target[fragments[fi]]) { + return; + } + + target = target[fragments[fi]]; + } + + return target; + } + + function expose(ids) { + for (var i = 0; i < ids.length; i++) { + var target = exports; + var id = ids[i]; + var fragments = id.split(/[.\/]/); + + for (var fi = 0; fi < fragments.length - 1; ++fi) { + if (target[fragments[fi]] === undefined) { + target[fragments[fi]] = {}; + } + + target = target[fragments[fi]]; + } + + target[fragments[fragments.length - 1]] = modules[id]; + } + } + +// Included from: js/tinymce/plugins/table/classes/TableGrid.js + +/** + * TableGrid.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a grid out of a table element. This + * makes it a whole lot easier to handle complex tables with + * col/row spans. + * + * @class tinymce.tableplugin.TableGrid + * @private + */ +define("tinymce/tableplugin/TableGrid", [ + "tinymce/util/Tools", + "tinymce/Env" +], function(Tools, Env) { + var each = Tools.each; + + function getSpanVal(td, name) { + return parseInt(td.getAttribute(name) || 1, 10); + } + + return function(editor, table) { + var grid, gridWidth, startPos, endPos, selectedCell, selection = editor.selection, dom = selection.dom; + + function buildGrid() { + var startY = 0; + + grid = []; + gridWidth = 0; + + each(['thead', 'tbody', 'tfoot'], function(part) { + var rows = dom.select('> ' + part + ' tr', table); + + each(rows, function(tr, y) { + y += startY; + + each(dom.select('> td, > th', tr), function(td, x) { + var x2, y2, rowspan, colspan; + + // Skip over existing cells produced by rowspan + if (grid[y]) { + while (grid[y][x]) { + x++; + } + } + + // Get col/rowspan from cell + rowspan = getSpanVal(td, 'rowspan'); + colspan = getSpanVal(td, 'colspan'); + + // Fill out rowspan/colspan right and down + for (y2 = y; y2 < y + rowspan; y2++) { + if (!grid[y2]) { + grid[y2] = []; + } + + for (x2 = x; x2 < x + colspan; x2++) { + grid[y2][x2] = { + part: part, + real: y2 == y && x2 == x, + elm: td, + rowspan: rowspan, + colspan: colspan + }; + } + } + + gridWidth = Math.max(gridWidth, x + 1); + }); + }); + + startY += rows.length; + }); + } + + function cloneNode(node, children) { + node = node.cloneNode(children); + node.removeAttribute('id'); + + return node; + } + + function getCell(x, y) { + var row; + + row = grid[y]; + if (row) { + return row[x]; + } + } + + function setSpanVal(td, name, val) { + if (td) { + val = parseInt(val, 10); + + if (val === 1) { + td.removeAttribute(name, 1); + } else { + td.setAttribute(name, val, 1); + } + } + } + + function isCellSelected(cell) { + return cell && (dom.hasClass(cell.elm, 'mce-item-selected') || cell == selectedCell); + } + + function getSelectedRows() { + var rows = []; + + each(table.rows, function(row) { + each(row.cells, function(cell) { + if (dom.hasClass(cell, 'mce-item-selected') || (selectedCell && cell == selectedCell.elm)) { + rows.push(row); + return false; + } + }); + }); + + return rows; + } + + function deleteTable() { + var rng = dom.createRng(); + + rng.setStartAfter(table); + rng.setEndAfter(table); + + selection.setRng(rng); + + dom.remove(table); + } + + function cloneCell(cell) { + var formatNode, cloneFormats = {}; + + if (editor.settings.table_clone_elements !== false) { + cloneFormats = Tools.makeMap( + (editor.settings.table_clone_elements || 'strong em b i span font h1 h2 h3 h4 h5 h6 p div').toUpperCase(), + /[ ,]/ + ); + } + + // Clone formats + Tools.walk(cell, function(node) { + var curNode; + + if (node.nodeType == 3) { + each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) { + if (!cloneFormats[node.nodeName]) { + return; + } + + node = cloneNode(node, false); + + if (!formatNode) { + formatNode = curNode = node; + } else if (curNode) { + curNode.appendChild(node); + } + + curNode = node; + }); + + // Add something to the inner node + if (curNode) { + curNode.innerHTML = Env.ie ? ' ' : '
    '; + } + + return false; + } + }, 'childNodes'); + + cell = cloneNode(cell, false); + setSpanVal(cell, 'rowSpan', 1); + setSpanVal(cell, 'colSpan', 1); + + if (formatNode) { + cell.appendChild(formatNode); + } else { + if (!Env.ie || Env.ie > 10) { + cell.innerHTML = '
    '; + } + } + + return cell; + } + + function cleanup() { + var rng = dom.createRng(), row; + + // Empty rows + each(dom.select('tr', table), function(tr) { + if (tr.cells.length === 0) { + dom.remove(tr); + } + }); + + // Empty table + if (dom.select('tr', table).length === 0) { + rng.setStartBefore(table); + rng.setEndBefore(table); + selection.setRng(rng); + dom.remove(table); + return; + } + + // Empty header/body/footer + each(dom.select('thead,tbody,tfoot', table), function(part) { + if (part.rows.length === 0) { + dom.remove(part); + } + }); + + // Restore selection to start position if it still exists + buildGrid(); + + // If we have a valid startPos object + if (startPos) { + // Restore the selection to the closest table position + row = grid[Math.min(grid.length - 1, startPos.y)]; + if (row) { + selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true); + selection.collapse(true); + } + } + } + + function fillLeftDown(x, y, rows, cols) { + var tr, x2, r, c, cell; + + tr = grid[y][x].elm.parentNode; + for (r = 1; r <= rows; r++) { + tr = dom.getNext(tr, 'tr'); + + if (tr) { + // Loop left to find real cell + for (x2 = x; x2 >= 0; x2--) { + cell = grid[y + r][x2].elm; + + if (cell.parentNode == tr) { + // Append clones after + for (c = 1; c <= cols; c++) { + dom.insertAfter(cloneCell(cell), cell); + } + + break; + } + } + + if (x2 == -1) { + // Insert nodes before first cell + for (c = 1; c <= cols; c++) { + tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]); + } + } + } + } + } + + function split() { + each(grid, function(row, y) { + each(row, function(cell, x) { + var colSpan, rowSpan, i; + + if (isCellSelected(cell)) { + cell = cell.elm; + colSpan = getSpanVal(cell, 'colspan'); + rowSpan = getSpanVal(cell, 'rowspan'); + + if (colSpan > 1 || rowSpan > 1) { + setSpanVal(cell, 'rowSpan', 1); + setSpanVal(cell, 'colSpan', 1); + + // Insert cells right + for (i = 0; i < colSpan - 1; i++) { + dom.insertAfter(cloneCell(cell), cell); + } + + fillLeftDown(x, y, rowSpan - 1, colSpan); + } + } + }); + }); + } + + function merge(cell, cols, rows) { + var pos, startX, startY, endX, endY, x, y, startCell, endCell, children, count; + + // Use specified cell and cols/rows + if (cell) { + pos = getPos(cell); + startX = pos.x; + startY = pos.y; + endX = startX + (cols - 1); + endY = startY + (rows - 1); + } else { + startPos = endPos = null; + + // Calculate start/end pos by checking for selected cells in grid works better with context menu + each(grid, function(row, y) { + each(row, function(cell, x) { + if (isCellSelected(cell)) { + if (!startPos) { + startPos = {x: x, y: y}; + } + + endPos = {x: x, y: y}; + } + }); + }); + + // Use selection, but make sure startPos is valid before accessing + if (startPos) { + startX = startPos.x; + startY = startPos.y; + endX = endPos.x; + endY = endPos.y; + } + } + + // Find start/end cells + startCell = getCell(startX, startY); + endCell = getCell(endX, endY); + + // Check if the cells exists and if they are of the same part for example tbody = tbody + if (startCell && endCell && startCell.part == endCell.part) { + // Split and rebuild grid + split(); + buildGrid(); + + // Set row/col span to start cell + startCell = getCell(startX, startY).elm; + setSpanVal(startCell, 'colSpan', (endX - startX) + 1); + setSpanVal(startCell, 'rowSpan', (endY - startY) + 1); + + // Remove other cells and add it's contents to the start cell + for (y = startY; y <= endY; y++) { + for (x = startX; x <= endX; x++) { + if (!grid[y] || !grid[y][x]) { + continue; + } + + cell = grid[y][x].elm; + + /*jshint loopfunc:true */ + /*eslint no-loop-func:0 */ + if (cell != startCell) { + // Move children to startCell + children = Tools.grep(cell.childNodes); + each(children, function(node) { + startCell.appendChild(node); + }); + + // Remove bogus nodes if there is children in the target cell + if (children.length) { + children = Tools.grep(startCell.childNodes); + count = 0; + each(children, function(node) { + if (node.nodeName == 'BR' && dom.getAttrib(node, 'data-mce-bogus') && count++ < children.length - 1) { + startCell.removeChild(node); + } + }); + } + + dom.remove(cell); + } + } + } + + // Remove empty rows etc and restore caret location + cleanup(); + } + } + + function insertRow(before) { + var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell, rowSpan; + + // Find first/last row + each(grid, function(row, y) { + each(row, function(cell) { + if (isCellSelected(cell)) { + cell = cell.elm; + rowElm = cell.parentNode; + newRow = cloneNode(rowElm, false); + posY = y; + + if (before) { + return false; + } + } + }); + + if (before) { + return !posY; + } + }); + + // If posY is undefined there is nothing for us to do here...just return to avoid crashing below + if (posY === undefined) { + return; + } + + for (x = 0; x < grid[0].length; x++) { + // Cell not found could be because of an invalid table structure + if (!grid[posY][x]) { + continue; + } + + cell = grid[posY][x].elm; + + if (cell != lastCell) { + if (!before) { + rowSpan = getSpanVal(cell, 'rowspan'); + if (rowSpan > 1) { + setSpanVal(cell, 'rowSpan', rowSpan + 1); + continue; + } + } else { + // Check if cell above can be expanded + if (posY > 0 && grid[posY - 1][x]) { + otherCell = grid[posY - 1][x].elm; + rowSpan = getSpanVal(otherCell, 'rowSpan'); + if (rowSpan > 1) { + setSpanVal(otherCell, 'rowSpan', rowSpan + 1); + continue; + } + } + } + + // Insert new cell into new row + newCell = cloneCell(cell); + setSpanVal(newCell, 'colSpan', cell.colSpan); + + newRow.appendChild(newCell); + + lastCell = cell; + } + } + + if (newRow.hasChildNodes()) { + if (!before) { + dom.insertAfter(newRow, rowElm); + } else { + rowElm.parentNode.insertBefore(newRow, rowElm); + } + } + } + + function insertCol(before) { + var posX, lastCell; + + // Find first/last column + each(grid, function(row) { + each(row, function(cell, x) { + if (isCellSelected(cell)) { + posX = x; + + if (before) { + return false; + } + } + }); + + if (before) { + return !posX; + } + }); + + each(grid, function(row, y) { + var cell, rowSpan, colSpan; + + if (!row[posX]) { + return; + } + + cell = row[posX].elm; + if (cell != lastCell) { + colSpan = getSpanVal(cell, 'colspan'); + rowSpan = getSpanVal(cell, 'rowspan'); + + if (colSpan == 1) { + if (!before) { + dom.insertAfter(cloneCell(cell), cell); + fillLeftDown(posX, y, rowSpan - 1, colSpan); + } else { + cell.parentNode.insertBefore(cloneCell(cell), cell); + fillLeftDown(posX, y, rowSpan - 1, colSpan); + } + } else { + setSpanVal(cell, 'colSpan', cell.colSpan + 1); + } + + lastCell = cell; + } + }); + } + + function deleteCols() { + var cols = []; + + // Get selected column indexes + each(grid, function(row) { + each(row, function(cell, x) { + if (isCellSelected(cell) && Tools.inArray(cols, x) === -1) { + each(grid, function(row) { + var cell = row[x].elm, colSpan; + + colSpan = getSpanVal(cell, 'colSpan'); + + if (colSpan > 1) { + setSpanVal(cell, 'colSpan', colSpan - 1); + } else { + dom.remove(cell); + } + }); + + cols.push(x); + } + }); + }); + + cleanup(); + } + + function deleteRows() { + var rows; + + function deleteRow(tr) { + var pos, lastCell; + + // Move down row spanned cells + each(tr.cells, function(cell) { + var rowSpan = getSpanVal(cell, 'rowSpan'); + + if (rowSpan > 1) { + setSpanVal(cell, 'rowSpan', rowSpan - 1); + pos = getPos(cell); + fillLeftDown(pos.x, pos.y, 1, 1); + } + }); + + // Delete cells + pos = getPos(tr.cells[0]); + each(grid[pos.y], function(cell) { + var rowSpan; + + cell = cell.elm; + + if (cell != lastCell) { + rowSpan = getSpanVal(cell, 'rowSpan'); + + if (rowSpan <= 1) { + dom.remove(cell); + } else { + setSpanVal(cell, 'rowSpan', rowSpan - 1); + } + + lastCell = cell; + } + }); + } + + // Get selected rows and move selection out of scope + rows = getSelectedRows(); + + // Delete all selected rows + each(rows.reverse(), function(tr) { + deleteRow(tr); + }); + + cleanup(); + } + + function cutRows() { + var rows = getSelectedRows(); + + dom.remove(rows); + cleanup(); + + return rows; + } + + function copyRows() { + var rows = getSelectedRows(); + + each(rows, function(row, i) { + rows[i] = cloneNode(row, true); + }); + + return rows; + } + + function pasteRows(rows, before) { + var selectedRows = getSelectedRows(), + targetRow = selectedRows[before ? 0 : selectedRows.length - 1], + targetCellCount = targetRow.cells.length; + + // Nothing to paste + if (!rows) { + return; + } + + // Calc target cell count + each(grid, function(row) { + var match; + + targetCellCount = 0; + each(row, function(cell) { + if (cell.real) { + targetCellCount += cell.colspan; + } + + if (cell.elm.parentNode == targetRow) { + match = 1; + } + }); + + if (match) { + return false; + } + }); + + if (!before) { + rows.reverse(); + } + + each(rows, function(row) { + var i, cellCount = row.cells.length, cell; + + // Remove col/rowspans + for (i = 0; i < cellCount; i++) { + cell = row.cells[i]; + setSpanVal(cell, 'colSpan', 1); + setSpanVal(cell, 'rowSpan', 1); + } + + // Needs more cells + for (i = cellCount; i < targetCellCount; i++) { + row.appendChild(cloneCell(row.cells[cellCount - 1])); + } + + // Needs less cells + for (i = targetCellCount; i < cellCount; i++) { + dom.remove(row.cells[i]); + } + + // Add before/after + if (before) { + targetRow.parentNode.insertBefore(row, targetRow); + } else { + dom.insertAfter(row, targetRow); + } + }); + + // Remove current selection + dom.removeClass(dom.select('td.mce-item-selected,th.mce-item-selected'), 'mce-item-selected'); + } + + function getPos(target) { + var pos; + + each(grid, function(row, y) { + each(row, function(cell, x) { + if (cell.elm == target) { + pos = {x: x, y: y}; + return false; + } + }); + + return !pos; + }); + + return pos; + } + + function setStartCell(cell) { + startPos = getPos(cell); + } + + function findEndPos() { + var maxX, maxY; + + maxX = maxY = 0; + + each(grid, function(row, y) { + each(row, function(cell, x) { + var colSpan, rowSpan; + + if (isCellSelected(cell)) { + cell = grid[y][x]; + + if (x > maxX) { + maxX = x; + } + + if (y > maxY) { + maxY = y; + } + + if (cell.real) { + colSpan = cell.colspan - 1; + rowSpan = cell.rowspan - 1; + + if (colSpan) { + if (x + colSpan > maxX) { + maxX = x + colSpan; + } + } + + if (rowSpan) { + if (y + rowSpan > maxY) { + maxY = y + rowSpan; + } + } + } + } + }); + }); + + return {x: maxX, y: maxY}; + } + + function setEndCell(cell) { + var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan, x, y; + + endPos = getPos(cell); + + if (startPos && endPos) { + // Get start/end positions + startX = Math.min(startPos.x, endPos.x); + startY = Math.min(startPos.y, endPos.y); + endX = Math.max(startPos.x, endPos.x); + endY = Math.max(startPos.y, endPos.y); + + // Expand end positon to include spans + maxX = endX; + maxY = endY; + + // Expand startX + for (y = startY; y <= maxY; y++) { + cell = grid[y][startX]; + + if (!cell.real) { + if (startX - (cell.colspan - 1) < startX) { + startX -= cell.colspan - 1; + } + } + } + + // Expand startY + for (x = startX; x <= maxX; x++) { + cell = grid[startY][x]; + + if (!cell.real) { + if (startY - (cell.rowspan - 1) < startY) { + startY -= cell.rowspan - 1; + } + } + } + + // Find max X, Y + for (y = startY; y <= endY; y++) { + for (x = startX; x <= endX; x++) { + cell = grid[y][x]; + + if (cell.real) { + colSpan = cell.colspan - 1; + rowSpan = cell.rowspan - 1; + + if (colSpan) { + if (x + colSpan > maxX) { + maxX = x + colSpan; + } + } + + if (rowSpan) { + if (y + rowSpan > maxY) { + maxY = y + rowSpan; + } + } + } + } + } + + // Remove current selection + dom.removeClass(dom.select('td.mce-item-selected,th.mce-item-selected'), 'mce-item-selected'); + + // Add new selection + for (y = startY; y <= maxY; y++) { + for (x = startX; x <= maxX; x++) { + if (grid[y][x]) { + dom.addClass(grid[y][x].elm, 'mce-item-selected'); + } + } + } + } + } + + function moveRelIdx(cellElm, delta) { + var pos, index, cell; + + pos = getPos(cellElm); + index = pos.y * gridWidth + pos.x; + + do { + index += delta; + cell = getCell(index % gridWidth, Math.floor(index / gridWidth)); + + if (!cell) { + break; + } + + if (cell.elm != cellElm) { + selection.select(cell.elm, true); + + if (dom.isEmpty(cell.elm)) { + selection.collapse(true); + } + + return true; + } + } while (cell.elm == cellElm); + + return false; + } + + table = table || dom.getParent(selection.getStart(), 'table'); + + buildGrid(); + + selectedCell = dom.getParent(selection.getStart(), 'th,td'); + if (selectedCell) { + startPos = getPos(selectedCell); + endPos = findEndPos(); + selectedCell = getCell(startPos.x, startPos.y); + } + + Tools.extend(this, { + deleteTable: deleteTable, + split: split, + merge: merge, + insertRow: insertRow, + insertCol: insertCol, + deleteCols: deleteCols, + deleteRows: deleteRows, + cutRows: cutRows, + copyRows: copyRows, + pasteRows: pasteRows, + getPos: getPos, + setStartCell: setStartCell, + setEndCell: setEndCell, + moveRelIdx: moveRelIdx, + refresh: buildGrid + }); + }; +}); + +// Included from: js/tinymce/plugins/table/classes/Quirks.js + +/** + * Quirks.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class includes fixes for various browser quirks. + * + * @class tinymce.tableplugin.Quirks + * @private + */ +define("tinymce/tableplugin/Quirks", [ + "tinymce/util/VK", + "tinymce/Env", + "tinymce/util/Tools" +], function(VK, Env, Tools) { + var each = Tools.each; + + function getSpanVal(td, name) { + return parseInt(td.getAttribute(name) || 1, 10); + } + + return function(editor) { + /** + * Fixed caret movement around tables on WebKit. + */ + function moveWebKitSelection() { + function eventHandler(e) { + var key = e.keyCode; + + function handle(upBool, sourceNode) { + var siblingDirection = upBool ? 'previousSibling' : 'nextSibling'; + var currentRow = editor.dom.getParent(sourceNode, 'tr'); + var siblingRow = currentRow[siblingDirection]; + + if (siblingRow) { + moveCursorToRow(editor, sourceNode, siblingRow, upBool); + e.preventDefault(); + return true; + } else { + var tableNode = editor.dom.getParent(currentRow, 'table'); + var middleNode = currentRow.parentNode; + var parentNodeName = middleNode.nodeName.toLowerCase(); + if (parentNodeName === 'tbody' || parentNodeName === (upBool ? 'tfoot' : 'thead')) { + var targetParent = getTargetParent(upBool, tableNode, middleNode, 'tbody'); + if (targetParent !== null) { + return moveToRowInTarget(upBool, targetParent, sourceNode); + } + } + return escapeTable(upBool, currentRow, siblingDirection, tableNode); + } + } + + function getTargetParent(upBool, topNode, secondNode, nodeName) { + var tbodies = editor.dom.select('>' + nodeName, topNode); + var position = tbodies.indexOf(secondNode); + if (upBool && position === 0 || !upBool && position === tbodies.length - 1) { + return getFirstHeadOrFoot(upBool, topNode); + } else if (position === -1) { + var topOrBottom = secondNode.tagName.toLowerCase() === 'thead' ? 0 : tbodies.length - 1; + return tbodies[topOrBottom]; + } else { + return tbodies[position + (upBool ? -1 : 1)]; + } + } + + function getFirstHeadOrFoot(upBool, parent) { + var tagName = upBool ? 'thead' : 'tfoot'; + var headOrFoot = editor.dom.select('>' + tagName, parent); + return headOrFoot.length !== 0 ? headOrFoot[0] : null; + } + + function moveToRowInTarget(upBool, targetParent, sourceNode) { + var targetRow = getChildForDirection(targetParent, upBool); + + if (targetRow) { + moveCursorToRow(editor, sourceNode, targetRow, upBool); + } + + e.preventDefault(); + return true; + } + + function escapeTable(upBool, currentRow, siblingDirection, table) { + var tableSibling = table[siblingDirection]; + + if (tableSibling) { + moveCursorToStartOfElement(tableSibling); + return true; + } else { + var parentCell = editor.dom.getParent(table, 'td,th'); + if (parentCell) { + return handle(upBool, parentCell, e); + } else { + var backUpSibling = getChildForDirection(currentRow, !upBool); + moveCursorToStartOfElement(backUpSibling); + e.preventDefault(); + return false; + } + } + } + + function getChildForDirection(parent, up) { + var child = parent && parent[up ? 'lastChild' : 'firstChild']; + // BR is not a valid table child to return in this case we return the table cell + return child && child.nodeName === 'BR' ? editor.dom.getParent(child, 'td,th') : child; + } + + function moveCursorToStartOfElement(n) { + editor.selection.setCursorLocation(n, 0); + } + + function isVerticalMovement() { + return key == VK.UP || key == VK.DOWN; + } + + function isInTable(editor) { + var node = editor.selection.getNode(); + var currentRow = editor.dom.getParent(node, 'tr'); + return currentRow !== null; + } + + function columnIndex(column) { + var colIndex = 0; + var c = column; + while (c.previousSibling) { + c = c.previousSibling; + colIndex = colIndex + getSpanVal(c, "colspan"); + } + return colIndex; + } + + function findColumn(rowElement, columnIndex) { + var c = 0, r = 0; + + each(rowElement.children, function(cell, i) { + c = c + getSpanVal(cell, "colspan"); + r = i; + if (c > columnIndex) { + return false; + } + }); + return r; + } + + function moveCursorToRow(ed, node, row, upBool) { + var srcColumnIndex = columnIndex(editor.dom.getParent(node, 'td,th')); + var tgtColumnIndex = findColumn(row, srcColumnIndex); + var tgtNode = row.childNodes[tgtColumnIndex]; + var rowCellTarget = getChildForDirection(tgtNode, upBool); + moveCursorToStartOfElement(rowCellTarget || tgtNode); + } + + function shouldFixCaret(preBrowserNode) { + var newNode = editor.selection.getNode(); + var newParent = editor.dom.getParent(newNode, 'td,th'); + var oldParent = editor.dom.getParent(preBrowserNode, 'td,th'); + + return newParent && newParent !== oldParent && checkSameParentTable(newParent, oldParent); + } + + function checkSameParentTable(nodeOne, NodeTwo) { + return editor.dom.getParent(nodeOne, 'TABLE') === editor.dom.getParent(NodeTwo, 'TABLE'); + } + + if (isVerticalMovement() && isInTable(editor)) { + var preBrowserNode = editor.selection.getNode(); + setTimeout(function() { + if (shouldFixCaret(preBrowserNode)) { + handle(!e.shiftKey && key === VK.UP, preBrowserNode, e); + } + }, 0); + } + } + + editor.on('KeyDown', function(e) { + eventHandler(e); + }); + } + + function fixBeforeTableCaretBug() { + // Checks if the selection/caret is at the start of the specified block element + function isAtStart(rng, par) { + var doc = par.ownerDocument, rng2 = doc.createRange(), elm; + + rng2.setStartBefore(par); + rng2.setEnd(rng.endContainer, rng.endOffset); + + elm = doc.createElement('body'); + elm.appendChild(rng2.cloneContents()); + + // Check for text characters of other elements that should be treated as content + return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length === 0; + } + + // Fixes an bug where it's impossible to place the caret before a table in Gecko + // this fix solves it by detecting when the caret is at the beginning of such a table + // and then manually moves the caret infront of the table + editor.on('KeyDown', function(e) { + var rng, table, dom = editor.dom; + + // On gecko it's not possible to place the caret before a table + if (e.keyCode == 37 || e.keyCode == 38) { + rng = editor.selection.getRng(); + table = dom.getParent(rng.startContainer, 'table'); + + if (table && editor.getBody().firstChild == table) { + if (isAtStart(rng, table)) { + rng = dom.createRng(); + + rng.setStartBefore(table); + rng.setEndBefore(table); + + editor.selection.setRng(rng); + + e.preventDefault(); + } + } + } + }); + } + + // Fixes an issue on Gecko where it's impossible to place the caret behind a table + // This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled + function fixTableCaretPos() { + editor.on('KeyDown SetContent VisualAid', function() { + var last; + + // Skip empty text nodes from the end + for (last = editor.getBody().lastChild; last; last = last.previousSibling) { + if (last.nodeType == 3) { + if (last.nodeValue.length > 0) { + break; + } + } else if (last.nodeType == 1 && (last.tagName == 'BR' || !last.getAttribute('data-mce-bogus'))) { + break; + } + } + + if (last && last.nodeName == 'TABLE') { + if (editor.settings.forced_root_block) { + editor.dom.add( + editor.getBody(), + editor.settings.forced_root_block, + editor.settings.forced_root_block_attrs, + Env.ie && Env.ie < 11 ? ' ' : '
    ' + ); + } else { + editor.dom.add(editor.getBody(), 'br', {'data-mce-bogus': '1'}); + } + } + }); + + editor.on('PreProcess', function(o) { + var last = o.node.lastChild; + + if (last && (last.nodeName == "BR" || (last.childNodes.length == 1 && + (last.firstChild.nodeName == 'BR' || last.firstChild.nodeValue == '\u00a0'))) && + last.previousSibling && last.previousSibling.nodeName == "TABLE") { + editor.dom.remove(last); + } + }); + } + + // this nasty hack is here to work around some WebKit selection bugs. + function fixTableCellSelection() { + function tableCellSelected(ed, rng, n, currentCell) { + // The decision of when a table cell is selected is somewhat involved. The fact that this code is + // required is actually a pointer to the root cause of this bug. A cell is selected when the start + // and end offsets are 0, the start container is a text, and the selection node is either a TR (most cases) + // or the parent of the table (in the case of the selection containing the last cell of a table). + var TEXT_NODE = 3, table = ed.dom.getParent(rng.startContainer, 'TABLE'); + var tableParent, allOfCellSelected, tableCellSelection; + + if (table) { + tableParent = table.parentNode; + } + + allOfCellSelected = rng.startContainer.nodeType == TEXT_NODE && + rng.startOffset === 0 && + rng.endOffset === 0 && + currentCell && + (n.nodeName == "TR" || n == tableParent); + + tableCellSelection = (n.nodeName == "TD" || n.nodeName == "TH") && !currentCell; + + return allOfCellSelected || tableCellSelection; + } + + function fixSelection() { + var rng = editor.selection.getRng(); + var n = editor.selection.getNode(); + var currentCell = editor.dom.getParent(rng.startContainer, 'TD,TH'); + + if (!tableCellSelected(editor, rng, n, currentCell)) { + return; + } + + if (!currentCell) { + currentCell = n; + } + + // Get the very last node inside the table cell + var end = currentCell.lastChild; + while (end.lastChild) { + end = end.lastChild; + } + + // Select the entire table cell. Nothing outside of the table cell should be selected. + if (end.nodeType == 3) { + rng.setEnd(end, end.data.length); + editor.selection.setRng(rng); + } + } + + editor.on('KeyDown', function() { + fixSelection(); + }); + + editor.on('MouseDown', function(e) { + if (e.button != 2) { + fixSelection(); + } + }); + } + + /** + * Delete table if all cells are selected. + */ + function deleteTable() { + editor.on('keydown', function(e) { + if ((e.keyCode == VK.DELETE || e.keyCode == VK.BACKSPACE) && !e.isDefaultPrevented()) { + var table = editor.dom.getParent(editor.selection.getStart(), 'table'); + + if (table) { + var cells = editor.dom.select('td,th', table), i = cells.length; + while (i--) { + if (!editor.dom.hasClass(cells[i], 'mce-item-selected')) { + return; + } + } + + e.preventDefault(); + editor.execCommand('mceTableDelete'); + } + } + }); + } + + deleteTable(); + + if (Env.webkit) { + moveWebKitSelection(); + fixTableCellSelection(); + } + + if (Env.gecko) { + fixBeforeTableCaretBug(); + fixTableCaretPos(); + } + + if (Env.ie > 10) { + fixBeforeTableCaretBug(); + fixTableCaretPos(); + } + }; +}); + +// Included from: js/tinymce/plugins/table/classes/CellSelection.js + +/** + * CellSelection.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles table cell selection by faking it using a css class that gets applied + * to cells when dragging the mouse from one cell to another. + * + * @class tinymce.tableplugin.CellSelection + * @private + */ +define("tinymce/tableplugin/CellSelection", [ + "tinymce/tableplugin/TableGrid", + "tinymce/dom/TreeWalker", + "tinymce/util/Tools" +], function(TableGrid, TreeWalker, Tools) { + return function(editor) { + var dom = editor.dom, tableGrid, startCell, startTable, hasCellSelection = true, resizing; + + function clear(force) { + // Restore selection possibilities + editor.getBody().style.webkitUserSelect = ''; + + if (force || hasCellSelection) { + editor.dom.removeClass( + editor.dom.select('td.mce-item-selected,th.mce-item-selected'), + 'mce-item-selected' + ); + + hasCellSelection = false; + } + } + + function cellSelectionHandler(e) { + var sel, table, target = e.target; + + if (resizing) { + return; + } + + if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) { + table = dom.getParent(target, 'table'); + if (table == startTable) { + if (!tableGrid) { + tableGrid = new TableGrid(editor, table); + tableGrid.setStartCell(startCell); + + editor.getBody().style.webkitUserSelect = 'none'; + } + + tableGrid.setEndCell(target); + hasCellSelection = true; + } + + // Remove current selection + sel = editor.selection.getSel(); + + try { + if (sel.removeAllRanges) { + sel.removeAllRanges(); + } else { + sel.empty(); + } + } catch (ex) { + // IE9 might throw errors here + } + + e.preventDefault(); + } + } + + // Add cell selection logic + editor.on('MouseDown', function(e) { + if (e.button != 2 && !resizing) { + clear(); + + startCell = dom.getParent(e.target, 'td,th'); + startTable = dom.getParent(startCell, 'table'); + } + }); + + editor.on('mouseover', cellSelectionHandler); + + editor.on('remove', function() { + dom.unbind(editor.getDoc(), 'mouseover', cellSelectionHandler); + }); + + editor.on('MouseUp', function() { + var rng, sel = editor.selection, selectedCells, walker, node, lastNode; + + function setPoint(node, start) { + var walker = new TreeWalker(node, node); + + do { + // Text node + if (node.nodeType == 3 && Tools.trim(node.nodeValue).length !== 0) { + if (start) { + rng.setStart(node, 0); + } else { + rng.setEnd(node, node.nodeValue.length); + } + + return; + } + + // BR element + if (node.nodeName == 'BR') { + if (start) { + rng.setStartBefore(node); + } else { + rng.setEndBefore(node); + } + + return; + } + } while ((node = (start ? walker.next() : walker.prev()))); + } + + // Move selection to startCell + if (startCell) { + if (tableGrid) { + editor.getBody().style.webkitUserSelect = ''; + } + + // Try to expand text selection as much as we can only Gecko supports cell selection + selectedCells = dom.select('td.mce-item-selected,th.mce-item-selected'); + if (selectedCells.length > 0) { + rng = dom.createRng(); + node = selectedCells[0]; + rng.setStartBefore(node); + rng.setEndAfter(node); + + setPoint(node, 1); + walker = new TreeWalker(node, dom.getParent(selectedCells[0], 'table')); + + do { + if (node.nodeName == 'TD' || node.nodeName == 'TH') { + if (!dom.hasClass(node, 'mce-item-selected')) { + break; + } + + lastNode = node; + } + } while ((node = walker.next())); + + setPoint(lastNode); + + sel.setRng(rng); + } + + editor.nodeChanged(); + startCell = tableGrid = startTable = null; + } + }); + + editor.on('KeyUp Drop SetContent', function(e) { + clear(e.type == 'setcontent'); + startCell = tableGrid = startTable = null; + resizing = false; + }); + + editor.on('ObjectResizeStart ObjectResized', function(e) { + resizing = e.type != 'objectresized'; + }); + + return { + clear: clear + }; + }; +}); + +// Included from: js/tinymce/plugins/table/classes/Dialogs.js + +/** + * Dialogs.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*eslint dot-notation:0*/ + +/** + * ... + * + * @class tinymce.tableplugin.Dialogs + * @private + */ +define("tinymce/tableplugin/Dialogs", [ + "tinymce/util/Tools", + "tinymce/Env" +], function(Tools, Env) { + var each = Tools.each; + + return function(editor) { + var self = this; + + function createColorPickAction() { + var colorPickerCallback = editor.settings.color_picker_callback; + + if (colorPickerCallback) { + return function() { + var self = this; + + colorPickerCallback.call( + editor, + function(value) { + self.value(value).fire('change'); + }, + self.value() + ); + }; + } + } + + function createStyleForm(dom) { + return { + title: 'Advanced', + type: 'form', + defaults: { + onchange: function() { + updateStyle(dom, this.parents().reverse()[0], this.name() == "style"); + } + }, + items: [ + { + label: 'Style', + name: 'style', + type: 'textbox' + }, + + { + type: 'form', + padding: 0, + formItemDefaults: { + layout: 'grid', + alignH: ['start', 'right'] + }, + defaults: { + size: 7 + }, + items: [ + { + label: 'Border color', + type: 'colorbox', + name: 'borderColor', + onaction: createColorPickAction() + }, + + { + label: 'Background color', + type: 'colorbox', + name: 'backgroundColor', + onaction: createColorPickAction() + } + ] + } + ] + }; + } + + function removePxSuffix(size) { + return size ? size.replace(/px$/, '') : ""; + } + + function addSizeSuffix(size) { + if (/^[0-9]+$/.test(size)) { + size += "px"; + } + + return size; + } + + function unApplyAlign(elm) { + each('left center right'.split(' '), function(name) { + editor.formatter.remove('align' + name, {}, elm); + }); + } + + function unApplyVAlign(elm) { + each('top middle bottom'.split(' '), function(name) { + editor.formatter.remove('valign' + name, {}, elm); + }); + } + + function buildListItems(inputList, itemCallback, startItems) { + function appendItems(values, output) { + output = output || []; + + Tools.each(values, function(item) { + var menuItem = {text: item.text || item.title}; + + if (item.menu) { + menuItem.menu = appendItems(item.menu); + } else { + menuItem.value = item.value; + + if (itemCallback) { + itemCallback(menuItem); + } + } + + output.push(menuItem); + }); + + return output; + } + + return appendItems(inputList, startItems || []); + } + + function updateStyle(dom, win, isStyleCtrl) { + var data = win.toJSON(); + var css = dom.parseStyle(data.style); + + if (isStyleCtrl) { + win.find('#borderColor').value(css["border-color"] || '')[0].fire('change'); + win.find('#backgroundColor').value(css["background-color"] || '')[0].fire('change'); + } else { + css["border-color"] = data.borderColor; + css["background-color"] = data.backgroundColor; + } + + win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css)))); + } + + function appendStylesToData(dom, data, elm) { + var css = dom.parseStyle(dom.getAttrib(elm, 'style')); + + if (css["border-color"]) { + data.borderColor = css["border-color"]; + } + + if (css["background-color"]) { + data.backgroundColor = css["background-color"]; + } + + data.style = dom.serializeStyle(css); + } + + function mergeStyles(dom, elm, styles) { + var css = dom.parseStyle(dom.getAttrib(elm, 'style')); + + each(styles, function(style) { + css[style.name] = style.value; + }); + + dom.setAttrib(elm, 'style', dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css)))); + } + + self.tableProps = function() { + self.table(true); + }; + + self.table = function(isProps) { + var dom = editor.dom, tableElm, colsCtrl, rowsCtrl, classListCtrl, data = {}, generalTableForm, stylesToMerge; + + function onSubmitTableForm() { + + //Explore the layers of the table till we find the first layer of tds or ths + function styleTDTH (elm, name, value) { + if (elm.tagName === "TD" || elm.tagName === "TH") { + dom.setStyle(elm, name, value); + } else { + if (elm.children) { + for (var i = 0; i < elm.children.length; i++) { + styleTDTH(elm.children[i], name, value); + } + } + } + } + + var captionElm; + + updateStyle(dom, this); + data = Tools.extend(data, this.toJSON()); + + if (data["class"] === false) { + delete data["class"]; + } + + editor.undoManager.transact(function() { + if (!tableElm) { + tableElm = editor.plugins.table.insertTable(data.cols || 1, data.rows || 1); + } + + editor.dom.setAttribs(tableElm, { + style: data.style, + 'class': data['class'] + }); + + if (editor.settings.table_style_by_css) { + stylesToMerge = []; + stylesToMerge.push({name: 'border', value: data.border}); + stylesToMerge.push({name: 'border-spacing', value: addSizeSuffix(data.cellspacing)}); + mergeStyles(dom, tableElm, stylesToMerge); + dom.setAttribs(tableElm, { + 'data-mce-border-color': data.borderColor, + 'data-mce-cell-padding': data.cellpadding, + 'data-mce-border': data.border + }); + if (tableElm.children) { + for (var i = 0; i < tableElm.children.length; i++) { + styleTDTH(tableElm.children[i], 'border', data.border); + styleTDTH(tableElm.children[i], 'padding', addSizeSuffix(data.cellpadding)); + } + } + } else { + editor.dom.setAttribs(tableElm, { + border: data.border, + cellpadding: data.cellpadding, + cellspacing: data.cellspacing + }); + } + + if (dom.getAttrib(tableElm, 'width') && !editor.settings.table_style_by_css) { + dom.setAttrib(tableElm, 'width', removePxSuffix(data.width)); + } else { + dom.setStyle(tableElm, 'width', addSizeSuffix(data.width)); + } + + dom.setStyle(tableElm, 'height', addSizeSuffix(data.height)); + + // Toggle caption on/off + captionElm = dom.select('caption', tableElm)[0]; + + if (captionElm && !data.caption) { + dom.remove(captionElm); + } + + if (!captionElm && data.caption) { + captionElm = dom.create('caption'); + captionElm.innerHTML = !Env.ie ? '
    ' : '\u00a0'; + tableElm.insertBefore(captionElm, tableElm.firstChild); + } + unApplyAlign(tableElm); + if (data.align) { + editor.formatter.apply('align' + data.align, {}, tableElm); + } + + editor.focus(); + editor.addVisual(); + }); + } + + function getTDTHOverallStyle (elm, name) { + var cells = editor.dom.select("td,th", elm), firstChildStyle; + + function checkChildren(firstChildStyle, elms) { + + for (var i = 0; i < elms.length; i++) { + var currentStyle = dom.getStyle(elms[i], name); + if (typeof firstChildStyle === "undefined") { + firstChildStyle = currentStyle; + } + if (firstChildStyle != currentStyle) { + return ""; + } + } + + return firstChildStyle; + + } + + firstChildStyle = checkChildren(firstChildStyle, cells); + + return firstChildStyle; + } + + if (isProps === true) { + tableElm = dom.getParent(editor.selection.getStart(), 'table'); + + if (tableElm) { + data = { + width: removePxSuffix(dom.getStyle(tableElm, 'width') || dom.getAttrib(tableElm, 'width')), + height: removePxSuffix(dom.getStyle(tableElm, 'height') || dom.getAttrib(tableElm, 'height')), + cellspacing: removePxSuffix(dom.getStyle(tableElm, 'border-spacing') || + dom.getAttrib(tableElm, 'cellspacing')), + cellpadding: dom.getAttrib(tableElm, 'data-mce-cell-padding') || dom.getAttrib(tableElm, 'cellpadding') || + getTDTHOverallStyle(tableElm, 'padding'), + border: dom.getAttrib(tableElm, 'data-mce-border') || dom.getAttrib(tableElm, 'border') || + getTDTHOverallStyle(tableElm, 'border'), + borderColor: dom.getAttrib(tableElm, 'data-mce-border-color'), + caption: !!dom.select('caption', tableElm)[0], + 'class': dom.getAttrib(tableElm, 'class') + }; + + each('left center right'.split(' '), function(name) { + if (editor.formatter.matchNode(tableElm, 'align' + name)) { + data.align = name; + } + }); + } + } else { + colsCtrl = {label: 'Cols', name: 'cols'}; + rowsCtrl = {label: 'Rows', name: 'rows'}; + } + + if (editor.settings.table_class_list) { + if (data["class"]) { + data["class"] = data["class"].replace(/\s*mce\-item\-table\s*/g, ''); + } + + classListCtrl = { + name: 'class', + type: 'listbox', + label: 'Class', + values: buildListItems( + editor.settings.table_class_list, + function(item) { + if (item.value) { + item.textStyle = function() { + return editor.formatter.getCssText({block: 'table', classes: [item.value]}); + }; + } + } + ) + }; + } + + generalTableForm = { + type: 'form', + layout: 'flex', + direction: 'column', + labelGapCalc: 'children', + padding: 0, + items: [ + { + type: 'form', + labelGapCalc: false, + padding: 0, + layout: 'grid', + columns: 2, + defaults: { + type: 'textbox', + maxWidth: 50 + }, + items: (editor.settings.table_appearance_options !== false) ? [ + colsCtrl, + rowsCtrl, + {label: 'Width', name: 'width'}, + {label: 'Height', name: 'height'}, + {label: 'Cell spacing', name: 'cellspacing'}, + {label: 'Cell padding', name: 'cellpadding'}, + {label: 'Border', name: 'border'}, + {label: 'Caption', name: 'caption', type: 'checkbox'} + ] : [ + colsCtrl, + rowsCtrl, + {label: 'Width', name: 'width'}, + {label: 'Height', name: 'height'} + ] + }, + + { + label: 'Alignment', + name: 'align', + type: 'listbox', + text: 'None', + values: [ + {text: 'None', value: ''}, + {text: 'Left', value: 'left'}, + {text: 'Center', value: 'center'}, + {text: 'Right', value: 'right'} + ] + }, + + classListCtrl + ] + }; + + if (editor.settings.table_advtab !== false) { + appendStylesToData(dom, data, tableElm); + + editor.windowManager.open({ + title: "Table properties", + data: data, + bodyType: 'tabpanel', + body: [ + { + title: 'General', + type: 'form', + items: generalTableForm + }, + createStyleForm(dom) + ], + + onsubmit: onSubmitTableForm + }); + } else { + editor.windowManager.open({ + title: "Table properties", + data: data, + body: generalTableForm, + onsubmit: onSubmitTableForm + }); + } + }; + + self.merge = function(grid, cell) { + editor.windowManager.open({ + title: "Merge cells", + body: [ + {label: 'Cols', name: 'cols', type: 'textbox', value: '1', size: 10}, + {label: 'Rows', name: 'rows', type: 'textbox', value: '1', size: 10} + ], + onsubmit: function() { + var data = this.toJSON(); + + editor.undoManager.transact(function() { + grid.merge(cell, data.cols, data.rows); + }); + } + }); + }; + + self.cell = function() { + var dom = editor.dom, cellElm, data, classListCtrl, cells = []; + + function onSubmitCellForm() { + updateStyle(dom, this); + data = Tools.extend(data, this.toJSON()); + + editor.undoManager.transact(function() { + each(cells, function(cellElm) { + editor.dom.setAttribs(cellElm, { + scope: data.scope, + style: data.style, + 'class': data['class'] + }); + + editor.dom.setStyles(cellElm, { + width: addSizeSuffix(data.width), + height: addSizeSuffix(data.height) + }); + + // Switch cell type + if (data.type && cellElm.nodeName.toLowerCase() != data.type) { + cellElm = dom.rename(cellElm, data.type); + } + + // Apply/remove alignment + unApplyAlign(cellElm); + if (data.align) { + editor.formatter.apply('align' + data.align, {}, cellElm); + } + + // Apply/remove vertical alignment + unApplyVAlign(cellElm); + if (data.valign) { + editor.formatter.apply('valign' + data.valign, {}, cellElm); + } + }); + + editor.focus(); + }); + } + + // Get selected cells or the current cell + cells = editor.dom.select('td.mce-item-selected,th.mce-item-selected'); + cellElm = editor.dom.getParent(editor.selection.getStart(), 'td,th'); + if (!cells.length && cellElm) { + cells.push(cellElm); + } + + cellElm = cellElm || cells[0]; + + if (!cellElm) { + // If this element is null, return now to avoid crashing. + return; + } + + data = { + width: removePxSuffix(dom.getStyle(cellElm, 'width') || dom.getAttrib(cellElm, 'width')), + height: removePxSuffix(dom.getStyle(cellElm, 'height') || dom.getAttrib(cellElm, 'height')), + scope: dom.getAttrib(cellElm, 'scope'), + 'class': dom.getAttrib(cellElm, 'class') + }; + + data.type = cellElm.nodeName.toLowerCase(); + + each('left center right'.split(' '), function(name) { + if (editor.formatter.matchNode(cellElm, 'align' + name)) { + data.align = name; + } + }); + + each('top middle bottom'.split(' '), function(name) { + if (editor.formatter.matchNode(cellElm, 'valign' + name)) { + data.valign = name; + } + }); + + if (editor.settings.table_cell_class_list) { + classListCtrl = { + name: 'class', + type: 'listbox', + label: 'Class', + values: buildListItems( + editor.settings.table_cell_class_list, + function(item) { + if (item.value) { + item.textStyle = function() { + return editor.formatter.getCssText({block: 'td', classes: [item.value]}); + }; + } + } + ) + }; + } + + var generalCellForm = { + type: 'form', + layout: 'flex', + direction: 'column', + labelGapCalc: 'children', + padding: 0, + items: [ + { + type: 'form', + layout: 'grid', + columns: 2, + labelGapCalc: false, + padding: 0, + defaults: { + type: 'textbox', + maxWidth: 50 + }, + items: [ + {label: 'Width', name: 'width'}, + {label: 'Height', name: 'height'}, + { + label: 'Cell type', + name: 'type', + type: 'listbox', + text: 'None', + minWidth: 90, + maxWidth: null, + values: [ + {text: 'Cell', value: 'td'}, + {text: 'Header cell', value: 'th'} + ] + }, + { + label: 'Scope', + name: 'scope', + type: 'listbox', + text: 'None', + minWidth: 90, + maxWidth: null, + values: [ + {text: 'None', value: ''}, + {text: 'Row', value: 'row'}, + {text: 'Column', value: 'col'}, + {text: 'Row group', value: 'rowgroup'}, + {text: 'Column group', value: 'colgroup'} + ] + }, + { + label: 'H Align', + name: 'align', + type: 'listbox', + text: 'None', + minWidth: 90, + maxWidth: null, + values: [ + {text: 'None', value: ''}, + {text: 'Left', value: 'left'}, + {text: 'Center', value: 'center'}, + {text: 'Right', value: 'right'} + ] + }, + { + label: 'V Align', + name: 'valign', + type: 'listbox', + text: 'None', + minWidth: 90, + maxWidth: null, + values: [ + {text: 'None', value: ''}, + {text: 'Top', value: 'top'}, + {text: 'Middle', value: 'middle'}, + {text: 'Bottom', value: 'bottom'} + ] + } + ] + }, + + classListCtrl + ] + }; + + if (editor.settings.table_cell_advtab !== false) { + appendStylesToData(dom, data, cellElm); + + editor.windowManager.open({ + title: "Cell properties", + bodyType: 'tabpanel', + data: data, + body: [ + { + title: 'General', + type: 'form', + items: generalCellForm + }, + + createStyleForm(dom) + ], + + onsubmit: onSubmitCellForm + }); + } else { + editor.windowManager.open({ + title: "Cell properties", + data: data, + body: generalCellForm, + onsubmit: onSubmitCellForm + }); + } + }; + + self.row = function() { + var dom = editor.dom, tableElm, cellElm, rowElm, classListCtrl, data, rows = [], generalRowForm; + + function onSubmitRowForm() { + var tableElm, oldParentElm, parentElm; + + updateStyle(dom, this); + data = Tools.extend(data, this.toJSON()); + + editor.undoManager.transact(function() { + var toType = data.type; + + each(rows, function(rowElm) { + editor.dom.setAttribs(rowElm, { + scope: data.scope, + style: data.style, + 'class': data['class'] + }); + + editor.dom.setStyles(rowElm, { + height: addSizeSuffix(data.height) + }); + + if (toType != rowElm.parentNode.nodeName.toLowerCase()) { + tableElm = dom.getParent(rowElm, 'table'); + + oldParentElm = rowElm.parentNode; + parentElm = dom.select(toType, tableElm)[0]; + if (!parentElm) { + parentElm = dom.create(toType); + if (tableElm.firstChild) { + tableElm.insertBefore(parentElm, tableElm.firstChild); + } else { + tableElm.appendChild(parentElm); + } + } + + parentElm.appendChild(rowElm); + + if (!oldParentElm.hasChildNodes()) { + dom.remove(oldParentElm); + } + } + + // Apply/remove alignment + unApplyAlign(rowElm); + if (data.align) { + editor.formatter.apply('align' + data.align, {}, rowElm); + } + }); + + editor.focus(); + }); + } + + tableElm = editor.dom.getParent(editor.selection.getStart(), 'table'); + cellElm = editor.dom.getParent(editor.selection.getStart(), 'td,th'); + + each(tableElm.rows, function(row) { + each(row.cells, function(cell) { + if (dom.hasClass(cell, 'mce-item-selected') || cell == cellElm) { + rows.push(row); + return false; + } + }); + }); + + rowElm = rows[0]; + if (!rowElm) { + // If this element is null, return now to avoid crashing. + return; + } + + data = { + height: removePxSuffix(dom.getStyle(rowElm, 'height') || dom.getAttrib(rowElm, 'height')), + scope: dom.getAttrib(rowElm, 'scope'), + 'class': dom.getAttrib(rowElm, 'class') + }; + + data.type = rowElm.parentNode.nodeName.toLowerCase(); + + each('left center right'.split(' '), function(name) { + if (editor.formatter.matchNode(rowElm, 'align' + name)) { + data.align = name; + } + }); + + if (editor.settings.table_row_class_list) { + classListCtrl = { + name: 'class', + type: 'listbox', + label: 'Class', + values: buildListItems( + editor.settings.table_row_class_list, + function(item) { + if (item.value) { + item.textStyle = function() { + return editor.formatter.getCssText({block: 'tr', classes: [item.value]}); + }; + } + } + ) + }; + } + + generalRowForm = { + type: 'form', + columns: 2, + padding: 0, + defaults: { + type: 'textbox' + }, + items: [ + { + type: 'listbox', + name: 'type', + label: 'Row type', + text: 'None', + maxWidth: null, + values: [ + {text: 'Header', value: 'thead'}, + {text: 'Body', value: 'tbody'}, + {text: 'Footer', value: 'tfoot'} + ] + }, + { + type: 'listbox', + name: 'align', + label: 'Alignment', + text: 'None', + maxWidth: null, + values: [ + {text: 'None', value: ''}, + {text: 'Left', value: 'left'}, + {text: 'Center', value: 'center'}, + {text: 'Right', value: 'right'} + ] + }, + {label: 'Height', name: 'height'}, + classListCtrl + ] + }; + + if (editor.settings.table_row_advtab !== false) { + appendStylesToData(dom, data, rowElm); + + editor.windowManager.open({ + title: "Row properties", + data: data, + bodyType: 'tabpanel', + body: [ + { + title: 'General', + type: 'form', + items: generalRowForm + }, + createStyleForm(dom) + ], + + onsubmit: onSubmitRowForm + }); + } else { + editor.windowManager.open({ + title: "Row properties", + data: data, + body: generalRowForm, + onsubmit: onSubmitRowForm + }); + } + }; + }; +}); + +// Included from: js/tinymce/plugins/table/classes/Plugin.js + +/** + * Plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class contains all core logic for the table plugin. + * + * @class tinymce.tableplugin.Plugin + * @private + */ +define("tinymce/tableplugin/Plugin", [ + "tinymce/tableplugin/TableGrid", + "tinymce/tableplugin/Quirks", + "tinymce/tableplugin/CellSelection", + "tinymce/tableplugin/Dialogs", + "tinymce/util/Tools", + "tinymce/dom/TreeWalker", + "tinymce/Env", + "tinymce/PluginManager" +], function(TableGrid, Quirks, CellSelection, Dialogs, Tools, TreeWalker, Env, PluginManager) { + var each = Tools.each; + + function Plugin(editor) { + var clipboardRows, self = this, dialogs = new Dialogs(editor); + + function cmd(command) { + return function() { + editor.execCommand(command); + }; + } + + function insertTable(cols, rows) { + var y, x, html, tableElm; + + html = ''; + + for (y = 0; y < rows; y++) { + html += ''; + + for (x = 0; x < cols; x++) { + html += ''; + } + + html += ''; + } + + html += '
    ' + (Env.ie ? " " : '
    ') + '
    '; + + editor.undoManager.transact(function() { + editor.insertContent(html); + + tableElm = editor.dom.get('__mce'); + editor.dom.setAttrib(tableElm, 'id', null); + + editor.dom.setAttribs(tableElm, editor.settings.table_default_attributes || {}); + editor.dom.setStyles(tableElm, editor.settings.table_default_styles || {}); + }); + + return tableElm; + } + + function handleDisabledState(ctrl, selector) { + function bindStateListener() { + ctrl.disabled(!editor.dom.getParent(editor.selection.getStart(), selector)); + + editor.selection.selectorChanged(selector, function(state) { + ctrl.disabled(!state); + }); + } + + if (editor.initialized) { + bindStateListener(); + } else { + editor.on('init', bindStateListener); + } + } + + function postRender() { + /*jshint validthis:true*/ + handleDisabledState(this, 'table'); + } + + function postRenderCell() { + /*jshint validthis:true*/ + handleDisabledState(this, 'td,th'); + } + + function generateTableGrid() { + var html = ''; + + html = ''; + + for (var y = 0; y < 10; y++) { + html += ''; + + for (var x = 0; x < 10; x++) { + html += ''; + } + + html += ''; + } + + html += '
    '; + + html += ''; + + return html; + } + + function selectGrid(tx, ty, control) { + var table = control.getEl().getElementsByTagName('table')[0]; + var x, y, focusCell, cell, active; + var rtl = control.isRtl() || control.parent().rel == 'tl-tr'; + + table.nextSibling.innerHTML = (tx + 1) + ' x ' + (ty + 1); + + if (rtl) { + tx = 9 - tx; + } + + for (y = 0; y < 10; y++) { + for (x = 0; x < 10; x++) { + cell = table.rows[y].childNodes[x].firstChild; + active = (rtl ? x >= tx : x <= tx) && y <= ty; + + editor.dom.toggleClass(cell, 'mce-active', active); + + if (active) { + focusCell = cell; + } + } + } + + return focusCell.parentNode; + } + + if (editor.settings.table_grid === false) { + editor.addMenuItem('inserttable', { + text: 'Insert table', + icon: 'table', + context: 'table', + onclick: dialogs.table + }); + } else { + editor.addMenuItem('inserttable', { + text: 'Insert table', + icon: 'table', + context: 'table', + ariaHideMenu: true, + onclick: function(e) { + if (e.aria) { + this.parent().hideAll(); + e.stopImmediatePropagation(); + dialogs.table(); + } + }, + onshow: function() { + selectGrid(0, 0, this.menu.items()[0]); + }, + onhide: function() { + var elements = this.menu.items()[0].getEl().getElementsByTagName('a'); + editor.dom.removeClass(elements, 'mce-active'); + editor.dom.addClass(elements[0], 'mce-active'); + }, + menu: [ + { + type: 'container', + html: generateTableGrid(), + + onPostRender: function() { + this.lastX = this.lastY = 0; + }, + + onmousemove: function(e) { + var target = e.target, x, y; + + if (target.tagName.toUpperCase() == 'A') { + x = parseInt(target.getAttribute('data-mce-x'), 10); + y = parseInt(target.getAttribute('data-mce-y'), 10); + + if (this.isRtl() || this.parent().rel == 'tl-tr') { + x = 9 - x; + } + + if (x !== this.lastX || y !== this.lastY) { + selectGrid(x, y, e.control); + + this.lastX = x; + this.lastY = y; + } + } + }, + + onclick: function(e) { + var self = this; + + if (e.target.tagName.toUpperCase() == 'A') { + e.preventDefault(); + e.stopPropagation(); + self.parent().cancel(); + + editor.undoManager.transact(function() { + insertTable(self.lastX + 1, self.lastY + 1); + }); + + editor.addVisual(); + } + } + } + ] + }); + } + + editor.addMenuItem('tableprops', { + text: 'Table properties', + context: 'table', + onPostRender: postRender, + onclick: dialogs.tableProps + }); + + editor.addMenuItem('deletetable', { + text: 'Delete table', + context: 'table', + onPostRender: postRender, + cmd: 'mceTableDelete' + }); + + editor.addMenuItem('cell', { + separator: 'before', + text: 'Cell', + context: 'table', + menu: [ + {text: 'Cell properties', onclick: cmd('mceTableCellProps'), onPostRender: postRenderCell}, + {text: 'Merge cells', onclick: cmd('mceTableMergeCells'), onPostRender: postRenderCell}, + {text: 'Split cell', onclick: cmd('mceTableSplitCells'), onPostRender: postRenderCell} + ] + }); + + editor.addMenuItem('row', { + text: 'Row', + context: 'table', + menu: [ + {text: 'Insert row before', onclick: cmd('mceTableInsertRowBefore'), onPostRender: postRenderCell}, + {text: 'Insert row after', onclick: cmd('mceTableInsertRowAfter'), onPostRender: postRenderCell}, + {text: 'Delete row', onclick: cmd('mceTableDeleteRow'), onPostRender: postRenderCell}, + {text: 'Row properties', onclick: cmd('mceTableRowProps'), onPostRender: postRenderCell}, + {text: '-'}, + {text: 'Cut row', onclick: cmd('mceTableCutRow'), onPostRender: postRenderCell}, + {text: 'Copy row', onclick: cmd('mceTableCopyRow'), onPostRender: postRenderCell}, + {text: 'Paste row before', onclick: cmd('mceTablePasteRowBefore'), onPostRender: postRenderCell}, + {text: 'Paste row after', onclick: cmd('mceTablePasteRowAfter'), onPostRender: postRenderCell} + ] + }); + + editor.addMenuItem('column', { + text: 'Column', + context: 'table', + menu: [ + {text: 'Insert column before', onclick: cmd('mceTableInsertColBefore'), onPostRender: postRenderCell}, + {text: 'Insert column after', onclick: cmd('mceTableInsertColAfter'), onPostRender: postRenderCell}, + {text: 'Delete column', onclick: cmd('mceTableDeleteCol'), onPostRender: postRenderCell} + ] + }); + + var menuItems = []; + each("inserttable tableprops deletetable | cell row column".split(' '), function(name) { + if (name == '|') { + menuItems.push({text: '-'}); + } else { + menuItems.push(editor.menuItems[name]); + } + }); + + editor.addButton("table", { + type: "menubutton", + title: "Table", + menu: menuItems + }); + + // Select whole table is a table border is clicked + if (!Env.isIE) { + editor.on('click', function(e) { + e = e.target; + + if (e.nodeName === 'TABLE') { + editor.selection.select(e); + editor.nodeChanged(); + } + }); + } + + self.quirks = new Quirks(editor); + + editor.on('Init', function() { + self.cellSelection = new CellSelection(editor); + }); + + editor.on('PreInit', function() { + // Remove internal data attributes + editor.serializer.addAttributeFilter( + 'data-mce-cell-padding,data-mce-border,data-mce-border-color', + function(nodes, name) { + + var i = nodes.length; + + while (i--) { + nodes[i].attr(name, null); + } + }); + }); + + // Register action commands + each({ + mceTableSplitCells: function(grid) { + grid.split(); + }, + + mceTableMergeCells: function(grid) { + var cell; + + cell = editor.dom.getParent(editor.selection.getStart(), 'th,td'); + + if (!editor.dom.select('td.mce-item-selected,th.mce-item-selected').length) { + dialogs.merge(grid, cell); + } else { + grid.merge(); + } + }, + + mceTableInsertRowBefore: function(grid) { + grid.insertRow(true); + }, + + mceTableInsertRowAfter: function(grid) { + grid.insertRow(); + }, + + mceTableInsertColBefore: function(grid) { + grid.insertCol(true); + }, + + mceTableInsertColAfter: function(grid) { + grid.insertCol(); + }, + + mceTableDeleteCol: function(grid) { + grid.deleteCols(); + }, + + mceTableDeleteRow: function(grid) { + grid.deleteRows(); + }, + + mceTableCutRow: function(grid) { + clipboardRows = grid.cutRows(); + }, + + mceTableCopyRow: function(grid) { + clipboardRows = grid.copyRows(); + }, + + mceTablePasteRowBefore: function(grid) { + grid.pasteRows(clipboardRows, true); + }, + + mceTablePasteRowAfter: function(grid) { + grid.pasteRows(clipboardRows); + }, + + mceTableDelete: function(grid) { + grid.deleteTable(); + } + }, function(func, name) { + editor.addCommand(name, function() { + var grid = new TableGrid(editor); + + if (grid) { + func(grid); + editor.execCommand('mceRepaint'); + self.cellSelection.clear(); + } + }); + }); + + // Register dialog commands + each({ + mceInsertTable: dialogs.table, + mceTableProps: function() { + dialogs.table(true); + }, + mceTableRowProps: dialogs.row, + mceTableCellProps: dialogs.cell + }, function(func, name) { + editor.addCommand(name, function(ui, val) { + func(val); + }); + }); + + // Enable tab key cell navigation + if (editor.settings.table_tab_navigation !== false) { + editor.on('keydown', function(e) { + var cellElm, grid, delta; + + if (e.keyCode == 9) { + cellElm = editor.dom.getParent(editor.selection.getStart(), 'th,td'); + + if (cellElm) { + e.preventDefault(); + + grid = new TableGrid(editor); + delta = e.shiftKey ? -1 : 1; + + editor.undoManager.transact(function() { + if (!grid.moveRelIdx(cellElm, delta) && delta > 0) { + grid.insertRow(); + grid.refresh(); + grid.moveRelIdx(cellElm, delta); + } + }); + } + } + }); + } + + self.insertTable = insertTable; + } + + PluginManager.add('table', Plugin); +}); +})(this); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/table/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +(function(b,g){var d={};function c(m,n){var l,j=[];for(var k=0;k "+U+" tr",O);l(V,function(W,X){X+=T;l(M.select("> td, > th",W),function(ad,Y){var Z,aa,ab,ac;if(n[X]){while(n[X][Y]){Y++}}ab=i(ad,"rowspan");ac=i(ad,"colspan");for(aa=X;aa'}return false}},"childNodes");T=G(T,false);A(T,"rowSpan",1);A(T,"colSpan",1);if(V){T.appendChild(V)}else{if(!j.ie||j.ie>10){T.innerHTML='
    '}}return T}function y(){var T=M.createRng(),U;l(M.select("tr",O),function(V){if(V.cells.length===0){M.remove(V)}});if(M.select("tr",O).length===0){T.setStartBefore(O);T.setEndBefore(O);R.setRng(T);M.remove(O);return}l(M.select("thead,tbody,tfoot",O),function(V){if(V.rows.length===0){M.remove(V)}});B();if(S){U=n[Math.min(n.length-1,S.y)];if(U){R.select(U[Math.min(U.length-1,S.x)].elm,true);R.collapse(true)}}}function C(Z,X,ab,Y){var W,U,T,V,aa;W=n[X][Z].elm.parentNode;for(T=1;T<=ab;T++){W=M.getNext(W,"tr");if(W){for(U=Z;U>=0;U--){aa=n[X+T][U].elm;if(aa.parentNode==W){for(V=1;V<=Y;V++){M.insertAfter(m(aa),aa)}break}}if(U==-1){for(V=1;V<=Y;V++){W.insertBefore(m(W.cells[0]),W.cells[0])}}}}}function I(){l(n,function(T,U){l(T,function(W,V){var Z,Y,X;if(p(W)){W=W.elm;Z=i(W,"colspan");Y=i(W,"rowspan");if(Z>1||Y>1){A(W,"rowSpan",1);A(W,"colSpan",1);for(X=0;X1){A(Z,"rowSpan",V+1);continue}}else{if(T>0&&n[T-1][Y]){ac=n[T-1][Y].elm;V=i(ac,"rowSpan");if(V>1){A(ac,"rowSpan",V+1);continue}}}U=m(Z);A(U,"colSpan",Z.colSpan);ab.appendChild(U);W=Z}}if(ab.hasChildNodes()){if(!X){M.insertAfter(ab,aa)}else{aa.parentNode.insertBefore(ab,aa)}}}function o(U){var V,T;l(n,function(W){l(W,function(Y,X){if(p(Y)){V=X;if(U){return false}}});if(U){return !V}});l(n,function(Z,aa){var W,X,Y;if(!Z[V]){return}W=Z[V].elm;if(W!=T){Y=i(W,"colspan");X=i(W,"rowspan");if(Y==1){if(!U){M.insertAfter(m(W),W);C(V,aa,X-1,Y)}else{W.parentNode.insertBefore(m(W),W);C(V,aa,X-1,Y)}}else{A(W,"colSpan",W.colSpan+1)}T=W}})}function u(){var T=[];l(n,function(U){l(U,function(W,V){if(p(W)&&k.inArray(T,V)===-1){l(n,function(Z){var X=Z[V].elm,Y;Y=i(X,"colSpan");if(Y>1){A(X,"colSpan",Y-1)}else{M.remove(X)}});T.push(V)}})});y()}function t(){var U;function T(W){var X,V;l(W.cells,function(Y){var Z=i(Y,"rowSpan");if(Z>1){A(Y,"rowSpan",Z-1);X=L(Y);C(X.x,X.y,1,1)}});X=L(W.cells[0]);l(n[X.y],function(Y){var Z;Y=Y.elm;if(Y!=V){Z=i(Y,"rowSpan");if(Z<=1){M.remove(Y)}else{A(Y,"rowSpan",Z-1)}V=Y}})}U=r();l(U.reverse(),function(V){T(V)});y()}function K(){var T=r();M.remove(T);y();return T}function Q(){var T=r();l(T,function(V,U){T[U]=G(V,true)});return T}function H(V,U){var W=r(),T=W[U?0:W.length-1],X=T.cells.length;if(!V){return}l(n,function(Z){var Y;X=0;l(Z,function(aa){if(aa.real){X+=aa.colspan}if(aa.elm.parentNode==T){Y=1}});if(Y){return false}});if(!U){V.reverse()}l(V,function(ab){var Z,aa=ab.cells.length,Y;for(Z=0;ZU){U=X}if(W>T){T=W}if(Y.real){aa=Y.colspan-1;Z=Y.rowspan-1;if(aa){if(X+aa>U){U=X+aa}}if(Z){if(W+Z>T){T=W+Z}}}}})});return{x:U,y:T}}function D(ab){var W,V,ad,ac,U,T,X,Y,aa,Z;J=L(ab);if(S&&J){W=Math.min(S.x,J.x);V=Math.min(S.y,J.y);ad=Math.max(S.x,J.x);ac=Math.max(S.y,J.y);U=ad;T=ac;for(Z=V;Z<=T;Z++){ab=n[Z][W];if(!ab.real){if(W-(ab.colspan-1)U){U=aa+X}}if(Y){if(Z+Y>T){T=Z+Y}}}}}M.removeClass(M.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected");for(Z=V;Z<=T;Z++){for(aa=W;aa<=U;aa++){if(n[Z][aa]){M.addClass(n[Z][aa].elm,"mce-item-selected")}}}}}function q(V,X){var W,U,T;W=L(V);U=W.y*N+W.x;do{U+=X;T=F(U%N,Math.floor(U/N));if(!T){break}if(T.elm!=V){R.select(T.elm,true);if(M.isEmpty(T.elm)){R.collapse(true)}return true}}while(T.elm==V);return false}O=O||M.getParent(R.getStart(),"table");B();w=M.getParent(R.getStart(),"th,td");if(w){S=L(w);J=P();w=F(S.x,S.y)}k.extend(this,{deleteTable:z,split:I,merge:x,insertRow:s,insertCol:o,deleteCols:u,deleteRows:t,cutRows:K,copyRows:Q,pasteRows:H,getPos:L,setStartCell:E,setEndCell:D,moveRelIdx:q,refresh:B})}});h("tinymce/tableplugin/Quirks",["tinymce/util/VK","tinymce/Env","tinymce/util/Tools"],function(m,j,k){var l=k.each;function i(o,n){return parseInt(o.getAttribute(n)||1,10)}return function(r){function s(){function t(C){var I=C.keyCode;function A(R,N){var M=R?"previousSibling":"nextSibling";var S=r.dom.getParent(N,"tr");var Q=S[M];if(Q){E(r,N,Q,R);C.preventDefault();return true}else{var T=r.dom.getParent(S,"table");var P=S.parentNode;var L=P.nodeName.toLowerCase();if(L==="tbody"||L===(R?"tfoot":"thead")){var O=v(R,T,P,"tbody");if(O!==null){return x(R,O,N)}}return H(R,S,M,T)}}function v(P,N,O,R){var M=r.dom.select(">"+R,N);var L=M.indexOf(O);if(P&&L===0||!P&&L===M.length-1){return y(P,N)}else{if(L===-1){var Q=O.tagName.toLowerCase()==="thead"?0:M.length-1;return M[Q]}else{return M[L+(P?-1:1)]}}}function y(O,N){var M=O?"thead":"tfoot";var L=r.dom.select(">"+M,N);return L.length!==0?L[0]:null}function x(O,N,M){var L=u(N,O);if(L){E(r,M,L,O)}C.preventDefault();return true}function H(R,O,L,Q){var M=Q[L];if(M){G(M);return true}else{var P=r.dom.getParent(Q,"td,th");if(P){return A(R,P,C)}else{var N=u(O,!R);G(N);C.preventDefault();return false}}}function u(M,L){var N=M&&M[L?"lastChild":"firstChild"];return N&&N.nodeName==="BR"?r.dom.getParent(N,"td,th"):N}function G(L){r.selection.setCursorLocation(L,0)}function D(){return I==m.UP||I==m.DOWN}function F(M){var N=M.selection.getNode();var L=M.dom.getParent(N,"tr");return L!==null}function B(M){var L=0;var N=M;while(N.previousSibling){N=N.previousSibling;L=L+i(N,"colspan")}return L}function w(N,L){var O=0,M=0;l(N.children,function(P,Q){O=O+i(P,"colspan");M=Q;if(O>L){return false}});return M}function E(N,Q,S,P){var R=B(r.dom.getParent(Q,"td,th"));var M=w(S,R);var L=S.childNodes[M];var O=u(L,P);G(O||L)}function K(L){var N=r.selection.getNode();var O=r.dom.getParent(N,"td,th");var M=r.dom.getParent(L,"td,th");return O&&O!==M&&z(O,M)}function z(M,L){return r.dom.getParent(M,"TABLE")===r.dom.getParent(L,"TABLE")}if(D()&&F(r)){var J=r.selection.getNode();setTimeout(function(){if(K(J)){A(!C.shiftKey&&I===m.UP,J,C)}},0)}}r.on("KeyDown",function(u){t(u)})}function n(){function t(v,w){var x=w.ownerDocument,u=x.createRange(),y;u.setStartBefore(w);u.setEnd(v.endContainer,v.endOffset);y=x.createElement("body");y.appendChild(u.cloneContents());return y.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length===0}r.on("KeyDown",function(w){var u,v,x=r.dom;if(w.keyCode==37||w.keyCode==38){u=r.selection.getRng();v=x.getParent(u.startContainer,"table");if(v&&r.getBody().firstChild==v){if(t(u,v)){u=x.createRng();u.setStartBefore(v);u.setEndBefore(v);r.selection.setRng(u);w.preventDefault()}}}})}function p(){r.on("KeyDown SetContent VisualAid",function(){var t;for(t=r.getBody().lastChild;t;t=t.previousSibling){if(t.nodeType==3){if(t.nodeValue.length>0){break}}else{if(t.nodeType==1&&(t.tagName=="BR"||!t.getAttribute("data-mce-bogus"))){break}}}if(t&&t.nodeName=="TABLE"){if(r.settings.forced_root_block){r.dom.add(r.getBody(),r.settings.forced_root_block,r.settings.forced_root_block_attrs,j.ie&&j.ie<11?" ":'
    ')}else{r.dom.add(r.getBody(),"br",{"data-mce-bogus":"1"})}}});r.on("PreProcess",function(u){var t=u.node.lastChild;if(t&&(t.nodeName=="BR"||(t.childNodes.length==1&&(t.firstChild.nodeName=="BR"||t.firstChild.nodeValue=="\u00a0")))&&t.previousSibling&&t.previousSibling.nodeName=="TABLE"){r.dom.remove(t)}})}function o(){function t(A,w,x,C){var y=3,D=A.dom.getParent(w.startContainer,"TABLE");var z,v,B;if(D){z=D.parentNode}v=w.startContainer.nodeType==y&&w.startOffset===0&&w.endOffset===0&&C&&(x.nodeName=="TR"||x==z);B=(x.nodeName=="TD"||x.nodeName=="TH")&&!C;return v||B}function u(){var w=r.selection.getRng();var y=r.selection.getNode();var x=r.dom.getParent(w.startContainer,"TD,TH");if(!t(r,w,y,x)){return}if(!x){x=y}var v=x.lastChild;while(v.lastChild){v=v.lastChild}if(v.nodeType==3){w.setEnd(v,v.data.length);r.selection.setRng(w)}}r.on("KeyDown",function(){u()});r.on("MouseDown",function(v){if(v.button!=2){u()}})}function q(){r.on("keydown",function(w){if((w.keyCode==m.DELETE||w.keyCode==m.BACKSPACE)&&!w.isDefaultPrevented()){var v=r.dom.getParent(r.selection.getStart(),"table");if(v){var t=r.dom.select("td,th",v),u=t.length;while(u--){if(!r.dom.hasClass(t[u],"mce-item-selected")){return}}w.preventDefault();r.execCommand("mceTableDelete")}}})}q();if(j.webkit){s();o()}if(j.gecko){n();p()}if(j.ie>10){n();p()}}});h("tinymce/tableplugin/CellSelection",["tinymce/tableplugin/TableGrid","tinymce/dom/TreeWalker","tinymce/util/Tools"],function(j,k,i){return function(p){var n=p.dom,s,r,m,t=true,q;function o(u){p.getBody().style.webkitUserSelect="";if(u||t){p.dom.removeClass(p.dom.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected");t=false}}function l(y){var w,v,x=y.target;if(q){return}if(r&&(s||x!=r)&&(x.nodeName=="TD"||x.nodeName=="TH")){v=n.getParent(x,"table");if(v==m){if(!s){s=new j(p,v);s.setStartCell(r);p.getBody().style.webkitUserSelect="none"}s.setEndCell(x);t=true}w=p.selection.getSel();try{if(w.removeAllRanges){w.removeAllRanges()}else{w.empty()}}catch(u){}y.preventDefault()}}p.on("MouseDown",function(u){if(u.button!=2&&!q){o();r=n.getParent(u.target,"td,th");m=n.getParent(r,"table")}});p.on("mouseover",l);p.on("remove",function(){n.unbind(p.getDoc(),"mouseover",l)});p.on("MouseUp",function(){var v,z=p.selection,u,A,y,x;function w(B,D){var C=new k(B,B);do{if(B.nodeType==3&&i.trim(B.nodeValue).length!==0){if(D){v.setStart(B,0)}else{v.setEnd(B,B.nodeValue.length)}return}if(B.nodeName=="BR"){if(D){v.setStartBefore(B)}else{v.setEndBefore(B)}return}}while((B=(D?C.next():C.prev())))}if(r){if(s){p.getBody().style.webkitUserSelect=""}u=n.select("td.mce-item-selected,th.mce-item-selected");if(u.length>0){v=n.createRng();y=u[0];v.setStartBefore(y);v.setEndAfter(y);w(y,1);A=new k(y,n.getParent(u[0],"table"));do{if(y.nodeName=="TD"||y.nodeName=="TH"){if(!n.hasClass(y,"mce-item-selected")){break}x=y}}while((y=A.next()));w(x);z.setRng(v)}p.nodeChanged();r=s=m=null}});p.on("KeyUp Drop SetContent",function(u){o(u.type=="setcontent");r=s=m=null;q=false});p.on("ObjectResizeStart ObjectResized",function(u){q=u.type!="objectresized"});return{clear:o}}});h("tinymce/tableplugin/Dialogs",["tinymce/util/Tools","tinymce/Env"],function(j,i){var k=j.each;return function(n){var w=this;function q(){var x=n.settings.color_picker_callback;if(x){return function(){var y=this;x.call(n,function(z){y.value(z).fire("change")},y.value())}}}function t(x){return{title:"Advanced",type:"form",defaults:{onchange:function(){v(x,this.parents().reverse()[0],this.name()=="style")}},items:[{label:"Style",name:"style",type:"textbox"},{type:"form",padding:0,formItemDefaults:{layout:"grid",alignH:["start","right"]},defaults:{size:7},items:[{label:"Border color",type:"colorbox",name:"borderColor",onaction:q()},{label:"Background color",type:"colorbox",name:"backgroundColor",onaction:q()}]}]}}function m(x){return x?x.replace(/px$/,""):""}function u(x){if(/^[0-9]+$/.test(x)){x+="px"}return x}function s(x){k("left center right".split(" "),function(y){n.formatter.remove("align"+y,{},x)})}function o(x){k("top middle bottom".split(" "),function(y){n.formatter.remove("valign"+y,{},x)})}function p(z,x,A){function y(C,B){B=B||[];j.each(C,function(E){var D={text:E.text||E.title};if(E.menu){D.menu=y(E.menu)}else{D.value=E.value;if(x){x(D)}}B.push(D)});return B}return y(z,A||[])}function v(B,A,x){var z=A.toJSON();var y=B.parseStyle(z.style);if(x){A.find("#borderColor").value(y["border-color"]||"")[0].fire("change");A.find("#backgroundColor").value(y["background-color"]||"")[0].fire("change")}else{y["border-color"]=z.borderColor;y["background-color"]=z.backgroundColor}A.find("#style").value(B.serializeStyle(B.parseStyle(B.serializeStyle(y))))}function l(z,y,A){var x=z.parseStyle(z.getAttrib(A,"style"));if(x["border-color"]){y.borderColor=x["border-color"]}if(x["background-color"]){y.backgroundColor=x["background-color"]}y.style=z.serializeStyle(x)}function r(z,A,y){var x=z.parseStyle(z.getAttrib(A,"style"));k(y,function(B){x[B.name]=B.value});z.setAttrib(A,"style",z.serializeStyle(z.parseStyle(z.serializeStyle(x))))}w.tableProps=function(){w.table(true)};w.table=function(B){var y=n.dom,D,F,C,x,A={},G,z;function H(){function J(N,K,M){if(N.tagName==="TD"||N.tagName==="TH"){y.setStyle(N,K,M)}else{if(N.children){for(var L=0;L':"\u00a0";D.insertBefore(I,D.firstChild)}s(D);if(A.align){n.formatter.apply("align"+A.align,{},D)}n.focus();n.addVisual()})}function E(M,K){var J=n.dom.select("td,th",M),L;function I(Q,P){for(var O=0;O";for(E=0;E"+(k.ie?" ":"
    ")+""}G+=""}G+="";A.undoManager.transact(function(){A.insertContent(G);F=A.dom.get("__mce");A.dom.setAttrib(F,"id",null);A.dom.setAttribs(F,A.settings.table_default_attributes||{});A.dom.setStyles(F,A.settings.table_default_styles||{})});return F}function v(F,E){function G(){F.disabled(!A.dom.getParent(A.selection.getStart(),E));A.selection.selectorChanged(E,function(H){F.disabled(!H)})}if(A.initialized){G()}else{A.on("init",G)}}function z(){v(this,"table")}function y(){v(this,"td,th")}function C(){var F="";F='';for(var G=0;G<10;G++){F+="";for(var E=0;E<10;E++){F+=''}F+=""}F+="
    ";F+='';return F}function t(H,F,G){var M=G.getEl().getElementsByTagName("table")[0];var K,J,N,L,E;var I=G.isRtl()||G.parent().rel=="tl-tr";M.nextSibling.innerHTML=(H+1)+" x "+(F+1);if(I){H=9-H}for(J=0;J<10;J++){for(K=0;K<10;K++){L=M.rows[J].childNodes[K].firstChild;E=(I?K>=H:K<=H)&&J<=F;A.dom.toggleClass(L,"mce-active",E);if(E){N=L}}}return N.parentNode}if(A.settings.table_grid===false){A.addMenuItem("inserttable",{text:"Insert table",icon:"table",context:"table",onclick:u.table})}else{A.addMenuItem("inserttable",{text:"Insert table",icon:"table",context:"table",ariaHideMenu:true,onclick:function(E){if(E.aria){this.parent().hideAll();E.stopImmediatePropagation();u.table()}},onshow:function(){t(0,0,this.menu.items()[0])},onhide:function(){var E=this.menu.items()[0].getEl().getElementsByTagName("a");A.dom.removeClass(E,"mce-active");A.dom.addClass(E[0],"mce-active")},menu:[{type:"container",html:C(),onPostRender:function(){this.lastX=this.lastY=0},onmousemove:function(G){var F=G.target,E,H;if(F.tagName.toUpperCase()=="A"){E=parseInt(F.getAttribute("data-mce-x"),10);H=parseInt(F.getAttribute("data-mce-y"),10);if(this.isRtl()||this.parent().rel=="tl-tr"){E=9-E}if(E!==this.lastX||H!==this.lastY){t(E,H,G.control);this.lastX=E;this.lastY=H}}},onclick:function(F){var E=this;if(F.target.tagName.toUpperCase()=="A"){F.preventDefault();F.stopPropagation();E.parent().cancel();A.undoManager.transact(function(){x(E.lastX+1,E.lastY+1)});A.addVisual()}}}]})}A.addMenuItem("tableprops",{text:"Table properties",context:"table",onPostRender:z,onclick:u.tableProps});A.addMenuItem("deletetable",{text:"Delete table",context:"table",onPostRender:z,cmd:"mceTableDelete"});A.addMenuItem("cell",{separator:"before",text:"Cell",context:"table",menu:[{text:"Cell properties",onclick:w("mceTableCellProps"),onPostRender:y},{text:"Merge cells",onclick:w("mceTableMergeCells"),onPostRender:y},{text:"Split cell",onclick:w("mceTableSplitCells"),onPostRender:y}]});A.addMenuItem("row",{text:"Row",context:"table",menu:[{text:"Insert row before",onclick:w("mceTableInsertRowBefore"),onPostRender:y},{text:"Insert row after",onclick:w("mceTableInsertRowAfter"),onPostRender:y},{text:"Delete row",onclick:w("mceTableDeleteRow"),onPostRender:y},{text:"Row properties",onclick:w("mceTableRowProps"),onPostRender:y},{text:"-"},{text:"Cut row",onclick:w("mceTableCutRow"),onPostRender:y},{text:"Copy row",onclick:w("mceTableCopyRow"),onPostRender:y},{text:"Paste row before",onclick:w("mceTablePasteRowBefore"),onPostRender:y},{text:"Paste row after",onclick:w("mceTablePasteRowAfter"),onPostRender:y}]});A.addMenuItem("column",{text:"Column",context:"table",menu:[{text:"Insert column before",onclick:w("mceTableInsertColBefore"),onPostRender:y},{text:"Insert column after",onclick:w("mceTableInsertColAfter"),onPostRender:y},{text:"Delete column",onclick:w("mceTableDeleteCol"),onPostRender:y}]});var s=[];m("inserttable tableprops deletetable | cell row column".split(" "),function(E){if(E=="|"){s.push({text:"-"})}else{s.push(A.menuItems[E])}});A.addButton("table",{type:"menubutton",title:"Table",menu:s});if(!k.isIE){A.on("click",function(E){E=E.target;if(E.nodeName==="TABLE"){A.selection.select(E);A.nodeChanged()}})}D.quirks=new p(A);A.on("Init",function(){D.cellSelection=new r(A)});A.on("PreInit",function(){A.serializer.addAttributeFilter("data-mce-cell-padding,data-mce-border,data-mce-border-color",function(E,F){var G=E.length;while(G--){E[G].attr(F,null)}})});m({mceTableSplitCells:function(E){E.split()},mceTableMergeCells:function(F){var E;E=A.dom.getParent(A.selection.getStart(),"th,td");if(!A.dom.select("td.mce-item-selected,th.mce-item-selected").length){u.merge(F,E)}else{F.merge()}},mceTableInsertRowBefore:function(E){E.insertRow(true)},mceTableInsertRowAfter:function(E){E.insertRow()},mceTableInsertColBefore:function(E){E.insertCol(true)},mceTableInsertColAfter:function(E){E.insertCol()},mceTableDeleteCol:function(E){E.deleteCols()},mceTableDeleteRow:function(E){E.deleteRows()},mceTableCutRow:function(E){B=E.cutRows()},mceTableCopyRow:function(E){B=E.copyRows()},mceTablePasteRowBefore:function(E){E.pasteRows(B,true)},mceTablePasteRowAfter:function(E){E.pasteRows(B)},mceTableDelete:function(E){E.deleteTable()}},function(F,E){A.addCommand(E,function(){var G=new q(A);if(G){F(G);A.execCommand("mceRepaint");D.cellSelection.clear()}})});m({mceInsertTable:u.table,mceTableProps:function(){u.table(true)},mceTableRowProps:u.row,mceTableCellProps:u.cell},function(F,E){A.addCommand(E,function(G,H){F(H)})});if(A.settings.table_tab_navigation!==false){A.on("keydown",function(G){var F,E,H;if(G.keyCode==9){F=A.dom.getParent(A.selection.getStart(),"th,td");if(F){G.preventDefault();E=new q(A);H=G.shiftKey?-1:1;A.undoManager.transact(function(){if(!E.moveRelIdx(F,H)&&H>0){E.insertRow();E.refresh();E.moveRelIdx(F,H)}})}}})}D.insertTable=x}j.add("table",l)})})(this); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/template/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/template/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,262 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +tinymce.PluginManager.add('template', function(editor) { + var each = tinymce.each; + + function createTemplateList(callback) { + return function() { + var templateList = editor.settings.templates; + + if (typeof templateList == "string") { + tinymce.util.XHR.send({ + url: templateList, + success: function(text) { + callback(tinymce.util.JSON.parse(text)); + } + }); + } else { + callback(templateList); + } + }; + } + + function showDialog(templateList) { + var win, values = [], templateHtml; + + if (!templateList || templateList.length === 0) { + editor.windowManager.alert('No templates defined'); + return; + } + + tinymce.each(templateList, function(template) { + values.push({ + selected: !values.length, + text: template.title, + value: { + url: template.url, + content: template.content, + description: template.description + } + }); + }); + + function onSelectTemplate(e) { + var value = e.control.value(); + + function insertIframeHtml(html) { + if (html.indexOf('') == -1) { + var contentCssLinks = ''; + + tinymce.each(editor.contentCSS, function(url) { + contentCssLinks += ''; + }); + + html = ( + '' + + '' + + '' + + contentCssLinks + + '' + + '' + + html + + '' + + '' + ); + } + + html = replaceTemplateValues(html, 'template_preview_replace_values'); + + var doc = win.find('iframe')[0].getEl().contentWindow.document; + doc.open(); + doc.write(html); + doc.close(); + } + + if (value.url) { + tinymce.util.XHR.send({ + url: value.url, + success: function(html) { + templateHtml = html; + insertIframeHtml(templateHtml); + } + }); + } else { + templateHtml = value.content; + insertIframeHtml(templateHtml); + } + + win.find('#description')[0].text(e.control.value().description); + } + + win = editor.windowManager.open({ + title: 'Insert template', + layout: 'flex', + direction: 'column', + align: 'stretch', + padding: 15, + spacing: 10, + + items: [ + {type: 'form', flex: 0, padding: 0, items: [ + {type: 'container', label: 'Templates', items: { + type: 'listbox', label: 'Templates', name: 'template', values: values, onselect: onSelectTemplate + }} + ]}, + {type: 'label', name: 'description', label: 'Description', text: '\u00a0'}, + {type: 'iframe', flex: 1, border: 1} + ], + + onsubmit: function() { + insertTemplate(false, templateHtml); + }, + + width: editor.getParam('template_popup_width', 600), + height: editor.getParam('template_popup_height', 500) + }); + + win.find('listbox')[0].fire('select'); + } + + function getDateTime(fmt, date) { + var daysShort = "Sun Mon Tue Wed Thu Fri Sat Sun".split(' '); + var daysLong = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(' '); + var monthsShort = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(' '); + var monthsLong = "January February March April May June July August September October November December".split(' '); + + function addZeros(value, len) { + value = "" + value; + + if (value.length < len) { + for (var i = 0; i < (len - value.length); i++) { + value = "0" + value; + } + } + + return value; + } + + date = date || new Date(); + + fmt = fmt.replace("%D", "%m/%d/%Y"); + fmt = fmt.replace("%r", "%I:%M:%S %p"); + fmt = fmt.replace("%Y", "" + date.getFullYear()); + fmt = fmt.replace("%y", "" + date.getYear()); + fmt = fmt.replace("%m", addZeros(date.getMonth() + 1, 2)); + fmt = fmt.replace("%d", addZeros(date.getDate(), 2)); + fmt = fmt.replace("%H", "" + addZeros(date.getHours(), 2)); + fmt = fmt.replace("%M", "" + addZeros(date.getMinutes(), 2)); + fmt = fmt.replace("%S", "" + addZeros(date.getSeconds(), 2)); + fmt = fmt.replace("%I", "" + ((date.getHours() + 11) % 12 + 1)); + fmt = fmt.replace("%p", "" + (date.getHours() < 12 ? "AM" : "PM")); + fmt = fmt.replace("%B", "" + editor.translate(monthsLong[date.getMonth()])); + fmt = fmt.replace("%b", "" + editor.translate(monthsShort[date.getMonth()])); + fmt = fmt.replace("%A", "" + editor.translate(daysLong[date.getDay()])); + fmt = fmt.replace("%a", "" + editor.translate(daysShort[date.getDay()])); + fmt = fmt.replace("%%", "%"); + + return fmt; + } + + function replaceVals(e) { + var dom = editor.dom, vl = editor.getParam('template_replace_values'); + + each(dom.select('*', e), function(e) { + each(vl, function(v, k) { + if (dom.hasClass(e, k)) { + if (typeof vl[k] == 'function') { + vl[k](e); + } + } + }); + }); + } + + function replaceTemplateValues(html, templateValuesOptionName) { + each(editor.getParam(templateValuesOptionName), function(v, k) { + if (typeof v != 'function') { + html = html.replace(new RegExp('\\{\\$' + k + '\\}', 'g'), v); + } + }); + + return html; + } + + function insertTemplate(ui, html) { + var el, n, dom = editor.dom, sel = editor.selection.getContent(); + + html = replaceTemplateValues(html, 'template_replace_values'); + el = dom.create('div', null, html); + + // Find template element within div + n = dom.select('.mceTmpl', el); + if (n && n.length > 0) { + el = dom.create('div', null); + el.appendChild(n[0].cloneNode(true)); + } + + function hasClass(n, c) { + return new RegExp('\\b' + c + '\\b', 'g').test(n.className); + } + + each(dom.select('*', el), function(n) { + // Replace cdate + if (hasClass(n, editor.getParam('template_cdate_classes', 'cdate').replace(/\s+/g, '|'))) { + n.innerHTML = getDateTime(editor.getParam("template_cdate_format", editor.getLang("template.cdate_format"))); + } + + // Replace mdate + if (hasClass(n, editor.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|'))) { + n.innerHTML = getDateTime(editor.getParam("template_mdate_format", editor.getLang("template.mdate_format"))); + } + + // Replace selection + if (hasClass(n, editor.getParam('template_selected_content_classes', 'selcontent').replace(/\s+/g, '|'))) { + n.innerHTML = sel; + } + }); + + replaceVals(el); + + editor.execCommand('mceInsertContent', false, el.innerHTML); + editor.addVisual(); + } + + editor.addCommand('mceInsertTemplate', insertTemplate); + + editor.addButton('template', { + title: 'Insert template', + onclick: createTemplateList(showDialog) + }); + + editor.addMenuItem('template', { + text: 'Insert template', + onclick: createTemplateList(showDialog), + context: 'insert' + }); + + editor.on('PreProcess', function(o) { + var dom = editor.dom; + + each(dom.select('div', o.node), function(e) { + if (dom.hasClass(e, 'mceTmpl')) { + each(dom.select('*', e), function(e) { + if (dom.hasClass(e, editor.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|'))) { + e.innerHTML = getDateTime(editor.getParam("template_mdate_format", editor.getLang("template.mdate_format"))); + } + }); + + replaceVals(e); + } + }); + }); +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/template/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/template/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("template",function(e){var g=tinymce.each;function f(i){return function(){var j=e.settings.templates;if(typeof j=="string"){tinymce.util.XHR.send({url:j,success:function(k){i(tinymce.util.JSON.parse(k))}})}else{i(j)}}}function a(l){var m,k=[],j;if(!l||l.length===0){e.windowManager.alert("No templates defined");return}tinymce.each(l,function(n){k.push({selected:!k.length,text:n.title,value:{url:n.url,content:n.content,description:n.description}})});function i(p){var o=p.control.value();function n(q){if(q.indexOf("")==-1){var s="";tinymce.each(e.contentCSS,function(t){s+=''});q=(""+s+""+q+"")}q=d(q,"template_preview_replace_values");var r=m.find("iframe")[0].getEl().contentWindow.document;r.open();r.write(q);r.close()}if(o.url){tinymce.util.XHR.send({url:o.url,success:function(q){j=q;n(j)}})}else{j=o.content;n(j)}m.find("#description")[0].text(p.control.value().description)}m=e.windowManager.open({title:"Insert template",layout:"flex",direction:"column",align:"stretch",padding:15,spacing:10,items:[{type:"form",flex:0,padding:0,items:[{type:"container",label:"Templates",items:{type:"listbox",label:"Templates",name:"template",values:k,onselect:i}}]},{type:"label",name:"description",label:"Description",text:"\u00a0"},{type:"iframe",flex:1,border:1}],onsubmit:function(){c(false,j)},width:e.getParam("template_popup_width",600),height:e.getParam("template_popup_height",500)});m.find("listbox")[0].fire("select")}function b(j,m){var i="Sun Mon Tue Wed Thu Fri Sat Sun".split(" ");var o="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" ");var n="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ");var l="January February March April May June July August September October November December".split(" ");function k(r,p){r=""+r;if(r.length0){k=o.create("div",null);k.appendChild(p[0].cloneNode(true))}function i(r,q){return new RegExp("\\b"+q+"\\b","g").test(r.className)}g(o.select("*",k),function(q){if(i(q,e.getParam("template_cdate_classes","cdate").replace(/\s+/g,"|"))){q.innerHTML=b(e.getParam("template_cdate_format",e.getLang("template.cdate_format")))}if(i(q,e.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))){q.innerHTML=b(e.getParam("template_mdate_format",e.getLang("template.mdate_format")))}if(i(q,e.getParam("template_selected_content_classes","selcontent").replace(/\s+/g,"|"))){q.innerHTML=l}});h(k);e.execCommand("mceInsertContent",false,k.innerHTML);e.addVisual()}e.addCommand("mceInsertTemplate",c);e.addButton("template",{title:"Insert template",onclick:f(a)});e.addMenuItem("template",{text:"Insert template",onclick:f(a),context:"insert"});e.on("PreProcess",function(j){var i=e.dom;g(i.select("div",j.node),function(k){if(i.hasClass(k,"mceTmpl")){g(i.select("*",k),function(l){if(i.hasClass(l,e.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))){l.innerHTML=b(e.getParam("template_mdate_format",e.getLang("template.mdate_format")))}});h(k)}})})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/textcolor/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/textcolor/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,282 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ +/*eslint consistent-this:0 */ + +tinymce.PluginManager.add('textcolor', function(editor) { + var cols, rows; + + rows = editor.settings.textcolor_rows || 5; + cols = editor.settings.textcolor_cols || 8; + + function getCurrentColor(format) { + var color; + + editor.dom.getParents(editor.selection.getStart(), function(elm) { + var value; + + if ((value = elm.style[format == 'forecolor' ? 'color' : 'background-color'])) { + color = value; + } + }); + + return color; + } + + function mapColors() { + var i, colors = [], colorMap; + + colorMap = editor.settings.textcolor_map || [ + "000000", "Black", + "993300", "Burnt orange", + "333300", "Dark olive", + "003300", "Dark green", + "003366", "Dark azure", + "000080", "Navy Blue", + "333399", "Indigo", + "333333", "Very dark gray", + "800000", "Maroon", + "FF6600", "Orange", + "808000", "Olive", + "008000", "Green", + "008080", "Teal", + "0000FF", "Blue", + "666699", "Grayish blue", + "808080", "Gray", + "FF0000", "Red", + "FF9900", "Amber", + "99CC00", "Yellow green", + "339966", "Sea green", + "33CCCC", "Turquoise", + "3366FF", "Royal blue", + "800080", "Purple", + "999999", "Medium gray", + "FF00FF", "Magenta", + "FFCC00", "Gold", + "FFFF00", "Yellow", + "00FF00", "Lime", + "00FFFF", "Aqua", + "00CCFF", "Sky blue", + "993366", "Red violet", + "FFFFFF", "White", + "FF99CC", "Pink", + "FFCC99", "Peach", + "FFFF99", "Light yellow", + "CCFFCC", "Pale green", + "CCFFFF", "Pale cyan", + "99CCFF", "Light sky blue", + "CC99FF", "Plum" + ]; + + for (i = 0; i < colorMap.length; i += 2) { + colors.push({ + text: colorMap[i + 1], + color: '#' + colorMap[i] + }); + } + + return colors; + } + + function renderColorPicker() { + var ctrl = this, colors, color, html, last, x, y, i, id = ctrl._id, count = 0; + + function getColorCellHtml(color, title) { + var isNoColor = color == 'transparent'; + + return ( + '' + + '
    ' + + (isNoColor ? '×' : '') + + '
    ' + + '' + ); + } + + colors = mapColors(); + colors.push({ + text: tinymce.translate("No color"), + color: "transparent" + }); + + html = ''; + last = colors.length - 1; + + for (y = 0; y < rows; y++) { + html += ''; + + for (x = 0; x < cols; x++) { + i = y * cols + x; + + if (i > last) { + html += ''; + } else { + color = colors[i]; + html += getColorCellHtml(color.color, color.text); + } + } + + html += ''; + } + + if (editor.settings.color_picker_callback) { + html += ( + '' + + '' + + '' + ); + + html += ''; + + for (x = 0; x < cols; x++) { + html += getColorCellHtml('', 'Custom color'); + } + + html += ''; + } + + html += '
    ' + + '
    ' + + '' + + '
    ' + + '
    '; + + return html; + } + + function applyFormat(format, value) { + editor.undoManager.transact(function() { + editor.focus(); + editor.formatter.apply(format, {value: value}); + editor.nodeChanged(); + }); + } + + function removeFormat(format) { + editor.undoManager.transact(function() { + editor.focus(); + editor.formatter.remove(format, {value: null}, null, true); + editor.nodeChanged(); + }); + } + + function onPanelClick(e) { + var buttonCtrl = this.parent(), value; + + function selectColor(value) { + buttonCtrl.hidePanel(); + buttonCtrl.color(value); + applyFormat(buttonCtrl.settings.format, value); + } + + function resetColor() { + buttonCtrl.hidePanel(); + buttonCtrl.resetColor(); + removeFormat(buttonCtrl.settings.format); + } + + function setDivColor(div, value) { + div.style.background = value; + div.setAttribute('data-mce-color', value); + } + + if (tinymce.DOM.getParent(e.target, '.mce-custom-color-btn')) { + buttonCtrl.hidePanel(); + + editor.settings.color_picker_callback.call(editor, function(value) { + var tableElm = buttonCtrl.panel.getEl().getElementsByTagName('table')[0]; + var customColorCells, div, i; + + customColorCells = tinymce.map(tableElm.rows[tableElm.rows.length - 1].childNodes, function(elm) { + return elm.firstChild; + }); + + for (i = 0; i < customColorCells.length; i++) { + div = customColorCells[i]; + if (!div.getAttribute('data-mce-color')) { + break; + } + } + + // Shift colors to the right + // TODO: Might need to be the left on RTL + if (i == cols) { + for (i = 0; i < cols - 1; i++) { + setDivColor(customColorCells[i], customColorCells[i + 1].getAttribute('data-mce-color')); + } + } + + setDivColor(div, value); + selectColor(value); + }, getCurrentColor(buttonCtrl.settings.format)); + } + + value = e.target.getAttribute('data-mce-color'); + if (value) { + if (this.lastId) { + document.getElementById(this.lastId).setAttribute('aria-selected', false); + } + + e.target.setAttribute('aria-selected', true); + this.lastId = e.target.id; + + if (value == 'transparent') { + resetColor(); + } else { + selectColor(value); + } + } else if (value !== null) { + buttonCtrl.hidePanel(); + } + } + + function onButtonClick() { + var self = this; + + if (self._color) { + applyFormat(self.settings.format, self._color); + } else { + removeFormat(self.settings.format); + } + } + + editor.addButton('forecolor', { + type: 'colorbutton', + tooltip: 'Text color', + format: 'forecolor', + panel: { + role: 'application', + ariaRemember: true, + html: renderColorPicker, + onclick: onPanelClick + }, + onclick: onButtonClick + }); + + editor.addButton('backcolor', { + type: 'colorbutton', + tooltip: 'Background color', + format: 'hilitecolor', + panel: { + role: 'application', + ariaRemember: true, + html: renderColorPicker, + onclick: onPanelClick + }, + onclick: onButtonClick + }); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/textcolor/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/textcolor/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("textcolor",function(f){var g,j;j=f.settings.textcolor_rows||5;g=f.settings.textcolor_cols||8;function a(l){var k;f.dom.getParents(f.selection.getStart(),function(n){var m;if((m=n.style[l=="forecolor"?"color":"background-color"])){k=m}});return k}function h(){var m,k=[],l;l=f.settings.textcolor_map||["000000","Black","993300","Burnt orange","333300","Dark olive","003300","Dark green","003366","Dark azure","000080","Navy Blue","333399","Indigo","333333","Very dark gray","800000","Maroon","FF6600","Orange","808000","Olive","008000","Green","008080","Teal","0000FF","Blue","666699","Grayish blue","808080","Gray","FF0000","Red","FF9900","Amber","99CC00","Yellow green","339966","Sea green","33CCCC","Turquoise","3366FF","Royal blue","800080","Purple","999999","Medium gray","FF00FF","Magenta","FFCC00","Gold","FFFF00","Yellow","00FF00","Lime","00FFFF","Aqua","00CCFF","Sky blue","993366","Red violet","FFFFFF","White","FF99CC","Pink","FFCC99","Peach","FFFF99","Light yellow","CCFFCC","Pale green","CCFFFF","Pale cyan","99CCFF","Light sky blue","CC99FF","Plum"];for(m=0;m
    '+(w?"×":"")+"
    ")}l=h();l.push({text:tinymce.translate("No color"),color:"transparent"});p='';u=l.length-1;for(s=0;s";for(t=0;tu){p+=""}else{n=l[o];p+=r(n.color,n.text)}}p+=""}if(f.settings.color_picker_callback){p+=('");p+="";for(t=0;t b.start.length) { + return -1; + } + + if (a.start.length < b.start.length) { + return 1; + } + + return 0; + }); + + isPatternsDirty = false; + } + + return patterns; + } + + // Finds a matching pattern to the specified text + function findPattern(text) { + var patterns = getPatterns(); + + for (var i = 0; i < patterns.length; i++) { + if (text.indexOf(patterns[i].start) !== 0) { + continue; + } + + if (patterns[i].end && text.lastIndexOf(patterns[i].end) != text.length - patterns[i].end.length) { + continue; + } + + return patterns[i]; + } + } + + // Finds the best matching end pattern + function findEndPattern(text, offset, delta) { + var patterns, pattern, i; + + // Find best matching end + patterns = getPatterns(); + for (i = 0; i < patterns.length; i++) { + pattern = patterns[i]; + if (pattern.end && text.substr(offset - pattern.end.length - delta, pattern.end.length) == pattern.end) { + return pattern; + } + } + } + + // Handles inline formats like *abc* and **abc** + function applyInlineFormat(space) { + var selection, dom, rng, container, offset, startOffset, text, patternRng, pattern, delta, format; + + function splitContainer() { + // Split text node and remove start/end from text node + container = container.splitText(startOffset); + container.splitText(offset - startOffset - delta); + container.deleteData(0, pattern.start.length); + container.deleteData(container.data.length - pattern.end.length, pattern.end.length); + } + + selection = editor.selection; + dom = editor.dom; + + if (!selection.isCollapsed()) { + return; + } + + rng = selection.getRng(true); + container = rng.startContainer; + offset = rng.startOffset; + text = container.data; + delta = space ? 1 : 0; + + if (container.nodeType != 3) { + return; + } + + // Find best matching end + pattern = findEndPattern(text, offset, delta); + if (!pattern) { + return; + } + + // Find start of matched pattern + // TODO: Might need to improve this if there is nested formats + startOffset = Math.max(0, offset - delta); + startOffset = text.lastIndexOf(pattern.start, startOffset - pattern.end.length - 1); + + if (startOffset === -1) { + return; + } + + // Setup a range for the matching word + patternRng = dom.createRng(); + patternRng.setStart(container, startOffset); + patternRng.setEnd(container, offset - delta); + pattern = findPattern(patternRng.toString()); + + if (!pattern || !pattern.end) { + return; + } + + // If container match doesn't have anything between start/end then do nothing + if (container.data.length <= pattern.start.length + pattern.end.length) { + return; + } + + format = editor.formatter.get(pattern.format); + if (format && format[0].inline) { + splitContainer(); + editor.formatter.apply(pattern.format, {}, container); + return container; + } + } + + // Handles block formats like ##abc or 1. abc + function applyBlockFormat() { + var selection, dom, container, firstTextNode, node, format, textBlockElm, pattern, walker, rng, offset; + + selection = editor.selection; + dom = editor.dom; + + if (!selection.isCollapsed()) { + return; + } + + textBlockElm = dom.getParent(selection.getStart(), 'p'); + if (textBlockElm) { + walker = new tinymce.dom.TreeWalker(textBlockElm, textBlockElm); + while ((node = walker.next())) { + if (node.nodeType == 3) { + firstTextNode = node; + break; + } + } + + if (firstTextNode) { + pattern = findPattern(firstTextNode.data); + if (!pattern) { + return; + } + + rng = selection.getRng(true); + container = rng.startContainer; + offset = rng.startOffset; + + if (firstTextNode == container) { + offset = Math.max(0, offset - pattern.start.length); + } + + if (tinymce.trim(firstTextNode.data).length == pattern.start.length) { + return; + } + + if (pattern.format) { + format = editor.formatter.get(pattern.format); + if (format && format[0].block) { + firstTextNode.deleteData(0, pattern.start.length); + editor.formatter.apply(pattern.format, {}, firstTextNode); + + rng.setStart(container, offset); + rng.collapse(true); + selection.setRng(rng); + } + } + + if (pattern.cmd) { + editor.undoManager.transact(function() { + firstTextNode.deleteData(0, pattern.start.length); + editor.execCommand(pattern.cmd); + }); + } + } + } + } + + function handleEnter() { + var rng, wrappedTextNode; + + wrappedTextNode = applyInlineFormat(); + if (wrappedTextNode) { + rng = editor.dom.createRng(); + rng.setStart(wrappedTextNode, wrappedTextNode.data.length); + rng.setEnd(wrappedTextNode, wrappedTextNode.data.length); + editor.selection.setRng(rng); + } + + applyBlockFormat(); + } + + function handleSpace() { + var wrappedTextNode, lastChar, lastCharNode, rng, dom; + + wrappedTextNode = applyInlineFormat(true); + if (wrappedTextNode) { + dom = editor.dom; + lastChar = wrappedTextNode.data.slice(-1); + + // Move space after the newly formatted node + if (/[\u00a0 ]/.test(lastChar)) { + wrappedTextNode.deleteData(wrappedTextNode.data.length - 1, 1); + lastCharNode = dom.doc.createTextNode(lastChar); + + if (wrappedTextNode.nextSibling) { + dom.insertAfter(lastCharNode, wrappedTextNode.nextSibling); + } else { + wrappedTextNode.parentNode.appendChild(lastCharNode); + } + + rng = dom.createRng(); + rng.setStart(lastCharNode, 1); + rng.setEnd(lastCharNode, 1); + editor.selection.setRng(rng); + } + } + } + + editor.on('keydown', function(e) { + if (e.keyCode == 13 && !tinymce.util.VK.modifierPressed(e)) { + handleEnter(); + } + }, true); + + editor.on('keyup', function(e) { + if (e.keyCode == 32 && !tinymce.util.VK.modifierPressed(e)) { + handleSpace(); + } + }); + + this.getPatterns = getPatterns; + this.setPatterns = function(newPatterns) { + patterns = newPatterns; + isPatternsDirty = true; + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/textpattern/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/textpattern/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("textpattern",function(f){var a=true,b;b=f.settings.textpattern_patterns||[{start:"*",end:"*",format:"italic"},{start:"**",end:"**",format:"bold"},{start:"#",format:"h1"},{start:"##",format:"h2"},{start:"###",format:"h3"},{start:"####",format:"h4"},{start:"#####",format:"h5"},{start:"######",format:"h6"},{start:"1. ",cmd:"InsertOrderedList"},{start:"* ",cmd:"InsertUnorderedList"},{start:"- ",cmd:"InsertUnorderedList"}];function j(){if(a){b.sort(function(l,k){if(l.start.length>k.start.length){return -1}if(l.start.length' + value + ''; + } + + function compileCharMapToRegExp() { + var key, regExp = ''; + + for (key in charMap) { + regExp += key; + } + + return new RegExp('[' + regExp + ']', 'g'); + } + + function compileCharMapToCssSelector() { + var key, selector = ''; + + for (key in charMap) { + if (selector) { + selector += ','; + } + + selector += 'span.mce-' + charMap[key]; + } + + return selector; + } + + state = !state; + self.state = state; + editor.fire('VisualChars', {state: state}); + visualCharsRegExp = compileCharMapToRegExp(); + + if (addBookmark) { + bookmark = selection.getBookmark(); + } + + if (state) { + nodeList = []; + tinymce.walk(body, function(n) { + if (n.nodeType == 3 && n.nodeValue && visualCharsRegExp.test(n.nodeValue)) { + nodeList.push(n); + } + }, 'childNodes'); + + for (i = 0; i < nodeList.length; i++) { + nodeValue = nodeList[i].nodeValue; + nodeValue = nodeValue.replace(visualCharsRegExp, wrapCharWithSpan); + + div = editor.dom.create('div', null, nodeValue); + while ((node = div.lastChild)) { + editor.dom.insertAfter(node, nodeList[i]); + } + + editor.dom.remove(nodeList[i]); + } + } else { + nodeList = editor.dom.select(compileCharMapToCssSelector(), body); + + for (i = nodeList.length - 1; i >= 0; i--) { + editor.dom.remove(nodeList[i], 1); + } + } + + selection.moveToBookmark(bookmark); + } + + function toggleActiveState() { + var self = this; + + editor.on('VisualChars', function(e) { + self.active(e.state); + }); + } + + editor.addCommand('mceVisualChars', toggleVisualChars); + + editor.addButton('visualchars', { + title: 'Show invisible characters', + cmd: 'mceVisualChars', + onPostRender: toggleActiveState + }); + + editor.addMenuItem('visualchars', { + text: 'Show invisible characters', + cmd: 'mceVisualChars', + onPostRender: toggleActiveState, + selectable: true, + context: 'view', + prependToContext: true + }); + + editor.on('beforegetcontent', function(e) { + if (state && e.format != 'raw' && !e.draft) { + state = true; + toggleVisualChars(false); + } + }); +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualchars/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/visualchars/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("visualchars",function(c){var a=this,e;function d(l){var g,j,k,n=c.getBody(),o,t=c.selection,f,q;var p,h;p={"\u00a0":"nbsp","\u00ad":"shy"};function r(i){return''+i+""}function s(){var u,i="";for(u in p){i+=u}return new RegExp("["+i+"]","g")}function m(){var u,i="";for(u in p){if(i){i+=","}i+="span.mce-"+p[u]}return i}e=!e;a.state=e;c.fire("VisualChars",{state:e});h=s();if(l){q=t.getBookmark()}if(e){j=[];tinymce.walk(n,function(i){if(i.nodeType==3&&i.nodeValue&&h.test(i.nodeValue)){j.push(i)}},"childNodes");for(k=0;k=0;k--){c.dom.remove(j[k],1)}}t.moveToBookmark(q)}function b(){var f=this;c.on("VisualChars",function(g){f.active(g.state)})}c.addCommand("mceVisualChars",d);c.addButton("visualchars",{title:"Show invisible characters",cmd:"mceVisualChars",onPostRender:b});c.addMenuItem("visualchars",{text:"Show invisible characters",cmd:"mceVisualChars",onPostRender:b,selectable:true,context:"view",prependToContext:true});c.on("beforegetcontent",function(f){if(e&&f.format!="raw"&&!f.draft){e=true;d(false)}})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/wordcount/plugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/wordcount/plugin.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,69 @@ +/** + * plugin.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +tinymce.PluginManager.add('wordcount', function(editor) { + var self = this, countre, cleanre; + + // Included most unicode blocks see: http://en.wikipedia.org/wiki/Unicode_block + // Latin-1_Supplement letters, a-z, u2019 == ’ + countre = editor.getParam('wordcount_countregex', /[\w\u2019\x27\-\u00C0-\u1FFF]+/g); + cleanre = editor.getParam('wordcount_cleanregex', /[0-9.(),;:!?%#$?\x27\x22_+=\\\/\-]*/g); + + function update() { + editor.theme.panel.find('#wordcount').text(['Words: {0}', self.getCount()]); + } + + editor.on('init', function() { + var statusbar = editor.theme.panel && editor.theme.panel.find('#statusbar')[0]; + + if (statusbar) { + window.setTimeout(function() { + statusbar.insert({ + type: 'label', + name: 'wordcount', + text: ['Words: {0}', self.getCount()], + classes: 'wordcount', + disabled: editor.settings.readonly + }, 0); + + editor.on('setcontent beforeaddundo', update); + + editor.on('keyup', function(e) { + if (e.keyCode == 32) { + update(); + } + }); + }, 0); + } + }); + + self.getCount = function() { + var tx = editor.getContent({format: 'raw'}); + var tc = 0; + + if (tx) { + tx = tx.replace(/\.\.\./g, ' '); // convert ellipses to spaces + tx = tx.replace(/<.[^<>]*?>/g, ' ').replace(/ | /gi, ' '); // remove html tags and space chars + + // deal with html entities + tx = tx.replace(/(\w+)(&#?[a-z0-9]+;)+(\w+)/i, "$1$3").replace(/&.+?;/g, ' '); + tx = tx.replace(cleanre, ''); // remove numbers and punctuation + + var wordArray = tx.match(countre); + if (wordArray) { + tc = wordArray.length; + } + } + + return tc; + }; +}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/plugins/wordcount/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/wordcount/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("wordcount",function(b){var a=this,c,e;c=b.getParam("wordcount_countregex",/[\w\u2019\x27\-\u00C0-\u1FFF]+/g);e=b.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\x27\x22_+=\\\/\-]*/g);function d(){b.theme.panel.find("#wordcount").text(["Words: {0}",a.getCount()])}b.on("init",function(){var f=b.theme.panel&&b.theme.panel.find("#statusbar")[0];if(f){window.setTimeout(function(){f.insert({type:"label",name:"wordcount",text:["Words: {0}",a.getCount()],classes:"wordcount",disabled:b.settings.readonly},0);b.on("setcontent beforeaddundo",d);b.on("keyup",function(g){if(g.keyCode==32){d()}})},0)}});a.getCount=function(){var g=b.getContent({format:"raw"});var f=0;if(g){g=g.replace(/\.\.\./g," ");g=g.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ");g=g.replace(/(\w+)(&#?[a-z0-9]+;)+(\w+)/i,"$1$3").replace(/&.+?;/g," ");g=g.replace(e,"");var h=g.match(c);if(h){f=h.length}}return f}}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/AbsoluteLayout.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/AbsoluteLayout.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,17 @@ +// AbsoluteLayout + +.@{prefix}-abs-layout { + position: relative; +} + +body .@{prefix}-abs-layout-item, .@{prefix}-abs-end { + position: absolute; +} + +.@{prefix}-abs-end { + width: 1px; height: 1px; +} + +.@{prefix}-container-body.@{prefix}-abs-layout { + overflow: hidden; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Animations.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Animations.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,10 @@ +// Animations + +.@{prefix}-fade { + opacity: 0; + .transition(opacity .15s linear); + + &.@{prefix}-in { + opacity: 1; + } +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Button.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Button.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,157 @@ +// Button + +.@{prefix}-btn { + border: 1px solid mix(rgb(red(@btn-border-right), green(@btn-border-right), blue(@btn-border-right)), @panel-bg, 30%); + border-color: @btn-border-top @btn-border-right @btn-border-bottom @btn-border-left; + position: relative; + text-shadow: @text-shadow; + + .inline-block(); + .border-radius(3px); + .box-shadow(@btn-box-shadow); + .vertical-gradient(@btn-bg, @btn-bg-hlight); + + &:hover, &:focus { + color: @btn-text; + .vertical-gradient(darken(@btn-bg, 5%), darken(@btn-bg-hlight, 5%)); + } + + &.@{prefix}-disabled button, &.@{prefix}-disabled:hover button { + cursor: default; + .box-shadow(none); + .opacity(@btn-box-disabled-opacity); + } + + &.@{prefix}-active, &.@{prefix}-active:hover { + .vertical-gradient(darken(@btn-bg, 10%), darken(@btn-bg-hlight, 10%)); + .box-shadow(@btn-box-shadow-active); + } + + &:active { + .vertical-gradient(darken(@btn-bg, 10%), darken(@btn-bg-hlight, 10%)); + .box-shadow(@btn-box-shadow-active); + } +} + +.@{prefix}-btn button { + padding: 4px 10px; + font-size: @font-size; + line-height: @line-height; + *line-height: @line-height - 4px; + cursor: pointer; + color: @btn-text; + text-align: center; + + // Fixes for default inner padding of button + overflow: visible; // IE7 + -webkit-appearance: none; // WebKit + &::-moz-focus-inner { // Gecko + border: 0; + padding: 0; + } +} + +.@{prefix}-btn i { + text-shadow: 1px 1px @btn-text-shadow; +} + +.@{prefix}-primary { + min-width: 50px; + color: @btn-primary-text; + border: 1px solid mix(rgb(red(@btn-border-right), green(@btn-border-right), blue(@btn-border-right)), @panel-bg, 30%); + border-color: @btn-border-top @btn-border-right @btn-border-bottom @btn-border-left; + .vertical-gradient(@btn-primary-bg, @btn-primary-bg-hlight); + + &:hover, &:focus { + .vertical-gradient(darken(@btn-primary-bg, 5%), darken(@btn-primary-bg-hlight, 5%)); + } + + &.@{prefix}-disabled button, &.@{prefix}-disabled:hover button { + cursor: default; + .box-shadow(none); + .opacity(@btn-box-disabled-opacity); + } + + &.@{prefix}-active, &.@{prefix}-active:hover, &:not(.@{prefix}-disabled):active { + .vertical-gradient(darken(@btn-primary-bg, 10%), darken(@btn-primary-bg-hlight, 10%)); + .box-shadow(@btn-box-shadow-active); + } +} + +.@{prefix}-primary button, .@{prefix}-primary button i { + color: @btn-primary-text; + text-shadow: 1px 1px @btn-primary-text-shadow; +} + +.@{prefix}-btn-large button { + padding: 9px 14px; + font-size: @font-size + 2px; + line-height: normal; + .border-radius(5px); +} + +.@{prefix}-btn-large i { + margin-top: 2px; +} + +.@{prefix}-btn-small button { + padding: 1px 5px; + font-size: @font-size - 2px; + *padding-bottom: 2px; +} + +.@{prefix}-btn-small i { + line-height: 20px; + vertical-align: top; + *line-height: 18px; +} + +.@{prefix}-btn .@{prefix}-caret { + margin-top: 8px; + margin-left: 0; +} + +.@{prefix}-btn-small .@{prefix}-caret { + margin-top: 8px; + margin-left: 0; +} + +.@{prefix}-caret { + .inline-block(); + width: 0; height: 0; + vertical-align: top; + border-top: 4px solid @btn-caret-border; + border-right: 4px solid transparent; + border-left: 4px solid transparent; + content: ""; +} + +.@{prefix}-disabled .@{prefix}-caret { + border-top-color: @text-disabled; +} + +.@{prefix}-caret.@{prefix}-up { + border-bottom: 4px solid @btn-caret-border; + border-top: 0; +} + +.@{prefix}-btn-flat { + border: 0; + background: transparent; + .border-radius(0); + .box-shadow(none); + filter: none; +} + +.@{prefix}-btn-flat:hover, .@{prefix}-btn-flat.@{prefix}-active, .@{prefix}-btn-flat:focus, .@{prefix}-btn-flat:active { + border: 0; + background: @menubar-bg-active; + filter: none; + .box-shadow(none); +} + +// RTL + +.@{prefix}-rtl .@{prefix}-btn button { + direction: rtl; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ButtonGroup.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ButtonGroup.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,27 @@ +// ButtonGroup + +.@{prefix}-btn-group .@{prefix}-btn { + border-width: 1px 0 1px 0; + margin: 0; + .border-radius(0); +} + +.@{prefix}-btn-group .@{prefix}-first { + border-left: 1px solid mix(rgb(red(@btn-border-left), green(@btn-border-left), blue(@btn-border-left)), @panel-bg, 30%); + border-left: 1px solid @btn-border-left; + .border-radius(3px 0 0 3px); +} + +.@{prefix}-btn-group .@{prefix}-last { + border-right: 1px solid mix(rgb(red(@btn-border-right), green(@btn-border-right), blue(@btn-border-right)), @panel-bg, 30%); + border-right: 1px solid @btn-border-right; + .border-radius(0 3px 3px 0); +} + +.@{prefix}-btn-group .@{prefix}-first.@{prefix}-last { + .border-radius(3px); +} + +.@{prefix}-btn-group .@{prefix}-btn.@{prefix}-flow-layout-item { + margin: 0; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Checkbox.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Checkbox.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,45 @@ +// Checkbox + +.@{prefix}-checkbox { + cursor: pointer; +} + +i.@{prefix}-i-checkbox { + margin: 0 3px 0 0; + border: 1px solid @checkbox-border; + .border-radius(3px); + .box-shadow(@checkbox-box-shadow); + .vertical-gradient(@checkbox-bg, @checkbox-bg-hlight); + text-indent: -10em; + *font-size: 0; + *line-height: 0; + *text-indent: 0; + overflow: hidden; +} + +.@{prefix}-checked i.@{prefix}-i-checkbox { + color: @btn-text; + font-size: 16px; + line-height: 16px; + text-indent: 0; +} + +.@{prefix}-checkbox:focus i.@{prefix}-i-checkbox, .@{prefix}-checkbox.@{prefix}-focus i.@{prefix}-i-checkbox { + border: 1px solid @checkbox-border-focus; + .box-shadow(inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px fadeout(@checkbox-border-focus, 15%)); +} + +.@{prefix}-checkbox.@{prefix}-disabled .@{prefix}-label, .@{prefix}-checkbox.@{prefix}-disabled i.@{prefix}-i-checkbox { + color: mix(@text, @panel-bg, 40%); +} + +// RTL + +.@{prefix}-rtl .@{prefix}-checkbox { + direction: rtl; + text-align: right; +} + +.@{prefix}-rtl i.@{prefix}-i-checkbox { + margin: 0 0 0 3px; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ColorBox.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ColorBox.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,6 @@ +// ColorBox + +.@{prefix}-colorbox i { + border: 1px solid @textbox-border; + width: 14px; height: 14px; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ColorButton.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ColorButton.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,78 @@ +// ColorButton + +.@{prefix}-colorbutton .@{prefix}-ico { + position: relative; +} + +.@{prefix}-colorbutton-grid { + margin: 4px; +} + +.@{prefix}-colorbutton button { + padding-right: 4px; +} + +.@{prefix}-colorbutton .@{prefix}-preview { + padding-right: 3px; + display: block; + position: absolute; + left: 50%; + top: 50%; + margin-left: -14px; + margin-top: 7px; + background: gray; + width: 13px; + height: 2px; + overflow: hidden; +} + +.@{prefix}-colorbutton.@{prefix}-btn-small .@{prefix}-preview { + margin-left: -16px; + padding-right: 0; + width: 16px; +} + +.@{prefix}-colorbutton .@{prefix}-open { + padding-left: 4px; + border-left: 1px solid transparent; + border-right: 1px solid transparent; +} + +.@{prefix}-colorbutton:hover .@{prefix}-open { + border-left-color: @btn-split-border; + border-right-color: @btn-split-border; +} + +.@{prefix}-colorbutton.@{prefix}-btn-small .@{prefix}-open { + padding: 0 3px 0 3px; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-colorbutton { + direction: rtl; +} + +.@{prefix}-rtl .@{prefix}-colorbutton .@{prefix}-preview { + margin-left: 0; + padding-right: 0; + padding-left: 4px; + margin-right: -14px; +} + +.@{prefix}-rtl .@{prefix}-colorbutton.@{prefix}-btn-small .@{prefix}-preview { + margin-left: 0; + padding-right: 0; + margin-right: -17px; + padding-left: 0; +} + +.@{prefix}-rtl .@{prefix}-colorbutton button { + padding-right: 10px; + padding-left: 10px; +} + +.@{prefix}-rtl .@{prefix}-colorbutton .@{prefix}-open { + padding-left: 4px; + padding-right: 4px; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ColorPicker.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ColorPicker.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,80 @@ +// ColorPicker + +.@{prefix}-colorpicker { + position: relative; + width: 250px; + height: 220px; +} + +.@{prefix}-colorpicker-sv { + position: absolute; + top: 0; left: 0; + width: 90%; + height: 100%; + border: 1px solid @colorpicker-border; + cursor: crosshair; + overflow: hidden; +} + +.@{prefix}-colorpicker-h-chunk { + width: 100%; +} + +.@{prefix}-colorpicker-overlay1, .@{prefix}-colorpicker-overlay2 { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; +} + +.@{prefix}-colorpicker-overlay1 { + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff'); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff')"; + background: linear-gradient(to right, rgba(255,255,255,1), rgba(255,255,255,0)); +} + +.@{prefix}-colorpicker-overlay2 { + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000'); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000')"; + background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,1)); +} + +.@{prefix}-colorpicker-selector1 { + background: none; + position: absolute; + width: 12px; + height: 12px; + margin: -8px 0 0 -8px; + border: 1px solid black; + border-radius: 50%; +} + +.@{prefix}-colorpicker-selector2 { + position: absolute; + width: 10px; + height: 10px; + border: 1px solid white; + border-radius: 50%; +} + +.@{prefix}-colorpicker-h { + position: absolute; + top: 0; right: 0; + width: 6.5%; + height: 100%; + border: 1px solid @colorpicker-border; + cursor: crosshair; +} + +.@{prefix}-colorpicker-h-marker { + margin-top: -4px; + position: absolute; + top: 0; + left: -1px; + width: 100%; + border: 1px solid @colorpicker-hue-border; + background: @colorpicker-hue-bg; + height: 4px; + z-index: 100; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ComboBox.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ComboBox.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,38 @@ +// ComboBox + +.@{prefix}-combobox { + .inline-block(); + .border-radius(3px); + .box-shadow(@textbox-box-shadow); + *height: 32px; +} + +.@{prefix}-combobox input { + border: 1px solid @textbox-border; + border-right-color: @combobox-border; + height: 28px; +} + +.@{prefix}-combobox.@{prefix}-disabled input { + color: mix(@text, @textbox-bg, 40%); +} + +.@{prefix}-combobox.@{prefix}-has-open input { + .border-radius(4px 0 0 4px); +} + +.@{prefix}-combobox .@{prefix}-btn { + border-left: 0; + .border-radius(0 4px 4px 0); +} + +.@{prefix}-combobox button { + padding-right: 8px; + padding-left: 8px; +} + +.@{prefix}-combobox.@{prefix}-disabled .@{prefix}-btn button { + cursor: default; + .box-shadow(none); + .opacity(@btn-box-disabled-opacity); +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Container.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Container.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,9 @@ +// Container + +.@{prefix}-container, .@{prefix}-container-body { + display: block; +} + +.@{prefix}-autoscroll { + overflow: hidden; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Content.Inline.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Content.Inline.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,3 @@ +/* Content.Inline.less */ + +@import "Content.Objects.less"; diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Content.Objects.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Content.Objects.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,82 @@ +/* Content.Objects.less */ + +.mce-object { + border: 1px dotted #3A3A3A; + background: #D5D5D5 url(img/object.gif) no-repeat center; +} + +.mce-pagebreak { + cursor: default; + display: block; + border: 0; + width: 100%; + height: 5px; + border: 1px dashed #666; + margin-top: 15px; + page-break-before: always; +} + +@media print { + .mce-pagebreak { + border: 0px; + } +} + +.mce-item-anchor { + cursor: default; + display: inline-block; + -webkit-user-select: all; + -webkit-user-modify: read-only; + -moz-user-select: all; + -moz-user-modify: read-only; + user-select: all; + user-modify: read-only; + width: 9px !important; + height: 9px !important; + border: 1px dotted #3A3A3A; + background: #D5D5D5 url(img/anchor.gif) no-repeat center; +} + +.mce-nbsp, .mce-shy { + background: #AAA; +} + +.mce-shy::after { + content: '-'; +} + +hr { + cursor: default; +} + +.mce-match-marker { + background: #AAA; + color: #fff; +} + +.mce-match-marker-selected { + background: #3399ff; + color: #fff; +} + +.mce-spellchecker-word { + border-bottom: 2px solid #F00; + cursor: default; +} + +.mce-spellchecker-grammar { + border-bottom: 2px solid #008000; + cursor: default; +} + +.mce-item-table, .mce-item-table td, .mce-item-table th, .mce-item-table caption { + border: 1px dashed #BBB; +} + +td.mce-item-selected, th.mce-item-selected { + background-color: #3399ff !important; +} + +.mce-edit-focus { + outline: 1px dotted #333; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Content.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Content.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,26 @@ +/* Content.less */ + +@font-family: Verdana, Arial, Helvetica, sans-serif; +@font-size: 11px; + +body { + background-color: #FFFFFF; + color: #000000; + font-family: @font-family; + font-size: @font-size; + scrollbar-3dlight-color: #F0F0EE; + scrollbar-arrow-color: #676662; + scrollbar-base-color: #F0F0EE; + scrollbar-darkshadow-color: #DDDDDD; + scrollbar-face-color: #E0E0DD; + scrollbar-highlight-color: #F0F0EE; + scrollbar-shadow-color: #F0F0EE; + scrollbar-track-color: #F5F5F5; +} + +td, th { + font-family: @font-family; + font-size: @font-size; +} + +@import "Content.Objects.less"; diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/FieldSet.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/FieldSet.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,15 @@ +// FieldSet + +.@{prefix}-fieldset { + border: 0 solid #9E9E9E; + .border-radius(3px); +} + +.@{prefix}-fieldset > .@{prefix}-container-body { + margin-top: -15px; +} + +.@{prefix}-fieldset-title { + margin-left: 5px; + padding: 0 5px 0 5px; +} \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/FitLayout.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/FitLayout.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,9 @@ +// FitLayout + +.@{prefix}-fit-layout { + .inline-block(); +} + +.@{prefix}-fit-layout-item { + position: absolute; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/FloatPanel.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/FloatPanel.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,69 @@ +// FloatPanel + +.@{prefix}-floatpanel { + position: absolute; + .box-shadow(@floatpanel-box-shadow); +} + +.@{prefix}-floatpanel.@{prefix}-fixed { + position: fixed; +} + +// Popover panel + +.@{prefix}-floatpanel .@{prefix}-arrow, +.@{prefix}-floatpanel .@{prefix}-arrow:after { + position: absolute; + display: block; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} + +.@{prefix}-floatpanel .@{prefix}-arrow { + border-width: @popover-arrow-outer-width; +} + +.@{prefix}-floatpanel .@{prefix}-arrow:after { + border-width: @popover-arrow-width; + content: ""; +} + +.@{prefix}-floatpanel.@{prefix}-popover { + .reset-gradient(); + .border-radius(6px); + .box-shadow(@floatpanel-box-shadow); + top: 0; + left: 0; + background: @popover-bg; + border: 1px solid @panel-border; + border: 1px solid @popover-arrow-outer; + + &.@{prefix}-bottom { + margin-top: @popover-arrow-width; + *margin-top: 0; + + & > .@{prefix}-arrow { + left: 50%; + margin-left: -@popover-arrow-outer-width; + border-top-width: 0; + border-bottom-color: @panel-border; + border-bottom-color: @popover-arrow-outer; + top: -@popover-arrow-outer-width; + + &:after { + top: 1px; + margin-left: -@popover-arrow-width; + border-top-width: 0; + border-bottom-color: @popover-arrow; + } + } + + &.@{prefix}-start { margin-left: -22px; } + &.@{prefix}-start > .@{prefix}-arrow { left: 20px; } + + &.@{prefix}-end { margin-left: 22px; } + &.@{prefix}-end > .@{prefix}-arrow { right: 10px; left: auto; } + } +} \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/FlowLayout.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/FlowLayout.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,36 @@ +// FlowLayout + +.@{prefix}-flow-layout-item { + .inline-block(); +} + +.@{prefix}-flow-layout-item { + margin: 2px 0 2px 2px; +} + +.@{prefix}-flow-layout-item.@{prefix}-last { + margin-right: 2px; +} + +.@{prefix}-flow-layout { + white-space: normal; +} + +.@{prefix}-tinymce-inline .@{prefix}-flow-layout { + white-space: nowrap; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-flow-layout { + text-align: right; + direction: rtl; +} + +.@{prefix}-rtl .@{prefix}-flow-layout-item { + margin: 2px 2px 2px 0; +} + +.@{prefix}-rtl .@{prefix}-flow-layout-item.@{prefix}-last { + margin-left: 2px; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Icons.Ie7.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Icons.Ie7.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,113 @@ +/* Icons IE7 */ + +@font-face { + font-family: 'tinymce'; + src:url('fonts/tinymce.eot'); + src:url('fonts/tinymce.eot?#iefix') format('embedded-opentype'), + url('fonts/tinymce.woff') format('woff'), + url('fonts/tinymce.ttf') format('truetype'), + url('fonts/tinymce.svg#tinymce') format('svg'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'tinymce-small'; + src:url('fonts/tinymce-small.eot'); + src:url('fonts/tinymce-small.eot?#iefix') format('embedded-opentype'), + url('fonts/tinymce-small.woff') format('woff'), + url('fonts/tinymce-small.ttf') format('truetype'), + url('fonts/tinymce-small.svg#tinymce') format('svg'); + font-weight: normal; + font-style: normal; +} + +@iconSize: 16px; + +.@{prefix}-ico { + font-family: 'tinymce'; + font-style: normal; + font-weight: normal; + font-size: @iconSize; + line-height: 16px; + vertical-align: text-top; + -webkit-font-smoothing: antialiased; + + display: inline-block; + background: transparent center center; + width: 16px; + height: 16px; + color: @btn-text; + -ie7-icon: ' '; +} + +.@{prefix}-btn-small .@{prefix}-ico { + font-family: 'tinymce-small'; +} + +// .@{prefix}-i-checkbox needs to have zoom overridden since it's set by the gradient mixin +.@{prefix}-ico, i.@{prefix}-i-checkbox { + zoom: ~"expression(this.runtimeStyle['zoom'] = '1', this.innerHTML = this.currentStyle['-ie7-icon'].substr(1, 1) + ' ')"; +} + +.@{prefix}-i-save { -ie7-icon: "\e000"; } +.@{prefix}-i-newdocument { -ie7-icon: "\e001"; } +.@{prefix}-i-fullpage { -ie7-icon: "\e002"; } +.@{prefix}-i-alignleft { -ie7-icon: "\e003"; } +.@{prefix}-i-aligncenter { -ie7-icon: "\e004"; } +.@{prefix}-i-alignright { -ie7-icon: "\e005"; } +.@{prefix}-i-alignjustify { -ie7-icon: "\e006"; } +.@{prefix}-i-cut { -ie7-icon: "\e007"; } +.@{prefix}-i-paste { -ie7-icon: "\e008"; } +.@{prefix}-i-searchreplace { -ie7-icon: "\e009"; } +.@{prefix}-i-bullist { -ie7-icon: "\e00a"; } +.@{prefix}-i-numlist { -ie7-icon: "\e00b"; } +.@{prefix}-i-indent { -ie7-icon: "\e00c"; } +.@{prefix}-i-outdent { -ie7-icon: "\e00d"; } +.@{prefix}-i-blockquote { -ie7-icon: "\e00e"; } +.@{prefix}-i-undo { -ie7-icon: "\e00f"; } +.@{prefix}-i-redo { -ie7-icon: "\e010"; } +.@{prefix}-i-link { -ie7-icon: "\e011"; } +.@{prefix}-i-unlink { -ie7-icon: "\e012"; } +.@{prefix}-i-anchor { -ie7-icon: "\e013"; } +.@{prefix}-i-image { -ie7-icon: "\e014"; } +.@{prefix}-i-media { -ie7-icon: "\e015"; } +.@{prefix}-i-help { -ie7-icon: "\e016"; } +.@{prefix}-i-code { -ie7-icon: "\e017"; } +.@{prefix}-i-insertdatetime { -ie7-icon: "\e018"; } +.@{prefix}-i-preview { -ie7-icon: "\e019"; } +.@{prefix}-i-forecolor { -ie7-icon: "\e01a"; } +.@{prefix}-i-backcolor { -ie7-icon: "\e01a"; } +.@{prefix}-i-table { -ie7-icon: "\e01b"; } +.@{prefix}-i-hr { -ie7-icon: "\e01c"; } +.@{prefix}-i-removeformat { -ie7-icon: "\e01d"; } +.@{prefix}-i-subscript { -ie7-icon: "\e01e"; } +.@{prefix}-i-superscript { -ie7-icon: "\e01f"; } +.@{prefix}-i-charmap { -ie7-icon: "\e020"; } +.@{prefix}-i-emoticons { -ie7-icon: "\e021"; } +.@{prefix}-i-print { -ie7-icon: "\e022"; } +.@{prefix}-i-fullscreen { -ie7-icon: "\e023"; } +.@{prefix}-i-spellchecker { -ie7-icon: "\e024"; } +.@{prefix}-i-nonbreaking { -ie7-icon: "\e025"; } +.@{prefix}-i-template { -ie7-icon: "\e026"; } +.@{prefix}-i-pagebreak { -ie7-icon: "\e027"; } +.@{prefix}-i-restoredraft { -ie7-icon: "\e028"; } +.@{prefix}-i-untitled { -ie7-icon: "\e029"; } +.@{prefix}-i-bold { -ie7-icon: "\e02a"; } +.@{prefix}-i-italic { -ie7-icon: "\e02b"; } +.@{prefix}-i-underline { -ie7-icon: "\e02c"; } +.@{prefix}-i-strikethrough { -ie7-icon: "\e02d"; } +.@{prefix}-i-visualchars { -ie7-icon: "\e02e"; } +.@{prefix}-i-ltr { -ie7-icon: "\e02f"; } +.@{prefix}-i-rtl { -ie7-icon: "\e030"; } +.@{prefix}-i-copy { -ie7-icon: "\e031"; } +.@{prefix}-i-resize { -ie7-icon: "\e032"; } +.@{prefix}-i-browse { -ie7-icon: "\e034"; } +.@{prefix}-i-pastetext { -ie7-icon: "\e035"; } + +.@{prefix}-i-checkbox, .@{prefix}-i-selected { + -ie7-icon: "\e033"; +} + +.@{prefix}-i-selected { visibility: hidden; } +.@{prefix}-i-backcolor { background: #BBB; } diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Icons.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Icons.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,112 @@ +/* Icons */ + +@font-face { + font-family: 'tinymce'; + src:url('fonts/tinymce.eot'); + src:url('fonts/tinymce.eot?#iefix') format('embedded-opentype'), + url('fonts/tinymce.woff') format('woff'), + url('fonts/tinymce.ttf') format('truetype'), + url('fonts/tinymce.svg#tinymce') format('svg'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'tinymce-small'; + src:url('fonts/tinymce-small.eot'); + src:url('fonts/tinymce-small.eot?#iefix') format('embedded-opentype'), + url('fonts/tinymce-small.woff') format('woff'), + url('fonts/tinymce-small.ttf') format('truetype'), + url('fonts/tinymce-small.svg#tinymce') format('svg'); + font-weight: normal; + font-style: normal; +} + +@iconSize: 16px; + +.@{prefix}-ico { + font-family: 'tinymce', Arial; + font-style: normal; + font-weight: normal; + font-variant: normal; + font-size: @iconSize; + line-height: 16px; + speak: none; + vertical-align: text-top; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + + display: inline-block; + background: transparent center center; + background-size: cover; + width: 16px; + height: 16px; + color: @btn-text; +} + +.@{prefix}-btn-small .@{prefix}-ico { + font-family: 'tinymce-small', Arial; +} + +.@{prefix}-i-save:before { content: "\e000"; } +.@{prefix}-i-newdocument:before { content: "\e001"; } +.@{prefix}-i-fullpage:before { content: "\e002"; } +.@{prefix}-i-alignleft:before { content: "\e003"; } +.@{prefix}-i-aligncenter:before { content: "\e004"; } +.@{prefix}-i-alignright:before { content: "\e005"; } +.@{prefix}-i-alignjustify:before { content: "\e006"; } +.@{prefix}-i-cut:before { content: "\e007"; } +.@{prefix}-i-paste:before { content: "\e008"; } +.@{prefix}-i-searchreplace:before { content: "\e009"; } +.@{prefix}-i-bullist:before { content: "\e00a"; } +.@{prefix}-i-numlist:before { content: "\e00b"; } +.@{prefix}-i-indent:before { content: "\e00c"; } +.@{prefix}-i-outdent:before { content: "\e00d"; } +.@{prefix}-i-blockquote:before { content: "\e00e"; } +.@{prefix}-i-undo:before { content: "\e00f"; } +.@{prefix}-i-redo:before { content: "\e010"; } +.@{prefix}-i-link:before { content: "\e011"; } +.@{prefix}-i-unlink:before { content: "\e012"; } +.@{prefix}-i-anchor:before { content: "\e013"; } +.@{prefix}-i-image:before { content: "\e014"; } +.@{prefix}-i-media:before { content: "\e015"; } +.@{prefix}-i-help:before { content: "\e016"; } +.@{prefix}-i-code:before { content: "\e017"; } +.@{prefix}-i-insertdatetime:before { content: "\e018"; } +.@{prefix}-i-preview:before { content: "\e019"; } +.@{prefix}-i-forecolor:before { content: "\e01a"; } +.@{prefix}-i-backcolor:before { content: "\e01a"; } +.@{prefix}-i-table:before { content: "\e01b"; } +.@{prefix}-i-hr:before { content: "\e01c"; } +.@{prefix}-i-removeformat:before { content: "\e01d"; } +.@{prefix}-i-subscript:before { content: "\e01e"; } +.@{prefix}-i-superscript:before { content: "\e01f"; } +.@{prefix}-i-charmap:before { content: "\e020"; } +.@{prefix}-i-emoticons:before { content: "\e021"; } +.@{prefix}-i-print:before { content: "\e022"; } +.@{prefix}-i-fullscreen:before { content: "\e023"; } +.@{prefix}-i-spellchecker:before { content: "\e024"; } +.@{prefix}-i-nonbreaking:before { content: "\e025"; } +.@{prefix}-i-template:before { content: "\e026"; } +.@{prefix}-i-pagebreak:before { content: "\e027"; } +.@{prefix}-i-restoredraft:before { content: "\e028"; } +.@{prefix}-i-untitled:before { content: "\e029"; } +.@{prefix}-i-bold:before { content: "\e02a"; } +.@{prefix}-i-italic:before { content: "\e02b"; } +.@{prefix}-i-underline:before { content: "\e02c"; } +.@{prefix}-i-strikethrough:before { content: "\e02d"; } +.@{prefix}-i-visualchars:before { content: "\e02e"; } +.@{prefix}-i-visualblocks:before { content: "\e02e"; } +.@{prefix}-i-ltr:before { content: "\e02f"; } +.@{prefix}-i-rtl:before { content: "\e030"; } +.@{prefix}-i-copy:before { content: "\e031"; } +.@{prefix}-i-resize:before { content: "\e032"; } +.@{prefix}-i-browse:before { content: "\e034"; } +.@{prefix}-i-pastetext:before { content: "\e035"; } + +.@{prefix}-i-checkbox:before, .@{prefix}-i-selected:before { + content: "\e033"; +} + +.@{prefix}-i-selected { visibility: hidden; } +i.@{prefix}-i-backcolor { text-shadow: none; background: @colorbtn-backcolor-bg; } diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Iframe.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Iframe.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,6 @@ +// Iframe + +.@{prefix}-iframe { + border: 0 solid @iframe-border; + width: 100%; height: 100%; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Label.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Label.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,30 @@ +// Label + +.@{prefix}-label { + .inline-block(); + text-shadow: @text-shadow; + overflow: hidden; +} + +.@{prefix}-label.@{prefix}-autoscroll { + overflow: auto; +} + +.@{prefix}-label.@{prefix}-disabled { + color: @text-disabled; +} + +.@{prefix}-label.@{prefix}-multiline { + white-space: pre-wrap; +} + +.@{prefix}-label.@{prefix}-error { + color: @text-error; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-label { + text-align: right; + direction: rtl; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ListBox.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ListBox.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,26 @@ +// ListBox + +.@{prefix}-listbox button { + text-align: left; + padding-right: 20px; + position: relative; +} + +.@{prefix}-listbox .@{prefix}-caret { + position: absolute; + margin-top: -2px; + right: 8px; + top: 50%; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-listbox .@{prefix}-caret { + right: auto; + left: 8px; +} + +.@{prefix}-rtl .@{prefix}-listbox button { + padding-right: 10px; + padding-left: 20px; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Menu.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Menu.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,34 @@ +// Menu + +.@{prefix}-menu { + position: absolute; + left: 0; top: 0; + .reset-gradient(); + z-index: 1000; + padding: 5px 0 5px 0; + margin: 2px 0 0; + min-width: 160px; + background: @menu-bg; + border: 1px solid mix(rgb(red(@menu-border), green(@menu-border), blue(@menu-border)), @panel-bg, round(alpha(@menu-border) * 200)); + border: 1px solid @menu-border; + z-index: 1002; + .border-radius(6px); + .box-shadow(0 5px 10px rgba(0,0,0,.2)); + max-height: 400px; + overflow: auto; + overflow-x: hidden; +} + +.@{prefix}-menu i { + display: none; +} + +.@{prefix}-menu-has-icons i { + display: inline-block; + *display: inline; +} + +.@{prefix}-menu-sub-tr-tl { margin: -6px 0 0 -1px; } +.@{prefix}-menu-sub-br-bl { margin: 6px 0 0 -1px; } +.@{prefix}-menu-sub-tl-tr { margin: -6px 0 0 1px; } +.@{prefix}-menu-sub-bl-br { margin: 6px 0 0 1px; } diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/MenuBar.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/MenuBar.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,28 @@ +/* MenuBar */ + +.@{prefix}-menubar .@{prefix}-menubtn { + border-color: transparent; + background: transparent; + .border-radius(0); + .box-shadow(none); + filter: none; +} + +.@{prefix}-menubar { + border: 1px solid @menubar-border; +} + +.@{prefix}-menubar .@{prefix}-menubtn button span { + color: @text; +} + +.@{prefix}-menubar .@{prefix}-caret { + border-top-color: @text; +} + +.@{prefix}-menubar .@{prefix}-menubtn:hover, .@{prefix}-menubar .@{prefix}-menubtn.@{prefix}-active, .@{prefix}-menubar .@{prefix}-menubtn:focus { + border-color: transparent; + background: @menubar-bg-active; + filter: none; + .box-shadow(none); +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/MenuButton.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/MenuButton.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,34 @@ +/* MenuButton */ + +.@{prefix}-menubtn span { + color: @btn-text; + margin-right: 2px; + line-height: @line-height; + *line-height: @line-height - 4px; +} + +.@{prefix}-menubtn.@{prefix}-btn-small span { + font-size: @font-size - 2px; +} + +.@{prefix}-menubtn.@{prefix}-fixed-width span { + display: inline-block; + overflow-x: hidden; + text-overflow: ellipsis; + width: 90px; +} + +.@{prefix}-menubtn.@{prefix}-fixed-width.@{prefix}-btn-small span { + width: 70px; +} + +.@{prefix}-menubtn .@{prefix}-caret { + *margin-top: 6px; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-menubtn button { + direction: rtl; + text-align: right; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/MenuItem.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/MenuItem.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,142 @@ +// MenuItem + +.@{prefix}-menu-item { + display: block; + padding: 6px 15px 6px 12px; + clear: both; + font-weight: normal; + line-height: 20px; + color: @menuitem-text; + white-space: nowrap; + cursor: pointer; + line-height: normal; + border-left: 4px solid transparent; + margin-bottom: 1px; +} + +.@{prefix}-menu-item .@{prefix}-ico, .@{prefix}-menu-item .@{prefix}-text { + color: @menuitem-text; +} + +.@{prefix}-menu-item.@{prefix}-disabled .@{prefix}-text, .@{prefix}-menu-item.@{prefix}-disabled .@{prefix}-ico { + color: mix(@menuitem-text, @menu-bg, 40%); +} + +.@{prefix}-menu-item:hover .@{prefix}-text, .@{prefix}-menu-item.@{prefix}-selected .@{prefix}-text, .@{prefix}-menu-item:focus .@{prefix}-text { + color: @menuitem-text-inverse; +} + +.@{prefix}-menu-item:hover .@{prefix}-ico, .@{prefix}-menu-item.@{prefix}-selected .@{prefix}-ico, .@{prefix}-menu-item:focus .@{prefix}-ico { + color: @menuitem-text-inverse; +} + +.@{prefix}-menu-item.@{prefix}-disabled:hover { + background: @menuitem-bg-disabled; +} + +.@{prefix}-menu-shortcut { + display: inline-block; + color: mix(@menuitem-text, @menu-bg, 40%); +} + +.@{prefix}-menu-shortcut { + .inline-block(); + padding: 0 15px 0 20px; +} + +.@{prefix}-menu-item:hover .@{prefix}-menu-shortcut, .@{prefix}-menu-item.@{prefix}-selected .@{prefix}-menu-shortcut, .@{prefix}-menu-item:focus .@{prefix}-menu-shortcut { + color: @menuitem-text-inverse; +} + +.@{prefix}-menu-item .@{prefix}-caret { + margin-top: 4px; + *margin-top: 3px; + margin-right: 6px; + border-top: 4px solid transparent; + border-bottom: 4px solid transparent; + border-left: 4px solid @menuitem-caret; +} + +.@{prefix}-menu-item.@{prefix}-selected .@{prefix}-caret, .@{prefix}-menu-item:focus .@{prefix}-caret, .@{prefix}-menu-item:hover .@{prefix}-caret { + border-left-color: @menuitem-caret-selected; +} + +.@{prefix}-menu-align .@{prefix}-menu-shortcut { + *margin-top: -2px; +} + +.@{prefix}-menu-align .@{prefix}-menu-shortcut, .@{prefix}-menu-align .@{prefix}-caret { + position: absolute; + right: 0; +} + +.@{prefix}-menu-item.@{prefix}-active i { + visibility: visible; +} + +.@{prefix}-menu-item-normal.@{prefix}-active { + background-color: @menuitem-bg-active; +} + +.@{prefix}-menu-item-preview.@{prefix}-active { + border-left: 5px solid @menuitem-preview-border-active; +} + +.@{prefix}-menu-item-normal.@{prefix}-active .@{prefix}-text { + color: @menuitem-text-active; +} + +.@{prefix}-menu-item-normal.@{prefix}-active:hover .@{prefix}-text, .@{prefix}-menu-item-normal.@{prefix}-active:hover .@{prefix}-ico { + color: @menuitem-text-inverse; +} + +.@{prefix}-menu-item-normal.@{prefix}-active:focus .@{prefix}-text, .@{prefix}-menu-item-normal.@{prefix}-active:focus .@{prefix}-ico { + color: @menuitem-text-inverse; +} + +.@{prefix}-menu-item:hover, .@{prefix}-menu-item.@{prefix}-selected, .@{prefix}-menu-item:focus { + text-decoration: none; + color: @menuitem-text-inverse; + .vertical-gradient(@menuitem-bg-selected, @menuitem-bg-selected-hlight); +} + +div.@{prefix}-menu .@{prefix}-menu-item-sep, .@{prefix}-menu-item-sep:hover { + border: 0; + padding: 0; + height: 1px; + margin: 9px 1px; + overflow: hidden; + background: @menuitem-separator-top; + border-bottom: 1px solid @menuitem-separator-bottom; + cursor: default; + filter: none; +} + +// RTL + +.@{prefix}-menu.@{prefix}-rtl { + direction: rtl; +} + +.@{prefix}-rtl .@{prefix}-menu-item { + text-align: right; + direction: rtl; + padding: 6px 12px 6px 15px; +} + +.@{prefix}-menu-align.@{prefix}-rtl .@{prefix}-menu-shortcut, .@{prefix}-menu-align.@{prefix}-rtl .@{prefix}-caret { + right: auto; + left: 0; +} + +.@{prefix}-rtl .@{prefix}-menu-item .@{prefix}-caret { + margin-left: 6px; + margin-right: 0; + border-right: 4px solid @menuitem-caret; + border-left: 0; +} + +.@{prefix}-rtl .@{prefix}-menu-item.@{prefix}-selected .@{prefix}-caret, .@{prefix}-rtl .@{prefix}-menu-item:focus .@{prefix}-caret, .@{prefix}-rtl .@{prefix}-menu-item:hover .@{prefix}-caret { + border-left-color: transparent; + border-right-color: @menuitem-caret-selected; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Mixins.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Mixins.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,54 @@ +// Mixins + +.opacity(@opacity) { + opacity: @opacity; + @opacityie: @opacity * 100; + filter: ~"alpha(opacity=@{opacityie})"; + zoom: 1; +} + +.vertical-gradient(@startColor, @endColor) when (@has-gradients = true) { + background-color: mix(@startColor, @endColor, 60%); + background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+ + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+ + background-image: -webkit-linear-gradient(top, @startColor, @endColor); // Safari 5.1+, Chrome 10+ + background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10 + background-image: linear-gradient(to bottom, @startColor, @endColor); // Standard, IE10 + background-repeat: repeat-x; + filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)", argb(@startColor), argb(@endColor))); + zoom: 1; +} + +.vertical-gradient(@startColor, @endColor) when (@has-gradients = false) { + background-color: mix(@startColor, @endColor, 60%); +} + +.border-radius(@radius) when (@has-radius = true) { + -webkit-border-radius: @radius; + -moz-border-radius: @radius; + border-radius: @radius; +} + +.box-shadow(@shadowA, @shadowB:X, ...) when (@has-boxshadow = true) { + // Multiple shadow solution from http://toekneestuck.com/blog/2012/05/15/less-css-arguments-variable/ + @props: ~`"@{arguments}".replace(/[\[\]]|\,\sX/g, '')`; + -webkit-box-shadow: @props; + -moz-box-shadow: @props; + box-shadow: @props; +} + +.transition(@transition) { + -webkit-transition: @transition; + transition: @transition; +} + +.inline-block() { + display: inline-block; + *display: inline; + *zoom: 1; +} + +.reset-gradient() { + filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)")); + background: transparent; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Panel.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Panel.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,6 @@ +// Panel + +.@{prefix}-panel { + border: 0 solid @panel-border; + .vertical-gradient(@panel-bg, @panel-bg-hlight); +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Path.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Path.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,45 @@ +// Path + +.@{prefix}-path { + .inline-block(); + padding: 8px; + white-space: normal; +} + +.@{prefix}-path .@{prefix}-txt { + display: inline-block; + padding-right: 3px; +} + +.@{prefix}-path .@{prefix}-path-body { + display: inline-block; +} + +.@{prefix}-path-item { + .inline-block(); + cursor: pointer; + color: @path-text; +} + +.@{prefix}-path-item:hover { + text-decoration: underline; +} + +.@{prefix}-path-item:focus { + background: @path-bg-focus; + color: @path-text-focus; +} + +.@{prefix}-path .@{prefix}-divider { + display: inline; +} + +.@{prefix}-disabled .@{prefix}-path-item { + color: @text-disabled; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-path { + direction: rtl; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Radio.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Radio.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +// Radio - not implemented yet diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Reset.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Reset.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,32 @@ +// Reset + +.@{prefix}-container, .@{prefix}-container *, .@{prefix}-widget, .@{prefix}-widget *, .@{prefix}-reset { + margin: 0; padding: 0; border: 0; outline: 0; + vertical-align: top; background: transparent; + text-decoration: none; color: @text; + font-family: @font-family; + font-size: @font-size; text-shadow: none; float: none; + position: static; width: auto; height: auto; + white-space: nowrap; cursor: inherit; + -webkit-tap-highlight-color: transparent; + line-height: normal; font-weight: normal; + text-align: left; + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + box-sizing: content-box; + direction: ltr; + max-width: none; +} + +.@{prefix}-widget button { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} + +.@{prefix}-container *[unselectable] { + -moz-user-select: none; + -webkit-user-select: none; + -o-user-select: none; + user-select: none; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ResizeHandle.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ResizeHandle.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,18 @@ +.@{prefix}-container-body .@{prefix}-resizehandle { + position: absolute; + right: 0; + bottom: 0; + width: 16px; + height: 16px; + visibility: visible; + cursor: s-resize; + margin: 0; +} + +.@{prefix}-container-body .@{prefix}-resizehandle-both { + cursor: se-resize; +} + +i.@{prefix}-i-resize { + color: @text; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Scrollable.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Scrollable.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,44 @@ +// Scrollbar + +.@{prefix}-scrollbar { + position: absolute; + width: 7px; + height: 100%; + top: 2px; + right: 2px; + .opacity(0.4); +} + +.@{prefix}-scrollbar-h { + top: auto; + right: auto; + left: 2px; + bottom: 2px; + width: 100%; + height: 7px; +} + +.@{prefix}-scrollbar-thumb { + position: absolute; + background-color: #000; + border: 1px solid #888; + border-color: rgba(85, 85, 85, .6); + width: 5px; + height: 100%; + .border-radius(7px); +} + +.@{prefix}-scrollbar-h .@{prefix}-scrollbar-thumb { + width: 100%; + height: 5px; +} + +.@{prefix}-scrollbar:hover, .@{prefix}-scrollbar.@{prefix}-active { + background-color: #AAA; + .opacity(0.6); + .border-radius(7px); +} + +.@{prefix}-scroll { + position: relative; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Spacer.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Spacer.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,5 @@ +// Spacer + +.@{prefix}-spacer { + visibility: hidden; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/SplitButton.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/SplitButton.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,44 @@ +// SplitButton + +.@{prefix}-splitbtn .@{prefix}-open { + border-left: 1px solid transparent; + border-right: 1px solid transparent; +} + +.@{prefix}-splitbtn:hover .@{prefix}-open { + border-left-color: @btn-split-border; + border-right-color: @btn-split-border; +} + +.@{prefix}-splitbtn button { + padding-right: 4px; +} + +.@{prefix}-splitbtn .@{prefix}-open { + padding-left: 4px; +} + +.@{prefix}-splitbtn .@{prefix}-open.@{prefix}-active { + .box-shadow(inset 0 2px 4px rgba(0, 0, 0, .15), 0 1px 2px rgba(0, 0, 0 ,.05)); +} + +.@{prefix}-splitbtn.@{prefix}-btn-small .@{prefix}-open { + padding: 0 3px 0 3px; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-splitbtn { + direction: rtl; + text-align: right; +} + +.@{prefix}-rtl .@{prefix}-splitbtn button { + padding-right: 10px; + padding-left: 10px; +} + +.@{prefix}-rtl .@{prefix}-splitbtn .@{prefix}-open { + padding-left: 4px; + padding-right: 4px; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/StackLayout.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/StackLayout.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,5 @@ +// StackLayout + +.@{prefix}-stack-layout-item { + display: block; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/TabPanel.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/TabPanel.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,39 @@ +// TabPanel + +.@{prefix}-tabs { + display: block; + border-bottom: 1px solid @tab-border; +} + +.@{prefix}-tab { + .inline-block(); + border: 1px solid @tab-border; + border-width: 0 1px 0 0; + background: @tab-bg; + padding: 8px; + text-shadow: @text-shadow; + height: 13px; + cursor: pointer; +} + +.@{prefix}-tab:hover { + background: @tab-bg-hover; +} + +.@{prefix}-tab.@{prefix}-active { + background: @tab-bg-active; + border-bottom-color: transparent; + margin-bottom: -1px; + height: 14px; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-tabs { + text-align: right; + direction: rtl; +} + +.@{prefix}-rtl .@{prefix}-tab { + border-width: 0 0 0 1px; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/TextBox.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/TextBox.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,40 @@ +// TextBox + +.@{prefix}-textbox { + background: @textbox-bg; + border: 1px solid @textbox-border; + .border-radius(3px); + .box-shadow(@textbox-box-shadow); + display: inline-block; + .transition(~"border linear .2s, box-shadow linear .2s"); + height: 28px; + resize: none; + padding: 0 4px 0 4px; + white-space: pre-wrap; + *white-space: pre; + color: @text; +} + +.@{prefix}-textbox:focus, .@{prefix}-textbox.@{prefix}-focus { + border-color: @textbox-border-focus; + .box-shadow(inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px fadeout(@textbox-border-focus, 15%)); +} + +.@{prefix}-placeholder .@{prefix}-textbox { + color: @textbox-text-placeholder; +} + +.@{prefix}-textbox.@{prefix}-multiline { + padding: 4px; +} + +.@{prefix}-textbox.@{prefix}-disabled { + color: mix(@text, @textbox-bg, 40%); +} + +// RTL + +.@{prefix}-rtl .@{prefix}-textbox { + text-align: right; + direction: rtl; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Throbber.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Throbber.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,14 @@ +// Throbber + +.@{prefix}-throbber { + position: absolute; + top: 0; left: 0; + width: 100%; height: 100%; + .opacity(0.6); + background: @throbber-bg; +} + +.@{prefix}-throbber-inline { + position: static; + height: 50px; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/TinyMCE.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/TinyMCE.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,151 @@ +.@{prefix}-tinymce { + // Avoid FOUC + visibility: inherit !important; + position: relative; +} + +.@{prefix}-fullscreen { + border: 0; padding: 0; margin: 0; + overflow: hidden; + height: 100%; + z-index: 100; +} + +div.@{prefix}-fullscreen { + position: fixed; + top: 0; left: 0; + width: 100%; + height: auto; +} + +.@{prefix}-tinymce { + display: block; + .border-radius(2px); +} + +.@{prefix}-wordcount { + position: absolute; + top: 0; + right: 0; + padding: 8px; +} + +div.@{prefix}-edit-area { + background: #FFF; + filter: none; +} + +.@{prefix}-statusbar { + position: relative; +} + +.@{prefix}-statusbar .@{prefix}-container-body { + position: relative; +} + +.@{prefix}-fullscreen .@{prefix}-resizehandle { + display: none; +} + +// Charmap + +.@{prefix}-charmap { + border-collapse: collapse; +} + +.@{prefix}-charmap td { + cursor: default; + border: 1px solid @panel-border; + width: 20px; + height: 20px; + line-height: 20px; + text-align: center; + vertical-align: middle; + padding: 2px; +} + +.@{prefix}-charmap td div { + text-align: center; +} + +.@{prefix}-charmap td:hover { + background: @btn-bg-hlight; +} + +.@{prefix}-grid td.@{prefix}-grid-cell div { + border: 1px solid @grid-border; + width: 15px; height: 15px; + margin: 0px; + cursor: pointer; + + &:focus { + border-color: @grid-border-active; + } + + &[disabled] { + cursor: not-allowed; + } +} + +.@{prefix}-grid { + border-spacing: 2px; + border-collapse: separate; + + a { + display: block; + border: 1px solid transparent; + + &:hover, &:focus { + border-color: @grid-border-active; + } + } +} + +.@{prefix}-grid-border { + margin: 0 4px 0 4px; + + a { + border-color: @grid-border; + width: 13px; height: 13px; + } + + a:hover, a.@{prefix}-active { + border-color: @grid-border-active; + background: @grid-bg-active; + } +} + +.@{prefix}-text-center { + text-align: center; +} + +div.@{prefix}-tinymce-inline { + width: 100%; + .box-shadow(none); +} + +.@{prefix}-colorbtn-trans div { + text-align: center; + vertical-align: middle; + font-weight: bold; + font-size: 20px; + line-height: 16px; + color: mix(@text, #fff, 70%); +} + +// Reduce double margins between toolbar rows + +.@{prefix}-toolbar-grp { + padding-bottom: 2px; +} + +.@{prefix}-toolbar-grp .@{prefix}-flow-layout-item { + margin-bottom: 0; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-wordcount { + left: 0; + right: auto; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ToolTip.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/ToolTip.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,129 @@ +// Tooltip + +.@{prefix}-tooltip { + position: absolute; + padding: 5px; + .opacity(0.8); +} + +.@{prefix}-tooltip-inner { + font-size: @tooltip-font-size; + background-color: @tooltip-bg; + color: @tooltip-text; + max-width: 200px; + padding: 5px 8px 4px 8px; + text-align: center; + white-space: normal; +} + +.@{prefix}-tooltip-inner { + .border-radius(3px); +} + +.@{prefix}-tooltip-inner { + .box-shadow(0 0 5px @tooltip-bg); +} + +.@{prefix}-tooltip-arrow { + position: absolute; + width: 0; + height: 0; + line-height: 0; + border: 5px dashed @tooltip-bg; +} + +.@{prefix}-tooltip-arrow-n { + border-bottom-color: @tooltip-bg; +} + +.@{prefix}-tooltip-arrow-s { + border-top-color: @tooltip-bg; +} + +.@{prefix}-tooltip-arrow-e { + border-left-color: @tooltip-bg; +} + +.@{prefix}-tooltip-arrow-w { + border-right-color: @tooltip-bg; +} + +.@{prefix}-tooltip-nw, .@{prefix}-tooltip-sw { + margin-left: -14px; +} + +.@{prefix}-tooltip-n .@{prefix}-tooltip-arrow { + top: 0px; + left: 50%; + margin-left: -5px; + border-bottom-style: solid; + border-top: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-nw .@{prefix}-tooltip-arrow { + top: 0; + left: 10px; + border-bottom-style: solid; + border-top: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-ne .@{prefix}-tooltip-arrow { + top: 0; + right: 10px; + border-bottom-style: solid; + border-top: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-s .@{prefix}-tooltip-arrow { + bottom: 0; + left: 50%; + margin-left: -5px; + border-top-style: solid; + border-bottom: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-sw .@{prefix}-tooltip-arrow { + bottom: 0; + left: 10px; + border-top-style: solid; + border-bottom: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-se .@{prefix}-tooltip-arrow { + bottom: 0; + right: 10px; + border-top-style: solid; + border-bottom: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-e .@{prefix}-tooltip-arrow { + right: 0; + top: 50%; + margin-top: -5px; + border-left-style: solid; + border-right: none; + border-top-color: transparent; + border-bottom-color: transparent; +} + +.@{prefix}-tooltip-w .@{prefix}-tooltip-arrow { + left: 0; + top: 50%; + margin-top: -5px; + border-right-style: solid; + border-left: none; + border-top-color: transparent; + border-bottom-color: transparent; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Variables.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Variables.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,147 @@ +// Variables +// Syntax: -()--()-(); +// Example: @btn-primary-bg-hover-hlight; + +@prefix: mce; + +// Default font +@font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +@font-size: 14px; +@line-height: 20px; +@has-gradients: true; +@has-radius: true; +@has-boxshadow: true; + +// Text colors +@text: #333; +@text-inverse: white; +@text-disabled: #aaa; +@text-shadow: 0 1px 1px hsla(hue(@text-inverse), saturation(@text-inverse), lightness(@text-inverse), 0.75); +@text-error: #aa0000; + +// Button +@btn-text: @text; +@btn-text-shadow: @text-inverse; +@btn-border-top: rgba(0, 0, 0, .1); +@btn-border-right: rgba(0, 0, 0, .1); +@btn-border-bottom: fadein(rgba(0, 0, 0, .1), 15%); +@btn-border-left: fadein(rgba(0, 0, 0, .1), 15%); +@btn-split-border: #bdbdbd; +@btn-caret-border: @btn-text; +@btn-text-disabled: @text-disabled; +@btn-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 1px 2px rgba(0, 0, 0, .05); +@btn-box-shadow-active: inset 0 2px 4px rgba(0, 0, 0, .15), 0 1px 2px rgba(0, 0, 0, .05); +@btn-box-disabled-opacity: 0.4; +@btn-bg: white; +@btn-bg-hlight: #D9D9D9; +@btn-bg-hover: darken(@btn-bg, 5%); +@btn-bg-hlight-hover: darken(@btn-bg-hlight, 5%); + +@btn-primary-bg: #0088cc; +@btn-primary-bg-hlight: #0044cc; +@btn-primary-bg-hover: darken(@btn-primary-bg, 5%); +@btn-primary-bg-hover-hlight: darken(@btn-primary-bg-hlight, 5%); +@btn-primary-text: #fff; +@btn-primary-text-shadow: #333; +@btn-primary-border-top: mix(@btn-border-top, @btn-primary-bg, 50%); +@btn-primary-border-right: mix(@btn-border-right, @btn-primary-bg, 50%); +@btn-primary-border-bottom: mix(@btn-border-bottom, @btn-primary-bg, 50%); +@btn-primary-border-left: mix(@btn-border-left, @btn-primary-bg, 50%); + +// Menu +@menuitem-text: @text; +@menu-bg: #fff; +@menu-border: rgba(0, 0, 0, 0.2); +@menubar-border: mix(@panel-border, @panel-bg, 60%); +@menuitem-text-inverse: @text-inverse; +@menubar-bg-active: darken(@btn-bg, 10%); +@menuitem-bg-hover: #0081C2; +@menuitem-bg-selected: #08C; +@menuitem-bg-selected-hlight: #0077B3; +@menuitem-bg-disabled: #CCC; +@menuitem-caret: @menuitem-text; +@menuitem-caret-selected: @menuitem-text-inverse; +@menuitem-separator-top: #CBCBCB; +@menuitem-separator-bottom: @menu-bg; +@menuitem-bg-active: #C8DEF4; +@menuitem-text-active: @text; +@menuitem-preview-border-active: #aaa; + +// Panel +@panel-border: #9E9E9E; +@panel-bg: #FDFDFD; +@panel-bg-hlight: #DDD; + +// Tabs +@tab-border: #c5c5c5; +@tab-bg: #e3e3e3; +@tab-bg-hover: #FDFDFD; +@tab-bg-active: #FDFDFD; + +// Tooltip +@tooltip-bg: #000; +@tooltip-text: white; +@tooltip-font-size: 11px; + +// Window +@window-border: #c5c5c5; +@window-head-border: @window-border; +@window-head-close: mix(@text, @window-bg, 60%); +@window-head-close-hover: mix(@text, @window-bg, 40%); +@window-foot-border: @window-border; +@window-foot-bg: @window-bg; +@window-fullscreen-bg: #FFF; +@window-modalblock-bg: #000; +@window-modalblock-opacity: 0.3; +@window-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); +@window-bg: #FFF; +@window-title-font-size: 20px; + +// Popover +@popover-bg: @window-bg; +@popover-arrow-width: 10px; +@popover-arrow: @window-bg; +@popover-arrow-outer-width: @popover-arrow-width + 1; +@popover-arrow-outer: rgba(0, 0, 0, 0.25); + +// Floatpanel +@floatpanel-box-shadow: 0 5px 10px rgba(0, 0, 0, .2); + +// Checkbox +@checkbox-bg: @btn-bg; +@checkbox-bg-hlight: @btn-bg-hlight; +@checkbox-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 1px 2px rgba(0, 0, 0, .05); +@checkbox-border: #c5c5c5; +@checkbox-border-focus: rgba(82, 168, 236, .8); + +// Path +@path-text: @text; +@path-bg-focus: #666; +@path-text-focus: #fff; + +// Textbox +@textbox-text-placeholder: #aaa; +@textbox-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +@textbox-bg: #fff; +@textbox-border: #c5c5c5; +@textbox-border-focus: rgba(82, 168, 236, .8); + +// Throbber +@throbber-bg: #fff url('img/loader.gif') no-repeat center center; + +// Combobox +@combobox-border: @textbox-border; + +// Colorpicker +@colorpicker-border: @textbox-border; +@colorpicker-hue-bg: #fff; +@colorpicker-hue-border: #333; + +// Grid +@grid-bg-active: @menuitem-bg-active; +@grid-border-active: #a1a1a1; +@grid-border: #d6d6d6; + +// Misc +@colorbtn-backcolor-bg: #BBB; +@iframe-border: @panel-border; diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Window.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/Window.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,123 @@ +// Window + +.@{prefix}-fullscreen { + border: 0; padding: 0; margin: 0; + overflow: hidden; + background: @window-fullscreen-bg; + height: 100%; +} + +div.@{prefix}-fullscreen { + position: fixed; + top: 0; left: 0; +} + +#@{prefix}-modal-block { + .opacity(0); + position: fixed; + left: 0; top: 0; + width: 100%; height: 100%; + background: @window-modalblock-bg; +} + +#@{prefix}-modal-block.@{prefix}-in { + .opacity(@window-modalblock-opacity); +} + +.@{prefix}-window-move { + cursor: move; +} + +.@{prefix}-window { + .border-radius(6px); + .box-shadow(@window-box-shadow); + .reset-gradient(); + background: @window-bg; + position: fixed; + top: 0; left: 0; + opacity: 0; + .transition(opacity 150ms ease-in); +} + +.@{prefix}-window.@{prefix}-in { + opacity: 1; +} + +.@{prefix}-window-head { + padding: 9px 15px; + border-bottom: 1px solid @window-head-border; + position: relative; +} + +.@{prefix}-window-head .@{prefix}-close { + position: absolute; + right: 15px; + top: 9px; + font-size: 20px; + font-weight: bold; + line-height: 20px; + color: @window-head-close; + cursor: pointer; + + // IE7 + height: 20px; + overflow: hidden; +} + +.@{prefix}-close:hover { + color: @window-head-close-hover; +} + +.@{prefix}-window-head .@{prefix}-title { + line-height: 20px; + font-size: @window-title-font-size; + font-weight: bold; + text-rendering: optimizelegibility; + padding-right: 10px; +} + +.@{prefix}-window .@{prefix}-container-body { + display: block; +} + +.@{prefix}-foot { + display: block; + background-color: @window-foot-bg; + border-top: 1px solid @window-foot-border; + .border-radius(0 0 6px 6px); +} + +.@{prefix}-window-head .@{prefix}-dragh { + position: absolute; + top: 0; left: 0; + cursor: move; + width: 90%; + height: 100%; +} + +.@{prefix}-window iframe { + width: 100%; + height: 100%; +} + +.@{prefix}-window.@{prefix}-fullscreen, .@{prefix}-window.@{prefix}-fullscreen .@{prefix}-foot { + .border-radius(0); +} + +// RTL + +.@{prefix}-rtl .@{prefix}-window-head .@{prefix}-close { + position: absolute; + right: auto; + left: 15px; +} + +.@{prefix}-rtl .@{prefix}-window-head .@{prefix}-dragh { + left: auto; + right: 0; +} + +.@{prefix}-rtl .@{prefix}-window-head .@{prefix}-title { + direction: rtl; + text-align: right; +} diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/content.inline.min.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/content.inline.min.css Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +.mce-object{border:1px dotted #3A3A3A;background:#d5d5d5 url(img/object.gif) no-repeat center}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px!important;height:9px!important;border:1px dotted #3A3A3A;background:#d5d5d5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}hr{cursor:default}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#39f;color:#fff}.mce-spellchecker-word{border-bottom:2px solid red;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid green;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td.mce-item-selected,th.mce-item-selected{background-color:#39f!important}.mce-edit-focus{outline:1px dotted #333} \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/content.min.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/content.min.css Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +body{background-color:#FFF;color:#000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px;scrollbar-3dlight-color:#F0F0EE;scrollbar-arrow-color:#676662;scrollbar-base-color:#F0F0EE;scrollbar-darkshadow-color:#DDD;scrollbar-face-color:#E0E0DD;scrollbar-highlight-color:#F0F0EE;scrollbar-shadow-color:#F0F0EE;scrollbar-track-color:#F5F5F5}td,th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px}.mce-object{border:1px dotted #3A3A3A;background:#d5d5d5 url(img/object.gif) no-repeat center}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px!important;height:9px!important;border:1px dotted #3A3A3A;background:#d5d5d5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}hr{cursor:default}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#39f;color:#fff}.mce-spellchecker-word{border-bottom:2px solid red;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid green;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td.mce-item-selected,th.mce-item-selected{background-color:#39f!important}.mce-edit-focus{outline:1px dotted #333} \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/readme.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/readme.md Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +Icons are generated and provided by the http://icomoon.io service. diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce-small.eot Binary file src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce-small.eot has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce-small.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce-small.json Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1194 @@ +{ + "IcoMoonType": "selection", + "icons": [ + { + "icon": { + "paths": [ + "M704 832v-37.004c151.348-61.628 256-193.82 256-346.996 0-212.078-200.576-384-448-384s-448 171.922-448 384c0 153.176 104.654 285.368 256 346.996v37.004h-192l-64-96v224h320v-222.812c-100.9-51.362-170.666-161.54-170.666-289.188 0-176.732 133.718-320 298.666-320 164.948 0 298.666 143.268 298.666 320 0 127.648-69.766 237.826-170.666 289.188v222.812h320v-224l-64 96h-192z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57376, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 0, + "order": 1, + "prevSize": 32, + "code": 57376, + "name": "charmap", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 0 + }, + { + "icon": { + "paths": [ + "M256 64v896l256-256 256 256v-896h-512zM704 789.49l-192-192-192 192v-661.49h384v661.49z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57363, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 1, + "order": 2, + "prevSize": 32, + "code": 57363, + "name": "bookmark", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 1 + }, + { + "icon": { + "paths": [ + "M927.274 230.216l-133.49-133.488c-21.104-21.104-49.232-32.728-79.198-32.728s-58.094 11.624-79.196 32.726l-165.492 165.49c-43.668 43.668-43.668 114.724 0 158.392l2.746 2.746 67.882-67.882-2.746-2.746c-6.132-6.132-6.132-16.494 0-22.626l165.492-165.492c4.010-4.008 8.808-4.608 11.312-4.608s7.302 0.598 11.312 4.61l133.49 133.488c6.132 6.134 6.132 16.498 0.002 22.628l-165.494 165.494c-4.008 4.008-8.806 4.608-11.31 4.608s-7.302-0.6-11.312-4.612l-2.746-2.746-67.88 67.884 2.742 2.742c21.106 21.108 49.23 32.728 79.2 32.728s58.094-11.624 79.196-32.726l165.494-165.492c43.662-43.666 43.662-114.72-0.004-158.39zM551.356 600.644l-67.882 67.882 2.746 2.746c4.008 4.008 4.61 8.806 4.61 11.31 0 2.506-0.598 7.302-4.606 11.314l-165.494 165.49c-4.010 4.010-8.81 4.61-11.314 4.61s-7.304-0.6-11.314-4.61l-133.492-133.486c-4.010-4.010-4.61-8.81-4.61-11.314s0.598-7.3 4.61-11.312l165.49-165.488c4.010-4.012 8.81-4.612 11.314-4.612s7.304 0.6 11.314 4.612l2.746 2.742 67.882-67.88-2.746-2.746c-21.104-21.104-49.23-32.726-79.196-32.726s-58.092 11.624-79.196 32.726l-165.488 165.486c-21.106 21.104-32.73 49.234-32.73 79.198s11.624 58.094 32.726 79.198l133.49 133.49c21.106 21.102 49.232 32.726 79.198 32.726s58.092-11.624 79.196-32.726l165.494-165.492c21.104-21.104 32.722-49.23 32.722-79.196s-11.624-58.094-32.726-79.196l-2.744-2.746zM800 838c-9.724 0-19.45-3.708-26.87-11.13l-128-127.998c-14.844-14.84-14.844-38.898 0-53.738 14.84-14.844 38.896-14.844 53.736 0l128 128c14.844 14.84 14.844 38.896 0 53.736-7.416 7.422-17.142 11.13-26.866 11.13zM608 960c-17.674 0-32-14.326-32-32v-128c0-17.674 14.326-32 32-32s32 14.326 32 32v128c0 17.674-14.326 32-32 32zM928 640h-128c-17.674 0-32-14.326-32-32s14.326-32 32-32h128c17.674 0 32 14.326 32 32s-14.326 32-32 32zM224 186c9.724 0 19.45 3.708 26.87 11.13l128 128c14.842 14.84 14.842 38.898 0 53.738-14.84 14.844-38.898 14.844-53.738 0l-128-128c-14.842-14.84-14.842-38.898 0-53.738 7.418-7.422 17.144-11.13 26.868-11.13zM416 64c17.674 0 32 14.326 32 32v128c0 17.674-14.326 32-32 32s-32-14.326-32-32v-128c0-17.674 14.326-32 32-32zM96 384h128c17.674 0 32 14.326 32 32s-14.326 32-32 32h-128c-17.674 0-32-14.326-32-32s14.326-32 32-32z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57362, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 2, + "order": 3, + "prevSize": 32, + "code": 57362, + "name": "link", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 2 + }, + { + "icon": { + "paths": [ + "M927.274 230.216l-133.49-133.488c-21.104-21.104-49.232-32.728-79.198-32.728s-58.094 11.624-79.196 32.726l-165.492 165.49c-43.668 43.668-43.668 114.724 0 158.392l2.746 2.746 67.882-67.882-2.746-2.746c-6.132-6.132-6.132-16.494 0-22.626l165.492-165.492c4.010-4.008 8.808-4.608 11.312-4.608s7.302 0.598 11.312 4.61l133.49 133.488c6.132 6.134 6.132 16.498 0.002 22.628l-165.494 165.494c-4.008 4.008-8.806 4.608-11.31 4.608s-7.302-0.6-11.312-4.612l-2.746-2.746-67.88 67.884 2.742 2.742c21.106 21.108 49.23 32.728 79.2 32.728s58.094-11.624 79.196-32.726l165.494-165.492c43.662-43.666 43.662-114.72-0.004-158.39zM551.356 600.644l-67.882 67.882 2.746 2.746c4.008 4.008 4.61 8.806 4.61 11.31 0 2.506-0.598 7.302-4.606 11.314l-165.494 165.49c-4.010 4.010-8.81 4.61-11.314 4.61s-7.304-0.6-11.314-4.61l-133.492-133.486c-4.010-4.010-4.61-8.81-4.61-11.314s0.598-7.3 4.61-11.312l165.49-165.488c4.010-4.012 8.81-4.612 11.314-4.612s7.304 0.6 11.314 4.612l2.746 2.742 67.882-67.88-2.746-2.746c-21.104-21.104-49.23-32.726-79.196-32.726s-58.092 11.624-79.196 32.726l-165.488 165.486c-21.106 21.104-32.73 49.234-32.73 79.198s11.624 58.094 32.726 79.198l133.49 133.49c21.106 21.102 49.232 32.726 79.198 32.726s58.092-11.624 79.196-32.726l165.494-165.492c21.104-21.104 32.722-49.23 32.722-79.196s-11.624-58.094-32.726-79.196l-2.744-2.746zM352 710c-9.724 0-19.45-3.71-26.87-11.128-14.84-14.84-14.84-38.898 0-53.738l320-320c14.84-14.84 38.896-14.84 53.736 0 14.844 14.84 14.844 38.9 0 53.74l-320 320c-7.416 7.416-17.142 11.126-26.866 11.126z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57361, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 3, + "order": 4, + "prevSize": 32, + "code": 57361, + "name": "unlink", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 3 + }, + { + "icon": { + "paths": [ + "M576 281.326v-217.326l336.002 336-336.002 336v-222.096c-390.906-9.17-315 247.096-256 446.096-288-320-212.092-690.874 256-678.674z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57360, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 4, + "order": 5, + "prevSize": 32, + "code": 57360, + "name": "redo", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 4 + }, + { + "icon": { + "paths": [ + "M704 960c59-199 134.906-455.266-256-446.096v222.096l-336.002-336 336.002-336v217.326c468.092-12.2 544 358.674 256 678.674z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57359, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 5, + "order": 6, + "prevSize": 32, + "code": 57359, + "name": "undo", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 5 + }, + { + "icon": { + "paths": [ + "M256.428 424.726c105.8 0 191.572 91.17 191.572 203.638 0 112.464-85.772 203.636-191.572 203.636-105.802 0-191.572-91.17-191.572-203.636l-0.856-29.092c0-224.93 171.54-407.272 383.144-407.272v116.364c-73.1 0-141.826 30.26-193.516 85.204-9.954 10.578-19.034 21.834-27.224 33.656 9.784-1.64 19.806-2.498 30.024-2.498zM768.428 424.726c105.8 0 191.572 91.17 191.572 203.638 0 112.464-85.772 203.636-191.572 203.636-105.802 0-191.572-91.17-191.572-203.636l-0.856-29.092c0-224.93 171.54-407.272 383.144-407.272v116.364c-73.1 0-141.826 30.26-193.516 85.204-9.956 10.578-19.036 21.834-27.224 33.656 9.784-1.64 19.806-2.498 30.024-2.498z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57358, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 6, + "order": 7, + "prevSize": 32, + "code": 57358, + "name": "blockquote", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 6 + }, + { + "icon": { + "paths": [ + "M64 192h896v128h-896zM384 576h576v128h-576zM384 384h576v128h-576zM64 768h896v128h-896zM64 384l224 160-224 160z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57356, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 7, + "order": 8, + "prevSize": 32, + "code": 57356, + "name": "indent", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 7 + }, + { + "icon": { + "paths": [ + "M64 192h896v128h-896zM64 576h576v128h-576zM64 384h576v128h-576zM64 768h896v128h-896zM960 384l-224 160 224 160z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57357, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 8, + "order": 9, + "prevSize": 32, + "code": 57357, + "name": "outdent", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 8 + }, + { + "icon": { + "paths": [ + "M384 128h576v128h-576zM384 448h576v128h-576zM384 768h576v128h-576zM320 530v-146h-64v-320h-128v64h64v256h-64v64h128v50l-128 60v146h128v64h-128v64h128v64h-128v64h192v-320h-128v-50z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57355, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 9, + "order": 10, + "prevSize": 32, + "code": 57355, + "name": "numlist", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 9 + }, + { + "icon": { + "paths": [ + "M384 128h576v128h-576zM384 448h576v128h-576zM384 768h576v128h-576zM128 192c0 35.346 28.654 64 64 64s64-28.654 64-64c0-35.346-28.654-64-64-64-35.346 0-64 28.654-64 64zM128 512c0 35.346 28.654 64 64 64s64-28.654 64-64c0-35.346-28.654-64-64-64-35.346 0-64 28.654-64 64zM128 832c0 35.346 28.654 64 64 64s64-28.654 64-64c0-35.346-28.654-64-64-64-35.346 0-64 28.654-64 64z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57354, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 10, + "order": 11, + "prevSize": 32, + "code": 57354, + "name": "bullist", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 10 + }, + { + "icon": { + "paths": [ + "M888 384h-56v-256h64v-64h-320v64h64v256h-256v-256h64v-64h-320v64h64v256h-56c-39.6 0-72 32.4-72 72v432c0 39.6 32.4 72 72 72h240c39.6 0 72-32.4 72-72v-312h128v312c0 39.6 32.4 72 72 72h240c39.6 0 72-32.4 72-72v-432c0-39.6-32.4-72-72-72zM348 896h-184c-19.8 0-36-14.4-36-32s16.2-32 36-32h184c19.8 0 36 14.4 36 32s-16.2 32-36 32zM544 512h-64c-17.6 0-32-14.4-32-32s14.4-32 32-32h64c17.6 0 32 14.4 32 32s-14.4 32-32 32zM860 896h-184c-19.8 0-36-14.4-36-32s16.2-32 36-32h184c19.8 0 36 14.4 36 32s-16.2 32-36 32z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57353, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 11, + "order": 12, + "prevSize": 32, + "code": 57353, + "name": "searchreplace", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 11 + }, + { + "icon": { + "paths": [ + "M704 384v-160c0-17.6-14.4-32-32-32h-160v-64c0-35.2-28.8-64-64-64h-128c-35.204 0-64 28.8-64 64v64h-160c-17.602 0-32 14.4-32 32v512c0 17.6 14.398 32 32 32h224v192h384l192-192v-384h-192zM320 128.114c0.034-0.038 0.072-0.078 0.114-0.114h127.768c0.042 0.036 0.082 0.076 0.118 0.114l0 63.886h-128v-63.886zM192 320v-64h384v64h-384zM704 869.49v-101.49h101.49l-101.49 101.49zM832 704h-192v192h-256v-448h448v256z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57352, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 12, + "order": 13, + "prevSize": 32, + "code": 57352, + "name": "paste", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 12 + }, + { + "icon": { + "paths": [ + "M832 320h-192v-64l-192-192h-384v704h384v192h576v-448l-192-192zM832 410.51l101.49 101.49h-101.49v-101.49zM448 154.51l101.49 101.49h-101.49v-101.49zM128 128h256v192h192v384h-448v-576zM960 896h-448v-128h128v-384h128v192h192v320z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57393, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 13, + "order": 14, + "prevSize": 32, + "code": 57393, + "name": "copy", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 13 + }, + { + "icon": { + "paths": [ + "M960 512h-265.876c-50.078-35.42-114.43-54.86-182.124-54.86-89.206 0-164.572-50.242-164.572-109.712 0-59.47 75.366-109.714 164.572-109.714 75.058 0 140.308 35.576 159.12 82.286h113.016c-7.93-50.644-37.58-97.968-84.058-132.826-50.88-38.16-117.676-59.174-188.078-59.174-70.404 0-137.196 21.014-188.074 59.174-54.788 41.090-86.212 99.502-86.212 160.254s31.424 119.164 86.212 160.254c1.956 1.466 3.942 2.898 5.946 4.316h-265.872v64h512.532c58.208 17.106 100.042 56.27 100.042 100.572 0 59.468-75.368 109.71-164.572 109.71-75.060 0-140.308-35.574-159.118-82.286h-113.016c7.93 50.64 37.582 97.968 84.060 132.826 50.876 38.164 117.668 59.18 188.072 59.18 70.402 0 137.198-21.016 188.074-59.174 54.79-41.090 86.208-99.502 86.208-160.254 0-35.298-10.654-69.792-30.294-100.572h204.012v-64z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57389, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 19, + "order": 15, + "prevSize": 32, + "code": 57389, + "name": "strikethrough", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 14 + }, + { + "icon": { + "paths": [ + "M192 832h576v64h-576v-64zM640 128v384c0 31.312-14.7 61.624-41.39 85.352-30.942 27.502-73.068 42.648-118.61 42.648-45.544 0-87.668-15.146-118.608-42.648-26.692-23.728-41.392-54.040-41.392-85.352v-384h-128v384c0 141.382 128.942 256 288 256s288-114.618 288-256v-384h-128z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57388, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 20, + "order": 16, + "prevSize": 32, + "code": 57388, + "name": "underline", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 15 + }, + { + "icon": { + "paths": [ + "M832 128v64h-144l-256 640h144v64h-448v-64h144l256-640h-144v-64h448z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57387, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 21, + "order": 17, + "prevSize": 32, + "code": 57387, + "name": "italic", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 16 + }, + { + "icon": { + "paths": [ + "M625.442 494.182c48.074-38.15 78.558-94.856 78.558-158.182 0-114.876-100.29-208-224-208h-224v768h288c123.712 0 224-93.124 224-208 0-88.196-59.118-163.562-142.558-193.818zM384 304c0-26.51 21.49-48 48-48h67.204c42.414 0 76.796 42.98 76.796 96s-34.382 96-76.796 96h-115.204v-144zM547.2 768h-115.2c-26.51 0-48-21.49-48-48v-144h163.2c42.418 0 76.8 42.98 76.8 96s-34.382 96-76.8 96z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57386, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 22, + "order": 18, + "prevSize": 32, + "code": 57386, + "name": "bold", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 17 + }, + { + "icon": { + "paths": [ + "M850.746 242.746l-133.492-133.49c-24.888-24.892-74.054-45.256-109.254-45.256h-416c-35.2 0-64 28.8-64 64v768c0 35.2 28.8 64 64 64h640c35.2 0 64-28.8 64-64v-544c0-35.2-20.366-84.364-45.254-109.254zM805.49 287.998c6.792 6.796 13.792 19.162 18.894 32.002h-184.384v-184.386c12.84 5.1 25.204 12.1 32 18.896l133.49 133.488zM831.884 896h-639.77c-0.040-0.034-0.082-0.076-0.114-0.116v-767.77c0.034-0.040 0.076-0.082 0.114-0.114h383.886v256h256v511.884c-0.034 0.040-0.076 0.082-0.116 0.116z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57345, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 23, + "order": 19, + "prevSize": 32, + "code": 57345, + "name": "newdocument", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 18 + }, + { + "icon": { + "paths": [ + "M960 880v-591.938l-223.938-224.062h-592.062c-44.182 0-80 35.816-80 80v736c0 44.184 35.818 80 80 80h736c44.184 0 80-35.816 80-80zM576 192h64v192h-64v-192zM704 832h-384v-255.882c0.034-0.042 0.076-0.082 0.116-0.118h383.77c0.040 0.036 0.082 0.076 0.116 0.118l-0.002 255.882zM832 832h-64v-256c0-35.2-28.8-64-64-64h-384c-35.2 0-64 28.8-64 64v256h-64v-640h64v192c0 35.2 28.8 64 64 64h320c35.2 0 64-28.8 64-64v-171.010l128 128.072v490.938z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57344, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 24, + "order": 20, + "prevSize": 32, + "code": 57344, + "name": "save", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 19 + }, + { + "icon": { + "paths": [ + "M64 192v704h896v-704h-896zM384 640v-128h256v128h-256zM640 704v128h-256v-128h256zM640 320v128h-256v-128h256zM320 320v128h-192v-128h192zM128 512h192v128h-192v-128zM704 512h192v128h-192v-128zM704 448v-128h192v128h-192zM128 704h192v128h-192v-128zM704 832v-128h192v128h-192z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57371, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 25, + "order": 21, + "prevSize": 32, + "code": 57371, + "name": "table", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 20 + }, + { + "icon": { + "paths": [ + "M512 140c99.366 0 192.782 38.694 263.042 108.956s108.958 163.678 108.958 263.044-38.696 192.782-108.958 263.042-163.676 108.958-263.042 108.958-192.782-38.696-263.044-108.958-108.956-163.676-108.956-263.042 38.694-192.782 108.956-263.044 163.678-108.956 263.044-108.956zM512 64c-247.424 0-448 200.576-448 448s200.576 448 448 448 448-200.576 448-448-200.576-448-448-448v0zM320 384c0 35.346 28.654 64 64 64s64-28.654 64-64c0-35.346-28.654-64-64-64-35.346 0-64 28.654-64 64zM576 384c0 35.346 28.654 64 64 64s64-28.654 64-64c0-35.346-28.654-64-64-64-35.346 0-64 28.654-64 64zM512 656c-101.84 0-192.56-36.874-251.166-94.328 23.126 117.608 126.778 206.328 251.166 206.328 124.388 0 228.040-88.72 251.168-206.328-58.608 57.454-149.328 94.328-251.168 94.328z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57377, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 26, + "order": 22, + "prevSize": 32, + "code": 57377, + "name": "emoticons", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 21 + }, + { + "icon": { + "paths": [ + "M480 384l-192-192 128-128h-352v352l128-128 192 192zM640 480l192-192 128 128v-352h-352l128 128-192 192zM544 640l192 192-128 128h352v-352l-128 128-192-192zM384 544l-192 192-128-128v352h352l-128-128 192-192z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57379, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 27, + "order": 23, + "prevSize": 32, + "code": 57379, + "name": "fullscreen", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 22 + }, + { + "icon": { + "paths": [ + "M64 448h896v128h-896z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57372, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 28, + "order": 24, + "prevSize": 32, + "code": 57372, + "name": "hr", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 23 + }, + { + "icon": { + "paths": [ + "M64 768h512v128h-512v-128zM768 192h-220.558l-183.766 512h-132.288l183.762-512h-223.15v-128h576v128zM929.774 896l-129.774-129.774-129.774 129.774-62.226-62.226 129.774-129.774-129.774-129.774 62.226-62.226 129.774 129.774 129.774-129.774 62.226 62.226-129.774 129.774 129.774 129.774-62.226 62.226z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57373, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 29, + "order": 25, + "prevSize": 32, + "code": 57373, + "name": "removefromat", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 24 + }, + { + "icon": { + "paths": [ + "M256 128h512v128h-512v-128zM896 320h-768c-35.2 0-64 28.8-64 64v256c0 35.2 28.796 64 64 64h128v192h512v-192h128c35.2 0 64-28.8 64-64v-256c0-35.2-28.8-64-64-64zM704 832h-384v-256h384v256zM910.4 416c0 25.626-20.774 46.4-46.398 46.4s-46.402-20.774-46.402-46.4 20.778-46.4 46.402-46.4c25.626 0 46.398 20.774 46.398 46.4z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57378, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 30, + "order": 26, + "prevSize": 32, + "code": 57378, + "name": "print", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 25 + }, + { + "icon": { + "paths": [ + "M384 128c-123.712 0-224 100.288-224 224s100.288 224 224 224v320h128v-640h64v640h128v-640h128v-128h-448z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57390, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 31, + "order": 27, + "prevSize": 32, + "code": 57390, + "name": "visualchars", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 26 + }, + { + "icon": { + "paths": [ + "M448 128c-123.712 0-224 100.288-224 224s100.288 224 224 224v320h128v-640h64v640h128v-640h128v-128h-448zM64 896l224-192-224-192z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57391, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 32, + "order": 28, + "prevSize": 32, + "code": 57391, + "name": "ltr", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 27 + }, + { + "icon": { + "paths": [ + "M416 704l-192-192 192-192-64-64-256 256 256 256zM672 256l-64 64 192 192-192 192 64 64 256-256z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57367, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 38, + "order": 29, + "prevSize": 32, + "code": 57367, + "name": "code", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 28 + }, + { + "icon": { + "paths": [ + "M448 704h128v128h-128v-128zM704 256c35.346 0 64 28.654 64 64v166l-228 154h-92v-64l192-128v-64h-320v-128h384zM512 64c-119.666 0-232.166 46.6-316.784 131.216-84.614 84.618-131.216 197.118-131.216 316.784 0 119.664 46.602 232.168 131.216 316.784 84.618 84.616 197.118 131.216 316.784 131.216 119.664 0 232.168-46.6 316.784-131.216 84.616-84.616 131.216-197.12 131.216-316.784 0-119.666-46.6-232.166-131.216-316.784-84.616-84.616-197.12-131.216-316.784-131.216z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57366, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 39, + "order": 30, + "prevSize": 32, + "code": 57366, + "name": "help", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 29 + }, + { + "icon": { + "paths": [ + "M896 128h-768c-35.2 0-64 28.8-64 64v640c0 35.2 28.8 64 64 64h768c35.2 0 64-28.8 64-64v-640c0-35.2-28.8-64-64-64zM896 831.884c-0.012 0.014-0.030 0.028-0.042 0.042l-191.958-319.926-160 128-224-288-191.968 479.916c-0.010-0.010-0.022-0.022-0.032-0.032v-639.77c0.034-0.040 0.076-0.082 0.114-0.114h767.77c0.040 0.034 0.082 0.076 0.116 0.116v639.768zM640 352c0 53.019 42.981 96 96 96s96-42.981 96-96c0-53.019-42.981-96-96-96-53.019 0-96 42.981-96 96z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57364, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 40, + "order": 31, + "prevSize": 32, + "code": 57364, + "name": "image", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 30 + }, + { + "icon": { + "paths": [ + "M896 128h-768c-35.2 0-64 28.8-64 64v640c0 35.2 28.8 64 64 64h768c35.2 0 64-28.8 64-64v-640c0-35.2-28.8-64-64-64zM256 832h-128v-128h128v128zM256 576h-128v-128h128v128zM256 320h-128v-128h128v128zM704 832h-384v-640h384v640zM896 832h-128v-128h128v128zM896 576h-128v-128h128v128zM896 320h-128v-128h128v128zM384 320v384l288-192z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57365, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 41, + "order": 32, + "prevSize": 32, + "code": 57365, + "name": "media", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 31 + }, + { + "icon": { + "paths": [ + "M77.798 304.624l81.414 50.882c50.802-81.114 128.788-143.454 221.208-174.246l-30.366-91.094c-113.748 37.898-209.728 114.626-272.256 214.458zM673.946 90.166l-30.366 91.094c92.422 30.792 170.404 93.132 221.208 174.248l81.412-50.882c-62.526-99.834-158.506-176.562-272.254-214.46zM607.974 704.008c-4.808 0-9.692-1.090-14.286-3.386l-145.688-72.844v-211.778c0-17.672 14.328-32 32-32s32 14.328 32 32v172.222l110.31 55.156c15.806 7.902 22.214 27.124 14.31 42.932-5.604 11.214-16.908 17.696-28.646 17.698zM512 192c-212.078 0-384 171.922-384 384s171.922 384 384 384c212.078 0 384-171.922 384-384 0-212.078-171.922-384-384-384zM512 864c-159.058 0-288-128.942-288-288s128.942-288 288-288c159.058 0 288 128.942 288 288 0 159.058-128.942 288-288 288z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57368, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 42, + "order": 33, + "prevSize": 32, + "code": 57368, + "name": "insertdatetime", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 32 + }, + { + "icon": { + "paths": [ + "M64 455.746c45.318-49.92 97.162-92.36 153.272-125.124 90.332-52.744 192.246-80.622 294.728-80.622 102.48 0 204.396 27.878 294.726 80.624 56.112 32.764 107.956 75.204 153.274 125.124v-117.432c-33.010-28.118-68.124-53.14-104.868-74.594-105.006-61.314-223.658-93.722-343.132-93.722s-238.128 32.408-343.134 93.72c-36.742 21.454-71.856 46.478-104.866 74.596v117.43zM512 320c-183.196 0-345.838 100.556-448 256 102.162 155.448 264.804 256 448 256 183.196 0 345.838-100.552 448-256-102.162-155.444-264.804-256-448-256zM512 512c0 35.346-28.654 64-64 64s-64-28.654-64-64c0-35.348 28.654-64 64-64s64 28.652 64 64zM728.066 696.662c-67.434 39.374-140.128 59.338-216.066 59.338s-148.632-19.964-216.066-59.338c-51.554-30.104-98.616-71.31-138.114-120.662 39.498-49.35 86.56-90.558 138.116-120.66 13.276-7.752 26.758-14.74 40.426-20.982-10.512 23.742-16.362 50.008-16.362 77.642 0 106.040 85.962 192 192 192 106.040 0 192-85.96 192-192 0-27.634-5.85-53.9-16.36-77.642 13.668 6.244 27.15 13.23 40.426 20.982 51.554 30.102 98.616 71.31 138.116 120.66-39.498 49.352-86.56 90.558-138.116 120.662z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57369, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 43, + "order": 34, + "prevSize": 32, + "code": 57369, + "name": "preview", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 33 + }, + { + "icon": { + "paths": [ + "M651.168 283.834c-24.612-81.962-28.876-91.834-107.168-91.834h-64c-79.618 0-82.664 10.152-108.418 96 0 0.002 0 0.002-0.002 0.004l-143.998 479.996h113.636l57.6-192h226.366l57.6 192h113.63l-145.246-484.166zM437.218 448l38.4-136c10.086-33.618 36.38-30 36.38-30s26.294-3.618 36.38 30h0.004l38.4 136h-149.564z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57370, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 44, + "order": 35, + "prevSize": 32, + "code": 57370, + "name": "forecolor", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 34 + }, + { + "icon": { + "paths": [ + "M576 64c247.424 0 448 200.576 448 448s-200.576 448-448 448v-96c94.024 0 182.418-36.614 248.902-103.098 66.484-66.484 103.098-154.878 103.098-248.902 0-94.022-36.614-182.418-103.098-248.902-66.484-66.484-154.878-103.098-248.902-103.098-94.022 0-182.418 36.614-248.902 103.098-51.14 51.138-84.582 115.246-97.306 184.902h186.208l-224 256-224-256h164.57c31.060-217.102 217.738-384 443.43-384zM768 448v128h-256v-320h128v192z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57384, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 45, + "order": 36, + "prevSize": 32, + "code": 57384, + "name": "restoredraft", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 35 + }, + { + "icon": { + "paths": [ + "M1024 592.458v-160.916l-159.144-15.914c-8.186-30.042-20.088-58.548-35.21-84.98l104.596-127.838-113.052-113.050-127.836 104.596c-26.434-15.124-54.942-27.026-84.982-35.208l-15.914-159.148h-160.916l-15.914 159.146c-30.042 8.186-58.548 20.086-84.98 35.208l-127.838-104.594-113.050 113.050 104.596 127.836c-15.124 26.432-27.026 54.94-35.21 84.98l-159.146 15.916v160.916l159.146 15.914c8.186 30.042 20.086 58.548 35.21 84.982l-104.596 127.836 113.048 113.048 127.838-104.596c26.432 15.124 54.94 27.028 84.98 35.21l15.916 159.148h160.916l15.914-159.144c30.042-8.186 58.548-20.088 84.982-35.21l127.836 104.596 113.048-113.048-104.596-127.836c15.124-26.434 27.028-54.942 35.21-84.98l159.148-15.92zM704 576l-128 128h-128l-128-128v-128l128-128h128l128 128v128z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57346, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 46, + "order": 37, + "prevSize": 32, + "code": 57346, + "name": "fullpage", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 36 + }, + { + "icon": { + "paths": [ + "M768 206v50h128v64h-192v-146l128-60v-50h-128v-64h192v146zM676 256h-136l-188 188-188-188h-136l256 256-256 256h136l188-188 188 188h136l-256-256z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57375, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 47, + "order": 38, + "prevSize": 32, + "code": 57375, + "name": "superscript", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 37 + }, + { + "icon": { + "paths": [ + "M768 910v50h128v64h-192v-146l128-60v-50h-128v-64h192v146zM676 256h-136l-188 188-188-188h-136l256 256-256 256h136l188-188 188 188h136l-256-256z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57374, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 48, + "order": 39, + "prevSize": 32, + "code": 57374, + "name": "subscript", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 38 + }, + { + "icon": { + "paths": [ + "M704 384v-160c0-17.6-14.4-32-32-32h-160v-64c0-35.2-28.8-64-64-64h-128c-35.204 0-64 28.8-64 64v64h-160c-17.602 0-32 14.4-32 32v512c0 17.6 14.398 32 32 32h224v192h576v-576h-192zM320 128.114c0.034-0.038 0.072-0.078 0.114-0.114h127.768c0.042 0.036 0.082 0.076 0.118 0.114l0 63.886h-128v-63.886zM192 320v-64h384v64h-384zM832 896h-448v-448h448v448zM448 512v128h32l32-64h64v192h-48v64h160v-64h-48v-192h64l32 64h32v-128z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "pastetext" + ], + "defaultCode": 57397, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 49, + "order": 40, + "prevSize": 32, + "code": 57397, + "name": "pastetext", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 39 + }, + { + "icon": { + "paths": [ + "M768 256h64v64h-64zM640 384h64v64h-64zM640 512h64v64h-64zM640 640h64v64h-64zM512 512h64v64h-64zM512 640h64v64h-64zM384 640h64v64h-64zM768 384h64v64h-64zM768 512h64v64h-64zM768 640h64v64h-64zM768 768h64v64h-64zM640 768h64v64h-64zM512 768h64v64h-64zM384 768h64v64h-64zM256 768h64v64h-64z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "resize", + "dots" + ], + "defaultCode": 57394, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 50, + "order": 41, + "prevSize": 32, + "code": 57394, + "name": "resize", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 40 + }, + { + "icon": { + "paths": [ + "M928 128h-416l-32-64h-352l-64 128h896zM840.34 704h87.66l32-448h-896l64 640h356.080c-104.882-37.776-180.080-138.266-180.080-256 0-149.982 122.018-272 272-272 149.98 0 272 122.018 272 272 0 21.678-2.622 43.15-7.66 64zM874.996 849.75l-134.496-110.692c17.454-28.922 27.5-62.814 27.5-99.058 0-106.040-85.96-192-192-192s-192 85.96-192 192 85.96 192 192 192c36.244 0 70.138-10.046 99.058-27.5l110.692 134.496c22.962 26.678 62.118 28.14 87.006 3.252l5.492-5.492c24.888-24.888 23.426-64.044-3.252-87.006zM576 764c-68.484 0-124-55.516-124-124s55.516-124 124-124 124 55.516 124 124-55.516 124-124 124z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "browse" + ], + "defaultCode": 57396, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 51, + "order": 42, + "prevSize": 32, + "code": 57396, + "name": "browse", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 41 + }, + { + "icon": { + "paths": [ + "M864.408 670.132c-46.47-46.47-106.938-68.004-161.082-62.806l-63.326-63.326 192-192c0 0 128-128 0-256l-320 320-320-320c-128 128 0 256 0 256l192 192-63.326 63.326c-54.144-5.198-114.61 16.338-161.080 62.806-74.98 74.98-85.112 186.418-22.626 248.9 62.482 62.482 173.92 52.354 248.9-22.626 46.47-46.468 68.002-106.938 62.806-161.080l63.326-63.326 63.328 63.328c-5.196 54.144 16.336 114.61 62.806 161.078 74.978 74.98 186.418 85.112 248.898 22.626 62.488-62.482 52.356-173.918-22.624-248.9zM353.124 758.578c-2.212 24.332-15.020 49.826-35.14 69.946-22.212 22.214-51.080 35.476-77.218 35.476-10.524 0-25.298-2.228-35.916-12.848-21.406-21.404-17.376-73.132 22.626-113.136 22.212-22.214 51.080-35.476 77.218-35.476 10.524 0 25.298 2.228 35.916 12.848 13.112 13.11 13.47 32.688 12.514 43.19zM512 608c-35.346 0-64-28.654-64-64s28.654-64 64-64 64 28.654 64 64-28.654 64-64 64zM819.152 851.152c-10.62 10.62-25.392 12.848-35.916 12.848-26.138 0-55.006-13.262-77.218-35.476-20.122-20.12-32.928-45.614-35.138-69.946-0.958-10.502-0.6-30.080 12.514-43.192 10.618-10.622 25.39-12.848 35.916-12.848 26.136 0 55.006 13.262 77.216 35.474 40.004 40.008 44.032 91.736 22.626 113.14z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57351, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 14, + "order": 43, + "prevSize": 32, + "code": 57351, + "name": "cut", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 42 + }, + { + "icon": { + "paths": [ + "M64 192h896v128h-896zM64 576h896v128h-896zM64 384h896v128h-896zM64 768h896v128h-896z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57350, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 15, + "order": 44, + "prevSize": 32, + "code": 57350, + "name": "alignjustify", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 43 + }, + { + "icon": { + "paths": [ + "M64 192h896v128h-896zM64 576h896v128h-896zM256 384h512v128h-512zM256 768h512v128h-512z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57348, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 16, + "order": 45, + "prevSize": 32, + "code": 57348, + "name": "aligncenter", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 44 + }, + { + "icon": { + "paths": [ + "M64 192h896v128h-896zM64 576h896v128h-896zM384 384h576v128h-576zM384 768h576v128h-576z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57349, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 17, + "order": 46, + "prevSize": 32, + "code": 57349, + "name": "alignright", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 45 + }, + { + "icon": { + "paths": [ + "M64 192h896v128h-896zM64 576h896v128h-896zM64 384h576v128h-576zM64 768h576v128h-576z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57347, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 18, + "order": 47, + "prevSize": 32, + "code": 57347, + "name": "alignleft", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 46 + }, + { + "icon": { + "paths": [ + "M320 128c-123.712 0-224 100.288-224 224s100.288 224 224 224v320h128v-640h64v640h128v-640h128v-128h-448zM960 512l-224 192 224 192z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57392, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 33, + "order": 48, + "prevSize": 32, + "code": 57392, + "name": "rtl", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 47 + }, + { + "icon": { + "paths": [ + "M512 384h128v64h-128zM512 768h128v64h-128zM576 576h128v64h-128zM768 576v192h-64v64h128v-256zM384 576h128v64h-128zM320 768h128v64h-128zM320 384h128v64h-128zM192 192v256h64v-192h64v-64zM704 448h128v-256h-64v192h-64zM64 64v896h896v-896h-896zM896 896h-768v-768h768v768zM192 576v256h64v-192h64v-64zM576 192h128v64h-128zM384 192h128v64h-128z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57382, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 34, + "order": 49, + "prevSize": 32, + "code": 57382, + "name": "template", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 48 + }, + { + "icon": { + "paths": [ + "M816 64l16 384h-640l16-384h32l16 320h512l16-320h32zM208 960l-16-320h640l-16 320h-32l-16-256h-512l-16 256h-32zM64 512h128v64h-128zM256 512h128v64h-128zM448 512h128v64h-128zM640 512h128v64h-128zM832 512h128v64h-128z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57383, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 35, + "order": 50, + "prevSize": 32, + "code": 57383, + "name": "pagebreak", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 49 + }, + { + "icon": { + "paths": [ + "M960 128v-64h-192c-35.202 0-64 28.8-64 64v320c0 15.856 5.858 30.402 15.496 41.614l-303.496 260.386-142-148-82 70 224 288 416-448h128v-64h-192v-320h192zM256 512h64v-384c0-35.2-28.8-64-64-64h-128c-35.2 0-64 28.8-64 64v384h64v-192h128v192zM128 256v-128h128v128h-128zM640 448v-96c0-35.2-8.8-64-44-64 35.2 0 44-28.8 44-64v-96c0-35.2-28.8-64-64-64h-192v448h192c35.2 0 64-28.8 64-64zM448 128h128v128h-128v-128zM448 320h128v128h-128v-128z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57380, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 36, + "order": 51, + "prevSize": 32, + "code": 57380, + "name": "spellcheck", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 50 + }, + { + "icon": { + "paths": [ + "M448 512h-128v-128h128v-128h128v128h128v128h-128v128h-128v-128zM960 576v320h-896v-320h128v192h640v-192h128z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57381, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 37, + "order": 52, + "prevSize": 32, + "code": 57381, + "name": "nonbreaking", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 51 + } + ], + "height": 1024, + "metadata": { + "name": "tinymce-small" + }, + "preferences": { + "showGlyphs": true, + "showQuickUse": true, + "showQuickUse2": true, + "showSVGs": true, + "fontPref": { + "prefix": "icon-", + "metadata": { + "fontFamily": "tinymce-small", + "majorVersion": 1, + "minorVersion": 0 + }, + "metrics": { + "emSize": 1024, + "baseline": 6.25, + "whitespace": 50 + }, + "showMetrics": false, + "showMetadata": false, + "showVersion": false + }, + "imagePref": { + "prefix": "icon-", + "png": true, + "useClassSelector": true, + "color": 4473924, + "bgColor": 16777215 + }, + "historySize": 100, + "showCodes": true + } +} \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce-small.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce-small.svg Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,62 @@ + + + +Generated by IcoMoon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce-small.ttf Binary file src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce-small.ttf has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce-small.woff Binary file src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce-small.woff has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce.eot Binary file src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce.eot has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce.json Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1357 @@ +{ + "IcoMoonType": "selection", + "icons": [ + { + "icon": { + "paths": [ + "M928 128h-416l-32-64h-352l-64 128h896zM904.34 704h74.86l44.8-448h-1024l64 640h484.080c-104.882-37.776-180.080-138.266-180.080-256 0-149.982 122.018-272 272-272 149.98 0 272 122.018 272 272 0 21.678-2.622 43.15-7.66 64zM1002.996 913.75l-198.496-174.692c17.454-28.92 27.5-62.814 27.5-99.058 0-106.040-85.96-192-192-192s-192 85.96-192 192 85.96 192 192 192c36.244 0 70.138-10.046 99.058-27.5l174.692 198.496c22.962 26.678 62.118 28.14 87.006 3.252l5.492-5.492c24.888-24.888 23.426-64.044-3.252-87.006zM640 764c-68.484 0-124-55.516-124-124s55.516-124 124-124 124 55.516 124 124-55.516 124-124 124z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57396, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 0, + "order": 1, + "prevSize": 32, + "code": 57396, + "name": "browse", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 0 + }, + { + "icon": { + "paths": [ + "M768 256h64v64h-64zM640 384h64v64h-64zM640 512h64v64h-64zM640 640h64v64h-64zM512 512h64v64h-64zM512 640h64v64h-64zM384 640h64v64h-64zM768 384h64v64h-64zM768 512h64v64h-64zM768 640h64v64h-64zM768 768h64v64h-64zM640 768h64v64h-64zM512 768h64v64h-64zM384 768h64v64h-64zM256 768h64v64h-64z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "resize", + "dots" + ], + "defaultCode": 57394, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 1, + "order": 2, + "prevSize": 32, + "code": 57394, + "name": "resize", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 1 + }, + { + "icon": { + "paths": [ + "M832 256h-192v-64l-192-192h-448v768h384v256h640v-576l-192-192zM832 346.51l101.49 101.49h-101.49v-101.49zM448 90.51l101.49 101.49h-101.49v-101.49zM64 64h320v192h192v448h-512v-640zM960 960h-512v-192h192v-448h128v192h192v448z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "copy" + ], + "defaultCode": 57393, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 2, + "order": 3, + "prevSize": 32, + "code": 57393, + "name": "copy", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 2 + }, + { + "icon": { + "paths": [ + "M256 64h512v128h-128v768h-128v-768h-128v768h-128v-448c-123.712 0-224-100.288-224-224s100.288-224 224-224zM960 896l-256-224 256-224z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "rtl" + ], + "defaultCode": 57392, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 3, + "order": 4, + "prevSize": 32, + "code": 57392, + "name": "rtl", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 3 + }, + { + "icon": { + "paths": [ + "M448 64h512v128h-128v768h-128v-768h-128v768h-128v-448c-123.712 0-224-100.288-224-224s100.288-224 224-224zM64 448l256 224-256 224z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "ltr" + ], + "defaultCode": 57391, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 4, + "order": 5, + "prevSize": 32, + "code": 57391, + "name": "ltr", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 4 + }, + { + "icon": { + "paths": [ + "M384 64h512v128h-128v768h-128v-768h-128v768h-128v-448c-123.712 0-224-100.288-224-224s100.288-224 224-224z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "visualchars" + ], + "defaultCode": 57390, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 5, + "order": 6, + "prevSize": 32, + "code": 57390, + "name": "visualchars", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 5 + }, + { + "icon": { + "paths": [ + "M731.42 517.036c63.92 47.938 100.58 116.086 100.58 186.964s-36.66 139.026-100.58 186.964c-59.358 44.518-137.284 69.036-219.42 69.036-82.138 0-160.062-24.518-219.42-69.036-63.92-47.938-100.58-116.086-100.58-186.964h128c0 69.382 87.926 128 192 128 104.074 0 192-58.618 192-128 0-69.382-87.926-128-192-128-82.138 0-160.062-24.518-219.42-69.036-63.92-47.94-100.58-116.086-100.58-186.964 0-70.878 36.66-139.024 100.58-186.964 59.358-44.518 137.282-69.036 219.42-69.036 82.136 0 160.062 24.518 219.42 69.036 63.92 47.94 100.58 116.086 100.58 186.964h-128c0-69.382-87.926-128-192-128-104.074 0-192 58.618-192 128 0 69.382 87.926 128 192 128 82.136 0 160.062 24.518 219.42 69.036zM0 512h1024v64h-1024z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "strikethrough" + ], + "defaultCode": 57389, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 6, + "order": 7, + "prevSize": 32, + "code": 57389, + "name": "strikethrough", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 6 + }, + { + "icon": { + "paths": [ + "M704 64h128v416c0 159.058-143.268 288-320 288-176.73 0-320-128.942-320-288v-416h128v416c0 40.166 18.238 78.704 51.354 108.506 36.896 33.204 86.846 51.494 140.646 51.494 53.8 0 103.75-18.29 140.646-51.494 33.116-29.802 51.354-68.34 51.354-108.506v-416zM192 832h640v128h-640z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "underline" + ], + "defaultCode": 57388, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 7, + "order": 8, + "prevSize": 32, + "code": 57388, + "name": "underline", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 7 + }, + { + "icon": { + "paths": [ + "M896 64v64h-128l-320 768h128v64h-448v-64h128l320-768h-128v-64z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "italic" + ], + "defaultCode": 57387, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 8, + "order": 9, + "prevSize": 32, + "code": 57387, + "name": "italic", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 8 + }, + { + "icon": { + "paths": [ + "M707.88 484.652c37.498-44.542 60.12-102.008 60.12-164.652 0-141.16-114.842-256-256-256h-320v896h384c141.158 0 256-114.842 256-256 0-92.956-49.798-174.496-124.12-219.348zM384 192h101.5c55.968 0 101.5 57.42 101.5 128s-45.532 128-101.5 128h-101.5v-256zM543 832h-159v-256h159c58.45 0 106 57.42 106 128s-47.55 128-106 128z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "bold0" + ], + "defaultCode": 57386, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 9, + "order": 10, + "prevSize": 32, + "code": 57386, + "name": "bold", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 9 + }, + { + "icon": { + "paths": [ + "M576 64c247.424 0 448 200.576 448 448s-200.576 448-448 448v-96c94.024 0 182.418-36.614 248.902-103.098 66.484-66.484 103.098-154.878 103.098-248.902 0-94.022-36.614-182.418-103.098-248.902-66.484-66.484-154.878-103.098-248.902-103.098-94.022 0-182.418 36.614-248.902 103.098-51.14 51.138-84.582 115.246-97.306 184.902h186.208l-224 256-224-256h164.57c31.060-217.102 217.738-384 443.43-384zM768 448v128h-256v-320h128v192z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "restoredraft" + ], + "defaultCode": 57384, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 11, + "order": 11, + "prevSize": 32, + "code": 57384, + "name": "restoredraft", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 10 + }, + { + "icon": { + "paths": [ + "M0 512h128v64h-128zM192 512h192v64h-192zM448 512h128v64h-128zM640 512h192v64h-192zM896 512h128v64h-128zM880 0l16 448h-768l16-448h32l16 384h640l16-384zM144 1024l-16-384h768l-16 384h-32l-16-320h-640l-16 320z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "pagebreak" + ], + "defaultCode": 57383, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 12, + "order": 12, + "prevSize": 32, + "code": 57383, + "name": "pagebreak", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 11 + }, + { + "icon": { + "paths": [ + "M384 192h128v64h-128zM576 192h128v64h-128zM896 192v256h-192v-64h128v-128h-64v-64zM320 384h128v64h-128zM512 384h128v64h-128zM192 256v128h64v64h-128v-256h192v64zM384 576h128v64h-128zM576 576h128v64h-128zM896 576v256h-192v-64h128v-128h-64v-64zM320 768h128v64h-128zM512 768h128v64h-128zM192 640v128h64v64h-128v-256h192v64zM960 64h-896v896h896v-896zM1024 0v0 1024h-1024v-1024h1024z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "template" + ], + "defaultCode": 57382, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 13, + "order": 13, + "prevSize": 32, + "code": 57382, + "name": "template", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 12 + }, + { + "icon": { + "paths": [ + "M448 576h-192v-128h192v-192h128v192h192v128h-192v192h-128zM1024 640v384h-1024v-384h128v256h768v-256z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "nonbreaking" + ], + "defaultCode": 57381, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 14, + "order": 14, + "prevSize": 32, + "code": 57381, + "name": "nonbreaking", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 13 + }, + { + "icon": { + "paths": [ + "M128 256h128v192h64v-384c0-35.2-28.8-64-64-64h-128c-35.2 0-64 28.8-64 64v384h64v-192zM128 64h128v128h-128v-128zM960 64v-64h-192c-35.202 0-64 28.8-64 64v320c0 35.2 28.798 64 64 64h192v-64h-192v-320h192zM640 160v-96c0-35.2-28.8-64-64-64h-192v448h192c35.2 0 64-28.8 64-64v-96c0-35.2-8.8-64-44-64 35.2 0 44-28.8 44-64zM576 384h-128v-128h128v128zM576 192h-128v-128h128v128zM832 576l-416 448-224-288 82-70 142 148 352-302z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "spellchecker" + ], + "defaultCode": 57380, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 15, + "order": 15, + "prevSize": 32, + "code": 57380, + "name": "spellchecker", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 14 + }, + { + "icon": { + "paths": [ + "M704 896h256l64-128v256h-384v-214.214c131.112-56.484 224-197.162 224-361.786 0-214.432-157.598-382.266-352-382.266-194.406 0-352 167.832-352 382.266 0 164.624 92.886 305.302 224 361.786v214.214h-384v-256l64 128h256v-32.59c-187.63-66.46-320-227.402-320-415.41 0-247.424 229.23-448 512-448 282.77 0 512 200.576 512 448 0 188.008-132.37 348.95-320 415.41v32.59z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "charmap" + ], + "defaultCode": 57376, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 19, + "order": 16, + "prevSize": 32, + "code": 57376, + "name": "charmap", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 15 + }, + { + "icon": { + "paths": [ + "M768 206v50h128v64h-192v-146l128-60v-50h-128v-64h192v146zM676 256h-136l-188 188-188-188h-136l256 256-256 256h136l188-188 188 188h136l-256-256z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "sup" + ], + "defaultCode": 57375, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 20, + "order": 17, + "prevSize": 32, + "code": 57375, + "name": "sup", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 16 + }, + { + "icon": { + "paths": [ + "M768 910v50h128v64h-192v-146l128-60v-50h-128v-64h192v146zM676 256h-136l-188 188-188-188h-136l256 256-256 256h136l188-188 188 188h136l-256-256z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "sub" + ], + "defaultCode": 57374, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 21, + "order": 18, + "prevSize": 32, + "code": 57374, + "name": "sub", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 17 + }, + { + "icon": { + "paths": [ + "M0 896h576v128h-576zM192 0h704v128h-704zM277.388 832l204.688-784.164 123.85 32.328-196.25 751.836zM929.774 1024l-129.774-129.774-129.774 129.774-62.226-62.226 129.774-129.774-129.774-129.774 62.226-62.226 129.774 129.774 129.774-129.774 62.226 62.226-129.774 129.774 129.774 129.774z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "removeformat" + ], + "defaultCode": 57373, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 22, + "order": 19, + "prevSize": 32, + "code": 57373, + "name": "removeformat", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 18 + }, + { + "icon": { + "paths": [ + "M0 448h1024v128h-1024z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "hr" + ], + "defaultCode": 57372, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 23, + "order": 20, + "prevSize": 32, + "code": 57372, + "name": "hr", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 19 + }, + { + "icon": { + "paths": [ + "M0 64v896h1024v-896h-1024zM384 640v-192h256v192h-256zM640 704v192h-256v-192h256zM640 192v192h-256v-192h256zM320 192v192h-256v-192h256zM64 448h256v192h-256v-192zM704 448h256v192h-256v-192zM704 384v-192h256v192h-256zM64 704h256v192h-256v-192zM704 896v-192h256v192h-256z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "table" + ], + "defaultCode": 57371, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 24, + "order": 21, + "prevSize": 32, + "code": 57371, + "name": "table", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 20 + }, + { + "icon": { + "paths": [ + "M322.018 832l57.6-192h264.764l57.6 192h113.632l-191.996-640h-223.236l-192 640h113.636zM475.618 320h72.764l57.6 192h-187.964l57.6-192z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "forecolor" + ], + "defaultCode": 57370, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 25, + "order": 22, + "prevSize": 32, + "code": 57370, + "name": "forecolor", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 21 + }, + { + "icon": { + "paths": [ + "M512 320c-209.368 0-395.244 100.556-512 256 116.756 155.446 302.632 256 512 256 209.368 0 395.244-100.554 512-256-116.756-155.444-302.632-256-512-256zM448 448c35.346 0 64 28.654 64 64s-28.654 64-64 64-64-28.654-64-64 28.654-64 64-64zM773.616 705.296c-39.648 20.258-81.652 35.862-124.846 46.376-44.488 10.836-90.502 16.328-136.77 16.328-46.266 0-92.282-5.492-136.768-16.324-43.194-10.518-85.198-26.122-124.846-46.376-63.020-32.202-120.222-76.41-167.64-129.298 47.418-52.888 104.62-97.1 167.64-129.298 32.336-16.522 66.242-29.946 101.082-40.040-19.888 30.242-31.468 66.434-31.468 105.336 0 106.040 85.962 192 192 192 106.038 0 192-85.96 192-192 0-38.902-11.582-75.094-31.466-105.34 34.838 10.096 68.744 23.52 101.082 40.042 63.022 32.198 120.218 76.408 167.638 129.298-47.42 52.886-104.618 97.1-167.638 129.296zM860.918 243.722c-108.72-55.554-226.112-83.722-348.918-83.722-122.806 0-240.198 28.168-348.918 83.722-58.772 30.032-113.732 67.904-163.082 112.076v109.206c55.338-58.566 120.694-107.754 192.194-144.29 99.62-50.904 207.218-76.714 319.806-76.714s220.186 25.81 319.804 76.716c71.502 36.536 136.858 85.724 192.196 144.29v-109.206c-49.35-44.174-104.308-82.046-163.082-112.078z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "preview" + ], + "defaultCode": 57369, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 26, + "order": 23, + "prevSize": 32, + "code": 57369, + "name": "preview", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 22 + }, + { + "icon": { + "paths": [ + "M512 192c-212.076 0-384 171.922-384 384s171.922 384 384 384c212.074 0 384-171.922 384-384s-171.926-384-384-384zM715.644 779.646c-54.392 54.396-126.716 84.354-203.644 84.354s-149.25-29.958-203.646-84.354c-54.396-54.394-84.354-126.718-84.354-203.646s29.958-149.25 84.354-203.646c54.396-54.396 126.718-84.354 203.646-84.354s149.252 29.958 203.642 84.354c54.402 54.396 84.358 126.718 84.358 203.646s-29.958 149.252-84.356 203.646zM325.93 203.862l-42.94-85.878c-98.874 49.536-179.47 130.132-229.006 229.008l85.876 42.94c40.248-80.336 105.732-145.822 186.070-186.070zM884.134 389.93l85.878-42.938c-49.532-98.876-130.126-179.472-229.004-229.008l-42.944 85.878c80.338 40.248 145.824 105.732 186.070 186.068zM512 384h-64v192c0 10.11 4.7 19.11 12.022 24.972l-0.012 0.016 160 128 39.976-49.976-147.986-118.39v-176.622z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "inserttime" + ], + "defaultCode": 57368, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 27, + "order": 24, + "prevSize": 32, + "code": 57368, + "name": "inserttime", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 23 + }, + { + "icon": { + "paths": [ + "M320 256l-256 256 256 256h128l-256-256 256-256zM704 256h-128l256 256-256 256h128l256-256z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "code" + ], + "defaultCode": 57367, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 28, + "order": 25, + "prevSize": 32, + "code": 57367, + "name": "code", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 24 + }, + { + "icon": { + "paths": [ + "M448 704h128v128h-128zM704 256c35.346 0 64 28.654 64 64v192l-192 128h-128v-64l192-128v-64h-320v-128h384zM512 96c-111.118 0-215.584 43.272-294.156 121.844s-121.844 183.038-121.844 294.156c0 111.118 43.272 215.584 121.844 294.156 78.572 78.572 183.038 121.844 294.156 121.844 111.118 0 215.584-43.272 294.156-121.844 78.572-78.572 121.844-183.038 121.844-294.156 0-111.118-43.272-215.584-121.844-294.156-78.572-78.572-183.038-121.844-294.156-121.844zM512 0v0c282.77 0 512 229.23 512 512s-229.23 512-512 512c-282.77 0-512-229.23-512-512 0-282.77 229.23-512 512-512z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "help" + ], + "defaultCode": 57366, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 29, + "order": 26, + "prevSize": 32, + "code": 57366, + "name": "help", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 25 + }, + { + "icon": { + "paths": [ + "M0 128v768h1024v-768h-1024zM192 832h-128v-128h128v128zM192 576h-128v-128h128v128zM192 320h-128v-128h128v128zM768 832h-512v-640h512v640zM960 832h-128v-128h128v128zM960 576h-128v-128h128v128zM960 320h-128v-128h128v128zM384 320v384l256-192z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "media" + ], + "defaultCode": 57365, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 30, + "order": 27, + "prevSize": 32, + "code": 57365, + "name": "media", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 26 + }, + { + "icon": { + "paths": [ + "M0 128v832h1024v-832h-1024zM960 896h-896v-704h896v704zM704 352c0-53.019 42.981-96 96-96s96 42.981 96 96c0 53.019-42.981 96-96 96-53.019 0-96-42.981-96-96zM896 832h-768l192-512 256 320 128-96z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "image" + ], + "defaultCode": 57364, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 31, + "order": 28, + "prevSize": 32, + "code": 57364, + "name": "image", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 27 + }, + { + "icon": { + "paths": [ + "M192 0v1024l320-320 320 320v-1024h-640zM768 869.49l-256-256-256 256v-805.49h512v805.49z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "anchor" + ], + "defaultCode": 57363, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 32, + "order": 29, + "prevSize": 32, + "code": 57363, + "name": "anchor", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 28 + }, + { + "icon": { + "paths": [ + "M476.888 675.114c4.56 9.048 6.99 19.158 6.99 29.696 0 17.616-6.744 34.058-18.992 46.308l-163.38 163.38c-12.248 12.248-28.696 18.992-46.308 18.992s-34.060-6.744-46.308-18.992l-99.38-99.38c-12.248-12.25-18.992-28.696-18.992-46.308s6.744-34.060 18.992-46.308l163.38-163.382c12.248-12.246 28.696-18.992 46.308-18.992 10.538 0 20.644 2.43 29.696 6.988l65.338-65.336c-27.87-21.41-61.44-32.16-95.034-32.16-39.986 0-79.972 15.166-110.308 45.502l-163.38 163.382c-60.67 60.67-60.67 159.95 0 220.618l99.38 99.382c30.334 30.332 70.32 45.5 110.306 45.5 39.988 0 79.974-15.168 110.308-45.502l163.38-163.38c55.82-55.82 60.238-144.298 13.344-205.346l-65.34 65.338zM978.496 144.884l-99.38-99.382c-30.334-30.336-70.32-45.502-110.308-45.502-39.986 0-79.97 15.166-110.306 45.502l-163.382 163.382c-55.82 55.82-60.238 144.298-13.342 205.342l65.338-65.34c-4.558-9.050-6.988-19.16-6.988-29.694 0-17.616 6.744-34.060 18.992-46.308l163.382-163.382c12.246-12.248 28.694-18.994 46.306-18.994 17.616 0 34.060 6.746 46.308 18.994l99.38 99.382c12.248 12.248 18.992 28.694 18.992 46.308s-6.744 34.060-18.992 46.308l-163.38 163.382c-12.248 12.248-28.694 18.992-46.308 18.992-10.536 0-20.644-2.43-29.696-6.99l-65.338 65.338c27.872 21.41 61.44 32.16 95.034 32.16 39.988 0 79.974-15.168 110.308-45.504l163.38-163.38c60.672-60.666 60.672-159.944 0-220.614zM233.368 278.624l-191.994-191.994 45.256-45.256 191.994 191.994zM384 0h64v192h-64zM0 384h192v64h-192zM790.632 745.376l191.996 191.996-45.256 45.256-191.996-191.996zM576 832h64v192h-64zM832 576h192v64h-192z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "unlink" + ], + "defaultCode": 57362, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 33, + "order": 30, + "prevSize": 32, + "code": 57362, + "name": "unlink", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 29 + }, + { + "icon": { + "paths": [ + "M320 704c17.6 17.6 47.274 16.726 65.942-1.942l316.118-316.116c18.668-18.668 19.54-48.342 1.94-65.942s-47.274-16.726-65.942 1.942l-316.116 316.116c-18.668 18.668-19.542 48.342-1.942 65.942zM476.888 675.112c4.56 9.050 6.99 19.16 6.99 29.696 0 17.616-6.744 34.060-18.992 46.308l-163.382 163.382c-12.248 12.248-28.694 18.992-46.308 18.992s-34.060-6.744-46.308-18.992l-99.382-99.382c-12.248-12.248-18.992-28.694-18.992-46.308s6.744-34.060 18.992-46.308l163.382-163.382c12.248-12.248 28.694-18.994 46.308-18.994 10.536 0 20.644 2.43 29.696 6.99l65.338-65.338c-27.87-21.41-61.44-32.16-95.034-32.16-39.986 0-79.972 15.166-110.308 45.502l-163.382 163.382c-60.67 60.67-60.67 159.948 0 220.618l99.382 99.382c30.334 30.332 70.32 45.5 110.306 45.5 39.988 0 79.974-15.168 110.308-45.502l163.382-163.382c55.82-55.82 60.238-144.298 13.344-205.344l-65.34 65.34zM978.498 144.884l-99.382-99.382c-30.334-30.336-70.32-45.502-110.308-45.502-39.986 0-79.972 15.166-110.308 45.502l-163.382 163.382c-55.82 55.82-60.238 144.298-13.342 205.342l65.338-65.34c-4.558-9.050-6.988-19.16-6.988-29.694 0-17.616 6.744-34.060 18.992-46.308l163.382-163.382c12.248-12.248 28.694-18.994 46.308-18.994s34.060 6.746 46.308 18.994l99.382 99.382c12.248 12.248 18.992 28.694 18.992 46.308s-6.744 34.060-18.992 46.308l-163.382 163.382c-12.248 12.248-28.694 18.992-46.308 18.992-10.536 0-20.644-2.43-29.696-6.99l-65.338 65.338c27.872 21.41 61.44 32.16 95.034 32.16 39.988 0 79.974-15.168 110.308-45.502l163.382-163.382c60.67-60.666 60.67-159.944 0-220.614z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "link" + ], + "defaultCode": 57361, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 34, + "order": 31, + "prevSize": 32, + "code": 57361, + "name": "link", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 30 + }, + { + "icon": { + "paths": [ + "M0 64h1024v128h-1024zM384 256h640v128h-640zM384 448h640v128h-640zM384 640h640v128h-640zM0 832h1024v128h-1024zM256 320v384l-256-192z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "outdent" + ], + "defaultCode": 57357, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 38, + "order": 32, + "prevSize": 32, + "code": 57357, + "name": "outdent", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 31 + }, + { + "icon": { + "paths": [ + "M0 64h1024v128h-1024zM384 256h640v128h-640zM384 448h640v128h-640zM384 640h640v128h-640zM0 832h1024v128h-1024zM0 704v-384l256 192z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "indent" + ], + "defaultCode": 57356, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 39, + "order": 33, + "prevSize": 32, + "code": 57356, + "name": "indent", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 32 + }, + { + "icon": { + "paths": [ + "M384 832h640v128h-640zM384 448h640v128h-640zM384 64h640v128h-640zM192 0v256h-64v-192h-64v-64zM128 526v50h128v64h-192v-146l128-60v-50h-128v-64h192v146zM256 704v320h-192v-64h128v-64h-128v-64h128v-64h-128v-64z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "numlist" + ], + "defaultCode": 57355, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 40, + "order": 34, + "prevSize": 32, + "code": 57355, + "name": "numlist", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 33 + }, + { + "icon": { + "paths": [ + "M384 64h640v128h-640v-128zM384 448h640v128h-640v-128zM384 832h640v128h-640v-128zM0 128c0-70.692 57.308-128 128-128 70.692 0 128 57.308 128 128 0 70.692-57.308 128-128 128-70.692 0-128-57.308-128-128zM0 512c0-70.692 57.308-128 128-128 70.692 0 128 57.308 128 128 0 70.692-57.308 128-128 128-70.692 0-128-57.308-128-128zM0 896c0-70.692 57.308-128 128-128 70.692 0 128 57.308 128 128 0 70.692-57.308 128-128 128-70.692 0-128-57.308-128-128z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "bullist" + ], + "defaultCode": 57354, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 41, + "order": 35, + "prevSize": 32, + "code": 57354, + "name": "bullist", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 34 + }, + { + "icon": { + "paths": [ + "M64 0h384v64h-384zM576 0h384v64h-384zM952 320h-56v-256h-256v256h-256v-256h-256v256h-56c-39.6 0-72 32.4-72 72v560c0 39.6 32.4 72 72 72h304c39.6 0 72-32.4 72-72v-376h128v376c0 39.6 32.4 72 72 72h304c39.6 0 72-32.4 72-72v-560c0-39.6-32.4-72-72-72zM348 960h-248c-19.8 0-36-14.4-36-32s16.2-32 36-32h248c19.8 0 36 14.4 36 32s-16.2 32-36 32zM544 512h-64c-17.6 0-32-14.4-32-32s14.4-32 32-32h64c17.6 0 32 14.4 32 32s-14.4 32-32 32zM924 960h-248c-19.8 0-36-14.4-36-32s16.2-32 36-32h248c19.8 0 36 14.4 36 32s-16.2 32-36 32z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "searchreplace" + ], + "defaultCode": 57353, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 42, + "order": 36, + "prevSize": 32, + "code": 57353, + "name": "searchreplace", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 35 + }, + { + "icon": { + "paths": [ + "M832 320v-160c0-17.6-14.4-32-32-32h-224v-64c0-35.2-28.8-64-64-64h-128c-35.204 0-64 28.8-64 64v64h-224c-17.602 0-32 14.4-32 32v640c0 17.6 14.398 32 32 32h288v192h448l192-192v-512h-192zM384 64.114c0.034-0.038 0.072-0.078 0.114-0.114h127.768c0.042 0.036 0.082 0.076 0.118 0.114l0 63.886h-128v-63.886zM192 256v-64h512v64h-512zM832 933.49v-101.49h101.49l-101.49 101.49zM960 768h-192v192h-320v-576h512v384z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "paste" + ], + "defaultCode": 57352, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 43, + "order": 37, + "prevSize": 32, + "code": 57352, + "name": "paste", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 36 + }, + { + "icon": { + "paths": [ + "M890.774 709.154c-45.654-45.556-103.728-69.072-157.946-69.072h-29.112l-63.904-64.008 255.62-256.038c63.904-64.010 63.904-192.028 0-256.038l-383.43 384.056-383.432-384.054c-63.904 64.008-63.904 192.028 0 256.038l255.622 256.034-63.906 64.008h-29.114c-54.22 0-112.292 23.518-157.948 69.076-81.622 81.442-92.65 202.484-24.63 270.35 29.97 29.902 70.288 44.494 112.996 44.494 54.216 0 112.29-23.514 157.946-69.072 53.584-53.464 76.742-124 67.084-185.348l65.384-65.488 65.376 65.488c-9.656 61.348 13.506 131.882 67.084 185.348 45.662 45.558 103.732 69.072 157.948 69.072 42.708 0 83.024-14.592 112.994-44.496 68.020-67.866 56.988-188.908-24.632-270.35zM353.024 845.538c-7.698 17.882-19.010 34.346-33.626 48.926-14.636 14.604-31.172 25.918-49.148 33.624-16.132 6.916-32.96 10.568-48.662 10.568-15.146 0-36.612-3.402-52.862-19.612-16.136-16.104-19.52-37.318-19.52-52.288 0-15.542 3.642-32.21 10.526-48.212 7.7-17.884 19.014-34.346 33.626-48.926 14.634-14.606 31.172-25.914 49.15-33.624 16.134-6.914 32.96-10.568 48.664-10.568 15.146 0 36.612 3.4 52.858 19.614 16.134 16.098 19.522 37.316 19.522 52.284 0.002 15.542-3.638 32.216-10.528 48.214zM512.004 666.596c-49.914 0-90.376-40.532-90.376-90.526 0-49.992 40.462-90.52 90.376-90.52s90.372 40.528 90.372 90.52c0 49.998-40.46 90.526-90.372 90.526zM855.272 919.042c-16.248 16.208-37.712 19.612-52.86 19.612-15.704 0-32.53-3.652-48.666-10.568-17.972-7.706-34.508-19.020-49.142-33.624-14.614-14.58-25.926-31.042-33.626-48.926-6.886-15.998-10.526-32.672-10.526-48.212 0-14.966 3.384-36.188 19.52-52.286 16.246-16.208 37.712-19.614 52.86-19.614 15.7 0 32.53 3.654 48.66 10.568 17.978 7.708 34.516 19.018 49.15 33.624 14.61 14.58 25.924 31.042 33.626 48.926 6.884 15.998 10.526 32.67 10.526 48.212-0.002 14.97-3.39 36.186-19.522 52.288z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "cut" + ], + "defaultCode": 57351, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 44, + "order": 38, + "prevSize": 32, + "code": 57351, + "name": "cut", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 37 + }, + { + "icon": { + "paths": [ + "M0 64h1024v128h-1024zM0 256h1024v128h-1024zM0 448h1024v128h-1024zM0 640h1024v128h-1024zM0 832h1024v128h-1024z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "alignjustify" + ], + "defaultCode": 57350, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 45, + "order": 39, + "prevSize": 32, + "code": 57350, + "name": "alignjustify", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 38 + }, + { + "icon": { + "paths": [ + "M0 64h1024v128h-1024zM384 256h640v128h-640zM384 640h640v128h-640zM0 448h1024v128h-1024zM0 832h1024v128h-1024z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "alignright" + ], + "defaultCode": 57349, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 46, + "order": 40, + "prevSize": 32, + "code": 57349, + "name": "alignright", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 39 + }, + { + "icon": { + "paths": [ + "M0 64h1024v128h-1024zM192 256h640v128h-640zM192 640h640v128h-640zM0 448h1024v128h-1024zM0 832h1024v128h-1024z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "aligncenter" + ], + "defaultCode": 57348, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 47, + "order": 41, + "prevSize": 32, + "code": 57348, + "name": "aligncenter", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 40 + }, + { + "icon": { + "paths": [ + "M0 64h1024v128h-1024zM0 256h640v128h-640zM0 640h640v128h-640zM0 448h1024v128h-1024zM0 832h1024v128h-1024z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "alignleft" + ], + "defaultCode": 57347, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 48, + "order": 42, + "prevSize": 32, + "code": 57347, + "name": "alignleft", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 41 + }, + { + "icon": { + "paths": [ + "M1024 592.458v-160.916l-159.144-15.914c-8.186-30.042-20.088-58.548-35.21-84.98l104.596-127.838-113.052-113.050-127.836 104.596c-26.434-15.124-54.942-27.026-84.982-35.208l-15.914-159.148h-160.916l-15.914 159.146c-30.042 8.186-58.548 20.086-84.98 35.208l-127.838-104.594-113.050 113.050 104.596 127.836c-15.124 26.432-27.026 54.94-35.21 84.98l-159.146 15.916v160.916l159.146 15.914c8.186 30.042 20.086 58.548 35.21 84.982l-104.596 127.836 113.048 113.048 127.838-104.596c26.432 15.124 54.94 27.028 84.98 35.21l15.916 159.148h160.916l15.914-159.144c30.042-8.186 58.548-20.088 84.982-35.21l127.836 104.596 113.048-113.048-104.596-127.836c15.124-26.434 27.028-54.942 35.21-84.98l159.148-15.92zM704 576l-128 128h-128l-128-128v-128l128-128h128l128 128v128z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "fullpage" + ], + "defaultCode": 57346, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 49, + "order": 43, + "prevSize": 32, + "code": 57346, + "name": "fullpage", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 42 + }, + { + "icon": { + "paths": [ + "M903.432 199.43l-142.864-142.862c-31.112-31.112-92.568-56.568-136.568-56.568h-480c-44 0-80 36-80 80v864c0 44 36 80 80 80h736c44 0 80-36 80-80v-608c0-44-25.456-105.458-56.568-136.57zM858.178 244.686c3.13 3.13 6.25 6.974 9.28 11.314h-163.458v-163.456c4.34 3.030 8.184 6.15 11.314 9.28l142.864 142.862zM896 944c0 8.672-7.328 16-16 16h-736c-8.672 0-16-7.328-16-16v-864c0-8.672 7.328-16 16-16h480c4.832 0 10.254 0.61 16 1.704v254.296h254.296c1.094 5.746 1.704 11.166 1.704 16v608z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "newdocument" + ], + "defaultCode": 57345, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 50, + "order": 44, + "prevSize": 32, + "code": 57345, + "name": "newdocument", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 43 + }, + { + "icon": { + "paths": [ + "M896 0h-896v1024h1024v-896l-128-128zM512 128h128v256h-128v-256zM896 896h-768v-768h64v320h576v-320h74.978l53.022 53.018v714.982z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "save" + ], + "defaultCode": 57344, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 51, + "order": 45, + "prevSize": 32, + "code": 57344, + "name": "save", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 44 + }, + { + "icon": { + "paths": [ + "M128 544l288 288 480-480-128-128-352 352-160-160z" + ], + "attrs": [], + "isMulticolor": false, + "defaultCode": 57395, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 52, + "order": 46, + "prevSize": 32, + "code": 57395, + "name": "checkbox", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 45 + }, + { + "icon": { + "paths": [ + "M512 512v128h32l32-64h64v256h-48v64h224v-64h-48v-256h64l32 64h32v-128zM832 320v-160c0-17.6-14.4-32-32-32h-224v-64c0-35.2-28.8-64-64-64h-128c-35.204 0-64 28.8-64 64v64h-224c-17.602 0-32 14.4-32 32v640c0 17.6 14.398 32 32 32h288v192h640v-704h-192zM384 64.114c0.034-0.038 0.072-0.078 0.114-0.114h127.768c0.042 0.036 0.082 0.076 0.118 0.114l0 63.886h-128v-63.886zM192 256v-64h512v64h-512zM960 960h-512v-576h512v576z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "pastetext" + ], + "defaultCode": 57397, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 53, + "order": 47, + "prevSize": 32, + "code": 57397, + "name": "pastetext", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 46 + }, + { + "icon": { + "paths": [ + "M1024 0v384l-138.26-138.26-212 212-107.48-107.48 212-212-138.26-138.26zM245.74 138.26l212 212-107.48 107.48-212-212-138.26 138.26v-384h384zM885.74 778.26l138.26-138.26v384h-384l138.26-138.26-212-212 107.48-107.48zM457.74 673.74l-212 212 138.26 138.26h-384v-384l138.26 138.26 212-212z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "fullscreen" + ], + "defaultCode": 57379, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 16, + "order": 48, + "prevSize": 32, + "code": 57379, + "name": "fullscreen", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 47 + }, + { + "icon": { + "paths": [ + "M256 64h512v128h-512zM960 256h-896c-35.2 0-64 28.8-64 64v320c0 35.2 28.796 64 64 64h192v256h512v-256h192c35.2 0 64-28.8 64-64v-320c0-35.2-28.8-64-64-64zM704 896h-384v-320h384v320zM974.4 352c0 25.626-20.774 46.4-46.398 46.4-25.626 0-46.402-20.774-46.402-46.4s20.776-46.4 46.402-46.4c25.626 0 46.398 20.774 46.398 46.4z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "print" + ], + "defaultCode": 57378, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 17, + "order": 49, + "prevSize": 32, + "code": 57378, + "name": "print", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 48 + }, + { + "icon": { + "paths": [ + "M512 0c-282.77 0-512 229.228-512 512 0 282.77 229.228 512 512 512 282.77 0 512-229.23 512-512 0-282.772-229.23-512-512-512zM512 944c-238.586 0-432-193.412-432-432 0-238.586 193.414-432 432-432 238.59 0 432 193.414 432 432 0 238.588-193.41 432-432 432zM384 320c0 35.346-28.654 64-64 64s-64-28.654-64-64 28.654-64 64-64 64 28.654 64 64zM768 320c0 35.346-28.652 64-64 64s-64-28.654-64-64 28.652-64 64-64 64 28.654 64 64zM512 652c141.074 0 262.688-57.532 318.462-123.192-20.872 171.22-156.288 303.192-318.462 303.192-162.118 0-297.498-132.026-318.444-303.168 55.786 65.646 177.386 123.168 318.444 123.168z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "emoticons" + ], + "defaultCode": 57377, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 18, + "order": 50, + "prevSize": 32, + "code": 57377, + "name": "emoticons", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 49 + }, + { + "icon": { + "paths": [ + "M225 448c123.712 0 224 100.29 224 224 0 123.712-100.288 224-224 224-123.712 0-224-100.288-224-224l-1-32c0-247.424 200.576-448 448-448v128c-85.474 0-165.834 33.286-226.274 93.726-11.634 11.636-22.252 24.016-31.83 37.020 11.438-1.8 23.16-2.746 35.104-2.746zM801 448c123.71 0 224 100.29 224 224 0 123.712-100.29 224-224 224-123.71 0-224-100.288-224-224l-1-32c0-247.424 200.576-448 448-448v128c-85.474 0-165.834 33.286-226.274 93.726-11.636 11.636-22.254 24.016-31.832 37.020 11.44-1.8 23.16-2.746 35.106-2.746z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "blockquote" + ], + "defaultCode": 57358, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 37, + "order": 51, + "prevSize": 32, + "code": 57358, + "name": "blockquote", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 50 + }, + { + "icon": { + "paths": [ + "M761.862 1024c113.726-206.032 132.888-520.306-313.862-509.824v253.824l-384-384 384-384v248.372c534.962-13.942 594.57 472.214 313.862 775.628z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "undo" + ], + "defaultCode": 57359, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 36, + "order": 52, + "prevSize": 32, + "code": 57359, + "name": "undo", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 51 + }, + { + "icon": { + "paths": [ + "M576 248.372v-248.372l384 384-384 384v-253.824c-446.75-10.482-427.588 303.792-313.86 509.824-280.712-303.414-221.1-789.57 313.86-775.628z" + ], + "attrs": [], + "isMulticolor": false, + "tags": [ + "redo" + ], + "defaultCode": 57360, + "grid": 0 + }, + "attrs": [], + "properties": { + "id": 35, + "order": 53, + "prevSize": 32, + "code": 57360, + "name": "redo", + "ligatures": "" + }, + "setIdx": 0, + "iconIdx": 52 + } + ], + "height": 1024, + "metadata": { + "name": "tinymce" + }, + "preferences": { + "showGlyphs": true, + "showQuickUse": true, + "showQuickUse2": true, + "showSVGs": true, + "fontPref": { + "prefix": "icon-", + "metadata": { + "fontFamily": "tinymce", + "majorVersion": 1, + "minorVersion": 0 + }, + "metrics": { + "emSize": 1024, + "baseline": 6.25, + "whitespace": 50 + } + }, + "imagePref": { + "prefix": "icon-", + "png": true, + "useClassSelector": true, + "color": 4473924, + "bgColor": 16777215 + }, + "historySize": 100, + "showCodes": true + } +} \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce.svg Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,63 @@ + + + +Generated by IcoMoon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce.ttf Binary file src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce.ttf has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce.woff Binary file src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/fonts/tinymce.woff has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/img/anchor.gif Binary file src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/img/anchor.gif has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/img/loader.gif Binary file src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/img/loader.gif has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/img/object.gif Binary file src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/img/object.gif has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/img/trans.gif Binary file src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/img/trans.gif has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.dev.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.dev.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,39 @@ +@import "Reset.less"; +@import "Variables.less"; +@import "Mixins.less"; +@import "Animations.less"; +@import "TinyMCE.less"; +@import "Container.less"; +@import "Scrollable.less"; +@import "Panel.less"; +@import "FloatPanel.less"; +@import "Window.less"; +@import "AbsoluteLayout.less"; +@import "ToolTip.less"; +@import "Button.less"; +@import "ButtonGroup.less"; +@import "Checkbox.less"; +@import "ComboBox.less"; +@import "ColorBox.less"; +@import "ColorButton.less"; +@import "ColorPicker.less"; +@import "Path.less"; +@import "FieldSet.less"; +@import "FitLayout.less"; +@import "FlowLayout.less"; +@import "Iframe.less"; +@import "Label.less"; +@import "MenuBar.less"; +@import "MenuButton.less"; +@import "ListBox.less"; +@import "MenuItem.less"; +@import "Menu.less"; +@import "Radio.less"; +@import "ResizeHandle.less"; +@import "Spacer.less"; +@import "SplitButton.less"; +@import "StackLayout.less"; +@import "TabPanel.less"; +@import "TextBox.less"; +@import "Throbber.less"; +@import "Icons.less"; diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.ie7.dev.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.ie7.dev.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,39 @@ +@import "Variables.less"; +@import "Reset.less"; +@import "Mixins.less"; +@import "Animations.less"; +@import "TinyMCE.less"; +@import "Container.less"; +@import "Scrollable.less"; +@import "Panel.less"; +@import "FloatPanel.less"; +@import "Window.less"; +@import "AbsoluteLayout.less"; +@import "ToolTip.less"; +@import "Button.less"; +@import "ButtonGroup.less"; +@import "Checkbox.less"; +@import "ComboBox.less"; +@import "ColorBox.less"; +@import "ColorButton.less"; +@import "ColorPicker.less"; +@import "Path.less"; +@import "FieldSet.less"; +@import "FitLayout.less"; +@import "FlowLayout.less"; +@import "Iframe.less"; +@import "Label.less"; +@import "MenuBar.less"; +@import "MenuButton.less"; +@import "ListBox.less"; +@import "MenuItem.less"; +@import "Menu.less"; +@import "Radio.less"; +@import "ResizeHandle.less"; +@import "Spacer.less"; +@import "SplitButton.less"; +@import "StackLayout.less"; +@import "TabPanel.less"; +@import "TextBox.less"; +@import "Throbber.less"; +@import "Icons.Ie7.less"; diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.ie7.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.ie7.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1904 @@ +// Reset + +.@{prefix}-container, .@{prefix}-container *, .@{prefix}-widget, .@{prefix}-widget *, .@{prefix}-reset { + margin: 0; padding: 0; border: 0; outline: 0; + vertical-align: top; background: transparent; + text-decoration: none; color: @text; + font-family: @font-family; + font-size: @font-size; text-shadow: none; float: none; + position: static; width: auto; height: auto; + white-space: nowrap; cursor: inherit; + -webkit-tap-highlight-color: transparent; + line-height: normal; font-weight: normal; + text-align: left; + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + box-sizing: content-box; + direction: ltr; + max-width: none; +} + +.@{prefix}-widget button { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} + +.@{prefix}-container *[unselectable] { + -moz-user-select: none; + -webkit-user-select: none; + -o-user-select: none; + user-select: none; +} +// Variables +// Syntax: -()--()-(); +// Example: @btn-primary-bg-hover-hlight; + +@prefix: mce; + +// Default font +@font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +@font-size: 14px; +@line-height: 20px; +@has-gradients: true; +@has-radius: true; +@has-boxshadow: true; + +// Text colors +@text: #333; +@text-inverse: white; +@text-disabled: #aaa; +@text-shadow: 0 1px 1px hsla(hue(@text-inverse), saturation(@text-inverse), lightness(@text-inverse), 0.75); +@text-error: #aa0000; + +// Button +@btn-text: @text; +@btn-text-shadow: @text-inverse; +@btn-border-top: rgba(0, 0, 0, .1); +@btn-border-right: rgba(0, 0, 0, .1); +@btn-border-bottom: fadein(rgba(0, 0, 0, .1), 15%); +@btn-border-left: fadein(rgba(0, 0, 0, .1), 15%); +@btn-split-border: #bdbdbd; +@btn-caret-border: @btn-text; +@btn-text-disabled: @text-disabled; +@btn-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 1px 2px rgba(0, 0, 0, .05); +@btn-box-shadow-active: inset 0 2px 4px rgba(0, 0, 0, .15), 0 1px 2px rgba(0, 0, 0, .05); +@btn-box-disabled-opacity: 0.4; +@btn-bg: white; +@btn-bg-hlight: #D9D9D9; +@btn-bg-hover: darken(@btn-bg, 5%); +@btn-bg-hlight-hover: darken(@btn-bg-hlight, 5%); + +@btn-primary-bg: #0088cc; +@btn-primary-bg-hlight: #0044cc; +@btn-primary-bg-hover: darken(@btn-primary-bg, 5%); +@btn-primary-bg-hover-hlight: darken(@btn-primary-bg-hlight, 5%); +@btn-primary-text: #fff; +@btn-primary-text-shadow: #333; +@btn-primary-border-top: mix(@btn-border-top, @btn-primary-bg, 50%); +@btn-primary-border-right: mix(@btn-border-right, @btn-primary-bg, 50%); +@btn-primary-border-bottom: mix(@btn-border-bottom, @btn-primary-bg, 50%); +@btn-primary-border-left: mix(@btn-border-left, @btn-primary-bg, 50%); + +// Menu +@menuitem-text: @text; +@menu-bg: #fff; +@menu-border: rgba(0, 0, 0, 0.2); +@menubar-border: mix(@panel-border, @panel-bg, 60%); +@menuitem-text-inverse: @text-inverse; +@menubar-bg-active: darken(@btn-bg, 10%); +@menuitem-bg-hover: #0081C2; +@menuitem-bg-selected: #08C; +@menuitem-bg-selected-hlight: #0077B3; +@menuitem-bg-disabled: #CCC; +@menuitem-caret: @menuitem-text; +@menuitem-caret-selected: @menuitem-text-inverse; +@menuitem-separator-top: #CBCBCB; +@menuitem-separator-bottom: @menu-bg; +@menuitem-bg-active: #C8DEF4; +@menuitem-text-active: @text; +@menuitem-preview-border-active: #aaa; + +// Panel +@panel-border: #9E9E9E; +@panel-bg: #FDFDFD; +@panel-bg-hlight: #DDD; + +// Tabs +@tab-border: #c5c5c5; +@tab-bg: #e3e3e3; +@tab-bg-hover: #FDFDFD; +@tab-bg-active: #FDFDFD; + +// Tooltip +@tooltip-bg: #000; +@tooltip-text: white; +@tooltip-font-size: 11px; + +// Window +@window-border: #c5c5c5; +@window-head-border: @window-border; +@window-head-close: mix(@text, @window-bg, 60%); +@window-head-close-hover: mix(@text, @window-bg, 40%); +@window-foot-border: @window-border; +@window-foot-bg: @window-bg; +@window-fullscreen-bg: #FFF; +@window-modalblock-bg: #000; +@window-modalblock-opacity: 0.3; +@window-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); +@window-bg: #FFF; +@window-title-font-size: 20px; + +// Popover +@popover-bg: @window-bg; +@popover-arrow-width: 10px; +@popover-arrow: @window-bg; +@popover-arrow-outer-width: @popover-arrow-width + 1; +@popover-arrow-outer: rgba(0, 0, 0, 0.25); + +// Floatpanel +@floatpanel-box-shadow: 0 5px 10px rgba(0, 0, 0, .2); + +// Checkbox +@checkbox-bg: @btn-bg; +@checkbox-bg-hlight: @btn-bg-hlight; +@checkbox-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 1px 2px rgba(0, 0, 0, .05); +@checkbox-border: #c5c5c5; +@checkbox-border-focus: rgba(82, 168, 236, .8); + +// Path +@path-text: @text; +@path-bg-focus: #666; +@path-text-focus: #fff; + +// Textbox +@textbox-text-placeholder: #aaa; +@textbox-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +@textbox-bg: #fff; +@textbox-border: #c5c5c5; +@textbox-border-focus: rgba(82, 168, 236, .8); + +// Throbber +@throbber-bg: #fff url('img/loader.gif') no-repeat center center; + +// Combobox +@combobox-border: @textbox-border; + +// Colorpicker +@colorpicker-border: @textbox-border; +@colorpicker-hue-bg: #fff; +@colorpicker-hue-border: #333; + +// Grid +@grid-bg-active: @menuitem-bg-active; +@grid-border-active: #a1a1a1; +@grid-border: #d6d6d6; + +// Misc +@colorbtn-backcolor-bg: #BBB; +@iframe-border: @panel-border; +// Mixins + +.opacity(@opacity) { + opacity: @opacity; + @opacityie: @opacity * 100; + filter: ~"alpha(opacity=@{opacityie})"; + zoom: 1; +} + +.vertical-gradient(@startColor, @endColor) when (@has-gradients = true) { + background-color: mix(@startColor, @endColor, 60%); + background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+ + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+ + background-image: -webkit-linear-gradient(top, @startColor, @endColor); // Safari 5.1+, Chrome 10+ + background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10 + background-image: linear-gradient(to bottom, @startColor, @endColor); // Standard, IE10 + background-repeat: repeat-x; + filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)", argb(@startColor), argb(@endColor))); + zoom: 1; +} + +.vertical-gradient(@startColor, @endColor) when (@has-gradients = false) { + background-color: mix(@startColor, @endColor, 60%); +} + +.border-radius(@radius) when (@has-radius = true) { + -webkit-border-radius: @radius; + -moz-border-radius: @radius; + border-radius: @radius; +} + +.box-shadow(@shadowA, @shadowB:X, ...) when (@has-boxshadow = true) { + // Multiple shadow solution from http://toekneestuck.com/blog/2012/05/15/less-css-arguments-variable/ + @props: ~`"@{arguments}".replace(/[\[\]]|\,\sX/g, '')`; + -webkit-box-shadow: @props; + -moz-box-shadow: @props; + box-shadow: @props; +} + +.transition(@transition) { + -webkit-transition: @transition; + transition: @transition; +} + +.inline-block() { + display: inline-block; + *display: inline; + *zoom: 1; +} + +.reset-gradient() { + filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)")); + background: transparent; +} +// Animations + +.@{prefix}-fade { + opacity: 0; + .transition(opacity .15s linear); + + &.@{prefix}-in { + opacity: 1; + } +} +.@{prefix}-tinymce { + // Avoid FOUC + visibility: inherit !important; + position: relative; +} + +.@{prefix}-fullscreen { + border: 0; padding: 0; margin: 0; + overflow: hidden; + height: 100%; + z-index: 100; +} + +div.@{prefix}-fullscreen { + position: fixed; + top: 0; left: 0; + width: 100%; + height: auto; +} + +.@{prefix}-tinymce { + display: block; + .border-radius(2px); +} + +.@{prefix}-wordcount { + position: absolute; + top: 0; + right: 0; + padding: 8px; +} + +div.@{prefix}-edit-area { + background: #FFF; + filter: none; +} + +.@{prefix}-statusbar { + position: relative; +} + +.@{prefix}-statusbar .@{prefix}-container-body { + position: relative; +} + +.@{prefix}-fullscreen .@{prefix}-resizehandle { + display: none; +} + +// Charmap + +.@{prefix}-charmap { + border-collapse: collapse; +} + +.@{prefix}-charmap td { + cursor: default; + border: 1px solid @panel-border; + width: 20px; + height: 20px; + line-height: 20px; + text-align: center; + vertical-align: middle; + padding: 2px; +} + +.@{prefix}-charmap td div { + text-align: center; +} + +.@{prefix}-charmap td:hover { + background: @btn-bg-hlight; +} + +.@{prefix}-grid td.@{prefix}-grid-cell div { + border: 1px solid @grid-border; + width: 15px; height: 15px; + margin: 0px; + cursor: pointer; + + &:focus { + border-color: @grid-border-active; + } + + &[disabled] { + cursor: not-allowed; + } +} + +.@{prefix}-grid { + border-spacing: 2px; + border-collapse: separate; + + a { + display: block; + border: 1px solid transparent; + + &:hover, &:focus { + border-color: @grid-border-active; + } + } +} + +.@{prefix}-grid-border { + margin: 0 4px 0 4px; + + a { + border-color: @grid-border; + width: 13px; height: 13px; + } + + a:hover, a.@{prefix}-active { + border-color: @grid-border-active; + background: @grid-bg-active; + } +} + +.@{prefix}-text-center { + text-align: center; +} + +div.@{prefix}-tinymce-inline { + width: 100%; + .box-shadow(none); +} + +.@{prefix}-colorbtn-trans div { + text-align: center; + vertical-align: middle; + font-weight: bold; + font-size: 20px; + line-height: 16px; + color: mix(@text, #fff, 70%); +} + +// Reduce double margins between toolbar rows + +.@{prefix}-toolbar-grp { + padding-bottom: 2px; +} + +.@{prefix}-toolbar-grp .@{prefix}-flow-layout-item { + margin-bottom: 0; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-wordcount { + left: 0; + right: auto; +} +// Container + +.@{prefix}-container, .@{prefix}-container-body { + display: block; +} + +.@{prefix}-autoscroll { + overflow: hidden; +} +// Scrollbar + +.@{prefix}-scrollbar { + position: absolute; + width: 7px; + height: 100%; + top: 2px; + right: 2px; + .opacity(0.4); +} + +.@{prefix}-scrollbar-h { + top: auto; + right: auto; + left: 2px; + bottom: 2px; + width: 100%; + height: 7px; +} + +.@{prefix}-scrollbar-thumb { + position: absolute; + background-color: #000; + border: 1px solid #888; + border-color: rgba(85, 85, 85, .6); + width: 5px; + height: 100%; + .border-radius(7px); +} + +.@{prefix}-scrollbar-h .@{prefix}-scrollbar-thumb { + width: 100%; + height: 5px; +} + +.@{prefix}-scrollbar:hover, .@{prefix}-scrollbar.@{prefix}-active { + background-color: #AAA; + .opacity(0.6); + .border-radius(7px); +} + +.@{prefix}-scroll { + position: relative; +} +// Panel + +.@{prefix}-panel { + border: 0 solid @panel-border; + .vertical-gradient(@panel-bg, @panel-bg-hlight); +} +// FloatPanel + +.@{prefix}-floatpanel { + position: absolute; + .box-shadow(@floatpanel-box-shadow); +} + +.@{prefix}-floatpanel.@{prefix}-fixed { + position: fixed; +} + +// Popover panel + +.@{prefix}-floatpanel .@{prefix}-arrow, +.@{prefix}-floatpanel .@{prefix}-arrow:after { + position: absolute; + display: block; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} + +.@{prefix}-floatpanel .@{prefix}-arrow { + border-width: @popover-arrow-outer-width; +} + +.@{prefix}-floatpanel .@{prefix}-arrow:after { + border-width: @popover-arrow-width; + content: ""; +} + +.@{prefix}-floatpanel.@{prefix}-popover { + .reset-gradient(); + .border-radius(6px); + .box-shadow(@floatpanel-box-shadow); + top: 0; + left: 0; + background: @popover-bg; + border: 1px solid @panel-border; + border: 1px solid @popover-arrow-outer; + + &.@{prefix}-bottom { + margin-top: @popover-arrow-width; + *margin-top: 0; + + & > .@{prefix}-arrow { + left: 50%; + margin-left: -@popover-arrow-outer-width; + border-top-width: 0; + border-bottom-color: @panel-border; + border-bottom-color: @popover-arrow-outer; + top: -@popover-arrow-outer-width; + + &:after { + top: 1px; + margin-left: -@popover-arrow-width; + border-top-width: 0; + border-bottom-color: @popover-arrow; + } + } + + &.@{prefix}-start { margin-left: -22px; } + &.@{prefix}-start > .@{prefix}-arrow { left: 20px; } + + &.@{prefix}-end { margin-left: 22px; } + &.@{prefix}-end > .@{prefix}-arrow { right: 10px; left: auto; } + } +}// Window + +.@{prefix}-fullscreen { + border: 0; padding: 0; margin: 0; + overflow: hidden; + background: @window-fullscreen-bg; + height: 100%; +} + +div.@{prefix}-fullscreen { + position: fixed; + top: 0; left: 0; +} + +#@{prefix}-modal-block { + .opacity(0); + position: fixed; + left: 0; top: 0; + width: 100%; height: 100%; + background: @window-modalblock-bg; +} + +#@{prefix}-modal-block.@{prefix}-in { + .opacity(@window-modalblock-opacity); +} + +.@{prefix}-window-move { + cursor: move; +} + +.@{prefix}-window { + .border-radius(6px); + .box-shadow(@window-box-shadow); + .reset-gradient(); + background: @window-bg; + position: fixed; + top: 0; left: 0; + opacity: 0; + .transition(opacity 150ms ease-in); +} + +.@{prefix}-window.@{prefix}-in { + opacity: 1; +} + +.@{prefix}-window-head { + padding: 9px 15px; + border-bottom: 1px solid @window-head-border; + position: relative; +} + +.@{prefix}-window-head .@{prefix}-close { + position: absolute; + right: 15px; + top: 9px; + font-size: 20px; + font-weight: bold; + line-height: 20px; + color: @window-head-close; + cursor: pointer; + + // IE7 + height: 20px; + overflow: hidden; +} + +.@{prefix}-close:hover { + color: @window-head-close-hover; +} + +.@{prefix}-window-head .@{prefix}-title { + line-height: 20px; + font-size: @window-title-font-size; + font-weight: bold; + text-rendering: optimizelegibility; + padding-right: 10px; +} + +.@{prefix}-window .@{prefix}-container-body { + display: block; +} + +.@{prefix}-foot { + display: block; + background-color: @window-foot-bg; + border-top: 1px solid @window-foot-border; + .border-radius(0 0 6px 6px); +} + +.@{prefix}-window-head .@{prefix}-dragh { + position: absolute; + top: 0; left: 0; + cursor: move; + width: 90%; + height: 100%; +} + +.@{prefix}-window iframe { + width: 100%; + height: 100%; +} + +.@{prefix}-window.@{prefix}-fullscreen, .@{prefix}-window.@{prefix}-fullscreen .@{prefix}-foot { + .border-radius(0); +} + +// RTL + +.@{prefix}-rtl .@{prefix}-window-head .@{prefix}-close { + position: absolute; + right: auto; + left: 15px; +} + +.@{prefix}-rtl .@{prefix}-window-head .@{prefix}-dragh { + left: auto; + right: 0; +} + +.@{prefix}-rtl .@{prefix}-window-head .@{prefix}-title { + direction: rtl; + text-align: right; +} +// AbsoluteLayout + +.@{prefix}-abs-layout { + position: relative; +} + +body .@{prefix}-abs-layout-item, .@{prefix}-abs-end { + position: absolute; +} + +.@{prefix}-abs-end { + width: 1px; height: 1px; +} + +.@{prefix}-container-body.@{prefix}-abs-layout { + overflow: hidden; +} +// Tooltip + +.@{prefix}-tooltip { + position: absolute; + padding: 5px; + .opacity(0.8); +} + +.@{prefix}-tooltip-inner { + font-size: @tooltip-font-size; + background-color: @tooltip-bg; + color: @tooltip-text; + max-width: 200px; + padding: 5px 8px 4px 8px; + text-align: center; + white-space: normal; +} + +.@{prefix}-tooltip-inner { + .border-radius(3px); +} + +.@{prefix}-tooltip-inner { + .box-shadow(0 0 5px @tooltip-bg); +} + +.@{prefix}-tooltip-arrow { + position: absolute; + width: 0; + height: 0; + line-height: 0; + border: 5px dashed @tooltip-bg; +} + +.@{prefix}-tooltip-arrow-n { + border-bottom-color: @tooltip-bg; +} + +.@{prefix}-tooltip-arrow-s { + border-top-color: @tooltip-bg; +} + +.@{prefix}-tooltip-arrow-e { + border-left-color: @tooltip-bg; +} + +.@{prefix}-tooltip-arrow-w { + border-right-color: @tooltip-bg; +} + +.@{prefix}-tooltip-nw, .@{prefix}-tooltip-sw { + margin-left: -14px; +} + +.@{prefix}-tooltip-n .@{prefix}-tooltip-arrow { + top: 0px; + left: 50%; + margin-left: -5px; + border-bottom-style: solid; + border-top: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-nw .@{prefix}-tooltip-arrow { + top: 0; + left: 10px; + border-bottom-style: solid; + border-top: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-ne .@{prefix}-tooltip-arrow { + top: 0; + right: 10px; + border-bottom-style: solid; + border-top: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-s .@{prefix}-tooltip-arrow { + bottom: 0; + left: 50%; + margin-left: -5px; + border-top-style: solid; + border-bottom: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-sw .@{prefix}-tooltip-arrow { + bottom: 0; + left: 10px; + border-top-style: solid; + border-bottom: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-se .@{prefix}-tooltip-arrow { + bottom: 0; + right: 10px; + border-top-style: solid; + border-bottom: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-e .@{prefix}-tooltip-arrow { + right: 0; + top: 50%; + margin-top: -5px; + border-left-style: solid; + border-right: none; + border-top-color: transparent; + border-bottom-color: transparent; +} + +.@{prefix}-tooltip-w .@{prefix}-tooltip-arrow { + left: 0; + top: 50%; + margin-top: -5px; + border-right-style: solid; + border-left: none; + border-top-color: transparent; + border-bottom-color: transparent; +} +// Button + +.@{prefix}-btn { + border: 1px solid mix(rgb(red(@btn-border-right), green(@btn-border-right), blue(@btn-border-right)), @panel-bg, 30%); + border-color: @btn-border-top @btn-border-right @btn-border-bottom @btn-border-left; + position: relative; + text-shadow: @text-shadow; + + .inline-block(); + .border-radius(3px); + .box-shadow(@btn-box-shadow); + .vertical-gradient(@btn-bg, @btn-bg-hlight); + + &:hover, &:focus { + color: @btn-text; + .vertical-gradient(darken(@btn-bg, 5%), darken(@btn-bg-hlight, 5%)); + } + + &.@{prefix}-disabled button, &.@{prefix}-disabled:hover button { + cursor: default; + .box-shadow(none); + .opacity(@btn-box-disabled-opacity); + } + + &.@{prefix}-active, &.@{prefix}-active:hover { + .vertical-gradient(darken(@btn-bg, 10%), darken(@btn-bg-hlight, 10%)); + .box-shadow(@btn-box-shadow-active); + } + + &:active { + .vertical-gradient(darken(@btn-bg, 10%), darken(@btn-bg-hlight, 10%)); + .box-shadow(@btn-box-shadow-active); + } +} + +.@{prefix}-btn button { + padding: 4px 10px; + font-size: @font-size; + line-height: @line-height; + *line-height: @line-height - 4px; + cursor: pointer; + color: @btn-text; + text-align: center; + + // Fixes for default inner padding of button + overflow: visible; // IE7 + -webkit-appearance: none; // WebKit + &::-moz-focus-inner { // Gecko + border: 0; + padding: 0; + } +} + +.@{prefix}-btn i { + text-shadow: 1px 1px @btn-text-shadow; +} + +.@{prefix}-primary { + min-width: 50px; + color: @btn-primary-text; + border: 1px solid mix(rgb(red(@btn-border-right), green(@btn-border-right), blue(@btn-border-right)), @panel-bg, 30%); + border-color: @btn-border-top @btn-border-right @btn-border-bottom @btn-border-left; + .vertical-gradient(@btn-primary-bg, @btn-primary-bg-hlight); + + &:hover, &:focus { + .vertical-gradient(darken(@btn-primary-bg, 5%), darken(@btn-primary-bg-hlight, 5%)); + } + + &.@{prefix}-disabled button, &.@{prefix}-disabled:hover button { + cursor: default; + .box-shadow(none); + .opacity(@btn-box-disabled-opacity); + } + + &.@{prefix}-active, &.@{prefix}-active:hover, &:not(.@{prefix}-disabled):active { + .vertical-gradient(darken(@btn-primary-bg, 10%), darken(@btn-primary-bg-hlight, 10%)); + .box-shadow(@btn-box-shadow-active); + } +} + +.@{prefix}-primary button, .@{prefix}-primary button i { + color: @btn-primary-text; + text-shadow: 1px 1px @btn-primary-text-shadow; +} + +.@{prefix}-btn-large button { + padding: 9px 14px; + font-size: @font-size + 2px; + line-height: normal; + .border-radius(5px); +} + +.@{prefix}-btn-large i { + margin-top: 2px; +} + +.@{prefix}-btn-small button { + padding: 1px 5px; + font-size: @font-size - 2px; + *padding-bottom: 2px; +} + +.@{prefix}-btn-small i { + line-height: 20px; + vertical-align: top; + *line-height: 18px; +} + +.@{prefix}-btn .@{prefix}-caret { + margin-top: 8px; + margin-left: 0; +} + +.@{prefix}-btn-small .@{prefix}-caret { + margin-top: 8px; + margin-left: 0; +} + +.@{prefix}-caret { + .inline-block(); + width: 0; height: 0; + vertical-align: top; + border-top: 4px solid @btn-caret-border; + border-right: 4px solid transparent; + border-left: 4px solid transparent; + content: ""; +} + +.@{prefix}-disabled .@{prefix}-caret { + border-top-color: @text-disabled; +} + +.@{prefix}-caret.@{prefix}-up { + border-bottom: 4px solid @btn-caret-border; + border-top: 0; +} + +.@{prefix}-btn-flat { + border: 0; + background: transparent; + .border-radius(0); + .box-shadow(none); + filter: none; +} + +.@{prefix}-btn-flat:hover, .@{prefix}-btn-flat.@{prefix}-active, .@{prefix}-btn-flat:focus, .@{prefix}-btn-flat:active { + border: 0; + background: @menubar-bg-active; + filter: none; + .box-shadow(none); +} + +// RTL + +.@{prefix}-rtl .@{prefix}-btn button { + direction: rtl; +} +// ButtonGroup + +.@{prefix}-btn-group .@{prefix}-btn { + border-width: 1px 0 1px 0; + margin: 0; + .border-radius(0); +} + +.@{prefix}-btn-group .@{prefix}-first { + border-left: 1px solid mix(rgb(red(@btn-border-left), green(@btn-border-left), blue(@btn-border-left)), @panel-bg, 30%); + border-left: 1px solid @btn-border-left; + .border-radius(3px 0 0 3px); +} + +.@{prefix}-btn-group .@{prefix}-last { + border-right: 1px solid mix(rgb(red(@btn-border-right), green(@btn-border-right), blue(@btn-border-right)), @panel-bg, 30%); + border-right: 1px solid @btn-border-right; + .border-radius(0 3px 3px 0); +} + +.@{prefix}-btn-group .@{prefix}-first.@{prefix}-last { + .border-radius(3px); +} + +.@{prefix}-btn-group .@{prefix}-btn.@{prefix}-flow-layout-item { + margin: 0; +} +// Checkbox + +.@{prefix}-checkbox { + cursor: pointer; +} + +i.@{prefix}-i-checkbox { + margin: 0 3px 0 0; + border: 1px solid @checkbox-border; + .border-radius(3px); + .box-shadow(@checkbox-box-shadow); + .vertical-gradient(@checkbox-bg, @checkbox-bg-hlight); + text-indent: -10em; + *font-size: 0; + *line-height: 0; + *text-indent: 0; + overflow: hidden; +} + +.@{prefix}-checked i.@{prefix}-i-checkbox { + color: @btn-text; + font-size: 16px; + line-height: 16px; + text-indent: 0; +} + +.@{prefix}-checkbox:focus i.@{prefix}-i-checkbox, .@{prefix}-checkbox.@{prefix}-focus i.@{prefix}-i-checkbox { + border: 1px solid @checkbox-border-focus; + .box-shadow(inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px fadeout(@checkbox-border-focus, 15%)); +} + +.@{prefix}-checkbox.@{prefix}-disabled .@{prefix}-label, .@{prefix}-checkbox.@{prefix}-disabled i.@{prefix}-i-checkbox { + color: mix(@text, @panel-bg, 40%); +} + +// RTL + +.@{prefix}-rtl .@{prefix}-checkbox { + direction: rtl; + text-align: right; +} + +.@{prefix}-rtl i.@{prefix}-i-checkbox { + margin: 0 0 0 3px; +} +// ComboBox + +.@{prefix}-combobox { + .inline-block(); + .border-radius(3px); + .box-shadow(@textbox-box-shadow); + *height: 32px; +} + +.@{prefix}-combobox input { + border: 1px solid @textbox-border; + border-right-color: @combobox-border; + height: 28px; +} + +.@{prefix}-combobox.@{prefix}-disabled input { + color: mix(@text, @textbox-bg, 40%); +} + +.@{prefix}-combobox.@{prefix}-has-open input { + .border-radius(4px 0 0 4px); +} + +.@{prefix}-combobox .@{prefix}-btn { + border-left: 0; + .border-radius(0 4px 4px 0); +} + +.@{prefix}-combobox button { + padding-right: 8px; + padding-left: 8px; +} + +.@{prefix}-combobox.@{prefix}-disabled .@{prefix}-btn button { + cursor: default; + .box-shadow(none); + .opacity(@btn-box-disabled-opacity); +} +// ColorBox + +.@{prefix}-colorbox i { + border: 1px solid @textbox-border; + width: 14px; height: 14px; +} +// ColorButton + +.@{prefix}-colorbutton .@{prefix}-ico { + position: relative; +} + +.@{prefix}-colorbutton-grid { + margin: 4px; +} + +.@{prefix}-colorbutton button { + padding-right: 4px; +} + +.@{prefix}-colorbutton .@{prefix}-preview { + padding-right: 3px; + display: block; + position: absolute; + left: 50%; + top: 50%; + margin-left: -14px; + margin-top: 7px; + background: gray; + width: 13px; + height: 2px; + overflow: hidden; +} + +.@{prefix}-colorbutton.@{prefix}-btn-small .@{prefix}-preview { + margin-left: -16px; + padding-right: 0; + width: 16px; +} + +.@{prefix}-colorbutton .@{prefix}-open { + padding-left: 4px; + border-left: 1px solid transparent; + border-right: 1px solid transparent; +} + +.@{prefix}-colorbutton:hover .@{prefix}-open { + border-left-color: @btn-split-border; + border-right-color: @btn-split-border; +} + +.@{prefix}-colorbutton.@{prefix}-btn-small .@{prefix}-open { + padding: 0 3px 0 3px; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-colorbutton { + direction: rtl; +} + +.@{prefix}-rtl .@{prefix}-colorbutton .@{prefix}-preview { + margin-left: 0; + padding-right: 0; + padding-left: 4px; + margin-right: -14px; +} + +.@{prefix}-rtl .@{prefix}-colorbutton.@{prefix}-btn-small .@{prefix}-preview { + margin-left: 0; + padding-right: 0; + margin-right: -17px; + padding-left: 0; +} + +.@{prefix}-rtl .@{prefix}-colorbutton button { + padding-right: 10px; + padding-left: 10px; +} + +.@{prefix}-rtl .@{prefix}-colorbutton .@{prefix}-open { + padding-left: 4px; + padding-right: 4px; +} +// ColorPicker + +.@{prefix}-colorpicker { + position: relative; + width: 250px; + height: 220px; +} + +.@{prefix}-colorpicker-sv { + position: absolute; + top: 0; left: 0; + width: 90%; + height: 100%; + border: 1px solid @colorpicker-border; + cursor: crosshair; + overflow: hidden; +} + +.@{prefix}-colorpicker-h-chunk { + width: 100%; +} + +.@{prefix}-colorpicker-overlay1, .@{prefix}-colorpicker-overlay2 { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; +} + +.@{prefix}-colorpicker-overlay1 { + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff'); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff')"; + background: linear-gradient(to right, rgba(255,255,255,1), rgba(255,255,255,0)); +} + +.@{prefix}-colorpicker-overlay2 { + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000'); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000')"; + background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,1)); +} + +.@{prefix}-colorpicker-selector1 { + background: none; + position: absolute; + width: 12px; + height: 12px; + margin: -8px 0 0 -8px; + border: 1px solid black; + border-radius: 50%; +} + +.@{prefix}-colorpicker-selector2 { + position: absolute; + width: 10px; + height: 10px; + border: 1px solid white; + border-radius: 50%; +} + +.@{prefix}-colorpicker-h { + position: absolute; + top: 0; right: 0; + width: 6.5%; + height: 100%; + border: 1px solid @colorpicker-border; + cursor: crosshair; +} + +.@{prefix}-colorpicker-h-marker { + margin-top: -4px; + position: absolute; + top: 0; + left: -1px; + width: 100%; + border: 1px solid @colorpicker-hue-border; + background: @colorpicker-hue-bg; + height: 4px; + z-index: 100; +} +// Path + +.@{prefix}-path { + .inline-block(); + padding: 8px; + white-space: normal; +} + +.@{prefix}-path .@{prefix}-txt { + display: inline-block; + padding-right: 3px; +} + +.@{prefix}-path .@{prefix}-path-body { + display: inline-block; +} + +.@{prefix}-path-item { + .inline-block(); + cursor: pointer; + color: @path-text; +} + +.@{prefix}-path-item:hover { + text-decoration: underline; +} + +.@{prefix}-path-item:focus { + background: @path-bg-focus; + color: @path-text-focus; +} + +.@{prefix}-path .@{prefix}-divider { + display: inline; +} + +.@{prefix}-disabled .@{prefix}-path-item { + color: @text-disabled; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-path { + direction: rtl; +} +// FieldSet + +.@{prefix}-fieldset { + border: 0 solid #9E9E9E; + .border-radius(3px); +} + +.@{prefix}-fieldset > .@{prefix}-container-body { + margin-top: -15px; +} + +.@{prefix}-fieldset-title { + margin-left: 5px; + padding: 0 5px 0 5px; +}// FitLayout + +.@{prefix}-fit-layout { + .inline-block(); +} + +.@{prefix}-fit-layout-item { + position: absolute; +} +// FlowLayout + +.@{prefix}-flow-layout-item { + .inline-block(); +} + +.@{prefix}-flow-layout-item { + margin: 2px 0 2px 2px; +} + +.@{prefix}-flow-layout-item.@{prefix}-last { + margin-right: 2px; +} + +.@{prefix}-flow-layout { + white-space: normal; +} + +.@{prefix}-tinymce-inline .@{prefix}-flow-layout { + white-space: nowrap; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-flow-layout { + text-align: right; + direction: rtl; +} + +.@{prefix}-rtl .@{prefix}-flow-layout-item { + margin: 2px 2px 2px 0; +} + +.@{prefix}-rtl .@{prefix}-flow-layout-item.@{prefix}-last { + margin-left: 2px; +} +// Iframe + +.@{prefix}-iframe { + border: 0 solid @iframe-border; + width: 100%; height: 100%; +} +// Label + +.@{prefix}-label { + .inline-block(); + text-shadow: @text-shadow; + overflow: hidden; +} + +.@{prefix}-label.@{prefix}-autoscroll { + overflow: auto; +} + +.@{prefix}-label.@{prefix}-disabled { + color: @text-disabled; +} + +.@{prefix}-label.@{prefix}-multiline { + white-space: pre-wrap; +} + +.@{prefix}-label.@{prefix}-error { + color: @text-error; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-label { + text-align: right; + direction: rtl; +} +/* MenuBar */ + +.@{prefix}-menubar .@{prefix}-menubtn { + border-color: transparent; + background: transparent; + .border-radius(0); + .box-shadow(none); + filter: none; +} + +.@{prefix}-menubar { + border: 1px solid @menubar-border; +} + +.@{prefix}-menubar .@{prefix}-menubtn button span { + color: @text; +} + +.@{prefix}-menubar .@{prefix}-caret { + border-top-color: @text; +} + +.@{prefix}-menubar .@{prefix}-menubtn:hover, .@{prefix}-menubar .@{prefix}-menubtn.@{prefix}-active, .@{prefix}-menubar .@{prefix}-menubtn:focus { + border-color: transparent; + background: @menubar-bg-active; + filter: none; + .box-shadow(none); +} +/* MenuButton */ + +.@{prefix}-menubtn span { + color: @btn-text; + margin-right: 2px; + line-height: @line-height; + *line-height: @line-height - 4px; +} + +.@{prefix}-menubtn.@{prefix}-btn-small span { + font-size: @font-size - 2px; +} + +.@{prefix}-menubtn.@{prefix}-fixed-width span { + display: inline-block; + overflow-x: hidden; + text-overflow: ellipsis; + width: 90px; +} + +.@{prefix}-menubtn.@{prefix}-fixed-width.@{prefix}-btn-small span { + width: 70px; +} + +.@{prefix}-menubtn .@{prefix}-caret { + *margin-top: 6px; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-menubtn button { + direction: rtl; + text-align: right; +} +// ListBox + +.@{prefix}-listbox button { + text-align: left; + padding-right: 20px; + position: relative; +} + +.@{prefix}-listbox .@{prefix}-caret { + position: absolute; + margin-top: -2px; + right: 8px; + top: 50%; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-listbox .@{prefix}-caret { + right: auto; + left: 8px; +} + +.@{prefix}-rtl .@{prefix}-listbox button { + padding-right: 10px; + padding-left: 20px; +} +// MenuItem + +.@{prefix}-menu-item { + display: block; + padding: 6px 15px 6px 12px; + clear: both; + font-weight: normal; + line-height: 20px; + color: @menuitem-text; + white-space: nowrap; + cursor: pointer; + line-height: normal; + border-left: 4px solid transparent; + margin-bottom: 1px; +} + +.@{prefix}-menu-item .@{prefix}-ico, .@{prefix}-menu-item .@{prefix}-text { + color: @menuitem-text; +} + +.@{prefix}-menu-item.@{prefix}-disabled .@{prefix}-text, .@{prefix}-menu-item.@{prefix}-disabled .@{prefix}-ico { + color: mix(@menuitem-text, @menu-bg, 40%); +} + +.@{prefix}-menu-item:hover .@{prefix}-text, .@{prefix}-menu-item.@{prefix}-selected .@{prefix}-text, .@{prefix}-menu-item:focus .@{prefix}-text { + color: @menuitem-text-inverse; +} + +.@{prefix}-menu-item:hover .@{prefix}-ico, .@{prefix}-menu-item.@{prefix}-selected .@{prefix}-ico, .@{prefix}-menu-item:focus .@{prefix}-ico { + color: @menuitem-text-inverse; +} + +.@{prefix}-menu-item.@{prefix}-disabled:hover { + background: @menuitem-bg-disabled; +} + +.@{prefix}-menu-shortcut { + display: inline-block; + color: mix(@menuitem-text, @menu-bg, 40%); +} + +.@{prefix}-menu-shortcut { + .inline-block(); + padding: 0 15px 0 20px; +} + +.@{prefix}-menu-item:hover .@{prefix}-menu-shortcut, .@{prefix}-menu-item.@{prefix}-selected .@{prefix}-menu-shortcut, .@{prefix}-menu-item:focus .@{prefix}-menu-shortcut { + color: @menuitem-text-inverse; +} + +.@{prefix}-menu-item .@{prefix}-caret { + margin-top: 4px; + *margin-top: 3px; + margin-right: 6px; + border-top: 4px solid transparent; + border-bottom: 4px solid transparent; + border-left: 4px solid @menuitem-caret; +} + +.@{prefix}-menu-item.@{prefix}-selected .@{prefix}-caret, .@{prefix}-menu-item:focus .@{prefix}-caret, .@{prefix}-menu-item:hover .@{prefix}-caret { + border-left-color: @menuitem-caret-selected; +} + +.@{prefix}-menu-align .@{prefix}-menu-shortcut { + *margin-top: -2px; +} + +.@{prefix}-menu-align .@{prefix}-menu-shortcut, .@{prefix}-menu-align .@{prefix}-caret { + position: absolute; + right: 0; +} + +.@{prefix}-menu-item.@{prefix}-active i { + visibility: visible; +} + +.@{prefix}-menu-item-normal.@{prefix}-active { + background-color: @menuitem-bg-active; +} + +.@{prefix}-menu-item-preview.@{prefix}-active { + border-left: 5px solid @menuitem-preview-border-active; +} + +.@{prefix}-menu-item-normal.@{prefix}-active .@{prefix}-text { + color: @menuitem-text-active; +} + +.@{prefix}-menu-item-normal.@{prefix}-active:hover .@{prefix}-text, .@{prefix}-menu-item-normal.@{prefix}-active:hover .@{prefix}-ico { + color: @menuitem-text-inverse; +} + +.@{prefix}-menu-item-normal.@{prefix}-active:focus .@{prefix}-text, .@{prefix}-menu-item-normal.@{prefix}-active:focus .@{prefix}-ico { + color: @menuitem-text-inverse; +} + +.@{prefix}-menu-item:hover, .@{prefix}-menu-item.@{prefix}-selected, .@{prefix}-menu-item:focus { + text-decoration: none; + color: @menuitem-text-inverse; + .vertical-gradient(@menuitem-bg-selected, @menuitem-bg-selected-hlight); +} + +div.@{prefix}-menu .@{prefix}-menu-item-sep, .@{prefix}-menu-item-sep:hover { + border: 0; + padding: 0; + height: 1px; + margin: 9px 1px; + overflow: hidden; + background: @menuitem-separator-top; + border-bottom: 1px solid @menuitem-separator-bottom; + cursor: default; + filter: none; +} + +// RTL + +.@{prefix}-menu.@{prefix}-rtl { + direction: rtl; +} + +.@{prefix}-rtl .@{prefix}-menu-item { + text-align: right; + direction: rtl; + padding: 6px 12px 6px 15px; +} + +.@{prefix}-menu-align.@{prefix}-rtl .@{prefix}-menu-shortcut, .@{prefix}-menu-align.@{prefix}-rtl .@{prefix}-caret { + right: auto; + left: 0; +} + +.@{prefix}-rtl .@{prefix}-menu-item .@{prefix}-caret { + margin-left: 6px; + margin-right: 0; + border-right: 4px solid @menuitem-caret; + border-left: 0; +} + +.@{prefix}-rtl .@{prefix}-menu-item.@{prefix}-selected .@{prefix}-caret, .@{prefix}-rtl .@{prefix}-menu-item:focus .@{prefix}-caret, .@{prefix}-rtl .@{prefix}-menu-item:hover .@{prefix}-caret { + border-left-color: transparent; + border-right-color: @menuitem-caret-selected; +} +// Menu + +.@{prefix}-menu { + position: absolute; + left: 0; top: 0; + .reset-gradient(); + z-index: 1000; + padding: 5px 0 5px 0; + margin: 2px 0 0; + min-width: 160px; + background: @menu-bg; + border: 1px solid mix(rgb(red(@menu-border), green(@menu-border), blue(@menu-border)), @panel-bg, round(alpha(@menu-border) * 200)); + border: 1px solid @menu-border; + z-index: 1002; + .border-radius(6px); + .box-shadow(0 5px 10px rgba(0,0,0,.2)); + max-height: 400px; + overflow: auto; + overflow-x: hidden; +} + +.@{prefix}-menu i { + display: none; +} + +.@{prefix}-menu-has-icons i { + display: inline-block; + *display: inline; +} + +.@{prefix}-menu-sub-tr-tl { margin: -6px 0 0 -1px; } +.@{prefix}-menu-sub-br-bl { margin: 6px 0 0 -1px; } +.@{prefix}-menu-sub-tl-tr { margin: -6px 0 0 1px; } +.@{prefix}-menu-sub-bl-br { margin: 6px 0 0 1px; } +// Radio - not implemented yet +.@{prefix}-container-body .@{prefix}-resizehandle { + position: absolute; + right: 0; + bottom: 0; + width: 16px; + height: 16px; + visibility: visible; + cursor: s-resize; + margin: 0; +} + +.@{prefix}-container-body .@{prefix}-resizehandle-both { + cursor: se-resize; +} + +i.@{prefix}-i-resize { + color: @text; +} +// Spacer + +.@{prefix}-spacer { + visibility: hidden; +} +// SplitButton + +.@{prefix}-splitbtn .@{prefix}-open { + border-left: 1px solid transparent; + border-right: 1px solid transparent; +} + +.@{prefix}-splitbtn:hover .@{prefix}-open { + border-left-color: @btn-split-border; + border-right-color: @btn-split-border; +} + +.@{prefix}-splitbtn button { + padding-right: 4px; +} + +.@{prefix}-splitbtn .@{prefix}-open { + padding-left: 4px; +} + +.@{prefix}-splitbtn .@{prefix}-open.@{prefix}-active { + .box-shadow(inset 0 2px 4px rgba(0, 0, 0, .15), 0 1px 2px rgba(0, 0, 0 ,.05)); +} + +.@{prefix}-splitbtn.@{prefix}-btn-small .@{prefix}-open { + padding: 0 3px 0 3px; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-splitbtn { + direction: rtl; + text-align: right; +} + +.@{prefix}-rtl .@{prefix}-splitbtn button { + padding-right: 10px; + padding-left: 10px; +} + +.@{prefix}-rtl .@{prefix}-splitbtn .@{prefix}-open { + padding-left: 4px; + padding-right: 4px; +} +// StackLayout + +.@{prefix}-stack-layout-item { + display: block; +} +// TabPanel + +.@{prefix}-tabs { + display: block; + border-bottom: 1px solid @tab-border; +} + +.@{prefix}-tab { + .inline-block(); + border: 1px solid @tab-border; + border-width: 0 1px 0 0; + background: @tab-bg; + padding: 8px; + text-shadow: @text-shadow; + height: 13px; + cursor: pointer; +} + +.@{prefix}-tab:hover { + background: @tab-bg-hover; +} + +.@{prefix}-tab.@{prefix}-active { + background: @tab-bg-active; + border-bottom-color: transparent; + margin-bottom: -1px; + height: 14px; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-tabs { + text-align: right; + direction: rtl; +} + +.@{prefix}-rtl .@{prefix}-tab { + border-width: 0 0 0 1px; +} +// TextBox + +.@{prefix}-textbox { + background: @textbox-bg; + border: 1px solid @textbox-border; + .border-radius(3px); + .box-shadow(@textbox-box-shadow); + display: inline-block; + .transition(~"border linear .2s, box-shadow linear .2s"); + height: 28px; + resize: none; + padding: 0 4px 0 4px; + white-space: pre-wrap; + *white-space: pre; + color: @text; +} + +.@{prefix}-textbox:focus, .@{prefix}-textbox.@{prefix}-focus { + border-color: @textbox-border-focus; + .box-shadow(inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px fadeout(@textbox-border-focus, 15%)); +} + +.@{prefix}-placeholder .@{prefix}-textbox { + color: @textbox-text-placeholder; +} + +.@{prefix}-textbox.@{prefix}-multiline { + padding: 4px; +} + +.@{prefix}-textbox.@{prefix}-disabled { + color: mix(@text, @textbox-bg, 40%); +} + +// RTL + +.@{prefix}-rtl .@{prefix}-textbox { + text-align: right; + direction: rtl; +} +// Throbber + +.@{prefix}-throbber { + position: absolute; + top: 0; left: 0; + width: 100%; height: 100%; + .opacity(0.6); + background: @throbber-bg; +} + +.@{prefix}-throbber-inline { + position: static; + height: 50px; +} +/* Icons IE7 */ + +@font-face { + font-family: 'tinymce'; + src:url('fonts/tinymce.eot'); + src:url('fonts/tinymce.eot?#iefix') format('embedded-opentype'), + url('fonts/tinymce.woff') format('woff'), + url('fonts/tinymce.ttf') format('truetype'), + url('fonts/tinymce.svg#tinymce') format('svg'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'tinymce-small'; + src:url('fonts/tinymce-small.eot'); + src:url('fonts/tinymce-small.eot?#iefix') format('embedded-opentype'), + url('fonts/tinymce-small.woff') format('woff'), + url('fonts/tinymce-small.ttf') format('truetype'), + url('fonts/tinymce-small.svg#tinymce') format('svg'); + font-weight: normal; + font-style: normal; +} + +@iconSize: 16px; + +.@{prefix}-ico { + font-family: 'tinymce'; + font-style: normal; + font-weight: normal; + font-size: @iconSize; + line-height: 16px; + vertical-align: text-top; + -webkit-font-smoothing: antialiased; + + display: inline-block; + background: transparent center center; + width: 16px; + height: 16px; + color: @btn-text; + -ie7-icon: ' '; +} + +.@{prefix}-btn-small .@{prefix}-ico { + font-family: 'tinymce-small'; +} + +// .@{prefix}-i-checkbox needs to have zoom overridden since it's set by the gradient mixin +.@{prefix}-ico, i.@{prefix}-i-checkbox { + zoom: ~"expression(this.runtimeStyle['zoom'] = '1', this.innerHTML = this.currentStyle['-ie7-icon'].substr(1, 1) + ' ')"; +} + +.@{prefix}-i-save { -ie7-icon: "\e000"; } +.@{prefix}-i-newdocument { -ie7-icon: "\e001"; } +.@{prefix}-i-fullpage { -ie7-icon: "\e002"; } +.@{prefix}-i-alignleft { -ie7-icon: "\e003"; } +.@{prefix}-i-aligncenter { -ie7-icon: "\e004"; } +.@{prefix}-i-alignright { -ie7-icon: "\e005"; } +.@{prefix}-i-alignjustify { -ie7-icon: "\e006"; } +.@{prefix}-i-cut { -ie7-icon: "\e007"; } +.@{prefix}-i-paste { -ie7-icon: "\e008"; } +.@{prefix}-i-searchreplace { -ie7-icon: "\e009"; } +.@{prefix}-i-bullist { -ie7-icon: "\e00a"; } +.@{prefix}-i-numlist { -ie7-icon: "\e00b"; } +.@{prefix}-i-indent { -ie7-icon: "\e00c"; } +.@{prefix}-i-outdent { -ie7-icon: "\e00d"; } +.@{prefix}-i-blockquote { -ie7-icon: "\e00e"; } +.@{prefix}-i-undo { -ie7-icon: "\e00f"; } +.@{prefix}-i-redo { -ie7-icon: "\e010"; } +.@{prefix}-i-link { -ie7-icon: "\e011"; } +.@{prefix}-i-unlink { -ie7-icon: "\e012"; } +.@{prefix}-i-anchor { -ie7-icon: "\e013"; } +.@{prefix}-i-image { -ie7-icon: "\e014"; } +.@{prefix}-i-media { -ie7-icon: "\e015"; } +.@{prefix}-i-help { -ie7-icon: "\e016"; } +.@{prefix}-i-code { -ie7-icon: "\e017"; } +.@{prefix}-i-insertdatetime { -ie7-icon: "\e018"; } +.@{prefix}-i-preview { -ie7-icon: "\e019"; } +.@{prefix}-i-forecolor { -ie7-icon: "\e01a"; } +.@{prefix}-i-backcolor { -ie7-icon: "\e01a"; } +.@{prefix}-i-table { -ie7-icon: "\e01b"; } +.@{prefix}-i-hr { -ie7-icon: "\e01c"; } +.@{prefix}-i-removeformat { -ie7-icon: "\e01d"; } +.@{prefix}-i-subscript { -ie7-icon: "\e01e"; } +.@{prefix}-i-superscript { -ie7-icon: "\e01f"; } +.@{prefix}-i-charmap { -ie7-icon: "\e020"; } +.@{prefix}-i-emoticons { -ie7-icon: "\e021"; } +.@{prefix}-i-print { -ie7-icon: "\e022"; } +.@{prefix}-i-fullscreen { -ie7-icon: "\e023"; } +.@{prefix}-i-spellchecker { -ie7-icon: "\e024"; } +.@{prefix}-i-nonbreaking { -ie7-icon: "\e025"; } +.@{prefix}-i-template { -ie7-icon: "\e026"; } +.@{prefix}-i-pagebreak { -ie7-icon: "\e027"; } +.@{prefix}-i-restoredraft { -ie7-icon: "\e028"; } +.@{prefix}-i-untitled { -ie7-icon: "\e029"; } +.@{prefix}-i-bold { -ie7-icon: "\e02a"; } +.@{prefix}-i-italic { -ie7-icon: "\e02b"; } +.@{prefix}-i-underline { -ie7-icon: "\e02c"; } +.@{prefix}-i-strikethrough { -ie7-icon: "\e02d"; } +.@{prefix}-i-visualchars { -ie7-icon: "\e02e"; } +.@{prefix}-i-ltr { -ie7-icon: "\e02f"; } +.@{prefix}-i-rtl { -ie7-icon: "\e030"; } +.@{prefix}-i-copy { -ie7-icon: "\e031"; } +.@{prefix}-i-resize { -ie7-icon: "\e032"; } +.@{prefix}-i-browse { -ie7-icon: "\e034"; } +.@{prefix}-i-pastetext { -ie7-icon: "\e035"; } + +.@{prefix}-i-checkbox, .@{prefix}-i-selected { + -ie7-icon: "\e033"; +} + +.@{prefix}-i-selected { visibility: hidden; } +.@{prefix}-i-backcolor { background: #BBB; } diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.ie7.min.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.ie7.min.css Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +.mce-container,.mce-container *,.mce-widget,.mce-widget *,.mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:#333;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;-webkit-tap-highlight-color:transparent;line-height:normal;font-weight:normal;text-align:left;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-widget button{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.mce-container *[unselectable]{-moz-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none}.mce-fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.mce-fade.mce-in{opacity:1}.mce-tinymce{visibility:inherit !important;position:relative}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;height:100%;z-index:100}div.mce-fullscreen{position:fixed;top:0;left:0;width:100%;height:auto}.mce-tinymce{display:block;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.mce-wordcount{position:absolute;top:0;right:0;padding:8px}div.mce-edit-area{background:#FFF;filter:none}.mce-statusbar{position:relative}.mce-statusbar .mce-container-body{position:relative}.mce-fullscreen .mce-resizehandle{display:none}.mce-charmap{border-collapse:collapse}.mce-charmap td{cursor:default;border:1px solid #9e9e9e;width:20px;height:20px;line-height:20px;text-align:center;vertical-align:middle;padding:2px}.mce-charmap td div{text-align:center}.mce-charmap td:hover{background:#d9d9d9}.mce-grid td.mce-grid-cell div{border:1px solid #d6d6d6;width:15px;height:15px;margin:0px;cursor:pointer}.mce-grid td.mce-grid-cell div:focus{border-color:#a1a1a1}.mce-grid td.mce-grid-cell div[disabled]{cursor:not-allowed}.mce-grid{border-spacing:2px;border-collapse:separate}.mce-grid a{display:block;border:1px solid transparent}.mce-grid a:hover,.mce-grid a:focus{border-color:#a1a1a1}.mce-grid-border{margin:0 4px 0 4px}.mce-grid-border a{border-color:#d6d6d6;width:13px;height:13px}.mce-grid-border a:hover,.mce-grid-border a.mce-active{border-color:#a1a1a1;background:#c8def4}.mce-text-center{text-align:center}div.mce-tinymce-inline{width:100%;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-colorbtn-trans div{text-align:center;vertical-align:middle;font-weight:bold;font-size:20px;line-height:16px;color:#707070}.mce-toolbar-grp{padding-bottom:2px}.mce-toolbar-grp .mce-flow-layout-item{margin-bottom:0}.mce-rtl .mce-wordcount{left:0;right:auto}.mce-container,.mce-container-body{display:block}.mce-autoscroll{overflow:hidden}.mce-scrollbar{position:absolute;width:7px;height:100%;top:2px;right:2px;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-scrollbar-h{top:auto;right:auto;left:2px;bottom:2px;width:100%;height:7px}.mce-scrollbar-thumb{position:absolute;background-color:#000;border:1px solid #888;border-color:rgba(85,85,85,0.6);width:5px;height:100%;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.mce-scrollbar-h .mce-scrollbar-thumb{width:100%;height:5px}.mce-scrollbar:hover,.mce-scrollbar.mce-active{background-color:#AAA;opacity:.6;filter:alpha(opacity=60);zoom:1;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.mce-scroll{position:relative}.mce-panel{border:0 solid #9e9e9e;background-color:#f0f0f0;background-image:-moz-linear-gradient(top, #fdfdfd, #ddd);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fdfdfd), to(#ddd));background-image:-webkit-linear-gradient(top, #fdfdfd, #ddd);background-image:-o-linear-gradient(top, #fdfdfd, #ddd);background-image:linear-gradient(to bottom, #fdfdfd, #ddd);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffdfdfd', endColorstr='#ffdddddd', GradientType=0);zoom:1}.mce-floatpanel{position:absolute;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2)}.mce-floatpanel.mce-fixed{position:fixed}.mce-floatpanel .mce-arrow,.mce-floatpanel .mce-arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.mce-floatpanel .mce-arrow{border-width:11px}.mce-floatpanel .mce-arrow:after{border-width:10px;content:""}.mce-floatpanel.mce-popover{filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);background:transparent;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);top:0;left:0;background:#fff;border:1px solid #9e9e9e;border:1px solid rgba(0,0,0,0.25)}.mce-floatpanel.mce-popover.mce-bottom{margin-top:10px;*margin-top:0}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#9e9e9e;border-bottom-color:rgba(0,0,0,0.25);top:-11px}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow:after{top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#fff}.mce-floatpanel.mce-popover.mce-bottom.mce-start{margin-left:-22px}.mce-floatpanel.mce-popover.mce-bottom.mce-start>.mce-arrow{left:20px}.mce-floatpanel.mce-popover.mce-bottom.mce-end{margin-left:22px}.mce-floatpanel.mce-popover.mce-bottom.mce-end>.mce-arrow{right:10px;left:auto}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;background:#fff;height:100%}div.mce-fullscreen{position:fixed;top:0;left:0}#mce-modal-block{opacity:0;filter:alpha(opacity=0);zoom:1;position:fixed;left:0;top:0;width:100%;height:100%;background:#000}#mce-modal-block.mce-in{opacity:.3;filter:alpha(opacity=30);zoom:1}.mce-window-move{cursor:move}.mce-window{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);background:transparent;background:#fff;position:fixed;top:0;left:0;opacity:0;-webkit-transition:opacity 150ms ease-in;transition:opacity 150ms ease-in}.mce-window.mce-in{opacity:1}.mce-window-head{padding:9px 15px;border-bottom:1px solid #c5c5c5;position:relative}.mce-window-head .mce-close{position:absolute;right:15px;top:9px;font-size:20px;font-weight:bold;line-height:20px;color:#858585;cursor:pointer;height:20px;overflow:hidden}.mce-close:hover{color:#adadad}.mce-window-head .mce-title{line-height:20px;font-size:20px;font-weight:bold;text-rendering:optimizelegibility;padding-right:10px}.mce-window .mce-container-body{display:block}.mce-foot{display:block;background-color:#fff;border-top:1px solid #c5c5c5;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.mce-window-head .mce-dragh{position:absolute;top:0;left:0;cursor:move;width:90%;height:100%}.mce-window iframe{width:100%;height:100%}.mce-window.mce-fullscreen,.mce-window.mce-fullscreen .mce-foot{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mce-rtl .mce-window-head .mce-close{position:absolute;right:auto;left:15px}.mce-rtl .mce-window-head .mce-dragh{left:auto;right:0}.mce-rtl .mce-window-head .mce-title{direction:rtl;text-align:right}.mce-abs-layout{position:relative}body .mce-abs-layout-item,.mce-abs-end{position:absolute}.mce-abs-end{width:1px;height:1px}.mce-container-body.mce-abs-layout{overflow:hidden}.mce-tooltip{position:absolute;padding:5px;opacity:.8;filter:alpha(opacity=80);zoom:1}.mce-tooltip-inner{font-size:11px;background-color:#000;color:#fff;max-width:200px;padding:5px 8px 4px 8px;text-align:center;white-space:normal}.mce-tooltip-inner{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-tooltip-inner{-webkit-box-shadow:0 0 5px #000000;-moz-box-shadow:0 0 5px #000000;box-shadow:0 0 5px #000000}.mce-tooltip-arrow{position:absolute;width:0;height:0;line-height:0;border:5px dashed #000}.mce-tooltip-arrow-n{border-bottom-color:#000}.mce-tooltip-arrow-s{border-top-color:#000}.mce-tooltip-arrow-e{border-left-color:#000}.mce-tooltip-arrow-w{border-right-color:#000}.mce-tooltip-nw,.mce-tooltip-sw{margin-left:-14px}.mce-tooltip-n .mce-tooltip-arrow{top:0px;left:50%;margin-left:-5px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-nw .mce-tooltip-arrow{top:0;left:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-ne .mce-tooltip-arrow{top:0;right:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-s .mce-tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-sw .mce-tooltip-arrow{bottom:0;left:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-se .mce-tooltip-arrow{bottom:0;right:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-e .mce-tooltip-arrow{right:0;top:50%;margin-top:-5px;border-left-style:solid;border-right:none;border-top-color:transparent;border-bottom-color:transparent}.mce-tooltip-w .mce-tooltip-arrow{left:0;top:50%;margin-top:-5px;border-right-style:solid;border-left:none;border-top-color:transparent;border-bottom-color:transparent}.mce-btn{border:1px solid #b1b1b1;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25) rgba(0,0,0,0.25);position:relative;text-shadow:0 1px 1px rgba(255,255,255,0.75);display:inline-block;*display:inline;*zoom:1;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);background-color:#f0f0f0;background-image:-moz-linear-gradient(top, #fff, #d9d9d9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#d9d9d9));background-image:-webkit-linear-gradient(top, #fff, #d9d9d9);background-image:-o-linear-gradient(top, #fff, #d9d9d9);background-image:linear-gradient(to bottom, #fff, #d9d9d9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffd9d9d9', GradientType=0);zoom:1}.mce-btn:hover,.mce-btn:focus{color:#333;background-color:#e3e3e3;background-image:-moz-linear-gradient(top, #f2f2f2, #ccc);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#f2f2f2), to(#ccc));background-image:-webkit-linear-gradient(top, #f2f2f2, #ccc);background-image:-o-linear-gradient(top, #f2f2f2, #ccc);background-image:linear-gradient(to bottom, #f2f2f2, #ccc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffcccccc', GradientType=0);zoom:1}.mce-btn.mce-disabled button,.mce-btn.mce-disabled:hover button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-btn.mce-active,.mce-btn.mce-active:hover{background-color:#d6d6d6;background-image:-moz-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#e6e6e6), to(#c0c0c0));background-image:-webkit-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:-o-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:linear-gradient(to bottom, #e6e6e6, #c0c0c0);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe6e6e6', endColorstr='#ffc0c0c0', GradientType=0);zoom:1;-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)}.mce-btn:active{background-color:#d6d6d6;background-image:-moz-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#e6e6e6), to(#c0c0c0));background-image:-webkit-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:-o-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:linear-gradient(to bottom, #e6e6e6, #c0c0c0);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe6e6e6', endColorstr='#ffc0c0c0', GradientType=0);zoom:1;-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)}.mce-btn button{padding:4px 10px;font-size:14px;line-height:20px;*line-height:16px;cursor:pointer;color:#333;text-align:center;overflow:visible;-webkit-appearance:none}.mce-btn button::-moz-focus-inner{border:0;padding:0}.mce-btn i{text-shadow:1px 1px #fff}.mce-primary{min-width:50px;color:#fff;border:1px solid #b1b1b1;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25) rgba(0,0,0,0.25);background-color:#006dcc;background-image:-moz-linear-gradient(top, #08c, #04c);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#08c), to(#04c));background-image:-webkit-linear-gradient(top, #08c, #04c);background-image:-o-linear-gradient(top, #08c, #04c);background-image:linear-gradient(to bottom, #08c, #04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);zoom:1}.mce-primary:hover,.mce-primary:focus{background-color:#005fb3;background-image:-moz-linear-gradient(top, #0077b3, #003cb3);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0077b3), to(#003cb3));background-image:-webkit-linear-gradient(top, #0077b3, #003cb3);background-image:-o-linear-gradient(top, #0077b3, #003cb3);background-image:linear-gradient(to bottom, #0077b3, #003cb3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0077b3', endColorstr='#ff003cb3', GradientType=0);zoom:1}.mce-primary.mce-disabled button,.mce-primary.mce-disabled:hover button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-primary.mce-active,.mce-primary.mce-active:hover,.mce-primary:not(.mce-disabled):active{background-color:#005299;background-image:-moz-linear-gradient(top, #069, #039);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#069), to(#039));background-image:-webkit-linear-gradient(top, #069, #039);background-image:-o-linear-gradient(top, #069, #039);background-image:linear-gradient(to bottom, #069, #039);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff006699', endColorstr='#ff003399', GradientType=0);zoom:1;-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)}.mce-primary button,.mce-primary button i{color:#fff;text-shadow:1px 1px #333}.mce-btn-large button{padding:9px 14px;font-size:16px;line-height:normal;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.mce-btn-large i{margin-top:2px}.mce-btn-small button{padding:1px 5px;font-size:12px;*padding-bottom:2px}.mce-btn-small i{line-height:20px;vertical-align:top;*line-height:18px}.mce-btn .mce-caret{margin-top:8px;margin-left:0}.mce-btn-small .mce-caret{margin-top:8px;margin-left:0}.mce-caret{display:inline-block;*display:inline;*zoom:1;width:0;height:0;vertical-align:top;border-top:4px solid #333;border-right:4px solid transparent;border-left:4px solid transparent;content:""}.mce-disabled .mce-caret{border-top-color:#aaa}.mce-caret.mce-up{border-bottom:4px solid #333;border-top:0}.mce-btn-flat{border:0;background:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:none}.mce-btn-flat:hover,.mce-btn-flat.mce-active,.mce-btn-flat:focus,.mce-btn-flat:active{border:0;background:#e6e6e6;filter:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-rtl .mce-btn button{direction:rtl}.mce-btn-group .mce-btn{border-width:1px 0 1px 0;margin:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mce-btn-group .mce-first{border-left:1px solid #b1b1b1;border-left:1px solid rgba(0,0,0,0.25);-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.mce-btn-group .mce-last{border-right:1px solid #b1b1b1;border-right:1px solid rgba(0,0,0,0.1);-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.mce-btn-group .mce-first.mce-last{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-btn-group .mce-btn.mce-flow-layout-item{margin:0}.mce-checkbox{cursor:pointer}i.mce-i-checkbox{margin:0 3px 0 0;border:1px solid #c5c5c5;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);background-color:#f0f0f0;background-image:-moz-linear-gradient(top, #fff, #d9d9d9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#d9d9d9));background-image:-webkit-linear-gradient(top, #fff, #d9d9d9);background-image:-o-linear-gradient(top, #fff, #d9d9d9);background-image:linear-gradient(to bottom, #fff, #d9d9d9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffd9d9d9', GradientType=0);zoom:1;text-indent:-10em;*font-size:0;*line-height:0;*text-indent:0;overflow:hidden}.mce-checked i.mce-i-checkbox{color:#333;font-size:16px;line-height:16px;text-indent:0}.mce-checkbox:focus i.mce-i-checkbox,.mce-checkbox.mce-focus i.mce-i-checkbox{border:1px solid rgba(82,168,236,0.8);-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65)}.mce-checkbox.mce-disabled .mce-label,.mce-checkbox.mce-disabled i.mce-i-checkbox{color:#acacac}.mce-rtl .mce-checkbox{direction:rtl;text-align:right}.mce-rtl i.mce-i-checkbox{margin:0 0 0 3px}.mce-combobox{display:inline-block;*display:inline;*zoom:1;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);*height:32px}.mce-combobox input{border:1px solid #c5c5c5;border-right-color:#c5c5c5;height:28px}.mce-combobox.mce-disabled input{color:#adadad}.mce-combobox.mce-has-open input{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.mce-combobox .mce-btn{border-left:0;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.mce-combobox button{padding-right:8px;padding-left:8px}.mce-combobox.mce-disabled .mce-btn button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-colorbox i{border:1px solid #c5c5c5;width:14px;height:14px}.mce-colorbutton .mce-ico{position:relative}.mce-colorbutton-grid{margin:4px}.mce-colorbutton button{padding-right:4px}.mce-colorbutton .mce-preview{padding-right:3px;display:block;position:absolute;left:50%;top:50%;margin-left:-14px;margin-top:7px;background:gray;width:13px;height:2px;overflow:hidden}.mce-colorbutton.mce-btn-small .mce-preview{margin-left:-16px;padding-right:0;width:16px}.mce-colorbutton .mce-open{padding-left:4px;border-left:1px solid transparent;border-right:1px solid transparent}.mce-colorbutton:hover .mce-open{border-left-color:#bdbdbd;border-right-color:#bdbdbd}.mce-colorbutton.mce-btn-small .mce-open{padding:0 3px 0 3px}.mce-rtl .mce-colorbutton{direction:rtl}.mce-rtl .mce-colorbutton .mce-preview{margin-left:0;padding-right:0;padding-left:4px;margin-right:-14px}.mce-rtl .mce-colorbutton.mce-btn-small .mce-preview{margin-left:0;padding-right:0;margin-right:-17px;padding-left:0}.mce-rtl .mce-colorbutton button{padding-right:10px;padding-left:10px}.mce-rtl .mce-colorbutton .mce-open{padding-left:4px;padding-right:4px}.mce-colorpicker{position:relative;width:250px;height:220px}.mce-colorpicker-sv{position:absolute;top:0;left:0;width:90%;height:100%;border:1px solid #c5c5c5;cursor:crosshair;overflow:hidden}.mce-colorpicker-h-chunk{width:100%}.mce-colorpicker-overlay1,.mce-colorpicker-overlay2{width:100%;height:100%;position:absolute;top:0;left:0}.mce-colorpicker-overlay1{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr='#ffffff', endColorstr='#00ffffff');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff')";background:linear-gradient(to right, #fff, rgba(255,255,255,0))}.mce-colorpicker-overlay2{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#00000000', endColorstr='#000000');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000')";background:linear-gradient(to bottom, rgba(0,0,0,0), #000)}.mce-colorpicker-selector1{background:none;position:absolute;width:12px;height:12px;margin:-8px 0 0 -8px;border:1px solid black;border-radius:50%}.mce-colorpicker-selector2{position:absolute;width:10px;height:10px;border:1px solid white;border-radius:50%}.mce-colorpicker-h{position:absolute;top:0;right:0;width:6.5%;height:100%;border:1px solid #c5c5c5;cursor:crosshair}.mce-colorpicker-h-marker{margin-top:-4px;position:absolute;top:0;left:-1px;width:100%;border:1px solid #333;background:#fff;height:4px;z-index:100}.mce-path{display:inline-block;*display:inline;*zoom:1;padding:8px;white-space:normal}.mce-path .mce-txt{display:inline-block;padding-right:3px}.mce-path .mce-path-body{display:inline-block}.mce-path-item{display:inline-block;*display:inline;*zoom:1;cursor:pointer;color:#333}.mce-path-item:hover{text-decoration:underline}.mce-path-item:focus{background:#666;color:#fff}.mce-path .mce-divider{display:inline}.mce-disabled .mce-path-item{color:#aaa}.mce-rtl .mce-path{direction:rtl}.mce-fieldset{border:0 solid #9E9E9E;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-fieldset>.mce-container-body{margin-top:-15px}.mce-fieldset-title{margin-left:5px;padding:0 5px 0 5px}.mce-fit-layout{display:inline-block;*display:inline;*zoom:1}.mce-fit-layout-item{position:absolute}.mce-flow-layout-item{display:inline-block;*display:inline;*zoom:1}.mce-flow-layout-item{margin:2px 0 2px 2px}.mce-flow-layout-item.mce-last{margin-right:2px}.mce-flow-layout{white-space:normal}.mce-tinymce-inline .mce-flow-layout{white-space:nowrap}.mce-rtl .mce-flow-layout{text-align:right;direction:rtl}.mce-rtl .mce-flow-layout-item{margin:2px 2px 2px 0}.mce-rtl .mce-flow-layout-item.mce-last{margin-left:2px}.mce-iframe{border:0 solid #9e9e9e;width:100%;height:100%}.mce-label{display:inline-block;*display:inline;*zoom:1;text-shadow:0 1px 1px rgba(255,255,255,0.75);overflow:hidden}.mce-label.mce-autoscroll{overflow:auto}.mce-label.mce-disabled{color:#aaa}.mce-label.mce-multiline{white-space:pre-wrap}.mce-label.mce-error{color:#a00}.mce-rtl .mce-label{text-align:right;direction:rtl}.mce-menubar .mce-menubtn{border-color:transparent;background:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:none}.mce-menubar{border:1px solid #c4c4c4}.mce-menubar .mce-menubtn button span{color:#333}.mce-menubar .mce-caret{border-top-color:#333}.mce-menubar .mce-menubtn:hover,.mce-menubar .mce-menubtn.mce-active,.mce-menubar .mce-menubtn:focus{border-color:transparent;background:#e6e6e6;filter:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-menubtn span{color:#333;margin-right:2px;line-height:20px;*line-height:16px}.mce-menubtn.mce-btn-small span{font-size:12px}.mce-menubtn.mce-fixed-width span{display:inline-block;overflow-x:hidden;text-overflow:ellipsis;width:90px}.mce-menubtn.mce-fixed-width.mce-btn-small span{width:70px}.mce-menubtn .mce-caret{*margin-top:6px}.mce-rtl .mce-menubtn button{direction:rtl;text-align:right}.mce-listbox button{text-align:left;padding-right:20px;position:relative}.mce-listbox .mce-caret{position:absolute;margin-top:-2px;right:8px;top:50%}.mce-rtl .mce-listbox .mce-caret{right:auto;left:8px}.mce-rtl .mce-listbox button{padding-right:10px;padding-left:20px}.mce-menu-item{display:block;padding:6px 15px 6px 12px;clear:both;font-weight:normal;line-height:20px;color:#333;white-space:nowrap;cursor:pointer;line-height:normal;border-left:4px solid transparent;margin-bottom:1px}.mce-menu-item .mce-ico,.mce-menu-item .mce-text{color:#333}.mce-menu-item.mce-disabled .mce-text,.mce-menu-item.mce-disabled .mce-ico{color:#adadad}.mce-menu-item:hover .mce-text,.mce-menu-item.mce-selected .mce-text,.mce-menu-item:focus .mce-text{color:#fff}.mce-menu-item:hover .mce-ico,.mce-menu-item.mce-selected .mce-ico,.mce-menu-item:focus .mce-ico{color:#fff}.mce-menu-item.mce-disabled:hover{background:#ccc}.mce-menu-shortcut{display:inline-block;color:#adadad}.mce-menu-shortcut{display:inline-block;*display:inline;*zoom:1;padding:0 15px 0 20px}.mce-menu-item:hover .mce-menu-shortcut,.mce-menu-item.mce-selected .mce-menu-shortcut,.mce-menu-item:focus .mce-menu-shortcut{color:#fff}.mce-menu-item .mce-caret{margin-top:4px;*margin-top:3px;margin-right:6px;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid #333}.mce-menu-item.mce-selected .mce-caret,.mce-menu-item:focus .mce-caret,.mce-menu-item:hover .mce-caret{border-left-color:#fff}.mce-menu-align .mce-menu-shortcut{*margin-top:-2px}.mce-menu-align .mce-menu-shortcut,.mce-menu-align .mce-caret{position:absolute;right:0}.mce-menu-item.mce-active i{visibility:visible}.mce-menu-item-normal.mce-active{background-color:#c8def4}.mce-menu-item-preview.mce-active{border-left:5px solid #aaa}.mce-menu-item-normal.mce-active .mce-text{color:#333}.mce-menu-item-normal.mce-active:hover .mce-text,.mce-menu-item-normal.mce-active:hover .mce-ico{color:#fff}.mce-menu-item-normal.mce-active:focus .mce-text,.mce-menu-item-normal.mce-active:focus .mce-ico{color:#fff}.mce-menu-item:hover,.mce-menu-item.mce-selected,.mce-menu-item:focus{text-decoration:none;color:#fff;background-color:#0081c2;background-image:-moz-linear-gradient(top, #08c, #0077b3);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#08c), to(#0077b3));background-image:-webkit-linear-gradient(top, #08c, #0077b3);background-image:-o-linear-gradient(top, #08c, #0077b3);background-image:linear-gradient(to bottom, #08c, #0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);zoom:1}div.mce-menu .mce-menu-item-sep,.mce-menu-item-sep:hover{border:0;padding:0;height:1px;margin:9px 1px;overflow:hidden;background:#cbcbcb;border-bottom:1px solid #fff;cursor:default;filter:none}.mce-menu.mce-rtl{direction:rtl}.mce-rtl .mce-menu-item{text-align:right;direction:rtl;padding:6px 12px 6px 15px}.mce-menu-align.mce-rtl .mce-menu-shortcut,.mce-menu-align.mce-rtl .mce-caret{right:auto;left:0}.mce-rtl .mce-menu-item .mce-caret{margin-left:6px;margin-right:0;border-right:4px solid #333;border-left:0}.mce-rtl .mce-menu-item.mce-selected .mce-caret,.mce-rtl .mce-menu-item:focus .mce-caret,.mce-rtl .mce-menu-item:hover .mce-caret{border-left-color:transparent;border-right-color:#fff}.mce-menu{position:absolute;left:0;top:0;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);background:transparent;z-index:1000;padding:5px 0 5px 0;margin:2px 0 0;min-width:160px;background:#fff;border:1px solid #989898;border:1px solid rgba(0,0,0,0.2);z-index:1002;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);max-height:400px;overflow:auto;overflow-x:hidden}.mce-menu i{display:none}.mce-menu-has-icons i{display:inline-block;*display:inline}.mce-menu-sub-tr-tl{margin:-6px 0 0 -1px}.mce-menu-sub-br-bl{margin:6px 0 0 -1px}.mce-menu-sub-tl-tr{margin:-6px 0 0 1px}.mce-menu-sub-bl-br{margin:6px 0 0 1px}.mce-container-body .mce-resizehandle{position:absolute;right:0;bottom:0;width:16px;height:16px;visibility:visible;cursor:s-resize;margin:0}.mce-container-body .mce-resizehandle-both{cursor:se-resize}i.mce-i-resize{color:#333}.mce-spacer{visibility:hidden}.mce-splitbtn .mce-open{border-left:1px solid transparent;border-right:1px solid transparent}.mce-splitbtn:hover .mce-open{border-left-color:#bdbdbd;border-right-color:#bdbdbd}.mce-splitbtn button{padding-right:4px}.mce-splitbtn .mce-open{padding-left:4px}.mce-splitbtn .mce-open.mce-active{-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)}.mce-splitbtn.mce-btn-small .mce-open{padding:0 3px 0 3px}.mce-rtl .mce-splitbtn{direction:rtl;text-align:right}.mce-rtl .mce-splitbtn button{padding-right:10px;padding-left:10px}.mce-rtl .mce-splitbtn .mce-open{padding-left:4px;padding-right:4px}.mce-stack-layout-item{display:block}.mce-tabs{display:block;border-bottom:1px solid #c5c5c5}.mce-tab{display:inline-block;*display:inline;*zoom:1;border:1px solid #c5c5c5;border-width:0 1px 0 0;background:#e3e3e3;padding:8px;text-shadow:0 1px 1px rgba(255,255,255,0.75);height:13px;cursor:pointer}.mce-tab:hover{background:#fdfdfd}.mce-tab.mce-active{background:#fdfdfd;border-bottom-color:transparent;margin-bottom:-1px;height:14px}.mce-rtl .mce-tabs{text-align:right;direction:rtl}.mce-rtl .mce-tab{border-width:0 0 0 1px}.mce-textbox{background:#fff;border:1px solid #c5c5c5;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);display:inline-block;-webkit-transition:border linear .2s, box-shadow linear .2s;transition:border linear .2s, box-shadow linear .2s;height:28px;resize:none;padding:0 4px 0 4px;white-space:pre-wrap;*white-space:pre;color:#333}.mce-textbox:focus,.mce-textbox.mce-focus{border-color:rgba(82,168,236,0.8);-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65)}.mce-placeholder .mce-textbox{color:#aaa}.mce-textbox.mce-multiline{padding:4px}.mce-textbox.mce-disabled{color:#adadad}.mce-rtl .mce-textbox{text-align:right;direction:rtl}.mce-throbber{position:absolute;top:0;left:0;width:100%;height:100%;opacity:.6;filter:alpha(opacity=60);zoom:1;background:#fff url('img/loader.gif') no-repeat center center}.mce-throbber-inline{position:static;height:50px}@font-face{font-family:'tinymce';src:url('fonts/tinymce.eot');src:url('fonts/tinymce.eot?#iefix') format('embedded-opentype'),url('fonts/tinymce.woff') format('woff'),url('fonts/tinymce.ttf') format('truetype'),url('fonts/tinymce.svg#tinymce') format('svg');font-weight:normal;font-style:normal}@font-face{font-family:'tinymce-small';src:url('fonts/tinymce-small.eot');src:url('fonts/tinymce-small.eot?#iefix') format('embedded-opentype'),url('fonts/tinymce-small.woff') format('woff'),url('fonts/tinymce-small.ttf') format('truetype'),url('fonts/tinymce-small.svg#tinymce') format('svg');font-weight:normal;font-style:normal}.mce-ico{font-family:'tinymce';font-style:normal;font-weight:normal;font-size:16px;line-height:16px;vertical-align:text-top;-webkit-font-smoothing:antialiased;display:inline-block;background:transparent center center;width:16px;height:16px;color:#333;-ie7-icon:' '}.mce-btn-small .mce-ico{font-family:'tinymce-small'}.mce-ico,i.mce-i-checkbox{zoom:expression(this.runtimeStyle['zoom'] = '1', this.innerHTML = this.currentStyle['-ie7-icon'].substr(1, 1) + ' ')}.mce-i-save{-ie7-icon:"\e000"}.mce-i-newdocument{-ie7-icon:"\e001"}.mce-i-fullpage{-ie7-icon:"\e002"}.mce-i-alignleft{-ie7-icon:"\e003"}.mce-i-aligncenter{-ie7-icon:"\e004"}.mce-i-alignright{-ie7-icon:"\e005"}.mce-i-alignjustify{-ie7-icon:"\e006"}.mce-i-cut{-ie7-icon:"\e007"}.mce-i-paste{-ie7-icon:"\e008"}.mce-i-searchreplace{-ie7-icon:"\e009"}.mce-i-bullist{-ie7-icon:"\e00a"}.mce-i-numlist{-ie7-icon:"\e00b"}.mce-i-indent{-ie7-icon:"\e00c"}.mce-i-outdent{-ie7-icon:"\e00d"}.mce-i-blockquote{-ie7-icon:"\e00e"}.mce-i-undo{-ie7-icon:"\e00f"}.mce-i-redo{-ie7-icon:"\e010"}.mce-i-link{-ie7-icon:"\e011"}.mce-i-unlink{-ie7-icon:"\e012"}.mce-i-anchor{-ie7-icon:"\e013"}.mce-i-image{-ie7-icon:"\e014"}.mce-i-media{-ie7-icon:"\e015"}.mce-i-help{-ie7-icon:"\e016"}.mce-i-code{-ie7-icon:"\e017"}.mce-i-insertdatetime{-ie7-icon:"\e018"}.mce-i-preview{-ie7-icon:"\e019"}.mce-i-forecolor{-ie7-icon:"\e01a"}.mce-i-backcolor{-ie7-icon:"\e01a"}.mce-i-table{-ie7-icon:"\e01b"}.mce-i-hr{-ie7-icon:"\e01c"}.mce-i-removeformat{-ie7-icon:"\e01d"}.mce-i-subscript{-ie7-icon:"\e01e"}.mce-i-superscript{-ie7-icon:"\e01f"}.mce-i-charmap{-ie7-icon:"\e020"}.mce-i-emoticons{-ie7-icon:"\e021"}.mce-i-print{-ie7-icon:"\e022"}.mce-i-fullscreen{-ie7-icon:"\e023"}.mce-i-spellchecker{-ie7-icon:"\e024"}.mce-i-nonbreaking{-ie7-icon:"\e025"}.mce-i-template{-ie7-icon:"\e026"}.mce-i-pagebreak{-ie7-icon:"\e027"}.mce-i-restoredraft{-ie7-icon:"\e028"}.mce-i-untitled{-ie7-icon:"\e029"}.mce-i-bold{-ie7-icon:"\e02a"}.mce-i-italic{-ie7-icon:"\e02b"}.mce-i-underline{-ie7-icon:"\e02c"}.mce-i-strikethrough{-ie7-icon:"\e02d"}.mce-i-visualchars{-ie7-icon:"\e02e"}.mce-i-ltr{-ie7-icon:"\e02f"}.mce-i-rtl{-ie7-icon:"\e030"}.mce-i-copy{-ie7-icon:"\e031"}.mce-i-resize{-ie7-icon:"\e032"}.mce-i-browse{-ie7-icon:"\e034"}.mce-i-pastetext{-ie7-icon:"\e035"}.mce-i-checkbox,.mce-i-selected{-ie7-icon:"\e033"}.mce-i-selected{visibility:hidden}.mce-i-backcolor{background:#BBB} \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1903 @@ +// Reset + +.@{prefix}-container, .@{prefix}-container *, .@{prefix}-widget, .@{prefix}-widget *, .@{prefix}-reset { + margin: 0; padding: 0; border: 0; outline: 0; + vertical-align: top; background: transparent; + text-decoration: none; color: @text; + font-family: @font-family; + font-size: @font-size; text-shadow: none; float: none; + position: static; width: auto; height: auto; + white-space: nowrap; cursor: inherit; + -webkit-tap-highlight-color: transparent; + line-height: normal; font-weight: normal; + text-align: left; + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + box-sizing: content-box; + direction: ltr; + max-width: none; +} + +.@{prefix}-widget button { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} + +.@{prefix}-container *[unselectable] { + -moz-user-select: none; + -webkit-user-select: none; + -o-user-select: none; + user-select: none; +} +// Variables +// Syntax: -()--()-(); +// Example: @btn-primary-bg-hover-hlight; + +@prefix: mce; + +// Default font +@font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +@font-size: 14px; +@line-height: 20px; +@has-gradients: true; +@has-radius: true; +@has-boxshadow: true; + +// Text colors +@text: #333; +@text-inverse: white; +@text-disabled: #aaa; +@text-shadow: 0 1px 1px hsla(hue(@text-inverse), saturation(@text-inverse), lightness(@text-inverse), 0.75); +@text-error: #aa0000; + +// Button +@btn-text: @text; +@btn-text-shadow: @text-inverse; +@btn-border-top: rgba(0, 0, 0, .1); +@btn-border-right: rgba(0, 0, 0, .1); +@btn-border-bottom: fadein(rgba(0, 0, 0, .1), 15%); +@btn-border-left: fadein(rgba(0, 0, 0, .1), 15%); +@btn-split-border: #bdbdbd; +@btn-caret-border: @btn-text; +@btn-text-disabled: @text-disabled; +@btn-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 1px 2px rgba(0, 0, 0, .05); +@btn-box-shadow-active: inset 0 2px 4px rgba(0, 0, 0, .15), 0 1px 2px rgba(0, 0, 0, .05); +@btn-box-disabled-opacity: 0.4; +@btn-bg: white; +@btn-bg-hlight: #D9D9D9; +@btn-bg-hover: darken(@btn-bg, 5%); +@btn-bg-hlight-hover: darken(@btn-bg-hlight, 5%); + +@btn-primary-bg: #0088cc; +@btn-primary-bg-hlight: #0044cc; +@btn-primary-bg-hover: darken(@btn-primary-bg, 5%); +@btn-primary-bg-hover-hlight: darken(@btn-primary-bg-hlight, 5%); +@btn-primary-text: #fff; +@btn-primary-text-shadow: #333; +@btn-primary-border-top: mix(@btn-border-top, @btn-primary-bg, 50%); +@btn-primary-border-right: mix(@btn-border-right, @btn-primary-bg, 50%); +@btn-primary-border-bottom: mix(@btn-border-bottom, @btn-primary-bg, 50%); +@btn-primary-border-left: mix(@btn-border-left, @btn-primary-bg, 50%); + +// Menu +@menuitem-text: @text; +@menu-bg: #fff; +@menu-border: rgba(0, 0, 0, 0.2); +@menubar-border: mix(@panel-border, @panel-bg, 60%); +@menuitem-text-inverse: @text-inverse; +@menubar-bg-active: darken(@btn-bg, 10%); +@menuitem-bg-hover: #0081C2; +@menuitem-bg-selected: #08C; +@menuitem-bg-selected-hlight: #0077B3; +@menuitem-bg-disabled: #CCC; +@menuitem-caret: @menuitem-text; +@menuitem-caret-selected: @menuitem-text-inverse; +@menuitem-separator-top: #CBCBCB; +@menuitem-separator-bottom: @menu-bg; +@menuitem-bg-active: #C8DEF4; +@menuitem-text-active: @text; +@menuitem-preview-border-active: #aaa; + +// Panel +@panel-border: #9E9E9E; +@panel-bg: #FDFDFD; +@panel-bg-hlight: #DDD; + +// Tabs +@tab-border: #c5c5c5; +@tab-bg: #e3e3e3; +@tab-bg-hover: #FDFDFD; +@tab-bg-active: #FDFDFD; + +// Tooltip +@tooltip-bg: #000; +@tooltip-text: white; +@tooltip-font-size: 11px; + +// Window +@window-border: #c5c5c5; +@window-head-border: @window-border; +@window-head-close: mix(@text, @window-bg, 60%); +@window-head-close-hover: mix(@text, @window-bg, 40%); +@window-foot-border: @window-border; +@window-foot-bg: @window-bg; +@window-fullscreen-bg: #FFF; +@window-modalblock-bg: #000; +@window-modalblock-opacity: 0.3; +@window-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); +@window-bg: #FFF; +@window-title-font-size: 20px; + +// Popover +@popover-bg: @window-bg; +@popover-arrow-width: 10px; +@popover-arrow: @window-bg; +@popover-arrow-outer-width: @popover-arrow-width + 1; +@popover-arrow-outer: rgba(0, 0, 0, 0.25); + +// Floatpanel +@floatpanel-box-shadow: 0 5px 10px rgba(0, 0, 0, .2); + +// Checkbox +@checkbox-bg: @btn-bg; +@checkbox-bg-hlight: @btn-bg-hlight; +@checkbox-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 1px 2px rgba(0, 0, 0, .05); +@checkbox-border: #c5c5c5; +@checkbox-border-focus: rgba(82, 168, 236, .8); + +// Path +@path-text: @text; +@path-bg-focus: #666; +@path-text-focus: #fff; + +// Textbox +@textbox-text-placeholder: #aaa; +@textbox-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +@textbox-bg: #fff; +@textbox-border: #c5c5c5; +@textbox-border-focus: rgba(82, 168, 236, .8); + +// Throbber +@throbber-bg: #fff url('img/loader.gif') no-repeat center center; + +// Combobox +@combobox-border: @textbox-border; + +// Colorpicker +@colorpicker-border: @textbox-border; +@colorpicker-hue-bg: #fff; +@colorpicker-hue-border: #333; + +// Grid +@grid-bg-active: @menuitem-bg-active; +@grid-border-active: #a1a1a1; +@grid-border: #d6d6d6; + +// Misc +@colorbtn-backcolor-bg: #BBB; +@iframe-border: @panel-border; +// Mixins + +.opacity(@opacity) { + opacity: @opacity; + @opacityie: @opacity * 100; + filter: ~"alpha(opacity=@{opacityie})"; + zoom: 1; +} + +.vertical-gradient(@startColor, @endColor) when (@has-gradients = true) { + background-color: mix(@startColor, @endColor, 60%); + background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+ + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+ + background-image: -webkit-linear-gradient(top, @startColor, @endColor); // Safari 5.1+, Chrome 10+ + background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10 + background-image: linear-gradient(to bottom, @startColor, @endColor); // Standard, IE10 + background-repeat: repeat-x; + filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)", argb(@startColor), argb(@endColor))); + zoom: 1; +} + +.vertical-gradient(@startColor, @endColor) when (@has-gradients = false) { + background-color: mix(@startColor, @endColor, 60%); +} + +.border-radius(@radius) when (@has-radius = true) { + -webkit-border-radius: @radius; + -moz-border-radius: @radius; + border-radius: @radius; +} + +.box-shadow(@shadowA, @shadowB:X, ...) when (@has-boxshadow = true) { + // Multiple shadow solution from http://toekneestuck.com/blog/2012/05/15/less-css-arguments-variable/ + @props: ~`"@{arguments}".replace(/[\[\]]|\,\sX/g, '')`; + -webkit-box-shadow: @props; + -moz-box-shadow: @props; + box-shadow: @props; +} + +.transition(@transition) { + -webkit-transition: @transition; + transition: @transition; +} + +.inline-block() { + display: inline-block; + *display: inline; + *zoom: 1; +} + +.reset-gradient() { + filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)")); + background: transparent; +} +// Animations + +.@{prefix}-fade { + opacity: 0; + .transition(opacity .15s linear); + + &.@{prefix}-in { + opacity: 1; + } +} +.@{prefix}-tinymce { + // Avoid FOUC + visibility: inherit !important; + position: relative; +} + +.@{prefix}-fullscreen { + border: 0; padding: 0; margin: 0; + overflow: hidden; + height: 100%; + z-index: 100; +} + +div.@{prefix}-fullscreen { + position: fixed; + top: 0; left: 0; + width: 100%; + height: auto; +} + +.@{prefix}-tinymce { + display: block; + .border-radius(2px); +} + +.@{prefix}-wordcount { + position: absolute; + top: 0; + right: 0; + padding: 8px; +} + +div.@{prefix}-edit-area { + background: #FFF; + filter: none; +} + +.@{prefix}-statusbar { + position: relative; +} + +.@{prefix}-statusbar .@{prefix}-container-body { + position: relative; +} + +.@{prefix}-fullscreen .@{prefix}-resizehandle { + display: none; +} + +// Charmap + +.@{prefix}-charmap { + border-collapse: collapse; +} + +.@{prefix}-charmap td { + cursor: default; + border: 1px solid @panel-border; + width: 20px; + height: 20px; + line-height: 20px; + text-align: center; + vertical-align: middle; + padding: 2px; +} + +.@{prefix}-charmap td div { + text-align: center; +} + +.@{prefix}-charmap td:hover { + background: @btn-bg-hlight; +} + +.@{prefix}-grid td.@{prefix}-grid-cell div { + border: 1px solid @grid-border; + width: 15px; height: 15px; + margin: 0px; + cursor: pointer; + + &:focus { + border-color: @grid-border-active; + } + + &[disabled] { + cursor: not-allowed; + } +} + +.@{prefix}-grid { + border-spacing: 2px; + border-collapse: separate; + + a { + display: block; + border: 1px solid transparent; + + &:hover, &:focus { + border-color: @grid-border-active; + } + } +} + +.@{prefix}-grid-border { + margin: 0 4px 0 4px; + + a { + border-color: @grid-border; + width: 13px; height: 13px; + } + + a:hover, a.@{prefix}-active { + border-color: @grid-border-active; + background: @grid-bg-active; + } +} + +.@{prefix}-text-center { + text-align: center; +} + +div.@{prefix}-tinymce-inline { + width: 100%; + .box-shadow(none); +} + +.@{prefix}-colorbtn-trans div { + text-align: center; + vertical-align: middle; + font-weight: bold; + font-size: 20px; + line-height: 16px; + color: mix(@text, #fff, 70%); +} + +// Reduce double margins between toolbar rows + +.@{prefix}-toolbar-grp { + padding-bottom: 2px; +} + +.@{prefix}-toolbar-grp .@{prefix}-flow-layout-item { + margin-bottom: 0; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-wordcount { + left: 0; + right: auto; +} +// Container + +.@{prefix}-container, .@{prefix}-container-body { + display: block; +} + +.@{prefix}-autoscroll { + overflow: hidden; +} +// Scrollbar + +.@{prefix}-scrollbar { + position: absolute; + width: 7px; + height: 100%; + top: 2px; + right: 2px; + .opacity(0.4); +} + +.@{prefix}-scrollbar-h { + top: auto; + right: auto; + left: 2px; + bottom: 2px; + width: 100%; + height: 7px; +} + +.@{prefix}-scrollbar-thumb { + position: absolute; + background-color: #000; + border: 1px solid #888; + border-color: rgba(85, 85, 85, .6); + width: 5px; + height: 100%; + .border-radius(7px); +} + +.@{prefix}-scrollbar-h .@{prefix}-scrollbar-thumb { + width: 100%; + height: 5px; +} + +.@{prefix}-scrollbar:hover, .@{prefix}-scrollbar.@{prefix}-active { + background-color: #AAA; + .opacity(0.6); + .border-radius(7px); +} + +.@{prefix}-scroll { + position: relative; +} +// Panel + +.@{prefix}-panel { + border: 0 solid @panel-border; + .vertical-gradient(@panel-bg, @panel-bg-hlight); +} +// FloatPanel + +.@{prefix}-floatpanel { + position: absolute; + .box-shadow(@floatpanel-box-shadow); +} + +.@{prefix}-floatpanel.@{prefix}-fixed { + position: fixed; +} + +// Popover panel + +.@{prefix}-floatpanel .@{prefix}-arrow, +.@{prefix}-floatpanel .@{prefix}-arrow:after { + position: absolute; + display: block; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} + +.@{prefix}-floatpanel .@{prefix}-arrow { + border-width: @popover-arrow-outer-width; +} + +.@{prefix}-floatpanel .@{prefix}-arrow:after { + border-width: @popover-arrow-width; + content: ""; +} + +.@{prefix}-floatpanel.@{prefix}-popover { + .reset-gradient(); + .border-radius(6px); + .box-shadow(@floatpanel-box-shadow); + top: 0; + left: 0; + background: @popover-bg; + border: 1px solid @panel-border; + border: 1px solid @popover-arrow-outer; + + &.@{prefix}-bottom { + margin-top: @popover-arrow-width; + *margin-top: 0; + + & > .@{prefix}-arrow { + left: 50%; + margin-left: -@popover-arrow-outer-width; + border-top-width: 0; + border-bottom-color: @panel-border; + border-bottom-color: @popover-arrow-outer; + top: -@popover-arrow-outer-width; + + &:after { + top: 1px; + margin-left: -@popover-arrow-width; + border-top-width: 0; + border-bottom-color: @popover-arrow; + } + } + + &.@{prefix}-start { margin-left: -22px; } + &.@{prefix}-start > .@{prefix}-arrow { left: 20px; } + + &.@{prefix}-end { margin-left: 22px; } + &.@{prefix}-end > .@{prefix}-arrow { right: 10px; left: auto; } + } +}// Window + +.@{prefix}-fullscreen { + border: 0; padding: 0; margin: 0; + overflow: hidden; + background: @window-fullscreen-bg; + height: 100%; +} + +div.@{prefix}-fullscreen { + position: fixed; + top: 0; left: 0; +} + +#@{prefix}-modal-block { + .opacity(0); + position: fixed; + left: 0; top: 0; + width: 100%; height: 100%; + background: @window-modalblock-bg; +} + +#@{prefix}-modal-block.@{prefix}-in { + .opacity(@window-modalblock-opacity); +} + +.@{prefix}-window-move { + cursor: move; +} + +.@{prefix}-window { + .border-radius(6px); + .box-shadow(@window-box-shadow); + .reset-gradient(); + background: @window-bg; + position: fixed; + top: 0; left: 0; + opacity: 0; + .transition(opacity 150ms ease-in); +} + +.@{prefix}-window.@{prefix}-in { + opacity: 1; +} + +.@{prefix}-window-head { + padding: 9px 15px; + border-bottom: 1px solid @window-head-border; + position: relative; +} + +.@{prefix}-window-head .@{prefix}-close { + position: absolute; + right: 15px; + top: 9px; + font-size: 20px; + font-weight: bold; + line-height: 20px; + color: @window-head-close; + cursor: pointer; + + // IE7 + height: 20px; + overflow: hidden; +} + +.@{prefix}-close:hover { + color: @window-head-close-hover; +} + +.@{prefix}-window-head .@{prefix}-title { + line-height: 20px; + font-size: @window-title-font-size; + font-weight: bold; + text-rendering: optimizelegibility; + padding-right: 10px; +} + +.@{prefix}-window .@{prefix}-container-body { + display: block; +} + +.@{prefix}-foot { + display: block; + background-color: @window-foot-bg; + border-top: 1px solid @window-foot-border; + .border-radius(0 0 6px 6px); +} + +.@{prefix}-window-head .@{prefix}-dragh { + position: absolute; + top: 0; left: 0; + cursor: move; + width: 90%; + height: 100%; +} + +.@{prefix}-window iframe { + width: 100%; + height: 100%; +} + +.@{prefix}-window.@{prefix}-fullscreen, .@{prefix}-window.@{prefix}-fullscreen .@{prefix}-foot { + .border-radius(0); +} + +// RTL + +.@{prefix}-rtl .@{prefix}-window-head .@{prefix}-close { + position: absolute; + right: auto; + left: 15px; +} + +.@{prefix}-rtl .@{prefix}-window-head .@{prefix}-dragh { + left: auto; + right: 0; +} + +.@{prefix}-rtl .@{prefix}-window-head .@{prefix}-title { + direction: rtl; + text-align: right; +} +// AbsoluteLayout + +.@{prefix}-abs-layout { + position: relative; +} + +body .@{prefix}-abs-layout-item, .@{prefix}-abs-end { + position: absolute; +} + +.@{prefix}-abs-end { + width: 1px; height: 1px; +} + +.@{prefix}-container-body.@{prefix}-abs-layout { + overflow: hidden; +} +// Tooltip + +.@{prefix}-tooltip { + position: absolute; + padding: 5px; + .opacity(0.8); +} + +.@{prefix}-tooltip-inner { + font-size: @tooltip-font-size; + background-color: @tooltip-bg; + color: @tooltip-text; + max-width: 200px; + padding: 5px 8px 4px 8px; + text-align: center; + white-space: normal; +} + +.@{prefix}-tooltip-inner { + .border-radius(3px); +} + +.@{prefix}-tooltip-inner { + .box-shadow(0 0 5px @tooltip-bg); +} + +.@{prefix}-tooltip-arrow { + position: absolute; + width: 0; + height: 0; + line-height: 0; + border: 5px dashed @tooltip-bg; +} + +.@{prefix}-tooltip-arrow-n { + border-bottom-color: @tooltip-bg; +} + +.@{prefix}-tooltip-arrow-s { + border-top-color: @tooltip-bg; +} + +.@{prefix}-tooltip-arrow-e { + border-left-color: @tooltip-bg; +} + +.@{prefix}-tooltip-arrow-w { + border-right-color: @tooltip-bg; +} + +.@{prefix}-tooltip-nw, .@{prefix}-tooltip-sw { + margin-left: -14px; +} + +.@{prefix}-tooltip-n .@{prefix}-tooltip-arrow { + top: 0px; + left: 50%; + margin-left: -5px; + border-bottom-style: solid; + border-top: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-nw .@{prefix}-tooltip-arrow { + top: 0; + left: 10px; + border-bottom-style: solid; + border-top: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-ne .@{prefix}-tooltip-arrow { + top: 0; + right: 10px; + border-bottom-style: solid; + border-top: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-s .@{prefix}-tooltip-arrow { + bottom: 0; + left: 50%; + margin-left: -5px; + border-top-style: solid; + border-bottom: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-sw .@{prefix}-tooltip-arrow { + bottom: 0; + left: 10px; + border-top-style: solid; + border-bottom: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-se .@{prefix}-tooltip-arrow { + bottom: 0; + right: 10px; + border-top-style: solid; + border-bottom: none; + border-left-color: transparent; + border-right-color: transparent; +} + +.@{prefix}-tooltip-e .@{prefix}-tooltip-arrow { + right: 0; + top: 50%; + margin-top: -5px; + border-left-style: solid; + border-right: none; + border-top-color: transparent; + border-bottom-color: transparent; +} + +.@{prefix}-tooltip-w .@{prefix}-tooltip-arrow { + left: 0; + top: 50%; + margin-top: -5px; + border-right-style: solid; + border-left: none; + border-top-color: transparent; + border-bottom-color: transparent; +} +// Button + +.@{prefix}-btn { + border: 1px solid mix(rgb(red(@btn-border-right), green(@btn-border-right), blue(@btn-border-right)), @panel-bg, 30%); + border-color: @btn-border-top @btn-border-right @btn-border-bottom @btn-border-left; + position: relative; + text-shadow: @text-shadow; + + .inline-block(); + .border-radius(3px); + .box-shadow(@btn-box-shadow); + .vertical-gradient(@btn-bg, @btn-bg-hlight); + + &:hover, &:focus { + color: @btn-text; + .vertical-gradient(darken(@btn-bg, 5%), darken(@btn-bg-hlight, 5%)); + } + + &.@{prefix}-disabled button, &.@{prefix}-disabled:hover button { + cursor: default; + .box-shadow(none); + .opacity(@btn-box-disabled-opacity); + } + + &.@{prefix}-active, &.@{prefix}-active:hover { + .vertical-gradient(darken(@btn-bg, 10%), darken(@btn-bg-hlight, 10%)); + .box-shadow(@btn-box-shadow-active); + } + + &:active { + .vertical-gradient(darken(@btn-bg, 10%), darken(@btn-bg-hlight, 10%)); + .box-shadow(@btn-box-shadow-active); + } +} + +.@{prefix}-btn button { + padding: 4px 10px; + font-size: @font-size; + line-height: @line-height; + *line-height: @line-height - 4px; + cursor: pointer; + color: @btn-text; + text-align: center; + + // Fixes for default inner padding of button + overflow: visible; // IE7 + -webkit-appearance: none; // WebKit + &::-moz-focus-inner { // Gecko + border: 0; + padding: 0; + } +} + +.@{prefix}-btn i { + text-shadow: 1px 1px @btn-text-shadow; +} + +.@{prefix}-primary { + min-width: 50px; + color: @btn-primary-text; + border: 1px solid mix(rgb(red(@btn-border-right), green(@btn-border-right), blue(@btn-border-right)), @panel-bg, 30%); + border-color: @btn-border-top @btn-border-right @btn-border-bottom @btn-border-left; + .vertical-gradient(@btn-primary-bg, @btn-primary-bg-hlight); + + &:hover, &:focus { + .vertical-gradient(darken(@btn-primary-bg, 5%), darken(@btn-primary-bg-hlight, 5%)); + } + + &.@{prefix}-disabled button, &.@{prefix}-disabled:hover button { + cursor: default; + .box-shadow(none); + .opacity(@btn-box-disabled-opacity); + } + + &.@{prefix}-active, &.@{prefix}-active:hover, &:not(.@{prefix}-disabled):active { + .vertical-gradient(darken(@btn-primary-bg, 10%), darken(@btn-primary-bg-hlight, 10%)); + .box-shadow(@btn-box-shadow-active); + } +} + +.@{prefix}-primary button, .@{prefix}-primary button i { + color: @btn-primary-text; + text-shadow: 1px 1px @btn-primary-text-shadow; +} + +.@{prefix}-btn-large button { + padding: 9px 14px; + font-size: @font-size + 2px; + line-height: normal; + .border-radius(5px); +} + +.@{prefix}-btn-large i { + margin-top: 2px; +} + +.@{prefix}-btn-small button { + padding: 1px 5px; + font-size: @font-size - 2px; + *padding-bottom: 2px; +} + +.@{prefix}-btn-small i { + line-height: 20px; + vertical-align: top; + *line-height: 18px; +} + +.@{prefix}-btn .@{prefix}-caret { + margin-top: 8px; + margin-left: 0; +} + +.@{prefix}-btn-small .@{prefix}-caret { + margin-top: 8px; + margin-left: 0; +} + +.@{prefix}-caret { + .inline-block(); + width: 0; height: 0; + vertical-align: top; + border-top: 4px solid @btn-caret-border; + border-right: 4px solid transparent; + border-left: 4px solid transparent; + content: ""; +} + +.@{prefix}-disabled .@{prefix}-caret { + border-top-color: @text-disabled; +} + +.@{prefix}-caret.@{prefix}-up { + border-bottom: 4px solid @btn-caret-border; + border-top: 0; +} + +.@{prefix}-btn-flat { + border: 0; + background: transparent; + .border-radius(0); + .box-shadow(none); + filter: none; +} + +.@{prefix}-btn-flat:hover, .@{prefix}-btn-flat.@{prefix}-active, .@{prefix}-btn-flat:focus, .@{prefix}-btn-flat:active { + border: 0; + background: @menubar-bg-active; + filter: none; + .box-shadow(none); +} + +// RTL + +.@{prefix}-rtl .@{prefix}-btn button { + direction: rtl; +} +// ButtonGroup + +.@{prefix}-btn-group .@{prefix}-btn { + border-width: 1px 0 1px 0; + margin: 0; + .border-radius(0); +} + +.@{prefix}-btn-group .@{prefix}-first { + border-left: 1px solid mix(rgb(red(@btn-border-left), green(@btn-border-left), blue(@btn-border-left)), @panel-bg, 30%); + border-left: 1px solid @btn-border-left; + .border-radius(3px 0 0 3px); +} + +.@{prefix}-btn-group .@{prefix}-last { + border-right: 1px solid mix(rgb(red(@btn-border-right), green(@btn-border-right), blue(@btn-border-right)), @panel-bg, 30%); + border-right: 1px solid @btn-border-right; + .border-radius(0 3px 3px 0); +} + +.@{prefix}-btn-group .@{prefix}-first.@{prefix}-last { + .border-radius(3px); +} + +.@{prefix}-btn-group .@{prefix}-btn.@{prefix}-flow-layout-item { + margin: 0; +} +// Checkbox + +.@{prefix}-checkbox { + cursor: pointer; +} + +i.@{prefix}-i-checkbox { + margin: 0 3px 0 0; + border: 1px solid @checkbox-border; + .border-radius(3px); + .box-shadow(@checkbox-box-shadow); + .vertical-gradient(@checkbox-bg, @checkbox-bg-hlight); + text-indent: -10em; + *font-size: 0; + *line-height: 0; + *text-indent: 0; + overflow: hidden; +} + +.@{prefix}-checked i.@{prefix}-i-checkbox { + color: @btn-text; + font-size: 16px; + line-height: 16px; + text-indent: 0; +} + +.@{prefix}-checkbox:focus i.@{prefix}-i-checkbox, .@{prefix}-checkbox.@{prefix}-focus i.@{prefix}-i-checkbox { + border: 1px solid @checkbox-border-focus; + .box-shadow(inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px fadeout(@checkbox-border-focus, 15%)); +} + +.@{prefix}-checkbox.@{prefix}-disabled .@{prefix}-label, .@{prefix}-checkbox.@{prefix}-disabled i.@{prefix}-i-checkbox { + color: mix(@text, @panel-bg, 40%); +} + +// RTL + +.@{prefix}-rtl .@{prefix}-checkbox { + direction: rtl; + text-align: right; +} + +.@{prefix}-rtl i.@{prefix}-i-checkbox { + margin: 0 0 0 3px; +} +// ComboBox + +.@{prefix}-combobox { + .inline-block(); + .border-radius(3px); + .box-shadow(@textbox-box-shadow); + *height: 32px; +} + +.@{prefix}-combobox input { + border: 1px solid @textbox-border; + border-right-color: @combobox-border; + height: 28px; +} + +.@{prefix}-combobox.@{prefix}-disabled input { + color: mix(@text, @textbox-bg, 40%); +} + +.@{prefix}-combobox.@{prefix}-has-open input { + .border-radius(4px 0 0 4px); +} + +.@{prefix}-combobox .@{prefix}-btn { + border-left: 0; + .border-radius(0 4px 4px 0); +} + +.@{prefix}-combobox button { + padding-right: 8px; + padding-left: 8px; +} + +.@{prefix}-combobox.@{prefix}-disabled .@{prefix}-btn button { + cursor: default; + .box-shadow(none); + .opacity(@btn-box-disabled-opacity); +} +// ColorBox + +.@{prefix}-colorbox i { + border: 1px solid @textbox-border; + width: 14px; height: 14px; +} +// ColorButton + +.@{prefix}-colorbutton .@{prefix}-ico { + position: relative; +} + +.@{prefix}-colorbutton-grid { + margin: 4px; +} + +.@{prefix}-colorbutton button { + padding-right: 4px; +} + +.@{prefix}-colorbutton .@{prefix}-preview { + padding-right: 3px; + display: block; + position: absolute; + left: 50%; + top: 50%; + margin-left: -14px; + margin-top: 7px; + background: gray; + width: 13px; + height: 2px; + overflow: hidden; +} + +.@{prefix}-colorbutton.@{prefix}-btn-small .@{prefix}-preview { + margin-left: -16px; + padding-right: 0; + width: 16px; +} + +.@{prefix}-colorbutton .@{prefix}-open { + padding-left: 4px; + border-left: 1px solid transparent; + border-right: 1px solid transparent; +} + +.@{prefix}-colorbutton:hover .@{prefix}-open { + border-left-color: @btn-split-border; + border-right-color: @btn-split-border; +} + +.@{prefix}-colorbutton.@{prefix}-btn-small .@{prefix}-open { + padding: 0 3px 0 3px; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-colorbutton { + direction: rtl; +} + +.@{prefix}-rtl .@{prefix}-colorbutton .@{prefix}-preview { + margin-left: 0; + padding-right: 0; + padding-left: 4px; + margin-right: -14px; +} + +.@{prefix}-rtl .@{prefix}-colorbutton.@{prefix}-btn-small .@{prefix}-preview { + margin-left: 0; + padding-right: 0; + margin-right: -17px; + padding-left: 0; +} + +.@{prefix}-rtl .@{prefix}-colorbutton button { + padding-right: 10px; + padding-left: 10px; +} + +.@{prefix}-rtl .@{prefix}-colorbutton .@{prefix}-open { + padding-left: 4px; + padding-right: 4px; +} +// ColorPicker + +.@{prefix}-colorpicker { + position: relative; + width: 250px; + height: 220px; +} + +.@{prefix}-colorpicker-sv { + position: absolute; + top: 0; left: 0; + width: 90%; + height: 100%; + border: 1px solid @colorpicker-border; + cursor: crosshair; + overflow: hidden; +} + +.@{prefix}-colorpicker-h-chunk { + width: 100%; +} + +.@{prefix}-colorpicker-overlay1, .@{prefix}-colorpicker-overlay2 { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; +} + +.@{prefix}-colorpicker-overlay1 { + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff'); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff')"; + background: linear-gradient(to right, rgba(255,255,255,1), rgba(255,255,255,0)); +} + +.@{prefix}-colorpicker-overlay2 { + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000'); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000')"; + background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,1)); +} + +.@{prefix}-colorpicker-selector1 { + background: none; + position: absolute; + width: 12px; + height: 12px; + margin: -8px 0 0 -8px; + border: 1px solid black; + border-radius: 50%; +} + +.@{prefix}-colorpicker-selector2 { + position: absolute; + width: 10px; + height: 10px; + border: 1px solid white; + border-radius: 50%; +} + +.@{prefix}-colorpicker-h { + position: absolute; + top: 0; right: 0; + width: 6.5%; + height: 100%; + border: 1px solid @colorpicker-border; + cursor: crosshair; +} + +.@{prefix}-colorpicker-h-marker { + margin-top: -4px; + position: absolute; + top: 0; + left: -1px; + width: 100%; + border: 1px solid @colorpicker-hue-border; + background: @colorpicker-hue-bg; + height: 4px; + z-index: 100; +} +// Path + +.@{prefix}-path { + .inline-block(); + padding: 8px; + white-space: normal; +} + +.@{prefix}-path .@{prefix}-txt { + display: inline-block; + padding-right: 3px; +} + +.@{prefix}-path .@{prefix}-path-body { + display: inline-block; +} + +.@{prefix}-path-item { + .inline-block(); + cursor: pointer; + color: @path-text; +} + +.@{prefix}-path-item:hover { + text-decoration: underline; +} + +.@{prefix}-path-item:focus { + background: @path-bg-focus; + color: @path-text-focus; +} + +.@{prefix}-path .@{prefix}-divider { + display: inline; +} + +.@{prefix}-disabled .@{prefix}-path-item { + color: @text-disabled; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-path { + direction: rtl; +} +// FieldSet + +.@{prefix}-fieldset { + border: 0 solid #9E9E9E; + .border-radius(3px); +} + +.@{prefix}-fieldset > .@{prefix}-container-body { + margin-top: -15px; +} + +.@{prefix}-fieldset-title { + margin-left: 5px; + padding: 0 5px 0 5px; +}// FitLayout + +.@{prefix}-fit-layout { + .inline-block(); +} + +.@{prefix}-fit-layout-item { + position: absolute; +} +// FlowLayout + +.@{prefix}-flow-layout-item { + .inline-block(); +} + +.@{prefix}-flow-layout-item { + margin: 2px 0 2px 2px; +} + +.@{prefix}-flow-layout-item.@{prefix}-last { + margin-right: 2px; +} + +.@{prefix}-flow-layout { + white-space: normal; +} + +.@{prefix}-tinymce-inline .@{prefix}-flow-layout { + white-space: nowrap; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-flow-layout { + text-align: right; + direction: rtl; +} + +.@{prefix}-rtl .@{prefix}-flow-layout-item { + margin: 2px 2px 2px 0; +} + +.@{prefix}-rtl .@{prefix}-flow-layout-item.@{prefix}-last { + margin-left: 2px; +} +// Iframe + +.@{prefix}-iframe { + border: 0 solid @iframe-border; + width: 100%; height: 100%; +} +// Label + +.@{prefix}-label { + .inline-block(); + text-shadow: @text-shadow; + overflow: hidden; +} + +.@{prefix}-label.@{prefix}-autoscroll { + overflow: auto; +} + +.@{prefix}-label.@{prefix}-disabled { + color: @text-disabled; +} + +.@{prefix}-label.@{prefix}-multiline { + white-space: pre-wrap; +} + +.@{prefix}-label.@{prefix}-error { + color: @text-error; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-label { + text-align: right; + direction: rtl; +} +/* MenuBar */ + +.@{prefix}-menubar .@{prefix}-menubtn { + border-color: transparent; + background: transparent; + .border-radius(0); + .box-shadow(none); + filter: none; +} + +.@{prefix}-menubar { + border: 1px solid @menubar-border; +} + +.@{prefix}-menubar .@{prefix}-menubtn button span { + color: @text; +} + +.@{prefix}-menubar .@{prefix}-caret { + border-top-color: @text; +} + +.@{prefix}-menubar .@{prefix}-menubtn:hover, .@{prefix}-menubar .@{prefix}-menubtn.@{prefix}-active, .@{prefix}-menubar .@{prefix}-menubtn:focus { + border-color: transparent; + background: @menubar-bg-active; + filter: none; + .box-shadow(none); +} +/* MenuButton */ + +.@{prefix}-menubtn span { + color: @btn-text; + margin-right: 2px; + line-height: @line-height; + *line-height: @line-height - 4px; +} + +.@{prefix}-menubtn.@{prefix}-btn-small span { + font-size: @font-size - 2px; +} + +.@{prefix}-menubtn.@{prefix}-fixed-width span { + display: inline-block; + overflow-x: hidden; + text-overflow: ellipsis; + width: 90px; +} + +.@{prefix}-menubtn.@{prefix}-fixed-width.@{prefix}-btn-small span { + width: 70px; +} + +.@{prefix}-menubtn .@{prefix}-caret { + *margin-top: 6px; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-menubtn button { + direction: rtl; + text-align: right; +} +// ListBox + +.@{prefix}-listbox button { + text-align: left; + padding-right: 20px; + position: relative; +} + +.@{prefix}-listbox .@{prefix}-caret { + position: absolute; + margin-top: -2px; + right: 8px; + top: 50%; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-listbox .@{prefix}-caret { + right: auto; + left: 8px; +} + +.@{prefix}-rtl .@{prefix}-listbox button { + padding-right: 10px; + padding-left: 20px; +} +// MenuItem + +.@{prefix}-menu-item { + display: block; + padding: 6px 15px 6px 12px; + clear: both; + font-weight: normal; + line-height: 20px; + color: @menuitem-text; + white-space: nowrap; + cursor: pointer; + line-height: normal; + border-left: 4px solid transparent; + margin-bottom: 1px; +} + +.@{prefix}-menu-item .@{prefix}-ico, .@{prefix}-menu-item .@{prefix}-text { + color: @menuitem-text; +} + +.@{prefix}-menu-item.@{prefix}-disabled .@{prefix}-text, .@{prefix}-menu-item.@{prefix}-disabled .@{prefix}-ico { + color: mix(@menuitem-text, @menu-bg, 40%); +} + +.@{prefix}-menu-item:hover .@{prefix}-text, .@{prefix}-menu-item.@{prefix}-selected .@{prefix}-text, .@{prefix}-menu-item:focus .@{prefix}-text { + color: @menuitem-text-inverse; +} + +.@{prefix}-menu-item:hover .@{prefix}-ico, .@{prefix}-menu-item.@{prefix}-selected .@{prefix}-ico, .@{prefix}-menu-item:focus .@{prefix}-ico { + color: @menuitem-text-inverse; +} + +.@{prefix}-menu-item.@{prefix}-disabled:hover { + background: @menuitem-bg-disabled; +} + +.@{prefix}-menu-shortcut { + display: inline-block; + color: mix(@menuitem-text, @menu-bg, 40%); +} + +.@{prefix}-menu-shortcut { + .inline-block(); + padding: 0 15px 0 20px; +} + +.@{prefix}-menu-item:hover .@{prefix}-menu-shortcut, .@{prefix}-menu-item.@{prefix}-selected .@{prefix}-menu-shortcut, .@{prefix}-menu-item:focus .@{prefix}-menu-shortcut { + color: @menuitem-text-inverse; +} + +.@{prefix}-menu-item .@{prefix}-caret { + margin-top: 4px; + *margin-top: 3px; + margin-right: 6px; + border-top: 4px solid transparent; + border-bottom: 4px solid transparent; + border-left: 4px solid @menuitem-caret; +} + +.@{prefix}-menu-item.@{prefix}-selected .@{prefix}-caret, .@{prefix}-menu-item:focus .@{prefix}-caret, .@{prefix}-menu-item:hover .@{prefix}-caret { + border-left-color: @menuitem-caret-selected; +} + +.@{prefix}-menu-align .@{prefix}-menu-shortcut { + *margin-top: -2px; +} + +.@{prefix}-menu-align .@{prefix}-menu-shortcut, .@{prefix}-menu-align .@{prefix}-caret { + position: absolute; + right: 0; +} + +.@{prefix}-menu-item.@{prefix}-active i { + visibility: visible; +} + +.@{prefix}-menu-item-normal.@{prefix}-active { + background-color: @menuitem-bg-active; +} + +.@{prefix}-menu-item-preview.@{prefix}-active { + border-left: 5px solid @menuitem-preview-border-active; +} + +.@{prefix}-menu-item-normal.@{prefix}-active .@{prefix}-text { + color: @menuitem-text-active; +} + +.@{prefix}-menu-item-normal.@{prefix}-active:hover .@{prefix}-text, .@{prefix}-menu-item-normal.@{prefix}-active:hover .@{prefix}-ico { + color: @menuitem-text-inverse; +} + +.@{prefix}-menu-item-normal.@{prefix}-active:focus .@{prefix}-text, .@{prefix}-menu-item-normal.@{prefix}-active:focus .@{prefix}-ico { + color: @menuitem-text-inverse; +} + +.@{prefix}-menu-item:hover, .@{prefix}-menu-item.@{prefix}-selected, .@{prefix}-menu-item:focus { + text-decoration: none; + color: @menuitem-text-inverse; + .vertical-gradient(@menuitem-bg-selected, @menuitem-bg-selected-hlight); +} + +div.@{prefix}-menu .@{prefix}-menu-item-sep, .@{prefix}-menu-item-sep:hover { + border: 0; + padding: 0; + height: 1px; + margin: 9px 1px; + overflow: hidden; + background: @menuitem-separator-top; + border-bottom: 1px solid @menuitem-separator-bottom; + cursor: default; + filter: none; +} + +// RTL + +.@{prefix}-menu.@{prefix}-rtl { + direction: rtl; +} + +.@{prefix}-rtl .@{prefix}-menu-item { + text-align: right; + direction: rtl; + padding: 6px 12px 6px 15px; +} + +.@{prefix}-menu-align.@{prefix}-rtl .@{prefix}-menu-shortcut, .@{prefix}-menu-align.@{prefix}-rtl .@{prefix}-caret { + right: auto; + left: 0; +} + +.@{prefix}-rtl .@{prefix}-menu-item .@{prefix}-caret { + margin-left: 6px; + margin-right: 0; + border-right: 4px solid @menuitem-caret; + border-left: 0; +} + +.@{prefix}-rtl .@{prefix}-menu-item.@{prefix}-selected .@{prefix}-caret, .@{prefix}-rtl .@{prefix}-menu-item:focus .@{prefix}-caret, .@{prefix}-rtl .@{prefix}-menu-item:hover .@{prefix}-caret { + border-left-color: transparent; + border-right-color: @menuitem-caret-selected; +} +// Menu + +.@{prefix}-menu { + position: absolute; + left: 0; top: 0; + .reset-gradient(); + z-index: 1000; + padding: 5px 0 5px 0; + margin: 2px 0 0; + min-width: 160px; + background: @menu-bg; + border: 1px solid mix(rgb(red(@menu-border), green(@menu-border), blue(@menu-border)), @panel-bg, round(alpha(@menu-border) * 200)); + border: 1px solid @menu-border; + z-index: 1002; + .border-radius(6px); + .box-shadow(0 5px 10px rgba(0,0,0,.2)); + max-height: 400px; + overflow: auto; + overflow-x: hidden; +} + +.@{prefix}-menu i { + display: none; +} + +.@{prefix}-menu-has-icons i { + display: inline-block; + *display: inline; +} + +.@{prefix}-menu-sub-tr-tl { margin: -6px 0 0 -1px; } +.@{prefix}-menu-sub-br-bl { margin: 6px 0 0 -1px; } +.@{prefix}-menu-sub-tl-tr { margin: -6px 0 0 1px; } +.@{prefix}-menu-sub-bl-br { margin: 6px 0 0 1px; } +// Radio - not implemented yet +.@{prefix}-container-body .@{prefix}-resizehandle { + position: absolute; + right: 0; + bottom: 0; + width: 16px; + height: 16px; + visibility: visible; + cursor: s-resize; + margin: 0; +} + +.@{prefix}-container-body .@{prefix}-resizehandle-both { + cursor: se-resize; +} + +i.@{prefix}-i-resize { + color: @text; +} +// Spacer + +.@{prefix}-spacer { + visibility: hidden; +} +// SplitButton + +.@{prefix}-splitbtn .@{prefix}-open { + border-left: 1px solid transparent; + border-right: 1px solid transparent; +} + +.@{prefix}-splitbtn:hover .@{prefix}-open { + border-left-color: @btn-split-border; + border-right-color: @btn-split-border; +} + +.@{prefix}-splitbtn button { + padding-right: 4px; +} + +.@{prefix}-splitbtn .@{prefix}-open { + padding-left: 4px; +} + +.@{prefix}-splitbtn .@{prefix}-open.@{prefix}-active { + .box-shadow(inset 0 2px 4px rgba(0, 0, 0, .15), 0 1px 2px rgba(0, 0, 0 ,.05)); +} + +.@{prefix}-splitbtn.@{prefix}-btn-small .@{prefix}-open { + padding: 0 3px 0 3px; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-splitbtn { + direction: rtl; + text-align: right; +} + +.@{prefix}-rtl .@{prefix}-splitbtn button { + padding-right: 10px; + padding-left: 10px; +} + +.@{prefix}-rtl .@{prefix}-splitbtn .@{prefix}-open { + padding-left: 4px; + padding-right: 4px; +} +// StackLayout + +.@{prefix}-stack-layout-item { + display: block; +} +// TabPanel + +.@{prefix}-tabs { + display: block; + border-bottom: 1px solid @tab-border; +} + +.@{prefix}-tab { + .inline-block(); + border: 1px solid @tab-border; + border-width: 0 1px 0 0; + background: @tab-bg; + padding: 8px; + text-shadow: @text-shadow; + height: 13px; + cursor: pointer; +} + +.@{prefix}-tab:hover { + background: @tab-bg-hover; +} + +.@{prefix}-tab.@{prefix}-active { + background: @tab-bg-active; + border-bottom-color: transparent; + margin-bottom: -1px; + height: 14px; +} + +// RTL + +.@{prefix}-rtl .@{prefix}-tabs { + text-align: right; + direction: rtl; +} + +.@{prefix}-rtl .@{prefix}-tab { + border-width: 0 0 0 1px; +} +// TextBox + +.@{prefix}-textbox { + background: @textbox-bg; + border: 1px solid @textbox-border; + .border-radius(3px); + .box-shadow(@textbox-box-shadow); + display: inline-block; + .transition(~"border linear .2s, box-shadow linear .2s"); + height: 28px; + resize: none; + padding: 0 4px 0 4px; + white-space: pre-wrap; + *white-space: pre; + color: @text; +} + +.@{prefix}-textbox:focus, .@{prefix}-textbox.@{prefix}-focus { + border-color: @textbox-border-focus; + .box-shadow(inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px fadeout(@textbox-border-focus, 15%)); +} + +.@{prefix}-placeholder .@{prefix}-textbox { + color: @textbox-text-placeholder; +} + +.@{prefix}-textbox.@{prefix}-multiline { + padding: 4px; +} + +.@{prefix}-textbox.@{prefix}-disabled { + color: mix(@text, @textbox-bg, 40%); +} + +// RTL + +.@{prefix}-rtl .@{prefix}-textbox { + text-align: right; + direction: rtl; +} +// Throbber + +.@{prefix}-throbber { + position: absolute; + top: 0; left: 0; + width: 100%; height: 100%; + .opacity(0.6); + background: @throbber-bg; +} + +.@{prefix}-throbber-inline { + position: static; + height: 50px; +} +/* Icons */ + +@font-face { + font-family: 'tinymce'; + src:url('fonts/tinymce.eot'); + src:url('fonts/tinymce.eot?#iefix') format('embedded-opentype'), + url('fonts/tinymce.woff') format('woff'), + url('fonts/tinymce.ttf') format('truetype'), + url('fonts/tinymce.svg#tinymce') format('svg'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'tinymce-small'; + src:url('fonts/tinymce-small.eot'); + src:url('fonts/tinymce-small.eot?#iefix') format('embedded-opentype'), + url('fonts/tinymce-small.woff') format('woff'), + url('fonts/tinymce-small.ttf') format('truetype'), + url('fonts/tinymce-small.svg#tinymce') format('svg'); + font-weight: normal; + font-style: normal; +} + +@iconSize: 16px; + +.@{prefix}-ico { + font-family: 'tinymce', Arial; + font-style: normal; + font-weight: normal; + font-variant: normal; + font-size: @iconSize; + line-height: 16px; + speak: none; + vertical-align: text-top; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + + display: inline-block; + background: transparent center center; + background-size: cover; + width: 16px; + height: 16px; + color: @btn-text; +} + +.@{prefix}-btn-small .@{prefix}-ico { + font-family: 'tinymce-small', Arial; +} + +.@{prefix}-i-save:before { content: "\e000"; } +.@{prefix}-i-newdocument:before { content: "\e001"; } +.@{prefix}-i-fullpage:before { content: "\e002"; } +.@{prefix}-i-alignleft:before { content: "\e003"; } +.@{prefix}-i-aligncenter:before { content: "\e004"; } +.@{prefix}-i-alignright:before { content: "\e005"; } +.@{prefix}-i-alignjustify:before { content: "\e006"; } +.@{prefix}-i-cut:before { content: "\e007"; } +.@{prefix}-i-paste:before { content: "\e008"; } +.@{prefix}-i-searchreplace:before { content: "\e009"; } +.@{prefix}-i-bullist:before { content: "\e00a"; } +.@{prefix}-i-numlist:before { content: "\e00b"; } +.@{prefix}-i-indent:before { content: "\e00c"; } +.@{prefix}-i-outdent:before { content: "\e00d"; } +.@{prefix}-i-blockquote:before { content: "\e00e"; } +.@{prefix}-i-undo:before { content: "\e00f"; } +.@{prefix}-i-redo:before { content: "\e010"; } +.@{prefix}-i-link:before { content: "\e011"; } +.@{prefix}-i-unlink:before { content: "\e012"; } +.@{prefix}-i-anchor:before { content: "\e013"; } +.@{prefix}-i-image:before { content: "\e014"; } +.@{prefix}-i-media:before { content: "\e015"; } +.@{prefix}-i-help:before { content: "\e016"; } +.@{prefix}-i-code:before { content: "\e017"; } +.@{prefix}-i-insertdatetime:before { content: "\e018"; } +.@{prefix}-i-preview:before { content: "\e019"; } +.@{prefix}-i-forecolor:before { content: "\e01a"; } +.@{prefix}-i-backcolor:before { content: "\e01a"; } +.@{prefix}-i-table:before { content: "\e01b"; } +.@{prefix}-i-hr:before { content: "\e01c"; } +.@{prefix}-i-removeformat:before { content: "\e01d"; } +.@{prefix}-i-subscript:before { content: "\e01e"; } +.@{prefix}-i-superscript:before { content: "\e01f"; } +.@{prefix}-i-charmap:before { content: "\e020"; } +.@{prefix}-i-emoticons:before { content: "\e021"; } +.@{prefix}-i-print:before { content: "\e022"; } +.@{prefix}-i-fullscreen:before { content: "\e023"; } +.@{prefix}-i-spellchecker:before { content: "\e024"; } +.@{prefix}-i-nonbreaking:before { content: "\e025"; } +.@{prefix}-i-template:before { content: "\e026"; } +.@{prefix}-i-pagebreak:before { content: "\e027"; } +.@{prefix}-i-restoredraft:before { content: "\e028"; } +.@{prefix}-i-untitled:before { content: "\e029"; } +.@{prefix}-i-bold:before { content: "\e02a"; } +.@{prefix}-i-italic:before { content: "\e02b"; } +.@{prefix}-i-underline:before { content: "\e02c"; } +.@{prefix}-i-strikethrough:before { content: "\e02d"; } +.@{prefix}-i-visualchars:before { content: "\e02e"; } +.@{prefix}-i-visualblocks:before { content: "\e02e"; } +.@{prefix}-i-ltr:before { content: "\e02f"; } +.@{prefix}-i-rtl:before { content: "\e030"; } +.@{prefix}-i-copy:before { content: "\e031"; } +.@{prefix}-i-resize:before { content: "\e032"; } +.@{prefix}-i-browse:before { content: "\e034"; } +.@{prefix}-i-pastetext:before { content: "\e035"; } + +.@{prefix}-i-checkbox:before, .@{prefix}-i-selected:before { + content: "\e033"; +} + +.@{prefix}-i-selected { visibility: hidden; } +i.@{prefix}-i-backcolor { text-shadow: none; background: @colorbtn-backcolor-bg; } diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.min.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.min.css Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +.mce-container,.mce-container *,.mce-widget,.mce-widget *,.mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:0 0;text-decoration:none;color:#333;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;-webkit-tap-highlight-color:transparent;line-height:normal;font-weight:400;text-align:left;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-widget button{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.mce-container [unselectable]{-moz-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none}.mce-fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.mce-fade.mce-in{opacity:1}.mce-tinymce{visibility:inherit!important;position:relative}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;height:100%;z-index:100}div.mce-fullscreen{position:fixed;top:0;left:0;width:100%;height:auto}.mce-tinymce{display:block;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.mce-wordcount{position:absolute;top:0;right:0;padding:8px}div.mce-edit-area{background:#FFF;filter:none}.mce-statusbar{position:relative}.mce-statusbar .mce-container-body{position:relative}.mce-fullscreen .mce-resizehandle{display:none}.mce-charmap{border-collapse:collapse}.mce-charmap td{cursor:default;border:1px solid #9e9e9e;width:20px;height:20px;line-height:20px;text-align:center;vertical-align:middle;padding:2px}.mce-charmap td div{text-align:center}.mce-charmap td:hover{background:#d9d9d9}.mce-grid td.mce-grid-cell div{border:1px solid #d6d6d6;width:15px;height:15px;margin:0;cursor:pointer}.mce-grid td.mce-grid-cell div:focus{border-color:#a1a1a1}.mce-grid td.mce-grid-cell div[disabled]{cursor:not-allowed}.mce-grid{border-spacing:2px;border-collapse:separate}.mce-grid a{display:block;border:1px solid transparent}.mce-grid a:hover,.mce-grid a:focus{border-color:#a1a1a1}.mce-grid-border{margin:0 4px 0 4px}.mce-grid-border a{border-color:#d6d6d6;width:13px;height:13px}.mce-grid-border a:hover,.mce-grid-border a.mce-active{border-color:#a1a1a1;background:#c8def4}.mce-text-center{text-align:center}div.mce-tinymce-inline{width:100%;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-colorbtn-trans div{text-align:center;vertical-align:middle;font-weight:700;font-size:20px;line-height:16px;color:#707070}.mce-toolbar-grp{padding-bottom:2px}.mce-toolbar-grp .mce-flow-layout-item{margin-bottom:0}.mce-rtl .mce-wordcount{left:0;right:auto}.mce-container,.mce-container-body{display:block}.mce-autoscroll{overflow:hidden}.mce-scrollbar{position:absolute;width:7px;height:100%;top:2px;right:2px;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-scrollbar-h{top:auto;right:auto;left:2px;bottom:2px;width:100%;height:7px}.mce-scrollbar-thumb{position:absolute;background-color:#000;border:1px solid #888;border-color:rgba(85,85,85,.6);width:5px;height:100%;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.mce-scrollbar-h .mce-scrollbar-thumb{width:100%;height:5px}.mce-scrollbar:hover,.mce-scrollbar.mce-active{background-color:#AAA;opacity:.6;filter:alpha(opacity=60);zoom:1;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.mce-scroll{position:relative}.mce-panel{border:0 solid #9e9e9e;background-color:#f0f0f0;background-image:-moz-linear-gradient(top,#fdfdfd,#ddd);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fdfdfd),to(#ddd));background-image:-webkit-linear-gradient(top,#fdfdfd,#ddd);background-image:-o-linear-gradient(top,#fdfdfd,#ddd);background-image:linear-gradient(to bottom,#fdfdfd,#ddd);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffdfdfd', endColorstr='#ffdddddd', GradientType=0);zoom:1}.mce-floatpanel{position:absolute;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.mce-floatpanel.mce-fixed{position:fixed}.mce-floatpanel .mce-arrow,.mce-floatpanel .mce-arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.mce-floatpanel .mce-arrow{border-width:11px}.mce-floatpanel .mce-arrow:after{border-width:10px;content:""}.mce-floatpanel.mce-popover{filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background:0 0;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);top:0;left:0;background:#fff;border:1px solid #9e9e9e;border:1px solid rgba(0,0,0,.25)}.mce-floatpanel.mce-popover.mce-bottom{margin-top:10px;}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#9e9e9e;border-bottom-color:rgba(0,0,0,.25);top:-11px}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow:after{top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#fff}.mce-floatpanel.mce-popover.mce-bottom.mce-start{margin-left:-22px}.mce-floatpanel.mce-popover.mce-bottom.mce-start>.mce-arrow{left:20px}.mce-floatpanel.mce-popover.mce-bottom.mce-end{margin-left:22px}.mce-floatpanel.mce-popover.mce-bottom.mce-end>.mce-arrow{right:10px;left:auto}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;background:#fff;height:100%}div.mce-fullscreen{position:fixed;top:0;left:0}#mce-modal-block{opacity:0;filter:alpha(opacity=0);zoom:1;position:fixed;left:0;top:0;width:100%;height:100%;background:#000}#mce-modal-block.mce-in{opacity:.3;filter:alpha(opacity=30);zoom:1}.mce-window-move{cursor:move}.mce-window{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0,0,0,.3);-moz-box-shadow:0 3px 7px rgba(0,0,0,.3);box-shadow:0 3px 7px rgba(0,0,0,.3);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background:0 0;background:#fff;position:fixed;top:0;left:0;opacity:0;-webkit-transition:opacity 150ms ease-in;transition:opacity 150ms ease-in}.mce-window.mce-in{opacity:1}.mce-window-head{padding:9px 15px;border-bottom:1px solid #c5c5c5;position:relative}.mce-window-head .mce-close{position:absolute;right:15px;top:9px;font-size:20px;font-weight:700;line-height:20px;color:#858585;cursor:pointer;height:20px;overflow:hidden}.mce-close:hover{color:#adadad}.mce-window-head .mce-title{line-height:20px;font-size:20px;font-weight:700;text-rendering:optimizelegibility;padding-right:10px}.mce-window .mce-container-body{display:block}.mce-foot{display:block;background-color:#fff;border-top:1px solid #c5c5c5;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.mce-window-head .mce-dragh{position:absolute;top:0;left:0;cursor:move;width:90%;height:100%}.mce-window iframe{width:100%;height:100%}.mce-window.mce-fullscreen,.mce-window.mce-fullscreen .mce-foot{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mce-rtl .mce-window-head .mce-close{position:absolute;right:auto;left:15px}.mce-rtl .mce-window-head .mce-dragh{left:auto;right:0}.mce-rtl .mce-window-head .mce-title{direction:rtl;text-align:right}.mce-abs-layout{position:relative}body .mce-abs-layout-item,.mce-abs-end{position:absolute}.mce-abs-end{width:1px;height:1px}.mce-container-body.mce-abs-layout{overflow:hidden}.mce-tooltip{position:absolute;padding:5px;opacity:.8;filter:alpha(opacity=80);zoom:1}.mce-tooltip-inner{font-size:11px;background-color:#000;color:#fff;max-width:200px;padding:5px 8px 4px 8px;text-align:center;white-space:normal}.mce-tooltip-inner{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-tooltip-inner{-webkit-box-shadow:0 0 5px #000;-moz-box-shadow:0 0 5px #000;box-shadow:0 0 5px #000}.mce-tooltip-arrow{position:absolute;width:0;height:0;line-height:0;border:5px dashed #000}.mce-tooltip-arrow-n{border-bottom-color:#000}.mce-tooltip-arrow-s{border-top-color:#000}.mce-tooltip-arrow-e{border-left-color:#000}.mce-tooltip-arrow-w{border-right-color:#000}.mce-tooltip-nw,.mce-tooltip-sw{margin-left:-14px}.mce-tooltip-n .mce-tooltip-arrow{top:0;left:50%;margin-left:-5px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-nw .mce-tooltip-arrow{top:0;left:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-ne .mce-tooltip-arrow{top:0;right:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-s .mce-tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-sw .mce-tooltip-arrow{bottom:0;left:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-se .mce-tooltip-arrow{bottom:0;right:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-e .mce-tooltip-arrow{right:0;top:50%;margin-top:-5px;border-left-style:solid;border-right:none;border-top-color:transparent;border-bottom-color:transparent}.mce-tooltip-w .mce-tooltip-arrow{left:0;top:50%;margin-top:-5px;border-right-style:solid;border-left:none;border-top-color:transparent;border-bottom-color:transparent}.mce-btn{border:1px solid #b1b1b1;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25) rgba(0,0,0,.25);position:relative;text-shadow:0 1px 1px rgba(255,255,255,.75);display:inline-block;;;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);background-color:#f0f0f0;background-image:-moz-linear-gradient(top,#fff,#d9d9d9);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#d9d9d9));background-image:-webkit-linear-gradient(top,#fff,#d9d9d9);background-image:-o-linear-gradient(top,#fff,#d9d9d9);background-image:linear-gradient(to bottom,#fff,#d9d9d9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffd9d9d9', GradientType=0);zoom:1}.mce-btn:hover,.mce-btn:focus{color:#333;background-color:#e3e3e3;background-image:-moz-linear-gradient(top,#f2f2f2,#ccc);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#ccc));background-image:-webkit-linear-gradient(top,#f2f2f2,#ccc);background-image:-o-linear-gradient(top,#f2f2f2,#ccc);background-image:linear-gradient(to bottom,#f2f2f2,#ccc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffcccccc', GradientType=0);zoom:1}.mce-btn.mce-disabled button,.mce-btn.mce-disabled:hover button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-btn.mce-active,.mce-btn.mce-active:hover{background-color:#d6d6d6;background-image:-moz-linear-gradient(top,#e6e6e6,silver);background-image:-webkit-gradient(linear,0 0,0 100%,from(#e6e6e6),to(silver));background-image:-webkit-linear-gradient(top,#e6e6e6,silver);background-image:-o-linear-gradient(top,#e6e6e6,silver);background-image:linear-gradient(to bottom,#e6e6e6,silver);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe6e6e6', endColorstr='#ffc0c0c0', GradientType=0);zoom:1;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.mce-btn:active{background-color:#d6d6d6;background-image:-moz-linear-gradient(top,#e6e6e6,silver);background-image:-webkit-gradient(linear,0 0,0 100%,from(#e6e6e6),to(silver));background-image:-webkit-linear-gradient(top,#e6e6e6,silver);background-image:-o-linear-gradient(top,#e6e6e6,silver);background-image:linear-gradient(to bottom,#e6e6e6,silver);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe6e6e6', endColorstr='#ffc0c0c0', GradientType=0);zoom:1;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.mce-btn button{padding:4px 10px;font-size:14px;line-height:20px;;cursor:pointer;color:#333;text-align:center;overflow:visible;-webkit-appearance:none}.mce-btn button::-moz-focus-inner{border:0;padding:0}.mce-btn i{text-shadow:1px 1px #fff}.mce-primary{min-width:50px;color:#fff;border:1px solid #b1b1b1;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25) rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);zoom:1}.mce-primary:hover,.mce-primary:focus{background-color:#005fb3;background-image:-moz-linear-gradient(top,#0077b3,#003cb3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#0077b3),to(#003cb3));background-image:-webkit-linear-gradient(top,#0077b3,#003cb3);background-image:-o-linear-gradient(top,#0077b3,#003cb3);background-image:linear-gradient(to bottom,#0077b3,#003cb3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0077b3', endColorstr='#ff003cb3', GradientType=0);zoom:1}.mce-primary.mce-disabled button,.mce-primary.mce-disabled:hover button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-primary.mce-active,.mce-primary.mce-active:hover,.mce-primary:not(.mce-disabled):active{background-color:#005299;background-image:-moz-linear-gradient(top,#069,#039);background-image:-webkit-gradient(linear,0 0,0 100%,from(#069),to(#039));background-image:-webkit-linear-gradient(top,#069,#039);background-image:-o-linear-gradient(top,#069,#039);background-image:linear-gradient(to bottom,#069,#039);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff006699', endColorstr='#ff003399', GradientType=0);zoom:1;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.mce-primary button,.mce-primary button i{color:#fff;text-shadow:1px 1px #333}.mce-btn-large button{padding:9px 14px;font-size:16px;line-height:normal;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.mce-btn-large i{margin-top:2px}.mce-btn-small button{padding:1px 5px;font-size:12px;}.mce-btn-small i{line-height:20px;vertical-align:top;}.mce-btn .mce-caret{margin-top:8px;margin-left:0}.mce-btn-small .mce-caret{margin-top:8px;margin-left:0}.mce-caret{display:inline-block;;;width:0;height:0;vertical-align:top;border-top:4px solid #333;border-right:4px solid transparent;border-left:4px solid transparent;content:""}.mce-disabled .mce-caret{border-top-color:#aaa}.mce-caret.mce-up{border-bottom:4px solid #333;border-top:0}.mce-btn-flat{border:0;background:0 0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:none}.mce-btn-flat:hover,.mce-btn-flat.mce-active,.mce-btn-flat:focus,.mce-btn-flat:active{border:0;background:#e6e6e6;filter:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-rtl .mce-btn button{direction:rtl}.mce-btn-group .mce-btn{border-width:1px 0 1px 0;margin:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mce-btn-group .mce-first{border-left:1px solid #b1b1b1;border-left:1px solid rgba(0,0,0,.25);-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.mce-btn-group .mce-last{border-right:1px solid #b1b1b1;border-right:1px solid rgba(0,0,0,.1);-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.mce-btn-group .mce-first.mce-last{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-btn-group .mce-btn.mce-flow-layout-item{margin:0}.mce-checkbox{cursor:pointer}i.mce-i-checkbox{margin:0 3px 0 0;border:1px solid #c5c5c5;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);background-color:#f0f0f0;background-image:-moz-linear-gradient(top,#fff,#d9d9d9);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#d9d9d9));background-image:-webkit-linear-gradient(top,#fff,#d9d9d9);background-image:-o-linear-gradient(top,#fff,#d9d9d9);background-image:linear-gradient(to bottom,#fff,#d9d9d9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffd9d9d9', GradientType=0);zoom:1;text-indent:-10em;;;;overflow:hidden}.mce-checked i.mce-i-checkbox{color:#333;font-size:16px;line-height:16px;text-indent:0}.mce-checkbox:focus i.mce-i-checkbox,.mce-checkbox.mce-focus i.mce-i-checkbox{border:1px solid rgba(82,168,236,.8);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65)}.mce-checkbox.mce-disabled .mce-label,.mce-checkbox.mce-disabled i.mce-i-checkbox{color:#acacac}.mce-rtl .mce-checkbox{direction:rtl;text-align:right}.mce-rtl i.mce-i-checkbox{margin:0 0 0 3px}.mce-combobox{display:inline-block;;;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);}.mce-combobox input{border:1px solid #c5c5c5;border-right-color:#c5c5c5;height:28px}.mce-combobox.mce-disabled input{color:#adadad}.mce-combobox.mce-has-open input{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.mce-combobox .mce-btn{border-left:0;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.mce-combobox button{padding-right:8px;padding-left:8px}.mce-combobox.mce-disabled .mce-btn button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-colorbox i{border:1px solid #c5c5c5;width:14px;height:14px}.mce-colorbutton .mce-ico{position:relative}.mce-colorbutton-grid{margin:4px}.mce-colorbutton button{padding-right:4px}.mce-colorbutton .mce-preview{padding-right:3px;display:block;position:absolute;left:50%;top:50%;margin-left:-14px;margin-top:7px;background:gray;width:13px;height:2px;overflow:hidden}.mce-colorbutton.mce-btn-small .mce-preview{margin-left:-16px;padding-right:0;width:16px}.mce-colorbutton .mce-open{padding-left:4px;border-left:1px solid transparent;border-right:1px solid transparent}.mce-colorbutton:hover .mce-open{border-left-color:#bdbdbd;border-right-color:#bdbdbd}.mce-colorbutton.mce-btn-small .mce-open{padding:0 3px 0 3px}.mce-rtl .mce-colorbutton{direction:rtl}.mce-rtl .mce-colorbutton .mce-preview{margin-left:0;padding-right:0;padding-left:4px;margin-right:-14px}.mce-rtl .mce-colorbutton.mce-btn-small .mce-preview{margin-left:0;padding-right:0;margin-right:-17px;padding-left:0}.mce-rtl .mce-colorbutton button{padding-right:10px;padding-left:10px}.mce-rtl .mce-colorbutton .mce-open{padding-left:4px;padding-right:4px}.mce-colorpicker{position:relative;width:250px;height:220px}.mce-colorpicker-sv{position:absolute;top:0;left:0;width:90%;height:100%;border:1px solid #c5c5c5;cursor:crosshair;overflow:hidden}.mce-colorpicker-h-chunk{width:100%}.mce-colorpicker-overlay1,.mce-colorpicker-overlay2{width:100%;height:100%;position:absolute;top:0;left:0}.mce-colorpicker-overlay1{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr='#ffffff', endColorstr='#00ffffff');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff')";background:linear-gradient(to right,#fff,rgba(255,255,255,0))}.mce-colorpicker-overlay2{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#00000000', endColorstr='#000000');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000')";background:linear-gradient(to bottom,rgba(0,0,0,0),#000)}.mce-colorpicker-selector1{background:0 0;position:absolute;width:12px;height:12px;margin:-8px 0 0 -8px;border:1px solid #000;border-radius:50%}.mce-colorpicker-selector2{position:absolute;width:10px;height:10px;border:1px solid #fff;border-radius:50%}.mce-colorpicker-h{position:absolute;top:0;right:0;width:6.5%;height:100%;border:1px solid #c5c5c5;cursor:crosshair}.mce-colorpicker-h-marker{margin-top:-4px;position:absolute;top:0;left:-1px;width:100%;border:1px solid #333;background:#fff;height:4px;z-index:100}.mce-path{display:inline-block;;;padding:8px;white-space:normal}.mce-path .mce-txt{display:inline-block;padding-right:3px}.mce-path .mce-path-body{display:inline-block}.mce-path-item{display:inline-block;;;cursor:pointer;color:#333}.mce-path-item:hover{text-decoration:underline}.mce-path-item:focus{background:#666;color:#fff}.mce-path .mce-divider{display:inline}.mce-disabled .mce-path-item{color:#aaa}.mce-rtl .mce-path{direction:rtl}.mce-fieldset{border:0 solid #9E9E9E;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-fieldset>.mce-container-body{margin-top:-15px}.mce-fieldset-title{margin-left:5px;padding:0 5px 0 5px}.mce-fit-layout{display:inline-block;;}.mce-fit-layout-item{position:absolute}.mce-flow-layout-item{display:inline-block;;}.mce-flow-layout-item{margin:2px 0 2px 2px}.mce-flow-layout-item.mce-last{margin-right:2px}.mce-flow-layout{white-space:normal}.mce-tinymce-inline .mce-flow-layout{white-space:nowrap}.mce-rtl .mce-flow-layout{text-align:right;direction:rtl}.mce-rtl .mce-flow-layout-item{margin:2px 2px 2px 0}.mce-rtl .mce-flow-layout-item.mce-last{margin-left:2px}.mce-iframe{border:0 solid #9e9e9e;width:100%;height:100%}.mce-label{display:inline-block;;;text-shadow:0 1px 1px rgba(255,255,255,.75);overflow:hidden}.mce-label.mce-autoscroll{overflow:auto}.mce-label.mce-disabled{color:#aaa}.mce-label.mce-multiline{white-space:pre-wrap}.mce-label.mce-error{color:#a00}.mce-rtl .mce-label{text-align:right;direction:rtl}.mce-menubar .mce-menubtn{border-color:transparent;background:0 0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:none}.mce-menubar{border:1px solid #c4c4c4}.mce-menubar .mce-menubtn button span{color:#333}.mce-menubar .mce-caret{border-top-color:#333}.mce-menubar .mce-menubtn:hover,.mce-menubar .mce-menubtn.mce-active,.mce-menubar .mce-menubtn:focus{border-color:transparent;background:#e6e6e6;filter:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-menubtn span{color:#333;margin-right:2px;line-height:20px;}.mce-menubtn.mce-btn-small span{font-size:12px}.mce-menubtn.mce-fixed-width span{display:inline-block;overflow-x:hidden;text-overflow:ellipsis;width:90px}.mce-menubtn.mce-fixed-width.mce-btn-small span{width:70px}.mce-rtl .mce-menubtn button{direction:rtl;text-align:right}.mce-listbox button{text-align:left;padding-right:20px;position:relative}.mce-listbox .mce-caret{position:absolute;margin-top:-2px;right:8px;top:50%}.mce-rtl .mce-listbox .mce-caret{right:auto;left:8px}.mce-rtl .mce-listbox button{padding-right:10px;padding-left:20px}.mce-menu-item{display:block;padding:6px 15px 6px 12px;clear:both;font-weight:400;line-height:20px;color:#333;white-space:nowrap;cursor:pointer;line-height:normal;border-left:4px solid transparent;margin-bottom:1px}.mce-menu-item .mce-ico,.mce-menu-item .mce-text{color:#333}.mce-menu-item.mce-disabled .mce-text,.mce-menu-item.mce-disabled .mce-ico{color:#adadad}.mce-menu-item:hover .mce-text,.mce-menu-item.mce-selected .mce-text,.mce-menu-item:focus .mce-text{color:#fff}.mce-menu-item:hover .mce-ico,.mce-menu-item.mce-selected .mce-ico,.mce-menu-item:focus .mce-ico{color:#fff}.mce-menu-item.mce-disabled:hover{background:#ccc}.mce-menu-shortcut{display:inline-block;color:#adadad}.mce-menu-shortcut{display:inline-block;;;padding:0 15px 0 20px}.mce-menu-item:hover .mce-menu-shortcut,.mce-menu-item.mce-selected .mce-menu-shortcut,.mce-menu-item:focus .mce-menu-shortcut{color:#fff}.mce-menu-item .mce-caret{margin-top:4px;;margin-right:6px;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid #333}.mce-menu-item.mce-selected .mce-caret,.mce-menu-item:focus .mce-caret,.mce-menu-item:hover .mce-caret{border-left-color:#fff}.mce-menu-align .mce-menu-shortcut,.mce-menu-align .mce-caret{position:absolute;right:0}.mce-menu-item.mce-active i{visibility:visible}.mce-menu-item-normal.mce-active{background-color:#c8def4}.mce-menu-item-preview.mce-active{border-left:5px solid #aaa}.mce-menu-item-normal.mce-active .mce-text{color:#333}.mce-menu-item-normal.mce-active:hover .mce-text,.mce-menu-item-normal.mce-active:hover .mce-ico{color:#fff}.mce-menu-item-normal.mce-active:focus .mce-text,.mce-menu-item-normal.mce-active:focus .mce-ico{color:#fff}.mce-menu-item:hover,.mce-menu-item.mce-selected,.mce-menu-item:focus{text-decoration:none;color:#fff;background-color:#0081c2;background-image:-moz-linear-gradient(top,#08c,#0077b3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#0077b3));background-image:-webkit-linear-gradient(top,#08c,#0077b3);background-image:-o-linear-gradient(top,#08c,#0077b3);background-image:linear-gradient(to bottom,#08c,#0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);zoom:1}div.mce-menu .mce-menu-item-sep,.mce-menu-item-sep:hover{border:0;padding:0;height:1px;margin:9px 1px;overflow:hidden;background:#cbcbcb;border-bottom:1px solid #fff;cursor:default;filter:none}.mce-menu.mce-rtl{direction:rtl}.mce-rtl .mce-menu-item{text-align:right;direction:rtl;padding:6px 12px 6px 15px}.mce-menu-align.mce-rtl .mce-menu-shortcut,.mce-menu-align.mce-rtl .mce-caret{right:auto;left:0}.mce-rtl .mce-menu-item .mce-caret{margin-left:6px;margin-right:0;border-right:4px solid #333;border-left:0}.mce-rtl .mce-menu-item.mce-selected .mce-caret,.mce-rtl .mce-menu-item:focus .mce-caret,.mce-rtl .mce-menu-item:hover .mce-caret{border-left-color:transparent;border-right-color:#fff}.mce-menu{position:absolute;left:0;top:0;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background:0 0;z-index:1000;padding:5px 0 5px 0;margin:2px 0 0;min-width:160px;background:#fff;border:1px solid #989898;border:1px solid rgba(0,0,0,.2);z-index:1002;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);max-height:400px;overflow:auto;overflow-x:hidden}.mce-menu i{display:none}.mce-menu-has-icons i{display:inline-block;}.mce-menu-sub-tr-tl{margin:-6px 0 0 -1px}.mce-menu-sub-br-bl{margin:6px 0 0 -1px}.mce-menu-sub-tl-tr{margin:-6px 0 0 1px}.mce-menu-sub-bl-br{margin:6px 0 0 1px}.mce-container-body .mce-resizehandle{position:absolute;right:0;bottom:0;width:16px;height:16px;visibility:visible;cursor:s-resize;margin:0}.mce-container-body .mce-resizehandle-both{cursor:se-resize}i.mce-i-resize{color:#333}.mce-spacer{visibility:hidden}.mce-splitbtn .mce-open{border-left:1px solid transparent;border-right:1px solid transparent}.mce-splitbtn:hover .mce-open{border-left-color:#bdbdbd;border-right-color:#bdbdbd}.mce-splitbtn button{padding-right:4px}.mce-splitbtn .mce-open{padding-left:4px}.mce-splitbtn .mce-open.mce-active{-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.mce-splitbtn.mce-btn-small .mce-open{padding:0 3px 0 3px}.mce-rtl .mce-splitbtn{direction:rtl;text-align:right}.mce-rtl .mce-splitbtn button{padding-right:10px;padding-left:10px}.mce-rtl .mce-splitbtn .mce-open{padding-left:4px;padding-right:4px}.mce-stack-layout-item{display:block}.mce-tabs{display:block;border-bottom:1px solid #c5c5c5}.mce-tab{display:inline-block;;;border:1px solid #c5c5c5;border-width:0 1px 0 0;background:#e3e3e3;padding:8px;text-shadow:0 1px 1px rgba(255,255,255,.75);height:13px;cursor:pointer}.mce-tab:hover{background:#fdfdfd}.mce-tab.mce-active{background:#fdfdfd;border-bottom-color:transparent;margin-bottom:-1px;height:14px}.mce-rtl .mce-tabs{text-align:right;direction:rtl}.mce-rtl .mce-tab{border-width:0 0 0 1px}.mce-textbox{background:#fff;border:1px solid #c5c5c5;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);display:inline-block;-webkit-transition:border linear .2s,box-shadow linear .2s;transition:border linear .2s,box-shadow linear .2s;height:28px;resize:none;padding:0 4px 0 4px;white-space:pre-wrap;;color:#333}.mce-textbox:focus,.mce-textbox.mce-focus{border-color:rgba(82,168,236,.8);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65)}.mce-placeholder .mce-textbox{color:#aaa}.mce-textbox.mce-multiline{padding:4px}.mce-textbox.mce-disabled{color:#adadad}.mce-rtl .mce-textbox{text-align:right;direction:rtl}.mce-throbber{position:absolute;top:0;left:0;width:100%;height:100%;opacity:.6;filter:alpha(opacity=60);zoom:1;background:#fff url(img/loader.gif) no-repeat center center}.mce-throbber-inline{position:static;height:50px}@font-face{font-family:tinymce;src:url(fonts/tinymce.eot);src:url(fonts/tinymce.eot?#iefix) format('embedded-opentype'),url(fonts/tinymce.woff) format('woff'),url(fonts/tinymce.ttf) format('truetype'),url(fonts/tinymce.svg#tinymce) format('svg');font-weight:400;font-style:normal}@font-face{font-family:tinymce-small;src:url(fonts/tinymce-small.eot);src:url(fonts/tinymce-small.eot?#iefix) format('embedded-opentype'),url(fonts/tinymce-small.woff) format('woff'),url(fonts/tinymce-small.ttf) format('truetype'),url(fonts/tinymce-small.svg#tinymce) format('svg');font-weight:400;font-style:normal}.mce-ico{font-family:tinymce,Arial;font-style:normal;font-weight:400;font-variant:normal;font-size:16px;line-height:16px;speak:none;vertical-align:text-top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;background:transparent center center;background-size:cover;width:16px;height:16px;color:#333}.mce-btn-small .mce-ico{font-family:tinymce-small,Arial}.mce-i-save:before{content:"\e000"}.mce-i-newdocument:before{content:"\e001"}.mce-i-fullpage:before{content:"\e002"}.mce-i-alignleft:before{content:"\e003"}.mce-i-aligncenter:before{content:"\e004"}.mce-i-alignright:before{content:"\e005"}.mce-i-alignjustify:before{content:"\e006"}.mce-i-cut:before{content:"\e007"}.mce-i-paste:before{content:"\e008"}.mce-i-searchreplace:before{content:"\e009"}.mce-i-bullist:before{content:"\e00a"}.mce-i-numlist:before{content:"\e00b"}.mce-i-indent:before{content:"\e00c"}.mce-i-outdent:before{content:"\e00d"}.mce-i-blockquote:before{content:"\e00e"}.mce-i-undo:before{content:"\e00f"}.mce-i-redo:before{content:"\e010"}.mce-i-link:before{content:"\e011"}.mce-i-unlink:before{content:"\e012"}.mce-i-anchor:before{content:"\e013"}.mce-i-image:before{content:"\e014"}.mce-i-media:before{content:"\e015"}.mce-i-help:before{content:"\e016"}.mce-i-code:before{content:"\e017"}.mce-i-insertdatetime:before{content:"\e018"}.mce-i-preview:before{content:"\e019"}.mce-i-forecolor:before{content:"\e01a"}.mce-i-backcolor:before{content:"\e01a"}.mce-i-table:before{content:"\e01b"}.mce-i-hr:before{content:"\e01c"}.mce-i-removeformat:before{content:"\e01d"}.mce-i-subscript:before{content:"\e01e"}.mce-i-superscript:before{content:"\e01f"}.mce-i-charmap:before{content:"\e020"}.mce-i-emoticons:before{content:"\e021"}.mce-i-print:before{content:"\e022"}.mce-i-fullscreen:before{content:"\e023"}.mce-i-spellchecker:before{content:"\e024"}.mce-i-nonbreaking:before{content:"\e025"}.mce-i-template:before{content:"\e026"}.mce-i-pagebreak:before{content:"\e027"}.mce-i-restoredraft:before{content:"\e028"}.mce-i-untitled:before{content:"\e029"}.mce-i-bold:before{content:"\e02a"}.mce-i-italic:before{content:"\e02b"}.mce-i-underline:before{content:"\e02c"}.mce-i-strikethrough:before{content:"\e02d"}.mce-i-visualchars:before{content:"\e02e"}.mce-i-visualblocks:before{content:"\e02e"}.mce-i-ltr:before{content:"\e02f"}.mce-i-rtl:before{content:"\e030"}.mce-i-copy:before{content:"\e031"}.mce-i-resize:before{content:"\e032"}.mce-i-browse:before{content:"\e034"}.mce-i-pastetext:before{content:"\e035"}.mce-i-checkbox:before,.mce-i-selected:before{content:"\e033"}.mce-i-selected{visibility:hidden}i.mce-i-backcolor{text-shadow:none;background:#bbb} \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.modern.dev.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/skins/lightgray/skin.modern.dev.less Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,39 @@ +@import "Variables.less"; +@import "Reset.less"; +@import "Mixins.less"; +@import "Animations.less"; +@import "TinyMCE.less"; +@import "Container.less"; +@import "Scrollable.less"; +@import "Panel.less"; +@import "FloatPanel.less"; +@import "Window.less"; +@import "AbsoluteLayout.less"; +@import "ToolTip.less"; +@import "Button.less"; +@import "ButtonGroup.less"; +@import "Checkbox.less"; +@import "ComboBox.less"; +@import "ColorBox.less"; +@import "ColorButton.less"; +@import "ColorPicker.less"; +@import "Path.less"; +@import "FieldSet.less"; +@import "FitLayout.less"; +@import "FlowLayout.less"; +@import "Iframe.less"; +@import "Label.less"; +@import "MenuBar.less"; +@import "MenuButton.less"; +@import "ListBox.less"; +@import "MenuItem.less"; +@import "Menu.less"; +@import "Radio.less"; +@import "ResizeHandle.less"; +@import "Spacer.less"; +@import "SplitButton.less"; +@import "StackLayout.less"; +@import "TabPanel.less"; +@import "TextBox.less"; +@import "Throbber.less"; +@import "Icons.less"; diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/themes/modern/theme.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/themes/modern/theme.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,617 @@ +/** + * theme.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +tinymce.ThemeManager.add('modern', function(editor) { + var self = this, settings = editor.settings, Factory = tinymce.ui.Factory, each = tinymce.each, DOM = tinymce.DOM; + + // Default menus + var defaultMenus = { + file: {title: 'File', items: 'newdocument'}, + edit: {title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall'}, + insert: {title: 'Insert', items: '|'}, + view: {title: 'View', items: 'visualaid |'}, + format: {title: 'Format', items: 'bold italic underline strikethrough superscript subscript | formats | removeformat'}, + table: {title: 'Table'}, + tools: {title: 'Tools'} + }; + + var defaultToolbar = "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | " + + "bullist numlist outdent indent | link image"; + + /** + * Creates the toolbars from config and returns a toolbar array. + * + * @return {Array} Array with toolbars. + */ + function createToolbars() { + var toolbars = []; + + function addToolbar(items) { + var toolbarItems = [], buttonGroup; + + if (!items) { + return; + } + + each(items.split(/[ ,]/), function(item) { + var itemName; + + function bindSelectorChanged() { + var selection = editor.selection; + + if (itemName == "bullist") { + selection.selectorChanged('ul > li', function(state, args) { + var nodeName, i = args.parents.length; + + while (i--) { + nodeName = args.parents[i].nodeName; + if (nodeName == "OL" || nodeName == "UL") { + break; + } + } + + item.active(state && nodeName == "UL"); + }); + } + + if (itemName == "numlist") { + selection.selectorChanged('ol > li', function(state, args) { + var nodeName, i = args.parents.length; + + while (i--) { + nodeName = args.parents[i].nodeName; + if (nodeName == "OL" || nodeName == "UL") { + break; + } + } + + item.active(state && nodeName == "OL"); + }); + } + + if (item.settings.stateSelector) { + selection.selectorChanged(item.settings.stateSelector, function(state) { + item.active(state); + }, true); + } + + if (item.settings.disabledStateSelector) { + selection.selectorChanged(item.settings.disabledStateSelector, function(state) { + item.disabled(state); + }); + } + } + + if (item == "|") { + buttonGroup = null; + } else { + if (Factory.has(item)) { + item = {type: item}; + + if (settings.toolbar_items_size) { + item.size = settings.toolbar_items_size; + } + + toolbarItems.push(item); + buttonGroup = null; + } else { + if (!buttonGroup) { + buttonGroup = {type: 'buttongroup', items: []}; + toolbarItems.push(buttonGroup); + } + + if (editor.buttons[item]) { + // TODO: Move control creation to some UI class + itemName = item; + item = editor.buttons[itemName]; + + if (typeof item == "function") { + item = item(); + } + + item.type = item.type || 'button'; + + if (settings.toolbar_items_size) { + item.size = settings.toolbar_items_size; + } + + item = Factory.create(item); + buttonGroup.items.push(item); + + if (editor.initialized) { + bindSelectorChanged(); + } else { + editor.on('init', bindSelectorChanged); + } + } + } + } + }); + + toolbars.push({type: 'toolbar', layout: 'flow', items: toolbarItems}); + + return true; + } + + // Convert toolbar array to multiple options + if (tinymce.isArray(settings.toolbar)) { + // Empty toolbar array is the same as a disabled toolbar + if (settings.toolbar.length === 0) { + return; + } + + tinymce.each(settings.toolbar, function(toolbar, i) { + settings["toolbar" + (i + 1)] = toolbar; + }); + + delete settings.toolbar; + } + + // Generate toolbar + for (var i = 1; i < 10; i++) { + if (!addToolbar(settings["toolbar" + i])) { + break; + } + } + + // Generate toolbar or default toolbar unless it's disabled + if (!toolbars.length && settings.toolbar !== false) { + addToolbar(settings.toolbar || defaultToolbar); + } + + if (toolbars.length) { + return { + type: 'panel', + layout: 'stack', + classes: "toolbar-grp", + ariaRoot: true, + ariaRemember: true, + items: toolbars + }; + } + } + + /** + * Creates the menu buttons based on config. + * + * @return {Array} Menu buttons array. + */ + function createMenuButtons() { + var name, menuButtons = []; + + function createMenuItem(name) { + var menuItem; + + if (name == '|') { + return {text: '|'}; + } + + menuItem = editor.menuItems[name]; + + return menuItem; + } + + function createMenu(context) { + var menuButton, menu, menuItems, isUserDefined, removedMenuItems; + + removedMenuItems = tinymce.makeMap((settings.removed_menuitems || '').split(/[ ,]/)); + + // User defined menu + if (settings.menu) { + menu = settings.menu[context]; + isUserDefined = true; + } else { + menu = defaultMenus[context]; + } + + if (menu) { + menuButton = {text: menu.title}; + menuItems = []; + + // Default/user defined items + each((menu.items || '').split(/[ ,]/), function(item) { + var menuItem = createMenuItem(item); + + if (menuItem && !removedMenuItems[item]) { + menuItems.push(createMenuItem(item)); + } + }); + + // Added though context + if (!isUserDefined) { + each(editor.menuItems, function(menuItem) { + if (menuItem.context == context) { + if (menuItem.separator == 'before') { + menuItems.push({text: '|'}); + } + + if (menuItem.prependToContext) { + menuItems.unshift(menuItem); + } else { + menuItems.push(menuItem); + } + + if (menuItem.separator == 'after') { + menuItems.push({text: '|'}); + } + } + }); + } + + for (var i = 0; i < menuItems.length; i++) { + if (menuItems[i].text == '|') { + if (i === 0 || i == menuItems.length - 1) { + menuItems.splice(i, 1); + } + } + } + + menuButton.menu = menuItems; + + if (!menuButton.menu.length) { + return null; + } + } + + return menuButton; + } + + var defaultMenuBar = []; + if (settings.menu) { + for (name in settings.menu) { + defaultMenuBar.push(name); + } + } else { + for (name in defaultMenus) { + defaultMenuBar.push(name); + } + } + + var enabledMenuNames = typeof settings.menubar == "string" ? settings.menubar.split(/[ ,]/) : defaultMenuBar; + for (var i = 0; i < enabledMenuNames.length; i++) { + var menu = enabledMenuNames[i]; + menu = createMenu(menu); + + if (menu) { + menuButtons.push(menu); + } + } + + return menuButtons; + } + + /** + * Adds accessibility shortcut keys to panel. + * + * @param {tinymce.ui.Panel} panel Panel to add focus to. + */ + function addAccessibilityKeys(panel) { + function focus(type) { + var item = panel.find(type)[0]; + + if (item) { + item.focus(true); + } + } + + editor.shortcuts.add('Alt+F9', '', function() { + focus('menubar'); + }); + + editor.shortcuts.add('Alt+F10', '', function() { + focus('toolbar'); + }); + + editor.shortcuts.add('Alt+F11', '', function() { + focus('elementpath'); + }); + + panel.on('cancel', function() { + editor.focus(); + }); + } + + /** + * Resizes the editor to the specified width, height. + */ + function resizeTo(width, height) { + var containerElm, iframeElm, containerSize, iframeSize; + + function getSize(elm) { + return { + width: elm.clientWidth, + height: elm.clientHeight + }; + } + + containerElm = editor.getContainer(); + iframeElm = editor.getContentAreaContainer().firstChild; + containerSize = getSize(containerElm); + iframeSize = getSize(iframeElm); + + if (width !== null) { + width = Math.max(settings.min_width || 100, width); + width = Math.min(settings.max_width || 0xFFFF, width); + + DOM.setStyle(containerElm, 'width', width + (containerSize.width - iframeSize.width)); + DOM.setStyle(iframeElm, 'width', width); + } + + height = Math.max(settings.min_height || 100, height); + height = Math.min(settings.max_height || 0xFFFF, height); + DOM.setStyle(iframeElm, 'height', height); + + editor.fire('ResizeEditor'); + } + + function resizeBy(dw, dh) { + var elm = editor.getContentAreaContainer(); + self.resizeTo(elm.clientWidth + dw, elm.clientHeight + dh); + } + + /** + * Renders the inline editor UI. + * + * @return {Object} Name/value object with theme data. + */ + function renderInlineUI(args) { + var panel, inlineToolbarContainer; + + if (settings.fixed_toolbar_container) { + inlineToolbarContainer = DOM.select(settings.fixed_toolbar_container)[0]; + } + + function reposition() { + if (panel && panel.moveRel && panel.visible() && !panel._fixed) { + // TODO: This is kind of ugly and doesn't handle multiple scrollable elements + var scrollContainer = editor.selection.getScrollContainer(), body = editor.getBody(); + var deltaX = 0, deltaY = 0; + + if (scrollContainer) { + var bodyPos = DOM.getPos(body), scrollContainerPos = DOM.getPos(scrollContainer); + + deltaX = Math.max(0, scrollContainerPos.x - bodyPos.x); + deltaY = Math.max(0, scrollContainerPos.y - bodyPos.y); + } + + panel.fixed(false).moveRel(body, editor.rtl ? ['tr-br', 'br-tr'] : ['tl-bl', 'bl-tl', 'tr-br']).moveBy(deltaX, deltaY); + } + } + + function show() { + if (panel) { + panel.show(); + reposition(); + DOM.addClass(editor.getBody(), 'mce-edit-focus'); + } + } + + function hide() { + if (panel) { + panel.hide(); + DOM.removeClass(editor.getBody(), 'mce-edit-focus'); + } + } + + function render() { + if (panel) { + if (!panel.visible()) { + show(); + } + + return; + } + + // Render a plain panel inside the inlineToolbarContainer if it's defined + panel = self.panel = Factory.create({ + type: inlineToolbarContainer ? 'panel' : 'floatpanel', + role: 'application', + classes: 'tinymce tinymce-inline', + layout: 'flex', + direction: 'column', + align: 'stretch', + autohide: false, + autofix: true, + fixed: !!inlineToolbarContainer, + border: 1, + items: [ + settings.menubar === false ? null : {type: 'menubar', border: '0 0 1 0', items: createMenuButtons()}, + createToolbars() + ] + }); + + // Add statusbar + /*if (settings.statusbar !== false) { + panel.add({type: 'panel', classes: 'statusbar', layout: 'flow', border: '1 0 0 0', items: [ + {type: 'elementpath'} + ]}); + }*/ + + editor.fire('BeforeRenderUI'); + panel.renderTo(inlineToolbarContainer || document.body).reflow(); + + addAccessibilityKeys(panel); + show(); + + editor.on('nodeChange', reposition); + editor.on('activate', show); + editor.on('deactivate', hide); + + editor.nodeChanged(); + } + + settings.content_editable = true; + + editor.on('focus', function() { + // Render only when the CSS file has been loaded + if (args.skinUiCss) { + tinymce.DOM.styleSheetLoader.load(args.skinUiCss, render, render); + } else { + render(); + } + }); + + editor.on('blur hide', hide); + + // Remove the panel when the editor is removed + editor.on('remove', function() { + if (panel) { + panel.remove(); + panel = null; + } + }); + + // Preload skin css + if (args.skinUiCss) { + tinymce.DOM.styleSheetLoader.load(args.skinUiCss); + } + + return {}; + } + + /** + * Renders the iframe editor UI. + * + * @param {Object} args Details about target element etc. + * @return {Object} Name/value object with theme data. + */ + function renderIframeUI(args) { + var panel, resizeHandleCtrl, startSize; + + if (args.skinUiCss) { + tinymce.DOM.loadCSS(args.skinUiCss); + } + + // Basic UI layout + panel = self.panel = Factory.create({ + type: 'panel', + role: 'application', + classes: 'tinymce', + style: 'visibility: hidden', + layout: 'stack', + border: 1, + items: [ + settings.menubar === false ? null : {type: 'menubar', border: '0 0 1 0', items: createMenuButtons()}, + createToolbars(), + {type: 'panel', name: 'iframe', layout: 'stack', classes: 'edit-area', html: '', border: '1 0 0 0'} + ] + }); + + if (settings.resize !== false) { + resizeHandleCtrl = { + type: 'resizehandle', + direction: settings.resize, + + onResizeStart: function() { + var elm = editor.getContentAreaContainer().firstChild; + + startSize = { + width: elm.clientWidth, + height: elm.clientHeight + }; + }, + + onResize: function(e) { + if (settings.resize == 'both') { + resizeTo(startSize.width + e.deltaX, startSize.height + e.deltaY); + } else { + resizeTo(null, startSize.height + e.deltaY); + } + } + }; + } + + // Add statusbar if needed + if (settings.statusbar !== false) { + panel.add({type: 'panel', name: 'statusbar', classes: 'statusbar', layout: 'flow', border: '1 0 0 0', ariaRoot: true, items: [ + {type: 'elementpath'}, + resizeHandleCtrl + ]}); + } + + if (settings.readonly) { + panel.find('*').disabled(true); + } + + editor.fire('BeforeRenderUI'); + panel.renderBefore(args.targetNode).reflow(); + + if (settings.width) { + tinymce.DOM.setStyle(panel.getEl(), 'width', settings.width); + } + + // Remove the panel when the editor is removed + editor.on('remove', function() { + panel.remove(); + panel = null; + }); + + // Add accesibility shortkuts + addAccessibilityKeys(panel); + + return { + iframeContainer: panel.find('#iframe')[0].getEl(), + editorContainer: panel.getEl() + }; + } + + /** + * Renders the UI for the theme. This gets called by the editor. + * + * @param {Object} args Details about target element etc. + * @return {Object} Theme UI data items. + */ + self.renderUI = function(args) { + var skin = settings.skin !== false ? settings.skin || 'lightgray' : false; + + if (skin) { + var skinUrl = settings.skin_url; + + if (skinUrl) { + skinUrl = editor.documentBaseURI.toAbsolute(skinUrl); + } else { + skinUrl = tinymce.baseURL + '/skins/' + skin; + } + + // Load special skin for IE7 + // TODO: Remove this when we drop IE7 support + if (tinymce.Env.documentMode <= 7) { + args.skinUiCss = skinUrl + '/skin.ie7.min.css'; + } else { + args.skinUiCss = skinUrl + '/skin.min.css'; + } + + // Load content.min.css or content.inline.min.css + editor.contentCSS.push(skinUrl + '/content' + (editor.inline ? '.inline' : '') + '.min.css'); + } + + // Handle editor setProgressState change + editor.on('ProgressState', function(e) { + self.throbber = self.throbber || new tinymce.ui.Throbber(self.panel.getEl('body')); + + if (e.state) { + self.throbber.show(e.time); + } else { + self.throbber.hide(); + } + }); + + if (settings.inline) { + return renderInlineUI(args); + } + + return renderIframeUI(args); + }; + + self.resizeTo = resizeTo; + self.resizeBy = resizeBy; +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/themes/modern/theme.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/themes/modern/theme.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.ThemeManager.add("modern",function(i){var o=this,f=i.settings,c=tinymce.ui.Factory,m=tinymce.each,n=tinymce.DOM;var d={file:{title:"File",items:"newdocument"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall"},insert:{title:"Insert",items:"|"},view:{title:"View",items:"visualaid |"},format:{title:"Format",items:"bold italic underline strikethrough superscript subscript | formats | removeformat"},table:{title:"Table"},tools:{title:"Tools"}};var b="undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image";function l(){var q=[];function r(t){var u=[],s;if(!t){return}m(t.split(/[ ,]/),function(w){var x;function v(){var y=i.selection;if(x=="bullist"){y.selectorChanged("ul > li",function(B,z){var C,A=z.parents.length;while(A--){C=z.parents[A].nodeName;if(C=="OL"||C=="UL"){break}}w.active(B&&C=="UL")})}if(x=="numlist"){y.selectorChanged("ol > li",function(B,z){var C,A=z.parents.length;while(A--){C=z.parents[A].nodeName;if(C=="OL"||C=="UL"){break}}w.active(B&&C=="OL")})}if(w.settings.stateSelector){y.selectorChanged(w.settings.stateSelector,function(z){w.active(z)},true)}if(w.settings.disabledStateSelector){y.selectorChanged(w.settings.disabledStateSelector,function(z){w.disabled(z)})}}if(w=="|"){s=null}else{if(c.has(w)){w={type:w};if(f.toolbar_items_size){w.size=f.toolbar_items_size}u.push(w);s=null}else{if(!s){s={type:"buttongroup",items:[]};u.push(s)}if(i.buttons[w]){x=w;w=i.buttons[x];if(typeof w=="function"){w=w()}w.type=w.type||"button";if(f.toolbar_items_size){w.size=f.toolbar_items_size}w=c.create(w);s.items.push(w);if(i.initialized){v()}else{i.on("init",v)}}}}});q.push({type:"toolbar",layout:"flow",items:u});return true}if(tinymce.isArray(f.toolbar)){if(f.toolbar.length===0){return}tinymce.each(f.toolbar,function(t,s){f["toolbar"+(s+1)]=t});delete f.toolbar}for(var p=1;p<10;p++){if(!r(f["toolbar"+p])){break}}if(!q.length&&f.toolbar!==false){r(f.toolbar||b)}if(q.length){return{type:"panel",layout:"stack",classes:"toolbar-grp",ariaRoot:true,ariaRemember:true,items:q}}}function k(){var r,w=[];function u(x){var y;if(x=="|"){return{text:"|"}}y=i.menuItems[x];return y}function p(B){var x,C,A,D,z;z=tinymce.makeMap((f.removed_menuitems||"").split(/[ ,]/));if(f.menu){C=f.menu[B];D=true}else{C=d[B]}if(C){x={text:C.title};A=[];m((C.items||"").split(/[ ,]/),function(F){var E=u(F);if(E&&!z[F]){A.push(u(F))}});if(!D){m(i.menuItems,function(E){if(E.context==B){if(E.separator=="before"){A.push({text:"|"})}if(E.prependToContext){A.unshift(E)}else{A.push(E)}if(E.separator=="after"){A.push({text:"|"})}}})}for(var y=0;y= 534; + + return { + /** + * Constant that is true if the browser is Opera. + * + * @property opera + * @type Boolean + * @final + */ + opera: opera, + + /** + * Constant that is true if the browser is WebKit (Safari/Chrome). + * + * @property webKit + * @type Boolean + * @final + */ + webkit: webkit, + + /** + * Constant that is more than zero if the browser is IE. + * + * @property ie + * @type Boolean + * @final + */ + ie: ie, + + /** + * Constant that is true if the browser is Gecko. + * + * @property gecko + * @type Boolean + * @final + */ + gecko: gecko, + + /** + * Constant that is true if the os is Mac OS. + * + * @property mac + * @type Boolean + * @final + */ + mac: mac, + + /** + * Constant that is true if the os is iOS. + * + * @property iOS + * @type Boolean + * @final + */ + iOS: iDevice, + + /** + * Constant that is true if the os is android. + * + * @property android + * @type Boolean + * @final + */ + android: android, + + /** + * Constant that is true if the browser supports editing. + * + * @property contentEditable + * @type Boolean + * @final + */ + contentEditable: contentEditable, + + /** + * Transparent image data url. + * + * @property transparentSrc + * @type Boolean + * @final + */ + transparentSrc: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", + + /** + * Returns true/false if the browser can or can't place the caret after a inline block like an image. + * + * @property noCaretAfter + * @type Boolean + * @final + */ + caretAfter: ie != 8, + + /** + * Constant that is true if the browser supports native DOM Ranges. IE 9+. + * + * @property range + * @type Boolean + */ + range: window.getSelection && "Range" in window, + + /** + * Returns the IE document mode for non IE browsers this will fake IE 10. + * + * @property documentMode + * @type Number + */ + documentMode: ie && !ie12 ? (document.documentMode || 7) : 10 + }; +}); + +// Included from: js/tinymce/classes/util/Tools.js + +/** + * Tools.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class contains various utlity functions. These are also exposed + * directly on the tinymce namespace. + * + * @class tinymce.util.Tools + */ +define("tinymce/util/Tools", [ + "tinymce/Env" +], function(Env) { + /** + * Removes whitespace from the beginning and end of a string. + * + * @method trim + * @param {String} s String to remove whitespace from. + * @return {String} New string with removed whitespace. + */ + var whiteSpaceRegExp = /^\s*|\s*$/g; + + function trim(str) { + return (str === null || str === undefined) ? '' : ("" + str).replace(whiteSpaceRegExp, ''); + } + + /** + * Returns true/false if the object is an array or not. + * + * @method isArray + * @param {Object} obj Object to check. + * @return {boolean} true/false state if the object is an array or not. + */ + var isArray = Array.isArray || function(obj) { + return Object.prototype.toString.call(obj) === "[object Array]"; + }; + + /** + * Checks if a object is of a specific type for example an array. + * + * @method is + * @param {Object} obj Object to check type of. + * @param {string} type Optional type to check for. + * @return {Boolean} true/false if the object is of the specified type. + */ + function is(obj, type) { + if (!type) { + return obj !== undefined; + } + + if (type == 'array' && isArray(obj)) { + return true; + } + + return typeof obj == type; + } + + /** + * Converts the specified object into a real JavaScript array. + * + * @method toArray + * @param {Object} obj Object to convert into array. + * @return {Array} Array object based in input. + */ + function toArray(obj) { + var array = obj, i, l; + + if (!isArray(obj)) { + array = []; + for (i = 0, l = obj.length; i < l; i++) { + array[i] = obj[i]; + } + } + + return array; + } + + /** + * Makes a name/object map out of an array with names. + * + * @method makeMap + * @param {Array/String} items Items to make map out of. + * @param {String} delim Optional delimiter to split string by. + * @param {Object} map Optional map to add items to. + * @return {Object} Name/value map of items. + */ + function makeMap(items, delim, map) { + var i; + + items = items || []; + delim = delim || ','; + + if (typeof items == "string") { + items = items.split(delim); + } + + map = map || {}; + + i = items.length; + while (i--) { + map[items[i]] = {}; + } + + return map; + } + + /** + * Performs an iteration of all items in a collection such as an object or array. This method will execure the + * callback function for each item in the collection, if the callback returns false the iteration will terminate. + * The callback has the following format: cb(value, key_or_index). + * + * @method each + * @param {Object} o Collection to iterate. + * @param {function} cb Callback function to execute for each item. + * @param {Object} s Optional scope to execute the callback in. + * @example + * // Iterate an array + * tinymce.each([1,2,3], function(v, i) { + * console.debug("Value: " + v + ", Index: " + i); + * }); + * + * // Iterate an object + * tinymce.each({a: 1, b: 2, c: 3], function(v, k) { + * console.debug("Value: " + v + ", Key: " + k); + * }); + */ + function each(o, cb, s) { + var n, l; + + if (!o) { + return 0; + } + + s = s || o; + + if (o.length !== undefined) { + // Indexed arrays, needed for Safari + for (n = 0, l = o.length; n < l; n++) { + if (cb.call(s, o[n], n, o) === false) { + return 0; + } + } + } else { + // Hashtables + for (n in o) { + if (o.hasOwnProperty(n)) { + if (cb.call(s, o[n], n, o) === false) { + return 0; + } + } + } + } + + return 1; + } + + /** + * Creates a new array by the return value of each iteration function call. This enables you to convert + * one array list into another. + * + * @method map + * @param {Array} array Array of items to iterate. + * @param {function} callback Function to call for each item. It's return value will be the new value. + * @return {Array} Array with new values based on function return values. + */ + function map(array, callback) { + var out = []; + + each(array, function(item) { + out.push(callback(item)); + }); + + return out; + } + + /** + * Filters out items from the input array by calling the specified function for each item. + * If the function returns false the item will be excluded if it returns true it will be included. + * + * @method grep + * @param {Array} a Array of items to loop though. + * @param {function} f Function to call for each item. Include/exclude depends on it's return value. + * @return {Array} New array with values imported and filtered based in input. + * @example + * // Filter out some items, this will return an array with 4 and 5 + * var items = tinymce.grep([1,2,3,4,5], function(v) {return v > 3;}); + */ + function grep(a, f) { + var o = []; + + each(a, function(v) { + if (!f || f(v)) { + o.push(v); + } + }); + + return o; + } + + /** + * Creates a class, subclass or static singleton. + * More details on this method can be found in the Wiki. + * + * @method create + * @param {String} s Class name, inheritage and prefix. + * @param {Object} p Collection of methods to add to the class. + * @param {Object} root Optional root object defaults to the global window object. + * @example + * // Creates a basic class + * tinymce.create('tinymce.somepackage.SomeClass', { + * SomeClass: function() { + * // Class constructor + * }, + * + * method: function() { + * // Some method + * } + * }); + * + * // Creates a basic subclass class + * tinymce.create('tinymce.somepackage.SomeSubClass:tinymce.somepackage.SomeClass', { + * SomeSubClass: function() { + * // Class constructor + * this.parent(); // Call parent constructor + * }, + * + * method: function() { + * // Some method + * this.parent(); // Call parent method + * }, + * + * 'static': { + * staticMethod: function() { + * // Static method + * } + * } + * }); + * + * // Creates a singleton/static class + * tinymce.create('static tinymce.somepackage.SomeSingletonClass', { + * method: function() { + * // Some method + * } + * }); + */ + function create(s, p, root) { + var self = this, sp, ns, cn, scn, c, de = 0; + + // Parse : : + s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s); + cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name + + // Create namespace for new class + ns = self.createNS(s[3].replace(/\.\w+$/, ''), root); + + // Class already exists + if (ns[cn]) { + return; + } + + // Make pure static class + if (s[2] == 'static') { + ns[cn] = p; + + if (this.onCreate) { + this.onCreate(s[2], s[3], ns[cn]); + } + + return; + } + + // Create default constructor + if (!p[cn]) { + p[cn] = function() {}; + de = 1; + } + + // Add constructor and methods + ns[cn] = p[cn]; + self.extend(ns[cn].prototype, p); + + // Extend + if (s[5]) { + sp = self.resolve(s[5]).prototype; + scn = s[5].match(/\.(\w+)$/i)[1]; // Class name + + // Extend constructor + c = ns[cn]; + if (de) { + // Add passthrough constructor + ns[cn] = function() { + return sp[scn].apply(this, arguments); + }; + } else { + // Add inherit constructor + ns[cn] = function() { + this.parent = sp[scn]; + return c.apply(this, arguments); + }; + } + ns[cn].prototype[cn] = ns[cn]; + + // Add super methods + self.each(sp, function(f, n) { + ns[cn].prototype[n] = sp[n]; + }); + + // Add overridden methods + self.each(p, function(f, n) { + // Extend methods if needed + if (sp[n]) { + ns[cn].prototype[n] = function() { + this.parent = sp[n]; + return f.apply(this, arguments); + }; + } else { + if (n != cn) { + ns[cn].prototype[n] = f; + } + } + }); + } + + // Add static methods + /*jshint sub:true*/ + /*eslint dot-notation:0*/ + self.each(p['static'], function(f, n) { + ns[cn][n] = f; + }); + } + + /** + * Returns the index of a value in an array, this method will return -1 if the item wasn't found. + * + * @method inArray + * @param {Array} a Array/Object to search for value in. + * @param {Object} v Value to check for inside the array. + * @return {Number/String} Index of item inside the array inside an object. Or -1 if it wasn't found. + * @example + * // Get index of value in array this will alert 1 since 2 is at that index + * alert(tinymce.inArray([1,2,3], 2)); + */ + function inArray(a, v) { + var i, l; + + if (a) { + for (i = 0, l = a.length; i < l; i++) { + if (a[i] === v) { + return i; + } + } + } + + return -1; + } + + function extend(obj, ext) { + var i, l, name, args = arguments, value; + + for (i = 1, l = args.length; i < l; i++) { + ext = args[i]; + for (name in ext) { + if (ext.hasOwnProperty(name)) { + value = ext[name]; + + if (value !== undefined) { + obj[name] = value; + } + } + } + } + + return obj; + } + + /** + * Executed the specified function for each item in a object tree. + * + * @method walk + * @param {Object} o Object tree to walk though. + * @param {function} f Function to call for each item. + * @param {String} n Optional name of collection inside the objects to walk for example childNodes. + * @param {String} s Optional scope to execute the function in. + */ + function walk(o, f, n, s) { + s = s || this; + + if (o) { + if (n) { + o = o[n]; + } + + each(o, function(o, i) { + if (f.call(s, o, i, n) === false) { + return false; + } + + walk(o, f, n, s); + }); + } + } + + /** + * Creates a namespace on a specific object. + * + * @method createNS + * @param {String} n Namespace to create for example a.b.c.d. + * @param {Object} o Optional object to add namespace to, defaults to window. + * @return {Object} New namespace object the last item in path. + * @example + * // Create some namespace + * tinymce.createNS('tinymce.somepackage.subpackage'); + * + * // Add a singleton + * var tinymce.somepackage.subpackage.SomeSingleton = { + * method: function() { + * // Some method + * } + * }; + */ + function createNS(n, o) { + var i, v; + + o = o || window; + + n = n.split('.'); + for (i = 0; i < n.length; i++) { + v = n[i]; + + if (!o[v]) { + o[v] = {}; + } + + o = o[v]; + } + + return o; + } + + /** + * Resolves a string and returns the object from a specific structure. + * + * @method resolve + * @param {String} n Path to resolve for example a.b.c.d. + * @param {Object} o Optional object to search though, defaults to window. + * @return {Object} Last object in path or null if it couldn't be resolved. + * @example + * // Resolve a path into an object reference + * var obj = tinymce.resolve('a.b.c.d'); + */ + function resolve(n, o) { + var i, l; + + o = o || window; + + n = n.split('.'); + for (i = 0, l = n.length; i < l; i++) { + o = o[n[i]]; + + if (!o) { + break; + } + } + + return o; + } + + /** + * Splits a string but removes the whitespace before and after each value. + * + * @method explode + * @param {string} s String to split. + * @param {string} d Delimiter to split by. + * @example + * // Split a string into an array with a,b,c + * var arr = tinymce.explode('a, b, c'); + */ + function explode(s, d) { + if (!s || is(s, 'array')) { + return s; + } + + return map(s.split(d || ','), trim); + } + + function _addCacheSuffix(url) { + var cacheSuffix = Env.cacheSuffix; + + if (cacheSuffix) { + url += (url.indexOf('?') === -1 ? '?' : '&') + cacheSuffix; + } + + return url; + } + + return { + trim: trim, + isArray: isArray, + is: is, + toArray: toArray, + makeMap: makeMap, + each: each, + map: map, + grep: grep, + inArray: inArray, + extend: extend, + create: create, + walk: walk, + createNS: createNS, + resolve: resolve, + explode: explode, + _addCacheSuffix: _addCacheSuffix + }; +}); + +// Included from: js/tinymce/classes/dom/DomQuery.js + +/** + * DomQuery.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class mimics most of the jQuery API: + * + * This is whats currently implemented: + * - Utility functions + * - DOM traversial + * - DOM manipulation + * - Event binding + * + * This is not currently implemented: + * - Dimension + * - Ajax + * - Animation + * - Advanced chaining + * + * @example + * var $ = tinymce.dom.DomQuery; + * $('p').attr('attr', 'value').addClass('class'); + * + * @class tinymce.dom.DomQuery + */ +define("tinymce/dom/DomQuery", [ + "tinymce/dom/EventUtils", + "tinymce/dom/Sizzle", + "tinymce/util/Tools", + "tinymce/Env" +], function(EventUtils, Sizzle, Tools, Env) { + var doc = document, push = Array.prototype.push, slice = Array.prototype.slice; + var rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/; + var Event = EventUtils.Event, undef; + + function isDefined(obj) { + return typeof obj !== 'undefined'; + } + + function isString(obj) { + return typeof obj === 'string'; + } + + function isWindow(obj) { + return obj && obj == obj.window; + } + + function createFragment(html, fragDoc) { + var frag, node, container; + + fragDoc = fragDoc || doc; + container = fragDoc.createElement('div'); + frag = fragDoc.createDocumentFragment(); + container.innerHTML = html; + + while ((node = container.firstChild)) { + frag.appendChild(node); + } + + return frag; + } + + function domManipulate(targetNodes, sourceItem, callback, reverse) { + var i; + + if (isString(sourceItem)) { + sourceItem = createFragment(sourceItem, getElementDocument(targetNodes[0])); + } else if (sourceItem.length && !sourceItem.nodeType) { + sourceItem = DomQuery.makeArray(sourceItem); + + if (reverse) { + for (i = sourceItem.length - 1; i >= 0; i--) { + domManipulate(targetNodes, sourceItem[i], callback, reverse); + } + } else { + for (i = 0; i < sourceItem.length; i++) { + domManipulate(targetNodes, sourceItem[i], callback, reverse); + } + } + + return targetNodes; + } + + if (sourceItem.nodeType) { + i = targetNodes.length; + while (i--) { + callback.call(targetNodes[i], sourceItem); + } + } + + return targetNodes; + } + + function hasClass(node, className) { + return node && className && (' ' + node.className + ' ').indexOf(' ' + className + ' ') !== -1; + } + + function wrap(elements, wrapper, all) { + var lastParent, newWrapper; + + wrapper = DomQuery(wrapper)[0]; + + elements.each(function() { + var self = this; + + if (!all || lastParent != self.parentNode) { + lastParent = self.parentNode; + newWrapper = wrapper.cloneNode(false); + self.parentNode.insertBefore(newWrapper, self); + newWrapper.appendChild(self); + } else { + newWrapper.appendChild(self); + } + }); + + return elements; + } + + var numericCssMap = Tools.makeMap('fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom', ' '); + var booleanMap = Tools.makeMap('checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected', ' '); + var propFix = { + 'for': 'htmlFor', + 'class': 'className', + 'readonly': 'readOnly' + }; + var cssFix = { + 'float': 'cssFloat' + }; + + var attrHooks = {}, cssHooks = {}; + + function DomQuery(selector, context) { + /*eslint new-cap:0 */ + return new DomQuery.fn.init(selector, context); + } + + function inArray(item, array) { + var i; + + if (array.indexOf) { + return array.indexOf(item); + } + + i = array.length; + while (i--) { + if (array[i] === item) { + return i; + } + } + + return -1; + } + + var whiteSpaceRegExp = /^\s*|\s*$/g; + + function trim(str) { + return (str === null || str === undef) ? '' : ("" + str).replace(whiteSpaceRegExp, ''); + } + + function each(obj, callback) { + var length, key, i, undef, value; + + if (obj) { + length = obj.length; + + if (length === undef) { + // Loop object items + for (key in obj) { + if (obj.hasOwnProperty(key)) { + value = obj[key]; + if (callback.call(value, key, value) === false) { + break; + } + } + } + } else { + // Loop array items + for (i = 0; i < length; i++) { + value = obj[i]; + if (callback.call(value, i, value) === false) { + break; + } + } + } + } + + return obj; + } + + function grep(array, callback) { + var out = []; + + each(array, function(i, item) { + if (callback(item, i)) { + out.push(item); + } + }); + + return out; + } + + function getElementDocument(element) { + if (!element) { + return doc; + } + + if (element.nodeType == 9) { + return element; + } + + return element.ownerDocument; + } + + DomQuery.fn = DomQuery.prototype = { + constructor: DomQuery, + + /** + * Selector for the current set. + * + * @property selector + * @type String + */ + selector: "", + + /** + * Context used to create the set. + * + * @property context + * @type Element + */ + context: null, + + /** + * Number of items in the current set. + * + * @property length + * @type Number + */ + length: 0, + + /** + * Constructs a new DomQuery instance with the specified selector or context. + * + * @constructor + * @method init + * @param {String/Array/DomQuery} selector Optional CSS selector/Array or array like object or HTML string. + * @param {Document/Element} context Optional context to search in. + */ + init: function(selector, context) { + var self = this, match, node; + + if (!selector) { + return self; + } + + if (selector.nodeType) { + self.context = self[0] = selector; + self.length = 1; + + return self; + } + + if (context && context.nodeType) { + self.context = context; + } else { + if (context) { + return DomQuery(selector).attr(context); + } else { + self.context = context = document; + } + } + + if (isString(selector)) { + self.selector = selector; + + if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) { + match = [null, selector, null]; + } else { + match = rquickExpr.exec(selector); + } + + if (match) { + if (match[1]) { + node = createFragment(selector, getElementDocument(context)).firstChild; + + while (node) { + push.call(self, node); + node = node.nextSibling; + } + } else { + node = getElementDocument(context).getElementById(match[2]); + + if (!node) { + return self; + } + + if (node.id !== match[2]) { + return self.find(selector); + } + + self.length = 1; + self[0] = node; + } + } else { + return DomQuery(context).find(selector); + } + } else { + this.add(selector, false); + } + + return self; + }, + + /** + * Converts the current set to an array. + * + * @method toArray + * @param {Array} Array of all nodes in set. + */ + toArray: function() { + return Tools.toArray(this); + }, + + /** + * Adds new nodes to the set. + * + * @method add + * @param {Array/tinymce.dom.DomQuery} items Array of all nodes to add to set. + * @return {tinymce.dom.DomQuery} New instance with nodes added. + */ + add: function(items, sort) { + var self = this, nodes, i; + + if (isString(items)) { + return self.add(DomQuery(items)); + } + + if (sort !== false) { + nodes = DomQuery.unique(self.toArray().concat(DomQuery.makeArray(items))); + self.length = nodes.length; + for (i = 0; i < nodes.length; i++) { + self[i] = nodes[i]; + } + } else { + push.apply(self, DomQuery.makeArray(items)); + } + + return self; + }, + + /** + * Sets/gets attributes on the elements in the current set. + * + * @method attr + * @param {String/Object} name Name of attribute to get or an object with attributes to set. + * @param {String} value Optional value to set. + * @return {tinymce.dom.DomQuery/String} Current set or the specified attribute when only the name is specified. + */ + attr: function(name, value) { + var self = this, hook; + + if (typeof name === "object") { + each(name, function(name, value) { + self.attr(name, value); + }); + } else if (isDefined(value)) { + this.each(function() { + var hook; + + if (this.nodeType === 1) { + hook = attrHooks[name]; + if (hook && hook.set) { + hook.set(this, value); + return; + } + + if (value === null) { + this.removeAttribute(name, 2); + } else { + this.setAttribute(name, value, 2); + } + } + }); + } else { + if (self[0] && self[0].nodeType === 1) { + hook = attrHooks[name]; + if (hook && hook.get) { + return hook.get(self[0], name); + } + + if (booleanMap[name]) { + return self.prop(name) ? name : undef; + } + + value = self[0].getAttribute(name, 2); + + if (value === null) { + value = undef; + } + } + + return value; + } + + return self; + }, + + /** + * Removes attributse on the elements in the current set. + * + * @method removeAttr + * @param {String/Object} name Name of attribute to remove. + * @return {tinymce.dom.DomQuery/String} Current set. + */ + removeAttr: function(name) { + return this.attr(name, null); + }, + + /** + * Sets/gets properties on the elements in the current set. + * + * @method attr + * @param {String/Object} name Name of property to get or an object with properties to set. + * @param {String} value Optional value to set. + * @return {tinymce.dom.DomQuery/String} Current set or the specified property when only the name is specified. + */ + prop: function(name, value) { + var self = this; + + name = propFix[name] || name; + + if (typeof name === "object") { + each(name, function(name, value) { + self.prop(name, value); + }); + } else if (isDefined(value)) { + this.each(function() { + if (this.nodeType == 1) { + this[name] = value; + } + }); + } else { + if (self[0] && self[0].nodeType && name in self[0]) { + return self[0][name]; + } + + return value; + } + + return self; + }, + + /** + * Sets/gets styles on the elements in the current set. + * + * @method css + * @param {String/Object} name Name of style to get or an object with styles to set. + * @param {String} value Optional value to set. + * @return {tinymce.dom.DomQuery/String} Current set or the specified style when only the name is specified. + */ + css: function(name, value) { + var self = this, elm, hook; + + function camel(name) { + return name.replace(/-(\D)/g, function(a, b) { + return b.toUpperCase(); + }); + } + + function dashed(name) { + return name.replace(/[A-Z]/g, function(a) { + return '-' + a; + }); + } + + if (typeof name === "object") { + each(name, function(name, value) { + self.css(name, value); + }); + } else { + if (isDefined(value)) { + name = camel(name); + + // Default px suffix on these + if (typeof value === 'number' && !numericCssMap[name]) { + value += 'px'; + } + + self.each(function() { + var style = this.style; + + hook = cssHooks[name]; + if (hook && hook.set) { + hook.set(this, value); + return; + } + + try { + this.style[cssFix[name] || name] = value; + } catch (ex) { + // Ignore + } + + if (value === null || value === '') { + if (style.removeProperty) { + style.removeProperty(dashed(name)); + } else { + style.removeAttribute(name); + } + } + }); + } else { + elm = self[0]; + + hook = cssHooks[name]; + if (hook && hook.get) { + return hook.get(elm); + } + + if (elm.ownerDocument.defaultView) { + try { + return elm.ownerDocument.defaultView.getComputedStyle(elm, null).getPropertyValue(dashed(name)); + } catch (ex) { + return undef; + } + } else if (elm.currentStyle) { + return elm.currentStyle[camel(name)]; + } + } + } + + return self; + }, + + /** + * Removes all nodes in set from the document. + * + * @method remove + * @return {tinymce.dom.DomQuery} Current set with the removed nodes. + */ + remove: function() { + var self = this, node, i = this.length; + + while (i--) { + node = self[i]; + Event.clean(node); + + if (node.parentNode) { + node.parentNode.removeChild(node); + } + } + + return this; + }, + + /** + * Empties all elements in set. + * + * @method empty + * @return {tinymce.dom.DomQuery} Current set with the empty nodes. + */ + empty: function() { + var self = this, node, i = this.length; + + while (i--) { + node = self[i]; + while (node.firstChild) { + node.removeChild(node.firstChild); + } + } + + return this; + }, + + /** + * Sets or gets the HTML of the current set or first set node. + * + * @method html + * @param {String} value Optional innerHTML value to set on each element. + * @return {tinymce.dom.DomQuery/String} Current set or the innerHTML of the first element. + */ + html: function(value) { + var self = this, i; + + if (isDefined(value)) { + i = self.length; + + try { + while (i--) { + self[i].innerHTML = value; + } + } catch (ex) { + // Workaround for "Unknown runtime error" when DIV is added to P on IE + DomQuery(self[i]).empty().append(value); + } + + return self; + } + + return self[0] ? self[0].innerHTML : ''; + }, + + /** + * Sets or gets the text of the current set or first set node. + * + * @method text + * @param {String} value Optional innerText value to set on each element. + * @return {tinymce.dom.DomQuery/String} Current set or the innerText of the first element. + */ + text: function(value) { + var self = this, i; + + if (isDefined(value)) { + i = self.length; + while (i--) { + if ("innerText" in self[i]) { + self[i].innerText = value; + } else { + self[0].textContent = value; + } + } + + return self; + } + + return self[0] ? (self[0].innerText || self[0].textContent) : ''; + }, + + /** + * Appends the specified node/html or node set to the current set nodes. + * + * @method append + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to append to each element in set. + * @return {tinymce.dom.DomQuery} Current set. + */ + append: function() { + return domManipulate(this, arguments, function(node) { + if (this.nodeType === 1) { + this.appendChild(node); + } + }); + }, + + /** + * Prepends the specified node/html or node set to the current set nodes. + * + * @method prepend + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to prepend to each element in set. + * @return {tinymce.dom.DomQuery} Current set. + */ + prepend: function() { + return domManipulate(this, arguments, function(node) { + if (this.nodeType === 1) { + this.insertBefore(node, this.firstChild); + } + }, true); + }, + + /** + * Adds the specified elements before current set nodes. + * + * @method before + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to add before to each element in set. + * @return {tinymce.dom.DomQuery} Current set. + */ + before: function() { + var self = this; + + if (self[0] && self[0].parentNode) { + return domManipulate(self, arguments, function(node) { + this.parentNode.insertBefore(node, this); + }); + } + + return self; + }, + + /** + * Adds the specified elements after current set nodes. + * + * @method after + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to add after to each element in set. + * @return {tinymce.dom.DomQuery} Current set. + */ + after: function() { + var self = this; + + if (self[0] && self[0].parentNode) { + return domManipulate(self, arguments, function(node) { + this.parentNode.insertBefore(node, this.nextSibling); + }, true); + } + + return self; + }, + + /** + * Appends the specified set nodes to the specified selector/instance. + * + * @method appendTo + * @param {String/Element/Array/tinymce.dom.DomQuery} val Item to append the current set to. + * @return {tinymce.dom.DomQuery} Current set with the appended nodes. + */ + appendTo: function(val) { + DomQuery(val).append(this); + + return this; + }, + + /** + * Prepends the specified set nodes to the specified selector/instance. + * + * @method prependTo + * @param {String/Element/Array/tinymce.dom.DomQuery} val Item to prepend the current set to. + * @return {tinymce.dom.DomQuery} Current set with the prepended nodes. + */ + prependTo: function(val) { + DomQuery(val).prepend(this); + + return this; + }, + + /** + * Replaces the nodes in set with the specified content. + * + * @method replaceWith + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to replace nodes with. + * @return {tinymce.dom.DomQuery} Set with replaced nodes. + */ + replaceWith: function(content) { + return this.before(content).remove(); + }, + + /** + * Wraps all elements in set with the specified wrapper. + * + * @method wrap + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to wrap nodes with. + * @return {tinymce.dom.DomQuery} Set with wrapped nodes. + */ + wrap: function(wrapper) { + return wrap(this, wrapper); + }, + + /** + * Wraps all nodes in set with the specified wrapper. If the nodes are siblings all of them + * will be wrapped in the same wrapper. + * + * @method wrapAll + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to wrap nodes with. + * @return {tinymce.dom.DomQuery} Set with wrapped nodes. + */ + wrapAll: function(wrapper) { + return wrap(this, wrapper, true); + }, + + /** + * Wraps all elements inner contents in set with the specified wrapper. + * + * @method wrapInner + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to wrap nodes with. + * @return {tinymce.dom.DomQuery} Set with wrapped nodes. + */ + wrapInner: function(wrapper) { + this.each(function() { + DomQuery(this).contents().wrapAll(wrapper); + }); + + return this; + }, + + /** + * Unwraps all elements by removing the parent element of each item in set. + * + * @method unwrap + * @return {tinymce.dom.DomQuery} Set with unwrapped nodes. + */ + unwrap: function() { + return this.parent().each(function() { + DomQuery(this).replaceWith(this.childNodes); + }); + }, + + /** + * Clones all nodes in set. + * + * @method clone + * @return {tinymce.dom.DomQuery} Set with cloned nodes. + */ + clone: function() { + var result = []; + + this.each(function() { + result.push(this.cloneNode(true)); + }); + + return DomQuery(result); + }, + + /** + * Adds the specified class name to the current set elements. + * + * @method addClass + * @param {String} className Class name to add. + * @return {tinymce.dom.DomQuery} Current set. + */ + addClass: function(className) { + return this.toggleClass(className, true); + }, + + /** + * Removes the specified class name to the current set elements. + * + * @method removeClass + * @param {String} className Class name to remove. + * @return {tinymce.dom.DomQuery} Current set. + */ + removeClass: function(className) { + return this.toggleClass(className, false); + }, + + /** + * Toggles the specified class name on the current set elements. + * + * @method toggleClass + * @param {String} className Class name to add/remove. + * @param {Boolean} state Optional state to toggle on/off. + * @return {tinymce.dom.DomQuery} Current set. + */ + toggleClass: function(className, state) { + var self = this; + + // Functions are not supported + if (typeof className != 'string') { + return self; + } + + if (className.indexOf(' ') !== -1) { + each(className.split(' '), function() { + self.toggleClass(this, state); + }); + } else { + self.each(function(index, node) { + var existingClassName, classState; + + classState = hasClass(node, className); + if (classState !== state) { + existingClassName = node.className; + + if (classState) { + node.className = trim((" " + existingClassName + " ").replace(' ' + className + ' ', ' ')); + } else { + node.className += existingClassName ? ' ' + className : className; + } + } + }); + } + + return self; + }, + + /** + * Returns true/false if the first item in set has the specified class. + * + * @method hasClass + * @param {String} className Class name to check for. + * @return {Boolean} True/false if the set has the specified class. + */ + hasClass: function(className) { + return hasClass(this[0], className); + }, + + /** + * Executes the callback function for each item DomQuery collection. If you return false in the + * callback it will break the loop. + * + * @method each + * @param {function} callback Callback function to execute for each item. + * @return {tinymce.dom.DomQuery} Current set. + */ + each: function(callback) { + return each(this, callback); + }, + + /** + * Binds an event with callback function to the elements in set. + * + * @method on + * @param {String} name Name of the event to bind. + * @param {function} callback Callback function to execute when the event occurs. + * @return {tinymce.dom.DomQuery} Current set. + */ + on: function(name, callback) { + return this.each(function() { + Event.bind(this, name, callback); + }); + }, + + /** + * Unbinds an event with callback function to the elements in set. + * + * @method off + * @param {String} name Optional name of the event to bind. + * @param {function} callback Optional callback function to execute when the event occurs. + * @return {tinymce.dom.DomQuery} Current set. + */ + off: function(name, callback) { + return this.each(function() { + Event.unbind(this, name, callback); + }); + }, + + /** + * Triggers the specified event by name or event object. + * + * @method trigger + * @param {String/Object} name Name of the event to trigger or event object. + * @return {tinymce.dom.DomQuery} Current set. + */ + trigger: function(name) { + return this.each(function() { + if (typeof name == 'object') { + Event.fire(this, name.type, name); + } else { + Event.fire(this, name); + } + }); + }, + + /** + * Shows all elements in set. + * + * @method show + * @return {tinymce.dom.DomQuery} Current set. + */ + show: function() { + return this.css('display', ''); + }, + + /** + * Hides all elements in set. + * + * @method hide + * @return {tinymce.dom.DomQuery} Current set. + */ + hide: function() { + return this.css('display', 'none'); + }, + + /** + * Slices the current set. + * + * @method slice + * @param {Number} start Start index to slice at. + * @param {Number} end Optional ened index to end slice at. + * @return {tinymce.dom.DomQuery} Sliced set. + */ + slice: function() { + return new DomQuery(slice.apply(this, arguments)); + }, + + /** + * Makes the set equal to the specified index. + * + * @method eq + * @param {Number} index Index to set it equal to. + * @return {tinymce.dom.DomQuery} Single item set. + */ + eq: function(index) { + return index === -1 ? this.slice(index) : this.slice(index, +index + 1); + }, + + /** + * Makes the set equal to first element in set. + * + * @method first + * @return {tinymce.dom.DomQuery} Single item set. + */ + first: function() { + return this.eq(0); + }, + + /** + * Makes the set equal to last element in set. + * + * @method last + * @return {tinymce.dom.DomQuery} Single item set. + */ + last: function() { + return this.eq(-1); + }, + + /** + * Finds elements by the specified selector for each element in set. + * + * @method find + * @param {String} selector Selector to find elements by. + * @return {tinymce.dom.DomQuery} Set with matches elements. + */ + find: function(selector) { + var i, l, ret = []; + + for (i = 0, l = this.length; i < l; i++) { + DomQuery.find(selector, this[i], ret); + } + + return DomQuery(ret); + }, + + /** + * Filters the current set with the specified selector. + * + * @method filter + * @param {String/function} selector Selector to filter elements by. + * @return {tinymce.dom.DomQuery} Set with filtered elements. + */ + filter: function(selector) { + if (typeof selector == 'function') { + return DomQuery(grep(this.toArray(), function(item, i) { + return selector(i, item); + })); + } + + return DomQuery(DomQuery.filter(selector, this.toArray())); + }, + + /** + * Gets the current node or any partent matching the specified selector. + * + * @method closest + * @param {String/Element/tinymce.dom.DomQuery} selector Selector or element to find. + * @return {tinymce.dom.DomQuery} Set with closest elements. + */ + closest: function(selector) { + var result = []; + + if (selector instanceof DomQuery) { + selector = selector[0]; + } + + this.each(function(i, node) { + while (node) { + if (typeof selector == 'string' && DomQuery(node).is(selector)) { + result.push(node); + break; + } else if (node == selector) { + result.push(node); + break; + } + + node = node.parentNode; + } + }); + + return DomQuery(result); + }, + + /** + * Returns the offset of the first element in set or sets the top/left css properties of all elements in set. + * + * @method offset + * @param {Object} offset Optional offset object to set on each item. + * @return {Object/tinymce.dom.DomQuery} Returns the first element offset or the current set if you specified an offset. + */ + offset: function(offset) { + var elm, doc, docElm; + var x = 0, y = 0, pos; + + if (!offset) { + elm = this[0]; + + if (elm) { + doc = elm.ownerDocument; + docElm = doc.documentElement; + + if (elm.getBoundingClientRect) { + pos = elm.getBoundingClientRect(); + x = pos.left + (docElm.scrollLeft || doc.body.scrollLeft) - docElm.clientLeft; + y = pos.top + (docElm.scrollTop || doc.body.scrollTop) - docElm.clientTop; + } + } + + return { + left: x, + top: y + }; + } + + return this.css(offset); + }, + + push: push, + sort: [].sort, + splice: [].splice + }; + + // Static members + Tools.extend(DomQuery, { + /** + * Extends the specified object with one or more objects. + * + * @static + * @method extend + * @param {Object} target Target object to extend with new items. + * @param {Object..} object Object to extend the target with. + * @return {Object} Extended input object. + */ + extend: Tools.extend, + + /** + * Creates an array out of an array like object. + * + * @static + * @method makeArray + * @param {Object} object Object to convert to array. + * @return {Arrau} Array produced from object. + */ + makeArray: function(array) { + if (isWindow(array) || array.nodeType) { + return [array]; + } + + return Tools.toArray(array); + }, + + /** + * Returns the index of the specified item inside the array. + * + * @static + * @method inArray + * @param {Object} item Item to look for. + * @param {Array} array Array to look for item in. + * @return {Number} Index of the item or -1. + */ + inArray: inArray, + + /** + * Returns true/false if the specified object is an array or not. + * + * @static + * @method isArray + * @param {Object} array Object to check if it's an array or not. + * @return {Boolean} True/false if the object is an array. + */ + isArray: Tools.isArray, + + /** + * Executes the callback function for each item in array/object. If you return false in the + * callback it will break the loop. + * + * @static + * @method each + * @param {Object} obj Object to iterate. + * @param {function} callback Callback function to execute for each item. + */ + each: each, + + /** + * Removes whitespace from the beginning and end of a string. + * + * @static + * @method trim + * @param {String} str String to remove whitespace from. + * @return {String} New string with removed whitespace. + */ + trim: trim, + + /** + * Filters out items from the input array by calling the specified function for each item. + * If the function returns false the item will be excluded if it returns true it will be included. + * + * @static + * @method grep + * @param {Array} array Array of items to loop though. + * @param {function} callback Function to call for each item. Include/exclude depends on it's return value. + * @return {Array} New array with values imported and filtered based in input. + * @example + * // Filter out some items, this will return an array with 4 and 5 + * var items = DomQuery.grep([1, 2, 3, 4, 5], function(v) {return v > 3;}); + */ + grep: grep, + + // Sizzle + find: Sizzle, + expr: Sizzle.selectors, + unique: Sizzle.uniqueSort, + text: Sizzle.getText, + contains: Sizzle.contains, + filter: function(expr, elems, not) { + var i = elems.length; + + if (not) { + expr = ":not(" + expr + ")"; + } + + while (i--) { + if (elems[i].nodeType != 1) { + elems.splice(i, 1); + } + } + + if (elems.length === 1) { + elems = DomQuery.find.matchesSelector(elems[0], expr) ? [elems[0]] : []; + } else { + elems = DomQuery.find.matches(expr, elems); + } + + return elems; + } + }); + + function dir(el, prop, until) { + var matched = [], cur = el[prop]; + + if (typeof until != 'string' && until instanceof DomQuery) { + until = until[0]; + } + + while (cur && cur.nodeType !== 9) { + if (until !== undefined) { + if (cur === until) { + break; + } + + if (typeof until == 'string' && DomQuery(cur).is(until)) { + break; + } + } + + if (cur.nodeType === 1) { + matched.push(cur); + } + + cur = cur[prop]; + } + + return matched; + } + + function sibling(node, siblingName, nodeType, until) { + var result = []; + + if (until instanceof DomQuery) { + until = until[0]; + } + + for (; node; node = node[siblingName]) { + if (nodeType && node.nodeType !== nodeType) { + continue; + } + + if (until !== undefined) { + if (node === until) { + break; + } + + if (typeof until == 'string' && DomQuery(node).is(until)) { + break; + } + } + + result.push(node); + } + + return result; + } + + function firstSibling(node, siblingName, nodeType) { + for (node = node[siblingName]; node; node = node[siblingName]) { + if (node.nodeType == nodeType) { + return node; + } + } + + return null; + } + + each({ + /** + * Returns a new collection with the parent of each item in current collection matching the optional selector. + * + * @method parent + * @param {String} selector Selector to match parents agains. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching parents. + */ + parent: function(node) { + var parent = node.parentNode; + + return parent && parent.nodeType !== 11 ? parent : null; + }, + + /** + * Returns a new collection with the all the parents of each item in current collection matching the optional selector. + * + * @method parents + * @param {String} selector Selector to match parents agains. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching parents. + */ + parents: function(node) { + return dir(node, "parentNode"); + }, + + /** + * Returns a new collection with next sibling of each item in current collection matching the optional selector. + * + * @method next + * @param {String} selector Selector to match the next element against. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + next: function(node) { + return firstSibling(node, 'nextSibling', 1); + }, + + /** + * Returns a new collection with previous sibling of each item in current collection matching the optional selector. + * + * @method prev + * @param {String} selector Selector to match the previous element against. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + prev: function(node) { + return firstSibling(node, 'previousSibling', 1); + }, + + /** + * Returns all child elements matching the optional selector. + * + * @method children + * @param {String} selector Selector to match the elements against. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + children: function(node) { + return sibling(node.firstChild, 'nextSibling', 1); + }, + + /** + * Returns all child nodes matching the optional selector. + * + * @method contents + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + contents: function(node) { + return Tools.toArray((node.nodeName === "iframe" ? node.contentDocument || node.contentWindow.document : node).childNodes); + } + }, function(name, fn) { + DomQuery.fn[name] = function(selector) { + var self = this, result = []; + + self.each(function() { + var nodes = fn.call(result, this, selector, result); + + if (nodes) { + if (DomQuery.isArray(nodes)) { + result.push.apply(result, nodes); + } else { + result.push(nodes); + } + } + }); + + // If traversing on multiple elements we might get the same elements twice + if (this.length > 1) { + result = DomQuery.unique(result); + + if (name.indexOf('parents') === 0) { + result = result.reverse(); + } + } + + result = DomQuery(result); + + if (selector) { + return result.filter(selector); + } + + return result; + }; + }); + + each({ + /** + * Returns a new collection with the all the parents until the matching selector/element + * of each item in current collection matching the optional selector. + * + * @method parentsUntil + * @param {String/Element/tinymce.dom.DomQuery} until Until the matching selector or element. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching parents. + */ + parentsUntil: function(node, until) { + return dir(node, "parentNode", until); + }, + + /** + * Returns a new collection with all next siblings of each item in current collection matching the optional selector. + * + * @method nextUntil + * @param {String/Element/tinymce.dom.DomQuery} until Until the matching selector or element. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + nextUntil: function(node, until) { + return sibling(node, 'nextSibling', 1, until).slice(1); + }, + + /** + * Returns a new collection with all previous siblings of each item in current collection matching the optional selector. + * + * @method prevUntil + * @param {String/Element/tinymce.dom.DomQuery} until Until the matching selector or element. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + prevUntil: function(node, until) { + return sibling(node, 'previousSibling', 1, until).slice(1); + } + }, function(name, fn) { + DomQuery.fn[name] = function(selector, filter) { + var self = this, result = []; + + self.each(function() { + var nodes = fn.call(result, this, selector, result); + + if (nodes) { + if (DomQuery.isArray(nodes)) { + result.push.apply(result, nodes); + } else { + result.push(nodes); + } + } + }); + + // If traversing on multiple elements we might get the same elements twice + if (this.length > 1) { + result = DomQuery.unique(result); + + if (name.indexOf('parents') === 0 || name === 'prevUntil') { + result = result.reverse(); + } + } + + result = DomQuery(result); + + if (filter) { + return result.filter(filter); + } + + return result; + }; + }); + + /** + * Returns true/false if the current set items matches the selector. + * + * @method is + * @param {String} selector Selector to match the elements against. + * @return {Boolean} True/false if the current set matches the selector. + */ + DomQuery.fn.is = function(selector) { + return !!selector && this.filter(selector).length > 0; + }; + + DomQuery.fn.init.prototype = DomQuery.fn; + + DomQuery.overrideDefaults = function(callback) { + var defaults; + + function sub(selector, context) { + defaults = defaults || callback(); + + if (arguments.length === 0) { + selector = defaults.element; + } + + if (!context) { + context = defaults.context; + } + + return new sub.fn.init(selector, context); + } + + DomQuery.extend(sub, this); + + return sub; + }; + + function appendHooks(targetHooks, prop, hooks) { + each(hooks, function(name, func) { + targetHooks[name] = targetHooks[name] || {}; + targetHooks[name][prop] = func; + }); + } + + if (Env.ie && Env.ie < 8) { + appendHooks(attrHooks, 'get', { + maxlength: function(elm) { + var value = elm.maxLength; + + if (value === 0x7fffffff) { + return undef; + } + + return value; + }, + + size: function(elm) { + var value = elm.size; + + if (value === 20) { + return undef; + } + + return value; + }, + + 'class': function(elm) { + return elm.className; + }, + + style: function(elm) { + var value = elm.style.cssText; + + if (value.length === 0) { + return undef; + } + + return value; + } + }); + + appendHooks(attrHooks, 'set', { + 'class': function(elm, value) { + elm.className = value; + }, + + style: function(elm, value) { + elm.style.cssText = value; + } + }); + } + + if (Env.ie && Env.ie < 9) { + /*jshint sub:true */ + /*eslint dot-notation: 0*/ + cssFix['float'] = 'styleFloat'; + + appendHooks(cssHooks, 'set', { + opacity: function(elm, value) { + var style = elm.style; + + if (value === null || value === '') { + style.removeAttribute('filter'); + } else { + style.zoom = 1; + style.filter = 'alpha(opacity=' + (value * 100) + ')'; + } + } + }); + } + + DomQuery.attrHooks = attrHooks; + DomQuery.cssHooks = cssHooks; + + return DomQuery; +}); + +// Included from: js/tinymce/classes/html/Styles.js + +/** + * Styles.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to parse CSS styles it also compresses styles to reduce the output size. + * + * @example + * var Styles = new tinymce.html.Styles({ + * url_converter: function(url) { + * return url; + * } + * }); + * + * styles = Styles.parse('border: 1px solid red'); + * styles.color = 'red'; + * + * console.log(new tinymce.html.StyleSerializer().serialize(styles)); + * + * @class tinymce.html.Styles + * @version 3.4 + */ +define("tinymce/html/Styles", [], function() { + return function(settings, schema) { + /*jshint maxlen:255 */ + /*eslint max-len:0 */ + var rgbRegExp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi, + urlOrStrRegExp = /(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi, + styleRegExp = /\s*([^:]+):\s*([^;]+);?/g, + trimRightRegExp = /\s+$/, + undef, i, encodingLookup = {}, encodingItems, validStyles, invalidStyles, invisibleChar = '\uFEFF'; + + settings = settings || {}; + + if (schema) { + validStyles = schema.getValidStyles(); + invalidStyles = schema.getInvalidStyles(); + } + + encodingItems = ('\\" \\\' \\; \\: ; : ' + invisibleChar).split(' '); + for (i = 0; i < encodingItems.length; i++) { + encodingLookup[encodingItems[i]] = invisibleChar + i; + encodingLookup[invisibleChar + i] = encodingItems[i]; + } + + function toHex(match, r, g, b) { + function hex(val) { + val = parseInt(val, 10).toString(16); + + return val.length > 1 ? val : '0' + val; // 0 -> 00 + } + + return '#' + hex(r) + hex(g) + hex(b); + } + + return { + /** + * Parses the specified RGB color value and returns a hex version of that color. + * + * @method toHex + * @param {String} color RGB string value like rgb(1,2,3) + * @return {String} Hex version of that RGB value like #FF00FF. + */ + toHex: function(color) { + return color.replace(rgbRegExp, toHex); + }, + + /** + * Parses the specified style value into an object collection. This parser will also + * merge and remove any redundant items that browsers might have added. It will also convert non hex + * colors to hex values. Urls inside the styles will also be converted to absolute/relative based on settings. + * + * @method parse + * @param {String} css Style value to parse for example: border:1px solid red;. + * @return {Object} Object representation of that style like {border: '1px solid red'} + */ + parse: function(css) { + var styles = {}, matches, name, value, isEncoded, urlConverter = settings.url_converter; + var urlConverterScope = settings.url_converter_scope || this; + + function compress(prefix, suffix, noJoin) { + var top, right, bottom, left; + + top = styles[prefix + '-top' + suffix]; + if (!top) { + return; + } + + right = styles[prefix + '-right' + suffix]; + if (!right) { + return; + } + + bottom = styles[prefix + '-bottom' + suffix]; + if (!bottom) { + return; + } + + left = styles[prefix + '-left' + suffix]; + if (!left) { + return; + } + + var box = [top, right, bottom, left]; + i = box.length - 1; + while (i--) { + if (box[i] !== box[i + 1]) { + break; + } + } + + if (i > -1 && noJoin) { + return; + } + + styles[prefix + suffix] = i == -1 ? box[0] : box.join(' '); + delete styles[prefix + '-top' + suffix]; + delete styles[prefix + '-right' + suffix]; + delete styles[prefix + '-bottom' + suffix]; + delete styles[prefix + '-left' + suffix]; + } + + /** + * Checks if the specific style can be compressed in other words if all border-width are equal. + */ + function canCompress(key) { + var value = styles[key], i; + + if (!value) { + return; + } + + value = value.split(' '); + i = value.length; + while (i--) { + if (value[i] !== value[0]) { + return false; + } + } + + styles[key] = value[0]; + + return true; + } + + /** + * Compresses multiple styles into one style. + */ + function compress2(target, a, b, c) { + if (!canCompress(a)) { + return; + } + + if (!canCompress(b)) { + return; + } + + if (!canCompress(c)) { + return; + } + + // Compress + styles[target] = styles[a] + ' ' + styles[b] + ' ' + styles[c]; + delete styles[a]; + delete styles[b]; + delete styles[c]; + } + + // Encodes the specified string by replacing all \" \' ; : with _ + function encode(str) { + isEncoded = true; + + return encodingLookup[str]; + } + + // Decodes the specified string by replacing all _ with it's original value \" \' etc + // It will also decode the \" \' if keep_slashes is set to fale or omitted + function decode(str, keep_slashes) { + if (isEncoded) { + str = str.replace(/\uFEFF[0-9]/g, function(str) { + return encodingLookup[str]; + }); + } + + if (!keep_slashes) { + str = str.replace(/\\([\'\";:])/g, "$1"); + } + + return str; + } + + function processUrl(match, url, url2, url3, str, str2) { + str = str || str2; + + if (str) { + str = decode(str); + + // Force strings into single quote format + return "'" + str.replace(/\'/g, "\\'") + "'"; + } + + url = decode(url || url2 || url3); + + if (!settings.allow_script_urls) { + var scriptUrl = url.replace(/[\s\r\n]+/, ''); + + if (/(java|vb)script:/i.test(scriptUrl)) { + return ""; + } + + if (!settings.allow_svg_data_urls && /^data:image\/svg/i.test(scriptUrl)) { + return ""; + } + } + + // Convert the URL to relative/absolute depending on config + if (urlConverter) { + url = urlConverter.call(urlConverterScope, url, 'style'); + } + + // Output new URL format + return "url('" + url.replace(/\'/g, "\\'") + "')"; + } + + if (css) { + css = css.replace(/[\u0000-\u001F]/g, ''); + + // Encode \" \' % and ; and : inside strings so they don't interfere with the style parsing + css = css.replace(/\\[\"\';:\uFEFF]/g, encode).replace(/\"[^\"]+\"|\'[^\']+\'/g, function(str) { + return str.replace(/[;:]/g, encode); + }); + + // Parse styles + while ((matches = styleRegExp.exec(css))) { + name = matches[1].replace(trimRightRegExp, '').toLowerCase(); + value = matches[2].replace(trimRightRegExp, ''); + + // Decode escaped sequences like \65 -> e + /*jshint loopfunc:true*/ + /*eslint no-loop-func:0 */ + value = value.replace(/\\[0-9a-f]+/g, function(e) { + return String.fromCharCode(parseInt(e.substr(1), 16)); + }); + + if (name && value.length > 0) { + // Don't allow behavior name or expression/comments within the values + if (!settings.allow_script_urls && (name == "behavior" || /expression\s*\(|\/\*|\*\//.test(value))) { + continue; + } + + // Opera will produce 700 instead of bold in their style values + if (name === 'font-weight' && value === '700') { + value = 'bold'; + } else if (name === 'color' || name === 'background-color') { // Lowercase colors like RED + value = value.toLowerCase(); + } + + // Convert RGB colors to HEX + value = value.replace(rgbRegExp, toHex); + + // Convert URLs and force them into url('value') format + value = value.replace(urlOrStrRegExp, processUrl); + styles[name] = isEncoded ? decode(value, true) : value; + } + + styleRegExp.lastIndex = matches.index + matches[0].length; + } + // Compress the styles to reduce it's size for example IE will expand styles + compress("border", "", true); + compress("border", "-width"); + compress("border", "-color"); + compress("border", "-style"); + compress("padding", ""); + compress("margin", ""); + compress2('border', 'border-width', 'border-style', 'border-color'); + + // Remove pointless border, IE produces these + if (styles.border === 'medium none') { + delete styles.border; + } + + // IE 11 will produce a border-image: none when getting the style attribute from

    + // So lets asume it shouldn't be there + if (styles['border-image'] === 'none') { + delete styles['border-image']; + } + } + + return styles; + }, + + /** + * Serializes the specified style object into a string. + * + * @method serialize + * @param {Object} styles Object to serialize as string for example: {border: '1px solid red'} + * @param {String} elementName Optional element name, if specified only the styles that matches the schema will be serialized. + * @return {String} String representation of the style object for example: border: 1px solid red. + */ + serialize: function(styles, elementName) { + var css = '', name, value; + + function serializeStyles(name) { + var styleList, i, l, value; + + styleList = validStyles[name]; + if (styleList) { + for (i = 0, l = styleList.length; i < l; i++) { + name = styleList[i]; + value = styles[name]; + + if (value !== undef && value.length > 0) { + css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';'; + } + } + } + } + + function isValid(name, elementName) { + var styleMap; + + styleMap = invalidStyles['*']; + if (styleMap && styleMap[name]) { + return false; + } + + styleMap = invalidStyles[elementName]; + if (styleMap && styleMap[name]) { + return false; + } + + return true; + } + + // Serialize styles according to schema + if (elementName && validStyles) { + // Serialize global styles and element specific styles + serializeStyles('*'); + serializeStyles(elementName); + } else { + // Output the styles in the order they are inside the object + for (name in styles) { + value = styles[name]; + + if (value !== undef && value.length > 0) { + if (!invalidStyles || isValid(name, elementName)) { + css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';'; + } + } + } + } + + return css; + } + }; + }; +}); + +// Included from: js/tinymce/classes/dom/TreeWalker.js + +/** + * TreeWalker.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * TreeWalker class enables you to walk the DOM in a linear manner. + * + * @class tinymce.dom.TreeWalker + * @example + * var walker = new tinymce.dom.TreeWalker(startNode); + * + * do { + * console.log(walker.current()); + * } while (walker.next()); + */ +define("tinymce/dom/TreeWalker", [], function() { + /** + * Constructs a new TreeWalker instance. + * + * @constructor + * @method TreeWalker + * @param {Node} startNode Node to start walking from. + * @param {node} rootNode Optional root node to never walk out of. + */ + return function(startNode, rootNode) { + var node = startNode; + + function findSibling(node, startName, siblingName, shallow) { + var sibling, parent; + + if (node) { + // Walk into nodes if it has a start + if (!shallow && node[startName]) { + return node[startName]; + } + + // Return the sibling if it has one + if (node != rootNode) { + sibling = node[siblingName]; + if (sibling) { + return sibling; + } + + // Walk up the parents to look for siblings + for (parent = node.parentNode; parent && parent != rootNode; parent = parent.parentNode) { + sibling = parent[siblingName]; + if (sibling) { + return sibling; + } + } + } + } + } + + /** + * Returns the current node. + * + * @method current + * @return {Node} Current node where the walker is. + */ + this.current = function() { + return node; + }; + + /** + * Walks to the next node in tree. + * + * @method next + * @return {Node} Current node where the walker is after moving to the next node. + */ + this.next = function(shallow) { + node = findSibling(node, 'firstChild', 'nextSibling', shallow); + return node; + }; + + /** + * Walks to the previous node in tree. + * + * @method prev + * @return {Node} Current node where the walker is after moving to the previous node. + */ + this.prev = function(shallow) { + node = findSibling(node, 'lastChild', 'previousSibling', shallow); + return node; + }; + }; +}); + +// Included from: js/tinymce/classes/dom/Range.js + +/** + * Range.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +define("tinymce/dom/Range", [ + "tinymce/util/Tools" +], function(Tools) { + // Range constructor + function Range(dom) { + var self = this, + doc = dom.doc, + EXTRACT = 0, + CLONE = 1, + DELETE = 2, + TRUE = true, + FALSE = false, + START_OFFSET = 'startOffset', + START_CONTAINER = 'startContainer', + END_CONTAINER = 'endContainer', + END_OFFSET = 'endOffset', + extend = Tools.extend, + nodeIndex = dom.nodeIndex; + + function createDocumentFragment() { + return doc.createDocumentFragment(); + } + + function setStart(n, o) { + _setEndPoint(TRUE, n, o); + } + + function setEnd(n, o) { + _setEndPoint(FALSE, n, o); + } + + function setStartBefore(n) { + setStart(n.parentNode, nodeIndex(n)); + } + + function setStartAfter(n) { + setStart(n.parentNode, nodeIndex(n) + 1); + } + + function setEndBefore(n) { + setEnd(n.parentNode, nodeIndex(n)); + } + + function setEndAfter(n) { + setEnd(n.parentNode, nodeIndex(n) + 1); + } + + function collapse(ts) { + if (ts) { + self[END_CONTAINER] = self[START_CONTAINER]; + self[END_OFFSET] = self[START_OFFSET]; + } else { + self[START_CONTAINER] = self[END_CONTAINER]; + self[START_OFFSET] = self[END_OFFSET]; + } + + self.collapsed = TRUE; + } + + function selectNode(n) { + setStartBefore(n); + setEndAfter(n); + } + + function selectNodeContents(n) { + setStart(n, 0); + setEnd(n, n.nodeType === 1 ? n.childNodes.length : n.nodeValue.length); + } + + function compareBoundaryPoints(h, r) { + var sc = self[START_CONTAINER], so = self[START_OFFSET], ec = self[END_CONTAINER], eo = self[END_OFFSET], + rsc = r.startContainer, rso = r.startOffset, rec = r.endContainer, reo = r.endOffset; + + // Check START_TO_START + if (h === 0) { + return _compareBoundaryPoints(sc, so, rsc, rso); + } + + // Check START_TO_END + if (h === 1) { + return _compareBoundaryPoints(ec, eo, rsc, rso); + } + + // Check END_TO_END + if (h === 2) { + return _compareBoundaryPoints(ec, eo, rec, reo); + } + + // Check END_TO_START + if (h === 3) { + return _compareBoundaryPoints(sc, so, rec, reo); + } + } + + function deleteContents() { + _traverse(DELETE); + } + + function extractContents() { + return _traverse(EXTRACT); + } + + function cloneContents() { + return _traverse(CLONE); + } + + function insertNode(n) { + var startContainer = this[START_CONTAINER], + startOffset = this[START_OFFSET], nn, o; + + // Node is TEXT_NODE or CDATA + if ((startContainer.nodeType === 3 || startContainer.nodeType === 4) && startContainer.nodeValue) { + if (!startOffset) { + // At the start of text + startContainer.parentNode.insertBefore(n, startContainer); + } else if (startOffset >= startContainer.nodeValue.length) { + // At the end of text + dom.insertAfter(n, startContainer); + } else { + // Middle, need to split + nn = startContainer.splitText(startOffset); + startContainer.parentNode.insertBefore(n, nn); + } + } else { + // Insert element node + if (startContainer.childNodes.length > 0) { + o = startContainer.childNodes[startOffset]; + } + + if (o) { + startContainer.insertBefore(n, o); + } else { + if (startContainer.nodeType == 3) { + dom.insertAfter(n, startContainer); + } else { + startContainer.appendChild(n); + } + } + } + } + + function surroundContents(n) { + var f = self.extractContents(); + + self.insertNode(n); + n.appendChild(f); + self.selectNode(n); + } + + function cloneRange() { + return extend(new Range(dom), { + startContainer: self[START_CONTAINER], + startOffset: self[START_OFFSET], + endContainer: self[END_CONTAINER], + endOffset: self[END_OFFSET], + collapsed: self.collapsed, + commonAncestorContainer: self.commonAncestorContainer + }); + } + + // Private methods + + function _getSelectedNode(container, offset) { + var child; + + if (container.nodeType == 3 /* TEXT_NODE */) { + return container; + } + + if (offset < 0) { + return container; + } + + child = container.firstChild; + while (child && offset > 0) { + --offset; + child = child.nextSibling; + } + + if (child) { + return child; + } + + return container; + } + + function _isCollapsed() { + return (self[START_CONTAINER] == self[END_CONTAINER] && self[START_OFFSET] == self[END_OFFSET]); + } + + function _compareBoundaryPoints(containerA, offsetA, containerB, offsetB) { + var c, offsetC, n, cmnRoot, childA, childB; + + // In the first case the boundary-points have the same container. A is before B + // if its offset is less than the offset of B, A is equal to B if its offset is + // equal to the offset of B, and A is after B if its offset is greater than the + // offset of B. + if (containerA == containerB) { + if (offsetA == offsetB) { + return 0; // equal + } + + if (offsetA < offsetB) { + return -1; // before + } + + return 1; // after + } + + // In the second case a child node C of the container of A is an ancestor + // container of B. In this case, A is before B if the offset of A is less than or + // equal to the index of the child node C and A is after B otherwise. + c = containerB; + while (c && c.parentNode != containerA) { + c = c.parentNode; + } + + if (c) { + offsetC = 0; + n = containerA.firstChild; + + while (n != c && offsetC < offsetA) { + offsetC++; + n = n.nextSibling; + } + + if (offsetA <= offsetC) { + return -1; // before + } + + return 1; // after + } + + // In the third case a child node C of the container of B is an ancestor container + // of A. In this case, A is before B if the index of the child node C is less than + // the offset of B and A is after B otherwise. + c = containerA; + while (c && c.parentNode != containerB) { + c = c.parentNode; + } + + if (c) { + offsetC = 0; + n = containerB.firstChild; + + while (n != c && offsetC < offsetB) { + offsetC++; + n = n.nextSibling; + } + + if (offsetC < offsetB) { + return -1; // before + } + + return 1; // after + } + + // In the fourth case, none of three other cases hold: the containers of A and B + // are siblings or descendants of sibling nodes. In this case, A is before B if + // the container of A is before the container of B in a pre-order traversal of the + // Ranges' context tree and A is after B otherwise. + cmnRoot = dom.findCommonAncestor(containerA, containerB); + childA = containerA; + + while (childA && childA.parentNode != cmnRoot) { + childA = childA.parentNode; + } + + if (!childA) { + childA = cmnRoot; + } + + childB = containerB; + while (childB && childB.parentNode != cmnRoot) { + childB = childB.parentNode; + } + + if (!childB) { + childB = cmnRoot; + } + + if (childA == childB) { + return 0; // equal + } + + n = cmnRoot.firstChild; + while (n) { + if (n == childA) { + return -1; // before + } + + if (n == childB) { + return 1; // after + } + + n = n.nextSibling; + } + } + + function _setEndPoint(st, n, o) { + var ec, sc; + + if (st) { + self[START_CONTAINER] = n; + self[START_OFFSET] = o; + } else { + self[END_CONTAINER] = n; + self[END_OFFSET] = o; + } + + // If one boundary-point of a Range is set to have a root container + // other than the current one for the Range, the Range is collapsed to + // the new position. This enforces the restriction that both boundary- + // points of a Range must have the same root container. + ec = self[END_CONTAINER]; + while (ec.parentNode) { + ec = ec.parentNode; + } + + sc = self[START_CONTAINER]; + while (sc.parentNode) { + sc = sc.parentNode; + } + + if (sc == ec) { + // The start position of a Range is guaranteed to never be after the + // end position. To enforce this restriction, if the start is set to + // be at a position after the end, the Range is collapsed to that + // position. + if (_compareBoundaryPoints(self[START_CONTAINER], self[START_OFFSET], self[END_CONTAINER], self[END_OFFSET]) > 0) { + self.collapse(st); + } + } else { + self.collapse(st); + } + + self.collapsed = _isCollapsed(); + self.commonAncestorContainer = dom.findCommonAncestor(self[START_CONTAINER], self[END_CONTAINER]); + } + + function _traverse(how) { + var c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep; + + if (self[START_CONTAINER] == self[END_CONTAINER]) { + return _traverseSameContainer(how); + } + + for (c = self[END_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) { + if (p == self[START_CONTAINER]) { + return _traverseCommonStartContainer(c, how); + } + + ++endContainerDepth; + } + + for (c = self[START_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) { + if (p == self[END_CONTAINER]) { + return _traverseCommonEndContainer(c, how); + } + + ++startContainerDepth; + } + + depthDiff = startContainerDepth - endContainerDepth; + + startNode = self[START_CONTAINER]; + while (depthDiff > 0) { + startNode = startNode.parentNode; + depthDiff--; + } + + endNode = self[END_CONTAINER]; + while (depthDiff < 0) { + endNode = endNode.parentNode; + depthDiff++; + } + + // ascend the ancestor hierarchy until we have a common parent. + for (sp = startNode.parentNode, ep = endNode.parentNode; sp != ep; sp = sp.parentNode, ep = ep.parentNode) { + startNode = sp; + endNode = ep; + } + + return _traverseCommonAncestors(startNode, endNode, how); + } + + function _traverseSameContainer(how) { + var frag, s, sub, n, cnt, sibling, xferNode, start, len; + + if (how != DELETE) { + frag = createDocumentFragment(); + } + + // If selection is empty, just return the fragment + if (self[START_OFFSET] == self[END_OFFSET]) { + return frag; + } + + // Text node needs special case handling + if (self[START_CONTAINER].nodeType == 3 /* TEXT_NODE */) { + // get the substring + s = self[START_CONTAINER].nodeValue; + sub = s.substring(self[START_OFFSET], self[END_OFFSET]); + + // set the original text node to its new value + if (how != CLONE) { + n = self[START_CONTAINER]; + start = self[START_OFFSET]; + len = self[END_OFFSET] - self[START_OFFSET]; + + if (start === 0 && len >= n.nodeValue.length - 1) { + n.parentNode.removeChild(n); + } else { + n.deleteData(start, len); + } + + // Nothing is partially selected, so collapse to start point + self.collapse(TRUE); + } + + if (how == DELETE) { + return; + } + + if (sub.length > 0) { + frag.appendChild(doc.createTextNode(sub)); + } + + return frag; + } + + // Copy nodes between the start/end offsets. + n = _getSelectedNode(self[START_CONTAINER], self[START_OFFSET]); + cnt = self[END_OFFSET] - self[START_OFFSET]; + + while (n && cnt > 0) { + sibling = n.nextSibling; + xferNode = _traverseFullySelected(n, how); + + if (frag) { + frag.appendChild(xferNode); + } + + --cnt; + n = sibling; + } + + // Nothing is partially selected, so collapse to start point + if (how != CLONE) { + self.collapse(TRUE); + } + + return frag; + } + + function _traverseCommonStartContainer(endAncestor, how) { + var frag, n, endIdx, cnt, sibling, xferNode; + + if (how != DELETE) { + frag = createDocumentFragment(); + } + + n = _traverseRightBoundary(endAncestor, how); + + if (frag) { + frag.appendChild(n); + } + + endIdx = nodeIndex(endAncestor); + cnt = endIdx - self[START_OFFSET]; + + if (cnt <= 0) { + // Collapse to just before the endAncestor, which + // is partially selected. + if (how != CLONE) { + self.setEndBefore(endAncestor); + self.collapse(FALSE); + } + + return frag; + } + + n = endAncestor.previousSibling; + while (cnt > 0) { + sibling = n.previousSibling; + xferNode = _traverseFullySelected(n, how); + + if (frag) { + frag.insertBefore(xferNode, frag.firstChild); + } + + --cnt; + n = sibling; + } + + // Collapse to just before the endAncestor, which + // is partially selected. + if (how != CLONE) { + self.setEndBefore(endAncestor); + self.collapse(FALSE); + } + + return frag; + } + + function _traverseCommonEndContainer(startAncestor, how) { + var frag, startIdx, n, cnt, sibling, xferNode; + + if (how != DELETE) { + frag = createDocumentFragment(); + } + + n = _traverseLeftBoundary(startAncestor, how); + if (frag) { + frag.appendChild(n); + } + + startIdx = nodeIndex(startAncestor); + ++startIdx; // Because we already traversed it + + cnt = self[END_OFFSET] - startIdx; + n = startAncestor.nextSibling; + while (n && cnt > 0) { + sibling = n.nextSibling; + xferNode = _traverseFullySelected(n, how); + + if (frag) { + frag.appendChild(xferNode); + } + + --cnt; + n = sibling; + } + + if (how != CLONE) { + self.setStartAfter(startAncestor); + self.collapse(TRUE); + } + + return frag; + } + + function _traverseCommonAncestors(startAncestor, endAncestor, how) { + var n, frag, startOffset, endOffset, cnt, sibling, nextSibling; + + if (how != DELETE) { + frag = createDocumentFragment(); + } + + n = _traverseLeftBoundary(startAncestor, how); + if (frag) { + frag.appendChild(n); + } + + startOffset = nodeIndex(startAncestor); + endOffset = nodeIndex(endAncestor); + ++startOffset; + + cnt = endOffset - startOffset; + sibling = startAncestor.nextSibling; + + while (cnt > 0) { + nextSibling = sibling.nextSibling; + n = _traverseFullySelected(sibling, how); + + if (frag) { + frag.appendChild(n); + } + + sibling = nextSibling; + --cnt; + } + + n = _traverseRightBoundary(endAncestor, how); + + if (frag) { + frag.appendChild(n); + } + + if (how != CLONE) { + self.setStartAfter(startAncestor); + self.collapse(TRUE); + } + + return frag; + } + + function _traverseRightBoundary(root, how) { + var next = _getSelectedNode(self[END_CONTAINER], self[END_OFFSET] - 1), parent, clonedParent; + var prevSibling, clonedChild, clonedGrandParent, isFullySelected = next != self[END_CONTAINER]; + + if (next == root) { + return _traverseNode(next, isFullySelected, FALSE, how); + } + + parent = next.parentNode; + clonedParent = _traverseNode(parent, FALSE, FALSE, how); + + while (parent) { + while (next) { + prevSibling = next.previousSibling; + clonedChild = _traverseNode(next, isFullySelected, FALSE, how); + + if (how != DELETE) { + clonedParent.insertBefore(clonedChild, clonedParent.firstChild); + } + + isFullySelected = TRUE; + next = prevSibling; + } + + if (parent == root) { + return clonedParent; + } + + next = parent.previousSibling; + parent = parent.parentNode; + + clonedGrandParent = _traverseNode(parent, FALSE, FALSE, how); + + if (how != DELETE) { + clonedGrandParent.appendChild(clonedParent); + } + + clonedParent = clonedGrandParent; + } + } + + function _traverseLeftBoundary(root, how) { + var next = _getSelectedNode(self[START_CONTAINER], self[START_OFFSET]), isFullySelected = next != self[START_CONTAINER]; + var parent, clonedParent, nextSibling, clonedChild, clonedGrandParent; + + if (next == root) { + return _traverseNode(next, isFullySelected, TRUE, how); + } + + parent = next.parentNode; + clonedParent = _traverseNode(parent, FALSE, TRUE, how); + + while (parent) { + while (next) { + nextSibling = next.nextSibling; + clonedChild = _traverseNode(next, isFullySelected, TRUE, how); + + if (how != DELETE) { + clonedParent.appendChild(clonedChild); + } + + isFullySelected = TRUE; + next = nextSibling; + } + + if (parent == root) { + return clonedParent; + } + + next = parent.nextSibling; + parent = parent.parentNode; + + clonedGrandParent = _traverseNode(parent, FALSE, TRUE, how); + + if (how != DELETE) { + clonedGrandParent.appendChild(clonedParent); + } + + clonedParent = clonedGrandParent; + } + } + + function _traverseNode(n, isFullySelected, isLeft, how) { + var txtValue, newNodeValue, oldNodeValue, offset, newNode; + + if (isFullySelected) { + return _traverseFullySelected(n, how); + } + + if (n.nodeType == 3 /* TEXT_NODE */) { + txtValue = n.nodeValue; + + if (isLeft) { + offset = self[START_OFFSET]; + newNodeValue = txtValue.substring(offset); + oldNodeValue = txtValue.substring(0, offset); + } else { + offset = self[END_OFFSET]; + newNodeValue = txtValue.substring(0, offset); + oldNodeValue = txtValue.substring(offset); + } + + if (how != CLONE) { + n.nodeValue = oldNodeValue; + } + + if (how == DELETE) { + return; + } + + newNode = dom.clone(n, FALSE); + newNode.nodeValue = newNodeValue; + + return newNode; + } + + if (how == DELETE) { + return; + } + + return dom.clone(n, FALSE); + } + + function _traverseFullySelected(n, how) { + if (how != DELETE) { + return how == CLONE ? dom.clone(n, TRUE) : n; + } + + n.parentNode.removeChild(n); + } + + function toStringIE() { + return dom.create('body', null, cloneContents()).outerText; + } + + extend(self, { + // Inital states + startContainer: doc, + startOffset: 0, + endContainer: doc, + endOffset: 0, + collapsed: TRUE, + commonAncestorContainer: doc, + + // Range constants + START_TO_START: 0, + START_TO_END: 1, + END_TO_END: 2, + END_TO_START: 3, + + // Public methods + setStart: setStart, + setEnd: setEnd, + setStartBefore: setStartBefore, + setStartAfter: setStartAfter, + setEndBefore: setEndBefore, + setEndAfter: setEndAfter, + collapse: collapse, + selectNode: selectNode, + selectNodeContents: selectNodeContents, + compareBoundaryPoints: compareBoundaryPoints, + deleteContents: deleteContents, + extractContents: extractContents, + cloneContents: cloneContents, + insertNode: insertNode, + surroundContents: surroundContents, + cloneRange: cloneRange, + toStringIE: toStringIE + }); + + return self; + } + + // Older IE versions doesn't let you override toString by it's constructor so we have to stick it in the prototype + Range.prototype.toString = function() { + return this.toStringIE(); + }; + + return Range; +}); + +// Included from: js/tinymce/classes/html/Entities.js + +/** + * Entities.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*jshint bitwise:false */ +/*eslint no-bitwise:0 */ + +/** + * Entity encoder class. + * + * @class tinymce.html.Entities + * @static + * @version 3.4 + */ +define("tinymce/html/Entities", [ + "tinymce/util/Tools" +], function(Tools) { + var makeMap = Tools.makeMap; + + var namedEntities, baseEntities, reverseEntities, + attrsCharsRegExp = /[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + textCharsRegExp = /[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + rawCharsRegExp = /[<>&\"\']/g, + entityRegExp = /&#([a-z0-9]+);?|&([a-z0-9]+);/gi, + asciiMap = { + 128: "\u20AC", 130: "\u201A", 131: "\u0192", 132: "\u201E", 133: "\u2026", 134: "\u2020", + 135: "\u2021", 136: "\u02C6", 137: "\u2030", 138: "\u0160", 139: "\u2039", 140: "\u0152", + 142: "\u017D", 145: "\u2018", 146: "\u2019", 147: "\u201C", 148: "\u201D", 149: "\u2022", + 150: "\u2013", 151: "\u2014", 152: "\u02DC", 153: "\u2122", 154: "\u0161", 155: "\u203A", + 156: "\u0153", 158: "\u017E", 159: "\u0178" + }; + + // Raw entities + baseEntities = { + '\"': '"', // Needs to be escaped since the YUI compressor would otherwise break the code + "'": ''', + '<': '<', + '>': '>', + '&': '&', + '\u0060': '`' + }; + + // Reverse lookup table for raw entities + reverseEntities = { + '<': '<', + '>': '>', + '&': '&', + '"': '"', + ''': "'" + }; + + // Decodes text by using the browser + function nativeDecode(text) { + var elm; + + elm = document.createElement("div"); + elm.innerHTML = text; + + return elm.textContent || elm.innerText || text; + } + + // Build a two way lookup table for the entities + function buildEntitiesLookup(items, radix) { + var i, chr, entity, lookup = {}; + + if (items) { + items = items.split(','); + radix = radix || 10; + + // Build entities lookup table + for (i = 0; i < items.length; i += 2) { + chr = String.fromCharCode(parseInt(items[i], radix)); + + // Only add non base entities + if (!baseEntities[chr]) { + entity = '&' + items[i + 1] + ';'; + lookup[chr] = entity; + lookup[entity] = chr; + } + } + + return lookup; + } + } + + // Unpack entities lookup where the numbers are in radix 32 to reduce the size + namedEntities = buildEntitiesLookup( + '50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' + + '5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' + + '5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' + + '5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' + + '68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' + + '6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' + + '6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' + + '75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' + + '7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' + + '7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' + + 'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' + + 'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' + + 't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' + + 'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' + + 'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' + + '81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' + + '8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' + + '8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' + + '8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' + + '8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' + + 'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' + + 'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' + + 'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' + + '80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' + + '811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32); + + var Entities = { + /** + * Encodes the specified string using raw entities. This means only the required XML base entities will be endoded. + * + * @method encodeRaw + * @param {String} text Text to encode. + * @param {Boolean} attr Optional flag to specify if the text is attribute contents. + * @return {String} Entity encoded text. + */ + encodeRaw: function(text, attr) { + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { + return baseEntities[chr] || chr; + }); + }, + + /** + * Encoded the specified text with both the attributes and text entities. This function will produce larger text contents + * since it doesn't know if the context is within a attribute or text node. This was added for compatibility + * and is exposed as the DOMUtils.encode function. + * + * @method encodeAllRaw + * @param {String} text Text to encode. + * @return {String} Entity encoded text. + */ + encodeAllRaw: function(text) { + return ('' + text).replace(rawCharsRegExp, function(chr) { + return baseEntities[chr] || chr; + }); + }, + + /** + * Encodes the specified string using numeric entities. The core entities will be + * encoded as named ones but all non lower ascii characters will be encoded into numeric entities. + * + * @method encodeNumeric + * @param {String} text Text to encode. + * @param {Boolean} attr Optional flag to specify if the text is attribute contents. + * @return {String} Entity encoded text. + */ + encodeNumeric: function(text, attr) { + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { + // Multi byte sequence convert it to a single entity + if (chr.length > 1) { + return '&#' + (((chr.charCodeAt(0) - 0xD800) * 0x400) + (chr.charCodeAt(1) - 0xDC00) + 0x10000) + ';'; + } + + return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';'; + }); + }, + + /** + * Encodes the specified string using named entities. The core entities will be encoded + * as named ones but all non lower ascii characters will be encoded into named entities. + * + * @method encodeNamed + * @param {String} text Text to encode. + * @param {Boolean} attr Optional flag to specify if the text is attribute contents. + * @param {Object} entities Optional parameter with entities to use. + * @return {String} Entity encoded text. + */ + encodeNamed: function(text, attr, entities) { + entities = entities || namedEntities; + + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { + return baseEntities[chr] || entities[chr] || chr; + }); + }, + + /** + * Returns an encode function based on the name(s) and it's optional entities. + * + * @method getEncodeFunc + * @param {String} name Comma separated list of encoders for example named,numeric. + * @param {String} entities Optional parameter with entities to use instead of the built in set. + * @return {function} Encode function to be used. + */ + getEncodeFunc: function(name, entities) { + entities = buildEntitiesLookup(entities) || namedEntities; + + function encodeNamedAndNumeric(text, attr) { + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { + return baseEntities[chr] || entities[chr] || '&#' + chr.charCodeAt(0) + ';' || chr; + }); + } + + function encodeCustomNamed(text, attr) { + return Entities.encodeNamed(text, attr, entities); + } + + // Replace + with , to be compatible with previous TinyMCE versions + name = makeMap(name.replace(/\+/g, ',')); + + // Named and numeric encoder + if (name.named && name.numeric) { + return encodeNamedAndNumeric; + } + + // Named encoder + if (name.named) { + // Custom names + if (entities) { + return encodeCustomNamed; + } + + return Entities.encodeNamed; + } + + // Numeric + if (name.numeric) { + return Entities.encodeNumeric; + } + + // Raw encoder + return Entities.encodeRaw; + }, + + /** + * Decodes the specified string, this will replace entities with raw UTF characters. + * + * @method decode + * @param {String} text Text to entity decode. + * @return {String} Entity decoded string. + */ + decode: function(text) { + return text.replace(entityRegExp, function(all, numeric) { + if (numeric) { + if (numeric.charAt(0).toLowerCase() === 'x') { + numeric = parseInt(numeric.substr(1), 16); + } else { + numeric = parseInt(numeric, 10); + } + + // Support upper UTF + if (numeric > 0xFFFF) { + numeric -= 0x10000; + + return String.fromCharCode(0xD800 + (numeric >> 10), 0xDC00 + (numeric & 0x3FF)); + } else { + return asciiMap[numeric] || String.fromCharCode(numeric); + } + } + + return reverseEntities[all] || namedEntities[all] || nativeDecode(all); + }); + } + }; + + return Entities; +}); + +// Included from: js/tinymce/classes/dom/StyleSheetLoader.js + +/** + * StyleSheetLoader.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles loading of external stylesheets and fires events when these are loaded. + * + * @class tinymce.dom.StyleSheetLoader + * @private + */ +define("tinymce/dom/StyleSheetLoader", [ + "tinymce/util/Tools" +], function(Tools) { + "use strict"; + + return function(document, settings) { + var idCount = 0, loadedStates = {}, maxLoadTime; + + settings = settings || {}; + maxLoadTime = settings.maxLoadTime || 5000; + + function appendToHead(node) { + document.getElementsByTagName('head')[0].appendChild(node); + } + + /** + * Loads the specified css style sheet file and call the loadedCallback once it's finished loading. + * + * @method load + * @param {String} url Url to be loaded. + * @param {Function} loadedCallback Callback to be executed when loaded. + * @param {Function} errorCallback Callback to be executed when failed loading. + */ + function load(url, loadedCallback, errorCallback) { + var link, style, startTime, state; + + function passed() { + var callbacks = state.passed, i = callbacks.length; + + while (i--) { + callbacks[i](); + } + + state.status = 2; + state.passed = []; + state.failed = []; + } + + function failed() { + var callbacks = state.failed, i = callbacks.length; + + while (i--) { + callbacks[i](); + } + + state.status = 3; + state.passed = []; + state.failed = []; + } + + // Sniffs for older WebKit versions that have the link.onload but a broken one + function isOldWebKit() { + var webKitChunks = navigator.userAgent.match(/WebKit\/(\d*)/); + return !!(webKitChunks && webKitChunks[1] < 536); + } + + // Calls the waitCallback until the test returns true or the timeout occurs + function wait(testCallback, waitCallback) { + if (!testCallback()) { + // Wait for timeout + if ((new Date().getTime()) - startTime < maxLoadTime) { + window.setTimeout(waitCallback, 0); + } else { + failed(); + } + } + } + + // Workaround for WebKit that doesn't properly support the onload event for link elements + // Or WebKit that fires the onload event before the StyleSheet is added to the document + function waitForWebKitLinkLoaded() { + wait(function() { + var styleSheets = document.styleSheets, styleSheet, i = styleSheets.length, owner; + + while (i--) { + styleSheet = styleSheets[i]; + owner = styleSheet.ownerNode ? styleSheet.ownerNode : styleSheet.owningElement; + if (owner && owner.id === link.id) { + passed(); + return true; + } + } + }, waitForWebKitLinkLoaded); + } + + // Workaround for older Geckos that doesn't have any onload event for StyleSheets + function waitForGeckoLinkLoaded() { + wait(function() { + try { + // Accessing the cssRules will throw an exception until the CSS file is loaded + var cssRules = style.sheet.cssRules; + passed(); + return !!cssRules; + } catch (ex) { + // Ignore + } + }, waitForGeckoLinkLoaded); + } + + url = Tools._addCacheSuffix(url); + + if (!loadedStates[url]) { + state = { + passed: [], + failed: [] + }; + + loadedStates[url] = state; + } else { + state = loadedStates[url]; + } + + if (loadedCallback) { + state.passed.push(loadedCallback); + } + + if (errorCallback) { + state.failed.push(errorCallback); + } + + // Is loading wait for it to pass + if (state.status == 1) { + return; + } + + // Has finished loading and was success + if (state.status == 2) { + passed(); + return; + } + + // Has finished loading and was a failure + if (state.status == 3) { + failed(); + return; + } + + // Start loading + state.status = 1; + link = document.createElement('link'); + link.rel = 'stylesheet'; + link.type = 'text/css'; + link.id = 'u' + (idCount++); + link.async = false; + link.defer = false; + startTime = new Date().getTime(); + + // Feature detect onload on link element and sniff older webkits since it has an broken onload event + if ("onload" in link && !isOldWebKit()) { + link.onload = waitForWebKitLinkLoaded; + link.onerror = failed; + } else { + // Sniff for old Firefox that doesn't support the onload event on link elements + // TODO: Remove this in the future when everyone uses modern browsers + if (navigator.userAgent.indexOf("Firefox") > 0) { + style = document.createElement('style'); + style.textContent = '@import "' + url + '"'; + waitForGeckoLinkLoaded(); + appendToHead(style); + return; + } else { + // Use the id owner on older webkits + waitForWebKitLinkLoaded(); + } + } + + appendToHead(link); + link.href = url; + } + + this.load = load; + }; +}); + +// Included from: js/tinymce/classes/dom/DOMUtils.js + +/** + * DOMUtils.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Utility class for various DOM manipulation and retrieval functions. + * + * @class tinymce.dom.DOMUtils + * @example + * // Add a class to an element by id in the page + * tinymce.DOM.addClass('someid', 'someclass'); + * + * // Add a class to an element by id inside the editor + * tinymce.activeEditor.dom.addClass('someid', 'someclass'); + */ +define("tinymce/dom/DOMUtils", [ + "tinymce/dom/Sizzle", + "tinymce/dom/DomQuery", + "tinymce/html/Styles", + "tinymce/dom/EventUtils", + "tinymce/dom/TreeWalker", + "tinymce/dom/Range", + "tinymce/html/Entities", + "tinymce/Env", + "tinymce/util/Tools", + "tinymce/dom/StyleSheetLoader" +], function(Sizzle, $, Styles, EventUtils, TreeWalker, Range, Entities, Env, Tools, StyleSheetLoader) { + // Shorten names + var each = Tools.each, is = Tools.is, grep = Tools.grep, trim = Tools.trim; + var isIE = Env.ie; + var simpleSelectorRe = /^([a-z0-9],?)+$/i; + var whiteSpaceRegExp = /^[ \t\r\n]*$/; + + function setupAttrHooks(domUtils, settings) { + var attrHooks = {}, keepValues = settings.keep_values, keepUrlHook; + + keepUrlHook = { + set: function($elm, value, name) { + if (settings.url_converter) { + value = settings.url_converter.call(settings.url_converter_scope || domUtils, value, name, $elm[0]); + } + + $elm.attr('data-mce-' + name, value).attr(name, value); + }, + + get: function($elm, name) { + return $elm.attr('data-mce-' + name) || $elm.attr(name); + } + }; + + attrHooks = { + style: { + set: function($elm, value) { + if (value !== null && typeof value === 'object') { + $elm.css(value); + return; + } + + if (keepValues) { + $elm.attr('data-mce-style', value); + } + + $elm.attr('style', value); + }, + + get: function($elm) { + var value = $elm.attr('data-mce-style') || $elm.attr('style'); + + value = domUtils.serializeStyle(domUtils.parseStyle(value), $elm[0].nodeName); + + return value; + } + } + }; + + if (keepValues) { + attrHooks.href = attrHooks.src = keepUrlHook; + } + + return attrHooks; + } + + /** + * Constructs a new DOMUtils instance. Consult the Wiki for more details on settings etc for this class. + * + * @constructor + * @method DOMUtils + * @param {Document} d Document reference to bind the utility class to. + * @param {settings} s Optional settings collection. + */ + function DOMUtils(doc, settings) { + var self = this, blockElementsMap; + + self.doc = doc; + self.win = window; + self.files = {}; + self.counter = 0; + self.stdMode = !isIE || doc.documentMode >= 8; + self.boxModel = !isIE || doc.compatMode == "CSS1Compat" || self.stdMode; + self.styleSheetLoader = new StyleSheetLoader(doc); + self.boundEvents = []; + self.settings = settings = settings || {}; + self.schema = settings.schema; + self.styles = new Styles({ + url_converter: settings.url_converter, + url_converter_scope: settings.url_converter_scope + }, settings.schema); + + self.fixDoc(doc); + self.events = settings.ownEvents ? new EventUtils(settings.proxy) : EventUtils.Event; + self.attrHooks = setupAttrHooks(self, settings); + blockElementsMap = settings.schema ? settings.schema.getBlockElements() : {}; + self.$ = $.overrideDefaults(function() { + return { + context: doc, + element: self.getRoot() + }; + }); + + /** + * Returns true/false if the specified element is a block element or not. + * + * @method isBlock + * @param {Node/String} node Element/Node to check. + * @return {Boolean} True/False state if the node is a block element or not. + */ + self.isBlock = function(node) { + // Fix for #5446 + if (!node) { + return false; + } + + // This function is called in module pattern style since it might be executed with the wrong this scope + var type = node.nodeType; + + // If it's a node then check the type and use the nodeName + if (type) { + return !!(type === 1 && blockElementsMap[node.nodeName]); + } + + return !!blockElementsMap[node]; + }; + } + + DOMUtils.prototype = { + $$: function(elm) { + if (typeof elm == 'string') { + elm = this.get(elm); + } + + return this.$(elm); + }, + + root: null, + + fixDoc: function(doc) { + var settings = this.settings, name; + + if (isIE && settings.schema) { + // Add missing HTML 4/5 elements to IE + ('abbr article aside audio canvas ' + + 'details figcaption figure footer ' + + 'header hgroup mark menu meter nav ' + + 'output progress section summary ' + + 'time video').replace(/\w+/g, function(name) { + doc.createElement(name); + }); + + // Create all custom elements + for (name in settings.schema.getCustomElements()) { + doc.createElement(name); + } + } + }, + + clone: function(node, deep) { + var self = this, clone, doc; + + // TODO: Add feature detection here in the future + if (!isIE || node.nodeType !== 1 || deep) { + return node.cloneNode(deep); + } + + doc = self.doc; + + // Make a HTML5 safe shallow copy + if (!deep) { + clone = doc.createElement(node.nodeName); + + // Copy attribs + each(self.getAttribs(node), function(attr) { + self.setAttrib(clone, attr.nodeName, self.getAttrib(node, attr.nodeName)); + }); + + return clone; + } + + return clone.firstChild; + }, + + /** + * Returns the root node of the document. This is normally the body but might be a DIV. Parents like getParent will not + * go above the point of this root node. + * + * @method getRoot + * @return {Element} Root element for the utility class. + */ + getRoot: function() { + var self = this; + + return self.settings.root_element || self.doc.body; + }, + + /** + * Returns the viewport of the window. + * + * @method getViewPort + * @param {Window} win Optional window to get viewport of. + * @return {Object} Viewport object with fields x, y, w and h. + */ + getViewPort: function(win) { + var doc, rootElm; + + win = !win ? this.win : win; + doc = win.document; + rootElm = this.boxModel ? doc.documentElement : doc.body; + + // Returns viewport size excluding scrollbars + return { + x: win.pageXOffset || rootElm.scrollLeft, + y: win.pageYOffset || rootElm.scrollTop, + w: win.innerWidth || rootElm.clientWidth, + h: win.innerHeight || rootElm.clientHeight + }; + }, + + /** + * Returns the rectangle for a specific element. + * + * @method getRect + * @param {Element/String} elm Element object or element ID to get rectangle from. + * @return {object} Rectangle for specified element object with x, y, w, h fields. + */ + getRect: function(elm) { + var self = this, pos, size; + + elm = self.get(elm); + pos = self.getPos(elm); + size = self.getSize(elm); + + return { + x: pos.x, y: pos.y, + w: size.w, h: size.h + }; + }, + + /** + * Returns the size dimensions of the specified element. + * + * @method getSize + * @param {Element/String} elm Element object or element ID to get rectangle from. + * @return {object} Rectangle for specified element object with w, h fields. + */ + getSize: function(elm) { + var self = this, w, h; + + elm = self.get(elm); + w = self.getStyle(elm, 'width'); + h = self.getStyle(elm, 'height'); + + // Non pixel value, then force offset/clientWidth + if (w.indexOf('px') === -1) { + w = 0; + } + + // Non pixel value, then force offset/clientWidth + if (h.indexOf('px') === -1) { + h = 0; + } + + return { + w: parseInt(w, 10) || elm.offsetWidth || elm.clientWidth, + h: parseInt(h, 10) || elm.offsetHeight || elm.clientHeight + }; + }, + + /** + * Returns a node by the specified selector function. This function will + * loop through all parent nodes and call the specified function for each node. + * If the function then returns true indicating that it has found what it was looking for, the loop execution will then end + * and the node it found will be returned. + * + * @method getParent + * @param {Node/String} node DOM node to search parents on or ID string. + * @param {function} selector Selection function or CSS selector to execute on each node. + * @param {Node} root Optional root element, never go below this point. + * @return {Node} DOM Node or null if it wasn't found. + */ + getParent: function(node, selector, root) { + return this.getParents(node, selector, root, false); + }, + + /** + * Returns a node list of all parents matching the specified selector function or pattern. + * If the function then returns true indicating that it has found what it was looking for and that node will be collected. + * + * @method getParents + * @param {Node/String} node DOM node to search parents on or ID string. + * @param {function} selector Selection function to execute on each node or CSS pattern. + * @param {Node} root Optional root element, never go below this point. + * @return {Array} Array of nodes or null if it wasn't found. + */ + getParents: function(node, selector, root, collect) { + var self = this, selectorVal, result = []; + + node = self.get(node); + collect = collect === undefined; + + // Default root on inline mode + root = root || (self.getRoot().nodeName != 'BODY' ? self.getRoot().parentNode : null); + + // Wrap node name as func + if (is(selector, 'string')) { + selectorVal = selector; + + if (selector === '*') { + selector = function(node) { + return node.nodeType == 1; + }; + } else { + selector = function(node) { + return self.is(node, selectorVal); + }; + } + } + + while (node) { + if (node == root || !node.nodeType || node.nodeType === 9) { + break; + } + + if (!selector || selector(node)) { + if (collect) { + result.push(node); + } else { + return node; + } + } + + node = node.parentNode; + } + + return collect ? result : null; + }, + + /** + * Returns the specified element by ID or the input element if it isn't a string. + * + * @method get + * @param {String/Element} n Element id to look for or element to just pass though. + * @return {Element} Element matching the specified id or null if it wasn't found. + */ + get: function(elm) { + var name; + + if (elm && this.doc && typeof elm == 'string') { + name = elm; + elm = this.doc.getElementById(elm); + + // IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick + if (elm && elm.id !== name) { + return this.doc.getElementsByName(name)[1]; + } + } + + return elm; + }, + + /** + * Returns the next node that matches selector or function + * + * @method getNext + * @param {Node} node Node to find siblings from. + * @param {String/function} selector Selector CSS expression or function. + * @return {Node} Next node item matching the selector or null if it wasn't found. + */ + getNext: function(node, selector) { + return this._findSib(node, selector, 'nextSibling'); + }, + + /** + * Returns the previous node that matches selector or function + * + * @method getPrev + * @param {Node} node Node to find siblings from. + * @param {String/function} selector Selector CSS expression or function. + * @return {Node} Previous node item matching the selector or null if it wasn't found. + */ + getPrev: function(node, selector) { + return this._findSib(node, selector, 'previousSibling'); + }, + + // #ifndef jquery + + /** + * Selects specific elements by a CSS level 3 pattern. For example "div#a1 p.test". + * This function is optimized for the most common patterns needed in TinyMCE but it also performs well enough + * on more complex patterns. + * + * @method select + * @param {String} selector CSS level 3 pattern to select/find elements by. + * @param {Object} scope Optional root element/scope element to search in. + * @return {Array} Array with all matched elements. + * @example + * // Adds a class to all paragraphs in the currently active editor + * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'someclass'); + * + * // Adds a class to all spans that have the test class in the currently active editor + * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('span.test'), 'someclass') + */ + select: function(selector, scope) { + var self = this; + + /*eslint new-cap:0 */ + return Sizzle(selector, self.get(scope) || self.settings.root_element || self.doc, []); + }, + + /** + * Returns true/false if the specified element matches the specified css pattern. + * + * @method is + * @param {Node/NodeList} elm DOM node to match or an array of nodes to match. + * @param {String} selector CSS pattern to match the element against. + */ + is: function(elm, selector) { + var i; + + // If it isn't an array then try to do some simple selectors instead of Sizzle for to boost performance + if (elm.length === undefined) { + // Simple all selector + if (selector === '*') { + return elm.nodeType == 1; + } + + // Simple selector just elements + if (simpleSelectorRe.test(selector)) { + selector = selector.toLowerCase().split(/,/); + elm = elm.nodeName.toLowerCase(); + + for (i = selector.length - 1; i >= 0; i--) { + if (selector[i] == elm) { + return true; + } + } + + return false; + } + } + + // Is non element + if (elm.nodeType && elm.nodeType != 1) { + return false; + } + + var elms = elm.nodeType ? [elm] : elm; + + /*eslint new-cap:0 */ + return Sizzle(selector, elms[0].ownerDocument || elms[0], null, elms).length > 0; + }, + + // #endif + + /** + * Adds the specified element to another element or elements. + * + * @method add + * @param {String/Element/Array} parentElm Element id string, DOM node element or array of ids or elements to add to. + * @param {String/Element} name Name of new element to add or existing element to add. + * @param {Object} attrs Optional object collection with arguments to add to the new element(s). + * @param {String} html Optional inner HTML contents to add for each element. + * @return {Element/Array} Element that got created, or an array of created elements if multiple input elements + * were passed in. + * @example + * // Adds a new paragraph to the end of the active editor + * tinymce.activeEditor.dom.add(tinymce.activeEditor.getBody(), 'p', {title: 'my title'}, 'Some content'); + */ + add: function(parentElm, name, attrs, html, create) { + var self = this; + + return this.run(parentElm, function(parentElm) { + var newElm; + + newElm = is(name, 'string') ? self.doc.createElement(name) : name; + self.setAttribs(newElm, attrs); + + if (html) { + if (html.nodeType) { + newElm.appendChild(html); + } else { + self.setHTML(newElm, html); + } + } + + return !create ? parentElm.appendChild(newElm) : newElm; + }); + }, + + /** + * Creates a new element. + * + * @method create + * @param {String} name Name of new element. + * @param {Object} attrs Optional object name/value collection with element attributes. + * @param {String} html Optional HTML string to set as inner HTML of the element. + * @return {Element} HTML DOM node element that got created. + * @example + * // Adds an element where the caret/selection is in the active editor + * var el = tinymce.activeEditor.dom.create('div', {id: 'test', 'class': 'myclass'}, 'some content'); + * tinymce.activeEditor.selection.setNode(el); + */ + create: function(name, attrs, html) { + return this.add(this.doc.createElement(name), name, attrs, html, 1); + }, + + /** + * Creates HTML string for element. The element will be closed unless an empty inner HTML string is passed in. + * + * @method createHTML + * @param {String} name Name of new element. + * @param {Object} attrs Optional object name/value collection with element attributes. + * @param {String} html Optional HTML string to set as inner HTML of the element. + * @return {String} String with new HTML element, for example: test. + * @example + * // Creates a html chunk and inserts it at the current selection/caret location + * tinymce.activeEditor.selection.setContent(tinymce.activeEditor.dom.createHTML('a', {href: 'test.html'}, 'some line')); + */ + createHTML: function(name, attrs, html) { + var outHtml = '', key; + + outHtml += '<' + name; + + for (key in attrs) { + if (attrs.hasOwnProperty(key) && attrs[key] !== null && typeof attrs[key] != 'undefined') { + outHtml += ' ' + key + '="' + this.encode(attrs[key]) + '"'; + } + } + + // A call to tinymce.is doesn't work for some odd reason on IE9 possible bug inside their JS runtime + if (typeof html != "undefined") { + return outHtml + '>' + html + ''; + } + + return outHtml + ' />'; + }, + + /** + * Creates a document fragment out of the specified HTML string. + * + * @method createFragment + * @param {String} html Html string to create fragment from. + * @return {DocumentFragment} Document fragment node. + */ + createFragment: function(html) { + var frag, node, doc = this.doc, container; + + container = doc.createElement("div"); + frag = doc.createDocumentFragment(); + + if (html) { + container.innerHTML = html; + } + + while ((node = container.firstChild)) { + frag.appendChild(node); + } + + return frag; + }, + + /** + * Removes/deletes the specified element(s) from the DOM. + * + * @method remove + * @param {String/Element/Array} node ID of element or DOM element object or array containing multiple elements/ids. + * @param {Boolean} keepChildren Optional state to keep children or not. If set to true all children will be + * placed at the location of the removed element. + * @return {Element/Array} HTML DOM element that got removed, or an array of removed elements if multiple input elements + * were passed in. + * @example + * // Removes all paragraphs in the active editor + * tinymce.activeEditor.dom.remove(tinymce.activeEditor.dom.select('p')); + * + * // Removes an element by id in the document + * tinymce.DOM.remove('mydiv'); + */ + remove: function(node, keepChildren) { + node = this.$$(node); + + if (keepChildren) { + node.each(function() { + var child; + + while ((child = this.firstChild)) { + if (child.nodeType == 3 && child.data.length === 0) { + this.removeChild(child); + } else { + this.parentNode.insertBefore(child, this); + } + } + }).remove(); + } else { + node.remove(); + } + + return node.length > 1 ? node.toArray() : node[0]; + }, + + /** + * Sets the CSS style value on a HTML element. The name can be a camelcase string + * or the CSS style name like background-color. + * + * @method setStyle + * @param {String/Element/Array} n HTML element/Element ID or Array of elements/ids to set CSS style value on. + * @param {String} na Name of the style value to set. + * @param {String} v Value to set on the style. + * @example + * // Sets a style value on all paragraphs in the currently active editor + * tinymce.activeEditor.dom.setStyle(tinymce.activeEditor.dom.select('p'), 'background-color', 'red'); + * + * // Sets a style value to an element by id in the current document + * tinymce.DOM.setStyle('mydiv', 'background-color', 'red'); + */ + setStyle: function(elm, name, value) { + elm = this.$$(elm).css(name, value); + + if (this.settings.update_styles) { + elm.attr('data-mce-style', null); + } + }, + + /** + * Returns the current style or runtime/computed value of an element. + * + * @method getStyle + * @param {String/Element} elm HTML element or element id string to get style from. + * @param {String} name Style name to return. + * @param {Boolean} computed Computed style. + * @return {String} Current style or computed style value of an element. + */ + getStyle: function(elm, name, computed) { + elm = this.$$(elm); + + if (computed) { + return elm.css(name); + } + + // Camelcase it, if needed + name = name.replace(/-(\D)/g, function(a, b) { + return b.toUpperCase(); + }); + + if (name == 'float') { + name = isIE ? 'styleFloat' : 'cssFloat'; + } + + return elm[0] && elm[0].style ? elm[0].style[name] : undefined; + }, + + /** + * Sets multiple styles on the specified element(s). + * + * @method setStyles + * @param {Element/String/Array} e DOM element, element id string or array of elements/ids to set styles on. + * @param {Object} o Name/Value collection of style items to add to the element(s). + * @example + * // Sets styles on all paragraphs in the currently active editor + * tinymce.activeEditor.dom.setStyles(tinymce.activeEditor.dom.select('p'), {'background-color': 'red', 'color': 'green'}); + * + * // Sets styles to an element by id in the current document + * tinymce.DOM.setStyles('mydiv', {'background-color': 'red', 'color': 'green'}); + */ + setStyles: function(elm, styles) { + elm = this.$$(elm).css(styles); + + if (this.settings.update_styles) { + elm.attr('data-mce-style', null); + } + }, + + /** + * Removes all attributes from an element or elements. + * + * @method removeAllAttribs + * @param {Element/String/Array} e DOM element, element id string or array of elements/ids to remove attributes from. + */ + removeAllAttribs: function(e) { + return this.run(e, function(e) { + var i, attrs = e.attributes; + for (i = attrs.length - 1; i >= 0; i--) { + e.removeAttributeNode(attrs.item(i)); + } + }); + }, + + /** + * Sets the specified attribute of an element or elements. + * + * @method setAttrib + * @param {Element/String/Array} e DOM element, element id string or array of elements/ids to set attribute on. + * @param {String} n Name of attribute to set. + * @param {String} v Value to set on the attribute - if this value is falsy like null, 0 or '' it will remove the attribute instead. + * @example + * // Sets class attribute on all paragraphs in the active editor + * tinymce.activeEditor.dom.setAttrib(tinymce.activeEditor.dom.select('p'), 'class', 'myclass'); + * + * // Sets class attribute on a specific element in the current page + * tinymce.dom.setAttrib('mydiv', 'class', 'myclass'); + */ + setAttrib: function(elm, name, value) { + var self = this, originalValue, hook, settings = self.settings; + + if (value === '') { + value = null; + } + + elm = self.$$(elm); + originalValue = elm.attr(name); + + if (!elm.length) { + return; + } + + hook = self.attrHooks[name]; + if (hook && hook.set) { + hook.set(elm, value, name); + } else { + elm.attr(name, value); + } + + if (originalValue != value && settings.onSetAttrib) { + settings.onSetAttrib({ + attrElm: elm, + attrName: name, + attrValue: value + }); + } + }, + + /** + * Sets two or more specified attributes of an element or elements. + * + * @method setAttribs + * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set attributes on. + * @param {Object} attrs Name/Value collection of attribute items to add to the element(s). + * @example + * // Sets class and title attributes on all paragraphs in the active editor + * tinymce.activeEditor.dom.setAttribs(tinymce.activeEditor.dom.select('p'), {'class': 'myclass', title: 'some title'}); + * + * // Sets class and title attributes on a specific element in the current page + * tinymce.DOM.setAttribs('mydiv', {'class': 'myclass', title: 'some title'}); + */ + setAttribs: function(elm, attrs) { + var self = this; + + self.$$(elm).each(function(i, node) { + each(attrs, function(value, name) { + self.setAttrib(node, name, value); + }); + }); + }, + + /** + * Returns the specified attribute by name. + * + * @method getAttrib + * @param {String/Element} elm Element string id or DOM element to get attribute from. + * @param {String} name Name of attribute to get. + * @param {String} defaultVal Optional default value to return if the attribute didn't exist. + * @return {String} Attribute value string, default value or null if the attribute wasn't found. + */ + getAttrib: function(elm, name, defaultVal) { + var self = this, hook, value; + + elm = self.$$(elm); + + if (elm.length) { + hook = self.attrHooks[name]; + + if (hook && hook.get) { + value = hook.get(elm, name); + } else { + value = elm.attr(name); + } + } + + if (typeof value == 'undefined') { + value = defaultVal || ''; + } + + return value; + }, + + /** + * Returns the absolute x, y position of a node. The position will be returned in an object with x, y fields. + * + * @method getPos + * @param {Element/String} elm HTML element or element id to get x, y position from. + * @param {Element} rootElm Optional root element to stop calculations at. + * @return {object} Absolute position of the specified element object with x, y fields. + */ + getPos: function(elm, rootElm) { + var self = this, x = 0, y = 0, offsetParent, doc = self.doc, body = doc.body, pos; + + elm = self.get(elm); + rootElm = rootElm || body; + + if (elm) { + // Use getBoundingClientRect if it exists since it's faster than looping offset nodes + // Fallback to offsetParent calculations if the body isn't static better since it stops at the body root + if (rootElm === body && elm.getBoundingClientRect && $(body).css('position') === 'static') { + pos = elm.getBoundingClientRect(); + rootElm = self.boxModel ? doc.documentElement : body; + + // Add scroll offsets from documentElement or body since IE with the wrong box model will use d.body and so do WebKit + // Also remove the body/documentelement clientTop/clientLeft on IE 6, 7 since they offset the position + x = pos.left + (doc.documentElement.scrollLeft || body.scrollLeft) - rootElm.clientLeft; + y = pos.top + (doc.documentElement.scrollTop || body.scrollTop) - rootElm.clientTop; + + return {x: x, y: y}; + } + + offsetParent = elm; + while (offsetParent && offsetParent != rootElm && offsetParent.nodeType) { + x += offsetParent.offsetLeft || 0; + y += offsetParent.offsetTop || 0; + offsetParent = offsetParent.offsetParent; + } + + offsetParent = elm.parentNode; + while (offsetParent && offsetParent != rootElm && offsetParent.nodeType) { + x -= offsetParent.scrollLeft || 0; + y -= offsetParent.scrollTop || 0; + offsetParent = offsetParent.parentNode; + } + } + + return {x: x, y: y}; + }, + + /** + * Parses the specified style value into an object collection. This parser will also + * merge and remove any redundant items that browsers might have added. It will also convert non-hex + * colors to hex values. Urls inside the styles will also be converted to absolute/relative based on settings. + * + * @method parseStyle + * @param {String} cssText Style value to parse, for example: border:1px solid red;. + * @return {Object} Object representation of that style, for example: {border: '1px solid red'} + */ + parseStyle: function(cssText) { + return this.styles.parse(cssText); + }, + + /** + * Serializes the specified style object into a string. + * + * @method serializeStyle + * @param {Object} styles Object to serialize as string, for example: {border: '1px solid red'} + * @param {String} name Optional element name. + * @return {String} String representation of the style object, for example: border: 1px solid red. + */ + serializeStyle: function(styles, name) { + return this.styles.serialize(styles, name); + }, + + /** + * Adds a style element at the top of the document with the specified cssText content. + * + * @method addStyle + * @param {String} cssText CSS Text style to add to top of head of document. + */ + addStyle: function(cssText) { + var self = this, doc = self.doc, head, styleElm; + + // Prevent inline from loading the same styles twice + if (self !== DOMUtils.DOM && doc === document) { + var addedStyles = DOMUtils.DOM.addedStyles; + + addedStyles = addedStyles || []; + if (addedStyles[cssText]) { + return; + } + + addedStyles[cssText] = true; + DOMUtils.DOM.addedStyles = addedStyles; + } + + // Create style element if needed + styleElm = doc.getElementById('mceDefaultStyles'); + if (!styleElm) { + styleElm = doc.createElement('style'); + styleElm.id = 'mceDefaultStyles'; + styleElm.type = 'text/css'; + + head = doc.getElementsByTagName('head')[0]; + if (head.firstChild) { + head.insertBefore(styleElm, head.firstChild); + } else { + head.appendChild(styleElm); + } + } + + // Append style data to old or new style element + if (styleElm.styleSheet) { + styleElm.styleSheet.cssText += cssText; + } else { + styleElm.appendChild(doc.createTextNode(cssText)); + } + }, + + /** + * Imports/loads the specified CSS file into the document bound to the class. + * + * @method loadCSS + * @param {String} u URL to CSS file to load. + * @example + * // Loads a CSS file dynamically into the current document + * tinymce.DOM.loadCSS('somepath/some.css'); + * + * // Loads a CSS file into the currently active editor instance + * tinymce.activeEditor.dom.loadCSS('somepath/some.css'); + * + * // Loads a CSS file into an editor instance by id + * tinymce.get('someid').dom.loadCSS('somepath/some.css'); + * + * // Loads multiple CSS files into the current document + * tinymce.DOM.loadCSS('somepath/some.css,somepath/someother.css'); + */ + loadCSS: function(url) { + var self = this, doc = self.doc, head; + + // Prevent inline from loading the same CSS file twice + if (self !== DOMUtils.DOM && doc === document) { + DOMUtils.DOM.loadCSS(url); + return; + } + + if (!url) { + url = ''; + } + + head = doc.getElementsByTagName('head')[0]; + + each(url.split(','), function(url) { + var link; + + url = Tools._addCacheSuffix(url); + + if (self.files[url]) { + return; + } + + self.files[url] = true; + link = self.create('link', {rel: 'stylesheet', href: url}); + + // IE 8 has a bug where dynamically loading stylesheets would produce a 1 item remaining bug + // This fix seems to resolve that issue by recalcing the document once a stylesheet finishes loading + // It's ugly but it seems to work fine. + if (isIE && doc.documentMode && doc.recalc) { + link.onload = function() { + if (doc.recalc) { + doc.recalc(); + } + + link.onload = null; + }; + } + + head.appendChild(link); + }); + }, + + /** + * Adds a class to the specified element or elements. + * + * @method addClass + * @param {String/Element/Array} elm Element ID string or DOM element or array with elements or IDs. + * @param {String} cls Class name to add to each element. + * @return {String/Array} String with new class value or array with new class values for all elements. + * @example + * // Adds a class to all paragraphs in the active editor + * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'myclass'); + * + * // Adds a class to a specific element in the current page + * tinymce.DOM.addClass('mydiv', 'myclass'); + */ + addClass: function(elm, cls) { + this.$$(elm).addClass(cls); + }, + + /** + * Removes a class from the specified element or elements. + * + * @method removeClass + * @param {String/Element/Array} elm Element ID string or DOM element or array with elements or IDs. + * @param {String} cls Class name to remove from each element. + * @return {String/Array} String of remaining class name(s), or an array of strings if multiple input elements + * were passed in. + * @example + * // Removes a class from all paragraphs in the active editor + * tinymce.activeEditor.dom.removeClass(tinymce.activeEditor.dom.select('p'), 'myclass'); + * + * // Removes a class from a specific element in the current page + * tinymce.DOM.removeClass('mydiv', 'myclass'); + */ + removeClass: function(elm, cls) { + this.toggleClass(elm, cls, false); + }, + + /** + * Returns true if the specified element has the specified class. + * + * @method hasClass + * @param {String/Element} n HTML element or element id string to check CSS class on. + * @param {String} c CSS class to check for. + * @return {Boolean} true/false if the specified element has the specified class. + */ + hasClass: function(elm, cls) { + return this.$$(elm).hasClass(cls); + }, + + /** + * Toggles the specified class on/off. + * + * @method toggleClass + * @param {Element} elm Element to toggle class on. + * @param {[type]} cls Class to toggle on/off. + * @param {[type]} state Optional state to set. + */ + toggleClass: function(elm, cls, state) { + this.$$(elm).toggleClass(cls, state).each(function() { + if (this.className === '') { + $(this).attr('class', null); + } + }); + }, + + /** + * Shows the specified element(s) by ID by setting the "display" style. + * + * @method show + * @param {String/Element/Array} elm ID of DOM element or DOM element or array with elements or IDs to show. + */ + show: function(elm) { + this.$$(elm).show(); + }, + + /** + * Hides the specified element(s) by ID by setting the "display" style. + * + * @method hide + * @param {String/Element/Array} e ID of DOM element or DOM element or array with elements or IDs to hide. + * @example + * // Hides an element by id in the document + * tinymce.DOM.hide('myid'); + */ + hide: function(elm) { + this.$$(elm).hide(); + }, + + /** + * Returns true/false if the element is hidden or not by checking the "display" style. + * + * @method isHidden + * @param {String/Element} e Id or element to check display state on. + * @return {Boolean} true/false if the element is hidden or not. + */ + isHidden: function(elm) { + return this.$$(elm).css('display') == 'none'; + }, + + /** + * Returns a unique id. This can be useful when generating elements on the fly. + * This method will not check if the element already exists. + * + * @method uniqueId + * @param {String} prefix Optional prefix to add in front of all ids - defaults to "mce_". + * @return {String} Unique id. + */ + uniqueId: function(prefix) { + return (!prefix ? 'mce_' : prefix) + (this.counter++); + }, + + /** + * Sets the specified HTML content inside the element or elements. The HTML will first be processed. This means + * URLs will get converted, hex color values fixed etc. Check processHTML for details. + * + * @method setHTML + * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set HTML inside of. + * @param {String} h HTML content to set as inner HTML of the element. + * @example + * // Sets the inner HTML of all paragraphs in the active editor + * tinymce.activeEditor.dom.setHTML(tinymce.activeEditor.dom.select('p'), 'some inner html'); + * + * // Sets the inner HTML of an element by id in the document + * tinymce.DOM.setHTML('mydiv', 'some inner html'); + */ + setHTML: function(elm, html) { + elm = this.$$(elm); + + if (isIE) { + elm.each(function(i, target) { + if (target.canHaveHTML === false) { + return; + } + + // Remove all child nodes, IE keeps empty text nodes in DOM + while (target.firstChild) { + target.removeChild(target.firstChild); + } + + try { + // IE will remove comments from the beginning + // unless you padd the contents with something + target.innerHTML = '
    ' + html; + target.removeChild(target.firstChild); + } catch (ex) { + // IE sometimes produces an unknown runtime error on innerHTML if it's a div inside a p + $('
    ').html('
    ' + html).contents().slice(1).appendTo(target); + } + + return html; + }); + } else { + elm.html(html); + } + }, + + /** + * Returns the outer HTML of an element. + * + * @method getOuterHTML + * @param {String/Element} elm Element ID or element object to get outer HTML from. + * @return {String} Outer HTML string. + * @example + * tinymce.DOM.getOuterHTML(editorElement); + * tinymce.activeEditor.getOuterHTML(tinymce.activeEditor.getBody()); + */ + getOuterHTML: function(elm) { + elm = this.get(elm); + + // Older FF doesn't have outerHTML 3.6 is still used by some orgaizations + return elm.nodeType == 1 && "outerHTML" in elm ? elm.outerHTML : $('
    ').append($(elm).clone()).html(); + }, + + /** + * Sets the specified outer HTML on an element or elements. + * + * @method setOuterHTML + * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set outer HTML on. + * @param {Object} html HTML code to set as outer value for the element. + * @param {Document} doc Optional document scope to use in this process - defaults to the document of the DOM class. + * @example + * // Sets the outer HTML of all paragraphs in the active editor + * tinymce.activeEditor.dom.setOuterHTML(tinymce.activeEditor.dom.select('p'), '
    some html
    '); + * + * // Sets the outer HTML of an element by id in the document + * tinymce.DOM.setOuterHTML('mydiv', '
    some html
    '); + */ + setOuterHTML: function(elm, html) { + var self = this; + + self.$$(elm).each(function() { + try { + // Older FF doesn't have outerHTML 3.6 is still used by some orgaizations + if ("outerHTML" in this) { + this.outerHTML = html; + return; + } + } catch (ex) { + // Ignore + } + + // OuterHTML for IE it sometimes produces an "unknown runtime error" + self.remove($(this).html(html), true); + }); + }, + + /** + * Entity decodes a string. This method decodes any HTML entities, such as å. + * + * @method decode + * @param {String} s String to decode entities on. + * @return {String} Entity decoded string. + */ + decode: Entities.decode, + + /** + * Entity encodes a string. This method encodes the most common entities, such as <>"&. + * + * @method encode + * @param {String} text String to encode with entities. + * @return {String} Entity encoded string. + */ + encode: Entities.encodeAllRaw, + + /** + * Inserts an element after the reference element. + * + * @method insertAfter + * @param {Element} node Element to insert after the reference. + * @param {Element/String/Array} reference_node Reference element, element id or array of elements to insert after. + * @return {Element/Array} Element that got added or an array with elements. + */ + insertAfter: function(node, referenceNode) { + referenceNode = this.get(referenceNode); + + return this.run(node, function(node) { + var parent, nextSibling; + + parent = referenceNode.parentNode; + nextSibling = referenceNode.nextSibling; + + if (nextSibling) { + parent.insertBefore(node, nextSibling); + } else { + parent.appendChild(node); + } + + return node; + }); + }, + + /** + * Replaces the specified element or elements with the new element specified. The new element will + * be cloned if multiple input elements are passed in. + * + * @method replace + * @param {Element} newElm New element to replace old ones with. + * @param {Element/String/Array} oldELm Element DOM node, element id or array of elements or ids to replace. + * @param {Boolean} k Optional keep children state, if set to true child nodes from the old object will be added to new ones. + */ + replace: function(newElm, oldElm, keepChildren) { + var self = this; + + return self.run(oldElm, function(oldElm) { + if (is(oldElm, 'array')) { + newElm = newElm.cloneNode(true); + } + + if (keepChildren) { + each(grep(oldElm.childNodes), function(node) { + newElm.appendChild(node); + }); + } + + return oldElm.parentNode.replaceChild(newElm, oldElm); + }); + }, + + /** + * Renames the specified element and keeps its attributes and children. + * + * @method rename + * @param {Element} elm Element to rename. + * @param {String} name Name of the new element. + * @return {Element} New element or the old element if it needed renaming. + */ + rename: function(elm, name) { + var self = this, newElm; + + if (elm.nodeName != name.toUpperCase()) { + // Rename block element + newElm = self.create(name); + + // Copy attribs to new block + each(self.getAttribs(elm), function(attrNode) { + self.setAttrib(newElm, attrNode.nodeName, self.getAttrib(elm, attrNode.nodeName)); + }); + + // Replace block + self.replace(newElm, elm, 1); + } + + return newElm || elm; + }, + + /** + * Find the common ancestor of two elements. This is a shorter method than using the DOM Range logic. + * + * @method findCommonAncestor + * @param {Element} a Element to find common ancestor of. + * @param {Element} b Element to find common ancestor of. + * @return {Element} Common ancestor element of the two input elements. + */ + findCommonAncestor: function(a, b) { + var ps = a, pe; + + while (ps) { + pe = b; + + while (pe && ps != pe) { + pe = pe.parentNode; + } + + if (ps == pe) { + break; + } + + ps = ps.parentNode; + } + + if (!ps && a.ownerDocument) { + return a.ownerDocument.documentElement; + } + + return ps; + }, + + /** + * Parses the specified RGB color value and returns a hex version of that color. + * + * @method toHex + * @param {String} rgbVal RGB string value like rgb(1,2,3) + * @return {String} Hex version of that RGB value like #FF00FF. + */ + toHex: function(rgbVal) { + return this.styles.toHex(Tools.trim(rgbVal)); + }, + + /** + * Executes the specified function on the element by id or dom element node or array of elements/id. + * + * @method run + * @param {String/Element/Array} Element ID or DOM element object or array with ids or elements. + * @param {function} f Function to execute for each item. + * @param {Object} s Optional scope to execute the function in. + * @return {Object/Array} Single object, or an array of objects if multiple input elements were passed in. + */ + run: function(elm, func, scope) { + var self = this, result; + + if (typeof elm === 'string') { + elm = self.get(elm); + } + + if (!elm) { + return false; + } + + scope = scope || this; + if (!elm.nodeType && (elm.length || elm.length === 0)) { + result = []; + + each(elm, function(elm, i) { + if (elm) { + if (typeof elm == 'string') { + elm = self.get(elm); + } + + result.push(func.call(scope, elm, i)); + } + }); + + return result; + } + + return func.call(scope, elm); + }, + + /** + * Returns a NodeList with attributes for the element. + * + * @method getAttribs + * @param {HTMLElement/string} elm Element node or string id to get attributes from. + * @return {NodeList} NodeList with attributes. + */ + getAttribs: function(elm) { + var attrs; + + elm = this.get(elm); + + if (!elm) { + return []; + } + + if (isIE) { + attrs = []; + + // Object will throw exception in IE + if (elm.nodeName == 'OBJECT') { + return elm.attributes; + } + + // IE doesn't keep the selected attribute if you clone option elements + if (elm.nodeName === 'OPTION' && this.getAttrib(elm, 'selected')) { + attrs.push({specified: 1, nodeName: 'selected'}); + } + + // It's crazy that this is faster in IE but it's because it returns all attributes all the time + var attrRegExp = /<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi; + elm.cloneNode(false).outerHTML.replace(attrRegExp, '').replace(/[\w:\-]+/gi, function(a) { + attrs.push({specified: 1, nodeName: a}); + }); + + return attrs; + } + + return elm.attributes; + }, + + /** + * Returns true/false if the specified node is to be considered empty or not. + * + * @example + * tinymce.DOM.isEmpty(node, {img: true}); + * @method isEmpty + * @param {Object} elements Optional name/value object with elements that are automatically treated as non-empty elements. + * @return {Boolean} true/false if the node is empty or not. + */ + isEmpty: function(node, elements) { + var self = this, i, attributes, type, walker, name, brCount = 0; + + node = node.firstChild; + if (node) { + walker = new TreeWalker(node, node.parentNode); + elements = elements || (self.schema ? self.schema.getNonEmptyElements() : null); + + do { + type = node.nodeType; + + if (type === 1) { + // Ignore bogus elements + if (node.getAttribute('data-mce-bogus')) { + continue; + } + + // Keep empty elements like + name = node.nodeName.toLowerCase(); + if (elements && elements[name]) { + // Ignore single BR elements in blocks like


    or


    + if (name === 'br') { + brCount++; + continue; + } + + return false; + } + + // Keep elements with data-bookmark attributes or name attribute like + attributes = self.getAttribs(node); + i = attributes.length; + while (i--) { + name = attributes[i].nodeName; + if (name === "name" || name === 'data-mce-bookmark') { + return false; + } + } + } + + // Keep comment nodes + if (type == 8) { + return false; + } + + // Keep non whitespace text nodes + if ((type === 3 && !whiteSpaceRegExp.test(node.nodeValue))) { + return false; + } + } while ((node = walker.next())); + } + + return brCount <= 1; + }, + + /** + * Creates a new DOM Range object. This will use the native DOM Range API if it's + * available. If it's not, it will fall back to the custom TinyMCE implementation. + * + * @method createRng + * @return {DOMRange} DOM Range object. + * @example + * var rng = tinymce.DOM.createRng(); + * alert(rng.startContainer + "," + rng.startOffset); + */ + createRng: function() { + var doc = this.doc; + + return doc.createRange ? doc.createRange() : new Range(this); + }, + + /** + * Returns the index of the specified node within its parent. + * + * @method nodeIndex + * @param {Node} node Node to look for. + * @param {boolean} normalized Optional true/false state if the index is what it would be after a normalization. + * @return {Number} Index of the specified node. + */ + nodeIndex: function(node, normalized) { + var idx = 0, lastNodeType, nodeType; + + if (node) { + for (lastNodeType = node.nodeType, node = node.previousSibling; node; node = node.previousSibling) { + nodeType = node.nodeType; + + // Normalize text nodes + if (normalized && nodeType == 3) { + if (nodeType == lastNodeType || !node.nodeValue.length) { + continue; + } + } + idx++; + lastNodeType = nodeType; + } + } + + return idx; + }, + + /** + * Splits an element into two new elements and places the specified split + * element or elements between the new ones. For example splitting the paragraph at the bold element in + * this example

    abcabc123

    would produce

    abc

    abc

    123

    . + * + * @method split + * @param {Element} parentElm Parent element to split. + * @param {Element} splitElm Element to split at. + * @param {Element} replacementElm Optional replacement element to replace the split element with. + * @return {Element} Returns the split element or the replacement element if that is specified. + */ + split: function(parentElm, splitElm, replacementElm) { + var self = this, r = self.createRng(), bef, aft, pa; + + // W3C valid browsers tend to leave empty nodes to the left/right side of the contents - this makes sense + // but we don't want that in our code since it serves no purpose for the end user + // For example splitting this html at the bold element: + //

    text 1CHOPtext 2

    + // would produce: + //

    text 1

    CHOP

    text 2

    + // this function will then trim off empty edges and produce: + //

    text 1

    CHOP

    text 2

    + function trimNode(node) { + var i, children = node.childNodes, type = node.nodeType; + + function surroundedBySpans(node) { + var previousIsSpan = node.previousSibling && node.previousSibling.nodeName == 'SPAN'; + var nextIsSpan = node.nextSibling && node.nextSibling.nodeName == 'SPAN'; + return previousIsSpan && nextIsSpan; + } + + if (type == 1 && node.getAttribute('data-mce-type') == 'bookmark') { + return; + } + + for (i = children.length - 1; i >= 0; i--) { + trimNode(children[i]); + } + + if (type != 9) { + // Keep non whitespace text nodes + if (type == 3 && node.nodeValue.length > 0) { + // If parent element isn't a block or there isn't any useful contents for example "

    " + // Also keep text nodes with only spaces if surrounded by spans. + // eg. "

    a b

    " should keep space between a and b + var trimmedLength = trim(node.nodeValue).length; + if (!self.isBlock(node.parentNode) || trimmedLength > 0 || trimmedLength === 0 && surroundedBySpans(node)) { + return; + } + } else if (type == 1) { + // If the only child is a bookmark then move it up + children = node.childNodes; + + // TODO fix this complex if + if (children.length == 1 && children[0] && children[0].nodeType == 1 && + children[0].getAttribute('data-mce-type') == 'bookmark') { + node.parentNode.insertBefore(children[0], node); + } + + // Keep non empty elements or img, hr etc + if (children.length || /^(br|hr|input|img)$/i.test(node.nodeName)) { + return; + } + } + + self.remove(node); + } + + return node; + } + + if (parentElm && splitElm) { + // Get before chunk + r.setStart(parentElm.parentNode, self.nodeIndex(parentElm)); + r.setEnd(splitElm.parentNode, self.nodeIndex(splitElm)); + bef = r.extractContents(); + + // Get after chunk + r = self.createRng(); + r.setStart(splitElm.parentNode, self.nodeIndex(splitElm) + 1); + r.setEnd(parentElm.parentNode, self.nodeIndex(parentElm) + 1); + aft = r.extractContents(); + + // Insert before chunk + pa = parentElm.parentNode; + pa.insertBefore(trimNode(bef), parentElm); + + // Insert middle chunk + if (replacementElm) { + pa.replaceChild(replacementElm, splitElm); + } else { + pa.insertBefore(splitElm, parentElm); + } + + // Insert after chunk + pa.insertBefore(trimNode(aft), parentElm); + self.remove(parentElm); + + return replacementElm || splitElm; + } + }, + + /** + * Adds an event handler to the specified object. + * + * @method bind + * @param {Element/Document/Window/Array} target Target element to bind events to. + * handler to or an array of elements/ids/documents. + * @param {String} name Name of event handler to add, for example: click. + * @param {function} func Function to execute when the event occurs. + * @param {Object} scope Optional scope to execute the function in. + * @return {function} Function callback handler the same as the one passed in. + */ + bind: function(target, name, func, scope) { + var self = this; + + if (Tools.isArray(target)) { + var i = target.length; + + while (i--) { + target[i] = self.bind(target[i], name, func, scope); + } + + return target; + } + + // Collect all window/document events bound by editor instance + if (self.settings.collect && (target === self.doc || target === self.win)) { + self.boundEvents.push([target, name, func, scope]); + } + + return self.events.bind(target, name, func, scope || self); + }, + + /** + * Removes the specified event handler by name and function from an element or collection of elements. + * + * @method unbind + * @param {Element/Document/Window/Array} target Target element to unbind events on. + * @param {String} name Event handler name, for example: "click" + * @param {function} func Function to remove. + * @return {bool/Array} Bool state of true if the handler was removed, or an array of states if multiple input elements + * were passed in. + */ + unbind: function(target, name, func) { + var self = this, i; + + if (Tools.isArray(target)) { + i = target.length; + + while (i--) { + target[i] = self.unbind(target[i], name, func); + } + + return target; + } + + // Remove any bound events matching the input + if (self.boundEvents && (target === self.doc || target === self.win)) { + i = self.boundEvents.length; + + while (i--) { + var item = self.boundEvents[i]; + + if (target == item[0] && (!name || name == item[1]) && (!func || func == item[2])) { + this.events.unbind(item[0], item[1], item[2]); + } + } + } + + return this.events.unbind(target, name, func); + }, + + /** + * Fires the specified event name with object on target. + * + * @method fire + * @param {Node/Document/Window} target Target element or object to fire event on. + * @param {String} name Name of the event to fire. + * @param {Object} evt Event object to send. + * @return {Event} Event object. + */ + fire: function(target, name, evt) { + return this.events.fire(target, name, evt); + }, + + // Returns the content editable state of a node + getContentEditable: function(node) { + var contentEditable; + + // Check type + if (!node || node.nodeType != 1) { + return null; + } + + // Check for fake content editable + contentEditable = node.getAttribute("data-mce-contenteditable"); + if (contentEditable && contentEditable !== "inherit") { + return contentEditable; + } + + // Check for real content editable + return node.contentEditable !== "inherit" ? node.contentEditable : null; + }, + + getContentEditableParent: function(node) { + var root = this.getRoot(), state = null; + + for (; node && node !== root; node = node.parentNode) { + state = this.getContentEditable(node); + + if (state !== null) { + break; + } + } + + return state; + }, + + /** + * Destroys all internal references to the DOM to solve IE leak issues. + * + * @method destroy + */ + destroy: function() { + var self = this; + + // Unbind all events bound to window/document by editor instance + if (self.boundEvents) { + var i = self.boundEvents.length; + + while (i--) { + var item = self.boundEvents[i]; + this.events.unbind(item[0], item[1], item[2]); + } + + self.boundEvents = null; + } + + // Restore sizzle document to window.document + // Since the current document might be removed producing "Permission denied" on IE see #6325 + if (Sizzle.setDocument) { + Sizzle.setDocument(); + } + + self.win = self.doc = self.root = self.events = self.frag = null; + }, + + isChildOf: function(node, parent) { + while (node) { + if (parent === node) { + return true; + } + + node = node.parentNode; + } + + return false; + }, + + // #ifdef debug + + dumpRng: function(r) { + return ( + 'startContainer: ' + r.startContainer.nodeName + + ', startOffset: ' + r.startOffset + + ', endContainer: ' + r.endContainer.nodeName + + ', endOffset: ' + r.endOffset + ); + }, + + // #endif + + _findSib: function(node, selector, name) { + var self = this, func = selector; + + if (node) { + // If expression make a function of it using is + if (typeof func == 'string') { + func = function(node) { + return self.is(node, selector); + }; + } + + // Loop all siblings + for (node = node[name]; node; node = node[name]) { + if (func(node)) { + return node; + } + } + } + + return null; + } + }; + + /** + * Instance of DOMUtils for the current document. + * + * @static + * @property DOM + * @type tinymce.dom.DOMUtils + * @example + * // Example of how to add a class to some element by id + * tinymce.DOM.addClass('someid', 'someclass'); + */ + DOMUtils.DOM = new DOMUtils(document); + + return DOMUtils; +}); + +// Included from: js/tinymce/classes/dom/ScriptLoader.js + +/** + * ScriptLoader.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*globals console*/ + +/** + * This class handles asynchronous/synchronous loading of JavaScript files it will execute callbacks + * when various items gets loaded. This class is useful to load external JavaScript files. + * + * @class tinymce.dom.ScriptLoader + * @example + * // Load a script from a specific URL using the global script loader + * tinymce.ScriptLoader.load('somescript.js'); + * + * // Load a script using a unique instance of the script loader + * var scriptLoader = new tinymce.dom.ScriptLoader(); + * + * scriptLoader.load('somescript.js'); + * + * // Load multiple scripts + * var scriptLoader = new tinymce.dom.ScriptLoader(); + * + * scriptLoader.add('somescript1.js'); + * scriptLoader.add('somescript2.js'); + * scriptLoader.add('somescript3.js'); + * + * scriptLoader.loadQueue(function() { + * alert('All scripts are now loaded.'); + * }); + */ +define("tinymce/dom/ScriptLoader", [ + "tinymce/dom/DOMUtils", + "tinymce/util/Tools" +], function(DOMUtils, Tools) { + var DOM = DOMUtils.DOM; + var each = Tools.each, grep = Tools.grep; + + function ScriptLoader() { + var QUEUED = 0, + LOADING = 1, + LOADED = 2, + states = {}, + queue = [], + scriptLoadedCallbacks = {}, + queueLoadedCallbacks = [], + loading = 0, + undef; + + /** + * Loads a specific script directly without adding it to the load queue. + * + * @method load + * @param {String} url Absolute URL to script to add. + * @param {function} callback Optional callback function to execute ones this script gets loaded. + * @param {Object} scope Optional scope to execute callback in. + */ + function loadScript(url, callback) { + var dom = DOM, elm, id; + + // Execute callback when script is loaded + function done() { + dom.remove(id); + + if (elm) { + elm.onreadystatechange = elm.onload = elm = null; + } + + callback(); + } + + function error() { + /*eslint no-console:0 */ + + // Report the error so it's easier for people to spot loading errors + if (typeof console !== "undefined" && console.log) { + console.log("Failed to load: " + url); + } + + // We can't mark it as done if there is a load error since + // A) We don't want to produce 404 errors on the server and + // B) the onerror event won't fire on all browsers. + // done(); + } + + id = dom.uniqueId(); + + // Create new script element + elm = document.createElement('script'); + elm.id = id; + elm.type = 'text/javascript'; + elm.src = Tools._addCacheSuffix(url); + + // Seems that onreadystatechange works better on IE 10 onload seems to fire incorrectly + if ("onreadystatechange" in elm) { + elm.onreadystatechange = function() { + if (/loaded|complete/.test(elm.readyState)) { + done(); + } + }; + } else { + elm.onload = done; + } + + // Add onerror event will get fired on some browsers but not all of them + elm.onerror = error; + + // Add script to document + (document.getElementsByTagName('head')[0] || document.body).appendChild(elm); + } + + /** + * Returns true/false if a script has been loaded or not. + * + * @method isDone + * @param {String} url URL to check for. + * @return {Boolean} true/false if the URL is loaded. + */ + this.isDone = function(url) { + return states[url] == LOADED; + }; + + /** + * Marks a specific script to be loaded. This can be useful if a script got loaded outside + * the script loader or to skip it from loading some script. + * + * @method markDone + * @param {string} u Absolute URL to the script to mark as loaded. + */ + this.markDone = function(url) { + states[url] = LOADED; + }; + + /** + * Adds a specific script to the load queue of the script loader. + * + * @method add + * @param {String} url Absolute URL to script to add. + * @param {function} callback Optional callback function to execute ones this script gets loaded. + * @param {Object} scope Optional scope to execute callback in. + */ + this.add = this.load = function(url, callback, scope) { + var state = states[url]; + + // Add url to load queue + if (state == undef) { + queue.push(url); + states[url] = QUEUED; + } + + if (callback) { + // Store away callback for later execution + if (!scriptLoadedCallbacks[url]) { + scriptLoadedCallbacks[url] = []; + } + + scriptLoadedCallbacks[url].push({ + func: callback, + scope: scope || this + }); + } + }; + + /** + * Starts the loading of the queue. + * + * @method loadQueue + * @param {function} callback Optional callback to execute when all queued items are loaded. + * @param {Object} scope Optional scope to execute the callback in. + */ + this.loadQueue = function(callback, scope) { + this.loadScripts(queue, callback, scope); + }; + + /** + * Loads the specified queue of files and executes the callback ones they are loaded. + * This method is generally not used outside this class but it might be useful in some scenarios. + * + * @method loadScripts + * @param {Array} scripts Array of queue items to load. + * @param {function} callback Optional callback to execute ones all items are loaded. + * @param {Object} scope Optional scope to execute callback in. + */ + this.loadScripts = function(scripts, callback, scope) { + var loadScripts; + + function execScriptLoadedCallbacks(url) { + // Execute URL callback functions + each(scriptLoadedCallbacks[url], function(callback) { + callback.func.call(callback.scope); + }); + + scriptLoadedCallbacks[url] = undef; + } + + queueLoadedCallbacks.push({ + func: callback, + scope: scope || this + }); + + loadScripts = function() { + var loadingScripts = grep(scripts); + + // Current scripts has been handled + scripts.length = 0; + + // Load scripts that needs to be loaded + each(loadingScripts, function(url) { + // Script is already loaded then execute script callbacks directly + if (states[url] == LOADED) { + execScriptLoadedCallbacks(url); + return; + } + + // Is script not loading then start loading it + if (states[url] != LOADING) { + states[url] = LOADING; + loading++; + + loadScript(url, function() { + states[url] = LOADED; + loading--; + + execScriptLoadedCallbacks(url); + + // Load more scripts if they where added by the recently loaded script + loadScripts(); + }); + } + }); + + // No scripts are currently loading then execute all pending queue loaded callbacks + if (!loading) { + each(queueLoadedCallbacks, function(callback) { + callback.func.call(callback.scope); + }); + + queueLoadedCallbacks.length = 0; + } + }; + + loadScripts(); + }; + } + + ScriptLoader.ScriptLoader = new ScriptLoader(); + + return ScriptLoader; +}); + +// Included from: js/tinymce/classes/AddOnManager.js + +/** + * AddOnManager.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles the loading of themes/plugins or other add-ons and their language packs. + * + * @class tinymce.AddOnManager + */ +define("tinymce/AddOnManager", [ + "tinymce/dom/ScriptLoader", + "tinymce/util/Tools" +], function(ScriptLoader, Tools) { + var each = Tools.each; + + function AddOnManager() { + var self = this; + + self.items = []; + self.urls = {}; + self.lookup = {}; + } + + AddOnManager.prototype = { + /** + * Returns the specified add on by the short name. + * + * @method get + * @param {String} name Add-on to look for. + * @return {tinymce.Theme/tinymce.Plugin} Theme or plugin add-on instance or undefined. + */ + get: function(name) { + if (this.lookup[name]) { + return this.lookup[name].instance; + } else { + return undefined; + } + }, + + dependencies: function(name) { + var result; + + if (this.lookup[name]) { + result = this.lookup[name].dependencies; + } + + return result || []; + }, + + /** + * Loads a language pack for the specified add-on. + * + * @method requireLangPack + * @param {String} name Short name of the add-on. + * @param {String} languages Optional comma or space separated list of languages to check if it matches the name. + */ + requireLangPack: function(name, languages) { + var language = AddOnManager.language; + + if (language && AddOnManager.languageLoad !== false) { + if (languages) { + languages = ',' + languages + ','; + + // Load short form sv.js or long form sv_SE.js + if (languages.indexOf(',' + language.substr(0, 2) + ',') != -1) { + language = language.substr(0, 2); + } else if (languages.indexOf(',' + language + ',') == -1) { + return; + } + } + + ScriptLoader.ScriptLoader.add(this.urls[name] + '/langs/' + language + '.js'); + } + }, + + /** + * Adds a instance of the add-on by it's short name. + * + * @method add + * @param {String} id Short name/id for the add-on. + * @param {tinymce.Theme/tinymce.Plugin} addOn Theme or plugin to add. + * @return {tinymce.Theme/tinymce.Plugin} The same theme or plugin instance that got passed in. + * @example + * // Create a simple plugin + * tinymce.create('tinymce.plugins.TestPlugin', { + * TestPlugin: function(ed, url) { + * ed.on('click', function(e) { + * ed.windowManager.alert('Hello World!'); + * }); + * } + * }); + * + * // Register plugin using the add method + * tinymce.PluginManager.add('test', tinymce.plugins.TestPlugin); + * + * // Initialize TinyMCE + * tinymce.init({ + * ... + * plugins: '-test' // Init the plugin but don't try to load it + * }); + */ + add: function(id, addOn, dependencies) { + this.items.push(addOn); + this.lookup[id] = {instance: addOn, dependencies: dependencies}; + + return addOn; + }, + + createUrl: function(baseUrl, dep) { + if (typeof dep === "object") { + return dep; + } else { + return {prefix: baseUrl.prefix, resource: dep, suffix: baseUrl.suffix}; + } + }, + + /** + * Add a set of components that will make up the add-on. Using the url of the add-on name as the base url. + * This should be used in development mode. A new compressor/javascript munger process will ensure that the + * components are put together into the plugin.js file and compressed correctly. + * + * @method addComponents + * @param {String} pluginName name of the plugin to load scripts from (will be used to get the base url for the plugins). + * @param {Array} scripts Array containing the names of the scripts to load. + */ + addComponents: function(pluginName, scripts) { + var pluginUrl = this.urls[pluginName]; + + each(scripts, function(script) { + ScriptLoader.ScriptLoader.add(pluginUrl + "/" + script); + }); + }, + + /** + * Loads an add-on from a specific url. + * + * @method load + * @param {String} name Short name of the add-on that gets loaded. + * @param {String} addOnUrl URL to the add-on that will get loaded. + * @param {function} callback Optional callback to execute ones the add-on is loaded. + * @param {Object} scope Optional scope to execute the callback in. + * @example + * // Loads a plugin from an external URL + * tinymce.PluginManager.load('myplugin', '/some/dir/someplugin/plugin.js'); + * + * // Initialize TinyMCE + * tinymce.init({ + * ... + * plugins: '-myplugin' // Don't try to load it again + * }); + */ + load: function(name, addOnUrl, callback, scope) { + var self = this, url = addOnUrl; + + function loadDependencies() { + var dependencies = self.dependencies(name); + + each(dependencies, function(dep) { + var newUrl = self.createUrl(addOnUrl, dep); + + self.load(newUrl.resource, newUrl, undefined, undefined); + }); + + if (callback) { + if (scope) { + callback.call(scope); + } else { + callback.call(ScriptLoader); + } + } + } + + if (self.urls[name]) { + return; + } + + if (typeof addOnUrl === "object") { + url = addOnUrl.prefix + addOnUrl.resource + addOnUrl.suffix; + } + + if (url.indexOf('/') !== 0 && url.indexOf('://') == -1) { + url = AddOnManager.baseURL + '/' + url; + } + + self.urls[name] = url.substring(0, url.lastIndexOf('/')); + + if (self.lookup[name]) { + loadDependencies(); + } else { + ScriptLoader.ScriptLoader.add(url, loadDependencies, scope); + } + } + }; + + AddOnManager.PluginManager = new AddOnManager(); + AddOnManager.ThemeManager = new AddOnManager(); + + return AddOnManager; +}); + +/** + * TinyMCE theme class. + * + * @class tinymce.Theme + */ + +/** + * This method is responsible for rendering/generating the overall user interface with toolbars, buttons, iframe containers etc. + * + * @method renderUI + * @param {Object} obj Object parameter containing the targetNode DOM node that will be replaced visually with an editor instance. + * @return {Object} an object with items like iframeContainer, editorContainer, sizeContainer, deltaWidth, deltaHeight. + */ + +/** + * Plugin base class, this is a pseudo class that describes how a plugin is to be created for TinyMCE. The methods below are all optional. + * + * @class tinymce.Plugin + * @example + * tinymce.PluginManager.add('example', function(editor, url) { + * // Add a button that opens a window + * editor.addButton('example', { + * text: 'My button', + * icon: false, + * onclick: function() { + * // Open window + * editor.windowManager.open({ + * title: 'Example plugin', + * body: [ + * {type: 'textbox', name: 'title', label: 'Title'} + * ], + * onsubmit: function(e) { + * // Insert content when the window form is submitted + * editor.insertContent('Title: ' + e.data.title); + * } + * }); + * } + * }); + * + * // Adds a menu item to the tools menu + * editor.addMenuItem('example', { + * text: 'Example plugin', + * context: 'tools', + * onclick: function() { + * // Open window with a specific url + * editor.windowManager.open({ + * title: 'TinyMCE site', + * url: 'http://www.tinymce.com', + * width: 800, + * height: 600, + * buttons: [{ + * text: 'Close', + * onclick: 'close' + * }] + * }); + * } + * }); + * }); + */ + +// Included from: js/tinymce/classes/dom/RangeUtils.js + +/** + * RangeUtils.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class contains a few utility methods for ranges. + * + * @class tinymce.dom.RangeUtils + */ +define("tinymce/dom/RangeUtils", [ + "tinymce/util/Tools", + "tinymce/dom/TreeWalker" +], function(Tools, TreeWalker) { + var each = Tools.each; + + function getEndChild(container, index) { + var childNodes = container.childNodes; + + index--; + + if (index > childNodes.length - 1) { + index = childNodes.length - 1; + } else if (index < 0) { + index = 0; + } + + return childNodes[index] || container; + } + + function RangeUtils(dom) { + /** + * Walks the specified range like object and executes the callback for each sibling collection it finds. + * + * @method walk + * @param {Object} rng Range like object. + * @param {function} callback Callback function to execute for each sibling collection. + */ + this.walk = function(rng, callback) { + var startContainer = rng.startContainer, + startOffset = rng.startOffset, + endContainer = rng.endContainer, + endOffset = rng.endOffset, + ancestor, startPoint, + endPoint, node, parent, siblings, nodes; + + // Handle table cell selection the table plugin enables + // you to fake select table cells and perform formatting actions on them + nodes = dom.select('td.mce-item-selected,th.mce-item-selected'); + if (nodes.length > 0) { + each(nodes, function(node) { + callback([node]); + }); + + return; + } + + /** + * Excludes start/end text node if they are out side the range + * + * @private + * @param {Array} nodes Nodes to exclude items from. + * @return {Array} Array with nodes excluding the start/end container if needed. + */ + function exclude(nodes) { + var node; + + // First node is excluded + node = nodes[0]; + if (node.nodeType === 3 && node === startContainer && startOffset >= node.nodeValue.length) { + nodes.splice(0, 1); + } + + // Last node is excluded + node = nodes[nodes.length - 1]; + if (endOffset === 0 && nodes.length > 0 && node === endContainer && node.nodeType === 3) { + nodes.splice(nodes.length - 1, 1); + } + + return nodes; + } + + /** + * Collects siblings + * + * @private + * @param {Node} node Node to collect siblings from. + * @param {String} name Name of the sibling to check for. + * @return {Array} Array of collected siblings. + */ + function collectSiblings(node, name, end_node) { + var siblings = []; + + for (; node && node != end_node; node = node[name]) { + siblings.push(node); + } + + return siblings; + } + + /** + * Find an end point this is the node just before the common ancestor root. + * + * @private + * @param {Node} node Node to start at. + * @param {Node} root Root/ancestor element to stop just before. + * @return {Node} Node just before the root element. + */ + function findEndPoint(node, root) { + do { + if (node.parentNode == root) { + return node; + } + + node = node.parentNode; + } while (node); + } + + function walkBoundary(start_node, end_node, next) { + var siblingName = next ? 'nextSibling' : 'previousSibling'; + + for (node = start_node, parent = node.parentNode; node && node != end_node; node = parent) { + parent = node.parentNode; + siblings = collectSiblings(node == start_node ? node : node[siblingName], siblingName); + + if (siblings.length) { + if (!next) { + siblings.reverse(); + } + + callback(exclude(siblings)); + } + } + } + + // If index based start position then resolve it + if (startContainer.nodeType == 1 && startContainer.hasChildNodes()) { + startContainer = startContainer.childNodes[startOffset]; + } + + // If index based end position then resolve it + if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) { + endContainer = getEndChild(endContainer, endOffset); + } + + // Same container + if (startContainer == endContainer) { + return callback(exclude([startContainer])); + } + + // Find common ancestor and end points + ancestor = dom.findCommonAncestor(startContainer, endContainer); + + // Process left side + for (node = startContainer; node; node = node.parentNode) { + if (node === endContainer) { + return walkBoundary(startContainer, ancestor, true); + } + + if (node === ancestor) { + break; + } + } + + // Process right side + for (node = endContainer; node; node = node.parentNode) { + if (node === startContainer) { + return walkBoundary(endContainer, ancestor); + } + + if (node === ancestor) { + break; + } + } + + // Find start/end point + startPoint = findEndPoint(startContainer, ancestor) || startContainer; + endPoint = findEndPoint(endContainer, ancestor) || endContainer; + + // Walk left leaf + walkBoundary(startContainer, startPoint, true); + + // Walk the middle from start to end point + siblings = collectSiblings( + startPoint == startContainer ? startPoint : startPoint.nextSibling, + 'nextSibling', + endPoint == endContainer ? endPoint.nextSibling : endPoint + ); + + if (siblings.length) { + callback(exclude(siblings)); + } + + // Walk right leaf + walkBoundary(endContainer, endPoint); + }; + + /** + * Splits the specified range at it's start/end points. + * + * @private + * @param {Range/RangeObject} rng Range to split. + * @return {Object} Range position object. + */ + this.split = function(rng) { + var startContainer = rng.startContainer, + startOffset = rng.startOffset, + endContainer = rng.endContainer, + endOffset = rng.endOffset; + + function splitText(node, offset) { + return node.splitText(offset); + } + + // Handle single text node + if (startContainer == endContainer && startContainer.nodeType == 3) { + if (startOffset > 0 && startOffset < startContainer.nodeValue.length) { + endContainer = splitText(startContainer, startOffset); + startContainer = endContainer.previousSibling; + + if (endOffset > startOffset) { + endOffset = endOffset - startOffset; + startContainer = endContainer = splitText(endContainer, endOffset).previousSibling; + endOffset = endContainer.nodeValue.length; + startOffset = 0; + } else { + endOffset = 0; + } + } + } else { + // Split startContainer text node if needed + if (startContainer.nodeType == 3 && startOffset > 0 && startOffset < startContainer.nodeValue.length) { + startContainer = splitText(startContainer, startOffset); + startOffset = 0; + } + + // Split endContainer text node if needed + if (endContainer.nodeType == 3 && endOffset > 0 && endOffset < endContainer.nodeValue.length) { + endContainer = splitText(endContainer, endOffset).previousSibling; + endOffset = endContainer.nodeValue.length; + } + } + + return { + startContainer: startContainer, + startOffset: startOffset, + endContainer: endContainer, + endOffset: endOffset + }; + }; + + /** + * Normalizes the specified range by finding the closest best suitable caret location. + * + * @private + * @param {Range} rng Range to normalize. + * @return {Boolean} True/false if the specified range was normalized or not. + */ + this.normalize = function(rng) { + var normalized, collapsed; + + function normalizeEndPoint(start) { + var container, offset, walker, body = dom.getRoot(), node, nonEmptyElementsMap; + var directionLeft, isAfterNode; + + function hasBrBeforeAfter(node, left) { + var walker = new TreeWalker(node, dom.getParent(node.parentNode, dom.isBlock) || body); + + while ((node = walker[left ? 'prev' : 'next']())) { + if (node.nodeName === "BR") { + return true; + } + } + } + + function isPrevNode(node, name) { + return node.previousSibling && node.previousSibling.nodeName == name; + } + + // Walks the dom left/right to find a suitable text node to move the endpoint into + // It will only walk within the current parent block or body and will stop if it hits a block or a BR/IMG + function findTextNodeRelative(left, startNode) { + var walker, lastInlineElement, parentBlockContainer; + + startNode = startNode || container; + parentBlockContainer = dom.getParent(startNode.parentNode, dom.isBlock) || body; + + // Lean left before the BR element if it's the only BR within a block element. Gecko bug: #6680 + // This:


    |

    becomes

    |

    + if (left && startNode.nodeName == 'BR' && isAfterNode && dom.isEmpty(parentBlockContainer)) { + container = startNode.parentNode; + offset = dom.nodeIndex(startNode); + normalized = true; + return; + } + + // Walk left until we hit a text node we can move to or a block/br/img + walker = new TreeWalker(startNode, parentBlockContainer); + while ((node = walker[left ? 'prev' : 'next']())) { + // Break if we hit a non content editable node + if (dom.getContentEditableParent(node) === "false") { + return; + } + + // Found text node that has a length + if (node.nodeType === 3 && node.nodeValue.length > 0) { + container = node; + offset = left ? node.nodeValue.length : 0; + normalized = true; + return; + } + + // Break if we find a block or a BR/IMG/INPUT etc + if (dom.isBlock(node) || nonEmptyElementsMap[node.nodeName.toLowerCase()]) { + return; + } + + lastInlineElement = node; + } + + // Only fetch the last inline element when in caret mode for now + if (collapsed && lastInlineElement) { + container = lastInlineElement; + normalized = true; + offset = 0; + } + } + + container = rng[(start ? 'start' : 'end') + 'Container']; + offset = rng[(start ? 'start' : 'end') + 'Offset']; + isAfterNode = container.nodeType == 1 && offset === container.childNodes.length; + nonEmptyElementsMap = dom.schema.getNonEmptyElements(); + directionLeft = start; + + if (container.nodeType == 1 && offset > container.childNodes.length - 1) { + directionLeft = false; + } + + // If the container is a document move it to the body element + if (container.nodeType === 9) { + container = dom.getRoot(); + offset = 0; + } + + // If the container is body try move it into the closest text node or position + if (container === body) { + // If start is before/after a image, table etc + if (directionLeft) { + node = container.childNodes[offset > 0 ? offset - 1 : 0]; + if (node) { + if (nonEmptyElementsMap[node.nodeName] || node.nodeName == "TABLE") { + return; + } + } + } + + // Resolve the index + if (container.hasChildNodes()) { + offset = Math.min(!directionLeft && offset > 0 ? offset - 1 : offset, container.childNodes.length - 1); + container = container.childNodes[offset]; + offset = 0; + + // Don't walk into elements that doesn't have any child nodes like a IMG + if (container.hasChildNodes() && !/TABLE/.test(container.nodeName)) { + // Walk the DOM to find a text node to place the caret at or a BR + node = container; + walker = new TreeWalker(container, body); + + do { + // Found a text node use that position + if (node.nodeType === 3 && node.nodeValue.length > 0) { + offset = directionLeft ? 0 : node.nodeValue.length; + container = node; + normalized = true; + break; + } + + // Found a BR/IMG element that we can place the caret before + if (nonEmptyElementsMap[node.nodeName.toLowerCase()]) { + offset = dom.nodeIndex(node); + container = node.parentNode; + + // Put caret after image when moving the end point + if (node.nodeName == "IMG" && !directionLeft) { + offset++; + } + + normalized = true; + break; + } + } while ((node = (directionLeft ? walker.next() : walker.prev()))); + } + } + } + + // Lean the caret to the left if possible + if (collapsed) { + // So this: x|x + // Becomes: x|x + // Seems that only gecko has issues with this + if (container.nodeType === 3 && offset === 0) { + findTextNodeRelative(true); + } + + // Lean left into empty inline elements when the caret is before a BR + // So this: |
    + // Becomes: |
    + // Seems that only gecko has issues with this. + // Special edge case for

    x|

    since we don't want

    x|

    + if (container.nodeType === 1) { + node = container.childNodes[offset]; + + // Offset is after the containers last child + // then use the previous child for normalization + if (!node) { + node = container.childNodes[offset - 1]; + } + + if (node && node.nodeName === 'BR' && !isPrevNode(node, 'A') && + !hasBrBeforeAfter(node) && !hasBrBeforeAfter(node, true)) { + findTextNodeRelative(true, node); + } + } + } + + // Lean the start of the selection right if possible + // So this: x[x] + // Becomes: x[x] + if (directionLeft && !collapsed && container.nodeType === 3 && offset === container.nodeValue.length) { + findTextNodeRelative(false); + } + + // Set endpoint if it was normalized + if (normalized) { + rng['set' + (start ? 'Start' : 'End')](container, offset); + } + } + + collapsed = rng.collapsed; + + normalizeEndPoint(true); + + if (!collapsed) { + normalizeEndPoint(); + } + + // If it was collapsed then make sure it still is + if (normalized && collapsed) { + rng.collapse(true); + } + + return normalized; + }; + } + + /** + * Compares two ranges and checks if they are equal. + * + * @static + * @method compareRanges + * @param {DOMRange} rng1 First range to compare. + * @param {DOMRange} rng2 First range to compare. + * @return {Boolean} true/false if the ranges are equal. + */ + RangeUtils.compareRanges = function(rng1, rng2) { + if (rng1 && rng2) { + // Compare native IE ranges + if (rng1.item || rng1.duplicate) { + // Both are control ranges and the selected element matches + if (rng1.item && rng2.item && rng1.item(0) === rng2.item(0)) { + return true; + } + + // Both are text ranges and the range matches + if (rng1.isEqual && rng2.isEqual && rng2.isEqual(rng1)) { + return true; + } + } else { + // Compare w3c ranges + return rng1.startContainer == rng2.startContainer && rng1.startOffset == rng2.startOffset; + } + } + + return false; + }; + + /** + * Gets the caret range for the given x/y location. + * + * @static + * @method getCaretRangeFromPoint + * @param {Number} x X coordinate for range + * @param {Number} y Y coordinate for range + * @param {Document} doc Document that x/y are relative to + * @returns {Range} caret range + */ + RangeUtils.getCaretRangeFromPoint = function(x, y, doc) { + var rng, point; + + if (doc.caretPositionFromPoint) { + point = doc.caretPositionFromPoint(x, y); + rng = doc.createRange(); + rng.setStart(point.offsetNode, point.offset); + rng.collapse(true); + } else if (doc.caretRangeFromPoint) { + rng = doc.caretRangeFromPoint(x, y); + } else if (doc.body.createTextRange) { + rng = doc.body.createTextRange(); + + try { + rng.moveToPoint(x, y); + rng.collapse(true); + } catch (ex) { + // Append to top or bottom depending on drop location + rng.collapse(y < doc.body.clientHeight); + } + } + + return rng; + }; + + RangeUtils.getNode = function(container, offset) { + if (container.nodeType == 1 && container.hasChildNodes()) { + if (offset >= container.childNodes.length) { + offset = container.childNodes.length - 1; + } + + container = container.childNodes[offset]; + } + + return container; + }; + + return RangeUtils; +}); + +// Included from: js/tinymce/classes/NodeChange.js + +/** + * NodeChange.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles the nodechange event dispatching both manual and though selection change events. + * + * @class tinymce.NodeChange + * @private + */ +define("tinymce/NodeChange", [ + "tinymce/dom/RangeUtils", + "tinymce/Env" +], function(RangeUtils, Env) { + return function(editor) { + var lastRng, lastPath = []; + + /** + * Returns true/false if the current element path has been changed or not. + * + * @private + * @return {Boolean} True if the element path is the same false if it's not. + */ + function isSameElementPath(startElm) { + var i, currentPath; + + currentPath = editor.$(startElm).parentsUntil(editor.getBody()).add(startElm); + if (currentPath.length === lastPath.length) { + for (i = currentPath.length; i >= 0; i--) { + if (currentPath[i] !== lastPath[i]) { + break; + } + } + + if (i === -1) { + lastPath = currentPath; + return true; + } + } + + lastPath = currentPath; + + return false; + } + + // Gecko doesn't support the "selectionchange" event + if (!('onselectionchange' in editor.getDoc())) { + editor.on('NodeChange Click MouseUp KeyUp Focus', function(e) { + var nativeRng, fakeRng; + + // Since DOM Ranges mutate on modification + // of the DOM we need to clone it's contents + nativeRng = editor.selection.getRng(); + fakeRng = { + startContainer: nativeRng.startContainer, + startOffset: nativeRng.startOffset, + endContainer: nativeRng.endContainer, + endOffset: nativeRng.endOffset + }; + + // Always treat nodechange as a selectionchange since applying + // formatting to the current range wouldn't update the range but it's parent + if (e.type == 'nodechange' || !RangeUtils.compareRanges(fakeRng, lastRng)) { + editor.fire('SelectionChange'); + } + + lastRng = fakeRng; + }); + } + + // IE has a bug where it fires a selectionchange on right click that has a range at the start of the body + // When the contextmenu event fires the selection is located at the right location + editor.on('contextmenu', function() { + editor.fire('SelectionChange'); + }); + + // Selection change is delayed ~200ms on IE when you click inside the current range + editor.on('SelectionChange', function() { + var startElm = editor.selection.getStart(true); + + // IE 8 will fire a selectionchange event with an incorrect selection + // when focusing out of table cells. Click inside cell -> toolbar = Invalid SelectionChange event + if (!Env.range && editor.selection.isCollapsed()) { + return; + } + + if (!isSameElementPath(startElm) && editor.dom.isChildOf(startElm, editor.getBody())) { + editor.nodeChanged({selectionChange: true}); + } + }); + + // Fire an extra nodeChange on mouseup for compatibility reasons + editor.on('MouseUp', function(e) { + if (!e.isDefaultPrevented()) { + // Delay nodeChanged call for WebKit edge case issue where the range + // isn't updated until after you click outside a selected image + if (editor.selection.getNode().nodeName == 'IMG') { + setTimeout(function() { + editor.nodeChanged(); + }, 0); + } else { + editor.nodeChanged(); + } + } + }); + + /** + * Distpaches out a onNodeChange event to all observers. This method should be called when you + * need to update the UI states or element path etc. + * + * @method nodeChanged + * @param {Object} args Optional args to pass to NodeChange event handlers. + */ + this.nodeChanged = function(args) { + var selection = editor.selection, node, parents, root; + + // Fix for bug #1896577 it seems that this can not be fired while the editor is loading + if (editor.initialized && selection && !editor.settings.disable_nodechange && !editor.settings.readonly) { + // Get start node + root = editor.getBody(); + node = selection.getStart() || root; + node = node.ownerDocument != editor.getDoc() ? editor.getBody() : node; + + // Edge case for

    |

    + if (node.nodeName == 'IMG' && selection.isCollapsed()) { + node = node.parentNode; + } + + // Get parents and add them to object + parents = []; + editor.dom.getParent(node, function(node) { + if (node === root) { + return true; + } + + parents.push(node); + }); + + args = args || {}; + args.element = node; + args.parents = parents; + + editor.fire('NodeChange', args); + } + }; + }; +}); + +// Included from: js/tinymce/classes/html/Node.js + +/** + * Node.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is a minimalistic implementation of a DOM like node used by the DomParser class. + * + * @example + * var node = new tinymce.html.Node('strong', 1); + * someRoot.append(node); + * + * @class tinymce.html.Node + * @version 3.4 + */ +define("tinymce/html/Node", [], function() { + var whiteSpaceRegExp = /^[ \t\r\n]*$/, typeLookup = { + '#text': 3, + '#comment': 8, + '#cdata': 4, + '#pi': 7, + '#doctype': 10, + '#document-fragment': 11 + }; + + // Walks the tree left/right + function walk(node, root_node, prev) { + var sibling, parent, startName = prev ? 'lastChild' : 'firstChild', siblingName = prev ? 'prev' : 'next'; + + // Walk into nodes if it has a start + if (node[startName]) { + return node[startName]; + } + + // Return the sibling if it has one + if (node !== root_node) { + sibling = node[siblingName]; + + if (sibling) { + return sibling; + } + + // Walk up the parents to look for siblings + for (parent = node.parent; parent && parent !== root_node; parent = parent.parent) { + sibling = parent[siblingName]; + + if (sibling) { + return sibling; + } + } + } + } + + /** + * Constructs a new Node instance. + * + * @constructor + * @method Node + * @param {String} name Name of the node type. + * @param {Number} type Numeric type representing the node. + */ + function Node(name, type) { + this.name = name; + this.type = type; + + if (type === 1) { + this.attributes = []; + this.attributes.map = {}; + } + } + + Node.prototype = { + /** + * Replaces the current node with the specified one. + * + * @example + * someNode.replace(someNewNode); + * + * @method replace + * @param {tinymce.html.Node} node Node to replace the current node with. + * @return {tinymce.html.Node} The old node that got replaced. + */ + replace: function(node) { + var self = this; + + if (node.parent) { + node.remove(); + } + + self.insert(node, self); + self.remove(); + + return self; + }, + + /** + * Gets/sets or removes an attribute by name. + * + * @example + * someNode.attr("name", "value"); // Sets an attribute + * console.log(someNode.attr("name")); // Gets an attribute + * someNode.attr("name", null); // Removes an attribute + * + * @method attr + * @param {String} name Attribute name to set or get. + * @param {String} value Optional value to set. + * @return {String/tinymce.html.Node} String or undefined on a get operation or the current node on a set operation. + */ + attr: function(name, value) { + var self = this, attrs, i, undef; + + if (typeof name !== "string") { + for (i in name) { + self.attr(i, name[i]); + } + + return self; + } + + if ((attrs = self.attributes)) { + if (value !== undef) { + // Remove attribute + if (value === null) { + if (name in attrs.map) { + delete attrs.map[name]; + + i = attrs.length; + while (i--) { + if (attrs[i].name === name) { + attrs = attrs.splice(i, 1); + return self; + } + } + } + + return self; + } + + // Set attribute + if (name in attrs.map) { + // Set attribute + i = attrs.length; + while (i--) { + if (attrs[i].name === name) { + attrs[i].value = value; + break; + } + } + } else { + attrs.push({name: name, value: value}); + } + + attrs.map[name] = value; + + return self; + } else { + return attrs.map[name]; + } + } + }, + + /** + * Does a shallow clones the node into a new node. It will also exclude id attributes since + * there should only be one id per document. + * + * @example + * var clonedNode = node.clone(); + * + * @method clone + * @return {tinymce.html.Node} New copy of the original node. + */ + clone: function() { + var self = this, clone = new Node(self.name, self.type), i, l, selfAttrs, selfAttr, cloneAttrs; + + // Clone element attributes + if ((selfAttrs = self.attributes)) { + cloneAttrs = []; + cloneAttrs.map = {}; + + for (i = 0, l = selfAttrs.length; i < l; i++) { + selfAttr = selfAttrs[i]; + + // Clone everything except id + if (selfAttr.name !== 'id') { + cloneAttrs[cloneAttrs.length] = {name: selfAttr.name, value: selfAttr.value}; + cloneAttrs.map[selfAttr.name] = selfAttr.value; + } + } + + clone.attributes = cloneAttrs; + } + + clone.value = self.value; + clone.shortEnded = self.shortEnded; + + return clone; + }, + + /** + * Wraps the node in in another node. + * + * @example + * node.wrap(wrapperNode); + * + * @method wrap + */ + wrap: function(wrapper) { + var self = this; + + self.parent.insert(wrapper, self); + wrapper.append(self); + + return self; + }, + + /** + * Unwraps the node in other words it removes the node but keeps the children. + * + * @example + * node.unwrap(); + * + * @method unwrap + */ + unwrap: function() { + var self = this, node, next; + + for (node = self.firstChild; node;) { + next = node.next; + self.insert(node, self, true); + node = next; + } + + self.remove(); + }, + + /** + * Removes the node from it's parent. + * + * @example + * node.remove(); + * + * @method remove + * @return {tinymce.html.Node} Current node that got removed. + */ + remove: function() { + var self = this, parent = self.parent, next = self.next, prev = self.prev; + + if (parent) { + if (parent.firstChild === self) { + parent.firstChild = next; + + if (next) { + next.prev = null; + } + } else { + prev.next = next; + } + + if (parent.lastChild === self) { + parent.lastChild = prev; + + if (prev) { + prev.next = null; + } + } else { + next.prev = prev; + } + + self.parent = self.next = self.prev = null; + } + + return self; + }, + + /** + * Appends a new node as a child of the current node. + * + * @example + * node.append(someNode); + * + * @method append + * @param {tinymce.html.Node} node Node to append as a child of the current one. + * @return {tinymce.html.Node} The node that got appended. + */ + append: function(node) { + var self = this, last; + + if (node.parent) { + node.remove(); + } + + last = self.lastChild; + if (last) { + last.next = node; + node.prev = last; + self.lastChild = node; + } else { + self.lastChild = self.firstChild = node; + } + + node.parent = self; + + return node; + }, + + /** + * Inserts a node at a specific position as a child of the current node. + * + * @example + * parentNode.insert(newChildNode, oldChildNode); + * + * @method insert + * @param {tinymce.html.Node} node Node to insert as a child of the current node. + * @param {tinymce.html.Node} ref_node Reference node to set node before/after. + * @param {Boolean} before Optional state to insert the node before the reference node. + * @return {tinymce.html.Node} The node that got inserted. + */ + insert: function(node, ref_node, before) { + var parent; + + if (node.parent) { + node.remove(); + } + + parent = ref_node.parent || this; + + if (before) { + if (ref_node === parent.firstChild) { + parent.firstChild = node; + } else { + ref_node.prev.next = node; + } + + node.prev = ref_node.prev; + node.next = ref_node; + ref_node.prev = node; + } else { + if (ref_node === parent.lastChild) { + parent.lastChild = node; + } else { + ref_node.next.prev = node; + } + + node.next = ref_node.next; + node.prev = ref_node; + ref_node.next = node; + } + + node.parent = parent; + + return node; + }, + + /** + * Get all children by name. + * + * @method getAll + * @param {String} name Name of the child nodes to collect. + * @return {Array} Array with child nodes matchin the specified name. + */ + getAll: function(name) { + var self = this, node, collection = []; + + for (node = self.firstChild; node; node = walk(node, self)) { + if (node.name === name) { + collection.push(node); + } + } + + return collection; + }, + + /** + * Removes all children of the current node. + * + * @method empty + * @return {tinymce.html.Node} The current node that got cleared. + */ + empty: function() { + var self = this, nodes, i, node; + + // Remove all children + if (self.firstChild) { + nodes = []; + + // Collect the children + for (node = self.firstChild; node; node = walk(node, self)) { + nodes.push(node); + } + + // Remove the children + i = nodes.length; + while (i--) { + node = nodes[i]; + node.parent = node.firstChild = node.lastChild = node.next = node.prev = null; + } + } + + self.firstChild = self.lastChild = null; + + return self; + }, + + /** + * Returns true/false if the node is to be considered empty or not. + * + * @example + * node.isEmpty({img: true}); + * @method isEmpty + * @param {Object} elements Name/value object with elements that are automatically treated as non empty elements. + * @return {Boolean} true/false if the node is empty or not. + */ + isEmpty: function(elements) { + var self = this, node = self.firstChild, i, name; + + if (node) { + do { + if (node.type === 1) { + // Ignore bogus elements + if (node.attributes.map['data-mce-bogus']) { + continue; + } + + // Keep empty elements like + if (elements[node.name]) { + return false; + } + + // Keep bookmark nodes and name attribute like + i = node.attributes.length; + while (i--) { + name = node.attributes[i].name; + if (name === "name" || name.indexOf('data-mce-bookmark') === 0) { + return false; + } + } + } + + // Keep comments + if (node.type === 8) { + return false; + } + + // Keep non whitespace text nodes + if ((node.type === 3 && !whiteSpaceRegExp.test(node.value))) { + return false; + } + } while ((node = walk(node, self))); + } + + return true; + }, + + /** + * Walks to the next or previous node and returns that node or null if it wasn't found. + * + * @method walk + * @param {Boolean} prev Optional previous node state defaults to false. + * @return {tinymce.html.Node} Node that is next to or previous of the current node. + */ + walk: function(prev) { + return walk(this, null, prev); + } + }; + + /** + * Creates a node of a specific type. + * + * @static + * @method create + * @param {String} name Name of the node type to create for example "b" or "#text". + * @param {Object} attrs Name/value collection of attributes that will be applied to elements. + */ + Node.create = function(name, attrs) { + var node, attrName; + + // Create node + node = new Node(name, typeLookup[name] || 1); + + // Add attributes if needed + if (attrs) { + for (attrName in attrs) { + node.attr(attrName, attrs[attrName]); + } + } + + return node; + }; + + return Node; +}); + +// Included from: js/tinymce/classes/html/Schema.js + +/** + * Schema.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Schema validator class. + * + * @class tinymce.html.Schema + * @example + * if (tinymce.activeEditor.schema.isValidChild('p', 'span')) + * alert('span is valid child of p.'); + * + * if (tinymce.activeEditor.schema.getElementRule('p')) + * alert('P is a valid element.'); + * + * @class tinymce.html.Schema + * @version 3.4 + */ +define("tinymce/html/Schema", [ + "tinymce/util/Tools" +], function(Tools) { + var mapCache = {}, dummyObj = {}; + var makeMap = Tools.makeMap, each = Tools.each, extend = Tools.extend, explode = Tools.explode, inArray = Tools.inArray; + + function split(items, delim) { + return items ? items.split(delim || ' ') : []; + } + + /** + * Builds a schema lookup table + * + * @private + * @param {String} type html4, html5 or html5-strict schema type. + * @return {Object} Schema lookup table. + */ + function compileSchema(type) { + var schema = {}, globalAttributes, blockContent; + var phrasingContent, flowContent, html4BlockContent, html4PhrasingContent; + + function add(name, attributes, children) { + var ni, i, attributesOrder, args = arguments; + + function arrayToMap(array, obj) { + var map = {}, i, l; + + for (i = 0, l = array.length; i < l; i++) { + map[array[i]] = obj || {}; + } + + return map; + } + + children = children || []; + attributes = attributes || ""; + + if (typeof children === "string") { + children = split(children); + } + + // Split string children + for (i = 3; i < args.length; i++) { + if (typeof args[i] === "string") { + args[i] = split(args[i]); + } + + children.push.apply(children, args[i]); + } + + name = split(name); + ni = name.length; + while (ni--) { + attributesOrder = [].concat(globalAttributes, split(attributes)); + schema[name[ni]] = { + attributes: arrayToMap(attributesOrder), + attributesOrder: attributesOrder, + children: arrayToMap(children, dummyObj) + }; + } + } + + function addAttrs(name, attributes) { + var ni, schemaItem, i, l; + + name = split(name); + ni = name.length; + attributes = split(attributes); + while (ni--) { + schemaItem = schema[name[ni]]; + for (i = 0, l = attributes.length; i < l; i++) { + schemaItem.attributes[attributes[i]] = {}; + schemaItem.attributesOrder.push(attributes[i]); + } + } + } + + // Use cached schema + if (mapCache[type]) { + return mapCache[type]; + } + + // Attributes present on all elements + globalAttributes = split("id accesskey class dir lang style tabindex title"); + + // Event attributes can be opt-in/opt-out + /*eventAttributes = split("onabort onblur oncancel oncanplay oncanplaythrough onchange onclick onclose oncontextmenu oncuechange " + + "ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended " + + "onerror onfocus oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart " + + "onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel onpause onplay onplaying onprogress onratechange " + + "onreset onscroll onseeked onseeking onseeking onselect onshow onstalled onsubmit onsuspend ontimeupdate onvolumechange " + + "onwaiting" + );*/ + + // Block content elements + blockContent = split( + "address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul" + ); + + // Phrasing content elements from the HTML5 spec (inline) + phrasingContent = split( + "a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd " + + "label map noscript object q s samp script select small span strong sub sup " + + "textarea u var #text #comment" + ); + + // Add HTML5 items to globalAttributes, blockContent, phrasingContent + if (type != "html4") { + globalAttributes.push.apply(globalAttributes, split("contenteditable contextmenu draggable dropzone " + + "hidden spellcheck translate")); + blockContent.push.apply(blockContent, split("article aside details dialog figure header footer hgroup section nav")); + phrasingContent.push.apply(phrasingContent, split("audio canvas command datalist mark meter output progress time wbr " + + "video ruby bdi keygen")); + } + + // Add HTML4 elements unless it's html5-strict + if (type != "html5-strict") { + globalAttributes.push("xml:lang"); + + html4PhrasingContent = split("acronym applet basefont big font strike tt"); + phrasingContent.push.apply(phrasingContent, html4PhrasingContent); + + each(html4PhrasingContent, function(name) { + add(name, "", phrasingContent); + }); + + html4BlockContent = split("center dir isindex noframes"); + blockContent.push.apply(blockContent, html4BlockContent); + + // Flow content elements from the HTML5 spec (block+inline) + flowContent = [].concat(blockContent, phrasingContent); + + each(html4BlockContent, function(name) { + add(name, "", flowContent); + }); + } + + // Flow content elements from the HTML5 spec (block+inline) + flowContent = flowContent || [].concat(blockContent, phrasingContent); + + // HTML4 base schema TODO: Move HTML5 specific attributes to HTML5 specific if statement + // Schema items , , + add("html", "manifest", "head body"); + add("head", "", "base command link meta noscript script style title"); + add("title hr noscript br"); + add("base", "href target"); + add("link", "href rel media hreflang type sizes hreflang"); + add("meta", "name http-equiv content charset"); + add("style", "media type scoped"); + add("script", "src async defer type charset"); + add("body", "onafterprint onbeforeprint onbeforeunload onblur onerror onfocus " + + "onhashchange onload onmessage onoffline ononline onpagehide onpageshow " + + "onpopstate onresize onscroll onstorage onunload", flowContent); + add("address dt dd div caption", "", flowContent); + add("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn", "", phrasingContent); + add("blockquote", "cite", flowContent); + add("ol", "reversed start type", "li"); + add("ul", "", "li"); + add("li", "value", flowContent); + add("dl", "", "dt dd"); + add("a", "href target rel media hreflang type", phrasingContent); + add("q", "cite", phrasingContent); + add("ins del", "cite datetime", flowContent); + add("img", "src sizes srcset alt usemap ismap width height"); + add("iframe", "src name width height", flowContent); + add("embed", "src type width height"); + add("object", "data type typemustmatch name usemap form width height", flowContent, "param"); + add("param", "name value"); + add("map", "name", flowContent, "area"); + add("area", "alt coords shape href target rel media hreflang type"); + add("table", "border", "caption colgroup thead tfoot tbody tr" + (type == "html4" ? " col" : "")); + add("colgroup", "span", "col"); + add("col", "span"); + add("tbody thead tfoot", "", "tr"); + add("tr", "", "td th"); + add("td", "colspan rowspan headers", flowContent); + add("th", "colspan rowspan headers scope abbr", flowContent); + add("form", "accept-charset action autocomplete enctype method name novalidate target", flowContent); + add("fieldset", "disabled form name", flowContent, "legend"); + add("label", "form for", phrasingContent); + add("input", "accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate " + + "formtarget height list max maxlength min multiple name pattern readonly required size src step type value width" + ); + add("button", "disabled form formaction formenctype formmethod formnovalidate formtarget name type value", + type == "html4" ? flowContent : phrasingContent); + add("select", "disabled form multiple name required size", "option optgroup"); + add("optgroup", "disabled label", "option"); + add("option", "disabled label selected value"); + add("textarea", "cols dirname disabled form maxlength name readonly required rows wrap"); + add("menu", "type label", flowContent, "li"); + add("noscript", "", flowContent); + + // Extend with HTML5 elements + if (type != "html4") { + add("wbr"); + add("ruby", "", phrasingContent, "rt rp"); + add("figcaption", "", flowContent); + add("mark rt rp summary bdi", "", phrasingContent); + add("canvas", "width height", flowContent); + add("video", "src crossorigin poster preload autoplay mediagroup loop " + + "muted controls width height buffered", flowContent, "track source"); + add("audio", "src crossorigin preload autoplay mediagroup loop muted controls buffered volume", flowContent, "track source"); + add("picture", "", "img source"); + add("source", "src srcset type media sizes"); + add("track", "kind src srclang label default"); + add("datalist", "", phrasingContent, "option"); + add("article section nav aside header footer", "", flowContent); + add("hgroup", "", "h1 h2 h3 h4 h5 h6"); + add("figure", "", flowContent, "figcaption"); + add("time", "datetime", phrasingContent); + add("dialog", "open", flowContent); + add("command", "type label icon disabled checked radiogroup command"); + add("output", "for form name", phrasingContent); + add("progress", "value max", phrasingContent); + add("meter", "value min max low high optimum", phrasingContent); + add("details", "open", flowContent, "summary"); + add("keygen", "autofocus challenge disabled form keytype name"); + } + + // Extend with HTML4 attributes unless it's html5-strict + if (type != "html5-strict") { + addAttrs("script", "language xml:space"); + addAttrs("style", "xml:space"); + addAttrs("object", "declare classid code codebase codetype archive standby align border hspace vspace"); + addAttrs("embed", "align name hspace vspace"); + addAttrs("param", "valuetype type"); + addAttrs("a", "charset name rev shape coords"); + addAttrs("br", "clear"); + addAttrs("applet", "codebase archive code object alt name width height align hspace vspace"); + addAttrs("img", "name longdesc align border hspace vspace"); + addAttrs("iframe", "longdesc frameborder marginwidth marginheight scrolling align"); + addAttrs("font basefont", "size color face"); + addAttrs("input", "usemap align"); + addAttrs("select", "onchange"); + addAttrs("textarea"); + addAttrs("h1 h2 h3 h4 h5 h6 div p legend caption", "align"); + addAttrs("ul", "type compact"); + addAttrs("li", "type"); + addAttrs("ol dl menu dir", "compact"); + addAttrs("pre", "width xml:space"); + addAttrs("hr", "align noshade size width"); + addAttrs("isindex", "prompt"); + addAttrs("table", "summary width frame rules cellspacing cellpadding align bgcolor"); + addAttrs("col", "width align char charoff valign"); + addAttrs("colgroup", "width align char charoff valign"); + addAttrs("thead", "align char charoff valign"); + addAttrs("tr", "align char charoff valign bgcolor"); + addAttrs("th", "axis align char charoff valign nowrap bgcolor width height"); + addAttrs("form", "accept"); + addAttrs("td", "abbr axis scope align char charoff valign nowrap bgcolor width height"); + addAttrs("tfoot", "align char charoff valign"); + addAttrs("tbody", "align char charoff valign"); + addAttrs("area", "nohref"); + addAttrs("body", "background bgcolor text link vlink alink"); + } + + // Extend with HTML5 attributes unless it's html4 + if (type != "html4") { + addAttrs("input button select textarea", "autofocus"); + addAttrs("input textarea", "placeholder"); + addAttrs("a", "download"); + addAttrs("link script img", "crossorigin"); + addAttrs("iframe", "sandbox seamless allowfullscreen"); // Excluded: srcdoc + } + + // Special: iframe, ruby, video, audio, label + + // Delete children of the same name from it's parent + // For example: form can't have a child of the name form + each(split('a form meter progress dfn'), function(name) { + if (schema[name]) { + delete schema[name].children[name]; + } + }); + + // Delete header, footer, sectioning and heading content descendants + /*each('dt th address', function(name) { + delete schema[name].children[name]; + });*/ + + // Caption can't have tables + delete schema.caption.children.table; + + // TODO: LI:s can only have value if parent is OL + + // TODO: Handle transparent elements + // a ins del canvas map + + mapCache[type] = schema; + + return schema; + } + + function compileElementMap(value, mode) { + var styles; + + if (value) { + styles = {}; + + if (typeof value == 'string') { + value = { + '*': value + }; + } + + // Convert styles into a rule list + each(value, function(value, key) { + styles[key] = styles[key.toUpperCase()] = mode == 'map' ? makeMap(value, /[, ]/) : explode(value, /[, ]/); + }); + } + + return styles; + } + + /** + * Constructs a new Schema instance. + * + * @constructor + * @method Schema + * @param {Object} settings Name/value settings object. + */ + return function(settings) { + var self = this, elements = {}, children = {}, patternElements = [], validStyles, invalidStyles, schemaItems; + var whiteSpaceElementsMap, selfClosingElementsMap, shortEndedElementsMap, boolAttrMap, validClasses; + var blockElementsMap, nonEmptyElementsMap, moveCaretBeforeOnEnterElementsMap, textBlockElementsMap, textInlineElementsMap; + var customElementsMap = {}, specialElements = {}; + + // Creates an lookup table map object for the specified option or the default value + function createLookupTable(option, default_value, extendWith) { + var value = settings[option]; + + if (!value) { + // Get cached default map or make it if needed + value = mapCache[option]; + + if (!value) { + value = makeMap(default_value, ' ', makeMap(default_value.toUpperCase(), ' ')); + value = extend(value, extendWith); + + mapCache[option] = value; + } + } else { + // Create custom map + value = makeMap(value, /[, ]/, makeMap(value.toUpperCase(), /[, ]/)); + } + + return value; + } + + settings = settings || {}; + schemaItems = compileSchema(settings.schema); + + // Allow all elements and attributes if verify_html is set to false + if (settings.verify_html === false) { + settings.valid_elements = '*[*]'; + } + + validStyles = compileElementMap(settings.valid_styles); + invalidStyles = compileElementMap(settings.invalid_styles, 'map'); + validClasses = compileElementMap(settings.valid_classes, 'map'); + + // Setup map objects + whiteSpaceElementsMap = createLookupTable('whitespace_elements', 'pre script noscript style textarea video audio iframe object'); + selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr'); + shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link ' + + 'meta param embed source wbr track'); + boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize ' + + 'noshade nowrap readonly selected autoplay loop controls'); + nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object script', shortEndedElementsMap); + moveCaretBeforeOnEnterElementsMap = createLookupTable('move_caret_before_on_enter_elements', 'table', nonEmptyElementsMap); + textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' + + 'blockquote center dir fieldset header footer article section hgroup aside nav figure'); + blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' + + 'th tr td li ol ul caption dl dt dd noscript menu isindex option ' + + 'datalist select optgroup', textBlockElementsMap); + textInlineElementsMap = createLookupTable('text_inline_elements', 'span strong b em i font strike u var cite ' + + 'dfn code mark q sup sub samp'); + + each((settings.special || 'script noscript style textarea').split(' '), function(name) { + specialElements[name] = new RegExp('<\/' + name + '[^>]*>', 'gi'); + }); + + // Converts a wildcard expression string to a regexp for example *a will become /.*a/. + function patternToRegExp(str) { + return new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$'); + } + + // Parses the specified valid_elements string and adds to the current rules + // This function is a bit hard to read since it's heavily optimized for speed + function addValidElements(validElements) { + var ei, el, ai, al, matches, element, attr, attrData, elementName, attrName, attrType, attributes, attributesOrder, + prefix, outputName, globalAttributes, globalAttributesOrder, key, value, + elementRuleRegExp = /^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)\])?$/, + attrRuleRegExp = /^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/, + hasPatternsRegExp = /[*?+]/; + + if (validElements) { + // Split valid elements into an array with rules + validElements = split(validElements, ','); + + if (elements['@']) { + globalAttributes = elements['@'].attributes; + globalAttributesOrder = elements['@'].attributesOrder; + } + + // Loop all rules + for (ei = 0, el = validElements.length; ei < el; ei++) { + // Parse element rule + matches = elementRuleRegExp.exec(validElements[ei]); + if (matches) { + // Setup local names for matches + prefix = matches[1]; + elementName = matches[2]; + outputName = matches[3]; + attrData = matches[5]; + + // Create new attributes and attributesOrder + attributes = {}; + attributesOrder = []; + + // Create the new element + element = { + attributes: attributes, + attributesOrder: attributesOrder + }; + + // Padd empty elements prefix + if (prefix === '#') { + element.paddEmpty = true; + } + + // Remove empty elements prefix + if (prefix === '-') { + element.removeEmpty = true; + } + + if (matches[4] === '!') { + element.removeEmptyAttrs = true; + } + + // Copy attributes from global rule into current rule + if (globalAttributes) { + for (key in globalAttributes) { + attributes[key] = globalAttributes[key]; + } + + attributesOrder.push.apply(attributesOrder, globalAttributesOrder); + } + + // Attributes defined + if (attrData) { + attrData = split(attrData, '|'); + for (ai = 0, al = attrData.length; ai < al; ai++) { + matches = attrRuleRegExp.exec(attrData[ai]); + if (matches) { + attr = {}; + attrType = matches[1]; + attrName = matches[2].replace(/::/g, ':'); + prefix = matches[3]; + value = matches[4]; + + // Required + if (attrType === '!') { + element.attributesRequired = element.attributesRequired || []; + element.attributesRequired.push(attrName); + attr.required = true; + } + + // Denied from global + if (attrType === '-') { + delete attributes[attrName]; + attributesOrder.splice(inArray(attributesOrder, attrName), 1); + continue; + } + + // Default value + if (prefix) { + // Default value + if (prefix === '=') { + element.attributesDefault = element.attributesDefault || []; + element.attributesDefault.push({name: attrName, value: value}); + attr.defaultValue = value; + } + + // Forced value + if (prefix === ':') { + element.attributesForced = element.attributesForced || []; + element.attributesForced.push({name: attrName, value: value}); + attr.forcedValue = value; + } + + // Required values + if (prefix === '<') { + attr.validValues = makeMap(value, '?'); + } + } + + // Check for attribute patterns + if (hasPatternsRegExp.test(attrName)) { + element.attributePatterns = element.attributePatterns || []; + attr.pattern = patternToRegExp(attrName); + element.attributePatterns.push(attr); + } else { + // Add attribute to order list if it doesn't already exist + if (!attributes[attrName]) { + attributesOrder.push(attrName); + } + + attributes[attrName] = attr; + } + } + } + } + + // Global rule, store away these for later usage + if (!globalAttributes && elementName == '@') { + globalAttributes = attributes; + globalAttributesOrder = attributesOrder; + } + + // Handle substitute elements such as b/strong + if (outputName) { + element.outputName = elementName; + elements[outputName] = element; + } + + // Add pattern or exact element + if (hasPatternsRegExp.test(elementName)) { + element.pattern = patternToRegExp(elementName); + patternElements.push(element); + } else { + elements[elementName] = element; + } + } + } + } + } + + function setValidElements(validElements) { + elements = {}; + patternElements = []; + + addValidElements(validElements); + + each(schemaItems, function(element, name) { + children[name] = element.children; + }); + } + + // Adds custom non HTML elements to the schema + function addCustomElements(customElements) { + var customElementRegExp = /^(~)?(.+)$/; + + if (customElements) { + // Flush cached items since we are altering the default maps + mapCache.text_block_elements = mapCache.block_elements = null; + + each(split(customElements, ','), function(rule) { + var matches = customElementRegExp.exec(rule), + inline = matches[1] === '~', + cloneName = inline ? 'span' : 'div', + name = matches[2]; + + children[name] = children[cloneName]; + customElementsMap[name] = cloneName; + + // If it's not marked as inline then add it to valid block elements + if (!inline) { + blockElementsMap[name.toUpperCase()] = {}; + blockElementsMap[name] = {}; + } + + // Add elements clone if needed + if (!elements[name]) { + var customRule = elements[cloneName]; + + customRule = extend({}, customRule); + delete customRule.removeEmptyAttrs; + delete customRule.removeEmpty; + + elements[name] = customRule; + } + + // Add custom elements at span/div positions + each(children, function(element, elmName) { + if (element[cloneName]) { + children[elmName] = element = extend({}, children[elmName]); + element[name] = element[cloneName]; + } + }); + }); + } + } + + // Adds valid children to the schema object + function addValidChildren(validChildren) { + var childRuleRegExp = /^([+\-]?)(\w+)\[([^\]]+)\]$/; + + if (validChildren) { + each(split(validChildren, ','), function(rule) { + var matches = childRuleRegExp.exec(rule), parent, prefix; + + if (matches) { + prefix = matches[1]; + + // Add/remove items from default + if (prefix) { + parent = children[matches[2]]; + } else { + parent = children[matches[2]] = {'#comment': {}}; + } + + parent = children[matches[2]]; + + each(split(matches[3], '|'), function(child) { + if (prefix === '-') { + // Clone the element before we delete + // things in it to not mess up default schemas + children[matches[2]] = parent = extend({}, children[matches[2]]); + + delete parent[child]; + } else { + parent[child] = {}; + } + }); + } + }); + } + } + + function getElementRule(name) { + var element = elements[name], i; + + // Exact match found + if (element) { + return element; + } + + // No exact match then try the patterns + i = patternElements.length; + while (i--) { + element = patternElements[i]; + + if (element.pattern.test(name)) { + return element; + } + } + } + + if (!settings.valid_elements) { + // No valid elements defined then clone the elements from the schema spec + each(schemaItems, function(element, name) { + elements[name] = { + attributes: element.attributes, + attributesOrder: element.attributesOrder + }; + + children[name] = element.children; + }); + + // Switch these on HTML4 + if (settings.schema != "html5") { + each(split('strong/b em/i'), function(item) { + item = split(item, '/'); + elements[item[1]].outputName = item[0]; + }); + } + + // Add default alt attribute for images + elements.img.attributesDefault = [{name: 'alt', value: ''}]; + + // Remove these if they are empty by default + each(split('ol ul sub sup blockquote span font a table tbody tr strong em b i'), function(name) { + if (elements[name]) { + elements[name].removeEmpty = true; + } + }); + + // Padd these by default + each(split('p h1 h2 h3 h4 h5 h6 th td pre div address caption'), function(name) { + elements[name].paddEmpty = true; + }); + + // Remove these if they have no attributes + each(split('span'), function(name) { + elements[name].removeEmptyAttrs = true; + }); + + // Remove these by default + // TODO: Reenable in 4.1 + /*each(split('script style'), function(name) { + delete elements[name]; + });*/ + } else { + setValidElements(settings.valid_elements); + } + + addCustomElements(settings.custom_elements); + addValidChildren(settings.valid_children); + addValidElements(settings.extended_valid_elements); + + // Todo: Remove this when we fix list handling to be valid + addValidChildren('+ol[ul|ol],+ul[ul|ol]'); + + // Delete invalid elements + if (settings.invalid_elements) { + each(explode(settings.invalid_elements), function(item) { + if (elements[item]) { + delete elements[item]; + } + }); + } + + // If the user didn't allow span only allow internal spans + if (!getElementRule('span')) { + addValidElements('span[!data-mce-type|*]'); + } + + /** + * Name/value map object with valid parents and children to those parents. + * + * @example + * children = { + * div:{p:{}, h1:{}} + * }; + * @field children + * @type Object + */ + self.children = children; + + /** + * Name/value map object with valid styles for each element. + * + * @method getValidStyles + * @type Object + */ + self.getValidStyles = function() { + return validStyles; + }; + + /** + * Name/value map object with valid styles for each element. + * + * @method getInvalidStyles + * @type Object + */ + self.getInvalidStyles = function() { + return invalidStyles; + }; + + /** + * Name/value map object with valid classes for each element. + * + * @method getValidClasses + * @type Object + */ + self.getValidClasses = function() { + return validClasses; + }; + + /** + * Returns a map with boolean attributes. + * + * @method getBoolAttrs + * @return {Object} Name/value lookup map for boolean attributes. + */ + self.getBoolAttrs = function() { + return boolAttrMap; + }; + + /** + * Returns a map with block elements. + * + * @method getBlockElements + * @return {Object} Name/value lookup map for block elements. + */ + self.getBlockElements = function() { + return blockElementsMap; + }; + + /** + * Returns a map with text block elements. Such as: p,h1-h6,div,address + * + * @method getTextBlockElements + * @return {Object} Name/value lookup map for block elements. + */ + self.getTextBlockElements = function() { + return textBlockElementsMap; + }; + + /** + * Returns a map of inline text format nodes for example strong/span or ins. + * + * @method getTextInlineElements + * @return {Object} Name/value lookup map for text format elements. + */ + self.getTextInlineElements = function() { + return textInlineElementsMap; + }; + + /** + * Returns a map with short ended elements such as BR or IMG. + * + * @method getShortEndedElements + * @return {Object} Name/value lookup map for short ended elements. + */ + self.getShortEndedElements = function() { + return shortEndedElementsMap; + }; + + /** + * Returns a map with self closing tags such as
  • . + * + * @method getSelfClosingElements + * @return {Object} Name/value lookup map for self closing tags elements. + */ + self.getSelfClosingElements = function() { + return selfClosingElementsMap; + }; + + /** + * Returns a map with elements that should be treated as contents regardless if it has text + * content in them or not such as TD, VIDEO or IMG. + * + * @method getNonEmptyElements + * @return {Object} Name/value lookup map for non empty elements. + */ + self.getNonEmptyElements = function() { + return nonEmptyElementsMap; + }; + + /** + * Returns a map with elements that the caret should be moved in front of after enter is + * pressed + * + * @method getMoveCaretBeforeOnEnterElements + * @return {Object} Name/value lookup map for elements to place the caret in front of. + */ + self.getMoveCaretBeforeOnEnterElements = function() { + return moveCaretBeforeOnEnterElementsMap; + }; + + /** + * Returns a map with elements where white space is to be preserved like PRE or SCRIPT. + * + * @method getWhiteSpaceElements + * @return {Object} Name/value lookup map for white space elements. + */ + self.getWhiteSpaceElements = function() { + return whiteSpaceElementsMap; + }; + + /** + * Returns a map with special elements. These are elements that needs to be parsed + * in a special way such as script, style, textarea etc. The map object values + * are regexps used to find the end of the element. + * + * @method getSpecialElements + * @return {Object} Name/value lookup map for special elements. + */ + self.getSpecialElements = function() { + return specialElements; + }; + + /** + * Returns true/false if the specified element and it's child is valid or not + * according to the schema. + * + * @method isValidChild + * @param {String} name Element name to check for. + * @param {String} child Element child to verify. + * @return {Boolean} True/false if the element is a valid child of the specified parent. + */ + self.isValidChild = function(name, child) { + var parent = children[name]; + + return !!(parent && parent[child]); + }; + + /** + * Returns true/false if the specified element name and optional attribute is + * valid according to the schema. + * + * @method isValid + * @param {String} name Name of element to check. + * @param {String} attr Optional attribute name to check for. + * @return {Boolean} True/false if the element and attribute is valid. + */ + self.isValid = function(name, attr) { + var attrPatterns, i, rule = getElementRule(name); + + // Check if it's a valid element + if (rule) { + if (attr) { + // Check if attribute name exists + if (rule.attributes[attr]) { + return true; + } + + // Check if attribute matches a regexp pattern + attrPatterns = rule.attributePatterns; + if (attrPatterns) { + i = attrPatterns.length; + while (i--) { + if (attrPatterns[i].pattern.test(name)) { + return true; + } + } + } + } else { + return true; + } + } + + // No match + return false; + }; + + /** + * Returns true/false if the specified element is valid or not + * according to the schema. + * + * @method getElementRule + * @param {String} name Element name to check for. + * @return {Object} Element object or undefined if the element isn't valid. + */ + self.getElementRule = getElementRule; + + /** + * Returns an map object of all custom elements. + * + * @method getCustomElements + * @return {Object} Name/value map object of all custom elements. + */ + self.getCustomElements = function() { + return customElementsMap; + }; + + /** + * Parses a valid elements string and adds it to the schema. The valid elements + * format is for example "element[attr=default|otherattr]". + * Existing rules will be replaced with the ones specified, so this extends the schema. + * + * @method addValidElements + * @param {String} valid_elements String in the valid elements format to be parsed. + */ + self.addValidElements = addValidElements; + + /** + * Parses a valid elements string and sets it to the schema. The valid elements + * format is for example "element[attr=default|otherattr]". + * Existing rules will be replaced with the ones specified, so this extends the schema. + * + * @method setValidElements + * @param {String} valid_elements String in the valid elements format to be parsed. + */ + self.setValidElements = setValidElements; + + /** + * Adds custom non HTML elements to the schema. + * + * @method addCustomElements + * @param {String} custom_elements Comma separated list of custom elements to add. + */ + self.addCustomElements = addCustomElements; + + /** + * Parses a valid children string and adds them to the schema structure. The valid children + * format is for example: "element[child1|child2]". + * + * @method addValidChildren + * @param {String} valid_children Valid children elements string to parse + */ + self.addValidChildren = addValidChildren; + + self.elements = elements; + }; +}); + +// Included from: js/tinymce/classes/html/SaxParser.js + +/** + * SaxParser.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*eslint max-depth:[2, 9] */ + +/** + * This class parses HTML code using pure JavaScript and executes various events for each item it finds. It will + * always execute the events in the right order for tag soup code like

    . It will also remove elements + * and attributes that doesn't fit the schema if the validate setting is enabled. + * + * @example + * var parser = new tinymce.html.SaxParser({ + * validate: true, + * + * comment: function(text) { + * console.log('Comment:', text); + * }, + * + * cdata: function(text) { + * console.log('CDATA:', text); + * }, + * + * text: function(text, raw) { + * console.log('Text:', text, 'Raw:', raw); + * }, + * + * start: function(name, attrs, empty) { + * console.log('Start:', name, attrs, empty); + * }, + * + * end: function(name) { + * console.log('End:', name); + * }, + * + * pi: function(name, text) { + * console.log('PI:', name, text); + * }, + * + * doctype: function(text) { + * console.log('DocType:', text); + * } + * }, schema); + * @class tinymce.html.SaxParser + * @version 3.4 + */ +define("tinymce/html/SaxParser", [ + "tinymce/html/Schema", + "tinymce/html/Entities", + "tinymce/util/Tools" +], function(Schema, Entities, Tools) { + var each = Tools.each; + + /** + * Returns the index of the end tag for a specific start tag. This can be + * used to skip all children of a parent element from being processed. + * + * @private + * @method findEndTag + * @param {tinymce.html.Schema} schema Schema instance to use to match short ended elements. + * @param {String} html HTML string to find the end tag in. + * @param {Number} startIndex Indext to start searching at should be after the start tag. + * @return {Number} Index of the end tag. + */ + function findEndTag(schema, html, startIndex) { + var count = 1, index, matches, tokenRegExp, shortEndedElements; + + shortEndedElements = schema.getShortEndedElements(); + tokenRegExp = /<([!?\/])?([A-Za-z0-9\-_\:\.]+)((?:\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\/|\s+)>/g; + tokenRegExp.lastIndex = index = startIndex; + + while ((matches = tokenRegExp.exec(html))) { + index = tokenRegExp.lastIndex; + + if (matches[1] === '/') { // End element + count--; + } else if (!matches[1]) { // Start element + if (matches[2] in shortEndedElements) { + continue; + } + + count++; + } + + if (count === 0) { + break; + } + } + + return index; + } + + /** + * Constructs a new SaxParser instance. + * + * @constructor + * @method SaxParser + * @param {Object} settings Name/value collection of settings. comment, cdata, text, start and end are callbacks. + * @param {tinymce.html.Schema} schema HTML Schema class to use when parsing. + */ + function SaxParser(settings, schema) { + var self = this; + + function noop() {} + + settings = settings || {}; + self.schema = schema = schema || new Schema(); + + if (settings.fix_self_closing !== false) { + settings.fix_self_closing = true; + } + + // Add handler functions from settings and setup default handlers + each('comment cdata text start end pi doctype'.split(' '), function(name) { + if (name) { + self[name] = settings[name] || noop; + } + }); + + /** + * Parses the specified HTML string and executes the callbacks for each item it finds. + * + * @example + * new SaxParser({...}).parse('text'); + * @method parse + * @param {String} html Html string to sax parse. + */ + self.parse = function(html) { + var self = this, matches, index = 0, value, endRegExp, stack = [], attrList, i, text, name; + var isInternalElement, removeInternalElements, shortEndedElements, fillAttrsMap, isShortEnded; + var validate, elementRule, isValidElement, attr, attribsValue, validAttributesMap, validAttributePatterns; + var attributesRequired, attributesDefault, attributesForced; + var anyAttributesRequired, selfClosing, tokenRegExp, attrRegExp, specialElements, attrValue, idCount = 0; + var decode = Entities.decode, fixSelfClosing, filteredUrlAttrs = Tools.makeMap('src,href,data,background,formaction,poster'); + var scriptUriRegExp = /((java|vb)script|mhtml):/i, dataUriRegExp = /^data:/i; + + function processEndTag(name) { + var pos, i; + + // Find position of parent of the same type + pos = stack.length; + while (pos--) { + if (stack[pos].name === name) { + break; + } + } + + // Found parent + if (pos >= 0) { + // Close all the open elements + for (i = stack.length - 1; i >= pos; i--) { + name = stack[i]; + + if (name.valid) { + self.end(name.name); + } + } + + // Remove the open elements from the stack + stack.length = pos; + } + } + + function parseAttribute(match, name, value, val2, val3) { + var attrRule, i, trimRegExp = /[\s\u0000-\u001F]+/g; + + name = name.toLowerCase(); + value = name in fillAttrsMap ? name : decode(value || val2 || val3 || ''); // Handle boolean attribute than value attribute + + // Validate name and value pass through all data- attributes + if (validate && !isInternalElement && name.indexOf('data-') !== 0) { + attrRule = validAttributesMap[name]; + + // Find rule by pattern matching + if (!attrRule && validAttributePatterns) { + i = validAttributePatterns.length; + while (i--) { + attrRule = validAttributePatterns[i]; + if (attrRule.pattern.test(name)) { + break; + } + } + + // No rule matched + if (i === -1) { + attrRule = null; + } + } + + // No attribute rule found + if (!attrRule) { + return; + } + + // Validate value + if (attrRule.validValues && !(value in attrRule.validValues)) { + return; + } + } + + // Block any javascript: urls or non image data uris + if (filteredUrlAttrs[name] && !settings.allow_script_urls) { + var uri = value.replace(trimRegExp, ''); + + try { + // Might throw malformed URI sequence + uri = decodeURIComponent(uri); + } catch (ex) { + // Fallback to non UTF-8 decoder + uri = unescape(uri); + } + + if (scriptUriRegExp.test(uri)) { + return; + } + + if (!settings.allow_html_data_urls && dataUriRegExp.test(uri) && !/^data:image\//i.test(uri)) { + return; + } + } + + // Add attribute to list and map + attrList.map[name] = value; + attrList.push({ + name: name, + value: value + }); + } + + // Precompile RegExps and map objects + tokenRegExp = new RegExp('<(?:' + + '(?:!--([\\w\\W]*?)-->)|' + // Comment + '(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|' + // CDATA + '(?:!DOCTYPE([\\w\\W]*?)>)|' + // DOCTYPE + '(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + // PI + '(?:\\/([^>]+)>)|' + // End element + '(?:([A-Za-z0-9\\-_\\:\\.]+)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/|\\s+)>)' + // Start element + ')', 'g'); + + attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g; + + // Setup lookup tables for empty elements and boolean attributes + shortEndedElements = schema.getShortEndedElements(); + selfClosing = settings.self_closing_elements || schema.getSelfClosingElements(); + fillAttrsMap = schema.getBoolAttrs(); + validate = settings.validate; + removeInternalElements = settings.remove_internals; + fixSelfClosing = settings.fix_self_closing; + specialElements = schema.getSpecialElements(); + + while ((matches = tokenRegExp.exec(html))) { + // Text + if (index < matches.index) { + self.text(decode(html.substr(index, matches.index - index))); + } + + if ((value = matches[6])) { // End element + value = value.toLowerCase(); + + // IE will add a ":" in front of elements it doesn't understand like custom elements or HTML5 elements + if (value.charAt(0) === ':') { + value = value.substr(1); + } + + processEndTag(value); + } else if ((value = matches[7])) { // Start element + value = value.toLowerCase(); + + // IE will add a ":" in front of elements it doesn't understand like custom elements or HTML5 elements + if (value.charAt(0) === ':') { + value = value.substr(1); + } + + isShortEnded = value in shortEndedElements; + + // Is self closing tag for example an
  • after an open
  • + if (fixSelfClosing && selfClosing[value] && stack.length > 0 && stack[stack.length - 1].name === value) { + processEndTag(value); + } + + // Validate element + if (!validate || (elementRule = schema.getElementRule(value))) { + isValidElement = true; + + // Grab attributes map and patters when validation is enabled + if (validate) { + validAttributesMap = elementRule.attributes; + validAttributePatterns = elementRule.attributePatterns; + } + + // Parse attributes + if ((attribsValue = matches[8])) { + isInternalElement = attribsValue.indexOf('data-mce-type') !== -1; // Check if the element is an internal element + + // If the element has internal attributes then remove it if we are told to do so + if (isInternalElement && removeInternalElements) { + isValidElement = false; + } + + attrList = []; + attrList.map = {}; + + attribsValue.replace(attrRegExp, parseAttribute); + } else { + attrList = []; + attrList.map = {}; + } + + // Process attributes if validation is enabled + if (validate && !isInternalElement) { + attributesRequired = elementRule.attributesRequired; + attributesDefault = elementRule.attributesDefault; + attributesForced = elementRule.attributesForced; + anyAttributesRequired = elementRule.removeEmptyAttrs; + + // Check if any attribute exists + if (anyAttributesRequired && !attrList.length) { + isValidElement = false; + } + + // Handle forced attributes + if (attributesForced) { + i = attributesForced.length; + while (i--) { + attr = attributesForced[i]; + name = attr.name; + attrValue = attr.value; + + if (attrValue === '{$uid}') { + attrValue = 'mce_' + idCount++; + } + + attrList.map[name] = attrValue; + attrList.push({name: name, value: attrValue}); + } + } + + // Handle default attributes + if (attributesDefault) { + i = attributesDefault.length; + while (i--) { + attr = attributesDefault[i]; + name = attr.name; + + if (!(name in attrList.map)) { + attrValue = attr.value; + + if (attrValue === '{$uid}') { + attrValue = 'mce_' + idCount++; + } + + attrList.map[name] = attrValue; + attrList.push({name: name, value: attrValue}); + } + } + } + + // Handle required attributes + if (attributesRequired) { + i = attributesRequired.length; + while (i--) { + if (attributesRequired[i] in attrList.map) { + break; + } + } + + // None of the required attributes where found + if (i === -1) { + isValidElement = false; + } + } + + // Invalidate element if it's marked as bogus + if ((attr = attrList.map['data-mce-bogus'])) { + if (attr === 'all') { + index = findEndTag(schema, html, tokenRegExp.lastIndex); + tokenRegExp.lastIndex = index; + continue; + } + + isValidElement = false; + } + } + + if (isValidElement) { + self.start(value, attrList, isShortEnded); + } + } else { + isValidElement = false; + } + + // Treat script, noscript and style a bit different since they may include code that looks like elements + if ((endRegExp = specialElements[value])) { + endRegExp.lastIndex = index = matches.index + matches[0].length; + + if ((matches = endRegExp.exec(html))) { + if (isValidElement) { + text = html.substr(index, matches.index - index); + } + + index = matches.index + matches[0].length; + } else { + text = html.substr(index); + index = html.length; + } + + if (isValidElement) { + if (text.length > 0) { + self.text(text, true); + } + + self.end(value); + } + + tokenRegExp.lastIndex = index; + continue; + } + + // Push value on to stack + if (!isShortEnded) { + if (!attribsValue || attribsValue.indexOf('/') != attribsValue.length - 1) { + stack.push({name: value, valid: isValidElement}); + } else if (isValidElement) { + self.end(value); + } + } + } else if ((value = matches[1])) { // Comment + // Padd comment value to avoid browsers from parsing invalid comments as HTML + if (value.charAt(0) === '>') { + value = ' ' + value; + } + + if (!settings.allow_conditional_comments && value.substr(0, 3) === '[if') { + value = ' ' + value; + } + + self.comment(value); + } else if ((value = matches[2])) { // CDATA + self.cdata(value); + } else if ((value = matches[3])) { // DOCTYPE + self.doctype(value); + } else if ((value = matches[4])) { // PI + self.pi(value, matches[5]); + } + + index = matches.index + matches[0].length; + } + + // Text + if (index < html.length) { + self.text(decode(html.substr(index))); + } + + // Close any open elements + for (i = stack.length - 1; i >= 0; i--) { + value = stack[i]; + + if (value.valid) { + self.end(value.name); + } + } + }; + } + + SaxParser.findEndTag = findEndTag; + + return SaxParser; +}); + +// Included from: js/tinymce/classes/html/DomParser.js + +/** + * DomParser.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class parses HTML code into a DOM like structure of nodes it will remove redundant whitespace and make + * sure that the node tree is valid according to the specified schema. + * So for example:

    a

    b

    c

    will become

    a

    b

    c

    + * + * @example + * var parser = new tinymce.html.DomParser({validate: true}, schema); + * var rootNode = parser.parse('

    content

    '); + * + * @class tinymce.html.DomParser + * @version 3.4 + */ +define("tinymce/html/DomParser", [ + "tinymce/html/Node", + "tinymce/html/Schema", + "tinymce/html/SaxParser", + "tinymce/util/Tools" +], function(Node, Schema, SaxParser, Tools) { + var makeMap = Tools.makeMap, each = Tools.each, explode = Tools.explode, extend = Tools.extend; + + /** + * Constructs a new DomParser instance. + * + * @constructor + * @method DomParser + * @param {Object} settings Name/value collection of settings. comment, cdata, text, start and end are callbacks. + * @param {tinymce.html.Schema} schema HTML Schema class to use when parsing. + */ + return function(settings, schema) { + var self = this, nodeFilters = {}, attributeFilters = [], matchedNodes = {}, matchedAttributes = {}; + + settings = settings || {}; + settings.validate = "validate" in settings ? settings.validate : true; + settings.root_name = settings.root_name || 'body'; + self.schema = schema = schema || new Schema(); + + function fixInvalidChildren(nodes) { + var ni, node, parent, parents, newParent, currentNode, tempNode, childNode, i; + var nonEmptyElements, nonSplitableElements, textBlockElements, sibling, nextNode; + + nonSplitableElements = makeMap('tr,td,th,tbody,thead,tfoot,table'); + nonEmptyElements = schema.getNonEmptyElements(); + textBlockElements = schema.getTextBlockElements(); + + for (ni = 0; ni < nodes.length; ni++) { + node = nodes[ni]; + + // Already removed or fixed + if (!node.parent || node.fixed) { + continue; + } + + // If the invalid element is a text block and the text block is within a parent LI element + // Then unwrap the first text block and convert other sibling text blocks to LI elements similar to Word/Open Office + if (textBlockElements[node.name] && node.parent.name == 'li') { + // Move sibling text blocks after LI element + sibling = node.next; + while (sibling) { + if (textBlockElements[sibling.name]) { + sibling.name = 'li'; + sibling.fixed = true; + node.parent.insert(sibling, node.parent); + } else { + break; + } + + sibling = sibling.next; + } + + // Unwrap current text block + node.unwrap(node); + continue; + } + + // Get list of all parent nodes until we find a valid parent to stick the child into + parents = [node]; + for (parent = node.parent; parent && !schema.isValidChild(parent.name, node.name) && + !nonSplitableElements[parent.name]; parent = parent.parent) { + parents.push(parent); + } + + // Found a suitable parent + if (parent && parents.length > 1) { + // Reverse the array since it makes looping easier + parents.reverse(); + + // Clone the related parent and insert that after the moved node + newParent = currentNode = self.filterNode(parents[0].clone()); + + // Start cloning and moving children on the left side of the target node + for (i = 0; i < parents.length - 1; i++) { + if (schema.isValidChild(currentNode.name, parents[i].name)) { + tempNode = self.filterNode(parents[i].clone()); + currentNode.append(tempNode); + } else { + tempNode = currentNode; + } + + for (childNode = parents[i].firstChild; childNode && childNode != parents[i + 1];) { + nextNode = childNode.next; + tempNode.append(childNode); + childNode = nextNode; + } + + currentNode = tempNode; + } + + if (!newParent.isEmpty(nonEmptyElements)) { + parent.insert(newParent, parents[0], true); + parent.insert(node, newParent); + } else { + parent.insert(node, parents[0], true); + } + + // Check if the element is empty by looking through it's contents and special treatment for


    + parent = parents[0]; + if (parent.isEmpty(nonEmptyElements) || parent.firstChild === parent.lastChild && parent.firstChild.name === 'br') { + parent.empty().remove(); + } + } else if (node.parent) { + // If it's an LI try to find a UL/OL for it or wrap it + if (node.name === 'li') { + sibling = node.prev; + if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) { + sibling.append(node); + continue; + } + + sibling = node.next; + if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) { + sibling.insert(node, sibling.firstChild, true); + continue; + } + + node.wrap(self.filterNode(new Node('ul', 1))); + continue; + } + + // Try wrapping the element in a DIV + if (schema.isValidChild(node.parent.name, 'div') && schema.isValidChild('div', node.name)) { + node.wrap(self.filterNode(new Node('div', 1))); + } else { + // We failed wrapping it, then remove or unwrap it + if (node.name === 'style' || node.name === 'script') { + node.empty().remove(); + } else { + node.unwrap(); + } + } + } + } + } + + /** + * Runs the specified node though the element and attributes filters. + * + * @method filterNode + * @param {tinymce.html.Node} Node the node to run filters on. + * @return {tinymce.html.Node} The passed in node. + */ + self.filterNode = function(node) { + var i, name, list; + + // Run element filters + if (name in nodeFilters) { + list = matchedNodes[name]; + + if (list) { + list.push(node); + } else { + matchedNodes[name] = [node]; + } + } + + // Run attribute filters + i = attributeFilters.length; + while (i--) { + name = attributeFilters[i].name; + + if (name in node.attributes.map) { + list = matchedAttributes[name]; + + if (list) { + list.push(node); + } else { + matchedAttributes[name] = [node]; + } + } + } + + return node; + }; + + /** + * Adds a node filter function to the parser, the parser will collect the specified nodes by name + * and then execute the callback ones it has finished parsing the document. + * + * @example + * parser.addNodeFilter('p,h1', function(nodes, name) { + * for (var i = 0; i < nodes.length; i++) { + * console.log(nodes[i].name); + * } + * }); + * @method addNodeFilter + * @method {String} name Comma separated list of nodes to collect. + * @param {function} callback Callback function to execute once it has collected nodes. + */ + self.addNodeFilter = function(name, callback) { + each(explode(name), function(name) { + var list = nodeFilters[name]; + + if (!list) { + nodeFilters[name] = list = []; + } + + list.push(callback); + }); + }; + + /** + * Adds a attribute filter function to the parser, the parser will collect nodes that has the specified attributes + * and then execute the callback ones it has finished parsing the document. + * + * @example + * parser.addAttributeFilter('src,href', function(nodes, name) { + * for (var i = 0; i < nodes.length; i++) { + * console.log(nodes[i].name); + * } + * }); + * @method addAttributeFilter + * @method {String} name Comma separated list of nodes to collect. + * @param {function} callback Callback function to execute once it has collected nodes. + */ + self.addAttributeFilter = function(name, callback) { + each(explode(name), function(name) { + var i; + + for (i = 0; i < attributeFilters.length; i++) { + if (attributeFilters[i].name === name) { + attributeFilters[i].callbacks.push(callback); + return; + } + } + + attributeFilters.push({name: name, callbacks: [callback]}); + }); + }; + + /** + * Parses the specified HTML string into a DOM like node tree and returns the result. + * + * @example + * var rootNode = new DomParser({...}).parse('text'); + * @method parse + * @param {String} html Html string to sax parse. + * @param {Object} args Optional args object that gets passed to all filter functions. + * @return {tinymce.html.Node} Root node containing the tree. + */ + self.parse = function(html, args) { + var parser, rootNode, node, nodes, i, l, fi, fl, list, name, validate; + var blockElements, startWhiteSpaceRegExp, invalidChildren = [], isInWhiteSpacePreservedElement; + var endWhiteSpaceRegExp, allWhiteSpaceRegExp, isAllWhiteSpaceRegExp, whiteSpaceElements; + var children, nonEmptyElements, rootBlockName; + + args = args || {}; + matchedNodes = {}; + matchedAttributes = {}; + blockElements = extend(makeMap('script,style,head,html,body,title,meta,param'), schema.getBlockElements()); + nonEmptyElements = schema.getNonEmptyElements(); + children = schema.children; + validate = settings.validate; + rootBlockName = "forced_root_block" in args ? args.forced_root_block : settings.forced_root_block; + + whiteSpaceElements = schema.getWhiteSpaceElements(); + startWhiteSpaceRegExp = /^[ \t\r\n]+/; + endWhiteSpaceRegExp = /[ \t\r\n]+$/; + allWhiteSpaceRegExp = /[ \t\r\n]+/g; + isAllWhiteSpaceRegExp = /^[ \t\r\n]+$/; + + function addRootBlocks() { + var node = rootNode.firstChild, next, rootBlockNode; + + // Removes whitespace at beginning and end of block so: + //

    x

    ->

    x

    + function trim(rootBlockNode) { + if (rootBlockNode) { + node = rootBlockNode.firstChild; + if (node && node.type == 3) { + node.value = node.value.replace(startWhiteSpaceRegExp, ''); + } + + node = rootBlockNode.lastChild; + if (node && node.type == 3) { + node.value = node.value.replace(endWhiteSpaceRegExp, ''); + } + } + } + + // Check if rootBlock is valid within rootNode for example if P is valid in H1 if H1 is the contentEditabe root + if (!schema.isValidChild(rootNode.name, rootBlockName.toLowerCase())) { + return; + } + + while (node) { + next = node.next; + + if (node.type == 3 || (node.type == 1 && node.name !== 'p' && + !blockElements[node.name] && !node.attr('data-mce-type'))) { + if (!rootBlockNode) { + // Create a new root block element + rootBlockNode = createNode(rootBlockName, 1); + rootBlockNode.attr(settings.forced_root_block_attrs); + rootNode.insert(rootBlockNode, node); + rootBlockNode.append(node); + } else { + rootBlockNode.append(node); + } + } else { + trim(rootBlockNode); + rootBlockNode = null; + } + + node = next; + } + + trim(rootBlockNode); + } + + function createNode(name, type) { + var node = new Node(name, type), list; + + if (name in nodeFilters) { + list = matchedNodes[name]; + + if (list) { + list.push(node); + } else { + matchedNodes[name] = [node]; + } + } + + return node; + } + + function removeWhitespaceBefore(node) { + var textNode, textVal, sibling; + + for (textNode = node.prev; textNode && textNode.type === 3;) { + textVal = textNode.value.replace(endWhiteSpaceRegExp, ''); + + if (textVal.length > 0) { + textNode.value = textVal; + textNode = textNode.prev; + } else { + sibling = textNode.prev; + textNode.remove(); + textNode = sibling; + } + } + } + + function cloneAndExcludeBlocks(input) { + var name, output = {}; + + for (name in input) { + if (name !== 'li' && name != 'p') { + output[name] = input[name]; + } + } + + return output; + } + + parser = new SaxParser({ + validate: validate, + allow_script_urls: settings.allow_script_urls, + allow_conditional_comments: settings.allow_conditional_comments, + + // Exclude P and LI from DOM parsing since it's treated better by the DOM parser + self_closing_elements: cloneAndExcludeBlocks(schema.getSelfClosingElements()), + + cdata: function(text) { + node.append(createNode('#cdata', 4)).value = text; + }, + + text: function(text, raw) { + var textNode; + + // Trim all redundant whitespace on non white space elements + if (!isInWhiteSpacePreservedElement) { + text = text.replace(allWhiteSpaceRegExp, ' '); + + if (node.lastChild && blockElements[node.lastChild.name]) { + text = text.replace(startWhiteSpaceRegExp, ''); + } + } + + // Do we need to create the node + if (text.length !== 0) { + textNode = createNode('#text', 3); + textNode.raw = !!raw; + node.append(textNode).value = text; + } + }, + + comment: function(text) { + node.append(createNode('#comment', 8)).value = text; + }, + + pi: function(name, text) { + node.append(createNode(name, 7)).value = text; + removeWhitespaceBefore(node); + }, + + doctype: function(text) { + var newNode; + + newNode = node.append(createNode('#doctype', 10)); + newNode.value = text; + removeWhitespaceBefore(node); + }, + + start: function(name, attrs, empty) { + var newNode, attrFiltersLen, elementRule, attrName, parent; + + elementRule = validate ? schema.getElementRule(name) : {}; + if (elementRule) { + newNode = createNode(elementRule.outputName || name, 1); + newNode.attributes = attrs; + newNode.shortEnded = empty; + + node.append(newNode); + + // Check if node is valid child of the parent node is the child is + // unknown we don't collect it since it's probably a custom element + parent = children[node.name]; + if (parent && children[newNode.name] && !parent[newNode.name]) { + invalidChildren.push(newNode); + } + + attrFiltersLen = attributeFilters.length; + while (attrFiltersLen--) { + attrName = attributeFilters[attrFiltersLen].name; + + if (attrName in attrs.map) { + list = matchedAttributes[attrName]; + + if (list) { + list.push(newNode); + } else { + matchedAttributes[attrName] = [newNode]; + } + } + } + + // Trim whitespace before block + if (blockElements[name]) { + removeWhitespaceBefore(newNode); + } + + // Change current node if the element wasn't empty i.e not
    or + if (!empty) { + node = newNode; + } + + // Check if we are inside a whitespace preserved element + if (!isInWhiteSpacePreservedElement && whiteSpaceElements[name]) { + isInWhiteSpacePreservedElement = true; + } + } + }, + + end: function(name) { + var textNode, elementRule, text, sibling, tempNode; + + elementRule = validate ? schema.getElementRule(name) : {}; + if (elementRule) { + if (blockElements[name]) { + if (!isInWhiteSpacePreservedElement) { + // Trim whitespace of the first node in a block + textNode = node.firstChild; + if (textNode && textNode.type === 3) { + text = textNode.value.replace(startWhiteSpaceRegExp, ''); + + // Any characters left after trim or should we remove it + if (text.length > 0) { + textNode.value = text; + textNode = textNode.next; + } else { + sibling = textNode.next; + textNode.remove(); + textNode = sibling; + + // Remove any pure whitespace siblings + while (textNode && textNode.type === 3) { + text = textNode.value; + sibling = textNode.next; + + if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) { + textNode.remove(); + textNode = sibling; + } + + textNode = sibling; + } + } + } + + // Trim whitespace of the last node in a block + textNode = node.lastChild; + if (textNode && textNode.type === 3) { + text = textNode.value.replace(endWhiteSpaceRegExp, ''); + + // Any characters left after trim or should we remove it + if (text.length > 0) { + textNode.value = text; + textNode = textNode.prev; + } else { + sibling = textNode.prev; + textNode.remove(); + textNode = sibling; + + // Remove any pure whitespace siblings + while (textNode && textNode.type === 3) { + text = textNode.value; + sibling = textNode.prev; + + if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) { + textNode.remove(); + textNode = sibling; + } + + textNode = sibling; + } + } + } + } + + // Trim start white space + // Removed due to: #5424 + /*textNode = node.prev; + if (textNode && textNode.type === 3) { + text = textNode.value.replace(startWhiteSpaceRegExp, ''); + + if (text.length > 0) + textNode.value = text; + else + textNode.remove(); + }*/ + } + + // Check if we exited a whitespace preserved element + if (isInWhiteSpacePreservedElement && whiteSpaceElements[name]) { + isInWhiteSpacePreservedElement = false; + } + + // Handle empty nodes + if (elementRule.removeEmpty || elementRule.paddEmpty) { + if (node.isEmpty(nonEmptyElements)) { + if (elementRule.paddEmpty) { + node.empty().append(new Node('#text', '3')).value = '\u00a0'; + } else { + // Leave nodes that have a name like + if (!node.attributes.map.name && !node.attributes.map.id) { + tempNode = node.parent; + + if (blockElements[node.name]) { + node.empty().remove(); + } else { + node.unwrap(); + } + + node = tempNode; + return; + } + } + } + } + + node = node.parent; + } + } + }, schema); + + rootNode = node = new Node(args.context || settings.root_name, 11); + + parser.parse(html); + + // Fix invalid children or report invalid children in a contextual parsing + if (validate && invalidChildren.length) { + if (!args.context) { + fixInvalidChildren(invalidChildren); + } else { + args.invalid = true; + } + } + + // Wrap nodes in the root into block elements if the root is body + if (rootBlockName && (rootNode.name == 'body' || args.isRootContent)) { + addRootBlocks(); + } + + // Run filters only when the contents is valid + if (!args.invalid) { + // Run node filters + for (name in matchedNodes) { + list = nodeFilters[name]; + nodes = matchedNodes[name]; + + // Remove already removed children + fi = nodes.length; + while (fi--) { + if (!nodes[fi].parent) { + nodes.splice(fi, 1); + } + } + + for (i = 0, l = list.length; i < l; i++) { + list[i](nodes, name, args); + } + } + + // Run attribute filters + for (i = 0, l = attributeFilters.length; i < l; i++) { + list = attributeFilters[i]; + + if (list.name in matchedAttributes) { + nodes = matchedAttributes[list.name]; + + // Remove already removed children + fi = nodes.length; + while (fi--) { + if (!nodes[fi].parent) { + nodes.splice(fi, 1); + } + } + + for (fi = 0, fl = list.callbacks.length; fi < fl; fi++) { + list.callbacks[fi](nodes, list.name, args); + } + } + } + } + + return rootNode; + }; + + // Remove
    at end of block elements Gecko and WebKit injects BR elements to + // make it possible to place the caret inside empty blocks. This logic tries to remove + // these elements and keep br elements that where intended to be there intact + if (settings.remove_trailing_brs) { + self.addNodeFilter('br', function(nodes) { + var i, l = nodes.length, node, blockElements = extend({}, schema.getBlockElements()); + var nonEmptyElements = schema.getNonEmptyElements(), parent, lastParent, prev, prevName; + var elementRule, textNode; + + // Remove brs from body element as well + blockElements.body = 1; + + // Must loop forwards since it will otherwise remove all brs in

    a


    + for (i = 0; i < l; i++) { + node = nodes[i]; + parent = node.parent; + + if (blockElements[node.parent.name] && node === parent.lastChild) { + // Loop all nodes to the left of the current node and check for other BR elements + // excluding bookmarks since they are invisible + prev = node.prev; + while (prev) { + prevName = prev.name; + + // Ignore bookmarks + if (prevName !== "span" || prev.attr('data-mce-type') !== 'bookmark') { + // Found a non BR element + if (prevName !== "br") { + break; + } + + // Found another br it's a

    structure then don't remove anything + if (prevName === 'br') { + node = null; + break; + } + } + + prev = prev.prev; + } + + if (node) { + node.remove(); + + // Is the parent to be considered empty after we removed the BR + if (parent.isEmpty(nonEmptyElements)) { + elementRule = schema.getElementRule(parent.name); + + // Remove or padd the element depending on schema rule + if (elementRule) { + if (elementRule.removeEmpty) { + parent.remove(); + } else if (elementRule.paddEmpty) { + parent.empty().append(new Node('#text', 3)).value = '\u00a0'; + } + } + } + } + } else { + // Replaces BR elements inside inline elements like


    + // so they become

     

    + lastParent = node; + while (parent && parent.firstChild === lastParent && parent.lastChild === lastParent) { + lastParent = parent; + + if (blockElements[parent.name]) { + break; + } + + parent = parent.parent; + } + + if (lastParent === parent) { + textNode = new Node('#text', 3); + textNode.value = '\u00a0'; + node.replace(textNode); + } + } + } + }); + } + + // Force anchor names closed, unless the setting "allow_html_in_named_anchor" is explicitly included. + if (!settings.allow_html_in_named_anchor) { + self.addAttributeFilter('id,name', function(nodes) { + var i = nodes.length, sibling, prevSibling, parent, node; + + while (i--) { + node = nodes[i]; + if (node.name === 'a' && node.firstChild && !node.attr('href')) { + parent = node.parent; + + // Move children after current node + sibling = node.lastChild; + do { + prevSibling = sibling.prev; + parent.insert(sibling, node); + sibling = prevSibling; + } while (sibling); + } + } + }); + } + + if (settings.validate && schema.getValidClasses()) { + self.addAttributeFilter('class', function(nodes) { + var i = nodes.length, node, classList, ci, className, classValue; + var validClasses = schema.getValidClasses(), validClassesMap, valid; + + while (i--) { + node = nodes[i]; + classList = node.attr('class').split(' '); + classValue = ''; + + for (ci = 0; ci < classList.length; ci++) { + className = classList[ci]; + valid = false; + + validClassesMap = validClasses['*']; + if (validClassesMap && validClassesMap[className]) { + valid = true; + } + + validClassesMap = validClasses[node.name]; + if (!valid && validClassesMap && validClassesMap[className]) { + valid = true; + } + + if (valid) { + if (classValue) { + classValue += ' '; + } + + classValue += className; + } + } + + if (!classValue.length) { + classValue = null; + } + + node.attr('class', classValue); + } + }); + } + }; +}); + +// Included from: js/tinymce/classes/html/Writer.js + +/** + * Writer.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to write HTML tags out it can be used with the Serializer or the SaxParser. + * + * @class tinymce.html.Writer + * @example + * var writer = new tinymce.html.Writer({indent: true}); + * var parser = new tinymce.html.SaxParser(writer).parse('


    '); + * console.log(writer.getContent()); + * + * @class tinymce.html.Writer + * @version 3.4 + */ +define("tinymce/html/Writer", [ + "tinymce/html/Entities", + "tinymce/util/Tools" +], function(Entities, Tools) { + var makeMap = Tools.makeMap; + + /** + * Constructs a new Writer instance. + * + * @constructor + * @method Writer + * @param {Object} settings Name/value settings object. + */ + return function(settings) { + var html = [], indent, indentBefore, indentAfter, encode, htmlOutput; + + settings = settings || {}; + indent = settings.indent; + indentBefore = makeMap(settings.indent_before || ''); + indentAfter = makeMap(settings.indent_after || ''); + encode = Entities.getEncodeFunc(settings.entity_encoding || 'raw', settings.entities); + htmlOutput = settings.element_format == "html"; + + return { + /** + * Writes the a start element such as

    . + * + * @method start + * @param {String} name Name of the element. + * @param {Array} attrs Optional attribute array or undefined if it hasn't any. + * @param {Boolean} empty Optional empty state if the tag should end like
    . + */ + start: function(name, attrs, empty) { + var i, l, attr, value; + + if (indent && indentBefore[name] && html.length > 0) { + value = html[html.length - 1]; + + if (value.length > 0 && value !== '\n') { + html.push('\n'); + } + } + + html.push('<', name); + + if (attrs) { + for (i = 0, l = attrs.length; i < l; i++) { + attr = attrs[i]; + html.push(' ', attr.name, '="', encode(attr.value, true), '"'); + } + } + + if (!empty || htmlOutput) { + html[html.length] = '>'; + } else { + html[html.length] = ' />'; + } + + if (empty && indent && indentAfter[name] && html.length > 0) { + value = html[html.length - 1]; + + if (value.length > 0 && value !== '\n') { + html.push('\n'); + } + } + }, + + /** + * Writes the a end element such as

    . + * + * @method end + * @param {String} name Name of the element. + */ + end: function(name) { + var value; + + /*if (indent && indentBefore[name] && html.length > 0) { + value = html[html.length - 1]; + + if (value.length > 0 && value !== '\n') + html.push('\n'); + }*/ + + html.push(''); + + if (indent && indentAfter[name] && html.length > 0) { + value = html[html.length - 1]; + + if (value.length > 0 && value !== '\n') { + html.push('\n'); + } + } + }, + + /** + * Writes a text node. + * + * @method text + * @param {String} text String to write out. + * @param {Boolean} raw Optional raw state if true the contents wont get encoded. + */ + text: function(text, raw) { + if (text.length > 0) { + html[html.length] = raw ? text : encode(text); + } + }, + + /** + * Writes a cdata node such as . + * + * @method cdata + * @param {String} text String to write out inside the cdata. + */ + cdata: function(text) { + html.push(''); + }, + + /** + * Writes a comment node such as . + * + * @method cdata + * @param {String} text String to write out inside the comment. + */ + comment: function(text) { + html.push(''); + }, + + /** + * Writes a PI node such as . + * + * @method pi + * @param {String} name Name of the pi. + * @param {String} text String to write out inside the pi. + */ + pi: function(name, text) { + if (text) { + html.push(''); + } else { + html.push(''); + } + + if (indent) { + html.push('\n'); + } + }, + + /** + * Writes a doctype node such as . + * + * @method doctype + * @param {String} text String to write out inside the doctype. + */ + doctype: function(text) { + html.push('', indent ? '\n' : ''); + }, + + /** + * Resets the internal buffer if one wants to reuse the writer. + * + * @method reset + */ + reset: function() { + html.length = 0; + }, + + /** + * Returns the contents that got serialized. + * + * @method getContent + * @return {String} HTML contents that got written down. + */ + getContent: function() { + return html.join('').replace(/\n$/, ''); + } + }; + }; +}); + +// Included from: js/tinymce/classes/html/Serializer.js + +/** + * Serializer.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to serialize down the DOM tree into a string using a Writer instance. + * + * + * @example + * new tinymce.html.Serializer().serialize(new tinymce.html.DomParser().parse('

    text

    ')); + * @class tinymce.html.Serializer + * @version 3.4 + */ +define("tinymce/html/Serializer", [ + "tinymce/html/Writer", + "tinymce/html/Schema" +], function(Writer, Schema) { + /** + * Constructs a new Serializer instance. + * + * @constructor + * @method Serializer + * @param {Object} settings Name/value settings object. + * @param {tinymce.html.Schema} schema Schema instance to use. + */ + return function(settings, schema) { + var self = this, writer = new Writer(settings); + + settings = settings || {}; + settings.validate = "validate" in settings ? settings.validate : true; + + self.schema = schema = schema || new Schema(); + self.writer = writer; + + /** + * Serializes the specified node into a string. + * + * @example + * new tinymce.html.Serializer().serialize(new tinymce.html.DomParser().parse('

    text

    ')); + * @method serialize + * @param {tinymce.html.Node} node Node instance to serialize. + * @return {String} String with HTML based on DOM tree. + */ + self.serialize = function(node) { + var handlers, validate; + + validate = settings.validate; + + handlers = { + // #text + 3: function(node) { + writer.text(node.value, node.raw); + }, + + // #comment + 8: function(node) { + writer.comment(node.value); + }, + + // Processing instruction + 7: function(node) { + writer.pi(node.name, node.value); + }, + + // Doctype + 10: function(node) { + writer.doctype(node.value); + }, + + // CDATA + 4: function(node) { + writer.cdata(node.value); + }, + + // Document fragment + 11: function(node) { + if ((node = node.firstChild)) { + do { + walk(node); + } while ((node = node.next)); + } + } + }; + + writer.reset(); + + function walk(node) { + var handler = handlers[node.type], name, isEmpty, attrs, attrName, attrValue, sortedAttrs, i, l, elementRule; + + if (!handler) { + name = node.name; + isEmpty = node.shortEnded; + attrs = node.attributes; + + // Sort attributes + if (validate && attrs && attrs.length > 1) { + sortedAttrs = []; + sortedAttrs.map = {}; + + elementRule = schema.getElementRule(node.name); + for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) { + attrName = elementRule.attributesOrder[i]; + + if (attrName in attrs.map) { + attrValue = attrs.map[attrName]; + sortedAttrs.map[attrName] = attrValue; + sortedAttrs.push({name: attrName, value: attrValue}); + } + } + + for (i = 0, l = attrs.length; i < l; i++) { + attrName = attrs[i].name; + + if (!(attrName in sortedAttrs.map)) { + attrValue = attrs.map[attrName]; + sortedAttrs.map[attrName] = attrValue; + sortedAttrs.push({name: attrName, value: attrValue}); + } + } + + attrs = sortedAttrs; + } + + writer.start(node.name, attrs, isEmpty); + + if (!isEmpty) { + if ((node = node.firstChild)) { + do { + walk(node); + } while ((node = node.next)); + } + + writer.end(name); + } + } else { + handler(node); + } + } + + // Serialize element and treat all non elements as fragments + if (node.type == 1 && !settings.inner) { + walk(node); + } else { + handlers[11](node); + } + + return writer.getContent(); + }; + }; +}); + +// Included from: js/tinymce/classes/dom/Serializer.js + +/** + * Serializer.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to serialize DOM trees into a string. Consult the TinyMCE Wiki API for + * more details and examples on how to use this class. + * + * @class tinymce.dom.Serializer + */ +define("tinymce/dom/Serializer", [ + "tinymce/dom/DOMUtils", + "tinymce/html/DomParser", + "tinymce/html/Entities", + "tinymce/html/Serializer", + "tinymce/html/Node", + "tinymce/html/Schema", + "tinymce/Env", + "tinymce/util/Tools" +], function(DOMUtils, DomParser, Entities, Serializer, Node, Schema, Env, Tools) { + var each = Tools.each, trim = Tools.trim; + var DOM = DOMUtils.DOM; + + /** + * Constructs a new DOM serializer class. + * + * @constructor + * @method Serializer + * @param {Object} settings Serializer settings object. + * @param {tinymce.Editor} editor Optional editor to bind events to and get schema/dom from. + */ + return function(settings, editor) { + var dom, schema, htmlParser; + + if (editor) { + dom = editor.dom; + schema = editor.schema; + } + + // Default DOM and Schema if they are undefined + dom = dom || DOM; + schema = schema || new Schema(settings); + settings.entity_encoding = settings.entity_encoding || 'named'; + settings.remove_trailing_brs = "remove_trailing_brs" in settings ? settings.remove_trailing_brs : true; + + htmlParser = new DomParser(settings, schema); + + // Convert tabindex back to elements when serializing contents + htmlParser.addAttributeFilter('data-mce-tabindex', function(nodes, name) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i]; + node.attr('tabindex', node.attributes.map['data-mce-tabindex']); + node.attr(name, null); + } + }); + + // Convert move data-mce-src, data-mce-href and data-mce-style into nodes or process them if needed + htmlParser.addAttributeFilter('src,href,style', function(nodes, name) { + var i = nodes.length, node, value, internalName = 'data-mce-' + name; + var urlConverter = settings.url_converter, urlConverterScope = settings.url_converter_scope, undef; + + while (i--) { + node = nodes[i]; + + value = node.attributes.map[internalName]; + if (value !== undef) { + // Set external name to internal value and remove internal + node.attr(name, value.length > 0 ? value : null); + node.attr(internalName, null); + } else { + // No internal attribute found then convert the value we have in the DOM + value = node.attributes.map[name]; + + if (name === "style") { + value = dom.serializeStyle(dom.parseStyle(value), node.name); + } else if (urlConverter) { + value = urlConverter.call(urlConverterScope, value, name, node.name); + } + + node.attr(name, value.length > 0 ? value : null); + } + } + }); + + // Remove internal classes mceItem<..> or mceSelected + htmlParser.addAttributeFilter('class', function(nodes) { + var i = nodes.length, node, value; + + while (i--) { + node = nodes[i]; + value = node.attr('class'); + + if (value) { + value = node.attr('class').replace(/(?:^|\s)mce-item-\w+(?!\S)/g, ''); + node.attr('class', value.length > 0 ? value : null); + } + } + }); + + // Remove bookmark elements + htmlParser.addAttributeFilter('data-mce-type', function(nodes, name, args) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i]; + + if (node.attributes.map['data-mce-type'] === 'bookmark' && !args.cleanup) { + node.remove(); + } + } + }); + + htmlParser.addNodeFilter('noscript', function(nodes) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i].firstChild; + + if (node) { + node.value = Entities.decode(node.value); + } + } + }); + + // Force script into CDATA sections and remove the mce- prefix also add comments around styles + htmlParser.addNodeFilter('script,style', function(nodes, name) { + var i = nodes.length, node, value, type; + + function trim(value) { + /*jshint maxlen:255 */ + /*eslint max-len:0 */ + return value.replace(/()/g, '\n') + .replace(/^[\r\n]*|[\r\n]*$/g, '') + .replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g, ''); + } + + while (i--) { + node = nodes[i]; + value = node.firstChild ? node.firstChild.value : ''; + + if (name === "script") { + // Remove mce- prefix from script elements and remove default type since the user specified + // a script element without type attribute + type = node.attr('type'); + if (type) { + node.attr('type', type == 'mce-no/type' ? null : type.replace(/^mce\-/, '')); + } + + if (value.length > 0) { + node.firstChild.value = '// '; + } + } else { + if (value.length > 0) { + node.firstChild.value = ''; + } + } + } + }); + + // Convert comments to cdata and handle protected comments + htmlParser.addNodeFilter('#comment', function(nodes) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i]; + + if (node.value.indexOf('[CDATA[') === 0) { + node.name = '#cdata'; + node.type = 4; + node.value = node.value.replace(/^\[CDATA\[|\]\]$/g, ''); + } else if (node.value.indexOf('mce:protected ') === 0) { + node.name = "#text"; + node.type = 3; + node.raw = true; + node.value = unescape(node.value).substr(14); + } + } + }); + + htmlParser.addNodeFilter('xml:namespace,input', function(nodes, name) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i]; + if (node.type === 7) { + node.remove(); + } else if (node.type === 1) { + if (name === "input" && !("type" in node.attributes.map)) { + node.attr('type', 'text'); + } + } + } + }); + + // Fix list elements, TODO: Replace this later + if (settings.fix_list_elements) { + htmlParser.addNodeFilter('ul,ol', function(nodes) { + var i = nodes.length, node, parentNode; + + while (i--) { + node = nodes[i]; + parentNode = node.parent; + + if (parentNode.name === 'ul' || parentNode.name === 'ol') { + if (node.prev && node.prev.name === 'li') { + node.prev.append(node); + } + } + } + }); + } + + // Remove internal data attributes + htmlParser.addAttributeFilter( + 'data-mce-src,data-mce-href,data-mce-style,' + + 'data-mce-selected,data-mce-expando,' + + 'data-mce-type,data-mce-resize', + + function(nodes, name) { + var i = nodes.length; + + while (i--) { + nodes[i].attr(name, null); + } + } + ); + + // Return public methods + return { + /** + * Schema instance that was used to when the Serializer was constructed. + * + * @field {tinymce.html.Schema} schema + */ + schema: schema, + + /** + * Adds a node filter function to the parser used by the serializer, the parser will collect the specified nodes by name + * and then execute the callback ones it has finished parsing the document. + * + * @example + * parser.addNodeFilter('p,h1', function(nodes, name) { + * for (var i = 0; i < nodes.length; i++) { + * console.log(nodes[i].name); + * } + * }); + * @method addNodeFilter + * @method {String} name Comma separated list of nodes to collect. + * @param {function} callback Callback function to execute once it has collected nodes. + */ + addNodeFilter: htmlParser.addNodeFilter, + + /** + * Adds a attribute filter function to the parser used by the serializer, the parser will + * collect nodes that has the specified attributes + * and then execute the callback ones it has finished parsing the document. + * + * @example + * parser.addAttributeFilter('src,href', function(nodes, name) { + * for (var i = 0; i < nodes.length; i++) { + * console.log(nodes[i].name); + * } + * }); + * @method addAttributeFilter + * @method {String} name Comma separated list of nodes to collect. + * @param {function} callback Callback function to execute once it has collected nodes. + */ + addAttributeFilter: htmlParser.addAttributeFilter, + + /** + * Serializes the specified browser DOM node into a HTML string. + * + * @method serialize + * @param {DOMNode} node DOM node to serialize. + * @param {Object} args Arguments option that gets passed to event handlers. + */ + serialize: function(node, args) { + var self = this, impl, doc, oldDoc, htmlSerializer, content; + + // Explorer won't clone contents of script and style and the + // selected index of select elements are cleared on a clone operation. + if (Env.ie && dom.select('script,style,select,map').length > 0) { + content = node.innerHTML; + node = node.cloneNode(false); + dom.setHTML(node, content); + } else { + node = node.cloneNode(true); + } + + // Nodes needs to be attached to something in WebKit/Opera + // This fix will make DOM ranges and make Sizzle happy! + impl = node.ownerDocument.implementation; + if (impl.createHTMLDocument) { + // Create an empty HTML document + doc = impl.createHTMLDocument(""); + + // Add the element or it's children if it's a body element to the new document + each(node.nodeName == 'BODY' ? node.childNodes : [node], function(node) { + doc.body.appendChild(doc.importNode(node, true)); + }); + + // Grab first child or body element for serialization + if (node.nodeName != 'BODY') { + node = doc.body.firstChild; + } else { + node = doc.body; + } + + // set the new document in DOMUtils so createElement etc works + oldDoc = dom.doc; + dom.doc = doc; + } + + args = args || {}; + args.format = args.format || 'html'; + + // Don't wrap content if we want selected html + if (args.selection) { + args.forced_root_block = ''; + } + + // Pre process + if (!args.no_events) { + args.node = node; + self.onPreProcess(args); + } + + // Setup serializer + htmlSerializer = new Serializer(settings, schema); + + // Parse and serialize HTML + args.content = htmlSerializer.serialize( + htmlParser.parse(trim(args.getInner ? node.innerHTML : dom.getOuterHTML(node)), args) + ); + + // Replace all BOM characters for now until we can find a better solution + if (!args.cleanup) { + args.content = args.content.replace(/\uFEFF/g, ''); + } + + // Post process + if (!args.no_events) { + self.onPostProcess(args); + } + + // Restore the old document if it was changed + if (oldDoc) { + dom.doc = oldDoc; + } + + args.node = null; + + return args.content; + }, + + /** + * Adds valid elements rules to the serializers schema instance this enables you to specify things + * like what elements should be outputted and what attributes specific elements might have. + * Consult the Wiki for more details on this format. + * + * @method addRules + * @param {String} rules Valid elements rules string to add to schema. + */ + addRules: function(rules) { + schema.addValidElements(rules); + }, + + /** + * Sets the valid elements rules to the serializers schema instance this enables you to specify things + * like what elements should be outputted and what attributes specific elements might have. + * Consult the Wiki for more details on this format. + * + * @method setRules + * @param {String} rules Valid elements rules string. + */ + setRules: function(rules) { + schema.setValidElements(rules); + }, + + onPreProcess: function(args) { + if (editor) { + editor.fire('PreProcess', args); + } + }, + + onPostProcess: function(args) { + if (editor) { + editor.fire('PostProcess', args); + } + } + }; + }; +}); + +// Included from: js/tinymce/classes/dom/TridentSelection.js + +/** + * TridentSelection.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Selection class for old explorer versions. This one fakes the + * native selection object available on modern browsers. + * + * @class tinymce.dom.TridentSelection + */ +define("tinymce/dom/TridentSelection", [], function() { + function Selection(selection) { + var self = this, dom = selection.dom, FALSE = false; + + function getPosition(rng, start) { + var checkRng, startIndex = 0, endIndex, inside, + children, child, offset, index, position = -1, parent; + + // Setup test range, collapse it and get the parent + checkRng = rng.duplicate(); + checkRng.collapse(start); + parent = checkRng.parentElement(); + + // Check if the selection is within the right document + if (parent.ownerDocument !== selection.dom.doc) { + return; + } + + // IE will report non editable elements as it's parent so look for an editable one + while (parent.contentEditable === "false") { + parent = parent.parentNode; + } + + // If parent doesn't have any children then return that we are inside the element + if (!parent.hasChildNodes()) { + return {node: parent, inside: 1}; + } + + // Setup node list and endIndex + children = parent.children; + endIndex = children.length - 1; + + // Perform a binary search for the position + while (startIndex <= endIndex) { + index = Math.floor((startIndex + endIndex) / 2); + + // Move selection to node and compare the ranges + child = children[index]; + checkRng.moveToElementText(child); + position = checkRng.compareEndPoints(start ? 'StartToStart' : 'EndToEnd', rng); + + // Before/after or an exact match + if (position > 0) { + endIndex = index - 1; + } else if (position < 0) { + startIndex = index + 1; + } else { + return {node: child}; + } + } + + // Check if child position is before or we didn't find a position + if (position < 0) { + // No element child was found use the parent element and the offset inside that + if (!child) { + checkRng.moveToElementText(parent); + checkRng.collapse(true); + child = parent; + inside = true; + } else { + checkRng.collapse(false); + } + + // Walk character by character in text node until we hit the selected range endpoint, + // hit the end of document or parent isn't the right one + // We need to walk char by char since rng.text or rng.htmlText will trim line endings + offset = 0; + while (checkRng.compareEndPoints(start ? 'StartToStart' : 'StartToEnd', rng) !== 0) { + if (checkRng.move('character', 1) === 0 || parent != checkRng.parentElement()) { + break; + } + + offset++; + } + } else { + // Child position is after the selection endpoint + checkRng.collapse(true); + + // Walk character by character in text node until we hit the selected range endpoint, hit + // the end of document or parent isn't the right one + offset = 0; + while (checkRng.compareEndPoints(start ? 'StartToStart' : 'StartToEnd', rng) !== 0) { + if (checkRng.move('character', -1) === 0 || parent != checkRng.parentElement()) { + break; + } + + offset++; + } + } + + return {node: child, position: position, offset: offset, inside: inside}; + } + + // Returns a W3C DOM compatible range object by using the IE Range API + function getRange() { + var ieRange = selection.getRng(), domRange = dom.createRng(), element, collapsed, tmpRange, element2, bookmark; + + // If selection is outside the current document just return an empty range + element = ieRange.item ? ieRange.item(0) : ieRange.parentElement(); + if (element.ownerDocument != dom.doc) { + return domRange; + } + + collapsed = selection.isCollapsed(); + + // Handle control selection + if (ieRange.item) { + domRange.setStart(element.parentNode, dom.nodeIndex(element)); + domRange.setEnd(domRange.startContainer, domRange.startOffset + 1); + + return domRange; + } + + function findEndPoint(start) { + var endPoint = getPosition(ieRange, start), container, offset, textNodeOffset = 0, sibling, undef, nodeValue; + + container = endPoint.node; + offset = endPoint.offset; + + if (endPoint.inside && !container.hasChildNodes()) { + domRange[start ? 'setStart' : 'setEnd'](container, 0); + return; + } + + if (offset === undef) { + domRange[start ? 'setStartBefore' : 'setEndAfter'](container); + return; + } + + if (endPoint.position < 0) { + sibling = endPoint.inside ? container.firstChild : container.nextSibling; + + if (!sibling) { + domRange[start ? 'setStartAfter' : 'setEndAfter'](container); + return; + } + + if (!offset) { + if (sibling.nodeType == 3) { + domRange[start ? 'setStart' : 'setEnd'](sibling, 0); + } else { + domRange[start ? 'setStartBefore' : 'setEndBefore'](sibling); + } + + return; + } + + // Find the text node and offset + while (sibling) { + if (sibling.nodeType == 3) { + nodeValue = sibling.nodeValue; + textNodeOffset += nodeValue.length; + + // We are at or passed the position we where looking for + if (textNodeOffset >= offset) { + container = sibling; + textNodeOffset -= offset; + textNodeOffset = nodeValue.length - textNodeOffset; + break; + } + } + + sibling = sibling.nextSibling; + } + } else { + // Find the text node and offset + sibling = container.previousSibling; + + if (!sibling) { + return domRange[start ? 'setStartBefore' : 'setEndBefore'](container); + } + + // If there isn't any text to loop then use the first position + if (!offset) { + if (container.nodeType == 3) { + domRange[start ? 'setStart' : 'setEnd'](sibling, container.nodeValue.length); + } else { + domRange[start ? 'setStartAfter' : 'setEndAfter'](sibling); + } + + return; + } + + while (sibling) { + if (sibling.nodeType == 3) { + textNodeOffset += sibling.nodeValue.length; + + // We are at or passed the position we where looking for + if (textNodeOffset >= offset) { + container = sibling; + textNodeOffset -= offset; + break; + } + } + + sibling = sibling.previousSibling; + } + } + + domRange[start ? 'setStart' : 'setEnd'](container, textNodeOffset); + } + + try { + // Find start point + findEndPoint(true); + + // Find end point if needed + if (!collapsed) { + findEndPoint(); + } + } catch (ex) { + // IE has a nasty bug where text nodes might throw "invalid argument" when you + // access the nodeValue or other properties of text nodes. This seems to happend when + // text nodes are split into two nodes by a delete/backspace call. So lets detect it and try to fix it. + if (ex.number == -2147024809) { + // Get the current selection + bookmark = self.getBookmark(2); + + // Get start element + tmpRange = ieRange.duplicate(); + tmpRange.collapse(true); + element = tmpRange.parentElement(); + + // Get end element + if (!collapsed) { + tmpRange = ieRange.duplicate(); + tmpRange.collapse(false); + element2 = tmpRange.parentElement(); + element2.innerHTML = element2.innerHTML; + } + + // Remove the broken elements + element.innerHTML = element.innerHTML; + + // Restore the selection + self.moveToBookmark(bookmark); + + // Since the range has moved we need to re-get it + ieRange = selection.getRng(); + + // Find start point + findEndPoint(true); + + // Find end point if needed + if (!collapsed) { + findEndPoint(); + } + } else { + throw ex; // Throw other errors + } + } + + return domRange; + } + + this.getBookmark = function(type) { + var rng = selection.getRng(), bookmark = {}; + + function getIndexes(node) { + var parent, root, children, i, indexes = []; + + parent = node.parentNode; + root = dom.getRoot().parentNode; + + while (parent != root && parent.nodeType !== 9) { + children = parent.children; + + i = children.length; + while (i--) { + if (node === children[i]) { + indexes.push(i); + break; + } + } + + node = parent; + parent = parent.parentNode; + } + + return indexes; + } + + function getBookmarkEndPoint(start) { + var position; + + position = getPosition(rng, start); + if (position) { + return { + position: position.position, + offset: position.offset, + indexes: getIndexes(position.node), + inside: position.inside + }; + } + } + + // Non ubstructive bookmark + if (type === 2) { + // Handle text selection + if (!rng.item) { + bookmark.start = getBookmarkEndPoint(true); + + if (!selection.isCollapsed()) { + bookmark.end = getBookmarkEndPoint(); + } + } else { + bookmark.start = {ctrl: true, indexes: getIndexes(rng.item(0))}; + } + } + + return bookmark; + }; + + this.moveToBookmark = function(bookmark) { + var rng, body = dom.doc.body; + + function resolveIndexes(indexes) { + var node, i, idx, children; + + node = dom.getRoot(); + for (i = indexes.length - 1; i >= 0; i--) { + children = node.children; + idx = indexes[i]; + + if (idx <= children.length - 1) { + node = children[idx]; + } + } + + return node; + } + + function setBookmarkEndPoint(start) { + var endPoint = bookmark[start ? 'start' : 'end'], moveLeft, moveRng, undef, offset; + + if (endPoint) { + moveLeft = endPoint.position > 0; + + moveRng = body.createTextRange(); + moveRng.moveToElementText(resolveIndexes(endPoint.indexes)); + + offset = endPoint.offset; + if (offset !== undef) { + moveRng.collapse(endPoint.inside || moveLeft); + moveRng.moveStart('character', moveLeft ? -offset : offset); + } else { + moveRng.collapse(start); + } + + rng.setEndPoint(start ? 'StartToStart' : 'EndToStart', moveRng); + + if (start) { + rng.collapse(true); + } + } + } + + if (bookmark.start) { + if (bookmark.start.ctrl) { + rng = body.createControlRange(); + rng.addElement(resolveIndexes(bookmark.start.indexes)); + rng.select(); + } else { + rng = body.createTextRange(); + setBookmarkEndPoint(true); + setBookmarkEndPoint(); + rng.select(); + } + } + }; + + this.addRange = function(rng) { + var ieRng, ctrlRng, startContainer, startOffset, endContainer, endOffset, sibling, + doc = selection.dom.doc, body = doc.body, nativeRng, ctrlElm; + + function setEndPoint(start) { + var container, offset, marker, tmpRng, nodes; + + marker = dom.create('a'); + container = start ? startContainer : endContainer; + offset = start ? startOffset : endOffset; + tmpRng = ieRng.duplicate(); + + if (container == doc || container == doc.documentElement) { + container = body; + offset = 0; + } + + if (container.nodeType == 3) { + container.parentNode.insertBefore(marker, container); + tmpRng.moveToElementText(marker); + tmpRng.moveStart('character', offset); + dom.remove(marker); + ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng); + } else { + nodes = container.childNodes; + + if (nodes.length) { + if (offset >= nodes.length) { + dom.insertAfter(marker, nodes[nodes.length - 1]); + } else { + container.insertBefore(marker, nodes[offset]); + } + + tmpRng.moveToElementText(marker); + } else if (container.canHaveHTML) { + // Empty node selection for example
    |
    + // Setting innerHTML with a span marker then remove that marker seems to keep empty block elements open + container.innerHTML = ''; + marker = container.firstChild; + tmpRng.moveToElementText(marker); + tmpRng.collapse(FALSE); // Collapse false works better than true for some odd reason + } + + ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng); + dom.remove(marker); + } + } + + // Setup some shorter versions + startContainer = rng.startContainer; + startOffset = rng.startOffset; + endContainer = rng.endContainer; + endOffset = rng.endOffset; + ieRng = body.createTextRange(); + + // If single element selection then try making a control selection out of it + if (startContainer == endContainer && startContainer.nodeType == 1) { + // Trick to place the caret inside an empty block element like

    + if (startOffset == endOffset && !startContainer.hasChildNodes()) { + if (startContainer.canHaveHTML) { + // Check if previous sibling is an empty block if it is then we need to render it + // IE would otherwise move the caret into the sibling instead of the empty startContainer see: #5236 + // Example this:

    |

    would become this:

    |

    + sibling = startContainer.previousSibling; + if (sibling && !sibling.hasChildNodes() && dom.isBlock(sibling)) { + sibling.innerHTML = ''; + } else { + sibling = null; + } + + startContainer.innerHTML = ''; + ieRng.moveToElementText(startContainer.lastChild); + ieRng.select(); + dom.doc.selection.clear(); + startContainer.innerHTML = ''; + + if (sibling) { + sibling.innerHTML = ''; + } + return; + } else { + startOffset = dom.nodeIndex(startContainer); + startContainer = startContainer.parentNode; + } + } + + if (startOffset == endOffset - 1) { + try { + ctrlElm = startContainer.childNodes[startOffset]; + ctrlRng = body.createControlRange(); + ctrlRng.addElement(ctrlElm); + ctrlRng.select(); + + // Check if the range produced is on the correct element and is a control range + // On IE 8 it will select the parent contentEditable container if you select an inner element see: #5398 + nativeRng = selection.getRng(); + if (nativeRng.item && ctrlElm === nativeRng.item(0)) { + return; + } + } catch (ex) { + // Ignore + } + } + } + + // Set start/end point of selection + setEndPoint(true); + setEndPoint(); + + // Select the new range and scroll it into view + ieRng.select(); + }; + + // Expose range method + this.getRangeAt = getRange; + } + + return Selection; +}); + +// Included from: js/tinymce/classes/util/VK.js + +/** + * VK.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This file exposes a set of the common KeyCodes for use. Please grow it as needed. + */ +define("tinymce/util/VK", [ + "tinymce/Env" +], function(Env) { + return { + BACKSPACE: 8, + DELETE: 46, + DOWN: 40, + ENTER: 13, + LEFT: 37, + RIGHT: 39, + SPACEBAR: 32, + TAB: 9, + UP: 38, + + modifierPressed: function(e) { + return e.shiftKey || e.ctrlKey || e.altKey || this.metaKeyPressed(e); + }, + + metaKeyPressed: function(e) { + // Check if ctrl or meta key is pressed. Edge case for AltGr on Windows where it produces ctrlKey+altKey states + return (Env.mac ? e.metaKey : e.ctrlKey && !e.altKey); + } + }; +}); + +// Included from: js/tinymce/classes/dom/ControlSelection.js + +/** + * ControlSelection.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles control selection of elements. Controls are elements + * that can be resized and needs to be selected as a whole. It adds custom resize handles + * to all browser engines that support properly disabling the built in resize logic. + * + * @class tinymce.dom.ControlSelection + */ +define("tinymce/dom/ControlSelection", [ + "tinymce/util/VK", + "tinymce/util/Tools", + "tinymce/Env" +], function(VK, Tools, Env) { + return function(selection, editor) { + var dom = editor.dom, each = Tools.each; + var selectedElm, selectedElmGhost, resizeHelper, resizeHandles, selectedHandle, lastMouseDownEvent; + var startX, startY, selectedElmX, selectedElmY, startW, startH, ratio, resizeStarted; + var width, height, editableDoc = editor.getDoc(), rootDocument = document, isIE = Env.ie && Env.ie < 11; + var abs = Math.abs, round = Math.round, rootElement = editor.getBody(), startScrollWidth, startScrollHeight; + + // Details about each resize handle how to scale etc + resizeHandles = { + // Name: x multiplier, y multiplier, delta size x, delta size y + n: [0.5, 0, 0, -1], + e: [1, 0.5, 1, 0], + s: [0.5, 1, 0, 1], + w: [0, 0.5, -1, 0], + nw: [0, 0, -1, -1], + ne: [1, 0, 1, -1], + se: [1, 1, 1, 1], + sw: [0, 1, -1, 1] + }; + + // Add CSS for resize handles, cloned element and selected + var rootClass = '.mce-content-body'; + editor.contentStyles.push( + rootClass + ' div.mce-resizehandle {' + + 'position: absolute;' + + 'border: 1px solid black;' + + 'background: #FFF;' + + 'width: 5px;' + + 'height: 5px;' + + 'z-index: 10000' + + '}' + + rootClass + ' .mce-resizehandle:hover {' + + 'background: #000' + + '}' + + rootClass + ' img[data-mce-selected], hr[data-mce-selected] {' + + 'outline: 1px solid black;' + + 'resize: none' + // Have been talks about implementing this in browsers + '}' + + rootClass + ' .mce-clonedresizable {' + + 'position: absolute;' + + (Env.gecko ? '' : 'outline: 1px dashed black;') + // Gecko produces trails while resizing + 'opacity: .5;' + + 'filter: alpha(opacity=50);' + + 'z-index: 10000' + + '}' + + rootClass + ' .mce-resize-helper {' + + 'background: #555;' + + 'background: rgba(0,0,0,0.75);' + + 'border-radius: 3px;' + + 'border: 1px;' + + 'color: white;' + + 'display: none;' + + 'font-family: sans-serif;' + + 'font-size: 12px;' + + 'white-space: nowrap;' + + 'line-height: 14px;' + + 'margin: 5px 10px;' + + 'padding: 5px;' + + 'position: absolute;' + + 'z-index: 10001' + + '}' + ); + + function isResizable(elm) { + var selector = editor.settings.object_resizing; + + if (selector === false || Env.iOS) { + return false; + } + + if (typeof selector != 'string') { + selector = 'table,img,div'; + } + + if (elm.getAttribute('data-mce-resize') === 'false') { + return false; + } + + return editor.dom.is(elm, selector); + } + + function resizeGhostElement(e) { + var deltaX, deltaY, proportional; + var resizeHelperX, resizeHelperY; + + // Calc new width/height + deltaX = e.screenX - startX; + deltaY = e.screenY - startY; + + // Calc new size + width = deltaX * selectedHandle[2] + startW; + height = deltaY * selectedHandle[3] + startH; + + // Never scale down lower than 5 pixels + width = width < 5 ? 5 : width; + height = height < 5 ? 5 : height; + + if (selectedElm.nodeName == "IMG" && editor.settings.resize_img_proportional !== false) { + proportional = !VK.modifierPressed(e); + } else { + proportional = VK.modifierPressed(e) || (selectedElm.nodeName == "IMG" && selectedHandle[2] * selectedHandle[3] !== 0); + } + + // Constrain proportions + if (proportional) { + if (abs(deltaX) > abs(deltaY)) { + height = round(width * ratio); + width = round(height / ratio); + } else { + width = round(height / ratio); + height = round(width * ratio); + } + } + + // Update ghost size + dom.setStyles(selectedElmGhost, { + width: width, + height: height + }); + + // Update resize helper position + resizeHelperX = selectedHandle.startPos.x + deltaX; + resizeHelperY = selectedHandle.startPos.y + deltaY; + resizeHelperX = resizeHelperX > 0 ? resizeHelperX : 0; + resizeHelperY = resizeHelperY > 0 ? resizeHelperY : 0; + + dom.setStyles(resizeHelper, { + left: resizeHelperX, + top: resizeHelperY, + display: 'block' + }); + + resizeHelper.innerHTML = width + ' × ' + height; + + // Update ghost X position if needed + if (selectedHandle[2] < 0 && selectedElmGhost.clientWidth <= width) { + dom.setStyle(selectedElmGhost, 'left', selectedElmX + (startW - width)); + } + + // Update ghost Y position if needed + if (selectedHandle[3] < 0 && selectedElmGhost.clientHeight <= height) { + dom.setStyle(selectedElmGhost, 'top', selectedElmY + (startH - height)); + } + + // Calculate how must overflow we got + deltaX = rootElement.scrollWidth - startScrollWidth; + deltaY = rootElement.scrollHeight - startScrollHeight; + + // Re-position the resize helper based on the overflow + if (deltaX + deltaY !== 0) { + dom.setStyles(resizeHelper, { + left: resizeHelperX - deltaX, + top: resizeHelperY - deltaY + }); + } + + if (!resizeStarted) { + editor.fire('ObjectResizeStart', {target: selectedElm, width: startW, height: startH}); + resizeStarted = true; + } + } + + function endGhostResize() { + resizeStarted = false; + + function setSizeProp(name, value) { + if (value) { + // Resize by using style or attribute + if (selectedElm.style[name] || !editor.schema.isValid(selectedElm.nodeName.toLowerCase(), name)) { + dom.setStyle(selectedElm, name, value); + } else { + dom.setAttrib(selectedElm, name, value); + } + } + } + + // Set width/height properties + setSizeProp('width', width); + setSizeProp('height', height); + + dom.unbind(editableDoc, 'mousemove', resizeGhostElement); + dom.unbind(editableDoc, 'mouseup', endGhostResize); + + if (rootDocument != editableDoc) { + dom.unbind(rootDocument, 'mousemove', resizeGhostElement); + dom.unbind(rootDocument, 'mouseup', endGhostResize); + } + + // Remove ghost/helper and update resize handle positions + dom.remove(selectedElmGhost); + dom.remove(resizeHelper); + + if (!isIE || selectedElm.nodeName == "TABLE") { + showResizeRect(selectedElm); + } + + editor.fire('ObjectResized', {target: selectedElm, width: width, height: height}); + dom.setAttrib(selectedElm, 'style', dom.getAttrib(selectedElm, 'style')); + editor.nodeChanged(); + } + + function showResizeRect(targetElm, mouseDownHandleName, mouseDownEvent) { + var position, targetWidth, targetHeight, e, rect; + + unbindResizeHandleEvents(); + + // Get position and size of target + position = dom.getPos(targetElm, rootElement); + selectedElmX = position.x; + selectedElmY = position.y; + rect = targetElm.getBoundingClientRect(); // Fix for Gecko offsetHeight for table with caption + targetWidth = rect.width || (rect.right - rect.left); + targetHeight = rect.height || (rect.bottom - rect.top); + + // Reset width/height if user selects a new image/table + if (selectedElm != targetElm) { + detachResizeStartListener(); + selectedElm = targetElm; + width = height = 0; + } + + // Makes it possible to disable resizing + e = editor.fire('ObjectSelected', {target: targetElm}); + + if (isResizable(targetElm) && !e.isDefaultPrevented()) { + each(resizeHandles, function(handle, name) { + var handleElm, handlerContainerElm; + + function startDrag(e) { + startX = e.screenX; + startY = e.screenY; + startW = selectedElm.clientWidth; + startH = selectedElm.clientHeight; + ratio = startH / startW; + selectedHandle = handle; + + handle.startPos = { + x: targetWidth * handle[0] + selectedElmX, + y: targetHeight * handle[1] + selectedElmY + }; + + startScrollWidth = rootElement.scrollWidth; + startScrollHeight = rootElement.scrollHeight; + + selectedElmGhost = selectedElm.cloneNode(true); + dom.addClass(selectedElmGhost, 'mce-clonedresizable'); + dom.setAttrib(selectedElmGhost, 'data-mce-bogus', 'all'); + selectedElmGhost.contentEditable = false; // Hides IE move layer cursor + selectedElmGhost.unSelectabe = true; + dom.setStyles(selectedElmGhost, { + left: selectedElmX, + top: selectedElmY, + margin: 0 + }); + + selectedElmGhost.removeAttribute('data-mce-selected'); + rootElement.appendChild(selectedElmGhost); + + dom.bind(editableDoc, 'mousemove', resizeGhostElement); + dom.bind(editableDoc, 'mouseup', endGhostResize); + + if (rootDocument != editableDoc) { + dom.bind(rootDocument, 'mousemove', resizeGhostElement); + dom.bind(rootDocument, 'mouseup', endGhostResize); + } + + resizeHelper = dom.add(rootElement, 'div', { + 'class': 'mce-resize-helper', + 'data-mce-bogus': 'all' + }, startW + ' × ' + startH); + } + + if (mouseDownHandleName) { + // Drag started by IE native resizestart + if (name == mouseDownHandleName) { + startDrag(mouseDownEvent); + } + + return; + } + + // Get existing or render resize handle + handleElm = dom.get('mceResizeHandle' + name); + if (!handleElm) { + handlerContainerElm = rootElement; + + handleElm = dom.add(handlerContainerElm, 'div', { + id: 'mceResizeHandle' + name, + 'data-mce-bogus': 'all', + 'class': 'mce-resizehandle', + unselectable: true, + style: 'cursor:' + name + '-resize; margin:0; padding:0' + }); + + // Hides IE move layer cursor + // If we set it on Chrome we get this wounderful bug: #6725 + if (Env.ie) { + handleElm.contentEditable = false; + } + } else { + dom.show(handleElm); + } + + if (!handle.elm) { + dom.bind(handleElm, 'mousedown', function(e) { + e.stopImmediatePropagation(); + e.preventDefault(); + startDrag(e); + }); + + handle.elm = handleElm; + } + + // Position element + dom.setStyles(handleElm, { + left: (targetWidth * handle[0] + selectedElmX) - (handleElm.offsetWidth / 2), + top: (targetHeight * handle[1] + selectedElmY) - (handleElm.offsetHeight / 2) + }); + }); + } else { + hideResizeRect(); + } + + selectedElm.setAttribute('data-mce-selected', '1'); + } + + function hideResizeRect() { + var name, handleElm; + + unbindResizeHandleEvents(); + + if (selectedElm) { + selectedElm.removeAttribute('data-mce-selected'); + } + + for (name in resizeHandles) { + handleElm = dom.get('mceResizeHandle' + name); + if (handleElm) { + dom.unbind(handleElm); + dom.remove(handleElm); + } + } + } + + function updateResizeRect(e) { + var startElm, controlElm; + + function isChildOrEqual(node, parent) { + if (node) { + do { + if (node === parent) { + return true; + } + } while ((node = node.parentNode)); + } + } + + // Ignore all events while resizing + if (resizeStarted) { + return; + } + + // Remove data-mce-selected from all elements since they might have been copied using Ctrl+c/v + each(dom.select('img[data-mce-selected],hr[data-mce-selected]'), function(img) { + img.removeAttribute('data-mce-selected'); + }); + + controlElm = e.type == 'mousedown' ? e.target : selection.getNode(); + controlElm = dom.$(controlElm).closest(isIE ? 'table' : 'table,img,hr')[0]; + + if (isChildOrEqual(controlElm, rootElement)) { + disableGeckoResize(); + startElm = selection.getStart(true); + + if (isChildOrEqual(startElm, controlElm) && isChildOrEqual(selection.getEnd(true), controlElm)) { + if (!isIE || (controlElm != startElm && startElm.nodeName !== 'IMG')) { + showResizeRect(controlElm); + return; + } + } + } + + hideResizeRect(); + } + + function attachEvent(elm, name, func) { + if (elm && elm.attachEvent) { + elm.attachEvent('on' + name, func); + } + } + + function detachEvent(elm, name, func) { + if (elm && elm.detachEvent) { + elm.detachEvent('on' + name, func); + } + } + + function resizeNativeStart(e) { + var target = e.srcElement, pos, name, corner, cornerX, cornerY, relativeX, relativeY; + + pos = target.getBoundingClientRect(); + relativeX = lastMouseDownEvent.clientX - pos.left; + relativeY = lastMouseDownEvent.clientY - pos.top; + + // Figure out what corner we are draging on + for (name in resizeHandles) { + corner = resizeHandles[name]; + + cornerX = target.offsetWidth * corner[0]; + cornerY = target.offsetHeight * corner[1]; + + if (abs(cornerX - relativeX) < 8 && abs(cornerY - relativeY) < 8) { + selectedHandle = corner; + break; + } + } + + // Remove native selection and let the magic begin + resizeStarted = true; + editor.fire('ObjectResizeStart', { + target: selectedElm, + width: selectedElm.clientWidth, + height: selectedElm.clientHeight + }); + editor.getDoc().selection.empty(); + showResizeRect(target, name, lastMouseDownEvent); + } + + function nativeControlSelect(e) { + var target = e.srcElement; + + if (target != selectedElm) { + editor.fire('ObjectSelected', {target: target}); + detachResizeStartListener(); + + if (target.id.indexOf('mceResizeHandle') === 0) { + e.returnValue = false; + return; + } + + if (target.nodeName == 'IMG' || target.nodeName == 'TABLE') { + hideResizeRect(); + selectedElm = target; + attachEvent(target, 'resizestart', resizeNativeStart); + } + } + } + + function detachResizeStartListener() { + detachEvent(selectedElm, 'resizestart', resizeNativeStart); + } + + function unbindResizeHandleEvents() { + for (var name in resizeHandles) { + var handle = resizeHandles[name]; + + if (handle.elm) { + dom.unbind(handle.elm); + delete handle.elm; + } + } + } + + function disableGeckoResize() { + try { + // Disable object resizing on Gecko + editor.getDoc().execCommand('enableObjectResizing', false, false); + } catch (ex) { + // Ignore + } + } + + function controlSelect(elm) { + var ctrlRng; + + if (!isIE) { + return; + } + + ctrlRng = editableDoc.body.createControlRange(); + + try { + ctrlRng.addElement(elm); + ctrlRng.select(); + return true; + } catch (ex) { + // Ignore since the element can't be control selected for example a P tag + } + } + + editor.on('init', function() { + if (isIE) { + // Hide the resize rect on resize and reselect the image + editor.on('ObjectResized', function(e) { + if (e.target.nodeName != 'TABLE') { + hideResizeRect(); + controlSelect(e.target); + } + }); + + attachEvent(rootElement, 'controlselect', nativeControlSelect); + + editor.on('mousedown', function(e) { + lastMouseDownEvent = e; + }); + } else { + disableGeckoResize(); + + if (Env.ie >= 11) { + // TODO: Drag/drop doesn't work + editor.on('mouseup', function(e) { + var nodeName = e.target.nodeName; + + if (!resizeStarted && /^(TABLE|IMG|HR)$/.test(nodeName)) { + editor.selection.select(e.target, nodeName == 'TABLE'); + editor.nodeChanged(); + } + }); + + editor.dom.bind(rootElement, 'mscontrolselect', function(e) { + if (/^(TABLE|IMG|HR)$/.test(e.target.nodeName)) { + e.preventDefault(); + + // This moves the selection from being a control selection to a text like selection like in WebKit #6753 + // TODO: Fix this the day IE works like other browsers without this nasty native ugly control selections. + if (e.target.tagName == 'IMG') { + window.setTimeout(function() { + editor.selection.select(e.target); + }, 0); + } + } + }); + } + } + + editor.on('nodechange ResizeEditor', updateResizeRect); + + // Update resize rect while typing in a table + editor.on('keydown keyup', function(e) { + if (selectedElm && selectedElm.nodeName == "TABLE") { + updateResizeRect(e); + } + }); + + editor.on('hide', hideResizeRect); + + // Hide rect on focusout since it would float on top of windows otherwise + //editor.on('focusout', hideResizeRect); + }); + + editor.on('remove', unbindResizeHandleEvents); + + function destroy() { + selectedElm = selectedElmGhost = null; + + if (isIE) { + detachResizeStartListener(); + detachEvent(rootElement, 'controlselect', nativeControlSelect); + } + } + + return { + isResizable: isResizable, + showResizeRect: showResizeRect, + hideResizeRect: hideResizeRect, + updateResizeRect: updateResizeRect, + controlSelect: controlSelect, + destroy: destroy + }; + }; +}); + +// Included from: js/tinymce/classes/dom/BookmarkManager.js + +/** + * BookmarkManager.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles selection bookmarks. + * + * @class tinymce.dom.BookmarkManager + */ +define("tinymce/dom/BookmarkManager", [ + "tinymce/Env", + "tinymce/util/Tools" +], function(Env, Tools) { + /** + * Constructs a new BookmarkManager instance for a specific selection instance. + * + * @constructor + * @method BookmarkManager + * @param {tinymce.dom.Selection} selection Selection instance to handle bookmarks for. + */ + function BookmarkManager(selection) { + var dom = selection.dom; + + /** + * Returns a bookmark location for the current selection. This bookmark object + * can then be used to restore the selection after some content modification to the document. + * + * @method getBookmark + * @param {Number} type Optional state if the bookmark should be simple or not. Default is complex. + * @param {Boolean} normalized Optional state that enables you to get a position that it would be after normalization. + * @return {Object} Bookmark object, use moveToBookmark with this object to restore the selection. + * @example + * // Stores a bookmark of the current selection + * var bm = tinymce.activeEditor.selection.getBookmark(); + * + * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content'); + * + * // Restore the selection bookmark + * tinymce.activeEditor.selection.moveToBookmark(bm); + */ + this.getBookmark = function(type, normalized) { + var rng, rng2, id, collapsed, name, element, chr = '', styles; + + function findIndex(name, element) { + var index = 0; + + Tools.each(dom.select(name), function(node, i) { + if (node == element) { + index = i; + } + }); + + return index; + } + + function normalizeTableCellSelection(rng) { + function moveEndPoint(start) { + var container, offset, childNodes, prefix = start ? 'start' : 'end'; + + container = rng[prefix + 'Container']; + offset = rng[prefix + 'Offset']; + + if (container.nodeType == 1 && container.nodeName == "TR") { + childNodes = container.childNodes; + container = childNodes[Math.min(start ? offset : offset - 1, childNodes.length - 1)]; + if (container) { + offset = start ? 0 : container.childNodes.length; + rng['set' + (start ? 'Start' : 'End')](container, offset); + } + } + } + + moveEndPoint(true); + moveEndPoint(); + + return rng; + } + + function getLocation() { + var rng = selection.getRng(true), root = dom.getRoot(), bookmark = {}; + + function getPoint(rng, start) { + var container = rng[start ? 'startContainer' : 'endContainer'], + offset = rng[start ? 'startOffset' : 'endOffset'], point = [], node, childNodes, after = 0; + + if (container.nodeType == 3) { + if (normalized) { + for (node = container.previousSibling; node && node.nodeType == 3; node = node.previousSibling) { + offset += node.nodeValue.length; + } + } + + point.push(offset); + } else { + childNodes = container.childNodes; + + if (offset >= childNodes.length && childNodes.length) { + after = 1; + offset = Math.max(0, childNodes.length - 1); + } + + point.push(dom.nodeIndex(childNodes[offset], normalized) + after); + } + + for (; container && container != root; container = container.parentNode) { + point.push(dom.nodeIndex(container, normalized)); + } + + return point; + } + + bookmark.start = getPoint(rng, true); + + if (!selection.isCollapsed()) { + bookmark.end = getPoint(rng); + } + + return bookmark; + } + + if (type == 2) { + element = selection.getNode(); + name = element ? element.nodeName : null; + + if (name == 'IMG') { + return {name: name, index: findIndex(name, element)}; + } + + if (selection.tridentSel) { + return selection.tridentSel.getBookmark(type); + } + + return getLocation(); + } + + // Handle simple range + if (type) { + return {rng: selection.getRng()}; + } + + rng = selection.getRng(); + id = dom.uniqueId(); + collapsed = selection.isCollapsed(); + styles = 'overflow:hidden;line-height:0px'; + + // Explorer method + if (rng.duplicate || rng.item) { + // Text selection + if (!rng.item) { + rng2 = rng.duplicate(); + + try { + // Insert start marker + rng.collapse(); + rng.pasteHTML('' + chr + ''); + + // Insert end marker + if (!collapsed) { + rng2.collapse(false); + + // Detect the empty space after block elements in IE and move the + // end back one character

    ] becomes

    ]

    + rng.moveToElementText(rng2.parentElement()); + if (rng.compareEndPoints('StartToEnd', rng2) === 0) { + rng2.move('character', -1); + } + + rng2.pasteHTML('' + chr + ''); + } + } catch (ex) { + // IE might throw unspecified error so lets ignore it + return null; + } + } else { + // Control selection + element = rng.item(0); + name = element.nodeName; + + return {name: name, index: findIndex(name, element)}; + } + } else { + element = selection.getNode(); + name = element.nodeName; + if (name == 'IMG') { + return {name: name, index: findIndex(name, element)}; + } + + // W3C method + rng2 = normalizeTableCellSelection(rng.cloneRange()); + + // Insert end marker + if (!collapsed) { + rng2.collapse(false); + rng2.insertNode(dom.create('span', {'data-mce-type': "bookmark", id: id + '_end', style: styles}, chr)); + } + + rng = normalizeTableCellSelection(rng); + rng.collapse(true); + rng.insertNode(dom.create('span', {'data-mce-type': "bookmark", id: id + '_start', style: styles}, chr)); + } + + selection.moveToBookmark({id: id, keep: 1}); + + return {id: id}; + }; + + /** + * Restores the selection to the specified bookmark. + * + * @method moveToBookmark + * @param {Object} bookmark Bookmark to restore selection from. + * @return {Boolean} true/false if it was successful or not. + * @example + * // Stores a bookmark of the current selection + * var bm = tinymce.activeEditor.selection.getBookmark(); + * + * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content'); + * + * // Restore the selection bookmark + * tinymce.activeEditor.selection.moveToBookmark(bm); + */ + this.moveToBookmark = function(bookmark) { + var rng, root, startContainer, endContainer, startOffset, endOffset; + + function setEndPoint(start) { + var point = bookmark[start ? 'start' : 'end'], i, node, offset, children; + + if (point) { + offset = point[0]; + + // Find container node + for (node = root, i = point.length - 1; i >= 1; i--) { + children = node.childNodes; + + if (point[i] > children.length - 1) { + return; + } + + node = children[point[i]]; + } + + // Move text offset to best suitable location + if (node.nodeType === 3) { + offset = Math.min(point[0], node.nodeValue.length); + } + + // Move element offset to best suitable location + if (node.nodeType === 1) { + offset = Math.min(point[0], node.childNodes.length); + } + + // Set offset within container node + if (start) { + rng.setStart(node, offset); + } else { + rng.setEnd(node, offset); + } + } + + return true; + } + + function restoreEndPoint(suffix) { + var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev, keep = bookmark.keep; + + if (marker) { + node = marker.parentNode; + + if (suffix == 'start') { + if (!keep) { + idx = dom.nodeIndex(marker); + } else { + node = marker.firstChild; + idx = 1; + } + + startContainer = endContainer = node; + startOffset = endOffset = idx; + } else { + if (!keep) { + idx = dom.nodeIndex(marker); + } else { + node = marker.firstChild; + idx = 1; + } + + endContainer = node; + endOffset = idx; + } + + if (!keep) { + prev = marker.previousSibling; + next = marker.nextSibling; + + // Remove all marker text nodes + Tools.each(Tools.grep(marker.childNodes), function(node) { + if (node.nodeType == 3) { + node.nodeValue = node.nodeValue.replace(/\uFEFF/g, ''); + } + }); + + // Remove marker but keep children if for example contents where inserted into the marker + // Also remove duplicated instances of the marker for example by a + // split operation or by WebKit auto split on paste feature + while ((marker = dom.get(bookmark.id + '_' + suffix))) { + dom.remove(marker, 1); + } + + // If siblings are text nodes then merge them unless it's Opera since it some how removes the node + // and we are sniffing since adding a lot of detection code for a browser with 3% of the market + // isn't worth the effort. Sorry, Opera but it's just a fact + if (prev && next && prev.nodeType == next.nodeType && prev.nodeType == 3 && !Env.opera) { + idx = prev.nodeValue.length; + prev.appendData(next.nodeValue); + dom.remove(next); + + if (suffix == 'start') { + startContainer = endContainer = prev; + startOffset = endOffset = idx; + } else { + endContainer = prev; + endOffset = idx; + } + } + } + } + } + + function addBogus(node) { + // Adds a bogus BR element for empty block elements + if (dom.isBlock(node) && !node.innerHTML && !Env.ie) { + node.innerHTML = '
    '; + } + + return node; + } + + if (bookmark) { + if (bookmark.start) { + rng = dom.createRng(); + root = dom.getRoot(); + + if (selection.tridentSel) { + return selection.tridentSel.moveToBookmark(bookmark); + } + + if (setEndPoint(true) && setEndPoint()) { + selection.setRng(rng); + } + } else if (bookmark.id) { + // Restore start/end points + restoreEndPoint('start'); + restoreEndPoint('end'); + + if (startContainer) { + rng = dom.createRng(); + rng.setStart(addBogus(startContainer), startOffset); + rng.setEnd(addBogus(endContainer), endOffset); + selection.setRng(rng); + } + } else if (bookmark.name) { + selection.select(dom.select(bookmark.name)[bookmark.index]); + } else if (bookmark.rng) { + selection.setRng(bookmark.rng); + } + } + }; + } + + /** + * Returns true/false if the specified node is a bookmark node or not. + * + * @static + * @method isBookmarkNode + * @param {DOMNode} node DOM Node to check if it's a bookmark node or not. + * @return {Boolean} true/false if the node is a bookmark node or not. + */ + BookmarkManager.isBookmarkNode = function(node) { + return node && node.tagName === 'SPAN' && node.getAttribute('data-mce-type') === 'bookmark'; + }; + + return BookmarkManager; +}); + +// Included from: js/tinymce/classes/dom/Selection.js + +/** + * Selection.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles text and control selection it's an crossbrowser utility class. + * Consult the TinyMCE Wiki API for more details and examples on how to use this class. + * + * @class tinymce.dom.Selection + * @example + * // Getting the currently selected node for the active editor + * alert(tinymce.activeEditor.selection.getNode().nodeName); + */ +define("tinymce/dom/Selection", [ + "tinymce/dom/TreeWalker", + "tinymce/dom/TridentSelection", + "tinymce/dom/ControlSelection", + "tinymce/dom/RangeUtils", + "tinymce/dom/BookmarkManager", + "tinymce/Env", + "tinymce/util/Tools" +], function(TreeWalker, TridentSelection, ControlSelection, RangeUtils, BookmarkManager, Env, Tools) { + var each = Tools.each, trim = Tools.trim; + var isIE = Env.ie; + + /** + * Constructs a new selection instance. + * + * @constructor + * @method Selection + * @param {tinymce.dom.DOMUtils} dom DOMUtils object reference. + * @param {Window} win Window to bind the selection object to. + * @param {tinymce.dom.Serializer} serializer DOM serialization class to use for getContent. + */ + function Selection(dom, win, serializer, editor) { + var self = this; + + self.dom = dom; + self.win = win; + self.serializer = serializer; + self.editor = editor; + self.bookmarkManager = new BookmarkManager(self); + self.controlSelection = new ControlSelection(self, editor); + + // No W3C Range support + if (!self.win.getSelection) { + self.tridentSel = new TridentSelection(self); + } + } + + Selection.prototype = { + /** + * Move the selection cursor range to the specified node and offset. + * If there is no node specified it will move it to the first suitable location within the body. + * + * @method setCursorLocation + * @param {Node} node Optional node to put the cursor in. + * @param {Number} offset Optional offset from the start of the node to put the cursor at. + */ + setCursorLocation: function(node, offset) { + var self = this, rng = self.dom.createRng(); + + if (!node) { + self._moveEndPoint(rng, self.editor.getBody(), true); + self.setRng(rng); + } else { + rng.setStart(node, offset); + rng.setEnd(node, offset); + self.setRng(rng); + self.collapse(false); + } + }, + + /** + * Returns the selected contents using the DOM serializer passed in to this class. + * + * @method getContent + * @param {Object} s Optional settings class with for example output format text or html. + * @return {String} Selected contents in for example HTML format. + * @example + * // Alerts the currently selected contents + * alert(tinymce.activeEditor.selection.getContent()); + * + * // Alerts the currently selected contents as plain text + * alert(tinymce.activeEditor.selection.getContent({format: 'text'})); + */ + getContent: function(args) { + var self = this, rng = self.getRng(), tmpElm = self.dom.create("body"); + var se = self.getSel(), whiteSpaceBefore, whiteSpaceAfter, fragment; + + args = args || {}; + whiteSpaceBefore = whiteSpaceAfter = ''; + args.get = true; + args.format = args.format || 'html'; + args.selection = true; + self.editor.fire('BeforeGetContent', args); + + if (args.format == 'text') { + return self.isCollapsed() ? '' : (rng.text || (se.toString ? se.toString() : '')); + } + + if (rng.cloneContents) { + fragment = rng.cloneContents(); + + if (fragment) { + tmpElm.appendChild(fragment); + } + } else if (rng.item !== undefined || rng.htmlText !== undefined) { + // IE will produce invalid markup if elements are present that + // it doesn't understand like custom elements or HTML5 elements. + // Adding a BR in front of the contents and then remoiving it seems to fix it though. + tmpElm.innerHTML = '
    ' + (rng.item ? rng.item(0).outerHTML : rng.htmlText); + tmpElm.removeChild(tmpElm.firstChild); + } else { + tmpElm.innerHTML = rng.toString(); + } + + // Keep whitespace before and after + if (/^\s/.test(tmpElm.innerHTML)) { + whiteSpaceBefore = ' '; + } + + if (/\s+$/.test(tmpElm.innerHTML)) { + whiteSpaceAfter = ' '; + } + + args.getInner = true; + + args.content = self.isCollapsed() ? '' : whiteSpaceBefore + self.serializer.serialize(tmpElm, args) + whiteSpaceAfter; + self.editor.fire('GetContent', args); + + return args.content; + }, + + /** + * Sets the current selection to the specified content. If any contents is selected it will be replaced + * with the contents passed in to this function. If there is no selection the contents will be inserted + * where the caret is placed in the editor/page. + * + * @method setContent + * @param {String} content HTML contents to set could also be other formats depending on settings. + * @param {Object} args Optional settings object with for example data format. + * @example + * // Inserts some HTML contents at the current selection + * tinymce.activeEditor.selection.setContent('Some contents'); + */ + setContent: function(content, args) { + var self = this, rng = self.getRng(), caretNode, doc = self.win.document, frag, temp; + + args = args || {format: 'html'}; + args.set = true; + args.selection = true; + content = args.content = content; + + // Dispatch before set content event + if (!args.no_events) { + self.editor.fire('BeforeSetContent', args); + } + + content = args.content; + + if (rng.insertNode) { + // Make caret marker since insertNode places the caret in the beginning of text after insert + content += '_'; + + // Delete and insert new node + if (rng.startContainer == doc && rng.endContainer == doc) { + // WebKit will fail if the body is empty since the range is then invalid and it can't insert contents + doc.body.innerHTML = content; + } else { + rng.deleteContents(); + + if (doc.body.childNodes.length === 0) { + doc.body.innerHTML = content; + } else { + // createContextualFragment doesn't exists in IE 9 DOMRanges + if (rng.createContextualFragment) { + rng.insertNode(rng.createContextualFragment(content)); + } else { + // Fake createContextualFragment call in IE 9 + frag = doc.createDocumentFragment(); + temp = doc.createElement('div'); + + frag.appendChild(temp); + temp.outerHTML = content; + + rng.insertNode(frag); + } + } + } + + // Move to caret marker + caretNode = self.dom.get('__caret'); + + // Make sure we wrap it compleatly, Opera fails with a simple select call + rng = doc.createRange(); + rng.setStartBefore(caretNode); + rng.setEndBefore(caretNode); + self.setRng(rng); + + // Remove the caret position + self.dom.remove('__caret'); + + try { + self.setRng(rng); + } catch (ex) { + // Might fail on Opera for some odd reason + } + } else { + if (rng.item) { + // Delete content and get caret text selection + doc.execCommand('Delete', false, null); + rng = self.getRng(); + } + + // Explorer removes spaces from the beginning of pasted contents + if (/^\s+/.test(content)) { + rng.pasteHTML('_' + content); + self.dom.remove('__mce_tmp'); + } else { + rng.pasteHTML(content); + } + } + + // Dispatch set content event + if (!args.no_events) { + self.editor.fire('SetContent', args); + } + }, + + /** + * Returns the start element of a selection range. If the start is in a text + * node the parent element will be returned. + * + * @method getStart + * @param {Boolean} real Optional state to get the real parent when the selection is collapsed not the closest element. + * @return {Element} Start element of selection range. + */ + getStart: function(real) { + var self = this, rng = self.getRng(), startElement, parentElement, checkRng, node; + + if (rng.duplicate || rng.item) { + // Control selection, return first item + if (rng.item) { + return rng.item(0); + } + + // Get start element + checkRng = rng.duplicate(); + checkRng.collapse(1); + startElement = checkRng.parentElement(); + if (startElement.ownerDocument !== self.dom.doc) { + startElement = self.dom.getRoot(); + } + + // Check if range parent is inside the start element, then return the inner parent element + // This will fix issues when a single element is selected, IE would otherwise return the wrong start element + parentElement = node = rng.parentElement(); + while ((node = node.parentNode)) { + if (node == startElement) { + startElement = parentElement; + break; + } + } + + return startElement; + } else { + startElement = rng.startContainer; + + if (startElement.nodeType == 1 && startElement.hasChildNodes()) { + if (!real || !rng.collapsed) { + startElement = startElement.childNodes[Math.min(startElement.childNodes.length - 1, rng.startOffset)]; + } + } + + if (startElement && startElement.nodeType == 3) { + return startElement.parentNode; + } + + return startElement; + } + }, + + /** + * Returns the end element of a selection range. If the end is in a text + * node the parent element will be returned. + * + * @method getEnd + * @param {Boolean} real Optional state to get the real parent when the selection is collapsed not the closest element. + * @return {Element} End element of selection range. + */ + getEnd: function(real) { + var self = this, rng = self.getRng(), endElement, endOffset; + + if (rng.duplicate || rng.item) { + if (rng.item) { + return rng.item(0); + } + + rng = rng.duplicate(); + rng.collapse(0); + endElement = rng.parentElement(); + if (endElement.ownerDocument !== self.dom.doc) { + endElement = self.dom.getRoot(); + } + + if (endElement && endElement.nodeName == 'BODY') { + return endElement.lastChild || endElement; + } + + return endElement; + } else { + endElement = rng.endContainer; + endOffset = rng.endOffset; + + if (endElement.nodeType == 1 && endElement.hasChildNodes()) { + if (!real || !rng.collapsed) { + endElement = endElement.childNodes[endOffset > 0 ? endOffset - 1 : endOffset]; + } + } + + if (endElement && endElement.nodeType == 3) { + return endElement.parentNode; + } + + return endElement; + } + }, + + /** + * Returns a bookmark location for the current selection. This bookmark object + * can then be used to restore the selection after some content modification to the document. + * + * @method getBookmark + * @param {Number} type Optional state if the bookmark should be simple or not. Default is complex. + * @param {Boolean} normalized Optional state that enables you to get a position that it would be after normalization. + * @return {Object} Bookmark object, use moveToBookmark with this object to restore the selection. + * @example + * // Stores a bookmark of the current selection + * var bm = tinymce.activeEditor.selection.getBookmark(); + * + * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content'); + * + * // Restore the selection bookmark + * tinymce.activeEditor.selection.moveToBookmark(bm); + */ + getBookmark: function(type, normalized) { + return this.bookmarkManager.getBookmark(type, normalized); + }, + + /** + * Restores the selection to the specified bookmark. + * + * @method moveToBookmark + * @param {Object} bookmark Bookmark to restore selection from. + * @return {Boolean} true/false if it was successful or not. + * @example + * // Stores a bookmark of the current selection + * var bm = tinymce.activeEditor.selection.getBookmark(); + * + * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content'); + * + * // Restore the selection bookmark + * tinymce.activeEditor.selection.moveToBookmark(bm); + */ + moveToBookmark: function(bookmark) { + return this.bookmarkManager.moveToBookmark(bookmark); + }, + + /** + * Selects the specified element. This will place the start and end of the selection range around the element. + * + * @method select + * @param {Element} node HMTL DOM element to select. + * @param {Boolean} content Optional bool state if the contents should be selected or not on non IE browser. + * @return {Element} Selected element the same element as the one that got passed in. + * @example + * // Select the first paragraph in the active editor + * tinymce.activeEditor.selection.select(tinymce.activeEditor.dom.select('p')[0]); + */ + select: function(node, content) { + var self = this, dom = self.dom, rng = dom.createRng(), idx; + + // Clear stored range set by FocusManager + self.lastFocusBookmark = null; + + if (node) { + if (!content && self.controlSelection.controlSelect(node)) { + return; + } + + idx = dom.nodeIndex(node); + rng.setStart(node.parentNode, idx); + rng.setEnd(node.parentNode, idx + 1); + + // Find first/last text node or BR element + if (content) { + self._moveEndPoint(rng, node, true); + self._moveEndPoint(rng, node); + } + + self.setRng(rng); + } + + return node; + }, + + /** + * Returns true/false if the selection range is collapsed or not. Collapsed means if it's a caret or a larger selection. + * + * @method isCollapsed + * @return {Boolean} true/false state if the selection range is collapsed or not. + * Collapsed means if it's a caret or a larger selection. + */ + isCollapsed: function() { + var self = this, rng = self.getRng(), sel = self.getSel(); + + if (!rng || rng.item) { + return false; + } + + if (rng.compareEndPoints) { + return rng.compareEndPoints('StartToEnd', rng) === 0; + } + + return !sel || rng.collapsed; + }, + + /** + * Collapse the selection to start or end of range. + * + * @method collapse + * @param {Boolean} toStart Optional boolean state if to collapse to end or not. Defaults to start. + */ + collapse: function(toStart) { + var self = this, rng = self.getRng(), node; + + // Control range on IE + if (rng.item) { + node = rng.item(0); + rng = self.win.document.body.createTextRange(); + rng.moveToElementText(node); + } + + rng.collapse(!!toStart); + self.setRng(rng); + }, + + /** + * Returns the browsers internal selection object. + * + * @method getSel + * @return {Selection} Internal browser selection object. + */ + getSel: function() { + var win = this.win; + + return win.getSelection ? win.getSelection() : win.document.selection; + }, + + /** + * Returns the browsers internal range object. + * + * @method getRng + * @param {Boolean} w3c Forces a compatible W3C range on IE. + * @return {Range} Internal browser range object. + * @see http://www.quirksmode.org/dom/range_intro.html + * @see http://www.dotvoid.com/2001/03/using-the-range-object-in-mozilla/ + */ + getRng: function(w3c) { + var self = this, selection, rng, elm, doc = self.win.document, ieRng; + + function tryCompareBoundaryPoints(how, sourceRange, destinationRange) { + try { + return sourceRange.compareBoundaryPoints(how, destinationRange); + } catch (ex) { + // Gecko throws wrong document exception if the range points + // to nodes that where removed from the dom #6690 + // Browsers should mutate existing DOMRange instances so that they always point + // to something in the document this is not the case in Gecko works fine in IE/WebKit/Blink + // For performance reasons just return -1 + return -1; + } + } + + // Use last rng passed from FocusManager if it's available this enables + // calls to editor.selection.getStart() to work when caret focus is lost on IE + if (!w3c && self.lastFocusBookmark) { + var bookmark = self.lastFocusBookmark; + + // Convert bookmark to range IE 11 fix + if (bookmark.startContainer) { + rng = doc.createRange(); + rng.setStart(bookmark.startContainer, bookmark.startOffset); + rng.setEnd(bookmark.endContainer, bookmark.endOffset); + } else { + rng = bookmark; + } + + return rng; + } + + // Found tridentSel object then we need to use that one + if (w3c && self.tridentSel) { + return self.tridentSel.getRangeAt(0); + } + + try { + if ((selection = self.getSel())) { + if (selection.rangeCount > 0) { + rng = selection.getRangeAt(0); + } else { + rng = selection.createRange ? selection.createRange() : doc.createRange(); + } + } + } catch (ex) { + // IE throws unspecified error here if TinyMCE is placed in a frame/iframe + } + + // We have W3C ranges and it's IE then fake control selection since IE9 doesn't handle that correctly yet + // IE 11 doesn't support the selection object so we check for that as well + if (isIE && rng && rng.setStart && doc.selection) { + try { + // IE will sometimes throw an exception here + ieRng = doc.selection.createRange(); + } catch (ex) { + + } + + if (ieRng && ieRng.item) { + elm = ieRng.item(0); + rng = doc.createRange(); + rng.setStartBefore(elm); + rng.setEndAfter(elm); + } + } + + // No range found then create an empty one + // This can occur when the editor is placed in a hidden container element on Gecko + // Or on IE when there was an exception + if (!rng) { + rng = doc.createRange ? doc.createRange() : doc.body.createTextRange(); + } + + // If range is at start of document then move it to start of body + if (rng.setStart && rng.startContainer.nodeType === 9 && rng.collapsed) { + elm = self.dom.getRoot(); + rng.setStart(elm, 0); + rng.setEnd(elm, 0); + } + + if (self.selectedRange && self.explicitRange) { + if (tryCompareBoundaryPoints(rng.START_TO_START, rng, self.selectedRange) === 0 && + tryCompareBoundaryPoints(rng.END_TO_END, rng, self.selectedRange) === 0) { + // Safari, Opera and Chrome only ever select text which causes the range to change. + // This lets us use the originally set range if the selection hasn't been changed by the user. + rng = self.explicitRange; + } else { + self.selectedRange = null; + self.explicitRange = null; + } + } + + return rng; + }, + + /** + * Changes the selection to the specified DOM range. + * + * @method setRng + * @param {Range} rng Range to select. + */ + setRng: function(rng, forward) { + var self = this, sel; + + if (!rng) { + return; + } + + // Is IE specific range + if (rng.select) { + try { + rng.select(); + } catch (ex) { + // Needed for some odd IE bug #1843306 + } + + return; + } + + if (!self.tridentSel) { + sel = self.getSel(); + + if (sel) { + self.explicitRange = rng; + + try { + sel.removeAllRanges(); + sel.addRange(rng); + } catch (ex) { + // IE might throw errors here if the editor is within a hidden container and selection is changed + } + + // Forward is set to false and we have an extend function + if (forward === false && sel.extend) { + sel.collapse(rng.endContainer, rng.endOffset); + sel.extend(rng.startContainer, rng.startOffset); + } + + // adding range isn't always successful so we need to check range count otherwise an exception can occur + self.selectedRange = sel.rangeCount > 0 ? sel.getRangeAt(0) : null; + } + } else { + // Is W3C Range fake range on IE + if (rng.cloneRange) { + try { + self.tridentSel.addRange(rng); + return; + } catch (ex) { + //IE9 throws an error here if called before selection is placed in the editor + } + } + } + }, + + /** + * Sets the current selection to the specified DOM element. + * + * @method setNode + * @param {Element} elm Element to set as the contents of the selection. + * @return {Element} Returns the element that got passed in. + * @example + * // Inserts a DOM node at current selection/caret location + * tinymce.activeEditor.selection.setNode(tinymce.activeEditor.dom.create('img', {src: 'some.gif', title: 'some title'})); + */ + setNode: function(elm) { + var self = this; + + self.setContent(self.dom.getOuterHTML(elm)); + + return elm; + }, + + /** + * Returns the currently selected element or the common ancestor element for both start and end of the selection. + * + * @method getNode + * @return {Element} Currently selected element or common ancestor element. + * @example + * // Alerts the currently selected elements node name + * alert(tinymce.activeEditor.selection.getNode().nodeName); + */ + getNode: function() { + var self = this, rng = self.getRng(), elm; + var startContainer = rng.startContainer, endContainer = rng.endContainer; + var startOffset = rng.startOffset, endOffset = rng.endOffset, root = self.dom.getRoot(); + + function skipEmptyTextNodes(node, forwards) { + var orig = node; + + while (node && node.nodeType === 3 && node.length === 0) { + node = forwards ? node.nextSibling : node.previousSibling; + } + + return node || orig; + } + + // Range maybe lost after the editor is made visible again + if (!rng) { + return root; + } + + if (rng.setStart) { + elm = rng.commonAncestorContainer; + + // Handle selection a image or other control like element such as anchors + if (!rng.collapsed) { + if (startContainer == endContainer) { + if (endOffset - startOffset < 2) { + if (startContainer.hasChildNodes()) { + elm = startContainer.childNodes[startOffset]; + } + } + } + + // If the anchor node is a element instead of a text node then return this element + //if (tinymce.isWebKit && sel.anchorNode && sel.anchorNode.nodeType == 1) + // return sel.anchorNode.childNodes[sel.anchorOffset]; + + // Handle cases where the selection is immediately wrapped around a node and return that node instead of it's parent. + // This happens when you double click an underlined word in FireFox. + if (startContainer.nodeType === 3 && endContainer.nodeType === 3) { + if (startContainer.length === startOffset) { + startContainer = skipEmptyTextNodes(startContainer.nextSibling, true); + } else { + startContainer = startContainer.parentNode; + } + + if (endOffset === 0) { + endContainer = skipEmptyTextNodes(endContainer.previousSibling, false); + } else { + endContainer = endContainer.parentNode; + } + + if (startContainer && startContainer === endContainer) { + return startContainer; + } + } + } + + if (elm && elm.nodeType == 3) { + return elm.parentNode; + } + + return elm; + } + + elm = rng.item ? rng.item(0) : rng.parentElement(); + + // IE 7 might return elements outside the iframe + if (elm.ownerDocument !== self.win.document) { + elm = root; + } + + return elm; + }, + + getSelectedBlocks: function(startElm, endElm) { + var self = this, dom = self.dom, node, root, selectedBlocks = []; + + root = dom.getRoot(); + startElm = dom.getParent(startElm || self.getStart(), dom.isBlock); + endElm = dom.getParent(endElm || self.getEnd(), dom.isBlock); + + if (startElm && startElm != root) { + selectedBlocks.push(startElm); + } + + if (startElm && endElm && startElm != endElm) { + node = startElm; + + var walker = new TreeWalker(startElm, root); + while ((node = walker.next()) && node != endElm) { + if (dom.isBlock(node)) { + selectedBlocks.push(node); + } + } + } + + if (endElm && startElm != endElm && endElm != root) { + selectedBlocks.push(endElm); + } + + return selectedBlocks; + }, + + isForward: function() { + var dom = this.dom, sel = this.getSel(), anchorRange, focusRange; + + // No support for selection direction then always return true + if (!sel || !sel.anchorNode || !sel.focusNode) { + return true; + } + + anchorRange = dom.createRng(); + anchorRange.setStart(sel.anchorNode, sel.anchorOffset); + anchorRange.collapse(true); + + focusRange = dom.createRng(); + focusRange.setStart(sel.focusNode, sel.focusOffset); + focusRange.collapse(true); + + return anchorRange.compareBoundaryPoints(anchorRange.START_TO_START, focusRange) <= 0; + }, + + normalize: function() { + var self = this, rng = self.getRng(); + + if (Env.range && new RangeUtils(self.dom).normalize(rng)) { + self.setRng(rng, self.isForward()); + } + + return rng; + }, + + /** + * Executes callback when the current selection starts/stops matching the specified selector. The current + * state will be passed to the callback as it's first argument. + * + * @method selectorChanged + * @param {String} selector CSS selector to check for. + * @param {function} callback Callback with state and args when the selector is matches or not. + */ + selectorChanged: function(selector, callback) { + var self = this, currentSelectors; + + if (!self.selectorChangedData) { + self.selectorChangedData = {}; + currentSelectors = {}; + + self.editor.on('NodeChange', function(e) { + var node = e.element, dom = self.dom, parents = dom.getParents(node, null, dom.getRoot()), matchedSelectors = {}; + + // Check for new matching selectors + each(self.selectorChangedData, function(callbacks, selector) { + each(parents, function(node) { + if (dom.is(node, selector)) { + if (!currentSelectors[selector]) { + // Execute callbacks + each(callbacks, function(callback) { + callback(true, {node: node, selector: selector, parents: parents}); + }); + + currentSelectors[selector] = callbacks; + } + + matchedSelectors[selector] = callbacks; + return false; + } + }); + }); + + // Check if current selectors still match + each(currentSelectors, function(callbacks, selector) { + if (!matchedSelectors[selector]) { + delete currentSelectors[selector]; + + each(callbacks, function(callback) { + callback(false, {node: node, selector: selector, parents: parents}); + }); + } + }); + }); + } + + // Add selector listeners + if (!self.selectorChangedData[selector]) { + self.selectorChangedData[selector] = []; + } + + self.selectorChangedData[selector].push(callback); + + return self; + }, + + getScrollContainer: function() { + var scrollContainer, node = this.dom.getRoot(); + + while (node && node.nodeName != 'BODY') { + if (node.scrollHeight > node.clientHeight) { + scrollContainer = node; + break; + } + + node = node.parentNode; + } + + return scrollContainer; + }, + + scrollIntoView: function(elm) { + var y, viewPort, self = this, dom = self.dom, root = dom.getRoot(), viewPortY, viewPortH; + + function getPos(elm) { + var x = 0, y = 0; + + var offsetParent = elm; + while (offsetParent && offsetParent.nodeType) { + x += offsetParent.offsetLeft || 0; + y += offsetParent.offsetTop || 0; + offsetParent = offsetParent.offsetParent; + } + + return {x: x, y: y}; + } + + if (root.nodeName != 'BODY') { + var scrollContainer = self.getScrollContainer(); + if (scrollContainer) { + y = getPos(elm).y - getPos(scrollContainer).y; + viewPortH = scrollContainer.clientHeight; + viewPortY = scrollContainer.scrollTop; + if (y < viewPortY || y + 25 > viewPortY + viewPortH) { + scrollContainer.scrollTop = y < viewPortY ? y : y - viewPortH + 25; + } + + return; + } + } + + viewPort = dom.getViewPort(self.editor.getWin()); + y = dom.getPos(elm).y; + viewPortY = viewPort.y; + viewPortH = viewPort.h; + if (y < viewPort.y || y + 25 > viewPortY + viewPortH) { + self.editor.getWin().scrollTo(0, y < viewPortY ? y : y - viewPortH + 25); + } + }, + + placeCaretAt: function(clientX, clientY) { + var doc = this.editor.getDoc(), rng, point; + + if (doc.caretPositionFromPoint) { + point = doc.caretPositionFromPoint(clientX, clientY); + rng = doc.createRange(); + rng.setStart(point.offsetNode, point.offset); + rng.collapse(true); + } else if (doc.caretRangeFromPoint) { + rng = doc.caretRangeFromPoint(clientX, clientY); + } else if (doc.body.createTextRange) { + rng = doc.body.createTextRange(); + + try { + rng.moveToPoint(clientX, clientY); + rng.collapse(true); + } catch (ex) { + rng.collapse(clientY < doc.body.clientHeight); + } + } + + this.setRng(rng); + }, + + _moveEndPoint: function(rng, node, start) { + var root = node, walker = new TreeWalker(node, root); + var nonEmptyElementsMap = this.dom.schema.getNonEmptyElements(); + + do { + // Text node + if (node.nodeType == 3 && trim(node.nodeValue).length !== 0) { + if (start) { + rng.setStart(node, 0); + } else { + rng.setEnd(node, node.nodeValue.length); + } + + return; + } + + // BR/IMG/INPUT elements but not table cells + if (nonEmptyElementsMap[node.nodeName] && !/^(TD|TH)$/.test(node.nodeName)) { + if (start) { + rng.setStartBefore(node); + } else { + if (node.nodeName == 'BR') { + rng.setEndBefore(node); + } else { + rng.setEndAfter(node); + } + } + + return; + } + + // Found empty text block old IE can place the selection inside those + if (Env.ie && Env.ie < 11 && this.dom.isBlock(node) && this.dom.isEmpty(node)) { + if (start) { + rng.setStart(node, 0); + } else { + rng.setEnd(node, 0); + } + + return; + } + } while ((node = (start ? walker.next() : walker.prev()))); + + // Failed to find any text node or other suitable location then move to the root of body + if (root.nodeName == 'BODY') { + if (start) { + rng.setStart(root, 0); + } else { + rng.setEnd(root, root.childNodes.length); + } + } + }, + + destroy: function() { + this.win = null; + this.controlSelection.destroy(); + } + }; + + return Selection; +}); + +// Included from: js/tinymce/classes/dom/ElementUtils.js + +/** + * ElementUtils.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Utility class for various element specific functions. + * + * @private + */ +define("tinymce/dom/ElementUtils", [ + "tinymce/dom/BookmarkManager", + "tinymce/util/Tools" +], function(BookmarkManager, Tools) { + var each = Tools.each; + + function ElementUtils(dom) { + /** + * Compares two nodes and checks if it's attributes and styles matches. + * This doesn't compare classes as items since their order is significant. + * + * @method compare + * @param {Node} node1 First node to compare with. + * @param {Node} node2 Second node to compare with. + * @return {boolean} True/false if the nodes are the same or not. + */ + this.compare = function(node1, node2) { + // Not the same name + if (node1.nodeName != node2.nodeName) { + return false; + } + + /** + * Returns all the nodes attributes excluding internal ones, styles and classes. + * + * @private + * @param {Node} node Node to get attributes from. + * @return {Object} Name/value object with attributes and attribute values. + */ + function getAttribs(node) { + var attribs = {}; + + each(dom.getAttribs(node), function(attr) { + var name = attr.nodeName.toLowerCase(); + + // Don't compare internal attributes or style + if (name.indexOf('_') !== 0 && name !== 'style' && name !== 'data-mce-style') { + attribs[name] = dom.getAttrib(node, name); + } + }); + + return attribs; + } + + /** + * Compares two objects checks if it's key + value exists in the other one. + * + * @private + * @param {Object} obj1 First object to compare. + * @param {Object} obj2 Second object to compare. + * @return {boolean} True/false if the objects matches or not. + */ + function compareObjects(obj1, obj2) { + var value, name; + + for (name in obj1) { + // Obj1 has item obj2 doesn't have + if (obj1.hasOwnProperty(name)) { + value = obj2[name]; + + // Obj2 doesn't have obj1 item + if (typeof value == "undefined") { + return false; + } + + // Obj2 item has a different value + if (obj1[name] != value) { + return false; + } + + // Delete similar value + delete obj2[name]; + } + } + + // Check if obj 2 has something obj 1 doesn't have + for (name in obj2) { + // Obj2 has item obj1 doesn't have + if (obj2.hasOwnProperty(name)) { + return false; + } + } + + return true; + } + + // Attribs are not the same + if (!compareObjects(getAttribs(node1), getAttribs(node2))) { + return false; + } + + // Styles are not the same + if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style')))) { + return false; + } + + return !BookmarkManager.isBookmarkNode(node1) && !BookmarkManager.isBookmarkNode(node2); + }; + } + + return ElementUtils; +}); + +// Included from: js/tinymce/classes/fmt/Preview.js + +/** + * Preview.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Internal class for generating previews styles for formats. + * + * Example: + * Preview.getCssText(editor, 'bold'); + * + * @class tinymce.fmt.Preview + * @private + */ +define("tinymce/fmt/Preview", [ + "tinymce/util/Tools" +], function(Tools) { + var each = Tools.each; + + function getCssText(editor, format) { + var name, previewElm, dom = editor.dom; + var previewCss = '', parentFontSize, previewStyles; + + previewStyles = editor.settings.preview_styles; + + // No preview forced + if (previewStyles === false) { + return ''; + } + + // Default preview + if (!previewStyles) { + previewStyles = 'font-family font-size font-weight font-style text-decoration ' + + 'text-transform color background-color border border-radius outline text-shadow'; + } + + // Removes any variables since these can't be previewed + function removeVars(val) { + return val.replace(/%(\w+)/g, ''); + } + + // Create block/inline element to use for preview + if (typeof format == "string") { + format = editor.formatter.get(format); + if (!format) { + return; + } + + format = format[0]; + } + + name = format.block || format.inline || 'span'; + previewElm = dom.create(name); + + // Add format styles to preview element + each(format.styles, function(value, name) { + value = removeVars(value); + + if (value) { + dom.setStyle(previewElm, name, value); + } + }); + + // Add attributes to preview element + each(format.attributes, function(value, name) { + value = removeVars(value); + + if (value) { + dom.setAttrib(previewElm, name, value); + } + }); + + // Add classes to preview element + each(format.classes, function(value) { + value = removeVars(value); + + if (!dom.hasClass(previewElm, value)) { + dom.addClass(previewElm, value); + } + }); + + editor.fire('PreviewFormats'); + + // Add the previewElm outside the visual area + dom.setStyles(previewElm, {position: 'absolute', left: -0xFFFF}); + editor.getBody().appendChild(previewElm); + + // Get parent container font size so we can compute px values out of em/% for older IE:s + parentFontSize = dom.getStyle(editor.getBody(), 'fontSize', true); + parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0; + + each(previewStyles.split(' '), function(name) { + var value = dom.getStyle(previewElm, name, true); + + // If background is transparent then check if the body has a background color we can use + if (name == 'background-color' && /transparent|rgba\s*\([^)]+,\s*0\)/.test(value)) { + value = dom.getStyle(editor.getBody(), name, true); + + // Ignore white since it's the default color, not the nicest fix + // TODO: Fix this by detecting runtime style + if (dom.toHex(value).toLowerCase() == '#ffffff') { + return; + } + } + + if (name == 'color') { + // Ignore black since it's the default color, not the nicest fix + // TODO: Fix this by detecting runtime style + if (dom.toHex(value).toLowerCase() == '#000000') { + return; + } + } + + // Old IE won't calculate the font size so we need to do that manually + if (name == 'font-size') { + if (/em|%$/.test(value)) { + if (parentFontSize === 0) { + return; + } + + // Convert font size from em/% to px + value = parseFloat(value, 10) / (/%$/.test(value) ? 100 : 1); + value = (value * parentFontSize) + 'px'; + } + } + + if (name == "border" && value) { + previewCss += 'padding:0 2px;'; + } + + previewCss += name + ':' + value + ';'; + }); + + editor.fire('AfterPreviewFormats'); + + //previewCss += 'line-height:normal'; + + dom.remove(previewElm); + + return previewCss; + } + + return { + getCssText: getCssText + }; +}); + +// Included from: js/tinymce/classes/Formatter.js + +/** + * Formatter.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Text formatter engine class. This class is used to apply formats like bold, italic, font size + * etc to the current selection or specific nodes. This engine was build to replace the browsers + * default formatting logic for execCommand due to it's inconsistent and buggy behavior. + * + * @class tinymce.Formatter + * @example + * tinymce.activeEditor.formatter.register('mycustomformat', { + * inline: 'span', + * styles: {color: '#ff0000'} + * }); + * + * tinymce.activeEditor.formatter.apply('mycustomformat'); + */ +define("tinymce/Formatter", [ + "tinymce/dom/TreeWalker", + "tinymce/dom/RangeUtils", + "tinymce/dom/BookmarkManager", + "tinymce/dom/ElementUtils", + "tinymce/util/Tools", + "tinymce/fmt/Preview" +], function(TreeWalker, RangeUtils, BookmarkManager, ElementUtils, Tools, Preview) { + /** + * Constructs a new formatter instance. + * + * @constructor Formatter + * @param {tinymce.Editor} ed Editor instance to construct the formatter engine to. + */ + return function(ed) { + var formats = {}, + dom = ed.dom, + selection = ed.selection, + rangeUtils = new RangeUtils(dom), + isValid = ed.schema.isValidChild, + isBlock = dom.isBlock, + forcedRootBlock = ed.settings.forced_root_block, + nodeIndex = dom.nodeIndex, + INVISIBLE_CHAR = '\uFEFF', + MCE_ATTR_RE = /^(src|href|style)$/, + FALSE = false, + TRUE = true, + formatChangeData, + undef, + getContentEditable = dom.getContentEditable, + disableCaretContainer, + markCaretContainersBogus, + isBookmarkNode = BookmarkManager.isBookmarkNode; + + var each = Tools.each, + grep = Tools.grep, + walk = Tools.walk, + extend = Tools.extend; + + function isTextBlock(name) { + if (name.nodeType) { + name = name.nodeName; + } + + return !!ed.schema.getTextBlockElements()[name.toLowerCase()]; + } + + function isTableCell(node) { + return /^(TH|TD)$/.test(node.nodeName); + } + + function getParents(node, selector) { + return dom.getParents(node, selector, dom.getRoot()); + } + + function isCaretNode(node) { + return node.nodeType === 1 && node.id === '_mce_caret'; + } + + function defaultFormats() { + register({ + valigntop: [ + {selector: 'td,th', styles: {'verticalAlign': 'top'}} + ], + + valignmiddle: [ + {selector: 'td,th', styles: {'verticalAlign': 'middle'}} + ], + + valignbottom: [ + {selector: 'td,th', styles: {'verticalAlign': 'bottom'}} + ], + + alignleft: [ + {selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'left'}, defaultBlock: 'div'}, + {selector: 'img,table', collapsed: false, styles: {'float': 'left'}} + ], + + aligncenter: [ + {selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'center'}, defaultBlock: 'div'}, + {selector: 'img', collapsed: false, styles: {display: 'block', marginLeft: 'auto', marginRight: 'auto'}}, + {selector: 'table', collapsed: false, styles: {marginLeft: 'auto', marginRight: 'auto'}} + ], + + alignright: [ + {selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'right'}, defaultBlock: 'div'}, + {selector: 'img,table', collapsed: false, styles: {'float': 'right'}} + ], + + alignjustify: [ + {selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'justify'}, defaultBlock: 'div'} + ], + + bold: [ + {inline: 'strong', remove: 'all'}, + {inline: 'span', styles: {fontWeight: 'bold'}}, + {inline: 'b', remove: 'all'} + ], + + italic: [ + {inline: 'em', remove: 'all'}, + {inline: 'span', styles: {fontStyle: 'italic'}}, + {inline: 'i', remove: 'all'} + ], + + underline: [ + {inline: 'span', styles: {textDecoration: 'underline'}, exact: true}, + {inline: 'u', remove: 'all'} + ], + + strikethrough: [ + {inline: 'span', styles: {textDecoration: 'line-through'}, exact: true}, + {inline: 'strike', remove: 'all'} + ], + + forecolor: {inline: 'span', styles: {color: '%value'}, links: true, remove_similar: true}, + hilitecolor: {inline: 'span', styles: {backgroundColor: '%value'}, links: true, remove_similar: true}, + fontname: {inline: 'span', styles: {fontFamily: '%value'}}, + fontsize: {inline: 'span', styles: {fontSize: '%value'}}, + fontsize_class: {inline: 'span', attributes: {'class': '%value'}}, + blockquote: {block: 'blockquote', wrapper: 1, remove: 'all'}, + subscript: {inline: 'sub'}, + superscript: {inline: 'sup'}, + code: {inline: 'code'}, + + link: {inline: 'a', selector: 'a', remove: 'all', split: true, deep: true, + onmatch: function() { + return true; + }, + + onformat: function(elm, fmt, vars) { + each(vars, function(value, key) { + dom.setAttrib(elm, key, value); + }); + } + }, + + removeformat: [ + { + selector: 'b,strong,em,i,font,u,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins', + remove: 'all', + split: true, + expand: false, + block_expand: true, + deep: true + }, + {selector: 'span', attributes: ['style', 'class'], remove: 'empty', split: true, expand: false, deep: true}, + {selector: '*', attributes: ['style', 'class'], split: false, expand: false, deep: true} + ] + }); + + // Register default block formats + each('p h1 h2 h3 h4 h5 h6 div address pre div dt dd samp'.split(/\s/), function(name) { + register(name, {block: name, remove: 'all'}); + }); + + // Register user defined formats + register(ed.settings.formats); + } + + function addKeyboardShortcuts() { + // Add some inline shortcuts + ed.addShortcut('meta+b', 'bold_desc', 'Bold'); + ed.addShortcut('meta+i', 'italic_desc', 'Italic'); + ed.addShortcut('meta+u', 'underline_desc', 'Underline'); + + // BlockFormat shortcuts keys + for (var i = 1; i <= 6; i++) { + ed.addShortcut('access+' + i, '', ['FormatBlock', false, 'h' + i]); + } + + ed.addShortcut('access+7', '', ['FormatBlock', false, 'p']); + ed.addShortcut('access+8', '', ['FormatBlock', false, 'div']); + ed.addShortcut('access+9', '', ['FormatBlock', false, 'address']); + } + + // Public functions + + /** + * Returns the format by name or all formats if no name is specified. + * + * @method get + * @param {String} name Optional name to retrive by. + * @return {Array/Object} Array/Object with all registred formats or a specific format. + */ + function get(name) { + return name ? formats[name] : formats; + } + + /** + * Registers a specific format by name. + * + * @method register + * @param {Object/String} name Name of the format for example "bold". + * @param {Object/Array} format Optional format object or array of format variants + * can only be omitted if the first arg is an object. + */ + function register(name, format) { + if (name) { + if (typeof name !== 'string') { + each(name, function(format, name) { + register(name, format); + }); + } else { + // Force format into array and add it to internal collection + format = format.length ? format : [format]; + + each(format, function(format) { + // Set deep to false by default on selector formats this to avoid removing + // alignment on images inside paragraphs when alignment is changed on paragraphs + if (format.deep === undef) { + format.deep = !format.selector; + } + + // Default to true + if (format.split === undef) { + format.split = !format.selector || format.inline; + } + + // Default to true + if (format.remove === undef && format.selector && !format.inline) { + format.remove = 'none'; + } + + // Mark format as a mixed format inline + block level + if (format.selector && format.inline) { + format.mixed = true; + format.block_expand = true; + } + + // Split classes if needed + if (typeof format.classes === 'string') { + format.classes = format.classes.split(/\s+/); + } + }); + + formats[name] = format; + } + } + } + + /** + * Unregister a specific format by name. + * + * @method unregister + * @param {String} name Name of the format for example "bold". + */ + function unregister(name) { + if (name && formats[name]) { + delete formats[name]; + } + + return formats; + } + + function getTextDecoration(node) { + var decoration; + + ed.dom.getParent(node, function(n) { + decoration = ed.dom.getStyle(n, 'text-decoration'); + return decoration && decoration !== 'none'; + }); + + return decoration; + } + + function processUnderlineAndColor(node) { + var textDecoration; + if (node.nodeType === 1 && node.parentNode && node.parentNode.nodeType === 1) { + textDecoration = getTextDecoration(node.parentNode); + if (ed.dom.getStyle(node, 'color') && textDecoration) { + ed.dom.setStyle(node, 'text-decoration', textDecoration); + } else if (ed.dom.getStyle(node, 'text-decoration') === textDecoration) { + ed.dom.setStyle(node, 'text-decoration', null); + } + } + } + + /** + * Applies the specified format to the current selection or specified node. + * + * @method apply + * @param {String} name Name of format to apply. + * @param {Object} vars Optional list of variables to replace within format before applying it. + * @param {Node} node Optional node to apply the format to defaults to current selection. + */ + function apply(name, vars, node) { + var formatList = get(name), format = formatList[0], bookmark, rng, isCollapsed = !node && selection.isCollapsed(); + + function setElementFormat(elm, fmt) { + fmt = fmt || format; + + if (elm) { + if (fmt.onformat) { + fmt.onformat(elm, fmt, vars, node); + } + + each(fmt.styles, function(value, name) { + dom.setStyle(elm, name, replaceVars(value, vars)); + }); + + // Needed for the WebKit span spam bug + // TODO: Remove this once WebKit/Blink fixes this + if (fmt.styles) { + var styleVal = dom.getAttrib(elm, 'style'); + + if (styleVal) { + elm.setAttribute('data-mce-style', styleVal); + } + } + + each(fmt.attributes, function(value, name) { + dom.setAttrib(elm, name, replaceVars(value, vars)); + }); + + each(fmt.classes, function(value) { + value = replaceVars(value, vars); + + if (!dom.hasClass(elm, value)) { + dom.addClass(elm, value); + } + }); + } + } + + function adjustSelectionToVisibleSelection() { + function findSelectionEnd(start, end) { + var walker = new TreeWalker(end); + for (node = walker.current(); node; node = walker.prev()) { + if (node.childNodes.length > 1 || node == start || node.tagName == 'BR') { + return node; + } + } + } + + // Adjust selection so that a end container with a end offset of zero is not included in the selection + // as this isn't visible to the user. + var rng = ed.selection.getRng(); + var start = rng.startContainer; + var end = rng.endContainer; + + if (start != end && rng.endOffset === 0) { + var newEnd = findSelectionEnd(start, end); + var endOffset = newEnd.nodeType == 3 ? newEnd.length : newEnd.childNodes.length; + + rng.setEnd(newEnd, endOffset); + } + + return rng; + } + + function applyRngStyle(rng, bookmark, node_specific) { + var newWrappers = [], wrapName, wrapElm, contentEditable = true; + + // Setup wrapper element + wrapName = format.inline || format.block; + wrapElm = dom.create(wrapName); + setElementFormat(wrapElm); + + rangeUtils.walk(rng, function(nodes) { + var currentWrapElm; + + /** + * Process a list of nodes wrap them. + */ + function process(node) { + var nodeName, parentName, found, hasContentEditableState, lastContentEditable; + + lastContentEditable = contentEditable; + nodeName = node.nodeName.toLowerCase(); + parentName = node.parentNode.nodeName.toLowerCase(); + + // Node has a contentEditable value + if (node.nodeType === 1 && getContentEditable(node)) { + lastContentEditable = contentEditable; + contentEditable = getContentEditable(node) === "true"; + hasContentEditableState = true; // We don't want to wrap the container only it's children + } + + // Stop wrapping on br elements + if (isEq(nodeName, 'br')) { + currentWrapElm = 0; + + // Remove any br elements when we wrap things + if (format.block) { + dom.remove(node); + } + + return; + } + + // If node is wrapper type + if (format.wrapper && matchNode(node, name, vars)) { + currentWrapElm = 0; + return; + } + + // Can we rename the block + // TODO: Break this if up, too complex + if (contentEditable && !hasContentEditableState && format.block && + !format.wrapper && isTextBlock(nodeName) && isValid(parentName, wrapName)) { + node = dom.rename(node, wrapName); + setElementFormat(node); + newWrappers.push(node); + currentWrapElm = 0; + return; + } + + // Handle selector patterns + if (format.selector) { + // Look for matching formats + each(formatList, function(format) { + // Check collapsed state if it exists + if ('collapsed' in format && format.collapsed !== isCollapsed) { + return; + } + + if (dom.is(node, format.selector) && !isCaretNode(node)) { + setElementFormat(node, format); + found = true; + } + }); + + // Continue processing if a selector match wasn't found and a inline element is defined + if (!format.inline || found) { + currentWrapElm = 0; + return; + } + } + + // Is it valid to wrap this item + // TODO: Break this if up, too complex + if (contentEditable && !hasContentEditableState && isValid(wrapName, nodeName) && isValid(parentName, wrapName) && + !(!node_specific && node.nodeType === 3 && + node.nodeValue.length === 1 && + node.nodeValue.charCodeAt(0) === 65279) && + !isCaretNode(node) && + (!format.inline || !isBlock(node))) { + // Start wrapping + if (!currentWrapElm) { + // Wrap the node + currentWrapElm = dom.clone(wrapElm, FALSE); + node.parentNode.insertBefore(currentWrapElm, node); + newWrappers.push(currentWrapElm); + } + + currentWrapElm.appendChild(node); + } else { + // Start a new wrapper for possible children + currentWrapElm = 0; + + each(grep(node.childNodes), process); + + if (hasContentEditableState) { + contentEditable = lastContentEditable; // Restore last contentEditable state from stack + } + + // End the last wrapper + currentWrapElm = 0; + } + } + + // Process siblings from range + each(nodes, process); + }); + + // Apply formats to links as well to get the color of the underline to change as well + if (format.links === true) { + each(newWrappers, function(node) { + function process(node) { + if (node.nodeName === 'A') { + setElementFormat(node, format); + } + + each(grep(node.childNodes), process); + } + + process(node); + }); + } + + // Cleanup + each(newWrappers, function(node) { + var childCount; + + function getChildCount(node) { + var count = 0; + + each(node.childNodes, function(node) { + if (!isWhiteSpaceNode(node) && !isBookmarkNode(node)) { + count++; + } + }); + + return count; + } + + function mergeStyles(node) { + var child, clone; + + each(node.childNodes, function(node) { + if (node.nodeType == 1 && !isBookmarkNode(node) && !isCaretNode(node)) { + child = node; + return FALSE; // break loop + } + }); + + // If child was found and of the same type as the current node + if (child && !isBookmarkNode(child) && matchName(child, format)) { + clone = dom.clone(child, FALSE); + setElementFormat(clone); + + dom.replace(clone, node, TRUE); + dom.remove(child, 1); + } + + return clone || node; + } + + childCount = getChildCount(node); + + // Remove empty nodes but only if there is multiple wrappers and they are not block + // elements so never remove single

    since that would remove the + // currrent empty block element where the caret is at + if ((newWrappers.length > 1 || !isBlock(node)) && childCount === 0) { + dom.remove(node, 1); + return; + } + + if (format.inline || format.wrapper) { + // Merges the current node with it's children of similar type to reduce the number of elements + if (!format.exact && childCount === 1) { + node = mergeStyles(node); + } + + // Remove/merge children + each(formatList, function(format) { + // Merge all children of similar type will move styles from child to parent + // this: text + // will become: text + each(dom.select(format.inline, node), function(child) { + if (isBookmarkNode(child)) { + return; + } + + removeFormat(format, vars, child, format.exact ? child : null); + }); + }); + + // Remove child if direct parent is of same type + if (matchNode(node.parentNode, name, vars)) { + dom.remove(node, 1); + node = 0; + return TRUE; + } + + // Look for parent with similar style format + if (format.merge_with_parents) { + dom.getParent(node.parentNode, function(parent) { + if (matchNode(parent, name, vars)) { + dom.remove(node, 1); + node = 0; + return TRUE; + } + }); + } + + // Merge next and previous siblings if they are similar texttext becomes texttext + if (node && format.merge_siblings !== false) { + node = mergeSiblings(getNonWhiteSpaceSibling(node), node); + node = mergeSiblings(node, getNonWhiteSpaceSibling(node, TRUE)); + } + } + }); + } + + if (format) { + if (node) { + if (node.nodeType) { + rng = dom.createRng(); + rng.setStartBefore(node); + rng.setEndAfter(node); + applyRngStyle(expandRng(rng, formatList), null, true); + } else { + applyRngStyle(node, null, true); + } + } else { + if (!isCollapsed || !format.inline || dom.select('td.mce-item-selected,th.mce-item-selected').length) { + // Obtain selection node before selection is unselected by applyRngStyle() + var curSelNode = ed.selection.getNode(); + + // If the formats have a default block and we can't find a parent block then + // start wrapping it with a DIV this is for forced_root_blocks: false + // It's kind of a hack but people should be using the default block type P since all desktop editors work that way + if (!forcedRootBlock && formatList[0].defaultBlock && !dom.getParent(curSelNode, dom.isBlock)) { + apply(formatList[0].defaultBlock); + } + + // Apply formatting to selection + ed.selection.setRng(adjustSelectionToVisibleSelection()); + bookmark = selection.getBookmark(); + applyRngStyle(expandRng(selection.getRng(TRUE), formatList), bookmark); + + // Colored nodes should be underlined so that the color of the underline matches the text color. + if (format.styles && (format.styles.color || format.styles.textDecoration)) { + walk(curSelNode, processUnderlineAndColor, 'childNodes'); + processUnderlineAndColor(curSelNode); + } + + selection.moveToBookmark(bookmark); + moveStart(selection.getRng(TRUE)); + ed.nodeChanged(); + } else { + performCaretAction('apply', name, vars); + } + } + } + } + + /** + * Removes the specified format from the current selection or specified node. + * + * @method remove + * @param {String} name Name of format to remove. + * @param {Object} vars Optional list of variables to replace within format before removing it. + * @param {Node/Range} node Optional node or DOM range to remove the format from defaults to current selection. + */ + function remove(name, vars, node, similar) { + var formatList = get(name), format = formatList[0], bookmark, rng, contentEditable = true; + + // Merges the styles for each node + function process(node) { + var children, i, l, lastContentEditable, hasContentEditableState; + + // Node has a contentEditable value + if (node.nodeType === 1 && getContentEditable(node)) { + lastContentEditable = contentEditable; + contentEditable = getContentEditable(node) === "true"; + hasContentEditableState = true; // We don't want to wrap the container only it's children + } + + // Grab the children first since the nodelist might be changed + children = grep(node.childNodes); + + // Process current node + if (contentEditable && !hasContentEditableState) { + for (i = 0, l = formatList.length; i < l; i++) { + if (removeFormat(formatList[i], vars, node, node)) { + break; + } + } + } + + // Process the children + if (format.deep) { + if (children.length) { + for (i = 0, l = children.length; i < l; i++) { + process(children[i]); + } + + if (hasContentEditableState) { + contentEditable = lastContentEditable; // Restore last contentEditable state from stack + } + } + } + } + + function findFormatRoot(container) { + var formatRoot; + + // Find format root + each(getParents(container.parentNode).reverse(), function(parent) { + var format; + + // Find format root element + if (!formatRoot && parent.id != '_start' && parent.id != '_end') { + // Is the node matching the format we are looking for + format = matchNode(parent, name, vars, similar); + if (format && format.split !== false) { + formatRoot = parent; + } + } + }); + + return formatRoot; + } + + function wrapAndSplit(formatRoot, container, target, split) { + var parent, clone, lastClone, firstClone, i, formatRootParent; + + // Format root found then clone formats and split it + if (formatRoot) { + formatRootParent = formatRoot.parentNode; + + for (parent = container.parentNode; parent && parent != formatRootParent; parent = parent.parentNode) { + clone = dom.clone(parent, FALSE); + + for (i = 0; i < formatList.length; i++) { + if (removeFormat(formatList[i], vars, clone, clone)) { + clone = 0; + break; + } + } + + // Build wrapper node + if (clone) { + if (lastClone) { + clone.appendChild(lastClone); + } + + if (!firstClone) { + firstClone = clone; + } + + lastClone = clone; + } + } + + // Never split block elements if the format is mixed + if (split && (!format.mixed || !isBlock(formatRoot))) { + container = dom.split(formatRoot, container); + } + + // Wrap container in cloned formats + if (lastClone) { + target.parentNode.insertBefore(lastClone, target); + firstClone.appendChild(target); + } + } + + return container; + } + + function splitToFormatRoot(container) { + return wrapAndSplit(findFormatRoot(container), container, container, true); + } + + function unwrap(start) { + var node = dom.get(start ? '_start' : '_end'), + out = node[start ? 'firstChild' : 'lastChild']; + + // If the end is placed within the start the result will be removed + // So this checks if the out node is a bookmark node if it is it + // checks for another more suitable node + if (isBookmarkNode(out)) { + out = out[start ? 'firstChild' : 'lastChild']; + } + + // Since dom.remove removes empty text nodes then we need to try to find a better node + if (out.nodeType == 3 && out.data.length === 0) { + out = start ? node.previousSibling || node.nextSibling : node.nextSibling || node.previousSibling; + } + + dom.remove(node, true); + + return out; + } + + function removeRngStyle(rng) { + var startContainer, endContainer; + var commonAncestorContainer = rng.commonAncestorContainer; + + rng = expandRng(rng, formatList, TRUE); + + if (format.split) { + startContainer = getContainer(rng, TRUE); + endContainer = getContainer(rng); + + if (startContainer != endContainer) { + // WebKit will render the table incorrectly if we wrap a TH or TD in a SPAN + // so let's see if we can use the first child instead + // This will happen if you triple click a table cell and use remove formatting + if (/^(TR|TH|TD)$/.test(startContainer.nodeName) && startContainer.firstChild) { + if (startContainer.nodeName == "TR") { + startContainer = startContainer.firstChild.firstChild || startContainer; + } else { + startContainer = startContainer.firstChild || startContainer; + } + } + + // Try to adjust endContainer as well if cells on the same row were selected - bug #6410 + if (commonAncestorContainer && + /^T(HEAD|BODY|FOOT|R)$/.test(commonAncestorContainer.nodeName) && + isTableCell(endContainer) && endContainer.firstChild) { + endContainer = endContainer.firstChild || endContainer; + } + + if (dom.isChildOf(startContainer, endContainer) && !isTableCell(startContainer) && !isTableCell(endContainer)) { + startContainer = wrap(startContainer, 'span', {id: '_start', 'data-mce-type': 'bookmark'}); + splitToFormatRoot(startContainer); + startContainer = unwrap(TRUE); + return; + } else { + // Wrap start/end nodes in span element since these might be cloned/moved + startContainer = wrap(startContainer, 'span', {id: '_start', 'data-mce-type': 'bookmark'}); + endContainer = wrap(endContainer, 'span', {id: '_end', 'data-mce-type': 'bookmark'}); + + // Split start/end + splitToFormatRoot(startContainer); + splitToFormatRoot(endContainer); + + // Unwrap start/end to get real elements again + startContainer = unwrap(TRUE); + endContainer = unwrap(); + } + } else { + startContainer = endContainer = splitToFormatRoot(startContainer); + } + + // Update range positions since they might have changed after the split operations + rng.startContainer = startContainer.parentNode ? startContainer.parentNode : startContainer; + rng.startOffset = nodeIndex(startContainer); + rng.endContainer = endContainer.parentNode ? endContainer.parentNode : endContainer; + rng.endOffset = nodeIndex(endContainer) + 1; + } + + // Remove items between start/end + rangeUtils.walk(rng, function(nodes) { + each(nodes, function(node) { + process(node); + + // Remove parent span if it only contains text-decoration: underline, yet a parent node is also underlined. + if (node.nodeType === 1 && ed.dom.getStyle(node, 'text-decoration') === 'underline' && + node.parentNode && getTextDecoration(node.parentNode) === 'underline') { + removeFormat({ + 'deep': false, + 'exact': true, + 'inline': 'span', + 'styles': { + 'textDecoration': 'underline' + } + }, null, node); + } + }); + }); + } + + // Handle node + if (node) { + if (node.nodeType) { + rng = dom.createRng(); + rng.setStartBefore(node); + rng.setEndAfter(node); + removeRngStyle(rng); + } else { + removeRngStyle(node); + } + + return; + } + + if (!selection.isCollapsed() || !format.inline || dom.select('td.mce-item-selected,th.mce-item-selected').length) { + bookmark = selection.getBookmark(); + removeRngStyle(selection.getRng(TRUE)); + selection.moveToBookmark(bookmark); + + // Check if start element still has formatting then we are at: "text|text" + // and need to move the start into the next text node + if (format.inline && match(name, vars, selection.getStart())) { + moveStart(selection.getRng(true)); + } + + ed.nodeChanged(); + } else { + performCaretAction('remove', name, vars, similar); + } + } + + /** + * Toggles the specified format on/off. + * + * @method toggle + * @param {String} name Name of format to apply/remove. + * @param {Object} vars Optional list of variables to replace within format before applying/removing it. + * @param {Node} node Optional node to apply the format to or remove from. Defaults to current selection. + */ + function toggle(name, vars, node) { + var fmt = get(name); + + if (match(name, vars, node) && (!('toggle' in fmt[0]) || fmt[0].toggle)) { + remove(name, vars, node); + } else { + apply(name, vars, node); + } + } + + /** + * Return true/false if the specified node has the specified format. + * + * @method matchNode + * @param {Node} node Node to check the format on. + * @param {String} name Format name to check. + * @param {Object} vars Optional list of variables to replace before checking it. + * @param {Boolean} similar Match format that has similar properties. + * @return {Object} Returns the format object it matches or undefined if it doesn't match. + */ + function matchNode(node, name, vars, similar) { + var formatList = get(name), format, i, classes; + + function matchItems(node, format, item_name) { + var key, value, items = format[item_name], i; + + // Custom match + if (format.onmatch) { + return format.onmatch(node, format, item_name); + } + + // Check all items + if (items) { + // Non indexed object + if (items.length === undef) { + for (key in items) { + if (items.hasOwnProperty(key)) { + if (item_name === 'attributes') { + value = dom.getAttrib(node, key); + } else { + value = getStyle(node, key); + } + + if (similar && !value && !format.exact) { + return; + } + + if ((!similar || format.exact) && !isEq(value, normalizeStyleValue(replaceVars(items[key], vars), key))) { + return; + } + } + } + } else { + // Only one match needed for indexed arrays + for (i = 0; i < items.length; i++) { + if (item_name === 'attributes' ? dom.getAttrib(node, items[i]) : getStyle(node, items[i])) { + return format; + } + } + } + } + + return format; + } + + if (formatList && node) { + // Check each format in list + for (i = 0; i < formatList.length; i++) { + format = formatList[i]; + + // Name name, attributes, styles and classes + if (matchName(node, format) && matchItems(node, format, 'attributes') && matchItems(node, format, 'styles')) { + // Match classes + if ((classes = format.classes)) { + for (i = 0; i < classes.length; i++) { + if (!dom.hasClass(node, classes[i])) { + return; + } + } + } + + return format; + } + } + } + } + + /** + * Matches the current selection or specified node against the specified format name. + * + * @method match + * @param {String} name Name of format to match. + * @param {Object} vars Optional list of variables to replace before checking it. + * @param {Node} node Optional node to check. + * @return {boolean} true/false if the specified selection/node matches the format. + */ + function match(name, vars, node) { + var startNode; + + function matchParents(node) { + var root = dom.getRoot(); + + if (node === root) { + return false; + } + + // Find first node with similar format settings + node = dom.getParent(node, function(node) { + return node.parentNode === root || !!matchNode(node, name, vars, true); + }); + + // Do an exact check on the similar format element + return matchNode(node, name, vars); + } + + // Check specified node + if (node) { + return matchParents(node); + } + + // Check selected node + node = selection.getNode(); + if (matchParents(node)) { + return TRUE; + } + + // Check start node if it's different + startNode = selection.getStart(); + if (startNode != node) { + if (matchParents(startNode)) { + return TRUE; + } + } + + return FALSE; + } + + /** + * Matches the current selection against the array of formats and returns a new array with matching formats. + * + * @method matchAll + * @param {Array} names Name of format to match. + * @param {Object} vars Optional list of variables to replace before checking it. + * @return {Array} Array with matched formats. + */ + function matchAll(names, vars) { + var startElement, matchedFormatNames = [], checkedMap = {}; + + // Check start of selection for formats + startElement = selection.getStart(); + dom.getParent(startElement, function(node) { + var i, name; + + for (i = 0; i < names.length; i++) { + name = names[i]; + + if (!checkedMap[name] && matchNode(node, name, vars)) { + checkedMap[name] = true; + matchedFormatNames.push(name); + } + } + }, dom.getRoot()); + + return matchedFormatNames; + } + + /** + * Returns true/false if the specified format can be applied to the current selection or not. It + * will currently only check the state for selector formats, it returns true on all other format types. + * + * @method canApply + * @param {String} name Name of format to check. + * @return {boolean} true/false if the specified format can be applied to the current selection/node. + */ + function canApply(name) { + var formatList = get(name), startNode, parents, i, x, selector; + + if (formatList) { + startNode = selection.getStart(); + parents = getParents(startNode); + + for (x = formatList.length - 1; x >= 0; x--) { + selector = formatList[x].selector; + + // Format is not selector based then always return TRUE + // Is it has a defaultBlock then it's likely it can be applied for example align on a non block element line + if (!selector || formatList[x].defaultBlock) { + return TRUE; + } + + for (i = parents.length - 1; i >= 0; i--) { + if (dom.is(parents[i], selector)) { + return TRUE; + } + } + } + } + + return FALSE; + } + + /** + * Executes the specified callback when the current selection matches the formats or not. + * + * @method formatChanged + * @param {String} formats Comma separated list of formats to check for. + * @param {function} callback Callback with state and args when the format is changed/toggled on/off. + * @param {Boolean} similar True/false state if the match should handle similar or exact formats. + */ + function formatChanged(formats, callback, similar) { + var currentFormats; + + // Setup format node change logic + if (!formatChangeData) { + formatChangeData = {}; + currentFormats = {}; + + ed.on('NodeChange', function(e) { + var parents = getParents(e.element), matchedFormats = {}; + + // Ignore bogus nodes like the
    tag created by moveStart() + parents = Tools.grep(parents, function(node) { + return node.nodeType == 1 && !node.getAttribute('data-mce-bogus'); + }); + + // Check for new formats + each(formatChangeData, function(callbacks, format) { + each(parents, function(node) { + if (matchNode(node, format, {}, callbacks.similar)) { + if (!currentFormats[format]) { + // Execute callbacks + each(callbacks, function(callback) { + callback(true, {node: node, format: format, parents: parents}); + }); + + currentFormats[format] = callbacks; + } + + matchedFormats[format] = callbacks; + return false; + } + }); + }); + + // Check if current formats still match + each(currentFormats, function(callbacks, format) { + if (!matchedFormats[format]) { + delete currentFormats[format]; + + each(callbacks, function(callback) { + callback(false, {node: e.element, format: format, parents: parents}); + }); + } + }); + }); + } + + // Add format listeners + each(formats.split(','), function(format) { + if (!formatChangeData[format]) { + formatChangeData[format] = []; + formatChangeData[format].similar = similar; + } + + formatChangeData[format].push(callback); + }); + + return this; + } + + /** + * Returns a preview css text for the specified format. + * + * @method getCssText + * @param {String/Object} format Format to generate preview css text for. + * @return {String} Css text for the specified format. + * @example + * var cssText1 = editor.formatter.getCssText('bold'); + * var cssText2 = editor.formatter.getCssText({inline: 'b'}); + */ + function getCssText(format) { + return Preview.getCssText(ed, format); + } + + // Expose to public + extend(this, { + get: get, + register: register, + unregister: unregister, + apply: apply, + remove: remove, + toggle: toggle, + match: match, + matchAll: matchAll, + matchNode: matchNode, + canApply: canApply, + formatChanged: formatChanged, + getCssText: getCssText + }); + + // Initialize + defaultFormats(); + addKeyboardShortcuts(); + ed.on('BeforeGetContent', function(e) { + if (markCaretContainersBogus && e.format != 'raw') { + markCaretContainersBogus(); + } + }); + ed.on('mouseup keydown', function(e) { + if (disableCaretContainer) { + disableCaretContainer(e); + } + }); + + // Private functions + + /** + * Checks if the specified nodes name matches the format inline/block or selector. + * + * @private + * @param {Node} node Node to match against the specified format. + * @param {Object} format Format object o match with. + * @return {boolean} true/false if the format matches. + */ + function matchName(node, format) { + // Check for inline match + if (isEq(node, format.inline)) { + return TRUE; + } + + // Check for block match + if (isEq(node, format.block)) { + return TRUE; + } + + // Check for selector match + if (format.selector) { + return node.nodeType == 1 && dom.is(node, format.selector); + } + } + + /** + * Compares two string/nodes regardless of their case. + * + * @private + * @param {String/Node} Node or string to compare. + * @param {String/Node} Node or string to compare. + * @return {boolean} True/false if they match. + */ + function isEq(str1, str2) { + str1 = str1 || ''; + str2 = str2 || ''; + + str1 = '' + (str1.nodeName || str1); + str2 = '' + (str2.nodeName || str2); + + return str1.toLowerCase() == str2.toLowerCase(); + } + + /** + * Returns the style by name on the specified node. This method modifies the style + * contents to make it more easy to match. This will resolve a few browser issues. + * + * @private + * @param {Node} node to get style from. + * @param {String} name Style name to get. + * @return {String} Style item value. + */ + function getStyle(node, name) { + return normalizeStyleValue(dom.getStyle(node, name), name); + } + + /** + * Normalize style value by name. This method modifies the style contents + * to make it more easy to match. This will resolve a few browser issues. + * + * @private + * @param {Node} node to get style from. + * @param {String} name Style name to get. + * @return {String} Style item value. + */ + function normalizeStyleValue(value, name) { + // Force the format to hex + if (name == 'color' || name == 'backgroundColor') { + value = dom.toHex(value); + } + + // Opera will return bold as 700 + if (name == 'fontWeight' && value == 700) { + value = 'bold'; + } + + // Normalize fontFamily so "'Font name', Font" becomes: "Font name,Font" + if (name == 'fontFamily') { + value = value.replace(/[\'\"]/g, '').replace(/,\s+/g, ','); + } + + return '' + value; + } + + /** + * Replaces variables in the value. The variable format is %var. + * + * @private + * @param {String} value Value to replace variables in. + * @param {Object} vars Name/value array with variables to replace. + * @return {String} New value with replaced variables. + */ + function replaceVars(value, vars) { + if (typeof value != "string") { + value = value(vars); + } else if (vars) { + value = value.replace(/%(\w+)/g, function(str, name) { + return vars[name] || str; + }); + } + + return value; + } + + function isWhiteSpaceNode(node) { + return node && node.nodeType === 3 && /^([\t \r\n]+|)$/.test(node.nodeValue); + } + + function wrap(node, name, attrs) { + var wrapper = dom.create(name, attrs); + + node.parentNode.insertBefore(wrapper, node); + wrapper.appendChild(node); + + return wrapper; + } + + /** + * Expands the specified range like object to depending on format. + * + * For example on block formats it will move the start/end position + * to the beginning of the current block. + * + * @private + * @param {Object} rng Range like object. + * @param {Array} formats Array with formats to expand by. + * @return {Object} Expanded range like object. + */ + function expandRng(rng, format, remove) { + var lastIdx, leaf, endPoint, + startContainer = rng.startContainer, + startOffset = rng.startOffset, + endContainer = rng.endContainer, + endOffset = rng.endOffset; + + // This function walks up the tree if there is no siblings before/after the node + function findParentContainer(start) { + var container, parent, sibling, siblingName, root; + + container = parent = start ? startContainer : endContainer; + siblingName = start ? 'previousSibling' : 'nextSibling'; + root = dom.getRoot(); + + function isBogusBr(node) { + return node.nodeName == "BR" && node.getAttribute('data-mce-bogus') && !node.nextSibling; + } + + // If it's a text node and the offset is inside the text + if (container.nodeType == 3 && !isWhiteSpaceNode(container)) { + if (start ? startOffset > 0 : endOffset < container.nodeValue.length) { + return container; + } + } + + /*eslint no-constant-condition:0 */ + while (true) { + // Stop expanding on block elements + if (!format[0].block_expand && isBlock(parent)) { + return parent; + } + + // Walk left/right + for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) { + if (!isBookmarkNode(sibling) && !isWhiteSpaceNode(sibling) && !isBogusBr(sibling)) { + return parent; + } + } + + // Check if we can move up are we at root level or body level + if (parent.parentNode == root) { + container = parent; + break; + } + + parent = parent.parentNode; + } + + return container; + } + + // This function walks down the tree to find the leaf at the selection. + // The offset is also returned as if node initially a leaf, the offset may be in the middle of the text node. + function findLeaf(node, offset) { + if (offset === undef) { + offset = node.nodeType === 3 ? node.length : node.childNodes.length; + } + + while (node && node.hasChildNodes()) { + node = node.childNodes[offset]; + if (node) { + offset = node.nodeType === 3 ? node.length : node.childNodes.length; + } + } + return {node: node, offset: offset}; + } + + // If index based start position then resolve it + if (startContainer.nodeType == 1 && startContainer.hasChildNodes()) { + lastIdx = startContainer.childNodes.length - 1; + startContainer = startContainer.childNodes[startOffset > lastIdx ? lastIdx : startOffset]; + + if (startContainer.nodeType == 3) { + startOffset = 0; + } + } + + // If index based end position then resolve it + if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) { + lastIdx = endContainer.childNodes.length - 1; + endContainer = endContainer.childNodes[endOffset > lastIdx ? lastIdx : endOffset - 1]; + + if (endContainer.nodeType == 3) { + endOffset = endContainer.nodeValue.length; + } + } + + // Expands the node to the closes contentEditable false element if it exists + function findParentContentEditable(node) { + var parent = node; + + while (parent) { + if (parent.nodeType === 1 && getContentEditable(parent)) { + return getContentEditable(parent) === "false" ? parent : node; + } + + parent = parent.parentNode; + } + + return node; + } + + function findWordEndPoint(container, offset, start) { + var walker, node, pos, lastTextNode; + + function findSpace(node, offset) { + var pos, pos2, str = node.nodeValue; + + if (typeof offset == "undefined") { + offset = start ? str.length : 0; + } + + if (start) { + pos = str.lastIndexOf(' ', offset); + pos2 = str.lastIndexOf('\u00a0', offset); + pos = pos > pos2 ? pos : pos2; + + // Include the space on remove to avoid tag soup + if (pos !== -1 && !remove) { + pos++; + } + } else { + pos = str.indexOf(' ', offset); + pos2 = str.indexOf('\u00a0', offset); + pos = pos !== -1 && (pos2 === -1 || pos < pos2) ? pos : pos2; + } + + return pos; + } + + if (container.nodeType === 3) { + pos = findSpace(container, offset); + + if (pos !== -1) { + return {container: container, offset: pos}; + } + + lastTextNode = container; + } + + // Walk the nodes inside the block + walker = new TreeWalker(container, dom.getParent(container, isBlock) || ed.getBody()); + while ((node = walker[start ? 'prev' : 'next']())) { + if (node.nodeType === 3) { + lastTextNode = node; + pos = findSpace(node); + + if (pos !== -1) { + return {container: node, offset: pos}; + } + } else if (isBlock(node)) { + break; + } + } + + if (lastTextNode) { + if (start) { + offset = 0; + } else { + offset = lastTextNode.length; + } + + return {container: lastTextNode, offset: offset}; + } + } + + function findSelectorEndPoint(container, sibling_name) { + var parents, i, y, curFormat; + + if (container.nodeType == 3 && container.nodeValue.length === 0 && container[sibling_name]) { + container = container[sibling_name]; + } + + parents = getParents(container); + for (i = 0; i < parents.length; i++) { + for (y = 0; y < format.length; y++) { + curFormat = format[y]; + + // If collapsed state is set then skip formats that doesn't match that + if ("collapsed" in curFormat && curFormat.collapsed !== rng.collapsed) { + continue; + } + + if (dom.is(parents[i], curFormat.selector)) { + return parents[i]; + } + } + } + + return container; + } + + function findBlockEndPoint(container, sibling_name) { + var node, root = dom.getRoot(); + + // Expand to block of similar type + if (!format[0].wrapper) { + node = dom.getParent(container, format[0].block, root); + } + + // Expand to first wrappable block element or any block element + if (!node) { + node = dom.getParent(container.nodeType == 3 ? container.parentNode : container, function(node) { + // Fixes #6183 where it would expand to editable parent element in inline mode + return node != root && isTextBlock(node); + }); + } + + // Exclude inner lists from wrapping + if (node && format[0].wrapper) { + node = getParents(node, 'ul,ol').reverse()[0] || node; + } + + // Didn't find a block element look for first/last wrappable element + if (!node) { + node = container; + + while (node[sibling_name] && !isBlock(node[sibling_name])) { + node = node[sibling_name]; + + // Break on BR but include it will be removed later on + // we can't remove it now since we need to check if it can be wrapped + if (isEq(node, 'br')) { + break; + } + } + } + + return node || container; + } + + // Expand to closest contentEditable element + startContainer = findParentContentEditable(startContainer); + endContainer = findParentContentEditable(endContainer); + + // Exclude bookmark nodes if possible + if (isBookmarkNode(startContainer.parentNode) || isBookmarkNode(startContainer)) { + startContainer = isBookmarkNode(startContainer) ? startContainer : startContainer.parentNode; + startContainer = startContainer.nextSibling || startContainer; + + if (startContainer.nodeType == 3) { + startOffset = 0; + } + } + + if (isBookmarkNode(endContainer.parentNode) || isBookmarkNode(endContainer)) { + endContainer = isBookmarkNode(endContainer) ? endContainer : endContainer.parentNode; + endContainer = endContainer.previousSibling || endContainer; + + if (endContainer.nodeType == 3) { + endOffset = endContainer.length; + } + } + + if (format[0].inline) { + if (rng.collapsed) { + // Expand left to closest word boundary + endPoint = findWordEndPoint(startContainer, startOffset, true); + if (endPoint) { + startContainer = endPoint.container; + startOffset = endPoint.offset; + } + + // Expand right to closest word boundary + endPoint = findWordEndPoint(endContainer, endOffset); + if (endPoint) { + endContainer = endPoint.container; + endOffset = endPoint.offset; + } + } + + // Avoid applying formatting to a trailing space. + leaf = findLeaf(endContainer, endOffset); + if (leaf.node) { + while (leaf.node && leaf.offset === 0 && leaf.node.previousSibling) { + leaf = findLeaf(leaf.node.previousSibling); + } + + if (leaf.node && leaf.offset > 0 && leaf.node.nodeType === 3 && + leaf.node.nodeValue.charAt(leaf.offset - 1) === ' ') { + + if (leaf.offset > 1) { + endContainer = leaf.node; + endContainer.splitText(leaf.offset - 1); + } + } + } + } + + // Move start/end point up the tree if the leaves are sharp and if we are in different containers + // Example * becomes !: !

    *texttext*

    ! + // This will reduce the number of wrapper elements that needs to be created + // Move start point up the tree + if (format[0].inline || format[0].block_expand) { + if (!format[0].inline || (startContainer.nodeType != 3 || startOffset === 0)) { + startContainer = findParentContainer(true); + } + + if (!format[0].inline || (endContainer.nodeType != 3 || endOffset === endContainer.nodeValue.length)) { + endContainer = findParentContainer(); + } + } + + // Expand start/end container to matching selector + if (format[0].selector && format[0].expand !== FALSE && !format[0].inline) { + // Find new startContainer/endContainer if there is better one + startContainer = findSelectorEndPoint(startContainer, 'previousSibling'); + endContainer = findSelectorEndPoint(endContainer, 'nextSibling'); + } + + // Expand start/end container to matching block element or text node + if (format[0].block || format[0].selector) { + // Find new startContainer/endContainer if there is better one + startContainer = findBlockEndPoint(startContainer, 'previousSibling'); + endContainer = findBlockEndPoint(endContainer, 'nextSibling'); + + // Non block element then try to expand up the leaf + if (format[0].block) { + if (!isBlock(startContainer)) { + startContainer = findParentContainer(true); + } + + if (!isBlock(endContainer)) { + endContainer = findParentContainer(); + } + } + } + + // Setup index for startContainer + if (startContainer.nodeType == 1) { + startOffset = nodeIndex(startContainer); + startContainer = startContainer.parentNode; + } + + // Setup index for endContainer + if (endContainer.nodeType == 1) { + endOffset = nodeIndex(endContainer) + 1; + endContainer = endContainer.parentNode; + } + + // Return new range like object + return { + startContainer: startContainer, + startOffset: startOffset, + endContainer: endContainer, + endOffset: endOffset + }; + } + + function isColorFormatAndAnchor(node, format) { + return format.links && node.tagName == 'A'; + } + + /** + * Removes the specified format for the specified node. It will also remove the node if it doesn't have + * any attributes if the format specifies it to do so. + * + * @private + * @param {Object} format Format object with items to remove from node. + * @param {Object} vars Name/value object with variables to apply to format. + * @param {Node} node Node to remove the format styles on. + * @param {Node} compare_node Optional compare node, if specified the styles will be compared to that node. + * @return {Boolean} True/false if the node was removed or not. + */ + function removeFormat(format, vars, node, compare_node) { + var i, attrs, stylesModified; + + // Check if node matches format + if (!matchName(node, format) && !isColorFormatAndAnchor(node, format)) { + return FALSE; + } + + // Should we compare with format attribs and styles + if (format.remove != 'all') { + // Remove styles + each(format.styles, function(value, name) { + value = normalizeStyleValue(replaceVars(value, vars), name); + + // Indexed array + if (typeof name === 'number') { + name = value; + compare_node = 0; + } + + if (format.remove_similar || (!compare_node || isEq(getStyle(compare_node, name), value))) { + dom.setStyle(node, name, ''); + } + + stylesModified = 1; + }); + + // Remove style attribute if it's empty + if (stylesModified && dom.getAttrib(node, 'style') === '') { + node.removeAttribute('style'); + node.removeAttribute('data-mce-style'); + } + + // Remove attributes + each(format.attributes, function(value, name) { + var valueOut; + + value = replaceVars(value, vars); + + // Indexed array + if (typeof name === 'number') { + name = value; + compare_node = 0; + } + + if (!compare_node || isEq(dom.getAttrib(compare_node, name), value)) { + // Keep internal classes + if (name == 'class') { + value = dom.getAttrib(node, name); + if (value) { + // Build new class value where everything is removed except the internal prefixed classes + valueOut = ''; + each(value.split(/\s+/), function(cls) { + if (/mce\-\w+/.test(cls)) { + valueOut += (valueOut ? ' ' : '') + cls; + } + }); + + // We got some internal classes left + if (valueOut) { + dom.setAttrib(node, name, valueOut); + return; + } + } + } + + // IE6 has a bug where the attribute doesn't get removed correctly + if (name == "class") { + node.removeAttribute('className'); + } + + // Remove mce prefixed attributes + if (MCE_ATTR_RE.test(name)) { + node.removeAttribute('data-mce-' + name); + } + + node.removeAttribute(name); + } + }); + + // Remove classes + each(format.classes, function(value) { + value = replaceVars(value, vars); + + if (!compare_node || dom.hasClass(compare_node, value)) { + dom.removeClass(node, value); + } + }); + + // Check for non internal attributes + attrs = dom.getAttribs(node); + for (i = 0; i < attrs.length; i++) { + if (attrs[i].nodeName.indexOf('_') !== 0) { + return FALSE; + } + } + } + + // Remove the inline child if it's empty for example or + if (format.remove != 'none') { + removeNode(node, format); + return TRUE; + } + } + + /** + * Removes the node and wrap it's children in paragraphs before doing so or + * appends BR elements to the beginning/end of the block element if forcedRootBlocks is disabled. + * + * If the div in the node below gets removed: + * text
    text
    text + * + * Output becomes: + * text

    text
    text + * + * So when the div is removed the result is: + * text
    text
    text + * + * @private + * @param {Node} node Node to remove + apply BR/P elements to. + * @param {Object} format Format rule. + * @return {Node} Input node. + */ + function removeNode(node, format) { + var parentNode = node.parentNode, rootBlockElm; + + function find(node, next, inc) { + node = getNonWhiteSpaceSibling(node, next, inc); + + return !node || (node.nodeName == 'BR' || isBlock(node)); + } + + if (format.block) { + if (!forcedRootBlock) { + // Append BR elements if needed before we remove the block + if (isBlock(node) && !isBlock(parentNode)) { + if (!find(node, FALSE) && !find(node.firstChild, TRUE, 1)) { + node.insertBefore(dom.create('br'), node.firstChild); + } + + if (!find(node, TRUE) && !find(node.lastChild, FALSE, 1)) { + node.appendChild(dom.create('br')); + } + } + } else { + // Wrap the block in a forcedRootBlock if we are at the root of document + if (parentNode == dom.getRoot()) { + if (!format.list_block || !isEq(node, format.list_block)) { + each(grep(node.childNodes), function(node) { + if (isValid(forcedRootBlock, node.nodeName.toLowerCase())) { + if (!rootBlockElm) { + rootBlockElm = wrap(node, forcedRootBlock); + dom.setAttribs(rootBlockElm, ed.settings.forced_root_block_attrs); + } else { + rootBlockElm.appendChild(node); + } + } else { + rootBlockElm = 0; + } + }); + } + } + } + } + + // Never remove nodes that isn't the specified inline element if a selector is specified too + if (format.selector && format.inline && !isEq(format.inline, node)) { + return; + } + + dom.remove(node, 1); + } + + /** + * Returns the next/previous non whitespace node. + * + * @private + * @param {Node} node Node to start at. + * @param {boolean} next (Optional) Include next or previous node defaults to previous. + * @param {boolean} inc (Optional) Include the current node in checking. Defaults to false. + * @return {Node} Next or previous node or undefined if it wasn't found. + */ + function getNonWhiteSpaceSibling(node, next, inc) { + if (node) { + next = next ? 'nextSibling' : 'previousSibling'; + + for (node = inc ? node : node[next]; node; node = node[next]) { + if (node.nodeType == 1 || !isWhiteSpaceNode(node)) { + return node; + } + } + } + } + + /** + * Merges the next/previous sibling element if they match. + * + * @private + * @param {Node} prev Previous node to compare/merge. + * @param {Node} next Next node to compare/merge. + * @return {Node} Next node if we didn't merge and prev node if we did. + */ + function mergeSiblings(prev, next) { + var sibling, tmpSibling, elementUtils = new ElementUtils(dom); + + function findElementSibling(node, sibling_name) { + for (sibling = node; sibling; sibling = sibling[sibling_name]) { + if (sibling.nodeType == 3 && sibling.nodeValue.length !== 0) { + return node; + } + + if (sibling.nodeType == 1 && !isBookmarkNode(sibling)) { + return sibling; + } + } + + return node; + } + + // Check if next/prev exists and that they are elements + if (prev && next) { + // If previous sibling is empty then jump over it + prev = findElementSibling(prev, 'previousSibling'); + next = findElementSibling(next, 'nextSibling'); + + // Compare next and previous nodes + if (elementUtils.compare(prev, next)) { + // Append nodes between + for (sibling = prev.nextSibling; sibling && sibling != next;) { + tmpSibling = sibling; + sibling = sibling.nextSibling; + prev.appendChild(tmpSibling); + } + + // Remove next node + dom.remove(next); + + // Move children into prev node + each(grep(next.childNodes), function(node) { + prev.appendChild(node); + }); + + return prev; + } + } + + return next; + } + + function getContainer(rng, start) { + var container, offset, lastIdx; + + container = rng[start ? 'startContainer' : 'endContainer']; + offset = rng[start ? 'startOffset' : 'endOffset']; + + if (container.nodeType == 1) { + lastIdx = container.childNodes.length - 1; + + if (!start && offset) { + offset--; + } + + container = container.childNodes[offset > lastIdx ? lastIdx : offset]; + } + + // If start text node is excluded then walk to the next node + if (container.nodeType === 3 && start && offset >= container.nodeValue.length) { + container = new TreeWalker(container, ed.getBody()).next() || container; + } + + // If end text node is excluded then walk to the previous node + if (container.nodeType === 3 && !start && offset === 0) { + container = new TreeWalker(container, ed.getBody()).prev() || container; + } + + return container; + } + + function performCaretAction(type, name, vars, similar) { + var caretContainerId = '_mce_caret', debug = ed.settings.caret_debug; + + // Creates a caret container bogus element + function createCaretContainer(fill) { + var caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true, style: debug ? 'color:red' : ''}); + + if (fill) { + caretContainer.appendChild(ed.getDoc().createTextNode(INVISIBLE_CHAR)); + } + + return caretContainer; + } + + function isCaretContainerEmpty(node, nodes) { + while (node) { + if ((node.nodeType === 3 && node.nodeValue !== INVISIBLE_CHAR) || node.childNodes.length > 1) { + return false; + } + + // Collect nodes + if (nodes && node.nodeType === 1) { + nodes.push(node); + } + + node = node.firstChild; + } + + return true; + } + + // Returns any parent caret container element + function getParentCaretContainer(node) { + while (node) { + if (node.id === caretContainerId) { + return node; + } + + node = node.parentNode; + } + } + + // Finds the first text node in the specified node + function findFirstTextNode(node) { + var walker; + + if (node) { + walker = new TreeWalker(node, node); + + for (node = walker.current(); node; node = walker.next()) { + if (node.nodeType === 3) { + return node; + } + } + } + } + + // Removes the caret container for the specified node or all on the current document + function removeCaretContainer(node, move_caret) { + var child, rng; + + if (!node) { + node = getParentCaretContainer(selection.getStart()); + + if (!node) { + while ((node = dom.get(caretContainerId))) { + removeCaretContainer(node, false); + } + } + } else { + rng = selection.getRng(true); + + if (isCaretContainerEmpty(node)) { + if (move_caret !== false) { + rng.setStartBefore(node); + rng.setEndBefore(node); + } + + dom.remove(node); + } else { + child = findFirstTextNode(node); + + if (child.nodeValue.charAt(0) === INVISIBLE_CHAR) { + child.deleteData(0, 1); + + // Fix for bug #6976 + if (rng.startContainer == child && rng.startOffset > 0) { + rng.setStart(child, rng.startOffset - 1); + } + + if (rng.endContainer == child && rng.endOffset > 0) { + rng.setEnd(child, rng.endOffset - 1); + } + } + + dom.remove(node, 1); + } + + selection.setRng(rng); + } + } + + // Applies formatting to the caret postion + function applyCaretFormat() { + var rng, caretContainer, textNode, offset, bookmark, container, text; + + rng = selection.getRng(true); + offset = rng.startOffset; + container = rng.startContainer; + text = container.nodeValue; + + caretContainer = getParentCaretContainer(selection.getStart()); + if (caretContainer) { + textNode = findFirstTextNode(caretContainer); + } + + // Expand to word is caret is in the middle of a text node and the char before/after is a alpha numeric character + if (text && offset > 0 && offset < text.length && /\w/.test(text.charAt(offset)) && /\w/.test(text.charAt(offset - 1))) { + // Get bookmark of caret position + bookmark = selection.getBookmark(); + + // Collapse bookmark range (WebKit) + rng.collapse(true); + + // Expand the range to the closest word and split it at those points + rng = expandRng(rng, get(name)); + rng = rangeUtils.split(rng); + + // Apply the format to the range + apply(name, vars, rng); + + // Move selection back to caret position + selection.moveToBookmark(bookmark); + } else { + if (!caretContainer || textNode.nodeValue !== INVISIBLE_CHAR) { + caretContainer = createCaretContainer(true); + textNode = caretContainer.firstChild; + + rng.insertNode(caretContainer); + offset = 1; + + apply(name, vars, caretContainer); + } else { + apply(name, vars, caretContainer); + } + + // Move selection to text node + selection.setCursorLocation(textNode, offset); + } + } + + function removeCaretFormat() { + var rng = selection.getRng(true), container, offset, bookmark, + hasContentAfter, node, formatNode, parents = [], i, caretContainer; + + container = rng.startContainer; + offset = rng.startOffset; + node = container; + + if (container.nodeType == 3) { + if (offset != container.nodeValue.length) { + hasContentAfter = true; + } + + node = node.parentNode; + } + + while (node) { + if (matchNode(node, name, vars, similar)) { + formatNode = node; + break; + } + + if (node.nextSibling) { + hasContentAfter = true; + } + + parents.push(node); + node = node.parentNode; + } + + // Node doesn't have the specified format + if (!formatNode) { + return; + } + + // Is there contents after the caret then remove the format on the element + if (hasContentAfter) { + // Get bookmark of caret position + bookmark = selection.getBookmark(); + + // Collapse bookmark range (WebKit) + rng.collapse(true); + + // Expand the range to the closest word and split it at those points + rng = expandRng(rng, get(name), true); + rng = rangeUtils.split(rng); + + // Remove the format from the range + remove(name, vars, rng); + + // Move selection back to caret position + selection.moveToBookmark(bookmark); + } else { + caretContainer = createCaretContainer(); + + node = caretContainer; + for (i = parents.length - 1; i >= 0; i--) { + node.appendChild(dom.clone(parents[i], false)); + node = node.firstChild; + } + + // Insert invisible character into inner most format element + node.appendChild(dom.doc.createTextNode(INVISIBLE_CHAR)); + node = node.firstChild; + + var block = dom.getParent(formatNode, isTextBlock); + + if (block && dom.isEmpty(block)) { + // Replace formatNode with caretContainer when removing format from empty block like

    |

    + formatNode.parentNode.replaceChild(caretContainer, formatNode); + } else { + // Insert caret container after the formated node + dom.insertAfter(caretContainer, formatNode); + } + + // Move selection to text node + selection.setCursorLocation(node, 1); + + // If the formatNode is empty, we can remove it safely. + if (dom.isEmpty(formatNode)) { + dom.remove(formatNode); + } + } + } + + // Checks if the parent caret container node isn't empty if that is the case it + // will remove the bogus state on all children that isn't empty + function unmarkBogusCaretParents() { + var caretContainer; + + caretContainer = getParentCaretContainer(selection.getStart()); + if (caretContainer && !dom.isEmpty(caretContainer)) { + walk(caretContainer, function(node) { + if (node.nodeType == 1 && node.id !== caretContainerId && !dom.isEmpty(node)) { + dom.setAttrib(node, 'data-mce-bogus', null); + } + }, 'childNodes'); + } + } + + // Only bind the caret events once + if (!ed._hasCaretEvents) { + // Mark current caret container elements as bogus when getting the contents so we don't end up with empty elements + markCaretContainersBogus = function() { + var nodes = [], i; + + if (isCaretContainerEmpty(getParentCaretContainer(selection.getStart()), nodes)) { + // Mark children + i = nodes.length; + while (i--) { + dom.setAttrib(nodes[i], 'data-mce-bogus', '1'); + } + } + }; + + disableCaretContainer = function(e) { + var keyCode = e.keyCode; + + removeCaretContainer(); + + // Remove caret container on keydown and it's a backspace, enter or left/right arrow keys + // Backspace key needs to check if the range is collapsed due to bug #6780 + if ((keyCode == 8 && selection.isCollapsed()) || keyCode == 37 || keyCode == 39) { + removeCaretContainer(getParentCaretContainer(selection.getStart())); + } + + unmarkBogusCaretParents(); + }; + + // Remove bogus state if they got filled by contents using editor.selection.setContent + ed.on('SetContent', function(e) { + if (e.selection) { + unmarkBogusCaretParents(); + } + }); + ed._hasCaretEvents = true; + } + + // Do apply or remove caret format + if (type == "apply") { + applyCaretFormat(); + } else { + removeCaretFormat(); + } + } + + /** + * Moves the start to the first suitable text node. + */ + function moveStart(rng) { + var container = rng.startContainer, + offset = rng.startOffset, isAtEndOfText, + walker, node, nodes, tmpNode; + + // Convert text node into index if possible + if (container.nodeType == 3 && offset >= container.nodeValue.length) { + // Get the parent container location and walk from there + offset = nodeIndex(container); + container = container.parentNode; + isAtEndOfText = true; + } + + // Move startContainer/startOffset in to a suitable node + if (container.nodeType == 1) { + nodes = container.childNodes; + container = nodes[Math.min(offset, nodes.length - 1)]; + walker = new TreeWalker(container, dom.getParent(container, dom.isBlock)); + + // If offset is at end of the parent node walk to the next one + if (offset > nodes.length - 1 || isAtEndOfText) { + walker.next(); + } + + for (node = walker.current(); node; node = walker.next()) { + if (node.nodeType == 3 && !isWhiteSpaceNode(node)) { + // IE has a "neat" feature where it moves the start node into the closest element + // we can avoid this by inserting an element before it and then remove it after we set the selection + tmpNode = dom.create('a', {'data-mce-bogus': 'all'}, INVISIBLE_CHAR); + node.parentNode.insertBefore(tmpNode, node); + + // Set selection and remove tmpNode + rng.setStart(node, 0); + selection.setRng(rng); + dom.remove(tmpNode); + + return; + } + } + } + } + }; +}); + +// Included from: js/tinymce/classes/UndoManager.js + +/** + * UndoManager.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles the undo/redo history levels for the editor. Since the build in undo/redo has major drawbacks a custom one was needed. + * + * @class tinymce.UndoManager + */ +define("tinymce/UndoManager", [ + "tinymce/util/VK", + "tinymce/Env", + "tinymce/util/Tools", + "tinymce/html/SaxParser" +], function(VK, Env, Tools, SaxParser) { + var trim = Tools.trim, trimContentRegExp; + + trimContentRegExp = new RegExp([ + ']+data-mce-bogus[^>]+>[\u200B\uFEFF]+<\\/span>', // Trim bogus spans like caret containers + '\\s?data-mce-selected="[^"]+"' // Trim temporaty data-mce prefixed attributes like data-mce-selected + ].join('|'), 'gi'); + + return function(editor) { + var self = this, index = 0, data = [], beforeBookmark, isFirstTypedCharacter, locks = 0; + + /** + * Returns a trimmed version of the editor contents to be used for the undo level. This + * will remove any data-mce-bogus="all" marked elements since these are used for UI it will also + * remove the data-mce-selected attributes used for selection of objects and caret containers. + * It will keep all data-mce-bogus="1" elements since these can be used to place the caret etc and will + * be removed by the serialization logic when you save. + * + * @private + * @return {String} HTML contents of the editor excluding some internal bogus elements. + */ + function getContent() { + var content = editor.getContent({format: 'raw', no_events: 1}); + var bogusAllRegExp = /<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g; + var endTagIndex, index, matchLength, matches, shortEndedElements, schema = editor.schema; + + content = content.replace(trimContentRegExp, ''); + shortEndedElements = schema.getShortEndedElements(); + + // Remove all bogus elements marked with "all" + while ((matches = bogusAllRegExp.exec(content))) { + index = bogusAllRegExp.lastIndex; + matchLength = matches[0].length; + + if (shortEndedElements[matches[1]]) { + endTagIndex = index; + } else { + endTagIndex = SaxParser.findEndTag(schema, content, index); + } + + content = content.substring(0, index - matchLength) + content.substring(endTagIndex); + bogusAllRegExp.lastIndex = index - matchLength; + } + + return trim(content); + } + + function setDirty(state) { + editor.isNotDirty = !state; + } + + function addNonTypingUndoLevel(e) { + self.typing = false; + self.add({}, e); + } + + // Add initial undo level when the editor is initialized + editor.on('init', function() { + self.add(); + }); + + // Get position before an execCommand is processed + editor.on('BeforeExecCommand', function(e) { + var cmd = e.command; + + if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint') { + self.beforeChange(); + } + }); + + // Add undo level after an execCommand call was made + editor.on('ExecCommand', function(e) { + var cmd = e.command; + + if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint') { + addNonTypingUndoLevel(e); + } + }); + + editor.on('ObjectResizeStart', function() { + self.beforeChange(); + }); + + editor.on('SaveContent ObjectResized blur', addNonTypingUndoLevel); + editor.on('DragEnd', addNonTypingUndoLevel); + + editor.on('KeyUp', function(e) { + var keyCode = e.keyCode; + + if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 45 || keyCode == 13 || e.ctrlKey) { + addNonTypingUndoLevel(); + editor.nodeChanged(); + } + + if (keyCode == 46 || keyCode == 8 || (Env.mac && (keyCode == 91 || keyCode == 93))) { + editor.nodeChanged(); + } + + // Fire a TypingUndo event on the first character entered + if (isFirstTypedCharacter && self.typing) { + // Make it dirty if the content was changed after typing the first character + if (!editor.isDirty()) { + setDirty(data[0] && getContent() != data[0].content); + + // Fire initial change event + if (!editor.isNotDirty) { + editor.fire('change', {level: data[0], lastLevel: null}); + } + } + + editor.fire('TypingUndo'); + isFirstTypedCharacter = false; + editor.nodeChanged(); + } + }); + + editor.on('KeyDown', function(e) { + var keyCode = e.keyCode; + + // Is caracter positon keys left,right,up,down,home,end,pgdown,pgup,enter + if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 45) { + if (self.typing) { + addNonTypingUndoLevel(e); + } + + return; + } + + // If key isn't Ctrl+Alt/AltGr + var modKey = (e.ctrlKey && !e.altKey) || e.metaKey; + if ((keyCode < 16 || keyCode > 20) && keyCode != 224 && keyCode != 91 && !self.typing && !modKey) { + self.beforeChange(); + self.typing = true; + self.add({}, e); + isFirstTypedCharacter = true; + } + }); + + editor.on('MouseDown', function(e) { + if (self.typing) { + addNonTypingUndoLevel(e); + } + }); + + // Add keyboard shortcuts for undo/redo keys + editor.addShortcut('meta+z', '', 'Undo'); + editor.addShortcut('meta+y,meta+shift+z', '', 'Redo'); + + editor.on('AddUndo Undo Redo ClearUndos', function(e) { + if (!e.isDefaultPrevented()) { + editor.nodeChanged(); + } + }); + + /*eslint consistent-this:0 */ + self = { + // Explose for debugging reasons + data: data, + + /** + * State if the user is currently typing or not. This will add a typing operation into one undo + * level instead of one new level for each keystroke. + * + * @field {Boolean} typing + */ + typing: false, + + /** + * Stores away a bookmark to be used when performing an undo action so that the selection is before + * the change has been made. + * + * @method beforeChange + */ + beforeChange: function() { + if (!locks) { + beforeBookmark = editor.selection.getBookmark(2, true); + } + }, + + /** + * Adds a new undo level/snapshot to the undo list. + * + * @method add + * @param {Object} level Optional undo level object to add. + * @param {DOMEvent} Event Optional event responsible for the creation of the undo level. + * @return {Object} Undo level that got added or null it a level wasn't needed. + */ + add: function(level, event) { + var i, settings = editor.settings, lastLevel; + + level = level || {}; + level.content = getContent(); + + if (locks || editor.removed) { + return null; + } + + lastLevel = data[index]; + if (editor.fire('BeforeAddUndo', {level: level, lastLevel: lastLevel, originalEvent: event}).isDefaultPrevented()) { + return null; + } + + // Add undo level if needed + if (lastLevel && lastLevel.content == level.content) { + return null; + } + + // Set before bookmark on previous level + if (data[index]) { + data[index].beforeBookmark = beforeBookmark; + } + + // Time to compress + if (settings.custom_undo_redo_levels) { + if (data.length > settings.custom_undo_redo_levels) { + for (i = 0; i < data.length - 1; i++) { + data[i] = data[i + 1]; + } + + data.length--; + index = data.length; + } + } + + // Get a non intrusive normalized bookmark + level.bookmark = editor.selection.getBookmark(2, true); + + // Crop array if needed + if (index < data.length - 1) { + data.length = index + 1; + } + + data.push(level); + index = data.length - 1; + + var args = {level: level, lastLevel: lastLevel, originalEvent: event}; + + editor.fire('AddUndo', args); + + if (index > 0) { + setDirty(true); + editor.fire('change', args); + } + + return level; + }, + + /** + * Undoes the last action. + * + * @method undo + * @return {Object} Undo level or null if no undo was performed. + */ + undo: function() { + var level; + + if (self.typing) { + self.add(); + self.typing = false; + } + + if (index > 0) { + level = data[--index]; + + // Undo to first index then set dirty state to false + if (index === 0) { + setDirty(false); + } + + editor.setContent(level.content, {format: 'raw'}); + editor.selection.moveToBookmark(level.beforeBookmark); + + editor.fire('undo', {level: level}); + } + + return level; + }, + + /** + * Redoes the last action. + * + * @method redo + * @return {Object} Redo level or null if no redo was performed. + */ + redo: function() { + var level; + + if (index < data.length - 1) { + level = data[++index]; + + editor.setContent(level.content, {format: 'raw'}); + editor.selection.moveToBookmark(level.bookmark); + setDirty(true); + + editor.fire('redo', {level: level}); + } + + return level; + }, + + /** + * Removes all undo levels. + * + * @method clear + */ + clear: function() { + data = []; + index = 0; + self.typing = false; + editor.fire('ClearUndos'); + }, + + /** + * Returns true/false if the undo manager has any undo levels. + * + * @method hasUndo + * @return {Boolean} true/false if the undo manager has any undo levels. + */ + hasUndo: function() { + // Has undo levels or typing and content isn't the same as the initial level + return index > 0 || (self.typing && data[0] && getContent() != data[0].content); + }, + + /** + * Returns true/false if the undo manager has any redo levels. + * + * @method hasRedo + * @return {Boolean} true/false if the undo manager has any redo levels. + */ + hasRedo: function() { + return index < data.length - 1 && !this.typing; + }, + + /** + * Executes the specified function in an undo transation. The selection + * before the modification will be stored to the undo stack and if the DOM changes + * it will add a new undo level. Any methods within the transation that adds undo levels will + * be ignored. So a transation can include calls to execCommand or editor.insertContent. + * + * @method transact + * @param {function} callback Function to execute dom manipulation logic in. + */ + transact: function(callback) { + self.beforeChange(); + + try { + locks++; + callback(); + } finally { + locks--; + } + + self.add(); + } + }; + + return self; + }; +}); + +// Included from: js/tinymce/classes/EnterKey.js + +/** + * EnterKey.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Contains logic for handling the enter key to split/generate block elements. + */ +define("tinymce/EnterKey", [ + "tinymce/dom/TreeWalker", + "tinymce/dom/RangeUtils", + "tinymce/Env" +], function(TreeWalker, RangeUtils, Env) { + var isIE = Env.ie && Env.ie < 11; + + return function(editor) { + var dom = editor.dom, selection = editor.selection, settings = editor.settings; + var undoManager = editor.undoManager, schema = editor.schema, nonEmptyElementsMap = schema.getNonEmptyElements(), + moveCaretBeforeOnEnterElementsMap = schema.getMoveCaretBeforeOnEnterElements(); + + function handleEnterKey(evt) { + var rng, tmpRng, editableRoot, container, offset, parentBlock, documentMode, shiftKey, + newBlock, fragment, containerBlock, parentBlockName, containerBlockName, newBlockName, isAfterLastNodeInContainer; + + // Returns true if the block can be split into two blocks or not + function canSplitBlock(node) { + return node && + dom.isBlock(node) && + !/^(TD|TH|CAPTION|FORM)$/.test(node.nodeName) && + !/^(fixed|absolute)/i.test(node.style.position) && + dom.getContentEditable(node) !== "true"; + } + + // Renders empty block on IE + function renderBlockOnIE(block) { + var oldRng; + + if (dom.isBlock(block)) { + oldRng = selection.getRng(); + block.appendChild(dom.create('span', null, '\u00a0')); + selection.select(block); + block.lastChild.outerHTML = ''; + selection.setRng(oldRng); + } + } + + // Remove the first empty inline element of the block so this:

    x

    becomes this:

    x

    + function trimInlineElementsOnLeftSideOfBlock(block) { + var node = block, firstChilds = [], i; + + if (!node) { + return; + } + + // Find inner most first child ex:

    *

    + while ((node = node.firstChild)) { + if (dom.isBlock(node)) { + return; + } + + if (node.nodeType == 1 && !nonEmptyElementsMap[node.nodeName.toLowerCase()]) { + firstChilds.push(node); + } + } + + i = firstChilds.length; + while (i--) { + node = firstChilds[i]; + if (!node.hasChildNodes() || (node.firstChild == node.lastChild && node.firstChild.nodeValue === '')) { + dom.remove(node); + } else { + // Remove
    see #5381 + if (node.nodeName == "A" && (node.innerText || node.textContent) === ' ') { + dom.remove(node); + } + } + } + } + + // Moves the caret to a suitable position within the root for example in the first non + // pure whitespace text node or before an image + function moveToCaretPosition(root) { + var walker, node, rng, lastNode = root, tempElm; + function firstNonWhiteSpaceNodeSibling(node) { + while (node) { + if (node.nodeType == 1 || (node.nodeType == 3 && node.data && /[\r\n\s]/.test(node.data))) { + return node; + } + + node = node.nextSibling; + } + } + + if (!root) { + return; + } + + // Old IE versions doesn't properly render blocks with br elements in them + // For example


    wont be rendered correctly in a contentEditable area + // until you remove the br producing

    + if (Env.ie && Env.ie < 9 && parentBlock && parentBlock.firstChild) { + if (parentBlock.firstChild == parentBlock.lastChild && parentBlock.firstChild.tagName == 'BR') { + dom.remove(parentBlock.firstChild); + } + } + + if (/^(LI|DT|DD)$/.test(root.nodeName)) { + var firstChild = firstNonWhiteSpaceNodeSibling(root.firstChild); + + if (firstChild && /^(UL|OL|DL)$/.test(firstChild.nodeName)) { + root.insertBefore(dom.doc.createTextNode('\u00a0'), root.firstChild); + } + } + + rng = dom.createRng(); + + // Normalize whitespace to remove empty text nodes. Fix for: #6904 + // Gecko will be able to place the caret in empty text nodes but it won't render propery + // Older IE versions will sometimes crash so for now ignore all IE versions + if (!Env.ie) { + root.normalize(); + } + + if (root.hasChildNodes()) { + walker = new TreeWalker(root, root); + + while ((node = walker.current())) { + if (node.nodeType == 3) { + rng.setStart(node, 0); + rng.setEnd(node, 0); + break; + } + + if (moveCaretBeforeOnEnterElementsMap[node.nodeName.toLowerCase()]) { + rng.setStartBefore(node); + rng.setEndBefore(node); + break; + } + + lastNode = node; + node = walker.next(); + } + + if (!node) { + rng.setStart(lastNode, 0); + rng.setEnd(lastNode, 0); + } + } else { + if (root.nodeName == 'BR') { + if (root.nextSibling && dom.isBlock(root.nextSibling)) { + // Trick on older IE versions to render the caret before the BR between two lists + if (!documentMode || documentMode < 9) { + tempElm = dom.create('br'); + root.parentNode.insertBefore(tempElm, root); + } + + rng.setStartBefore(root); + rng.setEndBefore(root); + } else { + rng.setStartAfter(root); + rng.setEndAfter(root); + } + } else { + rng.setStart(root, 0); + rng.setEnd(root, 0); + } + } + + selection.setRng(rng); + + // Remove tempElm created for old IE:s + dom.remove(tempElm); + selection.scrollIntoView(root); + } + + function setForcedBlockAttrs(node) { + var forcedRootBlockName = settings.forced_root_block; + + if (forcedRootBlockName && forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) { + dom.setAttribs(node, settings.forced_root_block_attrs); + } + } + + // Creates a new block element by cloning the current one or creating a new one if the name is specified + // This function will also copy any text formatting from the parent block and add it to the new one + function createNewBlock(name) { + var node = container, block, clonedNode, caretNode, textInlineElements = schema.getTextInlineElements(); + + if (name || parentBlockName == "TABLE") { + block = dom.create(name || newBlockName); + setForcedBlockAttrs(block); + } else { + block = parentBlock.cloneNode(false); + } + + caretNode = block; + + // Clone any parent styles + if (settings.keep_styles !== false) { + do { + if (textInlineElements[node.nodeName]) { + // Never clone a caret containers + if (node.id == '_mce_caret') { + continue; + } + + clonedNode = node.cloneNode(false); + dom.setAttrib(clonedNode, 'id', ''); // Remove ID since it needs to be document unique + + if (block.hasChildNodes()) { + clonedNode.appendChild(block.firstChild); + block.appendChild(clonedNode); + } else { + caretNode = clonedNode; + block.appendChild(clonedNode); + } + } + } while ((node = node.parentNode)); + } + + // BR is needed in empty blocks on non IE browsers + if (!isIE) { + caretNode.innerHTML = '
    '; + } + + return block; + } + + // Returns true/false if the caret is at the start/end of the parent block element + function isCaretAtStartOrEndOfBlock(start) { + var walker, node, name; + + // Caret is in the middle of a text node like "a|b" + if (container.nodeType == 3 && (start ? offset > 0 : offset < container.nodeValue.length)) { + return false; + } + + // If after the last element in block node edge case for #5091 + if (container.parentNode == parentBlock && isAfterLastNodeInContainer && !start) { + return true; + } + + // If the caret if before the first element in parentBlock + if (start && container.nodeType == 1 && container == parentBlock.firstChild) { + return true; + } + + // Caret can be before/after a table + if (container.nodeName === "TABLE" || (container.previousSibling && container.previousSibling.nodeName == "TABLE")) { + return (isAfterLastNodeInContainer && !start) || (!isAfterLastNodeInContainer && start); + } + + // Walk the DOM and look for text nodes or non empty elements + walker = new TreeWalker(container, parentBlock); + + // If caret is in beginning or end of a text block then jump to the next/previous node + if (container.nodeType == 3) { + if (start && offset === 0) { + walker.prev(); + } else if (!start && offset == container.nodeValue.length) { + walker.next(); + } + } + + while ((node = walker.current())) { + if (node.nodeType === 1) { + // Ignore bogus elements + if (!node.getAttribute('data-mce-bogus')) { + // Keep empty elements like but not trailing br:s like

    text|

    + name = node.nodeName.toLowerCase(); + if (nonEmptyElementsMap[name] && name !== 'br') { + return false; + } + } + } else if (node.nodeType === 3 && !/^[ \t\r\n]*$/.test(node.nodeValue)) { + return false; + } + + if (start) { + walker.prev(); + } else { + walker.next(); + } + } + + return true; + } + + // Wraps any text nodes or inline elements in the specified forced root block name + function wrapSelfAndSiblingsInDefaultBlock(container, offset) { + var newBlock, parentBlock, startNode, node, next, rootBlockName, blockName = newBlockName || 'P'; + + // Not in a block element or in a table cell or caption + parentBlock = dom.getParent(container, dom.isBlock); + rootBlockName = editor.getBody().nodeName.toLowerCase(); + if (!parentBlock || !canSplitBlock(parentBlock)) { + parentBlock = parentBlock || editableRoot; + + if (!parentBlock.hasChildNodes()) { + newBlock = dom.create(blockName); + setForcedBlockAttrs(newBlock); + parentBlock.appendChild(newBlock); + rng.setStart(newBlock, 0); + rng.setEnd(newBlock, 0); + return newBlock; + } + + // Find parent that is the first child of parentBlock + node = container; + while (node.parentNode != parentBlock) { + node = node.parentNode; + } + + // Loop left to find start node start wrapping at + while (node && !dom.isBlock(node)) { + startNode = node; + node = node.previousSibling; + } + + if (startNode && schema.isValidChild(rootBlockName, blockName.toLowerCase())) { + newBlock = dom.create(blockName); + setForcedBlockAttrs(newBlock); + startNode.parentNode.insertBefore(newBlock, startNode); + + // Start wrapping until we hit a block + node = startNode; + while (node && !dom.isBlock(node)) { + next = node.nextSibling; + newBlock.appendChild(node); + node = next; + } + + // Restore range to it's past location + rng.setStart(container, offset); + rng.setEnd(container, offset); + } + } + + return container; + } + + // Inserts a block or br before/after or in the middle of a split list of the LI is empty + function handleEmptyListItem() { + function isFirstOrLastLi(first) { + var node = containerBlock[first ? 'firstChild' : 'lastChild']; + + // Find first/last element since there might be whitespace there + while (node) { + if (node.nodeType == 1) { + break; + } + + node = node[first ? 'nextSibling' : 'previousSibling']; + } + + return node === parentBlock; + } + + function getContainerBlock() { + var containerBlockParent = containerBlock.parentNode; + + if (/^(LI|DT|DD)$/.test(containerBlockParent.nodeName)) { + return containerBlockParent; + } + + return containerBlock; + } + + // Check if we are in an nested list + var containerBlockParentName = containerBlock.parentNode.nodeName; + if (/^(OL|UL|LI)$/.test(containerBlockParentName)) { + newBlockName = 'LI'; + } + + newBlock = newBlockName ? createNewBlock(newBlockName) : dom.create('BR'); + + if (isFirstOrLastLi(true) && isFirstOrLastLi()) { + if (containerBlockParentName == 'LI') { + // Nested list is inside a LI + dom.insertAfter(newBlock, getContainerBlock()); + } else { + // Is first and last list item then replace the OL/UL with a text block + dom.replace(newBlock, containerBlock); + } + } else if (isFirstOrLastLi(true)) { + if (containerBlockParentName == 'LI') { + // List nested in an LI then move the list to a new sibling LI + dom.insertAfter(newBlock, getContainerBlock()); + newBlock.appendChild(dom.doc.createTextNode(' ')); // Needed for IE so the caret can be placed + newBlock.appendChild(containerBlock); + } else { + // First LI in list then remove LI and add text block before list + containerBlock.parentNode.insertBefore(newBlock, containerBlock); + } + } else if (isFirstOrLastLi()) { + // Last LI in list then remove LI and add text block after list + dom.insertAfter(newBlock, getContainerBlock()); + renderBlockOnIE(newBlock); + } else { + // Middle LI in list the split the list and insert a text block in the middle + // Extract after fragment and insert it after the current block + containerBlock = getContainerBlock(); + tmpRng = rng.cloneRange(); + tmpRng.setStartAfter(parentBlock); + tmpRng.setEndAfter(containerBlock); + fragment = tmpRng.extractContents(); + + if (newBlockName == 'LI' && fragment.firstChild.nodeName == 'LI') { + newBlock = fragment.firstChild; + dom.insertAfter(fragment, containerBlock); + } else { + dom.insertAfter(fragment, containerBlock); + dom.insertAfter(newBlock, containerBlock); + } + } + + dom.remove(parentBlock); + moveToCaretPosition(newBlock); + undoManager.add(); + } + + // Inserts a BR element if the forced_root_block option is set to false or empty string + function insertBr() { + editor.execCommand("InsertLineBreak", false, evt); + } + + // Trims any linebreaks at the beginning of node user for example when pressing enter in a PRE element + function trimLeadingLineBreaks(node) { + do { + if (node.nodeType === 3) { + node.nodeValue = node.nodeValue.replace(/^[\r\n]+/, ''); + } + + node = node.firstChild; + } while (node); + } + + function getEditableRoot(node) { + var root = dom.getRoot(), parent, editableRoot; + + // Get all parents until we hit a non editable parent or the root + parent = node; + while (parent !== root && dom.getContentEditable(parent) !== "false") { + if (dom.getContentEditable(parent) === "true") { + editableRoot = parent; + } + + parent = parent.parentNode; + } + + return parent !== root ? editableRoot : root; + } + + // Adds a BR at the end of blocks that only contains an IMG or INPUT since + // these might be floated and then they won't expand the block + function addBrToBlockIfNeeded(block) { + var lastChild; + + // IE will render the blocks correctly other browsers needs a BR + if (!isIE) { + block.normalize(); // Remove empty text nodes that got left behind by the extract + + // Check if the block is empty or contains a floated last child + lastChild = block.lastChild; + if (!lastChild || (/^(left|right)$/gi.test(dom.getStyle(lastChild, 'float', true)))) { + dom.add(block, 'br'); + } + } + } + + rng = selection.getRng(true); + + // Event is blocked by some other handler for example the lists plugin + if (evt.isDefaultPrevented()) { + return; + } + + // Delete any selected contents + if (!rng.collapsed) { + editor.execCommand('Delete'); + return; + } + + // Setup range items and newBlockName + new RangeUtils(dom).normalize(rng); + container = rng.startContainer; + offset = rng.startOffset; + newBlockName = (settings.force_p_newlines ? 'p' : '') || settings.forced_root_block; + newBlockName = newBlockName ? newBlockName.toUpperCase() : ''; + documentMode = dom.doc.documentMode; + shiftKey = evt.shiftKey; + + // Resolve node index + if (container.nodeType == 1 && container.hasChildNodes()) { + isAfterLastNodeInContainer = offset > container.childNodes.length - 1; + + container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container; + if (isAfterLastNodeInContainer && container.nodeType == 3) { + offset = container.nodeValue.length; + } else { + offset = 0; + } + } + + // Get editable root node normaly the body element but sometimes a div or span + editableRoot = getEditableRoot(container); + + // If there is no editable root then enter is done inside a contentEditable false element + if (!editableRoot) { + return; + } + + undoManager.beforeChange(); + + // If editable root isn't block nor the root of the editor + if (!dom.isBlock(editableRoot) && editableRoot != dom.getRoot()) { + if (!newBlockName || shiftKey) { + insertBr(); + } + + return; + } + + // Wrap the current node and it's sibling in a default block if it's needed. + // for example this
  • will become this + // This won't happen if root blocks are disabled or the shiftKey is pressed + if ((newBlockName && !shiftKey) || (!newBlockName && shiftKey)) { + container = wrapSelfAndSiblingsInDefaultBlock(container, offset); + } + + // Find parent block and setup empty block paddings + parentBlock = dom.getParent(container, dom.isBlock); + containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null; + + // Setup block names + parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5 + containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5 + + // Enter inside block contained within a LI then split or insert before/after LI + if (containerBlockName == 'LI' && !evt.ctrlKey) { + parentBlock = containerBlock; + parentBlockName = containerBlockName; + } + + // Handle enter in list item + if (/^(LI|DT|DD)$/.test(parentBlockName)) { + if (!newBlockName && shiftKey) { + insertBr(); + return; + } + + // Handle enter inside an empty list item + if (dom.isEmpty(parentBlock)) { + handleEmptyListItem(); + return; + } + } + + // Don't split PRE tags but insert a BR instead easier when writing code samples etc + if (parentBlockName == 'PRE' && settings.br_in_pre !== false) { + if (!shiftKey) { + insertBr(); + return; + } + } else { + // If no root block is configured then insert a BR by default or if the shiftKey is pressed + if ((!newBlockName && !shiftKey && parentBlockName != 'LI') || (newBlockName && shiftKey)) { + insertBr(); + return; + } + } + + // If parent block is root then never insert new blocks + if (newBlockName && parentBlock === editor.getBody()) { + return; + } + + // Default block name if it's not configured + newBlockName = newBlockName || 'P'; + + // Insert new block before/after the parent block depending on caret location + if (isCaretAtStartOrEndOfBlock()) { + // If the caret is at the end of a header we produce a P tag after it similar to Word unless we are in a hgroup + if (/^(H[1-6]|PRE|FIGURE)$/.test(parentBlockName) && containerBlockName != 'HGROUP') { + newBlock = createNewBlock(newBlockName); + } else { + newBlock = createNewBlock(); + } + + // Split the current container block element if enter is pressed inside an empty inner block element + if (settings.end_container_on_empty_block && canSplitBlock(containerBlock) && dom.isEmpty(parentBlock)) { + // Split container block for example a BLOCKQUOTE at the current blockParent location for example a P + newBlock = dom.split(containerBlock, parentBlock); + } else { + dom.insertAfter(newBlock, parentBlock); + } + + moveToCaretPosition(newBlock); + } else if (isCaretAtStartOrEndOfBlock(true)) { + // Insert new block before + newBlock = parentBlock.parentNode.insertBefore(createNewBlock(), parentBlock); + renderBlockOnIE(newBlock); + moveToCaretPosition(parentBlock); + } else { + // Extract after fragment and insert it after the current block + tmpRng = rng.cloneRange(); + tmpRng.setEndAfter(parentBlock); + fragment = tmpRng.extractContents(); + trimLeadingLineBreaks(fragment); + newBlock = fragment.firstChild; + dom.insertAfter(fragment, parentBlock); + trimInlineElementsOnLeftSideOfBlock(newBlock); + addBrToBlockIfNeeded(parentBlock); + moveToCaretPosition(newBlock); + } + + dom.setAttrib(newBlock, 'id', ''); // Remove ID since it needs to be document unique + + // Allow custom handling of new blocks + editor.fire('NewBlock', {newBlock: newBlock}); + + undoManager.add(); + } + + editor.on('keydown', function(evt) { + if (evt.keyCode == 13) { + if (handleEnterKey(evt) !== false) { + evt.preventDefault(); + } + } + }); + }; +}); + +// Included from: js/tinymce/classes/ForceBlocks.js + +/** + * ForceBlocks.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +define("tinymce/ForceBlocks", [], function() { + return function(editor) { + var settings = editor.settings, dom = editor.dom, selection = editor.selection; + var schema = editor.schema, blockElements = schema.getBlockElements(); + + function addRootBlocks() { + var node = selection.getStart(), rootNode = editor.getBody(), rng; + var startContainer, startOffset, endContainer, endOffset, rootBlockNode; + var tempNode, offset = -0xFFFFFF, wrapped, restoreSelection; + var tmpRng, rootNodeName, forcedRootBlock; + + forcedRootBlock = settings.forced_root_block; + + if (!node || node.nodeType !== 1 || !forcedRootBlock) { + return; + } + + // Check if node is wrapped in block + while (node && node != rootNode) { + if (blockElements[node.nodeName]) { + return; + } + + node = node.parentNode; + } + + // Get current selection + rng = selection.getRng(); + if (rng.setStart) { + startContainer = rng.startContainer; + startOffset = rng.startOffset; + endContainer = rng.endContainer; + endOffset = rng.endOffset; + + try { + restoreSelection = editor.getDoc().activeElement === rootNode; + } catch (ex) { + // IE throws unspecified error here sometimes + } + } else { + // Force control range into text range + if (rng.item) { + node = rng.item(0); + rng = editor.getDoc().body.createTextRange(); + rng.moveToElementText(node); + } + + restoreSelection = rng.parentElement().ownerDocument === editor.getDoc(); + tmpRng = rng.duplicate(); + tmpRng.collapse(true); + startOffset = tmpRng.move('character', offset) * -1; + + if (!tmpRng.collapsed) { + tmpRng = rng.duplicate(); + tmpRng.collapse(false); + endOffset = (tmpRng.move('character', offset) * -1) - startOffset; + } + } + + // Wrap non block elements and text nodes + node = rootNode.firstChild; + rootNodeName = rootNode.nodeName.toLowerCase(); + while (node) { + // TODO: Break this up, too complex + if (((node.nodeType === 3 || (node.nodeType == 1 && !blockElements[node.nodeName]))) && + schema.isValidChild(rootNodeName, forcedRootBlock.toLowerCase())) { + // Remove empty text nodes + if (node.nodeType === 3 && node.nodeValue.length === 0) { + tempNode = node; + node = node.nextSibling; + dom.remove(tempNode); + continue; + } + + if (!rootBlockNode) { + rootBlockNode = dom.create(forcedRootBlock, editor.settings.forced_root_block_attrs); + node.parentNode.insertBefore(rootBlockNode, node); + wrapped = true; + } + + tempNode = node; + node = node.nextSibling; + rootBlockNode.appendChild(tempNode); + } else { + rootBlockNode = null; + node = node.nextSibling; + } + } + + if (wrapped && restoreSelection) { + if (rng.setStart) { + rng.setStart(startContainer, startOffset); + rng.setEnd(endContainer, endOffset); + selection.setRng(rng); + } else { + // Only select if the previous selection was inside the document to prevent auto focus in quirks mode + try { + rng = editor.getDoc().body.createTextRange(); + rng.moveToElementText(rootNode); + rng.collapse(true); + rng.moveStart('character', startOffset); + + if (endOffset > 0) { + rng.moveEnd('character', endOffset); + } + + rng.select(); + } catch (ex) { + // Ignore + } + } + + editor.nodeChanged(); + } + } + + // Force root blocks + if (settings.forced_root_block) { + editor.on('NodeChange', addRootBlocks); + } + }; +}); + +// Included from: js/tinymce/classes/EditorCommands.js + +/** + * EditorCommands.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class enables you to add custom editor commands and it contains + * overrides for native browser commands to address various bugs and issues. + * + * @class tinymce.EditorCommands + */ +define("tinymce/EditorCommands", [ + "tinymce/html/Serializer", + "tinymce/Env", + "tinymce/util/Tools", + "tinymce/dom/ElementUtils", + "tinymce/dom/RangeUtils", + "tinymce/dom/TreeWalker" +], function(Serializer, Env, Tools, ElementUtils, RangeUtils, TreeWalker) { + // Added for compression purposes + var each = Tools.each, extend = Tools.extend; + var map = Tools.map, inArray = Tools.inArray, explode = Tools.explode; + var isGecko = Env.gecko, isIE = Env.ie, isOldIE = Env.ie && Env.ie < 11; + var TRUE = true, FALSE = false; + + return function(editor) { + var dom, selection, formatter, + commands = {state: {}, exec: {}, value: {}}, + settings = editor.settings, + bookmark; + + editor.on('PreInit', function() { + dom = editor.dom; + selection = editor.selection; + settings = editor.settings; + formatter = editor.formatter; + }); + + /** + * Executes the specified command. + * + * @method execCommand + * @param {String} command Command to execute. + * @param {Boolean} ui Optional user interface state. + * @param {Object} value Optional value for command. + * @return {Boolean} true/false if the command was found or not. + */ + function execCommand(command, ui, value, args) { + var func, customCommand, state = 0; + + if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(command) && (!args || !args.skip_focus)) { + editor.focus(); + } + + args = extend({}, args); + args = editor.fire('BeforeExecCommand', {command: command, ui: ui, value: value}); + if (args.isDefaultPrevented()) { + return false; + } + + customCommand = command.toLowerCase(); + if ((func = commands.exec[customCommand])) { + func(customCommand, ui, value); + editor.fire('ExecCommand', {command: command, ui: ui, value: value}); + return true; + } + + // Plugin commands + each(editor.plugins, function(p) { + if (p.execCommand && p.execCommand(command, ui, value)) { + editor.fire('ExecCommand', {command: command, ui: ui, value: value}); + state = true; + return false; + } + }); + + if (state) { + return state; + } + + // Theme commands + if (editor.theme && editor.theme.execCommand && editor.theme.execCommand(command, ui, value)) { + editor.fire('ExecCommand', {command: command, ui: ui, value: value}); + return true; + } + + // Browser commands + try { + state = editor.getDoc().execCommand(command, ui, value); + } catch (ex) { + // Ignore old IE errors + } + + if (state) { + editor.fire('ExecCommand', {command: command, ui: ui, value: value}); + return true; + } + + return false; + } + + /** + * Queries the current state for a command for example if the current selection is "bold". + * + * @method queryCommandState + * @param {String} command Command to check the state of. + * @return {Boolean/Number} true/false if the selected contents is bold or not, -1 if it's not found. + */ + function queryCommandState(command) { + var func; + + // Is hidden then return undefined + if (editor._isHidden()) { + return; + } + + command = command.toLowerCase(); + if ((func = commands.state[command])) { + return func(command); + } + + // Browser commands + try { + return editor.getDoc().queryCommandState(command); + } catch (ex) { + // Fails sometimes see bug: 1896577 + } + + return false; + } + + /** + * Queries the command value for example the current fontsize. + * + * @method queryCommandValue + * @param {String} command Command to check the value of. + * @return {Object} Command value of false if it's not found. + */ + function queryCommandValue(command) { + var func; + + // Is hidden then return undefined + if (editor._isHidden()) { + return; + } + + command = command.toLowerCase(); + if ((func = commands.value[command])) { + return func(command); + } + + // Browser commands + try { + return editor.getDoc().queryCommandValue(command); + } catch (ex) { + // Fails sometimes see bug: 1896577 + } + } + + /** + * Adds commands to the command collection. + * + * @method addCommands + * @param {Object} command_list Name/value collection with commands to add, the names can also be comma separated. + * @param {String} type Optional type to add, defaults to exec. Can be value or state as well. + */ + function addCommands(command_list, type) { + type = type || 'exec'; + + each(command_list, function(callback, command) { + each(command.toLowerCase().split(','), function(command) { + commands[type][command] = callback; + }); + }); + } + + function addCommand(command, callback, scope) { + command = command.toLowerCase(); + commands.exec[command] = function(command, ui, value, args) { + return callback.call(scope || editor, ui, value, args); + }; + } + + /** + * Returns true/false if the command is supported or not. + * + * @method queryCommandSupported + * @param {String} cmd Command that we check support for. + * @return {Boolean} true/false if the command is supported or not. + */ + function queryCommandSupported(command) { + command = command.toLowerCase(); + + if (commands.exec[command]) { + return true; + } + + // Browser commands + try { + return editor.getDoc().queryCommandSupported(command); + } catch (ex) { + // Fails sometimes see bug: 1896577 + } + + return false; + } + + function addQueryStateHandler(command, callback, scope) { + command = command.toLowerCase(); + commands.state[command] = function() { + return callback.call(scope || editor); + }; + } + + function addQueryValueHandler(command, callback, scope) { + command = command.toLowerCase(); + commands.value[command] = function() { + return callback.call(scope || editor); + }; + } + + function hasCustomCommand(command) { + command = command.toLowerCase(); + return !!commands.exec[command]; + } + + // Expose public methods + extend(this, { + execCommand: execCommand, + queryCommandState: queryCommandState, + queryCommandValue: queryCommandValue, + queryCommandSupported: queryCommandSupported, + addCommands: addCommands, + addCommand: addCommand, + addQueryStateHandler: addQueryStateHandler, + addQueryValueHandler: addQueryValueHandler, + hasCustomCommand: hasCustomCommand + }); + + // Private methods + + function execNativeCommand(command, ui, value) { + if (ui === undefined) { + ui = FALSE; + } + + if (value === undefined) { + value = null; + } + + return editor.getDoc().execCommand(command, ui, value); + } + + function isFormatMatch(name) { + return formatter.match(name); + } + + function toggleFormat(name, value) { + formatter.toggle(name, value ? {value: value} : undefined); + editor.nodeChanged(); + } + + function storeSelection(type) { + bookmark = selection.getBookmark(type); + } + + function restoreSelection() { + selection.moveToBookmark(bookmark); + } + + // Add execCommand overrides + addCommands({ + // Ignore these, added for compatibility + 'mceResetDesignMode,mceBeginUndoLevel': function() {}, + + // Add undo manager logic + 'mceEndUndoLevel,mceAddUndoLevel': function() { + editor.undoManager.add(); + }, + + 'Cut,Copy,Paste': function(command) { + var doc = editor.getDoc(), failed; + + // Try executing the native command + try { + execNativeCommand(command); + } catch (ex) { + // Command failed + failed = TRUE; + } + + // Present alert message about clipboard access not being available + if (failed || !doc.queryCommandSupported(command)) { + var msg = editor.translate( + "Your browser doesn't support direct access to the clipboard. " + + "Please use the Ctrl+X/C/V keyboard shortcuts instead." + ); + + if (Env.mac) { + msg = msg.replace(/Ctrl\+/g, '\u2318+'); + } + + editor.windowManager.alert(msg); + } + }, + + // Override unlink command + unlink: function() { + if (selection.isCollapsed()) { + var elm = selection.getNode(); + if (elm.tagName == 'A') { + editor.dom.remove(elm, true); + } + + return; + } + + formatter.remove("link"); + }, + + // Override justify commands to use the text formatter engine + 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull': function(command) { + var align = command.substring(7); + + if (align == 'full') { + align = 'justify'; + } + + // Remove all other alignments first + each('left,center,right,justify'.split(','), function(name) { + if (align != name) { + formatter.remove('align' + name); + } + }); + + toggleFormat('align' + align); + execCommand('mceRepaint'); + }, + + // Override list commands to fix WebKit bug + 'InsertUnorderedList,InsertOrderedList': function(command) { + var listElm, listParent; + + execNativeCommand(command); + + // WebKit produces lists within block elements so we need to split them + // we will replace the native list creation logic to custom logic later on + // TODO: Remove this when the list creation logic is removed + listElm = dom.getParent(selection.getNode(), 'ol,ul'); + if (listElm) { + listParent = listElm.parentNode; + + // If list is within a text block then split that block + if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) { + storeSelection(); + dom.split(listParent, listElm); + restoreSelection(); + } + } + }, + + // Override commands to use the text formatter engine + 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function(command) { + toggleFormat(command); + }, + + // Override commands to use the text formatter engine + 'ForeColor,HiliteColor,FontName': function(command, ui, value) { + toggleFormat(command, value); + }, + + FontSize: function(command, ui, value) { + var fontClasses, fontSizes; + + // Convert font size 1-7 to styles + if (value >= 1 && value <= 7) { + fontSizes = explode(settings.font_size_style_values); + fontClasses = explode(settings.font_size_classes); + + if (fontClasses) { + value = fontClasses[value - 1] || value; + } else { + value = fontSizes[value - 1] || value; + } + } + + toggleFormat(command, value); + }, + + RemoveFormat: function(command) { + formatter.remove(command); + }, + + mceBlockQuote: function() { + toggleFormat('blockquote'); + }, + + FormatBlock: function(command, ui, value) { + return toggleFormat(value || 'p'); + }, + + mceCleanup: function() { + var bookmark = selection.getBookmark(); + + editor.setContent(editor.getContent({cleanup: TRUE}), {cleanup: TRUE}); + + selection.moveToBookmark(bookmark); + }, + + mceRemoveNode: function(command, ui, value) { + var node = value || selection.getNode(); + + // Make sure that the body node isn't removed + if (node != editor.getBody()) { + storeSelection(); + editor.dom.remove(node, TRUE); + restoreSelection(); + } + }, + + mceSelectNodeDepth: function(command, ui, value) { + var counter = 0; + + dom.getParent(selection.getNode(), function(node) { + if (node.nodeType == 1 && counter++ == value) { + selection.select(node); + return FALSE; + } + }, editor.getBody()); + }, + + mceSelectNode: function(command, ui, value) { + selection.select(value); + }, + + mceInsertContent: function(command, ui, value) { + var parser, serializer, parentNode, rootNode, fragment, args; + var marker, rng, node, node2, bookmarkHtml, merge; + var textInlineElements = editor.schema.getTextInlineElements(); + + function trimOrPaddLeftRight(html) { + var rng, container, offset; + + rng = selection.getRng(true); + container = rng.startContainer; + offset = rng.startOffset; + + function hasSiblingText(siblingName) { + return container[siblingName] && container[siblingName].nodeType == 3; + } + + if (container.nodeType == 3) { + if (offset > 0) { + html = html.replace(/^ /, ' '); + } else if (!hasSiblingText('previousSibling')) { + html = html.replace(/^ /, ' '); + } + + if (offset < container.length) { + html = html.replace(/ (
    |)$/, ' '); + } else if (!hasSiblingText('nextSibling')) { + html = html.replace(/( | )(
    |)$/, ' '); + } + } + + return html; + } + + // Removes   from a [b] c -> a  c -> a c + function trimNbspAfterDeleteAndPaddValue() { + var rng, container, offset; + + rng = selection.getRng(true); + container = rng.startContainer; + offset = rng.startOffset; + + if (container.nodeType == 3 && rng.collapsed) { + if (container.data[offset] === '\u00a0') { + container.deleteData(offset, 1); + + if (!/[\u00a0| ]$/.test(value)) { + value += ' '; + } + } else if (container.data[offset - 1] === '\u00a0') { + container.deleteData(offset - 1, 1); + + if (!/[\u00a0| ]$/.test(value)) { + value = ' ' + value; + } + } + } + } + + function markInlineFormatElements(fragment) { + if (merge) { + for (node = fragment.firstChild; node; node = node.walk(true)) { + if (textInlineElements[node.name]) { + node.attr('data-mce-new', "true"); + } + } + } + } + + function reduceInlineTextElements() { + if (merge) { + var root = editor.getBody(), elementUtils = new ElementUtils(dom); + + each(dom.select('*[data-mce-new]'), function(node) { + node.removeAttribute('data-mce-new'); + + for (var testNode = node.parentNode; testNode && testNode != root; testNode = testNode.parentNode) { + if (elementUtils.compare(testNode, node)) { + dom.remove(node, true); + } + } + }); + } + } + + if (typeof value != 'string') { + merge = value.merge; + value = value.content; + } + + // Check for whitespace before/after value + if (/^ | $/.test(value)) { + value = trimOrPaddLeftRight(value); + } + + // Setup parser and serializer + parser = editor.parser; + serializer = new Serializer({}, editor.schema); + bookmarkHtml = '​'; + + // Run beforeSetContent handlers on the HTML to be inserted + args = {content: value, format: 'html', selection: true}; + editor.fire('BeforeSetContent', args); + value = args.content; + + // Add caret at end of contents if it's missing + if (value.indexOf('{$caret}') == -1) { + value += '{$caret}'; + } + + // Replace the caret marker with a span bookmark element + value = value.replace(/\{\$caret\}/, bookmarkHtml); + + // If selection is at |

    then move it into

    |

    + rng = selection.getRng(); + var caretElement = rng.startContainer || (rng.parentElement ? rng.parentElement() : null); + var body = editor.getBody(); + if (caretElement === body && selection.isCollapsed()) { + if (dom.isBlock(body.firstChild) && dom.isEmpty(body.firstChild)) { + rng = dom.createRng(); + rng.setStart(body.firstChild, 0); + rng.setEnd(body.firstChild, 0); + selection.setRng(rng); + } + } + + // Insert node maker where we will insert the new HTML and get it's parent + if (!selection.isCollapsed()) { + editor.getDoc().execCommand('Delete', false, null); + trimNbspAfterDeleteAndPaddValue(); + } + + parentNode = selection.getNode(); + + // Parse the fragment within the context of the parent node + var parserArgs = {context: parentNode.nodeName.toLowerCase()}; + fragment = parser.parse(value, parserArgs); + + markInlineFormatElements(fragment); + + // Move the caret to a more suitable location + node = fragment.lastChild; + if (node.attr('id') == 'mce_marker') { + marker = node; + + for (node = node.prev; node; node = node.walk(true)) { + if (node.type == 3 || !dom.isBlock(node.name)) { + if (editor.schema.isValidChild(node.parent.name, 'span')) { + node.parent.insert(marker, node, node.name === 'br'); + } + break; + } + } + } + + // If parser says valid we can insert the contents into that parent + if (!parserArgs.invalid) { + value = serializer.serialize(fragment); + + // Check if parent is empty or only has one BR element then set the innerHTML of that parent + node = parentNode.firstChild; + node2 = parentNode.lastChild; + if (!node || (node === node2 && node.nodeName === 'BR')) { + dom.setHTML(parentNode, value); + } else { + selection.setContent(value); + } + } else { + // If the fragment was invalid within that context then we need + // to parse and process the parent it's inserted into + + // Insert bookmark node and get the parent + selection.setContent(bookmarkHtml); + parentNode = selection.getNode(); + rootNode = editor.getBody(); + + // Opera will return the document node when selection is in root + if (parentNode.nodeType == 9) { + parentNode = node = rootNode; + } else { + node = parentNode; + } + + // Find the ancestor just before the root element + while (node !== rootNode) { + parentNode = node; + node = node.parentNode; + } + + // Get the outer/inner HTML depending on if we are in the root and parser and serialize that + value = parentNode == rootNode ? rootNode.innerHTML : dom.getOuterHTML(parentNode); + value = serializer.serialize( + parser.parse( + // Need to replace by using a function since $ in the contents would otherwise be a problem + value.replace(//i, function() { + return serializer.serialize(fragment); + }) + ) + ); + + // Set the inner/outer HTML depending on if we are in the root or not + if (parentNode == rootNode) { + dom.setHTML(rootNode, value); + } else { + dom.setOuterHTML(parentNode, value); + } + } + + reduceInlineTextElements(); + + marker = dom.get('mce_marker'); + selection.scrollIntoView(marker); + + // Move selection before marker and remove it + rng = dom.createRng(); + + // If previous sibling is a text node set the selection to the end of that node + node = marker.previousSibling; + if (node && node.nodeType == 3) { + rng.setStart(node, node.nodeValue.length); + + // TODO: Why can't we normalize on IE + if (!isIE) { + node2 = marker.nextSibling; + if (node2 && node2.nodeType == 3) { + node.appendData(node2.data); + node2.parentNode.removeChild(node2); + } + } + } else { + // If the previous sibling isn't a text node or doesn't exist set the selection before the marker node + rng.setStartBefore(marker); + rng.setEndBefore(marker); + } + + // Remove the marker node and set the new range + dom.remove(marker); + selection.setRng(rng); + + // Dispatch after event and add any visual elements needed + editor.fire('SetContent', args); + editor.addVisual(); + }, + + mceInsertRawHTML: function(command, ui, value) { + selection.setContent('tiny_mce_marker'); + editor.setContent( + editor.getContent().replace(/tiny_mce_marker/g, function() { + return value; + }) + ); + }, + + mceToggleFormat: function(command, ui, value) { + toggleFormat(value); + }, + + mceSetContent: function(command, ui, value) { + editor.setContent(value); + }, + + 'Indent,Outdent': function(command) { + var intentValue, indentUnit, value; + + // Setup indent level + intentValue = settings.indentation; + indentUnit = /[a-z%]+$/i.exec(intentValue); + intentValue = parseInt(intentValue, 10); + + if (!queryCommandState('InsertUnorderedList') && !queryCommandState('InsertOrderedList')) { + // If forced_root_blocks is set to false we don't have a block to indent so lets create a div + if (!settings.forced_root_block && !dom.getParent(selection.getNode(), dom.isBlock)) { + formatter.apply('div'); + } + + each(selection.getSelectedBlocks(), function(element) { + if (element.nodeName != "LI") { + var indentStyleName = editor.getParam('indent_use_margin', false) ? 'margin' : 'padding'; + + indentStyleName += dom.getStyle(element, 'direction', true) == 'rtl' ? 'Right' : 'Left'; + + if (command == 'outdent') { + value = Math.max(0, parseInt(element.style[indentStyleName] || 0, 10) - intentValue); + dom.setStyle(element, indentStyleName, value ? value + indentUnit : ''); + } else { + value = (parseInt(element.style[indentStyleName] || 0, 10) + intentValue) + indentUnit; + dom.setStyle(element, indentStyleName, value); + } + } + }); + } else { + execNativeCommand(command); + } + }, + + mceRepaint: function() { + if (isGecko) { + try { + storeSelection(TRUE); + + if (selection.getSel()) { + selection.getSel().selectAllChildren(editor.getBody()); + } + + selection.collapse(TRUE); + restoreSelection(); + } catch (ex) { + // Ignore + } + } + }, + + InsertHorizontalRule: function() { + editor.execCommand('mceInsertContent', false, '
    '); + }, + + mceToggleVisualAid: function() { + editor.hasVisual = !editor.hasVisual; + editor.addVisual(); + }, + + mceReplaceContent: function(command, ui, value) { + editor.execCommand('mceInsertContent', false, value.replace(/\{\$selection\}/g, selection.getContent({format: 'text'}))); + }, + + mceInsertLink: function(command, ui, value) { + var anchor; + + if (typeof value == 'string') { + value = {href: value}; + } + + anchor = dom.getParent(selection.getNode(), 'a'); + + // Spaces are never valid in URLs and it's a very common mistake for people to make so we fix it here. + value.href = value.href.replace(' ', '%20'); + + // Remove existing links if there could be child links or that the href isn't specified + if (!anchor || !value.href) { + formatter.remove('link'); + } + + // Apply new link to selection + if (value.href) { + formatter.apply('link', value, anchor); + } + }, + + selectAll: function() { + var root = dom.getRoot(), rng; + + if (selection.getRng().setStart) { + rng = dom.createRng(); + rng.setStart(root, 0); + rng.setEnd(root, root.childNodes.length); + selection.setRng(rng); + } else { + // IE will render it's own root level block elements and sometimes + // even put font elements in them when the user starts typing. So we need to + // move the selection to a more suitable element from this: + // |

    to this:

    |

    + rng = selection.getRng(); + if (!rng.item) { + rng.moveToElementText(root); + rng.select(); + } + } + }, + + "delete": function() { + execNativeCommand("Delete"); + + // Check if body is empty after the delete call if so then set the contents + // to an empty string and move the caret to any block produced by that operation + // this fixes the issue with root blocks not being properly produced after a delete call on IE + var body = editor.getBody(); + + if (dom.isEmpty(body)) { + editor.setContent(''); + + if (body.firstChild && dom.isBlock(body.firstChild)) { + editor.selection.setCursorLocation(body.firstChild, 0); + } else { + editor.selection.setCursorLocation(body, 0); + } + } + }, + + mceNewDocument: function() { + editor.setContent(''); + }, + + InsertLineBreak: function(command, ui, value) { + // We load the current event in from EnterKey.js when appropriate to heed + // certain event-specific variations such as ctrl-enter in a list + var evt = value; + var brElm, extraBr, marker; + var rng = selection.getRng(true); + new RangeUtils(dom).normalize(rng); + + var offset = rng.startOffset; + var container = rng.startContainer; + + // Resolve node index + if (container.nodeType == 1 && container.hasChildNodes()) { + var isAfterLastNodeInContainer = offset > container.childNodes.length - 1; + + container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container; + if (isAfterLastNodeInContainer && container.nodeType == 3) { + offset = container.nodeValue.length; + } else { + offset = 0; + } + } + + var parentBlock = dom.getParent(container, dom.isBlock); + var parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5 + var containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null; + var containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5 + + // Enter inside block contained within a LI then split or insert before/after LI + var isControlKey = evt && evt.ctrlKey; + if (containerBlockName == 'LI' && !isControlKey) { + parentBlock = containerBlock; + parentBlockName = containerBlockName; + } + + // Walks the parent block to the right and look for BR elements + function hasRightSideContent() { + var walker = new TreeWalker(container, parentBlock), node; + var nonEmptyElementsMap = editor.schema.getNonEmptyElements(); + + while ((node = walker.next())) { + if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) { + return true; + } + } + } + + if (container && container.nodeType == 3 && offset >= container.nodeValue.length) { + // Insert extra BR element at the end block elements + if (!isOldIE && !hasRightSideContent()) { + brElm = dom.create('br'); + rng.insertNode(brElm); + rng.setStartAfter(brElm); + rng.setEndAfter(brElm); + extraBr = true; + } + } + + brElm = dom.create('br'); + rng.insertNode(brElm); + + // Rendering modes below IE8 doesn't display BR elements in PRE unless we have a \n before it + var documentMode = dom.doc.documentMode; + if (isOldIE && parentBlockName == 'PRE' && (!documentMode || documentMode < 8)) { + brElm.parentNode.insertBefore(dom.doc.createTextNode('\r'), brElm); + } + + // Insert temp marker and scroll to that + marker = dom.create('span', {}, ' '); + brElm.parentNode.insertBefore(marker, brElm); + selection.scrollIntoView(marker); + dom.remove(marker); + + if (!extraBr) { + rng.setStartAfter(brElm); + rng.setEndAfter(brElm); + } else { + rng.setStartBefore(brElm); + rng.setEndBefore(brElm); + } + + selection.setRng(rng); + editor.undoManager.add(); + + return TRUE; + } + }); + + // Add queryCommandState overrides + addCommands({ + // Override justify commands + 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull': function(command) { + var name = 'align' + command.substring(7); + var nodes = selection.isCollapsed() ? [dom.getParent(selection.getNode(), dom.isBlock)] : selection.getSelectedBlocks(); + var matches = map(nodes, function(node) { + return !!formatter.matchNode(node, name); + }); + return inArray(matches, TRUE) !== -1; + }, + + 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function(command) { + return isFormatMatch(command); + }, + + mceBlockQuote: function() { + return isFormatMatch('blockquote'); + }, + + Outdent: function() { + var node; + + if (settings.inline_styles) { + if ((node = dom.getParent(selection.getStart(), dom.isBlock)) && parseInt(node.style.paddingLeft, 10) > 0) { + return TRUE; + } + + if ((node = dom.getParent(selection.getEnd(), dom.isBlock)) && parseInt(node.style.paddingLeft, 10) > 0) { + return TRUE; + } + } + + return ( + queryCommandState('InsertUnorderedList') || + queryCommandState('InsertOrderedList') || + (!settings.inline_styles && !!dom.getParent(selection.getNode(), 'BLOCKQUOTE')) + ); + }, + + 'InsertUnorderedList,InsertOrderedList': function(command) { + var list = dom.getParent(selection.getNode(), 'ul,ol'); + + return list && + ( + command === 'insertunorderedlist' && list.tagName === 'UL' || + command === 'insertorderedlist' && list.tagName === 'OL' + ); + } + }, 'state'); + + // Add queryCommandValue overrides + addCommands({ + 'FontSize,FontName': function(command) { + var value = 0, parent; + + if ((parent = dom.getParent(selection.getNode(), 'span'))) { + if (command == 'fontsize') { + value = parent.style.fontSize; + } else { + value = parent.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase(); + } + } + + return value; + } + }, 'value'); + + // Add undo manager logic + addCommands({ + Undo: function() { + editor.undoManager.undo(); + }, + + Redo: function() { + editor.undoManager.redo(); + } + }); + }; +}); + +// Included from: js/tinymce/classes/util/URI.js + +/** + * URI.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles parsing, modification and serialization of URI/URL strings. + * @class tinymce.util.URI + */ +define("tinymce/util/URI", [ + "tinymce/util/Tools" +], function(Tools) { + var each = Tools.each, trim = Tools.trim; + var queryParts = "source protocol authority userInfo user password host port relative path directory file query anchor".split(' '); + var DEFAULT_PORTS = { + 'ftp': 21, + 'http': 80, + 'https': 443, + 'mailto': 25 + }; + + /** + * Constructs a new URI instance. + * + * @constructor + * @method URI + * @param {String} url URI string to parse. + * @param {Object} settings Optional settings object. + */ + function URI(url, settings) { + var self = this, baseUri, base_url; + + url = trim(url); + settings = self.settings = settings || {}; + baseUri = settings.base_uri; + + // Strange app protocol that isn't http/https or local anchor + // For example: mailto,skype,tel etc. + if (/^([\w\-]+):([^\/]{2})/i.test(url) || /^\s*#/.test(url)) { + self.source = url; + return; + } + + var isProtocolRelative = url.indexOf('//') === 0; + + // Absolute path with no host, fake host and protocol + if (url.indexOf('/') === 0 && !isProtocolRelative) { + url = (baseUri ? baseUri.protocol || 'http' : 'http') + '://mce_host' + url; + } + + // Relative path http:// or protocol relative //path + if (!/^[\w\-]*:?\/\//.test(url)) { + base_url = settings.base_uri ? settings.base_uri.path : new URI(location.href).directory; + if (settings.base_uri.protocol === "") { + url = '//mce_host' + self.toAbsPath(base_url, url); + } else { + url = /([^#?]*)([#?]?.*)/.exec(url); + url = ((baseUri && baseUri.protocol) || 'http') + '://mce_host' + self.toAbsPath(base_url, url[1]) + url[2]; + } + } + + // Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri) + url = url.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something + + /*jshint maxlen: 255 */ + /*eslint max-len: 0 */ + url = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(url); + + each(queryParts, function(v, i) { + var part = url[i]; + + // Zope 3 workaround, they use @@something + if (part) { + part = part.replace(/\(mce_at\)/g, '@@'); + } + + self[v] = part; + }); + + if (baseUri) { + if (!self.protocol) { + self.protocol = baseUri.protocol; + } + + if (!self.userInfo) { + self.userInfo = baseUri.userInfo; + } + + if (!self.port && self.host === 'mce_host') { + self.port = baseUri.port; + } + + if (!self.host || self.host === 'mce_host') { + self.host = baseUri.host; + } + + self.source = ''; + } + + if (isProtocolRelative) { + self.protocol = ''; + } + + //t.path = t.path || '/'; + } + + URI.prototype = { + /** + * Sets the internal path part of the URI. + * + * @method setPath + * @param {string} path Path string to set. + */ + setPath: function(path) { + var self = this; + + path = /^(.*?)\/?(\w+)?$/.exec(path); + + // Update path parts + self.path = path[0]; + self.directory = path[1]; + self.file = path[2]; + + // Rebuild source + self.source = ''; + self.getURI(); + }, + + /** + * Converts the specified URI into a relative URI based on the current URI instance location. + * + * @method toRelative + * @param {String} uri URI to convert into a relative path/URI. + * @return {String} Relative URI from the point specified in the current URI instance. + * @example + * // Converts an absolute URL to an relative URL url will be somedir/somefile.htm + * var url = new tinymce.util.URI('http://www.site.com/dir/').toRelative('http://www.site.com/dir/somedir/somefile.htm'); + */ + toRelative: function(uri) { + var self = this, output; + + if (uri === "./") { + return uri; + } + + uri = new URI(uri, {base_uri: self}); + + // Not on same domain/port or protocol + if ((uri.host != 'mce_host' && self.host != uri.host && uri.host) || self.port != uri.port || + (self.protocol != uri.protocol && uri.protocol !== "")) { + return uri.getURI(); + } + + var tu = self.getURI(), uu = uri.getURI(); + + // Allow usage of the base_uri when relative_urls = true + if (tu == uu || (tu.charAt(tu.length - 1) == "/" && tu.substr(0, tu.length - 1) == uu)) { + return tu; + } + + output = self.toRelPath(self.path, uri.path); + + // Add query + if (uri.query) { + output += '?' + uri.query; + } + + // Add anchor + if (uri.anchor) { + output += '#' + uri.anchor; + } + + return output; + }, + + /** + * Converts the specified URI into a absolute URI based on the current URI instance location. + * + * @method toAbsolute + * @param {String} uri URI to convert into a relative path/URI. + * @param {Boolean} noHost No host and protocol prefix. + * @return {String} Absolute URI from the point specified in the current URI instance. + * @example + * // Converts an relative URL to an absolute URL url will be http://www.site.com/dir/somedir/somefile.htm + * var url = new tinymce.util.URI('http://www.site.com/dir/').toAbsolute('somedir/somefile.htm'); + */ + toAbsolute: function(uri, noHost) { + uri = new URI(uri, {base_uri: this}); + + return uri.getURI(noHost && this.isSameOrigin(uri)); + }, + + /** + * Determine whether the given URI has the same origin as this URI. Based on RFC-6454. + * Supports default ports for protocols listed in DEFAULT_PORTS. Unsupported protocols will fail safe: they + * won't match, if the port specifications differ. + * + * @method isSameOrigin + * @param {tinymce.util.URI} uri Uri instance to compare. + * @returns {Boolean} True if the origins are the same. + */ + isSameOrigin: function(uri) { + if (this.host == uri.host && this.protocol == uri.protocol) { + if (this.port == uri.port) { + return true; + } + + var defaultPort = DEFAULT_PORTS[this.protocol]; + if (defaultPort && ((this.port || defaultPort) == (uri.port || defaultPort))) { + return true; + } + } + + return false; + }, + + /** + * Converts a absolute path into a relative path. + * + * @method toRelPath + * @param {String} base Base point to convert the path from. + * @param {String} path Absolute path to convert into a relative path. + */ + toRelPath: function(base, path) { + var items, breakPoint = 0, out = '', i, l; + + // Split the paths + base = base.substring(0, base.lastIndexOf('/')); + base = base.split('/'); + items = path.split('/'); + + if (base.length >= items.length) { + for (i = 0, l = base.length; i < l; i++) { + if (i >= items.length || base[i] != items[i]) { + breakPoint = i + 1; + break; + } + } + } + + if (base.length < items.length) { + for (i = 0, l = items.length; i < l; i++) { + if (i >= base.length || base[i] != items[i]) { + breakPoint = i + 1; + break; + } + } + } + + if (breakPoint === 1) { + return path; + } + + for (i = 0, l = base.length - (breakPoint - 1); i < l; i++) { + out += "../"; + } + + for (i = breakPoint - 1, l = items.length; i < l; i++) { + if (i != breakPoint - 1) { + out += "/" + items[i]; + } else { + out += items[i]; + } + } + + return out; + }, + + /** + * Converts a relative path into a absolute path. + * + * @method toAbsPath + * @param {String} base Base point to convert the path from. + * @param {String} path Relative path to convert into an absolute path. + */ + toAbsPath: function(base, path) { + var i, nb = 0, o = [], tr, outPath; + + // Split paths + tr = /\/$/.test(path) ? '/' : ''; + base = base.split('/'); + path = path.split('/'); + + // Remove empty chunks + each(base, function(k) { + if (k) { + o.push(k); + } + }); + + base = o; + + // Merge relURLParts chunks + for (i = path.length - 1, o = []; i >= 0; i--) { + // Ignore empty or . + if (path[i].length === 0 || path[i] === ".") { + continue; + } + + // Is parent + if (path[i] === '..') { + nb++; + continue; + } + + // Move up + if (nb > 0) { + nb--; + continue; + } + + o.push(path[i]); + } + + i = base.length - nb; + + // If /a/b/c or / + if (i <= 0) { + outPath = o.reverse().join('/'); + } else { + outPath = base.slice(0, i).join('/') + '/' + o.reverse().join('/'); + } + + // Add front / if it's needed + if (outPath.indexOf('/') !== 0) { + outPath = '/' + outPath; + } + + // Add traling / if it's needed + if (tr && outPath.lastIndexOf('/') !== outPath.length - 1) { + outPath += tr; + } + + return outPath; + }, + + /** + * Returns the full URI of the internal structure. + * + * @method getURI + * @param {Boolean} noProtoHost Optional no host and protocol part. Defaults to false. + */ + getURI: function(noProtoHost) { + var s, self = this; + + // Rebuild source + if (!self.source || noProtoHost) { + s = ''; + + if (!noProtoHost) { + if (self.protocol) { + s += self.protocol + '://'; + } else { + s += '//'; + } + + if (self.userInfo) { + s += self.userInfo + '@'; + } + + if (self.host) { + s += self.host; + } + + if (self.port) { + s += ':' + self.port; + } + } + + if (self.path) { + s += self.path; + } + + if (self.query) { + s += '?' + self.query; + } + + if (self.anchor) { + s += '#' + self.anchor; + } + + self.source = s; + } + + return self.source; + } + }; + + return URI; +}); + +// Included from: js/tinymce/classes/util/Class.js + +/** + * Class.js + * + * Copyright 2003-2012, Moxiecode Systems AB, All rights reserved. + */ + +/** + * This utilitiy class is used for easier inheritage. + * + * Features: + * * Exposed super functions: this._super(); + * * Mixins + * * Dummy functions + * * Property functions: var value = object.value(); and object.value(newValue); + * * Static functions + * * Defaults settings + */ +define("tinymce/util/Class", [ + "tinymce/util/Tools" +], function(Tools) { + var each = Tools.each, extend = Tools.extend; + + var extendClass, initializing; + + function Class() { + } + + // Provides classical inheritance, based on code made by John Resig + Class.extend = extendClass = function(prop) { + var self = this, _super = self.prototype, prototype, name, member; + + // The dummy class constructor + function Class() { + var i, mixins, mixin, self = this; + + // All construction is actually done in the init method + if (!initializing) { + // Run class constuctor + if (self.init) { + self.init.apply(self, arguments); + } + + // Run mixin constructors + mixins = self.Mixins; + if (mixins) { + i = mixins.length; + while (i--) { + mixin = mixins[i]; + if (mixin.init) { + mixin.init.apply(self, arguments); + } + } + } + } + } + + // Dummy function, needs to be extended in order to provide functionality + function dummy() { + return this; + } + + // Creates a overloaded method for the class + // this enables you to use this._super(); to call the super function + function createMethod(name, fn) { + return function() { + var self = this, tmp = self._super, ret; + + self._super = _super[name]; + ret = fn.apply(self, arguments); + self._super = tmp; + + return ret; + }; + } + + // Instantiate a base class (but only create the instance, + // don't run the init constructor) + initializing = true; + + /*eslint new-cap:0 */ + prototype = new self(); + initializing = false; + + // Add mixins + if (prop.Mixins) { + each(prop.Mixins, function(mixin) { + mixin = mixin; + + for (var name in mixin) { + if (name !== "init") { + prop[name] = mixin[name]; + } + } + }); + + if (_super.Mixins) { + prop.Mixins = _super.Mixins.concat(prop.Mixins); + } + } + + // Generate dummy methods + if (prop.Methods) { + each(prop.Methods.split(','), function(name) { + prop[name] = dummy; + }); + } + + // Generate property methods + if (prop.Properties) { + each(prop.Properties.split(','), function(name) { + var fieldName = '_' + name; + + prop[name] = function(value) { + var self = this, undef; + + // Set value + if (value !== undef) { + self[fieldName] = value; + + return self; + } + + // Get value + return self[fieldName]; + }; + }); + } + + // Static functions + if (prop.Statics) { + each(prop.Statics, function(func, name) { + Class[name] = func; + }); + } + + // Default settings + if (prop.Defaults && _super.Defaults) { + prop.Defaults = extend({}, _super.Defaults, prop.Defaults); + } + + // Copy the properties over onto the new prototype + for (name in prop) { + member = prop[name]; + + if (typeof member == "function" && _super[name]) { + prototype[name] = createMethod(name, member); + } else { + prototype[name] = member; + } + } + + // Populate our constructed prototype object + Class.prototype = prototype; + + // Enforce the constructor to be what we expect + Class.constructor = Class; + + // And make this class extendible + Class.extend = extendClass; + + return Class; + }; + + return Class; +}); + +// Included from: js/tinymce/classes/util/EventDispatcher.js + +/** + * EventDispatcher.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class lets you add/remove and fire events by name on the specified scope. This makes + * it easy to add event listener logic to any class. + * + * @class tinymce.util.EventDispatcher + * @example + * var eventDispatcher = new EventDispatcher(); + * + * eventDispatcher.on('click', function() {console.log('data');}); + * eventDispatcher.fire('click', {data: 123}); + */ +define("tinymce/util/EventDispatcher", [ + "tinymce/util/Tools" +], function(Tools) { + var nativeEvents = Tools.makeMap( + "focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange " + + "mouseout mouseenter mouseleave wheel keydown keypress keyup input contextmenu dragstart dragend dragover " + + "draggesture dragdrop drop drag submit " + + "compositionstart compositionend compositionupdate touchstart touchend", + ' ' + ); + + function Dispatcher(settings) { + var self = this, scope, bindings = {}, toggleEvent; + + function returnFalse() { + return false; + } + + function returnTrue() { + return true; + } + + settings = settings || {}; + scope = settings.scope || self; + toggleEvent = settings.toggleEvent || returnFalse; + + /** + * Fires the specified event by name. + * + * @method fire + * @param {String} name Name of the event to fire. + * @param {Object?} args Event arguments. + * @return {Object} Event args instance passed in. + * @example + * instance.fire('event', {...}); + */ + function fire(name, args) { + var handlers, i, l, callback; + + name = name.toLowerCase(); + args = args || {}; + args.type = name; + + // Setup target is there isn't one + if (!args.target) { + args.target = scope; + } + + // Add event delegation methods if they are missing + if (!args.preventDefault) { + // Add preventDefault method + args.preventDefault = function() { + args.isDefaultPrevented = returnTrue; + }; + + // Add stopPropagation + args.stopPropagation = function() { + args.isPropagationStopped = returnTrue; + }; + + // Add stopImmediatePropagation + args.stopImmediatePropagation = function() { + args.isImmediatePropagationStopped = returnTrue; + }; + + // Add event delegation states + args.isDefaultPrevented = returnFalse; + args.isPropagationStopped = returnFalse; + args.isImmediatePropagationStopped = returnFalse; + } + + if (settings.beforeFire) { + settings.beforeFire(args); + } + + handlers = bindings[name]; + if (handlers) { + for (i = 0, l = handlers.length; i < l; i++) { + callback = handlers[i]; + + // Unbind handlers marked with "once" + if (callback.once) { + off(name, callback.func); + } + + // Stop immediate propagation if needed + if (args.isImmediatePropagationStopped()) { + args.stopPropagation(); + return args; + } + + // If callback returns false then prevent default and stop all propagation + if (callback.func.call(scope, args) === false) { + args.preventDefault(); + return args; + } + } + } + + return args; + } + + /** + * Binds an event listener to a specific event by name. + * + * @method on + * @param {String} name Event name or space separated list of events to bind. + * @param {callback} callback Callback to be executed when the event occurs. + * @param {Boolean} first Optional flag if the event should be prepended. Use this with care. + * @return {Object} Current class instance. + * @example + * instance.on('event', function(e) { + * // Callback logic + * }); + */ + function on(name, callback, prepend, extra) { + var handlers, names, i; + + if (callback === false) { + callback = returnFalse; + } + + if (callback) { + callback = { + func: callback + }; + + if (extra) { + Tools.extend(callback, extra); + } + + names = name.toLowerCase().split(' '); + i = names.length; + while (i--) { + name = names[i]; + handlers = bindings[name]; + if (!handlers) { + handlers = bindings[name] = []; + toggleEvent(name, true); + } + + if (prepend) { + handlers.unshift(callback); + } else { + handlers.push(callback); + } + } + } + + return self; + } + + /** + * Unbinds an event listener to a specific event by name. + * + * @method off + * @param {String?} name Name of the event to unbind. + * @param {callback?} callback Callback to unbind. + * @return {Object} Current class instance. + * @example + * // Unbind specific callback + * instance.off('event', handler); + * + * // Unbind all listeners by name + * instance.off('event'); + * + * // Unbind all events + * instance.off(); + */ + function off(name, callback) { + var i, handlers, bindingName, names, hi; + + if (name) { + names = name.toLowerCase().split(' '); + i = names.length; + while (i--) { + name = names[i]; + handlers = bindings[name]; + + // Unbind all handlers + if (!name) { + for (bindingName in bindings) { + toggleEvent(bindingName, false); + delete bindings[bindingName]; + } + + return self; + } + + if (handlers) { + // Unbind all by name + if (!callback) { + handlers.length = 0; + } else { + // Unbind specific ones + hi = handlers.length; + while (hi--) { + if (handlers[hi].func === callback) { + handlers = handlers.slice(0, hi).concat(handlers.slice(hi + 1)); + bindings[name] = handlers; + } + } + } + + if (!handlers.length) { + toggleEvent(name, false); + delete bindings[name]; + } + } + } + } else { + for (name in bindings) { + toggleEvent(name, false); + } + + bindings = {}; + } + + return self; + } + + /** + * Binds an event listener to a specific event by name + * and automatically unbind the event once the callback fires. + * + * @method once + * @param {String} name Event name or space separated list of events to bind. + * @param {callback} callback Callback to be executed when the event occurs. + * @param {Boolean} first Optional flag if the event should be prepended. Use this with care. + * @return {Object} Current class instance. + * @example + * instance.once('event', function(e) { + * // Callback logic + * }); + */ + function once(name, callback, prepend) { + return on(name, callback, prepend, {once: true}); + } + + /** + * Returns true/false if the dispatcher has a event of the specified name. + * + * @method has + * @param {String} name Name of the event to check for. + * @return {Boolean} true/false if the event exists or not. + */ + function has(name) { + name = name.toLowerCase(); + return !(!bindings[name] || bindings[name].length === 0); + } + + // Expose + self.fire = fire; + self.on = on; + self.off = off; + self.once = once; + self.has = has; + } + + /** + * Returns true/false if the specified event name is a native browser event or not. + * + * @method isNative + * @param {String} name Name to check if it's native. + * @return {Boolean} true/false if the event is native or not. + * @static + */ + Dispatcher.isNative = function(name) { + return !!nativeEvents[name.toLowerCase()]; + }; + + return Dispatcher; +}); + +// Included from: js/tinymce/classes/ui/Selector.js + +/** + * Selector.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*eslint no-nested-ternary:0 */ + +/** + * Selector engine, enables you to select controls by using CSS like expressions. + * We currently only support basic CSS expressions to reduce the size of the core + * and the ones we support should be enough for most cases. + * + * @example + * Supported expressions: + * element + * element#name + * element.class + * element[attr] + * element[attr*=value] + * element[attr~=value] + * element[attr!=value] + * element[attr^=value] + * element[attr$=value] + * element: + * element:not() + * element:first + * element:last + * element:odd + * element:even + * element element + * element > element + * + * @class tinymce.ui.Selector + */ +define("tinymce/ui/Selector", [ + "tinymce/util/Class" +], function(Class) { + "use strict"; + + /** + * Produces an array with a unique set of objects. It will not compare the values + * but the references of the objects. + * + * @private + * @method unqiue + * @param {Array} array Array to make into an array with unique items. + * @return {Array} Array with unique items. + */ + function unique(array) { + var uniqueItems = [], i = array.length, item; + + while (i--) { + item = array[i]; + + if (!item.__checked) { + uniqueItems.push(item); + item.__checked = 1; + } + } + + i = uniqueItems.length; + while (i--) { + delete uniqueItems[i].__checked; + } + + return uniqueItems; + } + + var expression = /^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i; + + /*jshint maxlen:255 */ + /*eslint max-len:0 */ + var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, + whiteSpace = /^\s*|\s*$/g, + Collection; + + var Selector = Class.extend({ + /** + * Constructs a new Selector instance. + * + * @constructor + * @method init + * @param {String} selector CSS like selector expression. + */ + init: function(selector) { + var match = this.match; + + function compileNameFilter(name) { + if (name) { + name = name.toLowerCase(); + + return function(item) { + return name === '*' || item.type === name; + }; + } + } + + function compileIdFilter(id) { + if (id) { + return function(item) { + return item._name === id; + }; + } + } + + function compileClassesFilter(classes) { + if (classes) { + classes = classes.split('.'); + + return function(item) { + var i = classes.length; + + while (i--) { + if (!item.hasClass(classes[i])) { + return false; + } + } + + return true; + }; + } + } + + function compileAttrFilter(name, cmp, check) { + if (name) { + return function(item) { + var value = item[name] ? item[name]() : ''; + + return !cmp ? !!check : + cmp === "=" ? value === check : + cmp === "*=" ? value.indexOf(check) >= 0 : + cmp === "~=" ? (" " + value + " ").indexOf(" " + check + " ") >= 0 : + cmp === "!=" ? value != check : + cmp === "^=" ? value.indexOf(check) === 0 : + cmp === "$=" ? value.substr(value.length - check.length) === check : + false; + }; + } + } + + function compilePsuedoFilter(name) { + var notSelectors; + + if (name) { + name = /(?:not\((.+)\))|(.+)/i.exec(name); + + if (!name[1]) { + name = name[2]; + + return function(item, index, length) { + return name === 'first' ? index === 0 : + name === 'last' ? index === length - 1 : + name === 'even' ? index % 2 === 0 : + name === 'odd' ? index % 2 === 1 : + item[name] ? item[name]() : + false; + }; + } else { + // Compile not expression + notSelectors = parseChunks(name[1], []); + + return function(item) { + return !match(item, notSelectors); + }; + } + } + } + + function compile(selector, filters, direct) { + var parts; + + function add(filter) { + if (filter) { + filters.push(filter); + } + } + + // Parse expression into parts + parts = expression.exec(selector.replace(whiteSpace, '')); + + add(compileNameFilter(parts[1])); + add(compileIdFilter(parts[2])); + add(compileClassesFilter(parts[3])); + add(compileAttrFilter(parts[4], parts[5], parts[6])); + add(compilePsuedoFilter(parts[7])); + + // Mark the filter with psuedo for performance + filters.psuedo = !!parts[7]; + filters.direct = direct; + + return filters; + } + + // Parser logic based on Sizzle by John Resig + function parseChunks(selector, selectors) { + var parts = [], extra, matches, i; + + do { + chunker.exec(""); + matches = chunker.exec(selector); + + if (matches) { + selector = matches[3]; + parts.push(matches[1]); + + if (matches[2]) { + extra = matches[3]; + break; + } + } + } while (matches); + + if (extra) { + parseChunks(extra, selectors); + } + + selector = []; + for (i = 0; i < parts.length; i++) { + if (parts[i] != '>') { + selector.push(compile(parts[i], [], parts[i - 1] === '>')); + } + } + + selectors.push(selector); + + return selectors; + } + + this._selectors = parseChunks(selector, []); + }, + + /** + * Returns true/false if the selector matches the specified control. + * + * @method match + * @param {tinymce.ui.Control} control Control to match agains the selector. + * @param {Array} selectors Optional array of selectors, mostly used internally. + * @return {Boolean} true/false state if the control matches or not. + */ + match: function(control, selectors) { + var i, l, si, sl, selector, fi, fl, filters, index, length, siblings, count, item; + + selectors = selectors || this._selectors; + for (i = 0, l = selectors.length; i < l; i++) { + selector = selectors[i]; + sl = selector.length; + item = control; + count = 0; + + for (si = sl - 1; si >= 0; si--) { + filters = selector[si]; + + while (item) { + // Find the index and length since a psuedo filter like :first needs it + if (filters.psuedo) { + siblings = item.parent().items(); + index = length = siblings.length; + while (index--) { + if (siblings[index] === item) { + break; + } + } + } + + for (fi = 0, fl = filters.length; fi < fl; fi++) { + if (!filters[fi](item, index, length)) { + fi = fl + 1; + break; + } + } + + if (fi === fl) { + count++; + break; + } else { + // If it didn't match the right most expression then + // break since it's no point looking at the parents + if (si === sl - 1) { + break; + } + } + + item = item.parent(); + } + } + + // If we found all selectors then return true otherwise continue looking + if (count === sl) { + return true; + } + } + + return false; + }, + + /** + * Returns a tinymce.ui.Collection with matches of the specified selector inside the specified container. + * + * @method find + * @param {tinymce.ui.Control} container Container to look for items in. + * @return {tinymce.ui.Collection} Collection with matched elements. + */ + find: function(container) { + var matches = [], i, l, selectors = this._selectors; + + function collect(items, selector, index) { + var i, l, fi, fl, item, filters = selector[index]; + + for (i = 0, l = items.length; i < l; i++) { + item = items[i]; + + // Run each filter agains the item + for (fi = 0, fl = filters.length; fi < fl; fi++) { + if (!filters[fi](item, i, l)) { + fi = fl + 1; + break; + } + } + + // All filters matched the item + if (fi === fl) { + // Matched item is on the last expression like: panel toolbar [button] + if (index == selector.length - 1) { + matches.push(item); + } else { + // Collect next expression type + if (item.items) { + collect(item.items(), selector, index + 1); + } + } + } else if (filters.direct) { + return; + } + + // Collect child items + if (item.items) { + collect(item.items(), selector, index); + } + } + } + + if (container.items) { + for (i = 0, l = selectors.length; i < l; i++) { + collect(container.items(), selectors[i], 0); + } + + // Unique the matches if needed + if (l > 1) { + matches = unique(matches); + } + } + + // Fix for circular reference + if (!Collection) { + // TODO: Fix me! + Collection = Selector.Collection; + } + + return new Collection(matches); + } + }); + + return Selector; +}); + +// Included from: js/tinymce/classes/ui/Collection.js + +/** + * Collection.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Control collection, this class contains control instances and it enables you to + * perform actions on all the contained items. This is very similar to how jQuery works. + * + * @example + * someCollection.show().disabled(true); + * + * @class tinymce.ui.Collection + */ +define("tinymce/ui/Collection", [ + "tinymce/util/Tools", + "tinymce/ui/Selector", + "tinymce/util/Class" +], function(Tools, Selector, Class) { + "use strict"; + + var Collection, proto, push = Array.prototype.push, slice = Array.prototype.slice; + + proto = { + /** + * Current number of contained control instances. + * + * @field length + * @type Number + */ + length: 0, + + /** + * Constructor for the collection. + * + * @constructor + * @method init + * @param {Array} items Optional array with items to add. + */ + init: function(items) { + if (items) { + this.add(items); + } + }, + + /** + * Adds new items to the control collection. + * + * @method add + * @param {Array} items Array if items to add to collection. + * @return {tinymce.ui.Collection} Current collection instance. + */ + add: function(items) { + var self = this; + + // Force single item into array + if (!Tools.isArray(items)) { + if (items instanceof Collection) { + self.add(items.toArray()); + } else { + push.call(self, items); + } + } else { + push.apply(self, items); + } + + return self; + }, + + /** + * Sets the contents of the collection. This will remove any existing items + * and replace them with the ones specified in the input array. + * + * @method set + * @param {Array} items Array with items to set into the Collection. + * @return {tinymce.ui.Collection} Collection instance. + */ + set: function(items) { + var self = this, len = self.length, i; + + self.length = 0; + self.add(items); + + // Remove old entries + for (i = self.length; i < len; i++) { + delete self[i]; + } + + return self; + }, + + /** + * Filters the collection item based on the specified selector expression or selector function. + * + * @method filter + * @param {String} selector Selector expression to filter items by. + * @return {tinymce.ui.Collection} Collection containing the filtered items. + */ + filter: function(selector) { + var self = this, i, l, matches = [], item, match; + + // Compile string into selector expression + if (typeof selector === "string") { + selector = new Selector(selector); + + match = function(item) { + return selector.match(item); + }; + } else { + // Use selector as matching function + match = selector; + } + + for (i = 0, l = self.length; i < l; i++) { + item = self[i]; + + if (match(item)) { + matches.push(item); + } + } + + return new Collection(matches); + }, + + /** + * Slices the items within the collection. + * + * @method slice + * @param {Number} index Index to slice at. + * @param {Number} len Optional length to slice. + * @return {tinymce.ui.Collection} Current collection. + */ + slice: function() { + return new Collection(slice.apply(this, arguments)); + }, + + /** + * Makes the current collection equal to the specified index. + * + * @method eq + * @param {Number} index Index of the item to set the collection to. + * @return {tinymce.ui.Collection} Current collection. + */ + eq: function(index) { + return index === -1 ? this.slice(index) : this.slice(index, +index + 1); + }, + + /** + * Executes the specified callback on each item in collection. + * + * @method each + * @param {function} callback Callback to execute for each item in collection. + * @return {tinymce.ui.Collection} Current collection instance. + */ + each: function(callback) { + Tools.each(this, callback); + + return this; + }, + + /** + * Returns an JavaScript array object of the contents inside the collection. + * + * @method toArray + * @return {Array} Array with all items from collection. + */ + toArray: function() { + return Tools.toArray(this); + }, + + /** + * Finds the index of the specified control or return -1 if it isn't in the collection. + * + * @method indexOf + * @param {Control} ctrl Control instance to look for. + * @return {Number} Index of the specified control or -1. + */ + indexOf: function(ctrl) { + var self = this, i = self.length; + + while (i--) { + if (self[i] === ctrl) { + break; + } + } + + return i; + }, + + /** + * Returns a new collection of the contents in reverse order. + * + * @method reverse + * @return {tinymce.ui.Collection} Collection instance with reversed items. + */ + reverse: function() { + return new Collection(Tools.toArray(this).reverse()); + }, + + /** + * Returns true/false if the class exists or not. + * + * @method hasClass + * @param {String} cls Class to check for. + * @return {Boolean} true/false state if the class exists or not. + */ + hasClass: function(cls) { + return this[0] ? this[0].hasClass(cls) : false; + }, + + /** + * Sets/gets the specific property on the items in the collection. The same as executing control.(); + * + * @method prop + * @param {String} name Property name to get/set. + * @param {Object} value Optional object value to set. + * @return {tinymce.ui.Collection} Current collection instance or value of the first item on a get operation. + */ + prop: function(name, value) { + var self = this, undef, item; + + if (value !== undef) { + self.each(function(item) { + if (item[name]) { + item[name](value); + } + }); + + return self; + } + + item = self[0]; + + if (item && item[name]) { + return item[name](); + } + }, + + /** + * Executes the specific function name with optional arguments an all items in collection if it exists. + * + * @example collection.exec("myMethod", arg1, arg2, arg3); + * @method exec + * @param {String} name Name of the function to execute. + * @param {Object} ... Multiple arguments to pass to each function. + * @return {tinymce.ui.Collection} Current collection. + */ + exec: function(name) { + var self = this, args = Tools.toArray(arguments).slice(1); + + self.each(function(item) { + if (item[name]) { + item[name].apply(item, args); + } + }); + + return self; + }, + + /** + * Remove all items from collection and DOM. + * + * @method remove + * @return {tinymce.ui.Collection} Current collection. + */ + remove: function() { + var i = this.length; + + while (i--) { + this[i].remove(); + } + + return this; + } + + /** + * Fires the specified event by name and arguments on the control. This will execute all + * bound event handlers. + * + * @method fire + * @param {String} name Name of the event to fire. + * @param {Object} args Optional arguments to pass to the event. + * @return {tinymce.ui.Collection} Current collection instance. + */ + // fire: function(event, args) {}, -- Generated by code below + + /** + * Binds a callback to the specified event. This event can both be + * native browser events like "click" or custom ones like PostRender. + * + * The callback function will have two parameters the first one being the control that received the event + * the second one will be the event object either the browsers native event object or a custom JS object. + * + * @method on + * @param {String} name Name of the event to bind. For example "click". + * @param {String/function} callback Callback function to execute ones the event occurs. + * @return {tinymce.ui.Collection} Current collection instance. + */ + // on: function(name, callback) {}, -- Generated by code below + + /** + * Unbinds the specified event and optionally a specific callback. If you omit the name + * parameter all event handlers will be removed. If you omit the callback all event handles + * by the specified name will be removed. + * + * @method off + * @param {String} name Optional name for the event to unbind. + * @param {function} callback Optional callback function to unbind. + * @return {tinymce.ui.Collection} Current collection instance. + */ + // off: function(name, callback) {}, -- Generated by code below + + /** + * Shows the items in the current collection. + * + * @method show + * @return {tinymce.ui.Collection} Current collection instance. + */ + // show: function() {}, -- Generated by code below + + /** + * Hides the items in the current collection. + * + * @method hide + * @return {tinymce.ui.Collection} Current collection instance. + */ + // hide: function() {}, -- Generated by code below + + /** + * Sets/gets the text contents of the items in the current collection. + * + * @method text + * @return {tinymce.ui.Collection} Current collection instance or text value of the first item on a get operation. + */ + // text: function(value) {}, -- Generated by code below + + /** + * Sets/gets the name contents of the items in the current collection. + * + * @method name + * @return {tinymce.ui.Collection} Current collection instance or name value of the first item on a get operation. + */ + // name: function(value) {}, -- Generated by code below + + /** + * Sets/gets the disabled state on the items in the current collection. + * + * @method disabled + * @return {tinymce.ui.Collection} Current collection instance or disabled state of the first item on a get operation. + */ + // disabled: function(state) {}, -- Generated by code below + + /** + * Sets/gets the active state on the items in the current collection. + * + * @method active + * @return {tinymce.ui.Collection} Current collection instance or active state of the first item on a get operation. + */ + // active: function(state) {}, -- Generated by code below + + /** + * Sets/gets the selected state on the items in the current collection. + * + * @method selected + * @return {tinymce.ui.Collection} Current collection instance or selected state of the first item on a get operation. + */ + // selected: function(state) {}, -- Generated by code below + + /** + * Sets/gets the selected state on the items in the current collection. + * + * @method visible + * @return {tinymce.ui.Collection} Current collection instance or visible state of the first item on a get operation. + */ + // visible: function(state) {}, -- Generated by code below + + /** + * Adds a class to all items in the collection. + * + * @method addClass + * @param {String} cls Class to add to each item. + * @return {tinymce.ui.Collection} Current collection instance. + */ + // addClass: function(cls) {}, -- Generated by code below + + /** + * Removes the specified class from all items in collection. + * + * @method removeClass + * @param {String} cls Class to remove from each item. + * @return {tinymce.ui.Collection} Current collection instance. + */ + // removeClass: function(cls) {}, -- Generated by code below + }; + + // Extend tinymce.ui.Collection prototype with some generated control specific methods + Tools.each('fire on off show hide addClass removeClass append prepend before after reflow'.split(' '), function(name) { + proto[name] = function() { + var args = Tools.toArray(arguments); + + this.each(function(ctrl) { + if (name in ctrl) { + ctrl[name].apply(ctrl, args); + } + }); + + return this; + }; + }); + + // Extend tinymce.ui.Collection prototype with some property methods + Tools.each('text name disabled active selected checked visible parent value data'.split(' '), function(name) { + proto[name] = function(value) { + return this.prop(name, value); + }; + }); + + // Create class based on the new prototype + Collection = Class.extend(proto); + + // Stick Collection into Selector to prevent circual references + Selector.Collection = Collection; + + return Collection; +}); + +// Included from: js/tinymce/classes/ui/DomUtils.js + +/** + * DOMUtils.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +define("tinymce/ui/DomUtils", [ + "tinymce/util/Tools", + "tinymce/dom/DOMUtils" +], function(Tools, DOMUtils) { + "use strict"; + + var count = 0; + + return { + id: function() { + return 'mceu_' + (count++); + }, + + createFragment: function(html) { + return DOMUtils.DOM.createFragment(html); + }, + + getWindowSize: function() { + return DOMUtils.DOM.getViewPort(); + }, + + getSize: function(elm) { + var width, height; + + if (elm.getBoundingClientRect) { + var rect = elm.getBoundingClientRect(); + + width = Math.max(rect.width || (rect.right - rect.left), elm.offsetWidth); + height = Math.max(rect.height || (rect.bottom - rect.bottom), elm.offsetHeight); + } else { + width = elm.offsetWidth; + height = elm.offsetHeight; + } + + return {width: width, height: height}; + }, + + getPos: function(elm, root) { + return DOMUtils.DOM.getPos(elm, root); + }, + + getViewPort: function(win) { + return DOMUtils.DOM.getViewPort(win); + }, + + get: function(id) { + return document.getElementById(id); + }, + + addClass: function(elm, cls) { + return DOMUtils.DOM.addClass(elm, cls); + }, + + removeClass: function(elm, cls) { + return DOMUtils.DOM.removeClass(elm, cls); + }, + + hasClass: function(elm, cls) { + return DOMUtils.DOM.hasClass(elm, cls); + }, + + toggleClass: function(elm, cls, state) { + return DOMUtils.DOM.toggleClass(elm, cls, state); + }, + + css: function(elm, name, value) { + return DOMUtils.DOM.setStyle(elm, name, value); + }, + + getRuntimeStyle: function(elm, name) { + return DOMUtils.DOM.getStyle(elm, name, true); + }, + + on: function(target, name, callback, scope) { + return DOMUtils.DOM.bind(target, name, callback, scope); + }, + + off: function(target, name, callback) { + return DOMUtils.DOM.unbind(target, name, callback); + }, + + fire: function(target, name, args) { + return DOMUtils.DOM.fire(target, name, args); + }, + + innerHtml: function(elm, html) { + // Workaround for
    in

    bug on IE 8 #6178 + DOMUtils.DOM.setHTML(elm, html); + } + }; +}); + +// Included from: js/tinymce/classes/ui/Control.js + +/** + * Control.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*eslint consistent-this:0 */ + +/** + * This is the base class for all controls and containers. All UI control instances inherit + * from this one as it has the base logic needed by all of them. + * + * @class tinymce.ui.Control + */ +define("tinymce/ui/Control", [ + "tinymce/util/Class", + "tinymce/util/Tools", + "tinymce/util/EventDispatcher", + "tinymce/ui/Collection", + "tinymce/ui/DomUtils" +], function(Class, Tools, EventDispatcher, Collection, DomUtils) { + "use strict"; + + var hasMouseWheelEventSupport = "onmousewheel" in document; + var hasWheelEventSupport = false; + var classPrefix = "mce-"; + + function getEventDispatcher(obj) { + if (!obj._eventDispatcher) { + obj._eventDispatcher = new EventDispatcher({ + scope: obj, + toggleEvent: function(name, state) { + if (state && EventDispatcher.isNative(name)) { + if (!obj._nativeEvents) { + obj._nativeEvents = {}; + } + + obj._nativeEvents[name] = true; + + if (obj._rendered) { + obj.bindPendingEvents(); + } + } + } + }); + } + + return obj._eventDispatcher; + } + + var Control = Class.extend({ + Statics: { + classPrefix: classPrefix + }, + + isRtl: function() { + return Control.rtl; + }, + + /** + * Class/id prefix to use for all controls. + * + * @final + * @field {String} classPrefix + */ + classPrefix: classPrefix, + + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {String} style Style CSS properties to add. + * @setting {String} border Border box values example: 1 1 1 1 + * @setting {String} padding Padding box values example: 1 1 1 1 + * @setting {String} margin Margin box values example: 1 1 1 1 + * @setting {Number} minWidth Minimal width for the control. + * @setting {Number} minHeight Minimal height for the control. + * @setting {String} classes Space separated list of classes to add. + * @setting {String} role WAI-ARIA role to use for control. + * @setting {Boolean} hidden Is the control hidden by default. + * @setting {Boolean} disabled Is the control disabled by default. + * @setting {String} name Name of the control instance. + */ + init: function(settings) { + var self = this, classes, i; + + self.settings = settings = Tools.extend({}, self.Defaults, settings); + + // Initial states + self._id = settings.id || DomUtils.id(); + self._text = self._name = ''; + self._width = self._height = 0; + self._aria = {role: settings.role}; + this._elmCache = {}; + + // Setup classes + classes = settings.classes; + if (classes) { + classes = classes.split(' '); + classes.map = {}; + i = classes.length; + while (i--) { + classes.map[classes[i]] = true; + } + } + + self._classes = classes || []; + self.visible(true); + + // Set some properties + Tools.each('title text width height name classes visible disabled active value'.split(' '), function(name) { + var value = settings[name], undef; + + if (value !== undef) { + self[name](value); + } else if (self['_' + name] === undef) { + self['_' + name] = false; + } + }); + + self.on('click', function() { + if (self.disabled()) { + return false; + } + }); + + // TODO: Is this needed duplicate code see above? + if (settings.classes) { + Tools.each(settings.classes.split(' '), function(cls) { + self.addClass(cls); + }); + } + + /** + * Name/value object with settings for the current control. + * + * @field {Object} settings + */ + self.settings = settings; + + self._borderBox = self.parseBox(settings.border); + self._paddingBox = self.parseBox(settings.padding); + self._marginBox = self.parseBox(settings.margin); + + if (settings.hidden) { + self.hide(); + } + }, + + // Will generate getter/setter methods for these properties + Properties: 'parent,title,text,width,height,disabled,active,name,value', + + // Will generate empty dummy functions for these + Methods: 'renderHtml', + + /** + * Returns the root element to render controls into. + * + * @method getContainerElm + * @return {Element} HTML DOM element to render into. + */ + getContainerElm: function() { + return document.body; + }, + + /** + * Returns a control instance for the current DOM element. + * + * @method getParentCtrl + * @param {Element} elm HTML dom element to get parent control from. + * @return {tinymce.ui.Control} Control instance or undefined. + */ + getParentCtrl: function(elm) { + var ctrl, lookup = this.getRoot().controlIdLookup; + + while (elm && lookup) { + ctrl = lookup[elm.id]; + if (ctrl) { + break; + } + + elm = elm.parentNode; + } + + return ctrl; + }, + + /** + * Parses the specified box value. A box value contains 1-4 properties in clockwise order. + * + * @method parseBox + * @param {String/Number} value Box value "0 1 2 3" or "0" etc. + * @return {Object} Object with top/right/bottom/left properties. + * @private + */ + parseBox: function(value) { + var len, radix = 10; + + if (!value) { + return; + } + + if (typeof value === "number") { + value = value || 0; + + return { + top: value, + left: value, + bottom: value, + right: value + }; + } + + value = value.split(' '); + len = value.length; + + if (len === 1) { + value[1] = value[2] = value[3] = value[0]; + } else if (len === 2) { + value[2] = value[0]; + value[3] = value[1]; + } else if (len === 3) { + value[3] = value[1]; + } + + return { + top: parseInt(value[0], radix) || 0, + right: parseInt(value[1], radix) || 0, + bottom: parseInt(value[2], radix) || 0, + left: parseInt(value[3], radix) || 0 + }; + }, + + borderBox: function() { + return this._borderBox; + }, + + paddingBox: function() { + return this._paddingBox; + }, + + marginBox: function() { + return this._marginBox; + }, + + measureBox: function(elm, prefix) { + function getStyle(name) { + var defaultView = document.defaultView; + + if (defaultView) { + // Remove camelcase + name = name.replace(/[A-Z]/g, function(a) { + return '-' + a; + }); + + return defaultView.getComputedStyle(elm, null).getPropertyValue(name); + } + + return elm.currentStyle[name]; + } + + function getSide(name) { + var val = parseFloat(getStyle(name), 10); + + return isNaN(val) ? 0 : val; + } + + return { + top: getSide(prefix + "TopWidth"), + right: getSide(prefix + "RightWidth"), + bottom: getSide(prefix + "BottomWidth"), + left: getSide(prefix + "LeftWidth") + }; + }, + + /** + * Initializes the current controls layout rect. + * This will be executed by the layout managers to determine the + * default minWidth/minHeight etc. + * + * @method initLayoutRect + * @return {Object} Layout rect instance. + */ + initLayoutRect: function() { + var self = this, settings = self.settings, borderBox, layoutRect; + var elm = self.getEl(), width, height, minWidth, minHeight, autoResize; + var startMinWidth, startMinHeight, initialSize; + + // Measure the current element + borderBox = self._borderBox = self._borderBox || self.measureBox(elm, 'border'); + self._paddingBox = self._paddingBox || self.measureBox(elm, 'padding'); + self._marginBox = self._marginBox || self.measureBox(elm, 'margin'); + initialSize = DomUtils.getSize(elm); + + // Setup minWidth/minHeight and width/height + startMinWidth = settings.minWidth; + startMinHeight = settings.minHeight; + minWidth = startMinWidth || initialSize.width; + minHeight = startMinHeight || initialSize.height; + width = settings.width; + height = settings.height; + autoResize = settings.autoResize; + autoResize = typeof autoResize != "undefined" ? autoResize : !width && !height; + + width = width || minWidth; + height = height || minHeight; + + var deltaW = borderBox.left + borderBox.right; + var deltaH = borderBox.top + borderBox.bottom; + + var maxW = settings.maxWidth || 0xFFFF; + var maxH = settings.maxHeight || 0xFFFF; + + // Setup initial layout rect + self._layoutRect = layoutRect = { + x: settings.x || 0, + y: settings.y || 0, + w: width, + h: height, + deltaW: deltaW, + deltaH: deltaH, + contentW: width - deltaW, + contentH: height - deltaH, + innerW: width - deltaW, + innerH: height - deltaH, + startMinWidth: startMinWidth || 0, + startMinHeight: startMinHeight || 0, + minW: Math.min(minWidth, maxW), + minH: Math.min(minHeight, maxH), + maxW: maxW, + maxH: maxH, + autoResize: autoResize, + scrollW: 0 + }; + + self._lastLayoutRect = {}; + + return layoutRect; + }, + + /** + * Getter/setter for the current layout rect. + * + * @method layoutRect + * @param {Object} [newRect] Optional new layout rect. + * @return {tinymce.ui.Control/Object} Current control or rect object. + */ + layoutRect: function(newRect) { + var self = this, curRect = self._layoutRect, lastLayoutRect, size, deltaWidth, deltaHeight, undef, repaintControls; + + // Initialize default layout rect + if (!curRect) { + curRect = self.initLayoutRect(); + } + + // Set new rect values + if (newRect) { + // Calc deltas between inner and outer sizes + deltaWidth = curRect.deltaW; + deltaHeight = curRect.deltaH; + + // Set x position + if (newRect.x !== undef) { + curRect.x = newRect.x; + } + + // Set y position + if (newRect.y !== undef) { + curRect.y = newRect.y; + } + + // Set minW + if (newRect.minW !== undef) { + curRect.minW = newRect.minW; + } + + // Set minH + if (newRect.minH !== undef) { + curRect.minH = newRect.minH; + } + + // Set new width and calculate inner width + size = newRect.w; + if (size !== undef) { + size = size < curRect.minW ? curRect.minW : size; + size = size > curRect.maxW ? curRect.maxW : size; + curRect.w = size; + curRect.innerW = size - deltaWidth; + } + + // Set new height and calculate inner height + size = newRect.h; + if (size !== undef) { + size = size < curRect.minH ? curRect.minH : size; + size = size > curRect.maxH ? curRect.maxH : size; + curRect.h = size; + curRect.innerH = size - deltaHeight; + } + + // Set new inner width and calculate width + size = newRect.innerW; + if (size !== undef) { + size = size < curRect.minW - deltaWidth ? curRect.minW - deltaWidth : size; + size = size > curRect.maxW - deltaWidth ? curRect.maxW - deltaWidth : size; + curRect.innerW = size; + curRect.w = size + deltaWidth; + } + + // Set new height and calculate inner height + size = newRect.innerH; + if (size !== undef) { + size = size < curRect.minH - deltaHeight ? curRect.minH - deltaHeight : size; + size = size > curRect.maxH - deltaHeight ? curRect.maxH - deltaHeight : size; + curRect.innerH = size; + curRect.h = size + deltaHeight; + } + + // Set new contentW + if (newRect.contentW !== undef) { + curRect.contentW = newRect.contentW; + } + + // Set new contentH + if (newRect.contentH !== undef) { + curRect.contentH = newRect.contentH; + } + + // Compare last layout rect with the current one to see if we need to repaint or not + lastLayoutRect = self._lastLayoutRect; + if (lastLayoutRect.x !== curRect.x || lastLayoutRect.y !== curRect.y || + lastLayoutRect.w !== curRect.w || lastLayoutRect.h !== curRect.h) { + repaintControls = Control.repaintControls; + + if (repaintControls) { + if (repaintControls.map && !repaintControls.map[self._id]) { + repaintControls.push(self); + repaintControls.map[self._id] = true; + } + } + + lastLayoutRect.x = curRect.x; + lastLayoutRect.y = curRect.y; + lastLayoutRect.w = curRect.w; + lastLayoutRect.h = curRect.h; + } + + return self; + } + + return curRect; + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this, style, bodyStyle, rect, borderBox, borderW = 0, borderH = 0, lastRepaintRect, round; + + // Use Math.round on all values on IE < 9 + round = !document.createRange ? Math.round : function(value) { + return value; + }; + + style = self.getEl().style; + rect = self._layoutRect; + lastRepaintRect = self._lastRepaintRect || {}; + + borderBox = self._borderBox; + borderW = borderBox.left + borderBox.right; + borderH = borderBox.top + borderBox.bottom; + + if (rect.x !== lastRepaintRect.x) { + style.left = round(rect.x) + 'px'; + lastRepaintRect.x = rect.x; + } + + if (rect.y !== lastRepaintRect.y) { + style.top = round(rect.y) + 'px'; + lastRepaintRect.y = rect.y; + } + + if (rect.w !== lastRepaintRect.w) { + style.width = round(rect.w - borderW) + 'px'; + lastRepaintRect.w = rect.w; + } + + if (rect.h !== lastRepaintRect.h) { + style.height = round(rect.h - borderH) + 'px'; + lastRepaintRect.h = rect.h; + } + + // Update body if needed + if (self._hasBody && rect.innerW !== lastRepaintRect.innerW) { + bodyStyle = self.getEl('body').style; + bodyStyle.width = round(rect.innerW) + 'px'; + lastRepaintRect.innerW = rect.innerW; + } + + if (self._hasBody && rect.innerH !== lastRepaintRect.innerH) { + bodyStyle = bodyStyle || self.getEl('body').style; + bodyStyle.height = round(rect.innerH) + 'px'; + lastRepaintRect.innerH = rect.innerH; + } + + self._lastRepaintRect = lastRepaintRect; + self.fire('repaint', {}, false); + }, + + /** + * Binds a callback to the specified event. This event can both be + * native browser events like "click" or custom ones like PostRender. + * + * The callback function will be passed a DOM event like object that enables yout do stop propagation. + * + * @method on + * @param {String} name Name of the event to bind. For example "click". + * @param {String/function} callback Callback function to execute ones the event occurs. + * @return {tinymce.ui.Control} Current control object. + */ + on: function(name, callback) { + var self = this; + + function resolveCallbackName(name) { + var callback, scope; + + if (typeof name != 'string') { + return name; + } + + return function(e) { + if (!callback) { + self.parentsAndSelf().each(function(ctrl) { + var callbacks = ctrl.settings.callbacks; + + if (callbacks && (callback = callbacks[name])) { + scope = ctrl; + return false; + } + }); + } + + return callback.call(scope, e); + }; + } + + getEventDispatcher(self).on(name, resolveCallbackName(callback)); + + return self; + }, + + /** + * Unbinds the specified event and optionally a specific callback. If you omit the name + * parameter all event handlers will be removed. If you omit the callback all event handles + * by the specified name will be removed. + * + * @method off + * @param {String} [name] Name for the event to unbind. + * @param {function} [callback] Callback function to unbind. + * @return {mxex.ui.Control} Current control object. + */ + off: function(name, callback) { + getEventDispatcher(this).off(name, callback); + return this; + }, + + /** + * Fires the specified event by name and arguments on the control. This will execute all + * bound event handlers. + * + * @method fire + * @param {String} name Name of the event to fire. + * @param {Object} [args] Arguments to pass to the event. + * @param {Boolean} [bubble] Value to control bubbeling. Defaults to true. + * @return {Object} Current arguments object. + */ + fire: function(name, args, bubble) { + var self = this; + + args = args || {}; + + if (!args.control) { + args.control = self; + } + + args = getEventDispatcher(self).fire(name, args); + + // Bubble event up to parents + if (bubble !== false && self.parent) { + var parent = self.parent(); + while (parent && !args.isPropagationStopped()) { + parent.fire(name, args, false); + parent = parent.parent(); + } + } + + return args; + }, + + /** + * Returns true/false if the specified event has any listeners. + * + * @method hasEventListeners + * @param {String} name Name of the event to check for. + * @return {Boolean} True/false state if the event has listeners. + */ + hasEventListeners: function(name) { + return getEventDispatcher(this).has(name); + }, + + /** + * Returns a control collection with all parent controls. + * + * @method parents + * @param {String} selector Optional selector expression to find parents. + * @return {tinymce.ui.Collection} Collection with all parent controls. + */ + parents: function(selector) { + var self = this, ctrl, parents = new Collection(); + + // Add each parent to collection + for (ctrl = self.parent(); ctrl; ctrl = ctrl.parent()) { + parents.add(ctrl); + } + + // Filter away everything that doesn't match the selector + if (selector) { + parents = parents.filter(selector); + } + + return parents; + }, + + /** + * Returns the current control and it's parents. + * + * @method parentsAndSelf + * @param {String} selector Optional selector expression to find parents. + * @return {tinymce.ui.Collection} Collection with all parent controls. + */ + parentsAndSelf: function(selector) { + return new Collection(this).add(this.parents(selector)); + }, + + /** + * Returns the control next to the current control. + * + * @method next + * @return {tinymce.ui.Control} Next control instance. + */ + next: function() { + var parentControls = this.parent().items(); + + return parentControls[parentControls.indexOf(this) + 1]; + }, + + /** + * Returns the control previous to the current control. + * + * @method prev + * @return {tinymce.ui.Control} Previous control instance. + */ + prev: function() { + var parentControls = this.parent().items(); + + return parentControls[parentControls.indexOf(this) - 1]; + }, + + /** + * Find the common ancestor for two control instances. + * + * @method findCommonAncestor + * @param {tinymce.ui.Control} ctrl1 First control. + * @param {tinymce.ui.Control} ctrl2 Second control. + * @return {tinymce.ui.Control} Ancestor control instance. + */ + findCommonAncestor: function(ctrl1, ctrl2) { + var parentCtrl; + + while (ctrl1) { + parentCtrl = ctrl2; + + while (parentCtrl && ctrl1 != parentCtrl) { + parentCtrl = parentCtrl.parent(); + } + + if (ctrl1 == parentCtrl) { + break; + } + + ctrl1 = ctrl1.parent(); + } + + return ctrl1; + }, + + /** + * Returns true/false if the specific control has the specific class. + * + * @method hasClass + * @param {String} cls Class to check for. + * @param {String} [group] Sub element group name. + * @return {Boolean} True/false if the control has the specified class. + */ + hasClass: function(cls, group) { + var classes = this._classes[group || 'control']; + + cls = this.classPrefix + cls; + + return classes && !!classes.map[cls]; + }, + + /** + * Adds the specified class to the control + * + * @method addClass + * @param {String} cls Class to check for. + * @param {String} [group] Sub element group name. + * @return {tinymce.ui.Control} Current control object. + */ + addClass: function(cls, group) { + var self = this, classes, elm; + + cls = this.classPrefix + cls; + classes = self._classes[group || 'control']; + + if (!classes) { + classes = []; + classes.map = {}; + self._classes[group || 'control'] = classes; + } + + if (!classes.map[cls]) { + classes.map[cls] = cls; + classes.push(cls); + + if (self._rendered) { + elm = self.getEl(group); + + if (elm) { + elm.className = classes.join(' '); + } + } + } + + return self; + }, + + /** + * Removes the specified class from the control. + * + * @method removeClass + * @param {String} cls Class to remove. + * @param {String} [group] Sub element group name. + * @return {tinymce.ui.Control} Current control object. + */ + removeClass: function(cls, group) { + var self = this, classes, i, elm; + + cls = this.classPrefix + cls; + classes = self._classes[group || 'control']; + if (classes && classes.map[cls]) { + delete classes.map[cls]; + + i = classes.length; + while (i--) { + if (classes[i] === cls) { + classes.splice(i, 1); + } + } + } + + if (self._rendered) { + elm = self.getEl(group); + + if (elm) { + elm.className = classes.join(' '); + } + } + + return self; + }, + + /** + * Toggles the specified class on the control. + * + * @method toggleClass + * @param {String} cls Class to remove. + * @param {Boolean} state True/false state to add/remove class. + * @param {String} [group] Sub element group name. + * @return {tinymce.ui.Control} Current control object. + */ + toggleClass: function(cls, state, group) { + var self = this; + + if (state) { + self.addClass(cls, group); + } else { + self.removeClass(cls, group); + } + + return self; + }, + + /** + * Returns the class string for the specified group name. + * + * @method classes + * @param {String} [group] Group to get clases by. + * @return {String} Classes for the specified group. + */ + classes: function(group) { + var classes = this._classes[group || 'control']; + + return classes ? classes.join(' ') : ''; + }, + + /** + * Sets the inner HTML of the control element. + * + * @method innerHtml + * @param {String} html Html string to set as inner html. + * @return {tinymce.ui.Control} Current control object. + */ + innerHtml: function(html) { + DomUtils.innerHtml(this.getEl(), html); + return this; + }, + + /** + * Returns the control DOM element or sub element. + * + * @method getEl + * @param {String} [suffix] Suffix to get element by. + * @return {Element} HTML DOM element for the current control or it's children. + */ + getEl: function(suffix) { + var id = suffix ? this._id + '-' + suffix : this._id; + + if (!this._elmCache[id]) { + this._elmCache[id] = DomUtils.get(id); + } + + return this._elmCache[id]; + }, + + /** + * Sets/gets the visible for the control. + * + * @method visible + * @param {Boolean} state Value to set to control. + * @return {Boolean/tinymce.ui.Control} Current control on a set operation or current state on a get. + */ + visible: function(state) { + var self = this, parentCtrl; + + if (typeof state !== "undefined") { + if (self._visible !== state) { + if (self._rendered) { + self.getEl().style.display = state ? '' : 'none'; + } + + self._visible = state; + + // Parent container needs to reflow + parentCtrl = self.parent(); + if (parentCtrl) { + parentCtrl._lastRect = null; + } + + self.fire(state ? 'show' : 'hide'); + } + + return self; + } + + return self._visible; + }, + + /** + * Sets the visible state to true. + * + * @method show + * @return {tinymce.ui.Control} Current control instance. + */ + show: function() { + return this.visible(true); + }, + + /** + * Sets the visible state to false. + * + * @method hide + * @return {tinymce.ui.Control} Current control instance. + */ + hide: function() { + return this.visible(false); + }, + + /** + * Focuses the current control. + * + * @method focus + * @return {tinymce.ui.Control} Current control instance. + */ + focus: function() { + try { + this.getEl().focus(); + } catch (ex) { + // Ignore IE error + } + + return this; + }, + + /** + * Blurs the current control. + * + * @method blur + * @return {tinymce.ui.Control} Current control instance. + */ + blur: function() { + this.getEl().blur(); + + return this; + }, + + /** + * Sets the specified aria property. + * + * @method aria + * @param {String} name Name of the aria property to set. + * @param {String} value Value of the aria property. + * @return {tinymce.ui.Control} Current control instance. + */ + aria: function(name, value) { + var self = this, elm = self.getEl(self.ariaTarget); + + if (typeof value === "undefined") { + return self._aria[name]; + } else { + self._aria[name] = value; + } + + if (self._rendered) { + elm.setAttribute(name == 'role' ? name : 'aria-' + name, value); + } + + return self; + }, + + /** + * Encodes the specified string with HTML entities. It will also + * translate the string to different languages. + * + * @method encode + * @param {String/Object/Array} text Text to entity encode. + * @param {Boolean} [translate=true] False if the contents shouldn't be translated. + * @return {String} Encoded and possible traslated string. + */ + encode: function(text, translate) { + if (translate !== false) { + text = this.translate(text); + } + + return (text || '').replace(/[&<>"]/g, function(match) { + return '&#' + match.charCodeAt(0) + ';'; + }); + }, + + /** + * Returns the translated string. + * + * @method translate + * @param {String} text Text to translate. + * @return {String} Translated string or the same as the input. + */ + translate: function(text) { + return Control.translate ? Control.translate(text) : text; + }, + + /** + * Adds items before the current control. + * + * @method before + * @param {Array/tinymce.ui.Collection} items Array of items to prepend before this control. + * @return {tinymce.ui.Control} Current control instance. + */ + before: function(items) { + var self = this, parent = self.parent(); + + if (parent) { + parent.insert(items, parent.items().indexOf(self), true); + } + + return self; + }, + + /** + * Adds items after the current control. + * + * @method after + * @param {Array/tinymce.ui.Collection} items Array of items to append after this control. + * @return {tinymce.ui.Control} Current control instance. + */ + after: function(items) { + var self = this, parent = self.parent(); + + if (parent) { + parent.insert(items, parent.items().indexOf(self)); + } + + return self; + }, + + /** + * Removes the current control from DOM and from UI collections. + * + * @method remove + * @return {tinymce.ui.Control} Current control instance. + */ + remove: function() { + var self = this, elm = self.getEl(), parent = self.parent(), newItems, i; + + if (self.items) { + var controls = self.items().toArray(); + i = controls.length; + while (i--) { + controls[i].remove(); + } + } + + if (parent && parent.items) { + newItems = []; + + parent.items().each(function(item) { + if (item !== self) { + newItems.push(item); + } + }); + + parent.items().set(newItems); + parent._lastRect = null; + } + + if (self._eventsRoot && self._eventsRoot == self) { + DomUtils.off(elm); + } + + var lookup = self.getRoot().controlIdLookup; + if (lookup) { + delete lookup[self._id]; + } + + if (elm && elm.parentNode) { + elm.parentNode.removeChild(elm); + } + + self._rendered = false; + + return self; + }, + + /** + * Renders the control before the specified element. + * + * @method renderBefore + * @param {Element} elm Element to render before. + * @return {tinymce.ui.Control} Current control instance. + */ + renderBefore: function(elm) { + var self = this; + + elm.parentNode.insertBefore(DomUtils.createFragment(self.renderHtml()), elm); + self.postRender(); + + return self; + }, + + /** + * Renders the control to the specified element. + * + * @method renderBefore + * @param {Element} elm Element to render to. + * @return {tinymce.ui.Control} Current control instance. + */ + renderTo: function(elm) { + var self = this; + + elm = elm || self.getContainerElm(); + elm.appendChild(DomUtils.createFragment(self.renderHtml())); + self.postRender(); + + return self; + }, + + /** + * Post render method. Called after the control has been rendered to the target. + * + * @method postRender + * @return {tinymce.ui.Control} Current control instance. + */ + postRender: function() { + var self = this, settings = self.settings, elm, box, parent, name, parentEventsRoot; + + // Bind on settings + for (name in settings) { + if (name.indexOf("on") === 0) { + self.on(name.substr(2), settings[name]); + } + } + + if (self._eventsRoot) { + for (parent = self.parent(); !parentEventsRoot && parent; parent = parent.parent()) { + parentEventsRoot = parent._eventsRoot; + } + + if (parentEventsRoot) { + for (name in parentEventsRoot._nativeEvents) { + self._nativeEvents[name] = true; + } + } + } + + self.bindPendingEvents(); + + if (settings.style) { + elm = self.getEl(); + if (elm) { + elm.setAttribute('style', settings.style); + elm.style.cssText = settings.style; + } + } + + if (!self._visible) { + DomUtils.css(self.getEl(), 'display', 'none'); + } + + if (self.settings.border) { + box = self.borderBox(); + DomUtils.css(self.getEl(), { + 'border-top-width': box.top, + 'border-right-width': box.right, + 'border-bottom-width': box.bottom, + 'border-left-width': box.left + }); + } + + // Add instance to lookup + var root = self.getRoot(); + if (!root.controlIdLookup) { + root.controlIdLookup = {}; + } + + root.controlIdLookup[self._id] = self; + + for (var key in self._aria) { + self.aria(key, self._aria[key]); + } + + self.fire('postrender', {}, false); + }, + + /** + * Scrolls the current control into view. + * + * @method scrollIntoView + * @param {String} align Alignment in view top|center|bottom. + * @return {tinymce.ui.Control} Current control instance. + */ + scrollIntoView: function(align) { + function getOffset(elm, rootElm) { + var x, y, parent = elm; + + x = y = 0; + while (parent && parent != rootElm && parent.nodeType) { + x += parent.offsetLeft || 0; + y += parent.offsetTop || 0; + parent = parent.offsetParent; + } + + return {x: x, y: y}; + } + + var elm = this.getEl(), parentElm = elm.parentNode; + var x, y, width, height, parentWidth, parentHeight; + var pos = getOffset(elm, parentElm); + + x = pos.x; + y = pos.y; + width = elm.offsetWidth; + height = elm.offsetHeight; + parentWidth = parentElm.clientWidth; + parentHeight = parentElm.clientHeight; + + if (align == "end") { + x -= parentWidth - width; + y -= parentHeight - height; + } else if (align == "center") { + x -= (parentWidth / 2) - (width / 2); + y -= (parentHeight / 2) - (height / 2); + } + + parentElm.scrollLeft = x; + parentElm.scrollTop = y; + + return this; + }, + + /** + * Binds pending DOM events. + * + * @private + */ + bindPendingEvents: function() { + var self = this, i, l, parents, eventRootCtrl, nativeEvents, name; + + function delegate(e) { + var control = self.getParentCtrl(e.target); + + if (control) { + control.fire(e.type, e); + } + } + + function mouseLeaveHandler() { + var ctrl = eventRootCtrl._lastHoverCtrl; + + if (ctrl) { + ctrl.fire("mouseleave", {target: ctrl.getEl()}); + + ctrl.parents().each(function(ctrl) { + ctrl.fire("mouseleave", {target: ctrl.getEl()}); + }); + + eventRootCtrl._lastHoverCtrl = null; + } + } + + function mouseEnterHandler(e) { + var ctrl = self.getParentCtrl(e.target), lastCtrl = eventRootCtrl._lastHoverCtrl, idx = 0, i, parents, lastParents; + + // Over on a new control + if (ctrl !== lastCtrl) { + eventRootCtrl._lastHoverCtrl = ctrl; + + parents = ctrl.parents().toArray().reverse(); + parents.push(ctrl); + + if (lastCtrl) { + lastParents = lastCtrl.parents().toArray().reverse(); + lastParents.push(lastCtrl); + + for (idx = 0; idx < lastParents.length; idx++) { + if (parents[idx] !== lastParents[idx]) { + break; + } + } + + for (i = lastParents.length - 1; i >= idx; i--) { + lastCtrl = lastParents[i]; + lastCtrl.fire("mouseleave", { + target: lastCtrl.getEl() + }); + } + } + + for (i = idx; i < parents.length; i++) { + ctrl = parents[i]; + ctrl.fire("mouseenter", { + target: ctrl.getEl() + }); + } + } + } + + function fixWheelEvent(e) { + e.preventDefault(); + + if (e.type == "mousewheel") { + e.deltaY = -1 / 40 * e.wheelDelta; + + if (e.wheelDeltaX) { + e.deltaX = -1 / 40 * e.wheelDeltaX; + } + } else { + e.deltaX = 0; + e.deltaY = e.detail; + } + + e = self.fire("wheel", e); + } + + self._rendered = true; + + nativeEvents = self._nativeEvents; + if (nativeEvents) { + // Find event root element if it exists + parents = self.parents().toArray(); + parents.unshift(self); + for (i = 0, l = parents.length; !eventRootCtrl && i < l; i++) { + eventRootCtrl = parents[i]._eventsRoot; + } + + // Event root wasn't found the use the root control + if (!eventRootCtrl) { + eventRootCtrl = parents[parents.length - 1] || self; + } + + // Set the eventsRoot property on children that didn't have it + self._eventsRoot = eventRootCtrl; + for (l = i, i = 0; i < l; i++) { + parents[i]._eventsRoot = eventRootCtrl; + } + + var eventRootDelegates = eventRootCtrl._delegates; + if (!eventRootDelegates) { + eventRootDelegates = eventRootCtrl._delegates = {}; + } + + // Bind native event delegates + for (name in nativeEvents) { + if (!nativeEvents) { + return false; + } + + if (name === "wheel" && !hasWheelEventSupport) { + if (hasMouseWheelEventSupport) { + DomUtils.on(self.getEl(), "mousewheel", fixWheelEvent); + } else { + DomUtils.on(self.getEl(), "DOMMouseScroll", fixWheelEvent); + } + + continue; + } + + // Special treatment for mousenter/mouseleave since these doesn't bubble + if (name === "mouseenter" || name === "mouseleave") { + // Fake mousenter/mouseleave + if (!eventRootCtrl._hasMouseEnter) { + DomUtils.on(eventRootCtrl.getEl(), "mouseleave", mouseLeaveHandler); + DomUtils.on(eventRootCtrl.getEl(), "mouseover", mouseEnterHandler); + eventRootCtrl._hasMouseEnter = 1; + } + } else if (!eventRootDelegates[name]) { + DomUtils.on(eventRootCtrl.getEl(), name, delegate); + eventRootDelegates[name] = true; + } + + // Remove the event once it's bound + nativeEvents[name] = false; + } + } + }, + + getRoot: function() { + var ctrl = this, rootControl, parents = []; + + while (ctrl) { + if (ctrl.rootControl) { + rootControl = ctrl.rootControl; + break; + } + + parents.push(ctrl); + rootControl = ctrl; + ctrl = ctrl.parent(); + } + + if (!rootControl) { + rootControl = this; + } + + var i = parents.length; + while (i--) { + parents[i].rootControl = rootControl; + } + + return rootControl; + }, + + /** + * Reflows the current control and it's parents. + * This should be used after you for example append children to the current control so + * that the layout managers know that they need to reposition everything. + * + * @example + * container.append({type: 'button', text: 'My button'}).reflow(); + * + * @method reflow + * @return {tinymce.ui.Control} Current control instance. + */ + reflow: function() { + this.repaint(); + + return this; + } + + /** + * Sets/gets the parent container for the control. + * + * @method parent + * @param {tinymce.ui.Container} parent Optional parent to set. + * @return {tinymce.ui.Control} Parent control or the current control on a set action. + */ + // parent: function(parent) {} -- Generated + + /** + * Sets/gets the text for the control. + * + * @method text + * @param {String} value Value to set to control. + * @return {String/tinymce.ui.Control} Current control on a set operation or current value on a get. + */ + // text: function(value) {} -- Generated + + /** + * Sets/gets the width for the control. + * + * @method width + * @param {Number} value Value to set to control. + * @return {Number/tinymce.ui.Control} Current control on a set operation or current value on a get. + */ + // width: function(value) {} -- Generated + + /** + * Sets/gets the height for the control. + * + * @method height + * @param {Number} value Value to set to control. + * @return {Number/tinymce.ui.Control} Current control on a set operation or current value on a get. + */ + // height: function(value) {} -- Generated + + /** + * Sets/gets the disabled state on the control. + * + * @method disabled + * @param {Boolean} state Value to set to control. + * @return {Boolean/tinymce.ui.Control} Current control on a set operation or current state on a get. + */ + // disabled: function(state) {} -- Generated + + /** + * Sets/gets the active for the control. + * + * @method active + * @param {Boolean} state Value to set to control. + * @return {Boolean/tinymce.ui.Control} Current control on a set operation or current state on a get. + */ + // active: function(state) {} -- Generated + + /** + * Sets/gets the name for the control. + * + * @method name + * @param {String} value Value to set to control. + * @return {String/tinymce.ui.Control} Current control on a set operation or current value on a get. + */ + // name: function(value) {} -- Generated + + /** + * Sets/gets the title for the control. + * + * @method title + * @param {String} value Value to set to control. + * @return {String/tinymce.ui.Control} Current control on a set operation or current value on a get. + */ + // title: function(value) {} -- Generated + }); + + return Control; +}); + +// Included from: js/tinymce/classes/ui/Factory.js + +/** + * Factory.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +/** + * This class is a factory for control instances. This enables you + * to create instances of controls without having to require the UI controls directly. + * + * It also allow you to override or add new control types. + * + * @class tinymce.ui.Factory + */ +define("tinymce/ui/Factory", [], function() { + "use strict"; + + var types = {}, namespaceInit; + + return { + /** + * Adds a new control instance type to the factory. + * + * @method add + * @param {String} type Type name for example "button". + * @param {function} typeClass Class type function. + */ + add: function(type, typeClass) { + types[type.toLowerCase()] = typeClass; + }, + + /** + * Returns true/false if the specified type exists or not. + * + * @method has + * @param {String} type Type to look for. + * @return {Boolean} true/false if the control by name exists. + */ + has: function(type) { + return !!types[type.toLowerCase()]; + }, + + /** + * Creates a new control instance based on the settings provided. The instance created will be + * based on the specified type property it can also create whole structures of components out of + * the specified JSON object. + * + * @example + * tinymce.ui.Factory.create({ + * type: 'button', + * text: 'Hello world!' + * }); + * + * @method create + * @param {Object/String} settings Name/Value object with items used to create the type. + * @return {tinymce.ui.Control} Control instance based on the specified type. + */ + create: function(type, settings) { + var ControlType, name, namespace; + + // Build type lookup + if (!namespaceInit) { + namespace = tinymce.ui; + + for (name in namespace) { + types[name.toLowerCase()] = namespace[name]; + } + + namespaceInit = true; + } + + // If string is specified then use it as the type + if (typeof type == 'string') { + settings = settings || {}; + settings.type = type; + } else { + settings = type; + type = settings.type; + } + + // Find control type + type = type.toLowerCase(); + ControlType = types[type]; + + // #if debug + + if (!ControlType) { + throw new Error("Could not find control by type: " + type); + } + + // #endif + + ControlType = new ControlType(settings); + ControlType.type = type; // Set the type on the instance, this will be used by the Selector engine + + return ControlType; + } + }; +}); + +// Included from: js/tinymce/classes/ui/KeyboardNavigation.js + +/** + * KeyboardNavigation.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles keyboard navigation of controls and elements. + * + * @class tinymce.ui.KeyboardNavigation + */ +define("tinymce/ui/KeyboardNavigation", [ +], function() { + "use strict"; + + /** + * This class handles all keyboard navigation for WAI-ARIA support. Each root container + * gets an instance of this class. + * + * @constructor + */ + return function(settings) { + var root = settings.root, focusedElement, focusedControl; + + try { + focusedElement = document.activeElement; + } catch (ex) { + // IE sometimes fails to return a proper element + focusedElement = document.body; + } + + focusedControl = root.getParentCtrl(focusedElement); + + /** + * Returns the currently focused elements wai aria role of the currently + * focused element or specified element. + * + * @private + * @param {Element} elm Optional element to get role from. + * @return {String} Role of specified element. + */ + function getRole(elm) { + elm = elm || focusedElement; + + return elm && elm.getAttribute('role'); + } + + /** + * Returns the wai role of the parent element of the currently + * focused element or specified element. + * + * @private + * @param {Element} elm Optional element to get parent role from. + * @return {String} Role of the first parent that has a role. + */ + function getParentRole(elm) { + var role, parent = elm || focusedElement; + + while ((parent = parent.parentNode)) { + if ((role = getRole(parent))) { + return role; + } + } + } + + /** + * Returns a wai aria property by name for example aria-selected. + * + * @private + * @param {String} name Name of the aria property to get for example "disabled". + * @return {String} Aria property value. + */ + function getAriaProp(name) { + var elm = focusedElement; + + if (elm) { + return elm.getAttribute('aria-' + name); + } + } + + /** + * Is the element a text input element or not. + * + * @private + * @param {Element} elm Element to check if it's an text input element or not. + * @return {Boolean} True/false if the element is a text element or not. + */ + function isTextInputElement(elm) { + var tagName = elm.tagName.toUpperCase(); + + // Notice: since type can be "email" etc we don't check the type + // So all input elements gets treated as text input elements + return tagName == "INPUT" || tagName == "TEXTAREA"; + } + + /** + * Returns true/false if the specified element can be focused or not. + * + * @private + * @param {Element} elm DOM element to check if it can be focused or not. + * @return {Boolean} True/false if the element can have focus. + */ + function canFocus(elm) { + if (isTextInputElement(elm) && !elm.hidden) { + return true; + } + + if (/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell)$/.test(getRole(elm))) { + return true; + } + + return false; + } + + /** + * Returns an array of focusable visible elements within the specified container element. + * + * @private + * @param {Element} elm DOM element to find focusable elements within. + * @return {Array} Array of focusable elements. + */ + function getFocusElements(elm) { + var elements = []; + + function collect(elm) { + if (elm.nodeType != 1 || elm.style.display == 'none') { + return; + } + + if (canFocus(elm)) { + elements.push(elm); + } + + for (var i = 0; i < elm.childNodes.length; i++) { + collect(elm.childNodes[i]); + } + } + + collect(elm || root.getEl()); + + return elements; + } + + /** + * Returns the navigation root control for the specified control. The navigation root + * is the control that the keyboard navigation gets scoped to for example a menubar or toolbar group. + * It will look for parents of the specified target control or the currently focused control if this option is omitted. + * + * @private + * @param {tinymce.ui.Control} targetControl Optional target control to find root of. + * @return {tinymce.ui.Control} Navigation root control. + */ + function getNavigationRoot(targetControl) { + var navigationRoot, controls; + + targetControl = targetControl || focusedControl; + controls = targetControl.parents().toArray(); + controls.unshift(targetControl); + + for (var i = 0; i < controls.length; i++) { + navigationRoot = controls[i]; + + if (navigationRoot.settings.ariaRoot) { + break; + } + } + + return navigationRoot; + } + + /** + * Focuses the first item in the specified targetControl element or the last aria index if the + * navigation root has the ariaRemember option enabled. + * + * @private + * @param {tinymce.ui.Control} targetControl Target control to focus the first item in. + */ + function focusFirst(targetControl) { + var navigationRoot = getNavigationRoot(targetControl); + var focusElements = getFocusElements(navigationRoot.getEl()); + + if (navigationRoot.settings.ariaRemember && "lastAriaIndex" in navigationRoot) { + moveFocusToIndex(navigationRoot.lastAriaIndex, focusElements); + } else { + moveFocusToIndex(0, focusElements); + } + } + + /** + * Moves the focus to the specified index within the elements list. + * This will scope the index to the size of the element list if it changed. + * + * @private + * @param {Number} idx Specified index to move to. + * @param {Array} elements Array with dom elements to move focus within. + * @return {Number} Input index or a changed index if it was out of range. + */ + function moveFocusToIndex(idx, elements) { + if (idx < 0) { + idx = elements.length - 1; + } else if (idx >= elements.length) { + idx = 0; + } + + if (elements[idx]) { + elements[idx].focus(); + } + + return idx; + } + + /** + * Moves the focus forwards or backwards. + * + * @private + * @param {Number} dir Direction to move in positive means forward, negative means backwards. + * @param {Array} elements Optional array of elements to move within defaults to the current navigation roots elements. + */ + function moveFocus(dir, elements) { + var idx = -1, navigationRoot = getNavigationRoot(); + + elements = elements || getFocusElements(navigationRoot.getEl()); + + for (var i = 0; i < elements.length; i++) { + if (elements[i] === focusedElement) { + idx = i; + } + } + + idx += dir; + navigationRoot.lastAriaIndex = moveFocusToIndex(idx, elements); + } + + /** + * Moves the focus to the left this is called by the left key. + * + * @private + */ + function left() { + var parentRole = getParentRole(); + + if (parentRole == "tablist") { + moveFocus(-1, getFocusElements(focusedElement.parentNode)); + } else if (focusedControl.parent().submenu) { + cancel(); + } else { + moveFocus(-1); + } + } + + /** + * Moves the focus to the right this is called by the right key. + * + * @private + */ + function right() { + var role = getRole(), parentRole = getParentRole(); + + if (parentRole == "tablist") { + moveFocus(1, getFocusElements(focusedElement.parentNode)); + } else if (role == "menuitem" && parentRole == "menu" && getAriaProp('haspopup')) { + enter(); + } else { + moveFocus(1); + } + } + + /** + * Moves the focus to the up this is called by the up key. + * + * @private + */ + function up() { + moveFocus(-1); + } + + /** + * Moves the focus to the up this is called by the down key. + * + * @private + */ + function down() { + var role = getRole(), parentRole = getParentRole(); + + if (role == "menuitem" && parentRole == "menubar") { + enter(); + } else if (role == "button" && getAriaProp('haspopup')) { + enter({key: 'down'}); + } else { + moveFocus(1); + } + } + + /** + * Moves the focus to the next item or previous item depending on shift key. + * + * @private + * @param {DOMEvent} e DOM event object. + */ + function tab(e) { + var parentRole = getParentRole(); + + if (parentRole == "tablist") { + var elm = getFocusElements(focusedControl.getEl('body'))[0]; + + if (elm) { + elm.focus(); + } + } else { + moveFocus(e.shiftKey ? -1 : 1); + } + } + + /** + * Calls the cancel event on the currently focused control. This is normally done using the Esc key. + * + * @private + */ + function cancel() { + focusedControl.fire('cancel'); + } + + /** + * Calls the click event on the currently focused control. This is normally done using the Enter/Space keys. + * + * @private + * @param {Object} aria Optional aria data to pass along with the enter event. + */ + function enter(aria) { + aria = aria || {}; + focusedControl.fire('click', {target: focusedElement, aria: aria}); + } + + root.on('keydown', function(e) { + function handleNonTabOrEscEvent(e, handler) { + // Ignore non tab keys for text elements + if (isTextInputElement(focusedElement)) { + return; + } + + if (handler(e) !== false) { + e.preventDefault(); + } + } + + if (e.isDefaultPrevented()) { + return; + } + + switch (e.keyCode) { + case 37: // DOM_VK_LEFT + handleNonTabOrEscEvent(e, left); + break; + + case 39: // DOM_VK_RIGHT + handleNonTabOrEscEvent(e, right); + break; + + case 38: // DOM_VK_UP + handleNonTabOrEscEvent(e, up); + break; + + case 40: // DOM_VK_DOWN + handleNonTabOrEscEvent(e, down); + break; + + case 27: // DOM_VK_ESCAPE + cancel(); + break; + + case 14: // DOM_VK_ENTER + case 13: // DOM_VK_RETURN + case 32: // DOM_VK_SPACE + handleNonTabOrEscEvent(e, enter); + break; + + case 9: // DOM_VK_TAB + if (tab(e) !== false) { + e.preventDefault(); + } + break; + } + }); + + root.on('focusin', function(e) { + focusedElement = e.target; + focusedControl = e.control; + }); + + return { + focusFirst: focusFirst + }; + }; +}); + +// Included from: js/tinymce/classes/ui/Container.js + +/** + * Container.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Container control. This is extended by all controls that can have + * children such as panels etc. You can also use this class directly as an + * generic container instance. The container doesn't have any specific role or style. + * + * @-x-less Container.less + * @class tinymce.ui.Container + * @extends tinymce.ui.Control + */ +define("tinymce/ui/Container", [ + "tinymce/ui/Control", + "tinymce/ui/Collection", + "tinymce/ui/Selector", + "tinymce/ui/Factory", + "tinymce/ui/KeyboardNavigation", + "tinymce/util/Tools", + "tinymce/ui/DomUtils" +], function(Control, Collection, Selector, Factory, KeyboardNavigation, Tools, DomUtils) { + "use strict"; + + var selectorCache = {}; + + return Control.extend({ + layout: '', + innerClass: 'container-inner', + + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Array} items Items to add to container in JSON format or control instances. + * @setting {String} layout Layout manager by name to use. + * @setting {Object} defaults Default settings to apply to all items. + */ + init: function(settings) { + var self = this; + + self._super(settings); + settings = self.settings; + self._fixed = settings.fixed; + self._items = new Collection(); + + if (self.isRtl()) { + self.addClass('rtl'); + } + + self.addClass('container'); + self.addClass('container-body', 'body'); + + if (settings.containerCls) { + self.addClass(settings.containerCls); + } + + self._layout = Factory.create((settings.layout || self.layout) + 'layout'); + + if (self.settings.items) { + self.add(self.settings.items); + } + + // TODO: Fix this! + self._hasBody = true; + }, + + /** + * Returns a collection of child items that the container currently have. + * + * @method items + * @return {tinymce.ui.Collection} Control collection direct child controls. + */ + items: function() { + return this._items; + }, + + /** + * Find child controls by selector. + * + * @method find + * @param {String} selector Selector CSS pattern to find children by. + * @return {tinymce.ui.Collection} Control collection with child controls. + */ + find: function(selector) { + selector = selectorCache[selector] = selectorCache[selector] || new Selector(selector); + + return selector.find(this); + }, + + /** + * Adds one or many items to the current container. This will create instances of + * the object representations if needed. + * + * @method add + * @param {Array/Object/tinymce.ui.Control} items Array or item that will be added to the container. + * @return {tinymce.ui.Collection} Current collection control. + */ + add: function(items) { + var self = this; + + self.items().add(self.create(items)).parent(self); + + return self; + }, + + /** + * Focuses the current container instance. This will look + * for the first control in the container and focus that. + * + * @method focus + * @param {Boolean} keyboard Optional true/false if the focus was a keyboard focus or not. + * @return {tinymce.ui.Collection} Current instance. + */ + focus: function(keyboard) { + var self = this, focusCtrl, keyboardNav, items; + + if (keyboard) { + keyboardNav = self.keyboardNav || self.parents().eq(-1)[0].keyboardNav; + + if (keyboardNav) { + keyboardNav.focusFirst(self); + return; + } + } + + items = self.find('*'); + + // TODO: Figure out a better way to auto focus alert dialog buttons + if (self.statusbar) { + items.add(self.statusbar.items()); + } + + items.each(function(ctrl) { + if (ctrl.settings.autofocus) { + focusCtrl = null; + return false; + } + + if (ctrl.canFocus) { + focusCtrl = focusCtrl || ctrl; + } + }); + + if (focusCtrl) { + focusCtrl.focus(); + } + + return self; + }, + + /** + * Replaces the specified child control with a new control. + * + * @method replace + * @param {tinymce.ui.Control} oldItem Old item to be replaced. + * @param {tinymce.ui.Control} newItem New item to be inserted. + */ + replace: function(oldItem, newItem) { + var ctrlElm, items = this.items(), i = items.length; + + // Replace the item in collection + while (i--) { + if (items[i] === oldItem) { + items[i] = newItem; + break; + } + } + + if (i >= 0) { + // Remove new item from DOM + ctrlElm = newItem.getEl(); + if (ctrlElm) { + ctrlElm.parentNode.removeChild(ctrlElm); + } + + // Remove old item from DOM + ctrlElm = oldItem.getEl(); + if (ctrlElm) { + ctrlElm.parentNode.removeChild(ctrlElm); + } + } + + // Adopt the item + newItem.parent(this); + }, + + /** + * Creates the specified items. If any of the items is plain JSON style objects + * it will convert these into real tinymce.ui.Control instances. + * + * @method create + * @param {Array} items Array of items to convert into control instances. + * @return {Array} Array with control instances. + */ + create: function(items) { + var self = this, settings, ctrlItems = []; + + // Non array structure, then force it into an array + if (!Tools.isArray(items)) { + items = [items]; + } + + // Add default type to each child control + Tools.each(items, function(item) { + if (item) { + // Construct item if needed + if (!(item instanceof Control)) { + // Name only then convert it to an object + if (typeof item == "string") { + item = {type: item}; + } + + // Create control instance based on input settings and default settings + settings = Tools.extend({}, self.settings.defaults, item); + item.type = settings.type = settings.type || item.type || self.settings.defaultType || + (settings.defaults ? settings.defaults.type : null); + item = Factory.create(settings); + } + + ctrlItems.push(item); + } + }); + + return ctrlItems; + }, + + /** + * Renders new control instances. + * + * @private + */ + renderNew: function() { + var self = this; + + // Render any new items + self.items().each(function(ctrl, index) { + var containerElm, fragment; + + ctrl.parent(self); + + if (!ctrl._rendered) { + containerElm = self.getEl('body'); + fragment = DomUtils.createFragment(ctrl.renderHtml()); + + // Insert or append the item + if (containerElm.hasChildNodes() && index <= containerElm.childNodes.length - 1) { + containerElm.insertBefore(fragment, containerElm.childNodes[index]); + } else { + containerElm.appendChild(fragment); + } + + ctrl.postRender(); + } + }); + + self._layout.applyClasses(self); + self._lastRect = null; + + return self; + }, + + /** + * Appends new instances to the current container. + * + * @method append + * @param {Array/tinymce.ui.Collection} items Array if controls to append. + * @return {tinymce.ui.Container} Current container instance. + */ + append: function(items) { + return this.add(items).renderNew(); + }, + + /** + * Prepends new instances to the current container. + * + * @method prepend + * @param {Array/tinymce.ui.Collection} items Array if controls to prepend. + * @return {tinymce.ui.Container} Current container instance. + */ + prepend: function(items) { + var self = this; + + self.items().set(self.create(items).concat(self.items().toArray())); + + return self.renderNew(); + }, + + /** + * Inserts an control at a specific index. + * + * @method insert + * @param {Array/tinymce.ui.Collection} items Array if controls to insert. + * @param {Number} index Index to insert controls at. + * @param {Boolean} [before=false] Inserts controls before the index. + */ + insert: function(items, index, before) { + var self = this, curItems, beforeItems, afterItems; + + items = self.create(items); + curItems = self.items(); + + if (!before && index < curItems.length - 1) { + index += 1; + } + + if (index >= 0 && index < curItems.length) { + beforeItems = curItems.slice(0, index).toArray(); + afterItems = curItems.slice(index).toArray(); + curItems.set(beforeItems.concat(items, afterItems)); + } + + return self.renderNew(); + }, + + /** + * Populates the form fields from the specified JSON data object. + * + * Control items in the form that matches the data will have it's value set. + * + * @method fromJSON + * @param {Object} data JSON data object to set control values by. + * @return {tinymce.ui.Container} Current form instance. + */ + fromJSON: function(data) { + var self = this; + + for (var name in data) { + self.find('#' + name).value(data[name]); + } + + return self; + }, + + /** + * Serializes the form into a JSON object by getting all items + * that has a name and a value. + * + * @method toJSON + * @return {Object} JSON object with form data. + */ + toJSON: function() { + var self = this, data = {}; + + self.find('*').each(function(ctrl) { + var name = ctrl.name(), value = ctrl.value(); + + if (name && typeof value != "undefined") { + data[name] = value; + } + }); + + return data; + }, + + preRender: function() { + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, role = this.settings.role; + + self.preRender(); + layout.preRender(self); + + return ( + '

    ' + + '
    ' + + (self.settings.html || '') + layout.renderHtml(self) + + '
    ' + + '
    ' + ); + }, + + /** + * Post render method. Called after the control has been rendered to the target. + * + * @method postRender + * @return {tinymce.ui.Container} Current combobox instance. + */ + postRender: function() { + var self = this, box; + + self.items().exec('postRender'); + self._super(); + + self._layout.postRender(self); + self._rendered = true; + + if (self.settings.style) { + DomUtils.css(self.getEl(), self.settings.style); + } + + if (self.settings.border) { + box = self.borderBox(); + DomUtils.css(self.getEl(), { + 'border-top-width': box.top, + 'border-right-width': box.right, + 'border-bottom-width': box.bottom, + 'border-left-width': box.left + }); + } + + if (!self.parent()) { + self.keyboardNav = new KeyboardNavigation({ + root: self + }); + } + + return self; + }, + + /** + * Initializes the current controls layout rect. + * This will be executed by the layout managers to determine the + * default minWidth/minHeight etc. + * + * @method initLayoutRect + * @return {Object} Layout rect instance. + */ + initLayoutRect: function() { + var self = this, layoutRect = self._super(); + + // Recalc container size by asking layout manager + self._layout.recalc(self); + + return layoutRect; + }, + + /** + * Recalculates the positions of the controls in the current container. + * This is invoked by the reflow method and shouldn't be called directly. + * + * @method recalc + */ + recalc: function() { + var self = this, rect = self._layoutRect, lastRect = self._lastRect; + + if (!lastRect || lastRect.w != rect.w || lastRect.h != rect.h) { + self._layout.recalc(self); + rect = self.layoutRect(); + self._lastRect = {x: rect.x, y: rect.y, w: rect.w, h: rect.h}; + return true; + } + }, + + /** + * Reflows the current container and it's children and possible parents. + * This should be used after you for example append children to the current control so + * that the layout managers know that they need to reposition everything. + * + * @example + * container.append({type: 'button', text: 'My button'}).reflow(); + * + * @method reflow + * @return {tinymce.ui.Container} Current container instance. + */ + reflow: function() { + var i; + + if (this.visible()) { + Control.repaintControls = []; + Control.repaintControls.map = {}; + + this.recalc(); + i = Control.repaintControls.length; + + while (i--) { + Control.repaintControls[i].repaint(); + } + + // TODO: Fix me! + if (this.settings.layout !== "flow" && this.settings.layout !== "stack") { + this.repaint(); + } + + Control.repaintControls = []; + } + + return this; + } + }); +}); + +// Included from: js/tinymce/classes/ui/DragHelper.js + +/** + * DragHelper.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Drag/drop helper class. + * + * @example + * var dragHelper = new tinymce.ui.DragHelper('mydiv', { + * start: function(evt) { + * }, + * + * drag: function(evt) { + * }, + * + * end: function(evt) { + * } + * }); + * + * @class tinymce.ui.DragHelper + */ +define("tinymce/ui/DragHelper", [ + "tinymce/ui/DomUtils" +], function(DomUtils) { + "use strict"; + + function getDocumentSize() { + var doc = document, documentElement, body, scrollWidth, clientWidth; + var offsetWidth, scrollHeight, clientHeight, offsetHeight, max = Math.max; + + documentElement = doc.documentElement; + body = doc.body; + + scrollWidth = max(documentElement.scrollWidth, body.scrollWidth); + clientWidth = max(documentElement.clientWidth, body.clientWidth); + offsetWidth = max(documentElement.offsetWidth, body.offsetWidth); + + scrollHeight = max(documentElement.scrollHeight, body.scrollHeight); + clientHeight = max(documentElement.clientHeight, body.clientHeight); + offsetHeight = max(documentElement.offsetHeight, body.offsetHeight); + + return { + width: scrollWidth < offsetWidth ? clientWidth : scrollWidth, + height: scrollHeight < offsetHeight ? clientHeight : scrollHeight + }; + } + + return function(id, settings) { + var eventOverlayElm, doc = document, downButton, start, stop, drag, startX, startY; + + settings = settings || {}; + + function getHandleElm() { + return doc.getElementById(settings.handle || id); + } + + start = function(e) { + var docSize = getDocumentSize(), handleElm, cursor; + + e.preventDefault(); + downButton = e.button; + handleElm = getHandleElm(); + startX = e.screenX; + startY = e.screenY; + + // Grab cursor from handle + if (window.getComputedStyle) { + cursor = window.getComputedStyle(handleElm, null).getPropertyValue("cursor"); + } else { + cursor = handleElm.runtimeStyle.cursor; + } + + // Create event overlay and add it to document + eventOverlayElm = doc.createElement('div'); + DomUtils.css(eventOverlayElm, { + position: "absolute", + top: 0, left: 0, + width: docSize.width, + height: docSize.height, + zIndex: 0x7FFFFFFF, + opacity: 0.0001, + cursor: cursor + }); + + doc.body.appendChild(eventOverlayElm); + + // Bind mouse events + DomUtils.on(doc, 'mousemove', drag); + DomUtils.on(doc, 'mouseup', stop); + + // Begin drag + settings.start(e); + }; + + drag = function(e) { + if (e.button !== downButton) { + return stop(e); + } + + e.deltaX = e.screenX - startX; + e.deltaY = e.screenY - startY; + + e.preventDefault(); + settings.drag(e); + }; + + stop = function(e) { + DomUtils.off(doc, 'mousemove', drag); + DomUtils.off(doc, 'mouseup', stop); + + eventOverlayElm.parentNode.removeChild(eventOverlayElm); + + if (settings.stop) { + settings.stop(e); + } + }; + + /** + * Destroys the drag/drop helper instance. + * + * @method destroy + */ + this.destroy = function() { + DomUtils.off(getHandleElm()); + }; + + DomUtils.on(getHandleElm(), 'mousedown', start); + }; +}); + +// Included from: js/tinymce/classes/ui/Scrollable.js + +/** + * Scrollable.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This mixin makes controls scrollable using custom scrollbars. + * + * @-x-less Scrollable.less + * @mixin tinymce.ui.Scrollable + */ +define("tinymce/ui/Scrollable", [ + "tinymce/ui/DomUtils", + "tinymce/ui/DragHelper" +], function(DomUtils, DragHelper) { + "use strict"; + + return { + init: function() { + var self = this; + self.on('repaint', self.renderScroll); + }, + + renderScroll: function() { + var self = this, margin = 2; + + function repaintScroll() { + var hasScrollH, hasScrollV, bodyElm; + + function repaintAxis(axisName, posName, sizeName, contentSizeName, hasScroll, ax) { + var containerElm, scrollBarElm, scrollThumbElm; + var containerSize, scrollSize, ratio, rect; + var posNameLower, sizeNameLower; + + scrollBarElm = self.getEl('scroll' + axisName); + if (scrollBarElm) { + posNameLower = posName.toLowerCase(); + sizeNameLower = sizeName.toLowerCase(); + + if (self.getEl('absend')) { + DomUtils.css(self.getEl('absend'), posNameLower, self.layoutRect()[contentSizeName] - 1); + } + + if (!hasScroll) { + DomUtils.css(scrollBarElm, 'display', 'none'); + return; + } + + DomUtils.css(scrollBarElm, 'display', 'block'); + containerElm = self.getEl('body'); + scrollThumbElm = self.getEl('scroll' + axisName + "t"); + containerSize = containerElm["client" + sizeName] - (margin * 2); + containerSize -= hasScrollH && hasScrollV ? scrollBarElm["client" + ax] : 0; + scrollSize = containerElm["scroll" + sizeName]; + ratio = containerSize / scrollSize; + + rect = {}; + rect[posNameLower] = containerElm["offset" + posName] + margin; + rect[sizeNameLower] = containerSize; + DomUtils.css(scrollBarElm, rect); + + rect = {}; + rect[posNameLower] = containerElm["scroll" + posName] * ratio; + rect[sizeNameLower] = containerSize * ratio; + DomUtils.css(scrollThumbElm, rect); + } + } + + bodyElm = self.getEl('body'); + hasScrollH = bodyElm.scrollWidth > bodyElm.clientWidth; + hasScrollV = bodyElm.scrollHeight > bodyElm.clientHeight; + + repaintAxis("h", "Left", "Width", "contentW", hasScrollH, "Height"); + repaintAxis("v", "Top", "Height", "contentH", hasScrollV, "Width"); + } + + function addScroll() { + function addScrollAxis(axisName, posName, sizeName, deltaPosName, ax) { + var scrollStart, axisId = self._id + '-scroll' + axisName, prefix = self.classPrefix; + + self.getEl().appendChild(DomUtils.createFragment( + '
    ' + + '
    ' + + '
    ' + )); + + self.draghelper = new DragHelper(axisId + 't', { + start: function() { + scrollStart = self.getEl('body')["scroll" + posName]; + DomUtils.addClass(DomUtils.get(axisId), prefix + 'active'); + }, + + drag: function(e) { + var ratio, hasScrollH, hasScrollV, containerSize, layoutRect = self.layoutRect(); + + hasScrollH = layoutRect.contentW > layoutRect.innerW; + hasScrollV = layoutRect.contentH > layoutRect.innerH; + containerSize = self.getEl('body')["client" + sizeName] - (margin * 2); + containerSize -= hasScrollH && hasScrollV ? self.getEl('scroll' + axisName)["client" + ax] : 0; + + ratio = containerSize / self.getEl('body')["scroll" + sizeName]; + self.getEl('body')["scroll" + posName] = scrollStart + (e["delta" + deltaPosName] / ratio); + }, + + stop: function() { + DomUtils.removeClass(DomUtils.get(axisId), prefix + 'active'); + } + }); +/* + self.on('click', function(e) { + if (e.target.id == self._id + '-scrollv') { + + } + });*/ + } + + self.addClass('scroll'); + + addScrollAxis("v", "Top", "Height", "Y", "Width"); + addScrollAxis("h", "Left", "Width", "X", "Height"); + } + + if (self.settings.autoScroll) { + if (!self._hasScroll) { + self._hasScroll = true; + addScroll(); + + self.on('wheel', function(e) { + var bodyEl = self.getEl('body'); + + bodyEl.scrollLeft += (e.deltaX || 0) * 10; + bodyEl.scrollTop += e.deltaY * 10; + + repaintScroll(); + }); + + DomUtils.on(self.getEl('body'), "scroll", repaintScroll); + } + + repaintScroll(); + } + } + }; +}); + +// Included from: js/tinymce/classes/ui/Panel.js + +/** + * Panel.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new panel. + * + * @-x-less Panel.less + * @class tinymce.ui.Panel + * @extends tinymce.ui.Container + * @mixes tinymce.ui.Scrollable + */ +define("tinymce/ui/Panel", [ + "tinymce/ui/Container", + "tinymce/ui/Scrollable" +], function(Container, Scrollable) { + "use strict"; + + return Container.extend({ + Defaults: { + layout: 'fit', + containerCls: 'panel' + }, + + Mixins: [Scrollable], + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, innerHtml = self.settings.html; + + self.preRender(); + layout.preRender(self); + + if (typeof innerHtml == "undefined") { + innerHtml = ( + '
    ' + + layout.renderHtml(self) + + '
    ' + ); + } else { + if (typeof innerHtml == 'function') { + innerHtml = innerHtml.call(self); + } + + self._hasBody = false; + } + + return ( + '
    ' + + (self._preBodyHtml || '') + + innerHtml + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/Movable.js + +/** + * Movable.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Movable mixin. Makes controls movable absolute and relative to other elements. + * + * @mixin tinymce.ui.Movable + */ +define("tinymce/ui/Movable", [ + "tinymce/ui/DomUtils" +], function(DomUtils) { + "use strict"; + + function calculateRelativePosition(ctrl, targetElm, rel) { + var ctrlElm, pos, x, y, selfW, selfH, targetW, targetH, viewport, size; + + viewport = DomUtils.getViewPort(); + + // Get pos of target + pos = DomUtils.getPos(targetElm); + x = pos.x; + y = pos.y; + + if (ctrl._fixed && DomUtils.getRuntimeStyle(document.body, 'position') == 'static') { + x -= viewport.x; + y -= viewport.y; + } + + // Get size of self + ctrlElm = ctrl.getEl(); + size = DomUtils.getSize(ctrlElm); + selfW = size.width; + selfH = size.height; + + // Get size of target + size = DomUtils.getSize(targetElm); + targetW = size.width; + targetH = size.height; + + // Parse align string + rel = (rel || '').split(''); + + // Target corners + if (rel[0] === 'b') { + y += targetH; + } + + if (rel[1] === 'r') { + x += targetW; + } + + if (rel[0] === 'c') { + y += Math.round(targetH / 2); + } + + if (rel[1] === 'c') { + x += Math.round(targetW / 2); + } + + // Self corners + if (rel[3] === 'b') { + y -= selfH; + } + + if (rel[4] === 'r') { + x -= selfW; + } + + if (rel[3] === 'c') { + y -= Math.round(selfH / 2); + } + + if (rel[4] === 'c') { + x -= Math.round(selfW / 2); + } + + return { + x: x, + y: y, + w: selfW, + h: selfH + }; + } + + return { + /** + * Tests various positions to get the most suitable one. + * + * @method testMoveRel + * @param {DOMElement} elm Element to position against. + * @param {Array} rels Array with relative positions. + * @return {String} Best suitable relative position. + */ + testMoveRel: function(elm, rels) { + var viewPortRect = DomUtils.getViewPort(); + + for (var i = 0; i < rels.length; i++) { + var pos = calculateRelativePosition(this, elm, rels[i]); + + if (this._fixed) { + if (pos.x > 0 && pos.x + pos.w < viewPortRect.w && pos.y > 0 && pos.y + pos.h < viewPortRect.h) { + return rels[i]; + } + } else { + if (pos.x > viewPortRect.x && pos.x + pos.w < viewPortRect.w + viewPortRect.x && + pos.y > viewPortRect.y && pos.y + pos.h < viewPortRect.h + viewPortRect.y) { + return rels[i]; + } + } + } + + return rels[0]; + }, + + /** + * Move relative to the specified element. + * + * @method moveRel + * @param {Element} elm Element to move relative to. + * @param {String} rel Relative mode. For example: br-tl. + * @return {tinymce.ui.Control} Current control instance. + */ + moveRel: function(elm, rel) { + if (typeof rel != 'string') { + rel = this.testMoveRel(elm, rel); + } + + var pos = calculateRelativePosition(this, elm, rel); + return this.moveTo(pos.x, pos.y); + }, + + /** + * Move by a relative x, y values. + * + * @method moveBy + * @param {Number} dx Relative x position. + * @param {Number} dy Relative y position. + * @return {tinymce.ui.Control} Current control instance. + */ + moveBy: function(dx, dy) { + var self = this, rect = self.layoutRect(); + + self.moveTo(rect.x + dx, rect.y + dy); + + return self; + }, + + /** + * Move to absolute position. + * + * @method moveTo + * @param {Number} x Absolute x position. + * @param {Number} y Absolute y position. + * @return {tinymce.ui.Control} Current control instance. + */ + moveTo: function(x, y) { + var self = this; + + // TODO: Move this to some global class + function contrain(value, max, size) { + if (value < 0) { + return 0; + } + + if (value + size > max) { + value = max - size; + return value < 0 ? 0 : value; + } + + return value; + } + + if (self.settings.constrainToViewport) { + var viewPortRect = DomUtils.getViewPort(window); + var layoutRect = self.layoutRect(); + + x = contrain(x, viewPortRect.w + viewPortRect.x, layoutRect.w); + y = contrain(y, viewPortRect.h + viewPortRect.y, layoutRect.h); + } + + if (self._rendered) { + self.layoutRect({x: x, y: y}).repaint(); + } else { + self.settings.x = x; + self.settings.y = y; + } + + self.fire('move', {x: x, y: y}); + + return self; + } + }; +}); + +// Included from: js/tinymce/classes/ui/Resizable.js + +/** + * Resizable.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Resizable mixin. Enables controls to be resized. + * + * @mixin tinymce.ui.Resizable + */ +define("tinymce/ui/Resizable", [ + "tinymce/ui/DomUtils" +], function(DomUtils) { + "use strict"; + + return { + /** + * Resizes the control to contents. + * + * @method resizeToContent + */ + resizeToContent: function() { + this._layoutRect.autoResize = true; + this._lastRect = null; + this.reflow(); + }, + + /** + * Resizes the control to a specific width/height. + * + * @method resizeTo + * @param {Number} w Control width. + * @param {Number} h Control height. + * @return {tinymce.ui.Control} Current control instance. + */ + resizeTo: function(w, h) { + // TODO: Fix hack + if (w <= 1 || h <= 1) { + var rect = DomUtils.getWindowSize(); + + w = w <= 1 ? w * rect.w : w; + h = h <= 1 ? h * rect.h : h; + } + + this._layoutRect.autoResize = false; + return this.layoutRect({minW: w, minH: h, w: w, h: h}).reflow(); + }, + + /** + * Resizes the control to a specific relative width/height. + * + * @method resizeBy + * @param {Number} dw Relative control width. + * @param {Number} dh Relative control height. + * @return {tinymce.ui.Control} Current control instance. + */ + resizeBy: function(dw, dh) { + var self = this, rect = self.layoutRect(); + + return self.resizeTo(rect.w + dw, rect.h + dh); + } + }; +}); + +// Included from: js/tinymce/classes/ui/FloatPanel.js + +/** + * FloatPanel.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a floating panel. + * + * @-x-less FloatPanel.less + * @class tinymce.ui.FloatPanel + * @extends tinymce.ui.Panel + * @mixes tinymce.ui.Movable + * @mixes tinymce.ui.Resizable + */ +define("tinymce/ui/FloatPanel", [ + "tinymce/ui/Panel", + "tinymce/ui/Movable", + "tinymce/ui/Resizable", + "tinymce/ui/DomUtils" +], function(Panel, Movable, Resizable, DomUtils) { + "use strict"; + + var documentClickHandler, documentScrollHandler, windowResizeHandler, visiblePanels = []; + var zOrder = [], hasModal; + + function bindDocumentClickHandler() { + function isChildOf(ctrl, parent) { + while (ctrl) { + if (ctrl == parent) { + return true; + } + + ctrl = ctrl.parent(); + } + } + + if (!documentClickHandler) { + documentClickHandler = function(e) { + // Gecko fires click event and in the wrong order on Mac so lets normalize + if (e.button == 2) { + return; + } + + // Hide any float panel when a click is out side that float panel and the + // float panels direct parent for example a click on a menu button + var i = visiblePanels.length; + while (i--) { + var panel = visiblePanels[i], clickCtrl = panel.getParentCtrl(e.target); + + if (panel.settings.autohide) { + if (clickCtrl) { + if (isChildOf(clickCtrl, panel) || panel.parent() === clickCtrl) { + continue; + } + } + + e = panel.fire('autohide', {target: e.target}); + if (!e.isDefaultPrevented()) { + panel.hide(); + } + } + } + }; + + DomUtils.on(document, 'click', documentClickHandler); + } + } + + function bindDocumentScrollHandler() { + if (!documentScrollHandler) { + documentScrollHandler = function() { + var i; + + i = visiblePanels.length; + while (i--) { + repositionPanel(visiblePanels[i]); + } + }; + + DomUtils.on(window, 'scroll', documentScrollHandler); + } + } + + function bindWindowResizeHandler() { + if (!windowResizeHandler) { + var docElm = document.documentElement, clientWidth = docElm.clientWidth, clientHeight = docElm.clientHeight; + + windowResizeHandler = function() { + // Workaround for #7065 IE 7 fires resize events event though the window wasn't resized + if (!document.all || clientWidth != docElm.clientWidth || clientHeight != docElm.clientHeight) { + clientWidth = docElm.clientWidth; + clientHeight = docElm.clientHeight; + FloatPanel.hideAll(); + } + }; + + DomUtils.on(window, 'resize', windowResizeHandler); + } + } + + /** + * Repositions the panel to the top of page if the panel is outside of the visual viewport. It will + * also reposition all child panels of the current panel. + */ + function repositionPanel(panel) { + var scrollY = DomUtils.getViewPort().y; + + function toggleFixedChildPanels(fixed, deltaY) { + var parent; + + for (var i = 0; i < visiblePanels.length; i++) { + if (visiblePanels[i] != panel) { + parent = visiblePanels[i].parent(); + + while (parent && (parent = parent.parent())) { + if (parent == panel) { + visiblePanels[i].fixed(fixed).moveBy(0, deltaY).repaint(); + } + } + } + } + } + + if (panel.settings.autofix) { + if (!panel._fixed) { + panel._autoFixY = panel.layoutRect().y; + + if (panel._autoFixY < scrollY) { + panel.fixed(true).layoutRect({y: 0}).repaint(); + toggleFixedChildPanels(true, scrollY - panel._autoFixY); + } + } else { + if (panel._autoFixY > scrollY) { + panel.fixed(false).layoutRect({y: panel._autoFixY}).repaint(); + toggleFixedChildPanels(false, panel._autoFixY - scrollY); + } + } + } + } + + function addRemove(add, ctrl) { + var i, zIndex = FloatPanel.zIndex || 0xFFFF, topModal; + + if (add) { + zOrder.push(ctrl); + } else { + i = zOrder.length; + + while (i--) { + if (zOrder[i] === ctrl) { + zOrder.splice(i, 1); + } + } + } + + if (zOrder.length) { + for (i = 0; i < zOrder.length; i++) { + if (zOrder[i].modal) { + zIndex++; + topModal = zOrder[i]; + } + + zOrder[i].getEl().style.zIndex = zIndex; + zOrder[i].zIndex = zIndex; + zIndex++; + } + } + + var modalBlockEl = document.getElementById(ctrl.classPrefix + 'modal-block'); + + if (topModal) { + DomUtils.css(modalBlockEl, 'z-index', topModal.zIndex - 1); + } else if (modalBlockEl) { + modalBlockEl.parentNode.removeChild(modalBlockEl); + hasModal = false; + } + + FloatPanel.currentZIndex = zIndex; + } + + var FloatPanel = Panel.extend({ + Mixins: [Movable, Resizable], + + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Boolean} autohide Automatically hide the panel. + */ + init: function(settings) { + var self = this; + + self._super(settings); + self._eventsRoot = self; + + self.addClass('floatpanel'); + + // Hide floatpanes on click out side the root button + if (settings.autohide) { + bindDocumentClickHandler(); + bindWindowResizeHandler(); + visiblePanels.push(self); + } + + if (settings.autofix) { + bindDocumentScrollHandler(); + + self.on('move', function() { + repositionPanel(this); + }); + } + + self.on('postrender show', function(e) { + if (e.control == self) { + var modalBlockEl, prefix = self.classPrefix; + + if (self.modal && !hasModal) { + modalBlockEl = DomUtils.createFragment('
    '); + modalBlockEl = modalBlockEl.firstChild; + + self.getContainerElm().appendChild(modalBlockEl); + + setTimeout(function() { + DomUtils.addClass(modalBlockEl, prefix + 'in'); + DomUtils.addClass(self.getEl(), prefix + 'in'); + }, 0); + + hasModal = true; + } + + addRemove(true, self); + } + }); + + self.on('show', function() { + self.parents().each(function(ctrl) { + if (ctrl._fixed) { + self.fixed(true); + return false; + } + }); + }); + + if (settings.popover) { + self._preBodyHtml = '
    '; + self.addClass('popover').addClass('bottom').addClass(self.isRtl() ? 'end' : 'start'); + } + }, + + fixed: function(state) { + var self = this; + + if (self._fixed != state) { + if (self._rendered) { + var viewport = DomUtils.getViewPort(); + + if (state) { + self.layoutRect().y -= viewport.y; + } else { + self.layoutRect().y += viewport.y; + } + } + + self.toggleClass('fixed', state); + self._fixed = state; + } + + return self; + }, + + /** + * Shows the current float panel. + * + * @method show + * @return {tinymce.ui.FloatPanel} Current floatpanel instance. + */ + show: function() { + var self = this, i, state = self._super(); + + i = visiblePanels.length; + while (i--) { + if (visiblePanels[i] === self) { + break; + } + } + + if (i === -1) { + visiblePanels.push(self); + } + + return state; + }, + + /** + * Hides the current float panel. + * + * @method hide + * @return {tinymce.ui.FloatPanel} Current floatpanel instance. + */ + hide: function() { + removeVisiblePanel(this); + addRemove(false, this); + + return this._super(); + }, + + /** + * Hide all visible float panels with he autohide setting enabled. This is for + * manually hiding floating menus or panels. + * + * @method hideAll + */ + hideAll: function() { + FloatPanel.hideAll(); + }, + + /** + * Closes the float panel. This will remove the float panel from page and fire the close event. + * + * @method close + */ + close: function() { + var self = this; + + if (!self.fire('close').isDefaultPrevented()) { + self.remove(); + addRemove(false, self); + } + + return self; + }, + + /** + * Removes the float panel from page. + * + * @method remove + */ + remove: function() { + removeVisiblePanel(this); + this._super(); + }, + + postRender: function() { + var self = this; + + if (self.settings.bodyRole) { + this.getEl('body').setAttribute('role', self.settings.bodyRole); + } + + return self._super(); + } + }); + + /** + * Hide all visible float panels with he autohide setting enabled. This is for + * manually hiding floating menus or panels. + * + * @static + * @method hideAll + */ + FloatPanel.hideAll = function() { + var i = visiblePanels.length; + + while (i--) { + var panel = visiblePanels[i]; + + if (panel && panel.settings.autohide) { + panel.hide(); + visiblePanels.splice(i, 1); + } + } + }; + + function removeVisiblePanel(panel) { + var i; + + i = visiblePanels.length; + while (i--) { + if (visiblePanels[i] === panel) { + visiblePanels.splice(i, 1); + } + } + + i = zOrder.length; + while (i--) { + if (zOrder[i] === panel) { + zOrder.splice(i, 1); + } + } + } + + return FloatPanel; +}); + +// Included from: js/tinymce/classes/ui/Window.js + +/** + * Window.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new window. + * + * @-x-less Window.less + * @class tinymce.ui.Window + * @extends tinymce.ui.FloatPanel + */ +define("tinymce/ui/Window", [ + "tinymce/ui/FloatPanel", + "tinymce/ui/Panel", + "tinymce/ui/DomUtils", + "tinymce/ui/DragHelper" +], function(FloatPanel, Panel, DomUtils, DragHelper) { + "use strict"; + + var Window = FloatPanel.extend({ + modal: true, + + Defaults: { + border: 1, + layout: 'flex', + containerCls: 'panel', + role: 'dialog', + callbacks: { + submit: function() { + this.fire('submit', {data: this.toJSON()}); + }, + + close: function() { + this.close(); + } + } + }, + + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this; + + self._super(settings); + + if (self.isRtl()) { + self.addClass('rtl'); + } + + self.addClass('window'); + self._fixed = true; + + // Create statusbar + if (settings.buttons) { + self.statusbar = new Panel({ + layout: 'flex', + border: '1 0 0 0', + spacing: 3, + padding: 10, + align: 'center', + pack: self.isRtl() ? 'start' : 'end', + defaults: { + type: 'button' + }, + items: settings.buttons + }); + + self.statusbar.addClass('foot'); + self.statusbar.parent(self); + } + + self.on('click', function(e) { + if (e.target.className.indexOf(self.classPrefix + 'close') != -1) { + self.close(); + } + }); + + self.on('cancel', function() { + self.close(); + }); + + self.aria('describedby', self.describedBy || self._id + '-none'); + self.aria('label', settings.title); + self._fullscreen = false; + }, + + /** + * Recalculates the positions of the controls in the current container. + * This is invoked by the reflow method and shouldn't be called directly. + * + * @method recalc + */ + recalc: function() { + var self = this, statusbar = self.statusbar, layoutRect, width, x, needsRecalc; + + if (self._fullscreen) { + self.layoutRect(DomUtils.getWindowSize()); + self.layoutRect().contentH = self.layoutRect().innerH; + } + + self._super(); + + layoutRect = self.layoutRect(); + + // Resize window based on title width + if (self.settings.title && !self._fullscreen) { + width = layoutRect.headerW; + if (width > layoutRect.w) { + x = layoutRect.x - Math.max(0, width / 2); + self.layoutRect({w: width, x: x}); + needsRecalc = true; + } + } + + // Resize window based on statusbar width + if (statusbar) { + statusbar.layoutRect({w: self.layoutRect().innerW}).recalc(); + + width = statusbar.layoutRect().minW + layoutRect.deltaW; + if (width > layoutRect.w) { + x = layoutRect.x - Math.max(0, width - layoutRect.w); + self.layoutRect({w: width, x: x}); + needsRecalc = true; + } + } + + // Recalc body and disable auto resize + if (needsRecalc) { + self.recalc(); + } + }, + + /** + * Initializes the current controls layout rect. + * This will be executed by the layout managers to determine the + * default minWidth/minHeight etc. + * + * @method initLayoutRect + * @return {Object} Layout rect instance. + */ + initLayoutRect: function() { + var self = this, layoutRect = self._super(), deltaH = 0, headEl; + + // Reserve vertical space for title + if (self.settings.title && !self._fullscreen) { + headEl = self.getEl('head'); + + var size = DomUtils.getSize(headEl); + + layoutRect.headerW = size.width; + layoutRect.headerH = size.height; + + deltaH += layoutRect.headerH; + } + + // Reserve vertical space for statusbar + if (self.statusbar) { + deltaH += self.statusbar.layoutRect().h; + } + + layoutRect.deltaH += deltaH; + layoutRect.minH += deltaH; + //layoutRect.innerH -= deltaH; + layoutRect.h += deltaH; + + var rect = DomUtils.getWindowSize(); + + layoutRect.x = Math.max(0, rect.w / 2 - layoutRect.w / 2); + layoutRect.y = Math.max(0, rect.h / 2 - layoutRect.h / 2); + + return layoutRect; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, id = self._id, prefix = self.classPrefix; + var settings = self.settings, headerHtml = '', footerHtml = '', html = settings.html; + + self.preRender(); + layout.preRender(self); + + if (settings.title) { + headerHtml = ( + '
    ' + + '
    ' + self.encode(settings.title) + '
    ' + + '' + + '
    ' + + '
    ' + ); + } + + if (settings.url) { + html = ''; + } + + if (typeof html == "undefined") { + html = layout.renderHtml(self); + } + + if (self.statusbar) { + footerHtml = self.statusbar.renderHtml(); + } + + return ( + '
    ' + + '
    ' + + headerHtml + + '
    ' + + html + + '
    ' + + footerHtml + + '
    ' + + '
    ' + ); + }, + + /** + * Switches the window fullscreen mode. + * + * @method fullscreen + * @param {Boolean} state True/false state. + * @return {tinymce.ui.Window} Current window instance. + */ + fullscreen: function(state) { + var self = this, documentElement = document.documentElement, slowRendering, prefix = self.classPrefix, layoutRect; + + if (state != self._fullscreen) { + DomUtils.on(window, 'resize', function() { + var time; + + if (self._fullscreen) { + // Time the layout time if it's to slow use a timeout to not hog the CPU + if (!slowRendering) { + time = new Date().getTime(); + + var rect = DomUtils.getWindowSize(); + self.moveTo(0, 0).resizeTo(rect.w, rect.h); + + if ((new Date().getTime()) - time > 50) { + slowRendering = true; + } + } else { + if (!self._timer) { + self._timer = setTimeout(function() { + var rect = DomUtils.getWindowSize(); + self.moveTo(0, 0).resizeTo(rect.w, rect.h); + + self._timer = 0; + }, 50); + } + } + } + }); + + layoutRect = self.layoutRect(); + self._fullscreen = state; + + if (!state) { + self._borderBox = self.parseBox(self.settings.border); + self.getEl('head').style.display = ''; + layoutRect.deltaH += layoutRect.headerH; + DomUtils.removeClass(documentElement, prefix + 'fullscreen'); + DomUtils.removeClass(document.body, prefix + 'fullscreen'); + self.removeClass('fullscreen'); + self.moveTo(self._initial.x, self._initial.y).resizeTo(self._initial.w, self._initial.h); + } else { + self._initial = {x: layoutRect.x, y: layoutRect.y, w: layoutRect.w, h: layoutRect.h}; + + self._borderBox = self.parseBox('0'); + self.getEl('head').style.display = 'none'; + layoutRect.deltaH -= layoutRect.headerH + 2; + DomUtils.addClass(documentElement, prefix + 'fullscreen'); + DomUtils.addClass(document.body, prefix + 'fullscreen'); + self.addClass('fullscreen'); + + var rect = DomUtils.getWindowSize(); + self.moveTo(0, 0).resizeTo(rect.w, rect.h); + } + } + + return self.reflow(); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this, startPos; + + setTimeout(function() { + self.addClass('in'); + }, 0); + + self._super(); + + if (self.statusbar) { + self.statusbar.postRender(); + } + + self.focus(); + + this.dragHelper = new DragHelper(self._id + '-dragh', { + start: function() { + startPos = { + x: self.layoutRect().x, + y: self.layoutRect().y + }; + }, + + drag: function(e) { + self.moveTo(startPos.x + e.deltaX, startPos.y + e.deltaY); + } + }); + + self.on('submit', function(e) { + if (!e.isDefaultPrevented()) { + self.close(); + } + }); + }, + + /** + * Fires a submit event with the serialized form. + * + * @method submit + * @return {Object} Event arguments object. + */ + submit: function() { + return this.fire('submit', {data: this.toJSON()}); + }, + + /** + * Removes the current control from DOM and from UI collections. + * + * @method remove + * @return {tinymce.ui.Control} Current control instance. + */ + remove: function() { + var self = this, prefix = self.classPrefix; + + self.dragHelper.destroy(); + self._super(); + + if (self.statusbar) { + this.statusbar.remove(); + } + + if (self._fullscreen) { + DomUtils.removeClass(document.documentElement, prefix + 'fullscreen'); + DomUtils.removeClass(document.body, prefix + 'fullscreen'); + } + }, + + /** + * Returns the contentWindow object of the iframe if it exists. + * + * @method getContentWindow + * @return {Window} window object or null. + */ + getContentWindow: function() { + var ifr = this.getEl().getElementsByTagName('iframe')[0]; + return ifr ? ifr.contentWindow : null; + } + }); + + return Window; +}); + +// Included from: js/tinymce/classes/ui/MessageBox.js + +/** + * MessageBox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to create MessageBoxes like alerts/confirms etc. + * + * @class tinymce.ui.MessageBox + * @extends tinymce.ui.Window + */ +define("tinymce/ui/MessageBox", [ + "tinymce/ui/Window" +], function(Window) { + "use strict"; + + var MessageBox = Window.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + settings = { + border: 1, + padding: 20, + layout: 'flex', + pack: "center", + align: "center", + containerCls: 'panel', + autoScroll: true, + buttons: {type: "button", text: "Ok", action: "ok"}, + items: { + type: "label", + multiline: true, + maxWidth: 500, + maxHeight: 200 + } + }; + + this._super(settings); + }, + + Statics: { + /** + * Ok buttons constant. + * + * @static + * @final + * @field {Number} OK + */ + OK: 1, + + /** + * Ok/cancel buttons constant. + * + * @static + * @final + * @field {Number} OK_CANCEL + */ + OK_CANCEL: 2, + + /** + * yes/no buttons constant. + * + * @static + * @final + * @field {Number} YES_NO + */ + YES_NO: 3, + + /** + * yes/no/cancel buttons constant. + * + * @static + * @final + * @field {Number} YES_NO_CANCEL + */ + YES_NO_CANCEL: 4, + + /** + * Constructs a new message box and renders it to the body element. + * + * @static + * @method msgBox + * @param {Object} settings Name/value object with settings. + */ + msgBox: function(settings) { + var buttons, callback = settings.callback || function() {}; + + function createButton(text, status, primary) { + return { + type: "button", + text: text, + subtype: primary ? 'primary' : '', + onClick: function(e) { + e.control.parents()[1].close(); + callback(status); + } + }; + } + + switch (settings.buttons) { + case MessageBox.OK_CANCEL: + buttons = [ + createButton('Ok', true, true), + createButton('Cancel', false) + ]; + break; + + case MessageBox.YES_NO: + case MessageBox.YES_NO_CANCEL: + buttons = [ + createButton('Yes', 1, true), + createButton('No', 0) + ]; + + if (settings.buttons == MessageBox.YES_NO_CANCEL) { + buttons.push(createButton('Cancel', -1)); + } + break; + + default: + buttons = [ + createButton('Ok', true, true) + ]; + break; + } + + return new Window({ + padding: 20, + x: settings.x, + y: settings.y, + minWidth: 300, + minHeight: 100, + layout: "flex", + pack: "center", + align: "center", + buttons: buttons, + title: settings.title, + role: 'alertdialog', + items: { + type: "label", + multiline: true, + maxWidth: 500, + maxHeight: 200, + text: settings.text + }, + onPostRender: function() { + this.aria('describedby', this.items()[0]._id); + }, + onClose: settings.onClose, + onCancel: function() { + callback(false); + } + }).renderTo(document.body).reflow(); + }, + + /** + * Creates a new alert dialog. + * + * @method alert + * @param {Object} settings Settings for the alert dialog. + * @param {function} [callback] Callback to execute when the user makes a choice. + */ + alert: function(settings, callback) { + if (typeof settings == "string") { + settings = {text: settings}; + } + + settings.callback = callback; + return MessageBox.msgBox(settings); + }, + + /** + * Creates a new confirm dialog. + * + * @method confirm + * @param {Object} settings Settings for the confirm dialog. + * @param {function} [callback] Callback to execute when the user makes a choice. + */ + confirm: function(settings, callback) { + if (typeof settings == "string") { + settings = {text: settings}; + } + + settings.callback = callback; + settings.buttons = MessageBox.OK_CANCEL; + + return MessageBox.msgBox(settings); + } + } + }); + + return MessageBox; +}); + +// Included from: js/tinymce/classes/WindowManager.js + +/** + * WindowManager.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles the creation of native windows and dialogs. This class can be extended to provide for example inline dialogs. + * + * @class tinymce.WindowManager + * @example + * // Opens a new dialog with the file.htm file and the size 320x240 + * // It also adds a custom parameter this can be retrieved by using tinyMCEPopup.getWindowArg inside the dialog. + * tinymce.activeEditor.windowManager.open({ + * url: 'file.htm', + * width: 320, + * height: 240 + * }, { + * custom_param: 1 + * }); + * + * // Displays an alert box using the active editors window manager instance + * tinymce.activeEditor.windowManager.alert('Hello world!'); + * + * // Displays an confirm box and an alert message will be displayed depending on what you choose in the confirm + * tinymce.activeEditor.windowManager.confirm("Do you want to do something", function(s) { + * if (s) + * tinymce.activeEditor.windowManager.alert("Ok"); + * else + * tinymce.activeEditor.windowManager.alert("Cancel"); + * }); + */ +define("tinymce/WindowManager", [ + "tinymce/ui/Window", + "tinymce/ui/MessageBox" +], function(Window, MessageBox) { + return function(editor) { + var self = this, windows = []; + + function getTopMostWindow() { + if (windows.length) { + return windows[windows.length - 1]; + } + } + + self.windows = windows; + + editor.on('remove', function() { + var i = windows.length; + + while (i--) { + windows[i].close(); + } + }); + + /** + * Opens a new window. + * + * @method open + * @param {Object} args Optional name/value settings collection contains things like width/height/url etc. + * @option {String} title Window title. + * @option {String} file URL of the file to open in the window. + * @option {Number} width Width in pixels. + * @option {Number} height Height in pixels. + * @option {Boolean} autoScroll Specifies whether the popup window can have scrollbars if required (i.e. content + * larger than the popup size specified). + */ + self.open = function(args, params) { + var win; + + editor.editorManager.setActive(editor); + + args.title = args.title || ' '; + + // Handle URL + args.url = args.url || args.file; // Legacy + if (args.url) { + args.width = parseInt(args.width || 320, 10); + args.height = parseInt(args.height || 240, 10); + } + + // Handle body + if (args.body) { + args.items = { + defaults: args.defaults, + type: args.bodyType || 'form', + items: args.body + }; + } + + if (!args.url && !args.buttons) { + args.buttons = [ + {text: 'Ok', subtype: 'primary', onclick: function() { + win.find('form')[0].submit(); + }}, + + {text: 'Cancel', onclick: function() { + win.close(); + }} + ]; + } + + win = new Window(args); + windows.push(win); + + win.on('close', function() { + var i = windows.length; + + while (i--) { + if (windows[i] === win) { + windows.splice(i, 1); + } + } + + if (!windows.length) { + editor.focus(); + } + }); + + // Handle data + if (args.data) { + win.on('postRender', function() { + this.find('*').each(function(ctrl) { + var name = ctrl.name(); + + if (name in args.data) { + ctrl.value(args.data[name]); + } + }); + }); + } + + // store args and parameters + win.features = args || {}; + win.params = params || {}; + + // Takes a snapshot in the FocusManager of the selection before focus is lost to dialog + if (windows.length === 1) { + editor.nodeChanged(); + } + + return win.renderTo().reflow(); + }; + + /** + * Creates a alert dialog. Please don't use the blocking behavior of this + * native version use the callback method instead then it can be extended. + * + * @method alert + * @param {String} message Text to display in the new alert dialog. + * @param {function} callback Callback function to be executed after the user has selected ok. + * @param {Object} scope Optional scope to execute the callback in. + * @example + * // Displays an alert box using the active editors window manager instance + * tinymce.activeEditor.windowManager.alert('Hello world!'); + */ + self.alert = function(message, callback, scope) { + MessageBox.alert(message, function() { + if (callback) { + callback.call(scope || this); + } else { + editor.focus(); + } + }); + }; + + /** + * Creates a confirm dialog. Please don't use the blocking behavior of this + * native version use the callback method instead then it can be extended. + * + * @method confirm + * @param {String} messageText to display in the new confirm dialog. + * @param {function} callback Callback function to be executed after the user has selected ok or cancel. + * @param {Object} scope Optional scope to execute the callback in. + * @example + * // Displays an confirm box and an alert message will be displayed depending on what you choose in the confirm + * tinymce.activeEditor.windowManager.confirm("Do you want to do something", function(s) { + * if (s) + * tinymce.activeEditor.windowManager.alert("Ok"); + * else + * tinymce.activeEditor.windowManager.alert("Cancel"); + * }); + */ + self.confirm = function(message, callback, scope) { + MessageBox.confirm(message, function(state) { + callback.call(scope || this, state); + }); + }; + + /** + * Closes the top most window. + * + * @method close + */ + self.close = function() { + if (getTopMostWindow()) { + getTopMostWindow().close(); + } + }; + + /** + * Returns the params of the last window open call. This can be used in iframe based + * dialog to get params passed from the tinymce plugin. + * + * @example + * var dialogArguments = top.tinymce.activeEditor.windowManager.getParams(); + * + * @method getParams + * @return {Object} Name/value object with parameters passed from windowManager.open call. + */ + self.getParams = function() { + return getTopMostWindow() ? getTopMostWindow().params : null; + }; + + /** + * Sets the params of the last opened window. + * + * @method setParams + * @param {Object} params Params object to set for the last opened window. + */ + self.setParams = function(params) { + if (getTopMostWindow()) { + getTopMostWindow().params = params; + } + }; + + /** + * Returns the currently opened window objects. + * + * @method getWindows + * @return {Array} Array of the currently opened windows. + */ + self.getWindows = function() { + return windows; + }; + }; +}); + +// Included from: js/tinymce/classes/util/Quirks.js + +/** + * Quirks.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + * + * @ignore-file + */ + +/** + * This file includes fixes for various browser quirks it's made to make it easy to add/remove browser specific fixes. + * + * @class tinymce.util.Quirks + */ +define("tinymce/util/Quirks", [ + "tinymce/util/VK", + "tinymce/dom/RangeUtils", + "tinymce/dom/TreeWalker", + "tinymce/html/Node", + "tinymce/html/Entities", + "tinymce/Env", + "tinymce/util/Tools" +], function(VK, RangeUtils, TreeWalker, Node, Entities, Env, Tools) { + return function(editor) { + var each = Tools.each, $ = editor.$; + var BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE, dom = editor.dom, selection = editor.selection, + settings = editor.settings, parser = editor.parser, serializer = editor.serializer; + var isGecko = Env.gecko, isIE = Env.ie, isWebKit = Env.webkit; + var mceInternalUrlPrefix = 'data:text/mce-internal,'; + var mceInternalDataType = isIE ? 'Text' : 'URL'; + + /** + * Executes a command with a specific state this can be to enable/disable browser editing features. + */ + function setEditorCommandState(cmd, state) { + try { + editor.getDoc().execCommand(cmd, false, state); + } catch (ex) { + // Ignore + } + } + + /** + * Returns current IE document mode. + */ + function getDocumentMode() { + var documentMode = editor.getDoc().documentMode; + + return documentMode ? documentMode : 6; + } + + /** + * Returns true/false if the event is prevented or not. + * + * @private + * @param {Event} e Event object. + * @return {Boolean} true/false if the event is prevented or not. + */ + function isDefaultPrevented(e) { + return e.isDefaultPrevented(); + } + + /** + * Sets Text/URL data on the event's dataTransfer object to a special data:text/mce-internal url. + * This is to workaround the inability to set custom contentType on IE and Safari. + * The editor's selected content is encoded into this url so drag and drop between editors will work. + * + * @private + * @param {DragEvent} e Event object + */ + function setMceInteralContent(e) { + var selectionHtml; + + if (e.dataTransfer) { + if (editor.selection.isCollapsed() && e.target.tagName == 'IMG') { + selection.select(e.target); + } + + selectionHtml = editor.selection.getContent(); + + // Safari/IE doesn't support custom dataTransfer items so we can only use URL and Text + if (selectionHtml.length > 0) { + e.dataTransfer.setData(mceInternalDataType, mceInternalUrlPrefix + escape(selectionHtml)); + } + } + } + + /** + * Gets content of special data:text/mce-internal url on the event's dataTransfer object. + * This is to workaround the inability to set custom contentType on IE and Safari. + * The editor's selected content is encoded into this url so drag and drop between editors will work. + * + * @private + * @param {DragEvent} e Event object + * @returns {String} mce-internal content + */ + function getMceInternalContent(e) { + var internalContent, content; + + if (e.dataTransfer) { + internalContent = e.dataTransfer.getData(mceInternalDataType); + + if (internalContent && internalContent.indexOf(mceInternalUrlPrefix) >= 0) { + content = unescape(internalContent.substr(mceInternalUrlPrefix.length)); + } + } + + return content; + } + + /** + * Inserts contents using the paste clipboard command if it's available if it isn't it will fallback + * to the core command. + * + * @private + * @param {String} content Content to insert at selection. + */ + function insertClipboardContents(content) { + if (editor.queryCommandSupported('mceInsertClipboardContent')) { + editor.execCommand('mceInsertClipboardContent', false, {content: content}); + } else { + editor.execCommand('mceInsertContent', false, content); + } + } + + /** + * Fixes a WebKit bug when deleting contents using backspace or delete key. + * WebKit will produce a span element if you delete across two block elements. + * + * Example: + *

    a

    |b

    + * + * Will produce this on backspace: + *

    ab

    + * + * This fixes the backspace to produce: + *

    a|b

    + * + * See bug: https://bugs.webkit.org/show_bug.cgi?id=45784 + * + * This fixes the following delete scenarios: + * 1. Delete by pressing backspace key. + * 2. Delete by pressing delete key. + * 3. Delete by pressing backspace key with ctrl/cmd (Word delete). + * 4. Delete by pressing delete key with ctrl/cmd (Word delete). + * 5. Delete by drag/dropping contents inside the editor. + * 6. Delete by using Cut Ctrl+X/Cmd+X. + * 7. Delete by selecting contents and writing a character. + * + * This code is a ugly hack since writing full custom delete logic for just this bug + * fix seemed like a huge task. I hope we can remove this before the year 2030. + */ + function cleanupStylesWhenDeleting() { + var doc = editor.getDoc(), dom = editor.dom, selection = editor.selection; + var MutationObserver = window.MutationObserver, olderWebKit, dragStartRng; + + // Add mini polyfill for older WebKits + // TODO: Remove this when old Safari versions gets updated + if (!MutationObserver) { + olderWebKit = true; + + MutationObserver = function() { + var records = [], target; + + function nodeInsert(e) { + var target = e.relatedNode || e.target; + records.push({target: target, addedNodes: [target]}); + } + + function attrModified(e) { + var target = e.relatedNode || e.target; + records.push({target: target, attributeName: e.attrName}); + } + + this.observe = function(node) { + target = node; + target.addEventListener('DOMSubtreeModified', nodeInsert, false); + target.addEventListener('DOMNodeInsertedIntoDocument', nodeInsert, false); + target.addEventListener('DOMNodeInserted', nodeInsert, false); + target.addEventListener('DOMAttrModified', attrModified, false); + }; + + this.disconnect = function() { + target.removeEventListener('DOMSubtreeModified', nodeInsert, false); + target.removeEventListener('DOMNodeInsertedIntoDocument', nodeInsert, false); + target.removeEventListener('DOMNodeInserted', nodeInsert, false); + target.removeEventListener('DOMAttrModified', attrModified, false); + }; + + this.takeRecords = function() { + return records; + }; + }; + } + + function isTrailingBr(node) { + var blockElements = dom.schema.getBlockElements(), rootNode = editor.getBody(); + + if (node.nodeName != 'BR') { + return false; + } + + for (node = node; node != rootNode && !blockElements[node.nodeName]; node = node.parentNode) { + if (node.nextSibling) { + return false; + } + } + + return true; + } + + function isSiblingsIgnoreWhiteSpace(node1, node2) { + var node; + + for (node = node1.nextSibling; node && node != node2; node = node.nextSibling) { + if (node.nodeType == 3 && $.trim(node.data).length === 0) { + continue; + } + + if (node !== node2) { + return false; + } + } + + return node === node2; + } + + function findCaretNode(node, forward, startNode) { + var walker, current, nonEmptyElements; + + nonEmptyElements = dom.schema.getNonEmptyElements(); + + walker = new TreeWalker(startNode || node, node); + + while ((current = walker[forward ? 'next' : 'prev']())) { + if (nonEmptyElements[current.nodeName] && !isTrailingBr(current)) { + return current; + } + + if (current.nodeType == 3 && current.data.length > 0) { + return current; + } + } + } + + function deleteRangeBetweenTextBlocks(rng) { + var startBlock, endBlock, caretNodeBefore, caretNodeAfter, textBlockElements; + + if (rng.collapsed) { + return; + } + + startBlock = dom.getParent(RangeUtils.getNode(rng.startContainer, rng.startOffset), dom.isBlock); + endBlock = dom.getParent(RangeUtils.getNode(rng.endContainer, rng.endOffset), dom.isBlock); + textBlockElements = editor.schema.getTextBlockElements(); + + if (startBlock == endBlock) { + return; + } + + if (!textBlockElements[startBlock.nodeName] || !textBlockElements[endBlock.nodeName]) { + return; + } + + if (dom.getContentEditable(startBlock) === "false" || dom.getContentEditable(endBlock) === "false") { + return; + } + + rng.deleteContents(); + + caretNodeBefore = findCaretNode(startBlock, false); + caretNodeAfter = findCaretNode(endBlock, true); + + if (!dom.isEmpty(endBlock)) { + $(startBlock).append(endBlock.childNodes); + } + + $(endBlock).remove(); + + if (caretNodeBefore) { + if (caretNodeBefore.nodeType == 1) { + if (caretNodeBefore.nodeName == "BR") { + rng.setStartBefore(caretNodeBefore); + rng.setEndBefore(caretNodeBefore); + } else { + rng.setStartAfter(caretNodeBefore); + rng.setEndAfter(caretNodeBefore); + } + } else { + rng.setStart(caretNodeBefore, caretNodeBefore.data.length); + rng.setEnd(caretNodeBefore, caretNodeBefore.data.length); + } + } else if (caretNodeAfter) { + if (caretNodeAfter.nodeType == 1) { + rng.setStartBefore(caretNodeAfter); + rng.setEndBefore(caretNodeAfter); + } else { + rng.setStart(caretNodeAfter, 0); + rng.setEnd(caretNodeAfter, 0); + } + } + + selection.setRng(rng); + + return true; + } + + function expandBetweenBlocks(rng, isForward) { + var caretNode, targetCaretNode, textBlock, targetTextBlock, container, offset; + + if (!rng.collapsed) { + return rng; + } + + container = rng.startContainer; + offset = rng.startOffset; + + if (container.nodeType == 3) { + if (isForward) { + if (offset < container.data.length) { + return rng; + } + } else { + if (offset > 0) { + return rng; + } + } + } + + caretNode = RangeUtils.getNode(rng.startContainer, rng.startOffset); + textBlock = dom.getParent(caretNode, dom.isBlock); + targetCaretNode = findCaretNode(editor.getBody(), isForward, caretNode); + targetTextBlock = dom.getParent(targetCaretNode, dom.isBlock); + + if (!caretNode || !targetCaretNode) { + return rng; + } + + if (targetTextBlock && textBlock != targetTextBlock) { + if (!isForward) { + if (!isSiblingsIgnoreWhiteSpace(targetTextBlock, textBlock)) { + return rng; + } + + if (targetCaretNode.nodeType == 1) { + if (targetCaretNode.nodeName == "BR") { + rng.setStartBefore(targetCaretNode); + } else { + rng.setStartAfter(targetCaretNode); + } + } else { + rng.setStart(targetCaretNode, targetCaretNode.data.length); + } + + if (caretNode.nodeType == 1) { + rng.setEnd(caretNode, 0); + } else { + rng.setEndBefore(caretNode); + } + } else { + if (!isSiblingsIgnoreWhiteSpace(textBlock, targetTextBlock)) { + return rng; + } + + if (caretNode.nodeType == 1) { + if (caretNode.nodeName == "BR") { + rng.setStartBefore(caretNode); + } else { + rng.setStartAfter(caretNode); + } + } else { + rng.setStart(caretNode, caretNode.data.length); + } + + if (targetCaretNode.nodeType == 1) { + rng.setEnd(targetCaretNode, 0); + } else { + rng.setEndBefore(targetCaretNode); + } + } + } + + return rng; + } + + function handleTextBlockMergeDelete(isForward) { + var rng = selection.getRng(); + + rng = expandBetweenBlocks(rng, isForward); + + if (deleteRangeBetweenTextBlocks(rng)) { + return true; + } + } + + function customDelete(isForward) { + var mutationObserver, rng, caretElement; + + if (handleTextBlockMergeDelete(isForward)) { + return; + } + + Tools.each(editor.getBody().getElementsByTagName('*'), function(elm) { + // Mark existing spans + if (elm.tagName == 'SPAN') { + elm.setAttribute('mce-data-marked', 1); + } + + // Make sure all elements has a data-mce-style attribute + if (!elm.hasAttribute('data-mce-style') && elm.hasAttribute('style')) { + editor.dom.setAttrib(elm, 'style', editor.dom.getAttrib(elm, 'style')); + } + }); + + // Observe added nodes and style attribute changes + mutationObserver = new MutationObserver(function() {}); + mutationObserver.observe(editor.getDoc(), { + childList: true, + attributes: true, + subtree: true, + attributeFilter: ['style'] + }); + + editor.getDoc().execCommand(isForward ? 'ForwardDelete' : 'Delete', false, null); + + rng = editor.selection.getRng(); + caretElement = rng.startContainer.parentNode; + + Tools.each(mutationObserver.takeRecords(), function(record) { + if (!dom.isChildOf(record.target, editor.getBody())) { + return; + } + + // Restore style attribute to previous value + if (record.attributeName == "style") { + var oldValue = record.target.getAttribute('data-mce-style'); + + if (oldValue) { + record.target.setAttribute("style", oldValue); + } else { + record.target.removeAttribute("style"); + } + } + + // Remove all spans that isn't maked and retain selection + Tools.each(record.addedNodes, function(node) { + if (node.nodeName == "SPAN" && !node.getAttribute('mce-data-marked')) { + var offset, container; + + if (node == caretElement) { + offset = rng.startOffset; + container = node.firstChild; + } + + dom.remove(node, true); + + if (container) { + rng.setStart(container, offset); + rng.setEnd(container, offset); + editor.selection.setRng(rng); + } + } + }); + }); + + mutationObserver.disconnect(); + + // Remove any left over marks + Tools.each(editor.dom.select('span[mce-data-marked]'), function(span) { + span.removeAttribute('mce-data-marked'); + }); + } + + editor.on('keydown', function(e) { + var isForward = e.keyCode == DELETE, isMetaOrCtrl = e.ctrlKey || e.metaKey; + + if (!isDefaultPrevented(e) && (isForward || e.keyCode == BACKSPACE)) { + var rng = editor.selection.getRng(), container = rng.startContainer, offset = rng.startOffset; + + // Ignore non meta delete in the where there is text before/after the caret + if (!isMetaOrCtrl && rng.collapsed && container.nodeType == 3) { + if (isForward ? offset < container.data.length : offset > 0) { + return; + } + } + + e.preventDefault(); + + if (isMetaOrCtrl) { + editor.selection.getSel().modify("extend", isForward ? "forward" : "backward", e.metaKey ? "lineboundary" : "word"); + } + + customDelete(isForward); + } + }); + + // Handle case where text is deleted by typing over + editor.on('keypress', function(e) { + if (!isDefaultPrevented(e) && !selection.isCollapsed() && e.charCode && !VK.metaKeyPressed(e)) { + var rng, currentFormatNodes, fragmentNode, blockParent, caretNode, charText; + + rng = editor.selection.getRng(); + charText = String.fromCharCode(e.charCode); + e.preventDefault(); + + // Keep track of current format nodes + currentFormatNodes = $(rng.startContainer).parents().filter(function(idx, node) { + return !!editor.schema.getTextInlineElements()[node.nodeName]; + }); + + customDelete(true); + + // Check if the browser removed them + currentFormatNodes = currentFormatNodes.filter(function(idx, node) { + return !$.contains(editor.getBody(), node); + }); + + // Then re-add them + if (currentFormatNodes.length) { + fragmentNode = dom.createFragment(); + + currentFormatNodes.each(function(idx, formatNode) { + formatNode = formatNode.cloneNode(false); + + if (fragmentNode.hasChildNodes()) { + formatNode.appendChild(fragmentNode.firstChild); + fragmentNode.appendChild(formatNode); + } else { + caretNode = formatNode; + fragmentNode.appendChild(formatNode); + } + + fragmentNode.appendChild(formatNode); + }); + + caretNode.appendChild(editor.getDoc().createTextNode(charText)); + + // Prevent edge case where older WebKit would add an extra BR element + blockParent = dom.getParent(rng.startContainer, dom.isBlock); + if (dom.isEmpty(blockParent)) { + $(blockParent).empty().append(fragmentNode); + } else { + rng.insertNode(fragmentNode); + } + + rng.setStart(caretNode.firstChild, 1); + rng.setEnd(caretNode.firstChild, 1); + editor.selection.setRng(rng); + } else { + editor.selection.setContent(charText); + } + } + }); + + editor.addCommand('Delete', function() { + customDelete(); + }); + + editor.addCommand('ForwardDelete', function() { + customDelete(true); + }); + + // Older WebKits doesn't properly handle the clipboard so we can't add the rest + if (olderWebKit) { + return; + } + + editor.on('dragstart', function(e) { + dragStartRng = selection.getRng(); + setMceInteralContent(e); + }); + + editor.on('drop', function(e) { + if (!isDefaultPrevented(e)) { + var internalContent = getMceInternalContent(e); + if (internalContent) { + e.preventDefault(); + + // Safari has a weird issue where drag/dropping images sometimes + // produces a green plus icon. When this happens the caretRangeFromPoint + // will return "null" even though the x, y coordinate is correct. + // But if we detach the insert from the drop event we will get a proper range + window.setTimeout(function() { + var pointRng = RangeUtils.getCaretRangeFromPoint(e.x, e.y, doc); + + if (dragStartRng) { + selection.setRng(dragStartRng); + dragStartRng = null; + } + + customDelete(); + selection.setRng(pointRng); + insertClipboardContents(internalContent); + }, 0); + } + } + }); + + editor.on('cut', function(e) { + if (!isDefaultPrevented(e) && e.clipboardData) { + e.preventDefault(); + e.clipboardData.clearData(); + e.clipboardData.setData('text/html', editor.selection.getContent()); + e.clipboardData.setData('text/plain', editor.selection.getContent({format: 'text'})); + customDelete(true); + } + }); + } + + /** + * Makes sure that the editor body becomes empty when backspace or delete is pressed in empty editors. + * + * For example: + *

    |

    + * + * Or: + *

    |

    + * + * Or: + * [

    ] + */ + function emptyEditorWhenDeleting() { + function serializeRng(rng) { + var body = dom.create("body"); + var contents = rng.cloneContents(); + body.appendChild(contents); + return selection.serializer.serialize(body, {format: 'html'}); + } + + function allContentsSelected(rng) { + if (!rng.setStart) { + if (rng.item) { + return false; + } + + var bodyRng = rng.duplicate(); + bodyRng.moveToElementText(editor.getBody()); + return RangeUtils.compareRanges(rng, bodyRng); + } + + var selection = serializeRng(rng); + + var allRng = dom.createRng(); + allRng.selectNode(editor.getBody()); + + var allSelection = serializeRng(allRng); + return selection === allSelection; + } + + editor.on('keydown', function(e) { + var keyCode = e.keyCode, isCollapsed, body; + + // Empty the editor if it's needed for example backspace at

    |

    + if (!isDefaultPrevented(e) && (keyCode == DELETE || keyCode == BACKSPACE)) { + isCollapsed = editor.selection.isCollapsed(); + body = editor.getBody(); + + // Selection is collapsed but the editor isn't empty + if (isCollapsed && !dom.isEmpty(body)) { + return; + } + + // Selection isn't collapsed but not all the contents is selected + if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) { + return; + } + + // Manually empty the editor + e.preventDefault(); + editor.setContent(''); + + if (body.firstChild && dom.isBlock(body.firstChild)) { + editor.selection.setCursorLocation(body.firstChild, 0); + } else { + editor.selection.setCursorLocation(body, 0); + } + + editor.nodeChanged(); + } + }); + } + + /** + * WebKit doesn't select all the nodes in the body when you press Ctrl+A. + * IE selects more than the contents [

    a

    ] instead of

    [a] see bug #6438 + * This selects the whole body so that backspace/delete logic will delete everything + */ + function selectAll() { + editor.shortcuts.add('meta+a', null, 'SelectAll'); + } + + /** + * WebKit has a weird issue where it some times fails to properly convert keypresses to input method keystrokes. + * The IME on Mac doesn't initialize when it doesn't fire a proper focus event. + * + * This seems to happen when the user manages to click the documentElement element then the window doesn't get proper focus until + * you enter a character into the editor. + * + * It also happens when the first focus in made to the body. + * + * See: https://bugs.webkit.org/show_bug.cgi?id=83566 + */ + function inputMethodFocus() { + if (!editor.settings.content_editable) { + // Case 1 IME doesn't initialize if you focus the document + dom.bind(editor.getDoc(), 'focusin', function() { + selection.setRng(selection.getRng()); + }); + + // Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event + // Needs to be both down/up due to weird rendering bug on Chrome Windows + dom.bind(editor.getDoc(), 'mousedown mouseup', function(e) { + if (e.target == editor.getDoc().documentElement) { + editor.getBody().focus(); + + if (e.type == 'mousedown') { + // Edge case for mousedown, drag select and mousedown again within selection on Chrome Windows to render caret + selection.placeCaretAt(e.clientX, e.clientY); + } else { + selection.setRng(selection.getRng()); + } + } + }); + } + } + + /** + * Backspacing in FireFox/IE from a paragraph into a horizontal rule results in a floating text node because the + * browser just deletes the paragraph - the browser fails to merge the text node with a horizontal rule so it is + * left there. TinyMCE sees a floating text node and wraps it in a paragraph on the key up event (ForceBlocks.js + * addRootBlocks), meaning the action does nothing. With this code, FireFox/IE matche the behaviour of other + * browsers. + * + * It also fixes a bug on Firefox where it's impossible to delete HR elements. + */ + function removeHrOnBackspace() { + editor.on('keydown', function(e) { + if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) { + // Check if there is any HR elements this is faster since getRng on IE 7 & 8 is slow + if (!editor.getBody().getElementsByTagName('hr').length) { + return; + } + + if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) { + var node = selection.getNode(); + var previousSibling = node.previousSibling; + + if (node.nodeName == 'HR') { + dom.remove(node); + e.preventDefault(); + return; + } + + if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "hr") { + dom.remove(previousSibling); + e.preventDefault(); + } + } + } + }); + } + + /** + * Firefox 3.x has an issue where the body element won't get proper focus if you click out + * side it's rectangle. + */ + function focusBody() { + // Fix for a focus bug in FF 3.x where the body element + // wouldn't get proper focus if the user clicked on the HTML element + if (!window.Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4 + editor.on('mousedown', function(e) { + if (!isDefaultPrevented(e) && e.target.nodeName === "HTML") { + var body = editor.getBody(); + + // Blur the body it's focused but not correctly focused + body.blur(); + + // Refocus the body after a little while + setTimeout(function() { + body.focus(); + }, 0); + } + }); + } + } + + /** + * WebKit has a bug where it isn't possible to select image, hr or anchor elements + * by clicking on them so we need to fake that. + */ + function selectControlElements() { + editor.on('click', function(e) { + var target = e.target; + + // Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250 + // WebKit can't even do simple things like selecting an image + // Needs to be the setBaseAndExtend or it will fail to select floated images + if (/^(IMG|HR)$/.test(target.nodeName)) { + e.preventDefault(); + selection.getSel().setBaseAndExtent(target, 0, target, 1); + editor.nodeChanged(); + } + + if (target.nodeName == 'A' && dom.hasClass(target, 'mce-item-anchor')) { + e.preventDefault(); + selection.select(target); + } + }); + } + + /** + * Fixes a Gecko bug where the style attribute gets added to the wrong element when deleting between two block elements. + * + * Fixes do backspace/delete on this: + *

    bla[ck

    r]ed

    + * + * Would become: + *

    bla|ed

    + * + * Instead of: + *

    bla|ed

    + */ + function removeStylesWhenDeletingAcrossBlockElements() { + function getAttributeApplyFunction() { + var template = dom.getAttribs(selection.getStart().cloneNode(false)); + + return function() { + var target = selection.getStart(); + + if (target !== editor.getBody()) { + dom.setAttrib(target, "style", null); + + each(template, function(attr) { + target.setAttributeNode(attr.cloneNode(true)); + }); + } + }; + } + + function isSelectionAcrossElements() { + return !selection.isCollapsed() && + dom.getParent(selection.getStart(), dom.isBlock) != dom.getParent(selection.getEnd(), dom.isBlock); + } + + editor.on('keypress', function(e) { + var applyAttributes; + + if (!isDefaultPrevented(e) && (e.keyCode == 8 || e.keyCode == 46) && isSelectionAcrossElements()) { + applyAttributes = getAttributeApplyFunction(); + editor.getDoc().execCommand('delete', false, null); + applyAttributes(); + e.preventDefault(); + return false; + } + }); + + dom.bind(editor.getDoc(), 'cut', function(e) { + var applyAttributes; + + if (!isDefaultPrevented(e) && isSelectionAcrossElements()) { + applyAttributes = getAttributeApplyFunction(); + + setTimeout(function() { + applyAttributes(); + }, 0); + } + }); + } + + /** + * Screen readers on IE needs to have the role application set on the body. + */ + function ensureBodyHasRoleApplication() { + document.body.setAttribute("role", "application"); + } + + /** + * Backspacing into a table behaves differently depending upon browser type. + * Therefore, disable Backspace when cursor immediately follows a table. + */ + function disableBackspaceIntoATable() { + editor.on('keydown', function(e) { + if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) { + if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) { + var previousSibling = selection.getNode().previousSibling; + if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "table") { + e.preventDefault(); + return false; + } + } + } + }); + } + + /** + * Old IE versions can't properly render BR elements in PRE tags white in contentEditable mode. So this + * logic adds a \n before the BR so that it will get rendered. + */ + function addNewLinesBeforeBrInPre() { + // IE8+ rendering mode does the right thing with BR in PRE + if (getDocumentMode() > 7) { + return; + } + + // Enable display: none in area and add a specific class that hides all BR elements in PRE to + // avoid the caret from getting stuck at the BR elements while pressing the right arrow key + setEditorCommandState('RespectVisibilityInDesign', true); + editor.contentStyles.push('.mceHideBrInPre pre br {display: none}'); + dom.addClass(editor.getBody(), 'mceHideBrInPre'); + + // Adds a \n before all BR elements in PRE to get them visual + parser.addNodeFilter('pre', function(nodes) { + var i = nodes.length, brNodes, j, brElm, sibling; + + while (i--) { + brNodes = nodes[i].getAll('br'); + j = brNodes.length; + while (j--) { + brElm = brNodes[j]; + + // Add \n before BR in PRE elements on older IE:s so the new lines get rendered + sibling = brElm.prev; + if (sibling && sibling.type === 3 && sibling.value.charAt(sibling.value - 1) != '\n') { + sibling.value += '\n'; + } else { + brElm.parent.insert(new Node('#text', 3), brElm, true).value = '\n'; + } + } + } + }); + + // Removes any \n before BR elements in PRE since other browsers and in contentEditable=false mode they will be visible + serializer.addNodeFilter('pre', function(nodes) { + var i = nodes.length, brNodes, j, brElm, sibling; + + while (i--) { + brNodes = nodes[i].getAll('br'); + j = brNodes.length; + while (j--) { + brElm = brNodes[j]; + sibling = brElm.prev; + if (sibling && sibling.type == 3) { + sibling.value = sibling.value.replace(/\r?\n$/, ''); + } + } + } + }); + } + + /** + * Moves style width/height to attribute width/height when the user resizes an image on IE. + */ + function removePreSerializedStylesWhenSelectingControls() { + dom.bind(editor.getBody(), 'mouseup', function() { + var value, node = selection.getNode(); + + // Moved styles to attributes on IMG eements + if (node.nodeName == 'IMG') { + // Convert style width to width attribute + if ((value = dom.getStyle(node, 'width'))) { + dom.setAttrib(node, 'width', value.replace(/[^0-9%]+/g, '')); + dom.setStyle(node, 'width', ''); + } + + // Convert style height to height attribute + if ((value = dom.getStyle(node, 'height'))) { + dom.setAttrib(node, 'height', value.replace(/[^0-9%]+/g, '')); + dom.setStyle(node, 'height', ''); + } + } + }); + } + + /** + * Removes a blockquote when backspace is pressed at the beginning of it. + * + * For example: + *

    |x

    + * + * Becomes: + *

    |x

    + */ + function removeBlockQuoteOnBackSpace() { + // Add block quote deletion handler + editor.on('keydown', function(e) { + var rng, container, offset, root, parent; + + if (isDefaultPrevented(e) || e.keyCode != VK.BACKSPACE) { + return; + } + + rng = selection.getRng(); + container = rng.startContainer; + offset = rng.startOffset; + root = dom.getRoot(); + parent = container; + + if (!rng.collapsed || offset !== 0) { + return; + } + + while (parent && parent.parentNode && parent.parentNode.firstChild == parent && parent.parentNode != root) { + parent = parent.parentNode; + } + + // Is the cursor at the beginning of a blockquote? + if (parent.tagName === 'BLOCKQUOTE') { + // Remove the blockquote + editor.formatter.toggle('blockquote', null, parent); + + // Move the caret to the beginning of container + rng = dom.createRng(); + rng.setStart(container, 0); + rng.setEnd(container, 0); + selection.setRng(rng); + } + }); + } + + /** + * Sets various Gecko editing options on mouse down and before a execCommand to disable inline table editing that is broken etc. + */ + function setGeckoEditingOptions() { + function setOpts() { + editor._refreshContentEditable(); + + setEditorCommandState("StyleWithCSS", false); + setEditorCommandState("enableInlineTableEditing", false); + + if (!settings.object_resizing) { + setEditorCommandState("enableObjectResizing", false); + } + } + + if (!settings.readonly) { + editor.on('BeforeExecCommand MouseDown', setOpts); + } + } + + /** + * Fixes a gecko link bug, when a link is placed at the end of block elements there is + * no way to move the caret behind the link. This fix adds a bogus br element after the link. + * + * For example this: + *

    x

    + * + * Becomes this: + *

    x

    + */ + function addBrAfterLastLinks() { + function fixLinks() { + each(dom.select('a'), function(node) { + var parentNode = node.parentNode, root = dom.getRoot(); + + if (parentNode.lastChild === node) { + while (parentNode && !dom.isBlock(parentNode)) { + if (parentNode.parentNode.lastChild !== parentNode || parentNode === root) { + return; + } + + parentNode = parentNode.parentNode; + } + + dom.add(parentNode, 'br', {'data-mce-bogus': 1}); + } + }); + } + + editor.on('SetContent ExecCommand', function(e) { + if (e.type == "setcontent" || e.command === 'mceInsertLink') { + fixLinks(); + } + }); + } + + /** + * WebKit will produce DIV elements here and there by default. But since TinyMCE uses paragraphs by + * default we want to change that behavior. + */ + function setDefaultBlockType() { + if (settings.forced_root_block) { + editor.on('init', function() { + setEditorCommandState('DefaultParagraphSeparator', settings.forced_root_block); + }); + } + } + + /** + * Removes ghost selections from images/tables on Gecko. + */ + function removeGhostSelection() { + editor.on('Undo Redo SetContent', function(e) { + if (!e.initial) { + editor.execCommand('mceRepaint'); + } + }); + } + + /** + * Deletes the selected image on IE instead of navigating to previous page. + */ + function deleteControlItemOnBackSpace() { + editor.on('keydown', function(e) { + var rng; + + if (!isDefaultPrevented(e) && e.keyCode == BACKSPACE) { + rng = editor.getDoc().selection.createRange(); + if (rng && rng.item) { + e.preventDefault(); + editor.undoManager.beforeChange(); + dom.remove(rng.item(0)); + editor.undoManager.add(); + } + } + }); + } + + /** + * IE10 doesn't properly render block elements with the right height until you add contents to them. + * This fixes that by adding a padding-right to all empty text block elements. + * See: https://connect.microsoft.com/IE/feedback/details/743881 + */ + function renderEmptyBlocksFix() { + var emptyBlocksCSS; + + // IE10+ + if (getDocumentMode() >= 10) { + emptyBlocksCSS = ''; + each('p div h1 h2 h3 h4 h5 h6'.split(' '), function(name, i) { + emptyBlocksCSS += (i > 0 ? ',' : '') + name + ':empty'; + }); + + editor.contentStyles.push(emptyBlocksCSS + '{padding-right: 1px !important}'); + } + } + + /** + * Old IE versions can't retain contents within noscript elements so this logic will store the contents + * as a attribute and the insert that value as it's raw text when the DOM is serialized. + */ + function keepNoScriptContents() { + if (getDocumentMode() < 9) { + parser.addNodeFilter('noscript', function(nodes) { + var i = nodes.length, node, textNode; + + while (i--) { + node = nodes[i]; + textNode = node.firstChild; + + if (textNode) { + node.attr('data-mce-innertext', textNode.value); + } + } + }); + + serializer.addNodeFilter('noscript', function(nodes) { + var i = nodes.length, node, textNode, value; + + while (i--) { + node = nodes[i]; + textNode = nodes[i].firstChild; + + if (textNode) { + textNode.value = Entities.decode(textNode.value); + } else { + // Old IE can't retain noscript value so an attribute is used to store it + value = node.attributes.map['data-mce-innertext']; + if (value) { + node.attr('data-mce-innertext', null); + textNode = new Node('#text', 3); + textNode.value = value; + textNode.raw = true; + node.append(textNode); + } + } + } + }); + } + } + + /** + * IE has an issue where you can't select/move the caret by clicking outside the body if the document is in standards mode. + */ + function fixCaretSelectionOfDocumentElementOnIe() { + var doc = dom.doc, body = doc.body, started, startRng, htmlElm; + + // Return range from point or null if it failed + function rngFromPoint(x, y) { + var rng = body.createTextRange(); + + try { + rng.moveToPoint(x, y); + } catch (ex) { + // IE sometimes throws and exception, so lets just ignore it + rng = null; + } + + return rng; + } + + // Fires while the selection is changing + function selectionChange(e) { + var pointRng; + + // Check if the button is down or not + if (e.button) { + // Create range from mouse position + pointRng = rngFromPoint(e.x, e.y); + + if (pointRng) { + // Check if pointRange is before/after selection then change the endPoint + if (pointRng.compareEndPoints('StartToStart', startRng) > 0) { + pointRng.setEndPoint('StartToStart', startRng); + } else { + pointRng.setEndPoint('EndToEnd', startRng); + } + + pointRng.select(); + } + } else { + endSelection(); + } + } + + // Removes listeners + function endSelection() { + var rng = doc.selection.createRange(); + + // If the range is collapsed then use the last start range + if (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0) { + startRng.select(); + } + + dom.unbind(doc, 'mouseup', endSelection); + dom.unbind(doc, 'mousemove', selectionChange); + startRng = started = 0; + } + + // Make HTML element unselectable since we are going to handle selection by hand + doc.documentElement.unselectable = true; + + // Detect when user selects outside BODY + dom.bind(doc, 'mousedown contextmenu', function(e) { + if (e.target.nodeName === 'HTML') { + if (started) { + endSelection(); + } + + // Detect vertical scrollbar, since IE will fire a mousedown on the scrollbar and have target set as HTML + htmlElm = doc.documentElement; + if (htmlElm.scrollHeight > htmlElm.clientHeight) { + return; + } + + started = 1; + // Setup start position + startRng = rngFromPoint(e.x, e.y); + if (startRng) { + // Listen for selection change events + dom.bind(doc, 'mouseup', endSelection); + dom.bind(doc, 'mousemove', selectionChange); + + dom.getRoot().focus(); + startRng.select(); + } + } + }); + } + + /** + * Fixes selection issues where the caret can be placed between two inline elements like a|b + * this fix will lean the caret right into the closest inline element. + */ + function normalizeSelection() { + // Normalize selection for example a|a becomes a|a except for Ctrl+A since it selects everything + editor.on('keyup focusin mouseup', function(e) { + if (e.keyCode != 65 || !VK.metaKeyPressed(e)) { + selection.normalize(); + } + }, true); + } + + /** + * Forces Gecko to render a broken image icon if it fails to load an image. + */ + function showBrokenImageIcon() { + editor.contentStyles.push( + 'img:-moz-broken {' + + '-moz-force-broken-image-icon:1;' + + 'min-width:24px;' + + 'min-height:24px' + + '}' + ); + } + + /** + * iOS has a bug where it's impossible to type if the document has a touchstart event + * bound and the user touches the document while having the on screen keyboard visible. + * + * The touch event moves the focus to the parent document while having the caret inside the iframe + * this fix moves the focus back into the iframe document. + */ + function restoreFocusOnKeyDown() { + if (!editor.inline) { + editor.on('keydown', function() { + if (document.activeElement == document.body) { + editor.getWin().focus(); + } + }); + } + } + + /** + * IE 11 has an annoying issue where you can't move focus into the editor + * by clicking on the white area HTML element. We used to be able to to fix this with + * the fixCaretSelectionOfDocumentElementOnIe fix. But since M$ removed the selection + * object it's not possible anymore. So we need to hack in a ungly CSS to force the + * body to be at least 150px. If the user clicks the HTML element out side this 150px region + * we simply move the focus into the first paragraph. Not ideal since you loose the + * positioning of the caret but goot enough for most cases. + */ + function bodyHeight() { + if (!editor.inline) { + editor.contentStyles.push('body {min-height: 150px}'); + editor.on('click', function(e) { + if (e.target.nodeName == 'HTML') { + var rng; + + // Need to store away non collapsed ranges since the focus call will mess that up see #7382 + rng = editor.selection.getRng(); + editor.getBody().focus(); + editor.selection.setRng(rng); + editor.selection.normalize(); + editor.nodeChanged(); + } + }); + } + } + + /** + * Firefox on Mac OS will move the browser back to the previous page if you press CMD+Left arrow. + * You might then loose all your work so we need to block that behavior and replace it with our own. + */ + function blockCmdArrowNavigation() { + if (Env.mac) { + editor.on('keydown', function(e) { + if (VK.metaKeyPressed(e) && (e.keyCode == 37 || e.keyCode == 39)) { + e.preventDefault(); + editor.selection.getSel().modify('move', e.keyCode == 37 ? 'backward' : 'forward', 'lineboundary'); + } + }); + } + } + + /** + * Disables the autolinking in IE 9+ this is then re-enabled by the autolink plugin. + */ + function disableAutoUrlDetect() { + setEditorCommandState("AutoUrlDetect", false); + } + + /** + * IE 11 has a fantastic bug where it will produce two trailing BR elements to iframe bodies when + * the iframe is hidden by display: none on a parent container. The DOM is actually out of sync + * with innerHTML in this case. It's like IE adds shadow DOM BR elements that appears on innerHTML + * but not as the lastChild of the body. However is we add a BR element to the body then remove it + * it doesn't seem to add these BR elements makes sence right?! + * + * Example of what happens: text becomes text

    + */ + function doubleTrailingBrElements() { + if (!editor.inline) { + editor.on('focus blur beforegetcontent', function() { + var br = editor.dom.create('br'); + editor.getBody().appendChild(br); + br.parentNode.removeChild(br); + }, true); + } + } + + /** + * iOS 7.1 introduced two new bugs: + * 1) It's possible to open links within a contentEditable area by clicking on them. + * 2) If you hold down the finger it will display the link/image touch callout menu. + */ + function tapLinksAndImages() { + editor.on('click', function(e) { + var elm = e.target; + + do { + if (elm.tagName === 'A') { + e.preventDefault(); + return; + } + } while ((elm = elm.parentNode)); + }); + + editor.contentStyles.push('.mce-content-body {-webkit-touch-callout: none}'); + } + + /** + * iOS Safari and possible other browsers have a bug where it won't fire + * a click event when a contentEditable is focused. This function fakes click events + * by using touchstart/touchend and measuring the time and distance travelled. + */ + function touchClickEvent() { + editor.on('touchstart', function(e) { + var elm, time, startTouch, changedTouches; + + elm = e.target; + time = new Date().getTime(); + changedTouches = e.changedTouches; + + if (!changedTouches || changedTouches.length > 1) { + return; + } + + startTouch = changedTouches[0]; + + editor.once('touchend', function(e) { + var endTouch = e.changedTouches[0], args; + + if (new Date().getTime() - time > 500) { + return; + } + + if (Math.abs(startTouch.clientX - endTouch.clientX) > 5) { + return; + } + + if (Math.abs(startTouch.clientY - endTouch.clientY) > 5) { + return; + } + + args = { + target: elm + }; + + each('pageX pageY clientX clientY screenX screenY'.split(' '), function(key) { + args[key] = endTouch[key]; + }); + + args = editor.fire('click', args); + + if (!args.isDefaultPrevented()) { + // iOS WebKit can't place the caret properly once + // you bind touch events so we need to do this manually + // TODO: Expand to the closest word? Touble tap still works. + editor.selection.placeCaretAt(endTouch.clientX, endTouch.clientY); + editor.nodeChanged(); + } + }); + }); + } + + /** + * WebKit has a bug where it will allow forms to be submitted if they are inside a contentEditable element. + * For example this:
    ' + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/ButtonGroup.js + +/** + * ButtonGroup.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This control enables you to put multiple buttons into a group. This is + * useful when you want to combine similar toolbar buttons into a group. + * + * @example + * // Create and render a buttongroup with two buttons to the body element + * tinymce.ui.Factory.create({ + * type: 'buttongroup', + * items: [ + * {text: 'Button A'}, + * {text: 'Button B'} + * ] + * }).renderTo(document.body); + * + * @-x-less ButtonGroup.less + * @class tinymce.ui.ButtonGroup + * @extends tinymce.ui.Container + */ +define("tinymce/ui/ButtonGroup", [ + "tinymce/ui/Container" +], function(Container) { + "use strict"; + + return Container.extend({ + Defaults: { + defaultType: 'button', + role: 'group' + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout; + + self.addClass('btn-group'); + self.preRender(); + layout.preRender(self); + + return ( + '
    ' + + '
    ' + + (self.settings.html || '') + layout.renderHtml(self) + + '
    ' + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/Checkbox.js + +/** + * Checkbox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This control creates a custom checkbox. + * + * @example + * // Create and render a checkbox to the body element + * tinymce.ui.Factory.create({ + * type: 'checkbox', + * checked: true, + * text: 'My checkbox' + * }).renderTo(document.body); + * + * @-x-less Checkbox.less + * @class tinymce.ui.Checkbox + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Checkbox", [ + "tinymce/ui/Widget" +], function(Widget) { + "use strict"; + + return Widget.extend({ + Defaults: { + classes: "checkbox", + role: "checkbox", + checked: false + }, + + /** + * Constructs a new Checkbox instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Boolean} checked True if the checkbox should be checked by default. + */ + init: function(settings) { + var self = this; + + self._super(settings); + + self.on('click mousedown', function(e) { + e.preventDefault(); + }); + + self.on('click', function(e) { + e.preventDefault(); + + if (!self.disabled()) { + self.checked(!self.checked()); + } + }); + + self.checked(self.settings.checked); + }, + + /** + * Getter/setter function for the checked state. + * + * @method checked + * @param {Boolean} [state] State to be set. + * @return {Boolean|tinymce.ui.Checkbox} True/false or checkbox if it's a set operation. + */ + checked: function(state) { + var self = this; + + if (typeof state != "undefined") { + if (state) { + self.addClass('checked'); + } else { + self.removeClass('checked'); + } + + self._checked = state; + self.aria('checked', state); + + return self; + } + + return self._checked; + }, + + /** + * Getter/setter function for the value state. + * + * @method value + * @param {Boolean} [state] State to be set. + * @return {Boolean|tinymce.ui.Checkbox} True/false or checkbox if it's a set operation. + */ + value: function(state) { + return this.checked(state); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix; + + return ( + '
    ' + + '' + + '' + self.encode(self._text) + '' + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/ComboBox.js + +/** + * ComboBox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a combobox control. Select box that you select a value from or + * type a value into. + * + * @-x-less ComboBox.less + * @class tinymce.ui.ComboBox + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/ComboBox", [ + "tinymce/ui/Widget", + "tinymce/ui/Factory", + "tinymce/ui/DomUtils" +], function(Widget, Factory, DomUtils) { + "use strict"; + + return Widget.extend({ + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {String} placeholder Placeholder text to display. + */ + init: function(settings) { + var self = this; + + self._super(settings); + self.addClass('combobox'); + self.subinput = true; + self.ariaTarget = 'inp'; // TODO: Figure out a better way + + settings = self.settings; + settings.menu = settings.menu || settings.values; + + if (settings.menu) { + settings.icon = 'caret'; + } + + self.on('click', function(e) { + var elm = e.target, root = self.getEl(); + + while (elm && elm != root) { + if (elm.id && elm.id.indexOf('-open') != -1) { + self.fire('action'); + + if (settings.menu) { + self.showMenu(); + + if (e.aria) { + self.menu.items()[0].focus(); + } + } + } + + elm = elm.parentNode; + } + }); + + // TODO: Rework this + self.on('keydown', function(e) { + if (e.target.nodeName == "INPUT" && e.keyCode == 13) { + self.parents().reverse().each(function(ctrl) { + e.preventDefault(); + self.fire('change'); + + if (ctrl.hasEventListeners('submit') && ctrl.toJSON) { + ctrl.fire('submit', {data: ctrl.toJSON()}); + return false; + } + }); + } + }); + + if (settings.placeholder) { + self.addClass('placeholder'); + + self.on('focusin', function() { + if (!self._hasOnChange) { + DomUtils.on(self.getEl('inp'), 'change', function() { + self.fire('change'); + }); + + self._hasOnChange = true; + } + + if (self.hasClass('placeholder')) { + self.getEl('inp').value = ''; + self.removeClass('placeholder'); + } + }); + + self.on('focusout', function() { + if (self.value().length === 0) { + self.getEl('inp').value = settings.placeholder; + self.addClass('placeholder'); + } + }); + } + }, + + showMenu: function() { + var self = this, settings = self.settings, menu; + + if (!self.menu) { + menu = settings.menu || []; + + // Is menu array then auto constuct menu control + if (menu.length) { + menu = { + type: 'menu', + items: menu + }; + } else { + menu.type = menu.type || 'menu'; + } + + self.menu = Factory.create(menu).parent(self).renderTo(self.getContainerElm()); + self.fire('createmenu'); + self.menu.reflow(); + self.menu.on('cancel', function(e) { + if (e.control === self.menu) { + self.focus(); + } + }); + + self.menu.on('show hide', function(e) { + e.control.items().each(function(ctrl) { + ctrl.active(ctrl.value() == self.value()); + }); + }).fire('show'); + + self.menu.on('select', function(e) { + self.value(e.control.value()); + }); + + self.on('focusin', function(e) { + if (e.target.tagName.toUpperCase() == 'INPUT') { + self.menu.hide(); + } + }); + + self.aria('expanded', true); + } + + self.menu.show(); + self.menu.layoutRect({w: self.layoutRect().w}); + self.menu.moveRel(self.getEl(), self.isRtl() ? ['br-tr', 'tr-br'] : ['bl-tl', 'tl-bl']); + }, + + /** + * Getter/setter function for the control value. + * + * @method value + * @param {String} [value] Value to be set. + * @return {String|tinymce.ui.ComboBox} Value or self if it's a set operation. + */ + value: function(value) { + var self = this; + + if (typeof value != "undefined") { + self._value = value; + self.removeClass('placeholder'); + + if (self._rendered) { + self.getEl('inp').value = value; + } + + return self; + } + + if (self._rendered) { + value = self.getEl('inp').value; + + if (value != self.settings.placeholder) { + return value; + } + + return ''; + } + + return self._value; + }, + + /** + * Getter/setter function for the disabled state. + * + * @method value + * @param {Boolean} [state] State to be set. + * @return {Boolean|tinymce.ui.ComboBox} True/false or self if it's a set operation. + */ + disabled: function(state) { + var self = this; + + if (self._rendered && typeof state != 'undefined') { + self.getEl('inp').disabled = state; + } + + return self._super(state); + }, + + /** + * Focuses the input area of the control. + * + * @method focus + */ + focus: function() { + this.getEl('inp').focus(); + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this, elm = self.getEl(), openElm = self.getEl('open'), rect = self.layoutRect(); + var width, lineHeight; + + if (openElm) { + width = rect.w - DomUtils.getSize(openElm).width - 10; + } else { + width = rect.w - 10; + } + + // Detect old IE 7+8 add lineHeight to align caret vertically in the middle + var doc = document; + if (doc.all && (!doc.documentMode || doc.documentMode <= 8)) { + lineHeight = (self.layoutRect().h - 2) + 'px'; + } + + DomUtils.css(elm.firstChild, { + width: width, + lineHeight: lineHeight + }); + + self._super(); + + return self; + }, + + /** + * Post render method. Called after the control has been rendered to the target. + * + * @method postRender + * @return {tinymce.ui.ComboBox} Current combobox instance. + */ + postRender: function() { + var self = this; + + DomUtils.on(this.getEl('inp'), 'change', function() { + self.fire('change'); + }); + + return self._super(); + }, + + remove: function() { + DomUtils.off(this.getEl('inp')); + this._super(); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, settings = self.settings, prefix = self.classPrefix; + var value = settings.value || settings.placeholder || ''; + var icon, text, openBtnHtml = '', extraAttrs = ''; + + if ("spellcheck" in settings) { + extraAttrs += ' spellcheck="' + settings.spellcheck + '"'; + } + + if (settings.maxLength) { + extraAttrs += ' maxlength="' + settings.maxLength + '"'; + } + + if (settings.size) { + extraAttrs += ' size="' + settings.size + '"'; + } + + if (settings.subtype) { + extraAttrs += ' type="' + settings.subtype + '"'; + } + + if (self.disabled()) { + extraAttrs += ' disabled="disabled"'; + } + + icon = settings.icon; + if (icon && icon != 'caret') { + icon = prefix + 'ico ' + prefix + 'i-' + settings.icon; + } + + text = self._text; + + if (icon || text) { + openBtnHtml = ( + '
    ' + + '' + + '
    ' + ); + + self.addClass('has-open'); + } + + return ( + '
    ' + + '' + + openBtnHtml + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/ColorBox.js + +/** + * ColorBox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This widget lets you enter colors and browse for colors by pressing the color button. It also displays + * a preview of the current color. + * + * @-x-less ColorBox.less + * @class tinymce.ui.ColorBox + * @extends tinymce.ui.ComboBox + */ +define("tinymce/ui/ColorBox", [ + "tinymce/ui/ComboBox" +], function(ComboBox) { + "use strict"; + + return ComboBox.extend({ + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this; + + settings.spellcheck = false; + + if (settings.onaction) { + settings.icon = 'none'; + } + + self._super(settings); + + self.addClass('colorbox'); + self.on('change keyup postrender', function() { + self.repaintColor(self.value()); + }); + }, + + repaintColor: function(value) { + var elm = this.getEl().getElementsByTagName('i')[0]; + + if (elm) { + try { + elm.style.background = value; + } catch (ex) { + // Ignore + } + } + }, + + value: function(value) { + var self = this; + + if (typeof value != "undefined") { + if (self._rendered) { + self.repaintColor(value); + } + } + + return self._super(value); + } + }); +}); + +// Included from: js/tinymce/classes/ui/PanelButton.js + +/** + * PanelButton.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new panel button. + * + * @class tinymce.ui.PanelButton + * @extends tinymce.ui.Button + */ +define("tinymce/ui/PanelButton", [ + "tinymce/ui/Button", + "tinymce/ui/FloatPanel" +], function(Button, FloatPanel) { + "use strict"; + + return Button.extend({ + /** + * Shows the panel for the button. + * + * @method showPanel + */ + showPanel: function() { + var self = this, settings = self.settings; + + self.active(true); + + if (!self.panel) { + var panelSettings = settings.panel; + + // Wrap panel in grid layout if type if specified + // This makes it possible to add forms or other containers directly in the panel option + if (panelSettings.type) { + panelSettings = { + layout: 'grid', + items: panelSettings + }; + } + + panelSettings.role = panelSettings.role || 'dialog'; + panelSettings.popover = true; + panelSettings.autohide = true; + panelSettings.ariaRoot = true; + + self.panel = new FloatPanel(panelSettings).on('hide', function() { + self.active(false); + }).on('cancel', function(e) { + e.stopPropagation(); + self.focus(); + self.hidePanel(); + }).parent(self).renderTo(self.getContainerElm()); + + self.panel.fire('show'); + self.panel.reflow(); + } else { + self.panel.show(); + } + + self.panel.moveRel(self.getEl(), settings.popoverAlign || (self.isRtl() ? ['bc-tr', 'bc-tc'] : ['bc-tl', 'bc-tc'])); + }, + + /** + * Hides the panel for the button. + * + * @method hidePanel + */ + hidePanel: function() { + var self = this; + + if (self.panel) { + self.panel.hide(); + } + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self.aria('haspopup', true); + + self.on('click', function(e) { + if (e.control === self) { + if (self.panel && self.panel.visible()) { + self.hidePanel(); + } else { + self.showPanel(); + self.panel.focus(!!e.aria); + } + } + }); + + return self._super(); + }, + + remove: function() { + if (this.panel) { + this.panel.remove(); + this.panel = null; + } + + return this._super(); + } + }); +}); + +// Included from: js/tinymce/classes/ui/ColorButton.js + +/** + * ColorButton.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a color button control. This is a split button in which the main + * button has a visual representation of the currently selected color. When clicked + * the caret button displays a color picker, allowing the user to select a new color. + * + * @-x-less ColorButton.less + * @class tinymce.ui.ColorButton + * @extends tinymce.ui.PanelButton + */ +define("tinymce/ui/ColorButton", [ + "tinymce/ui/PanelButton", + "tinymce/dom/DOMUtils" +], function(PanelButton, DomUtils) { + "use strict"; + + var DOM = DomUtils.DOM; + + return PanelButton.extend({ + /** + * Constructs a new ColorButton instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + this._super(settings); + this.addClass('colorbutton'); + }, + + /** + * Getter/setter for the current color. + * + * @method color + * @param {String} [color] Color to set. + * @return {String|tinymce.ui.ColorButton} Current color or current instance. + */ + color: function(color) { + if (color) { + this._color = color; + this.getEl('preview').style.backgroundColor = color; + return this; + } + + return this._color; + }, + + /** + * Resets the current color. + * + * @method resetColor + * @return {tinymce.ui.ColorButton} Current instance. + */ + resetColor: function() { + this._color = null; + this.getEl('preview').style.backgroundColor = null; + return this; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix; + var icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : ''; + var image = self.settings.image ? ' style="background-image: url(\'' + self.settings.image + '\')"' : ''; + + return ( + '
    ' + + '' + + '' + + '
    ' + ); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this, onClickHandler = self.settings.onclick; + + self.on('click', function(e) { + if (e.aria && e.aria.key == 'down') { + return; + } + + if (e.control == self && !DOM.getParent(e.target, '.' + self.classPrefix + 'open')) { + e.stopImmediatePropagation(); + onClickHandler.call(self, e); + } + }); + + delete self.settings.onclick; + + return self._super(); + } + }); +}); + +// Included from: js/tinymce/classes/util/Color.js + +/** + * Color.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class lets you parse/serialize colors and convert rgb/hsb. + * + * @class tinymce.util.Color + * @example + * var white = new tinymce.util.Color({r: 255, g: 255, b: 255}); + * var red = new tinymce.util.Color('#FF0000'); + * + * console.log(white.toHex(), red.toHsv()); + */ +define("tinymce/util/Color", [], function() { + var min = Math.min, max = Math.max, round = Math.round; + + /** + * Constructs a new color instance. + * + * @constructor + * @method Color + * @param {String} value Optional initial value to parse. + */ + function Color(value) { + var self = this, r = 0, g = 0, b = 0; + + function rgb2hsv(r, g, b) { + var h, s, v, d, minRGB, maxRGB; + + h = 0; + s = 0; + v = 0; + r = r / 255; + g = g / 255; + b = b / 255; + + minRGB = min(r, min(g, b)); + maxRGB = max(r, max(g, b)); + + if (minRGB == maxRGB) { + v = minRGB; + + return { + h: 0, + s: 0, + v: v * 100 + }; + } + + /*eslint no-nested-ternary:0 */ + d = (r == minRGB) ? g - b : ((b == minRGB) ? r - g : b - r); + h = (r == minRGB) ? 3 : ((b == minRGB) ? 1 : 5); + h = 60 * (h - d / (maxRGB - minRGB)); + s = (maxRGB - minRGB) / maxRGB; + v = maxRGB; + + return { + h: round(h), + s: round(s * 100), + v: round(v * 100) + }; + } + + function hsvToRgb(hue, saturation, brightness) { + var side, chroma, x, match; + + hue = (parseInt(hue, 10) || 0) % 360; + saturation = parseInt(saturation, 10) / 100; + brightness = parseInt(brightness, 10) / 100; + saturation = max(0, min(saturation, 1)); + brightness = max(0, min(brightness, 1)); + + if (saturation === 0) { + r = g = b = round(255 * brightness); + return; + } + + side = hue / 60; + chroma = brightness * saturation; + x = chroma * (1 - Math.abs(side % 2 - 1)); + match = brightness - chroma; + + switch (Math.floor(side)) { + case 0: + r = chroma; + g = x; + b = 0; + break; + + case 1: + r = x; + g = chroma; + b = 0; + break; + + case 2: + r = 0; + g = chroma; + b = x; + break; + + case 3: + r = 0; + g = x; + b = chroma; + break; + + case 4: + r = x; + g = 0; + b = chroma; + break; + + case 5: + r = chroma; + g = 0; + b = x; + break; + + default: + r = g = b = 0; + } + + r = round(255 * (r + match)); + g = round(255 * (g + match)); + b = round(255 * (b + match)); + } + + /** + * Returns the hex string of the current color. For example: #ff00ff + * + * @method toHex + * @return {String} Hex string of current color. + */ + function toHex() { + function hex(val) { + val = parseInt(val, 10).toString(16); + + return val.length > 1 ? val : '0' + val; + } + + return '#' + hex(r) + hex(g) + hex(b); + } + + /** + * Returns the r, g, b values of the color. Each channel has a range from 0-255. + * + * @method toRgb + * @return {Object} Object with r, g, b fields. + */ + function toRgb() { + return { + r: r, + g: g, + b: b + }; + } + + /** + * Returns the h, s, v values of the color. Ranges: h=0-360, s=0-100, v=0-100. + * + * @method toHsv + * @return {Object} Object with h, s, v fields. + */ + function toHsv() { + return rgb2hsv(r, g, b); + } + + /** + * Parses the specified value and populates the color instance. + * + * Supported format examples: + * * rbg(255,0,0) + * * #ff0000 + * * #fff + * * {r: 255, g: 0, b: 0} + * * {h: 360, s: 100, v: 100} + * + * @method parse + * @param {Object/String} value Color value to parse. + * @return {tinymce.util.Color} Current color instance. + */ + function parse(value) { + var matches; + + if (typeof value == 'object') { + if ("r" in value) { + r = value.r; + g = value.g; + b = value.b; + } else if ("v" in value) { + hsvToRgb(value.h, value.s, value.v); + } + } else { + if ((matches = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(value))) { + r = parseInt(matches[1], 10); + g = parseInt(matches[2], 10); + b = parseInt(matches[3], 10); + } else if ((matches = /#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(value))) { + r = parseInt(matches[1], 16); + g = parseInt(matches[2], 16); + b = parseInt(matches[3], 16); + } else if ((matches = /#([0-F])([0-F])([0-F])/gi.exec(value))) { + r = parseInt(matches[1] + matches[1], 16); + g = parseInt(matches[2] + matches[2], 16); + b = parseInt(matches[3] + matches[3], 16); + } + } + + r = r < 0 ? 0 : (r > 255 ? 255 : r); + g = g < 0 ? 0 : (g > 255 ? 255 : g); + b = b < 0 ? 0 : (b > 255 ? 255 : b); + + return self; + } + + if (value) { + parse(value); + } + + self.toRgb = toRgb; + self.toHsv = toHsv; + self.toHex = toHex; + self.parse = parse; + } + + return Color; +}); + +// Included from: js/tinymce/classes/ui/ColorPicker.js + +/** + * ColorPicker.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Color picker widget lets you select colors. + * + * @-x-less ColorPicker.less + * @class tinymce.ui.ColorPicker + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/ColorPicker", [ + "tinymce/ui/Widget", + "tinymce/ui/DragHelper", + "tinymce/ui/DomUtils", + "tinymce/util/Color" +], function(Widget, DragHelper, DomUtils, Color) { + "use strict"; + + return Widget.extend({ + Defaults: { + classes: "widget colorpicker" + }, + + /** + * Constructs a new colorpicker instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {String} color Initial color value. + */ + init: function(settings) { + this._super(settings); + }, + + postRender: function() { + var self = this, color = self.color(), hsv, hueRootElm, huePointElm, svRootElm, svPointElm; + + hueRootElm = self.getEl('h'); + huePointElm = self.getEl('hp'); + svRootElm = self.getEl('sv'); + svPointElm = self.getEl('svp'); + + function getPos(elm, event) { + var pos = DomUtils.getPos(elm), x, y; + + x = event.pageX - pos.x; + y = event.pageY - pos.y; + + x = Math.max(0, Math.min(x / elm.clientWidth, 1)); + y = Math.max(0, Math.min(y / elm.clientHeight, 1)); + + return { + x: x, + y: y + }; + } + + function updateColor(hsv, hueUpdate) { + var hue = (360 - hsv.h) / 360; + + DomUtils.css(huePointElm, { + top: (hue * 100) + '%' + }); + + if (!hueUpdate) { + DomUtils.css(svPointElm, { + left: hsv.s + '%', + top: (100 - hsv.v) + '%' + }); + } + + svRootElm.style.background = new Color({s: 100, v: 100, h: hsv.h}).toHex(); + self.color().parse({s: hsv.s, v: hsv.v, h: hsv.h}); + } + + function updateSaturationAndValue(e) { + var pos; + + pos = getPos(svRootElm, e); + hsv.s = pos.x * 100; + hsv.v = (1 - pos.y) * 100; + + updateColor(hsv); + self.fire('change'); + } + + function updateHue(e) { + var pos; + + pos = getPos(hueRootElm, e); + hsv = color.toHsv(); + hsv.h = (1 - pos.y) * 360; + updateColor(hsv, true); + self.fire('change'); + } + + self._repaint = function() { + hsv = color.toHsv(); + updateColor(hsv); + }; + + self._super(); + + self._svdraghelper = new DragHelper(self._id + '-sv', { + start: updateSaturationAndValue, + drag: updateSaturationAndValue + }); + + self._hdraghelper = new DragHelper(self._id + '-h', { + start: updateHue, + drag: updateHue + }); + + self._repaint(); + }, + + rgb: function() { + return this.color().toRgb(); + }, + + value: function(value) { + var self = this; + + if (arguments.length) { + self.color().parse(value); + + if (self._rendered) { + self._repaint(); + } + } else { + return self.color().toHex(); + } + }, + + color: function() { + if (!this._color) { + this._color = new Color(); + } + + return this._color; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix, hueHtml; + var stops = '#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000'; + + function getOldIeFallbackHtml() { + var i, l, html = '', gradientPrefix, stopsList; + + gradientPrefix = 'filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='; + stopsList = stops.split(','); + for (i = 0, l = stopsList.length - 1; i < l; i++) { + html += ( + '
    ' + ); + } + + return html; + } + + var gradientCssText = ( + 'background: -ms-linear-gradient(top,' + stops + ');' + + 'background: linear-gradient(to bottom,' + stops + ');' + ); + + hueHtml = ( + '
    ' + + getOldIeFallbackHtml() + + '
    ' + + '
    ' + ); + + return ( + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + hueHtml + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/Path.js + +/** + * Path.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new path control. + * + * @-x-less Path.less + * @class tinymce.ui.Path + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Path", [ + "tinymce/ui/Widget" +], function(Widget) { + "use strict"; + + return Widget.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {String} delimiter Delimiter to display between items in path. + */ + init: function(settings) { + var self = this; + + if (!settings.delimiter) { + settings.delimiter = '\u00BB'; + } + + self._super(settings); + self.addClass('path'); + self.canFocus = true; + + self.on('click', function(e) { + var index, target = e.target; + + if ((index = target.getAttribute('data-index'))) { + self.fire('select', {value: self.data()[index], index: index}); + } + }); + }, + + /** + * Focuses the current control. + * + * @method focus + * @return {tinymce.ui.Control} Current control instance. + */ + focus: function() { + var self = this; + + self.getEl().firstChild.focus(); + + return self; + }, + + /** + * Sets/gets the data to be used for the path. + * + * @method data + * @param {Array} data Array with items name is rendered to path. + */ + data: function(data) { + var self = this; + + if (typeof data !== "undefined") { + self._data = data; + self.update(); + + return self; + } + + return self._data; + }, + + /** + * Updated the path. + * + * @private + */ + update: function() { + this.innerHtml(this._getPathHtml()); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self._super(); + + self.data(self.settings.data); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this; + + return ( + '
    ' + + self._getPathHtml() + + '
    ' + ); + }, + + _getPathHtml: function() { + var self = this, parts = self._data || [], i, l, html = '', prefix = self.classPrefix; + + for (i = 0, l = parts.length; i < l; i++) { + html += ( + (i > 0 ? '' : '') + + '
    ' + parts[i].name + '
    ' + ); + } + + if (!html) { + html = '
    \u00a0
    '; + } + + return html; + } + }); +}); + +// Included from: js/tinymce/classes/ui/ElementPath.js + +/** + * ElementPath.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This control creates an path for the current selections parent elements in TinyMCE. + * + * @class tinymce.ui.ElementPath + * @extends tinymce.ui.Path + */ +define("tinymce/ui/ElementPath", [ + "tinymce/ui/Path", + "tinymce/EditorManager" +], function(Path, EditorManager) { + return Path.extend({ + /** + * Post render method. Called after the control has been rendered to the target. + * + * @method postRender + * @return {tinymce.ui.ElementPath} Current combobox instance. + */ + postRender: function() { + var self = this, editor = EditorManager.activeEditor; + + function isHidden(elm) { + if (elm.nodeType === 1) { + if (elm.nodeName == "BR" || !!elm.getAttribute('data-mce-bogus')) { + return true; + } + + if (elm.getAttribute('data-mce-type') === 'bookmark') { + return true; + } + } + + return false; + } + + if (editor.settings.elementpath !== false) { + self.on('select', function(e) { + editor.focus(); + editor.selection.select(this.data()[e.index].element); + editor.nodeChanged(); + }); + + editor.on('nodeChange', function(e) { + var outParents = [], parents = e.parents, i = parents.length; + + while (i--) { + if (parents[i].nodeType == 1 && !isHidden(parents[i])) { + var args = editor.fire('ResolveName', { + name: parents[i].nodeName.toLowerCase(), + target: parents[i] + }); + + if (!args.isDefaultPrevented()) { + outParents.push({name: args.name, element: parents[i]}); + } + + if (args.isPropagationStopped()) { + break; + } + } + } + + self.data(outParents); + }); + } + + return self._super(); + } + }); +}); + +// Included from: js/tinymce/classes/ui/FormItem.js + +/** + * FormItem.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is a container created by the form element with + * a label and control item. + * + * @class tinymce.ui.FormItem + * @extends tinymce.ui.Container + * @setting {String} label Label to display for the form item. + */ +define("tinymce/ui/FormItem", [ + "tinymce/ui/Container" +], function(Container) { + "use strict"; + + return Container.extend({ + Defaults: { + layout: 'flex', + align: 'center', + defaults: { + flex: 1 + } + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, prefix = self.classPrefix; + + self.addClass('formitem'); + layout.preRender(self); + + return ( + '
    ' + + (self.settings.title ? ('
    ' + + self.settings.title + '
    ') : '') + + '
    ' + + (self.settings.html || '') + layout.renderHtml(self) + + '
    ' + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/Form.js + +/** + * Form.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a form container. A form container has the ability + * to automatically wrap items in tinymce.ui.FormItem instances. + * + * Each FormItem instance is a container for the label and the item. + * + * @example + * tinymce.ui.Factory.create({ + * type: 'form', + * items: [ + * {type: 'textbox', label: 'My text box'} + * ] + * }).renderTo(document.body); + * + * @class tinymce.ui.Form + * @extends tinymce.ui.Container + */ +define("tinymce/ui/Form", [ + "tinymce/ui/Container", + "tinymce/ui/FormItem", + "tinymce/util/Tools" +], function(Container, FormItem, Tools) { + "use strict"; + + return Container.extend({ + Defaults: { + containerCls: 'form', + layout: 'flex', + direction: 'column', + align: 'stretch', + flex: 1, + padding: 20, + labelGap: 30, + spacing: 10, + callbacks: { + submit: function() { + this.submit(); + } + } + }, + + /** + * This method gets invoked before the control is rendered. + * + * @method preRender + */ + preRender: function() { + var self = this, items = self.items(); + + if (!self.settings.formItemDefaults) { + self.settings.formItemDefaults = { + layout: 'flex', + autoResize: "overflow", + defaults: {flex: 1} + }; + } + + // Wrap any labeled items in FormItems + items.each(function(ctrl) { + var formItem, label = ctrl.settings.label; + + if (label) { + formItem = new FormItem(Tools.extend({ + items: { + type: 'label', + id: ctrl._id + '-l', + text: label, + flex: 0, + forId: ctrl._id, + disabled: ctrl.disabled() + } + }, self.settings.formItemDefaults)); + + formItem.type = 'formitem'; + ctrl.aria('labelledby', ctrl._id + '-l'); + + if (typeof ctrl.settings.flex == "undefined") { + ctrl.settings.flex = 1; + } + + self.replace(ctrl, formItem); + formItem.add(ctrl); + } + }); + }, + + /** + * Recalcs label widths. + * + * @private + */ + recalcLabels: function() { + var self = this, maxLabelWidth = 0, labels = [], i, labelGap, items; + + if (self.settings.labelGapCalc === false) { + return; + } + + if (self.settings.labelGapCalc == "children") { + items = self.find('formitem'); + } else { + items = self.items(); + } + + items.filter('formitem').each(function(item) { + var labelCtrl = item.items()[0], labelWidth = labelCtrl.getEl().clientWidth; + + maxLabelWidth = labelWidth > maxLabelWidth ? labelWidth : maxLabelWidth; + labels.push(labelCtrl); + }); + + labelGap = self.settings.labelGap || 0; + + i = labels.length; + while (i--) { + labels[i].settings.minWidth = maxLabelWidth + labelGap; + } + }, + + /** + * Getter/setter for the visibility state. + * + * @method visible + * @param {Boolean} [state] True/false state to show/hide. + * @return {tinymce.ui.Form|Boolean} True/false state or current control. + */ + visible: function(state) { + var val = this._super(state); + + if (state === true && this._rendered) { + this.recalcLabels(); + } + + return val; + }, + + /** + * Fires a submit event with the serialized form. + * + * @method submit + * @return {Object} Event arguments object. + */ + submit: function() { + return this.fire('submit', {data: this.toJSON()}); + }, + + /** + * Post render method. Called after the control has been rendered to the target. + * + * @method postRender + * @return {tinymce.ui.ComboBox} Current combobox instance. + */ + postRender: function() { + var self = this; + + self._super(); + self.recalcLabels(); + self.fromJSON(self.settings.data); + } + }); +}); + +// Included from: js/tinymce/classes/ui/FieldSet.js + +/** + * FieldSet.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates fieldset containers. + * + * @-x-less FieldSet.less + * @class tinymce.ui.FieldSet + * @extends tinymce.ui.Form + */ +define("tinymce/ui/FieldSet", [ + "tinymce/ui/Form" +], function(Form) { + "use strict"; + + return Form.extend({ + Defaults: { + containerCls: 'fieldset', + layout: 'flex', + direction: 'column', + align: 'stretch', + flex: 1, + padding: "25 15 5 15", + labelGap: 30, + spacing: 10, + border: 1 + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, prefix = self.classPrefix; + + self.preRender(); + layout.preRender(self); + + return ( + '
    ' + + (self.settings.title ? ('' + + self.settings.title + '') : '') + + '
    ' + + (self.settings.html || '') + layout.renderHtml(self) + + '
    ' + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/FilePicker.js + +/** + * FilePicker.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +/** + * This class creates a file picker control. + * + * @class tinymce.ui.FilePicker + * @extends tinymce.ui.ComboBox + */ +define("tinymce/ui/FilePicker", [ + "tinymce/ui/ComboBox", + "tinymce/util/Tools" +], function(ComboBox, Tools) { + "use strict"; + + return ComboBox.extend({ + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this, editor = tinymce.activeEditor, editorSettings = editor.settings; + var actionCallback, fileBrowserCallback, fileBrowserCallbackTypes; + + settings.spellcheck = false; + + fileBrowserCallbackTypes = editorSettings.file_picker_types || editorSettings.file_browser_callback_types; + if (fileBrowserCallbackTypes) { + fileBrowserCallbackTypes = Tools.makeMap(fileBrowserCallbackTypes, /[, ]/); + } + + if (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[settings.filetype]) { + fileBrowserCallback = editorSettings.file_picker_callback; + if (fileBrowserCallback && (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[settings.filetype])) { + actionCallback = function() { + var meta = self.fire('beforecall').meta; + + meta = Tools.extend({filetype: settings.filetype}, meta); + + // file_picker_callback(callback, currentValue, metaData) + fileBrowserCallback.call( + editor, + function(value, meta) { + self.value(value).fire('change', {meta: meta}); + }, + self.value(), + meta + ); + }; + } else { + // Legacy callback: file_picker_callback(id, currentValue, filetype, window) + fileBrowserCallback = editorSettings.file_browser_callback; + if (fileBrowserCallback && (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[settings.filetype])) { + actionCallback = function() { + fileBrowserCallback( + self.getEl('inp').id, + self.value(), + settings.filetype, + window + ); + }; + } + } + } + + if (actionCallback) { + settings.icon = 'browse'; + settings.onaction = actionCallback; + } + + self._super(settings); + } + }); +}); + +// Included from: js/tinymce/classes/ui/FitLayout.js + +/** + * FitLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This layout manager will resize the control to be the size of it's parent container. + * In other words width: 100% and height: 100%. + * + * @-x-less FitLayout.less + * @class tinymce.ui.FitLayout + * @extends tinymce.ui.AbsoluteLayout + */ +define("tinymce/ui/FitLayout", [ + "tinymce/ui/AbsoluteLayout" +], function(AbsoluteLayout) { + "use strict"; + + return AbsoluteLayout.extend({ + /** + * Recalculates the positions of the controls in the specified container. + * + * @method recalc + * @param {tinymce.ui.Container} container Container instance to recalc. + */ + recalc: function(container) { + var contLayoutRect = container.layoutRect(), paddingBox = container.paddingBox(); + + container.items().filter(':visible').each(function(ctrl) { + ctrl.layoutRect({ + x: paddingBox.left, + y: paddingBox.top, + w: contLayoutRect.innerW - paddingBox.right - paddingBox.left, + h: contLayoutRect.innerH - paddingBox.top - paddingBox.bottom + }); + + if (ctrl.recalc) { + ctrl.recalc(); + } + }); + } + }); +}); + +// Included from: js/tinymce/classes/ui/FlexLayout.js + +/** + * FlexLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This layout manager works similar to the CSS flex box. + * + * @setting {String} direction row|row-reverse|column|column-reverse + * @setting {Number} flex A positive-number to flex by. + * @setting {String} align start|end|center|stretch + * @setting {String} pack start|end|justify + * + * @class tinymce.ui.FlexLayout + * @extends tinymce.ui.AbsoluteLayout + */ +define("tinymce/ui/FlexLayout", [ + "tinymce/ui/AbsoluteLayout" +], function(AbsoluteLayout) { + "use strict"; + + return AbsoluteLayout.extend({ + /** + * Recalculates the positions of the controls in the specified container. + * + * @method recalc + * @param {tinymce.ui.Container} container Container instance to recalc. + */ + recalc: function(container) { + // A ton of variables, needs to be in the same scope for performance + var i, l, items, contLayoutRect, contPaddingBox, contSettings, align, pack, spacing, totalFlex, availableSpace, direction; + var ctrl, ctrlLayoutRect, ctrlSettings, flex, maxSizeItems = [], size, maxSize, ratio, rect, pos, maxAlignEndPos; + var sizeName, minSizeName, posName, maxSizeName, beforeName, innerSizeName, deltaSizeName, contentSizeName; + var alignAxisName, alignInnerSizeName, alignSizeName, alignMinSizeName, alignBeforeName, alignAfterName; + var alignDeltaSizeName, alignContentSizeName; + var max = Math.max, min = Math.min; + + // Get container items, properties and settings + items = container.items().filter(':visible'); + contLayoutRect = container.layoutRect(); + contPaddingBox = container._paddingBox; + contSettings = container.settings; + direction = container.isRtl() ? (contSettings.direction || 'row-reversed') : contSettings.direction; + align = contSettings.align; + pack = container.isRtl() ? (contSettings.pack || 'end') : contSettings.pack; + spacing = contSettings.spacing || 0; + + if (direction == "row-reversed" || direction == "column-reverse") { + items = items.set(items.toArray().reverse()); + direction = direction.split('-')[0]; + } + + // Setup axis variable name for row/column direction since the calculations is the same + if (direction == "column") { + posName = "y"; + sizeName = "h"; + minSizeName = "minH"; + maxSizeName = "maxH"; + innerSizeName = "innerH"; + beforeName = 'top'; + deltaSizeName = "deltaH"; + contentSizeName = "contentH"; + + alignBeforeName = "left"; + alignSizeName = "w"; + alignAxisName = "x"; + alignInnerSizeName = "innerW"; + alignMinSizeName = "minW"; + alignAfterName = "right"; + alignDeltaSizeName = "deltaW"; + alignContentSizeName = "contentW"; + } else { + posName = "x"; + sizeName = "w"; + minSizeName = "minW"; + maxSizeName = "maxW"; + innerSizeName = "innerW"; + beforeName = 'left'; + deltaSizeName = "deltaW"; + contentSizeName = "contentW"; + + alignBeforeName = "top"; + alignSizeName = "h"; + alignAxisName = "y"; + alignInnerSizeName = "innerH"; + alignMinSizeName = "minH"; + alignAfterName = "bottom"; + alignDeltaSizeName = "deltaH"; + alignContentSizeName = "contentH"; + } + + // Figure out total flex, availableSpace and collect any max size elements + availableSpace = contLayoutRect[innerSizeName] - contPaddingBox[beforeName] - contPaddingBox[beforeName]; + maxAlignEndPos = totalFlex = 0; + for (i = 0, l = items.length; i < l; i++) { + ctrl = items[i]; + ctrlLayoutRect = ctrl.layoutRect(); + ctrlSettings = ctrl.settings; + flex = ctrlSettings.flex; + availableSpace -= (i < l - 1 ? spacing : 0); + + if (flex > 0) { + totalFlex += flex; + + // Flexed item has a max size then we need to check if we will hit that size + if (ctrlLayoutRect[maxSizeName]) { + maxSizeItems.push(ctrl); + } + + ctrlLayoutRect.flex = flex; + } + + availableSpace -= ctrlLayoutRect[minSizeName]; + + // Calculate the align end position to be used to check for overflow/underflow + size = contPaddingBox[alignBeforeName] + ctrlLayoutRect[alignMinSizeName] + contPaddingBox[alignAfterName]; + if (size > maxAlignEndPos) { + maxAlignEndPos = size; + } + } + + // Calculate minW/minH + rect = {}; + if (availableSpace < 0) { + rect[minSizeName] = contLayoutRect[minSizeName] - availableSpace + contLayoutRect[deltaSizeName]; + } else { + rect[minSizeName] = contLayoutRect[innerSizeName] - availableSpace + contLayoutRect[deltaSizeName]; + } + + rect[alignMinSizeName] = maxAlignEndPos + contLayoutRect[alignDeltaSizeName]; + + rect[contentSizeName] = contLayoutRect[innerSizeName] - availableSpace; + rect[alignContentSizeName] = maxAlignEndPos; + rect.minW = min(rect.minW, contLayoutRect.maxW); + rect.minH = min(rect.minH, contLayoutRect.maxH); + rect.minW = max(rect.minW, contLayoutRect.startMinWidth); + rect.minH = max(rect.minH, contLayoutRect.startMinHeight); + + // Resize container container if minSize was changed + if (contLayoutRect.autoResize && (rect.minW != contLayoutRect.minW || rect.minH != contLayoutRect.minH)) { + rect.w = rect.minW; + rect.h = rect.minH; + + container.layoutRect(rect); + this.recalc(container); + + // Forced recalc for example if items are hidden/shown + if (container._lastRect === null) { + var parentCtrl = container.parent(); + if (parentCtrl) { + parentCtrl._lastRect = null; + parentCtrl.recalc(); + } + } + + return; + } + + // Handle max size elements, check if they will become to wide with current options + ratio = availableSpace / totalFlex; + for (i = 0, l = maxSizeItems.length; i < l; i++) { + ctrl = maxSizeItems[i]; + ctrlLayoutRect = ctrl.layoutRect(); + maxSize = ctrlLayoutRect[maxSizeName]; + size = ctrlLayoutRect[minSizeName] + ctrlLayoutRect.flex * ratio; + + if (size > maxSize) { + availableSpace -= (ctrlLayoutRect[maxSizeName] - ctrlLayoutRect[minSizeName]); + totalFlex -= ctrlLayoutRect.flex; + ctrlLayoutRect.flex = 0; + ctrlLayoutRect.maxFlexSize = maxSize; + } else { + ctrlLayoutRect.maxFlexSize = 0; + } + } + + // Setup new ratio, target layout rect, start position + ratio = availableSpace / totalFlex; + pos = contPaddingBox[beforeName]; + rect = {}; + + // Handle pack setting moves the start position to end, center + if (totalFlex === 0) { + if (pack == "end") { + pos = availableSpace + contPaddingBox[beforeName]; + } else if (pack == "center") { + pos = Math.round( + (contLayoutRect[innerSizeName] / 2) - ((contLayoutRect[innerSizeName] - availableSpace) / 2) + ) + contPaddingBox[beforeName]; + + if (pos < 0) { + pos = contPaddingBox[beforeName]; + } + } else if (pack == "justify") { + pos = contPaddingBox[beforeName]; + spacing = Math.floor(availableSpace / (items.length - 1)); + } + } + + // Default aligning (start) the other ones needs to be calculated while doing the layout + rect[alignAxisName] = contPaddingBox[alignBeforeName]; + + // Start laying out controls + for (i = 0, l = items.length; i < l; i++) { + ctrl = items[i]; + ctrlLayoutRect = ctrl.layoutRect(); + size = ctrlLayoutRect.maxFlexSize || ctrlLayoutRect[minSizeName]; + + // Align the control on the other axis + if (align === "center") { + rect[alignAxisName] = Math.round((contLayoutRect[alignInnerSizeName] / 2) - (ctrlLayoutRect[alignSizeName] / 2)); + } else if (align === "stretch") { + rect[alignSizeName] = max( + ctrlLayoutRect[alignMinSizeName] || 0, + contLayoutRect[alignInnerSizeName] - contPaddingBox[alignBeforeName] - contPaddingBox[alignAfterName] + ); + rect[alignAxisName] = contPaddingBox[alignBeforeName]; + } else if (align === "end") { + rect[alignAxisName] = contLayoutRect[alignInnerSizeName] - ctrlLayoutRect[alignSizeName] - contPaddingBox.top; + } + + // Calculate new size based on flex + if (ctrlLayoutRect.flex > 0) { + size += ctrlLayoutRect.flex * ratio; + } + + rect[sizeName] = size; + rect[posName] = pos; + ctrl.layoutRect(rect); + + // Recalculate containers + if (ctrl.recalc) { + ctrl.recalc(); + } + + // Move x/y position + pos += size + spacing; + } + } + }); +}); + +// Included from: js/tinymce/classes/ui/FlowLayout.js + +/** + * FlowLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This layout manager will place the controls by using the browsers native layout. + * + * @-x-less FlowLayout.less + * @class tinymce.ui.FlowLayout + * @extends tinymce.ui.Layout + */ +define("tinymce/ui/FlowLayout", [ + "tinymce/ui/Layout" +], function(Layout) { + return Layout.extend({ + Defaults: { + containerClass: 'flow-layout', + controlClass: 'flow-layout-item', + endClass: 'break' + }, + + /** + * Recalculates the positions of the controls in the specified container. + * + * @method recalc + * @param {tinymce.ui.Container} container Container instance to recalc. + */ + recalc: function(container) { + container.items().filter(':visible').each(function(ctrl) { + if (ctrl.recalc) { + ctrl.recalc(); + } + }); + } + }); +}); + +// Included from: js/tinymce/classes/ui/FormatControls.js + +/** + * FormatControls.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Internal class containing all TinyMCE specific control types such as + * format listboxes, fontlist boxes, toolbar buttons etc. + * + * @class tinymce.ui.FormatControls + */ +define("tinymce/ui/FormatControls", [ + "tinymce/ui/Control", + "tinymce/ui/Widget", + "tinymce/ui/FloatPanel", + "tinymce/util/Tools", + "tinymce/EditorManager", + "tinymce/Env" +], function(Control, Widget, FloatPanel, Tools, EditorManager, Env) { + var each = Tools.each; + + EditorManager.on('AddEditor', function(e) { + if (e.editor.rtl) { + Control.rtl = true; + } + + registerControls(e.editor); + }); + + Control.translate = function(text) { + return EditorManager.translate(text); + }; + + Widget.tooltips = !Env.iOS; + + function registerControls(editor) { + var formatMenu; + + function createListBoxChangeHandler(items, formatName) { + return function() { + var self = this; + + editor.on('nodeChange', function(e) { + var formatter = editor.formatter; + var value = null; + + each(e.parents, function(node) { + each(items, function(item) { + if (formatName) { + if (formatter.matchNode(node, formatName, {value: item.value})) { + value = item.value; + } + } else { + if (formatter.matchNode(node, item.value)) { + value = item.value; + } + } + + if (value) { + return false; + } + }); + + if (value) { + return false; + } + }); + + self.value(value); + }); + }; + } + + function createFormats(formats) { + formats = formats.replace(/;$/, '').split(';'); + + var i = formats.length; + while (i--) { + formats[i] = formats[i].split('='); + } + + return formats; + } + + function createFormatMenu() { + var count = 0, newFormats = []; + + var defaultStyleFormats = [ + {title: 'Headings', items: [ + {title: 'Heading 1', format: 'h1'}, + {title: 'Heading 2', format: 'h2'}, + {title: 'Heading 3', format: 'h3'}, + {title: 'Heading 4', format: 'h4'}, + {title: 'Heading 5', format: 'h5'}, + {title: 'Heading 6', format: 'h6'} + ]}, + + {title: 'Inline', items: [ + {title: 'Bold', icon: 'bold', format: 'bold'}, + {title: 'Italic', icon: 'italic', format: 'italic'}, + {title: 'Underline', icon: 'underline', format: 'underline'}, + {title: 'Strikethrough', icon: 'strikethrough', format: 'strikethrough'}, + {title: 'Superscript', icon: 'superscript', format: 'superscript'}, + {title: 'Subscript', icon: 'subscript', format: 'subscript'}, + {title: 'Code', icon: 'code', format: 'code'} + ]}, + + {title: 'Blocks', items: [ + {title: 'Paragraph', format: 'p'}, + {title: 'Blockquote', format: 'blockquote'}, + {title: 'Div', format: 'div'}, + {title: 'Pre', format: 'pre'} + ]}, + + {title: 'Alignment', items: [ + {title: 'Left', icon: 'alignleft', format: 'alignleft'}, + {title: 'Center', icon: 'aligncenter', format: 'aligncenter'}, + {title: 'Right', icon: 'alignright', format: 'alignright'}, + {title: 'Justify', icon: 'alignjustify', format: 'alignjustify'} + ]} + ]; + + function createMenu(formats) { + var menu = []; + + if (!formats) { + return; + } + + each(formats, function(format) { + var menuItem = { + text: format.title, + icon: format.icon + }; + + if (format.items) { + menuItem.menu = createMenu(format.items); + } else { + var formatName = format.format || "custom" + count++; + + if (!format.format) { + format.name = formatName; + newFormats.push(format); + } + + menuItem.format = formatName; + menuItem.cmd = format.cmd; + } + + menu.push(menuItem); + }); + + return menu; + } + + function createStylesMenu() { + var menu; + + if (editor.settings.style_formats_merge) { + if (editor.settings.style_formats) { + menu = createMenu(defaultStyleFormats.concat(editor.settings.style_formats)); + } else { + menu = createMenu(defaultStyleFormats); + } + } else { + menu = createMenu(editor.settings.style_formats || defaultStyleFormats); + } + + return menu; + } + + editor.on('init', function() { + each(newFormats, function(format) { + editor.formatter.register(format.name, format); + }); + }); + + return { + type: 'menu', + items: createStylesMenu(), + onPostRender: function(e) { + editor.fire('renderFormatsMenu', {control: e.control}); + }, + itemDefaults: { + preview: true, + + textStyle: function() { + if (this.settings.format) { + return editor.formatter.getCssText(this.settings.format); + } + }, + + onPostRender: function() { + var self = this; + + self.parent().on('show', function() { + var formatName, command; + + formatName = self.settings.format; + if (formatName) { + self.disabled(!editor.formatter.canApply(formatName)); + self.active(editor.formatter.match(formatName)); + } + + command = self.settings.cmd; + if (command) { + self.active(editor.queryCommandState(command)); + } + }); + }, + + onclick: function() { + if (this.settings.format) { + toggleFormat(this.settings.format); + } + + if (this.settings.cmd) { + editor.execCommand(this.settings.cmd); + } + } + } + }; + } + + formatMenu = createFormatMenu(); + + // Simple format controls : + each({ + bold: 'Bold', + italic: 'Italic', + underline: 'Underline', + strikethrough: 'Strikethrough', + subscript: 'Subscript', + superscript: 'Superscript' + }, function(text, name) { + editor.addButton(name, { + tooltip: text, + onPostRender: function() { + var self = this; + + // TODO: Fix this + if (editor.formatter) { + editor.formatter.formatChanged(name, function(state) { + self.active(state); + }); + } else { + editor.on('init', function() { + editor.formatter.formatChanged(name, function(state) { + self.active(state); + }); + }); + } + }, + onclick: function() { + toggleFormat(name); + } + }); + }); + + // Simple command controls :[,] + each({ + outdent: ['Decrease indent', 'Outdent'], + indent: ['Increase indent', 'Indent'], + cut: ['Cut', 'Cut'], + copy: ['Copy', 'Copy'], + paste: ['Paste', 'Paste'], + help: ['Help', 'mceHelp'], + selectall: ['Select all', 'SelectAll'], + removeformat: ['Clear formatting', 'RemoveFormat'], + visualaid: ['Visual aids', 'mceToggleVisualAid'], + newdocument: ['New document', 'mceNewDocument'] + }, function(item, name) { + editor.addButton(name, { + tooltip: item[0], + cmd: item[1] + }); + }); + + // Simple command controls with format state + each({ + blockquote: ['Blockquote', 'mceBlockQuote'], + numlist: ['Numbered list', 'InsertOrderedList'], + bullist: ['Bullet list', 'InsertUnorderedList'], + subscript: ['Subscript', 'Subscript'], + superscript: ['Superscript', 'Superscript'], + alignleft: ['Align left', 'JustifyLeft'], + aligncenter: ['Align center', 'JustifyCenter'], + alignright: ['Align right', 'JustifyRight'], + alignjustify: ['Justify', 'JustifyFull'] + }, function(item, name) { + editor.addButton(name, { + tooltip: item[0], + cmd: item[1], + onPostRender: function() { + var self = this; + + // TODO: Fix this + if (editor.formatter) { + editor.formatter.formatChanged(name, function(state) { + self.active(state); + }); + } else { + editor.on('init', function() { + editor.formatter.formatChanged(name, function(state) { + self.active(state); + }); + }); + } + } + }); + }); + + function toggleUndoRedoState(type) { + return function() { + var self = this; + + type = type == 'redo' ? 'hasRedo' : 'hasUndo'; + + function checkState() { + return editor.undoManager ? editor.undoManager[type]() : false; + } + + self.disabled(!checkState()); + editor.on('Undo Redo AddUndo TypingUndo ClearUndos', function() { + self.disabled(!checkState()); + }); + }; + } + + function toggleVisualAidState() { + var self = this; + + editor.on('VisualAid', function(e) { + self.active(e.hasVisual); + }); + + self.active(editor.hasVisual); + } + + editor.addButton('undo', { + tooltip: 'Undo', + onPostRender: toggleUndoRedoState('undo'), + cmd: 'undo' + }); + + editor.addButton('redo', { + tooltip: 'Redo', + onPostRender: toggleUndoRedoState('redo'), + cmd: 'redo' + }); + + editor.addMenuItem('newdocument', { + text: 'New document', + icon: 'newdocument', + cmd: 'mceNewDocument' + }); + + editor.addMenuItem('undo', { + text: 'Undo', + icon: 'undo', + shortcut: 'Meta+Z', + onPostRender: toggleUndoRedoState('undo'), + cmd: 'undo' + }); + + editor.addMenuItem('redo', { + text: 'Redo', + icon: 'redo', + shortcut: 'Meta+Y', + onPostRender: toggleUndoRedoState('redo'), + cmd: 'redo' + }); + + editor.addMenuItem('visualaid', { + text: 'Visual aids', + selectable: true, + onPostRender: toggleVisualAidState, + cmd: 'mceToggleVisualAid' + }); + + each({ + cut: ['Cut', 'Cut', 'Meta+X'], + copy: ['Copy', 'Copy', 'Meta+C'], + paste: ['Paste', 'Paste', 'Meta+V'], + selectall: ['Select all', 'SelectAll', 'Meta+A'], + bold: ['Bold', 'Bold', 'Meta+B'], + italic: ['Italic', 'Italic', 'Meta+I'], + underline: ['Underline', 'Underline'], + strikethrough: ['Strikethrough', 'Strikethrough'], + subscript: ['Subscript', 'Subscript'], + superscript: ['Superscript', 'Superscript'], + removeformat: ['Clear formatting', 'RemoveFormat'] + }, function(item, name) { + editor.addMenuItem(name, { + text: item[0], + icon: name, + shortcut: item[2], + cmd: item[1] + }); + }); + + editor.on('mousedown', function() { + FloatPanel.hideAll(); + }); + + function toggleFormat(fmt) { + if (fmt.control) { + fmt = fmt.control.value(); + } + + if (fmt) { + editor.execCommand('mceToggleFormat', false, fmt); + } + } + + editor.addButton('styleselect', { + type: 'menubutton', + text: 'Formats', + menu: formatMenu + }); + + editor.addButton('formatselect', function() { + var items = [], blocks = createFormats(editor.settings.block_formats || + 'Paragraph=p;' + + 'Heading 1=h1;' + + 'Heading 2=h2;' + + 'Heading 3=h3;' + + 'Heading 4=h4;' + + 'Heading 5=h5;' + + 'Heading 6=h6;' + + 'Preformatted=pre' + ); + + each(blocks, function(block) { + items.push({ + text: block[0], + value: block[1], + textStyle: function() { + return editor.formatter.getCssText(block[1]); + } + }); + }); + + return { + type: 'listbox', + text: blocks[0][0], + values: items, + fixedWidth: true, + onselect: toggleFormat, + onPostRender: createListBoxChangeHandler(items) + }; + }); + + editor.addButton('fontselect', function() { + var defaultFontsFormats = + 'Andale Mono=andale mono,monospace;' + + 'Arial=arial,helvetica,sans-serif;' + + 'Arial Black=arial black,sans-serif;' + + 'Book Antiqua=book antiqua,palatino,serif;' + + 'Comic Sans MS=comic sans ms,sans-serif;' + + 'Courier New=courier new,courier,monospace;' + + 'Georgia=georgia,palatino,serif;' + + 'Helvetica=helvetica,arial,sans-serif;' + + 'Impact=impact,sans-serif;' + + 'Symbol=symbol;' + + 'Tahoma=tahoma,arial,helvetica,sans-serif;' + + 'Terminal=terminal,monaco,monospace;' + + 'Times New Roman=times new roman,times,serif;' + + 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' + + 'Verdana=verdana,geneva,sans-serif;' + + 'Webdings=webdings;' + + 'Wingdings=wingdings,zapf dingbats'; + + var items = [], fonts = createFormats(editor.settings.font_formats || defaultFontsFormats); + + each(fonts, function(font) { + items.push({ + text: {raw: font[0]}, + value: font[1], + textStyle: font[1].indexOf('dings') == -1 ? 'font-family:' + font[1] : '' + }); + }); + + return { + type: 'listbox', + text: 'Font Family', + tooltip: 'Font Family', + values: items, + fixedWidth: true, + onPostRender: createListBoxChangeHandler(items, 'fontname'), + onselect: function(e) { + if (e.control.settings.value) { + editor.execCommand('FontName', false, e.control.settings.value); + } + } + }; + }); + + editor.addButton('fontsizeselect', function() { + var items = [], defaultFontsizeFormats = '8pt 10pt 12pt 14pt 18pt 24pt 36pt'; + var fontsize_formats = editor.settings.fontsize_formats || defaultFontsizeFormats; + + each(fontsize_formats.split(' '), function(item) { + var text = item, value = item; + // Allow text=value font sizes. + var values = item.split('='); + if (values.length > 1) { + text = values[0]; + value = values[1]; + } + items.push({text: text, value: value}); + }); + + return { + type: 'listbox', + text: 'Font Sizes', + tooltip: 'Font Sizes', + values: items, + fixedWidth: true, + onPostRender: createListBoxChangeHandler(items, 'fontsize'), + onclick: function(e) { + if (e.control.settings.value) { + editor.execCommand('FontSize', false, e.control.settings.value); + } + } + }; + }); + + editor.addMenuItem('formats', { + text: 'Formats', + menu: formatMenu + }); + } +}); + +// Included from: js/tinymce/classes/ui/GridLayout.js + +/** + * GridLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This layout manager places controls in a grid. + * + * @setting {Number} spacing Spacing between controls. + * @setting {Number} spacingH Horizontal spacing between controls. + * @setting {Number} spacingV Vertical spacing between controls. + * @setting {Number} columns Number of columns to use. + * @setting {String/Array} alignH start|end|center|stretch or array of values for each column. + * @setting {String/Array} alignV start|end|center|stretch or array of values for each column. + * @setting {String} pack start|end + * + * @class tinymce.ui.GridLayout + * @extends tinymce.ui.AbsoluteLayout + */ +define("tinymce/ui/GridLayout", [ + "tinymce/ui/AbsoluteLayout" +], function(AbsoluteLayout) { + "use strict"; + + return AbsoluteLayout.extend({ + /** + * Recalculates the positions of the controls in the specified container. + * + * @method recalc + * @param {tinymce.ui.Container} container Container instance to recalc. + */ + recalc: function(container) { + var settings = container.settings, rows, cols, items, contLayoutRect, width, height, rect, + ctrlLayoutRect, ctrl, x, y, posX, posY, ctrlSettings, contPaddingBox, align, spacingH, spacingV, alignH, alignV, maxX, maxY, + colWidths = [], rowHeights = [], ctrlMinWidth, ctrlMinHeight, availableWidth, availableHeight, reverseRows, idx; + + // Get layout settings + settings = container.settings; + items = container.items().filter(':visible'); + contLayoutRect = container.layoutRect(); + cols = settings.columns || Math.ceil(Math.sqrt(items.length)); + rows = Math.ceil(items.length / cols); + spacingH = settings.spacingH || settings.spacing || 0; + spacingV = settings.spacingV || settings.spacing || 0; + alignH = settings.alignH || settings.align; + alignV = settings.alignV || settings.align; + contPaddingBox = container._paddingBox; + reverseRows = 'reverseRows' in settings ? settings.reverseRows : container.isRtl(); + + if (alignH && typeof alignH == "string") { + alignH = [alignH]; + } + + if (alignV && typeof alignV == "string") { + alignV = [alignV]; + } + + // Zero padd columnWidths + for (x = 0; x < cols; x++) { + colWidths.push(0); + } + + // Zero padd rowHeights + for (y = 0; y < rows; y++) { + rowHeights.push(0); + } + + // Calculate columnWidths and rowHeights + for (y = 0; y < rows; y++) { + for (x = 0; x < cols; x++) { + ctrl = items[y * cols + x]; + + // Out of bounds + if (!ctrl) { + break; + } + + ctrlLayoutRect = ctrl.layoutRect(); + ctrlMinWidth = ctrlLayoutRect.minW; + ctrlMinHeight = ctrlLayoutRect.minH; + + colWidths[x] = ctrlMinWidth > colWidths[x] ? ctrlMinWidth : colWidths[x]; + rowHeights[y] = ctrlMinHeight > rowHeights[y] ? ctrlMinHeight : rowHeights[y]; + } + } + + // Calculate maxX + availableWidth = contLayoutRect.innerW - contPaddingBox.left - contPaddingBox.right; + for (maxX = 0, x = 0; x < cols; x++) { + maxX += colWidths[x] + (x > 0 ? spacingH : 0); + availableWidth -= (x > 0 ? spacingH : 0) + colWidths[x]; + } + + // Calculate maxY + availableHeight = contLayoutRect.innerH - contPaddingBox.top - contPaddingBox.bottom; + for (maxY = 0, y = 0; y < rows; y++) { + maxY += rowHeights[y] + (y > 0 ? spacingV : 0); + availableHeight -= (y > 0 ? spacingV : 0) + rowHeights[y]; + } + + maxX += contPaddingBox.left + contPaddingBox.right; + maxY += contPaddingBox.top + contPaddingBox.bottom; + + // Calculate minW/minH + rect = {}; + rect.minW = maxX + (contLayoutRect.w - contLayoutRect.innerW); + rect.minH = maxY + (contLayoutRect.h - contLayoutRect.innerH); + + rect.contentW = rect.minW - contLayoutRect.deltaW; + rect.contentH = rect.minH - contLayoutRect.deltaH; + rect.minW = Math.min(rect.minW, contLayoutRect.maxW); + rect.minH = Math.min(rect.minH, contLayoutRect.maxH); + rect.minW = Math.max(rect.minW, contLayoutRect.startMinWidth); + rect.minH = Math.max(rect.minH, contLayoutRect.startMinHeight); + + // Resize container container if minSize was changed + if (contLayoutRect.autoResize && (rect.minW != contLayoutRect.minW || rect.minH != contLayoutRect.minH)) { + rect.w = rect.minW; + rect.h = rect.minH; + + container.layoutRect(rect); + this.recalc(container); + + // Forced recalc for example if items are hidden/shown + if (container._lastRect === null) { + var parentCtrl = container.parent(); + if (parentCtrl) { + parentCtrl._lastRect = null; + parentCtrl.recalc(); + } + } + + return; + } + + // Update contentW/contentH so absEnd moves correctly + if (contLayoutRect.autoResize) { + rect = container.layoutRect(rect); + rect.contentW = rect.minW - contLayoutRect.deltaW; + rect.contentH = rect.minH - contLayoutRect.deltaH; + } + + var flexV; + + if (settings.packV == 'start') { + flexV = 0; + } else { + flexV = availableHeight > 0 ? Math.floor(availableHeight / rows) : 0; + } + + // Calculate totalFlex + var totalFlex = 0; + var flexWidths = settings.flexWidths; + if (flexWidths) { + for (x = 0; x < flexWidths.length; x++) { + totalFlex += flexWidths[x]; + } + } else { + totalFlex = cols; + } + + // Calculate new column widths based on flex values + var ratio = availableWidth / totalFlex; + for (x = 0; x < cols; x++) { + colWidths[x] += flexWidths ? flexWidths[x] * ratio : ratio; + } + + // Move/resize controls + posY = contPaddingBox.top; + for (y = 0; y < rows; y++) { + posX = contPaddingBox.left; + height = rowHeights[y] + flexV; + + for (x = 0; x < cols; x++) { + if (reverseRows) { + idx = y * cols + cols - 1 - x; + } else { + idx = y * cols + x; + } + + ctrl = items[idx]; + + // No more controls to render then break + if (!ctrl) { + break; + } + + // Get control settings and calculate x, y + ctrlSettings = ctrl.settings; + ctrlLayoutRect = ctrl.layoutRect(); + width = Math.max(colWidths[x], ctrlLayoutRect.startMinWidth); + ctrlLayoutRect.x = posX; + ctrlLayoutRect.y = posY; + + // Align control horizontal + align = ctrlSettings.alignH || (alignH ? (alignH[x] || alignH[0]) : null); + if (align == "center") { + ctrlLayoutRect.x = posX + (width / 2) - (ctrlLayoutRect.w / 2); + } else if (align == "right") { + ctrlLayoutRect.x = posX + width - ctrlLayoutRect.w; + } else if (align == "stretch") { + ctrlLayoutRect.w = width; + } + + // Align control vertical + align = ctrlSettings.alignV || (alignV ? (alignV[x] || alignV[0]) : null); + if (align == "center") { + ctrlLayoutRect.y = posY + (height / 2) - (ctrlLayoutRect.h / 2); + } else if (align == "bottom") { + ctrlLayoutRect.y = posY + height - ctrlLayoutRect.h; + } else if (align == "stretch") { + ctrlLayoutRect.h = height; + } + + ctrl.layoutRect(ctrlLayoutRect); + + posX += width + spacingH; + + if (ctrl.recalc) { + ctrl.recalc(); + } + } + + posY += height + spacingV; + } + } + }); +}); + +// Included from: js/tinymce/classes/ui/Iframe.js + +/** + * Iframe.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*jshint scripturl:true */ + +/** + * This class creates an iframe. + * + * @setting {String} url Url to open in the iframe. + * + * @-x-less Iframe.less + * @class tinymce.ui.Iframe + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Iframe", [ + "tinymce/ui/Widget" +], function(Widget) { + "use strict"; + + return Widget.extend({ + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this; + + self.addClass('iframe'); + self.canFocus = false; + + /*eslint no-script-url:0 */ + return ( + '' + ); + }, + + /** + * Setter for the iframe source. + * + * @method src + * @param {String} src Source URL for iframe. + */ + src: function(src) { + this.getEl().src = src; + }, + + /** + * Inner HTML for the iframe. + * + * @method html + * @param {String} html HTML string to set as HTML inside the iframe. + * @param {function} callback Optional callback to execute when the iframe body is filled with contents. + * @return {tinymce.ui.Iframe} Current iframe control. + */ + html: function(html, callback) { + var self = this, body = this.getEl().contentWindow.document.body; + + // Wait for iframe to initialize IE 10 takes time + if (!body) { + setTimeout(function() { + self.html(html); + }, 0); + } else { + body.innerHTML = html; + + if (callback) { + callback(); + } + } + + return this; + } + }); +}); + +// Included from: js/tinymce/classes/ui/Label.js + +/** + * Label.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a label element. A label is a simple text control + * that can be bound to other controls. + * + * @-x-less Label.less + * @class tinymce.ui.Label + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Label", [ + "tinymce/ui/Widget", + "tinymce/ui/DomUtils" +], function(Widget, DomUtils) { + "use strict"; + + return Widget.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @param {Boolean} multiline Multiline label. + */ + init: function(settings) { + var self = this; + + self._super(settings); + self.addClass('widget'); + self.addClass('label'); + self.canFocus = false; + + if (settings.multiline) { + self.addClass('autoscroll'); + } + + if (settings.strong) { + self.addClass('strong'); + } + }, + + /** + * Initializes the current controls layout rect. + * This will be executed by the layout managers to determine the + * default minWidth/minHeight etc. + * + * @method initLayoutRect + * @return {Object} Layout rect instance. + */ + initLayoutRect: function() { + var self = this, layoutRect = self._super(); + + if (self.settings.multiline) { + var size = DomUtils.getSize(self.getEl()); + + // Check if the text fits within maxW if not then try word wrapping it + if (size.width > layoutRect.maxW) { + layoutRect.minW = layoutRect.maxW; + self.addClass('multiline'); + } + + self.getEl().style.width = layoutRect.minW + 'px'; + layoutRect.startMinH = layoutRect.h = layoutRect.minH = Math.min(layoutRect.maxH, DomUtils.getSize(self.getEl()).height); + } + + return layoutRect; + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this; + + if (!self.settings.multiline) { + self.getEl().style.lineHeight = self.layoutRect().h + 'px'; + } + + return self._super(); + }, + + /** + * Sets/gets the current label text. + * + * @method text + * @param {String} [text] New label text. + * @return {String|tinymce.ui.Label} Current text or current label instance. + */ + text: function(text) { + var self = this; + + if (self._rendered && text) { + this.innerHtml(self.encode(text)); + } + + return self._super(text); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, forId = self.settings.forId; + + return ( + '' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/Toolbar.js + +/** + * Toolbar.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new toolbar. + * + * @class tinymce.ui.Toolbar + * @extends tinymce.ui.Container + */ +define("tinymce/ui/Toolbar", [ + "tinymce/ui/Container" +], function(Container) { + "use strict"; + + return Container.extend({ + Defaults: { + role: 'toolbar', + layout: 'flow' + }, + + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this; + + self._super(settings); + self.addClass('toolbar'); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self.items().addClass('toolbar-item'); + + return self._super(); + } + }); +}); + +// Included from: js/tinymce/classes/ui/MenuBar.js + +/** + * MenuBar.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new menubar. + * + * @-x-less MenuBar.less + * @class tinymce.ui.MenuBar + * @extends tinymce.ui.Toolbar + */ +define("tinymce/ui/MenuBar", [ + "tinymce/ui/Toolbar" +], function(Toolbar) { + "use strict"; + + return Toolbar.extend({ + Defaults: { + role: 'menubar', + containerCls: 'menubar', + ariaRoot: true, + defaults: { + type: 'menubutton' + } + } + }); +}); + +// Included from: js/tinymce/classes/ui/MenuButton.js + +/** + * MenuButton.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new menu button. + * + * @-x-less MenuButton.less + * @class tinymce.ui.MenuButton + * @extends tinymce.ui.Button + */ +define("tinymce/ui/MenuButton", [ + "tinymce/ui/Button", + "tinymce/ui/Factory", + "tinymce/ui/MenuBar" +], function(Button, Factory, MenuBar) { + "use strict"; + + // TODO: Maybe add as some global function + function isChildOf(node, parent) { + while (node) { + if (parent === node) { + return true; + } + + node = node.parentNode; + } + + return false; + } + + var MenuButton = Button.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this; + + self._renderOpen = true; + self._super(settings); + + self.addClass('menubtn'); + + if (settings.fixedWidth) { + self.addClass('fixed-width'); + } + + self.aria('haspopup', true); + self.hasPopup = true; + }, + + /** + * Shows the menu for the button. + * + * @method showMenu + */ + showMenu: function() { + var self = this, settings = self.settings, menu; + + if (self.menu && self.menu.visible()) { + return self.hideMenu(); + } + + if (!self.menu) { + menu = settings.menu || []; + + // Is menu array then auto constuct menu control + if (menu.length) { + menu = { + type: 'menu', + items: menu + }; + } else { + menu.type = menu.type || 'menu'; + } + + self.menu = Factory.create(menu).parent(self).renderTo(); + self.fire('createmenu'); + self.menu.reflow(); + self.menu.on('cancel', function(e) { + if (e.control.parent() === self.menu) { + e.stopPropagation(); + self.focus(); + self.hideMenu(); + } + }); + + // Move focus to button when a menu item is selected/clicked + self.menu.on('select', function() { + self.focus(); + }); + + self.menu.on('show hide', function(e) { + if (e.control == self.menu) { + self.activeMenu(e.type == 'show'); + } + + self.aria('expanded', e.type == 'show'); + }).fire('show'); + } + + self.menu.show(); + self.menu.layoutRect({w: self.layoutRect().w}); + self.menu.moveRel(self.getEl(), self.isRtl() ? ['br-tr', 'tr-br'] : ['bl-tl', 'tl-bl']); + }, + + /** + * Hides the menu for the button. + * + * @method hideMenu + */ + hideMenu: function() { + var self = this; + + if (self.menu) { + self.menu.items().each(function(item) { + if (item.hideMenu) { + item.hideMenu(); + } + }); + + self.menu.hide(); + } + }, + + /** + * Sets the active menu state. + * + * @private + */ + activeMenu: function(state) { + this.toggleClass('active', state); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix; + var icon = self.settings.icon, image; + + image = self.settings.image; + if (image) { + icon = 'none'; + + // Support for [high dpi, low dpi] image sources + if (typeof image != "string") { + image = window.getSelection ? image[0] : image[1]; + } + + image = ' style="background-image: url(\'' + image + '\')"'; + } else { + image = ''; + } + + icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : ''; + + self.aria('role', self.parent() instanceof MenuBar ? 'menuitem' : 'button'); + + return ( + '
    ' + + '' + + '
    ' + ); + }, + + /** + * Gets invoked after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self.on('click', function(e) { + if (e.control === self && isChildOf(e.target, self.getEl())) { + self.showMenu(); + + if (e.aria) { + self.menu.items()[0].focus(); + } + } + }); + + self.on('mouseenter', function(e) { + var overCtrl = e.control, parent = self.parent(), hasVisibleSiblingMenu; + + if (overCtrl && parent && overCtrl instanceof MenuButton && overCtrl.parent() == parent) { + parent.items().filter('MenuButton').each(function(ctrl) { + if (ctrl.hideMenu && ctrl != overCtrl) { + if (ctrl.menu && ctrl.menu.visible()) { + hasVisibleSiblingMenu = true; + } + + ctrl.hideMenu(); + } + }); + + if (hasVisibleSiblingMenu) { + overCtrl.focus(); // Fix for: #5887 + overCtrl.showMenu(); + } + } + }); + + return self._super(); + }, + + /** + * Sets/gets the current button text. + * + * @method text + * @param {String} [text] New button text. + * @return {String|tinymce.ui.MenuButton} Current text or current MenuButton instance. + */ + text: function(text) { + var self = this, i, children; + + if (self._rendered) { + children = self.getEl('open').getElementsByTagName('span'); + for (i = 0; i < children.length; i++) { + children[i].innerHTML = (self.settings.icon && text ? '\u00a0' : '') + self.encode(text); + } + } + + return this._super(text); + }, + + /** + * Removes the control and it's menus. + * + * @method remove + */ + remove: function() { + this._super(); + + if (this.menu) { + this.menu.remove(); + } + } + }); + + return MenuButton; +}); + +// Included from: js/tinymce/classes/ui/ListBox.js + +/** + * ListBox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new list box control. + * + * @-x-less ListBox.less + * @class tinymce.ui.ListBox + * @extends tinymce.ui.MenuButton + */ +define("tinymce/ui/ListBox", [ + "tinymce/ui/MenuButton" +], function(MenuButton) { + "use strict"; + + return MenuButton.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Array} values Array with values to add to list box. + */ + init: function(settings) { + var self = this, values, selected, selectedText, lastItemCtrl; + + function setSelected(menuValues) { + // Try to find a selected value + for (var i = 0; i < menuValues.length; i++) { + selected = menuValues[i].selected || settings.value === menuValues[i].value; + + if (selected) { + selectedText = selectedText || menuValues[i].text; + self._value = menuValues[i].value; + break; + } + + // If the value has a submenu, try to find the selected values in that menu + if (menuValues[i].menu) { + setSelected(menuValues[i].menu); + } + } + } + + self._values = values = settings.values; + if (values) { + setSelected(values); + + // Default with first item + if (!selected && values.length > 0) { + selectedText = values[0].text; + self._value = values[0].value; + } + + settings.menu = values; + } + + settings.text = settings.text || selectedText || values[0].text; + + self._super(settings); + self.addClass('listbox'); + + self.on('select', function(e) { + var ctrl = e.control; + + if (lastItemCtrl) { + e.lastControl = lastItemCtrl; + } + + if (settings.multiple) { + ctrl.active(!ctrl.active()); + } else { + self.value(e.control.settings.value); + } + + lastItemCtrl = ctrl; + }); + }, + + /** + * Getter/setter function for the control value. + * + * @method value + * @param {String} [value] Value to be set. + * @return {Boolean/tinymce.ui.ListBox} Value or self if it's a set operation. + */ + value: function(value) { + var self = this, active, selectedText, menu; + + function activateByValue(menu, value) { + menu.items().each(function(ctrl) { + active = ctrl.value() === value; + + if (active) { + selectedText = selectedText || ctrl.text(); + } + + ctrl.active(active); + + if (ctrl.menu) { + activateByValue(ctrl.menu, value); + } + }); + } + + function setActiveValues(menuValues) { + for (var i = 0; i < menuValues.length; i++) { + active = menuValues[i].value == value; + + if (active) { + selectedText = selectedText || menuValues[i].text; + } + + menuValues[i].active = active; + + if (menuValues[i].menu) { + setActiveValues(menuValues[i].menu); + } + } + } + + if (typeof value != "undefined") { + if (self.menu) { + activateByValue(self.menu, value); + } else { + menu = self.settings.menu; + setActiveValues(menu); + } + + self.text(selectedText || this.settings.text); + } + + return self._super(value); + } + }); +}); + +// Included from: js/tinymce/classes/ui/MenuItem.js + +/** + * MenuItem.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new menu item. + * + * @-x-less MenuItem.less + * @class tinymce.ui.MenuItem + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/MenuItem", [ + "tinymce/ui/Widget", + "tinymce/ui/Factory", + "tinymce/Env" +], function(Widget, Factory, Env) { + "use strict"; + + return Widget.extend({ + Defaults: { + border: 0, + role: 'menuitem' + }, + + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Boolean} selectable Selectable menu. + * @setting {Array} menu Submenu array with items. + * @setting {String} shortcut Shortcut to display for menu item. Example: Ctrl+X + */ + init: function(settings) { + var self = this; + + self.hasPopup = true; + + self._super(settings); + + settings = self.settings; + + self.addClass('menu-item'); + + if (settings.menu) { + self.addClass('menu-item-expand'); + } + + if (settings.preview) { + self.addClass('menu-item-preview'); + } + + if (self._text === '-' || self._text === '|') { + self.addClass('menu-item-sep'); + self.aria('role', 'separator'); + self._text = '-'; + } + + if (settings.selectable) { + self.aria('role', 'menuitemcheckbox'); + self.addClass('menu-item-checkbox'); + settings.icon = 'selected'; + } + + if (!settings.preview && !settings.selectable) { + self.addClass('menu-item-normal'); + } + + self.on('mousedown', function(e) { + e.preventDefault(); + }); + + if (settings.menu && !settings.ariaHideMenu) { + self.aria('haspopup', true); + } + }, + + /** + * Returns true/false if the menuitem has sub menu. + * + * @method hasMenus + * @return {Boolean} True/false state if it has submenu. + */ + hasMenus: function() { + return !!this.settings.menu; + }, + + /** + * Shows the menu for the menu item. + * + * @method showMenu + */ + showMenu: function() { + var self = this, settings = self.settings, menu, parent = self.parent(); + + parent.items().each(function(ctrl) { + if (ctrl !== self) { + ctrl.hideMenu(); + } + }); + + if (settings.menu) { + menu = self.menu; + + if (!menu) { + menu = settings.menu; + + // Is menu array then auto constuct menu control + if (menu.length) { + menu = { + type: 'menu', + items: menu + }; + } else { + menu.type = menu.type || 'menu'; + } + + if (parent.settings.itemDefaults) { + menu.itemDefaults = parent.settings.itemDefaults; + } + + menu = self.menu = Factory.create(menu).parent(self).renderTo(); + menu.reflow(); + menu.on('cancel', function(e) { + e.stopPropagation(); + self.focus(); + menu.hide(); + }); + menu.on('show hide', function(e) { + e.control.items().each(function(ctrl) { + ctrl.active(ctrl.settings.selected); + }); + }).fire('show'); + + menu.on('hide', function(e) { + if (e.control === menu) { + self.removeClass('selected'); + } + }); + + menu.submenu = true; + } else { + menu.show(); + } + + menu._parentMenu = parent; + + menu.addClass('menu-sub'); + + var rel = menu.testMoveRel( + self.getEl(), + self.isRtl() ? ['tl-tr', 'bl-br', 'tr-tl', 'br-bl'] : ['tr-tl', 'br-bl', 'tl-tr', 'bl-br'] + ); + + menu.moveRel(self.getEl(), rel); + menu.rel = rel; + + rel = 'menu-sub-' + rel; + menu.removeClass(menu._lastRel); + menu.addClass(rel); + menu._lastRel = rel; + + self.addClass('selected'); + self.aria('expanded', true); + } + }, + + /** + * Hides the menu for the menu item. + * + * @method hideMenu + */ + hideMenu: function() { + var self = this; + + if (self.menu) { + self.menu.items().each(function(item) { + if (item.hideMenu) { + item.hideMenu(); + } + }); + + self.menu.hide(); + self.aria('expanded', false); + } + + return self; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, settings = self.settings, prefix = self.classPrefix, text = self.encode(self._text); + var icon = self.settings.icon, image = '', shortcut = settings.shortcut; + + // Converts shortcut format to Mac/PC variants + function convertShortcut(shortcut) { + var i, value, replace = {}; + + if (Env.mac) { + replace = { + alt: '⌥', + ctrl: '⌘', + shift: '⇧', + meta: '⌘' + }; + } else { + replace = { + meta: 'Ctrl' + }; + } + + shortcut = shortcut.split('+'); + + for (i = 0; i < shortcut.length; i++) { + value = replace[shortcut[i].toLowerCase()]; + + if (value) { + shortcut[i] = value; + } + } + + return shortcut.join('+'); + } + + if (icon) { + self.parent().addClass('menu-has-icons'); + } + + if (settings.image) { + icon = 'none'; + image = ' style="background-image: url(\'' + settings.image + '\')"'; + } + + if (shortcut) { + shortcut = convertShortcut(shortcut); + } + + icon = prefix + 'ico ' + prefix + 'i-' + (self.settings.icon || 'none'); + + return ( + '
    ' + + (text !== '-' ? '\u00a0' : '') + + (text !== '-' ? '' + text + '' : '') + + (shortcut ? '
    ' + shortcut + '
    ' : '') + + (settings.menu ? '
    ' : '') + + '
    ' + ); + }, + + /** + * Gets invoked after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this, settings = self.settings; + + var textStyle = settings.textStyle; + if (typeof textStyle == "function") { + textStyle = textStyle.call(this); + } + + if (textStyle) { + var textElm = self.getEl('text'); + if (textElm) { + textElm.setAttribute('style', textStyle); + } + } + + self.on('mouseenter click', function(e) { + if (e.control === self) { + if (!settings.menu && e.type === 'click') { + self.fire('select'); + self.parent().hideAll(); + } else { + self.showMenu(); + + if (e.aria) { + self.menu.focus(true); + } + } + } + }); + + self._super(); + + return self; + }, + + active: function(state) { + if (typeof state != "undefined") { + this.aria('checked', state); + } + + return this._super(state); + }, + + /** + * Removes the control and it's menus. + * + * @method remove + */ + remove: function() { + this._super(); + + if (this.menu) { + this.menu.remove(); + } + } + }); +}); + +// Included from: js/tinymce/classes/ui/Menu.js + +/** + * Menu.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new menu. + * + * @-x-less Menu.less + * @class tinymce.ui.Menu + * @extends tinymce.ui.FloatPanel + */ +define("tinymce/ui/Menu", [ + "tinymce/ui/FloatPanel", + "tinymce/ui/MenuItem", + "tinymce/util/Tools" +], function(FloatPanel, MenuItem, Tools) { + "use strict"; + + var Menu = FloatPanel.extend({ + Defaults: { + defaultType: 'menuitem', + border: 1, + layout: 'stack', + role: 'application', + bodyRole: 'menu', + ariaRoot: true + }, + + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this; + + settings.autohide = true; + settings.constrainToViewport = true; + + if (settings.itemDefaults) { + var items = settings.items, i = items.length; + + while (i--) { + items[i] = Tools.extend({}, settings.itemDefaults, items[i]); + } + } + + self._super(settings); + self.addClass('menu'); + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + this.toggleClass('menu-align', true); + + this._super(); + + this.getEl().style.height = ''; + this.getEl('body').style.height = ''; + + return this; + }, + + /** + * Hides/closes the menu. + * + * @method cancel + */ + cancel: function() { + var self = this; + + self.hideAll(); + self.fire('select'); + }, + + /** + * Hide menu and all sub menus. + * + * @method hideAll + */ + hideAll: function() { + var self = this; + + this.find('menuitem').exec('hideMenu'); + + return self._super(); + }, +/* + getContainerElm: function() { + var doc = document, id = this.classPrefix + 'menucontainer'; + + var elm = doc.getElementById(id); + if (!elm) { + elm = doc.createElement('div'); + elm.id = id; + elm.setAttribute('role', 'application'); + elm.className = this.classPrefix + '-reset'; + elm.style.position = 'absolute'; + elm.style.top = elm.style.left = '0'; + elm.style.overflow = 'visible'; + doc.body.appendChild(elm); + } + + return elm; + }, +*/ + /** + * Invoked before the menu is rendered. + * + * @method preRender + */ + preRender: function() { + var self = this; + + self.items().each(function(ctrl) { + var settings = ctrl.settings; + + if (settings.icon || settings.selectable) { + self._hasIcons = true; + return false; + } + }); + + return self._super(); + } + }); + + return Menu; +}); + +// Included from: js/tinymce/classes/ui/Radio.js + +/** + * Radio.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new radio button. + * + * @-x-less Radio.less + * @class tinymce.ui.Radio + * @extends tinymce.ui.Checkbox + */ +define("tinymce/ui/Radio", [ + "tinymce/ui/Checkbox" +], function(Checkbox) { + "use strict"; + + return Checkbox.extend({ + Defaults: { + classes: "radio", + role: "radio" + } + }); +}); + +// Included from: js/tinymce/classes/ui/ResizeHandle.js + +/** + * ResizeHandle.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Renders a resize handle that fires ResizeStart, Resize and ResizeEnd events. + * + * @-x-less ResizeHandle.less + * @class tinymce.ui.ResizeHandle + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/ResizeHandle", [ + "tinymce/ui/Widget", + "tinymce/ui/DragHelper" +], function(Widget, DragHelper) { + "use strict"; + + return Widget.extend({ + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, prefix = self.classPrefix; + + self.addClass('resizehandle'); + + if (self.settings.direction == "both") { + self.addClass('resizehandle-both'); + } + + self.canFocus = false; + + return ( + '
    ' + + '' + + '
    ' + ); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self._super(); + + self.resizeDragHelper = new DragHelper(this._id, { + start: function() { + self.fire('ResizeStart'); + }, + + drag: function(e) { + if (self.settings.direction != "both") { + e.deltaX = 0; + } + + self.fire('Resize', e); + }, + + stop: function() { + self.fire('ResizeEnd'); + } + }); + }, + + remove: function() { + if (this.resizeDragHelper) { + this.resizeDragHelper.destroy(); + } + + return this._super(); + } + }); +}); + +// Included from: js/tinymce/classes/ui/Spacer.js + +/** + * Spacer.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a spacer. This control is used in flex layouts for example. + * + * @-x-less Spacer.less + * @class tinymce.ui.Spacer + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Spacer", [ + "tinymce/ui/Widget" +], function(Widget) { + "use strict"; + + return Widget.extend({ + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this; + + self.addClass('spacer'); + self.canFocus = false; + + return '
    '; + } + }); +}); + +// Included from: js/tinymce/classes/ui/SplitButton.js + +/** + * SplitButton.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a split button. + * + * @-x-less SplitButton.less + * @class tinymce.ui.SplitButton + * @extends tinymce.ui.MenuButton + */ +define("tinymce/ui/SplitButton", [ + "tinymce/ui/MenuButton", + "tinymce/ui/DomUtils" +], function(MenuButton, DomUtils) { + return MenuButton.extend({ + Defaults: { + classes: "widget btn splitbtn", + role: "button" + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this, elm = self.getEl(), rect = self.layoutRect(), mainButtonElm, menuButtonElm; + + self._super(); + + mainButtonElm = elm.firstChild; + menuButtonElm = elm.lastChild; + + DomUtils.css(mainButtonElm, { + width: rect.w - DomUtils.getSize(menuButtonElm).width, + height: rect.h - 2 + }); + + DomUtils.css(menuButtonElm, { + height: rect.h - 2 + }); + + return self; + }, + + /** + * Sets the active menu state. + * + * @private + */ + activeMenu: function(state) { + var self = this; + + DomUtils.toggleClass(self.getEl().lastChild, self.classPrefix + 'active', state); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix, image; + var icon = self.settings.icon; + + image = self.settings.image; + if (image) { + icon = 'none'; + + // Support for [high dpi, low dpi] image sources + if (typeof image != "string") { + image = window.getSelection ? image[0] : image[1]; + } + + image = ' style="background-image: url(\'' + image + '\')"'; + } else { + image = ''; + } + + icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : ''; + + return ( + '
    ' + + '' + + '' + + '
    ' + ); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this, onClickHandler = self.settings.onclick; + + self.on('click', function(e) { + var node = e.target; + + if (e.control == this) { + // Find clicks that is on the main button + while (node) { + if ((e.aria && e.aria.key != 'down') || (node.nodeName == 'BUTTON' && node.className.indexOf('open') == -1)) { + e.stopImmediatePropagation(); + onClickHandler.call(this, e); + return; + } + + node = node.parentNode; + } + } + }); + + delete self.settings.onclick; + + return self._super(); + } + }); +}); + +// Included from: js/tinymce/classes/ui/StackLayout.js + +/** + * StackLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This layout uses the browsers layout when the items are blocks. + * + * @-x-less StackLayout.less + * @class tinymce.ui.StackLayout + * @extends tinymce.ui.FlowLayout + */ +define("tinymce/ui/StackLayout", [ + "tinymce/ui/FlowLayout" +], function(FlowLayout) { + "use strict"; + + return FlowLayout.extend({ + Defaults: { + containerClass: 'stack-layout', + controlClass: 'stack-layout-item', + endClass: 'break' + } + }); +}); + +// Included from: js/tinymce/classes/ui/TabPanel.js + +/** + * TabPanel.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a tab panel control. + * + * @-x-less TabPanel.less + * @class tinymce.ui.TabPanel + * @extends tinymce.ui.Panel + * + * @setting {Number} activeTab Active tab index. + */ +define("tinymce/ui/TabPanel", [ + "tinymce/ui/Panel", + "tinymce/ui/DomUtils" +], function(Panel, DomUtils) { + "use strict"; + + return Panel.extend({ + Defaults: { + layout: 'absolute', + defaults: { + type: 'panel' + } + }, + + /** + * Activates the specified tab by index. + * + * @method activateTab + * @param {Number} idx Index of the tab to activate. + */ + activateTab: function(idx) { + var activeTabElm; + + if (this.activeTabId) { + activeTabElm = this.getEl(this.activeTabId); + DomUtils.removeClass(activeTabElm, this.classPrefix + 'active'); + activeTabElm.setAttribute('aria-selected', "false"); + } + + this.activeTabId = 't' + idx; + + activeTabElm = this.getEl('t' + idx); + activeTabElm.setAttribute('aria-selected', "true"); + DomUtils.addClass(activeTabElm, this.classPrefix + 'active'); + + this.items()[idx].show().fire('showtab'); + this.reflow(); + + this.items().each(function(item, i) { + if (idx != i) { + item.hide(); + } + }); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, tabsHtml = '', prefix = self.classPrefix; + + self.preRender(); + layout.preRender(self); + + self.items().each(function(ctrl, i) { + var id = self._id + '-t' + i; + + ctrl.aria('role', 'tabpanel'); + ctrl.aria('labelledby', id); + + tabsHtml += ( + '' + ); + }); + + return ( + '
    ' + + '
    ' + + tabsHtml + + '
    ' + + '
    ' + + layout.renderHtml(self) + + '
    ' + + '
    ' + ); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self._super(); + + self.settings.activeTab = self.settings.activeTab || 0; + self.activateTab(self.settings.activeTab); + + this.on('click', function(e) { + var targetParent = e.target.parentNode; + + if (e.target.parentNode.id == self._id + '-head') { + var i = targetParent.childNodes.length; + + while (i--) { + if (targetParent.childNodes[i] == e.target) { + self.activateTab(i); + } + } + } + }); + }, + + /** + * Initializes the current controls layout rect. + * This will be executed by the layout managers to determine the + * default minWidth/minHeight etc. + * + * @method initLayoutRect + * @return {Object} Layout rect instance. + */ + initLayoutRect: function() { + var self = this, rect, minW, minH; + + minW = DomUtils.getSize(self.getEl('head')).width; + minW = minW < 0 ? 0 : minW; + minH = 0; + + self.items().each(function(item) { + minW = Math.max(minW, item.layoutRect().minW); + minH = Math.max(minH, item.layoutRect().minH); + }); + + self.items().each(function(ctrl) { + ctrl.settings.x = 0; + ctrl.settings.y = 0; + ctrl.settings.w = minW; + ctrl.settings.h = minH; + + ctrl.layoutRect({ + x: 0, + y: 0, + w: minW, + h: minH + }); + }); + + var headH = DomUtils.getSize(self.getEl('head')).height; + + self.settings.minWidth = minW; + self.settings.minHeight = minH + headH; + + rect = self._super(); + rect.deltaH += headH; + rect.innerH = rect.h - rect.deltaH; + + return rect; + } + }); +}); + +// Included from: js/tinymce/classes/ui/TextBox.js + +/** + * TextBox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new textbox. + * + * @-x-less TextBox.less + * @class tinymce.ui.TextBox + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/TextBox", [ + "tinymce/ui/Widget", + "tinymce/ui/DomUtils" +], function(Widget, DomUtils) { + "use strict"; + + return Widget.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Boolean} multiline True if the textbox is a multiline control. + * @setting {Number} maxLength Max length for the textbox. + * @setting {Number} size Size of the textbox in characters. + */ + init: function(settings) { + var self = this; + + self._super(settings); + + self._value = settings.value || ''; + self.addClass('textbox'); + + if (settings.multiline) { + self.addClass('multiline'); + } else { + // TODO: Rework this + self.on('keydown', function(e) { + if (e.keyCode == 13) { + self.parents().reverse().each(function(ctrl) { + e.preventDefault(); + + if (ctrl.hasEventListeners('submit') && ctrl.toJSON) { + ctrl.fire('submit', {data: ctrl.toJSON()}); + return false; + } + }); + } + }); + } + }, + + /** + * Getter/setter function for the disabled state. + * + * @method value + * @param {Boolean} [state] State to be set. + * @return {Boolean|tinymce.ui.ComboBox} True/false or self if it's a set operation. + */ + disabled: function(state) { + var self = this; + + if (self._rendered && typeof state != 'undefined') { + self.getEl().disabled = state; + } + + return self._super(state); + }, + + /** + * Getter/setter function for the control value. + * + * @method value + * @param {String} [value] Value to be set. + * @return {String|tinymce.ui.ComboBox} Value or self if it's a set operation. + */ + value: function(value) { + var self = this; + + if (typeof value != "undefined") { + self._value = value; + + if (self._rendered) { + self.getEl().value = value; + } + + return self; + } + + if (self._rendered) { + return self.getEl().value; + } + + return self._value; + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this, style, rect, borderBox, borderW = 0, borderH = 0, lastRepaintRect; + + style = self.getEl().style; + rect = self._layoutRect; + lastRepaintRect = self._lastRepaintRect || {}; + + // Detect old IE 7+8 add lineHeight to align caret vertically in the middle + var doc = document; + if (!self.settings.multiline && doc.all && (!doc.documentMode || doc.documentMode <= 8)) { + style.lineHeight = (rect.h - borderH) + 'px'; + } + + borderBox = self._borderBox; + borderW = borderBox.left + borderBox.right + 8; + borderH = borderBox.top + borderBox.bottom + (self.settings.multiline ? 8 : 0); + + if (rect.x !== lastRepaintRect.x) { + style.left = rect.x + 'px'; + lastRepaintRect.x = rect.x; + } + + if (rect.y !== lastRepaintRect.y) { + style.top = rect.y + 'px'; + lastRepaintRect.y = rect.y; + } + + if (rect.w !== lastRepaintRect.w) { + style.width = (rect.w - borderW) + 'px'; + lastRepaintRect.w = rect.w; + } + + if (rect.h !== lastRepaintRect.h) { + style.height = (rect.h - borderH) + 'px'; + lastRepaintRect.h = rect.h; + } + + self._lastRepaintRect = lastRepaintRect; + self.fire('repaint', {}, false); + + return self; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, settings = self.settings, value = self.encode(self._value, false), extraAttrs = ''; + + if ("spellcheck" in settings) { + extraAttrs += ' spellcheck="' + settings.spellcheck + '"'; + } + + if (settings.maxLength) { + extraAttrs += ' maxlength="' + settings.maxLength + '"'; + } + + if (settings.size) { + extraAttrs += ' size="' + settings.size + '"'; + } + + if (settings.subtype) { + extraAttrs += ' type="' + settings.subtype + '"'; + } + + if (self.disabled()) { + extraAttrs += ' disabled="disabled"'; + } + + if (settings.multiline) { + return ( + '' + ); + } + + return ''; + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + DomUtils.on(self.getEl(), 'change', function(e) { + self.fire('change', e); + }); + + return self._super(); + }, + + remove: function() { + DomUtils.off(this.getEl()); + this._super(); + } + }); +}); + +// Included from: js/tinymce/classes/ui/Throbber.js + +/** + * Throbber.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class enables you to display a Throbber for any element. + * + * @-x-less Throbber.less + * @class tinymce.ui.Throbber + */ +define("tinymce/ui/Throbber", [ + "tinymce/ui/DomUtils", + "tinymce/ui/Control" +], function(DomUtils, Control) { + "use strict"; + + /** + * Constructs a new throbber. + * + * @constructor + * @param {Element} elm DOM Html element to display throbber in. + * @param {Boolean} inline Optional true/false state if the throbber should be appended to end of element for infinite scroll. + */ + return function(elm, inline) { + var self = this, state, classPrefix = Control.classPrefix; + + /** + * Shows the throbber. + * + * @method show + * @param {Number} [time] Time to wait before showing. + * @return {tinymce.ui.Throbber} Current throbber instance. + */ + self.show = function(time) { + self.hide(); + + state = true; + + window.setTimeout(function() { + if (state) { + elm.appendChild(DomUtils.createFragment( + '
    ' + )); + } + }, time || 0); + + return self; + }; + + /** + * Hides the throbber. + * + * @method hide + * @return {tinymce.ui.Throbber} Current throbber instance. + */ + self.hide = function() { + var child = elm.lastChild; + + if (child && child.className.indexOf('throbber') != -1) { + child.parentNode.removeChild(child); + } + + state = false; + + return self; + }; + }; +}); + +expose(["tinymce/dom/EventUtils","tinymce/dom/Sizzle","tinymce/Env","tinymce/util/Tools","tinymce/dom/DomQuery","tinymce/html/Styles","tinymce/dom/TreeWalker","tinymce/dom/Range","tinymce/html/Entities","tinymce/dom/DOMUtils","tinymce/dom/ScriptLoader","tinymce/AddOnManager","tinymce/dom/RangeUtils","tinymce/html/Node","tinymce/html/Schema","tinymce/html/SaxParser","tinymce/html/DomParser","tinymce/html/Writer","tinymce/html/Serializer","tinymce/dom/Serializer","tinymce/dom/TridentSelection","tinymce/util/VK","tinymce/dom/ControlSelection","tinymce/dom/BookmarkManager","tinymce/dom/Selection","tinymce/dom/ElementUtils","tinymce/Formatter","tinymce/UndoManager","tinymce/EnterKey","tinymce/ForceBlocks","tinymce/EditorCommands","tinymce/util/URI","tinymce/util/Class","tinymce/util/EventDispatcher","tinymce/ui/Selector","tinymce/ui/Collection","tinymce/ui/DomUtils","tinymce/ui/Control","tinymce/ui/Factory","tinymce/ui/KeyboardNavigation","tinymce/ui/Container","tinymce/ui/DragHelper","tinymce/ui/Scrollable","tinymce/ui/Panel","tinymce/ui/Movable","tinymce/ui/Resizable","tinymce/ui/FloatPanel","tinymce/ui/Window","tinymce/ui/MessageBox","tinymce/WindowManager","tinymce/util/Quirks","tinymce/util/Observable","tinymce/EditorObservable","tinymce/Shortcuts","tinymce/Editor","tinymce/util/I18n","tinymce/FocusManager","tinymce/EditorManager","tinymce/LegacyInput","tinymce/util/XHR","tinymce/util/JSON","tinymce/util/JSONRequest","tinymce/util/JSONP","tinymce/util/LocalStorage","tinymce/Compat","tinymce/ui/Layout","tinymce/ui/AbsoluteLayout","tinymce/ui/Tooltip","tinymce/ui/Widget","tinymce/ui/Button","tinymce/ui/ButtonGroup","tinymce/ui/Checkbox","tinymce/ui/ComboBox","tinymce/ui/ColorBox","tinymce/ui/PanelButton","tinymce/ui/ColorButton","tinymce/util/Color","tinymce/ui/ColorPicker","tinymce/ui/Path","tinymce/ui/ElementPath","tinymce/ui/FormItem","tinymce/ui/Form","tinymce/ui/FieldSet","tinymce/ui/FilePicker","tinymce/ui/FitLayout","tinymce/ui/FlexLayout","tinymce/ui/FlowLayout","tinymce/ui/FormatControls","tinymce/ui/GridLayout","tinymce/ui/Iframe","tinymce/ui/Label","tinymce/ui/Toolbar","tinymce/ui/MenuBar","tinymce/ui/MenuButton","tinymce/ui/ListBox","tinymce/ui/MenuItem","tinymce/ui/Menu","tinymce/ui/Radio","tinymce/ui/ResizeHandle","tinymce/ui/Spacer","tinymce/ui/SplitButton","tinymce/ui/StackLayout","tinymce/ui/TabPanel","tinymce/ui/TextBox","tinymce/ui/Throbber"]); +})(this); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/tinymce.jquery.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/tinymce.jquery.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +(function(b,g){var d={};function c(m,n){var l,j=[];for(var k=0;k=534;return{opera:m,webkit:s,ie:j,gecko:l,mac:r,iOS:n,android:k,contentEditable:q,transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",caretAfter:j!=8,range:window.getSelection&&"Range" in window,documentMode:j&&!o?(document.documentMode||7):10}});h("tinymce/util/Tools",["tinymce/Env"],function(i){var z=/^\s*|\s*$/g;function u(A){return(A===null||A===g)?"":(""+A).replace(z,"")}var o=Array.isArray||function(A){return Object.prototype.toString.call(A)==="[object Array]"};function m(B,A){if(!A){return B!==g}if(A=="array"&&o(B)){return true}return typeof B==A}function s(C){var D=C,B,A;if(!o(C)){D=[];for(B=0,A=C.length;B)[^>]*$|#([\w\-]*)$)/;var O=t.Event,p;function k(Q){return typeof Q!=="undefined"}function y(Q){return typeof Q==="string"}function J(Q){return Q&&Q==Q.window}function D(S,R){var U,T,Q;R=R||P;Q=R.createElement("div");U=R.createDocumentFragment();Q.innerHTML=S;while((T=Q.firstChild)){U.appendChild(T)}return U}function A(Q,T,U,R){var S;if(y(T)){T=D(T,z(Q[0]))}else{if(T.length&&!T.nodeType){T=r.makeArray(T);if(R){for(S=T.length-1;S>=0;S--){A(Q,T[S],U,R)}}else{for(S=0;S"&&Q.length>=3){S=[null,Q,null]}else{S=B.exec(Q)}if(S){if(S[1]){U=D(Q,z(T)).firstChild;while(U){v.call(R,U);U=U.nextSibling}}else{U=z(T).getElementById(S[2]);if(!U){return R}if(U.id!==S[2]){return R.find(Q)}R.length=1;R[0]=U}}else{return r(T).find(Q)}}else{this.add(Q,false)}return R},toArray:function(){return n.toArray(this)},add:function(S,U){var R=this,Q,T;if(y(S)){return R.add(r(S))}if(U!==false){Q=r.unique(R.toArray().concat(r.makeArray(S)));R.length=Q.length;for(T=0;T1){S=r.unique(S);if(Q.indexOf("parents")===0){S=S.reverse()}}S=r(S);if(T){return S.filter(T)}return S}});s({parentsUntil:function(Q,R){return C(Q,"parentNode",R)},nextUntil:function(Q,R){return I(Q,"nextSibling",1,R).slice(1)},prevUntil:function(Q,R){return I(Q,"previousSibling",1,R).slice(1)}},function(Q,R){r.fn[Q]=function(T,V){var U=this,S=[];U.each(function(){var W=R.call(S,this,T,S);if(W){if(r.isArray(W)){S.push.apply(S,W)}else{S.push(W)}}});if(this.length>1){S=r.unique(S);if(Q.indexOf("parents")===0||Q==="prevUntil"){S=S.reverse()}}S=r(S);if(V){return S.filter(V)}return S}});r.fn.is=function(Q){return !!Q&&this.filter(Q).length>0};r.fn.init.prototype=r.fn;r.overrideDefaults=function(S){var R;function Q(T,U){R=R||S();if(arguments.length===0){T=R.element}if(!U){U=R.context}return new Q.fn.init(T,U)}r.extend(Q,this);return Q};function u(S,R,Q){s(Q,function(T,U){S[T]=S[T]||{};S[T][R]=U})}if(o.ie&&o.ie<8){u(M,"get",{maxlength:function(R){var Q=R.maxLength;if(Q===2147483647){return p}return Q},size:function(R){var Q=R.size;if(Q===20){return p}return Q},"class":function(Q){return Q.className},style:function(R){var Q=R.style.cssText;if(Q.length===0){return p}return Q}});u(M,"set",{"class":function(R,Q){R.className=Q},style:function(R,Q){R.style.cssText=Q}})}if(o.ie&&o.ie<9){m["float"]="styleFloat";u(N,"set",{opacity:function(S,R){var Q=S.style;if(R===null||R===""){Q.removeAttribute("filter")}else{Q.zoom=1;Q.filter="alpha(opacity="+(R*100)+")"}}})}r.attrHooks=M;r.cssHooks=N;return r});h("tinymce/html/Styles",[],function(){return function(o,q){var u=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,r=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,l=/\s*([^:]+):\s*([^;]+);?/g,w=/\s+$/,p,s,k={},t,n,j,v="\uFEFF";o=o||{};if(q){n=q.getValidStyles();j=q.getInvalidStyles()}t=("\\\" \\' \\; \\: ; : "+v).split(" ");for(s=0;s1?B:"0"+B}return"#"+y(A)+y(z)+y(i)}return{toHex:function(i){return i.replace(u,m)},parse:function(C){var I={},A,x,G,B,F=o.url_converter;var H=o.url_converter_scope||this;function z(O,R,L){var Q,M,K,P;Q=I[O+"-top"+R];if(!Q){return}M=I[O+"-right"+R];if(!M){return}K=I[O+"-bottom"+R];if(!K){return}P=I[O+"-left"+R];if(!P){return}var N=[Q,M,K,P];s=N.length-1;while(s--){if(N[s]!==N[s+1]){break}}if(s>-1&&L){return}I[O+R]=s==-1?N[0]:N.join(" ");delete I[O+"-top"+R];delete I[O+"-right"+R];delete I[O+"-bottom"+R];delete I[O+"-left"+R]}function E(L){var M=I[L],K;if(!M){return}M=M.split(" ");K=M.length;while(K--){if(M[K]!==M[0]){return false}}I[L]=M[0];return true}function J(M,L,K,N){if(!E(L)){return}if(!E(K)){return}if(!E(N)){return}I[M]=I[L]+" "+I[K]+" "+I[N];delete I[L];delete I[K];delete I[N]}function D(K){B=true;return k[K]}function i(L,K){if(B){L=L.replace(/\uFEFF[0-9]/g,function(M){return k[M]})}if(!K){L=L.replace(/\\([\'\";:])/g,"$1")}return L}function y(L,K,O,N,Q,M){Q=Q||M;if(Q){Q=i(Q);return"'"+Q.replace(/\'/g,"\\'")+"'"}K=i(K||O||N);if(!o.allow_script_urls){var P=K.replace(/[\s\r\n]+/,"");if(/(java|vb)script:/i.test(P)){return""}if(!o.allow_svg_data_urls&&/^data:image\/svg/i.test(P)){return""}}if(F){K=F.call(H,K,"style")}return"url('"+K.replace(/\'/g,"\\'")+"')"}if(C){C=C.replace(/[\u0000-\u001F]/g,"");C=C.replace(/\\[\"\';:\uFEFF]/g,D).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(K){return K.replace(/[;:]/g,D)});while((A=l.exec(C))){x=A[1].replace(w,"").toLowerCase();G=A[2].replace(w,"");G=G.replace(/\\[0-9a-f]+/g,function(K){return String.fromCharCode(parseInt(K.substr(1),16))});if(x&&G.length>0){if(!o.allow_script_urls&&(x=="behavior"||/expression\s*\(|\/\*|\*\//.test(G))){continue}if(x==="font-weight"&&G==="700"){G="bold"}else{if(x==="color"||x==="background-color"){G=G.toLowerCase()}}G=G.replace(u,m);G=G.replace(r,y);I[x]=B?i(G,true):G}l.lastIndex=A.index+A[0].length}z("border","",true);z("border","-width");z("border","-color");z("border","-style");z("padding","");z("margin","");J("border","border-width","border-style","border-color");if(I.border==="medium none"){delete I.border}if(I["border-image"]==="none"){delete I["border-image"]}}return I},serialize:function(A,i){var z="",y,B;function x(E){var H,F,D,G;H=n[E];if(H){for(F=0,D=H.length;F0){z+=(z.length>0?" ":"")+E+": "+G+";"}}}}function C(E,D){var F;F=j["*"];if(F&&F[E]){return false}F=j[D];if(F&&F[E]){return false}return true}if(i&&n){x("*");x(i)}else{for(y in A){B=A[y];if(B!==p&&B.length>0){if(!j||C(y,i)){z+=(z.length>0?" ":"")+y+": "+B+";"}}}}return z}}}});h("tinymce/dom/TreeWalker",[],function(){return function(j,i){var k=j;function l(q,m,n,r){var p,o;if(q){if(!r&&q[m]){return q[m]}if(q!=i){p=q[n];if(p){return p}for(o=q.parentNode;o&&o!=i;o=o.parentNode){p=o[n];if(p){return p}}}}}this.current=function(){return k};this.next=function(m){k=l(k,"firstChild","nextSibling",m);return k};this.prev=function(m){k=l(k,"lastChild","previousSibling",m);return k}}});h("tinymce/dom/Range",["tinymce/util/Tools"],function(i){function j(k){var o=this,m=k.doc,aa=0,M=1,s=2,L=true,Y=false,ac="startOffset",q="startContainer",W="endContainer",H="endOffset",t=i.extend,w=k.nodeIndex;function E(){return m.createDocumentFragment()}function z(ae,ad){J(L,ae,ad)}function B(ae,ad){J(Y,ae,ad)}function p(ad){z(ad.parentNode,w(ad))}function Q(ad){z(ad.parentNode,w(ad)+1)}function R(ad){B(ad.parentNode,w(ad))}function C(ad){B(ad.parentNode,w(ad)+1)}function I(ad){if(ad){o[W]=o[q];o[H]=o[ac]}else{o[q]=o[W];o[ac]=o[H]}o.collapsed=L}function F(ad){p(ad);C(ad)}function N(ad){z(ad,0);B(ad,ad.nodeType===1?ad.childNodes.length:ad.nodeValue.length)}function D(ah,ad){var ak=o[q],af=o[ac],aj=o[W],ae=o[H],ai=ad.startContainer,am=ad.startOffset,ag=ad.endContainer,al=ad.endOffset;if(ah===0){return O(ak,af,ai,am)}if(ah===1){return O(aj,ae,ai,am)}if(ah===2){return O(aj,ae,ag,al)}if(ah===3){return O(ak,af,ag,al)}}function y(){u(s)}function P(){return u(aa)}function l(){return u(M)}function K(ah){var ae=this[q],ad=this[ac],ag,af;if((ae.nodeType===3||ae.nodeType===4)&&ae.nodeValue){if(!ad){ae.parentNode.insertBefore(ah,ae)}else{if(ad>=ae.nodeValue.length){k.insertAfter(ah,ae)}else{ag=ae.splitText(ad);ae.parentNode.insertBefore(ah,ag)}}}else{if(ae.childNodes.length>0){af=ae.childNodes[ad]}if(af){ae.insertBefore(ah,af)}else{if(ae.nodeType==3){k.insertAfter(ah,ae)}else{ae.appendChild(ah)}}}}function U(ae){var ad=o.extractContents();o.insertNode(ae);ae.appendChild(ad);o.selectNode(ae)}function S(){return t(new j(k),{startContainer:o[q],startOffset:o[ac],endContainer:o[W],endOffset:o[H],collapsed:o.collapsed,commonAncestorContainer:o.commonAncestorContainer})}function V(ad,ae){var af;if(ad.nodeType==3){return ad}if(ae<0){return ad}af=ad.firstChild;while(af&&ae>0){--ae;af=af.nextSibling}if(af){return af}return ad}function v(){return(o[q]==o[W]&&o[ac]==o[H])}function O(ag,ai,ae,ah){var aj,af,ad,ak,am,al;if(ag==ae){if(ai==ah){return 0}if(ai0){o.collapse(ae)}}else{o.collapse(ae)}o.collapsed=v();o.commonAncestorContainer=k.findCommonAncestor(o[q],o[W])}function u(ak){var aj,ag=0,am=0,ae,ai,af,ah,ad,al;if(o[q]==o[W]){return n(ak)}for(aj=o[W],ae=aj.parentNode;ae;aj=ae,ae=ae.parentNode){if(ae==o[q]){return A(aj,ak)}++ag}for(aj=o[q],ae=aj.parentNode;ae;aj=ae,ae=ae.parentNode){if(ae==o[W]){return ab(aj,ak)}++am}ai=am-ag;af=o[q];while(ai>0){af=af.parentNode;ai--}ah=o[W];while(ai<0){ah=ah.parentNode;ai++}for(ad=af.parentNode,al=ah.parentNode;ad!=al;ad=ad.parentNode,al=al.parentNode){af=ad;ah=al}return x(af,ah,ak)}function n(aj){var al,am,ad,af,ag,ak,ah,ae,ai;if(aj!=s){al=E()}if(o[ac]==o[H]){return al}if(o[q].nodeType==3){am=o[q].nodeValue;ad=am.substring(o[ac],o[H]);if(aj!=M){af=o[q];ae=o[ac];ai=o[H]-o[ac];if(ae===0&&ai>=af.nodeValue.length-1){af.parentNode.removeChild(af)}else{af.deleteData(ae,ai)}o.collapse(L)}if(aj==s){return}if(ad.length>0){al.appendChild(m.createTextNode(ad))}return al}af=V(o[q],o[ac]);ag=o[H]-o[ac];while(af&&ag>0){ak=af.nextSibling;ah=G(af,aj);if(al){al.appendChild(ah)}--ag;af=ak}if(aj!=M){o.collapse(L)}return al}function A(ak,ah){var aj,ai,ae,ad,ag,af;if(ah!=s){aj=E()}ai=r(ak,ah);if(aj){aj.appendChild(ai)}ae=w(ak);ad=ae-o[ac];if(ad<=0){if(ah!=M){o.setEndBefore(ak);o.collapse(Y)}return aj}ai=ak.previousSibling;while(ad>0){ag=ai.previousSibling;af=G(ai,ah);if(aj){aj.insertBefore(af,aj.firstChild)}--ad;ai=ag}if(ah!=M){o.setEndBefore(ak);o.collapse(Y)}return aj}function ab(ai,ah){var ak,ae,aj,ad,ag,af;if(ah!=s){ak=E()}aj=X(ai,ah);if(ak){ak.appendChild(aj)}ae=w(ai);++ae;ad=o[H]-ae;aj=ai.nextSibling;while(aj&&ad>0){ag=aj.nextSibling;af=G(aj,ah);if(ak){ak.appendChild(af)}--ad;aj=ag}if(ah!=M){o.setStartAfter(ai);o.collapse(L)}return ak}function x(ah,ad,ak){var ae,am,ai,aj,af,al,ag;if(ak!=s){am=E()}ae=X(ah,ak);if(am){am.appendChild(ae)}ai=w(ah);aj=w(ad);++ai;af=aj-ai;al=ah.nextSibling;while(af>0){ag=al.nextSibling;ae=G(al,ak);if(am){am.appendChild(ae)}al=ag;--af}ae=r(ad,ak);if(am){am.appendChild(ae)}if(ak!=M){o.setStartAfter(ah);o.collapse(L)}return am}function r(aj,ak){var af=V(o[W],o[H]-1),al,ai;var ah,ad,ae,ag=af!=o[W];if(af==aj){return T(af,ag,Y,ak)}al=af.parentNode;ai=T(al,Y,Y,ak);while(al){while(af){ah=af.previousSibling;ad=T(af,ag,Y,ak);if(ak!=s){ai.insertBefore(ad,ai.firstChild)}ag=L;af=ah}if(al==aj){return ai}af=al.previousSibling;al=al.parentNode;ae=T(al,Y,Y,ak);if(ak!=s){ae.appendChild(ai)}ai=ae}}function X(aj,ak){var ag=V(o[q],o[ac]),ah=ag!=o[q];var al,ai,af,ad,ae;if(ag==aj){return T(ag,ah,L,ak)}al=ag.parentNode;ai=T(al,Y,L,ak);while(al){while(ag){af=ag.nextSibling;ad=T(ag,ah,L,ak);if(ak!=s){ai.appendChild(ad)}ah=L;ag=af}if(al==aj){return ai}ag=al.nextSibling;al=al.parentNode;ae=T(al,Y,L,ak);if(ak!=s){ae.appendChild(ai)}ai=ae}}function T(ad,ah,ak,al){var ag,af,ai,ae,aj;if(ah){return G(ad,al)}if(ad.nodeType==3){ag=ad.nodeValue;if(ak){ae=o[ac];af=ag.substring(ae);ai=ag.substring(0,ae)}else{ae=o[H];af=ag.substring(0,ae);ai=ag.substring(ae)}if(al!=M){ad.nodeValue=ai}if(al==s){return}aj=k.clone(ad,Y);aj.nodeValue=af;return aj}if(al==s){return}return k.clone(ad,Y)}function G(ae,ad){if(ad!=s){return ad==M?k.clone(ae,L):ae}ae.parentNode.removeChild(ae)}function Z(){return k.create("body",null,l()).outerText}t(o,{startContainer:m,startOffset:0,endContainer:m,endOffset:0,collapsed:L,commonAncestorContainer:m,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:z,setEnd:B,setStartBefore:p,setStartAfter:Q,setEndBefore:R,setEndAfter:C,collapse:I,selectNode:F,selectNodeContents:N,compareBoundaryPoints:D,deleteContents:y,extractContents:P,cloneContents:l,insertNode:K,surroundContents:U,cloneRange:S,toStringIE:Z});return o}j.prototype.toString=function(){return this.toStringIE()};return j});h("tinymce/html/Entities",["tinymce/util/Tools"],function(l){var m=l.makeMap;var i,r,o,u=/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,j=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,q=/[<>&\"\']/g,n=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,t={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"};r={'"':""","'":"'","<":"<",">":">","&":"&","\u0060":"`"};o={"<":"<",">":">","&":"&",""":'"',"'":"'"};function s(v){var w;w=document.createElement("div");w.innerHTML=v;return w.textContent||w.innerText||v}function p(w,z){var x,y,v,A={};if(w){w=w.split(",");z=z||10;for(x=0;x1){return"&#"+(((x.charCodeAt(0)-55296)*1024)+(x.charCodeAt(1)-56320)+65536)+";"}return r[x]||"&#"+x.charCodeAt(0)+";"})},encodeNamed:function(x,v,w){w=w||i;return x.replace(v?u:j,function(y){return r[y]||w[y]||y})},getEncodeFunc:function(v,y){y=p(y)||i;function w(A,z){return A.replace(z?u:j,function(B){return r[B]||y[B]||"&#"+B.charCodeAt(0)+";"||B})}function x(A,z){return k.encodeNamed(A,z,y)}v=m(v.replace(/\+/g,","));if(v.named&&v.numeric){return w}if(v.named){if(y){return x}return k.encodeNamed}if(v.numeric){return k.encodeNumeric}return k.encodeRaw},decode:function(v){return v.replace(n,function(x,w){if(w){if(w.charAt(0).toLowerCase()==="x"){w=parseInt(w.substr(1),16)}else{w=parseInt(w,10)}if(w>65535){w-=65536;return String.fromCharCode(55296+(w>>10),56320+(w&1023))}else{return t[w]||String.fromCharCode(w)}}return o[x]||i[x]||s(x)})}};return k});h("tinymce/dom/StyleSheetLoader",["tinymce/util/Tools"],function(i){return function(j,n){var k=0,m={},p;n=n||{};p=n.maxLoadTime||5000;function l(q){j.getElementsByTagName("head")[0].appendChild(q)}function o(s,w,A){var B,r,t,q;function x(){var E=q.passed,D=E.length;while(D--){E[D]()}q.status=2;q.passed=[];q.failed=[]}function z(){var E=q.failed,D=E.length;while(D--){E[D]()}q.status=3;q.passed=[];q.failed=[]}function C(){var D=navigator.userAgent.match(/WebKit\/(\d*)/);return !!(D&&D[1]<536)}function y(D,E){if(!D()){if((new Date().getTime())-t0){r=j.createElement("style");r.textContent='@import "'+s+'"';v();l(r);return}else{u()}}l(B);B.href=s}this.load=o}});h("tinymce/dom/DOMUtils",["tinymce/dom/Sizzle","tinymce/dom/DomQuery","tinymce/html/Styles","tinymce/dom/EventUtils","tinymce/dom/TreeWalker","tinymce/dom/Range","tinymce/html/Entities","tinymce/Env","tinymce/util/Tools","tinymce/dom/StyleSheetLoader"],function(k,o,r,n,p,z,l,j,i,u){var m=i.each,q=i.is,s=i.grep,w=i.trim;var v=j.ie;var t=/^([a-z0-9],?)+$/i;var A=/^[ \t\r\n]*$/;function x(C,E){var D={},B=E.keep_values,F;F={set:function(G,I,H){if(E.url_converter){I=E.url_converter.call(E.url_converter_scope||C,I,H,G[0])}G.attr("data-mce-"+H,I).attr(H,I)},get:function(G,H){return G.attr("data-mce-"+H)||G.attr(H)}};D={style:{set:function(G,H){if(H!==null&&typeof H==="object"){G.css(H);return}if(B){G.attr("data-mce-style",H)}G.attr("style",H)},get:function(G){var H=G.attr("data-mce-style")||G.attr("style");H=C.serializeStyle(C.parseStyle(H),G[0].nodeName);return H}}};if(B){D.href=D.src=F}return D}function y(E,C){var B=this,D;B.doc=E;B.win=window;B.files={};B.counter=0;B.stdMode=!v||E.documentMode>=8;B.boxModel=!v||E.compatMode=="CSS1Compat"||B.stdMode;B.styleSheetLoader=new u(E);B.boundEvents=[];B.settings=C=C||{};B.schema=C.schema;B.styles=new r({url_converter:C.url_converter,url_converter_scope:C.url_converter_scope},C.schema);B.fixDoc(E);B.events=C.ownEvents?new n(C.proxy):n.Event;B.attrHooks=x(B,C);D=C.schema?C.schema.getBlockElements():{};B.$=o.overrideDefaults(function(){return{context:E,element:B.getRoot()}});B.isBlock=function(G){if(!G){return false}var F=G.nodeType;if(F){return !!(F===1&&D[G.nodeName])}return !!D[G]}}y.prototype={$$:function(B){if(typeof B=="string"){B=this.get(B)}return this.$(B)},root:null,fixDoc:function(D){var C=this.settings,B;if(v&&C.schema){("abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video").replace(/\w+/g,function(E){D.createElement(E)});for(B in C.schema.getCustomElements()){D.createElement(B)}}},clone:function(D,B){var C=this,F,E;if(!v||D.nodeType!==1||B){return D.cloneNode(B)}E=C.doc;if(!B){F=E.createElement(D.nodeName);m(C.getAttribs(D),function(G){C.setAttrib(F,G.nodeName,C.getAttrib(D,G.nodeName))});return F}return F.firstChild},getRoot:function(){var B=this;return B.settings.root_element||B.doc.body},getViewPort:function(C){var B,D;C=!C?this.win:C;B=C.document;D=this.boxModel?B.documentElement:B.body;return{x:C.pageXOffset||D.scrollLeft,y:C.pageYOffset||D.scrollTop,w:C.innerWidth||D.clientWidth,h:C.innerHeight||D.clientHeight}},getRect:function(E){var B=this,D,C;E=B.get(E);D=B.getPos(E);C=B.getSize(E);return{x:D.x,y:D.y,w:C.w,h:C.h}},getSize:function(E){var C=this,B,D;E=C.get(E);B=C.getStyle(E,"width");D=C.getStyle(E,"height");if(B.indexOf("px")===-1){B=0}if(D.indexOf("px")===-1){D=0}return{w:parseInt(B,10)||E.offsetWidth||E.clientWidth,h:parseInt(D,10)||E.offsetHeight||E.clientHeight}},getParent:function(D,B,C){return this.getParents(D,B,C,false)},getParents:function(G,C,D,H){var F=this,E,B=[];G=F.get(G);H=H===g;D=D||(F.getRoot().nodeName!="BODY"?F.getRoot().parentNode:null);if(q(C,"string")){E=C;if(C==="*"){C=function(I){return I.nodeType==1}}else{C=function(I){return F.is(I,E)}}}while(G){if(G==D||!G.nodeType||G.nodeType===9){break}if(!C||C(G)){if(H){B.push(G)}else{return G}}G=G.parentNode}return H?B:null},get:function(C){var B;if(C&&this.doc&&typeof C=="string"){B=C;C=this.doc.getElementById(C);if(C&&C.id!==B){return this.doc.getElementsByName(B)[1]}}return C},getNext:function(C,B){return this._findSib(C,B,"nextSibling")},getPrev:function(C,B){return this._findSib(C,B,"previousSibling")},select:function(B,D){var C=this;return k(B,C.get(D)||C.settings.root_element||C.doc,[])},is:function(E,B){var C;if(E.length===g){if(B==="*"){return E.nodeType==1}if(t.test(B)){B=B.toLowerCase().split(/,/);E=E.nodeName.toLowerCase();for(C=B.length-1;C>=0;C--){if(B[C]==E){return true}}return false}}if(E.nodeType&&E.nodeType!=1){return false}var D=E.nodeType?[E]:E;return k(B,D[0].ownerDocument||D[0],null,D).length>0},add:function(G,D,C,F,E){var B=this;return this.run(G,function(I){var H;H=q(D,"string")?B.doc.createElement(D):D;B.setAttribs(H,C);if(F){if(F.nodeType){H.appendChild(F)}else{B.setHTML(H,F)}}return !E?I.appendChild(H):H})},create:function(C,B,D){return this.add(this.doc.createElement(C),C,B,D,1)},createHTML:function(C,B,E){var F="",D;F+="<"+C;for(D in B){if(B.hasOwnProperty(D)&&B[D]!==null&&typeof B[D]!="undefined"){F+=" "+D+'="'+this.encode(B[D])+'"'}}if(typeof E!="undefined"){return F+">"+E+""}return F+" />"},createFragment:function(C){var F,D,E=this.doc,B;B=E.createElement("div");F=E.createDocumentFragment();if(C){B.innerHTML=C}while((D=B.firstChild)){F.appendChild(D)}return F},remove:function(B,C){B=this.$$(B);if(C){B.each(function(){var D;while((D=this.firstChild)){if(D.nodeType==3&&D.data.length===0){this.removeChild(D)}else{this.parentNode.insertBefore(D,this)}}}).remove()}else{B.remove()}return B.length>1?B.toArray():B[0]},setStyle:function(D,B,C){D=this.$$(D).css(B,C);if(this.settings.update_styles){D.attr("data-mce-style",null)}},getStyle:function(D,B,C){D=this.$$(D);if(C){return D.css(B)}B=B.replace(/-(\D)/g,function(F,E){return E.toUpperCase()});if(B=="float"){B=v?"styleFloat":"cssFloat"}return D[0]&&D[0].style?D[0].style[B]:g},setStyles:function(C,B){C=this.$$(C).css(B);if(this.settings.update_styles){C.attr("data-mce-style",null)}},removeAllAttribs:function(B){return this.run(B,function(E){var D,C=E.attributes;for(D=C.length-1;D>=0;D--){E.removeAttributeNode(C.item(D))}})},setAttrib:function(H,D,G){var C=this,B,F,E=C.settings;if(G===""){G=null}H=C.$$(H);B=H.attr(D);if(!H.length){return}F=C.attrHooks[D];if(F&&F.set){F.set(H,G,D)}else{H.attr(D,G)}if(B!=G&&E.onSetAttrib){E.onSetAttrib({attrElm:H,attrName:D,attrValue:G})}},setAttribs:function(D,C){var B=this;B.$$(D).each(function(E,F){m(C,function(H,G){B.setAttrib(F,G,H)})})},getAttrib:function(G,C,F){var B=this,E,D;G=B.$$(G);if(G.length){E=B.attrHooks[C];if(E&&E.get){D=E.get(G,C)}else{D=G.attr(C)}}if(typeof D=="undefined"){D=F||""}return D},getPos:function(D,E){var J=this,H=0,G=0,B,I=J.doc,C=I.body,F;D=J.get(D);E=E||C;if(D){if(E===C&&D.getBoundingClientRect&&o(C).css("position")==="static"){F=D.getBoundingClientRect();E=J.boxModel?I.documentElement:C;H=F.left+(I.documentElement.scrollLeft||C.scrollLeft)-E.clientLeft;G=F.top+(I.documentElement.scrollTop||C.scrollTop)-E.clientTop;return{x:H,y:G}}B=D;while(B&&B!=E&&B.nodeType){H+=B.offsetLeft||0;G+=B.offsetTop||0;B=B.offsetParent}B=D.parentNode;while(B&&B!=E&&B.nodeType){H-=B.scrollLeft||0;G-=B.scrollTop||0;B=B.parentNode}}return{x:H,y:G}},parseStyle:function(B){return this.styles.parse(B)},serializeStyle:function(C,B){return this.styles.serialize(C,B)},addStyle:function(E){var C=this,F=C.doc,D,G;if(C!==y.DOM&&F===document){var B=y.DOM.addedStyles;B=B||[];if(B[E]){return}B[E]=true;y.DOM.addedStyles=B}G=F.getElementById("mceDefaultStyles");if(!G){G=F.createElement("style");G.id="mceDefaultStyles";G.type="text/css";D=F.getElementsByTagName("head")[0];if(D.firstChild){D.insertBefore(G,D.firstChild)}else{D.appendChild(G)}}if(G.styleSheet){G.styleSheet.cssText+=E}else{G.appendChild(F.createTextNode(E))}},loadCSS:function(C){var B=this,E=B.doc,D;if(B!==y.DOM&&E===document){y.DOM.loadCSS(C);return}if(!C){C=""}D=E.getElementsByTagName("head")[0];m(C.split(","),function(F){var G;F=i._addCacheSuffix(F);if(B.files[F]){return}B.files[F]=true;G=B.create("link",{rel:"stylesheet",href:F});if(v&&E.documentMode&&E.recalc){G.onload=function(){if(E.recalc){E.recalc()}G.onload=null}}D.appendChild(G)})},addClass:function(C,B){this.$$(C).addClass(B)},removeClass:function(C,B){this.toggleClass(C,B,false)},hasClass:function(C,B){return this.$$(C).hasClass(B)},toggleClass:function(D,B,C){this.$$(D).toggleClass(B,C).each(function(){if(this.className===""){o(this).attr("class",null)}})},show:function(B){this.$$(B).show()},hide:function(B){this.$$(B).hide()},isHidden:function(B){return this.$$(B).css("display")=="none"},uniqueId:function(B){return(!B?"mce_":B)+(this.counter++)},setHTML:function(C,B){C=this.$$(C);if(v){C.each(function(E,F){if(F.canHaveHTML===false){return}while(F.firstChild){F.removeChild(F.firstChild)}try{F.innerHTML="
    "+B;F.removeChild(F.firstChild)}catch(D){o("
    ").html("
    "+B).contents().slice(1).appendTo(F)}return B})}else{C.html(B)}},getOuterHTML:function(B){B=this.get(B);return B.nodeType==1&&"outerHTML" in B?B.outerHTML:o("
    ").append(o(B).clone()).html()},setOuterHTML:function(D,C){var B=this;B.$$(D).each(function(){try{if("outerHTML" in this){this.outerHTML=C;return}}catch(E){}B.remove(o(this).html(C),true)})},decode:l.decode,encode:l.encodeAllRaw,insertAfter:function(C,B){B=this.get(B);return this.run(C,function(E){var D,F;D=B.parentNode;F=B.nextSibling;if(F){D.insertBefore(E,F)}else{D.appendChild(E)}return E})},replace:function(D,C,E){var B=this;return B.run(C,function(F){if(q(F,"array")){D=D.cloneNode(true)}if(E){m(s(F.childNodes),function(G){D.appendChild(G)})}return F.parentNode.replaceChild(D,F)})},rename:function(E,C){var B=this,D;if(E.nodeName!=C.toUpperCase()){D=B.create(C);m(B.getAttribs(E),function(F){B.setAttrib(D,F.nodeName,B.getAttrib(E,F.nodeName))});B.replace(D,E,1)}return D||E},findCommonAncestor:function(D,B){var E=D,C;while(E){C=B;while(C&&E!=C){C=C.parentNode}if(E==C){break}E=E.parentNode}if(!E&&D.ownerDocument){return D.ownerDocument.documentElement}return E},toHex:function(B){return this.styles.toHex(i.trim(B))},run:function(F,E,D){var C=this,B;if(typeof F==="string"){F=C.get(F)}if(!F){return false}D=D||this;if(!F.nodeType&&(F.length||F.length===0)){B=[];m(F,function(H,G){if(H){if(typeof H=="string"){H=C.get(H)}B.push(E.call(D,H,G))}});return B}return E.call(D,F)},getAttribs:function(D){var B;D=this.get(D);if(!D){return[]}if(v){B=[];if(D.nodeName=="OBJECT"){return D.attributes}if(D.nodeName==="OPTION"&&this.getAttrib(D,"selected")){B.push({specified:1,nodeName:"selected"})}var C=/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi;D.cloneNode(false).outerHTML.replace(C,"").replace(/[\w:\-]+/gi,function(E){B.push({specified:1,nodeName:E})});return B}return D.attributes},isEmpty:function(E,C){var J=this,G,F,I,B,D,H=0;E=E.firstChild;if(E){B=new p(E,E.parentNode);C=C||(J.schema?J.schema.getNonEmptyElements():null);do{I=E.nodeType;if(I===1){if(E.getAttribute("data-mce-bogus")){continue}D=E.nodeName.toLowerCase();if(C&&C[D]){if(D==="br"){H++;continue}return false}F=J.getAttribs(E);G=F.length;while(G--){D=F[G].nodeName;if(D==="name"||D==="data-mce-bookmark"){return false}}}if(I==8){return false}if((I===3&&!A.test(E.nodeValue))){return false}}while((E=B.next()))}return H<=1},createRng:function(){var B=this.doc;return B.createRange?B.createRange():new z(this)},nodeIndex:function(E,F){var B=0,D,C;if(E){for(D=E.nodeType,E=E.previousSibling;E;E=E.previousSibling){C=E.nodeType;if(F&&C==3){if(C==D||!E.nodeValue.length){continue}}B++;D=C}}return B},split:function(F,G,C){var J=this,B=J.createRng(),H,E,I;function D(O){var M,L=O.childNodes,N=O.nodeType;function P(S){var R=S.previousSibling&&S.previousSibling.nodeName=="SPAN";var Q=S.nextSibling&&S.nextSibling.nodeName=="SPAN";return R&&Q}if(N==1&&O.getAttribute("data-mce-type")=="bookmark"){return}for(M=L.length-1;M>=0;M--){D(L[M])}if(N!=9){if(N==3&&O.nodeValue.length>0){var K=w(O.nodeValue).length;if(!J.isBlock(O.parentNode)||K>0||K===0&&P(O)){return}}else{if(N==1){L=O.childNodes;if(L.length==1&&L[0]&&L[0].nodeType==1&&L[0].getAttribute("data-mce-type")=="bookmark"){O.parentNode.insertBefore(L[0],O)}if(L.length||/^(br|hr|input|img)$/i.test(O.nodeName)){return}}}J.remove(O)}return O}if(F&&G){B.setStart(F.parentNode,J.nodeIndex(F));B.setEnd(G.parentNode,J.nodeIndex(G));H=B.extractContents();B=J.createRng();B.setStart(G.parentNode,J.nodeIndex(G)+1);B.setEnd(F.parentNode,J.nodeIndex(F)+1);E=B.extractContents();I=F.parentNode;I.insertBefore(D(H),F);if(C){I.replaceChild(C,G)}else{I.insertBefore(G,F)}I.insertBefore(D(E),F);J.remove(F);return C||G}},bind:function(G,C,F,E){var B=this;if(i.isArray(G)){var D=G.length;while(D--){G[D]=B.bind(G[D],C,F,E)}return G}if(B.settings.collect&&(G===B.doc||G===B.win)){B.boundEvents.push([G,C,F,E])}return B.events.bind(G,C,F,E||B)},unbind:function(G,C,F){var B=this,D;if(i.isArray(G)){D=G.length;while(D--){G[D]=B.unbind(G[D],C,F)}return G}if(B.boundEvents&&(G===B.doc||G===B.win)){D=B.boundEvents.length;while(D--){var E=B.boundEvents[D];if(G==E[0]&&(!C||C==E[1])&&(!F||F==E[2])){this.events.unbind(E[0],E[1],E[2])}}}return this.events.unbind(G,C,F)},fire:function(D,C,B){return this.events.fire(D,C,B)},getContentEditable:function(C){var B;if(!C||C.nodeType!=1){return null}B=C.getAttribute("data-mce-contenteditable");if(B&&B!=="inherit"){return B}return C.contentEditable!=="inherit"?C.contentEditable:null},getContentEditableParent:function(C){var B=this.getRoot(),D=null;for(;C&&C!==B;C=C.parentNode){D=this.getContentEditable(C);if(D!==null){break}}return D},destroy:function(){var B=this;if(B.boundEvents){var C=B.boundEvents.length;while(C--){var D=B.boundEvents[C];this.events.unbind(D[0],D[1],D[2])}B.boundEvents=null}if(k.setDocument){k.setDocument()}B.win=B.doc=B.root=B.events=B.frag=null},isChildOf:function(C,B){while(C){if(B===C){return true}C=C.parentNode}return false},dumpRng:function(B){return("startContainer: "+B.startContainer.nodeName+", startOffset: "+B.startOffset+", endContainer: "+B.endContainer.nodeName+", endOffset: "+B.endOffset)},_findSib:function(F,B,D){var C=this,E=B;if(F){if(typeof E=="string"){E=function(G){return C.is(G,B)}}for(F=F[D];F;F=F[D]){if(E(F)){return F}}}return null}};y.DOM=new y(document);return y});h("tinymce/dom/ScriptLoader",["tinymce/dom/DOMUtils","tinymce/util/Tools"],function(m,i){var k=m.DOM;var l=i.each,j=i.grep;function n(){var p=0,w=1,u=2,x={},v=[],r={},q=[],t=0,s;function o(A,E){var B=k,D,C;function y(){B.remove(C);if(D){D.onreadystatechange=D.onload=D=null}E()}function z(){if(typeof console!=="undefined"&&console.log){console.log("Failed to load: "+A)}}C=B.uniqueId();D=document.createElement("script");D.id=C;D.type="text/javascript";D.src=i._addCacheSuffix(A);if("onreadystatechange" in D){D.onreadystatechange=function(){if(/loaded|complete/.test(D.readyState)){y()}}}else{D.onload=y}D.onerror=z;(document.getElementsByTagName("head")[0]||document.body).appendChild(D)}this.isDone=function(y){return x[y]==u};this.markDone=function(y){x[y]=u};this.add=this.load=function(y,B,z){var A=x[y];if(A==s){v.push(y);x[y]=p}if(B){if(!r[y]){r[y]=[]}r[y].push({func:B,scope:z||this})}};this.loadQueue=function(z,y){this.loadScripts(v,z,y)};this.loadScripts=function(y,C,B){var A;function z(D){l(r[D],function(E){E.func.call(E.scope)});r[D]=s}q.push({func:C,scope:B||this});A=function(){var D=j(y);y.length=0;l(D,function(E){if(x[E]==u){z(E);return}if(x[E]!=w){x[E]=w;t++;o(E,function(){x[E]=u;t--;z(E);A()})}});if(!t){l(q,function(E){E.func.call(E.scope)});q.length=0}};A()}}n.ScriptLoader=new n();return n});h("tinymce/AddOnManager",["tinymce/dom/ScriptLoader","tinymce/util/Tools"],function(l,i){var k=i.each;function j(){var m=this;m.items=[];m.urls={};m.lookup={}}j.prototype={get:function(m){if(this.lookup[m]){return this.lookup[m].instance}else{return g}},dependencies:function(n){var m;if(this.lookup[n]){m=this.lookup[n].dependencies}return m||[]},requireLangPack:function(m,n){var o=j.language;if(o&&j.languageLoad!==false){if(n){n=","+n+",";if(n.indexOf(","+o.substr(0,2)+",")!=-1){o=o.substr(0,2)}else{if(n.indexOf(","+o+",")==-1){return}}}l.ScriptLoader.add(this.urls[m]+"/langs/"+o+".js")}},add:function(o,m,n){this.items.push(m);this.lookup[o]={instance:m,dependencies:n};return m},createUrl:function(m,n){if(typeof n==="object"){return n}else{return{prefix:m.prefix,resource:n,suffix:m.suffix}}},addComponents:function(o,m){var n=this.urls[o];k(m,function(p){l.ScriptLoader.add(n+"/"+p)})},load:function(o,q,s,p){var m=this,n=q;function r(){var t=m.dependencies(o);k(t,function(v){var u=m.createUrl(q,v);m.load(u.resource,u,g,g)});if(s){if(p){s.call(p)}else{s.call(l)}}}if(m.urls[o]){return}if(typeof q==="object"){n=q.prefix+q.resource+q.suffix}if(n.indexOf("/")!==0&&n.indexOf("://")==-1){n=j.baseURL+"/"+n}m.urls[o]=n.substring(0,n.lastIndexOf("/"));if(m.lookup[o]){r()}else{l.ScriptLoader.add(n,r,p)}}};j.PluginManager=new j();j.ThemeManager=new j();return j});h("tinymce/dom/RangeUtils",["tinymce/util/Tools","tinymce/dom/TreeWalker"],function(i,j){var l=i.each;function m(n,o){var p=n.childNodes;o--;if(o>p.length-1){o=p.length-1}else{if(o<0){o=0}}return p[o]||n}function k(n){this.walk=function(o,D){var t=o.startContainer,w=o.startOffset,E=o.endContainer,x=o.endOffset,u,r,z,s,C,B,p;p=n.select("td.mce-item-selected,th.mce-item-selected");if(p.length>0){l(p,function(F){D([F])});return}function q(F){var G;G=F[0];if(G.nodeType===3&&G===t&&w>=G.nodeValue.length){F.splice(0,1)}G=F[F.length-1];if(x===0&&F.length>0&&G===E&&G.nodeType===3){F.splice(F.length-1,1)}return F}function A(H,G,F){var I=[];for(;H&&H!=F;H=H[G]){I.push(H)}return I}function y(G,F){do{if(G.parentNode==F){return G}G=G.parentNode}while(G)}function v(H,G,I){var F=I?"nextSibling":"previousSibling";for(s=H,C=s.parentNode;s&&s!=G;s=C){C=s.parentNode;B=A(s==H?s:s[F],F);if(B.length){if(!I){B.reverse()}D(q(B))}}}if(t.nodeType==1&&t.hasChildNodes()){t=t.childNodes[w]}if(E.nodeType==1&&E.hasChildNodes()){E=m(E,x)}if(t==E){return D(q([t]))}u=n.findCommonAncestor(t,E);for(s=t;s;s=s.parentNode){if(s===E){return v(t,u,true)}if(s===u){break}}for(s=E;s;s=s.parentNode){if(s===t){return v(E,u)}if(s===u){break}}r=y(t,u)||t;z=y(E,u)||E;v(t,r,true);B=A(r==t?r:r.nextSibling,"nextSibling",z==E?z.nextSibling:z);if(B.length){D(q(B))}v(E,z)};this.split=function(p){var s=p.startContainer,o=p.startOffset,t=p.endContainer,r=p.endOffset;function q(u,v){return u.splitText(v)}if(s==t&&s.nodeType==3){if(o>0&&oo){r=r-o;s=t=q(t,r).previousSibling;r=t.nodeValue.length;o=0}else{r=0}}}else{if(s.nodeType==3&&o>0&&o0&&r0){t=v;x=H?v.nodeValue.length:0;r=true;return}if(n.isBlock(v)||y[v.nodeName.toLowerCase()]){return}F=v}if(q&&F){t=F;r=true;x=0}}t=o[(u?"start":"end")+"Container"];x=o[(u?"start":"end")+"Offset"];w=t.nodeType==1&&x===t.childNodes.length;y=n.schema.getNonEmptyElements();B=u;if(t.nodeType==1&&x>t.childNodes.length-1){B=false}if(t.nodeType===9){t=n.getRoot();x=0}if(t===z){if(B){v=t.childNodes[x>0?x-1:0];if(v){if(y[v.nodeName]||v.nodeName=="TABLE"){return}}}if(t.hasChildNodes()){x=Math.min(!B&&x>0?x-1:x,t.childNodes.length-1);t=t.childNodes[x];x=0;if(t.hasChildNodes()&&!/TABLE/.test(t.nodeName)){v=t;s=new j(t,z);do{if(v.nodeType===3&&v.nodeValue.length>0){x=B?0:v.nodeValue.length;t=v;r=true;break}if(y[v.nodeName.toLowerCase()]){x=n.nodeIndex(v);t=v.parentNode;if(v.nodeName=="IMG"&&!B){x++}r=true;break}}while((v=(B?s.next():s.prev())))}}}if(q){if(t.nodeType===3&&x===0){C(true)}if(t.nodeType===1){v=t.childNodes[x];if(!v){v=t.childNodes[x-1]}if(v&&v.nodeName==="BR"&&!A(v,"A")&&!D(v)&&!D(v,true)){C(true,v)}}}if(B&&!q&&t.nodeType===3&&x===t.nodeValue.length){C(false)}if(r){o["set"+(u?"Start":"End")](t,x)}}q=o.collapsed;p(true);if(!q){p()}if(r&&q){o.collapse(true)}return r}}k.compareRanges=function(o,n){if(o&&n){if(o.item||o.duplicate){if(o.item&&n.item&&o.item(0)===n.item(0)){return true}if(o.isEqual&&n.isEqual&&n.isEqual(o)){return true}}else{return o.startContainer==n.startContainer&&o.startOffset==n.startOffset}}return false};k.getCaretRangeFromPoint=function(o,s,r){var p,n;if(r.caretPositionFromPoint){n=r.caretPositionFromPoint(o,s);p=r.createRange();p.setStart(n.offsetNode,n.offset);p.collapse(true)}else{if(r.caretRangeFromPoint){p=r.caretRangeFromPoint(o,s)}else{if(r.body.createTextRange){p=r.body.createTextRange();try{p.moveToPoint(o,s);p.collapse(true)}catch(q){p.collapse(s=n.childNodes.length){o=n.childNodes.length-1}n=n.childNodes[o]}return n};return k});h("tinymce/NodeChange",["tinymce/dom/RangeUtils","tinymce/Env"],function(j,i){return function(k){var m,l=[];function n(o){var p,q;q=k.$(o).parentsUntil(k.getBody()).add(o);if(q.length===l.length){for(p=q.length;p>=0;p--){if(q[p]!==l[p]){break}}if(p===-1){l=q;return true}}l=q;return false}if(!("onselectionchange" in k.getDoc())){k.on("NodeChange Click MouseUp KeyUp Focus",function(p){var q,o;q=k.selection.getRng();o={startContainer:q.startContainer,startOffset:q.startOffset,endContainer:q.endContainer,endOffset:q.endOffset};if(p.type=="nodechange"||!j.compareRanges(o,m)){k.fire("SelectionChange")}m=o})}k.on("contextmenu",function(){k.fire("SelectionChange")});k.on("SelectionChange",function(){var o=k.selection.getStart(true);if(!i.range&&k.selection.isCollapsed()){return}if(!n(o)&&k.dom.isChildOf(o,k.getBody())){k.nodeChanged({selectionChange:true})}});k.on("MouseUp",function(o){if(!o.isDefaultPrevented()){if(k.selection.getNode().nodeName=="IMG"){setTimeout(function(){k.nodeChanged()},0)}else{k.nodeChanged()}}});this.nodeChanged=function(q){var r=k.selection,s,p,o;if(k.initialized&&r&&!k.settings.disable_nodechange&&!k.settings.readonly){o=k.getBody();s=r.getStart()||o;s=s.ownerDocument!=k.getDoc()?k.getBody():s;if(s.nodeName=="IMG"&&r.isCollapsed()){s=s.parentNode}p=[];k.dom.getParent(s,function(t){if(t===o){return true}p.push(t)});q=q||{};q.element=s;q.parents=p;k.fire("NodeChange",q)}}}});h("tinymce/html/Node",[],function(){var k=/^[ \t\r\n]*$/,l={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};function i(r,s,q){var p,o,m=q?"lastChild":"firstChild",n=q?"prev":"next";if(r[m]){return r[m]}if(r!==s){p=r[n];if(p){return p}for(o=r.parent;o&&o!==s;o=o.parent){p=o[n];if(p){return p}}}}function j(m,n){this.name=m;this.type=n;if(n===1){this.attributes=[];this.attributes.map={}}}j.prototype={replace:function(n){var m=this;if(n.parent){n.remove()}m.insert(n,m);m.remove();return m},attr:function(o,r){var m=this,n,p,q;if(typeof o!=="string"){for(p in o){m.attr(p,o[p])}return m}if((n=m.attributes)){if(r!==q){if(r===null){if(o in n.map){delete n.map[o];p=n.length;while(p--){if(n[p].name===o){n=n.splice(p,1);return m}}}return m}if(o in n.map){p=n.length;while(p--){if(n[p].name===o){n[p].value=r;break}}}else{n.push({name:o,value:r})}n.map[o]=r;return m}else{return n.map[o]}}},clone:function(){var n=this,s=new j(n.name,n.type),o,m,r,p,q;if((r=n.attributes)){q=[];q.map={};for(o=0,m=r.length;o
    ")},postRender:function(){var q=this,r;q.items().exec("postRender");q._super();q._layout.postRender(q);q._rendered=true;if(q.settings.style){j.css(q.getEl(),q.settings.style)}if(q.settings.border){r=q.borderBox();j.css(q.getEl(),{"border-top-width":r.top,"border-right-width":r.right,"border-bottom-width":r.bottom,"border-left-width":r.left})}if(!q.parent()){q.keyboardNav=new n({root:q})}return q},initLayoutRect:function(){var q=this,r=q._super();q._layout.recalc(q);return r},recalc:function(){var q=this,s=q._layoutRect,r=q._lastRect;if(!r||r.w!=s.w||r.h!=s.h){q._layout.recalc(q);s=q.layoutRect();q._lastRect={x:s.x,y:s.y,w:s.w,h:s.h};return true}},reflow:function(){var q;if(this.visible()){p.repaintControls=[];p.repaintControls.map={};this.recalc();q=p.repaintControls.length;while(q--){p.repaintControls[q].repaint()}if(this.settings.layout!=="flow"&&this.settings.layout!=="stack"){this.repaint()}p.repaintControls=[]}return this}})});h("tinymce/ui/DragHelper",["tinymce/ui/DomUtils"],function(i){function j(){var r=document,s,n,l,q;var o,t,m,k,p=Math.max;s=r.documentElement;n=r.body;l=p(s.scrollWidth,n.scrollWidth);q=p(s.clientWidth,n.clientWidth);o=p(s.offsetWidth,n.offsetWidth);t=p(s.scrollHeight,n.scrollHeight);m=p(s.clientHeight,n.clientHeight);k=p(s.offsetHeight,n.offsetHeight);return{width:lp.clientWidth;q=p.scrollHeight>p.clientHeight;o("h","Left","Width","contentW",r,"Height");o("v","Top","Height","contentH",q,"Width")}function k(){function o(v,r,p,w,t){var u,q=l._id+"-scroll"+v,s=l.classPrefix;l.getEl().appendChild(i.createFragment('
    '));l.draghelper=new j(q+"t",{start:function(){u=l.getEl("body")["scroll"+r];i.addClass(i.get(q),s+"active")},drag:function(A){var x,C,z,B,y=l.layoutRect();C=y.contentW>y.innerW;z=y.contentH>y.innerH;B=l.getEl("body")["client"+p]-(m*2);B-=C&&z?l.getEl("scroll"+v)["client"+t]:0;x=B/l.getEl("body")["scroll"+p];l.getEl("body")["scroll"+r]=u+(A["delta"+w]/x)},stop:function(){i.removeClass(i.get(q),s+"active")}})}l.addClass("scroll");o("v","Top","Height","Y","Width");o("h","Left","Width","X","Height")}if(l.settings.autoScroll){if(!l._hasScroll){l._hasScroll=true;k();l.on("wheel",function(p){var o=l.getEl("body");o.scrollLeft+=(p.deltaX||0)*10;o.scrollTop+=p.deltaY*10;n()});i.on(l.getEl("body"),"scroll",n)}n()}}}});h("tinymce/ui/Panel",["tinymce/ui/Container","tinymce/ui/Scrollable"],function(j,i){return j.extend({Defaults:{layout:"fit",containerCls:"panel"},Mixins:[i],renderHtml:function(){var l=this,m=l._layout,k=l.settings.html;l.preRender();m.preRender(l);if(typeof k=="undefined"){k=('
    '+m.renderHtml(l)+"
    ")}else{if(typeof k=="function"){k=k.call(l)}l._hasBody=false}return('
    '+(l._preBodyHtml||"")+k+"
    ")}})});h("tinymce/ui/Movable",["tinymce/ui/DomUtils"],function(i){function j(k,s,v){var u,o,r,p,t,m,q,l,n,w;n=i.getViewPort();o=i.getPos(s);r=o.x;p=o.y;if(k._fixed&&i.getRuntimeStyle(document.body,"position")=="static"){r-=n.x;p-=n.y}u=k.getEl();w=i.getSize(u);t=w.width;m=w.height;w=i.getSize(s);q=w.width;l=w.height;v=(v||"").split("");if(v[0]==="b"){p+=l}if(v[1]==="r"){r+=q}if(v[0]==="c"){p+=Math.round(l/2)}if(v[1]==="c"){r+=Math.round(q/2)}if(v[3]==="b"){p-=m}if(v[4]==="r"){r-=t}if(v[3]==="c"){p-=Math.round(m/2)}if(v[4]==="c"){r-=Math.round(t/2)}return{x:r,y:p,w:t,h:m}}return{testMoveRel:function(o,l){var k=i.getViewPort();for(var m=0;m0&&n.x+n.w0&&n.y+n.hk.x&&n.x+n.wk.y&&n.y+n.hq){s=q-r;return s<0?0:s}return s}if(m.settings.constrainToViewport){var n=i.getViewPort(window);var o=m.layoutRect();k=l(k,n.w+n.x,o.w);p=l(p,n.h+n.y,o.h)}if(m._rendered){m.layoutRect({x:k,y:p}).repaint()}else{m.settings.x=k;m.settings.y=p}m.fire("move",{x:k,y:p});return m}}});h("tinymce/ui/Resizable",["tinymce/ui/DomUtils"],function(i){return{resizeToContent:function(){this._layoutRect.autoResize=true;this._lastRect=null;this.reflow()},resizeTo:function(j,k){if(j<=1||k<=1){var l=i.getWindowSize();j=j<=1?j*l.w:j;k=k<=1?k*l.h:k}this._layoutRect.autoResize=false;return this.layoutRect({minW:j,minH:k,w:j,h:k}).reflow()},resizeBy:function(k,m){var j=this,l=j.layoutRect();return j.resizeTo(l.w+k,l.h+m)}}});h("tinymce/ui/FloatPanel",["tinymce/ui/Panel","tinymce/ui/Movable","tinymce/ui/Resizable","tinymce/ui/DomUtils"],function(w,t,k,i){var q,l,j,x=[];var o=[],y;function u(){function z(B,A){while(B){if(B==A){return true}B=B.parent()}}if(!q){q=function(D){if(D.button==2){return}var C=x.length;while(C--){var B=x[C],A=B.getParentCtrl(D.target);if(B.settings.autohide){if(A){if(z(A,B)||B.parent()===A){continue}}D=B.fire("autohide",{target:D.target});if(!D.isDefaultPrevented()){B.hide()}}}};i.on(document,"click",q)}}function n(){if(!l){l=function(){var z;z=x.length;while(z--){p(x[z])}};i.on(window,"scroll",l)}}function m(){if(!j){var A=document.documentElement,B=A.clientWidth,z=A.clientHeight;j=function(){if(!document.all||B!=A.clientWidth||z!=A.clientHeight){B=A.clientWidth;z=A.clientHeight;r.hideAll()}};i.on(window,"resize",j)}}function p(z){var A=i.getViewPort().y;function B(F,C){var E;for(var D=0;DA){z.fixed(false).layoutRect({y:z._autoFixY}).repaint();B(false,z._autoFixY-A)}}}}function v(D,B){var z,E=r.zIndex||65535,A;if(D){o.push(B)}else{z=o.length;while(z--){if(o[z]===B){o.splice(z,1)}}}if(o.length){for(z=0;z
    ');C=C.firstChild;z.getContainerElm().appendChild(C);setTimeout(function(){i.addClass(C,B+"in");i.addClass(z.getEl(),B+"in")},0);y=true}v(true,z)}});z.on("show",function(){z.parents().each(function(B){if(B._fixed){z.fixed(true);return false}})});if(A.popover){z._preBodyHtml='
    ';z.addClass("popover").addClass("bottom").addClass(z.isRtl()?"end":"start")}},fixed:function(B){var A=this;if(A._fixed!=B){if(A._rendered){var z=i.getViewPort();if(B){A.layoutRect().y-=z.y}else{A.layoutRect().y+=z.y}}A.toggleClass("fixed",B);A._fixed=B}return A},show:function(){var z=this,A,B=z._super();A=x.length;while(A--){if(x[A]===z){break}}if(A===-1){x.push(z)}return B},hide:function(){s(this);v(false,this);return this._super()},hideAll:function(){r.hideAll()},close:function(){var z=this;if(!z.fire("close").isDefaultPrevented()){z.remove();v(false,z)}return z},remove:function(){s(this);this._super()},postRender:function(){var z=this;if(z.settings.bodyRole){this.getEl("body").setAttribute("role",z.settings.bodyRole)}return z._super()}});r.hideAll=function(){var A=x.length;while(A--){var z=x[A];if(z&&z.settings.autohide){z.hide();x.splice(A,1)}}};function s(z){var A;A=x.length;while(A--){if(x[A]===z){x.splice(A,1)}}A=o.length;while(A--){if(o[A]===z){o.splice(A,1)}}}return r});h("tinymce/ui/Window",["tinymce/ui/FloatPanel","tinymce/ui/Panel","tinymce/ui/DomUtils","tinymce/ui/DragHelper"],function(m,l,i,k){var j=m.extend({modal:true,Defaults:{border:1,layout:"flex",containerCls:"panel",role:"dialog",callbacks:{submit:function(){this.fire("submit",{data:this.toJSON()})},close:function(){this.close()}}},init:function(o){var n=this;n._super(o);if(n.isRtl()){n.addClass("rtl")}n.addClass("window");n._fixed=true;if(o.buttons){n.statusbar=new l({layout:"flex",border:"1 0 0 0",spacing:3,padding:10,align:"center",pack:n.isRtl()?"start":"end",defaults:{type:"button"},items:o.buttons});n.statusbar.addClass("foot");n.statusbar.parent(n)}n.on("click",function(p){if(p.target.className.indexOf(n.classPrefix+"close")!=-1){n.close()}});n.on("cancel",function(){n.close()});n.aria("describedby",n.describedBy||n._id+"-none");n.aria("label",o.title);n._fullscreen=false},recalc:function(){var o=this,r=o.statusbar,q,p,n,s;if(o._fullscreen){o.layoutRect(i.getWindowSize());o.layoutRect().contentH=o.layoutRect().innerH}o._super();q=o.layoutRect();if(o.settings.title&&!o._fullscreen){p=q.headerW;if(p>q.w){n=q.x-Math.max(0,p/2);o.layoutRect({w:p,x:n});s=true}}if(r){r.layoutRect({w:o.layoutRect().innerW}).recalc();p=r.layoutRect().minW+q.deltaW;if(p>q.w){n=q.x-Math.max(0,p-q.w);o.layoutRect({w:p,x:n});s=true}}if(s){o.recalc()}},initLayoutRect:function(){var n=this,r=n._super(),q=0,s;if(n.settings.title&&!n._fullscreen){s=n.getEl("head");var o=i.getSize(s);r.headerW=o.width;r.headerH=o.height;q+=r.headerH}if(n.statusbar){q+=n.statusbar.layoutRect().h}r.deltaH+=q;r.minH+=q;r.h+=q;var p=i.getWindowSize();r.x=Math.max(0,p.w/2-r.w/2);r.y=Math.max(0,p.h/2-r.h/2);return r},renderHtml:function(){var o=this,r=o._layout,u=o._id,s=o.classPrefix;var q=o.settings,n="",t="",p=q.html;o.preRender();r.preRender(o);if(q.title){n=('
    '+o.encode(q.title)+'
    ')}if(q.url){p=''}if(typeof p=="undefined"){p=r.renderHtml(o)}if(o.statusbar){t=o.statusbar.renderHtml()}return('
    '+n+'
    '+p+"
    "+t+"
    ")},fullscreen:function(t){var n=this,s=document.documentElement,o,r=n.classPrefix,q;if(t!=n._fullscreen){i.on(window,"resize",function(){var v;if(n._fullscreen){if(!o){v=new Date().getTime();var u=i.getWindowSize();n.moveTo(0,0).resizeTo(u.w,u.h);if((new Date().getTime())-v>50){o=true}}else{if(!n._timer){n._timer=setTimeout(function(){var w=i.getWindowSize();n.moveTo(0,0).resizeTo(w.w,w.h);n._timer=0},50)}}}});q=n.layoutRect();n._fullscreen=t;if(!t){n._borderBox=n.parseBox(n.settings.border);n.getEl("head").style.display="";q.deltaH+=q.headerH;i.removeClass(s,r+"fullscreen");i.removeClass(document.body,r+"fullscreen");n.removeClass("fullscreen");n.moveTo(n._initial.x,n._initial.y).resizeTo(n._initial.w,n._initial.h)}else{n._initial={x:q.x,y:q.y,w:q.w,h:q.h};n._borderBox=n.parseBox("0");n.getEl("head").style.display="none";q.deltaH-=q.headerH+2;i.addClass(s,r+"fullscreen");i.addClass(document.body,r+"fullscreen");n.addClass("fullscreen");var p=i.getWindowSize();n.moveTo(0,0).resizeTo(p.w,p.h)}}return n.reflow()},postRender:function(){var n=this,o;setTimeout(function(){n.addClass("in")},0);n._super();if(n.statusbar){n.statusbar.postRender()}n.focus();this.dragHelper=new k(n._id+"-dragh",{start:function(){o={x:n.layoutRect().x,y:n.layoutRect().y}},drag:function(p){n.moveTo(o.x+p.deltaX,o.y+p.deltaY)}});n.on("submit",function(p){if(!p.isDefaultPrevented()){n.close()}})},submit:function(){return this.fire("submit",{data:this.toJSON()})},remove:function(){var n=this,o=n.classPrefix;n.dragHelper.destroy();n._super();if(n.statusbar){this.statusbar.remove()}if(n._fullscreen){i.removeClass(document.documentElement,o+"fullscreen");i.removeClass(document.body,o+"fullscreen")}},getContentWindow:function(){var n=this.getEl().getElementsByTagName("iframe")[0];return n?n.contentWindow:null}});return j});h("tinymce/ui/MessageBox",["tinymce/ui/Window"],function(j){var i=j.extend({init:function(k){k={border:1,padding:20,layout:"flex",pack:"center",align:"center",containerCls:"panel",autoScroll:true,buttons:{type:"button",text:"Ok",action:"ok"},items:{type:"label",multiline:true,maxWidth:500,maxHeight:200}};this._super(k)},Statics:{OK:1,OK_CANCEL:2,YES_NO:3,YES_NO_CANCEL:4,msgBox:function(l){var m,n=l.callback||function(){};function k(q,o,p){return{type:"button",text:q,subtype:p?"primary":"",onClick:function(r){r.control.parents()[1].close();n(o)}}}switch(l.buttons){case i.OK_CANCEL:m=[k("Ok",true,true),k("Cancel",false)];break;case i.YES_NO:case i.YES_NO_CANCEL:m=[k("Yes",1,true),k("No",0)];if(l.buttons==i.YES_NO_CANCEL){m.push(k("Cancel",-1))}break;default:m=[k("Ok",true,true)];break}return new j({padding:20,x:l.x,y:l.y,minWidth:300,minHeight:100,layout:"flex",pack:"center",align:"center",buttons:m,title:l.title,role:"alertdialog",items:{type:"label",multiline:true,maxWidth:500,maxHeight:200,text:l.text},onPostRender:function(){this.aria("describedby",this.items()[0]._id)},onClose:l.onClose,onCancel:function(){n(false)}}).renderTo(document.body).reflow()},alert:function(k,l){if(typeof k=="string"){k={text:k}}k.callback=l;return i.msgBox(k)},confirm:function(k,l){if(typeof k=="string"){k={text:k}}k.callback=l;k.buttons=i.OK_CANCEL;return i.msgBox(k)}}});return i});h("tinymce/WindowManager",["tinymce/ui/Window","tinymce/ui/MessageBox"],function(j,i){return function(m){var l=this,n=[];function k(){if(n.length){return n[n.length-1]}}l.windows=n;m.on("remove",function(){var o=n.length;while(o--){n[o].close()}});l.open=function(o,q){var p;m.editorManager.setActive(m);o.title=o.title||" ";o.url=o.url||o.file;if(o.url){o.width=parseInt(o.width||320,10);o.height=parseInt(o.height||240,10)}if(o.body){o.items={defaults:o.defaults,type:o.bodyType||"form",items:o.body}}if(!o.url&&!o.buttons){o.buttons=[{text:"Ok",subtype:"primary",onclick:function(){p.find("form")[0].submit()}},{text:"Cancel",onclick:function(){p.close()}}]}p=new j(o);n.push(p);p.on("close",function(){var r=n.length;while(r--){if(n[r]===p){n.splice(r,1)}}if(!n.length){m.focus()}});if(o.data){p.on("postRender",function(){this.find("*").each(function(s){var r=s.name();if(r in o.data){s.value(o.data[r])}})})}p.features=o||{};p.params=q||{};if(n.length===1){m.nodeChanged()}return p.renderTo().reflow()};l.alert=function(p,q,o){i.alert(p,function(){if(q){q.call(o||this)}else{m.focus()}})};l.confirm=function(p,q,o){i.confirm(p,function(r){q.call(o||this,r)})};l.close=function(){if(k()){k().close()}};l.getParams=function(){return k()?k().params:null};l.setParams=function(o){if(k()){k().params=o}};l.getWindows=function(){return n}}});h("tinymce/util/Quirks",["tinymce/util/VK","tinymce/dom/RangeUtils","tinymce/dom/TreeWalker","tinymce/html/Node","tinymce/html/Entities","tinymce/Env","tinymce/util/Tools"],function(n,m,l,k,o,i,j){return function(p){var aj=j.each,W=p.$;var s=n.BACKSPACE,E=n.DELETE,r=p.dom,G=p.selection,an=p.settings,V=p.parser,L=p.serializer;var u=i.gecko,C=i.ie,ag=i.webkit;var ab="data:text/mce-internal,";var t=C?"Text":"URL";function aa(au,at){try{p.getDoc().execCommand(au,false,at)}catch(ar){}}function J(){var ar=p.getDoc().documentMode;return ar?ar:6}function Z(ar){return ar.isDefaultPrevented()}function Q(at){var ar;if(at.dataTransfer){if(p.selection.isCollapsed()&&at.target.tagName=="IMG"){G.select(at.target)}ar=p.selection.getContent();if(ar.length>0){at.dataTransfer.setData(t,ab+escape(ar))}}}function K(at){var au,ar;if(at.dataTransfer){au=at.dataTransfer.getData(t);if(au&&au.indexOf(ab)>=0){ar=unescape(au.substr(ab.length))}}return ar}function R(ar){if(p.queryCommandSupported("mceInsertClipboardContent")){p.execCommand("mceInsertClipboardContent",false,{content:ar})}else{p.execCommand("mceInsertContent",false,ar)}}function ap(){var aD=p.getDoc(),ax=p.dom,aE=p.selection;var at=window.MutationObserver,ay,aC;if(!at){ay=true;at=function(){var aF=[],aI;function aH(aK){var aJ=aK.relatedNode||aK.target;aF.push({target:aJ,addedNodes:[aJ]})}function aG(aK){var aJ=aK.relatedNode||aK.target;aF.push({target:aJ,attributeName:aK.attrName})}this.observe=function(aJ){aI=aJ;aI.addEventListener("DOMSubtreeModified",aH,false);aI.addEventListener("DOMNodeInsertedIntoDocument",aH,false);aI.addEventListener("DOMNodeInserted",aH,false);aI.addEventListener("DOMAttrModified",aG,false)};this.disconnect=function(){aI.removeEventListener("DOMSubtreeModified",aH,false);aI.removeEventListener("DOMNodeInsertedIntoDocument",aH,false);aI.removeEventListener("DOMNodeInserted",aH,false);aI.removeEventListener("DOMAttrModified",aG,false)};this.takeRecords=function(){return aF}}}function ar(aH){var aG=ax.schema.getBlockElements(),aF=p.getBody();if(aH.nodeName!="BR"){return false}for(aH=aH;aH!=aF&&!aG[aH.nodeName];aH=aH.parentNode){if(aH.nextSibling){return false}}return true}function au(aG,aF){var aH;for(aH=aG.nextSibling;aH&&aH!=aF;aH=aH.nextSibling){if(aH.nodeType==3&&W.trim(aH.data).length===0){continue}if(aH!==aF){return false}}return aH===aF}function az(aI,aH,aG){var aK,aJ,aF;aF=ax.schema.getNonEmptyElements();aK=new l(aG||aI,aI);while((aJ=aK[aH?"next":"prev"]())){if(aF[aJ.nodeName]&&!ar(aJ)){return aJ}if(aJ.nodeType==3&&aJ.data.length>0){return aJ}}}function aB(aG){var aJ,aH,aF,aI,aK;if(aG.collapsed){return}aJ=ax.getParent(m.getNode(aG.startContainer,aG.startOffset),ax.isBlock);aH=ax.getParent(m.getNode(aG.endContainer,aG.endOffset),ax.isBlock);aK=p.schema.getTextBlockElements();if(aJ==aH){return}if(!aK[aJ.nodeName]||!aK[aH.nodeName]){return}if(ax.getContentEditable(aJ)==="false"||ax.getContentEditable(aH)==="false"){return}aG.deleteContents();aF=az(aJ,false);aI=az(aH,true);if(!ax.isEmpty(aH)){W(aJ).append(aH.childNodes)}W(aH).remove();if(aF){if(aF.nodeType==1){if(aF.nodeName=="BR"){aG.setStartBefore(aF);aG.setEndBefore(aF)}else{aG.setStartAfter(aF);aG.setEndAfter(aF)}}else{aG.setStart(aF,aF.data.length);aG.setEnd(aF,aF.data.length)}}else{if(aI){if(aI.nodeType==1){aG.setStartBefore(aI);aG.setEndBefore(aI)}else{aG.setStart(aI,0);aG.setEnd(aI,0)}}}aE.setRng(aG);return true}function aw(aG,aL){var aI,aK,aH,aJ,aF,aM;if(!aG.collapsed){return aG}aF=aG.startContainer;aM=aG.startOffset;if(aF.nodeType==3){if(aL){if(aM0){return aG}}}aI=m.getNode(aG.startContainer,aG.startOffset);aH=ax.getParent(aI,ax.isBlock);aK=az(p.getBody(),aL,aI);aJ=ax.getParent(aK,ax.isBlock);if(!aI||!aK){return aG}if(aJ&&aH!=aJ){if(!aL){if(!au(aJ,aH)){return aG}if(aK.nodeType==1){if(aK.nodeName=="BR"){aG.setStartBefore(aK)}else{aG.setStartAfter(aK)}}else{aG.setStart(aK,aK.data.length)}if(aI.nodeType==1){aG.setEnd(aI,0)}else{aG.setEndBefore(aI)}}else{if(!au(aH,aJ)){return aG}if(aI.nodeType==1){if(aI.nodeName=="BR"){aG.setStartBefore(aI)}else{aG.setStartAfter(aI)}}else{aG.setStart(aI,aI.data.length)}if(aK.nodeType==1){aG.setEnd(aK,0)}else{aG.setEndBefore(aK)}}}return aG}function av(aG){var aF=aE.getRng();aF=aw(aF,aG);if(aB(aF)){return true}}function aA(aH){var aG,aF,aI;if(av(aH)){return}j.each(p.getBody().getElementsByTagName("*"),function(aJ){if(aJ.tagName=="SPAN"){aJ.setAttribute("mce-data-marked",1)}if(!aJ.hasAttribute("data-mce-style")&&aJ.hasAttribute("style")){p.dom.setAttrib(aJ,"style",p.dom.getAttrib(aJ,"style"))}});aG=new at(function(){});aG.observe(p.getDoc(),{childList:true,attributes:true,subtree:true,attributeFilter:["style"]});p.getDoc().execCommand(aH?"ForwardDelete":"Delete",false,null);aF=p.selection.getRng();aI=aF.startContainer.parentNode;j.each(aG.takeRecords(),function(aJ){if(!ax.isChildOf(aJ.target,p.getBody())){return}if(aJ.attributeName=="style"){var aK=aJ.target.getAttribute("data-mce-style");if(aK){aJ.target.setAttribute("style",aK)}else{aJ.target.removeAttribute("style")}}j.each(aJ.addedNodes,function(aM){if(aM.nodeName=="SPAN"&&!aM.getAttribute("mce-data-marked")){var aN,aL;if(aM==aI){aN=aF.startOffset;aL=aM.firstChild}ax.remove(aM,true);if(aL){aF.setStart(aL,aN);aF.setEnd(aL,aN);p.selection.setRng(aF)}}})});aG.disconnect();j.each(p.dom.select("span[mce-data-marked]"),function(aJ){aJ.removeAttribute("mce-data-marked")})}p.on("keydown",function(aJ){var aI=aJ.keyCode==E,aF=aJ.ctrlKey||aJ.metaKey;if(!Z(aJ)&&(aI||aJ.keyCode==s)){var aH=p.selection.getRng(),aG=aH.startContainer,aK=aH.startOffset;if(!aF&&aH.collapsed&&aG.nodeType==3){if(aI?aK0){return}}aJ.preventDefault();if(aF){p.selection.getSel().modify("extend",aI?"forward":"backward",aJ.metaKey?"lineboundary":"word")}aA(aI)}});p.on("keypress",function(aK){if(!Z(aK)&&!aE.isCollapsed()&&aK.charCode&&!n.metaKeyPressed(aK)){var aF,aL,aJ,aG,aH,aI;aF=p.selection.getRng();aI=String.fromCharCode(aK.charCode);aK.preventDefault();aL=W(aF.startContainer).parents().filter(function(aM,aN){return !!p.schema.getTextInlineElements()[aN.nodeName]});aA(true);aL=aL.filter(function(aM,aN){return !W.contains(p.getBody(),aN)});if(aL.length){aJ=ax.createFragment();aL.each(function(aM,aN){aN=aN.cloneNode(false);if(aJ.hasChildNodes()){aN.appendChild(aJ.firstChild);aJ.appendChild(aN)}else{aH=aN;aJ.appendChild(aN)}aJ.appendChild(aN)});aH.appendChild(p.getDoc().createTextNode(aI));aG=ax.getParent(aF.startContainer,ax.isBlock);if(ax.isEmpty(aG)){W(aG).empty().append(aJ)}else{aF.insertNode(aJ)}aF.setStart(aH.firstChild,1);aF.setEnd(aH.firstChild,1);p.selection.setRng(aF)}else{p.selection.setContent(aI)}}});p.addCommand("Delete",function(){aA()});p.addCommand("ForwardDelete",function(){aA(true)});if(ay){return}p.on("dragstart",function(aF){aC=aE.getRng();Q(aF)});p.on("drop",function(aF){if(!Z(aF)){var aG=K(aF);if(aG){aF.preventDefault();window.setTimeout(function(){var aH=m.getCaretRangeFromPoint(aF.x,aF.y,aD);if(aC){aE.setRng(aC);aC=null}aA();aE.setRng(aH);R(aG)},0)}}});p.on("cut",function(aF){if(!Z(aF)&&aF.clipboardData){aF.preventDefault();aF.clipboardData.clearData();aF.clipboardData.setData("text/html",p.selection.getContent());aF.clipboardData.setData("text/plain",p.selection.getContent({format:"text"}));aA(true)}})}function P(){function ar(av){var au=r.create("body");var aw=av.cloneContents();au.appendChild(aw);return G.serializer.serialize(au,{format:"html"})}function at(au){if(!au.setStart){if(au.item){return false}var ay=au.duplicate();ay.moveToElementText(p.getBody());return m.compareRanges(au,ay)}var aw=ar(au);var ax=r.createRng();ax.selectNode(p.getBody());var av=ar(ax);return aw===av}p.on("keydown",function(ax){var aw=ax.keyCode,av,au;if(!Z(ax)&&(aw==E||aw==s)){av=p.selection.isCollapsed();au=p.getBody();if(av&&!r.isEmpty(au)){return}if(!av&&!at(p.selection.getRng())){return}ax.preventDefault();p.setContent("");if(au.firstChild&&r.isBlock(au.firstChild)){p.selection.setCursorLocation(au.firstChild,0)}else{p.selection.setCursorLocation(au,0)}p.nodeChanged()}})}function ao(){p.shortcuts.add("meta+a",null,"SelectAll")}function aq(){if(!p.settings.content_editable){r.bind(p.getDoc(),"focusin",function(){G.setRng(G.getRng())});r.bind(p.getDoc(),"mousedown mouseup",function(ar){if(ar.target==p.getDoc().documentElement){p.getBody().focus();if(ar.type=="mousedown"){G.placeCaretAt(ar.clientX,ar.clientY)}else{G.setRng(G.getRng())}}})}}function ad(){p.on("keydown",function(au){if(!Z(au)&&au.keyCode===s){if(!p.getBody().getElementsByTagName("hr").length){return}if(G.isCollapsed()&&G.getRng(true).startOffset===0){var at=G.getNode();var ar=at.previousSibling;if(at.nodeName=="HR"){r.remove(at);au.preventDefault();return}if(ar&&ar.nodeName&&ar.nodeName.toLowerCase()==="hr"){r.remove(ar);au.preventDefault()}}}})}function Y(){if(!window.Range.prototype.getClientRects){p.on("mousedown",function(at){if(!Z(at)&&at.target.nodeName==="HTML"){var ar=p.getBody();ar.blur();setTimeout(function(){ar.focus()},0)}})}}function x(){p.on("click",function(at){var ar=at.target;if(/^(IMG|HR)$/.test(ar.nodeName)){at.preventDefault();G.getSel().setBaseAndExtent(ar,0,ar,1);p.nodeChanged()}if(ar.nodeName=="A"&&r.hasClass(ar,"mce-item-anchor")){at.preventDefault();G.select(ar)}})}function ak(){function at(){var au=r.getAttribs(G.getStart().cloneNode(false));return function(){var av=G.getStart();if(av!==p.getBody()){r.setAttrib(av,"style",null);aj(au,function(aw){av.setAttributeNode(aw.cloneNode(true))})}}}function ar(){return !G.isCollapsed()&&r.getParent(G.getStart(),r.isBlock)!=r.getParent(G.getEnd(),r.isBlock)}p.on("keypress",function(av){var au;if(!Z(av)&&(av.keyCode==8||av.keyCode==46)&&ar()){au=at();p.getDoc().execCommand("delete",false,null);au();av.preventDefault();return false}});r.bind(p.getDoc(),"cut",function(av){var au;if(!Z(av)&&ar()){au=at();setTimeout(function(){au()},0)}})}function X(){document.body.setAttribute("role","application")}function U(){p.on("keydown",function(at){if(!Z(at)&&at.keyCode===s){if(G.isCollapsed()&&G.getRng(true).startOffset===0){var ar=G.getNode().previousSibling;if(ar&&ar.nodeName&&ar.nodeName.toLowerCase()==="table"){at.preventDefault();return false}}}})}function ah(){if(J()>7){return}aa("RespectVisibilityInDesign",true);p.contentStyles.push(".mceHideBrInPre pre br {display: none}");r.addClass(p.getBody(),"mceHideBrInPre");V.addNodeFilter("pre",function(ar){var au=ar.length,aw,at,ax,av;while(au--){aw=ar[au].getAll("br");at=aw.length;while(at--){ax=aw[at];av=ax.prev;if(av&&av.type===3&&av.value.charAt(av.value-1)!="\n"){av.value+="\n"}else{ax.parent.insert(new k("#text",3),ax,true).value="\n"}}}});L.addNodeFilter("pre",function(ar){var au=ar.length,aw,at,ax,av;while(au--){aw=ar[au].getAll("br");at=aw.length;while(at--){ax=aw[at];av=ax.prev;if(av&&av.type==3){av.value=av.value.replace(/\r?\n$/,"")}}}})}function w(){r.bind(p.getBody(),"mouseup",function(){var at,ar=G.getNode();if(ar.nodeName=="IMG"){if((at=r.getStyle(ar,"width"))){r.setAttrib(ar,"width",at.replace(/[^0-9%]+/g,""));r.setStyle(ar,"width","")}if((at=r.getStyle(ar,"height"))){r.setAttrib(ar,"height",at.replace(/[^0-9%]+/g,""));r.setStyle(ar,"height","")}}})}function am(){p.on("keydown",function(aw){var au,at,ax,ar,av;if(Z(aw)||aw.keyCode!=n.BACKSPACE){return}au=G.getRng();at=au.startContainer;ax=au.startOffset;ar=r.getRoot();av=at;if(!au.collapsed||ax!==0){return}while(av&&av.parentNode&&av.parentNode.firstChild==av&&av.parentNode!=ar){av=av.parentNode}if(av.tagName==="BLOCKQUOTE"){p.formatter.toggle("blockquote",null,av);au=r.createRng();au.setStart(at,0);au.setEnd(at,0);G.setRng(au)}})}function al(){function ar(){p._refreshContentEditable();aa("StyleWithCSS",false);aa("enableInlineTableEditing",false);if(!an.object_resizing){aa("enableObjectResizing",false)}}if(!an.readonly){p.on("BeforeExecCommand MouseDown",ar)}}function T(){function ar(){aj(r.select("a"),function(av){var at=av.parentNode,au=r.getRoot();if(at.lastChild===av){while(at&&!r.isBlock(at)){if(at.parentNode.lastChild!==at||at===au){return}at=at.parentNode}r.add(at,"br",{"data-mce-bogus":1})}})}p.on("SetContent ExecCommand",function(at){if(at.type=="setcontent"||at.command==="mceInsertLink"){ar()}})}function H(){if(an.forced_root_block){p.on("init",function(){aa("DefaultParagraphSeparator",an.forced_root_block)})}}function N(){p.on("Undo Redo SetContent",function(ar){if(!ar.initial){p.execCommand("mceRepaint")}})}function y(){p.on("keydown",function(at){var ar;if(!Z(at)&&at.keyCode==s){ar=p.getDoc().selection.createRange();if(ar&&ar.item){at.preventDefault();p.undoManager.beforeChange();r.remove(ar.item(0));p.undoManager.add()}}})}function S(){var ar;if(J()>=10){ar="";aj("p div h1 h2 h3 h4 h5 h6".split(" "),function(at,au){ar+=(au>0?",":"")+at+":empty"});p.contentStyles.push(ar+"{padding-right: 1px !important}")}}function ai(){if(J()<9){V.addNodeFilter("noscript",function(ar){var at=ar.length,au,av;while(at--){au=ar[at];av=au.firstChild;if(av){au.attr("data-mce-innertext",av.value)}}});L.addNodeFilter("noscript",function(ar){var at=ar.length,au,aw,av;while(at--){au=ar[at];aw=ar[at].firstChild;if(aw){aw.value=o.decode(aw.value)}else{av=au.attributes.map["data-mce-innertext"];if(av){au.attr("data-mce-innertext",null);aw=new k("#text",3);aw.value=av;aw.raw=true;au.append(aw)}}}})}}function O(){var ay=r.doc,at=ay.body,av,aw,az;function ax(aA,aD){var aB=at.createTextRange();try{aB.moveToPoint(aA,aD)}catch(aC){aB=null}return aB}function au(aB){var aA;if(aB.button){aA=ax(aB.x,aB.y);if(aA){if(aA.compareEndPoints("StartToStart",aw)>0){aA.setEndPoint("StartToStart",aw)}else{aA.setEndPoint("EndToEnd",aw)}aA.select()}}else{ar()}}function ar(){var aA=ay.selection.createRange();if(aw&&!aA.item&&aA.compareEndPoints("StartToEnd",aA)===0){aw.select()}r.unbind(ay,"mouseup",ar);r.unbind(ay,"mousemove",au);aw=av=0}ay.documentElement.unselectable=true;r.bind(ay,"mousedown contextmenu",function(aA){if(aA.target.nodeName==="HTML"){if(av){ar()}az=ay.documentElement;if(az.scrollHeight>az.clientHeight){return}av=1;aw=ax(aA.x,aA.y);if(aw){r.bind(ay,"mouseup",ar);r.bind(ay,"mousemove",au);r.getRoot().focus();aw.select()}}})}function af(){p.on("keyup focusin mouseup",function(ar){if(ar.keyCode!=65||!n.metaKeyPressed(ar)){G.normalize()}},true)}function A(){p.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")}function B(){if(!p.inline){p.on("keydown",function(){if(document.activeElement==document.body){p.getWin().focus()}})}}function F(){if(!p.inline){p.contentStyles.push("body {min-height: 150px}");p.on("click",function(at){if(at.target.nodeName=="HTML"){var ar;ar=p.selection.getRng();p.getBody().focus();p.selection.setRng(ar);p.selection.normalize();p.nodeChanged()}})}}function D(){if(i.mac){p.on("keydown",function(ar){if(n.metaKeyPressed(ar)&&(ar.keyCode==37||ar.keyCode==39)){ar.preventDefault();p.selection.getSel().modify("move",ar.keyCode==37?"backward":"forward","lineboundary")}})}}function ac(){aa("AutoUrlDetect",false)}function I(){if(!p.inline){p.on("focus blur beforegetcontent",function(){var ar=p.dom.create("br");p.getBody().appendChild(ar);ar.parentNode.removeChild(ar)},true)}}function z(){p.on("click",function(ar){var at=ar.target;do{if(at.tagName==="A"){ar.preventDefault();return}}while((at=at.parentNode))});p.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")}function q(){p.on("touchstart",function(av){var aw,au,at,ar;aw=av.target;au=new Date().getTime();ar=av.changedTouches;if(!ar||ar.length>1){return}at=ar[0];p.once("touchend",function(az){var ay=az.changedTouches[0],ax;if(new Date().getTime()-au>500){return}if(Math.abs(at.clientX-ay.clientX)>5){return}if(Math.abs(at.clientY-ay.clientY)>5){return}ax={target:aw};aj("pageX pageY clientX clientY screenX screenY".split(" "),function(aA){ax[aA]=ay[aA]});ax=p.fire("click",ax);if(!ax.isDefaultPrevented()){p.selection.placeCaretAt(ay.clientX,ay.clientY);p.nodeChanged()}})})}function M(){p.on("init",function(){p.dom.bind(p.getBody(),"submit",function(ar){ar.preventDefault()})})}function ae(){V.addNodeFilter("br",function(ar){var at=ar.length;while(at--){if(ar[at].attr("class")=="Apple-interchange-newline"){ar[at].remove()}}})}function v(){p.on("dragstart",function(ar){Q(ar)});p.on("drop",function(at){if(!Z(at)){var au=K(at);if(au){at.preventDefault();var ar=m.getCaretRangeFromPoint(at.x,at.y,p.getDoc());G.setRng(ar);R(au)}}})}am();P();af();if(ag){ap();aq();x();H();M();U();ae();q();if(i.iOS){B();F();z()}else{ao()}}if(C&&i.ie<11){ad();X();ah();w();y();S();ai();O()}if(i.ie>=11){F();I();U()}if(i.ie){ao();ac();v()}if(u){ad();Y();ak();al();T();N();A();D();U()}}});h("tinymce/util/Observable",["tinymce/util/EventDispatcher"],function(j){function i(k){if(!k._eventDispatcher){k._eventDispatcher=new j({scope:k,toggleEvent:function(l,m){if(j.isNative(l)&&k.toggleNativeEvent){k.toggleNativeEvent(l,m)}}})}return k._eventDispatcher}return{fire:function(n,m,k){var l=this;if(l.removed&&n!=="remove"){return m}m=i(l).fire(n,m,k);if(k!==false&&l.parent){var o=l.parent();while(o&&!m.isPropagationStopped()){o.fire(n,m,false);o=o.parent()}}return m},on:function(l,m,k){return i(this).on(l,m,k)},off:function(k,l){return i(this).off(k,l)},once:function(k,l){return i(this).once(k,l)},hasEventListeners:function(k){return i(this).has(k)}}});h("tinymce/EditorObservable",["tinymce/util/Observable","tinymce/dom/DOMUtils","tinymce/util/Tools"],function(i,n,k){var l=n.DOM,j;function o(r,q){if(q=="selectionchange"){return r.getDoc()}if(!r.inline&&/^mouse|click|contextmenu|drop|dragover|dragend/.test(q)){return r.getDoc().documentElement}if(r.settings.event_root){if(!r.eventRoot){r.eventRoot=l.select(r.settings.event_root)[0]}return r.eventRoot}return r.getBody()}function m(s,q){var t=o(s,q),r;if(!s.delegates){s.delegates={}}if(s.delegates[q]){return}if(s.settings.event_root){if(!j){j={};s.editorManager.on("removeEditor",function(){var u;if(!s.editorManager.activeEditor){if(j){for(u in j){s.dom.unbind(o(s,u))}j=null}}})}if(j[q]){return}r=function(y){var x=y.target,w=s.editorManager.editors,v=w.length;while(v--){var u=w[v].getBody();if(u===x||l.isChildOf(x,u)){if(!w[v].hidden){w[v].fire(q,y)}}}};j[q]=r;l.bind(t,q,r)}else{r=function(u){if(!s.hidden){s.fire(q,u)}};l.bind(t,q,r);s.delegates[q]=r}}var p={bindPendingEventDelegates:function(){var q=this;k.each(q._pendingNativeEvents,function(r){m(q,r)})},toggleNativeEvent:function(r,s){var q=this;if(q.settings.readonly){return}if(r=="focus"||r=="blur"){return}if(s){if(q.initialized){m(q,r)}else{if(!q._pendingNativeEvents){q._pendingNativeEvents=[r]}else{q._pendingNativeEvents.push(r)}}}else{if(q.initialized){q.dom.unbind(o(q,r),r,q.delegates[r]);delete q.delegates[r]}}},unbindAllNativeEvents:function(){var q=this,r;if(q.delegates){for(r in q.delegates){q.dom.unbind(o(q,r),r,q.delegates[r])}delete q.delegates}if(!q.inline){q.getBody().onload=null;q.dom.unbind(q.getWin());q.dom.unbind(q.getDoc())}q.dom.unbind(q.getBody());q.dom.unbind(q.getContainer())}};p=k.extend({},i,p);return p});h("tinymce/Shortcuts",["tinymce/util/Tools","tinymce/Env"],function(k,j){var n=k.each,m=k.explode;var i={f9:120,f10:121,f11:122};var l=k.makeMap("alt,ctrl,shift,meta,access");return function(r){var q=this,o={};function p(w,x,v,u){var y,t,s;s={func:v,scope:u||r,desc:r.translate(x)};n(m(w,"+"),function(z){if(z in l){s[z]=true}else{if(/^[0-9]{2,}$/.test(z)){s.keyCode=parseInt(z,10)}else{s.charCode=z.charCodeAt(0);s.keyCode=i[z]||z.toUpperCase().charCodeAt(0)}}});y=[s.keyCode];for(t in l){if(s[t]){y.push(t)}else{s[t]=false}}s.id=y.join(",");if(s.access){s.alt=true;if(j.mac){s.ctrl=true}else{s.shift=true}}if(s.meta){if(j.mac){s.meta=true}else{s.ctrl=true;s.meta=false}}return s}r.on("keyup keypress keydown",function(s){if((s.altKey||s.ctrlKey||s.metaKey)&&!s.isDefaultPrevented()){n(o,function(t){if(t.ctrl!=s.ctrlKey||t.meta!=s.metaKey){return}if(t.alt!=s.altKey||t.shift!=s.shiftKey){return}if(s.keyCode==t.keyCode||(s.charCode&&s.charCode==t.charCode)){s.preventDefault();if(s.type=="keydown"){t.func.call(t.scope)}return true}})}});q.add=function(v,w,t,s){var u;u=t;if(typeof t==="string"){t=function(){r.execCommand(u,false,null)}}else{if(k.isArray(u)){t=function(){r.execCommand(u[0],u[1],u[2])}}}n(m(v.toLowerCase()),function(y){var x=p(y,w,t,s);o[x.id]=x});return true};q.remove=function(t){var s=p(t);if(o[s.id]){delete o[s.id];return true}return false}}});h("tinymce/Editor",["tinymce/dom/DOMUtils","tinymce/dom/DomQuery","tinymce/AddOnManager","tinymce/NodeChange","tinymce/html/Node","tinymce/dom/Serializer","tinymce/html/Serializer","tinymce/dom/Selection","tinymce/Formatter","tinymce/UndoManager","tinymce/EnterKey","tinymce/ForceBlocks","tinymce/EditorCommands","tinymce/util/URI","tinymce/dom/ScriptLoader","tinymce/dom/EventUtils","tinymce/WindowManager","tinymce/html/Schema","tinymce/html/DomParser","tinymce/util/Quirks","tinymce/Env","tinymce/util/Tools","tinymce/EditorObservable","tinymce/Shortcuts"],function(S,A,C,m,x,K,I,E,y,n,J,G,v,D,s,t,M,o,j,B,N,q,k,P){var z=S.DOM,O=C.ThemeManager,R=C.PluginManager;var p=q.extend,L=q.each,r=q.explode;var Q=q.inArray,i=q.trim,u=q.resolve;var H=t.Event;var l=N.gecko,F=N.ie;function w(Y,V,X){var U=this,T,W;T=U.documentBaseUrl=X.documentBaseURL;W=X.baseURI;U.settings=V=p({id:Y,theme:"modern",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:T,add_form_submit_trigger:true,submit_patch:true,add_unload_trigger:true,convert_urls:true,relative_urls:true,remove_script_host:true,object_resizing:true,doctype:"",visual:true,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",forced_root_block:"p",hidden_input:true,padd_empty_editor:true,render_ui:true,indentation:"30px",inline_styles:true,convert_fonts_to_spans:true,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",validate:true,entity_encoding:"named",url_converter:U.convertURL,url_converter_scope:U,ie7_compat:true},V);C.language=V.language||"en";C.languageLoad=V.language_load;C.baseURL=X.baseURL;U.id=V.id=Y;U.isNotDirty=true;U.plugins={};U.documentBaseURI=new D(V.document_base_url||T,{base_uri:W});U.baseURI=W;U.contentCSS=[];U.contentStyles=[];U.shortcuts=new P(U);U.loadedCSS={};U.editorCommands=new v(U);if(V.target){U.targetElm=V.target}U.suffix=X.suffix;U.editorManager=X;U.inline=V.inline;if(V.cache_suffix){N.cacheSuffix=V.cache_suffix.replace(/^[\?\&]+/,"")}X.fire("SetupEditor",U);U.execCallback("setup",U);U.$=A.overrideDefaults(function(){return{context:U.inline?U.getBody():U.getDoc(),element:U.getBody()}})}w.prototype={render:function(){var T=this,W=T.settings,Z=T.id,Y=T.suffix;function V(){z.unbind(window,"ready",V);T.render()}if(!H.domLoaded){z.bind(window,"ready",V);return}if(!T.getElement()){return}if(!N.contentEditable){return}if(!W.inline){T.orgVisibility=T.getElement().style.visibility;T.getElement().style.visibility="hidden"}else{T.inline=true}var X=T.getElement().form||z.getParent(Z,"form");if(X){T.formElement=X;if(W.hidden_input&&!/TEXTAREA|INPUT/i.test(T.getElement().nodeName)){z.insertAfter(z.create("input",{type:"hidden",name:Z}),Z);T.hasHiddenInput=true}T.formEventDelegate=function(aa){T.fire(aa.type,aa)};z.bind(X,"submit reset",T.formEventDelegate);T.on("reset",function(){T.setContent(T.startContent,{format:"raw"})});if(W.submit_patch&&!X.submit.nodeType&&!X.submit.length&&!X._mceOldSubmit){X._mceOldSubmit=X.submit;X.submit=function(){T.editorManager.triggerSave();T.isNotDirty=true;return X._mceOldSubmit(X)}}}T.windowManager=new M(T);if(W.encoding=="xml"){T.on("GetContent",function(aa){if(aa.save){aa.content=z.encode(aa.content)}})}if(W.add_form_submit_trigger){T.on("submit",function(){if(T.initialized){T.save()}})}if(W.add_unload_trigger){T._beforeUnload=function(){if(T.initialized&&!T.destroyed&&!T.isHidden()){T.save({format:"raw",no_events:true,set_dirty:false})}};T.editorManager.on("BeforeUnload",T._beforeUnload)}function U(){var ab=s.ScriptLoader;if(W.language&&W.language!="en"&&!W.language_url){W.language_url=T.editorManager.baseURL+"/langs/"+W.language+".js"}if(W.language_url){ab.add(W.language_url)}if(W.theme&&typeof W.theme!="function"&&W.theme.charAt(0)!="-"&&!O.urls[W.theme]){var aa=W.theme_url;if(aa){aa=T.documentBaseURI.toAbsolute(aa)}else{aa="themes/"+W.theme+"/theme"+Y+".js"}O.load(W.theme,aa)}if(q.isArray(W.plugins)){W.plugins=W.plugins.join(" ")}L(W.external_plugins,function(ad,ac){R.load(ac,ad);W.plugins+=" "+ac});L(W.plugins.split(/[ ,]/),function(ac){ac=i(ac);if(ac&&!R.urls[ac]){if(ac.charAt(0)=="-"){ac=ac.substr(1,ac.length);var ad=R.dependencies(ac);L(ad,function(af){var ae={prefix:"plugins/",resource:af,suffix:"/plugin"+Y+".js"};af=R.createUrl(ae,af);R.load(af.resource,af)})}else{R.load(ac,{prefix:"plugins/",resource:ac,suffix:"/plugin"+Y+".js"})}}});ab.loadQueue(function(){if(!T.removed){T.init()}})}U()},init:function(){var ab=this,ak=ab.settings,X=ab.getElement();var Z,ai,W,ae,ac,T,U,am,ah,ad,ag,V=[];this.editorManager.i18n.setCode(ak.language);ab.rtl=this.editorManager.i18n.rtl;ab.editorManager.add(ab);ak.aria_label=ak.aria_label||z.getAttrib(X,"aria-label",ab.getLang("aria.rich_text_area"));if(ak.theme){if(typeof ak.theme!="function"){ak.theme=ak.theme.replace(/-/,"");T=O.get(ak.theme);ab.theme=new T(ab,O.urls[ak.theme]);if(ab.theme.init){ab.theme.init(ab,O.urls[ak.theme]||ab.documentBaseUrl.replace(/\/$/,""),ab.$)}}else{ab.theme=ak.theme}}function al(aq){var ap=R.get(aq),ao,an;ao=R.urls[aq]||ab.documentBaseUrl.replace(/\/$/,"");aq=i(aq);if(ap&&Q(V,aq)===-1){L(R.dependencies(aq),function(ar){al(ar)});an=new ap(ab,ao,ab.$);ab.plugins[aq]=an;if(an.init){an.init(ab,ao);V.push(aq)}}}L(ak.plugins.replace(/\-/g,"").split(/[ ,]/),al);if(ak.render_ui&&ab.theme){ab.orgDisplay=X.style.display;if(typeof ak.theme!="function"){Z=ak.width||X.style.width||X.offsetWidth;ai=ak.height||X.style.height||X.offsetHeight;W=ak.min_height||100;ad=/^[0-9\.]+(|px)$/i;if(ad.test(""+Z)){Z=Math.max(parseInt(Z,10),100)}if(ad.test(""+ai)){ai=Math.max(parseInt(ai,10),W)}ac=ab.theme.renderUI({targetNode:X,width:Z,height:ai,deltaWidth:ak.delta_width,deltaHeight:ak.delta_height});if(!ak.content_editable){ai=(ac.iframeHeight||ai)+(typeof ai=="number"?(ac.deltaHeight||0):"");if(ai";if(ak.document_base_url!=ab.documentBaseUrl){ab.iframeHTML+=''}if(!N.caretAfter&&ak.ie7_compat){ab.iframeHTML+=''}ab.iframeHTML+='';for(ag=0;ag');ab.loadedCSS[af]=true}am=ak.body_id||"tinymce";if(am.indexOf("=")!=-1){am=ab.getParam("body_id","","hash");am=am[ab.id]||am}ah=ak.body_class||"";if(ah.indexOf("=")!=-1){ah=ab.getParam("body_class","","hash");ah=ah[ab.id]||""}if(ak.content_security_policy){ab.iframeHTML+=''}ab.iframeHTML+='
    ';var aa='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinymce.get("'+ab.id+'");document.write(ed.iframeHTML);document.close();ed.initContentBody(true);})()';if(document.domain!=location.hostname){U=aa}var Y=z.create("iframe",{id:ab.id+"_ifr",frameBorder:"0",allowTransparency:"true",title:ab.editorManager.translate("Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help"),style:{width:"100%",height:ai,display:"block"}});Y.onload=function(){Y.onload=null;ab.fire("load")};z.setAttrib(Y,"src",U||'javascript:""');ab.contentAreaContainer=ac.iframeContainer;ab.iframeElement=Y;ae=z.add(ac.iframeContainer,Y);if(F){try{ab.getDoc()}catch(aj){ae.src=U=aa}}if(ac.editorContainer){z.get(ac.editorContainer).style.display=ab.orgDisplay;ab.hidden=z.isHidden(ac.editorContainer)}ab.getElement().style.display="none";z.setAttrib(ab.id,"aria-hidden",true);if(!U){ab.initContentBody()}X=ae=ac=null},initContentBody:function(U){var V=this,W=V.settings,X=V.getElement(),Y=V.getDoc(),T,Z;if(!W.inline){V.getElement().style.visibility=V.orgVisibility}if(!U&&!W.content_editable){Y.open();Y.write(V.iframeHTML);Y.close()}if(W.content_editable){V.on("remove",function(){var aa=this.getBody();z.removeClass(aa,"mce-content-body");z.removeClass(aa,"mce-edit-focus");z.setAttrib(aa,"contentEditable",null)});z.addClass(X,"mce-content-body");V.contentDocument=Y=W.content_document||document;V.contentWindow=W.content_window||window;V.bodyElement=X;W.content_document=W.content_window=null;W.root_name=X.nodeName.toLowerCase()}T=V.getBody();T.disabled=true;if(!W.readonly){if(V.inline&&z.getStyle(T,"position",true)=="static"){T.style.position="relative"}T.contentEditable=V.getParam("content_editable_state",true)}T.disabled=false;V.schema=new o(W);V.dom=new S(Y,{keep_values:true,url_converter:V.convertURL,url_converter_scope:V,hex_colors:W.force_hex_style_colors,class_filter:W.class_filter,update_styles:true,root_element:V.inline?V.getBody():null,collect:W.content_editable,schema:V.schema,onSetAttrib:function(aa){V.fire("SetAttrib",aa)}});V.parser=new j(W,V.schema);V.parser.addAttributeFilter("src,href,style,tabindex",function(aa,ab){var ac=aa.length,ae,ag=V.dom,af,ad;while(ac--){ae=aa[ac];af=ae.attr(ab);ad="data-mce-"+ab;if(!ae.attributes.map[ad]){if(ab==="style"){af=ag.serializeStyle(ag.parseStyle(af),ae.name);if(!af.length){af=null}ae.attr(ad,af);ae.attr(ab,af)}else{if(ab==="tabindex"){ae.attr(ad,af);ae.attr(ab,null)}else{ae.attr(ad,V.convertURL(af,ab,ae.name))}}}}});V.parser.addNodeFilter("script",function(aa){var ab=aa.length,ac;while(ab--){ac=aa[ab];ac.attr("type","mce-"+(ac.attr("type")||"no/type"))}});V.parser.addNodeFilter("#cdata",function(aa){var ab=aa.length,ac;while(ab--){ac=aa[ab];ac.type=8;ac.name="#comment";ac.value="[CDATA["+ac.value+"]]"}});V.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(ab){var ac=ab.length,ad,aa=V.schema.getNonEmptyElements();while(ac--){ad=ab[ac];if(ad.isEmpty(aa)){ad.append(new x("br",1)).shortEnded=true}}});V.serializer=new K(W,V);V.selection=new E(V.dom,V.getWin(),V.serializer,V);V.formatter=new y(V);V.undoManager=new n(V);V.forceBlocks=new G(V);V.enterKey=new J(V);V._nodeChangeDispatcher=new m(V);V.fire("PreInit");if(!W.browser_spellcheck&&!W.gecko_spellcheck){Y.body.spellcheck=false;z.setAttrib(T,"spellcheck","false")}V.fire("PostRender");V.quirks=new B(V);if(W.directionality){T.dir=W.directionality}if(W.nowrap){T.style.whiteSpace="nowrap"}if(W.protect){V.on("BeforeSetContent",function(aa){L(W.protect,function(ab){aa.content=aa.content.replace(ab,function(ac){return""})})})}V.on("SetContent",function(){V.addVisual(V.getBody())});if(W.padd_empty_editor){V.on("PostProcess",function(aa){aa.content=aa.content.replace(/^(]*>( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,"")})}V.load({initial:true,format:"html"});V.startContent=V.getContent({format:"raw"});V.initialized=true;V.bindPendingEventDelegates();V.fire("init");V.focus(true);V.nodeChanged({initial:true});V.execCallback("init_instance_callback",V);if(V.contentStyles.length>0){Z="";L(V.contentStyles,function(aa){Z+=aa+"\r\n"});V.dom.addStyle(Z)}L(V.contentCSS,function(aa){if(!V.loadedCSS[aa]){V.dom.loadCSS(aa);V.loadedCSS[aa]=true}});if(W.auto_focus){setTimeout(function(){var aa;if(W.auto_focus===true){aa=V}else{aa=V.editorManager.get(W.auto_focus)}if(!aa.destroyed){aa.focus()}},100)}X=Y=T=null},focus:function(U){var ab=this,aa=ab.selection,X=ab.settings.content_editable,T;var Y,Z=ab.getDoc(),V;if(!U){T=aa.getRng();if(T.item){Y=T.item(0)}ab._refreshContentEditable();if(!X){if(!N.opera){ab.getBody().focus()}ab.getWin().focus()}if(l||X){V=ab.getBody();if(V.setActive){try{V.setActive()}catch(W){V.focus()}}else{V.focus()}if(X){aa.normalize()}}if(Y&&Y.ownerDocument==Z){T=Z.body.createControlRange();T.addElement(Y);T.select()}}ab.editorManager.setActive(ab)},execCallback:function(U){var T=this,W=T.settings[U],V;if(!W){return}if(T.callbackLookup&&(V=T.callbackLookup[U])){W=V.func;V=V.scope}if(typeof W==="string"){V=W.replace(/\.\w+$/,"");V=V?u(V):0;W=u(W);T.callbackLookup=T.callbackLookup||{};T.callbackLookup[U]={func:W,scope:V}}return W.apply(V||T,Array.prototype.slice.call(arguments,1))},translate:function(V){var U=this.settings.language||"en",T=this.editorManager.i18n;if(!V){return""}return T.data[U+"."+V]||V.replace(/\{\#([^\}]+)\}/g,function(X,W){return T.data[U+"."+W]||"{#"+W+"}"})},getLang:function(T,U){return(this.editorManager.i18n.data[(this.settings.language||"en")+"."+T]||(U!==g?U:"{#"+T+"}"))},getParam:function(U,X,V){var W=U in this.settings?this.settings[U]:X,T;if(V==="hash"){T={};if(typeof W==="string"){L(W.indexOf("=")>0?W.split(/[;,](?![^=;,]*(?:[;,]|$))/):W.split(","),function(Y){Y=Y.split("=");if(Y.length>1){T[i(Y[0])]=i(Y[1])}else{T[i(Y[0])]=i(Y)}})}else{T=W}return T}return W},nodeChanged:function(T){this._nodeChangeDispatcher.nodeChanged(T)},addButton:function(U,V){var T=this;if(V.cmd){V.onclick=function(){T.execCommand(V.cmd)}}if(!V.text&&!V.icon){V.icon=U}T.buttons=T.buttons||{};V.tooltip=V.tooltip||V.title;T.buttons[U]=V},addMenuItem:function(U,V){var T=this;if(V.cmd){V.onclick=function(){T.execCommand(V.cmd)}}T.menuItems=T.menuItems||{};T.menuItems[U]=V},addCommand:function(T,V,U){this.editorCommands.addCommand(T,V,U)},addQueryStateHandler:function(T,V,U){this.editorCommands.addQueryStateHandler(T,V,U)},addQueryValueHandler:function(T,V,U){this.editorCommands.addQueryValueHandler(T,V,U)},addShortcut:function(V,W,U,T){this.shortcuts.add(V,W,U,T)},execCommand:function(W,V,U,T){return this.editorCommands.execCommand(W,V,U,T)},queryCommandState:function(T){return this.editorCommands.queryCommandState(T)},queryCommandValue:function(T){return this.editorCommands.queryCommandValue(T)},queryCommandSupported:function(T){return this.editorCommands.queryCommandSupported(T)},show:function(){var T=this;if(T.hidden){T.hidden=false;if(T.inline){T.getBody().contentEditable=true}else{z.show(T.getContainer());z.hide(T.id)}T.load();T.fire("show")}},hide:function(){var T=this,U=T.getDoc();if(!T.hidden){if(F&&U&&!T.inline){U.execCommand("SelectAll")}T.save();if(T.inline){T.getBody().contentEditable=false;if(T==T.editorManager.focusedEditor){T.editorManager.focusedEditor=null}}else{z.hide(T.getContainer());z.setStyle(T.id,"display",T.orgDisplay)}T.hidden=true;T.fire("hide")}},isHidden:function(){return !!this.hidden},setProgressState:function(T,U){this.fire("ProgressState",{state:T,time:U})},load:function(U){var T=this,W=T.getElement(),V;if(W){U=U||{};U.load=true;V=T.setContent(W.value!==g?W.value:W.innerHTML,U);U.element=W;if(!U.no_events){T.fire("LoadContent",U)}U.element=W=null;return V}},save:function(U){var T=this,X=T.getElement(),V,W;if(!X||!T.initialized){return}U=U||{};U.save=true;U.element=X;V=U.content=T.getContent(U);if(!U.no_events){T.fire("SaveContent",U)}V=U.content;if(!/TEXTAREA|INPUT/i.test(X.nodeName)){if(!T.inline){X.innerHTML=V}if((W=z.getParent(T.id,"form"))){L(W.elements,function(Y){if(Y.name==T.id){Y.value=V;return false}})}}else{X.value=V}U.element=X=null;if(U.set_dirty!==false){T.isNotDirty=true}return V},setContent:function(X,V){var U=this,T=U.getBody(),W;V=V||{};V.format=V.format||"html";V.set=true;V.content=X;if(!V.no_events){U.fire("BeforeSetContent",V)}X=V.content;if(X.length===0||/^\s+$/.test(X)){W=U.settings.forced_root_block;if(W&&U.schema.isValidChild(T.nodeName.toLowerCase(),W.toLowerCase())){X=F&&F<11?"":'
    ';X=U.dom.createHTML(W,U.settings.forced_root_block_attrs,X)}else{if(!F){X='
    '}}U.dom.setHTML(T,X);U.fire("SetContent",V)}else{if(V.format!=="raw"){X=new I({},U.schema).serialize(U.parser.parse(X,{isRootContent:true}))}V.content=i(X);U.dom.setHTML(T,V.content);if(!V.no_events){U.fire("SetContent",V)}}return V.content},getContent:function(V){var U=this,W,T=U.getBody();V=V||{};V.format=V.format||"html";V.get=true;V.getInner=true;if(!V.no_events){U.fire("BeforeGetContent",V)}if(V.format=="raw"){W=T.innerHTML}else{if(V.format=="text"){W=T.innerText||T.textContent}else{W=U.serializer.serialize(T,V)}}if(V.format!="text"){V.content=i(W)}else{V.content=W}if(!V.no_events){U.fire("GetContent",V)}return V.content},insertContent:function(U,T){if(T){U=p({content:U},T)}this.execCommand("mceInsertContent",false,U)},isDirty:function(){return !this.isNotDirty},getContainer:function(){var T=this;if(!T.container){T.container=z.get(T.editorContainer||T.id+"_parent")}return T.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){if(!this.targetElm){this.targetElm=z.get(this.id)}return this.targetElm},getWin:function(){var T=this,U;if(!T.contentWindow){U=T.iframeElement;if(U){T.contentWindow=U.contentWindow}}return T.contentWindow},getDoc:function(){var T=this,U;if(!T.contentDocument){U=T.getWin();if(U){T.contentDocument=U.document}}return T.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(V,U,X){var T=this,W=T.settings;if(W.urlconverter_callback){return T.execCallback("urlconverter_callback",V,X,true,U)}if(!W.convert_urls||(X&&X.nodeName=="LINK")||V.indexOf("file:")===0||V.length===0){return V}if(W.relative_urls){return T.documentBaseURI.toRelative(V)}V=T.documentBaseURI.toAbsolute(V,W.remove_script_host);return V},addVisual:function(X){var U=this,V=U.settings,W=U.dom,T;X=X||U.getBody();if(U.hasVisual===g){U.hasVisual=V.visual}L(W.select("table,a",X),function(Z){var Y;switch(Z.nodeName){case"TABLE":T=V.visual_table_class||"mce-item-table";Y=W.getAttrib(Z,"border");if((!Y||Y=="0")&&U.hasVisual){W.addClass(Z,T)}else{W.removeClass(Z,T)}return;case"A":if(!W.getAttrib(Z,"href",false)){Y=W.getAttrib(Z,"name")||Z.id;T=V.visual_anchor_class||"mce-item-anchor";if(Y&&U.hasVisual){W.addClass(Z,T)}else{W.removeClass(Z,T)}}return}});U.fire("VisualAid",{element:X,hasVisual:U.hasVisual})},remove:function(){var T=this;if(!T.removed){T.save();T.removed=1;T.unbindAllNativeEvents();if(T.hasHiddenInput){z.remove(T.getElement().nextSibling)}if(!T.inline){if(F&&F<10){T.getDoc().execCommand("SelectAll",false,null)}z.setStyle(T.id,"display",T.orgDisplay);T.getBody().onload=null}T.fire("remove");T.editorManager.remove(T);z.remove(T.getContainer());T.destroy()}},destroy:function(V){var T=this,U;if(T.destroyed){return}if(!V&&!T.removed){T.remove();return}if(!V){T.editorManager.off("beforeunload",T._beforeUnload);if(T.theme&&T.theme.destroy){T.theme.destroy()}T.selection.destroy();T.dom.destroy()}U=T.formElement;if(U){if(U._mceOldSubmit){U.submit=U._mceOldSubmit;U._mceOldSubmit=null}z.unbind(U,"submit reset",T.formEventDelegate)}T.contentAreaContainer=T.formElement=T.container=T.editorContainer=null;T.bodyElement=T.contentDocument=T.contentWindow=null;T.iframeElement=T.targetElm=null;if(T.selection){T.selection=T.selection.win=T.selection.dom=T.selection.dom.doc=null}T.destroyed=1},_refreshContentEditable:function(){var U=this,T,V;if(U._isHidden()){T=U.getBody();V=T.parentNode;V.removeChild(T);V.appendChild(T);T.focus()}},_isHidden:function(){var T;if(!l){return 0}T=this.selection.getSel();return(!T||!T.rangeCount||T.rangeCount===0)}};p(w.prototype,k);return w});h("tinymce/util/I18n",[],function(){var j={},i="en";return{setCode:function(k){if(k){i=k;this.rtl=this.data[k]?this.data[k]._dir==="rtl":false}},getCode:function(){return i},rtl:false,add:function(n,l){var k=j[n];if(!k){j[n]=k={}}for(var m in l){k[m]=l[m]}this.setCode(n)},translate:function(m){var k;k=j[i];if(!k){k={}}if(typeof m=="undefined"){return m}if(typeof m!="string"&&m.raw){return m.raw}if(m.push){var l=m.slice(1);m=(k[m[0]]||m[0]).replace(/\{([0-9]+)\}/g,function(o,n){return l[n]})}return(k[m]||m).replace(/{context:\w+}$/,"")},data:j}});h("tinymce/FocusManager",["tinymce/dom/DOMUtils","tinymce/Env"],function(o,j){var k,m,l,n=o.DOM;function i(v){function q(){try{return document.activeElement}catch(w){return document.body}}function u(x,w){if(w&&w.startContainer){if(!x.isChildOf(w.startContainer,x.getRoot())||!x.isChildOf(w.endContainer,x.getRoot())){return}return{startContainer:w.startContainer,startOffset:w.startOffset,endContainer:w.endContainer,endOffset:w.endOffset}}return w}function p(y,x){var w;if(x.startContainer){w=y.getDoc().createRange();w.setStart(x.startContainer,x.startOffset);w.setEnd(x.endContainer,x.endOffset)}else{w=x}return w}function t(w){return !!n.getParent(w,i.isEditorUIElement)}function r(x){var w=x.editor;w.on("init",function(){if(w.inline||j.ie){if("onbeforedeactivate" in document&&j.ie<9){w.dom.bind(w.getBody(),"beforedeactivate",function(z){if(z.target!=w.getBody()){return}try{w.lastRng=w.selection.getRng()}catch(y){}})}else{w.on("nodechange mouseup keyup",function(z){var y=q();if(z.type=="nodechange"&&z.selectionChange){return}if(y&&y.id==w.id+"_ifr"){y=w.getBody()}if(w.dom.isChildOf(y,w.getBody())){w.lastRng=w.selection.getRng()}})}if(j.webkit&&!k){k=function(){var z=v.activeEditor;if(z&&z.selection){var y=z.selection.getRng();if(y&&!y.collapsed){w.lastRng=y}}};n.bind(document,"selectionchange",k)}}});w.on("setcontent",function(){w.lastRng=null});w.on("mousedown",function(){w.selection.lastFocusBookmark=null});w.on("focusin",function(){var y=v.focusedEditor;if(w.selection.lastFocusBookmark){w.selection.setRng(p(w,w.selection.lastFocusBookmark));w.selection.lastFocusBookmark=null}if(y!=w){if(y){y.fire("blur",{focusedEditor:w})}v.setActive(w);v.focusedEditor=w;w.fire("focus",{blurredEditor:y});w.focus(true)}w.lastRng=null});w.on("focusout",function(){window.setTimeout(function(){var y=v.focusedEditor;if(!t(q())&&y==w){w.fire("blur",{focusedEditor:null});v.focusedEditor=null;if(w.selection){w.selection.lastFocusBookmark=null}}},0)});if(!m){m=function(z){var y=v.activeEditor;if(y&&z.target.ownerDocument==document){if(y.selection&&z.target!=y.getBody()){y.selection.lastFocusBookmark=u(y.dom,y.lastRng)}if(z.target!=document.body&&!t(z.target)&&v.focusedEditor==y){y.fire("blur",{focusedEditor:null});v.focusedEditor=null}}};n.bind(document,"focusin",m)}if(w.inline&&!l){l=function(A){var z=v.activeEditor;if(z.inline&&!z.dom.isChildOf(A.target,z.getBody())){var y=z.selection.getRng();if(!y.collapsed){z.lastRng=y}}};n.bind(document,"mouseup",l)}}function s(w){if(v.focusedEditor==w.editor){v.focusedEditor=null}if(!v.activeEditor){n.unbind(document,"selectionchange",k);n.unbind(document,"focusin",m);n.unbind(document,"mouseup",l);k=m=l=null}}v.on("AddEditor",r);v.on("RemoveEditor",s)}i.isEditorUIElement=function(p){return p.className.toString().indexOf("mce-")!==-1};return i});h("tinymce/EditorManager",["tinymce/Editor","tinymce/dom/DomQuery","tinymce/dom/DOMUtils","tinymce/util/URI","tinymce/Env","tinymce/util/Tools","tinymce/util/Observable","tinymce/util/I18n","tinymce/FocusManager"],function(s,k,w,n,j,i,p,t,m){var y=w.DOM;var u=i.explode,l=i.each,x=i.extend;var z=0,q,r;function v(C){var D=r.editors,B;delete D[C.id];for(var A=0;A0){l(u(I),function(L){var K;if((K=y.get(L))){C(L,F,K)}else{l(document.forms,function(M){l(M.elements,function(N){if(N.name===L){L="mce_editor_"+z++;y.setAttrib(N,"id",L);C(L,F,N)}})})}})}break;case"textareas":case"specific_textareas":l(y.select("textarea"),function(K){if(F.editor_deselector&&D(K,F.editor_deselector)){return}if(!F.editor_selector||D(K,F.editor_selector)){C(E(K),F,K)}});break}if(F.oninit){I=J=0;l(G,function(K){J++;if(!K.initialized){K.on("init",function(){I++;if(I==J){H("oninit")}})}else{I++}if(I==J){H("oninit")}})}}A.settings=F;y.bind(window,"ready",B)},get:function(A){if(!arguments.length){return this.editors}return A in this.editors?this.editors[A]:null},add:function(B){var A=this,C=A.editors;C[B.id]=B;C.push(B);A.activeEditor=B;A.fire("AddEditor",{editor:B});if(!q){q=function(){A.fire("BeforeUnload")};y.bind(window,"beforeunload",q)}return B},createEditor:function(B,A){return this.add(new s(B,A,this))},remove:function(A){var B=this,C,E=B.editors,D;if(!A){for(C=E.length-1;C>=0;C--){B.remove(E[C])}return}if(typeof A=="string"){A=A.selector||A;l(y.select(A),function(F){D=E[F.id];if(D){B.remove(D)}});return}D=A;if(!E[D.id]){return null}if(v(D)){B.fire("RemoveEditor",{editor:D})}if(!E.length){y.unbind(window,"beforeunload",q)}D.remove();return D},execCommand:function(E,D,C){var A=this,B=A.get(C);switch(E){case"mceAddEditor":if(!A.get(C)){new s(C,A.settings,A).render()}return true;case"mceRemoveEditor":if(B){B.remove()}return true;case"mceToggleEditor":if(!B){A.execCommand("mceAddEditor",0,C);return true}if(B.isHidden()){B.show()}else{B.hide()}return true}if(A.activeEditor){return A.activeEditor.execCommand(E,D,C)}return false},triggerSave:function(){l(this.editors,function(A){A.save()})},addI18n:function(B,A){t.add(B,A)},translate:function(A){return t.translate(A)},setActive:function(A){var B=this.activeEditor;if(this.activeEditor!=A){if(B){B.fire("deactivate",{relatedTarget:A})}A.fire("activate",{relatedTarget:B})}this.activeEditor=A}};x(r,p);r.setup();window.tinymce=window.tinyMCE=r;return r});h("tinymce/LegacyInput",["tinymce/EditorManager","tinymce/util/Tools"],function(j,i){var l=i.each,k=i.explode;j.on("AddEditor",function(n){var m=n.editor;m.on("preInit",function(){var q,t,s,p=m.settings;function o(v,u){l(u,function(x,w){if(x){s.setStyle(v,w,x)}});s.rename(v,"span")}function r(u){s=m.dom;if(p.convert_fonts_to_spans){l(s.select("font,u,strike",u.node),function(v){q[v.nodeName.toLowerCase()](s,v)})}}if(p.inline_styles){t=k(p.font_size_legacy_values);q={font:function(v,u){o(u,{backgroundColor:u.style.backgroundColor,color:u.color,fontFamily:u.face,fontSize:t[parseInt(u.size,10)-1]})},u:function(v,u){if(m.settings.schema==="html4"){o(u,{textDecoration:"underline"})}},strike:function(v,u){o(u,{textDecoration:"line-through"})}};m.on("PreProcess SetContent",r)}})})});h("tinymce/util/XHR",["tinymce/util/Observable","tinymce/util/Tools"],function(i,j){var k={send:function(m){var o,n=0;function l(){if(!m.async||o.readyState==4||n++>10000){if(m.success&&n<10000&&o.status==200){m.success.call(m.success_scope,""+o.responseText,o,m)}else{if(m.error){m.error.call(m.error_scope,n>10000?"TIMED_OUT":"GENERAL",o,m)}}o=null}else{setTimeout(l,10)}}m.scope=m.scope||this;m.success_scope=m.success_scope||m.scope;m.error_scope=m.error_scope||m.scope;m.async=m.async===false?false:true;m.data=m.data||"";o=new XMLHttpRequest();if(o){if(o.overrideMimeType){o.overrideMimeType(m.content_type)}o.open(m.type||(m.data?"POST":"GET"),m.url,m.async);if(m.crossDomain){o.withCredentials=true}if(m.content_type){o.setRequestHeader("Content-Type",m.content_type)}o.setRequestHeader("X-Requested-With","XMLHttpRequest");o=k.fire("beforeSend",{xhr:o,settings:m}).xhr;o.send(m.data);if(!m.async){return l()}setTimeout(l,10)}}};j.extend(k,i);return k});h("tinymce/util/JSON",[],function(){function i(p,k){var n,j,m,l;k=k||'"';if(p===null){return"null"}m=typeof p;if(m=="string"){j="\bb\tt\nn\ff\rr\"\"''\\\\";return k+p.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(q,o){if(k==='"'&&q==="'"){return q}n=j.indexOf(o);if(n+1){return"\\"+j.charAt(n+1)}q=o.charCodeAt().toString(16);return"\\u"+"0000".substring(q.length)+q})+k}if(m=="object"){if(p.hasOwnProperty&&Object.prototype.toString.call(p)==="[object Array]"){for(n=0,j="[";n0?",":"")+i(p[n],k)}return j+"]"}j="{";for(l in p){if(p.hasOwnProperty(l)){j+=typeof p[l]!="function"?(j.length>1?","+k:k)+l+k+":"+i(p[l],k):""}}return j+"}"}return""+p}return{serialize:i,parse:function(k){try{return window[String.fromCharCode(101)+"val"]("("+k+")")}catch(j){}}}});h("tinymce/util/JSONRequest",["tinymce/util/JSON","tinymce/util/XHR","tinymce/util/Tools"],function(l,k,j){var m=j.extend;function i(n){this.settings=m({},n);this.count=0}i.sendRPC=function(n){return new i().send(n)};i.prototype={send:function(p){var o=p.error,n=p.success;p=m(this.settings,p);p.success=function(r,q){r=l.parse(r);if(typeof r=="undefined"){r={error:"JSON Parse error."}}if(r.error){o.call(p.error_scope||p.scope,r.error,q)}else{n.call(p.success_scope||p.scope,r.result)}};p.error=function(r,q){if(o){o.call(p.error_scope||p.scope,r,q)}};p.data=l.serialize({id:p.id||"c"+(this.count++),method:p.method,params:p.params});p.content_type="application/json";k.send(p)}};return i});h("tinymce/util/JSONP",["tinymce/dom/DOMUtils"],function(i){return{callbacks:{},count:0,send:function(k){var j=this,m=i.DOM,l=k.count!==g?k.count:j.count;var n="tinymce_jsonp_"+l;j.callbacks[l]=function(o){m.remove(n);delete j.callbacks[l];k.callback(o)};m.add(m.doc.body,"script",{id:n,src:k.url,type:"text/javascript"});j.count++}}});h("tinymce/util/LocalStorage",[],function(){var l,k,o,q,r,j;try{if(window.localStorage){return localStorage}}catch(n){}r="tinymce";k=document.documentElement;j=!!k.addBehavior;if(j){k.addBehavior("#default#userData")}function i(){q=[];for(var s in o){q.push(s)}l.length=q.length}function p(){var s,v,u,x=0;o={};if(!j){return}function t(y){var A,z;z=y!==g?x+y:v.indexOf(",",x);if(z===-1||z>v.length){return null}A=v.substring(x,z);x=z+1;return A}k.load(r);v=k.getAttribute(r)||"";do{var w=t();if(w===null){break}s=t(parseInt(w,32)||0);if(s!==null){w=t();if(w===null){break}u=t(parseInt(w,32)||0);if(s){o[s]=u}}}while(s!==null);i()}function m(){var v,u="";if(!j){return}for(var t in o){v=o[t];u+=(u?",":"")+t.length.toString(32)+","+t+","+v.length.toString(32)+","+v}k.setAttribute(r,u);try{k.save(r)}catch(s){}i()}l={key:function(s){return q[s]},getItem:function(s){return s in o?o[s]:null},setItem:function(s,t){o[s]=""+t;m()},removeItem:function(s){delete o[s];m()},clear:function(){o={};m()}};p();return l});h("tinymce/Compat",["tinymce/dom/DOMUtils","tinymce/dom/EventUtils","tinymce/dom/ScriptLoader","tinymce/AddOnManager","tinymce/util/Tools","tinymce/Env"],function(m,o,n,l,j,i){var k=window.tinymce;k.DOM=m.DOM;k.ScriptLoader=n.ScriptLoader;k.PluginManager=l.PluginManager;k.ThemeManager=l.ThemeManager;k.dom=k.dom||{};k.dom.Event=o.Event;j.each(j,function(q,p){k[p]=q});j.each("isOpera isWebKit isIE isGecko isMac".split(" "),function(p){k[p]=i[p.substr(2).toLowerCase()]});return{}});h("tinymce/ui/Layout",["tinymce/util/Class","tinymce/util/Tools"],function(i,j){return i.extend({Defaults:{firstControlClass:"first",lastControlClass:"last"},init:function(k){this.settings=j.extend({},this.Defaults,k)},preRender:function(k){k.addClass(this.settings.containerClass,"body")},applyClasses:function(k){var m=this,p=m.settings,l,o,n;l=k.items().filter(":visible");o=p.firstControlClass;n=p.lastControlClass;l.each(function(q){q.removeClass(o).removeClass(n);if(p.controlClass){q.addClass(p.controlClass)}});l.eq(0).addClass(o);l.eq(-1).addClass(n)},renderHtml:function(k){var m=this,o=m.settings,l,n="";l=k.items();l.eq(0).addClass(o.firstControlClass);l.eq(-1).addClass(o.lastControlClass);l.each(function(p){if(o.controlClass){p.addClass(o.controlClass)}n+=p.renderHtml()});return n},recalc:function(){},postRender:function(){}})});h("tinymce/ui/AbsoluteLayout",["tinymce/ui/Layout"],function(i){return i.extend({Defaults:{containerClass:"abs-layout",controlClass:"abs-layout-item"},recalc:function(j){j.items().filter(":visible").each(function(l){var k=l.settings;l.layoutRect({x:k.x,y:k.y,w:k.w,h:k.h});if(l.recalc){l.recalc()}})},renderHtml:function(j){return'
    '+this._super(j)}})});h("tinymce/ui/Tooltip",["tinymce/ui/Control","tinymce/ui/Movable"],function(j,i){return j.extend({Mixins:[i],Defaults:{classes:"widget tooltip tooltip-n"},text:function(l){var k=this;if(typeof l!="undefined"){k._value=l;if(k._rendered){k.getEl().lastChild.innerHTML=k.encode(l)}return k}return k._value},renderHtml:function(){var k=this,l=k.classPrefix;return('")},repaint:function(){var k=this,l,m;l=k.getEl().style;m=k._layoutRect;l.left=m.x+"px";l.top=m.y+"px";l.zIndex=65535+65535}})});h("tinymce/ui/Widget",["tinymce/ui/Control","tinymce/ui/Tooltip"],function(k,i){var l;var j=k.extend({init:function(n){var m=this;m._super(n);n=m.settings;m.canFocus=true;if(n.tooltip&&j.tooltips!==false){m.on("mouseenter",function(q){var p=m.tooltip().moveTo(-65535);if(q.control==m){var o=p.text(n.tooltip).show().testMoveRel(m.getEl(),["bc-tc","bc-tl","bc-tr"]);p.toggleClass("tooltip-n",o=="bc-tc");p.toggleClass("tooltip-nw",o=="bc-tl");p.toggleClass("tooltip-ne",o=="bc-tr");p.moveRel(m.getEl(),o)}else{p.hide()}});m.on("mouseleave mousedown click",function(){m.tooltip().hide()})}m.aria("label",n.ariaLabel||n.tooltip)},tooltip:function(){if(!l){l=new i({type:"tooltip"});l.renderTo()}return l},active:function(o){var m=this,n;if(o!==n){m.aria("pressed",o);m.toggleClass("active",o)}return m._super(o)},disabled:function(o){var m=this,n;if(o!==n){m.aria("disabled",o);m.toggleClass("disabled",o)}return m._super(o)},postRender:function(){var m=this,n=m.settings;m._rendered=true;m._super();if(!m.parent()&&(n.width||n.height)){m.initLayoutRect();m.repaint()}if(n.autofocus){m.focus()}},remove:function(){this._super();if(l){l.remove();l=null}}});return j});h("tinymce/ui/Button",["tinymce/ui/Widget"],function(i){return i.extend({Defaults:{classes:"widget btn",role:"button"},init:function(l){var j=this,k;j.on("click mousedown",function(m){m.preventDefault()});j._super(l);k=l.size;if(l.subtype){j.addClass(l.subtype)}if(k){j.addClass("btn-"+k)}},icon:function(m){var l=this,n=l.classPrefix;if(typeof m=="undefined"){return l.settings.icon}l.settings.icon=m;m=m?n+"ico "+n+"i-"+l.settings.icon:"";if(l._rendered){var j=l.getEl().firstChild,k=j.getElementsByTagName("i")[0];if(m){if(!k||k!=j.firstChild){k=document.createElement("i");j.insertBefore(k,j.firstChild)}k.className=m}else{if(k){j.removeChild(k)}}l.text(l._text)}return l},repaint:function(){var j=this.getEl().firstChild.style;j.width=j.height="100%";this._super()},text:function(l){var j=this;if(j._rendered){var k=j.getEl().lastChild.lastChild;if(k){k.data=j.translate(l)}}return j._super(l)},renderHtml:function(){var j=this,n=j._id,l=j.classPrefix;var k=j.settings.icon,m;m=j.settings.image;if(m){k="none";if(typeof m!="string"){m=window.getSelection?m[0]:m[1]}m=" style=\"background-image: url('"+m+"')\""}else{m=""}k=j.settings.icon?l+"ico "+l+"i-"+k:"";return('
    ")}})});h("tinymce/ui/ButtonGroup",["tinymce/ui/Container"],function(i){return i.extend({Defaults:{defaultType:"button",role:"group"},renderHtml:function(){var j=this,k=j._layout;j.addClass("btn-group");j.preRender();k.preRender(j);return('
    '+(j.settings.html||"")+k.renderHtml(j)+"
    ")}})});h("tinymce/ui/Checkbox",["tinymce/ui/Widget"],function(i){return i.extend({Defaults:{classes:"checkbox",role:"checkbox",checked:false},init:function(k){var j=this;j._super(k);j.on("click mousedown",function(l){l.preventDefault()});j.on("click",function(l){l.preventDefault();if(!j.disabled()){j.checked(!j.checked())}});j.checked(j.settings.checked)},checked:function(k){var j=this;if(typeof k!="undefined"){if(k){j.addClass("checked")}else{j.removeClass("checked")}j._checked=k;j.aria("checked",k);return j}return j._checked},value:function(j){return this.checked(j)},renderHtml:function(){var j=this,l=j._id,k=j.classPrefix;return('
    '+j.encode(j._text)+"
    ")}})});h("tinymce/ui/ComboBox",["tinymce/ui/Widget","tinymce/ui/Factory","tinymce/ui/DomUtils"],function(k,i,j){return k.extend({init:function(m){var l=this;l._super(m);l.addClass("combobox");l.subinput=true;l.ariaTarget="inp";m=l.settings;m.menu=m.menu||m.values;if(m.menu){m.icon="caret"}l.on("click",function(o){var p=o.target,n=l.getEl();while(p&&p!=n){if(p.id&&p.id.indexOf("-open")!=-1){l.fire("action");if(m.menu){l.showMenu();if(o.aria){l.menu.items()[0].focus()}}}p=p.parentNode}});l.on("keydown",function(n){if(n.target.nodeName=="INPUT"&&n.keyCode==13){l.parents().reverse().each(function(o){n.preventDefault();l.fire("change");if(o.hasEventListeners("submit")&&o.toJSON){o.fire("submit",{data:o.toJSON()});return false}})}});if(m.placeholder){l.addClass("placeholder");l.on("focusin",function(){if(!l._hasOnChange){j.on(l.getEl("inp"),"change",function(){l.fire("change")});l._hasOnChange=true}if(l.hasClass("placeholder")){l.getEl("inp").value="";l.removeClass("placeholder")}});l.on("focusout",function(){if(l.value().length===0){l.getEl("inp").value=m.placeholder;l.addClass("placeholder")}})}},showMenu:function(){var l=this,m=l.settings,n;if(!l.menu){n=m.menu||[];if(n.length){n={type:"menu",items:n}}else{n.type=n.type||"menu"}l.menu=i.create(n).parent(l).renderTo(l.getContainerElm());l.fire("createmenu");l.menu.reflow();l.menu.on("cancel",function(o){if(o.control===l.menu){l.focus()}});l.menu.on("show hide",function(o){o.control.items().each(function(p){p.active(p.value()==l.value())})}).fire("show");l.menu.on("select",function(o){l.value(o.control.value())});l.on("focusin",function(o){if(o.target.tagName.toUpperCase()=="INPUT"){l.menu.hide()}});l.aria("expanded",true)}l.menu.show();l.menu.layoutRect({w:l.layoutRect().w});l.menu.moveRel(l.getEl(),l.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])},value:function(m){var l=this;if(typeof m!="undefined"){l._value=m;l.removeClass("placeholder");if(l._rendered){l.getEl("inp").value=m}return l}if(l._rendered){m=l.getEl("inp").value;if(m!=l.settings.placeholder){return m}return""}return l._value},disabled:function(m){var l=this;if(l._rendered&&typeof m!="undefined"){l.getEl("inp").disabled=m}return l._super(m)},focus:function(){this.getEl("inp").focus()},repaint:function(){var m=this,r=m.getEl(),l=m.getEl("open"),p=m.layoutRect();var o,n;if(l){o=p.w-j.getSize(l).width-10}else{o=p.w-10}var q=document;if(q.all&&(!q.documentMode||q.documentMode<=8)){n=(m.layoutRect().h-2)+"px"}j.css(r.firstChild,{width:o,lineHeight:n});m._super();return m},postRender:function(){var l=this;j.on(this.getEl("inp"),"change",function(){l.fire("change")});return l._super()},remove:function(){j.off(this.getEl("inp"));this._super()},renderHtml:function(){var t=this,l=t._id,m=t.settings,n=t.classPrefix;var q=m.value||m.placeholder||"";var p,s,o="",r="";if("spellcheck" in m){r+=' spellcheck="'+m.spellcheck+'"'}if(m.maxLength){r+=' maxlength="'+m.maxLength+'"'}if(m.size){r+=' size="'+m.size+'"'}if(m.subtype){r+=' type="'+m.subtype+'"'}if(t.disabled()){r+=' disabled="disabled"'}p=m.icon;if(p&&p!="caret"){p=n+"ico "+n+"i-"+m.icon}s=t._text;if(p||s){o=('
    ");t.addClass("has-open")}return('
    "+o+"
    ")}})});h("tinymce/ui/ColorBox",["tinymce/ui/ComboBox"],function(i){return i.extend({init:function(k){var j=this;k.spellcheck=false;if(k.onaction){k.icon="none"}j._super(k);j.addClass("colorbox");j.on("change keyup postrender",function(){j.repaintColor(j.value())})},repaintColor:function(k){var l=this.getEl().getElementsByTagName("i")[0];if(l){try{l.style.background=k}catch(j){}}},value:function(k){var j=this;if(typeof k!="undefined"){if(j._rendered){j.repaintColor(k)}}return j._super(k)}})});h("tinymce/ui/PanelButton",["tinymce/ui/Button","tinymce/ui/FloatPanel"],function(i,j){return i.extend({showPanel:function(){var k=this,l=k.settings;k.active(true);if(!k.panel){var m=l.panel;if(m.type){m={layout:"grid",items:m}}m.role=m.role||"dialog";m.popover=true;m.autohide=true;m.ariaRoot=true;k.panel=new j(m).on("hide",function(){k.active(false)}).on("cancel",function(n){n.stopPropagation();k.focus();k.hidePanel()}).parent(k).renderTo(k.getContainerElm());k.panel.fire("show");k.panel.reflow()}else{k.panel.show()}k.panel.moveRel(k.getEl(),l.popoverAlign||(k.isRtl()?["bc-tr","bc-tc"]:["bc-tl","bc-tc"]))},hidePanel:function(){var k=this;if(k.panel){k.panel.hide()}},postRender:function(){var k=this;k.aria("haspopup",true);k.on("click",function(l){if(l.control===k){if(k.panel&&k.panel.visible()){k.hidePanel()}else{k.showPanel();k.panel.focus(!!l.aria)}}});return k._super()},remove:function(){if(this.panel){this.panel.remove();this.panel=null}return this._super()}})});h("tinymce/ui/ColorButton",["tinymce/ui/PanelButton","tinymce/dom/DOMUtils"],function(j,i){var k=i.DOM;return j.extend({init:function(l){this._super(l);this.addClass("colorbutton")},color:function(l){if(l){this._color=l;this.getEl("preview").style.backgroundColor=l;return this}return this._color},resetColor:function(){this._color=null;this.getEl("preview").style.backgroundColor=null;return this},renderHtml:function(){var l=this,p=l._id,n=l.classPrefix;var m=l.settings.icon?n+"ico "+n+"i-"+l.settings.icon:"";var o=l.settings.image?" style=\"background-image: url('"+l.settings.image+"')\"":"";return('
    ')},postRender:function(){var l=this,m=l.settings.onclick;l.on("click",function(n){if(n.aria&&n.aria.key=="down"){return}if(n.control==l&&!k.getParent(n.target,"."+l.classPrefix+"open")){n.stopImmediatePropagation();m.call(l,n)}});delete l.settings.onclick;return l._super()}})});h("tinymce/util/Color",[],function(){var k=Math.min,i=Math.max,j=Math.round;function l(w){var x=this,m=0,t=0,v=0;function p(y,A,C){var z,G,E,B,D,F;z=0;G=0;E=0;y=y/255;A=A/255;C=C/255;D=k(y,k(A,C));F=i(y,i(A,C));if(D==F){E=D;return{h:0,s:0,v:E*100}}B=(y==D)?A-C:((C==D)?y-A:C-y);z=(y==D)?3:((C==D)?1:5);z=60*(z-B/(F-D));G=(F-D)/F;E=F;return{h:j(z),s:j(G*100),v:j(E*100)}}function q(y,C,D){var B,A,r,z;y=(parseInt(y,10)||0)%360;C=parseInt(C,10)/100;D=parseInt(D,10)/100;C=i(0,k(C,1));D=i(0,k(D,1));if(C===0){m=t=v=j(255*D);return}B=y/60;A=D*C;r=A*(1-Math.abs(B%2-1));z=D-A;switch(Math.floor(B)){case 0:m=A;t=r;v=0;break;case 1:m=r;t=A;v=0;break;case 2:m=0;t=A;v=r;break;case 3:m=0;t=r;v=A;break;case 4:m=r;t=0;v=A;break;case 5:m=A;t=0;v=r;break;default:m=t=v=0}m=j(255*(m+z));t=j(255*(t+z));v=j(255*(v+z))}function n(){function r(y){y=parseInt(y,10).toString(16);return y.length>1?y:"0"+y}return"#"+r(m)+r(t)+r(v)}function u(){return{r:m,g:t,b:v}}function s(){return p(m,t,v)}function o(y){var r;if(typeof y=="object"){if("r" in y){m=y.r;t=y.g;v=y.b}else{if("v" in y){q(y.h,y.s,y.v)}}}else{if((r=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(y))){m=parseInt(r[1],10);t=parseInt(r[2],10);v=parseInt(r[3],10)}else{if((r=/#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(y))){m=parseInt(r[1],16);t=parseInt(r[2],16);v=parseInt(r[3],16)}else{if((r=/#([0-F])([0-F])([0-F])/gi.exec(y))){m=parseInt(r[1]+r[1],16);t=parseInt(r[2]+r[2],16);v=parseInt(r[3]+r[3],16)}}}}m=m<0?0:(m>255?255:m);t=t<0?0:(t>255?255:t);v=v<0?0:(v>255?255:v);return x}if(w){o(w)}x.toRgb=u;x.toHsv=s;x.toHex=n;x.parse=o}return l});h("tinymce/ui/ColorPicker",["tinymce/ui/Widget","tinymce/ui/DragHelper","tinymce/ui/DomUtils","tinymce/util/Color"],function(k,j,i,l){return k.extend({Defaults:{classes:"widget colorpicker"},init:function(m){this._super(m)},postRender:function(){var w=this,q=w.color(),r,t,s,v,o;t=w.getEl("h");s=w.getEl("hp");v=w.getEl("sv");o=w.getEl("svp");function p(D,A){var C=i.getPos(D),z,B;z=A.pageX-C.x;B=A.pageY-C.y;z=Math.max(0,Math.min(z/D.clientWidth,1));B=Math.max(0,Math.min(B/D.clientHeight,1));return{x:z,y:B}}function n(z,y){var x=(360-z.h)/360;i.css(s,{top:(x*100)+"%"});if(!y){i.css(o,{left:z.s+"%",top:(100-z.v)+"%"})}v.style.background=new l({s:100,v:100,h:z.h}).toHex();w.color().parse({s:z.s,v:z.v,h:z.h})}function m(x){var y;y=p(v,x);r.s=y.x*100;r.v=(1-y.y)*100;n(r);w.fire("change")}function u(x){var y;y=p(t,x);r=q.toHsv();r.h=(1-y.y)*360;n(r,true);w.fire("change")}w._repaint=function(){r=q.toHsv();n(r)};w._super();w._svdraghelper=new j(w._id+"-sv",{start:m,drag:m});w._hdraghelper=new j(w._id+"-h",{start:u,drag:u});w._repaint()},rgb:function(){return this.color().toRgb()},value:function(n){var m=this;if(arguments.length){m.color().parse(n);if(m._rendered){m._repaint()}}else{return m.color().toHex()}},color:function(){if(!this._color){this._color=new l()}return this._color},renderHtml:function(){var m=this,s=m._id,q=m.classPrefix,o;var p="#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000";function n(){var w,u,v="",t,x;t="filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=";x=p.split(",");for(w=0,u=x.length-1;w')}return v}var r=("background: -ms-linear-gradient(top,"+p+");background: linear-gradient(to bottom,"+p+");");o=('
    '+n()+'
    ');return('
    '+o+"
    ")}})});h("tinymce/ui/Path",["tinymce/ui/Widget"],function(i){return i.extend({init:function(k){var j=this;if(!k.delimiter){k.delimiter="\u00BB"}j._super(k);j.addClass("path");j.canFocus=true;j.on("click",function(n){var l,m=n.target;if((l=m.getAttribute("data-index"))){j.fire("select",{value:j.data()[l],index:l})}})},focus:function(){var j=this;j.getEl().firstChild.focus();return j},data:function(k){var j=this;if(typeof k!=="undefined"){j._data=k;j.update();return j}return j._data},update:function(){this.innerHtml(this._getPathHtml())},postRender:function(){var j=this;j._super();j.data(j.settings.data)},renderHtml:function(){var j=this;return('
    '+j._getPathHtml()+"
    ")},_getPathHtml:function(){var k=this,p=k._data||[],n,j,m="",o=k.classPrefix;for(n=0,j=p.length;n0?'":"")+'
    '+p[n].name+"
    ")}if(!m){m='
    \u00a0
    '}return m}})});h("tinymce/ui/ElementPath",["tinymce/ui/Path","tinymce/EditorManager"],function(j,i){return j.extend({postRender:function(){var k=this,m=i.activeEditor;function l(n){if(n.nodeType===1){if(n.nodeName=="BR"||!!n.getAttribute("data-mce-bogus")){return true}if(n.getAttribute("data-mce-type")==="bookmark"){return true}}return false}if(m.settings.elementpath!==false){k.on("select",function(n){m.focus();m.selection.select(this.data()[n.index].element);m.nodeChanged()});m.on("nodeChange",function(r){var n=[],p=r.parents,q=p.length;while(q--){if(p[q].nodeType==1&&!l(p[q])){var o=m.fire("ResolveName",{name:p[q].nodeName.toLowerCase(),target:p[q]});if(!o.isDefaultPrevented()){n.push({name:o.name,element:p[q]})}if(o.isPropagationStopped()){break}}}k.data(n)})}return k._super()}})});h("tinymce/ui/FormItem",["tinymce/ui/Container"],function(i){return i.extend({Defaults:{layout:"flex",align:"center",defaults:{flex:1}},renderHtml:function(){var j=this,k=j._layout,l=j.classPrefix;j.addClass("formitem");k.preRender(j);return('
    '+(j.settings.title?('
    '+j.settings.title+"
    "):"")+'
    '+(j.settings.html||"")+k.renderHtml(j)+"
    ")}})});h("tinymce/ui/Form",["tinymce/ui/Container","tinymce/ui/FormItem","tinymce/util/Tools"],function(i,k,j){return i.extend({Defaults:{containerCls:"form",layout:"flex",direction:"column",align:"stretch",flex:1,padding:20,labelGap:30,spacing:10,callbacks:{submit:function(){this.submit()}}},preRender:function(){var m=this,l=m.items();if(!m.settings.formItemDefaults){m.settings.formItemDefaults={layout:"flex",autoResize:"overflow",defaults:{flex:1}}}l.each(function(p){var o,n=p.settings.label;if(n){o=new k(j.extend({items:{type:"label",id:p._id+"-l",text:n,flex:0,forId:p._id,disabled:p.disabled()}},m.settings.formItemDefaults));o.type="formitem";p.aria("labelledby",p._id+"-l");if(typeof p.settings.flex=="undefined"){p.settings.flex=1}m.replace(p,o);o.add(p)}})},recalcLabels:function(){var m=this,p=0,q=[],n,o,l;if(m.settings.labelGapCalc===false){return}if(m.settings.labelGapCalc=="children"){l=m.find("formitem")}else{l=m.items()}l.filter("formitem").each(function(t){var s=t.items()[0],r=s.getEl().clientWidth;p=r>p?r:p;q.push(s)});o=m.settings.labelGap||0;n=q.length;while(n--){q[n].settings.minWidth=p+o}},visible:function(l){var m=this._super(l);if(l===true&&this._rendered){this.recalcLabels()}return m},submit:function(){return this.fire("submit",{data:this.toJSON()})},postRender:function(){var l=this;l._super();l.recalcLabels();l.fromJSON(l.settings.data)}})});h("tinymce/ui/FieldSet",["tinymce/ui/Form"],function(i){return i.extend({Defaults:{containerCls:"fieldset",layout:"flex",direction:"column",align:"stretch",flex:1,padding:"25 15 5 15",labelGap:30,spacing:10,border:1},renderHtml:function(){var j=this,k=j._layout,l=j.classPrefix;j.preRender();k.preRender(j);return('
    '+(j.settings.title?(''+j.settings.title+""):"")+'
    '+(j.settings.html||"")+k.renderHtml(j)+"
    ")}})});h("tinymce/ui/FilePicker",["tinymce/ui/ComboBox","tinymce/util/Tools"],function(j,i){return j.extend({init:function(o){var m=this,n=tinymce.activeEditor,l=n.settings;var k,q,p;o.spellcheck=false;p=l.file_picker_types||l.file_browser_callback_types;if(p){p=i.makeMap(p,/[, ]/)}if(!p||p[o.filetype]){q=l.file_picker_callback;if(q&&(!p||p[o.filetype])){k=function(){var r=m.fire("beforecall").meta;r=i.extend({filetype:o.filetype},r);q.call(n,function(s,t){m.value(s).fire("change",{meta:t})},m.value(),r)}}else{q=l.file_browser_callback;if(q&&(!p||p[o.filetype])){k=function(){q(m.getEl("inp").id,m.value(),o.filetype,window)}}}}if(k){o.icon="browse";o.onaction=k}m._super(o)}})});h("tinymce/ui/FitLayout",["tinymce/ui/AbsoluteLayout"],function(i){return i.extend({recalc:function(k){var j=k.layoutRect(),l=k.paddingBox();k.items().filter(":visible").each(function(m){m.layoutRect({x:l.left,y:l.top,w:j.innerW-l.right-l.left,h:j.innerH-l.top-l.bottom});if(m.recalc){m.recalc()}})}})});h("tinymce/ui/FlexLayout",["tinymce/ui/AbsoluteLayout"],function(i){return i.extend({recalc:function(L){var X,S,y,V,t,B,R,w,m,Y,n,u;var T,k,o,q,s=[],r,E,P,I,J,W;var O,D,v,p,aa,M,x,N;var F,j,C,Q,H,U;var K,G;var z=Math.max,Z=Math.min;y=L.items().filter(":visible");V=L.layoutRect();t=L._paddingBox;B=L.settings;u=L.isRtl()?(B.direction||"row-reversed"):B.direction;R=B.align;w=L.isRtl()?(B.pack||"end"):B.pack;m=B.spacing||0;if(u=="row-reversed"||u=="column-reverse"){y=y.set(y.toArray().reverse());u=u.split("-")[0]}if(u=="column"){v="y";O="h";D="minH";p="maxH";M="innerH";aa="top";x="deltaH";N="contentH";H="left";C="w";F="x";j="innerW";Q="minW";U="right";K="deltaW";G="contentW"}else{v="x";O="w";D="minW";p="maxW";M="innerW";aa="left";x="deltaW";N="contentW";H="top";C="h";F="y";j="innerH";Q="minH";U="bottom";K="deltaH";G="contentH"}n=V[M]-t[aa]-t[aa];W=Y=0;for(X=0,S=y.length;X0){Y+=q;if(k[p]){s.push(T)}k.flex=q}n-=k[D];r=t[H]+k[Q]+t[U];if(r>W){W=r}}I={};if(n<0){I[D]=V[D]-n+V[x]}else{I[D]=V[M]-n+V[x]}I[Q]=W+V[K];I[N]=V[M]-n;I[G]=W;I.minW=Z(I.minW,V.maxW);I.minH=Z(I.minH,V.maxH);I.minW=z(I.minW,V.startMinWidth);I.minH=z(I.minH,V.startMinHeight);if(V.autoResize&&(I.minW!=V.minW||I.minH!=V.minH)){I.w=I.minW;I.h=I.minH;L.layoutRect(I);this.recalc(L);if(L._lastRect===null){var A=L.parent();if(A){A._lastRect=null;A.recalc()}}return}P=n/Y;for(X=0,S=s.length;XE){n-=(k[p]-k[D]);Y-=k.flex;k.flex=0;k.maxFlexSize=E}else{k.maxFlexSize=0}}P=n/Y;J=t[aa];I={};if(Y===0){if(w=="end"){J=n+t[aa]}else{if(w=="center"){J=Math.round((V[M]/2)-((V[M]-n)/2))+t[aa];if(J<0){J=t[aa]}}else{if(w=="justify"){J=t[aa];m=Math.floor(n/(y.length-1))}}}}I[F]=t[H];for(X=0,S=y.length;X0){r+=k.flex*P}I[O]=r;I[v]=J;T.layoutRect(I);if(T.recalc){T.recalc()}J+=r+m}}})});h("tinymce/ui/FlowLayout",["tinymce/ui/Layout"],function(i){return i.extend({Defaults:{containerClass:"flow-layout",controlClass:"flow-layout-item",endClass:"break"},recalc:function(j){j.items().filter(":visible").each(function(k){if(k.recalc){k.recalc()}})}})});h("tinymce/ui/FormatControls",["tinymce/ui/Control","tinymce/ui/Widget","tinymce/ui/FloatPanel","tinymce/util/Tools","tinymce/EditorManager","tinymce/Env"],function(n,m,p,j,l,i){var o=j.each;l.on("AddEditor",function(q){if(q.editor.rtl){n.rtl=true}k(q.editor)});n.translate=function(q){return l.translate(q)};m.tooltips=!i.iOS;function k(v){var q;function w(y,z){return function(){var A=this;v.on("nodeChange",function(D){var B=v.formatter;var C=null;o(D.parents,function(E){o(y,function(F){if(z){if(B.matchNode(E,z,{value:F.value})){C=F.value}}else{if(B.matchNode(E,F.value)){C=F.value}}if(C){return false}});if(C){return false}});A.value(C)})}}function t(y){y=y.replace(/;$/,"").split(";");var z=y.length;while(z--){y[z]=y[z].split("=")}return y}function s(){var C=0,B=[];var A=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough",icon:"strikethrough",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Alignment",items:[{title:"Left",icon:"alignleft",format:"alignleft"},{title:"Center",icon:"aligncenter",format:"aligncenter"},{title:"Right",icon:"alignright",format:"alignright"},{title:"Justify",icon:"alignjustify",format:"alignjustify"}]}];function y(D){var E=[];if(!D){return}o(D,function(H){var G={text:H.title,icon:H.icon};if(H.items){G.menu=y(H.items)}else{var F=H.format||"custom"+C++;if(!H.format){H.name=F;B.push(H)}G.format=F;G.cmd=H.cmd}E.push(G)});return E}function z(){var D;if(v.settings.style_formats_merge){if(v.settings.style_formats){D=y(A.concat(v.settings.style_formats))}else{D=y(A)}}else{D=y(v.settings.style_formats||A)}return D}v.on("init",function(){o(B,function(D){v.formatter.register(D.name,D)})});return{type:"menu",items:z(),onPostRender:function(D){v.fire("renderFormatsMenu",{control:D.control})},itemDefaults:{preview:true,textStyle:function(){if(this.settings.format){return v.formatter.getCssText(this.settings.format)}},onPostRender:function(){var D=this;D.parent().on("show",function(){var E,F;E=D.settings.format;if(E){D.disabled(!v.formatter.canApply(E));D.active(v.formatter.match(E))}F=D.settings.cmd;if(F){D.active(v.queryCommandState(F))}})},onclick:function(){if(this.settings.format){r(this.settings.format)}if(this.settings.cmd){v.execCommand(this.settings.cmd)}}}}}q=s();o({bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript"},function(z,y){v.addButton(y,{tooltip:z,onPostRender:function(){var A=this;if(v.formatter){v.formatter.formatChanged(y,function(B){A.active(B)})}else{v.on("init",function(){v.formatter.formatChanged(y,function(B){A.active(B)})})}},onclick:function(){r(y)}})});o({outdent:["Decrease indent","Outdent"],indent:["Increase indent","Indent"],cut:["Cut","Cut"],copy:["Copy","Copy"],paste:["Paste","Paste"],help:["Help","mceHelp"],selectall:["Select all","SelectAll"],removeformat:["Clear formatting","RemoveFormat"],visualaid:["Visual aids","mceToggleVisualAid"],newdocument:["New document","mceNewDocument"]},function(z,y){v.addButton(y,{tooltip:z[0],cmd:z[1]})});o({blockquote:["Blockquote","mceBlockQuote"],numlist:["Numbered list","InsertOrderedList"],bullist:["Bullet list","InsertUnorderedList"],subscript:["Subscript","Subscript"],superscript:["Superscript","Superscript"],alignleft:["Align left","JustifyLeft"],aligncenter:["Align center","JustifyCenter"],alignright:["Align right","JustifyRight"],alignjustify:["Justify","JustifyFull"]},function(z,y){v.addButton(y,{tooltip:z[0],cmd:z[1],onPostRender:function(){var A=this;if(v.formatter){v.formatter.formatChanged(y,function(B){A.active(B)})}else{v.on("init",function(){v.formatter.formatChanged(y,function(B){A.active(B)})})}}})});function u(y){return function(){var z=this;y=y=="redo"?"hasRedo":"hasUndo";function A(){return v.undoManager?v.undoManager[y]():false}z.disabled(!A());v.on("Undo Redo AddUndo TypingUndo ClearUndos",function(){z.disabled(!A())})}}function x(){var y=this;v.on("VisualAid",function(z){y.active(z.hasVisual)});y.active(v.hasVisual)}v.addButton("undo",{tooltip:"Undo",onPostRender:u("undo"),cmd:"undo"});v.addButton("redo",{tooltip:"Redo",onPostRender:u("redo"),cmd:"redo"});v.addMenuItem("newdocument",{text:"New document",icon:"newdocument",cmd:"mceNewDocument"});v.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onPostRender:u("undo"),cmd:"undo"});v.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onPostRender:u("redo"),cmd:"redo"});v.addMenuItem("visualaid",{text:"Visual aids",selectable:true,onPostRender:x,cmd:"mceToggleVisualAid"});o({cut:["Cut","Cut","Meta+X"],copy:["Copy","Copy","Meta+C"],paste:["Paste","Paste","Meta+V"],selectall:["Select all","SelectAll","Meta+A"],bold:["Bold","Bold","Meta+B"],italic:["Italic","Italic","Meta+I"],underline:["Underline","Underline"],strikethrough:["Strikethrough","Strikethrough"],subscript:["Subscript","Subscript"],superscript:["Superscript","Superscript"],removeformat:["Clear formatting","RemoveFormat"]},function(z,y){v.addMenuItem(y,{text:z[0],icon:y,shortcut:z[2],cmd:z[1]})});v.on("mousedown",function(){p.hideAll()});function r(y){if(y.control){y=y.control.value()}if(y){v.execCommand("mceToggleFormat",false,y)}}v.addButton("styleselect",{type:"menubutton",text:"Formats",menu:q});v.addButton("formatselect",function(){var y=[],z=t(v.settings.block_formats||"Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre");o(z,function(A){y.push({text:A[0],value:A[1],textStyle:function(){return v.formatter.getCssText(A[1])}})});return{type:"listbox",text:z[0][0],values:y,fixedWidth:true,onselect:r,onPostRender:w(y)}});v.addButton("fontselect",function(){var z="Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats";var y=[],A=t(v.settings.font_formats||z);o(A,function(B){y.push({text:{raw:B[0]},value:B[1],textStyle:B[1].indexOf("dings")==-1?"font-family:"+B[1]:""})});return{type:"listbox",text:"Font Family",tooltip:"Font Family",values:y,fixedWidth:true,onPostRender:w(y,"fontname"),onselect:function(B){if(B.control.settings.value){v.execCommand("FontName",false,B.control.settings.value)}}}});v.addButton("fontsizeselect",function(){var y=[],A="8pt 10pt 12pt 14pt 18pt 24pt 36pt";var z=v.settings.fontsize_formats||A;o(z.split(" "),function(C){var E=C,D=C;var B=C.split("=");if(B.length>1){E=B[0];D=B[1]}y.push({text:E,value:D})});return{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:y,fixedWidth:true,onPostRender:w(y,"fontsize"),onclick:function(B){if(B.control.settings.value){v.execCommand("FontSize",false,B.control.settings.value)}}}});v.addMenuItem("formats",{text:"Formats",menu:q})}});h("tinymce/ui/GridLayout",["tinymce/ui/AbsoluteLayout"],function(i){return i.extend({recalc:function(F){var T=F.settings,S,v,w,P,k,o,D,n,O,K,J,H,G,q,s,N,t,p,m,Q,A,z,M=[],j=[],B,U,r,u,I,V;T=F.settings;w=F.items().filter(":visible");P=F.layoutRect();v=T.columns||Math.ceil(Math.sqrt(w.length));S=Math.ceil(w.length/v);t=T.spacingH||T.spacing||0;p=T.spacingV||T.spacing||0;m=T.alignH||T.align;Q=T.alignV||T.align;s=F._paddingBox;I="reverseRows" in T?T.reverseRows:F.isRtl();if(m&&typeof m=="string"){m=[m]}if(Q&&typeof Q=="string"){Q=[Q]}for(K=0;KM[K]?B:M[K];j[J]=U>j[J]?U:j[J]}}r=P.innerW-s.left-s.right;for(A=0,K=0;K0?t:0);r-=(K>0?t:0)+M[K]}u=P.innerH-s.top-s.bottom;for(z=0,J=0;J0?p:0);u-=(J>0?p:0)+j[J]}A+=s.left+s.right;z+=s.top+s.bottom;D={};D.minW=A+(P.w-P.innerW);D.minH=z+(P.h-P.innerH);D.contentW=D.minW-P.deltaW;D.contentH=D.minH-P.deltaH;D.minW=Math.min(D.minW,P.maxW);D.minH=Math.min(D.minH,P.maxH);D.minW=Math.max(D.minW,P.startMinWidth);D.minH=Math.max(D.minH,P.startMinHeight);if(P.autoResize&&(D.minW!=P.minW||D.minH!=P.minH)){D.w=D.minW;D.h=D.minH;F.layoutRect(D);this.recalc(F);if(F._lastRect===null){var C=F.parent();if(C){C._lastRect=null;C.recalc()}}return}if(P.autoResize){D=F.layoutRect(D);D.contentW=D.minW-P.deltaW;D.contentH=D.minH-P.deltaH}var E;if(T.packV=="start"){E=0}else{E=u>0?Math.floor(u/S):0}var R=0;var l=T.flexWidths;if(l){for(K=0;K')},src:function(j){this.getEl().src=j},html:function(l,m){var k=this,j=this.getEl().contentWindow.document.body;if(!j){setTimeout(function(){k.html(l)},0)}else{j.innerHTML=l;if(m){m()}}return this}})});h("tinymce/ui/Label",["tinymce/ui/Widget","tinymce/ui/DomUtils"],function(j,i){return j.extend({init:function(l){var k=this;k._super(l);k.addClass("widget");k.addClass("label");k.canFocus=false;if(l.multiline){k.addClass("autoscroll")}if(l.strong){k.addClass("strong")}},initLayoutRect:function(){var k=this,m=k._super();if(k.settings.multiline){var l=i.getSize(k.getEl());if(l.width>m.maxW){m.minW=m.maxW;k.addClass("multiline")}k.getEl().style.width=m.minW+"px";m.startMinH=m.h=m.minH=Math.min(m.maxH,i.getSize(k.getEl()).height)}return m},repaint:function(){var k=this;if(!k.settings.multiline){k.getEl().style.lineHeight=k.layoutRect().h+"px"}return k._super()},text:function(l){var k=this;if(k._rendered&&l){this.innerHtml(k.encode(l))}return k._super(l)},renderHtml:function(){var l=this,k=l.settings.forId;return('")}})});h("tinymce/ui/Toolbar",["tinymce/ui/Container"],function(i){return i.extend({Defaults:{role:"toolbar",layout:"flow"},init:function(k){var j=this;j._super(k);j.addClass("toolbar")},postRender:function(){var j=this;j.items().addClass("toolbar-item");return j._super()}})});h("tinymce/ui/MenuBar",["tinymce/ui/Toolbar"],function(i){return i.extend({Defaults:{role:"menubar",containerCls:"menubar",ariaRoot:true,defaults:{type:"menubutton"}}})});h("tinymce/ui/MenuButton",["tinymce/ui/Button","tinymce/ui/Factory","tinymce/ui/MenuBar"],function(l,j,k){function i(o,n){while(o){if(n===o){return true}o=o.parentNode}return false}var m=l.extend({init:function(o){var n=this;n._renderOpen=true;n._super(o);n.addClass("menubtn");if(o.fixedWidth){n.addClass("fixed-width")}n.aria("haspopup",true);n.hasPopup=true},showMenu:function(){var n=this,o=n.settings,p;if(n.menu&&n.menu.visible()){return n.hideMenu()}if(!n.menu){p=o.menu||[];if(p.length){p={type:"menu",items:p}}else{p.type=p.type||"menu"}n.menu=j.create(p).parent(n).renderTo();n.fire("createmenu");n.menu.reflow();n.menu.on("cancel",function(q){if(q.control.parent()===n.menu){q.stopPropagation();n.focus();n.hideMenu()}});n.menu.on("select",function(){n.focus()});n.menu.on("show hide",function(q){if(q.control==n.menu){n.activeMenu(q.type=="show")}n.aria("expanded",q.type=="show")}).fire("show")}n.menu.show();n.menu.layoutRect({w:n.layoutRect().w});n.menu.moveRel(n.getEl(),n.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])},hideMenu:function(){var n=this;if(n.menu){n.menu.items().each(function(o){if(o.hideMenu){o.hideMenu()}});n.menu.hide()}},activeMenu:function(n){this.toggleClass("active",n)},renderHtml:function(){var n=this,r=n._id,p=n.classPrefix;var o=n.settings.icon,q;q=n.settings.image;if(q){o="none";if(typeof q!="string"){q=window.getSelection?q[0]:q[1]}q=" style=\"background-image: url('"+q+"')\""}else{q=""}o=n.settings.icon?p+"ico "+p+"i-"+o:"";n.aria("role",n.parent() instanceof k?"menuitem":"button");return('
    ')},postRender:function(){var n=this;n.on("click",function(o){if(o.control===n&&i(o.target,n.getEl())){n.showMenu();if(o.aria){n.menu.items()[0].focus()}}});n.on("mouseenter",function(r){var o=r.control,q=n.parent(),p;if(o&&q&&o instanceof m&&o.parent()==q){q.items().filter("MenuButton").each(function(s){if(s.hideMenu&&s!=o){if(s.menu&&s.menu.visible()){p=true}s.hideMenu()}});if(p){o.focus();o.showMenu()}}});return n._super()},text:function(q){var n=this,p,o;if(n._rendered){o=n.getEl("open").getElementsByTagName("span");for(p=0;p0){p=k[0].text;l._value=k[0].value}n.menu=k}n.text=n.text||p||k[0].text;l._super(n);l.addClass("listbox");l.on("select",function(r){var q=r.control;if(j){r.lastControl=j}if(n.multiple){q.active(!q.active())}else{l.value(r.control.settings.value)}j=q})},value:function(l){var j=this,m,p,o;function n(r,q){r.items().each(function(s){m=s.value()===q;if(m){p=p||s.text()}s.active(m);if(s.menu){n(s.menu,q)}})}function k(q){for(var r=0;r'+(s!=="-"?'\u00a0":"")+(s!=="-"?''+s+"":"")+(p?'
    '+p+"
    ":"")+(o.menu?'
    ':"")+"")},postRender:function(){var m=this,n=m.settings;var o=n.textStyle;if(typeof o=="function"){o=o.call(this)}if(o){var l=m.getEl("text");if(l){l.setAttribute("style",o)}}m.on("mouseenter click",function(p){if(p.control===m){if(!n.menu&&p.type==="click"){m.fire("select");m.parent().hideAll()}else{m.showMenu();if(p.aria){m.menu.focus(true)}}}});m._super();return m},active:function(l){if(typeof l!="undefined"){this.aria("checked",l)}return this._super(l)},remove:function(){this._super();if(this.menu){this.menu.remove()}}})});h("tinymce/ui/Menu",["tinymce/ui/FloatPanel","tinymce/ui/MenuItem","tinymce/util/Tools"],function(l,k,i){var j=l.extend({Defaults:{defaultType:"menuitem",border:1,layout:"stack",role:"application",bodyRole:"menu",ariaRoot:true},init:function(p){var n=this;p.autohide=true;p.constrainToViewport=true;if(p.itemDefaults){var m=p.items,o=m.length;while(o--){m[o]=i.extend({},p.itemDefaults,m[o])}}n._super(p);n.addClass("menu")},repaint:function(){this.toggleClass("menu-align",true);this._super();this.getEl().style.height="";this.getEl("body").style.height="";return this},cancel:function(){var m=this;m.hideAll();m.fire("select")},hideAll:function(){var m=this;this.find("menuitem").exec("hideMenu");return m._super()},preRender:function(){var m=this;m.items().each(function(o){var n=o.settings;if(n.icon||n.selectable){m._hasIcons=true;return false}});return m._super()}});return j});h("tinymce/ui/Radio",["tinymce/ui/Checkbox"],function(i){return i.extend({Defaults:{classes:"radio",role:"radio"}})});h("tinymce/ui/ResizeHandle",["tinymce/ui/Widget","tinymce/ui/DragHelper"],function(j,i){return j.extend({renderHtml:function(){var k=this,l=k.classPrefix;k.addClass("resizehandle");if(k.settings.direction=="both"){k.addClass("resizehandle-both")}k.canFocus=false;return('
    ')},postRender:function(){var k=this;k._super();k.resizeDragHelper=new i(this._id,{start:function(){k.fire("ResizeStart")},drag:function(l){if(k.settings.direction!="both"){l.deltaX=0}k.fire("Resize",l)},stop:function(){k.fire("ResizeEnd")}})},remove:function(){if(this.resizeDragHelper){this.resizeDragHelper.destroy()}return this._super()}})});h("tinymce/ui/Spacer",["tinymce/ui/Widget"],function(i){return i.extend({renderHtml:function(){var j=this;j.addClass("spacer");j.canFocus=false;return'
    '}})});h("tinymce/ui/SplitButton",["tinymce/ui/MenuButton","tinymce/ui/DomUtils"],function(j,i){return j.extend({Defaults:{classes:"widget btn splitbtn",role:"button"},repaint:function(){var k=this,o=k.getEl(),m=k.layoutRect(),l,n;k._super();l=o.firstChild;n=o.lastChild;i.css(l,{width:m.w-i.getSize(n).width,height:m.h-2});i.css(n,{height:m.h-2});return k},activeMenu:function(l){var k=this;i.toggleClass(k.getEl().lastChild,k.classPrefix+"active",l)},renderHtml:function(){var k=this,o=k._id,m=k.classPrefix,n;var l=k.settings.icon;n=k.settings.image;if(n){l="none";if(typeof n!="string"){n=window.getSelection?n[0]:n[1]}n=" style=\"background-image: url('"+n+"')\""}else{n=""}l=k.settings.icon?m+"ico "+m+"i-"+l:"";return('
    ')},postRender:function(){var k=this,l=k.settings.onclick;k.on("click",function(n){var m=n.target;if(n.control==this){while(m){if((n.aria&&n.aria.key!="down")||(m.nodeName=="BUTTON"&&m.className.indexOf("open")==-1)){n.stopImmediatePropagation();l.call(this,n);return}m=m.parentNode}}});delete k.settings.onclick;return k._super()}})});h("tinymce/ui/StackLayout",["tinymce/ui/FlowLayout"],function(i){return i.extend({Defaults:{containerClass:"stack-layout",controlClass:"stack-layout-item",endClass:"break"}})});h("tinymce/ui/TabPanel",["tinymce/ui/Panel","tinymce/ui/DomUtils"],function(j,i){return j.extend({Defaults:{layout:"absolute",defaults:{type:"panel"}},activateTab:function(k){var l;if(this.activeTabId){l=this.getEl(this.activeTabId);i.removeClass(l,this.classPrefix+"active");l.setAttribute("aria-selected","false")}this.activeTabId="t"+k;l=this.getEl("t"+k);l.setAttribute("aria-selected","true");i.addClass(l,this.classPrefix+"active");this.items()[k].show().fire("showtab");this.reflow();this.items().each(function(n,m){if(k!=m){n.hide()}})},renderHtml:function(){var l=this,m=l._layout,k="",n=l.classPrefix;l.preRender();m.preRender(l);l.items().each(function(p,o){var q=l._id+"-t"+o;p.aria("role","tabpanel");p.aria("labelledby",q);k+=('")});return('
    '+k+'
    '+m.renderHtml(l)+"
    ")},postRender:function(){var k=this;k._super();k.settings.activeTab=k.settings.activeTab||0;k.activateTab(k.settings.activeTab);this.on("click",function(n){var m=n.target.parentNode;if(n.target.parentNode.id==k._id+"-head"){var l=m.childNodes.length;while(l--){if(m.childNodes[l]==n.target){k.activateTab(l)}}}})},initLayoutRect:function(){var l=this,o,k,n;k=i.getSize(l.getEl("head")).width;k=k<0?0:k;n=0;l.items().each(function(p){k=Math.max(k,p.layoutRect().minW);n=Math.max(n,p.layoutRect().minH)});l.items().each(function(p){p.settings.x=0;p.settings.y=0;p.settings.w=k;p.settings.h=n;p.layoutRect({x:0,y:0,w:k,h:n})});var m=i.getSize(l.getEl("head")).height;l.settings.minWidth=k;l.settings.minHeight=n+m;o=l._super();o.deltaH+=m;o.innerH=o.h-o.deltaH;return o}})});h("tinymce/ui/TextBox",["tinymce/ui/Widget","tinymce/ui/DomUtils"],function(j,i){return j.extend({init:function(l){var k=this;k._super(l);k._value=l.value||"";k.addClass("textbox");if(l.multiline){k.addClass("multiline")}else{k.on("keydown",function(m){if(m.keyCode==13){k.parents().reverse().each(function(n){m.preventDefault();if(n.hasEventListeners("submit")&&n.toJSON){n.fire("submit",{data:n.toJSON()});return false}})}})}},disabled:function(l){var k=this;if(k._rendered&&typeof l!="undefined"){k.getEl().disabled=l}return k._super(l)},value:function(l){var k=this;if(typeof l!="undefined"){k._value=l;if(k._rendered){k.getEl().value=l}return k}if(k._rendered){return k.getEl().value}return k._value},repaint:function(){var l=this,n,o,r,m=0,p=0,k;n=l.getEl().style;o=l._layoutRect;k=l._lastRepaintRect||{};var q=document;if(!l.settings.multiline&&q.all&&(!q.documentMode||q.documentMode<=8)){n.lineHeight=(o.h-p)+"px"}r=l._borderBox;m=r.left+r.right+8;p=r.top+r.bottom+(l.settings.multiline?8:0);if(o.x!==k.x){n.left=o.x+"px";k.x=o.x}if(o.y!==k.y){n.top=o.y+"px";k.y=o.y}if(o.w!==k.w){n.width=(o.w-m)+"px";k.w=o.w}if(o.h!==k.h){n.height=(o.h-p)+"px";k.h=o.h}l._lastRepaintRect=k;l.fire("repaint",{},false);return l},renderHtml:function(){var k=this,o=k._id,l=k.settings,n=k.encode(k._value,false),m="";if("spellcheck" in l){m+=' spellcheck="'+l.spellcheck+'"'}if(l.maxLength){m+=' maxlength="'+l.maxLength+'"'}if(l.size){m+=' size="'+l.size+'"'}if(l.subtype){m+=' type="'+l.subtype+'"'}if(k.disabled()){m+=' disabled="disabled"'}if(l.multiline){return('")}return'"},postRender:function(){var k=this;i.on(k.getEl(),"change",function(l){k.fire("change",l)});return k._super()},remove:function(){i.off(this.getEl());this._super()}})});h("tinymce/ui/Throbber",["tinymce/ui/DomUtils","tinymce/ui/Control"],function(i,j){return function(o,n){var l=this,m,k=j.classPrefix;l.show=function(p){l.hide();m=true;window.setTimeout(function(){if(m){o.appendChild(i.createFragment('
    '))}},p||0);return l};l.hide=function(){var p=o.lastChild;if(p&&p.className.indexOf("throbber")!=-1){p.parentNode.removeChild(p)}m=false;return l}}});a(["tinymce/dom/EventUtils","tinymce/dom/Sizzle","tinymce/Env","tinymce/util/Tools","tinymce/dom/DomQuery","tinymce/html/Styles","tinymce/dom/TreeWalker","tinymce/dom/Range","tinymce/html/Entities","tinymce/dom/DOMUtils","tinymce/dom/ScriptLoader","tinymce/AddOnManager","tinymce/dom/RangeUtils","tinymce/html/Node","tinymce/html/Schema","tinymce/html/SaxParser","tinymce/html/DomParser","tinymce/html/Writer","tinymce/html/Serializer","tinymce/dom/Serializer","tinymce/dom/TridentSelection","tinymce/util/VK","tinymce/dom/ControlSelection","tinymce/dom/BookmarkManager","tinymce/dom/Selection","tinymce/dom/ElementUtils","tinymce/Formatter","tinymce/UndoManager","tinymce/EnterKey","tinymce/ForceBlocks","tinymce/EditorCommands","tinymce/util/URI","tinymce/util/Class","tinymce/util/EventDispatcher","tinymce/ui/Selector","tinymce/ui/Collection","tinymce/ui/DomUtils","tinymce/ui/Control","tinymce/ui/Factory","tinymce/ui/KeyboardNavigation","tinymce/ui/Container","tinymce/ui/DragHelper","tinymce/ui/Scrollable","tinymce/ui/Panel","tinymce/ui/Movable","tinymce/ui/Resizable","tinymce/ui/FloatPanel","tinymce/ui/Window","tinymce/ui/MessageBox","tinymce/WindowManager","tinymce/util/Quirks","tinymce/util/Observable","tinymce/EditorObservable","tinymce/Shortcuts","tinymce/Editor","tinymce/util/I18n","tinymce/FocusManager","tinymce/EditorManager","tinymce/LegacyInput","tinymce/util/XHR","tinymce/util/JSON","tinymce/util/JSONRequest","tinymce/util/JSONP","tinymce/util/LocalStorage","tinymce/Compat","tinymce/ui/Layout","tinymce/ui/AbsoluteLayout","tinymce/ui/Tooltip","tinymce/ui/Widget","tinymce/ui/Button","tinymce/ui/ButtonGroup","tinymce/ui/Checkbox","tinymce/ui/ComboBox","tinymce/ui/ColorBox","tinymce/ui/PanelButton","tinymce/ui/ColorButton","tinymce/util/Color","tinymce/ui/ColorPicker","tinymce/ui/Path","tinymce/ui/ElementPath","tinymce/ui/FormItem","tinymce/ui/Form","tinymce/ui/FieldSet","tinymce/ui/FilePicker","tinymce/ui/FitLayout","tinymce/ui/FlexLayout","tinymce/ui/FlowLayout","tinymce/ui/FormatControls","tinymce/ui/GridLayout","tinymce/ui/Iframe","tinymce/ui/Label","tinymce/ui/Toolbar","tinymce/ui/MenuBar","tinymce/ui/MenuButton","tinymce/ui/ListBox","tinymce/ui/MenuItem","tinymce/ui/Menu","tinymce/ui/Radio","tinymce/ui/ResizeHandle","tinymce/ui/Spacer","tinymce/ui/SplitButton","tinymce/ui/StackLayout","tinymce/ui/TabPanel","tinymce/ui/TextBox","tinymce/ui/Throbber"])})(this); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/tinymce.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/tinymce.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,38265 @@ +// 4.1.10 (2015-05-05) + +/** + * Compiled inline version. (Library mode) + */ + +/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */ +/*globals $code */ + +(function(exports, undefined) { + "use strict"; + + var modules = {}; + + function require(ids, callback) { + var module, defs = []; + + for (var i = 0; i < ids.length; ++i) { + module = modules[ids[i]] || resolve(ids[i]); + if (!module) { + throw 'module definition dependecy not found: ' + ids[i]; + } + + defs.push(module); + } + + callback.apply(null, defs); + } + + function define(id, dependencies, definition) { + if (typeof id !== 'string') { + throw 'invalid module definition, module id must be defined and be a string'; + } + + if (dependencies === undefined) { + throw 'invalid module definition, dependencies must be specified'; + } + + if (definition === undefined) { + throw 'invalid module definition, definition function must be specified'; + } + + require(dependencies, function() { + modules[id] = definition.apply(null, arguments); + }); + } + + function defined(id) { + return !!modules[id]; + } + + function resolve(id) { + var target = exports; + var fragments = id.split(/[.\/]/); + + for (var fi = 0; fi < fragments.length; ++fi) { + if (!target[fragments[fi]]) { + return; + } + + target = target[fragments[fi]]; + } + + return target; + } + + function expose(ids) { + for (var i = 0; i < ids.length; i++) { + var target = exports; + var id = ids[i]; + var fragments = id.split(/[.\/]/); + + for (var fi = 0; fi < fragments.length - 1; ++fi) { + if (target[fragments[fi]] === undefined) { + target[fragments[fi]] = {}; + } + + target = target[fragments[fi]]; + } + + target[fragments[fragments.length - 1]] = modules[id]; + } + } + +// Included from: js/tinymce/classes/dom/EventUtils.js + +/** + * EventUtils.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*jshint loopfunc:true*/ +/*eslint no-loop-func:0 */ + +/** + * This class wraps the browsers native event logic with more convenient methods. + * + * @class tinymce.dom.EventUtils + */ +define("tinymce/dom/EventUtils", [], function() { + "use strict"; + + var eventExpandoPrefix = "mce-data-"; + var mouseEventRe = /^(?:mouse|contextmenu)|click/; + var deprecated = {keyLocation: 1, layerX: 1, layerY: 1, returnValue: 1}; + + /** + * Binds a native event to a callback on the speified target. + */ + function addEvent(target, name, callback, capture) { + if (target.addEventListener) { + target.addEventListener(name, callback, capture || false); + } else if (target.attachEvent) { + target.attachEvent('on' + name, callback); + } + } + + /** + * Unbinds a native event callback on the specified target. + */ + function removeEvent(target, name, callback, capture) { + if (target.removeEventListener) { + target.removeEventListener(name, callback, capture || false); + } else if (target.detachEvent) { + target.detachEvent('on' + name, callback); + } + } + + /** + * Normalizes a native event object or just adds the event specific methods on a custom event. + */ + function fix(originalEvent, data) { + var name, event = data || {}, undef; + + // Dummy function that gets replaced on the delegation state functions + function returnFalse() { + return false; + } + + // Dummy function that gets replaced on the delegation state functions + function returnTrue() { + return true; + } + + // Copy all properties from the original event + for (name in originalEvent) { + // layerX/layerY is deprecated in Chrome and produces a warning + if (!deprecated[name]) { + event[name] = originalEvent[name]; + } + } + + // Normalize target IE uses srcElement + if (!event.target) { + event.target = event.srcElement || document; + } + + // Calculate pageX/Y if missing and clientX/Y available + if (originalEvent && mouseEventRe.test(originalEvent.type) && originalEvent.pageX === undef && originalEvent.clientX !== undef) { + var eventDoc = event.target.ownerDocument || document; + var doc = eventDoc.documentElement; + var body = eventDoc.body; + + event.pageX = originalEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - + (doc && doc.clientLeft || body && body.clientLeft || 0); + + event.pageY = originalEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - + (doc && doc.clientTop || body && body.clientTop || 0); + } + + // Add preventDefault method + event.preventDefault = function() { + event.isDefaultPrevented = returnTrue; + + // Execute preventDefault on the original event object + if (originalEvent) { + if (originalEvent.preventDefault) { + originalEvent.preventDefault(); + } else { + originalEvent.returnValue = false; // IE + } + } + }; + + // Add stopPropagation + event.stopPropagation = function() { + event.isPropagationStopped = returnTrue; + + // Execute stopPropagation on the original event object + if (originalEvent) { + if (originalEvent.stopPropagation) { + originalEvent.stopPropagation(); + } else { + originalEvent.cancelBubble = true; // IE + } + } + }; + + // Add stopImmediatePropagation + event.stopImmediatePropagation = function() { + event.isImmediatePropagationStopped = returnTrue; + event.stopPropagation(); + }; + + // Add event delegation states + if (!event.isDefaultPrevented) { + event.isDefaultPrevented = returnFalse; + event.isPropagationStopped = returnFalse; + event.isImmediatePropagationStopped = returnFalse; + } + + return event; + } + + /** + * Bind a DOMContentLoaded event across browsers and executes the callback once the page DOM is initialized. + * It will also set/check the domLoaded state of the event_utils instance so ready isn't called multiple times. + */ + function bindOnReady(win, callback, eventUtils) { + var doc = win.document, event = {type: 'ready'}; + + if (eventUtils.domLoaded) { + callback(event); + return; + } + + // Gets called when the DOM is ready + function readyHandler() { + if (!eventUtils.domLoaded) { + eventUtils.domLoaded = true; + callback(event); + } + } + + function waitForDomLoaded() { + // Check complete or interactive state if there is a body + // element on some iframes IE 8 will produce a null body + if (doc.readyState === "complete" || (doc.readyState === "interactive" && doc.body)) { + removeEvent(doc, "readystatechange", waitForDomLoaded); + readyHandler(); + } + } + + function tryScroll() { + try { + // If IE is used, use the trick by Diego Perini licensed under MIT by request to the author. + // http://javascript.nwbox.com/IEContentLoaded/ + doc.documentElement.doScroll("left"); + } catch (ex) { + setTimeout(tryScroll, 0); + return; + } + + readyHandler(); + } + + // Use W3C method + if (doc.addEventListener) { + if (doc.readyState === "complete") { + readyHandler(); + } else { + addEvent(win, 'DOMContentLoaded', readyHandler); + } + } else { + // Use IE method + addEvent(doc, "readystatechange", waitForDomLoaded); + + // Wait until we can scroll, when we can the DOM is initialized + if (doc.documentElement.doScroll && win.self === win.top) { + tryScroll(); + } + } + + // Fallback if any of the above methods should fail for some odd reason + addEvent(win, 'load', readyHandler); + } + + /** + * This class enables you to bind/unbind native events to elements and normalize it's behavior across browsers. + */ + function EventUtils() { + var self = this, events = {}, count, expando, hasFocusIn, hasMouseEnterLeave, mouseEnterLeave; + + expando = eventExpandoPrefix + (+new Date()).toString(32); + hasMouseEnterLeave = "onmouseenter" in document.documentElement; + hasFocusIn = "onfocusin" in document.documentElement; + mouseEnterLeave = {mouseenter: 'mouseover', mouseleave: 'mouseout'}; + count = 1; + + // State if the DOMContentLoaded was executed or not + self.domLoaded = false; + self.events = events; + + /** + * Executes all event handler callbacks for a specific event. + * + * @private + * @param {Event} evt Event object. + * @param {String} id Expando id value to look for. + */ + function executeHandlers(evt, id) { + var callbackList, i, l, callback, container = events[id]; + + callbackList = container && container[evt.type]; + if (callbackList) { + for (i = 0, l = callbackList.length; i < l; i++) { + callback = callbackList[i]; + + // Check if callback exists might be removed if a unbind is called inside the callback + if (callback && callback.func.call(callback.scope, evt) === false) { + evt.preventDefault(); + } + + // Should we stop propagation to immediate listeners + if (evt.isImmediatePropagationStopped()) { + return; + } + } + } + } + + /** + * Binds a callback to an event on the specified target. + * + * @method bind + * @param {Object} target Target node/window or custom object. + * @param {String} names Name of the event to bind. + * @param {function} callback Callback function to execute when the event occurs. + * @param {Object} scope Scope to call the callback function on, defaults to target. + * @return {function} Callback function that got bound. + */ + self.bind = function(target, names, callback, scope) { + var id, callbackList, i, name, fakeName, nativeHandler, capture, win = window; + + // Native event handler function patches the event and executes the callbacks for the expando + function defaultNativeHandler(evt) { + executeHandlers(fix(evt || win.event), id); + } + + // Don't bind to text nodes or comments + if (!target || target.nodeType === 3 || target.nodeType === 8) { + return; + } + + // Create or get events id for the target + if (!target[expando]) { + id = count++; + target[expando] = id; + events[id] = {}; + } else { + id = target[expando]; + } + + // Setup the specified scope or use the target as a default + scope = scope || target; + + // Split names and bind each event, enables you to bind multiple events with one call + names = names.split(' '); + i = names.length; + while (i--) { + name = names[i]; + nativeHandler = defaultNativeHandler; + fakeName = capture = false; + + // Use ready instead of DOMContentLoaded + if (name === "DOMContentLoaded") { + name = "ready"; + } + + // DOM is already ready + if (self.domLoaded && name === "ready" && target.readyState == 'complete') { + callback.call(scope, fix({type: name})); + continue; + } + + // Handle mouseenter/mouseleaver + if (!hasMouseEnterLeave) { + fakeName = mouseEnterLeave[name]; + + if (fakeName) { + nativeHandler = function(evt) { + var current, related; + + current = evt.currentTarget; + related = evt.relatedTarget; + + // Check if related is inside the current target if it's not then the event should + // be ignored since it's a mouseover/mouseout inside the element + if (related && current.contains) { + // Use contains for performance + related = current.contains(related); + } else { + while (related && related !== current) { + related = related.parentNode; + } + } + + // Fire fake event + if (!related) { + evt = fix(evt || win.event); + evt.type = evt.type === 'mouseout' ? 'mouseleave' : 'mouseenter'; + evt.target = current; + executeHandlers(evt, id); + } + }; + } + } + + // Fake bubbeling of focusin/focusout + if (!hasFocusIn && (name === "focusin" || name === "focusout")) { + capture = true; + fakeName = name === "focusin" ? "focus" : "blur"; + nativeHandler = function(evt) { + evt = fix(evt || win.event); + evt.type = evt.type === 'focus' ? 'focusin' : 'focusout'; + executeHandlers(evt, id); + }; + } + + // Setup callback list and bind native event + callbackList = events[id][name]; + if (!callbackList) { + events[id][name] = callbackList = [{func: callback, scope: scope}]; + callbackList.fakeName = fakeName; + callbackList.capture = capture; + //callbackList.callback = callback; + + // Add the nativeHandler to the callback list so that we can later unbind it + callbackList.nativeHandler = nativeHandler; + + // Check if the target has native events support + + if (name === "ready") { + bindOnReady(target, nativeHandler, self); + } else { + addEvent(target, fakeName || name, nativeHandler, capture); + } + } else { + if (name === "ready" && self.domLoaded) { + callback({type: name}); + } else { + // If it already has an native handler then just push the callback + callbackList.push({func: callback, scope: scope}); + } + } + } + + target = callbackList = 0; // Clean memory for IE + + return callback; + }; + + /** + * Unbinds the specified event by name, name and callback or all events on the target. + * + * @method unbind + * @param {Object} target Target node/window or custom object. + * @param {String} names Optional event name to unbind. + * @param {function} callback Optional callback function to unbind. + * @return {EventUtils} Event utils instance. + */ + self.unbind = function(target, names, callback) { + var id, callbackList, i, ci, name, eventMap; + + // Don't bind to text nodes or comments + if (!target || target.nodeType === 3 || target.nodeType === 8) { + return self; + } + + // Unbind event or events if the target has the expando + id = target[expando]; + if (id) { + eventMap = events[id]; + + // Specific callback + if (names) { + names = names.split(' '); + i = names.length; + while (i--) { + name = names[i]; + callbackList = eventMap[name]; + + // Unbind the event if it exists in the map + if (callbackList) { + // Remove specified callback + if (callback) { + ci = callbackList.length; + while (ci--) { + if (callbackList[ci].func === callback) { + var nativeHandler = callbackList.nativeHandler; + var fakeName = callbackList.fakeName, capture = callbackList.capture; + + // Clone callbackList since unbind inside a callback would otherwise break the handlers loop + callbackList = callbackList.slice(0, ci).concat(callbackList.slice(ci + 1)); + callbackList.nativeHandler = nativeHandler; + callbackList.fakeName = fakeName; + callbackList.capture = capture; + + eventMap[name] = callbackList; + } + } + } + + // Remove all callbacks if there isn't a specified callback or there is no callbacks left + if (!callback || callbackList.length === 0) { + delete eventMap[name]; + removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture); + } + } + } + } else { + // All events for a specific element + for (name in eventMap) { + callbackList = eventMap[name]; + removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture); + } + + eventMap = {}; + } + + // Check if object is empty, if it isn't then we won't remove the expando map + for (name in eventMap) { + return self; + } + + // Delete event object + delete events[id]; + + // Remove expando from target + try { + // IE will fail here since it can't delete properties from window + delete target[expando]; + } catch (ex) { + // IE will set it to null + target[expando] = null; + } + } + + return self; + }; + + /** + * Fires the specified event on the specified target. + * + * @method fire + * @param {Object} target Target node/window or custom object. + * @param {String} name Event name to fire. + * @param {Object} args Optional arguments to send to the observers. + * @return {EventUtils} Event utils instance. + */ + self.fire = function(target, name, args) { + var id; + + // Don't bind to text nodes or comments + if (!target || target.nodeType === 3 || target.nodeType === 8) { + return self; + } + + // Build event object by patching the args + args = fix(null, args); + args.type = name; + args.target = target; + + do { + // Found an expando that means there is listeners to execute + id = target[expando]; + if (id) { + executeHandlers(args, id); + } + + // Walk up the DOM + target = target.parentNode || target.ownerDocument || target.defaultView || target.parentWindow; + } while (target && !args.isPropagationStopped()); + + return self; + }; + + /** + * Removes all bound event listeners for the specified target. This will also remove any bound + * listeners to child nodes within that target. + * + * @method clean + * @param {Object} target Target node/window object. + * @return {EventUtils} Event utils instance. + */ + self.clean = function(target) { + var i, children, unbind = self.unbind; + + // Don't bind to text nodes or comments + if (!target || target.nodeType === 3 || target.nodeType === 8) { + return self; + } + + // Unbind any element on the specificed target + if (target[expando]) { + unbind(target); + } + + // Target doesn't have getElementsByTagName it's probably a window object then use it's document to find the children + if (!target.getElementsByTagName) { + target = target.document; + } + + // Remove events from each child element + if (target && target.getElementsByTagName) { + unbind(target); + + children = target.getElementsByTagName('*'); + i = children.length; + while (i--) { + target = children[i]; + + if (target[expando]) { + unbind(target); + } + } + } + + return self; + }; + + /** + * Destroys the event object. Call this on IE to remove memory leaks. + */ + self.destroy = function() { + events = {}; + }; + + // Legacy function for canceling events + self.cancel = function(e) { + if (e) { + e.preventDefault(); + e.stopImmediatePropagation(); + } + + return false; + }; + } + + EventUtils.Event = new EventUtils(); + EventUtils.Event.bind(window, 'ready', function() {}); + + return EventUtils; +}); + +// Included from: js/tinymce/classes/dom/Sizzle.js + +/** + * Sizzle.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + * + * @ignore-file + */ + +/*jshint bitwise:false, expr:true, noempty:false, sub:true, eqnull:true, latedef:false, maxlen:255 */ +/*eslint dot-notation:0, no-empty:0, no-cond-assign:0, no-unused-expressions:0, new-cap:0 */ +/*eslint no-nested-ternary:0, func-style:0, no-bitwise:0, max-len:0, brace-style:0, no-return-assign:0, no-multi-spaces:0 */ + +/** + * Sizzle CSS Selector Engine v@VERSION + * http://sizzlejs.com/ + * + * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: @DATE + */ +define("tinymce/dom/Sizzle", [], function() { +var i, + support, + Expr, + getText, + isXML, + tokenize, + compile, + select, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + -(new Date()), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + // General-purpose constants + strundefined = typeof undefined, + MAX_NEGATIVE = 1 << 31, + + // Instance methods + hasOwn = ({}).hasOwnProperty, + arr = [], + pop = arr.pop, + push_native = arr.push, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf if we can't use a native one + indexOf = arr.indexOf || function( elem ) { + var i = 0, + len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + + // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", + + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + + "*\\]", + + pseudos = ":(" + identifier + ")(?:\\((" + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), + + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + identifier + ")" ), + "CLASS": new RegExp( "^\\.(" + identifier + ")" ), + "TAG": new RegExp( "^(" + identifier + "|[*])" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + rescape = /'|\\/g, + + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox<24 + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + high < 0 ? + // BMP codepoint + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }; + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var match, elem, m, nodeType, + // QSA vars + i, groups, old, nid, newContext, newSelector; + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + + context = context || document; + results = results || []; + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { + return []; + } + + if ( documentIsHTML && !seed ) { + + // Shortcuts + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document (jQuery #6963) + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && support.getElementsByClassName ) { + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // QSA path + if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + nid = old = expando; + newContext = context; + newSelector = nodeType === 9 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + toSelector( groups[i] ); + } + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {Function(string, Object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key + " " ] = value); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created div and expects a boolean result + */ +function assert( fn ) { + var div = document.createElement("div"); + + try { + return !!fn( div ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( div.parentNode ) { + div.parentNode.removeChild( div ); + } + // release memory in IE + div = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = attrs.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + ( ~b.sourceIndex || MAX_NEGATIVE ) - + ( ~a.sourceIndex || MAX_NEGATIVE ); + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */ +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Checks a node for validity as a Sizzle context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */ +function testContext( context ) { + return context && typeof context.getElementsByTagName !== strundefined && context; +} + +// Expose support vars for convenience +support = Sizzle.support = {}; + +/** + * Detects XML nodes + * @param {Element|Object} elem An element or a document + * @returns {Boolean} True iff elem is a non-HTML XML node + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var hasCompare, + doc = node ? node.ownerDocument || node : preferredDoc, + parent = doc.defaultView; + + // If no document and documentElement is available, return + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Set our document + document = doc; + docElem = doc.documentElement; + + // Support tests + documentIsHTML = !isXML( doc ); + + // Support: IE>8 + // If iframe document is assigned to "document" variable and if iframe has been reloaded, + // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 + // IE6-8 do not support the defaultView property so parent will be undefined + if ( parent && parent !== parent.top ) { + // IE11 does not have attachEvent, so all must suffer + if ( parent.addEventListener ) { + parent.addEventListener( "unload", function() { + setDocument(); + }, false ); + } else if ( parent.attachEvent ) { + parent.attachEvent( "onunload", function() { + setDocument(); + }); + } + } + + /* Attributes + ---------------------------------------------------------------------- */ + + // Support: IE<8 + // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) + support.attributes = assert(function( div ) { + div.className = "i"; + return !div.getAttribute("className"); + }); + + /* getElement(s)By* + ---------------------------------------------------------------------- */ + + // Check if getElementsByTagName("*") returns only elements + support.getElementsByTagName = assert(function( div ) { + div.appendChild( doc.createComment("") ); + return !div.getElementsByTagName("*").length; + }); + + // Support: IE<9 + support.getElementsByClassName = rnative.test( doc.getElementsByClassName ); + + // Support: IE<10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert(function( div ) { + docElem.appendChild( div ).id = expando; + return !doc.getElementsByName || !doc.getElementsByName( expando ).length; + }); + + // ID find and filter + if ( support.getById ) { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && documentIsHTML ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [ m ] : []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + } else { + // Support: IE6/7 + // getElementById is not reliable as a find shortcut + delete Expr.find["ID"]; + + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + } + + // Tag + Expr.find["TAG"] = support.getElementsByTagName ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var elem, + tmp = [], + i = 0, + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( (elem = results[i++]) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Class + Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { + if ( documentIsHTML ) { + return context.getElementsByClassName( className ); + } + }; + + /* QSA/matchesSelector + ---------------------------------------------------------------------- */ + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21) + // We allow this because of a bug in IE8/9 that throws an error + // whenever `document.activeElement` is accessed on an iframe + // So, we allow :focus to pass through QSA all the time to avoid the IE error + // See http://bugs.jquery.com/ticket/13378 + rbuggyQSA = []; + + if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explicitly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = ""; + + // Support: IE8, Opera 11-12.16 + // Nothing should be selected when empty strings follow ^= or $= or *= + // The test attribute must be unknown in Opera but "safe" for WinRT + // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( div.querySelectorAll("[msallowcapture^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + } + + // Support: IE8 + // Boolean attributes and "value" are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + }); + + assert(function( div ) { + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + var input = doc.createElement("input"); + input.setAttribute( "type", "hidden" ); + div.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE8 + // Enforce case-sensitivity of name attribute + if ( div.querySelectorAll("[name=d]").length ) { + rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + div.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || + docElem.webkitMatchesSelector || + docElem.mozMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( div, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); + + /* Contains + ---------------------------------------------------------------------- */ + hasCompare = rnative.test( docElem.compareDocumentPosition ); + + // Element contains another + // Purposefully does not implement inclusive descendent + // As in, an element does not contain itself + contains = hasCompare || rnative.test( docElem.contains ) ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + /* Sorting + ---------------------------------------------------------------------- */ + + // Document order sorting + sortOrder = hasCompare ? + function( a, b ) { + + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if ( compare ) { + return compare; + } + + // Calculate position if both inputs belong to the same document + compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : + + // Otherwise we know they are disconnected + 1; + + // Disconnected nodes + if ( compare & 1 || + (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { + + // Choose the first element that is related to our preferred document + if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { + return -1; + } + if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + } : + function( a, b ) { + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Parentless nodes are either documents or disconnected + if ( !aup || !bup ) { + return a === doc ? -1 : + b === doc ? 1 : + aup ? -1 : + bup ? 1 : + sortInput ? + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + return doc; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + if ( support.matchesSelector && documentIsHTML && + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch(e) {} + } + + return Sizzle( expr, document, null, [ elem ] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ], + // Don't get fooled by Object.prototype properties (jQuery #13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + return val !== undefined ? + val : + support.attributes || !documentIsHTML ? + elem.getAttribute( name ) : + (val = elem.getAttributeNode(name)) && val.specified ? + val.value : + null; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + j = 0, + i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice( 0 ); + results.sort( sortOrder ); + + if ( hasDuplicate ) { + while ( (elem = results[i++]) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; +}; + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + while ( (node = elem[i++]) ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (jQuery #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[6] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[3] ) { + match[2] = match[4] || match[5] || ""; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeNameSelector ) { + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === "*" ? + function() { return true; } : + function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, outerCache, node, diff, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + // Seek `elem` from a previously-cached index + outerCache = parent[ expando ] || (parent[ expando ] = {}); + cache = outerCache[ type ] || []; + nodeIndex = cache[0] === dirruns && cache[1]; + diff = cache[0] === dirruns && cache[2]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + // Use previously-cached element index if available + } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { + diff = cache[1]; + + // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) + } else { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { + // Cache the index of each encountered element + if ( useCache ) { + (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + text = text.replace( runescape, funescape ); + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifier + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeType < 6 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + + // Support: IE<8 + // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + +tokenize = Sizzle.tokenize = function( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( (tokens = []) ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push({ + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + }); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push({ + value: matched, + type: type, + matches: match + }); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +}; + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var oldCache, outerCache, + newCache = [ dirruns, doneName ]; + + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + if ( (oldCache = outerCache[ dir ]) && + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { + + // Assign to newCache so results back-propagate to previous elements + return (newCache[ 2 ] = oldCache[ 2 ]); + } else { + // Reuse newcache so results back-propagate to previous elements + outerCache[ dir ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { + return true; + } + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) + ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, outermost ) { + var elem, j, matcher, + matchedCount = 0, + i = "0", + unmatched = seed && [], + setMatched = [], + contextBackup = outermostContext, + // We must always have either seed elements or outermost context + elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), + len = elems.length; + + if ( outermost ) { + outermostContext = context !== document && context; + } + + // Add elements passing elementMatchers directly to results + // Keep `i` a string if there are no elements so `matchedCount` will be "00" below + // Support: IE<9, Safari + // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id + for ( ; i !== len && (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !match ) { + match = tokenize( selector ); + } + i = match.length; + while ( i-- ) { + cached = matcherFromTokens( match[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + + // Save selector and tokenization + cached.selector = selector; + } + return cached; +}; + +/** + * A low-level selection function that works with Sizzle's compiled + * selector functions + * @param {String|Function} selector A selector or a pre-compiled + * selector function built with Sizzle.compile + * @param {Element} context + * @param {Array} [results] + * @param {Array} [seed] A set of elements to match against + */ +select = Sizzle.select = function( selector, context, results, seed ) { + var i, tokens, token, type, find, + compiled = typeof selector === "function" && selector, + match = !seed && tokenize( (selector = compiled.selector || selector) ); + + results = results || []; + + // Try to minimize operations if there is no seed and only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + support.getById && context.nodeType === 9 && documentIsHTML && + Expr.relative[ tokens[1].type ] ) { + + context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; + if ( !context ) { + return results; + + // Precompiled matchers will still verify ancestry, so step up a level + } else if ( compiled ) { + context = context.parentNode; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + + // Compile and execute a filtering function if one is not provided + // Provide `match` to avoid retokenization if we modified the selector above + ( compiled || compile( selector, match ) )( + seed, + context, + !documentIsHTML, + results, + rsibling.test( selector ) && testContext( context.parentNode ) || context + ); + return results; +}; + +// One-time assignments + +// Sort stability +support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; + +// Support: Chrome 14-35+ +// Always assume duplicates if they aren't passed to the comparison function +support.detectDuplicates = !!hasDuplicate; + +// Initialize against the default document +setDocument(); + +// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Detached nodes confoundingly follow *each other* +support.sortDetached = assert(function( div1 ) { + // Should return 1, but returns 4 (following) + return div1.compareDocumentPosition( document.createElement("div") ) & 1; +}); + +// Support: IE<8 +// Prevent attribute/property "interpolation" +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert(function( div ) { + div.innerHTML = ""; + return div.firstChild.getAttribute("href") === "#" ; +}) ) { + addHandle( "type|href|height|width", function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); + } + }); +} + +// Support: IE<9 +// Use defaultValue in place of getAttribute("value") +if ( !support.attributes || !assert(function( div ) { + div.innerHTML = ""; + div.firstChild.setAttribute( "value", "" ); + return div.firstChild.getAttribute( "value" ) === ""; +}) ) { + addHandle( "value", function( elem, name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { + return elem.defaultValue; + } + }); +} + +// Support: IE<9 +// Use getAttributeNode to fetch booleans when getAttribute lies +if ( !assert(function( div ) { + return div.getAttribute("disabled") == null; +}) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return elem[ name ] === true ? name.toLowerCase() : + (val = elem.getAttributeNode( name )) && val.specified ? + val.value : + null; + } + }); +} + +// EXPOSE +return Sizzle; +}); + +// Included from: js/tinymce/classes/Env.js + +/** + * Env.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class contains various environment constants like browser versions etc. + * Normally you don't want to sniff specific browser versions but sometimes you have + * to when it's impossible to feature detect. So use this with care. + * + * @class tinymce.Env + * @static + */ +define("tinymce/Env", [], function() { + var nav = navigator, userAgent = nav.userAgent; + var opera, webkit, ie, ie11, ie12, gecko, mac, iDevice, android; + + opera = window.opera && window.opera.buildNumber; + android = /Android/.test(userAgent); + webkit = /WebKit/.test(userAgent); + ie = !webkit && !opera && (/MSIE/gi).test(userAgent) && (/Explorer/gi).test(nav.appName); + ie = ie && /MSIE (\w+)\./.exec(userAgent)[1]; + ie11 = userAgent.indexOf('Trident/') != -1 && (userAgent.indexOf('rv:') != -1 || nav.appName.indexOf('Netscape') != -1) ? 11 : false; + ie12 = (document.msElementsFromPoint && !ie && !ie11) ? 12 : false; + ie = ie || ie11 || ie12; + gecko = !webkit && !ie11 && /Gecko/.test(userAgent); + mac = userAgent.indexOf('Mac') != -1; + iDevice = /(iPad|iPhone)/.test(userAgent); + + if (ie12) { + webkit = false; + } + + // Is a iPad/iPhone and not on iOS5 sniff the WebKit version since older iOS WebKit versions + // says it has contentEditable support but there is no visible caret. + var contentEditable = !iDevice || userAgent.match(/AppleWebKit\/(\d*)/)[1] >= 534; + + return { + /** + * Constant that is true if the browser is Opera. + * + * @property opera + * @type Boolean + * @final + */ + opera: opera, + + /** + * Constant that is true if the browser is WebKit (Safari/Chrome). + * + * @property webKit + * @type Boolean + * @final + */ + webkit: webkit, + + /** + * Constant that is more than zero if the browser is IE. + * + * @property ie + * @type Boolean + * @final + */ + ie: ie, + + /** + * Constant that is true if the browser is Gecko. + * + * @property gecko + * @type Boolean + * @final + */ + gecko: gecko, + + /** + * Constant that is true if the os is Mac OS. + * + * @property mac + * @type Boolean + * @final + */ + mac: mac, + + /** + * Constant that is true if the os is iOS. + * + * @property iOS + * @type Boolean + * @final + */ + iOS: iDevice, + + /** + * Constant that is true if the os is android. + * + * @property android + * @type Boolean + * @final + */ + android: android, + + /** + * Constant that is true if the browser supports editing. + * + * @property contentEditable + * @type Boolean + * @final + */ + contentEditable: contentEditable, + + /** + * Transparent image data url. + * + * @property transparentSrc + * @type Boolean + * @final + */ + transparentSrc: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", + + /** + * Returns true/false if the browser can or can't place the caret after a inline block like an image. + * + * @property noCaretAfter + * @type Boolean + * @final + */ + caretAfter: ie != 8, + + /** + * Constant that is true if the browser supports native DOM Ranges. IE 9+. + * + * @property range + * @type Boolean + */ + range: window.getSelection && "Range" in window, + + /** + * Returns the IE document mode for non IE browsers this will fake IE 10. + * + * @property documentMode + * @type Number + */ + documentMode: ie && !ie12 ? (document.documentMode || 7) : 10 + }; +}); + +// Included from: js/tinymce/classes/util/Tools.js + +/** + * Tools.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class contains various utlity functions. These are also exposed + * directly on the tinymce namespace. + * + * @class tinymce.util.Tools + */ +define("tinymce/util/Tools", [ + "tinymce/Env" +], function(Env) { + /** + * Removes whitespace from the beginning and end of a string. + * + * @method trim + * @param {String} s String to remove whitespace from. + * @return {String} New string with removed whitespace. + */ + var whiteSpaceRegExp = /^\s*|\s*$/g; + + function trim(str) { + return (str === null || str === undefined) ? '' : ("" + str).replace(whiteSpaceRegExp, ''); + } + + /** + * Returns true/false if the object is an array or not. + * + * @method isArray + * @param {Object} obj Object to check. + * @return {boolean} true/false state if the object is an array or not. + */ + var isArray = Array.isArray || function(obj) { + return Object.prototype.toString.call(obj) === "[object Array]"; + }; + + /** + * Checks if a object is of a specific type for example an array. + * + * @method is + * @param {Object} obj Object to check type of. + * @param {string} type Optional type to check for. + * @return {Boolean} true/false if the object is of the specified type. + */ + function is(obj, type) { + if (!type) { + return obj !== undefined; + } + + if (type == 'array' && isArray(obj)) { + return true; + } + + return typeof obj == type; + } + + /** + * Converts the specified object into a real JavaScript array. + * + * @method toArray + * @param {Object} obj Object to convert into array. + * @return {Array} Array object based in input. + */ + function toArray(obj) { + var array = obj, i, l; + + if (!isArray(obj)) { + array = []; + for (i = 0, l = obj.length; i < l; i++) { + array[i] = obj[i]; + } + } + + return array; + } + + /** + * Makes a name/object map out of an array with names. + * + * @method makeMap + * @param {Array/String} items Items to make map out of. + * @param {String} delim Optional delimiter to split string by. + * @param {Object} map Optional map to add items to. + * @return {Object} Name/value map of items. + */ + function makeMap(items, delim, map) { + var i; + + items = items || []; + delim = delim || ','; + + if (typeof items == "string") { + items = items.split(delim); + } + + map = map || {}; + + i = items.length; + while (i--) { + map[items[i]] = {}; + } + + return map; + } + + /** + * Performs an iteration of all items in a collection such as an object or array. This method will execure the + * callback function for each item in the collection, if the callback returns false the iteration will terminate. + * The callback has the following format: cb(value, key_or_index). + * + * @method each + * @param {Object} o Collection to iterate. + * @param {function} cb Callback function to execute for each item. + * @param {Object} s Optional scope to execute the callback in. + * @example + * // Iterate an array + * tinymce.each([1,2,3], function(v, i) { + * console.debug("Value: " + v + ", Index: " + i); + * }); + * + * // Iterate an object + * tinymce.each({a: 1, b: 2, c: 3], function(v, k) { + * console.debug("Value: " + v + ", Key: " + k); + * }); + */ + function each(o, cb, s) { + var n, l; + + if (!o) { + return 0; + } + + s = s || o; + + if (o.length !== undefined) { + // Indexed arrays, needed for Safari + for (n = 0, l = o.length; n < l; n++) { + if (cb.call(s, o[n], n, o) === false) { + return 0; + } + } + } else { + // Hashtables + for (n in o) { + if (o.hasOwnProperty(n)) { + if (cb.call(s, o[n], n, o) === false) { + return 0; + } + } + } + } + + return 1; + } + + /** + * Creates a new array by the return value of each iteration function call. This enables you to convert + * one array list into another. + * + * @method map + * @param {Array} array Array of items to iterate. + * @param {function} callback Function to call for each item. It's return value will be the new value. + * @return {Array} Array with new values based on function return values. + */ + function map(array, callback) { + var out = []; + + each(array, function(item) { + out.push(callback(item)); + }); + + return out; + } + + /** + * Filters out items from the input array by calling the specified function for each item. + * If the function returns false the item will be excluded if it returns true it will be included. + * + * @method grep + * @param {Array} a Array of items to loop though. + * @param {function} f Function to call for each item. Include/exclude depends on it's return value. + * @return {Array} New array with values imported and filtered based in input. + * @example + * // Filter out some items, this will return an array with 4 and 5 + * var items = tinymce.grep([1,2,3,4,5], function(v) {return v > 3;}); + */ + function grep(a, f) { + var o = []; + + each(a, function(v) { + if (!f || f(v)) { + o.push(v); + } + }); + + return o; + } + + /** + * Creates a class, subclass or static singleton. + * More details on this method can be found in the Wiki. + * + * @method create + * @param {String} s Class name, inheritage and prefix. + * @param {Object} p Collection of methods to add to the class. + * @param {Object} root Optional root object defaults to the global window object. + * @example + * // Creates a basic class + * tinymce.create('tinymce.somepackage.SomeClass', { + * SomeClass: function() { + * // Class constructor + * }, + * + * method: function() { + * // Some method + * } + * }); + * + * // Creates a basic subclass class + * tinymce.create('tinymce.somepackage.SomeSubClass:tinymce.somepackage.SomeClass', { + * SomeSubClass: function() { + * // Class constructor + * this.parent(); // Call parent constructor + * }, + * + * method: function() { + * // Some method + * this.parent(); // Call parent method + * }, + * + * 'static': { + * staticMethod: function() { + * // Static method + * } + * } + * }); + * + * // Creates a singleton/static class + * tinymce.create('static tinymce.somepackage.SomeSingletonClass', { + * method: function() { + * // Some method + * } + * }); + */ + function create(s, p, root) { + var self = this, sp, ns, cn, scn, c, de = 0; + + // Parse : : + s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s); + cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name + + // Create namespace for new class + ns = self.createNS(s[3].replace(/\.\w+$/, ''), root); + + // Class already exists + if (ns[cn]) { + return; + } + + // Make pure static class + if (s[2] == 'static') { + ns[cn] = p; + + if (this.onCreate) { + this.onCreate(s[2], s[3], ns[cn]); + } + + return; + } + + // Create default constructor + if (!p[cn]) { + p[cn] = function() {}; + de = 1; + } + + // Add constructor and methods + ns[cn] = p[cn]; + self.extend(ns[cn].prototype, p); + + // Extend + if (s[5]) { + sp = self.resolve(s[5]).prototype; + scn = s[5].match(/\.(\w+)$/i)[1]; // Class name + + // Extend constructor + c = ns[cn]; + if (de) { + // Add passthrough constructor + ns[cn] = function() { + return sp[scn].apply(this, arguments); + }; + } else { + // Add inherit constructor + ns[cn] = function() { + this.parent = sp[scn]; + return c.apply(this, arguments); + }; + } + ns[cn].prototype[cn] = ns[cn]; + + // Add super methods + self.each(sp, function(f, n) { + ns[cn].prototype[n] = sp[n]; + }); + + // Add overridden methods + self.each(p, function(f, n) { + // Extend methods if needed + if (sp[n]) { + ns[cn].prototype[n] = function() { + this.parent = sp[n]; + return f.apply(this, arguments); + }; + } else { + if (n != cn) { + ns[cn].prototype[n] = f; + } + } + }); + } + + // Add static methods + /*jshint sub:true*/ + /*eslint dot-notation:0*/ + self.each(p['static'], function(f, n) { + ns[cn][n] = f; + }); + } + + /** + * Returns the index of a value in an array, this method will return -1 if the item wasn't found. + * + * @method inArray + * @param {Array} a Array/Object to search for value in. + * @param {Object} v Value to check for inside the array. + * @return {Number/String} Index of item inside the array inside an object. Or -1 if it wasn't found. + * @example + * // Get index of value in array this will alert 1 since 2 is at that index + * alert(tinymce.inArray([1,2,3], 2)); + */ + function inArray(a, v) { + var i, l; + + if (a) { + for (i = 0, l = a.length; i < l; i++) { + if (a[i] === v) { + return i; + } + } + } + + return -1; + } + + function extend(obj, ext) { + var i, l, name, args = arguments, value; + + for (i = 1, l = args.length; i < l; i++) { + ext = args[i]; + for (name in ext) { + if (ext.hasOwnProperty(name)) { + value = ext[name]; + + if (value !== undefined) { + obj[name] = value; + } + } + } + } + + return obj; + } + + /** + * Executed the specified function for each item in a object tree. + * + * @method walk + * @param {Object} o Object tree to walk though. + * @param {function} f Function to call for each item. + * @param {String} n Optional name of collection inside the objects to walk for example childNodes. + * @param {String} s Optional scope to execute the function in. + */ + function walk(o, f, n, s) { + s = s || this; + + if (o) { + if (n) { + o = o[n]; + } + + each(o, function(o, i) { + if (f.call(s, o, i, n) === false) { + return false; + } + + walk(o, f, n, s); + }); + } + } + + /** + * Creates a namespace on a specific object. + * + * @method createNS + * @param {String} n Namespace to create for example a.b.c.d. + * @param {Object} o Optional object to add namespace to, defaults to window. + * @return {Object} New namespace object the last item in path. + * @example + * // Create some namespace + * tinymce.createNS('tinymce.somepackage.subpackage'); + * + * // Add a singleton + * var tinymce.somepackage.subpackage.SomeSingleton = { + * method: function() { + * // Some method + * } + * }; + */ + function createNS(n, o) { + var i, v; + + o = o || window; + + n = n.split('.'); + for (i = 0; i < n.length; i++) { + v = n[i]; + + if (!o[v]) { + o[v] = {}; + } + + o = o[v]; + } + + return o; + } + + /** + * Resolves a string and returns the object from a specific structure. + * + * @method resolve + * @param {String} n Path to resolve for example a.b.c.d. + * @param {Object} o Optional object to search though, defaults to window. + * @return {Object} Last object in path or null if it couldn't be resolved. + * @example + * // Resolve a path into an object reference + * var obj = tinymce.resolve('a.b.c.d'); + */ + function resolve(n, o) { + var i, l; + + o = o || window; + + n = n.split('.'); + for (i = 0, l = n.length; i < l; i++) { + o = o[n[i]]; + + if (!o) { + break; + } + } + + return o; + } + + /** + * Splits a string but removes the whitespace before and after each value. + * + * @method explode + * @param {string} s String to split. + * @param {string} d Delimiter to split by. + * @example + * // Split a string into an array with a,b,c + * var arr = tinymce.explode('a, b, c'); + */ + function explode(s, d) { + if (!s || is(s, 'array')) { + return s; + } + + return map(s.split(d || ','), trim); + } + + function _addCacheSuffix(url) { + var cacheSuffix = Env.cacheSuffix; + + if (cacheSuffix) { + url += (url.indexOf('?') === -1 ? '?' : '&') + cacheSuffix; + } + + return url; + } + + return { + trim: trim, + isArray: isArray, + is: is, + toArray: toArray, + makeMap: makeMap, + each: each, + map: map, + grep: grep, + inArray: inArray, + extend: extend, + create: create, + walk: walk, + createNS: createNS, + resolve: resolve, + explode: explode, + _addCacheSuffix: _addCacheSuffix + }; +}); + +// Included from: js/tinymce/classes/dom/DomQuery.js + +/** + * DomQuery.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class mimics most of the jQuery API: + * + * This is whats currently implemented: + * - Utility functions + * - DOM traversial + * - DOM manipulation + * - Event binding + * + * This is not currently implemented: + * - Dimension + * - Ajax + * - Animation + * - Advanced chaining + * + * @example + * var $ = tinymce.dom.DomQuery; + * $('p').attr('attr', 'value').addClass('class'); + * + * @class tinymce.dom.DomQuery + */ +define("tinymce/dom/DomQuery", [ + "tinymce/dom/EventUtils", + "tinymce/dom/Sizzle", + "tinymce/util/Tools", + "tinymce/Env" +], function(EventUtils, Sizzle, Tools, Env) { + var doc = document, push = Array.prototype.push, slice = Array.prototype.slice; + var rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/; + var Event = EventUtils.Event, undef; + + function isDefined(obj) { + return typeof obj !== 'undefined'; + } + + function isString(obj) { + return typeof obj === 'string'; + } + + function isWindow(obj) { + return obj && obj == obj.window; + } + + function createFragment(html, fragDoc) { + var frag, node, container; + + fragDoc = fragDoc || doc; + container = fragDoc.createElement('div'); + frag = fragDoc.createDocumentFragment(); + container.innerHTML = html; + + while ((node = container.firstChild)) { + frag.appendChild(node); + } + + return frag; + } + + function domManipulate(targetNodes, sourceItem, callback, reverse) { + var i; + + if (isString(sourceItem)) { + sourceItem = createFragment(sourceItem, getElementDocument(targetNodes[0])); + } else if (sourceItem.length && !sourceItem.nodeType) { + sourceItem = DomQuery.makeArray(sourceItem); + + if (reverse) { + for (i = sourceItem.length - 1; i >= 0; i--) { + domManipulate(targetNodes, sourceItem[i], callback, reverse); + } + } else { + for (i = 0; i < sourceItem.length; i++) { + domManipulate(targetNodes, sourceItem[i], callback, reverse); + } + } + + return targetNodes; + } + + if (sourceItem.nodeType) { + i = targetNodes.length; + while (i--) { + callback.call(targetNodes[i], sourceItem); + } + } + + return targetNodes; + } + + function hasClass(node, className) { + return node && className && (' ' + node.className + ' ').indexOf(' ' + className + ' ') !== -1; + } + + function wrap(elements, wrapper, all) { + var lastParent, newWrapper; + + wrapper = DomQuery(wrapper)[0]; + + elements.each(function() { + var self = this; + + if (!all || lastParent != self.parentNode) { + lastParent = self.parentNode; + newWrapper = wrapper.cloneNode(false); + self.parentNode.insertBefore(newWrapper, self); + newWrapper.appendChild(self); + } else { + newWrapper.appendChild(self); + } + }); + + return elements; + } + + var numericCssMap = Tools.makeMap('fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom', ' '); + var booleanMap = Tools.makeMap('checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected', ' '); + var propFix = { + 'for': 'htmlFor', + 'class': 'className', + 'readonly': 'readOnly' + }; + var cssFix = { + 'float': 'cssFloat' + }; + + var attrHooks = {}, cssHooks = {}; + + function DomQuery(selector, context) { + /*eslint new-cap:0 */ + return new DomQuery.fn.init(selector, context); + } + + function inArray(item, array) { + var i; + + if (array.indexOf) { + return array.indexOf(item); + } + + i = array.length; + while (i--) { + if (array[i] === item) { + return i; + } + } + + return -1; + } + + var whiteSpaceRegExp = /^\s*|\s*$/g; + + function trim(str) { + return (str === null || str === undef) ? '' : ("" + str).replace(whiteSpaceRegExp, ''); + } + + function each(obj, callback) { + var length, key, i, undef, value; + + if (obj) { + length = obj.length; + + if (length === undef) { + // Loop object items + for (key in obj) { + if (obj.hasOwnProperty(key)) { + value = obj[key]; + if (callback.call(value, key, value) === false) { + break; + } + } + } + } else { + // Loop array items + for (i = 0; i < length; i++) { + value = obj[i]; + if (callback.call(value, i, value) === false) { + break; + } + } + } + } + + return obj; + } + + function grep(array, callback) { + var out = []; + + each(array, function(i, item) { + if (callback(item, i)) { + out.push(item); + } + }); + + return out; + } + + function getElementDocument(element) { + if (!element) { + return doc; + } + + if (element.nodeType == 9) { + return element; + } + + return element.ownerDocument; + } + + DomQuery.fn = DomQuery.prototype = { + constructor: DomQuery, + + /** + * Selector for the current set. + * + * @property selector + * @type String + */ + selector: "", + + /** + * Context used to create the set. + * + * @property context + * @type Element + */ + context: null, + + /** + * Number of items in the current set. + * + * @property length + * @type Number + */ + length: 0, + + /** + * Constructs a new DomQuery instance with the specified selector or context. + * + * @constructor + * @method init + * @param {String/Array/DomQuery} selector Optional CSS selector/Array or array like object or HTML string. + * @param {Document/Element} context Optional context to search in. + */ + init: function(selector, context) { + var self = this, match, node; + + if (!selector) { + return self; + } + + if (selector.nodeType) { + self.context = self[0] = selector; + self.length = 1; + + return self; + } + + if (context && context.nodeType) { + self.context = context; + } else { + if (context) { + return DomQuery(selector).attr(context); + } else { + self.context = context = document; + } + } + + if (isString(selector)) { + self.selector = selector; + + if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) { + match = [null, selector, null]; + } else { + match = rquickExpr.exec(selector); + } + + if (match) { + if (match[1]) { + node = createFragment(selector, getElementDocument(context)).firstChild; + + while (node) { + push.call(self, node); + node = node.nextSibling; + } + } else { + node = getElementDocument(context).getElementById(match[2]); + + if (!node) { + return self; + } + + if (node.id !== match[2]) { + return self.find(selector); + } + + self.length = 1; + self[0] = node; + } + } else { + return DomQuery(context).find(selector); + } + } else { + this.add(selector, false); + } + + return self; + }, + + /** + * Converts the current set to an array. + * + * @method toArray + * @param {Array} Array of all nodes in set. + */ + toArray: function() { + return Tools.toArray(this); + }, + + /** + * Adds new nodes to the set. + * + * @method add + * @param {Array/tinymce.dom.DomQuery} items Array of all nodes to add to set. + * @return {tinymce.dom.DomQuery} New instance with nodes added. + */ + add: function(items, sort) { + var self = this, nodes, i; + + if (isString(items)) { + return self.add(DomQuery(items)); + } + + if (sort !== false) { + nodes = DomQuery.unique(self.toArray().concat(DomQuery.makeArray(items))); + self.length = nodes.length; + for (i = 0; i < nodes.length; i++) { + self[i] = nodes[i]; + } + } else { + push.apply(self, DomQuery.makeArray(items)); + } + + return self; + }, + + /** + * Sets/gets attributes on the elements in the current set. + * + * @method attr + * @param {String/Object} name Name of attribute to get or an object with attributes to set. + * @param {String} value Optional value to set. + * @return {tinymce.dom.DomQuery/String} Current set or the specified attribute when only the name is specified. + */ + attr: function(name, value) { + var self = this, hook; + + if (typeof name === "object") { + each(name, function(name, value) { + self.attr(name, value); + }); + } else if (isDefined(value)) { + this.each(function() { + var hook; + + if (this.nodeType === 1) { + hook = attrHooks[name]; + if (hook && hook.set) { + hook.set(this, value); + return; + } + + if (value === null) { + this.removeAttribute(name, 2); + } else { + this.setAttribute(name, value, 2); + } + } + }); + } else { + if (self[0] && self[0].nodeType === 1) { + hook = attrHooks[name]; + if (hook && hook.get) { + return hook.get(self[0], name); + } + + if (booleanMap[name]) { + return self.prop(name) ? name : undef; + } + + value = self[0].getAttribute(name, 2); + + if (value === null) { + value = undef; + } + } + + return value; + } + + return self; + }, + + /** + * Removes attributse on the elements in the current set. + * + * @method removeAttr + * @param {String/Object} name Name of attribute to remove. + * @return {tinymce.dom.DomQuery/String} Current set. + */ + removeAttr: function(name) { + return this.attr(name, null); + }, + + /** + * Sets/gets properties on the elements in the current set. + * + * @method attr + * @param {String/Object} name Name of property to get or an object with properties to set. + * @param {String} value Optional value to set. + * @return {tinymce.dom.DomQuery/String} Current set or the specified property when only the name is specified. + */ + prop: function(name, value) { + var self = this; + + name = propFix[name] || name; + + if (typeof name === "object") { + each(name, function(name, value) { + self.prop(name, value); + }); + } else if (isDefined(value)) { + this.each(function() { + if (this.nodeType == 1) { + this[name] = value; + } + }); + } else { + if (self[0] && self[0].nodeType && name in self[0]) { + return self[0][name]; + } + + return value; + } + + return self; + }, + + /** + * Sets/gets styles on the elements in the current set. + * + * @method css + * @param {String/Object} name Name of style to get or an object with styles to set. + * @param {String} value Optional value to set. + * @return {tinymce.dom.DomQuery/String} Current set or the specified style when only the name is specified. + */ + css: function(name, value) { + var self = this, elm, hook; + + function camel(name) { + return name.replace(/-(\D)/g, function(a, b) { + return b.toUpperCase(); + }); + } + + function dashed(name) { + return name.replace(/[A-Z]/g, function(a) { + return '-' + a; + }); + } + + if (typeof name === "object") { + each(name, function(name, value) { + self.css(name, value); + }); + } else { + if (isDefined(value)) { + name = camel(name); + + // Default px suffix on these + if (typeof value === 'number' && !numericCssMap[name]) { + value += 'px'; + } + + self.each(function() { + var style = this.style; + + hook = cssHooks[name]; + if (hook && hook.set) { + hook.set(this, value); + return; + } + + try { + this.style[cssFix[name] || name] = value; + } catch (ex) { + // Ignore + } + + if (value === null || value === '') { + if (style.removeProperty) { + style.removeProperty(dashed(name)); + } else { + style.removeAttribute(name); + } + } + }); + } else { + elm = self[0]; + + hook = cssHooks[name]; + if (hook && hook.get) { + return hook.get(elm); + } + + if (elm.ownerDocument.defaultView) { + try { + return elm.ownerDocument.defaultView.getComputedStyle(elm, null).getPropertyValue(dashed(name)); + } catch (ex) { + return undef; + } + } else if (elm.currentStyle) { + return elm.currentStyle[camel(name)]; + } + } + } + + return self; + }, + + /** + * Removes all nodes in set from the document. + * + * @method remove + * @return {tinymce.dom.DomQuery} Current set with the removed nodes. + */ + remove: function() { + var self = this, node, i = this.length; + + while (i--) { + node = self[i]; + Event.clean(node); + + if (node.parentNode) { + node.parentNode.removeChild(node); + } + } + + return this; + }, + + /** + * Empties all elements in set. + * + * @method empty + * @return {tinymce.dom.DomQuery} Current set with the empty nodes. + */ + empty: function() { + var self = this, node, i = this.length; + + while (i--) { + node = self[i]; + while (node.firstChild) { + node.removeChild(node.firstChild); + } + } + + return this; + }, + + /** + * Sets or gets the HTML of the current set or first set node. + * + * @method html + * @param {String} value Optional innerHTML value to set on each element. + * @return {tinymce.dom.DomQuery/String} Current set or the innerHTML of the first element. + */ + html: function(value) { + var self = this, i; + + if (isDefined(value)) { + i = self.length; + + try { + while (i--) { + self[i].innerHTML = value; + } + } catch (ex) { + // Workaround for "Unknown runtime error" when DIV is added to P on IE + DomQuery(self[i]).empty().append(value); + } + + return self; + } + + return self[0] ? self[0].innerHTML : ''; + }, + + /** + * Sets or gets the text of the current set or first set node. + * + * @method text + * @param {String} value Optional innerText value to set on each element. + * @return {tinymce.dom.DomQuery/String} Current set or the innerText of the first element. + */ + text: function(value) { + var self = this, i; + + if (isDefined(value)) { + i = self.length; + while (i--) { + if ("innerText" in self[i]) { + self[i].innerText = value; + } else { + self[0].textContent = value; + } + } + + return self; + } + + return self[0] ? (self[0].innerText || self[0].textContent) : ''; + }, + + /** + * Appends the specified node/html or node set to the current set nodes. + * + * @method append + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to append to each element in set. + * @return {tinymce.dom.DomQuery} Current set. + */ + append: function() { + return domManipulate(this, arguments, function(node) { + if (this.nodeType === 1) { + this.appendChild(node); + } + }); + }, + + /** + * Prepends the specified node/html or node set to the current set nodes. + * + * @method prepend + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to prepend to each element in set. + * @return {tinymce.dom.DomQuery} Current set. + */ + prepend: function() { + return domManipulate(this, arguments, function(node) { + if (this.nodeType === 1) { + this.insertBefore(node, this.firstChild); + } + }, true); + }, + + /** + * Adds the specified elements before current set nodes. + * + * @method before + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to add before to each element in set. + * @return {tinymce.dom.DomQuery} Current set. + */ + before: function() { + var self = this; + + if (self[0] && self[0].parentNode) { + return domManipulate(self, arguments, function(node) { + this.parentNode.insertBefore(node, this); + }); + } + + return self; + }, + + /** + * Adds the specified elements after current set nodes. + * + * @method after + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to add after to each element in set. + * @return {tinymce.dom.DomQuery} Current set. + */ + after: function() { + var self = this; + + if (self[0] && self[0].parentNode) { + return domManipulate(self, arguments, function(node) { + this.parentNode.insertBefore(node, this.nextSibling); + }, true); + } + + return self; + }, + + /** + * Appends the specified set nodes to the specified selector/instance. + * + * @method appendTo + * @param {String/Element/Array/tinymce.dom.DomQuery} val Item to append the current set to. + * @return {tinymce.dom.DomQuery} Current set with the appended nodes. + */ + appendTo: function(val) { + DomQuery(val).append(this); + + return this; + }, + + /** + * Prepends the specified set nodes to the specified selector/instance. + * + * @method prependTo + * @param {String/Element/Array/tinymce.dom.DomQuery} val Item to prepend the current set to. + * @return {tinymce.dom.DomQuery} Current set with the prepended nodes. + */ + prependTo: function(val) { + DomQuery(val).prepend(this); + + return this; + }, + + /** + * Replaces the nodes in set with the specified content. + * + * @method replaceWith + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to replace nodes with. + * @return {tinymce.dom.DomQuery} Set with replaced nodes. + */ + replaceWith: function(content) { + return this.before(content).remove(); + }, + + /** + * Wraps all elements in set with the specified wrapper. + * + * @method wrap + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to wrap nodes with. + * @return {tinymce.dom.DomQuery} Set with wrapped nodes. + */ + wrap: function(wrapper) { + return wrap(this, wrapper); + }, + + /** + * Wraps all nodes in set with the specified wrapper. If the nodes are siblings all of them + * will be wrapped in the same wrapper. + * + * @method wrapAll + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to wrap nodes with. + * @return {tinymce.dom.DomQuery} Set with wrapped nodes. + */ + wrapAll: function(wrapper) { + return wrap(this, wrapper, true); + }, + + /** + * Wraps all elements inner contents in set with the specified wrapper. + * + * @method wrapInner + * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to wrap nodes with. + * @return {tinymce.dom.DomQuery} Set with wrapped nodes. + */ + wrapInner: function(wrapper) { + this.each(function() { + DomQuery(this).contents().wrapAll(wrapper); + }); + + return this; + }, + + /** + * Unwraps all elements by removing the parent element of each item in set. + * + * @method unwrap + * @return {tinymce.dom.DomQuery} Set with unwrapped nodes. + */ + unwrap: function() { + return this.parent().each(function() { + DomQuery(this).replaceWith(this.childNodes); + }); + }, + + /** + * Clones all nodes in set. + * + * @method clone + * @return {tinymce.dom.DomQuery} Set with cloned nodes. + */ + clone: function() { + var result = []; + + this.each(function() { + result.push(this.cloneNode(true)); + }); + + return DomQuery(result); + }, + + /** + * Adds the specified class name to the current set elements. + * + * @method addClass + * @param {String} className Class name to add. + * @return {tinymce.dom.DomQuery} Current set. + */ + addClass: function(className) { + return this.toggleClass(className, true); + }, + + /** + * Removes the specified class name to the current set elements. + * + * @method removeClass + * @param {String} className Class name to remove. + * @return {tinymce.dom.DomQuery} Current set. + */ + removeClass: function(className) { + return this.toggleClass(className, false); + }, + + /** + * Toggles the specified class name on the current set elements. + * + * @method toggleClass + * @param {String} className Class name to add/remove. + * @param {Boolean} state Optional state to toggle on/off. + * @return {tinymce.dom.DomQuery} Current set. + */ + toggleClass: function(className, state) { + var self = this; + + // Functions are not supported + if (typeof className != 'string') { + return self; + } + + if (className.indexOf(' ') !== -1) { + each(className.split(' '), function() { + self.toggleClass(this, state); + }); + } else { + self.each(function(index, node) { + var existingClassName, classState; + + classState = hasClass(node, className); + if (classState !== state) { + existingClassName = node.className; + + if (classState) { + node.className = trim((" " + existingClassName + " ").replace(' ' + className + ' ', ' ')); + } else { + node.className += existingClassName ? ' ' + className : className; + } + } + }); + } + + return self; + }, + + /** + * Returns true/false if the first item in set has the specified class. + * + * @method hasClass + * @param {String} className Class name to check for. + * @return {Boolean} True/false if the set has the specified class. + */ + hasClass: function(className) { + return hasClass(this[0], className); + }, + + /** + * Executes the callback function for each item DomQuery collection. If you return false in the + * callback it will break the loop. + * + * @method each + * @param {function} callback Callback function to execute for each item. + * @return {tinymce.dom.DomQuery} Current set. + */ + each: function(callback) { + return each(this, callback); + }, + + /** + * Binds an event with callback function to the elements in set. + * + * @method on + * @param {String} name Name of the event to bind. + * @param {function} callback Callback function to execute when the event occurs. + * @return {tinymce.dom.DomQuery} Current set. + */ + on: function(name, callback) { + return this.each(function() { + Event.bind(this, name, callback); + }); + }, + + /** + * Unbinds an event with callback function to the elements in set. + * + * @method off + * @param {String} name Optional name of the event to bind. + * @param {function} callback Optional callback function to execute when the event occurs. + * @return {tinymce.dom.DomQuery} Current set. + */ + off: function(name, callback) { + return this.each(function() { + Event.unbind(this, name, callback); + }); + }, + + /** + * Triggers the specified event by name or event object. + * + * @method trigger + * @param {String/Object} name Name of the event to trigger or event object. + * @return {tinymce.dom.DomQuery} Current set. + */ + trigger: function(name) { + return this.each(function() { + if (typeof name == 'object') { + Event.fire(this, name.type, name); + } else { + Event.fire(this, name); + } + }); + }, + + /** + * Shows all elements in set. + * + * @method show + * @return {tinymce.dom.DomQuery} Current set. + */ + show: function() { + return this.css('display', ''); + }, + + /** + * Hides all elements in set. + * + * @method hide + * @return {tinymce.dom.DomQuery} Current set. + */ + hide: function() { + return this.css('display', 'none'); + }, + + /** + * Slices the current set. + * + * @method slice + * @param {Number} start Start index to slice at. + * @param {Number} end Optional ened index to end slice at. + * @return {tinymce.dom.DomQuery} Sliced set. + */ + slice: function() { + return new DomQuery(slice.apply(this, arguments)); + }, + + /** + * Makes the set equal to the specified index. + * + * @method eq + * @param {Number} index Index to set it equal to. + * @return {tinymce.dom.DomQuery} Single item set. + */ + eq: function(index) { + return index === -1 ? this.slice(index) : this.slice(index, +index + 1); + }, + + /** + * Makes the set equal to first element in set. + * + * @method first + * @return {tinymce.dom.DomQuery} Single item set. + */ + first: function() { + return this.eq(0); + }, + + /** + * Makes the set equal to last element in set. + * + * @method last + * @return {tinymce.dom.DomQuery} Single item set. + */ + last: function() { + return this.eq(-1); + }, + + /** + * Finds elements by the specified selector for each element in set. + * + * @method find + * @param {String} selector Selector to find elements by. + * @return {tinymce.dom.DomQuery} Set with matches elements. + */ + find: function(selector) { + var i, l, ret = []; + + for (i = 0, l = this.length; i < l; i++) { + DomQuery.find(selector, this[i], ret); + } + + return DomQuery(ret); + }, + + /** + * Filters the current set with the specified selector. + * + * @method filter + * @param {String/function} selector Selector to filter elements by. + * @return {tinymce.dom.DomQuery} Set with filtered elements. + */ + filter: function(selector) { + if (typeof selector == 'function') { + return DomQuery(grep(this.toArray(), function(item, i) { + return selector(i, item); + })); + } + + return DomQuery(DomQuery.filter(selector, this.toArray())); + }, + + /** + * Gets the current node or any partent matching the specified selector. + * + * @method closest + * @param {String/Element/tinymce.dom.DomQuery} selector Selector or element to find. + * @return {tinymce.dom.DomQuery} Set with closest elements. + */ + closest: function(selector) { + var result = []; + + if (selector instanceof DomQuery) { + selector = selector[0]; + } + + this.each(function(i, node) { + while (node) { + if (typeof selector == 'string' && DomQuery(node).is(selector)) { + result.push(node); + break; + } else if (node == selector) { + result.push(node); + break; + } + + node = node.parentNode; + } + }); + + return DomQuery(result); + }, + + /** + * Returns the offset of the first element in set or sets the top/left css properties of all elements in set. + * + * @method offset + * @param {Object} offset Optional offset object to set on each item. + * @return {Object/tinymce.dom.DomQuery} Returns the first element offset or the current set if you specified an offset. + */ + offset: function(offset) { + var elm, doc, docElm; + var x = 0, y = 0, pos; + + if (!offset) { + elm = this[0]; + + if (elm) { + doc = elm.ownerDocument; + docElm = doc.documentElement; + + if (elm.getBoundingClientRect) { + pos = elm.getBoundingClientRect(); + x = pos.left + (docElm.scrollLeft || doc.body.scrollLeft) - docElm.clientLeft; + y = pos.top + (docElm.scrollTop || doc.body.scrollTop) - docElm.clientTop; + } + } + + return { + left: x, + top: y + }; + } + + return this.css(offset); + }, + + push: push, + sort: [].sort, + splice: [].splice + }; + + // Static members + Tools.extend(DomQuery, { + /** + * Extends the specified object with one or more objects. + * + * @static + * @method extend + * @param {Object} target Target object to extend with new items. + * @param {Object..} object Object to extend the target with. + * @return {Object} Extended input object. + */ + extend: Tools.extend, + + /** + * Creates an array out of an array like object. + * + * @static + * @method makeArray + * @param {Object} object Object to convert to array. + * @return {Arrau} Array produced from object. + */ + makeArray: function(array) { + if (isWindow(array) || array.nodeType) { + return [array]; + } + + return Tools.toArray(array); + }, + + /** + * Returns the index of the specified item inside the array. + * + * @static + * @method inArray + * @param {Object} item Item to look for. + * @param {Array} array Array to look for item in. + * @return {Number} Index of the item or -1. + */ + inArray: inArray, + + /** + * Returns true/false if the specified object is an array or not. + * + * @static + * @method isArray + * @param {Object} array Object to check if it's an array or not. + * @return {Boolean} True/false if the object is an array. + */ + isArray: Tools.isArray, + + /** + * Executes the callback function for each item in array/object. If you return false in the + * callback it will break the loop. + * + * @static + * @method each + * @param {Object} obj Object to iterate. + * @param {function} callback Callback function to execute for each item. + */ + each: each, + + /** + * Removes whitespace from the beginning and end of a string. + * + * @static + * @method trim + * @param {String} str String to remove whitespace from. + * @return {String} New string with removed whitespace. + */ + trim: trim, + + /** + * Filters out items from the input array by calling the specified function for each item. + * If the function returns false the item will be excluded if it returns true it will be included. + * + * @static + * @method grep + * @param {Array} array Array of items to loop though. + * @param {function} callback Function to call for each item. Include/exclude depends on it's return value. + * @return {Array} New array with values imported and filtered based in input. + * @example + * // Filter out some items, this will return an array with 4 and 5 + * var items = DomQuery.grep([1, 2, 3, 4, 5], function(v) {return v > 3;}); + */ + grep: grep, + + // Sizzle + find: Sizzle, + expr: Sizzle.selectors, + unique: Sizzle.uniqueSort, + text: Sizzle.getText, + contains: Sizzle.contains, + filter: function(expr, elems, not) { + var i = elems.length; + + if (not) { + expr = ":not(" + expr + ")"; + } + + while (i--) { + if (elems[i].nodeType != 1) { + elems.splice(i, 1); + } + } + + if (elems.length === 1) { + elems = DomQuery.find.matchesSelector(elems[0], expr) ? [elems[0]] : []; + } else { + elems = DomQuery.find.matches(expr, elems); + } + + return elems; + } + }); + + function dir(el, prop, until) { + var matched = [], cur = el[prop]; + + if (typeof until != 'string' && until instanceof DomQuery) { + until = until[0]; + } + + while (cur && cur.nodeType !== 9) { + if (until !== undefined) { + if (cur === until) { + break; + } + + if (typeof until == 'string' && DomQuery(cur).is(until)) { + break; + } + } + + if (cur.nodeType === 1) { + matched.push(cur); + } + + cur = cur[prop]; + } + + return matched; + } + + function sibling(node, siblingName, nodeType, until) { + var result = []; + + if (until instanceof DomQuery) { + until = until[0]; + } + + for (; node; node = node[siblingName]) { + if (nodeType && node.nodeType !== nodeType) { + continue; + } + + if (until !== undefined) { + if (node === until) { + break; + } + + if (typeof until == 'string' && DomQuery(node).is(until)) { + break; + } + } + + result.push(node); + } + + return result; + } + + function firstSibling(node, siblingName, nodeType) { + for (node = node[siblingName]; node; node = node[siblingName]) { + if (node.nodeType == nodeType) { + return node; + } + } + + return null; + } + + each({ + /** + * Returns a new collection with the parent of each item in current collection matching the optional selector. + * + * @method parent + * @param {String} selector Selector to match parents agains. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching parents. + */ + parent: function(node) { + var parent = node.parentNode; + + return parent && parent.nodeType !== 11 ? parent : null; + }, + + /** + * Returns a new collection with the all the parents of each item in current collection matching the optional selector. + * + * @method parents + * @param {String} selector Selector to match parents agains. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching parents. + */ + parents: function(node) { + return dir(node, "parentNode"); + }, + + /** + * Returns a new collection with next sibling of each item in current collection matching the optional selector. + * + * @method next + * @param {String} selector Selector to match the next element against. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + next: function(node) { + return firstSibling(node, 'nextSibling', 1); + }, + + /** + * Returns a new collection with previous sibling of each item in current collection matching the optional selector. + * + * @method prev + * @param {String} selector Selector to match the previous element against. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + prev: function(node) { + return firstSibling(node, 'previousSibling', 1); + }, + + /** + * Returns all child elements matching the optional selector. + * + * @method children + * @param {String} selector Selector to match the elements against. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + children: function(node) { + return sibling(node.firstChild, 'nextSibling', 1); + }, + + /** + * Returns all child nodes matching the optional selector. + * + * @method contents + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + contents: function(node) { + return Tools.toArray((node.nodeName === "iframe" ? node.contentDocument || node.contentWindow.document : node).childNodes); + } + }, function(name, fn) { + DomQuery.fn[name] = function(selector) { + var self = this, result = []; + + self.each(function() { + var nodes = fn.call(result, this, selector, result); + + if (nodes) { + if (DomQuery.isArray(nodes)) { + result.push.apply(result, nodes); + } else { + result.push(nodes); + } + } + }); + + // If traversing on multiple elements we might get the same elements twice + if (this.length > 1) { + result = DomQuery.unique(result); + + if (name.indexOf('parents') === 0) { + result = result.reverse(); + } + } + + result = DomQuery(result); + + if (selector) { + return result.filter(selector); + } + + return result; + }; + }); + + each({ + /** + * Returns a new collection with the all the parents until the matching selector/element + * of each item in current collection matching the optional selector. + * + * @method parentsUntil + * @param {String/Element/tinymce.dom.DomQuery} until Until the matching selector or element. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching parents. + */ + parentsUntil: function(node, until) { + return dir(node, "parentNode", until); + }, + + /** + * Returns a new collection with all next siblings of each item in current collection matching the optional selector. + * + * @method nextUntil + * @param {String/Element/tinymce.dom.DomQuery} until Until the matching selector or element. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + nextUntil: function(node, until) { + return sibling(node, 'nextSibling', 1, until).slice(1); + }, + + /** + * Returns a new collection with all previous siblings of each item in current collection matching the optional selector. + * + * @method prevUntil + * @param {String/Element/tinymce.dom.DomQuery} until Until the matching selector or element. + * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements. + */ + prevUntil: function(node, until) { + return sibling(node, 'previousSibling', 1, until).slice(1); + } + }, function(name, fn) { + DomQuery.fn[name] = function(selector, filter) { + var self = this, result = []; + + self.each(function() { + var nodes = fn.call(result, this, selector, result); + + if (nodes) { + if (DomQuery.isArray(nodes)) { + result.push.apply(result, nodes); + } else { + result.push(nodes); + } + } + }); + + // If traversing on multiple elements we might get the same elements twice + if (this.length > 1) { + result = DomQuery.unique(result); + + if (name.indexOf('parents') === 0 || name === 'prevUntil') { + result = result.reverse(); + } + } + + result = DomQuery(result); + + if (filter) { + return result.filter(filter); + } + + return result; + }; + }); + + /** + * Returns true/false if the current set items matches the selector. + * + * @method is + * @param {String} selector Selector to match the elements against. + * @return {Boolean} True/false if the current set matches the selector. + */ + DomQuery.fn.is = function(selector) { + return !!selector && this.filter(selector).length > 0; + }; + + DomQuery.fn.init.prototype = DomQuery.fn; + + DomQuery.overrideDefaults = function(callback) { + var defaults; + + function sub(selector, context) { + defaults = defaults || callback(); + + if (arguments.length === 0) { + selector = defaults.element; + } + + if (!context) { + context = defaults.context; + } + + return new sub.fn.init(selector, context); + } + + DomQuery.extend(sub, this); + + return sub; + }; + + function appendHooks(targetHooks, prop, hooks) { + each(hooks, function(name, func) { + targetHooks[name] = targetHooks[name] || {}; + targetHooks[name][prop] = func; + }); + } + + if (Env.ie && Env.ie < 8) { + appendHooks(attrHooks, 'get', { + maxlength: function(elm) { + var value = elm.maxLength; + + if (value === 0x7fffffff) { + return undef; + } + + return value; + }, + + size: function(elm) { + var value = elm.size; + + if (value === 20) { + return undef; + } + + return value; + }, + + 'class': function(elm) { + return elm.className; + }, + + style: function(elm) { + var value = elm.style.cssText; + + if (value.length === 0) { + return undef; + } + + return value; + } + }); + + appendHooks(attrHooks, 'set', { + 'class': function(elm, value) { + elm.className = value; + }, + + style: function(elm, value) { + elm.style.cssText = value; + } + }); + } + + if (Env.ie && Env.ie < 9) { + /*jshint sub:true */ + /*eslint dot-notation: 0*/ + cssFix['float'] = 'styleFloat'; + + appendHooks(cssHooks, 'set', { + opacity: function(elm, value) { + var style = elm.style; + + if (value === null || value === '') { + style.removeAttribute('filter'); + } else { + style.zoom = 1; + style.filter = 'alpha(opacity=' + (value * 100) + ')'; + } + } + }); + } + + DomQuery.attrHooks = attrHooks; + DomQuery.cssHooks = cssHooks; + + return DomQuery; +}); + +// Included from: js/tinymce/classes/html/Styles.js + +/** + * Styles.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to parse CSS styles it also compresses styles to reduce the output size. + * + * @example + * var Styles = new tinymce.html.Styles({ + * url_converter: function(url) { + * return url; + * } + * }); + * + * styles = Styles.parse('border: 1px solid red'); + * styles.color = 'red'; + * + * console.log(new tinymce.html.StyleSerializer().serialize(styles)); + * + * @class tinymce.html.Styles + * @version 3.4 + */ +define("tinymce/html/Styles", [], function() { + return function(settings, schema) { + /*jshint maxlen:255 */ + /*eslint max-len:0 */ + var rgbRegExp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi, + urlOrStrRegExp = /(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi, + styleRegExp = /\s*([^:]+):\s*([^;]+);?/g, + trimRightRegExp = /\s+$/, + undef, i, encodingLookup = {}, encodingItems, validStyles, invalidStyles, invisibleChar = '\uFEFF'; + + settings = settings || {}; + + if (schema) { + validStyles = schema.getValidStyles(); + invalidStyles = schema.getInvalidStyles(); + } + + encodingItems = ('\\" \\\' \\; \\: ; : ' + invisibleChar).split(' '); + for (i = 0; i < encodingItems.length; i++) { + encodingLookup[encodingItems[i]] = invisibleChar + i; + encodingLookup[invisibleChar + i] = encodingItems[i]; + } + + function toHex(match, r, g, b) { + function hex(val) { + val = parseInt(val, 10).toString(16); + + return val.length > 1 ? val : '0' + val; // 0 -> 00 + } + + return '#' + hex(r) + hex(g) + hex(b); + } + + return { + /** + * Parses the specified RGB color value and returns a hex version of that color. + * + * @method toHex + * @param {String} color RGB string value like rgb(1,2,3) + * @return {String} Hex version of that RGB value like #FF00FF. + */ + toHex: function(color) { + return color.replace(rgbRegExp, toHex); + }, + + /** + * Parses the specified style value into an object collection. This parser will also + * merge and remove any redundant items that browsers might have added. It will also convert non hex + * colors to hex values. Urls inside the styles will also be converted to absolute/relative based on settings. + * + * @method parse + * @param {String} css Style value to parse for example: border:1px solid red;. + * @return {Object} Object representation of that style like {border: '1px solid red'} + */ + parse: function(css) { + var styles = {}, matches, name, value, isEncoded, urlConverter = settings.url_converter; + var urlConverterScope = settings.url_converter_scope || this; + + function compress(prefix, suffix, noJoin) { + var top, right, bottom, left; + + top = styles[prefix + '-top' + suffix]; + if (!top) { + return; + } + + right = styles[prefix + '-right' + suffix]; + if (!right) { + return; + } + + bottom = styles[prefix + '-bottom' + suffix]; + if (!bottom) { + return; + } + + left = styles[prefix + '-left' + suffix]; + if (!left) { + return; + } + + var box = [top, right, bottom, left]; + i = box.length - 1; + while (i--) { + if (box[i] !== box[i + 1]) { + break; + } + } + + if (i > -1 && noJoin) { + return; + } + + styles[prefix + suffix] = i == -1 ? box[0] : box.join(' '); + delete styles[prefix + '-top' + suffix]; + delete styles[prefix + '-right' + suffix]; + delete styles[prefix + '-bottom' + suffix]; + delete styles[prefix + '-left' + suffix]; + } + + /** + * Checks if the specific style can be compressed in other words if all border-width are equal. + */ + function canCompress(key) { + var value = styles[key], i; + + if (!value) { + return; + } + + value = value.split(' '); + i = value.length; + while (i--) { + if (value[i] !== value[0]) { + return false; + } + } + + styles[key] = value[0]; + + return true; + } + + /** + * Compresses multiple styles into one style. + */ + function compress2(target, a, b, c) { + if (!canCompress(a)) { + return; + } + + if (!canCompress(b)) { + return; + } + + if (!canCompress(c)) { + return; + } + + // Compress + styles[target] = styles[a] + ' ' + styles[b] + ' ' + styles[c]; + delete styles[a]; + delete styles[b]; + delete styles[c]; + } + + // Encodes the specified string by replacing all \" \' ; : with _ + function encode(str) { + isEncoded = true; + + return encodingLookup[str]; + } + + // Decodes the specified string by replacing all _ with it's original value \" \' etc + // It will also decode the \" \' if keep_slashes is set to fale or omitted + function decode(str, keep_slashes) { + if (isEncoded) { + str = str.replace(/\uFEFF[0-9]/g, function(str) { + return encodingLookup[str]; + }); + } + + if (!keep_slashes) { + str = str.replace(/\\([\'\";:])/g, "$1"); + } + + return str; + } + + function processUrl(match, url, url2, url3, str, str2) { + str = str || str2; + + if (str) { + str = decode(str); + + // Force strings into single quote format + return "'" + str.replace(/\'/g, "\\'") + "'"; + } + + url = decode(url || url2 || url3); + + if (!settings.allow_script_urls) { + var scriptUrl = url.replace(/[\s\r\n]+/, ''); + + if (/(java|vb)script:/i.test(scriptUrl)) { + return ""; + } + + if (!settings.allow_svg_data_urls && /^data:image\/svg/i.test(scriptUrl)) { + return ""; + } + } + + // Convert the URL to relative/absolute depending on config + if (urlConverter) { + url = urlConverter.call(urlConverterScope, url, 'style'); + } + + // Output new URL format + return "url('" + url.replace(/\'/g, "\\'") + "')"; + } + + if (css) { + css = css.replace(/[\u0000-\u001F]/g, ''); + + // Encode \" \' % and ; and : inside strings so they don't interfere with the style parsing + css = css.replace(/\\[\"\';:\uFEFF]/g, encode).replace(/\"[^\"]+\"|\'[^\']+\'/g, function(str) { + return str.replace(/[;:]/g, encode); + }); + + // Parse styles + while ((matches = styleRegExp.exec(css))) { + name = matches[1].replace(trimRightRegExp, '').toLowerCase(); + value = matches[2].replace(trimRightRegExp, ''); + + // Decode escaped sequences like \65 -> e + /*jshint loopfunc:true*/ + /*eslint no-loop-func:0 */ + value = value.replace(/\\[0-9a-f]+/g, function(e) { + return String.fromCharCode(parseInt(e.substr(1), 16)); + }); + + if (name && value.length > 0) { + // Don't allow behavior name or expression/comments within the values + if (!settings.allow_script_urls && (name == "behavior" || /expression\s*\(|\/\*|\*\//.test(value))) { + continue; + } + + // Opera will produce 700 instead of bold in their style values + if (name === 'font-weight' && value === '700') { + value = 'bold'; + } else if (name === 'color' || name === 'background-color') { // Lowercase colors like RED + value = value.toLowerCase(); + } + + // Convert RGB colors to HEX + value = value.replace(rgbRegExp, toHex); + + // Convert URLs and force them into url('value') format + value = value.replace(urlOrStrRegExp, processUrl); + styles[name] = isEncoded ? decode(value, true) : value; + } + + styleRegExp.lastIndex = matches.index + matches[0].length; + } + // Compress the styles to reduce it's size for example IE will expand styles + compress("border", "", true); + compress("border", "-width"); + compress("border", "-color"); + compress("border", "-style"); + compress("padding", ""); + compress("margin", ""); + compress2('border', 'border-width', 'border-style', 'border-color'); + + // Remove pointless border, IE produces these + if (styles.border === 'medium none') { + delete styles.border; + } + + // IE 11 will produce a border-image: none when getting the style attribute from

    + // So lets asume it shouldn't be there + if (styles['border-image'] === 'none') { + delete styles['border-image']; + } + } + + return styles; + }, + + /** + * Serializes the specified style object into a string. + * + * @method serialize + * @param {Object} styles Object to serialize as string for example: {border: '1px solid red'} + * @param {String} elementName Optional element name, if specified only the styles that matches the schema will be serialized. + * @return {String} String representation of the style object for example: border: 1px solid red. + */ + serialize: function(styles, elementName) { + var css = '', name, value; + + function serializeStyles(name) { + var styleList, i, l, value; + + styleList = validStyles[name]; + if (styleList) { + for (i = 0, l = styleList.length; i < l; i++) { + name = styleList[i]; + value = styles[name]; + + if (value !== undef && value.length > 0) { + css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';'; + } + } + } + } + + function isValid(name, elementName) { + var styleMap; + + styleMap = invalidStyles['*']; + if (styleMap && styleMap[name]) { + return false; + } + + styleMap = invalidStyles[elementName]; + if (styleMap && styleMap[name]) { + return false; + } + + return true; + } + + // Serialize styles according to schema + if (elementName && validStyles) { + // Serialize global styles and element specific styles + serializeStyles('*'); + serializeStyles(elementName); + } else { + // Output the styles in the order they are inside the object + for (name in styles) { + value = styles[name]; + + if (value !== undef && value.length > 0) { + if (!invalidStyles || isValid(name, elementName)) { + css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';'; + } + } + } + } + + return css; + } + }; + }; +}); + +// Included from: js/tinymce/classes/dom/TreeWalker.js + +/** + * TreeWalker.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * TreeWalker class enables you to walk the DOM in a linear manner. + * + * @class tinymce.dom.TreeWalker + * @example + * var walker = new tinymce.dom.TreeWalker(startNode); + * + * do { + * console.log(walker.current()); + * } while (walker.next()); + */ +define("tinymce/dom/TreeWalker", [], function() { + /** + * Constructs a new TreeWalker instance. + * + * @constructor + * @method TreeWalker + * @param {Node} startNode Node to start walking from. + * @param {node} rootNode Optional root node to never walk out of. + */ + return function(startNode, rootNode) { + var node = startNode; + + function findSibling(node, startName, siblingName, shallow) { + var sibling, parent; + + if (node) { + // Walk into nodes if it has a start + if (!shallow && node[startName]) { + return node[startName]; + } + + // Return the sibling if it has one + if (node != rootNode) { + sibling = node[siblingName]; + if (sibling) { + return sibling; + } + + // Walk up the parents to look for siblings + for (parent = node.parentNode; parent && parent != rootNode; parent = parent.parentNode) { + sibling = parent[siblingName]; + if (sibling) { + return sibling; + } + } + } + } + } + + /** + * Returns the current node. + * + * @method current + * @return {Node} Current node where the walker is. + */ + this.current = function() { + return node; + }; + + /** + * Walks to the next node in tree. + * + * @method next + * @return {Node} Current node where the walker is after moving to the next node. + */ + this.next = function(shallow) { + node = findSibling(node, 'firstChild', 'nextSibling', shallow); + return node; + }; + + /** + * Walks to the previous node in tree. + * + * @method prev + * @return {Node} Current node where the walker is after moving to the previous node. + */ + this.prev = function(shallow) { + node = findSibling(node, 'lastChild', 'previousSibling', shallow); + return node; + }; + }; +}); + +// Included from: js/tinymce/classes/dom/Range.js + +/** + * Range.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +define("tinymce/dom/Range", [ + "tinymce/util/Tools" +], function(Tools) { + // Range constructor + function Range(dom) { + var self = this, + doc = dom.doc, + EXTRACT = 0, + CLONE = 1, + DELETE = 2, + TRUE = true, + FALSE = false, + START_OFFSET = 'startOffset', + START_CONTAINER = 'startContainer', + END_CONTAINER = 'endContainer', + END_OFFSET = 'endOffset', + extend = Tools.extend, + nodeIndex = dom.nodeIndex; + + function createDocumentFragment() { + return doc.createDocumentFragment(); + } + + function setStart(n, o) { + _setEndPoint(TRUE, n, o); + } + + function setEnd(n, o) { + _setEndPoint(FALSE, n, o); + } + + function setStartBefore(n) { + setStart(n.parentNode, nodeIndex(n)); + } + + function setStartAfter(n) { + setStart(n.parentNode, nodeIndex(n) + 1); + } + + function setEndBefore(n) { + setEnd(n.parentNode, nodeIndex(n)); + } + + function setEndAfter(n) { + setEnd(n.parentNode, nodeIndex(n) + 1); + } + + function collapse(ts) { + if (ts) { + self[END_CONTAINER] = self[START_CONTAINER]; + self[END_OFFSET] = self[START_OFFSET]; + } else { + self[START_CONTAINER] = self[END_CONTAINER]; + self[START_OFFSET] = self[END_OFFSET]; + } + + self.collapsed = TRUE; + } + + function selectNode(n) { + setStartBefore(n); + setEndAfter(n); + } + + function selectNodeContents(n) { + setStart(n, 0); + setEnd(n, n.nodeType === 1 ? n.childNodes.length : n.nodeValue.length); + } + + function compareBoundaryPoints(h, r) { + var sc = self[START_CONTAINER], so = self[START_OFFSET], ec = self[END_CONTAINER], eo = self[END_OFFSET], + rsc = r.startContainer, rso = r.startOffset, rec = r.endContainer, reo = r.endOffset; + + // Check START_TO_START + if (h === 0) { + return _compareBoundaryPoints(sc, so, rsc, rso); + } + + // Check START_TO_END + if (h === 1) { + return _compareBoundaryPoints(ec, eo, rsc, rso); + } + + // Check END_TO_END + if (h === 2) { + return _compareBoundaryPoints(ec, eo, rec, reo); + } + + // Check END_TO_START + if (h === 3) { + return _compareBoundaryPoints(sc, so, rec, reo); + } + } + + function deleteContents() { + _traverse(DELETE); + } + + function extractContents() { + return _traverse(EXTRACT); + } + + function cloneContents() { + return _traverse(CLONE); + } + + function insertNode(n) { + var startContainer = this[START_CONTAINER], + startOffset = this[START_OFFSET], nn, o; + + // Node is TEXT_NODE or CDATA + if ((startContainer.nodeType === 3 || startContainer.nodeType === 4) && startContainer.nodeValue) { + if (!startOffset) { + // At the start of text + startContainer.parentNode.insertBefore(n, startContainer); + } else if (startOffset >= startContainer.nodeValue.length) { + // At the end of text + dom.insertAfter(n, startContainer); + } else { + // Middle, need to split + nn = startContainer.splitText(startOffset); + startContainer.parentNode.insertBefore(n, nn); + } + } else { + // Insert element node + if (startContainer.childNodes.length > 0) { + o = startContainer.childNodes[startOffset]; + } + + if (o) { + startContainer.insertBefore(n, o); + } else { + if (startContainer.nodeType == 3) { + dom.insertAfter(n, startContainer); + } else { + startContainer.appendChild(n); + } + } + } + } + + function surroundContents(n) { + var f = self.extractContents(); + + self.insertNode(n); + n.appendChild(f); + self.selectNode(n); + } + + function cloneRange() { + return extend(new Range(dom), { + startContainer: self[START_CONTAINER], + startOffset: self[START_OFFSET], + endContainer: self[END_CONTAINER], + endOffset: self[END_OFFSET], + collapsed: self.collapsed, + commonAncestorContainer: self.commonAncestorContainer + }); + } + + // Private methods + + function _getSelectedNode(container, offset) { + var child; + + if (container.nodeType == 3 /* TEXT_NODE */) { + return container; + } + + if (offset < 0) { + return container; + } + + child = container.firstChild; + while (child && offset > 0) { + --offset; + child = child.nextSibling; + } + + if (child) { + return child; + } + + return container; + } + + function _isCollapsed() { + return (self[START_CONTAINER] == self[END_CONTAINER] && self[START_OFFSET] == self[END_OFFSET]); + } + + function _compareBoundaryPoints(containerA, offsetA, containerB, offsetB) { + var c, offsetC, n, cmnRoot, childA, childB; + + // In the first case the boundary-points have the same container. A is before B + // if its offset is less than the offset of B, A is equal to B if its offset is + // equal to the offset of B, and A is after B if its offset is greater than the + // offset of B. + if (containerA == containerB) { + if (offsetA == offsetB) { + return 0; // equal + } + + if (offsetA < offsetB) { + return -1; // before + } + + return 1; // after + } + + // In the second case a child node C of the container of A is an ancestor + // container of B. In this case, A is before B if the offset of A is less than or + // equal to the index of the child node C and A is after B otherwise. + c = containerB; + while (c && c.parentNode != containerA) { + c = c.parentNode; + } + + if (c) { + offsetC = 0; + n = containerA.firstChild; + + while (n != c && offsetC < offsetA) { + offsetC++; + n = n.nextSibling; + } + + if (offsetA <= offsetC) { + return -1; // before + } + + return 1; // after + } + + // In the third case a child node C of the container of B is an ancestor container + // of A. In this case, A is before B if the index of the child node C is less than + // the offset of B and A is after B otherwise. + c = containerA; + while (c && c.parentNode != containerB) { + c = c.parentNode; + } + + if (c) { + offsetC = 0; + n = containerB.firstChild; + + while (n != c && offsetC < offsetB) { + offsetC++; + n = n.nextSibling; + } + + if (offsetC < offsetB) { + return -1; // before + } + + return 1; // after + } + + // In the fourth case, none of three other cases hold: the containers of A and B + // are siblings or descendants of sibling nodes. In this case, A is before B if + // the container of A is before the container of B in a pre-order traversal of the + // Ranges' context tree and A is after B otherwise. + cmnRoot = dom.findCommonAncestor(containerA, containerB); + childA = containerA; + + while (childA && childA.parentNode != cmnRoot) { + childA = childA.parentNode; + } + + if (!childA) { + childA = cmnRoot; + } + + childB = containerB; + while (childB && childB.parentNode != cmnRoot) { + childB = childB.parentNode; + } + + if (!childB) { + childB = cmnRoot; + } + + if (childA == childB) { + return 0; // equal + } + + n = cmnRoot.firstChild; + while (n) { + if (n == childA) { + return -1; // before + } + + if (n == childB) { + return 1; // after + } + + n = n.nextSibling; + } + } + + function _setEndPoint(st, n, o) { + var ec, sc; + + if (st) { + self[START_CONTAINER] = n; + self[START_OFFSET] = o; + } else { + self[END_CONTAINER] = n; + self[END_OFFSET] = o; + } + + // If one boundary-point of a Range is set to have a root container + // other than the current one for the Range, the Range is collapsed to + // the new position. This enforces the restriction that both boundary- + // points of a Range must have the same root container. + ec = self[END_CONTAINER]; + while (ec.parentNode) { + ec = ec.parentNode; + } + + sc = self[START_CONTAINER]; + while (sc.parentNode) { + sc = sc.parentNode; + } + + if (sc == ec) { + // The start position of a Range is guaranteed to never be after the + // end position. To enforce this restriction, if the start is set to + // be at a position after the end, the Range is collapsed to that + // position. + if (_compareBoundaryPoints(self[START_CONTAINER], self[START_OFFSET], self[END_CONTAINER], self[END_OFFSET]) > 0) { + self.collapse(st); + } + } else { + self.collapse(st); + } + + self.collapsed = _isCollapsed(); + self.commonAncestorContainer = dom.findCommonAncestor(self[START_CONTAINER], self[END_CONTAINER]); + } + + function _traverse(how) { + var c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep; + + if (self[START_CONTAINER] == self[END_CONTAINER]) { + return _traverseSameContainer(how); + } + + for (c = self[END_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) { + if (p == self[START_CONTAINER]) { + return _traverseCommonStartContainer(c, how); + } + + ++endContainerDepth; + } + + for (c = self[START_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) { + if (p == self[END_CONTAINER]) { + return _traverseCommonEndContainer(c, how); + } + + ++startContainerDepth; + } + + depthDiff = startContainerDepth - endContainerDepth; + + startNode = self[START_CONTAINER]; + while (depthDiff > 0) { + startNode = startNode.parentNode; + depthDiff--; + } + + endNode = self[END_CONTAINER]; + while (depthDiff < 0) { + endNode = endNode.parentNode; + depthDiff++; + } + + // ascend the ancestor hierarchy until we have a common parent. + for (sp = startNode.parentNode, ep = endNode.parentNode; sp != ep; sp = sp.parentNode, ep = ep.parentNode) { + startNode = sp; + endNode = ep; + } + + return _traverseCommonAncestors(startNode, endNode, how); + } + + function _traverseSameContainer(how) { + var frag, s, sub, n, cnt, sibling, xferNode, start, len; + + if (how != DELETE) { + frag = createDocumentFragment(); + } + + // If selection is empty, just return the fragment + if (self[START_OFFSET] == self[END_OFFSET]) { + return frag; + } + + // Text node needs special case handling + if (self[START_CONTAINER].nodeType == 3 /* TEXT_NODE */) { + // get the substring + s = self[START_CONTAINER].nodeValue; + sub = s.substring(self[START_OFFSET], self[END_OFFSET]); + + // set the original text node to its new value + if (how != CLONE) { + n = self[START_CONTAINER]; + start = self[START_OFFSET]; + len = self[END_OFFSET] - self[START_OFFSET]; + + if (start === 0 && len >= n.nodeValue.length - 1) { + n.parentNode.removeChild(n); + } else { + n.deleteData(start, len); + } + + // Nothing is partially selected, so collapse to start point + self.collapse(TRUE); + } + + if (how == DELETE) { + return; + } + + if (sub.length > 0) { + frag.appendChild(doc.createTextNode(sub)); + } + + return frag; + } + + // Copy nodes between the start/end offsets. + n = _getSelectedNode(self[START_CONTAINER], self[START_OFFSET]); + cnt = self[END_OFFSET] - self[START_OFFSET]; + + while (n && cnt > 0) { + sibling = n.nextSibling; + xferNode = _traverseFullySelected(n, how); + + if (frag) { + frag.appendChild(xferNode); + } + + --cnt; + n = sibling; + } + + // Nothing is partially selected, so collapse to start point + if (how != CLONE) { + self.collapse(TRUE); + } + + return frag; + } + + function _traverseCommonStartContainer(endAncestor, how) { + var frag, n, endIdx, cnt, sibling, xferNode; + + if (how != DELETE) { + frag = createDocumentFragment(); + } + + n = _traverseRightBoundary(endAncestor, how); + + if (frag) { + frag.appendChild(n); + } + + endIdx = nodeIndex(endAncestor); + cnt = endIdx - self[START_OFFSET]; + + if (cnt <= 0) { + // Collapse to just before the endAncestor, which + // is partially selected. + if (how != CLONE) { + self.setEndBefore(endAncestor); + self.collapse(FALSE); + } + + return frag; + } + + n = endAncestor.previousSibling; + while (cnt > 0) { + sibling = n.previousSibling; + xferNode = _traverseFullySelected(n, how); + + if (frag) { + frag.insertBefore(xferNode, frag.firstChild); + } + + --cnt; + n = sibling; + } + + // Collapse to just before the endAncestor, which + // is partially selected. + if (how != CLONE) { + self.setEndBefore(endAncestor); + self.collapse(FALSE); + } + + return frag; + } + + function _traverseCommonEndContainer(startAncestor, how) { + var frag, startIdx, n, cnt, sibling, xferNode; + + if (how != DELETE) { + frag = createDocumentFragment(); + } + + n = _traverseLeftBoundary(startAncestor, how); + if (frag) { + frag.appendChild(n); + } + + startIdx = nodeIndex(startAncestor); + ++startIdx; // Because we already traversed it + + cnt = self[END_OFFSET] - startIdx; + n = startAncestor.nextSibling; + while (n && cnt > 0) { + sibling = n.nextSibling; + xferNode = _traverseFullySelected(n, how); + + if (frag) { + frag.appendChild(xferNode); + } + + --cnt; + n = sibling; + } + + if (how != CLONE) { + self.setStartAfter(startAncestor); + self.collapse(TRUE); + } + + return frag; + } + + function _traverseCommonAncestors(startAncestor, endAncestor, how) { + var n, frag, startOffset, endOffset, cnt, sibling, nextSibling; + + if (how != DELETE) { + frag = createDocumentFragment(); + } + + n = _traverseLeftBoundary(startAncestor, how); + if (frag) { + frag.appendChild(n); + } + + startOffset = nodeIndex(startAncestor); + endOffset = nodeIndex(endAncestor); + ++startOffset; + + cnt = endOffset - startOffset; + sibling = startAncestor.nextSibling; + + while (cnt > 0) { + nextSibling = sibling.nextSibling; + n = _traverseFullySelected(sibling, how); + + if (frag) { + frag.appendChild(n); + } + + sibling = nextSibling; + --cnt; + } + + n = _traverseRightBoundary(endAncestor, how); + + if (frag) { + frag.appendChild(n); + } + + if (how != CLONE) { + self.setStartAfter(startAncestor); + self.collapse(TRUE); + } + + return frag; + } + + function _traverseRightBoundary(root, how) { + var next = _getSelectedNode(self[END_CONTAINER], self[END_OFFSET] - 1), parent, clonedParent; + var prevSibling, clonedChild, clonedGrandParent, isFullySelected = next != self[END_CONTAINER]; + + if (next == root) { + return _traverseNode(next, isFullySelected, FALSE, how); + } + + parent = next.parentNode; + clonedParent = _traverseNode(parent, FALSE, FALSE, how); + + while (parent) { + while (next) { + prevSibling = next.previousSibling; + clonedChild = _traverseNode(next, isFullySelected, FALSE, how); + + if (how != DELETE) { + clonedParent.insertBefore(clonedChild, clonedParent.firstChild); + } + + isFullySelected = TRUE; + next = prevSibling; + } + + if (parent == root) { + return clonedParent; + } + + next = parent.previousSibling; + parent = parent.parentNode; + + clonedGrandParent = _traverseNode(parent, FALSE, FALSE, how); + + if (how != DELETE) { + clonedGrandParent.appendChild(clonedParent); + } + + clonedParent = clonedGrandParent; + } + } + + function _traverseLeftBoundary(root, how) { + var next = _getSelectedNode(self[START_CONTAINER], self[START_OFFSET]), isFullySelected = next != self[START_CONTAINER]; + var parent, clonedParent, nextSibling, clonedChild, clonedGrandParent; + + if (next == root) { + return _traverseNode(next, isFullySelected, TRUE, how); + } + + parent = next.parentNode; + clonedParent = _traverseNode(parent, FALSE, TRUE, how); + + while (parent) { + while (next) { + nextSibling = next.nextSibling; + clonedChild = _traverseNode(next, isFullySelected, TRUE, how); + + if (how != DELETE) { + clonedParent.appendChild(clonedChild); + } + + isFullySelected = TRUE; + next = nextSibling; + } + + if (parent == root) { + return clonedParent; + } + + next = parent.nextSibling; + parent = parent.parentNode; + + clonedGrandParent = _traverseNode(parent, FALSE, TRUE, how); + + if (how != DELETE) { + clonedGrandParent.appendChild(clonedParent); + } + + clonedParent = clonedGrandParent; + } + } + + function _traverseNode(n, isFullySelected, isLeft, how) { + var txtValue, newNodeValue, oldNodeValue, offset, newNode; + + if (isFullySelected) { + return _traverseFullySelected(n, how); + } + + if (n.nodeType == 3 /* TEXT_NODE */) { + txtValue = n.nodeValue; + + if (isLeft) { + offset = self[START_OFFSET]; + newNodeValue = txtValue.substring(offset); + oldNodeValue = txtValue.substring(0, offset); + } else { + offset = self[END_OFFSET]; + newNodeValue = txtValue.substring(0, offset); + oldNodeValue = txtValue.substring(offset); + } + + if (how != CLONE) { + n.nodeValue = oldNodeValue; + } + + if (how == DELETE) { + return; + } + + newNode = dom.clone(n, FALSE); + newNode.nodeValue = newNodeValue; + + return newNode; + } + + if (how == DELETE) { + return; + } + + return dom.clone(n, FALSE); + } + + function _traverseFullySelected(n, how) { + if (how != DELETE) { + return how == CLONE ? dom.clone(n, TRUE) : n; + } + + n.parentNode.removeChild(n); + } + + function toStringIE() { + return dom.create('body', null, cloneContents()).outerText; + } + + extend(self, { + // Inital states + startContainer: doc, + startOffset: 0, + endContainer: doc, + endOffset: 0, + collapsed: TRUE, + commonAncestorContainer: doc, + + // Range constants + START_TO_START: 0, + START_TO_END: 1, + END_TO_END: 2, + END_TO_START: 3, + + // Public methods + setStart: setStart, + setEnd: setEnd, + setStartBefore: setStartBefore, + setStartAfter: setStartAfter, + setEndBefore: setEndBefore, + setEndAfter: setEndAfter, + collapse: collapse, + selectNode: selectNode, + selectNodeContents: selectNodeContents, + compareBoundaryPoints: compareBoundaryPoints, + deleteContents: deleteContents, + extractContents: extractContents, + cloneContents: cloneContents, + insertNode: insertNode, + surroundContents: surroundContents, + cloneRange: cloneRange, + toStringIE: toStringIE + }); + + return self; + } + + // Older IE versions doesn't let you override toString by it's constructor so we have to stick it in the prototype + Range.prototype.toString = function() { + return this.toStringIE(); + }; + + return Range; +}); + +// Included from: js/tinymce/classes/html/Entities.js + +/** + * Entities.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*jshint bitwise:false */ +/*eslint no-bitwise:0 */ + +/** + * Entity encoder class. + * + * @class tinymce.html.Entities + * @static + * @version 3.4 + */ +define("tinymce/html/Entities", [ + "tinymce/util/Tools" +], function(Tools) { + var makeMap = Tools.makeMap; + + var namedEntities, baseEntities, reverseEntities, + attrsCharsRegExp = /[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + textCharsRegExp = /[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + rawCharsRegExp = /[<>&\"\']/g, + entityRegExp = /&#([a-z0-9]+);?|&([a-z0-9]+);/gi, + asciiMap = { + 128: "\u20AC", 130: "\u201A", 131: "\u0192", 132: "\u201E", 133: "\u2026", 134: "\u2020", + 135: "\u2021", 136: "\u02C6", 137: "\u2030", 138: "\u0160", 139: "\u2039", 140: "\u0152", + 142: "\u017D", 145: "\u2018", 146: "\u2019", 147: "\u201C", 148: "\u201D", 149: "\u2022", + 150: "\u2013", 151: "\u2014", 152: "\u02DC", 153: "\u2122", 154: "\u0161", 155: "\u203A", + 156: "\u0153", 158: "\u017E", 159: "\u0178" + }; + + // Raw entities + baseEntities = { + '\"': '"', // Needs to be escaped since the YUI compressor would otherwise break the code + "'": ''', + '<': '<', + '>': '>', + '&': '&', + '\u0060': '`' + }; + + // Reverse lookup table for raw entities + reverseEntities = { + '<': '<', + '>': '>', + '&': '&', + '"': '"', + ''': "'" + }; + + // Decodes text by using the browser + function nativeDecode(text) { + var elm; + + elm = document.createElement("div"); + elm.innerHTML = text; + + return elm.textContent || elm.innerText || text; + } + + // Build a two way lookup table for the entities + function buildEntitiesLookup(items, radix) { + var i, chr, entity, lookup = {}; + + if (items) { + items = items.split(','); + radix = radix || 10; + + // Build entities lookup table + for (i = 0; i < items.length; i += 2) { + chr = String.fromCharCode(parseInt(items[i], radix)); + + // Only add non base entities + if (!baseEntities[chr]) { + entity = '&' + items[i + 1] + ';'; + lookup[chr] = entity; + lookup[entity] = chr; + } + } + + return lookup; + } + } + + // Unpack entities lookup where the numbers are in radix 32 to reduce the size + namedEntities = buildEntitiesLookup( + '50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' + + '5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' + + '5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' + + '5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' + + '68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' + + '6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' + + '6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' + + '75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' + + '7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' + + '7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' + + 'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' + + 'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' + + 't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' + + 'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' + + 'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' + + '81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' + + '8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' + + '8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' + + '8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' + + '8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' + + 'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' + + 'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' + + 'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' + + '80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' + + '811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32); + + var Entities = { + /** + * Encodes the specified string using raw entities. This means only the required XML base entities will be endoded. + * + * @method encodeRaw + * @param {String} text Text to encode. + * @param {Boolean} attr Optional flag to specify if the text is attribute contents. + * @return {String} Entity encoded text. + */ + encodeRaw: function(text, attr) { + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { + return baseEntities[chr] || chr; + }); + }, + + /** + * Encoded the specified text with both the attributes and text entities. This function will produce larger text contents + * since it doesn't know if the context is within a attribute or text node. This was added for compatibility + * and is exposed as the DOMUtils.encode function. + * + * @method encodeAllRaw + * @param {String} text Text to encode. + * @return {String} Entity encoded text. + */ + encodeAllRaw: function(text) { + return ('' + text).replace(rawCharsRegExp, function(chr) { + return baseEntities[chr] || chr; + }); + }, + + /** + * Encodes the specified string using numeric entities. The core entities will be + * encoded as named ones but all non lower ascii characters will be encoded into numeric entities. + * + * @method encodeNumeric + * @param {String} text Text to encode. + * @param {Boolean} attr Optional flag to specify if the text is attribute contents. + * @return {String} Entity encoded text. + */ + encodeNumeric: function(text, attr) { + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { + // Multi byte sequence convert it to a single entity + if (chr.length > 1) { + return '&#' + (((chr.charCodeAt(0) - 0xD800) * 0x400) + (chr.charCodeAt(1) - 0xDC00) + 0x10000) + ';'; + } + + return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';'; + }); + }, + + /** + * Encodes the specified string using named entities. The core entities will be encoded + * as named ones but all non lower ascii characters will be encoded into named entities. + * + * @method encodeNamed + * @param {String} text Text to encode. + * @param {Boolean} attr Optional flag to specify if the text is attribute contents. + * @param {Object} entities Optional parameter with entities to use. + * @return {String} Entity encoded text. + */ + encodeNamed: function(text, attr, entities) { + entities = entities || namedEntities; + + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { + return baseEntities[chr] || entities[chr] || chr; + }); + }, + + /** + * Returns an encode function based on the name(s) and it's optional entities. + * + * @method getEncodeFunc + * @param {String} name Comma separated list of encoders for example named,numeric. + * @param {String} entities Optional parameter with entities to use instead of the built in set. + * @return {function} Encode function to be used. + */ + getEncodeFunc: function(name, entities) { + entities = buildEntitiesLookup(entities) || namedEntities; + + function encodeNamedAndNumeric(text, attr) { + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { + return baseEntities[chr] || entities[chr] || '&#' + chr.charCodeAt(0) + ';' || chr; + }); + } + + function encodeCustomNamed(text, attr) { + return Entities.encodeNamed(text, attr, entities); + } + + // Replace + with , to be compatible with previous TinyMCE versions + name = makeMap(name.replace(/\+/g, ',')); + + // Named and numeric encoder + if (name.named && name.numeric) { + return encodeNamedAndNumeric; + } + + // Named encoder + if (name.named) { + // Custom names + if (entities) { + return encodeCustomNamed; + } + + return Entities.encodeNamed; + } + + // Numeric + if (name.numeric) { + return Entities.encodeNumeric; + } + + // Raw encoder + return Entities.encodeRaw; + }, + + /** + * Decodes the specified string, this will replace entities with raw UTF characters. + * + * @method decode + * @param {String} text Text to entity decode. + * @return {String} Entity decoded string. + */ + decode: function(text) { + return text.replace(entityRegExp, function(all, numeric) { + if (numeric) { + if (numeric.charAt(0).toLowerCase() === 'x') { + numeric = parseInt(numeric.substr(1), 16); + } else { + numeric = parseInt(numeric, 10); + } + + // Support upper UTF + if (numeric > 0xFFFF) { + numeric -= 0x10000; + + return String.fromCharCode(0xD800 + (numeric >> 10), 0xDC00 + (numeric & 0x3FF)); + } else { + return asciiMap[numeric] || String.fromCharCode(numeric); + } + } + + return reverseEntities[all] || namedEntities[all] || nativeDecode(all); + }); + } + }; + + return Entities; +}); + +// Included from: js/tinymce/classes/dom/StyleSheetLoader.js + +/** + * StyleSheetLoader.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles loading of external stylesheets and fires events when these are loaded. + * + * @class tinymce.dom.StyleSheetLoader + * @private + */ +define("tinymce/dom/StyleSheetLoader", [ + "tinymce/util/Tools" +], function(Tools) { + "use strict"; + + return function(document, settings) { + var idCount = 0, loadedStates = {}, maxLoadTime; + + settings = settings || {}; + maxLoadTime = settings.maxLoadTime || 5000; + + function appendToHead(node) { + document.getElementsByTagName('head')[0].appendChild(node); + } + + /** + * Loads the specified css style sheet file and call the loadedCallback once it's finished loading. + * + * @method load + * @param {String} url Url to be loaded. + * @param {Function} loadedCallback Callback to be executed when loaded. + * @param {Function} errorCallback Callback to be executed when failed loading. + */ + function load(url, loadedCallback, errorCallback) { + var link, style, startTime, state; + + function passed() { + var callbacks = state.passed, i = callbacks.length; + + while (i--) { + callbacks[i](); + } + + state.status = 2; + state.passed = []; + state.failed = []; + } + + function failed() { + var callbacks = state.failed, i = callbacks.length; + + while (i--) { + callbacks[i](); + } + + state.status = 3; + state.passed = []; + state.failed = []; + } + + // Sniffs for older WebKit versions that have the link.onload but a broken one + function isOldWebKit() { + var webKitChunks = navigator.userAgent.match(/WebKit\/(\d*)/); + return !!(webKitChunks && webKitChunks[1] < 536); + } + + // Calls the waitCallback until the test returns true or the timeout occurs + function wait(testCallback, waitCallback) { + if (!testCallback()) { + // Wait for timeout + if ((new Date().getTime()) - startTime < maxLoadTime) { + window.setTimeout(waitCallback, 0); + } else { + failed(); + } + } + } + + // Workaround for WebKit that doesn't properly support the onload event for link elements + // Or WebKit that fires the onload event before the StyleSheet is added to the document + function waitForWebKitLinkLoaded() { + wait(function() { + var styleSheets = document.styleSheets, styleSheet, i = styleSheets.length, owner; + + while (i--) { + styleSheet = styleSheets[i]; + owner = styleSheet.ownerNode ? styleSheet.ownerNode : styleSheet.owningElement; + if (owner && owner.id === link.id) { + passed(); + return true; + } + } + }, waitForWebKitLinkLoaded); + } + + // Workaround for older Geckos that doesn't have any onload event for StyleSheets + function waitForGeckoLinkLoaded() { + wait(function() { + try { + // Accessing the cssRules will throw an exception until the CSS file is loaded + var cssRules = style.sheet.cssRules; + passed(); + return !!cssRules; + } catch (ex) { + // Ignore + } + }, waitForGeckoLinkLoaded); + } + + url = Tools._addCacheSuffix(url); + + if (!loadedStates[url]) { + state = { + passed: [], + failed: [] + }; + + loadedStates[url] = state; + } else { + state = loadedStates[url]; + } + + if (loadedCallback) { + state.passed.push(loadedCallback); + } + + if (errorCallback) { + state.failed.push(errorCallback); + } + + // Is loading wait for it to pass + if (state.status == 1) { + return; + } + + // Has finished loading and was success + if (state.status == 2) { + passed(); + return; + } + + // Has finished loading and was a failure + if (state.status == 3) { + failed(); + return; + } + + // Start loading + state.status = 1; + link = document.createElement('link'); + link.rel = 'stylesheet'; + link.type = 'text/css'; + link.id = 'u' + (idCount++); + link.async = false; + link.defer = false; + startTime = new Date().getTime(); + + // Feature detect onload on link element and sniff older webkits since it has an broken onload event + if ("onload" in link && !isOldWebKit()) { + link.onload = waitForWebKitLinkLoaded; + link.onerror = failed; + } else { + // Sniff for old Firefox that doesn't support the onload event on link elements + // TODO: Remove this in the future when everyone uses modern browsers + if (navigator.userAgent.indexOf("Firefox") > 0) { + style = document.createElement('style'); + style.textContent = '@import "' + url + '"'; + waitForGeckoLinkLoaded(); + appendToHead(style); + return; + } else { + // Use the id owner on older webkits + waitForWebKitLinkLoaded(); + } + } + + appendToHead(link); + link.href = url; + } + + this.load = load; + }; +}); + +// Included from: js/tinymce/classes/dom/DOMUtils.js + +/** + * DOMUtils.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Utility class for various DOM manipulation and retrieval functions. + * + * @class tinymce.dom.DOMUtils + * @example + * // Add a class to an element by id in the page + * tinymce.DOM.addClass('someid', 'someclass'); + * + * // Add a class to an element by id inside the editor + * tinymce.activeEditor.dom.addClass('someid', 'someclass'); + */ +define("tinymce/dom/DOMUtils", [ + "tinymce/dom/Sizzle", + "tinymce/dom/DomQuery", + "tinymce/html/Styles", + "tinymce/dom/EventUtils", + "tinymce/dom/TreeWalker", + "tinymce/dom/Range", + "tinymce/html/Entities", + "tinymce/Env", + "tinymce/util/Tools", + "tinymce/dom/StyleSheetLoader" +], function(Sizzle, $, Styles, EventUtils, TreeWalker, Range, Entities, Env, Tools, StyleSheetLoader) { + // Shorten names + var each = Tools.each, is = Tools.is, grep = Tools.grep, trim = Tools.trim; + var isIE = Env.ie; + var simpleSelectorRe = /^([a-z0-9],?)+$/i; + var whiteSpaceRegExp = /^[ \t\r\n]*$/; + + function setupAttrHooks(domUtils, settings) { + var attrHooks = {}, keepValues = settings.keep_values, keepUrlHook; + + keepUrlHook = { + set: function($elm, value, name) { + if (settings.url_converter) { + value = settings.url_converter.call(settings.url_converter_scope || domUtils, value, name, $elm[0]); + } + + $elm.attr('data-mce-' + name, value).attr(name, value); + }, + + get: function($elm, name) { + return $elm.attr('data-mce-' + name) || $elm.attr(name); + } + }; + + attrHooks = { + style: { + set: function($elm, value) { + if (value !== null && typeof value === 'object') { + $elm.css(value); + return; + } + + if (keepValues) { + $elm.attr('data-mce-style', value); + } + + $elm.attr('style', value); + }, + + get: function($elm) { + var value = $elm.attr('data-mce-style') || $elm.attr('style'); + + value = domUtils.serializeStyle(domUtils.parseStyle(value), $elm[0].nodeName); + + return value; + } + } + }; + + if (keepValues) { + attrHooks.href = attrHooks.src = keepUrlHook; + } + + return attrHooks; + } + + /** + * Constructs a new DOMUtils instance. Consult the Wiki for more details on settings etc for this class. + * + * @constructor + * @method DOMUtils + * @param {Document} d Document reference to bind the utility class to. + * @param {settings} s Optional settings collection. + */ + function DOMUtils(doc, settings) { + var self = this, blockElementsMap; + + self.doc = doc; + self.win = window; + self.files = {}; + self.counter = 0; + self.stdMode = !isIE || doc.documentMode >= 8; + self.boxModel = !isIE || doc.compatMode == "CSS1Compat" || self.stdMode; + self.styleSheetLoader = new StyleSheetLoader(doc); + self.boundEvents = []; + self.settings = settings = settings || {}; + self.schema = settings.schema; + self.styles = new Styles({ + url_converter: settings.url_converter, + url_converter_scope: settings.url_converter_scope + }, settings.schema); + + self.fixDoc(doc); + self.events = settings.ownEvents ? new EventUtils(settings.proxy) : EventUtils.Event; + self.attrHooks = setupAttrHooks(self, settings); + blockElementsMap = settings.schema ? settings.schema.getBlockElements() : {}; + self.$ = $.overrideDefaults(function() { + return { + context: doc, + element: self.getRoot() + }; + }); + + /** + * Returns true/false if the specified element is a block element or not. + * + * @method isBlock + * @param {Node/String} node Element/Node to check. + * @return {Boolean} True/False state if the node is a block element or not. + */ + self.isBlock = function(node) { + // Fix for #5446 + if (!node) { + return false; + } + + // This function is called in module pattern style since it might be executed with the wrong this scope + var type = node.nodeType; + + // If it's a node then check the type and use the nodeName + if (type) { + return !!(type === 1 && blockElementsMap[node.nodeName]); + } + + return !!blockElementsMap[node]; + }; + } + + DOMUtils.prototype = { + $$: function(elm) { + if (typeof elm == 'string') { + elm = this.get(elm); + } + + return this.$(elm); + }, + + root: null, + + fixDoc: function(doc) { + var settings = this.settings, name; + + if (isIE && settings.schema) { + // Add missing HTML 4/5 elements to IE + ('abbr article aside audio canvas ' + + 'details figcaption figure footer ' + + 'header hgroup mark menu meter nav ' + + 'output progress section summary ' + + 'time video').replace(/\w+/g, function(name) { + doc.createElement(name); + }); + + // Create all custom elements + for (name in settings.schema.getCustomElements()) { + doc.createElement(name); + } + } + }, + + clone: function(node, deep) { + var self = this, clone, doc; + + // TODO: Add feature detection here in the future + if (!isIE || node.nodeType !== 1 || deep) { + return node.cloneNode(deep); + } + + doc = self.doc; + + // Make a HTML5 safe shallow copy + if (!deep) { + clone = doc.createElement(node.nodeName); + + // Copy attribs + each(self.getAttribs(node), function(attr) { + self.setAttrib(clone, attr.nodeName, self.getAttrib(node, attr.nodeName)); + }); + + return clone; + } + + return clone.firstChild; + }, + + /** + * Returns the root node of the document. This is normally the body but might be a DIV. Parents like getParent will not + * go above the point of this root node. + * + * @method getRoot + * @return {Element} Root element for the utility class. + */ + getRoot: function() { + var self = this; + + return self.settings.root_element || self.doc.body; + }, + + /** + * Returns the viewport of the window. + * + * @method getViewPort + * @param {Window} win Optional window to get viewport of. + * @return {Object} Viewport object with fields x, y, w and h. + */ + getViewPort: function(win) { + var doc, rootElm; + + win = !win ? this.win : win; + doc = win.document; + rootElm = this.boxModel ? doc.documentElement : doc.body; + + // Returns viewport size excluding scrollbars + return { + x: win.pageXOffset || rootElm.scrollLeft, + y: win.pageYOffset || rootElm.scrollTop, + w: win.innerWidth || rootElm.clientWidth, + h: win.innerHeight || rootElm.clientHeight + }; + }, + + /** + * Returns the rectangle for a specific element. + * + * @method getRect + * @param {Element/String} elm Element object or element ID to get rectangle from. + * @return {object} Rectangle for specified element object with x, y, w, h fields. + */ + getRect: function(elm) { + var self = this, pos, size; + + elm = self.get(elm); + pos = self.getPos(elm); + size = self.getSize(elm); + + return { + x: pos.x, y: pos.y, + w: size.w, h: size.h + }; + }, + + /** + * Returns the size dimensions of the specified element. + * + * @method getSize + * @param {Element/String} elm Element object or element ID to get rectangle from. + * @return {object} Rectangle for specified element object with w, h fields. + */ + getSize: function(elm) { + var self = this, w, h; + + elm = self.get(elm); + w = self.getStyle(elm, 'width'); + h = self.getStyle(elm, 'height'); + + // Non pixel value, then force offset/clientWidth + if (w.indexOf('px') === -1) { + w = 0; + } + + // Non pixel value, then force offset/clientWidth + if (h.indexOf('px') === -1) { + h = 0; + } + + return { + w: parseInt(w, 10) || elm.offsetWidth || elm.clientWidth, + h: parseInt(h, 10) || elm.offsetHeight || elm.clientHeight + }; + }, + + /** + * Returns a node by the specified selector function. This function will + * loop through all parent nodes and call the specified function for each node. + * If the function then returns true indicating that it has found what it was looking for, the loop execution will then end + * and the node it found will be returned. + * + * @method getParent + * @param {Node/String} node DOM node to search parents on or ID string. + * @param {function} selector Selection function or CSS selector to execute on each node. + * @param {Node} root Optional root element, never go below this point. + * @return {Node} DOM Node or null if it wasn't found. + */ + getParent: function(node, selector, root) { + return this.getParents(node, selector, root, false); + }, + + /** + * Returns a node list of all parents matching the specified selector function or pattern. + * If the function then returns true indicating that it has found what it was looking for and that node will be collected. + * + * @method getParents + * @param {Node/String} node DOM node to search parents on or ID string. + * @param {function} selector Selection function to execute on each node or CSS pattern. + * @param {Node} root Optional root element, never go below this point. + * @return {Array} Array of nodes or null if it wasn't found. + */ + getParents: function(node, selector, root, collect) { + var self = this, selectorVal, result = []; + + node = self.get(node); + collect = collect === undefined; + + // Default root on inline mode + root = root || (self.getRoot().nodeName != 'BODY' ? self.getRoot().parentNode : null); + + // Wrap node name as func + if (is(selector, 'string')) { + selectorVal = selector; + + if (selector === '*') { + selector = function(node) { + return node.nodeType == 1; + }; + } else { + selector = function(node) { + return self.is(node, selectorVal); + }; + } + } + + while (node) { + if (node == root || !node.nodeType || node.nodeType === 9) { + break; + } + + if (!selector || selector(node)) { + if (collect) { + result.push(node); + } else { + return node; + } + } + + node = node.parentNode; + } + + return collect ? result : null; + }, + + /** + * Returns the specified element by ID or the input element if it isn't a string. + * + * @method get + * @param {String/Element} n Element id to look for or element to just pass though. + * @return {Element} Element matching the specified id or null if it wasn't found. + */ + get: function(elm) { + var name; + + if (elm && this.doc && typeof elm == 'string') { + name = elm; + elm = this.doc.getElementById(elm); + + // IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick + if (elm && elm.id !== name) { + return this.doc.getElementsByName(name)[1]; + } + } + + return elm; + }, + + /** + * Returns the next node that matches selector or function + * + * @method getNext + * @param {Node} node Node to find siblings from. + * @param {String/function} selector Selector CSS expression or function. + * @return {Node} Next node item matching the selector or null if it wasn't found. + */ + getNext: function(node, selector) { + return this._findSib(node, selector, 'nextSibling'); + }, + + /** + * Returns the previous node that matches selector or function + * + * @method getPrev + * @param {Node} node Node to find siblings from. + * @param {String/function} selector Selector CSS expression or function. + * @return {Node} Previous node item matching the selector or null if it wasn't found. + */ + getPrev: function(node, selector) { + return this._findSib(node, selector, 'previousSibling'); + }, + + // #ifndef jquery + + /** + * Selects specific elements by a CSS level 3 pattern. For example "div#a1 p.test". + * This function is optimized for the most common patterns needed in TinyMCE but it also performs well enough + * on more complex patterns. + * + * @method select + * @param {String} selector CSS level 3 pattern to select/find elements by. + * @param {Object} scope Optional root element/scope element to search in. + * @return {Array} Array with all matched elements. + * @example + * // Adds a class to all paragraphs in the currently active editor + * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'someclass'); + * + * // Adds a class to all spans that have the test class in the currently active editor + * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('span.test'), 'someclass') + */ + select: function(selector, scope) { + var self = this; + + /*eslint new-cap:0 */ + return Sizzle(selector, self.get(scope) || self.settings.root_element || self.doc, []); + }, + + /** + * Returns true/false if the specified element matches the specified css pattern. + * + * @method is + * @param {Node/NodeList} elm DOM node to match or an array of nodes to match. + * @param {String} selector CSS pattern to match the element against. + */ + is: function(elm, selector) { + var i; + + // If it isn't an array then try to do some simple selectors instead of Sizzle for to boost performance + if (elm.length === undefined) { + // Simple all selector + if (selector === '*') { + return elm.nodeType == 1; + } + + // Simple selector just elements + if (simpleSelectorRe.test(selector)) { + selector = selector.toLowerCase().split(/,/); + elm = elm.nodeName.toLowerCase(); + + for (i = selector.length - 1; i >= 0; i--) { + if (selector[i] == elm) { + return true; + } + } + + return false; + } + } + + // Is non element + if (elm.nodeType && elm.nodeType != 1) { + return false; + } + + var elms = elm.nodeType ? [elm] : elm; + + /*eslint new-cap:0 */ + return Sizzle(selector, elms[0].ownerDocument || elms[0], null, elms).length > 0; + }, + + // #endif + + /** + * Adds the specified element to another element or elements. + * + * @method add + * @param {String/Element/Array} parentElm Element id string, DOM node element or array of ids or elements to add to. + * @param {String/Element} name Name of new element to add or existing element to add. + * @param {Object} attrs Optional object collection with arguments to add to the new element(s). + * @param {String} html Optional inner HTML contents to add for each element. + * @return {Element/Array} Element that got created, or an array of created elements if multiple input elements + * were passed in. + * @example + * // Adds a new paragraph to the end of the active editor + * tinymce.activeEditor.dom.add(tinymce.activeEditor.getBody(), 'p', {title: 'my title'}, 'Some content'); + */ + add: function(parentElm, name, attrs, html, create) { + var self = this; + + return this.run(parentElm, function(parentElm) { + var newElm; + + newElm = is(name, 'string') ? self.doc.createElement(name) : name; + self.setAttribs(newElm, attrs); + + if (html) { + if (html.nodeType) { + newElm.appendChild(html); + } else { + self.setHTML(newElm, html); + } + } + + return !create ? parentElm.appendChild(newElm) : newElm; + }); + }, + + /** + * Creates a new element. + * + * @method create + * @param {String} name Name of new element. + * @param {Object} attrs Optional object name/value collection with element attributes. + * @param {String} html Optional HTML string to set as inner HTML of the element. + * @return {Element} HTML DOM node element that got created. + * @example + * // Adds an element where the caret/selection is in the active editor + * var el = tinymce.activeEditor.dom.create('div', {id: 'test', 'class': 'myclass'}, 'some content'); + * tinymce.activeEditor.selection.setNode(el); + */ + create: function(name, attrs, html) { + return this.add(this.doc.createElement(name), name, attrs, html, 1); + }, + + /** + * Creates HTML string for element. The element will be closed unless an empty inner HTML string is passed in. + * + * @method createHTML + * @param {String} name Name of new element. + * @param {Object} attrs Optional object name/value collection with element attributes. + * @param {String} html Optional HTML string to set as inner HTML of the element. + * @return {String} String with new HTML element, for example: test. + * @example + * // Creates a html chunk and inserts it at the current selection/caret location + * tinymce.activeEditor.selection.setContent(tinymce.activeEditor.dom.createHTML('a', {href: 'test.html'}, 'some line')); + */ + createHTML: function(name, attrs, html) { + var outHtml = '', key; + + outHtml += '<' + name; + + for (key in attrs) { + if (attrs.hasOwnProperty(key) && attrs[key] !== null && typeof attrs[key] != 'undefined') { + outHtml += ' ' + key + '="' + this.encode(attrs[key]) + '"'; + } + } + + // A call to tinymce.is doesn't work for some odd reason on IE9 possible bug inside their JS runtime + if (typeof html != "undefined") { + return outHtml + '>' + html + ''; + } + + return outHtml + ' />'; + }, + + /** + * Creates a document fragment out of the specified HTML string. + * + * @method createFragment + * @param {String} html Html string to create fragment from. + * @return {DocumentFragment} Document fragment node. + */ + createFragment: function(html) { + var frag, node, doc = this.doc, container; + + container = doc.createElement("div"); + frag = doc.createDocumentFragment(); + + if (html) { + container.innerHTML = html; + } + + while ((node = container.firstChild)) { + frag.appendChild(node); + } + + return frag; + }, + + /** + * Removes/deletes the specified element(s) from the DOM. + * + * @method remove + * @param {String/Element/Array} node ID of element or DOM element object or array containing multiple elements/ids. + * @param {Boolean} keepChildren Optional state to keep children or not. If set to true all children will be + * placed at the location of the removed element. + * @return {Element/Array} HTML DOM element that got removed, or an array of removed elements if multiple input elements + * were passed in. + * @example + * // Removes all paragraphs in the active editor + * tinymce.activeEditor.dom.remove(tinymce.activeEditor.dom.select('p')); + * + * // Removes an element by id in the document + * tinymce.DOM.remove('mydiv'); + */ + remove: function(node, keepChildren) { + node = this.$$(node); + + if (keepChildren) { + node.each(function() { + var child; + + while ((child = this.firstChild)) { + if (child.nodeType == 3 && child.data.length === 0) { + this.removeChild(child); + } else { + this.parentNode.insertBefore(child, this); + } + } + }).remove(); + } else { + node.remove(); + } + + return node.length > 1 ? node.toArray() : node[0]; + }, + + /** + * Sets the CSS style value on a HTML element. The name can be a camelcase string + * or the CSS style name like background-color. + * + * @method setStyle + * @param {String/Element/Array} n HTML element/Element ID or Array of elements/ids to set CSS style value on. + * @param {String} na Name of the style value to set. + * @param {String} v Value to set on the style. + * @example + * // Sets a style value on all paragraphs in the currently active editor + * tinymce.activeEditor.dom.setStyle(tinymce.activeEditor.dom.select('p'), 'background-color', 'red'); + * + * // Sets a style value to an element by id in the current document + * tinymce.DOM.setStyle('mydiv', 'background-color', 'red'); + */ + setStyle: function(elm, name, value) { + elm = this.$$(elm).css(name, value); + + if (this.settings.update_styles) { + elm.attr('data-mce-style', null); + } + }, + + /** + * Returns the current style or runtime/computed value of an element. + * + * @method getStyle + * @param {String/Element} elm HTML element or element id string to get style from. + * @param {String} name Style name to return. + * @param {Boolean} computed Computed style. + * @return {String} Current style or computed style value of an element. + */ + getStyle: function(elm, name, computed) { + elm = this.$$(elm); + + if (computed) { + return elm.css(name); + } + + // Camelcase it, if needed + name = name.replace(/-(\D)/g, function(a, b) { + return b.toUpperCase(); + }); + + if (name == 'float') { + name = isIE ? 'styleFloat' : 'cssFloat'; + } + + return elm[0] && elm[0].style ? elm[0].style[name] : undefined; + }, + + /** + * Sets multiple styles on the specified element(s). + * + * @method setStyles + * @param {Element/String/Array} e DOM element, element id string or array of elements/ids to set styles on. + * @param {Object} o Name/Value collection of style items to add to the element(s). + * @example + * // Sets styles on all paragraphs in the currently active editor + * tinymce.activeEditor.dom.setStyles(tinymce.activeEditor.dom.select('p'), {'background-color': 'red', 'color': 'green'}); + * + * // Sets styles to an element by id in the current document + * tinymce.DOM.setStyles('mydiv', {'background-color': 'red', 'color': 'green'}); + */ + setStyles: function(elm, styles) { + elm = this.$$(elm).css(styles); + + if (this.settings.update_styles) { + elm.attr('data-mce-style', null); + } + }, + + /** + * Removes all attributes from an element or elements. + * + * @method removeAllAttribs + * @param {Element/String/Array} e DOM element, element id string or array of elements/ids to remove attributes from. + */ + removeAllAttribs: function(e) { + return this.run(e, function(e) { + var i, attrs = e.attributes; + for (i = attrs.length - 1; i >= 0; i--) { + e.removeAttributeNode(attrs.item(i)); + } + }); + }, + + /** + * Sets the specified attribute of an element or elements. + * + * @method setAttrib + * @param {Element/String/Array} e DOM element, element id string or array of elements/ids to set attribute on. + * @param {String} n Name of attribute to set. + * @param {String} v Value to set on the attribute - if this value is falsy like null, 0 or '' it will remove the attribute instead. + * @example + * // Sets class attribute on all paragraphs in the active editor + * tinymce.activeEditor.dom.setAttrib(tinymce.activeEditor.dom.select('p'), 'class', 'myclass'); + * + * // Sets class attribute on a specific element in the current page + * tinymce.dom.setAttrib('mydiv', 'class', 'myclass'); + */ + setAttrib: function(elm, name, value) { + var self = this, originalValue, hook, settings = self.settings; + + if (value === '') { + value = null; + } + + elm = self.$$(elm); + originalValue = elm.attr(name); + + if (!elm.length) { + return; + } + + hook = self.attrHooks[name]; + if (hook && hook.set) { + hook.set(elm, value, name); + } else { + elm.attr(name, value); + } + + if (originalValue != value && settings.onSetAttrib) { + settings.onSetAttrib({ + attrElm: elm, + attrName: name, + attrValue: value + }); + } + }, + + /** + * Sets two or more specified attributes of an element or elements. + * + * @method setAttribs + * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set attributes on. + * @param {Object} attrs Name/Value collection of attribute items to add to the element(s). + * @example + * // Sets class and title attributes on all paragraphs in the active editor + * tinymce.activeEditor.dom.setAttribs(tinymce.activeEditor.dom.select('p'), {'class': 'myclass', title: 'some title'}); + * + * // Sets class and title attributes on a specific element in the current page + * tinymce.DOM.setAttribs('mydiv', {'class': 'myclass', title: 'some title'}); + */ + setAttribs: function(elm, attrs) { + var self = this; + + self.$$(elm).each(function(i, node) { + each(attrs, function(value, name) { + self.setAttrib(node, name, value); + }); + }); + }, + + /** + * Returns the specified attribute by name. + * + * @method getAttrib + * @param {String/Element} elm Element string id or DOM element to get attribute from. + * @param {String} name Name of attribute to get. + * @param {String} defaultVal Optional default value to return if the attribute didn't exist. + * @return {String} Attribute value string, default value or null if the attribute wasn't found. + */ + getAttrib: function(elm, name, defaultVal) { + var self = this, hook, value; + + elm = self.$$(elm); + + if (elm.length) { + hook = self.attrHooks[name]; + + if (hook && hook.get) { + value = hook.get(elm, name); + } else { + value = elm.attr(name); + } + } + + if (typeof value == 'undefined') { + value = defaultVal || ''; + } + + return value; + }, + + /** + * Returns the absolute x, y position of a node. The position will be returned in an object with x, y fields. + * + * @method getPos + * @param {Element/String} elm HTML element or element id to get x, y position from. + * @param {Element} rootElm Optional root element to stop calculations at. + * @return {object} Absolute position of the specified element object with x, y fields. + */ + getPos: function(elm, rootElm) { + var self = this, x = 0, y = 0, offsetParent, doc = self.doc, body = doc.body, pos; + + elm = self.get(elm); + rootElm = rootElm || body; + + if (elm) { + // Use getBoundingClientRect if it exists since it's faster than looping offset nodes + // Fallback to offsetParent calculations if the body isn't static better since it stops at the body root + if (rootElm === body && elm.getBoundingClientRect && $(body).css('position') === 'static') { + pos = elm.getBoundingClientRect(); + rootElm = self.boxModel ? doc.documentElement : body; + + // Add scroll offsets from documentElement or body since IE with the wrong box model will use d.body and so do WebKit + // Also remove the body/documentelement clientTop/clientLeft on IE 6, 7 since they offset the position + x = pos.left + (doc.documentElement.scrollLeft || body.scrollLeft) - rootElm.clientLeft; + y = pos.top + (doc.documentElement.scrollTop || body.scrollTop) - rootElm.clientTop; + + return {x: x, y: y}; + } + + offsetParent = elm; + while (offsetParent && offsetParent != rootElm && offsetParent.nodeType) { + x += offsetParent.offsetLeft || 0; + y += offsetParent.offsetTop || 0; + offsetParent = offsetParent.offsetParent; + } + + offsetParent = elm.parentNode; + while (offsetParent && offsetParent != rootElm && offsetParent.nodeType) { + x -= offsetParent.scrollLeft || 0; + y -= offsetParent.scrollTop || 0; + offsetParent = offsetParent.parentNode; + } + } + + return {x: x, y: y}; + }, + + /** + * Parses the specified style value into an object collection. This parser will also + * merge and remove any redundant items that browsers might have added. It will also convert non-hex + * colors to hex values. Urls inside the styles will also be converted to absolute/relative based on settings. + * + * @method parseStyle + * @param {String} cssText Style value to parse, for example: border:1px solid red;. + * @return {Object} Object representation of that style, for example: {border: '1px solid red'} + */ + parseStyle: function(cssText) { + return this.styles.parse(cssText); + }, + + /** + * Serializes the specified style object into a string. + * + * @method serializeStyle + * @param {Object} styles Object to serialize as string, for example: {border: '1px solid red'} + * @param {String} name Optional element name. + * @return {String} String representation of the style object, for example: border: 1px solid red. + */ + serializeStyle: function(styles, name) { + return this.styles.serialize(styles, name); + }, + + /** + * Adds a style element at the top of the document with the specified cssText content. + * + * @method addStyle + * @param {String} cssText CSS Text style to add to top of head of document. + */ + addStyle: function(cssText) { + var self = this, doc = self.doc, head, styleElm; + + // Prevent inline from loading the same styles twice + if (self !== DOMUtils.DOM && doc === document) { + var addedStyles = DOMUtils.DOM.addedStyles; + + addedStyles = addedStyles || []; + if (addedStyles[cssText]) { + return; + } + + addedStyles[cssText] = true; + DOMUtils.DOM.addedStyles = addedStyles; + } + + // Create style element if needed + styleElm = doc.getElementById('mceDefaultStyles'); + if (!styleElm) { + styleElm = doc.createElement('style'); + styleElm.id = 'mceDefaultStyles'; + styleElm.type = 'text/css'; + + head = doc.getElementsByTagName('head')[0]; + if (head.firstChild) { + head.insertBefore(styleElm, head.firstChild); + } else { + head.appendChild(styleElm); + } + } + + // Append style data to old or new style element + if (styleElm.styleSheet) { + styleElm.styleSheet.cssText += cssText; + } else { + styleElm.appendChild(doc.createTextNode(cssText)); + } + }, + + /** + * Imports/loads the specified CSS file into the document bound to the class. + * + * @method loadCSS + * @param {String} u URL to CSS file to load. + * @example + * // Loads a CSS file dynamically into the current document + * tinymce.DOM.loadCSS('somepath/some.css'); + * + * // Loads a CSS file into the currently active editor instance + * tinymce.activeEditor.dom.loadCSS('somepath/some.css'); + * + * // Loads a CSS file into an editor instance by id + * tinymce.get('someid').dom.loadCSS('somepath/some.css'); + * + * // Loads multiple CSS files into the current document + * tinymce.DOM.loadCSS('somepath/some.css,somepath/someother.css'); + */ + loadCSS: function(url) { + var self = this, doc = self.doc, head; + + // Prevent inline from loading the same CSS file twice + if (self !== DOMUtils.DOM && doc === document) { + DOMUtils.DOM.loadCSS(url); + return; + } + + if (!url) { + url = ''; + } + + head = doc.getElementsByTagName('head')[0]; + + each(url.split(','), function(url) { + var link; + + url = Tools._addCacheSuffix(url); + + if (self.files[url]) { + return; + } + + self.files[url] = true; + link = self.create('link', {rel: 'stylesheet', href: url}); + + // IE 8 has a bug where dynamically loading stylesheets would produce a 1 item remaining bug + // This fix seems to resolve that issue by recalcing the document once a stylesheet finishes loading + // It's ugly but it seems to work fine. + if (isIE && doc.documentMode && doc.recalc) { + link.onload = function() { + if (doc.recalc) { + doc.recalc(); + } + + link.onload = null; + }; + } + + head.appendChild(link); + }); + }, + + /** + * Adds a class to the specified element or elements. + * + * @method addClass + * @param {String/Element/Array} elm Element ID string or DOM element or array with elements or IDs. + * @param {String} cls Class name to add to each element. + * @return {String/Array} String with new class value or array with new class values for all elements. + * @example + * // Adds a class to all paragraphs in the active editor + * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'myclass'); + * + * // Adds a class to a specific element in the current page + * tinymce.DOM.addClass('mydiv', 'myclass'); + */ + addClass: function(elm, cls) { + this.$$(elm).addClass(cls); + }, + + /** + * Removes a class from the specified element or elements. + * + * @method removeClass + * @param {String/Element/Array} elm Element ID string or DOM element or array with elements or IDs. + * @param {String} cls Class name to remove from each element. + * @return {String/Array} String of remaining class name(s), or an array of strings if multiple input elements + * were passed in. + * @example + * // Removes a class from all paragraphs in the active editor + * tinymce.activeEditor.dom.removeClass(tinymce.activeEditor.dom.select('p'), 'myclass'); + * + * // Removes a class from a specific element in the current page + * tinymce.DOM.removeClass('mydiv', 'myclass'); + */ + removeClass: function(elm, cls) { + this.toggleClass(elm, cls, false); + }, + + /** + * Returns true if the specified element has the specified class. + * + * @method hasClass + * @param {String/Element} n HTML element or element id string to check CSS class on. + * @param {String} c CSS class to check for. + * @return {Boolean} true/false if the specified element has the specified class. + */ + hasClass: function(elm, cls) { + return this.$$(elm).hasClass(cls); + }, + + /** + * Toggles the specified class on/off. + * + * @method toggleClass + * @param {Element} elm Element to toggle class on. + * @param {[type]} cls Class to toggle on/off. + * @param {[type]} state Optional state to set. + */ + toggleClass: function(elm, cls, state) { + this.$$(elm).toggleClass(cls, state).each(function() { + if (this.className === '') { + $(this).attr('class', null); + } + }); + }, + + /** + * Shows the specified element(s) by ID by setting the "display" style. + * + * @method show + * @param {String/Element/Array} elm ID of DOM element or DOM element or array with elements or IDs to show. + */ + show: function(elm) { + this.$$(elm).show(); + }, + + /** + * Hides the specified element(s) by ID by setting the "display" style. + * + * @method hide + * @param {String/Element/Array} e ID of DOM element or DOM element or array with elements or IDs to hide. + * @example + * // Hides an element by id in the document + * tinymce.DOM.hide('myid'); + */ + hide: function(elm) { + this.$$(elm).hide(); + }, + + /** + * Returns true/false if the element is hidden or not by checking the "display" style. + * + * @method isHidden + * @param {String/Element} e Id or element to check display state on. + * @return {Boolean} true/false if the element is hidden or not. + */ + isHidden: function(elm) { + return this.$$(elm).css('display') == 'none'; + }, + + /** + * Returns a unique id. This can be useful when generating elements on the fly. + * This method will not check if the element already exists. + * + * @method uniqueId + * @param {String} prefix Optional prefix to add in front of all ids - defaults to "mce_". + * @return {String} Unique id. + */ + uniqueId: function(prefix) { + return (!prefix ? 'mce_' : prefix) + (this.counter++); + }, + + /** + * Sets the specified HTML content inside the element or elements. The HTML will first be processed. This means + * URLs will get converted, hex color values fixed etc. Check processHTML for details. + * + * @method setHTML + * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set HTML inside of. + * @param {String} h HTML content to set as inner HTML of the element. + * @example + * // Sets the inner HTML of all paragraphs in the active editor + * tinymce.activeEditor.dom.setHTML(tinymce.activeEditor.dom.select('p'), 'some inner html'); + * + * // Sets the inner HTML of an element by id in the document + * tinymce.DOM.setHTML('mydiv', 'some inner html'); + */ + setHTML: function(elm, html) { + elm = this.$$(elm); + + if (isIE) { + elm.each(function(i, target) { + if (target.canHaveHTML === false) { + return; + } + + // Remove all child nodes, IE keeps empty text nodes in DOM + while (target.firstChild) { + target.removeChild(target.firstChild); + } + + try { + // IE will remove comments from the beginning + // unless you padd the contents with something + target.innerHTML = '
    ' + html; + target.removeChild(target.firstChild); + } catch (ex) { + // IE sometimes produces an unknown runtime error on innerHTML if it's a div inside a p + $('
    ').html('
    ' + html).contents().slice(1).appendTo(target); + } + + return html; + }); + } else { + elm.html(html); + } + }, + + /** + * Returns the outer HTML of an element. + * + * @method getOuterHTML + * @param {String/Element} elm Element ID or element object to get outer HTML from. + * @return {String} Outer HTML string. + * @example + * tinymce.DOM.getOuterHTML(editorElement); + * tinymce.activeEditor.getOuterHTML(tinymce.activeEditor.getBody()); + */ + getOuterHTML: function(elm) { + elm = this.get(elm); + + // Older FF doesn't have outerHTML 3.6 is still used by some orgaizations + return elm.nodeType == 1 && "outerHTML" in elm ? elm.outerHTML : $('
    ').append($(elm).clone()).html(); + }, + + /** + * Sets the specified outer HTML on an element or elements. + * + * @method setOuterHTML + * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set outer HTML on. + * @param {Object} html HTML code to set as outer value for the element. + * @param {Document} doc Optional document scope to use in this process - defaults to the document of the DOM class. + * @example + * // Sets the outer HTML of all paragraphs in the active editor + * tinymce.activeEditor.dom.setOuterHTML(tinymce.activeEditor.dom.select('p'), '
    some html
    '); + * + * // Sets the outer HTML of an element by id in the document + * tinymce.DOM.setOuterHTML('mydiv', '
    some html
    '); + */ + setOuterHTML: function(elm, html) { + var self = this; + + self.$$(elm).each(function() { + try { + // Older FF doesn't have outerHTML 3.6 is still used by some orgaizations + if ("outerHTML" in this) { + this.outerHTML = html; + return; + } + } catch (ex) { + // Ignore + } + + // OuterHTML for IE it sometimes produces an "unknown runtime error" + self.remove($(this).html(html), true); + }); + }, + + /** + * Entity decodes a string. This method decodes any HTML entities, such as å. + * + * @method decode + * @param {String} s String to decode entities on. + * @return {String} Entity decoded string. + */ + decode: Entities.decode, + + /** + * Entity encodes a string. This method encodes the most common entities, such as <>"&. + * + * @method encode + * @param {String} text String to encode with entities. + * @return {String} Entity encoded string. + */ + encode: Entities.encodeAllRaw, + + /** + * Inserts an element after the reference element. + * + * @method insertAfter + * @param {Element} node Element to insert after the reference. + * @param {Element/String/Array} reference_node Reference element, element id or array of elements to insert after. + * @return {Element/Array} Element that got added or an array with elements. + */ + insertAfter: function(node, referenceNode) { + referenceNode = this.get(referenceNode); + + return this.run(node, function(node) { + var parent, nextSibling; + + parent = referenceNode.parentNode; + nextSibling = referenceNode.nextSibling; + + if (nextSibling) { + parent.insertBefore(node, nextSibling); + } else { + parent.appendChild(node); + } + + return node; + }); + }, + + /** + * Replaces the specified element or elements with the new element specified. The new element will + * be cloned if multiple input elements are passed in. + * + * @method replace + * @param {Element} newElm New element to replace old ones with. + * @param {Element/String/Array} oldELm Element DOM node, element id or array of elements or ids to replace. + * @param {Boolean} k Optional keep children state, if set to true child nodes from the old object will be added to new ones. + */ + replace: function(newElm, oldElm, keepChildren) { + var self = this; + + return self.run(oldElm, function(oldElm) { + if (is(oldElm, 'array')) { + newElm = newElm.cloneNode(true); + } + + if (keepChildren) { + each(grep(oldElm.childNodes), function(node) { + newElm.appendChild(node); + }); + } + + return oldElm.parentNode.replaceChild(newElm, oldElm); + }); + }, + + /** + * Renames the specified element and keeps its attributes and children. + * + * @method rename + * @param {Element} elm Element to rename. + * @param {String} name Name of the new element. + * @return {Element} New element or the old element if it needed renaming. + */ + rename: function(elm, name) { + var self = this, newElm; + + if (elm.nodeName != name.toUpperCase()) { + // Rename block element + newElm = self.create(name); + + // Copy attribs to new block + each(self.getAttribs(elm), function(attrNode) { + self.setAttrib(newElm, attrNode.nodeName, self.getAttrib(elm, attrNode.nodeName)); + }); + + // Replace block + self.replace(newElm, elm, 1); + } + + return newElm || elm; + }, + + /** + * Find the common ancestor of two elements. This is a shorter method than using the DOM Range logic. + * + * @method findCommonAncestor + * @param {Element} a Element to find common ancestor of. + * @param {Element} b Element to find common ancestor of. + * @return {Element} Common ancestor element of the two input elements. + */ + findCommonAncestor: function(a, b) { + var ps = a, pe; + + while (ps) { + pe = b; + + while (pe && ps != pe) { + pe = pe.parentNode; + } + + if (ps == pe) { + break; + } + + ps = ps.parentNode; + } + + if (!ps && a.ownerDocument) { + return a.ownerDocument.documentElement; + } + + return ps; + }, + + /** + * Parses the specified RGB color value and returns a hex version of that color. + * + * @method toHex + * @param {String} rgbVal RGB string value like rgb(1,2,3) + * @return {String} Hex version of that RGB value like #FF00FF. + */ + toHex: function(rgbVal) { + return this.styles.toHex(Tools.trim(rgbVal)); + }, + + /** + * Executes the specified function on the element by id or dom element node or array of elements/id. + * + * @method run + * @param {String/Element/Array} Element ID or DOM element object or array with ids or elements. + * @param {function} f Function to execute for each item. + * @param {Object} s Optional scope to execute the function in. + * @return {Object/Array} Single object, or an array of objects if multiple input elements were passed in. + */ + run: function(elm, func, scope) { + var self = this, result; + + if (typeof elm === 'string') { + elm = self.get(elm); + } + + if (!elm) { + return false; + } + + scope = scope || this; + if (!elm.nodeType && (elm.length || elm.length === 0)) { + result = []; + + each(elm, function(elm, i) { + if (elm) { + if (typeof elm == 'string') { + elm = self.get(elm); + } + + result.push(func.call(scope, elm, i)); + } + }); + + return result; + } + + return func.call(scope, elm); + }, + + /** + * Returns a NodeList with attributes for the element. + * + * @method getAttribs + * @param {HTMLElement/string} elm Element node or string id to get attributes from. + * @return {NodeList} NodeList with attributes. + */ + getAttribs: function(elm) { + var attrs; + + elm = this.get(elm); + + if (!elm) { + return []; + } + + if (isIE) { + attrs = []; + + // Object will throw exception in IE + if (elm.nodeName == 'OBJECT') { + return elm.attributes; + } + + // IE doesn't keep the selected attribute if you clone option elements + if (elm.nodeName === 'OPTION' && this.getAttrib(elm, 'selected')) { + attrs.push({specified: 1, nodeName: 'selected'}); + } + + // It's crazy that this is faster in IE but it's because it returns all attributes all the time + var attrRegExp = /<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi; + elm.cloneNode(false).outerHTML.replace(attrRegExp, '').replace(/[\w:\-]+/gi, function(a) { + attrs.push({specified: 1, nodeName: a}); + }); + + return attrs; + } + + return elm.attributes; + }, + + /** + * Returns true/false if the specified node is to be considered empty or not. + * + * @example + * tinymce.DOM.isEmpty(node, {img: true}); + * @method isEmpty + * @param {Object} elements Optional name/value object with elements that are automatically treated as non-empty elements. + * @return {Boolean} true/false if the node is empty or not. + */ + isEmpty: function(node, elements) { + var self = this, i, attributes, type, walker, name, brCount = 0; + + node = node.firstChild; + if (node) { + walker = new TreeWalker(node, node.parentNode); + elements = elements || (self.schema ? self.schema.getNonEmptyElements() : null); + + do { + type = node.nodeType; + + if (type === 1) { + // Ignore bogus elements + if (node.getAttribute('data-mce-bogus')) { + continue; + } + + // Keep empty elements like + name = node.nodeName.toLowerCase(); + if (elements && elements[name]) { + // Ignore single BR elements in blocks like


    or


    + if (name === 'br') { + brCount++; + continue; + } + + return false; + } + + // Keep elements with data-bookmark attributes or name attribute like + attributes = self.getAttribs(node); + i = attributes.length; + while (i--) { + name = attributes[i].nodeName; + if (name === "name" || name === 'data-mce-bookmark') { + return false; + } + } + } + + // Keep comment nodes + if (type == 8) { + return false; + } + + // Keep non whitespace text nodes + if ((type === 3 && !whiteSpaceRegExp.test(node.nodeValue))) { + return false; + } + } while ((node = walker.next())); + } + + return brCount <= 1; + }, + + /** + * Creates a new DOM Range object. This will use the native DOM Range API if it's + * available. If it's not, it will fall back to the custom TinyMCE implementation. + * + * @method createRng + * @return {DOMRange} DOM Range object. + * @example + * var rng = tinymce.DOM.createRng(); + * alert(rng.startContainer + "," + rng.startOffset); + */ + createRng: function() { + var doc = this.doc; + + return doc.createRange ? doc.createRange() : new Range(this); + }, + + /** + * Returns the index of the specified node within its parent. + * + * @method nodeIndex + * @param {Node} node Node to look for. + * @param {boolean} normalized Optional true/false state if the index is what it would be after a normalization. + * @return {Number} Index of the specified node. + */ + nodeIndex: function(node, normalized) { + var idx = 0, lastNodeType, nodeType; + + if (node) { + for (lastNodeType = node.nodeType, node = node.previousSibling; node; node = node.previousSibling) { + nodeType = node.nodeType; + + // Normalize text nodes + if (normalized && nodeType == 3) { + if (nodeType == lastNodeType || !node.nodeValue.length) { + continue; + } + } + idx++; + lastNodeType = nodeType; + } + } + + return idx; + }, + + /** + * Splits an element into two new elements and places the specified split + * element or elements between the new ones. For example splitting the paragraph at the bold element in + * this example

    abcabc123

    would produce

    abc

    abc

    123

    . + * + * @method split + * @param {Element} parentElm Parent element to split. + * @param {Element} splitElm Element to split at. + * @param {Element} replacementElm Optional replacement element to replace the split element with. + * @return {Element} Returns the split element or the replacement element if that is specified. + */ + split: function(parentElm, splitElm, replacementElm) { + var self = this, r = self.createRng(), bef, aft, pa; + + // W3C valid browsers tend to leave empty nodes to the left/right side of the contents - this makes sense + // but we don't want that in our code since it serves no purpose for the end user + // For example splitting this html at the bold element: + //

    text 1CHOPtext 2

    + // would produce: + //

    text 1

    CHOP

    text 2

    + // this function will then trim off empty edges and produce: + //

    text 1

    CHOP

    text 2

    + function trimNode(node) { + var i, children = node.childNodes, type = node.nodeType; + + function surroundedBySpans(node) { + var previousIsSpan = node.previousSibling && node.previousSibling.nodeName == 'SPAN'; + var nextIsSpan = node.nextSibling && node.nextSibling.nodeName == 'SPAN'; + return previousIsSpan && nextIsSpan; + } + + if (type == 1 && node.getAttribute('data-mce-type') == 'bookmark') { + return; + } + + for (i = children.length - 1; i >= 0; i--) { + trimNode(children[i]); + } + + if (type != 9) { + // Keep non whitespace text nodes + if (type == 3 && node.nodeValue.length > 0) { + // If parent element isn't a block or there isn't any useful contents for example "

    " + // Also keep text nodes with only spaces if surrounded by spans. + // eg. "

    a b

    " should keep space between a and b + var trimmedLength = trim(node.nodeValue).length; + if (!self.isBlock(node.parentNode) || trimmedLength > 0 || trimmedLength === 0 && surroundedBySpans(node)) { + return; + } + } else if (type == 1) { + // If the only child is a bookmark then move it up + children = node.childNodes; + + // TODO fix this complex if + if (children.length == 1 && children[0] && children[0].nodeType == 1 && + children[0].getAttribute('data-mce-type') == 'bookmark') { + node.parentNode.insertBefore(children[0], node); + } + + // Keep non empty elements or img, hr etc + if (children.length || /^(br|hr|input|img)$/i.test(node.nodeName)) { + return; + } + } + + self.remove(node); + } + + return node; + } + + if (parentElm && splitElm) { + // Get before chunk + r.setStart(parentElm.parentNode, self.nodeIndex(parentElm)); + r.setEnd(splitElm.parentNode, self.nodeIndex(splitElm)); + bef = r.extractContents(); + + // Get after chunk + r = self.createRng(); + r.setStart(splitElm.parentNode, self.nodeIndex(splitElm) + 1); + r.setEnd(parentElm.parentNode, self.nodeIndex(parentElm) + 1); + aft = r.extractContents(); + + // Insert before chunk + pa = parentElm.parentNode; + pa.insertBefore(trimNode(bef), parentElm); + + // Insert middle chunk + if (replacementElm) { + pa.replaceChild(replacementElm, splitElm); + } else { + pa.insertBefore(splitElm, parentElm); + } + + // Insert after chunk + pa.insertBefore(trimNode(aft), parentElm); + self.remove(parentElm); + + return replacementElm || splitElm; + } + }, + + /** + * Adds an event handler to the specified object. + * + * @method bind + * @param {Element/Document/Window/Array} target Target element to bind events to. + * handler to or an array of elements/ids/documents. + * @param {String} name Name of event handler to add, for example: click. + * @param {function} func Function to execute when the event occurs. + * @param {Object} scope Optional scope to execute the function in. + * @return {function} Function callback handler the same as the one passed in. + */ + bind: function(target, name, func, scope) { + var self = this; + + if (Tools.isArray(target)) { + var i = target.length; + + while (i--) { + target[i] = self.bind(target[i], name, func, scope); + } + + return target; + } + + // Collect all window/document events bound by editor instance + if (self.settings.collect && (target === self.doc || target === self.win)) { + self.boundEvents.push([target, name, func, scope]); + } + + return self.events.bind(target, name, func, scope || self); + }, + + /** + * Removes the specified event handler by name and function from an element or collection of elements. + * + * @method unbind + * @param {Element/Document/Window/Array} target Target element to unbind events on. + * @param {String} name Event handler name, for example: "click" + * @param {function} func Function to remove. + * @return {bool/Array} Bool state of true if the handler was removed, or an array of states if multiple input elements + * were passed in. + */ + unbind: function(target, name, func) { + var self = this, i; + + if (Tools.isArray(target)) { + i = target.length; + + while (i--) { + target[i] = self.unbind(target[i], name, func); + } + + return target; + } + + // Remove any bound events matching the input + if (self.boundEvents && (target === self.doc || target === self.win)) { + i = self.boundEvents.length; + + while (i--) { + var item = self.boundEvents[i]; + + if (target == item[0] && (!name || name == item[1]) && (!func || func == item[2])) { + this.events.unbind(item[0], item[1], item[2]); + } + } + } + + return this.events.unbind(target, name, func); + }, + + /** + * Fires the specified event name with object on target. + * + * @method fire + * @param {Node/Document/Window} target Target element or object to fire event on. + * @param {String} name Name of the event to fire. + * @param {Object} evt Event object to send. + * @return {Event} Event object. + */ + fire: function(target, name, evt) { + return this.events.fire(target, name, evt); + }, + + // Returns the content editable state of a node + getContentEditable: function(node) { + var contentEditable; + + // Check type + if (!node || node.nodeType != 1) { + return null; + } + + // Check for fake content editable + contentEditable = node.getAttribute("data-mce-contenteditable"); + if (contentEditable && contentEditable !== "inherit") { + return contentEditable; + } + + // Check for real content editable + return node.contentEditable !== "inherit" ? node.contentEditable : null; + }, + + getContentEditableParent: function(node) { + var root = this.getRoot(), state = null; + + for (; node && node !== root; node = node.parentNode) { + state = this.getContentEditable(node); + + if (state !== null) { + break; + } + } + + return state; + }, + + /** + * Destroys all internal references to the DOM to solve IE leak issues. + * + * @method destroy + */ + destroy: function() { + var self = this; + + // Unbind all events bound to window/document by editor instance + if (self.boundEvents) { + var i = self.boundEvents.length; + + while (i--) { + var item = self.boundEvents[i]; + this.events.unbind(item[0], item[1], item[2]); + } + + self.boundEvents = null; + } + + // Restore sizzle document to window.document + // Since the current document might be removed producing "Permission denied" on IE see #6325 + if (Sizzle.setDocument) { + Sizzle.setDocument(); + } + + self.win = self.doc = self.root = self.events = self.frag = null; + }, + + isChildOf: function(node, parent) { + while (node) { + if (parent === node) { + return true; + } + + node = node.parentNode; + } + + return false; + }, + + // #ifdef debug + + dumpRng: function(r) { + return ( + 'startContainer: ' + r.startContainer.nodeName + + ', startOffset: ' + r.startOffset + + ', endContainer: ' + r.endContainer.nodeName + + ', endOffset: ' + r.endOffset + ); + }, + + // #endif + + _findSib: function(node, selector, name) { + var self = this, func = selector; + + if (node) { + // If expression make a function of it using is + if (typeof func == 'string') { + func = function(node) { + return self.is(node, selector); + }; + } + + // Loop all siblings + for (node = node[name]; node; node = node[name]) { + if (func(node)) { + return node; + } + } + } + + return null; + } + }; + + /** + * Instance of DOMUtils for the current document. + * + * @static + * @property DOM + * @type tinymce.dom.DOMUtils + * @example + * // Example of how to add a class to some element by id + * tinymce.DOM.addClass('someid', 'someclass'); + */ + DOMUtils.DOM = new DOMUtils(document); + + return DOMUtils; +}); + +// Included from: js/tinymce/classes/dom/ScriptLoader.js + +/** + * ScriptLoader.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*globals console*/ + +/** + * This class handles asynchronous/synchronous loading of JavaScript files it will execute callbacks + * when various items gets loaded. This class is useful to load external JavaScript files. + * + * @class tinymce.dom.ScriptLoader + * @example + * // Load a script from a specific URL using the global script loader + * tinymce.ScriptLoader.load('somescript.js'); + * + * // Load a script using a unique instance of the script loader + * var scriptLoader = new tinymce.dom.ScriptLoader(); + * + * scriptLoader.load('somescript.js'); + * + * // Load multiple scripts + * var scriptLoader = new tinymce.dom.ScriptLoader(); + * + * scriptLoader.add('somescript1.js'); + * scriptLoader.add('somescript2.js'); + * scriptLoader.add('somescript3.js'); + * + * scriptLoader.loadQueue(function() { + * alert('All scripts are now loaded.'); + * }); + */ +define("tinymce/dom/ScriptLoader", [ + "tinymce/dom/DOMUtils", + "tinymce/util/Tools" +], function(DOMUtils, Tools) { + var DOM = DOMUtils.DOM; + var each = Tools.each, grep = Tools.grep; + + function ScriptLoader() { + var QUEUED = 0, + LOADING = 1, + LOADED = 2, + states = {}, + queue = [], + scriptLoadedCallbacks = {}, + queueLoadedCallbacks = [], + loading = 0, + undef; + + /** + * Loads a specific script directly without adding it to the load queue. + * + * @method load + * @param {String} url Absolute URL to script to add. + * @param {function} callback Optional callback function to execute ones this script gets loaded. + * @param {Object} scope Optional scope to execute callback in. + */ + function loadScript(url, callback) { + var dom = DOM, elm, id; + + // Execute callback when script is loaded + function done() { + dom.remove(id); + + if (elm) { + elm.onreadystatechange = elm.onload = elm = null; + } + + callback(); + } + + function error() { + /*eslint no-console:0 */ + + // Report the error so it's easier for people to spot loading errors + if (typeof console !== "undefined" && console.log) { + console.log("Failed to load: " + url); + } + + // We can't mark it as done if there is a load error since + // A) We don't want to produce 404 errors on the server and + // B) the onerror event won't fire on all browsers. + // done(); + } + + id = dom.uniqueId(); + + // Create new script element + elm = document.createElement('script'); + elm.id = id; + elm.type = 'text/javascript'; + elm.src = Tools._addCacheSuffix(url); + + // Seems that onreadystatechange works better on IE 10 onload seems to fire incorrectly + if ("onreadystatechange" in elm) { + elm.onreadystatechange = function() { + if (/loaded|complete/.test(elm.readyState)) { + done(); + } + }; + } else { + elm.onload = done; + } + + // Add onerror event will get fired on some browsers but not all of them + elm.onerror = error; + + // Add script to document + (document.getElementsByTagName('head')[0] || document.body).appendChild(elm); + } + + /** + * Returns true/false if a script has been loaded or not. + * + * @method isDone + * @param {String} url URL to check for. + * @return {Boolean} true/false if the URL is loaded. + */ + this.isDone = function(url) { + return states[url] == LOADED; + }; + + /** + * Marks a specific script to be loaded. This can be useful if a script got loaded outside + * the script loader or to skip it from loading some script. + * + * @method markDone + * @param {string} u Absolute URL to the script to mark as loaded. + */ + this.markDone = function(url) { + states[url] = LOADED; + }; + + /** + * Adds a specific script to the load queue of the script loader. + * + * @method add + * @param {String} url Absolute URL to script to add. + * @param {function} callback Optional callback function to execute ones this script gets loaded. + * @param {Object} scope Optional scope to execute callback in. + */ + this.add = this.load = function(url, callback, scope) { + var state = states[url]; + + // Add url to load queue + if (state == undef) { + queue.push(url); + states[url] = QUEUED; + } + + if (callback) { + // Store away callback for later execution + if (!scriptLoadedCallbacks[url]) { + scriptLoadedCallbacks[url] = []; + } + + scriptLoadedCallbacks[url].push({ + func: callback, + scope: scope || this + }); + } + }; + + /** + * Starts the loading of the queue. + * + * @method loadQueue + * @param {function} callback Optional callback to execute when all queued items are loaded. + * @param {Object} scope Optional scope to execute the callback in. + */ + this.loadQueue = function(callback, scope) { + this.loadScripts(queue, callback, scope); + }; + + /** + * Loads the specified queue of files and executes the callback ones they are loaded. + * This method is generally not used outside this class but it might be useful in some scenarios. + * + * @method loadScripts + * @param {Array} scripts Array of queue items to load. + * @param {function} callback Optional callback to execute ones all items are loaded. + * @param {Object} scope Optional scope to execute callback in. + */ + this.loadScripts = function(scripts, callback, scope) { + var loadScripts; + + function execScriptLoadedCallbacks(url) { + // Execute URL callback functions + each(scriptLoadedCallbacks[url], function(callback) { + callback.func.call(callback.scope); + }); + + scriptLoadedCallbacks[url] = undef; + } + + queueLoadedCallbacks.push({ + func: callback, + scope: scope || this + }); + + loadScripts = function() { + var loadingScripts = grep(scripts); + + // Current scripts has been handled + scripts.length = 0; + + // Load scripts that needs to be loaded + each(loadingScripts, function(url) { + // Script is already loaded then execute script callbacks directly + if (states[url] == LOADED) { + execScriptLoadedCallbacks(url); + return; + } + + // Is script not loading then start loading it + if (states[url] != LOADING) { + states[url] = LOADING; + loading++; + + loadScript(url, function() { + states[url] = LOADED; + loading--; + + execScriptLoadedCallbacks(url); + + // Load more scripts if they where added by the recently loaded script + loadScripts(); + }); + } + }); + + // No scripts are currently loading then execute all pending queue loaded callbacks + if (!loading) { + each(queueLoadedCallbacks, function(callback) { + callback.func.call(callback.scope); + }); + + queueLoadedCallbacks.length = 0; + } + }; + + loadScripts(); + }; + } + + ScriptLoader.ScriptLoader = new ScriptLoader(); + + return ScriptLoader; +}); + +// Included from: js/tinymce/classes/AddOnManager.js + +/** + * AddOnManager.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles the loading of themes/plugins or other add-ons and their language packs. + * + * @class tinymce.AddOnManager + */ +define("tinymce/AddOnManager", [ + "tinymce/dom/ScriptLoader", + "tinymce/util/Tools" +], function(ScriptLoader, Tools) { + var each = Tools.each; + + function AddOnManager() { + var self = this; + + self.items = []; + self.urls = {}; + self.lookup = {}; + } + + AddOnManager.prototype = { + /** + * Returns the specified add on by the short name. + * + * @method get + * @param {String} name Add-on to look for. + * @return {tinymce.Theme/tinymce.Plugin} Theme or plugin add-on instance or undefined. + */ + get: function(name) { + if (this.lookup[name]) { + return this.lookup[name].instance; + } else { + return undefined; + } + }, + + dependencies: function(name) { + var result; + + if (this.lookup[name]) { + result = this.lookup[name].dependencies; + } + + return result || []; + }, + + /** + * Loads a language pack for the specified add-on. + * + * @method requireLangPack + * @param {String} name Short name of the add-on. + * @param {String} languages Optional comma or space separated list of languages to check if it matches the name. + */ + requireLangPack: function(name, languages) { + var language = AddOnManager.language; + + if (language && AddOnManager.languageLoad !== false) { + if (languages) { + languages = ',' + languages + ','; + + // Load short form sv.js or long form sv_SE.js + if (languages.indexOf(',' + language.substr(0, 2) + ',') != -1) { + language = language.substr(0, 2); + } else if (languages.indexOf(',' + language + ',') == -1) { + return; + } + } + + ScriptLoader.ScriptLoader.add(this.urls[name] + '/langs/' + language + '.js'); + } + }, + + /** + * Adds a instance of the add-on by it's short name. + * + * @method add + * @param {String} id Short name/id for the add-on. + * @param {tinymce.Theme/tinymce.Plugin} addOn Theme or plugin to add. + * @return {tinymce.Theme/tinymce.Plugin} The same theme or plugin instance that got passed in. + * @example + * // Create a simple plugin + * tinymce.create('tinymce.plugins.TestPlugin', { + * TestPlugin: function(ed, url) { + * ed.on('click', function(e) { + * ed.windowManager.alert('Hello World!'); + * }); + * } + * }); + * + * // Register plugin using the add method + * tinymce.PluginManager.add('test', tinymce.plugins.TestPlugin); + * + * // Initialize TinyMCE + * tinymce.init({ + * ... + * plugins: '-test' // Init the plugin but don't try to load it + * }); + */ + add: function(id, addOn, dependencies) { + this.items.push(addOn); + this.lookup[id] = {instance: addOn, dependencies: dependencies}; + + return addOn; + }, + + createUrl: function(baseUrl, dep) { + if (typeof dep === "object") { + return dep; + } else { + return {prefix: baseUrl.prefix, resource: dep, suffix: baseUrl.suffix}; + } + }, + + /** + * Add a set of components that will make up the add-on. Using the url of the add-on name as the base url. + * This should be used in development mode. A new compressor/javascript munger process will ensure that the + * components are put together into the plugin.js file and compressed correctly. + * + * @method addComponents + * @param {String} pluginName name of the plugin to load scripts from (will be used to get the base url for the plugins). + * @param {Array} scripts Array containing the names of the scripts to load. + */ + addComponents: function(pluginName, scripts) { + var pluginUrl = this.urls[pluginName]; + + each(scripts, function(script) { + ScriptLoader.ScriptLoader.add(pluginUrl + "/" + script); + }); + }, + + /** + * Loads an add-on from a specific url. + * + * @method load + * @param {String} name Short name of the add-on that gets loaded. + * @param {String} addOnUrl URL to the add-on that will get loaded. + * @param {function} callback Optional callback to execute ones the add-on is loaded. + * @param {Object} scope Optional scope to execute the callback in. + * @example + * // Loads a plugin from an external URL + * tinymce.PluginManager.load('myplugin', '/some/dir/someplugin/plugin.js'); + * + * // Initialize TinyMCE + * tinymce.init({ + * ... + * plugins: '-myplugin' // Don't try to load it again + * }); + */ + load: function(name, addOnUrl, callback, scope) { + var self = this, url = addOnUrl; + + function loadDependencies() { + var dependencies = self.dependencies(name); + + each(dependencies, function(dep) { + var newUrl = self.createUrl(addOnUrl, dep); + + self.load(newUrl.resource, newUrl, undefined, undefined); + }); + + if (callback) { + if (scope) { + callback.call(scope); + } else { + callback.call(ScriptLoader); + } + } + } + + if (self.urls[name]) { + return; + } + + if (typeof addOnUrl === "object") { + url = addOnUrl.prefix + addOnUrl.resource + addOnUrl.suffix; + } + + if (url.indexOf('/') !== 0 && url.indexOf('://') == -1) { + url = AddOnManager.baseURL + '/' + url; + } + + self.urls[name] = url.substring(0, url.lastIndexOf('/')); + + if (self.lookup[name]) { + loadDependencies(); + } else { + ScriptLoader.ScriptLoader.add(url, loadDependencies, scope); + } + } + }; + + AddOnManager.PluginManager = new AddOnManager(); + AddOnManager.ThemeManager = new AddOnManager(); + + return AddOnManager; +}); + +/** + * TinyMCE theme class. + * + * @class tinymce.Theme + */ + +/** + * This method is responsible for rendering/generating the overall user interface with toolbars, buttons, iframe containers etc. + * + * @method renderUI + * @param {Object} obj Object parameter containing the targetNode DOM node that will be replaced visually with an editor instance. + * @return {Object} an object with items like iframeContainer, editorContainer, sizeContainer, deltaWidth, deltaHeight. + */ + +/** + * Plugin base class, this is a pseudo class that describes how a plugin is to be created for TinyMCE. The methods below are all optional. + * + * @class tinymce.Plugin + * @example + * tinymce.PluginManager.add('example', function(editor, url) { + * // Add a button that opens a window + * editor.addButton('example', { + * text: 'My button', + * icon: false, + * onclick: function() { + * // Open window + * editor.windowManager.open({ + * title: 'Example plugin', + * body: [ + * {type: 'textbox', name: 'title', label: 'Title'} + * ], + * onsubmit: function(e) { + * // Insert content when the window form is submitted + * editor.insertContent('Title: ' + e.data.title); + * } + * }); + * } + * }); + * + * // Adds a menu item to the tools menu + * editor.addMenuItem('example', { + * text: 'Example plugin', + * context: 'tools', + * onclick: function() { + * // Open window with a specific url + * editor.windowManager.open({ + * title: 'TinyMCE site', + * url: 'http://www.tinymce.com', + * width: 800, + * height: 600, + * buttons: [{ + * text: 'Close', + * onclick: 'close' + * }] + * }); + * } + * }); + * }); + */ + +// Included from: js/tinymce/classes/dom/RangeUtils.js + +/** + * RangeUtils.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class contains a few utility methods for ranges. + * + * @class tinymce.dom.RangeUtils + */ +define("tinymce/dom/RangeUtils", [ + "tinymce/util/Tools", + "tinymce/dom/TreeWalker" +], function(Tools, TreeWalker) { + var each = Tools.each; + + function getEndChild(container, index) { + var childNodes = container.childNodes; + + index--; + + if (index > childNodes.length - 1) { + index = childNodes.length - 1; + } else if (index < 0) { + index = 0; + } + + return childNodes[index] || container; + } + + function RangeUtils(dom) { + /** + * Walks the specified range like object and executes the callback for each sibling collection it finds. + * + * @method walk + * @param {Object} rng Range like object. + * @param {function} callback Callback function to execute for each sibling collection. + */ + this.walk = function(rng, callback) { + var startContainer = rng.startContainer, + startOffset = rng.startOffset, + endContainer = rng.endContainer, + endOffset = rng.endOffset, + ancestor, startPoint, + endPoint, node, parent, siblings, nodes; + + // Handle table cell selection the table plugin enables + // you to fake select table cells and perform formatting actions on them + nodes = dom.select('td.mce-item-selected,th.mce-item-selected'); + if (nodes.length > 0) { + each(nodes, function(node) { + callback([node]); + }); + + return; + } + + /** + * Excludes start/end text node if they are out side the range + * + * @private + * @param {Array} nodes Nodes to exclude items from. + * @return {Array} Array with nodes excluding the start/end container if needed. + */ + function exclude(nodes) { + var node; + + // First node is excluded + node = nodes[0]; + if (node.nodeType === 3 && node === startContainer && startOffset >= node.nodeValue.length) { + nodes.splice(0, 1); + } + + // Last node is excluded + node = nodes[nodes.length - 1]; + if (endOffset === 0 && nodes.length > 0 && node === endContainer && node.nodeType === 3) { + nodes.splice(nodes.length - 1, 1); + } + + return nodes; + } + + /** + * Collects siblings + * + * @private + * @param {Node} node Node to collect siblings from. + * @param {String} name Name of the sibling to check for. + * @return {Array} Array of collected siblings. + */ + function collectSiblings(node, name, end_node) { + var siblings = []; + + for (; node && node != end_node; node = node[name]) { + siblings.push(node); + } + + return siblings; + } + + /** + * Find an end point this is the node just before the common ancestor root. + * + * @private + * @param {Node} node Node to start at. + * @param {Node} root Root/ancestor element to stop just before. + * @return {Node} Node just before the root element. + */ + function findEndPoint(node, root) { + do { + if (node.parentNode == root) { + return node; + } + + node = node.parentNode; + } while (node); + } + + function walkBoundary(start_node, end_node, next) { + var siblingName = next ? 'nextSibling' : 'previousSibling'; + + for (node = start_node, parent = node.parentNode; node && node != end_node; node = parent) { + parent = node.parentNode; + siblings = collectSiblings(node == start_node ? node : node[siblingName], siblingName); + + if (siblings.length) { + if (!next) { + siblings.reverse(); + } + + callback(exclude(siblings)); + } + } + } + + // If index based start position then resolve it + if (startContainer.nodeType == 1 && startContainer.hasChildNodes()) { + startContainer = startContainer.childNodes[startOffset]; + } + + // If index based end position then resolve it + if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) { + endContainer = getEndChild(endContainer, endOffset); + } + + // Same container + if (startContainer == endContainer) { + return callback(exclude([startContainer])); + } + + // Find common ancestor and end points + ancestor = dom.findCommonAncestor(startContainer, endContainer); + + // Process left side + for (node = startContainer; node; node = node.parentNode) { + if (node === endContainer) { + return walkBoundary(startContainer, ancestor, true); + } + + if (node === ancestor) { + break; + } + } + + // Process right side + for (node = endContainer; node; node = node.parentNode) { + if (node === startContainer) { + return walkBoundary(endContainer, ancestor); + } + + if (node === ancestor) { + break; + } + } + + // Find start/end point + startPoint = findEndPoint(startContainer, ancestor) || startContainer; + endPoint = findEndPoint(endContainer, ancestor) || endContainer; + + // Walk left leaf + walkBoundary(startContainer, startPoint, true); + + // Walk the middle from start to end point + siblings = collectSiblings( + startPoint == startContainer ? startPoint : startPoint.nextSibling, + 'nextSibling', + endPoint == endContainer ? endPoint.nextSibling : endPoint + ); + + if (siblings.length) { + callback(exclude(siblings)); + } + + // Walk right leaf + walkBoundary(endContainer, endPoint); + }; + + /** + * Splits the specified range at it's start/end points. + * + * @private + * @param {Range/RangeObject} rng Range to split. + * @return {Object} Range position object. + */ + this.split = function(rng) { + var startContainer = rng.startContainer, + startOffset = rng.startOffset, + endContainer = rng.endContainer, + endOffset = rng.endOffset; + + function splitText(node, offset) { + return node.splitText(offset); + } + + // Handle single text node + if (startContainer == endContainer && startContainer.nodeType == 3) { + if (startOffset > 0 && startOffset < startContainer.nodeValue.length) { + endContainer = splitText(startContainer, startOffset); + startContainer = endContainer.previousSibling; + + if (endOffset > startOffset) { + endOffset = endOffset - startOffset; + startContainer = endContainer = splitText(endContainer, endOffset).previousSibling; + endOffset = endContainer.nodeValue.length; + startOffset = 0; + } else { + endOffset = 0; + } + } + } else { + // Split startContainer text node if needed + if (startContainer.nodeType == 3 && startOffset > 0 && startOffset < startContainer.nodeValue.length) { + startContainer = splitText(startContainer, startOffset); + startOffset = 0; + } + + // Split endContainer text node if needed + if (endContainer.nodeType == 3 && endOffset > 0 && endOffset < endContainer.nodeValue.length) { + endContainer = splitText(endContainer, endOffset).previousSibling; + endOffset = endContainer.nodeValue.length; + } + } + + return { + startContainer: startContainer, + startOffset: startOffset, + endContainer: endContainer, + endOffset: endOffset + }; + }; + + /** + * Normalizes the specified range by finding the closest best suitable caret location. + * + * @private + * @param {Range} rng Range to normalize. + * @return {Boolean} True/false if the specified range was normalized or not. + */ + this.normalize = function(rng) { + var normalized, collapsed; + + function normalizeEndPoint(start) { + var container, offset, walker, body = dom.getRoot(), node, nonEmptyElementsMap; + var directionLeft, isAfterNode; + + function hasBrBeforeAfter(node, left) { + var walker = new TreeWalker(node, dom.getParent(node.parentNode, dom.isBlock) || body); + + while ((node = walker[left ? 'prev' : 'next']())) { + if (node.nodeName === "BR") { + return true; + } + } + } + + function isPrevNode(node, name) { + return node.previousSibling && node.previousSibling.nodeName == name; + } + + // Walks the dom left/right to find a suitable text node to move the endpoint into + // It will only walk within the current parent block or body and will stop if it hits a block or a BR/IMG + function findTextNodeRelative(left, startNode) { + var walker, lastInlineElement, parentBlockContainer; + + startNode = startNode || container; + parentBlockContainer = dom.getParent(startNode.parentNode, dom.isBlock) || body; + + // Lean left before the BR element if it's the only BR within a block element. Gecko bug: #6680 + // This:


    |

    becomes

    |

    + if (left && startNode.nodeName == 'BR' && isAfterNode && dom.isEmpty(parentBlockContainer)) { + container = startNode.parentNode; + offset = dom.nodeIndex(startNode); + normalized = true; + return; + } + + // Walk left until we hit a text node we can move to or a block/br/img + walker = new TreeWalker(startNode, parentBlockContainer); + while ((node = walker[left ? 'prev' : 'next']())) { + // Break if we hit a non content editable node + if (dom.getContentEditableParent(node) === "false") { + return; + } + + // Found text node that has a length + if (node.nodeType === 3 && node.nodeValue.length > 0) { + container = node; + offset = left ? node.nodeValue.length : 0; + normalized = true; + return; + } + + // Break if we find a block or a BR/IMG/INPUT etc + if (dom.isBlock(node) || nonEmptyElementsMap[node.nodeName.toLowerCase()]) { + return; + } + + lastInlineElement = node; + } + + // Only fetch the last inline element when in caret mode for now + if (collapsed && lastInlineElement) { + container = lastInlineElement; + normalized = true; + offset = 0; + } + } + + container = rng[(start ? 'start' : 'end') + 'Container']; + offset = rng[(start ? 'start' : 'end') + 'Offset']; + isAfterNode = container.nodeType == 1 && offset === container.childNodes.length; + nonEmptyElementsMap = dom.schema.getNonEmptyElements(); + directionLeft = start; + + if (container.nodeType == 1 && offset > container.childNodes.length - 1) { + directionLeft = false; + } + + // If the container is a document move it to the body element + if (container.nodeType === 9) { + container = dom.getRoot(); + offset = 0; + } + + // If the container is body try move it into the closest text node or position + if (container === body) { + // If start is before/after a image, table etc + if (directionLeft) { + node = container.childNodes[offset > 0 ? offset - 1 : 0]; + if (node) { + if (nonEmptyElementsMap[node.nodeName] || node.nodeName == "TABLE") { + return; + } + } + } + + // Resolve the index + if (container.hasChildNodes()) { + offset = Math.min(!directionLeft && offset > 0 ? offset - 1 : offset, container.childNodes.length - 1); + container = container.childNodes[offset]; + offset = 0; + + // Don't walk into elements that doesn't have any child nodes like a IMG + if (container.hasChildNodes() && !/TABLE/.test(container.nodeName)) { + // Walk the DOM to find a text node to place the caret at or a BR + node = container; + walker = new TreeWalker(container, body); + + do { + // Found a text node use that position + if (node.nodeType === 3 && node.nodeValue.length > 0) { + offset = directionLeft ? 0 : node.nodeValue.length; + container = node; + normalized = true; + break; + } + + // Found a BR/IMG element that we can place the caret before + if (nonEmptyElementsMap[node.nodeName.toLowerCase()]) { + offset = dom.nodeIndex(node); + container = node.parentNode; + + // Put caret after image when moving the end point + if (node.nodeName == "IMG" && !directionLeft) { + offset++; + } + + normalized = true; + break; + } + } while ((node = (directionLeft ? walker.next() : walker.prev()))); + } + } + } + + // Lean the caret to the left if possible + if (collapsed) { + // So this: x|x + // Becomes: x|x + // Seems that only gecko has issues with this + if (container.nodeType === 3 && offset === 0) { + findTextNodeRelative(true); + } + + // Lean left into empty inline elements when the caret is before a BR + // So this: |
    + // Becomes: |
    + // Seems that only gecko has issues with this. + // Special edge case for

    x|

    since we don't want

    x|

    + if (container.nodeType === 1) { + node = container.childNodes[offset]; + + // Offset is after the containers last child + // then use the previous child for normalization + if (!node) { + node = container.childNodes[offset - 1]; + } + + if (node && node.nodeName === 'BR' && !isPrevNode(node, 'A') && + !hasBrBeforeAfter(node) && !hasBrBeforeAfter(node, true)) { + findTextNodeRelative(true, node); + } + } + } + + // Lean the start of the selection right if possible + // So this: x[x] + // Becomes: x[x] + if (directionLeft && !collapsed && container.nodeType === 3 && offset === container.nodeValue.length) { + findTextNodeRelative(false); + } + + // Set endpoint if it was normalized + if (normalized) { + rng['set' + (start ? 'Start' : 'End')](container, offset); + } + } + + collapsed = rng.collapsed; + + normalizeEndPoint(true); + + if (!collapsed) { + normalizeEndPoint(); + } + + // If it was collapsed then make sure it still is + if (normalized && collapsed) { + rng.collapse(true); + } + + return normalized; + }; + } + + /** + * Compares two ranges and checks if they are equal. + * + * @static + * @method compareRanges + * @param {DOMRange} rng1 First range to compare. + * @param {DOMRange} rng2 First range to compare. + * @return {Boolean} true/false if the ranges are equal. + */ + RangeUtils.compareRanges = function(rng1, rng2) { + if (rng1 && rng2) { + // Compare native IE ranges + if (rng1.item || rng1.duplicate) { + // Both are control ranges and the selected element matches + if (rng1.item && rng2.item && rng1.item(0) === rng2.item(0)) { + return true; + } + + // Both are text ranges and the range matches + if (rng1.isEqual && rng2.isEqual && rng2.isEqual(rng1)) { + return true; + } + } else { + // Compare w3c ranges + return rng1.startContainer == rng2.startContainer && rng1.startOffset == rng2.startOffset; + } + } + + return false; + }; + + /** + * Gets the caret range for the given x/y location. + * + * @static + * @method getCaretRangeFromPoint + * @param {Number} x X coordinate for range + * @param {Number} y Y coordinate for range + * @param {Document} doc Document that x/y are relative to + * @returns {Range} caret range + */ + RangeUtils.getCaretRangeFromPoint = function(x, y, doc) { + var rng, point; + + if (doc.caretPositionFromPoint) { + point = doc.caretPositionFromPoint(x, y); + rng = doc.createRange(); + rng.setStart(point.offsetNode, point.offset); + rng.collapse(true); + } else if (doc.caretRangeFromPoint) { + rng = doc.caretRangeFromPoint(x, y); + } else if (doc.body.createTextRange) { + rng = doc.body.createTextRange(); + + try { + rng.moveToPoint(x, y); + rng.collapse(true); + } catch (ex) { + // Append to top or bottom depending on drop location + rng.collapse(y < doc.body.clientHeight); + } + } + + return rng; + }; + + RangeUtils.getNode = function(container, offset) { + if (container.nodeType == 1 && container.hasChildNodes()) { + if (offset >= container.childNodes.length) { + offset = container.childNodes.length - 1; + } + + container = container.childNodes[offset]; + } + + return container; + }; + + return RangeUtils; +}); + +// Included from: js/tinymce/classes/NodeChange.js + +/** + * NodeChange.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles the nodechange event dispatching both manual and though selection change events. + * + * @class tinymce.NodeChange + * @private + */ +define("tinymce/NodeChange", [ + "tinymce/dom/RangeUtils", + "tinymce/Env" +], function(RangeUtils, Env) { + return function(editor) { + var lastRng, lastPath = []; + + /** + * Returns true/false if the current element path has been changed or not. + * + * @private + * @return {Boolean} True if the element path is the same false if it's not. + */ + function isSameElementPath(startElm) { + var i, currentPath; + + currentPath = editor.$(startElm).parentsUntil(editor.getBody()).add(startElm); + if (currentPath.length === lastPath.length) { + for (i = currentPath.length; i >= 0; i--) { + if (currentPath[i] !== lastPath[i]) { + break; + } + } + + if (i === -1) { + lastPath = currentPath; + return true; + } + } + + lastPath = currentPath; + + return false; + } + + // Gecko doesn't support the "selectionchange" event + if (!('onselectionchange' in editor.getDoc())) { + editor.on('NodeChange Click MouseUp KeyUp Focus', function(e) { + var nativeRng, fakeRng; + + // Since DOM Ranges mutate on modification + // of the DOM we need to clone it's contents + nativeRng = editor.selection.getRng(); + fakeRng = { + startContainer: nativeRng.startContainer, + startOffset: nativeRng.startOffset, + endContainer: nativeRng.endContainer, + endOffset: nativeRng.endOffset + }; + + // Always treat nodechange as a selectionchange since applying + // formatting to the current range wouldn't update the range but it's parent + if (e.type == 'nodechange' || !RangeUtils.compareRanges(fakeRng, lastRng)) { + editor.fire('SelectionChange'); + } + + lastRng = fakeRng; + }); + } + + // IE has a bug where it fires a selectionchange on right click that has a range at the start of the body + // When the contextmenu event fires the selection is located at the right location + editor.on('contextmenu', function() { + editor.fire('SelectionChange'); + }); + + // Selection change is delayed ~200ms on IE when you click inside the current range + editor.on('SelectionChange', function() { + var startElm = editor.selection.getStart(true); + + // IE 8 will fire a selectionchange event with an incorrect selection + // when focusing out of table cells. Click inside cell -> toolbar = Invalid SelectionChange event + if (!Env.range && editor.selection.isCollapsed()) { + return; + } + + if (!isSameElementPath(startElm) && editor.dom.isChildOf(startElm, editor.getBody())) { + editor.nodeChanged({selectionChange: true}); + } + }); + + // Fire an extra nodeChange on mouseup for compatibility reasons + editor.on('MouseUp', function(e) { + if (!e.isDefaultPrevented()) { + // Delay nodeChanged call for WebKit edge case issue where the range + // isn't updated until after you click outside a selected image + if (editor.selection.getNode().nodeName == 'IMG') { + setTimeout(function() { + editor.nodeChanged(); + }, 0); + } else { + editor.nodeChanged(); + } + } + }); + + /** + * Distpaches out a onNodeChange event to all observers. This method should be called when you + * need to update the UI states or element path etc. + * + * @method nodeChanged + * @param {Object} args Optional args to pass to NodeChange event handlers. + */ + this.nodeChanged = function(args) { + var selection = editor.selection, node, parents, root; + + // Fix for bug #1896577 it seems that this can not be fired while the editor is loading + if (editor.initialized && selection && !editor.settings.disable_nodechange && !editor.settings.readonly) { + // Get start node + root = editor.getBody(); + node = selection.getStart() || root; + node = node.ownerDocument != editor.getDoc() ? editor.getBody() : node; + + // Edge case for

    |

    + if (node.nodeName == 'IMG' && selection.isCollapsed()) { + node = node.parentNode; + } + + // Get parents and add them to object + parents = []; + editor.dom.getParent(node, function(node) { + if (node === root) { + return true; + } + + parents.push(node); + }); + + args = args || {}; + args.element = node; + args.parents = parents; + + editor.fire('NodeChange', args); + } + }; + }; +}); + +// Included from: js/tinymce/classes/html/Node.js + +/** + * Node.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is a minimalistic implementation of a DOM like node used by the DomParser class. + * + * @example + * var node = new tinymce.html.Node('strong', 1); + * someRoot.append(node); + * + * @class tinymce.html.Node + * @version 3.4 + */ +define("tinymce/html/Node", [], function() { + var whiteSpaceRegExp = /^[ \t\r\n]*$/, typeLookup = { + '#text': 3, + '#comment': 8, + '#cdata': 4, + '#pi': 7, + '#doctype': 10, + '#document-fragment': 11 + }; + + // Walks the tree left/right + function walk(node, root_node, prev) { + var sibling, parent, startName = prev ? 'lastChild' : 'firstChild', siblingName = prev ? 'prev' : 'next'; + + // Walk into nodes if it has a start + if (node[startName]) { + return node[startName]; + } + + // Return the sibling if it has one + if (node !== root_node) { + sibling = node[siblingName]; + + if (sibling) { + return sibling; + } + + // Walk up the parents to look for siblings + for (parent = node.parent; parent && parent !== root_node; parent = parent.parent) { + sibling = parent[siblingName]; + + if (sibling) { + return sibling; + } + } + } + } + + /** + * Constructs a new Node instance. + * + * @constructor + * @method Node + * @param {String} name Name of the node type. + * @param {Number} type Numeric type representing the node. + */ + function Node(name, type) { + this.name = name; + this.type = type; + + if (type === 1) { + this.attributes = []; + this.attributes.map = {}; + } + } + + Node.prototype = { + /** + * Replaces the current node with the specified one. + * + * @example + * someNode.replace(someNewNode); + * + * @method replace + * @param {tinymce.html.Node} node Node to replace the current node with. + * @return {tinymce.html.Node} The old node that got replaced. + */ + replace: function(node) { + var self = this; + + if (node.parent) { + node.remove(); + } + + self.insert(node, self); + self.remove(); + + return self; + }, + + /** + * Gets/sets or removes an attribute by name. + * + * @example + * someNode.attr("name", "value"); // Sets an attribute + * console.log(someNode.attr("name")); // Gets an attribute + * someNode.attr("name", null); // Removes an attribute + * + * @method attr + * @param {String} name Attribute name to set or get. + * @param {String} value Optional value to set. + * @return {String/tinymce.html.Node} String or undefined on a get operation or the current node on a set operation. + */ + attr: function(name, value) { + var self = this, attrs, i, undef; + + if (typeof name !== "string") { + for (i in name) { + self.attr(i, name[i]); + } + + return self; + } + + if ((attrs = self.attributes)) { + if (value !== undef) { + // Remove attribute + if (value === null) { + if (name in attrs.map) { + delete attrs.map[name]; + + i = attrs.length; + while (i--) { + if (attrs[i].name === name) { + attrs = attrs.splice(i, 1); + return self; + } + } + } + + return self; + } + + // Set attribute + if (name in attrs.map) { + // Set attribute + i = attrs.length; + while (i--) { + if (attrs[i].name === name) { + attrs[i].value = value; + break; + } + } + } else { + attrs.push({name: name, value: value}); + } + + attrs.map[name] = value; + + return self; + } else { + return attrs.map[name]; + } + } + }, + + /** + * Does a shallow clones the node into a new node. It will also exclude id attributes since + * there should only be one id per document. + * + * @example + * var clonedNode = node.clone(); + * + * @method clone + * @return {tinymce.html.Node} New copy of the original node. + */ + clone: function() { + var self = this, clone = new Node(self.name, self.type), i, l, selfAttrs, selfAttr, cloneAttrs; + + // Clone element attributes + if ((selfAttrs = self.attributes)) { + cloneAttrs = []; + cloneAttrs.map = {}; + + for (i = 0, l = selfAttrs.length; i < l; i++) { + selfAttr = selfAttrs[i]; + + // Clone everything except id + if (selfAttr.name !== 'id') { + cloneAttrs[cloneAttrs.length] = {name: selfAttr.name, value: selfAttr.value}; + cloneAttrs.map[selfAttr.name] = selfAttr.value; + } + } + + clone.attributes = cloneAttrs; + } + + clone.value = self.value; + clone.shortEnded = self.shortEnded; + + return clone; + }, + + /** + * Wraps the node in in another node. + * + * @example + * node.wrap(wrapperNode); + * + * @method wrap + */ + wrap: function(wrapper) { + var self = this; + + self.parent.insert(wrapper, self); + wrapper.append(self); + + return self; + }, + + /** + * Unwraps the node in other words it removes the node but keeps the children. + * + * @example + * node.unwrap(); + * + * @method unwrap + */ + unwrap: function() { + var self = this, node, next; + + for (node = self.firstChild; node;) { + next = node.next; + self.insert(node, self, true); + node = next; + } + + self.remove(); + }, + + /** + * Removes the node from it's parent. + * + * @example + * node.remove(); + * + * @method remove + * @return {tinymce.html.Node} Current node that got removed. + */ + remove: function() { + var self = this, parent = self.parent, next = self.next, prev = self.prev; + + if (parent) { + if (parent.firstChild === self) { + parent.firstChild = next; + + if (next) { + next.prev = null; + } + } else { + prev.next = next; + } + + if (parent.lastChild === self) { + parent.lastChild = prev; + + if (prev) { + prev.next = null; + } + } else { + next.prev = prev; + } + + self.parent = self.next = self.prev = null; + } + + return self; + }, + + /** + * Appends a new node as a child of the current node. + * + * @example + * node.append(someNode); + * + * @method append + * @param {tinymce.html.Node} node Node to append as a child of the current one. + * @return {tinymce.html.Node} The node that got appended. + */ + append: function(node) { + var self = this, last; + + if (node.parent) { + node.remove(); + } + + last = self.lastChild; + if (last) { + last.next = node; + node.prev = last; + self.lastChild = node; + } else { + self.lastChild = self.firstChild = node; + } + + node.parent = self; + + return node; + }, + + /** + * Inserts a node at a specific position as a child of the current node. + * + * @example + * parentNode.insert(newChildNode, oldChildNode); + * + * @method insert + * @param {tinymce.html.Node} node Node to insert as a child of the current node. + * @param {tinymce.html.Node} ref_node Reference node to set node before/after. + * @param {Boolean} before Optional state to insert the node before the reference node. + * @return {tinymce.html.Node} The node that got inserted. + */ + insert: function(node, ref_node, before) { + var parent; + + if (node.parent) { + node.remove(); + } + + parent = ref_node.parent || this; + + if (before) { + if (ref_node === parent.firstChild) { + parent.firstChild = node; + } else { + ref_node.prev.next = node; + } + + node.prev = ref_node.prev; + node.next = ref_node; + ref_node.prev = node; + } else { + if (ref_node === parent.lastChild) { + parent.lastChild = node; + } else { + ref_node.next.prev = node; + } + + node.next = ref_node.next; + node.prev = ref_node; + ref_node.next = node; + } + + node.parent = parent; + + return node; + }, + + /** + * Get all children by name. + * + * @method getAll + * @param {String} name Name of the child nodes to collect. + * @return {Array} Array with child nodes matchin the specified name. + */ + getAll: function(name) { + var self = this, node, collection = []; + + for (node = self.firstChild; node; node = walk(node, self)) { + if (node.name === name) { + collection.push(node); + } + } + + return collection; + }, + + /** + * Removes all children of the current node. + * + * @method empty + * @return {tinymce.html.Node} The current node that got cleared. + */ + empty: function() { + var self = this, nodes, i, node; + + // Remove all children + if (self.firstChild) { + nodes = []; + + // Collect the children + for (node = self.firstChild; node; node = walk(node, self)) { + nodes.push(node); + } + + // Remove the children + i = nodes.length; + while (i--) { + node = nodes[i]; + node.parent = node.firstChild = node.lastChild = node.next = node.prev = null; + } + } + + self.firstChild = self.lastChild = null; + + return self; + }, + + /** + * Returns true/false if the node is to be considered empty or not. + * + * @example + * node.isEmpty({img: true}); + * @method isEmpty + * @param {Object} elements Name/value object with elements that are automatically treated as non empty elements. + * @return {Boolean} true/false if the node is empty or not. + */ + isEmpty: function(elements) { + var self = this, node = self.firstChild, i, name; + + if (node) { + do { + if (node.type === 1) { + // Ignore bogus elements + if (node.attributes.map['data-mce-bogus']) { + continue; + } + + // Keep empty elements like + if (elements[node.name]) { + return false; + } + + // Keep bookmark nodes and name attribute like + i = node.attributes.length; + while (i--) { + name = node.attributes[i].name; + if (name === "name" || name.indexOf('data-mce-bookmark') === 0) { + return false; + } + } + } + + // Keep comments + if (node.type === 8) { + return false; + } + + // Keep non whitespace text nodes + if ((node.type === 3 && !whiteSpaceRegExp.test(node.value))) { + return false; + } + } while ((node = walk(node, self))); + } + + return true; + }, + + /** + * Walks to the next or previous node and returns that node or null if it wasn't found. + * + * @method walk + * @param {Boolean} prev Optional previous node state defaults to false. + * @return {tinymce.html.Node} Node that is next to or previous of the current node. + */ + walk: function(prev) { + return walk(this, null, prev); + } + }; + + /** + * Creates a node of a specific type. + * + * @static + * @method create + * @param {String} name Name of the node type to create for example "b" or "#text". + * @param {Object} attrs Name/value collection of attributes that will be applied to elements. + */ + Node.create = function(name, attrs) { + var node, attrName; + + // Create node + node = new Node(name, typeLookup[name] || 1); + + // Add attributes if needed + if (attrs) { + for (attrName in attrs) { + node.attr(attrName, attrs[attrName]); + } + } + + return node; + }; + + return Node; +}); + +// Included from: js/tinymce/classes/html/Schema.js + +/** + * Schema.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Schema validator class. + * + * @class tinymce.html.Schema + * @example + * if (tinymce.activeEditor.schema.isValidChild('p', 'span')) + * alert('span is valid child of p.'); + * + * if (tinymce.activeEditor.schema.getElementRule('p')) + * alert('P is a valid element.'); + * + * @class tinymce.html.Schema + * @version 3.4 + */ +define("tinymce/html/Schema", [ + "tinymce/util/Tools" +], function(Tools) { + var mapCache = {}, dummyObj = {}; + var makeMap = Tools.makeMap, each = Tools.each, extend = Tools.extend, explode = Tools.explode, inArray = Tools.inArray; + + function split(items, delim) { + return items ? items.split(delim || ' ') : []; + } + + /** + * Builds a schema lookup table + * + * @private + * @param {String} type html4, html5 or html5-strict schema type. + * @return {Object} Schema lookup table. + */ + function compileSchema(type) { + var schema = {}, globalAttributes, blockContent; + var phrasingContent, flowContent, html4BlockContent, html4PhrasingContent; + + function add(name, attributes, children) { + var ni, i, attributesOrder, args = arguments; + + function arrayToMap(array, obj) { + var map = {}, i, l; + + for (i = 0, l = array.length; i < l; i++) { + map[array[i]] = obj || {}; + } + + return map; + } + + children = children || []; + attributes = attributes || ""; + + if (typeof children === "string") { + children = split(children); + } + + // Split string children + for (i = 3; i < args.length; i++) { + if (typeof args[i] === "string") { + args[i] = split(args[i]); + } + + children.push.apply(children, args[i]); + } + + name = split(name); + ni = name.length; + while (ni--) { + attributesOrder = [].concat(globalAttributes, split(attributes)); + schema[name[ni]] = { + attributes: arrayToMap(attributesOrder), + attributesOrder: attributesOrder, + children: arrayToMap(children, dummyObj) + }; + } + } + + function addAttrs(name, attributes) { + var ni, schemaItem, i, l; + + name = split(name); + ni = name.length; + attributes = split(attributes); + while (ni--) { + schemaItem = schema[name[ni]]; + for (i = 0, l = attributes.length; i < l; i++) { + schemaItem.attributes[attributes[i]] = {}; + schemaItem.attributesOrder.push(attributes[i]); + } + } + } + + // Use cached schema + if (mapCache[type]) { + return mapCache[type]; + } + + // Attributes present on all elements + globalAttributes = split("id accesskey class dir lang style tabindex title"); + + // Event attributes can be opt-in/opt-out + /*eventAttributes = split("onabort onblur oncancel oncanplay oncanplaythrough onchange onclick onclose oncontextmenu oncuechange " + + "ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended " + + "onerror onfocus oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart " + + "onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel onpause onplay onplaying onprogress onratechange " + + "onreset onscroll onseeked onseeking onseeking onselect onshow onstalled onsubmit onsuspend ontimeupdate onvolumechange " + + "onwaiting" + );*/ + + // Block content elements + blockContent = split( + "address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul" + ); + + // Phrasing content elements from the HTML5 spec (inline) + phrasingContent = split( + "a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd " + + "label map noscript object q s samp script select small span strong sub sup " + + "textarea u var #text #comment" + ); + + // Add HTML5 items to globalAttributes, blockContent, phrasingContent + if (type != "html4") { + globalAttributes.push.apply(globalAttributes, split("contenteditable contextmenu draggable dropzone " + + "hidden spellcheck translate")); + blockContent.push.apply(blockContent, split("article aside details dialog figure header footer hgroup section nav")); + phrasingContent.push.apply(phrasingContent, split("audio canvas command datalist mark meter output progress time wbr " + + "video ruby bdi keygen")); + } + + // Add HTML4 elements unless it's html5-strict + if (type != "html5-strict") { + globalAttributes.push("xml:lang"); + + html4PhrasingContent = split("acronym applet basefont big font strike tt"); + phrasingContent.push.apply(phrasingContent, html4PhrasingContent); + + each(html4PhrasingContent, function(name) { + add(name, "", phrasingContent); + }); + + html4BlockContent = split("center dir isindex noframes"); + blockContent.push.apply(blockContent, html4BlockContent); + + // Flow content elements from the HTML5 spec (block+inline) + flowContent = [].concat(blockContent, phrasingContent); + + each(html4BlockContent, function(name) { + add(name, "", flowContent); + }); + } + + // Flow content elements from the HTML5 spec (block+inline) + flowContent = flowContent || [].concat(blockContent, phrasingContent); + + // HTML4 base schema TODO: Move HTML5 specific attributes to HTML5 specific if statement + // Schema items , , + add("html", "manifest", "head body"); + add("head", "", "base command link meta noscript script style title"); + add("title hr noscript br"); + add("base", "href target"); + add("link", "href rel media hreflang type sizes hreflang"); + add("meta", "name http-equiv content charset"); + add("style", "media type scoped"); + add("script", "src async defer type charset"); + add("body", "onafterprint onbeforeprint onbeforeunload onblur onerror onfocus " + + "onhashchange onload onmessage onoffline ononline onpagehide onpageshow " + + "onpopstate onresize onscroll onstorage onunload", flowContent); + add("address dt dd div caption", "", flowContent); + add("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn", "", phrasingContent); + add("blockquote", "cite", flowContent); + add("ol", "reversed start type", "li"); + add("ul", "", "li"); + add("li", "value", flowContent); + add("dl", "", "dt dd"); + add("a", "href target rel media hreflang type", phrasingContent); + add("q", "cite", phrasingContent); + add("ins del", "cite datetime", flowContent); + add("img", "src sizes srcset alt usemap ismap width height"); + add("iframe", "src name width height", flowContent); + add("embed", "src type width height"); + add("object", "data type typemustmatch name usemap form width height", flowContent, "param"); + add("param", "name value"); + add("map", "name", flowContent, "area"); + add("area", "alt coords shape href target rel media hreflang type"); + add("table", "border", "caption colgroup thead tfoot tbody tr" + (type == "html4" ? " col" : "")); + add("colgroup", "span", "col"); + add("col", "span"); + add("tbody thead tfoot", "", "tr"); + add("tr", "", "td th"); + add("td", "colspan rowspan headers", flowContent); + add("th", "colspan rowspan headers scope abbr", flowContent); + add("form", "accept-charset action autocomplete enctype method name novalidate target", flowContent); + add("fieldset", "disabled form name", flowContent, "legend"); + add("label", "form for", phrasingContent); + add("input", "accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate " + + "formtarget height list max maxlength min multiple name pattern readonly required size src step type value width" + ); + add("button", "disabled form formaction formenctype formmethod formnovalidate formtarget name type value", + type == "html4" ? flowContent : phrasingContent); + add("select", "disabled form multiple name required size", "option optgroup"); + add("optgroup", "disabled label", "option"); + add("option", "disabled label selected value"); + add("textarea", "cols dirname disabled form maxlength name readonly required rows wrap"); + add("menu", "type label", flowContent, "li"); + add("noscript", "", flowContent); + + // Extend with HTML5 elements + if (type != "html4") { + add("wbr"); + add("ruby", "", phrasingContent, "rt rp"); + add("figcaption", "", flowContent); + add("mark rt rp summary bdi", "", phrasingContent); + add("canvas", "width height", flowContent); + add("video", "src crossorigin poster preload autoplay mediagroup loop " + + "muted controls width height buffered", flowContent, "track source"); + add("audio", "src crossorigin preload autoplay mediagroup loop muted controls buffered volume", flowContent, "track source"); + add("picture", "", "img source"); + add("source", "src srcset type media sizes"); + add("track", "kind src srclang label default"); + add("datalist", "", phrasingContent, "option"); + add("article section nav aside header footer", "", flowContent); + add("hgroup", "", "h1 h2 h3 h4 h5 h6"); + add("figure", "", flowContent, "figcaption"); + add("time", "datetime", phrasingContent); + add("dialog", "open", flowContent); + add("command", "type label icon disabled checked radiogroup command"); + add("output", "for form name", phrasingContent); + add("progress", "value max", phrasingContent); + add("meter", "value min max low high optimum", phrasingContent); + add("details", "open", flowContent, "summary"); + add("keygen", "autofocus challenge disabled form keytype name"); + } + + // Extend with HTML4 attributes unless it's html5-strict + if (type != "html5-strict") { + addAttrs("script", "language xml:space"); + addAttrs("style", "xml:space"); + addAttrs("object", "declare classid code codebase codetype archive standby align border hspace vspace"); + addAttrs("embed", "align name hspace vspace"); + addAttrs("param", "valuetype type"); + addAttrs("a", "charset name rev shape coords"); + addAttrs("br", "clear"); + addAttrs("applet", "codebase archive code object alt name width height align hspace vspace"); + addAttrs("img", "name longdesc align border hspace vspace"); + addAttrs("iframe", "longdesc frameborder marginwidth marginheight scrolling align"); + addAttrs("font basefont", "size color face"); + addAttrs("input", "usemap align"); + addAttrs("select", "onchange"); + addAttrs("textarea"); + addAttrs("h1 h2 h3 h4 h5 h6 div p legend caption", "align"); + addAttrs("ul", "type compact"); + addAttrs("li", "type"); + addAttrs("ol dl menu dir", "compact"); + addAttrs("pre", "width xml:space"); + addAttrs("hr", "align noshade size width"); + addAttrs("isindex", "prompt"); + addAttrs("table", "summary width frame rules cellspacing cellpadding align bgcolor"); + addAttrs("col", "width align char charoff valign"); + addAttrs("colgroup", "width align char charoff valign"); + addAttrs("thead", "align char charoff valign"); + addAttrs("tr", "align char charoff valign bgcolor"); + addAttrs("th", "axis align char charoff valign nowrap bgcolor width height"); + addAttrs("form", "accept"); + addAttrs("td", "abbr axis scope align char charoff valign nowrap bgcolor width height"); + addAttrs("tfoot", "align char charoff valign"); + addAttrs("tbody", "align char charoff valign"); + addAttrs("area", "nohref"); + addAttrs("body", "background bgcolor text link vlink alink"); + } + + // Extend with HTML5 attributes unless it's html4 + if (type != "html4") { + addAttrs("input button select textarea", "autofocus"); + addAttrs("input textarea", "placeholder"); + addAttrs("a", "download"); + addAttrs("link script img", "crossorigin"); + addAttrs("iframe", "sandbox seamless allowfullscreen"); // Excluded: srcdoc + } + + // Special: iframe, ruby, video, audio, label + + // Delete children of the same name from it's parent + // For example: form can't have a child of the name form + each(split('a form meter progress dfn'), function(name) { + if (schema[name]) { + delete schema[name].children[name]; + } + }); + + // Delete header, footer, sectioning and heading content descendants + /*each('dt th address', function(name) { + delete schema[name].children[name]; + });*/ + + // Caption can't have tables + delete schema.caption.children.table; + + // TODO: LI:s can only have value if parent is OL + + // TODO: Handle transparent elements + // a ins del canvas map + + mapCache[type] = schema; + + return schema; + } + + function compileElementMap(value, mode) { + var styles; + + if (value) { + styles = {}; + + if (typeof value == 'string') { + value = { + '*': value + }; + } + + // Convert styles into a rule list + each(value, function(value, key) { + styles[key] = styles[key.toUpperCase()] = mode == 'map' ? makeMap(value, /[, ]/) : explode(value, /[, ]/); + }); + } + + return styles; + } + + /** + * Constructs a new Schema instance. + * + * @constructor + * @method Schema + * @param {Object} settings Name/value settings object. + */ + return function(settings) { + var self = this, elements = {}, children = {}, patternElements = [], validStyles, invalidStyles, schemaItems; + var whiteSpaceElementsMap, selfClosingElementsMap, shortEndedElementsMap, boolAttrMap, validClasses; + var blockElementsMap, nonEmptyElementsMap, moveCaretBeforeOnEnterElementsMap, textBlockElementsMap, textInlineElementsMap; + var customElementsMap = {}, specialElements = {}; + + // Creates an lookup table map object for the specified option or the default value + function createLookupTable(option, default_value, extendWith) { + var value = settings[option]; + + if (!value) { + // Get cached default map or make it if needed + value = mapCache[option]; + + if (!value) { + value = makeMap(default_value, ' ', makeMap(default_value.toUpperCase(), ' ')); + value = extend(value, extendWith); + + mapCache[option] = value; + } + } else { + // Create custom map + value = makeMap(value, /[, ]/, makeMap(value.toUpperCase(), /[, ]/)); + } + + return value; + } + + settings = settings || {}; + schemaItems = compileSchema(settings.schema); + + // Allow all elements and attributes if verify_html is set to false + if (settings.verify_html === false) { + settings.valid_elements = '*[*]'; + } + + validStyles = compileElementMap(settings.valid_styles); + invalidStyles = compileElementMap(settings.invalid_styles, 'map'); + validClasses = compileElementMap(settings.valid_classes, 'map'); + + // Setup map objects + whiteSpaceElementsMap = createLookupTable('whitespace_elements', 'pre script noscript style textarea video audio iframe object'); + selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr'); + shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link ' + + 'meta param embed source wbr track'); + boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize ' + + 'noshade nowrap readonly selected autoplay loop controls'); + nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object script', shortEndedElementsMap); + moveCaretBeforeOnEnterElementsMap = createLookupTable('move_caret_before_on_enter_elements', 'table', nonEmptyElementsMap); + textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' + + 'blockquote center dir fieldset header footer article section hgroup aside nav figure'); + blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' + + 'th tr td li ol ul caption dl dt dd noscript menu isindex option ' + + 'datalist select optgroup', textBlockElementsMap); + textInlineElementsMap = createLookupTable('text_inline_elements', 'span strong b em i font strike u var cite ' + + 'dfn code mark q sup sub samp'); + + each((settings.special || 'script noscript style textarea').split(' '), function(name) { + specialElements[name] = new RegExp('<\/' + name + '[^>]*>', 'gi'); + }); + + // Converts a wildcard expression string to a regexp for example *a will become /.*a/. + function patternToRegExp(str) { + return new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$'); + } + + // Parses the specified valid_elements string and adds to the current rules + // This function is a bit hard to read since it's heavily optimized for speed + function addValidElements(validElements) { + var ei, el, ai, al, matches, element, attr, attrData, elementName, attrName, attrType, attributes, attributesOrder, + prefix, outputName, globalAttributes, globalAttributesOrder, key, value, + elementRuleRegExp = /^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)\])?$/, + attrRuleRegExp = /^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/, + hasPatternsRegExp = /[*?+]/; + + if (validElements) { + // Split valid elements into an array with rules + validElements = split(validElements, ','); + + if (elements['@']) { + globalAttributes = elements['@'].attributes; + globalAttributesOrder = elements['@'].attributesOrder; + } + + // Loop all rules + for (ei = 0, el = validElements.length; ei < el; ei++) { + // Parse element rule + matches = elementRuleRegExp.exec(validElements[ei]); + if (matches) { + // Setup local names for matches + prefix = matches[1]; + elementName = matches[2]; + outputName = matches[3]; + attrData = matches[5]; + + // Create new attributes and attributesOrder + attributes = {}; + attributesOrder = []; + + // Create the new element + element = { + attributes: attributes, + attributesOrder: attributesOrder + }; + + // Padd empty elements prefix + if (prefix === '#') { + element.paddEmpty = true; + } + + // Remove empty elements prefix + if (prefix === '-') { + element.removeEmpty = true; + } + + if (matches[4] === '!') { + element.removeEmptyAttrs = true; + } + + // Copy attributes from global rule into current rule + if (globalAttributes) { + for (key in globalAttributes) { + attributes[key] = globalAttributes[key]; + } + + attributesOrder.push.apply(attributesOrder, globalAttributesOrder); + } + + // Attributes defined + if (attrData) { + attrData = split(attrData, '|'); + for (ai = 0, al = attrData.length; ai < al; ai++) { + matches = attrRuleRegExp.exec(attrData[ai]); + if (matches) { + attr = {}; + attrType = matches[1]; + attrName = matches[2].replace(/::/g, ':'); + prefix = matches[3]; + value = matches[4]; + + // Required + if (attrType === '!') { + element.attributesRequired = element.attributesRequired || []; + element.attributesRequired.push(attrName); + attr.required = true; + } + + // Denied from global + if (attrType === '-') { + delete attributes[attrName]; + attributesOrder.splice(inArray(attributesOrder, attrName), 1); + continue; + } + + // Default value + if (prefix) { + // Default value + if (prefix === '=') { + element.attributesDefault = element.attributesDefault || []; + element.attributesDefault.push({name: attrName, value: value}); + attr.defaultValue = value; + } + + // Forced value + if (prefix === ':') { + element.attributesForced = element.attributesForced || []; + element.attributesForced.push({name: attrName, value: value}); + attr.forcedValue = value; + } + + // Required values + if (prefix === '<') { + attr.validValues = makeMap(value, '?'); + } + } + + // Check for attribute patterns + if (hasPatternsRegExp.test(attrName)) { + element.attributePatterns = element.attributePatterns || []; + attr.pattern = patternToRegExp(attrName); + element.attributePatterns.push(attr); + } else { + // Add attribute to order list if it doesn't already exist + if (!attributes[attrName]) { + attributesOrder.push(attrName); + } + + attributes[attrName] = attr; + } + } + } + } + + // Global rule, store away these for later usage + if (!globalAttributes && elementName == '@') { + globalAttributes = attributes; + globalAttributesOrder = attributesOrder; + } + + // Handle substitute elements such as b/strong + if (outputName) { + element.outputName = elementName; + elements[outputName] = element; + } + + // Add pattern or exact element + if (hasPatternsRegExp.test(elementName)) { + element.pattern = patternToRegExp(elementName); + patternElements.push(element); + } else { + elements[elementName] = element; + } + } + } + } + } + + function setValidElements(validElements) { + elements = {}; + patternElements = []; + + addValidElements(validElements); + + each(schemaItems, function(element, name) { + children[name] = element.children; + }); + } + + // Adds custom non HTML elements to the schema + function addCustomElements(customElements) { + var customElementRegExp = /^(~)?(.+)$/; + + if (customElements) { + // Flush cached items since we are altering the default maps + mapCache.text_block_elements = mapCache.block_elements = null; + + each(split(customElements, ','), function(rule) { + var matches = customElementRegExp.exec(rule), + inline = matches[1] === '~', + cloneName = inline ? 'span' : 'div', + name = matches[2]; + + children[name] = children[cloneName]; + customElementsMap[name] = cloneName; + + // If it's not marked as inline then add it to valid block elements + if (!inline) { + blockElementsMap[name.toUpperCase()] = {}; + blockElementsMap[name] = {}; + } + + // Add elements clone if needed + if (!elements[name]) { + var customRule = elements[cloneName]; + + customRule = extend({}, customRule); + delete customRule.removeEmptyAttrs; + delete customRule.removeEmpty; + + elements[name] = customRule; + } + + // Add custom elements at span/div positions + each(children, function(element, elmName) { + if (element[cloneName]) { + children[elmName] = element = extend({}, children[elmName]); + element[name] = element[cloneName]; + } + }); + }); + } + } + + // Adds valid children to the schema object + function addValidChildren(validChildren) { + var childRuleRegExp = /^([+\-]?)(\w+)\[([^\]]+)\]$/; + + if (validChildren) { + each(split(validChildren, ','), function(rule) { + var matches = childRuleRegExp.exec(rule), parent, prefix; + + if (matches) { + prefix = matches[1]; + + // Add/remove items from default + if (prefix) { + parent = children[matches[2]]; + } else { + parent = children[matches[2]] = {'#comment': {}}; + } + + parent = children[matches[2]]; + + each(split(matches[3], '|'), function(child) { + if (prefix === '-') { + // Clone the element before we delete + // things in it to not mess up default schemas + children[matches[2]] = parent = extend({}, children[matches[2]]); + + delete parent[child]; + } else { + parent[child] = {}; + } + }); + } + }); + } + } + + function getElementRule(name) { + var element = elements[name], i; + + // Exact match found + if (element) { + return element; + } + + // No exact match then try the patterns + i = patternElements.length; + while (i--) { + element = patternElements[i]; + + if (element.pattern.test(name)) { + return element; + } + } + } + + if (!settings.valid_elements) { + // No valid elements defined then clone the elements from the schema spec + each(schemaItems, function(element, name) { + elements[name] = { + attributes: element.attributes, + attributesOrder: element.attributesOrder + }; + + children[name] = element.children; + }); + + // Switch these on HTML4 + if (settings.schema != "html5") { + each(split('strong/b em/i'), function(item) { + item = split(item, '/'); + elements[item[1]].outputName = item[0]; + }); + } + + // Add default alt attribute for images + elements.img.attributesDefault = [{name: 'alt', value: ''}]; + + // Remove these if they are empty by default + each(split('ol ul sub sup blockquote span font a table tbody tr strong em b i'), function(name) { + if (elements[name]) { + elements[name].removeEmpty = true; + } + }); + + // Padd these by default + each(split('p h1 h2 h3 h4 h5 h6 th td pre div address caption'), function(name) { + elements[name].paddEmpty = true; + }); + + // Remove these if they have no attributes + each(split('span'), function(name) { + elements[name].removeEmptyAttrs = true; + }); + + // Remove these by default + // TODO: Reenable in 4.1 + /*each(split('script style'), function(name) { + delete elements[name]; + });*/ + } else { + setValidElements(settings.valid_elements); + } + + addCustomElements(settings.custom_elements); + addValidChildren(settings.valid_children); + addValidElements(settings.extended_valid_elements); + + // Todo: Remove this when we fix list handling to be valid + addValidChildren('+ol[ul|ol],+ul[ul|ol]'); + + // Delete invalid elements + if (settings.invalid_elements) { + each(explode(settings.invalid_elements), function(item) { + if (elements[item]) { + delete elements[item]; + } + }); + } + + // If the user didn't allow span only allow internal spans + if (!getElementRule('span')) { + addValidElements('span[!data-mce-type|*]'); + } + + /** + * Name/value map object with valid parents and children to those parents. + * + * @example + * children = { + * div:{p:{}, h1:{}} + * }; + * @field children + * @type Object + */ + self.children = children; + + /** + * Name/value map object with valid styles for each element. + * + * @method getValidStyles + * @type Object + */ + self.getValidStyles = function() { + return validStyles; + }; + + /** + * Name/value map object with valid styles for each element. + * + * @method getInvalidStyles + * @type Object + */ + self.getInvalidStyles = function() { + return invalidStyles; + }; + + /** + * Name/value map object with valid classes for each element. + * + * @method getValidClasses + * @type Object + */ + self.getValidClasses = function() { + return validClasses; + }; + + /** + * Returns a map with boolean attributes. + * + * @method getBoolAttrs + * @return {Object} Name/value lookup map for boolean attributes. + */ + self.getBoolAttrs = function() { + return boolAttrMap; + }; + + /** + * Returns a map with block elements. + * + * @method getBlockElements + * @return {Object} Name/value lookup map for block elements. + */ + self.getBlockElements = function() { + return blockElementsMap; + }; + + /** + * Returns a map with text block elements. Such as: p,h1-h6,div,address + * + * @method getTextBlockElements + * @return {Object} Name/value lookup map for block elements. + */ + self.getTextBlockElements = function() { + return textBlockElementsMap; + }; + + /** + * Returns a map of inline text format nodes for example strong/span or ins. + * + * @method getTextInlineElements + * @return {Object} Name/value lookup map for text format elements. + */ + self.getTextInlineElements = function() { + return textInlineElementsMap; + }; + + /** + * Returns a map with short ended elements such as BR or IMG. + * + * @method getShortEndedElements + * @return {Object} Name/value lookup map for short ended elements. + */ + self.getShortEndedElements = function() { + return shortEndedElementsMap; + }; + + /** + * Returns a map with self closing tags such as
  • . + * + * @method getSelfClosingElements + * @return {Object} Name/value lookup map for self closing tags elements. + */ + self.getSelfClosingElements = function() { + return selfClosingElementsMap; + }; + + /** + * Returns a map with elements that should be treated as contents regardless if it has text + * content in them or not such as TD, VIDEO or IMG. + * + * @method getNonEmptyElements + * @return {Object} Name/value lookup map for non empty elements. + */ + self.getNonEmptyElements = function() { + return nonEmptyElementsMap; + }; + + /** + * Returns a map with elements that the caret should be moved in front of after enter is + * pressed + * + * @method getMoveCaretBeforeOnEnterElements + * @return {Object} Name/value lookup map for elements to place the caret in front of. + */ + self.getMoveCaretBeforeOnEnterElements = function() { + return moveCaretBeforeOnEnterElementsMap; + }; + + /** + * Returns a map with elements where white space is to be preserved like PRE or SCRIPT. + * + * @method getWhiteSpaceElements + * @return {Object} Name/value lookup map for white space elements. + */ + self.getWhiteSpaceElements = function() { + return whiteSpaceElementsMap; + }; + + /** + * Returns a map with special elements. These are elements that needs to be parsed + * in a special way such as script, style, textarea etc. The map object values + * are regexps used to find the end of the element. + * + * @method getSpecialElements + * @return {Object} Name/value lookup map for special elements. + */ + self.getSpecialElements = function() { + return specialElements; + }; + + /** + * Returns true/false if the specified element and it's child is valid or not + * according to the schema. + * + * @method isValidChild + * @param {String} name Element name to check for. + * @param {String} child Element child to verify. + * @return {Boolean} True/false if the element is a valid child of the specified parent. + */ + self.isValidChild = function(name, child) { + var parent = children[name]; + + return !!(parent && parent[child]); + }; + + /** + * Returns true/false if the specified element name and optional attribute is + * valid according to the schema. + * + * @method isValid + * @param {String} name Name of element to check. + * @param {String} attr Optional attribute name to check for. + * @return {Boolean} True/false if the element and attribute is valid. + */ + self.isValid = function(name, attr) { + var attrPatterns, i, rule = getElementRule(name); + + // Check if it's a valid element + if (rule) { + if (attr) { + // Check if attribute name exists + if (rule.attributes[attr]) { + return true; + } + + // Check if attribute matches a regexp pattern + attrPatterns = rule.attributePatterns; + if (attrPatterns) { + i = attrPatterns.length; + while (i--) { + if (attrPatterns[i].pattern.test(name)) { + return true; + } + } + } + } else { + return true; + } + } + + // No match + return false; + }; + + /** + * Returns true/false if the specified element is valid or not + * according to the schema. + * + * @method getElementRule + * @param {String} name Element name to check for. + * @return {Object} Element object or undefined if the element isn't valid. + */ + self.getElementRule = getElementRule; + + /** + * Returns an map object of all custom elements. + * + * @method getCustomElements + * @return {Object} Name/value map object of all custom elements. + */ + self.getCustomElements = function() { + return customElementsMap; + }; + + /** + * Parses a valid elements string and adds it to the schema. The valid elements + * format is for example "element[attr=default|otherattr]". + * Existing rules will be replaced with the ones specified, so this extends the schema. + * + * @method addValidElements + * @param {String} valid_elements String in the valid elements format to be parsed. + */ + self.addValidElements = addValidElements; + + /** + * Parses a valid elements string and sets it to the schema. The valid elements + * format is for example "element[attr=default|otherattr]". + * Existing rules will be replaced with the ones specified, so this extends the schema. + * + * @method setValidElements + * @param {String} valid_elements String in the valid elements format to be parsed. + */ + self.setValidElements = setValidElements; + + /** + * Adds custom non HTML elements to the schema. + * + * @method addCustomElements + * @param {String} custom_elements Comma separated list of custom elements to add. + */ + self.addCustomElements = addCustomElements; + + /** + * Parses a valid children string and adds them to the schema structure. The valid children + * format is for example: "element[child1|child2]". + * + * @method addValidChildren + * @param {String} valid_children Valid children elements string to parse + */ + self.addValidChildren = addValidChildren; + + self.elements = elements; + }; +}); + +// Included from: js/tinymce/classes/html/SaxParser.js + +/** + * SaxParser.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*eslint max-depth:[2, 9] */ + +/** + * This class parses HTML code using pure JavaScript and executes various events for each item it finds. It will + * always execute the events in the right order for tag soup code like

    . It will also remove elements + * and attributes that doesn't fit the schema if the validate setting is enabled. + * + * @example + * var parser = new tinymce.html.SaxParser({ + * validate: true, + * + * comment: function(text) { + * console.log('Comment:', text); + * }, + * + * cdata: function(text) { + * console.log('CDATA:', text); + * }, + * + * text: function(text, raw) { + * console.log('Text:', text, 'Raw:', raw); + * }, + * + * start: function(name, attrs, empty) { + * console.log('Start:', name, attrs, empty); + * }, + * + * end: function(name) { + * console.log('End:', name); + * }, + * + * pi: function(name, text) { + * console.log('PI:', name, text); + * }, + * + * doctype: function(text) { + * console.log('DocType:', text); + * } + * }, schema); + * @class tinymce.html.SaxParser + * @version 3.4 + */ +define("tinymce/html/SaxParser", [ + "tinymce/html/Schema", + "tinymce/html/Entities", + "tinymce/util/Tools" +], function(Schema, Entities, Tools) { + var each = Tools.each; + + /** + * Returns the index of the end tag for a specific start tag. This can be + * used to skip all children of a parent element from being processed. + * + * @private + * @method findEndTag + * @param {tinymce.html.Schema} schema Schema instance to use to match short ended elements. + * @param {String} html HTML string to find the end tag in. + * @param {Number} startIndex Indext to start searching at should be after the start tag. + * @return {Number} Index of the end tag. + */ + function findEndTag(schema, html, startIndex) { + var count = 1, index, matches, tokenRegExp, shortEndedElements; + + shortEndedElements = schema.getShortEndedElements(); + tokenRegExp = /<([!?\/])?([A-Za-z0-9\-_\:\.]+)((?:\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\/|\s+)>/g; + tokenRegExp.lastIndex = index = startIndex; + + while ((matches = tokenRegExp.exec(html))) { + index = tokenRegExp.lastIndex; + + if (matches[1] === '/') { // End element + count--; + } else if (!matches[1]) { // Start element + if (matches[2] in shortEndedElements) { + continue; + } + + count++; + } + + if (count === 0) { + break; + } + } + + return index; + } + + /** + * Constructs a new SaxParser instance. + * + * @constructor + * @method SaxParser + * @param {Object} settings Name/value collection of settings. comment, cdata, text, start and end are callbacks. + * @param {tinymce.html.Schema} schema HTML Schema class to use when parsing. + */ + function SaxParser(settings, schema) { + var self = this; + + function noop() {} + + settings = settings || {}; + self.schema = schema = schema || new Schema(); + + if (settings.fix_self_closing !== false) { + settings.fix_self_closing = true; + } + + // Add handler functions from settings and setup default handlers + each('comment cdata text start end pi doctype'.split(' '), function(name) { + if (name) { + self[name] = settings[name] || noop; + } + }); + + /** + * Parses the specified HTML string and executes the callbacks for each item it finds. + * + * @example + * new SaxParser({...}).parse('text'); + * @method parse + * @param {String} html Html string to sax parse. + */ + self.parse = function(html) { + var self = this, matches, index = 0, value, endRegExp, stack = [], attrList, i, text, name; + var isInternalElement, removeInternalElements, shortEndedElements, fillAttrsMap, isShortEnded; + var validate, elementRule, isValidElement, attr, attribsValue, validAttributesMap, validAttributePatterns; + var attributesRequired, attributesDefault, attributesForced; + var anyAttributesRequired, selfClosing, tokenRegExp, attrRegExp, specialElements, attrValue, idCount = 0; + var decode = Entities.decode, fixSelfClosing, filteredUrlAttrs = Tools.makeMap('src,href,data,background,formaction,poster'); + var scriptUriRegExp = /((java|vb)script|mhtml):/i, dataUriRegExp = /^data:/i; + + function processEndTag(name) { + var pos, i; + + // Find position of parent of the same type + pos = stack.length; + while (pos--) { + if (stack[pos].name === name) { + break; + } + } + + // Found parent + if (pos >= 0) { + // Close all the open elements + for (i = stack.length - 1; i >= pos; i--) { + name = stack[i]; + + if (name.valid) { + self.end(name.name); + } + } + + // Remove the open elements from the stack + stack.length = pos; + } + } + + function parseAttribute(match, name, value, val2, val3) { + var attrRule, i, trimRegExp = /[\s\u0000-\u001F]+/g; + + name = name.toLowerCase(); + value = name in fillAttrsMap ? name : decode(value || val2 || val3 || ''); // Handle boolean attribute than value attribute + + // Validate name and value pass through all data- attributes + if (validate && !isInternalElement && name.indexOf('data-') !== 0) { + attrRule = validAttributesMap[name]; + + // Find rule by pattern matching + if (!attrRule && validAttributePatterns) { + i = validAttributePatterns.length; + while (i--) { + attrRule = validAttributePatterns[i]; + if (attrRule.pattern.test(name)) { + break; + } + } + + // No rule matched + if (i === -1) { + attrRule = null; + } + } + + // No attribute rule found + if (!attrRule) { + return; + } + + // Validate value + if (attrRule.validValues && !(value in attrRule.validValues)) { + return; + } + } + + // Block any javascript: urls or non image data uris + if (filteredUrlAttrs[name] && !settings.allow_script_urls) { + var uri = value.replace(trimRegExp, ''); + + try { + // Might throw malformed URI sequence + uri = decodeURIComponent(uri); + } catch (ex) { + // Fallback to non UTF-8 decoder + uri = unescape(uri); + } + + if (scriptUriRegExp.test(uri)) { + return; + } + + if (!settings.allow_html_data_urls && dataUriRegExp.test(uri) && !/^data:image\//i.test(uri)) { + return; + } + } + + // Add attribute to list and map + attrList.map[name] = value; + attrList.push({ + name: name, + value: value + }); + } + + // Precompile RegExps and map objects + tokenRegExp = new RegExp('<(?:' + + '(?:!--([\\w\\W]*?)-->)|' + // Comment + '(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|' + // CDATA + '(?:!DOCTYPE([\\w\\W]*?)>)|' + // DOCTYPE + '(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + // PI + '(?:\\/([^>]+)>)|' + // End element + '(?:([A-Za-z0-9\\-_\\:\\.]+)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/|\\s+)>)' + // Start element + ')', 'g'); + + attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g; + + // Setup lookup tables for empty elements and boolean attributes + shortEndedElements = schema.getShortEndedElements(); + selfClosing = settings.self_closing_elements || schema.getSelfClosingElements(); + fillAttrsMap = schema.getBoolAttrs(); + validate = settings.validate; + removeInternalElements = settings.remove_internals; + fixSelfClosing = settings.fix_self_closing; + specialElements = schema.getSpecialElements(); + + while ((matches = tokenRegExp.exec(html))) { + // Text + if (index < matches.index) { + self.text(decode(html.substr(index, matches.index - index))); + } + + if ((value = matches[6])) { // End element + value = value.toLowerCase(); + + // IE will add a ":" in front of elements it doesn't understand like custom elements or HTML5 elements + if (value.charAt(0) === ':') { + value = value.substr(1); + } + + processEndTag(value); + } else if ((value = matches[7])) { // Start element + value = value.toLowerCase(); + + // IE will add a ":" in front of elements it doesn't understand like custom elements or HTML5 elements + if (value.charAt(0) === ':') { + value = value.substr(1); + } + + isShortEnded = value in shortEndedElements; + + // Is self closing tag for example an
  • after an open
  • + if (fixSelfClosing && selfClosing[value] && stack.length > 0 && stack[stack.length - 1].name === value) { + processEndTag(value); + } + + // Validate element + if (!validate || (elementRule = schema.getElementRule(value))) { + isValidElement = true; + + // Grab attributes map and patters when validation is enabled + if (validate) { + validAttributesMap = elementRule.attributes; + validAttributePatterns = elementRule.attributePatterns; + } + + // Parse attributes + if ((attribsValue = matches[8])) { + isInternalElement = attribsValue.indexOf('data-mce-type') !== -1; // Check if the element is an internal element + + // If the element has internal attributes then remove it if we are told to do so + if (isInternalElement && removeInternalElements) { + isValidElement = false; + } + + attrList = []; + attrList.map = {}; + + attribsValue.replace(attrRegExp, parseAttribute); + } else { + attrList = []; + attrList.map = {}; + } + + // Process attributes if validation is enabled + if (validate && !isInternalElement) { + attributesRequired = elementRule.attributesRequired; + attributesDefault = elementRule.attributesDefault; + attributesForced = elementRule.attributesForced; + anyAttributesRequired = elementRule.removeEmptyAttrs; + + // Check if any attribute exists + if (anyAttributesRequired && !attrList.length) { + isValidElement = false; + } + + // Handle forced attributes + if (attributesForced) { + i = attributesForced.length; + while (i--) { + attr = attributesForced[i]; + name = attr.name; + attrValue = attr.value; + + if (attrValue === '{$uid}') { + attrValue = 'mce_' + idCount++; + } + + attrList.map[name] = attrValue; + attrList.push({name: name, value: attrValue}); + } + } + + // Handle default attributes + if (attributesDefault) { + i = attributesDefault.length; + while (i--) { + attr = attributesDefault[i]; + name = attr.name; + + if (!(name in attrList.map)) { + attrValue = attr.value; + + if (attrValue === '{$uid}') { + attrValue = 'mce_' + idCount++; + } + + attrList.map[name] = attrValue; + attrList.push({name: name, value: attrValue}); + } + } + } + + // Handle required attributes + if (attributesRequired) { + i = attributesRequired.length; + while (i--) { + if (attributesRequired[i] in attrList.map) { + break; + } + } + + // None of the required attributes where found + if (i === -1) { + isValidElement = false; + } + } + + // Invalidate element if it's marked as bogus + if ((attr = attrList.map['data-mce-bogus'])) { + if (attr === 'all') { + index = findEndTag(schema, html, tokenRegExp.lastIndex); + tokenRegExp.lastIndex = index; + continue; + } + + isValidElement = false; + } + } + + if (isValidElement) { + self.start(value, attrList, isShortEnded); + } + } else { + isValidElement = false; + } + + // Treat script, noscript and style a bit different since they may include code that looks like elements + if ((endRegExp = specialElements[value])) { + endRegExp.lastIndex = index = matches.index + matches[0].length; + + if ((matches = endRegExp.exec(html))) { + if (isValidElement) { + text = html.substr(index, matches.index - index); + } + + index = matches.index + matches[0].length; + } else { + text = html.substr(index); + index = html.length; + } + + if (isValidElement) { + if (text.length > 0) { + self.text(text, true); + } + + self.end(value); + } + + tokenRegExp.lastIndex = index; + continue; + } + + // Push value on to stack + if (!isShortEnded) { + if (!attribsValue || attribsValue.indexOf('/') != attribsValue.length - 1) { + stack.push({name: value, valid: isValidElement}); + } else if (isValidElement) { + self.end(value); + } + } + } else if ((value = matches[1])) { // Comment + // Padd comment value to avoid browsers from parsing invalid comments as HTML + if (value.charAt(0) === '>') { + value = ' ' + value; + } + + if (!settings.allow_conditional_comments && value.substr(0, 3) === '[if') { + value = ' ' + value; + } + + self.comment(value); + } else if ((value = matches[2])) { // CDATA + self.cdata(value); + } else if ((value = matches[3])) { // DOCTYPE + self.doctype(value); + } else if ((value = matches[4])) { // PI + self.pi(value, matches[5]); + } + + index = matches.index + matches[0].length; + } + + // Text + if (index < html.length) { + self.text(decode(html.substr(index))); + } + + // Close any open elements + for (i = stack.length - 1; i >= 0; i--) { + value = stack[i]; + + if (value.valid) { + self.end(value.name); + } + } + }; + } + + SaxParser.findEndTag = findEndTag; + + return SaxParser; +}); + +// Included from: js/tinymce/classes/html/DomParser.js + +/** + * DomParser.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class parses HTML code into a DOM like structure of nodes it will remove redundant whitespace and make + * sure that the node tree is valid according to the specified schema. + * So for example:

    a

    b

    c

    will become

    a

    b

    c

    + * + * @example + * var parser = new tinymce.html.DomParser({validate: true}, schema); + * var rootNode = parser.parse('

    content

    '); + * + * @class tinymce.html.DomParser + * @version 3.4 + */ +define("tinymce/html/DomParser", [ + "tinymce/html/Node", + "tinymce/html/Schema", + "tinymce/html/SaxParser", + "tinymce/util/Tools" +], function(Node, Schema, SaxParser, Tools) { + var makeMap = Tools.makeMap, each = Tools.each, explode = Tools.explode, extend = Tools.extend; + + /** + * Constructs a new DomParser instance. + * + * @constructor + * @method DomParser + * @param {Object} settings Name/value collection of settings. comment, cdata, text, start and end are callbacks. + * @param {tinymce.html.Schema} schema HTML Schema class to use when parsing. + */ + return function(settings, schema) { + var self = this, nodeFilters = {}, attributeFilters = [], matchedNodes = {}, matchedAttributes = {}; + + settings = settings || {}; + settings.validate = "validate" in settings ? settings.validate : true; + settings.root_name = settings.root_name || 'body'; + self.schema = schema = schema || new Schema(); + + function fixInvalidChildren(nodes) { + var ni, node, parent, parents, newParent, currentNode, tempNode, childNode, i; + var nonEmptyElements, nonSplitableElements, textBlockElements, sibling, nextNode; + + nonSplitableElements = makeMap('tr,td,th,tbody,thead,tfoot,table'); + nonEmptyElements = schema.getNonEmptyElements(); + textBlockElements = schema.getTextBlockElements(); + + for (ni = 0; ni < nodes.length; ni++) { + node = nodes[ni]; + + // Already removed or fixed + if (!node.parent || node.fixed) { + continue; + } + + // If the invalid element is a text block and the text block is within a parent LI element + // Then unwrap the first text block and convert other sibling text blocks to LI elements similar to Word/Open Office + if (textBlockElements[node.name] && node.parent.name == 'li') { + // Move sibling text blocks after LI element + sibling = node.next; + while (sibling) { + if (textBlockElements[sibling.name]) { + sibling.name = 'li'; + sibling.fixed = true; + node.parent.insert(sibling, node.parent); + } else { + break; + } + + sibling = sibling.next; + } + + // Unwrap current text block + node.unwrap(node); + continue; + } + + // Get list of all parent nodes until we find a valid parent to stick the child into + parents = [node]; + for (parent = node.parent; parent && !schema.isValidChild(parent.name, node.name) && + !nonSplitableElements[parent.name]; parent = parent.parent) { + parents.push(parent); + } + + // Found a suitable parent + if (parent && parents.length > 1) { + // Reverse the array since it makes looping easier + parents.reverse(); + + // Clone the related parent and insert that after the moved node + newParent = currentNode = self.filterNode(parents[0].clone()); + + // Start cloning and moving children on the left side of the target node + for (i = 0; i < parents.length - 1; i++) { + if (schema.isValidChild(currentNode.name, parents[i].name)) { + tempNode = self.filterNode(parents[i].clone()); + currentNode.append(tempNode); + } else { + tempNode = currentNode; + } + + for (childNode = parents[i].firstChild; childNode && childNode != parents[i + 1];) { + nextNode = childNode.next; + tempNode.append(childNode); + childNode = nextNode; + } + + currentNode = tempNode; + } + + if (!newParent.isEmpty(nonEmptyElements)) { + parent.insert(newParent, parents[0], true); + parent.insert(node, newParent); + } else { + parent.insert(node, parents[0], true); + } + + // Check if the element is empty by looking through it's contents and special treatment for


    + parent = parents[0]; + if (parent.isEmpty(nonEmptyElements) || parent.firstChild === parent.lastChild && parent.firstChild.name === 'br') { + parent.empty().remove(); + } + } else if (node.parent) { + // If it's an LI try to find a UL/OL for it or wrap it + if (node.name === 'li') { + sibling = node.prev; + if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) { + sibling.append(node); + continue; + } + + sibling = node.next; + if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) { + sibling.insert(node, sibling.firstChild, true); + continue; + } + + node.wrap(self.filterNode(new Node('ul', 1))); + continue; + } + + // Try wrapping the element in a DIV + if (schema.isValidChild(node.parent.name, 'div') && schema.isValidChild('div', node.name)) { + node.wrap(self.filterNode(new Node('div', 1))); + } else { + // We failed wrapping it, then remove or unwrap it + if (node.name === 'style' || node.name === 'script') { + node.empty().remove(); + } else { + node.unwrap(); + } + } + } + } + } + + /** + * Runs the specified node though the element and attributes filters. + * + * @method filterNode + * @param {tinymce.html.Node} Node the node to run filters on. + * @return {tinymce.html.Node} The passed in node. + */ + self.filterNode = function(node) { + var i, name, list; + + // Run element filters + if (name in nodeFilters) { + list = matchedNodes[name]; + + if (list) { + list.push(node); + } else { + matchedNodes[name] = [node]; + } + } + + // Run attribute filters + i = attributeFilters.length; + while (i--) { + name = attributeFilters[i].name; + + if (name in node.attributes.map) { + list = matchedAttributes[name]; + + if (list) { + list.push(node); + } else { + matchedAttributes[name] = [node]; + } + } + } + + return node; + }; + + /** + * Adds a node filter function to the parser, the parser will collect the specified nodes by name + * and then execute the callback ones it has finished parsing the document. + * + * @example + * parser.addNodeFilter('p,h1', function(nodes, name) { + * for (var i = 0; i < nodes.length; i++) { + * console.log(nodes[i].name); + * } + * }); + * @method addNodeFilter + * @method {String} name Comma separated list of nodes to collect. + * @param {function} callback Callback function to execute once it has collected nodes. + */ + self.addNodeFilter = function(name, callback) { + each(explode(name), function(name) { + var list = nodeFilters[name]; + + if (!list) { + nodeFilters[name] = list = []; + } + + list.push(callback); + }); + }; + + /** + * Adds a attribute filter function to the parser, the parser will collect nodes that has the specified attributes + * and then execute the callback ones it has finished parsing the document. + * + * @example + * parser.addAttributeFilter('src,href', function(nodes, name) { + * for (var i = 0; i < nodes.length; i++) { + * console.log(nodes[i].name); + * } + * }); + * @method addAttributeFilter + * @method {String} name Comma separated list of nodes to collect. + * @param {function} callback Callback function to execute once it has collected nodes. + */ + self.addAttributeFilter = function(name, callback) { + each(explode(name), function(name) { + var i; + + for (i = 0; i < attributeFilters.length; i++) { + if (attributeFilters[i].name === name) { + attributeFilters[i].callbacks.push(callback); + return; + } + } + + attributeFilters.push({name: name, callbacks: [callback]}); + }); + }; + + /** + * Parses the specified HTML string into a DOM like node tree and returns the result. + * + * @example + * var rootNode = new DomParser({...}).parse('text'); + * @method parse + * @param {String} html Html string to sax parse. + * @param {Object} args Optional args object that gets passed to all filter functions. + * @return {tinymce.html.Node} Root node containing the tree. + */ + self.parse = function(html, args) { + var parser, rootNode, node, nodes, i, l, fi, fl, list, name, validate; + var blockElements, startWhiteSpaceRegExp, invalidChildren = [], isInWhiteSpacePreservedElement; + var endWhiteSpaceRegExp, allWhiteSpaceRegExp, isAllWhiteSpaceRegExp, whiteSpaceElements; + var children, nonEmptyElements, rootBlockName; + + args = args || {}; + matchedNodes = {}; + matchedAttributes = {}; + blockElements = extend(makeMap('script,style,head,html,body,title,meta,param'), schema.getBlockElements()); + nonEmptyElements = schema.getNonEmptyElements(); + children = schema.children; + validate = settings.validate; + rootBlockName = "forced_root_block" in args ? args.forced_root_block : settings.forced_root_block; + + whiteSpaceElements = schema.getWhiteSpaceElements(); + startWhiteSpaceRegExp = /^[ \t\r\n]+/; + endWhiteSpaceRegExp = /[ \t\r\n]+$/; + allWhiteSpaceRegExp = /[ \t\r\n]+/g; + isAllWhiteSpaceRegExp = /^[ \t\r\n]+$/; + + function addRootBlocks() { + var node = rootNode.firstChild, next, rootBlockNode; + + // Removes whitespace at beginning and end of block so: + //

    x

    ->

    x

    + function trim(rootBlockNode) { + if (rootBlockNode) { + node = rootBlockNode.firstChild; + if (node && node.type == 3) { + node.value = node.value.replace(startWhiteSpaceRegExp, ''); + } + + node = rootBlockNode.lastChild; + if (node && node.type == 3) { + node.value = node.value.replace(endWhiteSpaceRegExp, ''); + } + } + } + + // Check if rootBlock is valid within rootNode for example if P is valid in H1 if H1 is the contentEditabe root + if (!schema.isValidChild(rootNode.name, rootBlockName.toLowerCase())) { + return; + } + + while (node) { + next = node.next; + + if (node.type == 3 || (node.type == 1 && node.name !== 'p' && + !blockElements[node.name] && !node.attr('data-mce-type'))) { + if (!rootBlockNode) { + // Create a new root block element + rootBlockNode = createNode(rootBlockName, 1); + rootBlockNode.attr(settings.forced_root_block_attrs); + rootNode.insert(rootBlockNode, node); + rootBlockNode.append(node); + } else { + rootBlockNode.append(node); + } + } else { + trim(rootBlockNode); + rootBlockNode = null; + } + + node = next; + } + + trim(rootBlockNode); + } + + function createNode(name, type) { + var node = new Node(name, type), list; + + if (name in nodeFilters) { + list = matchedNodes[name]; + + if (list) { + list.push(node); + } else { + matchedNodes[name] = [node]; + } + } + + return node; + } + + function removeWhitespaceBefore(node) { + var textNode, textVal, sibling; + + for (textNode = node.prev; textNode && textNode.type === 3;) { + textVal = textNode.value.replace(endWhiteSpaceRegExp, ''); + + if (textVal.length > 0) { + textNode.value = textVal; + textNode = textNode.prev; + } else { + sibling = textNode.prev; + textNode.remove(); + textNode = sibling; + } + } + } + + function cloneAndExcludeBlocks(input) { + var name, output = {}; + + for (name in input) { + if (name !== 'li' && name != 'p') { + output[name] = input[name]; + } + } + + return output; + } + + parser = new SaxParser({ + validate: validate, + allow_script_urls: settings.allow_script_urls, + allow_conditional_comments: settings.allow_conditional_comments, + + // Exclude P and LI from DOM parsing since it's treated better by the DOM parser + self_closing_elements: cloneAndExcludeBlocks(schema.getSelfClosingElements()), + + cdata: function(text) { + node.append(createNode('#cdata', 4)).value = text; + }, + + text: function(text, raw) { + var textNode; + + // Trim all redundant whitespace on non white space elements + if (!isInWhiteSpacePreservedElement) { + text = text.replace(allWhiteSpaceRegExp, ' '); + + if (node.lastChild && blockElements[node.lastChild.name]) { + text = text.replace(startWhiteSpaceRegExp, ''); + } + } + + // Do we need to create the node + if (text.length !== 0) { + textNode = createNode('#text', 3); + textNode.raw = !!raw; + node.append(textNode).value = text; + } + }, + + comment: function(text) { + node.append(createNode('#comment', 8)).value = text; + }, + + pi: function(name, text) { + node.append(createNode(name, 7)).value = text; + removeWhitespaceBefore(node); + }, + + doctype: function(text) { + var newNode; + + newNode = node.append(createNode('#doctype', 10)); + newNode.value = text; + removeWhitespaceBefore(node); + }, + + start: function(name, attrs, empty) { + var newNode, attrFiltersLen, elementRule, attrName, parent; + + elementRule = validate ? schema.getElementRule(name) : {}; + if (elementRule) { + newNode = createNode(elementRule.outputName || name, 1); + newNode.attributes = attrs; + newNode.shortEnded = empty; + + node.append(newNode); + + // Check if node is valid child of the parent node is the child is + // unknown we don't collect it since it's probably a custom element + parent = children[node.name]; + if (parent && children[newNode.name] && !parent[newNode.name]) { + invalidChildren.push(newNode); + } + + attrFiltersLen = attributeFilters.length; + while (attrFiltersLen--) { + attrName = attributeFilters[attrFiltersLen].name; + + if (attrName in attrs.map) { + list = matchedAttributes[attrName]; + + if (list) { + list.push(newNode); + } else { + matchedAttributes[attrName] = [newNode]; + } + } + } + + // Trim whitespace before block + if (blockElements[name]) { + removeWhitespaceBefore(newNode); + } + + // Change current node if the element wasn't empty i.e not
    or + if (!empty) { + node = newNode; + } + + // Check if we are inside a whitespace preserved element + if (!isInWhiteSpacePreservedElement && whiteSpaceElements[name]) { + isInWhiteSpacePreservedElement = true; + } + } + }, + + end: function(name) { + var textNode, elementRule, text, sibling, tempNode; + + elementRule = validate ? schema.getElementRule(name) : {}; + if (elementRule) { + if (blockElements[name]) { + if (!isInWhiteSpacePreservedElement) { + // Trim whitespace of the first node in a block + textNode = node.firstChild; + if (textNode && textNode.type === 3) { + text = textNode.value.replace(startWhiteSpaceRegExp, ''); + + // Any characters left after trim or should we remove it + if (text.length > 0) { + textNode.value = text; + textNode = textNode.next; + } else { + sibling = textNode.next; + textNode.remove(); + textNode = sibling; + + // Remove any pure whitespace siblings + while (textNode && textNode.type === 3) { + text = textNode.value; + sibling = textNode.next; + + if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) { + textNode.remove(); + textNode = sibling; + } + + textNode = sibling; + } + } + } + + // Trim whitespace of the last node in a block + textNode = node.lastChild; + if (textNode && textNode.type === 3) { + text = textNode.value.replace(endWhiteSpaceRegExp, ''); + + // Any characters left after trim or should we remove it + if (text.length > 0) { + textNode.value = text; + textNode = textNode.prev; + } else { + sibling = textNode.prev; + textNode.remove(); + textNode = sibling; + + // Remove any pure whitespace siblings + while (textNode && textNode.type === 3) { + text = textNode.value; + sibling = textNode.prev; + + if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) { + textNode.remove(); + textNode = sibling; + } + + textNode = sibling; + } + } + } + } + + // Trim start white space + // Removed due to: #5424 + /*textNode = node.prev; + if (textNode && textNode.type === 3) { + text = textNode.value.replace(startWhiteSpaceRegExp, ''); + + if (text.length > 0) + textNode.value = text; + else + textNode.remove(); + }*/ + } + + // Check if we exited a whitespace preserved element + if (isInWhiteSpacePreservedElement && whiteSpaceElements[name]) { + isInWhiteSpacePreservedElement = false; + } + + // Handle empty nodes + if (elementRule.removeEmpty || elementRule.paddEmpty) { + if (node.isEmpty(nonEmptyElements)) { + if (elementRule.paddEmpty) { + node.empty().append(new Node('#text', '3')).value = '\u00a0'; + } else { + // Leave nodes that have a name like + if (!node.attributes.map.name && !node.attributes.map.id) { + tempNode = node.parent; + + if (blockElements[node.name]) { + node.empty().remove(); + } else { + node.unwrap(); + } + + node = tempNode; + return; + } + } + } + } + + node = node.parent; + } + } + }, schema); + + rootNode = node = new Node(args.context || settings.root_name, 11); + + parser.parse(html); + + // Fix invalid children or report invalid children in a contextual parsing + if (validate && invalidChildren.length) { + if (!args.context) { + fixInvalidChildren(invalidChildren); + } else { + args.invalid = true; + } + } + + // Wrap nodes in the root into block elements if the root is body + if (rootBlockName && (rootNode.name == 'body' || args.isRootContent)) { + addRootBlocks(); + } + + // Run filters only when the contents is valid + if (!args.invalid) { + // Run node filters + for (name in matchedNodes) { + list = nodeFilters[name]; + nodes = matchedNodes[name]; + + // Remove already removed children + fi = nodes.length; + while (fi--) { + if (!nodes[fi].parent) { + nodes.splice(fi, 1); + } + } + + for (i = 0, l = list.length; i < l; i++) { + list[i](nodes, name, args); + } + } + + // Run attribute filters + for (i = 0, l = attributeFilters.length; i < l; i++) { + list = attributeFilters[i]; + + if (list.name in matchedAttributes) { + nodes = matchedAttributes[list.name]; + + // Remove already removed children + fi = nodes.length; + while (fi--) { + if (!nodes[fi].parent) { + nodes.splice(fi, 1); + } + } + + for (fi = 0, fl = list.callbacks.length; fi < fl; fi++) { + list.callbacks[fi](nodes, list.name, args); + } + } + } + } + + return rootNode; + }; + + // Remove
    at end of block elements Gecko and WebKit injects BR elements to + // make it possible to place the caret inside empty blocks. This logic tries to remove + // these elements and keep br elements that where intended to be there intact + if (settings.remove_trailing_brs) { + self.addNodeFilter('br', function(nodes) { + var i, l = nodes.length, node, blockElements = extend({}, schema.getBlockElements()); + var nonEmptyElements = schema.getNonEmptyElements(), parent, lastParent, prev, prevName; + var elementRule, textNode; + + // Remove brs from body element as well + blockElements.body = 1; + + // Must loop forwards since it will otherwise remove all brs in

    a


    + for (i = 0; i < l; i++) { + node = nodes[i]; + parent = node.parent; + + if (blockElements[node.parent.name] && node === parent.lastChild) { + // Loop all nodes to the left of the current node and check for other BR elements + // excluding bookmarks since they are invisible + prev = node.prev; + while (prev) { + prevName = prev.name; + + // Ignore bookmarks + if (prevName !== "span" || prev.attr('data-mce-type') !== 'bookmark') { + // Found a non BR element + if (prevName !== "br") { + break; + } + + // Found another br it's a

    structure then don't remove anything + if (prevName === 'br') { + node = null; + break; + } + } + + prev = prev.prev; + } + + if (node) { + node.remove(); + + // Is the parent to be considered empty after we removed the BR + if (parent.isEmpty(nonEmptyElements)) { + elementRule = schema.getElementRule(parent.name); + + // Remove or padd the element depending on schema rule + if (elementRule) { + if (elementRule.removeEmpty) { + parent.remove(); + } else if (elementRule.paddEmpty) { + parent.empty().append(new Node('#text', 3)).value = '\u00a0'; + } + } + } + } + } else { + // Replaces BR elements inside inline elements like


    + // so they become

     

    + lastParent = node; + while (parent && parent.firstChild === lastParent && parent.lastChild === lastParent) { + lastParent = parent; + + if (blockElements[parent.name]) { + break; + } + + parent = parent.parent; + } + + if (lastParent === parent) { + textNode = new Node('#text', 3); + textNode.value = '\u00a0'; + node.replace(textNode); + } + } + } + }); + } + + // Force anchor names closed, unless the setting "allow_html_in_named_anchor" is explicitly included. + if (!settings.allow_html_in_named_anchor) { + self.addAttributeFilter('id,name', function(nodes) { + var i = nodes.length, sibling, prevSibling, parent, node; + + while (i--) { + node = nodes[i]; + if (node.name === 'a' && node.firstChild && !node.attr('href')) { + parent = node.parent; + + // Move children after current node + sibling = node.lastChild; + do { + prevSibling = sibling.prev; + parent.insert(sibling, node); + sibling = prevSibling; + } while (sibling); + } + } + }); + } + + if (settings.validate && schema.getValidClasses()) { + self.addAttributeFilter('class', function(nodes) { + var i = nodes.length, node, classList, ci, className, classValue; + var validClasses = schema.getValidClasses(), validClassesMap, valid; + + while (i--) { + node = nodes[i]; + classList = node.attr('class').split(' '); + classValue = ''; + + for (ci = 0; ci < classList.length; ci++) { + className = classList[ci]; + valid = false; + + validClassesMap = validClasses['*']; + if (validClassesMap && validClassesMap[className]) { + valid = true; + } + + validClassesMap = validClasses[node.name]; + if (!valid && validClassesMap && validClassesMap[className]) { + valid = true; + } + + if (valid) { + if (classValue) { + classValue += ' '; + } + + classValue += className; + } + } + + if (!classValue.length) { + classValue = null; + } + + node.attr('class', classValue); + } + }); + } + }; +}); + +// Included from: js/tinymce/classes/html/Writer.js + +/** + * Writer.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to write HTML tags out it can be used with the Serializer or the SaxParser. + * + * @class tinymce.html.Writer + * @example + * var writer = new tinymce.html.Writer({indent: true}); + * var parser = new tinymce.html.SaxParser(writer).parse('


    '); + * console.log(writer.getContent()); + * + * @class tinymce.html.Writer + * @version 3.4 + */ +define("tinymce/html/Writer", [ + "tinymce/html/Entities", + "tinymce/util/Tools" +], function(Entities, Tools) { + var makeMap = Tools.makeMap; + + /** + * Constructs a new Writer instance. + * + * @constructor + * @method Writer + * @param {Object} settings Name/value settings object. + */ + return function(settings) { + var html = [], indent, indentBefore, indentAfter, encode, htmlOutput; + + settings = settings || {}; + indent = settings.indent; + indentBefore = makeMap(settings.indent_before || ''); + indentAfter = makeMap(settings.indent_after || ''); + encode = Entities.getEncodeFunc(settings.entity_encoding || 'raw', settings.entities); + htmlOutput = settings.element_format == "html"; + + return { + /** + * Writes the a start element such as

    . + * + * @method start + * @param {String} name Name of the element. + * @param {Array} attrs Optional attribute array or undefined if it hasn't any. + * @param {Boolean} empty Optional empty state if the tag should end like
    . + */ + start: function(name, attrs, empty) { + var i, l, attr, value; + + if (indent && indentBefore[name] && html.length > 0) { + value = html[html.length - 1]; + + if (value.length > 0 && value !== '\n') { + html.push('\n'); + } + } + + html.push('<', name); + + if (attrs) { + for (i = 0, l = attrs.length; i < l; i++) { + attr = attrs[i]; + html.push(' ', attr.name, '="', encode(attr.value, true), '"'); + } + } + + if (!empty || htmlOutput) { + html[html.length] = '>'; + } else { + html[html.length] = ' />'; + } + + if (empty && indent && indentAfter[name] && html.length > 0) { + value = html[html.length - 1]; + + if (value.length > 0 && value !== '\n') { + html.push('\n'); + } + } + }, + + /** + * Writes the a end element such as

    . + * + * @method end + * @param {String} name Name of the element. + */ + end: function(name) { + var value; + + /*if (indent && indentBefore[name] && html.length > 0) { + value = html[html.length - 1]; + + if (value.length > 0 && value !== '\n') + html.push('\n'); + }*/ + + html.push(''); + + if (indent && indentAfter[name] && html.length > 0) { + value = html[html.length - 1]; + + if (value.length > 0 && value !== '\n') { + html.push('\n'); + } + } + }, + + /** + * Writes a text node. + * + * @method text + * @param {String} text String to write out. + * @param {Boolean} raw Optional raw state if true the contents wont get encoded. + */ + text: function(text, raw) { + if (text.length > 0) { + html[html.length] = raw ? text : encode(text); + } + }, + + /** + * Writes a cdata node such as . + * + * @method cdata + * @param {String} text String to write out inside the cdata. + */ + cdata: function(text) { + html.push(''); + }, + + /** + * Writes a comment node such as . + * + * @method cdata + * @param {String} text String to write out inside the comment. + */ + comment: function(text) { + html.push(''); + }, + + /** + * Writes a PI node such as . + * + * @method pi + * @param {String} name Name of the pi. + * @param {String} text String to write out inside the pi. + */ + pi: function(name, text) { + if (text) { + html.push(''); + } else { + html.push(''); + } + + if (indent) { + html.push('\n'); + } + }, + + /** + * Writes a doctype node such as . + * + * @method doctype + * @param {String} text String to write out inside the doctype. + */ + doctype: function(text) { + html.push('', indent ? '\n' : ''); + }, + + /** + * Resets the internal buffer if one wants to reuse the writer. + * + * @method reset + */ + reset: function() { + html.length = 0; + }, + + /** + * Returns the contents that got serialized. + * + * @method getContent + * @return {String} HTML contents that got written down. + */ + getContent: function() { + return html.join('').replace(/\n$/, ''); + } + }; + }; +}); + +// Included from: js/tinymce/classes/html/Serializer.js + +/** + * Serializer.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to serialize down the DOM tree into a string using a Writer instance. + * + * + * @example + * new tinymce.html.Serializer().serialize(new tinymce.html.DomParser().parse('

    text

    ')); + * @class tinymce.html.Serializer + * @version 3.4 + */ +define("tinymce/html/Serializer", [ + "tinymce/html/Writer", + "tinymce/html/Schema" +], function(Writer, Schema) { + /** + * Constructs a new Serializer instance. + * + * @constructor + * @method Serializer + * @param {Object} settings Name/value settings object. + * @param {tinymce.html.Schema} schema Schema instance to use. + */ + return function(settings, schema) { + var self = this, writer = new Writer(settings); + + settings = settings || {}; + settings.validate = "validate" in settings ? settings.validate : true; + + self.schema = schema = schema || new Schema(); + self.writer = writer; + + /** + * Serializes the specified node into a string. + * + * @example + * new tinymce.html.Serializer().serialize(new tinymce.html.DomParser().parse('

    text

    ')); + * @method serialize + * @param {tinymce.html.Node} node Node instance to serialize. + * @return {String} String with HTML based on DOM tree. + */ + self.serialize = function(node) { + var handlers, validate; + + validate = settings.validate; + + handlers = { + // #text + 3: function(node) { + writer.text(node.value, node.raw); + }, + + // #comment + 8: function(node) { + writer.comment(node.value); + }, + + // Processing instruction + 7: function(node) { + writer.pi(node.name, node.value); + }, + + // Doctype + 10: function(node) { + writer.doctype(node.value); + }, + + // CDATA + 4: function(node) { + writer.cdata(node.value); + }, + + // Document fragment + 11: function(node) { + if ((node = node.firstChild)) { + do { + walk(node); + } while ((node = node.next)); + } + } + }; + + writer.reset(); + + function walk(node) { + var handler = handlers[node.type], name, isEmpty, attrs, attrName, attrValue, sortedAttrs, i, l, elementRule; + + if (!handler) { + name = node.name; + isEmpty = node.shortEnded; + attrs = node.attributes; + + // Sort attributes + if (validate && attrs && attrs.length > 1) { + sortedAttrs = []; + sortedAttrs.map = {}; + + elementRule = schema.getElementRule(node.name); + for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) { + attrName = elementRule.attributesOrder[i]; + + if (attrName in attrs.map) { + attrValue = attrs.map[attrName]; + sortedAttrs.map[attrName] = attrValue; + sortedAttrs.push({name: attrName, value: attrValue}); + } + } + + for (i = 0, l = attrs.length; i < l; i++) { + attrName = attrs[i].name; + + if (!(attrName in sortedAttrs.map)) { + attrValue = attrs.map[attrName]; + sortedAttrs.map[attrName] = attrValue; + sortedAttrs.push({name: attrName, value: attrValue}); + } + } + + attrs = sortedAttrs; + } + + writer.start(node.name, attrs, isEmpty); + + if (!isEmpty) { + if ((node = node.firstChild)) { + do { + walk(node); + } while ((node = node.next)); + } + + writer.end(name); + } + } else { + handler(node); + } + } + + // Serialize element and treat all non elements as fragments + if (node.type == 1 && !settings.inner) { + walk(node); + } else { + handlers[11](node); + } + + return writer.getContent(); + }; + }; +}); + +// Included from: js/tinymce/classes/dom/Serializer.js + +/** + * Serializer.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to serialize DOM trees into a string. Consult the TinyMCE Wiki API for + * more details and examples on how to use this class. + * + * @class tinymce.dom.Serializer + */ +define("tinymce/dom/Serializer", [ + "tinymce/dom/DOMUtils", + "tinymce/html/DomParser", + "tinymce/html/Entities", + "tinymce/html/Serializer", + "tinymce/html/Node", + "tinymce/html/Schema", + "tinymce/Env", + "tinymce/util/Tools" +], function(DOMUtils, DomParser, Entities, Serializer, Node, Schema, Env, Tools) { + var each = Tools.each, trim = Tools.trim; + var DOM = DOMUtils.DOM; + + /** + * Constructs a new DOM serializer class. + * + * @constructor + * @method Serializer + * @param {Object} settings Serializer settings object. + * @param {tinymce.Editor} editor Optional editor to bind events to and get schema/dom from. + */ + return function(settings, editor) { + var dom, schema, htmlParser; + + if (editor) { + dom = editor.dom; + schema = editor.schema; + } + + // Default DOM and Schema if they are undefined + dom = dom || DOM; + schema = schema || new Schema(settings); + settings.entity_encoding = settings.entity_encoding || 'named'; + settings.remove_trailing_brs = "remove_trailing_brs" in settings ? settings.remove_trailing_brs : true; + + htmlParser = new DomParser(settings, schema); + + // Convert tabindex back to elements when serializing contents + htmlParser.addAttributeFilter('data-mce-tabindex', function(nodes, name) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i]; + node.attr('tabindex', node.attributes.map['data-mce-tabindex']); + node.attr(name, null); + } + }); + + // Convert move data-mce-src, data-mce-href and data-mce-style into nodes or process them if needed + htmlParser.addAttributeFilter('src,href,style', function(nodes, name) { + var i = nodes.length, node, value, internalName = 'data-mce-' + name; + var urlConverter = settings.url_converter, urlConverterScope = settings.url_converter_scope, undef; + + while (i--) { + node = nodes[i]; + + value = node.attributes.map[internalName]; + if (value !== undef) { + // Set external name to internal value and remove internal + node.attr(name, value.length > 0 ? value : null); + node.attr(internalName, null); + } else { + // No internal attribute found then convert the value we have in the DOM + value = node.attributes.map[name]; + + if (name === "style") { + value = dom.serializeStyle(dom.parseStyle(value), node.name); + } else if (urlConverter) { + value = urlConverter.call(urlConverterScope, value, name, node.name); + } + + node.attr(name, value.length > 0 ? value : null); + } + } + }); + + // Remove internal classes mceItem<..> or mceSelected + htmlParser.addAttributeFilter('class', function(nodes) { + var i = nodes.length, node, value; + + while (i--) { + node = nodes[i]; + value = node.attr('class'); + + if (value) { + value = node.attr('class').replace(/(?:^|\s)mce-item-\w+(?!\S)/g, ''); + node.attr('class', value.length > 0 ? value : null); + } + } + }); + + // Remove bookmark elements + htmlParser.addAttributeFilter('data-mce-type', function(nodes, name, args) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i]; + + if (node.attributes.map['data-mce-type'] === 'bookmark' && !args.cleanup) { + node.remove(); + } + } + }); + + htmlParser.addNodeFilter('noscript', function(nodes) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i].firstChild; + + if (node) { + node.value = Entities.decode(node.value); + } + } + }); + + // Force script into CDATA sections and remove the mce- prefix also add comments around styles + htmlParser.addNodeFilter('script,style', function(nodes, name) { + var i = nodes.length, node, value, type; + + function trim(value) { + /*jshint maxlen:255 */ + /*eslint max-len:0 */ + return value.replace(/()/g, '\n') + .replace(/^[\r\n]*|[\r\n]*$/g, '') + .replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g, ''); + } + + while (i--) { + node = nodes[i]; + value = node.firstChild ? node.firstChild.value : ''; + + if (name === "script") { + // Remove mce- prefix from script elements and remove default type since the user specified + // a script element without type attribute + type = node.attr('type'); + if (type) { + node.attr('type', type == 'mce-no/type' ? null : type.replace(/^mce\-/, '')); + } + + if (value.length > 0) { + node.firstChild.value = '// '; + } + } else { + if (value.length > 0) { + node.firstChild.value = ''; + } + } + } + }); + + // Convert comments to cdata and handle protected comments + htmlParser.addNodeFilter('#comment', function(nodes) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i]; + + if (node.value.indexOf('[CDATA[') === 0) { + node.name = '#cdata'; + node.type = 4; + node.value = node.value.replace(/^\[CDATA\[|\]\]$/g, ''); + } else if (node.value.indexOf('mce:protected ') === 0) { + node.name = "#text"; + node.type = 3; + node.raw = true; + node.value = unescape(node.value).substr(14); + } + } + }); + + htmlParser.addNodeFilter('xml:namespace,input', function(nodes, name) { + var i = nodes.length, node; + + while (i--) { + node = nodes[i]; + if (node.type === 7) { + node.remove(); + } else if (node.type === 1) { + if (name === "input" && !("type" in node.attributes.map)) { + node.attr('type', 'text'); + } + } + } + }); + + // Fix list elements, TODO: Replace this later + if (settings.fix_list_elements) { + htmlParser.addNodeFilter('ul,ol', function(nodes) { + var i = nodes.length, node, parentNode; + + while (i--) { + node = nodes[i]; + parentNode = node.parent; + + if (parentNode.name === 'ul' || parentNode.name === 'ol') { + if (node.prev && node.prev.name === 'li') { + node.prev.append(node); + } + } + } + }); + } + + // Remove internal data attributes + htmlParser.addAttributeFilter( + 'data-mce-src,data-mce-href,data-mce-style,' + + 'data-mce-selected,data-mce-expando,' + + 'data-mce-type,data-mce-resize', + + function(nodes, name) { + var i = nodes.length; + + while (i--) { + nodes[i].attr(name, null); + } + } + ); + + // Return public methods + return { + /** + * Schema instance that was used to when the Serializer was constructed. + * + * @field {tinymce.html.Schema} schema + */ + schema: schema, + + /** + * Adds a node filter function to the parser used by the serializer, the parser will collect the specified nodes by name + * and then execute the callback ones it has finished parsing the document. + * + * @example + * parser.addNodeFilter('p,h1', function(nodes, name) { + * for (var i = 0; i < nodes.length; i++) { + * console.log(nodes[i].name); + * } + * }); + * @method addNodeFilter + * @method {String} name Comma separated list of nodes to collect. + * @param {function} callback Callback function to execute once it has collected nodes. + */ + addNodeFilter: htmlParser.addNodeFilter, + + /** + * Adds a attribute filter function to the parser used by the serializer, the parser will + * collect nodes that has the specified attributes + * and then execute the callback ones it has finished parsing the document. + * + * @example + * parser.addAttributeFilter('src,href', function(nodes, name) { + * for (var i = 0; i < nodes.length; i++) { + * console.log(nodes[i].name); + * } + * }); + * @method addAttributeFilter + * @method {String} name Comma separated list of nodes to collect. + * @param {function} callback Callback function to execute once it has collected nodes. + */ + addAttributeFilter: htmlParser.addAttributeFilter, + + /** + * Serializes the specified browser DOM node into a HTML string. + * + * @method serialize + * @param {DOMNode} node DOM node to serialize. + * @param {Object} args Arguments option that gets passed to event handlers. + */ + serialize: function(node, args) { + var self = this, impl, doc, oldDoc, htmlSerializer, content; + + // Explorer won't clone contents of script and style and the + // selected index of select elements are cleared on a clone operation. + if (Env.ie && dom.select('script,style,select,map').length > 0) { + content = node.innerHTML; + node = node.cloneNode(false); + dom.setHTML(node, content); + } else { + node = node.cloneNode(true); + } + + // Nodes needs to be attached to something in WebKit/Opera + // This fix will make DOM ranges and make Sizzle happy! + impl = node.ownerDocument.implementation; + if (impl.createHTMLDocument) { + // Create an empty HTML document + doc = impl.createHTMLDocument(""); + + // Add the element or it's children if it's a body element to the new document + each(node.nodeName == 'BODY' ? node.childNodes : [node], function(node) { + doc.body.appendChild(doc.importNode(node, true)); + }); + + // Grab first child or body element for serialization + if (node.nodeName != 'BODY') { + node = doc.body.firstChild; + } else { + node = doc.body; + } + + // set the new document in DOMUtils so createElement etc works + oldDoc = dom.doc; + dom.doc = doc; + } + + args = args || {}; + args.format = args.format || 'html'; + + // Don't wrap content if we want selected html + if (args.selection) { + args.forced_root_block = ''; + } + + // Pre process + if (!args.no_events) { + args.node = node; + self.onPreProcess(args); + } + + // Setup serializer + htmlSerializer = new Serializer(settings, schema); + + // Parse and serialize HTML + args.content = htmlSerializer.serialize( + htmlParser.parse(trim(args.getInner ? node.innerHTML : dom.getOuterHTML(node)), args) + ); + + // Replace all BOM characters for now until we can find a better solution + if (!args.cleanup) { + args.content = args.content.replace(/\uFEFF/g, ''); + } + + // Post process + if (!args.no_events) { + self.onPostProcess(args); + } + + // Restore the old document if it was changed + if (oldDoc) { + dom.doc = oldDoc; + } + + args.node = null; + + return args.content; + }, + + /** + * Adds valid elements rules to the serializers schema instance this enables you to specify things + * like what elements should be outputted and what attributes specific elements might have. + * Consult the Wiki for more details on this format. + * + * @method addRules + * @param {String} rules Valid elements rules string to add to schema. + */ + addRules: function(rules) { + schema.addValidElements(rules); + }, + + /** + * Sets the valid elements rules to the serializers schema instance this enables you to specify things + * like what elements should be outputted and what attributes specific elements might have. + * Consult the Wiki for more details on this format. + * + * @method setRules + * @param {String} rules Valid elements rules string. + */ + setRules: function(rules) { + schema.setValidElements(rules); + }, + + onPreProcess: function(args) { + if (editor) { + editor.fire('PreProcess', args); + } + }, + + onPostProcess: function(args) { + if (editor) { + editor.fire('PostProcess', args); + } + } + }; + }; +}); + +// Included from: js/tinymce/classes/dom/TridentSelection.js + +/** + * TridentSelection.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Selection class for old explorer versions. This one fakes the + * native selection object available on modern browsers. + * + * @class tinymce.dom.TridentSelection + */ +define("tinymce/dom/TridentSelection", [], function() { + function Selection(selection) { + var self = this, dom = selection.dom, FALSE = false; + + function getPosition(rng, start) { + var checkRng, startIndex = 0, endIndex, inside, + children, child, offset, index, position = -1, parent; + + // Setup test range, collapse it and get the parent + checkRng = rng.duplicate(); + checkRng.collapse(start); + parent = checkRng.parentElement(); + + // Check if the selection is within the right document + if (parent.ownerDocument !== selection.dom.doc) { + return; + } + + // IE will report non editable elements as it's parent so look for an editable one + while (parent.contentEditable === "false") { + parent = parent.parentNode; + } + + // If parent doesn't have any children then return that we are inside the element + if (!parent.hasChildNodes()) { + return {node: parent, inside: 1}; + } + + // Setup node list and endIndex + children = parent.children; + endIndex = children.length - 1; + + // Perform a binary search for the position + while (startIndex <= endIndex) { + index = Math.floor((startIndex + endIndex) / 2); + + // Move selection to node and compare the ranges + child = children[index]; + checkRng.moveToElementText(child); + position = checkRng.compareEndPoints(start ? 'StartToStart' : 'EndToEnd', rng); + + // Before/after or an exact match + if (position > 0) { + endIndex = index - 1; + } else if (position < 0) { + startIndex = index + 1; + } else { + return {node: child}; + } + } + + // Check if child position is before or we didn't find a position + if (position < 0) { + // No element child was found use the parent element and the offset inside that + if (!child) { + checkRng.moveToElementText(parent); + checkRng.collapse(true); + child = parent; + inside = true; + } else { + checkRng.collapse(false); + } + + // Walk character by character in text node until we hit the selected range endpoint, + // hit the end of document or parent isn't the right one + // We need to walk char by char since rng.text or rng.htmlText will trim line endings + offset = 0; + while (checkRng.compareEndPoints(start ? 'StartToStart' : 'StartToEnd', rng) !== 0) { + if (checkRng.move('character', 1) === 0 || parent != checkRng.parentElement()) { + break; + } + + offset++; + } + } else { + // Child position is after the selection endpoint + checkRng.collapse(true); + + // Walk character by character in text node until we hit the selected range endpoint, hit + // the end of document or parent isn't the right one + offset = 0; + while (checkRng.compareEndPoints(start ? 'StartToStart' : 'StartToEnd', rng) !== 0) { + if (checkRng.move('character', -1) === 0 || parent != checkRng.parentElement()) { + break; + } + + offset++; + } + } + + return {node: child, position: position, offset: offset, inside: inside}; + } + + // Returns a W3C DOM compatible range object by using the IE Range API + function getRange() { + var ieRange = selection.getRng(), domRange = dom.createRng(), element, collapsed, tmpRange, element2, bookmark; + + // If selection is outside the current document just return an empty range + element = ieRange.item ? ieRange.item(0) : ieRange.parentElement(); + if (element.ownerDocument != dom.doc) { + return domRange; + } + + collapsed = selection.isCollapsed(); + + // Handle control selection + if (ieRange.item) { + domRange.setStart(element.parentNode, dom.nodeIndex(element)); + domRange.setEnd(domRange.startContainer, domRange.startOffset + 1); + + return domRange; + } + + function findEndPoint(start) { + var endPoint = getPosition(ieRange, start), container, offset, textNodeOffset = 0, sibling, undef, nodeValue; + + container = endPoint.node; + offset = endPoint.offset; + + if (endPoint.inside && !container.hasChildNodes()) { + domRange[start ? 'setStart' : 'setEnd'](container, 0); + return; + } + + if (offset === undef) { + domRange[start ? 'setStartBefore' : 'setEndAfter'](container); + return; + } + + if (endPoint.position < 0) { + sibling = endPoint.inside ? container.firstChild : container.nextSibling; + + if (!sibling) { + domRange[start ? 'setStartAfter' : 'setEndAfter'](container); + return; + } + + if (!offset) { + if (sibling.nodeType == 3) { + domRange[start ? 'setStart' : 'setEnd'](sibling, 0); + } else { + domRange[start ? 'setStartBefore' : 'setEndBefore'](sibling); + } + + return; + } + + // Find the text node and offset + while (sibling) { + if (sibling.nodeType == 3) { + nodeValue = sibling.nodeValue; + textNodeOffset += nodeValue.length; + + // We are at or passed the position we where looking for + if (textNodeOffset >= offset) { + container = sibling; + textNodeOffset -= offset; + textNodeOffset = nodeValue.length - textNodeOffset; + break; + } + } + + sibling = sibling.nextSibling; + } + } else { + // Find the text node and offset + sibling = container.previousSibling; + + if (!sibling) { + return domRange[start ? 'setStartBefore' : 'setEndBefore'](container); + } + + // If there isn't any text to loop then use the first position + if (!offset) { + if (container.nodeType == 3) { + domRange[start ? 'setStart' : 'setEnd'](sibling, container.nodeValue.length); + } else { + domRange[start ? 'setStartAfter' : 'setEndAfter'](sibling); + } + + return; + } + + while (sibling) { + if (sibling.nodeType == 3) { + textNodeOffset += sibling.nodeValue.length; + + // We are at or passed the position we where looking for + if (textNodeOffset >= offset) { + container = sibling; + textNodeOffset -= offset; + break; + } + } + + sibling = sibling.previousSibling; + } + } + + domRange[start ? 'setStart' : 'setEnd'](container, textNodeOffset); + } + + try { + // Find start point + findEndPoint(true); + + // Find end point if needed + if (!collapsed) { + findEndPoint(); + } + } catch (ex) { + // IE has a nasty bug where text nodes might throw "invalid argument" when you + // access the nodeValue or other properties of text nodes. This seems to happend when + // text nodes are split into two nodes by a delete/backspace call. So lets detect it and try to fix it. + if (ex.number == -2147024809) { + // Get the current selection + bookmark = self.getBookmark(2); + + // Get start element + tmpRange = ieRange.duplicate(); + tmpRange.collapse(true); + element = tmpRange.parentElement(); + + // Get end element + if (!collapsed) { + tmpRange = ieRange.duplicate(); + tmpRange.collapse(false); + element2 = tmpRange.parentElement(); + element2.innerHTML = element2.innerHTML; + } + + // Remove the broken elements + element.innerHTML = element.innerHTML; + + // Restore the selection + self.moveToBookmark(bookmark); + + // Since the range has moved we need to re-get it + ieRange = selection.getRng(); + + // Find start point + findEndPoint(true); + + // Find end point if needed + if (!collapsed) { + findEndPoint(); + } + } else { + throw ex; // Throw other errors + } + } + + return domRange; + } + + this.getBookmark = function(type) { + var rng = selection.getRng(), bookmark = {}; + + function getIndexes(node) { + var parent, root, children, i, indexes = []; + + parent = node.parentNode; + root = dom.getRoot().parentNode; + + while (parent != root && parent.nodeType !== 9) { + children = parent.children; + + i = children.length; + while (i--) { + if (node === children[i]) { + indexes.push(i); + break; + } + } + + node = parent; + parent = parent.parentNode; + } + + return indexes; + } + + function getBookmarkEndPoint(start) { + var position; + + position = getPosition(rng, start); + if (position) { + return { + position: position.position, + offset: position.offset, + indexes: getIndexes(position.node), + inside: position.inside + }; + } + } + + // Non ubstructive bookmark + if (type === 2) { + // Handle text selection + if (!rng.item) { + bookmark.start = getBookmarkEndPoint(true); + + if (!selection.isCollapsed()) { + bookmark.end = getBookmarkEndPoint(); + } + } else { + bookmark.start = {ctrl: true, indexes: getIndexes(rng.item(0))}; + } + } + + return bookmark; + }; + + this.moveToBookmark = function(bookmark) { + var rng, body = dom.doc.body; + + function resolveIndexes(indexes) { + var node, i, idx, children; + + node = dom.getRoot(); + for (i = indexes.length - 1; i >= 0; i--) { + children = node.children; + idx = indexes[i]; + + if (idx <= children.length - 1) { + node = children[idx]; + } + } + + return node; + } + + function setBookmarkEndPoint(start) { + var endPoint = bookmark[start ? 'start' : 'end'], moveLeft, moveRng, undef, offset; + + if (endPoint) { + moveLeft = endPoint.position > 0; + + moveRng = body.createTextRange(); + moveRng.moveToElementText(resolveIndexes(endPoint.indexes)); + + offset = endPoint.offset; + if (offset !== undef) { + moveRng.collapse(endPoint.inside || moveLeft); + moveRng.moveStart('character', moveLeft ? -offset : offset); + } else { + moveRng.collapse(start); + } + + rng.setEndPoint(start ? 'StartToStart' : 'EndToStart', moveRng); + + if (start) { + rng.collapse(true); + } + } + } + + if (bookmark.start) { + if (bookmark.start.ctrl) { + rng = body.createControlRange(); + rng.addElement(resolveIndexes(bookmark.start.indexes)); + rng.select(); + } else { + rng = body.createTextRange(); + setBookmarkEndPoint(true); + setBookmarkEndPoint(); + rng.select(); + } + } + }; + + this.addRange = function(rng) { + var ieRng, ctrlRng, startContainer, startOffset, endContainer, endOffset, sibling, + doc = selection.dom.doc, body = doc.body, nativeRng, ctrlElm; + + function setEndPoint(start) { + var container, offset, marker, tmpRng, nodes; + + marker = dom.create('a'); + container = start ? startContainer : endContainer; + offset = start ? startOffset : endOffset; + tmpRng = ieRng.duplicate(); + + if (container == doc || container == doc.documentElement) { + container = body; + offset = 0; + } + + if (container.nodeType == 3) { + container.parentNode.insertBefore(marker, container); + tmpRng.moveToElementText(marker); + tmpRng.moveStart('character', offset); + dom.remove(marker); + ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng); + } else { + nodes = container.childNodes; + + if (nodes.length) { + if (offset >= nodes.length) { + dom.insertAfter(marker, nodes[nodes.length - 1]); + } else { + container.insertBefore(marker, nodes[offset]); + } + + tmpRng.moveToElementText(marker); + } else if (container.canHaveHTML) { + // Empty node selection for example
    |
    + // Setting innerHTML with a span marker then remove that marker seems to keep empty block elements open + container.innerHTML = ''; + marker = container.firstChild; + tmpRng.moveToElementText(marker); + tmpRng.collapse(FALSE); // Collapse false works better than true for some odd reason + } + + ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng); + dom.remove(marker); + } + } + + // Setup some shorter versions + startContainer = rng.startContainer; + startOffset = rng.startOffset; + endContainer = rng.endContainer; + endOffset = rng.endOffset; + ieRng = body.createTextRange(); + + // If single element selection then try making a control selection out of it + if (startContainer == endContainer && startContainer.nodeType == 1) { + // Trick to place the caret inside an empty block element like

    + if (startOffset == endOffset && !startContainer.hasChildNodes()) { + if (startContainer.canHaveHTML) { + // Check if previous sibling is an empty block if it is then we need to render it + // IE would otherwise move the caret into the sibling instead of the empty startContainer see: #5236 + // Example this:

    |

    would become this:

    |

    + sibling = startContainer.previousSibling; + if (sibling && !sibling.hasChildNodes() && dom.isBlock(sibling)) { + sibling.innerHTML = ''; + } else { + sibling = null; + } + + startContainer.innerHTML = ''; + ieRng.moveToElementText(startContainer.lastChild); + ieRng.select(); + dom.doc.selection.clear(); + startContainer.innerHTML = ''; + + if (sibling) { + sibling.innerHTML = ''; + } + return; + } else { + startOffset = dom.nodeIndex(startContainer); + startContainer = startContainer.parentNode; + } + } + + if (startOffset == endOffset - 1) { + try { + ctrlElm = startContainer.childNodes[startOffset]; + ctrlRng = body.createControlRange(); + ctrlRng.addElement(ctrlElm); + ctrlRng.select(); + + // Check if the range produced is on the correct element and is a control range + // On IE 8 it will select the parent contentEditable container if you select an inner element see: #5398 + nativeRng = selection.getRng(); + if (nativeRng.item && ctrlElm === nativeRng.item(0)) { + return; + } + } catch (ex) { + // Ignore + } + } + } + + // Set start/end point of selection + setEndPoint(true); + setEndPoint(); + + // Select the new range and scroll it into view + ieRng.select(); + }; + + // Expose range method + this.getRangeAt = getRange; + } + + return Selection; +}); + +// Included from: js/tinymce/classes/util/VK.js + +/** + * VK.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This file exposes a set of the common KeyCodes for use. Please grow it as needed. + */ +define("tinymce/util/VK", [ + "tinymce/Env" +], function(Env) { + return { + BACKSPACE: 8, + DELETE: 46, + DOWN: 40, + ENTER: 13, + LEFT: 37, + RIGHT: 39, + SPACEBAR: 32, + TAB: 9, + UP: 38, + + modifierPressed: function(e) { + return e.shiftKey || e.ctrlKey || e.altKey || this.metaKeyPressed(e); + }, + + metaKeyPressed: function(e) { + // Check if ctrl or meta key is pressed. Edge case for AltGr on Windows where it produces ctrlKey+altKey states + return (Env.mac ? e.metaKey : e.ctrlKey && !e.altKey); + } + }; +}); + +// Included from: js/tinymce/classes/dom/ControlSelection.js + +/** + * ControlSelection.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles control selection of elements. Controls are elements + * that can be resized and needs to be selected as a whole. It adds custom resize handles + * to all browser engines that support properly disabling the built in resize logic. + * + * @class tinymce.dom.ControlSelection + */ +define("tinymce/dom/ControlSelection", [ + "tinymce/util/VK", + "tinymce/util/Tools", + "tinymce/Env" +], function(VK, Tools, Env) { + return function(selection, editor) { + var dom = editor.dom, each = Tools.each; + var selectedElm, selectedElmGhost, resizeHelper, resizeHandles, selectedHandle, lastMouseDownEvent; + var startX, startY, selectedElmX, selectedElmY, startW, startH, ratio, resizeStarted; + var width, height, editableDoc = editor.getDoc(), rootDocument = document, isIE = Env.ie && Env.ie < 11; + var abs = Math.abs, round = Math.round, rootElement = editor.getBody(), startScrollWidth, startScrollHeight; + + // Details about each resize handle how to scale etc + resizeHandles = { + // Name: x multiplier, y multiplier, delta size x, delta size y + n: [0.5, 0, 0, -1], + e: [1, 0.5, 1, 0], + s: [0.5, 1, 0, 1], + w: [0, 0.5, -1, 0], + nw: [0, 0, -1, -1], + ne: [1, 0, 1, -1], + se: [1, 1, 1, 1], + sw: [0, 1, -1, 1] + }; + + // Add CSS for resize handles, cloned element and selected + var rootClass = '.mce-content-body'; + editor.contentStyles.push( + rootClass + ' div.mce-resizehandle {' + + 'position: absolute;' + + 'border: 1px solid black;' + + 'background: #FFF;' + + 'width: 5px;' + + 'height: 5px;' + + 'z-index: 10000' + + '}' + + rootClass + ' .mce-resizehandle:hover {' + + 'background: #000' + + '}' + + rootClass + ' img[data-mce-selected], hr[data-mce-selected] {' + + 'outline: 1px solid black;' + + 'resize: none' + // Have been talks about implementing this in browsers + '}' + + rootClass + ' .mce-clonedresizable {' + + 'position: absolute;' + + (Env.gecko ? '' : 'outline: 1px dashed black;') + // Gecko produces trails while resizing + 'opacity: .5;' + + 'filter: alpha(opacity=50);' + + 'z-index: 10000' + + '}' + + rootClass + ' .mce-resize-helper {' + + 'background: #555;' + + 'background: rgba(0,0,0,0.75);' + + 'border-radius: 3px;' + + 'border: 1px;' + + 'color: white;' + + 'display: none;' + + 'font-family: sans-serif;' + + 'font-size: 12px;' + + 'white-space: nowrap;' + + 'line-height: 14px;' + + 'margin: 5px 10px;' + + 'padding: 5px;' + + 'position: absolute;' + + 'z-index: 10001' + + '}' + ); + + function isResizable(elm) { + var selector = editor.settings.object_resizing; + + if (selector === false || Env.iOS) { + return false; + } + + if (typeof selector != 'string') { + selector = 'table,img,div'; + } + + if (elm.getAttribute('data-mce-resize') === 'false') { + return false; + } + + return editor.dom.is(elm, selector); + } + + function resizeGhostElement(e) { + var deltaX, deltaY, proportional; + var resizeHelperX, resizeHelperY; + + // Calc new width/height + deltaX = e.screenX - startX; + deltaY = e.screenY - startY; + + // Calc new size + width = deltaX * selectedHandle[2] + startW; + height = deltaY * selectedHandle[3] + startH; + + // Never scale down lower than 5 pixels + width = width < 5 ? 5 : width; + height = height < 5 ? 5 : height; + + if (selectedElm.nodeName == "IMG" && editor.settings.resize_img_proportional !== false) { + proportional = !VK.modifierPressed(e); + } else { + proportional = VK.modifierPressed(e) || (selectedElm.nodeName == "IMG" && selectedHandle[2] * selectedHandle[3] !== 0); + } + + // Constrain proportions + if (proportional) { + if (abs(deltaX) > abs(deltaY)) { + height = round(width * ratio); + width = round(height / ratio); + } else { + width = round(height / ratio); + height = round(width * ratio); + } + } + + // Update ghost size + dom.setStyles(selectedElmGhost, { + width: width, + height: height + }); + + // Update resize helper position + resizeHelperX = selectedHandle.startPos.x + deltaX; + resizeHelperY = selectedHandle.startPos.y + deltaY; + resizeHelperX = resizeHelperX > 0 ? resizeHelperX : 0; + resizeHelperY = resizeHelperY > 0 ? resizeHelperY : 0; + + dom.setStyles(resizeHelper, { + left: resizeHelperX, + top: resizeHelperY, + display: 'block' + }); + + resizeHelper.innerHTML = width + ' × ' + height; + + // Update ghost X position if needed + if (selectedHandle[2] < 0 && selectedElmGhost.clientWidth <= width) { + dom.setStyle(selectedElmGhost, 'left', selectedElmX + (startW - width)); + } + + // Update ghost Y position if needed + if (selectedHandle[3] < 0 && selectedElmGhost.clientHeight <= height) { + dom.setStyle(selectedElmGhost, 'top', selectedElmY + (startH - height)); + } + + // Calculate how must overflow we got + deltaX = rootElement.scrollWidth - startScrollWidth; + deltaY = rootElement.scrollHeight - startScrollHeight; + + // Re-position the resize helper based on the overflow + if (deltaX + deltaY !== 0) { + dom.setStyles(resizeHelper, { + left: resizeHelperX - deltaX, + top: resizeHelperY - deltaY + }); + } + + if (!resizeStarted) { + editor.fire('ObjectResizeStart', {target: selectedElm, width: startW, height: startH}); + resizeStarted = true; + } + } + + function endGhostResize() { + resizeStarted = false; + + function setSizeProp(name, value) { + if (value) { + // Resize by using style or attribute + if (selectedElm.style[name] || !editor.schema.isValid(selectedElm.nodeName.toLowerCase(), name)) { + dom.setStyle(selectedElm, name, value); + } else { + dom.setAttrib(selectedElm, name, value); + } + } + } + + // Set width/height properties + setSizeProp('width', width); + setSizeProp('height', height); + + dom.unbind(editableDoc, 'mousemove', resizeGhostElement); + dom.unbind(editableDoc, 'mouseup', endGhostResize); + + if (rootDocument != editableDoc) { + dom.unbind(rootDocument, 'mousemove', resizeGhostElement); + dom.unbind(rootDocument, 'mouseup', endGhostResize); + } + + // Remove ghost/helper and update resize handle positions + dom.remove(selectedElmGhost); + dom.remove(resizeHelper); + + if (!isIE || selectedElm.nodeName == "TABLE") { + showResizeRect(selectedElm); + } + + editor.fire('ObjectResized', {target: selectedElm, width: width, height: height}); + dom.setAttrib(selectedElm, 'style', dom.getAttrib(selectedElm, 'style')); + editor.nodeChanged(); + } + + function showResizeRect(targetElm, mouseDownHandleName, mouseDownEvent) { + var position, targetWidth, targetHeight, e, rect; + + unbindResizeHandleEvents(); + + // Get position and size of target + position = dom.getPos(targetElm, rootElement); + selectedElmX = position.x; + selectedElmY = position.y; + rect = targetElm.getBoundingClientRect(); // Fix for Gecko offsetHeight for table with caption + targetWidth = rect.width || (rect.right - rect.left); + targetHeight = rect.height || (rect.bottom - rect.top); + + // Reset width/height if user selects a new image/table + if (selectedElm != targetElm) { + detachResizeStartListener(); + selectedElm = targetElm; + width = height = 0; + } + + // Makes it possible to disable resizing + e = editor.fire('ObjectSelected', {target: targetElm}); + + if (isResizable(targetElm) && !e.isDefaultPrevented()) { + each(resizeHandles, function(handle, name) { + var handleElm, handlerContainerElm; + + function startDrag(e) { + startX = e.screenX; + startY = e.screenY; + startW = selectedElm.clientWidth; + startH = selectedElm.clientHeight; + ratio = startH / startW; + selectedHandle = handle; + + handle.startPos = { + x: targetWidth * handle[0] + selectedElmX, + y: targetHeight * handle[1] + selectedElmY + }; + + startScrollWidth = rootElement.scrollWidth; + startScrollHeight = rootElement.scrollHeight; + + selectedElmGhost = selectedElm.cloneNode(true); + dom.addClass(selectedElmGhost, 'mce-clonedresizable'); + dom.setAttrib(selectedElmGhost, 'data-mce-bogus', 'all'); + selectedElmGhost.contentEditable = false; // Hides IE move layer cursor + selectedElmGhost.unSelectabe = true; + dom.setStyles(selectedElmGhost, { + left: selectedElmX, + top: selectedElmY, + margin: 0 + }); + + selectedElmGhost.removeAttribute('data-mce-selected'); + rootElement.appendChild(selectedElmGhost); + + dom.bind(editableDoc, 'mousemove', resizeGhostElement); + dom.bind(editableDoc, 'mouseup', endGhostResize); + + if (rootDocument != editableDoc) { + dom.bind(rootDocument, 'mousemove', resizeGhostElement); + dom.bind(rootDocument, 'mouseup', endGhostResize); + } + + resizeHelper = dom.add(rootElement, 'div', { + 'class': 'mce-resize-helper', + 'data-mce-bogus': 'all' + }, startW + ' × ' + startH); + } + + if (mouseDownHandleName) { + // Drag started by IE native resizestart + if (name == mouseDownHandleName) { + startDrag(mouseDownEvent); + } + + return; + } + + // Get existing or render resize handle + handleElm = dom.get('mceResizeHandle' + name); + if (!handleElm) { + handlerContainerElm = rootElement; + + handleElm = dom.add(handlerContainerElm, 'div', { + id: 'mceResizeHandle' + name, + 'data-mce-bogus': 'all', + 'class': 'mce-resizehandle', + unselectable: true, + style: 'cursor:' + name + '-resize; margin:0; padding:0' + }); + + // Hides IE move layer cursor + // If we set it on Chrome we get this wounderful bug: #6725 + if (Env.ie) { + handleElm.contentEditable = false; + } + } else { + dom.show(handleElm); + } + + if (!handle.elm) { + dom.bind(handleElm, 'mousedown', function(e) { + e.stopImmediatePropagation(); + e.preventDefault(); + startDrag(e); + }); + + handle.elm = handleElm; + } + + // Position element + dom.setStyles(handleElm, { + left: (targetWidth * handle[0] + selectedElmX) - (handleElm.offsetWidth / 2), + top: (targetHeight * handle[1] + selectedElmY) - (handleElm.offsetHeight / 2) + }); + }); + } else { + hideResizeRect(); + } + + selectedElm.setAttribute('data-mce-selected', '1'); + } + + function hideResizeRect() { + var name, handleElm; + + unbindResizeHandleEvents(); + + if (selectedElm) { + selectedElm.removeAttribute('data-mce-selected'); + } + + for (name in resizeHandles) { + handleElm = dom.get('mceResizeHandle' + name); + if (handleElm) { + dom.unbind(handleElm); + dom.remove(handleElm); + } + } + } + + function updateResizeRect(e) { + var startElm, controlElm; + + function isChildOrEqual(node, parent) { + if (node) { + do { + if (node === parent) { + return true; + } + } while ((node = node.parentNode)); + } + } + + // Ignore all events while resizing + if (resizeStarted) { + return; + } + + // Remove data-mce-selected from all elements since they might have been copied using Ctrl+c/v + each(dom.select('img[data-mce-selected],hr[data-mce-selected]'), function(img) { + img.removeAttribute('data-mce-selected'); + }); + + controlElm = e.type == 'mousedown' ? e.target : selection.getNode(); + controlElm = dom.$(controlElm).closest(isIE ? 'table' : 'table,img,hr')[0]; + + if (isChildOrEqual(controlElm, rootElement)) { + disableGeckoResize(); + startElm = selection.getStart(true); + + if (isChildOrEqual(startElm, controlElm) && isChildOrEqual(selection.getEnd(true), controlElm)) { + if (!isIE || (controlElm != startElm && startElm.nodeName !== 'IMG')) { + showResizeRect(controlElm); + return; + } + } + } + + hideResizeRect(); + } + + function attachEvent(elm, name, func) { + if (elm && elm.attachEvent) { + elm.attachEvent('on' + name, func); + } + } + + function detachEvent(elm, name, func) { + if (elm && elm.detachEvent) { + elm.detachEvent('on' + name, func); + } + } + + function resizeNativeStart(e) { + var target = e.srcElement, pos, name, corner, cornerX, cornerY, relativeX, relativeY; + + pos = target.getBoundingClientRect(); + relativeX = lastMouseDownEvent.clientX - pos.left; + relativeY = lastMouseDownEvent.clientY - pos.top; + + // Figure out what corner we are draging on + for (name in resizeHandles) { + corner = resizeHandles[name]; + + cornerX = target.offsetWidth * corner[0]; + cornerY = target.offsetHeight * corner[1]; + + if (abs(cornerX - relativeX) < 8 && abs(cornerY - relativeY) < 8) { + selectedHandle = corner; + break; + } + } + + // Remove native selection and let the magic begin + resizeStarted = true; + editor.fire('ObjectResizeStart', { + target: selectedElm, + width: selectedElm.clientWidth, + height: selectedElm.clientHeight + }); + editor.getDoc().selection.empty(); + showResizeRect(target, name, lastMouseDownEvent); + } + + function nativeControlSelect(e) { + var target = e.srcElement; + + if (target != selectedElm) { + editor.fire('ObjectSelected', {target: target}); + detachResizeStartListener(); + + if (target.id.indexOf('mceResizeHandle') === 0) { + e.returnValue = false; + return; + } + + if (target.nodeName == 'IMG' || target.nodeName == 'TABLE') { + hideResizeRect(); + selectedElm = target; + attachEvent(target, 'resizestart', resizeNativeStart); + } + } + } + + function detachResizeStartListener() { + detachEvent(selectedElm, 'resizestart', resizeNativeStart); + } + + function unbindResizeHandleEvents() { + for (var name in resizeHandles) { + var handle = resizeHandles[name]; + + if (handle.elm) { + dom.unbind(handle.elm); + delete handle.elm; + } + } + } + + function disableGeckoResize() { + try { + // Disable object resizing on Gecko + editor.getDoc().execCommand('enableObjectResizing', false, false); + } catch (ex) { + // Ignore + } + } + + function controlSelect(elm) { + var ctrlRng; + + if (!isIE) { + return; + } + + ctrlRng = editableDoc.body.createControlRange(); + + try { + ctrlRng.addElement(elm); + ctrlRng.select(); + return true; + } catch (ex) { + // Ignore since the element can't be control selected for example a P tag + } + } + + editor.on('init', function() { + if (isIE) { + // Hide the resize rect on resize and reselect the image + editor.on('ObjectResized', function(e) { + if (e.target.nodeName != 'TABLE') { + hideResizeRect(); + controlSelect(e.target); + } + }); + + attachEvent(rootElement, 'controlselect', nativeControlSelect); + + editor.on('mousedown', function(e) { + lastMouseDownEvent = e; + }); + } else { + disableGeckoResize(); + + if (Env.ie >= 11) { + // TODO: Drag/drop doesn't work + editor.on('mouseup', function(e) { + var nodeName = e.target.nodeName; + + if (!resizeStarted && /^(TABLE|IMG|HR)$/.test(nodeName)) { + editor.selection.select(e.target, nodeName == 'TABLE'); + editor.nodeChanged(); + } + }); + + editor.dom.bind(rootElement, 'mscontrolselect', function(e) { + if (/^(TABLE|IMG|HR)$/.test(e.target.nodeName)) { + e.preventDefault(); + + // This moves the selection from being a control selection to a text like selection like in WebKit #6753 + // TODO: Fix this the day IE works like other browsers without this nasty native ugly control selections. + if (e.target.tagName == 'IMG') { + window.setTimeout(function() { + editor.selection.select(e.target); + }, 0); + } + } + }); + } + } + + editor.on('nodechange ResizeEditor', updateResizeRect); + + // Update resize rect while typing in a table + editor.on('keydown keyup', function(e) { + if (selectedElm && selectedElm.nodeName == "TABLE") { + updateResizeRect(e); + } + }); + + editor.on('hide', hideResizeRect); + + // Hide rect on focusout since it would float on top of windows otherwise + //editor.on('focusout', hideResizeRect); + }); + + editor.on('remove', unbindResizeHandleEvents); + + function destroy() { + selectedElm = selectedElmGhost = null; + + if (isIE) { + detachResizeStartListener(); + detachEvent(rootElement, 'controlselect', nativeControlSelect); + } + } + + return { + isResizable: isResizable, + showResizeRect: showResizeRect, + hideResizeRect: hideResizeRect, + updateResizeRect: updateResizeRect, + controlSelect: controlSelect, + destroy: destroy + }; + }; +}); + +// Included from: js/tinymce/classes/dom/BookmarkManager.js + +/** + * BookmarkManager.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles selection bookmarks. + * + * @class tinymce.dom.BookmarkManager + */ +define("tinymce/dom/BookmarkManager", [ + "tinymce/Env", + "tinymce/util/Tools" +], function(Env, Tools) { + /** + * Constructs a new BookmarkManager instance for a specific selection instance. + * + * @constructor + * @method BookmarkManager + * @param {tinymce.dom.Selection} selection Selection instance to handle bookmarks for. + */ + function BookmarkManager(selection) { + var dom = selection.dom; + + /** + * Returns a bookmark location for the current selection. This bookmark object + * can then be used to restore the selection after some content modification to the document. + * + * @method getBookmark + * @param {Number} type Optional state if the bookmark should be simple or not. Default is complex. + * @param {Boolean} normalized Optional state that enables you to get a position that it would be after normalization. + * @return {Object} Bookmark object, use moveToBookmark with this object to restore the selection. + * @example + * // Stores a bookmark of the current selection + * var bm = tinymce.activeEditor.selection.getBookmark(); + * + * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content'); + * + * // Restore the selection bookmark + * tinymce.activeEditor.selection.moveToBookmark(bm); + */ + this.getBookmark = function(type, normalized) { + var rng, rng2, id, collapsed, name, element, chr = '', styles; + + function findIndex(name, element) { + var index = 0; + + Tools.each(dom.select(name), function(node, i) { + if (node == element) { + index = i; + } + }); + + return index; + } + + function normalizeTableCellSelection(rng) { + function moveEndPoint(start) { + var container, offset, childNodes, prefix = start ? 'start' : 'end'; + + container = rng[prefix + 'Container']; + offset = rng[prefix + 'Offset']; + + if (container.nodeType == 1 && container.nodeName == "TR") { + childNodes = container.childNodes; + container = childNodes[Math.min(start ? offset : offset - 1, childNodes.length - 1)]; + if (container) { + offset = start ? 0 : container.childNodes.length; + rng['set' + (start ? 'Start' : 'End')](container, offset); + } + } + } + + moveEndPoint(true); + moveEndPoint(); + + return rng; + } + + function getLocation() { + var rng = selection.getRng(true), root = dom.getRoot(), bookmark = {}; + + function getPoint(rng, start) { + var container = rng[start ? 'startContainer' : 'endContainer'], + offset = rng[start ? 'startOffset' : 'endOffset'], point = [], node, childNodes, after = 0; + + if (container.nodeType == 3) { + if (normalized) { + for (node = container.previousSibling; node && node.nodeType == 3; node = node.previousSibling) { + offset += node.nodeValue.length; + } + } + + point.push(offset); + } else { + childNodes = container.childNodes; + + if (offset >= childNodes.length && childNodes.length) { + after = 1; + offset = Math.max(0, childNodes.length - 1); + } + + point.push(dom.nodeIndex(childNodes[offset], normalized) + after); + } + + for (; container && container != root; container = container.parentNode) { + point.push(dom.nodeIndex(container, normalized)); + } + + return point; + } + + bookmark.start = getPoint(rng, true); + + if (!selection.isCollapsed()) { + bookmark.end = getPoint(rng); + } + + return bookmark; + } + + if (type == 2) { + element = selection.getNode(); + name = element ? element.nodeName : null; + + if (name == 'IMG') { + return {name: name, index: findIndex(name, element)}; + } + + if (selection.tridentSel) { + return selection.tridentSel.getBookmark(type); + } + + return getLocation(); + } + + // Handle simple range + if (type) { + return {rng: selection.getRng()}; + } + + rng = selection.getRng(); + id = dom.uniqueId(); + collapsed = selection.isCollapsed(); + styles = 'overflow:hidden;line-height:0px'; + + // Explorer method + if (rng.duplicate || rng.item) { + // Text selection + if (!rng.item) { + rng2 = rng.duplicate(); + + try { + // Insert start marker + rng.collapse(); + rng.pasteHTML('' + chr + ''); + + // Insert end marker + if (!collapsed) { + rng2.collapse(false); + + // Detect the empty space after block elements in IE and move the + // end back one character

    ] becomes

    ]

    + rng.moveToElementText(rng2.parentElement()); + if (rng.compareEndPoints('StartToEnd', rng2) === 0) { + rng2.move('character', -1); + } + + rng2.pasteHTML('' + chr + ''); + } + } catch (ex) { + // IE might throw unspecified error so lets ignore it + return null; + } + } else { + // Control selection + element = rng.item(0); + name = element.nodeName; + + return {name: name, index: findIndex(name, element)}; + } + } else { + element = selection.getNode(); + name = element.nodeName; + if (name == 'IMG') { + return {name: name, index: findIndex(name, element)}; + } + + // W3C method + rng2 = normalizeTableCellSelection(rng.cloneRange()); + + // Insert end marker + if (!collapsed) { + rng2.collapse(false); + rng2.insertNode(dom.create('span', {'data-mce-type': "bookmark", id: id + '_end', style: styles}, chr)); + } + + rng = normalizeTableCellSelection(rng); + rng.collapse(true); + rng.insertNode(dom.create('span', {'data-mce-type': "bookmark", id: id + '_start', style: styles}, chr)); + } + + selection.moveToBookmark({id: id, keep: 1}); + + return {id: id}; + }; + + /** + * Restores the selection to the specified bookmark. + * + * @method moveToBookmark + * @param {Object} bookmark Bookmark to restore selection from. + * @return {Boolean} true/false if it was successful or not. + * @example + * // Stores a bookmark of the current selection + * var bm = tinymce.activeEditor.selection.getBookmark(); + * + * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content'); + * + * // Restore the selection bookmark + * tinymce.activeEditor.selection.moveToBookmark(bm); + */ + this.moveToBookmark = function(bookmark) { + var rng, root, startContainer, endContainer, startOffset, endOffset; + + function setEndPoint(start) { + var point = bookmark[start ? 'start' : 'end'], i, node, offset, children; + + if (point) { + offset = point[0]; + + // Find container node + for (node = root, i = point.length - 1; i >= 1; i--) { + children = node.childNodes; + + if (point[i] > children.length - 1) { + return; + } + + node = children[point[i]]; + } + + // Move text offset to best suitable location + if (node.nodeType === 3) { + offset = Math.min(point[0], node.nodeValue.length); + } + + // Move element offset to best suitable location + if (node.nodeType === 1) { + offset = Math.min(point[0], node.childNodes.length); + } + + // Set offset within container node + if (start) { + rng.setStart(node, offset); + } else { + rng.setEnd(node, offset); + } + } + + return true; + } + + function restoreEndPoint(suffix) { + var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev, keep = bookmark.keep; + + if (marker) { + node = marker.parentNode; + + if (suffix == 'start') { + if (!keep) { + idx = dom.nodeIndex(marker); + } else { + node = marker.firstChild; + idx = 1; + } + + startContainer = endContainer = node; + startOffset = endOffset = idx; + } else { + if (!keep) { + idx = dom.nodeIndex(marker); + } else { + node = marker.firstChild; + idx = 1; + } + + endContainer = node; + endOffset = idx; + } + + if (!keep) { + prev = marker.previousSibling; + next = marker.nextSibling; + + // Remove all marker text nodes + Tools.each(Tools.grep(marker.childNodes), function(node) { + if (node.nodeType == 3) { + node.nodeValue = node.nodeValue.replace(/\uFEFF/g, ''); + } + }); + + // Remove marker but keep children if for example contents where inserted into the marker + // Also remove duplicated instances of the marker for example by a + // split operation or by WebKit auto split on paste feature + while ((marker = dom.get(bookmark.id + '_' + suffix))) { + dom.remove(marker, 1); + } + + // If siblings are text nodes then merge them unless it's Opera since it some how removes the node + // and we are sniffing since adding a lot of detection code for a browser with 3% of the market + // isn't worth the effort. Sorry, Opera but it's just a fact + if (prev && next && prev.nodeType == next.nodeType && prev.nodeType == 3 && !Env.opera) { + idx = prev.nodeValue.length; + prev.appendData(next.nodeValue); + dom.remove(next); + + if (suffix == 'start') { + startContainer = endContainer = prev; + startOffset = endOffset = idx; + } else { + endContainer = prev; + endOffset = idx; + } + } + } + } + } + + function addBogus(node) { + // Adds a bogus BR element for empty block elements + if (dom.isBlock(node) && !node.innerHTML && !Env.ie) { + node.innerHTML = '
    '; + } + + return node; + } + + if (bookmark) { + if (bookmark.start) { + rng = dom.createRng(); + root = dom.getRoot(); + + if (selection.tridentSel) { + return selection.tridentSel.moveToBookmark(bookmark); + } + + if (setEndPoint(true) && setEndPoint()) { + selection.setRng(rng); + } + } else if (bookmark.id) { + // Restore start/end points + restoreEndPoint('start'); + restoreEndPoint('end'); + + if (startContainer) { + rng = dom.createRng(); + rng.setStart(addBogus(startContainer), startOffset); + rng.setEnd(addBogus(endContainer), endOffset); + selection.setRng(rng); + } + } else if (bookmark.name) { + selection.select(dom.select(bookmark.name)[bookmark.index]); + } else if (bookmark.rng) { + selection.setRng(bookmark.rng); + } + } + }; + } + + /** + * Returns true/false if the specified node is a bookmark node or not. + * + * @static + * @method isBookmarkNode + * @param {DOMNode} node DOM Node to check if it's a bookmark node or not. + * @return {Boolean} true/false if the node is a bookmark node or not. + */ + BookmarkManager.isBookmarkNode = function(node) { + return node && node.tagName === 'SPAN' && node.getAttribute('data-mce-type') === 'bookmark'; + }; + + return BookmarkManager; +}); + +// Included from: js/tinymce/classes/dom/Selection.js + +/** + * Selection.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles text and control selection it's an crossbrowser utility class. + * Consult the TinyMCE Wiki API for more details and examples on how to use this class. + * + * @class tinymce.dom.Selection + * @example + * // Getting the currently selected node for the active editor + * alert(tinymce.activeEditor.selection.getNode().nodeName); + */ +define("tinymce/dom/Selection", [ + "tinymce/dom/TreeWalker", + "tinymce/dom/TridentSelection", + "tinymce/dom/ControlSelection", + "tinymce/dom/RangeUtils", + "tinymce/dom/BookmarkManager", + "tinymce/Env", + "tinymce/util/Tools" +], function(TreeWalker, TridentSelection, ControlSelection, RangeUtils, BookmarkManager, Env, Tools) { + var each = Tools.each, trim = Tools.trim; + var isIE = Env.ie; + + /** + * Constructs a new selection instance. + * + * @constructor + * @method Selection + * @param {tinymce.dom.DOMUtils} dom DOMUtils object reference. + * @param {Window} win Window to bind the selection object to. + * @param {tinymce.dom.Serializer} serializer DOM serialization class to use for getContent. + */ + function Selection(dom, win, serializer, editor) { + var self = this; + + self.dom = dom; + self.win = win; + self.serializer = serializer; + self.editor = editor; + self.bookmarkManager = new BookmarkManager(self); + self.controlSelection = new ControlSelection(self, editor); + + // No W3C Range support + if (!self.win.getSelection) { + self.tridentSel = new TridentSelection(self); + } + } + + Selection.prototype = { + /** + * Move the selection cursor range to the specified node and offset. + * If there is no node specified it will move it to the first suitable location within the body. + * + * @method setCursorLocation + * @param {Node} node Optional node to put the cursor in. + * @param {Number} offset Optional offset from the start of the node to put the cursor at. + */ + setCursorLocation: function(node, offset) { + var self = this, rng = self.dom.createRng(); + + if (!node) { + self._moveEndPoint(rng, self.editor.getBody(), true); + self.setRng(rng); + } else { + rng.setStart(node, offset); + rng.setEnd(node, offset); + self.setRng(rng); + self.collapse(false); + } + }, + + /** + * Returns the selected contents using the DOM serializer passed in to this class. + * + * @method getContent + * @param {Object} s Optional settings class with for example output format text or html. + * @return {String} Selected contents in for example HTML format. + * @example + * // Alerts the currently selected contents + * alert(tinymce.activeEditor.selection.getContent()); + * + * // Alerts the currently selected contents as plain text + * alert(tinymce.activeEditor.selection.getContent({format: 'text'})); + */ + getContent: function(args) { + var self = this, rng = self.getRng(), tmpElm = self.dom.create("body"); + var se = self.getSel(), whiteSpaceBefore, whiteSpaceAfter, fragment; + + args = args || {}; + whiteSpaceBefore = whiteSpaceAfter = ''; + args.get = true; + args.format = args.format || 'html'; + args.selection = true; + self.editor.fire('BeforeGetContent', args); + + if (args.format == 'text') { + return self.isCollapsed() ? '' : (rng.text || (se.toString ? se.toString() : '')); + } + + if (rng.cloneContents) { + fragment = rng.cloneContents(); + + if (fragment) { + tmpElm.appendChild(fragment); + } + } else if (rng.item !== undefined || rng.htmlText !== undefined) { + // IE will produce invalid markup if elements are present that + // it doesn't understand like custom elements or HTML5 elements. + // Adding a BR in front of the contents and then remoiving it seems to fix it though. + tmpElm.innerHTML = '
    ' + (rng.item ? rng.item(0).outerHTML : rng.htmlText); + tmpElm.removeChild(tmpElm.firstChild); + } else { + tmpElm.innerHTML = rng.toString(); + } + + // Keep whitespace before and after + if (/^\s/.test(tmpElm.innerHTML)) { + whiteSpaceBefore = ' '; + } + + if (/\s+$/.test(tmpElm.innerHTML)) { + whiteSpaceAfter = ' '; + } + + args.getInner = true; + + args.content = self.isCollapsed() ? '' : whiteSpaceBefore + self.serializer.serialize(tmpElm, args) + whiteSpaceAfter; + self.editor.fire('GetContent', args); + + return args.content; + }, + + /** + * Sets the current selection to the specified content. If any contents is selected it will be replaced + * with the contents passed in to this function. If there is no selection the contents will be inserted + * where the caret is placed in the editor/page. + * + * @method setContent + * @param {String} content HTML contents to set could also be other formats depending on settings. + * @param {Object} args Optional settings object with for example data format. + * @example + * // Inserts some HTML contents at the current selection + * tinymce.activeEditor.selection.setContent('Some contents'); + */ + setContent: function(content, args) { + var self = this, rng = self.getRng(), caretNode, doc = self.win.document, frag, temp; + + args = args || {format: 'html'}; + args.set = true; + args.selection = true; + content = args.content = content; + + // Dispatch before set content event + if (!args.no_events) { + self.editor.fire('BeforeSetContent', args); + } + + content = args.content; + + if (rng.insertNode) { + // Make caret marker since insertNode places the caret in the beginning of text after insert + content += '_'; + + // Delete and insert new node + if (rng.startContainer == doc && rng.endContainer == doc) { + // WebKit will fail if the body is empty since the range is then invalid and it can't insert contents + doc.body.innerHTML = content; + } else { + rng.deleteContents(); + + if (doc.body.childNodes.length === 0) { + doc.body.innerHTML = content; + } else { + // createContextualFragment doesn't exists in IE 9 DOMRanges + if (rng.createContextualFragment) { + rng.insertNode(rng.createContextualFragment(content)); + } else { + // Fake createContextualFragment call in IE 9 + frag = doc.createDocumentFragment(); + temp = doc.createElement('div'); + + frag.appendChild(temp); + temp.outerHTML = content; + + rng.insertNode(frag); + } + } + } + + // Move to caret marker + caretNode = self.dom.get('__caret'); + + // Make sure we wrap it compleatly, Opera fails with a simple select call + rng = doc.createRange(); + rng.setStartBefore(caretNode); + rng.setEndBefore(caretNode); + self.setRng(rng); + + // Remove the caret position + self.dom.remove('__caret'); + + try { + self.setRng(rng); + } catch (ex) { + // Might fail on Opera for some odd reason + } + } else { + if (rng.item) { + // Delete content and get caret text selection + doc.execCommand('Delete', false, null); + rng = self.getRng(); + } + + // Explorer removes spaces from the beginning of pasted contents + if (/^\s+/.test(content)) { + rng.pasteHTML('_' + content); + self.dom.remove('__mce_tmp'); + } else { + rng.pasteHTML(content); + } + } + + // Dispatch set content event + if (!args.no_events) { + self.editor.fire('SetContent', args); + } + }, + + /** + * Returns the start element of a selection range. If the start is in a text + * node the parent element will be returned. + * + * @method getStart + * @param {Boolean} real Optional state to get the real parent when the selection is collapsed not the closest element. + * @return {Element} Start element of selection range. + */ + getStart: function(real) { + var self = this, rng = self.getRng(), startElement, parentElement, checkRng, node; + + if (rng.duplicate || rng.item) { + // Control selection, return first item + if (rng.item) { + return rng.item(0); + } + + // Get start element + checkRng = rng.duplicate(); + checkRng.collapse(1); + startElement = checkRng.parentElement(); + if (startElement.ownerDocument !== self.dom.doc) { + startElement = self.dom.getRoot(); + } + + // Check if range parent is inside the start element, then return the inner parent element + // This will fix issues when a single element is selected, IE would otherwise return the wrong start element + parentElement = node = rng.parentElement(); + while ((node = node.parentNode)) { + if (node == startElement) { + startElement = parentElement; + break; + } + } + + return startElement; + } else { + startElement = rng.startContainer; + + if (startElement.nodeType == 1 && startElement.hasChildNodes()) { + if (!real || !rng.collapsed) { + startElement = startElement.childNodes[Math.min(startElement.childNodes.length - 1, rng.startOffset)]; + } + } + + if (startElement && startElement.nodeType == 3) { + return startElement.parentNode; + } + + return startElement; + } + }, + + /** + * Returns the end element of a selection range. If the end is in a text + * node the parent element will be returned. + * + * @method getEnd + * @param {Boolean} real Optional state to get the real parent when the selection is collapsed not the closest element. + * @return {Element} End element of selection range. + */ + getEnd: function(real) { + var self = this, rng = self.getRng(), endElement, endOffset; + + if (rng.duplicate || rng.item) { + if (rng.item) { + return rng.item(0); + } + + rng = rng.duplicate(); + rng.collapse(0); + endElement = rng.parentElement(); + if (endElement.ownerDocument !== self.dom.doc) { + endElement = self.dom.getRoot(); + } + + if (endElement && endElement.nodeName == 'BODY') { + return endElement.lastChild || endElement; + } + + return endElement; + } else { + endElement = rng.endContainer; + endOffset = rng.endOffset; + + if (endElement.nodeType == 1 && endElement.hasChildNodes()) { + if (!real || !rng.collapsed) { + endElement = endElement.childNodes[endOffset > 0 ? endOffset - 1 : endOffset]; + } + } + + if (endElement && endElement.nodeType == 3) { + return endElement.parentNode; + } + + return endElement; + } + }, + + /** + * Returns a bookmark location for the current selection. This bookmark object + * can then be used to restore the selection after some content modification to the document. + * + * @method getBookmark + * @param {Number} type Optional state if the bookmark should be simple or not. Default is complex. + * @param {Boolean} normalized Optional state that enables you to get a position that it would be after normalization. + * @return {Object} Bookmark object, use moveToBookmark with this object to restore the selection. + * @example + * // Stores a bookmark of the current selection + * var bm = tinymce.activeEditor.selection.getBookmark(); + * + * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content'); + * + * // Restore the selection bookmark + * tinymce.activeEditor.selection.moveToBookmark(bm); + */ + getBookmark: function(type, normalized) { + return this.bookmarkManager.getBookmark(type, normalized); + }, + + /** + * Restores the selection to the specified bookmark. + * + * @method moveToBookmark + * @param {Object} bookmark Bookmark to restore selection from. + * @return {Boolean} true/false if it was successful or not. + * @example + * // Stores a bookmark of the current selection + * var bm = tinymce.activeEditor.selection.getBookmark(); + * + * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content'); + * + * // Restore the selection bookmark + * tinymce.activeEditor.selection.moveToBookmark(bm); + */ + moveToBookmark: function(bookmark) { + return this.bookmarkManager.moveToBookmark(bookmark); + }, + + /** + * Selects the specified element. This will place the start and end of the selection range around the element. + * + * @method select + * @param {Element} node HMTL DOM element to select. + * @param {Boolean} content Optional bool state if the contents should be selected or not on non IE browser. + * @return {Element} Selected element the same element as the one that got passed in. + * @example + * // Select the first paragraph in the active editor + * tinymce.activeEditor.selection.select(tinymce.activeEditor.dom.select('p')[0]); + */ + select: function(node, content) { + var self = this, dom = self.dom, rng = dom.createRng(), idx; + + // Clear stored range set by FocusManager + self.lastFocusBookmark = null; + + if (node) { + if (!content && self.controlSelection.controlSelect(node)) { + return; + } + + idx = dom.nodeIndex(node); + rng.setStart(node.parentNode, idx); + rng.setEnd(node.parentNode, idx + 1); + + // Find first/last text node or BR element + if (content) { + self._moveEndPoint(rng, node, true); + self._moveEndPoint(rng, node); + } + + self.setRng(rng); + } + + return node; + }, + + /** + * Returns true/false if the selection range is collapsed or not. Collapsed means if it's a caret or a larger selection. + * + * @method isCollapsed + * @return {Boolean} true/false state if the selection range is collapsed or not. + * Collapsed means if it's a caret or a larger selection. + */ + isCollapsed: function() { + var self = this, rng = self.getRng(), sel = self.getSel(); + + if (!rng || rng.item) { + return false; + } + + if (rng.compareEndPoints) { + return rng.compareEndPoints('StartToEnd', rng) === 0; + } + + return !sel || rng.collapsed; + }, + + /** + * Collapse the selection to start or end of range. + * + * @method collapse + * @param {Boolean} toStart Optional boolean state if to collapse to end or not. Defaults to start. + */ + collapse: function(toStart) { + var self = this, rng = self.getRng(), node; + + // Control range on IE + if (rng.item) { + node = rng.item(0); + rng = self.win.document.body.createTextRange(); + rng.moveToElementText(node); + } + + rng.collapse(!!toStart); + self.setRng(rng); + }, + + /** + * Returns the browsers internal selection object. + * + * @method getSel + * @return {Selection} Internal browser selection object. + */ + getSel: function() { + var win = this.win; + + return win.getSelection ? win.getSelection() : win.document.selection; + }, + + /** + * Returns the browsers internal range object. + * + * @method getRng + * @param {Boolean} w3c Forces a compatible W3C range on IE. + * @return {Range} Internal browser range object. + * @see http://www.quirksmode.org/dom/range_intro.html + * @see http://www.dotvoid.com/2001/03/using-the-range-object-in-mozilla/ + */ + getRng: function(w3c) { + var self = this, selection, rng, elm, doc = self.win.document, ieRng; + + function tryCompareBoundaryPoints(how, sourceRange, destinationRange) { + try { + return sourceRange.compareBoundaryPoints(how, destinationRange); + } catch (ex) { + // Gecko throws wrong document exception if the range points + // to nodes that where removed from the dom #6690 + // Browsers should mutate existing DOMRange instances so that they always point + // to something in the document this is not the case in Gecko works fine in IE/WebKit/Blink + // For performance reasons just return -1 + return -1; + } + } + + // Use last rng passed from FocusManager if it's available this enables + // calls to editor.selection.getStart() to work when caret focus is lost on IE + if (!w3c && self.lastFocusBookmark) { + var bookmark = self.lastFocusBookmark; + + // Convert bookmark to range IE 11 fix + if (bookmark.startContainer) { + rng = doc.createRange(); + rng.setStart(bookmark.startContainer, bookmark.startOffset); + rng.setEnd(bookmark.endContainer, bookmark.endOffset); + } else { + rng = bookmark; + } + + return rng; + } + + // Found tridentSel object then we need to use that one + if (w3c && self.tridentSel) { + return self.tridentSel.getRangeAt(0); + } + + try { + if ((selection = self.getSel())) { + if (selection.rangeCount > 0) { + rng = selection.getRangeAt(0); + } else { + rng = selection.createRange ? selection.createRange() : doc.createRange(); + } + } + } catch (ex) { + // IE throws unspecified error here if TinyMCE is placed in a frame/iframe + } + + // We have W3C ranges and it's IE then fake control selection since IE9 doesn't handle that correctly yet + // IE 11 doesn't support the selection object so we check for that as well + if (isIE && rng && rng.setStart && doc.selection) { + try { + // IE will sometimes throw an exception here + ieRng = doc.selection.createRange(); + } catch (ex) { + + } + + if (ieRng && ieRng.item) { + elm = ieRng.item(0); + rng = doc.createRange(); + rng.setStartBefore(elm); + rng.setEndAfter(elm); + } + } + + // No range found then create an empty one + // This can occur when the editor is placed in a hidden container element on Gecko + // Or on IE when there was an exception + if (!rng) { + rng = doc.createRange ? doc.createRange() : doc.body.createTextRange(); + } + + // If range is at start of document then move it to start of body + if (rng.setStart && rng.startContainer.nodeType === 9 && rng.collapsed) { + elm = self.dom.getRoot(); + rng.setStart(elm, 0); + rng.setEnd(elm, 0); + } + + if (self.selectedRange && self.explicitRange) { + if (tryCompareBoundaryPoints(rng.START_TO_START, rng, self.selectedRange) === 0 && + tryCompareBoundaryPoints(rng.END_TO_END, rng, self.selectedRange) === 0) { + // Safari, Opera and Chrome only ever select text which causes the range to change. + // This lets us use the originally set range if the selection hasn't been changed by the user. + rng = self.explicitRange; + } else { + self.selectedRange = null; + self.explicitRange = null; + } + } + + return rng; + }, + + /** + * Changes the selection to the specified DOM range. + * + * @method setRng + * @param {Range} rng Range to select. + */ + setRng: function(rng, forward) { + var self = this, sel; + + if (!rng) { + return; + } + + // Is IE specific range + if (rng.select) { + try { + rng.select(); + } catch (ex) { + // Needed for some odd IE bug #1843306 + } + + return; + } + + if (!self.tridentSel) { + sel = self.getSel(); + + if (sel) { + self.explicitRange = rng; + + try { + sel.removeAllRanges(); + sel.addRange(rng); + } catch (ex) { + // IE might throw errors here if the editor is within a hidden container and selection is changed + } + + // Forward is set to false and we have an extend function + if (forward === false && sel.extend) { + sel.collapse(rng.endContainer, rng.endOffset); + sel.extend(rng.startContainer, rng.startOffset); + } + + // adding range isn't always successful so we need to check range count otherwise an exception can occur + self.selectedRange = sel.rangeCount > 0 ? sel.getRangeAt(0) : null; + } + } else { + // Is W3C Range fake range on IE + if (rng.cloneRange) { + try { + self.tridentSel.addRange(rng); + return; + } catch (ex) { + //IE9 throws an error here if called before selection is placed in the editor + } + } + } + }, + + /** + * Sets the current selection to the specified DOM element. + * + * @method setNode + * @param {Element} elm Element to set as the contents of the selection. + * @return {Element} Returns the element that got passed in. + * @example + * // Inserts a DOM node at current selection/caret location + * tinymce.activeEditor.selection.setNode(tinymce.activeEditor.dom.create('img', {src: 'some.gif', title: 'some title'})); + */ + setNode: function(elm) { + var self = this; + + self.setContent(self.dom.getOuterHTML(elm)); + + return elm; + }, + + /** + * Returns the currently selected element or the common ancestor element for both start and end of the selection. + * + * @method getNode + * @return {Element} Currently selected element or common ancestor element. + * @example + * // Alerts the currently selected elements node name + * alert(tinymce.activeEditor.selection.getNode().nodeName); + */ + getNode: function() { + var self = this, rng = self.getRng(), elm; + var startContainer = rng.startContainer, endContainer = rng.endContainer; + var startOffset = rng.startOffset, endOffset = rng.endOffset, root = self.dom.getRoot(); + + function skipEmptyTextNodes(node, forwards) { + var orig = node; + + while (node && node.nodeType === 3 && node.length === 0) { + node = forwards ? node.nextSibling : node.previousSibling; + } + + return node || orig; + } + + // Range maybe lost after the editor is made visible again + if (!rng) { + return root; + } + + if (rng.setStart) { + elm = rng.commonAncestorContainer; + + // Handle selection a image or other control like element such as anchors + if (!rng.collapsed) { + if (startContainer == endContainer) { + if (endOffset - startOffset < 2) { + if (startContainer.hasChildNodes()) { + elm = startContainer.childNodes[startOffset]; + } + } + } + + // If the anchor node is a element instead of a text node then return this element + //if (tinymce.isWebKit && sel.anchorNode && sel.anchorNode.nodeType == 1) + // return sel.anchorNode.childNodes[sel.anchorOffset]; + + // Handle cases where the selection is immediately wrapped around a node and return that node instead of it's parent. + // This happens when you double click an underlined word in FireFox. + if (startContainer.nodeType === 3 && endContainer.nodeType === 3) { + if (startContainer.length === startOffset) { + startContainer = skipEmptyTextNodes(startContainer.nextSibling, true); + } else { + startContainer = startContainer.parentNode; + } + + if (endOffset === 0) { + endContainer = skipEmptyTextNodes(endContainer.previousSibling, false); + } else { + endContainer = endContainer.parentNode; + } + + if (startContainer && startContainer === endContainer) { + return startContainer; + } + } + } + + if (elm && elm.nodeType == 3) { + return elm.parentNode; + } + + return elm; + } + + elm = rng.item ? rng.item(0) : rng.parentElement(); + + // IE 7 might return elements outside the iframe + if (elm.ownerDocument !== self.win.document) { + elm = root; + } + + return elm; + }, + + getSelectedBlocks: function(startElm, endElm) { + var self = this, dom = self.dom, node, root, selectedBlocks = []; + + root = dom.getRoot(); + startElm = dom.getParent(startElm || self.getStart(), dom.isBlock); + endElm = dom.getParent(endElm || self.getEnd(), dom.isBlock); + + if (startElm && startElm != root) { + selectedBlocks.push(startElm); + } + + if (startElm && endElm && startElm != endElm) { + node = startElm; + + var walker = new TreeWalker(startElm, root); + while ((node = walker.next()) && node != endElm) { + if (dom.isBlock(node)) { + selectedBlocks.push(node); + } + } + } + + if (endElm && startElm != endElm && endElm != root) { + selectedBlocks.push(endElm); + } + + return selectedBlocks; + }, + + isForward: function() { + var dom = this.dom, sel = this.getSel(), anchorRange, focusRange; + + // No support for selection direction then always return true + if (!sel || !sel.anchorNode || !sel.focusNode) { + return true; + } + + anchorRange = dom.createRng(); + anchorRange.setStart(sel.anchorNode, sel.anchorOffset); + anchorRange.collapse(true); + + focusRange = dom.createRng(); + focusRange.setStart(sel.focusNode, sel.focusOffset); + focusRange.collapse(true); + + return anchorRange.compareBoundaryPoints(anchorRange.START_TO_START, focusRange) <= 0; + }, + + normalize: function() { + var self = this, rng = self.getRng(); + + if (Env.range && new RangeUtils(self.dom).normalize(rng)) { + self.setRng(rng, self.isForward()); + } + + return rng; + }, + + /** + * Executes callback when the current selection starts/stops matching the specified selector. The current + * state will be passed to the callback as it's first argument. + * + * @method selectorChanged + * @param {String} selector CSS selector to check for. + * @param {function} callback Callback with state and args when the selector is matches or not. + */ + selectorChanged: function(selector, callback) { + var self = this, currentSelectors; + + if (!self.selectorChangedData) { + self.selectorChangedData = {}; + currentSelectors = {}; + + self.editor.on('NodeChange', function(e) { + var node = e.element, dom = self.dom, parents = dom.getParents(node, null, dom.getRoot()), matchedSelectors = {}; + + // Check for new matching selectors + each(self.selectorChangedData, function(callbacks, selector) { + each(parents, function(node) { + if (dom.is(node, selector)) { + if (!currentSelectors[selector]) { + // Execute callbacks + each(callbacks, function(callback) { + callback(true, {node: node, selector: selector, parents: parents}); + }); + + currentSelectors[selector] = callbacks; + } + + matchedSelectors[selector] = callbacks; + return false; + } + }); + }); + + // Check if current selectors still match + each(currentSelectors, function(callbacks, selector) { + if (!matchedSelectors[selector]) { + delete currentSelectors[selector]; + + each(callbacks, function(callback) { + callback(false, {node: node, selector: selector, parents: parents}); + }); + } + }); + }); + } + + // Add selector listeners + if (!self.selectorChangedData[selector]) { + self.selectorChangedData[selector] = []; + } + + self.selectorChangedData[selector].push(callback); + + return self; + }, + + getScrollContainer: function() { + var scrollContainer, node = this.dom.getRoot(); + + while (node && node.nodeName != 'BODY') { + if (node.scrollHeight > node.clientHeight) { + scrollContainer = node; + break; + } + + node = node.parentNode; + } + + return scrollContainer; + }, + + scrollIntoView: function(elm) { + var y, viewPort, self = this, dom = self.dom, root = dom.getRoot(), viewPortY, viewPortH; + + function getPos(elm) { + var x = 0, y = 0; + + var offsetParent = elm; + while (offsetParent && offsetParent.nodeType) { + x += offsetParent.offsetLeft || 0; + y += offsetParent.offsetTop || 0; + offsetParent = offsetParent.offsetParent; + } + + return {x: x, y: y}; + } + + if (root.nodeName != 'BODY') { + var scrollContainer = self.getScrollContainer(); + if (scrollContainer) { + y = getPos(elm).y - getPos(scrollContainer).y; + viewPortH = scrollContainer.clientHeight; + viewPortY = scrollContainer.scrollTop; + if (y < viewPortY || y + 25 > viewPortY + viewPortH) { + scrollContainer.scrollTop = y < viewPortY ? y : y - viewPortH + 25; + } + + return; + } + } + + viewPort = dom.getViewPort(self.editor.getWin()); + y = dom.getPos(elm).y; + viewPortY = viewPort.y; + viewPortH = viewPort.h; + if (y < viewPort.y || y + 25 > viewPortY + viewPortH) { + self.editor.getWin().scrollTo(0, y < viewPortY ? y : y - viewPortH + 25); + } + }, + + placeCaretAt: function(clientX, clientY) { + var doc = this.editor.getDoc(), rng, point; + + if (doc.caretPositionFromPoint) { + point = doc.caretPositionFromPoint(clientX, clientY); + rng = doc.createRange(); + rng.setStart(point.offsetNode, point.offset); + rng.collapse(true); + } else if (doc.caretRangeFromPoint) { + rng = doc.caretRangeFromPoint(clientX, clientY); + } else if (doc.body.createTextRange) { + rng = doc.body.createTextRange(); + + try { + rng.moveToPoint(clientX, clientY); + rng.collapse(true); + } catch (ex) { + rng.collapse(clientY < doc.body.clientHeight); + } + } + + this.setRng(rng); + }, + + _moveEndPoint: function(rng, node, start) { + var root = node, walker = new TreeWalker(node, root); + var nonEmptyElementsMap = this.dom.schema.getNonEmptyElements(); + + do { + // Text node + if (node.nodeType == 3 && trim(node.nodeValue).length !== 0) { + if (start) { + rng.setStart(node, 0); + } else { + rng.setEnd(node, node.nodeValue.length); + } + + return; + } + + // BR/IMG/INPUT elements but not table cells + if (nonEmptyElementsMap[node.nodeName] && !/^(TD|TH)$/.test(node.nodeName)) { + if (start) { + rng.setStartBefore(node); + } else { + if (node.nodeName == 'BR') { + rng.setEndBefore(node); + } else { + rng.setEndAfter(node); + } + } + + return; + } + + // Found empty text block old IE can place the selection inside those + if (Env.ie && Env.ie < 11 && this.dom.isBlock(node) && this.dom.isEmpty(node)) { + if (start) { + rng.setStart(node, 0); + } else { + rng.setEnd(node, 0); + } + + return; + } + } while ((node = (start ? walker.next() : walker.prev()))); + + // Failed to find any text node or other suitable location then move to the root of body + if (root.nodeName == 'BODY') { + if (start) { + rng.setStart(root, 0); + } else { + rng.setEnd(root, root.childNodes.length); + } + } + }, + + destroy: function() { + this.win = null; + this.controlSelection.destroy(); + } + }; + + return Selection; +}); + +// Included from: js/tinymce/classes/dom/ElementUtils.js + +/** + * ElementUtils.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Utility class for various element specific functions. + * + * @private + */ +define("tinymce/dom/ElementUtils", [ + "tinymce/dom/BookmarkManager", + "tinymce/util/Tools" +], function(BookmarkManager, Tools) { + var each = Tools.each; + + function ElementUtils(dom) { + /** + * Compares two nodes and checks if it's attributes and styles matches. + * This doesn't compare classes as items since their order is significant. + * + * @method compare + * @param {Node} node1 First node to compare with. + * @param {Node} node2 Second node to compare with. + * @return {boolean} True/false if the nodes are the same or not. + */ + this.compare = function(node1, node2) { + // Not the same name + if (node1.nodeName != node2.nodeName) { + return false; + } + + /** + * Returns all the nodes attributes excluding internal ones, styles and classes. + * + * @private + * @param {Node} node Node to get attributes from. + * @return {Object} Name/value object with attributes and attribute values. + */ + function getAttribs(node) { + var attribs = {}; + + each(dom.getAttribs(node), function(attr) { + var name = attr.nodeName.toLowerCase(); + + // Don't compare internal attributes or style + if (name.indexOf('_') !== 0 && name !== 'style' && name !== 'data-mce-style') { + attribs[name] = dom.getAttrib(node, name); + } + }); + + return attribs; + } + + /** + * Compares two objects checks if it's key + value exists in the other one. + * + * @private + * @param {Object} obj1 First object to compare. + * @param {Object} obj2 Second object to compare. + * @return {boolean} True/false if the objects matches or not. + */ + function compareObjects(obj1, obj2) { + var value, name; + + for (name in obj1) { + // Obj1 has item obj2 doesn't have + if (obj1.hasOwnProperty(name)) { + value = obj2[name]; + + // Obj2 doesn't have obj1 item + if (typeof value == "undefined") { + return false; + } + + // Obj2 item has a different value + if (obj1[name] != value) { + return false; + } + + // Delete similar value + delete obj2[name]; + } + } + + // Check if obj 2 has something obj 1 doesn't have + for (name in obj2) { + // Obj2 has item obj1 doesn't have + if (obj2.hasOwnProperty(name)) { + return false; + } + } + + return true; + } + + // Attribs are not the same + if (!compareObjects(getAttribs(node1), getAttribs(node2))) { + return false; + } + + // Styles are not the same + if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style')))) { + return false; + } + + return !BookmarkManager.isBookmarkNode(node1) && !BookmarkManager.isBookmarkNode(node2); + }; + } + + return ElementUtils; +}); + +// Included from: js/tinymce/classes/fmt/Preview.js + +/** + * Preview.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Internal class for generating previews styles for formats. + * + * Example: + * Preview.getCssText(editor, 'bold'); + * + * @class tinymce.fmt.Preview + * @private + */ +define("tinymce/fmt/Preview", [ + "tinymce/util/Tools" +], function(Tools) { + var each = Tools.each; + + function getCssText(editor, format) { + var name, previewElm, dom = editor.dom; + var previewCss = '', parentFontSize, previewStyles; + + previewStyles = editor.settings.preview_styles; + + // No preview forced + if (previewStyles === false) { + return ''; + } + + // Default preview + if (!previewStyles) { + previewStyles = 'font-family font-size font-weight font-style text-decoration ' + + 'text-transform color background-color border border-radius outline text-shadow'; + } + + // Removes any variables since these can't be previewed + function removeVars(val) { + return val.replace(/%(\w+)/g, ''); + } + + // Create block/inline element to use for preview + if (typeof format == "string") { + format = editor.formatter.get(format); + if (!format) { + return; + } + + format = format[0]; + } + + name = format.block || format.inline || 'span'; + previewElm = dom.create(name); + + // Add format styles to preview element + each(format.styles, function(value, name) { + value = removeVars(value); + + if (value) { + dom.setStyle(previewElm, name, value); + } + }); + + // Add attributes to preview element + each(format.attributes, function(value, name) { + value = removeVars(value); + + if (value) { + dom.setAttrib(previewElm, name, value); + } + }); + + // Add classes to preview element + each(format.classes, function(value) { + value = removeVars(value); + + if (!dom.hasClass(previewElm, value)) { + dom.addClass(previewElm, value); + } + }); + + editor.fire('PreviewFormats'); + + // Add the previewElm outside the visual area + dom.setStyles(previewElm, {position: 'absolute', left: -0xFFFF}); + editor.getBody().appendChild(previewElm); + + // Get parent container font size so we can compute px values out of em/% for older IE:s + parentFontSize = dom.getStyle(editor.getBody(), 'fontSize', true); + parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0; + + each(previewStyles.split(' '), function(name) { + var value = dom.getStyle(previewElm, name, true); + + // If background is transparent then check if the body has a background color we can use + if (name == 'background-color' && /transparent|rgba\s*\([^)]+,\s*0\)/.test(value)) { + value = dom.getStyle(editor.getBody(), name, true); + + // Ignore white since it's the default color, not the nicest fix + // TODO: Fix this by detecting runtime style + if (dom.toHex(value).toLowerCase() == '#ffffff') { + return; + } + } + + if (name == 'color') { + // Ignore black since it's the default color, not the nicest fix + // TODO: Fix this by detecting runtime style + if (dom.toHex(value).toLowerCase() == '#000000') { + return; + } + } + + // Old IE won't calculate the font size so we need to do that manually + if (name == 'font-size') { + if (/em|%$/.test(value)) { + if (parentFontSize === 0) { + return; + } + + // Convert font size from em/% to px + value = parseFloat(value, 10) / (/%$/.test(value) ? 100 : 1); + value = (value * parentFontSize) + 'px'; + } + } + + if (name == "border" && value) { + previewCss += 'padding:0 2px;'; + } + + previewCss += name + ':' + value + ';'; + }); + + editor.fire('AfterPreviewFormats'); + + //previewCss += 'line-height:normal'; + + dom.remove(previewElm); + + return previewCss; + } + + return { + getCssText: getCssText + }; +}); + +// Included from: js/tinymce/classes/Formatter.js + +/** + * Formatter.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Text formatter engine class. This class is used to apply formats like bold, italic, font size + * etc to the current selection or specific nodes. This engine was build to replace the browsers + * default formatting logic for execCommand due to it's inconsistent and buggy behavior. + * + * @class tinymce.Formatter + * @example + * tinymce.activeEditor.formatter.register('mycustomformat', { + * inline: 'span', + * styles: {color: '#ff0000'} + * }); + * + * tinymce.activeEditor.formatter.apply('mycustomformat'); + */ +define("tinymce/Formatter", [ + "tinymce/dom/TreeWalker", + "tinymce/dom/RangeUtils", + "tinymce/dom/BookmarkManager", + "tinymce/dom/ElementUtils", + "tinymce/util/Tools", + "tinymce/fmt/Preview" +], function(TreeWalker, RangeUtils, BookmarkManager, ElementUtils, Tools, Preview) { + /** + * Constructs a new formatter instance. + * + * @constructor Formatter + * @param {tinymce.Editor} ed Editor instance to construct the formatter engine to. + */ + return function(ed) { + var formats = {}, + dom = ed.dom, + selection = ed.selection, + rangeUtils = new RangeUtils(dom), + isValid = ed.schema.isValidChild, + isBlock = dom.isBlock, + forcedRootBlock = ed.settings.forced_root_block, + nodeIndex = dom.nodeIndex, + INVISIBLE_CHAR = '\uFEFF', + MCE_ATTR_RE = /^(src|href|style)$/, + FALSE = false, + TRUE = true, + formatChangeData, + undef, + getContentEditable = dom.getContentEditable, + disableCaretContainer, + markCaretContainersBogus, + isBookmarkNode = BookmarkManager.isBookmarkNode; + + var each = Tools.each, + grep = Tools.grep, + walk = Tools.walk, + extend = Tools.extend; + + function isTextBlock(name) { + if (name.nodeType) { + name = name.nodeName; + } + + return !!ed.schema.getTextBlockElements()[name.toLowerCase()]; + } + + function isTableCell(node) { + return /^(TH|TD)$/.test(node.nodeName); + } + + function getParents(node, selector) { + return dom.getParents(node, selector, dom.getRoot()); + } + + function isCaretNode(node) { + return node.nodeType === 1 && node.id === '_mce_caret'; + } + + function defaultFormats() { + register({ + valigntop: [ + {selector: 'td,th', styles: {'verticalAlign': 'top'}} + ], + + valignmiddle: [ + {selector: 'td,th', styles: {'verticalAlign': 'middle'}} + ], + + valignbottom: [ + {selector: 'td,th', styles: {'verticalAlign': 'bottom'}} + ], + + alignleft: [ + {selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'left'}, defaultBlock: 'div'}, + {selector: 'img,table', collapsed: false, styles: {'float': 'left'}} + ], + + aligncenter: [ + {selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'center'}, defaultBlock: 'div'}, + {selector: 'img', collapsed: false, styles: {display: 'block', marginLeft: 'auto', marginRight: 'auto'}}, + {selector: 'table', collapsed: false, styles: {marginLeft: 'auto', marginRight: 'auto'}} + ], + + alignright: [ + {selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'right'}, defaultBlock: 'div'}, + {selector: 'img,table', collapsed: false, styles: {'float': 'right'}} + ], + + alignjustify: [ + {selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'justify'}, defaultBlock: 'div'} + ], + + bold: [ + {inline: 'strong', remove: 'all'}, + {inline: 'span', styles: {fontWeight: 'bold'}}, + {inline: 'b', remove: 'all'} + ], + + italic: [ + {inline: 'em', remove: 'all'}, + {inline: 'span', styles: {fontStyle: 'italic'}}, + {inline: 'i', remove: 'all'} + ], + + underline: [ + {inline: 'span', styles: {textDecoration: 'underline'}, exact: true}, + {inline: 'u', remove: 'all'} + ], + + strikethrough: [ + {inline: 'span', styles: {textDecoration: 'line-through'}, exact: true}, + {inline: 'strike', remove: 'all'} + ], + + forecolor: {inline: 'span', styles: {color: '%value'}, links: true, remove_similar: true}, + hilitecolor: {inline: 'span', styles: {backgroundColor: '%value'}, links: true, remove_similar: true}, + fontname: {inline: 'span', styles: {fontFamily: '%value'}}, + fontsize: {inline: 'span', styles: {fontSize: '%value'}}, + fontsize_class: {inline: 'span', attributes: {'class': '%value'}}, + blockquote: {block: 'blockquote', wrapper: 1, remove: 'all'}, + subscript: {inline: 'sub'}, + superscript: {inline: 'sup'}, + code: {inline: 'code'}, + + link: {inline: 'a', selector: 'a', remove: 'all', split: true, deep: true, + onmatch: function() { + return true; + }, + + onformat: function(elm, fmt, vars) { + each(vars, function(value, key) { + dom.setAttrib(elm, key, value); + }); + } + }, + + removeformat: [ + { + selector: 'b,strong,em,i,font,u,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins', + remove: 'all', + split: true, + expand: false, + block_expand: true, + deep: true + }, + {selector: 'span', attributes: ['style', 'class'], remove: 'empty', split: true, expand: false, deep: true}, + {selector: '*', attributes: ['style', 'class'], split: false, expand: false, deep: true} + ] + }); + + // Register default block formats + each('p h1 h2 h3 h4 h5 h6 div address pre div dt dd samp'.split(/\s/), function(name) { + register(name, {block: name, remove: 'all'}); + }); + + // Register user defined formats + register(ed.settings.formats); + } + + function addKeyboardShortcuts() { + // Add some inline shortcuts + ed.addShortcut('meta+b', 'bold_desc', 'Bold'); + ed.addShortcut('meta+i', 'italic_desc', 'Italic'); + ed.addShortcut('meta+u', 'underline_desc', 'Underline'); + + // BlockFormat shortcuts keys + for (var i = 1; i <= 6; i++) { + ed.addShortcut('access+' + i, '', ['FormatBlock', false, 'h' + i]); + } + + ed.addShortcut('access+7', '', ['FormatBlock', false, 'p']); + ed.addShortcut('access+8', '', ['FormatBlock', false, 'div']); + ed.addShortcut('access+9', '', ['FormatBlock', false, 'address']); + } + + // Public functions + + /** + * Returns the format by name or all formats if no name is specified. + * + * @method get + * @param {String} name Optional name to retrive by. + * @return {Array/Object} Array/Object with all registred formats or a specific format. + */ + function get(name) { + return name ? formats[name] : formats; + } + + /** + * Registers a specific format by name. + * + * @method register + * @param {Object/String} name Name of the format for example "bold". + * @param {Object/Array} format Optional format object or array of format variants + * can only be omitted if the first arg is an object. + */ + function register(name, format) { + if (name) { + if (typeof name !== 'string') { + each(name, function(format, name) { + register(name, format); + }); + } else { + // Force format into array and add it to internal collection + format = format.length ? format : [format]; + + each(format, function(format) { + // Set deep to false by default on selector formats this to avoid removing + // alignment on images inside paragraphs when alignment is changed on paragraphs + if (format.deep === undef) { + format.deep = !format.selector; + } + + // Default to true + if (format.split === undef) { + format.split = !format.selector || format.inline; + } + + // Default to true + if (format.remove === undef && format.selector && !format.inline) { + format.remove = 'none'; + } + + // Mark format as a mixed format inline + block level + if (format.selector && format.inline) { + format.mixed = true; + format.block_expand = true; + } + + // Split classes if needed + if (typeof format.classes === 'string') { + format.classes = format.classes.split(/\s+/); + } + }); + + formats[name] = format; + } + } + } + + /** + * Unregister a specific format by name. + * + * @method unregister + * @param {String} name Name of the format for example "bold". + */ + function unregister(name) { + if (name && formats[name]) { + delete formats[name]; + } + + return formats; + } + + function getTextDecoration(node) { + var decoration; + + ed.dom.getParent(node, function(n) { + decoration = ed.dom.getStyle(n, 'text-decoration'); + return decoration && decoration !== 'none'; + }); + + return decoration; + } + + function processUnderlineAndColor(node) { + var textDecoration; + if (node.nodeType === 1 && node.parentNode && node.parentNode.nodeType === 1) { + textDecoration = getTextDecoration(node.parentNode); + if (ed.dom.getStyle(node, 'color') && textDecoration) { + ed.dom.setStyle(node, 'text-decoration', textDecoration); + } else if (ed.dom.getStyle(node, 'text-decoration') === textDecoration) { + ed.dom.setStyle(node, 'text-decoration', null); + } + } + } + + /** + * Applies the specified format to the current selection or specified node. + * + * @method apply + * @param {String} name Name of format to apply. + * @param {Object} vars Optional list of variables to replace within format before applying it. + * @param {Node} node Optional node to apply the format to defaults to current selection. + */ + function apply(name, vars, node) { + var formatList = get(name), format = formatList[0], bookmark, rng, isCollapsed = !node && selection.isCollapsed(); + + function setElementFormat(elm, fmt) { + fmt = fmt || format; + + if (elm) { + if (fmt.onformat) { + fmt.onformat(elm, fmt, vars, node); + } + + each(fmt.styles, function(value, name) { + dom.setStyle(elm, name, replaceVars(value, vars)); + }); + + // Needed for the WebKit span spam bug + // TODO: Remove this once WebKit/Blink fixes this + if (fmt.styles) { + var styleVal = dom.getAttrib(elm, 'style'); + + if (styleVal) { + elm.setAttribute('data-mce-style', styleVal); + } + } + + each(fmt.attributes, function(value, name) { + dom.setAttrib(elm, name, replaceVars(value, vars)); + }); + + each(fmt.classes, function(value) { + value = replaceVars(value, vars); + + if (!dom.hasClass(elm, value)) { + dom.addClass(elm, value); + } + }); + } + } + + function adjustSelectionToVisibleSelection() { + function findSelectionEnd(start, end) { + var walker = new TreeWalker(end); + for (node = walker.current(); node; node = walker.prev()) { + if (node.childNodes.length > 1 || node == start || node.tagName == 'BR') { + return node; + } + } + } + + // Adjust selection so that a end container with a end offset of zero is not included in the selection + // as this isn't visible to the user. + var rng = ed.selection.getRng(); + var start = rng.startContainer; + var end = rng.endContainer; + + if (start != end && rng.endOffset === 0) { + var newEnd = findSelectionEnd(start, end); + var endOffset = newEnd.nodeType == 3 ? newEnd.length : newEnd.childNodes.length; + + rng.setEnd(newEnd, endOffset); + } + + return rng; + } + + function applyRngStyle(rng, bookmark, node_specific) { + var newWrappers = [], wrapName, wrapElm, contentEditable = true; + + // Setup wrapper element + wrapName = format.inline || format.block; + wrapElm = dom.create(wrapName); + setElementFormat(wrapElm); + + rangeUtils.walk(rng, function(nodes) { + var currentWrapElm; + + /** + * Process a list of nodes wrap them. + */ + function process(node) { + var nodeName, parentName, found, hasContentEditableState, lastContentEditable; + + lastContentEditable = contentEditable; + nodeName = node.nodeName.toLowerCase(); + parentName = node.parentNode.nodeName.toLowerCase(); + + // Node has a contentEditable value + if (node.nodeType === 1 && getContentEditable(node)) { + lastContentEditable = contentEditable; + contentEditable = getContentEditable(node) === "true"; + hasContentEditableState = true; // We don't want to wrap the container only it's children + } + + // Stop wrapping on br elements + if (isEq(nodeName, 'br')) { + currentWrapElm = 0; + + // Remove any br elements when we wrap things + if (format.block) { + dom.remove(node); + } + + return; + } + + // If node is wrapper type + if (format.wrapper && matchNode(node, name, vars)) { + currentWrapElm = 0; + return; + } + + // Can we rename the block + // TODO: Break this if up, too complex + if (contentEditable && !hasContentEditableState && format.block && + !format.wrapper && isTextBlock(nodeName) && isValid(parentName, wrapName)) { + node = dom.rename(node, wrapName); + setElementFormat(node); + newWrappers.push(node); + currentWrapElm = 0; + return; + } + + // Handle selector patterns + if (format.selector) { + // Look for matching formats + each(formatList, function(format) { + // Check collapsed state if it exists + if ('collapsed' in format && format.collapsed !== isCollapsed) { + return; + } + + if (dom.is(node, format.selector) && !isCaretNode(node)) { + setElementFormat(node, format); + found = true; + } + }); + + // Continue processing if a selector match wasn't found and a inline element is defined + if (!format.inline || found) { + currentWrapElm = 0; + return; + } + } + + // Is it valid to wrap this item + // TODO: Break this if up, too complex + if (contentEditable && !hasContentEditableState && isValid(wrapName, nodeName) && isValid(parentName, wrapName) && + !(!node_specific && node.nodeType === 3 && + node.nodeValue.length === 1 && + node.nodeValue.charCodeAt(0) === 65279) && + !isCaretNode(node) && + (!format.inline || !isBlock(node))) { + // Start wrapping + if (!currentWrapElm) { + // Wrap the node + currentWrapElm = dom.clone(wrapElm, FALSE); + node.parentNode.insertBefore(currentWrapElm, node); + newWrappers.push(currentWrapElm); + } + + currentWrapElm.appendChild(node); + } else { + // Start a new wrapper for possible children + currentWrapElm = 0; + + each(grep(node.childNodes), process); + + if (hasContentEditableState) { + contentEditable = lastContentEditable; // Restore last contentEditable state from stack + } + + // End the last wrapper + currentWrapElm = 0; + } + } + + // Process siblings from range + each(nodes, process); + }); + + // Apply formats to links as well to get the color of the underline to change as well + if (format.links === true) { + each(newWrappers, function(node) { + function process(node) { + if (node.nodeName === 'A') { + setElementFormat(node, format); + } + + each(grep(node.childNodes), process); + } + + process(node); + }); + } + + // Cleanup + each(newWrappers, function(node) { + var childCount; + + function getChildCount(node) { + var count = 0; + + each(node.childNodes, function(node) { + if (!isWhiteSpaceNode(node) && !isBookmarkNode(node)) { + count++; + } + }); + + return count; + } + + function mergeStyles(node) { + var child, clone; + + each(node.childNodes, function(node) { + if (node.nodeType == 1 && !isBookmarkNode(node) && !isCaretNode(node)) { + child = node; + return FALSE; // break loop + } + }); + + // If child was found and of the same type as the current node + if (child && !isBookmarkNode(child) && matchName(child, format)) { + clone = dom.clone(child, FALSE); + setElementFormat(clone); + + dom.replace(clone, node, TRUE); + dom.remove(child, 1); + } + + return clone || node; + } + + childCount = getChildCount(node); + + // Remove empty nodes but only if there is multiple wrappers and they are not block + // elements so never remove single

    since that would remove the + // currrent empty block element where the caret is at + if ((newWrappers.length > 1 || !isBlock(node)) && childCount === 0) { + dom.remove(node, 1); + return; + } + + if (format.inline || format.wrapper) { + // Merges the current node with it's children of similar type to reduce the number of elements + if (!format.exact && childCount === 1) { + node = mergeStyles(node); + } + + // Remove/merge children + each(formatList, function(format) { + // Merge all children of similar type will move styles from child to parent + // this: text + // will become: text + each(dom.select(format.inline, node), function(child) { + if (isBookmarkNode(child)) { + return; + } + + removeFormat(format, vars, child, format.exact ? child : null); + }); + }); + + // Remove child if direct parent is of same type + if (matchNode(node.parentNode, name, vars)) { + dom.remove(node, 1); + node = 0; + return TRUE; + } + + // Look for parent with similar style format + if (format.merge_with_parents) { + dom.getParent(node.parentNode, function(parent) { + if (matchNode(parent, name, vars)) { + dom.remove(node, 1); + node = 0; + return TRUE; + } + }); + } + + // Merge next and previous siblings if they are similar texttext becomes texttext + if (node && format.merge_siblings !== false) { + node = mergeSiblings(getNonWhiteSpaceSibling(node), node); + node = mergeSiblings(node, getNonWhiteSpaceSibling(node, TRUE)); + } + } + }); + } + + if (format) { + if (node) { + if (node.nodeType) { + rng = dom.createRng(); + rng.setStartBefore(node); + rng.setEndAfter(node); + applyRngStyle(expandRng(rng, formatList), null, true); + } else { + applyRngStyle(node, null, true); + } + } else { + if (!isCollapsed || !format.inline || dom.select('td.mce-item-selected,th.mce-item-selected').length) { + // Obtain selection node before selection is unselected by applyRngStyle() + var curSelNode = ed.selection.getNode(); + + // If the formats have a default block and we can't find a parent block then + // start wrapping it with a DIV this is for forced_root_blocks: false + // It's kind of a hack but people should be using the default block type P since all desktop editors work that way + if (!forcedRootBlock && formatList[0].defaultBlock && !dom.getParent(curSelNode, dom.isBlock)) { + apply(formatList[0].defaultBlock); + } + + // Apply formatting to selection + ed.selection.setRng(adjustSelectionToVisibleSelection()); + bookmark = selection.getBookmark(); + applyRngStyle(expandRng(selection.getRng(TRUE), formatList), bookmark); + + // Colored nodes should be underlined so that the color of the underline matches the text color. + if (format.styles && (format.styles.color || format.styles.textDecoration)) { + walk(curSelNode, processUnderlineAndColor, 'childNodes'); + processUnderlineAndColor(curSelNode); + } + + selection.moveToBookmark(bookmark); + moveStart(selection.getRng(TRUE)); + ed.nodeChanged(); + } else { + performCaretAction('apply', name, vars); + } + } + } + } + + /** + * Removes the specified format from the current selection or specified node. + * + * @method remove + * @param {String} name Name of format to remove. + * @param {Object} vars Optional list of variables to replace within format before removing it. + * @param {Node/Range} node Optional node or DOM range to remove the format from defaults to current selection. + */ + function remove(name, vars, node, similar) { + var formatList = get(name), format = formatList[0], bookmark, rng, contentEditable = true; + + // Merges the styles for each node + function process(node) { + var children, i, l, lastContentEditable, hasContentEditableState; + + // Node has a contentEditable value + if (node.nodeType === 1 && getContentEditable(node)) { + lastContentEditable = contentEditable; + contentEditable = getContentEditable(node) === "true"; + hasContentEditableState = true; // We don't want to wrap the container only it's children + } + + // Grab the children first since the nodelist might be changed + children = grep(node.childNodes); + + // Process current node + if (contentEditable && !hasContentEditableState) { + for (i = 0, l = formatList.length; i < l; i++) { + if (removeFormat(formatList[i], vars, node, node)) { + break; + } + } + } + + // Process the children + if (format.deep) { + if (children.length) { + for (i = 0, l = children.length; i < l; i++) { + process(children[i]); + } + + if (hasContentEditableState) { + contentEditable = lastContentEditable; // Restore last contentEditable state from stack + } + } + } + } + + function findFormatRoot(container) { + var formatRoot; + + // Find format root + each(getParents(container.parentNode).reverse(), function(parent) { + var format; + + // Find format root element + if (!formatRoot && parent.id != '_start' && parent.id != '_end') { + // Is the node matching the format we are looking for + format = matchNode(parent, name, vars, similar); + if (format && format.split !== false) { + formatRoot = parent; + } + } + }); + + return formatRoot; + } + + function wrapAndSplit(formatRoot, container, target, split) { + var parent, clone, lastClone, firstClone, i, formatRootParent; + + // Format root found then clone formats and split it + if (formatRoot) { + formatRootParent = formatRoot.parentNode; + + for (parent = container.parentNode; parent && parent != formatRootParent; parent = parent.parentNode) { + clone = dom.clone(parent, FALSE); + + for (i = 0; i < formatList.length; i++) { + if (removeFormat(formatList[i], vars, clone, clone)) { + clone = 0; + break; + } + } + + // Build wrapper node + if (clone) { + if (lastClone) { + clone.appendChild(lastClone); + } + + if (!firstClone) { + firstClone = clone; + } + + lastClone = clone; + } + } + + // Never split block elements if the format is mixed + if (split && (!format.mixed || !isBlock(formatRoot))) { + container = dom.split(formatRoot, container); + } + + // Wrap container in cloned formats + if (lastClone) { + target.parentNode.insertBefore(lastClone, target); + firstClone.appendChild(target); + } + } + + return container; + } + + function splitToFormatRoot(container) { + return wrapAndSplit(findFormatRoot(container), container, container, true); + } + + function unwrap(start) { + var node = dom.get(start ? '_start' : '_end'), + out = node[start ? 'firstChild' : 'lastChild']; + + // If the end is placed within the start the result will be removed + // So this checks if the out node is a bookmark node if it is it + // checks for another more suitable node + if (isBookmarkNode(out)) { + out = out[start ? 'firstChild' : 'lastChild']; + } + + // Since dom.remove removes empty text nodes then we need to try to find a better node + if (out.nodeType == 3 && out.data.length === 0) { + out = start ? node.previousSibling || node.nextSibling : node.nextSibling || node.previousSibling; + } + + dom.remove(node, true); + + return out; + } + + function removeRngStyle(rng) { + var startContainer, endContainer; + var commonAncestorContainer = rng.commonAncestorContainer; + + rng = expandRng(rng, formatList, TRUE); + + if (format.split) { + startContainer = getContainer(rng, TRUE); + endContainer = getContainer(rng); + + if (startContainer != endContainer) { + // WebKit will render the table incorrectly if we wrap a TH or TD in a SPAN + // so let's see if we can use the first child instead + // This will happen if you triple click a table cell and use remove formatting + if (/^(TR|TH|TD)$/.test(startContainer.nodeName) && startContainer.firstChild) { + if (startContainer.nodeName == "TR") { + startContainer = startContainer.firstChild.firstChild || startContainer; + } else { + startContainer = startContainer.firstChild || startContainer; + } + } + + // Try to adjust endContainer as well if cells on the same row were selected - bug #6410 + if (commonAncestorContainer && + /^T(HEAD|BODY|FOOT|R)$/.test(commonAncestorContainer.nodeName) && + isTableCell(endContainer) && endContainer.firstChild) { + endContainer = endContainer.firstChild || endContainer; + } + + if (dom.isChildOf(startContainer, endContainer) && !isTableCell(startContainer) && !isTableCell(endContainer)) { + startContainer = wrap(startContainer, 'span', {id: '_start', 'data-mce-type': 'bookmark'}); + splitToFormatRoot(startContainer); + startContainer = unwrap(TRUE); + return; + } else { + // Wrap start/end nodes in span element since these might be cloned/moved + startContainer = wrap(startContainer, 'span', {id: '_start', 'data-mce-type': 'bookmark'}); + endContainer = wrap(endContainer, 'span', {id: '_end', 'data-mce-type': 'bookmark'}); + + // Split start/end + splitToFormatRoot(startContainer); + splitToFormatRoot(endContainer); + + // Unwrap start/end to get real elements again + startContainer = unwrap(TRUE); + endContainer = unwrap(); + } + } else { + startContainer = endContainer = splitToFormatRoot(startContainer); + } + + // Update range positions since they might have changed after the split operations + rng.startContainer = startContainer.parentNode ? startContainer.parentNode : startContainer; + rng.startOffset = nodeIndex(startContainer); + rng.endContainer = endContainer.parentNode ? endContainer.parentNode : endContainer; + rng.endOffset = nodeIndex(endContainer) + 1; + } + + // Remove items between start/end + rangeUtils.walk(rng, function(nodes) { + each(nodes, function(node) { + process(node); + + // Remove parent span if it only contains text-decoration: underline, yet a parent node is also underlined. + if (node.nodeType === 1 && ed.dom.getStyle(node, 'text-decoration') === 'underline' && + node.parentNode && getTextDecoration(node.parentNode) === 'underline') { + removeFormat({ + 'deep': false, + 'exact': true, + 'inline': 'span', + 'styles': { + 'textDecoration': 'underline' + } + }, null, node); + } + }); + }); + } + + // Handle node + if (node) { + if (node.nodeType) { + rng = dom.createRng(); + rng.setStartBefore(node); + rng.setEndAfter(node); + removeRngStyle(rng); + } else { + removeRngStyle(node); + } + + return; + } + + if (!selection.isCollapsed() || !format.inline || dom.select('td.mce-item-selected,th.mce-item-selected').length) { + bookmark = selection.getBookmark(); + removeRngStyle(selection.getRng(TRUE)); + selection.moveToBookmark(bookmark); + + // Check if start element still has formatting then we are at: "text|text" + // and need to move the start into the next text node + if (format.inline && match(name, vars, selection.getStart())) { + moveStart(selection.getRng(true)); + } + + ed.nodeChanged(); + } else { + performCaretAction('remove', name, vars, similar); + } + } + + /** + * Toggles the specified format on/off. + * + * @method toggle + * @param {String} name Name of format to apply/remove. + * @param {Object} vars Optional list of variables to replace within format before applying/removing it. + * @param {Node} node Optional node to apply the format to or remove from. Defaults to current selection. + */ + function toggle(name, vars, node) { + var fmt = get(name); + + if (match(name, vars, node) && (!('toggle' in fmt[0]) || fmt[0].toggle)) { + remove(name, vars, node); + } else { + apply(name, vars, node); + } + } + + /** + * Return true/false if the specified node has the specified format. + * + * @method matchNode + * @param {Node} node Node to check the format on. + * @param {String} name Format name to check. + * @param {Object} vars Optional list of variables to replace before checking it. + * @param {Boolean} similar Match format that has similar properties. + * @return {Object} Returns the format object it matches or undefined if it doesn't match. + */ + function matchNode(node, name, vars, similar) { + var formatList = get(name), format, i, classes; + + function matchItems(node, format, item_name) { + var key, value, items = format[item_name], i; + + // Custom match + if (format.onmatch) { + return format.onmatch(node, format, item_name); + } + + // Check all items + if (items) { + // Non indexed object + if (items.length === undef) { + for (key in items) { + if (items.hasOwnProperty(key)) { + if (item_name === 'attributes') { + value = dom.getAttrib(node, key); + } else { + value = getStyle(node, key); + } + + if (similar && !value && !format.exact) { + return; + } + + if ((!similar || format.exact) && !isEq(value, normalizeStyleValue(replaceVars(items[key], vars), key))) { + return; + } + } + } + } else { + // Only one match needed for indexed arrays + for (i = 0; i < items.length; i++) { + if (item_name === 'attributes' ? dom.getAttrib(node, items[i]) : getStyle(node, items[i])) { + return format; + } + } + } + } + + return format; + } + + if (formatList && node) { + // Check each format in list + for (i = 0; i < formatList.length; i++) { + format = formatList[i]; + + // Name name, attributes, styles and classes + if (matchName(node, format) && matchItems(node, format, 'attributes') && matchItems(node, format, 'styles')) { + // Match classes + if ((classes = format.classes)) { + for (i = 0; i < classes.length; i++) { + if (!dom.hasClass(node, classes[i])) { + return; + } + } + } + + return format; + } + } + } + } + + /** + * Matches the current selection or specified node against the specified format name. + * + * @method match + * @param {String} name Name of format to match. + * @param {Object} vars Optional list of variables to replace before checking it. + * @param {Node} node Optional node to check. + * @return {boolean} true/false if the specified selection/node matches the format. + */ + function match(name, vars, node) { + var startNode; + + function matchParents(node) { + var root = dom.getRoot(); + + if (node === root) { + return false; + } + + // Find first node with similar format settings + node = dom.getParent(node, function(node) { + return node.parentNode === root || !!matchNode(node, name, vars, true); + }); + + // Do an exact check on the similar format element + return matchNode(node, name, vars); + } + + // Check specified node + if (node) { + return matchParents(node); + } + + // Check selected node + node = selection.getNode(); + if (matchParents(node)) { + return TRUE; + } + + // Check start node if it's different + startNode = selection.getStart(); + if (startNode != node) { + if (matchParents(startNode)) { + return TRUE; + } + } + + return FALSE; + } + + /** + * Matches the current selection against the array of formats and returns a new array with matching formats. + * + * @method matchAll + * @param {Array} names Name of format to match. + * @param {Object} vars Optional list of variables to replace before checking it. + * @return {Array} Array with matched formats. + */ + function matchAll(names, vars) { + var startElement, matchedFormatNames = [], checkedMap = {}; + + // Check start of selection for formats + startElement = selection.getStart(); + dom.getParent(startElement, function(node) { + var i, name; + + for (i = 0; i < names.length; i++) { + name = names[i]; + + if (!checkedMap[name] && matchNode(node, name, vars)) { + checkedMap[name] = true; + matchedFormatNames.push(name); + } + } + }, dom.getRoot()); + + return matchedFormatNames; + } + + /** + * Returns true/false if the specified format can be applied to the current selection or not. It + * will currently only check the state for selector formats, it returns true on all other format types. + * + * @method canApply + * @param {String} name Name of format to check. + * @return {boolean} true/false if the specified format can be applied to the current selection/node. + */ + function canApply(name) { + var formatList = get(name), startNode, parents, i, x, selector; + + if (formatList) { + startNode = selection.getStart(); + parents = getParents(startNode); + + for (x = formatList.length - 1; x >= 0; x--) { + selector = formatList[x].selector; + + // Format is not selector based then always return TRUE + // Is it has a defaultBlock then it's likely it can be applied for example align on a non block element line + if (!selector || formatList[x].defaultBlock) { + return TRUE; + } + + for (i = parents.length - 1; i >= 0; i--) { + if (dom.is(parents[i], selector)) { + return TRUE; + } + } + } + } + + return FALSE; + } + + /** + * Executes the specified callback when the current selection matches the formats or not. + * + * @method formatChanged + * @param {String} formats Comma separated list of formats to check for. + * @param {function} callback Callback with state and args when the format is changed/toggled on/off. + * @param {Boolean} similar True/false state if the match should handle similar or exact formats. + */ + function formatChanged(formats, callback, similar) { + var currentFormats; + + // Setup format node change logic + if (!formatChangeData) { + formatChangeData = {}; + currentFormats = {}; + + ed.on('NodeChange', function(e) { + var parents = getParents(e.element), matchedFormats = {}; + + // Ignore bogus nodes like the
    tag created by moveStart() + parents = Tools.grep(parents, function(node) { + return node.nodeType == 1 && !node.getAttribute('data-mce-bogus'); + }); + + // Check for new formats + each(formatChangeData, function(callbacks, format) { + each(parents, function(node) { + if (matchNode(node, format, {}, callbacks.similar)) { + if (!currentFormats[format]) { + // Execute callbacks + each(callbacks, function(callback) { + callback(true, {node: node, format: format, parents: parents}); + }); + + currentFormats[format] = callbacks; + } + + matchedFormats[format] = callbacks; + return false; + } + }); + }); + + // Check if current formats still match + each(currentFormats, function(callbacks, format) { + if (!matchedFormats[format]) { + delete currentFormats[format]; + + each(callbacks, function(callback) { + callback(false, {node: e.element, format: format, parents: parents}); + }); + } + }); + }); + } + + // Add format listeners + each(formats.split(','), function(format) { + if (!formatChangeData[format]) { + formatChangeData[format] = []; + formatChangeData[format].similar = similar; + } + + formatChangeData[format].push(callback); + }); + + return this; + } + + /** + * Returns a preview css text for the specified format. + * + * @method getCssText + * @param {String/Object} format Format to generate preview css text for. + * @return {String} Css text for the specified format. + * @example + * var cssText1 = editor.formatter.getCssText('bold'); + * var cssText2 = editor.formatter.getCssText({inline: 'b'}); + */ + function getCssText(format) { + return Preview.getCssText(ed, format); + } + + // Expose to public + extend(this, { + get: get, + register: register, + unregister: unregister, + apply: apply, + remove: remove, + toggle: toggle, + match: match, + matchAll: matchAll, + matchNode: matchNode, + canApply: canApply, + formatChanged: formatChanged, + getCssText: getCssText + }); + + // Initialize + defaultFormats(); + addKeyboardShortcuts(); + ed.on('BeforeGetContent', function(e) { + if (markCaretContainersBogus && e.format != 'raw') { + markCaretContainersBogus(); + } + }); + ed.on('mouseup keydown', function(e) { + if (disableCaretContainer) { + disableCaretContainer(e); + } + }); + + // Private functions + + /** + * Checks if the specified nodes name matches the format inline/block or selector. + * + * @private + * @param {Node} node Node to match against the specified format. + * @param {Object} format Format object o match with. + * @return {boolean} true/false if the format matches. + */ + function matchName(node, format) { + // Check for inline match + if (isEq(node, format.inline)) { + return TRUE; + } + + // Check for block match + if (isEq(node, format.block)) { + return TRUE; + } + + // Check for selector match + if (format.selector) { + return node.nodeType == 1 && dom.is(node, format.selector); + } + } + + /** + * Compares two string/nodes regardless of their case. + * + * @private + * @param {String/Node} Node or string to compare. + * @param {String/Node} Node or string to compare. + * @return {boolean} True/false if they match. + */ + function isEq(str1, str2) { + str1 = str1 || ''; + str2 = str2 || ''; + + str1 = '' + (str1.nodeName || str1); + str2 = '' + (str2.nodeName || str2); + + return str1.toLowerCase() == str2.toLowerCase(); + } + + /** + * Returns the style by name on the specified node. This method modifies the style + * contents to make it more easy to match. This will resolve a few browser issues. + * + * @private + * @param {Node} node to get style from. + * @param {String} name Style name to get. + * @return {String} Style item value. + */ + function getStyle(node, name) { + return normalizeStyleValue(dom.getStyle(node, name), name); + } + + /** + * Normalize style value by name. This method modifies the style contents + * to make it more easy to match. This will resolve a few browser issues. + * + * @private + * @param {Node} node to get style from. + * @param {String} name Style name to get. + * @return {String} Style item value. + */ + function normalizeStyleValue(value, name) { + // Force the format to hex + if (name == 'color' || name == 'backgroundColor') { + value = dom.toHex(value); + } + + // Opera will return bold as 700 + if (name == 'fontWeight' && value == 700) { + value = 'bold'; + } + + // Normalize fontFamily so "'Font name', Font" becomes: "Font name,Font" + if (name == 'fontFamily') { + value = value.replace(/[\'\"]/g, '').replace(/,\s+/g, ','); + } + + return '' + value; + } + + /** + * Replaces variables in the value. The variable format is %var. + * + * @private + * @param {String} value Value to replace variables in. + * @param {Object} vars Name/value array with variables to replace. + * @return {String} New value with replaced variables. + */ + function replaceVars(value, vars) { + if (typeof value != "string") { + value = value(vars); + } else if (vars) { + value = value.replace(/%(\w+)/g, function(str, name) { + return vars[name] || str; + }); + } + + return value; + } + + function isWhiteSpaceNode(node) { + return node && node.nodeType === 3 && /^([\t \r\n]+|)$/.test(node.nodeValue); + } + + function wrap(node, name, attrs) { + var wrapper = dom.create(name, attrs); + + node.parentNode.insertBefore(wrapper, node); + wrapper.appendChild(node); + + return wrapper; + } + + /** + * Expands the specified range like object to depending on format. + * + * For example on block formats it will move the start/end position + * to the beginning of the current block. + * + * @private + * @param {Object} rng Range like object. + * @param {Array} formats Array with formats to expand by. + * @return {Object} Expanded range like object. + */ + function expandRng(rng, format, remove) { + var lastIdx, leaf, endPoint, + startContainer = rng.startContainer, + startOffset = rng.startOffset, + endContainer = rng.endContainer, + endOffset = rng.endOffset; + + // This function walks up the tree if there is no siblings before/after the node + function findParentContainer(start) { + var container, parent, sibling, siblingName, root; + + container = parent = start ? startContainer : endContainer; + siblingName = start ? 'previousSibling' : 'nextSibling'; + root = dom.getRoot(); + + function isBogusBr(node) { + return node.nodeName == "BR" && node.getAttribute('data-mce-bogus') && !node.nextSibling; + } + + // If it's a text node and the offset is inside the text + if (container.nodeType == 3 && !isWhiteSpaceNode(container)) { + if (start ? startOffset > 0 : endOffset < container.nodeValue.length) { + return container; + } + } + + /*eslint no-constant-condition:0 */ + while (true) { + // Stop expanding on block elements + if (!format[0].block_expand && isBlock(parent)) { + return parent; + } + + // Walk left/right + for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) { + if (!isBookmarkNode(sibling) && !isWhiteSpaceNode(sibling) && !isBogusBr(sibling)) { + return parent; + } + } + + // Check if we can move up are we at root level or body level + if (parent.parentNode == root) { + container = parent; + break; + } + + parent = parent.parentNode; + } + + return container; + } + + // This function walks down the tree to find the leaf at the selection. + // The offset is also returned as if node initially a leaf, the offset may be in the middle of the text node. + function findLeaf(node, offset) { + if (offset === undef) { + offset = node.nodeType === 3 ? node.length : node.childNodes.length; + } + + while (node && node.hasChildNodes()) { + node = node.childNodes[offset]; + if (node) { + offset = node.nodeType === 3 ? node.length : node.childNodes.length; + } + } + return {node: node, offset: offset}; + } + + // If index based start position then resolve it + if (startContainer.nodeType == 1 && startContainer.hasChildNodes()) { + lastIdx = startContainer.childNodes.length - 1; + startContainer = startContainer.childNodes[startOffset > lastIdx ? lastIdx : startOffset]; + + if (startContainer.nodeType == 3) { + startOffset = 0; + } + } + + // If index based end position then resolve it + if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) { + lastIdx = endContainer.childNodes.length - 1; + endContainer = endContainer.childNodes[endOffset > lastIdx ? lastIdx : endOffset - 1]; + + if (endContainer.nodeType == 3) { + endOffset = endContainer.nodeValue.length; + } + } + + // Expands the node to the closes contentEditable false element if it exists + function findParentContentEditable(node) { + var parent = node; + + while (parent) { + if (parent.nodeType === 1 && getContentEditable(parent)) { + return getContentEditable(parent) === "false" ? parent : node; + } + + parent = parent.parentNode; + } + + return node; + } + + function findWordEndPoint(container, offset, start) { + var walker, node, pos, lastTextNode; + + function findSpace(node, offset) { + var pos, pos2, str = node.nodeValue; + + if (typeof offset == "undefined") { + offset = start ? str.length : 0; + } + + if (start) { + pos = str.lastIndexOf(' ', offset); + pos2 = str.lastIndexOf('\u00a0', offset); + pos = pos > pos2 ? pos : pos2; + + // Include the space on remove to avoid tag soup + if (pos !== -1 && !remove) { + pos++; + } + } else { + pos = str.indexOf(' ', offset); + pos2 = str.indexOf('\u00a0', offset); + pos = pos !== -1 && (pos2 === -1 || pos < pos2) ? pos : pos2; + } + + return pos; + } + + if (container.nodeType === 3) { + pos = findSpace(container, offset); + + if (pos !== -1) { + return {container: container, offset: pos}; + } + + lastTextNode = container; + } + + // Walk the nodes inside the block + walker = new TreeWalker(container, dom.getParent(container, isBlock) || ed.getBody()); + while ((node = walker[start ? 'prev' : 'next']())) { + if (node.nodeType === 3) { + lastTextNode = node; + pos = findSpace(node); + + if (pos !== -1) { + return {container: node, offset: pos}; + } + } else if (isBlock(node)) { + break; + } + } + + if (lastTextNode) { + if (start) { + offset = 0; + } else { + offset = lastTextNode.length; + } + + return {container: lastTextNode, offset: offset}; + } + } + + function findSelectorEndPoint(container, sibling_name) { + var parents, i, y, curFormat; + + if (container.nodeType == 3 && container.nodeValue.length === 0 && container[sibling_name]) { + container = container[sibling_name]; + } + + parents = getParents(container); + for (i = 0; i < parents.length; i++) { + for (y = 0; y < format.length; y++) { + curFormat = format[y]; + + // If collapsed state is set then skip formats that doesn't match that + if ("collapsed" in curFormat && curFormat.collapsed !== rng.collapsed) { + continue; + } + + if (dom.is(parents[i], curFormat.selector)) { + return parents[i]; + } + } + } + + return container; + } + + function findBlockEndPoint(container, sibling_name) { + var node, root = dom.getRoot(); + + // Expand to block of similar type + if (!format[0].wrapper) { + node = dom.getParent(container, format[0].block, root); + } + + // Expand to first wrappable block element or any block element + if (!node) { + node = dom.getParent(container.nodeType == 3 ? container.parentNode : container, function(node) { + // Fixes #6183 where it would expand to editable parent element in inline mode + return node != root && isTextBlock(node); + }); + } + + // Exclude inner lists from wrapping + if (node && format[0].wrapper) { + node = getParents(node, 'ul,ol').reverse()[0] || node; + } + + // Didn't find a block element look for first/last wrappable element + if (!node) { + node = container; + + while (node[sibling_name] && !isBlock(node[sibling_name])) { + node = node[sibling_name]; + + // Break on BR but include it will be removed later on + // we can't remove it now since we need to check if it can be wrapped + if (isEq(node, 'br')) { + break; + } + } + } + + return node || container; + } + + // Expand to closest contentEditable element + startContainer = findParentContentEditable(startContainer); + endContainer = findParentContentEditable(endContainer); + + // Exclude bookmark nodes if possible + if (isBookmarkNode(startContainer.parentNode) || isBookmarkNode(startContainer)) { + startContainer = isBookmarkNode(startContainer) ? startContainer : startContainer.parentNode; + startContainer = startContainer.nextSibling || startContainer; + + if (startContainer.nodeType == 3) { + startOffset = 0; + } + } + + if (isBookmarkNode(endContainer.parentNode) || isBookmarkNode(endContainer)) { + endContainer = isBookmarkNode(endContainer) ? endContainer : endContainer.parentNode; + endContainer = endContainer.previousSibling || endContainer; + + if (endContainer.nodeType == 3) { + endOffset = endContainer.length; + } + } + + if (format[0].inline) { + if (rng.collapsed) { + // Expand left to closest word boundary + endPoint = findWordEndPoint(startContainer, startOffset, true); + if (endPoint) { + startContainer = endPoint.container; + startOffset = endPoint.offset; + } + + // Expand right to closest word boundary + endPoint = findWordEndPoint(endContainer, endOffset); + if (endPoint) { + endContainer = endPoint.container; + endOffset = endPoint.offset; + } + } + + // Avoid applying formatting to a trailing space. + leaf = findLeaf(endContainer, endOffset); + if (leaf.node) { + while (leaf.node && leaf.offset === 0 && leaf.node.previousSibling) { + leaf = findLeaf(leaf.node.previousSibling); + } + + if (leaf.node && leaf.offset > 0 && leaf.node.nodeType === 3 && + leaf.node.nodeValue.charAt(leaf.offset - 1) === ' ') { + + if (leaf.offset > 1) { + endContainer = leaf.node; + endContainer.splitText(leaf.offset - 1); + } + } + } + } + + // Move start/end point up the tree if the leaves are sharp and if we are in different containers + // Example * becomes !: !

    *texttext*

    ! + // This will reduce the number of wrapper elements that needs to be created + // Move start point up the tree + if (format[0].inline || format[0].block_expand) { + if (!format[0].inline || (startContainer.nodeType != 3 || startOffset === 0)) { + startContainer = findParentContainer(true); + } + + if (!format[0].inline || (endContainer.nodeType != 3 || endOffset === endContainer.nodeValue.length)) { + endContainer = findParentContainer(); + } + } + + // Expand start/end container to matching selector + if (format[0].selector && format[0].expand !== FALSE && !format[0].inline) { + // Find new startContainer/endContainer if there is better one + startContainer = findSelectorEndPoint(startContainer, 'previousSibling'); + endContainer = findSelectorEndPoint(endContainer, 'nextSibling'); + } + + // Expand start/end container to matching block element or text node + if (format[0].block || format[0].selector) { + // Find new startContainer/endContainer if there is better one + startContainer = findBlockEndPoint(startContainer, 'previousSibling'); + endContainer = findBlockEndPoint(endContainer, 'nextSibling'); + + // Non block element then try to expand up the leaf + if (format[0].block) { + if (!isBlock(startContainer)) { + startContainer = findParentContainer(true); + } + + if (!isBlock(endContainer)) { + endContainer = findParentContainer(); + } + } + } + + // Setup index for startContainer + if (startContainer.nodeType == 1) { + startOffset = nodeIndex(startContainer); + startContainer = startContainer.parentNode; + } + + // Setup index for endContainer + if (endContainer.nodeType == 1) { + endOffset = nodeIndex(endContainer) + 1; + endContainer = endContainer.parentNode; + } + + // Return new range like object + return { + startContainer: startContainer, + startOffset: startOffset, + endContainer: endContainer, + endOffset: endOffset + }; + } + + function isColorFormatAndAnchor(node, format) { + return format.links && node.tagName == 'A'; + } + + /** + * Removes the specified format for the specified node. It will also remove the node if it doesn't have + * any attributes if the format specifies it to do so. + * + * @private + * @param {Object} format Format object with items to remove from node. + * @param {Object} vars Name/value object with variables to apply to format. + * @param {Node} node Node to remove the format styles on. + * @param {Node} compare_node Optional compare node, if specified the styles will be compared to that node. + * @return {Boolean} True/false if the node was removed or not. + */ + function removeFormat(format, vars, node, compare_node) { + var i, attrs, stylesModified; + + // Check if node matches format + if (!matchName(node, format) && !isColorFormatAndAnchor(node, format)) { + return FALSE; + } + + // Should we compare with format attribs and styles + if (format.remove != 'all') { + // Remove styles + each(format.styles, function(value, name) { + value = normalizeStyleValue(replaceVars(value, vars), name); + + // Indexed array + if (typeof name === 'number') { + name = value; + compare_node = 0; + } + + if (format.remove_similar || (!compare_node || isEq(getStyle(compare_node, name), value))) { + dom.setStyle(node, name, ''); + } + + stylesModified = 1; + }); + + // Remove style attribute if it's empty + if (stylesModified && dom.getAttrib(node, 'style') === '') { + node.removeAttribute('style'); + node.removeAttribute('data-mce-style'); + } + + // Remove attributes + each(format.attributes, function(value, name) { + var valueOut; + + value = replaceVars(value, vars); + + // Indexed array + if (typeof name === 'number') { + name = value; + compare_node = 0; + } + + if (!compare_node || isEq(dom.getAttrib(compare_node, name), value)) { + // Keep internal classes + if (name == 'class') { + value = dom.getAttrib(node, name); + if (value) { + // Build new class value where everything is removed except the internal prefixed classes + valueOut = ''; + each(value.split(/\s+/), function(cls) { + if (/mce\-\w+/.test(cls)) { + valueOut += (valueOut ? ' ' : '') + cls; + } + }); + + // We got some internal classes left + if (valueOut) { + dom.setAttrib(node, name, valueOut); + return; + } + } + } + + // IE6 has a bug where the attribute doesn't get removed correctly + if (name == "class") { + node.removeAttribute('className'); + } + + // Remove mce prefixed attributes + if (MCE_ATTR_RE.test(name)) { + node.removeAttribute('data-mce-' + name); + } + + node.removeAttribute(name); + } + }); + + // Remove classes + each(format.classes, function(value) { + value = replaceVars(value, vars); + + if (!compare_node || dom.hasClass(compare_node, value)) { + dom.removeClass(node, value); + } + }); + + // Check for non internal attributes + attrs = dom.getAttribs(node); + for (i = 0; i < attrs.length; i++) { + if (attrs[i].nodeName.indexOf('_') !== 0) { + return FALSE; + } + } + } + + // Remove the inline child if it's empty for example or + if (format.remove != 'none') { + removeNode(node, format); + return TRUE; + } + } + + /** + * Removes the node and wrap it's children in paragraphs before doing so or + * appends BR elements to the beginning/end of the block element if forcedRootBlocks is disabled. + * + * If the div in the node below gets removed: + * text
    text
    text + * + * Output becomes: + * text

    text
    text + * + * So when the div is removed the result is: + * text
    text
    text + * + * @private + * @param {Node} node Node to remove + apply BR/P elements to. + * @param {Object} format Format rule. + * @return {Node} Input node. + */ + function removeNode(node, format) { + var parentNode = node.parentNode, rootBlockElm; + + function find(node, next, inc) { + node = getNonWhiteSpaceSibling(node, next, inc); + + return !node || (node.nodeName == 'BR' || isBlock(node)); + } + + if (format.block) { + if (!forcedRootBlock) { + // Append BR elements if needed before we remove the block + if (isBlock(node) && !isBlock(parentNode)) { + if (!find(node, FALSE) && !find(node.firstChild, TRUE, 1)) { + node.insertBefore(dom.create('br'), node.firstChild); + } + + if (!find(node, TRUE) && !find(node.lastChild, FALSE, 1)) { + node.appendChild(dom.create('br')); + } + } + } else { + // Wrap the block in a forcedRootBlock if we are at the root of document + if (parentNode == dom.getRoot()) { + if (!format.list_block || !isEq(node, format.list_block)) { + each(grep(node.childNodes), function(node) { + if (isValid(forcedRootBlock, node.nodeName.toLowerCase())) { + if (!rootBlockElm) { + rootBlockElm = wrap(node, forcedRootBlock); + dom.setAttribs(rootBlockElm, ed.settings.forced_root_block_attrs); + } else { + rootBlockElm.appendChild(node); + } + } else { + rootBlockElm = 0; + } + }); + } + } + } + } + + // Never remove nodes that isn't the specified inline element if a selector is specified too + if (format.selector && format.inline && !isEq(format.inline, node)) { + return; + } + + dom.remove(node, 1); + } + + /** + * Returns the next/previous non whitespace node. + * + * @private + * @param {Node} node Node to start at. + * @param {boolean} next (Optional) Include next or previous node defaults to previous. + * @param {boolean} inc (Optional) Include the current node in checking. Defaults to false. + * @return {Node} Next or previous node or undefined if it wasn't found. + */ + function getNonWhiteSpaceSibling(node, next, inc) { + if (node) { + next = next ? 'nextSibling' : 'previousSibling'; + + for (node = inc ? node : node[next]; node; node = node[next]) { + if (node.nodeType == 1 || !isWhiteSpaceNode(node)) { + return node; + } + } + } + } + + /** + * Merges the next/previous sibling element if they match. + * + * @private + * @param {Node} prev Previous node to compare/merge. + * @param {Node} next Next node to compare/merge. + * @return {Node} Next node if we didn't merge and prev node if we did. + */ + function mergeSiblings(prev, next) { + var sibling, tmpSibling, elementUtils = new ElementUtils(dom); + + function findElementSibling(node, sibling_name) { + for (sibling = node; sibling; sibling = sibling[sibling_name]) { + if (sibling.nodeType == 3 && sibling.nodeValue.length !== 0) { + return node; + } + + if (sibling.nodeType == 1 && !isBookmarkNode(sibling)) { + return sibling; + } + } + + return node; + } + + // Check if next/prev exists and that they are elements + if (prev && next) { + // If previous sibling is empty then jump over it + prev = findElementSibling(prev, 'previousSibling'); + next = findElementSibling(next, 'nextSibling'); + + // Compare next and previous nodes + if (elementUtils.compare(prev, next)) { + // Append nodes between + for (sibling = prev.nextSibling; sibling && sibling != next;) { + tmpSibling = sibling; + sibling = sibling.nextSibling; + prev.appendChild(tmpSibling); + } + + // Remove next node + dom.remove(next); + + // Move children into prev node + each(grep(next.childNodes), function(node) { + prev.appendChild(node); + }); + + return prev; + } + } + + return next; + } + + function getContainer(rng, start) { + var container, offset, lastIdx; + + container = rng[start ? 'startContainer' : 'endContainer']; + offset = rng[start ? 'startOffset' : 'endOffset']; + + if (container.nodeType == 1) { + lastIdx = container.childNodes.length - 1; + + if (!start && offset) { + offset--; + } + + container = container.childNodes[offset > lastIdx ? lastIdx : offset]; + } + + // If start text node is excluded then walk to the next node + if (container.nodeType === 3 && start && offset >= container.nodeValue.length) { + container = new TreeWalker(container, ed.getBody()).next() || container; + } + + // If end text node is excluded then walk to the previous node + if (container.nodeType === 3 && !start && offset === 0) { + container = new TreeWalker(container, ed.getBody()).prev() || container; + } + + return container; + } + + function performCaretAction(type, name, vars, similar) { + var caretContainerId = '_mce_caret', debug = ed.settings.caret_debug; + + // Creates a caret container bogus element + function createCaretContainer(fill) { + var caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true, style: debug ? 'color:red' : ''}); + + if (fill) { + caretContainer.appendChild(ed.getDoc().createTextNode(INVISIBLE_CHAR)); + } + + return caretContainer; + } + + function isCaretContainerEmpty(node, nodes) { + while (node) { + if ((node.nodeType === 3 && node.nodeValue !== INVISIBLE_CHAR) || node.childNodes.length > 1) { + return false; + } + + // Collect nodes + if (nodes && node.nodeType === 1) { + nodes.push(node); + } + + node = node.firstChild; + } + + return true; + } + + // Returns any parent caret container element + function getParentCaretContainer(node) { + while (node) { + if (node.id === caretContainerId) { + return node; + } + + node = node.parentNode; + } + } + + // Finds the first text node in the specified node + function findFirstTextNode(node) { + var walker; + + if (node) { + walker = new TreeWalker(node, node); + + for (node = walker.current(); node; node = walker.next()) { + if (node.nodeType === 3) { + return node; + } + } + } + } + + // Removes the caret container for the specified node or all on the current document + function removeCaretContainer(node, move_caret) { + var child, rng; + + if (!node) { + node = getParentCaretContainer(selection.getStart()); + + if (!node) { + while ((node = dom.get(caretContainerId))) { + removeCaretContainer(node, false); + } + } + } else { + rng = selection.getRng(true); + + if (isCaretContainerEmpty(node)) { + if (move_caret !== false) { + rng.setStartBefore(node); + rng.setEndBefore(node); + } + + dom.remove(node); + } else { + child = findFirstTextNode(node); + + if (child.nodeValue.charAt(0) === INVISIBLE_CHAR) { + child.deleteData(0, 1); + + // Fix for bug #6976 + if (rng.startContainer == child && rng.startOffset > 0) { + rng.setStart(child, rng.startOffset - 1); + } + + if (rng.endContainer == child && rng.endOffset > 0) { + rng.setEnd(child, rng.endOffset - 1); + } + } + + dom.remove(node, 1); + } + + selection.setRng(rng); + } + } + + // Applies formatting to the caret postion + function applyCaretFormat() { + var rng, caretContainer, textNode, offset, bookmark, container, text; + + rng = selection.getRng(true); + offset = rng.startOffset; + container = rng.startContainer; + text = container.nodeValue; + + caretContainer = getParentCaretContainer(selection.getStart()); + if (caretContainer) { + textNode = findFirstTextNode(caretContainer); + } + + // Expand to word is caret is in the middle of a text node and the char before/after is a alpha numeric character + if (text && offset > 0 && offset < text.length && /\w/.test(text.charAt(offset)) && /\w/.test(text.charAt(offset - 1))) { + // Get bookmark of caret position + bookmark = selection.getBookmark(); + + // Collapse bookmark range (WebKit) + rng.collapse(true); + + // Expand the range to the closest word and split it at those points + rng = expandRng(rng, get(name)); + rng = rangeUtils.split(rng); + + // Apply the format to the range + apply(name, vars, rng); + + // Move selection back to caret position + selection.moveToBookmark(bookmark); + } else { + if (!caretContainer || textNode.nodeValue !== INVISIBLE_CHAR) { + caretContainer = createCaretContainer(true); + textNode = caretContainer.firstChild; + + rng.insertNode(caretContainer); + offset = 1; + + apply(name, vars, caretContainer); + } else { + apply(name, vars, caretContainer); + } + + // Move selection to text node + selection.setCursorLocation(textNode, offset); + } + } + + function removeCaretFormat() { + var rng = selection.getRng(true), container, offset, bookmark, + hasContentAfter, node, formatNode, parents = [], i, caretContainer; + + container = rng.startContainer; + offset = rng.startOffset; + node = container; + + if (container.nodeType == 3) { + if (offset != container.nodeValue.length) { + hasContentAfter = true; + } + + node = node.parentNode; + } + + while (node) { + if (matchNode(node, name, vars, similar)) { + formatNode = node; + break; + } + + if (node.nextSibling) { + hasContentAfter = true; + } + + parents.push(node); + node = node.parentNode; + } + + // Node doesn't have the specified format + if (!formatNode) { + return; + } + + // Is there contents after the caret then remove the format on the element + if (hasContentAfter) { + // Get bookmark of caret position + bookmark = selection.getBookmark(); + + // Collapse bookmark range (WebKit) + rng.collapse(true); + + // Expand the range to the closest word and split it at those points + rng = expandRng(rng, get(name), true); + rng = rangeUtils.split(rng); + + // Remove the format from the range + remove(name, vars, rng); + + // Move selection back to caret position + selection.moveToBookmark(bookmark); + } else { + caretContainer = createCaretContainer(); + + node = caretContainer; + for (i = parents.length - 1; i >= 0; i--) { + node.appendChild(dom.clone(parents[i], false)); + node = node.firstChild; + } + + // Insert invisible character into inner most format element + node.appendChild(dom.doc.createTextNode(INVISIBLE_CHAR)); + node = node.firstChild; + + var block = dom.getParent(formatNode, isTextBlock); + + if (block && dom.isEmpty(block)) { + // Replace formatNode with caretContainer when removing format from empty block like

    |

    + formatNode.parentNode.replaceChild(caretContainer, formatNode); + } else { + // Insert caret container after the formated node + dom.insertAfter(caretContainer, formatNode); + } + + // Move selection to text node + selection.setCursorLocation(node, 1); + + // If the formatNode is empty, we can remove it safely. + if (dom.isEmpty(formatNode)) { + dom.remove(formatNode); + } + } + } + + // Checks if the parent caret container node isn't empty if that is the case it + // will remove the bogus state on all children that isn't empty + function unmarkBogusCaretParents() { + var caretContainer; + + caretContainer = getParentCaretContainer(selection.getStart()); + if (caretContainer && !dom.isEmpty(caretContainer)) { + walk(caretContainer, function(node) { + if (node.nodeType == 1 && node.id !== caretContainerId && !dom.isEmpty(node)) { + dom.setAttrib(node, 'data-mce-bogus', null); + } + }, 'childNodes'); + } + } + + // Only bind the caret events once + if (!ed._hasCaretEvents) { + // Mark current caret container elements as bogus when getting the contents so we don't end up with empty elements + markCaretContainersBogus = function() { + var nodes = [], i; + + if (isCaretContainerEmpty(getParentCaretContainer(selection.getStart()), nodes)) { + // Mark children + i = nodes.length; + while (i--) { + dom.setAttrib(nodes[i], 'data-mce-bogus', '1'); + } + } + }; + + disableCaretContainer = function(e) { + var keyCode = e.keyCode; + + removeCaretContainer(); + + // Remove caret container on keydown and it's a backspace, enter or left/right arrow keys + // Backspace key needs to check if the range is collapsed due to bug #6780 + if ((keyCode == 8 && selection.isCollapsed()) || keyCode == 37 || keyCode == 39) { + removeCaretContainer(getParentCaretContainer(selection.getStart())); + } + + unmarkBogusCaretParents(); + }; + + // Remove bogus state if they got filled by contents using editor.selection.setContent + ed.on('SetContent', function(e) { + if (e.selection) { + unmarkBogusCaretParents(); + } + }); + ed._hasCaretEvents = true; + } + + // Do apply or remove caret format + if (type == "apply") { + applyCaretFormat(); + } else { + removeCaretFormat(); + } + } + + /** + * Moves the start to the first suitable text node. + */ + function moveStart(rng) { + var container = rng.startContainer, + offset = rng.startOffset, isAtEndOfText, + walker, node, nodes, tmpNode; + + // Convert text node into index if possible + if (container.nodeType == 3 && offset >= container.nodeValue.length) { + // Get the parent container location and walk from there + offset = nodeIndex(container); + container = container.parentNode; + isAtEndOfText = true; + } + + // Move startContainer/startOffset in to a suitable node + if (container.nodeType == 1) { + nodes = container.childNodes; + container = nodes[Math.min(offset, nodes.length - 1)]; + walker = new TreeWalker(container, dom.getParent(container, dom.isBlock)); + + // If offset is at end of the parent node walk to the next one + if (offset > nodes.length - 1 || isAtEndOfText) { + walker.next(); + } + + for (node = walker.current(); node; node = walker.next()) { + if (node.nodeType == 3 && !isWhiteSpaceNode(node)) { + // IE has a "neat" feature where it moves the start node into the closest element + // we can avoid this by inserting an element before it and then remove it after we set the selection + tmpNode = dom.create('a', {'data-mce-bogus': 'all'}, INVISIBLE_CHAR); + node.parentNode.insertBefore(tmpNode, node); + + // Set selection and remove tmpNode + rng.setStart(node, 0); + selection.setRng(rng); + dom.remove(tmpNode); + + return; + } + } + } + } + }; +}); + +// Included from: js/tinymce/classes/UndoManager.js + +/** + * UndoManager.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles the undo/redo history levels for the editor. Since the build in undo/redo has major drawbacks a custom one was needed. + * + * @class tinymce.UndoManager + */ +define("tinymce/UndoManager", [ + "tinymce/util/VK", + "tinymce/Env", + "tinymce/util/Tools", + "tinymce/html/SaxParser" +], function(VK, Env, Tools, SaxParser) { + var trim = Tools.trim, trimContentRegExp; + + trimContentRegExp = new RegExp([ + ']+data-mce-bogus[^>]+>[\u200B\uFEFF]+<\\/span>', // Trim bogus spans like caret containers + '\\s?data-mce-selected="[^"]+"' // Trim temporaty data-mce prefixed attributes like data-mce-selected + ].join('|'), 'gi'); + + return function(editor) { + var self = this, index = 0, data = [], beforeBookmark, isFirstTypedCharacter, locks = 0; + + /** + * Returns a trimmed version of the editor contents to be used for the undo level. This + * will remove any data-mce-bogus="all" marked elements since these are used for UI it will also + * remove the data-mce-selected attributes used for selection of objects and caret containers. + * It will keep all data-mce-bogus="1" elements since these can be used to place the caret etc and will + * be removed by the serialization logic when you save. + * + * @private + * @return {String} HTML contents of the editor excluding some internal bogus elements. + */ + function getContent() { + var content = editor.getContent({format: 'raw', no_events: 1}); + var bogusAllRegExp = /<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g; + var endTagIndex, index, matchLength, matches, shortEndedElements, schema = editor.schema; + + content = content.replace(trimContentRegExp, ''); + shortEndedElements = schema.getShortEndedElements(); + + // Remove all bogus elements marked with "all" + while ((matches = bogusAllRegExp.exec(content))) { + index = bogusAllRegExp.lastIndex; + matchLength = matches[0].length; + + if (shortEndedElements[matches[1]]) { + endTagIndex = index; + } else { + endTagIndex = SaxParser.findEndTag(schema, content, index); + } + + content = content.substring(0, index - matchLength) + content.substring(endTagIndex); + bogusAllRegExp.lastIndex = index - matchLength; + } + + return trim(content); + } + + function setDirty(state) { + editor.isNotDirty = !state; + } + + function addNonTypingUndoLevel(e) { + self.typing = false; + self.add({}, e); + } + + // Add initial undo level when the editor is initialized + editor.on('init', function() { + self.add(); + }); + + // Get position before an execCommand is processed + editor.on('BeforeExecCommand', function(e) { + var cmd = e.command; + + if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint') { + self.beforeChange(); + } + }); + + // Add undo level after an execCommand call was made + editor.on('ExecCommand', function(e) { + var cmd = e.command; + + if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint') { + addNonTypingUndoLevel(e); + } + }); + + editor.on('ObjectResizeStart', function() { + self.beforeChange(); + }); + + editor.on('SaveContent ObjectResized blur', addNonTypingUndoLevel); + editor.on('DragEnd', addNonTypingUndoLevel); + + editor.on('KeyUp', function(e) { + var keyCode = e.keyCode; + + if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 45 || keyCode == 13 || e.ctrlKey) { + addNonTypingUndoLevel(); + editor.nodeChanged(); + } + + if (keyCode == 46 || keyCode == 8 || (Env.mac && (keyCode == 91 || keyCode == 93))) { + editor.nodeChanged(); + } + + // Fire a TypingUndo event on the first character entered + if (isFirstTypedCharacter && self.typing) { + // Make it dirty if the content was changed after typing the first character + if (!editor.isDirty()) { + setDirty(data[0] && getContent() != data[0].content); + + // Fire initial change event + if (!editor.isNotDirty) { + editor.fire('change', {level: data[0], lastLevel: null}); + } + } + + editor.fire('TypingUndo'); + isFirstTypedCharacter = false; + editor.nodeChanged(); + } + }); + + editor.on('KeyDown', function(e) { + var keyCode = e.keyCode; + + // Is caracter positon keys left,right,up,down,home,end,pgdown,pgup,enter + if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 45) { + if (self.typing) { + addNonTypingUndoLevel(e); + } + + return; + } + + // If key isn't Ctrl+Alt/AltGr + var modKey = (e.ctrlKey && !e.altKey) || e.metaKey; + if ((keyCode < 16 || keyCode > 20) && keyCode != 224 && keyCode != 91 && !self.typing && !modKey) { + self.beforeChange(); + self.typing = true; + self.add({}, e); + isFirstTypedCharacter = true; + } + }); + + editor.on('MouseDown', function(e) { + if (self.typing) { + addNonTypingUndoLevel(e); + } + }); + + // Add keyboard shortcuts for undo/redo keys + editor.addShortcut('meta+z', '', 'Undo'); + editor.addShortcut('meta+y,meta+shift+z', '', 'Redo'); + + editor.on('AddUndo Undo Redo ClearUndos', function(e) { + if (!e.isDefaultPrevented()) { + editor.nodeChanged(); + } + }); + + /*eslint consistent-this:0 */ + self = { + // Explose for debugging reasons + data: data, + + /** + * State if the user is currently typing or not. This will add a typing operation into one undo + * level instead of one new level for each keystroke. + * + * @field {Boolean} typing + */ + typing: false, + + /** + * Stores away a bookmark to be used when performing an undo action so that the selection is before + * the change has been made. + * + * @method beforeChange + */ + beforeChange: function() { + if (!locks) { + beforeBookmark = editor.selection.getBookmark(2, true); + } + }, + + /** + * Adds a new undo level/snapshot to the undo list. + * + * @method add + * @param {Object} level Optional undo level object to add. + * @param {DOMEvent} Event Optional event responsible for the creation of the undo level. + * @return {Object} Undo level that got added or null it a level wasn't needed. + */ + add: function(level, event) { + var i, settings = editor.settings, lastLevel; + + level = level || {}; + level.content = getContent(); + + if (locks || editor.removed) { + return null; + } + + lastLevel = data[index]; + if (editor.fire('BeforeAddUndo', {level: level, lastLevel: lastLevel, originalEvent: event}).isDefaultPrevented()) { + return null; + } + + // Add undo level if needed + if (lastLevel && lastLevel.content == level.content) { + return null; + } + + // Set before bookmark on previous level + if (data[index]) { + data[index].beforeBookmark = beforeBookmark; + } + + // Time to compress + if (settings.custom_undo_redo_levels) { + if (data.length > settings.custom_undo_redo_levels) { + for (i = 0; i < data.length - 1; i++) { + data[i] = data[i + 1]; + } + + data.length--; + index = data.length; + } + } + + // Get a non intrusive normalized bookmark + level.bookmark = editor.selection.getBookmark(2, true); + + // Crop array if needed + if (index < data.length - 1) { + data.length = index + 1; + } + + data.push(level); + index = data.length - 1; + + var args = {level: level, lastLevel: lastLevel, originalEvent: event}; + + editor.fire('AddUndo', args); + + if (index > 0) { + setDirty(true); + editor.fire('change', args); + } + + return level; + }, + + /** + * Undoes the last action. + * + * @method undo + * @return {Object} Undo level or null if no undo was performed. + */ + undo: function() { + var level; + + if (self.typing) { + self.add(); + self.typing = false; + } + + if (index > 0) { + level = data[--index]; + + // Undo to first index then set dirty state to false + if (index === 0) { + setDirty(false); + } + + editor.setContent(level.content, {format: 'raw'}); + editor.selection.moveToBookmark(level.beforeBookmark); + + editor.fire('undo', {level: level}); + } + + return level; + }, + + /** + * Redoes the last action. + * + * @method redo + * @return {Object} Redo level or null if no redo was performed. + */ + redo: function() { + var level; + + if (index < data.length - 1) { + level = data[++index]; + + editor.setContent(level.content, {format: 'raw'}); + editor.selection.moveToBookmark(level.bookmark); + setDirty(true); + + editor.fire('redo', {level: level}); + } + + return level; + }, + + /** + * Removes all undo levels. + * + * @method clear + */ + clear: function() { + data = []; + index = 0; + self.typing = false; + editor.fire('ClearUndos'); + }, + + /** + * Returns true/false if the undo manager has any undo levels. + * + * @method hasUndo + * @return {Boolean} true/false if the undo manager has any undo levels. + */ + hasUndo: function() { + // Has undo levels or typing and content isn't the same as the initial level + return index > 0 || (self.typing && data[0] && getContent() != data[0].content); + }, + + /** + * Returns true/false if the undo manager has any redo levels. + * + * @method hasRedo + * @return {Boolean} true/false if the undo manager has any redo levels. + */ + hasRedo: function() { + return index < data.length - 1 && !this.typing; + }, + + /** + * Executes the specified function in an undo transation. The selection + * before the modification will be stored to the undo stack and if the DOM changes + * it will add a new undo level. Any methods within the transation that adds undo levels will + * be ignored. So a transation can include calls to execCommand or editor.insertContent. + * + * @method transact + * @param {function} callback Function to execute dom manipulation logic in. + */ + transact: function(callback) { + self.beforeChange(); + + try { + locks++; + callback(); + } finally { + locks--; + } + + self.add(); + } + }; + + return self; + }; +}); + +// Included from: js/tinymce/classes/EnterKey.js + +/** + * EnterKey.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Contains logic for handling the enter key to split/generate block elements. + */ +define("tinymce/EnterKey", [ + "tinymce/dom/TreeWalker", + "tinymce/dom/RangeUtils", + "tinymce/Env" +], function(TreeWalker, RangeUtils, Env) { + var isIE = Env.ie && Env.ie < 11; + + return function(editor) { + var dom = editor.dom, selection = editor.selection, settings = editor.settings; + var undoManager = editor.undoManager, schema = editor.schema, nonEmptyElementsMap = schema.getNonEmptyElements(), + moveCaretBeforeOnEnterElementsMap = schema.getMoveCaretBeforeOnEnterElements(); + + function handleEnterKey(evt) { + var rng, tmpRng, editableRoot, container, offset, parentBlock, documentMode, shiftKey, + newBlock, fragment, containerBlock, parentBlockName, containerBlockName, newBlockName, isAfterLastNodeInContainer; + + // Returns true if the block can be split into two blocks or not + function canSplitBlock(node) { + return node && + dom.isBlock(node) && + !/^(TD|TH|CAPTION|FORM)$/.test(node.nodeName) && + !/^(fixed|absolute)/i.test(node.style.position) && + dom.getContentEditable(node) !== "true"; + } + + // Renders empty block on IE + function renderBlockOnIE(block) { + var oldRng; + + if (dom.isBlock(block)) { + oldRng = selection.getRng(); + block.appendChild(dom.create('span', null, '\u00a0')); + selection.select(block); + block.lastChild.outerHTML = ''; + selection.setRng(oldRng); + } + } + + // Remove the first empty inline element of the block so this:

    x

    becomes this:

    x

    + function trimInlineElementsOnLeftSideOfBlock(block) { + var node = block, firstChilds = [], i; + + if (!node) { + return; + } + + // Find inner most first child ex:

    *

    + while ((node = node.firstChild)) { + if (dom.isBlock(node)) { + return; + } + + if (node.nodeType == 1 && !nonEmptyElementsMap[node.nodeName.toLowerCase()]) { + firstChilds.push(node); + } + } + + i = firstChilds.length; + while (i--) { + node = firstChilds[i]; + if (!node.hasChildNodes() || (node.firstChild == node.lastChild && node.firstChild.nodeValue === '')) { + dom.remove(node); + } else { + // Remove
    see #5381 + if (node.nodeName == "A" && (node.innerText || node.textContent) === ' ') { + dom.remove(node); + } + } + } + } + + // Moves the caret to a suitable position within the root for example in the first non + // pure whitespace text node or before an image + function moveToCaretPosition(root) { + var walker, node, rng, lastNode = root, tempElm; + function firstNonWhiteSpaceNodeSibling(node) { + while (node) { + if (node.nodeType == 1 || (node.nodeType == 3 && node.data && /[\r\n\s]/.test(node.data))) { + return node; + } + + node = node.nextSibling; + } + } + + if (!root) { + return; + } + + // Old IE versions doesn't properly render blocks with br elements in them + // For example


    wont be rendered correctly in a contentEditable area + // until you remove the br producing

    + if (Env.ie && Env.ie < 9 && parentBlock && parentBlock.firstChild) { + if (parentBlock.firstChild == parentBlock.lastChild && parentBlock.firstChild.tagName == 'BR') { + dom.remove(parentBlock.firstChild); + } + } + + if (/^(LI|DT|DD)$/.test(root.nodeName)) { + var firstChild = firstNonWhiteSpaceNodeSibling(root.firstChild); + + if (firstChild && /^(UL|OL|DL)$/.test(firstChild.nodeName)) { + root.insertBefore(dom.doc.createTextNode('\u00a0'), root.firstChild); + } + } + + rng = dom.createRng(); + + // Normalize whitespace to remove empty text nodes. Fix for: #6904 + // Gecko will be able to place the caret in empty text nodes but it won't render propery + // Older IE versions will sometimes crash so for now ignore all IE versions + if (!Env.ie) { + root.normalize(); + } + + if (root.hasChildNodes()) { + walker = new TreeWalker(root, root); + + while ((node = walker.current())) { + if (node.nodeType == 3) { + rng.setStart(node, 0); + rng.setEnd(node, 0); + break; + } + + if (moveCaretBeforeOnEnterElementsMap[node.nodeName.toLowerCase()]) { + rng.setStartBefore(node); + rng.setEndBefore(node); + break; + } + + lastNode = node; + node = walker.next(); + } + + if (!node) { + rng.setStart(lastNode, 0); + rng.setEnd(lastNode, 0); + } + } else { + if (root.nodeName == 'BR') { + if (root.nextSibling && dom.isBlock(root.nextSibling)) { + // Trick on older IE versions to render the caret before the BR between two lists + if (!documentMode || documentMode < 9) { + tempElm = dom.create('br'); + root.parentNode.insertBefore(tempElm, root); + } + + rng.setStartBefore(root); + rng.setEndBefore(root); + } else { + rng.setStartAfter(root); + rng.setEndAfter(root); + } + } else { + rng.setStart(root, 0); + rng.setEnd(root, 0); + } + } + + selection.setRng(rng); + + // Remove tempElm created for old IE:s + dom.remove(tempElm); + selection.scrollIntoView(root); + } + + function setForcedBlockAttrs(node) { + var forcedRootBlockName = settings.forced_root_block; + + if (forcedRootBlockName && forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) { + dom.setAttribs(node, settings.forced_root_block_attrs); + } + } + + // Creates a new block element by cloning the current one or creating a new one if the name is specified + // This function will also copy any text formatting from the parent block and add it to the new one + function createNewBlock(name) { + var node = container, block, clonedNode, caretNode, textInlineElements = schema.getTextInlineElements(); + + if (name || parentBlockName == "TABLE") { + block = dom.create(name || newBlockName); + setForcedBlockAttrs(block); + } else { + block = parentBlock.cloneNode(false); + } + + caretNode = block; + + // Clone any parent styles + if (settings.keep_styles !== false) { + do { + if (textInlineElements[node.nodeName]) { + // Never clone a caret containers + if (node.id == '_mce_caret') { + continue; + } + + clonedNode = node.cloneNode(false); + dom.setAttrib(clonedNode, 'id', ''); // Remove ID since it needs to be document unique + + if (block.hasChildNodes()) { + clonedNode.appendChild(block.firstChild); + block.appendChild(clonedNode); + } else { + caretNode = clonedNode; + block.appendChild(clonedNode); + } + } + } while ((node = node.parentNode)); + } + + // BR is needed in empty blocks on non IE browsers + if (!isIE) { + caretNode.innerHTML = '
    '; + } + + return block; + } + + // Returns true/false if the caret is at the start/end of the parent block element + function isCaretAtStartOrEndOfBlock(start) { + var walker, node, name; + + // Caret is in the middle of a text node like "a|b" + if (container.nodeType == 3 && (start ? offset > 0 : offset < container.nodeValue.length)) { + return false; + } + + // If after the last element in block node edge case for #5091 + if (container.parentNode == parentBlock && isAfterLastNodeInContainer && !start) { + return true; + } + + // If the caret if before the first element in parentBlock + if (start && container.nodeType == 1 && container == parentBlock.firstChild) { + return true; + } + + // Caret can be before/after a table + if (container.nodeName === "TABLE" || (container.previousSibling && container.previousSibling.nodeName == "TABLE")) { + return (isAfterLastNodeInContainer && !start) || (!isAfterLastNodeInContainer && start); + } + + // Walk the DOM and look for text nodes or non empty elements + walker = new TreeWalker(container, parentBlock); + + // If caret is in beginning or end of a text block then jump to the next/previous node + if (container.nodeType == 3) { + if (start && offset === 0) { + walker.prev(); + } else if (!start && offset == container.nodeValue.length) { + walker.next(); + } + } + + while ((node = walker.current())) { + if (node.nodeType === 1) { + // Ignore bogus elements + if (!node.getAttribute('data-mce-bogus')) { + // Keep empty elements like but not trailing br:s like

    text|

    + name = node.nodeName.toLowerCase(); + if (nonEmptyElementsMap[name] && name !== 'br') { + return false; + } + } + } else if (node.nodeType === 3 && !/^[ \t\r\n]*$/.test(node.nodeValue)) { + return false; + } + + if (start) { + walker.prev(); + } else { + walker.next(); + } + } + + return true; + } + + // Wraps any text nodes or inline elements in the specified forced root block name + function wrapSelfAndSiblingsInDefaultBlock(container, offset) { + var newBlock, parentBlock, startNode, node, next, rootBlockName, blockName = newBlockName || 'P'; + + // Not in a block element or in a table cell or caption + parentBlock = dom.getParent(container, dom.isBlock); + rootBlockName = editor.getBody().nodeName.toLowerCase(); + if (!parentBlock || !canSplitBlock(parentBlock)) { + parentBlock = parentBlock || editableRoot; + + if (!parentBlock.hasChildNodes()) { + newBlock = dom.create(blockName); + setForcedBlockAttrs(newBlock); + parentBlock.appendChild(newBlock); + rng.setStart(newBlock, 0); + rng.setEnd(newBlock, 0); + return newBlock; + } + + // Find parent that is the first child of parentBlock + node = container; + while (node.parentNode != parentBlock) { + node = node.parentNode; + } + + // Loop left to find start node start wrapping at + while (node && !dom.isBlock(node)) { + startNode = node; + node = node.previousSibling; + } + + if (startNode && schema.isValidChild(rootBlockName, blockName.toLowerCase())) { + newBlock = dom.create(blockName); + setForcedBlockAttrs(newBlock); + startNode.parentNode.insertBefore(newBlock, startNode); + + // Start wrapping until we hit a block + node = startNode; + while (node && !dom.isBlock(node)) { + next = node.nextSibling; + newBlock.appendChild(node); + node = next; + } + + // Restore range to it's past location + rng.setStart(container, offset); + rng.setEnd(container, offset); + } + } + + return container; + } + + // Inserts a block or br before/after or in the middle of a split list of the LI is empty + function handleEmptyListItem() { + function isFirstOrLastLi(first) { + var node = containerBlock[first ? 'firstChild' : 'lastChild']; + + // Find first/last element since there might be whitespace there + while (node) { + if (node.nodeType == 1) { + break; + } + + node = node[first ? 'nextSibling' : 'previousSibling']; + } + + return node === parentBlock; + } + + function getContainerBlock() { + var containerBlockParent = containerBlock.parentNode; + + if (/^(LI|DT|DD)$/.test(containerBlockParent.nodeName)) { + return containerBlockParent; + } + + return containerBlock; + } + + // Check if we are in an nested list + var containerBlockParentName = containerBlock.parentNode.nodeName; + if (/^(OL|UL|LI)$/.test(containerBlockParentName)) { + newBlockName = 'LI'; + } + + newBlock = newBlockName ? createNewBlock(newBlockName) : dom.create('BR'); + + if (isFirstOrLastLi(true) && isFirstOrLastLi()) { + if (containerBlockParentName == 'LI') { + // Nested list is inside a LI + dom.insertAfter(newBlock, getContainerBlock()); + } else { + // Is first and last list item then replace the OL/UL with a text block + dom.replace(newBlock, containerBlock); + } + } else if (isFirstOrLastLi(true)) { + if (containerBlockParentName == 'LI') { + // List nested in an LI then move the list to a new sibling LI + dom.insertAfter(newBlock, getContainerBlock()); + newBlock.appendChild(dom.doc.createTextNode(' ')); // Needed for IE so the caret can be placed + newBlock.appendChild(containerBlock); + } else { + // First LI in list then remove LI and add text block before list + containerBlock.parentNode.insertBefore(newBlock, containerBlock); + } + } else if (isFirstOrLastLi()) { + // Last LI in list then remove LI and add text block after list + dom.insertAfter(newBlock, getContainerBlock()); + renderBlockOnIE(newBlock); + } else { + // Middle LI in list the split the list and insert a text block in the middle + // Extract after fragment and insert it after the current block + containerBlock = getContainerBlock(); + tmpRng = rng.cloneRange(); + tmpRng.setStartAfter(parentBlock); + tmpRng.setEndAfter(containerBlock); + fragment = tmpRng.extractContents(); + + if (newBlockName == 'LI' && fragment.firstChild.nodeName == 'LI') { + newBlock = fragment.firstChild; + dom.insertAfter(fragment, containerBlock); + } else { + dom.insertAfter(fragment, containerBlock); + dom.insertAfter(newBlock, containerBlock); + } + } + + dom.remove(parentBlock); + moveToCaretPosition(newBlock); + undoManager.add(); + } + + // Inserts a BR element if the forced_root_block option is set to false or empty string + function insertBr() { + editor.execCommand("InsertLineBreak", false, evt); + } + + // Trims any linebreaks at the beginning of node user for example when pressing enter in a PRE element + function trimLeadingLineBreaks(node) { + do { + if (node.nodeType === 3) { + node.nodeValue = node.nodeValue.replace(/^[\r\n]+/, ''); + } + + node = node.firstChild; + } while (node); + } + + function getEditableRoot(node) { + var root = dom.getRoot(), parent, editableRoot; + + // Get all parents until we hit a non editable parent or the root + parent = node; + while (parent !== root && dom.getContentEditable(parent) !== "false") { + if (dom.getContentEditable(parent) === "true") { + editableRoot = parent; + } + + parent = parent.parentNode; + } + + return parent !== root ? editableRoot : root; + } + + // Adds a BR at the end of blocks that only contains an IMG or INPUT since + // these might be floated and then they won't expand the block + function addBrToBlockIfNeeded(block) { + var lastChild; + + // IE will render the blocks correctly other browsers needs a BR + if (!isIE) { + block.normalize(); // Remove empty text nodes that got left behind by the extract + + // Check if the block is empty or contains a floated last child + lastChild = block.lastChild; + if (!lastChild || (/^(left|right)$/gi.test(dom.getStyle(lastChild, 'float', true)))) { + dom.add(block, 'br'); + } + } + } + + rng = selection.getRng(true); + + // Event is blocked by some other handler for example the lists plugin + if (evt.isDefaultPrevented()) { + return; + } + + // Delete any selected contents + if (!rng.collapsed) { + editor.execCommand('Delete'); + return; + } + + // Setup range items and newBlockName + new RangeUtils(dom).normalize(rng); + container = rng.startContainer; + offset = rng.startOffset; + newBlockName = (settings.force_p_newlines ? 'p' : '') || settings.forced_root_block; + newBlockName = newBlockName ? newBlockName.toUpperCase() : ''; + documentMode = dom.doc.documentMode; + shiftKey = evt.shiftKey; + + // Resolve node index + if (container.nodeType == 1 && container.hasChildNodes()) { + isAfterLastNodeInContainer = offset > container.childNodes.length - 1; + + container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container; + if (isAfterLastNodeInContainer && container.nodeType == 3) { + offset = container.nodeValue.length; + } else { + offset = 0; + } + } + + // Get editable root node normaly the body element but sometimes a div or span + editableRoot = getEditableRoot(container); + + // If there is no editable root then enter is done inside a contentEditable false element + if (!editableRoot) { + return; + } + + undoManager.beforeChange(); + + // If editable root isn't block nor the root of the editor + if (!dom.isBlock(editableRoot) && editableRoot != dom.getRoot()) { + if (!newBlockName || shiftKey) { + insertBr(); + } + + return; + } + + // Wrap the current node and it's sibling in a default block if it's needed. + // for example this
  • will become this + // This won't happen if root blocks are disabled or the shiftKey is pressed + if ((newBlockName && !shiftKey) || (!newBlockName && shiftKey)) { + container = wrapSelfAndSiblingsInDefaultBlock(container, offset); + } + + // Find parent block and setup empty block paddings + parentBlock = dom.getParent(container, dom.isBlock); + containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null; + + // Setup block names + parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5 + containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5 + + // Enter inside block contained within a LI then split or insert before/after LI + if (containerBlockName == 'LI' && !evt.ctrlKey) { + parentBlock = containerBlock; + parentBlockName = containerBlockName; + } + + // Handle enter in list item + if (/^(LI|DT|DD)$/.test(parentBlockName)) { + if (!newBlockName && shiftKey) { + insertBr(); + return; + } + + // Handle enter inside an empty list item + if (dom.isEmpty(parentBlock)) { + handleEmptyListItem(); + return; + } + } + + // Don't split PRE tags but insert a BR instead easier when writing code samples etc + if (parentBlockName == 'PRE' && settings.br_in_pre !== false) { + if (!shiftKey) { + insertBr(); + return; + } + } else { + // If no root block is configured then insert a BR by default or if the shiftKey is pressed + if ((!newBlockName && !shiftKey && parentBlockName != 'LI') || (newBlockName && shiftKey)) { + insertBr(); + return; + } + } + + // If parent block is root then never insert new blocks + if (newBlockName && parentBlock === editor.getBody()) { + return; + } + + // Default block name if it's not configured + newBlockName = newBlockName || 'P'; + + // Insert new block before/after the parent block depending on caret location + if (isCaretAtStartOrEndOfBlock()) { + // If the caret is at the end of a header we produce a P tag after it similar to Word unless we are in a hgroup + if (/^(H[1-6]|PRE|FIGURE)$/.test(parentBlockName) && containerBlockName != 'HGROUP') { + newBlock = createNewBlock(newBlockName); + } else { + newBlock = createNewBlock(); + } + + // Split the current container block element if enter is pressed inside an empty inner block element + if (settings.end_container_on_empty_block && canSplitBlock(containerBlock) && dom.isEmpty(parentBlock)) { + // Split container block for example a BLOCKQUOTE at the current blockParent location for example a P + newBlock = dom.split(containerBlock, parentBlock); + } else { + dom.insertAfter(newBlock, parentBlock); + } + + moveToCaretPosition(newBlock); + } else if (isCaretAtStartOrEndOfBlock(true)) { + // Insert new block before + newBlock = parentBlock.parentNode.insertBefore(createNewBlock(), parentBlock); + renderBlockOnIE(newBlock); + moveToCaretPosition(parentBlock); + } else { + // Extract after fragment and insert it after the current block + tmpRng = rng.cloneRange(); + tmpRng.setEndAfter(parentBlock); + fragment = tmpRng.extractContents(); + trimLeadingLineBreaks(fragment); + newBlock = fragment.firstChild; + dom.insertAfter(fragment, parentBlock); + trimInlineElementsOnLeftSideOfBlock(newBlock); + addBrToBlockIfNeeded(parentBlock); + moveToCaretPosition(newBlock); + } + + dom.setAttrib(newBlock, 'id', ''); // Remove ID since it needs to be document unique + + // Allow custom handling of new blocks + editor.fire('NewBlock', {newBlock: newBlock}); + + undoManager.add(); + } + + editor.on('keydown', function(evt) { + if (evt.keyCode == 13) { + if (handleEnterKey(evt) !== false) { + evt.preventDefault(); + } + } + }); + }; +}); + +// Included from: js/tinymce/classes/ForceBlocks.js + +/** + * ForceBlocks.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +define("tinymce/ForceBlocks", [], function() { + return function(editor) { + var settings = editor.settings, dom = editor.dom, selection = editor.selection; + var schema = editor.schema, blockElements = schema.getBlockElements(); + + function addRootBlocks() { + var node = selection.getStart(), rootNode = editor.getBody(), rng; + var startContainer, startOffset, endContainer, endOffset, rootBlockNode; + var tempNode, offset = -0xFFFFFF, wrapped, restoreSelection; + var tmpRng, rootNodeName, forcedRootBlock; + + forcedRootBlock = settings.forced_root_block; + + if (!node || node.nodeType !== 1 || !forcedRootBlock) { + return; + } + + // Check if node is wrapped in block + while (node && node != rootNode) { + if (blockElements[node.nodeName]) { + return; + } + + node = node.parentNode; + } + + // Get current selection + rng = selection.getRng(); + if (rng.setStart) { + startContainer = rng.startContainer; + startOffset = rng.startOffset; + endContainer = rng.endContainer; + endOffset = rng.endOffset; + + try { + restoreSelection = editor.getDoc().activeElement === rootNode; + } catch (ex) { + // IE throws unspecified error here sometimes + } + } else { + // Force control range into text range + if (rng.item) { + node = rng.item(0); + rng = editor.getDoc().body.createTextRange(); + rng.moveToElementText(node); + } + + restoreSelection = rng.parentElement().ownerDocument === editor.getDoc(); + tmpRng = rng.duplicate(); + tmpRng.collapse(true); + startOffset = tmpRng.move('character', offset) * -1; + + if (!tmpRng.collapsed) { + tmpRng = rng.duplicate(); + tmpRng.collapse(false); + endOffset = (tmpRng.move('character', offset) * -1) - startOffset; + } + } + + // Wrap non block elements and text nodes + node = rootNode.firstChild; + rootNodeName = rootNode.nodeName.toLowerCase(); + while (node) { + // TODO: Break this up, too complex + if (((node.nodeType === 3 || (node.nodeType == 1 && !blockElements[node.nodeName]))) && + schema.isValidChild(rootNodeName, forcedRootBlock.toLowerCase())) { + // Remove empty text nodes + if (node.nodeType === 3 && node.nodeValue.length === 0) { + tempNode = node; + node = node.nextSibling; + dom.remove(tempNode); + continue; + } + + if (!rootBlockNode) { + rootBlockNode = dom.create(forcedRootBlock, editor.settings.forced_root_block_attrs); + node.parentNode.insertBefore(rootBlockNode, node); + wrapped = true; + } + + tempNode = node; + node = node.nextSibling; + rootBlockNode.appendChild(tempNode); + } else { + rootBlockNode = null; + node = node.nextSibling; + } + } + + if (wrapped && restoreSelection) { + if (rng.setStart) { + rng.setStart(startContainer, startOffset); + rng.setEnd(endContainer, endOffset); + selection.setRng(rng); + } else { + // Only select if the previous selection was inside the document to prevent auto focus in quirks mode + try { + rng = editor.getDoc().body.createTextRange(); + rng.moveToElementText(rootNode); + rng.collapse(true); + rng.moveStart('character', startOffset); + + if (endOffset > 0) { + rng.moveEnd('character', endOffset); + } + + rng.select(); + } catch (ex) { + // Ignore + } + } + + editor.nodeChanged(); + } + } + + // Force root blocks + if (settings.forced_root_block) { + editor.on('NodeChange', addRootBlocks); + } + }; +}); + +// Included from: js/tinymce/classes/EditorCommands.js + +/** + * EditorCommands.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class enables you to add custom editor commands and it contains + * overrides for native browser commands to address various bugs and issues. + * + * @class tinymce.EditorCommands + */ +define("tinymce/EditorCommands", [ + "tinymce/html/Serializer", + "tinymce/Env", + "tinymce/util/Tools", + "tinymce/dom/ElementUtils", + "tinymce/dom/RangeUtils", + "tinymce/dom/TreeWalker" +], function(Serializer, Env, Tools, ElementUtils, RangeUtils, TreeWalker) { + // Added for compression purposes + var each = Tools.each, extend = Tools.extend; + var map = Tools.map, inArray = Tools.inArray, explode = Tools.explode; + var isGecko = Env.gecko, isIE = Env.ie, isOldIE = Env.ie && Env.ie < 11; + var TRUE = true, FALSE = false; + + return function(editor) { + var dom, selection, formatter, + commands = {state: {}, exec: {}, value: {}}, + settings = editor.settings, + bookmark; + + editor.on('PreInit', function() { + dom = editor.dom; + selection = editor.selection; + settings = editor.settings; + formatter = editor.formatter; + }); + + /** + * Executes the specified command. + * + * @method execCommand + * @param {String} command Command to execute. + * @param {Boolean} ui Optional user interface state. + * @param {Object} value Optional value for command. + * @return {Boolean} true/false if the command was found or not. + */ + function execCommand(command, ui, value, args) { + var func, customCommand, state = 0; + + if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(command) && (!args || !args.skip_focus)) { + editor.focus(); + } + + args = extend({}, args); + args = editor.fire('BeforeExecCommand', {command: command, ui: ui, value: value}); + if (args.isDefaultPrevented()) { + return false; + } + + customCommand = command.toLowerCase(); + if ((func = commands.exec[customCommand])) { + func(customCommand, ui, value); + editor.fire('ExecCommand', {command: command, ui: ui, value: value}); + return true; + } + + // Plugin commands + each(editor.plugins, function(p) { + if (p.execCommand && p.execCommand(command, ui, value)) { + editor.fire('ExecCommand', {command: command, ui: ui, value: value}); + state = true; + return false; + } + }); + + if (state) { + return state; + } + + // Theme commands + if (editor.theme && editor.theme.execCommand && editor.theme.execCommand(command, ui, value)) { + editor.fire('ExecCommand', {command: command, ui: ui, value: value}); + return true; + } + + // Browser commands + try { + state = editor.getDoc().execCommand(command, ui, value); + } catch (ex) { + // Ignore old IE errors + } + + if (state) { + editor.fire('ExecCommand', {command: command, ui: ui, value: value}); + return true; + } + + return false; + } + + /** + * Queries the current state for a command for example if the current selection is "bold". + * + * @method queryCommandState + * @param {String} command Command to check the state of. + * @return {Boolean/Number} true/false if the selected contents is bold or not, -1 if it's not found. + */ + function queryCommandState(command) { + var func; + + // Is hidden then return undefined + if (editor._isHidden()) { + return; + } + + command = command.toLowerCase(); + if ((func = commands.state[command])) { + return func(command); + } + + // Browser commands + try { + return editor.getDoc().queryCommandState(command); + } catch (ex) { + // Fails sometimes see bug: 1896577 + } + + return false; + } + + /** + * Queries the command value for example the current fontsize. + * + * @method queryCommandValue + * @param {String} command Command to check the value of. + * @return {Object} Command value of false if it's not found. + */ + function queryCommandValue(command) { + var func; + + // Is hidden then return undefined + if (editor._isHidden()) { + return; + } + + command = command.toLowerCase(); + if ((func = commands.value[command])) { + return func(command); + } + + // Browser commands + try { + return editor.getDoc().queryCommandValue(command); + } catch (ex) { + // Fails sometimes see bug: 1896577 + } + } + + /** + * Adds commands to the command collection. + * + * @method addCommands + * @param {Object} command_list Name/value collection with commands to add, the names can also be comma separated. + * @param {String} type Optional type to add, defaults to exec. Can be value or state as well. + */ + function addCommands(command_list, type) { + type = type || 'exec'; + + each(command_list, function(callback, command) { + each(command.toLowerCase().split(','), function(command) { + commands[type][command] = callback; + }); + }); + } + + function addCommand(command, callback, scope) { + command = command.toLowerCase(); + commands.exec[command] = function(command, ui, value, args) { + return callback.call(scope || editor, ui, value, args); + }; + } + + /** + * Returns true/false if the command is supported or not. + * + * @method queryCommandSupported + * @param {String} cmd Command that we check support for. + * @return {Boolean} true/false if the command is supported or not. + */ + function queryCommandSupported(command) { + command = command.toLowerCase(); + + if (commands.exec[command]) { + return true; + } + + // Browser commands + try { + return editor.getDoc().queryCommandSupported(command); + } catch (ex) { + // Fails sometimes see bug: 1896577 + } + + return false; + } + + function addQueryStateHandler(command, callback, scope) { + command = command.toLowerCase(); + commands.state[command] = function() { + return callback.call(scope || editor); + }; + } + + function addQueryValueHandler(command, callback, scope) { + command = command.toLowerCase(); + commands.value[command] = function() { + return callback.call(scope || editor); + }; + } + + function hasCustomCommand(command) { + command = command.toLowerCase(); + return !!commands.exec[command]; + } + + // Expose public methods + extend(this, { + execCommand: execCommand, + queryCommandState: queryCommandState, + queryCommandValue: queryCommandValue, + queryCommandSupported: queryCommandSupported, + addCommands: addCommands, + addCommand: addCommand, + addQueryStateHandler: addQueryStateHandler, + addQueryValueHandler: addQueryValueHandler, + hasCustomCommand: hasCustomCommand + }); + + // Private methods + + function execNativeCommand(command, ui, value) { + if (ui === undefined) { + ui = FALSE; + } + + if (value === undefined) { + value = null; + } + + return editor.getDoc().execCommand(command, ui, value); + } + + function isFormatMatch(name) { + return formatter.match(name); + } + + function toggleFormat(name, value) { + formatter.toggle(name, value ? {value: value} : undefined); + editor.nodeChanged(); + } + + function storeSelection(type) { + bookmark = selection.getBookmark(type); + } + + function restoreSelection() { + selection.moveToBookmark(bookmark); + } + + // Add execCommand overrides + addCommands({ + // Ignore these, added for compatibility + 'mceResetDesignMode,mceBeginUndoLevel': function() {}, + + // Add undo manager logic + 'mceEndUndoLevel,mceAddUndoLevel': function() { + editor.undoManager.add(); + }, + + 'Cut,Copy,Paste': function(command) { + var doc = editor.getDoc(), failed; + + // Try executing the native command + try { + execNativeCommand(command); + } catch (ex) { + // Command failed + failed = TRUE; + } + + // Present alert message about clipboard access not being available + if (failed || !doc.queryCommandSupported(command)) { + var msg = editor.translate( + "Your browser doesn't support direct access to the clipboard. " + + "Please use the Ctrl+X/C/V keyboard shortcuts instead." + ); + + if (Env.mac) { + msg = msg.replace(/Ctrl\+/g, '\u2318+'); + } + + editor.windowManager.alert(msg); + } + }, + + // Override unlink command + unlink: function() { + if (selection.isCollapsed()) { + var elm = selection.getNode(); + if (elm.tagName == 'A') { + editor.dom.remove(elm, true); + } + + return; + } + + formatter.remove("link"); + }, + + // Override justify commands to use the text formatter engine + 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull': function(command) { + var align = command.substring(7); + + if (align == 'full') { + align = 'justify'; + } + + // Remove all other alignments first + each('left,center,right,justify'.split(','), function(name) { + if (align != name) { + formatter.remove('align' + name); + } + }); + + toggleFormat('align' + align); + execCommand('mceRepaint'); + }, + + // Override list commands to fix WebKit bug + 'InsertUnorderedList,InsertOrderedList': function(command) { + var listElm, listParent; + + execNativeCommand(command); + + // WebKit produces lists within block elements so we need to split them + // we will replace the native list creation logic to custom logic later on + // TODO: Remove this when the list creation logic is removed + listElm = dom.getParent(selection.getNode(), 'ol,ul'); + if (listElm) { + listParent = listElm.parentNode; + + // If list is within a text block then split that block + if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) { + storeSelection(); + dom.split(listParent, listElm); + restoreSelection(); + } + } + }, + + // Override commands to use the text formatter engine + 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function(command) { + toggleFormat(command); + }, + + // Override commands to use the text formatter engine + 'ForeColor,HiliteColor,FontName': function(command, ui, value) { + toggleFormat(command, value); + }, + + FontSize: function(command, ui, value) { + var fontClasses, fontSizes; + + // Convert font size 1-7 to styles + if (value >= 1 && value <= 7) { + fontSizes = explode(settings.font_size_style_values); + fontClasses = explode(settings.font_size_classes); + + if (fontClasses) { + value = fontClasses[value - 1] || value; + } else { + value = fontSizes[value - 1] || value; + } + } + + toggleFormat(command, value); + }, + + RemoveFormat: function(command) { + formatter.remove(command); + }, + + mceBlockQuote: function() { + toggleFormat('blockquote'); + }, + + FormatBlock: function(command, ui, value) { + return toggleFormat(value || 'p'); + }, + + mceCleanup: function() { + var bookmark = selection.getBookmark(); + + editor.setContent(editor.getContent({cleanup: TRUE}), {cleanup: TRUE}); + + selection.moveToBookmark(bookmark); + }, + + mceRemoveNode: function(command, ui, value) { + var node = value || selection.getNode(); + + // Make sure that the body node isn't removed + if (node != editor.getBody()) { + storeSelection(); + editor.dom.remove(node, TRUE); + restoreSelection(); + } + }, + + mceSelectNodeDepth: function(command, ui, value) { + var counter = 0; + + dom.getParent(selection.getNode(), function(node) { + if (node.nodeType == 1 && counter++ == value) { + selection.select(node); + return FALSE; + } + }, editor.getBody()); + }, + + mceSelectNode: function(command, ui, value) { + selection.select(value); + }, + + mceInsertContent: function(command, ui, value) { + var parser, serializer, parentNode, rootNode, fragment, args; + var marker, rng, node, node2, bookmarkHtml, merge; + var textInlineElements = editor.schema.getTextInlineElements(); + + function trimOrPaddLeftRight(html) { + var rng, container, offset; + + rng = selection.getRng(true); + container = rng.startContainer; + offset = rng.startOffset; + + function hasSiblingText(siblingName) { + return container[siblingName] && container[siblingName].nodeType == 3; + } + + if (container.nodeType == 3) { + if (offset > 0) { + html = html.replace(/^ /, ' '); + } else if (!hasSiblingText('previousSibling')) { + html = html.replace(/^ /, ' '); + } + + if (offset < container.length) { + html = html.replace(/ (
    |)$/, ' '); + } else if (!hasSiblingText('nextSibling')) { + html = html.replace(/( | )(
    |)$/, ' '); + } + } + + return html; + } + + // Removes   from a [b] c -> a  c -> a c + function trimNbspAfterDeleteAndPaddValue() { + var rng, container, offset; + + rng = selection.getRng(true); + container = rng.startContainer; + offset = rng.startOffset; + + if (container.nodeType == 3 && rng.collapsed) { + if (container.data[offset] === '\u00a0') { + container.deleteData(offset, 1); + + if (!/[\u00a0| ]$/.test(value)) { + value += ' '; + } + } else if (container.data[offset - 1] === '\u00a0') { + container.deleteData(offset - 1, 1); + + if (!/[\u00a0| ]$/.test(value)) { + value = ' ' + value; + } + } + } + } + + function markInlineFormatElements(fragment) { + if (merge) { + for (node = fragment.firstChild; node; node = node.walk(true)) { + if (textInlineElements[node.name]) { + node.attr('data-mce-new', "true"); + } + } + } + } + + function reduceInlineTextElements() { + if (merge) { + var root = editor.getBody(), elementUtils = new ElementUtils(dom); + + each(dom.select('*[data-mce-new]'), function(node) { + node.removeAttribute('data-mce-new'); + + for (var testNode = node.parentNode; testNode && testNode != root; testNode = testNode.parentNode) { + if (elementUtils.compare(testNode, node)) { + dom.remove(node, true); + } + } + }); + } + } + + if (typeof value != 'string') { + merge = value.merge; + value = value.content; + } + + // Check for whitespace before/after value + if (/^ | $/.test(value)) { + value = trimOrPaddLeftRight(value); + } + + // Setup parser and serializer + parser = editor.parser; + serializer = new Serializer({}, editor.schema); + bookmarkHtml = '​'; + + // Run beforeSetContent handlers on the HTML to be inserted + args = {content: value, format: 'html', selection: true}; + editor.fire('BeforeSetContent', args); + value = args.content; + + // Add caret at end of contents if it's missing + if (value.indexOf('{$caret}') == -1) { + value += '{$caret}'; + } + + // Replace the caret marker with a span bookmark element + value = value.replace(/\{\$caret\}/, bookmarkHtml); + + // If selection is at |

    then move it into

    |

    + rng = selection.getRng(); + var caretElement = rng.startContainer || (rng.parentElement ? rng.parentElement() : null); + var body = editor.getBody(); + if (caretElement === body && selection.isCollapsed()) { + if (dom.isBlock(body.firstChild) && dom.isEmpty(body.firstChild)) { + rng = dom.createRng(); + rng.setStart(body.firstChild, 0); + rng.setEnd(body.firstChild, 0); + selection.setRng(rng); + } + } + + // Insert node maker where we will insert the new HTML and get it's parent + if (!selection.isCollapsed()) { + editor.getDoc().execCommand('Delete', false, null); + trimNbspAfterDeleteAndPaddValue(); + } + + parentNode = selection.getNode(); + + // Parse the fragment within the context of the parent node + var parserArgs = {context: parentNode.nodeName.toLowerCase()}; + fragment = parser.parse(value, parserArgs); + + markInlineFormatElements(fragment); + + // Move the caret to a more suitable location + node = fragment.lastChild; + if (node.attr('id') == 'mce_marker') { + marker = node; + + for (node = node.prev; node; node = node.walk(true)) { + if (node.type == 3 || !dom.isBlock(node.name)) { + if (editor.schema.isValidChild(node.parent.name, 'span')) { + node.parent.insert(marker, node, node.name === 'br'); + } + break; + } + } + } + + // If parser says valid we can insert the contents into that parent + if (!parserArgs.invalid) { + value = serializer.serialize(fragment); + + // Check if parent is empty or only has one BR element then set the innerHTML of that parent + node = parentNode.firstChild; + node2 = parentNode.lastChild; + if (!node || (node === node2 && node.nodeName === 'BR')) { + dom.setHTML(parentNode, value); + } else { + selection.setContent(value); + } + } else { + // If the fragment was invalid within that context then we need + // to parse and process the parent it's inserted into + + // Insert bookmark node and get the parent + selection.setContent(bookmarkHtml); + parentNode = selection.getNode(); + rootNode = editor.getBody(); + + // Opera will return the document node when selection is in root + if (parentNode.nodeType == 9) { + parentNode = node = rootNode; + } else { + node = parentNode; + } + + // Find the ancestor just before the root element + while (node !== rootNode) { + parentNode = node; + node = node.parentNode; + } + + // Get the outer/inner HTML depending on if we are in the root and parser and serialize that + value = parentNode == rootNode ? rootNode.innerHTML : dom.getOuterHTML(parentNode); + value = serializer.serialize( + parser.parse( + // Need to replace by using a function since $ in the contents would otherwise be a problem + value.replace(//i, function() { + return serializer.serialize(fragment); + }) + ) + ); + + // Set the inner/outer HTML depending on if we are in the root or not + if (parentNode == rootNode) { + dom.setHTML(rootNode, value); + } else { + dom.setOuterHTML(parentNode, value); + } + } + + reduceInlineTextElements(); + + marker = dom.get('mce_marker'); + selection.scrollIntoView(marker); + + // Move selection before marker and remove it + rng = dom.createRng(); + + // If previous sibling is a text node set the selection to the end of that node + node = marker.previousSibling; + if (node && node.nodeType == 3) { + rng.setStart(node, node.nodeValue.length); + + // TODO: Why can't we normalize on IE + if (!isIE) { + node2 = marker.nextSibling; + if (node2 && node2.nodeType == 3) { + node.appendData(node2.data); + node2.parentNode.removeChild(node2); + } + } + } else { + // If the previous sibling isn't a text node or doesn't exist set the selection before the marker node + rng.setStartBefore(marker); + rng.setEndBefore(marker); + } + + // Remove the marker node and set the new range + dom.remove(marker); + selection.setRng(rng); + + // Dispatch after event and add any visual elements needed + editor.fire('SetContent', args); + editor.addVisual(); + }, + + mceInsertRawHTML: function(command, ui, value) { + selection.setContent('tiny_mce_marker'); + editor.setContent( + editor.getContent().replace(/tiny_mce_marker/g, function() { + return value; + }) + ); + }, + + mceToggleFormat: function(command, ui, value) { + toggleFormat(value); + }, + + mceSetContent: function(command, ui, value) { + editor.setContent(value); + }, + + 'Indent,Outdent': function(command) { + var intentValue, indentUnit, value; + + // Setup indent level + intentValue = settings.indentation; + indentUnit = /[a-z%]+$/i.exec(intentValue); + intentValue = parseInt(intentValue, 10); + + if (!queryCommandState('InsertUnorderedList') && !queryCommandState('InsertOrderedList')) { + // If forced_root_blocks is set to false we don't have a block to indent so lets create a div + if (!settings.forced_root_block && !dom.getParent(selection.getNode(), dom.isBlock)) { + formatter.apply('div'); + } + + each(selection.getSelectedBlocks(), function(element) { + if (element.nodeName != "LI") { + var indentStyleName = editor.getParam('indent_use_margin', false) ? 'margin' : 'padding'; + + indentStyleName += dom.getStyle(element, 'direction', true) == 'rtl' ? 'Right' : 'Left'; + + if (command == 'outdent') { + value = Math.max(0, parseInt(element.style[indentStyleName] || 0, 10) - intentValue); + dom.setStyle(element, indentStyleName, value ? value + indentUnit : ''); + } else { + value = (parseInt(element.style[indentStyleName] || 0, 10) + intentValue) + indentUnit; + dom.setStyle(element, indentStyleName, value); + } + } + }); + } else { + execNativeCommand(command); + } + }, + + mceRepaint: function() { + if (isGecko) { + try { + storeSelection(TRUE); + + if (selection.getSel()) { + selection.getSel().selectAllChildren(editor.getBody()); + } + + selection.collapse(TRUE); + restoreSelection(); + } catch (ex) { + // Ignore + } + } + }, + + InsertHorizontalRule: function() { + editor.execCommand('mceInsertContent', false, '
    '); + }, + + mceToggleVisualAid: function() { + editor.hasVisual = !editor.hasVisual; + editor.addVisual(); + }, + + mceReplaceContent: function(command, ui, value) { + editor.execCommand('mceInsertContent', false, value.replace(/\{\$selection\}/g, selection.getContent({format: 'text'}))); + }, + + mceInsertLink: function(command, ui, value) { + var anchor; + + if (typeof value == 'string') { + value = {href: value}; + } + + anchor = dom.getParent(selection.getNode(), 'a'); + + // Spaces are never valid in URLs and it's a very common mistake for people to make so we fix it here. + value.href = value.href.replace(' ', '%20'); + + // Remove existing links if there could be child links or that the href isn't specified + if (!anchor || !value.href) { + formatter.remove('link'); + } + + // Apply new link to selection + if (value.href) { + formatter.apply('link', value, anchor); + } + }, + + selectAll: function() { + var root = dom.getRoot(), rng; + + if (selection.getRng().setStart) { + rng = dom.createRng(); + rng.setStart(root, 0); + rng.setEnd(root, root.childNodes.length); + selection.setRng(rng); + } else { + // IE will render it's own root level block elements and sometimes + // even put font elements in them when the user starts typing. So we need to + // move the selection to a more suitable element from this: + // |

    to this:

    |

    + rng = selection.getRng(); + if (!rng.item) { + rng.moveToElementText(root); + rng.select(); + } + } + }, + + "delete": function() { + execNativeCommand("Delete"); + + // Check if body is empty after the delete call if so then set the contents + // to an empty string and move the caret to any block produced by that operation + // this fixes the issue with root blocks not being properly produced after a delete call on IE + var body = editor.getBody(); + + if (dom.isEmpty(body)) { + editor.setContent(''); + + if (body.firstChild && dom.isBlock(body.firstChild)) { + editor.selection.setCursorLocation(body.firstChild, 0); + } else { + editor.selection.setCursorLocation(body, 0); + } + } + }, + + mceNewDocument: function() { + editor.setContent(''); + }, + + InsertLineBreak: function(command, ui, value) { + // We load the current event in from EnterKey.js when appropriate to heed + // certain event-specific variations such as ctrl-enter in a list + var evt = value; + var brElm, extraBr, marker; + var rng = selection.getRng(true); + new RangeUtils(dom).normalize(rng); + + var offset = rng.startOffset; + var container = rng.startContainer; + + // Resolve node index + if (container.nodeType == 1 && container.hasChildNodes()) { + var isAfterLastNodeInContainer = offset > container.childNodes.length - 1; + + container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container; + if (isAfterLastNodeInContainer && container.nodeType == 3) { + offset = container.nodeValue.length; + } else { + offset = 0; + } + } + + var parentBlock = dom.getParent(container, dom.isBlock); + var parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5 + var containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null; + var containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5 + + // Enter inside block contained within a LI then split or insert before/after LI + var isControlKey = evt && evt.ctrlKey; + if (containerBlockName == 'LI' && !isControlKey) { + parentBlock = containerBlock; + parentBlockName = containerBlockName; + } + + // Walks the parent block to the right and look for BR elements + function hasRightSideContent() { + var walker = new TreeWalker(container, parentBlock), node; + var nonEmptyElementsMap = editor.schema.getNonEmptyElements(); + + while ((node = walker.next())) { + if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) { + return true; + } + } + } + + if (container && container.nodeType == 3 && offset >= container.nodeValue.length) { + // Insert extra BR element at the end block elements + if (!isOldIE && !hasRightSideContent()) { + brElm = dom.create('br'); + rng.insertNode(brElm); + rng.setStartAfter(brElm); + rng.setEndAfter(brElm); + extraBr = true; + } + } + + brElm = dom.create('br'); + rng.insertNode(brElm); + + // Rendering modes below IE8 doesn't display BR elements in PRE unless we have a \n before it + var documentMode = dom.doc.documentMode; + if (isOldIE && parentBlockName == 'PRE' && (!documentMode || documentMode < 8)) { + brElm.parentNode.insertBefore(dom.doc.createTextNode('\r'), brElm); + } + + // Insert temp marker and scroll to that + marker = dom.create('span', {}, ' '); + brElm.parentNode.insertBefore(marker, brElm); + selection.scrollIntoView(marker); + dom.remove(marker); + + if (!extraBr) { + rng.setStartAfter(brElm); + rng.setEndAfter(brElm); + } else { + rng.setStartBefore(brElm); + rng.setEndBefore(brElm); + } + + selection.setRng(rng); + editor.undoManager.add(); + + return TRUE; + } + }); + + // Add queryCommandState overrides + addCommands({ + // Override justify commands + 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull': function(command) { + var name = 'align' + command.substring(7); + var nodes = selection.isCollapsed() ? [dom.getParent(selection.getNode(), dom.isBlock)] : selection.getSelectedBlocks(); + var matches = map(nodes, function(node) { + return !!formatter.matchNode(node, name); + }); + return inArray(matches, TRUE) !== -1; + }, + + 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function(command) { + return isFormatMatch(command); + }, + + mceBlockQuote: function() { + return isFormatMatch('blockquote'); + }, + + Outdent: function() { + var node; + + if (settings.inline_styles) { + if ((node = dom.getParent(selection.getStart(), dom.isBlock)) && parseInt(node.style.paddingLeft, 10) > 0) { + return TRUE; + } + + if ((node = dom.getParent(selection.getEnd(), dom.isBlock)) && parseInt(node.style.paddingLeft, 10) > 0) { + return TRUE; + } + } + + return ( + queryCommandState('InsertUnorderedList') || + queryCommandState('InsertOrderedList') || + (!settings.inline_styles && !!dom.getParent(selection.getNode(), 'BLOCKQUOTE')) + ); + }, + + 'InsertUnorderedList,InsertOrderedList': function(command) { + var list = dom.getParent(selection.getNode(), 'ul,ol'); + + return list && + ( + command === 'insertunorderedlist' && list.tagName === 'UL' || + command === 'insertorderedlist' && list.tagName === 'OL' + ); + } + }, 'state'); + + // Add queryCommandValue overrides + addCommands({ + 'FontSize,FontName': function(command) { + var value = 0, parent; + + if ((parent = dom.getParent(selection.getNode(), 'span'))) { + if (command == 'fontsize') { + value = parent.style.fontSize; + } else { + value = parent.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase(); + } + } + + return value; + } + }, 'value'); + + // Add undo manager logic + addCommands({ + Undo: function() { + editor.undoManager.undo(); + }, + + Redo: function() { + editor.undoManager.redo(); + } + }); + }; +}); + +// Included from: js/tinymce/classes/util/URI.js + +/** + * URI.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles parsing, modification and serialization of URI/URL strings. + * @class tinymce.util.URI + */ +define("tinymce/util/URI", [ + "tinymce/util/Tools" +], function(Tools) { + var each = Tools.each, trim = Tools.trim; + var queryParts = "source protocol authority userInfo user password host port relative path directory file query anchor".split(' '); + var DEFAULT_PORTS = { + 'ftp': 21, + 'http': 80, + 'https': 443, + 'mailto': 25 + }; + + /** + * Constructs a new URI instance. + * + * @constructor + * @method URI + * @param {String} url URI string to parse. + * @param {Object} settings Optional settings object. + */ + function URI(url, settings) { + var self = this, baseUri, base_url; + + url = trim(url); + settings = self.settings = settings || {}; + baseUri = settings.base_uri; + + // Strange app protocol that isn't http/https or local anchor + // For example: mailto,skype,tel etc. + if (/^([\w\-]+):([^\/]{2})/i.test(url) || /^\s*#/.test(url)) { + self.source = url; + return; + } + + var isProtocolRelative = url.indexOf('//') === 0; + + // Absolute path with no host, fake host and protocol + if (url.indexOf('/') === 0 && !isProtocolRelative) { + url = (baseUri ? baseUri.protocol || 'http' : 'http') + '://mce_host' + url; + } + + // Relative path http:// or protocol relative //path + if (!/^[\w\-]*:?\/\//.test(url)) { + base_url = settings.base_uri ? settings.base_uri.path : new URI(location.href).directory; + if (settings.base_uri.protocol === "") { + url = '//mce_host' + self.toAbsPath(base_url, url); + } else { + url = /([^#?]*)([#?]?.*)/.exec(url); + url = ((baseUri && baseUri.protocol) || 'http') + '://mce_host' + self.toAbsPath(base_url, url[1]) + url[2]; + } + } + + // Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri) + url = url.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something + + /*jshint maxlen: 255 */ + /*eslint max-len: 0 */ + url = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(url); + + each(queryParts, function(v, i) { + var part = url[i]; + + // Zope 3 workaround, they use @@something + if (part) { + part = part.replace(/\(mce_at\)/g, '@@'); + } + + self[v] = part; + }); + + if (baseUri) { + if (!self.protocol) { + self.protocol = baseUri.protocol; + } + + if (!self.userInfo) { + self.userInfo = baseUri.userInfo; + } + + if (!self.port && self.host === 'mce_host') { + self.port = baseUri.port; + } + + if (!self.host || self.host === 'mce_host') { + self.host = baseUri.host; + } + + self.source = ''; + } + + if (isProtocolRelative) { + self.protocol = ''; + } + + //t.path = t.path || '/'; + } + + URI.prototype = { + /** + * Sets the internal path part of the URI. + * + * @method setPath + * @param {string} path Path string to set. + */ + setPath: function(path) { + var self = this; + + path = /^(.*?)\/?(\w+)?$/.exec(path); + + // Update path parts + self.path = path[0]; + self.directory = path[1]; + self.file = path[2]; + + // Rebuild source + self.source = ''; + self.getURI(); + }, + + /** + * Converts the specified URI into a relative URI based on the current URI instance location. + * + * @method toRelative + * @param {String} uri URI to convert into a relative path/URI. + * @return {String} Relative URI from the point specified in the current URI instance. + * @example + * // Converts an absolute URL to an relative URL url will be somedir/somefile.htm + * var url = new tinymce.util.URI('http://www.site.com/dir/').toRelative('http://www.site.com/dir/somedir/somefile.htm'); + */ + toRelative: function(uri) { + var self = this, output; + + if (uri === "./") { + return uri; + } + + uri = new URI(uri, {base_uri: self}); + + // Not on same domain/port or protocol + if ((uri.host != 'mce_host' && self.host != uri.host && uri.host) || self.port != uri.port || + (self.protocol != uri.protocol && uri.protocol !== "")) { + return uri.getURI(); + } + + var tu = self.getURI(), uu = uri.getURI(); + + // Allow usage of the base_uri when relative_urls = true + if (tu == uu || (tu.charAt(tu.length - 1) == "/" && tu.substr(0, tu.length - 1) == uu)) { + return tu; + } + + output = self.toRelPath(self.path, uri.path); + + // Add query + if (uri.query) { + output += '?' + uri.query; + } + + // Add anchor + if (uri.anchor) { + output += '#' + uri.anchor; + } + + return output; + }, + + /** + * Converts the specified URI into a absolute URI based on the current URI instance location. + * + * @method toAbsolute + * @param {String} uri URI to convert into a relative path/URI. + * @param {Boolean} noHost No host and protocol prefix. + * @return {String} Absolute URI from the point specified in the current URI instance. + * @example + * // Converts an relative URL to an absolute URL url will be http://www.site.com/dir/somedir/somefile.htm + * var url = new tinymce.util.URI('http://www.site.com/dir/').toAbsolute('somedir/somefile.htm'); + */ + toAbsolute: function(uri, noHost) { + uri = new URI(uri, {base_uri: this}); + + return uri.getURI(noHost && this.isSameOrigin(uri)); + }, + + /** + * Determine whether the given URI has the same origin as this URI. Based on RFC-6454. + * Supports default ports for protocols listed in DEFAULT_PORTS. Unsupported protocols will fail safe: they + * won't match, if the port specifications differ. + * + * @method isSameOrigin + * @param {tinymce.util.URI} uri Uri instance to compare. + * @returns {Boolean} True if the origins are the same. + */ + isSameOrigin: function(uri) { + if (this.host == uri.host && this.protocol == uri.protocol) { + if (this.port == uri.port) { + return true; + } + + var defaultPort = DEFAULT_PORTS[this.protocol]; + if (defaultPort && ((this.port || defaultPort) == (uri.port || defaultPort))) { + return true; + } + } + + return false; + }, + + /** + * Converts a absolute path into a relative path. + * + * @method toRelPath + * @param {String} base Base point to convert the path from. + * @param {String} path Absolute path to convert into a relative path. + */ + toRelPath: function(base, path) { + var items, breakPoint = 0, out = '', i, l; + + // Split the paths + base = base.substring(0, base.lastIndexOf('/')); + base = base.split('/'); + items = path.split('/'); + + if (base.length >= items.length) { + for (i = 0, l = base.length; i < l; i++) { + if (i >= items.length || base[i] != items[i]) { + breakPoint = i + 1; + break; + } + } + } + + if (base.length < items.length) { + for (i = 0, l = items.length; i < l; i++) { + if (i >= base.length || base[i] != items[i]) { + breakPoint = i + 1; + break; + } + } + } + + if (breakPoint === 1) { + return path; + } + + for (i = 0, l = base.length - (breakPoint - 1); i < l; i++) { + out += "../"; + } + + for (i = breakPoint - 1, l = items.length; i < l; i++) { + if (i != breakPoint - 1) { + out += "/" + items[i]; + } else { + out += items[i]; + } + } + + return out; + }, + + /** + * Converts a relative path into a absolute path. + * + * @method toAbsPath + * @param {String} base Base point to convert the path from. + * @param {String} path Relative path to convert into an absolute path. + */ + toAbsPath: function(base, path) { + var i, nb = 0, o = [], tr, outPath; + + // Split paths + tr = /\/$/.test(path) ? '/' : ''; + base = base.split('/'); + path = path.split('/'); + + // Remove empty chunks + each(base, function(k) { + if (k) { + o.push(k); + } + }); + + base = o; + + // Merge relURLParts chunks + for (i = path.length - 1, o = []; i >= 0; i--) { + // Ignore empty or . + if (path[i].length === 0 || path[i] === ".") { + continue; + } + + // Is parent + if (path[i] === '..') { + nb++; + continue; + } + + // Move up + if (nb > 0) { + nb--; + continue; + } + + o.push(path[i]); + } + + i = base.length - nb; + + // If /a/b/c or / + if (i <= 0) { + outPath = o.reverse().join('/'); + } else { + outPath = base.slice(0, i).join('/') + '/' + o.reverse().join('/'); + } + + // Add front / if it's needed + if (outPath.indexOf('/') !== 0) { + outPath = '/' + outPath; + } + + // Add traling / if it's needed + if (tr && outPath.lastIndexOf('/') !== outPath.length - 1) { + outPath += tr; + } + + return outPath; + }, + + /** + * Returns the full URI of the internal structure. + * + * @method getURI + * @param {Boolean} noProtoHost Optional no host and protocol part. Defaults to false. + */ + getURI: function(noProtoHost) { + var s, self = this; + + // Rebuild source + if (!self.source || noProtoHost) { + s = ''; + + if (!noProtoHost) { + if (self.protocol) { + s += self.protocol + '://'; + } else { + s += '//'; + } + + if (self.userInfo) { + s += self.userInfo + '@'; + } + + if (self.host) { + s += self.host; + } + + if (self.port) { + s += ':' + self.port; + } + } + + if (self.path) { + s += self.path; + } + + if (self.query) { + s += '?' + self.query; + } + + if (self.anchor) { + s += '#' + self.anchor; + } + + self.source = s; + } + + return self.source; + } + }; + + return URI; +}); + +// Included from: js/tinymce/classes/util/Class.js + +/** + * Class.js + * + * Copyright 2003-2012, Moxiecode Systems AB, All rights reserved. + */ + +/** + * This utilitiy class is used for easier inheritage. + * + * Features: + * * Exposed super functions: this._super(); + * * Mixins + * * Dummy functions + * * Property functions: var value = object.value(); and object.value(newValue); + * * Static functions + * * Defaults settings + */ +define("tinymce/util/Class", [ + "tinymce/util/Tools" +], function(Tools) { + var each = Tools.each, extend = Tools.extend; + + var extendClass, initializing; + + function Class() { + } + + // Provides classical inheritance, based on code made by John Resig + Class.extend = extendClass = function(prop) { + var self = this, _super = self.prototype, prototype, name, member; + + // The dummy class constructor + function Class() { + var i, mixins, mixin, self = this; + + // All construction is actually done in the init method + if (!initializing) { + // Run class constuctor + if (self.init) { + self.init.apply(self, arguments); + } + + // Run mixin constructors + mixins = self.Mixins; + if (mixins) { + i = mixins.length; + while (i--) { + mixin = mixins[i]; + if (mixin.init) { + mixin.init.apply(self, arguments); + } + } + } + } + } + + // Dummy function, needs to be extended in order to provide functionality + function dummy() { + return this; + } + + // Creates a overloaded method for the class + // this enables you to use this._super(); to call the super function + function createMethod(name, fn) { + return function() { + var self = this, tmp = self._super, ret; + + self._super = _super[name]; + ret = fn.apply(self, arguments); + self._super = tmp; + + return ret; + }; + } + + // Instantiate a base class (but only create the instance, + // don't run the init constructor) + initializing = true; + + /*eslint new-cap:0 */ + prototype = new self(); + initializing = false; + + // Add mixins + if (prop.Mixins) { + each(prop.Mixins, function(mixin) { + mixin = mixin; + + for (var name in mixin) { + if (name !== "init") { + prop[name] = mixin[name]; + } + } + }); + + if (_super.Mixins) { + prop.Mixins = _super.Mixins.concat(prop.Mixins); + } + } + + // Generate dummy methods + if (prop.Methods) { + each(prop.Methods.split(','), function(name) { + prop[name] = dummy; + }); + } + + // Generate property methods + if (prop.Properties) { + each(prop.Properties.split(','), function(name) { + var fieldName = '_' + name; + + prop[name] = function(value) { + var self = this, undef; + + // Set value + if (value !== undef) { + self[fieldName] = value; + + return self; + } + + // Get value + return self[fieldName]; + }; + }); + } + + // Static functions + if (prop.Statics) { + each(prop.Statics, function(func, name) { + Class[name] = func; + }); + } + + // Default settings + if (prop.Defaults && _super.Defaults) { + prop.Defaults = extend({}, _super.Defaults, prop.Defaults); + } + + // Copy the properties over onto the new prototype + for (name in prop) { + member = prop[name]; + + if (typeof member == "function" && _super[name]) { + prototype[name] = createMethod(name, member); + } else { + prototype[name] = member; + } + } + + // Populate our constructed prototype object + Class.prototype = prototype; + + // Enforce the constructor to be what we expect + Class.constructor = Class; + + // And make this class extendible + Class.extend = extendClass; + + return Class; + }; + + return Class; +}); + +// Included from: js/tinymce/classes/util/EventDispatcher.js + +/** + * EventDispatcher.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class lets you add/remove and fire events by name on the specified scope. This makes + * it easy to add event listener logic to any class. + * + * @class tinymce.util.EventDispatcher + * @example + * var eventDispatcher = new EventDispatcher(); + * + * eventDispatcher.on('click', function() {console.log('data');}); + * eventDispatcher.fire('click', {data: 123}); + */ +define("tinymce/util/EventDispatcher", [ + "tinymce/util/Tools" +], function(Tools) { + var nativeEvents = Tools.makeMap( + "focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange " + + "mouseout mouseenter mouseleave wheel keydown keypress keyup input contextmenu dragstart dragend dragover " + + "draggesture dragdrop drop drag submit " + + "compositionstart compositionend compositionupdate touchstart touchend", + ' ' + ); + + function Dispatcher(settings) { + var self = this, scope, bindings = {}, toggleEvent; + + function returnFalse() { + return false; + } + + function returnTrue() { + return true; + } + + settings = settings || {}; + scope = settings.scope || self; + toggleEvent = settings.toggleEvent || returnFalse; + + /** + * Fires the specified event by name. + * + * @method fire + * @param {String} name Name of the event to fire. + * @param {Object?} args Event arguments. + * @return {Object} Event args instance passed in. + * @example + * instance.fire('event', {...}); + */ + function fire(name, args) { + var handlers, i, l, callback; + + name = name.toLowerCase(); + args = args || {}; + args.type = name; + + // Setup target is there isn't one + if (!args.target) { + args.target = scope; + } + + // Add event delegation methods if they are missing + if (!args.preventDefault) { + // Add preventDefault method + args.preventDefault = function() { + args.isDefaultPrevented = returnTrue; + }; + + // Add stopPropagation + args.stopPropagation = function() { + args.isPropagationStopped = returnTrue; + }; + + // Add stopImmediatePropagation + args.stopImmediatePropagation = function() { + args.isImmediatePropagationStopped = returnTrue; + }; + + // Add event delegation states + args.isDefaultPrevented = returnFalse; + args.isPropagationStopped = returnFalse; + args.isImmediatePropagationStopped = returnFalse; + } + + if (settings.beforeFire) { + settings.beforeFire(args); + } + + handlers = bindings[name]; + if (handlers) { + for (i = 0, l = handlers.length; i < l; i++) { + callback = handlers[i]; + + // Unbind handlers marked with "once" + if (callback.once) { + off(name, callback.func); + } + + // Stop immediate propagation if needed + if (args.isImmediatePropagationStopped()) { + args.stopPropagation(); + return args; + } + + // If callback returns false then prevent default and stop all propagation + if (callback.func.call(scope, args) === false) { + args.preventDefault(); + return args; + } + } + } + + return args; + } + + /** + * Binds an event listener to a specific event by name. + * + * @method on + * @param {String} name Event name or space separated list of events to bind. + * @param {callback} callback Callback to be executed when the event occurs. + * @param {Boolean} first Optional flag if the event should be prepended. Use this with care. + * @return {Object} Current class instance. + * @example + * instance.on('event', function(e) { + * // Callback logic + * }); + */ + function on(name, callback, prepend, extra) { + var handlers, names, i; + + if (callback === false) { + callback = returnFalse; + } + + if (callback) { + callback = { + func: callback + }; + + if (extra) { + Tools.extend(callback, extra); + } + + names = name.toLowerCase().split(' '); + i = names.length; + while (i--) { + name = names[i]; + handlers = bindings[name]; + if (!handlers) { + handlers = bindings[name] = []; + toggleEvent(name, true); + } + + if (prepend) { + handlers.unshift(callback); + } else { + handlers.push(callback); + } + } + } + + return self; + } + + /** + * Unbinds an event listener to a specific event by name. + * + * @method off + * @param {String?} name Name of the event to unbind. + * @param {callback?} callback Callback to unbind. + * @return {Object} Current class instance. + * @example + * // Unbind specific callback + * instance.off('event', handler); + * + * // Unbind all listeners by name + * instance.off('event'); + * + * // Unbind all events + * instance.off(); + */ + function off(name, callback) { + var i, handlers, bindingName, names, hi; + + if (name) { + names = name.toLowerCase().split(' '); + i = names.length; + while (i--) { + name = names[i]; + handlers = bindings[name]; + + // Unbind all handlers + if (!name) { + for (bindingName in bindings) { + toggleEvent(bindingName, false); + delete bindings[bindingName]; + } + + return self; + } + + if (handlers) { + // Unbind all by name + if (!callback) { + handlers.length = 0; + } else { + // Unbind specific ones + hi = handlers.length; + while (hi--) { + if (handlers[hi].func === callback) { + handlers = handlers.slice(0, hi).concat(handlers.slice(hi + 1)); + bindings[name] = handlers; + } + } + } + + if (!handlers.length) { + toggleEvent(name, false); + delete bindings[name]; + } + } + } + } else { + for (name in bindings) { + toggleEvent(name, false); + } + + bindings = {}; + } + + return self; + } + + /** + * Binds an event listener to a specific event by name + * and automatically unbind the event once the callback fires. + * + * @method once + * @param {String} name Event name or space separated list of events to bind. + * @param {callback} callback Callback to be executed when the event occurs. + * @param {Boolean} first Optional flag if the event should be prepended. Use this with care. + * @return {Object} Current class instance. + * @example + * instance.once('event', function(e) { + * // Callback logic + * }); + */ + function once(name, callback, prepend) { + return on(name, callback, prepend, {once: true}); + } + + /** + * Returns true/false if the dispatcher has a event of the specified name. + * + * @method has + * @param {String} name Name of the event to check for. + * @return {Boolean} true/false if the event exists or not. + */ + function has(name) { + name = name.toLowerCase(); + return !(!bindings[name] || bindings[name].length === 0); + } + + // Expose + self.fire = fire; + self.on = on; + self.off = off; + self.once = once; + self.has = has; + } + + /** + * Returns true/false if the specified event name is a native browser event or not. + * + * @method isNative + * @param {String} name Name to check if it's native. + * @return {Boolean} true/false if the event is native or not. + * @static + */ + Dispatcher.isNative = function(name) { + return !!nativeEvents[name.toLowerCase()]; + }; + + return Dispatcher; +}); + +// Included from: js/tinymce/classes/ui/Selector.js + +/** + * Selector.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*eslint no-nested-ternary:0 */ + +/** + * Selector engine, enables you to select controls by using CSS like expressions. + * We currently only support basic CSS expressions to reduce the size of the core + * and the ones we support should be enough for most cases. + * + * @example + * Supported expressions: + * element + * element#name + * element.class + * element[attr] + * element[attr*=value] + * element[attr~=value] + * element[attr!=value] + * element[attr^=value] + * element[attr$=value] + * element: + * element:not() + * element:first + * element:last + * element:odd + * element:even + * element element + * element > element + * + * @class tinymce.ui.Selector + */ +define("tinymce/ui/Selector", [ + "tinymce/util/Class" +], function(Class) { + "use strict"; + + /** + * Produces an array with a unique set of objects. It will not compare the values + * but the references of the objects. + * + * @private + * @method unqiue + * @param {Array} array Array to make into an array with unique items. + * @return {Array} Array with unique items. + */ + function unique(array) { + var uniqueItems = [], i = array.length, item; + + while (i--) { + item = array[i]; + + if (!item.__checked) { + uniqueItems.push(item); + item.__checked = 1; + } + } + + i = uniqueItems.length; + while (i--) { + delete uniqueItems[i].__checked; + } + + return uniqueItems; + } + + var expression = /^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i; + + /*jshint maxlen:255 */ + /*eslint max-len:0 */ + var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, + whiteSpace = /^\s*|\s*$/g, + Collection; + + var Selector = Class.extend({ + /** + * Constructs a new Selector instance. + * + * @constructor + * @method init + * @param {String} selector CSS like selector expression. + */ + init: function(selector) { + var match = this.match; + + function compileNameFilter(name) { + if (name) { + name = name.toLowerCase(); + + return function(item) { + return name === '*' || item.type === name; + }; + } + } + + function compileIdFilter(id) { + if (id) { + return function(item) { + return item._name === id; + }; + } + } + + function compileClassesFilter(classes) { + if (classes) { + classes = classes.split('.'); + + return function(item) { + var i = classes.length; + + while (i--) { + if (!item.hasClass(classes[i])) { + return false; + } + } + + return true; + }; + } + } + + function compileAttrFilter(name, cmp, check) { + if (name) { + return function(item) { + var value = item[name] ? item[name]() : ''; + + return !cmp ? !!check : + cmp === "=" ? value === check : + cmp === "*=" ? value.indexOf(check) >= 0 : + cmp === "~=" ? (" " + value + " ").indexOf(" " + check + " ") >= 0 : + cmp === "!=" ? value != check : + cmp === "^=" ? value.indexOf(check) === 0 : + cmp === "$=" ? value.substr(value.length - check.length) === check : + false; + }; + } + } + + function compilePsuedoFilter(name) { + var notSelectors; + + if (name) { + name = /(?:not\((.+)\))|(.+)/i.exec(name); + + if (!name[1]) { + name = name[2]; + + return function(item, index, length) { + return name === 'first' ? index === 0 : + name === 'last' ? index === length - 1 : + name === 'even' ? index % 2 === 0 : + name === 'odd' ? index % 2 === 1 : + item[name] ? item[name]() : + false; + }; + } else { + // Compile not expression + notSelectors = parseChunks(name[1], []); + + return function(item) { + return !match(item, notSelectors); + }; + } + } + } + + function compile(selector, filters, direct) { + var parts; + + function add(filter) { + if (filter) { + filters.push(filter); + } + } + + // Parse expression into parts + parts = expression.exec(selector.replace(whiteSpace, '')); + + add(compileNameFilter(parts[1])); + add(compileIdFilter(parts[2])); + add(compileClassesFilter(parts[3])); + add(compileAttrFilter(parts[4], parts[5], parts[6])); + add(compilePsuedoFilter(parts[7])); + + // Mark the filter with psuedo for performance + filters.psuedo = !!parts[7]; + filters.direct = direct; + + return filters; + } + + // Parser logic based on Sizzle by John Resig + function parseChunks(selector, selectors) { + var parts = [], extra, matches, i; + + do { + chunker.exec(""); + matches = chunker.exec(selector); + + if (matches) { + selector = matches[3]; + parts.push(matches[1]); + + if (matches[2]) { + extra = matches[3]; + break; + } + } + } while (matches); + + if (extra) { + parseChunks(extra, selectors); + } + + selector = []; + for (i = 0; i < parts.length; i++) { + if (parts[i] != '>') { + selector.push(compile(parts[i], [], parts[i - 1] === '>')); + } + } + + selectors.push(selector); + + return selectors; + } + + this._selectors = parseChunks(selector, []); + }, + + /** + * Returns true/false if the selector matches the specified control. + * + * @method match + * @param {tinymce.ui.Control} control Control to match agains the selector. + * @param {Array} selectors Optional array of selectors, mostly used internally. + * @return {Boolean} true/false state if the control matches or not. + */ + match: function(control, selectors) { + var i, l, si, sl, selector, fi, fl, filters, index, length, siblings, count, item; + + selectors = selectors || this._selectors; + for (i = 0, l = selectors.length; i < l; i++) { + selector = selectors[i]; + sl = selector.length; + item = control; + count = 0; + + for (si = sl - 1; si >= 0; si--) { + filters = selector[si]; + + while (item) { + // Find the index and length since a psuedo filter like :first needs it + if (filters.psuedo) { + siblings = item.parent().items(); + index = length = siblings.length; + while (index--) { + if (siblings[index] === item) { + break; + } + } + } + + for (fi = 0, fl = filters.length; fi < fl; fi++) { + if (!filters[fi](item, index, length)) { + fi = fl + 1; + break; + } + } + + if (fi === fl) { + count++; + break; + } else { + // If it didn't match the right most expression then + // break since it's no point looking at the parents + if (si === sl - 1) { + break; + } + } + + item = item.parent(); + } + } + + // If we found all selectors then return true otherwise continue looking + if (count === sl) { + return true; + } + } + + return false; + }, + + /** + * Returns a tinymce.ui.Collection with matches of the specified selector inside the specified container. + * + * @method find + * @param {tinymce.ui.Control} container Container to look for items in. + * @return {tinymce.ui.Collection} Collection with matched elements. + */ + find: function(container) { + var matches = [], i, l, selectors = this._selectors; + + function collect(items, selector, index) { + var i, l, fi, fl, item, filters = selector[index]; + + for (i = 0, l = items.length; i < l; i++) { + item = items[i]; + + // Run each filter agains the item + for (fi = 0, fl = filters.length; fi < fl; fi++) { + if (!filters[fi](item, i, l)) { + fi = fl + 1; + break; + } + } + + // All filters matched the item + if (fi === fl) { + // Matched item is on the last expression like: panel toolbar [button] + if (index == selector.length - 1) { + matches.push(item); + } else { + // Collect next expression type + if (item.items) { + collect(item.items(), selector, index + 1); + } + } + } else if (filters.direct) { + return; + } + + // Collect child items + if (item.items) { + collect(item.items(), selector, index); + } + } + } + + if (container.items) { + for (i = 0, l = selectors.length; i < l; i++) { + collect(container.items(), selectors[i], 0); + } + + // Unique the matches if needed + if (l > 1) { + matches = unique(matches); + } + } + + // Fix for circular reference + if (!Collection) { + // TODO: Fix me! + Collection = Selector.Collection; + } + + return new Collection(matches); + } + }); + + return Selector; +}); + +// Included from: js/tinymce/classes/ui/Collection.js + +/** + * Collection.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Control collection, this class contains control instances and it enables you to + * perform actions on all the contained items. This is very similar to how jQuery works. + * + * @example + * someCollection.show().disabled(true); + * + * @class tinymce.ui.Collection + */ +define("tinymce/ui/Collection", [ + "tinymce/util/Tools", + "tinymce/ui/Selector", + "tinymce/util/Class" +], function(Tools, Selector, Class) { + "use strict"; + + var Collection, proto, push = Array.prototype.push, slice = Array.prototype.slice; + + proto = { + /** + * Current number of contained control instances. + * + * @field length + * @type Number + */ + length: 0, + + /** + * Constructor for the collection. + * + * @constructor + * @method init + * @param {Array} items Optional array with items to add. + */ + init: function(items) { + if (items) { + this.add(items); + } + }, + + /** + * Adds new items to the control collection. + * + * @method add + * @param {Array} items Array if items to add to collection. + * @return {tinymce.ui.Collection} Current collection instance. + */ + add: function(items) { + var self = this; + + // Force single item into array + if (!Tools.isArray(items)) { + if (items instanceof Collection) { + self.add(items.toArray()); + } else { + push.call(self, items); + } + } else { + push.apply(self, items); + } + + return self; + }, + + /** + * Sets the contents of the collection. This will remove any existing items + * and replace them with the ones specified in the input array. + * + * @method set + * @param {Array} items Array with items to set into the Collection. + * @return {tinymce.ui.Collection} Collection instance. + */ + set: function(items) { + var self = this, len = self.length, i; + + self.length = 0; + self.add(items); + + // Remove old entries + for (i = self.length; i < len; i++) { + delete self[i]; + } + + return self; + }, + + /** + * Filters the collection item based on the specified selector expression or selector function. + * + * @method filter + * @param {String} selector Selector expression to filter items by. + * @return {tinymce.ui.Collection} Collection containing the filtered items. + */ + filter: function(selector) { + var self = this, i, l, matches = [], item, match; + + // Compile string into selector expression + if (typeof selector === "string") { + selector = new Selector(selector); + + match = function(item) { + return selector.match(item); + }; + } else { + // Use selector as matching function + match = selector; + } + + for (i = 0, l = self.length; i < l; i++) { + item = self[i]; + + if (match(item)) { + matches.push(item); + } + } + + return new Collection(matches); + }, + + /** + * Slices the items within the collection. + * + * @method slice + * @param {Number} index Index to slice at. + * @param {Number} len Optional length to slice. + * @return {tinymce.ui.Collection} Current collection. + */ + slice: function() { + return new Collection(slice.apply(this, arguments)); + }, + + /** + * Makes the current collection equal to the specified index. + * + * @method eq + * @param {Number} index Index of the item to set the collection to. + * @return {tinymce.ui.Collection} Current collection. + */ + eq: function(index) { + return index === -1 ? this.slice(index) : this.slice(index, +index + 1); + }, + + /** + * Executes the specified callback on each item in collection. + * + * @method each + * @param {function} callback Callback to execute for each item in collection. + * @return {tinymce.ui.Collection} Current collection instance. + */ + each: function(callback) { + Tools.each(this, callback); + + return this; + }, + + /** + * Returns an JavaScript array object of the contents inside the collection. + * + * @method toArray + * @return {Array} Array with all items from collection. + */ + toArray: function() { + return Tools.toArray(this); + }, + + /** + * Finds the index of the specified control or return -1 if it isn't in the collection. + * + * @method indexOf + * @param {Control} ctrl Control instance to look for. + * @return {Number} Index of the specified control or -1. + */ + indexOf: function(ctrl) { + var self = this, i = self.length; + + while (i--) { + if (self[i] === ctrl) { + break; + } + } + + return i; + }, + + /** + * Returns a new collection of the contents in reverse order. + * + * @method reverse + * @return {tinymce.ui.Collection} Collection instance with reversed items. + */ + reverse: function() { + return new Collection(Tools.toArray(this).reverse()); + }, + + /** + * Returns true/false if the class exists or not. + * + * @method hasClass + * @param {String} cls Class to check for. + * @return {Boolean} true/false state if the class exists or not. + */ + hasClass: function(cls) { + return this[0] ? this[0].hasClass(cls) : false; + }, + + /** + * Sets/gets the specific property on the items in the collection. The same as executing control.(); + * + * @method prop + * @param {String} name Property name to get/set. + * @param {Object} value Optional object value to set. + * @return {tinymce.ui.Collection} Current collection instance or value of the first item on a get operation. + */ + prop: function(name, value) { + var self = this, undef, item; + + if (value !== undef) { + self.each(function(item) { + if (item[name]) { + item[name](value); + } + }); + + return self; + } + + item = self[0]; + + if (item && item[name]) { + return item[name](); + } + }, + + /** + * Executes the specific function name with optional arguments an all items in collection if it exists. + * + * @example collection.exec("myMethod", arg1, arg2, arg3); + * @method exec + * @param {String} name Name of the function to execute. + * @param {Object} ... Multiple arguments to pass to each function. + * @return {tinymce.ui.Collection} Current collection. + */ + exec: function(name) { + var self = this, args = Tools.toArray(arguments).slice(1); + + self.each(function(item) { + if (item[name]) { + item[name].apply(item, args); + } + }); + + return self; + }, + + /** + * Remove all items from collection and DOM. + * + * @method remove + * @return {tinymce.ui.Collection} Current collection. + */ + remove: function() { + var i = this.length; + + while (i--) { + this[i].remove(); + } + + return this; + } + + /** + * Fires the specified event by name and arguments on the control. This will execute all + * bound event handlers. + * + * @method fire + * @param {String} name Name of the event to fire. + * @param {Object} args Optional arguments to pass to the event. + * @return {tinymce.ui.Collection} Current collection instance. + */ + // fire: function(event, args) {}, -- Generated by code below + + /** + * Binds a callback to the specified event. This event can both be + * native browser events like "click" or custom ones like PostRender. + * + * The callback function will have two parameters the first one being the control that received the event + * the second one will be the event object either the browsers native event object or a custom JS object. + * + * @method on + * @param {String} name Name of the event to bind. For example "click". + * @param {String/function} callback Callback function to execute ones the event occurs. + * @return {tinymce.ui.Collection} Current collection instance. + */ + // on: function(name, callback) {}, -- Generated by code below + + /** + * Unbinds the specified event and optionally a specific callback. If you omit the name + * parameter all event handlers will be removed. If you omit the callback all event handles + * by the specified name will be removed. + * + * @method off + * @param {String} name Optional name for the event to unbind. + * @param {function} callback Optional callback function to unbind. + * @return {tinymce.ui.Collection} Current collection instance. + */ + // off: function(name, callback) {}, -- Generated by code below + + /** + * Shows the items in the current collection. + * + * @method show + * @return {tinymce.ui.Collection} Current collection instance. + */ + // show: function() {}, -- Generated by code below + + /** + * Hides the items in the current collection. + * + * @method hide + * @return {tinymce.ui.Collection} Current collection instance. + */ + // hide: function() {}, -- Generated by code below + + /** + * Sets/gets the text contents of the items in the current collection. + * + * @method text + * @return {tinymce.ui.Collection} Current collection instance or text value of the first item on a get operation. + */ + // text: function(value) {}, -- Generated by code below + + /** + * Sets/gets the name contents of the items in the current collection. + * + * @method name + * @return {tinymce.ui.Collection} Current collection instance or name value of the first item on a get operation. + */ + // name: function(value) {}, -- Generated by code below + + /** + * Sets/gets the disabled state on the items in the current collection. + * + * @method disabled + * @return {tinymce.ui.Collection} Current collection instance or disabled state of the first item on a get operation. + */ + // disabled: function(state) {}, -- Generated by code below + + /** + * Sets/gets the active state on the items in the current collection. + * + * @method active + * @return {tinymce.ui.Collection} Current collection instance or active state of the first item on a get operation. + */ + // active: function(state) {}, -- Generated by code below + + /** + * Sets/gets the selected state on the items in the current collection. + * + * @method selected + * @return {tinymce.ui.Collection} Current collection instance or selected state of the first item on a get operation. + */ + // selected: function(state) {}, -- Generated by code below + + /** + * Sets/gets the selected state on the items in the current collection. + * + * @method visible + * @return {tinymce.ui.Collection} Current collection instance or visible state of the first item on a get operation. + */ + // visible: function(state) {}, -- Generated by code below + + /** + * Adds a class to all items in the collection. + * + * @method addClass + * @param {String} cls Class to add to each item. + * @return {tinymce.ui.Collection} Current collection instance. + */ + // addClass: function(cls) {}, -- Generated by code below + + /** + * Removes the specified class from all items in collection. + * + * @method removeClass + * @param {String} cls Class to remove from each item. + * @return {tinymce.ui.Collection} Current collection instance. + */ + // removeClass: function(cls) {}, -- Generated by code below + }; + + // Extend tinymce.ui.Collection prototype with some generated control specific methods + Tools.each('fire on off show hide addClass removeClass append prepend before after reflow'.split(' '), function(name) { + proto[name] = function() { + var args = Tools.toArray(arguments); + + this.each(function(ctrl) { + if (name in ctrl) { + ctrl[name].apply(ctrl, args); + } + }); + + return this; + }; + }); + + // Extend tinymce.ui.Collection prototype with some property methods + Tools.each('text name disabled active selected checked visible parent value data'.split(' '), function(name) { + proto[name] = function(value) { + return this.prop(name, value); + }; + }); + + // Create class based on the new prototype + Collection = Class.extend(proto); + + // Stick Collection into Selector to prevent circual references + Selector.Collection = Collection; + + return Collection; +}); + +// Included from: js/tinymce/classes/ui/DomUtils.js + +/** + * DOMUtils.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +define("tinymce/ui/DomUtils", [ + "tinymce/util/Tools", + "tinymce/dom/DOMUtils" +], function(Tools, DOMUtils) { + "use strict"; + + var count = 0; + + return { + id: function() { + return 'mceu_' + (count++); + }, + + createFragment: function(html) { + return DOMUtils.DOM.createFragment(html); + }, + + getWindowSize: function() { + return DOMUtils.DOM.getViewPort(); + }, + + getSize: function(elm) { + var width, height; + + if (elm.getBoundingClientRect) { + var rect = elm.getBoundingClientRect(); + + width = Math.max(rect.width || (rect.right - rect.left), elm.offsetWidth); + height = Math.max(rect.height || (rect.bottom - rect.bottom), elm.offsetHeight); + } else { + width = elm.offsetWidth; + height = elm.offsetHeight; + } + + return {width: width, height: height}; + }, + + getPos: function(elm, root) { + return DOMUtils.DOM.getPos(elm, root); + }, + + getViewPort: function(win) { + return DOMUtils.DOM.getViewPort(win); + }, + + get: function(id) { + return document.getElementById(id); + }, + + addClass: function(elm, cls) { + return DOMUtils.DOM.addClass(elm, cls); + }, + + removeClass: function(elm, cls) { + return DOMUtils.DOM.removeClass(elm, cls); + }, + + hasClass: function(elm, cls) { + return DOMUtils.DOM.hasClass(elm, cls); + }, + + toggleClass: function(elm, cls, state) { + return DOMUtils.DOM.toggleClass(elm, cls, state); + }, + + css: function(elm, name, value) { + return DOMUtils.DOM.setStyle(elm, name, value); + }, + + getRuntimeStyle: function(elm, name) { + return DOMUtils.DOM.getStyle(elm, name, true); + }, + + on: function(target, name, callback, scope) { + return DOMUtils.DOM.bind(target, name, callback, scope); + }, + + off: function(target, name, callback) { + return DOMUtils.DOM.unbind(target, name, callback); + }, + + fire: function(target, name, args) { + return DOMUtils.DOM.fire(target, name, args); + }, + + innerHtml: function(elm, html) { + // Workaround for
    in

    bug on IE 8 #6178 + DOMUtils.DOM.setHTML(elm, html); + } + }; +}); + +// Included from: js/tinymce/classes/ui/Control.js + +/** + * Control.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*eslint consistent-this:0 */ + +/** + * This is the base class for all controls and containers. All UI control instances inherit + * from this one as it has the base logic needed by all of them. + * + * @class tinymce.ui.Control + */ +define("tinymce/ui/Control", [ + "tinymce/util/Class", + "tinymce/util/Tools", + "tinymce/util/EventDispatcher", + "tinymce/ui/Collection", + "tinymce/ui/DomUtils" +], function(Class, Tools, EventDispatcher, Collection, DomUtils) { + "use strict"; + + var hasMouseWheelEventSupport = "onmousewheel" in document; + var hasWheelEventSupport = false; + var classPrefix = "mce-"; + + function getEventDispatcher(obj) { + if (!obj._eventDispatcher) { + obj._eventDispatcher = new EventDispatcher({ + scope: obj, + toggleEvent: function(name, state) { + if (state && EventDispatcher.isNative(name)) { + if (!obj._nativeEvents) { + obj._nativeEvents = {}; + } + + obj._nativeEvents[name] = true; + + if (obj._rendered) { + obj.bindPendingEvents(); + } + } + } + }); + } + + return obj._eventDispatcher; + } + + var Control = Class.extend({ + Statics: { + classPrefix: classPrefix + }, + + isRtl: function() { + return Control.rtl; + }, + + /** + * Class/id prefix to use for all controls. + * + * @final + * @field {String} classPrefix + */ + classPrefix: classPrefix, + + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {String} style Style CSS properties to add. + * @setting {String} border Border box values example: 1 1 1 1 + * @setting {String} padding Padding box values example: 1 1 1 1 + * @setting {String} margin Margin box values example: 1 1 1 1 + * @setting {Number} minWidth Minimal width for the control. + * @setting {Number} minHeight Minimal height for the control. + * @setting {String} classes Space separated list of classes to add. + * @setting {String} role WAI-ARIA role to use for control. + * @setting {Boolean} hidden Is the control hidden by default. + * @setting {Boolean} disabled Is the control disabled by default. + * @setting {String} name Name of the control instance. + */ + init: function(settings) { + var self = this, classes, i; + + self.settings = settings = Tools.extend({}, self.Defaults, settings); + + // Initial states + self._id = settings.id || DomUtils.id(); + self._text = self._name = ''; + self._width = self._height = 0; + self._aria = {role: settings.role}; + this._elmCache = {}; + + // Setup classes + classes = settings.classes; + if (classes) { + classes = classes.split(' '); + classes.map = {}; + i = classes.length; + while (i--) { + classes.map[classes[i]] = true; + } + } + + self._classes = classes || []; + self.visible(true); + + // Set some properties + Tools.each('title text width height name classes visible disabled active value'.split(' '), function(name) { + var value = settings[name], undef; + + if (value !== undef) { + self[name](value); + } else if (self['_' + name] === undef) { + self['_' + name] = false; + } + }); + + self.on('click', function() { + if (self.disabled()) { + return false; + } + }); + + // TODO: Is this needed duplicate code see above? + if (settings.classes) { + Tools.each(settings.classes.split(' '), function(cls) { + self.addClass(cls); + }); + } + + /** + * Name/value object with settings for the current control. + * + * @field {Object} settings + */ + self.settings = settings; + + self._borderBox = self.parseBox(settings.border); + self._paddingBox = self.parseBox(settings.padding); + self._marginBox = self.parseBox(settings.margin); + + if (settings.hidden) { + self.hide(); + } + }, + + // Will generate getter/setter methods for these properties + Properties: 'parent,title,text,width,height,disabled,active,name,value', + + // Will generate empty dummy functions for these + Methods: 'renderHtml', + + /** + * Returns the root element to render controls into. + * + * @method getContainerElm + * @return {Element} HTML DOM element to render into. + */ + getContainerElm: function() { + return document.body; + }, + + /** + * Returns a control instance for the current DOM element. + * + * @method getParentCtrl + * @param {Element} elm HTML dom element to get parent control from. + * @return {tinymce.ui.Control} Control instance or undefined. + */ + getParentCtrl: function(elm) { + var ctrl, lookup = this.getRoot().controlIdLookup; + + while (elm && lookup) { + ctrl = lookup[elm.id]; + if (ctrl) { + break; + } + + elm = elm.parentNode; + } + + return ctrl; + }, + + /** + * Parses the specified box value. A box value contains 1-4 properties in clockwise order. + * + * @method parseBox + * @param {String/Number} value Box value "0 1 2 3" or "0" etc. + * @return {Object} Object with top/right/bottom/left properties. + * @private + */ + parseBox: function(value) { + var len, radix = 10; + + if (!value) { + return; + } + + if (typeof value === "number") { + value = value || 0; + + return { + top: value, + left: value, + bottom: value, + right: value + }; + } + + value = value.split(' '); + len = value.length; + + if (len === 1) { + value[1] = value[2] = value[3] = value[0]; + } else if (len === 2) { + value[2] = value[0]; + value[3] = value[1]; + } else if (len === 3) { + value[3] = value[1]; + } + + return { + top: parseInt(value[0], radix) || 0, + right: parseInt(value[1], radix) || 0, + bottom: parseInt(value[2], radix) || 0, + left: parseInt(value[3], radix) || 0 + }; + }, + + borderBox: function() { + return this._borderBox; + }, + + paddingBox: function() { + return this._paddingBox; + }, + + marginBox: function() { + return this._marginBox; + }, + + measureBox: function(elm, prefix) { + function getStyle(name) { + var defaultView = document.defaultView; + + if (defaultView) { + // Remove camelcase + name = name.replace(/[A-Z]/g, function(a) { + return '-' + a; + }); + + return defaultView.getComputedStyle(elm, null).getPropertyValue(name); + } + + return elm.currentStyle[name]; + } + + function getSide(name) { + var val = parseFloat(getStyle(name), 10); + + return isNaN(val) ? 0 : val; + } + + return { + top: getSide(prefix + "TopWidth"), + right: getSide(prefix + "RightWidth"), + bottom: getSide(prefix + "BottomWidth"), + left: getSide(prefix + "LeftWidth") + }; + }, + + /** + * Initializes the current controls layout rect. + * This will be executed by the layout managers to determine the + * default minWidth/minHeight etc. + * + * @method initLayoutRect + * @return {Object} Layout rect instance. + */ + initLayoutRect: function() { + var self = this, settings = self.settings, borderBox, layoutRect; + var elm = self.getEl(), width, height, minWidth, minHeight, autoResize; + var startMinWidth, startMinHeight, initialSize; + + // Measure the current element + borderBox = self._borderBox = self._borderBox || self.measureBox(elm, 'border'); + self._paddingBox = self._paddingBox || self.measureBox(elm, 'padding'); + self._marginBox = self._marginBox || self.measureBox(elm, 'margin'); + initialSize = DomUtils.getSize(elm); + + // Setup minWidth/minHeight and width/height + startMinWidth = settings.minWidth; + startMinHeight = settings.minHeight; + minWidth = startMinWidth || initialSize.width; + minHeight = startMinHeight || initialSize.height; + width = settings.width; + height = settings.height; + autoResize = settings.autoResize; + autoResize = typeof autoResize != "undefined" ? autoResize : !width && !height; + + width = width || minWidth; + height = height || minHeight; + + var deltaW = borderBox.left + borderBox.right; + var deltaH = borderBox.top + borderBox.bottom; + + var maxW = settings.maxWidth || 0xFFFF; + var maxH = settings.maxHeight || 0xFFFF; + + // Setup initial layout rect + self._layoutRect = layoutRect = { + x: settings.x || 0, + y: settings.y || 0, + w: width, + h: height, + deltaW: deltaW, + deltaH: deltaH, + contentW: width - deltaW, + contentH: height - deltaH, + innerW: width - deltaW, + innerH: height - deltaH, + startMinWidth: startMinWidth || 0, + startMinHeight: startMinHeight || 0, + minW: Math.min(minWidth, maxW), + minH: Math.min(minHeight, maxH), + maxW: maxW, + maxH: maxH, + autoResize: autoResize, + scrollW: 0 + }; + + self._lastLayoutRect = {}; + + return layoutRect; + }, + + /** + * Getter/setter for the current layout rect. + * + * @method layoutRect + * @param {Object} [newRect] Optional new layout rect. + * @return {tinymce.ui.Control/Object} Current control or rect object. + */ + layoutRect: function(newRect) { + var self = this, curRect = self._layoutRect, lastLayoutRect, size, deltaWidth, deltaHeight, undef, repaintControls; + + // Initialize default layout rect + if (!curRect) { + curRect = self.initLayoutRect(); + } + + // Set new rect values + if (newRect) { + // Calc deltas between inner and outer sizes + deltaWidth = curRect.deltaW; + deltaHeight = curRect.deltaH; + + // Set x position + if (newRect.x !== undef) { + curRect.x = newRect.x; + } + + // Set y position + if (newRect.y !== undef) { + curRect.y = newRect.y; + } + + // Set minW + if (newRect.minW !== undef) { + curRect.minW = newRect.minW; + } + + // Set minH + if (newRect.minH !== undef) { + curRect.minH = newRect.minH; + } + + // Set new width and calculate inner width + size = newRect.w; + if (size !== undef) { + size = size < curRect.minW ? curRect.minW : size; + size = size > curRect.maxW ? curRect.maxW : size; + curRect.w = size; + curRect.innerW = size - deltaWidth; + } + + // Set new height and calculate inner height + size = newRect.h; + if (size !== undef) { + size = size < curRect.minH ? curRect.minH : size; + size = size > curRect.maxH ? curRect.maxH : size; + curRect.h = size; + curRect.innerH = size - deltaHeight; + } + + // Set new inner width and calculate width + size = newRect.innerW; + if (size !== undef) { + size = size < curRect.minW - deltaWidth ? curRect.minW - deltaWidth : size; + size = size > curRect.maxW - deltaWidth ? curRect.maxW - deltaWidth : size; + curRect.innerW = size; + curRect.w = size + deltaWidth; + } + + // Set new height and calculate inner height + size = newRect.innerH; + if (size !== undef) { + size = size < curRect.minH - deltaHeight ? curRect.minH - deltaHeight : size; + size = size > curRect.maxH - deltaHeight ? curRect.maxH - deltaHeight : size; + curRect.innerH = size; + curRect.h = size + deltaHeight; + } + + // Set new contentW + if (newRect.contentW !== undef) { + curRect.contentW = newRect.contentW; + } + + // Set new contentH + if (newRect.contentH !== undef) { + curRect.contentH = newRect.contentH; + } + + // Compare last layout rect with the current one to see if we need to repaint or not + lastLayoutRect = self._lastLayoutRect; + if (lastLayoutRect.x !== curRect.x || lastLayoutRect.y !== curRect.y || + lastLayoutRect.w !== curRect.w || lastLayoutRect.h !== curRect.h) { + repaintControls = Control.repaintControls; + + if (repaintControls) { + if (repaintControls.map && !repaintControls.map[self._id]) { + repaintControls.push(self); + repaintControls.map[self._id] = true; + } + } + + lastLayoutRect.x = curRect.x; + lastLayoutRect.y = curRect.y; + lastLayoutRect.w = curRect.w; + lastLayoutRect.h = curRect.h; + } + + return self; + } + + return curRect; + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this, style, bodyStyle, rect, borderBox, borderW = 0, borderH = 0, lastRepaintRect, round; + + // Use Math.round on all values on IE < 9 + round = !document.createRange ? Math.round : function(value) { + return value; + }; + + style = self.getEl().style; + rect = self._layoutRect; + lastRepaintRect = self._lastRepaintRect || {}; + + borderBox = self._borderBox; + borderW = borderBox.left + borderBox.right; + borderH = borderBox.top + borderBox.bottom; + + if (rect.x !== lastRepaintRect.x) { + style.left = round(rect.x) + 'px'; + lastRepaintRect.x = rect.x; + } + + if (rect.y !== lastRepaintRect.y) { + style.top = round(rect.y) + 'px'; + lastRepaintRect.y = rect.y; + } + + if (rect.w !== lastRepaintRect.w) { + style.width = round(rect.w - borderW) + 'px'; + lastRepaintRect.w = rect.w; + } + + if (rect.h !== lastRepaintRect.h) { + style.height = round(rect.h - borderH) + 'px'; + lastRepaintRect.h = rect.h; + } + + // Update body if needed + if (self._hasBody && rect.innerW !== lastRepaintRect.innerW) { + bodyStyle = self.getEl('body').style; + bodyStyle.width = round(rect.innerW) + 'px'; + lastRepaintRect.innerW = rect.innerW; + } + + if (self._hasBody && rect.innerH !== lastRepaintRect.innerH) { + bodyStyle = bodyStyle || self.getEl('body').style; + bodyStyle.height = round(rect.innerH) + 'px'; + lastRepaintRect.innerH = rect.innerH; + } + + self._lastRepaintRect = lastRepaintRect; + self.fire('repaint', {}, false); + }, + + /** + * Binds a callback to the specified event. This event can both be + * native browser events like "click" or custom ones like PostRender. + * + * The callback function will be passed a DOM event like object that enables yout do stop propagation. + * + * @method on + * @param {String} name Name of the event to bind. For example "click". + * @param {String/function} callback Callback function to execute ones the event occurs. + * @return {tinymce.ui.Control} Current control object. + */ + on: function(name, callback) { + var self = this; + + function resolveCallbackName(name) { + var callback, scope; + + if (typeof name != 'string') { + return name; + } + + return function(e) { + if (!callback) { + self.parentsAndSelf().each(function(ctrl) { + var callbacks = ctrl.settings.callbacks; + + if (callbacks && (callback = callbacks[name])) { + scope = ctrl; + return false; + } + }); + } + + return callback.call(scope, e); + }; + } + + getEventDispatcher(self).on(name, resolveCallbackName(callback)); + + return self; + }, + + /** + * Unbinds the specified event and optionally a specific callback. If you omit the name + * parameter all event handlers will be removed. If you omit the callback all event handles + * by the specified name will be removed. + * + * @method off + * @param {String} [name] Name for the event to unbind. + * @param {function} [callback] Callback function to unbind. + * @return {mxex.ui.Control} Current control object. + */ + off: function(name, callback) { + getEventDispatcher(this).off(name, callback); + return this; + }, + + /** + * Fires the specified event by name and arguments on the control. This will execute all + * bound event handlers. + * + * @method fire + * @param {String} name Name of the event to fire. + * @param {Object} [args] Arguments to pass to the event. + * @param {Boolean} [bubble] Value to control bubbeling. Defaults to true. + * @return {Object} Current arguments object. + */ + fire: function(name, args, bubble) { + var self = this; + + args = args || {}; + + if (!args.control) { + args.control = self; + } + + args = getEventDispatcher(self).fire(name, args); + + // Bubble event up to parents + if (bubble !== false && self.parent) { + var parent = self.parent(); + while (parent && !args.isPropagationStopped()) { + parent.fire(name, args, false); + parent = parent.parent(); + } + } + + return args; + }, + + /** + * Returns true/false if the specified event has any listeners. + * + * @method hasEventListeners + * @param {String} name Name of the event to check for. + * @return {Boolean} True/false state if the event has listeners. + */ + hasEventListeners: function(name) { + return getEventDispatcher(this).has(name); + }, + + /** + * Returns a control collection with all parent controls. + * + * @method parents + * @param {String} selector Optional selector expression to find parents. + * @return {tinymce.ui.Collection} Collection with all parent controls. + */ + parents: function(selector) { + var self = this, ctrl, parents = new Collection(); + + // Add each parent to collection + for (ctrl = self.parent(); ctrl; ctrl = ctrl.parent()) { + parents.add(ctrl); + } + + // Filter away everything that doesn't match the selector + if (selector) { + parents = parents.filter(selector); + } + + return parents; + }, + + /** + * Returns the current control and it's parents. + * + * @method parentsAndSelf + * @param {String} selector Optional selector expression to find parents. + * @return {tinymce.ui.Collection} Collection with all parent controls. + */ + parentsAndSelf: function(selector) { + return new Collection(this).add(this.parents(selector)); + }, + + /** + * Returns the control next to the current control. + * + * @method next + * @return {tinymce.ui.Control} Next control instance. + */ + next: function() { + var parentControls = this.parent().items(); + + return parentControls[parentControls.indexOf(this) + 1]; + }, + + /** + * Returns the control previous to the current control. + * + * @method prev + * @return {tinymce.ui.Control} Previous control instance. + */ + prev: function() { + var parentControls = this.parent().items(); + + return parentControls[parentControls.indexOf(this) - 1]; + }, + + /** + * Find the common ancestor for two control instances. + * + * @method findCommonAncestor + * @param {tinymce.ui.Control} ctrl1 First control. + * @param {tinymce.ui.Control} ctrl2 Second control. + * @return {tinymce.ui.Control} Ancestor control instance. + */ + findCommonAncestor: function(ctrl1, ctrl2) { + var parentCtrl; + + while (ctrl1) { + parentCtrl = ctrl2; + + while (parentCtrl && ctrl1 != parentCtrl) { + parentCtrl = parentCtrl.parent(); + } + + if (ctrl1 == parentCtrl) { + break; + } + + ctrl1 = ctrl1.parent(); + } + + return ctrl1; + }, + + /** + * Returns true/false if the specific control has the specific class. + * + * @method hasClass + * @param {String} cls Class to check for. + * @param {String} [group] Sub element group name. + * @return {Boolean} True/false if the control has the specified class. + */ + hasClass: function(cls, group) { + var classes = this._classes[group || 'control']; + + cls = this.classPrefix + cls; + + return classes && !!classes.map[cls]; + }, + + /** + * Adds the specified class to the control + * + * @method addClass + * @param {String} cls Class to check for. + * @param {String} [group] Sub element group name. + * @return {tinymce.ui.Control} Current control object. + */ + addClass: function(cls, group) { + var self = this, classes, elm; + + cls = this.classPrefix + cls; + classes = self._classes[group || 'control']; + + if (!classes) { + classes = []; + classes.map = {}; + self._classes[group || 'control'] = classes; + } + + if (!classes.map[cls]) { + classes.map[cls] = cls; + classes.push(cls); + + if (self._rendered) { + elm = self.getEl(group); + + if (elm) { + elm.className = classes.join(' '); + } + } + } + + return self; + }, + + /** + * Removes the specified class from the control. + * + * @method removeClass + * @param {String} cls Class to remove. + * @param {String} [group] Sub element group name. + * @return {tinymce.ui.Control} Current control object. + */ + removeClass: function(cls, group) { + var self = this, classes, i, elm; + + cls = this.classPrefix + cls; + classes = self._classes[group || 'control']; + if (classes && classes.map[cls]) { + delete classes.map[cls]; + + i = classes.length; + while (i--) { + if (classes[i] === cls) { + classes.splice(i, 1); + } + } + } + + if (self._rendered) { + elm = self.getEl(group); + + if (elm) { + elm.className = classes.join(' '); + } + } + + return self; + }, + + /** + * Toggles the specified class on the control. + * + * @method toggleClass + * @param {String} cls Class to remove. + * @param {Boolean} state True/false state to add/remove class. + * @param {String} [group] Sub element group name. + * @return {tinymce.ui.Control} Current control object. + */ + toggleClass: function(cls, state, group) { + var self = this; + + if (state) { + self.addClass(cls, group); + } else { + self.removeClass(cls, group); + } + + return self; + }, + + /** + * Returns the class string for the specified group name. + * + * @method classes + * @param {String} [group] Group to get clases by. + * @return {String} Classes for the specified group. + */ + classes: function(group) { + var classes = this._classes[group || 'control']; + + return classes ? classes.join(' ') : ''; + }, + + /** + * Sets the inner HTML of the control element. + * + * @method innerHtml + * @param {String} html Html string to set as inner html. + * @return {tinymce.ui.Control} Current control object. + */ + innerHtml: function(html) { + DomUtils.innerHtml(this.getEl(), html); + return this; + }, + + /** + * Returns the control DOM element or sub element. + * + * @method getEl + * @param {String} [suffix] Suffix to get element by. + * @return {Element} HTML DOM element for the current control or it's children. + */ + getEl: function(suffix) { + var id = suffix ? this._id + '-' + suffix : this._id; + + if (!this._elmCache[id]) { + this._elmCache[id] = DomUtils.get(id); + } + + return this._elmCache[id]; + }, + + /** + * Sets/gets the visible for the control. + * + * @method visible + * @param {Boolean} state Value to set to control. + * @return {Boolean/tinymce.ui.Control} Current control on a set operation or current state on a get. + */ + visible: function(state) { + var self = this, parentCtrl; + + if (typeof state !== "undefined") { + if (self._visible !== state) { + if (self._rendered) { + self.getEl().style.display = state ? '' : 'none'; + } + + self._visible = state; + + // Parent container needs to reflow + parentCtrl = self.parent(); + if (parentCtrl) { + parentCtrl._lastRect = null; + } + + self.fire(state ? 'show' : 'hide'); + } + + return self; + } + + return self._visible; + }, + + /** + * Sets the visible state to true. + * + * @method show + * @return {tinymce.ui.Control} Current control instance. + */ + show: function() { + return this.visible(true); + }, + + /** + * Sets the visible state to false. + * + * @method hide + * @return {tinymce.ui.Control} Current control instance. + */ + hide: function() { + return this.visible(false); + }, + + /** + * Focuses the current control. + * + * @method focus + * @return {tinymce.ui.Control} Current control instance. + */ + focus: function() { + try { + this.getEl().focus(); + } catch (ex) { + // Ignore IE error + } + + return this; + }, + + /** + * Blurs the current control. + * + * @method blur + * @return {tinymce.ui.Control} Current control instance. + */ + blur: function() { + this.getEl().blur(); + + return this; + }, + + /** + * Sets the specified aria property. + * + * @method aria + * @param {String} name Name of the aria property to set. + * @param {String} value Value of the aria property. + * @return {tinymce.ui.Control} Current control instance. + */ + aria: function(name, value) { + var self = this, elm = self.getEl(self.ariaTarget); + + if (typeof value === "undefined") { + return self._aria[name]; + } else { + self._aria[name] = value; + } + + if (self._rendered) { + elm.setAttribute(name == 'role' ? name : 'aria-' + name, value); + } + + return self; + }, + + /** + * Encodes the specified string with HTML entities. It will also + * translate the string to different languages. + * + * @method encode + * @param {String/Object/Array} text Text to entity encode. + * @param {Boolean} [translate=true] False if the contents shouldn't be translated. + * @return {String} Encoded and possible traslated string. + */ + encode: function(text, translate) { + if (translate !== false) { + text = this.translate(text); + } + + return (text || '').replace(/[&<>"]/g, function(match) { + return '&#' + match.charCodeAt(0) + ';'; + }); + }, + + /** + * Returns the translated string. + * + * @method translate + * @param {String} text Text to translate. + * @return {String} Translated string or the same as the input. + */ + translate: function(text) { + return Control.translate ? Control.translate(text) : text; + }, + + /** + * Adds items before the current control. + * + * @method before + * @param {Array/tinymce.ui.Collection} items Array of items to prepend before this control. + * @return {tinymce.ui.Control} Current control instance. + */ + before: function(items) { + var self = this, parent = self.parent(); + + if (parent) { + parent.insert(items, parent.items().indexOf(self), true); + } + + return self; + }, + + /** + * Adds items after the current control. + * + * @method after + * @param {Array/tinymce.ui.Collection} items Array of items to append after this control. + * @return {tinymce.ui.Control} Current control instance. + */ + after: function(items) { + var self = this, parent = self.parent(); + + if (parent) { + parent.insert(items, parent.items().indexOf(self)); + } + + return self; + }, + + /** + * Removes the current control from DOM and from UI collections. + * + * @method remove + * @return {tinymce.ui.Control} Current control instance. + */ + remove: function() { + var self = this, elm = self.getEl(), parent = self.parent(), newItems, i; + + if (self.items) { + var controls = self.items().toArray(); + i = controls.length; + while (i--) { + controls[i].remove(); + } + } + + if (parent && parent.items) { + newItems = []; + + parent.items().each(function(item) { + if (item !== self) { + newItems.push(item); + } + }); + + parent.items().set(newItems); + parent._lastRect = null; + } + + if (self._eventsRoot && self._eventsRoot == self) { + DomUtils.off(elm); + } + + var lookup = self.getRoot().controlIdLookup; + if (lookup) { + delete lookup[self._id]; + } + + if (elm && elm.parentNode) { + elm.parentNode.removeChild(elm); + } + + self._rendered = false; + + return self; + }, + + /** + * Renders the control before the specified element. + * + * @method renderBefore + * @param {Element} elm Element to render before. + * @return {tinymce.ui.Control} Current control instance. + */ + renderBefore: function(elm) { + var self = this; + + elm.parentNode.insertBefore(DomUtils.createFragment(self.renderHtml()), elm); + self.postRender(); + + return self; + }, + + /** + * Renders the control to the specified element. + * + * @method renderBefore + * @param {Element} elm Element to render to. + * @return {tinymce.ui.Control} Current control instance. + */ + renderTo: function(elm) { + var self = this; + + elm = elm || self.getContainerElm(); + elm.appendChild(DomUtils.createFragment(self.renderHtml())); + self.postRender(); + + return self; + }, + + /** + * Post render method. Called after the control has been rendered to the target. + * + * @method postRender + * @return {tinymce.ui.Control} Current control instance. + */ + postRender: function() { + var self = this, settings = self.settings, elm, box, parent, name, parentEventsRoot; + + // Bind on settings + for (name in settings) { + if (name.indexOf("on") === 0) { + self.on(name.substr(2), settings[name]); + } + } + + if (self._eventsRoot) { + for (parent = self.parent(); !parentEventsRoot && parent; parent = parent.parent()) { + parentEventsRoot = parent._eventsRoot; + } + + if (parentEventsRoot) { + for (name in parentEventsRoot._nativeEvents) { + self._nativeEvents[name] = true; + } + } + } + + self.bindPendingEvents(); + + if (settings.style) { + elm = self.getEl(); + if (elm) { + elm.setAttribute('style', settings.style); + elm.style.cssText = settings.style; + } + } + + if (!self._visible) { + DomUtils.css(self.getEl(), 'display', 'none'); + } + + if (self.settings.border) { + box = self.borderBox(); + DomUtils.css(self.getEl(), { + 'border-top-width': box.top, + 'border-right-width': box.right, + 'border-bottom-width': box.bottom, + 'border-left-width': box.left + }); + } + + // Add instance to lookup + var root = self.getRoot(); + if (!root.controlIdLookup) { + root.controlIdLookup = {}; + } + + root.controlIdLookup[self._id] = self; + + for (var key in self._aria) { + self.aria(key, self._aria[key]); + } + + self.fire('postrender', {}, false); + }, + + /** + * Scrolls the current control into view. + * + * @method scrollIntoView + * @param {String} align Alignment in view top|center|bottom. + * @return {tinymce.ui.Control} Current control instance. + */ + scrollIntoView: function(align) { + function getOffset(elm, rootElm) { + var x, y, parent = elm; + + x = y = 0; + while (parent && parent != rootElm && parent.nodeType) { + x += parent.offsetLeft || 0; + y += parent.offsetTop || 0; + parent = parent.offsetParent; + } + + return {x: x, y: y}; + } + + var elm = this.getEl(), parentElm = elm.parentNode; + var x, y, width, height, parentWidth, parentHeight; + var pos = getOffset(elm, parentElm); + + x = pos.x; + y = pos.y; + width = elm.offsetWidth; + height = elm.offsetHeight; + parentWidth = parentElm.clientWidth; + parentHeight = parentElm.clientHeight; + + if (align == "end") { + x -= parentWidth - width; + y -= parentHeight - height; + } else if (align == "center") { + x -= (parentWidth / 2) - (width / 2); + y -= (parentHeight / 2) - (height / 2); + } + + parentElm.scrollLeft = x; + parentElm.scrollTop = y; + + return this; + }, + + /** + * Binds pending DOM events. + * + * @private + */ + bindPendingEvents: function() { + var self = this, i, l, parents, eventRootCtrl, nativeEvents, name; + + function delegate(e) { + var control = self.getParentCtrl(e.target); + + if (control) { + control.fire(e.type, e); + } + } + + function mouseLeaveHandler() { + var ctrl = eventRootCtrl._lastHoverCtrl; + + if (ctrl) { + ctrl.fire("mouseleave", {target: ctrl.getEl()}); + + ctrl.parents().each(function(ctrl) { + ctrl.fire("mouseleave", {target: ctrl.getEl()}); + }); + + eventRootCtrl._lastHoverCtrl = null; + } + } + + function mouseEnterHandler(e) { + var ctrl = self.getParentCtrl(e.target), lastCtrl = eventRootCtrl._lastHoverCtrl, idx = 0, i, parents, lastParents; + + // Over on a new control + if (ctrl !== lastCtrl) { + eventRootCtrl._lastHoverCtrl = ctrl; + + parents = ctrl.parents().toArray().reverse(); + parents.push(ctrl); + + if (lastCtrl) { + lastParents = lastCtrl.parents().toArray().reverse(); + lastParents.push(lastCtrl); + + for (idx = 0; idx < lastParents.length; idx++) { + if (parents[idx] !== lastParents[idx]) { + break; + } + } + + for (i = lastParents.length - 1; i >= idx; i--) { + lastCtrl = lastParents[i]; + lastCtrl.fire("mouseleave", { + target: lastCtrl.getEl() + }); + } + } + + for (i = idx; i < parents.length; i++) { + ctrl = parents[i]; + ctrl.fire("mouseenter", { + target: ctrl.getEl() + }); + } + } + } + + function fixWheelEvent(e) { + e.preventDefault(); + + if (e.type == "mousewheel") { + e.deltaY = -1 / 40 * e.wheelDelta; + + if (e.wheelDeltaX) { + e.deltaX = -1 / 40 * e.wheelDeltaX; + } + } else { + e.deltaX = 0; + e.deltaY = e.detail; + } + + e = self.fire("wheel", e); + } + + self._rendered = true; + + nativeEvents = self._nativeEvents; + if (nativeEvents) { + // Find event root element if it exists + parents = self.parents().toArray(); + parents.unshift(self); + for (i = 0, l = parents.length; !eventRootCtrl && i < l; i++) { + eventRootCtrl = parents[i]._eventsRoot; + } + + // Event root wasn't found the use the root control + if (!eventRootCtrl) { + eventRootCtrl = parents[parents.length - 1] || self; + } + + // Set the eventsRoot property on children that didn't have it + self._eventsRoot = eventRootCtrl; + for (l = i, i = 0; i < l; i++) { + parents[i]._eventsRoot = eventRootCtrl; + } + + var eventRootDelegates = eventRootCtrl._delegates; + if (!eventRootDelegates) { + eventRootDelegates = eventRootCtrl._delegates = {}; + } + + // Bind native event delegates + for (name in nativeEvents) { + if (!nativeEvents) { + return false; + } + + if (name === "wheel" && !hasWheelEventSupport) { + if (hasMouseWheelEventSupport) { + DomUtils.on(self.getEl(), "mousewheel", fixWheelEvent); + } else { + DomUtils.on(self.getEl(), "DOMMouseScroll", fixWheelEvent); + } + + continue; + } + + // Special treatment for mousenter/mouseleave since these doesn't bubble + if (name === "mouseenter" || name === "mouseleave") { + // Fake mousenter/mouseleave + if (!eventRootCtrl._hasMouseEnter) { + DomUtils.on(eventRootCtrl.getEl(), "mouseleave", mouseLeaveHandler); + DomUtils.on(eventRootCtrl.getEl(), "mouseover", mouseEnterHandler); + eventRootCtrl._hasMouseEnter = 1; + } + } else if (!eventRootDelegates[name]) { + DomUtils.on(eventRootCtrl.getEl(), name, delegate); + eventRootDelegates[name] = true; + } + + // Remove the event once it's bound + nativeEvents[name] = false; + } + } + }, + + getRoot: function() { + var ctrl = this, rootControl, parents = []; + + while (ctrl) { + if (ctrl.rootControl) { + rootControl = ctrl.rootControl; + break; + } + + parents.push(ctrl); + rootControl = ctrl; + ctrl = ctrl.parent(); + } + + if (!rootControl) { + rootControl = this; + } + + var i = parents.length; + while (i--) { + parents[i].rootControl = rootControl; + } + + return rootControl; + }, + + /** + * Reflows the current control and it's parents. + * This should be used after you for example append children to the current control so + * that the layout managers know that they need to reposition everything. + * + * @example + * container.append({type: 'button', text: 'My button'}).reflow(); + * + * @method reflow + * @return {tinymce.ui.Control} Current control instance. + */ + reflow: function() { + this.repaint(); + + return this; + } + + /** + * Sets/gets the parent container for the control. + * + * @method parent + * @param {tinymce.ui.Container} parent Optional parent to set. + * @return {tinymce.ui.Control} Parent control or the current control on a set action. + */ + // parent: function(parent) {} -- Generated + + /** + * Sets/gets the text for the control. + * + * @method text + * @param {String} value Value to set to control. + * @return {String/tinymce.ui.Control} Current control on a set operation or current value on a get. + */ + // text: function(value) {} -- Generated + + /** + * Sets/gets the width for the control. + * + * @method width + * @param {Number} value Value to set to control. + * @return {Number/tinymce.ui.Control} Current control on a set operation or current value on a get. + */ + // width: function(value) {} -- Generated + + /** + * Sets/gets the height for the control. + * + * @method height + * @param {Number} value Value to set to control. + * @return {Number/tinymce.ui.Control} Current control on a set operation or current value on a get. + */ + // height: function(value) {} -- Generated + + /** + * Sets/gets the disabled state on the control. + * + * @method disabled + * @param {Boolean} state Value to set to control. + * @return {Boolean/tinymce.ui.Control} Current control on a set operation or current state on a get. + */ + // disabled: function(state) {} -- Generated + + /** + * Sets/gets the active for the control. + * + * @method active + * @param {Boolean} state Value to set to control. + * @return {Boolean/tinymce.ui.Control} Current control on a set operation or current state on a get. + */ + // active: function(state) {} -- Generated + + /** + * Sets/gets the name for the control. + * + * @method name + * @param {String} value Value to set to control. + * @return {String/tinymce.ui.Control} Current control on a set operation or current value on a get. + */ + // name: function(value) {} -- Generated + + /** + * Sets/gets the title for the control. + * + * @method title + * @param {String} value Value to set to control. + * @return {String/tinymce.ui.Control} Current control on a set operation or current value on a get. + */ + // title: function(value) {} -- Generated + }); + + return Control; +}); + +// Included from: js/tinymce/classes/ui/Factory.js + +/** + * Factory.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +/** + * This class is a factory for control instances. This enables you + * to create instances of controls without having to require the UI controls directly. + * + * It also allow you to override or add new control types. + * + * @class tinymce.ui.Factory + */ +define("tinymce/ui/Factory", [], function() { + "use strict"; + + var types = {}, namespaceInit; + + return { + /** + * Adds a new control instance type to the factory. + * + * @method add + * @param {String} type Type name for example "button". + * @param {function} typeClass Class type function. + */ + add: function(type, typeClass) { + types[type.toLowerCase()] = typeClass; + }, + + /** + * Returns true/false if the specified type exists or not. + * + * @method has + * @param {String} type Type to look for. + * @return {Boolean} true/false if the control by name exists. + */ + has: function(type) { + return !!types[type.toLowerCase()]; + }, + + /** + * Creates a new control instance based on the settings provided. The instance created will be + * based on the specified type property it can also create whole structures of components out of + * the specified JSON object. + * + * @example + * tinymce.ui.Factory.create({ + * type: 'button', + * text: 'Hello world!' + * }); + * + * @method create + * @param {Object/String} settings Name/Value object with items used to create the type. + * @return {tinymce.ui.Control} Control instance based on the specified type. + */ + create: function(type, settings) { + var ControlType, name, namespace; + + // Build type lookup + if (!namespaceInit) { + namespace = tinymce.ui; + + for (name in namespace) { + types[name.toLowerCase()] = namespace[name]; + } + + namespaceInit = true; + } + + // If string is specified then use it as the type + if (typeof type == 'string') { + settings = settings || {}; + settings.type = type; + } else { + settings = type; + type = settings.type; + } + + // Find control type + type = type.toLowerCase(); + ControlType = types[type]; + + // #if debug + + if (!ControlType) { + throw new Error("Could not find control by type: " + type); + } + + // #endif + + ControlType = new ControlType(settings); + ControlType.type = type; // Set the type on the instance, this will be used by the Selector engine + + return ControlType; + } + }; +}); + +// Included from: js/tinymce/classes/ui/KeyboardNavigation.js + +/** + * KeyboardNavigation.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles keyboard navigation of controls and elements. + * + * @class tinymce.ui.KeyboardNavigation + */ +define("tinymce/ui/KeyboardNavigation", [ +], function() { + "use strict"; + + /** + * This class handles all keyboard navigation for WAI-ARIA support. Each root container + * gets an instance of this class. + * + * @constructor + */ + return function(settings) { + var root = settings.root, focusedElement, focusedControl; + + try { + focusedElement = document.activeElement; + } catch (ex) { + // IE sometimes fails to return a proper element + focusedElement = document.body; + } + + focusedControl = root.getParentCtrl(focusedElement); + + /** + * Returns the currently focused elements wai aria role of the currently + * focused element or specified element. + * + * @private + * @param {Element} elm Optional element to get role from. + * @return {String} Role of specified element. + */ + function getRole(elm) { + elm = elm || focusedElement; + + return elm && elm.getAttribute('role'); + } + + /** + * Returns the wai role of the parent element of the currently + * focused element or specified element. + * + * @private + * @param {Element} elm Optional element to get parent role from. + * @return {String} Role of the first parent that has a role. + */ + function getParentRole(elm) { + var role, parent = elm || focusedElement; + + while ((parent = parent.parentNode)) { + if ((role = getRole(parent))) { + return role; + } + } + } + + /** + * Returns a wai aria property by name for example aria-selected. + * + * @private + * @param {String} name Name of the aria property to get for example "disabled". + * @return {String} Aria property value. + */ + function getAriaProp(name) { + var elm = focusedElement; + + if (elm) { + return elm.getAttribute('aria-' + name); + } + } + + /** + * Is the element a text input element or not. + * + * @private + * @param {Element} elm Element to check if it's an text input element or not. + * @return {Boolean} True/false if the element is a text element or not. + */ + function isTextInputElement(elm) { + var tagName = elm.tagName.toUpperCase(); + + // Notice: since type can be "email" etc we don't check the type + // So all input elements gets treated as text input elements + return tagName == "INPUT" || tagName == "TEXTAREA"; + } + + /** + * Returns true/false if the specified element can be focused or not. + * + * @private + * @param {Element} elm DOM element to check if it can be focused or not. + * @return {Boolean} True/false if the element can have focus. + */ + function canFocus(elm) { + if (isTextInputElement(elm) && !elm.hidden) { + return true; + } + + if (/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell)$/.test(getRole(elm))) { + return true; + } + + return false; + } + + /** + * Returns an array of focusable visible elements within the specified container element. + * + * @private + * @param {Element} elm DOM element to find focusable elements within. + * @return {Array} Array of focusable elements. + */ + function getFocusElements(elm) { + var elements = []; + + function collect(elm) { + if (elm.nodeType != 1 || elm.style.display == 'none') { + return; + } + + if (canFocus(elm)) { + elements.push(elm); + } + + for (var i = 0; i < elm.childNodes.length; i++) { + collect(elm.childNodes[i]); + } + } + + collect(elm || root.getEl()); + + return elements; + } + + /** + * Returns the navigation root control for the specified control. The navigation root + * is the control that the keyboard navigation gets scoped to for example a menubar or toolbar group. + * It will look for parents of the specified target control or the currently focused control if this option is omitted. + * + * @private + * @param {tinymce.ui.Control} targetControl Optional target control to find root of. + * @return {tinymce.ui.Control} Navigation root control. + */ + function getNavigationRoot(targetControl) { + var navigationRoot, controls; + + targetControl = targetControl || focusedControl; + controls = targetControl.parents().toArray(); + controls.unshift(targetControl); + + for (var i = 0; i < controls.length; i++) { + navigationRoot = controls[i]; + + if (navigationRoot.settings.ariaRoot) { + break; + } + } + + return navigationRoot; + } + + /** + * Focuses the first item in the specified targetControl element or the last aria index if the + * navigation root has the ariaRemember option enabled. + * + * @private + * @param {tinymce.ui.Control} targetControl Target control to focus the first item in. + */ + function focusFirst(targetControl) { + var navigationRoot = getNavigationRoot(targetControl); + var focusElements = getFocusElements(navigationRoot.getEl()); + + if (navigationRoot.settings.ariaRemember && "lastAriaIndex" in navigationRoot) { + moveFocusToIndex(navigationRoot.lastAriaIndex, focusElements); + } else { + moveFocusToIndex(0, focusElements); + } + } + + /** + * Moves the focus to the specified index within the elements list. + * This will scope the index to the size of the element list if it changed. + * + * @private + * @param {Number} idx Specified index to move to. + * @param {Array} elements Array with dom elements to move focus within. + * @return {Number} Input index or a changed index if it was out of range. + */ + function moveFocusToIndex(idx, elements) { + if (idx < 0) { + idx = elements.length - 1; + } else if (idx >= elements.length) { + idx = 0; + } + + if (elements[idx]) { + elements[idx].focus(); + } + + return idx; + } + + /** + * Moves the focus forwards or backwards. + * + * @private + * @param {Number} dir Direction to move in positive means forward, negative means backwards. + * @param {Array} elements Optional array of elements to move within defaults to the current navigation roots elements. + */ + function moveFocus(dir, elements) { + var idx = -1, navigationRoot = getNavigationRoot(); + + elements = elements || getFocusElements(navigationRoot.getEl()); + + for (var i = 0; i < elements.length; i++) { + if (elements[i] === focusedElement) { + idx = i; + } + } + + idx += dir; + navigationRoot.lastAriaIndex = moveFocusToIndex(idx, elements); + } + + /** + * Moves the focus to the left this is called by the left key. + * + * @private + */ + function left() { + var parentRole = getParentRole(); + + if (parentRole == "tablist") { + moveFocus(-1, getFocusElements(focusedElement.parentNode)); + } else if (focusedControl.parent().submenu) { + cancel(); + } else { + moveFocus(-1); + } + } + + /** + * Moves the focus to the right this is called by the right key. + * + * @private + */ + function right() { + var role = getRole(), parentRole = getParentRole(); + + if (parentRole == "tablist") { + moveFocus(1, getFocusElements(focusedElement.parentNode)); + } else if (role == "menuitem" && parentRole == "menu" && getAriaProp('haspopup')) { + enter(); + } else { + moveFocus(1); + } + } + + /** + * Moves the focus to the up this is called by the up key. + * + * @private + */ + function up() { + moveFocus(-1); + } + + /** + * Moves the focus to the up this is called by the down key. + * + * @private + */ + function down() { + var role = getRole(), parentRole = getParentRole(); + + if (role == "menuitem" && parentRole == "menubar") { + enter(); + } else if (role == "button" && getAriaProp('haspopup')) { + enter({key: 'down'}); + } else { + moveFocus(1); + } + } + + /** + * Moves the focus to the next item or previous item depending on shift key. + * + * @private + * @param {DOMEvent} e DOM event object. + */ + function tab(e) { + var parentRole = getParentRole(); + + if (parentRole == "tablist") { + var elm = getFocusElements(focusedControl.getEl('body'))[0]; + + if (elm) { + elm.focus(); + } + } else { + moveFocus(e.shiftKey ? -1 : 1); + } + } + + /** + * Calls the cancel event on the currently focused control. This is normally done using the Esc key. + * + * @private + */ + function cancel() { + focusedControl.fire('cancel'); + } + + /** + * Calls the click event on the currently focused control. This is normally done using the Enter/Space keys. + * + * @private + * @param {Object} aria Optional aria data to pass along with the enter event. + */ + function enter(aria) { + aria = aria || {}; + focusedControl.fire('click', {target: focusedElement, aria: aria}); + } + + root.on('keydown', function(e) { + function handleNonTabOrEscEvent(e, handler) { + // Ignore non tab keys for text elements + if (isTextInputElement(focusedElement)) { + return; + } + + if (handler(e) !== false) { + e.preventDefault(); + } + } + + if (e.isDefaultPrevented()) { + return; + } + + switch (e.keyCode) { + case 37: // DOM_VK_LEFT + handleNonTabOrEscEvent(e, left); + break; + + case 39: // DOM_VK_RIGHT + handleNonTabOrEscEvent(e, right); + break; + + case 38: // DOM_VK_UP + handleNonTabOrEscEvent(e, up); + break; + + case 40: // DOM_VK_DOWN + handleNonTabOrEscEvent(e, down); + break; + + case 27: // DOM_VK_ESCAPE + cancel(); + break; + + case 14: // DOM_VK_ENTER + case 13: // DOM_VK_RETURN + case 32: // DOM_VK_SPACE + handleNonTabOrEscEvent(e, enter); + break; + + case 9: // DOM_VK_TAB + if (tab(e) !== false) { + e.preventDefault(); + } + break; + } + }); + + root.on('focusin', function(e) { + focusedElement = e.target; + focusedControl = e.control; + }); + + return { + focusFirst: focusFirst + }; + }; +}); + +// Included from: js/tinymce/classes/ui/Container.js + +/** + * Container.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Container control. This is extended by all controls that can have + * children such as panels etc. You can also use this class directly as an + * generic container instance. The container doesn't have any specific role or style. + * + * @-x-less Container.less + * @class tinymce.ui.Container + * @extends tinymce.ui.Control + */ +define("tinymce/ui/Container", [ + "tinymce/ui/Control", + "tinymce/ui/Collection", + "tinymce/ui/Selector", + "tinymce/ui/Factory", + "tinymce/ui/KeyboardNavigation", + "tinymce/util/Tools", + "tinymce/ui/DomUtils" +], function(Control, Collection, Selector, Factory, KeyboardNavigation, Tools, DomUtils) { + "use strict"; + + var selectorCache = {}; + + return Control.extend({ + layout: '', + innerClass: 'container-inner', + + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Array} items Items to add to container in JSON format or control instances. + * @setting {String} layout Layout manager by name to use. + * @setting {Object} defaults Default settings to apply to all items. + */ + init: function(settings) { + var self = this; + + self._super(settings); + settings = self.settings; + self._fixed = settings.fixed; + self._items = new Collection(); + + if (self.isRtl()) { + self.addClass('rtl'); + } + + self.addClass('container'); + self.addClass('container-body', 'body'); + + if (settings.containerCls) { + self.addClass(settings.containerCls); + } + + self._layout = Factory.create((settings.layout || self.layout) + 'layout'); + + if (self.settings.items) { + self.add(self.settings.items); + } + + // TODO: Fix this! + self._hasBody = true; + }, + + /** + * Returns a collection of child items that the container currently have. + * + * @method items + * @return {tinymce.ui.Collection} Control collection direct child controls. + */ + items: function() { + return this._items; + }, + + /** + * Find child controls by selector. + * + * @method find + * @param {String} selector Selector CSS pattern to find children by. + * @return {tinymce.ui.Collection} Control collection with child controls. + */ + find: function(selector) { + selector = selectorCache[selector] = selectorCache[selector] || new Selector(selector); + + return selector.find(this); + }, + + /** + * Adds one or many items to the current container. This will create instances of + * the object representations if needed. + * + * @method add + * @param {Array/Object/tinymce.ui.Control} items Array or item that will be added to the container. + * @return {tinymce.ui.Collection} Current collection control. + */ + add: function(items) { + var self = this; + + self.items().add(self.create(items)).parent(self); + + return self; + }, + + /** + * Focuses the current container instance. This will look + * for the first control in the container and focus that. + * + * @method focus + * @param {Boolean} keyboard Optional true/false if the focus was a keyboard focus or not. + * @return {tinymce.ui.Collection} Current instance. + */ + focus: function(keyboard) { + var self = this, focusCtrl, keyboardNav, items; + + if (keyboard) { + keyboardNav = self.keyboardNav || self.parents().eq(-1)[0].keyboardNav; + + if (keyboardNav) { + keyboardNav.focusFirst(self); + return; + } + } + + items = self.find('*'); + + // TODO: Figure out a better way to auto focus alert dialog buttons + if (self.statusbar) { + items.add(self.statusbar.items()); + } + + items.each(function(ctrl) { + if (ctrl.settings.autofocus) { + focusCtrl = null; + return false; + } + + if (ctrl.canFocus) { + focusCtrl = focusCtrl || ctrl; + } + }); + + if (focusCtrl) { + focusCtrl.focus(); + } + + return self; + }, + + /** + * Replaces the specified child control with a new control. + * + * @method replace + * @param {tinymce.ui.Control} oldItem Old item to be replaced. + * @param {tinymce.ui.Control} newItem New item to be inserted. + */ + replace: function(oldItem, newItem) { + var ctrlElm, items = this.items(), i = items.length; + + // Replace the item in collection + while (i--) { + if (items[i] === oldItem) { + items[i] = newItem; + break; + } + } + + if (i >= 0) { + // Remove new item from DOM + ctrlElm = newItem.getEl(); + if (ctrlElm) { + ctrlElm.parentNode.removeChild(ctrlElm); + } + + // Remove old item from DOM + ctrlElm = oldItem.getEl(); + if (ctrlElm) { + ctrlElm.parentNode.removeChild(ctrlElm); + } + } + + // Adopt the item + newItem.parent(this); + }, + + /** + * Creates the specified items. If any of the items is plain JSON style objects + * it will convert these into real tinymce.ui.Control instances. + * + * @method create + * @param {Array} items Array of items to convert into control instances. + * @return {Array} Array with control instances. + */ + create: function(items) { + var self = this, settings, ctrlItems = []; + + // Non array structure, then force it into an array + if (!Tools.isArray(items)) { + items = [items]; + } + + // Add default type to each child control + Tools.each(items, function(item) { + if (item) { + // Construct item if needed + if (!(item instanceof Control)) { + // Name only then convert it to an object + if (typeof item == "string") { + item = {type: item}; + } + + // Create control instance based on input settings and default settings + settings = Tools.extend({}, self.settings.defaults, item); + item.type = settings.type = settings.type || item.type || self.settings.defaultType || + (settings.defaults ? settings.defaults.type : null); + item = Factory.create(settings); + } + + ctrlItems.push(item); + } + }); + + return ctrlItems; + }, + + /** + * Renders new control instances. + * + * @private + */ + renderNew: function() { + var self = this; + + // Render any new items + self.items().each(function(ctrl, index) { + var containerElm, fragment; + + ctrl.parent(self); + + if (!ctrl._rendered) { + containerElm = self.getEl('body'); + fragment = DomUtils.createFragment(ctrl.renderHtml()); + + // Insert or append the item + if (containerElm.hasChildNodes() && index <= containerElm.childNodes.length - 1) { + containerElm.insertBefore(fragment, containerElm.childNodes[index]); + } else { + containerElm.appendChild(fragment); + } + + ctrl.postRender(); + } + }); + + self._layout.applyClasses(self); + self._lastRect = null; + + return self; + }, + + /** + * Appends new instances to the current container. + * + * @method append + * @param {Array/tinymce.ui.Collection} items Array if controls to append. + * @return {tinymce.ui.Container} Current container instance. + */ + append: function(items) { + return this.add(items).renderNew(); + }, + + /** + * Prepends new instances to the current container. + * + * @method prepend + * @param {Array/tinymce.ui.Collection} items Array if controls to prepend. + * @return {tinymce.ui.Container} Current container instance. + */ + prepend: function(items) { + var self = this; + + self.items().set(self.create(items).concat(self.items().toArray())); + + return self.renderNew(); + }, + + /** + * Inserts an control at a specific index. + * + * @method insert + * @param {Array/tinymce.ui.Collection} items Array if controls to insert. + * @param {Number} index Index to insert controls at. + * @param {Boolean} [before=false] Inserts controls before the index. + */ + insert: function(items, index, before) { + var self = this, curItems, beforeItems, afterItems; + + items = self.create(items); + curItems = self.items(); + + if (!before && index < curItems.length - 1) { + index += 1; + } + + if (index >= 0 && index < curItems.length) { + beforeItems = curItems.slice(0, index).toArray(); + afterItems = curItems.slice(index).toArray(); + curItems.set(beforeItems.concat(items, afterItems)); + } + + return self.renderNew(); + }, + + /** + * Populates the form fields from the specified JSON data object. + * + * Control items in the form that matches the data will have it's value set. + * + * @method fromJSON + * @param {Object} data JSON data object to set control values by. + * @return {tinymce.ui.Container} Current form instance. + */ + fromJSON: function(data) { + var self = this; + + for (var name in data) { + self.find('#' + name).value(data[name]); + } + + return self; + }, + + /** + * Serializes the form into a JSON object by getting all items + * that has a name and a value. + * + * @method toJSON + * @return {Object} JSON object with form data. + */ + toJSON: function() { + var self = this, data = {}; + + self.find('*').each(function(ctrl) { + var name = ctrl.name(), value = ctrl.value(); + + if (name && typeof value != "undefined") { + data[name] = value; + } + }); + + return data; + }, + + preRender: function() { + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, role = this.settings.role; + + self.preRender(); + layout.preRender(self); + + return ( + '

    ' + + '
    ' + + (self.settings.html || '') + layout.renderHtml(self) + + '
    ' + + '
    ' + ); + }, + + /** + * Post render method. Called after the control has been rendered to the target. + * + * @method postRender + * @return {tinymce.ui.Container} Current combobox instance. + */ + postRender: function() { + var self = this, box; + + self.items().exec('postRender'); + self._super(); + + self._layout.postRender(self); + self._rendered = true; + + if (self.settings.style) { + DomUtils.css(self.getEl(), self.settings.style); + } + + if (self.settings.border) { + box = self.borderBox(); + DomUtils.css(self.getEl(), { + 'border-top-width': box.top, + 'border-right-width': box.right, + 'border-bottom-width': box.bottom, + 'border-left-width': box.left + }); + } + + if (!self.parent()) { + self.keyboardNav = new KeyboardNavigation({ + root: self + }); + } + + return self; + }, + + /** + * Initializes the current controls layout rect. + * This will be executed by the layout managers to determine the + * default minWidth/minHeight etc. + * + * @method initLayoutRect + * @return {Object} Layout rect instance. + */ + initLayoutRect: function() { + var self = this, layoutRect = self._super(); + + // Recalc container size by asking layout manager + self._layout.recalc(self); + + return layoutRect; + }, + + /** + * Recalculates the positions of the controls in the current container. + * This is invoked by the reflow method and shouldn't be called directly. + * + * @method recalc + */ + recalc: function() { + var self = this, rect = self._layoutRect, lastRect = self._lastRect; + + if (!lastRect || lastRect.w != rect.w || lastRect.h != rect.h) { + self._layout.recalc(self); + rect = self.layoutRect(); + self._lastRect = {x: rect.x, y: rect.y, w: rect.w, h: rect.h}; + return true; + } + }, + + /** + * Reflows the current container and it's children and possible parents. + * This should be used after you for example append children to the current control so + * that the layout managers know that they need to reposition everything. + * + * @example + * container.append({type: 'button', text: 'My button'}).reflow(); + * + * @method reflow + * @return {tinymce.ui.Container} Current container instance. + */ + reflow: function() { + var i; + + if (this.visible()) { + Control.repaintControls = []; + Control.repaintControls.map = {}; + + this.recalc(); + i = Control.repaintControls.length; + + while (i--) { + Control.repaintControls[i].repaint(); + } + + // TODO: Fix me! + if (this.settings.layout !== "flow" && this.settings.layout !== "stack") { + this.repaint(); + } + + Control.repaintControls = []; + } + + return this; + } + }); +}); + +// Included from: js/tinymce/classes/ui/DragHelper.js + +/** + * DragHelper.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Drag/drop helper class. + * + * @example + * var dragHelper = new tinymce.ui.DragHelper('mydiv', { + * start: function(evt) { + * }, + * + * drag: function(evt) { + * }, + * + * end: function(evt) { + * } + * }); + * + * @class tinymce.ui.DragHelper + */ +define("tinymce/ui/DragHelper", [ + "tinymce/ui/DomUtils" +], function(DomUtils) { + "use strict"; + + function getDocumentSize() { + var doc = document, documentElement, body, scrollWidth, clientWidth; + var offsetWidth, scrollHeight, clientHeight, offsetHeight, max = Math.max; + + documentElement = doc.documentElement; + body = doc.body; + + scrollWidth = max(documentElement.scrollWidth, body.scrollWidth); + clientWidth = max(documentElement.clientWidth, body.clientWidth); + offsetWidth = max(documentElement.offsetWidth, body.offsetWidth); + + scrollHeight = max(documentElement.scrollHeight, body.scrollHeight); + clientHeight = max(documentElement.clientHeight, body.clientHeight); + offsetHeight = max(documentElement.offsetHeight, body.offsetHeight); + + return { + width: scrollWidth < offsetWidth ? clientWidth : scrollWidth, + height: scrollHeight < offsetHeight ? clientHeight : scrollHeight + }; + } + + return function(id, settings) { + var eventOverlayElm, doc = document, downButton, start, stop, drag, startX, startY; + + settings = settings || {}; + + function getHandleElm() { + return doc.getElementById(settings.handle || id); + } + + start = function(e) { + var docSize = getDocumentSize(), handleElm, cursor; + + e.preventDefault(); + downButton = e.button; + handleElm = getHandleElm(); + startX = e.screenX; + startY = e.screenY; + + // Grab cursor from handle + if (window.getComputedStyle) { + cursor = window.getComputedStyle(handleElm, null).getPropertyValue("cursor"); + } else { + cursor = handleElm.runtimeStyle.cursor; + } + + // Create event overlay and add it to document + eventOverlayElm = doc.createElement('div'); + DomUtils.css(eventOverlayElm, { + position: "absolute", + top: 0, left: 0, + width: docSize.width, + height: docSize.height, + zIndex: 0x7FFFFFFF, + opacity: 0.0001, + cursor: cursor + }); + + doc.body.appendChild(eventOverlayElm); + + // Bind mouse events + DomUtils.on(doc, 'mousemove', drag); + DomUtils.on(doc, 'mouseup', stop); + + // Begin drag + settings.start(e); + }; + + drag = function(e) { + if (e.button !== downButton) { + return stop(e); + } + + e.deltaX = e.screenX - startX; + e.deltaY = e.screenY - startY; + + e.preventDefault(); + settings.drag(e); + }; + + stop = function(e) { + DomUtils.off(doc, 'mousemove', drag); + DomUtils.off(doc, 'mouseup', stop); + + eventOverlayElm.parentNode.removeChild(eventOverlayElm); + + if (settings.stop) { + settings.stop(e); + } + }; + + /** + * Destroys the drag/drop helper instance. + * + * @method destroy + */ + this.destroy = function() { + DomUtils.off(getHandleElm()); + }; + + DomUtils.on(getHandleElm(), 'mousedown', start); + }; +}); + +// Included from: js/tinymce/classes/ui/Scrollable.js + +/** + * Scrollable.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This mixin makes controls scrollable using custom scrollbars. + * + * @-x-less Scrollable.less + * @mixin tinymce.ui.Scrollable + */ +define("tinymce/ui/Scrollable", [ + "tinymce/ui/DomUtils", + "tinymce/ui/DragHelper" +], function(DomUtils, DragHelper) { + "use strict"; + + return { + init: function() { + var self = this; + self.on('repaint', self.renderScroll); + }, + + renderScroll: function() { + var self = this, margin = 2; + + function repaintScroll() { + var hasScrollH, hasScrollV, bodyElm; + + function repaintAxis(axisName, posName, sizeName, contentSizeName, hasScroll, ax) { + var containerElm, scrollBarElm, scrollThumbElm; + var containerSize, scrollSize, ratio, rect; + var posNameLower, sizeNameLower; + + scrollBarElm = self.getEl('scroll' + axisName); + if (scrollBarElm) { + posNameLower = posName.toLowerCase(); + sizeNameLower = sizeName.toLowerCase(); + + if (self.getEl('absend')) { + DomUtils.css(self.getEl('absend'), posNameLower, self.layoutRect()[contentSizeName] - 1); + } + + if (!hasScroll) { + DomUtils.css(scrollBarElm, 'display', 'none'); + return; + } + + DomUtils.css(scrollBarElm, 'display', 'block'); + containerElm = self.getEl('body'); + scrollThumbElm = self.getEl('scroll' + axisName + "t"); + containerSize = containerElm["client" + sizeName] - (margin * 2); + containerSize -= hasScrollH && hasScrollV ? scrollBarElm["client" + ax] : 0; + scrollSize = containerElm["scroll" + sizeName]; + ratio = containerSize / scrollSize; + + rect = {}; + rect[posNameLower] = containerElm["offset" + posName] + margin; + rect[sizeNameLower] = containerSize; + DomUtils.css(scrollBarElm, rect); + + rect = {}; + rect[posNameLower] = containerElm["scroll" + posName] * ratio; + rect[sizeNameLower] = containerSize * ratio; + DomUtils.css(scrollThumbElm, rect); + } + } + + bodyElm = self.getEl('body'); + hasScrollH = bodyElm.scrollWidth > bodyElm.clientWidth; + hasScrollV = bodyElm.scrollHeight > bodyElm.clientHeight; + + repaintAxis("h", "Left", "Width", "contentW", hasScrollH, "Height"); + repaintAxis("v", "Top", "Height", "contentH", hasScrollV, "Width"); + } + + function addScroll() { + function addScrollAxis(axisName, posName, sizeName, deltaPosName, ax) { + var scrollStart, axisId = self._id + '-scroll' + axisName, prefix = self.classPrefix; + + self.getEl().appendChild(DomUtils.createFragment( + '
    ' + + '
    ' + + '
    ' + )); + + self.draghelper = new DragHelper(axisId + 't', { + start: function() { + scrollStart = self.getEl('body')["scroll" + posName]; + DomUtils.addClass(DomUtils.get(axisId), prefix + 'active'); + }, + + drag: function(e) { + var ratio, hasScrollH, hasScrollV, containerSize, layoutRect = self.layoutRect(); + + hasScrollH = layoutRect.contentW > layoutRect.innerW; + hasScrollV = layoutRect.contentH > layoutRect.innerH; + containerSize = self.getEl('body')["client" + sizeName] - (margin * 2); + containerSize -= hasScrollH && hasScrollV ? self.getEl('scroll' + axisName)["client" + ax] : 0; + + ratio = containerSize / self.getEl('body')["scroll" + sizeName]; + self.getEl('body')["scroll" + posName] = scrollStart + (e["delta" + deltaPosName] / ratio); + }, + + stop: function() { + DomUtils.removeClass(DomUtils.get(axisId), prefix + 'active'); + } + }); +/* + self.on('click', function(e) { + if (e.target.id == self._id + '-scrollv') { + + } + });*/ + } + + self.addClass('scroll'); + + addScrollAxis("v", "Top", "Height", "Y", "Width"); + addScrollAxis("h", "Left", "Width", "X", "Height"); + } + + if (self.settings.autoScroll) { + if (!self._hasScroll) { + self._hasScroll = true; + addScroll(); + + self.on('wheel', function(e) { + var bodyEl = self.getEl('body'); + + bodyEl.scrollLeft += (e.deltaX || 0) * 10; + bodyEl.scrollTop += e.deltaY * 10; + + repaintScroll(); + }); + + DomUtils.on(self.getEl('body'), "scroll", repaintScroll); + } + + repaintScroll(); + } + } + }; +}); + +// Included from: js/tinymce/classes/ui/Panel.js + +/** + * Panel.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new panel. + * + * @-x-less Panel.less + * @class tinymce.ui.Panel + * @extends tinymce.ui.Container + * @mixes tinymce.ui.Scrollable + */ +define("tinymce/ui/Panel", [ + "tinymce/ui/Container", + "tinymce/ui/Scrollable" +], function(Container, Scrollable) { + "use strict"; + + return Container.extend({ + Defaults: { + layout: 'fit', + containerCls: 'panel' + }, + + Mixins: [Scrollable], + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, innerHtml = self.settings.html; + + self.preRender(); + layout.preRender(self); + + if (typeof innerHtml == "undefined") { + innerHtml = ( + '
    ' + + layout.renderHtml(self) + + '
    ' + ); + } else { + if (typeof innerHtml == 'function') { + innerHtml = innerHtml.call(self); + } + + self._hasBody = false; + } + + return ( + '
    ' + + (self._preBodyHtml || '') + + innerHtml + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/Movable.js + +/** + * Movable.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Movable mixin. Makes controls movable absolute and relative to other elements. + * + * @mixin tinymce.ui.Movable + */ +define("tinymce/ui/Movable", [ + "tinymce/ui/DomUtils" +], function(DomUtils) { + "use strict"; + + function calculateRelativePosition(ctrl, targetElm, rel) { + var ctrlElm, pos, x, y, selfW, selfH, targetW, targetH, viewport, size; + + viewport = DomUtils.getViewPort(); + + // Get pos of target + pos = DomUtils.getPos(targetElm); + x = pos.x; + y = pos.y; + + if (ctrl._fixed && DomUtils.getRuntimeStyle(document.body, 'position') == 'static') { + x -= viewport.x; + y -= viewport.y; + } + + // Get size of self + ctrlElm = ctrl.getEl(); + size = DomUtils.getSize(ctrlElm); + selfW = size.width; + selfH = size.height; + + // Get size of target + size = DomUtils.getSize(targetElm); + targetW = size.width; + targetH = size.height; + + // Parse align string + rel = (rel || '').split(''); + + // Target corners + if (rel[0] === 'b') { + y += targetH; + } + + if (rel[1] === 'r') { + x += targetW; + } + + if (rel[0] === 'c') { + y += Math.round(targetH / 2); + } + + if (rel[1] === 'c') { + x += Math.round(targetW / 2); + } + + // Self corners + if (rel[3] === 'b') { + y -= selfH; + } + + if (rel[4] === 'r') { + x -= selfW; + } + + if (rel[3] === 'c') { + y -= Math.round(selfH / 2); + } + + if (rel[4] === 'c') { + x -= Math.round(selfW / 2); + } + + return { + x: x, + y: y, + w: selfW, + h: selfH + }; + } + + return { + /** + * Tests various positions to get the most suitable one. + * + * @method testMoveRel + * @param {DOMElement} elm Element to position against. + * @param {Array} rels Array with relative positions. + * @return {String} Best suitable relative position. + */ + testMoveRel: function(elm, rels) { + var viewPortRect = DomUtils.getViewPort(); + + for (var i = 0; i < rels.length; i++) { + var pos = calculateRelativePosition(this, elm, rels[i]); + + if (this._fixed) { + if (pos.x > 0 && pos.x + pos.w < viewPortRect.w && pos.y > 0 && pos.y + pos.h < viewPortRect.h) { + return rels[i]; + } + } else { + if (pos.x > viewPortRect.x && pos.x + pos.w < viewPortRect.w + viewPortRect.x && + pos.y > viewPortRect.y && pos.y + pos.h < viewPortRect.h + viewPortRect.y) { + return rels[i]; + } + } + } + + return rels[0]; + }, + + /** + * Move relative to the specified element. + * + * @method moveRel + * @param {Element} elm Element to move relative to. + * @param {String} rel Relative mode. For example: br-tl. + * @return {tinymce.ui.Control} Current control instance. + */ + moveRel: function(elm, rel) { + if (typeof rel != 'string') { + rel = this.testMoveRel(elm, rel); + } + + var pos = calculateRelativePosition(this, elm, rel); + return this.moveTo(pos.x, pos.y); + }, + + /** + * Move by a relative x, y values. + * + * @method moveBy + * @param {Number} dx Relative x position. + * @param {Number} dy Relative y position. + * @return {tinymce.ui.Control} Current control instance. + */ + moveBy: function(dx, dy) { + var self = this, rect = self.layoutRect(); + + self.moveTo(rect.x + dx, rect.y + dy); + + return self; + }, + + /** + * Move to absolute position. + * + * @method moveTo + * @param {Number} x Absolute x position. + * @param {Number} y Absolute y position. + * @return {tinymce.ui.Control} Current control instance. + */ + moveTo: function(x, y) { + var self = this; + + // TODO: Move this to some global class + function contrain(value, max, size) { + if (value < 0) { + return 0; + } + + if (value + size > max) { + value = max - size; + return value < 0 ? 0 : value; + } + + return value; + } + + if (self.settings.constrainToViewport) { + var viewPortRect = DomUtils.getViewPort(window); + var layoutRect = self.layoutRect(); + + x = contrain(x, viewPortRect.w + viewPortRect.x, layoutRect.w); + y = contrain(y, viewPortRect.h + viewPortRect.y, layoutRect.h); + } + + if (self._rendered) { + self.layoutRect({x: x, y: y}).repaint(); + } else { + self.settings.x = x; + self.settings.y = y; + } + + self.fire('move', {x: x, y: y}); + + return self; + } + }; +}); + +// Included from: js/tinymce/classes/ui/Resizable.js + +/** + * Resizable.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Resizable mixin. Enables controls to be resized. + * + * @mixin tinymce.ui.Resizable + */ +define("tinymce/ui/Resizable", [ + "tinymce/ui/DomUtils" +], function(DomUtils) { + "use strict"; + + return { + /** + * Resizes the control to contents. + * + * @method resizeToContent + */ + resizeToContent: function() { + this._layoutRect.autoResize = true; + this._lastRect = null; + this.reflow(); + }, + + /** + * Resizes the control to a specific width/height. + * + * @method resizeTo + * @param {Number} w Control width. + * @param {Number} h Control height. + * @return {tinymce.ui.Control} Current control instance. + */ + resizeTo: function(w, h) { + // TODO: Fix hack + if (w <= 1 || h <= 1) { + var rect = DomUtils.getWindowSize(); + + w = w <= 1 ? w * rect.w : w; + h = h <= 1 ? h * rect.h : h; + } + + this._layoutRect.autoResize = false; + return this.layoutRect({minW: w, minH: h, w: w, h: h}).reflow(); + }, + + /** + * Resizes the control to a specific relative width/height. + * + * @method resizeBy + * @param {Number} dw Relative control width. + * @param {Number} dh Relative control height. + * @return {tinymce.ui.Control} Current control instance. + */ + resizeBy: function(dw, dh) { + var self = this, rect = self.layoutRect(); + + return self.resizeTo(rect.w + dw, rect.h + dh); + } + }; +}); + +// Included from: js/tinymce/classes/ui/FloatPanel.js + +/** + * FloatPanel.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a floating panel. + * + * @-x-less FloatPanel.less + * @class tinymce.ui.FloatPanel + * @extends tinymce.ui.Panel + * @mixes tinymce.ui.Movable + * @mixes tinymce.ui.Resizable + */ +define("tinymce/ui/FloatPanel", [ + "tinymce/ui/Panel", + "tinymce/ui/Movable", + "tinymce/ui/Resizable", + "tinymce/ui/DomUtils" +], function(Panel, Movable, Resizable, DomUtils) { + "use strict"; + + var documentClickHandler, documentScrollHandler, windowResizeHandler, visiblePanels = []; + var zOrder = [], hasModal; + + function bindDocumentClickHandler() { + function isChildOf(ctrl, parent) { + while (ctrl) { + if (ctrl == parent) { + return true; + } + + ctrl = ctrl.parent(); + } + } + + if (!documentClickHandler) { + documentClickHandler = function(e) { + // Gecko fires click event and in the wrong order on Mac so lets normalize + if (e.button == 2) { + return; + } + + // Hide any float panel when a click is out side that float panel and the + // float panels direct parent for example a click on a menu button + var i = visiblePanels.length; + while (i--) { + var panel = visiblePanels[i], clickCtrl = panel.getParentCtrl(e.target); + + if (panel.settings.autohide) { + if (clickCtrl) { + if (isChildOf(clickCtrl, panel) || panel.parent() === clickCtrl) { + continue; + } + } + + e = panel.fire('autohide', {target: e.target}); + if (!e.isDefaultPrevented()) { + panel.hide(); + } + } + } + }; + + DomUtils.on(document, 'click', documentClickHandler); + } + } + + function bindDocumentScrollHandler() { + if (!documentScrollHandler) { + documentScrollHandler = function() { + var i; + + i = visiblePanels.length; + while (i--) { + repositionPanel(visiblePanels[i]); + } + }; + + DomUtils.on(window, 'scroll', documentScrollHandler); + } + } + + function bindWindowResizeHandler() { + if (!windowResizeHandler) { + var docElm = document.documentElement, clientWidth = docElm.clientWidth, clientHeight = docElm.clientHeight; + + windowResizeHandler = function() { + // Workaround for #7065 IE 7 fires resize events event though the window wasn't resized + if (!document.all || clientWidth != docElm.clientWidth || clientHeight != docElm.clientHeight) { + clientWidth = docElm.clientWidth; + clientHeight = docElm.clientHeight; + FloatPanel.hideAll(); + } + }; + + DomUtils.on(window, 'resize', windowResizeHandler); + } + } + + /** + * Repositions the panel to the top of page if the panel is outside of the visual viewport. It will + * also reposition all child panels of the current panel. + */ + function repositionPanel(panel) { + var scrollY = DomUtils.getViewPort().y; + + function toggleFixedChildPanels(fixed, deltaY) { + var parent; + + for (var i = 0; i < visiblePanels.length; i++) { + if (visiblePanels[i] != panel) { + parent = visiblePanels[i].parent(); + + while (parent && (parent = parent.parent())) { + if (parent == panel) { + visiblePanels[i].fixed(fixed).moveBy(0, deltaY).repaint(); + } + } + } + } + } + + if (panel.settings.autofix) { + if (!panel._fixed) { + panel._autoFixY = panel.layoutRect().y; + + if (panel._autoFixY < scrollY) { + panel.fixed(true).layoutRect({y: 0}).repaint(); + toggleFixedChildPanels(true, scrollY - panel._autoFixY); + } + } else { + if (panel._autoFixY > scrollY) { + panel.fixed(false).layoutRect({y: panel._autoFixY}).repaint(); + toggleFixedChildPanels(false, panel._autoFixY - scrollY); + } + } + } + } + + function addRemove(add, ctrl) { + var i, zIndex = FloatPanel.zIndex || 0xFFFF, topModal; + + if (add) { + zOrder.push(ctrl); + } else { + i = zOrder.length; + + while (i--) { + if (zOrder[i] === ctrl) { + zOrder.splice(i, 1); + } + } + } + + if (zOrder.length) { + for (i = 0; i < zOrder.length; i++) { + if (zOrder[i].modal) { + zIndex++; + topModal = zOrder[i]; + } + + zOrder[i].getEl().style.zIndex = zIndex; + zOrder[i].zIndex = zIndex; + zIndex++; + } + } + + var modalBlockEl = document.getElementById(ctrl.classPrefix + 'modal-block'); + + if (topModal) { + DomUtils.css(modalBlockEl, 'z-index', topModal.zIndex - 1); + } else if (modalBlockEl) { + modalBlockEl.parentNode.removeChild(modalBlockEl); + hasModal = false; + } + + FloatPanel.currentZIndex = zIndex; + } + + var FloatPanel = Panel.extend({ + Mixins: [Movable, Resizable], + + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Boolean} autohide Automatically hide the panel. + */ + init: function(settings) { + var self = this; + + self._super(settings); + self._eventsRoot = self; + + self.addClass('floatpanel'); + + // Hide floatpanes on click out side the root button + if (settings.autohide) { + bindDocumentClickHandler(); + bindWindowResizeHandler(); + visiblePanels.push(self); + } + + if (settings.autofix) { + bindDocumentScrollHandler(); + + self.on('move', function() { + repositionPanel(this); + }); + } + + self.on('postrender show', function(e) { + if (e.control == self) { + var modalBlockEl, prefix = self.classPrefix; + + if (self.modal && !hasModal) { + modalBlockEl = DomUtils.createFragment('
    '); + modalBlockEl = modalBlockEl.firstChild; + + self.getContainerElm().appendChild(modalBlockEl); + + setTimeout(function() { + DomUtils.addClass(modalBlockEl, prefix + 'in'); + DomUtils.addClass(self.getEl(), prefix + 'in'); + }, 0); + + hasModal = true; + } + + addRemove(true, self); + } + }); + + self.on('show', function() { + self.parents().each(function(ctrl) { + if (ctrl._fixed) { + self.fixed(true); + return false; + } + }); + }); + + if (settings.popover) { + self._preBodyHtml = '
    '; + self.addClass('popover').addClass('bottom').addClass(self.isRtl() ? 'end' : 'start'); + } + }, + + fixed: function(state) { + var self = this; + + if (self._fixed != state) { + if (self._rendered) { + var viewport = DomUtils.getViewPort(); + + if (state) { + self.layoutRect().y -= viewport.y; + } else { + self.layoutRect().y += viewport.y; + } + } + + self.toggleClass('fixed', state); + self._fixed = state; + } + + return self; + }, + + /** + * Shows the current float panel. + * + * @method show + * @return {tinymce.ui.FloatPanel} Current floatpanel instance. + */ + show: function() { + var self = this, i, state = self._super(); + + i = visiblePanels.length; + while (i--) { + if (visiblePanels[i] === self) { + break; + } + } + + if (i === -1) { + visiblePanels.push(self); + } + + return state; + }, + + /** + * Hides the current float panel. + * + * @method hide + * @return {tinymce.ui.FloatPanel} Current floatpanel instance. + */ + hide: function() { + removeVisiblePanel(this); + addRemove(false, this); + + return this._super(); + }, + + /** + * Hide all visible float panels with he autohide setting enabled. This is for + * manually hiding floating menus or panels. + * + * @method hideAll + */ + hideAll: function() { + FloatPanel.hideAll(); + }, + + /** + * Closes the float panel. This will remove the float panel from page and fire the close event. + * + * @method close + */ + close: function() { + var self = this; + + if (!self.fire('close').isDefaultPrevented()) { + self.remove(); + addRemove(false, self); + } + + return self; + }, + + /** + * Removes the float panel from page. + * + * @method remove + */ + remove: function() { + removeVisiblePanel(this); + this._super(); + }, + + postRender: function() { + var self = this; + + if (self.settings.bodyRole) { + this.getEl('body').setAttribute('role', self.settings.bodyRole); + } + + return self._super(); + } + }); + + /** + * Hide all visible float panels with he autohide setting enabled. This is for + * manually hiding floating menus or panels. + * + * @static + * @method hideAll + */ + FloatPanel.hideAll = function() { + var i = visiblePanels.length; + + while (i--) { + var panel = visiblePanels[i]; + + if (panel && panel.settings.autohide) { + panel.hide(); + visiblePanels.splice(i, 1); + } + } + }; + + function removeVisiblePanel(panel) { + var i; + + i = visiblePanels.length; + while (i--) { + if (visiblePanels[i] === panel) { + visiblePanels.splice(i, 1); + } + } + + i = zOrder.length; + while (i--) { + if (zOrder[i] === panel) { + zOrder.splice(i, 1); + } + } + } + + return FloatPanel; +}); + +// Included from: js/tinymce/classes/ui/Window.js + +/** + * Window.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new window. + * + * @-x-less Window.less + * @class tinymce.ui.Window + * @extends tinymce.ui.FloatPanel + */ +define("tinymce/ui/Window", [ + "tinymce/ui/FloatPanel", + "tinymce/ui/Panel", + "tinymce/ui/DomUtils", + "tinymce/ui/DragHelper" +], function(FloatPanel, Panel, DomUtils, DragHelper) { + "use strict"; + + var Window = FloatPanel.extend({ + modal: true, + + Defaults: { + border: 1, + layout: 'flex', + containerCls: 'panel', + role: 'dialog', + callbacks: { + submit: function() { + this.fire('submit', {data: this.toJSON()}); + }, + + close: function() { + this.close(); + } + } + }, + + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this; + + self._super(settings); + + if (self.isRtl()) { + self.addClass('rtl'); + } + + self.addClass('window'); + self._fixed = true; + + // Create statusbar + if (settings.buttons) { + self.statusbar = new Panel({ + layout: 'flex', + border: '1 0 0 0', + spacing: 3, + padding: 10, + align: 'center', + pack: self.isRtl() ? 'start' : 'end', + defaults: { + type: 'button' + }, + items: settings.buttons + }); + + self.statusbar.addClass('foot'); + self.statusbar.parent(self); + } + + self.on('click', function(e) { + if (e.target.className.indexOf(self.classPrefix + 'close') != -1) { + self.close(); + } + }); + + self.on('cancel', function() { + self.close(); + }); + + self.aria('describedby', self.describedBy || self._id + '-none'); + self.aria('label', settings.title); + self._fullscreen = false; + }, + + /** + * Recalculates the positions of the controls in the current container. + * This is invoked by the reflow method and shouldn't be called directly. + * + * @method recalc + */ + recalc: function() { + var self = this, statusbar = self.statusbar, layoutRect, width, x, needsRecalc; + + if (self._fullscreen) { + self.layoutRect(DomUtils.getWindowSize()); + self.layoutRect().contentH = self.layoutRect().innerH; + } + + self._super(); + + layoutRect = self.layoutRect(); + + // Resize window based on title width + if (self.settings.title && !self._fullscreen) { + width = layoutRect.headerW; + if (width > layoutRect.w) { + x = layoutRect.x - Math.max(0, width / 2); + self.layoutRect({w: width, x: x}); + needsRecalc = true; + } + } + + // Resize window based on statusbar width + if (statusbar) { + statusbar.layoutRect({w: self.layoutRect().innerW}).recalc(); + + width = statusbar.layoutRect().minW + layoutRect.deltaW; + if (width > layoutRect.w) { + x = layoutRect.x - Math.max(0, width - layoutRect.w); + self.layoutRect({w: width, x: x}); + needsRecalc = true; + } + } + + // Recalc body and disable auto resize + if (needsRecalc) { + self.recalc(); + } + }, + + /** + * Initializes the current controls layout rect. + * This will be executed by the layout managers to determine the + * default minWidth/minHeight etc. + * + * @method initLayoutRect + * @return {Object} Layout rect instance. + */ + initLayoutRect: function() { + var self = this, layoutRect = self._super(), deltaH = 0, headEl; + + // Reserve vertical space for title + if (self.settings.title && !self._fullscreen) { + headEl = self.getEl('head'); + + var size = DomUtils.getSize(headEl); + + layoutRect.headerW = size.width; + layoutRect.headerH = size.height; + + deltaH += layoutRect.headerH; + } + + // Reserve vertical space for statusbar + if (self.statusbar) { + deltaH += self.statusbar.layoutRect().h; + } + + layoutRect.deltaH += deltaH; + layoutRect.minH += deltaH; + //layoutRect.innerH -= deltaH; + layoutRect.h += deltaH; + + var rect = DomUtils.getWindowSize(); + + layoutRect.x = Math.max(0, rect.w / 2 - layoutRect.w / 2); + layoutRect.y = Math.max(0, rect.h / 2 - layoutRect.h / 2); + + return layoutRect; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, id = self._id, prefix = self.classPrefix; + var settings = self.settings, headerHtml = '', footerHtml = '', html = settings.html; + + self.preRender(); + layout.preRender(self); + + if (settings.title) { + headerHtml = ( + '
    ' + + '
    ' + self.encode(settings.title) + '
    ' + + '' + + '
    ' + + '
    ' + ); + } + + if (settings.url) { + html = ''; + } + + if (typeof html == "undefined") { + html = layout.renderHtml(self); + } + + if (self.statusbar) { + footerHtml = self.statusbar.renderHtml(); + } + + return ( + '
    ' + + '
    ' + + headerHtml + + '
    ' + + html + + '
    ' + + footerHtml + + '
    ' + + '
    ' + ); + }, + + /** + * Switches the window fullscreen mode. + * + * @method fullscreen + * @param {Boolean} state True/false state. + * @return {tinymce.ui.Window} Current window instance. + */ + fullscreen: function(state) { + var self = this, documentElement = document.documentElement, slowRendering, prefix = self.classPrefix, layoutRect; + + if (state != self._fullscreen) { + DomUtils.on(window, 'resize', function() { + var time; + + if (self._fullscreen) { + // Time the layout time if it's to slow use a timeout to not hog the CPU + if (!slowRendering) { + time = new Date().getTime(); + + var rect = DomUtils.getWindowSize(); + self.moveTo(0, 0).resizeTo(rect.w, rect.h); + + if ((new Date().getTime()) - time > 50) { + slowRendering = true; + } + } else { + if (!self._timer) { + self._timer = setTimeout(function() { + var rect = DomUtils.getWindowSize(); + self.moveTo(0, 0).resizeTo(rect.w, rect.h); + + self._timer = 0; + }, 50); + } + } + } + }); + + layoutRect = self.layoutRect(); + self._fullscreen = state; + + if (!state) { + self._borderBox = self.parseBox(self.settings.border); + self.getEl('head').style.display = ''; + layoutRect.deltaH += layoutRect.headerH; + DomUtils.removeClass(documentElement, prefix + 'fullscreen'); + DomUtils.removeClass(document.body, prefix + 'fullscreen'); + self.removeClass('fullscreen'); + self.moveTo(self._initial.x, self._initial.y).resizeTo(self._initial.w, self._initial.h); + } else { + self._initial = {x: layoutRect.x, y: layoutRect.y, w: layoutRect.w, h: layoutRect.h}; + + self._borderBox = self.parseBox('0'); + self.getEl('head').style.display = 'none'; + layoutRect.deltaH -= layoutRect.headerH + 2; + DomUtils.addClass(documentElement, prefix + 'fullscreen'); + DomUtils.addClass(document.body, prefix + 'fullscreen'); + self.addClass('fullscreen'); + + var rect = DomUtils.getWindowSize(); + self.moveTo(0, 0).resizeTo(rect.w, rect.h); + } + } + + return self.reflow(); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this, startPos; + + setTimeout(function() { + self.addClass('in'); + }, 0); + + self._super(); + + if (self.statusbar) { + self.statusbar.postRender(); + } + + self.focus(); + + this.dragHelper = new DragHelper(self._id + '-dragh', { + start: function() { + startPos = { + x: self.layoutRect().x, + y: self.layoutRect().y + }; + }, + + drag: function(e) { + self.moveTo(startPos.x + e.deltaX, startPos.y + e.deltaY); + } + }); + + self.on('submit', function(e) { + if (!e.isDefaultPrevented()) { + self.close(); + } + }); + }, + + /** + * Fires a submit event with the serialized form. + * + * @method submit + * @return {Object} Event arguments object. + */ + submit: function() { + return this.fire('submit', {data: this.toJSON()}); + }, + + /** + * Removes the current control from DOM and from UI collections. + * + * @method remove + * @return {tinymce.ui.Control} Current control instance. + */ + remove: function() { + var self = this, prefix = self.classPrefix; + + self.dragHelper.destroy(); + self._super(); + + if (self.statusbar) { + this.statusbar.remove(); + } + + if (self._fullscreen) { + DomUtils.removeClass(document.documentElement, prefix + 'fullscreen'); + DomUtils.removeClass(document.body, prefix + 'fullscreen'); + } + }, + + /** + * Returns the contentWindow object of the iframe if it exists. + * + * @method getContentWindow + * @return {Window} window object or null. + */ + getContentWindow: function() { + var ifr = this.getEl().getElementsByTagName('iframe')[0]; + return ifr ? ifr.contentWindow : null; + } + }); + + return Window; +}); + +// Included from: js/tinymce/classes/ui/MessageBox.js + +/** + * MessageBox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is used to create MessageBoxes like alerts/confirms etc. + * + * @class tinymce.ui.MessageBox + * @extends tinymce.ui.Window + */ +define("tinymce/ui/MessageBox", [ + "tinymce/ui/Window" +], function(Window) { + "use strict"; + + var MessageBox = Window.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + settings = { + border: 1, + padding: 20, + layout: 'flex', + pack: "center", + align: "center", + containerCls: 'panel', + autoScroll: true, + buttons: {type: "button", text: "Ok", action: "ok"}, + items: { + type: "label", + multiline: true, + maxWidth: 500, + maxHeight: 200 + } + }; + + this._super(settings); + }, + + Statics: { + /** + * Ok buttons constant. + * + * @static + * @final + * @field {Number} OK + */ + OK: 1, + + /** + * Ok/cancel buttons constant. + * + * @static + * @final + * @field {Number} OK_CANCEL + */ + OK_CANCEL: 2, + + /** + * yes/no buttons constant. + * + * @static + * @final + * @field {Number} YES_NO + */ + YES_NO: 3, + + /** + * yes/no/cancel buttons constant. + * + * @static + * @final + * @field {Number} YES_NO_CANCEL + */ + YES_NO_CANCEL: 4, + + /** + * Constructs a new message box and renders it to the body element. + * + * @static + * @method msgBox + * @param {Object} settings Name/value object with settings. + */ + msgBox: function(settings) { + var buttons, callback = settings.callback || function() {}; + + function createButton(text, status, primary) { + return { + type: "button", + text: text, + subtype: primary ? 'primary' : '', + onClick: function(e) { + e.control.parents()[1].close(); + callback(status); + } + }; + } + + switch (settings.buttons) { + case MessageBox.OK_CANCEL: + buttons = [ + createButton('Ok', true, true), + createButton('Cancel', false) + ]; + break; + + case MessageBox.YES_NO: + case MessageBox.YES_NO_CANCEL: + buttons = [ + createButton('Yes', 1, true), + createButton('No', 0) + ]; + + if (settings.buttons == MessageBox.YES_NO_CANCEL) { + buttons.push(createButton('Cancel', -1)); + } + break; + + default: + buttons = [ + createButton('Ok', true, true) + ]; + break; + } + + return new Window({ + padding: 20, + x: settings.x, + y: settings.y, + minWidth: 300, + minHeight: 100, + layout: "flex", + pack: "center", + align: "center", + buttons: buttons, + title: settings.title, + role: 'alertdialog', + items: { + type: "label", + multiline: true, + maxWidth: 500, + maxHeight: 200, + text: settings.text + }, + onPostRender: function() { + this.aria('describedby', this.items()[0]._id); + }, + onClose: settings.onClose, + onCancel: function() { + callback(false); + } + }).renderTo(document.body).reflow(); + }, + + /** + * Creates a new alert dialog. + * + * @method alert + * @param {Object} settings Settings for the alert dialog. + * @param {function} [callback] Callback to execute when the user makes a choice. + */ + alert: function(settings, callback) { + if (typeof settings == "string") { + settings = {text: settings}; + } + + settings.callback = callback; + return MessageBox.msgBox(settings); + }, + + /** + * Creates a new confirm dialog. + * + * @method confirm + * @param {Object} settings Settings for the confirm dialog. + * @param {function} [callback] Callback to execute when the user makes a choice. + */ + confirm: function(settings, callback) { + if (typeof settings == "string") { + settings = {text: settings}; + } + + settings.callback = callback; + settings.buttons = MessageBox.OK_CANCEL; + + return MessageBox.msgBox(settings); + } + } + }); + + return MessageBox; +}); + +// Included from: js/tinymce/classes/WindowManager.js + +/** + * WindowManager.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class handles the creation of native windows and dialogs. This class can be extended to provide for example inline dialogs. + * + * @class tinymce.WindowManager + * @example + * // Opens a new dialog with the file.htm file and the size 320x240 + * // It also adds a custom parameter this can be retrieved by using tinyMCEPopup.getWindowArg inside the dialog. + * tinymce.activeEditor.windowManager.open({ + * url: 'file.htm', + * width: 320, + * height: 240 + * }, { + * custom_param: 1 + * }); + * + * // Displays an alert box using the active editors window manager instance + * tinymce.activeEditor.windowManager.alert('Hello world!'); + * + * // Displays an confirm box and an alert message will be displayed depending on what you choose in the confirm + * tinymce.activeEditor.windowManager.confirm("Do you want to do something", function(s) { + * if (s) + * tinymce.activeEditor.windowManager.alert("Ok"); + * else + * tinymce.activeEditor.windowManager.alert("Cancel"); + * }); + */ +define("tinymce/WindowManager", [ + "tinymce/ui/Window", + "tinymce/ui/MessageBox" +], function(Window, MessageBox) { + return function(editor) { + var self = this, windows = []; + + function getTopMostWindow() { + if (windows.length) { + return windows[windows.length - 1]; + } + } + + self.windows = windows; + + editor.on('remove', function() { + var i = windows.length; + + while (i--) { + windows[i].close(); + } + }); + + /** + * Opens a new window. + * + * @method open + * @param {Object} args Optional name/value settings collection contains things like width/height/url etc. + * @option {String} title Window title. + * @option {String} file URL of the file to open in the window. + * @option {Number} width Width in pixels. + * @option {Number} height Height in pixels. + * @option {Boolean} autoScroll Specifies whether the popup window can have scrollbars if required (i.e. content + * larger than the popup size specified). + */ + self.open = function(args, params) { + var win; + + editor.editorManager.setActive(editor); + + args.title = args.title || ' '; + + // Handle URL + args.url = args.url || args.file; // Legacy + if (args.url) { + args.width = parseInt(args.width || 320, 10); + args.height = parseInt(args.height || 240, 10); + } + + // Handle body + if (args.body) { + args.items = { + defaults: args.defaults, + type: args.bodyType || 'form', + items: args.body + }; + } + + if (!args.url && !args.buttons) { + args.buttons = [ + {text: 'Ok', subtype: 'primary', onclick: function() { + win.find('form')[0].submit(); + }}, + + {text: 'Cancel', onclick: function() { + win.close(); + }} + ]; + } + + win = new Window(args); + windows.push(win); + + win.on('close', function() { + var i = windows.length; + + while (i--) { + if (windows[i] === win) { + windows.splice(i, 1); + } + } + + if (!windows.length) { + editor.focus(); + } + }); + + // Handle data + if (args.data) { + win.on('postRender', function() { + this.find('*').each(function(ctrl) { + var name = ctrl.name(); + + if (name in args.data) { + ctrl.value(args.data[name]); + } + }); + }); + } + + // store args and parameters + win.features = args || {}; + win.params = params || {}; + + // Takes a snapshot in the FocusManager of the selection before focus is lost to dialog + if (windows.length === 1) { + editor.nodeChanged(); + } + + return win.renderTo().reflow(); + }; + + /** + * Creates a alert dialog. Please don't use the blocking behavior of this + * native version use the callback method instead then it can be extended. + * + * @method alert + * @param {String} message Text to display in the new alert dialog. + * @param {function} callback Callback function to be executed after the user has selected ok. + * @param {Object} scope Optional scope to execute the callback in. + * @example + * // Displays an alert box using the active editors window manager instance + * tinymce.activeEditor.windowManager.alert('Hello world!'); + */ + self.alert = function(message, callback, scope) { + MessageBox.alert(message, function() { + if (callback) { + callback.call(scope || this); + } else { + editor.focus(); + } + }); + }; + + /** + * Creates a confirm dialog. Please don't use the blocking behavior of this + * native version use the callback method instead then it can be extended. + * + * @method confirm + * @param {String} messageText to display in the new confirm dialog. + * @param {function} callback Callback function to be executed after the user has selected ok or cancel. + * @param {Object} scope Optional scope to execute the callback in. + * @example + * // Displays an confirm box and an alert message will be displayed depending on what you choose in the confirm + * tinymce.activeEditor.windowManager.confirm("Do you want to do something", function(s) { + * if (s) + * tinymce.activeEditor.windowManager.alert("Ok"); + * else + * tinymce.activeEditor.windowManager.alert("Cancel"); + * }); + */ + self.confirm = function(message, callback, scope) { + MessageBox.confirm(message, function(state) { + callback.call(scope || this, state); + }); + }; + + /** + * Closes the top most window. + * + * @method close + */ + self.close = function() { + if (getTopMostWindow()) { + getTopMostWindow().close(); + } + }; + + /** + * Returns the params of the last window open call. This can be used in iframe based + * dialog to get params passed from the tinymce plugin. + * + * @example + * var dialogArguments = top.tinymce.activeEditor.windowManager.getParams(); + * + * @method getParams + * @return {Object} Name/value object with parameters passed from windowManager.open call. + */ + self.getParams = function() { + return getTopMostWindow() ? getTopMostWindow().params : null; + }; + + /** + * Sets the params of the last opened window. + * + * @method setParams + * @param {Object} params Params object to set for the last opened window. + */ + self.setParams = function(params) { + if (getTopMostWindow()) { + getTopMostWindow().params = params; + } + }; + + /** + * Returns the currently opened window objects. + * + * @method getWindows + * @return {Array} Array of the currently opened windows. + */ + self.getWindows = function() { + return windows; + }; + }; +}); + +// Included from: js/tinymce/classes/util/Quirks.js + +/** + * Quirks.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + * + * @ignore-file + */ + +/** + * This file includes fixes for various browser quirks it's made to make it easy to add/remove browser specific fixes. + * + * @class tinymce.util.Quirks + */ +define("tinymce/util/Quirks", [ + "tinymce/util/VK", + "tinymce/dom/RangeUtils", + "tinymce/dom/TreeWalker", + "tinymce/html/Node", + "tinymce/html/Entities", + "tinymce/Env", + "tinymce/util/Tools" +], function(VK, RangeUtils, TreeWalker, Node, Entities, Env, Tools) { + return function(editor) { + var each = Tools.each, $ = editor.$; + var BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE, dom = editor.dom, selection = editor.selection, + settings = editor.settings, parser = editor.parser, serializer = editor.serializer; + var isGecko = Env.gecko, isIE = Env.ie, isWebKit = Env.webkit; + var mceInternalUrlPrefix = 'data:text/mce-internal,'; + var mceInternalDataType = isIE ? 'Text' : 'URL'; + + /** + * Executes a command with a specific state this can be to enable/disable browser editing features. + */ + function setEditorCommandState(cmd, state) { + try { + editor.getDoc().execCommand(cmd, false, state); + } catch (ex) { + // Ignore + } + } + + /** + * Returns current IE document mode. + */ + function getDocumentMode() { + var documentMode = editor.getDoc().documentMode; + + return documentMode ? documentMode : 6; + } + + /** + * Returns true/false if the event is prevented or not. + * + * @private + * @param {Event} e Event object. + * @return {Boolean} true/false if the event is prevented or not. + */ + function isDefaultPrevented(e) { + return e.isDefaultPrevented(); + } + + /** + * Sets Text/URL data on the event's dataTransfer object to a special data:text/mce-internal url. + * This is to workaround the inability to set custom contentType on IE and Safari. + * The editor's selected content is encoded into this url so drag and drop between editors will work. + * + * @private + * @param {DragEvent} e Event object + */ + function setMceInteralContent(e) { + var selectionHtml; + + if (e.dataTransfer) { + if (editor.selection.isCollapsed() && e.target.tagName == 'IMG') { + selection.select(e.target); + } + + selectionHtml = editor.selection.getContent(); + + // Safari/IE doesn't support custom dataTransfer items so we can only use URL and Text + if (selectionHtml.length > 0) { + e.dataTransfer.setData(mceInternalDataType, mceInternalUrlPrefix + escape(selectionHtml)); + } + } + } + + /** + * Gets content of special data:text/mce-internal url on the event's dataTransfer object. + * This is to workaround the inability to set custom contentType on IE and Safari. + * The editor's selected content is encoded into this url so drag and drop between editors will work. + * + * @private + * @param {DragEvent} e Event object + * @returns {String} mce-internal content + */ + function getMceInternalContent(e) { + var internalContent, content; + + if (e.dataTransfer) { + internalContent = e.dataTransfer.getData(mceInternalDataType); + + if (internalContent && internalContent.indexOf(mceInternalUrlPrefix) >= 0) { + content = unescape(internalContent.substr(mceInternalUrlPrefix.length)); + } + } + + return content; + } + + /** + * Inserts contents using the paste clipboard command if it's available if it isn't it will fallback + * to the core command. + * + * @private + * @param {String} content Content to insert at selection. + */ + function insertClipboardContents(content) { + if (editor.queryCommandSupported('mceInsertClipboardContent')) { + editor.execCommand('mceInsertClipboardContent', false, {content: content}); + } else { + editor.execCommand('mceInsertContent', false, content); + } + } + + /** + * Fixes a WebKit bug when deleting contents using backspace or delete key. + * WebKit will produce a span element if you delete across two block elements. + * + * Example: + *

    a

    |b

    + * + * Will produce this on backspace: + *

    ab

    + * + * This fixes the backspace to produce: + *

    a|b

    + * + * See bug: https://bugs.webkit.org/show_bug.cgi?id=45784 + * + * This fixes the following delete scenarios: + * 1. Delete by pressing backspace key. + * 2. Delete by pressing delete key. + * 3. Delete by pressing backspace key with ctrl/cmd (Word delete). + * 4. Delete by pressing delete key with ctrl/cmd (Word delete). + * 5. Delete by drag/dropping contents inside the editor. + * 6. Delete by using Cut Ctrl+X/Cmd+X. + * 7. Delete by selecting contents and writing a character. + * + * This code is a ugly hack since writing full custom delete logic for just this bug + * fix seemed like a huge task. I hope we can remove this before the year 2030. + */ + function cleanupStylesWhenDeleting() { + var doc = editor.getDoc(), dom = editor.dom, selection = editor.selection; + var MutationObserver = window.MutationObserver, olderWebKit, dragStartRng; + + // Add mini polyfill for older WebKits + // TODO: Remove this when old Safari versions gets updated + if (!MutationObserver) { + olderWebKit = true; + + MutationObserver = function() { + var records = [], target; + + function nodeInsert(e) { + var target = e.relatedNode || e.target; + records.push({target: target, addedNodes: [target]}); + } + + function attrModified(e) { + var target = e.relatedNode || e.target; + records.push({target: target, attributeName: e.attrName}); + } + + this.observe = function(node) { + target = node; + target.addEventListener('DOMSubtreeModified', nodeInsert, false); + target.addEventListener('DOMNodeInsertedIntoDocument', nodeInsert, false); + target.addEventListener('DOMNodeInserted', nodeInsert, false); + target.addEventListener('DOMAttrModified', attrModified, false); + }; + + this.disconnect = function() { + target.removeEventListener('DOMSubtreeModified', nodeInsert, false); + target.removeEventListener('DOMNodeInsertedIntoDocument', nodeInsert, false); + target.removeEventListener('DOMNodeInserted', nodeInsert, false); + target.removeEventListener('DOMAttrModified', attrModified, false); + }; + + this.takeRecords = function() { + return records; + }; + }; + } + + function isTrailingBr(node) { + var blockElements = dom.schema.getBlockElements(), rootNode = editor.getBody(); + + if (node.nodeName != 'BR') { + return false; + } + + for (node = node; node != rootNode && !blockElements[node.nodeName]; node = node.parentNode) { + if (node.nextSibling) { + return false; + } + } + + return true; + } + + function isSiblingsIgnoreWhiteSpace(node1, node2) { + var node; + + for (node = node1.nextSibling; node && node != node2; node = node.nextSibling) { + if (node.nodeType == 3 && $.trim(node.data).length === 0) { + continue; + } + + if (node !== node2) { + return false; + } + } + + return node === node2; + } + + function findCaretNode(node, forward, startNode) { + var walker, current, nonEmptyElements; + + nonEmptyElements = dom.schema.getNonEmptyElements(); + + walker = new TreeWalker(startNode || node, node); + + while ((current = walker[forward ? 'next' : 'prev']())) { + if (nonEmptyElements[current.nodeName] && !isTrailingBr(current)) { + return current; + } + + if (current.nodeType == 3 && current.data.length > 0) { + return current; + } + } + } + + function deleteRangeBetweenTextBlocks(rng) { + var startBlock, endBlock, caretNodeBefore, caretNodeAfter, textBlockElements; + + if (rng.collapsed) { + return; + } + + startBlock = dom.getParent(RangeUtils.getNode(rng.startContainer, rng.startOffset), dom.isBlock); + endBlock = dom.getParent(RangeUtils.getNode(rng.endContainer, rng.endOffset), dom.isBlock); + textBlockElements = editor.schema.getTextBlockElements(); + + if (startBlock == endBlock) { + return; + } + + if (!textBlockElements[startBlock.nodeName] || !textBlockElements[endBlock.nodeName]) { + return; + } + + if (dom.getContentEditable(startBlock) === "false" || dom.getContentEditable(endBlock) === "false") { + return; + } + + rng.deleteContents(); + + caretNodeBefore = findCaretNode(startBlock, false); + caretNodeAfter = findCaretNode(endBlock, true); + + if (!dom.isEmpty(endBlock)) { + $(startBlock).append(endBlock.childNodes); + } + + $(endBlock).remove(); + + if (caretNodeBefore) { + if (caretNodeBefore.nodeType == 1) { + if (caretNodeBefore.nodeName == "BR") { + rng.setStartBefore(caretNodeBefore); + rng.setEndBefore(caretNodeBefore); + } else { + rng.setStartAfter(caretNodeBefore); + rng.setEndAfter(caretNodeBefore); + } + } else { + rng.setStart(caretNodeBefore, caretNodeBefore.data.length); + rng.setEnd(caretNodeBefore, caretNodeBefore.data.length); + } + } else if (caretNodeAfter) { + if (caretNodeAfter.nodeType == 1) { + rng.setStartBefore(caretNodeAfter); + rng.setEndBefore(caretNodeAfter); + } else { + rng.setStart(caretNodeAfter, 0); + rng.setEnd(caretNodeAfter, 0); + } + } + + selection.setRng(rng); + + return true; + } + + function expandBetweenBlocks(rng, isForward) { + var caretNode, targetCaretNode, textBlock, targetTextBlock, container, offset; + + if (!rng.collapsed) { + return rng; + } + + container = rng.startContainer; + offset = rng.startOffset; + + if (container.nodeType == 3) { + if (isForward) { + if (offset < container.data.length) { + return rng; + } + } else { + if (offset > 0) { + return rng; + } + } + } + + caretNode = RangeUtils.getNode(rng.startContainer, rng.startOffset); + textBlock = dom.getParent(caretNode, dom.isBlock); + targetCaretNode = findCaretNode(editor.getBody(), isForward, caretNode); + targetTextBlock = dom.getParent(targetCaretNode, dom.isBlock); + + if (!caretNode || !targetCaretNode) { + return rng; + } + + if (targetTextBlock && textBlock != targetTextBlock) { + if (!isForward) { + if (!isSiblingsIgnoreWhiteSpace(targetTextBlock, textBlock)) { + return rng; + } + + if (targetCaretNode.nodeType == 1) { + if (targetCaretNode.nodeName == "BR") { + rng.setStartBefore(targetCaretNode); + } else { + rng.setStartAfter(targetCaretNode); + } + } else { + rng.setStart(targetCaretNode, targetCaretNode.data.length); + } + + if (caretNode.nodeType == 1) { + rng.setEnd(caretNode, 0); + } else { + rng.setEndBefore(caretNode); + } + } else { + if (!isSiblingsIgnoreWhiteSpace(textBlock, targetTextBlock)) { + return rng; + } + + if (caretNode.nodeType == 1) { + if (caretNode.nodeName == "BR") { + rng.setStartBefore(caretNode); + } else { + rng.setStartAfter(caretNode); + } + } else { + rng.setStart(caretNode, caretNode.data.length); + } + + if (targetCaretNode.nodeType == 1) { + rng.setEnd(targetCaretNode, 0); + } else { + rng.setEndBefore(targetCaretNode); + } + } + } + + return rng; + } + + function handleTextBlockMergeDelete(isForward) { + var rng = selection.getRng(); + + rng = expandBetweenBlocks(rng, isForward); + + if (deleteRangeBetweenTextBlocks(rng)) { + return true; + } + } + + function customDelete(isForward) { + var mutationObserver, rng, caretElement; + + if (handleTextBlockMergeDelete(isForward)) { + return; + } + + Tools.each(editor.getBody().getElementsByTagName('*'), function(elm) { + // Mark existing spans + if (elm.tagName == 'SPAN') { + elm.setAttribute('mce-data-marked', 1); + } + + // Make sure all elements has a data-mce-style attribute + if (!elm.hasAttribute('data-mce-style') && elm.hasAttribute('style')) { + editor.dom.setAttrib(elm, 'style', editor.dom.getAttrib(elm, 'style')); + } + }); + + // Observe added nodes and style attribute changes + mutationObserver = new MutationObserver(function() {}); + mutationObserver.observe(editor.getDoc(), { + childList: true, + attributes: true, + subtree: true, + attributeFilter: ['style'] + }); + + editor.getDoc().execCommand(isForward ? 'ForwardDelete' : 'Delete', false, null); + + rng = editor.selection.getRng(); + caretElement = rng.startContainer.parentNode; + + Tools.each(mutationObserver.takeRecords(), function(record) { + if (!dom.isChildOf(record.target, editor.getBody())) { + return; + } + + // Restore style attribute to previous value + if (record.attributeName == "style") { + var oldValue = record.target.getAttribute('data-mce-style'); + + if (oldValue) { + record.target.setAttribute("style", oldValue); + } else { + record.target.removeAttribute("style"); + } + } + + // Remove all spans that isn't maked and retain selection + Tools.each(record.addedNodes, function(node) { + if (node.nodeName == "SPAN" && !node.getAttribute('mce-data-marked')) { + var offset, container; + + if (node == caretElement) { + offset = rng.startOffset; + container = node.firstChild; + } + + dom.remove(node, true); + + if (container) { + rng.setStart(container, offset); + rng.setEnd(container, offset); + editor.selection.setRng(rng); + } + } + }); + }); + + mutationObserver.disconnect(); + + // Remove any left over marks + Tools.each(editor.dom.select('span[mce-data-marked]'), function(span) { + span.removeAttribute('mce-data-marked'); + }); + } + + editor.on('keydown', function(e) { + var isForward = e.keyCode == DELETE, isMetaOrCtrl = e.ctrlKey || e.metaKey; + + if (!isDefaultPrevented(e) && (isForward || e.keyCode == BACKSPACE)) { + var rng = editor.selection.getRng(), container = rng.startContainer, offset = rng.startOffset; + + // Ignore non meta delete in the where there is text before/after the caret + if (!isMetaOrCtrl && rng.collapsed && container.nodeType == 3) { + if (isForward ? offset < container.data.length : offset > 0) { + return; + } + } + + e.preventDefault(); + + if (isMetaOrCtrl) { + editor.selection.getSel().modify("extend", isForward ? "forward" : "backward", e.metaKey ? "lineboundary" : "word"); + } + + customDelete(isForward); + } + }); + + // Handle case where text is deleted by typing over + editor.on('keypress', function(e) { + if (!isDefaultPrevented(e) && !selection.isCollapsed() && e.charCode && !VK.metaKeyPressed(e)) { + var rng, currentFormatNodes, fragmentNode, blockParent, caretNode, charText; + + rng = editor.selection.getRng(); + charText = String.fromCharCode(e.charCode); + e.preventDefault(); + + // Keep track of current format nodes + currentFormatNodes = $(rng.startContainer).parents().filter(function(idx, node) { + return !!editor.schema.getTextInlineElements()[node.nodeName]; + }); + + customDelete(true); + + // Check if the browser removed them + currentFormatNodes = currentFormatNodes.filter(function(idx, node) { + return !$.contains(editor.getBody(), node); + }); + + // Then re-add them + if (currentFormatNodes.length) { + fragmentNode = dom.createFragment(); + + currentFormatNodes.each(function(idx, formatNode) { + formatNode = formatNode.cloneNode(false); + + if (fragmentNode.hasChildNodes()) { + formatNode.appendChild(fragmentNode.firstChild); + fragmentNode.appendChild(formatNode); + } else { + caretNode = formatNode; + fragmentNode.appendChild(formatNode); + } + + fragmentNode.appendChild(formatNode); + }); + + caretNode.appendChild(editor.getDoc().createTextNode(charText)); + + // Prevent edge case where older WebKit would add an extra BR element + blockParent = dom.getParent(rng.startContainer, dom.isBlock); + if (dom.isEmpty(blockParent)) { + $(blockParent).empty().append(fragmentNode); + } else { + rng.insertNode(fragmentNode); + } + + rng.setStart(caretNode.firstChild, 1); + rng.setEnd(caretNode.firstChild, 1); + editor.selection.setRng(rng); + } else { + editor.selection.setContent(charText); + } + } + }); + + editor.addCommand('Delete', function() { + customDelete(); + }); + + editor.addCommand('ForwardDelete', function() { + customDelete(true); + }); + + // Older WebKits doesn't properly handle the clipboard so we can't add the rest + if (olderWebKit) { + return; + } + + editor.on('dragstart', function(e) { + dragStartRng = selection.getRng(); + setMceInteralContent(e); + }); + + editor.on('drop', function(e) { + if (!isDefaultPrevented(e)) { + var internalContent = getMceInternalContent(e); + if (internalContent) { + e.preventDefault(); + + // Safari has a weird issue where drag/dropping images sometimes + // produces a green plus icon. When this happens the caretRangeFromPoint + // will return "null" even though the x, y coordinate is correct. + // But if we detach the insert from the drop event we will get a proper range + window.setTimeout(function() { + var pointRng = RangeUtils.getCaretRangeFromPoint(e.x, e.y, doc); + + if (dragStartRng) { + selection.setRng(dragStartRng); + dragStartRng = null; + } + + customDelete(); + selection.setRng(pointRng); + insertClipboardContents(internalContent); + }, 0); + } + } + }); + + editor.on('cut', function(e) { + if (!isDefaultPrevented(e) && e.clipboardData) { + e.preventDefault(); + e.clipboardData.clearData(); + e.clipboardData.setData('text/html', editor.selection.getContent()); + e.clipboardData.setData('text/plain', editor.selection.getContent({format: 'text'})); + customDelete(true); + } + }); + } + + /** + * Makes sure that the editor body becomes empty when backspace or delete is pressed in empty editors. + * + * For example: + *

    |

    + * + * Or: + *

    |

    + * + * Or: + * [

    ] + */ + function emptyEditorWhenDeleting() { + function serializeRng(rng) { + var body = dom.create("body"); + var contents = rng.cloneContents(); + body.appendChild(contents); + return selection.serializer.serialize(body, {format: 'html'}); + } + + function allContentsSelected(rng) { + if (!rng.setStart) { + if (rng.item) { + return false; + } + + var bodyRng = rng.duplicate(); + bodyRng.moveToElementText(editor.getBody()); + return RangeUtils.compareRanges(rng, bodyRng); + } + + var selection = serializeRng(rng); + + var allRng = dom.createRng(); + allRng.selectNode(editor.getBody()); + + var allSelection = serializeRng(allRng); + return selection === allSelection; + } + + editor.on('keydown', function(e) { + var keyCode = e.keyCode, isCollapsed, body; + + // Empty the editor if it's needed for example backspace at

    |

    + if (!isDefaultPrevented(e) && (keyCode == DELETE || keyCode == BACKSPACE)) { + isCollapsed = editor.selection.isCollapsed(); + body = editor.getBody(); + + // Selection is collapsed but the editor isn't empty + if (isCollapsed && !dom.isEmpty(body)) { + return; + } + + // Selection isn't collapsed but not all the contents is selected + if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) { + return; + } + + // Manually empty the editor + e.preventDefault(); + editor.setContent(''); + + if (body.firstChild && dom.isBlock(body.firstChild)) { + editor.selection.setCursorLocation(body.firstChild, 0); + } else { + editor.selection.setCursorLocation(body, 0); + } + + editor.nodeChanged(); + } + }); + } + + /** + * WebKit doesn't select all the nodes in the body when you press Ctrl+A. + * IE selects more than the contents [

    a

    ] instead of

    [a] see bug #6438 + * This selects the whole body so that backspace/delete logic will delete everything + */ + function selectAll() { + editor.shortcuts.add('meta+a', null, 'SelectAll'); + } + + /** + * WebKit has a weird issue where it some times fails to properly convert keypresses to input method keystrokes. + * The IME on Mac doesn't initialize when it doesn't fire a proper focus event. + * + * This seems to happen when the user manages to click the documentElement element then the window doesn't get proper focus until + * you enter a character into the editor. + * + * It also happens when the first focus in made to the body. + * + * See: https://bugs.webkit.org/show_bug.cgi?id=83566 + */ + function inputMethodFocus() { + if (!editor.settings.content_editable) { + // Case 1 IME doesn't initialize if you focus the document + dom.bind(editor.getDoc(), 'focusin', function() { + selection.setRng(selection.getRng()); + }); + + // Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event + // Needs to be both down/up due to weird rendering bug on Chrome Windows + dom.bind(editor.getDoc(), 'mousedown mouseup', function(e) { + if (e.target == editor.getDoc().documentElement) { + editor.getBody().focus(); + + if (e.type == 'mousedown') { + // Edge case for mousedown, drag select and mousedown again within selection on Chrome Windows to render caret + selection.placeCaretAt(e.clientX, e.clientY); + } else { + selection.setRng(selection.getRng()); + } + } + }); + } + } + + /** + * Backspacing in FireFox/IE from a paragraph into a horizontal rule results in a floating text node because the + * browser just deletes the paragraph - the browser fails to merge the text node with a horizontal rule so it is + * left there. TinyMCE sees a floating text node and wraps it in a paragraph on the key up event (ForceBlocks.js + * addRootBlocks), meaning the action does nothing. With this code, FireFox/IE matche the behaviour of other + * browsers. + * + * It also fixes a bug on Firefox where it's impossible to delete HR elements. + */ + function removeHrOnBackspace() { + editor.on('keydown', function(e) { + if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) { + // Check if there is any HR elements this is faster since getRng on IE 7 & 8 is slow + if (!editor.getBody().getElementsByTagName('hr').length) { + return; + } + + if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) { + var node = selection.getNode(); + var previousSibling = node.previousSibling; + + if (node.nodeName == 'HR') { + dom.remove(node); + e.preventDefault(); + return; + } + + if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "hr") { + dom.remove(previousSibling); + e.preventDefault(); + } + } + } + }); + } + + /** + * Firefox 3.x has an issue where the body element won't get proper focus if you click out + * side it's rectangle. + */ + function focusBody() { + // Fix for a focus bug in FF 3.x where the body element + // wouldn't get proper focus if the user clicked on the HTML element + if (!window.Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4 + editor.on('mousedown', function(e) { + if (!isDefaultPrevented(e) && e.target.nodeName === "HTML") { + var body = editor.getBody(); + + // Blur the body it's focused but not correctly focused + body.blur(); + + // Refocus the body after a little while + setTimeout(function() { + body.focus(); + }, 0); + } + }); + } + } + + /** + * WebKit has a bug where it isn't possible to select image, hr or anchor elements + * by clicking on them so we need to fake that. + */ + function selectControlElements() { + editor.on('click', function(e) { + var target = e.target; + + // Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250 + // WebKit can't even do simple things like selecting an image + // Needs to be the setBaseAndExtend or it will fail to select floated images + if (/^(IMG|HR)$/.test(target.nodeName)) { + e.preventDefault(); + selection.getSel().setBaseAndExtent(target, 0, target, 1); + editor.nodeChanged(); + } + + if (target.nodeName == 'A' && dom.hasClass(target, 'mce-item-anchor')) { + e.preventDefault(); + selection.select(target); + } + }); + } + + /** + * Fixes a Gecko bug where the style attribute gets added to the wrong element when deleting between two block elements. + * + * Fixes do backspace/delete on this: + *

    bla[ck

    r]ed

    + * + * Would become: + *

    bla|ed

    + * + * Instead of: + *

    bla|ed

    + */ + function removeStylesWhenDeletingAcrossBlockElements() { + function getAttributeApplyFunction() { + var template = dom.getAttribs(selection.getStart().cloneNode(false)); + + return function() { + var target = selection.getStart(); + + if (target !== editor.getBody()) { + dom.setAttrib(target, "style", null); + + each(template, function(attr) { + target.setAttributeNode(attr.cloneNode(true)); + }); + } + }; + } + + function isSelectionAcrossElements() { + return !selection.isCollapsed() && + dom.getParent(selection.getStart(), dom.isBlock) != dom.getParent(selection.getEnd(), dom.isBlock); + } + + editor.on('keypress', function(e) { + var applyAttributes; + + if (!isDefaultPrevented(e) && (e.keyCode == 8 || e.keyCode == 46) && isSelectionAcrossElements()) { + applyAttributes = getAttributeApplyFunction(); + editor.getDoc().execCommand('delete', false, null); + applyAttributes(); + e.preventDefault(); + return false; + } + }); + + dom.bind(editor.getDoc(), 'cut', function(e) { + var applyAttributes; + + if (!isDefaultPrevented(e) && isSelectionAcrossElements()) { + applyAttributes = getAttributeApplyFunction(); + + setTimeout(function() { + applyAttributes(); + }, 0); + } + }); + } + + /** + * Screen readers on IE needs to have the role application set on the body. + */ + function ensureBodyHasRoleApplication() { + document.body.setAttribute("role", "application"); + } + + /** + * Backspacing into a table behaves differently depending upon browser type. + * Therefore, disable Backspace when cursor immediately follows a table. + */ + function disableBackspaceIntoATable() { + editor.on('keydown', function(e) { + if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) { + if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) { + var previousSibling = selection.getNode().previousSibling; + if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "table") { + e.preventDefault(); + return false; + } + } + } + }); + } + + /** + * Old IE versions can't properly render BR elements in PRE tags white in contentEditable mode. So this + * logic adds a \n before the BR so that it will get rendered. + */ + function addNewLinesBeforeBrInPre() { + // IE8+ rendering mode does the right thing with BR in PRE + if (getDocumentMode() > 7) { + return; + } + + // Enable display: none in area and add a specific class that hides all BR elements in PRE to + // avoid the caret from getting stuck at the BR elements while pressing the right arrow key + setEditorCommandState('RespectVisibilityInDesign', true); + editor.contentStyles.push('.mceHideBrInPre pre br {display: none}'); + dom.addClass(editor.getBody(), 'mceHideBrInPre'); + + // Adds a \n before all BR elements in PRE to get them visual + parser.addNodeFilter('pre', function(nodes) { + var i = nodes.length, brNodes, j, brElm, sibling; + + while (i--) { + brNodes = nodes[i].getAll('br'); + j = brNodes.length; + while (j--) { + brElm = brNodes[j]; + + // Add \n before BR in PRE elements on older IE:s so the new lines get rendered + sibling = brElm.prev; + if (sibling && sibling.type === 3 && sibling.value.charAt(sibling.value - 1) != '\n') { + sibling.value += '\n'; + } else { + brElm.parent.insert(new Node('#text', 3), brElm, true).value = '\n'; + } + } + } + }); + + // Removes any \n before BR elements in PRE since other browsers and in contentEditable=false mode they will be visible + serializer.addNodeFilter('pre', function(nodes) { + var i = nodes.length, brNodes, j, brElm, sibling; + + while (i--) { + brNodes = nodes[i].getAll('br'); + j = brNodes.length; + while (j--) { + brElm = brNodes[j]; + sibling = brElm.prev; + if (sibling && sibling.type == 3) { + sibling.value = sibling.value.replace(/\r?\n$/, ''); + } + } + } + }); + } + + /** + * Moves style width/height to attribute width/height when the user resizes an image on IE. + */ + function removePreSerializedStylesWhenSelectingControls() { + dom.bind(editor.getBody(), 'mouseup', function() { + var value, node = selection.getNode(); + + // Moved styles to attributes on IMG eements + if (node.nodeName == 'IMG') { + // Convert style width to width attribute + if ((value = dom.getStyle(node, 'width'))) { + dom.setAttrib(node, 'width', value.replace(/[^0-9%]+/g, '')); + dom.setStyle(node, 'width', ''); + } + + // Convert style height to height attribute + if ((value = dom.getStyle(node, 'height'))) { + dom.setAttrib(node, 'height', value.replace(/[^0-9%]+/g, '')); + dom.setStyle(node, 'height', ''); + } + } + }); + } + + /** + * Removes a blockquote when backspace is pressed at the beginning of it. + * + * For example: + *

    |x

    + * + * Becomes: + *

    |x

    + */ + function removeBlockQuoteOnBackSpace() { + // Add block quote deletion handler + editor.on('keydown', function(e) { + var rng, container, offset, root, parent; + + if (isDefaultPrevented(e) || e.keyCode != VK.BACKSPACE) { + return; + } + + rng = selection.getRng(); + container = rng.startContainer; + offset = rng.startOffset; + root = dom.getRoot(); + parent = container; + + if (!rng.collapsed || offset !== 0) { + return; + } + + while (parent && parent.parentNode && parent.parentNode.firstChild == parent && parent.parentNode != root) { + parent = parent.parentNode; + } + + // Is the cursor at the beginning of a blockquote? + if (parent.tagName === 'BLOCKQUOTE') { + // Remove the blockquote + editor.formatter.toggle('blockquote', null, parent); + + // Move the caret to the beginning of container + rng = dom.createRng(); + rng.setStart(container, 0); + rng.setEnd(container, 0); + selection.setRng(rng); + } + }); + } + + /** + * Sets various Gecko editing options on mouse down and before a execCommand to disable inline table editing that is broken etc. + */ + function setGeckoEditingOptions() { + function setOpts() { + editor._refreshContentEditable(); + + setEditorCommandState("StyleWithCSS", false); + setEditorCommandState("enableInlineTableEditing", false); + + if (!settings.object_resizing) { + setEditorCommandState("enableObjectResizing", false); + } + } + + if (!settings.readonly) { + editor.on('BeforeExecCommand MouseDown', setOpts); + } + } + + /** + * Fixes a gecko link bug, when a link is placed at the end of block elements there is + * no way to move the caret behind the link. This fix adds a bogus br element after the link. + * + * For example this: + *

    x

    + * + * Becomes this: + *

    x

    + */ + function addBrAfterLastLinks() { + function fixLinks() { + each(dom.select('a'), function(node) { + var parentNode = node.parentNode, root = dom.getRoot(); + + if (parentNode.lastChild === node) { + while (parentNode && !dom.isBlock(parentNode)) { + if (parentNode.parentNode.lastChild !== parentNode || parentNode === root) { + return; + } + + parentNode = parentNode.parentNode; + } + + dom.add(parentNode, 'br', {'data-mce-bogus': 1}); + } + }); + } + + editor.on('SetContent ExecCommand', function(e) { + if (e.type == "setcontent" || e.command === 'mceInsertLink') { + fixLinks(); + } + }); + } + + /** + * WebKit will produce DIV elements here and there by default. But since TinyMCE uses paragraphs by + * default we want to change that behavior. + */ + function setDefaultBlockType() { + if (settings.forced_root_block) { + editor.on('init', function() { + setEditorCommandState('DefaultParagraphSeparator', settings.forced_root_block); + }); + } + } + + /** + * Removes ghost selections from images/tables on Gecko. + */ + function removeGhostSelection() { + editor.on('Undo Redo SetContent', function(e) { + if (!e.initial) { + editor.execCommand('mceRepaint'); + } + }); + } + + /** + * Deletes the selected image on IE instead of navigating to previous page. + */ + function deleteControlItemOnBackSpace() { + editor.on('keydown', function(e) { + var rng; + + if (!isDefaultPrevented(e) && e.keyCode == BACKSPACE) { + rng = editor.getDoc().selection.createRange(); + if (rng && rng.item) { + e.preventDefault(); + editor.undoManager.beforeChange(); + dom.remove(rng.item(0)); + editor.undoManager.add(); + } + } + }); + } + + /** + * IE10 doesn't properly render block elements with the right height until you add contents to them. + * This fixes that by adding a padding-right to all empty text block elements. + * See: https://connect.microsoft.com/IE/feedback/details/743881 + */ + function renderEmptyBlocksFix() { + var emptyBlocksCSS; + + // IE10+ + if (getDocumentMode() >= 10) { + emptyBlocksCSS = ''; + each('p div h1 h2 h3 h4 h5 h6'.split(' '), function(name, i) { + emptyBlocksCSS += (i > 0 ? ',' : '') + name + ':empty'; + }); + + editor.contentStyles.push(emptyBlocksCSS + '{padding-right: 1px !important}'); + } + } + + /** + * Old IE versions can't retain contents within noscript elements so this logic will store the contents + * as a attribute and the insert that value as it's raw text when the DOM is serialized. + */ + function keepNoScriptContents() { + if (getDocumentMode() < 9) { + parser.addNodeFilter('noscript', function(nodes) { + var i = nodes.length, node, textNode; + + while (i--) { + node = nodes[i]; + textNode = node.firstChild; + + if (textNode) { + node.attr('data-mce-innertext', textNode.value); + } + } + }); + + serializer.addNodeFilter('noscript', function(nodes) { + var i = nodes.length, node, textNode, value; + + while (i--) { + node = nodes[i]; + textNode = nodes[i].firstChild; + + if (textNode) { + textNode.value = Entities.decode(textNode.value); + } else { + // Old IE can't retain noscript value so an attribute is used to store it + value = node.attributes.map['data-mce-innertext']; + if (value) { + node.attr('data-mce-innertext', null); + textNode = new Node('#text', 3); + textNode.value = value; + textNode.raw = true; + node.append(textNode); + } + } + } + }); + } + } + + /** + * IE has an issue where you can't select/move the caret by clicking outside the body if the document is in standards mode. + */ + function fixCaretSelectionOfDocumentElementOnIe() { + var doc = dom.doc, body = doc.body, started, startRng, htmlElm; + + // Return range from point or null if it failed + function rngFromPoint(x, y) { + var rng = body.createTextRange(); + + try { + rng.moveToPoint(x, y); + } catch (ex) { + // IE sometimes throws and exception, so lets just ignore it + rng = null; + } + + return rng; + } + + // Fires while the selection is changing + function selectionChange(e) { + var pointRng; + + // Check if the button is down or not + if (e.button) { + // Create range from mouse position + pointRng = rngFromPoint(e.x, e.y); + + if (pointRng) { + // Check if pointRange is before/after selection then change the endPoint + if (pointRng.compareEndPoints('StartToStart', startRng) > 0) { + pointRng.setEndPoint('StartToStart', startRng); + } else { + pointRng.setEndPoint('EndToEnd', startRng); + } + + pointRng.select(); + } + } else { + endSelection(); + } + } + + // Removes listeners + function endSelection() { + var rng = doc.selection.createRange(); + + // If the range is collapsed then use the last start range + if (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0) { + startRng.select(); + } + + dom.unbind(doc, 'mouseup', endSelection); + dom.unbind(doc, 'mousemove', selectionChange); + startRng = started = 0; + } + + // Make HTML element unselectable since we are going to handle selection by hand + doc.documentElement.unselectable = true; + + // Detect when user selects outside BODY + dom.bind(doc, 'mousedown contextmenu', function(e) { + if (e.target.nodeName === 'HTML') { + if (started) { + endSelection(); + } + + // Detect vertical scrollbar, since IE will fire a mousedown on the scrollbar and have target set as HTML + htmlElm = doc.documentElement; + if (htmlElm.scrollHeight > htmlElm.clientHeight) { + return; + } + + started = 1; + // Setup start position + startRng = rngFromPoint(e.x, e.y); + if (startRng) { + // Listen for selection change events + dom.bind(doc, 'mouseup', endSelection); + dom.bind(doc, 'mousemove', selectionChange); + + dom.getRoot().focus(); + startRng.select(); + } + } + }); + } + + /** + * Fixes selection issues where the caret can be placed between two inline elements like a|b + * this fix will lean the caret right into the closest inline element. + */ + function normalizeSelection() { + // Normalize selection for example a|a becomes a|a except for Ctrl+A since it selects everything + editor.on('keyup focusin mouseup', function(e) { + if (e.keyCode != 65 || !VK.metaKeyPressed(e)) { + selection.normalize(); + } + }, true); + } + + /** + * Forces Gecko to render a broken image icon if it fails to load an image. + */ + function showBrokenImageIcon() { + editor.contentStyles.push( + 'img:-moz-broken {' + + '-moz-force-broken-image-icon:1;' + + 'min-width:24px;' + + 'min-height:24px' + + '}' + ); + } + + /** + * iOS has a bug where it's impossible to type if the document has a touchstart event + * bound and the user touches the document while having the on screen keyboard visible. + * + * The touch event moves the focus to the parent document while having the caret inside the iframe + * this fix moves the focus back into the iframe document. + */ + function restoreFocusOnKeyDown() { + if (!editor.inline) { + editor.on('keydown', function() { + if (document.activeElement == document.body) { + editor.getWin().focus(); + } + }); + } + } + + /** + * IE 11 has an annoying issue where you can't move focus into the editor + * by clicking on the white area HTML element. We used to be able to to fix this with + * the fixCaretSelectionOfDocumentElementOnIe fix. But since M$ removed the selection + * object it's not possible anymore. So we need to hack in a ungly CSS to force the + * body to be at least 150px. If the user clicks the HTML element out side this 150px region + * we simply move the focus into the first paragraph. Not ideal since you loose the + * positioning of the caret but goot enough for most cases. + */ + function bodyHeight() { + if (!editor.inline) { + editor.contentStyles.push('body {min-height: 150px}'); + editor.on('click', function(e) { + if (e.target.nodeName == 'HTML') { + var rng; + + // Need to store away non collapsed ranges since the focus call will mess that up see #7382 + rng = editor.selection.getRng(); + editor.getBody().focus(); + editor.selection.setRng(rng); + editor.selection.normalize(); + editor.nodeChanged(); + } + }); + } + } + + /** + * Firefox on Mac OS will move the browser back to the previous page if you press CMD+Left arrow. + * You might then loose all your work so we need to block that behavior and replace it with our own. + */ + function blockCmdArrowNavigation() { + if (Env.mac) { + editor.on('keydown', function(e) { + if (VK.metaKeyPressed(e) && (e.keyCode == 37 || e.keyCode == 39)) { + e.preventDefault(); + editor.selection.getSel().modify('move', e.keyCode == 37 ? 'backward' : 'forward', 'lineboundary'); + } + }); + } + } + + /** + * Disables the autolinking in IE 9+ this is then re-enabled by the autolink plugin. + */ + function disableAutoUrlDetect() { + setEditorCommandState("AutoUrlDetect", false); + } + + /** + * IE 11 has a fantastic bug where it will produce two trailing BR elements to iframe bodies when + * the iframe is hidden by display: none on a parent container. The DOM is actually out of sync + * with innerHTML in this case. It's like IE adds shadow DOM BR elements that appears on innerHTML + * but not as the lastChild of the body. However is we add a BR element to the body then remove it + * it doesn't seem to add these BR elements makes sence right?! + * + * Example of what happens: text becomes text

    + */ + function doubleTrailingBrElements() { + if (!editor.inline) { + editor.on('focus blur beforegetcontent', function() { + var br = editor.dom.create('br'); + editor.getBody().appendChild(br); + br.parentNode.removeChild(br); + }, true); + } + } + + /** + * iOS 7.1 introduced two new bugs: + * 1) It's possible to open links within a contentEditable area by clicking on them. + * 2) If you hold down the finger it will display the link/image touch callout menu. + */ + function tapLinksAndImages() { + editor.on('click', function(e) { + var elm = e.target; + + do { + if (elm.tagName === 'A') { + e.preventDefault(); + return; + } + } while ((elm = elm.parentNode)); + }); + + editor.contentStyles.push('.mce-content-body {-webkit-touch-callout: none}'); + } + + /** + * iOS Safari and possible other browsers have a bug where it won't fire + * a click event when a contentEditable is focused. This function fakes click events + * by using touchstart/touchend and measuring the time and distance travelled. + */ + function touchClickEvent() { + editor.on('touchstart', function(e) { + var elm, time, startTouch, changedTouches; + + elm = e.target; + time = new Date().getTime(); + changedTouches = e.changedTouches; + + if (!changedTouches || changedTouches.length > 1) { + return; + } + + startTouch = changedTouches[0]; + + editor.once('touchend', function(e) { + var endTouch = e.changedTouches[0], args; + + if (new Date().getTime() - time > 500) { + return; + } + + if (Math.abs(startTouch.clientX - endTouch.clientX) > 5) { + return; + } + + if (Math.abs(startTouch.clientY - endTouch.clientY) > 5) { + return; + } + + args = { + target: elm + }; + + each('pageX pageY clientX clientY screenX screenY'.split(' '), function(key) { + args[key] = endTouch[key]; + }); + + args = editor.fire('click', args); + + if (!args.isDefaultPrevented()) { + // iOS WebKit can't place the caret properly once + // you bind touch events so we need to do this manually + // TODO: Expand to the closest word? Touble tap still works. + editor.selection.placeCaretAt(endTouch.clientX, endTouch.clientY); + editor.nodeChanged(); + } + }); + }); + } + + /** + * WebKit has a bug where it will allow forms to be submitted if they are inside a contentEditable element. + * For example this:
    ' + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/ButtonGroup.js + +/** + * ButtonGroup.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This control enables you to put multiple buttons into a group. This is + * useful when you want to combine similar toolbar buttons into a group. + * + * @example + * // Create and render a buttongroup with two buttons to the body element + * tinymce.ui.Factory.create({ + * type: 'buttongroup', + * items: [ + * {text: 'Button A'}, + * {text: 'Button B'} + * ] + * }).renderTo(document.body); + * + * @-x-less ButtonGroup.less + * @class tinymce.ui.ButtonGroup + * @extends tinymce.ui.Container + */ +define("tinymce/ui/ButtonGroup", [ + "tinymce/ui/Container" +], function(Container) { + "use strict"; + + return Container.extend({ + Defaults: { + defaultType: 'button', + role: 'group' + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout; + + self.addClass('btn-group'); + self.preRender(); + layout.preRender(self); + + return ( + '
    ' + + '
    ' + + (self.settings.html || '') + layout.renderHtml(self) + + '
    ' + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/Checkbox.js + +/** + * Checkbox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This control creates a custom checkbox. + * + * @example + * // Create and render a checkbox to the body element + * tinymce.ui.Factory.create({ + * type: 'checkbox', + * checked: true, + * text: 'My checkbox' + * }).renderTo(document.body); + * + * @-x-less Checkbox.less + * @class tinymce.ui.Checkbox + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Checkbox", [ + "tinymce/ui/Widget" +], function(Widget) { + "use strict"; + + return Widget.extend({ + Defaults: { + classes: "checkbox", + role: "checkbox", + checked: false + }, + + /** + * Constructs a new Checkbox instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Boolean} checked True if the checkbox should be checked by default. + */ + init: function(settings) { + var self = this; + + self._super(settings); + + self.on('click mousedown', function(e) { + e.preventDefault(); + }); + + self.on('click', function(e) { + e.preventDefault(); + + if (!self.disabled()) { + self.checked(!self.checked()); + } + }); + + self.checked(self.settings.checked); + }, + + /** + * Getter/setter function for the checked state. + * + * @method checked + * @param {Boolean} [state] State to be set. + * @return {Boolean|tinymce.ui.Checkbox} True/false or checkbox if it's a set operation. + */ + checked: function(state) { + var self = this; + + if (typeof state != "undefined") { + if (state) { + self.addClass('checked'); + } else { + self.removeClass('checked'); + } + + self._checked = state; + self.aria('checked', state); + + return self; + } + + return self._checked; + }, + + /** + * Getter/setter function for the value state. + * + * @method value + * @param {Boolean} [state] State to be set. + * @return {Boolean|tinymce.ui.Checkbox} True/false or checkbox if it's a set operation. + */ + value: function(state) { + return this.checked(state); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix; + + return ( + '
    ' + + '' + + '' + self.encode(self._text) + '' + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/ComboBox.js + +/** + * ComboBox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a combobox control. Select box that you select a value from or + * type a value into. + * + * @-x-less ComboBox.less + * @class tinymce.ui.ComboBox + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/ComboBox", [ + "tinymce/ui/Widget", + "tinymce/ui/Factory", + "tinymce/ui/DomUtils" +], function(Widget, Factory, DomUtils) { + "use strict"; + + return Widget.extend({ + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {String} placeholder Placeholder text to display. + */ + init: function(settings) { + var self = this; + + self._super(settings); + self.addClass('combobox'); + self.subinput = true; + self.ariaTarget = 'inp'; // TODO: Figure out a better way + + settings = self.settings; + settings.menu = settings.menu || settings.values; + + if (settings.menu) { + settings.icon = 'caret'; + } + + self.on('click', function(e) { + var elm = e.target, root = self.getEl(); + + while (elm && elm != root) { + if (elm.id && elm.id.indexOf('-open') != -1) { + self.fire('action'); + + if (settings.menu) { + self.showMenu(); + + if (e.aria) { + self.menu.items()[0].focus(); + } + } + } + + elm = elm.parentNode; + } + }); + + // TODO: Rework this + self.on('keydown', function(e) { + if (e.target.nodeName == "INPUT" && e.keyCode == 13) { + self.parents().reverse().each(function(ctrl) { + e.preventDefault(); + self.fire('change'); + + if (ctrl.hasEventListeners('submit') && ctrl.toJSON) { + ctrl.fire('submit', {data: ctrl.toJSON()}); + return false; + } + }); + } + }); + + if (settings.placeholder) { + self.addClass('placeholder'); + + self.on('focusin', function() { + if (!self._hasOnChange) { + DomUtils.on(self.getEl('inp'), 'change', function() { + self.fire('change'); + }); + + self._hasOnChange = true; + } + + if (self.hasClass('placeholder')) { + self.getEl('inp').value = ''; + self.removeClass('placeholder'); + } + }); + + self.on('focusout', function() { + if (self.value().length === 0) { + self.getEl('inp').value = settings.placeholder; + self.addClass('placeholder'); + } + }); + } + }, + + showMenu: function() { + var self = this, settings = self.settings, menu; + + if (!self.menu) { + menu = settings.menu || []; + + // Is menu array then auto constuct menu control + if (menu.length) { + menu = { + type: 'menu', + items: menu + }; + } else { + menu.type = menu.type || 'menu'; + } + + self.menu = Factory.create(menu).parent(self).renderTo(self.getContainerElm()); + self.fire('createmenu'); + self.menu.reflow(); + self.menu.on('cancel', function(e) { + if (e.control === self.menu) { + self.focus(); + } + }); + + self.menu.on('show hide', function(e) { + e.control.items().each(function(ctrl) { + ctrl.active(ctrl.value() == self.value()); + }); + }).fire('show'); + + self.menu.on('select', function(e) { + self.value(e.control.value()); + }); + + self.on('focusin', function(e) { + if (e.target.tagName.toUpperCase() == 'INPUT') { + self.menu.hide(); + } + }); + + self.aria('expanded', true); + } + + self.menu.show(); + self.menu.layoutRect({w: self.layoutRect().w}); + self.menu.moveRel(self.getEl(), self.isRtl() ? ['br-tr', 'tr-br'] : ['bl-tl', 'tl-bl']); + }, + + /** + * Getter/setter function for the control value. + * + * @method value + * @param {String} [value] Value to be set. + * @return {String|tinymce.ui.ComboBox} Value or self if it's a set operation. + */ + value: function(value) { + var self = this; + + if (typeof value != "undefined") { + self._value = value; + self.removeClass('placeholder'); + + if (self._rendered) { + self.getEl('inp').value = value; + } + + return self; + } + + if (self._rendered) { + value = self.getEl('inp').value; + + if (value != self.settings.placeholder) { + return value; + } + + return ''; + } + + return self._value; + }, + + /** + * Getter/setter function for the disabled state. + * + * @method value + * @param {Boolean} [state] State to be set. + * @return {Boolean|tinymce.ui.ComboBox} True/false or self if it's a set operation. + */ + disabled: function(state) { + var self = this; + + if (self._rendered && typeof state != 'undefined') { + self.getEl('inp').disabled = state; + } + + return self._super(state); + }, + + /** + * Focuses the input area of the control. + * + * @method focus + */ + focus: function() { + this.getEl('inp').focus(); + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this, elm = self.getEl(), openElm = self.getEl('open'), rect = self.layoutRect(); + var width, lineHeight; + + if (openElm) { + width = rect.w - DomUtils.getSize(openElm).width - 10; + } else { + width = rect.w - 10; + } + + // Detect old IE 7+8 add lineHeight to align caret vertically in the middle + var doc = document; + if (doc.all && (!doc.documentMode || doc.documentMode <= 8)) { + lineHeight = (self.layoutRect().h - 2) + 'px'; + } + + DomUtils.css(elm.firstChild, { + width: width, + lineHeight: lineHeight + }); + + self._super(); + + return self; + }, + + /** + * Post render method. Called after the control has been rendered to the target. + * + * @method postRender + * @return {tinymce.ui.ComboBox} Current combobox instance. + */ + postRender: function() { + var self = this; + + DomUtils.on(this.getEl('inp'), 'change', function() { + self.fire('change'); + }); + + return self._super(); + }, + + remove: function() { + DomUtils.off(this.getEl('inp')); + this._super(); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, settings = self.settings, prefix = self.classPrefix; + var value = settings.value || settings.placeholder || ''; + var icon, text, openBtnHtml = '', extraAttrs = ''; + + if ("spellcheck" in settings) { + extraAttrs += ' spellcheck="' + settings.spellcheck + '"'; + } + + if (settings.maxLength) { + extraAttrs += ' maxlength="' + settings.maxLength + '"'; + } + + if (settings.size) { + extraAttrs += ' size="' + settings.size + '"'; + } + + if (settings.subtype) { + extraAttrs += ' type="' + settings.subtype + '"'; + } + + if (self.disabled()) { + extraAttrs += ' disabled="disabled"'; + } + + icon = settings.icon; + if (icon && icon != 'caret') { + icon = prefix + 'ico ' + prefix + 'i-' + settings.icon; + } + + text = self._text; + + if (icon || text) { + openBtnHtml = ( + '
    ' + + '' + + '
    ' + ); + + self.addClass('has-open'); + } + + return ( + '
    ' + + '' + + openBtnHtml + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/ColorBox.js + +/** + * ColorBox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This widget lets you enter colors and browse for colors by pressing the color button. It also displays + * a preview of the current color. + * + * @-x-less ColorBox.less + * @class tinymce.ui.ColorBox + * @extends tinymce.ui.ComboBox + */ +define("tinymce/ui/ColorBox", [ + "tinymce/ui/ComboBox" +], function(ComboBox) { + "use strict"; + + return ComboBox.extend({ + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this; + + settings.spellcheck = false; + + if (settings.onaction) { + settings.icon = 'none'; + } + + self._super(settings); + + self.addClass('colorbox'); + self.on('change keyup postrender', function() { + self.repaintColor(self.value()); + }); + }, + + repaintColor: function(value) { + var elm = this.getEl().getElementsByTagName('i')[0]; + + if (elm) { + try { + elm.style.background = value; + } catch (ex) { + // Ignore + } + } + }, + + value: function(value) { + var self = this; + + if (typeof value != "undefined") { + if (self._rendered) { + self.repaintColor(value); + } + } + + return self._super(value); + } + }); +}); + +// Included from: js/tinymce/classes/ui/PanelButton.js + +/** + * PanelButton.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new panel button. + * + * @class tinymce.ui.PanelButton + * @extends tinymce.ui.Button + */ +define("tinymce/ui/PanelButton", [ + "tinymce/ui/Button", + "tinymce/ui/FloatPanel" +], function(Button, FloatPanel) { + "use strict"; + + return Button.extend({ + /** + * Shows the panel for the button. + * + * @method showPanel + */ + showPanel: function() { + var self = this, settings = self.settings; + + self.active(true); + + if (!self.panel) { + var panelSettings = settings.panel; + + // Wrap panel in grid layout if type if specified + // This makes it possible to add forms or other containers directly in the panel option + if (panelSettings.type) { + panelSettings = { + layout: 'grid', + items: panelSettings + }; + } + + panelSettings.role = panelSettings.role || 'dialog'; + panelSettings.popover = true; + panelSettings.autohide = true; + panelSettings.ariaRoot = true; + + self.panel = new FloatPanel(panelSettings).on('hide', function() { + self.active(false); + }).on('cancel', function(e) { + e.stopPropagation(); + self.focus(); + self.hidePanel(); + }).parent(self).renderTo(self.getContainerElm()); + + self.panel.fire('show'); + self.panel.reflow(); + } else { + self.panel.show(); + } + + self.panel.moveRel(self.getEl(), settings.popoverAlign || (self.isRtl() ? ['bc-tr', 'bc-tc'] : ['bc-tl', 'bc-tc'])); + }, + + /** + * Hides the panel for the button. + * + * @method hidePanel + */ + hidePanel: function() { + var self = this; + + if (self.panel) { + self.panel.hide(); + } + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self.aria('haspopup', true); + + self.on('click', function(e) { + if (e.control === self) { + if (self.panel && self.panel.visible()) { + self.hidePanel(); + } else { + self.showPanel(); + self.panel.focus(!!e.aria); + } + } + }); + + return self._super(); + }, + + remove: function() { + if (this.panel) { + this.panel.remove(); + this.panel = null; + } + + return this._super(); + } + }); +}); + +// Included from: js/tinymce/classes/ui/ColorButton.js + +/** + * ColorButton.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a color button control. This is a split button in which the main + * button has a visual representation of the currently selected color. When clicked + * the caret button displays a color picker, allowing the user to select a new color. + * + * @-x-less ColorButton.less + * @class tinymce.ui.ColorButton + * @extends tinymce.ui.PanelButton + */ +define("tinymce/ui/ColorButton", [ + "tinymce/ui/PanelButton", + "tinymce/dom/DOMUtils" +], function(PanelButton, DomUtils) { + "use strict"; + + var DOM = DomUtils.DOM; + + return PanelButton.extend({ + /** + * Constructs a new ColorButton instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + this._super(settings); + this.addClass('colorbutton'); + }, + + /** + * Getter/setter for the current color. + * + * @method color + * @param {String} [color] Color to set. + * @return {String|tinymce.ui.ColorButton} Current color or current instance. + */ + color: function(color) { + if (color) { + this._color = color; + this.getEl('preview').style.backgroundColor = color; + return this; + } + + return this._color; + }, + + /** + * Resets the current color. + * + * @method resetColor + * @return {tinymce.ui.ColorButton} Current instance. + */ + resetColor: function() { + this._color = null; + this.getEl('preview').style.backgroundColor = null; + return this; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix; + var icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : ''; + var image = self.settings.image ? ' style="background-image: url(\'' + self.settings.image + '\')"' : ''; + + return ( + '
    ' + + '' + + '' + + '
    ' + ); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this, onClickHandler = self.settings.onclick; + + self.on('click', function(e) { + if (e.aria && e.aria.key == 'down') { + return; + } + + if (e.control == self && !DOM.getParent(e.target, '.' + self.classPrefix + 'open')) { + e.stopImmediatePropagation(); + onClickHandler.call(self, e); + } + }); + + delete self.settings.onclick; + + return self._super(); + } + }); +}); + +// Included from: js/tinymce/classes/util/Color.js + +/** + * Color.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class lets you parse/serialize colors and convert rgb/hsb. + * + * @class tinymce.util.Color + * @example + * var white = new tinymce.util.Color({r: 255, g: 255, b: 255}); + * var red = new tinymce.util.Color('#FF0000'); + * + * console.log(white.toHex(), red.toHsv()); + */ +define("tinymce/util/Color", [], function() { + var min = Math.min, max = Math.max, round = Math.round; + + /** + * Constructs a new color instance. + * + * @constructor + * @method Color + * @param {String} value Optional initial value to parse. + */ + function Color(value) { + var self = this, r = 0, g = 0, b = 0; + + function rgb2hsv(r, g, b) { + var h, s, v, d, minRGB, maxRGB; + + h = 0; + s = 0; + v = 0; + r = r / 255; + g = g / 255; + b = b / 255; + + minRGB = min(r, min(g, b)); + maxRGB = max(r, max(g, b)); + + if (minRGB == maxRGB) { + v = minRGB; + + return { + h: 0, + s: 0, + v: v * 100 + }; + } + + /*eslint no-nested-ternary:0 */ + d = (r == minRGB) ? g - b : ((b == minRGB) ? r - g : b - r); + h = (r == minRGB) ? 3 : ((b == minRGB) ? 1 : 5); + h = 60 * (h - d / (maxRGB - minRGB)); + s = (maxRGB - minRGB) / maxRGB; + v = maxRGB; + + return { + h: round(h), + s: round(s * 100), + v: round(v * 100) + }; + } + + function hsvToRgb(hue, saturation, brightness) { + var side, chroma, x, match; + + hue = (parseInt(hue, 10) || 0) % 360; + saturation = parseInt(saturation, 10) / 100; + brightness = parseInt(brightness, 10) / 100; + saturation = max(0, min(saturation, 1)); + brightness = max(0, min(brightness, 1)); + + if (saturation === 0) { + r = g = b = round(255 * brightness); + return; + } + + side = hue / 60; + chroma = brightness * saturation; + x = chroma * (1 - Math.abs(side % 2 - 1)); + match = brightness - chroma; + + switch (Math.floor(side)) { + case 0: + r = chroma; + g = x; + b = 0; + break; + + case 1: + r = x; + g = chroma; + b = 0; + break; + + case 2: + r = 0; + g = chroma; + b = x; + break; + + case 3: + r = 0; + g = x; + b = chroma; + break; + + case 4: + r = x; + g = 0; + b = chroma; + break; + + case 5: + r = chroma; + g = 0; + b = x; + break; + + default: + r = g = b = 0; + } + + r = round(255 * (r + match)); + g = round(255 * (g + match)); + b = round(255 * (b + match)); + } + + /** + * Returns the hex string of the current color. For example: #ff00ff + * + * @method toHex + * @return {String} Hex string of current color. + */ + function toHex() { + function hex(val) { + val = parseInt(val, 10).toString(16); + + return val.length > 1 ? val : '0' + val; + } + + return '#' + hex(r) + hex(g) + hex(b); + } + + /** + * Returns the r, g, b values of the color. Each channel has a range from 0-255. + * + * @method toRgb + * @return {Object} Object with r, g, b fields. + */ + function toRgb() { + return { + r: r, + g: g, + b: b + }; + } + + /** + * Returns the h, s, v values of the color. Ranges: h=0-360, s=0-100, v=0-100. + * + * @method toHsv + * @return {Object} Object with h, s, v fields. + */ + function toHsv() { + return rgb2hsv(r, g, b); + } + + /** + * Parses the specified value and populates the color instance. + * + * Supported format examples: + * * rbg(255,0,0) + * * #ff0000 + * * #fff + * * {r: 255, g: 0, b: 0} + * * {h: 360, s: 100, v: 100} + * + * @method parse + * @param {Object/String} value Color value to parse. + * @return {tinymce.util.Color} Current color instance. + */ + function parse(value) { + var matches; + + if (typeof value == 'object') { + if ("r" in value) { + r = value.r; + g = value.g; + b = value.b; + } else if ("v" in value) { + hsvToRgb(value.h, value.s, value.v); + } + } else { + if ((matches = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(value))) { + r = parseInt(matches[1], 10); + g = parseInt(matches[2], 10); + b = parseInt(matches[3], 10); + } else if ((matches = /#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(value))) { + r = parseInt(matches[1], 16); + g = parseInt(matches[2], 16); + b = parseInt(matches[3], 16); + } else if ((matches = /#([0-F])([0-F])([0-F])/gi.exec(value))) { + r = parseInt(matches[1] + matches[1], 16); + g = parseInt(matches[2] + matches[2], 16); + b = parseInt(matches[3] + matches[3], 16); + } + } + + r = r < 0 ? 0 : (r > 255 ? 255 : r); + g = g < 0 ? 0 : (g > 255 ? 255 : g); + b = b < 0 ? 0 : (b > 255 ? 255 : b); + + return self; + } + + if (value) { + parse(value); + } + + self.toRgb = toRgb; + self.toHsv = toHsv; + self.toHex = toHex; + self.parse = parse; + } + + return Color; +}); + +// Included from: js/tinymce/classes/ui/ColorPicker.js + +/** + * ColorPicker.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Color picker widget lets you select colors. + * + * @-x-less ColorPicker.less + * @class tinymce.ui.ColorPicker + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/ColorPicker", [ + "tinymce/ui/Widget", + "tinymce/ui/DragHelper", + "tinymce/ui/DomUtils", + "tinymce/util/Color" +], function(Widget, DragHelper, DomUtils, Color) { + "use strict"; + + return Widget.extend({ + Defaults: { + classes: "widget colorpicker" + }, + + /** + * Constructs a new colorpicker instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {String} color Initial color value. + */ + init: function(settings) { + this._super(settings); + }, + + postRender: function() { + var self = this, color = self.color(), hsv, hueRootElm, huePointElm, svRootElm, svPointElm; + + hueRootElm = self.getEl('h'); + huePointElm = self.getEl('hp'); + svRootElm = self.getEl('sv'); + svPointElm = self.getEl('svp'); + + function getPos(elm, event) { + var pos = DomUtils.getPos(elm), x, y; + + x = event.pageX - pos.x; + y = event.pageY - pos.y; + + x = Math.max(0, Math.min(x / elm.clientWidth, 1)); + y = Math.max(0, Math.min(y / elm.clientHeight, 1)); + + return { + x: x, + y: y + }; + } + + function updateColor(hsv, hueUpdate) { + var hue = (360 - hsv.h) / 360; + + DomUtils.css(huePointElm, { + top: (hue * 100) + '%' + }); + + if (!hueUpdate) { + DomUtils.css(svPointElm, { + left: hsv.s + '%', + top: (100 - hsv.v) + '%' + }); + } + + svRootElm.style.background = new Color({s: 100, v: 100, h: hsv.h}).toHex(); + self.color().parse({s: hsv.s, v: hsv.v, h: hsv.h}); + } + + function updateSaturationAndValue(e) { + var pos; + + pos = getPos(svRootElm, e); + hsv.s = pos.x * 100; + hsv.v = (1 - pos.y) * 100; + + updateColor(hsv); + self.fire('change'); + } + + function updateHue(e) { + var pos; + + pos = getPos(hueRootElm, e); + hsv = color.toHsv(); + hsv.h = (1 - pos.y) * 360; + updateColor(hsv, true); + self.fire('change'); + } + + self._repaint = function() { + hsv = color.toHsv(); + updateColor(hsv); + }; + + self._super(); + + self._svdraghelper = new DragHelper(self._id + '-sv', { + start: updateSaturationAndValue, + drag: updateSaturationAndValue + }); + + self._hdraghelper = new DragHelper(self._id + '-h', { + start: updateHue, + drag: updateHue + }); + + self._repaint(); + }, + + rgb: function() { + return this.color().toRgb(); + }, + + value: function(value) { + var self = this; + + if (arguments.length) { + self.color().parse(value); + + if (self._rendered) { + self._repaint(); + } + } else { + return self.color().toHex(); + } + }, + + color: function() { + if (!this._color) { + this._color = new Color(); + } + + return this._color; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix, hueHtml; + var stops = '#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000'; + + function getOldIeFallbackHtml() { + var i, l, html = '', gradientPrefix, stopsList; + + gradientPrefix = 'filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='; + stopsList = stops.split(','); + for (i = 0, l = stopsList.length - 1; i < l; i++) { + html += ( + '
    ' + ); + } + + return html; + } + + var gradientCssText = ( + 'background: -ms-linear-gradient(top,' + stops + ');' + + 'background: linear-gradient(to bottom,' + stops + ');' + ); + + hueHtml = ( + '
    ' + + getOldIeFallbackHtml() + + '
    ' + + '
    ' + ); + + return ( + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + hueHtml + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/Path.js + +/** + * Path.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new path control. + * + * @-x-less Path.less + * @class tinymce.ui.Path + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Path", [ + "tinymce/ui/Widget" +], function(Widget) { + "use strict"; + + return Widget.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {String} delimiter Delimiter to display between items in path. + */ + init: function(settings) { + var self = this; + + if (!settings.delimiter) { + settings.delimiter = '\u00BB'; + } + + self._super(settings); + self.addClass('path'); + self.canFocus = true; + + self.on('click', function(e) { + var index, target = e.target; + + if ((index = target.getAttribute('data-index'))) { + self.fire('select', {value: self.data()[index], index: index}); + } + }); + }, + + /** + * Focuses the current control. + * + * @method focus + * @return {tinymce.ui.Control} Current control instance. + */ + focus: function() { + var self = this; + + self.getEl().firstChild.focus(); + + return self; + }, + + /** + * Sets/gets the data to be used for the path. + * + * @method data + * @param {Array} data Array with items name is rendered to path. + */ + data: function(data) { + var self = this; + + if (typeof data !== "undefined") { + self._data = data; + self.update(); + + return self; + } + + return self._data; + }, + + /** + * Updated the path. + * + * @private + */ + update: function() { + this.innerHtml(this._getPathHtml()); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self._super(); + + self.data(self.settings.data); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this; + + return ( + '
    ' + + self._getPathHtml() + + '
    ' + ); + }, + + _getPathHtml: function() { + var self = this, parts = self._data || [], i, l, html = '', prefix = self.classPrefix; + + for (i = 0, l = parts.length; i < l; i++) { + html += ( + (i > 0 ? '' : '') + + '
    ' + parts[i].name + '
    ' + ); + } + + if (!html) { + html = '
    \u00a0
    '; + } + + return html; + } + }); +}); + +// Included from: js/tinymce/classes/ui/ElementPath.js + +/** + * ElementPath.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This control creates an path for the current selections parent elements in TinyMCE. + * + * @class tinymce.ui.ElementPath + * @extends tinymce.ui.Path + */ +define("tinymce/ui/ElementPath", [ + "tinymce/ui/Path", + "tinymce/EditorManager" +], function(Path, EditorManager) { + return Path.extend({ + /** + * Post render method. Called after the control has been rendered to the target. + * + * @method postRender + * @return {tinymce.ui.ElementPath} Current combobox instance. + */ + postRender: function() { + var self = this, editor = EditorManager.activeEditor; + + function isHidden(elm) { + if (elm.nodeType === 1) { + if (elm.nodeName == "BR" || !!elm.getAttribute('data-mce-bogus')) { + return true; + } + + if (elm.getAttribute('data-mce-type') === 'bookmark') { + return true; + } + } + + return false; + } + + if (editor.settings.elementpath !== false) { + self.on('select', function(e) { + editor.focus(); + editor.selection.select(this.data()[e.index].element); + editor.nodeChanged(); + }); + + editor.on('nodeChange', function(e) { + var outParents = [], parents = e.parents, i = parents.length; + + while (i--) { + if (parents[i].nodeType == 1 && !isHidden(parents[i])) { + var args = editor.fire('ResolveName', { + name: parents[i].nodeName.toLowerCase(), + target: parents[i] + }); + + if (!args.isDefaultPrevented()) { + outParents.push({name: args.name, element: parents[i]}); + } + + if (args.isPropagationStopped()) { + break; + } + } + } + + self.data(outParents); + }); + } + + return self._super(); + } + }); +}); + +// Included from: js/tinymce/classes/ui/FormItem.js + +/** + * FormItem.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class is a container created by the form element with + * a label and control item. + * + * @class tinymce.ui.FormItem + * @extends tinymce.ui.Container + * @setting {String} label Label to display for the form item. + */ +define("tinymce/ui/FormItem", [ + "tinymce/ui/Container" +], function(Container) { + "use strict"; + + return Container.extend({ + Defaults: { + layout: 'flex', + align: 'center', + defaults: { + flex: 1 + } + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, prefix = self.classPrefix; + + self.addClass('formitem'); + layout.preRender(self); + + return ( + '
    ' + + (self.settings.title ? ('
    ' + + self.settings.title + '
    ') : '') + + '
    ' + + (self.settings.html || '') + layout.renderHtml(self) + + '
    ' + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/Form.js + +/** + * Form.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a form container. A form container has the ability + * to automatically wrap items in tinymce.ui.FormItem instances. + * + * Each FormItem instance is a container for the label and the item. + * + * @example + * tinymce.ui.Factory.create({ + * type: 'form', + * items: [ + * {type: 'textbox', label: 'My text box'} + * ] + * }).renderTo(document.body); + * + * @class tinymce.ui.Form + * @extends tinymce.ui.Container + */ +define("tinymce/ui/Form", [ + "tinymce/ui/Container", + "tinymce/ui/FormItem", + "tinymce/util/Tools" +], function(Container, FormItem, Tools) { + "use strict"; + + return Container.extend({ + Defaults: { + containerCls: 'form', + layout: 'flex', + direction: 'column', + align: 'stretch', + flex: 1, + padding: 20, + labelGap: 30, + spacing: 10, + callbacks: { + submit: function() { + this.submit(); + } + } + }, + + /** + * This method gets invoked before the control is rendered. + * + * @method preRender + */ + preRender: function() { + var self = this, items = self.items(); + + if (!self.settings.formItemDefaults) { + self.settings.formItemDefaults = { + layout: 'flex', + autoResize: "overflow", + defaults: {flex: 1} + }; + } + + // Wrap any labeled items in FormItems + items.each(function(ctrl) { + var formItem, label = ctrl.settings.label; + + if (label) { + formItem = new FormItem(Tools.extend({ + items: { + type: 'label', + id: ctrl._id + '-l', + text: label, + flex: 0, + forId: ctrl._id, + disabled: ctrl.disabled() + } + }, self.settings.formItemDefaults)); + + formItem.type = 'formitem'; + ctrl.aria('labelledby', ctrl._id + '-l'); + + if (typeof ctrl.settings.flex == "undefined") { + ctrl.settings.flex = 1; + } + + self.replace(ctrl, formItem); + formItem.add(ctrl); + } + }); + }, + + /** + * Recalcs label widths. + * + * @private + */ + recalcLabels: function() { + var self = this, maxLabelWidth = 0, labels = [], i, labelGap, items; + + if (self.settings.labelGapCalc === false) { + return; + } + + if (self.settings.labelGapCalc == "children") { + items = self.find('formitem'); + } else { + items = self.items(); + } + + items.filter('formitem').each(function(item) { + var labelCtrl = item.items()[0], labelWidth = labelCtrl.getEl().clientWidth; + + maxLabelWidth = labelWidth > maxLabelWidth ? labelWidth : maxLabelWidth; + labels.push(labelCtrl); + }); + + labelGap = self.settings.labelGap || 0; + + i = labels.length; + while (i--) { + labels[i].settings.minWidth = maxLabelWidth + labelGap; + } + }, + + /** + * Getter/setter for the visibility state. + * + * @method visible + * @param {Boolean} [state] True/false state to show/hide. + * @return {tinymce.ui.Form|Boolean} True/false state or current control. + */ + visible: function(state) { + var val = this._super(state); + + if (state === true && this._rendered) { + this.recalcLabels(); + } + + return val; + }, + + /** + * Fires a submit event with the serialized form. + * + * @method submit + * @return {Object} Event arguments object. + */ + submit: function() { + return this.fire('submit', {data: this.toJSON()}); + }, + + /** + * Post render method. Called after the control has been rendered to the target. + * + * @method postRender + * @return {tinymce.ui.ComboBox} Current combobox instance. + */ + postRender: function() { + var self = this; + + self._super(); + self.recalcLabels(); + self.fromJSON(self.settings.data); + } + }); +}); + +// Included from: js/tinymce/classes/ui/FieldSet.js + +/** + * FieldSet.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates fieldset containers. + * + * @-x-less FieldSet.less + * @class tinymce.ui.FieldSet + * @extends tinymce.ui.Form + */ +define("tinymce/ui/FieldSet", [ + "tinymce/ui/Form" +], function(Form) { + "use strict"; + + return Form.extend({ + Defaults: { + containerCls: 'fieldset', + layout: 'flex', + direction: 'column', + align: 'stretch', + flex: 1, + padding: "25 15 5 15", + labelGap: 30, + spacing: 10, + border: 1 + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, prefix = self.classPrefix; + + self.preRender(); + layout.preRender(self); + + return ( + '
    ' + + (self.settings.title ? ('' + + self.settings.title + '') : '') + + '
    ' + + (self.settings.html || '') + layout.renderHtml(self) + + '
    ' + + '
    ' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/FilePicker.js + +/** + * FilePicker.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*global tinymce:true */ + +/** + * This class creates a file picker control. + * + * @class tinymce.ui.FilePicker + * @extends tinymce.ui.ComboBox + */ +define("tinymce/ui/FilePicker", [ + "tinymce/ui/ComboBox", + "tinymce/util/Tools" +], function(ComboBox, Tools) { + "use strict"; + + return ComboBox.extend({ + /** + * Constructs a new control instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this, editor = tinymce.activeEditor, editorSettings = editor.settings; + var actionCallback, fileBrowserCallback, fileBrowserCallbackTypes; + + settings.spellcheck = false; + + fileBrowserCallbackTypes = editorSettings.file_picker_types || editorSettings.file_browser_callback_types; + if (fileBrowserCallbackTypes) { + fileBrowserCallbackTypes = Tools.makeMap(fileBrowserCallbackTypes, /[, ]/); + } + + if (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[settings.filetype]) { + fileBrowserCallback = editorSettings.file_picker_callback; + if (fileBrowserCallback && (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[settings.filetype])) { + actionCallback = function() { + var meta = self.fire('beforecall').meta; + + meta = Tools.extend({filetype: settings.filetype}, meta); + + // file_picker_callback(callback, currentValue, metaData) + fileBrowserCallback.call( + editor, + function(value, meta) { + self.value(value).fire('change', {meta: meta}); + }, + self.value(), + meta + ); + }; + } else { + // Legacy callback: file_picker_callback(id, currentValue, filetype, window) + fileBrowserCallback = editorSettings.file_browser_callback; + if (fileBrowserCallback && (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[settings.filetype])) { + actionCallback = function() { + fileBrowserCallback( + self.getEl('inp').id, + self.value(), + settings.filetype, + window + ); + }; + } + } + } + + if (actionCallback) { + settings.icon = 'browse'; + settings.onaction = actionCallback; + } + + self._super(settings); + } + }); +}); + +// Included from: js/tinymce/classes/ui/FitLayout.js + +/** + * FitLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This layout manager will resize the control to be the size of it's parent container. + * In other words width: 100% and height: 100%. + * + * @-x-less FitLayout.less + * @class tinymce.ui.FitLayout + * @extends tinymce.ui.AbsoluteLayout + */ +define("tinymce/ui/FitLayout", [ + "tinymce/ui/AbsoluteLayout" +], function(AbsoluteLayout) { + "use strict"; + + return AbsoluteLayout.extend({ + /** + * Recalculates the positions of the controls in the specified container. + * + * @method recalc + * @param {tinymce.ui.Container} container Container instance to recalc. + */ + recalc: function(container) { + var contLayoutRect = container.layoutRect(), paddingBox = container.paddingBox(); + + container.items().filter(':visible').each(function(ctrl) { + ctrl.layoutRect({ + x: paddingBox.left, + y: paddingBox.top, + w: contLayoutRect.innerW - paddingBox.right - paddingBox.left, + h: contLayoutRect.innerH - paddingBox.top - paddingBox.bottom + }); + + if (ctrl.recalc) { + ctrl.recalc(); + } + }); + } + }); +}); + +// Included from: js/tinymce/classes/ui/FlexLayout.js + +/** + * FlexLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This layout manager works similar to the CSS flex box. + * + * @setting {String} direction row|row-reverse|column|column-reverse + * @setting {Number} flex A positive-number to flex by. + * @setting {String} align start|end|center|stretch + * @setting {String} pack start|end|justify + * + * @class tinymce.ui.FlexLayout + * @extends tinymce.ui.AbsoluteLayout + */ +define("tinymce/ui/FlexLayout", [ + "tinymce/ui/AbsoluteLayout" +], function(AbsoluteLayout) { + "use strict"; + + return AbsoluteLayout.extend({ + /** + * Recalculates the positions of the controls in the specified container. + * + * @method recalc + * @param {tinymce.ui.Container} container Container instance to recalc. + */ + recalc: function(container) { + // A ton of variables, needs to be in the same scope for performance + var i, l, items, contLayoutRect, contPaddingBox, contSettings, align, pack, spacing, totalFlex, availableSpace, direction; + var ctrl, ctrlLayoutRect, ctrlSettings, flex, maxSizeItems = [], size, maxSize, ratio, rect, pos, maxAlignEndPos; + var sizeName, minSizeName, posName, maxSizeName, beforeName, innerSizeName, deltaSizeName, contentSizeName; + var alignAxisName, alignInnerSizeName, alignSizeName, alignMinSizeName, alignBeforeName, alignAfterName; + var alignDeltaSizeName, alignContentSizeName; + var max = Math.max, min = Math.min; + + // Get container items, properties and settings + items = container.items().filter(':visible'); + contLayoutRect = container.layoutRect(); + contPaddingBox = container._paddingBox; + contSettings = container.settings; + direction = container.isRtl() ? (contSettings.direction || 'row-reversed') : contSettings.direction; + align = contSettings.align; + pack = container.isRtl() ? (contSettings.pack || 'end') : contSettings.pack; + spacing = contSettings.spacing || 0; + + if (direction == "row-reversed" || direction == "column-reverse") { + items = items.set(items.toArray().reverse()); + direction = direction.split('-')[0]; + } + + // Setup axis variable name for row/column direction since the calculations is the same + if (direction == "column") { + posName = "y"; + sizeName = "h"; + minSizeName = "minH"; + maxSizeName = "maxH"; + innerSizeName = "innerH"; + beforeName = 'top'; + deltaSizeName = "deltaH"; + contentSizeName = "contentH"; + + alignBeforeName = "left"; + alignSizeName = "w"; + alignAxisName = "x"; + alignInnerSizeName = "innerW"; + alignMinSizeName = "minW"; + alignAfterName = "right"; + alignDeltaSizeName = "deltaW"; + alignContentSizeName = "contentW"; + } else { + posName = "x"; + sizeName = "w"; + minSizeName = "minW"; + maxSizeName = "maxW"; + innerSizeName = "innerW"; + beforeName = 'left'; + deltaSizeName = "deltaW"; + contentSizeName = "contentW"; + + alignBeforeName = "top"; + alignSizeName = "h"; + alignAxisName = "y"; + alignInnerSizeName = "innerH"; + alignMinSizeName = "minH"; + alignAfterName = "bottom"; + alignDeltaSizeName = "deltaH"; + alignContentSizeName = "contentH"; + } + + // Figure out total flex, availableSpace and collect any max size elements + availableSpace = contLayoutRect[innerSizeName] - contPaddingBox[beforeName] - contPaddingBox[beforeName]; + maxAlignEndPos = totalFlex = 0; + for (i = 0, l = items.length; i < l; i++) { + ctrl = items[i]; + ctrlLayoutRect = ctrl.layoutRect(); + ctrlSettings = ctrl.settings; + flex = ctrlSettings.flex; + availableSpace -= (i < l - 1 ? spacing : 0); + + if (flex > 0) { + totalFlex += flex; + + // Flexed item has a max size then we need to check if we will hit that size + if (ctrlLayoutRect[maxSizeName]) { + maxSizeItems.push(ctrl); + } + + ctrlLayoutRect.flex = flex; + } + + availableSpace -= ctrlLayoutRect[minSizeName]; + + // Calculate the align end position to be used to check for overflow/underflow + size = contPaddingBox[alignBeforeName] + ctrlLayoutRect[alignMinSizeName] + contPaddingBox[alignAfterName]; + if (size > maxAlignEndPos) { + maxAlignEndPos = size; + } + } + + // Calculate minW/minH + rect = {}; + if (availableSpace < 0) { + rect[minSizeName] = contLayoutRect[minSizeName] - availableSpace + contLayoutRect[deltaSizeName]; + } else { + rect[minSizeName] = contLayoutRect[innerSizeName] - availableSpace + contLayoutRect[deltaSizeName]; + } + + rect[alignMinSizeName] = maxAlignEndPos + contLayoutRect[alignDeltaSizeName]; + + rect[contentSizeName] = contLayoutRect[innerSizeName] - availableSpace; + rect[alignContentSizeName] = maxAlignEndPos; + rect.minW = min(rect.minW, contLayoutRect.maxW); + rect.minH = min(rect.minH, contLayoutRect.maxH); + rect.minW = max(rect.minW, contLayoutRect.startMinWidth); + rect.minH = max(rect.minH, contLayoutRect.startMinHeight); + + // Resize container container if minSize was changed + if (contLayoutRect.autoResize && (rect.minW != contLayoutRect.minW || rect.minH != contLayoutRect.minH)) { + rect.w = rect.minW; + rect.h = rect.minH; + + container.layoutRect(rect); + this.recalc(container); + + // Forced recalc for example if items are hidden/shown + if (container._lastRect === null) { + var parentCtrl = container.parent(); + if (parentCtrl) { + parentCtrl._lastRect = null; + parentCtrl.recalc(); + } + } + + return; + } + + // Handle max size elements, check if they will become to wide with current options + ratio = availableSpace / totalFlex; + for (i = 0, l = maxSizeItems.length; i < l; i++) { + ctrl = maxSizeItems[i]; + ctrlLayoutRect = ctrl.layoutRect(); + maxSize = ctrlLayoutRect[maxSizeName]; + size = ctrlLayoutRect[minSizeName] + ctrlLayoutRect.flex * ratio; + + if (size > maxSize) { + availableSpace -= (ctrlLayoutRect[maxSizeName] - ctrlLayoutRect[minSizeName]); + totalFlex -= ctrlLayoutRect.flex; + ctrlLayoutRect.flex = 0; + ctrlLayoutRect.maxFlexSize = maxSize; + } else { + ctrlLayoutRect.maxFlexSize = 0; + } + } + + // Setup new ratio, target layout rect, start position + ratio = availableSpace / totalFlex; + pos = contPaddingBox[beforeName]; + rect = {}; + + // Handle pack setting moves the start position to end, center + if (totalFlex === 0) { + if (pack == "end") { + pos = availableSpace + contPaddingBox[beforeName]; + } else if (pack == "center") { + pos = Math.round( + (contLayoutRect[innerSizeName] / 2) - ((contLayoutRect[innerSizeName] - availableSpace) / 2) + ) + contPaddingBox[beforeName]; + + if (pos < 0) { + pos = contPaddingBox[beforeName]; + } + } else if (pack == "justify") { + pos = contPaddingBox[beforeName]; + spacing = Math.floor(availableSpace / (items.length - 1)); + } + } + + // Default aligning (start) the other ones needs to be calculated while doing the layout + rect[alignAxisName] = contPaddingBox[alignBeforeName]; + + // Start laying out controls + for (i = 0, l = items.length; i < l; i++) { + ctrl = items[i]; + ctrlLayoutRect = ctrl.layoutRect(); + size = ctrlLayoutRect.maxFlexSize || ctrlLayoutRect[minSizeName]; + + // Align the control on the other axis + if (align === "center") { + rect[alignAxisName] = Math.round((contLayoutRect[alignInnerSizeName] / 2) - (ctrlLayoutRect[alignSizeName] / 2)); + } else if (align === "stretch") { + rect[alignSizeName] = max( + ctrlLayoutRect[alignMinSizeName] || 0, + contLayoutRect[alignInnerSizeName] - contPaddingBox[alignBeforeName] - contPaddingBox[alignAfterName] + ); + rect[alignAxisName] = contPaddingBox[alignBeforeName]; + } else if (align === "end") { + rect[alignAxisName] = contLayoutRect[alignInnerSizeName] - ctrlLayoutRect[alignSizeName] - contPaddingBox.top; + } + + // Calculate new size based on flex + if (ctrlLayoutRect.flex > 0) { + size += ctrlLayoutRect.flex * ratio; + } + + rect[sizeName] = size; + rect[posName] = pos; + ctrl.layoutRect(rect); + + // Recalculate containers + if (ctrl.recalc) { + ctrl.recalc(); + } + + // Move x/y position + pos += size + spacing; + } + } + }); +}); + +// Included from: js/tinymce/classes/ui/FlowLayout.js + +/** + * FlowLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This layout manager will place the controls by using the browsers native layout. + * + * @-x-less FlowLayout.less + * @class tinymce.ui.FlowLayout + * @extends tinymce.ui.Layout + */ +define("tinymce/ui/FlowLayout", [ + "tinymce/ui/Layout" +], function(Layout) { + return Layout.extend({ + Defaults: { + containerClass: 'flow-layout', + controlClass: 'flow-layout-item', + endClass: 'break' + }, + + /** + * Recalculates the positions of the controls in the specified container. + * + * @method recalc + * @param {tinymce.ui.Container} container Container instance to recalc. + */ + recalc: function(container) { + container.items().filter(':visible').each(function(ctrl) { + if (ctrl.recalc) { + ctrl.recalc(); + } + }); + } + }); +}); + +// Included from: js/tinymce/classes/ui/FormatControls.js + +/** + * FormatControls.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Internal class containing all TinyMCE specific control types such as + * format listboxes, fontlist boxes, toolbar buttons etc. + * + * @class tinymce.ui.FormatControls + */ +define("tinymce/ui/FormatControls", [ + "tinymce/ui/Control", + "tinymce/ui/Widget", + "tinymce/ui/FloatPanel", + "tinymce/util/Tools", + "tinymce/EditorManager", + "tinymce/Env" +], function(Control, Widget, FloatPanel, Tools, EditorManager, Env) { + var each = Tools.each; + + EditorManager.on('AddEditor', function(e) { + if (e.editor.rtl) { + Control.rtl = true; + } + + registerControls(e.editor); + }); + + Control.translate = function(text) { + return EditorManager.translate(text); + }; + + Widget.tooltips = !Env.iOS; + + function registerControls(editor) { + var formatMenu; + + function createListBoxChangeHandler(items, formatName) { + return function() { + var self = this; + + editor.on('nodeChange', function(e) { + var formatter = editor.formatter; + var value = null; + + each(e.parents, function(node) { + each(items, function(item) { + if (formatName) { + if (formatter.matchNode(node, formatName, {value: item.value})) { + value = item.value; + } + } else { + if (formatter.matchNode(node, item.value)) { + value = item.value; + } + } + + if (value) { + return false; + } + }); + + if (value) { + return false; + } + }); + + self.value(value); + }); + }; + } + + function createFormats(formats) { + formats = formats.replace(/;$/, '').split(';'); + + var i = formats.length; + while (i--) { + formats[i] = formats[i].split('='); + } + + return formats; + } + + function createFormatMenu() { + var count = 0, newFormats = []; + + var defaultStyleFormats = [ + {title: 'Headings', items: [ + {title: 'Heading 1', format: 'h1'}, + {title: 'Heading 2', format: 'h2'}, + {title: 'Heading 3', format: 'h3'}, + {title: 'Heading 4', format: 'h4'}, + {title: 'Heading 5', format: 'h5'}, + {title: 'Heading 6', format: 'h6'} + ]}, + + {title: 'Inline', items: [ + {title: 'Bold', icon: 'bold', format: 'bold'}, + {title: 'Italic', icon: 'italic', format: 'italic'}, + {title: 'Underline', icon: 'underline', format: 'underline'}, + {title: 'Strikethrough', icon: 'strikethrough', format: 'strikethrough'}, + {title: 'Superscript', icon: 'superscript', format: 'superscript'}, + {title: 'Subscript', icon: 'subscript', format: 'subscript'}, + {title: 'Code', icon: 'code', format: 'code'} + ]}, + + {title: 'Blocks', items: [ + {title: 'Paragraph', format: 'p'}, + {title: 'Blockquote', format: 'blockquote'}, + {title: 'Div', format: 'div'}, + {title: 'Pre', format: 'pre'} + ]}, + + {title: 'Alignment', items: [ + {title: 'Left', icon: 'alignleft', format: 'alignleft'}, + {title: 'Center', icon: 'aligncenter', format: 'aligncenter'}, + {title: 'Right', icon: 'alignright', format: 'alignright'}, + {title: 'Justify', icon: 'alignjustify', format: 'alignjustify'} + ]} + ]; + + function createMenu(formats) { + var menu = []; + + if (!formats) { + return; + } + + each(formats, function(format) { + var menuItem = { + text: format.title, + icon: format.icon + }; + + if (format.items) { + menuItem.menu = createMenu(format.items); + } else { + var formatName = format.format || "custom" + count++; + + if (!format.format) { + format.name = formatName; + newFormats.push(format); + } + + menuItem.format = formatName; + menuItem.cmd = format.cmd; + } + + menu.push(menuItem); + }); + + return menu; + } + + function createStylesMenu() { + var menu; + + if (editor.settings.style_formats_merge) { + if (editor.settings.style_formats) { + menu = createMenu(defaultStyleFormats.concat(editor.settings.style_formats)); + } else { + menu = createMenu(defaultStyleFormats); + } + } else { + menu = createMenu(editor.settings.style_formats || defaultStyleFormats); + } + + return menu; + } + + editor.on('init', function() { + each(newFormats, function(format) { + editor.formatter.register(format.name, format); + }); + }); + + return { + type: 'menu', + items: createStylesMenu(), + onPostRender: function(e) { + editor.fire('renderFormatsMenu', {control: e.control}); + }, + itemDefaults: { + preview: true, + + textStyle: function() { + if (this.settings.format) { + return editor.formatter.getCssText(this.settings.format); + } + }, + + onPostRender: function() { + var self = this; + + self.parent().on('show', function() { + var formatName, command; + + formatName = self.settings.format; + if (formatName) { + self.disabled(!editor.formatter.canApply(formatName)); + self.active(editor.formatter.match(formatName)); + } + + command = self.settings.cmd; + if (command) { + self.active(editor.queryCommandState(command)); + } + }); + }, + + onclick: function() { + if (this.settings.format) { + toggleFormat(this.settings.format); + } + + if (this.settings.cmd) { + editor.execCommand(this.settings.cmd); + } + } + } + }; + } + + formatMenu = createFormatMenu(); + + // Simple format controls : + each({ + bold: 'Bold', + italic: 'Italic', + underline: 'Underline', + strikethrough: 'Strikethrough', + subscript: 'Subscript', + superscript: 'Superscript' + }, function(text, name) { + editor.addButton(name, { + tooltip: text, + onPostRender: function() { + var self = this; + + // TODO: Fix this + if (editor.formatter) { + editor.formatter.formatChanged(name, function(state) { + self.active(state); + }); + } else { + editor.on('init', function() { + editor.formatter.formatChanged(name, function(state) { + self.active(state); + }); + }); + } + }, + onclick: function() { + toggleFormat(name); + } + }); + }); + + // Simple command controls :[,] + each({ + outdent: ['Decrease indent', 'Outdent'], + indent: ['Increase indent', 'Indent'], + cut: ['Cut', 'Cut'], + copy: ['Copy', 'Copy'], + paste: ['Paste', 'Paste'], + help: ['Help', 'mceHelp'], + selectall: ['Select all', 'SelectAll'], + removeformat: ['Clear formatting', 'RemoveFormat'], + visualaid: ['Visual aids', 'mceToggleVisualAid'], + newdocument: ['New document', 'mceNewDocument'] + }, function(item, name) { + editor.addButton(name, { + tooltip: item[0], + cmd: item[1] + }); + }); + + // Simple command controls with format state + each({ + blockquote: ['Blockquote', 'mceBlockQuote'], + numlist: ['Numbered list', 'InsertOrderedList'], + bullist: ['Bullet list', 'InsertUnorderedList'], + subscript: ['Subscript', 'Subscript'], + superscript: ['Superscript', 'Superscript'], + alignleft: ['Align left', 'JustifyLeft'], + aligncenter: ['Align center', 'JustifyCenter'], + alignright: ['Align right', 'JustifyRight'], + alignjustify: ['Justify', 'JustifyFull'] + }, function(item, name) { + editor.addButton(name, { + tooltip: item[0], + cmd: item[1], + onPostRender: function() { + var self = this; + + // TODO: Fix this + if (editor.formatter) { + editor.formatter.formatChanged(name, function(state) { + self.active(state); + }); + } else { + editor.on('init', function() { + editor.formatter.formatChanged(name, function(state) { + self.active(state); + }); + }); + } + } + }); + }); + + function toggleUndoRedoState(type) { + return function() { + var self = this; + + type = type == 'redo' ? 'hasRedo' : 'hasUndo'; + + function checkState() { + return editor.undoManager ? editor.undoManager[type]() : false; + } + + self.disabled(!checkState()); + editor.on('Undo Redo AddUndo TypingUndo ClearUndos', function() { + self.disabled(!checkState()); + }); + }; + } + + function toggleVisualAidState() { + var self = this; + + editor.on('VisualAid', function(e) { + self.active(e.hasVisual); + }); + + self.active(editor.hasVisual); + } + + editor.addButton('undo', { + tooltip: 'Undo', + onPostRender: toggleUndoRedoState('undo'), + cmd: 'undo' + }); + + editor.addButton('redo', { + tooltip: 'Redo', + onPostRender: toggleUndoRedoState('redo'), + cmd: 'redo' + }); + + editor.addMenuItem('newdocument', { + text: 'New document', + icon: 'newdocument', + cmd: 'mceNewDocument' + }); + + editor.addMenuItem('undo', { + text: 'Undo', + icon: 'undo', + shortcut: 'Meta+Z', + onPostRender: toggleUndoRedoState('undo'), + cmd: 'undo' + }); + + editor.addMenuItem('redo', { + text: 'Redo', + icon: 'redo', + shortcut: 'Meta+Y', + onPostRender: toggleUndoRedoState('redo'), + cmd: 'redo' + }); + + editor.addMenuItem('visualaid', { + text: 'Visual aids', + selectable: true, + onPostRender: toggleVisualAidState, + cmd: 'mceToggleVisualAid' + }); + + each({ + cut: ['Cut', 'Cut', 'Meta+X'], + copy: ['Copy', 'Copy', 'Meta+C'], + paste: ['Paste', 'Paste', 'Meta+V'], + selectall: ['Select all', 'SelectAll', 'Meta+A'], + bold: ['Bold', 'Bold', 'Meta+B'], + italic: ['Italic', 'Italic', 'Meta+I'], + underline: ['Underline', 'Underline'], + strikethrough: ['Strikethrough', 'Strikethrough'], + subscript: ['Subscript', 'Subscript'], + superscript: ['Superscript', 'Superscript'], + removeformat: ['Clear formatting', 'RemoveFormat'] + }, function(item, name) { + editor.addMenuItem(name, { + text: item[0], + icon: name, + shortcut: item[2], + cmd: item[1] + }); + }); + + editor.on('mousedown', function() { + FloatPanel.hideAll(); + }); + + function toggleFormat(fmt) { + if (fmt.control) { + fmt = fmt.control.value(); + } + + if (fmt) { + editor.execCommand('mceToggleFormat', false, fmt); + } + } + + editor.addButton('styleselect', { + type: 'menubutton', + text: 'Formats', + menu: formatMenu + }); + + editor.addButton('formatselect', function() { + var items = [], blocks = createFormats(editor.settings.block_formats || + 'Paragraph=p;' + + 'Heading 1=h1;' + + 'Heading 2=h2;' + + 'Heading 3=h3;' + + 'Heading 4=h4;' + + 'Heading 5=h5;' + + 'Heading 6=h6;' + + 'Preformatted=pre' + ); + + each(blocks, function(block) { + items.push({ + text: block[0], + value: block[1], + textStyle: function() { + return editor.formatter.getCssText(block[1]); + } + }); + }); + + return { + type: 'listbox', + text: blocks[0][0], + values: items, + fixedWidth: true, + onselect: toggleFormat, + onPostRender: createListBoxChangeHandler(items) + }; + }); + + editor.addButton('fontselect', function() { + var defaultFontsFormats = + 'Andale Mono=andale mono,monospace;' + + 'Arial=arial,helvetica,sans-serif;' + + 'Arial Black=arial black,sans-serif;' + + 'Book Antiqua=book antiqua,palatino,serif;' + + 'Comic Sans MS=comic sans ms,sans-serif;' + + 'Courier New=courier new,courier,monospace;' + + 'Georgia=georgia,palatino,serif;' + + 'Helvetica=helvetica,arial,sans-serif;' + + 'Impact=impact,sans-serif;' + + 'Symbol=symbol;' + + 'Tahoma=tahoma,arial,helvetica,sans-serif;' + + 'Terminal=terminal,monaco,monospace;' + + 'Times New Roman=times new roman,times,serif;' + + 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' + + 'Verdana=verdana,geneva,sans-serif;' + + 'Webdings=webdings;' + + 'Wingdings=wingdings,zapf dingbats'; + + var items = [], fonts = createFormats(editor.settings.font_formats || defaultFontsFormats); + + each(fonts, function(font) { + items.push({ + text: {raw: font[0]}, + value: font[1], + textStyle: font[1].indexOf('dings') == -1 ? 'font-family:' + font[1] : '' + }); + }); + + return { + type: 'listbox', + text: 'Font Family', + tooltip: 'Font Family', + values: items, + fixedWidth: true, + onPostRender: createListBoxChangeHandler(items, 'fontname'), + onselect: function(e) { + if (e.control.settings.value) { + editor.execCommand('FontName', false, e.control.settings.value); + } + } + }; + }); + + editor.addButton('fontsizeselect', function() { + var items = [], defaultFontsizeFormats = '8pt 10pt 12pt 14pt 18pt 24pt 36pt'; + var fontsize_formats = editor.settings.fontsize_formats || defaultFontsizeFormats; + + each(fontsize_formats.split(' '), function(item) { + var text = item, value = item; + // Allow text=value font sizes. + var values = item.split('='); + if (values.length > 1) { + text = values[0]; + value = values[1]; + } + items.push({text: text, value: value}); + }); + + return { + type: 'listbox', + text: 'Font Sizes', + tooltip: 'Font Sizes', + values: items, + fixedWidth: true, + onPostRender: createListBoxChangeHandler(items, 'fontsize'), + onclick: function(e) { + if (e.control.settings.value) { + editor.execCommand('FontSize', false, e.control.settings.value); + } + } + }; + }); + + editor.addMenuItem('formats', { + text: 'Formats', + menu: formatMenu + }); + } +}); + +// Included from: js/tinymce/classes/ui/GridLayout.js + +/** + * GridLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This layout manager places controls in a grid. + * + * @setting {Number} spacing Spacing between controls. + * @setting {Number} spacingH Horizontal spacing between controls. + * @setting {Number} spacingV Vertical spacing between controls. + * @setting {Number} columns Number of columns to use. + * @setting {String/Array} alignH start|end|center|stretch or array of values for each column. + * @setting {String/Array} alignV start|end|center|stretch or array of values for each column. + * @setting {String} pack start|end + * + * @class tinymce.ui.GridLayout + * @extends tinymce.ui.AbsoluteLayout + */ +define("tinymce/ui/GridLayout", [ + "tinymce/ui/AbsoluteLayout" +], function(AbsoluteLayout) { + "use strict"; + + return AbsoluteLayout.extend({ + /** + * Recalculates the positions of the controls in the specified container. + * + * @method recalc + * @param {tinymce.ui.Container} container Container instance to recalc. + */ + recalc: function(container) { + var settings = container.settings, rows, cols, items, contLayoutRect, width, height, rect, + ctrlLayoutRect, ctrl, x, y, posX, posY, ctrlSettings, contPaddingBox, align, spacingH, spacingV, alignH, alignV, maxX, maxY, + colWidths = [], rowHeights = [], ctrlMinWidth, ctrlMinHeight, availableWidth, availableHeight, reverseRows, idx; + + // Get layout settings + settings = container.settings; + items = container.items().filter(':visible'); + contLayoutRect = container.layoutRect(); + cols = settings.columns || Math.ceil(Math.sqrt(items.length)); + rows = Math.ceil(items.length / cols); + spacingH = settings.spacingH || settings.spacing || 0; + spacingV = settings.spacingV || settings.spacing || 0; + alignH = settings.alignH || settings.align; + alignV = settings.alignV || settings.align; + contPaddingBox = container._paddingBox; + reverseRows = 'reverseRows' in settings ? settings.reverseRows : container.isRtl(); + + if (alignH && typeof alignH == "string") { + alignH = [alignH]; + } + + if (alignV && typeof alignV == "string") { + alignV = [alignV]; + } + + // Zero padd columnWidths + for (x = 0; x < cols; x++) { + colWidths.push(0); + } + + // Zero padd rowHeights + for (y = 0; y < rows; y++) { + rowHeights.push(0); + } + + // Calculate columnWidths and rowHeights + for (y = 0; y < rows; y++) { + for (x = 0; x < cols; x++) { + ctrl = items[y * cols + x]; + + // Out of bounds + if (!ctrl) { + break; + } + + ctrlLayoutRect = ctrl.layoutRect(); + ctrlMinWidth = ctrlLayoutRect.minW; + ctrlMinHeight = ctrlLayoutRect.minH; + + colWidths[x] = ctrlMinWidth > colWidths[x] ? ctrlMinWidth : colWidths[x]; + rowHeights[y] = ctrlMinHeight > rowHeights[y] ? ctrlMinHeight : rowHeights[y]; + } + } + + // Calculate maxX + availableWidth = contLayoutRect.innerW - contPaddingBox.left - contPaddingBox.right; + for (maxX = 0, x = 0; x < cols; x++) { + maxX += colWidths[x] + (x > 0 ? spacingH : 0); + availableWidth -= (x > 0 ? spacingH : 0) + colWidths[x]; + } + + // Calculate maxY + availableHeight = contLayoutRect.innerH - contPaddingBox.top - contPaddingBox.bottom; + for (maxY = 0, y = 0; y < rows; y++) { + maxY += rowHeights[y] + (y > 0 ? spacingV : 0); + availableHeight -= (y > 0 ? spacingV : 0) + rowHeights[y]; + } + + maxX += contPaddingBox.left + contPaddingBox.right; + maxY += contPaddingBox.top + contPaddingBox.bottom; + + // Calculate minW/minH + rect = {}; + rect.minW = maxX + (contLayoutRect.w - contLayoutRect.innerW); + rect.minH = maxY + (contLayoutRect.h - contLayoutRect.innerH); + + rect.contentW = rect.minW - contLayoutRect.deltaW; + rect.contentH = rect.minH - contLayoutRect.deltaH; + rect.minW = Math.min(rect.minW, contLayoutRect.maxW); + rect.minH = Math.min(rect.minH, contLayoutRect.maxH); + rect.minW = Math.max(rect.minW, contLayoutRect.startMinWidth); + rect.minH = Math.max(rect.minH, contLayoutRect.startMinHeight); + + // Resize container container if minSize was changed + if (contLayoutRect.autoResize && (rect.minW != contLayoutRect.minW || rect.minH != contLayoutRect.minH)) { + rect.w = rect.minW; + rect.h = rect.minH; + + container.layoutRect(rect); + this.recalc(container); + + // Forced recalc for example if items are hidden/shown + if (container._lastRect === null) { + var parentCtrl = container.parent(); + if (parentCtrl) { + parentCtrl._lastRect = null; + parentCtrl.recalc(); + } + } + + return; + } + + // Update contentW/contentH so absEnd moves correctly + if (contLayoutRect.autoResize) { + rect = container.layoutRect(rect); + rect.contentW = rect.minW - contLayoutRect.deltaW; + rect.contentH = rect.minH - contLayoutRect.deltaH; + } + + var flexV; + + if (settings.packV == 'start') { + flexV = 0; + } else { + flexV = availableHeight > 0 ? Math.floor(availableHeight / rows) : 0; + } + + // Calculate totalFlex + var totalFlex = 0; + var flexWidths = settings.flexWidths; + if (flexWidths) { + for (x = 0; x < flexWidths.length; x++) { + totalFlex += flexWidths[x]; + } + } else { + totalFlex = cols; + } + + // Calculate new column widths based on flex values + var ratio = availableWidth / totalFlex; + for (x = 0; x < cols; x++) { + colWidths[x] += flexWidths ? flexWidths[x] * ratio : ratio; + } + + // Move/resize controls + posY = contPaddingBox.top; + for (y = 0; y < rows; y++) { + posX = contPaddingBox.left; + height = rowHeights[y] + flexV; + + for (x = 0; x < cols; x++) { + if (reverseRows) { + idx = y * cols + cols - 1 - x; + } else { + idx = y * cols + x; + } + + ctrl = items[idx]; + + // No more controls to render then break + if (!ctrl) { + break; + } + + // Get control settings and calculate x, y + ctrlSettings = ctrl.settings; + ctrlLayoutRect = ctrl.layoutRect(); + width = Math.max(colWidths[x], ctrlLayoutRect.startMinWidth); + ctrlLayoutRect.x = posX; + ctrlLayoutRect.y = posY; + + // Align control horizontal + align = ctrlSettings.alignH || (alignH ? (alignH[x] || alignH[0]) : null); + if (align == "center") { + ctrlLayoutRect.x = posX + (width / 2) - (ctrlLayoutRect.w / 2); + } else if (align == "right") { + ctrlLayoutRect.x = posX + width - ctrlLayoutRect.w; + } else if (align == "stretch") { + ctrlLayoutRect.w = width; + } + + // Align control vertical + align = ctrlSettings.alignV || (alignV ? (alignV[x] || alignV[0]) : null); + if (align == "center") { + ctrlLayoutRect.y = posY + (height / 2) - (ctrlLayoutRect.h / 2); + } else if (align == "bottom") { + ctrlLayoutRect.y = posY + height - ctrlLayoutRect.h; + } else if (align == "stretch") { + ctrlLayoutRect.h = height; + } + + ctrl.layoutRect(ctrlLayoutRect); + + posX += width + spacingH; + + if (ctrl.recalc) { + ctrl.recalc(); + } + } + + posY += height + spacingV; + } + } + }); +}); + +// Included from: js/tinymce/classes/ui/Iframe.js + +/** + * Iframe.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/*jshint scripturl:true */ + +/** + * This class creates an iframe. + * + * @setting {String} url Url to open in the iframe. + * + * @-x-less Iframe.less + * @class tinymce.ui.Iframe + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Iframe", [ + "tinymce/ui/Widget" +], function(Widget) { + "use strict"; + + return Widget.extend({ + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this; + + self.addClass('iframe'); + self.canFocus = false; + + /*eslint no-script-url:0 */ + return ( + '' + ); + }, + + /** + * Setter for the iframe source. + * + * @method src + * @param {String} src Source URL for iframe. + */ + src: function(src) { + this.getEl().src = src; + }, + + /** + * Inner HTML for the iframe. + * + * @method html + * @param {String} html HTML string to set as HTML inside the iframe. + * @param {function} callback Optional callback to execute when the iframe body is filled with contents. + * @return {tinymce.ui.Iframe} Current iframe control. + */ + html: function(html, callback) { + var self = this, body = this.getEl().contentWindow.document.body; + + // Wait for iframe to initialize IE 10 takes time + if (!body) { + setTimeout(function() { + self.html(html); + }, 0); + } else { + body.innerHTML = html; + + if (callback) { + callback(); + } + } + + return this; + } + }); +}); + +// Included from: js/tinymce/classes/ui/Label.js + +/** + * Label.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class creates a label element. A label is a simple text control + * that can be bound to other controls. + * + * @-x-less Label.less + * @class tinymce.ui.Label + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Label", [ + "tinymce/ui/Widget", + "tinymce/ui/DomUtils" +], function(Widget, DomUtils) { + "use strict"; + + return Widget.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @param {Boolean} multiline Multiline label. + */ + init: function(settings) { + var self = this; + + self._super(settings); + self.addClass('widget'); + self.addClass('label'); + self.canFocus = false; + + if (settings.multiline) { + self.addClass('autoscroll'); + } + + if (settings.strong) { + self.addClass('strong'); + } + }, + + /** + * Initializes the current controls layout rect. + * This will be executed by the layout managers to determine the + * default minWidth/minHeight etc. + * + * @method initLayoutRect + * @return {Object} Layout rect instance. + */ + initLayoutRect: function() { + var self = this, layoutRect = self._super(); + + if (self.settings.multiline) { + var size = DomUtils.getSize(self.getEl()); + + // Check if the text fits within maxW if not then try word wrapping it + if (size.width > layoutRect.maxW) { + layoutRect.minW = layoutRect.maxW; + self.addClass('multiline'); + } + + self.getEl().style.width = layoutRect.minW + 'px'; + layoutRect.startMinH = layoutRect.h = layoutRect.minH = Math.min(layoutRect.maxH, DomUtils.getSize(self.getEl()).height); + } + + return layoutRect; + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this; + + if (!self.settings.multiline) { + self.getEl().style.lineHeight = self.layoutRect().h + 'px'; + } + + return self._super(); + }, + + /** + * Sets/gets the current label text. + * + * @method text + * @param {String} [text] New label text. + * @return {String|tinymce.ui.Label} Current text or current label instance. + */ + text: function(text) { + var self = this; + + if (self._rendered && text) { + this.innerHtml(self.encode(text)); + } + + return self._super(text); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, forId = self.settings.forId; + + return ( + '' + ); + } + }); +}); + +// Included from: js/tinymce/classes/ui/Toolbar.js + +/** + * Toolbar.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new toolbar. + * + * @class tinymce.ui.Toolbar + * @extends tinymce.ui.Container + */ +define("tinymce/ui/Toolbar", [ + "tinymce/ui/Container" +], function(Container) { + "use strict"; + + return Container.extend({ + Defaults: { + role: 'toolbar', + layout: 'flow' + }, + + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this; + + self._super(settings); + self.addClass('toolbar'); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self.items().addClass('toolbar-item'); + + return self._super(); + } + }); +}); + +// Included from: js/tinymce/classes/ui/MenuBar.js + +/** + * MenuBar.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new menubar. + * + * @-x-less MenuBar.less + * @class tinymce.ui.MenuBar + * @extends tinymce.ui.Toolbar + */ +define("tinymce/ui/MenuBar", [ + "tinymce/ui/Toolbar" +], function(Toolbar) { + "use strict"; + + return Toolbar.extend({ + Defaults: { + role: 'menubar', + containerCls: 'menubar', + ariaRoot: true, + defaults: { + type: 'menubutton' + } + } + }); +}); + +// Included from: js/tinymce/classes/ui/MenuButton.js + +/** + * MenuButton.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new menu button. + * + * @-x-less MenuButton.less + * @class tinymce.ui.MenuButton + * @extends tinymce.ui.Button + */ +define("tinymce/ui/MenuButton", [ + "tinymce/ui/Button", + "tinymce/ui/Factory", + "tinymce/ui/MenuBar" +], function(Button, Factory, MenuBar) { + "use strict"; + + // TODO: Maybe add as some global function + function isChildOf(node, parent) { + while (node) { + if (parent === node) { + return true; + } + + node = node.parentNode; + } + + return false; + } + + var MenuButton = Button.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this; + + self._renderOpen = true; + self._super(settings); + + self.addClass('menubtn'); + + if (settings.fixedWidth) { + self.addClass('fixed-width'); + } + + self.aria('haspopup', true); + self.hasPopup = true; + }, + + /** + * Shows the menu for the button. + * + * @method showMenu + */ + showMenu: function() { + var self = this, settings = self.settings, menu; + + if (self.menu && self.menu.visible()) { + return self.hideMenu(); + } + + if (!self.menu) { + menu = settings.menu || []; + + // Is menu array then auto constuct menu control + if (menu.length) { + menu = { + type: 'menu', + items: menu + }; + } else { + menu.type = menu.type || 'menu'; + } + + self.menu = Factory.create(menu).parent(self).renderTo(); + self.fire('createmenu'); + self.menu.reflow(); + self.menu.on('cancel', function(e) { + if (e.control.parent() === self.menu) { + e.stopPropagation(); + self.focus(); + self.hideMenu(); + } + }); + + // Move focus to button when a menu item is selected/clicked + self.menu.on('select', function() { + self.focus(); + }); + + self.menu.on('show hide', function(e) { + if (e.control == self.menu) { + self.activeMenu(e.type == 'show'); + } + + self.aria('expanded', e.type == 'show'); + }).fire('show'); + } + + self.menu.show(); + self.menu.layoutRect({w: self.layoutRect().w}); + self.menu.moveRel(self.getEl(), self.isRtl() ? ['br-tr', 'tr-br'] : ['bl-tl', 'tl-bl']); + }, + + /** + * Hides the menu for the button. + * + * @method hideMenu + */ + hideMenu: function() { + var self = this; + + if (self.menu) { + self.menu.items().each(function(item) { + if (item.hideMenu) { + item.hideMenu(); + } + }); + + self.menu.hide(); + } + }, + + /** + * Sets the active menu state. + * + * @private + */ + activeMenu: function(state) { + this.toggleClass('active', state); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix; + var icon = self.settings.icon, image; + + image = self.settings.image; + if (image) { + icon = 'none'; + + // Support for [high dpi, low dpi] image sources + if (typeof image != "string") { + image = window.getSelection ? image[0] : image[1]; + } + + image = ' style="background-image: url(\'' + image + '\')"'; + } else { + image = ''; + } + + icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : ''; + + self.aria('role', self.parent() instanceof MenuBar ? 'menuitem' : 'button'); + + return ( + '
    ' + + '' + + '
    ' + ); + }, + + /** + * Gets invoked after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self.on('click', function(e) { + if (e.control === self && isChildOf(e.target, self.getEl())) { + self.showMenu(); + + if (e.aria) { + self.menu.items()[0].focus(); + } + } + }); + + self.on('mouseenter', function(e) { + var overCtrl = e.control, parent = self.parent(), hasVisibleSiblingMenu; + + if (overCtrl && parent && overCtrl instanceof MenuButton && overCtrl.parent() == parent) { + parent.items().filter('MenuButton').each(function(ctrl) { + if (ctrl.hideMenu && ctrl != overCtrl) { + if (ctrl.menu && ctrl.menu.visible()) { + hasVisibleSiblingMenu = true; + } + + ctrl.hideMenu(); + } + }); + + if (hasVisibleSiblingMenu) { + overCtrl.focus(); // Fix for: #5887 + overCtrl.showMenu(); + } + } + }); + + return self._super(); + }, + + /** + * Sets/gets the current button text. + * + * @method text + * @param {String} [text] New button text. + * @return {String|tinymce.ui.MenuButton} Current text or current MenuButton instance. + */ + text: function(text) { + var self = this, i, children; + + if (self._rendered) { + children = self.getEl('open').getElementsByTagName('span'); + for (i = 0; i < children.length; i++) { + children[i].innerHTML = (self.settings.icon && text ? '\u00a0' : '') + self.encode(text); + } + } + + return this._super(text); + }, + + /** + * Removes the control and it's menus. + * + * @method remove + */ + remove: function() { + this._super(); + + if (this.menu) { + this.menu.remove(); + } + } + }); + + return MenuButton; +}); + +// Included from: js/tinymce/classes/ui/ListBox.js + +/** + * ListBox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new list box control. + * + * @-x-less ListBox.less + * @class tinymce.ui.ListBox + * @extends tinymce.ui.MenuButton + */ +define("tinymce/ui/ListBox", [ + "tinymce/ui/MenuButton" +], function(MenuButton) { + "use strict"; + + return MenuButton.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Array} values Array with values to add to list box. + */ + init: function(settings) { + var self = this, values, selected, selectedText, lastItemCtrl; + + function setSelected(menuValues) { + // Try to find a selected value + for (var i = 0; i < menuValues.length; i++) { + selected = menuValues[i].selected || settings.value === menuValues[i].value; + + if (selected) { + selectedText = selectedText || menuValues[i].text; + self._value = menuValues[i].value; + break; + } + + // If the value has a submenu, try to find the selected values in that menu + if (menuValues[i].menu) { + setSelected(menuValues[i].menu); + } + } + } + + self._values = values = settings.values; + if (values) { + setSelected(values); + + // Default with first item + if (!selected && values.length > 0) { + selectedText = values[0].text; + self._value = values[0].value; + } + + settings.menu = values; + } + + settings.text = settings.text || selectedText || values[0].text; + + self._super(settings); + self.addClass('listbox'); + + self.on('select', function(e) { + var ctrl = e.control; + + if (lastItemCtrl) { + e.lastControl = lastItemCtrl; + } + + if (settings.multiple) { + ctrl.active(!ctrl.active()); + } else { + self.value(e.control.settings.value); + } + + lastItemCtrl = ctrl; + }); + }, + + /** + * Getter/setter function for the control value. + * + * @method value + * @param {String} [value] Value to be set. + * @return {Boolean/tinymce.ui.ListBox} Value or self if it's a set operation. + */ + value: function(value) { + var self = this, active, selectedText, menu; + + function activateByValue(menu, value) { + menu.items().each(function(ctrl) { + active = ctrl.value() === value; + + if (active) { + selectedText = selectedText || ctrl.text(); + } + + ctrl.active(active); + + if (ctrl.menu) { + activateByValue(ctrl.menu, value); + } + }); + } + + function setActiveValues(menuValues) { + for (var i = 0; i < menuValues.length; i++) { + active = menuValues[i].value == value; + + if (active) { + selectedText = selectedText || menuValues[i].text; + } + + menuValues[i].active = active; + + if (menuValues[i].menu) { + setActiveValues(menuValues[i].menu); + } + } + } + + if (typeof value != "undefined") { + if (self.menu) { + activateByValue(self.menu, value); + } else { + menu = self.settings.menu; + setActiveValues(menu); + } + + self.text(selectedText || this.settings.text); + } + + return self._super(value); + } + }); +}); + +// Included from: js/tinymce/classes/ui/MenuItem.js + +/** + * MenuItem.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new menu item. + * + * @-x-less MenuItem.less + * @class tinymce.ui.MenuItem + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/MenuItem", [ + "tinymce/ui/Widget", + "tinymce/ui/Factory", + "tinymce/Env" +], function(Widget, Factory, Env) { + "use strict"; + + return Widget.extend({ + Defaults: { + border: 0, + role: 'menuitem' + }, + + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Boolean} selectable Selectable menu. + * @setting {Array} menu Submenu array with items. + * @setting {String} shortcut Shortcut to display for menu item. Example: Ctrl+X + */ + init: function(settings) { + var self = this; + + self.hasPopup = true; + + self._super(settings); + + settings = self.settings; + + self.addClass('menu-item'); + + if (settings.menu) { + self.addClass('menu-item-expand'); + } + + if (settings.preview) { + self.addClass('menu-item-preview'); + } + + if (self._text === '-' || self._text === '|') { + self.addClass('menu-item-sep'); + self.aria('role', 'separator'); + self._text = '-'; + } + + if (settings.selectable) { + self.aria('role', 'menuitemcheckbox'); + self.addClass('menu-item-checkbox'); + settings.icon = 'selected'; + } + + if (!settings.preview && !settings.selectable) { + self.addClass('menu-item-normal'); + } + + self.on('mousedown', function(e) { + e.preventDefault(); + }); + + if (settings.menu && !settings.ariaHideMenu) { + self.aria('haspopup', true); + } + }, + + /** + * Returns true/false if the menuitem has sub menu. + * + * @method hasMenus + * @return {Boolean} True/false state if it has submenu. + */ + hasMenus: function() { + return !!this.settings.menu; + }, + + /** + * Shows the menu for the menu item. + * + * @method showMenu + */ + showMenu: function() { + var self = this, settings = self.settings, menu, parent = self.parent(); + + parent.items().each(function(ctrl) { + if (ctrl !== self) { + ctrl.hideMenu(); + } + }); + + if (settings.menu) { + menu = self.menu; + + if (!menu) { + menu = settings.menu; + + // Is menu array then auto constuct menu control + if (menu.length) { + menu = { + type: 'menu', + items: menu + }; + } else { + menu.type = menu.type || 'menu'; + } + + if (parent.settings.itemDefaults) { + menu.itemDefaults = parent.settings.itemDefaults; + } + + menu = self.menu = Factory.create(menu).parent(self).renderTo(); + menu.reflow(); + menu.on('cancel', function(e) { + e.stopPropagation(); + self.focus(); + menu.hide(); + }); + menu.on('show hide', function(e) { + e.control.items().each(function(ctrl) { + ctrl.active(ctrl.settings.selected); + }); + }).fire('show'); + + menu.on('hide', function(e) { + if (e.control === menu) { + self.removeClass('selected'); + } + }); + + menu.submenu = true; + } else { + menu.show(); + } + + menu._parentMenu = parent; + + menu.addClass('menu-sub'); + + var rel = menu.testMoveRel( + self.getEl(), + self.isRtl() ? ['tl-tr', 'bl-br', 'tr-tl', 'br-bl'] : ['tr-tl', 'br-bl', 'tl-tr', 'bl-br'] + ); + + menu.moveRel(self.getEl(), rel); + menu.rel = rel; + + rel = 'menu-sub-' + rel; + menu.removeClass(menu._lastRel); + menu.addClass(rel); + menu._lastRel = rel; + + self.addClass('selected'); + self.aria('expanded', true); + } + }, + + /** + * Hides the menu for the menu item. + * + * @method hideMenu + */ + hideMenu: function() { + var self = this; + + if (self.menu) { + self.menu.items().each(function(item) { + if (item.hideMenu) { + item.hideMenu(); + } + }); + + self.menu.hide(); + self.aria('expanded', false); + } + + return self; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, settings = self.settings, prefix = self.classPrefix, text = self.encode(self._text); + var icon = self.settings.icon, image = '', shortcut = settings.shortcut; + + // Converts shortcut format to Mac/PC variants + function convertShortcut(shortcut) { + var i, value, replace = {}; + + if (Env.mac) { + replace = { + alt: '⌥', + ctrl: '⌘', + shift: '⇧', + meta: '⌘' + }; + } else { + replace = { + meta: 'Ctrl' + }; + } + + shortcut = shortcut.split('+'); + + for (i = 0; i < shortcut.length; i++) { + value = replace[shortcut[i].toLowerCase()]; + + if (value) { + shortcut[i] = value; + } + } + + return shortcut.join('+'); + } + + if (icon) { + self.parent().addClass('menu-has-icons'); + } + + if (settings.image) { + icon = 'none'; + image = ' style="background-image: url(\'' + settings.image + '\')"'; + } + + if (shortcut) { + shortcut = convertShortcut(shortcut); + } + + icon = prefix + 'ico ' + prefix + 'i-' + (self.settings.icon || 'none'); + + return ( + '
    ' + + (text !== '-' ? '\u00a0' : '') + + (text !== '-' ? '' + text + '' : '') + + (shortcut ? '
    ' + shortcut + '
    ' : '') + + (settings.menu ? '
    ' : '') + + '
    ' + ); + }, + + /** + * Gets invoked after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this, settings = self.settings; + + var textStyle = settings.textStyle; + if (typeof textStyle == "function") { + textStyle = textStyle.call(this); + } + + if (textStyle) { + var textElm = self.getEl('text'); + if (textElm) { + textElm.setAttribute('style', textStyle); + } + } + + self.on('mouseenter click', function(e) { + if (e.control === self) { + if (!settings.menu && e.type === 'click') { + self.fire('select'); + self.parent().hideAll(); + } else { + self.showMenu(); + + if (e.aria) { + self.menu.focus(true); + } + } + } + }); + + self._super(); + + return self; + }, + + active: function(state) { + if (typeof state != "undefined") { + this.aria('checked', state); + } + + return this._super(state); + }, + + /** + * Removes the control and it's menus. + * + * @method remove + */ + remove: function() { + this._super(); + + if (this.menu) { + this.menu.remove(); + } + } + }); +}); + +// Included from: js/tinymce/classes/ui/Menu.js + +/** + * Menu.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new menu. + * + * @-x-less Menu.less + * @class tinymce.ui.Menu + * @extends tinymce.ui.FloatPanel + */ +define("tinymce/ui/Menu", [ + "tinymce/ui/FloatPanel", + "tinymce/ui/MenuItem", + "tinymce/util/Tools" +], function(FloatPanel, MenuItem, Tools) { + "use strict"; + + var Menu = FloatPanel.extend({ + Defaults: { + defaultType: 'menuitem', + border: 1, + layout: 'stack', + role: 'application', + bodyRole: 'menu', + ariaRoot: true + }, + + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + */ + init: function(settings) { + var self = this; + + settings.autohide = true; + settings.constrainToViewport = true; + + if (settings.itemDefaults) { + var items = settings.items, i = items.length; + + while (i--) { + items[i] = Tools.extend({}, settings.itemDefaults, items[i]); + } + } + + self._super(settings); + self.addClass('menu'); + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + this.toggleClass('menu-align', true); + + this._super(); + + this.getEl().style.height = ''; + this.getEl('body').style.height = ''; + + return this; + }, + + /** + * Hides/closes the menu. + * + * @method cancel + */ + cancel: function() { + var self = this; + + self.hideAll(); + self.fire('select'); + }, + + /** + * Hide menu and all sub menus. + * + * @method hideAll + */ + hideAll: function() { + var self = this; + + this.find('menuitem').exec('hideMenu'); + + return self._super(); + }, +/* + getContainerElm: function() { + var doc = document, id = this.classPrefix + 'menucontainer'; + + var elm = doc.getElementById(id); + if (!elm) { + elm = doc.createElement('div'); + elm.id = id; + elm.setAttribute('role', 'application'); + elm.className = this.classPrefix + '-reset'; + elm.style.position = 'absolute'; + elm.style.top = elm.style.left = '0'; + elm.style.overflow = 'visible'; + doc.body.appendChild(elm); + } + + return elm; + }, +*/ + /** + * Invoked before the menu is rendered. + * + * @method preRender + */ + preRender: function() { + var self = this; + + self.items().each(function(ctrl) { + var settings = ctrl.settings; + + if (settings.icon || settings.selectable) { + self._hasIcons = true; + return false; + } + }); + + return self._super(); + } + }); + + return Menu; +}); + +// Included from: js/tinymce/classes/ui/Radio.js + +/** + * Radio.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new radio button. + * + * @-x-less Radio.less + * @class tinymce.ui.Radio + * @extends tinymce.ui.Checkbox + */ +define("tinymce/ui/Radio", [ + "tinymce/ui/Checkbox" +], function(Checkbox) { + "use strict"; + + return Checkbox.extend({ + Defaults: { + classes: "radio", + role: "radio" + } + }); +}); + +// Included from: js/tinymce/classes/ui/ResizeHandle.js + +/** + * ResizeHandle.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Renders a resize handle that fires ResizeStart, Resize and ResizeEnd events. + * + * @-x-less ResizeHandle.less + * @class tinymce.ui.ResizeHandle + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/ResizeHandle", [ + "tinymce/ui/Widget", + "tinymce/ui/DragHelper" +], function(Widget, DragHelper) { + "use strict"; + + return Widget.extend({ + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, prefix = self.classPrefix; + + self.addClass('resizehandle'); + + if (self.settings.direction == "both") { + self.addClass('resizehandle-both'); + } + + self.canFocus = false; + + return ( + '
    ' + + '' + + '
    ' + ); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self._super(); + + self.resizeDragHelper = new DragHelper(this._id, { + start: function() { + self.fire('ResizeStart'); + }, + + drag: function(e) { + if (self.settings.direction != "both") { + e.deltaX = 0; + } + + self.fire('Resize', e); + }, + + stop: function() { + self.fire('ResizeEnd'); + } + }); + }, + + remove: function() { + if (this.resizeDragHelper) { + this.resizeDragHelper.destroy(); + } + + return this._super(); + } + }); +}); + +// Included from: js/tinymce/classes/ui/Spacer.js + +/** + * Spacer.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a spacer. This control is used in flex layouts for example. + * + * @-x-less Spacer.less + * @class tinymce.ui.Spacer + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/Spacer", [ + "tinymce/ui/Widget" +], function(Widget) { + "use strict"; + + return Widget.extend({ + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this; + + self.addClass('spacer'); + self.canFocus = false; + + return '
    '; + } + }); +}); + +// Included from: js/tinymce/classes/ui/SplitButton.js + +/** + * SplitButton.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a split button. + * + * @-x-less SplitButton.less + * @class tinymce.ui.SplitButton + * @extends tinymce.ui.MenuButton + */ +define("tinymce/ui/SplitButton", [ + "tinymce/ui/MenuButton", + "tinymce/ui/DomUtils" +], function(MenuButton, DomUtils) { + return MenuButton.extend({ + Defaults: { + classes: "widget btn splitbtn", + role: "button" + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this, elm = self.getEl(), rect = self.layoutRect(), mainButtonElm, menuButtonElm; + + self._super(); + + mainButtonElm = elm.firstChild; + menuButtonElm = elm.lastChild; + + DomUtils.css(mainButtonElm, { + width: rect.w - DomUtils.getSize(menuButtonElm).width, + height: rect.h - 2 + }); + + DomUtils.css(menuButtonElm, { + height: rect.h - 2 + }); + + return self; + }, + + /** + * Sets the active menu state. + * + * @private + */ + activeMenu: function(state) { + var self = this; + + DomUtils.toggleClass(self.getEl().lastChild, self.classPrefix + 'active', state); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, prefix = self.classPrefix, image; + var icon = self.settings.icon; + + image = self.settings.image; + if (image) { + icon = 'none'; + + // Support for [high dpi, low dpi] image sources + if (typeof image != "string") { + image = window.getSelection ? image[0] : image[1]; + } + + image = ' style="background-image: url(\'' + image + '\')"'; + } else { + image = ''; + } + + icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : ''; + + return ( + '
    ' + + '' + + '' + + '
    ' + ); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this, onClickHandler = self.settings.onclick; + + self.on('click', function(e) { + var node = e.target; + + if (e.control == this) { + // Find clicks that is on the main button + while (node) { + if ((e.aria && e.aria.key != 'down') || (node.nodeName == 'BUTTON' && node.className.indexOf('open') == -1)) { + e.stopImmediatePropagation(); + onClickHandler.call(this, e); + return; + } + + node = node.parentNode; + } + } + }); + + delete self.settings.onclick; + + return self._super(); + } + }); +}); + +// Included from: js/tinymce/classes/ui/StackLayout.js + +/** + * StackLayout.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This layout uses the browsers layout when the items are blocks. + * + * @-x-less StackLayout.less + * @class tinymce.ui.StackLayout + * @extends tinymce.ui.FlowLayout + */ +define("tinymce/ui/StackLayout", [ + "tinymce/ui/FlowLayout" +], function(FlowLayout) { + "use strict"; + + return FlowLayout.extend({ + Defaults: { + containerClass: 'stack-layout', + controlClass: 'stack-layout-item', + endClass: 'break' + } + }); +}); + +// Included from: js/tinymce/classes/ui/TabPanel.js + +/** + * TabPanel.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a tab panel control. + * + * @-x-less TabPanel.less + * @class tinymce.ui.TabPanel + * @extends tinymce.ui.Panel + * + * @setting {Number} activeTab Active tab index. + */ +define("tinymce/ui/TabPanel", [ + "tinymce/ui/Panel", + "tinymce/ui/DomUtils" +], function(Panel, DomUtils) { + "use strict"; + + return Panel.extend({ + Defaults: { + layout: 'absolute', + defaults: { + type: 'panel' + } + }, + + /** + * Activates the specified tab by index. + * + * @method activateTab + * @param {Number} idx Index of the tab to activate. + */ + activateTab: function(idx) { + var activeTabElm; + + if (this.activeTabId) { + activeTabElm = this.getEl(this.activeTabId); + DomUtils.removeClass(activeTabElm, this.classPrefix + 'active'); + activeTabElm.setAttribute('aria-selected', "false"); + } + + this.activeTabId = 't' + idx; + + activeTabElm = this.getEl('t' + idx); + activeTabElm.setAttribute('aria-selected', "true"); + DomUtils.addClass(activeTabElm, this.classPrefix + 'active'); + + this.items()[idx].show().fire('showtab'); + this.reflow(); + + this.items().each(function(item, i) { + if (idx != i) { + item.hide(); + } + }); + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, layout = self._layout, tabsHtml = '', prefix = self.classPrefix; + + self.preRender(); + layout.preRender(self); + + self.items().each(function(ctrl, i) { + var id = self._id + '-t' + i; + + ctrl.aria('role', 'tabpanel'); + ctrl.aria('labelledby', id); + + tabsHtml += ( + '' + ); + }); + + return ( + '
    ' + + '
    ' + + tabsHtml + + '
    ' + + '
    ' + + layout.renderHtml(self) + + '
    ' + + '
    ' + ); + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + self._super(); + + self.settings.activeTab = self.settings.activeTab || 0; + self.activateTab(self.settings.activeTab); + + this.on('click', function(e) { + var targetParent = e.target.parentNode; + + if (e.target.parentNode.id == self._id + '-head') { + var i = targetParent.childNodes.length; + + while (i--) { + if (targetParent.childNodes[i] == e.target) { + self.activateTab(i); + } + } + } + }); + }, + + /** + * Initializes the current controls layout rect. + * This will be executed by the layout managers to determine the + * default minWidth/minHeight etc. + * + * @method initLayoutRect + * @return {Object} Layout rect instance. + */ + initLayoutRect: function() { + var self = this, rect, minW, minH; + + minW = DomUtils.getSize(self.getEl('head')).width; + minW = minW < 0 ? 0 : minW; + minH = 0; + + self.items().each(function(item) { + minW = Math.max(minW, item.layoutRect().minW); + minH = Math.max(minH, item.layoutRect().minH); + }); + + self.items().each(function(ctrl) { + ctrl.settings.x = 0; + ctrl.settings.y = 0; + ctrl.settings.w = minW; + ctrl.settings.h = minH; + + ctrl.layoutRect({ + x: 0, + y: 0, + w: minW, + h: minH + }); + }); + + var headH = DomUtils.getSize(self.getEl('head')).height; + + self.settings.minWidth = minW; + self.settings.minHeight = minH + headH; + + rect = self._super(); + rect.deltaH += headH; + rect.innerH = rect.h - rect.deltaH; + + return rect; + } + }); +}); + +// Included from: js/tinymce/classes/ui/TextBox.js + +/** + * TextBox.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * Creates a new textbox. + * + * @-x-less TextBox.less + * @class tinymce.ui.TextBox + * @extends tinymce.ui.Widget + */ +define("tinymce/ui/TextBox", [ + "tinymce/ui/Widget", + "tinymce/ui/DomUtils" +], function(Widget, DomUtils) { + "use strict"; + + return Widget.extend({ + /** + * Constructs a instance with the specified settings. + * + * @constructor + * @param {Object} settings Name/value object with settings. + * @setting {Boolean} multiline True if the textbox is a multiline control. + * @setting {Number} maxLength Max length for the textbox. + * @setting {Number} size Size of the textbox in characters. + */ + init: function(settings) { + var self = this; + + self._super(settings); + + self._value = settings.value || ''; + self.addClass('textbox'); + + if (settings.multiline) { + self.addClass('multiline'); + } else { + // TODO: Rework this + self.on('keydown', function(e) { + if (e.keyCode == 13) { + self.parents().reverse().each(function(ctrl) { + e.preventDefault(); + + if (ctrl.hasEventListeners('submit') && ctrl.toJSON) { + ctrl.fire('submit', {data: ctrl.toJSON()}); + return false; + } + }); + } + }); + } + }, + + /** + * Getter/setter function for the disabled state. + * + * @method value + * @param {Boolean} [state] State to be set. + * @return {Boolean|tinymce.ui.ComboBox} True/false or self if it's a set operation. + */ + disabled: function(state) { + var self = this; + + if (self._rendered && typeof state != 'undefined') { + self.getEl().disabled = state; + } + + return self._super(state); + }, + + /** + * Getter/setter function for the control value. + * + * @method value + * @param {String} [value] Value to be set. + * @return {String|tinymce.ui.ComboBox} Value or self if it's a set operation. + */ + value: function(value) { + var self = this; + + if (typeof value != "undefined") { + self._value = value; + + if (self._rendered) { + self.getEl().value = value; + } + + return self; + } + + if (self._rendered) { + return self.getEl().value; + } + + return self._value; + }, + + /** + * Repaints the control after a layout operation. + * + * @method repaint + */ + repaint: function() { + var self = this, style, rect, borderBox, borderW = 0, borderH = 0, lastRepaintRect; + + style = self.getEl().style; + rect = self._layoutRect; + lastRepaintRect = self._lastRepaintRect || {}; + + // Detect old IE 7+8 add lineHeight to align caret vertically in the middle + var doc = document; + if (!self.settings.multiline && doc.all && (!doc.documentMode || doc.documentMode <= 8)) { + style.lineHeight = (rect.h - borderH) + 'px'; + } + + borderBox = self._borderBox; + borderW = borderBox.left + borderBox.right + 8; + borderH = borderBox.top + borderBox.bottom + (self.settings.multiline ? 8 : 0); + + if (rect.x !== lastRepaintRect.x) { + style.left = rect.x + 'px'; + lastRepaintRect.x = rect.x; + } + + if (rect.y !== lastRepaintRect.y) { + style.top = rect.y + 'px'; + lastRepaintRect.y = rect.y; + } + + if (rect.w !== lastRepaintRect.w) { + style.width = (rect.w - borderW) + 'px'; + lastRepaintRect.w = rect.w; + } + + if (rect.h !== lastRepaintRect.h) { + style.height = (rect.h - borderH) + 'px'; + lastRepaintRect.h = rect.h; + } + + self._lastRepaintRect = lastRepaintRect; + self.fire('repaint', {}, false); + + return self; + }, + + /** + * Renders the control as a HTML string. + * + * @method renderHtml + * @return {String} HTML representing the control. + */ + renderHtml: function() { + var self = this, id = self._id, settings = self.settings, value = self.encode(self._value, false), extraAttrs = ''; + + if ("spellcheck" in settings) { + extraAttrs += ' spellcheck="' + settings.spellcheck + '"'; + } + + if (settings.maxLength) { + extraAttrs += ' maxlength="' + settings.maxLength + '"'; + } + + if (settings.size) { + extraAttrs += ' size="' + settings.size + '"'; + } + + if (settings.subtype) { + extraAttrs += ' type="' + settings.subtype + '"'; + } + + if (self.disabled()) { + extraAttrs += ' disabled="disabled"'; + } + + if (settings.multiline) { + return ( + '' + ); + } + + return ''; + }, + + /** + * Called after the control has been rendered. + * + * @method postRender + */ + postRender: function() { + var self = this; + + DomUtils.on(self.getEl(), 'change', function(e) { + self.fire('change', e); + }); + + return self._super(); + }, + + remove: function() { + DomUtils.off(this.getEl()); + this._super(); + } + }); +}); + +// Included from: js/tinymce/classes/ui/Throbber.js + +/** + * Throbber.js + * + * Copyright, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + +/** + * This class enables you to display a Throbber for any element. + * + * @-x-less Throbber.less + * @class tinymce.ui.Throbber + */ +define("tinymce/ui/Throbber", [ + "tinymce/ui/DomUtils", + "tinymce/ui/Control" +], function(DomUtils, Control) { + "use strict"; + + /** + * Constructs a new throbber. + * + * @constructor + * @param {Element} elm DOM Html element to display throbber in. + * @param {Boolean} inline Optional true/false state if the throbber should be appended to end of element for infinite scroll. + */ + return function(elm, inline) { + var self = this, state, classPrefix = Control.classPrefix; + + /** + * Shows the throbber. + * + * @method show + * @param {Number} [time] Time to wait before showing. + * @return {tinymce.ui.Throbber} Current throbber instance. + */ + self.show = function(time) { + self.hide(); + + state = true; + + window.setTimeout(function() { + if (state) { + elm.appendChild(DomUtils.createFragment( + '
    ' + )); + } + }, time || 0); + + return self; + }; + + /** + * Hides the throbber. + * + * @method hide + * @return {tinymce.ui.Throbber} Current throbber instance. + */ + self.hide = function() { + var child = elm.lastChild; + + if (child && child.className.indexOf('throbber') != -1) { + child.parentNode.removeChild(child); + } + + state = false; + + return self; + }; + }; +}); + +expose(["tinymce/dom/EventUtils","tinymce/dom/Sizzle","tinymce/Env","tinymce/util/Tools","tinymce/dom/DomQuery","tinymce/html/Styles","tinymce/dom/TreeWalker","tinymce/dom/Range","tinymce/html/Entities","tinymce/dom/DOMUtils","tinymce/dom/ScriptLoader","tinymce/AddOnManager","tinymce/dom/RangeUtils","tinymce/html/Node","tinymce/html/Schema","tinymce/html/SaxParser","tinymce/html/DomParser","tinymce/html/Writer","tinymce/html/Serializer","tinymce/dom/Serializer","tinymce/dom/TridentSelection","tinymce/util/VK","tinymce/dom/ControlSelection","tinymce/dom/BookmarkManager","tinymce/dom/Selection","tinymce/dom/ElementUtils","tinymce/Formatter","tinymce/UndoManager","tinymce/EnterKey","tinymce/ForceBlocks","tinymce/EditorCommands","tinymce/util/URI","tinymce/util/Class","tinymce/util/EventDispatcher","tinymce/ui/Selector","tinymce/ui/Collection","tinymce/ui/DomUtils","tinymce/ui/Control","tinymce/ui/Factory","tinymce/ui/KeyboardNavigation","tinymce/ui/Container","tinymce/ui/DragHelper","tinymce/ui/Scrollable","tinymce/ui/Panel","tinymce/ui/Movable","tinymce/ui/Resizable","tinymce/ui/FloatPanel","tinymce/ui/Window","tinymce/ui/MessageBox","tinymce/WindowManager","tinymce/util/Quirks","tinymce/util/Observable","tinymce/EditorObservable","tinymce/Shortcuts","tinymce/Editor","tinymce/util/I18n","tinymce/FocusManager","tinymce/EditorManager","tinymce/LegacyInput","tinymce/util/XHR","tinymce/util/JSON","tinymce/util/JSONRequest","tinymce/util/JSONP","tinymce/util/LocalStorage","tinymce/Compat","tinymce/ui/Layout","tinymce/ui/AbsoluteLayout","tinymce/ui/Tooltip","tinymce/ui/Widget","tinymce/ui/Button","tinymce/ui/ButtonGroup","tinymce/ui/Checkbox","tinymce/ui/ComboBox","tinymce/ui/ColorBox","tinymce/ui/PanelButton","tinymce/ui/ColorButton","tinymce/util/Color","tinymce/ui/ColorPicker","tinymce/ui/Path","tinymce/ui/ElementPath","tinymce/ui/FormItem","tinymce/ui/Form","tinymce/ui/FieldSet","tinymce/ui/FilePicker","tinymce/ui/FitLayout","tinymce/ui/FlexLayout","tinymce/ui/FlowLayout","tinymce/ui/FormatControls","tinymce/ui/GridLayout","tinymce/ui/Iframe","tinymce/ui/Label","tinymce/ui/Toolbar","tinymce/ui/MenuBar","tinymce/ui/MenuButton","tinymce/ui/ListBox","tinymce/ui/MenuItem","tinymce/ui/Menu","tinymce/ui/Radio","tinymce/ui/ResizeHandle","tinymce/ui/Spacer","tinymce/ui/SplitButton","tinymce/ui/StackLayout","tinymce/ui/TabPanel","tinymce/ui/TextBox","tinymce/ui/Throbber"]); +})(this); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/dev/tinymce.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/dev/tinymce.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +(function(b,g){var d={};function c(m,n){var l,j=[];for(var k=0;k+~]|"+B+")"+B+"*"),F=new RegExp("="+B+"*([^\\]'\"]*?)"+B+"*\\]","g"),ad=new RegExp(w),af=new RegExp("^"+W+"$"),an={ID:new RegExp("^#("+W+")"),CLASS:new RegExp("^\\.("+W+")"),TAG:new RegExp("^("+W+"|[*])"),ATTR:new RegExp("^"+ar),PSEUDO:new RegExp("^"+w),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+B+"*(even|odd|(([+-]|)(\\d*)n|)"+B+"*(?:([+-]|)"+B+"*(\\d+)|))"+B+"*\\)|)","i"),bool:new RegExp("^(?:"+k+")$","i"),needsContext:new RegExp("^"+B+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+B+"*((?:-\\d)?\\d*)"+B+"*\\)|)(?=[^-]|$)","i")},o=/^(?:input|select|textarea|button)$/i,x=/^h\d$/i,aa=/^[^{]+\{\s*\[native \w/,ac=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,am=/[+~]/,Y=/'|\\/g,E=new RegExp("\\\\([\\da-f]{1,6}"+B+"?|("+B+")|.)","ig"),aq=function(i,aK,aI){var aJ="0x"+aK-65536;return aJ!==aJ||aI?aK:aJ<0?String.fromCharCode(aJ+65536):String.fromCharCode(aJ>>10|55296,aJ&1023|56320)};try{j.apply((ay=y.call(U.childNodes)),U.childNodes);ay[U.childNodes.length].nodeType}catch(O){j={apply:ay.length?function(aI,i){X.apply(aI,y.call(i))}:function(aL,aK){var aI=aL.length,aJ=0;while((aL[aI++]=aK[aJ++])){}aL.length=aI-1}}}function H(aQ,aJ,aU,aW){var aV,aN,aO,aS,aT,aM,aL,aI,aK,aR;if((aJ?aJ.ownerDocument||aJ:U)!==N){ak(aJ)}aJ=aJ||N;aU=aU||[];if(!aQ||typeof aQ!=="string"){return aU}if((aS=aJ.nodeType)!==1&&aS!==9){return[]}if(au&&!aW){if((aV=ac.exec(aQ))){if((aO=aV[1])){if(aS===9){aN=aJ.getElementById(aO);if(aN&&aN.parentNode){if(aN.id===aO){aU.push(aN);return aU}}else{return aU}}else{if(aJ.ownerDocument&&(aN=aJ.ownerDocument.getElementById(aO))&&Q(aJ,aN)&&aN.id===aO){aU.push(aN);return aU}}}else{if(aV[2]){j.apply(aU,aJ.getElementsByTagName(aQ));return aU}else{if((aO=aV[3])&&aD.getElementsByClassName){j.apply(aU,aJ.getElementsByClassName(aO));return aU}}}}if(aD.qsa&&(!ao||!ao.test(aQ))){aI=aL=aw;aK=aJ;aR=aS===9&&aQ;if(aS===1&&aJ.nodeName.toLowerCase()!=="object"){aM=t(aQ);if((aL=aJ.getAttribute("id"))){aI=aL.replace(Y,"\\$&")}else{aJ.setAttribute("id",aI)}aI="[id='"+aI+"'] ";aT=aM.length;while(aT--){aM[aT]=aI+u(aM[aT])}aK=am.test(aQ)&&ae(aJ.parentNode)||aJ;aR=aM.join(",")}if(aR){try{j.apply(aU,aK.querySelectorAll(aR));return aU}catch(aP){}finally{if(!aL){aJ.removeAttribute("id")}}}}}return aC(aQ.replace(D,"$1"),aJ,aU,aW)}function L(){var aI=[];function i(aJ,aK){if(aI.push(aJ+" ")>z.cacheLength){delete i[aI.shift()]}return(i[aJ+" "]=aK)}return i}function v(i){i[aw]=true;return i}function r(i){var aJ=N.createElement("div");try{return !!i(aJ)}catch(aI){return false}finally{if(aJ.parentNode){aJ.parentNode.removeChild(aJ)}aJ=null}}function aF(aJ,aL){var aI=aJ.split("|"),aK=aJ.length;while(aK--){z.attrHandle[aI[aK]]=aL}}function m(aI,i){var aK=i&&aI,aJ=aK&&aI.nodeType===1&&i.nodeType===1&&(~i.sourceIndex||ab)-(~aI.sourceIndex||ab);if(aJ){return aJ}if(aK){while((aK=aK.nextSibling)){if(aK===i){return -1}}}return aI?1:-1}function I(i){return function(aJ){var aI=aJ.nodeName.toLowerCase();return aI==="input"&&aJ.type===i}}function n(i){return function(aJ){var aI=aJ.nodeName.toLowerCase();return(aI==="input"||aI==="button")&&aJ.type===i}}function at(i){return v(function(aI){aI=+aI;return v(function(aJ,aN){var aL,aK=i([],aJ.length,aI),aM=aK.length;while(aM--){if(aJ[(aL=aK[aM])]){aJ[aL]=!(aN[aL]=aJ[aL])}}})})}function ae(i){return i&&typeof i.getElementsByTagName!==aA&&i}aD=H.support={};V=H.isXML=function(i){var aI=i&&(i.ownerDocument||i).documentElement;return aI?aI.nodeName!=="HTML":false};ak=H.setDocument=function(aJ){var i,aK=aJ?aJ.ownerDocument||aJ:U,aI=aK.defaultView;if(aK===N||aK.nodeType!==9||!aK.documentElement){return N}N=aK;A=aK.documentElement;au=!V(aK);if(aI&&aI!==aI.top){if(aI.addEventListener){aI.addEventListener("unload",function(){ak()},false)}else{if(aI.attachEvent){aI.attachEvent("onunload",function(){ak()})}}}aD.attributes=r(function(aL){aL.className="i";return !aL.getAttribute("className")});aD.getElementsByTagName=r(function(aL){aL.appendChild(aK.createComment(""));return !aL.getElementsByTagName("*").length});aD.getElementsByClassName=aa.test(aK.getElementsByClassName);aD.getById=r(function(aL){A.appendChild(aL).id=aw;return !aK.getElementsByName||!aK.getElementsByName(aw).length});if(aD.getById){z.find.ID=function(aN,aM){if(typeof aM.getElementById!==aA&&au){var aL=aM.getElementById(aN);return aL&&aL.parentNode?[aL]:[]}};z.filter.ID=function(aM){var aL=aM.replace(E,aq);return function(aN){return aN.getAttribute("id")===aL}}}else{delete z.find.ID;z.filter.ID=function(aM){var aL=aM.replace(E,aq);return function(aO){var aN=typeof aO.getAttributeNode!==aA&&aO.getAttributeNode("id");return aN&&aN.value===aL}}}z.find.TAG=aD.getElementsByTagName?function(aL,aM){if(typeof aM.getElementsByTagName!==aA){return aM.getElementsByTagName(aL)}}:function(aL,aP){var aQ,aO=[],aN=0,aM=aP.getElementsByTagName(aL);if(aL==="*"){while((aQ=aM[aN++])){if(aQ.nodeType===1){aO.push(aQ)}}return aO}return aM};z.find.CLASS=aD.getElementsByClassName&&function(aM,aL){if(au){return aL.getElementsByClassName(aM)}};aB=[];ao=[];if((aD.qsa=aa.test(aK.querySelectorAll))){r(function(aL){aL.innerHTML="";if(aL.querySelectorAll("[msallowcapture^='']").length){ao.push("[*^$]="+B+"*(?:''|\"\")")}if(!aL.querySelectorAll("[selected]").length){ao.push("\\["+B+"*(?:value|"+k+")")}if(!aL.querySelectorAll(":checked").length){ao.push(":checked")}});r(function(aM){var aL=aK.createElement("input");aL.setAttribute("type","hidden");aM.appendChild(aL).setAttribute("name","D");if(aM.querySelectorAll("[name=d]").length){ao.push("name"+B+"*[*^$|!~]?=")}if(!aM.querySelectorAll(":enabled").length){ao.push(":enabled",":disabled")}aM.querySelectorAll("*,:x");ao.push(",.*:")})}if((aD.matchesSelector=aa.test((q=A.matches||A.webkitMatchesSelector||A.mozMatchesSelector||A.oMatchesSelector||A.msMatchesSelector)))){r(function(aL){aD.disconnectedMatch=q.call(aL,"div");q.call(aL,"[s!='']:x");aB.push("!=",w)})}ao=ao.length&&new RegExp(ao.join("|"));aB=aB.length&&new RegExp(aB.join("|"));i=aa.test(A.compareDocumentPosition);Q=i||aa.test(A.contains)?function(aM,aL){var aO=aM.nodeType===9?aM.documentElement:aM,aN=aL&&aL.parentNode;return aM===aN||!!(aN&&aN.nodeType===1&&(aO.contains?aO.contains(aN):aM.compareDocumentPosition&&aM.compareDocumentPosition(aN)&16))}:function(aM,aL){if(aL){while((aL=aL.parentNode)){if(aL===aM){return true}}}return false};P=i?function(aM,aL){if(aM===aL){ai=true;return 0}var aN=!aM.compareDocumentPosition-!aL.compareDocumentPosition;if(aN){return aN}aN=(aM.ownerDocument||aM)===(aL.ownerDocument||aL)?aM.compareDocumentPosition(aL):1;if(aN&1||(!aD.sortDetached&&aL.compareDocumentPosition(aM)===aN)){if(aM===aK||aM.ownerDocument===U&&Q(U,aM)){return -1}if(aL===aK||aL.ownerDocument===U&&Q(U,aL)){return 1}return T?(p.call(T,aM)-p.call(T,aL)):0}return aN&4?-1:1}:function(aM,aL){if(aM===aL){ai=true;return 0}var aS,aP=0,aR=aM.parentNode,aO=aL.parentNode,aN=[aM],aQ=[aL];if(!aR||!aO){return aM===aK?-1:aL===aK?1:aR?-1:aO?1:T?(p.call(T,aM)-p.call(T,aL)):0}else{if(aR===aO){return m(aM,aL)}}aS=aM;while((aS=aS.parentNode)){aN.unshift(aS)}aS=aL;while((aS=aS.parentNode)){aQ.unshift(aS)}while(aN[aP]===aQ[aP]){aP++}return aP?m(aN[aP],aQ[aP]):aN[aP]===U?-1:aQ[aP]===U?1:0};return aK};H.matches=function(aI,i){return H(aI,null,null,i)};H.matchesSelector=function(aI,aK){if((aI.ownerDocument||aI)!==N){ak(aI)}aK=aK.replace(F,"='$1']");if(aD.matchesSelector&&au&&(!aB||!aB.test(aK))&&(!ao||!ao.test(aK))){try{var i=q.call(aI,aK);if(i||aD.disconnectedMatch||aI.document&&aI.document.nodeType!==11){return i}}catch(aJ){}}return H(aK,N,null,[aI]).length>0};H.contains=function(i,aI){if((i.ownerDocument||i)!==N){ak(i)}return Q(i,aI)};H.attr=function(aJ,i){if((aJ.ownerDocument||aJ)!==N){ak(aJ)}var aI=z.attrHandle[i.toLowerCase()],aK=aI&&Z.call(z.attrHandle,i.toLowerCase())?aI(aJ,i,!au):g;return aK!==g?aK:aD.attributes||!au?aJ.getAttribute(i):(aK=aJ.getAttributeNode(i))&&aK.specified?aK.value:null};H.error=function(i){throw new Error("Syntax error, unrecognized expression: "+i)};H.uniqueSort=function(aK){var aL,aM=[],aI=0,aJ=0;ai=!aD.detectDuplicates;T=!aD.sortStable&&aK.slice(0);aK.sort(P);if(ai){while((aL=aK[aJ++])){if(aL===aK[aJ]){aI=aM.push(aJ)}}while(aI--){aK.splice(aM[aI],1)}}T=null;return aK};S=H.getText=function(aM){var aL,aJ="",aK=0,aI=aM.nodeType;if(!aI){while((aL=aM[aK++])){aJ+=S(aL)}}else{if(aI===1||aI===9||aI===11){if(typeof aM.textContent==="string"){return aM.textContent}else{for(aM=aM.firstChild;aM;aM=aM.nextSibling){aJ+=S(aM)}}}else{if(aI===3||aI===4){return aM.nodeValue}}}return aJ};z=H.selectors={cacheLength:50,createPseudo:v,match:an,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:true}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:true},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(i){i[1]=i[1].replace(E,aq);i[3]=(i[3]||i[4]||i[5]||"").replace(E,aq);if(i[2]==="~="){i[3]=" "+i[3]+" "}return i.slice(0,4)},CHILD:function(i){i[1]=i[1].toLowerCase();if(i[1].slice(0,3)==="nth"){if(!i[3]){H.error(i[0])}i[4]=+(i[4]?i[5]+(i[6]||1):2*(i[3]==="even"||i[3]==="odd"));i[5]=+((i[7]+i[8])||i[3]==="odd")}else{if(i[3]){H.error(i[0])}}return i},PSEUDO:function(aI){var i,aJ=!aI[6]&&aI[2];if(an.CHILD.test(aI[0])){return null}if(aI[3]){aI[2]=aI[4]||aI[5]||""}else{if(aJ&&ad.test(aJ)&&(i=t(aJ,true))&&(i=aJ.indexOf(")",aJ.length-i)-aJ.length)){aI[0]=aI[0].slice(0,i);aI[2]=aJ.slice(0,i)}}return aI.slice(0,3)}},filter:{TAG:function(aI){var i=aI.replace(E,aq).toLowerCase();return aI==="*"?function(){return true}:function(aJ){return aJ.nodeName&&aJ.nodeName.toLowerCase()===i}},CLASS:function(i){var aI=l[i+" "];return aI||(aI=new RegExp("(^|"+B+")"+i+"("+B+"|$)"))&&l(i,function(aJ){return aI.test(typeof aJ.className==="string"&&aJ.className||typeof aJ.getAttribute!==aA&&aJ.getAttribute("class")||"")})},ATTR:function(aJ,aI,i){return function(aL){var aK=H.attr(aL,aJ);if(aK==null){return aI==="!="}if(!aI){return true}aK+="";return aI==="="?aK===i:aI==="!="?aK!==i:aI==="^="?i&&aK.indexOf(i)===0:aI==="*="?i&&aK.indexOf(i)>-1:aI==="$="?i&&aK.slice(-i.length)===i:aI==="~="?(" "+aK+" ").indexOf(i)>-1:aI==="|="?aK===i||aK.slice(0,i.length+1)===i+"-":false}},CHILD:function(aI,aL,aK,aM,aJ){var aO=aI.slice(0,3)!=="nth",i=aI.slice(-4)!=="last",aN=aL==="of-type";return aM===1&&aJ===0?function(aP){return !!aP.parentNode}:function(aV,aT,aY){var aP,a1,aW,a0,aX,aS,aU=aO!==i?"nextSibling":"previousSibling",aZ=aV.parentNode,aR=aN&&aV.nodeName.toLowerCase(),aQ=!aY&&!aN;if(aZ){if(aO){while(aU){aW=aV;while((aW=aW[aU])){if(aN?aW.nodeName.toLowerCase()===aR:aW.nodeType===1){return false}}aS=aU=aI==="only"&&!aS&&"nextSibling"}return true}aS=[i?aZ.firstChild:aZ.lastChild];if(i&&aQ){a1=aZ[aw]||(aZ[aw]={});aP=a1[aI]||[];aX=aP[0]===aE&&aP[1];a0=aP[0]===aE&&aP[2];aW=aX&&aZ.childNodes[aX];while((aW=++aX&&aW&&aW[aU]||(a0=aX=0)||aS.pop())){if(aW.nodeType===1&&++a0&&aW===aV){a1[aI]=[aE,aX,a0];break}}}else{if(aQ&&(aP=(aV[aw]||(aV[aw]={}))[aI])&&aP[0]===aE){a0=aP[1]}else{while((aW=++aX&&aW&&aW[aU]||(a0=aX=0)||aS.pop())){if((aN?aW.nodeName.toLowerCase()===aR:aW.nodeType===1)&&++a0){if(aQ){(aW[aw]||(aW[aw]={}))[aI]=[aE,a0]}if(aW===aV){break}}}}}a0-=aJ;return a0===aM||(a0%aM===0&&a0/aM>=0)}}},PSEUDO:function(aK,aJ){var i,aI=z.pseudos[aK]||z.setFilters[aK.toLowerCase()]||H.error("unsupported pseudo: "+aK);if(aI[aw]){return aI(aJ)}if(aI.length>1){i=[aK,aK,"",aJ];return z.setFilters.hasOwnProperty(aK.toLowerCase())?v(function(aN,aP){var aM,aL=aI(aN,aJ),aO=aL.length;while(aO--){aM=p.call(aN,aL[aO]);aN[aM]=!(aP[aM]=aL[aO])}}):function(aL){return aI(aL,0,i)}}return aI}},pseudos:{not:v(function(i){var aI=[],aJ=[],aK=ah(i.replace(D,"$1"));return aK[aw]?v(function(aM,aR,aP,aN){var aQ,aL=aK(aM,null,aN,[]),aO=aM.length;while(aO--){if((aQ=aL[aO])){aM[aO]=!(aR[aO]=aQ)}}}):function(aN,aM,aL){aI[0]=aN;aK(aI,null,aL,aJ);return !aJ.pop()}}),has:v(function(i){return function(aI){return H(i,aI).length>0}}),contains:v(function(i){i=i.replace(E,aq);return function(aI){return(aI.textContent||aI.innerText||S(aI)).indexOf(i)>-1}}),lang:v(function(i){if(!af.test(i||"")){H.error("unsupported lang: "+i)}i=i.replace(E,aq).toLowerCase();return function(aJ){var aI;do{if((aI=au?aJ.lang:aJ.getAttribute("xml:lang")||aJ.getAttribute("lang"))){aI=aI.toLowerCase();return aI===i||aI.indexOf(i+"-")===0}}while((aJ=aJ.parentNode)&&aJ.nodeType===1);return false}}),target:function(i){var aI=window.location&&window.location.hash;return aI&&aI.slice(1)===i.id},root:function(i){return i===A},focus:function(i){return i===N.activeElement&&(!N.hasFocus||N.hasFocus())&&!!(i.type||i.href||~i.tabIndex)},enabled:function(i){return i.disabled===false},disabled:function(i){return i.disabled===true},checked:function(i){var aI=i.nodeName.toLowerCase();return(aI==="input"&&!!i.checked)||(aI==="option"&&!!i.selected)},selected:function(i){if(i.parentNode){i.parentNode.selectedIndex}return i.selected===true},empty:function(i){for(i=i.firstChild;i;i=i.nextSibling){if(i.nodeType<6){return false}}return true},parent:function(i){return !z.pseudos.empty(i)},header:function(i){return x.test(i.nodeName)},input:function(i){return o.test(i.nodeName)},button:function(aI){var i=aI.nodeName.toLowerCase();return i==="input"&&aI.type==="button"||i==="button"},text:function(aI){var i;return aI.nodeName.toLowerCase()==="input"&&aI.type==="text"&&((i=aI.getAttribute("type"))==null||i.toLowerCase()==="text")},first:at(function(){return[0]}),last:at(function(i,aI){return[aI-1]}),eq:at(function(i,aJ,aI){return[aI<0?aI+aJ:aI]}),even:at(function(aI,aK){var aJ=0;for(;aJ=0;){aI.push(aJ)}return aI}),gt:at(function(aI,aL,aK){var aJ=aK<0?aK+aL:aK;for(;++aJ1?function(aL,aK,aI){var aJ=i.length;while(aJ--){if(!i[aJ](aL,aK,aI)){return false}}return true}:i[0]}function K(aJ,aM,aL){var aK=0,aI=aM.length;for(;aK-1){aX[aZ]=!(aU[aZ]=aR)}}}}else{aT=al(aT===aU?aT.splice(aO,aT.length):aT);if(aM){aM(null,aU,aT,aW)}else{j.apply(aU,aT)}}})}function ax(aO){var aJ,aM,aK,aN=aO.length,aR=z.relative[aO[0].type],aS=aR||z.relative[" "],aL=aR?1:0,aP=C(function(i){return i===aJ},aS,true),aQ=C(function(i){return p.call(aJ,i)>-1},aS,true),aI=[function(aU,aT,i){return(!aR&&(i||aT!==aH))||((aJ=aT).nodeType?aP(aU,aT,i):aQ(aU,aT,i))}];for(;aL1&&aG(aI),aL>1&&u(aO.slice(0,aL-1).concat({value:aO[aL-2].type===" "?"*":""})).replace(D,"$1"),aM,aL0,aL=aK.length>0,aI=function(aV,aP,aU,aT,aY){var aQ,aR,aW,a0=0,aS="0",aM=aV&&[],a1=[],aZ=aH,aO=aV||aL&&z.find.TAG("*",aY),aN=(aE+=aZ==null?1:Math.random()||0.1),aX=aO.length;if(aY){aH=aP!==N&&aP}for(;aS!==aX&&(aQ=aO[aS])!=null;aS++){if(aL&&aQ){aR=0;while((aW=aK[aR++])){if(aW(aQ,aP,aU)){aT.push(aQ);break}}if(aY){aE=aN}}if(i){if((aQ=!aW&&aQ)){a0--}if(aV){aM.push(aQ)}}}a0+=aS;if(i&&aS!==a0){aR=0;while((aW=aJ[aR++])){aW(aM,a1,aP,aU)}if(aV){if(a0>0){while(aS--){if(!(aM[aS]||a1[aS])){a1[aS]=az.call(aT)}}}a1=al(a1)}j.apply(aT,a1);if(aY&&!aV&&a1.length>0&&(a0+aJ.length)>1){H.uniqueSort(aT)}}if(aY){aE=aN;aH=aZ}return aM};return i?v(aI):aI}ah=H.compile=function(aI,aK){var aL,aJ=[],aN=[],aM=R[aI+" "];if(!aM){if(!aK){aK=t(aI)}aL=aK.length;while(aL--){aM=ax(aK[aL]);if(aM[aw]){aJ.push(aM)}else{aN.push(aM)}}aM=R(aI,aj(aN,aJ));aM.selector=aI}return aM};aC=H.select=function(aK,aI,aL,aO){var aM,aR,aJ,aS,aP,aQ=typeof aK==="function"&&aK,aN=!aO&&t((aK=aQ.selector||aK));aL=aL||[];if(aN.length===1){aR=aN[0]=aN[0].slice(0);if(aR.length>2&&(aJ=aR[0]).type==="ID"&&aD.getById&&aI.nodeType===9&&au&&z.relative[aR[1].type]){aI=(z.find.ID(aJ.matches[0].replace(E,aq),aI)||[])[0];if(!aI){return aL}else{if(aQ){aI=aI.parentNode}}aK=aK.slice(aR.shift().value.length)}aM=an.needsContext.test(aK)?0:aR.length;while(aM--){aJ=aR[aM];if(z.relative[(aS=aJ.type)]){break}if((aP=z.find[aS])){if((aO=aP(aJ.matches[0].replace(E,aq),am.test(aR[0].type)&&ae(aI.parentNode)||aI))){aR.splice(aM,1);aK=aO.length&&u(aR);if(!aK){j.apply(aL,aO);return aL}break}}}}(aQ||ah(aK,aN))(aO,aI,!au,aL,am.test(aK)&&ae(aI.parentNode)||aI);return aL};aD.sortStable=aw.split("").sort(P).join("")===aw;aD.detectDuplicates=!!ai;ak();aD.sortDetached=r(function(i){return i.compareDocumentPosition(N.createElement("div"))&1});if(!r(function(i){i.innerHTML="";return i.firstChild.getAttribute("href")==="#"})){aF("type|href|height|width",function(aI,i,aJ){if(!aJ){return aI.getAttribute(i,i.toLowerCase()==="type"?1:2)}})}if(!aD.attributes||!r(function(i){i.innerHTML="";i.firstChild.setAttribute("value","");return i.firstChild.getAttribute("value")===""})){aF("value",function(aI,i,aJ){if(!aJ&&aI.nodeName.toLowerCase()==="input"){return aI.defaultValue}})}if(!r(function(i){return i.getAttribute("disabled")==null})){aF(k,function(aI,i,aK){var aJ;if(!aK){return aI[i]===true?i.toLowerCase():(aJ=aI.getAttributeNode(i))&&aJ.specified?aJ.value:null}})}return H});h("tinymce/Env",[],function(){var i=navigator,t=i.userAgent;var m,s,j,p,o,l,r,n,k;m=window.opera&&window.opera.buildNumber;k=/Android/.test(t);s=/WebKit/.test(t);j=!s&&!m&&(/MSIE/gi).test(t)&&(/Explorer/gi).test(i.appName);j=j&&/MSIE (\w+)\./.exec(t)[1];p=t.indexOf("Trident/")!=-1&&(t.indexOf("rv:")!=-1||i.appName.indexOf("Netscape")!=-1)?11:false;o=(document.msElementsFromPoint&&!j&&!p)?12:false;j=j||p||o;l=!s&&!p&&/Gecko/.test(t);r=t.indexOf("Mac")!=-1;n=/(iPad|iPhone)/.test(t);if(o){s=false}var q=!n||t.match(/AppleWebKit\/(\d*)/)[1]>=534;return{opera:m,webkit:s,ie:j,gecko:l,mac:r,iOS:n,android:k,contentEditable:q,transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",caretAfter:j!=8,range:window.getSelection&&"Range" in window,documentMode:j&&!o?(document.documentMode||7):10}});h("tinymce/util/Tools",["tinymce/Env"],function(i){var z=/^\s*|\s*$/g;function u(A){return(A===null||A===g)?"":(""+A).replace(z,"")}var o=Array.isArray||function(A){return Object.prototype.toString.call(A)==="[object Array]"};function m(B,A){if(!A){return B!==g}if(A=="array"&&o(B)){return true}return typeof B==A}function s(C){var D=C,B,A;if(!o(C)){D=[];for(B=0,A=C.length;B)[^>]*$|#([\w\-]*)$)/;var O=t.Event,p;function k(Q){return typeof Q!=="undefined"}function y(Q){return typeof Q==="string"}function J(Q){return Q&&Q==Q.window}function D(S,R){var U,T,Q;R=R||P;Q=R.createElement("div");U=R.createDocumentFragment();Q.innerHTML=S;while((T=Q.firstChild)){U.appendChild(T)}return U}function A(Q,T,U,R){var S;if(y(T)){T=D(T,z(Q[0]))}else{if(T.length&&!T.nodeType){T=r.makeArray(T);if(R){for(S=T.length-1;S>=0;S--){A(Q,T[S],U,R)}}else{for(S=0;S"&&Q.length>=3){S=[null,Q,null]}else{S=B.exec(Q)}if(S){if(S[1]){U=D(Q,z(T)).firstChild;while(U){v.call(R,U);U=U.nextSibling}}else{U=z(T).getElementById(S[2]);if(!U){return R}if(U.id!==S[2]){return R.find(Q)}R.length=1;R[0]=U}}else{return r(T).find(Q)}}else{this.add(Q,false)}return R},toArray:function(){return n.toArray(this)},add:function(S,U){var R=this,Q,T;if(y(S)){return R.add(r(S))}if(U!==false){Q=r.unique(R.toArray().concat(r.makeArray(S)));R.length=Q.length;for(T=0;T1){S=r.unique(S);if(Q.indexOf("parents")===0){S=S.reverse()}}S=r(S);if(T){return S.filter(T)}return S}});s({parentsUntil:function(Q,R){return C(Q,"parentNode",R)},nextUntil:function(Q,R){return I(Q,"nextSibling",1,R).slice(1)},prevUntil:function(Q,R){return I(Q,"previousSibling",1,R).slice(1)}},function(Q,R){r.fn[Q]=function(T,V){var U=this,S=[];U.each(function(){var W=R.call(S,this,T,S);if(W){if(r.isArray(W)){S.push.apply(S,W)}else{S.push(W)}}});if(this.length>1){S=r.unique(S);if(Q.indexOf("parents")===0||Q==="prevUntil"){S=S.reverse()}}S=r(S);if(V){return S.filter(V)}return S}});r.fn.is=function(Q){return !!Q&&this.filter(Q).length>0};r.fn.init.prototype=r.fn;r.overrideDefaults=function(S){var R;function Q(T,U){R=R||S();if(arguments.length===0){T=R.element}if(!U){U=R.context}return new Q.fn.init(T,U)}r.extend(Q,this);return Q};function u(S,R,Q){s(Q,function(T,U){S[T]=S[T]||{};S[T][R]=U})}if(o.ie&&o.ie<8){u(M,"get",{maxlength:function(R){var Q=R.maxLength;if(Q===2147483647){return p}return Q},size:function(R){var Q=R.size;if(Q===20){return p}return Q},"class":function(Q){return Q.className},style:function(R){var Q=R.style.cssText;if(Q.length===0){return p}return Q}});u(M,"set",{"class":function(R,Q){R.className=Q},style:function(R,Q){R.style.cssText=Q}})}if(o.ie&&o.ie<9){m["float"]="styleFloat";u(N,"set",{opacity:function(S,R){var Q=S.style;if(R===null||R===""){Q.removeAttribute("filter")}else{Q.zoom=1;Q.filter="alpha(opacity="+(R*100)+")"}}})}r.attrHooks=M;r.cssHooks=N;return r});h("tinymce/html/Styles",[],function(){return function(o,q){var u=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,r=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,l=/\s*([^:]+):\s*([^;]+);?/g,w=/\s+$/,p,s,k={},t,n,j,v="\uFEFF";o=o||{};if(q){n=q.getValidStyles();j=q.getInvalidStyles()}t=("\\\" \\' \\; \\: ; : "+v).split(" ");for(s=0;s1?B:"0"+B}return"#"+y(A)+y(z)+y(i)}return{toHex:function(i){return i.replace(u,m)},parse:function(C){var I={},A,x,G,B,F=o.url_converter;var H=o.url_converter_scope||this;function z(O,R,L){var Q,M,K,P;Q=I[O+"-top"+R];if(!Q){return}M=I[O+"-right"+R];if(!M){return}K=I[O+"-bottom"+R];if(!K){return}P=I[O+"-left"+R];if(!P){return}var N=[Q,M,K,P];s=N.length-1;while(s--){if(N[s]!==N[s+1]){break}}if(s>-1&&L){return}I[O+R]=s==-1?N[0]:N.join(" ");delete I[O+"-top"+R];delete I[O+"-right"+R];delete I[O+"-bottom"+R];delete I[O+"-left"+R]}function E(L){var M=I[L],K;if(!M){return}M=M.split(" ");K=M.length;while(K--){if(M[K]!==M[0]){return false}}I[L]=M[0];return true}function J(M,L,K,N){if(!E(L)){return}if(!E(K)){return}if(!E(N)){return}I[M]=I[L]+" "+I[K]+" "+I[N];delete I[L];delete I[K];delete I[N]}function D(K){B=true;return k[K]}function i(L,K){if(B){L=L.replace(/\uFEFF[0-9]/g,function(M){return k[M]})}if(!K){L=L.replace(/\\([\'\";:])/g,"$1")}return L}function y(L,K,O,N,Q,M){Q=Q||M;if(Q){Q=i(Q);return"'"+Q.replace(/\'/g,"\\'")+"'"}K=i(K||O||N);if(!o.allow_script_urls){var P=K.replace(/[\s\r\n]+/,"");if(/(java|vb)script:/i.test(P)){return""}if(!o.allow_svg_data_urls&&/^data:image\/svg/i.test(P)){return""}}if(F){K=F.call(H,K,"style")}return"url('"+K.replace(/\'/g,"\\'")+"')"}if(C){C=C.replace(/[\u0000-\u001F]/g,"");C=C.replace(/\\[\"\';:\uFEFF]/g,D).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(K){return K.replace(/[;:]/g,D)});while((A=l.exec(C))){x=A[1].replace(w,"").toLowerCase();G=A[2].replace(w,"");G=G.replace(/\\[0-9a-f]+/g,function(K){return String.fromCharCode(parseInt(K.substr(1),16))});if(x&&G.length>0){if(!o.allow_script_urls&&(x=="behavior"||/expression\s*\(|\/\*|\*\//.test(G))){continue}if(x==="font-weight"&&G==="700"){G="bold"}else{if(x==="color"||x==="background-color"){G=G.toLowerCase()}}G=G.replace(u,m);G=G.replace(r,y);I[x]=B?i(G,true):G}l.lastIndex=A.index+A[0].length}z("border","",true);z("border","-width");z("border","-color");z("border","-style");z("padding","");z("margin","");J("border","border-width","border-style","border-color");if(I.border==="medium none"){delete I.border}if(I["border-image"]==="none"){delete I["border-image"]}}return I},serialize:function(A,i){var z="",y,B;function x(E){var H,F,D,G;H=n[E];if(H){for(F=0,D=H.length;F0){z+=(z.length>0?" ":"")+E+": "+G+";"}}}}function C(E,D){var F;F=j["*"];if(F&&F[E]){return false}F=j[D];if(F&&F[E]){return false}return true}if(i&&n){x("*");x(i)}else{for(y in A){B=A[y];if(B!==p&&B.length>0){if(!j||C(y,i)){z+=(z.length>0?" ":"")+y+": "+B+";"}}}}return z}}}});h("tinymce/dom/TreeWalker",[],function(){return function(j,i){var k=j;function l(q,m,n,r){var p,o;if(q){if(!r&&q[m]){return q[m]}if(q!=i){p=q[n];if(p){return p}for(o=q.parentNode;o&&o!=i;o=o.parentNode){p=o[n];if(p){return p}}}}}this.current=function(){return k};this.next=function(m){k=l(k,"firstChild","nextSibling",m);return k};this.prev=function(m){k=l(k,"lastChild","previousSibling",m);return k}}});h("tinymce/dom/Range",["tinymce/util/Tools"],function(i){function j(k){var o=this,m=k.doc,aa=0,M=1,s=2,L=true,Y=false,ac="startOffset",q="startContainer",W="endContainer",H="endOffset",t=i.extend,w=k.nodeIndex;function E(){return m.createDocumentFragment()}function z(ae,ad){J(L,ae,ad)}function B(ae,ad){J(Y,ae,ad)}function p(ad){z(ad.parentNode,w(ad))}function Q(ad){z(ad.parentNode,w(ad)+1)}function R(ad){B(ad.parentNode,w(ad))}function C(ad){B(ad.parentNode,w(ad)+1)}function I(ad){if(ad){o[W]=o[q];o[H]=o[ac]}else{o[q]=o[W];o[ac]=o[H]}o.collapsed=L}function F(ad){p(ad);C(ad)}function N(ad){z(ad,0);B(ad,ad.nodeType===1?ad.childNodes.length:ad.nodeValue.length)}function D(ah,ad){var ak=o[q],af=o[ac],aj=o[W],ae=o[H],ai=ad.startContainer,am=ad.startOffset,ag=ad.endContainer,al=ad.endOffset;if(ah===0){return O(ak,af,ai,am)}if(ah===1){return O(aj,ae,ai,am)}if(ah===2){return O(aj,ae,ag,al)}if(ah===3){return O(ak,af,ag,al)}}function y(){u(s)}function P(){return u(aa)}function l(){return u(M)}function K(ah){var ae=this[q],ad=this[ac],ag,af;if((ae.nodeType===3||ae.nodeType===4)&&ae.nodeValue){if(!ad){ae.parentNode.insertBefore(ah,ae)}else{if(ad>=ae.nodeValue.length){k.insertAfter(ah,ae)}else{ag=ae.splitText(ad);ae.parentNode.insertBefore(ah,ag)}}}else{if(ae.childNodes.length>0){af=ae.childNodes[ad]}if(af){ae.insertBefore(ah,af)}else{if(ae.nodeType==3){k.insertAfter(ah,ae)}else{ae.appendChild(ah)}}}}function U(ae){var ad=o.extractContents();o.insertNode(ae);ae.appendChild(ad);o.selectNode(ae)}function S(){return t(new j(k),{startContainer:o[q],startOffset:o[ac],endContainer:o[W],endOffset:o[H],collapsed:o.collapsed,commonAncestorContainer:o.commonAncestorContainer})}function V(ad,ae){var af;if(ad.nodeType==3){return ad}if(ae<0){return ad}af=ad.firstChild;while(af&&ae>0){--ae;af=af.nextSibling}if(af){return af}return ad}function v(){return(o[q]==o[W]&&o[ac]==o[H])}function O(ag,ai,ae,ah){var aj,af,ad,ak,am,al;if(ag==ae){if(ai==ah){return 0}if(ai0){o.collapse(ae)}}else{o.collapse(ae)}o.collapsed=v();o.commonAncestorContainer=k.findCommonAncestor(o[q],o[W])}function u(ak){var aj,ag=0,am=0,ae,ai,af,ah,ad,al;if(o[q]==o[W]){return n(ak)}for(aj=o[W],ae=aj.parentNode;ae;aj=ae,ae=ae.parentNode){if(ae==o[q]){return A(aj,ak)}++ag}for(aj=o[q],ae=aj.parentNode;ae;aj=ae,ae=ae.parentNode){if(ae==o[W]){return ab(aj,ak)}++am}ai=am-ag;af=o[q];while(ai>0){af=af.parentNode;ai--}ah=o[W];while(ai<0){ah=ah.parentNode;ai++}for(ad=af.parentNode,al=ah.parentNode;ad!=al;ad=ad.parentNode,al=al.parentNode){af=ad;ah=al}return x(af,ah,ak)}function n(aj){var al,am,ad,af,ag,ak,ah,ae,ai;if(aj!=s){al=E()}if(o[ac]==o[H]){return al}if(o[q].nodeType==3){am=o[q].nodeValue;ad=am.substring(o[ac],o[H]);if(aj!=M){af=o[q];ae=o[ac];ai=o[H]-o[ac];if(ae===0&&ai>=af.nodeValue.length-1){af.parentNode.removeChild(af)}else{af.deleteData(ae,ai)}o.collapse(L)}if(aj==s){return}if(ad.length>0){al.appendChild(m.createTextNode(ad))}return al}af=V(o[q],o[ac]);ag=o[H]-o[ac];while(af&&ag>0){ak=af.nextSibling;ah=G(af,aj);if(al){al.appendChild(ah)}--ag;af=ak}if(aj!=M){o.collapse(L)}return al}function A(ak,ah){var aj,ai,ae,ad,ag,af;if(ah!=s){aj=E()}ai=r(ak,ah);if(aj){aj.appendChild(ai)}ae=w(ak);ad=ae-o[ac];if(ad<=0){if(ah!=M){o.setEndBefore(ak);o.collapse(Y)}return aj}ai=ak.previousSibling;while(ad>0){ag=ai.previousSibling;af=G(ai,ah);if(aj){aj.insertBefore(af,aj.firstChild)}--ad;ai=ag}if(ah!=M){o.setEndBefore(ak);o.collapse(Y)}return aj}function ab(ai,ah){var ak,ae,aj,ad,ag,af;if(ah!=s){ak=E()}aj=X(ai,ah);if(ak){ak.appendChild(aj)}ae=w(ai);++ae;ad=o[H]-ae;aj=ai.nextSibling;while(aj&&ad>0){ag=aj.nextSibling;af=G(aj,ah);if(ak){ak.appendChild(af)}--ad;aj=ag}if(ah!=M){o.setStartAfter(ai);o.collapse(L)}return ak}function x(ah,ad,ak){var ae,am,ai,aj,af,al,ag;if(ak!=s){am=E()}ae=X(ah,ak);if(am){am.appendChild(ae)}ai=w(ah);aj=w(ad);++ai;af=aj-ai;al=ah.nextSibling;while(af>0){ag=al.nextSibling;ae=G(al,ak);if(am){am.appendChild(ae)}al=ag;--af}ae=r(ad,ak);if(am){am.appendChild(ae)}if(ak!=M){o.setStartAfter(ah);o.collapse(L)}return am}function r(aj,ak){var af=V(o[W],o[H]-1),al,ai;var ah,ad,ae,ag=af!=o[W];if(af==aj){return T(af,ag,Y,ak)}al=af.parentNode;ai=T(al,Y,Y,ak);while(al){while(af){ah=af.previousSibling;ad=T(af,ag,Y,ak);if(ak!=s){ai.insertBefore(ad,ai.firstChild)}ag=L;af=ah}if(al==aj){return ai}af=al.previousSibling;al=al.parentNode;ae=T(al,Y,Y,ak);if(ak!=s){ae.appendChild(ai)}ai=ae}}function X(aj,ak){var ag=V(o[q],o[ac]),ah=ag!=o[q];var al,ai,af,ad,ae;if(ag==aj){return T(ag,ah,L,ak)}al=ag.parentNode;ai=T(al,Y,L,ak);while(al){while(ag){af=ag.nextSibling;ad=T(ag,ah,L,ak);if(ak!=s){ai.appendChild(ad)}ah=L;ag=af}if(al==aj){return ai}ag=al.nextSibling;al=al.parentNode;ae=T(al,Y,L,ak);if(ak!=s){ae.appendChild(ai)}ai=ae}}function T(ad,ah,ak,al){var ag,af,ai,ae,aj;if(ah){return G(ad,al)}if(ad.nodeType==3){ag=ad.nodeValue;if(ak){ae=o[ac];af=ag.substring(ae);ai=ag.substring(0,ae)}else{ae=o[H];af=ag.substring(0,ae);ai=ag.substring(ae)}if(al!=M){ad.nodeValue=ai}if(al==s){return}aj=k.clone(ad,Y);aj.nodeValue=af;return aj}if(al==s){return}return k.clone(ad,Y)}function G(ae,ad){if(ad!=s){return ad==M?k.clone(ae,L):ae}ae.parentNode.removeChild(ae)}function Z(){return k.create("body",null,l()).outerText}t(o,{startContainer:m,startOffset:0,endContainer:m,endOffset:0,collapsed:L,commonAncestorContainer:m,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:z,setEnd:B,setStartBefore:p,setStartAfter:Q,setEndBefore:R,setEndAfter:C,collapse:I,selectNode:F,selectNodeContents:N,compareBoundaryPoints:D,deleteContents:y,extractContents:P,cloneContents:l,insertNode:K,surroundContents:U,cloneRange:S,toStringIE:Z});return o}j.prototype.toString=function(){return this.toStringIE()};return j});h("tinymce/html/Entities",["tinymce/util/Tools"],function(l){var m=l.makeMap;var i,r,o,u=/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,j=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,q=/[<>&\"\']/g,n=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,t={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"};r={'"':""","'":"'","<":"<",">":">","&":"&","\u0060":"`"};o={"<":"<",">":">","&":"&",""":'"',"'":"'"};function s(v){var w;w=document.createElement("div");w.innerHTML=v;return w.textContent||w.innerText||v}function p(w,z){var x,y,v,A={};if(w){w=w.split(",");z=z||10;for(x=0;x1){return"&#"+(((x.charCodeAt(0)-55296)*1024)+(x.charCodeAt(1)-56320)+65536)+";"}return r[x]||"&#"+x.charCodeAt(0)+";"})},encodeNamed:function(x,v,w){w=w||i;return x.replace(v?u:j,function(y){return r[y]||w[y]||y})},getEncodeFunc:function(v,y){y=p(y)||i;function w(A,z){return A.replace(z?u:j,function(B){return r[B]||y[B]||"&#"+B.charCodeAt(0)+";"||B})}function x(A,z){return k.encodeNamed(A,z,y)}v=m(v.replace(/\+/g,","));if(v.named&&v.numeric){return w}if(v.named){if(y){return x}return k.encodeNamed}if(v.numeric){return k.encodeNumeric}return k.encodeRaw},decode:function(v){return v.replace(n,function(x,w){if(w){if(w.charAt(0).toLowerCase()==="x"){w=parseInt(w.substr(1),16)}else{w=parseInt(w,10)}if(w>65535){w-=65536;return String.fromCharCode(55296+(w>>10),56320+(w&1023))}else{return t[w]||String.fromCharCode(w)}}return o[x]||i[x]||s(x)})}};return k});h("tinymce/dom/StyleSheetLoader",["tinymce/util/Tools"],function(i){return function(j,n){var k=0,m={},p;n=n||{};p=n.maxLoadTime||5000;function l(q){j.getElementsByTagName("head")[0].appendChild(q)}function o(s,w,A){var B,r,t,q;function x(){var E=q.passed,D=E.length;while(D--){E[D]()}q.status=2;q.passed=[];q.failed=[]}function z(){var E=q.failed,D=E.length;while(D--){E[D]()}q.status=3;q.passed=[];q.failed=[]}function C(){var D=navigator.userAgent.match(/WebKit\/(\d*)/);return !!(D&&D[1]<536)}function y(D,E){if(!D()){if((new Date().getTime())-t0){r=j.createElement("style");r.textContent='@import "'+s+'"';v();l(r);return}else{u()}}l(B);B.href=s}this.load=o}});h("tinymce/dom/DOMUtils",["tinymce/dom/Sizzle","tinymce/dom/DomQuery","tinymce/html/Styles","tinymce/dom/EventUtils","tinymce/dom/TreeWalker","tinymce/dom/Range","tinymce/html/Entities","tinymce/Env","tinymce/util/Tools","tinymce/dom/StyleSheetLoader"],function(k,o,r,n,p,z,l,j,i,u){var m=i.each,q=i.is,s=i.grep,w=i.trim;var v=j.ie;var t=/^([a-z0-9],?)+$/i;var A=/^[ \t\r\n]*$/;function x(C,E){var D={},B=E.keep_values,F;F={set:function(G,I,H){if(E.url_converter){I=E.url_converter.call(E.url_converter_scope||C,I,H,G[0])}G.attr("data-mce-"+H,I).attr(H,I)},get:function(G,H){return G.attr("data-mce-"+H)||G.attr(H)}};D={style:{set:function(G,H){if(H!==null&&typeof H==="object"){G.css(H);return}if(B){G.attr("data-mce-style",H)}G.attr("style",H)},get:function(G){var H=G.attr("data-mce-style")||G.attr("style");H=C.serializeStyle(C.parseStyle(H),G[0].nodeName);return H}}};if(B){D.href=D.src=F}return D}function y(E,C){var B=this,D;B.doc=E;B.win=window;B.files={};B.counter=0;B.stdMode=!v||E.documentMode>=8;B.boxModel=!v||E.compatMode=="CSS1Compat"||B.stdMode;B.styleSheetLoader=new u(E);B.boundEvents=[];B.settings=C=C||{};B.schema=C.schema;B.styles=new r({url_converter:C.url_converter,url_converter_scope:C.url_converter_scope},C.schema);B.fixDoc(E);B.events=C.ownEvents?new n(C.proxy):n.Event;B.attrHooks=x(B,C);D=C.schema?C.schema.getBlockElements():{};B.$=o.overrideDefaults(function(){return{context:E,element:B.getRoot()}});B.isBlock=function(G){if(!G){return false}var F=G.nodeType;if(F){return !!(F===1&&D[G.nodeName])}return !!D[G]}}y.prototype={$$:function(B){if(typeof B=="string"){B=this.get(B)}return this.$(B)},root:null,fixDoc:function(D){var C=this.settings,B;if(v&&C.schema){("abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video").replace(/\w+/g,function(E){D.createElement(E)});for(B in C.schema.getCustomElements()){D.createElement(B)}}},clone:function(D,B){var C=this,F,E;if(!v||D.nodeType!==1||B){return D.cloneNode(B)}E=C.doc;if(!B){F=E.createElement(D.nodeName);m(C.getAttribs(D),function(G){C.setAttrib(F,G.nodeName,C.getAttrib(D,G.nodeName))});return F}return F.firstChild},getRoot:function(){var B=this;return B.settings.root_element||B.doc.body},getViewPort:function(C){var B,D;C=!C?this.win:C;B=C.document;D=this.boxModel?B.documentElement:B.body;return{x:C.pageXOffset||D.scrollLeft,y:C.pageYOffset||D.scrollTop,w:C.innerWidth||D.clientWidth,h:C.innerHeight||D.clientHeight}},getRect:function(E){var B=this,D,C;E=B.get(E);D=B.getPos(E);C=B.getSize(E);return{x:D.x,y:D.y,w:C.w,h:C.h}},getSize:function(E){var C=this,B,D;E=C.get(E);B=C.getStyle(E,"width");D=C.getStyle(E,"height");if(B.indexOf("px")===-1){B=0}if(D.indexOf("px")===-1){D=0}return{w:parseInt(B,10)||E.offsetWidth||E.clientWidth,h:parseInt(D,10)||E.offsetHeight||E.clientHeight}},getParent:function(D,B,C){return this.getParents(D,B,C,false)},getParents:function(G,C,D,H){var F=this,E,B=[];G=F.get(G);H=H===g;D=D||(F.getRoot().nodeName!="BODY"?F.getRoot().parentNode:null);if(q(C,"string")){E=C;if(C==="*"){C=function(I){return I.nodeType==1}}else{C=function(I){return F.is(I,E)}}}while(G){if(G==D||!G.nodeType||G.nodeType===9){break}if(!C||C(G)){if(H){B.push(G)}else{return G}}G=G.parentNode}return H?B:null},get:function(C){var B;if(C&&this.doc&&typeof C=="string"){B=C;C=this.doc.getElementById(C);if(C&&C.id!==B){return this.doc.getElementsByName(B)[1]}}return C},getNext:function(C,B){return this._findSib(C,B,"nextSibling")},getPrev:function(C,B){return this._findSib(C,B,"previousSibling")},select:function(B,D){var C=this;return k(B,C.get(D)||C.settings.root_element||C.doc,[])},is:function(E,B){var C;if(E.length===g){if(B==="*"){return E.nodeType==1}if(t.test(B)){B=B.toLowerCase().split(/,/);E=E.nodeName.toLowerCase();for(C=B.length-1;C>=0;C--){if(B[C]==E){return true}}return false}}if(E.nodeType&&E.nodeType!=1){return false}var D=E.nodeType?[E]:E;return k(B,D[0].ownerDocument||D[0],null,D).length>0},add:function(G,D,C,F,E){var B=this;return this.run(G,function(I){var H;H=q(D,"string")?B.doc.createElement(D):D;B.setAttribs(H,C);if(F){if(F.nodeType){H.appendChild(F)}else{B.setHTML(H,F)}}return !E?I.appendChild(H):H})},create:function(C,B,D){return this.add(this.doc.createElement(C),C,B,D,1)},createHTML:function(C,B,E){var F="",D;F+="<"+C;for(D in B){if(B.hasOwnProperty(D)&&B[D]!==null&&typeof B[D]!="undefined"){F+=" "+D+'="'+this.encode(B[D])+'"'}}if(typeof E!="undefined"){return F+">"+E+""}return F+" />"},createFragment:function(C){var F,D,E=this.doc,B;B=E.createElement("div");F=E.createDocumentFragment();if(C){B.innerHTML=C}while((D=B.firstChild)){F.appendChild(D)}return F},remove:function(B,C){B=this.$$(B);if(C){B.each(function(){var D;while((D=this.firstChild)){if(D.nodeType==3&&D.data.length===0){this.removeChild(D)}else{this.parentNode.insertBefore(D,this)}}}).remove()}else{B.remove()}return B.length>1?B.toArray():B[0]},setStyle:function(D,B,C){D=this.$$(D).css(B,C);if(this.settings.update_styles){D.attr("data-mce-style",null)}},getStyle:function(D,B,C){D=this.$$(D);if(C){return D.css(B)}B=B.replace(/-(\D)/g,function(F,E){return E.toUpperCase()});if(B=="float"){B=v?"styleFloat":"cssFloat"}return D[0]&&D[0].style?D[0].style[B]:g},setStyles:function(C,B){C=this.$$(C).css(B);if(this.settings.update_styles){C.attr("data-mce-style",null)}},removeAllAttribs:function(B){return this.run(B,function(E){var D,C=E.attributes;for(D=C.length-1;D>=0;D--){E.removeAttributeNode(C.item(D))}})},setAttrib:function(H,D,G){var C=this,B,F,E=C.settings;if(G===""){G=null}H=C.$$(H);B=H.attr(D);if(!H.length){return}F=C.attrHooks[D];if(F&&F.set){F.set(H,G,D)}else{H.attr(D,G)}if(B!=G&&E.onSetAttrib){E.onSetAttrib({attrElm:H,attrName:D,attrValue:G})}},setAttribs:function(D,C){var B=this;B.$$(D).each(function(E,F){m(C,function(H,G){B.setAttrib(F,G,H)})})},getAttrib:function(G,C,F){var B=this,E,D;G=B.$$(G);if(G.length){E=B.attrHooks[C];if(E&&E.get){D=E.get(G,C)}else{D=G.attr(C)}}if(typeof D=="undefined"){D=F||""}return D},getPos:function(D,E){var J=this,H=0,G=0,B,I=J.doc,C=I.body,F;D=J.get(D);E=E||C;if(D){if(E===C&&D.getBoundingClientRect&&o(C).css("position")==="static"){F=D.getBoundingClientRect();E=J.boxModel?I.documentElement:C;H=F.left+(I.documentElement.scrollLeft||C.scrollLeft)-E.clientLeft;G=F.top+(I.documentElement.scrollTop||C.scrollTop)-E.clientTop;return{x:H,y:G}}B=D;while(B&&B!=E&&B.nodeType){H+=B.offsetLeft||0;G+=B.offsetTop||0;B=B.offsetParent}B=D.parentNode;while(B&&B!=E&&B.nodeType){H-=B.scrollLeft||0;G-=B.scrollTop||0;B=B.parentNode}}return{x:H,y:G}},parseStyle:function(B){return this.styles.parse(B)},serializeStyle:function(C,B){return this.styles.serialize(C,B)},addStyle:function(E){var C=this,F=C.doc,D,G;if(C!==y.DOM&&F===document){var B=y.DOM.addedStyles;B=B||[];if(B[E]){return}B[E]=true;y.DOM.addedStyles=B}G=F.getElementById("mceDefaultStyles");if(!G){G=F.createElement("style");G.id="mceDefaultStyles";G.type="text/css";D=F.getElementsByTagName("head")[0];if(D.firstChild){D.insertBefore(G,D.firstChild)}else{D.appendChild(G)}}if(G.styleSheet){G.styleSheet.cssText+=E}else{G.appendChild(F.createTextNode(E))}},loadCSS:function(C){var B=this,E=B.doc,D;if(B!==y.DOM&&E===document){y.DOM.loadCSS(C);return}if(!C){C=""}D=E.getElementsByTagName("head")[0];m(C.split(","),function(F){var G;F=i._addCacheSuffix(F);if(B.files[F]){return}B.files[F]=true;G=B.create("link",{rel:"stylesheet",href:F});if(v&&E.documentMode&&E.recalc){G.onload=function(){if(E.recalc){E.recalc()}G.onload=null}}D.appendChild(G)})},addClass:function(C,B){this.$$(C).addClass(B)},removeClass:function(C,B){this.toggleClass(C,B,false)},hasClass:function(C,B){return this.$$(C).hasClass(B)},toggleClass:function(D,B,C){this.$$(D).toggleClass(B,C).each(function(){if(this.className===""){o(this).attr("class",null)}})},show:function(B){this.$$(B).show()},hide:function(B){this.$$(B).hide()},isHidden:function(B){return this.$$(B).css("display")=="none"},uniqueId:function(B){return(!B?"mce_":B)+(this.counter++)},setHTML:function(C,B){C=this.$$(C);if(v){C.each(function(E,F){if(F.canHaveHTML===false){return}while(F.firstChild){F.removeChild(F.firstChild)}try{F.innerHTML="
    "+B;F.removeChild(F.firstChild)}catch(D){o("
    ").html("
    "+B).contents().slice(1).appendTo(F)}return B})}else{C.html(B)}},getOuterHTML:function(B){B=this.get(B);return B.nodeType==1&&"outerHTML" in B?B.outerHTML:o("
    ").append(o(B).clone()).html()},setOuterHTML:function(D,C){var B=this;B.$$(D).each(function(){try{if("outerHTML" in this){this.outerHTML=C;return}}catch(E){}B.remove(o(this).html(C),true)})},decode:l.decode,encode:l.encodeAllRaw,insertAfter:function(C,B){B=this.get(B);return this.run(C,function(E){var D,F;D=B.parentNode;F=B.nextSibling;if(F){D.insertBefore(E,F)}else{D.appendChild(E)}return E})},replace:function(D,C,E){var B=this;return B.run(C,function(F){if(q(F,"array")){D=D.cloneNode(true)}if(E){m(s(F.childNodes),function(G){D.appendChild(G)})}return F.parentNode.replaceChild(D,F)})},rename:function(E,C){var B=this,D;if(E.nodeName!=C.toUpperCase()){D=B.create(C);m(B.getAttribs(E),function(F){B.setAttrib(D,F.nodeName,B.getAttrib(E,F.nodeName))});B.replace(D,E,1)}return D||E},findCommonAncestor:function(D,B){var E=D,C;while(E){C=B;while(C&&E!=C){C=C.parentNode}if(E==C){break}E=E.parentNode}if(!E&&D.ownerDocument){return D.ownerDocument.documentElement}return E},toHex:function(B){return this.styles.toHex(i.trim(B))},run:function(F,E,D){var C=this,B;if(typeof F==="string"){F=C.get(F)}if(!F){return false}D=D||this;if(!F.nodeType&&(F.length||F.length===0)){B=[];m(F,function(H,G){if(H){if(typeof H=="string"){H=C.get(H)}B.push(E.call(D,H,G))}});return B}return E.call(D,F)},getAttribs:function(D){var B;D=this.get(D);if(!D){return[]}if(v){B=[];if(D.nodeName=="OBJECT"){return D.attributes}if(D.nodeName==="OPTION"&&this.getAttrib(D,"selected")){B.push({specified:1,nodeName:"selected"})}var C=/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi;D.cloneNode(false).outerHTML.replace(C,"").replace(/[\w:\-]+/gi,function(E){B.push({specified:1,nodeName:E})});return B}return D.attributes},isEmpty:function(E,C){var J=this,G,F,I,B,D,H=0;E=E.firstChild;if(E){B=new p(E,E.parentNode);C=C||(J.schema?J.schema.getNonEmptyElements():null);do{I=E.nodeType;if(I===1){if(E.getAttribute("data-mce-bogus")){continue}D=E.nodeName.toLowerCase();if(C&&C[D]){if(D==="br"){H++;continue}return false}F=J.getAttribs(E);G=F.length;while(G--){D=F[G].nodeName;if(D==="name"||D==="data-mce-bookmark"){return false}}}if(I==8){return false}if((I===3&&!A.test(E.nodeValue))){return false}}while((E=B.next()))}return H<=1},createRng:function(){var B=this.doc;return B.createRange?B.createRange():new z(this)},nodeIndex:function(E,F){var B=0,D,C;if(E){for(D=E.nodeType,E=E.previousSibling;E;E=E.previousSibling){C=E.nodeType;if(F&&C==3){if(C==D||!E.nodeValue.length){continue}}B++;D=C}}return B},split:function(F,G,C){var J=this,B=J.createRng(),H,E,I;function D(O){var M,L=O.childNodes,N=O.nodeType;function P(S){var R=S.previousSibling&&S.previousSibling.nodeName=="SPAN";var Q=S.nextSibling&&S.nextSibling.nodeName=="SPAN";return R&&Q}if(N==1&&O.getAttribute("data-mce-type")=="bookmark"){return}for(M=L.length-1;M>=0;M--){D(L[M])}if(N!=9){if(N==3&&O.nodeValue.length>0){var K=w(O.nodeValue).length;if(!J.isBlock(O.parentNode)||K>0||K===0&&P(O)){return}}else{if(N==1){L=O.childNodes;if(L.length==1&&L[0]&&L[0].nodeType==1&&L[0].getAttribute("data-mce-type")=="bookmark"){O.parentNode.insertBefore(L[0],O)}if(L.length||/^(br|hr|input|img)$/i.test(O.nodeName)){return}}}J.remove(O)}return O}if(F&&G){B.setStart(F.parentNode,J.nodeIndex(F));B.setEnd(G.parentNode,J.nodeIndex(G));H=B.extractContents();B=J.createRng();B.setStart(G.parentNode,J.nodeIndex(G)+1);B.setEnd(F.parentNode,J.nodeIndex(F)+1);E=B.extractContents();I=F.parentNode;I.insertBefore(D(H),F);if(C){I.replaceChild(C,G)}else{I.insertBefore(G,F)}I.insertBefore(D(E),F);J.remove(F);return C||G}},bind:function(G,C,F,E){var B=this;if(i.isArray(G)){var D=G.length;while(D--){G[D]=B.bind(G[D],C,F,E)}return G}if(B.settings.collect&&(G===B.doc||G===B.win)){B.boundEvents.push([G,C,F,E])}return B.events.bind(G,C,F,E||B)},unbind:function(G,C,F){var B=this,D;if(i.isArray(G)){D=G.length;while(D--){G[D]=B.unbind(G[D],C,F)}return G}if(B.boundEvents&&(G===B.doc||G===B.win)){D=B.boundEvents.length;while(D--){var E=B.boundEvents[D];if(G==E[0]&&(!C||C==E[1])&&(!F||F==E[2])){this.events.unbind(E[0],E[1],E[2])}}}return this.events.unbind(G,C,F)},fire:function(D,C,B){return this.events.fire(D,C,B)},getContentEditable:function(C){var B;if(!C||C.nodeType!=1){return null}B=C.getAttribute("data-mce-contenteditable");if(B&&B!=="inherit"){return B}return C.contentEditable!=="inherit"?C.contentEditable:null},getContentEditableParent:function(C){var B=this.getRoot(),D=null;for(;C&&C!==B;C=C.parentNode){D=this.getContentEditable(C);if(D!==null){break}}return D},destroy:function(){var B=this;if(B.boundEvents){var C=B.boundEvents.length;while(C--){var D=B.boundEvents[C];this.events.unbind(D[0],D[1],D[2])}B.boundEvents=null}if(k.setDocument){k.setDocument()}B.win=B.doc=B.root=B.events=B.frag=null},isChildOf:function(C,B){while(C){if(B===C){return true}C=C.parentNode}return false},dumpRng:function(B){return("startContainer: "+B.startContainer.nodeName+", startOffset: "+B.startOffset+", endContainer: "+B.endContainer.nodeName+", endOffset: "+B.endOffset)},_findSib:function(F,B,D){var C=this,E=B;if(F){if(typeof E=="string"){E=function(G){return C.is(G,B)}}for(F=F[D];F;F=F[D]){if(E(F)){return F}}}return null}};y.DOM=new y(document);return y});h("tinymce/dom/ScriptLoader",["tinymce/dom/DOMUtils","tinymce/util/Tools"],function(m,i){var k=m.DOM;var l=i.each,j=i.grep;function n(){var p=0,w=1,u=2,x={},v=[],r={},q=[],t=0,s;function o(A,E){var B=k,D,C;function y(){B.remove(C);if(D){D.onreadystatechange=D.onload=D=null}E()}function z(){if(typeof console!=="undefined"&&console.log){console.log("Failed to load: "+A)}}C=B.uniqueId();D=document.createElement("script");D.id=C;D.type="text/javascript";D.src=i._addCacheSuffix(A);if("onreadystatechange" in D){D.onreadystatechange=function(){if(/loaded|complete/.test(D.readyState)){y()}}}else{D.onload=y}D.onerror=z;(document.getElementsByTagName("head")[0]||document.body).appendChild(D)}this.isDone=function(y){return x[y]==u};this.markDone=function(y){x[y]=u};this.add=this.load=function(y,B,z){var A=x[y];if(A==s){v.push(y);x[y]=p}if(B){if(!r[y]){r[y]=[]}r[y].push({func:B,scope:z||this})}};this.loadQueue=function(z,y){this.loadScripts(v,z,y)};this.loadScripts=function(y,C,B){var A;function z(D){l(r[D],function(E){E.func.call(E.scope)});r[D]=s}q.push({func:C,scope:B||this});A=function(){var D=j(y);y.length=0;l(D,function(E){if(x[E]==u){z(E);return}if(x[E]!=w){x[E]=w;t++;o(E,function(){x[E]=u;t--;z(E);A()})}});if(!t){l(q,function(E){E.func.call(E.scope)});q.length=0}};A()}}n.ScriptLoader=new n();return n});h("tinymce/AddOnManager",["tinymce/dom/ScriptLoader","tinymce/util/Tools"],function(l,i){var k=i.each;function j(){var m=this;m.items=[];m.urls={};m.lookup={}}j.prototype={get:function(m){if(this.lookup[m]){return this.lookup[m].instance}else{return g}},dependencies:function(n){var m;if(this.lookup[n]){m=this.lookup[n].dependencies}return m||[]},requireLangPack:function(m,n){var o=j.language;if(o&&j.languageLoad!==false){if(n){n=","+n+",";if(n.indexOf(","+o.substr(0,2)+",")!=-1){o=o.substr(0,2)}else{if(n.indexOf(","+o+",")==-1){return}}}l.ScriptLoader.add(this.urls[m]+"/langs/"+o+".js")}},add:function(o,m,n){this.items.push(m);this.lookup[o]={instance:m,dependencies:n};return m},createUrl:function(m,n){if(typeof n==="object"){return n}else{return{prefix:m.prefix,resource:n,suffix:m.suffix}}},addComponents:function(o,m){var n=this.urls[o];k(m,function(p){l.ScriptLoader.add(n+"/"+p)})},load:function(o,q,s,p){var m=this,n=q;function r(){var t=m.dependencies(o);k(t,function(v){var u=m.createUrl(q,v);m.load(u.resource,u,g,g)});if(s){if(p){s.call(p)}else{s.call(l)}}}if(m.urls[o]){return}if(typeof q==="object"){n=q.prefix+q.resource+q.suffix}if(n.indexOf("/")!==0&&n.indexOf("://")==-1){n=j.baseURL+"/"+n}m.urls[o]=n.substring(0,n.lastIndexOf("/"));if(m.lookup[o]){r()}else{l.ScriptLoader.add(n,r,p)}}};j.PluginManager=new j();j.ThemeManager=new j();return j});h("tinymce/dom/RangeUtils",["tinymce/util/Tools","tinymce/dom/TreeWalker"],function(i,j){var l=i.each;function m(n,o){var p=n.childNodes;o--;if(o>p.length-1){o=p.length-1}else{if(o<0){o=0}}return p[o]||n}function k(n){this.walk=function(o,D){var t=o.startContainer,w=o.startOffset,E=o.endContainer,x=o.endOffset,u,r,z,s,C,B,p;p=n.select("td.mce-item-selected,th.mce-item-selected");if(p.length>0){l(p,function(F){D([F])});return}function q(F){var G;G=F[0];if(G.nodeType===3&&G===t&&w>=G.nodeValue.length){F.splice(0,1)}G=F[F.length-1];if(x===0&&F.length>0&&G===E&&G.nodeType===3){F.splice(F.length-1,1)}return F}function A(H,G,F){var I=[];for(;H&&H!=F;H=H[G]){I.push(H)}return I}function y(G,F){do{if(G.parentNode==F){return G}G=G.parentNode}while(G)}function v(H,G,I){var F=I?"nextSibling":"previousSibling";for(s=H,C=s.parentNode;s&&s!=G;s=C){C=s.parentNode;B=A(s==H?s:s[F],F);if(B.length){if(!I){B.reverse()}D(q(B))}}}if(t.nodeType==1&&t.hasChildNodes()){t=t.childNodes[w]}if(E.nodeType==1&&E.hasChildNodes()){E=m(E,x)}if(t==E){return D(q([t]))}u=n.findCommonAncestor(t,E);for(s=t;s;s=s.parentNode){if(s===E){return v(t,u,true)}if(s===u){break}}for(s=E;s;s=s.parentNode){if(s===t){return v(E,u)}if(s===u){break}}r=y(t,u)||t;z=y(E,u)||E;v(t,r,true);B=A(r==t?r:r.nextSibling,"nextSibling",z==E?z.nextSibling:z);if(B.length){D(q(B))}v(E,z)};this.split=function(p){var s=p.startContainer,o=p.startOffset,t=p.endContainer,r=p.endOffset;function q(u,v){return u.splitText(v)}if(s==t&&s.nodeType==3){if(o>0&&oo){r=r-o;s=t=q(t,r).previousSibling;r=t.nodeValue.length;o=0}else{r=0}}}else{if(s.nodeType==3&&o>0&&o0&&r0){t=v;x=H?v.nodeValue.length:0;r=true;return}if(n.isBlock(v)||y[v.nodeName.toLowerCase()]){return}F=v}if(q&&F){t=F;r=true;x=0}}t=o[(u?"start":"end")+"Container"];x=o[(u?"start":"end")+"Offset"];w=t.nodeType==1&&x===t.childNodes.length;y=n.schema.getNonEmptyElements();B=u;if(t.nodeType==1&&x>t.childNodes.length-1){B=false}if(t.nodeType===9){t=n.getRoot();x=0}if(t===z){if(B){v=t.childNodes[x>0?x-1:0];if(v){if(y[v.nodeName]||v.nodeName=="TABLE"){return}}}if(t.hasChildNodes()){x=Math.min(!B&&x>0?x-1:x,t.childNodes.length-1);t=t.childNodes[x];x=0;if(t.hasChildNodes()&&!/TABLE/.test(t.nodeName)){v=t;s=new j(t,z);do{if(v.nodeType===3&&v.nodeValue.length>0){x=B?0:v.nodeValue.length;t=v;r=true;break}if(y[v.nodeName.toLowerCase()]){x=n.nodeIndex(v);t=v.parentNode;if(v.nodeName=="IMG"&&!B){x++}r=true;break}}while((v=(B?s.next():s.prev())))}}}if(q){if(t.nodeType===3&&x===0){C(true)}if(t.nodeType===1){v=t.childNodes[x];if(!v){v=t.childNodes[x-1]}if(v&&v.nodeName==="BR"&&!A(v,"A")&&!D(v)&&!D(v,true)){C(true,v)}}}if(B&&!q&&t.nodeType===3&&x===t.nodeValue.length){C(false)}if(r){o["set"+(u?"Start":"End")](t,x)}}q=o.collapsed;p(true);if(!q){p()}if(r&&q){o.collapse(true)}return r}}k.compareRanges=function(o,n){if(o&&n){if(o.item||o.duplicate){if(o.item&&n.item&&o.item(0)===n.item(0)){return true}if(o.isEqual&&n.isEqual&&n.isEqual(o)){return true}}else{return o.startContainer==n.startContainer&&o.startOffset==n.startOffset}}return false};k.getCaretRangeFromPoint=function(o,s,r){var p,n;if(r.caretPositionFromPoint){n=r.caretPositionFromPoint(o,s);p=r.createRange();p.setStart(n.offsetNode,n.offset);p.collapse(true)}else{if(r.caretRangeFromPoint){p=r.caretRangeFromPoint(o,s)}else{if(r.body.createTextRange){p=r.body.createTextRange();try{p.moveToPoint(o,s);p.collapse(true)}catch(q){p.collapse(s=n.childNodes.length){o=n.childNodes.length-1}n=n.childNodes[o]}return n};return k});h("tinymce/NodeChange",["tinymce/dom/RangeUtils","tinymce/Env"],function(j,i){return function(k){var m,l=[];function n(o){var p,q;q=k.$(o).parentsUntil(k.getBody()).add(o);if(q.length===l.length){for(p=q.length;p>=0;p--){if(q[p]!==l[p]){break}}if(p===-1){l=q;return true}}l=q;return false}if(!("onselectionchange" in k.getDoc())){k.on("NodeChange Click MouseUp KeyUp Focus",function(p){var q,o;q=k.selection.getRng();o={startContainer:q.startContainer,startOffset:q.startOffset,endContainer:q.endContainer,endOffset:q.endOffset};if(p.type=="nodechange"||!j.compareRanges(o,m)){k.fire("SelectionChange")}m=o})}k.on("contextmenu",function(){k.fire("SelectionChange")});k.on("SelectionChange",function(){var o=k.selection.getStart(true);if(!i.range&&k.selection.isCollapsed()){return}if(!n(o)&&k.dom.isChildOf(o,k.getBody())){k.nodeChanged({selectionChange:true})}});k.on("MouseUp",function(o){if(!o.isDefaultPrevented()){if(k.selection.getNode().nodeName=="IMG"){setTimeout(function(){k.nodeChanged()},0)}else{k.nodeChanged()}}});this.nodeChanged=function(q){var r=k.selection,s,p,o;if(k.initialized&&r&&!k.settings.disable_nodechange&&!k.settings.readonly){o=k.getBody();s=r.getStart()||o;s=s.ownerDocument!=k.getDoc()?k.getBody():s;if(s.nodeName=="IMG"&&r.isCollapsed()){s=s.parentNode}p=[];k.dom.getParent(s,function(t){if(t===o){return true}p.push(t)});q=q||{};q.element=s;q.parents=p;k.fire("NodeChange",q)}}}});h("tinymce/html/Node",[],function(){var k=/^[ \t\r\n]*$/,l={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};function i(r,s,q){var p,o,m=q?"lastChild":"firstChild",n=q?"prev":"next";if(r[m]){return r[m]}if(r!==s){p=r[n];if(p){return p}for(o=r.parent;o&&o!==s;o=o.parent){p=o[n];if(p){return p}}}}function j(m,n){this.name=m;this.type=n;if(n===1){this.attributes=[];this.attributes.map={}}}j.prototype={replace:function(n){var m=this;if(n.parent){n.remove()}m.insert(n,m);m.remove();return m},attr:function(o,r){var m=this,n,p,q;if(typeof o!=="string"){for(p in o){m.attr(p,o[p])}return m}if((n=m.attributes)){if(r!==q){if(r===null){if(o in n.map){delete n.map[o];p=n.length;while(p--){if(n[p].name===o){n=n.splice(p,1);return m}}}return m}if(o in n.map){p=n.length;while(p--){if(n[p].name===o){n[p].value=r;break}}}else{n.push({name:o,value:r})}n.map[o]=r;return m}else{return n.map[o]}}},clone:function(){var n=this,s=new j(n.name,n.type),o,m,r,p,q;if((r=n.attributes)){q=[];q.map={};for(o=0,m=r.length;o
    ")},postRender:function(){var q=this,r;q.items().exec("postRender");q._super();q._layout.postRender(q);q._rendered=true;if(q.settings.style){j.css(q.getEl(),q.settings.style)}if(q.settings.border){r=q.borderBox();j.css(q.getEl(),{"border-top-width":r.top,"border-right-width":r.right,"border-bottom-width":r.bottom,"border-left-width":r.left})}if(!q.parent()){q.keyboardNav=new n({root:q})}return q},initLayoutRect:function(){var q=this,r=q._super();q._layout.recalc(q);return r},recalc:function(){var q=this,s=q._layoutRect,r=q._lastRect;if(!r||r.w!=s.w||r.h!=s.h){q._layout.recalc(q);s=q.layoutRect();q._lastRect={x:s.x,y:s.y,w:s.w,h:s.h};return true}},reflow:function(){var q;if(this.visible()){p.repaintControls=[];p.repaintControls.map={};this.recalc();q=p.repaintControls.length;while(q--){p.repaintControls[q].repaint()}if(this.settings.layout!=="flow"&&this.settings.layout!=="stack"){this.repaint()}p.repaintControls=[]}return this}})});h("tinymce/ui/DragHelper",["tinymce/ui/DomUtils"],function(i){function j(){var r=document,s,n,l,q;var o,t,m,k,p=Math.max;s=r.documentElement;n=r.body;l=p(s.scrollWidth,n.scrollWidth);q=p(s.clientWidth,n.clientWidth);o=p(s.offsetWidth,n.offsetWidth);t=p(s.scrollHeight,n.scrollHeight);m=p(s.clientHeight,n.clientHeight);k=p(s.offsetHeight,n.offsetHeight);return{width:lp.clientWidth;q=p.scrollHeight>p.clientHeight;o("h","Left","Width","contentW",r,"Height");o("v","Top","Height","contentH",q,"Width")}function k(){function o(v,r,p,w,t){var u,q=l._id+"-scroll"+v,s=l.classPrefix;l.getEl().appendChild(i.createFragment('
    '));l.draghelper=new j(q+"t",{start:function(){u=l.getEl("body")["scroll"+r];i.addClass(i.get(q),s+"active")},drag:function(A){var x,C,z,B,y=l.layoutRect();C=y.contentW>y.innerW;z=y.contentH>y.innerH;B=l.getEl("body")["client"+p]-(m*2);B-=C&&z?l.getEl("scroll"+v)["client"+t]:0;x=B/l.getEl("body")["scroll"+p];l.getEl("body")["scroll"+r]=u+(A["delta"+w]/x)},stop:function(){i.removeClass(i.get(q),s+"active")}})}l.addClass("scroll");o("v","Top","Height","Y","Width");o("h","Left","Width","X","Height")}if(l.settings.autoScroll){if(!l._hasScroll){l._hasScroll=true;k();l.on("wheel",function(p){var o=l.getEl("body");o.scrollLeft+=(p.deltaX||0)*10;o.scrollTop+=p.deltaY*10;n()});i.on(l.getEl("body"),"scroll",n)}n()}}}});h("tinymce/ui/Panel",["tinymce/ui/Container","tinymce/ui/Scrollable"],function(j,i){return j.extend({Defaults:{layout:"fit",containerCls:"panel"},Mixins:[i],renderHtml:function(){var l=this,m=l._layout,k=l.settings.html;l.preRender();m.preRender(l);if(typeof k=="undefined"){k=('
    '+m.renderHtml(l)+"
    ")}else{if(typeof k=="function"){k=k.call(l)}l._hasBody=false}return('
    '+(l._preBodyHtml||"")+k+"
    ")}})});h("tinymce/ui/Movable",["tinymce/ui/DomUtils"],function(i){function j(k,s,v){var u,o,r,p,t,m,q,l,n,w;n=i.getViewPort();o=i.getPos(s);r=o.x;p=o.y;if(k._fixed&&i.getRuntimeStyle(document.body,"position")=="static"){r-=n.x;p-=n.y}u=k.getEl();w=i.getSize(u);t=w.width;m=w.height;w=i.getSize(s);q=w.width;l=w.height;v=(v||"").split("");if(v[0]==="b"){p+=l}if(v[1]==="r"){r+=q}if(v[0]==="c"){p+=Math.round(l/2)}if(v[1]==="c"){r+=Math.round(q/2)}if(v[3]==="b"){p-=m}if(v[4]==="r"){r-=t}if(v[3]==="c"){p-=Math.round(m/2)}if(v[4]==="c"){r-=Math.round(t/2)}return{x:r,y:p,w:t,h:m}}return{testMoveRel:function(o,l){var k=i.getViewPort();for(var m=0;m0&&n.x+n.w0&&n.y+n.hk.x&&n.x+n.wk.y&&n.y+n.hq){s=q-r;return s<0?0:s}return s}if(m.settings.constrainToViewport){var n=i.getViewPort(window);var o=m.layoutRect();k=l(k,n.w+n.x,o.w);p=l(p,n.h+n.y,o.h)}if(m._rendered){m.layoutRect({x:k,y:p}).repaint()}else{m.settings.x=k;m.settings.y=p}m.fire("move",{x:k,y:p});return m}}});h("tinymce/ui/Resizable",["tinymce/ui/DomUtils"],function(i){return{resizeToContent:function(){this._layoutRect.autoResize=true;this._lastRect=null;this.reflow()},resizeTo:function(j,k){if(j<=1||k<=1){var l=i.getWindowSize();j=j<=1?j*l.w:j;k=k<=1?k*l.h:k}this._layoutRect.autoResize=false;return this.layoutRect({minW:j,minH:k,w:j,h:k}).reflow()},resizeBy:function(k,m){var j=this,l=j.layoutRect();return j.resizeTo(l.w+k,l.h+m)}}});h("tinymce/ui/FloatPanel",["tinymce/ui/Panel","tinymce/ui/Movable","tinymce/ui/Resizable","tinymce/ui/DomUtils"],function(w,t,k,i){var q,l,j,x=[];var o=[],y;function u(){function z(B,A){while(B){if(B==A){return true}B=B.parent()}}if(!q){q=function(D){if(D.button==2){return}var C=x.length;while(C--){var B=x[C],A=B.getParentCtrl(D.target);if(B.settings.autohide){if(A){if(z(A,B)||B.parent()===A){continue}}D=B.fire("autohide",{target:D.target});if(!D.isDefaultPrevented()){B.hide()}}}};i.on(document,"click",q)}}function n(){if(!l){l=function(){var z;z=x.length;while(z--){p(x[z])}};i.on(window,"scroll",l)}}function m(){if(!j){var A=document.documentElement,B=A.clientWidth,z=A.clientHeight;j=function(){if(!document.all||B!=A.clientWidth||z!=A.clientHeight){B=A.clientWidth;z=A.clientHeight;r.hideAll()}};i.on(window,"resize",j)}}function p(z){var A=i.getViewPort().y;function B(F,C){var E;for(var D=0;DA){z.fixed(false).layoutRect({y:z._autoFixY}).repaint();B(false,z._autoFixY-A)}}}}function v(D,B){var z,E=r.zIndex||65535,A;if(D){o.push(B)}else{z=o.length;while(z--){if(o[z]===B){o.splice(z,1)}}}if(o.length){for(z=0;z
    ');C=C.firstChild;z.getContainerElm().appendChild(C);setTimeout(function(){i.addClass(C,B+"in");i.addClass(z.getEl(),B+"in")},0);y=true}v(true,z)}});z.on("show",function(){z.parents().each(function(B){if(B._fixed){z.fixed(true);return false}})});if(A.popover){z._preBodyHtml='
    ';z.addClass("popover").addClass("bottom").addClass(z.isRtl()?"end":"start")}},fixed:function(B){var A=this;if(A._fixed!=B){if(A._rendered){var z=i.getViewPort();if(B){A.layoutRect().y-=z.y}else{A.layoutRect().y+=z.y}}A.toggleClass("fixed",B);A._fixed=B}return A},show:function(){var z=this,A,B=z._super();A=x.length;while(A--){if(x[A]===z){break}}if(A===-1){x.push(z)}return B},hide:function(){s(this);v(false,this);return this._super()},hideAll:function(){r.hideAll()},close:function(){var z=this;if(!z.fire("close").isDefaultPrevented()){z.remove();v(false,z)}return z},remove:function(){s(this);this._super()},postRender:function(){var z=this;if(z.settings.bodyRole){this.getEl("body").setAttribute("role",z.settings.bodyRole)}return z._super()}});r.hideAll=function(){var A=x.length;while(A--){var z=x[A];if(z&&z.settings.autohide){z.hide();x.splice(A,1)}}};function s(z){var A;A=x.length;while(A--){if(x[A]===z){x.splice(A,1)}}A=o.length;while(A--){if(o[A]===z){o.splice(A,1)}}}return r});h("tinymce/ui/Window",["tinymce/ui/FloatPanel","tinymce/ui/Panel","tinymce/ui/DomUtils","tinymce/ui/DragHelper"],function(m,l,i,k){var j=m.extend({modal:true,Defaults:{border:1,layout:"flex",containerCls:"panel",role:"dialog",callbacks:{submit:function(){this.fire("submit",{data:this.toJSON()})},close:function(){this.close()}}},init:function(o){var n=this;n._super(o);if(n.isRtl()){n.addClass("rtl")}n.addClass("window");n._fixed=true;if(o.buttons){n.statusbar=new l({layout:"flex",border:"1 0 0 0",spacing:3,padding:10,align:"center",pack:n.isRtl()?"start":"end",defaults:{type:"button"},items:o.buttons});n.statusbar.addClass("foot");n.statusbar.parent(n)}n.on("click",function(p){if(p.target.className.indexOf(n.classPrefix+"close")!=-1){n.close()}});n.on("cancel",function(){n.close()});n.aria("describedby",n.describedBy||n._id+"-none");n.aria("label",o.title);n._fullscreen=false},recalc:function(){var o=this,r=o.statusbar,q,p,n,s;if(o._fullscreen){o.layoutRect(i.getWindowSize());o.layoutRect().contentH=o.layoutRect().innerH}o._super();q=o.layoutRect();if(o.settings.title&&!o._fullscreen){p=q.headerW;if(p>q.w){n=q.x-Math.max(0,p/2);o.layoutRect({w:p,x:n});s=true}}if(r){r.layoutRect({w:o.layoutRect().innerW}).recalc();p=r.layoutRect().minW+q.deltaW;if(p>q.w){n=q.x-Math.max(0,p-q.w);o.layoutRect({w:p,x:n});s=true}}if(s){o.recalc()}},initLayoutRect:function(){var n=this,r=n._super(),q=0,s;if(n.settings.title&&!n._fullscreen){s=n.getEl("head");var o=i.getSize(s);r.headerW=o.width;r.headerH=o.height;q+=r.headerH}if(n.statusbar){q+=n.statusbar.layoutRect().h}r.deltaH+=q;r.minH+=q;r.h+=q;var p=i.getWindowSize();r.x=Math.max(0,p.w/2-r.w/2);r.y=Math.max(0,p.h/2-r.h/2);return r},renderHtml:function(){var o=this,r=o._layout,u=o._id,s=o.classPrefix;var q=o.settings,n="",t="",p=q.html;o.preRender();r.preRender(o);if(q.title){n=('
    '+o.encode(q.title)+'
    ')}if(q.url){p=''}if(typeof p=="undefined"){p=r.renderHtml(o)}if(o.statusbar){t=o.statusbar.renderHtml()}return('
    '+n+'
    '+p+"
    "+t+"
    ")},fullscreen:function(t){var n=this,s=document.documentElement,o,r=n.classPrefix,q;if(t!=n._fullscreen){i.on(window,"resize",function(){var v;if(n._fullscreen){if(!o){v=new Date().getTime();var u=i.getWindowSize();n.moveTo(0,0).resizeTo(u.w,u.h);if((new Date().getTime())-v>50){o=true}}else{if(!n._timer){n._timer=setTimeout(function(){var w=i.getWindowSize();n.moveTo(0,0).resizeTo(w.w,w.h);n._timer=0},50)}}}});q=n.layoutRect();n._fullscreen=t;if(!t){n._borderBox=n.parseBox(n.settings.border);n.getEl("head").style.display="";q.deltaH+=q.headerH;i.removeClass(s,r+"fullscreen");i.removeClass(document.body,r+"fullscreen");n.removeClass("fullscreen");n.moveTo(n._initial.x,n._initial.y).resizeTo(n._initial.w,n._initial.h)}else{n._initial={x:q.x,y:q.y,w:q.w,h:q.h};n._borderBox=n.parseBox("0");n.getEl("head").style.display="none";q.deltaH-=q.headerH+2;i.addClass(s,r+"fullscreen");i.addClass(document.body,r+"fullscreen");n.addClass("fullscreen");var p=i.getWindowSize();n.moveTo(0,0).resizeTo(p.w,p.h)}}return n.reflow()},postRender:function(){var n=this,o;setTimeout(function(){n.addClass("in")},0);n._super();if(n.statusbar){n.statusbar.postRender()}n.focus();this.dragHelper=new k(n._id+"-dragh",{start:function(){o={x:n.layoutRect().x,y:n.layoutRect().y}},drag:function(p){n.moveTo(o.x+p.deltaX,o.y+p.deltaY)}});n.on("submit",function(p){if(!p.isDefaultPrevented()){n.close()}})},submit:function(){return this.fire("submit",{data:this.toJSON()})},remove:function(){var n=this,o=n.classPrefix;n.dragHelper.destroy();n._super();if(n.statusbar){this.statusbar.remove()}if(n._fullscreen){i.removeClass(document.documentElement,o+"fullscreen");i.removeClass(document.body,o+"fullscreen")}},getContentWindow:function(){var n=this.getEl().getElementsByTagName("iframe")[0];return n?n.contentWindow:null}});return j});h("tinymce/ui/MessageBox",["tinymce/ui/Window"],function(j){var i=j.extend({init:function(k){k={border:1,padding:20,layout:"flex",pack:"center",align:"center",containerCls:"panel",autoScroll:true,buttons:{type:"button",text:"Ok",action:"ok"},items:{type:"label",multiline:true,maxWidth:500,maxHeight:200}};this._super(k)},Statics:{OK:1,OK_CANCEL:2,YES_NO:3,YES_NO_CANCEL:4,msgBox:function(l){var m,n=l.callback||function(){};function k(q,o,p){return{type:"button",text:q,subtype:p?"primary":"",onClick:function(r){r.control.parents()[1].close();n(o)}}}switch(l.buttons){case i.OK_CANCEL:m=[k("Ok",true,true),k("Cancel",false)];break;case i.YES_NO:case i.YES_NO_CANCEL:m=[k("Yes",1,true),k("No",0)];if(l.buttons==i.YES_NO_CANCEL){m.push(k("Cancel",-1))}break;default:m=[k("Ok",true,true)];break}return new j({padding:20,x:l.x,y:l.y,minWidth:300,minHeight:100,layout:"flex",pack:"center",align:"center",buttons:m,title:l.title,role:"alertdialog",items:{type:"label",multiline:true,maxWidth:500,maxHeight:200,text:l.text},onPostRender:function(){this.aria("describedby",this.items()[0]._id)},onClose:l.onClose,onCancel:function(){n(false)}}).renderTo(document.body).reflow()},alert:function(k,l){if(typeof k=="string"){k={text:k}}k.callback=l;return i.msgBox(k)},confirm:function(k,l){if(typeof k=="string"){k={text:k}}k.callback=l;k.buttons=i.OK_CANCEL;return i.msgBox(k)}}});return i});h("tinymce/WindowManager",["tinymce/ui/Window","tinymce/ui/MessageBox"],function(j,i){return function(m){var l=this,n=[];function k(){if(n.length){return n[n.length-1]}}l.windows=n;m.on("remove",function(){var o=n.length;while(o--){n[o].close()}});l.open=function(o,q){var p;m.editorManager.setActive(m);o.title=o.title||" ";o.url=o.url||o.file;if(o.url){o.width=parseInt(o.width||320,10);o.height=parseInt(o.height||240,10)}if(o.body){o.items={defaults:o.defaults,type:o.bodyType||"form",items:o.body}}if(!o.url&&!o.buttons){o.buttons=[{text:"Ok",subtype:"primary",onclick:function(){p.find("form")[0].submit()}},{text:"Cancel",onclick:function(){p.close()}}]}p=new j(o);n.push(p);p.on("close",function(){var r=n.length;while(r--){if(n[r]===p){n.splice(r,1)}}if(!n.length){m.focus()}});if(o.data){p.on("postRender",function(){this.find("*").each(function(s){var r=s.name();if(r in o.data){s.value(o.data[r])}})})}p.features=o||{};p.params=q||{};if(n.length===1){m.nodeChanged()}return p.renderTo().reflow()};l.alert=function(p,q,o){i.alert(p,function(){if(q){q.call(o||this)}else{m.focus()}})};l.confirm=function(p,q,o){i.confirm(p,function(r){q.call(o||this,r)})};l.close=function(){if(k()){k().close()}};l.getParams=function(){return k()?k().params:null};l.setParams=function(o){if(k()){k().params=o}};l.getWindows=function(){return n}}});h("tinymce/util/Quirks",["tinymce/util/VK","tinymce/dom/RangeUtils","tinymce/dom/TreeWalker","tinymce/html/Node","tinymce/html/Entities","tinymce/Env","tinymce/util/Tools"],function(n,m,l,k,o,i,j){return function(p){var aj=j.each,W=p.$;var s=n.BACKSPACE,E=n.DELETE,r=p.dom,G=p.selection,an=p.settings,V=p.parser,L=p.serializer;var u=i.gecko,C=i.ie,ag=i.webkit;var ab="data:text/mce-internal,";var t=C?"Text":"URL";function aa(au,at){try{p.getDoc().execCommand(au,false,at)}catch(ar){}}function J(){var ar=p.getDoc().documentMode;return ar?ar:6}function Z(ar){return ar.isDefaultPrevented()}function Q(at){var ar;if(at.dataTransfer){if(p.selection.isCollapsed()&&at.target.tagName=="IMG"){G.select(at.target)}ar=p.selection.getContent();if(ar.length>0){at.dataTransfer.setData(t,ab+escape(ar))}}}function K(at){var au,ar;if(at.dataTransfer){au=at.dataTransfer.getData(t);if(au&&au.indexOf(ab)>=0){ar=unescape(au.substr(ab.length))}}return ar}function R(ar){if(p.queryCommandSupported("mceInsertClipboardContent")){p.execCommand("mceInsertClipboardContent",false,{content:ar})}else{p.execCommand("mceInsertContent",false,ar)}}function ap(){var aD=p.getDoc(),ax=p.dom,aE=p.selection;var at=window.MutationObserver,ay,aC;if(!at){ay=true;at=function(){var aF=[],aI;function aH(aK){var aJ=aK.relatedNode||aK.target;aF.push({target:aJ,addedNodes:[aJ]})}function aG(aK){var aJ=aK.relatedNode||aK.target;aF.push({target:aJ,attributeName:aK.attrName})}this.observe=function(aJ){aI=aJ;aI.addEventListener("DOMSubtreeModified",aH,false);aI.addEventListener("DOMNodeInsertedIntoDocument",aH,false);aI.addEventListener("DOMNodeInserted",aH,false);aI.addEventListener("DOMAttrModified",aG,false)};this.disconnect=function(){aI.removeEventListener("DOMSubtreeModified",aH,false);aI.removeEventListener("DOMNodeInsertedIntoDocument",aH,false);aI.removeEventListener("DOMNodeInserted",aH,false);aI.removeEventListener("DOMAttrModified",aG,false)};this.takeRecords=function(){return aF}}}function ar(aH){var aG=ax.schema.getBlockElements(),aF=p.getBody();if(aH.nodeName!="BR"){return false}for(aH=aH;aH!=aF&&!aG[aH.nodeName];aH=aH.parentNode){if(aH.nextSibling){return false}}return true}function au(aG,aF){var aH;for(aH=aG.nextSibling;aH&&aH!=aF;aH=aH.nextSibling){if(aH.nodeType==3&&W.trim(aH.data).length===0){continue}if(aH!==aF){return false}}return aH===aF}function az(aI,aH,aG){var aK,aJ,aF;aF=ax.schema.getNonEmptyElements();aK=new l(aG||aI,aI);while((aJ=aK[aH?"next":"prev"]())){if(aF[aJ.nodeName]&&!ar(aJ)){return aJ}if(aJ.nodeType==3&&aJ.data.length>0){return aJ}}}function aB(aG){var aJ,aH,aF,aI,aK;if(aG.collapsed){return}aJ=ax.getParent(m.getNode(aG.startContainer,aG.startOffset),ax.isBlock);aH=ax.getParent(m.getNode(aG.endContainer,aG.endOffset),ax.isBlock);aK=p.schema.getTextBlockElements();if(aJ==aH){return}if(!aK[aJ.nodeName]||!aK[aH.nodeName]){return}if(ax.getContentEditable(aJ)==="false"||ax.getContentEditable(aH)==="false"){return}aG.deleteContents();aF=az(aJ,false);aI=az(aH,true);if(!ax.isEmpty(aH)){W(aJ).append(aH.childNodes)}W(aH).remove();if(aF){if(aF.nodeType==1){if(aF.nodeName=="BR"){aG.setStartBefore(aF);aG.setEndBefore(aF)}else{aG.setStartAfter(aF);aG.setEndAfter(aF)}}else{aG.setStart(aF,aF.data.length);aG.setEnd(aF,aF.data.length)}}else{if(aI){if(aI.nodeType==1){aG.setStartBefore(aI);aG.setEndBefore(aI)}else{aG.setStart(aI,0);aG.setEnd(aI,0)}}}aE.setRng(aG);return true}function aw(aG,aL){var aI,aK,aH,aJ,aF,aM;if(!aG.collapsed){return aG}aF=aG.startContainer;aM=aG.startOffset;if(aF.nodeType==3){if(aL){if(aM0){return aG}}}aI=m.getNode(aG.startContainer,aG.startOffset);aH=ax.getParent(aI,ax.isBlock);aK=az(p.getBody(),aL,aI);aJ=ax.getParent(aK,ax.isBlock);if(!aI||!aK){return aG}if(aJ&&aH!=aJ){if(!aL){if(!au(aJ,aH)){return aG}if(aK.nodeType==1){if(aK.nodeName=="BR"){aG.setStartBefore(aK)}else{aG.setStartAfter(aK)}}else{aG.setStart(aK,aK.data.length)}if(aI.nodeType==1){aG.setEnd(aI,0)}else{aG.setEndBefore(aI)}}else{if(!au(aH,aJ)){return aG}if(aI.nodeType==1){if(aI.nodeName=="BR"){aG.setStartBefore(aI)}else{aG.setStartAfter(aI)}}else{aG.setStart(aI,aI.data.length)}if(aK.nodeType==1){aG.setEnd(aK,0)}else{aG.setEndBefore(aK)}}}return aG}function av(aG){var aF=aE.getRng();aF=aw(aF,aG);if(aB(aF)){return true}}function aA(aH){var aG,aF,aI;if(av(aH)){return}j.each(p.getBody().getElementsByTagName("*"),function(aJ){if(aJ.tagName=="SPAN"){aJ.setAttribute("mce-data-marked",1)}if(!aJ.hasAttribute("data-mce-style")&&aJ.hasAttribute("style")){p.dom.setAttrib(aJ,"style",p.dom.getAttrib(aJ,"style"))}});aG=new at(function(){});aG.observe(p.getDoc(),{childList:true,attributes:true,subtree:true,attributeFilter:["style"]});p.getDoc().execCommand(aH?"ForwardDelete":"Delete",false,null);aF=p.selection.getRng();aI=aF.startContainer.parentNode;j.each(aG.takeRecords(),function(aJ){if(!ax.isChildOf(aJ.target,p.getBody())){return}if(aJ.attributeName=="style"){var aK=aJ.target.getAttribute("data-mce-style");if(aK){aJ.target.setAttribute("style",aK)}else{aJ.target.removeAttribute("style")}}j.each(aJ.addedNodes,function(aM){if(aM.nodeName=="SPAN"&&!aM.getAttribute("mce-data-marked")){var aN,aL;if(aM==aI){aN=aF.startOffset;aL=aM.firstChild}ax.remove(aM,true);if(aL){aF.setStart(aL,aN);aF.setEnd(aL,aN);p.selection.setRng(aF)}}})});aG.disconnect();j.each(p.dom.select("span[mce-data-marked]"),function(aJ){aJ.removeAttribute("mce-data-marked")})}p.on("keydown",function(aJ){var aI=aJ.keyCode==E,aF=aJ.ctrlKey||aJ.metaKey;if(!Z(aJ)&&(aI||aJ.keyCode==s)){var aH=p.selection.getRng(),aG=aH.startContainer,aK=aH.startOffset;if(!aF&&aH.collapsed&&aG.nodeType==3){if(aI?aK0){return}}aJ.preventDefault();if(aF){p.selection.getSel().modify("extend",aI?"forward":"backward",aJ.metaKey?"lineboundary":"word")}aA(aI)}});p.on("keypress",function(aK){if(!Z(aK)&&!aE.isCollapsed()&&aK.charCode&&!n.metaKeyPressed(aK)){var aF,aL,aJ,aG,aH,aI;aF=p.selection.getRng();aI=String.fromCharCode(aK.charCode);aK.preventDefault();aL=W(aF.startContainer).parents().filter(function(aM,aN){return !!p.schema.getTextInlineElements()[aN.nodeName]});aA(true);aL=aL.filter(function(aM,aN){return !W.contains(p.getBody(),aN)});if(aL.length){aJ=ax.createFragment();aL.each(function(aM,aN){aN=aN.cloneNode(false);if(aJ.hasChildNodes()){aN.appendChild(aJ.firstChild);aJ.appendChild(aN)}else{aH=aN;aJ.appendChild(aN)}aJ.appendChild(aN)});aH.appendChild(p.getDoc().createTextNode(aI));aG=ax.getParent(aF.startContainer,ax.isBlock);if(ax.isEmpty(aG)){W(aG).empty().append(aJ)}else{aF.insertNode(aJ)}aF.setStart(aH.firstChild,1);aF.setEnd(aH.firstChild,1);p.selection.setRng(aF)}else{p.selection.setContent(aI)}}});p.addCommand("Delete",function(){aA()});p.addCommand("ForwardDelete",function(){aA(true)});if(ay){return}p.on("dragstart",function(aF){aC=aE.getRng();Q(aF)});p.on("drop",function(aF){if(!Z(aF)){var aG=K(aF);if(aG){aF.preventDefault();window.setTimeout(function(){var aH=m.getCaretRangeFromPoint(aF.x,aF.y,aD);if(aC){aE.setRng(aC);aC=null}aA();aE.setRng(aH);R(aG)},0)}}});p.on("cut",function(aF){if(!Z(aF)&&aF.clipboardData){aF.preventDefault();aF.clipboardData.clearData();aF.clipboardData.setData("text/html",p.selection.getContent());aF.clipboardData.setData("text/plain",p.selection.getContent({format:"text"}));aA(true)}})}function P(){function ar(av){var au=r.create("body");var aw=av.cloneContents();au.appendChild(aw);return G.serializer.serialize(au,{format:"html"})}function at(au){if(!au.setStart){if(au.item){return false}var ay=au.duplicate();ay.moveToElementText(p.getBody());return m.compareRanges(au,ay)}var aw=ar(au);var ax=r.createRng();ax.selectNode(p.getBody());var av=ar(ax);return aw===av}p.on("keydown",function(ax){var aw=ax.keyCode,av,au;if(!Z(ax)&&(aw==E||aw==s)){av=p.selection.isCollapsed();au=p.getBody();if(av&&!r.isEmpty(au)){return}if(!av&&!at(p.selection.getRng())){return}ax.preventDefault();p.setContent("");if(au.firstChild&&r.isBlock(au.firstChild)){p.selection.setCursorLocation(au.firstChild,0)}else{p.selection.setCursorLocation(au,0)}p.nodeChanged()}})}function ao(){p.shortcuts.add("meta+a",null,"SelectAll")}function aq(){if(!p.settings.content_editable){r.bind(p.getDoc(),"focusin",function(){G.setRng(G.getRng())});r.bind(p.getDoc(),"mousedown mouseup",function(ar){if(ar.target==p.getDoc().documentElement){p.getBody().focus();if(ar.type=="mousedown"){G.placeCaretAt(ar.clientX,ar.clientY)}else{G.setRng(G.getRng())}}})}}function ad(){p.on("keydown",function(au){if(!Z(au)&&au.keyCode===s){if(!p.getBody().getElementsByTagName("hr").length){return}if(G.isCollapsed()&&G.getRng(true).startOffset===0){var at=G.getNode();var ar=at.previousSibling;if(at.nodeName=="HR"){r.remove(at);au.preventDefault();return}if(ar&&ar.nodeName&&ar.nodeName.toLowerCase()==="hr"){r.remove(ar);au.preventDefault()}}}})}function Y(){if(!window.Range.prototype.getClientRects){p.on("mousedown",function(at){if(!Z(at)&&at.target.nodeName==="HTML"){var ar=p.getBody();ar.blur();setTimeout(function(){ar.focus()},0)}})}}function x(){p.on("click",function(at){var ar=at.target;if(/^(IMG|HR)$/.test(ar.nodeName)){at.preventDefault();G.getSel().setBaseAndExtent(ar,0,ar,1);p.nodeChanged()}if(ar.nodeName=="A"&&r.hasClass(ar,"mce-item-anchor")){at.preventDefault();G.select(ar)}})}function ak(){function at(){var au=r.getAttribs(G.getStart().cloneNode(false));return function(){var av=G.getStart();if(av!==p.getBody()){r.setAttrib(av,"style",null);aj(au,function(aw){av.setAttributeNode(aw.cloneNode(true))})}}}function ar(){return !G.isCollapsed()&&r.getParent(G.getStart(),r.isBlock)!=r.getParent(G.getEnd(),r.isBlock)}p.on("keypress",function(av){var au;if(!Z(av)&&(av.keyCode==8||av.keyCode==46)&&ar()){au=at();p.getDoc().execCommand("delete",false,null);au();av.preventDefault();return false}});r.bind(p.getDoc(),"cut",function(av){var au;if(!Z(av)&&ar()){au=at();setTimeout(function(){au()},0)}})}function X(){document.body.setAttribute("role","application")}function U(){p.on("keydown",function(at){if(!Z(at)&&at.keyCode===s){if(G.isCollapsed()&&G.getRng(true).startOffset===0){var ar=G.getNode().previousSibling;if(ar&&ar.nodeName&&ar.nodeName.toLowerCase()==="table"){at.preventDefault();return false}}}})}function ah(){if(J()>7){return}aa("RespectVisibilityInDesign",true);p.contentStyles.push(".mceHideBrInPre pre br {display: none}");r.addClass(p.getBody(),"mceHideBrInPre");V.addNodeFilter("pre",function(ar){var au=ar.length,aw,at,ax,av;while(au--){aw=ar[au].getAll("br");at=aw.length;while(at--){ax=aw[at];av=ax.prev;if(av&&av.type===3&&av.value.charAt(av.value-1)!="\n"){av.value+="\n"}else{ax.parent.insert(new k("#text",3),ax,true).value="\n"}}}});L.addNodeFilter("pre",function(ar){var au=ar.length,aw,at,ax,av;while(au--){aw=ar[au].getAll("br");at=aw.length;while(at--){ax=aw[at];av=ax.prev;if(av&&av.type==3){av.value=av.value.replace(/\r?\n$/,"")}}}})}function w(){r.bind(p.getBody(),"mouseup",function(){var at,ar=G.getNode();if(ar.nodeName=="IMG"){if((at=r.getStyle(ar,"width"))){r.setAttrib(ar,"width",at.replace(/[^0-9%]+/g,""));r.setStyle(ar,"width","")}if((at=r.getStyle(ar,"height"))){r.setAttrib(ar,"height",at.replace(/[^0-9%]+/g,""));r.setStyle(ar,"height","")}}})}function am(){p.on("keydown",function(aw){var au,at,ax,ar,av;if(Z(aw)||aw.keyCode!=n.BACKSPACE){return}au=G.getRng();at=au.startContainer;ax=au.startOffset;ar=r.getRoot();av=at;if(!au.collapsed||ax!==0){return}while(av&&av.parentNode&&av.parentNode.firstChild==av&&av.parentNode!=ar){av=av.parentNode}if(av.tagName==="BLOCKQUOTE"){p.formatter.toggle("blockquote",null,av);au=r.createRng();au.setStart(at,0);au.setEnd(at,0);G.setRng(au)}})}function al(){function ar(){p._refreshContentEditable();aa("StyleWithCSS",false);aa("enableInlineTableEditing",false);if(!an.object_resizing){aa("enableObjectResizing",false)}}if(!an.readonly){p.on("BeforeExecCommand MouseDown",ar)}}function T(){function ar(){aj(r.select("a"),function(av){var at=av.parentNode,au=r.getRoot();if(at.lastChild===av){while(at&&!r.isBlock(at)){if(at.parentNode.lastChild!==at||at===au){return}at=at.parentNode}r.add(at,"br",{"data-mce-bogus":1})}})}p.on("SetContent ExecCommand",function(at){if(at.type=="setcontent"||at.command==="mceInsertLink"){ar()}})}function H(){if(an.forced_root_block){p.on("init",function(){aa("DefaultParagraphSeparator",an.forced_root_block)})}}function N(){p.on("Undo Redo SetContent",function(ar){if(!ar.initial){p.execCommand("mceRepaint")}})}function y(){p.on("keydown",function(at){var ar;if(!Z(at)&&at.keyCode==s){ar=p.getDoc().selection.createRange();if(ar&&ar.item){at.preventDefault();p.undoManager.beforeChange();r.remove(ar.item(0));p.undoManager.add()}}})}function S(){var ar;if(J()>=10){ar="";aj("p div h1 h2 h3 h4 h5 h6".split(" "),function(at,au){ar+=(au>0?",":"")+at+":empty"});p.contentStyles.push(ar+"{padding-right: 1px !important}")}}function ai(){if(J()<9){V.addNodeFilter("noscript",function(ar){var at=ar.length,au,av;while(at--){au=ar[at];av=au.firstChild;if(av){au.attr("data-mce-innertext",av.value)}}});L.addNodeFilter("noscript",function(ar){var at=ar.length,au,aw,av;while(at--){au=ar[at];aw=ar[at].firstChild;if(aw){aw.value=o.decode(aw.value)}else{av=au.attributes.map["data-mce-innertext"];if(av){au.attr("data-mce-innertext",null);aw=new k("#text",3);aw.value=av;aw.raw=true;au.append(aw)}}}})}}function O(){var ay=r.doc,at=ay.body,av,aw,az;function ax(aA,aD){var aB=at.createTextRange();try{aB.moveToPoint(aA,aD)}catch(aC){aB=null}return aB}function au(aB){var aA;if(aB.button){aA=ax(aB.x,aB.y);if(aA){if(aA.compareEndPoints("StartToStart",aw)>0){aA.setEndPoint("StartToStart",aw)}else{aA.setEndPoint("EndToEnd",aw)}aA.select()}}else{ar()}}function ar(){var aA=ay.selection.createRange();if(aw&&!aA.item&&aA.compareEndPoints("StartToEnd",aA)===0){aw.select()}r.unbind(ay,"mouseup",ar);r.unbind(ay,"mousemove",au);aw=av=0}ay.documentElement.unselectable=true;r.bind(ay,"mousedown contextmenu",function(aA){if(aA.target.nodeName==="HTML"){if(av){ar()}az=ay.documentElement;if(az.scrollHeight>az.clientHeight){return}av=1;aw=ax(aA.x,aA.y);if(aw){r.bind(ay,"mouseup",ar);r.bind(ay,"mousemove",au);r.getRoot().focus();aw.select()}}})}function af(){p.on("keyup focusin mouseup",function(ar){if(ar.keyCode!=65||!n.metaKeyPressed(ar)){G.normalize()}},true)}function A(){p.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")}function B(){if(!p.inline){p.on("keydown",function(){if(document.activeElement==document.body){p.getWin().focus()}})}}function F(){if(!p.inline){p.contentStyles.push("body {min-height: 150px}");p.on("click",function(at){if(at.target.nodeName=="HTML"){var ar;ar=p.selection.getRng();p.getBody().focus();p.selection.setRng(ar);p.selection.normalize();p.nodeChanged()}})}}function D(){if(i.mac){p.on("keydown",function(ar){if(n.metaKeyPressed(ar)&&(ar.keyCode==37||ar.keyCode==39)){ar.preventDefault();p.selection.getSel().modify("move",ar.keyCode==37?"backward":"forward","lineboundary")}})}}function ac(){aa("AutoUrlDetect",false)}function I(){if(!p.inline){p.on("focus blur beforegetcontent",function(){var ar=p.dom.create("br");p.getBody().appendChild(ar);ar.parentNode.removeChild(ar)},true)}}function z(){p.on("click",function(ar){var at=ar.target;do{if(at.tagName==="A"){ar.preventDefault();return}}while((at=at.parentNode))});p.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")}function q(){p.on("touchstart",function(av){var aw,au,at,ar;aw=av.target;au=new Date().getTime();ar=av.changedTouches;if(!ar||ar.length>1){return}at=ar[0];p.once("touchend",function(az){var ay=az.changedTouches[0],ax;if(new Date().getTime()-au>500){return}if(Math.abs(at.clientX-ay.clientX)>5){return}if(Math.abs(at.clientY-ay.clientY)>5){return}ax={target:aw};aj("pageX pageY clientX clientY screenX screenY".split(" "),function(aA){ax[aA]=ay[aA]});ax=p.fire("click",ax);if(!ax.isDefaultPrevented()){p.selection.placeCaretAt(ay.clientX,ay.clientY);p.nodeChanged()}})})}function M(){p.on("init",function(){p.dom.bind(p.getBody(),"submit",function(ar){ar.preventDefault()})})}function ae(){V.addNodeFilter("br",function(ar){var at=ar.length;while(at--){if(ar[at].attr("class")=="Apple-interchange-newline"){ar[at].remove()}}})}function v(){p.on("dragstart",function(ar){Q(ar)});p.on("drop",function(at){if(!Z(at)){var au=K(at);if(au){at.preventDefault();var ar=m.getCaretRangeFromPoint(at.x,at.y,p.getDoc());G.setRng(ar);R(au)}}})}am();P();af();if(ag){ap();aq();x();H();M();U();ae();q();if(i.iOS){B();F();z()}else{ao()}}if(C&&i.ie<11){ad();X();ah();w();y();S();ai();O()}if(i.ie>=11){F();I();U()}if(i.ie){ao();ac();v()}if(u){ad();Y();ak();al();T();N();A();D();U()}}});h("tinymce/util/Observable",["tinymce/util/EventDispatcher"],function(j){function i(k){if(!k._eventDispatcher){k._eventDispatcher=new j({scope:k,toggleEvent:function(l,m){if(j.isNative(l)&&k.toggleNativeEvent){k.toggleNativeEvent(l,m)}}})}return k._eventDispatcher}return{fire:function(n,m,k){var l=this;if(l.removed&&n!=="remove"){return m}m=i(l).fire(n,m,k);if(k!==false&&l.parent){var o=l.parent();while(o&&!m.isPropagationStopped()){o.fire(n,m,false);o=o.parent()}}return m},on:function(l,m,k){return i(this).on(l,m,k)},off:function(k,l){return i(this).off(k,l)},once:function(k,l){return i(this).once(k,l)},hasEventListeners:function(k){return i(this).has(k)}}});h("tinymce/EditorObservable",["tinymce/util/Observable","tinymce/dom/DOMUtils","tinymce/util/Tools"],function(i,n,k){var l=n.DOM,j;function o(r,q){if(q=="selectionchange"){return r.getDoc()}if(!r.inline&&/^mouse|click|contextmenu|drop|dragover|dragend/.test(q)){return r.getDoc().documentElement}if(r.settings.event_root){if(!r.eventRoot){r.eventRoot=l.select(r.settings.event_root)[0]}return r.eventRoot}return r.getBody()}function m(s,q){var t=o(s,q),r;if(!s.delegates){s.delegates={}}if(s.delegates[q]){return}if(s.settings.event_root){if(!j){j={};s.editorManager.on("removeEditor",function(){var u;if(!s.editorManager.activeEditor){if(j){for(u in j){s.dom.unbind(o(s,u))}j=null}}})}if(j[q]){return}r=function(y){var x=y.target,w=s.editorManager.editors,v=w.length;while(v--){var u=w[v].getBody();if(u===x||l.isChildOf(x,u)){if(!w[v].hidden){w[v].fire(q,y)}}}};j[q]=r;l.bind(t,q,r)}else{r=function(u){if(!s.hidden){s.fire(q,u)}};l.bind(t,q,r);s.delegates[q]=r}}var p={bindPendingEventDelegates:function(){var q=this;k.each(q._pendingNativeEvents,function(r){m(q,r)})},toggleNativeEvent:function(r,s){var q=this;if(q.settings.readonly){return}if(r=="focus"||r=="blur"){return}if(s){if(q.initialized){m(q,r)}else{if(!q._pendingNativeEvents){q._pendingNativeEvents=[r]}else{q._pendingNativeEvents.push(r)}}}else{if(q.initialized){q.dom.unbind(o(q,r),r,q.delegates[r]);delete q.delegates[r]}}},unbindAllNativeEvents:function(){var q=this,r;if(q.delegates){for(r in q.delegates){q.dom.unbind(o(q,r),r,q.delegates[r])}delete q.delegates}if(!q.inline){q.getBody().onload=null;q.dom.unbind(q.getWin());q.dom.unbind(q.getDoc())}q.dom.unbind(q.getBody());q.dom.unbind(q.getContainer())}};p=k.extend({},i,p);return p});h("tinymce/Shortcuts",["tinymce/util/Tools","tinymce/Env"],function(k,j){var n=k.each,m=k.explode;var i={f9:120,f10:121,f11:122};var l=k.makeMap("alt,ctrl,shift,meta,access");return function(r){var q=this,o={};function p(w,x,v,u){var y,t,s;s={func:v,scope:u||r,desc:r.translate(x)};n(m(w,"+"),function(z){if(z in l){s[z]=true}else{if(/^[0-9]{2,}$/.test(z)){s.keyCode=parseInt(z,10)}else{s.charCode=z.charCodeAt(0);s.keyCode=i[z]||z.toUpperCase().charCodeAt(0)}}});y=[s.keyCode];for(t in l){if(s[t]){y.push(t)}else{s[t]=false}}s.id=y.join(",");if(s.access){s.alt=true;if(j.mac){s.ctrl=true}else{s.shift=true}}if(s.meta){if(j.mac){s.meta=true}else{s.ctrl=true;s.meta=false}}return s}r.on("keyup keypress keydown",function(s){if((s.altKey||s.ctrlKey||s.metaKey)&&!s.isDefaultPrevented()){n(o,function(t){if(t.ctrl!=s.ctrlKey||t.meta!=s.metaKey){return}if(t.alt!=s.altKey||t.shift!=s.shiftKey){return}if(s.keyCode==t.keyCode||(s.charCode&&s.charCode==t.charCode)){s.preventDefault();if(s.type=="keydown"){t.func.call(t.scope)}return true}})}});q.add=function(v,w,t,s){var u;u=t;if(typeof t==="string"){t=function(){r.execCommand(u,false,null)}}else{if(k.isArray(u)){t=function(){r.execCommand(u[0],u[1],u[2])}}}n(m(v.toLowerCase()),function(y){var x=p(y,w,t,s);o[x.id]=x});return true};q.remove=function(t){var s=p(t);if(o[s.id]){delete o[s.id];return true}return false}}});h("tinymce/Editor",["tinymce/dom/DOMUtils","tinymce/dom/DomQuery","tinymce/AddOnManager","tinymce/NodeChange","tinymce/html/Node","tinymce/dom/Serializer","tinymce/html/Serializer","tinymce/dom/Selection","tinymce/Formatter","tinymce/UndoManager","tinymce/EnterKey","tinymce/ForceBlocks","tinymce/EditorCommands","tinymce/util/URI","tinymce/dom/ScriptLoader","tinymce/dom/EventUtils","tinymce/WindowManager","tinymce/html/Schema","tinymce/html/DomParser","tinymce/util/Quirks","tinymce/Env","tinymce/util/Tools","tinymce/EditorObservable","tinymce/Shortcuts"],function(S,A,C,m,x,K,I,E,y,n,J,G,v,D,s,t,M,o,j,B,N,q,k,P){var z=S.DOM,O=C.ThemeManager,R=C.PluginManager;var p=q.extend,L=q.each,r=q.explode;var Q=q.inArray,i=q.trim,u=q.resolve;var H=t.Event;var l=N.gecko,F=N.ie;function w(Y,V,X){var U=this,T,W;T=U.documentBaseUrl=X.documentBaseURL;W=X.baseURI;U.settings=V=p({id:Y,theme:"modern",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:T,add_form_submit_trigger:true,submit_patch:true,add_unload_trigger:true,convert_urls:true,relative_urls:true,remove_script_host:true,object_resizing:true,doctype:"",visual:true,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",forced_root_block:"p",hidden_input:true,padd_empty_editor:true,render_ui:true,indentation:"30px",inline_styles:true,convert_fonts_to_spans:true,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",validate:true,entity_encoding:"named",url_converter:U.convertURL,url_converter_scope:U,ie7_compat:true},V);C.language=V.language||"en";C.languageLoad=V.language_load;C.baseURL=X.baseURL;U.id=V.id=Y;U.isNotDirty=true;U.plugins={};U.documentBaseURI=new D(V.document_base_url||T,{base_uri:W});U.baseURI=W;U.contentCSS=[];U.contentStyles=[];U.shortcuts=new P(U);U.loadedCSS={};U.editorCommands=new v(U);if(V.target){U.targetElm=V.target}U.suffix=X.suffix;U.editorManager=X;U.inline=V.inline;if(V.cache_suffix){N.cacheSuffix=V.cache_suffix.replace(/^[\?\&]+/,"")}X.fire("SetupEditor",U);U.execCallback("setup",U);U.$=A.overrideDefaults(function(){return{context:U.inline?U.getBody():U.getDoc(),element:U.getBody()}})}w.prototype={render:function(){var T=this,W=T.settings,Z=T.id,Y=T.suffix;function V(){z.unbind(window,"ready",V);T.render()}if(!H.domLoaded){z.bind(window,"ready",V);return}if(!T.getElement()){return}if(!N.contentEditable){return}if(!W.inline){T.orgVisibility=T.getElement().style.visibility;T.getElement().style.visibility="hidden"}else{T.inline=true}var X=T.getElement().form||z.getParent(Z,"form");if(X){T.formElement=X;if(W.hidden_input&&!/TEXTAREA|INPUT/i.test(T.getElement().nodeName)){z.insertAfter(z.create("input",{type:"hidden",name:Z}),Z);T.hasHiddenInput=true}T.formEventDelegate=function(aa){T.fire(aa.type,aa)};z.bind(X,"submit reset",T.formEventDelegate);T.on("reset",function(){T.setContent(T.startContent,{format:"raw"})});if(W.submit_patch&&!X.submit.nodeType&&!X.submit.length&&!X._mceOldSubmit){X._mceOldSubmit=X.submit;X.submit=function(){T.editorManager.triggerSave();T.isNotDirty=true;return X._mceOldSubmit(X)}}}T.windowManager=new M(T);if(W.encoding=="xml"){T.on("GetContent",function(aa){if(aa.save){aa.content=z.encode(aa.content)}})}if(W.add_form_submit_trigger){T.on("submit",function(){if(T.initialized){T.save()}})}if(W.add_unload_trigger){T._beforeUnload=function(){if(T.initialized&&!T.destroyed&&!T.isHidden()){T.save({format:"raw",no_events:true,set_dirty:false})}};T.editorManager.on("BeforeUnload",T._beforeUnload)}function U(){var ab=s.ScriptLoader;if(W.language&&W.language!="en"&&!W.language_url){W.language_url=T.editorManager.baseURL+"/langs/"+W.language+".js"}if(W.language_url){ab.add(W.language_url)}if(W.theme&&typeof W.theme!="function"&&W.theme.charAt(0)!="-"&&!O.urls[W.theme]){var aa=W.theme_url;if(aa){aa=T.documentBaseURI.toAbsolute(aa)}else{aa="themes/"+W.theme+"/theme"+Y+".js"}O.load(W.theme,aa)}if(q.isArray(W.plugins)){W.plugins=W.plugins.join(" ")}L(W.external_plugins,function(ad,ac){R.load(ac,ad);W.plugins+=" "+ac});L(W.plugins.split(/[ ,]/),function(ac){ac=i(ac);if(ac&&!R.urls[ac]){if(ac.charAt(0)=="-"){ac=ac.substr(1,ac.length);var ad=R.dependencies(ac);L(ad,function(af){var ae={prefix:"plugins/",resource:af,suffix:"/plugin"+Y+".js"};af=R.createUrl(ae,af);R.load(af.resource,af)})}else{R.load(ac,{prefix:"plugins/",resource:ac,suffix:"/plugin"+Y+".js"})}}});ab.loadQueue(function(){if(!T.removed){T.init()}})}U()},init:function(){var ab=this,ak=ab.settings,X=ab.getElement();var Z,ai,W,ae,ac,T,U,am,ah,ad,ag,V=[];this.editorManager.i18n.setCode(ak.language);ab.rtl=this.editorManager.i18n.rtl;ab.editorManager.add(ab);ak.aria_label=ak.aria_label||z.getAttrib(X,"aria-label",ab.getLang("aria.rich_text_area"));if(ak.theme){if(typeof ak.theme!="function"){ak.theme=ak.theme.replace(/-/,"");T=O.get(ak.theme);ab.theme=new T(ab,O.urls[ak.theme]);if(ab.theme.init){ab.theme.init(ab,O.urls[ak.theme]||ab.documentBaseUrl.replace(/\/$/,""),ab.$)}}else{ab.theme=ak.theme}}function al(aq){var ap=R.get(aq),ao,an;ao=R.urls[aq]||ab.documentBaseUrl.replace(/\/$/,"");aq=i(aq);if(ap&&Q(V,aq)===-1){L(R.dependencies(aq),function(ar){al(ar)});an=new ap(ab,ao,ab.$);ab.plugins[aq]=an;if(an.init){an.init(ab,ao);V.push(aq)}}}L(ak.plugins.replace(/\-/g,"").split(/[ ,]/),al);if(ak.render_ui&&ab.theme){ab.orgDisplay=X.style.display;if(typeof ak.theme!="function"){Z=ak.width||X.style.width||X.offsetWidth;ai=ak.height||X.style.height||X.offsetHeight;W=ak.min_height||100;ad=/^[0-9\.]+(|px)$/i;if(ad.test(""+Z)){Z=Math.max(parseInt(Z,10),100)}if(ad.test(""+ai)){ai=Math.max(parseInt(ai,10),W)}ac=ab.theme.renderUI({targetNode:X,width:Z,height:ai,deltaWidth:ak.delta_width,deltaHeight:ak.delta_height});if(!ak.content_editable){ai=(ac.iframeHeight||ai)+(typeof ai=="number"?(ac.deltaHeight||0):"");if(ai";if(ak.document_base_url!=ab.documentBaseUrl){ab.iframeHTML+=''}if(!N.caretAfter&&ak.ie7_compat){ab.iframeHTML+=''}ab.iframeHTML+='';for(ag=0;ag');ab.loadedCSS[af]=true}am=ak.body_id||"tinymce";if(am.indexOf("=")!=-1){am=ab.getParam("body_id","","hash");am=am[ab.id]||am}ah=ak.body_class||"";if(ah.indexOf("=")!=-1){ah=ab.getParam("body_class","","hash");ah=ah[ab.id]||""}if(ak.content_security_policy){ab.iframeHTML+=''}ab.iframeHTML+='
    ';var aa='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinymce.get("'+ab.id+'");document.write(ed.iframeHTML);document.close();ed.initContentBody(true);})()';if(document.domain!=location.hostname){U=aa}var Y=z.create("iframe",{id:ab.id+"_ifr",frameBorder:"0",allowTransparency:"true",title:ab.editorManager.translate("Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help"),style:{width:"100%",height:ai,display:"block"}});Y.onload=function(){Y.onload=null;ab.fire("load")};z.setAttrib(Y,"src",U||'javascript:""');ab.contentAreaContainer=ac.iframeContainer;ab.iframeElement=Y;ae=z.add(ac.iframeContainer,Y);if(F){try{ab.getDoc()}catch(aj){ae.src=U=aa}}if(ac.editorContainer){z.get(ac.editorContainer).style.display=ab.orgDisplay;ab.hidden=z.isHidden(ac.editorContainer)}ab.getElement().style.display="none";z.setAttrib(ab.id,"aria-hidden",true);if(!U){ab.initContentBody()}X=ae=ac=null},initContentBody:function(U){var V=this,W=V.settings,X=V.getElement(),Y=V.getDoc(),T,Z;if(!W.inline){V.getElement().style.visibility=V.orgVisibility}if(!U&&!W.content_editable){Y.open();Y.write(V.iframeHTML);Y.close()}if(W.content_editable){V.on("remove",function(){var aa=this.getBody();z.removeClass(aa,"mce-content-body");z.removeClass(aa,"mce-edit-focus");z.setAttrib(aa,"contentEditable",null)});z.addClass(X,"mce-content-body");V.contentDocument=Y=W.content_document||document;V.contentWindow=W.content_window||window;V.bodyElement=X;W.content_document=W.content_window=null;W.root_name=X.nodeName.toLowerCase()}T=V.getBody();T.disabled=true;if(!W.readonly){if(V.inline&&z.getStyle(T,"position",true)=="static"){T.style.position="relative"}T.contentEditable=V.getParam("content_editable_state",true)}T.disabled=false;V.schema=new o(W);V.dom=new S(Y,{keep_values:true,url_converter:V.convertURL,url_converter_scope:V,hex_colors:W.force_hex_style_colors,class_filter:W.class_filter,update_styles:true,root_element:V.inline?V.getBody():null,collect:W.content_editable,schema:V.schema,onSetAttrib:function(aa){V.fire("SetAttrib",aa)}});V.parser=new j(W,V.schema);V.parser.addAttributeFilter("src,href,style,tabindex",function(aa,ab){var ac=aa.length,ae,ag=V.dom,af,ad;while(ac--){ae=aa[ac];af=ae.attr(ab);ad="data-mce-"+ab;if(!ae.attributes.map[ad]){if(ab==="style"){af=ag.serializeStyle(ag.parseStyle(af),ae.name);if(!af.length){af=null}ae.attr(ad,af);ae.attr(ab,af)}else{if(ab==="tabindex"){ae.attr(ad,af);ae.attr(ab,null)}else{ae.attr(ad,V.convertURL(af,ab,ae.name))}}}}});V.parser.addNodeFilter("script",function(aa){var ab=aa.length,ac;while(ab--){ac=aa[ab];ac.attr("type","mce-"+(ac.attr("type")||"no/type"))}});V.parser.addNodeFilter("#cdata",function(aa){var ab=aa.length,ac;while(ab--){ac=aa[ab];ac.type=8;ac.name="#comment";ac.value="[CDATA["+ac.value+"]]"}});V.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(ab){var ac=ab.length,ad,aa=V.schema.getNonEmptyElements();while(ac--){ad=ab[ac];if(ad.isEmpty(aa)){ad.append(new x("br",1)).shortEnded=true}}});V.serializer=new K(W,V);V.selection=new E(V.dom,V.getWin(),V.serializer,V);V.formatter=new y(V);V.undoManager=new n(V);V.forceBlocks=new G(V);V.enterKey=new J(V);V._nodeChangeDispatcher=new m(V);V.fire("PreInit");if(!W.browser_spellcheck&&!W.gecko_spellcheck){Y.body.spellcheck=false;z.setAttrib(T,"spellcheck","false")}V.fire("PostRender");V.quirks=new B(V);if(W.directionality){T.dir=W.directionality}if(W.nowrap){T.style.whiteSpace="nowrap"}if(W.protect){V.on("BeforeSetContent",function(aa){L(W.protect,function(ab){aa.content=aa.content.replace(ab,function(ac){return""})})})}V.on("SetContent",function(){V.addVisual(V.getBody())});if(W.padd_empty_editor){V.on("PostProcess",function(aa){aa.content=aa.content.replace(/^(]*>( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,"")})}V.load({initial:true,format:"html"});V.startContent=V.getContent({format:"raw"});V.initialized=true;V.bindPendingEventDelegates();V.fire("init");V.focus(true);V.nodeChanged({initial:true});V.execCallback("init_instance_callback",V);if(V.contentStyles.length>0){Z="";L(V.contentStyles,function(aa){Z+=aa+"\r\n"});V.dom.addStyle(Z)}L(V.contentCSS,function(aa){if(!V.loadedCSS[aa]){V.dom.loadCSS(aa);V.loadedCSS[aa]=true}});if(W.auto_focus){setTimeout(function(){var aa;if(W.auto_focus===true){aa=V}else{aa=V.editorManager.get(W.auto_focus)}if(!aa.destroyed){aa.focus()}},100)}X=Y=T=null},focus:function(U){var ab=this,aa=ab.selection,X=ab.settings.content_editable,T;var Y,Z=ab.getDoc(),V;if(!U){T=aa.getRng();if(T.item){Y=T.item(0)}ab._refreshContentEditable();if(!X){if(!N.opera){ab.getBody().focus()}ab.getWin().focus()}if(l||X){V=ab.getBody();if(V.setActive){try{V.setActive()}catch(W){V.focus()}}else{V.focus()}if(X){aa.normalize()}}if(Y&&Y.ownerDocument==Z){T=Z.body.createControlRange();T.addElement(Y);T.select()}}ab.editorManager.setActive(ab)},execCallback:function(U){var T=this,W=T.settings[U],V;if(!W){return}if(T.callbackLookup&&(V=T.callbackLookup[U])){W=V.func;V=V.scope}if(typeof W==="string"){V=W.replace(/\.\w+$/,"");V=V?u(V):0;W=u(W);T.callbackLookup=T.callbackLookup||{};T.callbackLookup[U]={func:W,scope:V}}return W.apply(V||T,Array.prototype.slice.call(arguments,1))},translate:function(V){var U=this.settings.language||"en",T=this.editorManager.i18n;if(!V){return""}return T.data[U+"."+V]||V.replace(/\{\#([^\}]+)\}/g,function(X,W){return T.data[U+"."+W]||"{#"+W+"}"})},getLang:function(T,U){return(this.editorManager.i18n.data[(this.settings.language||"en")+"."+T]||(U!==g?U:"{#"+T+"}"))},getParam:function(U,X,V){var W=U in this.settings?this.settings[U]:X,T;if(V==="hash"){T={};if(typeof W==="string"){L(W.indexOf("=")>0?W.split(/[;,](?![^=;,]*(?:[;,]|$))/):W.split(","),function(Y){Y=Y.split("=");if(Y.length>1){T[i(Y[0])]=i(Y[1])}else{T[i(Y[0])]=i(Y)}})}else{T=W}return T}return W},nodeChanged:function(T){this._nodeChangeDispatcher.nodeChanged(T)},addButton:function(U,V){var T=this;if(V.cmd){V.onclick=function(){T.execCommand(V.cmd)}}if(!V.text&&!V.icon){V.icon=U}T.buttons=T.buttons||{};V.tooltip=V.tooltip||V.title;T.buttons[U]=V},addMenuItem:function(U,V){var T=this;if(V.cmd){V.onclick=function(){T.execCommand(V.cmd)}}T.menuItems=T.menuItems||{};T.menuItems[U]=V},addCommand:function(T,V,U){this.editorCommands.addCommand(T,V,U)},addQueryStateHandler:function(T,V,U){this.editorCommands.addQueryStateHandler(T,V,U)},addQueryValueHandler:function(T,V,U){this.editorCommands.addQueryValueHandler(T,V,U)},addShortcut:function(V,W,U,T){this.shortcuts.add(V,W,U,T)},execCommand:function(W,V,U,T){return this.editorCommands.execCommand(W,V,U,T)},queryCommandState:function(T){return this.editorCommands.queryCommandState(T)},queryCommandValue:function(T){return this.editorCommands.queryCommandValue(T)},queryCommandSupported:function(T){return this.editorCommands.queryCommandSupported(T)},show:function(){var T=this;if(T.hidden){T.hidden=false;if(T.inline){T.getBody().contentEditable=true}else{z.show(T.getContainer());z.hide(T.id)}T.load();T.fire("show")}},hide:function(){var T=this,U=T.getDoc();if(!T.hidden){if(F&&U&&!T.inline){U.execCommand("SelectAll")}T.save();if(T.inline){T.getBody().contentEditable=false;if(T==T.editorManager.focusedEditor){T.editorManager.focusedEditor=null}}else{z.hide(T.getContainer());z.setStyle(T.id,"display",T.orgDisplay)}T.hidden=true;T.fire("hide")}},isHidden:function(){return !!this.hidden},setProgressState:function(T,U){this.fire("ProgressState",{state:T,time:U})},load:function(U){var T=this,W=T.getElement(),V;if(W){U=U||{};U.load=true;V=T.setContent(W.value!==g?W.value:W.innerHTML,U);U.element=W;if(!U.no_events){T.fire("LoadContent",U)}U.element=W=null;return V}},save:function(U){var T=this,X=T.getElement(),V,W;if(!X||!T.initialized){return}U=U||{};U.save=true;U.element=X;V=U.content=T.getContent(U);if(!U.no_events){T.fire("SaveContent",U)}V=U.content;if(!/TEXTAREA|INPUT/i.test(X.nodeName)){if(!T.inline){X.innerHTML=V}if((W=z.getParent(T.id,"form"))){L(W.elements,function(Y){if(Y.name==T.id){Y.value=V;return false}})}}else{X.value=V}U.element=X=null;if(U.set_dirty!==false){T.isNotDirty=true}return V},setContent:function(X,V){var U=this,T=U.getBody(),W;V=V||{};V.format=V.format||"html";V.set=true;V.content=X;if(!V.no_events){U.fire("BeforeSetContent",V)}X=V.content;if(X.length===0||/^\s+$/.test(X)){W=U.settings.forced_root_block;if(W&&U.schema.isValidChild(T.nodeName.toLowerCase(),W.toLowerCase())){X=F&&F<11?"":'
    ';X=U.dom.createHTML(W,U.settings.forced_root_block_attrs,X)}else{if(!F){X='
    '}}U.dom.setHTML(T,X);U.fire("SetContent",V)}else{if(V.format!=="raw"){X=new I({},U.schema).serialize(U.parser.parse(X,{isRootContent:true}))}V.content=i(X);U.dom.setHTML(T,V.content);if(!V.no_events){U.fire("SetContent",V)}}return V.content},getContent:function(V){var U=this,W,T=U.getBody();V=V||{};V.format=V.format||"html";V.get=true;V.getInner=true;if(!V.no_events){U.fire("BeforeGetContent",V)}if(V.format=="raw"){W=T.innerHTML}else{if(V.format=="text"){W=T.innerText||T.textContent}else{W=U.serializer.serialize(T,V)}}if(V.format!="text"){V.content=i(W)}else{V.content=W}if(!V.no_events){U.fire("GetContent",V)}return V.content},insertContent:function(U,T){if(T){U=p({content:U},T)}this.execCommand("mceInsertContent",false,U)},isDirty:function(){return !this.isNotDirty},getContainer:function(){var T=this;if(!T.container){T.container=z.get(T.editorContainer||T.id+"_parent")}return T.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){if(!this.targetElm){this.targetElm=z.get(this.id)}return this.targetElm},getWin:function(){var T=this,U;if(!T.contentWindow){U=T.iframeElement;if(U){T.contentWindow=U.contentWindow}}return T.contentWindow},getDoc:function(){var T=this,U;if(!T.contentDocument){U=T.getWin();if(U){T.contentDocument=U.document}}return T.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(V,U,X){var T=this,W=T.settings;if(W.urlconverter_callback){return T.execCallback("urlconverter_callback",V,X,true,U)}if(!W.convert_urls||(X&&X.nodeName=="LINK")||V.indexOf("file:")===0||V.length===0){return V}if(W.relative_urls){return T.documentBaseURI.toRelative(V)}V=T.documentBaseURI.toAbsolute(V,W.remove_script_host);return V},addVisual:function(X){var U=this,V=U.settings,W=U.dom,T;X=X||U.getBody();if(U.hasVisual===g){U.hasVisual=V.visual}L(W.select("table,a",X),function(Z){var Y;switch(Z.nodeName){case"TABLE":T=V.visual_table_class||"mce-item-table";Y=W.getAttrib(Z,"border");if((!Y||Y=="0")&&U.hasVisual){W.addClass(Z,T)}else{W.removeClass(Z,T)}return;case"A":if(!W.getAttrib(Z,"href",false)){Y=W.getAttrib(Z,"name")||Z.id;T=V.visual_anchor_class||"mce-item-anchor";if(Y&&U.hasVisual){W.addClass(Z,T)}else{W.removeClass(Z,T)}}return}});U.fire("VisualAid",{element:X,hasVisual:U.hasVisual})},remove:function(){var T=this;if(!T.removed){T.save();T.removed=1;T.unbindAllNativeEvents();if(T.hasHiddenInput){z.remove(T.getElement().nextSibling)}if(!T.inline){if(F&&F<10){T.getDoc().execCommand("SelectAll",false,null)}z.setStyle(T.id,"display",T.orgDisplay);T.getBody().onload=null}T.fire("remove");T.editorManager.remove(T);z.remove(T.getContainer());T.destroy()}},destroy:function(V){var T=this,U;if(T.destroyed){return}if(!V&&!T.removed){T.remove();return}if(!V){T.editorManager.off("beforeunload",T._beforeUnload);if(T.theme&&T.theme.destroy){T.theme.destroy()}T.selection.destroy();T.dom.destroy()}U=T.formElement;if(U){if(U._mceOldSubmit){U.submit=U._mceOldSubmit;U._mceOldSubmit=null}z.unbind(U,"submit reset",T.formEventDelegate)}T.contentAreaContainer=T.formElement=T.container=T.editorContainer=null;T.bodyElement=T.contentDocument=T.contentWindow=null;T.iframeElement=T.targetElm=null;if(T.selection){T.selection=T.selection.win=T.selection.dom=T.selection.dom.doc=null}T.destroyed=1},_refreshContentEditable:function(){var U=this,T,V;if(U._isHidden()){T=U.getBody();V=T.parentNode;V.removeChild(T);V.appendChild(T);T.focus()}},_isHidden:function(){var T;if(!l){return 0}T=this.selection.getSel();return(!T||!T.rangeCount||T.rangeCount===0)}};p(w.prototype,k);return w});h("tinymce/util/I18n",[],function(){var j={},i="en";return{setCode:function(k){if(k){i=k;this.rtl=this.data[k]?this.data[k]._dir==="rtl":false}},getCode:function(){return i},rtl:false,add:function(n,l){var k=j[n];if(!k){j[n]=k={}}for(var m in l){k[m]=l[m]}this.setCode(n)},translate:function(m){var k;k=j[i];if(!k){k={}}if(typeof m=="undefined"){return m}if(typeof m!="string"&&m.raw){return m.raw}if(m.push){var l=m.slice(1);m=(k[m[0]]||m[0]).replace(/\{([0-9]+)\}/g,function(o,n){return l[n]})}return(k[m]||m).replace(/{context:\w+}$/,"")},data:j}});h("tinymce/FocusManager",["tinymce/dom/DOMUtils","tinymce/Env"],function(o,j){var k,m,l,n=o.DOM;function i(v){function q(){try{return document.activeElement}catch(w){return document.body}}function u(x,w){if(w&&w.startContainer){if(!x.isChildOf(w.startContainer,x.getRoot())||!x.isChildOf(w.endContainer,x.getRoot())){return}return{startContainer:w.startContainer,startOffset:w.startOffset,endContainer:w.endContainer,endOffset:w.endOffset}}return w}function p(y,x){var w;if(x.startContainer){w=y.getDoc().createRange();w.setStart(x.startContainer,x.startOffset);w.setEnd(x.endContainer,x.endOffset)}else{w=x}return w}function t(w){return !!n.getParent(w,i.isEditorUIElement)}function r(x){var w=x.editor;w.on("init",function(){if(w.inline||j.ie){if("onbeforedeactivate" in document&&j.ie<9){w.dom.bind(w.getBody(),"beforedeactivate",function(z){if(z.target!=w.getBody()){return}try{w.lastRng=w.selection.getRng()}catch(y){}})}else{w.on("nodechange mouseup keyup",function(z){var y=q();if(z.type=="nodechange"&&z.selectionChange){return}if(y&&y.id==w.id+"_ifr"){y=w.getBody()}if(w.dom.isChildOf(y,w.getBody())){w.lastRng=w.selection.getRng()}})}if(j.webkit&&!k){k=function(){var z=v.activeEditor;if(z&&z.selection){var y=z.selection.getRng();if(y&&!y.collapsed){w.lastRng=y}}};n.bind(document,"selectionchange",k)}}});w.on("setcontent",function(){w.lastRng=null});w.on("mousedown",function(){w.selection.lastFocusBookmark=null});w.on("focusin",function(){var y=v.focusedEditor;if(w.selection.lastFocusBookmark){w.selection.setRng(p(w,w.selection.lastFocusBookmark));w.selection.lastFocusBookmark=null}if(y!=w){if(y){y.fire("blur",{focusedEditor:w})}v.setActive(w);v.focusedEditor=w;w.fire("focus",{blurredEditor:y});w.focus(true)}w.lastRng=null});w.on("focusout",function(){window.setTimeout(function(){var y=v.focusedEditor;if(!t(q())&&y==w){w.fire("blur",{focusedEditor:null});v.focusedEditor=null;if(w.selection){w.selection.lastFocusBookmark=null}}},0)});if(!m){m=function(z){var y=v.activeEditor;if(y&&z.target.ownerDocument==document){if(y.selection&&z.target!=y.getBody()){y.selection.lastFocusBookmark=u(y.dom,y.lastRng)}if(z.target!=document.body&&!t(z.target)&&v.focusedEditor==y){y.fire("blur",{focusedEditor:null});v.focusedEditor=null}}};n.bind(document,"focusin",m)}if(w.inline&&!l){l=function(A){var z=v.activeEditor;if(z.inline&&!z.dom.isChildOf(A.target,z.getBody())){var y=z.selection.getRng();if(!y.collapsed){z.lastRng=y}}};n.bind(document,"mouseup",l)}}function s(w){if(v.focusedEditor==w.editor){v.focusedEditor=null}if(!v.activeEditor){n.unbind(document,"selectionchange",k);n.unbind(document,"focusin",m);n.unbind(document,"mouseup",l);k=m=l=null}}v.on("AddEditor",r);v.on("RemoveEditor",s)}i.isEditorUIElement=function(p){return p.className.toString().indexOf("mce-")!==-1};return i});h("tinymce/EditorManager",["tinymce/Editor","tinymce/dom/DomQuery","tinymce/dom/DOMUtils","tinymce/util/URI","tinymce/Env","tinymce/util/Tools","tinymce/util/Observable","tinymce/util/I18n","tinymce/FocusManager"],function(s,k,w,n,j,i,p,t,m){var y=w.DOM;var u=i.explode,l=i.each,x=i.extend;var z=0,q,r;function v(C){var D=r.editors,B;delete D[C.id];for(var A=0;A0){l(u(I),function(L){var K;if((K=y.get(L))){C(L,F,K)}else{l(document.forms,function(M){l(M.elements,function(N){if(N.name===L){L="mce_editor_"+z++;y.setAttrib(N,"id",L);C(L,F,N)}})})}})}break;case"textareas":case"specific_textareas":l(y.select("textarea"),function(K){if(F.editor_deselector&&D(K,F.editor_deselector)){return}if(!F.editor_selector||D(K,F.editor_selector)){C(E(K),F,K)}});break}if(F.oninit){I=J=0;l(G,function(K){J++;if(!K.initialized){K.on("init",function(){I++;if(I==J){H("oninit")}})}else{I++}if(I==J){H("oninit")}})}}A.settings=F;y.bind(window,"ready",B)},get:function(A){if(!arguments.length){return this.editors}return A in this.editors?this.editors[A]:null},add:function(B){var A=this,C=A.editors;C[B.id]=B;C.push(B);A.activeEditor=B;A.fire("AddEditor",{editor:B});if(!q){q=function(){A.fire("BeforeUnload")};y.bind(window,"beforeunload",q)}return B},createEditor:function(B,A){return this.add(new s(B,A,this))},remove:function(A){var B=this,C,E=B.editors,D;if(!A){for(C=E.length-1;C>=0;C--){B.remove(E[C])}return}if(typeof A=="string"){A=A.selector||A;l(y.select(A),function(F){D=E[F.id];if(D){B.remove(D)}});return}D=A;if(!E[D.id]){return null}if(v(D)){B.fire("RemoveEditor",{editor:D})}if(!E.length){y.unbind(window,"beforeunload",q)}D.remove();return D},execCommand:function(E,D,C){var A=this,B=A.get(C);switch(E){case"mceAddEditor":if(!A.get(C)){new s(C,A.settings,A).render()}return true;case"mceRemoveEditor":if(B){B.remove()}return true;case"mceToggleEditor":if(!B){A.execCommand("mceAddEditor",0,C);return true}if(B.isHidden()){B.show()}else{B.hide()}return true}if(A.activeEditor){return A.activeEditor.execCommand(E,D,C)}return false},triggerSave:function(){l(this.editors,function(A){A.save()})},addI18n:function(B,A){t.add(B,A)},translate:function(A){return t.translate(A)},setActive:function(A){var B=this.activeEditor;if(this.activeEditor!=A){if(B){B.fire("deactivate",{relatedTarget:A})}A.fire("activate",{relatedTarget:B})}this.activeEditor=A}};x(r,p);r.setup();window.tinymce=window.tinyMCE=r;return r});h("tinymce/LegacyInput",["tinymce/EditorManager","tinymce/util/Tools"],function(j,i){var l=i.each,k=i.explode;j.on("AddEditor",function(n){var m=n.editor;m.on("preInit",function(){var q,t,s,p=m.settings;function o(v,u){l(u,function(x,w){if(x){s.setStyle(v,w,x)}});s.rename(v,"span")}function r(u){s=m.dom;if(p.convert_fonts_to_spans){l(s.select("font,u,strike",u.node),function(v){q[v.nodeName.toLowerCase()](s,v)})}}if(p.inline_styles){t=k(p.font_size_legacy_values);q={font:function(v,u){o(u,{backgroundColor:u.style.backgroundColor,color:u.color,fontFamily:u.face,fontSize:t[parseInt(u.size,10)-1]})},u:function(v,u){if(m.settings.schema==="html4"){o(u,{textDecoration:"underline"})}},strike:function(v,u){o(u,{textDecoration:"line-through"})}};m.on("PreProcess SetContent",r)}})})});h("tinymce/util/XHR",["tinymce/util/Observable","tinymce/util/Tools"],function(i,j){var k={send:function(m){var o,n=0;function l(){if(!m.async||o.readyState==4||n++>10000){if(m.success&&n<10000&&o.status==200){m.success.call(m.success_scope,""+o.responseText,o,m)}else{if(m.error){m.error.call(m.error_scope,n>10000?"TIMED_OUT":"GENERAL",o,m)}}o=null}else{setTimeout(l,10)}}m.scope=m.scope||this;m.success_scope=m.success_scope||m.scope;m.error_scope=m.error_scope||m.scope;m.async=m.async===false?false:true;m.data=m.data||"";o=new XMLHttpRequest();if(o){if(o.overrideMimeType){o.overrideMimeType(m.content_type)}o.open(m.type||(m.data?"POST":"GET"),m.url,m.async);if(m.crossDomain){o.withCredentials=true}if(m.content_type){o.setRequestHeader("Content-Type",m.content_type)}o.setRequestHeader("X-Requested-With","XMLHttpRequest");o=k.fire("beforeSend",{xhr:o,settings:m}).xhr;o.send(m.data);if(!m.async){return l()}setTimeout(l,10)}}};j.extend(k,i);return k});h("tinymce/util/JSON",[],function(){function i(p,k){var n,j,m,l;k=k||'"';if(p===null){return"null"}m=typeof p;if(m=="string"){j="\bb\tt\nn\ff\rr\"\"''\\\\";return k+p.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(q,o){if(k==='"'&&q==="'"){return q}n=j.indexOf(o);if(n+1){return"\\"+j.charAt(n+1)}q=o.charCodeAt().toString(16);return"\\u"+"0000".substring(q.length)+q})+k}if(m=="object"){if(p.hasOwnProperty&&Object.prototype.toString.call(p)==="[object Array]"){for(n=0,j="[";n0?",":"")+i(p[n],k)}return j+"]"}j="{";for(l in p){if(p.hasOwnProperty(l)){j+=typeof p[l]!="function"?(j.length>1?","+k:k)+l+k+":"+i(p[l],k):""}}return j+"}"}return""+p}return{serialize:i,parse:function(k){try{return window[String.fromCharCode(101)+"val"]("("+k+")")}catch(j){}}}});h("tinymce/util/JSONRequest",["tinymce/util/JSON","tinymce/util/XHR","tinymce/util/Tools"],function(l,k,j){var m=j.extend;function i(n){this.settings=m({},n);this.count=0}i.sendRPC=function(n){return new i().send(n)};i.prototype={send:function(p){var o=p.error,n=p.success;p=m(this.settings,p);p.success=function(r,q){r=l.parse(r);if(typeof r=="undefined"){r={error:"JSON Parse error."}}if(r.error){o.call(p.error_scope||p.scope,r.error,q)}else{n.call(p.success_scope||p.scope,r.result)}};p.error=function(r,q){if(o){o.call(p.error_scope||p.scope,r,q)}};p.data=l.serialize({id:p.id||"c"+(this.count++),method:p.method,params:p.params});p.content_type="application/json";k.send(p)}};return i});h("tinymce/util/JSONP",["tinymce/dom/DOMUtils"],function(i){return{callbacks:{},count:0,send:function(k){var j=this,m=i.DOM,l=k.count!==g?k.count:j.count;var n="tinymce_jsonp_"+l;j.callbacks[l]=function(o){m.remove(n);delete j.callbacks[l];k.callback(o)};m.add(m.doc.body,"script",{id:n,src:k.url,type:"text/javascript"});j.count++}}});h("tinymce/util/LocalStorage",[],function(){var l,k,o,q,r,j;try{if(window.localStorage){return localStorage}}catch(n){}r="tinymce";k=document.documentElement;j=!!k.addBehavior;if(j){k.addBehavior("#default#userData")}function i(){q=[];for(var s in o){q.push(s)}l.length=q.length}function p(){var s,v,u,x=0;o={};if(!j){return}function t(y){var A,z;z=y!==g?x+y:v.indexOf(",",x);if(z===-1||z>v.length){return null}A=v.substring(x,z);x=z+1;return A}k.load(r);v=k.getAttribute(r)||"";do{var w=t();if(w===null){break}s=t(parseInt(w,32)||0);if(s!==null){w=t();if(w===null){break}u=t(parseInt(w,32)||0);if(s){o[s]=u}}}while(s!==null);i()}function m(){var v,u="";if(!j){return}for(var t in o){v=o[t];u+=(u?",":"")+t.length.toString(32)+","+t+","+v.length.toString(32)+","+v}k.setAttribute(r,u);try{k.save(r)}catch(s){}i()}l={key:function(s){return q[s]},getItem:function(s){return s in o?o[s]:null},setItem:function(s,t){o[s]=""+t;m()},removeItem:function(s){delete o[s];m()},clear:function(){o={};m()}};p();return l});h("tinymce/Compat",["tinymce/dom/DOMUtils","tinymce/dom/EventUtils","tinymce/dom/ScriptLoader","tinymce/AddOnManager","tinymce/util/Tools","tinymce/Env"],function(m,o,n,l,j,i){var k=window.tinymce;k.DOM=m.DOM;k.ScriptLoader=n.ScriptLoader;k.PluginManager=l.PluginManager;k.ThemeManager=l.ThemeManager;k.dom=k.dom||{};k.dom.Event=o.Event;j.each(j,function(q,p){k[p]=q});j.each("isOpera isWebKit isIE isGecko isMac".split(" "),function(p){k[p]=i[p.substr(2).toLowerCase()]});return{}});h("tinymce/ui/Layout",["tinymce/util/Class","tinymce/util/Tools"],function(i,j){return i.extend({Defaults:{firstControlClass:"first",lastControlClass:"last"},init:function(k){this.settings=j.extend({},this.Defaults,k)},preRender:function(k){k.addClass(this.settings.containerClass,"body")},applyClasses:function(k){var m=this,p=m.settings,l,o,n;l=k.items().filter(":visible");o=p.firstControlClass;n=p.lastControlClass;l.each(function(q){q.removeClass(o).removeClass(n);if(p.controlClass){q.addClass(p.controlClass)}});l.eq(0).addClass(o);l.eq(-1).addClass(n)},renderHtml:function(k){var m=this,o=m.settings,l,n="";l=k.items();l.eq(0).addClass(o.firstControlClass);l.eq(-1).addClass(o.lastControlClass);l.each(function(p){if(o.controlClass){p.addClass(o.controlClass)}n+=p.renderHtml()});return n},recalc:function(){},postRender:function(){}})});h("tinymce/ui/AbsoluteLayout",["tinymce/ui/Layout"],function(i){return i.extend({Defaults:{containerClass:"abs-layout",controlClass:"abs-layout-item"},recalc:function(j){j.items().filter(":visible").each(function(l){var k=l.settings;l.layoutRect({x:k.x,y:k.y,w:k.w,h:k.h});if(l.recalc){l.recalc()}})},renderHtml:function(j){return'
    '+this._super(j)}})});h("tinymce/ui/Tooltip",["tinymce/ui/Control","tinymce/ui/Movable"],function(j,i){return j.extend({Mixins:[i],Defaults:{classes:"widget tooltip tooltip-n"},text:function(l){var k=this;if(typeof l!="undefined"){k._value=l;if(k._rendered){k.getEl().lastChild.innerHTML=k.encode(l)}return k}return k._value},renderHtml:function(){var k=this,l=k.classPrefix;return('")},repaint:function(){var k=this,l,m;l=k.getEl().style;m=k._layoutRect;l.left=m.x+"px";l.top=m.y+"px";l.zIndex=65535+65535}})});h("tinymce/ui/Widget",["tinymce/ui/Control","tinymce/ui/Tooltip"],function(k,i){var l;var j=k.extend({init:function(n){var m=this;m._super(n);n=m.settings;m.canFocus=true;if(n.tooltip&&j.tooltips!==false){m.on("mouseenter",function(q){var p=m.tooltip().moveTo(-65535);if(q.control==m){var o=p.text(n.tooltip).show().testMoveRel(m.getEl(),["bc-tc","bc-tl","bc-tr"]);p.toggleClass("tooltip-n",o=="bc-tc");p.toggleClass("tooltip-nw",o=="bc-tl");p.toggleClass("tooltip-ne",o=="bc-tr");p.moveRel(m.getEl(),o)}else{p.hide()}});m.on("mouseleave mousedown click",function(){m.tooltip().hide()})}m.aria("label",n.ariaLabel||n.tooltip)},tooltip:function(){if(!l){l=new i({type:"tooltip"});l.renderTo()}return l},active:function(o){var m=this,n;if(o!==n){m.aria("pressed",o);m.toggleClass("active",o)}return m._super(o)},disabled:function(o){var m=this,n;if(o!==n){m.aria("disabled",o);m.toggleClass("disabled",o)}return m._super(o)},postRender:function(){var m=this,n=m.settings;m._rendered=true;m._super();if(!m.parent()&&(n.width||n.height)){m.initLayoutRect();m.repaint()}if(n.autofocus){m.focus()}},remove:function(){this._super();if(l){l.remove();l=null}}});return j});h("tinymce/ui/Button",["tinymce/ui/Widget"],function(i){return i.extend({Defaults:{classes:"widget btn",role:"button"},init:function(l){var j=this,k;j.on("click mousedown",function(m){m.preventDefault()});j._super(l);k=l.size;if(l.subtype){j.addClass(l.subtype)}if(k){j.addClass("btn-"+k)}},icon:function(m){var l=this,n=l.classPrefix;if(typeof m=="undefined"){return l.settings.icon}l.settings.icon=m;m=m?n+"ico "+n+"i-"+l.settings.icon:"";if(l._rendered){var j=l.getEl().firstChild,k=j.getElementsByTagName("i")[0];if(m){if(!k||k!=j.firstChild){k=document.createElement("i");j.insertBefore(k,j.firstChild)}k.className=m}else{if(k){j.removeChild(k)}}l.text(l._text)}return l},repaint:function(){var j=this.getEl().firstChild.style;j.width=j.height="100%";this._super()},text:function(l){var j=this;if(j._rendered){var k=j.getEl().lastChild.lastChild;if(k){k.data=j.translate(l)}}return j._super(l)},renderHtml:function(){var j=this,n=j._id,l=j.classPrefix;var k=j.settings.icon,m;m=j.settings.image;if(m){k="none";if(typeof m!="string"){m=window.getSelection?m[0]:m[1]}m=" style=\"background-image: url('"+m+"')\""}else{m=""}k=j.settings.icon?l+"ico "+l+"i-"+k:"";return('
    ")}})});h("tinymce/ui/ButtonGroup",["tinymce/ui/Container"],function(i){return i.extend({Defaults:{defaultType:"button",role:"group"},renderHtml:function(){var j=this,k=j._layout;j.addClass("btn-group");j.preRender();k.preRender(j);return('
    '+(j.settings.html||"")+k.renderHtml(j)+"
    ")}})});h("tinymce/ui/Checkbox",["tinymce/ui/Widget"],function(i){return i.extend({Defaults:{classes:"checkbox",role:"checkbox",checked:false},init:function(k){var j=this;j._super(k);j.on("click mousedown",function(l){l.preventDefault()});j.on("click",function(l){l.preventDefault();if(!j.disabled()){j.checked(!j.checked())}});j.checked(j.settings.checked)},checked:function(k){var j=this;if(typeof k!="undefined"){if(k){j.addClass("checked")}else{j.removeClass("checked")}j._checked=k;j.aria("checked",k);return j}return j._checked},value:function(j){return this.checked(j)},renderHtml:function(){var j=this,l=j._id,k=j.classPrefix;return('
    '+j.encode(j._text)+"
    ")}})});h("tinymce/ui/ComboBox",["tinymce/ui/Widget","tinymce/ui/Factory","tinymce/ui/DomUtils"],function(k,i,j){return k.extend({init:function(m){var l=this;l._super(m);l.addClass("combobox");l.subinput=true;l.ariaTarget="inp";m=l.settings;m.menu=m.menu||m.values;if(m.menu){m.icon="caret"}l.on("click",function(o){var p=o.target,n=l.getEl();while(p&&p!=n){if(p.id&&p.id.indexOf("-open")!=-1){l.fire("action");if(m.menu){l.showMenu();if(o.aria){l.menu.items()[0].focus()}}}p=p.parentNode}});l.on("keydown",function(n){if(n.target.nodeName=="INPUT"&&n.keyCode==13){l.parents().reverse().each(function(o){n.preventDefault();l.fire("change");if(o.hasEventListeners("submit")&&o.toJSON){o.fire("submit",{data:o.toJSON()});return false}})}});if(m.placeholder){l.addClass("placeholder");l.on("focusin",function(){if(!l._hasOnChange){j.on(l.getEl("inp"),"change",function(){l.fire("change")});l._hasOnChange=true}if(l.hasClass("placeholder")){l.getEl("inp").value="";l.removeClass("placeholder")}});l.on("focusout",function(){if(l.value().length===0){l.getEl("inp").value=m.placeholder;l.addClass("placeholder")}})}},showMenu:function(){var l=this,m=l.settings,n;if(!l.menu){n=m.menu||[];if(n.length){n={type:"menu",items:n}}else{n.type=n.type||"menu"}l.menu=i.create(n).parent(l).renderTo(l.getContainerElm());l.fire("createmenu");l.menu.reflow();l.menu.on("cancel",function(o){if(o.control===l.menu){l.focus()}});l.menu.on("show hide",function(o){o.control.items().each(function(p){p.active(p.value()==l.value())})}).fire("show");l.menu.on("select",function(o){l.value(o.control.value())});l.on("focusin",function(o){if(o.target.tagName.toUpperCase()=="INPUT"){l.menu.hide()}});l.aria("expanded",true)}l.menu.show();l.menu.layoutRect({w:l.layoutRect().w});l.menu.moveRel(l.getEl(),l.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])},value:function(m){var l=this;if(typeof m!="undefined"){l._value=m;l.removeClass("placeholder");if(l._rendered){l.getEl("inp").value=m}return l}if(l._rendered){m=l.getEl("inp").value;if(m!=l.settings.placeholder){return m}return""}return l._value},disabled:function(m){var l=this;if(l._rendered&&typeof m!="undefined"){l.getEl("inp").disabled=m}return l._super(m)},focus:function(){this.getEl("inp").focus()},repaint:function(){var m=this,r=m.getEl(),l=m.getEl("open"),p=m.layoutRect();var o,n;if(l){o=p.w-j.getSize(l).width-10}else{o=p.w-10}var q=document;if(q.all&&(!q.documentMode||q.documentMode<=8)){n=(m.layoutRect().h-2)+"px"}j.css(r.firstChild,{width:o,lineHeight:n});m._super();return m},postRender:function(){var l=this;j.on(this.getEl("inp"),"change",function(){l.fire("change")});return l._super()},remove:function(){j.off(this.getEl("inp"));this._super()},renderHtml:function(){var t=this,l=t._id,m=t.settings,n=t.classPrefix;var q=m.value||m.placeholder||"";var p,s,o="",r="";if("spellcheck" in m){r+=' spellcheck="'+m.spellcheck+'"'}if(m.maxLength){r+=' maxlength="'+m.maxLength+'"'}if(m.size){r+=' size="'+m.size+'"'}if(m.subtype){r+=' type="'+m.subtype+'"'}if(t.disabled()){r+=' disabled="disabled"'}p=m.icon;if(p&&p!="caret"){p=n+"ico "+n+"i-"+m.icon}s=t._text;if(p||s){o=('
    ");t.addClass("has-open")}return('
    "+o+"
    ")}})});h("tinymce/ui/ColorBox",["tinymce/ui/ComboBox"],function(i){return i.extend({init:function(k){var j=this;k.spellcheck=false;if(k.onaction){k.icon="none"}j._super(k);j.addClass("colorbox");j.on("change keyup postrender",function(){j.repaintColor(j.value())})},repaintColor:function(k){var l=this.getEl().getElementsByTagName("i")[0];if(l){try{l.style.background=k}catch(j){}}},value:function(k){var j=this;if(typeof k!="undefined"){if(j._rendered){j.repaintColor(k)}}return j._super(k)}})});h("tinymce/ui/PanelButton",["tinymce/ui/Button","tinymce/ui/FloatPanel"],function(i,j){return i.extend({showPanel:function(){var k=this,l=k.settings;k.active(true);if(!k.panel){var m=l.panel;if(m.type){m={layout:"grid",items:m}}m.role=m.role||"dialog";m.popover=true;m.autohide=true;m.ariaRoot=true;k.panel=new j(m).on("hide",function(){k.active(false)}).on("cancel",function(n){n.stopPropagation();k.focus();k.hidePanel()}).parent(k).renderTo(k.getContainerElm());k.panel.fire("show");k.panel.reflow()}else{k.panel.show()}k.panel.moveRel(k.getEl(),l.popoverAlign||(k.isRtl()?["bc-tr","bc-tc"]:["bc-tl","bc-tc"]))},hidePanel:function(){var k=this;if(k.panel){k.panel.hide()}},postRender:function(){var k=this;k.aria("haspopup",true);k.on("click",function(l){if(l.control===k){if(k.panel&&k.panel.visible()){k.hidePanel()}else{k.showPanel();k.panel.focus(!!l.aria)}}});return k._super()},remove:function(){if(this.panel){this.panel.remove();this.panel=null}return this._super()}})});h("tinymce/ui/ColorButton",["tinymce/ui/PanelButton","tinymce/dom/DOMUtils"],function(j,i){var k=i.DOM;return j.extend({init:function(l){this._super(l);this.addClass("colorbutton")},color:function(l){if(l){this._color=l;this.getEl("preview").style.backgroundColor=l;return this}return this._color},resetColor:function(){this._color=null;this.getEl("preview").style.backgroundColor=null;return this},renderHtml:function(){var l=this,p=l._id,n=l.classPrefix;var m=l.settings.icon?n+"ico "+n+"i-"+l.settings.icon:"";var o=l.settings.image?" style=\"background-image: url('"+l.settings.image+"')\"":"";return('
    ')},postRender:function(){var l=this,m=l.settings.onclick;l.on("click",function(n){if(n.aria&&n.aria.key=="down"){return}if(n.control==l&&!k.getParent(n.target,"."+l.classPrefix+"open")){n.stopImmediatePropagation();m.call(l,n)}});delete l.settings.onclick;return l._super()}})});h("tinymce/util/Color",[],function(){var k=Math.min,i=Math.max,j=Math.round;function l(w){var x=this,m=0,t=0,v=0;function p(y,A,C){var z,G,E,B,D,F;z=0;G=0;E=0;y=y/255;A=A/255;C=C/255;D=k(y,k(A,C));F=i(y,i(A,C));if(D==F){E=D;return{h:0,s:0,v:E*100}}B=(y==D)?A-C:((C==D)?y-A:C-y);z=(y==D)?3:((C==D)?1:5);z=60*(z-B/(F-D));G=(F-D)/F;E=F;return{h:j(z),s:j(G*100),v:j(E*100)}}function q(y,C,D){var B,A,r,z;y=(parseInt(y,10)||0)%360;C=parseInt(C,10)/100;D=parseInt(D,10)/100;C=i(0,k(C,1));D=i(0,k(D,1));if(C===0){m=t=v=j(255*D);return}B=y/60;A=D*C;r=A*(1-Math.abs(B%2-1));z=D-A;switch(Math.floor(B)){case 0:m=A;t=r;v=0;break;case 1:m=r;t=A;v=0;break;case 2:m=0;t=A;v=r;break;case 3:m=0;t=r;v=A;break;case 4:m=r;t=0;v=A;break;case 5:m=A;t=0;v=r;break;default:m=t=v=0}m=j(255*(m+z));t=j(255*(t+z));v=j(255*(v+z))}function n(){function r(y){y=parseInt(y,10).toString(16);return y.length>1?y:"0"+y}return"#"+r(m)+r(t)+r(v)}function u(){return{r:m,g:t,b:v}}function s(){return p(m,t,v)}function o(y){var r;if(typeof y=="object"){if("r" in y){m=y.r;t=y.g;v=y.b}else{if("v" in y){q(y.h,y.s,y.v)}}}else{if((r=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(y))){m=parseInt(r[1],10);t=parseInt(r[2],10);v=parseInt(r[3],10)}else{if((r=/#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(y))){m=parseInt(r[1],16);t=parseInt(r[2],16);v=parseInt(r[3],16)}else{if((r=/#([0-F])([0-F])([0-F])/gi.exec(y))){m=parseInt(r[1]+r[1],16);t=parseInt(r[2]+r[2],16);v=parseInt(r[3]+r[3],16)}}}}m=m<0?0:(m>255?255:m);t=t<0?0:(t>255?255:t);v=v<0?0:(v>255?255:v);return x}if(w){o(w)}x.toRgb=u;x.toHsv=s;x.toHex=n;x.parse=o}return l});h("tinymce/ui/ColorPicker",["tinymce/ui/Widget","tinymce/ui/DragHelper","tinymce/ui/DomUtils","tinymce/util/Color"],function(k,j,i,l){return k.extend({Defaults:{classes:"widget colorpicker"},init:function(m){this._super(m)},postRender:function(){var w=this,q=w.color(),r,t,s,v,o;t=w.getEl("h");s=w.getEl("hp");v=w.getEl("sv");o=w.getEl("svp");function p(D,A){var C=i.getPos(D),z,B;z=A.pageX-C.x;B=A.pageY-C.y;z=Math.max(0,Math.min(z/D.clientWidth,1));B=Math.max(0,Math.min(B/D.clientHeight,1));return{x:z,y:B}}function n(z,y){var x=(360-z.h)/360;i.css(s,{top:(x*100)+"%"});if(!y){i.css(o,{left:z.s+"%",top:(100-z.v)+"%"})}v.style.background=new l({s:100,v:100,h:z.h}).toHex();w.color().parse({s:z.s,v:z.v,h:z.h})}function m(x){var y;y=p(v,x);r.s=y.x*100;r.v=(1-y.y)*100;n(r);w.fire("change")}function u(x){var y;y=p(t,x);r=q.toHsv();r.h=(1-y.y)*360;n(r,true);w.fire("change")}w._repaint=function(){r=q.toHsv();n(r)};w._super();w._svdraghelper=new j(w._id+"-sv",{start:m,drag:m});w._hdraghelper=new j(w._id+"-h",{start:u,drag:u});w._repaint()},rgb:function(){return this.color().toRgb()},value:function(n){var m=this;if(arguments.length){m.color().parse(n);if(m._rendered){m._repaint()}}else{return m.color().toHex()}},color:function(){if(!this._color){this._color=new l()}return this._color},renderHtml:function(){var m=this,s=m._id,q=m.classPrefix,o;var p="#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000";function n(){var w,u,v="",t,x;t="filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=";x=p.split(",");for(w=0,u=x.length-1;w')}return v}var r=("background: -ms-linear-gradient(top,"+p+");background: linear-gradient(to bottom,"+p+");");o=('
    '+n()+'
    ');return('
    '+o+"
    ")}})});h("tinymce/ui/Path",["tinymce/ui/Widget"],function(i){return i.extend({init:function(k){var j=this;if(!k.delimiter){k.delimiter="\u00BB"}j._super(k);j.addClass("path");j.canFocus=true;j.on("click",function(n){var l,m=n.target;if((l=m.getAttribute("data-index"))){j.fire("select",{value:j.data()[l],index:l})}})},focus:function(){var j=this;j.getEl().firstChild.focus();return j},data:function(k){var j=this;if(typeof k!=="undefined"){j._data=k;j.update();return j}return j._data},update:function(){this.innerHtml(this._getPathHtml())},postRender:function(){var j=this;j._super();j.data(j.settings.data)},renderHtml:function(){var j=this;return('
    '+j._getPathHtml()+"
    ")},_getPathHtml:function(){var k=this,p=k._data||[],n,j,m="",o=k.classPrefix;for(n=0,j=p.length;n0?'":"")+'
    '+p[n].name+"
    ")}if(!m){m='
    \u00a0
    '}return m}})});h("tinymce/ui/ElementPath",["tinymce/ui/Path","tinymce/EditorManager"],function(j,i){return j.extend({postRender:function(){var k=this,m=i.activeEditor;function l(n){if(n.nodeType===1){if(n.nodeName=="BR"||!!n.getAttribute("data-mce-bogus")){return true}if(n.getAttribute("data-mce-type")==="bookmark"){return true}}return false}if(m.settings.elementpath!==false){k.on("select",function(n){m.focus();m.selection.select(this.data()[n.index].element);m.nodeChanged()});m.on("nodeChange",function(r){var n=[],p=r.parents,q=p.length;while(q--){if(p[q].nodeType==1&&!l(p[q])){var o=m.fire("ResolveName",{name:p[q].nodeName.toLowerCase(),target:p[q]});if(!o.isDefaultPrevented()){n.push({name:o.name,element:p[q]})}if(o.isPropagationStopped()){break}}}k.data(n)})}return k._super()}})});h("tinymce/ui/FormItem",["tinymce/ui/Container"],function(i){return i.extend({Defaults:{layout:"flex",align:"center",defaults:{flex:1}},renderHtml:function(){var j=this,k=j._layout,l=j.classPrefix;j.addClass("formitem");k.preRender(j);return('
    '+(j.settings.title?('
    '+j.settings.title+"
    "):"")+'
    '+(j.settings.html||"")+k.renderHtml(j)+"
    ")}})});h("tinymce/ui/Form",["tinymce/ui/Container","tinymce/ui/FormItem","tinymce/util/Tools"],function(i,k,j){return i.extend({Defaults:{containerCls:"form",layout:"flex",direction:"column",align:"stretch",flex:1,padding:20,labelGap:30,spacing:10,callbacks:{submit:function(){this.submit()}}},preRender:function(){var m=this,l=m.items();if(!m.settings.formItemDefaults){m.settings.formItemDefaults={layout:"flex",autoResize:"overflow",defaults:{flex:1}}}l.each(function(p){var o,n=p.settings.label;if(n){o=new k(j.extend({items:{type:"label",id:p._id+"-l",text:n,flex:0,forId:p._id,disabled:p.disabled()}},m.settings.formItemDefaults));o.type="formitem";p.aria("labelledby",p._id+"-l");if(typeof p.settings.flex=="undefined"){p.settings.flex=1}m.replace(p,o);o.add(p)}})},recalcLabels:function(){var m=this,p=0,q=[],n,o,l;if(m.settings.labelGapCalc===false){return}if(m.settings.labelGapCalc=="children"){l=m.find("formitem")}else{l=m.items()}l.filter("formitem").each(function(t){var s=t.items()[0],r=s.getEl().clientWidth;p=r>p?r:p;q.push(s)});o=m.settings.labelGap||0;n=q.length;while(n--){q[n].settings.minWidth=p+o}},visible:function(l){var m=this._super(l);if(l===true&&this._rendered){this.recalcLabels()}return m},submit:function(){return this.fire("submit",{data:this.toJSON()})},postRender:function(){var l=this;l._super();l.recalcLabels();l.fromJSON(l.settings.data)}})});h("tinymce/ui/FieldSet",["tinymce/ui/Form"],function(i){return i.extend({Defaults:{containerCls:"fieldset",layout:"flex",direction:"column",align:"stretch",flex:1,padding:"25 15 5 15",labelGap:30,spacing:10,border:1},renderHtml:function(){var j=this,k=j._layout,l=j.classPrefix;j.preRender();k.preRender(j);return('
    '+(j.settings.title?(''+j.settings.title+""):"")+'
    '+(j.settings.html||"")+k.renderHtml(j)+"
    ")}})});h("tinymce/ui/FilePicker",["tinymce/ui/ComboBox","tinymce/util/Tools"],function(j,i){return j.extend({init:function(o){var m=this,n=tinymce.activeEditor,l=n.settings;var k,q,p;o.spellcheck=false;p=l.file_picker_types||l.file_browser_callback_types;if(p){p=i.makeMap(p,/[, ]/)}if(!p||p[o.filetype]){q=l.file_picker_callback;if(q&&(!p||p[o.filetype])){k=function(){var r=m.fire("beforecall").meta;r=i.extend({filetype:o.filetype},r);q.call(n,function(s,t){m.value(s).fire("change",{meta:t})},m.value(),r)}}else{q=l.file_browser_callback;if(q&&(!p||p[o.filetype])){k=function(){q(m.getEl("inp").id,m.value(),o.filetype,window)}}}}if(k){o.icon="browse";o.onaction=k}m._super(o)}})});h("tinymce/ui/FitLayout",["tinymce/ui/AbsoluteLayout"],function(i){return i.extend({recalc:function(k){var j=k.layoutRect(),l=k.paddingBox();k.items().filter(":visible").each(function(m){m.layoutRect({x:l.left,y:l.top,w:j.innerW-l.right-l.left,h:j.innerH-l.top-l.bottom});if(m.recalc){m.recalc()}})}})});h("tinymce/ui/FlexLayout",["tinymce/ui/AbsoluteLayout"],function(i){return i.extend({recalc:function(L){var X,S,y,V,t,B,R,w,m,Y,n,u;var T,k,o,q,s=[],r,E,P,I,J,W;var O,D,v,p,aa,M,x,N;var F,j,C,Q,H,U;var K,G;var z=Math.max,Z=Math.min;y=L.items().filter(":visible");V=L.layoutRect();t=L._paddingBox;B=L.settings;u=L.isRtl()?(B.direction||"row-reversed"):B.direction;R=B.align;w=L.isRtl()?(B.pack||"end"):B.pack;m=B.spacing||0;if(u=="row-reversed"||u=="column-reverse"){y=y.set(y.toArray().reverse());u=u.split("-")[0]}if(u=="column"){v="y";O="h";D="minH";p="maxH";M="innerH";aa="top";x="deltaH";N="contentH";H="left";C="w";F="x";j="innerW";Q="minW";U="right";K="deltaW";G="contentW"}else{v="x";O="w";D="minW";p="maxW";M="innerW";aa="left";x="deltaW";N="contentW";H="top";C="h";F="y";j="innerH";Q="minH";U="bottom";K="deltaH";G="contentH"}n=V[M]-t[aa]-t[aa];W=Y=0;for(X=0,S=y.length;X0){Y+=q;if(k[p]){s.push(T)}k.flex=q}n-=k[D];r=t[H]+k[Q]+t[U];if(r>W){W=r}}I={};if(n<0){I[D]=V[D]-n+V[x]}else{I[D]=V[M]-n+V[x]}I[Q]=W+V[K];I[N]=V[M]-n;I[G]=W;I.minW=Z(I.minW,V.maxW);I.minH=Z(I.minH,V.maxH);I.minW=z(I.minW,V.startMinWidth);I.minH=z(I.minH,V.startMinHeight);if(V.autoResize&&(I.minW!=V.minW||I.minH!=V.minH)){I.w=I.minW;I.h=I.minH;L.layoutRect(I);this.recalc(L);if(L._lastRect===null){var A=L.parent();if(A){A._lastRect=null;A.recalc()}}return}P=n/Y;for(X=0,S=s.length;XE){n-=(k[p]-k[D]);Y-=k.flex;k.flex=0;k.maxFlexSize=E}else{k.maxFlexSize=0}}P=n/Y;J=t[aa];I={};if(Y===0){if(w=="end"){J=n+t[aa]}else{if(w=="center"){J=Math.round((V[M]/2)-((V[M]-n)/2))+t[aa];if(J<0){J=t[aa]}}else{if(w=="justify"){J=t[aa];m=Math.floor(n/(y.length-1))}}}}I[F]=t[H];for(X=0,S=y.length;X0){r+=k.flex*P}I[O]=r;I[v]=J;T.layoutRect(I);if(T.recalc){T.recalc()}J+=r+m}}})});h("tinymce/ui/FlowLayout",["tinymce/ui/Layout"],function(i){return i.extend({Defaults:{containerClass:"flow-layout",controlClass:"flow-layout-item",endClass:"break"},recalc:function(j){j.items().filter(":visible").each(function(k){if(k.recalc){k.recalc()}})}})});h("tinymce/ui/FormatControls",["tinymce/ui/Control","tinymce/ui/Widget","tinymce/ui/FloatPanel","tinymce/util/Tools","tinymce/EditorManager","tinymce/Env"],function(n,m,p,j,l,i){var o=j.each;l.on("AddEditor",function(q){if(q.editor.rtl){n.rtl=true}k(q.editor)});n.translate=function(q){return l.translate(q)};m.tooltips=!i.iOS;function k(v){var q;function w(y,z){return function(){var A=this;v.on("nodeChange",function(D){var B=v.formatter;var C=null;o(D.parents,function(E){o(y,function(F){if(z){if(B.matchNode(E,z,{value:F.value})){C=F.value}}else{if(B.matchNode(E,F.value)){C=F.value}}if(C){return false}});if(C){return false}});A.value(C)})}}function t(y){y=y.replace(/;$/,"").split(";");var z=y.length;while(z--){y[z]=y[z].split("=")}return y}function s(){var C=0,B=[];var A=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough",icon:"strikethrough",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Alignment",items:[{title:"Left",icon:"alignleft",format:"alignleft"},{title:"Center",icon:"aligncenter",format:"aligncenter"},{title:"Right",icon:"alignright",format:"alignright"},{title:"Justify",icon:"alignjustify",format:"alignjustify"}]}];function y(D){var E=[];if(!D){return}o(D,function(H){var G={text:H.title,icon:H.icon};if(H.items){G.menu=y(H.items)}else{var F=H.format||"custom"+C++;if(!H.format){H.name=F;B.push(H)}G.format=F;G.cmd=H.cmd}E.push(G)});return E}function z(){var D;if(v.settings.style_formats_merge){if(v.settings.style_formats){D=y(A.concat(v.settings.style_formats))}else{D=y(A)}}else{D=y(v.settings.style_formats||A)}return D}v.on("init",function(){o(B,function(D){v.formatter.register(D.name,D)})});return{type:"menu",items:z(),onPostRender:function(D){v.fire("renderFormatsMenu",{control:D.control})},itemDefaults:{preview:true,textStyle:function(){if(this.settings.format){return v.formatter.getCssText(this.settings.format)}},onPostRender:function(){var D=this;D.parent().on("show",function(){var E,F;E=D.settings.format;if(E){D.disabled(!v.formatter.canApply(E));D.active(v.formatter.match(E))}F=D.settings.cmd;if(F){D.active(v.queryCommandState(F))}})},onclick:function(){if(this.settings.format){r(this.settings.format)}if(this.settings.cmd){v.execCommand(this.settings.cmd)}}}}}q=s();o({bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript"},function(z,y){v.addButton(y,{tooltip:z,onPostRender:function(){var A=this;if(v.formatter){v.formatter.formatChanged(y,function(B){A.active(B)})}else{v.on("init",function(){v.formatter.formatChanged(y,function(B){A.active(B)})})}},onclick:function(){r(y)}})});o({outdent:["Decrease indent","Outdent"],indent:["Increase indent","Indent"],cut:["Cut","Cut"],copy:["Copy","Copy"],paste:["Paste","Paste"],help:["Help","mceHelp"],selectall:["Select all","SelectAll"],removeformat:["Clear formatting","RemoveFormat"],visualaid:["Visual aids","mceToggleVisualAid"],newdocument:["New document","mceNewDocument"]},function(z,y){v.addButton(y,{tooltip:z[0],cmd:z[1]})});o({blockquote:["Blockquote","mceBlockQuote"],numlist:["Numbered list","InsertOrderedList"],bullist:["Bullet list","InsertUnorderedList"],subscript:["Subscript","Subscript"],superscript:["Superscript","Superscript"],alignleft:["Align left","JustifyLeft"],aligncenter:["Align center","JustifyCenter"],alignright:["Align right","JustifyRight"],alignjustify:["Justify","JustifyFull"]},function(z,y){v.addButton(y,{tooltip:z[0],cmd:z[1],onPostRender:function(){var A=this;if(v.formatter){v.formatter.formatChanged(y,function(B){A.active(B)})}else{v.on("init",function(){v.formatter.formatChanged(y,function(B){A.active(B)})})}}})});function u(y){return function(){var z=this;y=y=="redo"?"hasRedo":"hasUndo";function A(){return v.undoManager?v.undoManager[y]():false}z.disabled(!A());v.on("Undo Redo AddUndo TypingUndo ClearUndos",function(){z.disabled(!A())})}}function x(){var y=this;v.on("VisualAid",function(z){y.active(z.hasVisual)});y.active(v.hasVisual)}v.addButton("undo",{tooltip:"Undo",onPostRender:u("undo"),cmd:"undo"});v.addButton("redo",{tooltip:"Redo",onPostRender:u("redo"),cmd:"redo"});v.addMenuItem("newdocument",{text:"New document",icon:"newdocument",cmd:"mceNewDocument"});v.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onPostRender:u("undo"),cmd:"undo"});v.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onPostRender:u("redo"),cmd:"redo"});v.addMenuItem("visualaid",{text:"Visual aids",selectable:true,onPostRender:x,cmd:"mceToggleVisualAid"});o({cut:["Cut","Cut","Meta+X"],copy:["Copy","Copy","Meta+C"],paste:["Paste","Paste","Meta+V"],selectall:["Select all","SelectAll","Meta+A"],bold:["Bold","Bold","Meta+B"],italic:["Italic","Italic","Meta+I"],underline:["Underline","Underline"],strikethrough:["Strikethrough","Strikethrough"],subscript:["Subscript","Subscript"],superscript:["Superscript","Superscript"],removeformat:["Clear formatting","RemoveFormat"]},function(z,y){v.addMenuItem(y,{text:z[0],icon:y,shortcut:z[2],cmd:z[1]})});v.on("mousedown",function(){p.hideAll()});function r(y){if(y.control){y=y.control.value()}if(y){v.execCommand("mceToggleFormat",false,y)}}v.addButton("styleselect",{type:"menubutton",text:"Formats",menu:q});v.addButton("formatselect",function(){var y=[],z=t(v.settings.block_formats||"Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre");o(z,function(A){y.push({text:A[0],value:A[1],textStyle:function(){return v.formatter.getCssText(A[1])}})});return{type:"listbox",text:z[0][0],values:y,fixedWidth:true,onselect:r,onPostRender:w(y)}});v.addButton("fontselect",function(){var z="Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats";var y=[],A=t(v.settings.font_formats||z);o(A,function(B){y.push({text:{raw:B[0]},value:B[1],textStyle:B[1].indexOf("dings")==-1?"font-family:"+B[1]:""})});return{type:"listbox",text:"Font Family",tooltip:"Font Family",values:y,fixedWidth:true,onPostRender:w(y,"fontname"),onselect:function(B){if(B.control.settings.value){v.execCommand("FontName",false,B.control.settings.value)}}}});v.addButton("fontsizeselect",function(){var y=[],A="8pt 10pt 12pt 14pt 18pt 24pt 36pt";var z=v.settings.fontsize_formats||A;o(z.split(" "),function(C){var E=C,D=C;var B=C.split("=");if(B.length>1){E=B[0];D=B[1]}y.push({text:E,value:D})});return{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:y,fixedWidth:true,onPostRender:w(y,"fontsize"),onclick:function(B){if(B.control.settings.value){v.execCommand("FontSize",false,B.control.settings.value)}}}});v.addMenuItem("formats",{text:"Formats",menu:q})}});h("tinymce/ui/GridLayout",["tinymce/ui/AbsoluteLayout"],function(i){return i.extend({recalc:function(F){var T=F.settings,S,v,w,P,k,o,D,n,O,K,J,H,G,q,s,N,t,p,m,Q,A,z,M=[],j=[],B,U,r,u,I,V;T=F.settings;w=F.items().filter(":visible");P=F.layoutRect();v=T.columns||Math.ceil(Math.sqrt(w.length));S=Math.ceil(w.length/v);t=T.spacingH||T.spacing||0;p=T.spacingV||T.spacing||0;m=T.alignH||T.align;Q=T.alignV||T.align;s=F._paddingBox;I="reverseRows" in T?T.reverseRows:F.isRtl();if(m&&typeof m=="string"){m=[m]}if(Q&&typeof Q=="string"){Q=[Q]}for(K=0;KM[K]?B:M[K];j[J]=U>j[J]?U:j[J]}}r=P.innerW-s.left-s.right;for(A=0,K=0;K0?t:0);r-=(K>0?t:0)+M[K]}u=P.innerH-s.top-s.bottom;for(z=0,J=0;J0?p:0);u-=(J>0?p:0)+j[J]}A+=s.left+s.right;z+=s.top+s.bottom;D={};D.minW=A+(P.w-P.innerW);D.minH=z+(P.h-P.innerH);D.contentW=D.minW-P.deltaW;D.contentH=D.minH-P.deltaH;D.minW=Math.min(D.minW,P.maxW);D.minH=Math.min(D.minH,P.maxH);D.minW=Math.max(D.minW,P.startMinWidth);D.minH=Math.max(D.minH,P.startMinHeight);if(P.autoResize&&(D.minW!=P.minW||D.minH!=P.minH)){D.w=D.minW;D.h=D.minH;F.layoutRect(D);this.recalc(F);if(F._lastRect===null){var C=F.parent();if(C){C._lastRect=null;C.recalc()}}return}if(P.autoResize){D=F.layoutRect(D);D.contentW=D.minW-P.deltaW;D.contentH=D.minH-P.deltaH}var E;if(T.packV=="start"){E=0}else{E=u>0?Math.floor(u/S):0}var R=0;var l=T.flexWidths;if(l){for(K=0;K')},src:function(j){this.getEl().src=j},html:function(l,m){var k=this,j=this.getEl().contentWindow.document.body;if(!j){setTimeout(function(){k.html(l)},0)}else{j.innerHTML=l;if(m){m()}}return this}})});h("tinymce/ui/Label",["tinymce/ui/Widget","tinymce/ui/DomUtils"],function(j,i){return j.extend({init:function(l){var k=this;k._super(l);k.addClass("widget");k.addClass("label");k.canFocus=false;if(l.multiline){k.addClass("autoscroll")}if(l.strong){k.addClass("strong")}},initLayoutRect:function(){var k=this,m=k._super();if(k.settings.multiline){var l=i.getSize(k.getEl());if(l.width>m.maxW){m.minW=m.maxW;k.addClass("multiline")}k.getEl().style.width=m.minW+"px";m.startMinH=m.h=m.minH=Math.min(m.maxH,i.getSize(k.getEl()).height)}return m},repaint:function(){var k=this;if(!k.settings.multiline){k.getEl().style.lineHeight=k.layoutRect().h+"px"}return k._super()},text:function(l){var k=this;if(k._rendered&&l){this.innerHtml(k.encode(l))}return k._super(l)},renderHtml:function(){var l=this,k=l.settings.forId;return('")}})});h("tinymce/ui/Toolbar",["tinymce/ui/Container"],function(i){return i.extend({Defaults:{role:"toolbar",layout:"flow"},init:function(k){var j=this;j._super(k);j.addClass("toolbar")},postRender:function(){var j=this;j.items().addClass("toolbar-item");return j._super()}})});h("tinymce/ui/MenuBar",["tinymce/ui/Toolbar"],function(i){return i.extend({Defaults:{role:"menubar",containerCls:"menubar",ariaRoot:true,defaults:{type:"menubutton"}}})});h("tinymce/ui/MenuButton",["tinymce/ui/Button","tinymce/ui/Factory","tinymce/ui/MenuBar"],function(l,j,k){function i(o,n){while(o){if(n===o){return true}o=o.parentNode}return false}var m=l.extend({init:function(o){var n=this;n._renderOpen=true;n._super(o);n.addClass("menubtn");if(o.fixedWidth){n.addClass("fixed-width")}n.aria("haspopup",true);n.hasPopup=true},showMenu:function(){var n=this,o=n.settings,p;if(n.menu&&n.menu.visible()){return n.hideMenu()}if(!n.menu){p=o.menu||[];if(p.length){p={type:"menu",items:p}}else{p.type=p.type||"menu"}n.menu=j.create(p).parent(n).renderTo();n.fire("createmenu");n.menu.reflow();n.menu.on("cancel",function(q){if(q.control.parent()===n.menu){q.stopPropagation();n.focus();n.hideMenu()}});n.menu.on("select",function(){n.focus()});n.menu.on("show hide",function(q){if(q.control==n.menu){n.activeMenu(q.type=="show")}n.aria("expanded",q.type=="show")}).fire("show")}n.menu.show();n.menu.layoutRect({w:n.layoutRect().w});n.menu.moveRel(n.getEl(),n.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])},hideMenu:function(){var n=this;if(n.menu){n.menu.items().each(function(o){if(o.hideMenu){o.hideMenu()}});n.menu.hide()}},activeMenu:function(n){this.toggleClass("active",n)},renderHtml:function(){var n=this,r=n._id,p=n.classPrefix;var o=n.settings.icon,q;q=n.settings.image;if(q){o="none";if(typeof q!="string"){q=window.getSelection?q[0]:q[1]}q=" style=\"background-image: url('"+q+"')\""}else{q=""}o=n.settings.icon?p+"ico "+p+"i-"+o:"";n.aria("role",n.parent() instanceof k?"menuitem":"button");return('
    ')},postRender:function(){var n=this;n.on("click",function(o){if(o.control===n&&i(o.target,n.getEl())){n.showMenu();if(o.aria){n.menu.items()[0].focus()}}});n.on("mouseenter",function(r){var o=r.control,q=n.parent(),p;if(o&&q&&o instanceof m&&o.parent()==q){q.items().filter("MenuButton").each(function(s){if(s.hideMenu&&s!=o){if(s.menu&&s.menu.visible()){p=true}s.hideMenu()}});if(p){o.focus();o.showMenu()}}});return n._super()},text:function(q){var n=this,p,o;if(n._rendered){o=n.getEl("open").getElementsByTagName("span");for(p=0;p0){p=k[0].text;l._value=k[0].value}n.menu=k}n.text=n.text||p||k[0].text;l._super(n);l.addClass("listbox");l.on("select",function(r){var q=r.control;if(j){r.lastControl=j}if(n.multiple){q.active(!q.active())}else{l.value(r.control.settings.value)}j=q})},value:function(l){var j=this,m,p,o;function n(r,q){r.items().each(function(s){m=s.value()===q;if(m){p=p||s.text()}s.active(m);if(s.menu){n(s.menu,q)}})}function k(q){for(var r=0;r'+(s!=="-"?'\u00a0":"")+(s!=="-"?''+s+"":"")+(p?'
    '+p+"
    ":"")+(o.menu?'
    ':"")+"")},postRender:function(){var m=this,n=m.settings;var o=n.textStyle;if(typeof o=="function"){o=o.call(this)}if(o){var l=m.getEl("text");if(l){l.setAttribute("style",o)}}m.on("mouseenter click",function(p){if(p.control===m){if(!n.menu&&p.type==="click"){m.fire("select");m.parent().hideAll()}else{m.showMenu();if(p.aria){m.menu.focus(true)}}}});m._super();return m},active:function(l){if(typeof l!="undefined"){this.aria("checked",l)}return this._super(l)},remove:function(){this._super();if(this.menu){this.menu.remove()}}})});h("tinymce/ui/Menu",["tinymce/ui/FloatPanel","tinymce/ui/MenuItem","tinymce/util/Tools"],function(l,k,i){var j=l.extend({Defaults:{defaultType:"menuitem",border:1,layout:"stack",role:"application",bodyRole:"menu",ariaRoot:true},init:function(p){var n=this;p.autohide=true;p.constrainToViewport=true;if(p.itemDefaults){var m=p.items,o=m.length;while(o--){m[o]=i.extend({},p.itemDefaults,m[o])}}n._super(p);n.addClass("menu")},repaint:function(){this.toggleClass("menu-align",true);this._super();this.getEl().style.height="";this.getEl("body").style.height="";return this},cancel:function(){var m=this;m.hideAll();m.fire("select")},hideAll:function(){var m=this;this.find("menuitem").exec("hideMenu");return m._super()},preRender:function(){var m=this;m.items().each(function(o){var n=o.settings;if(n.icon||n.selectable){m._hasIcons=true;return false}});return m._super()}});return j});h("tinymce/ui/Radio",["tinymce/ui/Checkbox"],function(i){return i.extend({Defaults:{classes:"radio",role:"radio"}})});h("tinymce/ui/ResizeHandle",["tinymce/ui/Widget","tinymce/ui/DragHelper"],function(j,i){return j.extend({renderHtml:function(){var k=this,l=k.classPrefix;k.addClass("resizehandle");if(k.settings.direction=="both"){k.addClass("resizehandle-both")}k.canFocus=false;return('
    ')},postRender:function(){var k=this;k._super();k.resizeDragHelper=new i(this._id,{start:function(){k.fire("ResizeStart")},drag:function(l){if(k.settings.direction!="both"){l.deltaX=0}k.fire("Resize",l)},stop:function(){k.fire("ResizeEnd")}})},remove:function(){if(this.resizeDragHelper){this.resizeDragHelper.destroy()}return this._super()}})});h("tinymce/ui/Spacer",["tinymce/ui/Widget"],function(i){return i.extend({renderHtml:function(){var j=this;j.addClass("spacer");j.canFocus=false;return'
    '}})});h("tinymce/ui/SplitButton",["tinymce/ui/MenuButton","tinymce/ui/DomUtils"],function(j,i){return j.extend({Defaults:{classes:"widget btn splitbtn",role:"button"},repaint:function(){var k=this,o=k.getEl(),m=k.layoutRect(),l,n;k._super();l=o.firstChild;n=o.lastChild;i.css(l,{width:m.w-i.getSize(n).width,height:m.h-2});i.css(n,{height:m.h-2});return k},activeMenu:function(l){var k=this;i.toggleClass(k.getEl().lastChild,k.classPrefix+"active",l)},renderHtml:function(){var k=this,o=k._id,m=k.classPrefix,n;var l=k.settings.icon;n=k.settings.image;if(n){l="none";if(typeof n!="string"){n=window.getSelection?n[0]:n[1]}n=" style=\"background-image: url('"+n+"')\""}else{n=""}l=k.settings.icon?m+"ico "+m+"i-"+l:"";return('
    ')},postRender:function(){var k=this,l=k.settings.onclick;k.on("click",function(n){var m=n.target;if(n.control==this){while(m){if((n.aria&&n.aria.key!="down")||(m.nodeName=="BUTTON"&&m.className.indexOf("open")==-1)){n.stopImmediatePropagation();l.call(this,n);return}m=m.parentNode}}});delete k.settings.onclick;return k._super()}})});h("tinymce/ui/StackLayout",["tinymce/ui/FlowLayout"],function(i){return i.extend({Defaults:{containerClass:"stack-layout",controlClass:"stack-layout-item",endClass:"break"}})});h("tinymce/ui/TabPanel",["tinymce/ui/Panel","tinymce/ui/DomUtils"],function(j,i){return j.extend({Defaults:{layout:"absolute",defaults:{type:"panel"}},activateTab:function(k){var l;if(this.activeTabId){l=this.getEl(this.activeTabId);i.removeClass(l,this.classPrefix+"active");l.setAttribute("aria-selected","false")}this.activeTabId="t"+k;l=this.getEl("t"+k);l.setAttribute("aria-selected","true");i.addClass(l,this.classPrefix+"active");this.items()[k].show().fire("showtab");this.reflow();this.items().each(function(n,m){if(k!=m){n.hide()}})},renderHtml:function(){var l=this,m=l._layout,k="",n=l.classPrefix;l.preRender();m.preRender(l);l.items().each(function(p,o){var q=l._id+"-t"+o;p.aria("role","tabpanel");p.aria("labelledby",q);k+=('")});return('
    '+k+'
    '+m.renderHtml(l)+"
    ")},postRender:function(){var k=this;k._super();k.settings.activeTab=k.settings.activeTab||0;k.activateTab(k.settings.activeTab);this.on("click",function(n){var m=n.target.parentNode;if(n.target.parentNode.id==k._id+"-head"){var l=m.childNodes.length;while(l--){if(m.childNodes[l]==n.target){k.activateTab(l)}}}})},initLayoutRect:function(){var l=this,o,k,n;k=i.getSize(l.getEl("head")).width;k=k<0?0:k;n=0;l.items().each(function(p){k=Math.max(k,p.layoutRect().minW);n=Math.max(n,p.layoutRect().minH)});l.items().each(function(p){p.settings.x=0;p.settings.y=0;p.settings.w=k;p.settings.h=n;p.layoutRect({x:0,y:0,w:k,h:n})});var m=i.getSize(l.getEl("head")).height;l.settings.minWidth=k;l.settings.minHeight=n+m;o=l._super();o.deltaH+=m;o.innerH=o.h-o.deltaH;return o}})});h("tinymce/ui/TextBox",["tinymce/ui/Widget","tinymce/ui/DomUtils"],function(j,i){return j.extend({init:function(l){var k=this;k._super(l);k._value=l.value||"";k.addClass("textbox");if(l.multiline){k.addClass("multiline")}else{k.on("keydown",function(m){if(m.keyCode==13){k.parents().reverse().each(function(n){m.preventDefault();if(n.hasEventListeners("submit")&&n.toJSON){n.fire("submit",{data:n.toJSON()});return false}})}})}},disabled:function(l){var k=this;if(k._rendered&&typeof l!="undefined"){k.getEl().disabled=l}return k._super(l)},value:function(l){var k=this;if(typeof l!="undefined"){k._value=l;if(k._rendered){k.getEl().value=l}return k}if(k._rendered){return k.getEl().value}return k._value},repaint:function(){var l=this,n,o,r,m=0,p=0,k;n=l.getEl().style;o=l._layoutRect;k=l._lastRepaintRect||{};var q=document;if(!l.settings.multiline&&q.all&&(!q.documentMode||q.documentMode<=8)){n.lineHeight=(o.h-p)+"px"}r=l._borderBox;m=r.left+r.right+8;p=r.top+r.bottom+(l.settings.multiline?8:0);if(o.x!==k.x){n.left=o.x+"px";k.x=o.x}if(o.y!==k.y){n.top=o.y+"px";k.y=o.y}if(o.w!==k.w){n.width=(o.w-m)+"px";k.w=o.w}if(o.h!==k.h){n.height=(o.h-p)+"px";k.h=o.h}l._lastRepaintRect=k;l.fire("repaint",{},false);return l},renderHtml:function(){var k=this,o=k._id,l=k.settings,n=k.encode(k._value,false),m="";if("spellcheck" in l){m+=' spellcheck="'+l.spellcheck+'"'}if(l.maxLength){m+=' maxlength="'+l.maxLength+'"'}if(l.size){m+=' size="'+l.size+'"'}if(l.subtype){m+=' type="'+l.subtype+'"'}if(k.disabled()){m+=' disabled="disabled"'}if(l.multiline){return('")}return'"},postRender:function(){var k=this;i.on(k.getEl(),"change",function(l){k.fire("change",l)});return k._super()},remove:function(){i.off(this.getEl());this._super()}})});h("tinymce/ui/Throbber",["tinymce/ui/DomUtils","tinymce/ui/Control"],function(i,j){return function(o,n){var l=this,m,k=j.classPrefix;l.show=function(p){l.hide();m=true;window.setTimeout(function(){if(m){o.appendChild(i.createFragment('
    '))}},p||0);return l};l.hide=function(){var p=o.lastChild;if(p&&p.className.indexOf("throbber")!=-1){p.parentNode.removeChild(p)}m=false;return l}}});a(["tinymce/dom/EventUtils","tinymce/dom/Sizzle","tinymce/Env","tinymce/util/Tools","tinymce/dom/DomQuery","tinymce/html/Styles","tinymce/dom/TreeWalker","tinymce/dom/Range","tinymce/html/Entities","tinymce/dom/DOMUtils","tinymce/dom/ScriptLoader","tinymce/AddOnManager","tinymce/dom/RangeUtils","tinymce/html/Node","tinymce/html/Schema","tinymce/html/SaxParser","tinymce/html/DomParser","tinymce/html/Writer","tinymce/html/Serializer","tinymce/dom/Serializer","tinymce/dom/TridentSelection","tinymce/util/VK","tinymce/dom/ControlSelection","tinymce/dom/BookmarkManager","tinymce/dom/Selection","tinymce/dom/ElementUtils","tinymce/Formatter","tinymce/UndoManager","tinymce/EnterKey","tinymce/ForceBlocks","tinymce/EditorCommands","tinymce/util/URI","tinymce/util/Class","tinymce/util/EventDispatcher","tinymce/ui/Selector","tinymce/ui/Collection","tinymce/ui/DomUtils","tinymce/ui/Control","tinymce/ui/Factory","tinymce/ui/KeyboardNavigation","tinymce/ui/Container","tinymce/ui/DragHelper","tinymce/ui/Scrollable","tinymce/ui/Panel","tinymce/ui/Movable","tinymce/ui/Resizable","tinymce/ui/FloatPanel","tinymce/ui/Window","tinymce/ui/MessageBox","tinymce/WindowManager","tinymce/util/Quirks","tinymce/util/Observable","tinymce/EditorObservable","tinymce/Shortcuts","tinymce/Editor","tinymce/util/I18n","tinymce/FocusManager","tinymce/EditorManager","tinymce/LegacyInput","tinymce/util/XHR","tinymce/util/JSON","tinymce/util/JSONRequest","tinymce/util/JSONP","tinymce/util/LocalStorage","tinymce/Compat","tinymce/ui/Layout","tinymce/ui/AbsoluteLayout","tinymce/ui/Tooltip","tinymce/ui/Widget","tinymce/ui/Button","tinymce/ui/ButtonGroup","tinymce/ui/Checkbox","tinymce/ui/ComboBox","tinymce/ui/ColorBox","tinymce/ui/PanelButton","tinymce/ui/ColorButton","tinymce/util/Color","tinymce/ui/ColorPicker","tinymce/ui/Path","tinymce/ui/ElementPath","tinymce/ui/FormItem","tinymce/ui/Form","tinymce/ui/FieldSet","tinymce/ui/FilePicker","tinymce/ui/FitLayout","tinymce/ui/FlexLayout","tinymce/ui/FlowLayout","tinymce/ui/FormatControls","tinymce/ui/GridLayout","tinymce/ui/Iframe","tinymce/ui/Label","tinymce/ui/Toolbar","tinymce/ui/MenuBar","tinymce/ui/MenuButton","tinymce/ui/ListBox","tinymce/ui/MenuItem","tinymce/ui/Menu","tinymce/ui/Radio","tinymce/ui/ResizeHandle","tinymce/ui/Spacer","tinymce/ui/SplitButton","tinymce/ui/StackLayout","tinymce/ui/TabPanel","tinymce/ui/TextBox","tinymce/ui/Throbber"])})(this); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/jquery.tinymce.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/jquery.tinymce.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +!function(a){function b(){function b(a){"remove"===a&&this.each(function(a,b){var c=e(b);c&&c.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(a,b){var c=tinymce.get(b.id.replace(/_parent$/,""));c&&c.remove()})}function d(a){var c,d=this;if(null!=a)b.call(d),d.each(function(b,c){var d;(d=tinymce.get(c.id))&&d.setContent(a)});else if(d.length>0&&(c=tinymce.get(d[0].id)))return c.getContent()}function e(a){var b=null;return a&&a.id&&g.tinymce&&(b=tinymce.get(a.id)),b}function f(a){return!!(a&&a.length&&g.tinymce&&a.is(":tinymce"))}var h={};a.each(["text","html","val"],function(b,g){var i=h[g]=a.fn[g],j="text"===g;a.fn[g]=function(b){var g=this;if(!f(g))return i.apply(g,arguments);if(b!==c)return d.call(g.filter(":tinymce"),b),i.apply(g.not(":tinymce"),arguments),g;var h="",k=arguments;return(j?g:g.eq(0)).each(function(b,c){var d=e(c);h+=d?j?d.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):d.getContent({save:!0}):i.apply(a(c),k)}),h}}),a.each(["append","prepend"],function(b,d){var g=h[d]=a.fn[d],i="prepend"===d;a.fn[d]=function(a){var b=this;return f(b)?a!==c?("string"==typeof a&&b.filter(":tinymce").each(function(b,c){var d=e(c);d&&d.setContent(i?a+d.getContent():d.getContent()+a)}),g.apply(b.not(":tinymce"),arguments),b):void 0:g.apply(b,arguments)}}),a.each(["remove","replaceWith","replaceAll","empty"],function(c,d){var e=h[d]=a.fn[d];a.fn[d]=function(){return b.call(this,d),e.apply(this,arguments)}}),h.attr=a.fn.attr,a.fn.attr=function(b,g){var i=this,j=arguments;if(!b||"value"!==b||!f(i))return g!==c?h.attr.apply(i,j):h.attr.apply(i,j);if(g!==c)return d.call(i.filter(":tinymce"),g),h.attr.apply(i.not(":tinymce"),j),i;var k=i[0],l=e(k);return l?l.getContent({save:!0}):h.attr.apply(a(k),j)}}var c,d,e,f=[],g=window;a.fn.tinymce=function(c){function h(){var d=[],f=0;e||(b(),e=!0),l.each(function(a,b){var e,g=b.id,h=c.oninit;g||(b.id=g=tinymce.DOM.uniqueId()),tinymce.get(g)||(e=new tinymce.Editor(g,c,tinymce.EditorManager),d.push(e),e.on("init",function(){var a,b=h;l.css("visibility",""),h&&++f==d.length&&("string"==typeof b&&(a=-1===b.indexOf(".")?null:tinymce.resolve(b.replace(/\.\w+$/,"")),b=tinymce.resolve(b)),b.apply(a||tinymce,d))}))}),a.each(d,function(a,b){b.render()})}var i,j,k,l=this,m="";if(!l.length)return l;if(!c)return window.tinymce?tinymce.get(l[0].id):null;if(l.css("visibility","hidden"),g.tinymce||d||!(i=c.script_url))1===d?f.push(h):h();else{d=1,j=i.substring(0,i.lastIndexOf("/")),-1!=i.indexOf(".min")&&(m=".min"),g.tinymce=g.tinyMCEPreInit||{base:j,suffix:m},-1!=i.indexOf("gzip")&&(k=c.language||"en",i=i+(/\?/.test(i)?"&":"?")+"js=true&core=true&suffix="+escape(m)+"&themes="+escape(c.theme||"modern")+"&plugins="+escape(c.plugins||"")+"&languages="+(k||""),g.tinyMCE_GZ||(g.tinyMCE_GZ={start:function(){function b(a){tinymce.ScriptLoader.markDone(tinymce.baseURI.toAbsolute(a))}b("langs/"+k+".js"),b("themes/"+c.theme+"/theme"+m+".js"),b("themes/"+c.theme+"/langs/"+k+".js"),a.each(c.plugins.split(","),function(a,c){c&&(b("plugins/"+c+"/plugin"+m+".js"),b("plugins/"+c+"/langs/"+k+".js"))})},end:function(){}}));var n=document.createElement("script");n.type="text/javascript",n.onload=n.onreadystatechange=function(b){b=b||window.event,2===d||"load"!=b.type&&!/complete|loaded/.test(n.readyState)||(tinymce.dom.Event.domLoaded=1,d=2,c.script_loaded&&c.script_loaded(),h(),a.each(f,function(a,b){b()}))},n.src=i,document.body.appendChild(n)}return l},a.extend(a.expr[":"],{tinymce:function(a){var b;return a.id&&"tinymce"in window&&(b=tinymce.get(a.id),b&&b.editorManager===tinymce)?!0:!1}})}(jQuery); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/langs/fr.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/langs/fr.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,200 @@ +tinymce.addI18n('fr',{ +"Cut": "Couper", +"Heading 5": "En-t\u00eate 5", +"Header 2": "Titre 2", +"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "Votre navigateur ne supporte pas la copie directe. Merci d'utiliser les touches Ctrl+X\/C\/V.", +"Heading 4": "En-t\u00eate 4", +"Div": "Div", +"Heading 2": "En-t\u00eate 2", +"Paste": "Coller", +"Close": "Fermer", +"Font Family": "Police", +"Pre": "Pre", +"Align right": "Aligner \u00e0 droite", +"New document": "Nouveau document", +"Blockquote": "Citation", +"Numbered list": "Num\u00e9rotation", +"Heading 1": "En-t\u00eate 1", +"Headings": "En-t\u00eates", +"Increase indent": "Augmenter le retrait", +"Formats": "Formats", +"Headers": "Titres", +"Select all": "Tout s\u00e9lectionner", +"Header 3": "Titre 3", +"Blocks": "Blocs", +"Undo": "Annuler", +"Strikethrough": "Barr\u00e9", +"Bullet list": "Puces", +"Header 1": "Titre 1", +"Superscript": "Exposant", +"Clear formatting": "Effacer la mise en forme", +"Font Sizes": "Taille de police", +"Subscript": "Indice", +"Header 6": "Titre 6", +"Redo": "R\u00e9tablir", +"Paragraph": "Paragraphe", +"Ok": "Ok", +"Bold": "Gras", +"Code": "Code", +"Italic": "Italique", +"Align center": "Centrer", +"Header 5": "Titre 5", +"Heading 6": "En-t\u00eate 6", +"Heading 3": "En-t\u00eate 3", +"Decrease indent": "Diminuer le retrait", +"Header 4": "Titre 4", +"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "Le presse-papiers est maintenant en mode \"texte plein\". Les contenus seront coll\u00e9s sans retenir les formatages jusqu'\u00e0 ce que vous d\u00e9sactiviez cette option.", +"Underline": "Soulign\u00e9", +"Cancel": "Annuler", +"Justify": "Justifier", +"Inline": "En ligne", +"Copy": "Copier", +"Align left": "Aligner \u00e0 gauche", +"Visual aids": "Aides visuelle", +"Lower Greek": "Grec minuscule", +"Square": "Carr\u00e9", +"Default": "Par d\u00e9faut", +"Lower Alpha": "Alpha minuscule", +"Circle": "Cercle", +"Disc": "Disque", +"Upper Alpha": "Alpha majuscule", +"Upper Roman": "Romain majuscule", +"Lower Roman": "Romain minuscule", +"Name": "Nom", +"Anchor": "Ancre", +"You have unsaved changes are you sure you want to navigate away?": "Vous avez des modifications non enregistr\u00e9es, \u00eates-vous s\u00fbr de quitter la page?", +"Restore last draft": "Restaurer le dernier brouillon", +"Special character": "Caract\u00e8res sp\u00e9ciaux", +"Source code": "Code source", +"Color": "Couleur", +"Right to left": "Droite \u00e0 gauche", +"Left to right": "Gauche \u00e0 droite", +"Emoticons": "Emotic\u00f4nes", +"Robots": "Robots", +"Document properties": "Propri\u00e9t\u00e9 du document", +"Title": "Titre", +"Keywords": "Mots-cl\u00e9s", +"Encoding": "Encodage", +"Description": "Description", +"Author": "Auteur", +"Fullscreen": "Plein \u00e9cran", +"Horizontal line": "Ligne horizontale", +"Horizontal space": "Espacement horizontal", +"B": "B", +"Insert\/edit image": "Ins\u00e9rer\/modifier une image", +"General": "G\u00e9n\u00e9ral", +"Advanced": "Avanc\u00e9", +"G": "V", +"R": "R", +"Source": "Source", +"Border": "Bordure", +"Constrain proportions": "Conserver les proportions", +"Vertical space": "Espacement vertical", +"Image description": "Description de l'image", +"Style": "Style", +"Dimensions": "Dimensions", +"Insert image": "Ins\u00e9rer une image", +"Insert date\/time": "Ins\u00e9rer date\/heure", +"Remove link": "Enlever le lien", +"Url": "Url", +"Text to display": "Texte \u00e0 afficher", +"Anchors": "Ancres", +"Insert link": "Ins\u00e9rer un lien", +"New window": "Nouvelle fen\u00eatre", +"None": "n\/a", +"The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?": "L'URL que vous avez entr\u00e9e semble \u00eatre un lien externe. Voulez-vous ajouter le pr\u00e9fixe http:\/\/ n\u00e9cessaire?", +"Target": "Cible", +"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?": "L'URL que vous avez entr\u00e9e semble \u00eatre une adresse e-mail. Voulez-vous ajouter le pr\u00e9fixe mailto: n\u00e9cessaire?", +"Insert\/edit link": "Ins\u00e9rer\/modifier un lien", +"Insert\/edit video": "Ins\u00e9rer\/modifier une vid\u00e9o", +"Poster": "Publier", +"Alternative source": "Source alternative", +"Paste your embed code below:": "Collez votre code d'int\u00e9gration ci-dessous :", +"Insert video": "Ins\u00e9rer une vid\u00e9o", +"Embed": "Int\u00e9grer", +"Nonbreaking space": "Espace ins\u00e9cable", +"Page break": "Saut de page", +"Paste as text": "Coller comme texte", +"Preview": "Pr\u00e9visualiser", +"Print": "Imprimer", +"Save": "Enregistrer", +"Could not find the specified string.": "Impossible de trouver la cha\u00eene sp\u00e9cifi\u00e9e.", +"Replace": "Remplacer", +"Next": "Suiv", +"Whole words": "Mots entiers", +"Find and replace": "Trouver et remplacer", +"Replace with": "Remplacer par", +"Find": "Chercher", +"Replace all": "Tout remplacer", +"Match case": "Respecter la casse", +"Prev": "Pr\u00e9c ", +"Spellcheck": "V\u00e9rification orthographique", +"Finish": "Finie", +"Ignore all": "Tout ignorer", +"Ignore": "Ignorer", +"Add to Dictionary": "Ajouter au dictionnaire", +"Insert row before": "Ins\u00e9rer une ligne avant", +"Rows": "Lignes", +"Height": "Hauteur", +"Paste row after": "Coller la ligne apr\u00e8s", +"Alignment": "Alignement", +"Border color": "Couleur de la bordure", +"Column group": "Groupe de colonnes", +"Row": "Ligne", +"Insert column before": "Ins\u00e9rer une colonne avant", +"Split cell": "Diviser la cellule", +"Cell padding": "Espacement interne cellule", +"Cell spacing": "Espacement inter-cellulles", +"Row type": "Type de ligne", +"Insert table": "Ins\u00e9rer un tableau", +"Body": "Corps", +"Caption": "Titre", +"Footer": "Pied", +"Delete row": "Effacer la ligne", +"Paste row before": "Coller la ligne avant", +"Scope": "Etendue", +"Delete table": "Supprimer le tableau", +"H Align": "Alignement H", +"Top": "Haut", +"Header cell": "Cellule d'en-t\u00eate", +"Column": "Colonne", +"Row group": "Groupe de lignes", +"Cell": "Cellule", +"Middle": "Milieu", +"Cell type": "Type de cellule", +"Copy row": "Copier la ligne", +"Row properties": "Propri\u00e9t\u00e9s de la ligne", +"Table properties": "Propri\u00e9t\u00e9s du tableau", +"Bottom": "Bas", +"V Align": "Alignement V", +"Header": "En-t\u00eate", +"Right": "Droite", +"Insert column after": "Ins\u00e9rer une colonne apr\u00e8s", +"Cols": "Colonnes", +"Insert row after": "Ins\u00e9rer une ligne apr\u00e8s", +"Width": "Largeur", +"Cell properties": "Propri\u00e9t\u00e9s de la cellule", +"Left": "Gauche", +"Cut row": "Couper la ligne", +"Delete column": "Effacer la colonne", +"Center": "Centr\u00e9", +"Merge cells": "Fusionner les cellules", +"Insert template": "Ajouter un th\u00e8me", +"Templates": "Th\u00e8mes", +"Background color": "Couleur d'arri\u00e8re-plan", +"Custom...": "Personnalis\u00e9...", +"Custom color": "Couleur personnalis\u00e9e", +"No color": "Aucune couleur", +"Text color": "Couleur du texte", +"Show blocks": "Afficher les blocs", +"Show invisible characters": "Afficher les caract\u00e8res invisibles", +"Words: {0}": "Mots : {0}", +"Insert": "Ins\u00e9rer", +"File": "Fichier", +"Edit": "Editer", +"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help": "Zone Texte Riche. Appuyer sur ALT-F9 pour le menu. Appuyer sur ALT-F10 pour la barre d'outils. Appuyer sur ALT-0 pour de l'aide.", +"Tools": "Outils", +"View": "Voir", +"Table": "Tableau", +"Format": "Format" +}); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/langs/readme.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/langs/readme.md Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,3 @@ +This is where language files should be placed. + +Please DO NOT translate these directly use this service: https://www.transifex.com/projects/p/tinymce/ diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/license.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/license.txt Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/advlist/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/advlist/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("advlist",function(a){function b(a,b){var c=[];return tinymce.each(b.split(/[ ,]/),function(a){c.push({text:a.replace(/\-/g," ").replace(/\b\w/g,function(a){return a.toUpperCase()}),data:"default"==a?"":a})}),c}function c(b,c){a.undoManager.transact(function(){var d,e=a.dom,f=a.selection;d=e.getParent(f.getNode(),"ol,ul"),d&&d.nodeName==b&&c!==!1||a.execCommand("UL"==b?"InsertUnorderedList":"InsertOrderedList"),c=c===!1?g[b]:c,g[b]=c,d=e.getParent(f.getNode(),"ol,ul"),d&&(e.setStyle(d,"listStyleType",c?c:null),d.removeAttribute("data-mce-style")),a.focus()})}function d(b){var c=a.dom.getStyle(a.dom.getParent(a.selection.getNode(),"ol,ul"),"listStyleType")||"";b.control.items().each(function(a){a.active(a.settings.data===c)})}var e,f,g={};e=b("OL",a.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman")),f=b("UL",a.getParam("advlist_bullet_styles","default,circle,disc,square")),a.addButton("numlist",{type:"splitbutton",tooltip:"Numbered list",menu:e,onshow:d,onselect:function(a){c("OL",a.control.settings.data)},onclick:function(){c("OL",!1)}}),a.addButton("bullist",{type:"splitbutton",tooltip:"Bullet list",menu:f,onshow:d,onselect:function(a){c("UL",a.control.settings.data)},onclick:function(){c("UL",!1)}})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/anchor/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/anchor/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("anchor",function(a){function b(){var b=a.selection.getNode(),c="";"A"==b.tagName&&(c=b.name||b.id||""),a.windowManager.open({title:"Anchor",body:{type:"textbox",name:"name",size:40,label:"Name",value:c},onsubmit:function(b){a.execCommand("mceInsertContent",!1,a.dom.createHTML("a",{id:b.data.name}))}})}a.addButton("anchor",{icon:"anchor",tooltip:"Anchor",onclick:b,stateSelector:"a:not([href])"}),a.addMenuItem("anchor",{icon:"anchor",text:"Anchor",context:"insert",onclick:b})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/autolink/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/autolink/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("autolink",function(a){function b(a){e(a,-1,"(",!0)}function c(a){e(a,0,"",!0)}function d(a){e(a,-1,"",!1)}function e(a,b,c){function d(a,b){if(0>b&&(b=0),3==a.nodeType){var c=a.data.length;b>c&&(b=c)}return b}function e(a,b){1!=a.nodeType||a.hasChildNodes()?g.setStart(a,d(a,b)):g.setStartBefore(a)}function f(a,b){1!=a.nodeType||a.hasChildNodes()?g.setEnd(a,d(a,b)):g.setEndAfter(a)}var g,h,i,j,k,l,m,n,o,p;if(g=a.selection.getRng(!0).cloneRange(),g.startOffset<5){if(n=g.endContainer.previousSibling,!n){if(!g.endContainer.firstChild||!g.endContainer.firstChild.nextSibling)return;n=g.endContainer.firstChild.nextSibling}if(o=n.length,e(n,o),f(n,o),g.endOffset<5)return;h=g.endOffset,j=n}else{if(j=g.endContainer,3!=j.nodeType&&j.firstChild){for(;3!=j.nodeType&&j.firstChild;)j=j.firstChild;3==j.nodeType&&(e(j,0),f(j,j.nodeValue.length))}h=1==g.endOffset?2:g.endOffset-1-b}i=h;do e(j,h>=2?h-2:0),f(j,h>=1?h-1:0),h-=1,p=g.toString();while(" "!=p&&""!==p&&160!=p.charCodeAt(0)&&h-2>=0&&p!=c);g.toString()==c||160==g.toString().charCodeAt(0)?(e(j,h),f(j,i),h+=1):0===g.startOffset?(e(j,0),f(j,i)):(e(j,h),f(j,i)),l=g.toString(),"."==l.charAt(l.length-1)&&f(j,i-1),l=g.toString(),m=l.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i),m&&("www."==m[1]?m[1]="http://www.":/@$/.test(m[1])&&!/^mailto:/.test(m[1])&&(m[1]="mailto:"+m[1]),k=a.selection.getBookmark(),a.selection.setRng(g),a.execCommand("createlink",!1,m[1]+m[2]),a.selection.moveToBookmark(k),a.nodeChanged())}var f;return a.on("keydown",function(b){return 13==b.keyCode?d(a):void 0}),tinymce.Env.ie?void a.on("focus",function(){if(!f){f=!0;try{a.execCommand("AutoUrlDetect",!1,!0)}catch(b){}}}):(a.on("keypress",function(c){return 41==c.keyCode?b(a):void 0}),void a.on("keyup",function(b){return 32==b.keyCode?c(a):void 0}))}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/autoresize/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/autoresize/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("autoresize",function(a){function b(){return a.plugins.fullscreen&&a.plugins.fullscreen.isFullscreen()}function c(d){var g,h,i,j,k,l,m,n,o,p,q,r,s=tinymce.DOM;if(h=a.getDoc()){if(i=h.body,j=h.documentElement,k=e.autoresize_min_height,!i||d&&"setcontent"===d.type&&d.initial||b())return void(i&&j&&(i.style.overflowY="auto",j.style.overflowY="auto"));m=a.dom.getStyle(i,"margin-top",!0),n=a.dom.getStyle(i,"margin-bottom",!0),o=a.dom.getStyle(i,"padding-top",!0),p=a.dom.getStyle(i,"padding-bottom",!0),q=a.dom.getStyle(i,"border-top-width",!0),r=a.dom.getStyle(i,"border-bottom-width",!0),l=i.offsetHeight+parseInt(m,10)+parseInt(n,10)+parseInt(o,10)+parseInt(p,10)+parseInt(q,10)+parseInt(r,10),(isNaN(l)||0>=l)&&(l=tinymce.Env.ie?i.scrollHeight:tinymce.Env.webkit&&0===i.clientHeight?0:i.offsetHeight),l>e.autoresize_min_height&&(k=l),e.autoresize_max_height&&l>e.autoresize_max_height?(k=e.autoresize_max_height,i.style.overflowY="auto",j.style.overflowY="auto"):(i.style.overflowY="hidden",j.style.overflowY="hidden",i.scrollTop=0),k!==f&&(g=k-f,s.setStyle(a.iframeElement,"height",k+"px"),f=k,tinymce.isWebKit&&0>g&&c(d))}}function d(a,b,e){setTimeout(function(){c({}),a--?d(a,b,e):e&&e()},b)}var e=a.settings,f=0;a.settings.inline||(e.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight),10),e.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0),10),a.on("init",function(){var b,c;b=a.getParam("autoresize_overflow_padding",1),c=a.getParam("autoresize_bottom_margin",50),b!==!1&&a.dom.setStyles(a.getBody(),{paddingLeft:b,paddingRight:b}),c!==!1&&a.dom.setStyles(a.getBody(),{paddingBottom:c})}),a.on("nodechange setcontent keyup FullscreenStateChanged",c),a.getParam("autoresize_on_init",!0)&&a.on("init",function(){d(20,100,function(){d(5,1e3)})}),a.addCommand("mceAutoResize",c))}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/autosave/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/autosave/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce._beforeUnloadHandler=function(){var a;return tinymce.each(tinymce.editors,function(b){b.plugins.autosave&&b.plugins.autosave.storeDraft(),!a&&b.isDirty()&&b.getParam("autosave_ask_before_unload",!0)&&(a=b.translate("You have unsaved changes are you sure you want to navigate away?"))}),a},tinymce.PluginManager.add("autosave",function(a){function b(a,b){var c={s:1e3,m:6e4};return a=/^(\d+)([ms]?)$/.exec(""+(a||b)),(a[2]?c[a[2]]:1)*parseInt(a,10)}function c(){var a=parseInt(n.getItem(k+"time"),10)||0;return(new Date).getTime()-a>m.autosave_retention?(d(!1),!1):!0}function d(b){n.removeItem(k+"draft"),n.removeItem(k+"time"),b!==!1&&a.fire("RemoveDraft")}function e(){!j()&&a.isDirty()&&(n.setItem(k+"draft",a.getContent({format:"raw",no_events:!0})),n.setItem(k+"time",(new Date).getTime()),a.fire("StoreDraft"))}function f(){c()&&(a.setContent(n.getItem(k+"draft"),{format:"raw"}),a.fire("RestoreDraft"))}function g(){l||(setInterval(function(){a.removed||e()},m.autosave_interval),l=!0)}function h(){var b=this;b.disabled(!c()),a.on("StoreDraft RestoreDraft RemoveDraft",function(){b.disabled(!c())}),g()}function i(){a.undoManager.beforeChange(),f(),d(),a.undoManager.add()}function j(b){var c=a.settings.forced_root_block;return b=tinymce.trim("undefined"==typeof b?a.getBody().innerHTML:b),""===b||new RegExp("^<"+c+"[^>]*>((\xa0| |[ ]|]*>)+?|)|
    $","i").test(b)}var k,l,m=a.settings,n=tinymce.util.LocalStorage;k=m.autosave_prefix||"tinymce-autosave-{path}{query}-{id}-",k=k.replace(/\{path\}/g,document.location.pathname),k=k.replace(/\{query\}/g,document.location.search),k=k.replace(/\{id\}/g,a.id),m.autosave_interval=b(m.autosave_interval,"30s"),m.autosave_retention=b(m.autosave_retention,"20m"),a.addButton("restoredraft",{title:"Restore last draft",onclick:i,onPostRender:h}),a.addMenuItem("restoredraft",{text:"Restore last draft",onclick:i,onPostRender:h,context:"file"}),a.settings.autosave_restore_when_empty!==!1&&(a.on("init",function(){c()&&j()&&f()}),a.on("saveContent",function(){d()})),window.onbeforeunload=tinymce._beforeUnloadHandler,this.hasDraft=c,this.storeDraft=e,this.restoreDraft=f,this.removeDraft=d,this.isEmpty=j}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/bbcode/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/bbcode/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +!function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(a){var b=this,c=a.getParam("bbcode_dialect","punbb").toLowerCase();a.on("beforeSetContent",function(a){a.content=b["_"+c+"_bbcode2html"](a.content)}),a.on("postProcess",function(a){a.set&&(a.content=b["_"+c+"_bbcode2html"](a.content)),a.get&&(a.content=b["_"+c+"_html2bbcode"](a.content))})},getInfo:function(){return{longname:"BBCode Plugin",author:"Moxiecode Systems AB",authorurl:"http://www.tinymce.com",infourl:"http://www.tinymce.com/wiki.php/Plugin:bbcode"}},_punbb_html2bbcode:function(a){function b(b,c){a=a.replace(b,c)}return a=tinymce.trim(a),b(/(.*?)<\/a>/gi,"[url=$1]$2[/url]"),b(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),b(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),b(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),b(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),b(/(.*?)<\/span>/gi,"[color=$1]$2[/color]"),b(/(.*?)<\/font>/gi,"[color=$1]$2[/color]"),b(/(.*?)<\/span>/gi,"[size=$1]$2[/size]"),b(/(.*?)<\/font>/gi,"$1"),b(//gi,"[img]$1[/img]"),b(/(.*?)<\/span>/gi,"[code]$1[/code]"),b(/(.*?)<\/span>/gi,"[quote]$1[/quote]"),b(/(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),b(/(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),b(/(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),b(/(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),b(/(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),b(/(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),b(/<\/(strong|b)>/gi,"[/b]"),b(/<(strong|b)>/gi,"[b]"),b(/<\/(em|i)>/gi,"[/i]"),b(/<(em|i)>/gi,"[i]"),b(/<\/u>/gi,"[/u]"),b(/(.*?)<\/span>/gi,"[u]$1[/u]"),b(//gi,"[u]"),b(/]*>/gi,"[quote]"),b(/<\/blockquote>/gi,"[/quote]"),b(/
    /gi,"\n"),b(//gi,"\n"),b(/
    /gi,"\n"),b(/

    /gi,""),b(/<\/p>/gi,"\n"),b(/ |\u00a0/gi," "),b(/"/gi,'"'),b(/</gi,"<"),b(/>/gi,">"),b(/&/gi,"&"),a},_punbb_bbcode2html:function(a){function b(b,c){a=a.replace(b,c)}return a=tinymce.trim(a),b(/\n/gi,"
    "),b(/\[b\]/gi,""),b(/\[\/b\]/gi,""),b(/\[i\]/gi,""),b(/\[\/i\]/gi,""),b(/\[u\]/gi,""),b(/\[\/u\]/gi,""),b(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'$2'),b(/\[url\](.*?)\[\/url\]/gi,'$1'),b(/\[img\](.*?)\[\/img\]/gi,''),b(/\[color=(.*?)\](.*?)\[\/color\]/gi,'$2'),b(/\[code\](.*?)\[\/code\]/gi,'$1 '),b(/\[quote.*?\](.*?)\[\/quote\]/gi,'$1 '),a}}),tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)}(); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/charmap/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/charmap/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("charmap",function(a){function b(){function b(a){for(;a;){if("TD"==a.nodeName)return a;a=a.parentNode}}var d,e,f,g;d='

    text|text2

    text|text2

    text|text2

    text|text2

    ';var h=25,i=Math.ceil(c.length/h);for(f=0;i>f;f++){for(d+="",e=0;h>e;e++){var j=f*h+e;if(j
    '+(k?String.fromCharCode(parseInt(k[0],10)):" ")+"
    "}else d+="
    "}d+="";var l={type:"container",html:d,onclick:function(c){var d=c.target;/^(TD|DIV)$/.test(d.nodeName)&&b(d).firstChild&&(a.execCommand("mceInsertContent",!1,tinymce.trim(d.innerText||d.textContent)),c.ctrlKey||g.close())},onmouseover:function(a){var c=b(a.target);c&&c.firstChild?(g.find("#preview").text(c.firstChild.firstChild.data),g.find("#previewTitle").text(c.title)):(g.find("#preview").text(" "),g.find("#previewTitle").text(" "))}};g=a.windowManager.open({title:"Special character",spacing:10,padding:10,items:[l,{type:"container",layout:"flex",direction:"column",align:"center",spacing:5,minWidth:160,minHeight:160,items:[{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:140,minHeight:80},{type:"label",name:"previewTitle",text:" ",style:"text-align: center",border:1,minWidth:140,minHeight:80}]}],buttons:[{text:"Close",onclick:function(){g.close()}}]})}var c=[["160","no-break space"],["173","soft hyphen"],["34","quotation mark"],["162","cent sign"],["8364","euro sign"],["163","pound sign"],["165","yen sign"],["169","copyright sign"],["174","registered sign"],["8482","trade mark sign"],["8240","per mille sign"],["181","micro sign"],["183","middle dot"],["8226","bullet"],["8230","three dot leader"],["8242","minutes / feet"],["8243","seconds / inches"],["167","section sign"],["182","paragraph sign"],["223","sharp s / ess-zed"],["8249","single left-pointing angle quotation mark"],["8250","single right-pointing angle quotation mark"],["171","left pointing guillemet"],["187","right pointing guillemet"],["8216","left single quotation mark"],["8217","right single quotation mark"],["8220","left double quotation mark"],["8221","right double quotation mark"],["8218","single low-9 quotation mark"],["8222","double low-9 quotation mark"],["60","less-than sign"],["62","greater-than sign"],["8804","less-than or equal to"],["8805","greater-than or equal to"],["8211","en dash"],["8212","em dash"],["175","macron"],["8254","overline"],["164","currency sign"],["166","broken bar"],["168","diaeresis"],["161","inverted exclamation mark"],["191","turned question mark"],["710","circumflex accent"],["732","small tilde"],["176","degree sign"],["8722","minus sign"],["177","plus-minus sign"],["247","division sign"],["8260","fraction slash"],["215","multiplication sign"],["185","superscript one"],["178","superscript two"],["179","superscript three"],["188","fraction one quarter"],["189","fraction one half"],["190","fraction three quarters"],["402","function / florin"],["8747","integral"],["8721","n-ary sumation"],["8734","infinity"],["8730","square root"],["8764","similar to"],["8773","approximately equal to"],["8776","almost equal to"],["8800","not equal to"],["8801","identical to"],["8712","element of"],["8713","not an element of"],["8715","contains as member"],["8719","n-ary product"],["8743","logical and"],["8744","logical or"],["172","not sign"],["8745","intersection"],["8746","union"],["8706","partial differential"],["8704","for all"],["8707","there exists"],["8709","diameter"],["8711","backward difference"],["8727","asterisk operator"],["8733","proportional to"],["8736","angle"],["180","acute accent"],["184","cedilla"],["170","feminine ordinal indicator"],["186","masculine ordinal indicator"],["8224","dagger"],["8225","double dagger"],["192","A - grave"],["193","A - acute"],["194","A - circumflex"],["195","A - tilde"],["196","A - diaeresis"],["197","A - ring above"],["198","ligature AE"],["199","C - cedilla"],["200","E - grave"],["201","E - acute"],["202","E - circumflex"],["203","E - diaeresis"],["204","I - grave"],["205","I - acute"],["206","I - circumflex"],["207","I - diaeresis"],["208","ETH"],["209","N - tilde"],["210","O - grave"],["211","O - acute"],["212","O - circumflex"],["213","O - tilde"],["214","O - diaeresis"],["216","O - slash"],["338","ligature OE"],["352","S - caron"],["217","U - grave"],["218","U - acute"],["219","U - circumflex"],["220","U - diaeresis"],["221","Y - acute"],["376","Y - diaeresis"],["222","THORN"],["224","a - grave"],["225","a - acute"],["226","a - circumflex"],["227","a - tilde"],["228","a - diaeresis"],["229","a - ring above"],["230","ligature ae"],["231","c - cedilla"],["232","e - grave"],["233","e - acute"],["234","e - circumflex"],["235","e - diaeresis"],["236","i - grave"],["237","i - acute"],["238","i - circumflex"],["239","i - diaeresis"],["240","eth"],["241","n - tilde"],["242","o - grave"],["243","o - acute"],["244","o - circumflex"],["245","o - tilde"],["246","o - diaeresis"],["248","o slash"],["339","ligature oe"],["353","s - caron"],["249","u - grave"],["250","u - acute"],["251","u - circumflex"],["252","u - diaeresis"],["253","y - acute"],["254","thorn"],["255","y - diaeresis"],["913","Alpha"],["914","Beta"],["915","Gamma"],["916","Delta"],["917","Epsilon"],["918","Zeta"],["919","Eta"],["920","Theta"],["921","Iota"],["922","Kappa"],["923","Lambda"],["924","Mu"],["925","Nu"],["926","Xi"],["927","Omicron"],["928","Pi"],["929","Rho"],["931","Sigma"],["932","Tau"],["933","Upsilon"],["934","Phi"],["935","Chi"],["936","Psi"],["937","Omega"],["945","alpha"],["946","beta"],["947","gamma"],["948","delta"],["949","epsilon"],["950","zeta"],["951","eta"],["952","theta"],["953","iota"],["954","kappa"],["955","lambda"],["956","mu"],["957","nu"],["958","xi"],["959","omicron"],["960","pi"],["961","rho"],["962","final sigma"],["963","sigma"],["964","tau"],["965","upsilon"],["966","phi"],["967","chi"],["968","psi"],["969","omega"],["8501","alef symbol"],["982","pi symbol"],["8476","real part symbol"],["978","upsilon - hook symbol"],["8472","Weierstrass p"],["8465","imaginary part"],["8592","leftwards arrow"],["8593","upwards arrow"],["8594","rightwards arrow"],["8595","downwards arrow"],["8596","left right arrow"],["8629","carriage return"],["8656","leftwards double arrow"],["8657","upwards double arrow"],["8658","rightwards double arrow"],["8659","downwards double arrow"],["8660","left right double arrow"],["8756","therefore"],["8834","subset of"],["8835","superset of"],["8836","not a subset of"],["8838","subset of or equal to"],["8839","superset of or equal to"],["8853","circled plus"],["8855","circled times"],["8869","perpendicular"],["8901","dot operator"],["8968","left ceiling"],["8969","right ceiling"],["8970","left floor"],["8971","right floor"],["9001","left-pointing angle bracket"],["9002","right-pointing angle bracket"],["9674","lozenge"],["9824","black spade suit"],["9827","black club suit"],["9829","black heart suit"],["9830","black diamond suit"],["8194","en space"],["8195","em space"],["8201","thin space"],["8204","zero width non-joiner"],["8205","zero width joiner"],["8206","left-to-right mark"],["8207","right-to-left mark"]];a.addButton("charmap",{icon:"charmap",tooltip:"Special character",onclick:b}),a.addMenuItem("charmap",{icon:"charmap",text:"Special character",onclick:b,context:"insert"})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/code/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/code/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("code",function(a){function b(){var b=a.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:a.getParam("code_dialog_width",600),minHeight:a.getParam("code_dialog_height",Math.min(tinymce.DOM.getViewPort().h-200,500)),spellcheck:!1,style:"direction: ltr; text-align: left"},onSubmit:function(b){a.focus(),a.undoManager.transact(function(){a.setContent(b.data.code)}),a.selection.setCursorLocation(),a.nodeChanged()}});b.find("#code").value(a.getContent({source_view:!0}))}a.addCommand("mceCodeEditor",b),a.addButton("code",{icon:"code",tooltip:"Source code",onclick:b}),a.addMenuItem("code",{icon:"code",text:"Source code",context:"tools",onclick:b})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/colorpicker/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/colorpicker/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("colorpicker",function(a){function b(b,c){function d(a){var b=new tinymce.util.Color(a),c=b.toRgb();f.fromJSON({r:c.r,g:c.g,b:c.b,hex:b.toHex().substr(1)}),e(b.toHex())}function e(a){f.find("#preview")[0].getEl().style.background=a}var f=a.windowManager.open({title:"Color",items:{type:"container",layout:"flex",direction:"row",align:"stretch",padding:5,spacing:10,items:[{type:"colorpicker",value:c,onchange:function(){var a=this.rgb();f&&(f.find("#r").value(a.r),f.find("#g").value(a.g),f.find("#b").value(a.b),f.find("#hex").value(this.value().substr(1)),e(this.value()))}},{type:"form",padding:0,labelGap:5,defaults:{type:"textbox",size:7,value:"0",flex:1,spellcheck:!1,onchange:function(){var a,b,c=f.find("colorpicker")[0];return a=this.name(),b=this.value(),"hex"==a?(b="#"+b,d(b),void c.value(b)):(b={r:f.find("#r").value(),g:f.find("#g").value(),b:f.find("#b").value()},c.value(b),void d(b))}},items:[{name:"r",label:"R",autofocus:1},{name:"g",label:"G"},{name:"b",label:"B"},{name:"hex",label:"#",value:"000000"},{name:"preview",type:"container",border:1}]}]},onSubmit:function(){b("#"+this.toJSON().hex)}});d(c)}a.settings.color_picker_callback||(a.settings.color_picker_callback=b)}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/contextmenu/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/contextmenu/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("contextmenu",function(a){var b,c=a.settings.contextmenu_never_use_native;a.on("contextmenu",function(d){var e,f=a.getDoc();if(!d.ctrlKey||c){if(d.preventDefault(),tinymce.Env.mac&&tinymce.Env.webkit&&2==d.button&&f.caretRangeFromPoint&&a.selection.setRng(f.caretRangeFromPoint(d.x,d.y)),e=a.settings.contextmenu||"link image inserttable | cell row column deletetable",b)b.show();else{var g=[];tinymce.each(e.split(/[ ,]/),function(b){var c=a.menuItems[b];"|"==b&&(c={text:b}),c&&(c.shortcut="",g.push(c))});for(var h=0;h'}),a+=""}),a+=""}var d=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]];a.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:c,onclick:function(b){var c=a.dom.getParent(b.target,"a");c&&(a.insertContent(''+c.getAttribute('),this.hide())}},tooltip:"Emoticons"})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/example/dialog.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/example/dialog.html Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,8 @@ + + + +

    Custom dialog

    + Input some text: + + + \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/example/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/example/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("example",function(a,b){a.addButton("example",{text:"My button",icon:!1,onclick:function(){a.windowManager.open({title:"Example plugin",body:[{type:"textbox",name:"title",label:"Title"}],onsubmit:function(b){a.insertContent("Title: "+b.data.title)}})}}),a.addMenuItem("example",{text:"Example plugin",context:"tools",onclick:function(){a.windowManager.open({title:"TinyMCE site",url:b+"/dialog.html",width:600,height:400,buttons:[{text:"Insert",onclick:function(){var b=a.windowManager.getWindows()[0];a.insertContent(b.getContentWindow().document.getElementById("content").value),b.close()}},{text:"Close",onclick:"close"}]})}})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/example_dependency/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/example_dependency/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("example_dependency",function(){},["example"]); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/fullpage/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/fullpage/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("fullpage",function(a){function b(){var b=c();a.windowManager.open({title:"Document properties",data:b,defaults:{type:"textbox",size:40},body:[{name:"title",label:"Title"},{name:"keywords",label:"Keywords"},{name:"description",label:"Description"},{name:"robots",label:"Robots"},{name:"author",label:"Author"},{name:"docencoding",label:"Encoding"}],onSubmit:function(a){d(tinymce.extend(b,a.data))}})}function c(){function b(a,b){var c=a.attr(b);return c||""}var c,d,f=e(),g={};return g.fontface=a.getParam("fullpage_default_fontface",""),g.fontsize=a.getParam("fullpage_default_fontsize",""),c=f.firstChild,7==c.type&&(g.xml_pi=!0,d=/encoding="([^"]+)"/.exec(c.value),d&&(g.docencoding=d[1])),c=f.getAll("#doctype")[0],c&&(g.doctype=""),c=f.getAll("title")[0],c&&c.firstChild&&(g.title=c.firstChild.value),k(f.getAll("meta"),function(a){var b,c=a.attr("name"),d=a.attr("http-equiv");c?g[c.toLowerCase()]=a.attr("content"):"Content-Type"==d&&(b=/charset\s*=\s*(.*)\s*/gi.exec(a.attr("content")),b&&(g.docencoding=b[1]))}),c=f.getAll("html")[0],c&&(g.langcode=b(c,"lang")||b(c,"xml:lang")),g.stylesheets=[],tinymce.each(f.getAll("link"),function(a){"stylesheet"==a.attr("rel")&&g.stylesheets.push(a.attr("href"))}),c=f.getAll("body")[0],c&&(g.langdir=b(c,"dir"),g.style=b(c,"style"),g.visited_color=b(c,"vlink"),g.link_color=b(c,"link"),g.active_color=b(c,"alink")),g}function d(b){function c(a,b,c){a.attr(b,c?c:void 0)}function d(a){g.firstChild?g.insert(a,g.firstChild):g.append(a)}var f,g,h,j,m,n=a.dom;f=e(),g=f.getAll("head")[0],g||(j=f.getAll("html")[0],g=new l("head",1),j.firstChild?j.insert(g,j.firstChild,!0):j.append(g)),j=f.firstChild,b.xml_pi?(m='version="1.0"',b.docencoding&&(m+=' encoding="'+b.docencoding+'"'),7!=j.type&&(j=new l("xml",7),f.insert(j,f.firstChild,!0)),j.value=m):j&&7==j.type&&j.remove(),j=f.getAll("#doctype")[0],b.doctype?(j||(j=new l("#doctype",10),b.xml_pi?f.insert(j,f.firstChild):d(j)),j.value=b.doctype.substring(9,b.doctype.length-1)):j&&j.remove(),j=null,k(f.getAll("meta"),function(a){"Content-Type"==a.attr("http-equiv")&&(j=a)}),b.docencoding?(j||(j=new l("meta",1),j.attr("http-equiv","Content-Type"),j.shortEnded=!0,d(j)),j.attr("content","text/html; charset="+b.docencoding)):j&&j.remove(),j=f.getAll("title")[0],b.title?(j?j.empty():(j=new l("title",1),d(j)),j.append(new l("#text",3)).value=b.title):j&&j.remove(),k("keywords,description,author,copyright,robots".split(","),function(a){var c,e,g=f.getAll("meta"),h=b[a];for(c=0;c"))}function e(){return new tinymce.html.DomParser({validate:!1,root_name:"#document"}).parse(i)}function f(b){function c(a){return a.replace(/<\/?[A-Z]+/g,function(a){return a.toLowerCase()})}var d,f,h,l,m=b.content,n="",o=a.dom;if(!b.selection&&!("raw"==b.format&&i||b.source_view&&a.getParam("fullpage_hide_in_source_view"))){0!==m.length||b.source_view||(m=tinymce.trim(i)+"\n"+tinymce.trim(m)+"\n"+tinymce.trim(j)),m=m.replace(/<(\/?)BODY/gi,"<$1body"),d=m.indexOf("",d),i=c(m.substring(0,d+1)),f=m.indexOf("\n"),h=e(),k(h.getAll("style"),function(a){a.firstChild&&(n+=a.firstChild.value)}),l=h.getAll("body")[0],l&&o.setAttribs(a.getBody(),{style:l.attr("style")||"",dir:l.attr("dir")||"",vLink:l.attr("vlink")||"",link:l.attr("link")||"",aLink:l.attr("alink")||""}),o.remove("fullpage_styles");var p=a.getDoc().getElementsByTagName("head")[0];n&&(o.add(p,"style",{id:"fullpage_styles"},n),l=o.get("fullpage_styles"),l.styleSheet&&(l.styleSheet.cssText=n));var q={};tinymce.each(p.getElementsByTagName("link"),function(a){"stylesheet"==a.rel&&a.getAttribute("data-mce-fullpage")&&(q[a.href]=a)}),tinymce.each(h.getAll("link"),function(a){var b=a.attr("href");q[b]||"stylesheet"!=a.attr("rel")||o.add(p,"link",{rel:"stylesheet",text:"text/css",href:b,"data-mce-fullpage":"1"}),delete q[b]}),tinymce.each(q,function(a){a.parentNode.removeChild(a)})}}function g(){var b,c="",d="";return a.getParam("fullpage_default_xml_pi")&&(c+='\n'),c+=a.getParam("fullpage_default_doctype",""),c+="\n\n\n",(b=a.getParam("fullpage_default_title"))&&(c+=""+b+"\n"),(b=a.getParam("fullpage_default_encoding"))&&(c+='\n'),(b=a.getParam("fullpage_default_font_family"))&&(d+="font-family: "+b+";"),(b=a.getParam("fullpage_default_font_size"))&&(d+="font-size: "+b+";"),(b=a.getParam("fullpage_default_text_color"))&&(d+="color: "+b+";"),c+="\n\n"}function h(b){b.selection||b.source_view&&a.getParam("fullpage_hide_in_source_view")||(b.content=tinymce.trim(i)+"\n"+tinymce.trim(b.content)+"\n"+tinymce.trim(j))}var i,j,k=tinymce.each,l=tinymce.html.Node;a.addCommand("mceFullPageProperties",b),a.addButton("fullpage",{title:"Document properties",cmd:"mceFullPageProperties"}),a.addMenuItem("fullpage",{text:"Document properties",cmd:"mceFullPageProperties",context:"file"}),a.on("BeforeSetContent",f),a.on("GetContent",h)}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/fullscreen/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/fullscreen/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("fullscreen",function(a){function b(){var a,b,c=window,d=document,e=d.body;return e.offsetWidth&&(a=e.offsetWidth,b=e.offsetHeight),c.innerWidth&&c.innerHeight&&(a=c.innerWidth,b=c.innerHeight),{w:a,h:b}}function c(){function c(){j.setStyle(m,"height",b().h-(l.clientHeight-m.clientHeight))}var k,l,m,n,o=document.body,p=document.documentElement;i=!i,l=a.getContainer(),k=l.style,m=a.getContentAreaContainer().firstChild,n=m.style,i?(d=n.width,e=n.height,n.width=n.height="100%",g=k.width,h=k.height,k.width=k.height="",j.addClass(o,"mce-fullscreen"),j.addClass(p,"mce-fullscreen"),j.addClass(l,"mce-fullscreen"),j.bind(window,"resize",c),c(),f=c):(n.width=d,n.height=e,g&&(k.width=g),h&&(k.height=h),j.removeClass(o,"mce-fullscreen"),j.removeClass(p,"mce-fullscreen"),j.removeClass(l,"mce-fullscreen"),j.unbind(window,"resize",f)),a.fire("FullscreenStateChanged",{state:i})}var d,e,f,g,h,i=!1,j=tinymce.DOM;return a.settings.inline?void 0:(a.on("init",function(){a.addShortcut("Meta+Alt+F","",c)}),a.on("remove",function(){f&&j.unbind(window,"resize",f)}),a.addCommand("mceFullScreen",c),a.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Meta+Alt+F",selectable:!0,onClick:c,onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})},context:"view"}),a.addButton("fullscreen",{tooltip:"Fullscreen",shortcut:"Meta+Alt+F",onClick:c,onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})}}),{isFullscreen:function(){return i}})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/hr/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/hr/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("hr",function(a){a.addCommand("InsertHorizontalRule",function(){a.execCommand("mceInsertContent",!1,"
    ")}),a.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),a.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/image/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/image/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("image",function(a){function b(a,b){function c(a,c){d.parentNode&&d.parentNode.removeChild(d),b({width:a,height:c})}var d=document.createElement("img");d.onload=function(){c(d.clientWidth,d.clientHeight)},d.onerror=function(){c()};var e=d.style;e.visibility="hidden",e.position="fixed",e.bottom=e.left=0,e.width=e.height="auto",document.body.appendChild(d),d.src=a}function c(a,b,c){function d(a,c){return c=c||[],tinymce.each(a,function(a){var e={text:a.text||a.title};a.menu?e.menu=d(a.menu):(e.value=a.value,b(e)),c.push(e)}),c}return d(a,c||[])}function d(b){return function(){var c=a.settings.image_list;"string"==typeof c?tinymce.util.XHR.send({url:c,success:function(a){b(tinymce.util.JSON.parse(a))}}):"function"==typeof c?c(b):b(c)}}function e(d){function e(){var a,b,c,d;a=l.find("#width")[0],b=l.find("#height")[0],a&&b&&(c=a.value(),d=b.value(),l.find("#constrain")[0].checked()&&m&&n&&c&&d&&(m!=c?(d=Math.round(c/m*d),isNaN(d)||b.value(d)):(c=Math.round(d/n*c),isNaN(c)||a.value(c))),m=c,n=d)}function f(){function b(b){function c(){b.onload=b.onerror=null,a.selection&&(a.selection.select(b),a.nodeChanged())}b.onload=function(){q.width||q.height||!t||r.setAttribs(b,{width:b.clientWidth,height:b.clientHeight}),c()},b.onerror=c}j(),e(),q=tinymce.extend(q,l.toJSON()),q.alt||(q.alt=""),q.title||(q.title=""),""===q.width&&(q.width=null),""===q.height&&(q.height=null),q.style||(q.style=null),q={src:q.src,alt:q.alt,title:q.title,width:q.width,height:q.height,style:q.style,"class":q["class"]},a.undoManager.transact(function(){return q.src?(""===q.title&&(q.title=null),s?r.setAttribs(s,q):(q.id="__mcenew",a.focus(),a.selection.setContent(r.createHTML("img",q)),s=r.get("__mcenew"),r.setAttrib(s,"id",null)),void b(s)):void(s&&(r.remove(s),a.focus(),a.nodeChanged()))})}function g(a){return a&&(a=a.replace(/px$/,"")),a}function h(c){var d,e,f,g=c.meta||{};o&&o.value(a.convertURL(this.value(),"src")),tinymce.each(g,function(a,b){l.find("#"+b).value(a)}),g.width||g.height||(d=a.convertURL(this.value(),"src"),e=a.settings.image_prepend_url,f=new RegExp("^(?:[a-z]+:)?//","i"),e&&!f.test(d)&&d.substring(0,e.length)!==e&&(d=e+d),this.value(d),b(a.documentBaseURI.toAbsolute(this.value()),function(a){a.width&&a.height&&t&&(m=a.width,n=a.height,l.find("#width").value(m),l.find("#height").value(n))}))}function i(a){if(a.margin){var b=a.margin.split(" ");switch(b.length){case 1:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[0],a["margin-bottom"]=a["margin-bottom"]||b[0],a["margin-left"]=a["margin-left"]||b[0];break;case 2:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[1],a["margin-bottom"]=a["margin-bottom"]||b[0],a["margin-left"]=a["margin-left"]||b[1];break;case 3:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[1],a["margin-bottom"]=a["margin-bottom"]||b[2],a["margin-left"]=a["margin-left"]||b[1];break;case 4:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[1],a["margin-bottom"]=a["margin-bottom"]||b[2],a["margin-left"]=a["margin-left"]||b[3]}delete a.margin}return a}function j(){function b(a){return a.length>0&&/^[0-9]+$/.test(a)&&(a+="px"),a}if(a.settings.image_advtab){var c=l.toJSON(),d=r.parseStyle(c.style);d=i(d),c.vspace&&(d["margin-top"]=d["margin-bottom"]=b(c.vspace)),c.hspace&&(d["margin-left"]=d["margin-right"]=b(c.hspace)),c.border&&(d["border-width"]=b(c.border)),l.find("#style").value(r.serializeStyle(r.parseStyle(r.serializeStyle(d))))}}function k(){if(a.settings.image_advtab){var b=l.toJSON(),c=r.parseStyle(b.style);l.find("#vspace").value(""),l.find("#hspace").value(""),c=i(c),(c["margin-top"]&&c["margin-bottom"]||c["margin-right"]&&c["margin-left"])&&(l.find("#vspace").value(c["margin-top"]===c["margin-bottom"]?g(c["margin-top"]):""),l.find("#hspace").value(c["margin-right"]===c["margin-left"]?g(c["margin-right"]):"")),c["border-width"]&&l.find("#border").value(g(c["border-width"])),l.find("#style").value(r.serializeStyle(r.parseStyle(r.serializeStyle(c))))}}var l,m,n,o,p,q={},r=a.dom,s=a.selection.getNode(),t=a.settings.image_dimensions!==!1;m=r.getAttrib(s,"width"),n=r.getAttrib(s,"height"),"IMG"!=s.nodeName||s.getAttribute("data-mce-object")||s.getAttribute("data-mce-placeholder")?s=null:q={src:r.getAttrib(s,"src"),alt:r.getAttrib(s,"alt"),title:r.getAttrib(s,"title"),"class":r.getAttrib(s,"class"),width:m,height:n},d&&(o={type:"listbox",label:"Image list",values:c(d,function(b){b.value=a.convertURL(b.value||b.url,"src")},[{text:"None",value:""}]),value:q.src&&a.convertURL(q.src,"src"),onselect:function(a){var b=l.find("#alt");(!b.value()||a.lastControl&&b.value()==a.lastControl.text())&&b.value(a.control.text()),l.find("#src").value(a.control.value()).fire("change")},onPostRender:function(){o=this}}),a.settings.image_class_list&&(p={name:"class",type:"listbox",label:"Class",values:c(a.settings.image_class_list,function(b){b.value&&(b.textStyle=function(){return a.formatter.getCssText({inline:"img",classes:[b.value]})})})});var u=[{name:"src",type:"filepicker",filetype:"image",label:"Source",autofocus:!0,onchange:h},o];a.settings.image_description!==!1&&u.push({name:"alt",type:"textbox",label:"Image description"}),a.settings.image_title&&u.push({name:"title",type:"textbox",label:"Image Title"}),t&&u.push({type:"container",label:"Dimensions",layout:"flex",direction:"row",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:3,onchange:e,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:3,onchange:e,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}),u.push(p),a.settings.image_advtab?(s&&(s.style.marginLeft&&s.style.marginRight&&s.style.marginLeft===s.style.marginRight&&(q.hspace=g(s.style.marginLeft)),s.style.marginTop&&s.style.marginBottom&&s.style.marginTop===s.style.marginBottom&&(q.vspace=g(s.style.marginTop)),s.style.borderWidth&&(q.border=g(s.style.borderWidth)),q.style=a.dom.serializeStyle(a.dom.parseStyle(a.dom.getAttrib(s,"style")))),l=a.windowManager.open({title:"Insert/edit image",data:q,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},{title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox",onchange:k},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,alignH:["left","right"],defaults:{type:"textbox",maxWidth:50,onchange:j},items:[{label:"Vertical space",name:"vspace"},{label:"Horizontal space",name:"hspace"},{label:"Border",name:"border"}]}]}],onSubmit:f})):l=a.windowManager.open({title:"Insert/edit image",data:q,body:u,onSubmit:f})}a.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:d(e),stateSelector:"img:not([data-mce-object],[data-mce-placeholder])"}),a.addMenuItem("image",{icon:"image",text:"Insert/edit image",onclick:d(e),context:"insert",prependToContext:!0}),a.addCommand("mceImage",d(e))}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/importcss/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/importcss/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("importcss",function(a){function b(a){return"string"==typeof a?function(b){return-1!==b.indexOf(a)}:a instanceof RegExp?function(b){return a.test(b)}:a}function c(b,c){function d(a,b){var g,h=a.href;if(h&&c(h,b)){f(a.imports,function(a){d(a,!0)});try{g=a.cssRules||a.rules}catch(i){}f(g,function(a){a.styleSheet?d(a.styleSheet,!0):a.selectorText&&f(a.selectorText.split(","),function(a){e.push(tinymce.trim(a))})})}}var e=[],g={};f(a.contentCSS,function(a){g[a]=!0}),c||(c=function(a,b){return b||g[a]});try{f(b.styleSheets,function(a){d(a)})}catch(h){}return e}function d(b){var c,d=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(b);if(d){var e=d[1],f=d[2].substr(1).split(".").join(" "),g=tinymce.makeMap("a,img");return d[1]?(c={title:b},a.schema.getTextBlockElements()[e]?c.block=e:a.schema.getBlockElements()[e]||g[e.toLowerCase()]?c.selector=e:c.inline=e):d[2]&&(c={inline:"span",title:b.substr(1),classes:f}),a.settings.importcss_merge_classes!==!1?c.classes=f:c.attributes={"class":f},c}}var e=this,f=tinymce.each;a.on("renderFormatsMenu",function(g){var h=a.settings,i={},j=h.importcss_selector_converter||d,k=b(h.importcss_selector_filter),l=g.control;a.settings.importcss_append||l.items().remove();var m=[];tinymce.each(h.importcss_groups,function(a){a=tinymce.extend({},a),a.filter=b(a.filter),m.push(a)}),f(c(g.doc||a.getDoc(),b(h.importcss_file_filter)),function(b){if(-1===b.indexOf(".mce-")&&!i[b]&&(!k||k(b))){var c,d=j.call(e,b);if(d){var f=d.name||tinymce.DOM.uniqueId();if(m)for(var g=0;g'+d+"";var f=a.dom.getParent(a.selection.getStart(),"time");if(f)return void a.dom.setOuterHTML(f,d)}a.insertContent(d)}var d,e,f="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),g="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),h="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),i="January February March April May June July August September October November December".split(" "),j=[];a.addCommand("mceInsertDate",function(){c(a.getParam("insertdatetime_dateformat",a.translate("%Y-%m-%d")))}),a.addCommand("mceInsertTime",function(){c(a.getParam("insertdatetime_timeformat",a.translate("%H:%M:%S")))}),a.addButton("insertdatetime",{type:"splitbutton",title:"Insert date/time",onclick:function(){c(d||e)},menu:j}),tinymce.each(a.settings.insertdatetime_formats||["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"],function(a){e||(e=a),j.push({text:b(a),onclick:function(){d=a,c(a)}})}),a.addMenuItem("insertdatetime",{icon:"date",text:"Insert date/time",menu:j,context:"insert"})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/layer/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/layer/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("layer",function(a){function b(a){do if(a.className&&-1!=a.className.indexOf("mceItemLayer"))return a;while(a=a.parentNode)}function c(b){var c=a.dom;tinymce.each(c.select("div,p",b),function(a){/^(absolute|relative|fixed)$/i.test(a.style.position)&&(a.hasVisual?c.addClass(a,"mceItemVisualAid"):c.removeClass(a,"mceItemVisualAid"),c.addClass(a,"mceItemLayer"))})}function d(c){var d,e,f=[],g=b(a.selection.getNode()),h=-1,i=-1;for(e=[],tinymce.walk(a.getBody(),function(a){1==a.nodeType&&/^(absolute|relative|static)$/i.test(a.style.position)&&e.push(a)},"childNodes"),d=0;dh&&e[d]==g&&(h=d);if(0>c){for(d=0;d-1?(e[h].style.zIndex=f[i],e[i].style.zIndex=f[h]):f[h]>0&&(e[h].style.zIndex=f[h]-1)}else{for(d=0;df[h]){i=d;break}i>-1?(e[h].style.zIndex=f[i],e[i].style.zIndex=f[h]):e[h].style.zIndex=f[h]+1}a.execCommand("mceRepaint")}function e(){var b=a.dom,c=b.getPos(b.getParent(a.selection.getNode(),"*")),d=a.getBody();a.dom.add(d,"div",{style:{position:"absolute",left:c.x,top:c.y>20?c.y:20,width:100,height:100},"class":"mceItemVisualAid mceItemLayer"},a.selection.getContent()||a.getLang("layer.content")),tinymce.Env.ie&&b.setHTML(d,d.innerHTML)}function f(){var c=b(a.selection.getNode());c||(c=a.dom.getParent(a.selection.getNode(),"DIV,P,IMG")),c&&("absolute"==c.style.position.toLowerCase()?(a.dom.setStyles(c,{position:"",left:"",top:"",width:"",height:""}),a.dom.removeClass(c,"mceItemVisualAid"),a.dom.removeClass(c,"mceItemLayer")):(c.style.left||(c.style.left="20px"),c.style.top||(c.style.top="20px"),c.style.width||(c.style.width=c.width?c.width+"px":"100px"),c.style.height||(c.style.height=c.height?c.height+"px":"100px"),c.style.position="absolute",a.dom.setAttrib(c,"data-mce-style",""),a.addVisual(a.getBody())),a.execCommand("mceRepaint"),a.nodeChanged())}a.addCommand("mceInsertLayer",e),a.addCommand("mceMoveForward",function(){d(1)}),a.addCommand("mceMoveBackward",function(){d(-1)}),a.addCommand("mceMakeAbsolute",function(){f()}),a.addButton("moveforward",{title:"layer.forward_desc",cmd:"mceMoveForward"}),a.addButton("movebackward",{title:"layer.backward_desc",cmd:"mceMoveBackward"}),a.addButton("absolute",{title:"layer.absolute_desc",cmd:"mceMakeAbsolute"}),a.addButton("insertlayer",{title:"layer.insertlayer_desc",cmd:"mceInsertLayer"}),a.on("init",function(){tinymce.Env.ie&&a.getDoc().execCommand("2D-Position",!1,!0)}),a.on("mouseup",function(c){var d=b(c.target);d&&a.dom.setAttrib(d,"data-mce-style","")}),a.on("mousedown",function(c){var d,e=c.target,f=a.getDoc();tinymce.Env.gecko&&(b(e)?"on"!==f.designMode&&(f.designMode="on",e=f.body,d=e.parentNode,d.removeChild(e),d.appendChild(e)):"on"==f.designMode&&(f.designMode="off"))}),a.on("NodeChange",c)}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/legacyoutput/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/legacyoutput/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +!function(a){a.on("AddEditor",function(a){a.editor.settings.inline_styles=!1}),a.PluginManager.add("legacyoutput",function(b,c,d){b.on("init",function(){var c="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",d=a.explode(b.settings.font_size_style_values),e=b.schema;b.formatter.register({alignleft:{selector:c,attributes:{align:"left"}},aligncenter:{selector:c,attributes:{align:"center"}},alignright:{selector:c,attributes:{align:"right"}},alignjustify:{selector:c,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:!0}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:!0}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(b){return a.inArray(d,b.value)+1}}},forecolor:{inline:"font",attributes:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}}),a.each("b,i,u,strike".split(","),function(a){e.addValidElements(a+"[*]")}),e.getElementRule("font")||e.addValidElements("font[face|size|color|style]"),a.each(c.split(","),function(a){var b=e.getElementRule(a);b&&(b.attributes.align||(b.attributes.align={},b.attributesOrder.push("align")))})}),b.addButton("fontsizeselect",function(){var a=[],c="8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7",d=b.settings.fontsize_formats||c;return b.$.each(d.split(" "),function(b,c){var d=c,e=c,f=c.split("=");f.length>1&&(d=f[0],e=f[1]),a.push({text:d,value:e})}),{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:a,fixedWidth:!0,onPostRender:function(){var a=this;b.on("NodeChange",function(){var c;c=b.dom.getParent(b.selection.getNode(),"font"),a.value(c?c.size:"")})},onclick:function(a){a.control.settings.value&&b.execCommand("FontSize",!1,a.control.settings.value)}}}),b.addButton("fontselect",function(){function a(a){a=a.replace(/;$/,"").split(";");for(var b=a.length;b--;)a[b]=a[b].split("=");return a}var c="Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats",e=[],f=a(b.settings.font_formats||c);return d.each(f,function(a,b){e.push({text:{raw:b[0]},value:b[1],textStyle:-1==b[1].indexOf("dings")?"font-family:"+b[1]:""})}),{type:"listbox",text:"Font Family",tooltip:"Font Family",values:e,fixedWidth:!0,onPostRender:function(){var a=this;b.on("NodeChange",function(){var c;c=b.dom.getParent(b.selection.getNode(),"font"),a.value(c?c.face:"")})},onselect:function(a){a.control.settings.value&&b.execCommand("FontName",!1,a.control.settings.value)}}})})}(tinymce); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/link/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/link/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("link",function(a){function b(b){return function(){var c=a.settings.link_list;"string"==typeof c?tinymce.util.XHR.send({url:c,success:function(a){b(tinymce.util.JSON.parse(a))}}):"function"==typeof c?c(b):b(c)}}function c(a,b,c){function d(a,c){return c=c||[],tinymce.each(a,function(a){var e={text:a.text||a.title};a.menu?e.menu=d(a.menu):(e.value=a.value,b&&b(e)),c.push(e)}),c}return d(a,c||[])}function d(b){function d(a){var b=l.find("#text");(!b.value()||a.lastControl&&b.value()==a.lastControl.text())&&b.value(a.control.text()),l.find("#href").value(a.control.value())}function e(b){var c=[];return tinymce.each(a.dom.select("a:not([href])"),function(a){var d=a.name||a.id;d&&c.push({text:d,value:"#"+d,selected:-1!=b.indexOf("#"+d)})}),c.length?(c.unshift({text:"None",value:""}),{name:"anchor",type:"listbox",label:"Anchors",values:c,onselect:d}):void 0}function f(){!k&&0===u.text.length&&m&&this.parent().parent().find("#text")[0].value(this.value())}function g(b){var c=b.meta||{};o&&o.value(a.convertURL(this.value(),"href")),tinymce.each(b.meta,function(a,b){l.find("#"+b).value(a)}),c.text||f.call(this)}function h(a){var b=v.getContent();if(/]+>[^<]+<\/a>$/.test(b)||-1==b.indexOf("href=")))return!1;if(a){var c,d=a.childNodes;if(0===d.length)return!1;for(c=d.length-1;c>=0;c--)if(3!=d[c].nodeType)return!1}return!0}var i,j,k,l,m,n,o,p,q,r,s,t,u={},v=a.selection,w=a.dom;i=v.getNode(),j=w.getParent(i,"a[href]"),m=h(),u.text=k=j?j.innerText||j.textContent:v.getContent({format:"text"}),u.href=j?w.getAttrib(j,"href"):"",j?u.target=w.getAttrib(j,"target"):a.settings.default_link_target&&(u.target=a.settings.default_link_target),(t=w.getAttrib(j,"rel"))&&(u.rel=t),(t=w.getAttrib(j,"class"))&&(u["class"]=t),(t=w.getAttrib(j,"title"))&&(u.title=t),m&&(n={name:"text",type:"textbox",size:40,label:"Text to display",onchange:function(){u.text=this.value()}}),b&&(o={type:"listbox",label:"Link list",values:c(b,function(b){b.value=a.convertURL(b.value||b.url,"href")},[{text:"None",value:""}]),onselect:d,value:a.convertURL(u.href,"href"),onPostRender:function(){o=this}}),a.settings.target_list!==!1&&(a.settings.target_list||(a.settings.target_list=[{text:"None",value:""},{text:"New window",value:"_blank"}]),q={name:"target",type:"listbox",label:"Target",values:c(a.settings.target_list)}),a.settings.rel_list&&(p={name:"rel",type:"listbox",label:"Rel",values:c(a.settings.rel_list)}),a.settings.link_class_list&&(r={name:"class",type:"listbox",label:"Class",values:c(a.settings.link_class_list,function(b){b.value&&(b.textStyle=function(){return a.formatter.getCssText({inline:"a",classes:[b.value]})})})}),a.settings.link_title!==!1&&(s={name:"title",type:"textbox",label:"Title",value:u.title}),l=a.windowManager.open({title:"Insert link",data:u,body:[{name:"href",type:"filepicker",filetype:"file",size:40,autofocus:!0,label:"Url",onchange:g,onkeyup:f},n,s,e(u.href),o,p,q,r],onSubmit:function(b){function c(b,c){var d=a.selection.getRng();window.setTimeout(function(){a.windowManager.confirm(b,function(b){a.selection.setRng(d),c(b)})},0)}function d(){var b={href:e,target:u.target?u.target:null,rel:u.rel?u.rel:null,"class":u["class"]?u["class"]:null,title:u.title?u.title:null};j?(a.focus(),m&&u.text!=k&&("innerText"in j?j.innerText=u.text:j.textContent=u.text),w.setAttribs(j,b),v.select(j),a.undoManager.add()):m?a.insertContent(w.createHTML("a",b,w.encode(u.text))):a.execCommand("mceInsertLink",!1,b)}var e;return u=tinymce.extend(u,b.data),(e=u.href)?e.indexOf("@")>0&&-1==e.indexOf("//")&&-1==e.indexOf("mailto:")?void c("The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",function(a){a&&(e="mailto:"+e),d()}):a.settings.link_assume_external_targets&&!/^\w+:/i.test(e)||!a.settings.link_assume_external_targets&&/^\s*www\./i.test(e)?void c("The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",function(a){a&&(e="http://"+e),d()}):void d():void a.execCommand("unlink")}})}a.addButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Meta+K",onclick:b(d),stateSelector:"a[href]"}),a.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink",stateSelector:"a[href]"}),a.addShortcut("Meta+K","",b(d)),a.addCommand("mceLink",b(d)),this.showDialog=d,a.addMenuItem("link",{icon:"link",text:"Insert/edit link",shortcut:"Meta+K",onclick:b(d),stateSelector:"a[href]",context:"insert",prependToContext:!0})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/lists/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/lists/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("lists",function(a){function b(a){return a&&/^(OL|UL|DL)$/.test(a.nodeName)}function c(a){return a.parentNode.firstChild==a}function d(a){return a.parentNode.lastChild==a}function e(b){return b&&!!a.schema.getTextBlockElements()[b.nodeName]}var f=this;a.on("init",function(){function g(a){function b(b){var d,e,f;e=a[b?"startContainer":"endContainer"],f=a[b?"startOffset":"endOffset"],1==e.nodeType&&(d=v.create("span",{"data-mce-type":"bookmark"}),e.hasChildNodes()?(f=Math.min(f,e.childNodes.length-1),b?e.insertBefore(d,e.childNodes[f]):v.insertAfter(d,e.childNodes[f])):e.appendChild(d),e=d,f=0),c[b?"startContainer":"endContainer"]=e,c[b?"startOffset":"endOffset"]=f}var c={};return b(!0),a.collapsed||b(),c}function h(a){function b(b){function c(a){for(var b=a.parentNode.firstChild,c=0;b;){if(b==a)return c;(1!=b.nodeType||"bookmark"!=b.getAttribute("data-mce-type"))&&c++,b=b.nextSibling}return-1}var d,e,f;d=f=a[b?"startContainer":"endContainer"],e=a[b?"startOffset":"endOffset"],d&&(1==d.nodeType&&(e=c(d),d=d.parentNode,v.remove(f)),a[b?"startContainer":"endContainer"]=d,a[b?"startOffset":"endOffset"]=e)}b(!0),b();var c=v.createRng();c.setStart(a.startContainer,a.startOffset),a.endContainer&&c.setEnd(a.endContainer,a.endOffset),w.setRng(c)}function i(b,c){var d,e,f,g=v.createFragment(),h=a.schema.getBlockElements();if(a.settings.forced_root_block&&(c=c||a.settings.forced_root_block),c&&(e=v.create(c),e.tagName===a.settings.forced_root_block&&v.setAttribs(e,a.settings.forced_root_block_attrs),g.appendChild(e)),b)for(;d=b.firstChild;){var i=d.nodeName;f||"SPAN"==i&&"bookmark"==d.getAttribute("data-mce-type")||(f=!0),h[i]?(g.appendChild(d),e=null):c?(e||(e=v.create(c),g.appendChild(e)),e.appendChild(d)):g.appendChild(d)}return a.settings.forced_root_block?f||tinymce.Env.ie&&!(tinymce.Env.ie>10)||e.appendChild(v.create("br",{"data-mce-bogus":"1"})):g.appendChild(v.create("br")),g}function j(){return tinymce.grep(w.getSelectedBlocks(),function(a){return/^(LI|DT|DD)$/.test(a.nodeName)})}function k(a,b,c){function d(a){tinymce.each(g,function(c){a.parentNode.insertBefore(c,b.parentNode)}),v.remove(a)}var e,f,g,h;for(g=v.select('span[data-mce-type="bookmark"]',a),c=c||i(b),e=v.createRng(),e.setStartAfter(b),e.setEndAfter(a),f=e.extractContents(),h=f.firstChild;h;h=h.firstChild)if("LI"==h.nodeName&&v.isEmpty(h)){v.remove(h);break}v.isEmpty(f)||v.insertAfter(f,a),v.insertAfter(c,a),v.isEmpty(b.parentNode)&&d(b.parentNode),v.remove(b),v.isEmpty(a)&&v.remove(a)}function l(a){var c,d;if(c=a.nextSibling,c&&b(c)&&c.nodeName==a.nodeName){for(;d=c.firstChild;)a.appendChild(d);v.remove(c)}if(c=a.previousSibling,c&&b(c)&&c.nodeName==a.nodeName){for(;d=c.firstChild;)a.insertBefore(d,a.firstChild);v.remove(c)}}function m(a){tinymce.each(tinymce.grep(v.select("ol,ul",a)),function(a){var c,d=a.parentNode;"LI"==d.nodeName&&d.firstChild==a&&(c=d.previousSibling,c&&"LI"==c.nodeName&&(c.appendChild(a),v.isEmpty(d)&&v.remove(d))),b(d)&&(c=d.previousSibling,c&&"LI"==c.nodeName&&c.appendChild(a))})}function n(a){function e(a){v.isEmpty(a)&&v.remove(a)}var f,g=a.parentNode,h=g.parentNode;return"DD"==a.nodeName?(v.rename(a,"DT"),!0):c(a)&&d(a)?("LI"==h.nodeName?(v.insertAfter(a,h),e(h),v.remove(g)):b(h)?v.remove(g,!0):(h.insertBefore(i(a),g),v.remove(g)),!0):c(a)?("LI"==h.nodeName?(v.insertAfter(a,h),a.appendChild(g),e(h)):b(h)?h.insertBefore(a,g):(h.insertBefore(i(a),g),v.remove(a)),!0):d(a)?("LI"==h.nodeName?v.insertAfter(a,h):b(h)?v.insertAfter(a,g):(v.insertAfter(i(a),g),v.remove(a)),!0):("LI"==h.nodeName?(g=h,f=i(a,"LI")):f=b(h)?i(a,"LI"):i(a),k(g,a,f),m(g.parentNode),!0)}function o(a){function c(c,d){var e;if(b(c)){for(;e=a.lastChild.firstChild;)d.appendChild(e);v.remove(c)}}var d,e;return"DT"==a.nodeName?(v.rename(a,"DD"),!0):(d=a.previousSibling,d&&b(d)?(d.appendChild(a),!0):d&&"LI"==d.nodeName&&b(d.lastChild)?(d.lastChild.appendChild(a),c(a.lastChild,d.lastChild),!0):(d=a.nextSibling,d&&b(d)?(d.insertBefore(a,d.firstChild),!0):d&&"LI"==d.nodeName&&b(a.lastChild)?!1:(d=a.previousSibling,d&&"LI"==d.nodeName?(e=v.create(a.parentNode.nodeName),d.appendChild(e),e.appendChild(a),c(a.lastChild,e),!0):!1)))}function p(){var b=j();if(b.length){for(var c=g(w.getRng(!0)),d=0;d0))return f;for(d=a.schema.getNonEmptyElements(),e=new tinymce.dom.TreeWalker(b.startContainer);f=e[c?"next":"prev"]();){if("LI"==f.nodeName&&!f.hasChildNodes())return f;if(d[f.nodeName])return f;if(3==f.nodeType&&f.data.length>0)return f}}function e(a,c){var d,e,f=a.parentNode;if(b(c.lastChild)&&(e=c.lastChild),d=c.lastChild,d&&"BR"==d.nodeName&&a.hasChildNodes()&&v.remove(d),v.isEmpty(c)&&v.$(c).empty(),!v.isEmpty(a))for(;d=a.firstChild;)c.appendChild(d);e&&c.appendChild(e),v.remove(a),v.isEmpty(f)&&v.remove(f)}if(w.isCollapsed()){var f=v.getParent(w.getStart(),"LI");if(f){var i=w.getRng(!0),j=v.getParent(d(i,c),"LI");if(j&&j!=f){var k=g(i);return c?e(j,f):e(f,j),h(k),!0}if(!j&&!c&&s(f.parentNode.nodeName))return!0}}},a.on("BeforeExecCommand",function(b){var c,d=b.command.toLowerCase();return"indent"==d?p()&&(c=!0):"outdent"==d&&q()&&(c=!0),c?(a.fire("ExecCommand",{command:b.command}),b.preventDefault(),!0):void 0}),a.addCommand("InsertUnorderedList",function(){t("UL")}),a.addCommand("InsertOrderedList",function(){t("OL")}),a.addCommand("InsertDefinitionList",function(){t("DL")}),a.addQueryStateHandler("InsertUnorderedList",u("UL")),a.addQueryStateHandler("InsertOrderedList",u("OL")),a.addQueryStateHandler("InsertDefinitionList",u("DL")),a.on("keydown",function(b){9!=b.keyCode||tinymce.util.VK.metaKeyPressed(b)||a.dom.getParent(a.selection.getStart(),"LI,DT,DD")&&(b.preventDefault(),b.shiftKey?q():p())})}),a.addButton("indent",{icon:"indent",title:"Increase indent",cmd:"Indent",onPostRender:function(){var b=this;a.on("nodechange",function(){for(var d=a.selection.getSelectedBlocks(),e=!1,f=0,g=d.length;!e&&g>f;f++){var h=d[f].nodeName;e="LI"==h&&c(d[f])||"UL"==h||"OL"==h||"DD"==h}b.disabled(e)})}}),a.on("keydown",function(a){a.keyCode==tinymce.util.VK.BACKSPACE?f.backspaceDelete()&&a.preventDefault():a.keyCode==tinymce.util.VK.DELETE&&f.backspaceDelete(!0)&&a.preventDefault()})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/media/moxieplayer.swf Binary file src/pyams_skin/resources/js/ext/tinymce/plugins/media/moxieplayer.swf has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/media/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/media/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("media",function(a,b){function c(a){return a=a.toLowerCase(),-1!=a.indexOf(".mp3")?"audio/mpeg":-1!=a.indexOf(".wav")?"audio/wav":-1!=a.indexOf(".mp4")?"video/mp4":-1!=a.indexOf(".webm")?"video/webm":-1!=a.indexOf(".ogg")?"video/ogg":-1!=a.indexOf(".swf")?"application/x-shockwave-flash":""}function d(b){var c=a.settings.media_scripts;if(c)for(var d=0;d=0;e--)b[d]==c[e]&&c.splice(e,1);a.selection.select(c[0]),a.nodeChanged()}})}function f(){var b=a.selection.getNode();return b.getAttribute("data-mce-object")?a.selection.getContent():void 0}function g(e){var f="";if(!e.source1&&(tinymce.extend(e,h(e.embed)),!e.source1))return"";if(e.source2||(e.source2=""),e.poster||(e.poster=""),e.source1=a.convertURL(e.source1,"source"),e.source2=a.convertURL(e.source2,"source"),e.source1mime=c(e.source1),e.source2mime=c(e.source2),e.poster=a.convertURL(e.poster,"poster"),e.flashPlayerUrl=a.convertURL(b+"/moxieplayer.swf","movie"),tinymce.each(l,function(a){var b,c,d;if(b=a.regex.exec(e.source1)){for(d=a.url,c=0;b[c];c++)d=d.replace("$"+c,function(){return b[c]});e.source1=d,e.type=a.type,e.width=e.width||a.w,e.height=e.height||a.h}}),e.embed)f=k(e.embed,e,!0);else{var g=d(e.source1);g&&(e.type="script",e.width=g.width,e.height=g.height),e.width=e.width||300,e.height=e.height||150,tinymce.each(e,function(b,c){e[c]=a.dom.encode(b)}),"iframe"==e.type?f+='':"application/x-shockwave-flash"==e.source1mime?(f+='',e.poster&&(f+=''),f+=""):-1!=e.source1mime.indexOf("audio")?a.settings.audio_template_callback?f=a.settings.audio_template_callback(e):f+='":"script"==e.type?f+='':f=a.settings.video_template_callback?a.settings.video_template_callback(e):'"}return f}function h(a){var b={};return new tinymce.html.SaxParser({validate:!1,allow_conditional_comments:!0,special:"script,noscript",start:function(a,c){if(b.source1||"param"!=a||(b.source1=c.map.movie),("iframe"==a||"object"==a||"embed"==a||"video"==a||"audio"==a)&&(b.type||(b.type=a),b=tinymce.extend(c.map,b)),"script"==a){var e=d(c.map.src);if(!e)return;b={type:"script",source1:c.map.src,width:e.width,height:e.height}}"source"==a&&(b.source1?b.source2||(b.source2=c.map.src):b.source1=c.map.src),"img"!=a||b.poster||(b.poster=c.map.src)}}).parse(a),b.source1=b.source1||b.src||b.data,b.source2=b.source2||"",b.poster=b.poster||"",b}function i(b){return b.getAttribute("data-mce-object")?h(a.serializer.serialize(b,{selection:!0})):{}}function j(b){if(a.settings.media_filter_html===!1)return b;var c=new tinymce.html.Writer;return new tinymce.html.SaxParser({validate:!1,allow_conditional_comments:!1,special:"script,noscript",comment:function(a){c.comment(a)},cdata:function(a){c.cdata(a)},text:function(a,b){c.text(a,b)},start:function(a,b,d){if("script"!=a&&"noscript"!=a){for(var e=0;e=g&&(d(h,{src:b["source"+g],type:b["source"+g+"mime"]}),!b["source"+g]))return;break;case"img":if(!b.poster)return;e=!0}f.start(a,h,i)},end:function(a){if("video"==a&&c)for(var h=1;2>=h;h++)if(b["source"+h]){var i=[];i.map={},h>g&&(d(i,{src:b["source"+h],type:b["source"+h+"mime"]}),f.start("source",i,!0))}if(b.poster&&"object"==a&&c&&!e){var j=[];j.map={},d(j,{src:b.poster,width:b.width,height:b.height}),f.start("img",j,!0)}f.end(a)}},new tinymce.html.Schema({})).parse(a),f.getContent()}var l=[{regex:/youtu\.be\/([\w\-.]+)/,type:"iframe",w:425,h:350,url:"//www.youtube.com/embed/$1"},{regex:/youtube\.com(.+)v=([^&]+)/,type:"iframe",w:425,h:350,url:"//www.youtube.com/embed/$2"},{regex:/vimeo\.com\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc"},{regex:/vimeo\.com\/(.*)\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$2?title=0&byline=0"},{regex:/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,type:"iframe",w:425,h:350,url:'//maps.google.com/maps/ms?msid=$2&output=embed"'}],m=tinymce.Env.ie&&tinymce.Env.ie<=8?"onChange":"onInput";a.on("ResolveName",function(a){var b;1==a.target.nodeType&&(b=a.target.getAttribute("data-mce-object"))&&(a.name=b)}),a.on("preInit",function(){var b=a.schema.getSpecialElements();tinymce.each("video audio iframe object".split(" "),function(a){b[a]=new RegExp("]*>","gi")});var c=a.schema.getBoolAttrs();tinymce.each("webkitallowfullscreen mozallowfullscreen allowfullscreen".split(" "),function(a){c[a]={}}),a.parser.addNodeFilter("iframe,video,audio,object,embed,script",function(b,c){for(var e,f,g,h,i,j,k,l,m=b.length;m--;)if(f=b[m],f.parent&&("script"!=f.name||(l=d(f.attr("src"))))){for(g=new tinymce.html.Node("img",1),g.shortEnded=!0,l&&(l.width&&f.attr("width",l.width.toString()),l.height&&f.attr("height",l.height.toString())),j=f.attributes,e=j.length;e--;)h=j[e].name,i=j[e].value,"width"!==h&&"height"!==h&&"style"!==h&&(("data"==h||"src"==h)&&(i=a.convertURL(i,h)),g.attr("data-mce-p-"+h,i));k=f.firstChild&&f.firstChild.value,k&&(g.attr("data-mce-html",escape(k)),g.firstChild=null),g.attr({width:f.attr("width")||"300",height:f.attr("height")||("audio"==c?"30":"150"),style:f.attr("style"),src:tinymce.Env.transparentSrc,"data-mce-object":c,"class":"mce-object mce-object-"+c}),f.replace(g)}}),a.serializer.addAttributeFilter("data-mce-object",function(a,b){for(var c,d,e,f,g,h,i,k=a.length;k--;)if(c=a[k],c.parent){for(i=c.attr(b),d=new tinymce.html.Node(i,1),"audio"!=i&&"script"!=i&&d.attr({width:c.attr("width"),height:c.attr("height")}),d.attr({style:c.attr("style")}),f=c.attributes,e=f.length;e--;){var l=f[e].name;0===l.indexOf("data-mce-p-")&&d.attr(l.substr(11),f[e].value)}"script"==i&&d.attr("type","text/javascript"),g=c.attr("data-mce-html"),g&&(h=new tinymce.html.Node("#text",3),h.raw=!0,h.value=j(unescape(g)),d.append(h)),c.replace(d)}})}),a.on("ObjectSelected",function(a){var b=a.target.getAttribute("data-mce-object");("audio"==b||"script"==b)&&a.preventDefault()}),a.on("objectResized",function(a){var b,c=a.target;c.getAttribute("data-mce-object")&&(b=c.getAttribute("data-mce-html"),b&&(b=unescape(b),c.setAttribute("data-mce-html",escape(k(b,{width:a.width,height:a.height})))))}),a.addButton("media",{tooltip:"Insert/edit video",onclick:e,stateSelector:["img[data-mce-object=video]","img[data-mce-object=iframe]"]}),a.addMenuItem("media",{icon:"media",text:"Insert/edit video",onclick:e,context:"insert",prependToContext:!0})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/nonbreaking/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/nonbreaking/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("nonbreaking",function(a){var b=a.getParam("nonbreaking_force_tab");if(a.addCommand("mceNonBreaking",function(){a.insertContent(a.plugins.visualchars&&a.plugins.visualchars.state?' ':" "),a.dom.setAttrib(a.dom.select("span.mce-nbsp"),"data-mce-bogus","1")}),a.addButton("nonbreaking",{title:"Nonbreaking space",cmd:"mceNonBreaking"}),a.addMenuItem("nonbreaking",{text:"Nonbreaking space",cmd:"mceNonBreaking",context:"insert"}),b){var c=+b>1?+b:3;a.on("keydown",function(b){if(9==b.keyCode){if(b.shiftKey)return;b.preventDefault();for(var d=0;c>d;d++)a.execCommand("mceNonBreaking")}})}}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/noneditable/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/noneditable/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("noneditable",function(a){function b(a){var b;if(1===a.nodeType){if(b=a.getAttribute(k),b&&"inherit"!==b)return b;if(b=a.contentEditable,"inherit"!==b)return b}return null}function c(a){for(var c;a;){if(c=b(a))return"false"===c?a:null;a=a.parentNode}}function d(){function d(a){for(;a;){if(a.id===n)return a;a=a.parentNode}}function e(a){var b;if(a)for(b=new i(a,a),a=b.current();a;a=b.next())if(3===a.nodeType)return a}function f(c,d){var e,f;return"false"===b(c)&&k.isBlock(c)?void m.select(c):(f=k.createRng(),"true"===b(c)&&(c.firstChild||c.appendChild(a.getDoc().createTextNode("\xa0")),c=c.firstChild,d=!0),e=k.create("span",{id:n,"data-mce-bogus":!0},o),d?c.parentNode.insertBefore(e,c):k.insertAfter(e,c),f.setStart(e.firstChild,1),f.collapse(!0),m.setRng(f),e)}function g(a){var b,c,d;if(a)b=m.getRng(!0),b.setStartBefore(a),b.setEndBefore(a),c=e(a),c&&c.nodeValue.charAt(0)==o&&(c=c.deleteData(0,1)),k.remove(a,!0),m.setRng(b);else for(;(a=k.get(n))&&a!==d;)c=e(a),c&&c.nodeValue.charAt(0)==o&&(c=c.deleteData(0,1)),k.remove(a,!0),d=a}function h(){function a(a,c){var d,e,f,g,h;if(d=j.startContainer,e=j.startOffset,3==d.nodeType){if(h=d.nodeValue.length,e>0&&h>e||(c?e==h:0===e))return}else{if(!(e0?e-1:e;d=d.childNodes[k],d.hasChildNodes()&&(d=d.firstChild)}for(f=new i(d,a);g=f[c?"prev":"next"]();){if(3===g.nodeType&&g.nodeValue.length>0)return;if("true"===b(g))return g}return a}var d,e,h,j,k;g(),h=m.isCollapsed(),d=c(m.getStart()),e=c(m.getEnd()),(d||e)&&(j=m.getRng(!0),h?(d=d||e,(k=a(d,!0))?f(k,!0):(k=a(d,!1))?f(k,!1):m.select(d)):(j=m.getRng(!0),d&&j.setStartBefore(d),e&&j.setEndAfter(e),m.setRng(j)))}function j(e){function f(a,b){for(;a=a[b?"previousSibling":"nextSibling"];)if(3!==a.nodeType||a.nodeValue.length>0)return a}function j(a,b){m.select(a),m.collapse(b)}function n(e){function f(a){for(var b=j;b;){if(b===a)return;b=b.parentNode}k.remove(a),h()}function g(){var d,g,h=a.schema.getNonEmptyElements();for(g=new tinymce.dom.TreeWalker(j,a.getBody());(d=e?g.prev():g.next())&&!h[d.nodeName.toLowerCase()]&&!(3===d.nodeType&&tinymce.trim(d.nodeValue).length>0);)if("false"===b(d))return f(d),!0;return c(d)?!0:!1}var i,j,l,n;if(m.isCollapsed()){if(i=m.getRng(!0),j=i.startContainer,l=i.startOffset,j=d(j)||j,n=c(j))return f(n),!1;if(3==j.nodeType&&(e?l>0:ls||s>124)&&s!=l.DELETE&&s!=l.BACKSPACE){if((tinymce.isMac?e.metaKey:e.ctrlKey)&&(67==s||88==s||86==s))return;if(e.preventDefault(),u)if(a.dom.isBlock(o)){var w=v?o.previousSibling:o.nextSibling;if(!w||w&&"false"===b(w)){var x=k.create("p",null," ");x.className="mceTmpParagraph";var y=v?o:w;y&&y.parentNode?y.parentNode.insertBefore(x,y):w||v||o.parentNode.appendChild(x),w=x}var z=new i(w,w),A=v?z.prev():z.next();j(A,!v)}else j(o,v)}else if(u||s==l.BACKSPACE||s==l.DELETE){if(p=d(q)){if(s==l.LEFT||s==l.BACKSPACE)if(o=f(p,!0),o&&"false"===b(o)){if(e.preventDefault(),s!=l.LEFT)return void k.remove(o);j(o,!0)}else g(p);if(s==l.RIGHT||s==l.DELETE)if(o=f(p,!0),o&&"false"===b(o)){if(e.preventDefault(),s!=l.RIGHT)return void k.remove(o);j(o,!1)}else g(p)}else{if(u&&t&&-1!==t.className.indexOf("mceTmpParagraph")&&t[v?"previousSibling":"nextSibling"]){var B=t[v?"previousSibling":"nextSibling"];" "===t.innerHTML||""===t.innerHTML||" "===t.innerHTML?k.remove(t):t.className=t.className.replace("mceTmpParagraph",""),j(B,!v)}var C=m.getRng(!0),D=C.endContainer;if(k.isBlock(D)&&k.isBlock(D.nextSibling)&&1==C.endOffset&&s==l.DELETE&&(o=c(D.nextSibling)),o&&(s==l.DELETE||s==l.BACKSPACE)&&k.isBlock(o))return e.preventDefault(),void k.remove(o)}if((s==l.BACKSPACE||s==l.DELETE)&&!n(s==l.BACKSPACE))return e.preventDefault(),!1}}var k=a.dom,m=a.selection,n="mce_noneditablecaret",o="\ufeff";a.on("mousedown",function(c){var d=a.selection.getNode();d&&-1!==d.className.indexOf("mceTmpParagraph")&&d!==c.target&&(" "===d.innerHTML||""===d.innerHTML||" "===d.innerHTML?k.remove(d):d.className=d.className.replace("mceTmpParagraph","")),"false"===b(d)&&d==c.target&&h()}),a.on("mouseup",h),a.on("keydown",j)}function e(b){var c=h.length,d=b.content,e=tinymce.trim(g);if("raw"!=b.format){for(;c--;)d=d.replace(h[c],function(b){var c=arguments,f=c[c.length-2];return f>0&&'"'==d.charAt(f-1)?b:''+a.dom.encode("string"==typeof c[1]?c[1]:c[0])+""});b.content=d}}var f,g,h,i=tinymce.dom.TreeWalker,j="contenteditable",k="data-mce-"+j,l=tinymce.util.VK;f=" "+tinymce.trim(a.getParam("noneditable_editable_class","mceEditable"))+" ",g=" "+tinymce.trim(a.getParam("noneditable_noneditable_class","mceNonEditable"))+" ",h=a.getParam("noneditable_regexp"),h&&!h.length&&(h=[h]),a.on("PreInit",function(){d(),h&&a.on("BeforeSetContent",e),a.parser.addAttributeFilter("class",function(a){for(var b,c,d=a.length;d--;)c=a[d],b=" "+c.attr("class")+" ",-1!==b.indexOf(f)?c.attr(k,"true"):-1!==b.indexOf(g)&&c.attr(k,"false")}),a.serializer.addAttributeFilter(k,function(a){for(var b,c=a.length;c--;)b=a[c],h&&b.attr("data-mce-content")?(b.name="#text",b.type=3,b.raw=!0,b.value=b.attr("data-mce-content")):(b.attr(j,null),b.attr(k,null))}),a.parser.addAttributeFilter(j,function(a){for(var b,c=a.length;c--;)b=a[c],b.attr(k,b.attr(j)),b.attr(j,null)})}),a.on("drop",function(a){c(a.target)&&a.preventDefault()})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/pagebreak/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/pagebreak/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("pagebreak",function(a){var b="mce-pagebreak",c=a.getParam("pagebreak_separator",""),d=new RegExp(c.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(a){return"\\"+a}),"gi"),e='';a.addCommand("mcePageBreak",function(){a.insertContent(a.settings.pagebreak_split_block?"

    "+e+"

    ":e)}),a.addButton("pagebreak",{title:"Page break",cmd:"mcePageBreak"}),a.addMenuItem("pagebreak",{text:"Page break",icon:"pagebreak",cmd:"mcePageBreak",context:"insert"}),a.on("ResolveName",function(c){"IMG"==c.target.nodeName&&a.dom.hasClass(c.target,b)&&(c.name="pagebreak")}),a.on("click",function(c){c=c.target,"IMG"===c.nodeName&&a.dom.hasClass(c,b)&&a.selection.select(c)}),a.on("BeforeSetContent",function(a){a.content=a.content.replace(d,e)}),a.on("PreInit",function(){a.serializer.addNodeFilter("img",function(b){for(var d,e,f=b.length;f--;)if(d=b[f],e=d.attr("class"),e&&-1!==e.indexOf("mce-pagebreak")){var g=d.parent;if(a.schema.getBlockElements()[g.name]&&a.settings.pagebreak_split_block){g.type=3,g.value=c,g.raw=!0,d.remove();continue}d.type=3,d.value=c,d.raw=!0}})})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/paste/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/paste/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +!function(a,b){"use strict";function c(a,b){for(var c,d=[],f=0;f/g]),f(h.parse(e)),i}function f(a){function b(a,b,c){return b||c?"\xa0":" "}return a=d(a,[/^[\s\S]*]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g,/|/g,[/( ?)\u00a0<\/span>( ?)/g,b],/
    $/i])}return{filter:d,innerText:e,trimHtml:f}}),d("tinymce/pasteplugin/Clipboard",["tinymce/Env","tinymce/dom/RangeUtils","tinymce/util/VK","tinymce/pasteplugin/Utils"],function(a,b,c,d){return function(e){function f(a){var b,c=e.dom;if(b=e.fire("BeforePastePreProcess",{content:a}),b=e.fire("PastePreProcess",b),a=b.content,!b.isDefaultPrevented()){if(e.hasEventListeners("PastePostProcess")&&!b.isDefaultPrevented()){var d=c.add(e.getBody(),"div",{style:"display:none"},a);b=e.fire("PastePostProcess",{node:d}),c.remove(d),a=b.node.innerHTML}b.isDefaultPrevented()||e.insertContent(a,{merge:e.settings.paste_merge_formats!==!1})}}function g(a){a=e.dom.encode(a).replace(/\r\n/g,"\n");var b,c=e.dom.getParent(e.selection.getStart(),e.dom.isBlock),g=e.settings.forced_root_block;g&&(b=e.dom.createHTML(g,e.settings.forced_root_block_attrs),b=b.substr(0,b.length-3)+">"),c&&/^(PRE|DIV)$/.test(c.nodeName)||!g?a=d.filter(a,[[/\n/g,"
    "]]):(a=d.filter(a,[[/\n\n/g,"

    "+b],[/^(.*<\/p>)(

    )$/,b+"$1"],[/\n/g,"
    "]]),-1!=a.indexOf("

    ")&&(a=b+a)),f(a)}function h(){function b(a){var b,c,e,f=a.startContainer;if(b=a.getClientRects(),b.length)return b[0];if(a.collapsed&&1==f.nodeType){for(e=f.childNodes[t.startOffset];e&&3==e.nodeType&&!e.data.length;)e=e.nextSibling;if(e)return"BR"==e.tagName&&(c=d.doc.createTextNode("\ufeff"),e.parentNode.insertBefore(c,e),a=d.createRng(),a.setStartBefore(c),a.setEndAfter(c),b=a.getClientRects(),d.remove(c)),b.length?b[0]:void 0}}var c,d=e.dom,f=e.getBody(),g=e.dom.getViewPort(e.getWin()),h=g.y,i=20;if(t=e.selection.getRng(),e.inline&&(c=e.selection.getScrollContainer(),c&&c.scrollTop>0&&(h=c.scrollTop)),t.getClientRects){var j=b(t);if(j)i=h+(j.top-d.getPos(f).y);else{i=h;var k=t.startContainer;k&&(3==k.nodeType&&k.parentNode!=f&&(k=k.parentNode),1==k.nodeType&&(i=d.getPos(k,c||f).y))}}s=d.add(e.getBody(),"div",{id:"mcepastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: absolute; top: "+i+"px;width: 10px; height: 10px; overflow: hidden; opacity: 0"},y),(a.ie||a.gecko)&&d.setStyle(s,"left","rtl"==d.getStyle(f,"direction",!0)?65535:-65535),d.bind(s,"beforedeactivate focusin focusout",function(a){a.stopPropagation()}),s.focus(),e.selection.select(s,!0)}function i(){if(s){for(var a;a=e.dom.get("mcepastebin");)e.dom.remove(a),e.dom.unbind(a);t&&e.selection.setRng(t)}s=t=null}function j(){var a,b,c,d,f="";for(a=e.dom.select("div[id=mcepastebin]"),b=0;b0&&-1==c.indexOf(z)&&(b["text/plain"]=c)}if(a.types)for(var d=0;d')}var g,h,i,j=!1;if(c)for(g=0;g0}function q(a){return c.metaKeyPressed(a)&&86==a.keyCode||a.shiftKey&&45==a.keyCode}function r(){e.on("keydown",function(b){function c(a){q(a)&&!a.isDefaultPrevented()&&i()}if(q(b)&&!b.isDefaultPrevented()){if(u=b.shiftKey&&86==b.keyCode,u&&a.webkit&&-1!=navigator.userAgent.indexOf("Version/"))return;if(b.stopImmediatePropagation(),w=(new Date).getTime(),a.ie&&u)return b.preventDefault(),void e.fire("paste",{ieFake:!0});i(),h(),e.once("keyup",c),e.once("paste",function(){e.off("keyup",c)})}}),e.on("paste",function(b){var c=(new Date).getTime(),k=l(b),o=(new Date).getTime()-c,q=(new Date).getTime()-w-o<1e3,r="text"==v.pasteFormat||u;return u=!1,b.isDefaultPrevented()||n(b)?void i():m(b)?void i():(q||b.preventDefault(),!a.ie||q&&!b.ieFake||(h(),e.dom.bind(s,"paste",function(a){a.stopPropagation()}),e.getDoc().execCommand("Paste",!1,null),k["text/html"]=j()),void setTimeout(function(){var a;return p(k,"text/html")?a=k["text/html"]:(a=j(),a==y&&(r=!0)),a=d.trimHtml(a),s&&s.firstChild&&"mcepastebin"===s.firstChild.id&&(r=!0),i(),a.length||(r=!0),r&&(a=p(k,"text/plain")&&-1==a.indexOf("

    ")?k["text/plain"]:d.innerText(a)),a==y?void(q||e.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.")):void(r?g(a):f(a))},0))}),e.on("dragstart dragend",function(a){x="dragstart"==a.type}),e.on("drop",function(a){var b=o(a);if(!a.isDefaultPrevented()&&!x&&!m(a,b)&&b&&e.settings.paste_filter_drop!==!1){var c=k(a.dataTransfer),h=c["mce-internal"]||c["text/html"]||c["text/plain"];h&&(a.preventDefault(),e.undoManager.transact(function(){c["mce-internal"]&&e.execCommand("Delete"),e.selection.setRng(b),h=d.trimHtml(h),c["text/html"]?f(h):g(h)}))}}),e.on("dragover dragend",function(a){e.settings.paste_data_images&&a.preventDefault()})}var s,t,u,v=this,w=0,x=!1,y="%MCEPASTEBIN%",z="data:text/mce-internal,";v.pasteHtml=f,v.pasteText=g,e.on("preInit",function(){r(),e.parser.addNodeFilter("img",function(b){if(!e.settings.paste_data_images)for(var c=b.length;c--;){var d=b[c].attributes.map.src;d&&/^(data:image|webkit\-fake\-url)/.test(d)&&(b[c].attr("data-mce-object")||d===a.transparentSrc||b[c].remove())}})})}}),d("tinymce/pasteplugin/WordFilter",["tinymce/util/Tools","tinymce/html/DomParser","tinymce/html/Schema","tinymce/html/Serializer","tinymce/html/Node","tinymce/pasteplugin/Utils"],function(a,b,c,d,e,f){function g(a){return/h?g&&(g=g.parent.parent):(j=g,g=null)),g&&g.name==b?g.append(a):(j=j||g,g=new e(b,1),f>1&&g.attr("start",""+f),a.wrap(g)),a.name="li",h>k&&j&&j.lastChild.append(g),k=h,d(a),c(a,/^\u00a0+/),c(a,/^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/),c(a,/^\u00a0+/)}for(var g,j,k=1,l=[],m=a.firstChild;"undefined"!=typeof m&&null!==m;)if(l.push(m),m=m.walk(),null!==m)for(;"undefined"!=typeof m&&m.parent!==a;)m=m.walk();for(var n=0;n]+id="?docs-internal-[^>]*>/gi,""),q=q.replace(/
    /gi,""),o=k.paste_retain_style_properties,o&&(p=a.makeMap(o.split(/[, ]/))),k.paste_enable_default_filters!==!1&&g(l.content)){l.wordContent=!0,q=f.filter(q,[//gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/ /gi,"\xa0"],[/([\s\u00a0]*)<\/span>/gi,function(a,b){return b.length>0?b.replace(/./," ").slice(Math.floor(b.length/2)).split("").join("\xa0"):""}]]);var r=k.paste_word_valid_elements;r||(r="-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody");var s=new c({valid_elements:r,valid_children:"-li[p]"});a.each(s.elements,function(a){a.attributes["class"]||(a.attributes["class"]={},a.attributesOrder.push("class")),a.attributes.style||(a.attributes.style={},a.attributesOrder.push("style"))});var t=new b({},s);t.addAttributeFilter("style",function(a){for(var b,c=a.length;c--;)b=a[c],b.attr("style",n(b,b.attr("style"))),"span"==b.name&&b.parent&&!b.attributes.length&&b.unwrap()}),t.addAttributeFilter("class",function(a){for(var b,c,d=a.length;d--;)b=a[d],c=b.attr("class"),/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(c)&&b.remove(),b.attr("class",null)}),t.addNodeFilter("del",function(a){for(var b=a.length;b--;)a[b].remove()}),t.addNodeFilter("a",function(a){for(var b,c,d,e=a.length;e--;)if(b=a[e],c=b.attr("href"),d=b.attr("name"),c&&-1!=c.indexOf("#_msocom_"))b.remove();else if(c&&0===c.indexOf("file://")&&(c=c.split("#")[1],c&&(c="#"+c)),c||d){if(d&&!/^_?(?:toc|edn|ftn)/i.test(d)){b.unwrap();continue}b.attr({href:c,name:d})}else b.unwrap()});var u=t.parse(q);k.paste_convert_word_fake_lists!==!1&&m(u),l.content=new d({},s).serialize(u)}})}return j.isWordContent=g,j}),d("tinymce/pasteplugin/Quirks",["tinymce/Env","tinymce/util/Tools","tinymce/pasteplugin/WordFilter","tinymce/pasteplugin/Utils"],function(a,b,c,d){return function(e){function f(a){e.on("BeforePastePreProcess",function(b){b.content=a(b.content)})}function g(a){if(!c.isWordContent(a))return a;var f=[];b.each(e.schema.getBlockElements(),function(a,b){f.push(b)});var g=new RegExp("(?:
     [\\s\\r\\n]+|
    )*(<\\/?("+f.join("|")+")[^>]*>)(?:
     [\\s\\r\\n]+|
    )*","g");return a=d.filter(a,[[g,"$1"]]),a=d.filter(a,[[/

    /g,"

    "],[/
    /g," "],[/

    /g,"
    "]])}function h(a){if(c.isWordContent(a))return a;var b=e.settings.paste_webkit_styles;if(e.settings.paste_remove_styles_if_webkit===!1||"all"==b)return a;if(b&&(b=b.split(/[, ]/)),b){var d=e.dom,f=e.selection.getNode();a=a.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,function(a,c,e,g){var h=d.parseStyle(e,"span"),i={};if("none"===b)return c+g;for(var j=0;j]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return a=a.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,function(a,b,c,d){return b+' style="'+c+'"'+d})}a.webkit&&f(h),a.ie&&f(g)}}),d("tinymce/pasteplugin/Plugin",["tinymce/PluginManager","tinymce/pasteplugin/Clipboard","tinymce/pasteplugin/WordFilter","tinymce/pasteplugin/Quirks"],function(a,b,c,d){var e;a.add("paste",function(a){function f(){"text"==g.pasteFormat?(this.active(!1),g.pasteFormat="html"):(g.pasteFormat="text",this.active(!0),e||(a.windowManager.alert("Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off."),e=!0))}var g,h=this,i=a.settings;h.clipboard=g=new b(a),h.quirks=new d(a),h.wordFilter=new c(a),a.settings.paste_as_text&&(h.clipboard.pasteFormat="text"),i.paste_preprocess&&a.on("PastePreProcess",function(a){i.paste_preprocess.call(h,h,a)}),i.paste_postprocess&&a.on("PastePostProcess",function(a){i.paste_postprocess.call(h,h,a)}),a.addCommand("mceInsertClipboardContent",function(a,b){b.content&&h.clipboard.pasteHtml(b.content),b.text&&h.clipboard.pasteText(b.text)}),a.paste_block_drop&&a.on("dragend dragover draggesture dragdrop drop drag",function(a){a.preventDefault(),a.stopPropagation()}),a.settings.paste_data_images||a.on("drop",function(a){var b=a.dataTransfer;b&&b.files&&b.files.length>0&&a.preventDefault()}),a.addButton("pastetext",{icon:"pastetext",tooltip:"Paste as text",onclick:f,active:"text"==h.clipboard.pasteFormat}),a.addMenuItem("pastetext",{text:"Paste as text",selectable:!0,active:g.pasteFormat,onclick:f})})}),f(["tinymce/pasteplugin/Utils"])}(this); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/preview/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/preview/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("preview",function(a){var b=a.settings,c=!tinymce.Env.ie;a.addCommand("mcePreview",function(){a.windowManager.open({title:"Preview",width:parseInt(a.getParam("plugin_preview_width","650"),10),height:parseInt(a.getParam("plugin_preview_height","500"),10),html:'",buttons:{text:"Close",onclick:function(){this.parent().parent().close()}},onPostRender:function(){var d,e="";e+='',tinymce.each(a.contentCSS,function(b){e+=''});var f=b.body_id||"tinymce";-1!=f.indexOf("=")&&(f=a.getParam("body_id","","hash"),f=f[a.id]||f);var g=b.body_class||"";-1!=g.indexOf("=")&&(g=a.getParam("body_class","","hash"),g=g[a.id]||"");var h=a.settings.directionality?' dir="'+a.settings.directionality+'"':"";if(d=""+e+'"+a.getContent()+"",c)this.getEl("body").firstChild.src="data:text/html;charset=utf-8,"+encodeURIComponent(d);else{var i=this.getEl("body").firstChild.contentWindow.document;i.open(),i.write(d),i.close()}}})}),a.addButton("preview",{title:"Preview",cmd:"mcePreview"}),a.addMenuItem("preview",{text:"Preview",cmd:"mcePreview",context:"view"})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/print/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/print/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("print",function(a){a.addCommand("mcePrint",function(){a.getWin().print()}),a.addButton("print",{title:"Print",cmd:"mcePrint"}),a.addShortcut("Meta+P","","mcePrint"),a.addMenuItem("print",{text:"Print",cmd:"mcePrint",icon:"print",shortcut:"Meta+P",context:"file"})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/save/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/save/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("save",function(a){function b(){var b;return b=tinymce.DOM.getParent(a.id,"form"),!a.getParam("save_enablewhendirty",!0)||a.isDirty()?(tinymce.triggerSave(),a.getParam("save_onsavecallback")?void(a.execCallback("save_onsavecallback",a)&&(a.startContent=tinymce.trim(a.getContent({format:"raw"})),a.nodeChanged())):void(b?(a.isNotDirty=!0,(!b.onsubmit||b.onsubmit())&&("function"==typeof b.submit?b.submit():a.windowManager.alert("Error: Form submit field collision.")),a.nodeChanged()):a.windowManager.alert("Error: No form element found."))):void 0}function c(){var b=tinymce.trim(a.startContent);return a.getParam("save_oncancelcallback")?void a.execCallback("save_oncancelcallback",a):(a.setContent(b),a.undoManager.clear(),void a.nodeChanged())}function d(){var b=this;a.on("nodeChange",function(){b.disabled(a.getParam("save_enablewhendirty",!0)&&!a.isDirty())})}a.addCommand("mceSave",b),a.addCommand("mceCancel",c),a.addButton("save",{icon:"save",text:"Save",cmd:"mceSave",disabled:!0,onPostRender:d}),a.addButton("cancel",{text:"Cancel",icon:!1,cmd:"mceCancel",disabled:!0,onPostRender:d}),a.addShortcut("Meta+S","","mceSave")}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/searchreplace/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/searchreplace/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +!function(){function a(a,b,c,d,e){function f(a,b){if(b=b||0,!a[0])throw"findAndReplaceDOMText cannot handle zero-length matches";var c=a.index;if(b>0){var d=a[b];if(!d)throw"Invalid capture group";c+=a[0].indexOf(d),a[0]=d}return[c,c+a[0].length,[a[0]]]}function g(a){var b;if(3===a.nodeType)return a.data;if(n[a.nodeName]&&!m[a.nodeName])return"";if(b="",(m[a.nodeName]||o[a.nodeName])&&(b+="\n"),a=a.firstChild)do b+=g(a);while(a=a.nextSibling);return b}function h(a,b,c){var d,e,f,g,h=[],i=0,j=a,k=b.shift(),l=0;a:for(;;){if((m[j.nodeName]||o[j.nodeName])&&i++,3===j.nodeType&&(!e&&j.length+i>=k[1]?(e=j,g=k[1]-i):d&&h.push(j),!d&&j.length+i>k[0]&&(d=j,f=k[0]-i),i+=j.length),d&&e){if(j=c({startNode:d,startNodeIndex:f,endNode:e,endNodeIndex:g,innerNodes:h,match:k[2],matchIndex:l}),i-=e.length-g,d=null,e=null,h=[],k=b.shift(),l++,!k)break}else{if((!n[j.nodeName]||m[j.nodeName])&&j.firstChild){j=j.firstChild;continue}if(j.nextSibling){j=j.nextSibling;continue}}for(;;){if(j.nextSibling){j=j.nextSibling;break}if(j.parentNode===a)break a;j=j.parentNode}}}function i(a){var b;if("function"!=typeof a){var c=a.nodeType?a:l.createElement(a);b=function(a,b){var d=c.cloneNode(!1);return d.setAttribute("data-mce-index",b),a&&d.appendChild(l.createTextNode(a)),d}}else b=a;return function(a){var c,d,e,f=a.startNode,g=a.endNode,h=a.matchIndex;if(f===g){var i=f;e=i.parentNode,a.startNodeIndex>0&&(c=l.createTextNode(i.data.substring(0,a.startNodeIndex)),e.insertBefore(c,i));var j=b(a.match[0],h);return e.insertBefore(j,i),a.endNodeIndexn;++n){var p=a.innerNodes[n],q=b(p.data,h);p.parentNode.replaceChild(q,p),m.push(q)}var r=b(g.data.substring(0,a.endNodeIndex),h);return e=f.parentNode,e.insertBefore(c,f),e.insertBefore(k,f),e.removeChild(f),e=g.parentNode,e.insertBefore(r,g),e.insertBefore(d,g),e.removeChild(g),r}}var j,k,l,m,n,o,p=[],q=0;if(l=b.ownerDocument,m=e.getBlockElements(),n=e.getWhiteSpaceElements(),o=e.getShortEndedElements(),k=g(b)){if(a.global)for(;j=a.exec(k);)p.push(f(j,d));else j=k.match(a),p.push(f(j,d));return p.length&&(q=p.length,h(b,p,i(c))),q}}function b(b){function c(){function a(){e.statusbar.find("#next").disabled(!g(k+1).length),e.statusbar.find("#prev").disabled(!g(k-1).length)}function c(){tinymce.ui.MessageBox.alert("Could not find the specified string.",function(){e.find("#find")[0].focus()})}var d={},e=tinymce.ui.Factory.create({type:"window",layout:"flex",pack:"center",align:"center",onClose:function(){b.focus(),j.done()},onSubmit:function(b){var f,h,i,l;return b.preventDefault(),h=e.find("#case").checked(),l=e.find("#words").checked(),i=e.find("#find").value(),i.length?d.text==i&&d.caseState==h&&d.wholeWord==l?0===g(k+1).length?void c():(j.next(),void a()):(f=j.find(i,h,l),f||c(),e.statusbar.items().slice(1).disabled(0===f),a(),void(d={text:i,caseState:h,wholeWord:l})):(j.done(!1),void e.statusbar.items().slice(1).disabled(!0))},buttons:[{text:"Find",onclick:function(){e.submit()}},{text:"Replace",disabled:!0,onclick:function(){j.replace(e.find("#replace").value())||(e.statusbar.items().slice(1).disabled(!0),k=-1,d={})}},{text:"Replace all",disabled:!0,onclick:function(){j.replace(e.find("#replace").value(),!0,!0),e.statusbar.items().slice(1).disabled(!0),d={}}},{type:"spacer",flex:1},{text:"Prev",name:"prev",disabled:!0,onclick:function(){j.prev(),a()}},{text:"Next",name:"next",disabled:!0,onclick:function(){j.next(),a()}}],title:"Find and replace",items:{type:"form",padding:20,labelGap:30,spacing:10,items:[{type:"textbox",name:"find",size:40,label:"Find",value:b.selection.getNode().src},{type:"textbox",name:"replace",size:40,label:"Replace with"},{type:"checkbox",name:"case",text:"Match case",label:" "},{type:"checkbox",name:"words",text:"Whole words",label:" "}]}}).renderTo().reflow()}function d(a){var b=a.getAttribute("data-mce-index");return"number"==typeof b?""+b:b}function e(c){var d,e;return e=b.dom.create("span",{"data-mce-bogus":1}),e.className="mce-match-marker",d=b.getBody(),j.done(!1),a(c,d,e,!1,b.schema)}function f(a){var b=a.parentNode;a.firstChild&&b.insertBefore(a.firstChild,a),a.parentNode.removeChild(a)}function g(a){var c,e=[];if(c=tinymce.toArray(b.getBody().getElementsByTagName("span")),c.length)for(var f=0;fk&&l[h].setAttribute("data-mce-index",o-1)}return b.undoManager.add(),k=q,c?(p=g(q+1).length>0,j.next()):(p=g(q-1).length>0,j.prev()),!e&&p},j.done=function(a){var c,e,g,h;for(e=tinymce.toArray(b.getBody().getElementsByTagName("span")),c=0;c=h.end?(e=k,g=h.end-j):d&&i.push(k),!d&&k.length+j>h.start&&(d=k,f=h.start-j),j+=k.length),d&&e){if(k=c({startNode:d,startNodeIndex:f,endNode:e,endNodeIndex:g,innerNodes:i,match:h.text,matchIndex:l}),j-=e.length-g,d=null,e=null,i=[],h=b.shift(),l++,!h)break}else{if((!x[k.nodeName]||w[k.nodeName])&&k.firstChild){k=k.firstChild;continue}if(k.nextSibling){k=k.nextSibling;continue}}for(;;){if(k.nextSibling){k=k.nextSibling;break}if(k.parentNode===a)break a;k=k.parentNode}}}function f(a){function b(b,c){var d=z[c];d.stencil||(d.stencil=a(d));var e=d.stencil.cloneNode(!1);return e.setAttribute("data-mce-index",c),b&&e.appendChild(A.doc.createTextNode(b)),e}return function(a){var c,d,e,f=a.startNode,g=a.endNode,h=a.matchIndex,i=A.doc;if(f===g){var j=f;e=j.parentNode,a.startNodeIndex>0&&(c=i.createTextNode(j.data.substring(0,a.startNodeIndex)),e.insertBefore(c,j));var k=b(a.match,h);return e.insertBefore(k,j),a.endNodeIndexn;++n){var p=a.innerNodes[n],q=b(p.data,h);p.parentNode.replaceChild(q,p),m.push(q)}var r=b(g.data.substring(0,a.endNodeIndex),h);return e=f.parentNode,e.insertBefore(c,f),e.insertBefore(l,f),e.removeChild(f),e=g.parentNode,e.insertBefore(r,g),e.insertBefore(d,g),e.removeChild(g),r}}function g(a){var b=a.parentNode;b.insertBefore(a.firstChild,a),a.parentNode.removeChild(a)}function h(b){var c=a.getElementsByTagName("*"),d=[];b="number"==typeof b?""+b:null;for(var e=0;eb&&a(z[b],b)!==!1;b++);return this}function l(b){return z.length&&e(a,z,f(b)),this}function m(a,b){if(v&&a.global)for(;u=a.exec(v);)z.push(c(u,b));return this}function n(a){var b,c=h(a?i(a):null);for(b=c.length;b--;)g(c[b]);return this}function o(a){return z[a.getAttribute("data-mce-index")]}function p(a){return h(i(a))[0]}function q(a,b,c){return z.push({start:a,end:a+b,text:v.substr(a,b),data:c}),this}function r(a){var c=h(i(a)),d=b.dom.createRng();return d.setStartBefore(c[0]),d.setEndAfter(c[c.length-1]),d}function s(a,c){var d=r(a);return d.deleteContents(),c.length>0&&d.insertNode(b.dom.doc.createTextNode(c)),d}function t(){return z.splice(0,z.length),n(),this}var u,v,w,x,y,z=[],A=b.dom;return w=b.schema.getBlockElements(),x=b.schema.getWhiteSpaceElements(),y=b.schema.getShortEndedElements(),v=d(a),{text:v,matches:z,each:k,filter:j,reset:t,matchFromElement:o,elementFromMatch:p,find:m,add:q,wrap:l,unwrap:n,replace:s,rangeFromMatch:r,indexOf:i}}}),d("tinymce/spellcheckerplugin/Plugin",["tinymce/spellcheckerplugin/DomTextMatcher","tinymce/PluginManager","tinymce/util/Tools","tinymce/ui/Menu","tinymce/dom/DOMUtils","tinymce/util/XHR","tinymce/util/URI","tinymce/util/JSON"],function(a,b,c,d,e,f,g,h){b.add("spellchecker",function(b,i){function j(){return E.textMatcher||(E.textMatcher=new a(b.getBody(),b)),E.textMatcher}function k(a,b){var d=[];return c.each(b,function(a){d.push({selectable:!0,text:a.name,data:a.value})}),d}function l(a){for(var b in a)return!1;return!0}function m(a,f){var g=[],h=A[a];c.each(h,function(a){g.push({text:a,onclick:function(){b.insertContent(b.dom.encode(a)),b.dom.remove(f),r()}})}),g.push({text:"-"}),D&&g.push({text:"Add to Dictionary",onclick:function(){s(a,f)}}),g.push.apply(g,[{text:"Ignore",onclick:function(){t(a,f)}},{text:"Ignore all",onclick:function(){t(a,f,!0)}}]),C=new d({items:g,context:"contextmenu",onautohide:function(a){-1!=a.target.className.indexOf("spellchecker")&&a.preventDefault()},onhide:function(){C.remove(),C=null}}),C.renderTo(document.body);var i=e.DOM.getPos(b.getContentAreaContainer()),j=b.dom.getPos(f[0]),k=b.dom.getRoot();"BODY"==k.nodeName?(j.x-=k.ownerDocument.documentElement.scrollLeft||k.scrollLeft,j.y-=k.ownerDocument.documentElement.scrollTop||k.scrollTop):(j.x-=k.scrollLeft,j.y-=k.scrollTop),i.x+=j.x,i.y+=j.y,C.moveTo(i.x,i.y+f[0].offsetHeight)}function n(){return b.getParam("spellchecker_wordchar_pattern")||new RegExp('[^\\s!"#$%&()*+,-./:;<=>?@[\\]^_{|}`\xa7\xa9\xab\xae\xb1\xb6\xb7\xb8\xbb\xbc\xbd\xbe\xbf\xd7\xf7\xa4\u201d\u201c\u201e\xa0\u2002\u2003\u2009]+',"g")}function o(a,b,d,e){var j={method:a},k="";"spellcheck"==a&&(j.text=b,j.lang=F.spellchecker_language),"addToDictionary"==a&&(j.word=b),c.each(j,function(a,b){k&&(k+="&"),k+=b+"="+encodeURIComponent(a)}),f.send({url:new g(i).toAbsolute(F.spellchecker_rpc_url),type:"post",content_type:"application/x-www-form-urlencoded",data:k,success:function(a){a=h.parse(a),a?a.error?e(a.error):d(a):e("Sever response wasn't proper JSON.")},error:function(a,b){e("Spellchecker request error: "+b.status)}})}function p(a,b,c,d){var e=F.spellchecker_callback||o;e.call(E,a,b,c,d)}function q(){function a(a){b.windowManager.alert(a),b.setProgressState(!1),u()}return B?void u():(u(),b.setProgressState(!0),p("spellcheck",j().text,y,a),void b.focus())}function r(){b.dom.select("span.mce-spellchecker-word").length||u()}function s(a,c){b.setProgressState(!0),p("addToDictionary",a,function(){b.setProgressState(!1),b.dom.remove(c,!0),r()},function(a){b.windowManager.alert(a),b.setProgressState(!1)})}function t(a,d,e){b.selection.collapse(),e?c.each(b.dom.select("span.mce-spellchecker-word"),function(c){c.getAttribute("data-mce-word")==a&&b.dom.remove(c,!0)}):b.dom.remove(d,!0),r()}function u(){j().reset(),E.textMatcher=null,B&&(B=!1,b.fire("SpellcheckEnd"))}function v(a){var b=a.getAttribute("data-mce-index");return"number"==typeof b?""+b:b}function w(a){var d,e=[];if(d=c.toArray(b.getBody().getElementsByTagName("span")),d.length)for(var f=0;f0){var e=b.dom.createRng();e.setStartBefore(d[0]),e.setEndAfter(d[d.length-1]),b.selection.setRng(e),m(c.getAttribute("data-mce-word"),d)}}}),b.addMenuItem("spellchecker",{text:"Spellcheck",context:"tools",onclick:q,selectable:!0,onPostRender:function(){var a=this;a.active(B),b.on("SpellcheckStart SpellcheckEnd",function(){a.active(B)})}});var H={tooltip:"Spellcheck",onclick:q,onPostRender:function(){var a=this;b.on("SpellcheckStart SpellcheckEnd",function(){a.active(B)})}};z.length>1&&(H.type="splitbutton",H.menu=z,H.onshow=x,H.onselect=function(a){F.spellchecker_language=a.control.settings.data}),b.addButton("spellchecker",H),b.addCommand("mceSpellCheck",q),b.on("remove",function(){C&&(C.remove(),C=null)}),b.on("change",r),this.getTextMatcher=j,this.getWordCharPattern=n,this.markErrors=y,this.getLanguage=function(){return F.spellchecker_language},F.spellchecker_language=F.spellchecker_language||F.language||"en"})}),f(["tinymce/spellcheckerplugin/DomTextMatcher"])}(this); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/tabfocus/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/tabfocus/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("tabfocus",function(a){function b(a){9!==a.keyCode||a.ctrlKey||a.altKey||a.metaKey||a.preventDefault()}function c(b){function c(c){function f(a){return"BODY"===a.nodeName||"hidden"!=a.type&&"none"!=a.style.display&&"hidden"!=a.style.visibility&&f(a.parentNode)}function i(a){return/INPUT|TEXTAREA|BUTTON/.test(a.tagName)&&tinymce.get(b.id)&&-1!=a.tabIndex&&f(a)}if(h=d.select(":input:enabled,*[tabindex]:not(iframe)"),e(h,function(b,c){return b.id==a.id?(g=c,!1):void 0}),c>0){for(j=g+1;j=0;j--)if(i(h[j]))return h[j];return null}var g,h,i,j;if(!(9!==b.keyCode||b.ctrlKey||b.altKey||b.metaKey||b.isDefaultPrevented())&&(i=f(a.getParam("tab_focus",a.getParam("tabfocus_elements",":prev,:next"))),1==i.length&&(i[1]=i[0],i[0]=":prev"),h=b.shiftKey?":prev"==i[0]?c(-1):d.get(i[0]):":next"==i[1]?c(1):d.get(i[1]))){var k=tinymce.get(h.id||h.name);h.id&&k?k.focus():window.setTimeout(function(){tinymce.Env.webkit||window.focus(),h.focus()},10),b.preventDefault()}}var d=tinymce.DOM,e=tinymce.each,f=tinymce.explode;a.on("init",function(){a.inline&&tinymce.DOM.setAttrib(a.getBody(),"tabIndex",null),a.on("keyup",b),tinymce.Env.gecko?a.on("keypress keydown",c):a.on("keydown",c)})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/table/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/table/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +!function(a,b){"use strict";function c(a,b){for(var c,d=[],g=0;g "+b+" tr",g);e(c,function(c,f){f+=a,e(L.select("> td, > th",c),function(a,c){var e,g,h,i;if(F[f])for(;F[f][c];)c++;for(h=d(a,"rowspan"),i=d(a,"colspan"),g=f;f+h>g;g++)for(F[g]||(F[g]=[]),e=c;c+i>e;e++)F[g][e]={part:b,real:g==f&&e==c,elm:a,rowspan:h,colspan:i};G=Math.max(G,c+1)})}),a+=c.length})}function i(a,b){return a=a.cloneNode(b),a.removeAttribute("id"),a}function j(a,b){var c;return c=F[b],c?c[a]:void 0}function k(a,b,c){a&&(c=parseInt(c,10),1===c?a.removeAttribute(b,1):a.setAttribute(b,c,1))}function l(a){return a&&(L.hasClass(a.elm,"mce-item-selected")||a==J)}function m(){var a=[];return e(g.rows,function(b){e(b.cells,function(c){return L.hasClass(c,"mce-item-selected")||J&&c==J.elm?(a.push(b),!1):void 0})}),a}function n(){var a=L.createRng();a.setStartAfter(g),a.setEndAfter(g),K.setRng(a),L.remove(g)}function o(b){var d,g={};return f.settings.table_clone_elements!==!1&&(g=a.makeMap((f.settings.table_clone_elements||"strong em b i span font h1 h2 h3 h4 h5 h6 p div").toUpperCase(),/[ ,]/)),a.walk(b,function(a){var f;return 3==a.nodeType?(e(L.getParents(a.parentNode,null,b).reverse(),function(a){g[a.nodeName]&&(a=i(a,!1),d?f&&f.appendChild(a):d=f=a,f=a)}),f&&(f.innerHTML=c.ie?" ":'
    '),!1):void 0},"childNodes"),b=i(b,!1),k(b,"rowSpan",1),k(b,"colSpan",1),d?b.appendChild(d):(!c.ie||c.ie>10)&&(b.innerHTML='
    '),b}function p(){var a,b=L.createRng();return e(L.select("tr",g),function(a){0===a.cells.length&&L.remove(a)}),0===L.select("tr",g).length?(b.setStartBefore(g),b.setEndBefore(g),K.setRng(b),void L.remove(g)):(e(L.select("thead,tbody,tfoot",g),function(a){0===a.rows.length&&L.remove(a)}),h(),void(H&&(a=F[Math.min(F.length-1,H.y)],a&&(K.select(a[Math.min(a.length-1,H.x)].elm,!0),K.collapse(!0)))))}function q(a,b,c,d){var e,f,g,h,i;for(e=F[b][a].elm.parentNode,g=1;c>=g;g++)if(e=L.getNext(e,"tr")){for(f=a;f>=0;f--)if(i=F[b+g][f].elm,i.parentNode==e){for(h=1;d>=h;h++)L.insertAfter(o(i),i);break}if(-1==f)for(h=1;d>=h;h++)e.insertBefore(o(e.cells[0]),e.cells[0])}}function r(){e(F,function(a,b){e(a,function(a,c){var e,f,g;if(l(a)&&(a=a.elm,e=d(a,"colspan"),f=d(a,"rowspan"),e>1||f>1)){for(k(a,"rowSpan",1),k(a,"colSpan",1),g=0;e-1>g;g++)L.insertAfter(o(a),a);q(c,b,f-1,e)}})})}function s(b,c,d){var f,g,i,m,n,o,q,s,t,u,v;if(b?(f=A(b),g=f.x,i=f.y,m=g+(c-1),n=i+(d-1)):(H=I=null,e(F,function(a,b){e(a,function(a,c){l(a)&&(H||(H={x:c,y:b}),I={x:c,y:b})})}),H&&(g=H.x,i=H.y,m=I.x,n=I.y)),s=j(g,i),t=j(m,n),s&&t&&s.part==t.part){for(r(),h(),s=j(g,i).elm,k(s,"colSpan",m-g+1),k(s,"rowSpan",n-i+1),q=i;n>=q;q++)for(o=g;m>=o;o++)F[q]&&F[q][o]&&(b=F[q][o].elm,b!=s&&(u=a.grep(b.childNodes),e(u,function(a){s.appendChild(a)}),u.length&&(u=a.grep(s.childNodes),v=0,e(u,function(a){"BR"==a.nodeName&&L.getAttrib(a,"data-mce-bogus")&&v++0&&F[c-1][h]&&(p=F[c-1][h].elm,q=d(p,"rowSpan"),q>1)){k(p,"rowSpan",q+1);continue}}else if(q=d(f,"rowspan"),q>1){k(f,"rowSpan",q+1);continue}n=o(f),k(n,"colSpan",f.colSpan),m.appendChild(n),g=f}m.hasChildNodes()&&(a?j.parentNode.insertBefore(m,j):L.insertAfter(m,j))}}function u(a){var b,c;e(F,function(c){return e(c,function(c,d){return l(c)&&(b=d,a)?!1:void 0}),a?!b:void 0}),e(F,function(e,f){var g,h,i;e[b]&&(g=e[b].elm,g!=c&&(i=d(g,"colspan"),h=d(g,"rowspan"),1==i?a?(g.parentNode.insertBefore(o(g),g),q(b,f,h-1,i)):(L.insertAfter(o(g),g),q(b,f,h-1,i)):k(g,"colSpan",g.colSpan+1),c=g))})}function v(){var b=[];e(F,function(c){e(c,function(c,f){l(c)&&-1===a.inArray(b,f)&&(e(F,function(a){var b,c=a[f].elm;b=d(c,"colSpan"),b>1?k(c,"colSpan",b-1):L.remove(c)}),b.push(f))})}),p()}function w(){function a(a){var b,c;e(a.cells,function(a){var c=d(a,"rowSpan");c>1&&(k(a,"rowSpan",c-1),b=A(a),q(b.x,b.y,1,1))}),b=A(a.cells[0]),e(F[b.y],function(a){var b;a=a.elm,a!=c&&(b=d(a,"rowSpan"),1>=b?L.remove(a):k(a,"rowSpan",b-1),c=a)})}var b;b=m(),e(b.reverse(),function(b){a(b)}),p()}function x(){var a=m();return L.remove(a),p(),a}function y(){var a=m();return e(a,function(b,c){a[c]=i(b,!0)}),a}function z(a,b){var c=m(),d=c[b?0:c.length-1],f=d.cells.length;a&&(e(F,function(a){var b;return f=0,e(a,function(a){a.real&&(f+=a.colspan),a.elm.parentNode==d&&(b=1)}),b?!1:void 0}),b||a.reverse(),e(a,function(a){var c,e,g=a.cells.length;for(c=0;g>c;c++)e=a.cells[c],k(e,"colSpan",1),k(e,"rowSpan",1);for(c=g;f>c;c++)a.appendChild(o(a.cells[g-1]));for(c=f;g>c;c++)L.remove(a.cells[c]);b?d.parentNode.insertBefore(a,d):L.insertAfter(a,d)}),L.removeClass(L.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"))}function A(a){var b;return e(F,function(c,d){return e(c,function(c,e){return c.elm==a?(b={x:e,y:d},!1):void 0}),!b}),b}function B(a){H=A(a)}function C(){var a,b;return a=b=0,e(F,function(c,d){e(c,function(c,e){var f,g;l(c)&&(c=F[d][e],e>a&&(a=e),d>b&&(b=d),c.real&&(f=c.colspan-1,g=c.rowspan-1,f&&e+f>a&&(a=e+f),g&&d+g>b&&(b=d+g)))})}),{x:a,y:b}}function D(a){var b,c,d,e,f,g,h,i,j,k;if(I=A(a),H&&I){for(b=Math.min(H.x,I.x),c=Math.min(H.y,I.y),d=Math.max(H.x,I.x),e=Math.max(H.y,I.y),f=d,g=e,k=c;g>=k;k++)a=F[k][b],a.real||b-(a.colspan-1)=j;j++)a=F[c][j],a.real||c-(a.rowspan-1)=k;k++)for(j=b;d>=j;j++)a=F[k][j],a.real&&(h=a.colspan-1,i=a.rowspan-1,h&&j+h>f&&(f=j+h),i&&k+i>g&&(g=k+i));for(L.removeClass(L.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"),k=c;g>=k;k++)for(j=b;f>=j;j++)F[k][j]&&L.addClass(F[k][j].elm,"mce-item-selected")}}function E(a,b){var c,d,e;c=A(a),d=c.y*G+c.x;do{if(d+=b,e=j(d%G,Math.floor(d/G)),!e)break;if(e.elm!=a)return K.select(e.elm,!0),L.isEmpty(e.elm)&&K.collapse(!0),!0}while(e.elm==a);return!1}var F,G,H,I,J,K=f.selection,L=K.dom;g=g||L.getParent(K.getStart(),"table"),h(),J=L.getParent(K.getStart(),"th,td"),J&&(H=A(J),I=C(),J=j(H.x,H.y)),a.extend(this,{deleteTable:n,split:r,merge:s,insertRow:t,insertCol:u,deleteCols:v,deleteRows:w,cutRows:x,copyRows:y,pasteRows:z,getPos:A,setStartCell:B,setEndCell:D,moveRelIdx:E,refresh:h})}}),d("tinymce/tableplugin/Quirks",["tinymce/util/VK","tinymce/Env","tinymce/util/Tools"],function(a,b,c){function d(a,b){return parseInt(a.getAttribute(b)||1,10)}var e=c.each;return function(c){function f(){function b(b){function f(a,d){var e=a?"previousSibling":"nextSibling",f=c.dom.getParent(d,"tr"),h=f[e];if(h)return q(c,d,h,a),b.preventDefault(),!0;var k=c.dom.getParent(f,"table"),l=f.parentNode,m=l.nodeName.toLowerCase();if("tbody"===m||m===(a?"tfoot":"thead")){var n=g(a,k,l,"tbody");if(null!==n)return i(a,n,d)}return j(a,f,e,k)}function g(a,b,d,e){var f=c.dom.select(">"+e,b),g=f.indexOf(d);if(a&&0===g||!a&&g===f.length-1)return h(a,b);if(-1===g){var i="thead"===d.tagName.toLowerCase()?0:f.length-1;return f[i]}return f[g+(a?-1:1)]}function h(a,b){var d=a?"thead":"tfoot",e=c.dom.select(">"+d,b);return 0!==e.length?e[0]:null}function i(a,d,e){var f=k(d,a);return f&&q(c,e,f,a),b.preventDefault(),!0}function j(a,d,e,g){var h=g[e];if(h)return l(h),!0;var i=c.dom.getParent(g,"td,th");if(i)return f(a,i,b);var j=k(d,!a);return l(j),b.preventDefault(),!1}function k(a,b){var d=a&&a[b?"lastChild":"firstChild"];return d&&"BR"===d.nodeName?c.dom.getParent(d,"td,th"):d}function l(a){c.selection.setCursorLocation(a,0)}function m(){return t==a.UP||t==a.DOWN}function n(a){var b=a.selection.getNode(),c=a.dom.getParent(b,"tr");return null!==c}function o(a){for(var b=0,c=a;c.previousSibling;)c=c.previousSibling,b+=d(c,"colspan");return b}function p(a,b){var c=0,f=0;return e(a.children,function(a,e){return c+=d(a,"colspan"),f=e,c>b?!1:void 0}),f}function q(a,b,d,e){var f=o(c.dom.getParent(b,"td,th")),g=p(d,f),h=d.childNodes[g],i=k(h,e);l(i||h)}function r(a){var b=c.selection.getNode(),d=c.dom.getParent(b,"td,th"),e=c.dom.getParent(a,"td,th");return d&&d!==e&&s(d,e)}function s(a,b){return c.dom.getParent(a,"TABLE")===c.dom.getParent(b,"TABLE")}var t=b.keyCode;if(m()&&n(c)){var u=c.selection.getNode();setTimeout(function(){r(u)&&f(!b.shiftKey&&t===a.UP,u,b)},0)}}c.on("KeyDown",function(a){b(a)})}function g(){function a(a,b){var c,d=b.ownerDocument,e=d.createRange();return e.setStartBefore(b),e.setEnd(a.endContainer,a.endOffset),c=d.createElement("body"),c.appendChild(e.cloneContents()),0===c.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length}c.on("KeyDown",function(b){var d,e,f=c.dom;(37==b.keyCode||38==b.keyCode)&&(d=c.selection.getRng(),e=f.getParent(d.startContainer,"table"),e&&c.getBody().firstChild==e&&a(d,e)&&(d=f.createRng(),d.setStartBefore(e),d.setEndBefore(e),c.selection.setRng(d),b.preventDefault()))})}function h(){c.on("KeyDown SetContent VisualAid",function(){var a;for(a=c.getBody().lastChild;a;a=a.previousSibling)if(3==a.nodeType){if(a.nodeValue.length>0)break}else if(1==a.nodeType&&("BR"==a.tagName||!a.getAttribute("data-mce-bogus")))break;a&&"TABLE"==a.nodeName&&(c.settings.forced_root_block?c.dom.add(c.getBody(),c.settings.forced_root_block,c.settings.forced_root_block_attrs,b.ie&&b.ie<11?" ":'
    '):c.dom.add(c.getBody(),"br",{"data-mce-bogus":"1"}))}),c.on("PreProcess",function(a){var b=a.node.lastChild;b&&("BR"==b.nodeName||1==b.childNodes.length&&("BR"==b.firstChild.nodeName||"\xa0"==b.firstChild.nodeValue))&&b.previousSibling&&"TABLE"==b.previousSibling.nodeName&&c.dom.remove(b)})}function i(){function a(a,b,c,d){var e,f,g,h=3,i=a.dom.getParent(b.startContainer,"TABLE");return i&&(e=i.parentNode),f=b.startContainer.nodeType==h&&0===b.startOffset&&0===b.endOffset&&d&&("TR"==c.nodeName||c==e),g=("TD"==c.nodeName||"TH"==c.nodeName)&&!d,f||g}function b(){var b=c.selection.getRng(),d=c.selection.getNode(),e=c.dom.getParent(b.startContainer,"TD,TH");if(a(c,b,d,e)){e||(e=d);for(var f=e.lastChild;f.lastChild;)f=f.lastChild;3==f.nodeType&&(b.setEnd(f,f.data.length),c.selection.setRng(b))}}c.on("KeyDown",function(){b()}),c.on("MouseDown",function(a){2!=a.button&&b()})}function j(){c.on("keydown",function(b){if((b.keyCode==a.DELETE||b.keyCode==a.BACKSPACE)&&!b.isDefaultPrevented()){var d=c.dom.getParent(c.selection.getStart(),"table");if(d){for(var e=c.dom.select("td,th",d),f=e.length;f--;)if(!c.dom.hasClass(e[f],"mce-item-selected"))return;b.preventDefault(),c.execCommand("mceTableDelete")}}})}j(),b.webkit&&(f(),i()),b.gecko&&(g(),h()),b.ie>10&&(g(),h())}}),d("tinymce/tableplugin/CellSelection",["tinymce/tableplugin/TableGrid","tinymce/dom/TreeWalker","tinymce/util/Tools"],function(a,b,c){return function(d){function e(a){d.getBody().style.webkitUserSelect="",(a||l)&&(d.dom.removeClass(d.dom.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"),l=!1)}function f(b){var c,e,f=b.target;if(!j&&h&&(g||f!=h)&&("TD"==f.nodeName||"TH"==f.nodeName)){e=k.getParent(f,"table"),e==i&&(g||(g=new a(d,e),g.setStartCell(h),d.getBody().style.webkitUserSelect="none"),g.setEndCell(f),l=!0),c=d.selection.getSel();try{c.removeAllRanges?c.removeAllRanges():c.empty()}catch(m){}b.preventDefault()}}var g,h,i,j,k=d.dom,l=!0;return d.on("MouseDown",function(a){2==a.button||j||(e(),h=k.getParent(a.target,"td,th"),i=k.getParent(h,"table"))}),d.on("mouseover",f),d.on("remove",function(){k.unbind(d.getDoc(),"mouseover",f)}),d.on("MouseUp",function(){function a(a,d){var f=new b(a,a);do{if(3==a.nodeType&&0!==c.trim(a.nodeValue).length)return void(d?e.setStart(a,0):e.setEnd(a,a.nodeValue.length));if("BR"==a.nodeName)return void(d?e.setStartBefore(a):e.setEndBefore(a))}while(a=d?f.next():f.prev())}var e,f,j,l,m,n=d.selection;if(h){if(g&&(d.getBody().style.webkitUserSelect=""),f=k.select("td.mce-item-selected,th.mce-item-selected"),f.length>0){e=k.createRng(),l=f[0],e.setStartBefore(l),e.setEndAfter(l),a(l,1),j=new b(l,k.getParent(f[0],"table"));do if("TD"==l.nodeName||"TH"==l.nodeName){if(!k.hasClass(l,"mce-item-selected"))break;m=l}while(l=j.next());a(m),n.setRng(e)}d.nodeChanged(),h=g=i=null}}),d.on("KeyUp Drop SetContent",function(a){e("setcontent"==a.type),h=g=i=null,j=!1}),d.on("ObjectResizeStart ObjectResized",function(a){j="objectresized"!=a.type}),{clear:e}}}),d("tinymce/tableplugin/Dialogs",["tinymce/util/Tools","tinymce/Env"],function(a,b){var c=a.each;return function(d){function e(){var a=d.settings.color_picker_callback;return a?function(){var b=this;a.call(d,function(a){b.value(a).fire("change")},b.value())}:void 0}function f(a){return{title:"Advanced",type:"form",defaults:{onchange:function(){l(a,this.parents().reverse()[0],"style"==this.name())}},items:[{label:"Style",name:"style",type:"textbox"},{type:"form",padding:0,formItemDefaults:{layout:"grid",alignH:["start","right"]},defaults:{size:7},items:[{label:"Border color",type:"colorbox",name:"borderColor",onaction:e()},{label:"Background color",type:"colorbox",name:"backgroundColor",onaction:e()}]}]}}function g(a){return a?a.replace(/px$/,""):""}function h(a){return/^[0-9]+$/.test(a)&&(a+="px"),a}function i(a){c("left center right".split(" "),function(b){d.formatter.remove("align"+b,{},a)})}function j(a){c("top middle bottom".split(" "),function(b){d.formatter.remove("valign"+b,{},a)})}function k(b,c,d){function e(b,d){return d=d||[],a.each(b,function(a){var b={text:a.text||a.title};a.menu?b.menu=e(a.menu):(b.value=a.value,c&&c(b)),d.push(b)}),d}return e(b,d||[])}function l(a,b,c){var d=b.toJSON(),e=a.parseStyle(d.style);c?(b.find("#borderColor").value(e["border-color"]||"")[0].fire("change"),b.find("#backgroundColor").value(e["background-color"]||"")[0].fire("change")):(e["border-color"]=d.borderColor,e["background-color"]=d.backgroundColor),b.find("#style").value(a.serializeStyle(a.parseStyle(a.serializeStyle(e))))}function m(a,b,c){var d=a.parseStyle(a.getAttrib(c,"style"));d["border-color"]&&(b.borderColor=d["border-color"]),d["background-color"]&&(b.backgroundColor=d["background-color"]),b.style=a.serializeStyle(d)}function n(a,b,d){var e=a.parseStyle(a.getAttrib(b,"style"));c(d,function(a){e[a.name]=a.value}),a.setAttrib(b,"style",a.serializeStyle(a.parseStyle(a.serializeStyle(e))))}var o=this;o.tableProps=function(){o.table(!0)},o.table=function(e){function j(){function c(a,b,d){if("TD"===a.tagName||"TH"===a.tagName)v.setStyle(a,b,d);else if(a.children)for(var e=0;e',p.insertBefore(e,p.firstChild)),i(p),w.align&&d.formatter.apply("align"+w.align,{},p),d.focus(),d.addVisual()})}function o(a,b){function c(a,c){for(var d=0;dc;c++){for(f+="",d=0;a>d;d++)f+=""+(g.ie?" ":"
    ")+"";f+=""}return f+="",e.undoManager.transact(function(){e.insertContent(f),h=e.dom.get("__mce"),e.dom.setAttrib(h,"id",null),e.dom.setAttribs(h,e.settings.table_default_attributes||{}),e.dom.setStyles(h,e.settings.table_default_styles||{})}),h}function i(a,b){function c(){a.disabled(!e.dom.getParent(e.selection.getStart(),b)),e.selection.selectorChanged(b,function(b){a.disabled(!b)})}e.initialized?c():e.on("init",c)}function k(){i(this,"table")}function l(){i(this,"td,th")}function m(){var a="";a='';for(var b=0;10>b;b++){a+="";for(var c=0;10>c;c++)a+='';a+=""}return a+="
    ",a+=''}function n(a,b,c){var d,f,g,h,i,j=c.getEl().getElementsByTagName("table")[0],k=c.isRtl()||"tl-tr"==c.parent().rel;for(j.nextSibling.innerHTML=a+1+" x "+(b+1),k&&(a=9-a),f=0;10>f;f++)for(d=0;10>d;d++)h=j.rows[f].childNodes[d].firstChild,i=(k?d>=a:a>=d)&&b>=f,e.dom.toggleClass(h,"mce-active",i),i&&(g=h);return g.parentNode}var o,p=this,q=new d(e);e.settings.table_grid===!1?e.addMenuItem("inserttable",{text:"Insert table",icon:"table",context:"table",onclick:q.table}):e.addMenuItem("inserttable",{text:"Insert table",icon:"table",context:"table",ariaHideMenu:!0,onclick:function(a){a.aria&&(this.parent().hideAll(),a.stopImmediatePropagation(),q.table())},onshow:function(){n(0,0,this.menu.items()[0])},onhide:function(){var a=this.menu.items()[0].getEl().getElementsByTagName("a");e.dom.removeClass(a,"mce-active"),e.dom.addClass(a[0],"mce-active")},menu:[{type:"container",html:m(),onPostRender:function(){this.lastX=this.lastY=0},onmousemove:function(a){var b,c,d=a.target;"A"==d.tagName.toUpperCase()&&(b=parseInt(d.getAttribute("data-mce-x"),10),c=parseInt(d.getAttribute("data-mce-y"),10),(this.isRtl()||"tl-tr"==this.parent().rel)&&(b=9-b),(b!==this.lastX||c!==this.lastY)&&(n(b,c,a.control),this.lastX=b,this.lastY=c))},onclick:function(a){var b=this;"A"==a.target.tagName.toUpperCase()&&(a.preventDefault(),a.stopPropagation(),b.parent().cancel(),e.undoManager.transact(function(){h(b.lastX+1,b.lastY+1)}),e.addVisual())}}]}),e.addMenuItem("tableprops",{text:"Table properties",context:"table",onPostRender:k,onclick:q.tableProps}),e.addMenuItem("deletetable",{text:"Delete table",context:"table",onPostRender:k,cmd:"mceTableDelete"}),e.addMenuItem("cell",{separator:"before",text:"Cell",context:"table",menu:[{text:"Cell properties",onclick:f("mceTableCellProps"),onPostRender:l},{text:"Merge cells",onclick:f("mceTableMergeCells"),onPostRender:l},{text:"Split cell",onclick:f("mceTableSplitCells"),onPostRender:l}]}),e.addMenuItem("row",{text:"Row",context:"table",menu:[{text:"Insert row before",onclick:f("mceTableInsertRowBefore"),onPostRender:l},{text:"Insert row after",onclick:f("mceTableInsertRowAfter"),onPostRender:l},{text:"Delete row",onclick:f("mceTableDeleteRow"),onPostRender:l},{text:"Row properties",onclick:f("mceTableRowProps"),onPostRender:l},{text:"-"},{text:"Cut row",onclick:f("mceTableCutRow"),onPostRender:l},{text:"Copy row",onclick:f("mceTableCopyRow"),onPostRender:l},{text:"Paste row before",onclick:f("mceTablePasteRowBefore"),onPostRender:l},{text:"Paste row after",onclick:f("mceTablePasteRowAfter"),onPostRender:l}]}),e.addMenuItem("column",{text:"Column",context:"table",menu:[{text:"Insert column before",onclick:f("mceTableInsertColBefore"),onPostRender:l},{text:"Insert column after",onclick:f("mceTableInsertColAfter"),onPostRender:l},{text:"Delete column",onclick:f("mceTableDeleteCol"),onPostRender:l}]});var r=[];j("inserttable tableprops deletetable | cell row column".split(" "),function(a){r.push("|"==a?{text:"-"}:e.menuItems[a])}),e.addButton("table",{type:"menubutton",title:"Table",menu:r}),g.isIE||e.on("click",function(a){a=a.target,"TABLE"===a.nodeName&&(e.selection.select(a),e.nodeChanged())}),p.quirks=new b(e),e.on("Init",function(){p.cellSelection=new c(e)}),e.on("PreInit",function(){e.serializer.addAttributeFilter("data-mce-cell-padding,data-mce-border,data-mce-border-color",function(a,b){for(var c=a.length;c--;)a[c].attr(b,null)})}),j({mceTableSplitCells:function(a){a.split()},mceTableMergeCells:function(a){var b;b=e.dom.getParent(e.selection.getStart(),"th,td"),e.dom.select("td.mce-item-selected,th.mce-item-selected").length?a.merge():q.merge(a,b)},mceTableInsertRowBefore:function(a){a.insertRow(!0)},mceTableInsertRowAfter:function(a){a.insertRow()},mceTableInsertColBefore:function(a){a.insertCol(!0)},mceTableInsertColAfter:function(a){a.insertCol()},mceTableDeleteCol:function(a){a.deleteCols()},mceTableDeleteRow:function(a){a.deleteRows()},mceTableCutRow:function(a){o=a.cutRows()},mceTableCopyRow:function(a){o=a.copyRows()},mceTablePasteRowBefore:function(a){a.pasteRows(o,!0)},mceTablePasteRowAfter:function(a){a.pasteRows(o)},mceTableDelete:function(a){a.deleteTable()}},function(b,c){e.addCommand(c,function(){var c=new a(e);c&&(b(c),e.execCommand("mceRepaint"),p.cellSelection.clear())})}),j({mceInsertTable:q.table,mceTableProps:function(){q.table(!0)},mceTableRowProps:q.row,mceTableCellProps:q.cell},function(a,b){e.addCommand(b,function(b,c){a(c)})}),e.settings.table_tab_navigation!==!1&&e.on("keydown",function(b){var c,d,f;9==b.keyCode&&(c=e.dom.getParent(e.selection.getStart(),"th,td"),c&&(b.preventDefault(),d=new a(e),f=b.shiftKey?-1:1,e.undoManager.transact(function(){!d.moveRelIdx(c,f)&&f>0&&(d.insertRow(),d.refresh(),d.moveRelIdx(c,f))})))}),p.insertTable=h}var j=e.each;h.add("table",i)})}(this); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/template/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/template/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("template",function(a){function b(b){return function(){var c=a.settings.templates;"string"==typeof c?tinymce.util.XHR.send({url:c,success:function(a){b(tinymce.util.JSON.parse(a))}}):b(c)}}function c(b){function c(b){function c(b){if(-1==b.indexOf("")){var c="";tinymce.each(a.contentCSS,function(b){c+=''}),b=""+c+""+b+""}b=f(b,"template_preview_replace_values");var e=d.find("iframe")[0].getEl().contentWindow.document;e.open(),e.write(b),e.close()}var g=b.control.value();g.url?tinymce.util.XHR.send({url:g.url,success:function(a){e=a,c(e)}}):(e=g.content,c(e)),d.find("#description")[0].text(b.control.value().description)}var d,e,h=[];return b&&0!==b.length?(tinymce.each(b,function(a){h.push({selected:!h.length,text:a.title,value:{url:a.url,content:a.content,description:a.description}})}),d=a.windowManager.open({title:"Insert template",layout:"flex",direction:"column",align:"stretch",padding:15,spacing:10,items:[{type:"form",flex:0,padding:0,items:[{type:"container",label:"Templates",items:{type:"listbox",label:"Templates",name:"template",values:h,onselect:c}}]},{type:"label",name:"description",label:"Description",text:"\xa0"},{type:"iframe",flex:1,border:1}],onsubmit:function(){g(!1,e)},width:a.getParam("template_popup_width",600),height:a.getParam("template_popup_height",500)}),void d.find("listbox")[0].fire("select")):void a.windowManager.alert("No templates defined")}function d(b,c){function d(a,b){if(a=""+a,a.length0&&(i=k.create("div",null),i.appendChild(j[0].cloneNode(!0))),h(k.select("*",i),function(b){g(b,a.getParam("template_cdate_classes","cdate").replace(/\s+/g,"|"))&&(b.innerHTML=d(a.getParam("template_cdate_format",a.getLang("template.cdate_format")))),g(b,a.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))&&(b.innerHTML=d(a.getParam("template_mdate_format",a.getLang("template.mdate_format")))),g(b,a.getParam("template_selected_content_classes","selcontent").replace(/\s+/g,"|"))&&(b.innerHTML=l)}),e(i),a.execCommand("mceInsertContent",!1,i.innerHTML),a.addVisual()}var h=tinymce.each;a.addCommand("mceInsertTemplate",g),a.addButton("template",{title:"Insert template",onclick:b(c)}),a.addMenuItem("template",{text:"Insert template",onclick:b(c),context:"insert"}),a.on("PreProcess",function(b){var c=a.dom;h(c.select("div",b.node),function(b){c.hasClass(b,"mceTmpl")&&(h(c.select("*",b),function(b){c.hasClass(b,a.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))&&(b.innerHTML=d(a.getParam("template_mdate_format",a.getLang("template.mdate_format"))))}),e(b))})})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/textcolor/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/textcolor/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("textcolor",function(a){function b(b){var c;return a.dom.getParents(a.selection.getStart(),function(a){var d;(d=a.style["forecolor"==b?"color":"background-color"])&&(c=d)}),c}function c(){var b,c,d=[];for(c=a.settings.textcolor_map||["000000","Black","993300","Burnt orange","333300","Dark olive","003300","Dark green","003366","Dark azure","000080","Navy Blue","333399","Indigo","333333","Very dark gray","800000","Maroon","FF6600","Orange","808000","Olive","008000","Green","008080","Teal","0000FF","Blue","666699","Grayish blue","808080","Gray","FF0000","Red","FF9900","Amber","99CC00","Yellow green","339966","Sea green","33CCCC","Turquoise","3366FF","Royal blue","800080","Purple","999999","Medium gray","FF00FF","Magenta","FFCC00","Gold","FFFF00","Yellow","00FF00","Lime","00FFFF","Aqua","00CCFF","Sky blue","993366","Red violet","FFFFFF","White","FF99CC","Pink","FFCC99","Peach","FFFF99","Light yellow","CCFFCC","Pale green","CCFFFF","Pale cyan","99CCFF","Light sky blue","CC99FF","Plum"],b=0;b
    '+(c?"×":"")+"
    "}var d,e,f,g,h,k,l,m=this,n=m._id,o=0;for(d=c(),d.push({text:tinymce.translate("No color"),color:"transparent"}),f='',g=d.length-1,k=0;j>k;k++){for(f+="",h=0;i>h;h++)l=k*i+h,l>g?f+="":(e=d[l],f+=b(e.color,e.text));f+=""}if(a.settings.color_picker_callback){for(f+='",f+="",h=0;i>h;h++)f+=b("","Custom color");f+=""}return f+="
    "}function e(b,c){a.undoManager.transact(function(){a.focus(),a.formatter.apply(b,{value:c}),a.nodeChanged()})}function f(b){a.undoManager.transact(function(){a.focus(),a.formatter.remove(b,{value:null},null,!0),a.nodeChanged()})}function g(c){function d(a){k.hidePanel(),k.color(a),e(k.settings.format,a)}function g(){k.hidePanel(),k.resetColor(),f(k.settings.format)}function h(a,b){a.style.background=b,a.setAttribute("data-mce-color",b)}var j,k=this.parent();tinymce.DOM.getParent(c.target,".mce-custom-color-btn")&&(k.hidePanel(),a.settings.color_picker_callback.call(a,function(a){var b,c,e,f=k.panel.getEl().getElementsByTagName("table")[0];for(b=tinymce.map(f.rows[f.rows.length-1].childNodes,function(a){return a.firstChild}),e=0;ee;e++)h(b[e],b[e+1].getAttribute("data-mce-color"));h(c,a),d(a)},b(k.settings.format))),j=c.target.getAttribute("data-mce-color"),j?(this.lastId&&document.getElementById(this.lastId).setAttribute("aria-selected",!1),c.target.setAttribute("aria-selected",!0),this.lastId=c.target.id,"transparent"==j?g():d(j)):null!==j&&k.hidePanel()}function h(){var a=this;a._color?e(a.settings.format,a._color):f(a.settings.format)}var i,j;j=a.settings.textcolor_rows||5,i=a.settings.textcolor_cols||8,a.addButton("forecolor",{type:"colorbutton",tooltip:"Text color",format:"forecolor",panel:{role:"application",ariaRemember:!0,html:d,onclick:g},onclick:h}),a.addButton("backcolor",{type:"colorbutton",tooltip:"Background color",format:"hilitecolor",panel:{role:"application",ariaRemember:!0,html:d,onclick:g},onclick:h})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/textpattern/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/textpattern/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("textpattern",function(a){function b(){return j&&(i.sort(function(a,b){return a.start.length>b.start.length?-1:a.start.length'+a+"
    "}function f(){var a,b="";for(a in n)b+=a;return new RegExp("["+b+"]","g")}function g(){var a,b="";for(a in n)b&&(b+=","),b+="span.mce-"+n[a];return b}var h,i,j,k,l,m,n,o,p=a.getBody(),q=a.selection;if(n={"\xa0":"nbsp","\xad":"shy"},d=!d,e.state=d,a.fire("VisualChars",{state:d}),o=f(),b&&(m=q.getBookmark()),d)for(i=[],tinymce.walk(p,function(a){3==a.nodeType&&a.nodeValue&&o.test(a.nodeValue)&&i.push(a)},"childNodes"),j=0;j=0;j--)a.dom.remove(i[j],1);q.moveToBookmark(m)}function c(){var b=this;a.on("VisualChars",function(a){b.active(a.state)})}var d,e=this;a.addCommand("mceVisualChars",b),a.addButton("visualchars",{title:"Show invisible characters",cmd:"mceVisualChars",onPostRender:c}),a.addMenuItem("visualchars",{text:"Show invisible characters",cmd:"mceVisualChars",onPostRender:c,selectable:!0,context:"view",prependToContext:!0}),a.on("beforegetcontent",function(a){d&&"raw"!=a.format&&!a.draft&&(d=!0,b(!1))})}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/plugins/wordcount/plugin.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/plugins/wordcount/plugin.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.PluginManager.add("wordcount",function(a){function b(){a.theme.panel.find("#wordcount").text(["Words: {0}",e.getCount()])}var c,d,e=this;c=a.getParam("wordcount_countregex",/[\w\u2019\x27\-\u00C0-\u1FFF]+/g),d=a.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\x27\x22_+=\\\/\-]*/g),a.on("init",function(){var c=a.theme.panel&&a.theme.panel.find("#statusbar")[0];c&&window.setTimeout(function(){c.insert({type:"label",name:"wordcount",text:["Words: {0}",e.getCount()],classes:"wordcount",disabled:a.settings.readonly},0),a.on("setcontent beforeaddundo",b),a.on("keyup",function(a){32==a.keyCode&&b()})},0)}),e.getCount=function(){var b=a.getContent({format:"raw"}),e=0;if(b){b=b.replace(/\.\.\./g," "),b=b.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," "),b=b.replace(/(\w+)(&#?[a-z0-9]+;)+(\w+)/i,"$1$3").replace(/&.+?;/g," "),b=b.replace(d,"");var f=b.match(c);f&&(e=f.length)}return e}}); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/content.inline.min.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/content.inline.min.css Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +.mce-object{border:1px dotted #3A3A3A;background:#d5d5d5 url(img/object.gif) no-repeat center}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px!important;height:9px!important;border:1px dotted #3A3A3A;background:#d5d5d5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}hr{cursor:default}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#39f;color:#fff}.mce-spellchecker-word{border-bottom:2px solid red;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid green;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td.mce-item-selected,th.mce-item-selected{background-color:#39f!important}.mce-edit-focus{outline:1px dotted #333} \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/content.min.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/content.min.css Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +body{background-color:#FFF;color:#000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px;scrollbar-3dlight-color:#F0F0EE;scrollbar-arrow-color:#676662;scrollbar-base-color:#F0F0EE;scrollbar-darkshadow-color:#DDD;scrollbar-face-color:#E0E0DD;scrollbar-highlight-color:#F0F0EE;scrollbar-shadow-color:#F0F0EE;scrollbar-track-color:#F5F5F5}td,th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px}.mce-object{border:1px dotted #3A3A3A;background:#d5d5d5 url(img/object.gif) no-repeat center}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px!important;height:9px!important;border:1px dotted #3A3A3A;background:#d5d5d5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}hr{cursor:default}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#39f;color:#fff}.mce-spellchecker-word{border-bottom:2px solid red;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid green;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td.mce-item-selected,th.mce-item-selected{background-color:#39f!important}.mce-edit-focus{outline:1px dotted #333} \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce-small.eot Binary file src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce-small.eot has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce-small.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce-small.svg Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,62 @@ + + + +Generated by IcoMoon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce-small.ttf Binary file src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce-small.ttf has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce-small.woff Binary file src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce-small.woff has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce.eot Binary file src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce.eot has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce.svg Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,63 @@ + + + +Generated by IcoMoon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce.ttf Binary file src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce.ttf has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce.woff Binary file src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/fonts/tinymce.woff has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/img/anchor.gif Binary file src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/img/anchor.gif has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/img/loader.gif Binary file src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/img/loader.gif has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/img/object.gif Binary file src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/img/object.gif has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/img/trans.gif Binary file src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/img/trans.gif has changed diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/skin.ie7.min.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/skin.ie7.min.css Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +.mce-container,.mce-container *,.mce-widget,.mce-widget *,.mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:#333;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;-webkit-tap-highlight-color:transparent;line-height:normal;font-weight:normal;text-align:left;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-widget button{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.mce-container *[unselectable]{-moz-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none}.mce-fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.mce-fade.mce-in{opacity:1}.mce-tinymce{visibility:inherit !important;position:relative}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;height:100%;z-index:100}div.mce-fullscreen{position:fixed;top:0;left:0;width:100%;height:auto}.mce-tinymce{display:block;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.mce-wordcount{position:absolute;top:0;right:0;padding:8px}div.mce-edit-area{background:#FFF;filter:none}.mce-statusbar{position:relative}.mce-statusbar .mce-container-body{position:relative}.mce-fullscreen .mce-resizehandle{display:none}.mce-charmap{border-collapse:collapse}.mce-charmap td{cursor:default;border:1px solid #9e9e9e;width:20px;height:20px;line-height:20px;text-align:center;vertical-align:middle;padding:2px}.mce-charmap td div{text-align:center}.mce-charmap td:hover{background:#d9d9d9}.mce-grid td.mce-grid-cell div{border:1px solid #d6d6d6;width:15px;height:15px;margin:0px;cursor:pointer}.mce-grid td.mce-grid-cell div:focus{border-color:#a1a1a1}.mce-grid td.mce-grid-cell div[disabled]{cursor:not-allowed}.mce-grid{border-spacing:2px;border-collapse:separate}.mce-grid a{display:block;border:1px solid transparent}.mce-grid a:hover,.mce-grid a:focus{border-color:#a1a1a1}.mce-grid-border{margin:0 4px 0 4px}.mce-grid-border a{border-color:#d6d6d6;width:13px;height:13px}.mce-grid-border a:hover,.mce-grid-border a.mce-active{border-color:#a1a1a1;background:#c8def4}.mce-text-center{text-align:center}div.mce-tinymce-inline{width:100%;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-colorbtn-trans div{text-align:center;vertical-align:middle;font-weight:bold;font-size:20px;line-height:16px;color:#707070}.mce-toolbar-grp{padding-bottom:2px}.mce-toolbar-grp .mce-flow-layout-item{margin-bottom:0}.mce-rtl .mce-wordcount{left:0;right:auto}.mce-container,.mce-container-body{display:block}.mce-autoscroll{overflow:hidden}.mce-scrollbar{position:absolute;width:7px;height:100%;top:2px;right:2px;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-scrollbar-h{top:auto;right:auto;left:2px;bottom:2px;width:100%;height:7px}.mce-scrollbar-thumb{position:absolute;background-color:#000;border:1px solid #888;border-color:rgba(85,85,85,0.6);width:5px;height:100%;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.mce-scrollbar-h .mce-scrollbar-thumb{width:100%;height:5px}.mce-scrollbar:hover,.mce-scrollbar.mce-active{background-color:#AAA;opacity:.6;filter:alpha(opacity=60);zoom:1;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.mce-scroll{position:relative}.mce-panel{border:0 solid #9e9e9e;background-color:#f0f0f0;background-image:-moz-linear-gradient(top, #fdfdfd, #ddd);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fdfdfd), to(#ddd));background-image:-webkit-linear-gradient(top, #fdfdfd, #ddd);background-image:-o-linear-gradient(top, #fdfdfd, #ddd);background-image:linear-gradient(to bottom, #fdfdfd, #ddd);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffdfdfd', endColorstr='#ffdddddd', GradientType=0);zoom:1}.mce-floatpanel{position:absolute;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2)}.mce-floatpanel.mce-fixed{position:fixed}.mce-floatpanel .mce-arrow,.mce-floatpanel .mce-arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.mce-floatpanel .mce-arrow{border-width:11px}.mce-floatpanel .mce-arrow:after{border-width:10px;content:""}.mce-floatpanel.mce-popover{filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);background:transparent;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);top:0;left:0;background:#fff;border:1px solid #9e9e9e;border:1px solid rgba(0,0,0,0.25)}.mce-floatpanel.mce-popover.mce-bottom{margin-top:10px;*margin-top:0}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#9e9e9e;border-bottom-color:rgba(0,0,0,0.25);top:-11px}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow:after{top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#fff}.mce-floatpanel.mce-popover.mce-bottom.mce-start{margin-left:-22px}.mce-floatpanel.mce-popover.mce-bottom.mce-start>.mce-arrow{left:20px}.mce-floatpanel.mce-popover.mce-bottom.mce-end{margin-left:22px}.mce-floatpanel.mce-popover.mce-bottom.mce-end>.mce-arrow{right:10px;left:auto}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;background:#fff;height:100%}div.mce-fullscreen{position:fixed;top:0;left:0}#mce-modal-block{opacity:0;filter:alpha(opacity=0);zoom:1;position:fixed;left:0;top:0;width:100%;height:100%;background:#000}#mce-modal-block.mce-in{opacity:.3;filter:alpha(opacity=30);zoom:1}.mce-window-move{cursor:move}.mce-window{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);background:transparent;background:#fff;position:fixed;top:0;left:0;opacity:0;-webkit-transition:opacity 150ms ease-in;transition:opacity 150ms ease-in}.mce-window.mce-in{opacity:1}.mce-window-head{padding:9px 15px;border-bottom:1px solid #c5c5c5;position:relative}.mce-window-head .mce-close{position:absolute;right:15px;top:9px;font-size:20px;font-weight:bold;line-height:20px;color:#858585;cursor:pointer;height:20px;overflow:hidden}.mce-close:hover{color:#adadad}.mce-window-head .mce-title{line-height:20px;font-size:20px;font-weight:bold;text-rendering:optimizelegibility;padding-right:10px}.mce-window .mce-container-body{display:block}.mce-foot{display:block;background-color:#fff;border-top:1px solid #c5c5c5;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.mce-window-head .mce-dragh{position:absolute;top:0;left:0;cursor:move;width:90%;height:100%}.mce-window iframe{width:100%;height:100%}.mce-window.mce-fullscreen,.mce-window.mce-fullscreen .mce-foot{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mce-rtl .mce-window-head .mce-close{position:absolute;right:auto;left:15px}.mce-rtl .mce-window-head .mce-dragh{left:auto;right:0}.mce-rtl .mce-window-head .mce-title{direction:rtl;text-align:right}.mce-abs-layout{position:relative}body .mce-abs-layout-item,.mce-abs-end{position:absolute}.mce-abs-end{width:1px;height:1px}.mce-container-body.mce-abs-layout{overflow:hidden}.mce-tooltip{position:absolute;padding:5px;opacity:.8;filter:alpha(opacity=80);zoom:1}.mce-tooltip-inner{font-size:11px;background-color:#000;color:#fff;max-width:200px;padding:5px 8px 4px 8px;text-align:center;white-space:normal}.mce-tooltip-inner{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-tooltip-inner{-webkit-box-shadow:0 0 5px #000000;-moz-box-shadow:0 0 5px #000000;box-shadow:0 0 5px #000000}.mce-tooltip-arrow{position:absolute;width:0;height:0;line-height:0;border:5px dashed #000}.mce-tooltip-arrow-n{border-bottom-color:#000}.mce-tooltip-arrow-s{border-top-color:#000}.mce-tooltip-arrow-e{border-left-color:#000}.mce-tooltip-arrow-w{border-right-color:#000}.mce-tooltip-nw,.mce-tooltip-sw{margin-left:-14px}.mce-tooltip-n .mce-tooltip-arrow{top:0px;left:50%;margin-left:-5px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-nw .mce-tooltip-arrow{top:0;left:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-ne .mce-tooltip-arrow{top:0;right:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-s .mce-tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-sw .mce-tooltip-arrow{bottom:0;left:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-se .mce-tooltip-arrow{bottom:0;right:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-e .mce-tooltip-arrow{right:0;top:50%;margin-top:-5px;border-left-style:solid;border-right:none;border-top-color:transparent;border-bottom-color:transparent}.mce-tooltip-w .mce-tooltip-arrow{left:0;top:50%;margin-top:-5px;border-right-style:solid;border-left:none;border-top-color:transparent;border-bottom-color:transparent}.mce-btn{border:1px solid #b1b1b1;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25) rgba(0,0,0,0.25);position:relative;text-shadow:0 1px 1px rgba(255,255,255,0.75);display:inline-block;*display:inline;*zoom:1;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);background-color:#f0f0f0;background-image:-moz-linear-gradient(top, #fff, #d9d9d9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#d9d9d9));background-image:-webkit-linear-gradient(top, #fff, #d9d9d9);background-image:-o-linear-gradient(top, #fff, #d9d9d9);background-image:linear-gradient(to bottom, #fff, #d9d9d9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffd9d9d9', GradientType=0);zoom:1}.mce-btn:hover,.mce-btn:focus{color:#333;background-color:#e3e3e3;background-image:-moz-linear-gradient(top, #f2f2f2, #ccc);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#f2f2f2), to(#ccc));background-image:-webkit-linear-gradient(top, #f2f2f2, #ccc);background-image:-o-linear-gradient(top, #f2f2f2, #ccc);background-image:linear-gradient(to bottom, #f2f2f2, #ccc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffcccccc', GradientType=0);zoom:1}.mce-btn.mce-disabled button,.mce-btn.mce-disabled:hover button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-btn.mce-active,.mce-btn.mce-active:hover{background-color:#d6d6d6;background-image:-moz-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#e6e6e6), to(#c0c0c0));background-image:-webkit-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:-o-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:linear-gradient(to bottom, #e6e6e6, #c0c0c0);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe6e6e6', endColorstr='#ffc0c0c0', GradientType=0);zoom:1;-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)}.mce-btn:active{background-color:#d6d6d6;background-image:-moz-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#e6e6e6), to(#c0c0c0));background-image:-webkit-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:-o-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:linear-gradient(to bottom, #e6e6e6, #c0c0c0);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe6e6e6', endColorstr='#ffc0c0c0', GradientType=0);zoom:1;-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)}.mce-btn button{padding:4px 10px;font-size:14px;line-height:20px;*line-height:16px;cursor:pointer;color:#333;text-align:center;overflow:visible;-webkit-appearance:none}.mce-btn button::-moz-focus-inner{border:0;padding:0}.mce-btn i{text-shadow:1px 1px #fff}.mce-primary{min-width:50px;color:#fff;border:1px solid #b1b1b1;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25) rgba(0,0,0,0.25);background-color:#006dcc;background-image:-moz-linear-gradient(top, #08c, #04c);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#08c), to(#04c));background-image:-webkit-linear-gradient(top, #08c, #04c);background-image:-o-linear-gradient(top, #08c, #04c);background-image:linear-gradient(to bottom, #08c, #04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);zoom:1}.mce-primary:hover,.mce-primary:focus{background-color:#005fb3;background-image:-moz-linear-gradient(top, #0077b3, #003cb3);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0077b3), to(#003cb3));background-image:-webkit-linear-gradient(top, #0077b3, #003cb3);background-image:-o-linear-gradient(top, #0077b3, #003cb3);background-image:linear-gradient(to bottom, #0077b3, #003cb3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0077b3', endColorstr='#ff003cb3', GradientType=0);zoom:1}.mce-primary.mce-disabled button,.mce-primary.mce-disabled:hover button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-primary.mce-active,.mce-primary.mce-active:hover,.mce-primary:not(.mce-disabled):active{background-color:#005299;background-image:-moz-linear-gradient(top, #069, #039);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#069), to(#039));background-image:-webkit-linear-gradient(top, #069, #039);background-image:-o-linear-gradient(top, #069, #039);background-image:linear-gradient(to bottom, #069, #039);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff006699', endColorstr='#ff003399', GradientType=0);zoom:1;-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)}.mce-primary button,.mce-primary button i{color:#fff;text-shadow:1px 1px #333}.mce-btn-large button{padding:9px 14px;font-size:16px;line-height:normal;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.mce-btn-large i{margin-top:2px}.mce-btn-small button{padding:1px 5px;font-size:12px;*padding-bottom:2px}.mce-btn-small i{line-height:20px;vertical-align:top;*line-height:18px}.mce-btn .mce-caret{margin-top:8px;margin-left:0}.mce-btn-small .mce-caret{margin-top:8px;margin-left:0}.mce-caret{display:inline-block;*display:inline;*zoom:1;width:0;height:0;vertical-align:top;border-top:4px solid #333;border-right:4px solid transparent;border-left:4px solid transparent;content:""}.mce-disabled .mce-caret{border-top-color:#aaa}.mce-caret.mce-up{border-bottom:4px solid #333;border-top:0}.mce-btn-flat{border:0;background:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:none}.mce-btn-flat:hover,.mce-btn-flat.mce-active,.mce-btn-flat:focus,.mce-btn-flat:active{border:0;background:#e6e6e6;filter:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-rtl .mce-btn button{direction:rtl}.mce-btn-group .mce-btn{border-width:1px 0 1px 0;margin:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mce-btn-group .mce-first{border-left:1px solid #b1b1b1;border-left:1px solid rgba(0,0,0,0.25);-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.mce-btn-group .mce-last{border-right:1px solid #b1b1b1;border-right:1px solid rgba(0,0,0,0.1);-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.mce-btn-group .mce-first.mce-last{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-btn-group .mce-btn.mce-flow-layout-item{margin:0}.mce-checkbox{cursor:pointer}i.mce-i-checkbox{margin:0 3px 0 0;border:1px solid #c5c5c5;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);background-color:#f0f0f0;background-image:-moz-linear-gradient(top, #fff, #d9d9d9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#d9d9d9));background-image:-webkit-linear-gradient(top, #fff, #d9d9d9);background-image:-o-linear-gradient(top, #fff, #d9d9d9);background-image:linear-gradient(to bottom, #fff, #d9d9d9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffd9d9d9', GradientType=0);zoom:1;text-indent:-10em;*font-size:0;*line-height:0;*text-indent:0;overflow:hidden}.mce-checked i.mce-i-checkbox{color:#333;font-size:16px;line-height:16px;text-indent:0}.mce-checkbox:focus i.mce-i-checkbox,.mce-checkbox.mce-focus i.mce-i-checkbox{border:1px solid rgba(82,168,236,0.8);-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65)}.mce-checkbox.mce-disabled .mce-label,.mce-checkbox.mce-disabled i.mce-i-checkbox{color:#acacac}.mce-rtl .mce-checkbox{direction:rtl;text-align:right}.mce-rtl i.mce-i-checkbox{margin:0 0 0 3px}.mce-combobox{display:inline-block;*display:inline;*zoom:1;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);*height:32px}.mce-combobox input{border:1px solid #c5c5c5;border-right-color:#c5c5c5;height:28px}.mce-combobox.mce-disabled input{color:#adadad}.mce-combobox.mce-has-open input{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.mce-combobox .mce-btn{border-left:0;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.mce-combobox button{padding-right:8px;padding-left:8px}.mce-combobox.mce-disabled .mce-btn button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-colorbox i{border:1px solid #c5c5c5;width:14px;height:14px}.mce-colorbutton .mce-ico{position:relative}.mce-colorbutton-grid{margin:4px}.mce-colorbutton button{padding-right:4px}.mce-colorbutton .mce-preview{padding-right:3px;display:block;position:absolute;left:50%;top:50%;margin-left:-14px;margin-top:7px;background:gray;width:13px;height:2px;overflow:hidden}.mce-colorbutton.mce-btn-small .mce-preview{margin-left:-16px;padding-right:0;width:16px}.mce-colorbutton .mce-open{padding-left:4px;border-left:1px solid transparent;border-right:1px solid transparent}.mce-colorbutton:hover .mce-open{border-left-color:#bdbdbd;border-right-color:#bdbdbd}.mce-colorbutton.mce-btn-small .mce-open{padding:0 3px 0 3px}.mce-rtl .mce-colorbutton{direction:rtl}.mce-rtl .mce-colorbutton .mce-preview{margin-left:0;padding-right:0;padding-left:4px;margin-right:-14px}.mce-rtl .mce-colorbutton.mce-btn-small .mce-preview{margin-left:0;padding-right:0;margin-right:-17px;padding-left:0}.mce-rtl .mce-colorbutton button{padding-right:10px;padding-left:10px}.mce-rtl .mce-colorbutton .mce-open{padding-left:4px;padding-right:4px}.mce-colorpicker{position:relative;width:250px;height:220px}.mce-colorpicker-sv{position:absolute;top:0;left:0;width:90%;height:100%;border:1px solid #c5c5c5;cursor:crosshair;overflow:hidden}.mce-colorpicker-h-chunk{width:100%}.mce-colorpicker-overlay1,.mce-colorpicker-overlay2{width:100%;height:100%;position:absolute;top:0;left:0}.mce-colorpicker-overlay1{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr='#ffffff', endColorstr='#00ffffff');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff')";background:linear-gradient(to right, #fff, rgba(255,255,255,0))}.mce-colorpicker-overlay2{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#00000000', endColorstr='#000000');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000')";background:linear-gradient(to bottom, rgba(0,0,0,0), #000)}.mce-colorpicker-selector1{background:none;position:absolute;width:12px;height:12px;margin:-8px 0 0 -8px;border:1px solid black;border-radius:50%}.mce-colorpicker-selector2{position:absolute;width:10px;height:10px;border:1px solid white;border-radius:50%}.mce-colorpicker-h{position:absolute;top:0;right:0;width:6.5%;height:100%;border:1px solid #c5c5c5;cursor:crosshair}.mce-colorpicker-h-marker{margin-top:-4px;position:absolute;top:0;left:-1px;width:100%;border:1px solid #333;background:#fff;height:4px;z-index:100}.mce-path{display:inline-block;*display:inline;*zoom:1;padding:8px;white-space:normal}.mce-path .mce-txt{display:inline-block;padding-right:3px}.mce-path .mce-path-body{display:inline-block}.mce-path-item{display:inline-block;*display:inline;*zoom:1;cursor:pointer;color:#333}.mce-path-item:hover{text-decoration:underline}.mce-path-item:focus{background:#666;color:#fff}.mce-path .mce-divider{display:inline}.mce-disabled .mce-path-item{color:#aaa}.mce-rtl .mce-path{direction:rtl}.mce-fieldset{border:0 solid #9E9E9E;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-fieldset>.mce-container-body{margin-top:-15px}.mce-fieldset-title{margin-left:5px;padding:0 5px 0 5px}.mce-fit-layout{display:inline-block;*display:inline;*zoom:1}.mce-fit-layout-item{position:absolute}.mce-flow-layout-item{display:inline-block;*display:inline;*zoom:1}.mce-flow-layout-item{margin:2px 0 2px 2px}.mce-flow-layout-item.mce-last{margin-right:2px}.mce-flow-layout{white-space:normal}.mce-tinymce-inline .mce-flow-layout{white-space:nowrap}.mce-rtl .mce-flow-layout{text-align:right;direction:rtl}.mce-rtl .mce-flow-layout-item{margin:2px 2px 2px 0}.mce-rtl .mce-flow-layout-item.mce-last{margin-left:2px}.mce-iframe{border:0 solid #9e9e9e;width:100%;height:100%}.mce-label{display:inline-block;*display:inline;*zoom:1;text-shadow:0 1px 1px rgba(255,255,255,0.75);overflow:hidden}.mce-label.mce-autoscroll{overflow:auto}.mce-label.mce-disabled{color:#aaa}.mce-label.mce-multiline{white-space:pre-wrap}.mce-label.mce-error{color:#a00}.mce-rtl .mce-label{text-align:right;direction:rtl}.mce-menubar .mce-menubtn{border-color:transparent;background:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:none}.mce-menubar{border:1px solid #c4c4c4}.mce-menubar .mce-menubtn button span{color:#333}.mce-menubar .mce-caret{border-top-color:#333}.mce-menubar .mce-menubtn:hover,.mce-menubar .mce-menubtn.mce-active,.mce-menubar .mce-menubtn:focus{border-color:transparent;background:#e6e6e6;filter:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-menubtn span{color:#333;margin-right:2px;line-height:20px;*line-height:16px}.mce-menubtn.mce-btn-small span{font-size:12px}.mce-menubtn.mce-fixed-width span{display:inline-block;overflow-x:hidden;text-overflow:ellipsis;width:90px}.mce-menubtn.mce-fixed-width.mce-btn-small span{width:70px}.mce-menubtn .mce-caret{*margin-top:6px}.mce-rtl .mce-menubtn button{direction:rtl;text-align:right}.mce-listbox button{text-align:left;padding-right:20px;position:relative}.mce-listbox .mce-caret{position:absolute;margin-top:-2px;right:8px;top:50%}.mce-rtl .mce-listbox .mce-caret{right:auto;left:8px}.mce-rtl .mce-listbox button{padding-right:10px;padding-left:20px}.mce-menu-item{display:block;padding:6px 15px 6px 12px;clear:both;font-weight:normal;line-height:20px;color:#333;white-space:nowrap;cursor:pointer;line-height:normal;border-left:4px solid transparent;margin-bottom:1px}.mce-menu-item .mce-ico,.mce-menu-item .mce-text{color:#333}.mce-menu-item.mce-disabled .mce-text,.mce-menu-item.mce-disabled .mce-ico{color:#adadad}.mce-menu-item:hover .mce-text,.mce-menu-item.mce-selected .mce-text,.mce-menu-item:focus .mce-text{color:#fff}.mce-menu-item:hover .mce-ico,.mce-menu-item.mce-selected .mce-ico,.mce-menu-item:focus .mce-ico{color:#fff}.mce-menu-item.mce-disabled:hover{background:#ccc}.mce-menu-shortcut{display:inline-block;color:#adadad}.mce-menu-shortcut{display:inline-block;*display:inline;*zoom:1;padding:0 15px 0 20px}.mce-menu-item:hover .mce-menu-shortcut,.mce-menu-item.mce-selected .mce-menu-shortcut,.mce-menu-item:focus .mce-menu-shortcut{color:#fff}.mce-menu-item .mce-caret{margin-top:4px;*margin-top:3px;margin-right:6px;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid #333}.mce-menu-item.mce-selected .mce-caret,.mce-menu-item:focus .mce-caret,.mce-menu-item:hover .mce-caret{border-left-color:#fff}.mce-menu-align .mce-menu-shortcut{*margin-top:-2px}.mce-menu-align .mce-menu-shortcut,.mce-menu-align .mce-caret{position:absolute;right:0}.mce-menu-item.mce-active i{visibility:visible}.mce-menu-item-normal.mce-active{background-color:#c8def4}.mce-menu-item-preview.mce-active{border-left:5px solid #aaa}.mce-menu-item-normal.mce-active .mce-text{color:#333}.mce-menu-item-normal.mce-active:hover .mce-text,.mce-menu-item-normal.mce-active:hover .mce-ico{color:#fff}.mce-menu-item-normal.mce-active:focus .mce-text,.mce-menu-item-normal.mce-active:focus .mce-ico{color:#fff}.mce-menu-item:hover,.mce-menu-item.mce-selected,.mce-menu-item:focus{text-decoration:none;color:#fff;background-color:#0081c2;background-image:-moz-linear-gradient(top, #08c, #0077b3);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#08c), to(#0077b3));background-image:-webkit-linear-gradient(top, #08c, #0077b3);background-image:-o-linear-gradient(top, #08c, #0077b3);background-image:linear-gradient(to bottom, #08c, #0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);zoom:1}div.mce-menu .mce-menu-item-sep,.mce-menu-item-sep:hover{border:0;padding:0;height:1px;margin:9px 1px;overflow:hidden;background:#cbcbcb;border-bottom:1px solid #fff;cursor:default;filter:none}.mce-menu.mce-rtl{direction:rtl}.mce-rtl .mce-menu-item{text-align:right;direction:rtl;padding:6px 12px 6px 15px}.mce-menu-align.mce-rtl .mce-menu-shortcut,.mce-menu-align.mce-rtl .mce-caret{right:auto;left:0}.mce-rtl .mce-menu-item .mce-caret{margin-left:6px;margin-right:0;border-right:4px solid #333;border-left:0}.mce-rtl .mce-menu-item.mce-selected .mce-caret,.mce-rtl .mce-menu-item:focus .mce-caret,.mce-rtl .mce-menu-item:hover .mce-caret{border-left-color:transparent;border-right-color:#fff}.mce-menu{position:absolute;left:0;top:0;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);background:transparent;z-index:1000;padding:5px 0 5px 0;margin:2px 0 0;min-width:160px;background:#fff;border:1px solid #989898;border:1px solid rgba(0,0,0,0.2);z-index:1002;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);max-height:400px;overflow:auto;overflow-x:hidden}.mce-menu i{display:none}.mce-menu-has-icons i{display:inline-block;*display:inline}.mce-menu-sub-tr-tl{margin:-6px 0 0 -1px}.mce-menu-sub-br-bl{margin:6px 0 0 -1px}.mce-menu-sub-tl-tr{margin:-6px 0 0 1px}.mce-menu-sub-bl-br{margin:6px 0 0 1px}.mce-container-body .mce-resizehandle{position:absolute;right:0;bottom:0;width:16px;height:16px;visibility:visible;cursor:s-resize;margin:0}.mce-container-body .mce-resizehandle-both{cursor:se-resize}i.mce-i-resize{color:#333}.mce-spacer{visibility:hidden}.mce-splitbtn .mce-open{border-left:1px solid transparent;border-right:1px solid transparent}.mce-splitbtn:hover .mce-open{border-left-color:#bdbdbd;border-right-color:#bdbdbd}.mce-splitbtn button{padding-right:4px}.mce-splitbtn .mce-open{padding-left:4px}.mce-splitbtn .mce-open.mce-active{-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)}.mce-splitbtn.mce-btn-small .mce-open{padding:0 3px 0 3px}.mce-rtl .mce-splitbtn{direction:rtl;text-align:right}.mce-rtl .mce-splitbtn button{padding-right:10px;padding-left:10px}.mce-rtl .mce-splitbtn .mce-open{padding-left:4px;padding-right:4px}.mce-stack-layout-item{display:block}.mce-tabs{display:block;border-bottom:1px solid #c5c5c5}.mce-tab{display:inline-block;*display:inline;*zoom:1;border:1px solid #c5c5c5;border-width:0 1px 0 0;background:#e3e3e3;padding:8px;text-shadow:0 1px 1px rgba(255,255,255,0.75);height:13px;cursor:pointer}.mce-tab:hover{background:#fdfdfd}.mce-tab.mce-active{background:#fdfdfd;border-bottom-color:transparent;margin-bottom:-1px;height:14px}.mce-rtl .mce-tabs{text-align:right;direction:rtl}.mce-rtl .mce-tab{border-width:0 0 0 1px}.mce-textbox{background:#fff;border:1px solid #c5c5c5;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);display:inline-block;-webkit-transition:border linear .2s, box-shadow linear .2s;transition:border linear .2s, box-shadow linear .2s;height:28px;resize:none;padding:0 4px 0 4px;white-space:pre-wrap;*white-space:pre;color:#333}.mce-textbox:focus,.mce-textbox.mce-focus{border-color:rgba(82,168,236,0.8);-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65)}.mce-placeholder .mce-textbox{color:#aaa}.mce-textbox.mce-multiline{padding:4px}.mce-textbox.mce-disabled{color:#adadad}.mce-rtl .mce-textbox{text-align:right;direction:rtl}.mce-throbber{position:absolute;top:0;left:0;width:100%;height:100%;opacity:.6;filter:alpha(opacity=60);zoom:1;background:#fff url('img/loader.gif') no-repeat center center}.mce-throbber-inline{position:static;height:50px}@font-face{font-family:'tinymce';src:url('fonts/tinymce.eot');src:url('fonts/tinymce.eot?#iefix') format('embedded-opentype'),url('fonts/tinymce.woff') format('woff'),url('fonts/tinymce.ttf') format('truetype'),url('fonts/tinymce.svg#tinymce') format('svg');font-weight:normal;font-style:normal}@font-face{font-family:'tinymce-small';src:url('fonts/tinymce-small.eot');src:url('fonts/tinymce-small.eot?#iefix') format('embedded-opentype'),url('fonts/tinymce-small.woff') format('woff'),url('fonts/tinymce-small.ttf') format('truetype'),url('fonts/tinymce-small.svg#tinymce') format('svg');font-weight:normal;font-style:normal}.mce-ico{font-family:'tinymce';font-style:normal;font-weight:normal;font-size:16px;line-height:16px;vertical-align:text-top;-webkit-font-smoothing:antialiased;display:inline-block;background:transparent center center;width:16px;height:16px;color:#333;-ie7-icon:' '}.mce-btn-small .mce-ico{font-family:'tinymce-small'}.mce-ico,i.mce-i-checkbox{zoom:expression(this.runtimeStyle['zoom'] = '1', this.innerHTML = this.currentStyle['-ie7-icon'].substr(1, 1) + ' ')}.mce-i-save{-ie7-icon:"\e000"}.mce-i-newdocument{-ie7-icon:"\e001"}.mce-i-fullpage{-ie7-icon:"\e002"}.mce-i-alignleft{-ie7-icon:"\e003"}.mce-i-aligncenter{-ie7-icon:"\e004"}.mce-i-alignright{-ie7-icon:"\e005"}.mce-i-alignjustify{-ie7-icon:"\e006"}.mce-i-cut{-ie7-icon:"\e007"}.mce-i-paste{-ie7-icon:"\e008"}.mce-i-searchreplace{-ie7-icon:"\e009"}.mce-i-bullist{-ie7-icon:"\e00a"}.mce-i-numlist{-ie7-icon:"\e00b"}.mce-i-indent{-ie7-icon:"\e00c"}.mce-i-outdent{-ie7-icon:"\e00d"}.mce-i-blockquote{-ie7-icon:"\e00e"}.mce-i-undo{-ie7-icon:"\e00f"}.mce-i-redo{-ie7-icon:"\e010"}.mce-i-link{-ie7-icon:"\e011"}.mce-i-unlink{-ie7-icon:"\e012"}.mce-i-anchor{-ie7-icon:"\e013"}.mce-i-image{-ie7-icon:"\e014"}.mce-i-media{-ie7-icon:"\e015"}.mce-i-help{-ie7-icon:"\e016"}.mce-i-code{-ie7-icon:"\e017"}.mce-i-insertdatetime{-ie7-icon:"\e018"}.mce-i-preview{-ie7-icon:"\e019"}.mce-i-forecolor{-ie7-icon:"\e01a"}.mce-i-backcolor{-ie7-icon:"\e01a"}.mce-i-table{-ie7-icon:"\e01b"}.mce-i-hr{-ie7-icon:"\e01c"}.mce-i-removeformat{-ie7-icon:"\e01d"}.mce-i-subscript{-ie7-icon:"\e01e"}.mce-i-superscript{-ie7-icon:"\e01f"}.mce-i-charmap{-ie7-icon:"\e020"}.mce-i-emoticons{-ie7-icon:"\e021"}.mce-i-print{-ie7-icon:"\e022"}.mce-i-fullscreen{-ie7-icon:"\e023"}.mce-i-spellchecker{-ie7-icon:"\e024"}.mce-i-nonbreaking{-ie7-icon:"\e025"}.mce-i-template{-ie7-icon:"\e026"}.mce-i-pagebreak{-ie7-icon:"\e027"}.mce-i-restoredraft{-ie7-icon:"\e028"}.mce-i-untitled{-ie7-icon:"\e029"}.mce-i-bold{-ie7-icon:"\e02a"}.mce-i-italic{-ie7-icon:"\e02b"}.mce-i-underline{-ie7-icon:"\e02c"}.mce-i-strikethrough{-ie7-icon:"\e02d"}.mce-i-visualchars{-ie7-icon:"\e02e"}.mce-i-ltr{-ie7-icon:"\e02f"}.mce-i-rtl{-ie7-icon:"\e030"}.mce-i-copy{-ie7-icon:"\e031"}.mce-i-resize{-ie7-icon:"\e032"}.mce-i-browse{-ie7-icon:"\e034"}.mce-i-pastetext{-ie7-icon:"\e035"}.mce-i-checkbox,.mce-i-selected{-ie7-icon:"\e033"}.mce-i-selected{visibility:hidden}.mce-i-backcolor{background:#BBB} \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/skin.min.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/skins/lightgray/skin.min.css Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +.mce-container,.mce-container *,.mce-widget,.mce-widget *,.mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:0 0;text-decoration:none;color:#333;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;-webkit-tap-highlight-color:transparent;line-height:normal;font-weight:400;text-align:left;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-widget button{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.mce-container [unselectable]{-moz-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none}.mce-fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.mce-fade.mce-in{opacity:1}.mce-tinymce{visibility:inherit!important;position:relative}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;height:100%;z-index:100}div.mce-fullscreen{position:fixed;top:0;left:0;width:100%;height:auto}.mce-tinymce{display:block;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.mce-wordcount{position:absolute;top:0;right:0;padding:8px}div.mce-edit-area{background:#FFF;filter:none}.mce-statusbar{position:relative}.mce-statusbar .mce-container-body{position:relative}.mce-fullscreen .mce-resizehandle{display:none}.mce-charmap{border-collapse:collapse}.mce-charmap td{cursor:default;border:1px solid #9e9e9e;width:20px;height:20px;line-height:20px;text-align:center;vertical-align:middle;padding:2px}.mce-charmap td div{text-align:center}.mce-charmap td:hover{background:#d9d9d9}.mce-grid td.mce-grid-cell div{border:1px solid #d6d6d6;width:15px;height:15px;margin:0;cursor:pointer}.mce-grid td.mce-grid-cell div:focus{border-color:#a1a1a1}.mce-grid td.mce-grid-cell div[disabled]{cursor:not-allowed}.mce-grid{border-spacing:2px;border-collapse:separate}.mce-grid a{display:block;border:1px solid transparent}.mce-grid a:hover,.mce-grid a:focus{border-color:#a1a1a1}.mce-grid-border{margin:0 4px 0 4px}.mce-grid-border a{border-color:#d6d6d6;width:13px;height:13px}.mce-grid-border a:hover,.mce-grid-border a.mce-active{border-color:#a1a1a1;background:#c8def4}.mce-text-center{text-align:center}div.mce-tinymce-inline{width:100%;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-colorbtn-trans div{text-align:center;vertical-align:middle;font-weight:700;font-size:20px;line-height:16px;color:#707070}.mce-toolbar-grp{padding-bottom:2px}.mce-toolbar-grp .mce-flow-layout-item{margin-bottom:0}.mce-rtl .mce-wordcount{left:0;right:auto}.mce-container,.mce-container-body{display:block}.mce-autoscroll{overflow:hidden}.mce-scrollbar{position:absolute;width:7px;height:100%;top:2px;right:2px;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-scrollbar-h{top:auto;right:auto;left:2px;bottom:2px;width:100%;height:7px}.mce-scrollbar-thumb{position:absolute;background-color:#000;border:1px solid #888;border-color:rgba(85,85,85,.6);width:5px;height:100%;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.mce-scrollbar-h .mce-scrollbar-thumb{width:100%;height:5px}.mce-scrollbar:hover,.mce-scrollbar.mce-active{background-color:#AAA;opacity:.6;filter:alpha(opacity=60);zoom:1;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.mce-scroll{position:relative}.mce-panel{border:0 solid #9e9e9e;background-color:#f0f0f0;background-image:-moz-linear-gradient(top,#fdfdfd,#ddd);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fdfdfd),to(#ddd));background-image:-webkit-linear-gradient(top,#fdfdfd,#ddd);background-image:-o-linear-gradient(top,#fdfdfd,#ddd);background-image:linear-gradient(to bottom,#fdfdfd,#ddd);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffdfdfd', endColorstr='#ffdddddd', GradientType=0);zoom:1}.mce-floatpanel{position:absolute;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.mce-floatpanel.mce-fixed{position:fixed}.mce-floatpanel .mce-arrow,.mce-floatpanel .mce-arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.mce-floatpanel .mce-arrow{border-width:11px}.mce-floatpanel .mce-arrow:after{border-width:10px;content:""}.mce-floatpanel.mce-popover{filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background:0 0;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);top:0;left:0;background:#fff;border:1px solid #9e9e9e;border:1px solid rgba(0,0,0,.25)}.mce-floatpanel.mce-popover.mce-bottom{margin-top:10px;}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#9e9e9e;border-bottom-color:rgba(0,0,0,.25);top:-11px}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow:after{top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#fff}.mce-floatpanel.mce-popover.mce-bottom.mce-start{margin-left:-22px}.mce-floatpanel.mce-popover.mce-bottom.mce-start>.mce-arrow{left:20px}.mce-floatpanel.mce-popover.mce-bottom.mce-end{margin-left:22px}.mce-floatpanel.mce-popover.mce-bottom.mce-end>.mce-arrow{right:10px;left:auto}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;background:#fff;height:100%}div.mce-fullscreen{position:fixed;top:0;left:0}#mce-modal-block{opacity:0;filter:alpha(opacity=0);zoom:1;position:fixed;left:0;top:0;width:100%;height:100%;background:#000}#mce-modal-block.mce-in{opacity:.3;filter:alpha(opacity=30);zoom:1}.mce-window-move{cursor:move}.mce-window{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0,0,0,.3);-moz-box-shadow:0 3px 7px rgba(0,0,0,.3);box-shadow:0 3px 7px rgba(0,0,0,.3);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background:0 0;background:#fff;position:fixed;top:0;left:0;opacity:0;-webkit-transition:opacity 150ms ease-in;transition:opacity 150ms ease-in}.mce-window.mce-in{opacity:1}.mce-window-head{padding:9px 15px;border-bottom:1px solid #c5c5c5;position:relative}.mce-window-head .mce-close{position:absolute;right:15px;top:9px;font-size:20px;font-weight:700;line-height:20px;color:#858585;cursor:pointer;height:20px;overflow:hidden}.mce-close:hover{color:#adadad}.mce-window-head .mce-title{line-height:20px;font-size:20px;font-weight:700;text-rendering:optimizelegibility;padding-right:10px}.mce-window .mce-container-body{display:block}.mce-foot{display:block;background-color:#fff;border-top:1px solid #c5c5c5;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.mce-window-head .mce-dragh{position:absolute;top:0;left:0;cursor:move;width:90%;height:100%}.mce-window iframe{width:100%;height:100%}.mce-window.mce-fullscreen,.mce-window.mce-fullscreen .mce-foot{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mce-rtl .mce-window-head .mce-close{position:absolute;right:auto;left:15px}.mce-rtl .mce-window-head .mce-dragh{left:auto;right:0}.mce-rtl .mce-window-head .mce-title{direction:rtl;text-align:right}.mce-abs-layout{position:relative}body .mce-abs-layout-item,.mce-abs-end{position:absolute}.mce-abs-end{width:1px;height:1px}.mce-container-body.mce-abs-layout{overflow:hidden}.mce-tooltip{position:absolute;padding:5px;opacity:.8;filter:alpha(opacity=80);zoom:1}.mce-tooltip-inner{font-size:11px;background-color:#000;color:#fff;max-width:200px;padding:5px 8px 4px 8px;text-align:center;white-space:normal}.mce-tooltip-inner{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-tooltip-inner{-webkit-box-shadow:0 0 5px #000;-moz-box-shadow:0 0 5px #000;box-shadow:0 0 5px #000}.mce-tooltip-arrow{position:absolute;width:0;height:0;line-height:0;border:5px dashed #000}.mce-tooltip-arrow-n{border-bottom-color:#000}.mce-tooltip-arrow-s{border-top-color:#000}.mce-tooltip-arrow-e{border-left-color:#000}.mce-tooltip-arrow-w{border-right-color:#000}.mce-tooltip-nw,.mce-tooltip-sw{margin-left:-14px}.mce-tooltip-n .mce-tooltip-arrow{top:0;left:50%;margin-left:-5px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-nw .mce-tooltip-arrow{top:0;left:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-ne .mce-tooltip-arrow{top:0;right:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-s .mce-tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-sw .mce-tooltip-arrow{bottom:0;left:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-se .mce-tooltip-arrow{bottom:0;right:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-e .mce-tooltip-arrow{right:0;top:50%;margin-top:-5px;border-left-style:solid;border-right:none;border-top-color:transparent;border-bottom-color:transparent}.mce-tooltip-w .mce-tooltip-arrow{left:0;top:50%;margin-top:-5px;border-right-style:solid;border-left:none;border-top-color:transparent;border-bottom-color:transparent}.mce-btn{border:1px solid #b1b1b1;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25) rgba(0,0,0,.25);position:relative;text-shadow:0 1px 1px rgba(255,255,255,.75);display:inline-block;;;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);background-color:#f0f0f0;background-image:-moz-linear-gradient(top,#fff,#d9d9d9);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#d9d9d9));background-image:-webkit-linear-gradient(top,#fff,#d9d9d9);background-image:-o-linear-gradient(top,#fff,#d9d9d9);background-image:linear-gradient(to bottom,#fff,#d9d9d9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffd9d9d9', GradientType=0);zoom:1}.mce-btn:hover,.mce-btn:focus{color:#333;background-color:#e3e3e3;background-image:-moz-linear-gradient(top,#f2f2f2,#ccc);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#ccc));background-image:-webkit-linear-gradient(top,#f2f2f2,#ccc);background-image:-o-linear-gradient(top,#f2f2f2,#ccc);background-image:linear-gradient(to bottom,#f2f2f2,#ccc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffcccccc', GradientType=0);zoom:1}.mce-btn.mce-disabled button,.mce-btn.mce-disabled:hover button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-btn.mce-active,.mce-btn.mce-active:hover{background-color:#d6d6d6;background-image:-moz-linear-gradient(top,#e6e6e6,silver);background-image:-webkit-gradient(linear,0 0,0 100%,from(#e6e6e6),to(silver));background-image:-webkit-linear-gradient(top,#e6e6e6,silver);background-image:-o-linear-gradient(top,#e6e6e6,silver);background-image:linear-gradient(to bottom,#e6e6e6,silver);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe6e6e6', endColorstr='#ffc0c0c0', GradientType=0);zoom:1;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.mce-btn:active{background-color:#d6d6d6;background-image:-moz-linear-gradient(top,#e6e6e6,silver);background-image:-webkit-gradient(linear,0 0,0 100%,from(#e6e6e6),to(silver));background-image:-webkit-linear-gradient(top,#e6e6e6,silver);background-image:-o-linear-gradient(top,#e6e6e6,silver);background-image:linear-gradient(to bottom,#e6e6e6,silver);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe6e6e6', endColorstr='#ffc0c0c0', GradientType=0);zoom:1;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.mce-btn button{padding:4px 10px;font-size:14px;line-height:20px;;cursor:pointer;color:#333;text-align:center;overflow:visible;-webkit-appearance:none}.mce-btn button::-moz-focus-inner{border:0;padding:0}.mce-btn i{text-shadow:1px 1px #fff}.mce-primary{min-width:50px;color:#fff;border:1px solid #b1b1b1;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25) rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);zoom:1}.mce-primary:hover,.mce-primary:focus{background-color:#005fb3;background-image:-moz-linear-gradient(top,#0077b3,#003cb3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#0077b3),to(#003cb3));background-image:-webkit-linear-gradient(top,#0077b3,#003cb3);background-image:-o-linear-gradient(top,#0077b3,#003cb3);background-image:linear-gradient(to bottom,#0077b3,#003cb3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0077b3', endColorstr='#ff003cb3', GradientType=0);zoom:1}.mce-primary.mce-disabled button,.mce-primary.mce-disabled:hover button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-primary.mce-active,.mce-primary.mce-active:hover,.mce-primary:not(.mce-disabled):active{background-color:#005299;background-image:-moz-linear-gradient(top,#069,#039);background-image:-webkit-gradient(linear,0 0,0 100%,from(#069),to(#039));background-image:-webkit-linear-gradient(top,#069,#039);background-image:-o-linear-gradient(top,#069,#039);background-image:linear-gradient(to bottom,#069,#039);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff006699', endColorstr='#ff003399', GradientType=0);zoom:1;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.mce-primary button,.mce-primary button i{color:#fff;text-shadow:1px 1px #333}.mce-btn-large button{padding:9px 14px;font-size:16px;line-height:normal;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.mce-btn-large i{margin-top:2px}.mce-btn-small button{padding:1px 5px;font-size:12px;}.mce-btn-small i{line-height:20px;vertical-align:top;}.mce-btn .mce-caret{margin-top:8px;margin-left:0}.mce-btn-small .mce-caret{margin-top:8px;margin-left:0}.mce-caret{display:inline-block;;;width:0;height:0;vertical-align:top;border-top:4px solid #333;border-right:4px solid transparent;border-left:4px solid transparent;content:""}.mce-disabled .mce-caret{border-top-color:#aaa}.mce-caret.mce-up{border-bottom:4px solid #333;border-top:0}.mce-btn-flat{border:0;background:0 0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:none}.mce-btn-flat:hover,.mce-btn-flat.mce-active,.mce-btn-flat:focus,.mce-btn-flat:active{border:0;background:#e6e6e6;filter:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-rtl .mce-btn button{direction:rtl}.mce-btn-group .mce-btn{border-width:1px 0 1px 0;margin:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mce-btn-group .mce-first{border-left:1px solid #b1b1b1;border-left:1px solid rgba(0,0,0,.25);-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.mce-btn-group .mce-last{border-right:1px solid #b1b1b1;border-right:1px solid rgba(0,0,0,.1);-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.mce-btn-group .mce-first.mce-last{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-btn-group .mce-btn.mce-flow-layout-item{margin:0}.mce-checkbox{cursor:pointer}i.mce-i-checkbox{margin:0 3px 0 0;border:1px solid #c5c5c5;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);background-color:#f0f0f0;background-image:-moz-linear-gradient(top,#fff,#d9d9d9);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#d9d9d9));background-image:-webkit-linear-gradient(top,#fff,#d9d9d9);background-image:-o-linear-gradient(top,#fff,#d9d9d9);background-image:linear-gradient(to bottom,#fff,#d9d9d9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffd9d9d9', GradientType=0);zoom:1;text-indent:-10em;;;;overflow:hidden}.mce-checked i.mce-i-checkbox{color:#333;font-size:16px;line-height:16px;text-indent:0}.mce-checkbox:focus i.mce-i-checkbox,.mce-checkbox.mce-focus i.mce-i-checkbox{border:1px solid rgba(82,168,236,.8);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65)}.mce-checkbox.mce-disabled .mce-label,.mce-checkbox.mce-disabled i.mce-i-checkbox{color:#acacac}.mce-rtl .mce-checkbox{direction:rtl;text-align:right}.mce-rtl i.mce-i-checkbox{margin:0 0 0 3px}.mce-combobox{display:inline-block;;;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);}.mce-combobox input{border:1px solid #c5c5c5;border-right-color:#c5c5c5;height:28px}.mce-combobox.mce-disabled input{color:#adadad}.mce-combobox.mce-has-open input{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.mce-combobox .mce-btn{border-left:0;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.mce-combobox button{padding-right:8px;padding-left:8px}.mce-combobox.mce-disabled .mce-btn button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-colorbox i{border:1px solid #c5c5c5;width:14px;height:14px}.mce-colorbutton .mce-ico{position:relative}.mce-colorbutton-grid{margin:4px}.mce-colorbutton button{padding-right:4px}.mce-colorbutton .mce-preview{padding-right:3px;display:block;position:absolute;left:50%;top:50%;margin-left:-14px;margin-top:7px;background:gray;width:13px;height:2px;overflow:hidden}.mce-colorbutton.mce-btn-small .mce-preview{margin-left:-16px;padding-right:0;width:16px}.mce-colorbutton .mce-open{padding-left:4px;border-left:1px solid transparent;border-right:1px solid transparent}.mce-colorbutton:hover .mce-open{border-left-color:#bdbdbd;border-right-color:#bdbdbd}.mce-colorbutton.mce-btn-small .mce-open{padding:0 3px 0 3px}.mce-rtl .mce-colorbutton{direction:rtl}.mce-rtl .mce-colorbutton .mce-preview{margin-left:0;padding-right:0;padding-left:4px;margin-right:-14px}.mce-rtl .mce-colorbutton.mce-btn-small .mce-preview{margin-left:0;padding-right:0;margin-right:-17px;padding-left:0}.mce-rtl .mce-colorbutton button{padding-right:10px;padding-left:10px}.mce-rtl .mce-colorbutton .mce-open{padding-left:4px;padding-right:4px}.mce-colorpicker{position:relative;width:250px;height:220px}.mce-colorpicker-sv{position:absolute;top:0;left:0;width:90%;height:100%;border:1px solid #c5c5c5;cursor:crosshair;overflow:hidden}.mce-colorpicker-h-chunk{width:100%}.mce-colorpicker-overlay1,.mce-colorpicker-overlay2{width:100%;height:100%;position:absolute;top:0;left:0}.mce-colorpicker-overlay1{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr='#ffffff', endColorstr='#00ffffff');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff')";background:linear-gradient(to right,#fff,rgba(255,255,255,0))}.mce-colorpicker-overlay2{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#00000000', endColorstr='#000000');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000')";background:linear-gradient(to bottom,rgba(0,0,0,0),#000)}.mce-colorpicker-selector1{background:0 0;position:absolute;width:12px;height:12px;margin:-8px 0 0 -8px;border:1px solid #000;border-radius:50%}.mce-colorpicker-selector2{position:absolute;width:10px;height:10px;border:1px solid #fff;border-radius:50%}.mce-colorpicker-h{position:absolute;top:0;right:0;width:6.5%;height:100%;border:1px solid #c5c5c5;cursor:crosshair}.mce-colorpicker-h-marker{margin-top:-4px;position:absolute;top:0;left:-1px;width:100%;border:1px solid #333;background:#fff;height:4px;z-index:100}.mce-path{display:inline-block;;;padding:8px;white-space:normal}.mce-path .mce-txt{display:inline-block;padding-right:3px}.mce-path .mce-path-body{display:inline-block}.mce-path-item{display:inline-block;;;cursor:pointer;color:#333}.mce-path-item:hover{text-decoration:underline}.mce-path-item:focus{background:#666;color:#fff}.mce-path .mce-divider{display:inline}.mce-disabled .mce-path-item{color:#aaa}.mce-rtl .mce-path{direction:rtl}.mce-fieldset{border:0 solid #9E9E9E;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-fieldset>.mce-container-body{margin-top:-15px}.mce-fieldset-title{margin-left:5px;padding:0 5px 0 5px}.mce-fit-layout{display:inline-block;;}.mce-fit-layout-item{position:absolute}.mce-flow-layout-item{display:inline-block;;}.mce-flow-layout-item{margin:2px 0 2px 2px}.mce-flow-layout-item.mce-last{margin-right:2px}.mce-flow-layout{white-space:normal}.mce-tinymce-inline .mce-flow-layout{white-space:nowrap}.mce-rtl .mce-flow-layout{text-align:right;direction:rtl}.mce-rtl .mce-flow-layout-item{margin:2px 2px 2px 0}.mce-rtl .mce-flow-layout-item.mce-last{margin-left:2px}.mce-iframe{border:0 solid #9e9e9e;width:100%;height:100%}.mce-label{display:inline-block;;;text-shadow:0 1px 1px rgba(255,255,255,.75);overflow:hidden}.mce-label.mce-autoscroll{overflow:auto}.mce-label.mce-disabled{color:#aaa}.mce-label.mce-multiline{white-space:pre-wrap}.mce-label.mce-error{color:#a00}.mce-rtl .mce-label{text-align:right;direction:rtl}.mce-menubar .mce-menubtn{border-color:transparent;background:0 0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:none}.mce-menubar{border:1px solid #c4c4c4}.mce-menubar .mce-menubtn button span{color:#333}.mce-menubar .mce-caret{border-top-color:#333}.mce-menubar .mce-menubtn:hover,.mce-menubar .mce-menubtn.mce-active,.mce-menubar .mce-menubtn:focus{border-color:transparent;background:#e6e6e6;filter:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-menubtn span{color:#333;margin-right:2px;line-height:20px;}.mce-menubtn.mce-btn-small span{font-size:12px}.mce-menubtn.mce-fixed-width span{display:inline-block;overflow-x:hidden;text-overflow:ellipsis;width:90px}.mce-menubtn.mce-fixed-width.mce-btn-small span{width:70px}.mce-rtl .mce-menubtn button{direction:rtl;text-align:right}.mce-listbox button{text-align:left;padding-right:20px;position:relative}.mce-listbox .mce-caret{position:absolute;margin-top:-2px;right:8px;top:50%}.mce-rtl .mce-listbox .mce-caret{right:auto;left:8px}.mce-rtl .mce-listbox button{padding-right:10px;padding-left:20px}.mce-menu-item{display:block;padding:6px 15px 6px 12px;clear:both;font-weight:400;line-height:20px;color:#333;white-space:nowrap;cursor:pointer;line-height:normal;border-left:4px solid transparent;margin-bottom:1px}.mce-menu-item .mce-ico,.mce-menu-item .mce-text{color:#333}.mce-menu-item.mce-disabled .mce-text,.mce-menu-item.mce-disabled .mce-ico{color:#adadad}.mce-menu-item:hover .mce-text,.mce-menu-item.mce-selected .mce-text,.mce-menu-item:focus .mce-text{color:#fff}.mce-menu-item:hover .mce-ico,.mce-menu-item.mce-selected .mce-ico,.mce-menu-item:focus .mce-ico{color:#fff}.mce-menu-item.mce-disabled:hover{background:#ccc}.mce-menu-shortcut{display:inline-block;color:#adadad}.mce-menu-shortcut{display:inline-block;;;padding:0 15px 0 20px}.mce-menu-item:hover .mce-menu-shortcut,.mce-menu-item.mce-selected .mce-menu-shortcut,.mce-menu-item:focus .mce-menu-shortcut{color:#fff}.mce-menu-item .mce-caret{margin-top:4px;;margin-right:6px;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid #333}.mce-menu-item.mce-selected .mce-caret,.mce-menu-item:focus .mce-caret,.mce-menu-item:hover .mce-caret{border-left-color:#fff}.mce-menu-align .mce-menu-shortcut,.mce-menu-align .mce-caret{position:absolute;right:0}.mce-menu-item.mce-active i{visibility:visible}.mce-menu-item-normal.mce-active{background-color:#c8def4}.mce-menu-item-preview.mce-active{border-left:5px solid #aaa}.mce-menu-item-normal.mce-active .mce-text{color:#333}.mce-menu-item-normal.mce-active:hover .mce-text,.mce-menu-item-normal.mce-active:hover .mce-ico{color:#fff}.mce-menu-item-normal.mce-active:focus .mce-text,.mce-menu-item-normal.mce-active:focus .mce-ico{color:#fff}.mce-menu-item:hover,.mce-menu-item.mce-selected,.mce-menu-item:focus{text-decoration:none;color:#fff;background-color:#0081c2;background-image:-moz-linear-gradient(top,#08c,#0077b3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#0077b3));background-image:-webkit-linear-gradient(top,#08c,#0077b3);background-image:-o-linear-gradient(top,#08c,#0077b3);background-image:linear-gradient(to bottom,#08c,#0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);zoom:1}div.mce-menu .mce-menu-item-sep,.mce-menu-item-sep:hover{border:0;padding:0;height:1px;margin:9px 1px;overflow:hidden;background:#cbcbcb;border-bottom:1px solid #fff;cursor:default;filter:none}.mce-menu.mce-rtl{direction:rtl}.mce-rtl .mce-menu-item{text-align:right;direction:rtl;padding:6px 12px 6px 15px}.mce-menu-align.mce-rtl .mce-menu-shortcut,.mce-menu-align.mce-rtl .mce-caret{right:auto;left:0}.mce-rtl .mce-menu-item .mce-caret{margin-left:6px;margin-right:0;border-right:4px solid #333;border-left:0}.mce-rtl .mce-menu-item.mce-selected .mce-caret,.mce-rtl .mce-menu-item:focus .mce-caret,.mce-rtl .mce-menu-item:hover .mce-caret{border-left-color:transparent;border-right-color:#fff}.mce-menu{position:absolute;left:0;top:0;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background:0 0;z-index:1000;padding:5px 0 5px 0;margin:2px 0 0;min-width:160px;background:#fff;border:1px solid #989898;border:1px solid rgba(0,0,0,.2);z-index:1002;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);max-height:400px;overflow:auto;overflow-x:hidden}.mce-menu i{display:none}.mce-menu-has-icons i{display:inline-block;}.mce-menu-sub-tr-tl{margin:-6px 0 0 -1px}.mce-menu-sub-br-bl{margin:6px 0 0 -1px}.mce-menu-sub-tl-tr{margin:-6px 0 0 1px}.mce-menu-sub-bl-br{margin:6px 0 0 1px}.mce-container-body .mce-resizehandle{position:absolute;right:0;bottom:0;width:16px;height:16px;visibility:visible;cursor:s-resize;margin:0}.mce-container-body .mce-resizehandle-both{cursor:se-resize}i.mce-i-resize{color:#333}.mce-spacer{visibility:hidden}.mce-splitbtn .mce-open{border-left:1px solid transparent;border-right:1px solid transparent}.mce-splitbtn:hover .mce-open{border-left-color:#bdbdbd;border-right-color:#bdbdbd}.mce-splitbtn button{padding-right:4px}.mce-splitbtn .mce-open{padding-left:4px}.mce-splitbtn .mce-open.mce-active{-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.mce-splitbtn.mce-btn-small .mce-open{padding:0 3px 0 3px}.mce-rtl .mce-splitbtn{direction:rtl;text-align:right}.mce-rtl .mce-splitbtn button{padding-right:10px;padding-left:10px}.mce-rtl .mce-splitbtn .mce-open{padding-left:4px;padding-right:4px}.mce-stack-layout-item{display:block}.mce-tabs{display:block;border-bottom:1px solid #c5c5c5}.mce-tab{display:inline-block;;;border:1px solid #c5c5c5;border-width:0 1px 0 0;background:#e3e3e3;padding:8px;text-shadow:0 1px 1px rgba(255,255,255,.75);height:13px;cursor:pointer}.mce-tab:hover{background:#fdfdfd}.mce-tab.mce-active{background:#fdfdfd;border-bottom-color:transparent;margin-bottom:-1px;height:14px}.mce-rtl .mce-tabs{text-align:right;direction:rtl}.mce-rtl .mce-tab{border-width:0 0 0 1px}.mce-textbox{background:#fff;border:1px solid #c5c5c5;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);display:inline-block;-webkit-transition:border linear .2s,box-shadow linear .2s;transition:border linear .2s,box-shadow linear .2s;height:28px;resize:none;padding:0 4px 0 4px;white-space:pre-wrap;;color:#333}.mce-textbox:focus,.mce-textbox.mce-focus{border-color:rgba(82,168,236,.8);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65)}.mce-placeholder .mce-textbox{color:#aaa}.mce-textbox.mce-multiline{padding:4px}.mce-textbox.mce-disabled{color:#adadad}.mce-rtl .mce-textbox{text-align:right;direction:rtl}.mce-throbber{position:absolute;top:0;left:0;width:100%;height:100%;opacity:.6;filter:alpha(opacity=60);zoom:1;background:#fff url(img/loader.gif) no-repeat center center}.mce-throbber-inline{position:static;height:50px}@font-face{font-family:tinymce;src:url(fonts/tinymce.eot);src:url(fonts/tinymce.eot?#iefix) format('embedded-opentype'),url(fonts/tinymce.woff) format('woff'),url(fonts/tinymce.ttf) format('truetype'),url(fonts/tinymce.svg#tinymce) format('svg');font-weight:400;font-style:normal}@font-face{font-family:tinymce-small;src:url(fonts/tinymce-small.eot);src:url(fonts/tinymce-small.eot?#iefix) format('embedded-opentype'),url(fonts/tinymce-small.woff) format('woff'),url(fonts/tinymce-small.ttf) format('truetype'),url(fonts/tinymce-small.svg#tinymce) format('svg');font-weight:400;font-style:normal}.mce-ico{font-family:tinymce,Arial;font-style:normal;font-weight:400;font-variant:normal;font-size:16px;line-height:16px;speak:none;vertical-align:text-top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;background:transparent center center;background-size:cover;width:16px;height:16px;color:#333}.mce-btn-small .mce-ico{font-family:tinymce-small,Arial}.mce-i-save:before{content:"\e000"}.mce-i-newdocument:before{content:"\e001"}.mce-i-fullpage:before{content:"\e002"}.mce-i-alignleft:before{content:"\e003"}.mce-i-aligncenter:before{content:"\e004"}.mce-i-alignright:before{content:"\e005"}.mce-i-alignjustify:before{content:"\e006"}.mce-i-cut:before{content:"\e007"}.mce-i-paste:before{content:"\e008"}.mce-i-searchreplace:before{content:"\e009"}.mce-i-bullist:before{content:"\e00a"}.mce-i-numlist:before{content:"\e00b"}.mce-i-indent:before{content:"\e00c"}.mce-i-outdent:before{content:"\e00d"}.mce-i-blockquote:before{content:"\e00e"}.mce-i-undo:before{content:"\e00f"}.mce-i-redo:before{content:"\e010"}.mce-i-link:before{content:"\e011"}.mce-i-unlink:before{content:"\e012"}.mce-i-anchor:before{content:"\e013"}.mce-i-image:before{content:"\e014"}.mce-i-media:before{content:"\e015"}.mce-i-help:before{content:"\e016"}.mce-i-code:before{content:"\e017"}.mce-i-insertdatetime:before{content:"\e018"}.mce-i-preview:before{content:"\e019"}.mce-i-forecolor:before{content:"\e01a"}.mce-i-backcolor:before{content:"\e01a"}.mce-i-table:before{content:"\e01b"}.mce-i-hr:before{content:"\e01c"}.mce-i-removeformat:before{content:"\e01d"}.mce-i-subscript:before{content:"\e01e"}.mce-i-superscript:before{content:"\e01f"}.mce-i-charmap:before{content:"\e020"}.mce-i-emoticons:before{content:"\e021"}.mce-i-print:before{content:"\e022"}.mce-i-fullscreen:before{content:"\e023"}.mce-i-spellchecker:before{content:"\e024"}.mce-i-nonbreaking:before{content:"\e025"}.mce-i-template:before{content:"\e026"}.mce-i-pagebreak:before{content:"\e027"}.mce-i-restoredraft:before{content:"\e028"}.mce-i-untitled:before{content:"\e029"}.mce-i-bold:before{content:"\e02a"}.mce-i-italic:before{content:"\e02b"}.mce-i-underline:before{content:"\e02c"}.mce-i-strikethrough:before{content:"\e02d"}.mce-i-visualchars:before{content:"\e02e"}.mce-i-visualblocks:before{content:"\e02e"}.mce-i-ltr:before{content:"\e02f"}.mce-i-rtl:before{content:"\e030"}.mce-i-copy:before{content:"\e031"}.mce-i-resize:before{content:"\e032"}.mce-i-browse:before{content:"\e034"}.mce-i-pastetext:before{content:"\e035"}.mce-i-checkbox:before,.mce-i-selected:before{content:"\e033"}.mce-i-selected{visibility:hidden}i.mce-i-backcolor{text-shadow:none;background:#bbb} \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/ext/tinymce/themes/modern/theme.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/tinymce/themes/modern/theme.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,1 @@ +tinymce.ThemeManager.add("modern",function(a){function b(){function b(b){var d,e=[];if(b)return l(b.split(/[ ,]/),function(b){function c(){var c=a.selection;"bullist"==f&&c.selectorChanged("ul > li",function(a,c){for(var d,e=c.parents.length;e--&&(d=c.parents[e].nodeName,"OL"!=d&&"UL"!=d););b.active(a&&"UL"==d)}),"numlist"==f&&c.selectorChanged("ol > li",function(a,c){for(var d,e=c.parents.length;e--&&(d=c.parents[e].nodeName,"OL"!=d&&"UL"!=d););b.active(a&&"OL"==d)}),b.settings.stateSelector&&c.selectorChanged(b.settings.stateSelector,function(a){b.active(a)},!0),b.settings.disabledStateSelector&&c.selectorChanged(b.settings.disabledStateSelector,function(a){b.disabled(a)})}var f;"|"==b?d=null:k.has(b)?(b={type:b},j.toolbar_items_size&&(b.size=j.toolbar_items_size),e.push(b),d=null):(d||(d={type:"buttongroup",items:[]},e.push(d)),a.buttons[b]&&(f=b,b=a.buttons[f],"function"==typeof b&&(b=b()),b.type=b.type||"button",j.toolbar_items_size&&(b.size=j.toolbar_items_size),b=k.create(b),d.items.push(b),a.initialized?c():a.on("init",c)))}),c.push({type:"toolbar",layout:"flow",items:e}),!0}var c=[];if(tinymce.isArray(j.toolbar)){if(0===j.toolbar.length)return;tinymce.each(j.toolbar,function(a,b){j["toolbar"+(b+1)]=a}),delete j.toolbar}for(var d=1;10>d&&b(j["toolbar"+d]);d++);return c.length||j.toolbar===!1||b(j.toolbar||o),c.length?{type:"panel",layout:"stack",classes:"toolbar-grp",ariaRoot:!0,ariaRemember:!0,items:c}:void 0}function c(){function b(b){var c;return"|"==b?{text:"|"}:c=a.menuItems[b]}function c(c){var d,e,f,g,h;if(h=tinymce.makeMap((j.removed_menuitems||"").split(/[ ,]/)),j.menu?(e=j.menu[c],g=!0):e=n[c],e){d={text:e.title},f=[],l((e.items||"").split(/[ ,]/),function(a){var c=b(a);c&&!h[a]&&f.push(b(a))}),g||l(a.menuItems,function(a){a.context==c&&("before"==a.separator&&f.push({text:"|"}),a.prependToContext?f.unshift(a):f.push(a),"after"==a.separator&&f.push({text:"|"}))});for(var i=0;ir;r++)if(o=n[r],o&&o.func.call(o.scope,e)===!1&&e.preventDefault(),e.isImmediatePropagationStopped())return}var a=this,s={},l,c,u,d,f;c=o+(+new Date).toString(32),d="onmouseenter"in document.documentElement,u="onfocusin"in document.documentElement,f={mouseenter:"mouseover",mouseleave:"mouseout"},l=1,a.domLoaded=!1,a.events=s,a.bind=function(t,o,p,h){function m(e){i(n(e||_.event),g)}var g,v,y,b,C,x,w,_=window;if(t&&3!==t.nodeType&&8!==t.nodeType){for(t[c]?g=t[c]:(g=l++,t[c]=g,s[g]={}),h=h||t,o=o.split(" "),y=o.length;y--;)b=o[y],x=m,C=w=!1,"DOMContentLoaded"===b&&(b="ready"),a.domLoaded&&"ready"===b&&"complete"==t.readyState?p.call(h,n({type:b})):(d||(C=f[b],C&&(x=function(e){var t,r;if(t=e.currentTarget,r=e.relatedTarget,r&&t.contains)r=t.contains(r);else for(;r&&r!==t;)r=r.parentNode;r||(e=n(e||_.event),e.type="mouseout"===e.type?"mouseleave":"mouseenter",e.target=t,i(e,g))})),u||"focusin"!==b&&"focusout"!==b||(w=!0,C="focusin"===b?"focus":"blur",x=function(e){e=n(e||_.event),e.type="focus"===e.type?"focusin":"focusout",i(e,g)}),v=s[g][b],v?"ready"===b&&a.domLoaded?p({type:b}):v.push({func:p,scope:h}):(s[g][b]=v=[{func:p,scope:h}],v.fakeName=C,v.capture=w,v.nativeHandler=x,"ready"===b?r(t,x,a):e(t,C||b,x,w)));return t=v=0,p}},a.unbind=function(e,n,r){var i,o,l,u,d,f;if(!e||3===e.nodeType||8===e.nodeType)return a;if(i=e[c]){if(f=s[i],n){for(n=n.split(" "),l=n.length;l--;)if(d=n[l],o=f[d]){if(r)for(u=o.length;u--;)if(o[u].func===r){var p=o.nativeHandler,h=o.fakeName,m=o.capture;o=o.slice(0,u).concat(o.slice(u+1)),o.nativeHandler=p,o.fakeName=h,o.capture=m,f[d]=o}r&&0!==o.length||(delete f[d],t(e,o.fakeName||d,o.nativeHandler,o.capture))}}else{for(d in f)o=f[d],t(e,o.fakeName||d,o.nativeHandler,o.capture);f={}}for(d in f)return a;delete s[i];try{delete e[c]}catch(g){e[c]=null}}return a},a.fire=function(e,t,r){var o;if(!e||3===e.nodeType||8===e.nodeType)return a;r=n(null,r),r.type=t,r.target=e;do o=e[c],o&&i(r,o),e=e.parentNode||e.ownerDocument||e.defaultView||e.parentWindow;while(e&&!r.isPropagationStopped());return a},a.clean=function(e){var t,n,r=a.unbind;if(!e||3===e.nodeType||8===e.nodeType)return a;if(e[c]&&r(e),e.getElementsByTagName||(e=e.document),e&&e.getElementsByTagName)for(r(e),n=e.getElementsByTagName("*"),t=n.length;t--;)e=n[t],e[c]&&r(e);return a},a.destroy=function(){s={}},a.cancel=function(e){return e&&(e.preventDefault(),e.stopImmediatePropagation()),!1}}var o="mce-data-",a=/^(?:mouse|contextmenu)|click/,s={keyLocation:1,layerX:1,layerY:1,returnValue:1};return i.Event=new i,i.Event.bind(window,"ready",function(){}),i}),r(c,[],function(){if(!window.jQuery)throw new Error("Load jQuery first");return jQuery.find}),r(u,[],function(){var e=navigator,t=e.userAgent,n,r,i,o,a,s,l,c,u;n=window.opera&&window.opera.buildNumber,u=/Android/.test(t),r=/WebKit/.test(t),i=!r&&!n&&/MSIE/gi.test(t)&&/Explorer/gi.test(e.appName),i=i&&/MSIE (\w+)\./.exec(t)[1],o=-1==t.indexOf("Trident/")||-1==t.indexOf("rv:")&&-1==e.appName.indexOf("Netscape")?!1:11,a=!document.msElementsFromPoint||i||o?!1:12,i=i||o||a,s=!r&&!o&&/Gecko/.test(t),l=-1!=t.indexOf("Mac"),c=/(iPad|iPhone)/.test(t),a&&(r=!1);var d=!c||t.match(/AppleWebKit\/(\d*)/)[1]>=534;return{opera:n,webkit:r,ie:i,gecko:s,mac:l,iOS:c,android:u,contentEditable:d,transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",caretAfter:8!=i,range:window.getSelection&&"Range"in window,documentMode:i&&!a?document.documentMode||7:10}}),r(d,[u],function(e){function n(e){return null===e||e===t?"":(""+e).replace(v,"")}function r(e,n){return n?"array"==n&&y(e)?!0:typeof e==n:e!==t}function i(e){var t=e,n,r;if(!y(e))for(t=[],n=0,r=e.length;r>n;n++)t[n]=e[n];return t}function o(e,t,n){var r;for(e=e||[],t=t||",","string"==typeof e&&(e=e.split(t)),n=n||{},r=e.length;r--;)n[e[r]]={};return n}function a(e,n,r){var i,o;if(!e)return 0;if(r=r||e,e.length!==t){for(i=0,o=e.length;o>i;i++)if(n.call(r,e[i],i,e)===!1)return 0}else for(i in e)if(e.hasOwnProperty(i)&&n.call(r,e[i],i,e)===!1)return 0;return 1}function s(e,t){var n=[];return a(e,function(e){n.push(t(e))}),n}function l(e,t){var n=[];return a(e,function(e){(!t||t(e))&&n.push(e)}),n}function c(e,t,n){var r=this,i,o,a,s,l,c=0;if(e=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(e),a=e[3].match(/(^|\.)(\w+)$/i)[2],o=r.createNS(e[3].replace(/\.\w+$/,""),n),!o[a]){if("static"==e[2])return o[a]=t,void(this.onCreate&&this.onCreate(e[2],e[3],o[a]));t[a]||(t[a]=function(){},c=1),o[a]=t[a],r.extend(o[a].prototype,t),e[5]&&(i=r.resolve(e[5]).prototype,s=e[5].match(/\.(\w+)$/i)[1],l=o[a],c?o[a]=function(){return i[s].apply(this,arguments)}:o[a]=function(){return this.parent=i[s],l.apply(this,arguments)},o[a].prototype[a]=o[a],r.each(i,function(e,t){o[a].prototype[t]=i[t]}),r.each(t,function(e,t){i[t]?o[a].prototype[t]=function(){return this.parent=i[t],e.apply(this,arguments)}:t!=a&&(o[a].prototype[t]=e)})),r.each(t["static"],function(e,t){o[a][t]=e})}}function u(e,t){var n,r;if(e)for(n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1}function d(e,n){var r,i,o,a=arguments,s;for(r=1,i=a.length;i>r;r++){n=a[r];for(o in n)n.hasOwnProperty(o)&&(s=n[o],s!==t&&(e[o]=s))}return e}function f(e,t,n,r){r=r||this,e&&(n&&(e=e[n]),a(e,function(e,i){return t.call(r,e,i,n)===!1?!1:void f(e,t,n,r)}))}function p(e,t){var n,r;for(t=t||window,e=e.split("."),n=0;nn&&(t=t[e[n]],t);n++);return t}function m(e,t){return!e||r(e,"array")?e:s(e.split(t||","),n)}function g(t){var n=e.cacheSuffix;return n&&(t+=(-1===t.indexOf("?")?"?":"&")+n),t}var v=/^\s*|\s*$/g,y=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};return{trim:n,isArray:y,is:r,toArray:i,makeMap:o,each:a,map:s,grep:l,inArray:u,extend:d,create:c,walk:f,createNS:p,resolve:h,explode:m,_addCacheSuffix:g}}),r(f,[l,c,d,u],function(e,n,r,i){function o(e){return"undefined"!=typeof e}function a(e){return"string"==typeof e}function s(e){return e&&e==e.window}function l(e,t){var n,r,i;for(t=t||w,i=t.createElement("div"),n=t.createDocumentFragment(),i.innerHTML=e;r=i.firstChild;)n.appendChild(r);return n}function c(e,t,n,r){var i;if(a(t))t=l(t,v(e[0]));else if(t.length&&!t.nodeType){if(t=f.makeArray(t),r)for(i=t.length-1;i>=0;i--)c(e,t[i],n,r);else for(i=0;ii&&(a=e[i],t.call(a,i,a)!==!1);i++);return e}function g(e,t){var n=[];return m(e,function(e,r){t(r,e)&&n.push(r)}),n}function v(e){return e?9==e.nodeType?e:e.ownerDocument:w}function y(e,n,r){var i=[],o=e[n];for("string"!=typeof r&&r instanceof f&&(r=r[0]);o&&9!==o.nodeType;){if(r!==t){if(o===r)break;if("string"==typeof r&&f(o).is(r))break}1===o.nodeType&&i.push(o),o=o[n]}return i}function b(e,n,r,i){var o=[];for(i instanceof f&&(i=i[0]);e;e=e[n])if(!r||e.nodeType===r){if(i!==t){if(e===i)break;if("string"==typeof i&&f(e).is(i))break}o.push(e)}return o}function C(e,t,n){for(e=e[t];e;e=e[t])if(e.nodeType==n)return e;return null}function x(e,t,n){m(n,function(n,r){e[n]=e[n]||{},e[n][t]=r})}var w=document,_=Array.prototype.push,E=Array.prototype.slice,N=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,k=e.Event,S,T=r.makeMap("fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom"," "),R=r.makeMap("checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected"," "),A={"for":"htmlFor","class":"className",readonly:"readOnly"},B={"float":"cssFloat"},D={},M={},H=/^\s*|\s*$/g;return f.fn=f.prototype={constructor:f,selector:"",context:null,length:0,init:function(e,t){var n=this,r,i;if(!e)return n;if(e.nodeType)return n.context=n[0]=e,n.length=1,n;if(t&&t.nodeType)n.context=t;else{if(t)return f(e).attr(t);n.context=t=document}if(a(e)){if(n.selector=e,r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!r)return f(t).find(e);if(r[1])for(i=l(e,v(t)).firstChild;i;)_.call(n,i),i=i.nextSibling;else{if(i=v(t).getElementById(r[2]),!i)return n;if(i.id!==r[2])return n.find(e);n.length=1,n[0]=i}}else this.add(e,!1);return n},toArray:function(){return r.toArray(this)},add:function(e,t){var n=this,r,i;if(a(e))return n.add(f(e));if(t!==!1)for(r=f.unique(n.toArray().concat(f.makeArray(e))),n.length=r.length,i=0;it;t++)f.find(e,this[t],r);return f(r)},filter:function(e){return f("function"==typeof e?g(this.toArray(),function(t,n){return e(n,t)}):f.filter(e,this.toArray()))},closest:function(e){var t=[];return e instanceof f&&(e=e[0]),this.each(function(n,r){for(;r;){if("string"==typeof e&&f(r).is(e)){t.push(r);break}if(r==e){t.push(r);break}r=r.parentNode}}),f(t)},offset:function(e){var t,n,r,i=0,o=0,a;return e?this.css(e):(t=this[0],t&&(n=t.ownerDocument,r=n.documentElement,t.getBoundingClientRect&&(a=t.getBoundingClientRect(),i=a.left+(r.scrollLeft||n.body.scrollLeft)-r.clientLeft,o=a.top+(r.scrollTop||n.body.scrollTop)-r.clientTop)),{left:i,top:o})},push:_,sort:[].sort,splice:[].splice},r.extend(f,{extend:r.extend,makeArray:function(e){return s(e)||e.nodeType?[e]:r.toArray(e)},inArray:p,isArray:r.isArray,each:m,trim:h,grep:g,find:n,expr:n.selectors,unique:n.uniqueSort,text:n.getText,contains:n.contains,filter:function(e,t,n){var r=t.length;for(n&&(e=":not("+e+")");r--;)1!=t[r].nodeType&&t.splice(r,1);return t=1===t.length?f.find.matchesSelector(t[0],e)?[t[0]]:[]:f.find.matches(e,t)}}),m({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return y(e,"parentNode")},next:function(e){return C(e,"nextSibling",1)},prev:function(e){return C(e,"previousSibling",1)},children:function(e){return b(e.firstChild,"nextSibling",1)},contents:function(e){return r.toArray(("iframe"===e.nodeName?e.contentDocument||e.contentWindow.document:e).childNodes)}},function(e,t){f.fn[e]=function(n){var r=this,i=[];return r.each(function(){var e=t.call(i,this,n,i);e&&(f.isArray(e)?i.push.apply(i,e):i.push(e))}),this.length>1&&(i=f.unique(i),0===e.indexOf("parents")&&(i=i.reverse())),i=f(i),n?i.filter(n):i}}),m({parentsUntil:function(e,t){return y(e,"parentNode",t)},nextUntil:function(e,t){return b(e,"nextSibling",1,t).slice(1)},prevUntil:function(e,t){return b(e,"previousSibling",1,t).slice(1)}},function(e,t){f.fn[e]=function(n,r){var i=this,o=[];return i.each(function(){var e=t.call(o,this,n,o);e&&(f.isArray(e)?o.push.apply(o,e):o.push(e))}),this.length>1&&(o=f.unique(o),(0===e.indexOf("parents")||"prevUntil"===e)&&(o=o.reverse())),o=f(o),r?o.filter(r):o}}),f.fn.is=function(e){return!!e&&this.filter(e).length>0},f.fn.init.prototype=f.fn,f.overrideDefaults=function(e){function t(r,i){return n=n||e(),0===arguments.length&&(r=n.element),i||(i=n.context),new t.fn.init(r,i)}var n;return f.extend(t,this),t},i.ie&&i.ie<8&&(x(D,"get",{maxlength:function(e){var t=e.maxLength;return 2147483647===t?S:t},size:function(e){var t=e.size;return 20===t?S:t},"class":function(e){return e.className},style:function(e){var t=e.style.cssText;return 0===t.length?S:t}}),x(D,"set",{"class":function(e,t){e.className=t},style:function(e,t){e.style.cssText=t}})),i.ie&&i.ie<9&&(B["float"]="styleFloat",x(M,"set",{opacity:function(e,t){var n=e.style;null===t||""===t?n.removeAttribute("filter"):(n.zoom=1,n.filter="alpha(opacity="+100*t+")")}})),f.attrHooks=D,f.cssHooks=M,f}),r(p,[],function(){return function(e,t){function n(e,t,n,r){function i(e){return e=parseInt(e,10).toString(16),e.length>1?e:"0"+e}return"#"+i(t)+i(n)+i(r)}var r=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,i=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,o=/\s*([^:]+):\s*([^;]+);?/g,a=/\s+$/,s,l,c={},u,d,f,p="\ufeff";for(e=e||{},t&&(d=t.getValidStyles(),f=t.getInvalidStyles()),u=("\\\" \\' \\; \\: ; : "+p).split(" "),l=0;l-1&&n||(m[e+t]=-1==l?s[0]:s.join(" "),delete m[e+"-top"+t],delete m[e+"-right"+t],delete m[e+"-bottom"+t],delete m[e+"-left"+t])}}function u(e){var t=m[e],n;if(t){for(t=t.split(" "),n=t.length;n--;)if(t[n]!==t[0])return!1;return m[e]=t[0],!0}}function d(e,t,n,r){u(t)&&u(n)&&u(r)&&(m[e]=m[t]+" "+m[n]+" "+m[r],delete m[t],delete m[n],delete m[r])}function f(e){return b=!0,c[e]}function p(e,t){return b&&(e=e.replace(/\uFEFF[0-9]/g,function(e){return c[e]})),t||(e=e.replace(/\\([\'\";:])/g,"$1")),e}function h(t,n,r,i,o,a){if(o=o||a)return o=p(o),"'"+o.replace(/\'/g,"\\'")+"'";if(n=p(n||r||i),!e.allow_script_urls){var s=n.replace(/[\s\r\n]+/,"");if(/(java|vb)script:/i.test(s))return"";if(!e.allow_svg_data_urls&&/^data:image\/svg/i.test(s))return""}return C&&(n=C.call(x,n,"style")),"url('"+n.replace(/\'/g,"\\'")+"')"}var m={},g,v,y,b,C=e.url_converter,x=e.url_converter_scope||this;if(t){for(t=t.replace(/[\u0000-\u001F]/g,""),t=t.replace(/\\[\"\';:\uFEFF]/g,f).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(e){return e.replace(/[;:]/g,f)});g=o.exec(t);){if(v=g[1].replace(a,"").toLowerCase(),y=g[2].replace(a,""),y=y.replace(/\\[0-9a-f]+/g,function(e){return String.fromCharCode(parseInt(e.substr(1),16))}),v&&y.length>0){if(!e.allow_script_urls&&("behavior"==v||/expression\s*\(|\/\*|\*\//.test(y)))continue;"font-weight"===v&&"700"===y?y="bold":("color"===v||"background-color"===v)&&(y=y.toLowerCase()),y=y.replace(r,n),y=y.replace(i,h),m[v]=b?p(y,!0):y}o.lastIndex=g.index+g[0].length}s("border","",!0),s("border","-width"),s("border","-color"),s("border","-style"),s("padding",""),s("margin",""),d("border","border-width","border-style","border-color"),"medium none"===m.border&&delete m.border,"none"===m["border-image"]&&delete m["border-image"]}return m},serialize:function(e,t){function n(t){var n,r,o,a;if(n=d[t])for(r=0,o=n.length;o>r;r++)t=n[r],a=e[t],a!==s&&a.length>0&&(i+=(i.length>0?" ":"")+t+": "+a+";")}function r(e,t){var n;return n=f["*"],n&&n[e]?!1:(n=f[t],n&&n[e]?!1:!0)}var i="",o,a;if(t&&d)n("*"),n(t);else for(o in e)a=e[o],a!==s&&a.length>0&&(!f||r(o,t))&&(i+=(i.length>0?" ":"")+o+": "+a+";");return i}}}}),r(h,[],function(){return function(e,t){function n(e,n,r,i){var o,a;if(e){if(!i&&e[n])return e[n];if(e!=t){if(o=e[r])return o;for(a=e.parentNode;a&&a!=t;a=a.parentNode)if(o=a[r])return o}}}var r=e;this.current=function(){return r},this.next=function(e){return r=n(r,"firstChild","nextSibling",e)},this.prev=function(e){return r=n(r,"lastChild","previousSibling",e)}}}),r(m,[d],function(e){function t(n){function r(){return L.createDocumentFragment()}function i(e,t){_(F,e,t)}function o(e,t){_(z,e,t)}function a(e){i(e.parentNode,j(e))}function s(e){i(e.parentNode,j(e)+1)}function l(e){o(e.parentNode,j(e))}function c(e){o(e.parentNode,j(e)+1)}function u(e){e?(H[U]=H[V],H[$]=H[W]):(H[V]=H[U],H[W]=H[$]),H.collapsed=F}function d(e){a(e),c(e)}function f(e){i(e,0),o(e,1===e.nodeType?e.childNodes.length:e.nodeValue.length)}function p(e,t){var n=H[V],r=H[W],i=H[U],o=H[$],a=t.startContainer,s=t.startOffset,l=t.endContainer,c=t.endOffset;return 0===e?w(n,r,a,s):1===e?w(i,o,a,s):2===e?w(i,o,l,c):3===e?w(n,r,l,c):void 0}function h(){E(I)}function m(){return E(P)}function g(){return E(O)}function v(e){var t=this[V],r=this[W],i,o;3!==t.nodeType&&4!==t.nodeType||!t.nodeValue?(t.childNodes.length>0&&(o=t.childNodes[r]),o?t.insertBefore(e,o):3==t.nodeType?n.insertAfter(e,t):t.appendChild(e)):r?r>=t.nodeValue.length?n.insertAfter(e,t):(i=t.splitText(r),t.parentNode.insertBefore(e,i)):t.parentNode.insertBefore(e,t)}function y(e){var t=H.extractContents();H.insertNode(e),e.appendChild(t),H.selectNode(e)}function b(){return q(new t(n),{startContainer:H[V],startOffset:H[W],endContainer:H[U],endOffset:H[$],collapsed:H.collapsed,commonAncestorContainer:H.commonAncestorContainer})}function C(e,t){var n;if(3==e.nodeType)return e;if(0>t)return e;for(n=e.firstChild;n&&t>0;)--t,n=n.nextSibling;return n?n:e}function x(){return H[V]==H[U]&&H[W]==H[$]}function w(e,t,r,i){var o,a,s,l,c,u;if(e==r)return t==i?0:i>t?-1:1;for(o=r;o&&o.parentNode!=e;)o=o.parentNode;if(o){for(a=0,s=e.firstChild;s!=o&&t>a;)a++,s=s.nextSibling;return a>=t?-1:1}for(o=e;o&&o.parentNode!=r;)o=o.parentNode;if(o){for(a=0,s=r.firstChild;s!=o&&i>a;)a++,s=s.nextSibling;return i>a?-1:1}for(l=n.findCommonAncestor(e,r),c=e;c&&c.parentNode!=l;)c=c.parentNode;for(c||(c=l),u=r;u&&u.parentNode!=l;)u=u.parentNode;if(u||(u=l),c==u)return 0;for(s=l.firstChild;s;){if(s==c)return-1;if(s==u)return 1;s=s.nextSibling}}function _(e,t,r){var i,o;for(e?(H[V]=t,H[W]=r):(H[U]=t,H[$]=r),i=H[U];i.parentNode;)i=i.parentNode;for(o=H[V];o.parentNode;)o=o.parentNode;o==i?w(H[V],H[W],H[U],H[$])>0&&H.collapse(e):H.collapse(e),H.collapsed=x(),H.commonAncestorContainer=n.findCommonAncestor(H[V],H[U])}function E(e){var t,n=0,r=0,i,o,a,s,l,c;if(H[V]==H[U])return N(e);for(t=H[U],i=t.parentNode;i;t=i,i=i.parentNode){if(i==H[V])return k(t,e);++n}for(t=H[V],i=t.parentNode;i;t=i,i=i.parentNode){if(i==H[U])return S(t,e);++r}for(o=r-n,a=H[V];o>0;)a=a.parentNode,o--;for(s=H[U];0>o;)s=s.parentNode,o++;for(l=a.parentNode,c=s.parentNode;l!=c;l=l.parentNode,c=c.parentNode)a=l,s=c;return T(a,s,e)}function N(e){var t,n,i,o,a,s,l,c,u;if(e!=I&&(t=r()),H[W]==H[$])return t;if(3==H[V].nodeType){if(n=H[V].nodeValue,i=n.substring(H[W],H[$]),e!=O&&(o=H[V],c=H[W],u=H[$]-H[W],0===c&&u>=o.nodeValue.length-1?o.parentNode.removeChild(o):o.deleteData(c,u),H.collapse(F)),e==I)return;return i.length>0&&t.appendChild(L.createTextNode(i)),t}for(o=C(H[V],H[W]),a=H[$]-H[W];o&&a>0;)s=o.nextSibling,l=D(o,e),t&&t.appendChild(l),--a,o=s;return e!=O&&H.collapse(F),t}function k(e,t){var n,i,o,a,s,l;if(t!=I&&(n=r()),i=R(e,t),n&&n.appendChild(i),o=j(e),a=o-H[W],0>=a)return t!=O&&(H.setEndBefore(e),H.collapse(z)),n;for(i=e.previousSibling;a>0;)s=i.previousSibling,l=D(i,t),n&&n.insertBefore(l,n.firstChild),--a,i=s;return t!=O&&(H.setEndBefore(e),H.collapse(z)),n}function S(e,t){var n,i,o,a,s,l;for(t!=I&&(n=r()),o=A(e,t),n&&n.appendChild(o),i=j(e),++i,a=H[$]-i,o=e.nextSibling;o&&a>0;)s=o.nextSibling,l=D(o,t),n&&n.appendChild(l),--a,o=s;return t!=O&&(H.setStartAfter(e),H.collapse(F)),n}function T(e,t,n){var i,o,a,s,l,c,u;for(n!=I&&(o=r()),i=A(e,n),o&&o.appendChild(i),a=j(e),s=j(t),++a,l=s-a,c=e.nextSibling;l>0;)u=c.nextSibling,i=D(c,n),o&&o.appendChild(i),c=u,--l;return i=R(t,n),o&&o.appendChild(i),n!=O&&(H.setStartAfter(e),H.collapse(F)),o}function R(e,t){var n=C(H[U],H[$]-1),r,i,o,a,s,l=n!=H[U];if(n==e)return B(n,l,z,t);for(r=n.parentNode,i=B(r,z,z,t);r;){for(;n;)o=n.previousSibling,a=B(n,l,z,t),t!=I&&i.insertBefore(a,i.firstChild),l=F,n=o;if(r==e)return i;n=r.previousSibling,r=r.parentNode,s=B(r,z,z,t),t!=I&&s.appendChild(i),i=s}}function A(e,t){var n=C(H[V],H[W]),r=n!=H[V],i,o,a,s,l;if(n==e)return B(n,r,F,t);for(i=n.parentNode,o=B(i,z,F,t);i;){for(;n;)a=n.nextSibling,s=B(n,r,F,t),t!=I&&o.appendChild(s),r=F,n=a;if(i==e)return o;n=i.nextSibling,i=i.parentNode,l=B(i,z,F,t),t!=I&&l.appendChild(o),o=l}}function B(e,t,r,i){var o,a,s,l,c;if(t)return D(e,i);if(3==e.nodeType){if(o=e.nodeValue,r?(l=H[W],a=o.substring(l),s=o.substring(0,l)):(l=H[$],a=o.substring(0,l),s=o.substring(l)),i!=O&&(e.nodeValue=s),i==I)return;return c=n.clone(e,z),c.nodeValue=a,c}if(i!=I)return n.clone(e,z)}function D(e,t){return t!=I?t==O?n.clone(e,F):e:void e.parentNode.removeChild(e)}function M(){return n.create("body",null,g()).outerText}var H=this,L=n.doc,P=0,O=1,I=2,F=!0,z=!1,W="startOffset",V="startContainer",U="endContainer",$="endOffset",q=e.extend,j=n.nodeIndex;return q(H,{startContainer:L,startOffset:0,endContainer:L,endOffset:0,collapsed:F,commonAncestorContainer:L,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:i,setEnd:o,setStartBefore:a,setStartAfter:s,setEndBefore:l,setEndAfter:c,collapse:u,selectNode:d,selectNodeContents:f,compareBoundaryPoints:p,deleteContents:h,extractContents:m,cloneContents:g,insertNode:v,surroundContents:y,cloneRange:b,toStringIE:M}),H}return t.prototype.toString=function(){return this.toStringIE()},t}),r(g,[d],function(e){function t(e){var t;return t=document.createElement("div"),t.innerHTML=e,t.textContent||t.innerText||e}function n(e,t){var n,r,i,a={};if(e){for(e=e.split(","),t=t||10,n=0;n\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,l=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,c=/[<>&\"\']/g,u=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,d={128:"\u20ac",130:"\u201a",131:"\u0192",132:"\u201e",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02c6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017d",145:"\u2018",146:"\u2019",147:"\u201c",148:"\u201d",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02dc",153:"\u2122",154:"\u0161",155:"\u203a",156:"\u0153",158:"\u017e",159:"\u0178"};o={'"':""","'":"'","<":"<",">":">","&":"&","`":"`"},a={"<":"<",">":">","&":"&",""":'"',"'":"'"},i=n("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32); + +var f={encodeRaw:function(e,t){return e.replace(t?s:l,function(e){return o[e]||e})},encodeAllRaw:function(e){return(""+e).replace(c,function(e){return o[e]||e})},encodeNumeric:function(e,t){return e.replace(t?s:l,function(e){return e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":o[e]||"&#"+e.charCodeAt(0)+";"})},encodeNamed:function(e,t,n){return n=n||i,e.replace(t?s:l,function(e){return o[e]||n[e]||e})},getEncodeFunc:function(e,t){function a(e,n){return e.replace(n?s:l,function(e){return o[e]||t[e]||"&#"+e.charCodeAt(0)+";"||e})}function c(e,n){return f.encodeNamed(e,n,t)}return t=n(t)||i,e=r(e.replace(/\+/g,",")),e.named&&e.numeric?a:e.named?t?c:f.encodeNamed:e.numeric?f.encodeNumeric:f.encodeRaw},decode:function(e){return e.replace(u,function(e,n){return n?(n="x"===n.charAt(0).toLowerCase()?parseInt(n.substr(1),16):parseInt(n,10),n>65535?(n-=65536,String.fromCharCode(55296+(n>>10),56320+(1023&n))):d[n]||String.fromCharCode(n)):a[e]||i[e]||t(e)})}};return f}),r(v,[d],function(e){return function(t,n){function r(e){t.getElementsByTagName("head")[0].appendChild(e)}function i(n,i,l){function c(){for(var e=y.passed,t=e.length;t--;)e[t]();y.status=2,y.passed=[],y.failed=[]}function u(){for(var e=y.failed,t=e.length;t--;)e[t]();y.status=3,y.passed=[],y.failed=[]}function d(){var e=navigator.userAgent.match(/WebKit\/(\d*)/);return!!(e&&e[1]<536)}function f(e,t){e()||((new Date).getTime()-v0)return g=t.createElement("style"),g.textContent='@import "'+n+'"',h(),void r(g);p()}r(m),m.href=n}}var o=0,a={},s;n=n||{},s=n.maxLoadTime||5e3,this.load=i}}),r(y,[c,f,p,l,h,m,g,u,d,v],function(e,n,r,i,o,a,s,l,c,u){function d(e,t){var n={},r=t.keep_values,i;return i={set:function(n,r,i){t.url_converter&&(r=t.url_converter.call(t.url_converter_scope||e,r,i,n[0])),n.attr("data-mce-"+i,r).attr(i,r)},get:function(e,t){return e.attr("data-mce-"+t)||e.attr(t)}},n={style:{set:function(e,t){return null!==t&&"object"==typeof t?void e.css(t):(r&&e.attr("data-mce-style",t),void e.attr("style",t))},get:function(t){var n=t.attr("data-mce-style")||t.attr("style");return n=e.serializeStyle(e.parseStyle(n),t[0].nodeName)}}},r&&(n.href=n.src=i),n}function f(e,t){var o=this,a;o.doc=e,o.win=window,o.files={},o.counter=0,o.stdMode=!v||e.documentMode>=8,o.boxModel=!v||"CSS1Compat"==e.compatMode||o.stdMode,o.styleSheetLoader=new u(e),o.boundEvents=[],o.settings=t=t||{},o.schema=t.schema,o.styles=new r({url_converter:t.url_converter,url_converter_scope:t.url_converter_scope},t.schema),o.fixDoc(e),o.events=t.ownEvents?new i(t.proxy):i.Event,o.attrHooks=d(o,t),a=t.schema?t.schema.getBlockElements():{},o.$=n.overrideDefaults(function(){return{context:e,element:o.getRoot()}}),o.isBlock=function(e){if(!e)return!1;var t=e.nodeType;return t?!(1!==t||!a[e.nodeName]):!!a[e]}}var p=c.each,h=c.is,m=c.grep,g=c.trim,v=l.ie,y=/^([a-z0-9],?)+$/i,b=/^[ \t\r\n]*$/;return f.prototype={$$:function(e){return"string"==typeof e&&(e=this.get(e)),this.$(e)},root:null,fixDoc:function(e){var t=this.settings,n;if(v&&t.schema){"abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video".replace(/\w+/g,function(t){e.createElement(t)});for(n in t.schema.getCustomElements())e.createElement(n)}},clone:function(e,t){var n=this,r,i;return!v||1!==e.nodeType||t?e.cloneNode(t):(i=n.doc,t?r.firstChild:(r=i.createElement(e.nodeName),p(n.getAttribs(e),function(t){n.setAttrib(r,t.nodeName,n.getAttrib(e,t.nodeName))}),r))},getRoot:function(){var e=this;return e.settings.root_element||e.doc.body},getViewPort:function(e){var t,n;return e=e?e:this.win,t=e.document,n=this.boxModel?t.documentElement:t.body,{x:e.pageXOffset||n.scrollLeft,y:e.pageYOffset||n.scrollTop,w:e.innerWidth||n.clientWidth,h:e.innerHeight||n.clientHeight}},getRect:function(e){var t=this,n,r;return e=t.get(e),n=t.getPos(e),r=t.getSize(e),{x:n.x,y:n.y,w:r.w,h:r.h}},getSize:function(e){var t=this,n,r;return e=t.get(e),n=t.getStyle(e,"width"),r=t.getStyle(e,"height"),-1===n.indexOf("px")&&(n=0),-1===r.indexOf("px")&&(r=0),{w:parseInt(n,10)||e.offsetWidth||e.clientWidth,h:parseInt(r,10)||e.offsetHeight||e.clientHeight}},getParent:function(e,t,n){return this.getParents(e,t,n,!1)},getParents:function(e,n,r,i){var o=this,a,s=[];for(e=o.get(e),i=i===t,r=r||("BODY"!=o.getRoot().nodeName?o.getRoot().parentNode:null),h(n,"string")&&(a=n,n="*"===n?function(e){return 1==e.nodeType}:function(e){return o.is(e,a)});e&&e!=r&&e.nodeType&&9!==e.nodeType;){if(!n||n(e)){if(!i)return e;s.push(e)}e=e.parentNode}return i?s:null},get:function(e){var t;return e&&this.doc&&"string"==typeof e&&(t=e,e=this.doc.getElementById(e),e&&e.id!==t)?this.doc.getElementsByName(t)[1]:e},getNext:function(e,t){return this._findSib(e,t,"nextSibling")},getPrev:function(e,t){return this._findSib(e,t,"previousSibling")},select:function(t,n){var r=this;return e(t,r.get(n)||r.settings.root_element||r.doc,[])},is:function(n,r){var i;if(n.length===t){if("*"===r)return 1==n.nodeType;if(y.test(r)){for(r=r.toLowerCase().split(/,/),n=n.nodeName.toLowerCase(),i=r.length-1;i>=0;i--)if(r[i]==n)return!0;return!1}}if(n.nodeType&&1!=n.nodeType)return!1;var o=n.nodeType?[n]:n;return e(r,o[0].ownerDocument||o[0],null,o).length>0},add:function(e,t,n,r,i){var o=this;return this.run(e,function(e){var a;return a=h(t,"string")?o.doc.createElement(t):t,o.setAttribs(a,n),r&&(r.nodeType?a.appendChild(r):o.setHTML(a,r)),i?a:e.appendChild(a)})},create:function(e,t,n){return this.add(this.doc.createElement(e),e,t,n,1)},createHTML:function(e,t,n){var r="",i;r+="<"+e;for(i in t)t.hasOwnProperty(i)&&null!==t[i]&&"undefined"!=typeof t[i]&&(r+=" "+i+'="'+this.encode(t[i])+'"');return"undefined"!=typeof n?r+">"+n+"":r+" />"},createFragment:function(e){var t,n,r=this.doc,i;for(i=r.createElement("div"),t=r.createDocumentFragment(),e&&(i.innerHTML=e);n=i.firstChild;)t.appendChild(n);return t},remove:function(e,t){return e=this.$$(e),t?e.each(function(){for(var e;e=this.firstChild;)3==e.nodeType&&0===e.data.length?this.removeChild(e):this.parentNode.insertBefore(e,this)}).remove():e.remove(),e.length>1?e.toArray():e[0]},setStyle:function(e,t,n){e=this.$$(e).css(t,n),this.settings.update_styles&&e.attr("data-mce-style",null)},getStyle:function(e,n,r){return e=this.$$(e),r?e.css(n):(n=n.replace(/-(\D)/g,function(e,t){return t.toUpperCase()}),"float"==n&&(n=v?"styleFloat":"cssFloat"),e[0]&&e[0].style?e[0].style[n]:t)},setStyles:function(e,t){e=this.$$(e).css(t),this.settings.update_styles&&e.attr("data-mce-style",null)},removeAllAttribs:function(e){return this.run(e,function(e){var t,n=e.attributes;for(t=n.length-1;t>=0;t--)e.removeAttributeNode(n.item(t))})},setAttrib:function(e,t,n){var r=this,i,o,a=r.settings;""===n&&(n=null),e=r.$$(e),i=e.attr(t),e.length&&(o=r.attrHooks[t],o&&o.set?o.set(e,n,t):e.attr(t,n),i!=n&&a.onSetAttrib&&a.onSetAttrib({attrElm:e,attrName:t,attrValue:n}))},setAttribs:function(e,t){var n=this;n.$$(e).each(function(e,r){p(t,function(e,t){n.setAttrib(r,t,e)})})},getAttrib:function(e,t,n){var r=this,i,o;return e=r.$$(e),e.length&&(i=r.attrHooks[t],o=i&&i.get?i.get(e,t):e.attr(t)),"undefined"==typeof o&&(o=n||""),o},getPos:function(e,t){var r=this,i=0,o=0,a,s=r.doc,l=s.body,c;if(e=r.get(e),t=t||l,e){if(t===l&&e.getBoundingClientRect&&"static"===n(l).css("position"))return c=e.getBoundingClientRect(),t=r.boxModel?s.documentElement:l,i=c.left+(s.documentElement.scrollLeft||l.scrollLeft)-t.clientLeft,o=c.top+(s.documentElement.scrollTop||l.scrollTop)-t.clientTop,{x:i,y:o};for(a=e;a&&a!=t&&a.nodeType;)i+=a.offsetLeft||0,o+=a.offsetTop||0,a=a.offsetParent;for(a=e.parentNode;a&&a!=t&&a.nodeType;)i-=a.scrollLeft||0,o-=a.scrollTop||0,a=a.parentNode}return{x:i,y:o}},parseStyle:function(e){return this.styles.parse(e)},serializeStyle:function(e,t){return this.styles.serialize(e,t)},addStyle:function(e){var t=this,n=t.doc,r,i;if(t!==f.DOM&&n===document){var o=f.DOM.addedStyles;if(o=o||[],o[e])return;o[e]=!0,f.DOM.addedStyles=o}i=n.getElementById("mceDefaultStyles"),i||(i=n.createElement("style"),i.id="mceDefaultStyles",i.type="text/css",r=n.getElementsByTagName("head")[0],r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i)),i.styleSheet?i.styleSheet.cssText+=e:i.appendChild(n.createTextNode(e))},loadCSS:function(e){var t=this,n=t.doc,r;return t!==f.DOM&&n===document?void f.DOM.loadCSS(e):(e||(e=""),r=n.getElementsByTagName("head")[0],void p(e.split(","),function(e){var i;e=c._addCacheSuffix(e),t.files[e]||(t.files[e]=!0,i=t.create("link",{rel:"stylesheet",href:e}),v&&n.documentMode&&n.recalc&&(i.onload=function(){n.recalc&&n.recalc(),i.onload=null}),r.appendChild(i))}))},addClass:function(e,t){this.$$(e).addClass(t)},removeClass:function(e,t){this.toggleClass(e,t,!1)},hasClass:function(e,t){return this.$$(e).hasClass(t)},toggleClass:function(e,t,r){this.$$(e).toggleClass(t,r).each(function(){""===this.className&&n(this).attr("class",null)})},show:function(e){this.$$(e).show()},hide:function(e){this.$$(e).hide()},isHidden:function(e){return"none"==this.$$(e).css("display")},uniqueId:function(e){return(e?e:"mce_")+this.counter++},setHTML:function(e,t){e=this.$$(e),v?e.each(function(e,r){if(r.canHaveHTML!==!1){for(;r.firstChild;)r.removeChild(r.firstChild);try{r.innerHTML="
    "+t,r.removeChild(r.firstChild)}catch(i){n("
    ").html("
    "+t).contents().slice(1).appendTo(r)}return t}}):e.html(t)},getOuterHTML:function(e){return e=this.get(e),1==e.nodeType&&"outerHTML"in e?e.outerHTML:n("
    ").append(n(e).clone()).html()},setOuterHTML:function(e,t){var r=this;r.$$(e).each(function(){try{if("outerHTML"in this)return void(this.outerHTML=t)}catch(e){}r.remove(n(this).html(t),!0)})},decode:s.decode,encode:s.encodeAllRaw,insertAfter:function(e,t){return t=this.get(t),this.run(e,function(e){var n,r;return n=t.parentNode,r=t.nextSibling,r?n.insertBefore(e,r):n.appendChild(e),e})},replace:function(e,t,n){var r=this;return r.run(t,function(t){return h(t,"array")&&(e=e.cloneNode(!0)),n&&p(m(t.childNodes),function(t){e.appendChild(t)}),t.parentNode.replaceChild(e,t)})},rename:function(e,t){var n=this,r;return e.nodeName!=t.toUpperCase()&&(r=n.create(t),p(n.getAttribs(e),function(t){n.setAttrib(r,t.nodeName,n.getAttrib(e,t.nodeName))}),n.replace(r,e,1)),r||e},findCommonAncestor:function(e,t){for(var n=e,r;n;){for(r=t;r&&n!=r;)r=r.parentNode;if(n==r)break;n=n.parentNode}return!n&&e.ownerDocument?e.ownerDocument.documentElement:n},toHex:function(e){return this.styles.toHex(c.trim(e))},run:function(e,t,n){var r=this,i;return"string"==typeof e&&(e=r.get(e)),e?(n=n||this,e.nodeType||!e.length&&0!==e.length?t.call(n,e):(i=[],p(e,function(e,o){e&&("string"==typeof e&&(e=r.get(e)),i.push(t.call(n,e,o)))}),i)):!1},getAttribs:function(e){var t;if(e=this.get(e),!e)return[];if(v){if(t=[],"OBJECT"==e.nodeName)return e.attributes;"OPTION"===e.nodeName&&this.getAttrib(e,"selected")&&t.push({specified:1,nodeName:"selected"});var n=/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi;return e.cloneNode(!1).outerHTML.replace(n,"").replace(/[\w:\-]+/gi,function(e){t.push({specified:1,nodeName:e})}),t}return e.attributes},isEmpty:function(e,t){var n=this,r,i,a,s,l,c=0;if(e=e.firstChild){s=new o(e,e.parentNode),t=t||(n.schema?n.schema.getNonEmptyElements():null);do{if(a=e.nodeType,1===a){if(e.getAttribute("data-mce-bogus"))continue;if(l=e.nodeName.toLowerCase(),t&&t[l]){if("br"===l){c++;continue}return!1}for(i=n.getAttribs(e),r=i.length;r--;)if(l=i[r].nodeName,"name"===l||"data-mce-bookmark"===l)return!1}if(8==a)return!1;if(3===a&&!b.test(e.nodeValue))return!1}while(e=s.next())}return 1>=c},createRng:function(){var e=this.doc;return e.createRange?e.createRange():new a(this)},nodeIndex:function(e,t){var n=0,r,i;if(e)for(r=e.nodeType,e=e.previousSibling;e;e=e.previousSibling)i=e.nodeType,(!t||3!=i||i!=r&&e.nodeValue.length)&&(n++,r=i);return n},split:function(e,t,n){function r(e){function t(e){var t=e.previousSibling&&"SPAN"==e.previousSibling.nodeName,n=e.nextSibling&&"SPAN"==e.nextSibling.nodeName;return t&&n}var n,o=e.childNodes,a=e.nodeType;if(1!=a||"bookmark"!=e.getAttribute("data-mce-type")){for(n=o.length-1;n>=0;n--)r(o[n]);if(9!=a){if(3==a&&e.nodeValue.length>0){var s=g(e.nodeValue).length;if(!i.isBlock(e.parentNode)||s>0||0===s&&t(e))return}else if(1==a&&(o=e.childNodes,1==o.length&&o[0]&&1==o[0].nodeType&&"bookmark"==o[0].getAttribute("data-mce-type")&&e.parentNode.insertBefore(o[0],e),o.length||/^(br|hr|input|img)$/i.test(e.nodeName)))return;i.remove(e)}return e}}var i=this,o=i.createRng(),a,s,l;return e&&t?(o.setStart(e.parentNode,i.nodeIndex(e)),o.setEnd(t.parentNode,i.nodeIndex(t)),a=o.extractContents(),o=i.createRng(),o.setStart(t.parentNode,i.nodeIndex(t)+1),o.setEnd(e.parentNode,i.nodeIndex(e)+1),s=o.extractContents(),l=e.parentNode,l.insertBefore(r(a),e),n?l.replaceChild(n,t):l.insertBefore(t,e),l.insertBefore(r(s),e),i.remove(e),n||t):void 0},bind:function(e,t,n,r){var i=this;if(c.isArray(e)){for(var o=e.length;o--;)e[o]=i.bind(e[o],t,n,r);return e}return!i.settings.collect||e!==i.doc&&e!==i.win||i.boundEvents.push([e,t,n,r]),i.events.bind(e,t,n,r||i)},unbind:function(e,t,n){var r=this,i;if(c.isArray(e)){for(i=e.length;i--;)e[i]=r.unbind(e[i],t,n);return e}if(r.boundEvents&&(e===r.doc||e===r.win))for(i=r.boundEvents.length;i--;){var o=r.boundEvents[i];e!=o[0]||t&&t!=o[1]||n&&n!=o[2]||this.events.unbind(o[0],o[1],o[2])}return this.events.unbind(e,t,n)},fire:function(e,t,n){return this.events.fire(e,t,n)},getContentEditable:function(e){var t;return e&&1==e.nodeType?(t=e.getAttribute("data-mce-contenteditable"),t&&"inherit"!==t?t:"inherit"!==e.contentEditable?e.contentEditable:null):null},getContentEditableParent:function(e){for(var t=this.getRoot(),n=null;e&&e!==t&&(n=this.getContentEditable(e),null===n);e=e.parentNode);return n},destroy:function(){var t=this;if(t.boundEvents){for(var n=t.boundEvents.length;n--;){var r=t.boundEvents[n];this.events.unbind(r[0],r[1],r[2])}t.boundEvents=null}e.setDocument&&e.setDocument(),t.win=t.doc=t.root=t.events=t.frag=null},isChildOf:function(e,t){for(;e;){if(t===e)return!0;e=e.parentNode}return!1},dumpRng:function(e){return"startContainer: "+e.startContainer.nodeName+", startOffset: "+e.startOffset+", endContainer: "+e.endContainer.nodeName+", endOffset: "+e.endOffset},_findSib:function(e,t,n){var r=this,i=t;if(e)for("string"==typeof i&&(i=function(e){return r.is(e,t)}),e=e[n];e;e=e[n])if(i(e))return e;return null}},f.DOM=new f(document),f}),r(b,[y,d],function(e,t){function n(){function e(e,n){function i(){a.remove(l),s&&(s.onreadystatechange=s.onload=s=null),n()}function o(){"undefined"!=typeof console&&console.log&&console.log("Failed to load: "+e)}var a=r,s,l;l=a.uniqueId(),s=document.createElement("script"),s.id=l,s.type="text/javascript",s.src=t._addCacheSuffix(e),"onreadystatechange"in s?s.onreadystatechange=function(){/loaded|complete/.test(s.readyState)&&i()}:s.onload=i,s.onerror=o,(document.getElementsByTagName("head")[0]||document.body).appendChild(s)}var n=0,a=1,s=2,l={},c=[],u={},d=[],f=0,p;this.isDone=function(e){return l[e]==s},this.markDone=function(e){l[e]=s},this.add=this.load=function(e,t,r){var i=l[e];i==p&&(c.push(e),l[e]=n),t&&(u[e]||(u[e]=[]),u[e].push({func:t,scope:r||this}))},this.loadQueue=function(e,t){this.loadScripts(c,e,t)},this.loadScripts=function(t,n,r){function c(e){i(u[e],function(e){e.func.call(e.scope)}),u[e]=p}var h;d.push({func:n,scope:r||this}),(h=function(){var n=o(t);t.length=0,i(n,function(t){return l[t]==s?void c(t):void(l[t]!=a&&(l[t]=a,f++,e(t,function(){l[t]=s,f--,c(t),h()})))}),f||(i(d,function(e){e.func.call(e.scope)}),d.length=0)})()}}var r=e.DOM,i=t.each,o=t.grep;return n.ScriptLoader=new n,n}),r(C,[b,d],function(e,n){function r(){var e=this;e.items=[],e.urls={},e.lookup={}}var i=n.each;return r.prototype={get:function(e){return this.lookup[e]?this.lookup[e].instance:t},dependencies:function(e){var t;return this.lookup[e]&&(t=this.lookup[e].dependencies),t||[]},requireLangPack:function(t,n){var i=r.language;if(i&&r.languageLoad!==!1){if(n)if(n=","+n+",",-1!=n.indexOf(","+i.substr(0,2)+","))i=i.substr(0,2);else if(-1==n.indexOf(","+i+","))return;e.ScriptLoader.add(this.urls[t]+"/langs/"+i+".js")}},add:function(e,t,n){return this.items.push(t),this.lookup[e]={instance:t,dependencies:n},t},createUrl:function(e,t){return"object"==typeof t?t:{prefix:e.prefix,resource:t,suffix:e.suffix}},addComponents:function(t,n){var r=this.urls[t];i(n,function(t){e.ScriptLoader.add(r+"/"+t)})},load:function(n,o,a,s){function l(){var r=c.dependencies(n);i(r,function(e){var n=c.createUrl(o,e);c.load(n.resource,n,t,t)}),a&&a.call(s?s:e)}var c=this,u=o;c.urls[n]||("object"==typeof o&&(u=o.prefix+o.resource+o.suffix),0!==u.indexOf("/")&&-1==u.indexOf("://")&&(u=r.baseURL+"/"+u),c.urls[n]=u.substring(0,u.lastIndexOf("/")),c.lookup[n]?l():e.ScriptLoader.add(u,l,s))}},r.PluginManager=new r,r.ThemeManager=new r,r}),r(x,[d,h],function(e,t){function n(e,t){var n=e.childNodes;return t--,t>n.length-1?t=n.length-1:0>t&&(t=0),n[t]||e}function r(e){this.walk=function(t,r){function o(e){var t;return t=e[0],3===t.nodeType&&t===c&&u>=t.nodeValue.length&&e.splice(0,1),t=e[e.length-1],0===f&&e.length>0&&t===d&&3===t.nodeType&&e.splice(e.length-1,1),e}function a(e,t,n){for(var r=[];e&&e!=n;e=e[t])r.push(e);return r}function s(e,t){do{if(e.parentNode==t)return e;e=e.parentNode}while(e)}function l(e,t,n){var i=n?"nextSibling":"previousSibling";for(g=e,v=g.parentNode;g&&g!=t;g=v)v=g.parentNode,y=a(g==e?g:g[i],i),y.length&&(n||y.reverse(),r(o(y)))}var c=t.startContainer,u=t.startOffset,d=t.endContainer,f=t.endOffset,p,h,m,g,v,y,b;if(b=e.select("td.mce-item-selected,th.mce-item-selected"),b.length>0)return void i(b,function(e){r([e])});if(1==c.nodeType&&c.hasChildNodes()&&(c=c.childNodes[u]),1==d.nodeType&&d.hasChildNodes()&&(d=n(d,f)),c==d)return r(o([c]));for(p=e.findCommonAncestor(c,d),g=c;g;g=g.parentNode){if(g===d)return l(c,p,!0);if(g===p)break}for(g=d;g;g=g.parentNode){if(g===c)return l(d,p);if(g===p)break}h=s(c,p)||c,m=s(d,p)||d,l(c,h,!0),y=a(h==c?h:h.nextSibling,"nextSibling",m==d?m.nextSibling:m),y.length&&r(o(y)),l(d,m)},this.split=function(e){function t(e,t){return e.splitText(t)}var n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset;return n==i&&3==n.nodeType?r>0&&rr?(o-=r,n=i=t(i,o).previousSibling,o=i.nodeValue.length,r=0):o=0):(3==n.nodeType&&r>0&&r0&&o0)return c=p,u=n?p.nodeValue.length:0,void(i=!0);if(e.isBlock(p)||h[p.nodeName.toLowerCase()])return;s=p}o&&s&&(c=s,i=!0,u=0)}var c,u,d,f=e.getRoot(),p,h,m,g;if(c=n[(r?"start":"end")+"Container"],u=n[(r?"start":"end")+"Offset"],g=1==c.nodeType&&u===c.childNodes.length,h=e.schema.getNonEmptyElements(),m=r,1==c.nodeType&&u>c.childNodes.length-1&&(m=!1),9===c.nodeType&&(c=e.getRoot(),u=0),c===f){if(m&&(p=c.childNodes[u>0?u-1:0],p&&(h[p.nodeName]||"TABLE"==p.nodeName)))return;if(c.hasChildNodes()&&(u=Math.min(!m&&u>0?u-1:u,c.childNodes.length-1),c=c.childNodes[u],u=0,c.hasChildNodes()&&!/TABLE/.test(c.nodeName))){p=c,d=new t(c,f);do{if(3===p.nodeType&&p.nodeValue.length>0){u=m?0:p.nodeValue.length,c=p,i=!0;break}if(h[p.nodeName.toLowerCase()]){u=e.nodeIndex(p),c=p.parentNode,"IMG"!=p.nodeName||m||u++,i=!0;break}}while(p=m?d.next():d.prev())}}o&&(3===c.nodeType&&0===u&&l(!0),1===c.nodeType&&(p=c.childNodes[u],p||(p=c.childNodes[u-1]),!p||"BR"!==p.nodeName||s(p,"A")||a(p)||a(p,!0)||l(!0,p))),m&&!o&&3===c.nodeType&&u===c.nodeValue.length&&l(!1),i&&n["set"+(r?"Start":"End")](c,u)}var i,o;return o=n.collapsed,r(!0),o||r(),i&&o&&n.collapse(!0),i}}var i=e.each;return r.compareRanges=function(e,t){if(e&&t){if(!e.item&&!e.duplicate)return e.startContainer==t.startContainer&&e.startOffset==t.startOffset;if(e.item&&t.item&&e.item(0)===t.item(0))return!0;if(e.isEqual&&t.isEqual&&t.isEqual(e))return!0}return!1},r.getCaretRangeFromPoint=function(e,t,n){var r,i;if(n.caretPositionFromPoint)i=n.caretPositionFromPoint(e,t),r=n.createRange(),r.setStart(i.offsetNode,i.offset),r.collapse(!0);else if(n.caretRangeFromPoint)r=n.caretRangeFromPoint(e,t);else if(n.body.createTextRange){r=n.body.createTextRange();try{r.moveToPoint(e,t),r.collapse(!0)}catch(o){r.collapse(t=e.childNodes.length&&(t=e.childNodes.length-1),e=e.childNodes[t]),e},r}),r(w,[x,u],function(e,t){return function(n){function r(e){var t,r;if(r=n.$(e).parentsUntil(n.getBody()).add(e),r.length===o.length){for(t=r.length;t>=0&&r[t]===o[t];t--);if(-1===t)return o=r,!0}return o=r,!1}var i,o=[];"onselectionchange"in n.getDoc()||n.on("NodeChange Click MouseUp KeyUp Focus",function(t){var r,o;r=n.selection.getRng(),o={startContainer:r.startContainer,startOffset:r.startOffset,endContainer:r.endContainer,endOffset:r.endOffset},"nodechange"!=t.type&&e.compareRanges(o,i)||n.fire("SelectionChange"),i=o}),n.on("contextmenu",function(){n.fire("SelectionChange")}),n.on("SelectionChange",function(){var e=n.selection.getStart(!0);(t.range||!n.selection.isCollapsed())&&!r(e)&&n.dom.isChildOf(e,n.getBody())&&n.nodeChanged({selectionChange:!0})}),n.on("MouseUp",function(e){e.isDefaultPrevented()||("IMG"==n.selection.getNode().nodeName?setTimeout(function(){n.nodeChanged()},0):n.nodeChanged())}),this.nodeChanged=function(e){var t=n.selection,r,i,o;n.initialized&&t&&!n.settings.disable_nodechange&&!n.settings.readonly&&(o=n.getBody(),r=t.getStart()||o,r=r.ownerDocument!=n.getDoc()?n.getBody():r,"IMG"==r.nodeName&&t.isCollapsed()&&(r=r.parentNode),i=[],n.dom.getParent(r,function(e){return e===o?!0:void i.push(e)}),e=e||{},e.element=r,e.parents=i,n.fire("NodeChange",e))}}}),r(_,[],function(){function e(e,t,n){var r,i,o=n?"lastChild":"firstChild",a=n?"prev":"next";if(e[o])return e[o];if(e!==t){if(r=e[a])return r;for(i=e.parent;i&&i!==t;i=i.parent)if(r=i[a])return r}}function t(e,t){this.name=e,this.type=t,1===t&&(this.attributes=[],this.attributes.map={})}var n=/^[ \t\r\n]*$/,r={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};return t.prototype={replace:function(e){var t=this;return e.parent&&e.remove(),t.insert(e,t),t.remove(),t},attr:function(e,t){var n=this,r,i,o;if("string"!=typeof e){for(i in e)n.attr(i,e[i]);return n}if(r=n.attributes){if(t!==o){if(null===t){if(e in r.map)for(delete r.map[e],i=r.length;i--;)if(r[i].name===e)return r=r.splice(i,1),n;return n}if(e in r.map){for(i=r.length;i--;)if(r[i].name===e){r[i].value=t;break}}else r.push({name:e,value:t});return r.map[e]=t,n}return r.map[e]}},clone:function(){var e=this,n=new t(e.name,e.type),r,i,o,a,s;if(o=e.attributes){for(s=[],s.map={},r=0,i=o.length;i>r;r++)a=o[r],"id"!==a.name&&(s[s.length]={name:a.name,value:a.value},s.map[a.name]=a.value);n.attributes=s}return n.value=e.value,n.shortEnded=e.shortEnded,n},wrap:function(e){var t=this;return t.parent.insert(e,t),e.append(t),t},unwrap:function(){var e=this,t,n;for(t=e.firstChild;t;)n=t.next,e.insert(t,e,!0),t=n;e.remove()},remove:function(){var e=this,t=e.parent,n=e.next,r=e.prev;return t&&(t.firstChild===e?(t.firstChild=n,n&&(n.prev=null)):r.next=n,t.lastChild===e?(t.lastChild=r,r&&(r.next=null)):n.prev=r,e.parent=e.next=e.prev=null),e},append:function(e){var t=this,n;return e.parent&&e.remove(),n=t.lastChild,n?(n.next=e,e.prev=n,t.lastChild=e):t.lastChild=t.firstChild=e,e.parent=t,e},insert:function(e,t,n){var r;return e.parent&&e.remove(),r=t.parent||this,n?(t===r.firstChild?r.firstChild=e:t.prev.next=e,e.prev=t.prev,e.next=t,t.prev=e):(t===r.lastChild?r.lastChild=e:t.next.prev=e,e.next=t.next,e.prev=t,t.next=e),e.parent=r,e},getAll:function(t){var n=this,r,i=[];for(r=n.firstChild;r;r=e(r,n))r.name===t&&i.push(r);return i},empty:function(){var t=this,n,r,i;if(t.firstChild){for(n=[],i=t.firstChild;i;i=e(i,t))n.push(i);for(r=n.length;r--;)i=n[r],i.parent=i.firstChild=i.lastChild=i.next=i.prev=null}return t.firstChild=t.lastChild=null,t},isEmpty:function(t){var r=this,i=r.firstChild,o,a;if(i)do{if(1===i.type){if(i.attributes.map["data-mce-bogus"])continue;if(t[i.name])return!1;for(o=i.attributes.length;o--;)if(a=i.attributes[o].name,"name"===a||0===a.indexOf("data-mce-bookmark"))return!1}if(8===i.type)return!1;if(3===i.type&&!n.test(i.value))return!1}while(i=e(i,r));return!0},walk:function(t){return e(this,null,t)}},t.create=function(e,n){var i,o;if(i=new t(e,r[e]||1),n)for(o in n)i.attr(o,n[o]);return i},t}),r(E,[d],function(e){function t(e,t){return e?e.split(t||" "):[]}function n(e){function n(e,n,r){function i(e,t){var n={},r,i;for(r=0,i=e.length;i>r;r++)n[e[r]]=t||{};return n}var s,c,u,d=arguments;for(r=r||[],n=n||"","string"==typeof r&&(r=t(r)),c=3;co;o++)i.attributes[n[o]]={},i.attributesOrder.push(n[o])}var a={},l,c,u,d,f,p;return i[e]?i[e]:(l=t("id accesskey class dir lang style tabindex title"),c=t("address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul"),u=t("a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd label map noscript object q s samp script select small span strong sub sup textarea u var #text #comment"),"html4"!=e&&(l.push.apply(l,t("contenteditable contextmenu draggable dropzone hidden spellcheck translate")),c.push.apply(c,t("article aside details dialog figure header footer hgroup section nav")),u.push.apply(u,t("audio canvas command datalist mark meter output progress time wbr video ruby bdi keygen"))),"html5-strict"!=e&&(l.push("xml:lang"),p=t("acronym applet basefont big font strike tt"),u.push.apply(u,p),s(p,function(e){n(e,"",u)}),f=t("center dir isindex noframes"),c.push.apply(c,f),d=[].concat(c,u),s(f,function(e){n(e,"",d)})),d=d||[].concat(c,u),n("html","manifest","head body"),n("head","","base command link meta noscript script style title"),n("title hr noscript br"),n("base","href target"),n("link","href rel media hreflang type sizes hreflang"),n("meta","name http-equiv content charset"),n("style","media type scoped"),n("script","src async defer type charset"),n("body","onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload onmessage onoffline ononline onpagehide onpageshow onpopstate onresize onscroll onstorage onunload",d),n("address dt dd div caption","",d),n("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn","",u),n("blockquote","cite",d),n("ol","reversed start type","li"),n("ul","","li"),n("li","value",d),n("dl","","dt dd"),n("a","href target rel media hreflang type",u),n("q","cite",u),n("ins del","cite datetime",d),n("img","src sizes srcset alt usemap ismap width height"),n("iframe","src name width height",d),n("embed","src type width height"),n("object","data type typemustmatch name usemap form width height",d,"param"),n("param","name value"),n("map","name",d,"area"),n("area","alt coords shape href target rel media hreflang type"),n("table","border","caption colgroup thead tfoot tbody tr"+("html4"==e?" col":"")),n("colgroup","span","col"),n("col","span"),n("tbody thead tfoot","","tr"),n("tr","","td th"),n("td","colspan rowspan headers",d),n("th","colspan rowspan headers scope abbr",d),n("form","accept-charset action autocomplete enctype method name novalidate target",d),n("fieldset","disabled form name",d,"legend"),n("label","form for",u),n("input","accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate formtarget height list max maxlength min multiple name pattern readonly required size src step type value width"),n("button","disabled form formaction formenctype formmethod formnovalidate formtarget name type value","html4"==e?d:u),n("select","disabled form multiple name required size","option optgroup"),n("optgroup","disabled label","option"),n("option","disabled label selected value"),n("textarea","cols dirname disabled form maxlength name readonly required rows wrap"),n("menu","type label",d,"li"),n("noscript","",d),"html4"!=e&&(n("wbr"),n("ruby","",u,"rt rp"),n("figcaption","",d),n("mark rt rp summary bdi","",u),n("canvas","width height",d),n("video","src crossorigin poster preload autoplay mediagroup loop muted controls width height buffered",d,"track source"),n("audio","src crossorigin preload autoplay mediagroup loop muted controls buffered volume",d,"track source"),n("picture","","img source"),n("source","src srcset type media sizes"),n("track","kind src srclang label default"),n("datalist","",u,"option"),n("article section nav aside header footer","",d),n("hgroup","","h1 h2 h3 h4 h5 h6"),n("figure","",d,"figcaption"),n("time","datetime",u),n("dialog","open",d),n("command","type label icon disabled checked radiogroup command"),n("output","for form name",u),n("progress","value max",u),n("meter","value min max low high optimum",u),n("details","open",d,"summary"),n("keygen","autofocus challenge disabled form keytype name")),"html5-strict"!=e&&(r("script","language xml:space"),r("style","xml:space"),r("object","declare classid code codebase codetype archive standby align border hspace vspace"),r("embed","align name hspace vspace"),r("param","valuetype type"),r("a","charset name rev shape coords"),r("br","clear"),r("applet","codebase archive code object alt name width height align hspace vspace"),r("img","name longdesc align border hspace vspace"),r("iframe","longdesc frameborder marginwidth marginheight scrolling align"),r("font basefont","size color face"),r("input","usemap align"),r("select","onchange"),r("textarea"),r("h1 h2 h3 h4 h5 h6 div p legend caption","align"),r("ul","type compact"),r("li","type"),r("ol dl menu dir","compact"),r("pre","width xml:space"),r("hr","align noshade size width"),r("isindex","prompt"),r("table","summary width frame rules cellspacing cellpadding align bgcolor"),r("col","width align char charoff valign"),r("colgroup","width align char charoff valign"),r("thead","align char charoff valign"),r("tr","align char charoff valign bgcolor"),r("th","axis align char charoff valign nowrap bgcolor width height"),r("form","accept"),r("td","abbr axis scope align char charoff valign nowrap bgcolor width height"),r("tfoot","align char charoff valign"),r("tbody","align char charoff valign"),r("area","nohref"),r("body","background bgcolor text link vlink alink")),"html4"!=e&&(r("input button select textarea","autofocus"),r("input textarea","placeholder"), +r("a","download"),r("link script img","crossorigin"),r("iframe","sandbox seamless allowfullscreen")),s(t("a form meter progress dfn"),function(e){a[e]&&delete a[e].children[e]}),delete a.caption.children.table,i[e]=a,a)}function r(e,t){var n;return e&&(n={},"string"==typeof e&&(e={"*":e}),s(e,function(e,r){n[r]=n[r.toUpperCase()]="map"==t?a(e,/[, ]/):c(e,/[, ]/)})),n}var i={},o={},a=e.makeMap,s=e.each,l=e.extend,c=e.explode,u=e.inArray;return function(e){function o(t,n,r){var o=e[t];return o?o=a(o,/[, ]/,a(o.toUpperCase(),/[, ]/)):(o=i[t],o||(o=a(n," ",a(n.toUpperCase()," ")),o=l(o,r),i[t]=o)),o}function d(e){return new RegExp("^"+e.replace(/([?+*])/g,".$1")+"$")}function f(e){var n,r,i,o,s,l,c,f,p,h,m,g,v,b,x,w,_,E,N,k=/^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)\])?$/,S=/^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,T=/[*?+]/;if(e)for(e=t(e,","),y["@"]&&(w=y["@"].attributes,_=y["@"].attributesOrder),n=0,r=e.length;r>n;n++)if(s=k.exec(e[n])){if(b=s[1],p=s[2],x=s[3],f=s[5],g={},v=[],l={attributes:g,attributesOrder:v},"#"===b&&(l.paddEmpty=!0),"-"===b&&(l.removeEmpty=!0),"!"===s[4]&&(l.removeEmptyAttrs=!0),w){for(E in w)g[E]=w[E];v.push.apply(v,_)}if(f)for(f=t(f,"|"),i=0,o=f.length;o>i;i++)if(s=S.exec(f[i])){if(c={},m=s[1],h=s[2].replace(/::/g,":"),b=s[3],N=s[4],"!"===m&&(l.attributesRequired=l.attributesRequired||[],l.attributesRequired.push(h),c.required=!0),"-"===m){delete g[h],v.splice(u(v,h),1);continue}b&&("="===b&&(l.attributesDefault=l.attributesDefault||[],l.attributesDefault.push({name:h,value:N}),c.defaultValue=N),":"===b&&(l.attributesForced=l.attributesForced||[],l.attributesForced.push({name:h,value:N}),c.forcedValue=N),"<"===b&&(c.validValues=a(N,"?"))),T.test(h)?(l.attributePatterns=l.attributePatterns||[],c.pattern=d(h),l.attributePatterns.push(c)):(g[h]||v.push(h),g[h]=c)}w||"@"!=p||(w=g,_=v),x&&(l.outputName=p,y[x]=l),T.test(p)?(l.pattern=d(p),C.push(l)):y[p]=l}}function p(e){y={},C=[],f(e),s(_,function(e,t){b[t]=e.children})}function h(e){var n=/^(~)?(.+)$/;e&&(i.text_block_elements=i.block_elements=null,s(t(e,","),function(e){var t=n.exec(e),r="~"===t[1],i=r?"span":"div",o=t[2];if(b[o]=b[i],H[o]=i,r||(R[o.toUpperCase()]={},R[o]={}),!y[o]){var a=y[i];a=l({},a),delete a.removeEmptyAttrs,delete a.removeEmpty,y[o]=a}s(b,function(e,t){e[i]&&(b[t]=e=l({},b[t]),e[o]=e[i])})}))}function m(e){var n=/^([+\-]?)(\w+)\[([^\]]+)\]$/;e&&s(t(e,","),function(e){var r=n.exec(e),i,o;r&&(o=r[1],i=o?b[r[2]]:b[r[2]]={"#comment":{}},i=b[r[2]],s(t(r[3],"|"),function(e){"-"===o?(b[r[2]]=i=l({},b[r[2]]),delete i[e]):i[e]={}}))})}function g(e){var t=y[e],n;if(t)return t;for(n=C.length;n--;)if(t=C[n],t.pattern.test(e))return t}var v=this,y={},b={},C=[],x,w,_,E,N,k,S,T,R,A,B,D,M,H={},L={};e=e||{},_=n(e.schema),e.verify_html===!1&&(e.valid_elements="*[*]"),x=r(e.valid_styles),w=r(e.invalid_styles,"map"),T=r(e.valid_classes,"map"),E=o("whitespace_elements","pre script noscript style textarea video audio iframe object"),N=o("self_closing_elements","colgroup dd dt li option p td tfoot th thead tr"),k=o("short_ended_elements","area base basefont br col frame hr img input isindex link meta param embed source wbr track"),S=o("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls"),A=o("non_empty_elements","td th iframe video audio object script",k),B=o("move_caret_before_on_enter_elements","table",A),D=o("text_block_elements","h1 h2 h3 h4 h5 h6 p div address pre form blockquote center dir fieldset header footer article section hgroup aside nav figure"),R=o("block_elements","hr table tbody thead tfoot th tr td li ol ul caption dl dt dd noscript menu isindex option datalist select optgroup",D),M=o("text_inline_elements","span strong b em i font strike u var cite dfn code mark q sup sub samp"),s((e.special||"script noscript style textarea").split(" "),function(e){L[e]=new RegExp("]*>","gi")}),e.valid_elements?p(e.valid_elements):(s(_,function(e,t){y[t]={attributes:e.attributes,attributesOrder:e.attributesOrder},b[t]=e.children}),"html5"!=e.schema&&s(t("strong/b em/i"),function(e){e=t(e,"/"),y[e[1]].outputName=e[0]}),y.img.attributesDefault=[{name:"alt",value:""}],s(t("ol ul sub sup blockquote span font a table tbody tr strong em b i"),function(e){y[e]&&(y[e].removeEmpty=!0)}),s(t("p h1 h2 h3 h4 h5 h6 th td pre div address caption"),function(e){y[e].paddEmpty=!0}),s(t("span"),function(e){y[e].removeEmptyAttrs=!0})),h(e.custom_elements),m(e.valid_children),f(e.extended_valid_elements),m("+ol[ul|ol],+ul[ul|ol]"),e.invalid_elements&&s(c(e.invalid_elements),function(e){y[e]&&delete y[e]}),g("span")||f("span[!data-mce-type|*]"),v.children=b,v.getValidStyles=function(){return x},v.getInvalidStyles=function(){return w},v.getValidClasses=function(){return T},v.getBoolAttrs=function(){return S},v.getBlockElements=function(){return R},v.getTextBlockElements=function(){return D},v.getTextInlineElements=function(){return M},v.getShortEndedElements=function(){return k},v.getSelfClosingElements=function(){return N},v.getNonEmptyElements=function(){return A},v.getMoveCaretBeforeOnEnterElements=function(){return B},v.getWhiteSpaceElements=function(){return E},v.getSpecialElements=function(){return L},v.isValidChild=function(e,t){var n=b[e];return!(!n||!n[t])},v.isValid=function(e,t){var n,r,i=g(e);if(i){if(!t)return!0;if(i.attributes[t])return!0;if(n=i.attributePatterns)for(r=n.length;r--;)if(n[r].pattern.test(e))return!0}return!1},v.getElementRule=g,v.getCustomElements=function(){return H},v.addValidElements=f,v.setValidElements=p,v.addCustomElements=h,v.addValidChildren=m,v.elements=y}}),r(N,[E,g,d],function(e,t,n){function r(e,t,n){var r=1,i,o,a,s;for(s=e.getShortEndedElements(),a=/<([!?\/])?([A-Za-z0-9\-_\:\.]+)((?:\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\/|\s+)>/g,a.lastIndex=i=n;o=a.exec(t);){if(i=a.lastIndex,"/"===o[1])r--;else if(!o[1]){if(o[2]in s)continue;r++}if(0===r)break}return i}function i(i,a){function s(){}var l=this;i=i||{},l.schema=a=a||new e,i.fix_self_closing!==!1&&(i.fix_self_closing=!0),o("comment cdata text start end pi doctype".split(" "),function(e){e&&(l[e]=i[e]||s)}),l.parse=function(e){function o(e){var t,n;for(t=p.length;t--&&p[t].name!==e;);if(t>=0){for(n=p.length-1;n>=t;n--)e=p[n],e.valid&&l.end(e.name);p.length=t}}function s(e,t,n,r,o){var a,s,l=/[\s\u0000-\u001F]+/g;if(t=t.toLowerCase(),n=t in x?t:z(n||r||o||""),_&&!y&&0!==t.indexOf("data-")){if(a=T[t],!a&&R){for(s=R.length;s--&&(a=R[s],!a.pattern.test(t)););-1===s&&(a=null)}if(!a)return;if(a.validValues&&!(n in a.validValues))return}if(V[t]&&!i.allow_script_urls){var c=n.replace(l,"");try{c=decodeURIComponent(c)}catch(u){c=unescape(c)}if(U.test(c))return;if(!i.allow_html_data_urls&&$.test(c)&&!/^data:image\//i.test(c))return}h.map[t]=n,h.push({name:t,value:n})}var l=this,c,u=0,d,f,p=[],h,m,g,v,y,b,C,x,w,_,E,N,k,S,T,R,A,B,D,M,H,L,P,O,I,F=0,z=t.decode,W,V=n.makeMap("src,href,data,background,formaction,poster"),U=/((java|vb)script|mhtml):/i,$=/^data:/i;for(L=new RegExp("<(?:(?:!--([\\w\\W]*?)-->)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([^>]+)>)|(?:([A-Za-z0-9\\-_\\:\\.]+)((?:\\s+[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*|\\/|\\s+)>))","g"),P=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g,C=a.getShortEndedElements(),H=i.self_closing_elements||a.getSelfClosingElements(),x=a.getBoolAttrs(),_=i.validate,b=i.remove_internals,W=i.fix_self_closing,O=a.getSpecialElements();c=L.exec(e);){if(u0&&p[p.length-1].name===d&&o(d),!_||(E=a.getElementRule(d))){if(N=!0,_&&(T=E.attributes,R=E.attributePatterns),(S=c[8])?(y=-1!==S.indexOf("data-mce-type"),y&&b&&(N=!1),h=[],h.map={},S.replace(P,s)):(h=[],h.map={}),_&&!y){if(A=E.attributesRequired,B=E.attributesDefault,D=E.attributesForced,M=E.removeEmptyAttrs,M&&!h.length&&(N=!1),D)for(m=D.length;m--;)k=D[m],v=k.name,I=k.value,"{$uid}"===I&&(I="mce_"+F++),h.map[v]=I,h.push({name:v,value:I});if(B)for(m=B.length;m--;)k=B[m],v=k.name,v in h.map||(I=k.value,"{$uid}"===I&&(I="mce_"+F++),h.map[v]=I,h.push({name:v,value:I}));if(A){for(m=A.length;m--&&!(A[m]in h.map););-1===m&&(N=!1)}if(k=h.map["data-mce-bogus"]){if("all"===k){u=r(a,e,L.lastIndex),L.lastIndex=u;continue}N=!1}}N&&l.start(d,h,w)}else N=!1;if(f=O[d]){f.lastIndex=u=c.index+c[0].length,(c=f.exec(e))?(N&&(g=e.substr(u,c.index-u)),u=c.index+c[0].length):(g=e.substr(u),u=e.length),N&&(g.length>0&&l.text(g,!0),l.end(d)),L.lastIndex=u;continue}w||(S&&S.indexOf("/")==S.length-1?N&&l.end(d):p.push({name:d,valid:N}))}else(d=c[1])?(">"===d.charAt(0)&&(d=" "+d),i.allow_conditional_comments||"[if"!==d.substr(0,3)||(d=" "+d),l.comment(d)):(d=c[2])?l.cdata(d):(d=c[3])?l.doctype(d):(d=c[4])&&l.pi(d,c[5]);u=c.index+c[0].length}for(u=0;m--)d=p[m],d.valid&&l.end(d.name)}}var o=n.each;return i.findEndTag=r,i}),r(k,[_,E,N,d],function(e,t,n,r){var i=r.makeMap,o=r.each,a=r.explode,s=r.extend;return function(r,l){function c(t){var n,r,o,a,s,c,d,f,p,h,m,g,v,y;for(m=i("tr,td,th,tbody,thead,tfoot,table"),h=l.getNonEmptyElements(),g=l.getTextBlockElements(),n=0;n1){for(a.reverse(),s=c=u.filterNode(a[0].clone()),p=0;p0?(t.value=n,t=t.prev):(r=t.prev,t.remove(),t=r)}function g(e){var t,n={};for(t in e)"li"!==t&&"p"!=t&&(n[t]=e[t]);return n}var v,y,b,C,x,w,_,E,N,k,S,T,R,A=[],B,D,M,H,L,P,O,I;if(o=o||{},p={},h={},T=s(i("script,style,head,html,body,title,meta,param"),l.getBlockElements()),O=l.getNonEmptyElements(),P=l.children,S=r.validate,I="forced_root_block"in o?o.forced_root_block:r.forced_root_block,L=l.getWhiteSpaceElements(),R=/^[ \t\r\n]+/,D=/[ \t\r\n]+$/,M=/[ \t\r\n]+/g,H=/^[ \t\r\n]+$/,v=new n({validate:S,allow_script_urls:r.allow_script_urls,allow_conditional_comments:r.allow_conditional_comments,self_closing_elements:g(l.getSelfClosingElements()),cdata:function(e){b.append(u("#cdata",4)).value=e},text:function(e,t){var n;B||(e=e.replace(M," "),b.lastChild&&T[b.lastChild.name]&&(e=e.replace(R,""))),0!==e.length&&(n=u("#text",3),n.raw=!!t,b.append(n).value=e)},comment:function(e){b.append(u("#comment",8)).value=e},pi:function(e,t){b.append(u(e,7)).value=t,m(b)},doctype:function(e){var t;t=b.append(u("#doctype",10)),t.value=e,m(b)},start:function(e,t,n){var r,i,o,a,s;if(o=S?l.getElementRule(e):{}){for(r=u(o.outputName||e,1),r.attributes=t,r.shortEnded=n,b.append(r),s=P[b.name],s&&P[r.name]&&!s[r.name]&&A.push(r),i=f.length;i--;)a=f[i].name,a in t.map&&(N=h[a],N?N.push(r):h[a]=[r]);T[e]&&m(r),n||(b=r),!B&&L[e]&&(B=!0)}},end:function(t){var n,r,i,o,a;if(r=S?l.getElementRule(t):{}){if(T[t]&&!B){if(n=b.firstChild,n&&3===n.type)if(i=n.value.replace(R,""),i.length>0)n.value=i,n=n.next;else for(o=n.next,n.remove(),n=o;n&&3===n.type;)i=n.value,o=n.next,(0===i.length||H.test(i))&&(n.remove(),n=o),n=o;if(n=b.lastChild,n&&3===n.type)if(i=n.value.replace(D,""),i.length>0)n.value=i,n=n.prev;else for(o=n.prev,n.remove(),n=o;n&&3===n.type;)i=n.value,o=n.prev,(0===i.length||H.test(i))&&(n.remove(),n=o),n=o}if(B&&L[t]&&(B=!1),(r.removeEmpty||r.paddEmpty)&&b.isEmpty(O))if(r.paddEmpty)b.empty().append(new e("#text","3")).value="\xa0";else if(!b.attributes.map.name&&!b.attributes.map.id)return a=b.parent,T[b.name]?b.empty().remove():b.unwrap(),void(b=a);b=b.parent}}},l),y=b=new e(o.context||r.root_name,11),v.parse(t),S&&A.length&&(o.context?o.invalid=!0:c(A)),I&&("body"==y.name||o.isRootContent)&&a(),!o.invalid){for(k in p){for(N=d[k],C=p[k],_=C.length;_--;)C[_].parent||C.splice(_,1);for(x=0,w=N.length;w>x;x++)N[x](C,k,o)}for(x=0,w=f.length;w>x;x++)if(N=f[x],N.name in h){for(C=h[N.name],_=C.length;_--;)C[_].parent||C.splice(_,1);for(_=0,E=N.callbacks.length;E>_;_++)N.callbacks[_](C,N.name,o)}}return y},r.remove_trailing_brs&&u.addNodeFilter("br",function(t){var n,r=t.length,i,o=s({},l.getBlockElements()),a=l.getNonEmptyElements(),c,u,d,f,p,h;for(o.body=1,n=0;r>n;n++)if(i=t[n],c=i.parent,o[i.parent.name]&&i===c.lastChild){for(d=i.prev;d;){if(f=d.name,"span"!==f||"bookmark"!==d.attr("data-mce-type")){if("br"!==f)break;if("br"===f){i=null;break}}d=d.prev}i&&(i.remove(),c.isEmpty(a)&&(p=l.getElementRule(c.name),p&&(p.removeEmpty?c.remove():p.paddEmpty&&(c.empty().append(new e("#text",3)).value="\xa0"))))}else{for(u=i;c&&c.firstChild===u&&c.lastChild===u&&(u=c,!o[c.name]);)c=c.parent;u===c&&(h=new e("#text",3),h.value="\xa0",i.replace(h))}}),r.allow_html_in_named_anchor||u.addAttributeFilter("id,name",function(e){for(var t=e.length,n,r,i,o;t--;)if(o=e[t],"a"===o.name&&o.firstChild&&!o.attr("href")){i=o.parent,n=o.lastChild;do r=n.prev,i.insert(n,o),n=r;while(n)}}),r.validate&&l.getValidClasses()&&u.addAttributeFilter("class",function(e){for(var t=e.length,n,r,i,o,a,s=l.getValidClasses(),c,u;t--;){for(n=e[t],r=n.attr("class").split(" "),a="",i=0;i0&&(f=r[r.length-1],f.length>0&&"\n"!==f&&r.push("\n")),r.push("<",e),t)for(c=0,u=t.length;u>c;c++)d=t[c],r.push(" ",d.name,'="',s(d.value,!0),'"');!n||l?r[r.length]=">":r[r.length]=" />",n&&i&&a[e]&&r.length>0&&(f=r[r.length-1],f.length>0&&"\n"!==f&&r.push("\n"))},end:function(e){var t;r.push(""),i&&a[e]&&r.length>0&&(t=r[r.length-1],t.length>0&&"\n"!==t&&r.push("\n"))},text:function(e,t){e.length>0&&(r[r.length]=t?e:s(e))},cdata:function(e){r.push("")},comment:function(e){r.push("")},pi:function(e,t){t?r.push(""):r.push(""),i&&r.push("\n")},doctype:function(e){r.push("",i?"\n":"")},reset:function(){r.length=0},getContent:function(){return r.join("").replace(/\n$/,"")}}}}),r(T,[S,E],function(e,t){return function(n,r){var i=this,o=new e(n);n=n||{},n.validate="validate"in n?n.validate:!0,i.schema=r=r||new t,i.writer=o,i.serialize=function(e){function t(e){var n=i[e.type],s,l,c,u,d,f,p,h,m;if(n)n(e);else{if(s=e.name,l=e.shortEnded,c=e.attributes,a&&c&&c.length>1){for(f=[],f.map={},m=r.getElementRule(e.name),p=0,h=m.attributesOrder.length;h>p;p++)u=m.attributesOrder[p],u in c.map&&(d=c.map[u],f.map[u]=d,f.push({name:u,value:d}));for(p=0,h=c.length;h>p;p++)u=c[p].name,u in f.map||(d=c.map[u],f.map[u]=d,f.push({name:u,value:d}));c=f}if(o.start(e.name,c,l),!l){if(e=e.firstChild)do t(e);while(e=e.next);o.end(s)}}}var i,a;return a=n.validate,i={3:function(e){o.text(e.value,e.raw)},8:function(e){o.comment(e.value)},7:function(e){o.pi(e.name,e.value)},10:function(e){o.doctype(e.value)},4:function(e){o.cdata(e.value)},11:function(e){if(e=e.firstChild)do t(e);while(e=e.next)}},o.reset(),1!=e.type||n.inner?i[11](e):t(e),o.getContent()}}}),r(R,[y,k,g,T,_,E,u,d],function(e,t,n,r,i,o,a,s){var l=s.each,c=s.trim,u=e.DOM;return function(e,i){var s,d,f;return i&&(s=i.dom,d=i.schema),s=s||u,d=d||new o(e),e.entity_encoding=e.entity_encoding||"named",e.remove_trailing_brs="remove_trailing_brs"in e?e.remove_trailing_brs:!0,f=new t(e,d),f.addAttributeFilter("data-mce-tabindex",function(e,t){for(var n=e.length,r;n--;)r=e[n],r.attr("tabindex",r.attributes.map["data-mce-tabindex"]),r.attr(t,null)}),f.addAttributeFilter("src,href,style",function(t,n){for(var r=t.length,i,o,a="data-mce-"+n,l=e.url_converter,c=e.url_converter_scope,u;r--;)i=t[r],o=i.attributes.map[a],o!==u?(i.attr(n,o.length>0?o:null),i.attr(a,null)):(o=i.attributes.map[n],"style"===n?o=s.serializeStyle(s.parseStyle(o),i.name):l&&(o=l.call(c,o,n,i.name)),i.attr(n,o.length>0?o:null))}),f.addAttributeFilter("class",function(e){for(var t=e.length,n,r;t--;)n=e[t],r=n.attr("class"),r&&(r=n.attr("class").replace(/(?:^|\s)mce-item-\w+(?!\S)/g,""),n.attr("class",r.length>0?r:null))}),f.addAttributeFilter("data-mce-type",function(e,t,n){for(var r=e.length,i;r--;)i=e[r],"bookmark"!==i.attributes.map["data-mce-type"]||n.cleanup||i.remove()}),f.addNodeFilter("noscript",function(e){for(var t=e.length,r;t--;)r=e[t].firstChild,r&&(r.value=n.decode(r.value))}),f.addNodeFilter("script,style",function(e,t){function n(e){return e.replace(/()/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"")}for(var r=e.length,i,o,a;r--;)i=e[r],o=i.firstChild?i.firstChild.value:"","script"===t?(a=i.attr("type"),a&&i.attr("type","mce-no/type"==a?null:a.replace(/^mce\-/,"")),o.length>0&&(i.firstChild.value="// ")):o.length>0&&(i.firstChild.value="")}),f.addNodeFilter("#comment",function(e){for(var t=e.length,n;t--;)n=e[t],0===n.value.indexOf("[CDATA[")?(n.name="#cdata",n.type=4,n.value=n.value.replace(/^\[CDATA\[|\]\]$/g,"")):0===n.value.indexOf("mce:protected ")&&(n.name="#text",n.type=3,n.raw=!0,n.value=unescape(n.value).substr(14))}),f.addNodeFilter("xml:namespace,input",function(e,t){for(var n=e.length,r;n--;)r=e[n],7===r.type?r.remove():1===r.type&&("input"!==t||"type"in r.attributes.map||r.attr("type","text"))}),e.fix_list_elements&&f.addNodeFilter("ul,ol",function(e){for(var t=e.length,n,r;t--;)n=e[t],r=n.parent,("ul"===r.name||"ol"===r.name)&&n.prev&&"li"===n.prev.name&&n.prev.append(n)}),f.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style,data-mce-selected,data-mce-expando,data-mce-type,data-mce-resize",function(e,t){for(var n=e.length;n--;)e[n].attr(t,null)}),{schema:d,addNodeFilter:f.addNodeFilter,addAttributeFilter:f.addAttributeFilter,serialize:function(t,n){var i=this,o,u,p,h,m;return a.ie&&s.select("script,style,select,map").length>0?(m=t.innerHTML,t=t.cloneNode(!1),s.setHTML(t,m)):t=t.cloneNode(!0),o=t.ownerDocument.implementation,o.createHTMLDocument&&(u=o.createHTMLDocument(""),l("BODY"==t.nodeName?t.childNodes:[t],function(e){u.body.appendChild(u.importNode(e,!0))}),t="BODY"!=t.nodeName?u.body.firstChild:u.body,p=s.doc,s.doc=u),n=n||{},n.format=n.format||"html",n.selection&&(n.forced_root_block=""),n.no_events||(n.node=t,i.onPreProcess(n)),h=new r(e,d),n.content=h.serialize(f.parse(c(n.getInner?t.innerHTML:s.getOuterHTML(t)),n)),n.cleanup||(n.content=n.content.replace(/\uFEFF/g,"")),n.no_events||i.onPostProcess(n),p&&(s.doc=p),n.node=null,n.content},addRules:function(e){d.addValidElements(e)},setRules:function(e){d.setValidElements(e)},onPreProcess:function(e){i&&i.fire("PreProcess",e)},onPostProcess:function(e){i&&i.fire("PostProcess",e)}}}}),r(A,[],function(){function e(e){function t(t,n){var r,i=0,o,a,s,l,c,u,d=-1,f;if(r=t.duplicate(),r.collapse(n),f=r.parentElement(),f.ownerDocument===e.dom.doc){for(;"false"===f.contentEditable;)f=f.parentNode;if(!f.hasChildNodes())return{node:f,inside:1};for(s=f.children,o=s.length-1;o>=i;)if(u=Math.floor((i+o)/2),l=s[u],r.moveToElementText(l),d=r.compareEndPoints(n?"StartToStart":"EndToEnd",t),d>0)o=u-1;else{if(!(0>d))return{node:l};i=u+1}if(0>d)for(l?r.collapse(!1):(r.moveToElementText(f),r.collapse(!0),l=f,a=!0),c=0;0!==r.compareEndPoints(n?"StartToStart":"StartToEnd",t)&&0!==r.move("character",1)&&f==r.parentElement();)c++;else for(r.collapse(!0),c=0;0!==r.compareEndPoints(n?"StartToStart":"StartToEnd",t)&&0!==r.move("character",-1)&&f==r.parentElement();)c++;return{node:l,position:d,offset:c,inside:a}}}function n(){function n(e){var n=t(o,e),r,i,s=0,l,c,u;if(r=n.node,i=n.offset,n.inside&&!r.hasChildNodes())return void a[e?"setStart":"setEnd"](r,0);if(i===c)return void a[e?"setStartBefore":"setEndAfter"](r);if(n.position<0){if(l=n.inside?r.firstChild:r.nextSibling,!l)return void a[e?"setStartAfter":"setEndAfter"](r);if(!i)return void(3==l.nodeType?a[e?"setStart":"setEnd"](l,0):a[e?"setStartBefore":"setEndBefore"](l));for(;l;){if(3==l.nodeType&&(u=l.nodeValue,s+=u.length,s>=i)){r=l,s-=i,s=u.length-s;break}l=l.nextSibling}}else{if(l=r.previousSibling,!l)return a[e?"setStartBefore":"setEndBefore"](r);if(!i)return void(3==r.nodeType?a[e?"setStart":"setEnd"](l,r.nodeValue.length):a[e?"setStartAfter":"setEndAfter"](l));for(;l;){if(3==l.nodeType&&(s+=l.nodeValue.length,s>=i)){r=l,s-=i;break}l=l.previousSibling}}a[e?"setStart":"setEnd"](r,s)}var o=e.getRng(),a=i.createRng(),s,l,c,u,d;if(s=o.item?o.item(0):o.parentElement(),s.ownerDocument!=i.doc)return a;if(l=e.isCollapsed(),o.item)return a.setStart(s.parentNode,i.nodeIndex(s)),a.setEnd(a.startContainer,a.startOffset+1),a;try{n(!0),l||n()}catch(f){if(-2147024809!=f.number)throw f;d=r.getBookmark(2),c=o.duplicate(),c.collapse(!0),s=c.parentElement(),l||(c=o.duplicate(),c.collapse(!1),u=c.parentElement(),u.innerHTML=u.innerHTML),s.innerHTML=s.innerHTML,r.moveToBookmark(d),o=e.getRng(),n(!0),l||n()}return a}var r=this,i=e.dom,o=!1;this.getBookmark=function(n){function r(e){var t,n,r,o,a=[];for(t=e.parentNode,n=i.getRoot().parentNode;t!=n&&9!==t.nodeType;){for(r=t.children,o=r.length;o--;)if(e===r[o]){a.push(o);break}e=t,t=t.parentNode}return a}function o(e){var n;return n=t(a,e),n?{position:n.position,offset:n.offset,indexes:r(n.node),inside:n.inside}:void 0}var a=e.getRng(),s={};return 2===n&&(a.item?s.start={ctrl:!0,indexes:r(a.item(0))}:(s.start=o(!0),e.isCollapsed()||(s.end=o()))),s},this.moveToBookmark=function(e){function t(e){var t,n,r,o;for(t=i.getRoot(),n=e.length-1;n>=0;n--)o=t.children,r=e[n],r<=o.length-1&&(t=o[r]);return t}function n(n){var i=e[n?"start":"end"],a,s,l,c;i&&(a=i.position>0,s=o.createTextRange(),s.moveToElementText(t(i.indexes)),c=i.offset,c!==l?(s.collapse(i.inside||a),s.moveStart("character",a?-c:c)):s.collapse(n),r.setEndPoint(n?"StartToStart":"EndToStart",s),n&&r.collapse(!0))}var r,o=i.doc.body;e.start&&(e.start.ctrl?(r=o.createControlRange(),r.addElement(t(e.start.indexes)),r.select()):(r=o.createTextRange(),n(!0),n(),r.select()))},this.addRange=function(t){function n(e){var t,n,a,d,h;a=i.create("a"),t=e?s:c,n=e?l:u,d=r.duplicate(),(t==f||t==f.documentElement)&&(t=p,n=0),3==t.nodeType?(t.parentNode.insertBefore(a,t),d.moveToElementText(a),d.moveStart("character",n),i.remove(a),r.setEndPoint(e?"StartToStart":"EndToEnd",d)):(h=t.childNodes,h.length?(n>=h.length?i.insertAfter(a,h[h.length-1]):t.insertBefore(a,h[n]),d.moveToElementText(a)):t.canHaveHTML&&(t.innerHTML="",a=t.firstChild,d.moveToElementText(a),d.collapse(o)),r.setEndPoint(e?"StartToStart":"EndToEnd",d),i.remove(a))}var r,a,s,l,c,u,d,f=e.dom.doc,p=f.body,h,m;if(s=t.startContainer,l=t.startOffset,c=t.endContainer,u=t.endOffset,r=p.createTextRange(),s==c&&1==s.nodeType){if(l==u&&!s.hasChildNodes()){if(s.canHaveHTML)return d=s.previousSibling,d&&!d.hasChildNodes()&&i.isBlock(d)?d.innerHTML="":d=null,s.innerHTML="",r.moveToElementText(s.lastChild),r.select(),i.doc.selection.clear(),s.innerHTML="",void(d&&(d.innerHTML=""));l=i.nodeIndex(s),s=s.parentNode}if(l==u-1)try{if(m=s.childNodes[l],a=p.createControlRange(),a.addElement(m),a.select(),h=e.getRng(),h.item&&m===h.item(0))return}catch(g){}}n(!0),n(),r.select()},this.getRangeAt=n}return e}),r(B,[u],function(e){return{BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,modifierPressed:function(e){return e.shiftKey||e.ctrlKey||e.altKey||this.metaKeyPressed(e)},metaKeyPressed:function(t){return e.mac?t.metaKey:t.ctrlKey&&!t.altKey}}}),r(D,[B,d,u],function(e,t,n){return function(r,i){function o(e){var t=i.settings.object_resizing;return t===!1||n.iOS?!1:("string"!=typeof t&&(t="table,img,div"),"false"===e.getAttribute("data-mce-resize")?!1:i.dom.is(e,t))}function a(t){var n,r,o,a,s;n=t.screenX-T,r=t.screenY-R,P=n*k[2]+D,O=r*k[3]+M,P=5>P?5:P,O=5>O?5:O,o="IMG"==w.nodeName&&i.settings.resize_img_proportional!==!1?!e.modifierPressed(t):e.modifierPressed(t)||"IMG"==w.nodeName&&k[2]*k[3]!==0,o&&(W(n)>W(r)?(O=V(P*H),P=V(O/H)):(P=V(O/H),O=V(P*H))),C.setStyles(_,{width:P,height:O}),a=k.startPos.x+n,s=k.startPos.y+r,a=a>0?a:0,s=s>0?s:0,C.setStyles(E,{left:a,top:s,display:"block"}),E.innerHTML=P+" × "+O,k[2]<0&&_.clientWidth<=P&&C.setStyle(_,"left",A+(D-P)),k[3]<0&&_.clientHeight<=O&&C.setStyle(_,"top",B+(M-O)),n=U.scrollWidth-$,r=U.scrollHeight-q,n+r!==0&&C.setStyles(E,{left:a-n,top:s-r}),L||(i.fire("ObjectResizeStart",{target:w,width:D,height:M}),L=!0)}function s(){function e(e,t){t&&(w.style[e]||!i.schema.isValid(w.nodeName.toLowerCase(),e)?C.setStyle(w,e,t):C.setAttrib(w,e,t))}L=!1,e("width",P),e("height",O),C.unbind(I,"mousemove",a),C.unbind(I,"mouseup",s),F!=I&&(C.unbind(F,"mousemove",a),C.unbind(F,"mouseup",s)),C.remove(_),C.remove(E),z&&"TABLE"!=w.nodeName||l(w),i.fire("ObjectResized",{target:w,width:P,height:O}),C.setAttrib(w,"style",C.getAttrib(w,"style")),i.nodeChanged()}function l(e,t,r){var l,u,d,f,p;g(),l=C.getPos(e,U),A=l.x,B=l.y,p=e.getBoundingClientRect(),u=p.width||p.right-p.left,d=p.height||p.bottom-p.top,w!=e&&(m(),w=e,P=O=0),f=i.fire("ObjectSelected",{target:e}),o(e)&&!f.isDefaultPrevented()?x(N,function(e,i){function o(t){T=t.screenX,R=t.screenY,D=w.clientWidth,M=w.clientHeight,H=M/D,k=e,e.startPos={x:u*e[0]+A,y:d*e[1]+B},$=U.scrollWidth,q=U.scrollHeight,_=w.cloneNode(!0),C.addClass(_,"mce-clonedresizable"),C.setAttrib(_,"data-mce-bogus","all"),_.contentEditable=!1,_.unSelectabe=!0,C.setStyles(_,{left:A,top:B,margin:0}),_.removeAttribute("data-mce-selected"),U.appendChild(_),C.bind(I,"mousemove",a),C.bind(I,"mouseup",s),F!=I&&(C.bind(F,"mousemove",a),C.bind(F,"mouseup",s)),E=C.add(U,"div",{"class":"mce-resize-helper","data-mce-bogus":"all"},D+" × "+M)}var l,c;return t?void(i==t&&o(r)):(l=C.get("mceResizeHandle"+i),l?C.show(l):(c=U,l=C.add(c,"div",{id:"mceResizeHandle"+i,"data-mce-bogus":"all","class":"mce-resizehandle",unselectable:!0,style:"cursor:"+i+"-resize; margin:0; padding:0"}),n.ie&&(l.contentEditable=!1)),e.elm||(C.bind(l,"mousedown",function(e){e.stopImmediatePropagation(),e.preventDefault(),o(e)}),e.elm=l),void C.setStyles(l,{left:u*e[0]+A-l.offsetWidth/2,top:d*e[1]+B-l.offsetHeight/2}))}):c(),w.setAttribute("data-mce-selected","1")}function c(){var e,t;g(),w&&w.removeAttribute("data-mce-selected");for(e in N)t=C.get("mceResizeHandle"+e),t&&(C.unbind(t),C.remove(t))}function u(e){function t(e,t){if(e)do if(e===t)return!0;while(e=e.parentNode)}var n,i;if(!L)return x(C.select("img[data-mce-selected],hr[data-mce-selected]"),function(e){e.removeAttribute("data-mce-selected")}),i="mousedown"==e.type?e.target:r.getNode(),i=C.$(i).closest(z?"table":"table,img,hr")[0],t(i,U)&&(v(),n=r.getStart(!0),t(n,i)&&t(r.getEnd(!0),i)&&(!z||i!=n&&"IMG"!==n.nodeName))?void l(i):void c()}function d(e,t,n){e&&e.attachEvent&&e.attachEvent("on"+t,n)}function f(e,t,n){e&&e.detachEvent&&e.detachEvent("on"+t,n)}function p(e){var t=e.srcElement,n,r,o,a,s,c,u;n=t.getBoundingClientRect(),c=S.clientX-n.left,u=S.clientY-n.top;for(r in N)if(o=N[r],a=t.offsetWidth*o[0],s=t.offsetHeight*o[1],W(a-c)<8&&W(s-u)<8){k=o;break}L=!0,i.fire("ObjectResizeStart",{target:w,width:w.clientWidth,height:w.clientHeight}),i.getDoc().selection.empty(),l(t,r,S)}function h(e){var t=e.srcElement;if(t!=w){if(i.fire("ObjectSelected",{target:t}),m(),0===t.id.indexOf("mceResizeHandle"))return void(e.returnValue=!1);("IMG"==t.nodeName||"TABLE"==t.nodeName)&&(c(),w=t,d(t,"resizestart",p))}}function m(){f(w,"resizestart",p)}function g(){for(var e in N){var t=N[e];t.elm&&(C.unbind(t.elm),delete t.elm)}}function v(){try{i.getDoc().execCommand("enableObjectResizing",!1,!1)}catch(e){}}function y(e){var t;if(z){t=I.body.createControlRange();try{return t.addElement(e),t.select(),!0}catch(n){}}}function b(){w=_=null,z&&(m(),f(U,"controlselect",h))}var C=i.dom,x=t.each,w,_,E,N,k,S,T,R,A,B,D,M,H,L,P,O,I=i.getDoc(),F=document,z=n.ie&&n.ie<11,W=Math.abs,V=Math.round,U=i.getBody(),$,q;N={n:[.5,0,0,-1],e:[1,.5,1,0],s:[.5,1,0,1],w:[0,.5,-1,0],nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,1],sw:[0,1,-1,1]};var j=".mce-content-body";return i.contentStyles.push(j+" div.mce-resizehandle {position: absolute;border: 1px solid black;background: #FFF;width: 5px;height: 5px;z-index: 10000}"+j+" .mce-resizehandle:hover {background: #000}"+j+" img[data-mce-selected], hr[data-mce-selected] {outline: 1px solid black;resize: none}"+j+" .mce-clonedresizable {position: absolute;"+(n.gecko?"":"outline: 1px dashed black;")+"opacity: .5;filter: alpha(opacity=50);z-index: 10000}"+j+" .mce-resize-helper {background: #555;background: rgba(0,0,0,0.75);border-radius: 3px;border: 1px;color: white;display: none;font-family: sans-serif;font-size: 12px;white-space: nowrap;line-height: 14px;margin: 5px 10px;padding: 5px;position: absolute;z-index: 10001}"),i.on("init",function(){z?(i.on("ObjectResized",function(e){"TABLE"!=e.target.nodeName&&(c(),y(e.target))}),d(U,"controlselect",h),i.on("mousedown",function(e){S=e})):(v(),n.ie>=11&&(i.on("mouseup",function(e){var t=e.target.nodeName;!L&&/^(TABLE|IMG|HR)$/.test(t)&&(i.selection.select(e.target,"TABLE"==t),i.nodeChanged())}),i.dom.bind(U,"mscontrolselect",function(e){/^(TABLE|IMG|HR)$/.test(e.target.nodeName)&&(e.preventDefault(),"IMG"==e.target.tagName&&window.setTimeout(function(){i.selection.select(e.target)},0))}))),i.on("nodechange ResizeEditor",u),i.on("keydown keyup",function(e){w&&"TABLE"==w.nodeName&&u(e)}),i.on("hide",c)}),i.on("remove",g),{isResizable:o,showResizeRect:l,hideResizeRect:c,updateResizeRect:u, +controlSelect:y,destroy:b}}}),r(M,[u,d],function(e,t){function n(n){var r=n.dom;this.getBookmark=function(e,i){function o(e,n){var i=0;return t.each(r.select(e),function(e,t){e==n&&(i=t)}),i}function a(e){function t(t){var n,r,i,o=t?"start":"end";n=e[o+"Container"],r=e[o+"Offset"],1==n.nodeType&&"TR"==n.nodeName&&(i=n.childNodes,n=i[Math.min(t?r:r-1,i.length-1)],n&&(r=t?0:n.childNodes.length,e["set"+(t?"Start":"End")](n,r)))}return t(!0),t(),e}function s(){function e(e,t){var n=e[t?"startContainer":"endContainer"],a=e[t?"startOffset":"endOffset"],s=[],l,c,u=0;if(3==n.nodeType){if(i)for(l=n.previousSibling;l&&3==l.nodeType;l=l.previousSibling)a+=l.nodeValue.length;s.push(a)}else c=n.childNodes,a>=c.length&&c.length&&(u=1,a=Math.max(0,c.length-1)),s.push(r.nodeIndex(c[a],i)+u);for(;n&&n!=o;n=n.parentNode)s.push(r.nodeIndex(n,i));return s}var t=n.getRng(!0),o=r.getRoot(),a={};return a.start=e(t,!0),n.isCollapsed()||(a.end=e(t)),a}var l,c,u,d,f,p,h="",m;if(2==e)return p=n.getNode(),f=p?p.nodeName:null,"IMG"==f?{name:f,index:o(f,p)}:n.tridentSel?n.tridentSel.getBookmark(e):s();if(e)return{rng:n.getRng()};if(l=n.getRng(),u=r.uniqueId(),d=n.isCollapsed(),m="overflow:hidden;line-height:0px",l.duplicate||l.item){if(l.item)return p=l.item(0),f=p.nodeName,{name:f,index:o(f,p)};c=l.duplicate();try{l.collapse(),l.pasteHTML(''+h+""),d||(c.collapse(!1),l.moveToElementText(c.parentElement()),0===l.compareEndPoints("StartToEnd",c)&&c.move("character",-1),c.pasteHTML(''+h+""))}catch(g){return null}}else{if(p=n.getNode(),f=p.nodeName,"IMG"==f)return{name:f,index:o(f,p)};c=a(l.cloneRange()),d||(c.collapse(!1),c.insertNode(r.create("span",{"data-mce-type":"bookmark",id:u+"_end",style:m},h))),l=a(l),l.collapse(!0),l.insertNode(r.create("span",{"data-mce-type":"bookmark",id:u+"_start",style:m},h))}return n.moveToBookmark({id:u,keep:1}),{id:u}},this.moveToBookmark=function(i){function o(e){var t=i[e?"start":"end"],n,r,o,a;if(t){for(o=t[0],r=c,n=t.length-1;n>=1;n--){if(a=r.childNodes,t[n]>a.length-1)return;r=a[t[n]]}3===r.nodeType&&(o=Math.min(t[0],r.nodeValue.length)),1===r.nodeType&&(o=Math.min(t[0],r.childNodes.length)),e?l.setStart(r,o):l.setEnd(r,o)}return!0}function a(n){var o=r.get(i.id+"_"+n),a,s,l,c,h=i.keep;if(o&&(a=o.parentNode,"start"==n?(h?(a=o.firstChild,s=1):s=r.nodeIndex(o),u=d=a,f=p=s):(h?(a=o.firstChild,s=1):s=r.nodeIndex(o),d=a,p=s),!h)){for(c=o.previousSibling,l=o.nextSibling,t.each(t.grep(o.childNodes),function(e){3==e.nodeType&&(e.nodeValue=e.nodeValue.replace(/\uFEFF/g,""))});o=r.get(i.id+"_"+n);)r.remove(o,1);c&&l&&c.nodeType==l.nodeType&&3==c.nodeType&&!e.opera&&(s=c.nodeValue.length,c.appendData(l.nodeValue),r.remove(l),"start"==n?(u=d=c,f=p=s):(d=c,p=s))}}function s(t){return!r.isBlock(t)||t.innerHTML||e.ie||(t.innerHTML='
    '),t}var l,c,u,d,f,p;if(i)if(i.start){if(l=r.createRng(),c=r.getRoot(),n.tridentSel)return n.tridentSel.moveToBookmark(i);o(!0)&&o()&&n.setRng(l)}else i.id?(a("start"),a("end"),u&&(l=r.createRng(),l.setStart(s(u),f),l.setEnd(s(d),p),n.setRng(l))):i.name?n.select(r.select(i.name)[i.index]):i.rng&&n.setRng(i.rng)}}return n.isBookmarkNode=function(e){return e&&"SPAN"===e.tagName&&"bookmark"===e.getAttribute("data-mce-type")},n}),r(H,[h,A,D,x,M,u,d],function(e,n,r,i,o,a,s){function l(e,t,i,a){var s=this;s.dom=e,s.win=t,s.serializer=i,s.editor=a,s.bookmarkManager=new o(s),s.controlSelection=new r(s,a),s.win.getSelection||(s.tridentSel=new n(s))}var c=s.each,u=s.trim,d=a.ie;return l.prototype={setCursorLocation:function(e,t){var n=this,r=n.dom.createRng();e?(r.setStart(e,t),r.setEnd(e,t),n.setRng(r),n.collapse(!1)):(n._moveEndPoint(r,n.editor.getBody(),!0),n.setRng(r))},getContent:function(e){var n=this,r=n.getRng(),i=n.dom.create("body"),o=n.getSel(),a,s,l;return e=e||{},a=s="",e.get=!0,e.format=e.format||"html",e.selection=!0,n.editor.fire("BeforeGetContent",e),"text"==e.format?n.isCollapsed()?"":r.text||(o.toString?o.toString():""):(r.cloneContents?(l=r.cloneContents(),l&&i.appendChild(l)):r.item!==t||r.htmlText!==t?(i.innerHTML="
    "+(r.item?r.item(0).outerHTML:r.htmlText),i.removeChild(i.firstChild)):i.innerHTML=r.toString(),/^\s/.test(i.innerHTML)&&(a=" "),/\s+$/.test(i.innerHTML)&&(s=" "),e.getInner=!0,e.content=n.isCollapsed()?"":a+n.serializer.serialize(i,e)+s,n.editor.fire("GetContent",e),e.content)},setContent:function(e,t){var n=this,r=n.getRng(),i,o=n.win.document,a,s;if(t=t||{format:"html"},t.set=!0,t.selection=!0,e=t.content=e,t.no_events||n.editor.fire("BeforeSetContent",t),e=t.content,r.insertNode){e+='_',r.startContainer==o&&r.endContainer==o?o.body.innerHTML=e:(r.deleteContents(),0===o.body.childNodes.length?o.body.innerHTML=e:r.createContextualFragment?r.insertNode(r.createContextualFragment(e)):(a=o.createDocumentFragment(),s=o.createElement("div"),a.appendChild(s),s.outerHTML=e,r.insertNode(a))),i=n.dom.get("__caret"),r=o.createRange(),r.setStartBefore(i),r.setEndBefore(i),n.setRng(r),n.dom.remove("__caret");try{n.setRng(r)}catch(l){}}else r.item&&(o.execCommand("Delete",!1,null),r=n.getRng()),/^\s+/.test(e)?(r.pasteHTML('_'+e),n.dom.remove("__mce_tmp")):r.pasteHTML(e);t.no_events||n.editor.fire("SetContent",t)},getStart:function(e){var t=this,n=t.getRng(),r,i,o,a;if(n.duplicate||n.item){if(n.item)return n.item(0);for(o=n.duplicate(),o.collapse(1),r=o.parentElement(),r.ownerDocument!==t.dom.doc&&(r=t.dom.getRoot()),i=a=n.parentElement();a=a.parentNode;)if(a==r){r=i;break}return r}return r=n.startContainer,1==r.nodeType&&r.hasChildNodes()&&(e&&n.collapsed||(r=r.childNodes[Math.min(r.childNodes.length-1,n.startOffset)])),r&&3==r.nodeType?r.parentNode:r},getEnd:function(e){var t=this,n=t.getRng(),r,i;return n.duplicate||n.item?n.item?n.item(0):(n=n.duplicate(),n.collapse(0),r=n.parentElement(),r.ownerDocument!==t.dom.doc&&(r=t.dom.getRoot()),r&&"BODY"==r.nodeName?r.lastChild||r:r):(r=n.endContainer,i=n.endOffset,1==r.nodeType&&r.hasChildNodes()&&(e&&n.collapsed||(r=r.childNodes[i>0?i-1:i])),r&&3==r.nodeType?r.parentNode:r)},getBookmark:function(e,t){return this.bookmarkManager.getBookmark(e,t)},moveToBookmark:function(e){return this.bookmarkManager.moveToBookmark(e)},select:function(e,t){var n=this,r=n.dom,i=r.createRng(),o;if(n.lastFocusBookmark=null,e){if(!t&&n.controlSelection.controlSelect(e))return;o=r.nodeIndex(e),i.setStart(e.parentNode,o),i.setEnd(e.parentNode,o+1),t&&(n._moveEndPoint(i,e,!0),n._moveEndPoint(i,e)),n.setRng(i)}return e},isCollapsed:function(){var e=this,t=e.getRng(),n=e.getSel();return!t||t.item?!1:t.compareEndPoints?0===t.compareEndPoints("StartToEnd",t):!n||t.collapsed},collapse:function(e){var t=this,n=t.getRng(),r;n.item&&(r=n.item(0),n=t.win.document.body.createTextRange(),n.moveToElementText(r)),n.collapse(!!e),t.setRng(n)},getSel:function(){var e=this.win;return e.getSelection?e.getSelection():e.document.selection},getRng:function(e){function t(e,t,n){try{return t.compareBoundaryPoints(e,n)}catch(r){return-1}}var n=this,r,i,o,a=n.win.document,s;if(!e&&n.lastFocusBookmark){var l=n.lastFocusBookmark;return l.startContainer?(i=a.createRange(),i.setStart(l.startContainer,l.startOffset),i.setEnd(l.endContainer,l.endOffset)):i=l,i}if(e&&n.tridentSel)return n.tridentSel.getRangeAt(0);try{(r=n.getSel())&&(i=r.rangeCount>0?r.getRangeAt(0):r.createRange?r.createRange():a.createRange())}catch(c){}if(d&&i&&i.setStart&&a.selection){try{s=a.selection.createRange()}catch(c){}s&&s.item&&(o=s.item(0),i=a.createRange(),i.setStartBefore(o),i.setEndAfter(o))}return i||(i=a.createRange?a.createRange():a.body.createTextRange()),i.setStart&&9===i.startContainer.nodeType&&i.collapsed&&(o=n.dom.getRoot(),i.setStart(o,0),i.setEnd(o,0)),n.selectedRange&&n.explicitRange&&(0===t(i.START_TO_START,i,n.selectedRange)&&0===t(i.END_TO_END,i,n.selectedRange)?i=n.explicitRange:(n.selectedRange=null,n.explicitRange=null)),i},setRng:function(e,t){var n=this,r;if(e)if(e.select)try{e.select()}catch(i){}else if(n.tridentSel){if(e.cloneRange)try{return void n.tridentSel.addRange(e)}catch(i){}}else if(r=n.getSel()){n.explicitRange=e;try{r.removeAllRanges(),r.addRange(e)}catch(i){}t===!1&&r.extend&&(r.collapse(e.endContainer,e.endOffset),r.extend(e.startContainer,e.startOffset)),n.selectedRange=r.rangeCount>0?r.getRangeAt(0):null}},setNode:function(e){var t=this;return t.setContent(t.dom.getOuterHTML(e)),e},getNode:function(){function e(e,t){for(var n=e;e&&3===e.nodeType&&0===e.length;)e=t?e.nextSibling:e.previousSibling;return e||n}var t=this,n=t.getRng(),r,i=n.startContainer,o=n.endContainer,a=n.startOffset,s=n.endOffset,l=t.dom.getRoot();return n?n.setStart?(r=n.commonAncestorContainer,!n.collapsed&&(i==o&&2>s-a&&i.hasChildNodes()&&(r=i.childNodes[a]),3===i.nodeType&&3===o.nodeType&&(i=i.length===a?e(i.nextSibling,!0):i.parentNode,o=0===s?e(o.previousSibling,!1):o.parentNode,i&&i===o))?i:r&&3==r.nodeType?r.parentNode:r):(r=n.item?n.item(0):n.parentElement(),r.ownerDocument!==t.win.document&&(r=l),r):l},getSelectedBlocks:function(t,n){var r=this,i=r.dom,o,a,s=[];if(a=i.getRoot(),t=i.getParent(t||r.getStart(),i.isBlock),n=i.getParent(n||r.getEnd(),i.isBlock),t&&t!=a&&s.push(t),t&&n&&t!=n){o=t;for(var l=new e(t,a);(o=l.next())&&o!=n;)i.isBlock(o)&&s.push(o)}return n&&t!=n&&n!=a&&s.push(n),s},isForward:function(){var e=this.dom,t=this.getSel(),n,r;return t&&t.anchorNode&&t.focusNode?(n=e.createRng(),n.setStart(t.anchorNode,t.anchorOffset),n.collapse(!0),r=e.createRng(),r.setStart(t.focusNode,t.focusOffset),r.collapse(!0),n.compareBoundaryPoints(n.START_TO_START,r)<=0):!0},normalize:function(){var e=this,t=e.getRng();return a.range&&new i(e.dom).normalize(t)&&e.setRng(t,e.isForward()),t},selectorChanged:function(e,t){var n=this,r;return n.selectorChangedData||(n.selectorChangedData={},r={},n.editor.on("NodeChange",function(e){var t=e.element,i=n.dom,o=i.getParents(t,null,i.getRoot()),a={};c(n.selectorChangedData,function(e,t){c(o,function(n){return i.is(n,t)?(r[t]||(c(e,function(e){e(!0,{node:n,selector:t,parents:o})}),r[t]=e),a[t]=e,!1):void 0})}),c(r,function(e,n){a[n]||(delete r[n],c(e,function(e){e(!1,{node:t,selector:n,parents:o})}))})})),n.selectorChangedData[e]||(n.selectorChangedData[e]=[]),n.selectorChangedData[e].push(t),n},getScrollContainer:function(){for(var e,t=this.dom.getRoot();t&&"BODY"!=t.nodeName;){if(t.scrollHeight>t.clientHeight){e=t;break}t=t.parentNode}return e},scrollIntoView:function(e){function t(e){for(var t=0,n=0,r=e;r&&r.nodeType;)t+=r.offsetLeft||0,n+=r.offsetTop||0,r=r.offsetParent;return{x:t,y:n}}var n,r,i=this,o=i.dom,a=o.getRoot(),s,l;if("BODY"!=a.nodeName){var c=i.getScrollContainer();if(c)return n=t(e).y-t(c).y,l=c.clientHeight,s=c.scrollTop,void((s>n||n+25>s+l)&&(c.scrollTop=s>n?n:n-l+25))}r=o.getViewPort(i.editor.getWin()),n=o.getPos(e).y,s=r.y,l=r.h,(ns+l)&&i.editor.getWin().scrollTo(0,s>n?n:n-l+25)},placeCaretAt:function(e,t){var n=this.editor.getDoc(),r,i;if(n.caretPositionFromPoint)i=n.caretPositionFromPoint(e,t),r=n.createRange(),r.setStart(i.offsetNode,i.offset),r.collapse(!0);else if(n.caretRangeFromPoint)r=n.caretRangeFromPoint(e,t);else if(n.body.createTextRange){r=n.body.createTextRange();try{r.moveToPoint(e,t),r.collapse(!0)}catch(o){r.collapse(t=e;e++)a.addShortcut("access+"+e,"",["FormatBlock",!1,"h"+e]);a.addShortcut("access+7","",["FormatBlock",!1,"p"]),a.addShortcut("access+8","",["FormatBlock",!1,"div"]),a.addShortcut("access+9","",["FormatBlock",!1,"address"])}function p(e){return e?U[e]:U}function h(e,t){e&&("string"!=typeof e?se(e,function(e,t){h(t,e)}):(t=t.length?t:[t],se(t,function(e){e.deep===ne&&(e.deep=!e.selector),e.split===ne&&(e.split=!e.selector||e.inline),e.remove===ne&&e.selector&&!e.inline&&(e.remove="none"),e.selector&&e.inline&&(e.mixed=!0,e.block_expand=!0),"string"==typeof e.classes&&(e.classes=e.classes.split(/\s+/))}),U[e]=t))}function m(e){return e&&U[e]&&delete U[e],U}function g(e){var t;return a.dom.getParent(e,function(e){return t=a.dom.getStyle(e,"text-decoration"),t&&"none"!==t}),t}function v(e){var t;1===e.nodeType&&e.parentNode&&1===e.parentNode.nodeType&&(t=g(e.parentNode),a.dom.getStyle(e,"color")&&t?a.dom.setStyle(e,"text-decoration",t):a.dom.getStyle(e,"text-decoration")===t&&a.dom.setStyle(e,"text-decoration",null))}function y(t,n,r){function i(e,t){if(t=t||d,e){if(t.onformat&&t.onformat(e,t,n,r),se(t.styles,function(t,r){$.setStyle(e,r,B(t,n))}),t.styles){var i=$.getAttrib(e,"style");i&&e.setAttribute("data-mce-style",i)}se(t.attributes,function(t,r){$.setAttrib(e,r,B(t,n))}),se(t.classes,function(t){t=B(t,n),$.hasClass(e,t)||$.addClass(e,t)})}}function o(){function t(t,n){var i=new e(n);for(r=i.current();r;r=i.prev())if(r.childNodes.length>1||r==t||"BR"==r.tagName)return r}var n=a.selection.getRng(),i=n.startContainer,o=n.endContainer;if(i!=o&&0===n.endOffset){var s=t(i,o),l=3==s.nodeType?s.length:s.childNodes.length;n.setEnd(s,l)}return n}function l(e,r,o){var a=[],l,f,p=!0;l=d.inline||d.block,f=$.create(l),i(f),j.walk(e,function(e){function r(e){var g,v,y,b,C;return C=p,g=e.nodeName.toLowerCase(),v=e.parentNode.nodeName.toLowerCase(),1===e.nodeType&&re(e)&&(C=p,p="true"===re(e),b=!0),T(g,"br")?(h=0,void(d.block&&$.remove(e))):d.wrapper&&x(e,t,n)?void(h=0):p&&!b&&d.block&&!d.wrapper&&s(g)&&K(v,l)?(e=$.rename(e,l),i(e),a.push(e),void(h=0)):d.selector&&(se(c,function(t){"collapsed"in t&&t.collapsed!==m||$.is(e,t.selector)&&!u(e)&&(i(e,t),y=!0)}),!d.inline||y)?void(h=0):void(!p||b||!K(l,g)||!K(v,l)||!o&&3===e.nodeType&&1===e.nodeValue.length&&65279===e.nodeValue.charCodeAt(0)||u(e)||d.inline&&Y(e)?(h=0,se(le(e.childNodes),r),b&&(p=C),h=0):(h||(h=$.clone(f,Z),e.parentNode.insertBefore(h,e),a.push(h)),h.appendChild(e)))}var h;se(e,r)}),d.links===!0&&se(a,function(e){function t(e){"A"===e.nodeName&&i(e,d),se(le(e.childNodes),t)}t(e)}),se(a,function(e){function r(e){var t=0;return se(e.childNodes,function(e){D(e)||ae(e)||t++}),t}function o(e){var t,n;return se(e.childNodes,function(e){return 1!=e.nodeType||ae(e)||u(e)?void 0:(t=e,Z)}),t&&!ae(t)&&S(t,d)&&(n=$.clone(t,Z),i(n),$.replace(n,e,ee),$.remove(t,1)),n||e}var s;if(s=r(e),(a.length>1||!Y(e))&&0===s)return void $.remove(e,1);if(d.inline||d.wrapper){if(d.exact||1!==s||(e=o(e)),se(c,function(t){se($.select(t.inline,e),function(e){ae(e)||P(t,n,e,t.exact?e:null)})}),x(e.parentNode,t,n))return $.remove(e,1),e=0,ee;d.merge_with_parents&&$.getParent(e.parentNode,function(r){return x(r,t,n)?($.remove(e,1),e=0,ee):void 0}),e&&d.merge_siblings!==!1&&(e=F(I(e),e),e=F(e,I(e,ee)))}})}var c=p(t),d=c[0],f,h,m=!r&&q.isCollapsed();if(d)if(r)r.nodeType?(h=$.createRng(),h.setStartBefore(r),h.setEndAfter(r),l(H(h,c),null,!0)):l(r,null,!0);else if(m&&d.inline&&!$.select("td.mce-item-selected,th.mce-item-selected").length)W("apply",t,n);else{var g=a.selection.getNode();G||!c[0].defaultBlock||$.getParent(g,$.isBlock)||y(c[0].defaultBlock),a.selection.setRng(o()),f=q.getBookmark(),l(H(q.getRng(ee),c),f),d.styles&&(d.styles.color||d.styles.textDecoration)&&(ce(g,v,"childNodes"),v(g)),q.moveToBookmark(f),V(q.getRng(ee)),a.nodeChanged()}}function b(e,t,n,r){function i(e){var n,r,o,a,s;if(1===e.nodeType&&re(e)&&(a=b,b="true"===re(e),s=!0),n=le(e.childNodes),b&&!s)for(r=0,o=h.length;o>r&&!P(h[r],t,e,e);r++);if(m.deep&&n.length){for(r=0,o=n.length;o>r;r++)i(n[r]);s&&(b=a)}}function o(n){var i;return se(c(n.parentNode).reverse(),function(n){var o;i||"_start"==n.id||"_end"==n.id||(o=x(n,e,t,r),o&&o.split!==!1&&(i=n))}),i}function s(e,n,r,i){var o,a,s,l,c,u;if(e){for(u=e.parentNode,o=n.parentNode;o&&o!=u;o=o.parentNode){for(a=$.clone(o,Z),c=0;c=0;o--){if(a=t[o].selector,!a||t[o].defaultBlock)return ee;for(i=r.length-1;i>=0;i--)if($.is(r[i],a))return ee}return Z}function N(e,t,n){var r;return te||(te={},r={},a.on("NodeChange",function(e){var t=c(e.element),n={};t=i.grep(t,function(e){return 1==e.nodeType&&!e.getAttribute("data-mce-bogus")}),se(te,function(e,i){se(t,function(o){return x(o,i,{},e.similar)?(r[i]||(se(e,function(e){e(!0,{node:o,format:i,parents:t})}),r[i]=e),n[i]=e,!1):void 0})}),se(r,function(i,o){n[o]||(delete r[o],se(i,function(n){n(!1,{node:e.element,format:o,parents:t})}))})})),se(e.split(","),function(e){te[e]||(te[e]=[],te[e].similar=n),te[e].push(t)}),this}function k(e){return o.getCssText(a,e)}function S(e,t){return T(e,t.inline)?ee:T(e,t.block)?ee:t.selector?1==e.nodeType&&$.is(e,t.selector):void 0}function T(e,t){return e=e||"",t=t||"",e=""+(e.nodeName||e),t=""+(t.nodeName||t),e.toLowerCase()==t.toLowerCase()}function R(e,t){return A($.getStyle(e,t),t)}function A(e,t){return("color"==t||"backgroundColor"==t)&&(e=$.toHex(e)),"fontWeight"==t&&700==e&&(e="bold"),"fontFamily"==t&&(e=e.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),""+e}function B(e,t){return"string"!=typeof e?e=e(t):t&&(e=e.replace(/%(\w+)/g,function(e,n){return t[n]||e})),e}function D(e){return e&&3===e.nodeType&&/^([\t \r\n]+|)$/.test(e.nodeValue)}function M(e,t,n){var r=$.create(t,n);return e.parentNode.insertBefore(r,e),r.appendChild(e),r}function H(t,n,r){function i(e){function t(e){return"BR"==e.nodeName&&e.getAttribute("data-mce-bogus")&&!e.nextSibling}var r,i,o,a,s;if(r=i=e?g:y,a=e?"previousSibling":"nextSibling",s=$.getRoot(),3==r.nodeType&&!D(r)&&(e?v>0:bo?n:o,-1===n||r||n++):(n=a.indexOf(" ",t),o=a.indexOf("\xa0",t),n=-1!==n&&(-1===o||o>n)?n:o),n}var s,l,c,u;if(3===t.nodeType){if(c=o(t,n),-1!==c)return{container:t,offset:c};u=t}for(s=new e(t,$.getParent(t,Y)||a.getBody());l=s[i?"prev":"next"]();)if(3===l.nodeType){if(u=l,c=o(l),-1!==c)return{container:l,offset:c}}else if(Y(l))break;return u?(n=i?0:u.length,{container:u,offset:n}):void 0}function d(e,r){var i,o,a,s;for(3==e.nodeType&&0===e.nodeValue.length&&e[r]&&(e=e[r]),i=c(e),o=0;op?p:v],3==g.nodeType&&(v=0)),1==y.nodeType&&y.hasChildNodes()&&(p=y.childNodes.length-1,y=y.childNodes[b>p?p:b-1],3==y.nodeType&&(b=y.nodeValue.length)),g=l(g),y=l(y),(ae(g.parentNode)||ae(g))&&(g=ae(g)?g:g.parentNode,g=g.nextSibling||g,3==g.nodeType&&(v=0)),(ae(y.parentNode)||ae(y))&&(y=ae(y)?y:y.parentNode,y=y.previousSibling||y,3==y.nodeType&&(b=y.length)),n[0].inline&&(t.collapsed&&(m=u(g,v,!0),m&&(g=m.container,v=m.offset),m=u(y,b),m&&(y=m.container,b=m.offset)),h=o(y,b),h.node)){for(;h.node&&0===h.offset&&h.node.previousSibling;)h=o(h.node.previousSibling);h.node&&h.offset>0&&3===h.node.nodeType&&" "===h.node.nodeValue.charAt(h.offset-1)&&h.offset>1&&(y=h.node,y.splitText(h.offset-1))}return(n[0].inline||n[0].block_expand)&&(n[0].inline&&3==g.nodeType&&0!==v||(g=i(!0)),n[0].inline&&3==y.nodeType&&b!==y.nodeValue.length||(y=i())),n[0].selector&&n[0].expand!==Z&&!n[0].inline&&(g=d(g,"previousSibling"),y=d(y,"nextSibling")),(n[0].block||n[0].selector)&&(g=f(g,"previousSibling"),y=f(y,"nextSibling"),n[0].block&&(Y(g)||(g=i(!0)),Y(y)||(y=i()))),1==g.nodeType&&(v=X(g),g=g.parentNode),1==y.nodeType&&(b=X(y)+1,y=y.parentNode),{startContainer:g,startOffset:v,endContainer:y,endOffset:b}}function L(e,t){return t.links&&"A"==e.tagName}function P(e,t,n,r){var i,o,a;if(!S(n,e)&&!L(n,e))return Z;if("all"!=e.remove)for(se(e.styles,function(i,o){i=A(B(i,t),o),"number"==typeof o&&(o=i,r=0),(e.remove_similar||!r||T(R(r,o),i))&&$.setStyle(n,o,""),a=1}),a&&""===$.getAttrib(n,"style")&&(n.removeAttribute("style"),n.removeAttribute("data-mce-style")),se(e.attributes,function(e,i){var o;if(e=B(e,t),"number"==typeof i&&(i=e,r=0),!r||T($.getAttrib(r,i),e)){if("class"==i&&(e=$.getAttrib(n,i),e&&(o="",se(e.split(/\s+/),function(e){/mce\-\w+/.test(e)&&(o+=(o?" ":"")+e)}),o)))return void $.setAttrib(n,i,o);"class"==i&&n.removeAttribute("className"),Q.test(i)&&n.removeAttribute("data-mce-"+i),n.removeAttribute(i)}}),se(e.classes,function(e){e=B(e,t),(!r||$.hasClass(r,e))&&$.removeClass(n,e)}),o=$.getAttribs(n),i=0;io?o:i]),3===r.nodeType&&n&&i>=r.nodeValue.length&&(r=new e(r,a.getBody()).next()||r),3!==r.nodeType||n||0!==i||(r=new e(r,a.getBody()).prev()||r),r}function W(t,n,r,i){function o(e){var t=$.create("span",{id:g,"data-mce-bogus":!0,style:v?"color:red":""});return e&&t.appendChild(a.getDoc().createTextNode(J)),t}function l(e,t){for(;e;){if(3===e.nodeType&&e.nodeValue!==J||e.childNodes.length>1)return!1;t&&1===e.nodeType&&t.push(e),e=e.firstChild}return!0}function c(e){for(;e;){if(e.id===g)return e;e=e.parentNode}}function u(t){var n;if(t)for(n=new e(t,t),t=n.current();t;t=n.next())if(3===t.nodeType)return t}function d(e,t){var n,r;if(e)r=q.getRng(!0),l(e)?(t!==!1&&(r.setStartBefore(e),r.setEndBefore(e)),$.remove(e)):(n=u(e),n.nodeValue.charAt(0)===J&&(n.deleteData(0,1),r.startContainer==n&&r.startOffset>0&&r.setStart(n,r.startOffset-1),r.endContainer==n&&r.endOffset>0&&r.setEnd(n,r.endOffset-1)),$.remove(e,1)),q.setRng(r);else if(e=c(q.getStart()),!e)for(;e=$.get(g);)d(e,!1)}function f(){var e,t,i,a,s,l,d;e=q.getRng(!0),a=e.startOffset,l=e.startContainer,d=l.nodeValue,t=c(q.getStart()),t&&(i=u(t)),d&&a>0&&a=0;h--)u.appendChild($.clone(f[h],!1)),u=u.firstChild;u.appendChild($.doc.createTextNode(J)),u=u.firstChild;var g=$.getParent(d,s);g&&$.isEmpty(g)?d.parentNode.replaceChild(m,d):$.insertAfter(m,d),q.setCursorLocation(u,1),$.isEmpty(d)&&$.remove(d)}}function m(){var e;e=c(q.getStart()),e&&!$.isEmpty(e)&&ce(e,function(e){1!=e.nodeType||e.id===g||$.isEmpty(e)||$.setAttrib(e,"data-mce-bogus",null)},"childNodes")}var g="_mce_caret",v=a.settings.caret_debug;a._hasCaretEvents||(oe=function(){var e=[],t;if(l(c(q.getStart()),e))for(t=e.length;t--;)$.setAttrib(e[t],"data-mce-bogus","1")},ie=function(e){var t=e.keyCode;d(),(8==t&&q.isCollapsed()||37==t||39==t)&&d(c(q.getStart())),m()},a.on("SetContent",function(e){e.selection&&m()}),a._hasCaretEvents=!0),"apply"==t?f():h()}function V(t){var n=t.startContainer,r=t.startOffset,i,o,a,s,l;if(3==n.nodeType&&r>=n.nodeValue.length&&(r=X(n),n=n.parentNode,i=!0),1==n.nodeType)for(s=n.childNodes,n=s[Math.min(r,s.length-1)],o=new e(n,$.getParent(n,$.isBlock)),(r>s.length-1||i)&&o.next(),a=o.current();a;a=o.next())if(3==a.nodeType&&!D(a))return l=$.create("a",{"data-mce-bogus":"all"},J),a.parentNode.insertBefore(l,a),t.setStart(a,0),q.setRng(t),void $.remove(l)}var U={},$=a.dom,q=a.selection,j=new t($),K=a.schema.isValidChild,Y=$.isBlock,G=a.settings.forced_root_block,X=$.nodeIndex,J="\ufeff",Q=/^(src|href|style)$/,Z=!1,ee=!0,te,ne,re=$.getContentEditable,ie,oe,ae=n.isBookmarkNode,se=i.each,le=i.grep,ce=i.walk,ue=i.extend;ue(this,{get:p,register:h,unregister:m,apply:y,remove:b,toggle:C,match:w,matchAll:_,matchNode:x,canApply:E,formatChanged:N,getCssText:k}),d(),f(),a.on("BeforeGetContent",function(e){oe&&"raw"!=e.format&&oe()}),a.on("mouseup keydown",function(e){ie&&ie(e)})}}),r(I,[B,u,d,N],function(e,t,n,r){var i=n.trim,o;return o=new RegExp(["]+data-mce-bogus[^>]+>[\u200b\ufeff]+<\\/span>",'\\s?data-mce-selected="[^"]+"'].join("|"),"gi"),function(e){function n(){var t=e.getContent({format:"raw",no_events:1}),n=/<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g,a,s,l,c,u,d=e.schema;for(t=t.replace(o,""),u=d.getShortEndedElements();c=n.exec(t);)s=n.lastIndex,l=c[0].length,a=u[c[1]]?s:r.findEndTag(d,t,s),t=t.substring(0,s-l)+t.substring(a),n.lastIndex=s-l;return i(t)}function a(t){e.isNotDirty=!t}function s(e){l.typing=!1,l.add({},e)}var l=this,c=0,u=[],d,f,p=0;return e.on("init",function(){l.add()}),e.on("BeforeExecCommand",function(e){var t=e.command;"Undo"!=t&&"Redo"!=t&&"mceRepaint"!=t&&l.beforeChange()}),e.on("ExecCommand",function(e){var t=e.command;"Undo"!=t&&"Redo"!=t&&"mceRepaint"!=t&&s(e)}),e.on("ObjectResizeStart",function(){l.beforeChange()}),e.on("SaveContent ObjectResized blur",s),e.on("DragEnd",s),e.on("KeyUp",function(r){var i=r.keyCode;(i>=33&&36>=i||i>=37&&40>=i||45==i||13==i||r.ctrlKey)&&(s(),e.nodeChanged()),(46==i||8==i||t.mac&&(91==i||93==i))&&e.nodeChanged(),f&&l.typing&&(e.isDirty()||(a(u[0]&&n()!=u[0].content),e.isNotDirty||e.fire("change",{level:u[0],lastLevel:null})),e.fire("TypingUndo"),f=!1,e.nodeChanged())}),e.on("KeyDown",function(e){var t=e.keyCode;if(t>=33&&36>=t||t>=37&&40>=t||45==t)return void(l.typing&&s(e));var n=e.ctrlKey&&!e.altKey||e.metaKey;!(16>t||t>20)||224==t||91==t||l.typing||n||(l.beforeChange(),l.typing=!0,l.add({},e),f=!0)}),e.on("MouseDown",function(e){l.typing&&s(e)}),e.addShortcut("meta+z","","Undo"),e.addShortcut("meta+y,meta+shift+z","","Redo"),e.on("AddUndo Undo Redo ClearUndos",function(t){t.isDefaultPrevented()||e.nodeChanged()}),l={data:u,typing:!1,beforeChange:function(){p||(d=e.selection.getBookmark(2,!0))},add:function(t,r){var i,o=e.settings,s;if(t=t||{},t.content=n(),p||e.removed)return null;if(s=u[c],e.fire("BeforeAddUndo",{level:t,lastLevel:s,originalEvent:r}).isDefaultPrevented())return null;if(s&&s.content==t.content)return null;if(u[c]&&(u[c].beforeBookmark=d),o.custom_undo_redo_levels&&u.length>o.custom_undo_redo_levels){for(i=0;i0&&(a(!0),e.fire("change",l)),t},undo:function(){var t;return l.typing&&(l.add(),l.typing=!1),c>0&&(t=u[--c],0===c&&a(!1),e.setContent(t.content,{format:"raw"}),e.selection.moveToBookmark(t.beforeBookmark),e.fire("undo",{level:t})),t},redo:function(){var t;return c0||l.typing&&u[0]&&n()!=u[0].content},hasRedo:function(){return cD)&&(u=a.create("br"),t.parentNode.insertBefore(u,t)),l.setStartBefore(t),l.setEndBefore(t)):(l.setStartAfter(t),l.setEndAfter(t)):(l.setStart(t,0),l.setEnd(t,0));s.setRng(l),a.remove(u),s.scrollIntoView(t)}}function v(e){var t=l.forced_root_block;t&&t.toLowerCase()===e.tagName.toLowerCase()&&a.setAttribs(e,l.forced_root_block_attrs)}function y(e){var t=R,n,i,o,s=u.getTextInlineElements();if(e||"TABLE"==O?(n=a.create(e||F),v(n)):n=B.cloneNode(!1),o=n,l.keep_styles!==!1)do if(s[t.nodeName]){if("_mce_caret"==t.id)continue;i=t.cloneNode(!1),a.setAttrib(i,"id",""),n.hasChildNodes()?(i.appendChild(n.firstChild),n.appendChild(i)):(o=i,n.appendChild(i))}while(t=t.parentNode);return r||(o.innerHTML='
    '),n}function b(t){var n,r,i;if(3==R.nodeType&&(t?A>0:AR.childNodes.length-1,R=R.childNodes[Math.min(A,R.childNodes.length-1)]||R,A=z&&3==R.nodeType?R.nodeValue.length:0),T=E(R)){if(c.beforeChange(),!a.isBlock(T)&&T!=a.getRoot())return void((!F||M)&&w());if((F&&!M||!F&&M)&&(R=C(R,A)),B=a.getParent(R,a.isBlock),P=B?a.getParent(B.parentNode,a.isBlock):null,O=B?B.nodeName.toUpperCase():"",I=P?P.nodeName.toUpperCase():"","LI"!=I||o.ctrlKey||(B=P,O=I),/^(LI|DT|DD)$/.test(O)){if(!F&&M)return void w();if(a.isEmpty(B))return void x()}if("PRE"==O&&l.br_in_pre!==!1){if(!M)return void w()}else if(!F&&!M&&"LI"!=O||F&&M)return void w();F&&B===i.getBody()||(F=F||"P",b()?(H=/^(H[1-6]|PRE|FIGURE)$/.test(O)&&"HGROUP"!=I?y(F):y(),l.end_container_on_empty_block&&p(P)&&a.isEmpty(B)?H=a.split(P,B):a.insertAfter(H,B),g(H)):b(!0)?(H=B.parentNode.insertBefore(y(),B),h(H),g(B)):(S=k.cloneRange(),S.setEndAfter(B),L=S.extractContents(),_(L),H=L.firstChild,a.insertAfter(L,B),m(H),N(B),g(H)),a.setAttrib(H,"id",""),i.fire("NewBlock",{newBlock:H}),c.add())}}}var a=i.dom,s=i.selection,l=i.settings,c=i.undoManager,u=i.schema,d=u.getNonEmptyElements(),f=u.getMoveCaretBeforeOnEnterElements();i.on("keydown",function(e){13==e.keyCode&&o(e)!==!1&&e.preventDefault()})}}),r(z,[],function(){return function(e){function t(){var t=i.getStart(),s=e.getBody(),l,c,u,d,f,p,h,m=-16777215,g,v,y,b,C;if(C=n.forced_root_block,t&&1===t.nodeType&&C){for(;t&&t!=s;){if(a[t.nodeName])return;t=t.parentNode}if(l=i.getRng(),l.setStart){c=l.startContainer,u=l.startOffset,d=l.endContainer,f=l.endOffset;try{v=e.getDoc().activeElement===s}catch(x){}}else l.item&&(t=l.item(0),l=e.getDoc().body.createTextRange(),l.moveToElementText(t)),v=l.parentElement().ownerDocument===e.getDoc(),y=l.duplicate(),y.collapse(!0),u=-1*y.move("character",m),y.collapsed||(y=l.duplicate(),y.collapse(!1),f=-1*y.move("character",m)-u);for(t=s.firstChild,b=s.nodeName.toLowerCase();t;)if((3===t.nodeType||1==t.nodeType&&!a[t.nodeName])&&o.isValidChild(b,C.toLowerCase())){if(3===t.nodeType&&0===t.nodeValue.length){h=t,t=t.nextSibling,r.remove(h);continue}p||(p=r.create(C,e.settings.forced_root_block_attrs),t.parentNode.insertBefore(p,t),g=!0),h=t,t=t.nextSibling,p.appendChild(h)}else p=null,t=t.nextSibling;if(g&&v){if(l.setStart)l.setStart(c,u),l.setEnd(d,f),i.setRng(l);else try{l=e.getDoc().body.createTextRange(),l.moveToElementText(s),l.collapse(!0),l.moveStart("character",u),f>0&&l.moveEnd("character",f),l.select()}catch(x){}e.nodeChanged()}}}var n=e.settings,r=e.dom,i=e.selection,o=e.schema,a=o.getBlockElements();n.forced_root_block&&e.on("NodeChange",t)}}),r(W,[T,u,d,L,x,h],function(e,n,r,i,o,a){var s=r.each,l=r.extend,c=r.map,u=r.inArray,d=r.explode,f=n.gecko,p=n.ie,h=n.ie&&n.ie<11,m=!0,g=!1;return function(r){function v(e,t,n,i){var o,a,c=0;if(/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(e)||i&&i.skip_focus||r.focus(),i=l({},i),i=r.fire("BeforeExecCommand",{command:e,ui:t,value:n}),i.isDefaultPrevented())return!1;if(a=e.toLowerCase(),o=H.exec[a])return o(a,t,n),r.fire("ExecCommand",{command:e,ui:t,value:n}),!0;if(s(r.plugins,function(i){return i.execCommand&&i.execCommand(e,t,n)?(r.fire("ExecCommand",{command:e,ui:t,value:n}),c=!0,!1):void 0}),c)return c;if(r.theme&&r.theme.execCommand&&r.theme.execCommand(e,t,n))return r.fire("ExecCommand",{command:e,ui:t,value:n}),!0;try{c=r.getDoc().execCommand(e,t,n)}catch(u){}return c?(r.fire("ExecCommand",{command:e,ui:t,value:n}),!0):!1}function y(e){var t;if(!r._isHidden()){if(e=e.toLowerCase(),t=H.state[e])return t(e);try{return r.getDoc().queryCommandState(e)}catch(n){}return!1}}function b(e){var t;if(!r._isHidden()){if(e=e.toLowerCase(),t=H.value[e])return t(e);try{return r.getDoc().queryCommandValue(e)}catch(n){}}}function C(e,t){t=t||"exec",s(e,function(e,n){s(n.toLowerCase().split(","),function(n){H[t][n]=e})})}function x(e,t,n){e=e.toLowerCase(),H.exec[e]=function(e,i,o,a){return t.call(n||r,i,o,a)}}function w(e){if(e=e.toLowerCase(),H.exec[e])return!0;try{return r.getDoc().queryCommandSupported(e)}catch(t){}return!1}function _(e,t,n){e=e.toLowerCase(),H.state[e]=function(){return t.call(n||r)}}function E(e,t,n){e=e.toLowerCase(),H.value[e]=function(){return t.call(n||r)}}function N(e){return e=e.toLowerCase(),!!H.exec[e]}function k(e,n,i){return n===t&&(n=g),i===t&&(i=null),r.getDoc().execCommand(e,n,i)}function S(e){return M.match(e)}function T(e,n){M.toggle(e,n?{value:n}:t),r.nodeChanged()}function R(e){P=D.getBookmark(e)}function A(){D.moveToBookmark(P)}var B,D,M,H={state:{},exec:{},value:{}},L=r.settings,P;r.on("PreInit",function(){B=r.dom,D=r.selection,L=r.settings,M=r.formatter}),l(this,{execCommand:v,queryCommandState:y,queryCommandValue:b,queryCommandSupported:w,addCommands:C,addCommand:x,addQueryStateHandler:_,addQueryValueHandler:E,hasCustomCommand:N}),C({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){r.undoManager.add()},"Cut,Copy,Paste":function(e){var t=r.getDoc(),i;try{k(e)}catch(o){i=m}if(i||!t.queryCommandSupported(e)){var a=r.translate("Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.");n.mac&&(a=a.replace(/Ctrl\+/g,"\u2318+")),r.windowManager.alert(a)}},unlink:function(){if(D.isCollapsed()){var e=D.getNode();return void("A"==e.tagName&&r.dom.remove(e,!0))}M.remove("link")},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(e){var t=e.substring(7);"full"==t&&(t="justify"),s("left,center,right,justify".split(","),function(e){t!=e&&M.remove("align"+e)}),T("align"+t),v("mceRepaint")},"InsertUnorderedList,InsertOrderedList":function(e){var t,n;k(e),t=B.getParent(D.getNode(),"ol,ul"),t&&(n=t.parentNode,/^(H[1-6]|P|ADDRESS|PRE)$/.test(n.nodeName)&&(R(),B.split(n,t),A()))},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(e){T(e)},"ForeColor,HiliteColor,FontName":function(e,t,n){T(e,n)},FontSize:function(e,t,n){var r,i;n>=1&&7>=n&&(i=d(L.font_size_style_values),r=d(L.font_size_classes),n=r?r[n-1]||n:i[n-1]||n),T(e,n)},RemoveFormat:function(e){M.remove(e)},mceBlockQuote:function(){T("blockquote")},FormatBlock:function(e,t,n){return T(n||"p")},mceCleanup:function(){var e=D.getBookmark();r.setContent(r.getContent({cleanup:m}),{cleanup:m}),D.moveToBookmark(e)},mceRemoveNode:function(e,t,n){var i=n||D.getNode();i!=r.getBody()&&(R(),r.dom.remove(i,m),A())},mceSelectNodeDepth:function(e,t,n){var i=0;B.getParent(D.getNode(),function(e){return 1==e.nodeType&&i++==n?(D.select(e),g):void 0},r.getBody())},mceSelectNode:function(e,t,n){D.select(n)},mceInsertContent:function(t,n,o){function a(e){function t(e){return r[e]&&3==r[e].nodeType}var n,r,i;return n=D.getRng(!0),r=n.startContainer,i=n.startOffset,3==r.nodeType&&(i>0?e=e.replace(/^ /," "):t("previousSibling")||(e=e.replace(/^ /," ")),i|)$/," "):t("nextSibling")||(e=e.replace(/( | )(
    |)$/," "))),e}function l(){var e,t,n;e=D.getRng(!0),t=e.startContainer,n=e.startOffset,3==t.nodeType&&e.collapsed&&("\xa0"===t.data[n]?(t.deleteData(n,1),/[\u00a0| ]$/.test(o)||(o+=" ")):"\xa0"===t.data[n-1]&&(t.deleteData(n-1,1),/[\u00a0| ]$/.test(o)||(o=" "+o)))}function c(e){if(_)for(C=e.firstChild;C;C=C.walk(!0))E[C.name]&&C.attr("data-mce-new","true")}function u(){if(_){var e=r.getBody(),t=new i(B);s(B.select("*[data-mce-new]"),function(n){n.removeAttribute("data-mce-new");for(var r=n.parentNode;r&&r!=e;r=r.parentNode)t.compare(r,n)&&B.remove(n,!0)})}}var d,f,h,m,g,v,y,b,C,x,w,_,E=r.schema.getTextInlineElements();"string"!=typeof o&&(_=o.merge,o=o.content),/^ | $/.test(o)&&(o=a(o)),d=r.parser,f=new e({},r.schema),w='​',v={content:o,format:"html",selection:!0},r.fire("BeforeSetContent",v),o=v.content,-1==o.indexOf("{$caret}")&&(o+="{$caret}"),o=o.replace(/\{\$caret\}/,w),b=D.getRng();var N=b.startContainer||(b.parentElement?b.parentElement():null),k=r.getBody();N===k&&D.isCollapsed()&&B.isBlock(k.firstChild)&&B.isEmpty(k.firstChild)&&(b=B.createRng(),b.setStart(k.firstChild,0),b.setEnd(k.firstChild,0),D.setRng(b)),D.isCollapsed()||(r.getDoc().execCommand("Delete",!1,null),l()),h=D.getNode();var S={context:h.nodeName.toLowerCase()};if(g=d.parse(o,S),c(g),C=g.lastChild,"mce_marker"==C.attr("id"))for(y=C,C=C.prev;C;C=C.walk(!0))if(3==C.type||!B.isBlock(C.name)){r.schema.isValidChild(C.parent.name,"span")&&C.parent.insert(y,C,"br"===C.name);break}if(S.invalid){for(D.setContent(w),h=D.getNode(),m=r.getBody(),9==h.nodeType?h=C=m:C=h;C!==m;)h=C,C=C.parentNode;o=h==m?m.innerHTML:B.getOuterHTML(h),o=f.serialize(d.parse(o.replace(//i,function(){return f.serialize(g)}))),h==m?B.setHTML(m,o):B.setOuterHTML(h,o)}else o=f.serialize(g),C=h.firstChild,x=h.lastChild,!C||C===x&&"BR"===C.nodeName?B.setHTML(h,o):D.setContent(o);u(),y=B.get("mce_marker"),D.scrollIntoView(y),b=B.createRng(),C=y.previousSibling,C&&3==C.nodeType?(b.setStart(C,C.nodeValue.length),p||(x=y.nextSibling,x&&3==x.nodeType&&(C.appendData(x.data),x.parentNode.removeChild(x)))):(b.setStartBefore(y),b.setEndBefore(y)),B.remove(y),D.setRng(b),r.fire("SetContent",v),r.addVisual()},mceInsertRawHTML:function(e,t,n){D.setContent("tiny_mce_marker"),r.setContent(r.getContent().replace(/tiny_mce_marker/g,function(){return n}))},mceToggleFormat:function(e,t,n){T(n)},mceSetContent:function(e,t,n){r.setContent(n)},"Indent,Outdent":function(e){var t,n,i;t=L.indentation,n=/[a-z%]+$/i.exec(t),t=parseInt(t,10),y("InsertUnorderedList")||y("InsertOrderedList")?k(e):(L.forced_root_block||B.getParent(D.getNode(),B.isBlock)||M.apply("div"),s(D.getSelectedBlocks(),function(o){if("LI"!=o.nodeName){var a=r.getParam("indent_use_margin",!1)?"margin":"padding";a+="rtl"==B.getStyle(o,"direction",!0)?"Right":"Left","outdent"==e?(i=Math.max(0,parseInt(o.style[a]||0,10)-t),B.setStyle(o,a,i?i+n:"")):(i=parseInt(o.style[a]||0,10)+t+n,B.setStyle(o,a,i))}}))},mceRepaint:function(){if(f)try{R(m),D.getSel()&&D.getSel().selectAllChildren(r.getBody()),D.collapse(m),A()}catch(e){}},InsertHorizontalRule:function(){r.execCommand("mceInsertContent",!1,"
    ")},mceToggleVisualAid:function(){r.hasVisual=!r.hasVisual,r.addVisual()},mceReplaceContent:function(e,t,n){r.execCommand("mceInsertContent",!1,n.replace(/\{\$selection\}/g,D.getContent({format:"text"})))},mceInsertLink:function(e,t,n){var r;"string"==typeof n&&(n={href:n}),r=B.getParent(D.getNode(),"a"),n.href=n.href.replace(" ","%20"),r&&n.href||M.remove("link"),n.href&&M.apply("link",n,r)},selectAll:function(){var e=B.getRoot(),t;D.getRng().setStart?(t=B.createRng(),t.setStart(e,0),t.setEnd(e,e.childNodes.length),D.setRng(t)):(t=D.getRng(),t.item||(t.moveToElementText(e),t.select()))},"delete":function(){k("Delete");var e=r.getBody();B.isEmpty(e)&&(r.setContent(""),e.firstChild&&B.isBlock(e.firstChild)?r.selection.setCursorLocation(e.firstChild,0):r.selection.setCursorLocation(e,0))},mceNewDocument:function(){r.setContent("")},InsertLineBreak:function(e,t,n){function i(){for(var e=new a(p,v),t,n=r.schema.getNonEmptyElements();t=e.next();)if(n[t.nodeName.toLowerCase()]||t.length>0)return!0}var s=n,l,c,u,d=D.getRng(!0);new o(B).normalize(d);var f=d.startOffset,p=d.startContainer;if(1==p.nodeType&&p.hasChildNodes()){var g=f>p.childNodes.length-1;p=p.childNodes[Math.min(f,p.childNodes.length-1)]||p,f=g&&3==p.nodeType?p.nodeValue.length:0}var v=B.getParent(p,B.isBlock),y=v?v.nodeName.toUpperCase():"",b=v?B.getParent(v.parentNode,B.isBlock):null,C=b?b.nodeName.toUpperCase():"",x=s&&s.ctrlKey;"LI"!=C||x||(v=b,y=C),p&&3==p.nodeType&&f>=p.nodeValue.length&&(h||i()||(l=B.create("br"),d.insertNode(l),d.setStartAfter(l),d.setEndAfter(l),c=!0)),l=B.create("br"),d.insertNode(l);var w=B.doc.documentMode;return h&&"PRE"==y&&(!w||8>w)&&l.parentNode.insertBefore(B.doc.createTextNode("\r"),l),u=B.create("span",{}," "),l.parentNode.insertBefore(u,l),D.scrollIntoView(u),B.remove(u),c?(d.setStartBefore(l),d.setEndBefore(l)):(d.setStartAfter(l),d.setEndAfter(l)),D.setRng(d),r.undoManager.add(),m}}),C({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(e){var t="align"+e.substring(7),n=D.isCollapsed()?[B.getParent(D.getNode(),B.isBlock)]:D.getSelectedBlocks(),r=c(n,function(e){return!!M.matchNode(e,t)});return-1!==u(r,m)},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(e){return S(e)},mceBlockQuote:function(){return S("blockquote")},Outdent:function(){var e;if(L.inline_styles){if((e=B.getParent(D.getStart(),B.isBlock))&&parseInt(e.style.paddingLeft,10)>0)return m;if((e=B.getParent(D.getEnd(),B.isBlock))&&parseInt(e.style.paddingLeft,10)>0)return m}return y("InsertUnorderedList")||y("InsertOrderedList")||!L.inline_styles&&!!B.getParent(D.getNode(),"BLOCKQUOTE")},"InsertUnorderedList,InsertOrderedList":function(e){var t=B.getParent(D.getNode(),"ul,ol");return t&&("insertunorderedlist"===e&&"UL"===t.tagName||"insertorderedlist"===e&&"OL"===t.tagName)}},"state"),C({"FontSize,FontName":function(e){var t=0,n;return(n=B.getParent(D.getNode(),"span"))&&(t="fontsize"==e?n.style.fontSize:n.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()),t}},"value"),C({Undo:function(){r.undoManager.undo()},Redo:function(){r.undoManager.redo()}})}}),r(V,[d],function(e){function t(e,o){var a=this,s,l;if(e=r(e),o=a.settings=o||{},s=o.base_uri,/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e))return void(a.source=e);var c=0===e.indexOf("//");0!==e.indexOf("/")||c||(e=(s?s.protocol||"http":"http")+"://mce_host"+e),/^[\w\-]*:?\/\//.test(e)||(l=o.base_uri?o.base_uri.path:new t(location.href).directory,""===o.base_uri.protocol?e="//mce_host"+a.toAbsPath(l,e):(e=/([^#?]*)([#?]?.*)/.exec(e),e=(s&&s.protocol||"http")+"://mce_host"+a.toAbsPath(l,e[1])+e[2])),e=e.replace(/@@/g,"(mce_at)"),e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e),n(i,function(t,n){var r=e[n];r&&(r=r.replace(/\(mce_at\)/g,"@@")),a[t]=r}),s&&(a.protocol||(a.protocol=s.protocol),a.userInfo||(a.userInfo=s.userInfo),a.port||"mce_host"!==a.host||(a.port=s.port),a.host&&"mce_host"!==a.host||(a.host=s.host),a.source=""),c&&(a.protocol="")}var n=e.each,r=e.trim,i="source protocol authority userInfo user password host port relative path directory file query anchor".split(" "),o={ftp:21,http:80,https:443,mailto:25};return t.prototype={setPath:function(e){var t=this;e=/^(.*?)\/?(\w+)?$/.exec(e),t.path=e[0],t.directory=e[1],t.file=e[2],t.source="",t.getURI()},toRelative:function(e){var n=this,r;if("./"===e)return e;if(e=new t(e,{base_uri:n}),"mce_host"!=e.host&&n.host!=e.host&&e.host||n.port!=e.port||n.protocol!=e.protocol&&""!==e.protocol)return e.getURI();var i=n.getURI(),o=e.getURI();return i==o||"/"==i.charAt(i.length-1)&&i.substr(0,i.length-1)==o?i:(r=n.toRelPath(n.path,e.path),e.query&&(r+="?"+e.query),e.anchor&&(r+="#"+e.anchor),r)},toAbsolute:function(e,n){return e=new t(e,{base_uri:this}),e.getURI(n&&this.isSameOrigin(e))},isSameOrigin:function(e){if(this.host==e.host&&this.protocol==e.protocol){if(this.port==e.port)return!0;var t=o[this.protocol];if(t&&(this.port||t)==(e.port||t))return!0}return!1},toRelPath:function(e,t){var n,r=0,i="",o,a;if(e=e.substring(0,e.lastIndexOf("/")),e=e.split("/"),n=t.split("/"),e.length>=n.length)for(o=0,a=e.length;a>o;o++)if(o>=n.length||e[o]!=n[o]){r=o+1;break}if(e.lengtho;o++)if(o>=e.length||e[o]!=n[o]){r=o+1;break}if(1===r)return t;for(o=0,a=e.length-(r-1);a>o;o++)i+="../";for(o=r-1,a=n.length;a>o;o++)i+=o!=r-1?"/"+n[o]:n[o];return i},toAbsPath:function(e,t){var r,i=0,o=[],a,s;for(a=/\/$/.test(t)?"/":"",e=e.split("/"),t=t.split("/"),n(e,function(e){e&&o.push(e)}),e=o,r=t.length-1,o=[];r>=0;r--)0!==t[r].length&&"."!==t[r]&&(".."!==t[r]?i>0?i--:o.push(t[r]):i++);return r=e.length-i,s=0>=r?o.reverse().join("/"):e.slice(0,r).join("/")+"/"+o.reverse().join("/"),0!==s.indexOf("/")&&(s="/"+s),a&&s.lastIndexOf("/")!==s.length-1&&(s+=a),s},getURI:function(e){var t,n=this;return(!n.source||e)&&(t="",e||(t+=n.protocol?n.protocol+"://":"//",n.userInfo&&(t+=n.userInfo+"@"),n.host&&(t+=n.host),n.port&&(t+=":"+n.port)),n.path&&(t+=n.path),n.query&&(t+="?"+n.query),n.anchor&&(t+="#"+n.anchor),n.source=t),n.source}},t}),r(U,[d],function(e){function t(){}var n=e.each,r=e.extend,i,o;return t.extend=i=function(e){function t(){var e,t,n,r=this;if(!o&&(r.init&&r.init.apply(r,arguments),t=r.Mixins))for(e=t.length;e--;)n=t[e],n.init&&n.init.apply(r,arguments)}function a(){return this}function s(e,t){return function(){var n=this,r=n._super,i;return n._super=c[e],i=t.apply(n,arguments),n._super=r,i}}var l=this,c=l.prototype,u,d,f;o=!0,u=new l,o=!1,e.Mixins&&(n(e.Mixins,function(t){t=t;for(var n in t)"init"!==n&&(e[n]=t[n])}),c.Mixins&&(e.Mixins=c.Mixins.concat(e.Mixins))),e.Methods&&n(e.Methods.split(","),function(t){e[t]=a}),e.Properties&&n(e.Properties.split(","),function(t){var n="_"+t;e[t]=function(e){var t=this,r;return e!==r?(t[n]=e,t):t[n]}}),e.Statics&&n(e.Statics,function(e,n){t[n]=e}),e.Defaults&&c.Defaults&&(e.Defaults=r({},c.Defaults,e.Defaults));for(d in e)f=e[d],"function"==typeof f&&c[d]?u[d]=s(d,f):u[d]=f;return t.prototype=u,t.constructor=t,t.extend=i,t},t}),r($,[d],function(e){function t(t){function n(){return!1}function r(){return!0}function i(e,i){var o,s,l,c;if(e=e.toLowerCase(),i=i||{},i.type=e,i.target||(i.target=u),i.preventDefault||(i.preventDefault=function(){i.isDefaultPrevented=r},i.stopPropagation=function(){i.isPropagationStopped=r},i.stopImmediatePropagation=function(){i.isImmediatePropagationStopped=r},i.isDefaultPrevented=n,i.isPropagationStopped=n,i.isImmediatePropagationStopped=n),t.beforeFire&&t.beforeFire(i),o=d[e])for(s=0,l=o.length;l>s;s++){if(c=o[s],c.once&&a(e,c.func),i.isImmediatePropagationStopped())return i.stopPropagation(),i;if(c.func.call(u,i)===!1)return i.preventDefault(),i}return i}function o(t,r,i,o){var a,s,l;if(r===!1&&(r=n),r)for(r={func:r},o&&e.extend(r,o),s=t.toLowerCase().split(" "),l=s.length;l--;)t=s[l],a=d[t],a||(a=d[t]=[],f(t,!0)),i?a.unshift(r):a.push(r);return c}function a(e,t){var n,r,i,o,a;if(e)for(o=e.toLowerCase().split(" "),n=o.length;n--;){if(e=o[n],r=d[e],!e){for(i in d)f(i,!1),delete d[i];return c}if(r){if(t)for(a=r.length;a--;)r[a].func===t&&(r=r.slice(0,a).concat(r.slice(a+1)),d[e]=r);else r.length=0;r.length||(f(e,!1),delete d[e])}}else{for(e in d)f(e,!1);d={}}return c}function s(e,t,n){return o(e,t,n,{once:!0})}function l(e){return e=e.toLowerCase(),!(!d[e]||0===d[e].length)}var c=this,u,d={},f;t=t||{},u=t.scope||c,f=t.toggleEvent||n,c.fire=i,c.on=o,c.off=a,c.once=s,c.has=l}var n=e.makeMap("focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange mouseout mouseenter mouseleave wheel keydown keypress keyup input contextmenu dragstart dragend dragover draggesture dragdrop drop drag submit compositionstart compositionend compositionupdate touchstart touchend"," ");return t.isNative=function(e){return!!n[e.toLowerCase()]},t}),r(q,[U],function(e){function t(e){for(var t=[],n=e.length,r;n--;)r=e[n],r.__checked||(t.push(r),r.__checked=1);for(n=t.length;n--;)delete t[n].__checked;return t}var n=/^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i,r=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,i=/^\s*|\s*$/g,o,a=e.extend({init:function(e){function t(e){return e?(e=e.toLowerCase(),function(t){return"*"===e||t.type===e}):void 0}function o(e){return e?function(t){return t._name===e}:void 0}function a(e){return e?(e=e.split("."),function(t){for(var n=e.length;n--;)if(!t.hasClass(e[n]))return!1;return!0}):void 0}function s(e,t,n){return e?function(r){var i=r[e]?r[e]():"";return t?"="===t?i===n:"*="===t?i.indexOf(n)>=0:"~="===t?(" "+i+" ").indexOf(" "+n+" ")>=0:"!="===t?i!=n:"^="===t?0===i.indexOf(n):"$="===t?i.substr(i.length-n.length)===n:!1:!!n}:void 0}function l(e){var t;return e?(e=/(?:not\((.+)\))|(.+)/i.exec(e),e[1]?(t=u(e[1],[]),function(e){return!d(e,t)}):(e=e[2],function(t,n,r){return"first"===e?0===n:"last"===e?n===r-1:"even"===e?n%2===0:"odd"===e?n%2===1:t[e]?t[e]():!1})):void 0}function c(e,r,c){function u(e){e&&r.push(e)}var d;return d=n.exec(e.replace(i,"")),u(t(d[1])),u(o(d[2])),u(a(d[3])),u(s(d[4],d[5],d[6])),u(l(d[7])),r.psuedo=!!d[7],r.direct=c,r}function u(e,t){var n=[],i,o,a;do if(r.exec(""),o=r.exec(e),o&&(e=o[3],n.push(o[1]),o[2])){i=o[3];break}while(o);for(i&&u(i,t),e=[],a=0;a"!=n[a]&&e.push(c(n[a],[],">"===n[a-1]));return t.push(e),t}var d=this.match;this._selectors=u(e,[])},match:function(e,t){var n,r,i,o,a,s,l,c,u,d,f,p,h;for(t=t||this._selectors,n=0,r=t.length;r>n;n++){for(a=t[n],o=a.length,h=e,p=0,i=o-1;i>=0;i--)for(c=a[i];h;){if(c.psuedo)for(f=h.parent().items(),u=d=f.length;u--&&f[u]!==h;);for(s=0,l=c.length;l>s;s++)if(!c[s](h,u,d)){s=l+1;break}if(s===l){p++;break}if(i===o-1)break;h=h.parent()}if(p===o)return!0}return!1},find:function(e){function n(e,t,i){var o,a,s,l,c,u=t[i];for(o=0,a=e.length;a>o;o++){for(c=e[o],s=0,l=u.length;l>s;s++)if(!u[s](c,o,a)){s=l+1;break}if(s===l)i==t.length-1?r.push(c):c.items&&n(c.items(),t,i+1);else if(u.direct)return;c.items&&n(c.items(),t,i)}}var r=[],i,s,l=this._selectors;if(e.items){for(i=0,s=l.length;s>i;i++)n(e.items(),l[i],0);s>1&&(r=t(r))}return o||(o=a.Collection),new o(r)}});return a}),r(j,[d,q,U],function(e,t,n){var r,i,o=Array.prototype.push,a=Array.prototype.slice;return i={length:0,init:function(e){e&&this.add(e)},add:function(t){var n=this;return e.isArray(t)?o.apply(n,t):t instanceof r?n.add(t.toArray()):o.call(n,t),n},set:function(e){var t=this,n=t.length,r;for(t.length=0,t.add(e),r=t.length;n>r;r++)delete t[r];return t},filter:function(e){var n=this,i,o,a=[],s,l;for("string"==typeof e?(e=new t(e),l=function(t){return e.match(t)}):l=e,i=0,o=n.length;o>i;i++)s=n[i],l(s)&&a.push(s); + +return new r(a)},slice:function(){return new r(a.apply(this,arguments))},eq:function(e){return-1===e?this.slice(e):this.slice(e,+e+1)},each:function(t){return e.each(this,t),this},toArray:function(){return e.toArray(this)},indexOf:function(e){for(var t=this,n=t.length;n--&&t[n]!==e;);return n},reverse:function(){return new r(e.toArray(this).reverse())},hasClass:function(e){return this[0]?this[0].hasClass(e):!1},prop:function(e,t){var n=this,r,i;return t!==r?(n.each(function(n){n[e]&&n[e](t)}),n):(i=n[0],i&&i[e]?i[e]():void 0)},exec:function(t){var n=this,r=e.toArray(arguments).slice(1);return n.each(function(e){e[t]&&e[t].apply(e,r)}),n},remove:function(){for(var e=this.length;e--;)this[e].remove();return this}},e.each("fire on off show hide addClass removeClass append prepend before after reflow".split(" "),function(t){i[t]=function(){var n=e.toArray(arguments);return this.each(function(e){t in e&&e[t].apply(e,n)}),this}}),e.each("text name disabled active selected checked visible parent value data".split(" "),function(e){i[e]=function(t){return this.prop(e,t)}}),r=n.extend(i),t.Collection=r,r}),r(K,[d,y],function(e,t){var n=0;return{id:function(){return"mceu_"+n++},createFragment:function(e){return t.DOM.createFragment(e)},getWindowSize:function(){return t.DOM.getViewPort()},getSize:function(e){var t,n;if(e.getBoundingClientRect){var r=e.getBoundingClientRect();t=Math.max(r.width||r.right-r.left,e.offsetWidth),n=Math.max(r.height||r.bottom-r.bottom,e.offsetHeight)}else t=e.offsetWidth,n=e.offsetHeight;return{width:t,height:n}},getPos:function(e,n){return t.DOM.getPos(e,n)},getViewPort:function(e){return t.DOM.getViewPort(e)},get:function(e){return document.getElementById(e)},addClass:function(e,n){return t.DOM.addClass(e,n)},removeClass:function(e,n){return t.DOM.removeClass(e,n)},hasClass:function(e,n){return t.DOM.hasClass(e,n)},toggleClass:function(e,n,r){return t.DOM.toggleClass(e,n,r)},css:function(e,n,r){return t.DOM.setStyle(e,n,r)},getRuntimeStyle:function(e,n){return t.DOM.getStyle(e,n,!0)},on:function(e,n,r,i){return t.DOM.bind(e,n,r,i)},off:function(e,n,r){return t.DOM.unbind(e,n,r)},fire:function(e,n,r){return t.DOM.fire(e,n,r)},innerHtml:function(e,n){t.DOM.setHTML(e,n)}}}),r(Y,[U,d,$,j,K],function(e,t,n,r,i){function o(e){return e._eventDispatcher||(e._eventDispatcher=new n({scope:e,toggleEvent:function(t,r){r&&n.isNative(t)&&(e._nativeEvents||(e._nativeEvents={}),e._nativeEvents[t]=!0,e._rendered&&e.bindPendingEvents())}})),e._eventDispatcher}var a="onmousewheel"in document,s=!1,l="mce-",c=e.extend({Statics:{classPrefix:l},isRtl:function(){return c.rtl},classPrefix:l,init:function(e){var n=this,r,o;if(n.settings=e=t.extend({},n.Defaults,e),n._id=e.id||i.id(),n._text=n._name="",n._width=n._height=0,n._aria={role:e.role},this._elmCache={},r=e.classes)for(r=r.split(" "),r.map={},o=r.length;o--;)r.map[r[o]]=!0;n._classes=r||[],n.visible(!0),t.each("title text width height name classes visible disabled active value".split(" "),function(t){var r=e[t],i;r!==i?n[t](r):n["_"+t]===i&&(n["_"+t]=!1)}),n.on("click",function(){return n.disabled()?!1:void 0}),e.classes&&t.each(e.classes.split(" "),function(e){n.addClass(e)}),n.settings=e,n._borderBox=n.parseBox(e.border),n._paddingBox=n.parseBox(e.padding),n._marginBox=n.parseBox(e.margin),e.hidden&&n.hide()},Properties:"parent,title,text,width,height,disabled,active,name,value",Methods:"renderHtml",getContainerElm:function(){return document.body},getParentCtrl:function(e){for(var t,n=this.getRoot().controlIdLookup;e&&n&&!(t=n[e.id]);)e=e.parentNode;return t},parseBox:function(e){var t,n=10;if(e)return"number"==typeof e?(e=e||0,{top:e,left:e,bottom:e,right:e}):(e=e.split(" "),t=e.length,1===t?e[1]=e[2]=e[3]=e[0]:2===t?(e[2]=e[0],e[3]=e[1]):3===t&&(e[3]=e[1]),{top:parseInt(e[0],n)||0,right:parseInt(e[1],n)||0,bottom:parseInt(e[2],n)||0,left:parseInt(e[3],n)||0})},borderBox:function(){return this._borderBox},paddingBox:function(){return this._paddingBox},marginBox:function(){return this._marginBox},measureBox:function(e,t){function n(t){var n=document.defaultView;return n?(t=t.replace(/[A-Z]/g,function(e){return"-"+e}),n.getComputedStyle(e,null).getPropertyValue(t)):e.currentStyle[t]}function r(e){var t=parseFloat(n(e),10);return isNaN(t)?0:t}return{top:r(t+"TopWidth"),right:r(t+"RightWidth"),bottom:r(t+"BottomWidth"),left:r(t+"LeftWidth")}},initLayoutRect:function(){var e=this,t=e.settings,n,r,o=e.getEl(),a,s,l,c,u,d,f,p;n=e._borderBox=e._borderBox||e.measureBox(o,"border"),e._paddingBox=e._paddingBox||e.measureBox(o,"padding"),e._marginBox=e._marginBox||e.measureBox(o,"margin"),p=i.getSize(o),d=t.minWidth,f=t.minHeight,l=d||p.width,c=f||p.height,a=t.width,s=t.height,u=t.autoResize,u="undefined"!=typeof u?u:!a&&!s,a=a||l,s=s||c;var h=n.left+n.right,m=n.top+n.bottom,g=t.maxWidth||65535,v=t.maxHeight||65535;return e._layoutRect=r={x:t.x||0,y:t.y||0,w:a,h:s,deltaW:h,deltaH:m,contentW:a-h,contentH:s-m,innerW:a-h,innerH:s-m,startMinWidth:d||0,startMinHeight:f||0,minW:Math.min(l,g),minH:Math.min(c,v),maxW:g,maxH:v,autoResize:u,scrollW:0},e._lastLayoutRect={},r},layoutRect:function(e){var t=this,n=t._layoutRect,r,i,o,a,s,l;return n||(n=t.initLayoutRect()),e?(o=n.deltaW,a=n.deltaH,e.x!==s&&(n.x=e.x),e.y!==s&&(n.y=e.y),e.minW!==s&&(n.minW=e.minW),e.minH!==s&&(n.minH=e.minH),i=e.w,i!==s&&(i=in.maxW?n.maxW:i,n.w=i,n.innerW=i-o),i=e.h,i!==s&&(i=in.maxH?n.maxH:i,n.h=i,n.innerH=i-a),i=e.innerW,i!==s&&(i=in.maxW-o?n.maxW-o:i,n.innerW=i,n.w=i+o),i=e.innerH,i!==s&&(i=in.maxH-a?n.maxH-a:i,n.innerH=i,n.h=i+a),e.contentW!==s&&(n.contentW=e.contentW),e.contentH!==s&&(n.contentH=e.contentH),r=t._lastLayoutRect,(r.x!==n.x||r.y!==n.y||r.w!==n.w||r.h!==n.h)&&(l=c.repaintControls,l&&l.map&&!l.map[t._id]&&(l.push(t),l.map[t._id]=!0),r.x=n.x,r.y=n.y,r.w=n.w,r.h=n.h),t):n},repaint:function(){var e=this,t,n,r,i,o=0,a=0,s,l;l=document.createRange?function(e){return e}:Math.round,t=e.getEl().style,r=e._layoutRect,s=e._lastRepaintRect||{},i=e._borderBox,o=i.left+i.right,a=i.top+i.bottom,r.x!==s.x&&(t.left=l(r.x)+"px",s.x=r.x),r.y!==s.y&&(t.top=l(r.y)+"px",s.y=r.y),r.w!==s.w&&(t.width=l(r.w-o)+"px",s.w=r.w),r.h!==s.h&&(t.height=l(r.h-a)+"px",s.h=r.h),e._hasBody&&r.innerW!==s.innerW&&(n=e.getEl("body").style,n.width=l(r.innerW)+"px",s.innerW=r.innerW),e._hasBody&&r.innerH!==s.innerH&&(n=n||e.getEl("body").style,n.height=l(r.innerH)+"px",s.innerH=r.innerH),e._lastRepaintRect=s,e.fire("repaint",{},!1)},on:function(e,t){function n(e){var t,n;return"string"!=typeof e?e:function(i){return t||r.parentsAndSelf().each(function(r){var i=r.settings.callbacks;return i&&(t=i[e])?(n=r,!1):void 0}),t.call(n,i)}}var r=this;return o(r).on(e,n(t)),r},off:function(e,t){return o(this).off(e,t),this},fire:function(e,t,n){var r=this;if(t=t||{},t.control||(t.control=r),t=o(r).fire(e,t),n!==!1&&r.parent)for(var i=r.parent();i&&!t.isPropagationStopped();)i.fire(e,t,!1),i=i.parent();return t},hasEventListeners:function(e){return o(this).has(e)},parents:function(e){var t=this,n,i=new r;for(n=t.parent();n;n=n.parent())i.add(n);return e&&(i=i.filter(e)),i},parentsAndSelf:function(e){return new r(this).add(this.parents(e))},next:function(){var e=this.parent().items();return e[e.indexOf(this)+1]},prev:function(){var e=this.parent().items();return e[e.indexOf(this)-1]},findCommonAncestor:function(e,t){for(var n;e;){for(n=t;n&&e!=n;)n=n.parent();if(e==n)break;e=e.parent()}return e},hasClass:function(e,t){var n=this._classes[t||"control"];return e=this.classPrefix+e,n&&!!n.map[e]},addClass:function(e,t){var n=this,r,i;return e=this.classPrefix+e,r=n._classes[t||"control"],r||(r=[],r.map={},n._classes[t||"control"]=r),r.map[e]||(r.map[e]=e,r.push(e),n._rendered&&(i=n.getEl(t),i&&(i.className=r.join(" ")))),n},removeClass:function(e,t){var n=this,r,i,o;if(e=this.classPrefix+e,r=n._classes[t||"control"],r&&r.map[e])for(delete r.map[e],i=r.length;i--;)r[i]===e&&r.splice(i,1);return n._rendered&&(o=n.getEl(t),o&&(o.className=r.join(" "))),n},toggleClass:function(e,t,n){var r=this;return t?r.addClass(e,n):r.removeClass(e,n),r},classes:function(e){var t=this._classes[e||"control"];return t?t.join(" "):""},innerHtml:function(e){return i.innerHtml(this.getEl(),e),this},getEl:function(e){var t=e?this._id+"-"+e:this._id;return this._elmCache[t]||(this._elmCache[t]=i.get(t)),this._elmCache[t]},visible:function(e){var t=this,n;return"undefined"!=typeof e?(t._visible!==e&&(t._rendered&&(t.getEl().style.display=e?"":"none"),t._visible=e,n=t.parent(),n&&(n._lastRect=null),t.fire(e?"show":"hide")),t):t._visible},show:function(){return this.visible(!0)},hide:function(){return this.visible(!1)},focus:function(){try{this.getEl().focus()}catch(e){}return this},blur:function(){return this.getEl().blur(),this},aria:function(e,t){var n=this,r=n.getEl(n.ariaTarget);return"undefined"==typeof t?n._aria[e]:(n._aria[e]=t,n._rendered&&r.setAttribute("role"==e?e:"aria-"+e,t),n)},encode:function(e,t){return t!==!1&&(e=this.translate(e)),(e||"").replace(/[&<>"]/g,function(e){return"&#"+e.charCodeAt(0)+";"})},translate:function(e){return c.translate?c.translate(e):e},before:function(e){var t=this,n=t.parent();return n&&n.insert(e,n.items().indexOf(t),!0),t},after:function(e){var t=this,n=t.parent();return n&&n.insert(e,n.items().indexOf(t)),t},remove:function(){var e=this,t=e.getEl(),n=e.parent(),r,o;if(e.items){var a=e.items().toArray();for(o=a.length;o--;)a[o].remove()}n&&n.items&&(r=[],n.items().each(function(t){t!==e&&r.push(t)}),n.items().set(r),n._lastRect=null),e._eventsRoot&&e._eventsRoot==e&&i.off(t);var s=e.getRoot().controlIdLookup;return s&&delete s[e._id],t&&t.parentNode&&t.parentNode.removeChild(t),e._rendered=!1,e},renderBefore:function(e){var t=this;return e.parentNode.insertBefore(i.createFragment(t.renderHtml()),e),t.postRender(),t},renderTo:function(e){var t=this;return e=e||t.getContainerElm(),e.appendChild(i.createFragment(t.renderHtml())),t.postRender(),t},postRender:function(){var e=this,t=e.settings,n,r,o,a,s;for(a in t)0===a.indexOf("on")&&e.on(a.substr(2),t[a]);if(e._eventsRoot){for(o=e.parent();!s&&o;o=o.parent())s=o._eventsRoot;if(s)for(a in s._nativeEvents)e._nativeEvents[a]=!0}e.bindPendingEvents(),t.style&&(n=e.getEl(),n&&(n.setAttribute("style",t.style),n.style.cssText=t.style)),e._visible||i.css(e.getEl(),"display","none"),e.settings.border&&(r=e.borderBox(),i.css(e.getEl(),{"border-top-width":r.top,"border-right-width":r.right,"border-bottom-width":r.bottom,"border-left-width":r.left}));var l=e.getRoot();l.controlIdLookup||(l.controlIdLookup={}),l.controlIdLookup[e._id]=e;for(var c in e._aria)e.aria(c,e._aria[c]);e.fire("postrender",{},!1)},scrollIntoView:function(e){function t(e,t){var n,r,i=e;for(n=r=0;i&&i!=t&&i.nodeType;)n+=i.offsetLeft||0,r+=i.offsetTop||0,i=i.offsetParent;return{x:n,y:r}}var n=this.getEl(),r=n.parentNode,i,o,a,s,l,c,u=t(n,r);return i=u.x,o=u.y,a=n.offsetWidth,s=n.offsetHeight,l=r.clientWidth,c=r.clientHeight,"end"==e?(i-=l-a,o-=c-s):"center"==e&&(i-=l/2-a/2,o-=c/2-s/2),r.scrollLeft=i,r.scrollTop=o,this},bindPendingEvents:function(){function e(e){var t=o.getParentCtrl(e.target);t&&t.fire(e.type,e)}function t(){var e=d._lastHoverCtrl;e&&(e.fire("mouseleave",{target:e.getEl()}),e.parents().each(function(e){e.fire("mouseleave",{target:e.getEl()})}),d._lastHoverCtrl=null)}function n(e){var t=o.getParentCtrl(e.target),n=d._lastHoverCtrl,r=0,i,a,s;if(t!==n){if(d._lastHoverCtrl=t,a=t.parents().toArray().reverse(),a.push(t),n){for(s=n.parents().toArray().reverse(),s.push(n),r=0;r=r;i--)n=s[i],n.fire("mouseleave",{target:n.getEl()})}for(i=r;il;l++)d=u[l]._eventsRoot;for(d||(d=u[u.length-1]||o),o._eventsRoot=d,c=l,l=0;c>l;l++)u[l]._eventsRoot=d;var h=d._delegates;h||(h=d._delegates={});for(p in f){if(!f)return!1;"wheel"!==p||s?("mouseenter"===p||"mouseleave"===p?d._hasMouseEnter||(i.on(d.getEl(),"mouseleave",t),i.on(d.getEl(),"mouseover",n),d._hasMouseEnter=1):h[p]||(i.on(d.getEl(),p,e),h[p]=!0),f[p]=!1):a?i.on(o.getEl(),"mousewheel",r):i.on(o.getEl(),"DOMMouseScroll",r)}}},getRoot:function(){for(var e=this,t,n=[];e;){if(e.rootControl){t=e.rootControl;break}n.push(e),t=e,e=e.parent()}t||(t=this);for(var r=n.length;r--;)n[r].rootControl=t;return t},reflow:function(){return this.repaint(),this}});return c}),r(G,[],function(){var e={},t;return{add:function(t,n){e[t.toLowerCase()]=n},has:function(t){return!!e[t.toLowerCase()]},create:function(n,r){var i,o,a;if(!t){a=tinymce.ui;for(o in a)e[o.toLowerCase()]=a[o];t=!0}if("string"==typeof n?(r=r||{},r.type=n):(r=n,n=r.type),n=n.toLowerCase(),i=e[n],!i)throw new Error("Could not find control by type: "+n);return i=new i(r),i.type=n,i}}}),r(X,[],function(){return function(e){function t(e){return e=e||b,e&&e.getAttribute("role")}function n(e){for(var n,r=e||b;r=r.parentNode;)if(n=t(r))return n}function r(e){var t=b;return t?t.getAttribute("aria-"+e):void 0}function i(e){var t=e.tagName.toUpperCase();return"INPUT"==t||"TEXTAREA"==t}function o(e){return i(e)&&!e.hidden?!0:/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell)$/.test(t(e))?!0:!1}function a(e){function t(e){if(1==e.nodeType&&"none"!=e.style.display){o(e)&&n.push(e);for(var r=0;re?e=t.length-1:e>=t.length&&(e=0),t[e]&&t[e].focus(),e}function u(e,t){var n=-1,r=s();t=t||a(r.getEl());for(var i=0;i=0&&(n=t.getEl(),n&&n.parentNode.removeChild(n),n=e.getEl(),n&&n.parentNode.removeChild(n)),t.parent(this)},create:function(t){var n=this,i,a=[];return o.isArray(t)||(t=[t]),o.each(t,function(t){t&&(t instanceof e||("string"==typeof t&&(t={type:t}),i=o.extend({},n.settings.defaults,t),t.type=i.type=i.type||t.type||n.settings.defaultType||(i.defaults?i.defaults.type:null),t=r.create(i)),a.push(t))}),a},renderNew:function(){var e=this;return e.items().each(function(t,n){var r,i;t.parent(e),t._rendered||(r=e.getEl("body"),i=a.createFragment(t.renderHtml()),r.hasChildNodes()&&n<=r.childNodes.length-1?r.insertBefore(i,r.childNodes[n]):r.appendChild(i),t.postRender())}),e._layout.applyClasses(e),e._lastRect=null,e},append:function(e){return this.add(e).renderNew()},prepend:function(e){var t=this;return t.items().set(t.create(e).concat(t.items().toArray())),t.renderNew()},insert:function(e,t,n){var r=this,i,o,a;return e=r.create(e),i=r.items(),!n&&t=0&&t
    '+(e.settings.html||"")+t.renderHtml(e)+"
    "},postRender:function(){var e=this,t;return e.items().exec("postRender"),e._super(),e._layout.postRender(e),e._rendered=!0,e.settings.style&&a.css(e.getEl(),e.settings.style),e.settings.border&&(t=e.borderBox(),a.css(e.getEl(),{"border-top-width":t.top,"border-right-width":t.right,"border-bottom-width":t.bottom,"border-left-width":t.left})),e.parent()||(e.keyboardNav=new i({root:e})),e},initLayoutRect:function(){var e=this,t=e._super();return e._layout.recalc(e),t},recalc:function(){var e=this,t=e._layoutRect,n=e._lastRect;return n&&n.w==t.w&&n.h==t.h?void 0:(e._layout.recalc(e),t=e.layoutRect(),e._lastRect={x:t.x,y:t.y,w:t.w,h:t.h},!0)},reflow:function(){var t;if(this.visible()){for(e.repaintControls=[],e.repaintControls.map={},this.recalc(),t=e.repaintControls.length;t--;)e.repaintControls[t].repaint();"flow"!==this.settings.layout&&"stack"!==this.settings.layout&&this.repaint(),e.repaintControls=[]}return this}})}),r(Q,[K],function(e){function t(){var e=document,t,n,r,i,o,a,s,l,c=Math.max;return t=e.documentElement,n=e.body,r=c(t.scrollWidth,n.scrollWidth),i=c(t.clientWidth,n.clientWidth),o=c(t.offsetWidth,n.offsetWidth),a=c(t.scrollHeight,n.scrollHeight),s=c(t.clientHeight,n.clientHeight),l=c(t.offsetHeight,n.offsetHeight),{width:o>r?i:r,height:l>a?s:a}}return function(n,r){function i(){return a.getElementById(r.handle||n)}var o,a=document,s,l,c,u,d,f;r=r||{},l=function(n){var l=t(),p,h;n.preventDefault(),s=n.button,p=i(),d=n.screenX,f=n.screenY,h=window.getComputedStyle?window.getComputedStyle(p,null).getPropertyValue("cursor"):p.runtimeStyle.cursor,o=a.createElement("div"),e.css(o,{position:"absolute",top:0,left:0,width:l.width,height:l.height,zIndex:2147483647,opacity:1e-4,cursor:h}),a.body.appendChild(o),e.on(a,"mousemove",u),e.on(a,"mouseup",c),r.start(n)},u=function(e){return e.button!==s?c(e):(e.deltaX=e.screenX-d,e.deltaY=e.screenY-f,e.preventDefault(),void r.drag(e))},c=function(t){e.off(a,"mousemove",u),e.off(a,"mouseup",c),o.parentNode.removeChild(o),r.stop&&r.stop(t)},this.destroy=function(){e.off(i())},e.on(i(),"mousedown",l)}}),r(Z,[K,Q],function(e,t){return{init:function(){var e=this;e.on("repaint",e.renderScroll)},renderScroll:function(){function n(){function t(t,a,s,l,c,u){var d,f,p,h,m,g,v,y,b;if(f=i.getEl("scroll"+t)){if(y=a.toLowerCase(),b=s.toLowerCase(),i.getEl("absend")&&e.css(i.getEl("absend"),y,i.layoutRect()[l]-1),!c)return void e.css(f,"display","none");e.css(f,"display","block"),d=i.getEl("body"),p=i.getEl("scroll"+t+"t"),h=d["client"+s]-2*o,h-=n&&r?f["client"+u]:0,m=d["scroll"+s],g=h/m,v={},v[y]=d["offset"+a]+o,v[b]=h,e.css(f,v),v={},v[y]=d["scroll"+a]*g,v[b]=h*g,e.css(p,v)}}var n,r,a;a=i.getEl("body"),n=a.scrollWidth>a.clientWidth,r=a.scrollHeight>a.clientHeight,t("h","Left","Width","contentW",n,"Height"),t("v","Top","Height","contentH",r,"Width")}function r(){function n(n,r,a,s,l){var c,u=i._id+"-scroll"+n,d=i.classPrefix;i.getEl().appendChild(e.createFragment('
    ')),i.draghelper=new t(u+"t",{start:function(){c=i.getEl("body")["scroll"+r],e.addClass(e.get(u),d+"active")},drag:function(e){var t,u,d,f,p=i.layoutRect();u=p.contentW>p.innerW,d=p.contentH>p.innerH,f=i.getEl("body")["client"+a]-2*o,f-=u&&d?i.getEl("scroll"+n)["client"+l]:0,t=f/i.getEl("body")["scroll"+a],i.getEl("body")["scroll"+r]=c+e["delta"+s]/t},stop:function(){e.removeClass(e.get(u),d+"active")}})}i.addClass("scroll"),n("v","Top","Height","Y","Width"),n("h","Left","Width","X","Height")}var i=this,o=2;i.settings.autoScroll&&(i._hasScroll||(i._hasScroll=!0,r(),i.on("wheel",function(e){var t=i.getEl("body");t.scrollLeft+=10*(e.deltaX||0),t.scrollTop+=10*e.deltaY,n()}),e.on(i.getEl("body"),"scroll",n)),n())}}}),r(ee,[J,Z],function(e,t){return e.extend({Defaults:{layout:"fit",containerCls:"panel"},Mixins:[t],renderHtml:function(){var e=this,t=e._layout,n=e.settings.html;return e.preRender(),t.preRender(e),"undefined"==typeof n?n='
    '+t.renderHtml(e)+"
    ":("function"==typeof n&&(n=n.call(e)),e._hasBody=!1),'
    '+(e._preBodyHtml||"")+n+"
    "}})}),r(te,[K],function(e){function t(t,n,r){var i,o,a,s,l,c,u,d,f,p;return f=e.getViewPort(),o=e.getPos(n),a=o.x,s=o.y,t._fixed&&"static"==e.getRuntimeStyle(document.body,"position")&&(a-=f.x,s-=f.y),i=t.getEl(),p=e.getSize(i),l=p.width,c=p.height,p=e.getSize(n),u=p.width,d=p.height,r=(r||"").split(""),"b"===r[0]&&(s+=d),"r"===r[1]&&(a+=u),"c"===r[0]&&(s+=Math.round(d/2)),"c"===r[1]&&(a+=Math.round(u/2)),"b"===r[3]&&(s-=c),"r"===r[4]&&(a-=l),"c"===r[3]&&(s-=Math.round(c/2)),"c"===r[4]&&(a-=Math.round(l/2)),{x:a,y:s,w:l,h:c}}return{testMoveRel:function(n,r){for(var i=e.getViewPort(),o=0;o0&&a.x+a.w0&&a.y+a.hi.x&&a.x+a.wi.y&&a.y+a.he?0:e+n>t?(e=t-n,0>e?0:e):e}var i=this;if(i.settings.constrainToViewport){var o=e.getViewPort(window),a=i.layoutRect();t=r(t,o.w+o.x,a.w),n=r(n,o.h+o.y,a.h)}return i._rendered?i.layoutRect({x:t,y:n}).repaint():(i.settings.x=t,i.settings.y=n),i.fire("move",{x:t,y:n}),i}}}),r(ne,[K],function(e){return{resizeToContent:function(){this._layoutRect.autoResize=!0,this._lastRect=null,this.reflow()},resizeTo:function(t,n){if(1>=t||1>=n){var r=e.getWindowSize();t=1>=t?t*r.w:t,n=1>=n?n*r.h:n}return this._layoutRect.autoResize=!1,this.layoutRect({minW:t,minH:n,w:t,h:n}).reflow()},resizeBy:function(e,t){var n=this,r=n.layoutRect();return n.resizeTo(r.w+e,r.h+t)}}}),r(re,[ee,te,ne,K],function(e,t,n,r){function i(){function e(e,t){for(;e;){if(e==t)return!0;e=e.parent()}}u||(u=function(t){if(2!=t.button)for(var n=p.length;n--;){var r=p[n],i=r.getParentCtrl(t.target);if(r.settings.autohide){if(i&&(e(i,r)||r.parent()===i))continue;t=r.fire("autohide",{target:t.target}),t.isDefaultPrevented()||r.hide()}}},r.on(document,"click",u))}function o(){d||(d=function(){var e;for(e=p.length;e--;)s(p[e])},r.on(window,"scroll",d))}function a(){if(!f){var e=document.documentElement,t=e.clientWidth,n=e.clientHeight;f=function(){document.all&&t==e.clientWidth&&n==e.clientHeight||(t=e.clientWidth,n=e.clientHeight,g.hideAll())},r.on(window,"resize",f)}}function s(e){function t(t,n){for(var r,i=0;in&&(e.fixed(!1).layoutRect({y:e._autoFixY}).repaint(),t(!1,e._autoFixY-n)):(e._autoFixY=e.layoutRect().y,e._autoFixY
    '),n=n.firstChild,t.getContainerElm().appendChild(n),setTimeout(function(){r.addClass(n,i+"in"),r.addClass(t.getEl(),i+"in")},0),m=!0),l(!0,t)}}),t.on("show",function(){t.parents().each(function(e){return e._fixed?(t.fixed(!0),!1):void 0})}),e.popover&&(t._preBodyHtml='
    ',t.addClass("popover").addClass("bottom").addClass(t.isRtl()?"end":"start"))},fixed:function(e){var t=this;if(t._fixed!=e){if(t._rendered){var n=r.getViewPort();e?t.layoutRect().y-=n.y:t.layoutRect().y+=n.y}t.toggleClass("fixed",e),t._fixed=e}return t},show:function(){var e=this,t,n=e._super();for(t=p.length;t--&&p[t]!==e;);return-1===t&&p.push(e),n},hide:function(){return c(this),l(!1,this),this._super()},hideAll:function(){g.hideAll()},close:function(){var e=this;return e.fire("close").isDefaultPrevented()||(e.remove(),l(!1,e)),e},remove:function(){c(this),this._super()},postRender:function(){var e=this;return e.settings.bodyRole&&this.getEl("body").setAttribute("role",e.settings.bodyRole),e._super()}});return g.hideAll=function(){for(var e=p.length;e--;){var t=p[e];t&&t.settings.autohide&&(t.hide(),p.splice(e,1))}},g}),r(ie,[re,ee,K,Q],function(e,t,n,r){var i=e.extend({modal:!0,Defaults:{border:1,layout:"flex",containerCls:"panel",role:"dialog",callbacks:{submit:function(){this.fire("submit",{data:this.toJSON()})},close:function(){this.close()}}},init:function(e){var n=this;n._super(e),n.isRtl()&&n.addClass("rtl"),n.addClass("window"),n._fixed=!0,e.buttons&&(n.statusbar=new t({layout:"flex",border:"1 0 0 0",spacing:3,padding:10,align:"center",pack:n.isRtl()?"start":"end",defaults:{type:"button"},items:e.buttons}),n.statusbar.addClass("foot"),n.statusbar.parent(n)),n.on("click",function(e){-1!=e.target.className.indexOf(n.classPrefix+"close")&&n.close()}),n.on("cancel",function(){n.close()}),n.aria("describedby",n.describedBy||n._id+"-none"),n.aria("label",e.title),n._fullscreen=!1},recalc:function(){var e=this,t=e.statusbar,r,i,o,a;e._fullscreen&&(e.layoutRect(n.getWindowSize()),e.layoutRect().contentH=e.layoutRect().innerH),e._super(),r=e.layoutRect(),e.settings.title&&!e._fullscreen&&(i=r.headerW,i>r.w&&(o=r.x-Math.max(0,i/2),e.layoutRect({w:i,x:o}),a=!0)),t&&(t.layoutRect({w:e.layoutRect().innerW}).recalc(),i=t.layoutRect().minW+r.deltaW,i>r.w&&(o=r.x-Math.max(0,i-r.w),e.layoutRect({w:i,x:o}),a=!0)),a&&e.recalc()},initLayoutRect:function(){var e=this,t=e._super(),r=0,i;if(e.settings.title&&!e._fullscreen){i=e.getEl("head");var o=n.getSize(i);t.headerW=o.width,t.headerH=o.height,r+=t.headerH}e.statusbar&&(r+=e.statusbar.layoutRect().h),t.deltaH+=r,t.minH+=r,t.h+=r;var a=n.getWindowSize();return t.x=Math.max(0,a.w/2-t.w/2),t.y=Math.max(0,a.h/2-t.h/2),t},renderHtml:function(){var e=this,t=e._layout,n=e._id,r=e.classPrefix,i=e.settings,o="",a="",s=i.html;return e.preRender(),t.preRender(e),i.title&&(o='
    '+e.encode(i.title)+'
    '),i.url&&(s=''),"undefined"==typeof s&&(s=t.renderHtml(e)),e.statusbar&&(a=e.statusbar.renderHtml()),'
    '+o+'
    '+s+"
    "+a+"
    "},fullscreen:function(e){var t=this,r=document.documentElement,i,o=t.classPrefix,a;if(e!=t._fullscreen)if(n.on(window,"resize",function(){var e;if(t._fullscreen)if(i)t._timer||(t._timer=setTimeout(function(){var e=n.getWindowSize();t.moveTo(0,0).resizeTo(e.w,e.h),t._timer=0},50));else{e=(new Date).getTime();var r=n.getWindowSize();t.moveTo(0,0).resizeTo(r.w,r.h),(new Date).getTime()-e>50&&(i=!0)}}),a=t.layoutRect(),t._fullscreen=e,e){t._initial={x:a.x,y:a.y,w:a.w,h:a.h},t._borderBox=t.parseBox("0"),t.getEl("head").style.display="none",a.deltaH-=a.headerH+2,n.addClass(r,o+"fullscreen"),n.addClass(document.body,o+"fullscreen"),t.addClass("fullscreen");var s=n.getWindowSize();t.moveTo(0,0).resizeTo(s.w,s.h)}else t._borderBox=t.parseBox(t.settings.border),t.getEl("head").style.display="",a.deltaH+=a.headerH,n.removeClass(r,o+"fullscreen"),n.removeClass(document.body,o+"fullscreen"),t.removeClass("fullscreen"),t.moveTo(t._initial.x,t._initial.y).resizeTo(t._initial.w,t._initial.h);return t.reflow()},postRender:function(){var e=this,t;setTimeout(function(){e.addClass("in")},0),e._super(),e.statusbar&&e.statusbar.postRender(),e.focus(),this.dragHelper=new r(e._id+"-dragh",{start:function(){t={x:e.layoutRect().x,y:e.layoutRect().y}},drag:function(n){e.moveTo(t.x+n.deltaX,t.y+n.deltaY)}}),e.on("submit",function(t){t.isDefaultPrevented()||e.close()})},submit:function(){return this.fire("submit",{data:this.toJSON()})},remove:function(){var e=this,t=e.classPrefix;e.dragHelper.destroy(),e._super(),e.statusbar&&this.statusbar.remove(),e._fullscreen&&(n.removeClass(document.documentElement,t+"fullscreen"),n.removeClass(document.body,t+"fullscreen"))},getContentWindow:function(){var e=this.getEl().getElementsByTagName("iframe")[0];return e?e.contentWindow:null}});return i}),r(oe,[ie],function(e){var t=e.extend({init:function(e){e={border:1,padding:20,layout:"flex",pack:"center",align:"center",containerCls:"panel",autoScroll:!0,buttons:{type:"button",text:"Ok",action:"ok"},items:{type:"label",multiline:!0,maxWidth:500,maxHeight:200}},this._super(e)},Statics:{OK:1,OK_CANCEL:2,YES_NO:3,YES_NO_CANCEL:4,msgBox:function(n){function r(e,t,n){return{type:"button",text:e,subtype:n?"primary":"",onClick:function(e){e.control.parents()[1].close(),o(t)}}}var i,o=n.callback||function(){};switch(n.buttons){case t.OK_CANCEL:i=[r("Ok",!0,!0),r("Cancel",!1)];break;case t.YES_NO:case t.YES_NO_CANCEL:i=[r("Yes",1,!0),r("No",0)],n.buttons==t.YES_NO_CANCEL&&i.push(r("Cancel",-1));break;default:i=[r("Ok",!0,!0)]}return new e({padding:20,x:n.x,y:n.y,minWidth:300,minHeight:100,layout:"flex",pack:"center",align:"center",buttons:i,title:n.title,role:"alertdialog",items:{type:"label",multiline:!0,maxWidth:500,maxHeight:200,text:n.text},onPostRender:function(){this.aria("describedby",this.items()[0]._id)},onClose:n.onClose,onCancel:function(){o(!1)}}).renderTo(document.body).reflow()},alert:function(e,n){return"string"==typeof e&&(e={ +text:e}),e.callback=n,t.msgBox(e)},confirm:function(e,n){return"string"==typeof e&&(e={text:e}),e.callback=n,e.buttons=t.OK_CANCEL,t.msgBox(e)}}});return t}),r(ae,[ie,oe],function(e,t){return function(n){function r(){return o.length?o[o.length-1]:void 0}var i=this,o=[];i.windows=o,n.on("remove",function(){for(var e=o.length;e--;)o[e].close()}),i.open=function(t,r){var i;return n.editorManager.setActive(n),t.title=t.title||" ",t.url=t.url||t.file,t.url&&(t.width=parseInt(t.width||320,10),t.height=parseInt(t.height||240,10)),t.body&&(t.items={defaults:t.defaults,type:t.bodyType||"form",items:t.body}),t.url||t.buttons||(t.buttons=[{text:"Ok",subtype:"primary",onclick:function(){i.find("form")[0].submit()}},{text:"Cancel",onclick:function(){i.close()}}]),i=new e(t),o.push(i),i.on("close",function(){for(var e=o.length;e--;)o[e]===i&&o.splice(e,1);o.length||n.focus()}),t.data&&i.on("postRender",function(){this.find("*").each(function(e){var n=e.name();n in t.data&&e.value(t.data[n])})}),i.features=t||{},i.params=r||{},1===o.length&&n.nodeChanged(),i.renderTo().reflow()},i.alert=function(e,r,i){t.alert(e,function(){r?r.call(i||this):n.focus()})},i.confirm=function(e,n,r){t.confirm(e,function(e){n.call(r||this,e)})},i.close=function(){r()&&r().close()},i.getParams=function(){return r()?r().params:null},i.setParams=function(e){r()&&(r().params=e)},i.getWindows=function(){return o}}}),r(se,[B,x,h,_,g,u,d],function(e,t,n,r,i,o,a){return function(s){function l(e,t){try{s.getDoc().execCommand(e,!1,t)}catch(n){}}function c(){var e=s.getDoc().documentMode;return e?e:6}function u(e){return e.isDefaultPrevented()}function d(e){var t;e.dataTransfer&&(s.selection.isCollapsed()&&"IMG"==e.target.tagName&&Q.select(e.target),t=s.selection.getContent(),t.length>0&&e.dataTransfer.setData(ae,oe+escape(t)))}function f(e){var t,n;return e.dataTransfer&&(t=e.dataTransfer.getData(ae),t&&t.indexOf(oe)>=0&&(n=unescape(t.substr(oe.length)))),n}function p(e){s.queryCommandSupported("mceInsertClipboardContent")?s.execCommand("mceInsertClipboardContent",!1,{content:e}):s.execCommand("mceInsertContent",!1,e)}function h(){function r(e){var t=v.schema.getBlockElements(),n=s.getBody();if("BR"!=e.nodeName)return!1;for(e=e;e!=n&&!t[e.nodeName];e=e.parentNode)if(e.nextSibling)return!1;return!0}function i(e,t){var n;for(n=e.nextSibling;n&&n!=t;n=n.nextSibling)if((3!=n.nodeType||0!==Y.trim(n.data).length)&&n!==t)return!1;return n===t}function o(e,t,i){var o,a,s;for(s=v.schema.getNonEmptyElements(),o=new n(i||e,e);a=o[t?"next":"prev"]();){if(s[a.nodeName]&&!r(a))return a;if(3==a.nodeType&&a.data.length>0)return a}}function l(e){var n,r,i,a,l;if(!e.collapsed&&(n=v.getParent(t.getNode(e.startContainer,e.startOffset),v.isBlock),r=v.getParent(t.getNode(e.endContainer,e.endOffset),v.isBlock),l=s.schema.getTextBlockElements(),n!=r&&l[n.nodeName]&&l[r.nodeName]&&"false"!==v.getContentEditable(n)&&"false"!==v.getContentEditable(r)))return e.deleteContents(),i=o(n,!1),a=o(r,!0),v.isEmpty(r)||Y(n).append(r.childNodes),Y(r).remove(),i?1==i.nodeType?"BR"==i.nodeName?(e.setStartBefore(i),e.setEndBefore(i)):(e.setStartAfter(i),e.setEndAfter(i)):(e.setStart(i,i.data.length),e.setEnd(i,i.data.length)):a&&(1==a.nodeType?(e.setStartBefore(a),e.setEndBefore(a)):(e.setStart(a,0),e.setEnd(a,0))),y.setRng(e),!0}function c(e,n){var r,a,l,c,u,d;if(!e.collapsed)return e;if(u=e.startContainer,d=e.startOffset,3==u.nodeType)if(n){if(d0)return e;if(r=t.getNode(e.startContainer,e.startOffset),l=v.getParent(r,v.isBlock),a=o(s.getBody(),n,r),c=v.getParent(a,v.isBlock),!r||!a)return e;if(c&&l!=c)if(n){if(!i(l,c))return e;1==r.nodeType?"BR"==r.nodeName?e.setStartBefore(r):e.setStartAfter(r):e.setStart(r,r.data.length),1==a.nodeType?e.setEnd(a,0):e.setEndBefore(a)}else{if(!i(c,l))return e;1==a.nodeType?"BR"==a.nodeName?e.setStartBefore(a):e.setStartAfter(a):e.setStart(a,a.data.length),1==r.nodeType?e.setEnd(r,0):e.setEndBefore(r)}return e}function h(e){var t=y.getRng();return t=c(t,e),l(t)?!0:void 0}function m(e){var t,n,r;h(e)||(a.each(s.getBody().getElementsByTagName("*"),function(e){"SPAN"==e.tagName&&e.setAttribute("mce-data-marked",1),!e.hasAttribute("data-mce-style")&&e.hasAttribute("style")&&s.dom.setAttrib(e,"style",s.dom.getAttrib(e,"style"))}),t=new b(function(){}),t.observe(s.getDoc(),{childList:!0,attributes:!0,subtree:!0,attributeFilter:["style"]}),s.getDoc().execCommand(e?"ForwardDelete":"Delete",!1,null),n=s.selection.getRng(),r=n.startContainer.parentNode,a.each(t.takeRecords(),function(e){if(v.isChildOf(e.target,s.getBody())){if("style"==e.attributeName){var t=e.target.getAttribute("data-mce-style");t?e.target.setAttribute("style",t):e.target.removeAttribute("style")}a.each(e.addedNodes,function(e){if("SPAN"==e.nodeName&&!e.getAttribute("mce-data-marked")){var t,i;e==r&&(t=n.startOffset,i=e.firstChild),v.remove(e,!0),i&&(n.setStart(i,t),n.setEnd(i,t),s.selection.setRng(n))}})}}),t.disconnect(),a.each(s.dom.select("span[mce-data-marked]"),function(e){e.removeAttribute("mce-data-marked")}))}var g=s.getDoc(),v=s.dom,y=s.selection,b=window.MutationObserver,C,x;b||(C=!0,b=function(){function e(e){var t=e.relatedNode||e.target;n.push({target:t,addedNodes:[t]})}function t(e){var t=e.relatedNode||e.target;n.push({target:t,attributeName:e.attrName})}var n=[],r;this.observe=function(n){r=n,r.addEventListener("DOMSubtreeModified",e,!1),r.addEventListener("DOMNodeInsertedIntoDocument",e,!1),r.addEventListener("DOMNodeInserted",e,!1),r.addEventListener("DOMAttrModified",t,!1)},this.disconnect=function(){r.removeEventListener("DOMSubtreeModified",e,!1),r.removeEventListener("DOMNodeInsertedIntoDocument",e,!1),r.removeEventListener("DOMNodeInserted",e,!1),r.removeEventListener("DOMAttrModified",t,!1)},this.takeRecords=function(){return n}}),s.on("keydown",function(e){var t=e.keyCode==X,n=e.ctrlKey||e.metaKey;if(!u(e)&&(t||e.keyCode==G)){var r=s.selection.getRng(),i=r.startContainer,o=r.startOffset;if(!n&&r.collapsed&&3==i.nodeType&&(t?o0))return;e.preventDefault(),n&&s.selection.getSel().modify("extend",t?"forward":"backward",e.metaKey?"lineboundary":"word"),m(t)}}),s.on("keypress",function(t){if(!u(t)&&!y.isCollapsed()&&t.charCode&&!e.metaKeyPressed(t)){var n,r,i,o,a,l;n=s.selection.getRng(),l=String.fromCharCode(t.charCode),t.preventDefault(),r=Y(n.startContainer).parents().filter(function(e,t){return!!s.schema.getTextInlineElements()[t.nodeName]}),m(!0),r=r.filter(function(e,t){return!Y.contains(s.getBody(),t)}),r.length?(i=v.createFragment(),r.each(function(e,t){t=t.cloneNode(!1),i.hasChildNodes()?(t.appendChild(i.firstChild),i.appendChild(t)):(a=t,i.appendChild(t)),i.appendChild(t)}),a.appendChild(s.getDoc().createTextNode(l)),o=v.getParent(n.startContainer,v.isBlock),v.isEmpty(o)?Y(o).empty().append(i):n.insertNode(i),n.setStart(a.firstChild,1),n.setEnd(a.firstChild,1),s.selection.setRng(n)):s.selection.setContent(l)}}),s.addCommand("Delete",function(){m()}),s.addCommand("ForwardDelete",function(){m(!0)}),C||(s.on("dragstart",function(e){x=y.getRng(),d(e)}),s.on("drop",function(e){if(!u(e)){var n=f(e);n&&(e.preventDefault(),window.setTimeout(function(){var r=t.getCaretRangeFromPoint(e.x,e.y,g);x&&(y.setRng(x),x=null),m(),y.setRng(r),p(n)},0))}}),s.on("cut",function(e){!u(e)&&e.clipboardData&&(e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/html",s.selection.getContent()),e.clipboardData.setData("text/plain",s.selection.getContent({format:"text"})),m(!0))}))}function m(){function e(e){var t=J.create("body"),n=e.cloneContents();return t.appendChild(n),Q.serializer.serialize(t,{format:"html"})}function n(n){if(!n.setStart){if(n.item)return!1;var r=n.duplicate();return r.moveToElementText(s.getBody()),t.compareRanges(n,r)}var i=e(n),o=J.createRng();o.selectNode(s.getBody());var a=e(o);return i===a}s.on("keydown",function(e){var t=e.keyCode,r,i;if(!u(e)&&(t==X||t==G)){if(r=s.selection.isCollapsed(),i=s.getBody(),r&&!J.isEmpty(i))return;if(!r&&!n(s.selection.getRng()))return;e.preventDefault(),s.setContent(""),i.firstChild&&J.isBlock(i.firstChild)?s.selection.setCursorLocation(i.firstChild,0):s.selection.setCursorLocation(i,0),s.nodeChanged()}})}function g(){s.shortcuts.add("meta+a",null,"SelectAll")}function v(){s.settings.content_editable||(J.bind(s.getDoc(),"focusin",function(){Q.setRng(Q.getRng())}),J.bind(s.getDoc(),"mousedown mouseup",function(e){e.target==s.getDoc().documentElement&&(s.getBody().focus(),"mousedown"==e.type?Q.placeCaretAt(e.clientX,e.clientY):Q.setRng(Q.getRng()))}))}function y(){s.on("keydown",function(e){if(!u(e)&&e.keyCode===G){if(!s.getBody().getElementsByTagName("hr").length)return;if(Q.isCollapsed()&&0===Q.getRng(!0).startOffset){var t=Q.getNode(),n=t.previousSibling;if("HR"==t.nodeName)return J.remove(t),void e.preventDefault();n&&n.nodeName&&"hr"===n.nodeName.toLowerCase()&&(J.remove(n),e.preventDefault())}}})}function b(){window.Range.prototype.getClientRects||s.on("mousedown",function(e){if(!u(e)&&"HTML"===e.target.nodeName){var t=s.getBody();t.blur(),setTimeout(function(){t.focus()},0)}})}function C(){s.on("click",function(e){var t=e.target;/^(IMG|HR)$/.test(t.nodeName)&&(e.preventDefault(),Q.getSel().setBaseAndExtent(t,0,t,1),s.nodeChanged()),"A"==t.nodeName&&J.hasClass(t,"mce-item-anchor")&&(e.preventDefault(),Q.select(t))})}function x(){function e(){var e=J.getAttribs(Q.getStart().cloneNode(!1));return function(){var t=Q.getStart();t!==s.getBody()&&(J.setAttrib(t,"style",null),K(e,function(e){t.setAttributeNode(e.cloneNode(!0))}))}}function t(){return!Q.isCollapsed()&&J.getParent(Q.getStart(),J.isBlock)!=J.getParent(Q.getEnd(),J.isBlock)}s.on("keypress",function(n){var r;return u(n)||8!=n.keyCode&&46!=n.keyCode||!t()?void 0:(r=e(),s.getDoc().execCommand("delete",!1,null),r(),n.preventDefault(),!1)}),J.bind(s.getDoc(),"cut",function(n){var r;!u(n)&&t()&&(r=e(),setTimeout(function(){r()},0))})}function w(){document.body.setAttribute("role","application")}function _(){s.on("keydown",function(e){if(!u(e)&&e.keyCode===G&&Q.isCollapsed()&&0===Q.getRng(!0).startOffset){var t=Q.getNode().previousSibling;if(t&&t.nodeName&&"table"===t.nodeName.toLowerCase())return e.preventDefault(),!1}})}function E(){c()>7||(l("RespectVisibilityInDesign",!0),s.contentStyles.push(".mceHideBrInPre pre br {display: none}"),J.addClass(s.getBody(),"mceHideBrInPre"),ee.addNodeFilter("pre",function(e){for(var t=e.length,n,i,o,a;t--;)for(n=e[t].getAll("br"),i=n.length;i--;)o=n[i],a=o.prev,a&&3===a.type&&"\n"!=a.value.charAt(a.value-1)?a.value+="\n":o.parent.insert(new r("#text",3),o,!0).value="\n"}),te.addNodeFilter("pre",function(e){for(var t=e.length,n,r,i,o;t--;)for(n=e[t].getAll("br"),r=n.length;r--;)i=n[r],o=i.prev,o&&3==o.type&&(o.value=o.value.replace(/\r?\n$/,""))}))}function N(){J.bind(s.getBody(),"mouseup",function(){var e,t=Q.getNode();"IMG"==t.nodeName&&((e=J.getStyle(t,"width"))&&(J.setAttrib(t,"width",e.replace(/[^0-9%]+/g,"")),J.setStyle(t,"width","")),(e=J.getStyle(t,"height"))&&(J.setAttrib(t,"height",e.replace(/[^0-9%]+/g,"")),J.setStyle(t,"height","")))})}function k(){s.on("keydown",function(t){var n,r,i,o,a;if(!u(t)&&t.keyCode==e.BACKSPACE&&(n=Q.getRng(),r=n.startContainer,i=n.startOffset,o=J.getRoot(),a=r,n.collapsed&&0===i)){for(;a&&a.parentNode&&a.parentNode.firstChild==a&&a.parentNode!=o;)a=a.parentNode;"BLOCKQUOTE"===a.tagName&&(s.formatter.toggle("blockquote",null,a),n=J.createRng(),n.setStart(r,0),n.setEnd(r,0),Q.setRng(n))}})}function S(){function e(){s._refreshContentEditable(),l("StyleWithCSS",!1),l("enableInlineTableEditing",!1),Z.object_resizing||l("enableObjectResizing",!1)}Z.readonly||s.on("BeforeExecCommand MouseDown",e)}function T(){function e(){K(J.select("a"),function(e){var t=e.parentNode,n=J.getRoot();if(t.lastChild===e){for(;t&&!J.isBlock(t);){if(t.parentNode.lastChild!==t||t===n)return;t=t.parentNode}J.add(t,"br",{"data-mce-bogus":1})}})}s.on("SetContent ExecCommand",function(t){("setcontent"==t.type||"mceInsertLink"===t.command)&&e()})}function R(){Z.forced_root_block&&s.on("init",function(){l("DefaultParagraphSeparator",Z.forced_root_block)})}function A(){s.on("Undo Redo SetContent",function(e){e.initial||s.execCommand("mceRepaint")})}function B(){s.on("keydown",function(e){var t;u(e)||e.keyCode!=G||(t=s.getDoc().selection.createRange(),t&&t.item&&(e.preventDefault(),s.undoManager.beforeChange(),J.remove(t.item(0)),s.undoManager.add()))})}function D(){var e;c()>=10&&(e="",K("p div h1 h2 h3 h4 h5 h6".split(" "),function(t,n){e+=(n>0?",":"")+t+":empty"}),s.contentStyles.push(e+"{padding-right: 1px !important}"))}function M(){c()<9&&(ee.addNodeFilter("noscript",function(e){for(var t=e.length,n,r;t--;)n=e[t],r=n.firstChild,r&&n.attr("data-mce-innertext",r.value)}),te.addNodeFilter("noscript",function(e){for(var t=e.length,n,o,a;t--;)n=e[t],o=e[t].firstChild,o?o.value=i.decode(o.value):(a=n.attributes.map["data-mce-innertext"],a&&(n.attr("data-mce-innertext",null),o=new r("#text",3),o.value=a,o.raw=!0,n.append(o)))}))}function H(){function e(e,t){var n=i.createTextRange();try{n.moveToPoint(e,t)}catch(r){n=null}return n}function t(t){var r;t.button?(r=e(t.x,t.y),r&&(r.compareEndPoints("StartToStart",a)>0?r.setEndPoint("StartToStart",a):r.setEndPoint("EndToEnd",a),r.select())):n()}function n(){var e=r.selection.createRange();a&&!e.item&&0===e.compareEndPoints("StartToEnd",e)&&a.select(),J.unbind(r,"mouseup",n),J.unbind(r,"mousemove",t),a=o=0}var r=J.doc,i=r.body,o,a,s;r.documentElement.unselectable=!0,J.bind(r,"mousedown contextmenu",function(i){if("HTML"===i.target.nodeName){if(o&&n(),s=r.documentElement,s.scrollHeight>s.clientHeight)return;o=1,a=e(i.x,i.y),a&&(J.bind(r,"mouseup",n),J.bind(r,"mousemove",t),J.getRoot().focus(),a.select())}})}function L(){s.on("keyup focusin mouseup",function(t){65==t.keyCode&&e.metaKeyPressed(t)||Q.normalize()},!0)}function P(){s.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")}function O(){s.inline||s.on("keydown",function(){document.activeElement==document.body&&s.getWin().focus()})}function I(){s.inline||(s.contentStyles.push("body {min-height: 150px}"),s.on("click",function(e){if("HTML"==e.target.nodeName){var t;t=s.selection.getRng(),s.getBody().focus(),s.selection.setRng(t),s.selection.normalize(),s.nodeChanged()}}))}function F(){o.mac&&s.on("keydown",function(t){!e.metaKeyPressed(t)||37!=t.keyCode&&39!=t.keyCode||(t.preventDefault(),s.selection.getSel().modify("move",37==t.keyCode?"backward":"forward","lineboundary"))})}function z(){l("AutoUrlDetect",!1)}function W(){s.inline||s.on("focus blur beforegetcontent",function(){var e=s.dom.create("br");s.getBody().appendChild(e),e.parentNode.removeChild(e)},!0)}function V(){s.on("click",function(e){var t=e.target;do if("A"===t.tagName)return void e.preventDefault();while(t=t.parentNode)}),s.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")}function U(){s.on("touchstart",function(e){var t,n,r,i;t=e.target,n=(new Date).getTime(),i=e.changedTouches,!i||i.length>1||(r=i[0],s.once("touchend",function(e){var i=e.changedTouches[0],o;(new Date).getTime()-n>500||Math.abs(r.clientX-i.clientX)>5||Math.abs(r.clientY-i.clientY)>5||(o={target:t},K("pageX pageY clientX clientY screenX screenY".split(" "),function(e){o[e]=i[e]}),o=s.fire("click",o),o.isDefaultPrevented()||(s.selection.placeCaretAt(i.clientX,i.clientY),s.nodeChanged()))}))})}function $(){s.on("init",function(){s.dom.bind(s.getBody(),"submit",function(e){e.preventDefault()})})}function q(){ee.addNodeFilter("br",function(e){for(var t=e.length;t--;)"Apple-interchange-newline"==e[t].attr("class")&&e[t].remove()})}function j(){s.on("dragstart",function(e){d(e)}),s.on("drop",function(e){if(!u(e)){var n=f(e);if(n){e.preventDefault();var r=t.getCaretRangeFromPoint(e.x,e.y,s.getDoc());Q.setRng(r),p(n)}}})}var K=a.each,Y=s.$,G=e.BACKSPACE,X=e.DELETE,J=s.dom,Q=s.selection,Z=s.settings,ee=s.parser,te=s.serializer,ne=o.gecko,re=o.ie,ie=o.webkit,oe="data:text/mce-internal,",ae=re?"Text":"URL";k(),m(),L(),ie&&(h(),v(),C(),R(),$(),_(),q(),U(),o.iOS?(O(),I(),V()):g()),re&&o.ie<11&&(y(),w(),E(),N(),B(),D(),M(),H()),o.ie>=11&&(I(),W(),_()),o.ie&&(g(),z(),j()),ne&&(y(),b(),x(),S(),T(),A(),P(),F(),_())}}),r(le,[$],function(e){function t(t){return t._eventDispatcher||(t._eventDispatcher=new e({scope:t,toggleEvent:function(n,r){e.isNative(n)&&t.toggleNativeEvent&&t.toggleNativeEvent(n,r)}})),t._eventDispatcher}return{fire:function(e,n,r){var i=this;if(i.removed&&"remove"!==e)return n;if(n=t(i).fire(e,n,r),r!==!1&&i.parent)for(var o=i.parent();o&&!n.isPropagationStopped();)o.fire(e,n,!1),o=o.parent();return n},on:function(e,n,r){return t(this).on(e,n,r)},off:function(e,n){return t(this).off(e,n)},once:function(e,n){return t(this).once(e,n)},hasEventListeners:function(e){return t(this).has(e)}}}),r(ce,[le,y,d],function(e,t,n){function r(e,t){return"selectionchange"==t?e.getDoc():!e.inline&&/^mouse|click|contextmenu|drop|dragover|dragend/.test(t)?e.getDoc().documentElement:e.settings.event_root?(e.eventRoot||(e.eventRoot=o.select(e.settings.event_root)[0]),e.eventRoot):e.getBody()}function i(e,t){var n=r(e,t),i;if(e.delegates||(e.delegates={}),!e.delegates[t])if(e.settings.event_root){if(a||(a={},e.editorManager.on("removeEditor",function(){var t;if(!e.editorManager.activeEditor&&a){for(t in a)e.dom.unbind(r(e,t));a=null}})),a[t])return;i=function(n){for(var r=n.target,i=e.editorManager.editors,a=i.length;a--;){var s=i[a].getBody();(s===r||o.isChildOf(r,s))&&(i[a].hidden||i[a].fire(t,n))}},a[t]=i,o.bind(n,t,i)}else i=function(n){e.hidden||e.fire(t,n)},o.bind(n,t,i),e.delegates[t]=i}var o=t.DOM,a,s={bindPendingEventDelegates:function(){var e=this;n.each(e._pendingNativeEvents,function(t){i(e,t)})},toggleNativeEvent:function(e,t){var n=this;n.settings.readonly||"focus"!=e&&"blur"!=e&&(t?n.initialized?i(n,e):n._pendingNativeEvents?n._pendingNativeEvents.push(e):n._pendingNativeEvents=[e]:n.initialized&&(n.dom.unbind(r(n,e),e,n.delegates[e]),delete n.delegates[e]))},unbindAllNativeEvents:function(){var e=this,t;if(e.delegates){for(t in e.delegates)e.dom.unbind(r(e,t),t,e.delegates[t]);delete e.delegates}e.inline||(e.getBody().onload=null,e.dom.unbind(e.getWin()),e.dom.unbind(e.getDoc())),e.dom.unbind(e.getBody()),e.dom.unbind(e.getContainer())}};return s=n.extend({},e,s)}),r(ue,[d,u],function(e,t){var n=e.each,r=e.explode,i={f9:120,f10:121,f11:122},o=e.makeMap("alt,ctrl,shift,meta,access");return function(a){function s(e,s,l,c){var u,d,f;f={func:l,scope:c||a,desc:a.translate(s)},n(r(e,"+"),function(e){e in o?f[e]=!0:/^[0-9]{2,}$/.test(e)?f.keyCode=parseInt(e,10):(f.charCode=e.charCodeAt(0),f.keyCode=i[e]||e.toUpperCase().charCodeAt(0))}),u=[f.keyCode];for(d in o)f[d]?u.push(d):f[d]=!1;return f.id=u.join(","),f.access&&(f.alt=!0,t.mac?f.ctrl=!0:f.shift=!0),f.meta&&(t.mac?f.meta=!0:(f.ctrl=!0,f.meta=!1)),f}var l=this,c={};a.on("keyup keypress keydown",function(e){(e.altKey||e.ctrlKey||e.metaKey)&&!e.isDefaultPrevented()&&n(c,function(t){return t.ctrl==e.ctrlKey&&t.meta==e.metaKey&&t.alt==e.altKey&&t.shift==e.shiftKey&&(e.keyCode==t.keyCode||e.charCode&&e.charCode==t.charCode)?(e.preventDefault(),"keydown"==e.type&&t.func.call(t.scope),!0):void 0})}),l.add=function(t,i,o,l){var u;return u=o,"string"==typeof o?o=function(){a.execCommand(u,!1,null)}:e.isArray(u)&&(o=function(){a.execCommand(u[0],u[1],u[2])}),n(r(t.toLowerCase()),function(e){var t=s(e,i,o,l);c[t.id]=t}),!0},l.remove=function(e){var t=s(e);return c[t.id]?(delete c[t.id],!0):!1}}}),r(de,[y,f,C,w,_,R,T,H,O,I,F,z,W,V,b,l,ae,E,k,se,u,d,ce,ue],function(e,n,r,i,o,a,s,l,c,u,d,f,p,h,m,g,v,y,b,C,x,w,_,E){function N(e,t,i){var o=this,a,s;a=o.documentBaseUrl=i.documentBaseURL,s=i.baseURI,o.settings=t=R({id:e,theme:"modern",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:a,add_form_submit_trigger:!0,submit_patch:!0,add_unload_trigger:!0,convert_urls:!0,relative_urls:!0,remove_script_host:!0,object_resizing:!0,doctype:"",visual:!0,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",forced_root_block:"p",hidden_input:!0,padd_empty_editor:!0,render_ui:!0,indentation:"30px",inline_styles:!0,convert_fonts_to_spans:!0,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",validate:!0,entity_encoding:"named",url_converter:o.convertURL,url_converter_scope:o,ie7_compat:!0},t),r.language=t.language||"en",r.languageLoad=t.language_load,r.baseURL=i.baseURL,o.id=t.id=e,o.isNotDirty=!0,o.plugins={},o.documentBaseURI=new h(t.document_base_url||a,{base_uri:s}),o.baseURI=s,o.contentCSS=[],o.contentStyles=[],o.shortcuts=new E(o),o.loadedCSS={},o.editorCommands=new p(o),t.target&&(o.targetElm=t.target),o.suffix=i.suffix,o.editorManager=i,o.inline=t.inline,t.cache_suffix&&(x.cacheSuffix=t.cache_suffix.replace(/^[\?\&]+/,"")),i.fire("SetupEditor",o),o.execCallback("setup",o),o.$=n.overrideDefaults(function(){return{context:o.inline?o.getBody():o.getDoc(),element:o.getBody()}})}var k=e.DOM,S=r.ThemeManager,T=r.PluginManager,R=w.extend,A=w.each,B=w.explode,D=w.inArray,M=w.trim,H=w.resolve,L=g.Event,P=x.gecko,O=x.ie;return N.prototype={render:function(){function e(){k.unbind(window,"ready",e),n.render()}function t(){var e=m.ScriptLoader;if(r.language&&"en"!=r.language&&!r.language_url&&(r.language_url=n.editorManager.baseURL+"/langs/"+r.language+".js"),r.language_url&&e.add(r.language_url),r.theme&&"function"!=typeof r.theme&&"-"!=r.theme.charAt(0)&&!S.urls[r.theme]){var t=r.theme_url;t=t?n.documentBaseURI.toAbsolute(t):"themes/"+r.theme+"/theme"+o+".js",S.load(r.theme,t)}w.isArray(r.plugins)&&(r.plugins=r.plugins.join(" ")),A(r.external_plugins,function(e,t){T.load(t,e),r.plugins+=" "+t}),A(r.plugins.split(/[ ,]/),function(e){if(e=M(e),e&&!T.urls[e])if("-"==e.charAt(0)){e=e.substr(1,e.length);var t=T.dependencies(e);A(t,function(e){var t={prefix:"plugins/",resource:e,suffix:"/plugin"+o+".js"};e=T.createUrl(t,e),T.load(e.resource,e)})}else T.load(e,{prefix:"plugins/",resource:e,suffix:"/plugin"+o+".js"})}),e.loadQueue(function(){n.removed||n.init()})}var n=this,r=n.settings,i=n.id,o=n.suffix;if(!L.domLoaded)return void k.bind(window,"ready",e);if(n.getElement()&&x.contentEditable){r.inline?n.inline=!0:(n.orgVisibility=n.getElement().style.visibility,n.getElement().style.visibility="hidden");var a=n.getElement().form||k.getParent(i,"form");a&&(n.formElement=a,r.hidden_input&&!/TEXTAREA|INPUT/i.test(n.getElement().nodeName)&&(k.insertAfter(k.create("input",{type:"hidden",name:i}),i),n.hasHiddenInput=!0),n.formEventDelegate=function(e){n.fire(e.type,e)},k.bind(a,"submit reset",n.formEventDelegate),n.on("reset",function(){n.setContent(n.startContent,{format:"raw"})}),!r.submit_patch||a.submit.nodeType||a.submit.length||a._mceOldSubmit||(a._mceOldSubmit=a.submit,a.submit=function(){return n.editorManager.triggerSave(),n.isNotDirty=!0,a._mceOldSubmit(a)})),n.windowManager=new v(n),"xml"==r.encoding&&n.on("GetContent",function(e){e.save&&(e.content=k.encode(e.content))}),r.add_form_submit_trigger&&n.on("submit",function(){n.initialized&&n.save()}),r.add_unload_trigger&&(n._beforeUnload=function(){!n.initialized||n.destroyed||n.isHidden()||n.save({format:"raw",no_events:!0,set_dirty:!1})},n.editorManager.on("BeforeUnload",n._beforeUnload)),t()}},init:function(){function e(n){var r=T.get(n),i,o;i=T.urls[n]||t.documentBaseUrl.replace(/\/$/,""),n=M(n),r&&-1===D(m,n)&&(A(T.dependencies(n),function(t){e(t)}),o=new r(t,i,t.$),t.plugins[n]=o,o.init&&(o.init(t,i),m.push(n)))}var t=this,n=t.settings,r=t.getElement(),i,o,a,s,l,c,u,d,f,p,h,m=[];if(this.editorManager.i18n.setCode(n.language),t.rtl=this.editorManager.i18n.rtl,t.editorManager.add(t),n.aria_label=n.aria_label||k.getAttrib(r,"aria-label",t.getLang("aria.rich_text_area")),n.theme&&("function"!=typeof n.theme?(n.theme=n.theme.replace(/-/,""),c=S.get(n.theme),t.theme=new c(t,S.urls[n.theme]),t.theme.init&&t.theme.init(t,S.urls[n.theme]||t.documentBaseUrl.replace(/\/$/,""),t.$)):t.theme=n.theme),A(n.plugins.replace(/\-/g,"").split(/[ ,]/),e),n.render_ui&&t.theme&&(t.orgDisplay=r.style.display,"function"!=typeof n.theme?(i=n.width||r.style.width||r.offsetWidth,o=n.height||r.style.height||r.offsetHeight,a=n.min_height||100,p=/^[0-9\.]+(|px)$/i,p.test(""+i)&&(i=Math.max(parseInt(i,10),100)),p.test(""+o)&&(o=Math.max(parseInt(o,10),a)),l=t.theme.renderUI({targetNode:r,width:i,height:o,deltaWidth:n.delta_width,deltaHeight:n.delta_height}),n.content_editable||(o=(l.iframeHeight||o)+("number"==typeof o?l.deltaHeight||0:""),a>o&&(o=a))):(l=n.theme(t,r),l.editorContainer.nodeType&&(l.editorContainer=l.editorContainer.id=l.editorContainer.id||t.id+"_parent"),l.iframeContainer.nodeType&&(l.iframeContainer=l.iframeContainer.id=l.iframeContainer.id||t.id+"_iframecontainer"),o=l.iframeHeight||r.offsetHeight),t.editorContainer=l.editorContainer),n.content_css&&A(B(n.content_css),function(e){t.contentCSS.push(t.documentBaseURI.toAbsolute(e))}),n.content_style&&t.contentStyles.push(n.content_style),n.content_editable)return r=s=l=null,t.initContentBody();for(t.iframeHTML=n.doctype+"",n.document_base_url!=t.documentBaseUrl&&(t.iframeHTML+=''),!x.caretAfter&&n.ie7_compat&&(t.iframeHTML+=''),t.iframeHTML+='',h=0;h',t.loadedCSS[g]=!0}d=n.body_id||"tinymce",-1!=d.indexOf("=")&&(d=t.getParam("body_id","","hash"),d=d[t.id]||d),f=n.body_class||"",-1!=f.indexOf("=")&&(f=t.getParam("body_class","","hash"),f=f[t.id]||""),n.content_security_policy&&(t.iframeHTML+=''),t.iframeHTML+='
    ';var v='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinymce.get("'+t.id+'");document.write(ed.iframeHTML);document.close();ed.initContentBody(true);})()';document.domain!=location.hostname&&(u=v);var y=k.create("iframe",{id:t.id+"_ifr",frameBorder:"0",allowTransparency:"true",title:t.editorManager.translate("Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help"),style:{width:"100%",height:o,display:"block"}});if(y.onload=function(){y.onload=null,t.fire("load")},k.setAttrib(y,"src",u||'javascript:""'),t.contentAreaContainer=l.iframeContainer,t.iframeElement=y,s=k.add(l.iframeContainer,y),O)try{t.getDoc()}catch(b){s.src=u=v}l.editorContainer&&(k.get(l.editorContainer).style.display=t.orgDisplay,t.hidden=k.isHidden(l.editorContainer)),t.getElement().style.display="none",k.setAttrib(t.id,"aria-hidden",!0),u||t.initContentBody(),r=s=l=null},initContentBody:function(t){var n=this,r=n.settings,s=n.getElement(),p=n.getDoc(),h,m;r.inline||(n.getElement().style.visibility=n.orgVisibility),t||r.content_editable||(p.open(),p.write(n.iframeHTML),p.close()),r.content_editable&&(n.on("remove",function(){var e=this.getBody();k.removeClass(e,"mce-content-body"),k.removeClass(e,"mce-edit-focus"),k.setAttrib(e,"contentEditable",null)}),k.addClass(s,"mce-content-body"),n.contentDocument=p=r.content_document||document,n.contentWindow=r.content_window||window,n.bodyElement=s,r.content_document=r.content_window=null,r.root_name=s.nodeName.toLowerCase()),h=n.getBody(),h.disabled=!0,r.readonly||(n.inline&&"static"==k.getStyle(h,"position",!0)&&(h.style.position="relative"),h.contentEditable=n.getParam("content_editable_state",!0)),h.disabled=!1,n.schema=new y(r),n.dom=new e(p,{keep_values:!0,url_converter:n.convertURL,url_converter_scope:n,hex_colors:r.force_hex_style_colors,class_filter:r.class_filter,update_styles:!0,root_element:n.inline?n.getBody():null,collect:r.content_editable,schema:n.schema,onSetAttrib:function(e){n.fire("SetAttrib",e)}}),n.parser=new b(r,n.schema),n.parser.addAttributeFilter("src,href,style,tabindex",function(e,t){for(var r=e.length,i,o=n.dom,a,s;r--;)i=e[r],a=i.attr(t),s="data-mce-"+t,i.attributes.map[s]||("style"===t?(a=o.serializeStyle(o.parseStyle(a),i.name),a.length||(a=null),i.attr(s,a),i.attr(t,a)):"tabindex"===t?(i.attr(s,a),i.attr(t,null)):i.attr(s,n.convertURL(a,t,i.name)))}),n.parser.addNodeFilter("script",function(e){for(var t=e.length,n;t--;)n=e[t],n.attr("type","mce-"+(n.attr("type")||"no/type"))}),n.parser.addNodeFilter("#cdata",function(e){for(var t=e.length,n;t--;)n=e[t],n.type=8,n.name="#comment",n.value="[CDATA["+n.value+"]]"}),n.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(e){for(var t=e.length,r,i=n.schema.getNonEmptyElements();t--;)r=e[t],r.isEmpty(i)&&(r.append(new o("br",1)).shortEnded=!0)}),n.serializer=new a(r,n),n.selection=new l(n.dom,n.getWin(),n.serializer,n),n.formatter=new c(n),n.undoManager=new u(n),n.forceBlocks=new f(n),n.enterKey=new d(n),n._nodeChangeDispatcher=new i(n),n.fire("PreInit"),r.browser_spellcheck||r.gecko_spellcheck||(p.body.spellcheck=!1,k.setAttrib(h,"spellcheck","false")),n.fire("PostRender"),n.quirks=new C(n),r.directionality&&(h.dir=r.directionality),r.nowrap&&(h.style.whiteSpace="nowrap"),r.protect&&n.on("BeforeSetContent",function(e){A(r.protect,function(t){e.content=e.content.replace(t,function(e){return""})})}),n.on("SetContent",function(){n.addVisual(n.getBody())}),r.padd_empty_editor&&n.on("PostProcess",function(e){e.content=e.content.replace(/^(]*>( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,"")}),n.load({initial:!0,format:"html"}),n.startContent=n.getContent({format:"raw"}),n.initialized=!0,n.bindPendingEventDelegates(),n.fire("init"),n.focus(!0),n.nodeChanged({initial:!0}),n.execCallback("init_instance_callback",n),n.contentStyles.length>0&&(m="",A(n.contentStyles,function(e){m+=e+"\r\n"}),n.dom.addStyle(m)),A(n.contentCSS,function(e){n.loadedCSS[e]||(n.dom.loadCSS(e),n.loadedCSS[e]=!0)}),r.auto_focus&&setTimeout(function(){var e;e=r.auto_focus===!0?n:n.editorManager.get(r.auto_focus),e.destroyed||e.focus()},100),s=p=h=null},focus:function(e){var t=this,n=t.selection,r=t.settings.content_editable,i,o,a=t.getDoc(),s;if(!e){if(i=n.getRng(),i.item&&(o=i.item(0)),t._refreshContentEditable(),r||(x.opera||t.getBody().focus(),t.getWin().focus()),P||r){if(s=t.getBody(),s.setActive)try{s.setActive()}catch(l){s.focus()}else s.focus();r&&n.normalize()}o&&o.ownerDocument==a&&(i=a.body.createControlRange(),i.addElement(o),i.select())}t.editorManager.setActive(t)},execCallback:function(e){var t=this,n=t.settings[e],r;if(n)return t.callbackLookup&&(r=t.callbackLookup[e])&&(n=r.func,r=r.scope),"string"==typeof n&&(r=n.replace(/\.\w+$/,""),r=r?H(r):0,n=H(n),t.callbackLookup=t.callbackLookup||{},t.callbackLookup[e]={func:n,scope:r}),n.apply(r||t,Array.prototype.slice.call(arguments,1))},translate:function(e){var t=this.settings.language||"en",n=this.editorManager.i18n;return e?n.data[t+"."+e]||e.replace(/\{\#([^\}]+)\}/g,function(e,r){return n.data[t+"."+r]||"{#"+r+"}"}):""},getLang:function(e,n){return this.editorManager.i18n.data[(this.settings.language||"en")+"."+e]||(n!==t?n:"{#"+e+"}")},getParam:function(e,t,n){var r=e in this.settings?this.settings[e]:t,i;return"hash"===n?(i={},"string"==typeof r?A(r.split(r.indexOf("=")>0?/[;,](?![^=;,]*(?:[;,]|$))/:","),function(e){e=e.split("="),e.length>1?i[M(e[0])]=M(e[1]):i[M(e[0])]=M(e)}):i=r,i):r},nodeChanged:function(e){this._nodeChangeDispatcher.nodeChanged(e); + +},addButton:function(e,t){var n=this;t.cmd&&(t.onclick=function(){n.execCommand(t.cmd)}),t.text||t.icon||(t.icon=e),n.buttons=n.buttons||{},t.tooltip=t.tooltip||t.title,n.buttons[e]=t},addMenuItem:function(e,t){var n=this;t.cmd&&(t.onclick=function(){n.execCommand(t.cmd)}),n.menuItems=n.menuItems||{},n.menuItems[e]=t},addCommand:function(e,t,n){this.editorCommands.addCommand(e,t,n)},addQueryStateHandler:function(e,t,n){this.editorCommands.addQueryStateHandler(e,t,n)},addQueryValueHandler:function(e,t,n){this.editorCommands.addQueryValueHandler(e,t,n)},addShortcut:function(e,t,n,r){this.shortcuts.add(e,t,n,r)},execCommand:function(e,t,n,r){return this.editorCommands.execCommand(e,t,n,r)},queryCommandState:function(e){return this.editorCommands.queryCommandState(e)},queryCommandValue:function(e){return this.editorCommands.queryCommandValue(e)},queryCommandSupported:function(e){return this.editorCommands.queryCommandSupported(e)},show:function(){var e=this;e.hidden&&(e.hidden=!1,e.inline?e.getBody().contentEditable=!0:(k.show(e.getContainer()),k.hide(e.id)),e.load(),e.fire("show"))},hide:function(){var e=this,t=e.getDoc();e.hidden||(O&&t&&!e.inline&&t.execCommand("SelectAll"),e.save(),e.inline?(e.getBody().contentEditable=!1,e==e.editorManager.focusedEditor&&(e.editorManager.focusedEditor=null)):(k.hide(e.getContainer()),k.setStyle(e.id,"display",e.orgDisplay)),e.hidden=!0,e.fire("hide"))},isHidden:function(){return!!this.hidden},setProgressState:function(e,t){this.fire("ProgressState",{state:e,time:t})},load:function(e){var n=this,r=n.getElement(),i;return r?(e=e||{},e.load=!0,i=n.setContent(r.value!==t?r.value:r.innerHTML,e),e.element=r,e.no_events||n.fire("LoadContent",e),e.element=r=null,i):void 0},save:function(e){var t=this,n=t.getElement(),r,i;if(n&&t.initialized)return e=e||{},e.save=!0,e.element=n,r=e.content=t.getContent(e),e.no_events||t.fire("SaveContent",e),r=e.content,/TEXTAREA|INPUT/i.test(n.nodeName)?n.value=r:(t.inline||(n.innerHTML=r),(i=k.getParent(t.id,"form"))&&A(i.elements,function(e){return e.name==t.id?(e.value=r,!1):void 0})),e.element=n=null,e.set_dirty!==!1&&(t.isNotDirty=!0),r},setContent:function(e,t){var n=this,r=n.getBody(),i;return t=t||{},t.format=t.format||"html",t.set=!0,t.content=e,t.no_events||n.fire("BeforeSetContent",t),e=t.content,0===e.length||/^\s+$/.test(e)?(i=n.settings.forced_root_block,i&&n.schema.isValidChild(r.nodeName.toLowerCase(),i.toLowerCase())?(e=O&&11>O?"":'
    ',e=n.dom.createHTML(i,n.settings.forced_root_block_attrs,e)):O||(e='
    '),n.dom.setHTML(r,e),n.fire("SetContent",t)):("raw"!==t.format&&(e=new s({},n.schema).serialize(n.parser.parse(e,{isRootContent:!0}))),t.content=M(e),n.dom.setHTML(r,t.content),t.no_events||n.fire("SetContent",t)),t.content},getContent:function(e){var t=this,n,r=t.getBody();return e=e||{},e.format=e.format||"html",e.get=!0,e.getInner=!0,e.no_events||t.fire("BeforeGetContent",e),n="raw"==e.format?r.innerHTML:"text"==e.format?r.innerText||r.textContent:t.serializer.serialize(r,e),"text"!=e.format?e.content=M(n):e.content=n,e.no_events||t.fire("GetContent",e),e.content},insertContent:function(e,t){t&&(e=R({content:e},t)),this.execCommand("mceInsertContent",!1,e)},isDirty:function(){return!this.isNotDirty},getContainer:function(){var e=this;return e.container||(e.container=k.get(e.editorContainer||e.id+"_parent")),e.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return this.targetElm||(this.targetElm=k.get(this.id)),this.targetElm},getWin:function(){var e=this,t;return e.contentWindow||(t=e.iframeElement,t&&(e.contentWindow=t.contentWindow)),e.contentWindow},getDoc:function(){var e=this,t;return e.contentDocument||(t=e.getWin(),t&&(e.contentDocument=t.document)),e.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(e,t,n){var r=this,i=r.settings;return i.urlconverter_callback?r.execCallback("urlconverter_callback",e,n,!0,t):!i.convert_urls||n&&"LINK"==n.nodeName||0===e.indexOf("file:")||0===e.length?e:i.relative_urls?r.documentBaseURI.toRelative(e):e=r.documentBaseURI.toAbsolute(e,i.remove_script_host)},addVisual:function(e){var n=this,r=n.settings,i=n.dom,o;e=e||n.getBody(),n.hasVisual===t&&(n.hasVisual=r.visual),A(i.select("table,a",e),function(e){var t;switch(e.nodeName){case"TABLE":return o=r.visual_table_class||"mce-item-table",t=i.getAttrib(e,"border"),void(t&&"0"!=t||!n.hasVisual?i.removeClass(e,o):i.addClass(e,o));case"A":return void(i.getAttrib(e,"href",!1)||(t=i.getAttrib(e,"name")||e.id,o=r.visual_anchor_class||"mce-item-anchor",t&&n.hasVisual?i.addClass(e,o):i.removeClass(e,o)))}}),n.fire("VisualAid",{element:e,hasVisual:n.hasVisual})},remove:function(){var e=this;e.removed||(e.save(),e.removed=1,e.unbindAllNativeEvents(),e.hasHiddenInput&&k.remove(e.getElement().nextSibling),e.inline||(O&&10>O&&e.getDoc().execCommand("SelectAll",!1,null),k.setStyle(e.id,"display",e.orgDisplay),e.getBody().onload=null),e.fire("remove"),e.editorManager.remove(e),k.remove(e.getContainer()),e.destroy())},destroy:function(e){var t=this,n;if(!t.destroyed){if(!e&&!t.removed)return void t.remove();e||(t.editorManager.off("beforeunload",t._beforeUnload),t.theme&&t.theme.destroy&&t.theme.destroy(),t.selection.destroy(),t.dom.destroy()),n=t.formElement,n&&(n._mceOldSubmit&&(n.submit=n._mceOldSubmit,n._mceOldSubmit=null),k.unbind(n,"submit reset",t.formEventDelegate)),t.contentAreaContainer=t.formElement=t.container=t.editorContainer=null,t.bodyElement=t.contentDocument=t.contentWindow=null,t.iframeElement=t.targetElm=null,t.selection&&(t.selection=t.selection.win=t.selection.dom=t.selection.dom.doc=null),t.destroyed=1}},_refreshContentEditable:function(){var e=this,t,n;e._isHidden()&&(t=e.getBody(),n=t.parentNode,n.removeChild(t),n.appendChild(t),t.focus())},_isHidden:function(){var e;return P?(e=this.selection.getSel(),!e||!e.rangeCount||0===e.rangeCount):0}},R(N.prototype,_),N}),r(fe,[],function(){var e={},t="en";return{setCode:function(e){e&&(t=e,this.rtl=this.data[e]?"rtl"===this.data[e]._dir:!1)},getCode:function(){return t},rtl:!1,add:function(t,n){var r=e[t];r||(e[t]=r={});for(var i in n)r[i]=n[i];this.setCode(t)},translate:function(n){var r;if(r=e[t],r||(r={}),"undefined"==typeof n)return n;if("string"!=typeof n&&n.raw)return n.raw;if(n.push){var i=n.slice(1);n=(r[n[0]]||n[0]).replace(/\{([0-9]+)\}/g,function(e,t){return i[t]})}return(r[n]||n).replace(/{context:\w+}$/,"")},data:e}}),r(pe,[y,u],function(e,t){function n(e){function s(){try{return document.activeElement}catch(e){return document.body}}function l(e,t){if(t&&t.startContainer){if(!e.isChildOf(t.startContainer,e.getRoot())||!e.isChildOf(t.endContainer,e.getRoot()))return;return{startContainer:t.startContainer,startOffset:t.startOffset,endContainer:t.endContainer,endOffset:t.endOffset}}return t}function c(e,t){var n;return t.startContainer?(n=e.getDoc().createRange(),n.setStart(t.startContainer,t.startOffset),n.setEnd(t.endContainer,t.endOffset)):n=t,n}function u(e){return!!a.getParent(e,n.isEditorUIElement)}function d(n){var d=n.editor;d.on("init",function(){(d.inline||t.ie)&&("onbeforedeactivate"in document&&t.ie<9?d.dom.bind(d.getBody(),"beforedeactivate",function(e){if(e.target==d.getBody())try{d.lastRng=d.selection.getRng()}catch(t){}}):d.on("nodechange mouseup keyup",function(e){var t=s();"nodechange"==e.type&&e.selectionChange||(t&&t.id==d.id+"_ifr"&&(t=d.getBody()),d.dom.isChildOf(t,d.getBody())&&(d.lastRng=d.selection.getRng()))}),t.webkit&&!r&&(r=function(){var t=e.activeEditor;if(t&&t.selection){var n=t.selection.getRng();n&&!n.collapsed&&(d.lastRng=n)}},a.bind(document,"selectionchange",r)))}),d.on("setcontent",function(){d.lastRng=null}),d.on("mousedown",function(){d.selection.lastFocusBookmark=null}),d.on("focusin",function(){var t=e.focusedEditor;d.selection.lastFocusBookmark&&(d.selection.setRng(c(d,d.selection.lastFocusBookmark)),d.selection.lastFocusBookmark=null),t!=d&&(t&&t.fire("blur",{focusedEditor:d}),e.setActive(d),e.focusedEditor=d,d.fire("focus",{blurredEditor:t}),d.focus(!0)),d.lastRng=null}),d.on("focusout",function(){window.setTimeout(function(){var t=e.focusedEditor;u(s())||t!=d||(d.fire("blur",{focusedEditor:null}),e.focusedEditor=null,d.selection&&(d.selection.lastFocusBookmark=null))},0)}),i||(i=function(t){var n=e.activeEditor;n&&t.target.ownerDocument==document&&(n.selection&&t.target!=n.getBody()&&(n.selection.lastFocusBookmark=l(n.dom,n.lastRng)),t.target==document.body||u(t.target)||e.focusedEditor!=n||(n.fire("blur",{focusedEditor:null}),e.focusedEditor=null))},a.bind(document,"focusin",i)),d.inline&&!o&&(o=function(t){var n=e.activeEditor;if(n.inline&&!n.dom.isChildOf(t.target,n.getBody())){var r=n.selection.getRng();r.collapsed||(n.lastRng=r)}},a.bind(document,"mouseup",o))}function f(t){e.focusedEditor==t.editor&&(e.focusedEditor=null),e.activeEditor||(a.unbind(document,"selectionchange",r),a.unbind(document,"focusin",i),a.unbind(document,"mouseup",o),r=i=o=null)}e.on("AddEditor",d),e.on("RemoveEditor",f)}var r,i,o,a=e.DOM;return n.isEditorUIElement=function(e){return-1!==e.className.toString().indexOf("mce-")},n}),r(he,[de,f,y,V,u,d,le,fe,pe],function(e,t,n,r,i,o,a,s,l){function c(e){var t=v.editors,n;delete t[e.id];for(var r=0;r0&&p(f(e),function(e){var n;(n=d.get(e))?r(e,t,n):p(document.forms,function(n){p(n.elements,function(n){n.name===e&&(e="mce_editor_"+m++,d.setAttrib(n,"id",e),r(e,t,n))})})});break;case"textareas":case"specific_textareas":p(d.select("textarea"),function(e){t.editor_deselector&&o(e,t.editor_deselector)||(!t.editor_selector||o(e,t.editor_selector))&&r(n(e),t,e)})}t.oninit&&(e=s=0,p(l,function(t){s++,t.initialized?e++:t.on("init",function(){e++,e==s&&i("oninit")}),e==s&&i("oninit")}))}var s=this,l=[];s.settings=t,d.bind(window,"ready",a)},get:function(e){return arguments.length?e in this.editors?this.editors[e]:null:this.editors},add:function(e){var t=this,n=t.editors;return n[e.id]=e,n.push(e),t.activeEditor=e,t.fire("AddEditor",{editor:e}),g||(g=function(){t.fire("BeforeUnload")},d.bind(window,"beforeunload",g)),e},createEditor:function(t,n){return this.add(new e(t,n,this))},remove:function(e){var t=this,n,r=t.editors,i;{if(e)return"string"==typeof e?(e=e.selector||e,void p(d.select(e),function(e){i=r[e.id],i&&t.remove(i)})):(i=e,r[i.id]?(c(i)&&t.fire("RemoveEditor",{editor:i}),r.length||d.unbind(window,"beforeunload",g),i.remove(),i):null);for(n=r.length-1;n>=0;n--)t.remove(r[n])}},execCommand:function(t,n,r){var i=this,o=i.get(r);switch(t){case"mceAddEditor":return i.get(r)||new e(r,i.settings,i).render(),!0;case"mceRemoveEditor":return o&&o.remove(),!0;case"mceToggleEditor":return o?(o.isHidden()?o.show():o.hide(),!0):(i.execCommand("mceAddEditor",0,r),!0)}return i.activeEditor?i.activeEditor.execCommand(t,n,r):!1},triggerSave:function(){p(this.editors,function(e){e.save()})},addI18n:function(e,t){s.add(e,t)},translate:function(e){return s.translate(e)},setActive:function(e){var t=this.activeEditor;this.activeEditor!=e&&(t&&t.fire("deactivate",{relatedTarget:e}),e.fire("activate",{relatedTarget:t})),this.activeEditor=e}},h(v,a),v.setup(),window.tinymce=window.tinyMCE=v,v}),r(me,[he,d],function(e,t){var n=t.each,r=t.explode;e.on("AddEditor",function(e){var t=e.editor;t.on("preInit",function(){function e(e,t){n(t,function(t,n){t&&s.setStyle(e,n,t)}),s.rename(e,"span")}function i(e){s=t.dom,l.convert_fonts_to_spans&&n(s.select("font,u,strike",e.node),function(e){o[e.nodeName.toLowerCase()](s,e)})}var o,a,s,l=t.settings;l.inline_styles&&(a=r(l.font_size_legacy_values),o={font:function(t,n){e(n,{backgroundColor:n.style.backgroundColor,color:n.color,fontFamily:n.face,fontSize:a[parseInt(n.size,10)-1]})},u:function(n,r){"html4"===t.settings.schema&&e(r,{textDecoration:"underline"})},strike:function(t,n){e(n,{textDecoration:"line-through"})}},t.on("PreProcess SetContent",i))})})}),r(ge,[le,d],function(e,t){var n={send:function(e){function t(){!e.async||4==r.readyState||i++>1e4?(e.success&&1e4>i&&200==r.status?e.success.call(e.success_scope,""+r.responseText,r,e):e.error&&e.error.call(e.error_scope,i>1e4?"TIMED_OUT":"GENERAL",r,e),r=null):setTimeout(t,10)}var r,i=0;if(e.scope=e.scope||this,e.success_scope=e.success_scope||e.scope,e.error_scope=e.error_scope||e.scope,e.async=e.async===!1?!1:!0,e.data=e.data||"",r=new XMLHttpRequest){if(r.overrideMimeType&&r.overrideMimeType(e.content_type),r.open(e.type||(e.data?"POST":"GET"),e.url,e.async),e.crossDomain&&(r.withCredentials=!0),e.content_type&&r.setRequestHeader("Content-Type",e.content_type),r.setRequestHeader("X-Requested-With","XMLHttpRequest"),r=n.fire("beforeSend",{xhr:r,settings:e}).xhr,r.send(e.data),!e.async)return t();setTimeout(t,10)}}};return t.extend(n,e),n}),r(ve,[],function(){function e(t,n){var r,i,o,a;if(n=n||'"',null===t)return"null";if(o=typeof t,"string"==o)return i="\bb t\nn\ff\rr\"\"''\\\\",n+t.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(e,t){return'"'===n&&"'"===e?e:(r=i.indexOf(t),r+1?"\\"+i.charAt(r+1):(e=t.charCodeAt().toString(16),"\\u"+"0000".substring(e.length)+e))})+n;if("object"==o){if(t.hasOwnProperty&&"[object Array]"===Object.prototype.toString.call(t)){for(r=0,i="[";r0?",":"")+e(t[r],n);return i+"]"}i="{";for(a in t)t.hasOwnProperty(a)&&(i+="function"!=typeof t[a]?(i.length>1?","+n:n)+a+n+":"+e(t[a],n):"");return i+"}"}return""+t}return{serialize:e,parse:function(e){try{return window[String.fromCharCode(101)+"val"]("("+e+")")}catch(t){}}}}),r(ye,[ve,ge,d],function(e,t,n){function r(e){this.settings=i({},e),this.count=0}var i=n.extend;return r.sendRPC=function(e){return(new r).send(e)},r.prototype={send:function(n){var r=n.error,o=n.success;n=i(this.settings,n),n.success=function(t,i){t=e.parse(t),"undefined"==typeof t&&(t={error:"JSON Parse error."}),t.error?r.call(n.error_scope||n.scope,t.error,i):o.call(n.success_scope||n.scope,t.result)},n.error=function(e,t){r&&r.call(n.error_scope||n.scope,e,t)},n.data=e.serialize({id:n.id||"c"+this.count++,method:n.method,params:n.params}),n.content_type="application/json",t.send(n)}},r}),r(be,[y],function(e){return{callbacks:{},count:0,send:function(n){var r=this,i=e.DOM,o=n.count!==t?n.count:r.count,a="tinymce_jsonp_"+o;r.callbacks[o]=function(e){i.remove(a),delete r.callbacks[o],n.callback(e)},i.add(i.doc.body,"script",{id:a,src:n.url,type:"text/javascript"}),r.count++}}}),r(Ce,[],function(){function e(){s=[];for(var e in a)s.push(e);i.length=s.length}function n(){function n(e){var n,r;return r=e!==t?u+e:i.indexOf(",",u),-1===r||r>i.length?null:(n=i.substring(u,r),u=r+1,n)}var r,i,s,u=0;if(a={},c){o.load(l),i=o.getAttribute(l)||"";do{var d=n();if(null===d)break;if(r=n(parseInt(d,32)||0),null!==r){if(d=n(),null===d)break;s=n(parseInt(d,32)||0),r&&(a[r]=s)}}while(null!==r);e()}}function r(){var t,n="";if(c){for(var r in a)t=a[r],n+=(n?",":"")+r.length.toString(32)+","+r+","+t.length.toString(32)+","+t;o.setAttribute(l,n);try{o.save(l)}catch(i){}e()}}var i,o,a,s,l,c;try{if(window.localStorage)return localStorage}catch(u){}return l="tinymce",o=document.documentElement,c=!!o.addBehavior,c&&o.addBehavior("#default#userData"),i={key:function(e){return s[e]},getItem:function(e){return e in a?a[e]:null},setItem:function(e,t){a[e]=""+t,r()},removeItem:function(e){delete a[e],r()},clear:function(){a={},r()}},n(),i}),r(xe,[y,l,b,C,d,u],function(e,t,n,r,i,o){var a=window.tinymce;return a.DOM=e.DOM,a.ScriptLoader=n.ScriptLoader,a.PluginManager=r.PluginManager,a.ThemeManager=r.ThemeManager,a.dom=a.dom||{},a.dom.Event=t.Event,i.each(i,function(e,t){a[t]=e}),i.each("isOpera isWebKit isIE isGecko isMac".split(" "),function(e){a[e]=o[e.substr(2).toLowerCase()]}),{}}),r(we,[U,d],function(e,t){return e.extend({Defaults:{firstControlClass:"first",lastControlClass:"last"},init:function(e){this.settings=t.extend({},this.Defaults,e)},preRender:function(e){e.addClass(this.settings.containerClass,"body")},applyClasses:function(e){var t=this,n=t.settings,r,i,o;r=e.items().filter(":visible"),i=n.firstControlClass,o=n.lastControlClass,r.each(function(e){e.removeClass(i).removeClass(o),n.controlClass&&e.addClass(n.controlClass)}),r.eq(0).addClass(i),r.eq(-1).addClass(o)},renderHtml:function(e){var t=this,n=t.settings,r,i="";return r=e.items(),r.eq(0).addClass(n.firstControlClass),r.eq(-1).addClass(n.lastControlClass),r.each(function(e){n.controlClass&&e.addClass(n.controlClass),i+=e.renderHtml()}),i},recalc:function(){},postRender:function(){}})}),r(_e,[we],function(e){return e.extend({Defaults:{containerClass:"abs-layout",controlClass:"abs-layout-item"},recalc:function(e){e.items().filter(":visible").each(function(e){var t=e.settings;e.layoutRect({x:t.x,y:t.y,w:t.w,h:t.h}),e.recalc&&e.recalc()})},renderHtml:function(e){return'
    '+this._super(e)}})}),r(Ee,[Y,te],function(e,t){return e.extend({Mixins:[t],Defaults:{classes:"widget tooltip tooltip-n"},text:function(e){var t=this;return"undefined"!=typeof e?(t._value=e,t._rendered&&(t.getEl().lastChild.innerHTML=t.encode(e)),t):t._value},renderHtml:function(){var e=this,t=e.classPrefix;return'"},repaint:function(){var e=this,t,n;t=e.getEl().style,n=e._layoutRect,t.left=n.x+"px",t.top=n.y+"px",t.zIndex=131070}})}),r(Ne,[Y,Ee],function(e,t){var n,r=e.extend({init:function(e){var t=this;t._super(e),e=t.settings,t.canFocus=!0,e.tooltip&&r.tooltips!==!1&&(t.on("mouseenter",function(n){var r=t.tooltip().moveTo(-65535);if(n.control==t){var i=r.text(e.tooltip).show().testMoveRel(t.getEl(),["bc-tc","bc-tl","bc-tr"]);r.toggleClass("tooltip-n","bc-tc"==i),r.toggleClass("tooltip-nw","bc-tl"==i),r.toggleClass("tooltip-ne","bc-tr"==i),r.moveRel(t.getEl(),i)}else r.hide()}),t.on("mouseleave mousedown click",function(){t.tooltip().hide()})),t.aria("label",e.ariaLabel||e.tooltip)},tooltip:function(){return n||(n=new t({type:"tooltip"}),n.renderTo()),n},active:function(e){var t=this,n;return e!==n&&(t.aria("pressed",e),t.toggleClass("active",e)),t._super(e)},disabled:function(e){var t=this,n;return e!==n&&(t.aria("disabled",e),t.toggleClass("disabled",e)),t._super(e)},postRender:function(){var e=this,t=e.settings;e._rendered=!0,e._super(),e.parent()||!t.width&&!t.height||(e.initLayoutRect(),e.repaint()),t.autofocus&&e.focus()},remove:function(){this._super(),n&&(n.remove(),n=null)}});return r}),r(ke,[Ne],function(e){return e.extend({Defaults:{classes:"widget btn",role:"button"},init:function(e){var t=this,n;t.on("click mousedown",function(e){e.preventDefault()}),t._super(e),n=e.size,e.subtype&&t.addClass(e.subtype),n&&t.addClass("btn-"+n)},icon:function(e){var t=this,n=t.classPrefix;if("undefined"==typeof e)return t.settings.icon;if(t.settings.icon=e,e=e?n+"ico "+n+"i-"+t.settings.icon:"",t._rendered){var r=t.getEl().firstChild,i=r.getElementsByTagName("i")[0];e?(i&&i==r.firstChild||(i=document.createElement("i"),r.insertBefore(i,r.firstChild)),i.className=e):i&&r.removeChild(i),t.text(t._text)}return t},repaint:function(){var e=this.getEl().firstChild.style;e.width=e.height="100%",this._super()},text:function(e){var t=this;if(t._rendered){var n=t.getEl().lastChild.lastChild;n&&(n.data=t.translate(e))}return t._super(e)},renderHtml:function(){var e=this,t=e._id,n=e.classPrefix,r=e.settings.icon,i;return i=e.settings.image,i?(r="none","string"!=typeof i&&(i=window.getSelection?i[0]:i[1]),i=" style=\"background-image: url('"+i+"')\""):i="",r=e.settings.icon?n+"ico "+n+"i-"+r:"",'
    "}})}),r(Se,[J],function(e){return e.extend({Defaults:{defaultType:"button",role:"group"},renderHtml:function(){var e=this,t=e._layout;return e.addClass("btn-group"),e.preRender(),t.preRender(e),'
    '+(e.settings.html||"")+t.renderHtml(e)+"
    "}})}),r(Te,[Ne],function(e){return e.extend({Defaults:{classes:"checkbox",role:"checkbox",checked:!1},init:function(e){var t=this;t._super(e),t.on("click mousedown",function(e){e.preventDefault()}),t.on("click",function(e){e.preventDefault(),t.disabled()||t.checked(!t.checked())}),t.checked(t.settings.checked)},checked:function(e){var t=this;return"undefined"!=typeof e?(e?t.addClass("checked"):t.removeClass("checked"),t._checked=e,t.aria("checked",e),t):t._checked},value:function(e){return this.checked(e)},renderHtml:function(){var e=this,t=e._id,n=e.classPrefix;return'
    '+e.encode(e._text)+"
    "}})}),r(Re,[Ne,G,K],function(e,t,n){return e.extend({init:function(e){var t=this;t._super(e),t.addClass("combobox"),t.subinput=!0,t.ariaTarget="inp",e=t.settings,e.menu=e.menu||e.values,e.menu&&(e.icon="caret"),t.on("click",function(n){for(var r=n.target,i=t.getEl();r&&r!=i;)r.id&&-1!=r.id.indexOf("-open")&&(t.fire("action"),e.menu&&(t.showMenu(),n.aria&&t.menu.items()[0].focus())),r=r.parentNode}),t.on("keydown",function(e){"INPUT"==e.target.nodeName&&13==e.keyCode&&t.parents().reverse().each(function(n){return e.preventDefault(),t.fire("change"),n.hasEventListeners("submit")&&n.toJSON?(n.fire("submit",{data:n.toJSON()}),!1):void 0})}),e.placeholder&&(t.addClass("placeholder"),t.on("focusin",function(){t._hasOnChange||(n.on(t.getEl("inp"),"change",function(){t.fire("change")}),t._hasOnChange=!0),t.hasClass("placeholder")&&(t.getEl("inp").value="",t.removeClass("placeholder"))}),t.on("focusout",function(){0===t.value().length&&(t.getEl("inp").value=e.placeholder,t.addClass("placeholder"))}))},showMenu:function(){var e=this,n=e.settings,r;e.menu||(r=n.menu||[],r.length?r={type:"menu",items:r}:r.type=r.type||"menu",e.menu=t.create(r).parent(e).renderTo(e.getContainerElm()),e.fire("createmenu"),e.menu.reflow(),e.menu.on("cancel",function(t){t.control===e.menu&&e.focus()}),e.menu.on("show hide",function(t){t.control.items().each(function(t){t.active(t.value()==e.value())})}).fire("show"),e.menu.on("select",function(t){e.value(t.control.value())}),e.on("focusin",function(t){"INPUT"==t.target.tagName.toUpperCase()&&e.menu.hide()}),e.aria("expanded",!0)),e.menu.show(),e.menu.layoutRect({w:e.layoutRect().w}),e.menu.moveRel(e.getEl(),e.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])},value:function(e){var t=this;return"undefined"!=typeof e?(t._value=e,t.removeClass("placeholder"),t._rendered&&(t.getEl("inp").value=e),t):t._rendered?(e=t.getEl("inp").value,e!=t.settings.placeholder?e:""):t._value},disabled:function(e){var t=this;return t._rendered&&"undefined"!=typeof e&&(t.getEl("inp").disabled=e),t._super(e)},focus:function(){this.getEl("inp").focus()},repaint:function(){var e=this,t=e.getEl(),r=e.getEl("open"),i=e.layoutRect(),o,a;o=r?i.w-n.getSize(r).width-10:i.w-10;var s=document;return s.all&&(!s.documentMode||s.documentMode<=8)&&(a=e.layoutRect().h-2+"px"),n.css(t.firstChild,{width:o,lineHeight:a}),e._super(),e},postRender:function(){var e=this;return n.on(this.getEl("inp"),"change",function(){e.fire("change")}),e._super()},remove:function(){n.off(this.getEl("inp")),this._super()},renderHtml:function(){var e=this,t=e._id,n=e.settings,r=e.classPrefix,i=n.value||n.placeholder||"",o,a,s="",l="";return"spellcheck"in n&&(l+=' spellcheck="'+n.spellcheck+'"'),n.maxLength&&(l+=' maxlength="'+n.maxLength+'"'),n.size&&(l+=' size="'+n.size+'"'),n.subtype&&(l+=' type="'+n.subtype+'"'),e.disabled()&&(l+=' disabled="disabled"'),o=n.icon,o&&"caret"!=o&&(o=r+"ico "+r+"i-"+n.icon),a=e._text,(o||a)&&(s='
    ",e.addClass("has-open")),'
    "+s+"
    "}})}),r(Ae,[Re],function(e){return e.extend({init:function(e){var t=this;e.spellcheck=!1,e.onaction&&(e.icon="none"),t._super(e),t.addClass("colorbox"),t.on("change keyup postrender",function(){t.repaintColor(t.value())})},repaintColor:function(e){var t=this.getEl().getElementsByTagName("i")[0];if(t)try{t.style.background=e}catch(n){}},value:function(e){var t=this;return"undefined"!=typeof e&&t._rendered&&t.repaintColor(e),t._super(e)}})}),r(Be,[ke,re],function(e,t){return e.extend({showPanel:function(){var e=this,n=e.settings;if(e.active(!0),e.panel)e.panel.show();else{var r=n.panel;r.type&&(r={layout:"grid",items:r}),r.role=r.role||"dialog",r.popover=!0,r.autohide=!0,r.ariaRoot=!0,e.panel=new t(r).on("hide",function(){e.active(!1)}).on("cancel",function(t){t.stopPropagation(),e.focus(),e.hidePanel()}).parent(e).renderTo(e.getContainerElm()),e.panel.fire("show"),e.panel.reflow()}e.panel.moveRel(e.getEl(),n.popoverAlign||(e.isRtl()?["bc-tr","bc-tc"]:["bc-tl","bc-tc"]))},hidePanel:function(){var e=this;e.panel&&e.panel.hide()},postRender:function(){var e=this;return e.aria("haspopup",!0),e.on("click",function(t){t.control===e&&(e.panel&&e.panel.visible()?e.hidePanel():(e.showPanel(),e.panel.focus(!!t.aria)))}),e._super()},remove:function(){return this.panel&&(this.panel.remove(),this.panel=null),this._super()}})}),r(De,[Be,y],function(e,t){var n=t.DOM;return e.extend({init:function(e){this._super(e),this.addClass("colorbutton")},color:function(e){return e?(this._color=e,this.getEl("preview").style.backgroundColor=e,this):this._color},resetColor:function(){return this._color=null,this.getEl("preview").style.backgroundColor=null,this},renderHtml:function(){var e=this,t=e._id,n=e.classPrefix,r=e.settings.icon?n+"ico "+n+"i-"+e.settings.icon:"",i=e.settings.image?" style=\"background-image: url('"+e.settings.image+"')\"":"";return'
    '},postRender:function(){var e=this,t=e.settings.onclick;return e.on("click",function(r){r.aria&&"down"==r.aria.key||r.control!=e||n.getParent(r.target,"."+e.classPrefix+"open")||(r.stopImmediatePropagation(),t.call(e,r))}),delete e.settings.onclick,e._super()}})}),r(Me,[],function(){function e(e){function i(e,i,o){var a,s,l,c,u,d;return a=0,s=0,l=0,e/=255,i/=255,o/=255,u=t(e,t(i,o)),d=n(e,n(i,o)),u==d?(l=u,{h:0,s:0,v:100*l}):(c=e==u?i-o:o==u?e-i:o-e,a=e==u?3:o==u?1:5,a=60*(a-c/(d-u)),s=(d-u)/d,l=d,{h:r(a),s:r(100*s),v:r(100*l)})}function o(e,i,o){var a,s,l,c;if(e=(parseInt(e,10)||0)%360,i=parseInt(i,10)/100,o=parseInt(o,10)/100,i=n(0,t(i,1)),o=n(0,t(o,1)),0===i)return void(d=f=p=r(255*o));switch(a=e/60,s=o*i,l=s*(1-Math.abs(a%2-1)),c=o-s,Math.floor(a)){case 0:d=s,f=l,p=0;break;case 1:d=l,f=s,p=0;break;case 2:d=0,f=s,p=l;break;case 3:d=0,f=l,p=s;break;case 4:d=l,f=0,p=s;break;case 5:d=s,f=0,p=l;break;default:d=f=p=0}d=r(255*(d+c)),f=r(255*(f+c)),p=r(255*(p+c))}function a(){function e(e){return e=parseInt(e,10).toString(16),e.length>1?e:"0"+e}return"#"+e(d)+e(f)+e(p)}function s(){return{r:d,g:f,b:p}}function l(){return i(d,f,p)}function c(e){var t;return"object"==typeof e?"r"in e?(d=e.r,f=e.g,p=e.b):"v"in e&&o(e.h,e.s,e.v):(t=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(e))?(d=parseInt(t[1],10),f=parseInt(t[2],10),p=parseInt(t[3],10)):(t=/#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(e))?(d=parseInt(t[1],16),f=parseInt(t[2],16),p=parseInt(t[3],16)):(t=/#([0-F])([0-F])([0-F])/gi.exec(e))&&(d=parseInt(t[1]+t[1],16),f=parseInt(t[2]+t[2],16),p=parseInt(t[3]+t[3],16)),d=0>d?0:d>255?255:d,f=0>f?0:f>255?255:f,p=0>p?0:p>255?255:p,u}var u=this,d=0,f=0,p=0;e&&c(e),u.toRgb=s,u.toHsv=l,u.toHex=a,u.parse=c}var t=Math.min,n=Math.max,r=Math.round;return e}),r(He,[Ne,Q,K,Me],function(e,t,n,r){return e.extend({Defaults:{classes:"widget colorpicker"},init:function(e){this._super(e)},postRender:function(){function e(e,t){var r=n.getPos(e),i,o;return i=t.pageX-r.x,o=t.pageY-r.y,i=Math.max(0,Math.min(i/e.clientWidth,1)),o=Math.max(0,Math.min(o/e.clientHeight,1)),{x:i,y:o}}function i(e,t){var i=(360-e.h)/360;n.css(d,{top:100*i+"%"}),t||n.css(p,{left:e.s+"%",top:100-e.v+"%"}),f.style.background=new r({s:100,v:100,h:e.h}).toHex(),s.color().parse({s:e.s,v:e.v,h:e.h})}function o(t){var n;n=e(f,t),c.s=100*n.x,c.v=100*(1-n.y),i(c),s.fire("change")}function a(t){var n;n=e(u,t),c=l.toHsv(),c.h=360*(1-n.y),i(c,!0),s.fire("change")}var s=this,l=s.color(),c,u,d,f,p;u=s.getEl("h"),d=s.getEl("hp"),f=s.getEl("sv"),p=s.getEl("svp"),s._repaint=function(){c=l.toHsv(),i(c)},s._super(),s._svdraghelper=new t(s._id+"-sv",{start:o,drag:o}),s._hdraghelper=new t(s._id+"-h",{start:a,drag:a}),s._repaint()},rgb:function(){return this.color().toRgb()},value:function(e){var t=this;return arguments.length?(t.color().parse(e),void(t._rendered&&t._repaint())):t.color().toHex()},color:function(){return this._color||(this._color=new r),this._color},renderHtml:function(){function e(){var e,t,n="",i,a;for(i="filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=",a=o.split(","),e=0,t=a.length-1;t>e;e++)n+='
    ';return n}var t=this,n=t._id,r=t.classPrefix,i,o="#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000",a="background: -ms-linear-gradient(top,"+o+");background: linear-gradient(to bottom,"+o+");"; + +return i='
    '+e()+'
    ','
    '+i+"
    "}})}),r(Le,[Ne],function(e){return e.extend({init:function(e){var t=this;e.delimiter||(e.delimiter="\xbb"),t._super(e),t.addClass("path"),t.canFocus=!0,t.on("click",function(e){var n,r=e.target;(n=r.getAttribute("data-index"))&&t.fire("select",{value:t.data()[n],index:n})})},focus:function(){var e=this;return e.getEl().firstChild.focus(),e},data:function(e){var t=this;return"undefined"!=typeof e?(t._data=e,t.update(),t):t._data},update:function(){this.innerHtml(this._getPathHtml())},postRender:function(){var e=this;e._super(),e.data(e.settings.data)},renderHtml:function(){var e=this;return'
    '+e._getPathHtml()+"
    "},_getPathHtml:function(){var e=this,t=e._data||[],n,r,i="",o=e.classPrefix;for(n=0,r=t.length;r>n;n++)i+=(n>0?'":"")+'
    '+t[n].name+"
    ";return i||(i='
    \xa0
    '),i}})}),r(Pe,[Le,he],function(e,t){return e.extend({postRender:function(){function e(e){if(1===e.nodeType){if("BR"==e.nodeName||e.getAttribute("data-mce-bogus"))return!0;if("bookmark"===e.getAttribute("data-mce-type"))return!0}return!1}var n=this,r=t.activeEditor;return r.settings.elementpath!==!1&&(n.on("select",function(e){r.focus(),r.selection.select(this.data()[e.index].element),r.nodeChanged()}),r.on("nodeChange",function(t){for(var i=[],o=t.parents,a=o.length;a--;)if(1==o[a].nodeType&&!e(o[a])){var s=r.fire("ResolveName",{name:o[a].nodeName.toLowerCase(),target:o[a]});if(s.isDefaultPrevented()||i.push({name:s.name,element:o[a]}),s.isPropagationStopped())break}n.data(i)})),n._super()}})}),r(Oe,[J],function(e){return e.extend({Defaults:{layout:"flex",align:"center",defaults:{flex:1}},renderHtml:function(){var e=this,t=e._layout,n=e.classPrefix;return e.addClass("formitem"),t.preRender(e),'
    '+(e.settings.title?'
    '+e.settings.title+"
    ":"")+'
    '+(e.settings.html||"")+t.renderHtml(e)+"
    "}})}),r(Ie,[J,Oe,d],function(e,t,n){return e.extend({Defaults:{containerCls:"form",layout:"flex",direction:"column",align:"stretch",flex:1,padding:20,labelGap:30,spacing:10,callbacks:{submit:function(){this.submit()}}},preRender:function(){var e=this,r=e.items();e.settings.formItemDefaults||(e.settings.formItemDefaults={layout:"flex",autoResize:"overflow",defaults:{flex:1}}),r.each(function(r){var i,o=r.settings.label;o&&(i=new t(n.extend({items:{type:"label",id:r._id+"-l",text:o,flex:0,forId:r._id,disabled:r.disabled()}},e.settings.formItemDefaults)),i.type="formitem",r.aria("labelledby",r._id+"-l"),"undefined"==typeof r.settings.flex&&(r.settings.flex=1),e.replace(r,i),i.add(r))})},recalcLabels:function(){var e=this,t=0,n=[],r,i,o;if(e.settings.labelGapCalc!==!1)for(o="children"==e.settings.labelGapCalc?e.find("formitem"):e.items(),o.filter("formitem").each(function(e){var r=e.items()[0],i=r.getEl().clientWidth;t=i>t?i:t,n.push(r)}),i=e.settings.labelGap||0,r=n.length;r--;)n[r].settings.minWidth=t+i},visible:function(e){var t=this._super(e);return e===!0&&this._rendered&&this.recalcLabels(),t},submit:function(){return this.fire("submit",{data:this.toJSON()})},postRender:function(){var e=this;e._super(),e.recalcLabels(),e.fromJSON(e.settings.data)}})}),r(Fe,[Ie],function(e){return e.extend({Defaults:{containerCls:"fieldset",layout:"flex",direction:"column",align:"stretch",flex:1,padding:"25 15 5 15",labelGap:30,spacing:10,border:1},renderHtml:function(){var e=this,t=e._layout,n=e.classPrefix;return e.preRender(),t.preRender(e),'
    '+(e.settings.title?''+e.settings.title+"":"")+'
    '+(e.settings.html||"")+t.renderHtml(e)+"
    "}})}),r(ze,[Re,d],function(e,t){return e.extend({init:function(e){var n=this,r=tinymce.activeEditor,i=r.settings,o,a,s;e.spellcheck=!1,s=i.file_picker_types||i.file_browser_callback_types,s&&(s=t.makeMap(s,/[, ]/)),(!s||s[e.filetype])&&(a=i.file_picker_callback,!a||s&&!s[e.filetype]?(a=i.file_browser_callback,!a||s&&!s[e.filetype]||(o=function(){a(n.getEl("inp").id,n.value(),e.filetype,window)})):o=function(){var i=n.fire("beforecall").meta;i=t.extend({filetype:e.filetype},i),a.call(r,function(e,t){n.value(e).fire("change",{meta:t})},n.value(),i)}),o&&(e.icon="browse",e.onaction=o),n._super(e)}})}),r(We,[_e],function(e){return e.extend({recalc:function(e){var t=e.layoutRect(),n=e.paddingBox();e.items().filter(":visible").each(function(e){e.layoutRect({x:n.left,y:n.top,w:t.innerW-n.right-n.left,h:t.innerH-n.top-n.bottom}),e.recalc&&e.recalc()})}})}),r(Ve,[_e],function(e){return e.extend({recalc:function(e){var t,n,r,i,o,a,s,l,c,u,d,f,p,h,m,g,v=[],y,b,C,x,w,_,E,N,k,S,T,R,A,B,D,M,H,L,P,O,I,F,z=Math.max,W=Math.min;for(r=e.items().filter(":visible"),i=e.layoutRect(),o=e._paddingBox,a=e.settings,f=e.isRtl()?a.direction||"row-reversed":a.direction,s=a.align,l=e.isRtl()?a.pack||"end":a.pack,c=a.spacing||0,("row-reversed"==f||"column-reverse"==f)&&(r=r.set(r.toArray().reverse()),f=f.split("-")[0]),"column"==f?(k="y",E="h",N="minH",S="maxH",R="innerH",T="top",A="deltaH",B="contentH",P="left",H="w",D="x",M="innerW",L="minW",O="right",I="deltaW",F="contentW"):(k="x",E="w",N="minW",S="maxW",R="innerW",T="left",A="deltaW",B="contentW",P="top",H="h",D="y",M="innerH",L="minH",O="bottom",I="deltaH",F="contentH"),d=i[R]-o[T]-o[T],_=u=0,t=0,n=r.length;n>t;t++)p=r[t],h=p.layoutRect(),m=p.settings,g=m.flex,d-=n-1>t?c:0,g>0&&(u+=g,h[S]&&v.push(p),h.flex=g),d-=h[N],y=o[P]+h[L]+o[O],y>_&&(_=y);if(x={},0>d?x[N]=i[N]-d+i[A]:x[N]=i[R]-d+i[A],x[L]=_+i[I],x[B]=i[R]-d,x[F]=_,x.minW=W(x.minW,i.maxW),x.minH=W(x.minH,i.maxH),x.minW=z(x.minW,i.startMinWidth),x.minH=z(x.minH,i.startMinHeight),!i.autoResize||x.minW==i.minW&&x.minH==i.minH){for(C=d/u,t=0,n=v.length;n>t;t++)p=v[t],h=p.layoutRect(),b=h[S],y=h[N]+h.flex*C,y>b?(d-=h[S]-h[N],u-=h.flex,h.flex=0,h.maxFlexSize=b):h.maxFlexSize=0;for(C=d/u,w=o[T],x={},0===u&&("end"==l?w=d+o[T]:"center"==l?(w=Math.round(i[R]/2-(i[R]-d)/2)+o[T],0>w&&(w=o[T])):"justify"==l&&(w=o[T],c=Math.floor(d/(r.length-1)))),x[D]=o[P],t=0,n=r.length;n>t;t++)p=r[t],h=p.layoutRect(),y=h.maxFlexSize||h[N],"center"===s?x[D]=Math.round(i[M]/2-h[H]/2):"stretch"===s?(x[H]=z(h[L]||0,i[M]-o[P]-o[O]),x[D]=o[P]):"end"===s&&(x[D]=i[M]-h[H]-o.top),h.flex>0&&(y+=h.flex*C),x[E]=y,x[k]=w,p.layoutRect(x),p.recalc&&p.recalc(),w+=y+c}else if(x.w=x.minW,x.h=x.minH,e.layoutRect(x),this.recalc(e),null===e._lastRect){var V=e.parent();V&&(V._lastRect=null,V.recalc())}}})}),r(Ue,[we],function(e){return e.extend({Defaults:{containerClass:"flow-layout",controlClass:"flow-layout-item",endClass:"break"},recalc:function(e){e.items().filter(":visible").each(function(e){e.recalc&&e.recalc()})}})}),r($e,[Y,Ne,re,d,he,u],function(e,t,n,r,i,o){function a(e){function t(t,n){return function(){var r=this;e.on("nodeChange",function(i){var o=e.formatter,a=null;s(i.parents,function(e){return s(t,function(t){return n?o.matchNode(e,n,{value:t.value})&&(a=t.value):o.matchNode(e,t.value)&&(a=t.value),a?!1:void 0}),a?!1:void 0}),r.value(a)})}}function r(e){e=e.replace(/;$/,"").split(";");for(var t=e.length;t--;)e[t]=e[t].split("=");return e}function i(){function t(e){var n=[];if(e)return s(e,function(e){var o={text:e.title,icon:e.icon};if(e.items)o.menu=t(e.items);else{var a=e.format||"custom"+r++;e.format||(e.name=a,i.push(e)),o.format=a,o.cmd=e.cmd}n.push(o)}),n}function n(){var n;return n=t(e.settings.style_formats_merge?e.settings.style_formats?o.concat(e.settings.style_formats):o:e.settings.style_formats||o)}var r=0,i=[],o=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough",icon:"strikethrough",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Alignment",items:[{title:"Left",icon:"alignleft",format:"alignleft"},{title:"Center",icon:"aligncenter",format:"aligncenter"},{title:"Right",icon:"alignright",format:"alignright"},{title:"Justify",icon:"alignjustify",format:"alignjustify"}]}];return e.on("init",function(){s(i,function(t){e.formatter.register(t.name,t)})}),{type:"menu",items:n(),onPostRender:function(t){e.fire("renderFormatsMenu",{control:t.control})},itemDefaults:{preview:!0,textStyle:function(){return this.settings.format?e.formatter.getCssText(this.settings.format):void 0},onPostRender:function(){var t=this;t.parent().on("show",function(){var n,r;n=t.settings.format,n&&(t.disabled(!e.formatter.canApply(n)),t.active(e.formatter.match(n))),r=t.settings.cmd,r&&t.active(e.queryCommandState(r))})},onclick:function(){this.settings.format&&l(this.settings.format),this.settings.cmd&&e.execCommand(this.settings.cmd)}}}}function o(t){return function(){function n(){return e.undoManager?e.undoManager[t]():!1}var r=this;t="redo"==t?"hasRedo":"hasUndo",r.disabled(!n()),e.on("Undo Redo AddUndo TypingUndo ClearUndos",function(){r.disabled(!n())})}}function a(){var t=this;e.on("VisualAid",function(e){t.active(e.hasVisual)}),t.active(e.hasVisual)}function l(t){t.control&&(t=t.control.value()),t&&e.execCommand("mceToggleFormat",!1,t)}var c;c=i(),s({bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript"},function(t,n){e.addButton(n,{tooltip:t,onPostRender:function(){var t=this;e.formatter?e.formatter.formatChanged(n,function(e){t.active(e)}):e.on("init",function(){e.formatter.formatChanged(n,function(e){t.active(e)})})},onclick:function(){l(n)}})}),s({outdent:["Decrease indent","Outdent"],indent:["Increase indent","Indent"],cut:["Cut","Cut"],copy:["Copy","Copy"],paste:["Paste","Paste"],help:["Help","mceHelp"],selectall:["Select all","SelectAll"],removeformat:["Clear formatting","RemoveFormat"],visualaid:["Visual aids","mceToggleVisualAid"],newdocument:["New document","mceNewDocument"]},function(t,n){e.addButton(n,{tooltip:t[0],cmd:t[1]})}),s({blockquote:["Blockquote","mceBlockQuote"],numlist:["Numbered list","InsertOrderedList"],bullist:["Bullet list","InsertUnorderedList"],subscript:["Subscript","Subscript"],superscript:["Superscript","Superscript"],alignleft:["Align left","JustifyLeft"],aligncenter:["Align center","JustifyCenter"],alignright:["Align right","JustifyRight"],alignjustify:["Justify","JustifyFull"]},function(t,n){e.addButton(n,{tooltip:t[0],cmd:t[1],onPostRender:function(){var t=this;e.formatter?e.formatter.formatChanged(n,function(e){t.active(e)}):e.on("init",function(){e.formatter.formatChanged(n,function(e){t.active(e)})})}})}),e.addButton("undo",{tooltip:"Undo",onPostRender:o("undo"),cmd:"undo"}),e.addButton("redo",{tooltip:"Redo",onPostRender:o("redo"),cmd:"redo"}),e.addMenuItem("newdocument",{text:"New document",icon:"newdocument",cmd:"mceNewDocument"}),e.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onPostRender:o("undo"),cmd:"undo"}),e.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onPostRender:o("redo"),cmd:"redo"}),e.addMenuItem("visualaid",{text:"Visual aids",selectable:!0,onPostRender:a,cmd:"mceToggleVisualAid"}),s({cut:["Cut","Cut","Meta+X"],copy:["Copy","Copy","Meta+C"],paste:["Paste","Paste","Meta+V"],selectall:["Select all","SelectAll","Meta+A"],bold:["Bold","Bold","Meta+B"],italic:["Italic","Italic","Meta+I"],underline:["Underline","Underline"],strikethrough:["Strikethrough","Strikethrough"],subscript:["Subscript","Subscript"],superscript:["Superscript","Superscript"],removeformat:["Clear formatting","RemoveFormat"]},function(t,n){e.addMenuItem(n,{text:t[0],icon:n,shortcut:t[2],cmd:t[1]})}),e.on("mousedown",function(){n.hideAll()}),e.addButton("styleselect",{type:"menubutton",text:"Formats",menu:c}),e.addButton("formatselect",function(){var n=[],i=r(e.settings.block_formats||"Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre");return s(i,function(t){n.push({text:t[0],value:t[1],textStyle:function(){return e.formatter.getCssText(t[1])}})}),{type:"listbox",text:i[0][0],values:n,fixedWidth:!0,onselect:l,onPostRender:t(n)}}),e.addButton("fontselect",function(){var n="Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats",i=[],o=r(e.settings.font_formats||n);return s(o,function(e){i.push({text:{raw:e[0]},value:e[1],textStyle:-1==e[1].indexOf("dings")?"font-family:"+e[1]:""})}),{type:"listbox",text:"Font Family",tooltip:"Font Family",values:i,fixedWidth:!0,onPostRender:t(i,"fontname"),onselect:function(t){t.control.settings.value&&e.execCommand("FontName",!1,t.control.settings.value)}}}),e.addButton("fontsizeselect",function(){var n=[],r="8pt 10pt 12pt 14pt 18pt 24pt 36pt",i=e.settings.fontsize_formats||r;return s(i.split(" "),function(e){var t=e,r=e,i=e.split("=");i.length>1&&(t=i[0],r=i[1]),n.push({text:t,value:r})}),{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:n,fixedWidth:!0,onPostRender:t(n,"fontsize"),onclick:function(t){t.control.settings.value&&e.execCommand("FontSize",!1,t.control.settings.value)}}}),e.addMenuItem("formats",{text:"Formats",menu:c})}var s=r.each;i.on("AddEditor",function(t){t.editor.rtl&&(e.rtl=!0),a(t.editor)}),e.translate=function(e){return i.translate(e)},t.tooltips=!o.iOS}),r(qe,[_e],function(e){return e.extend({recalc:function(e){var t=e.settings,n,r,i,o,a,s,l,c,u,d,f,p,h,m,g,v,y,b,C,x,w,_,E=[],N=[],k,S,T,R,A,B;t=e.settings,i=e.items().filter(":visible"),o=e.layoutRect(),r=t.columns||Math.ceil(Math.sqrt(i.length)),n=Math.ceil(i.length/r),y=t.spacingH||t.spacing||0,b=t.spacingV||t.spacing||0,C=t.alignH||t.align,x=t.alignV||t.align,g=e._paddingBox,A="reverseRows"in t?t.reverseRows:e.isRtl(),C&&"string"==typeof C&&(C=[C]),x&&"string"==typeof x&&(x=[x]);for(d=0;r>d;d++)E.push(0);for(f=0;n>f;f++)N.push(0);for(f=0;n>f;f++)for(d=0;r>d&&(u=i[f*r+d],u);d++)c=u.layoutRect(),k=c.minW,S=c.minH,E[d]=k>E[d]?k:E[d],N[f]=S>N[f]?S:N[f];for(T=o.innerW-g.left-g.right,w=0,d=0;r>d;d++)w+=E[d]+(d>0?y:0),T-=(d>0?y:0)+E[d];for(R=o.innerH-g.top-g.bottom,_=0,f=0;n>f;f++)_+=N[f]+(f>0?b:0),R-=(f>0?b:0)+N[f];if(w+=g.left+g.right,_+=g.top+g.bottom,l={},l.minW=w+(o.w-o.innerW),l.minH=_+(o.h-o.innerH),l.contentW=l.minW-o.deltaW,l.contentH=l.minH-o.deltaH,l.minW=Math.min(l.minW,o.maxW),l.minH=Math.min(l.minH,o.maxH),l.minW=Math.max(l.minW,o.startMinWidth),l.minH=Math.max(l.minH,o.startMinHeight),!o.autoResize||l.minW==o.minW&&l.minH==o.minH){o.autoResize&&(l=e.layoutRect(l),l.contentW=l.minW-o.deltaW,l.contentH=l.minH-o.deltaH);var D;D="start"==t.packV?0:R>0?Math.floor(R/n):0;var M=0,H=t.flexWidths;if(H)for(d=0;dd;d++)E[d]+=H?H[d]*L:L;for(h=g.top,f=0;n>f;f++){for(p=g.left,s=N[f]+D,d=0;r>d&&(B=A?f*r+r-1-d:f*r+d,u=i[B],u);d++)m=u.settings,c=u.layoutRect(),a=Math.max(E[d],c.startMinWidth),c.x=p,c.y=h,v=m.alignH||(C?C[d]||C[0]:null),"center"==v?c.x=p+a/2-c.w/2:"right"==v?c.x=p+a-c.w:"stretch"==v&&(c.w=a),v=m.alignV||(x?x[d]||x[0]:null),"center"==v?c.y=h+s/2-c.h/2:"bottom"==v?c.y=h+s-c.h:"stretch"==v&&(c.h=s),u.layoutRect(c),p+=a+y,u.recalc&&u.recalc();h+=s+b}}else if(l.w=l.minW,l.h=l.minH,e.layoutRect(l),this.recalc(e),null===e._lastRect){var P=e.parent();P&&(P._lastRect=null,P.recalc())}}})}),r(je,[Ne],function(e){return e.extend({renderHtml:function(){var e=this;return e.addClass("iframe"),e.canFocus=!1,''},src:function(e){this.getEl().src=e},html:function(e,t){var n=this,r=this.getEl().contentWindow.document.body;return r?(r.innerHTML=e,t&&t()):setTimeout(function(){n.html(e)},0),this}})}),r(Ke,[Ne,K],function(e,t){return e.extend({init:function(e){var t=this;t._super(e),t.addClass("widget"),t.addClass("label"),t.canFocus=!1,e.multiline&&t.addClass("autoscroll"),e.strong&&t.addClass("strong")},initLayoutRect:function(){var e=this,n=e._super();if(e.settings.multiline){var r=t.getSize(e.getEl());r.width>n.maxW&&(n.minW=n.maxW,e.addClass("multiline")),e.getEl().style.width=n.minW+"px",n.startMinH=n.h=n.minH=Math.min(n.maxH,t.getSize(e.getEl()).height)}return n},repaint:function(){var e=this;return e.settings.multiline||(e.getEl().style.lineHeight=e.layoutRect().h+"px"),e._super()},text:function(e){var t=this;return t._rendered&&e&&this.innerHtml(t.encode(e)),t._super(e)},renderHtml:function(){var e=this,t=e.settings.forId;return'"}})}),r(Ye,[J],function(e){return e.extend({Defaults:{role:"toolbar",layout:"flow"},init:function(e){var t=this;t._super(e),t.addClass("toolbar")},postRender:function(){var e=this;return e.items().addClass("toolbar-item"),e._super()}})}),r(Ge,[Ye],function(e){return e.extend({Defaults:{role:"menubar",containerCls:"menubar",ariaRoot:!0,defaults:{type:"menubutton"}}})}),r(Xe,[ke,G,Ge],function(e,t,n){function r(e,t){for(;e;){if(t===e)return!0;e=e.parentNode}return!1}var i=e.extend({init:function(e){var t=this;t._renderOpen=!0,t._super(e),t.addClass("menubtn"),e.fixedWidth&&t.addClass("fixed-width"),t.aria("haspopup",!0),t.hasPopup=!0},showMenu:function(){var e=this,n=e.settings,r;return e.menu&&e.menu.visible()?e.hideMenu():(e.menu||(r=n.menu||[],r.length?r={type:"menu",items:r}:r.type=r.type||"menu",e.menu=t.create(r).parent(e).renderTo(),e.fire("createmenu"),e.menu.reflow(),e.menu.on("cancel",function(t){t.control.parent()===e.menu&&(t.stopPropagation(),e.focus(),e.hideMenu())}),e.menu.on("select",function(){e.focus()}),e.menu.on("show hide",function(t){t.control==e.menu&&e.activeMenu("show"==t.type),e.aria("expanded","show"==t.type)}).fire("show")),e.menu.show(),e.menu.layoutRect({w:e.layoutRect().w}),void e.menu.moveRel(e.getEl(),e.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"]))},hideMenu:function(){var e=this;e.menu&&(e.menu.items().each(function(e){e.hideMenu&&e.hideMenu()}),e.menu.hide())},activeMenu:function(e){this.toggleClass("active",e)},renderHtml:function(){var e=this,t=e._id,r=e.classPrefix,i=e.settings.icon,o;return o=e.settings.image,o?(i="none","string"!=typeof o&&(o=window.getSelection?o[0]:o[1]),o=" style=\"background-image: url('"+o+"')\""):o="",i=e.settings.icon?r+"ico "+r+"i-"+i:"",e.aria("role",e.parent()instanceof n?"menuitem":"button"),'
    '},postRender:function(){var e=this;return e.on("click",function(t){t.control===e&&r(t.target,e.getEl())&&(e.showMenu(),t.aria&&e.menu.items()[0].focus())}),e.on("mouseenter",function(t){var n=t.control,r=e.parent(),o;n&&r&&n instanceof i&&n.parent()==r&&(r.items().filter("MenuButton").each(function(e){e.hideMenu&&e!=n&&(e.menu&&e.menu.visible()&&(o=!0),e.hideMenu())}),o&&(n.focus(),n.showMenu()))}),e._super()},text:function(e){var t=this,n,r;if(t._rendered)for(r=t.getEl("open").getElementsByTagName("span"),n=0;n0&&(o=r[0].text,n._value=r[0].value),e.menu=r),e.text=e.text||o||r[0].text,n._super(e),n.addClass("listbox"),n.on("select",function(t){var r=t.control;a&&(t.lastControl=a),e.multiple?r.active(!r.active()):n.value(t.control.settings.value),a=r})},value:function(e){function t(e,n){e.items().each(function(e){i=e.value()===n,i&&(o=o||e.text()),e.active(i),e.menu&&t(e.menu,n)})}function n(t){for(var r=0;r'+("-"!==a?'\xa0":"")+("-"!==a?''+a+"":"")+(c?'
    '+c+"
    ":"")+(i.menu?'
    ':"")+"
    "},postRender:function(){var e=this,t=e.settings,n=t.textStyle;if("function"==typeof n&&(n=n.call(this)),n){var r=e.getEl("text");r&&r.setAttribute("style",n)}return e.on("mouseenter click",function(n){n.control===e&&(t.menu||"click"!==n.type?(e.showMenu(),n.aria&&e.menu.focus(!0)):(e.fire("select"),e.parent().hideAll()))}),e._super(),e},active:function(e){return"undefined"!=typeof e&&this.aria("checked",e),this._super(e)},remove:function(){this._super(),this.menu&&this.menu.remove()}})}),r(Ze,[re,Qe,d],function(e,t,n){var r=e.extend({Defaults:{defaultType:"menuitem",border:1,layout:"stack",role:"application",bodyRole:"menu",ariaRoot:!0},init:function(e){var t=this;if(e.autohide=!0,e.constrainToViewport=!0,e.itemDefaults)for(var r=e.items,i=r.length;i--;)r[i]=n.extend({},e.itemDefaults,r[i]);t._super(e),t.addClass("menu")},repaint:function(){return this.toggleClass("menu-align",!0),this._super(),this.getEl().style.height="",this.getEl("body").style.height="",this},cancel:function(){var e=this;e.hideAll(),e.fire("select")},hideAll:function(){var e=this;return this.find("menuitem").exec("hideMenu"),e._super()},preRender:function(){var e=this;return e.items().each(function(t){var n=t.settings;return n.icon||n.selectable?(e._hasIcons=!0,!1):void 0}),e._super()}});return r}),r(et,[Te],function(e){return e.extend({Defaults:{classes:"radio",role:"radio"}})}),r(tt,[Ne,Q],function(e,t){return e.extend({renderHtml:function(){var e=this,t=e.classPrefix;return e.addClass("resizehandle"),"both"==e.settings.direction&&e.addClass("resizehandle-both"),e.canFocus=!1,'
    '},postRender:function(){var e=this;e._super(),e.resizeDragHelper=new t(this._id,{start:function(){e.fire("ResizeStart")},drag:function(t){"both"!=e.settings.direction&&(t.deltaX=0),e.fire("Resize",t)},stop:function(){e.fire("ResizeEnd")}})},remove:function(){return this.resizeDragHelper&&this.resizeDragHelper.destroy(),this._super()}})}),r(nt,[Ne],function(e){return e.extend({renderHtml:function(){var e=this;return e.addClass("spacer"),e.canFocus=!1,'
    '}})}),r(rt,[Xe,K],function(e,t){return e.extend({Defaults:{classes:"widget btn splitbtn",role:"button"},repaint:function(){var e=this,n=e.getEl(),r=e.layoutRect(),i,o;return e._super(),i=n.firstChild,o=n.lastChild,t.css(i,{width:r.w-t.getSize(o).width,height:r.h-2}),t.css(o,{height:r.h-2}),e},activeMenu:function(e){var n=this;t.toggleClass(n.getEl().lastChild,n.classPrefix+"active",e)},renderHtml:function(){var e=this,t=e._id,n=e.classPrefix,r,i=e.settings.icon;return r=e.settings.image,r?(i="none","string"!=typeof r&&(r=window.getSelection?r[0]:r[1]),r=" style=\"background-image: url('"+r+"')\""):r="",i=e.settings.icon?n+"ico "+n+"i-"+i:"",'
    '},postRender:function(){var e=this,t=e.settings.onclick;return e.on("click",function(e){var n=e.target;if(e.control==this)for(;n;){if(e.aria&&"down"!=e.aria.key||"BUTTON"==n.nodeName&&-1==n.className.indexOf("open"))return e.stopImmediatePropagation(),void t.call(this,e);n=n.parentNode}}),delete e.settings.onclick,e._super()}})}),r(it,[Ue],function(e){return e.extend({Defaults:{containerClass:"stack-layout",controlClass:"stack-layout-item",endClass:"break"}})}),r(ot,[ee,K],function(e,t){return e.extend({Defaults:{layout:"absolute",defaults:{type:"panel"}},activateTab:function(e){var n;this.activeTabId&&(n=this.getEl(this.activeTabId),t.removeClass(n,this.classPrefix+"active"),n.setAttribute("aria-selected","false")),this.activeTabId="t"+e,n=this.getEl("t"+e),n.setAttribute("aria-selected","true"),t.addClass(n,this.classPrefix+"active"),this.items()[e].show().fire("showtab"),this.reflow(),this.items().each(function(t,n){e!=n&&t.hide()})},renderHtml:function(){var e=this,t=e._layout,n="",r=e.classPrefix;return e.preRender(),t.preRender(e),e.items().each(function(t,i){var o=e._id+"-t"+i;t.aria("role","tabpanel"),t.aria("labelledby",o),n+='"}),'
    '+n+'
    '+t.renderHtml(e)+"
    "},postRender:function(){var e=this;e._super(),e.settings.activeTab=e.settings.activeTab||0,e.activateTab(e.settings.activeTab),this.on("click",function(t){var n=t.target.parentNode;if(t.target.parentNode.id==e._id+"-head")for(var r=n.childNodes.length;r--;)n.childNodes[r]==t.target&&e.activateTab(r)})},initLayoutRect:function(){var e=this,n,r,i;r=t.getSize(e.getEl("head")).width,r=0>r?0:r,i=0,e.items().each(function(e){r=Math.max(r,e.layoutRect().minW),i=Math.max(i,e.layoutRect().minH)}),e.items().each(function(e){e.settings.x=0,e.settings.y=0,e.settings.w=r,e.settings.h=i,e.layoutRect({x:0,y:0,w:r,h:i})});var o=t.getSize(e.getEl("head")).height;return e.settings.minWidth=r,e.settings.minHeight=i+o,n=e._super(),n.deltaH+=o,n.innerH=n.h-n.deltaH,n}})}),r(at,[Ne,K],function(e,t){return e.extend({init:function(e){var t=this;t._super(e),t._value=e.value||"",t.addClass("textbox"),e.multiline?t.addClass("multiline"):t.on("keydown",function(e){13==e.keyCode&&t.parents().reverse().each(function(t){return e.preventDefault(),t.hasEventListeners("submit")&&t.toJSON?(t.fire("submit",{data:t.toJSON()}),!1):void 0})})},disabled:function(e){var t=this;return t._rendered&&"undefined"!=typeof e&&(t.getEl().disabled=e),t._super(e)},value:function(e){var t=this;return"undefined"!=typeof e?(t._value=e,t._rendered&&(t.getEl().value=e),t):t._rendered?t.getEl().value:t._value},repaint:function(){var e=this,t,n,r,i=0,o=0,a;t=e.getEl().style,n=e._layoutRect,a=e._lastRepaintRect||{};var s=document;return!e.settings.multiline&&s.all&&(!s.documentMode||s.documentMode<=8)&&(t.lineHeight=n.h-o+"px"),r=e._borderBox,i=r.left+r.right+8,o=r.top+r.bottom+(e.settings.multiline?8:0),n.x!==a.x&&(t.left=n.x+"px",a.x=n.x),n.y!==a.y&&(t.top=n.y+"px",a.y=n.y),n.w!==a.w&&(t.width=n.w-i+"px",a.w=n.w),n.h!==a.h&&(t.height=n.h-o+"px",a.h=n.h),e._lastRepaintRect=a,e.fire("repaint",{},!1),e},renderHtml:function(){var e=this,t=e._id,n=e.settings,r=e.encode(e._value,!1),i="";return"spellcheck"in n&&(i+=' spellcheck="'+n.spellcheck+'"'),n.maxLength&&(i+=' maxlength="'+n.maxLength+'"'),n.size&&(i+=' size="'+n.size+'"'),n.subtype&&(i+=' type="'+n.subtype+'"'),e.disabled()&&(i+=' disabled="disabled"'),n.multiline?'":'"},postRender:function(){var e=this;return t.on(e.getEl(),"change",function(t){e.fire("change",t)}),e._super()},remove:function(){t.off(this.getEl()),this._super()}})}),r(st,[K,Y],function(e,t){return function(n,r){var i=this,o,a=t.classPrefix;i.show=function(t){return i.hide(),o=!0,window.setTimeout(function(){o&&n.appendChild(e.createFragment('
    ')); + +},t||0),i},i.hide=function(){var e=n.lastChild;return e&&-1!=e.className.indexOf("throbber")&&e.parentNode.removeChild(e),o=!1,i}}}),a([l,c,u,d,f,p,h,m,g,y,b,C,x,_,E,N,k,S,T,R,A,B,D,M,H,L,O,I,F,z,W,V,U,$,q,j,K,Y,G,X,J,Q,Z,ee,te,ne,re,ie,oe,ae,se,le,ce,ue,de,fe,pe,he,me,ge,ve,ye,be,Ce,xe,we,_e,Ee,Ne,ke,Se,Te,Re,Ae,Be,De,Me,He,Le,Pe,Oe,Ie,Fe,ze,We,Ve,Ue,$e,qe,je,Ke,Ye,Ge,Xe,Je,Qe,Ze,et,tt,nt,rt,it,ot,at,st])}(this); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/myams.js --- a/src/pyams_skin/resources/js/myams.js Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/resources/js/myams.js Wed Jun 17 10:00:10 2015 +0200 @@ -400,9 +400,9 @@ * Copyright Andrew Davy: https://forrst.com/posts/Get_the_URL_of_the_current_javascript_file-Dst */ MyAMS.baseURL = (function () { - var script = $('script[src$="/myams.js"], script[src$="/myams.min.js"]'); + var script = $('script[src*="/myams.js"], script[src*="/myams.min.js"]'); var src = script.attr("src"); - ams.devmode = !src.endsWith('.min.js'); + ams.devmode = src.indexOf('.min.js') < 0; ams.devext = ams.devmode ? '' : '.min'; return src.substring(0, src.lastIndexOf('/') + 1); })(); @@ -980,7 +980,7 @@ */ query: function(query, method, options, callback) { ams.ajax.check($.jsonRpc, - ams.baseURL + 'ext/jquery-jsonrpc' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js', function() { var result; if (typeof(options) == 'function') { @@ -1029,7 +1029,7 @@ */ post: function(method, data, options, callback) { ams.ajax.check($.jsonRPC, - ams.baseURL + 'ext/jquery-jsonrpc' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js', function() { var result; if (typeof(options) == 'function') { @@ -1092,7 +1092,7 @@ */ post: function(url, method, data, options, callback) { ams.ajax.check($.xmlrpc, - ams.baseURL + 'ext/jquery-xmlrpc' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/jquery-xmlrpc' + ams.devext + '.js', function() { var result; if (typeof(options) == 'function') { @@ -1227,10 +1227,10 @@ $('.state-error', form).removeClassPrefix('state-'); // Check submit button var button = $(form.data('ams-submit-button')); - if (button) + if (button && !button.data('ams-form-hide-loading')) button.button('loading'); ams.ajax.check($.fn.ajaxSubmit, - ams.baseURL + 'ext/jquery-form-3.49' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/jquery-form-3.49' + ams.devext + '.js', function() { function _submitAjaxForm(form, options) { @@ -1409,7 +1409,7 @@ // and matching named buttons will be deleted (on first form submit) // before JQuery-form plug-in can get them when submitting the form... ams.ajax.check($.progressBar, - ams.baseURL + 'ext/jquery-progressbar' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/jquery-progressbar' + ams.devext + '.js'); var settings = $.extend({}, { uuid: $.progressBar.submit(form) }); @@ -1624,13 +1624,18 @@ ams.skin.alert(form, 'error', header, errors); } else { $('.state-error', form).removeClass('state-error'); - header = errors.widgets && (errors.widgets.length > 1) ? ams.i18n.ERRORS_OCCURED : ams.i18n.ERROR_OCCURED; + header = errors.error_header || + (errors.widgets && (errors.widgets.length > 1) ? ams.i18n.ERRORS_OCCURED : ams.i18n.ERROR_OCCURED); var message = new Array(); var index; for (index in errors.messages) { if (!$.isNumeric(index)) continue; - message.push(errors.messages[index].message || errors.messages[index]); + if (errors.messages[index].header) { + message.push('' + errors.messages[index].header + '
    ' + errors.messages[index].message); + } else { + message.push(errors.messages[index].message || errors.messages[index]); + } } for (index in errors.widgets) { if (!$.isNumeric(index)) @@ -1655,7 +1660,7 @@ $('li.state-error:first a', form).click(); } } - ams.skin.alert(form, 'error', header, message, errors.error_message); + ams.skin.alert(form, errors.error_level || 'error', header, message, errors.error_message); } } }; @@ -1685,10 +1690,10 @@ */ open: function(source, options) { ams.ajax.check($.fn.modalmanager, - ams.baseURL + 'ext/bootstrap-modalmanager' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/bootstrap-modalmanager' + ams.devext + '.js', function() { ams.ajax.check($.fn.modal.defaults, - ams.baseURL + 'ext/bootstrap-modal' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/bootstrap-modal' + ams.devext + '.js', function(first_load) { if (first_load) { $(document).off('click.modal'); @@ -1832,6 +1837,9 @@ */ hidden: function(e) { var modal = e.target; + // Call registered cleaning callbacks + ams.skin.cleanContainer(modal); + // Call registered hide callbacks var callbacks = ams.dialog._hide_callbacks; for (var index in callbacks) { callbacks[index].call(modal); @@ -2013,16 +2021,7 @@ } }); - // Run already enabled plug-ins - for (var index in ams.plugins.enabled) { - if (disabled.indexOf(index) >= 0) - continue; - var plugin = ams.plugins.enabled[index]; - if (typeof(plugin) == 'function') - plugin(element); - } - - // Load, run and register new plug-ins + // Load and register new plug-ins var name; $('[data-ams-plugins]', element).each(function() { var source = $(this); @@ -2050,8 +2049,6 @@ var callback = plugin.callback; if (callback) { var called = ams.getFunctionByName(callback); - if (typeof(called) == 'function') - called.apply(source); if (plugin.register !== false) ams.plugins.enabled[name] = called; } else { @@ -2068,6 +2065,15 @@ } } }); + + // Run all enabled plug-ins + for (var index in ams.plugins.enabled) { + if (disabled.indexOf(index) >= 0) + continue; + var plugin = ams.plugins.enabled[index]; + if (typeof(plugin) == 'function') + plugin(element); + } }, /** @@ -2157,9 +2163,9 @@ var hints = $('.hint:not(:parents(.nohints))', element); if (hints.length > 0) ams.ajax.check($.fn.tipsy, - ams.baseURL + 'ext/jquery-tipsy' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/jquery-tipsy' + ams.devext + '.js', function() { - ams.getCSS(ams.baseURL + '../css/ext/jquery-tipsy' + (ams.devmode ? '.css' : '.min.css'), + ams.getCSS(ams.baseURL + '../css/ext/jquery-tipsy' + ams.devext + '.css', 'jquery-tipsy'); hints.each(function() { var hint = $(this); @@ -2172,7 +2178,7 @@ hint.attr(data.amsHintTitleAttr || 'title') || (data.amsHintHtml ? hint.html() : hint.text()); }, - opacity: data.amsHintOpacity, + opacity: data.amsHintOpacity || 0.95, gravity: data.amsHintGravity || 'sw', offset: data.amsHintOffset || 0 }; @@ -2185,6 +2191,27 @@ }, /** + * Context menu plug-in + */ + contextMenu: function(element) { + var menus = $('.context-menu', element); + if (menus.length > 0) { + menus.each(function() { + var menu = $(this); + var data = menu.data(); + var data_options = { + menuSelector: data.amsContextmenuSelector, + menuSelected: ams.helpers.contextMenuHandler + }; + var settings = $.extend({}, data_options, data.amsContextmenuOptions); + settings = ams.executeFunctionByName(data.amsContextmenuInitCallback, menu, settings) || settings; + var plugin = menu.contextMenu(settings); + ams.executeFunctionByName(data.amsContextmenuAfterInitCallback, menu, plugin, settings); + }); + } + }, + + /** * Fieldset legend switcher */ switcher: function(element) { @@ -2269,10 +2296,13 @@ input.on('change', function(e) { e.preventDefault(); var veto = {}; + var isChecked = $(this).is(':checked'); legend.trigger('ams.checker.before-switch', [legend, veto]); - if (veto.veto) + if (veto.veto) { + // reset checked status because event is fired after change... + $(this).prop('checked', !isChecked); return; - var isChecked = $(this).is(':checked'); + } ams.executeFunctionByName(data.amsCheckerChangeHandler, legend, isChecked); if (!data.amsCheckerCancelDefault) { var hidden = input.data('ams-checker-hidden-input'); @@ -2287,7 +2317,7 @@ legend.trigger('ams.checker.opened', [legend]); } else { if (data.amsCheckerMode == 'disable') - fieldset.attr('disabled', 'disabled'); + fieldset.prop('disabled', 'disabled'); else fieldset.addClass('switched'); if (hidden) @@ -2419,23 +2449,24 @@ }, /** - * Context menu plug-in + * JQuery typeahead plug-in */ - contextMenu: function(element) { - var menus = $('.context-menu', element); - if (menus.length > 0) { - menus.each(function() { - var menu = $(this); - var data = menu.data(); - var data_options = { - menuSelector: data.amsContextmenuSelector, - menuSelected: ams.helpers.contextMenuHandler - }; - var settings = $.extend({}, data_options, data.amsContextmenuOptions); - settings = ams.executeFunctionByName(data.amsContextmenuInitCallback, menu, settings) || settings; - var plugin = menu.contextMenu(settings); - ams.executeFunctionByName(data.amsContextmenuAfterInitCallback, menu, plugin, settings); - }); + typeahead: function(element) { + var typeaheads = $('.typeahead', element); + if (typeaheads.length > 0) { + ams.ajax.check($.fn.typeahead, + ams.baseURL + 'ext/jquery-typeahead' + ams.devext + '.js', + function() { + typeaheads.each(function() { + var input = $(this); + var data = input.data(); + var data_options = {}; + var settings = $.extend({}, data_options, data.amsTypeaheadOptions); + settings = ams.executeFunctionByName(data.amsTypeaheadInitCallback, input, settings) || settings; + var plugin = input.typeahead(settings); + ams.executeFunctionByName(data.amsTypeaheadAfterInitCallback, input, plugin, settings); + }); + }); } }, @@ -2446,7 +2477,7 @@ var selects = $('.select2', element); if (selects.length > 0) { ams.ajax.check($.fn.select2, - ams.baseURL + 'ext/jquery-select2-3.5.2' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/jquery-select2-3.5.2' + ams.devext + '.js', function() { selects.each(function() { var select = $(this); @@ -2537,9 +2568,11 @@ } if (select.attr('readonly')) { - data_options.query = function() { - return []; - }; + if (select.attr('type') == 'hidden') { + data_options.query = function () { + return []; + }; + } } else if (data.amsSelect2Query) { // Custom query method data_options.query = ams.getFunctionByName(data.amsSelect2Query); @@ -2578,7 +2611,7 @@ settings = $.extend({}, settings, data.amsSelect2QueryOptions); settings = ams.executeFunctionByName(data.amsSelect2QueryInitCallback, select, settings) || settings; ams.ajax.check($.jsonRPC, - ams.baseURL + 'ext/jquery-jsonrpc' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js', function() { $.jsonRPC.withOptions({ endPoint: data.amsSelect2MethodTarget || ams.jsonrpc.getAddr(), @@ -2610,9 +2643,8 @@ var plugin = select.select2(settings); ams.executeFunctionByName(data.amsSelect2AfterInitCallback, select, plugin, settings); if (select.hasClass('ordered')) { - select.addClass('nofloat'); ams.ajax.check($.fn.select2Sortable, - ams.baseURL + 'ext/jquery-select2-sortable' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/jquery-select2-sortable' + ams.devext + '.js', function() { select.select2Sortable({ bindOrder: 'sortableStop' @@ -2661,10 +2693,10 @@ var datepickers = $('.datepicker', element); if (datepickers.length > 0) { ams.ajax.check($.fn.datetimepicker, - ams.baseURL + 'ext/jquery-datetimepicker' + (ams.devmode ? '.js': '.min.js'), + ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js', function(first_load) { if (first_load) { - ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + (ams.devmode ? '.css' : '.min.css'), 'jquery-datetimepicker'); + ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css', 'jquery-datetimepicker'); ams.dialog.registerHideCallback(ams.helpers.datetimepickerDialogHiddenCallback); } datepickers.each(function() { @@ -2693,10 +2725,10 @@ var datetimepickers = $('.datetimepicker', element); if (datetimepickers.length > 0) { ams.ajax.check($.fn.datetimepicker, - ams.baseURL + 'ext/jquery-datetimepicker' + (ams.devmode ? '.js': '.min.js'), + ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js', function(first_load) { if (first_load) { - ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + (ams.devmode ? '.css' : '.min.css'), 'jquery-datetimepicker'); + ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css', 'jquery-datetimepicker'); ams.dialog.registerHideCallback(ams.helpers.datetimepickerDialogHiddenCallback); } datetimepickers.each(function() { @@ -2725,10 +2757,10 @@ var timepickers = $('.timepicker', element); if (timepickers.length > 0) { ams.ajax.check($.fn.datetimepicker, - ams.baseURL + 'ext/jquery-datetimepicker' + (ams.devmode ? '.js': '.min.js'), + ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js', function(first_load) { if (first_load) { - ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + (ams.devmode ? '.css' : '.min.css'), 'jquery-datetimepicker'); + ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css', 'jquery-datetimepicker'); ams.dialog.registerHideCallback(ams.helpers.datetimepickerDialogHiddenCallback); } timepickers.each(function() { @@ -2756,10 +2788,10 @@ var colorpickers = $('.colorpicker', element); if (colorpickers.length > 0) { ams.ajax.check($.fn.minicolors, - ams.baseURL + 'ext/jquery-minicolors' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/jquery-minicolors' + ams.devext + '.js', function(first_load) { if (first_load) { - ams.getCSS(ams.baseURL + '../css/ext/jquery-minicolors' + (ams.devmode ? '.css' : '.min.css'), 'jquery-minicolors'); + ams.getCSS(ams.baseURL + '../css/ext/jquery-minicolors' + ams.devext + '.css', 'jquery-minicolors'); } colorpickers.each(function() { var input = $(this); @@ -2777,35 +2809,13 @@ }, /** - * JQuery typeahead plug-in - */ - typeahead: function(element) { - var typeaheads = $('.typeahead', element); - if (typeaheads.length > 0) { - ams.ajax.check($.fn.typeahead, - ams.baseURL + 'ext/jquery-typeahead' + (ams.devmode ? '.js' : '.min.js'), - function() { - typeaheads.each(function() { - var input = $(this); - var data = input.data(); - var data_options = {}; - var settings = $.extend({}, data_options, data.amsTypeaheadOptions); - settings = ams.executeFunctionByName(data.amsTypeaheadInitCallback, input, settings) || settings; - var plugin = input.typeahead(settings); - ams.executeFunctionByName(data.amsTypeaheadAfterInitCallback, input, plugin, settings); - }); - }); - } - }, - - /** * JQuery validation plug-in */ validate: function(element) { var forms = $('FORM:not([novalidate])', element); if (forms.length > 0) { ams.ajax.check($.fn.validate, - ams.baseURL + 'ext/jquery-validate-1.11.1' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/jquery-validate-1.11.1' + ams.devext + '.js', function(first_load) { if (first_load) { $.validator.setDefaults({ @@ -2849,7 +2859,7 @@ // before JQuery-form plug-in can get them when submitting the form... $('.state-error', form).removeClass('state-error'); ams.ajax.check($.fn.ajaxSubmit, - ams.baseURL + 'ext/jquery-form-3.49' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/jquery-form-3.49' + ams.devext + '.js'); return ams.form.submit(form); } : ams.getFunctionByName(data.amsFormSubmitHandler) @@ -2889,7 +2899,7 @@ var tables = $('.datatable', element); if (tables.length > 0) { ams.ajax.check($.fn.dataTable, - ams.baseURL + 'ext/jquery-dataTables-1.9.4' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/jquery-dataTables-1.9.4' + ams.devext + '.js', function(first_load) { if (first_load) { $.fn.dataTableExt.oSort['numeric-comma-asc'] = function(a, b) { @@ -2909,7 +2919,7 @@ } $(tables).each(function() { ams.ajax.check($.fn.dataTableExt.oPagination['bootstrap_full'], - ams.baseURL + 'myams-dataTables' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'myams-dataTables' + ams.devext + '.js'); var table = $(this); var data = table.data(); var extensions = (data.amsDatatableExtensions || '').split(/\s+/); @@ -2933,6 +2943,7 @@ bPaginate: data.amsDatatablePagination !== false, bInfo: data.amsDatatableInfo !== false, bSort: data.amsDatatableSort !== false, + aaSorting: data.amsDatatableSorting, bDeferRender: true, bAutoWidth: false, iDisplayLength: data.amsDatatableDisplayLength || 25, @@ -2951,23 +2962,23 @@ switch (extensions[index]) { case 'autofill': ams.ajax.check($.fn.dataTable.AutoFill, - ams.baseURL + 'ext/jquery-dataTables-autoFill' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/jquery-dataTables-autoFill' + ams.devext + '.js'); break; case 'columnfilter': ams.ajax.check($.fn.columnFilter, - ams.baseURL + 'ext/jquery-dataTables-columnFilter' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/jquery-dataTables-columnFilter' + ams.devext + '.js'); break; case 'colreorder': ams.ajax.check($.fn.dataTable.ColReorder, - ams.baseURL + 'ext/jquery-dataTables-colReorder' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/jquery-dataTables-colReorder' + ams.devext + '.js'); break; case 'colreorderwithresize': ams.ajax.check($.fn.dataTable.ColReorder, - ams.baseURL + 'ext/jquery-dataTables-colReorderWithResize' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/jquery-dataTables-colReorderWithResize' + ams.devext + '.js'); break; case 'colvis': ams.ajax.check($.fn.dataTable.ColVis, - ams.baseURL + 'ext/jquery-dataTables-colVis' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/jquery-dataTables-colVis' + ams.devext + '.js'); var cv_default = { activate: 'click', sAlign: 'right' @@ -2976,33 +2987,33 @@ break; case 'editable': ams.ajax.check($.fn.editable, - ams.baseURL + 'ext/jquery-jeditable' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/jquery-jeditable' + ams.devext + '.js'); ams.ajax.check($.fn.makeEditable, - ams.baseURL + 'ext/jquery-dataTables-editable' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/jquery-dataTables-editable' + ams.devext + '.js'); break; case 'fixedcolumns': ams.ajax.check($.fn.dataTable.FixedColumns, - ams.baseURL + 'ext/jquery-dataTables-fixedColumns' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/jquery-dataTables-fixedColumns' + ams.devext + '.js'); break; case 'fixedheader': ams.ajax.check($.fn.dataTable.FixedHeader, - ams.baseURL + 'ext/jquery-dataTables-fixedHeader' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/jquery-dataTables-fixedHeader' + ams.devext + '.js'); break; case 'keytable': ams.ajax.check(window.KeyTable, - ams.baseURL + 'ext/jquery-dataTables-keyTable' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/jquery-dataTables-keyTable' + ams.devext + '.js'); break; case 'rowgrouping': ams.ajax.check($.fn.rowGrouping, - ams.baseURL + 'ext/jquery-dataTables-rowGrouping' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/jquery-dataTables-rowGrouping' + ams.devext + '.js'); break; case 'rowreordering': ams.ajax.check($.fn.rowReordering, - ams.baseURL + 'ext/jquery-dataTables-rowReordering' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/jquery-dataTables-rowReordering' + ams.devext + '.js'); break; case 'scroller': ams.ajax.check($.fn.dataTable.Scroller, - ams.baseURL + 'ext/jquery-dataTables-scroller' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/jquery-dataTables-scroller' + ams.devext + '.js'); break; default: break; @@ -3101,7 +3112,7 @@ var tables = $('.table-dnd', element); if (tables.length > 0) { ams.ajax.check($.fn.tableDnD, - ams.baseURL + 'ext/jquery-tablednd' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/jquery-tablednd' + ams.devext + '.js', function(first_load) { tables.each(function() { var table = $(this); @@ -3130,9 +3141,10 @@ if (typeof(local_target) == 'function') { local_target.call(table, dnd_table, rows); } else { - ams.ajax.post(target, {names: rows}); + ams.ajax.post(target, {names: JSON.stringify(rows)}); } } + return false; } }; var settings = $.extend({}, data_options, data.amsTabledndOptions); @@ -3145,16 +3157,133 @@ }, /** + * TinyMCE plug-in + */ + tinymce: function(element) { + + function cleanEditors() { + $('.tinymce', $(this)).each(function() { + var editor = tinymce.get($(this).attr('id')); + if (editor) { + editor.remove(); + } + }); + } + + var editors = $('.tinymce', element); + if (editors.length > 0) { + var baseURL = ams.baseURL + 'ext/tinymce' + (ams.devmode ? '/dev' : ''); + ams.ajax.check(window.tinymce, + baseURL + '/tinymce' + ams.devext + '.js', + function(first_load) { + if (first_load) { + ams.getScript(baseURL + '/jquery.tinymce' + ams.devext + '.js'); + tinymce.baseURL = baseURL; + tinymce.suffix = ams.devext; + ams.skin.registerCleanCallback(cleanEditors); + } + editors.each(function() { + var editor = $(this); + var data = editor.data(); + var data_options = { + theme: "modern", + language: ams.lang, + plugins: [ + "advlist autosave autolink lists link image charmap print preview hr anchor pagebreak", + "searchreplace wordcount visualblocks visualchars code fullscreen", + "insertdatetime media nonbreaking save table contextmenu directionality", + "emoticons paste textcolor colorpicker textpattern" + ], + toolbar1: "newdocument undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image", + toolbar2: "print preview media | forecolor backcolor emoticons | code fullscreen", + content_css: data.amsTinymceContentCss, + formats: data.amsTinymceFormats, + style_formats: data.amsTinymceStyleFormats, + block_formats: data.amsTinymceBlockFormats, + valid_classes: data.amsTinymceValidClasses, + image_advtab: true, + image_list: ams.getFunctionByName(data.amsTinymceImageList) || data.amsTinymceImageList, + image_class_list: data.amsTinymceImageClassList, + link_list: ams.getFunctionByName(data.amsTinymceLinkList) || data.amsTinymceLinkList, + link_class_list: data.amsTinymceLinkClassList, + resize: true + }; + if (data.amsTinymceExternalPlugins) { + var names = data.amsTinymceExternalPlugins.split(/\s+/); + for (var index in names) { + var plugin_src = editor.data('ams-tinymce-plugin-' + names[index]); + tinymce.PluginManager.load(names[index], ams.getSource(plugin_src)); + } + } + var settings = $.extend({}, data_options, data.amsTinymceOptions); + settings = ams.executeFunctionByName(data.amsTinymceInitCallback, editor, settings) || settings; + var plugin = editor.tinymce(settings); + ams.executeFunctionByName(data.amsTinymceAfterInitCallback, editor, plugin, settings); + }); + }); + } + }, + + /** + * Image area select plug-in + */ + imgareaselect: function(element) { + var images = $('.imgareaselect', element); + if (images.length > 0) { + ams.ajax.check($.fn.imgAreaSelect, + ams.baseURL + 'ext/jquery-imgareaselect-0.9.10' + ams.devext + '.js', + function(first_load) { + if (first_load) + ams.getCSS(ams.baseURL + '../css/ext/jquery-imgareaselect' + ams.devext + '.css'); + images.each(function() { + var image = $(this); + var data = image.data(); + var parent = data.amsImgareaselectParent ? image.parents(data.amsImgareaselectParent) : 'body'; + var data_options = { + instance: true, + handles: true, + parent: parent, + x1: data.amsImgareaselectX1 || 0, + y1: data.amsImgareaselectY1 || 0, + x2: data.amsImgareaselectX2 || data.amsImgareaselectImageWidth, + y2: data.amsImgareaselectY2 || data.amsImgareaselectImageHeight, + imageWidth: data.amsImgareaselectImageWidth, + imageHeight: data.amsImgareaselectImageHeight, + minWidth: 128, + minHeight: 128, + aspectRatio: data.amsImgareaselectRatio, + onSelectEnd: ams.getFunctionByName(data.amsImgareaselectSelectEnd) || function(img, selection) { + var target = data.amsImgareaselectTargetField || 'image_'; + $('input[name="' + target + 'x1"]', parent).val(selection.x1); + $('input[name="' + target + 'y1"]', parent).val(selection.y1); + $('input[name="' + target + 'x2"]', parent).val(selection.x2); + $('input[name="' + target + 'y2"]', parent).val(selection.y2); + } + }; + var settings = $.extend({}, data_options, data.amsImgareaselectOptions); + settings = ams.executeFunctionByName(data.amsImgareaselectInitCallback, image, settings) || settings; + var plugin = image.imgAreaSelect(settings); + ams.executeFunctionByName(data.amsImgareaselectAfterInitCallback, image, plugin, settings); + // Add update timeout when plug-in is displayed into a modal dialog + setTimeout(function() { + plugin.update(); + }, 250); + }); + }) + } + }, + + /** * FancyBox plug-in */ fancybox: function(element) { var fancyboxes = $('.fancybox', element); if (fancyboxes.length > 0) { ams.ajax.check($.fn.fancybox, - ams.baseURL + 'ext/jquery-fancybox-2.1.5' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/jquery-fancybox-2.1.5' + ams.devext + '.js', function(first_load) { if (first_load) - ams.getCSS(ams.baseURL + '../css/ext/jquery-fancybox-2.1.5' + (ams.devmode ? '.css' : '.min.css')); + ams.getCSS(ams.baseURL + '../css/ext/jquery-fancybox-2.1.5' + ams.devext + '.css'); fancyboxes.each(function() { var fancybox = $(this); var data = fancybox.data(); @@ -3165,15 +3294,15 @@ switch (helper) { case 'buttons': ams.ajax.check($.fancybox.helpers.buttons, - ams.baseURL + 'ext/fancybox-helpers/fancybox-buttons.js' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/fancybox-helpers/fancybox-buttons' + ams.devext + '.js'); break; case 'thumbs': ams.ajax.check($.fancybox.helpers.thumbs, - ams.baseURL + 'ext/fancybox-helpers/fancybox-thumbs.js' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/fancybox-helpers/fancybox-thumbs' + ams.devext + '.js'); break; case 'media': ams.ajax.check($.fancybox.helpers.media, - ams.baseURL + 'ext/fancybox-helpers/fancybox-media.js' + (ams.devmode ? '.js' : '.min.js')); + ams.baseURL + 'ext/fancybox-helpers/fancybox-media' + ams.devext + '.js'); break; default: break; @@ -3203,62 +3332,13 @@ }, /** - * Image area select plug-in - */ - imgareaselect: function(element) { - var images = $('.imgareaselect', element); - if (images.length > 0) { - ams.ajax.check($.fn.imgAreaSelect, - ams.baseURL + 'ext/jquery-imgareaselect-0.9.10' + (ams.devmode ? '.js' : '.min.js'), - function(first_load) { - if (first_load) - ams.getCSS(ams.baseURL + '../css/ext/jquery-imgareaselect' + (ams.devmode ? '.css' : '.min.css')); - images.each(function() { - var image = $(this); - var data = image.data(); - var parent = data.amsImgareaselectParent ? image.parents(data.amsImgareaselectParent) : 'body'; - var data_options = { - instance: true, - handles: true, - parent: parent, - x1: data.amsImgareaselectX1 || 0, - y1: data.amsImgareaselectY1 || 0, - x2: data.amsImgareaselectX2 || data.amsImgareaselectImageWidth, - y2: data.amsImgareaselectY2 || data.amsImgareaselectImageHeight, - imageWidth: data.amsImgareaselectImageWidth, - imageHeight: data.amsImgareaselectImageHeight, - minWidth: 128, - minHeight: 128, - aspectRatio: data.amsImgareaselectRatio, - onSelectEnd: ams.getFunctionByName(data.amsImgareaselectSelectEnd) || function(img, selection) { - var target = data.amsImgareaselectTargetField || 'image_'; - $('input[name="' + target + 'x1"]', parent).val(selection.x1); - $('input[name="' + target + 'y1"]', parent).val(selection.y1); - $('input[name="' + target + 'x2"]', parent).val(selection.x2); - $('input[name="' + target + 'y2"]', parent).val(selection.y2); - } - }; - var settings = $.extend({}, data_options, data.amsImgareaselectOptions); - settings = ams.executeFunctionByName(data.amsImgareaselectInitCallback, image, settings) || settings; - var plugin = image.imgAreaSelect(settings); - ams.executeFunctionByName(data.amsImgareaselectAfterInitCallback, image, plugin, settings); - // Add update timeout when plug-in is displayed into a modal dialog - setTimeout(function() { - plugin.update(); - }, 250); - }); - }) - } - }, - - /** * Sparkline graphs */ graphs: function(element) { var graphs = $('.sparkline', element); if (graphs.length > 0) { ams.ajax.check(ams.graphs, - ams.baseURL + 'myams-graphs' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'myams-graphs' + ams.devext + '.js', function() { ams.graphs.init(graphs); }); @@ -3275,7 +3355,7 @@ ams.baseURL + 'ext/jquery-mousewheel.min.js', function() { ams.ajax.check($.fn.mCustomScrollbar, - ams.baseURL + 'ext/jquery-mCustomScrollbar' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/jquery-mCustomScrollbar' + ams.devext + '.js', function(first_load) { if (first_load) ams.getCSS(ams.baseURL + '../css/ext/jquery-mCustomScrollbar.css', @@ -3568,7 +3648,7 @@ var widgets = $('.ams-widget', element); if (widgets.length > 0) ams.ajax.check($.fn.MyAMSWidget, - ams.baseURL + 'myams-widgets' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'myams-widgets' + ams.devext + '.js', function() { widgets.each(function() { var widget = $(this); @@ -3638,7 +3718,7 @@ */ bigBox: function(options, callback) { ams.ajax.check(ams.notify, - ams.baseURL + 'myams-notify' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'myams-notify' + ams.devext + '.js', function() { ams.notify.messageBox(options, callback); }); @@ -3654,7 +3734,7 @@ status = 'info'; } ams.ajax.check(ams.notify, - ams.baseURL + 'myams-notify' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'myams-notify' + ams.devext + '.js', function() { switch (status) { case 'error': @@ -3685,7 +3765,7 @@ status = 'info'; } ams.ajax.check(ams.notify, - ams.baseURL + 'myams-notify' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'myams-notify' + ams.devext + '.js', function() { switch (status) { case 'error': @@ -3777,6 +3857,32 @@ }, /** + * List of registered 'cleaning' callbacks + * These callbacks are called before loading a new URL into a given container + * to clean required elements from memory before the DOM elements are removed + */ + _clean_callbacks: [], + + /** + * Register a callback which should be called before a container is replaced + */ + registerCleanCallback: function(callback) { + var callbacks = ams.skin._clean_callbacks; + if (callbacks.indexOf(callback) < 0) + callbacks.push(callback); + }, + + /** + * Call registered cleaning callbacks on given container + */ + cleanContainer: function(container) { + var callbacks = ams.skin._clean_callbacks; + for (var index in callbacks) { + callbacks[index].call(container); + } + }, + + /** * Load given URL into container */ loadURL: function(url, container, options, callback) { @@ -3794,7 +3900,8 @@ dataType: 'html', cache: false, beforeSend: function() { - container.html('

    Loading...

    '); + ams.skin.cleanContainer(container); + container.html('

    Loading...

    '); if (container[0] == $('#content')[0]) { ams.skin._drawBreadCrumb(); document.title = $('.breadcrumb LI:last-child').text(); @@ -3810,6 +3917,7 @@ var request_data = ams.ajax.getResponse(request); var data_type = request_data.content_type; var result = request_data.data; + $('.loading', container).remove(); switch (data_type) { case 'json': ams.ajax.handleJSON(result, container); @@ -3920,7 +4028,7 @@ ams.device = 'mobile'; if (ams.enable_fastclick) { ams.ajax.check($.fn.noClickDelay, - ams.baseURL + '/ext/jquery-smartclick' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + '/ext/jquery-smartclick' + ams.devext + '.js', function() { $('NAV UL A').noClickDelay(); $('#hide-menu A').noClickDelay(); @@ -4050,7 +4158,7 @@ // Resize events ams.ajax.check($.resize, - ams.baseURL + 'ext/jquery-resize' + (ams.devmode ? '.js' : '.min.js'), + ams.baseURL + 'ext/jquery-resize' + ams.devext + '.js', function() { $('#main').resize(function() { ams.skin._setPageHeight(); @@ -4063,8 +4171,6 @@ // Init AJAX navigation if (ams.ajax_nav) { - if ($('nav').length > 0) - ams.skin.checkURL(); $(document).on('click', 'a[href="#"]', function(e) { e.preventDefault(); }); @@ -4196,6 +4302,13 @@ } }); + // Prevent bootstrap dialog from blocking TinyMCE focus + $(document).on('focusin', function(e) { + if ($(e.target).closest('.mce-window').length) { + e.stopImmediatePropagation(); + } + }); + // Disable clicks on disabled tabs $("a[data-toggle=tab]", ".nav-tabs").on("click", function(e) { if ($(this).parent('li').hasClass("disabled")) { @@ -4217,13 +4330,10 @@ } }); - // Init plug-ins required by main layout - ams.plugins.enabled.hint(document); - - // Init content when not loaded by AJAX request - // or when redirecting to authentication page... - if ((window.location.hash == '') || (ams.getQueryVar(window.location.href, 'came_from') != false)) - ams.initContent(document); + // Init page content + ams.initContent(document); + if (ams.ajax_nav && ($('nav').length > 0)) + ams.skin.checkURL(); // Add unload event listener to check for modified forms $(window).on('beforeunload', ams.form.checkBeforeUnload); diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/js/myams.min.js --- a/src/pyams_skin/resources/js/myams.min.js Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/resources/js/myams.min.js Wed Jun 17 10:00:10 2015 +0200 @@ -1,1 +1,1 @@ -(function(b){String.prototype.startsWith=function(e){var c=this.length;var d=e.length;if(c0};if(b.scrollbarWidth===undefined){b.scrollbarWidth=function(){var d=b('
    ').appendTo("body");var e=d.children();var c=e.innerWidth()-e.height(99).innerWidth();d.remove();return c}}b.fn.extend({exists:function(){return b(this).length>0},listattr:function(d){var c=[];this.each(function(){c.push(b(this).attr(d))});return c},style:function(d,g,c){var f=this.get(0);if(typeof f=="undefined"){return}var e=this.get(0).style;if(typeof d!="undefined"){if(typeof g!="undefined"){c=typeof c!="undefined"?c:"";e.setProperty(d,g,c);return this}else{return e.getPropertyValue(d)}}else{return e}},removeClassPrefix:function(c){this.each(function(e,f){var d=f.className.split(" ").map(function(g){return g.startsWith(c)?"":g});f.className=b.trim(d.join(" "))});return this},contextMenu:function(d){function c(g,i,f){var h=b(window)[i](),j=b(d.menuSelector)[i](),e=g;if(g+j>h&&j
    ',openedSign:''};var d=b.extend({},e,c);var f=b(this);f.find("LI").each(function(){var g=b(this);if(g.find("UL").size()>0){g.find("A:first").append(""+d.closedSign+"");var h=g.find("A:first");if(h.attr("href")=="#"){h.click(function(){return false})}}});f.find("LI.active").each(function(){var g=b(this).parents("UL");var h=g.parent("LI");g.slideDown(d.speed);h.find("b:first").html(d.openedSign);h.addClass("open")});f.find("LI A").on("click",function(){var j=b(this);var g=j.parent().find("UL");if(d.accordion){var i=j.parent().parents("UL");var k=f.find("UL:visible");k.each(function(l){var m=true;i.each(function(n){if(i[n]==k[l]){m=false;return false}});if(m){if(g!=k[l]){b(k[l]).slideUp(d.speed,function(){j.parent("LI").find("b:first").html(d.closedSign);j.parent("LI").removeClass("open")})}}})}var h=j.parent().find("UL:first");if(!j.attr("href").replace(/^#/,"")&&h.is(":visible")&&!h.hasClass("active")){h.slideUp(d.speed,function(){j.parent("LI").removeClass("open").find("B:first").delay(d.speed).html(d.closedSign)})}else{h.slideDown(d.speed,function(){j.parent("LI").addClass("open").find("B:first").delay(d.speed).html(d.openedSign)})}})}});b.UTF8={encode:function(e){e=e.replace(/\r\n/g,"\n");var d="";for(var g=0;g127)&&(f<2048)){d+=String.fromCharCode((f>>6)|192);d+=String.fromCharCode((f&63)|128)}else{d+=String.fromCharCode((f>>12)|224);d+=String.fromCharCode(((f>>6)&63)|128);d+=String.fromCharCode((f&63)|128)}}}return d},decode:function(d){var f="";var h=0,j=0,g=0,e=0;while(h191)&&(j<224)){g=d.charCodeAt(h+1);f+=String.fromCharCode(((j&31)<<6)|(g&63));h+=2}else{g=d.charCodeAt(h+1);e=d.charCodeAt(h+2);f+=String.fromCharCode(((j&15)<<12)|((g&63)<<6)|(e&63));h+=3}}}return f}};if(window.MyAMS===undefined){window.MyAMS={devmode:true,devext:"",lang:"en",throttle_delay:350,menu_speed:235,navbar_height:49,ajax_nav:true,enable_widgets:true,enable_mobile:false,enable_fastclick:false,warn_on_form_change:false,ismobile:(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))}}var a=MyAMS;MyAMS.baseURL=(function(){var c=b('script[src$="/myams.js"], script[src$="/myams.min.js"]');var d=c.attr("src");a.devmode=!d.endsWith(".min.js");a.devext=a.devmode?"":".min";return d.substring(0,d.lastIndexOf("/")+1)})();MyAMS.getQueryVar=function(e,f){if(e.indexOf("?")<0){return false}if(!e.endsWith("&")){e+="&"}var c=new RegExp(".*?[&\\?]"+f+"=(.*?)&.*");var d=e.replace(c,"$1");return d==e?false:d};MyAMS.rgb2hex=function(c){return"#"+b.map(c.match(/\b(\d+)\b/g),function(d){return("0"+parseInt(d).toString(16)).slice(-2)}).join("")};MyAMS.generateId=function(){function c(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return c()+c()+c()+c()};MyAMS.getFunctionByName=function(h,d){if(h===undefined){return undefined}else{if(typeof(h)=="function"){return h}}var g=h.split(".");var f=g.pop();d=(d===undefined||d===null)?window:d;for(var c=0;c").attr({rel:"stylesheet",type:"text/css",href:f,"data-ams-id":g}).appendTo(e)}};MyAMS.event={stop:function(c){if(!c){c=window.event}if(c){if(c.stopPropagation){c.stopPropagation();c.preventDefault()}else{c.cancelBubble=true;c.returnValue=false}}}};MyAMS.browser={getInternetExplorerVersion:function(){var e=-1;if(navigator.appName=="Microsoft Internet Explorer"){var c=navigator.userAgent;var d=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(d.exec(c)!=null){e=parseFloat(RegExp.$1)}}return e},checkVersion:function(){var d="You're not using Windows Internet Explorer.";var c=this.getInternetExplorerVersion();if(c>-1){if(c>=8){d="You're using a recent copy of Windows Internet Explorer."}else{d="You should upgrade your copy of Windows Internet Explorer."}}alert(d)},isIE8orlower:function(){var d="0";var c=this.getInternetExplorerVersion();if(c>-1){if(c>=9){d=0}else{d=1}}return d}};MyAMS.error={ajax:function(f,e){if(e.statusText=="OK"){return}var c=a.ajax.getResponse(e);if(c.content_type=="json"){a.ajax.handleJSON(c.data)}else{var g=f.statusText||f.type;var d=e.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

    "+g+"

    "+d+"

    ",icon:"fa fa-warning animated shake",timeout:10000})}if(window.console){console.error(f);console.debug(e)}},show:function(f,c,e){if(!e){return}var d=a.ajax.getResponse(f);if(d.content_type=="json"){a.ajax.handleJSON(d.data)}else{a.skin.messageBox("error",{title:a.i18n.ERRORS_OCCURED,content:"

    "+c+"

    "+e+"

    ",icon:"fa fa-warning animated shake",timeout:10000})}if(window.console){console.error(e);console.debug(f)}}};MyAMS.ajax={check:function(d,f,h,c){if(typeof(h)=="object"){c=h;h=undefined}var g={async:typeof(h)=="function"};var e=b.extend({},g,c);if(d===undefined){a.getScript(f,function(){if(typeof(h)=="function"){h(true,c)}},e)}else{if(typeof(h)=="function"){h(false,c)}}},getAddr:function(d){var c=d||b("HTML HEAD BASE").attr("href")||window.location.href;return c.substr(0,c.lastIndexOf("/")+1)},start:function(){b("#ajax-gear").show()},stop:function(){b("#ajax-gear").hide()},progress:function(c){if(!c.lengthComputable){return}if(c.loaded>=c.total){return}console.log(parseInt((c.loaded/c.total*100),10)+"%")},post:function(e,g,d,j){if(e.startsWith(window.location.protocol)){var i=e}else{i=this.getAddr()+e}if(typeof(d)=="function"){j=d;d={}}else{if(!d){d={}}}if(typeof(j)=="undefined"){j=d.callback}if(typeof(j)=="string"){j=a.getFunctionByName(j)}delete d.callback;var c=undefined;var h={url:i,type:"post",cache:false,async:typeof(j)=="function",data:b.param(g),dataType:"json",success:j||function(k){c=k.result},error:a.error.show};var f=b.extend({},h,d);b.ajax(f);return c},getResponse:function(f){var d=f.getResponseHeader("content-type"),h,c;if(d){if(d.startsWith("application/javascript")){h="script";c=f.responseText}else{if(d.startsWith("text/html")){h="html";c=f.responseText}else{if(d.startsWith("text/xml")){h="xml";c=f.responseText}else{c=f.responseJSON;if(c){h="json"}else{try{c=JSON.parse(f.responseText);h="json"}catch(g){c=f.responseText;h="text"}}}}}}else{h="json";c={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{content_type:h,data:c}},handleJSON:function(n,e,j){var h=n.status;var c;switch(h){case"alert":alert(n.alert.title+"\n\n"+n.alert.content);break;case"error":a.form.showErrors(e,n);break;case"info":case"success":if(n.close_form!=false){a.dialog.close(e)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":if(n.close_form!=false){a.dialog.close(e)}break;case"modal":a.dialog.open(n.location);break;case"reload":if(n.close_form!=false){a.dialog.close(e)}c=n.location||window.location.hash;if(c.startsWith("#")){c=c.substr(1)}a.skin.loadURL(c,n.target||j||"#content");break;case"redirect":if(n.close_form==true){a.dialog.close(e)}c=n.location||window.location.href;if(n.window){window.open(c,n.window,n.options)}else{window.location.href=c}break;default:console.log("Unhandled status: "+h);break}if(n.content){var k=n.content;var d=b(k.target||j||e||"#content");if(k.raw==true){d.text(k.text)}else{d.html(k.html);a.initContent(d)}if(!k.keep_hidden){d.removeClass("hidden")}}if(n.contents){var g=n.contents;for(var i in g){k=g[i];d=b(k.target);if(k.raw==true){d.text(k.text)}else{d.html(k.html);a.initContent(d)}if(!k.keep_hidden){d.removeClass("hidden")}}}if(n.message){var m=n.message;if(typeof(m)=="string"){if((h=="info")||(h=="success")){a.skin.smallBox(h,{title:m,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}else{a.skin.alert(b(e||"#content"),h,m)}}else{a.skin.alert(b(m.target||j||e||"#content"),m.status||"success",m.header,m.body,m.subtitle)}}if(n.smallbox){a.skin.smallBox(n.smallbox_status||h,{title:n.smallbox,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}if(n.messagebox){m=n.messagebox;if(typeof(m)=="string"){a.skin.messageBox("info",{title:a.i18n.ERROR_OCCURED,content:m,timeout:10000})}else{var f=m.status||"info";if(f=="error"&&e&&j){a.executeFunctionByName(e.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",e,j)}a.skin.messageBox(f,{title:m.title||a.i18n.ERROR_OCCURED,content:m.content,icon:m.icon,number:m.number,timeout:m.timeout==null?undefined:(m.timeout||10000)})}}if(n.event){e.trigger(n.event,n.event_options)}if(n.callback){a.executeFunctionByName(n.callback,e,n.options)}if(n.callbacks){for(i in n.callbacks){if(!b.isNumeric(i)){continue}var l=n.callbacks[i];a.executeFunctionByName(l,e,l.options)}}}};MyAMS.jsonrpc={getAddr:function(e){var c=e||b("HTML HEAD BASE").attr("href")||window.location.href;var d=c.replace(/\+\+skin\+\+\w+\//,"");return d.substr(0,d.lastIndexOf("/")+1)},query:function(d,f,c,e){a.ajax.check(b.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+(a.devmode?".js":".min.js"),function(){var g;if(typeof(c)=="function"){e=c;c={}}else{if(!c){c={}}}if(typeof(e)=="undefined"){e=c.callback}if(typeof(e)=="string"){e=a.getFunctionByName(e)}delete c.callback;var i={};if(typeof(d)=="string"){i.query=d}else{if(typeof(d)=="object"){b.extend(i,d)}}b.extend(i,c);var h={url:a.jsonrpc.getAddr(c.url),type:"post",cache:false,method:f,params:i,async:typeof(e)=="function",success:e||function(j){g=j.result},error:a.error.show};b.jsonRpc(h);return g})},post:function(f,d,c,e){a.ajax.check(b.jsonRPC,a.baseURL+"ext/jquery-jsonrpc"+(a.devmode?".js":".min.js"),function(){var g;if(typeof(c)=="function"){e=c;c={}}else{if(!c){c={}}}if(typeof(e)=="undefined"){e=c.callback}if(typeof(e)=="string"){e=a.getFunctionByName(e)}delete c.callback;var g;var i={id:new Date().getTime(),params:d,success:e||function(j){g=j},error:a.error.show};var h=b.extend({},i,c);b.jsonRPC.withOptions({endPoint:a.jsonrpc.getAddr(c.url),namespace:c.namespace,cache:false},function(){b.jsonRPC.request(f,h)});return g})}};MyAMS.xmlrpc={getAddr:function(e){var c=e||b("HTML HEAD BASE").attr("href")||window.location.href;var d=c.replace(/\+\+skin\+\+\w+\//,"");return d.substr(0,d.lastIndexOf("/")+1)},post:function(d,g,e,c,f){a.ajax.check(b.xmlrpc,a.baseURL+"ext/jquery-xmlrpc"+(a.devmode?".js":".min.js"),function(){var h;if(typeof(c)=="function"){f=c;c={}}else{if(!c){c={}}}if(typeof(f)=="undefined"){f=c.callback}if(typeof(f)=="string"){f=a.getFunctionByName(f)}delete c.callback;var j={url:a.xmlrpc.getAddr(d),methodName:g,params:e,success:f||function(k){h=k},error:a.error.show};var i=b.extend({},j,c);b.xmlrpc(i);return h})}};MyAMS.form={init:function(d){if(a.warn_on_form_change){var c=b('FORM[data-ams-warn-on-change!="false"]',d)}else{c=b('FORM[data-ams-warn-on-change="true"]',d)}c.each(function(){var e=b(this);b('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',e).each(function(){var g=b(this);if(g.data("ams-ignore-change")!==true){var f=g.data("ams-changed-event")||"change";g.on(f,function(){b(this).parents("FORM").attr("data-ams-form-changed",true)})}});e.on("reset",function(){b(this).removeAttr("data-ams-form-changed")})})},checkBeforeUnload:function(){var c=b('FORM[data-ams-form-changed="true"]');if(c.exists()){return a.i18n.FORM_CHANGED_WARNING}},confirmChangedForm:function(d,e){if(typeof(d)=="function"){e=d;d=undefined}var c=b('FORM[data-ams-form-changed="true"]',d);if(c.exists()){a.skin.bigBox({title:a.i18n.WARNING,content:'  '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(f){if(f==a.i18n.BTN_OK){e.call(d)}})}else{e.call(d)}},submit:function(e,d,f){e=b(e);if(!e.exists()){return false}if(typeof(d)=="object"){f=d;d=undefined}if(e.data("submitted")){if(!e.data("ams-form-hide-submitted")){a.skin.messageBox("warning",{title:a.i18n.WAIT,content:a.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:e.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(e)){return false}b(".alert, SPAN.state-error",e).remove();b(".state-error",e).removeClassPrefix("state-");var c=b(e.data("ams-submit-button"));if(c){c.button("loading")}a.ajax.check(b.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+(a.devmode?".js":".min.js"),function(){function i(k,m){var j;var C=k.data();var t=C.amsFormOptions;if(f){var o=f.formDataInitCallback}if(o){delete f.formDataInitCallback}else{o=C.amsFormDataInitCallback}if(o){var u={};if(typeof(o)=="function"){var l=o.call(k,u)}else{l=a.executeFunctionByName(o,k,u)}if(u.veto){j=k.data("ams-submit-button");if(j){j.button("reset")}a.form.finalizeSubmitFooter.call(k);return false}}else{l=C.amsFormData||{}}j=b(k.data("ams-submit-button"));var v,y;if(j){v=j.data("ams-form-handler");y=j.data("ams-form-submit-target")}var r=d||v||C.amsFormHandler||"";if(r.startsWith(window.location.protocol)){var n=r}else{var x=k.attr("action").replace(/#/,"");if(x.startsWith(window.location.protocol)){n=x}else{n=a.ajax.getAddr()+x}n+=r}var B=null;if(C.amsFormInitSubmitTarget){B=b(y||C.amsFormSubmitTarget||"#content");a.executeFunctionByName(C.amsFormInitSubmit||"MyAMS.form.initSubmit",k,B)}else{if(!C.amsFormHideSubmitFooter){a.executeFunctionByName(C.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",k)}}var p=typeof(m.uuid)!="undefined";if(p){if(n.indexOf("X-Progress-ID")<0){n+="?X-Progress-ID="+m.uuid}delete m.uuid}var s={url:n,type:"post",cache:false,data:l,dataType:C.amsFormDatatype,beforeSerialize:function(){if(typeof(tinyMCE)!="undefined"){tinyMCE.triggerSave()}},beforeSubmit:function(E,D){D.data("submitted",true)},error:function(H,D,E,G){if(B){a.executeFunctionByName(C.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",G,B)}if(G.is(":visible")){var F=G.data("ams-submit-button");if(F){F.button("reset")}a.form.finalizeSubmitFooter.call(G)}G.data("submitted",false);G.removeData("ams-submit-button")},iframe:p};var w=C.amsFormDownloadTarget;if(w){var q=b('iframe[name="'+w+'"]');if(!q.exists()){q=b("").hide().attr("name",w).appendTo(k)}s=b.extend({},s,{iframe:true,iframeTarget:q,success:function(D,E,I,H){var G=b(H).parents(".modal-dialog");if(G.exists()){a.dialog.close(H)}else{var J;var F=H.data("ams-submit-button");if(F){J=F.data("ams-form-submit-callback")}if(!J){J=a.getFunctionByName(C.amsFormSubmitCallback)||a.form._submitCallback}J.call(H,D,E,I,H);if(H.is(":visible")&&F){F.button("reset")}H.data("submitted",false);H.removeData("ams-submit-button");H.removeAttr("data-ams-form-changed")}}})}else{s=b.extend({},s,{error:function(H,D,E,G){if(B){a.executeFunctionByName(C.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",G,B)}if(G.is(":visible")){var F=G.data("ams-submit-button");if(F){F.button("reset")}a.form.finalizeSubmitFooter.call(G)}G.data("submitted",false);G.removeData("ams-submit-button")},success:function(D,E,H,G){var I;var F=G.data("ams-submit-button");if(F){I=F.data("ams-form-submit-callback")}if(!I){I=a.getFunctionByName(C.amsFormSubmitCallback)||a.form._submitCallback}I.call(G,D,E,H,G);if(G.is(":visible")&&F){F.button("reset")}G.data("submitted",false);G.removeData("ams-submit-button");G.removeAttr("data-ams-form-changed")},iframe:p})}var A=b.extend({},s,m,t,f);b(k).ajaxSubmit(A);if(w){var z=b(k).parents(".modal-dialog");if(z.exists()){a.dialog.close(k)}else{a.form.finalizeSubmitFooter.call(k);if(j){j.button("reset")}k.data("submitted",false);k.removeData("ams-submit-button");k.removeAttr("data-ams-form-changed")}}}var h=b('INPUT[type="file"]',e).length>0;if(h){a.ajax.check(b.progressBar,a.baseURL+"ext/jquery-progressbar"+(a.devmode?".js":".min.js"));var g=b.extend({},{uuid:b.progressBar.submit(e)});i(e,g)}else{i(e,{})}});return false},initSubmit:function(e,d){var c=b(this);var f='';if(!d){d=c.data("ams-form-submit-message")}if(d){f+=""+d+""}b(e).html('
    '+f+"
    ");b(e).parents(".hidden").removeClass("hidden")},finalizeSubmitOnError:function(c){b("i",c).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(d){var c=b(this);var f='';if(!d){d=b(this).data("ams-form-submit-message")}if(d){f+=''+d+""}var e=b("footer",c);b("button",e).hide();e.append('
    '+f+"
    ")},finalizeSubmitFooter:function(){var c=b(this);var d=b("footer",c);if(d){b(".row",d).remove();b("button",d).show()}},_submitCallback:function(m,e,d,c){if(c.is(":visible")){a.form.finalizeSubmitFooter.call(c);var g=c.data("ams-submit-button");if(g){g.button("reset")}}var f=c.data();if(f.amsFormDatatype){var j=f.amsFormDatatype}else{var h=a.ajax.getResponse(d);j=h.content_type;m=h.data}if(g){var i=b(g.amsFormSubmitTarget||f.amsFormSubmitTarget||"#content")}else{i=b(f.amsFormSubmitTarget||"#content")}switch(j){case"json":a.ajax.handleJSON(m,c,i);break;case"script":break;case"xml":break;case"html":case"text":default:if(g&&(g.data("ams-keep-modal")!==true)){a.dialog.close(c)}if(!i.exists()){i=b("body")}i.parents(".hidden").removeClass("hidden");b(".alert",i.parents(".alerts-container")).remove();i.css({opacity:"0.0"}).html(m).delay(50).animate({opacity:"1.0"},300);a.initContent(i)}var k=d.getResponseHeader("X-AMS-Callback");if(k){var l=d.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(k,c,l===undefined?{}:JSON.parse(l),d)}},_getSubmitValidators:function(d){var c=new Array();var e=d.data("ams-form-validator");if(e){c.push([d,e])}b("[data-ams-form-validator]",d).each(function(){var f=b(this);c.push([f,f.data("ams-form-validator")])});return c},_checkSubmitValidators:function(e){var g=a.form._getSubmitValidators(e);if(!g.length){return true}var f=new Array();var l=true;for(var i in g){if(!b.isNumeric(i)){continue}var d=g[i];var c=d[0];var j=d[1];var k=a.executeFunctionByName(j,e,c);if(k===false){l=false}else{if(typeof(k)=="string"){f.push(k)}else{if(l.length&&(l.length>0)){f=f.concat(l)}}}}if(f.length>0){var h=f.length==1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"danger",h,f);return false}else{return l}},showErrors:function(c,j){if(typeof(j)=="string"){a.skin.alert(c,"error",a.i18n.ERROR_OCCURED,j)}else{if(j instanceof Array){var f=j.length==1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(c,"error",f,j)}else{b(".state-error",c).removeClass("state-error");f=j.widgets&&(j.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED;var k=new Array();var i;for(i in j.messages){if(!b.isNumeric(i)){continue}k.push(j.messages[i].message||j.messages[i])}for(i in j.widgets){if(!b.isNumeric(i)){continue}var d=j.widgets[i];var g=b('[name="'+d.name+'"]',c);g.parents("label:first").removeClassPrefix("state-").addClass("state-error").after(''+d.message+"");if(d.label){k.push(d.label+" : "+d.message)}var h=g.parents(".tab-pane").index()+1;if(h>0){var e=b(".nav-tabs",b(g).parents(".tabforms"));b("li:nth-child("+h+")",e).removeClassPrefix("state-").addClass("state-error");b("li.state-error:first a",c).click()}}a.skin.alert(c,"error",f,k,j.error_message)}}}};MyAMS.dialog={_hide_callbacks:[],registerHideCallback:function(d){var c=a.dialog._hide_callbacks;if(c.indexOf(d)<0){c.push(d)}},open:function(d,c){a.ajax.check(b.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+(a.devmode?".js":".min.js"),function(){a.ajax.check(b.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+(a.devmode?".js":".min.js"),function(h){if(h){b(document).off("click.modal");b.fn.modal.defaults.spinner=b.fn.modalmanager.defaults.spinner='
    '}if(typeof(d)=="string"){var g={};var f=d}else{g=d.data();f=d.attr("href")||g.amsUrl;var e=a.getFunctionByName(f);if(typeof(e)=="function"){f=e.call(d)}}if(!f){return}b("body").modalmanager("loading");if(f.indexOf("#")==0){b(f).modal("show")}else{b.ajax({url:f,type:"get",cache:g.amsAllowCache===undefined?false:g.amsAllowCache,data:c,success:function(l,k,j){b("body").modalmanager("removeLoading");var m=a.ajax.getResponse(j);var r=m.content_type;var s=m.data;switch(r){case"json":a.ajax.handleJSON(s,b(b(d).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var n=b(s);var p=b(".modal-dialog",n.wrap("
    ").parent());var o=p.data();var q={overflow:o.amsModalOverflow||".modal-viewport",maxHeight:o.amsModalMaxHeight===undefined?function(){return b(window).height()-b(".modal-header",n).outerHeight(true)-b("footer",n).outerHeight(true)-85}:a.getFunctionByName(o.amsModalMaxHeight)};var i=b.extend({},q,o.amsModalOptions);i=a.executeFunctionByName(o.amsModalInitCallback,p,i)||i;b("
    ").addClass("modal fade").append(n).modal(i).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(n)}}})}})})},shown:function(i){function h(k){var l=b(".scrollmarker.top",c);var j=c.scrollTop();if(j>0){l.show()}else{l.hide()}var e=b(".scrollmarker.bottom",c);if(f+j>=c.get(0).scrollHeight){e.hide()}else{e.show()}}var g=i.target;var c=b(".modal-viewport",g);if(c.length==0){return}var f=parseInt(c.css("max-height"));var d=b.scrollbarWidth();if(c.height()==f){b("
    ").addClass("scrollmarker").addClass("top").css("top",0).css("width",c.width()-d).hide().appendTo(c);b("
    ").addClass("scrollmarker").addClass("bottom").css("top",f-20).css("width",c.width()-d).appendTo(c);c.scroll(h);c.off("resize").on("resize",h)}else{b(".scrollmarker",c).remove()}},close:function(d){var e=d.parents(".modal").data("modal");if(e){var c=b("body").data("modalmanager");if(c&&(c.getOpenModals().indexOf(e)>=0)){e.hide()}}},hidden:function(g){var f=g.target;var d=a.dialog._hide_callbacks;for(var c in d){d[c].call(f)}}};MyAMS.helpers={select2ClearSelection:function(){var d=b(this);var c=d.parents("label");var e=d.data("ams-select2-target");b('[name="'+e+'"]',c).data("select2").val("")},select2FormatSelection:function(d,c){if(d instanceof Array){b(d).each(function(){if(typeof(this)=="object"){c.append(this.text)}else{c.append(this)}})}else{if(typeof(d)=="object"){c.append(d.text)}else{c.append(d)}}},select2QueryUrlResultsCallback:function(e,d,c){switch(e.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

    "+e.error_message+"

    ",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":b(this).data("select2").dropdown.hide();a.dialog.open(result.location);break;default:return{results:e.results||e,more:e.has_more||false,context:e.context}}},select2QueryMethodSuccessCallback:function(g,d,f){var c=g.result;if(typeof(c)=="string"){try{c=JSON.parse(c)}catch(h){}}switch(c.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

    "+c.error_message+"

    ",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":b(this).data("select2").dropdown.hide();a.dialog.open(c.location);break;default:f.callback({results:c.results||c,more:c.has_more||false,context:c.context})}},contextMenuHandler:function(f,g){var c=g.data();if(c.toggle=="modal"){a.dialog.open(g)}else{var d=g.attr("href")||c.amsUrl;if(!d||d.startsWith("javascript:")||g.attr("target")){return}a.event.stop();var e=a.getFunctionByName(d);if(typeof(e)=="function"){d=e.call(g,f)}if(typeof(d)=="function"){d.call(g,f)}else{d=d.replace(/\%23/,"#");var f=g.data("ams-target");if(f){a.form.confirmChangedForm(f,function(){a.skin.loadURL(d,f,g.data("ams-link-options"),g.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(d.startsWith("#")){if(d!=location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=d},150)}else{window.location.hash=d}}}else{window.location=d}})}}}},datetimepickerDialogHiddenCallback:function(){b(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};MyAMS.plugins={init:function(e){a.plugins.initData(e);var f=new Array();b("[data-ams-plugins-disabled]",e).each(function(){var h=b(this).data("ams-plugins-disabled").split(/\s+/);for(var i in h){f.push(h[i])}});for(var d in a.plugins.enabled){if(f.indexOf(d)>=0){continue}var g=a.plugins.enabled[d];if(typeof(g)=="function"){g(e)}}var c;b("[data-ams-plugins]",e).each(function(){var l=b(this);var h={};if(typeof(l.data("ams-plugins"))==="string"){var m=l.data("ams-plugins").split(/\s+/);for(var j in m){c=m[j];var i={src:l.data("ams-plugin-"+c+"-src"),css:l.data("ams-plugin-"+c+"-css"),callback:l.data("ams-plugin-"+c+"-callback"),register:l.data("ams-plugin-"+c+"-register"),async:l.data("ams-plugin-"+c+"-async")};h[c]=i}}else{h=l.data("ams-plugins")}for(c in h){if(a.plugins.enabled[c]===undefined){var k=h[c];a.getScript(k.src,function(){var p=k.callback;if(p){var o=a.getFunctionByName(p);if(typeof(o)=="function"){o.apply(l)}if(k.register!==false){a.plugins.enabled[c]=o}}else{if(k.register!==false){a.plugins.enabled[c]=null}}var n=k.css;if(n){a.getCSS(n,c+"_css")}},{async:k.async===undefined?true:k.async})}}})},initData:function(c){b("[data-ams-data]",c).each(function(){var e=b(this);var f=e.data("ams-data");for(var d in f){e.attr("data-"+d,f[d])}})},register:function(d,c,f){if(typeof(c)=="function"){f=c;c=null}c=c||d.name;if(a.plugins.enabled.indexOf(c)>=0){if(window.console){console.warn("Plugin "+c+" is already registered!")}return}if(typeof(d)=="object"){var e=d.src;if(e){a.ajax.check(d.callback,e,function(g){if(g){a.plugins.enabled[c]=a.getFunctionByName(d.callback);if(d.css){a.getCSS(d.css,c+"_css")}if(f){a.executeFunctionByName(f)}}})}else{a.plugins.enabled[c]=a.getFunctionByName(d.callback);if(d.css){a.getCSS(d.css,c+"_css")}if(f){a.executeFunctionByName(f)}}}else{if(typeof(d)=="function"){a.plugins.enabled[c]=d;if(f){a.executeFunctionByName(f)}}}},enabled:{hint:function(c){var d=b(".hint:not(:parents(.nohints))",c);if(d.length>0){a.ajax.check(b.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+(a.devmode?".js":".min.js"),function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+(a.devmode?".css":".min.css"),"jquery-tipsy");d.each(function(){var i=b(this);var h=i.data();var f={html:h.amsHintHtml,title:a.getFunctionByName(h.amsHintTitleGetter)||function(){var j=b(this);return j.attr("original-title")||j.attr(h.amsHintTitleAttr||"title")||(h.amsHintHtml?j.html():j.text())},opacity:h.amsHintOpacity,gravity:h.amsHintGravity||"sw",offset:h.amsHintOffset||0};var e=b.extend({},f,h.amsHintOptions);e=a.executeFunctionByName(h.amsHintInitCallback,i,e)||e;var g=i.tipsy(e);a.executeFunctionByName(h.amsHintAfterInitCallback,i,g,e)})})}},switcher:function(c){b("LEGEND.switcher",c).each(function(){var e=b(this);var d=e.parent("fieldset");var f=e.data();if(!f.amsSwitcher){b('').prependTo(b(this)).addClass(f.amsSwitcherState=="open"?(f.amsSwitcherMinusClass||"fa-minus"):(f.amsSwitcherPlusClass||"fa-plus"));e.on("click",function(h){h.preventDefault();var g={};e.trigger("ams.switcher.before-switch",[e,g]);if(g.veto){return}if(d.hasClass("switched")){d.removeClass("switched");b(".fa",e).removeClass(f.amsSwitcherPlusClass||"fa-plus").addClass(f.amsSwitcherMinusClass||"fa-minus");e.trigger("ams.switcher.opened",[e]);var i=e.attr("id");if(i){b('legend.switcher[data-ams-switcher-sync="'+i+'"]',d).each(function(){var j=b(this);if(j.parents("fieldset").hasClass("switched")){j.click()}})}}else{d.addClass("switched");b(".fa",e).removeClass(f.amsSwitcherMinusClass||"fa-minus").addClass(f.amsSwitcherPlusClass||"fa-plus");e.trigger("ams.switcher.closed",[e])}});if(f.amsSwitcherState!="open"){d.addClass("switched")}e.data("ams-switcher","on")}})},checker:function(c){b("LEGEND.checker",c).each(function(){var o=b(this);var p=o.parent("fieldset");var f=o.data();if(!f.amsChecker){var d=b('');var i=f.amsCheckerFieldname||("checker_"+a.generateId());var m=i.replace(/\./,"_");var g=f.amsCheckerHiddenPrefix;var h=null;var l=f.amsCheckerHiddenValueOn||"true";var j=f.amsCheckerHiddenValueOff||"false";var e=f.amsCheckerMarker||false;if(g){h=b('').attr("name",g+i).val(f.amsCheckerState=="on"?l:j).prependTo(o)}else{if(e){b('').attr("name",e).attr("value",1).prependTo(o)}}var n=b('').attr("name",i).attr("id",m).data("ams-checker-hidden-input",h).data("ams-checker-init",true).val(f.amsCheckerValue||true).attr("checked",f.amsCheckerState=="on"?"checked":null);if(f.amsCheckerReadonly){n.attr("disabled","disabled")}else{n.on("change",function(s){s.preventDefault();var q={};o.trigger("ams.checker.before-switch",[o,q]);if(q.veto){return}var t=b(this).is(":checked");a.executeFunctionByName(f.amsCheckerChangeHandler,o,t);if(!f.amsCheckerCancelDefault){var r=n.data("ams-checker-hidden-input");if(t){if(f.amsCheckerMode=="disable"){p.removeAttr("disabled")}else{p.removeClass("switched")}if(r){r.val(l)}b("[data-required]",p).attr("required","required");o.trigger("ams.checker.opened",[o])}else{if(f.amsCheckerMode=="disable"){p.attr("disabled","disabled")}else{p.addClass("switched")}if(r){r.val(j)}b("[data-required]",p).removeAttr("required");o.trigger("ams.checker.closed",[o])}}})}n.appendTo(d);b(">label",o).attr("for",n.attr("id"));d.append("").prependTo(o);var k=b("[required]",p);k.attr("data-required",true);if(f.amsCheckerState=="on"){n.attr("checked",true)}else{if(f.amsCheckerMode=="disable"){p.attr("disabled","disabled")}else{p.addClass("switched")}k.removeAttr("required")}o.data("ams-checker","on")}})},slider:function(c){var d=b(".slider",c);if(d.length>0){a.ajax.check(b.fn.slider,a.baseURL+"ext/bootstrap-slider.min.js",function(){d.each(function(){var h=b(this);var i=h.data();var f={};var e=b.extend({},f,h.data.amsSliderOptions);e=a.executeFunctionByName(i.amsSliderInitCallback,h,e)||e;var g=h.slider(e);a.executeFunctionByName(i.amsSliderAfterInitCallback,h,g,e)})})}},draggable:function(d){var c=b(".draggable",d);if(c.length>0){c.each(function(){var e=b(this);var i=e.data();var g={containment:i.amsDraggableContainment,helper:a.getFunctionByName(i.amsDraggableHelper)||i.amsDraggableHelper,start:a.getFunctionByName(i.amsDraggableStart),stop:a.getFunctionByName(i.amsDraggableStop)};var f=b.extend({},g,i.amsDraggableOptions);f=a.executeFunctionByName(i.amsDraggableInitCallback,e,f)||f;var h=e.draggable(f);e.disableSelection();a.executeFunctionByName(i.amsDraggableAfterInitCallback,e,h,f)})}},sortable:function(c){var d=b(".sortable",c);if(d.length>0){d.each(function(){var i=b(this);var h=i.data();var f={items:h.amsSortableItems,handle:h.amsSortableHandle,connectWith:h.amsSortableConnectwith,start:a.getFunctionByName(h.amsSortableStart),over:a.getFunctionByName(h.amsSortableOver),containment:h.amsSortableContainment,placeholder:h.amsSortablePlaceholder,stop:a.getFunctionByName(h.amsSortableStop)};var e=b.extend({},f,h.amsSortableOptions);e=a.executeFunctionByName(h.amsSortableInitCallback,i,e)||e;var g=i.sortable(e);i.disableSelection();a.executeFunctionByName(h.amsSortableAfterInitCallback,i,g,e)})}},resizable:function(d){var c=b(".resizable",d);if(c.length>0){c.each(function(){var e=b(this);var i=e.data();var g={autoHide:i.amsResizableAutohide===false?true:i.amsResizableAutohide,containment:i.amsResizableContainment,grid:i.amsResizableGrid,handles:i.amsResizableHandles,start:a.getFunctionByName(i.amsResizableStart),stop:a.getFunctionByName(i.amsResizableStop)};var f=b.extend({},g,i.amsResizableOptions);f=a.executeFunctionByName(i.amsResizableInitCallback,e,f)||f;var h=e.resizable(f);e.disableSelection();a.executeFunctionByName(i.amsResizableAfterInitCallback,e,h,f)})}},contextMenu:function(c){var d=b(".context-menu",c);if(d.length>0){d.each(function(){var i=b(this);var h=i.data();var f={menuSelector:h.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var e=b.extend({},f,h.amsContextmenuOptions);e=a.executeFunctionByName(h.amsContextmenuInitCallback,i,e)||e;var g=i.contextMenu(e);a.executeFunctionByName(h.amsContextmenuAfterInitCallback,i,g,e)})}},select2:function(d){var c=b(".select2",d);if(c.length>0){a.ajax.check(b.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+(a.devmode?".js":".min.js"),function(){c.each(function(){var e=b(this);var j=e.data();var h={placeholder:j.amsSelect2Placeholder,multiple:j.amsSelect2Multiple,minimumInputLength:j.amsSelect2MinimumInputLength||0,maximumSelectionSize:j.amsSelect2MaximumSelectionSize,openOnEnter:j.amsSelect2EnterOpen===undefined?true:j.amsSelect2EnterOpen,allowClear:j.amsSelect2AllowClear===undefined?true:j.amsSelect2AllowClear,width:j.amsSelect2Width||"100%",initSelection:a.getFunctionByName(j.amsSelect2InitSelection),formatSelection:j.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(j.amsSelect2FormatSelection),formatResult:a.getFunctionByName(j.amsSelect2FormatResult),formatMatches:j.amsSelect2FormatMatches===undefined?function(k){if(k==1){return a.i18n.SELECT2_MATCH}else{return k+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(j.amsSelect2FormatMatches),formatNoMatches:j.amsSelect2FormatResult===undefined?function(k){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(j.amsSelect2FormatResult),formatInputTooShort:j.amsSelect2FormatInputTooShort===undefined?function(k,l){var m=l-k.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,m).replace(/\{1\}/,m==1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(j.amsSelect2FormatInputTooShort),formatInputTooLong:j.amsSelect2FormatInputTooLong===undefined?function(l,k){var m=l.length-k;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,m).replace(/\{1\}/,m==1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(j.amsSelect2FormatInputTooLong),formatSelectionTooBig:j.amsSelect2FormatSelectionTooBig===undefined?function(k){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,k).replace(/\{1\}/,k==1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(j.amsSelect2FormatSelectionTooBig),formatLoadMore:j.amsSelect2FormatLoadMore===undefined?function(k){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(j.amsSelect2FormatLoadMore),formatSearching:j.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(j.amsSelect2FormatSearching),separator:j.amsSelect2Separator||",",tokenSeparators:j.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(j.amsSelect2Tokenizer)};switch(e.context.type){case"text":case"hidden":if(!h.initSelection){var f=e.data("ams-select2-values");if(f){h.initSelection=function(k,m){var l=[];b(k.val().split(h.separator)).each(function(){l.push({id:this,text:f[this]||this})});m(l)}}}break;default:break}if(e.attr("readonly")){h.query=function(){return[]}}else{if(j.amsSelect2Query){h.query=a.getFunctionByName(j.amsSelect2Query);h.minimumInputLength=j.amsSelect2MinimumInputLength||1}else{if(j.amsSelect2QueryUrl){h.ajax={url:j.amsSelect2QueryUrl,quietMillis:j.amsSelect2QuietMillis||200,type:j.amsSelect2QueryType||"POST",dataType:j.amsSelect2QueryDatatype||"json",data:function(m,n,l){var k={};k[j.amsSelect2QueryParamName||"query"]=m;k[j.amsSelect2PageParamName||"page"]=n;k[j.amsSelect2ContextParamName||"context"]=l;return b.extend({},k,j.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};h.minimumInputLength=j.amsSelect2MinimumInputLength||1}else{if(j.amsSelect2QueryMethod){h.query=function(k){var l={id:new Date().getTime(),params:j.amsSelect2QueryParams||{},success:function(m){return a.helpers.select2QueryMethodSuccessCallback.call(e,m,"success",k)},error:a.error.show};l.params[j.amsSelect2QueryParamName||"query"]=k.term;l.params[j.amsSelect2PageParamName||"page"]=k.page;l.params[j.amsSelect2ContextParamName||"context"]=k.context;l=b.extend({},l,j.amsSelect2QueryOptions);l=a.executeFunctionByName(j.amsSelect2QueryInitCallback,e,l)||l;a.ajax.check(b.jsonRPC,a.baseURL+"ext/jquery-jsonrpc"+(a.devmode?".js":".min.js"),function(){b.jsonRPC.withOptions({endPoint:j.amsSelect2MethodTarget||a.jsonrpc.getAddr(),namespace:j.amsSelect2MethodNamespace,cache:false},function(){b.jsonRPC.request(j.amsSelect2QueryMethod,l)})})};h.minimumInputLength=j.amsSelect2MinimumInputLength||1}else{if(j.amsSelect2Tags){h.tags=j.amsSelect2Tags}else{if(j.amsSelect2Data){h.data=j.amsSelect2Data}}}}}}if(j.amsSelect2EnableFreeTags){h.createSearchChoice=function(k){return{id:k,text:(j.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+k}}}var g=b.extend({},h,j.amsSelect2Options);g=a.executeFunctionByName(j.amsSelect2InitCallback,e,g)||g;var i=e.select2(g);a.executeFunctionByName(j.amsSelect2AfterInitCallback,e,i,g);if(e.hasClass("ordered")){e.addClass("nofloat");a.ajax.check(b.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+(a.devmode?".js":".min.js"),function(){e.select2Sortable({bindOrder:"sortableStop"})})}e.on("change",function(){var k=b(e.get(0).form).data("validator");if(k!==undefined){b(e).valid()}})})})}},maskedit:function(d){var c=b("[data-mask]",d);if(c.length>0){a.ajax.check(b.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.3.1.min.js",function(){c.each(function(){var e=b(this);var i=e.data();var g={placeholder:i.amsMaskeditPlaceholder||"X"};var f=b.extend({},g,i.amsMaskeditOptions);f=a.executeFunctionByName(i.amsMaskeditInitCallback,e,f)||f;var h=e.mask(e.attr("data-mask"),f);a.executeFunctionByName(i.amsMaskeditAfterInitCallback,e,h,f)})})}},datepicker:function(c){var d=b(".datepicker",c);if(d.length>0){a.ajax.check(b.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+(a.devmode?".js":".min.js"),function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+(a.devmode?".css":".min.css"),"jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}d.each(function(){var f=b(this);var j=f.data();var h={lang:j.amsDatetimepickerLang||a.lang,format:j.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var g=b.extend({},h,j.amsDatetimepickerOptions);g=a.executeFunctionByName(j.amsDatetimepickerInitCallback,f,g)||g;var i=f.datetimepicker(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},datetimepicker:function(d){var c=b(".datetimepicker",d);if(c.length>0){a.ajax.check(b.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+(a.devmode?".js":".min.js"),function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+(a.devmode?".css":".min.css"),"jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}c.each(function(){var f=b(this);var j=f.data();var h={lang:j.amsDatetimepickerLang||a.lang,format:j.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var g=b.extend({},h,j.amsDatetimepickerOptions);g=a.executeFunctionByName(j.amsDatetimepickerInitCallback,f,g)||g;var i=f.datetimepicker(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},timepicker:function(d){var c=b(".timepicker",d);if(c.length>0){a.ajax.check(b.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+(a.devmode?".js":".min.js"),function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+(a.devmode?".css":".min.css"),"jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}c.each(function(){var f=b(this);var j=f.data();var h={lang:j.amsDatetimepickerLang||a.lang,format:j.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var g=b.extend({},h,j.amsDatetimepickerOptions);g=a.executeFunctionByName(j.amsDatetimepickerInitCallback,f,g)||g;var i=f.datetimepicker(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},colorpicker:function(c){var d=b(".colorpicker",c);if(d.length>0){a.ajax.check(b.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+(a.devmode?".js":".min.js"),function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+(a.devmode?".css":".min.css"),"jquery-minicolors")}d.each(function(){var f=b(this);var j=f.data();var h={position:j.amsColorpickerPosition||f.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var g=b.extend({},h,j.amsColorpickerOptions);g=a.executeFunctionByName(j.amsColorpickerInitCallback,f,g)||g;var i=f.minicolors(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},typeahead:function(d){var c=b(".typeahead",d);if(c.length>0){a.ajax.check(b.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+(a.devmode?".js":".min.js"),function(){c.each(function(){var e=b(this);var i=e.data();var g={};var f=b.extend({},g,i.amsTypeaheadOptions);f=a.executeFunctionByName(i.amsTypeaheadInitCallback,e,f)||f;var h=e.typeahead(f);a.executeFunctionByName(i.amsTypeaheadAfterInitCallback,e,h,f)})})}},validate:function(d){var c=b("FORM:not([novalidate])",d);if(c.length>0){a.ajax.check(b.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+(a.devmode?".js":".min.js"),function(g){if(g){b.validator.setDefaults({highlight:function(h){b(h).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(h){b(h).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(i,j){var h=j.parents("label:first");if(h.length){i.insertAfter(h)}else{i.insertAfter(j)}}});if(a.plugins.i18n){for(var e in a.plugins.i18n.validate){var f=a.plugins.i18n.validate[e];if((typeof(f)=="string")&&(f.indexOf("{0}")>-1)){a.plugins.i18n.validate[e]=b.validator.format(f)}}b.extend(b.validator.messages,a.plugins.i18n.validate)}}c.each(function(){var k=b(this);var l=k.data();var i={ignore:null,submitHandler:k.attr("data-async")!==undefined?l.amsFormSubmitHandler===undefined?function(){b(".state-error",k).removeClass("state-error");a.ajax.check(b.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+(a.devmode?".js":".min.js"));return a.form.submit(k)}:a.getFunctionByName(l.amsFormSubmitHandler):undefined,invalidHandler:k.attr("data-async")!==undefined?l.amsFormInvalidHandler===undefined?function(q,p){b(".state-error",k).removeClass("state-error");for(var n in p.errorList){var m=p.errorList[n];var o=b(m.element).parents(".tab-pane").index()+1;if(o>0){var r=b(".nav-tabs",b(m.element).parents(".tabforms"));b("li:nth-child("+o+")",r).removeClassPrefix("state-").addClass("state-error");b("li.state-error:first a",r).click()}}}:a.getFunctionByName(l.amsFormInvalidHandler):undefined};var h=b.extend({},i,l.amsValidateOptions);h=a.executeFunctionByName(l.amsValidateInitCallback,k,h)||h;var j=k.validate(h);a.executeFunctionByName(l.amsValidateAfterInitCallback,k,j,h)})})}},datatable:function(d){var c=b(".datatable",d);if(c.length>0){a.ajax.check(b.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+(a.devmode?".js":".min.js"),function(e){if(e){b.fn.dataTableExt.oSort["numeric-comma-asc"]=function(h,g){var f=h.replace(/,/,".").replace(/ /g,"");var i=g.replace(/,/,".").replace(/ /g,"");f=parseFloat(f);i=parseFloat(i);return((fi)?1:0))};b.fn.dataTableExt.oSort["numeric-comma-desc"]=function(h,g){var f=h.replace(/,/,".").replace(/ /g,"");var i=g.replace(/,/,".").replace(/ /g,"");f=parseFloat(f);i=parseFloat(i);return((fi)?-1:0))}}b(c).each(function(){a.ajax.check(b.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+(a.devmode?".js":".min.js"));var u=b(this);var x=u.data();var w=(x.amsDatatableExtensions||"").split(/\s+/);var h=x.amsDatatableSdom||"W"+((w.indexOf("colreorder")>=0||w.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(w.indexOf("colvis")>=0?"C":"")+((x.amsDatatablePagination===false||x.amsDatatablePaginationSize===false)?"":"L")+(x.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(w.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(x.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var r={bJQueryUI:false,bFilter:x.amsDatatableGlobalFilter!==false,bPaginate:x.amsDatatablePagination!==false,bInfo:x.amsDatatableInfo!==false,bSort:x.amsDatatableSort!==false,bDeferRender:true,bAutoWidth:false,iDisplayLength:x.amsDatatableDisplayLength||25,sPaginationType:x.amsDatatablePaginationType||"bootstrap_full",sDom:h,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(A,z){b(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' ')}};var v=b.extend({},r,x.amsDatatableOptions);var j;if(w.length>0){for(j in w){switch(w[j]){case"autofill":a.ajax.check(b.fn.dataTable.AutoFill,a.baseURL+"ext/jquery-dataTables-autoFill"+(a.devmode?".js":".min.js"));break;case"columnfilter":a.ajax.check(b.fn.columnFilter,a.baseURL+"ext/jquery-dataTables-columnFilter"+(a.devmode?".js":".min.js"));break;case"colreorder":a.ajax.check(b.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorder"+(a.devmode?".js":".min.js"));break;case"colreorderwithresize":a.ajax.check(b.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorderWithResize"+(a.devmode?".js":".min.js"));break;case"colvis":a.ajax.check(b.fn.dataTable.ColVis,a.baseURL+"ext/jquery-dataTables-colVis"+(a.devmode?".js":".min.js"));var n={activate:"click",sAlign:"right"};v.oColVis=b.extend({},n,x.amsDatatableColvisOptions);break;case"editable":a.ajax.check(b.fn.editable,a.baseURL+"ext/jquery-jeditable"+(a.devmode?".js":".min.js"));a.ajax.check(b.fn.makeEditable,a.baseURL+"ext/jquery-dataTables-editable"+(a.devmode?".js":".min.js"));break;case"fixedcolumns":a.ajax.check(b.fn.dataTable.FixedColumns,a.baseURL+"ext/jquery-dataTables-fixedColumns"+(a.devmode?".js":".min.js"));break;case"fixedheader":a.ajax.check(b.fn.dataTable.FixedHeader,a.baseURL+"ext/jquery-dataTables-fixedHeader"+(a.devmode?".js":".min.js"));break;case"keytable":a.ajax.check(window.KeyTable,a.baseURL+"ext/jquery-dataTables-keyTable"+(a.devmode?".js":".min.js"));break;case"rowgrouping":a.ajax.check(b.fn.rowGrouping,a.baseURL+"ext/jquery-dataTables-rowGrouping"+(a.devmode?".js":".min.js"));break;case"rowreordering":a.ajax.check(b.fn.rowReordering,a.baseURL+"ext/jquery-dataTables-rowReordering"+(a.devmode?".js":".min.js"));break;case"scroller":a.ajax.check(b.fn.dataTable.Scroller,a.baseURL+"ext/jquery-dataTables-scroller"+(a.devmode?".js":".min.js"));break;default:break}}}v=a.executeFunctionByName(x.amsDatatableInitCallback,u,v)||v;var g=u.dataTable(v);a.executeFunctionByName(x.amsDatatableAfterInitCallback,u,g,v);if(w.length>0){for(j in w){switch(w[j]){case"autofill":var y=b.extend({},x.amsDatatableAutofillOptions,v.autofill);y=a.executeFunctionByName(x.amsDatatableAutofillInitCallback,u,y)||y;u.data("ams-autofill",x.amsDatatableAutofillConstructor===undefined?new b.fn.dataTable.AutoFill(u,y):a.executeFunctionByName(x.amsDatatableAutofillConstructor,u,g,y));break;case"columnfilter":var k={sPlaceHolder:"head:after"};var l=b.extend({},k,x.amsDatatableColumnfilterOptions,v.columnfilter);l=a.executeFunctionByName(x.amsDatatableColumnfilterInitCallback,u,l)||l;u.data("ams-columnfilter",x.amsDatatableColumnfilterConstructor===undefined?g.columnFilter(l):a.executeFunctionByName(x.amsDatatableColumnfilterConstructor,u,g,l));break;case"editable":var m=b.extend({},x.amsDatatableEditableOptions,v.editable);m=a.executeFunctionByName(x.amsDatatableEditableInitCallback,u,m)||m;u.data("ams-editable",x.amsDatatableEditableConstructor===undefined?u.makeEditable(m):a.executeFunctionByName(x.amsDatatableEditableConstructor,u,g,m));break;case"fixedcolumns":var f=b.extend({},x.amsDatatableFixedcolumnsOptions,v.fixedcolumns);f=a.executeFunctionByName(x.amsDatatableFixedcolumnsInitCallback,u,f)||f;u.data("ams-fixedcolumns",x.amsDatatableFixedcolumnsConstructor===undefined?new b.fn.dataTable.FixedColumns(u,f):a.executeFunctionByName(x.amsDatatableFixedcolumnsConstructor,u,g,f));break;case"fixedheader":var s=b.extend({},x.amsDatatableFixedheaderOptions,v.fixedheader);s=a.executeFunctionByName(x.amsDatatableFixedheadeInitCallback,u,s)||s;u.data("ams-fixedheader",x.amsDatatableFixedheaderConstructor===undefined?new b.fn.dataTable.FixedHeader(u,s):a.executeFunctionByName(x.amsDatatableFixedheaderConstructor,u,g,s));break;case"keytable":var i={table:u.get(0),datatable:g};var q=b.extend({},i,x.amsDatatableKeytableOptions,v.keytable);q=a.executeFunctionByName(x.amsDatatableKeytableInitCallback,u,q)||q;u.data("ams-keytable",x.amsDatatableKeytableConstructor===undefined?new KeyTable(q):a.executeFunctionByName(x.amsDatatableKeytableConstructor,u,g,q));break;case"rowgrouping":var p=b.extend({},x.amsDatatableRowgroupingOptions,v.rowgrouping);p=a.executeFunctionByName(x.amsDatatableRowgroupingInitCallback,u,p)||p;u.data("ams-rowgrouping",x.amsDatatableRowgroupingConstructor===undefined?u.rowGrouping(p):a.executeFunctionByName(x.amsDatatableRowgroupingConstructor,u,g,p));break;case"rowreordering":var o=b.extend({},x.amsDatatableRowreorderingOptions,v.rowreordering);o=a.executeFunctionByName(x.amsDatatableRowreorderingInitCallback,u,o)||o;u.data("ams-rowreordering",x.amsDatatableRowreorderingConstructor===undefined?u.rowReordering(o):a.executeFunctionByName(x.amsDatatableRowreorderingConstructor,u,g,o));break;default:break}}}var t=(x.amsDatatableFinalizeCallback||"").split(/\s+/);if(t.length>0){for(j in t){a.executeFunctionByName(t[j],u,g,v)}}})})}},tablednd:function(d){var c=b(".table-dnd",d);if(c.length>0){a.ajax.check(b.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+(a.devmode?".js":".min.js"),function(e){c.each(function(){var i=b(this);b(i).on("mouseover","tr",function(){b(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){b(this.cells[0]).removeClass("drag-handle")});var j=i.data();var g={onDragClass:j.amsTabledndDragClass||"dragging-row",onDragStart:j.amsTabledndDragStart,dragHandle:j.amsTabledndDragHandle,scrollAmount:j.amsTabledndScrollAmount,onAllowDrop:j.amsTabledndAllowDrop,onDrop:j.amsTabledndDrop||function(m,o){var l=j.amsTabledndDropTarget;if(l){var k=[];b(m.rows).each(function(){var p=b(this).data("ams-element-name");if(p){k.push(p)}});var n=a.getFunctionByName(l);if(typeof(n)=="function"){n.call(i,m,k)}else{a.ajax.post(l,{names:k})}}}};var f=b.extend({},g,j.amsTabledndOptions);f=a.executeFunctionByName(j.amsTabledndInitCallback,i,f)||f;var h=i.tableDnD(f);a.executeFunctionByName(j.amsTabledndAfterInitCallback,i,h,f)})})}},fancybox:function(c){var d=b(".fancybox",c);if(d.length>0){a.ajax.check(b.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+(a.devmode?".js":".min.js"),function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+(a.devmode?".css":".min.css"))}d.each(function(){var f=b(this);var m=f.data();var l=(m.amsFancyboxHelpers||"").split(/\s+/);if(l.length>0){for(var g in l){var k=l[g];switch(k){case"buttons":a.ajax.check(b.fancybox.helpers.buttons,a.baseURL+"ext/fancybox-helpers/fancybox-buttons.js"+(a.devmode?".js":".min.js"));break;case"thumbs":a.ajax.check(b.fancybox.helpers.thumbs,a.baseURL+"ext/fancybox-helpers/fancybox-thumbs.js"+(a.devmode?".js":".min.js"));break;case"media":a.ajax.check(b.fancybox.helpers.media,a.baseURL+"ext/fancybox-helpers/fancybox-media.js"+(a.devmode?".js":".min.js"));break;default:break}}}var i={type:m.amsFancyboxType,padding:m.amsFancyboxPadding||10,margin:m.amsFancyboxMargin||10,beforeLoad:a.getFunctionByName(m.amsFancyboxBeforeLoad)||function(){this.title=a.executeFunctionByName(m.amsFancyboxTitleGetter,this)||b(this.element).attr("original-title")||b(this.element).attr("title")},helpers:{title:{type:"inside"}}};var h=b.extend({},i,m.amsFancyboxOptions);h=a.executeFunctionByName(m.amsFancyboxInitCallback,f,h)||h;var j=f.fancybox(h);a.executeFunctionByName(m.amsFancyboxAfterInitCallback,f,j,h)})})}},imgareaselect:function(d){var c=b(".imgareaselect",d);if(c.length>0){a.ajax.check(b.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.10"+(a.devmode?".js":".min.js"),function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+(a.devmode?".css":".min.css"))}c.each(function(){var k=b(this);var j=k.data();var h=j.amsImgareaselectParent?k.parents(j.amsImgareaselectParent):"body";var g={instance:true,handles:true,parent:h,x1:j.amsImgareaselectX1||0,y1:j.amsImgareaselectY1||0,x2:j.amsImgareaselectX2||j.amsImgareaselectImageWidth,y2:j.amsImgareaselectY2||j.amsImgareaselectImageHeight,imageWidth:j.amsImgareaselectImageWidth,imageHeight:j.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:j.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(j.amsImgareaselectSelectEnd)||function(l,m){var n=j.amsImgareaselectTargetField||"image_";b('input[name="'+n+'x1"]',h).val(m.x1);b('input[name="'+n+'y1"]',h).val(m.y1);b('input[name="'+n+'x2"]',h).val(m.x2);b('input[name="'+n+'y2"]',h).val(m.y2)}};var f=b.extend({},g,j.amsImgareaselectOptions);f=a.executeFunctionByName(j.amsImgareaselectInitCallback,k,f)||f;var i=k.imgAreaSelect(f);a.executeFunctionByName(j.amsImgareaselectAfterInitCallback,k,i,f);setTimeout(function(){i.update()},250)})})}},graphs:function(d){var c=b(".sparkline",d);if(c.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+(a.devmode?".js":".min.js"),function(){a.graphs.init(c)})}},scrollbars:function(c){var d=b(".scrollbar",c);if(d.length>0){a.ajax.check(b.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(b.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+(a.devmode?".js":".min.js"),function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}d.each(function(){var j=b(this);var i=j.data();var g={theme:i.amsScrollbarTheme||"light"};var f=b.extend({},g,i.amsScrollbarOptions);f=a.executeFunctionByName(i.amsScrollbarInitCallback,j,f)||f;var h=j.mCustomScrollbar(f);a.executeFunctionByName(i.amsScrollbarAfterInitCallback,j,h,f)})})})}}}};MyAMS.callbacks={init:function(c){b("[data-ams-callback]",c).each(function(){var d=this;var e=b(d).data();var f=a.getFunctionByName(e.amsCallback);if(f===undefined){if(e.amsCallbackSource){a.getScript(e.amsCallbackSource,function(){a.executeFunctionByName(e.amsCallback,d,e.amsCallbackOptions)})}else{if(window.console){console.warn("Undefined callback: "+e.amsCallback)}}}else{f.call(d,e.amsCallbackOptions)}})},alert:function(k){var f=b(this).data();var c=b.extend({},k,f.amsAlertOptions);var i=b(f.amsAlertParent||c.parent||this);var e=f.amsAlertStatus||c.status||"info";var g=f.amsAlertHeader||c.header;var j=f.amsAlertMessage||c.message;var h=f.amsAlertSubtitle||c.subtitle;var d=f.amsAlertMargin===undefined?(c.margin===undefined?false:c.margin):f.amsAlertMargin;a.skin.alert(i,e,g,j,h,d)},messageBox:function(d){var g=b(this).data();var f=b.extend({},d,g.amsMessageboxOptions);var e=b.extend({},f,{title:g.amsMessageboxTitle||f.title||"",content:g.amsMessageboxContent||f.content||"",icon:g.amsMessageboxIcon||f.icon,number:g.amsMessageboxNumber||f.number,timeout:g.amsMessageboxTimeout||f.timeout});var c=g.amsMessageboxStatus||f.status||"info";var h=a.getFunctionByName(g.amsMessageboxCallback||f.callback);a.skin.messageBox(c,e,h)},smallBox:function(d){var g=b(this).data();var f=b.extend({},d,g.amsSmallboxOptions);var e=b.extend({},f,{title:g.amsSmallboxTitle||f.title||"",content:g.amsSmallboxContent||f.content||"",icon:g.amsSmallboxIcon||f.icon,iconSmall:g.amsSmallboxIconSmall||f.iconSmall,timeout:g.amsSmallboxTimeout||f.timeout});var c=g.amsSmallboxStatus||f.status||"info";var h=a.getFunctionByName(g.amsSmallboxCallback||f.callback);a.skin.smallBox(c,e,h)}};MyAMS.events={init:function(c){b("[data-ams-events-handlers]",c).each(function(){var e=b(this);var d=e.data("ams-events-handlers");for(var f in d){e.on(f,a.getFunctionByName(d[f]))}})}};MyAMS.container={changeOrder:function(d,e){var c=b('input[name="'+b(this).data("ams-input-name")+'"]',b(this));c.val(e.join(";"))},deleteElement:function(c){return function(){var d=b(this);MyAMS.skin.bigBox({title:a.i18n.WARNING,content:'  '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(g){if(g==a.i18n.BTN_OK){var i=d.parents("table");var f=i.data("ams-location")||"";var j=d.parents("tr");var h=j.data("ams-delete-target")||i.data("ams-delete-target")||"delete-element.json";var e=j.data("ams-element-name");MyAMS.ajax.post(f+"/"+h,{object_name:e},function(k,l){if(k.status=="success"){if(i.hasClass("datatable")){i.dataTable().fnDeleteRow(j[0])}else{j.remove()}}})}})}}};MyAMS.skin={_setPageHeight:function(){var e=b("#main").height();var c=a.left_panel.height();var d=b(window).height()-a.navbar_height;if(e>d){a.left_panel.css("min-height",e);a.root.css("min-height",e+a.navbar_height)}else{a.left_panel.css("min-height",d);a.root.css("min-height",d)}},_checkMobileWidth:function(){if(b(window).width()<979){a.root.addClass("mobile-view-activated")}else{if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("mobile-view-activated")}}},_showShortcutButtons:function(){a.shortcuts.animate({height:"show"},200,"easeOutCirc");a.root.addClass("shortcut-on")},_hideShortcutButtons:function(){a.shortcuts.animate({height:"hide"},300,"easeOutCirc");a.root.removeClass("shortcut-on")},checkNotification:function(){$this=b("#activity > .badge");if(parseInt($this.text())>0){$this.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{$this.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},_initDesktopWidgets:function(c){if(a.enable_widgets){var d=b(".ams-widget",c);if(d.length>0){a.ajax.check(b.fn.MyAMSWidget,a.baseURL+"myams-widgets"+(a.devmode?".js":".min.js"),function(){d.each(function(){var h=b(this);var g=h.data();var f={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var e=b.extend({},f,g.amsWidgetOptions);e=a.executeFunctionByName(g.amsWidgetInitcallback,h,e)||e;h.MyAMSWidget(e)});MyAMSWidget.initWidgetsGrid(b(".ams-widget-grid",c))})}}},_initMobileWidgets:function(c){if(a.enable_mobile&&a.enable_widgets){a.skin._initDesktopWidgets(c)}},alert:function(j,d,e,k,i,c){b(".alert",j).remove();if(d=="error"){d="danger"}var g='

    '+e+"

    "+(i?("

    "+i+"

    "):"");if(typeof(k)=="string"){g+="
    • "+k+"
    "}else{if(k){g+="
      ";for(var f in k){if(!b.isNumeric(f)){continue}g+="
    • "+k[f]+"
    • "}g+="
    "}}g+="
    ";var h=b(g).prependTo(j);if(j.exists){a.ajax.check(b.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){b.scrollTo(j,{offset:{top:-50}})})}},bigBox:function(c,d){a.ajax.check(a.notify,a.baseURL+"myams-notify"+(a.devmode?".js":".min.js"),function(){a.notify.messageBox(c,d)})},messageBox:function(c,d,e){if(typeof(c)=="object"){e=d;d=c||{};c="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+(a.devmode?".js":".min.js"),function(){switch(c){case"error":case"danger":d.color="#C46A69";break;case"warning":d.color="#C79121";break;case"success":d.color="#739E73";break;default:d.color=d.color||"#3276B1"}d.sound=false;a.notify.bigBox(d,e)})},smallBox:function(c,d,e){if(typeof(c)=="object"){e=d;d=c||{};c="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+(a.devmode?".js":".min.js"),function(){switch(c){case"error":case"danger":d.color="#C46A69";break;case"warning":d.color="#C79121";break;case"success":d.color="#739E73";break;default:d.color=d.color||"#3276B1"}d.sound=false;a.notify.smallBox(d,e)})},_drawBreadCrumb:function(){var c=b("#ribbon OL.breadcrumb");c.empty().append(b("
  • ").append(b("").text(a.i18n.HOME).attr("href",b('nav a[href!="#"]:first').attr("href"))));b("nav LI.active >A").each(function(){var f=b(this);var d=b.trim(f.clone().children(".badge").remove().end().text());var e=b("
  • ").append(f.attr("href").replace(/^#/,"")?b("").html(d).attr("href",f.attr("href")):d);c.append(e)})},checkURL:function(){function c(i){b("nav .active").removeClass("active");i.addClass("open").addClass("active");i.parents("li").addClass("open active").children("ul").addClass("active").show();i.parents("li:first").removeClass("open");i.parents("ul").addClass(i.attr("href").replace(/^#/,"")?"active":"").show()}var f=location.hash;var e=f.replace(/^#/,"");if(e){var d=b("#content");if(!d.exists()){d=b("body")}var g=b('nav A[href="'+f+'"]');if(g.exists()){c(g)}a.skin.loadURL(e,d);document.title=b("[data-ams-page-title]:first",d).data("ams-page-title")||g.attr("title")||document.title}else{var h=b("[data-ams-active-menu]").data("ams-active-menu");if(h){g=b('nav A[href="'+h+'"]')}else{g=b('nav >UL >LI >A[href!="#"]').first()}if(g.exists()){c(g);if(h){a.skin._drawBreadCrumb()}else{window.location.hash=g.attr("href")}}}},loadURL:function(e,c,d,h){if(e.startsWith("#")){e=e.substr(1)}if(typeof(d)=="function"){h=d;d={}}c=b(c);var g={type:"GET",url:e,dataType:"html",cache:false,beforeSend:function(){c.html('

    Loading...

    ');if(c[0]==b("#content")[0]){a.skin._drawBreadCrumb();document.title=b(".breadcrumb LI:last-child").text();b("html, body").animate({scrollTop:0},"fast")}else{c.animate({scrollTop:0},"fast")}},success:function(m,j,l){if(h){a.executeFunctionByName(h,this,m,j,l,d)}else{var k=a.ajax.getResponse(l);var n=k.content_type;var i=k.data;switch(n){case"json":a.ajax.handleJSON(i,c);break;case"script":break;case"xml":break;case"html":case"text":default:c.parents(".hidden").removeClass("hidden");b(".alert",c.parents(".alerts-container")).remove();c.css({opacity:"0.0"}).html(m).removeClass("hidden").delay(50).animate({opacity:"1.0"},300);a.initContent(c)}if(d&&d.afterLoadCallback){a.executeFunctionByName(d.afterLoadCallback,this)}}},error:function(k,j,i){c.html('

    '+a.i18n.ERROR+i+"

    "+k.responseText)},async:false};var f=b.extend({},g,d);b.ajax(f)},setLanguage:function(d){var f=d.lang;var e=d.handler_type||"json";switch(e){case"json":var g=d.method||"setUserLanguage";a.jsonrpc.post(g,{lang:f},function(){window.location.reload(true)});break;case"ajax":var c=d.href||"setUserLanguage";a.ajax.post(c,{lang:f},function(){window.location.reload(true)});break}},logout:function(){window.location=a.loginURL}};MyAMS.initPage=function(){var c=b("body");a.root=c;a.left_panel=b("#left-panel");a.shortcuts=b("#shortcut");a.plugins.initData(c);var d=b.ajaxSettings.xhr;b.ajaxSetup({progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var f=d();if(f&&(typeof(f.addEventListener)=="function")){var e=this;f.addEventListener("progress",function(g){e.progress(g)},false)}return f}});b(document).ajaxStart(a.ajax.start);b(document).ajaxStop(a.ajax.stop);b(document).ajaxError(a.error.ajax);if(!a.isMobile){a.root.addClass("desktop-detected");a.device="desktop"}else{a.root.addClass("mobile-detected");a.device="mobile";if(a.enable_fastclick){a.ajax.check(b.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+(a.devmode?".js":".min.js"),function(){b("NAV UL A").noClickDelay();b("#hide-menu A").noClickDelay()})}}b("#hide-menu >:first-child > A").click(function(f){c.toggleClass("hidden-menu");f.preventDefault()});b("#show-shortcut").click(function(f){if(a.shortcuts.is(":visible")){a.skin._hideShortcutButtons()}else{a.skin._showShortcutButtons()}f.preventDefault()});b(document).mouseup(function(f){if(!a.shortcuts.is(f.target)&&a.shortcuts.has(f.target).length===0){a.skin._hideShortcutButtons()}});b("#search-mobile").click(function(){a.root.addClass("search-mobile")});b("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")});b("#activity").click(function(g){var f=b(this);var h=f.next(".ajax-dropdown");if(!h.is(":visible")){h.css("left",f.position().left-h.innerWidth()/2+f.innerWidth()/2).fadeIn(150);f.addClass("active")}else{h.fadeOut(150);f.removeClass("active")}g.preventDefault()});a.skin.checkNotification();b(document).mouseup(function(f){var g=b(".ajax-dropdown");if(!g.is(f.target)&&g.has(f.target).length===0){g.fadeOut(150).prev().removeClass("active")}});b('input[name="activity"]').change(function(){var e=b(this).data("ams-url");container=b(".ajax-notifications");a.skin.loadURL(e,container)});b("#logout a").click(function(f){f.preventDefault();f.stopPropagation();a.loginURL=b(this).attr("href");a.skin.bigBox({title:" "+a.i18n.LOGOUT+" "+b("#show-shortcut").text()+" ?",content:a.i18n.LOGOUT_COMMENT,buttons:"["+a.i18n.BTN_NO+"]["+a.i18n.BTN_YES+"]"},function(e){if(e==a.i18n.BTN_YES){a.root.addClass("animated fadeOutUp");setTimeout(a.skin.logout,1000)}})});b("NAV UL").myams_menu({accordion:true,speed:a.menu_speed});b(".minifyme").click(function(f){b("BODY").toggleClass("minified");b(this).effect("highlight",{},500);f.preventDefault()});b("#refresh").click(function(f){a.skin.bigBox({title:" "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(e){if(e==a.i18n.BTN_OK&&localStorage){localStorage.clear();location.reload()}});f.preventDefault()});c.on("click",function(g){var f=b(this);if(!f.is(g.target)&&f.has(g.target).length===0&&b(".popover").has(g.target).length===0){f.popover("hide")}});a.ajax.check(b.resize,a.baseURL+"ext/jquery-resize"+(a.devmode?".js":".min.js"),function(){b("#main").resize(function(){a.skin._setPageHeight();a.skin._checkMobileWidth()});b("nav").resize(function(){a.skin._setPageHeight()})});if(a.ajax_nav){if(b("nav").length>0){a.skin.checkURL()}b(document).on("click",'a[href="#"]',function(f){f.preventDefault()});b(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(j){var h=b(j.currentTarget);var f=h.attr("href")||h.data("ams-url");if(!f||f.startsWith("javascript:")||h.attr("target")||(h.data("ams-context-menu")===true)){return}j.preventDefault();j.stopPropagation();var g=a.getFunctionByName(f);if(typeof(g)=="function"){f=g.call(h)}if(typeof(f)=="function"){f.call(h)}else{f=f.replace(/\%23/,"#");var i=h.data("ams-target");if(i){a.form.confirmChangedForm(i,function(){a.skin.loadURL(f,i,h.data("ams-link-options"),h.data("ams-link-callback"));j.stopPropagation()})}else{a.form.confirmChangedForm(function(){if(f.startsWith("#")){if(f!=location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=f},150)}else{window.location.hash=f}}}else{window.location=f}})}}});b(document).on("click",'a[target="_blank"]',function(f){f.preventDefault();window.open(b(f.currentTarget).attr("href"))});b(document).on("click",'a[target="_top"]',function(f){f.preventDefault();a.form.confirmChangedForm(function(){window.location=b(f.currentTarget).attr("href")})});b(window).on("hashchange",a.skin.checkURL)}b(document).off("click.modal").on("click",'[data-toggle="modal"]',function(g){var f=b(this);if(f.data("ams-context-menu")===true){return}if(f.data("ams-stop-propagation")===true){g.stopPropagation()}g.preventDefault();a.dialog.open(f);if(f.parents("#shortcut").exists()){setTimeout(a.skin._hideShortcutButtons,300)}});b(document).on("click",'button[type="submit"], button.submit',function(){var e=b(this);b(e.get(0).form).data("ams-submit-button",e)});b(document).on("click","[data-ams-click-handler]",function(h){var g=b(this);var f=g.data();if(f.amsClickHandler){if((f.amsStopPropagation===true)||(f.amsClickStopPropagation===true)){h.stopPropagation()}if(f.amsClickKeepDefault!==true){h.preventDefault()}var i=a.getFunctionByName(f.amsClickHandler);if(i!==undefined){i.call(g,f.amsClickHandlerOptions)}}});b(document).on("change","[data-ams-change-handler]",function(h){var g=b(this);var f=g.data();if(f.amsChangeHandler){if(f.amsChangeKeepDefault!==true){h.preventDefault()}var i=a.getFunctionByName(f.amsChangeHandler);if(i!==undefined){i.call(g,f.amsChangeHandlerOptions)}}});b(document).on("reset","[data-ams-reset-handler]",function(h){var f=b(this);var g=f.data();if(g.amsResetHandler){if(g.amsResetKeepDefault!==true){h.preventDefault()}var i=a.getFunctionByName(g.amsResetHandler);if(i!==undefined){i.call(f,g.amsResetHandlerOptions)}}});b(document).on("change",'input[type="file"]',function(h){h.preventDefault();var f=b(this);var g=f.parent(".button");if(g.exists()&&g.parent().hasClass("input-file")){g.next('input[type="text"]').val(f.val())}});b("a[data-toggle=tab]",".nav-tabs").on("click",function(f){if(b(this).parent("li").hasClass("disabled")){f.preventDefault();return false}});b(document).on("show.bs.tab",function(h){var f=b(h.target);var g=f.data();if(g.amsUrl){if(g.amsTabLoaded){return}a.skin.loadURL(g.amsUrl,f.attr("href"));if(g.amsTabLoadOnce){f.data("ams-tab-loaded",true)}}});a.plugins.enabled.hint(document);if((window.location.hash=="")||(a.getQueryVar(window.location.href,"came_from")!=false)){a.initContent(document)}b(window).on("beforeunload",a.form.checkBeforeUnload)};MyAMS.initContent=function(c){b(".tipsy").remove();b("[rel=tooltip]",c).tooltip();b("[rel=popover]",c).popover();b("[rel=popover-hover]",c).popover({trigger:"hover"});a.plugins.init(c);a.callbacks.init(c);a.events.init(c);a.form.init(c);if(a.device==="desktop"){a.skin._initDesktopWidgets(c)}else{a.skin._initMobileWidgets(c)}a.skin._setPageHeight()};MyAMS.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",FORM_CHANGED_WARNING:"Some changes were not saved. These updates will be lost if you leave this page.",DELETE_WARNING:"This change can't be undone. Are you sure that you want to delete this element?",NO_UPDATE:"No changes were applied.",DATA_UPDATED:"Data successfully updated.",HOME:"Home",LOGOUT:"Logout?",LOGOUT_COMMENT:"You can improve your security further after logging out by closing this opened browser",SELECT2_PLURAL:"s",SELECT2_MATCH:"One result is available, press enter to select it.",SELECT2_MATCHES:" results are available, use up and down arrow keys to navigate.",SELECT2_NOMATCHES:"No matches found",SELECT2_SEARCHING:"Searching...",SELECT2_LOADMORE:"Loading more results...",SELECT2_INPUT_TOOSHORT:"Please enter {0} more character{1}",SELECT2_INPUT_TOOLONG:"Please delete {0} character{1}",SELECT2_SELECTION_TOOBIG:"You can only select {0} item{1}",SELECT2_FREETAG_PREFIX:"Free text: ",DT_COLUMNS:"Columns"};b(document).ready(function(){b=jQuery.noConflict();var c=b("HTML");var d=c.attr("lang")||c.attr("xml:lang");if(d&&!d.startsWith("en")){MyAMS.lang=d;MyAMS.getScript(MyAMS.baseURL+"i18n/myams_"+d.substr(0,2)+".js",function(){MyAMS.initPage()})}else{MyAMS.initPage()}})})(jQuery); \ No newline at end of file +(function(b){String.prototype.startsWith=function(e){var c=this.length;var d=e.length;if(c0};if(b.scrollbarWidth===undefined){b.scrollbarWidth=function(){var d=b('
    ').appendTo("body");var e=d.children();var c=e.innerWidth()-e.height(99).innerWidth();d.remove();return c}}b.fn.extend({exists:function(){return b(this).length>0},listattr:function(d){var c=[];this.each(function(){c.push(b(this).attr(d))});return c},style:function(d,g,c){var f=this.get(0);if(typeof f=="undefined"){return}var e=this.get(0).style;if(typeof d!="undefined"){if(typeof g!="undefined"){c=typeof c!="undefined"?c:"";e.setProperty(d,g,c);return this}else{return e.getPropertyValue(d)}}else{return e}},removeClassPrefix:function(c){this.each(function(e,f){var d=f.className.split(" ").map(function(g){return g.startsWith(c)?"":g});f.className=b.trim(d.join(" "))});return this},contextMenu:function(d){function c(g,i,f){var h=b(window)[i](),j=b(d.menuSelector)[i](),e=g;if(g+j>h&&j
    ',openedSign:''};var d=b.extend({},e,c);var f=b(this);f.find("LI").each(function(){var g=b(this);if(g.find("UL").size()>0){g.find("A:first").append(""+d.closedSign+"");var h=g.find("A:first");if(h.attr("href")=="#"){h.click(function(){return false})}}});f.find("LI.active").each(function(){var g=b(this).parents("UL");var h=g.parent("LI");g.slideDown(d.speed);h.find("b:first").html(d.openedSign);h.addClass("open")});f.find("LI A").on("click",function(){var j=b(this);var g=j.parent().find("UL");if(d.accordion){var i=j.parent().parents("UL");var k=f.find("UL:visible");k.each(function(l){var m=true;i.each(function(n){if(i[n]==k[l]){m=false;return false}});if(m){if(g!=k[l]){b(k[l]).slideUp(d.speed,function(){j.parent("LI").find("b:first").html(d.closedSign);j.parent("LI").removeClass("open")})}}})}var h=j.parent().find("UL:first");if(!j.attr("href").replace(/^#/,"")&&h.is(":visible")&&!h.hasClass("active")){h.slideUp(d.speed,function(){j.parent("LI").removeClass("open").find("B:first").delay(d.speed).html(d.closedSign)})}else{h.slideDown(d.speed,function(){j.parent("LI").addClass("open").find("B:first").delay(d.speed).html(d.openedSign)})}})}});b.UTF8={encode:function(e){e=e.replace(/\r\n/g,"\n");var d="";for(var g=0;g127)&&(f<2048)){d+=String.fromCharCode((f>>6)|192);d+=String.fromCharCode((f&63)|128)}else{d+=String.fromCharCode((f>>12)|224);d+=String.fromCharCode(((f>>6)&63)|128);d+=String.fromCharCode((f&63)|128)}}}return d},decode:function(d){var f="";var h=0,j=0,g=0,e=0;while(h191)&&(j<224)){g=d.charCodeAt(h+1);f+=String.fromCharCode(((j&31)<<6)|(g&63));h+=2}else{g=d.charCodeAt(h+1);e=d.charCodeAt(h+2);f+=String.fromCharCode(((j&15)<<12)|((g&63)<<6)|(e&63));h+=3}}}return f}};if(window.MyAMS===undefined){window.MyAMS={devmode:true,devext:"",lang:"en",throttle_delay:350,menu_speed:235,navbar_height:49,ajax_nav:true,enable_widgets:true,enable_mobile:false,enable_fastclick:false,warn_on_form_change:false,ismobile:(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))}}var a=MyAMS;MyAMS.baseURL=(function(){var c=b('script[src*="/myams.js"], script[src*="/myams.min.js"]');var d=c.attr("src");a.devmode=d.indexOf(".min.js")<0;a.devext=a.devmode?"":".min";return d.substring(0,d.lastIndexOf("/")+1)})();MyAMS.getQueryVar=function(e,f){if(e.indexOf("?")<0){return false}if(!e.endsWith("&")){e+="&"}var c=new RegExp(".*?[&\\?]"+f+"=(.*?)&.*");var d=e.replace(c,"$1");return d==e?false:d};MyAMS.rgb2hex=function(c){return"#"+b.map(c.match(/\b(\d+)\b/g),function(d){return("0"+parseInt(d).toString(16)).slice(-2)}).join("")};MyAMS.generateId=function(){function c(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return c()+c()+c()+c()};MyAMS.getFunctionByName=function(h,d){if(h===undefined){return undefined}else{if(typeof(h)=="function"){return h}}var g=h.split(".");var f=g.pop();d=(d===undefined||d===null)?window:d;for(var c=0;c").attr({rel:"stylesheet",type:"text/css",href:f,"data-ams-id":g}).appendTo(e)}};MyAMS.event={stop:function(c){if(!c){c=window.event}if(c){if(c.stopPropagation){c.stopPropagation();c.preventDefault()}else{c.cancelBubble=true;c.returnValue=false}}}};MyAMS.browser={getInternetExplorerVersion:function(){var e=-1;if(navigator.appName=="Microsoft Internet Explorer"){var c=navigator.userAgent;var d=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(d.exec(c)!=null){e=parseFloat(RegExp.$1)}}return e},checkVersion:function(){var d="You're not using Windows Internet Explorer.";var c=this.getInternetExplorerVersion();if(c>-1){if(c>=8){d="You're using a recent copy of Windows Internet Explorer."}else{d="You should upgrade your copy of Windows Internet Explorer."}}alert(d)},isIE8orlower:function(){var d="0";var c=this.getInternetExplorerVersion();if(c>-1){if(c>=9){d=0}else{d=1}}return d}};MyAMS.error={ajax:function(f,e){if(e.statusText=="OK"){return}var c=a.ajax.getResponse(e);if(c.content_type=="json"){a.ajax.handleJSON(c.data)}else{var g=f.statusText||f.type;var d=e.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

    "+g+"

    "+d+"

    ",icon:"fa fa-warning animated shake",timeout:10000})}if(window.console){console.error(f);console.debug(e)}},show:function(f,c,e){if(!e){return}var d=a.ajax.getResponse(f);if(d.content_type=="json"){a.ajax.handleJSON(d.data)}else{a.skin.messageBox("error",{title:a.i18n.ERRORS_OCCURED,content:"

    "+c+"

    "+e+"

    ",icon:"fa fa-warning animated shake",timeout:10000})}if(window.console){console.error(e);console.debug(f)}}};MyAMS.ajax={check:function(d,f,h,c){if(typeof(h)=="object"){c=h;h=undefined}var g={async:typeof(h)=="function"};var e=b.extend({},g,c);if(d===undefined){a.getScript(f,function(){if(typeof(h)=="function"){h(true,c)}},e)}else{if(typeof(h)=="function"){h(false,c)}}},getAddr:function(d){var c=d||b("HTML HEAD BASE").attr("href")||window.location.href;return c.substr(0,c.lastIndexOf("/")+1)},start:function(){b("#ajax-gear").show()},stop:function(){b("#ajax-gear").hide()},progress:function(c){if(!c.lengthComputable){return}if(c.loaded>=c.total){return}console.log(parseInt((c.loaded/c.total*100),10)+"%")},post:function(e,g,d,j){if(e.startsWith(window.location.protocol)){var i=e}else{i=this.getAddr()+e}if(typeof(d)=="function"){j=d;d={}}else{if(!d){d={}}}if(typeof(j)=="undefined"){j=d.callback}if(typeof(j)=="string"){j=a.getFunctionByName(j)}delete d.callback;var c=undefined;var h={url:i,type:"post",cache:false,async:typeof(j)=="function",data:b.param(g),dataType:"json",success:j||function(k){c=k.result},error:a.error.show};var f=b.extend({},h,d);b.ajax(f);return c},getResponse:function(f){var d=f.getResponseHeader("content-type"),h,c;if(d){if(d.startsWith("application/javascript")){h="script";c=f.responseText}else{if(d.startsWith("text/html")){h="html";c=f.responseText}else{if(d.startsWith("text/xml")){h="xml";c=f.responseText}else{c=f.responseJSON;if(c){h="json"}else{try{c=JSON.parse(f.responseText);h="json"}catch(g){c=f.responseText;h="text"}}}}}}else{h="json";c={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{content_type:h,data:c}},handleJSON:function(n,e,j){var h=n.status;var c;switch(h){case"alert":alert(n.alert.title+"\n\n"+n.alert.content);break;case"error":a.form.showErrors(e,n);break;case"info":case"success":if(n.close_form!=false){a.dialog.close(e)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":if(n.close_form!=false){a.dialog.close(e)}break;case"modal":a.dialog.open(n.location);break;case"reload":if(n.close_form!=false){a.dialog.close(e)}c=n.location||window.location.hash;if(c.startsWith("#")){c=c.substr(1)}a.skin.loadURL(c,n.target||j||"#content");break;case"redirect":if(n.close_form==true){a.dialog.close(e)}c=n.location||window.location.href;if(n.window){window.open(c,n.window,n.options)}else{window.location.href=c}break;default:console.log("Unhandled status: "+h);break}if(n.content){var k=n.content;var d=b(k.target||j||e||"#content");if(k.raw==true){d.text(k.text)}else{d.html(k.html);a.initContent(d)}if(!k.keep_hidden){d.removeClass("hidden")}}if(n.contents){var g=n.contents;for(var i in g){k=g[i];d=b(k.target);if(k.raw==true){d.text(k.text)}else{d.html(k.html);a.initContent(d)}if(!k.keep_hidden){d.removeClass("hidden")}}}if(n.message){var m=n.message;if(typeof(m)=="string"){if((h=="info")||(h=="success")){a.skin.smallBox(h,{title:m,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}else{a.skin.alert(b(e||"#content"),h,m)}}else{a.skin.alert(b(m.target||j||e||"#content"),m.status||"success",m.header,m.body,m.subtitle)}}if(n.smallbox){a.skin.smallBox(n.smallbox_status||h,{title:n.smallbox,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}if(n.messagebox){m=n.messagebox;if(typeof(m)=="string"){a.skin.messageBox("info",{title:a.i18n.ERROR_OCCURED,content:m,timeout:10000})}else{var f=m.status||"info";if(f=="error"&&e&&j){a.executeFunctionByName(e.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",e,j)}a.skin.messageBox(f,{title:m.title||a.i18n.ERROR_OCCURED,content:m.content,icon:m.icon,number:m.number,timeout:m.timeout==null?undefined:(m.timeout||10000)})}}if(n.event){e.trigger(n.event,n.event_options)}if(n.callback){a.executeFunctionByName(n.callback,e,n.options)}if(n.callbacks){for(i in n.callbacks){if(!b.isNumeric(i)){continue}var l=n.callbacks[i];a.executeFunctionByName(l,e,l.options)}}}};MyAMS.jsonrpc={getAddr:function(e){var c=e||b("HTML HEAD BASE").attr("href")||window.location.href;var d=c.replace(/\+\+skin\+\+\w+\//,"");return d.substr(0,d.lastIndexOf("/")+1)},query:function(d,f,c,e){a.ajax.check(b.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){var g;if(typeof(c)=="function"){e=c;c={}}else{if(!c){c={}}}if(typeof(e)=="undefined"){e=c.callback}if(typeof(e)=="string"){e=a.getFunctionByName(e)}delete c.callback;var i={};if(typeof(d)=="string"){i.query=d}else{if(typeof(d)=="object"){b.extend(i,d)}}b.extend(i,c);var h={url:a.jsonrpc.getAddr(c.url),type:"post",cache:false,method:f,params:i,async:typeof(e)=="function",success:e||function(j){g=j.result},error:a.error.show};b.jsonRpc(h);return g})},post:function(f,d,c,e){a.ajax.check(b.jsonRPC,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){var g;if(typeof(c)=="function"){e=c;c={}}else{if(!c){c={}}}if(typeof(e)=="undefined"){e=c.callback}if(typeof(e)=="string"){e=a.getFunctionByName(e)}delete c.callback;var g;var i={id:new Date().getTime(),params:d,success:e||function(j){g=j},error:a.error.show};var h=b.extend({},i,c);b.jsonRPC.withOptions({endPoint:a.jsonrpc.getAddr(c.url),namespace:c.namespace,cache:false},function(){b.jsonRPC.request(f,h)});return g})}};MyAMS.xmlrpc={getAddr:function(e){var c=e||b("HTML HEAD BASE").attr("href")||window.location.href;var d=c.replace(/\+\+skin\+\+\w+\//,"");return d.substr(0,d.lastIndexOf("/")+1)},post:function(d,g,e,c,f){a.ajax.check(b.xmlrpc,a.baseURL+"ext/jquery-xmlrpc"+a.devext+".js",function(){var h;if(typeof(c)=="function"){f=c;c={}}else{if(!c){c={}}}if(typeof(f)=="undefined"){f=c.callback}if(typeof(f)=="string"){f=a.getFunctionByName(f)}delete c.callback;var j={url:a.xmlrpc.getAddr(d),methodName:g,params:e,success:f||function(k){h=k},error:a.error.show};var i=b.extend({},j,c);b.xmlrpc(i);return h})}};MyAMS.form={init:function(d){if(a.warn_on_form_change){var c=b('FORM[data-ams-warn-on-change!="false"]',d)}else{c=b('FORM[data-ams-warn-on-change="true"]',d)}c.each(function(){var e=b(this);b('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',e).each(function(){var g=b(this);if(g.data("ams-ignore-change")!==true){var f=g.data("ams-changed-event")||"change";g.on(f,function(){b(this).parents("FORM").attr("data-ams-form-changed",true)})}});e.on("reset",function(){b(this).removeAttr("data-ams-form-changed")})})},checkBeforeUnload:function(){var c=b('FORM[data-ams-form-changed="true"]');if(c.exists()){return a.i18n.FORM_CHANGED_WARNING}},confirmChangedForm:function(d,e){if(typeof(d)=="function"){e=d;d=undefined}var c=b('FORM[data-ams-form-changed="true"]',d);if(c.exists()){a.skin.bigBox({title:a.i18n.WARNING,content:'  '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(f){if(f==a.i18n.BTN_OK){e.call(d)}})}else{e.call(d)}},submit:function(e,d,f){e=b(e);if(!e.exists()){return false}if(typeof(d)=="object"){f=d;d=undefined}if(e.data("submitted")){if(!e.data("ams-form-hide-submitted")){a.skin.messageBox("warning",{title:a.i18n.WAIT,content:a.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:e.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(e)){return false}b(".alert, SPAN.state-error",e).remove();b(".state-error",e).removeClassPrefix("state-");var c=b(e.data("ams-submit-button"));if(c&&!c.data("ams-form-hide-loading")){c.button("loading")}a.ajax.check(b.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js",function(){function i(k,m){var j;var C=k.data();var t=C.amsFormOptions;if(f){var o=f.formDataInitCallback}if(o){delete f.formDataInitCallback}else{o=C.amsFormDataInitCallback}if(o){var u={};if(typeof(o)=="function"){var l=o.call(k,u)}else{l=a.executeFunctionByName(o,k,u)}if(u.veto){j=k.data("ams-submit-button");if(j){j.button("reset")}a.form.finalizeSubmitFooter.call(k);return false}}else{l=C.amsFormData||{}}j=b(k.data("ams-submit-button"));var v,y;if(j){v=j.data("ams-form-handler");y=j.data("ams-form-submit-target")}var r=d||v||C.amsFormHandler||"";if(r.startsWith(window.location.protocol)){var n=r}else{var x=k.attr("action").replace(/#/,"");if(x.startsWith(window.location.protocol)){n=x}else{n=a.ajax.getAddr()+x}n+=r}var B=null;if(C.amsFormInitSubmitTarget){B=b(y||C.amsFormSubmitTarget||"#content");a.executeFunctionByName(C.amsFormInitSubmit||"MyAMS.form.initSubmit",k,B)}else{if(!C.amsFormHideSubmitFooter){a.executeFunctionByName(C.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",k)}}var p=typeof(m.uuid)!="undefined";if(p){if(n.indexOf("X-Progress-ID")<0){n+="?X-Progress-ID="+m.uuid}delete m.uuid}var s={url:n,type:"post",cache:false,data:l,dataType:C.amsFormDatatype,beforeSerialize:function(){if(typeof(tinyMCE)!="undefined"){tinyMCE.triggerSave()}},beforeSubmit:function(E,D){D.data("submitted",true)},error:function(H,D,E,G){if(B){a.executeFunctionByName(C.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",G,B)}if(G.is(":visible")){var F=G.data("ams-submit-button");if(F){F.button("reset")}a.form.finalizeSubmitFooter.call(G)}G.data("submitted",false);G.removeData("ams-submit-button")},iframe:p};var w=C.amsFormDownloadTarget;if(w){var q=b('iframe[name="'+w+'"]');if(!q.exists()){q=b("").hide().attr("name",w).appendTo(k)}s=b.extend({},s,{iframe:true,iframeTarget:q,success:function(D,E,I,H){var G=b(H).parents(".modal-dialog");if(G.exists()){a.dialog.close(H)}else{var J;var F=H.data("ams-submit-button");if(F){J=F.data("ams-form-submit-callback")}if(!J){J=a.getFunctionByName(C.amsFormSubmitCallback)||a.form._submitCallback}J.call(H,D,E,I,H);if(H.is(":visible")&&F){F.button("reset")}H.data("submitted",false);H.removeData("ams-submit-button");H.removeAttr("data-ams-form-changed")}}})}else{s=b.extend({},s,{error:function(H,D,E,G){if(B){a.executeFunctionByName(C.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",G,B)}if(G.is(":visible")){var F=G.data("ams-submit-button");if(F){F.button("reset")}a.form.finalizeSubmitFooter.call(G)}G.data("submitted",false);G.removeData("ams-submit-button")},success:function(D,E,H,G){var I;var F=G.data("ams-submit-button");if(F){I=F.data("ams-form-submit-callback")}if(!I){I=a.getFunctionByName(C.amsFormSubmitCallback)||a.form._submitCallback}I.call(G,D,E,H,G);if(G.is(":visible")&&F){F.button("reset")}G.data("submitted",false);G.removeData("ams-submit-button");G.removeAttr("data-ams-form-changed")},iframe:p})}var A=b.extend({},s,m,t,f);b(k).ajaxSubmit(A);if(w){var z=b(k).parents(".modal-dialog");if(z.exists()){a.dialog.close(k)}else{a.form.finalizeSubmitFooter.call(k);if(j){j.button("reset")}k.data("submitted",false);k.removeData("ams-submit-button");k.removeAttr("data-ams-form-changed")}}}var h=b('INPUT[type="file"]',e).length>0;if(h){a.ajax.check(b.progressBar,a.baseURL+"ext/jquery-progressbar"+a.devext+".js");var g=b.extend({},{uuid:b.progressBar.submit(e)});i(e,g)}else{i(e,{})}});return false},initSubmit:function(e,d){var c=b(this);var f='';if(!d){d=c.data("ams-form-submit-message")}if(d){f+=""+d+""}b(e).html('
    '+f+"
    ");b(e).parents(".hidden").removeClass("hidden")},finalizeSubmitOnError:function(c){b("i",c).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(d){var c=b(this);var f='';if(!d){d=b(this).data("ams-form-submit-message")}if(d){f+=''+d+""}var e=b("footer",c);b("button",e).hide();e.append('
    '+f+"
    ")},finalizeSubmitFooter:function(){var c=b(this);var d=b("footer",c);if(d){b(".row",d).remove();b("button",d).show()}},_submitCallback:function(m,e,d,c){if(c.is(":visible")){a.form.finalizeSubmitFooter.call(c);var g=c.data("ams-submit-button");if(g){g.button("reset")}}var f=c.data();if(f.amsFormDatatype){var j=f.amsFormDatatype}else{var h=a.ajax.getResponse(d);j=h.content_type;m=h.data}if(g){var i=b(g.amsFormSubmitTarget||f.amsFormSubmitTarget||"#content")}else{i=b(f.amsFormSubmitTarget||"#content")}switch(j){case"json":a.ajax.handleJSON(m,c,i);break;case"script":break;case"xml":break;case"html":case"text":default:if(g&&(g.data("ams-keep-modal")!==true)){a.dialog.close(c)}if(!i.exists()){i=b("body")}i.parents(".hidden").removeClass("hidden");b(".alert",i.parents(".alerts-container")).remove();i.css({opacity:"0.0"}).html(m).delay(50).animate({opacity:"1.0"},300);a.initContent(i)}var k=d.getResponseHeader("X-AMS-Callback");if(k){var l=d.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(k,c,l===undefined?{}:JSON.parse(l),d)}},_getSubmitValidators:function(d){var c=new Array();var e=d.data("ams-form-validator");if(e){c.push([d,e])}b("[data-ams-form-validator]",d).each(function(){var f=b(this);c.push([f,f.data("ams-form-validator")])});return c},_checkSubmitValidators:function(e){var g=a.form._getSubmitValidators(e);if(!g.length){return true}var f=new Array();var l=true;for(var i in g){if(!b.isNumeric(i)){continue}var d=g[i];var c=d[0];var j=d[1];var k=a.executeFunctionByName(j,e,c);if(k===false){l=false}else{if(typeof(k)=="string"){f.push(k)}else{if(l.length&&(l.length>0)){f=f.concat(l)}}}}if(f.length>0){var h=f.length==1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"danger",h,f);return false}else{return l}},showErrors:function(c,j){if(typeof(j)=="string"){a.skin.alert(c,"error",a.i18n.ERROR_OCCURED,j)}else{if(j instanceof Array){var f=j.length==1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(c,"error",f,j)}else{b(".state-error",c).removeClass("state-error");f=j.error_header||(j.widgets&&(j.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED);var k=new Array();var i;for(i in j.messages){if(!b.isNumeric(i)){continue}if(j.messages[i].header){k.push(""+j.messages[i].header+"
    "+j.messages[i].message)}else{k.push(j.messages[i].message||j.messages[i])}}for(i in j.widgets){if(!b.isNumeric(i)){continue}var d=j.widgets[i];var g=b('[name="'+d.name+'"]',c);g.parents("label:first").removeClassPrefix("state-").addClass("state-error").after(''+d.message+"");if(d.label){k.push(d.label+" : "+d.message)}var h=g.parents(".tab-pane").index()+1;if(h>0){var e=b(".nav-tabs",b(g).parents(".tabforms"));b("li:nth-child("+h+")",e).removeClassPrefix("state-").addClass("state-error");b("li.state-error:first a",c).click()}}a.skin.alert(c,j.error_level||"error",f,k,j.error_message)}}}};MyAMS.dialog={_hide_callbacks:[],registerHideCallback:function(d){var c=a.dialog._hide_callbacks;if(c.indexOf(d)<0){c.push(d)}},open:function(d,c){a.ajax.check(b.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+a.devext+".js",function(){a.ajax.check(b.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+a.devext+".js",function(h){if(h){b(document).off("click.modal");b.fn.modal.defaults.spinner=b.fn.modalmanager.defaults.spinner='
    '}if(typeof(d)=="string"){var g={};var f=d}else{g=d.data();f=d.attr("href")||g.amsUrl;var e=a.getFunctionByName(f);if(typeof(e)=="function"){f=e.call(d)}}if(!f){return}b("body").modalmanager("loading");if(f.indexOf("#")==0){b(f).modal("show")}else{b.ajax({url:f,type:"get",cache:g.amsAllowCache===undefined?false:g.amsAllowCache,data:c,success:function(l,k,j){b("body").modalmanager("removeLoading");var m=a.ajax.getResponse(j);var r=m.content_type;var s=m.data;switch(r){case"json":a.ajax.handleJSON(s,b(b(d).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var n=b(s);var p=b(".modal-dialog",n.wrap("
    ").parent());var o=p.data();var q={overflow:o.amsModalOverflow||".modal-viewport",maxHeight:o.amsModalMaxHeight===undefined?function(){return b(window).height()-b(".modal-header",n).outerHeight(true)-b("footer",n).outerHeight(true)-85}:a.getFunctionByName(o.amsModalMaxHeight)};var i=b.extend({},q,o.amsModalOptions);i=a.executeFunctionByName(o.amsModalInitCallback,p,i)||i;b("
    ").addClass("modal fade").append(n).modal(i).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(n)}}})}})})},shown:function(i){function h(k){var l=b(".scrollmarker.top",c);var j=c.scrollTop();if(j>0){l.show()}else{l.hide()}var e=b(".scrollmarker.bottom",c);if(f+j>=c.get(0).scrollHeight){e.hide()}else{e.show()}}var g=i.target;var c=b(".modal-viewport",g);if(c.length==0){return}var f=parseInt(c.css("max-height"));var d=b.scrollbarWidth();if(c.height()==f){b("
    ").addClass("scrollmarker").addClass("top").css("top",0).css("width",c.width()-d).hide().appendTo(c);b("
    ").addClass("scrollmarker").addClass("bottom").css("top",f-20).css("width",c.width()-d).appendTo(c);c.scroll(h);c.off("resize").on("resize",h)}else{b(".scrollmarker",c).remove()}},close:function(d){var e=d.parents(".modal").data("modal");if(e){var c=b("body").data("modalmanager");if(c&&(c.getOpenModals().indexOf(e)>=0)){e.hide()}}},hidden:function(g){var f=g.target;a.skin.cleanContainer(f);var d=a.dialog._hide_callbacks;for(var c in d){d[c].call(f)}}};MyAMS.helpers={select2ClearSelection:function(){var d=b(this);var c=d.parents("label");var e=d.data("ams-select2-target");b('[name="'+e+'"]',c).data("select2").val("")},select2FormatSelection:function(d,c){if(d instanceof Array){b(d).each(function(){if(typeof(this)=="object"){c.append(this.text)}else{c.append(this)}})}else{if(typeof(d)=="object"){c.append(d.text)}else{c.append(d)}}},select2QueryUrlResultsCallback:function(e,d,c){switch(e.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

    "+e.error_message+"

    ",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":b(this).data("select2").dropdown.hide();a.dialog.open(result.location);break;default:return{results:e.results||e,more:e.has_more||false,context:e.context}}},select2QueryMethodSuccessCallback:function(g,d,f){var c=g.result;if(typeof(c)=="string"){try{c=JSON.parse(c)}catch(h){}}switch(c.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

    "+c.error_message+"

    ",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":b(this).data("select2").dropdown.hide();a.dialog.open(c.location);break;default:f.callback({results:c.results||c,more:c.has_more||false,context:c.context})}},contextMenuHandler:function(f,g){var c=g.data();if(c.toggle=="modal"){a.dialog.open(g)}else{var d=g.attr("href")||c.amsUrl;if(!d||d.startsWith("javascript:")||g.attr("target")){return}a.event.stop();var e=a.getFunctionByName(d);if(typeof(e)=="function"){d=e.call(g,f)}if(typeof(d)=="function"){d.call(g,f)}else{d=d.replace(/\%23/,"#");var f=g.data("ams-target");if(f){a.form.confirmChangedForm(f,function(){a.skin.loadURL(d,f,g.data("ams-link-options"),g.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(d.startsWith("#")){if(d!=location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=d},150)}else{window.location.hash=d}}}else{window.location=d}})}}}},datetimepickerDialogHiddenCallback:function(){b(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};MyAMS.plugins={init:function(e){a.plugins.initData(e);var f=new Array();b("[data-ams-plugins-disabled]",e).each(function(){var h=b(this).data("ams-plugins-disabled").split(/\s+/);for(var i in h){f.push(h[i])}});var d;b("[data-ams-plugins]",e).each(function(){var l=b(this);var h={};if(typeof(l.data("ams-plugins"))==="string"){var m=l.data("ams-plugins").split(/\s+/);for(var j in m){d=m[j];var i={src:l.data("ams-plugin-"+d+"-src"),css:l.data("ams-plugin-"+d+"-css"),callback:l.data("ams-plugin-"+d+"-callback"),register:l.data("ams-plugin-"+d+"-register"),async:l.data("ams-plugin-"+d+"-async")};h[d]=i}}else{h=l.data("ams-plugins")}for(d in h){if(a.plugins.enabled[d]===undefined){var k=h[d];a.getScript(k.src,function(){var p=k.callback;if(p){var o=a.getFunctionByName(p);if(k.register!==false){a.plugins.enabled[d]=o}}else{if(k.register!==false){a.plugins.enabled[d]=null}}var n=k.css;if(n){a.getCSS(n,d+"_css")}},{async:k.async===undefined?true:k.async})}}});for(var c in a.plugins.enabled){if(f.indexOf(c)>=0){continue}var g=a.plugins.enabled[c];if(typeof(g)=="function"){g(e)}}},initData:function(c){b("[data-ams-data]",c).each(function(){var e=b(this);var f=e.data("ams-data");for(var d in f){e.attr("data-"+d,f[d])}})},register:function(d,c,f){if(typeof(c)=="function"){f=c;c=null}c=c||d.name;if(a.plugins.enabled.indexOf(c)>=0){if(window.console){console.warn("Plugin "+c+" is already registered!")}return}if(typeof(d)=="object"){var e=d.src;if(e){a.ajax.check(d.callback,e,function(g){if(g){a.plugins.enabled[c]=a.getFunctionByName(d.callback);if(d.css){a.getCSS(d.css,c+"_css")}if(f){a.executeFunctionByName(f)}}})}else{a.plugins.enabled[c]=a.getFunctionByName(d.callback);if(d.css){a.getCSS(d.css,c+"_css")}if(f){a.executeFunctionByName(f)}}}else{if(typeof(d)=="function"){a.plugins.enabled[c]=d;if(f){a.executeFunctionByName(f)}}}},enabled:{hint:function(c){var d=b(".hint:not(:parents(.nohints))",c);if(d.length>0){a.ajax.check(b.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+a.devext+".js",function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+a.devext+".css","jquery-tipsy");d.each(function(){var i=b(this);var h=i.data();var f={html:h.amsHintHtml,title:a.getFunctionByName(h.amsHintTitleGetter)||function(){var j=b(this);return j.attr("original-title")||j.attr(h.amsHintTitleAttr||"title")||(h.amsHintHtml?j.html():j.text())},opacity:h.amsHintOpacity||0.95,gravity:h.amsHintGravity||"sw",offset:h.amsHintOffset||0};var e=b.extend({},f,h.amsHintOptions);e=a.executeFunctionByName(h.amsHintInitCallback,i,e)||e;var g=i.tipsy(e);a.executeFunctionByName(h.amsHintAfterInitCallback,i,g,e)})})}},contextMenu:function(c){var d=b(".context-menu",c);if(d.length>0){d.each(function(){var i=b(this);var h=i.data();var f={menuSelector:h.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var e=b.extend({},f,h.amsContextmenuOptions);e=a.executeFunctionByName(h.amsContextmenuInitCallback,i,e)||e;var g=i.contextMenu(e);a.executeFunctionByName(h.amsContextmenuAfterInitCallback,i,g,e)})}},switcher:function(c){b("LEGEND.switcher",c).each(function(){var e=b(this);var d=e.parent("fieldset");var f=e.data();if(!f.amsSwitcher){b('').prependTo(b(this)).addClass(f.amsSwitcherState=="open"?(f.amsSwitcherMinusClass||"fa-minus"):(f.amsSwitcherPlusClass||"fa-plus"));e.on("click",function(h){h.preventDefault();var g={};e.trigger("ams.switcher.before-switch",[e,g]);if(g.veto){return}if(d.hasClass("switched")){d.removeClass("switched");b(".fa",e).removeClass(f.amsSwitcherPlusClass||"fa-plus").addClass(f.amsSwitcherMinusClass||"fa-minus");e.trigger("ams.switcher.opened",[e]);var i=e.attr("id");if(i){b('legend.switcher[data-ams-switcher-sync="'+i+'"]',d).each(function(){var j=b(this);if(j.parents("fieldset").hasClass("switched")){j.click()}})}}else{d.addClass("switched");b(".fa",e).removeClass(f.amsSwitcherMinusClass||"fa-minus").addClass(f.amsSwitcherPlusClass||"fa-plus");e.trigger("ams.switcher.closed",[e])}});if(f.amsSwitcherState!="open"){d.addClass("switched")}e.data("ams-switcher","on")}})},checker:function(c){b("LEGEND.checker",c).each(function(){var o=b(this);var p=o.parent("fieldset");var f=o.data();if(!f.amsChecker){var d=b('');var i=f.amsCheckerFieldname||("checker_"+a.generateId());var m=i.replace(/\./,"_");var g=f.amsCheckerHiddenPrefix;var h=null;var l=f.amsCheckerHiddenValueOn||"true";var j=f.amsCheckerHiddenValueOff||"false";var e=f.amsCheckerMarker||false;if(g){h=b('').attr("name",g+i).val(f.amsCheckerState=="on"?l:j).prependTo(o)}else{if(e){b('').attr("name",e).attr("value",1).prependTo(o)}}var n=b('').attr("name",i).attr("id",m).data("ams-checker-hidden-input",h).data("ams-checker-init",true).val(f.amsCheckerValue||true).attr("checked",f.amsCheckerState=="on"?"checked":null);if(f.amsCheckerReadonly){n.attr("disabled","disabled")}else{n.on("change",function(s){s.preventDefault();var q={};var t=b(this).is(":checked");o.trigger("ams.checker.before-switch",[o,q]);if(q.veto){b(this).prop("checked",!t);return}a.executeFunctionByName(f.amsCheckerChangeHandler,o,t);if(!f.amsCheckerCancelDefault){var r=n.data("ams-checker-hidden-input");if(t){if(f.amsCheckerMode=="disable"){p.removeAttr("disabled")}else{p.removeClass("switched")}if(r){r.val(l)}b("[data-required]",p).attr("required","required");o.trigger("ams.checker.opened",[o])}else{if(f.amsCheckerMode=="disable"){p.prop("disabled","disabled")}else{p.addClass("switched")}if(r){r.val(j)}b("[data-required]",p).removeAttr("required");o.trigger("ams.checker.closed",[o])}}})}n.appendTo(d);b(">label",o).attr("for",n.attr("id"));d.append("").prependTo(o);var k=b("[required]",p);k.attr("data-required",true);if(f.amsCheckerState=="on"){n.attr("checked",true)}else{if(f.amsCheckerMode=="disable"){p.attr("disabled","disabled")}else{p.addClass("switched")}k.removeAttr("required")}o.data("ams-checker","on")}})},slider:function(c){var d=b(".slider",c);if(d.length>0){a.ajax.check(b.fn.slider,a.baseURL+"ext/bootstrap-slider.min.js",function(){d.each(function(){var h=b(this);var i=h.data();var f={};var e=b.extend({},f,h.data.amsSliderOptions);e=a.executeFunctionByName(i.amsSliderInitCallback,h,e)||e;var g=h.slider(e);a.executeFunctionByName(i.amsSliderAfterInitCallback,h,g,e)})})}},draggable:function(d){var c=b(".draggable",d);if(c.length>0){c.each(function(){var e=b(this);var i=e.data();var g={containment:i.amsDraggableContainment,helper:a.getFunctionByName(i.amsDraggableHelper)||i.amsDraggableHelper,start:a.getFunctionByName(i.amsDraggableStart),stop:a.getFunctionByName(i.amsDraggableStop)};var f=b.extend({},g,i.amsDraggableOptions);f=a.executeFunctionByName(i.amsDraggableInitCallback,e,f)||f;var h=e.draggable(f);e.disableSelection();a.executeFunctionByName(i.amsDraggableAfterInitCallback,e,h,f)})}},sortable:function(c){var d=b(".sortable",c);if(d.length>0){d.each(function(){var i=b(this);var h=i.data();var f={items:h.amsSortableItems,handle:h.amsSortableHandle,connectWith:h.amsSortableConnectwith,start:a.getFunctionByName(h.amsSortableStart),over:a.getFunctionByName(h.amsSortableOver),containment:h.amsSortableContainment,placeholder:h.amsSortablePlaceholder,stop:a.getFunctionByName(h.amsSortableStop)};var e=b.extend({},f,h.amsSortableOptions);e=a.executeFunctionByName(h.amsSortableInitCallback,i,e)||e;var g=i.sortable(e);i.disableSelection();a.executeFunctionByName(h.amsSortableAfterInitCallback,i,g,e)})}},resizable:function(d){var c=b(".resizable",d);if(c.length>0){c.each(function(){var e=b(this);var i=e.data();var g={autoHide:i.amsResizableAutohide===false?true:i.amsResizableAutohide,containment:i.amsResizableContainment,grid:i.amsResizableGrid,handles:i.amsResizableHandles,start:a.getFunctionByName(i.amsResizableStart),stop:a.getFunctionByName(i.amsResizableStop)};var f=b.extend({},g,i.amsResizableOptions);f=a.executeFunctionByName(i.amsResizableInitCallback,e,f)||f;var h=e.resizable(f);e.disableSelection();a.executeFunctionByName(i.amsResizableAfterInitCallback,e,h,f)})}},typeahead:function(d){var c=b(".typeahead",d);if(c.length>0){a.ajax.check(b.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+a.devext+".js",function(){c.each(function(){var e=b(this);var i=e.data();var g={};var f=b.extend({},g,i.amsTypeaheadOptions);f=a.executeFunctionByName(i.amsTypeaheadInitCallback,e,f)||f;var h=e.typeahead(f);a.executeFunctionByName(i.amsTypeaheadAfterInitCallback,e,h,f)})})}},select2:function(d){var c=b(".select2",d);if(c.length>0){a.ajax.check(b.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+a.devext+".js",function(){c.each(function(){var e=b(this);var j=e.data();var h={placeholder:j.amsSelect2Placeholder,multiple:j.amsSelect2Multiple,minimumInputLength:j.amsSelect2MinimumInputLength||0,maximumSelectionSize:j.amsSelect2MaximumSelectionSize,openOnEnter:j.amsSelect2EnterOpen===undefined?true:j.amsSelect2EnterOpen,allowClear:j.amsSelect2AllowClear===undefined?true:j.amsSelect2AllowClear,width:j.amsSelect2Width||"100%",initSelection:a.getFunctionByName(j.amsSelect2InitSelection),formatSelection:j.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(j.amsSelect2FormatSelection),formatResult:a.getFunctionByName(j.amsSelect2FormatResult),formatMatches:j.amsSelect2FormatMatches===undefined?function(k){if(k==1){return a.i18n.SELECT2_MATCH}else{return k+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(j.amsSelect2FormatMatches),formatNoMatches:j.amsSelect2FormatResult===undefined?function(k){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(j.amsSelect2FormatResult),formatInputTooShort:j.amsSelect2FormatInputTooShort===undefined?function(k,l){var m=l-k.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,m).replace(/\{1\}/,m==1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(j.amsSelect2FormatInputTooShort),formatInputTooLong:j.amsSelect2FormatInputTooLong===undefined?function(l,k){var m=l.length-k;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,m).replace(/\{1\}/,m==1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(j.amsSelect2FormatInputTooLong),formatSelectionTooBig:j.amsSelect2FormatSelectionTooBig===undefined?function(k){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,k).replace(/\{1\}/,k==1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(j.amsSelect2FormatSelectionTooBig),formatLoadMore:j.amsSelect2FormatLoadMore===undefined?function(k){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(j.amsSelect2FormatLoadMore),formatSearching:j.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(j.amsSelect2FormatSearching),separator:j.amsSelect2Separator||",",tokenSeparators:j.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(j.amsSelect2Tokenizer)};switch(e.context.type){case"text":case"hidden":if(!h.initSelection){var f=e.data("ams-select2-values");if(f){h.initSelection=function(k,m){var l=[];b(k.val().split(h.separator)).each(function(){l.push({id:this,text:f[this]||this})});m(l)}}}break;default:break}if(e.attr("readonly")){if(e.attr("type")=="hidden"){h.query=function(){return[]}}}else{if(j.amsSelect2Query){h.query=a.getFunctionByName(j.amsSelect2Query);h.minimumInputLength=j.amsSelect2MinimumInputLength||1}else{if(j.amsSelect2QueryUrl){h.ajax={url:j.amsSelect2QueryUrl,quietMillis:j.amsSelect2QuietMillis||200,type:j.amsSelect2QueryType||"POST",dataType:j.amsSelect2QueryDatatype||"json",data:function(m,n,l){var k={};k[j.amsSelect2QueryParamName||"query"]=m;k[j.amsSelect2PageParamName||"page"]=n;k[j.amsSelect2ContextParamName||"context"]=l;return b.extend({},k,j.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};h.minimumInputLength=j.amsSelect2MinimumInputLength||1}else{if(j.amsSelect2QueryMethod){h.query=function(k){var l={id:new Date().getTime(),params:j.amsSelect2QueryParams||{},success:function(m){return a.helpers.select2QueryMethodSuccessCallback.call(e,m,"success",k)},error:a.error.show};l.params[j.amsSelect2QueryParamName||"query"]=k.term;l.params[j.amsSelect2PageParamName||"page"]=k.page;l.params[j.amsSelect2ContextParamName||"context"]=k.context;l=b.extend({},l,j.amsSelect2QueryOptions);l=a.executeFunctionByName(j.amsSelect2QueryInitCallback,e,l)||l;a.ajax.check(b.jsonRPC,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){b.jsonRPC.withOptions({endPoint:j.amsSelect2MethodTarget||a.jsonrpc.getAddr(),namespace:j.amsSelect2MethodNamespace,cache:false},function(){b.jsonRPC.request(j.amsSelect2QueryMethod,l)})})};h.minimumInputLength=j.amsSelect2MinimumInputLength||1}else{if(j.amsSelect2Tags){h.tags=j.amsSelect2Tags}else{if(j.amsSelect2Data){h.data=j.amsSelect2Data}}}}}}if(j.amsSelect2EnableFreeTags){h.createSearchChoice=function(k){return{id:k,text:(j.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+k}}}var g=b.extend({},h,j.amsSelect2Options);g=a.executeFunctionByName(j.amsSelect2InitCallback,e,g)||g;var i=e.select2(g);a.executeFunctionByName(j.amsSelect2AfterInitCallback,e,i,g);if(e.hasClass("ordered")){a.ajax.check(b.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+a.devext+".js",function(){e.select2Sortable({bindOrder:"sortableStop"})})}e.on("change",function(){var k=b(e.get(0).form).data("validator");if(k!==undefined){b(e).valid()}})})})}},maskedit:function(d){var c=b("[data-mask]",d);if(c.length>0){a.ajax.check(b.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.3.1.min.js",function(){c.each(function(){var e=b(this);var i=e.data();var g={placeholder:i.amsMaskeditPlaceholder||"X"};var f=b.extend({},g,i.amsMaskeditOptions);f=a.executeFunctionByName(i.amsMaskeditInitCallback,e,f)||f;var h=e.mask(e.attr("data-mask"),f);a.executeFunctionByName(i.amsMaskeditAfterInitCallback,e,h,f)})})}},datepicker:function(c){var d=b(".datepicker",c);if(d.length>0){a.ajax.check(b.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}d.each(function(){var f=b(this);var j=f.data();var h={lang:j.amsDatetimepickerLang||a.lang,format:j.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var g=b.extend({},h,j.amsDatetimepickerOptions);g=a.executeFunctionByName(j.amsDatetimepickerInitCallback,f,g)||g;var i=f.datetimepicker(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},datetimepicker:function(d){var c=b(".datetimepicker",d);if(c.length>0){a.ajax.check(b.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}c.each(function(){var f=b(this);var j=f.data();var h={lang:j.amsDatetimepickerLang||a.lang,format:j.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var g=b.extend({},h,j.amsDatetimepickerOptions);g=a.executeFunctionByName(j.amsDatetimepickerInitCallback,f,g)||g;var i=f.datetimepicker(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},timepicker:function(d){var c=b(".timepicker",d);if(c.length>0){a.ajax.check(b.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}c.each(function(){var f=b(this);var j=f.data();var h={lang:j.amsDatetimepickerLang||a.lang,format:j.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var g=b.extend({},h,j.amsDatetimepickerOptions);g=a.executeFunctionByName(j.amsDatetimepickerInitCallback,f,g)||g;var i=f.datetimepicker(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},colorpicker:function(c){var d=b(".colorpicker",c);if(d.length>0){a.ajax.check(b.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+a.devext+".css","jquery-minicolors")}d.each(function(){var f=b(this);var j=f.data();var h={position:j.amsColorpickerPosition||f.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var g=b.extend({},h,j.amsColorpickerOptions);g=a.executeFunctionByName(j.amsColorpickerInitCallback,f,g)||g;var i=f.minicolors(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},validate:function(d){var c=b("FORM:not([novalidate])",d);if(c.length>0){a.ajax.check(b.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+a.devext+".js",function(g){if(g){b.validator.setDefaults({highlight:function(h){b(h).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(h){b(h).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(i,j){var h=j.parents("label:first");if(h.length){i.insertAfter(h)}else{i.insertAfter(j)}}});if(a.plugins.i18n){for(var e in a.plugins.i18n.validate){var f=a.plugins.i18n.validate[e];if((typeof(f)=="string")&&(f.indexOf("{0}")>-1)){a.plugins.i18n.validate[e]=b.validator.format(f)}}b.extend(b.validator.messages,a.plugins.i18n.validate)}}c.each(function(){var k=b(this);var l=k.data();var i={ignore:null,submitHandler:k.attr("data-async")!==undefined?l.amsFormSubmitHandler===undefined?function(){b(".state-error",k).removeClass("state-error");a.ajax.check(b.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js");return a.form.submit(k)}:a.getFunctionByName(l.amsFormSubmitHandler):undefined,invalidHandler:k.attr("data-async")!==undefined?l.amsFormInvalidHandler===undefined?function(q,p){b(".state-error",k).removeClass("state-error");for(var n in p.errorList){var m=p.errorList[n];var o=b(m.element).parents(".tab-pane").index()+1;if(o>0){var r=b(".nav-tabs",b(m.element).parents(".tabforms"));b("li:nth-child("+o+")",r).removeClassPrefix("state-").addClass("state-error");b("li.state-error:first a",r).click()}}}:a.getFunctionByName(l.amsFormInvalidHandler):undefined};var h=b.extend({},i,l.amsValidateOptions);h=a.executeFunctionByName(l.amsValidateInitCallback,k,h)||h;var j=k.validate(h);a.executeFunctionByName(l.amsValidateAfterInitCallback,k,j,h)})})}},datatable:function(d){var c=b(".datatable",d);if(c.length>0){a.ajax.check(b.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+a.devext+".js",function(e){if(e){b.fn.dataTableExt.oSort["numeric-comma-asc"]=function(h,g){var f=h.replace(/,/,".").replace(/ /g,"");var i=g.replace(/,/,".").replace(/ /g,"");f=parseFloat(f);i=parseFloat(i);return((fi)?1:0))};b.fn.dataTableExt.oSort["numeric-comma-desc"]=function(h,g){var f=h.replace(/,/,".").replace(/ /g,"");var i=g.replace(/,/,".").replace(/ /g,"");f=parseFloat(f);i=parseFloat(i);return((fi)?-1:0))}}b(c).each(function(){a.ajax.check(b.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+a.devext+".js");var u=b(this);var x=u.data();var w=(x.amsDatatableExtensions||"").split(/\s+/);var h=x.amsDatatableSdom||"W"+((w.indexOf("colreorder")>=0||w.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(w.indexOf("colvis")>=0?"C":"")+((x.amsDatatablePagination===false||x.amsDatatablePaginationSize===false)?"":"L")+(x.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(w.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(x.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var r={bJQueryUI:false,bFilter:x.amsDatatableGlobalFilter!==false,bPaginate:x.amsDatatablePagination!==false,bInfo:x.amsDatatableInfo!==false,bSort:x.amsDatatableSort!==false,aaSorting:x.amsDatatableSorting,bDeferRender:true,bAutoWidth:false,iDisplayLength:x.amsDatatableDisplayLength||25,sPaginationType:x.amsDatatablePaginationType||"bootstrap_full",sDom:h,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(A,z){b(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' ')}};var v=b.extend({},r,x.amsDatatableOptions);var j;if(w.length>0){for(j in w){switch(w[j]){case"autofill":a.ajax.check(b.fn.dataTable.AutoFill,a.baseURL+"ext/jquery-dataTables-autoFill"+a.devext+".js");break;case"columnfilter":a.ajax.check(b.fn.columnFilter,a.baseURL+"ext/jquery-dataTables-columnFilter"+a.devext+".js");break;case"colreorder":a.ajax.check(b.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorder"+a.devext+".js");break;case"colreorderwithresize":a.ajax.check(b.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorderWithResize"+a.devext+".js");break;case"colvis":a.ajax.check(b.fn.dataTable.ColVis,a.baseURL+"ext/jquery-dataTables-colVis"+a.devext+".js");var n={activate:"click",sAlign:"right"};v.oColVis=b.extend({},n,x.amsDatatableColvisOptions);break;case"editable":a.ajax.check(b.fn.editable,a.baseURL+"ext/jquery-jeditable"+a.devext+".js");a.ajax.check(b.fn.makeEditable,a.baseURL+"ext/jquery-dataTables-editable"+a.devext+".js");break;case"fixedcolumns":a.ajax.check(b.fn.dataTable.FixedColumns,a.baseURL+"ext/jquery-dataTables-fixedColumns"+a.devext+".js");break;case"fixedheader":a.ajax.check(b.fn.dataTable.FixedHeader,a.baseURL+"ext/jquery-dataTables-fixedHeader"+a.devext+".js");break;case"keytable":a.ajax.check(window.KeyTable,a.baseURL+"ext/jquery-dataTables-keyTable"+a.devext+".js");break;case"rowgrouping":a.ajax.check(b.fn.rowGrouping,a.baseURL+"ext/jquery-dataTables-rowGrouping"+a.devext+".js");break;case"rowreordering":a.ajax.check(b.fn.rowReordering,a.baseURL+"ext/jquery-dataTables-rowReordering"+a.devext+".js");break;case"scroller":a.ajax.check(b.fn.dataTable.Scroller,a.baseURL+"ext/jquery-dataTables-scroller"+a.devext+".js");break;default:break}}}v=a.executeFunctionByName(x.amsDatatableInitCallback,u,v)||v;var g=u.dataTable(v);a.executeFunctionByName(x.amsDatatableAfterInitCallback,u,g,v);if(w.length>0){for(j in w){switch(w[j]){case"autofill":var y=b.extend({},x.amsDatatableAutofillOptions,v.autofill);y=a.executeFunctionByName(x.amsDatatableAutofillInitCallback,u,y)||y;u.data("ams-autofill",x.amsDatatableAutofillConstructor===undefined?new b.fn.dataTable.AutoFill(u,y):a.executeFunctionByName(x.amsDatatableAutofillConstructor,u,g,y));break;case"columnfilter":var k={sPlaceHolder:"head:after"};var l=b.extend({},k,x.amsDatatableColumnfilterOptions,v.columnfilter);l=a.executeFunctionByName(x.amsDatatableColumnfilterInitCallback,u,l)||l;u.data("ams-columnfilter",x.amsDatatableColumnfilterConstructor===undefined?g.columnFilter(l):a.executeFunctionByName(x.amsDatatableColumnfilterConstructor,u,g,l));break;case"editable":var m=b.extend({},x.amsDatatableEditableOptions,v.editable);m=a.executeFunctionByName(x.amsDatatableEditableInitCallback,u,m)||m;u.data("ams-editable",x.amsDatatableEditableConstructor===undefined?u.makeEditable(m):a.executeFunctionByName(x.amsDatatableEditableConstructor,u,g,m));break;case"fixedcolumns":var f=b.extend({},x.amsDatatableFixedcolumnsOptions,v.fixedcolumns);f=a.executeFunctionByName(x.amsDatatableFixedcolumnsInitCallback,u,f)||f;u.data("ams-fixedcolumns",x.amsDatatableFixedcolumnsConstructor===undefined?new b.fn.dataTable.FixedColumns(u,f):a.executeFunctionByName(x.amsDatatableFixedcolumnsConstructor,u,g,f));break;case"fixedheader":var s=b.extend({},x.amsDatatableFixedheaderOptions,v.fixedheader);s=a.executeFunctionByName(x.amsDatatableFixedheadeInitCallback,u,s)||s;u.data("ams-fixedheader",x.amsDatatableFixedheaderConstructor===undefined?new b.fn.dataTable.FixedHeader(u,s):a.executeFunctionByName(x.amsDatatableFixedheaderConstructor,u,g,s));break;case"keytable":var i={table:u.get(0),datatable:g};var q=b.extend({},i,x.amsDatatableKeytableOptions,v.keytable);q=a.executeFunctionByName(x.amsDatatableKeytableInitCallback,u,q)||q;u.data("ams-keytable",x.amsDatatableKeytableConstructor===undefined?new KeyTable(q):a.executeFunctionByName(x.amsDatatableKeytableConstructor,u,g,q));break;case"rowgrouping":var p=b.extend({},x.amsDatatableRowgroupingOptions,v.rowgrouping);p=a.executeFunctionByName(x.amsDatatableRowgroupingInitCallback,u,p)||p;u.data("ams-rowgrouping",x.amsDatatableRowgroupingConstructor===undefined?u.rowGrouping(p):a.executeFunctionByName(x.amsDatatableRowgroupingConstructor,u,g,p));break;case"rowreordering":var o=b.extend({},x.amsDatatableRowreorderingOptions,v.rowreordering);o=a.executeFunctionByName(x.amsDatatableRowreorderingInitCallback,u,o)||o;u.data("ams-rowreordering",x.amsDatatableRowreorderingConstructor===undefined?u.rowReordering(o):a.executeFunctionByName(x.amsDatatableRowreorderingConstructor,u,g,o));break;default:break}}}var t=(x.amsDatatableFinalizeCallback||"").split(/\s+/);if(t.length>0){for(j in t){a.executeFunctionByName(t[j],u,g,v)}}})})}},tablednd:function(d){var c=b(".table-dnd",d);if(c.length>0){a.ajax.check(b.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+a.devext+".js",function(e){c.each(function(){var i=b(this);b(i).on("mouseover","tr",function(){b(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){b(this.cells[0]).removeClass("drag-handle")});var j=i.data();var g={onDragClass:j.amsTabledndDragClass||"dragging-row",onDragStart:j.amsTabledndDragStart,dragHandle:j.amsTabledndDragHandle,scrollAmount:j.amsTabledndScrollAmount,onAllowDrop:j.amsTabledndAllowDrop,onDrop:j.amsTabledndDrop||function(m,o){var l=j.amsTabledndDropTarget;if(l){var k=[];b(m.rows).each(function(){var p=b(this).data("ams-element-name");if(p){k.push(p)}});var n=a.getFunctionByName(l);if(typeof(n)=="function"){n.call(i,m,k)}else{a.ajax.post(l,{names:JSON.stringify(k)})}}return false}};var f=b.extend({},g,j.amsTabledndOptions);f=a.executeFunctionByName(j.amsTabledndInitCallback,i,f)||f;var h=i.tableDnD(f);a.executeFunctionByName(j.amsTabledndAfterInitCallback,i,h,f)})})}},tinymce:function(c){function f(){b(".tinymce",b(this)).each(function(){var g=tinymce.get(b(this).attr("id"));if(g){g.remove()}})}var d=b(".tinymce",c);if(d.length>0){var e=a.baseURL+"ext/tinymce"+(a.devmode?"/dev":"");a.ajax.check(window.tinymce,e+"/tinymce"+a.devext+".js",function(g){if(g){a.getScript(e+"/jquery.tinymce"+a.devext+".js");tinymce.baseURL=e;tinymce.suffix=a.devext;a.skin.registerCleanCallback(f)}d.each(function(){var k=b(this);var n=k.data();var j={theme:"modern",language:a.lang,plugins:["advlist autosave autolink lists link image charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code fullscreen","insertdatetime media nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern"],toolbar1:"newdocument undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",toolbar2:"print preview media | forecolor backcolor emoticons | code fullscreen",content_css:n.amsTinymceContentCss,formats:n.amsTinymceFormats,style_formats:n.amsTinymceStyleFormats,block_formats:n.amsTinymceBlockFormats,valid_classes:n.amsTinymceValidClasses,image_advtab:true,image_list:a.getFunctionByName(n.amsTinymceImageList)||n.amsTinymceImageList,image_class_list:n.amsTinymceImageClassList,link_list:a.getFunctionByName(n.amsTinymceLinkList)||n.amsTinymceLinkList,link_class_list:n.amsTinymceLinkClassList,resize:true};if(n.amsTinymceExternalPlugins){var o=n.amsTinymceExternalPlugins.split(/\s+/);for(var h in o){var m=k.data("ams-tinymce-plugin-"+o[h]);tinymce.PluginManager.load(o[h],a.getSource(m))}}var i=b.extend({},j,n.amsTinymceOptions);i=a.executeFunctionByName(n.amsTinymceInitCallback,k,i)||i;var l=k.tinymce(i);a.executeFunctionByName(n.amsTinymceAfterInitCallback,k,l,i)})})}},imgareaselect:function(d){var c=b(".imgareaselect",d);if(c.length>0){a.ajax.check(b.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.10"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+a.devext+".css")}c.each(function(){var k=b(this);var j=k.data();var h=j.amsImgareaselectParent?k.parents(j.amsImgareaselectParent):"body";var g={instance:true,handles:true,parent:h,x1:j.amsImgareaselectX1||0,y1:j.amsImgareaselectY1||0,x2:j.amsImgareaselectX2||j.amsImgareaselectImageWidth,y2:j.amsImgareaselectY2||j.amsImgareaselectImageHeight,imageWidth:j.amsImgareaselectImageWidth,imageHeight:j.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:j.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(j.amsImgareaselectSelectEnd)||function(l,m){var n=j.amsImgareaselectTargetField||"image_";b('input[name="'+n+'x1"]',h).val(m.x1);b('input[name="'+n+'y1"]',h).val(m.y1);b('input[name="'+n+'x2"]',h).val(m.x2);b('input[name="'+n+'y2"]',h).val(m.y2)}};var f=b.extend({},g,j.amsImgareaselectOptions);f=a.executeFunctionByName(j.amsImgareaselectInitCallback,k,f)||f;var i=k.imgAreaSelect(f);a.executeFunctionByName(j.amsImgareaselectAfterInitCallback,k,i,f);setTimeout(function(){i.update()},250)})})}},fancybox:function(c){var d=b(".fancybox",c);if(d.length>0){a.ajax.check(b.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+a.devext+".css")}d.each(function(){var f=b(this);var m=f.data();var l=(m.amsFancyboxHelpers||"").split(/\s+/);if(l.length>0){for(var g in l){var k=l[g];switch(k){case"buttons":a.ajax.check(b.fancybox.helpers.buttons,a.baseURL+"ext/fancybox-helpers/fancybox-buttons"+a.devext+".js");break;case"thumbs":a.ajax.check(b.fancybox.helpers.thumbs,a.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+a.devext+".js");break;case"media":a.ajax.check(b.fancybox.helpers.media,a.baseURL+"ext/fancybox-helpers/fancybox-media"+a.devext+".js");break;default:break}}}var i={type:m.amsFancyboxType,padding:m.amsFancyboxPadding||10,margin:m.amsFancyboxMargin||10,beforeLoad:a.getFunctionByName(m.amsFancyboxBeforeLoad)||function(){this.title=a.executeFunctionByName(m.amsFancyboxTitleGetter,this)||b(this.element).attr("original-title")||b(this.element).attr("title")},helpers:{title:{type:"inside"}}};var h=b.extend({},i,m.amsFancyboxOptions);h=a.executeFunctionByName(m.amsFancyboxInitCallback,f,h)||h;var j=f.fancybox(h);a.executeFunctionByName(m.amsFancyboxAfterInitCallback,f,j,h)})})}},graphs:function(d){var c=b(".sparkline",d);if(c.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+a.devext+".js",function(){a.graphs.init(c)})}},scrollbars:function(c){var d=b(".scrollbar",c);if(d.length>0){a.ajax.check(b.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(b.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}d.each(function(){var j=b(this);var i=j.data();var g={theme:i.amsScrollbarTheme||"light"};var f=b.extend({},g,i.amsScrollbarOptions);f=a.executeFunctionByName(i.amsScrollbarInitCallback,j,f)||f;var h=j.mCustomScrollbar(f);a.executeFunctionByName(i.amsScrollbarAfterInitCallback,j,h,f)})})})}}}};MyAMS.callbacks={init:function(c){b("[data-ams-callback]",c).each(function(){var d=this;var e=b(d).data();var f=a.getFunctionByName(e.amsCallback);if(f===undefined){if(e.amsCallbackSource){a.getScript(e.amsCallbackSource,function(){a.executeFunctionByName(e.amsCallback,d,e.amsCallbackOptions)})}else{if(window.console){console.warn("Undefined callback: "+e.amsCallback)}}}else{f.call(d,e.amsCallbackOptions)}})},alert:function(k){var f=b(this).data();var c=b.extend({},k,f.amsAlertOptions);var i=b(f.amsAlertParent||c.parent||this);var e=f.amsAlertStatus||c.status||"info";var g=f.amsAlertHeader||c.header;var j=f.amsAlertMessage||c.message;var h=f.amsAlertSubtitle||c.subtitle;var d=f.amsAlertMargin===undefined?(c.margin===undefined?false:c.margin):f.amsAlertMargin;a.skin.alert(i,e,g,j,h,d)},messageBox:function(d){var g=b(this).data();var f=b.extend({},d,g.amsMessageboxOptions);var e=b.extend({},f,{title:g.amsMessageboxTitle||f.title||"",content:g.amsMessageboxContent||f.content||"",icon:g.amsMessageboxIcon||f.icon,number:g.amsMessageboxNumber||f.number,timeout:g.amsMessageboxTimeout||f.timeout});var c=g.amsMessageboxStatus||f.status||"info";var h=a.getFunctionByName(g.amsMessageboxCallback||f.callback);a.skin.messageBox(c,e,h)},smallBox:function(d){var g=b(this).data();var f=b.extend({},d,g.amsSmallboxOptions);var e=b.extend({},f,{title:g.amsSmallboxTitle||f.title||"",content:g.amsSmallboxContent||f.content||"",icon:g.amsSmallboxIcon||f.icon,iconSmall:g.amsSmallboxIconSmall||f.iconSmall,timeout:g.amsSmallboxTimeout||f.timeout});var c=g.amsSmallboxStatus||f.status||"info";var h=a.getFunctionByName(g.amsSmallboxCallback||f.callback);a.skin.smallBox(c,e,h)}};MyAMS.events={init:function(c){b("[data-ams-events-handlers]",c).each(function(){var e=b(this);var d=e.data("ams-events-handlers");for(var f in d){e.on(f,a.getFunctionByName(d[f]))}})}};MyAMS.container={changeOrder:function(d,e){var c=b('input[name="'+b(this).data("ams-input-name")+'"]',b(this));c.val(e.join(";"))},deleteElement:function(c){return function(){var d=b(this);MyAMS.skin.bigBox({title:a.i18n.WARNING,content:'  '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(g){if(g==a.i18n.BTN_OK){var i=d.parents("table");var f=i.data("ams-location")||"";var j=d.parents("tr");var h=j.data("ams-delete-target")||i.data("ams-delete-target")||"delete-element.json";var e=j.data("ams-element-name");MyAMS.ajax.post(f+"/"+h,{object_name:e},function(k,l){if(k.status=="success"){if(i.hasClass("datatable")){i.dataTable().fnDeleteRow(j[0])}else{j.remove()}}})}})}}};MyAMS.skin={_setPageHeight:function(){var e=b("#main").height();var c=a.left_panel.height();var d=b(window).height()-a.navbar_height;if(e>d){a.left_panel.css("min-height",e);a.root.css("min-height",e+a.navbar_height)}else{a.left_panel.css("min-height",d);a.root.css("min-height",d)}},_checkMobileWidth:function(){if(b(window).width()<979){a.root.addClass("mobile-view-activated")}else{if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("mobile-view-activated")}}},_showShortcutButtons:function(){a.shortcuts.animate({height:"show"},200,"easeOutCirc");a.root.addClass("shortcut-on")},_hideShortcutButtons:function(){a.shortcuts.animate({height:"hide"},300,"easeOutCirc");a.root.removeClass("shortcut-on")},checkNotification:function(){$this=b("#activity > .badge");if(parseInt($this.text())>0){$this.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{$this.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},_initDesktopWidgets:function(c){if(a.enable_widgets){var d=b(".ams-widget",c);if(d.length>0){a.ajax.check(b.fn.MyAMSWidget,a.baseURL+"myams-widgets"+a.devext+".js",function(){d.each(function(){var h=b(this);var g=h.data();var f={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var e=b.extend({},f,g.amsWidgetOptions);e=a.executeFunctionByName(g.amsWidgetInitcallback,h,e)||e;h.MyAMSWidget(e)});MyAMSWidget.initWidgetsGrid(b(".ams-widget-grid",c))})}}},_initMobileWidgets:function(c){if(a.enable_mobile&&a.enable_widgets){a.skin._initDesktopWidgets(c)}},alert:function(j,d,e,k,i,c){b(".alert",j).remove();if(d=="error"){d="danger"}var g='

    '+e+"

    "+(i?("

    "+i+"

    "):"");if(typeof(k)=="string"){g+="
    • "+k+"
    "}else{if(k){g+="
      ";for(var f in k){if(!b.isNumeric(f)){continue}g+="
    • "+k[f]+"
    • "}g+="
    "}}g+="
    ";var h=b(g).prependTo(j);if(j.exists){a.ajax.check(b.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){b.scrollTo(j,{offset:{top:-50}})})}},bigBox:function(c,d){a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){a.notify.messageBox(c,d)})},messageBox:function(c,d,e){if(typeof(c)=="object"){e=d;d=c||{};c="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(c){case"error":case"danger":d.color="#C46A69";break;case"warning":d.color="#C79121";break;case"success":d.color="#739E73";break;default:d.color=d.color||"#3276B1"}d.sound=false;a.notify.bigBox(d,e)})},smallBox:function(c,d,e){if(typeof(c)=="object"){e=d;d=c||{};c="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(c){case"error":case"danger":d.color="#C46A69";break;case"warning":d.color="#C79121";break;case"success":d.color="#739E73";break;default:d.color=d.color||"#3276B1"}d.sound=false;a.notify.smallBox(d,e)})},_drawBreadCrumb:function(){var c=b("#ribbon OL.breadcrumb");c.empty().append(b("
  • ").append(b("").text(a.i18n.HOME).attr("href",b('nav a[href!="#"]:first').attr("href"))));b("nav LI.active >A").each(function(){var f=b(this);var d=b.trim(f.clone().children(".badge").remove().end().text());var e=b("
  • ").append(f.attr("href").replace(/^#/,"")?b("").html(d).attr("href",f.attr("href")):d);c.append(e)})},checkURL:function(){function c(i){b("nav .active").removeClass("active");i.addClass("open").addClass("active");i.parents("li").addClass("open active").children("ul").addClass("active").show();i.parents("li:first").removeClass("open");i.parents("ul").addClass(i.attr("href").replace(/^#/,"")?"active":"").show()}var f=location.hash;var e=f.replace(/^#/,"");if(e){var d=b("#content");if(!d.exists()){d=b("body")}var g=b('nav A[href="'+f+'"]');if(g.exists()){c(g)}a.skin.loadURL(e,d);document.title=b("[data-ams-page-title]:first",d).data("ams-page-title")||g.attr("title")||document.title}else{var h=b("[data-ams-active-menu]").data("ams-active-menu");if(h){g=b('nav A[href="'+h+'"]')}else{g=b('nav >UL >LI >A[href!="#"]').first()}if(g.exists()){c(g);if(h){a.skin._drawBreadCrumb()}else{window.location.hash=g.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(d){var c=a.skin._clean_callbacks;if(c.indexOf(d)<0){c.push(d)}},cleanContainer:function(c){var e=a.skin._clean_callbacks;for(var d in e){e[d].call(c)}},loadURL:function(e,c,d,h){if(e.startsWith("#")){e=e.substr(1)}if(typeof(d)=="function"){h=d;d={}}c=b(c);var g={type:"GET",url:e,dataType:"html",cache:false,beforeSend:function(){a.skin.cleanContainer(c);c.html('

    Loading...

    ');if(c[0]==b("#content")[0]){a.skin._drawBreadCrumb();document.title=b(".breadcrumb LI:last-child").text();b("html, body").animate({scrollTop:0},"fast")}else{c.animate({scrollTop:0},"fast")}},success:function(m,j,l){if(h){a.executeFunctionByName(h,this,m,j,l,d)}else{var k=a.ajax.getResponse(l);var n=k.content_type;var i=k.data;b(".loading",c).remove();switch(n){case"json":a.ajax.handleJSON(i,c);break;case"script":break;case"xml":break;case"html":case"text":default:c.parents(".hidden").removeClass("hidden");b(".alert",c.parents(".alerts-container")).remove();c.css({opacity:"0.0"}).html(m).removeClass("hidden").delay(50).animate({opacity:"1.0"},300);a.initContent(c)}if(d&&d.afterLoadCallback){a.executeFunctionByName(d.afterLoadCallback,this)}}},error:function(k,j,i){c.html('

    '+a.i18n.ERROR+i+"

    "+k.responseText)},async:false};var f=b.extend({},g,d);b.ajax(f)},setLanguage:function(d){var f=d.lang;var e=d.handler_type||"json";switch(e){case"json":var g=d.method||"setUserLanguage";a.jsonrpc.post(g,{lang:f},function(){window.location.reload(true)});break;case"ajax":var c=d.href||"setUserLanguage";a.ajax.post(c,{lang:f},function(){window.location.reload(true)});break}},logout:function(){window.location=a.loginURL}};MyAMS.initPage=function(){var c=b("body");a.root=c;a.left_panel=b("#left-panel");a.shortcuts=b("#shortcut");a.plugins.initData(c);var d=b.ajaxSettings.xhr;b.ajaxSetup({progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var f=d();if(f&&(typeof(f.addEventListener)=="function")){var e=this;f.addEventListener("progress",function(g){e.progress(g)},false)}return f}});b(document).ajaxStart(a.ajax.start);b(document).ajaxStop(a.ajax.stop);b(document).ajaxError(a.error.ajax);if(!a.isMobile){a.root.addClass("desktop-detected");a.device="desktop"}else{a.root.addClass("mobile-detected");a.device="mobile";if(a.enable_fastclick){a.ajax.check(b.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){b("NAV UL A").noClickDelay();b("#hide-menu A").noClickDelay()})}}b("#hide-menu >:first-child > A").click(function(f){c.toggleClass("hidden-menu");f.preventDefault()});b("#show-shortcut").click(function(f){if(a.shortcuts.is(":visible")){a.skin._hideShortcutButtons()}else{a.skin._showShortcutButtons()}f.preventDefault()});b(document).mouseup(function(f){if(!a.shortcuts.is(f.target)&&a.shortcuts.has(f.target).length===0){a.skin._hideShortcutButtons()}});b("#search-mobile").click(function(){a.root.addClass("search-mobile")});b("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")});b("#activity").click(function(g){var f=b(this);var h=f.next(".ajax-dropdown");if(!h.is(":visible")){h.css("left",f.position().left-h.innerWidth()/2+f.innerWidth()/2).fadeIn(150);f.addClass("active")}else{h.fadeOut(150);f.removeClass("active")}g.preventDefault()});a.skin.checkNotification();b(document).mouseup(function(f){var g=b(".ajax-dropdown");if(!g.is(f.target)&&g.has(f.target).length===0){g.fadeOut(150).prev().removeClass("active")}});b('input[name="activity"]').change(function(){var e=b(this).data("ams-url");container=b(".ajax-notifications");a.skin.loadURL(e,container)});b("#logout a").click(function(f){f.preventDefault();f.stopPropagation();a.loginURL=b(this).attr("href");a.skin.bigBox({title:" "+a.i18n.LOGOUT+" "+b("#show-shortcut").text()+" ?",content:a.i18n.LOGOUT_COMMENT,buttons:"["+a.i18n.BTN_NO+"]["+a.i18n.BTN_YES+"]"},function(e){if(e==a.i18n.BTN_YES){a.root.addClass("animated fadeOutUp");setTimeout(a.skin.logout,1000)}})});b("NAV UL").myams_menu({accordion:true,speed:a.menu_speed});b(".minifyme").click(function(f){b("BODY").toggleClass("minified");b(this).effect("highlight",{},500);f.preventDefault()});b("#refresh").click(function(f){a.skin.bigBox({title:" "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(e){if(e==a.i18n.BTN_OK&&localStorage){localStorage.clear();location.reload()}});f.preventDefault()});c.on("click",function(g){var f=b(this);if(!f.is(g.target)&&f.has(g.target).length===0&&b(".popover").has(g.target).length===0){f.popover("hide")}});a.ajax.check(b.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){b("#main").resize(function(){a.skin._setPageHeight();a.skin._checkMobileWidth()});b("nav").resize(function(){a.skin._setPageHeight()})});if(a.ajax_nav){b(document).on("click",'a[href="#"]',function(f){f.preventDefault()});b(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(j){var h=b(j.currentTarget);var f=h.attr("href")||h.data("ams-url");if(!f||f.startsWith("javascript:")||h.attr("target")||(h.data("ams-context-menu")===true)){return}j.preventDefault();j.stopPropagation();var g=a.getFunctionByName(f);if(typeof(g)=="function"){f=g.call(h)}if(typeof(f)=="function"){f.call(h)}else{f=f.replace(/\%23/,"#");var i=h.data("ams-target");if(i){a.form.confirmChangedForm(i,function(){a.skin.loadURL(f,i,h.data("ams-link-options"),h.data("ams-link-callback"));j.stopPropagation()})}else{a.form.confirmChangedForm(function(){if(f.startsWith("#")){if(f!=location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=f},150)}else{window.location.hash=f}}}else{window.location=f}})}}});b(document).on("click",'a[target="_blank"]',function(f){f.preventDefault();window.open(b(f.currentTarget).attr("href"))});b(document).on("click",'a[target="_top"]',function(f){f.preventDefault();a.form.confirmChangedForm(function(){window.location=b(f.currentTarget).attr("href")})});b(window).on("hashchange",a.skin.checkURL)}b(document).off("click.modal").on("click",'[data-toggle="modal"]',function(g){var f=b(this);if(f.data("ams-context-menu")===true){return}if(f.data("ams-stop-propagation")===true){g.stopPropagation()}g.preventDefault();a.dialog.open(f);if(f.parents("#shortcut").exists()){setTimeout(a.skin._hideShortcutButtons,300)}});b(document).on("click",'button[type="submit"], button.submit',function(){var e=b(this);b(e.get(0).form).data("ams-submit-button",e)});b(document).on("click","[data-ams-click-handler]",function(h){var g=b(this);var f=g.data();if(f.amsClickHandler){if((f.amsStopPropagation===true)||(f.amsClickStopPropagation===true)){h.stopPropagation()}if(f.amsClickKeepDefault!==true){h.preventDefault()}var i=a.getFunctionByName(f.amsClickHandler);if(i!==undefined){i.call(g,f.amsClickHandlerOptions)}}});b(document).on("change","[data-ams-change-handler]",function(h){var g=b(this);var f=g.data();if(f.amsChangeHandler){if(f.amsChangeKeepDefault!==true){h.preventDefault()}var i=a.getFunctionByName(f.amsChangeHandler);if(i!==undefined){i.call(g,f.amsChangeHandlerOptions)}}});b(document).on("reset","[data-ams-reset-handler]",function(h){var f=b(this);var g=f.data();if(g.amsResetHandler){if(g.amsResetKeepDefault!==true){h.preventDefault()}var i=a.getFunctionByName(g.amsResetHandler);if(i!==undefined){i.call(f,g.amsResetHandlerOptions)}}});b(document).on("change",'input[type="file"]',function(h){h.preventDefault();var f=b(this);var g=f.parent(".button");if(g.exists()&&g.parent().hasClass("input-file")){g.next('input[type="text"]').val(f.val())}});b(document).on("focusin",function(f){if(b(f.target).closest(".mce-window").length){f.stopImmediatePropagation()}});b("a[data-toggle=tab]",".nav-tabs").on("click",function(f){if(b(this).parent("li").hasClass("disabled")){f.preventDefault();return false}});b(document).on("show.bs.tab",function(h){var f=b(h.target);var g=f.data();if(g.amsUrl){if(g.amsTabLoaded){return}a.skin.loadURL(g.amsUrl,f.attr("href"));if(g.amsTabLoadOnce){f.data("ams-tab-loaded",true)}}});a.initContent(document);if(a.ajax_nav&&(b("nav").length>0)){a.skin.checkURL()}b(window).on("beforeunload",a.form.checkBeforeUnload)};MyAMS.initContent=function(c){b(".tipsy").remove();b("[rel=tooltip]",c).tooltip();b("[rel=popover]",c).popover();b("[rel=popover-hover]",c).popover({trigger:"hover"});a.plugins.init(c);a.callbacks.init(c);a.events.init(c);a.form.init(c);if(a.device==="desktop"){a.skin._initDesktopWidgets(c)}else{a.skin._initMobileWidgets(c)}a.skin._setPageHeight()};MyAMS.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",FORM_CHANGED_WARNING:"Some changes were not saved. These updates will be lost if you leave this page.",DELETE_WARNING:"This change can't be undone. Are you sure that you want to delete this element?",NO_UPDATE:"No changes were applied.",DATA_UPDATED:"Data successfully updated.",HOME:"Home",LOGOUT:"Logout?",LOGOUT_COMMENT:"You can improve your security further after logging out by closing this opened browser",SELECT2_PLURAL:"s",SELECT2_MATCH:"One result is available, press enter to select it.",SELECT2_MATCHES:" results are available, use up and down arrow keys to navigate.",SELECT2_NOMATCHES:"No matches found",SELECT2_SEARCHING:"Searching...",SELECT2_LOADMORE:"Loading more results...",SELECT2_INPUT_TOOSHORT:"Please enter {0} more character{1}",SELECT2_INPUT_TOOLONG:"Please delete {0} character{1}",SELECT2_SELECTION_TOOBIG:"You can only select {0} item{1}",SELECT2_FREETAG_PREFIX:"Free text: ",DT_COLUMNS:"Columns"};b(document).ready(function(){b=jQuery.noConflict();var c=b("HTML");var d=c.attr("lang")||c.attr("xml:lang");if(d&&!d.startsWith("en")){MyAMS.lang=d;MyAMS.getScript(MyAMS.baseURL+"i18n/myams_"+d.substr(0,2)+".js",function(){MyAMS.initPage()})}else{MyAMS.initPage()}})})(jQuery); \ No newline at end of file diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/less/forms.less --- a/src/pyams_skin/resources/less/forms.less Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/resources/less/forms.less Wed Jun 17 10:00:10 2015 +0200 @@ -851,6 +851,12 @@ .form-group { padding: 5px 10px; } + &.form-tight, + & .form-tight { + .form-group { + padding: 1px 10px; + } + } label { &.checkbox, &.radio { @@ -1304,6 +1310,25 @@ line-height: 1em; } } + .input span.textarea-widget, + .textarea span.textarea-widget { + display: block; + width: 100%; + min-height: 14px; + padding: 4px 0; + border-bottom: 1px solid #ccc!important; + } + .input .i18n-content input, + .select .i18n-content select, + .textarea .i18n-content textarea { + &[readonly] { + border-width: 0!important; + } + } + .input .i18n-content .textarea-widget { + display: block; + min-height: 12px; + } .input input:focus + .tooltip, .textarea textarea:focus + .tooltip { opacity: 1; @@ -2641,6 +2666,10 @@ } } +.mce-edit-area >iframe { + min-height: 400px!important; +} + .client-form header { padding: 15px 13px; margin: 0; diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/less/menus.less --- a/src/pyams_skin/resources/less/menus.less Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/resources/less/menus.less Wed Jun 17 10:00:10 2015 +0200 @@ -116,7 +116,7 @@ margin: 0; display: none; background: rgba(91,103,113,0.8); - padding: 7px 0; + padding: 2px 0; >li:hover b { color: #D5D9E2; @@ -125,6 +125,11 @@ margin: 0; padding: 0; + &.divider { + height: 1px; + margin-left: 30px; + padding: 0; + } >a { padding-left: 42px; font-size: 12px; diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/less/modal.less --- a/src/pyams_skin/resources/less/modal.less Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/resources/less/modal.less Wed Jun 17 10:00:10 2015 +0200 @@ -7,6 +7,7 @@ position: fixed; width: 100%; height: 100%; + z-index: 990; } .modal-dialog { @@ -32,6 +33,11 @@ max-width: 450px; } } + .modal-body { + .modal-viewport { + min-height: 140px; + } + } .suffix { .alert { margin-bottom: 0; diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/less/tables.less --- a/src/pyams_skin/resources/less/tables.less Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/resources/less/tables.less Wed Jun 17 10:00:10 2015 +0200 @@ -46,6 +46,13 @@ line-height: 1.3!important; } } +.table-small { + td, + th { + padding: 2px 8px!important; + line-height: 1.2!important; + } +} .table-mini { td, th { diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/resources/less/widgets.less --- a/src/pyams_skin/resources/less/widgets.less Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/resources/less/widgets.less Wed Jun 17 10:00:10 2015 +0200 @@ -303,6 +303,11 @@ >h2 { margin-left: 10px; float: left; + + & + .btn, + & + .btn-group { + margin-left: 20px; + } } .rtl & { padding: 0 7px 0 0; @@ -348,12 +353,12 @@ margin: 0; padding: 13px 13px 0; background-color: #fff !important; - border-width: 1px 1px 2px; + border-width: 1px; border-style: solid; + border-color: #ccc!important; + } + >header+div { border-top: 0; - border-right-color: #CCC !important; - border-bottom-color: #CCC !important; - border-left-color: #CCC !important; } .widget-body { position: relative; @@ -1120,7 +1125,7 @@ display: list-item; background-image: none; - &.select2-result-with-children>.select2-result-label { + &.select2-result-with-children >.select2-result-label { font-weight: 700; } } @@ -1274,7 +1279,7 @@ } .select2-search-choice { padding: 1px 28px 1px 8px; - margin: 2px 0 2px 2px; + margin: 2px; position: relative; line-height: 18px; color: #fff; @@ -1298,6 +1303,10 @@ } &.ui-sortable-handle { cursor: move; + + .with-icons & { + margin-right: 1px; + } } } } @@ -1305,6 +1314,7 @@ .select2-choices { li { float: none; + cursor: move; &.ui-state-highlight { margin: 2px 0 2px 2px; @@ -1414,8 +1424,8 @@ } } label.with-icon { - >i.icon-append + .select2-parent { - .select2-choices { + >i.icon-append +.select2-parent { + >.select2-choices { padding-right: 29px; } } diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/table.py --- a/src/pyams_skin/table.py Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/table.py Wed Jun 17 10:00:10 2015 +0200 @@ -68,7 +68,8 @@ return {'tr': {'id': lambda x: '{0}::{1}'.format(self.id, getattr(x, '__name__', '')), 'data-ams-element-name': lambda x: getattr(x, '__name__', None), 'data-ams-url': lambda x: getattr(get_element_editor(self, x), 'url', None), - 'data-toggle': lambda x: 'modal' if getattr(get_element_editor(self, x), 'modal_target', None) else None}} + 'data-toggle': lambda x: 'modal' if getattr(get_element_editor(self, x), 'modal_target', None) + else None}} batchSize = 10000 startBatchingAt = 10000 @@ -177,7 +178,7 @@ permission = None def renderCell(self, item): - if self.permission and not self.request.has_permission(self.permission): + if self.permission and not self.request.has_permission(self.permission, context=item): return '' if self.checker: if callable(self.checker): @@ -211,6 +212,13 @@ return self.url +class ImageColumn(ActionColumn): + """Simple image column""" + + def renderCell(self, item): + return self.get_icon(item) + + @adapter_config(name='actions', context=(Interface, IPyAMSLayer, ITableWithActions), provides=IColumn) class MenuActionsColumn(I18nColumn, Column): """Menu actions column""" diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/templates/header.pt --- a/src/pyams_skin/templates/header.pt Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/templates/header.pt Wed Jun 17 10:00:10 2015 +0200 @@ -1,8 +1,8 @@ + condition="header" i18n:domain="pyams_skin">

    @@ -10,9 +10,15 @@ +
    +

    diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/templates/layout.pt --- a/src/pyams_skin/templates/layout.pt Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/templates/layout.pt Wed Jun 17 10:00:10 2015 +0200 @@ -1,5 +1,5 @@ - - + diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/templates/table.pt --- a/src/pyams_skin/templates/table.pt Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/templates/table.pt Wed Jun 17 10:00:10 2015 +0200 @@ -1,10 +1,11 @@ -
    -
    +
    +

    +
    diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/templates/widget-layout.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/templates/widget-layout.pt Wed Jun 17 10:00:10 2015 +0200 @@ -0,0 +1,16 @@ + + +
    +
    + + +

    Title

    + + +
    +
    + +
    +
    diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/viewlet/shortcuts/__init__.py --- a/src/pyams_skin/viewlet/shortcuts/__init__.py Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/viewlet/shortcuts/__init__.py Wed Jun 17 10:00:10 2015 +0200 @@ -31,6 +31,7 @@ @viewletmanager_config(name='pyams.shortcuts', layer=IPyAMSLayer, provides=IShortcutsViewletManager) @template_config(template='manager.pt', layer=IPyAMSLayer) +@implementer(IShortcutsViewletManager) class ShortcutsViewletManager(TemplateBasedViewletManager, WeightOrderedViewletManager): """Shortcuts viewlet manager""" @@ -42,6 +43,7 @@ bg_color_class = FieldProperty(IShortcut['bg_color_class']) icon_class = FieldProperty(IShortcut['icon_class']) + label = FieldProperty(IShortcut['label']) url = FieldProperty(IShortcut['url']) target = FieldProperty(IShortcut['target']) modal_target = FieldProperty(IShortcut['modal_target']) @@ -56,7 +58,7 @@ except ImportError: pass else: - @viewlet_config(name='admin.shortcut', manager=ShortcutsViewletManager, + @viewlet_config(name='admin.shortcut', manager=IShortcutsViewletManager, layer=IPyAMSLayer, permission='system.view', weight=9999) class ManagementInterfaceShortcut(Shortcut): """Access to management interface""" diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/viewlet/toolbar/__init__.py --- a/src/pyams_skin/viewlet/toolbar/__init__.py Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/viewlet/toolbar/__init__.py Wed Jun 17 10:00:10 2015 +0200 @@ -18,7 +18,7 @@ # import interfaces from pyams_skin.interfaces.container import ITableWithActions from pyams_skin.interfaces.viewlet import IToolbarViewletManager, IToolbarAction, IToolbarMenu, IToolbarMenuItem, \ - IContextActions, IToolbarAddingMenu, ITableItemColumnActionsMenu + IContextActions, IToolbarAddingMenu, ITableItemColumnActionsMenu, IWidgetTitleViewletManager from pyams_skin.layer import IPyAMSLayer from pyams_utils.interfaces.tales import ITALESExtension from zope.contentprovider.interfaces import IContentProvider @@ -35,6 +35,11 @@ from pyams_skin import _ +@viewletmanager_config(name='pyams.widget_title', view=Interface, layer=IPyAMSLayer, provides=IWidgetTitleViewletManager) +class WidgetTitleViewletManager(WeightOrderedViewletManager): + """Widget title extensions viewlet manager""" + + @viewletmanager_config(name='pyams.toolbar', view=Interface, layer=IPyAMSLayer, provides=IToolbarViewletManager) @template_config(template='manager.pt', layer=IPyAMSLayer) class TableToolbarViewletManager(TemplateBasedViewletManager, WeightOrderedViewletManager): @@ -84,13 +89,15 @@ return Viewlet.render(self) -@viewlet_config(name='pyams.addings', view=Interface, layer=IPyAMSLayer, manager=IToolbarViewletManager) +@viewlet_config(name='pyams.addings', view=Interface, layer=IPyAMSLayer, manager=IWidgetTitleViewletManager, weight=50) @viewletmanager_config(name='pyams.addings', view=Interface, layer=IPyAMSLayer, provides=IToolbarAddingMenu) @implementer(IToolbarAddingMenu) class ToolbarAddingMenu(ToolbarMenu): """Toolbar adding menu""" label = _("Add...") + css_class = 'btn btn-xs btn-success dropdown-toggle' + menu_css_class = 'dropdown-menu' @viewletmanager_config(name='pyams.table-item.actions', view=ITableWithActions, layer=IPyAMSLayer, @@ -136,12 +143,14 @@ css_class = 'divider' +@viewlet_config(name='pyams.actions', view=Interface, layer=IPyAMSLayer, manager=IToolbarViewletManager, weight=999) @viewletmanager_config(name='pyams.actions', view=Interface, layer=IPyAMSLayer, provides=IContextActions) @template_config(template='menu.pt', layer=IPyAMSLayer) @implementer(IContextActions) class ContextActionsViewletManager(ToolbarMenu): """Context actions viewlet manager""" + label = _("Other actions...") css_class = FieldProperty(IContextActions['css_class']) diff -r fd8fb93e1b6a -r a361355b55c7 src/pyams_skin/viewlet/toplinks/__init__.py --- a/src/pyams_skin/viewlet/toplinks/__init__.py Wed May 20 15:01:45 2015 +0200 +++ b/src/pyams_skin/viewlet/toplinks/__init__.py Wed Jun 17 10:00:10 2015 +0200 @@ -71,7 +71,7 @@ if self.css_class == 'divider': return '
  • ' else: - label = self.request.localizer.translate(self.label, context=self.request) + label = self.request.localizer.translate(self.label) return '''
  • {3}
  • '''.format(self.css_class, @@ -83,7 +83,7 @@ data = self.data.copy() if self.click_handler: data.update({'data-ams-click-handler': self.click_handler}) - return ' '.join('%s=%s' % item for item in data.iteritems()) + return ' '.join('%s=%s' % item for item in data.items()) #